Closed viebel closed 8 years ago
Uhm, one thing I am worried about is the io (again) here. By using no-op
you are maybe interfering with some underlying mechanism that I will confirm you after some investigation ok?
Thanks for reporting!
Yes I have to check this out
And then again we have this in our test (I did not remember, we should probably refer to check tests before opening issues):
https://github.com/Lambda-X/replumb/blob/master/test/cljs/replumb/macro_test.cljs#L9
With options:
https://github.com/Lambda-X/replumb/blob/master/test/browser/replumb/test_env.cljs#L7
I'm using the same options and it doesn't work. Could you please double check that the tests pass in the browser?
Yes I will, btw all the builds are here, but we execute NodeJS only tests for io related stuff. We should use Korma for browser testing, it was planned but then all the contributors got caught up with other things. PRs as usual would be more than welcome in this case. I can guide you if you want to contribute, just let me know. Thanks!
As you can see we have:
;; ======================================================================
;; Testing with Phantom:
...
Testing replumb.macro-test
(foo.core/hello (+ 2 3))
(hello (+ 2 3))
So they pass with PhantomJS.
in your tests, you use read-eval-call-test
that receives an array of expressions to execute; while in my case, I am passing all the expressions together in a single statement
The issue repos also with eval-str
(cljs/eval-str (cljs/empty-state) "(ns my.hello231$macros) (defmacro hello [x] `(inc ~x)) (my.hello231/hello 13)" "" {:eval cljs/js-eval} identity)
; => {:error #error {:message "ERROR", :data {:tag :cljs/analysis-error}, :cause #object[TypeError TypeError: Cannot read property 'hello' of undefined]}}
It might be a bug with :context :statement
then...
@viebel do you still have this problem?
@arichiardi Yes I still have the problem.
But I think this is by design: I heard David Nolen and Mike Fikes telling a couple of times:
Macros should be defined in a previous compilation stage than their execution
It explains why it returns an error on first execution and it returns the correct result on subsequent executions.
When I define a macro inside a namespace and use it in the same namespace,
read-eval-call
returns an error on first execution and it returns the correct result on subsequent executions.Two remarks:
cljs/eval-str
it works