Andy Wardley wrote:
I also think this is semantically fabulous but syntactically slightly
dubious. '~' reads 'match' in my book,
Really? We don't have any trouble in Perl 5 with an = character
being used in various unrelated operators:
== comparison
= assignment
~= match
=> comma
<= less than or equal to
or with - as a component of each of:
-- decrement
- difference
-= subtraction
-> dereference
-X file op
I'm just suggesting the same for the ~ character:
~~ smart-match
~ concatenate
~| stringy bitwise OR
~> append args
<~ invocate
I would prefer something like <| and |> which has a more obvious
connotation (to me at least) of "pipe left" or "pipe right".
I can certainly see the appeal, and I did consider this very alternative
(after Dan had privately suggested the two symbols to me). But they simply
don't work as well visually.
I mean, compare:
@a ~> grep {...} ~> map {...} ~> sort ~> @a;
@a <~ sort <~ map {...} <~ grep {...} <~ @a;
with:
@a |> grep {...} |> map {...} |> sort |> @a;
@a <| sort <| map {...} <| grep {...} <| @a;
I don't know about *your* font, but in mine the ~> and <~ versions are
at least twice as readable as the |> and <| ones.
Damian