Just a small request
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Just a small request
- From: Hugo Etchegoyen <hetchegoyen@...>
- Date: 2007年1月24日 17:04:35 -0300
I have been working with Lua for
only a few weeks, and I like the language a lot. It offers a wonderful
combination of size, speed, simplicity, ease of learning and openness
so that anybody can extend it and tweak it to taste.
But being a seasoned C/C++ programmer, there is only one thing I miss a
lot: a continue statement! Please, please, I know that people
asking for new features to be added to a language usually annoy its
designers, and generally for good reason. But I honestly think this
would be a great addition which would cost practically nothing and
would benefit the language and make it more coherent.
Pascal was a coherent language: it religiously avoided anything that
could break the structured flow of control, so it did not have returns,
continues or breaks. It did not even have elseif! That is why most
Pascal programs are unreadable when they have more than two or three
levels of nested ifs and they tend to overflow the right margin unless
programmers use ugly and confusing indentation tricks.
Clearly Lua is more like C, since it has return and break. But the
absence of continue complicates the body of loops. Consider this loop,
for example:
for i = 1 to somevalue
do
if some_condition then
...
...
...
end
end
Wouldn't this be nicer?
for i = 1 to somevalue do
if not some_condition(i) then continue end
...
...
...
end
I know it's
a matter of taste, but also of coherence. IMO Pascal was coherent (but
ugly) and Lua is beautiful but still lacks this last touch.
Regards,
Hugo Etchegoyen