[Edu-sig] java

Kirby Urner urnerk at qwest.net
Wed Oct 15 14:29:43 EDT 2003


> I do have to disagree about clumping OCaml in with those other languages.

OK, thanks for the experience-based details.  I just grabbed it from someone
else's list of static languages.  I've not used OCaml myself (just read some
docs at one point).

> This length() function takes a list of any type, and knows that it'll
> return an integer.  Nothing here requires the programmer to explicitly
> declare variable types -- it'll work on lists of strings just as well as
> on lists of integers.
> 
> (******)
> # length ["hello"; "world"];;
> - : int = 2
> # length [1;2;3;4;5];;
> - : int = 5
> (******)

Well, this would be a feature of C# as well, in that the System.Array type
has its built-in Length field, like Python's __len__ method, where the Array
may be of various types, or of mixed type if you say its an array of object
references.

Yes, you have to declare the array type, but it's the same myarray.Length
invocation every time.

Isn't Java like this too?
 
> 
> And, like Python, OCaml's types will follow values, not names:
> 
> (******)
> # let age = "forty-two";;
> val age : string = "forty-two"
> # let age = 42;;
> val age : int = 42
> (******)
> 
> OCaml has a lot of the good features of a "dynamic" language, including a
> interactive interpreter.  And although its syntax is a little wacky, that
> shouldn't be an excuse to aggregate it with the likes of Java.  *grin*
> 
> 
> > If I had to choose one over the other, I'd take Python over Java.
> > Students would be more productive more quickly and it's easier to teach.
> 
> Yes, Python and OCaml are excellent alternatives to Java.  Both present an
> environment where the cost of playing around with the language is very low
> --- their interactive interpreters allow for casual experimentation. Java,
> on the other hand, requires explicit compilation, so it's just not much
> fun to play with.

But Jython fixes that shortcoming.

I think you've hit the nail on the head though:  it's having an interactive
interpreter that makes all the difference.  Non-CS majors trying to be
productive in their own disciplines should be given an interactive language
to learn (Mathematica and Matlab also qualify, as does J).
 
> My apologies for focusing on OCaml so much on this post; I'm still a bit
> brainwashed after reading Mark Jason Dominus's page on:
> 
>     http://perl.plover.com/yak/typing/typing.html
> 
> *grin*

Again, I appreciate your detailed input.

Kirby





More information about the Edu-sig mailing list