http://qs321.pair.com?node_id=217434


in reply to Re: New String Concatenation In Perl 6?
in thread New String Concatenation In Perl 6?

~ is the unary operator to force string context.
- is the binary operator to concatenate strings.

-- stefp

Replies are listed 'Best First'.
Re: Re: Re: New String Concatenation In Perl 6?
by theorbtwo (Prior) on Dec 04, 2002 at 20:42 UTC

    ~ is both the unary string context forcing operator and the concatenate operator; - is still subtraction.


    Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).

      Sorry, I really meant underscore. Anyway, tilda is indeed discussed as a possible concatenation operator. It makes indeed sense to use the same sign for the unary conversion to string and the binary concatenation. Also the underscore was less than ideal because it is used for identifiers. So that meant that it had to be surrounded by space.

      There are very long threads in p6l about operators in general and concatenation in particular. Indeed, the status of underscore as concatenation character is contested and tilda seems the main contendant but that does not seem a done thing.

      -- stef