- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Compiler plugin to provide metadata about a property
Wed, 2012-02-15, 22:55
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
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
Thu, 2012-02-16, 17:41
#2
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
so for lack of reviewing your code, I could suggest you make it look like that ^^
cheersadriaan
Thu, 2012-02-16, 20:41
#3
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 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.)
Sun, 2012-02-19, 06:41
#4
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:
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
Sun, 2012-02-19, 09:51
#5
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
On Wed, Feb 15, 2012 at 1:55 PM, EECOLOR <eecolor@gmail.com> wrote:
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.)