Motivation for Alias Routine Names
Built-in routines of a programming environment have normally a fix name and a given argument order. If you don't adhere to these "details", they simply won't work...
So in order to compute e.g. the square root of some number x, where there is a function sqrt for, you will have to use sqrt(x) , whereas "square_root(x) " won't of course work.
With some plugged-in demo controller modules like Turtleizer, this is now (i.e. since version 3.27-05) different: Teachers requested a possibility to "translate" (more generally: to rename) the available turtle commands in order to facilitate the learning process of their pupils, such that e.g. users in Spain might type "adelante" instead of "forward" in order to move the turtle ahead.
But these alias names should not automatically change with the chosen dialog language. So a separate preferences mechanism was needed.
The Controller Alias Specification
Version 3.27-05 introduced an additional preferences dialog available via menu item "Preferences › Controller Aliases ...":
When selected, the following dialog will appear where you may specify your favourite alias names for the available routines of plugged-in controller modules (by now there is only Turtleizer, but some day there might be more):
The dialog contains a tab for every plugged-in diagram controller module with a lexicographically sorted table of all available procedures and functions. The left column shows the original signatures (i.e. names, expected argument types, and the result type — if the routine returns a value). The right column is initially empty, but you may fill in your favourite alias routine names, which are virtually to replace the original names. Don't write parentheses and type names there, just the alternative routine name. Argument number and types cannot be changed. The alias names must be identifiers, i.e. they must only consist of (English) letters, digits, and possibly underscores, like this_is_4_you. Other characters like spaces, hyphens, operator symbols, or special alphanumerical characters (e.g. ä, ú, ß) must not occur. Otherwise your typed name will be rejected:
The dialog does not only check identifier syntax but also that there won't be name conflicts among the controller routines. This check is only done when you press the "OK" button or try to leave the dialog with <Ctrl><Enter> or <Shift><Enter> (which also mean committing the changes). If the combination of an alias name with the argument number of the associated routine equals some original routine signature or another specified alias (case-ignorantly), then an error message listing all conflicting sets of routines will pop up and tells you to resolve the listed conflicts (by choosing other names or by clearing conflicting aliases):
You may use the same alias name for routines with different argument number, though, but not for routines with equal argument numbers.
(By the way, the conflict list is sent to the system clipboard when the "OK" button of the above message box is pressed such that you might save it somewhere and have a look at it while you modify the conflicting names.)
An empty cell in the right column means "no alias" for the routine of that row. So by clearing a cell you can delete a specified or conflicting alias.
If you leave the dialog with <Esc> or by pressing the close button ([x]) then all your changes will be discarded (forgotten).
The Effects
In order to make the alias definitions effective you must select the checkbox "Apply the specified aliases on display etc." above the tab region in the Diagram Controller Aliases dialog (see screenshot farther above).
If you do so then the defined alias names will immediately replace the original routine names in the rendering of the diagram and on editing:
In syntax highlighting mode, the alias names will be underlined for easier distinction.
In the element editor you may type either the original or the alias name without making a difference: The diagram will constantly show the alias, and when you edit a respective element, you will find the alias in the editor text area.
Internally, however, the original routine names are still stored in the diagram, such that execution, code export etc. are not affected, i.e. they work as before. This way, you will even see loaded diagrams with your set of aliases if they have been created without any alias or with a different set of aliases. |