K
Kevin Olemoh
Hello I have been using ruby off and on for a few months and I have been
having a great time with the language but a few things bother me about
the syntax of the language itself. The two glaring issues are:
1. The syntax errors generated by the following code:
a.each
do
#stuff
end
for reasons I do not understand ruby demands that, that line be written as:
a.each do
#stuff
end
Quite frankly I find the second form to be more difficult to read
especially if one tends to create blocks with braces rather than the do
end keywords like I do. Is there some specific reason that both forms
are not supported by Ruby? It is needlessly restrictive with respect to
formatting in my opinion, perhaps a kind ruby-core developer could sneak
this syntax change into a future release?
2. What is with the elseif syntax specifically why is it elsif instead
of elseif when ruby already has an else keyword? I can't count how many
times I got errors because I decided to type elseif instead of elsif
while doing something with an if statement. I can name at least two
popular languages that use elseif not to mention the fact that if
English is your first language you will probably spell out else without
even realizing it since that is the correct way to spell the word in
English. Yes I know its a minor thing but if no one voices their
gripes how do people know something might need a bit of tweaking?
having a great time with the language but a few things bother me about
the syntax of the language itself. The two glaring issues are:
1. The syntax errors generated by the following code:
a.each
do
#stuff
end
for reasons I do not understand ruby demands that, that line be written as:
a.each do
#stuff
end
Quite frankly I find the second form to be more difficult to read
especially if one tends to create blocks with braces rather than the do
end keywords like I do. Is there some specific reason that both forms
are not supported by Ruby? It is needlessly restrictive with respect to
formatting in my opinion, perhaps a kind ruby-core developer could sneak
this syntax change into a future release?
2. What is with the elseif syntax specifically why is it elsif instead
of elseif when ruby already has an else keyword? I can't count how many
times I got errors because I decided to type elseif instead of elsif
while doing something with an if statement. I can name at least two
popular languages that use elseif not to mention the fact that if
English is your first language you will probably spell out else without
even realizing it since that is the correct way to spell the word in
English. Yes I know its a minor thing but if no one voices their
gripes how do people know something might need a bit of tweaking?