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,25aa3c7e1b59f7b5 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-01-10 13:46:23 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.mathworks.com!newstransit.mitre.org!world!news From: Robert A Duff Subject: Re: A case where Ada defaults to unsafe? Sender: news@world.std.com (Mr Usenet Himself) Message-ID: Date: Thu, 10 Jan 2002 21:29:05 GMT References: <3C34BF2C.6030500@mail.com> <3C34D252.4070307@mail.com> NNTP-Posting-Host: shell01.theworld.com Organization: The World Public Access UNIX, Brookline, MA X-Newsreader: Gnus v5.7/Emacs 20.7 Xref: archiver1.google.com comp.lang.ada:18744 Date: 2002-01-10T21:29:05+00:00 List-Id: Brian Rogoff writes: > On Fri, 4 Jan 2002, Robert A Duff wrote: > > If you're looking for cases where Ada makes the default less safe, I can > > think of a few. Here's one: "X: T := ...;" is a variable, whereas > > "X: constant T := ...;" is a constant. IMHO, it should be the other way > > around ("X: var T := ...;" for a variable), since constants are safer > > than variables. > > I know I'm digressing a bit, but I'd prefer that ":=" not be used for > declaring the value of a constant, since I think of that as being > different from assignment. It seems to me that initializing an object is conceptually different from an assignment statement, and therefore deserves a different notation. But I would use the same notation for initializing both constants and variables. I'm not sure I like "=", because we already use that for equality tests. How about ":=" for init, and ":==" for assignment statements? (Imagine you're designing a language from scratch, here.) >... Better to use "=" IMO. Of course I am now > spoiled by functional (quasifunctional :) languages like ML where > assignment is far less frequent than in Ada or C++. Assignment and > equality hide a lot of complexity behind a simple facade; that seems to > have been recognized by the Ada designers. A related issue is limited types: you ought to be able to return a nonlocal object from a function, you ought to be able to use aggregates, and you ought to be able to do initialization. It's really the "fetch value out of object" operation that should be considered naughty for limited types. Not the assignment operation. - Bob