From: | malcolm@sedi8.nag.co.uk (Malcolm Cohen) |
Newsgroups: | comp.compilers,comp.lang.misc,comp.arch.arithmetic |
Date: | 16 Mar 1997 23:34:24 -0500 |
Organization: | The Numerical Algorithms Group Ltd., Oxford, U.K. |
References: | 97-03-037 97-03-051 |
Keywords: | design |
Richard Rogers <rrogers@cs.washington.edu> wrote:
>In fact, I might go as far as to say that
>
>(mnvs \oplus k1 \dot k2) \otimes ijq4
>
>is better code than
>
>frop (glort ( foo (mnvs, k1), k2), ijq4)
>
>if only because it's easier for humans to parse
You must be joking, not to mention biasing the question.
The bias: you should have used the same names for both, e.g.
(mnvs \foo k1 \glort k2) \frop ijq4
And this human did not find it easier to parse the above, i.e. is that
((mnvs \foo k1) \glort k2) \frop ijq4
or
(mnvs \foo (k1 \glort k2)) \frop ijq4
(Ok, more familiarity with TeX might have helped me here - I haven't a clue
what its precedence rules are).
> with a restricted set of operators, your're forced to chose
> something at least a little better than "frop."
Well sure, if you cannot invent new operators but only overload the
existing ones, it is not longer any harder to parse than before
(though understanding the semantics may have suffered).
But if you can invent new operator names
(a) the language cannot force you to make those sensible
(b) unless the precedence rules are *very* simple - e.g. one level and always
left-to-right (like your example seems to imply) or always lowest
precedence and left-to-right associative (like Fortran 90) - you have
upped the ante on merely parsing the expression, and on code maintenance.
Cheers,
...........................Malcolm Cohen, NAG Ltd., Oxford, U.K.
(malcolm@nag.co.uk)
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.