This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Compiler plugin to provide metadata about a property

5 replies
EECOLOR
Joined: 2012-01-18,
User offline. Last seen 34 weeks 5 days ago.
Hello,

Maybe this is not the correct place to post this, let me know if there is a better place.
I created a compiler plugin that allows you to get information about a property that is accessed. An example:
object X {
   val y:String = "z"
   test(y)
   def test(metadata:Metadata) = {       println(metadata) //Metadata(y,class java.lang.String,X$@5f9849e5)
   }
}

I am very new to Scala, so I was wondering if anyone would be willing to look through the source code of the plugin to give some pointers. Any comments are welcome as most of the code in this plugin has been created using the trial and error method (my least favorite way of working).

Thank you

Erik
extempore
Joined: 2008-12-17,
User offline. Last seen 35 weeks 3 days ago.
Re: Compiler plugin to provide metadata about a property


On Wed, Feb 15, 2012 at 1:55 PM, EECOLOR <eecolor@gmail.com> wrote:
I am very new to Scala, so I was wondering if anyone would be willing to look through the source code of the plugin to give some pointers. Any comments are welcome as most of the code in this plugin has been created using the trial and error method (my least favorite way of working).

It is one in a million that somebody will volunteer to review code if you don't even reveal how to see it. You can improve your odds by at least three orders of magnitude by posting a link to the repository, and then by another constant factor by including some specific piece of code with which you are dissatisfied in your email.
The vaguer the question, and the harder you make the questionee work to get to the matter of interest, the more certain are the crickets.  (It's not specific to scala.)
adriaanm
Joined: 2010-02-08,
User offline. Last seen 31 weeks 4 days ago.
Re: Compiler plugin to provide metadata about a property
the feature you propose reminds me a bit of scala-virtualized's SourceContext, which is like a Manifest, but instead of preserving types until run time, it preserves source information (like line numbers)it's not in master (yet), but the latest improvement to it is in commit https://github.com/adriaanm/scala/commit/69f8e42a228da36c48d7b6111a7c5201ce9c1c7d
so for lack of reviewing your code, I could suggest you make it look like that ^^
cheersadriaan
EECOLOR
Joined: 2012-01-18,
User offline. Last seen 34 weeks 5 days ago.
Re: Compiler plugin to provide metadata about a property
Oops, haha. That's pretty stupid. Here is the link: http://code.google.com/p/scala-implicit-metadata-plugin/source/browse/trunk/ImplicitMetadata/src/ee/scala/plugin/implicitMetadata/ImplicitMetadataPlugin.scala



On Thu, Feb 16, 2012 at 4:31 PM, Paul Phillips <paulp@improving.org> wrote:


On Wed, Feb 15, 2012 at 1:55 PM, EECOLOR <eecolor@gmail.com> wrote:
I am very new to Scala, so I was wondering if anyone would be willing to look through the source code of the plugin to give some pointers. Any comments are welcome as most of the code in this plugin has been created using the trial and error method (my least favorite way of working).

It is one in a million that somebody will volunteer to review code if you don't even reveal how to see it. You can improve your odds by at least three orders of magnitude by posting a link to the repository, and then by another constant factor by including some specific piece of code with which you are dissatisfied in your email.
The vaguer the question, and the harder you make the questionee work to get to the matter of interest, the more certain are the crickets.  (It's not specific to scala.)

Jorge Ortiz
Joined: 2008-12-16,
User offline. Last seen 29 weeks 3 days ago.
Re: Compiler plugin to provide metadata about a property
How likely is it that SourceContext will make it into 2.10? It would be quite handy in a few cases.

On Thu, Feb 16, 2012 at 11:23 AM, Adriaan Moors <adriaan.moors@epfl.ch> wrote:
the feature you propose reminds me a bit of scala-virtualized's SourceContext, which is like a Manifest, but instead of preserving types until run time, it preserves source information (like line numbers) it's not in master (yet), but the latest improvement to it is in commit https://github.com/adriaanm/scala/commit/69f8e42a228da36c48d7b6111a7c5201ce9c1c7d
so for lack of reviewing your code, I could suggest you make it look like that ^^
cheersadriaan

odersky
Joined: 2008-07-29,
User offline. Last seen 45 weeks 6 days ago.
Re: Compiler plugin to provide metadata about a property

On Sun, Feb 19, 2012 at 6:33 AM, Jorge Ortiz wrote:
> How likely is it that SourceContext will make it into 2.10? It would be
> quite handy in a few cases.
>
>
It's pretty likely, I would say. No formal decision yet but the
consensus so far is that it should go in.

Cheers

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland