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

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

by einhverfr (Friar)
on Nov 25, 2013 at 07:27 UTC ( [id://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.

Replies are listed 'Best First'.
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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1064196]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-03-19 07:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found