Monday, August 30, 2010

New Mint Release: r15716

As mentioned before, Eddy and I discovered a problem with type variables in code generated by the Mint compiler. We have now fixed this problem in the new release of Mint and DrJava with Mint: August 30, 2010 (r15716). The latest release is, as always, available from the Mint implementation page:
The problem occurred when the programmer used a type variable inside a bracket. An example of this would be a generic method like this:
public separable <X> Code<X> fun(Code<X> c1, Code<X> c2) {
return <| ( `(lfTest.eval(e,f).booleanCodeValue()) ?
`c2 : `c1 ) |>;
}
This caused Mint to generate 2nd stage code that contained the type variable X unbound. Unfortunately, the types are erased, and there is no way to find out what type X actually refers to at runtime, e.g. by writing something like X.class (this generates the Java compiler error "cannot select from a type variable").

To get around this problem, we now require a final instance of type Class<X> to be in scope for every type variable X. For example, in the generic method above, there is a type variable X that is being used in the bracket. Therefore, we now have to have a final instance of Class<X>somewhere in scope, for example as a method parameter.
public separable <X> Code<X> fun(Code<X> c1, Code<X> c2,
final Class<X> xc) {
return <| ( `(lfTest.eval(e,f).booleanCodeValue()) ?
`c2 : `c1 ) |>;
}
That's all that is necessary. The variable xc is not actually used in the code, it just needs to be in scope.

22 comments:

  1. Adidas produce il nuovo Chelsea 16-17 casa, lontano e kit terzo per l’ultima volta dopo che il contratto che hanno deciso di tagliare il loro kit di sponsorizzazione a lungo termine sul 11 maggio Chelsea camicia sponsor Yokohama è di nuovo sulle nuove Chelsea 2016-17 camicie .maglie calcio,
    poco prezzo Maglia Barcelona vendita
    Maglia Deportivo shop

    ReplyDelete
  2. Our Green Bay Packers Banner measures a huge 2x8 feet, is constructed of thick weather resistant nylon, and is embroidered with the Green Bay Packers NFL team logo as shown. Our Green Bay Packers Banner includes ten (10) reinforced metal grommets around the perimeter for easy hanging at your next tailgate party, in your sports room, or as an interior or exterior "gameday" decoration.
    nfl house flags
    nfl flags wholesaleRavens american flags
    Bills stars and stripes flags

    ReplyDelete
  3. Thanks for your article .its very useful for everyone. best aws training in chennai | aws course fees details


    Thanks for your article .its very useful for everyone. best aws training in chennai | aws course fees details


    Thanks for your article .its very useful for my project. Thank you so much for your valuable content. best aws training in chennai | aws course fees details






    ReplyDelete
  4. I would like to say thank you for the amazing details and concepts you are sharing in this.
    Mobile Apps Training

    ReplyDelete
  5. Thanks for such a great article here. I was searching for something like this for quite a long time and at last I’ve found it on your blog. It was definitely interesting for me to read  about their market situation nowadays.

    python training in chennai | python training in bangalore

    python online training | python training in pune

    python training in chennai

    ReplyDelete
  6. We are a group of volunteers and starting a new initiative in a community. Your blog provided us valuable information to work on.You have done a marvellous job!

    java training in chennai | java training in bangalore

    java online training | java training in pune

    ReplyDelete
  7. Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.

    rpa training in Chennai | rpa training in pune

    rpa training in tambaram | rpa training in sholinganallur

    rpa training in Chennai | rpa training in velachery

    rpa online training | rpa training in bangalore

    ReplyDelete
  8. I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own BlogEngine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it.
    python training in tambaram
    python training in annanagar
    python training in Bangalore

    ReplyDelete
  9. Great post! I am actually getting ready to across this information, It’s very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.
    DevOps online Training
    DevOps Training in USA

    ReplyDelete
  10. Hmm, it seems like your site ate my first comment (it was extremely long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog. I as well as an aspiring blog writer, but I’m still new to the whole thing. Do you have any recommendations for newbie blog writers? I’d appreciate it.

    Best Selenium Training in Chennai | Selenium Training Institute in Chennai | Besant Technologies

    Selenium Training in Bangalore | Best Selenium Training in Bangalore

    AWS Training in Bangalore | Amazon Web Services Training in Bangalore

    ReplyDelete