<< Back to previous view

[CLJCLR-11] Simplify integration of Clojure code with existing .NET code Created: 03/Mar/13  Updated: 06/Mar/13

Status: Open
Project: ClojureCLR
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Minor
Reporter: Aaron Craelius Assignee: David Miller
Resolution: Unresolved Votes: 1
Labels: None

Attachments: Text File clojure-hosting2.patch     Text File clojure-hosting.patch    
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().



 Comments   
Comment by Aaron Craelius [ 06/Mar/13 8:42 PM ]

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

Generated at Wed Jul 23 10:27:15 CDT 2014 using JIRA 4.4#649-r158309.