Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: Reflections on “Higher Order Perl” §1.1

by moritz (Cardinal)
on Jun 10, 2009 at 17:20 UTC ( [id://770401]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Reflections on “Higher Order Perl” §1.1
in thread Reflections on “Higher Order Perl” §1.1

Note that multi a(0|1) { ... } is not the same as multi a(0|1 $n) { ... }. The former is explicitly allowed as a short cut for an anyonymous parameter, ie its longer form would be Int $ where 0|1. The latter is currently not parsed by STD.pm, and I don't see which part of the specs would allow that - any pointers to a piece of spec?

Replies are listed 'Best First'.
Re^4: Reflections on “Higher Order Perl” §1.1
by John M. Dlugosz (Monsignor) on Jun 10, 2009 at 17:35 UTC
    A literal (including integer) is a subset type. That means they should be able to appear in junction types. Either Larry was being overentheusiastic when he said that literals (including ints) and named values (constants and enumerations) "are" subset types, and the parser ran into trouble actually doing that in full generality, or the STD.pm is just not caught up to his latest vision.

    —John

      That's the theory, but for practical reasons (not giving Jonathan a thundering apoplexy, for instance), parameters are currently restricted to a single constraint in front, and will continue to be restricted until we get more experience with the sorting of multiple dispatch candidates using multiple constraints. See the note in S12, "Multiple constraints".
        So chalk it up as "implementation limitation",
        and beware of any rules concerning multiple constraints as they are subject to change.

        "Single constraint" means not combining junctions and subsets?

        —John

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2024-04-23 16:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found