krl-compiler
Advanced tools
Changelog
0.13.0 - September 13, 2017
Wrangler provides a lot of the engine module functionality. It aims for easy, programmatically management of registering, installing, uninstalling, and listing rulesets, creation, deletion and listing of channels, as well as creation, deletion and listing of children picos. Wrangler allows you to write code to do everything that a user would us the UI for.
engine:getAdminECI(pico_id)
engine:newPico(pico_id)
now sets the parent id to pico_id
creates an admin channel for you.engine:getParent(pico_id)
and engine:listChildren(pico_id)
engine:listInstalledRIDs(pico_id)
engine:*
functions that have a pico_id
argument now defaults to meta:picoId
defaction
between rulesets now return the right valuekrl/
) now are loaded by dependency ordering.Changelog
0.12.0 - May 25, 2017
setting(..)
)<name> = defaction(<params...>){
<declaration 0>
<declaration 1>
...
<action block (i.e. anything you would put in a rule action)>
returns <expr 0>, <expr 1>, ...
}
NOTE: returns
is optional
For example
global {
foo = defaction(){
send_directive("foobar")
returns 1, 2, 3
}
}
rule bar {
select when ...
foo() setting(a, b, c)
fired {
//a = 1, b = 2, c = 3
}
}
Another example
global {
foo = defaction(){
every {
http:get(...) setting(resp)
}
return resp["content"].decode()["msg"]
}
}
rule bar {
select when ...
foo() setting(message)
}
sample
This will randomly select an action to run.rule bar {
select when ...
//randomly pick one of these 3 actions to run
sample {
send_directive("foo")
send_directive("bar")
send_directive("baz")
}
}
ActionBlock ->
<action> ;
| if <expr> then <action> ;
| if <expr> then every { <action 0> ; <action 1> ; ... }
| if <expr> then sample { <action 0> ; <action 1> ; ... }
| every { <action 0> ; <action 1> ; ... }
| sample { <action 0> ; <action 1> ; ... }
| choose <expr> { <action 0> ; <action 1> ; ... }
with
is no longer used for named arguments. Both for functions and actions.//OLD WAY
foo(1, 2) with a = 3 and b = 4
//NEW WAY
foo(1, 2, a = 3, b = 4)
with
is no longer used on raise
/schedule
//OLD WAY
raise domain event "type" with foo = 1 and bar = 2
//NEW WAY
raise domain event "type" attributes {"foo": 1, "bar": 2}
send_directive
no longer uses with
it's now send_directive(name, options = {})
//OLD WAY
send_directive("name") with foo = x and bar = y
//NEW WAY
send_directive("name", {"foo": x, "bar": y})
select when ...
//OLD WAY
select when foo bar;
//NEW WAY
select when foo bar
with
Changelog
0.11.0 - May 20, 2017
<name> = defaction(<params...>){
<declaration 0>
<declaration 1>
...
<action block (i.e. anything you would put in a rule action)>
}
For example
chooser = defaction(val){
baz = "hello"
qux = "bye"
choose val {
asdf =>
foo(val)
fdsa =>
bar(val, "ok", "done")
}
}
configure using
)foo = function(bar = 2, baz = bar + 3){
bar + baz
}
//-or- when it gets too long
foo = function(
bar = 2,
baz = bar + 3,
qux = 4,
quux = blah(qux),
){
...
}
//defaction parameters work the same way as functions
//the following are now actions and cannot be used as a function
engine:newPico
engine:removePico
engine:newChannel
engine:removeChannel
engine:registerRuleset
engine:unregisterRuleset
engine:installRuleset
engine:uninstallRuleset
event:send
schedule:remove