C
Chris Dew
As far as I can see, the 'end' keyword is 'repeating yourself' when
used with properly indented code.
class Foo
def bar(value)
if value < 7
puts "hello"
else
puts "world"
end
end
def foobar
puts "foobar"
end
end
could be
class Foo
def bar(value)
if value < 7
puts "hello"
else
puts "world"
def foobar
puts "foobar"
with no reduction in meaning, yet 25% fewer lines of code.
What are the reasons why this isn't used/implemented/liked? It would
be a small change to the interpreter. Enabling meaningful indentation
would only make 'end' optional, not invalid; backwards compatibility
wouldn't be a problem.
(I use both Ruby and Python. I think indentation is one of the few
*language* features where Python leads Ruby.)
If this post generates a positive response, I'll make a patch for Ruby
1.9.
used with properly indented code.
class Foo
def bar(value)
if value < 7
puts "hello"
else
puts "world"
end
end
def foobar
puts "foobar"
end
end
could be
class Foo
def bar(value)
if value < 7
puts "hello"
else
puts "world"
def foobar
puts "foobar"
with no reduction in meaning, yet 25% fewer lines of code.
What are the reasons why this isn't used/implemented/liked? It would
be a small change to the interpreter. Enabling meaningful indentation
would only make 'end' optional, not invalid; backwards compatibility
wouldn't be a problem.
(I use both Ruby and Python. I think indentation is one of the few
*language* features where Python leads Ruby.)
If this post generates a positive response, I'll make a patch for Ruby
1.9.