Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: What operator should perl5porters use for safe dereferencing?

by xiaoyafeng (Chaplain)
on Jun 01, 2012 at 02:46 UTC ( #973661=note: print w/ replies, xml ) Need Help??


in reply to What operator should perl5porters use for safe dereferencing?

I vote to ?->, perl is a sigil language, and keep them consisting. I think ~ is assigned to regex match already?





I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction


Comment on Re: What operator should perl5porters use for safe dereferencing?
Re^2: What operator should perl5porters use for safe dereferencing?
by Anonymous Monk on Jun 01, 2012 at 03:02 UTC

    I think ~ is assigned to regex match already?

    No, see perlop

    Binary "=~" binds a scalar expression to a pattern match. Binary "!~" is just like "=~" ... Binary "~~" does a smart match between its arguments. Unary "~" performs bitwise negation ""->"" is an infix dereference operator, just as it is in C and C++. nonassoc < > <= >= lt gt le ge
    so currently  ~> is a syntax error, you can't have unary operator bitwise-negation follow greater than operator, so  ~> is free and open for use with no possibility of confusion with anything else

    Also, neither  > nor ~ nor ~> nor -> are sigils, sigils are  $ % @ * as in  $ro %sham @bo *dynamite

      Thanks for your correction! But the 3 first main usages of ~ is about match. I suggest ?-> is I believe the one of advantages which perl6 is better than perl5 is its consistency. take a look below:
      • ~ means string, so ~$foo change $foo into string context, and $foo1 ~ $foo2 make a concatenation.
      • +/- means numeric, so +$foo change $foo into numeric context and $foo + 3 is doing mathematic operation.
      • and ? means bool, * means global etc.......
      as we see, in perl6, every sigil has its own consistent meaning and easily for learning. I don't say ~> is bad, I just want every new grammar/op adding during perl5 evolved should keep consistent.




      I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction

        I don't say ~> is bad, I just want every new grammar/op adding during perl5 evolved should keep consistent.

        Too late. Tilde already has a full house of contextual overloads:

        print ~'fred';; print ~12345;; 18446744073709539270 print ~( 2 != 2 );; 18446744073709551615 print ~~( '2' eq '2' );; 1 ~\'fred';; &#9565;&#9474;Τ&#9552;&#9577;פ

        One more is neither here nor there.


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

        The start of some sanity?

        as we see, in perl6, every sigil has its own consistent meaning and easily for learning

        ~ is not a sigil. Its not a sigil in perl5 and its not a sigil in perl6. Also, perl5 is not perl6

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2014-12-28 20:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (182 votes), past polls