Uploaded image for project: 'core.async'
  1. ASYNC-91

(CLJS) 'and' does not short circuit within go block in clojurescript

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Labels:
      None
    • Environment:

      core.async 0.1.338.0-5c5012-alpha

      Description

      I have the following piece of ClojureScript code within a go block:

      (cond
      (and (vector? x) (= (first x) :some-key)) ...)

      This generates the following piece of JavaScript code for the cond case:

      if (40 === f) {
      return
      d = b[9],
      f = cljs.core.vector_QMARK_.call(null, d),
      d = cljs.core.first.call(null, d),
      d = cljs.core.EQ.call(null, d, new cljs.core.Keyword(null, "some-key", "some-key", -978969032)),
      cljs.core.truth_(f && d) ? b[1] = 42 : b[1] = 43,
      new cljs.core.Keyword(null, "recur", "recur", -437573268);
      }

      This looks to me like both and arguments would actually get evaluated. As a result my code crashes whenever it hits this cond case and 'x' is not seqable.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              alex+import import
            • Votes:
              2 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: