hyperjumptech/grule-rule-engine

Edge case for generics or bad implementation ? (no function named...)

Closed this issue · 1 comments

ryjogo commented

Describe the bug

ERRO[0000] error while executing expression MF.Hostname.UseVMWare(). got this node identified as "MF.Hostname" have no function named UseVMWare  lib=grule-rule-engine package=ast
ERRO[0000] Failed execution rule : CheckValues. Got error this node identified as "MF.Hostname" have no function named UseVMWare  lib=grule-rule-engine package=engine
2023/02/17 19:03:25 error while executing rule CheckValues. got this node identified as "MF.Hostname" have no function named UseVMWare
panic: error while executing rule CheckValues. got this node identified as "MF.Hostname" have no function named UseVMWare

To Reproduce
Steps to reproduce the behavior:

i have made a small test:
https://github.com/ryjogo/grule-rule-engine-issues-359/blob/main/main.go

for clarification, i am trying to access a method:

    rule CheckValues "Check the default values" salience 10 {
    when 
        true
    then
        MF.Hostname.UseVMWare();
        Retract("CheckValues");
    }

Expected behavior
The idea was that i could run rules on my test.Hostname - then choose a value with the Use methods, i.e. UseVMWare.
This works :

    test.Hostname.UseVMWare()
    fmt.Printf("value is now: %s\n", test.Hostname.GetValue())

but in the drls it throws the above error.

newm4n commented

Ah yes. The engine are not yet able to reflect with generics yet.