ClojureCLR 1.5.1 compiler problem

97 views
Skip to first unread message

Brian Barnes

unread,
Nov 26, 2013, 9:03:53 AM11/26/13
to clo...@googlegroups.com
I'm not sure this is the correct place for this, but the GitHub page led me to this place.
 
I believe I have found a problem in the 1.5.1 ClojureCLR currently on GitHub. The problem is with the initialization of the static Compiler class.
 
According to section 10.4.5.1 of the MSDN documentation, the fields of a static class are evaluated "in textual order".
 
Unfortunately, this line:
 
public static readonly Symbol FnOnceSym = (Symbol) Symbol.intern("fn*").withMeta(RT.map(Keyword.intern(null, "once"), true));
 
 
comes before this line:
 
static Dictionary<String, Type> _duplicateTypeMap = new Dictionary<string, Type>();
 
The evaluation of the first causes a call to the static method FindDuplicateType() within the same class, and this method uses the _duplicateTypeMap without a null check. This causes a null exception to be thrown because the initializer for _duplicateTypeMap hasn't executed yet.
 
My solution is to add a section at the very top of the Compiler class for "dependency" intializations - consisiting only of the initialization of _duplicateTypeMap at this point, to give a home to all such initializations that get used by the other static initializers.
 
There is no "Issues" section on the GitHub page, or I would have logged an issue there. Please let me know the best way to get this issue evaluated for a future release of the compiler.
 
Brian C. Barnes
 

dmiller

unread,
Nov 26, 2013, 1:33:20 PM11/26/13
to clo...@googlegroups.com
I guess it doesn't matter that it works fine for me if it doesn't for you. :)
I'll post an issue.
Along with many other Clojure projects, issues and related items are on the JIRA site under dev.clojure.org.
For ClojureCLR, that is at http://dev.clojure.org/jira/browse/CLJCLR

-David

Brian Barnes

unread,
Nov 27, 2013, 8:52:58 AM11/27/13
to clo...@googlegroups.com
It worked fine for me as well for a long time. Then I started playing with the vsClojure extension, and added a build task extension to compile projects internally without using Clojure.Compile.exe (for better control) that consists of code almost identical to the code in the 'main' function of Clojure.Compile, and that's when I started seeing this. Perhaps I'm missing some extra bit of initialization?
 
Brian.
 
Reply all
Reply to author
Forward
0 new messages