Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^5: (OT) "Learn one new language every year"? Yeah, right.

by revdiablo (Prior)
on Oct 08, 2004 at 17:28 UTC ( #397723=note: print w/ replies, xml ) Need Help??


in reply to Re^4: (OT) "Learn one new language every year"? Yeah, right.
in thread (OT) "Learn one new language every year"? Yeah, right.

Java and C++ are not really statically typed

They are not strongly typed, but they are statically typed. There is a distinction. Strong typing means you cannot easily convert between data types (for instance, Perl is strongly typed. It is not particularly easy to convert between an array and a scalar). Static typing means the types are determined at compile-time. Casting is what you have to do in C and Java to circumvent the static type checking.

If you look at MJD's excellent talk again, you'll notice it is saying that strong typing can be good. It is also describing why static typing, as implemented in Pascal and C (and by extension, Java), is not very helpful.


Comment on Re^5: (OT) "Learn one new language every year"? Yeah, right.
Re^6: (OT) "Learn one new language every year"? Yeah, right.
by fergal (Chaplain) on Oct 09, 2004 at 15:01 UTC

    It seems to me that he is singing the praises of lanagues which are (according to your definitions) both strongly typed and statically typed.

    His Spectacular Example shows ML detecting an infinite loop at compile time (ie statically) but ML's fancy static type system wouldn't be much better than Java's if it wasn't also strong (that would essentially be Java + type inference, allowing you to cut out lots of declarations but still leaving you open to run time type errors). Strong without static would be Perl and that talk is definitely not a celebration of Perl's type system.

    The definitions are controversial and somewhere (possibily in that or another MJD talk) there's a list of about 8 conflicting definition for various kinds of typing but in that talk, on this page he says "static" and "strong" typing are the same.

    If you really want to make a distinction you could take "strong" to mean that conversions (casts) are impossible and "static" to mean that types are determined at compile time. Then, if you want to say that Java really is statically typed you should probably make it clear that you mean that "types are determined at compile time but might have been determined incorrectly". Come to think of it, that's a great definition, it makes it clear just how badly Java, C, and C++'s type systems suck.

    Maybe we should call Java a "hopefully typed" language :-).

      The definitions are controversial and somewhere (possibily in that or another MJD talk) there's a list of about 8 conflicting definition for various kinds of typing

      I would like to see this list. In my mind, the basic definitions are fairly straightforward, though there are many people who muddle them together. Just think about the words themselves: "strong" and "static." Strong typing imparts strength (as opposed to weakness) to the type system, and static typing imparts staticness (as opposed to dynamism).

      on this page he says "static" and "strong" typing are the same

      I think that page is saying that FORTRAN's type system is both static and strong. He doesn't talk a whole lot about a distinction between strong and static typing, but if you look at the talk notes, he does say, "contrary to what you might think, Pascal is not a strongly typed language, but a weakly typed one." This is after he has described it as statically typed. So he too seems to draw a distinction between the two.

      you could take "strong" to mean that conversions (casts) are impossible and "static" to mean that types are determined at compile time

      That is the definition of static I would use, but I'm not so sure about the definition of strong. That is too tied to a particular concept (i.e. casts) for me. I still like my earlier definition, "strong typing means you cannot easily convert between data types," but I know it's not perfect. Obviously, people will bicker endlessly about specific details of specific type systems, but I think the general idea is pretty simple to understand.

        Funilly enough, no sooner had I typed "I can't find the list" than I found it! Near the top of this, starts with "I did just a little research a few months ago". At the end of the list Dominus says "I no longer use the phrases 'strongly typed' or 'strong typing'." So I guess I shouldn't have pointed to his definitions!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://397723]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (11)
As of 2014-07-30 03:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (229 votes), past polls