[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [Suggestion] Define t[[]] to index t with a long string
- From: "Soni L." <fakedme@...>
- Date: Fri, 9 Oct 2015 11:51:03 -0300
On 09/10/15 08:17 AM, Rena wrote:
On Oct 9, 2015 6:41 AM, "Thomas Jericke" <firstname.lastname@example.org
> On 10/09/2015 12:48 AM, Nagaev Boris wrote:
>> t[[[z]]] looks ambiguous. Everybody would have to remember what it
>> means: t("z") or t["z"].
> t[[z]] is t("z") so t[[]] would actually be t(""), wouldn't it?
Yeah, this syntax is ambiguous. t [[[z]]] already looks like it could
be parsed as one of:
t["z"] -- replacing innermost [] with ""
t"[z"] -- replacing first [[ and ]] with ""
t"[z]" -- replacing outermost [] with ""
As far as neatness, I think spaces improve it a lot here by clearly
defining the intended meaning:
t[ [[z]] ] -- or even:
[[some long string here]]
But of course spaces don't matter to the compiler.
My solution if I were presented with this situation would be one of:
X = t[s]
Or: refactor so that indexing a table with a string that doesn't fit
nicely in quotes is no longer necessary. :)
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.