Ashley Winters wrote:
On Sun, 13 Mar 2005 23:42:41 -0600, Rod Adams <[EMAIL PROTECTED]> wrote:
Ashley Winters wrote:
For documentary purposes, can we make that $radians?
multi sub cos (Num +$degrees) returns Num { return cos :radians($degrees * PI / 180); }
my Num $x = cos :degrees(270);
I have changed the trig functions it to have an optional "base" argument. (I'm option to new names for this term.)
The problem I see with your proposal is that both versions have the same MMD long name, which only looks at required parameters. We'd have to have something like:
multi sub cos (Num ?$radians = $CALLER:_, Num +$degrees, Num
+$gradians) returns Num
As for the duplicate long names, don't we have permissiveIn this case the foot shooting would be enabled by locally redefining &cos<>. The problem with how you did it is that you were then calling your new version inside itself. I believe the following would have worked:
foot-shooting? We get "is default" as a tie-breaker in the end, no?
multi sub cos (Num +$degrees) returns Num { &*cos.($degrees * PI /180) }
Since you're now calling the global version of cos.
Side Question: Should I putting *'s throughout S29's signatures, or assume they are assumed?
The trick here is that the where clause actually created a subtype of Int, so the long names are something likeHell, I seem to recall seeing example functions whose signatures vary by a "where" or "when" or some such clause.
multi sub foo (Int $x where { $_ ~~ any(1..10) })
multi sub foo (Int $x where { $_ ~~ any(5..15) }) is default
&foo<Int(where {$_ ~~ any(1..10)})> &foo<Int(where {$_ ~~ any(5..15)})>
exactly how a where clause mutates the name of the type has not been defined yet. hmm. Actually I think it's been defined as being an anonymous subclass, so they might look like:
&foo<ANON-0x03F3> &foo<ANON-0x042A>
Regardless, they are different types, and MMD can handle it.
It's been defined that Perl 6.0.0 does not dispatch on named parameters, for better or for worse. If you don't like it, talk to Larry.
-- Rod Adams.