From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ae5e339df4dff313 X-Google-Attributes: gid103376,public From: Paul Graham Subject: Re: Language Lawyer question Date: 2000/06/02 Message-ID: <39381943.88350E6@cadence.com>#1/1 X-Deja-AN: 630358163 Content-Transfer-Encoding: 7bit References: <39380CEB.2CC4682E@ftw.rsc.raytheon.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Cadence Design Systems Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 2000-06-02T00:00:00+00:00 List-Id: Wes Groleau wrote: > Why do we have to write > Some_Type'Pred (Some_Value) > when > Some_Value'Pred > is more natural/intuitive and > carries just as much type info? > > I pointed out that there is no type info in a literal (like > Orange'Pred) but he said that the type info would be somewhere > else in the statement. I could not quickly come up with a > counter-example. Plus, how often would we use a literal as > parameter to 'Pred ? Might as well just use the literal value > of the Predecessor. It could be Some_Type'Pred(f(x)) for an arbitrary function f (this has the same problem as your example using a literal, but is more realistic. Or you might want to say Integer'Pred(1+1), which is easier to parse than (1+1)'Pred. An attribute like 'Pred has a kind of qualified expression syntax, if you think of Pred as an overloaded function predefined on all discrete types. Then the type qualifier Some_Type' resolves the overloading. Paul