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

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.)

Replies are listed 'Best First'.
(bbfu) (DWIM scalars) Re4: Perl6 headaches?
by bbfu (Curate) on Nov 05, 2001 at 08:35 UTC

    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.