Skip to content

Implementation Ideas

Michael O'Keefe edited this page Jul 2, 2014 · 4 revisions

Embedding / using Kiss

  • Kiss is designed to be embedded in the Clojure runtime environment. Clojure code will be fully usable from Kiss and vice versa. In the first instance, Kiss will just use all of clojure.core directly, in addition to taking advantage of Clojure data structures, interfaces, abstractions etc.
  • There will be a kiss macro to execute Kiss code easily within Clojure source. This will probably be the normal way of using Kiss

Environments

  • Kiss environments will look like maps to Clojure code, specifically maps from symbols to values (internally the environment will maintain more data, e.g. the types of each value)
  • Kiss will keep a dependency graph between compiled code in immutable environments, If you redefine something, this will enable all dependent code in the environment to be updated. This will recreate the "dynamic redefinition" behaviour that is familiar to Clojure users, without requiring full recompilations
  • It will be possible to define something with a missing dependency: this will create a "deferred dependency". This will enable modules / units of code to be loaded independently, while still allowing circular references to be resolved later. Actually trying to evaluate something that is a deferred dependency will be an error of course.
  • It should be possible to merge Kiss environments. This could be useful for tasks like reconfiguring a module dynamically etc.
  • It should be possible to fork Kiss environments to create independent instances from the same base environment. Structural sharing should ensure that this is highly efficient
  • Restricted Kiss environments should work as an effective sandbox: there will be no escape from the sandbox except via definitions that already exist in the environment.
  • Kiss environments are independent, with no inherrent global state. This will make them practical for running e.g. isolated instances of application servers.

Expressions

  • Kiss Expressions are compiled into an AST-style data structure
  • Expressions have the following properties
    • A return type (can be Any)
    • A set of free variables
  • Expressions can be computed if and only if all free variables are provided. One way of doing this is to compute an Expression within a sufficiently populated environment.
  • Expressions support a number of operations
    • Specialisation on the type of one or more free variables
Clone this wiki locally