Meta-language for mxTextTools

M.-A. Lemburg mal at lemburg.com
Fri Jul 16 05:58:57 EDT 1999


Tony J. Ibbs (Tibs) wrote:
> 
> M.-A. Lemburg wrote:
> > One itch that I have with the syntax: since you are
> > already using Pythonish syntax, why not simply write
> >
> > def keyword:
> >     ...
> >
> > instead of
> >
> > keyword is:
> >     ...
> 
> "is" was what I originally thought of, because I was trying to think of
> "reading" the tag table definition back to myself, and that sounded better.
> When I realised that I was wanting to be "Python-esque" I realised that
> using "def" would perhaps be more consistent, but by then I'd got used to
> "is", and also I couldn't help feeling that "def" was less clear *to me* - I
> wanted it to be obvious to me that I wasn't defining a function (perhaps I'm
> still (vaingloriously) hoping to allow Python code in tag-table files...).
> However, it's probably not a religious issue, and may perhaps change before
> things get released. How strong an itch is it?

Well, it's just that "def" state exactly what you are doing
when you define a table. "is" is only used in comaprisons in
Python, so the analogy doesn't go too far.

You might even consider using "table" to start the section.
This wouldn't conflict with functions/methods in Python and
still express what you are aiming at.
 
> > An alias "back" for -1 would help reading the tables:
> >
> > Skip back
> > vs.
> > Skip -1
> 
> I would be happy with that - would one bother with "forward" as well, even
> though I doubt that is as often used (I tend to assume not)? Or should one
> reuse "previous":
> 
>     Skip previous
> 
> which is explicit in meaning -1 (whereas to me "back" just indicates the
> direction), but seems to be missing the word "to".

There is a small difference in semantics between "previous" and
"back": you are using "previous" to move the instruction pointer
in the table, while "back" moves the engine's current position
in the text. So having to different synonyms may be a good idea
(the wording is secondary, IMHO).
 
> Hmm. I'll think on it - both have disadvantages for me, but I definitely
> like "hiding" that -1 (although since this is moving the read-head it is
> less important to me than losing what I think of as "line numbers" in the
> tag table).

Right. That's my major gripe with the tables: you constantly
have to adjust offsets whenever you insert things. A meta language
ought to take care of this by introducing jump targets.

Cheers,
-- 
Marc-Andre Lemburg
______________________________________________________________________
Y2000:                                                   168 days left
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/





More information about the Python-list mailing list