Language Tips and Tricks - Basic

This page is intended for basic level programmers. See Advanced Magik Language for more advanced language uses.


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

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

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License