Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Declined
    • Affects versions: None
    • Fix versions: None
    • Labels:
      None

      Description

      Given some JavaScript library included in the same page as CLJS output:

      var Lib = {};
      
      Lib.Thing = function (val) {
          this.val = val;
      };
      
      Lib.Thing.prototype.log = function () {
          console.log(this.val);
      };
      

      I can bind the Thing property to a local and construct it using new or the dot form. This code compiles and runs without errors, and logs three lines to the console.

      (ns cljs-construct-locals-bug.core)
      
      ; Legit
      (let [thing (new js/Lib.Thing "hello")]
        (.log thing))
      
      ; Questionable
      (let [Thing (.-Thing js/Lib)
            thing1 (new Thing "maybe")
            thing2 (Thing. "no way")]
        (.log thing1)
        (.log thing2))
      

      I talked to David Nolen and he said this behavior is not correct.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: