Details
-
Type:
Improvement
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: 0.9.3
-
Fix Version/s: None
-
Component/s: Runtime (Boo.Lang)
-
Labels:None
-
Environment:Boo 0.9.3
-
Testcase included:yes
-
Number of attachments :
Description
I tried to use Linq methods to process results returned by method IQuackFu.QuackInvoke. Because you are reading this issue you could guess that I did not succeed.
There are two problems in runtime Boo environment which prevents using non-Boo generic extensions.
First is that there is no method to register CLR extensions in RuntimeServices.
Second is that runtime method resolver doesn't resolve generic method definitions.
I propose to add RegisterClrExtensions method to Boo.Lang.Runtime.ExtensionRegistry. Also I propose to add logic resolving generic method definitions to Boo.Lang.Runtime.MethodResolver.
Test case:
"""
3
"""
import Boo.Lang.Compiler
import Boo.Lang.Compiler.Ast
import System.Collections.Generic
class Foo(IQuackFu):
def QuackSet(name as string, parameters as (object), value) as object:
return null
def QuackGet(name as string, parameters as (object)) as object:
return null
def QuackInvoke(name as string, args as (object)) as object:
l1 = (1,)
l2 = (2,3)
if name == "Invoke1":
return l1
return l2
Boo.Lang.Runtime.RuntimeServices.RegisterClrExtensions(System.Linq.Enumerable)
foo = Foo()
l3 = foo.Invoke1().Concat(foo.Invoke2())
print l3.Count()
The proposed fix is in the attached diff.