Author: lwall
Date: 2009-11-24 18:50:52 +0100 (Tue, 24 Nov 2009)
New Revision: 29186
Modified:
docs/Perl6/Spec/S02-bits.pod
docs/Perl6/Spec/S04-control.pod
docs/Perl6/Spec/S05-regex.pod
docs/Perl6/Spec/S06-routines.pod
docs/Perl6/Spec/S09-data.pod
docs/Perl6/Spec/S12-objects.pod
docs/Perl6/Spec/S32-setting-library/Basics.pod
Log:
much less tentatively go with the Mu suggestion from TheDamian++
Modified: docs/Perl6/Spec/S02-bits.pod
===================================================================
--- docs/Perl6/Spec/S02-bits.pod 2009-11-24 12:37:18 UTC (rev 29185)
+++ docs/Perl6/Spec/S02-bits.pod 2009-11-24 17:50:52 UTC (rev 29186)
@@ -588,7 +588,7 @@
=item *
Variables with non-native types can always contain I<undefined> values,
-such as C<U>, C<Whatever> and C<Failure> objects. See S04 for more
+such as C<Mu>, C<Whatever> and C<Failure> objects. See S04 for more
about failures (i.e. unthrown exceptions):
my Int $x = Int; # works
@@ -1045,26 +1045,49 @@
type based on 32-bit integers produces valid UTF-32 in the native
endianness.)
+=head2 The C<Mu> type
+
+Among other things, C<Mu> is named after the eastern concept of
+"Mu" or 無 (see L<http://en.wikipedia.org/wiki/MU>, especially the
+"Mu_(negative)" entry), so in Perl 6 it stands in for Perl 5's
+concept of "undef" when that is used as a noun. However, C<Mu> is also
+the "nothing" from which everything else is derived via the undefined
+type objects, so it stands in for the concept of "Object" as used in
+languages like Java. Or think of it as a "micro" or µ-object that
+is the the basis for all other objects, something atomic like a Muon.
+Or if acronyms make you happy, there are a variety to pick from:
+
+ Most Universal
+ More Undefined
+ Modern Undef
+ Master Union
+ Meta Ur
+ Mega Up
+ ...
+
+Or just think of it as a sound a cow makes, which simultaneously
+means everything and nothing.
+
=head2 Undefined types
Perl 6 does not have a single value representing undefinedness.
Instead, objects of various types can carry type information while
nevertheless remaining undefined themselves. Whether an object is
defined is determined by whether C<.defined> returns true or not.
-These typed objects typically represent unitialized values. Failure
+These typed objects typically represent uninitialized values. Failure
objects are also officially undefined despite carrying exception
information; these may be created using the C<fail> function, or by
direct construction of an exception object of some sort. (See S04
for how failures are handled.)
- U Uninitialized (derivatives serve as type objects)
+ Mu Most Undefined
Failure Failure (lazy exceptions, thrown if not handled properly)
Whenever you declare any kind of type, class, module, or package, you're
automatically declaring a undefined prototype value with the same name, known
as the I<type object>. The name itself returns that type object:
- U Perl 6 object (default block parameter type, either Any or
junction)
+ Mu Perl 6 object (default block parameter type, either Any or
junction)
Any Perl 6 object (default routine parameter type, excludes
junction)
Whatever Wildcard (like Any, but subject to do-what-I-mean via MMD)
Int Any Int object
@@ -1078,11 +1101,12 @@
Whenever a C<Failure> value is put into a typed container, it takes
on the type specified by the container but continues to carry the
-C<Failure> role.
-Use C<fail> to return specific failures. Use
-C<U> for the most generic non-failure undefined value. The C<Any>
-type is also undefined, but excludes C<junctions> so that autothreading
-may be dispatched using normal multiple dispatch rules.
+C<Failure> role. Use C<fail> to return specific failures. Use C<Mu>
+for the most generic non-failure undefined value. The C<Any> type,
+derived from C<Mu>, is also undefined, but excludes C<junctions> so
+that autothreading may be dispatched using normal multiple dispatch
+rules. The C<Whatever> type is derived from C<Any> but nothing else
+is derived from it.
=head2 Immutable types
@@ -1798,7 +1822,7 @@
Assigning or binding C<Nil> to any scalar container causes the
container to throw out any contents and restore itself to an
uninitialized state (after which it will contain a type object
-appropriate to the declared type of the container, or C<U>
+appropriate to the declared type of the container, or C<Mu>
for untyped containers).
Assigning or binding C<Nil> to any composite container (such as an
@@ -3842,12 +3866,12 @@
=item *
The definition of C<.Bool> for the most ancestral type (that is, the
-C<U> type) is equivalent to C<.defined>. Since type objects are
-considered undefined, all type objects (including C<U> itself)
+C<Mu> type) is equivalent to C<.defined>. Since type objects are
+considered undefined, all type objects (including C<Mu> itself)
are false unless the type overrides the definition of C<.Bool>
to include undefined values. Instantiated objects default to true
unless the class overrides the definition. Note that if you could
-instantiate a C<U> it would be considered defined, and thus true.
+instantiate a C<Mu> it would be considered defined, and thus true.
(It is not clear that this is allowed, however.)
=item *
Modified: docs/Perl6/Spec/S04-control.pod
===================================================================
--- docs/Perl6/Spec/S04-control.pod 2009-11-24 12:37:18 UTC (rev 29185)
+++ docs/Perl6/Spec/S04-control.pod 2009-11-24 17:50:52 UTC (rev 29186)
@@ -1119,7 +1119,7 @@
any container whose type allows the C<Failure> role to be mixed in.)
The C<.handled> method returns C<False> on failures that have not
been handled. It returns C<True> for handled exceptions and for
-all non-C<Failure> objects. (That is, it is a C<U> method,
+all non-C<Failure> objects. (That is, it is a C<Mu> method,
not a C<Failure> method. Only C<Failure> objects need to store the
actual status however; other types just return C<True>.)
@@ -1533,7 +1533,7 @@
and not care about whether the function is being called in item or list
context. To return an explicit scalar undef, you can always say
- return U;
+ return Mu; # like "return undef" in Perl 5
Then in list context, you're returning a list of length 1, which is
defined (much like in Perl 5). But generally you should be using
Modified: docs/Perl6/Spec/S05-regex.pod
===================================================================
--- docs/Perl6/Spec/S05-regex.pod 2009-11-24 12:37:18 UTC (rev 29185)
+++ docs/Perl6/Spec/S05-regex.pod 2009-11-24 17:50:52 UTC (rev 29186)
@@ -2907,11 +2907,10 @@
| (every) (green) (BEM) (devours) (faces)
/;
-This means that if the second alternation matches, the C<@$/> array will
+This means that if the second alternation matches, the list value of the match
will
contain C<('every', 'green', 'BEM', 'devours', 'faces')> rather than
-C<(U, U, U, U, U, U, 'every', 'green', 'BEM',
-'devours', 'faces')> (as the same regex would in Perl 5, considering
-C<U> to be the same as C<undef>).
+Perl 5's C<(undef, undef, undef, undef, undef, undef, 'every', 'green', 'BEM',
+'devours', 'faces')>.
=item *
Modified: docs/Perl6/Spec/S06-routines.pod
===================================================================
--- docs/Perl6/Spec/S06-routines.pod 2009-11-24 12:37:18 UTC (rev 29185)
+++ docs/Perl6/Spec/S06-routines.pod 2009-11-24 17:50:52 UTC (rev 29186)
@@ -3114,7 +3114,7 @@
The natural way to implement autothreading for multi subs is to
simply have the junctional signatures (the ones that can accept
-C<U>s or junctions as well as C<Any> parameters) match more loosely than
+C<Mu> or junction as well as C<Any> parameters) match more loosely than
the non-autothreading versions, and let multiple dispatch find the
appropriate sub based on the signature. Those generic routines
then end up redispatching to the more specific ones.
Modified: docs/Perl6/Spec/S09-data.pod
===================================================================
--- docs/Perl6/Spec/S09-data.pod 2009-11-24 12:37:18 UTC (rev 29185)
+++ docs/Perl6/Spec/S09-data.pod 2009-11-24 17:50:52 UTC (rev 29186)
@@ -257,7 +257,7 @@
=head1 Typed arrays
-The type of value stored in each element of the array (normally C<U>)
+The type of value stored in each element of the array (normally C<Mu> for
unspecified type)
can be explicitly specified too, as an external C<of> type:
my num @nums; # Each element stores a native number
@@ -1070,7 +1070,7 @@
default, and the exact value that allowed the collapse to "true"
is not available. A variant of that is to say that if you want
autothreading of a control construct, you must assign or bind to
-a non-C<U> container before the control construct, and that
+a non-C<Mu> container before the control construct, and that
assignment or binding to any such container results in autothreading
the rest of the dynamic scope. (The performance ramifications of this
are not clear without further experimentation, however.) So for now,
@@ -1201,10 +1201,14 @@
my Fight %hash{Dog; Squirrel where {!.scared}};
-The standard Hash is just
+The standard Hash:
- my U %hash{Str};
+ my %hash;
+is really short for:
+
+ my Mu %hash{Str};
+
Note that any type used as a key must be intrinsically immutable,
or it has to be able to make a copy that functions as an immutable key,
or it has to have copy-on-write semantics. It is erroneous to change
Modified: docs/Perl6/Spec/S12-objects.pod
===================================================================
--- docs/Perl6/Spec/S12-objects.pod 2009-11-24 12:37:18 UTC (rev 29185)
+++ docs/Perl6/Spec/S12-objects.pod 2009-11-24 17:50:52 UTC (rev 29186)
@@ -36,7 +36,7 @@
to support both class-based and prototype-based OO programming.
So all metaprogramming is done through the current object's C<HOW>
object, which can delegate metaprogramming to any metamodel it likes.
-However, by default, objects derived from C<U> support a fairly
+However, by default, objects derived from C<Mu> support a fairly
standard class-based model.
There are two basic class declaration syntaxes:
@@ -579,7 +579,7 @@
warning to define a submethod in any class that does not inherit the
corresponding method name from some base class. More importantly, this
would help safeguard Liskov substitutability. (But note that the
-standard C<U> class already supplies a default C<BUILD> and C<new>.)
+standard C<Mu> class already supplies a default C<BUILD> and C<new>.)
=head1 Attributes
@@ -712,7 +712,7 @@
=head1 Construction and Initialization
-All classes inherit a default C<new> constructor from C<U>. It
+All classes inherit a default C<new> constructor from C<Mu>. It
expects all arguments to be named parameters initializing attributes of
the same name. You may write your own C<new> to override the default,
or write constructors with any other name you like. As in Perl 5,
@@ -765,7 +765,7 @@
which initializes the object in least-derived to most-derived order.
C<DESTROY> and C<DESTROYALL> work the same way, only in reverse.
-The default C<BUILD> and C<BUILDALL> are inherited from C<U>,
+The default C<BUILD> and C<BUILDALL> are inherited from C<Mu>,
so you need to write initialization routines only if you wish to
modify the default behavior. The C<bless> function automatically
passes the appropriate argument list to the C<BUILD> of its various
@@ -1818,8 +1818,8 @@
you can add more methods to them, though you have to be explicit that
that is what you're doing:
- augment class U {
- method wow () { say "Wow, I'm an object." }
+ augment class Mu {
+ method wow () { say "Wow, I'm in the Cosmic All." }
}
Otherwise you'll get a class redefinition error. (Also, to completely
Modified: docs/Perl6/Spec/S32-setting-library/Basics.pod
===================================================================
--- docs/Perl6/Spec/S32-setting-library/Basics.pod 2009-11-24 12:37:18 UTC
(rev 29185)
+++ docs/Perl6/Spec/S32-setting-library/Basics.pod 2009-11-24 17:50:52 UTC
(rev 29186)
@@ -90,12 +90,12 @@
XXX Copied from S02 -- should it be deleted from there?
The definition of C<.Bool> for the most ancestral type (that is, the
-C<U> type) is equivalent to C<.defined>. Since type objects are
-considered undefined, all type objects (including C<U> itself)
+C<Mu> type) is equivalent to C<.defined>. Since type objects are
+considered undefined, all type objects (including C<Mu> itself)
are false unless the type overrides the definition of C<.Bool>
to include undefined values. Instantiated objects default to true
unless the class overrides the definition. Note that if you could
-instantiate a C<U> it would be considered defined, and thus true.
+instantiate a C<Mu> it would be considered defined, and thus true.
(It is not clear that this is allowed, however.)
=back