ClojureScript

Conditional compilation (or reading)

Details

  • Type: Enhancement Enhancement
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code and Test
  • Approval:
    Vetted

Description

As people start trying to write libs that are portable between Clojure and ClojureScript they might need to have a bit of branching on target. N.B. supporting this means a change to Clojure, although it has general utility there as well.

Consider CL #+ #- reader macros - http://www.lispworks.com/documentation/lw50/CLHS/Body/02_dhq.htm

Activity

Hide
Roman Scherer added a comment -

The following patches include an implementation of Common Lisp's #+
and #- reader macros to allow conditional compilation/reading for
Clojure and ClojureScript.

The patches add a dynamic variable called features to the
clojure.core and cljs.core namespaces, that should contain the
supported features of the platform in question as keywords.

Unlike in Common Lisp, the variable is a Clojure set and not a list.
In Clojure the set contains at the moment the :clojure keyword, and in
ClojureScript the :clojurescript keyword.

I would like to get feedback on the names that are added to this
variable. Are those ok? Is :jvm for Clojure and :js for ClojureScript
better? Should ClojureScript add something like :rhino, :v8 or
:browser as well?

To run the ClojureScript tests, drop a JAR named "clojure.jar" that
has the Clojure patch applied into ClojureScript's lib directory.

Show
Roman Scherer added a comment - The following patches include an implementation of Common Lisp's #+ and #- reader macros to allow conditional compilation/reading for Clojure and ClojureScript. The patches add a dynamic variable called features to the clojure.core and cljs.core namespaces, that should contain the supported features of the platform in question as keywords. Unlike in Common Lisp, the variable is a Clojure set and not a list. In Clojure the set contains at the moment the :clojure keyword, and in ClojureScript the :clojurescript keyword. I would like to get feedback on the names that are added to this variable. Are those ok? Is :jvm for Clojure and :js for ClojureScript better? Should ClojureScript add something like :rhino, :v8 or :browser as well? To run the ClojureScript tests, drop a JAR named "clojure.jar" that has the Clojure patch applied into ClojureScript's lib directory.
Roman Scherer made changes -
Field Original Value New Value
Attachment conditional-compilation-clojurescript.diff [ 11386 ]
Attachment conditional-compilation-clojure.diff [ 11385 ]
Roman Scherer made changes -
Attachment conditional-compilation-clojurescript.diff [ 11386 ]
Roman Scherer made changes -
Attachment conditional-compilation-clojure.diff [ 11385 ]
Roman Scherer made changes -
Hide
David Nolen added a comment -

This is an enhancement so it probably requires a design page and extended discussion before it will go anywhere. Until that happens I'm marking this is as low priority.

Show
David Nolen added a comment - This is an enhancement so it probably requires a design page and extended discussion before it will go anywhere. Until that happens I'm marking this is as low priority.
David Nolen made changes -
Priority Major [ 3 ] Minor [ 4 ]
Hide
Roman Scherer added a comment -

Ok. If someone could give me write access to the Clojure Dev Wiki I would be happy to start such a design page.

Show
Roman Scherer added a comment - Ok. If someone could give me write access to the Clojure Dev Wiki I would be happy to start such a design page.
Hide
David Nolen added a comment -

If you've sent in your CA request permissions on the clojure-dev mailing list.

Show
David Nolen added a comment - If you've sent in your CA request permissions on the clojure-dev mailing list.
Hide
Roman Scherer added a comment -

I started a design page for this ticket in the Clojure Dev wiki:
http://dev.clojure.org/display/design/Feature+Expressions

Show
Roman Scherer added a comment - I started a design page for this ticket in the Clojure Dev wiki: http://dev.clojure.org/display/design/Feature+Expressions
Stuart Halloway made changes -
Patch Code and Test [ 10002 ]
Approval Vetted [ 10003 ]
Priority Minor [ 4 ] Major [ 3 ]
Hide
Stuart Halloway added a comment -

Posting my comments over on the design page...

Show
Stuart Halloway added a comment - Posting my comments over on the design page...

People

Vote (10)
Watch (7)

Dates

  • Created:
    Updated: