Skip to content

Fixed object manipulation and enhanced scoping of functions and variables.

Pre-release
Pre-release
Compare
Choose a tag to compare
@sigmasoldi3r sigmasoldi3r released this 20 Sep 10:43
· 25 commits to master since this release

Now you can export global-level functions just by adding :global as first expression of the function.

(defn package-level []
  "hey")

(defn global-func [] :global
  "awesome, huh?")

The scoping now is divided in package, local and global.
If you want to return the symbol :global from a function you can escape it's "decorator" behaviour by adding a unit as first
expression:

(defn what-symbol []
  unit ; Basically a noop-expression
  :global)

Also object/set was not doing fine when converting symbols to string keys. If desired, a symbol key can be used by invoking object/set-raw:

(object/set o1 :my_key "Hello")
(object/set-raw o2 :my_key "Hello")

Those translate roughly to:

o1.my_key = "Hello";
o2[charon.symbol"my_key"] = "Hello";

Which is different, specially when talking about POLT objects.