Thanks Mark - that's a great solution for a one-liner, or even for a 2-
or 3- liner, but not practical for a real=life, multi-line handler.
(And as a purist I'd mention that it implements call-by-name not
call-by-reference, to the sound of Algol reference papers 'thunk'ing
onto my desk :-)
See the result of
on mouseUp
local X, J
put 1 into J
put 1 into x[1]
put 7 into X[2]
inc "x[J]", "J" // use quotes instead of @
put x[1] && x[2]
end mouseUp
on inc x, t
local myContext
put line -1 of the executionContexts into myContext
set the debugContext to line -2 of the executionContexts
debugDo ("add 1 to" && t)
debugDo ("add 1 to" && x)
set the debugContext to myContext
end inc
call-by-ref would have given "2 7" but here we get "1 8"
Thanks again
-- Alex.
On 01/10/2012 00:32, Mark Schonewille wrote:
This:
on foo
put 1 into x[1
inc "x[1]" // use quotes instead of @
put x[1]
end foo
on inc x
put line -1 of the executionContexts into myContext
set the debugContext to line -2 of the executionContexts
debugDo ("add 1 to"&& x)
set the debugContext to myContext
end inc
--
Best regards,
Mark Schonewille
Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553
Use Color Converter to convert CMYK, RGB, RAL, XYZ, H.Lab and other colour
spaces. http://www.color-converter.com
So we have a question: if enough folks find this sort of suggested syntax
useful, by what syntactic means could we tell the interpreter not to evaluate
the argument?
--
Richard Gaskin
Fourth World
LiveCode training and consulting: http://www.fourthworld.com
Webzine for LiveCode developers: http://www.LiveCodeJournal.com
Follow me on Twitter: http://twitter.com/FourthWorldSys
_______________________________________________
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