This page is intended for basic level programmers. See Advanced Magik Language for more advanced language uses.
proc()
To create a global variable that is to run a proc use the following
_global a_global_proc <<
_proc @a_global_proc(_optional args) # The @ is a label
# Do something
_endproc
A gotcha to look out for… do not put () after _endproc() or your global will be evaluated to whatever the proc returns. Although this may be useful ins some cases, it can cause grief to figure out why the global proc isn't a proc but a result.
Colours (Colors)
Determining predefined colours
Many of you know about the method colour.called() and you can pass in a symbol like :red, :black, :white, etc. But how do you know what colors are already defined? Well, it is private constant called colour_table. So you can do a print or loop over colour.sys!perform(:colour_table).
More Info From describe_fields()
These changes will show the size of the selection or db_rope within describe fields
Loops
Gather Tuples (loop variables)
If you are unsure (or don't care) what is being returned from the loopbody you can use _gather on the _for statement.
_for _gather vals _over {:a,:b,:c}.fast_keys_and_elements()
_loop
show(_scatter vals)
_endloop