Timothy Baldridge <tbaldri...@gmail.com> writes:

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

Basically, I think to split out platform specific code into their own
namespaces is appropriate and should be encouraged for all the good
reasons you mentioned.  But there might be places where it also had its
drawbacks.

For example, you have a single, rather complex function that uses
platform specific code at various places.  With the cond-require
approach, you have to essentially clone it for each platform.  If the
original version is buggy, all of them are buggy.  If you start
refactoring your design, you'll need to do the same modifications to all
of them.

Alternatively and probably better, you just create wrapper functions for
every occurence of platform specific code, may it only be a constructor
call.  Well, that's a bit against the clojure principle of "don't wrap
your host platform", but probably that principle is becoming out of
fashion at least for libs and programs intended to be run on many
platforms.

Bye,
Tassilo

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