On Mon, Jul 09, 2001 at 11:00:45PM -0500, David L. Nicol wrote:
> [EMAIL PROTECTED] wrote:
> Why not drop the sigil on things with declared types?

A VERY SHORT DIGRESSION INTO SIGILS

I'm going to say you need sigils for this:

        print "Hello, my name is $name\n";

You're going to say this:

        print "Hello, my name is $(name)\n";

And then I'm going to say that looks like crap and then 12 other
people are going to join in and then nothing useful will get done.

So in the interest of keeping this thread down to just one massively
controversial topic, let's assume the sigils are going to stay for the
purposes of this discussion.

THIS ENDS THE VERY SHORT DIGRESSION INTO SIGILS.  PLEASE DO NOT START
ARGUING ABOUT THEM IN THIS THREAD.  THANK YOU.


> > I'm pondering this being okay:
> > 
> >         my Num    $dec = 4.0;
> >         my Int    $int = $dec;  # Num -> Int okay since 4.0 truncates to 4
> >                                 #     with no(?) information lost
> 
> You have lost information.  You have lost one digit of precision.  That is
> not insignificant. Although that information is currently carried in STRING
> types and not in FLOAT types.

Sig figs isn't really the issue here.  You can convert back and forth
between 4, 4.0, '4' and '4.0' all day and still get the same value
(I'm ignoring for the moment the possibility of floating point error,
I don't know how much of an issue it is).

The real problem isn't that.  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.


> > You'd have to do an explicit typecast (syntax left as an exercise).
> > Given that most times when you try to use a reference as a string
> > you're making a mistake, this shouldn't be a big deal.
> 
> This would be a nice thing to have a pragmata for, what hash refs 
> stringify to.

Why?  Example of use?


> > Now, here's an example of something that might be really annoying to
> > get right.  Let's say localtime() returns a hash in Perl 6 (sensible).
<snip>
> localtime would return a magic read-only hash reference.
<snip>

I just picked localtime() as a sufficiently complicated example.  I
don't really want to discuss its interface here.  See sigils above.

The real question:  variables implying their types from function
signatures... is it sane?


> >         my $foo;                # *error* forgot to declare a type.
> > 
> > We could have Perl go through heroics to try and find $foo's first
> > assignment and imply a type from that, but I think that will rapidly
> > get Messy and Surprising.
> 
>       my $foo;                # PMAW

PMAW?


-- 

Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
Perl6 Quality Assurance     <[EMAIL PROTECTED]>       Kwalitee Is Job One
Realize this, sweetheart, I'm squeezing my poodle.

Reply via email to