Dijkstra
Well, I’m in the same situation. I cannot program anymore without ending up wanting to set up rules in the system I design.
I have a lot of ideas about using Inform7 in ‘real’ programming projects. This ranges from agent oriented programming, distributed systems and hyperspatial programming (cf IbM’s HyperJ) to meta object and meta-compiler protocols (the latters do not even exist). I won’t expose my ideas here in details, because what I have in mind is insane qnd fuzzy but I can try to sum it up here : as of now inform7 is a meta-language and I’d like to turn it into a middle-language. For instance, that’d imply the possibility to modify the way inform7 is ‘compiled’ using inform7 itself.
Insane, insane…
For now, I’d just like to implement inform7 in objective-c : I don’t mean to rewrite inform7 so that it is translated to objective-c code, but to be able to use inform7 within objective-c (or any other dynamic language, but I’ll stick to objective-c which I know pretty well).
I have already semi-implemented a rule framework in objective-c on top of which I built an aspect-oriented framework (executing code before or after a certain method, and in a non-invasive way). Then I started to program a framework that allows you to do role-oriented programming and last time I was working on this project(s) I was wondering how I could do subject-oriented programming elegantly, that without mutilating objective-c native coding style.
You might think : this guys mad. Well sort of, what I described :
- fits in a couple thousands lines.
- is just a proof of concept, no unit tests, few comments. No documentation.
- the whole stuff relies on the fact objective-c allows you to catch method invocations in order to redirect them.
Is it efficient ?
Well I compared cocoa’s native observer pattern (using the NsNotificationCenter class) to my own observer pattern (I think I built it on top of the aspect-oriented framework I made, or what is the role-oriented one, can’t really remember…) and it turns out mine is around 20% faster (and it has a nasty memory leak I wasn’t able to fix).
Anyway, as cool/insane as it sounds, it has a huge drawback : it looks ugly.
So I was hopping that if I added a bit of Inform7’s magic, that would look better. Since the stuff I described above is entirely dynamic, I was thinking about implementing a parser for Inform7 in objective-c. I don’t think I want to reproduce inform7 in its entirety, just the part that concerns rules.
So here I am, asking questions :
How does NI work ? I know the code is private, but could someone (graham Nelson itself maybe ?) drop the name of the technology/concept it relies on ?
Is there any formalization of the concept of rule around ?
Thank you.