Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!hplabs!hpcc05!hpyhde4!hpycla!hpcuhc!hpcupt3!shankar From: shankar@hpcupt3.cup.hp.com (Shankar Unni) Newsgroups: comp.lang.c++ Subject: Re: taking powers with "^" Message-ID: <45680013@hpcupt3.cup.hp.com> Date: 29 Jun 91 04:21:58 GMT References: <1920003@hpsad.HP.COM> Organization: HP India Software Op., Bangalore Lines: 35 In comp.lang.c++, etj90@ecs.soton.ac.uk (Khaos) writes: > This just gave me a Thought. Defining your own "meta-operators" would > allow you to define things that aren't a normal language thing at all, > such as foo@bar would allow you to e.g. booleanly test for the existence > of foo in your Object bar (a database of some sort). If this is too > woolly and 7th generation language-y then ignore it but defining your > own operators (although I think retaining priorities of overloaded op's > is a good idea) would be REELY K00L. ^^^^^^^^^^ It's a bird! It's a plane! It's ... BIFF?? :-) Anyway, having just used a language that allows you just this sort of facility (Prolog) - defining or modifying *any* arbitrary operator, along with precedence and arguments (unary and binary only, though :-/), I can say that it's an interesting feature, but used too rarely to justify the enormously more complex (or inefficient) parser required for such dynamic grammar changes. One of the most attractive features of C++ is that it's still a compact language, for which very efficient code can be generated. While the "general operator" facility won't necessarily detract from either of these, it will add an order of magnitude to the difficulty of writing a compiler for the language. That said, I'd also vote for an exponentiation operator as one of the "numeric extensions" to the language. I hope there will eventually be a formal tie-up between the ANSI C++ committee and the NCEG (Numerical C Extensions Group, a subgroup of the ANSI C committee), unless there is one already... ----- Shankar Unni E-Mail: HP India Software Operation, Bangalore Internet: shankar@india.hp.com Phone : +91-812-261254 x417 UUCP: ...!hplabs!hpda!shankar