Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: typos and an additional common error

...

An event is sent to a pico by issuing a POST (or GET**) request to the pico engine which currently hosts the pico. The engine converts the HTTP request into an event to the pico. Many of the rules in any of the rulesets installed in the pico may be selected for evaluation. Ruleset Rulesets are considered in a non-deterministic order, but within a ruleset the selected rules will be evaluated in the order written. Each rules rule may conditionally take action on other picos or the outside world in general (including HTTP POSTs), and may also have effects on the state of the pico. Furthermore, a rule may raise additional events (to the same pico) which will be processed as part of the original incoming event (See Raising Explicit Events in the Postlude). You might think of the original event as ricocheting within the boundary of the pico until things settle down, and all rules have had a chance to run. Only then will results specified by the rules be gathered together and packaged into an HTTP response to theĀ event generator which issued the request. Any actions taken on the outside world happen as the rules are evaluated, but the results are not returned until event evaluation is complete. (SeeĀ Event Loop Introduction for a more complete discussion).

...

However, when the value matched is a string, only the first line of that string will be retained. See this commit for an example of working around this.

Ruleset identifier (RID) vs. KRL filename

By convention, most KRL programmers use the ruleset identifier as the name of the file containing the ruleset, with .krl as the filename extension. This is not enforced by the KRL compiler (as a similar convention is enforced in Java). If you decide to not follow the convention, be aware of potential pitfalls.

The RID must be used in a sky/cloud/ URL, and is the value of meta:rid within a ruleset. It must also be used as the rid attribute in the wrangler:install_ruleset_request event, when accompanied by the absoluteURL attribute. In contrast, the url attribute for that same event will end with the entire filename where the ruleset is located (and so will include the .krl extension.

The pico engine enforces uniqueness of rulesets installed in any given pico that it hosts by using the RID, not the URL from which it is installed.