Browse thread
[Caml-list] Missing Symbols
- David McClain
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2001-12-07 (14:42) |
From: | David McClain <barabh@q...> |
Subject: | [Caml-list] Missing Symbols |
Hi, On a number of occaisions now, I have been faced with the need for "symbols" in the language -- most notably some syntactic items that can be read from a script at runtime and used internally to represent themselves uniquely. This can be synthesized with strings and hashtables holding "unique" copies of these string items, but that requires a clumsy syntax in the scanned text files, e.g., "aSymbol" instead of something like #aSymbol (sans quotes). I tend to make my symbols case insensitive. It also requires a fair amount of internal code scaffolding to support these items. I find it a curious omission from languages aimed at symbolic computation, not to have a type Symbol along the lines of the keyword symbol package in Lisp. I do understand that union types can serve as just this -- inside the program code. But that still leaves the connection to the outside world lacking. The particular prompt for this feature re-arose when I tried to program a smart scripting program that can take a description of foreign interfaces, run it against a prewritten template text file, and perform intelligent substitutions: E.g., the template file might read, #ifdef __GENERATE_PROTOS__ ~~(:c-function-prototypes) #endif which is used by the program along with a list of abstract, langauge independent, interface specifications. The symbol here ":c-function-prototypes" is carried into the template reader and used as a hashtable lookup key for the function to perform this request. The tilde-paren is the tip off that a symbolic request is about to be made. Otherwise, all the text in the template file is simply written to the output file as is. Any thoughts on why the language decision was made to elide symbolic items? Cheers, - David McClain, Sr. Scientist, Raytheon Systems Co., Tucson, AZ ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr