lua-users home
lua-l archive

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


This could very easily be done as a pre-processor written in Lua...

I personally like the Python syntax .. Python tends to be very legible. But I
really don't like the way they mix tabs and spaces. It seems to me that the
parser doesn't know until it's read a few lines of the file wether to use
spaces or tabs or both.

In Lua, it also leads to somewhat unattractive things like:

for i in obj:iterator():
	do_stuff(i)

Two colons on the same line? That mean completely different things? Ugh. Maybe
you could make "do" the beginning of a block.

Besides, one of the nice things about Lua is its size, right? With the current
syntax, you could strip all the whitespace out of a lua file and insert some
necessary semi-colons, then gzip the whole thing, resulting in a very small
source ... there's no way to do that if whitespace is significant.

But your idea is just deranged enough that I kinda like it. :)

Serge Semashko said:
> It is interesting what would you think about making some changes to
> lua lexer to support indentation for statements grouping like in
> Python?
> 
> I think that it will make source code more readable (no need for 'end'
> keyword - less text to type and easier to read the code) and Python
> fans will like it. This approach also has some drawbacks, but Python
> is a very popular language and people do not complain much.
> 
> Of course, this can't be called 'lua', we can find some other name for
> it, maybe something like 'pylua'.