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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,79bbf7e359159d0d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-06 15:22:12 PST Newsgroups: comp.lang.ada Path: supernews.google.com!sn-xit-03!supernews.com!news-out.visi.com!hermes.visi.com!newspump.sol.net!nntp.msen.com!uunet!ash.uu.net!world!bobduff From: Robert A Duff Subject: Re: newbie can't get exceptions to work! Sender: bobduff@world.std.com (Robert A Duff) Message-ID: Date: Fri, 6 Apr 2001 22:20:38 GMT References: <25%y6.2364$jz.201607@www.newsranger.com> <3ACDB29E.45B91316@earthlink.net> Organization: The World Public Access UNIX, Brookline, MA X-Newsreader: Gnus v5.3/Emacs 19.34 Xref: supernews.google.com comp.lang.ada:6597 Date: 2001-04-06T22:20:38+00:00 List-Id: Brian Rogoff writes: > On Fri, 6 Apr 2001, Robert A Duff wrote: > > "Marc A. Criley" writes: > > > I was very pleased with the addition of "use type" to Ada 95, despite > > > the opinion of a some that it's an ugly addition that was included > > > merely to avoid having to write "renames" clauses for operators. > > Hmmm. I think it's ugly because it was included merely to avoid having to > write use clauses. If you're a no-use fanatic, you should be content with > not using use clauses, but no, use-phobes thinks it's OK as long as the > infix syntax is used. So the language is butchered to handle this special > case. It has nothing to do with "writing". It has to do with reading. I'm neither use-phobe nor use-phile. I think it depends on the package, whether you should say "use" of it. I take it you're a use-phile, and don't really care if the use-phobes have to write unreadable code. If so, then I suppose you think "use" should be banished, and everything should be use-visible by default? > > Not only do the renames clutter -- they are also quite error prone. > > > > Use type is better than nothing, > > Nah, no change would have been fine. The syntax is nicely messed up now. > Once "with type" is part of the standard the mess will get messier, as > we'll have with and use, with type and use type. > > > but even that adds one line of clutter. > > IMHO, you should be able to refer to operators *anywhere*, without > > having to say anything special. > > Why, what's so special about operators? Operators are used when the programmer thinks the concise notation of operator syntax makes the code more readable than identifier-named functions. Eg, we think that: A + B*C is more readable than: Add(A, Multiply(B, C)) If that's true, it makes no sense at all to ever say: "+"(A, "*"(B, C)) or: Some_Package."+"(A, Some_Package."*"(B, C)) Given that the whole point of operators is to use a concise symbol instead of an English word, I think one should always use operator notation for calls to operator functions. If you always "use" everything, then you can do that. But I think it makes sense not to 'use' a particular package, so you have to say Some_Package.Some_Function, but still want to write calls to operators using operator notation (infix, etc). >... Well, OK, Ada makes them a bit > special by not allowing you to define new ones (an annoying restriction > IMO) but they are just functions, right? I agree that it's an annoying restriction. The reason, I guess, is that if you allowed someone to define an operator "$" or "&^%$$##", you would have to worry about the syntax. What is the precedence of these operators? I think Cecil has a nice solution to the problem. > > You don't have to say "use" in order to > > write "X := Y"; > > ":=" is special. It's not a function, and you can't redefine it, except > for very special types. Yes, I know you know all this :-). Yes, I know it, and I know you know it, and I know you know I know it. ;-) I can still gripe about it. It's not just ":=", but also notations like "in", "and then", and "A(I)" (I would prefer "A[I]", by the way) and literal notation. These are all "special" in that you don't need to say "use" to use these notations (and also in that you can't redefine them; sigh). They look like operators to me, but Ada says otherwise. > > why should you have to write "use" in order to write > > "if X = Y ..."? > > "=" is also kind of special, right? Unfortunately true. > Are you proposing that assignment and equality are both special enough > that no use is necessary, or are you saying all operators should be exempt > from being use (type)-ed? I meant that all operators should be exempt. I wasn't speaking particularly about ":=" and "=" (and I realize that Ada defines "=" to be an operator, but not ":=" or "in", etc). - Bob