lua-users home
lua-l archive

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



Opinions, am I getting completely nuts?


==== PERL-LIKE FEATURES ====

Perl has a STRONG ease in the output of things, by allowing variables to be included in the string itself. This not only is shorter, but most of all much more readable than a lot of ..'s. Could be introduced in Lua as syntax sugar, using """ and [[[ operations.

Use of this is getting more frequent if/when/now that Lua is being used for system, and network scripting.

Note that if the implementation is like below, it will work with both local, and global values. Also these table syntaxes should work:
        """field $within.table"""
        """another field $within[anything]"""


print """something $like $this"""
-->
print( "something "..like.." "..this )


print( [[[or even $multiline
like $this
]]] )
-->
print( [[or even ]]..multiline..[[
like ]]..this..[[
]] )

While this may seem like stupid for most Lua programmers (does it?) it's the single most "wanted" thing I seem to long for in Lua now, after having used Perl. And I'm pretty sure people looking for Lua as a Perl-replacement (for say, better table handling..) will come to the same request. They shouldn't need to leave out something that does work rather well and seamlessly.

Now, you may stone me!   :)

-asko