Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: use feature 'postderef'; # Postfix Dereference Syntax is coming in 5.20

by einhverfr (Pilgrim)
on Nov 25, 2013 at 07:27 UTC ( #1064196=note: print w/ replies, xml ) Need Help??


in reply to use feature 'postderef'; # Postfix Dereference Syntax is coming in 5.20

I don't think this is a good syntax. I would humbly suggest a better syntax is actually a new operator. Something like this:

my @array \= $arrayref;

This would be the exact opposite of what happens when you reverse the order of the = and \. I.e. you can already

my @array =\$arrayref;

This would just reverse the process.


Comment on Re: use feature 'postderef'; # Postfix Dereference Syntax is coming in 5.20
Select or Download Code
Re^2: use feature 'postderef'; # Postfix Dereference Syntax is coming in 5.20
by Anonymous Monk on Nov 25, 2013 at 08:17 UTC

    I don't think this is a good syntax. I would humbly suggest a better syntax is actually a new operator. Something like this:

    But that does so much less than the proposed syntax, also it confuses assignment with dereferencing (dereferencing doesn't imply assignment)

      Ok, this is a fair concern. The question is what sort of syntax would work when, say, passing in an argument to a function. One could have implicit assignments in a unitary left hand operator for example, something like:

      my $foo = somefunc(\= $bar);

      This would be contextually equivalent to %$bar or @$bar depending on what $bar references. The idea would be it means "what ___ references" and that gets coerced into a list or array after that point. Of course in this context, it would be coerced into a list (of possibly only one value)...

      In short if the \= operator was overloaded so that it could be either binary or unitary (left-hand), then the problem goes away.

        In short if the \= operator was overloaded so that it could be either binary or unitary (left-hand), then the problem goes away.

        An even worse idea :)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2014-10-25 18:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (147 votes), past polls