I can't reply to the thread on the Dev list, but here's my take.

Unless I'm missing something, it seems to me that most these issues could 
be resolved by having a dynamic var that gets set during macro expansion 
according to the target platform.  For instance, *compiler-target* is set 
to :clj or :cljs, depending on whether we're compiler for the JVM or 
Javascript.  If we want to be a little more sophisticated, *compiler-target* 
could 
be a set whose members are the same keywords that were "active" at 
read-time.  That would have the additional convenience that 
*compiler-target* would act as a predicate, indicating whether a particular 
"feature" is available for the target platform.

Then if a macro needs to be expanded in a certain way for certain 
platforms, it can just consult *compiler-target*.

Anyway, that's my 2-cents.

Nathan Davis


On Sunday, May 22, 2016 at 5:57:14 PM UTC-5, Herwig Hochleitner wrote:
>
> This thread just came up, while I was in the process of composing a mail 
> on this topic to clojure-dev: 
> https://groups.google.com/d/msg/clojure-dev/f6ULUVokXrU/3uue5okSAgAJ
>
> 2016-05-20 23:22 GMT+02:00 Dan Burton <danburt...@gmail.com <javascript:>>
> :
>
>> What about something like
>>
>> (def obj #?(:clj Object :cljs js/Object))
>>
>
> Unfortunately, doesn't work for cases, where you need to generate 
> different syntax, eg `(try .. (catch Throwable e ...))` vs `(try ... (catch 
> :default e ...))`.
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to