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

Scala-style Runtime-visible Annotations?

5 replies
Adam Jorgensen
Joined: 2011-04-17,
User offline. Last seen 42 years 45 weeks ago.

So, does anyone know if any progress has been made with implementing
runtime-visible scala-style
annotations?

I know it's possible to get runtime visibility using annotations
implemented in Java but this is not ideal
as the Java annotation definition system is a lot more kludgy than
Scala-style annotations.

I found this sad, lonely ticket on the Scala Trac system:
https://lampsvn.epfl.ch/trac/scala/ticket/32

It looks to have been abandoned...

Is there any hope that we will get this feature implemented at some
point in time...

Of course, if anyone knows of a better feature that can replace the
needs for this one that works
right now I would like to hear about it :-)

rytz
Joined: 2008-07-01,
User offline. Last seen 45 weeks 5 days ago.
Re: Scala-style Runtime-visible Annotations?


On Mon, Apr 18, 2011 at 07:22, Adam Jorgensen <adam.jorgensen.za@gmail.com> wrote:
So, does anyone know if any progress has been made with implementing
runtime-visible scala-style
annotations?

I know it's possible to get runtime visibility using annotations
implemented in Java but this is not ideal
as the Java annotation definition system is a lot more kludgy than
Scala-style annotations.

I found this sad, lonely ticket on the Scala Trac system:
https://lampsvn.epfl.ch/trac/scala/ticket/32

It looks to have been abandoned...

It has low priority, and nobody is working on this AFAICT. If somebodysteps up and starts implementing we'll be happy to accept patches..
 

Is there any hope that we will get this feature implemented at some
point in time...


Of course, if anyone knows of a better feature that can replace the
needs for this one that works
right now I would like to hear about it :-)

Ismael Juma 2
Joined: 2011-01-22,
User offline. Last seen 42 years 45 weeks ago.
Re: Scala-style Runtime-visible Annotations?

On Mon, Apr 18, 2011 at 6:59 AM, Lukas Rytz wrote:
> It has low priority, and nobody is working on this AFAICT. If somebody
> steps up and starts implementing we'll be happy to accept patches..

It's worth mentioning that this makes the following more of an issue.

https://lampsvn.epfl.ch/trac/scala/ticket/2764

Since one has to use Java for runtime annotations, one ends up using
features like Java static constants or Java enums while creating them
in the same project as the Scala files to avoid having a separate
project just for the annotations. And then one runs into #2764.

Best,
Ismael

Adam Jorgensen
Joined: 2011-04-17,
User offline. Last seen 42 years 45 weeks ago.
Re: Scala-style Runtime-visible Annotations?

Ouch, nasty.

It seems like it would be an all-round good think of runtime visible
annotations were implemented then. It's a pity that the ticket
in question has low priority.

Does anyone have an idea of how much work would be involved
in implementing this feature?

On 18 April 2011 10:13, Ismael Juma wrote:
> On Mon, Apr 18, 2011 at 6:59 AM, Lukas Rytz wrote:
>> It has low priority, and nobody is working on this AFAICT. If somebody
>> steps up and starts implementing we'll be happy to accept patches..
>
> It's worth mentioning that this makes the following more of an issue.
>
> https://lampsvn.epfl.ch/trac/scala/ticket/2764
>
> Since one has to use Java for runtime annotations, one ends up using
> features like Java static constants or Java enums while creating them
> in the same project as the Scala files to avoid having a separate
> project just for the annotations. And then one runs into #2764.
>
> Best,
> Ismael
>

rytz
Joined: 2008-07-01,
User offline. Last seen 45 weeks 5 days ago.
Re: Scala-style Runtime-visible Annotations?


On Mon, Apr 18, 2011 at 15:16, Adam Jorgensen <adam.jorgensen.za@gmail.com> wrote:
Ouch, nasty.

It seems like it would be an all-round good think of runtime visible
annotations were implemented then. It's a pity that the ticket
in question has low priority.

Does anyone have an idea of how much work would be involved
in implementing this feature?

It's definitely non-trivial. Java annotations have specific representation inbytecode (the classfile format described here), which would require changes to Scala's bytecode generator.
Also the language of java annotations is quite special, different from the rest ofthe Java language (see here), so one would need to define how this can be represented in a Scala class.
Lukas 

On 18 April 2011 10:13, Ismael Juma <ismael@juma.me.uk> wrote:
> On Mon, Apr 18, 2011 at 6:59 AM, Lukas Rytz <lukas.rytz@epfl.ch> wrote:
>> It has low priority, and nobody is working on this AFAICT. If somebody
>> steps up and starts implementing we'll be happy to accept patches..
>
> It's worth mentioning that this makes the following more of an issue.
>
> https://lampsvn.epfl.ch/trac/scala/ticket/2764
>
> Since one has to use Java for runtime annotations, one ends up using
> features like Java static constants or Java enums while creating them
> in the same project as the Scala files to avoid having a separate
> project just for the annotations. And then one runs into #2764.
>
> Best,
> Ismael
>

Adam Jorgensen
Joined: 2011-04-17,
User offline. Last seen 42 years 45 weeks ago.
Re: Scala-style Runtime-visible Annotations?

On 18 April 2011 16:00, Lukas Rytz wrote:
>
>
> On Mon, Apr 18, 2011 at 15:16, Adam Jorgensen
> wrote:
>>
>> Ouch, nasty.
>>
>> It seems like it would be an all-round good think of runtime visible
>> annotations were implemented then. It's a pity that the ticket
>> in question has low priority.
>>
>> Does anyone have an idea of how much work would be involved
>> in implementing this feature?
>
> It's definitely non-trivial. Java annotations have specific representation
> in
> bytecode (the classfile format described here), which would require changes
> to Scala's bytecode generator.
> Also the language of java annotations is quite special, different from the
> rest of
> the Java language (see here), so one would need to define how this can be
> represented in a Scala class.
> Lukas

Indeed, very non-trivial. It's a real pity this is not something that can
be implemented easily because it's a useful feature :-/

So the difficulty really lies in the fact that Java annotations are one of
those "special cases" that scala tries to avoid :-)

Again, most unfortunate because Scala annotations are a lot more logical
and consistent than Java ones...

>
>>
>> On 18 April 2011 10:13, Ismael Juma wrote:
>> > On Mon, Apr 18, 2011 at 6:59 AM, Lukas Rytz wrote:
>> >> It has low priority, and nobody is working on this AFAICT. If somebody
>> >> steps up and starts implementing we'll be happy to accept patches..
>> >
>> > It's worth mentioning that this makes the following more of an issue.
>> >
>> > https://lampsvn.epfl.ch/trac/scala/ticket/2764
>> >
>> > Since one has to use Java for runtime annotations, one ends up using
>> > features like Java static constants or Java enums while creating them
>> > in the same project as the Scala files to avoid having a separate
>> > project just for the annotations. And then one runs into #2764.
>> >
>> > Best,
>> > Ismael
>> >
>
>

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