[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [Suggestion] Define t[[[]]] to index t with a long string
- From: Christian Thaeter <ct@...>
- Date: Sat, 10 Oct 2015 20:57:40 +0200
On 2015-10-08 19:00, Soni L. wrote:
> I sometimes don't want to escape strings (so that the human reader
> can read them literally instead of trying to figure out the escapes),
> and adding spaces around the long strings just doesn't look as good.
> t[[[]]] is currently a syntax error and t[[===[]===]] is currently a
> function call.
late idea, what comes in mind for a lua-ish syntax is that functions
already accept strings (and tables) without parentheses. I think this
could be applied to indexing without syntax ambiguity:
foo = {}
foo.bar = "as usual, syntactic sugar for foo['bar']"
foo."string here" = "syntactic sugar for foo['string here']"
foo.[[Then working with long strings shouldn't be any trouble]] = ".."
Christian