Also, the `{}` literal syntax does _not_ restrict to non-dups. `{ 1:1, 1:2, 1:3 
}` will probably always be equivalent to `@[ (1,1), (1,2), (1,3) ]`.

To my knowledge there are no plans to make `{}` de-dup and I, for one, hope it 
stays that way. Such `{}` sugar is syntactic while de-dup is semantic. Of 
course, `{...}.toTable` does de-dup, but `{...}.toSomethingElse` need not. I 
went with `{...}.toLPTabz(dups=true)` with `LPTabz`, for example.

[I actually think](https://github.com/nim-lang/RFCs/issues/207) it is more 
consistent & informative to use `{}` and `{}=` for associative lookup and `[]` 
and `[]=` for positional lookup (but maybe as a backward compat thing have 
either work when there is only one kind of index). The kind of `seq` @Hlaaftana 
mentions is a good example where both positional and keyed access make sense. 
[Others disagree with me, though](https://forum.nim-lang.org/t/6167#38125), 
though, more or less on the grounds of it being "too different from other 
prog.langs/their personal experience/personal mental model" aka "not invented 
by Leibniz". I think "just one indexing syntax" is an unfortunate artifact of 
1980s era C++/Python languages having "rigid syntax/flexible semantics". Ah 
well.

Reply via email to