Author: larry Date: Sun Jul 16 18:58:53 2006 New Revision: 10250 Modified: doc/trunk/design/syn/S03.pod doc/trunk/design/syn/S04.pod doc/trunk/design/syn/S06.pod
Log: Renamed .id to .valid as a pun on "value id". Modified: doc/trunk/design/syn/S03.pod ============================================================================== --- doc/trunk/design/syn/S03.pod (original) +++ doc/trunk/design/syn/S03.pod Sun Jul 16 18:58:53 2006 @@ -12,9 +12,9 @@ Maintainer: Larry Wall <[EMAIL PROTECTED]> Date: 8 Mar 2004 - Last Modified: 15 Jul 2006 + Last Modified: 16 Jul 2006 Number: 3 - Version: 48 + Version: 49 =head1 Changes to existing operators @@ -341,15 +341,15 @@ C<Array> objects, but it is true that C<@a === @a> because those are the same C<Array> object). -Any object type may pretend to be a value type by defining a C<.id> +Any object type may pretend to be a value type by defining a C<.valid> method which returns a value type that can be recursively compared using C<===>, or in cases where that is impractical, by overloading C<===> such that the comparison treats values consistently with their "eternal" identity. (Strings are defined as values this way despite also being objects.) -(Because Perl 6 uses a false C<.id> to signify a non-instantiated prototype, -all instances should arrange to return a C<.id> that boolifies to true.) +(Because Perl 6 uses a false C<.valid> to signify a non-instantiated prototype, +all instances should arrange to return a C<.valid> that boolifies to true.) Two values are never equivalent unless they are of exactly the same type. By contrast, C<eq> always coerces to string, while C<==> always coerces to Modified: doc/trunk/design/syn/S04.pod ============================================================================== --- doc/trunk/design/syn/S04.pod (original) +++ doc/trunk/design/syn/S04.pod Sun Jul 16 18:58:53 2006 @@ -12,9 +12,9 @@ Maintainer: Larry Wall <[EMAIL PROTECTED]> Date: 19 Aug 2004 - Last Modified: 3 July 2006 + Last Modified: 16 July 2006 Number: 4 - Version: 26 + Version: 27 This document summarizes Apocalypse 4, which covers the block and statement syntax of Perl. @@ -540,7 +540,7 @@ C<Failure> objects, which refers to an unthrown C<Exception> object in C<$!> and knows whether it has been handled or not. -If you test a C<Failure> for C<.id>, C<.defined> or C<.true>, it causes +If you test a C<Failure> for C<.valid>, C<.defined> or C<.true>, it causes C<$!> to mark the exception as I<handled>, and acts as a harmless C<Undef> value thereafter. Any other use of the C<Failure> will throw its associated exception immediately. Modified: doc/trunk/design/syn/S06.pod ============================================================================== --- doc/trunk/design/syn/S06.pod (original) +++ doc/trunk/design/syn/S06.pod Sun Jul 16 18:58:53 2006 @@ -13,9 +13,9 @@ Maintainer: Larry Wall <[EMAIL PROTECTED]> Date: 21 Mar 2003 - Last Modified: 1 July 2006 + Last Modified: 16 July 2006 Number: 6 - Version: 39 + Version: 40 This document summarizes Apocalypse 6, which covers subroutines and the @@ -1337,9 +1337,10 @@ =head2 Undefined types -These can behave as values or objects of any class, but always return a -C<.id> of 0. One can create them with the built-in C<undef> and C<fail> -functions. (See S02 for how failures are handled.) +These can behave as values or objects of any class, but always return +a C<.valid> that evaluates to false. One can create them with the +built-in C<undef> and C<fail> functions. (See S02 for how failures +are handled.) Undef Undefined (can serve as a prototype object of any class) Whatever Wildcard (like undef, but subject to do-what-I-mean via MMD) @@ -1371,7 +1372,7 @@ =head2 Mutable types -Objects with these types have distinct C<.id> values. +Objects with these types have distinct C<.valid> values. Array Perl array Hash Perl hash @@ -1954,10 +1955,10 @@ class LoudArray is Array { method TEMP { - print "Replacing $.id() at {caller.location}\n"; + print "Replacing $.valid() at {caller.location}\n"; my $restorer = $.SUPER::TEMP(); return { - print "Restoring $.id() at {caller.location}\n"; + print "Restoring $.valid() at {caller.location}\n"; $restorer(); }; } @@ -2003,7 +2004,7 @@ sub thermo ($t) {...} # set temperature in Celsius, returns old temp # Add a wrapper to convert from Fahrenheit... - $id = &thermo.wrap( { call( ($^t-32)/1.8 ) } ); + $handle = &thermo.wrap( { call( ($^t-32)/1.8 ) } ); The call to C<.wrap> replaces the original C<Routine> with the C<Code> argument, and arranges that the call to C<call> invokes the previous @@ -2013,13 +2014,13 @@ &old_thermo := &thermo; &thermo := sub ($t) { old_thermo( ($t-32)/1.8 ) } -Except that C<&thermo> is mutated in-place, so C<&thermo.id> stays the same +Except that C<&thermo> is mutated in-place, so C<&thermo.valid> stays the same after the C<.wrap>. -The call to C<.wrap> returns a unique identifier that can later be passed to +The call to C<.wrap> returns a unique handle that can later be passed to the C<.unwrap> method, to undo the wrapping: - &thermo.unwrap($id); + &thermo.unwrap($handle); This does not affect any other wrappings placed to the routine.