Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

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

by pdcawley (Hermit)
on Oct 08, 2004 at 06:32 UTC ( [id://397563]=note: print w/replies, xml ) Need Help??


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

I think it depends on how you look at the language. For instance, I wouldn't say I've learned Smalltalk, in the sense that I would be comfortable writing a proper application in the language, but I've spent enough time with it to get a much deeper understanding of the possibilities of a dynamic object oriented language (like, say, Perl). It also helped me come to understand what it is I don't like about Java and C++ (Static typing is just wrong! OO without blocks/closures isn't really OO! Surely if you're designing a language with OO as its central feature, it would be a good idea to come up with a nice, concise syntax for making use of that feature. Ahem).

My take on Andy & Dave's advice is to learn enough of a programming language that you can read good code written in it, then do that. Find books that are well respected by people in the language's community (for example, SICP for scheme, On Lisp for common lisp, Smalltalk Best Practice Patterns for Smalltalk...) and read them. You're not trying to become an ace programmer in your new language; you're trying to get a feel for the mindset that goes with the language.

Replies are listed 'Best First'.
Re^4: (OT) "Learn one new language every year"? Yeah, right.
by fergal (Chaplain) on Oct 08, 2004 at 12:43 UTC
    I don't like about Java and C++ (Static typing is just wrong!

    Java and C++ are not really statically typed, in that they allow casts, in fact they require casts. This means that type errors can occur at runtime, which is exactly what static typing is supposed to prevent. Have a read MJD's excellent talk? You should read some ML or Haskell, you don't have get into monads to appreciate a lot of Haskell's typing system. I'm not even sure if I correctly understand monads because I haven't ever tried to write anything in Haskell but I can still appreciate what real static typing (with type inference so that you don't have keep telling the compiler things it could work out for itself) can do.

    I think it's cecil that brings another rather cool feature to static typing, it lets you get it wrong but still compiles your code (issuing warnings of course). This allows you to experiment with your classes as in a dynamic language without having to rewrite half your code just to get it to compile.

    So yes, Java and C++'s static typing is absolutely wrong but it's not really static typing.

      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.

        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 :-).

Re^4: (OT) "Learn one new language every year"? Yeah, right.
by fletcher_the_dog (Friar) on Oct 15, 2004 at 17:49 UTC
    It also helped me come to understand what it is I don't like about Java and C++ (Static typing is just wrong! OO without blocks/closures isn't really OO!
    I am curious as to how much Java or C++ you have actually programmed. I used to ride on the "Java is evil" band wagon until I actual had to start writing stuff in java. At first it was a pain but the type checking actually helped find a lot of errors quickly. Then I found the great editor eclipse and became a java believer. It takes advantages of java's "evil" typing and saves all sorts of time by been able to do context,type and scope sensitive variable and method completion. It has almost made creating java code as easy as creating perl code. It makes big projects much easier to work on because you do have to go searching for the method names when you cannot remember them. I love perl, but before you knock another language be sure that you have actually used it.

      If you like Java's type checking, you'll love any language with a modern Hindley-Milner type system. (Haskell is one; I believe OCaml is another.) My mental model of this type systems keeps evolving; right now it's something like a lightweight OO system with easy and unambiguous multiple inheritance, augmented with recursive typing. Of course I despised it when I started writing Haskell -- I was used to the Lispy "lots of conses" method of functional programming -- but it's grown on me.

      --
      Yours in pedantry,
      F o x t r o t U n i f o r m

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-03-28 16:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found