> Date: Tue, 10 Dec 2002 08:04:46 -0800
> From: Dave Storrs <[EMAIL PROTECTED]>
> 
> On Mon, Dec 09, 2002 at 03:58:54PM -0700, Luke Palmer wrote:
> > > From: Dave Storrs <[EMAIL PROTECTED]>
> > > My understanding was that in Perl6, you could use pretty much anything
> > > for a hashkey--string, number, object, whatever, and that it did not
> > > get mashed down into a string.  Did I have this wrong?
> > 
> > By default they're keyed by strings.  You can smack a property on them
> > to key them by something else, though:
> > 
> >     my %sparse is keyed(Int);
> >     my %anything is keyed(Object);  # or UNIVERSAL
> 
> Hmmm...maybe this is a good time to bring up something that's been
> bothering me for a while.
> 
> It seems like Perl6 is moving farther and farther away from Perl5's
> (almost) typelessness.  All of a sudden, we are getting into ints,
> Ints, Objects, Strs, etc...more and more of the code examples that are
> being posted to these lists use type declarations in method
> signatures, variable declarations, and anywhere else that they might
> squeeze in.  It isn't clear to me if this is being done because we are
> currently discussing the new types and type-safety mechanisms--all of
> which are optional, and only come into play when you request them--or
> if it is expected that this will be the new paradigm for Perl
> programming. 

You'll note that in my code sample the hash values had no type.  What
I specified is no more restrictive than Perl 5, just using something
other than a string for the hash key.

But I know what you mean as far as the rest of it.  There will
certainly be no I<mandatory> typing in Perl 6 where there wasn't in
Perl 5.  As far as what people will do, well, that's up to people.
They're not going to set social standards.  But my guess would be that
the standards would converge to some moderate between strongly typed
and typelessness.  You might see things like this:

    my Int $count = 0;
    while (...) { ... }

But probably nothing C++ish:

    my LinkedList::iterator_type $iter = new LinkedList::iterator;

People would probably leave that one untyped, because it's such a
pain.  I'm reminded of several Perl mottos simultaneously...
 
> So...are we intending that types and type safety will be like 'use
> strict' (optional and only on request), or will they be like sigils
> (mandatory, can't be turned off)?  Or, perhaps, on by default but able
> to be turned off?

Optional by request, but not explicit request.  If you type a
variable, you're asking for type checking on that variable.

Luke

Reply via email to