HaloO,
David Green wrote:
On 2008-Oct-22, at 10:03 am, TSa wrote:
Note that types have a fundamentally different task in a signature
than name and position have. The latter are for binding arguments to
parameters. The types however are for selection of dispatch target.
Names do that too; I think both names and types should be available for
both binding and dispatching, depending on what's more natural in a
given context. Sometimes we think in terms of names (I'm going to
Fred's place), sometimes in terms of types (I'm going to the grocery
store). (And some types are names (Dad)!)
I meant that only types are checked for specificity. In the first
stage of the dispatch when applicability is checked the named params
play a role, of course. But I've no idea how a named binding compares
to a typed positional one.
multi sub action (Hammer $hammer, Nail $nail) {...}
multi sub action (SledgeHammer $hammer;; Any :$object) {...}
How would these compare if we assume that SledgeHammer is more specific
than Hammer? Would the named param of the second sub be silently
promoted to positional?
Regards, TSa.
--
"The unavoidable price of reliability is simplicity" -- C.A.R. Hoare
"Simplicity does not precede complexity, but follows it." -- A.J. Perlis
1 + 2 + 3 + 4 + ... = -1/12 -- Srinivasa Ramanujan