Author: lwall Date: 2009-11-20 05:31:36 +0100 (Fri, 20 Nov 2009) New Revision: 29140
Modified: docs/Perl6/Spec/S12-objects.pod Log: [S12] start process of distingishing abstract ~ from concrete .Str (likewise for + vs .Num) Modified: docs/Perl6/Spec/S12-objects.pod =================================================================== --- docs/Perl6/Spec/S12-objects.pod 2009-11-20 04:24:48 UTC (rev 29139) +++ docs/Perl6/Spec/S12-objects.pod 2009-11-20 04:31:36 UTC (rev 29140) @@ -1889,7 +1889,7 @@ Metamethods for objects are named with interrogative pronouns in uppercase: - WHAT the type object of the type, stringifies to short name ~ '()' + WHAT the type object of the type, .Str returns MyClass() WHICH the object's identity value WHO the package supporting the object, stringifies to long name WHERE the memory address of the object @@ -1922,10 +1922,14 @@ as the first argument to methods of the metaclass, while the other forms require you to pass this explicitly. -Note that C<WHAT> appends C<()> to indicate emptiness. Use C<.perl> to get the -bare name from a type object. +Note that C<WHAT.Str> appends C<()> to the name to indicate emptiness. +Use C<.perl> to get the bare name from a type object. Use one of +C<.Stringy>, C<< prefix:<~> >>, or C<< infix:<~> >> to get the Perl5ish +semantics of returning the empty string (with a warning) on any type +object. (There is no "undef", in Perl 6; type objects provide typed +undefs instead.) -In general, use of these in ordinary code should be a red flag that +In general, use of these uppercased accessors in ordinary code should be a red flag that Something Very Strange is going on. (Hence the allcaps.) Most code should use PerlĀ 6's operators that make use of this information implicitly. For instance, instead of