jstrachan | 29 Jan 08:20 2005

static versus dynamic typing policy

Just a quick thought I had while replying to a mail that I figured 
belonged in its own thread.

A common reaction to optional static typing seems to be 'oh no, folks 
will get confused if things behave differently'. So I'm trying to ensure 
that whenever we introduce static typing into Groovy, things behave as 
if they are dynamic - its just that

(i) the compiler can give you better compile time errors (catching more 

(ii) the implementation *may* figure out some more optimal way of 
implementing the method dispatch - whether it does or doesn't should not 
affect the semantics of the program.

(iii) because of the extra metadata in the code, IDEs can do their magic 
of completion/refactoring

So it'd be good whenever we think about static versus dynamic typing, to 
  ensure that the semantics are always the same (the same thing 
happens). In the past John Wilson has come up with various use cases 
where this could break; we should keep an eye out for this.