Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: New String Concatenation In Perl 6?

by theorbtwo (Prior)
on Dec 04, 2002 at 05:07 UTC ( [id://217421]=note: print w/replies, xml ) Need Help??


in reply to New String Concatenation In Perl 6?

I think this is the current list. String concatination is no longer . or _, it's ~. This doesn't mess up the smart-match (=~ or is that ~=?) operator, which is now ~~... or at least, it doesn't mess with it much.


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

  • Comment on Re: New String Concatenation In Perl 6?

Replies are listed 'Best First'.
Re: Re: New String Concatenation In Perl 6?
by stefp (Vicar) on Dec 04, 2002 at 08:49 UTC
    ~ is the unary operator to force string context.
    - is the binary operator to concatenate strings.

    -- stefp

      ~ 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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://217421]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (None)
    As of 2024-04-25 02:05 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found