Re:Matz at RubyConf 2014: Will Ruby 3.0 Be Statically Typed?
by AnimalMuppet on Monday November 17, 2014 @03:51PM
(#8620461)
The idea that a type is defined by a set of methods sounds almost exactly like Go...
[ Parent
| on HN ]
Re:Matz at RubyConf 2014: Will Ruby 3.0 Be Statically Typed?
by robertknight on Monday November 17, 2014 @05:22PM
(#8621083)
The more general name for this approach is structural typing - http://en.wikipedia.org/wiki/Structural_type_system
Re:Matz at RubyConf 2014: Will Ruby 3.0 Be Statically Typed?
by blktiger on Monday November 17, 2014 @05:53PM
(#8621269)
Except in Go don't you have to define the set of methods in interfaces? In Matz's system the interfaces would be discovered by the interpreter at run-time.
Re:Matz at RubyConf 2014: Will Ruby 3.0 Be Statically Typed?
by jabbrwcky on Tuesday November 18, 2014 @10:51AM
(#8624378)
In Go you define the methods in interfaces but implementors do not have to specify that they implement a given interface.
Instead any object (though Go has no real objects) is considered to be an implementation of an interface iff it implements all define methods.
Re:Matz at RubyConf 2014: Will Ruby 3.0 Be Statically Typed?
by AnimalMuppet on Monday November 17, 2014 @07:00PM
(#8621622)
If I understand correctly, yes, in Go you have to define the methods that make up the interface.