CBFalconer wrote:
Markus Gerwinski wrote:
Of course, you also can do so by explicitly declaring `result`as a local variable and assigning it to getIndexOf in the end, but personally, I find the above way far more elegant.
Which, to me, means there are no new capabilities introduced by this usage. I find the local variable and final assignment to be much clearer and more elegant. All result has done is provide a synonym for the function name, whose use in an expression will not trigger recursion.
Exactly.
My issue here isn't about capability, but about readability. I usually try chosing my function names in a manner that you can use them just like verbs in normal talking. Using them as a noun when passing themselves as their own result always gave me a strange feeling, even back when I started my first steps in BP. Besides, since it can always happen that you run into that recursion at some point, I used to always declare the function's return value as a local variable whenever the function was bigger than a one-liner, even in my old BP days.
This may be a matter of taste, but I was really happy when GPC gained the ability to declare them in the function implementation's header, and I'd be really, really sad to lose it again. ______________________________________________________________ Verschicken Sie romantische, coole und witzige Bilder per SMS! Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193