Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.glorb.com!postnews.google.com!v11g2000prn.googlegroups.com!not-for-mail From: Joshua Maurice Newsgroups: comp.lang.java.programmer Subject: Re: Why "lock" functionality is introduced for all the objects? Date: Fri, 1 Jul 2011 18:28:20 -0700 (PDT) Organization: http://groups.google.com Lines: 31 Message-ID: References: NNTP-Posting-Host: 76.225.157.56 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1309570100 10689 127.0.0.1 (2 Jul 2011 01:28:20 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 2 Jul 2011 01:28:20 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: v11g2000prn.googlegroups.com; posting-host=76.225.157.56; posting-account=C7XBLgoAAAAxMpmeFo8Iv_pud1pyFhjy User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: HUALESNKRC X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0,gzip(gfe) Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:5816 On Jun 28, 10:12=A0pm, supercalifragilisticexpialadiamaticonormalizeringelimatisticantations wrote: > On 28/06/2011 4:43 PM, BGB wrote: > > > yeah... > > > they made every object lockable but not every object cloneable, where > > one would think cloning would be generally a higher priority. > > If they'd been smarter about managing mutability to begin with (e.g. > fields immutable by default, objects normally immutable) cloning would > not be a priority at all. > > Sure, the boxed primitives and Strings are immutable, and that's about > it. We've got mutable stuff out the wazoo, most of which probably > shouldn't be -- java.util.Date, anyone? Not to mention java.awt.Point > and friends. All those conundrums about whether Square should be a > subclass of Rectangle, or Circle of Ellipse, go away if they aren't > mutable. Then they clearly are subclasses. Mutable collections and > arrays also make type reasoning more complicated and don't allow casting > a List to a List as then you might add a non-Sub Super to > the list. If the list wasn't mutable there'd be no problem casting a > List to a List. > > I could go on...but I won't. If you want a functional language, go use a functional language and stop complaining that Java is not a functional language.