Re: Concurrency and custom types.

2013-03-25 Thread Jim foo.bar
On 25/03/13 12:55, Michael Klishin wrote: Take a look at https://blogs.oracle.com/jrose/entry/value_types_in_the_vm, it indicates that there is interest in "true value types" on the JVM but at best they will make it in JDK 9 in 2015. thanks for thisvery interesting stuff indeed... :) Jim

Re: Concurrency and custom types.

2013-03-25 Thread Shantanu Kumar
On Monday, 25 March 2013 18:23:25 UTC+5:30, Jim foo.bar wrote: > > On 25/03/13 12:50, Shantanu Kumar wrote: > > However, I'd consider they are just implementation details and intended > for idiomatic use from within the Clojure language. > > > I think you meant "*not* intended for idiomatic u

Re: Concurrency and custom types.

2013-03-25 Thread Michael Klishin
2013/3/25 Jim foo.bar > I only asked because you said there is no 100% immutability on the JVM I see. I was referring to the fact that JDK collections and maps are mutable, (at least some comonly used) .NET collections are mutable and JavaScript arrays and objects are mutable. Take a look at

Re: Concurrency and custom types.

2013-03-25 Thread Jim foo.bar
On 25/03/13 12:50, Shantanu Kumar wrote: However, I'd consider they are just implementation details and intended for idiomatic use from within the Clojure language. I think you meant "*not* intended for idiomatic use from within the Clojure language." Jim -- -- You received this message bec

Re: Concurrency and custom types.

2013-03-25 Thread Jim foo.bar
On 25/03/13 12:45, Michael Klishin wrote: Not sure how strings and numerical types fit into this discussion about collection mutability. I only asked because you said there is no 100% immutability on the JVM. I also found this blog-post where Doug Lea joined in for a discussion... http://w

Re: Concurrency and custom types.

2013-03-25 Thread Shantanu Kumar
On Monday, 25 March 2013 18:07:33 UTC+5:30, Jim foo.bar wrote: > > On 25/03/13 12:28, Michael Klishin wrote: > > There is no absolute immutability on the JVM, .NET, in JavaScript. > > There is always a backdoor to mutability. > > But 99.9% of projects won't use it. > > Andy hinted this last n

Re: Concurrency and custom types.

2013-03-25 Thread Michael Klishin
2013/3/25 Jim foo.bar > if I declare a Integer/String object as private & final within a class, is > there a way to mutate it? Strings are immutable but they are backed by arrays. You can create a native extension that will mess with that array. Does this count as "true immutability" to you? It

Re: Concurrency and custom types.

2013-03-25 Thread Dave Sann
how could it not be true? it's in data represented in memory. On Monday, 25 March 2013 23:37:33 UTC+11, Jim foo.bar wrote: > > On 25/03/13 12:28, Michael Klishin wrote: > > There is no absolute immutability on the JVM, .NET, in JavaScript. > > There is always a backdoor to mutability. > > Bu

Re: Concurrency and custom types.

2013-03-25 Thread Jim foo.bar
On 25/03/13 12:28, Michael Klishin wrote: There is no absolute immutability on the JVM, .NET, in JavaScript. There is always a backdoor to mutability. But 99.9% of projects won't use it. Andy hinted this last night as well...is this true? if I declare a Integer/String object as private & fina

Re: Concurrency and custom types.

2013-03-25 Thread Michael Klishin
2013/3/25 Jim foo.bar > I've never seen that in Clojure code but is 'how responsible a programmer > is' what really matters? In other words, are clojure's collection > persistent by covention (up to the programmer)? I'd argue that when you > call a collection 'persistent' what matters is 'persis

Re: Concurrency and custom types.

2013-03-25 Thread Jim foo.bar
On 25/03/13 12:08, Michael Klishin wrote: How often do you see implementation details such as PersistentVector#tail used in Clojure code? That is what matters. I've never seen that in Clojure code but is 'how responsible a programmer is' what really matters? In other words, are clojure's co

Re: Concurrency and custom types.

2013-03-25 Thread Michael Klishin
2013/3/25 Jim foo.bar > Moreover, consider the following scenario: > > -someone has heard about clojure's collections and wants to use them from > Java. > -he opens up his favourite IDE, imports Clojure and starts using a > persistent vector-let's call it 'v'. > -he types 'v.' and the IDE autocom

Re: Concurrency and custom types.

2013-03-25 Thread Michael Klishin
2013/3/25 Jim foo.bar > OMG! I read your message very quickly late last night and honestly I > thought you were pulling my leg...I just tried this at a repl though, and > you're indeed right...Am I the only one who finds this slightly disturbing? > For almost 4 years, I've been hearing of how bea

Re: Concurrency and custom types.

2013-03-25 Thread Jim foo.bar
On 24/03/13 22:59, Andy Fingerhut wrote: It might not be obvious at first, but Clojure's "immutable" types are *not* immutable in the sense of "they cannot be modified in place from within the JVM", but only in the sense of "they cannot be modified in place by using Clojure's functions alone on

Re: Concurrency and custom types.

2013-03-24 Thread Cedric Greevey
On Sun, Mar 24, 2013 at 6:59 PM, Andy Fingerhut wrote: > > > On Sun, Mar 24, 2013 at 11:04 AM, Jim - FooBar(); wrote: > >> On 24/03/13 17:49, Shantanu Kumar wrote: >> >>> In this case, making the type immutable is probably encouraged but not >>> mandatory >>> >> >> yes true, it's not enforced or a

Re: Concurrency and custom types.

2013-03-24 Thread Andy Fingerhut
On Sun, Mar 24, 2013 at 11:04 AM, Jim - FooBar(); wrote: > On 24/03/13 17:49, Shantanu Kumar wrote: > >> In this case, making the type immutable is probably encouraged but not >> mandatory >> > > yes true, it's not enforced or anything like that, but I'd say it is more > than just 'encouraged'...

Re: Concurrency and custom types.

2013-03-24 Thread Richard Elliott
thanks guys. On Sunday, 24 March 2013 19:27:59 UTC, Shantanu Kumar wrote: > > > > On Sunday, 24 March 2013 23:34:38 UTC+5:30, Jim foo.bar wrote: >> >> On 24/03/13 17:49, Shantanu Kumar wrote: >> > In this case, making the type immutable is probably encouraged but not >> > mandatory >> >> yes tr

Re: Concurrency and custom types.

2013-03-24 Thread Shantanu Kumar
On Sunday, 24 March 2013 23:34:38 UTC+5:30, Jim foo.bar wrote: > > On 24/03/13 17:49, Shantanu Kumar wrote: > > In this case, making the type immutable is probably encouraged but not > > mandatory > > yes true, it's not enforced or anything like that, but I'd say it is > more than just 'encou

Re: Concurrency and custom types.

2013-03-24 Thread Jim - FooBar();
On 24/03/13 17:49, Shantanu Kumar wrote: In this case, making the type immutable is probably encouraged but not mandatory yes true, it's not enforced or anything like that, but I'd say it is more than just 'encouraged'... what would be the point of using clojure's reference types with somethi

Re: Concurrency and custom types.

2013-03-24 Thread Shantanu Kumar
On Sunday, 24 March 2013 22:04:46 UTC+5:30, Richard Elliott wrote: > > Hi, > > If i create an immutable type in java and use an instance of it from > clojure, can I wrap it in an atom and benefit from the concurrency > semantics of swap! etc. > In this case, making the type immutable is probab

Re: Concurrency and custom types.

2013-03-24 Thread Jim - FooBar();
of course you can... however be careful of what you mean immutable in Java. Declaring fields as final doesn't make them immutable unless they point to something immutable (a value). if they do, make sure you override .equals() appropriately and you're good to go... :) Jim On 24/03/13 16:34

Concurrency and custom types.

2013-03-24 Thread Richard Elliott
Hi, If i create an immutable type in java and use an instance of it from clojure, can I wrap it in an atom and benefit from the concurrency semantics of swap! etc. Cheers Richard -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this