Author: lwall Date: 2010-02-16 05:50:34 +0100 (Tue, 16 Feb 2010) New Revision: 29741
Modified: docs/Perl6/Spec/S32-setting-library/Numeric.pod Log: [Numeric] make it possible to have fast trig functions Modified: docs/Perl6/Spec/S32-setting-library/Numeric.pod =================================================================== --- docs/Perl6/Spec/S32-setting-library/Numeric.pod 2010-02-16 02:14:55 UTC (rev 29740) +++ docs/Perl6/Spec/S32-setting-library/Numeric.pod 2010-02-16 04:50:34 UTC (rev 29741) @@ -19,8 +19,8 @@ Created: 19 Mar 2009 extracted from S29-functions.pod - Last Modified: 27 Nov 2009 - Version: 4 + Last Modified: 15 Feb 2010 + Version: 5 The document is a draft. @@ -294,7 +294,7 @@ =item I<Standard Trig Functions> - Numeric multi method func ( Numeric $x: TrigBase $base = $?TRIGBASE ) is export + Numeric multi method func ( Numeric $x: TrigBase $base = CALLER::($?TRIGBASE) ) is export where I<func> is one of: sin, cos, tan, asin, acos, atan, sec, cosec, cotan, asec, acosec, @@ -314,10 +314,16 @@ Circles 1 To change the base within your own lexical scope, it suffices to redefine the -compiler constant: +compiler constant with the C<trigbase> pragma: - constant $?TRIGBASE = Degrees; + use trigbase Degrees; +In addition to setting the new lexical C<$?TRIGBASE>, this also +curries a new set of functions into the current lexical scope that +assume the new base. (Note that methods calls cannot be curried, so +methods must still look up the caller's trigbase. The optimizer may, +of course, optimize these into fast function calls.) + =item atan2 our Numeric multi method atan2 ( Numeric $y: Numeric $x = 1 )