Re: _STRICT_EXTRA keyword [message #29886 is a reply to message #29821] |
Mon, 25 March 2002 06:23   |
btupper
Messages: 55 Registered: January 2002
|
Member |
|
|
On Fri, 22 Mar 2002 13:01:16 -0700, JD Smith <jdsmith@as.arizona.edu>
wrote:
> You may find this bit I wrote up interesting. Too much detail for a
> tutorial, but it gives you the basic ideas, and even touches on
> _STRICT_EXTRA (bother indeed). I may repurpose this as a tutorial if
> enough people bug me.
>
> http://groups.google.com/groups?selm=3BE2FCDF.6A63C4C9%40ast ro.cornell.edu
>
Thanks JD,
I hadn't look long enough for that discussion, and now I wish I had.
Is it a silly idea to wish for yet another *_extra keyword? Here's
what is rattling around in my head: _VAL_EXTRA. This keyword would
perform the same service as _EXTRA, but would make the reference vs.
value behavior clearer to folks like me (who have enough empty space
between the ears for things to rattle around in.)
My confusion about these keywords is quite similar to my confusion
when I was learning about Newton's first law of motion. It was a
useless excerise until someone pointed out that you have to pay
attention to 'on', 'by' and other such clues in "When one object
applies a force *on* another...." Such is the case here, for me,
when I think about the following snippets:
From you...
> So, bottom line rule of thumb: always use _EXTRA in your calls (or at
> least, never use _REF_EXTRA...)
and..
> The RSI developers discovered a trick, however:
> they could isolate the required change only to the routine definition,
> and allow all the calling routines (including existing code) to continue
> to use _EXTRA as-is. And some routines might just do both! Yes, you
> can pass on a by-reference inherited keyword set to a by-value
> inheriting routine: the conversion is automatic.
From David...
> Here is the rule of thumb I would use. On every
> GetProperty method, I would *define* a _Ref_Extra
> keyword. But on every *call* to a GetProperty method
> I would use an _Extra keyword to pass the extra
> structure.
From Ted...
> When keywords are stored and passed along in
> the _EXTRA structures created in function declarations, however, they are
> stored in fields by value and the reference information is lost. This is
> fine if you only want to USE the value, but not if you want to CHANGE the
> value stored in the argument. In order to change the value in some other
> function, _REF_EXTRA allows you to pass along the output keywords by
> reference.
Thanks again,
Ben
|
|
|