开发者

Protocols/Interfaces in Ruby

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.


Check project Ruby-Contract

Not more work is happening on it. :(


This might be interesting for the second part of your question: Type checking in ruby

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜