Re: Idiomatic ruby



Dňa Pondelok 13 Február 2006 01:03 Phrogz napísal:
How about returning multiple values?

def valid?
[ @is_valid_flag, @error_message ]
end

Wouldn't ever evaluate as false, which means all the predicates would have to
be true on a failure, which might be a bit confusing - I prefer to code
assertively if possible.

David Vallner


.



Relevant Pages

  • Re: Variable naming problem
    ... >> return value to represent some serious failure, ... "Exceptions are too expensive, lets get back to special return values". ... Therefore, there are either no predicates at all, or we may safely call ... readLine does not fail on EOF, since EOF is not an exceptional ...
    (comp.lang.java.programmer)
  • Re: [RFC, PATCH 5/24] i386 Vmi code patching
    ... Minor nitpick. ... The error logic here is somewhat confusing. ... If a VMI_CALL_Init results in a failure, ... Anthony Liguori ...
    (Linux-Kernel)
  • Re: diets
    ... Since the failure is pretty specific, namely the failure to "metabolize" glucose and glucose specifically, please refer to it specifically. ... I'm not objecting to your overall point, I'm just concerned about your language misleading a casual reader. ... You must be confusing me with someone who wants your advice on the wording of my posts here. ...
    (misc.health.diabetes)
  • Re: find() w/ a user defined functor
    ... I am now trying to use sort with a vector and getting a rather confusing ... > Use find_ifand give different predicates depending on whether you want ... > Stephen Howe ...
    (microsoft.public.vc.stl)
  • Re: swi debug_control_hook
    ... predicates using the familiar spy/1 interface. ... failure and backtracking of ... how could I get the frame of mainframe2? ...
    (comp.lang.prolog)