Re: [Ikvm-developers] How to refer to identifiers containing a $ from C#
Brought to you by:
jfrijters
From: Jeroen F. <je...@su...> - 2013-02-05 09:57:42
|
Hi Rüdiger, IKVM does not automatically do this conversion for various reasons (mostly because Java actively discourages the usage of $ in identifiers and if I did do an automatic conversion it would still end up looking really ugly and most people probably wouldn't like it anyway). As you found C# doesn't have a way to access these identifiers. @ only works for keywords. The only practical solution is to write Java wrappers. The map.xml approach is also not really intended for this (although you could use it to add additional methods/properties that alias the methods/fields, but there is nothing for class names). Regards, Jeroen > -----Original Message----- > From: Rüdiger Klaehn [mailto:rk...@gm...] > Sent: Friday, February 1, 2013 22:49 > To: Volker Berlin > Cc: ikv...@li... > Subject: Re: [Ikvm-developers] How to refer to identifiers containing a > $ from C# > > Using @ doesn't work for me. > > I have class names that end with a '$', like for example > scala.collection.immutable.HashMap$, and method/field names that start > with a $ like for example "$plus". > > I can not refer to any of them using C#. I tried using @HashMap$ and > even inserting the unicode escape sequence for a $, \u0024, like so: > HashMap\u0024. It appears that $ is not a valid identifier character for > C#. I only have linux at home, so I tried mono. No luck either. > > But $ is a valid identifier inside the CLR, otherwise compiling and > running a scala program using ikvmc would not work at all. > > > On Fri, Feb 1, 2013 at 10:04 PM, Volker Berlin <volker.berlin@goebel- > clan.de <mailto:vol...@go...> > wrote: > > > Hi, > > Do you want rename classes or do you want only access an inner > class from C#? > > For renaming we use an obfuscator before compiling. > > For accessing a class with a $ you can prefix it with a @ > character. > > Volker > > > > Am 01.02.2013 17:35, schrieb Rüdiger Klaehn: > > > Any idea on this? > > I noticed that there seems to be a way to rename individual > methods using the -remap option of ikvmc. But I could not find a > documentation for the format of that file. Is there a way to rename > identifiers using regex patterns, or do you have to refer to each > identifier individually? > > thanks a lot, > > Rüdiger > > > On Tue, May 8, 2012 at 10:17 AM, Rüdiger Klaehn > <rk...@go... <mailto:rk...@go...> > wrote: > > > Hi all, > > I am trying to use IKVM to allow us a gradual migration > of a large > project from .NET to the JVM. Our plan is to start > writing a numerical > library in scala and to use IKVM to allow usage of this > library from > .NET for the transition time. > > We have no illusions about this: you will not be able to > write the > library in straight scala and use it seamlessly from C#. > Instead there > will have to be some boilerplate on the scala side to > make usage from > C# easier. So the interface between scala and C# has to > be very > minimal. > > The compilation and calling complex methods works > surprisingly well. > Even the performance is reasonable. But there is one > problem that I > could not solve so far: scala frequently uses $ in > identifiers, e.g. > for the names of companion objects. But I can not see > any way to use $ > from C#. But obviously $ is a valid identifier at CLR > level, otherwise > it would not be possible to translate scala or java > programs _at all_. > > So is there a way to refer to an identifier like a > method name "$plus" > or a type name "MyObject$" from C#? Or do we have to > write proxy > objects with friendly names for every single type we > want to use from > C#? > > cheers, > > Rüdiger > > > > > > > ------------------------------------------------------------- > ----------------- > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_jan > > > > _______________________________________________ > Ikvm-developers mailing list > Ikv...@li... <mailto:Ikvm- > dev...@li...> > https://lists.sourceforge.net/lists/listinfo/ikvm-developers > > > > ------------------------------------------------------------------- > ----------- > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_jan > _______________________________________________ > Ikvm-developers mailing list > Ikv...@li... <mailto:Ikvm- > dev...@li...> > https://lists.sourceforge.net/lists/listinfo/ikvm-developers > > > |