Lists in Transcript

Brian Yennie briany at qldlearning.com
Mon May 23 18:41:44 EDT 2005


Ruslan, All,

> I wonder, is it good idea add to Transcript lists as they exists
> In Macromedia Director, WebSiphon, ...
>
>     func( var1, [v1, v2, "ffsdg", 4.52]  )

This makes me think a similar thing. For the example above, it has been 
suggested:

func( var1, "v1, v2, ffsdg, 4.52")

This almost does the same as a list, because you can easily say 
something like:

function func pVal, pList
    put item 1 of pList into x ## 'v1'
    put item 3 of pList into x ## 'ffsdg'
end func

This is what Rev programmers are used to using- "items".

However, there are two things I wish we could do:

1) Create multi-dimensional values / arrays. We have single key, 
associative arrays. They are handy no doubt, but limited. In the 
example of lists, embedded lists can only be "faked" using strings and 
tricky formatting.

2) Embed variable values in strings. For example, in PHP I can say:

$animal = 'dog';
$color = 'black';
$message = "My $animal is $color and costs \$5"; ## "My dog is black 
and costs $5"

In Transcript, I am forced to ALWAYS use concatenation operators, and a 
lot of "&" and "&&" can get pretty messy.
For example:

put (var1&comma&var2&comma&"some text"&comma&"4.52") into myValues

Would be a lot easier if I could say something natively like:

put "dog" into animal
put "black" into color
put "My @animal is @color and his email is @animal\@pets.com" into 
myValues
## "My dog is black and his email is dog at pets.com"

For a language where text chunking syntax is unparalleled, it sure is a 
pain to concatenate. Heck, the above could probably be implemented 
using some sort of pre-processor on the script editor. Another thing 
which I would like to see - if there was a standard API for 
preprocessing scripts prior to compilation, then the language could 
actually be extended outside of the engine by 3rd parties. For example, 
the above syntax for concatenating could be supported by a preprocessor 
which simply (pseudo-code):

FOR EACH string literal
	REPLACE @xxx with ("&xxx&")
	REPLACE "\@" with "@"

There is a format() function, but come on, a function call? New users 
or converts are unlikely to find it or understand why it's not native.

>
> Very compact form of notation.
>
> And IMHO fit into ideology of Revolution.



More information about the use-livecode mailing list