When I assume .....

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

When I assume .....

Curry Kenworthy via use-livecode
Hi folks,

I've been with LC for 5 years now ...I use the send in time format alot
because i want to keep my interface unblocked.

In this code ...


on mouseUp
   local test_array

   put "a" into test_array["1"]
   put "b" into test_array["2"]
   put "c" into test_array["3"]

   send "TestCommand test_array" to me in 0 milliseconds (1)
   TestCommand test_array (2)
end mouseUp

on TestCommand IncomingArray
   answer the keys of IncomingArray &&  IncomingArray["1"]
end TestCommand


I had no idea that both these methods work the same way..... (1), (2)

I always assumed that the send in quotes version would treat the variable
name as a string not as a variable that it is.

I decided to do a test today and sure enough ... the behavior is identical.

I built and optimized many workarounds to this 'problem'

had I only done a simple test ...I would have saved alot of time.

moral of the story ....test...don't assume.
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: When I assume .....

Curry Kenworthy via use-livecode
On 07/02/2018 02:55 PM, Tom Glod via use-livecode wrote:

> I decided to do a test today and sure enough ... the behavior is identical.

They're not identical. The immediate version will invoke TestCommand
during the execution of mouseUp. The 'send in time' version will invoke
TestCommand after the mouseUp handler is done. That's the purpose of
sending a command in time: even with an interval of 0 milliseconds
you're delaying the sent action until the current handler has finished.

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: When I assume .....

Curry Kenworthy via use-livecode
Mark, I meant that the command I am calling is able to receive the array
variable via parameter.... like i said .. i assumed variable name was being
sent as string ..not as variable array and its data.

On Mon, Jul 2, 2018 at 6:10 PM, Mark Wieder via use-livecode <
[hidden email]> wrote:

> On 07/02/2018 02:55 PM, Tom Glod via use-livecode wrote:
>
> I decided to do a test today and sure enough ... the behavior is identical.
>>
>
> They're not identical. The immediate version will invoke TestCommand
> during the execution of mouseUp. The 'send in time' version will invoke
> TestCommand after the mouseUp handler is done. That's the purpose of
> sending a command in time: even with an interval of 0 milliseconds you're
> delaying the sent action until the current handler has finished.
>
> --
>  Mark Wieder
>  [hidden email]
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode