[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: shared-text substrings

Shriram Krishnamurthi <shriram@xxxxxxxxxxx> writes:

> Keywords in your implementation are wholly unnecesary.  This is a data
> language, not a procedure call context.  The XML collection could just
> as well have used the syntax you propose, or indeed many others.

Even in this context of pure data (as opposed to procedure calls),
builtin keyword support has teh advantage that keywords are
self-evaluating, and they are distinct from normal symbols.  When you
use the `NAME:' syntax they also have a nice read/-print-syntax that
is natural for specifying name-value pairs.  (Languages that have
keywords may also have some mechanism that automates processing of
keyword arguments passed to procedures, but keywords can be useful
independent of that - as in my example.)

> And this is without even getting into the cost of keywords,

Keywords per se are cheap. Processing keyword parameters can
be expensive, but you only pay for it when you use it.

> indeed even their appropriateness (as a poor man's substitute for
> objects -- why bother when you have real objects?),

I don't know where this is coming from - I see keywords as completely
orthogonal to objects.  (Keywords make it nice to specify initial
attributes of objects, though.)

> PS: Now that I think about it even more, I *can't* reuse the
>     implementation of keywords built into the implementation (using,
>     say, APPLY), because the set of keywords used by the set of all
>     documents is naturally limitless, whereas keyword syntaxes use a
>     fixed set of keywords.  So keywords don't help any.

I agree a general XML-processing applications cannot take much
advantage of the keyword processing done for keyword parameters.  Thus
keywords don't help in any *fundamental* way.  Where they do help is
in the *syntax*:  They allow a more readable, more concise, less
error-prone syntax, since they don't depend on as many parentheses.
This is mainly a matter of personal preference, but I suspect the
keyword style will be more natural for most people.
	--Per Bothner
per@xxxxxxxxxxx   http://www.bothner.com/~per/