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-Thread: 103376,5af5c381381ac5a7 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Path: g2news2.google.com!news3.google.com!feeder.news-service.com!feeder2.cambriumusenet.nl!feed.tweaknews.nl!85.158.31.10.MISMATCH!newsfeed-0.progon.net!progon.net!news.tele.dk!feed118.news.tele.dk!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Newsgroups: comp.lang.ada Subject: Re: Ada requires too much typing! References: Date: Sun, 06 Jun 2010 10:06:29 +0200 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Martin Krischik" Organization: Martin Krischik, Softwareentwicklung Message-ID: User-Agent: Opera Mail/10.53 (MacIntel) NNTP-Posting-Host: 89.236.175.138 X-Trace: news.sunsite.dk DXC=gmGmnEP>4Ta`;IS0i7S8TaYSB=nbEKnkkLk>VcI2_6ZmIDiY_4:UK?cd3Nai^>E:QM5d2e^5VLiC>9fcVePVNgPFBn X-Complaints-To: staff@sunsite.dk Xref: g2news2.google.com comp.lang.ada:12312 Date: 2010-06-06T10:06:29+02:00 List-Id: Am 28.05.2010, 07:25 Uhr, schrieb Luis Espinal : > I don't think that is much of an issue. Mutability is. This is a big > issue for > Java as it has turned out. The commonly accepted best practice now is to > mark > variables and parameters as final unless you know before hand that you > want to > change them. Which only makes the reference to the variable un-mutable, not the content. That combined with language which can do only pass by reference for all complex types and a Clonable interface which was badly sorted out gives you a language where the protection a getter function should give you is just not there - unless you make it a habit to use «return x.clone ()» [1]. And if we are at it - setter functions should use «this.x = x.clone ()». Those who did Ada or C++ know that. In Ada setter and getter functions usually take a copy and in C++ setter and getter functions take a reference to a constant object. That is: not the reference is constant - the object itself is constant (un-mutable). As it is most setter and getter functions in Java are placebos - they give you you the feeling to do it the proper OO way but you are don't! Martin [1] provided the class at hand implements the Clonable interface property and does indeed do full deep copy. -- Martin Krischik mailto://krischik@users.sourceforge.net https://sourceforge.net/users/krischik