[scala-tools] Plugins

View: New views
9 Messages — Rating Filter:   Alert me  

[scala-tools] Plugins

by bearfeeder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Folks,

I tried to run the plugin tutorial at http://www.scala-lang.org/node/140 on Scala 2.7.4 and 2.7.5 and got compilation errors.

Is this code 2.8.0?  If so, should I be running 2.8 against the nightlies or against some known stable snapshot?

Thanks,

David

--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

Re: [scala-tools] Plugins

by Anders Bach Nielsen-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi David

The code in the examples should work for 2.7.x and the code needed for
2.8 (trunk) is shown in comments in the examples.

What is the error ?

/Anders

David Pollak wrote:

> Folks,
>
> I tried to run the plugin tutorial at http://www.scala-lang.org/node/140 on
> Scala 2.7.4 and 2.7.5 and got compilation errors.
>
> Is this code 2.8.0?  If so, should I be running 2.8 against the nightlies or
> against some known stable snapshot?
>
> Thanks,
>
> David
>
> --
> Lift, the simply functional web framework http://liftweb.net
> Beginning Scala http://www.apress.com/book/view/1430219890
> Follow me: http://twitter.com/dpp
> Git some: http://github.com/dpp

--
Anders Bach Nielsen            |   http://www.cs.au.dk/~abachn/
University of Aarhus           |   abachn@...
-
  The reward of a thing well done is to have done it. -- Emerson

Re: [scala-tools] Plugins

by bearfeeder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On Mon, Jun 8, 2009 at 12:46 PM, Anders Bach Nielsen <andersbach.nielsen@...> wrote:
Hi David

The code in the examples should work for 2.7.x and the code needed for
2.8 (trunk) is shown in comments in the examples.

What is the error ?

I copied and pasted the code from http://www.scala-lang.org/node/140

When I compiled:

dpp@yak:~$ scalac Foo.scala
Foo.scala:24: error: not found: type StdPhase
  private class DivByZeroPhase(prev: Phase) extends StdPhase(prev) {
                                                    ^
Foo.scala:21: error: type mismatch;
 found   : DivByZero.this.DivByZeroPhase
 required: scala.tools.nsc.Phase
    def newPhase(prev: Phase) = new DivByZeroPhase(prev)    
                                ^
two errors found
dpp@yak:~$ 

Thanks,

David
 


/Anders

David Pollak wrote:
> Folks,
>
> I tried to run the plugin tutorial at http://www.scala-lang.org/node/140 on
> Scala 2.7.4 and 2.7.5 and got compilation errors.
>
> Is this code 2.8.0?  If so, should I be running 2.8 against the nightlies or
> against some known stable snapshot?
>
> Thanks,
>
> David
>
> --
> Lift, the simply functional web framework http://liftweb.net
> Beginning Scala http://www.apress.com/book/view/1430219890
> Follow me: http://twitter.com/dpp
> Git some: http://github.com/dpp

--
Anders Bach Nielsen            |   http://www.cs.au.dk/~abachn/
University of Aarhus           |   abachn@...
-
 The reward of a thing well done is to have done it. -- Emerson



--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

Re: [scala-tools] Plugins

by Josh Suereth :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I remember running into an issue where StdPhase was not visible from the package I was using.  I simple extended Phase (has the same constructor as StdPhase), and kept moving along.

If you want an example of creating/testing a scalac plugin (using maven), check out: http://github.com/jsuereth/osgi-scalac-plugin/tree/master

I hope to finalize that project if/when I start using OSGi in production again.

-Josh

On Mon, Jun 8, 2009 at 7:06 PM, David Pollak <feeder.of.the.bears@...> wrote:


On Mon, Jun 8, 2009 at 12:46 PM, Anders Bach Nielsen <andersbach.nielsen@...> wrote:
Hi David

The code in the examples should work for 2.7.x and the code needed for
2.8 (trunk) is shown in comments in the examples.

What is the error ?

I copied and pasted the code from http://www.scala-lang.org/node/140

When I compiled:

dpp@yak:~$ scalac Foo.scala
Foo.scala:24: error: not found: type StdPhase
  private class DivByZeroPhase(prev: Phase) extends StdPhase(prev) {
                                                    ^
Foo.scala:21: error: type mismatch;
 found   : DivByZero.this.DivByZeroPhase
 required: scala.tools.nsc.Phase
    def newPhase(prev: Phase) = new DivByZeroPhase(prev)    
                                ^
two errors found
dpp@yak:~$ 

Thanks,

David
 


/Anders

David Pollak wrote:
> Folks,
>
> I tried to run the plugin tutorial at http://www.scala-lang.org/node/140 on
> Scala 2.7.4 and 2.7.5 and got compilation errors.
>
> Is this code 2.8.0?  If so, should I be running 2.8 against the nightlies or
> against some known stable snapshot?
>
> Thanks,
>
> David
>
> --
> Lift, the simply functional web framework http://liftweb.net
> Beginning Scala http://www.apress.com/book/view/1430219890
> Follow me: http://twitter.com/dpp
> Git some: http://github.com/dpp

--
Anders Bach Nielsen            |   http://www.cs.au.dk/~abachn/
University of Aarhus           |   abachn@...
-
 The reward of a thing well done is to have done it. -- Emerson



--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp


Parent Message unknown Re: [scala-tools] Plugins

by bearfeeder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

An example would be great... and how do you specify the plugin from maven?

My plugin will initially enforce json serializability, then I'll add serializers automagically and if that works, I'll emit javascript that reflects the scala defined methods (scala to javascript conversion for a subset of the scala language.)

On Jun 8, 2009 5:56 PM, "Josh Suereth" <joshua.suereth@...> wrote:

I remember running into an issue where StdPhase was not visible from the package I was using.  I simple extended Phase (has the same constructor as StdPhase), and kept moving along.

If you want an example of creating/testing a scalac plugin (using maven), check out: http://github.com/jsuereth/osgi-scalac-plugin/tree/master

I hope to finalize that project if/when I start using OSGi in production again.

-Josh

On Mon, Jun 8, 2009 at 7:06 PM, David Pollak <feeder.of.the.bears@...> wrote: > > > > On Mon...


Re: [scala-tools] Plugins

by Anders Bach Nielsen-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey David

Hmm, yes there is a change in how StdPhase is used in the compiler. I
have created a version that compiles and attached it to this email
divbyzero.tar.gz and I will go update the website to conform to the
changes in the compiler, thank you for pointing this out :)

If you want to do something larger (and it sound like you want to) then
instead of using the StdPhase use one of the Transformers. They already
extend StdPhase and give you the basics for traversing the tree and
picking up information. I wrote a little plugin some time ago to see the
base classes of all classes in a program (very simple) and it uses an
InforTransformer. See the file lincheck.tar.gz

I hope this helps

/Anders

David Pollak wrote:

> On Mon, Jun 8, 2009 at 12:46 PM, Anders Bach Nielsen <
> andersbach.nielsen@...> wrote:
>
> > Hi David
> >
> > The code in the examples should work for 2.7.x and the code needed for
> > 2.8 (trunk) is shown in comments in the examples.
> >
> > What is the error ?
>
>
> I copied and pasted the code from http://www.scala-lang.org/node/140
>
> When I compiled:
>
> dpp@yak:~$ scalac Foo.scala
> Foo.scala:24: error: not found: type StdPhase
>   private class DivByZeroPhase(prev: Phase) extends StdPhase(prev) {
>                                                     ^
> Foo.scala:21: error: type mismatch;
>  found   : DivByZero.this.DivByZeroPhase
>  required: scala.tools.nsc.Phase
>     def newPhase(prev: Phase) = new DivByZeroPhase(prev)
>                                 ^
> two errors found
> dpp@yak:~$
>
>
> Thanks,
>
> David
>
>
> >
> >
> > /Anders
> >
> > David Pollak wrote:
> > > Folks,
> > >
> > > I tried to run the plugin tutorial at http://www.scala-lang.org/node/140on
> > > Scala 2.7.4 and 2.7.5 and got compilation errors.
> > >
> > > Is this code 2.8.0?  If so, should I be running 2.8 against the nightlies
> > or
> > > against some known stable snapshot?
> > >
> > > Thanks,
> > >
> > > David
> > >
> > > --
> > > Lift, the simply functional web framework http://liftweb.net
> > > Beginning Scala http://www.apress.com/book/view/1430219890
> > > Follow me: http://twitter.com/dpp
> > > Git some: http://github.com/dpp
> >
> > --
> > Anders Bach Nielsen            |   http://www.cs.au.dk/~abachn/
> > University of Aarhus           |   abachn@...
> > -
> >  The reward of a thing well done is to have done it. -- Emerson
> >
>
>
>
> --
> Lift, the simply functional web framework http://liftweb.net
> Beginning Scala http://www.apress.com/book/view/1430219890
> Follow me: http://twitter.com/dpp
> Git some: http://github.com/dpp
--
Anders Bach Nielsen            |   http://www.cs.au.dk/~abachn/
University of Aarhus           |   abachn@...
-
  The moving cursor writes, and having written, blinks on.



lincheck.tar.gz (11K) Download Attachment
divbyzero.tar.gz (22K) Download Attachment

Re: [scala-tools] Plugins

by Anders Bach Nielsen-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey

> > > > I tried to run the plugin tutorial at http://www.scala-lang.org/node/140on
> > > > Scala 2.7.4 and 2.7.5 and got compilation errors.

And now the guide should be up-to-date again!

/Anders


--
Anders Bach Nielsen            |   http://www.cs.au.dk/~abachn/
University of Aarhus           |   abachn@...
-
  I've got a COUSIN who works in the GARMENT DISTRICT ...

Re: [scala-tools] Plugins

by Josh Suereth :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://www.scala-tools.org/mvnsites/maven-scala-plugin/usage_scalac_plugins.html

I tried to send this earlier, but apparently I'm bad with technology.


On Mon, Jun 8, 2009 at 9:42 PM, David Pollak <feeder.of.the.bears@...> wrote:

An example would be great... and how do you specify the plugin from maven?

My plugin will initially enforce json serializability, then I'll add serializers automagically and if that works, I'll emit javascript that reflects the scala defined methods (scala to javascript conversion for a subset of the scala language.)

On Jun 8, 2009 5:56 PM, "Josh Suereth" <joshua.suereth@...> wrote:

I remember running into an issue where StdPhase was not visible from the package I was using.  I simple extended Phase (has the same constructor as StdPhase), and kept moving along.

If you want an example of creating/testing a scalac plugin (using maven), check out: http://github.com/jsuereth/osgi-scalac-plugin/tree/master

I hope to finalize that project if/when I start using OSGi in production again.

-Josh

On Mon, Jun 8, 2009 at 7:06 PM, David Pollak <feeder.of.the.bears@...> wrote: > > > > On Mon...



Re: [scala-tools] Plugins

by bearfeeder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On Tue, Jun 9, 2009 at 12:12 AM, Anders Bach Nielsen <andersbach.nielsen@...> wrote:
Hey

> > > > I tried to run the plugin tutorial at http://www.scala-lang.org/node/140on
> > > > Scala 2.7.4 and 2.7.5 and got compilation errors.

And now the guide should be up-to-date again!

Thanks!
 


/Anders


--
Anders Bach Nielsen            |   http://www.cs.au.dk/~abachn/
University of Aarhus           |   abachn@...
-
 I've got a COUSIN who works in the GARMENT DISTRICT ...



--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp