David Whipp wrote:
> 
> Dan Sugalski [mailto:dan@;sidhe.org] wrote:
> > At 6:50 PM -0800 11/6/02, David Whipp wrote:
> > > Whenever a value passes through a primitive type, it
> > > loses all its run-time properties; and superpositions
> > > will collapse.
> >
> > What makes you think so, and are you really sure?

 Why? I guess its a case of ass/u/me; plus reading other
> people's assumptions (e.g. Michael Lazzaro's initial
> "Chapter", at cog.cognitivity.com/perl6/val.html).

Oh, no you don't... don't pin this one on me.  :-)

> If I am wrong, then I am in need of enlightenment. What
> is the difference between the primitive types and their
> heavyweight partners? And which should I use in a typical
> script?

It has been stated multiple times that primitive types can't take
runtime properties or other "object-like" features, so that they may be
as lightweight as possible -- flyweight classes, as it were.

Primitive types were originally intended for runtime speed, thus an
"int" or a "bit" is as small as possible, and not a lot of weird runtime
checking has to take place that would slow it down.  It can't even be
undef, because that would take an extra bit, minimum, to store. 
Promoted types, on the other hand, can do all that stuff -- that's the
whole reason there are two separate versions of each "type".  It allows
some credible possibility of optimal runtime efficiency in Perl6, when
it's important to you.

It is not necessarily a given that the behavior will hold true for
superpositions.  In fact, it is hypothetically possible (tho almost
certainly unworkable) that typechecking on primitives wouldn't really
enforce true primitiveness at all, but merely acts as a "suggested"
type, trading optimal efficiency for more moderate efficiency (but
meaning you _could_ store an undef, etc. in a hole meant for a
primitive: it'll just have to assume more runtime checks then it
originally would for a "true" primitive.)  Or it may be that storing in
primitive type does indeed enforce maximal efficiency, and that you
should use the promoted types when you don't want that.  Dunno.

MikeL

Reply via email to