Clojurians
#cljs-dev
<
2016-03-04
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

mfikes00:03:26

Evidently, there is no need to build macro towers in bootstrap. If this is true, it would be huge for the desired consistency between bootstrap and JVM ClojureScript. In short, it means that a macro can call a macro in the same namespace (we can relax the staging rules). I know empirically that it works with Planck and with Replumb (via Elbow). I think the underlying technical reason it works is perhaps related to the fact that (cljs.core$macros/inc 3) happens to work as a macro invocation. I don’t want to actually claim that we can relax the rules, but here is the gist that works: https://gist.github.com/mfikes/4e39c29c668e21f1bb71

mfikes01:03:40

By the way, I suspect we couldn’t see this until relatively recently (mid-Jan), owing to it needing syntax-quote working.

mfikes13:03:22

Actually, looking into the above a little more, it is abiding the staging rules, owing to the way macroexpansion works. If you instead have either a function that calls a macro, or a macro that calls a macro during expansion as opposed to expanding to a macro call, then you violate the staging rules. TL;DR: The above is valid, plays by the rules, and it doesn’t imply any rules can be relaxed.

spinningtopsofdoom17:03:00

@mfikes for CLJS-1587 #{1 '1} translates the items to (1 (quote 1)) in clojure and (1 1) for ClojureScript.

spinningtopsofdoom17:03:36

So the checks for distinctness (= (count (into #{} items)) (count items)))passes in Clojure. Is there a good way to flatten out (quote x) from a seq?

richiardiandrea17:03:16

can't you use distinct? sorry don't know the problem at end, just suggesting :smile:

spinningtopsofdoom17:03:29

Nope the sequence is (list 1 (list 'quote 1)) when distinctness is tested but gets turned into (list 1 1) when getting turned into JavaScript

richiardiandrea17:03:58

oh now is clear yes

richiardiandrea17:03:25

I don't know how to help you with that, and filtering the quote forms seems a bad workaround

mfikes20:03:58

@spinningtopsofdoom There is a bit of discussion going on in #C06E3HYPR on literals and duplicate checks

spinningtopsofdoom20:03:44

It can be fixed by adding (-> item :env :quoted? not) to the (= (:op item) :constant) check that happens for the on the item's ast

spinningtopsofdoom20:03:19

so that any quoted item uses fromArray instead of building a literal PersistentArrayMap with duplicate keys