Re: Keyword implementation
Andreas Rottmann <[email protected]> Mon, 07 Jun 2004 19:46:43 +0200
| Newsgroups | gmane.lisp.scheme.pika.devel |
|---|---|
| Message-ID | <[email protected]> |
Tom Lord <lord-1tv/[email protected]> writes: > > From: Andreas Rottmann <[email protected]> > > > I just sat down to do a bit of work on keywords. I've now > > implemented lexer support for R5RS-compatible keywords, and am > > now thinking about how to best implement the data structure for > > them. Would a one-slot vtable object, whose slot carries the > > symbol corresponding to the keyword work? This way we can easily > > reuse parts of the symbols implementation (e.g. interning), plus > > KEYWORD->SYMBOL and SYMBOL->KEYWORD will be quite fast. OTOH, > > this would make keywords more heavyweight and EQ? will not work > > for them, so this is probably not a good idea. Thoughts? > > > My non-scientific opinion, based on my experience with keywords, is > that conversion to and from symbols is rarely needed. It isn't > important for it to be fast. > > On the other hand, keywords wind up being used in MEMQ calls and CASE > expressions often, so EQ? speed for keywords is very important. > I agree. My current approach is to "duplicate" the interning infrastructure for keywords (i.e. have a keyword_table in struct scm_gc_arena). Andy -- Andreas Rottmann | [email protected] | [email protected] | [email protected] http://yi.org/rotty | GnuPG Key: http://yi.org/rotty/gpg.asc Fingerprint | DFB4 4EB4 78A4 5EEE 6219 F228 F92F CFC5 01FD 5B62 Say NO to Software Patents! -- http://petition.eurolinux.org/