On Tue, Jul 10, 2001 at 01:02:18AM -0500, David L. Nicol wrote:
> > The real problem isn't [sig digs].  The real problem is how much this
> > complicates the implicit typing rules.  I'm going to have to play
> > around a bit and see which way works best.
> 
> I hope you're proposing that fatal errors on poor conversion is
> off by default.

You mean if you try this:

        my Num $foo = 4.2;
        my Int $bar = $foo;     # *error*  loss of information

that would be fatal, yes.  I think that's the right thing to do, its
exactly the sort of thing types are made to defend against.  You can
always cast:

        my Int $bar = int($foo);


PS  This is *ALL* off by default.


> > > This would be a nice thing to have a pragmata for, what hash refs
> > > stringify to.
> > 
> > Why?  Example of use?
> 
> I had a situation where I cared if refs were reffing the same object or not
> and interpolating them was actually handy.  But there are other situations
> where it might be nice to have them expand to their keys, expand to their
> values, or expand to their perl5 arrayifications.

This appears to be outside the scope of this discussion.  Refs don't
do any of that right now with or without typing.

If you're building strong typing, some magic has to go.  99% of the
time when you use a reference as a string its a mistake.  Ergo,
references do not automatically cast.  You can always make an explicit
cast or bless your refs and overload their references'
stringification.

Remember, the idea here is to catch mistakes.


> When in doubt, do everything.

Unfortunately, there's a very finite amount of tuits available to
implement all this, not to forget document, test and teach.

When in doubt, stop and rethink.


> > >       my $foo;                # PMAW
> > 
> > PMAW?
> 
> Perl's Magical Autoconverting Wondervariable.
> 
> The "draw of the PMAW" is why we're all here  (rather than outside
> in the heat, tinkering with our regenerative braking systems) in
> the first place.

We could assume untyped variables are untyped, but I'd rather they're
considered mistakes.  Again, the purpose here is to catch mistakes.  I
don't know if this will wind up being more or less annoying, we'll
have to play with it a little.  Fortunately, its a decision that can
easily be reversed.

You can always just do this:

        my Value $foo;

And $foo will act like a normal scalar taking anything (your PMAW).


Rather than just speculate, I'm going to go play with this idea for a
while.


-- 

Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
Perl6 Quality Assurance     <[EMAIL PROTECTED]>       Kwalitee Is Job One
I was *meant* to mount your donuts.

Reply via email to