ClojureCLR

Simplify integration of Clojure code with existing .NET code

Details

  • Type: Enhancement Enhancement
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code

Description

It would be nice to have a nice high-level wrapper class for key Clojure integration functions. In IronPython for example, there is a IronPython.Hosting.Python class. For ClojureCLR, I created the attached clojure.lang.Hosting.Clojure class which provides three simple functions Require, GetVar, and AddNamespaceLoadMapping (for integrating .clj files into .NET assemblies as embedded resources). This class or one like it is a simple suggestion to make integration with existing code as painless as possible.

Sample usage:

Clojure.GetVar("clojure.main", "main").invoke(); // Starts an embedded Clojure REPL

This is much simpler than:

Symbol CLOJURE_MAIN = Symbol.intern("clojure.main");
Var REQUIRE = RT.var("clojure.core", "require");
REQUIRE.invoke(CLOJURE_MAIN);
RT.var("clojure.main", "main").invoke().

  1. clojure-hosting.patch
    03/Mar/13 8:16 PM
    3 kB
    Aaron Craelius
  2. clojure-hosting2.patch
    06/Mar/13 8:42 PM
    5 kB
    Aaron Craelius

Activity

Hide
Aaron Craelius added a comment -

This is an updated patch that supercedes the previous patch adds an AddToLoadPath method.

Show
Aaron Craelius added a comment - This is an updated patch that supercedes the previous patch adds an AddToLoadPath method.
Aaron Craelius made changes -
Field Original Value New Value
Attachment clojure-hosting2.patch [ 11896 ]

People

Vote (1)
Watch (0)

Dates

  • Created:
    Updated: