Dragaera

Evolving language

books at bofh.com books at bofh.com
Thu Aug 22 10:32:34 PDT 2002

[Mark M]
>Oh, sure. Contextual distinction. In Perl, the '#' character begins a
>comment, but '$#foo', iirc, is an assignable variable meaning the
>highest subscript value in the array @foo.

I think in this case #, is a special character, that only has meaning
in the comment case and the array indexing.  I suspect that it's
something that Larry put in for convienence, but I'm unsure how the
interpreter/compiler handles it.  (since you can accomplish the
same thing with size(@array) -1 ).  Then again, that seems like a bit
of a kludge, and Larry doesn't generally kludge stuff.  Regardless,
in both cases it is not an operator but more of a variable.  (In the
comment case it isn't really a variable, but it's also not an
operator.)

Ok, so I broke out my _Bat_ book, and if you'll excuse some sweeping, and 
perhaps wrong, generalizations I'll explain why I think sendmail is
the conterexample.

Brief background:

Sendmail rules are broken into 3 parts, only 2 of which are of real
interest to us:

Left Hand Side (LHS) [tab] Right Hand Side (RHS) [tab] Comment

The LHS is used as a pattern match with the workspace to determine
if a rule is invoked.

The RHS rewrites the workspace.  The sytax for the RHS is:

Operator rule

Discussion:

Consider the rule matching an address where the workspace as 0 remaining
tokes and you want to rewrite it once and return (don't continue within
the rule) and you want to do it the rewrite on a lookup from the database.
Here is an example of how this could be done:

R$@	$@$(U $2 $@$1 $:$2.XXX $)

In this case $@ is the matching string (I think operator would be
incorrect here), the rewrite operator and finally the substitution
determinator (again a string).

This strikes me as an example of when a single 'symbol' is being
used in multiple contexts, and thus is a counter-example.

-Jot

P.S: No warranty is made, expressed or implied about the
validity of this in any sendmail configuration.  It takes me 
a not inconsiderable amount of time, immersing myself in a 
particular problem, to really grok sendmail configurations.  I've
done it before, but not unlike hitting yourself in the testicles,
it's not much fun.  :)