[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Rather, DSSLs increase modularity, productivity

Side note: I find ocaml's object system way too restrictive precisely
because it forbids downcasting (casting an object to the class of a
subclass of the object's class, which might fail at runtime).  You can
upcast, but that can be statically checked.

The bias of the ocaml developers is to never allow *any* type errors at
runtime, but they don't provide any reasonable alternative IMO (the ones
I've seen suggested are so hacky, complex, heavyweight and nonscalable that
they really aren't worth considering).  So when I want to write
object-oriented code, I avoid ocaml.  I keep hoping they'll come to their
senses someday ;-)


> From: Neelakantan Krishnaswami <neelk@gs3106.sp.cs.cmu.edu>
> Date: Tue, 18 Nov 2003 12:52:19 -0500
> Matthias Felleisen writes:
> > On Monday, November 17, 2003, at 11:34 PM, Neelakantan Krishnaswami  
> > wrote:
> > >
> > > IIUC, the type system for Java generics ensures that a type-safe Java
> > > 1.5 program will never throw a casting exception at runtime.
> > 
> > With all respect, but I doubt that one. Not even ML can do this.
> I'm only talking about Java's ClassCastException, not other kinds of
> errors, such as the RuntimeStoreException that Java's covariant arrays
> permit.
> Incidentally, I don't understand your point about ML: it doesn't have
> a cast operator, so it seems like it's vacuously the case that it can
> never fail a cast.
> -- 
> Neel Krishnaswami
> neelk@cs.cmu.edu