Tuesday, April 3, 2007

CST 4.1 allows single-quote strings

CST version 4.1 now allows single-quote strings.

Here's an example. Let's say you wanted to put in the short-hand notation for inch in a string. So you might try...


MagikSF> length << "5""
$
**** Error (parser_error): on line 1
length << "5""
^
Missing end of statement


The Magik compiler gets confused by your use of the double-quote character as a string delimiter and an inch unit.

To get around that in Magik, you would have to do something like...


MagikSF> length << write_string(5,%")
$
"5""


But as of version 4.1 you can use single quotes for strings...


MagikSF> length << '5"'
$
"5""


And if you wanted to do something similar with the short hand for feet units, you could do...


MagikSF> length << "5'"
$
"5'"



Incidentally...

MagikSF> '5' = "5"
$
True

No comments: