Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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

by einhverfr (Friar)
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.

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
Node Status?
node history
Node Type: note [id://1064196]
help
Chatterbox?
[TCLion]: Good Morning Monks, I am parsing logs and some date time formats are inconsistent. I am trying to make output all same format. What is the best way to convert a month(word) to month(number)?
[Corion]: TCLion: I'm not aware of a better way than manually building the hash, as all strptime incarnations I know have nasty edge cases
[davido]: And remember; time is hard. :) As soon as you think, I've got this, you'll discover that time is harder than that. :)
[1nickt]: TCLion are you parsing the dates with DateTime or another tool?

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (11)
As of 2017-03-23 14:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (287 votes). Check out past polls.