From: Eduard R. <asp...@ed...> - 2005-04-04 14:30:27
|
Hi, I'm just getting into this whole Aspectoriented Programming thing and tried out a bit of your code to get a feel for it. After using it for a homegrown Assert mechanism with Attributes, I really began to appreciate the ideas and concepts. As much as I liked and applaud the library, there seem to be several issues that aren't resolved and there are given limitations through the C# language. As you've already used ANTLR, I was wondering if it might not be a better idea to develop a C# compiler with some added keywords, that contains "normal" C# as subset and implement the Aspect features into the compiler instead. For one thing certain limitations like having to declare the methods virtual for an IMethodInterceptor could be resolved. For another thing it would also allow for realizing Interceptors for constuctors or maybe for assignments or comparisons. Comments, ideas, etc. appreciated Eduard Ralph |
From: hammett <ha...@uo...> - 2005-04-04 15:04:57
|
Hello Eduard! ----- Original Message ----- From: "Eduard Ralph" <asp...@ed...> > As you've already used ANTLR, I was wondering if it might not be a better > idea to develop a C# compiler with some added keywords, that contains > "normal" C# as subset and implement the Aspect features into the compiler > instead. Wow! That's quite a move, huh? Instead of a compiler we could develop a pre-processor, but then we would need to integrate it with VS.Net and several issues could come afterwards... IMHO it would be best to stick with the dynamic approach, the same used by dynaop. > For one thing certain limitations like having to declare the methods > virtual > for an IMethodInterceptor could be resolved. If you weave the resulting code, then it's true. > For another thing it would also > allow for realizing Interceptors for constuctors or maybe for assignments > or > comparisons. I thought DynProxy would be able to intercept operators.... -- Cheers, hammett http://www.castleproject.org/~hammett |
From: Eduard R. <asp...@ed...> - 2005-04-04 15:49:22
|
Hi hammett > > As you've already used ANTLR, I was wondering if it might not be a better > > idea to develop a C# compiler with some added keywords, that contains > > "normal" C# as subset and implement the Aspect features into the compiler > > instead. > Wow! That's quite a move, huh? Instead of a compiler we could develop a > pre-processor, but then we would need to integrate it with VS.Net and > several issues could come afterwards... The thought had occurred to me to do it over a pre-processor. In my experience that generally ends up being an unhappy solution because you generally have a hard time pinning some of the problems. I once worked with a pre-processor from oracle for embedded SQL in C++ and that was a real dog. That was one of the reasons I dropped that idea early on. AFAIK ANTLR already has a C# compiler, so I was thinking just to use that and extend it. I don't know in what sort of state it is, so that might be more work too, but it would probably save a lot of extra hassle, etc. > IMHO it would be best to stick with the dynamic approach, the same used by > dynaop. I'll admit I've written only a few very small compilers so far (hardly worth the name), so the work one would face is probably more then I would believe. I also see that it would be a shame to loose all the effort invested so far. > > For one thing certain limitations like having to declare the methods > > virtual > > for an IMethodInterceptor could be resolved. > If you weave the resulting code, then it's true. I'll also admit I haven't thought it through in every detail, which is why some input from your side would be great. Like I said, I'm just toying with the idea right now. > > For another thing it would also > > allow for realizing Interceptors for constuctors or maybe for assignments > > or > > comparisons. > I thought DynProxy would be able to intercept operators.... I also haven't looked at your code in detail so my thinking might be going in the wrong way. Unfortunately one can't overload the assignment, nor the new operator (which is why you have this engine-builder thing). That means one would never be able to intercept assignments - at least not the ones from builtin types. Of course that would create some security issues as well (which is why they don't allow it in the first place). The other thing that occurred to me in connection with the issue of security and access restriction: as far as I can tell, I can intercept and mix in my code into any object which was instantiated over the engine. It probably would be sensible to somehow include mechanisms to not allow it under certain circumstances (like when something is sealed, etc) but that might be able to be implemented in the current makeup. An own compiler could just make it slightly easier, that is all. Greets, Eduard |
From: hammett <ha...@uo...> - 2005-04-04 16:28:53
|
----- Original Message ----- From: "Eduard Ralph" <asp...@ed...> > That was one of the reasons I dropped that idea early on. AFAIK ANTLR > already has a C# compiler, so I was thinking just to use that and extend > it. > I don't know in what sort of state it is, so that might be more work too, > but it would probably save a lot of extra hassle, etc. They have a grammar, which is just a small piece of what composes a compiler (lexer and parser). A compiler to C# would take, I don't, maybe a whole year of work... Even if I +1 the proposal, I simply don't have the time/energy to invest on it. Contributions are welcomed, though :-) -- Cheers, hammett http://www.castleproject.org/~hammett |
From: Eduard R. <asp...@ed...> - 2005-04-04 17:03:26
|
Hi, ok, so that means more work then I had anticipated. I thought they had all the parts. Hmm, your right - rewriting a C# compiler would be a major effort. The other thing I looked into was using Mono and just expanding that. But that would mean getting into all the code. Hmmm - we will have to see. > Even if I +1 the proposal, I simply don't have the time/energy to invest on > it. Contributions are welcomed, though :-) So in principle you would say that the approach would be right, but the amount of effort would be an issue. I can understand if you would choose not to get into it. I would be willing to invest the time to build the thing (building a compiler would be interesting to me anyway). If I prove the point and get it far enough, would you or someone else on the list want to chip in some? Here again, contribution welcomed... :-) Greets, Eduard |
From: Rodrigo B. de O. <rod...@gm...> - 2005-04-04 22:48:17
|
1) Get the ANTLR C# parser to construct a boo[1] AST 2) Write AOP custom attributes and pipelines steps so we all (c# and boo users) could benefit from 3) Let the existing pipeline infrastructure deal with all the rest (expression validation, code emission, etc) [1] http://boo.codehaus.org/ On Apr 4, 2005 2:03 PM, Eduard Ralph <asp...@ed...> wrote: > Hi, > > ok, so that means more work then I had anticipated. I thought they had all > the parts. Hmm, your right - rewriting a C# compiler would be a major > effort. The other thing I looked into was using Mono and just expanding > that. But that would mean getting into all the code. > Hmmm - we will have to see. > > > > Even if I +1 the proposal, I simply don't have the time/energy to invest > on > > it. Contributions are welcomed, though :-) > > So in principle you would say that the approach would be right, but the > amount of effort would be an issue. > I can understand if you would choose not to get into it. I would be willing > to invest the time to build the thing (building a compiler would be > interesting to me anyway). If I prove the point and get it far enough, would > you or someone else on the list want to chip in some? Here again, > contribution welcomed... :-) > > Greets, > > Eduard > |