|
|
On May 30, 2:35 pm, Andreas Leitgeb <a...@xxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
> Alexandre Ferrieux <alexandre.ferri...@xxxxxxxxx> wrote:
>
> [on defaults for dicts]
>
> > What about:
> > [dict getdef $d $key1 ... $keyN $def]
>
> Imho one point of this thread is storing the default with
> the data (be it an array or dict), and not having to pass it
> separately to the getter (be it a command or $-syntax).
No, I was following Donal's idea that within EIAS the only way to
avoid a specific reserved key was to have a specific access syntax.
This is fine for everyday uses, since currently the equivalent code is
bigger and uglier (and does two hash lookups).
Now in the meantime you have made another interesting suggestion with
odd-numbered lists. I must admit it is elegant. It could even make
useless the special case for [dict incr] which allows the element to
be undefined:
set d [list 0]
....
dict incr d $key
Donal, any comments about this ?
-Alex
|
|