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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,15d5eb6390443ef2 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!z1g2000yqn.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Immutable and Transient Objects and GC? Date: Wed, 18 Mar 2009 14:32:55 -0700 (PDT) Organization: http://groups.google.com Message-ID: <0fb0ee0b-b5af-45af-b93c-fc6e931930fd@z1g2000yqn.googlegroups.com> References: NNTP-Posting-Host: 83.78.1.25 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1237411975 28192 127.0.0.1 (18 Mar 2009 21:32:55 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 18 Mar 2009 21:32:55 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: z1g2000yqn.googlegroups.com; posting-host=83.78.1.25; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.6) Gecko/2009011912 Firefox/3.0.6,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:4176 Date: 2009-03-18T14:32:55-07:00 List-Id: On 18 Mar, 21:07, Dimonax wrote: > An Immutable Object, conceptually, is pretty clear. Even though there is a bit of hype around immutable objects recently, related to the hopes that this automagically solves concurrency problems (which ones, really?), I do not think that it can become a mainstream approach in languages like Ada. The problem is that Ada is really a value-oriented language (and not a reference-oriented one) and there are lots of fundamental language constructs that promote or even require mutability: 'out' and 'in out' parameter modes are just examples. Also, there is a strong culture of avoiding, or at least not overusing, dynamic memory allocation and this requires mutable state for recycling objects. In other words, mutability is part of the language spirit. In addition and just IMHO, immutability cannot be a solution for anything, because it distorts what should be a natural design of a given program. What I mean by natural is that (im)mutability of any given object should come out from the main problem analysis and not from elsewhere - trying to solve whatever concurrency issues you have is that "elsewhere" because it has nothing to do with what the given object represents. In other words, if the given object *happens* to be immutable as a result of the problem analysis and this fact can help with concurrency, then it is a worthy coincidence; but when immutability of objects is *imposed* in order to solve some unrelated concurrency (or other) issues, then it is just a design distortion. -- Maciej Sobczak * www.msobczak.com * www.inspirel.com Database Access Library for Ada: www.inspirel.com/soci-ada