Standard library compiled with generics? (was: Re: [scala] Scala generics as java generics?)

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

Standard library compiled with generics? (was: Re: [scala] Scala generics as java generics?)

by Paul Chiusano-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I thought of an additional question: when scala generics as java generics becomes available in 2.7.2, will the standard library be compiled with generics information, so that Option will show up as Option<T>, etc? If so, will there also be an official 1.4 version of the scala library packaged along with scala, for people who need to target 1.4 as well as 1.5, or will users like this just have to compile their own version of the standard library targeting 1.4?

Paul

On Wed, Jul 9, 2008 at 9:50 AM, Paul Chiusano <paul.chiusano@...> wrote:
That's excellent! Thank you.

On Wed, Jul 9, 2008 at 8:23 AM, martin odersky <martin.odersky@...> wrote:
It's not done yet. The plan is to make this available for 2.7.2. An RC
for this is expected late august.

Cheers

 -- Martin

On Wed, Jul 9, 2008 at 10:43 AM, David MacIver <david.maciver@...> wrote:
> On Wed, Jul 9, 2008 at 9:01 AM, Sean McDirmid <sean.mcdirmid@...> wrote:
>> The Scala compiler has done this for a while now. The type parameter
>> attributes are generated for Java and used from Java when the scalac
>> target flag is set to 1.5 (may be default now). Both Scala and Java
>> depend on erasure, so Scala type parameters are erased as usual and
>> only remain behind in the type parameter attribute section of the
>> classfile (just as in Java).
>
> I don't think this is true, at least in 2.7.1 (and I haven't seen
> anything in the commit logs to suggest it's true in trunk, but don't
> readily have a version for testing). I just ran some quick tests
> against both the standard library and freshly compiled code and
> couldn't see a single instance of Java being able to see type
> parameters defined in Scala. Are you sure you haven't misunderstood
> the question? The other direction works (Scala can see Java type
> parameters), but scalac still doesn't emit Java compatible generics
> information.
>
>> I deal with the Scala/Java integration problem by writing all my new
>> code in Scala. This is the easiest approach if you can stomache it. Of
>
> So do I. That doesn't solve all the problems, as there are a number of
> cases where it would be useful if the generic type information had the
> same reflective structure as it does in Java.
>


LightInTheBox - Buy quality products at wholesale price