On concatenation

jdavidb on 2002-11-06T17:03:08

I read that _ (the operator formerly known as .) has been changed to ~. I'm pretty happy about that; _ seems like a very expensive character to type, while I type ~'s all the time, and it seems much easier. Both still require the use of a shift, but ~ feels like it's much closer.

Of course, I still like .. Maybe there can be a syntax warping pragma for us . diehards.

I realize none of this makes any rational sense.


Noooo!

jplindstrom on 2002-11-06T17:43:57

* garghhhh *

On a Swedish keyboard, the ~ is AltGraph-akey+Space. That's so we can produce chars like ã with the ~ on top of the a (we don't use that in Swedish, but still).

Right now it's just annoying when writing urls with home directories. With ~ as a Perl operator, I'll have to bind it to a macro if I want to remain sane...

/J

Re:Noooo!

jdavidb on 2002-11-06T19:14:31

Sorry to hear that. I can see how it will be painful.

Maybe with the Perl 6 syntax warping features we'll both be able to:

{
  use concatenator '.';
  ...
}

Out of curiosity, I would expect that =~ gives you grief today, too? Maybe Swedish Perl programmers use $_ more often than others. :)

Why buck tradition?

djberg96 on 2002-11-06T19:46:39

How about using what every other language uses for string concatenation: "+"

As for the ease of the "~" key - not if you're on a Sun keyboard. :)

Re:Why buck tradition?

jdavidb on 2002-11-06T20:05:46

As for the ease of the "~" key - not if you're on a Sun keyboard. :)

(Glances over at the blade I'm still not using more than this Linux box.) Ooh, you're right. Hadn't thought of that.

Why is it the price of getting the control key in the "right" place on my keyboard is totally losing the ~ key?

Re:Why buck tradition?

mary.poppins on 2002-11-07T04:56:38

Because in Perl, numbers and strings are easily interconverted. Just try:

perl -e 'print "5"+"6"'

and see what happens!

In any case, the dot operator is wonderful, and I'm disappointed that it's being changed at all.

Confusing

bart on 2002-11-07T08:59:46

So now we'll have two similar but completely unrelated operators =~ and ~=. Hmm. Just like we already had <= and =>.

Re:Confusing

wickline on 2002-11-07T11:11:17

I think =~ is turning into ~~ in perl6, so you'll just have the pre-existing pair to disambiguate.

-matt

Re:Confusing

jdavidb on 2002-11-07T14:43:38

I got my info from the latest Perl 6 summary, which also mentioned they were getting rid of (one of those...) for just that reason.