Talk:GetSelf

From the Fallout3 GECK Wiki
Jump to navigation Jump to search

GetSelf "preferred"[edit source]

I have to argue against that one. GetSelf is specifically deprecated, as -- aside from the (admittedly almost inconsequential) overhead in creating a redundant explicit variable -- the GECK (+ Powerup) is designed to spit out errors whenever GetSelf is used in the script of any object that can be carried. GetSelf is useful only in very specific circumstances and it is definitely not preferential to assign explicit ref variables for every act of manipulation when the script is going to be attached to a known reference (or always called from a specific object type with function scripts).

I think anyone should be especially cautious when copying and pasting code, not only because the mere act of doing so increases the likelihood of producing spaghetti code but because it is inappropriate to follow syntax that is only necessary in languages that do not have implied references. Disambiguation is useful when necessary, but unnecessarily time consuming to write and borderline impractical when unnecessary. Designing code for robust copy-paste support is basically asking for it to be misused by people who don't understand what that block of code is doing. The statement that GetSelf should be "prefer[red]" might as well be a suggestion to use more comments instead. ;-)

--JT (talk) 12:36, 13 April 2016 (EDT)