2009/10/15 Manuel Woelker <[email protected]> > > > How about the compiler just loads classes in a SecurityManager context > that > > won't allow some naughtiness like System.exit()? Then you'd get a > > CompilerException caused by ExceptionInInitializerError caused by > > SecurityException rather than have your REPL, IDE, or whatever blow up > from > > code like the above. :) > > Well, that seems like quite a hack. And it still doesn't cover things > like infinite loops (maybe inadvertently). Plus there may well be good > reasons to do certain things in clinit. What if the initializer throws > an exception because of some configuration error? > > As for macros: These must of course be executed during compilation, > that's the whole point of macros anyway. I would consider macros to be > more like "compiler extensions" that happen to live near the code. > > I took a closer look at the relevant methods and it seems like it > should be doable. > > Really looking forward to some feedback >
Manuel, Two more thoughts: 1/ wouldn't your solution limit too heavily the possibilities ? I mean it seems that you think that only defns, defmacros (and maybe defstructs) and macro calls can be done at the top level. But even in the top level of a well behaving namespace, static initializations can occur, some of which may be necessary for the defined macros to work well. 2/ false sense of security: macros too can be buggy (especially when being developed) and contain infinite loops, malicious code, etc. . It would place a false sense of security (concerning the stability of the host compiling environment) to trust macros totally ? HTH, -- Laurent --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---
