Welcome! Please see the About page for a little more info on how this works.

0 votes
in core.async by

There is a fair amount of duplicated code between the Clojure and ClojureScript versions of core.async. Converting the library to use Reader Conditionals would get rid of a lot of code volume and reduce the chances of changes in one library not being correctly implemented in the other. It may also make maintenance and source reading easier by making the platform specific code stick out more, where the 'essence' of core.async stays in pure Clojure. This could also be an opportunity to bring cljs.core.async.macros into the main async namespace using reader conditionals.

Despite these benefits there are a few downsides to this:
Currently the two ports are able to exist fairly separate from each other and the domain experts in each can work on their own part without affecting the other. If this was a concern, more tests may be able to be added to ensure there aren't breakages
Combining the two ports may make it harder to read either version in the same source file.

As this is a fairly large change, I wanted to get feedback on this proposal before going any further.

2 Answers

0 votes

Comment made by: alexmiller

For the time being, we are still supporting Clojure 1.6 with core.async so this is not an option. At some point, that will change, not sure when.

Another aspect here is that reader conditionals are designed for code that is very similar across platforms but the code for clj and cljs is substantially different in many cases, so it is not an obvious candidate. Rather, I would expect to see alternate versions of the same namespace in many cases.

Changing namespaces would also of course break existing users, so we would need to plan ahead for this change.

While I think there is an endpoint with more consolidated code base (and a better build system, which I have been working on), I do not think it's wise for anyone outside the core team to work on it.

0 votes
Reference: https://clojure.atlassian.net/browse/ASYNC-141 (reported by desk@danielcompton.net)