Re: Proposal for a (small) enhancement to the value() function.
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Jun 27, 2007
- 761 views
CChris wrote: > Could you explain, however, why this alternative scheme is preferable? I have now totally changed my mind and gone off on a complete tangent: optional parameters. If Eu had optional parameters, then:
integer errcode, chars_read, lead_space procedure value_info(sequence info) errcode = info[1] chars_read = info[2] lead_space = info[3] if errcode!=GET_SUCCESS then -- handle errors centrally... end if end procedure constant r_ve=routine_id("value_info") object r r=value("0",r_ve) if errcode!=GET_SUCCESS then -- ... or one at a time
If you call value() with one parameter it behaves as now, for legacy code. If you call value() with two parameters, the result is a single value like most people expect. Note that in this scheme, value_info() is always called, GET_SUCCESS or not. Since optional parameters are a way off, I now change my vote to adding a valueEx() routine which works as above. Regards, Pete