Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

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

by einhverfr (Monk)
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
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 cooling their heels in the Monastery: (10)
As of 2014-10-01 13:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (21 votes), past polls