I'm starting to like the hybrid approach as well. We could create a
new version of "require" that's a conditional load:

(cond-require {:platform :jvm :version 7} 'core.platform.jvm.mymodule)
(cond-require {:platform :clr :version 4.5} 'core.platform.clr.mymodule)

With a single modification to core.clj we could then add this to the ns macro:



(ns clojure.core.match
 (:refer-clojure :exclude [compile])
 (:require [clojure.set :as set])
 (:cond-require {:platform :jvm :version 7}
[core.platform.jvm.mymodule :as mymodule])
 (:cond-require {:platform :clr :version 4.5 :arch :x64}
[core.platform.clr.mymodule :as mymodule]))

In this way we kind-of get the best of all worlds. Code is broken out
into seperate files, we can use metadata to give extra platform
specific info to the loading routines, and we don't end up with any
magic strings. Users can organize code however they wish, if someone
wants /src/platform/jvm/foo.clj and someone else wants
/src/jvm/foo/platform/foo.clj they are free to do so.

I guess the only thing I don't like about this is that when porting to
a new platform you can't simply find for .cljclr and copy/modify all
the found files. Instead you have to grep the contents of all .clj
files, and figure out what needs to be done, but if the library
maintainers do their job, that should be eaiser. They can simply put
all platform files in a separate directory

Timothy

-- 
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

Reply via email to