uniform tuple syntax
via Digitalmars-d
digitalmars-d at puremagic.com
Wed Mar 25 01:14:29 PDT 2015
On Tuesday, 24 March 2015 at 23:07:29 UTC, Vlad Levenfeld wrote:
> You'd also have to rename opDollar to opHash or, maybe less
> confusingly, opPound.
opLength?
> Also, $ is already a common idiom (at least in Unix) for "the
> end". It would be better to just name
No, in Unix "$" is used in /bin/sh for the prompt and to denote a
variable, but "$#" is used for the number of parameters and
"${#variable}" is used for length. What you are thinking about is
that "$" is used for pattern matching of the conceptual
EOL-symbol (character) in regular expressions, but that's not
length.
So in the Unix world "$" is either used for variables or pattern
matching, and "#" is used for length.
In perl "$#" is used to denote last item in list? In Lua "#" is
the length operator? Using "$" for length is just confusing if
you know other languages.
More information about the Digitalmars-d
mailing list