Str function in new API in plugin

Here is maybe a tougher one:

REALLoadFrameworkMethod(“Str(number as Double) as String”)

How does that one go to New API in a plugin ?

Thanks

Björn

the new api is just an extends method

ToString(extends d as double) as string

and it lives in a global module called Double from what I can tell

I will test in a bit if I can load such method thanks Normal. ! I will report back if it works.

I like to think I am [quote=457405:@Björn Eiríksson]Normal[/quote] :stuck_out_tongue:

Ops !! so sorry did not mean to mess up your name !

no problem … autocorrect does that a lot of the time unintentionally :slight_smile:

Ok so I just tested… and was not able to load.

Am not sure actually that we have ever been able to load Extension methods.

REALLoadFrameworkMethod(“ToString(extends d as double) as String”);

Tested also without Extends.

Some more variants I tested:

REALLoadFrameworkMethod(“ToString(extends d as Double, locale as Locale=nil) as String”);
REALLoadFrameworkMethod(“Double.ToString(extends d as Double, locale as Locale=nil) as String”);

But no luck.

bug report ?
dunno what else to say as a lot of the new api 2.0 methods are just extensions in various modules from what I can tell
kind of like string.instr() etc were but then there was always the older instr(string) version that was the exact equivalent

Yea I think those are somehow different since you were always able to call Instr also as normal function I guess yes as you say.

I am guessing there is no way at all to load pure extension method.

I will put in bug report.

and Instr still exists
the new extension may just call that wit 0 based params instead of 1 based

57819 - There seems to be no way for Plugin to load the new API 2 string methods

can you load any extension method ?
maybe thats the more general problem

Yes, I think extension methods cannot be loaded.

This particular one is not showstopper at the moment since obviously I can use the old one for now. Still something that needs to be addressed so we not continue to make code that one day will be invalid.

well until they make something like

123.ToString

work they have to keep the non-extension versions or break a TON more code by forcing you to write that as

dim i as integer = 123
s = i.ToString