Protocols/Interfaces in Ruby
Posted
by fifigyuri
on Stack Overflow
See other posts from Stack Overflow
or by fifigyuri
Published on 2010-03-17T10:09:22Z
Indexed on
2010/03/17
10:11 UTC
Read the original article
Hit count: 156
While coding in Ruby I did not really miss the type-orientedness of Java or C++ so far, but for some cases I think it is useful to have them. For Python there was a project PyProtocols which defined interfaces and protocols for objects. Does a similar initiative also exist for Ruby? I would like to be able to declare the expected parameters for some methods for some objects (for the entire code I find such think useless). It the method during the execution receives an unexpected input, it tries to adapt it or if it cannot, it throws an exception. Does something similar exist for Ruby? Introducing types for a type-less language like Ruby might sound freak, but I think types are sometimes useful. Thanks for help.
© Stack Overflow or respective owner