More on symbols


[ Zettels Traum ] [ search / suche ]

von dp am 13.Januar 98 um 17:48:33:

From: John Dowdell
Subject: Re: More on Symbols

Peter McBride wrote on April 29 of finding the position of symbols in their
lookup table, "Is anybody doing anything with symbol math? My hacker hackles are
up! Is it possible to rebuild the symbol table using something like 'put the
symbol of 355' (which doesn't work) or ANYTHING else along these lines?
Macromedia Techs?"

More info is in the back conversations on DIRECT-L. With the phrase "put #apple
+ 0" both arguments are automatically coerced to integers, just as "put 23 into
field Y" will automatically coerce the integer to a string, and "put 7 + 1.0"
will automatically coerce the integer to a float.

We can determine the position of a symbol in the lookup table, but I have not
found a way to determine the symbol at a given position in the table, and I'd be
surprised if there were a way to manually reorder the lookup table, particularly
for reserved keywords... such a shuffling would risk breaking previous
references to those symbols.

Reserved keywords will have the same position across restarts, and common
reserved keywords will have the same position across versions. Your own symbols
are added to the symbol lookup table in the order in which they're called,
though... can vary across sessions. Once an item is in the table its position
is, to the best of my knowledge, locked for the rest of that session,
case-insensitively.

The only unique use I've seen for this trick is to determine the total number of
current symbols, which can still be a critical element in Win3.1 engines with
their segmented memory model. A list must fit into a single 64K memory segment,
which can work out to about 5-10K distinct elements, depending on length.
(Rephrased: You can overflow a Win3.1 engine with tons o'symbols, and the
symptom would be alerts such as "handler undefined: #startMovie" and similar
alerts. More info's in the KB.)


Chris Allert writes later in the thread on wishing for a string-to-symbol
coercion operator. There's one in D6, but the usual way in previous versions is
to "set theSymbol to value('#' & theString)". Depending on the origin of the
string you may need to search for spaces or leading integers, either of which
would produce invalid symbols.


Regards,
John Dowdell
Macromedia Tech Support


Dazu:























D. Plänitz