3 ms·
Is there an analog to guard in other languages?
by Zelphyr 11y ago
Is there an analog to guard in other languages?
- vezzy-fnord 11y agoErlang has guard sequences, also a "when" clause: http://erlang.org/doc/reference_manual/expressions.html#id83710 http://erlang.org/doc/reference_manual/expressions.html#id83...
- zem 11y ago"design by contract" is the general term [see http://c2.com/cgi/wiki?DesignByContract http://c2.com/cgi/wiki?DesignByContract]. d and racket have excellent support for it https://dlang.org/spec/contracts.html https://dlang.org/spec/contracts.html http://docs.racket-lang.org/guide/contracts.html http://docs.racket-lang.org/guide/contracts.html and here's a library to add it to ruby (i've seen a couple of others floating around): https://egonschiele.github.io/contracts.ruby/ https://egonschiele.github.io/contracts.ruby/