Hey Tim, thanks for the reply.

I didn't know how Google Groups worked so I expected to by notified of a reply, 
so I saw it late.

I see my question was horrible to parse so I created a gist. I also found out 
that the problem I was having has been fixed from version 0.0-2080 to 0.0-2127!

https://gist.github.com/aymanosman/8364430

You can see in the (simplified) output that the "correct" code is being emitted 
by the compiler on the line with the assignment of example.core.device_wrong3.

Thanks for your help. I wonder when that was fixed. I find it exciting and 
quite scary that such changes to the compiler can happen over a short period of 
time.

On Thursday, 12 December 2013 15:15:37 UTC, Tim Visher  wrote:
> Hi Ayman,
> 
> 
> 
> Welcome to the group!
> 
> 
> 
> Without a little more detail in your post, I think you won't get much help.
> 
> 
> 
> If your comments are your questions I would suggest opening up
> 
> multiple threads with specific questions on each point.
> 
> 
> 
> On Wed, Dec 11, 2013 at 4:06 PM, Ayman Osman <[email protected]> wrote:
> 
> > Hi There,
> 
> >
> 
> > I'm new to this group, don't know how to introduce myself so I will get 
> > straight to the point.
> 
> >
> 
> > (ns example.core
> 
> >   (:require [serialport :as comPort]) ;; As a side note, why does the :as 
> > clause add a second call to goog.require??
> 
> >   )
> 
> >
> 
> > (def com (js.require "serialport")) ;; Using a dot instead of a / works 
> > incidentally
> 
> >
> 
> > (def device-wrong1 (com.SerialPort. "COM1"))
> 
> >
> 
> > (def SerialPort (.-SerialPort com))
> 
> > (def device-correct1 (SerialPort. "COM1")) ;; Must I resort to this...
> 
> > (def device-correct2 (example.core.com.SerialPort. "COM1")) ;; ...or this?
> 
> >
> 
> > (def device-wrong2 (com/SerialPort. "COM1"))
> 
> > (def device-wrong3 (new com.SerialPort "COM1"))
> 
> >
> 
> > // Compiled by ClojureScript 0.0-2080
> 
> > goog.provide('example.core');
> 
> > goog.require('cljs.core');
> 
> > goog.require('serialport');
> 
> > goog.require('serialport'); // Second added by :as clause in ns :require
> 
> > example.core.com = require("serialport");
> 
> > example.core.device_wrong1 = (new com.SerialPort("COM1"));
> 
> > example.core.SerialPort = example.core.com.SerialPort;
> 
> > example.core.device_correct1 = (new example.core.SerialPort("COM1"));
> 
> > example.core.device_correct2 = (new example.core.com.SerialPort("COM1"));
> 
> > example.core.device_wrong2 = (new com.SerialPort("COM1"));
> 
> > example.core.device_wrong3 = (new com.SerialPort("COM1"));
> 
> >
> 
> > I'm probably missing some basic understandings about the way the 
> > ClojureScript compiler works. What would you do that is idiomatic?
> 
> >
> 
> > --
> 
> > Note that posts from new members are moderated - please be patient with 
> > your first post.
> 
> > ---
> 
> > You received this message because you are subscribed to the Google Groups 
> > "ClojureScript" group.
> 
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to [email protected].
> 
> > To post to this group, send email to [email protected].
> 
> > Visit this group at http://groups.google.com/group/clojurescript.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to