in reply to Re: Perl6 headaches?
in thread Perl6 headaches?

I agree. This is a change made for the sake of consistency. I'm not a big fan of the underscore, but I can see the point. Overloading '+', like Java does in its String class wouldn't work -- not with magical DWIM scalars. (No snide remarks about Java's consistency here, either :).

The dot operator isn't just for OO -- it'll be used to access properties and attributes as well. Sure, you could argue that it's syntactic sugar for lvalue subs, but I like sugar, in measured doses. It'll be used commonly, and one character is shorter than two. It'll probably be easier to read, too, because the dot is small.

I'll personally have a bit of trouble with the sigils becoming part of the variable name, instead of indicating what to expect. Then again, consider how many new programmers make context errors like @array[1] = localtime;.

It's change, yeah, but it's not for the sake of change. It's for the sake of consistency, Perlishness in general, and the principle that Perl should Just Make Sense. I'll miss the dot concatenation operator, but I'm willing to spend the 30 seconds it takes to learn a few new operators. In the long run, this is a good change.

Replies are listed 'Best First'.
Re: Re: Re: Perl6 headaches?
by kwoff (Friar) on Nov 05, 2001 at 04:50 UTC
    Overloading '+', like Java does in its String class wouldn't work -- not with magical DWIM scalars.

    Personally, I was more disappointed with using '_' instead of '+' than I was with using '.' instead of '->'. (FWIW, I don't understand WYM w.r.t. DWIM scalars.)

      DWIM scalars: ie, the fact that numeric strings convert themselves to numbers in numeric context, and that numbers convert themselves into strings in string context. Overloading '+' for strings would break this behaviour; and I think pretty much everyone can agree that this is a Bad Thing. :-)

      (Eg, what if you add a numeric string and a number together... Should they be concatenated, or added?)

      bbfu
      Seasons don't fear The Reaper.
      Nor do the wind, the sun, and the rain.
      We can be like they are.

        If we call '+' concatenation a DWIM operator, then I'm not sure that DWIM scalars are necessarily more desirable than DWIM operators. With perl6's ability to declare types (like 'my int i = 6' or something), then maybe there's some other way to work it. I'm not knowledgeable about perl internals, though.