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

This seems like a poor limitation in practice. I wasn't even proposing
having that degrees version be in the standard library -- I offered
that function as an example implementation to put in my own
degree-using programs..

Don't get me wrong, I like having degrees/gradians as an option in the
standard language, but how should I do what I proposed in other cases,
when the option isn't included in the standard implementation?

As for the duplicate long names, don't we have permissive
foot-shooting? We get "is default" as a tie-breaker in the end, no?

Hell, 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

Ashley

Reply via email to