is. Cheking type   [3.4.4]

^reflection:is[element name;type]
^reflection:
is[element name;type;context]

The operator checks if element with specified name is an object of specified type and returns bool value (true/false).
Extends is operator functionality, allowing to check if argument is code. To check if the element is code (passed in
curly or round brackets) parameter type should be set to special value 'code'. To check if the element is method
reference parameter type should be set to special value 'method'.

By default the context is method call context. If the method accepts variable number of parameters, context should be
set to variable that keeps them.

Parameter type check

@main[]
^method[string]
^method{code}
^method[$method]
^another-method[$method]

@method[param]
^if(^reflection:is[param;
junction]){
    Param is ^if(^reflection:is[param;code]){code}{method reference}
}{
    Param is not code or method reference
}

@another-method[*params]
^if(^reflection:is[0;method;$params]){
    First param is method reference
}




Copyright © 1997–2021 Art. Lebedev Studio | http://www.artlebedev.com Last updated: 21.07.2016