Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: perldelta unclear on 'given's fate

by ikegami (Pope)
on Jan 06, 2014 at 11:45 UTC ( #1069488=note: print w/ replies, xml ) Need Help??

in reply to perldelta unclear on 'given's fate

There are problems with the design of smart-matching. The decision of what any given TYPE ~~ TYPE should do is most often unobvious, inconsistent and/or disputed. The idea isn't to remove smart matching; it's to fix it.

Specifically, ~~ will likely be greatly simplified, as you can see in a proposal by the 5.18 pumpking. Decisions as to how two things should match will be done with helpers such as those that already exist in Smart::Match.

... ~~ any(...)

Much more readable, much more flexible (fully extensible), and solves a number of problems (such as "When should X be considered a number, and when should it be considered a string?").

Along the same lines, the rules for when when uses smart-matching and when it doesn't are complicated. I suspect that will change.

Lexical $_ (currently used by given) apparently causes too much problems. For example, the following code doesn't work because first sets package variable $_, but the callback captured the lexical $_ declared by given.

given (...) { ... first { /.../ } ... ... }

Rather than continuing to require callbacks to use our $_;, given will be changed to use package variable $_ instead of lexical $_ in 5.20.

Comment on Re: perldelta unclear on 'given's fate
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (14)
As of 2015-11-30 13:34 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (771 votes), past polls