Power Status (was Re: Because LC can't do two things at once.)
Richard Gaskin
ambassador at fourthworld.com
Sat Mar 7 11:52:04 EST 2015
Peter M. Brigham wrote:
> On 3/7/15 1:35 AM, Richard Gaskin wrote:
>> FWIW I appreciate efforts to distinguish getters from setters
>> by including "get" as part of a function name, but it becomes
>> odd to read things like:
>>
>> get getPowerSource()
>>
>> Personally I believe that being a function makes its role as
>> a getter implicitly clear enough as-is.
>
> Good point. I guess this never occurred to me because I never do
> "get …", I always do "put … into varName". The "it" variable is
> somewhat ephemeral if you're not careful. Even with an "ask …"
> I always follow it with a "put it into varName" before proceeding,
> so I don't overwrite "it" later inadvertently.
I use "it" sparingly myself for that reason, but -- perhaps based more
on my own ignorant superstitions than anything actually happening in the
engine (Fraser, care to chime in?) -- my hunch is that since "it" is
already initialized using it saves an additional malloc.
Over the scope of an entire code base this habit might save me as much
as two milliseconds. :)
--
Richard Gaskin
Fourth World Systems
Software Design and Development for the Desktop, Mobile, and the Web
____________________________________________________________________
Ambassador at FourthWorld.com http://www.FourthWorld.com
More information about the use-livecode
mailing list