Re: User defined precedence for user defined operators.

Marco van de Voort <marcov@stack.nl>
15 Aug 2006 18:57:20 -0400

          From comp.compilers

Related articles
User defined precedence for user defined operators. gah@ugcs.caltech.edu (glen herrmannsfeldt) (2006-08-14)
Re: User defined precedence for user defined operators. tommy.thorn@gmail.com (Tommy Thorn) (2006-08-15)
Re: User defined precedence for user defined operators. DrDiettrich1@aol.com (Hans-Peter Diettrich) (2006-08-15)
Re: User defined precedence for user defined operators. marcov@stack.nl (Marco van de Voort) (2006-08-15)
Re: User defined precedence for user defined operators. tmk@netvision.net.il (Michael Tiomkin) (2006-08-15)
User defined precedence for user defined operators. derek@knosof.co.uk (Derek M Jones) (2006-08-15)
Re: User defined precedence for user defined operators. torbenm@app-5.diku.dk (2006-08-18)
| List of all articles for this month |

From: Marco van de Voort <marcov@stack.nl>
Newsgroups: comp.lang.fortran,comp.compilers
Followup-To: comp.compilers
Date: 15 Aug 2006 18:57:20 -0400
Organization: Stack Usenet News Service
References: <1155280055.803334.85200@h48g2000cwc.googlegroups.com> <1155424619.168792.202040@h48g2000cwc.googlegroups.com> <ebpn6e$qbt$1@vilya.larc.nasa.gov> <1hk1yfv.zyn74w12uw4xsN%nospam@see.signature> <44E0B3FF.4040401@cits1.stanford.edu> 06-08-081
Keywords: Fortran, design, comment
Posted-Date: 15 Aug 2006 18:57:20 EDT

On 2006-08-14, glen herrmannsfeldt <gah@ugcs.caltech.edu> wrote:


> [I don't think I've ever seen a language where the operator precedence
> depended on the types of the operands, and I hope I never do. -John]


I could imagine that the languages that auto convert to string when a string
is added to a number prefer to do the algorithmic part first?
e.g. 1+2+''


[Seems like a shortsighted micro-optimization to me. Getting these
things right is very hard; a classic example is adding strings in PL/I
and storing the result back in a string, where '123'+'456' produces ' '
because the result is converted to a fixed length string padded out
with spaces, then truncated from the right. Each rule makes sense by
itself, but they combine to produce absurd results. -John]


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.