How are assignments and references different in Lasso 9 than in Lasso 8?
An example showing how the creation of assignments and references differs between Lasso 9 and Lasso 8.
7-3-2010 by
Why
Here's why you might do this:- You're storing objects in a map and you want to retrieve them using the syntax var:'varname' instead of always having to type $myMapName->(Find:'myMapKey').
In Lasso 9 you can also use $myMapName->find(myMapKey).
Discussion
Every variable in Lasso is a named reference to an object. The referenced object could be a string, integer, array, map, or any other data type. Usually, each object is only referenced by one variable.
In Lasso 8 (but NOT in Lasso 9) the [Reference] tag (@ symbol) allows a reference to data to be stored in a variable rather than a copy of the referenced data.
For example: [variable: 'VariableOne' = @($VariableTwo)] stores a reference to VariableTwo in VariableOne. Now, both variables refer to the same object and changes made to one are reflected in the other.
However, the [Reference] tag does not exist in Lasso 9. To get the same functionality you must use the [String->Replace] tag.
See more examples at https://lassosoft.wiki.zoho.com/What-Has-Changed.html#assignment-and-references.
The Lasso 8 Way:
The Lasso 9 Way:
Creative Computing