lua-users home
lua-l archive

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


Miles Bader <miles@gnu.org> writes:
> Sven Olsen <sven2718@gmail.com> writes:
>> Thus my latest excursion into lparser.c.  The idea is to allow ~ to denote
>> a "conditional field reference".  When evaluating 'table~key', the result
>> is 'table.key' provided that 'table' exists. But if 'table' doesn't exist,
>> then 'table~key' evaluates to 'table'.  I fall back on the nonexistent case
>> when 'table' equals nil or false, so the semantics match the behavior of
>> more standard 'and/or' tricks.
>
> Hmm, how about ".?" instead of "~" (which seems kind of random) ...?
> Using ".?", the meaning seems to almost jump out at you...

.. or "?.", and then similarly "?[...]"  ?

-miles

-- 
"Yorton, Wressle, and Gospel Oak, the richness of your heritage is ended.
We shall not stop at you again; for Dr Beeching stops at nothing."