Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!nrl-cmf!ukma!gatech!hubcap!ncrcae!ncrlnk!uunet!mcvax!ukc!etive!aipna!jeff From: jeff@aipna.ed.ac.uk (Jeff Dalton) Newsgroups: comp.lang.lisp Subject: Re: Common Lisp Problems with Hash-table in Macros Message-ID: <403@aipna.ed.ac.uk> Date: 16 Dec 88 16:43:28 GMT References: <701@crin.crin.fr> Reply-To: jeff@uk.ac.ed.aipna.UUCP (Jeff Dalton) Organization: Dept. of AI, Edinburgh, UK Lines: 48 In article <701@crin.crin.fr> stephan@crin.crin.fr (Stephan BRUNESSAUX) writes: >In article <393@aipna.ed.ac.uk> you write: >>In KCL, the hash table just gets PRINTed and so looks like this: >> >> # >My first question is : why the compiler does not DUMP the hash table ? I guess it's because someone would have to write DUMP, whatever it is. CLtL doesn't say much about what should happen to quoted constants in code that gets compiled. There are some cleanup items about this being discussed by the X3J13 Compiler subcommittee, so it should be clarified in the standard; but right now different implementations do quite different things. There has also been a proposal to give hash tables a printed representation, by the way. >The above example correctly runs if you supersede the hash table by a vector >(with some changes to display the contents). True. >On Symbolics, the hash table is DUMPed; so, you can read or modify the hash >table after loading the compiled file. Some implementations might put it in a read-only area. >On Explorer, the hash table seems to be dumped but no longer works since you >cannot add or remove any entries. Not surprising. >My second question is : Am I right to write that kind of macro ? That will depend on what X3J13 finally says. I think it is probably safe to use something like "#," (or a LOAD-TIME-EVAL special form, if it gets added to Common Lisp) to include an expression that builds the hash table at load time. >My third question is : As far as I developped on Symbolics (in Common Lisp >package) a big software using that kind of macros, is it normal to encounter >such problems on others Common Lisps ? Probably, because it isn't well-defined by Common Lisp: the Language, and because people don't completely agree on what should be done. Jeff Dalton, JANET: J.Dalton@uk.ac.ed AI Applications Institute, ARPA: J.Dalton%uk.ac.ed@nss.cs.ucl.ac.uk Edinburgh University. UUCP: ...!ukc!ed.ac.uk!J.Dalton