Re: [The Java Posse] Re: New compiler-plugin available for the Scala wags

2009-12-02 Thread Kevin Wright
Part II now available: http://www.artima.com/weblogs/viewpost.jsp?thread=275588 It explains a bit more about what's possible On Thu, Nov 26, 2009 at 5:35 PM, Graham Allan wrote: > > The current policy is that the first declaration wins.

Re: [The Java Posse] Re: New compiler-plugin available for the Scala wags

2009-11-26 Thread Graham Allan
> The current policy is that the first declaration wins. > So the final structure of B will contain: > All methods from B plus > All methods from A not matching any existing signature from B > All methods from C not matching any existing signature from A or B > > > This is actually by design, as B

Re: [The Java Posse] Re: New compiler-plugin available for the Scala wags

2009-11-26 Thread Kevin Wright
On Thu, Nov 26, 2009 at 5:06 PM, Graham Allan wrote: > I know you asked for feedback through Artima, but I don't have an account > and > I wanted to share something. > > I enjoyed the article, however I think there's information missing that is > likely to be useful. I've discussed with a few peop

Re: [The Java Posse] Re: New compiler-plugin available for the Scala wags

2009-11-26 Thread Graham Allan
I know you asked for feedback through Artima, but I don't have an account and I wanted to share something. I enjoyed the article, however I think there's information missing that is likely to be useful. I've discussed with a few people the concept of functionality like this for Java, and inevi

Re: [The Java Posse] Re: New compiler-plugin available for the Scala wags

2009-11-26 Thread Kevin Wright
New article on the plugin here: http://www.artima.com/weblogs/viewpost.jsp?thread=275135 On Thu, Nov 26, 2009 at 12:11 PM, Kevin Wright < kev.lee.wri...@googlemail.com> wrote: > correction: > val Foo = new Foo with Bar > > should read >

Re: [The Java Posse] Re: New compiler-plugin available for the Scala wags

2009-11-26 Thread Kevin Wright
correction: val Foo = new Foo with Bar should read val foo = new Foo with Bar On Thu, Nov 26, 2009 at 12:10 PM, Kevin Wright < kev.lee.wri...@googlemail.com> wrote: > Of course, if you want to simply create an object and then forward to it, > you're better off with standard mixins > > inste

Re: [The Java Posse] Re: New compiler-plugin available for the Scala wags

2009-11-26 Thread Kevin Wright
Of course, if you want to simply create an object and then forward to it, you're better off with standard mixins instead of: class Foo { @proxy val bar = new Bar } val foo = new Foo I would use: val Foo = new Foo with Bar This requires that Bar is a trait, but that's also the rec

Re: [The Java Posse] Re: New compiler-plugin available for the Scala wags

2009-11-26 Thread Graham Allan
Having had a look at JCIP I think this is one of the cases where it is possible to break the rule and still be safe, but as you say the potential for hard-to-trace errors means you'd probably want to avoid it. Thanks Patrick. ~ Graham > It would be best to read Java Concurrency in Practice for

[The Java Posse] Re: New compiler-plugin available for the Scala wags

2009-11-24 Thread Kevin Wright
On Nov 24, 10:40 am, Patrick Wright wrote: > Hi Kevin > > Thanks for your reply. > > 1) I think the plugin should enforce, at least with a runtime check/ > assertion, that the value for a delegate field is non-null. I would > rather receive that exception than an NPE inside a synthetic method. >

[The Java Posse] Re: New compiler-plugin available for the Scala wags

2009-11-24 Thread Patrick Wright
Hi Kevin Thanks for your reply. 1) I think the plugin should enforce, at least with a runtime check/ assertion, that the value for a delegate field is non-null. I would rather receive that exception than an NPE inside a synthetic method. The lazy val trick sounds like a decent approach to publish

[The Java Posse] Re: New compiler-plugin available for the Scala wags

2009-11-24 Thread Kevin Wright
On Nov 24, 10:16 am, Kevin Wright wrote: > I'll try and answer all the points in one mail :) > > The source is here:http://github.com/scala-incubator/autoproxy-plugin > And the wiki here:http://wiki.github.com/scala-incubator/autoproxy-plugin > The tabs at the top of the page should help you...

Re: [The Java Posse] Re: New compiler-plugin available for the Scala wags

2009-11-24 Thread Roel Spilker
Project Lombok will not use reflection. It is a compiler plugin and will just generate the code to delegate the call to a field. Roel On Tue, Nov 24, 2009 at 9:46 AM, Patrick Wright wrote: > In Java, this would be like > implementing Comparable then delegating the comparison to a helper > class

[The Java Posse] Re: New compiler-plugin available for the Scala wags

2009-11-24 Thread Kevin Wright
I'll try and answer all the points in one mail :) The source is here: http://github.com/scala-incubator/autoproxy-plugin And the wiki here: http://wiki.github.com/scala-incubator/autoproxy-plugin The tabs at the top of the page should help you... I did also consider @forward in addition to @with

[The Java Posse] Re: New compiler-plugin available for the Scala wags

2009-11-24 Thread Patrick Wright
> Is it such a black-and-white scenario? I would have thought there were a few > caveats with which publishing 'this' in the constructor is safe. So within > either object's constructor the following should hold: > > - foo = new Foo(this) is called last, after the state of the object has been > set

Re: [The Java Posse] Re: New compiler-plugin available for the Scala wags

2009-11-24 Thread Graham Allan
> I believe you can't safely publish the "this" (e.g. Bar) from inside > its constructor, meaning you can't do (in Bar's constructor) foo = new > Foo(this); this ends up (in my mind) reducing the usability of the > technique. See JCIP, chapter 3, "Sharing Objects", "Safe Construction > Practices"

[The Java Posse] Re: New compiler-plugin available for the Scala wags

2009-11-24 Thread Patrick Wright
Glad to see someone is working on this. In a Java implementation, I would expect that Bar, which delegates to Foo, would have implemented Foo, so that the clients of Bar would know what methods were available on it, e.g. what contract it fulfilled. In Java, this would be like implementing Comparabl

[The Java Posse] Re: New compiler-plugin available for the Scala wags

2009-11-24 Thread hlovatt
Kevin, Can't see any source at the URL you give. -- Howard. On Nov 23, 11:39 am, Kevin Wright wrote: > The autoproxy compiler-plugin for scala is now available to view on > github:http://wiki.github.com/scala-incubator/autoproxy-plugin > > My goal is to take some of the boilerplate pain out of

[The Java Posse] Re: New compiler-plugin available for the Scala wags

2009-11-24 Thread hlovatt
Kevin, I tried to look at your wave but don't have a wave account, it says you need an invite. Any chance of inviting howard.lov...@gmail.com. Thanks in advance, -- Howard. On Nov 23, 10:59 pm, Kevin Wright wrote: > Funnily enough, that question has also been raised on the wave I > started fo

[The Java Posse] Re: New compiler-plugin available for the Scala wags

2009-11-23 Thread Kevin Wright
Funnily enough, that question has also been raised on the wave I started for the project; it's public, see here: https://wave.google.com/wave/?pli=1#restored:wave:googlewave.com!w%252Ba3G_NBOLC I guess that this is slightly a scala thing, I went for a verb instead of a noun as this feels more nat

[The Java Posse] Re: New compiler-plugin available for the Scala wags

2009-11-23 Thread Reinier Zwitserloot
Interesting that you called it proxy. We have a similar plan for lombok (used to be at the top of the list, but interesting co- operation with Michael Ernst and the Checker Framework, as well as the closures announcement, has pretty much made the lombok agenda null and void. We're still sorting thr