Re[4]: Multitask Feedback
- Posted by akusaya at gmx.net Sep 25, 2005
- 447 views
>> > Again, and again, how about a feature to ignore return values after >> > calling a function? It's really annoying, almost every time I make a >> > little Eu program I need to do something like >> > >> > PP = seek(fn, 100) >> > >> > where PP is a global variable I defined in aku.e which is an include >> > file I always include when starting to write a new Eu program. (almost >> > never write a Eu program without an "include"!) >> > >> > All languages I know allow ignoring function return values. Why not >> > Eu? >> > >> > (BTW, I tried making a website with PHP, unexpectedly it's not a lot >> > harder than using Eu, but much easier since it has rich functions and >> > database access functions) >> > >> >> Well, functions return values for a reason and it's not that hard to ignore a >> return >> value. Is it annoying? At times, yes. Worth adding some >> language construct to the langauge >> to remedy it? Definitely not. >> >> Here, this is what I use: >> >> }}} <eucode> >> procedure ignore(object x) >> -- Do nothing, just ignore the object passed >> end procedure -- ignore >> >> ignore( seek(fn, 100) ) >> </eucode> {{{ >> >> It's not that hard to implement and use, looks neat and clear, and most >> importantly >> doesn't change Euphoria in any way. >> j> Why not just j> global object ignore j> ignore = seek(fn,100) j> that way you save procedure call overhead. In my opinion, using a global variable or empty procedure call is not significantly degrades performance, but the problem (besides more typing and corrupts global namespace) is the readability (Eu was designed for great readability). I think, function returns values has a purpose, if the main purpose of returning values is returning the result of the function. But many functions only return values that indicate errors. [1] If Eu had a error catching feature, all functions would return the intended value, not error code, so assigning function result to a variable could be made compulsary. Unfortunately Eu is not, so many functions return error code. So, IMO, Eu should allow ignoring function return values, unless Eu has implemented error catching feature (such as in Java) [1] Except rare functions such as value() that returns {error code, result} which I never use anymore since I have global function val(object x) object y y = value(x) return y[2] end function and again it means I need to include a file even for a very simple Eu program.