[metapost] Re: [metafont] Re: all intersections between two paths

Hans Hagen pragma at wxs.nl
Mon Jan 17 13:43:57 CET 2005

Laurence Finston wrote:

> With all due respect, I think this is an area where TeX and MF
> use completely different strategies.  If I remember correctly,
> Knuth had to be talked into including loops in TeX, and in my

there are no loops in tex

> opinion, they're not the nicest part of TeX.  While TeX has
> loops and MF has macros, if I had to describe

both tex and mf/mp have macros

> TeX and MF in no more than two words each, I would say that TeX
> is a "macro processor" and MF is an "interpreter".  It therefore

hm, both are macro-interpreters -)

> stands to reason that the implementation of macros, including the
> handling of recursion, would be especially efficient in TeX, while
> that of loops would be especially efficient in MF.  In GNU 3DLDF,
> and I suspect in MF, the cost of a macro call is largely the cost
> of copying the replacement text, replacing placeholders with the
> arguments, arranging to read input from the copy, and arranging to
> return to the original input source when it's been read.

a few differences:

- in tex output and 'programming' are mixed
- mp has functions with return values (vardef etc) which tex unfortunalty lacks
- tex and mp have a different concept of grouping

for the rest, they serve a different purpose; also, my guess is that knuth made 
them different (in some language aspects) simply in order to demonstrate 
different mechanisms; keep in mind that both programs served as examples of 
documented code for his students


                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl

More information about the metapost mailing list