Everything sux

Saturday, August 14, 2004

Java,C,C++ sux, types do not

Ok, Peter William Lount and james robertson are playing the 'oh type sux' game again.
Let me state I have great respect for both, before I go on bashing them ;)
And thid message does not imply I don't like smalltalk. I happen to prefer ruby and Slate in the dynamic/agile/buzzworld-of-the-day language world, but smalltalk rock. Now, onto the rant:


In the end, I think I understood what they mean. they mean
"I used c++ and java and was disappointed, thus static typing sux"

This is quite agreeable, I won't ever try to say it's wrong.
But it misses the point. I'd like to answer to P.W.L on his kind_of blog but comments are not allowed there. Please do switch to the cincom blog service ;P

Now, the message:

  1. I know that nil can get some messages, I just wrote wrong, so I'll skip this.
  2. the fact that you use multi type variables adds nothing to the discussion, you can have multitype variables in any non stupid static language. You can have them in perl6 too.
    This is quite easy: type mytype= sometype or niltype (see Haskell, or perl6's junctions). See, even if you don't have type creation of such an high level, you have nullable types in Nice or C# too.
  3. I ignore the C and Java rant. I agree with you.
  4. The environment is the language with ST so you get instant error-correct. The java guy use to say that IDEA does typing for them. I don't like this way of thinking.
  5. The next para is about things you can do with proper dynamic systems. I just make you notice that some static-strong or static-soft languages (i.e. Haskell and CL) do have types expressed in the language itself. This mean you can get "extensible runtime type safety validations with full semantic expressiveness of the language" at compile time. Yes, the 'runtime at compile time' is a joke, don't bother to correct me.
  6. #doesNotUnderstand: is a nice mechanic but if you look for a moment out of smalltalk (and ruby, with his #method_missing ) you may discover that almost any language allows you to write a proxy object with a one liner. IIRC even that cranky java thing has DynamicProxy to do this.
  7. "Smalltalk is a language that is highly extensible. It allows you to build your own custom language capabilities within it's range of expandability - which is much wider and thus more powerful than typed variable languages" I'm still afraid you are trying to say "then java's one". You can declare types in CL or Dylan, yet they're quite extensible, ain't em?
Mr. robertson is quite clear:
verbat,
The problem is that the cost of static typing (in terms of expressiveness and flexibility - is
higher than the benefit. Having used the common static languages (Java, C, C ) and
Smalltalk, I can tell you that the cost isn't worth it.

Perfect, agreed. Java,C and C++ are not expressive.
Does this mean 'static typing is bad? Not at all. Did you consider what I was saying? I said:
If I was going to give you a compiler that compiles all your smalltalk code *except* those that generates MNU (yet allowing it if doesNotUnderstand: is implemented)

I translate: "if we had a type system as expressive as ST's one but plus static error detection (and this does not only relates to type checking, it involves array bound checking, property assertion a-la DBC or pseudotype assertion a-la Haskell, checking for primality, oddity or the likes) would you use it?"

I would do this, and I think you would too.


3 Comments:

Post a Comment

<< Home