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-19 15:09:42 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.cwix.com!sjc-peer.news.verio.net!news.verio.net!sjc-read.news.verio.net.POSTED!not-for-mail Newsgroups: comp.lang.ada From: Brian Rogoff Subject: Re: A case where Ada defaults to unsafe? In-Reply-To: Message-ID: References: <3C34BF2C.6030500@mail.com> <3C34D252.4070307@mail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Date: Sat, 19 Jan 2002 23:10:22 GMT NNTP-Posting-Host: 192.220.65.223 X-Complaints-To: abuse@verio.net X-Trace: sjc-read.news.verio.net 1011481822 192.220.65.223 (Sat, 19 Jan 2002 23:10:22 GMT) NNTP-Posting-Date: Sat, 19 Jan 2002 23:10:22 GMT Organization: Verio Xref: archiver1.google.com comp.lang.ada:19110 Date: 2002-01-19T23:10:22+00:00 List-Id: On Sat, 19 Jan 2002, Robert A Duff wrote: > Brian Rogoff writes: > > > I assume that you are assuming that assignment will be less frequent than > > object initialization, and so assignment gets the longer token? > > Well, if you program in a mostly-functional style, that would be true. In my pet language, OCaml, you can only assign to record fields which are declared mutable. There is also syntactic sugar for SML style refs, which are just polymorphic records with a single mutable field. Initialization of constants and vars uses "=", and there are two notations for assignment depending on whether you're assigning to a ref or the mutable field of a record. Is that kind of like what you want? Somehow, I don't think of Ada as being a mostly functional language, nor do I think of a future Ada like language as being one, though I certainly look to ML and Haskell as inspirations. > But that's not why. It just seems like the "safer" thing should usually > be shorter. Of course, forgive me ;-). > > I'm not sure I like this proposal. Do we really want to think of constant > > initialization as being like assignment? > > I think so. I want to think of constant initialization as being like > variable initialization. In fact, I want the semantics to be > identical. In other words, a constant and a variable are the same thing > -- except you can't assign into a constant. OK. Given that view, the ML approach may appeal to you (or not, as you're a contentious fellow :-). > >... It seems that we're really just > > declaring its value, and that =, or "is" as someone else suggested, is > > better. > > Yeah, "is" seems nice for constants, but it makes no sense for > variables. Surely you don't want a different notation for variable > initialization?! No, but "is" doesn't seem as bad for "variables" if the mutability is part of the type, as in OCaml. My gut feeling is that ultimately type systems like those of Clean and Mercury which have uniqueness types are the way to go, and that OCaml style mutable declarations, and Ada's limited and controlled types, and Haskell's monadic state machinery, are all just a bit hacky or unsafe. I don't know if that kind of thing makes sense for a low level language like Ada though. Any language which provides control over underlying representations, like Ada, will never be really safe. -- Brian