Re: multiple return values

2011-12-24 Thread Razvan Rotaru
On Dec 23, 5:08 am, Alan Malloy wrote: > > It turns out even this is not true, becauseproxyuses some kind of > deep JVM magic called (appropriately)ProxyClasses. So every time you > write (proxy[Object] (...anything at all...)), you get an instance of > the same class, initialized with a differe

Re: multiple return values

2011-12-22 Thread Alan Malloy
On Dec 22, 5:48 pm, Brian Goslinga wrote: > On Dec 22, 8:52 am, Razvan Rotaru wrote:> What do > you mean by site? > > For example, how is it when I'm creating my proxy inside a macro? (and > > assuming this macro is called many times) > > > (defmacro [a-class] > >     (proxy (a-class) )) > >

Re: multiple return values

2011-12-22 Thread Brian Goslinga
On Dec 22, 8:52 am, Razvan Rotaru wrote: > What do you mean by site? > For example, how is it when I'm creating my proxy inside a macro? (and > assuming this macro is called many times) > > (defmacro [a-class] >     (proxy (a-class) )) > > Razvan Once all code is macroexpanded, every use of pr

Re: multiple return values

2011-12-22 Thread Razvan Rotaru
On Dec 14, 5:33 pm, Tom Faulhaber wrote: > Razvan, > > I believe that proxy actually only creates a new class per call site, > not per instance. However, I can't completely swear to this. > > Anyone with more detailed knowledge than I have want to comment? > > Assuming I'm right,, you should be fi

Re: multiple return values

2011-12-15 Thread Razvan Rotaru
Thanks. On Dec 14, 8:30 pm, Alan Malloy wrote: > Correct, just like closures and reifies. > > On Dec 14, 7:33 am, Tom Faulhaber wrote: > > > > > > > > > Razvan, > > > I believe that proxy actually only creates a new class per call site, > > not per instance. However, I can't completely swear to

Re: multiple return values

2011-12-14 Thread Alan Malloy
Correct, just like closures and reifies. On Dec 14, 7:33 am, Tom Faulhaber wrote: > Razvan, > > I believe that proxy actually only creates a new class per call site, > not per instance. However, I can't completely swear to this. > > Anyone with more detailed knowledge than I have want to comment?

Re: multiple return values

2011-12-14 Thread Tom Faulhaber
Razvan, I believe that proxy actually only creates a new class per call site, not per instance. However, I can't completely swear to this. Anyone with more detailed knowledge than I have want to comment? Assuming I'm right,, you should be fine to have lots of instances. HTH, Tom On Dec 13, 10

Re: multiple return values

2011-12-13 Thread Stephen Compall
On Tue, 2011-12-13 at 10:52 -0800, Razvan Rotaru wrote: > Thanks. I don't know how this hashmap works, but at the first glance > there seems to be one problem: the two values don't get garbage > collected at the same time. There are problems with weak hashmaps, but I wouldn't count that among them

Re: multiple return values

2011-12-13 Thread Razvan Rotaru
Thanks. I don't know how this hashmap works, but at the first glance there seems to be one problem: the two values don't get garbage collected at the same time. I'll look more into it, thanks. On Dec 13, 3:10 am, Stephen Compall wrote: > On Mon, 2011-12-12 at 10:54 -0800, Razvan Rotaru wrote: > >

Re: multiple return values

2011-12-13 Thread Razvan Rotaru
I don't want to change the interface i'm exposing to the outer world. May be that I'm thinking too javaish, but what I miss here is a possibility to extend the base class. :) On Dec 12, 9:31 pm, James Reeves wrote: > On 12 December 2011 18:54, Razvan Rotaru wrote: > > > - function returns a valu

Re: multiple return values

2011-12-13 Thread Razvan Rotaru
Thanks Tom. Using proxy like this could work. But i'm worried about one thing.What happens if I have many instances? With proxy there's a new class with each instance. Could I run out of permgen space? On Dec 13, 9:38 am, Tom Faulhaber wrote: > Razvan, > > I think that you can implement your idea

Re: multiple return values

2011-12-12 Thread Tom Faulhaber
Razvan, I think that you can implement your idea of "extending the class with proxy" in the following way (originally suggested to me by Rich Hickey & Chris Houser for use with the pretty printer): (let [extra-fields (ref {:field1 extra-value1, :field2 extra-value2}] (proxy [Writer IDeref]

Re: multiple return values

2011-12-12 Thread Stephen Compall
On Mon, 2011-12-12 at 10:54 -0800, Razvan Rotaru wrote: > - function returns a value which is a java instance (not possible to > change here, or at least not from what I see - it needs to be a java > instance) > - i need to be able to call some function which gets some values that > are not part of

Re: multiple return values

2011-12-12 Thread Alex Baranosky
Intuitively it sounds like you are making something much more complicated than it needs to be. I'd say to return from your computation a vector with the two values, or possibly a map with them. If you need to create some kind of Java interop object, then map the result of the computation to that

Re: multiple return values

2011-12-12 Thread Kevin Downey
On Mon, Dec 12, 2011 at 10:54 AM, Razvan Rotaru wrote: > Hi, > > I read that there's no such thing as lisp-like multiple values return > in clojure. We can use vectors, and the destructuring feature helps > also. > > However, for what I'm trying to do I need to emulate somehow the > following beha

Re: multiple return values

2011-12-12 Thread James Reeves
On 12 December 2011 18:54, Razvan Rotaru wrote: > - function returns a value which is a java instance (not possible to > change here, or at least not from what I see - it needs to be a java > instance) Why does it need to be a Java instance? - James -- You received this message because you are

Re: Multiple return values

2008-10-21 Thread Fredrik Appelberg
On Tue, Oct 21, 2008 at 7:48 AM, Jeffrey Chu <[EMAIL PROTECTED]> wrote: > > Hi, > > If you really need multiple value calls, you can always try to emulate > parts of it with some fancy macros. I've hacked up a quick proof of > concept - I haven't gotten a chance to test it too much, but it seems >

Re: Multiple return values

2008-10-20 Thread Jeffrey Chu
Hi, If you really need multiple value calls, you can always try to emulate parts of it with some fancy macros. I've hacked up a quick proof of concept - I haven't gotten a chance to test it too much, but it seems to work. http://paste.lisp.org/display/68919 - Jeff On Oct 20, 1:00 pm, "Fredrik

Re: Multiple return values

2008-10-20 Thread Fredrik Appelberg
On Mon, Oct 20, 2008 at 1:03 PM, Parth Malwankar <[EMAIL PROTECTED]>wrote: > > On Oct 20, 3:51 pm, "Fredrik Appelberg" <[EMAIL PROTECTED]> > wrote: > > Hi all, > > > > The CL feature for handling multiple return values from a function come > in > > really handy sometimes and make for cleaner APIs.

Re: Multiple return values

2008-10-20 Thread Michel Salim
On Oct 20, 7:03 am, Parth Malwankar <[EMAIL PROTECTED]> wrote: > On Oct 20, 3:51 pm, "Fredrik Appelberg" <[EMAIL PROTECTED]> > wrote: > > > Hi all, > > > The CL feature for handling multiple return values from a function come in > > really handy sometimes and make for cleaner APIs. For example,

Re: Multiple return values

2008-10-20 Thread Parth Malwankar
On Oct 20, 3:51 pm, "Fredrik Appelberg" <[EMAIL PROTECTED]> wrote: > Hi all, > > The CL feature for handling multiple return values from a function come in > really handy sometimes and make for cleaner APIs. For example, the ROUND > function returns the integer part of a float as the regular val