News for hackers. Stuff that matters.
Re:Java.next() - Scala: The Revenge of the Static Typing by masklinn on Wednesday May 11, 2011 @12:17PM (#2537014)
> He also said that there's no mechanism to compensate for the absence of duck typing.

Whereas, in reality, there's a whole class of static type systems which do the same thing, except statically: structural type systems (example: OCaml's object types).

Much as duck typing, they only make sense for object-oriented languages. Structural type systems treat (concrete) objects and object types as method sets (where a method is a triple of name, argument types and return types), where, given the types A and B with A a structural subtype of B, A's methodset will be a superset B's methodset.

> I think that some Scala mechanisms provide that power.

Scala provides structural types (via type refinements) since 2.6.0: http://programming-scala.labs.oreilly.com/ch12.html#Structur... http://scala.sygneca.com/patterns/duck-typing-done-right

There are no comments on this comment yet.