I assume you know why we often use "42" as the foil in certain discussions.
I know why *I* consider the number significant; I was a huge HG2G fan from the day - somewhere back in the mid-to-late-80's - that I stumbled onto the first book in my local library. I just always assume someone who uses the number is using it for that reason (and if they aren't, they oughta be).
Rereading your posts, I am still a little unsure why passing a parameter by reference does not directly do what you asked. Can you post a short pseudocode handler to demonstrate what you wished for?
I think the difference comes down to aesthetics; there is no functional difference as far as accessing the caller's 'it', but it places a greater burden on the caller.
My way, they can just call SomeHandlerName with no args at all, or with just the args they care about. They do not have to remember to put the "it" var in the parameter list in addition to whatever they are passing, just to be able to then say "if it is foo then blarg with the result" immediately afterward (and of course "it" should be used immediately afterward, before something else can interfere with "it",
as with any of the built-ins that modify "it", and as the docs already clearly warn about; I get it, the dangers of "it", really I do
)
calling the pass-by-ref way:
Code: Select all
SomeHandlerName parmThatMakesSense1, parmThatMakesSense2, it -- ?? gotta remember to tack it in the explicit parm list somewhere, not self-documented by naming the way the other 2 parms are (or could be).
if it is foo then blarg the result -- this part the same either way
calling my way:
Code: Select all
SomeHandlerName parmThatMakesSense1, parmThatMakesSense2 -- cleaner, all args can be self-documented by naming, both on caller and callee ends
if it is foo then blarg the result -- this part the same either way
I am not showing the handler pseudo-code definition because that isn't the place where this feature would make a noticeable difference; it's the
caller that gets benefit from not having to explicitly pass the "it" var.
As hinted at in my other posts, imagine if you had to do the pass-by-ref way with the built-ins that use "it".
Maybe better, imagine if LC now decided that you had to start doing it that way even with the built-ins, after years of being accustomed to calling them without explicitly passing "it" in.
So any code that worked with checking "it" after a call to "get", "ask", "answer" etc would suddenly have to get a bit clunkier, because you would have to explicitly add another arg to all those calls.
To me the notion of
is quite noticeably clunkier/clumsier than
especially if you imagine all the many, many places the "ask" would be used.
Whether that little bit of extra clunkiness/typing (many times over!) would bother a person will just depend on the person.
So...convenience. Aesthetics. More phrasing choices for english-like code. Large reduction in specifying a commonly used extra-info feature, if the handler in question gets called a lot.
Basically the same kind of benefits we get from the "the result" feature, just more of them.
Another thought experiment: imagine "the result" was *also* local only, could not be influenced by a handler unless you explicitly passed it by reference. Again, now all of a sudden you've got to pass something in explicitly which would work so much more beautifully, so much more conveniently, if the called routine could only set it for the caller without that extra parm being needed for such a commonly used phrase...
My goodness, I have gone on about this quite a bit, haven't I? I'll stop for a moment or three now
[edited: typo]