Related articles |
---|
silly question: prefix vs postfix ops rosing@peakfive.com (MattR) (2008-03-03) |
Re: silly question: prefix vs postfix ops csaavedra@alumnos.utalca.cl (Claudio Saavedra) (2008-03-03) |
Re: silly question: prefix vs postfix ops mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2008-03-03) |
Re: silly question: prefix vs postfix ops gah@ugcs.caltech.edu (glen herrmannsfeldt) (2008-03-03) |
Re: silly question: prefix vs postfix ops haberg_20080207@math.su.se (Hans Aberg) (2008-03-03) |
Re: silly question: prefix vs postfix ops marcov@stack.nl (Marco van de Voort) (2008-03-03) |
Re: silly question: prefix vs postfix ops gah@ugcs.caltech.edu (glen herrmannsfeldt) (2008-03-04) |
Re: silly question: prefix vs postfix ops dot@dotat.at (Tony Finch) (2008-03-04) |
Re: silly question: prefix vs postfix ops rpboland@gmail.com (Ralph Boland) (2008-03-04) |
[2 later articles] |
From: | "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> |
Newsgroups: | comp.compilers |
Date: | Mon, 3 Mar 2008 20:42:38 +0100 |
Organization: | cbb software GmbH |
References: | 08-03-012 |
Keywords: | syntax, design |
Posted-Date: | 03 Mar 2008 16:18:11 EST |
On Mon, 3 Mar 2008 10:37:52 -0800 (PST), MattR wrote:
> This is more of a language question than a compiler question (and
> therefore should create a religious battle :) ), but I'm wondering if
> the answer has more to do with the compiler. Anyway, why are there
> prefix operators that could just as well be postfix? Why is it !a and
> not a!, or *a and not a* ?
There is no reason. For example in Ada * and & are both postfix:
Ptr.all -- Dereference
X'Access -- Gets a pointer to X
> I can understand the increment and
> decrement operators,
This applies only to the operators with side effects, which is a bad idea
anyway.
> and the & op but expressions like *a[i] would be
> a lot clearer if it were a[i]*, just read the operators from right to
> left.
Why not, you could have array indexing prefix or infix. In mathematics
indices are placed before, above, below, inside... where it pleases the
writer.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
Return to the
comp.compilers page.
Search the
comp.compilers archives again.