[mcclim-devel] Presentation Translator Utilities

Daniel Jensen daniel at bigwalter.net
Mon May 14 20:11:58 UTC 2007


I began writing the functions in 27.5 "Presentation Translator
Utilities", since they are missing in McCLIM, but I'm having trouble
reading the spec.

The spec does not go into detail on how translators are implemented. The
description for define-presentation-translator mentions that they have
names and are stored in command tables. The McCLIM implementation is a
reasonable interpretation of this.

The problem lies with add-presentation-translator-to-command-table. Here
it is very clear that the name is used outside command tables too:

    add-presentation-translator-to-command-table
    command-table translator-name &key (errorp t)  [Function]

    Adds the translator named by translator-name to command-table. The
    translator must have been previously defined with
    define-presentation-translator or
    define-presentation-to-command-translator.

It is not possible to write this function without changing more stuff. I
guess it calls for a global translator table (i.e., a hash table.)

What do you think? I don't really get it. I would much rather like to
change the definition of add-presentation-translator-to-command-table.
It makes more sense to me to do it like this:

    add-presentation-translator-to-command-table
    command-table translator &key (errorp t)  [Function]

    Adds a presentation translator to command-table. The translator must
    have been previously defined with define-presentation-translator or
    define-presentation-to-command-translator.

This removes the only usage of the global name. It is more consistent
with the other translator functions.

I attach a file with the functions from 27.5. See if you like it. It
might be an idea to refactor them together with the rest of the
translator code, because I copied a lot from there.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: presentation-translator-utils.lisp
Type: application/octet-stream
Size: 2671 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/mcclim-devel/attachments/20070514/aee52bac/attachment.obj>


More information about the mcclim-devel mailing list