Quantcast
Channel: dkal Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 25

Closed Feature: Reflection Substrate [8]

$
0
0
Reflection substrate allows DKAL to call specific methods in external libraries via reflection.
This can be used to integrate DKAL into some complex systems.

Substrate declaration:
```
datasource reflection("Class, Assembly") namespaces "ns"
```
where _"Class, Assembly"_ is full name of a class (with assembly if needed).
See [System.Type.GetClass(string)](http://msdn.microsoft.com/en-us/library/w3f99sx1.aspx) for format.

Usage:
```
{|ns| OutputVars = method(InputVars) |}
```
_method_ is static method name in the class specified above. DKAL will call the _method_ with values of _InputVars_ as arguments and bind method return values to _OutputVars_
_OutputVars_ - comma separated list of output variables
_InputVars_ - comma separated list of input variables

_method_ type signature (C#), general case:
```
public class Class {
public static IEnumerable<IEnumerable<Object>> method(T1 I1, ..., Tn In)
```
Each element of return value is treated as output variables bindings.
if _method_ return type is not IEnumerable then returned value treated as IEnumerable with single element.
if _method_ returns null then result will be empty IEnumerable.
if _OutputVars_ is empty then _method_ should return boolean. In this case _method_ is just a filter of substitutions.

valid method signatures:
```
public static string getParent(string o)
public static bool notOwned(string o)
public static string[] owns(string o)
```
usage:
```
{|r| G = owns(O) |}
{|r| notOwned(O) |} && {|r| O1 = getParent(O) |}
```

Viewing all articles
Browse latest Browse all 25

Latest Images

Trending Articles





Latest Images