in reply to Re: Re: There's Only One Way To Do It
in thread There's Only One Way To Do It
You have three data types -- scalar, array, hash.
There are a few other types, such as subroutines and filehandles, plus the umbrella glob type. Also, I would argue that array and hash should be considered subtypes of the type 'list', since you can coerce a hash into an array (which may or may not give a useful result). You could also consider blessed references to have their own type (that type being the package they were blessed into), but if you do, you have to remember that it's totally seperate from the rest of Perl's type system. It's also easy to subvert via re-blessing.
Java does the B&D thing with data types, leading to the ever-popular downcast. They may claim to be Strongly Typed, but you can't do anything useful without having to subvert the type system to get data moved around.
Java actually has a rather weak type system, preciely because of the subversion you mention (C and C++ exibit the same problem). A big mistake a lot of people have made is equating static typing = strong, and dynamic typing = weak. Perl is dynamically typed, but also very strong. C/C++/Java are statically typed, but are relatively weak.
Languages with a type system like C are usually only good for giving the compiler some optimization hints. Some would argue that it's more self-documenting, but given how easy it is to subvert, I think this could easily lead to more confusion than its worth.
----
: () { :|:& };:
Note: All code is untested, unless otherwise stated
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: There's Only One Way To Do It
by disciple (Pilgrim) on Apr 06, 2004 at 22:09 UTC | |
by hardburn (Abbot) on Apr 07, 2004 at 03:18 UTC | |
by disciple (Pilgrim) on Apr 07, 2004 at 03:45 UTC | |
by herveus (Prior) on Apr 07, 2004 at 10:59 UTC | |
|
Re: Re: Re: Re: There's Only One Way To Do It
by herveus (Prior) on Apr 06, 2004 at 18:31 UTC |