Command-line Editor

Command-line is handy for many computations and also rather useful to isolate and test parts of a script.

 

1) History file:

At the very first session a history file (.shist) is created and upon exiting ScienceSuit the commands are recorded to the history file. During any session by using the up and down arrow keys it is possible to find the previously executed commands.

 

 

2) Auto-completion and Help

The intelli-sense feature of command-line offers the correct parameters whether it is a library or a data structure and filters the list as the user continues typing.

As seen above once a composite data such as std, followed by a "." or ":" is typed, the contents will be listed and will be shown with the following signs:

 

Continuing to type after the auto-complete dialog is shown will filter the contents of the auto-complete dialog to be able to find the exact match. Selecting any of the list item, will show a help if there is one help file associated with the item. Currently, there is help associated with over 160 functions.

 

The intelli-sense feature also recognizes the type of the variable and offers the code-completion accordingly.

 

 

3) Variable scope

The variables created via command-line are directly placed in the global table. Therefore, if a variable is created using the keyword local, that variable will not be accessible anymore.

>>a=3
>>local b=2
>>c=a+b
[string "c=a+b"]:1: attempt to perform arithmetic on a nil value (global 'b')

 

By printing out the variables, we can easily see why the error was thrown.

>>a
3

>>b
nil