On Tue, Jun 05, 2001 at 02:42:01PM -0400, John Porter wrote:
> > You don't want to try holding up prototypes and dereference checks to
> > Java's typing system and try to claim its in the same league, or even
> > the same sport.
>
> As I said before, it boils down to the fact that perl's notion of a
> "type" is different from other languages.  It *does* check these
> types, and it "casts" very opportunistically.

Ok, let's call them types for a moment.

A) You can't meaningfully define new types.  This makes it pretty much
useless as a typing system.

B) The system's only awareness of OO is that objects must be
references, otherwise anything goes.  Even if prototypes worked on
methods you still couldn't specify which objects you want.

C) To call Perl's differenciation between scalar, array,
etc... references a typing system is like calling C's differenciation
between structs, arrays and scalars a typing system.  You may be able
to draw analogies, but they don't serve the same purpose.

Yes, there is some actual type casting going on between strings and
numbers and various internal scalar types, but its mostly behind the
scenes.


What Perl does with references is basic sanity.  Using a scalar
reference as an array ref doesn't really have meaning, for example.  A
real typing system is a layer of *additional and arbitrary* (from a
purely syntactical PoV) enforcement on top of this.  Typed data could
mix and could have meaning (a variable of type Velocity could be used
where a Price is wanted, they're both numbers) but you disallow it
because it doesn't fit in with the reality you've defined in your
program.


Perl doesn't have a built-in typing system comparable to what most of
other languages have, and its not healthy to delude ourselves into
thinking we have one.  The lack isn't much of a problem, Perl doesn't
really need it and it causes all sorts of complications (as noted in
the other threads).  Wouldn't hurt to have one, though.


I have a feeling we're arguing somewhat different things here.

-- 

Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
Perl6 Quality Assurance     <[EMAIL PROTECTED]>       Kwalitee Is Job One
OH GOD!!  It's LINUX!  All you Linux fanboys go wild!  It never crashes!
It'll wash your underpants!  It'll eat your dog for you, if you want your
dog to be eaten!  It'll make you attractive and smell good and... it'll...
uh... uh.  Man, I'm so sick of this shit.
        http://www.goats.com/archive/000602.html

Reply via email to