IndexNextUpPreviousUrbi SDK 3.0.0

Chapter 17
Migration from urbiscript 2 to urbiscript 3

This chapter describes the changes needed to make urbiscript code written for urbiscript 2 work in the urbiscript 3 interpreter.

 17.1 Automatic function evaluation without parenthesis
 17.2 getSlot and setSlot
 17.3 Packages

17.1 Automatic function evaluation without parenthesis

The most visible change from urbiscript 2 to urbiscript 3 is that functions are no longer called when parenthesis are omitted. The function itself is returned instead.

So one must add missing parenthesis around all function calls, or convert functions with no arguments to properties (7.8) where appropriate.

To help you track function calls missing parenthesis, you can define the environment variable URBI_REPORT_MISSING_PAREN.

function f() {1}; 
[00004397] function () { 1 } 
f; // In urbiscript 2 this would have called f 
[  Urbi.Compatibility   ] Maybe missing parens at 2.1 
[00005092] function () { 1 }  

This will produce false positives in the urbiscript standard library that you can safely ignore, and false positives in urbiscript 3 code.

17.2 getSlot and setSlot

Since Slots are now exposed in urbiscript, the urbiscript 2 Slot.getSlot and Slot.setSlot have been renamed to Slot.getSlotValue and Slot.setSlotValue.

17.3 Packages

Since packages (8) were introduced, some functions are no longuer directly accessible without the proper import or package prefix. One notable instance is the content of System:

[02623134:error] !!! 29.1-8: lookup failed: hostName 
[02627733] "redlance" 
import System.*; 
[02635245] "redlance"