On 2016-01-08 21:56, Monte Goulding wrote:
Using Mark’s example:

on processThing
 load url "..." with block pResultCode, pData, pError
   ---
 end block
end processThing

— OR

on processThing
 load url "..." with processThing2
end processThing

block processThing2 pResultCode, pData, pError
 --
end processThing2

Is the block syntax really any better than just using callbacks?

If you don't have the block inline, then it is the same; if you do then things get unwieldy as soon as you want to sequence 3 or more things (I tend to find at least).

Ideally, I think all blocking operations would block using 'with with messages', and message loops created in this way would run side-by-side rather than recursively (the current recursive nature is why you get into a lot of trouble with 'get url' if you aren't careful).

In terms of cancellation, then you could imagine that each handler stack which is started (all running side-by-side in a co-operative fashion) has some sort of easily accessible id (e.g. the task id) which you could save and then do something like 'cancel task id ...'. This would cause a 'cancelled' exception to be generated in the context of that task so it could clean itself up.

Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

_______________________________________________
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