Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

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

by einhverfr (Friar)
on Nov 25, 2013 at 08:47 UTC ( #1064204=note: print w/ replies, xml ) Need Help??


in reply to Re^2: use feature 'postderef'; # Postfix Dereference Syntax is coming in 5.20
in thread use feature 'postderef'; # Postfix Dereference Syntax is coming in 5.20

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.


Comment on Re^3: use feature 'postderef'; # Postfix Dereference Syntax is coming in 5.20
Download Code
Replies are listed 'Best First'.
Re^4: use feature 'postderef'; # Postfix Dereference Syntax is coming in 5.20
by Anonymous Monk on Nov 25, 2013 at 10:56 UTC

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

      If it is an even worse idea, then my conclusion is that this whole thing is a bad idea and we should just stick to the current dereference syntax, i.e. ${ $object->{foo} }.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (16)
As of 2015-07-07 17:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls