lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 1/25/06, Chris Marrin <> wrote:
> I have been flipping back and forth between Lua and C++ lately and the
> most painful things are:
> - different comment syntax
> - ~= vs !=
> - 'and' and 'or' rather than '&&' and '||'
> - the required 'then' keyword
> - Using ':' rather than '.' in function calls
The interesting thing, that C++ _does_ supports "and" and "or"
keywords by standard. Just try to #include <iso646> :)

About syntax flame - I personally don't mind lua syntax, at least no
comments one. I have no difficulty typing -- instead of //, I don't
even confuse them (probably because editors with syntax highlighting).
The thing I confuse from time to time is ~= because resembles a lot a
Perl's match operator =~. So every time I type it, I need to stop and
thinks, which side "~" has to go to :) But again, I think that my
habits are my personal problems, I would not expect language to change
according to my taste. :)

And regarding switch operator - I definitely against it. In C it is
unavoidable, but in higher-level languages using "switch" is
considered as bad practice. Personally, in my C++ programs, I ban
switch completely, using hash_map<key,func> instead in most cases. It
gives much more clear and structured code, then huge switch
dispatchers. And in Lua it comes even more easily and naturally, so
why to present something that will encourage bad style programming?

Best regards,