Pathologically Eclectic Rubbish Lister | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I very much like the spirit behind this proposal, though I'm not sure if : is a good choice as "defined"-modifier. It doesn't have any definedness connotation for me. Maybe just stick with d? There's no rule that says operators need to be either word or non-word character only: A d|| B etc. And while you're at it, you can also introduce a prefix meta operator for exists instead of defined: e|| and e&& FWIW I don't see any problems with having multiple names for the same operator; it's a good way to deal with language change and graceful deprecation. Update: I should add that Perl 6 has long taken the road of having meta operators, and even type prefixed operators. For example bitwise AND behaves different from strings and numbers, which is there are two operators for them: +& and ~& (the ~ generally stands for strings in Perl 6, concatenation is infix ~, and string context is prefix ~). Meta operators are more general than that. For example the Z meta op can be applied to infix operators, making them "zip" two lists together:
It's a case where an operator consists of both word and non-word characters, and it's not particularly hard to read. In reply to Re: Perl5 Language Extension: Definedness-Triggered Shortcut Operators
by moritz
|
|