caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Missing Symbols
@ 2001-12-07  0:12 David McClain
  0 siblings, 0 replies; only message in thread
From: David McClain @ 2001-12-07  0:12 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-12-07 14:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-07  0:12 [Caml-list] Missing Symbols David McClain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).