Re: Keyword abuse (Re: reduced size symbols/keywords)



På Fri, 29 Aug 2008 16:01:09 +0200, skrev Marco Antoniotti <marcoxa@xxxxxxxxx>:


Apart from all the previous comments which I agree with, there is an
issue that has been nagging me for some time. I see several libraries
(I won't name names!) that "abuse" keywords. The typical example is
the home brew HTML replacement that does the following

(:html (:head ...) (:body (:h1 ... (:ul ...))))

you get the idea.

I would advocate against this (and similar) use of keywords. Packaged
symbols are perfect for this kind of job.


Why is this abuse?
The idea of keywords is they are visible in all packages. Which in this case is exactly what you want.

(HTML:HTML (HTML:HEAD ...) (HTML:BODY...)
would be a real pain. After all HTML is typically in use on several packages and it is important that the refer to the same symbol.
If something unrelated to HTML uses the key like :body no harm is done.
If you have a 'body local to the package and a 'body in a different package they are not the same symbol.
This could cause errors.
It is far better to have it all in one place the KEYWORD package.

--------------
John Thingstad
.



Relevant Pages

  • Re: keyword o package?
    ... The protocol use ... Keywords won't give you checking for mis-spellings. ... The reader will make new keywords automatically. ... Exported symbols in a package, by contrast, will cause reader failures. ...
    (comp.lang.lisp)
  • Package Update: svn-multi v2.0 released as beta version
    ... External files can be declared inside the document and their keywords ... Automatic Declaration of all Files as Extra Groups: ... New Style of the Package Manual: ... All this features can be enabled using package options (some depend on ...
    (comp.text.tex)
  • Re: Package Update: svn-multi v2.0 released as beta version
    ... External files can be declared inside the document and their keywords ... Automatic Declaration of all Files as Extra Groups: ... New Style of the Package Manual: ... All this features can be enabled using package options (some depend on ...
    (comp.text.tex)
  • Re: Basic question
    ... Lisp keywords are symbols interned in the package named "KEYWORD". ... they have the special property of being automatically defined as ... LAMBDA is not a keyword, unless the current package is the package ...
    (comp.lang.lisp)
  • Re: openOffice Php MySQL
    ... I've been using only Kate and Vim in these exercises. ... about this but I have a feeling the editor in Quanta is either based ... You'll find it in the kdewebdev3 package, along with a few other useful ... KLinkStatus--validator for links on HTML pages ...
    (alt.os.linux.suse)