JanetDocsSourcePlaygroundI'm feeling luckyCommunityGitHub sign in

with-dyns

core-api


    macro
    boot.janet on line 1477, column 1

    (with-dyns bindings & body)

    Run a block of code in a new fiber that has some dynamic bindings 
    set. The fiber will not mask errors or signals, but the dynamic 
    bindings will be properly unset, as dynamic bindings are 
    fiber-local.


1 exampleSign in to add an example
Loading...
# based on: https://codeberg.org/veqq/janetdocs/src/commit/54a964d1a35920af2655c4932a9b51379e8b9380/seed.janet#L16 

(def core-api (all-bindings))
(def alldocs @[])

(loop [b :in core-api]
  (when (not= "allbindings" (string b))
    (do
      (def buf @"")
      (with-dyns [:out buf]
        (doc* b)
        (array/push alldocs {:name (string b) :docstring (string buf)})))))

(pp alldocs)
veqqqPlayground