Public Vars

Back

with-in-str (clj)

(source)

macro

(with-in-str s & body)
Evaluates body in a context in which *in* is bound to a fresh StringReader initialized with the string s.

Examples

frenchy64/fully-satisfies
(ns io.github.frenchy64.fully-satisfies.non-leaky-macros.clojure.core
  "Implementations of clojure.core macros that don't leak implementation details."
  (:refer-clojure :exclude [locking binding with-bindings sync with-local-vars
                            with-in-str dosync with-precision with-loading-context
                            with-redefs delay vswap! lazy-seq lazy-cat future
                            pvalues])
  (:require [clojure.core :as cc]))

(defmacro non-leaky-with-in-str
  "Like clojure.core/with-in-str, except body cannot leak try/catch syntax."
  [s & args]
  `(cc/with-in-str ~s
     (do ~@args)))

(defmacro with-in-str
  [& args]
  `(non-leaky-with-in-str ~@args))