Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news.albasani.net!.POSTED!not-for-mail From: BGB Newsgroups: comp.lang.java.programmer Subject: Re: Why "lock" functionality is introduced for all the objects? Date: Mon, 04 Jul 2011 09:39:38 -0700 Organization: albasani.net Lines: 34 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net nrwKubHXV2oxRMuQhWM9/31voD/cy6cKQUN3yRnXc8S3vJqpsfl+jqOIaoE+OoKMMnMuJTHY2nD2YeX6NDqt5A== NNTP-Posting-Date: Mon, 4 Jul 2011 16:43:47 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="V3NgikefdFbPqgWlP1RQfO74a/TcceaoThspOLLVm0V934iIVKHkzvZEDXuSfGIPVhbKzjcAQu1PaZFuTP6L3jFPgOGH1E3/pbTt48N2MU+cBUiJKytlQOVwvb1KzB/I"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11 In-Reply-To: Cancel-Lock: sha1:dYVILkmrxHRg3bst3oDnhorCx54= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:5854 On 7/1/2011 7:05 PM, Joshua Cranmer wrote: > On 6/28/2011 10:12 PM, > supercalifragilisticexpialadiamaticonormalizeringelimatisticantations > wrote: >> If the list wasn't mutable there'd be no problem casting a >> List to a List. > > And then I'd complain because my program would be spending more time > copying the values between immutable queues than actually doing work. As > long as the language has the potential for mutable collections (which > most people want for performance reasons), you have the potential for > generics casting issues. > well, and probably putting more pressure on the garbage collector. a great downside of using an FP-like style with a GC and a language/VM that generally lacks the concept of user-defined value-types is that it increases the amount of garbage produced (thus increasing the number of GC cycles). a language with 'struct' need not have this issue, as then they can use it for implementing such value types. but, I have seen cases where people have abused struct (mostly in C#), generally using references-to-struct for things which would probably have been better done with a heap-allocated class instance. in my own personal language, it may be possible to create structs using a constructor and using 'final' on fields to create an immutable struct. or such...