Nothing much -- it was just an artificial test to learn whether LC stores 
numbers as numbers internally. It sets up two variables, checks the time, goes 
through the same steps repeatedly, then checks the time again. Here it is with 
more comments:

on mouseUp
  put "1" into X -- X is a string
  put 1 into Y -- Y is a number
  put the long seconds into T -- this records the present time with some 
precision 
  repeat 9999999 -- have to do this a lot of times because its very fast
     put X into Z 
       -- THE FIRST TIME THROUGH
       -- There is no Z, so LC creates a new variable Z
       -- and puts X into it. Both X and Z are strings at this point: "1"

       -- THE SECOND THROUGH 9999999TH LOOP
       -- Z has been converted to a number (see below)
       -- But X is still a string. So each time after the first, 
       -- Z has to be converted back to a string,
       -- and then X ("1") is put into Z, and Z is "1" again

     add Z to Y 
       -- Z is a string("1"), so it has to be converted to a number:
       -- "1" becomes 1, and 1 is added to Y
  end repeat
  put the long seconds - T -- get the time, subtract the original time for 
duration
end mouseUp


Sent from my iPad

On Sep 15, 2013, at 2:35 PM, Vaughn Clement <vclem...@gmail.com> wrote:

> Hi Geoff
> 
> For the new developer, can you explain what the script is doing in more
> detail?
> 
> 
> Thank you
> 
> Vaughn Clement
> 
> Apps by Vaughn Clement (Support)
> *http://www.appsbyvaughnclement.com/tools/home-page/*
> Skype: vaughn.clement
> https://secure.join.me/appsbyvclement
> FaceTime: vclem...@gmail.com
> LogMeIn also avaialble
> Call on "ooVoo" at address:  vaughnclement or 9282549062
> Ph. 928-254-9062
> Cloud Hosting Registration Web Site:
> https://my.oditech.com/cart.php?a=add&pid=41
> 
> 
> On Sun, Sep 15, 2013 at 11:53 AM, Geoff Canyon <gcan...@gmail.com> wrote:
> 
>> In the absence of confirmation from someone looking at the engine code, I
>> wrote a test. Here are two handlers, with comments explaining what I think
>> is going on:
>> 
>> on mouseUp
>>   put 1 into X -- X is a number
>>   put 1 into Y -- Y is a number
>>   put the long seconds into T
>>   repeat 9999999
>>      put X into Z -- Z is a number, no conversion
>>      add Z to Y -- Z is a number, no conversion
>>   end repeat
>>   put the long seconds - T
>> end mouseUp
>> 
>> 
>> on mouseUp
>>   put "1" into X -- X is a string
>>   put 1 into Y -- Y is a number
>>   put the long seconds into T
>>   repeat 9999999
>>      put X into Z -- after the first loop, each time Z has to convert back
>> to a string
>>      add Z to Y -- Z has to be converted to a number
>>   end repeat
>>   put the long seconds - T
>> end mouseUp
>> 
>> On my mac, the second handler consistently takes 10% longer to run. Since
>> the handlers are otherwise identical, I have to think string conversion is
>> causing the slowdown, and that in the first handler, nothing is being
>> stored as a string.
>> 
>> gc
>> 
>> 
>> On Sat, Sep 14, 2013 at 11:08 PM, <dunb...@aol.com> wrote:
>> 
>>> Geoff.
>>> 
>>> 
>>> I could be misRemembering, possibly even in an earlier life (HC), that
>>> variable typing was done by the interpreter at runtime, or in HC 2, at
>>> compile time.
>>> 
>>> 
>>> Maybe this was changed in LC? Someone here must know...
>>> 
>>> 
>>> Craig
>>> 
>>> 
>>> 
>>> -----Original Message-----
>>> From: Geoff Canyon <gcan...@gmail.com>
>>> To: How to use LiveCode <use-livecode@lists.runrev.com>
>>> Sent: Sat, Sep 14, 2013 9:10 pm
>>> Subject: Re: Trying a custom handler for several math fields
>>> 
>>> 
>>> (We agree on all your other points)
>>> 
>>> I remember reading many years ago on this mailing list that if you
>> assign a
>>> number  to a variable:
>>> 
>>> put 52 into x
>>> 
>>> LC stores that variable as a number from the get-go and only converts it
>>> to a
>>> string if needed.
>>> 
>>> Sent from my iPad
>>> 
>>> On Sep 14, 2013, at 9:22 AM, dunb...@aol.com wrote:
>>> 
>>>> If you add a number to "50", it is then that the engine types the
>> string
>>> as a
>>> number.
>>> 
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode@lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription
>>> preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>> 
>>> 
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode@lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
> _______________________________________________
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to