Hi all,

In the interest of Clojure & ClojureScript interop, I'd like to break down 
the discussion for dev.clojure.org/display/design/Feature+Expressions into 
two parts: 1) The potential syntax changes or core macro additions and 2) 
the underlying data source that would allow for conditional compilation. I 
believe that #2 is a prerequisite for any work on #1 and frees up the 
option for conditional compilation macros as a library before a decision is 
made regarding #1.

Currently, all we've got is *clojure-version*, which looks like {:major 1, 
:minor 5, :incremental 0, :qualifier nil}

Here's a first cut at the minimal information that I think we should have 
access to:

   - Language dialect and version
   - Compiler name and version
   - Host platform with version
   - Operating System with version
   - System/CPU architecture

Here's some examples of availability of this information in other languages:

   - 
   
http://docs.oracle.com/javase/6/docs/api/java/lang/System.html#getProperties()
   - http://docs.python.org/2/library/platform.html
   - ruby -e 'require "rbconfig"; require "pp"; pp RbConfig::CONFIG'
   - http://docs.racket-lang.org/reference/runtime.html
   - Haskell seems to rely on C preprocessor macros

I'm interested in hearing opinions on how exactly this data should be made 
available. My initial thought was that it makes sense to store all of this 
information in a single dynamic var as a map EDN structure. 
clojure.core/*config* maybe. I'd like the data organized in such a way to 
make common conditional compilation predicates easy, so it might make sense 
to have a :features key with a set of flags as a value.

One interesting thing to consider is stratified environments like 
ClojureScript. I think that this information is primarily relevant to 
conditional compilation, and so need not be available to the ClojureScript 
runtime, only it's compiler. There is other information that may be 
relevant to ClojureScript at runtime, such as the 
User-Agent: 
http://docs.closure-library.googlecode.com/git/namespace_goog_userAgent.html 
-- We might want to consider storing this information in two vars instead 
of one, maybe something like *compiler-config* and *runtime-config*.

Please let me know your thoughts on this, especially if you have experience 
writing portable code in other languages. For now, let's focus the 
discussion on the data, instead of the syntax or similar. However, it's 
definitely worth discussing potential predicates & switching on that data.

Let me know if people think I should take a shot at designing a schema or 
example config map.

Cheers,
Brandon

-- 
-- 
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/groups/opt_out.


Reply via email to