The Next Mainstream Programming Language: A Game Developer?s Perspective

"Rémy J. A. Mouëza" ray.jay.ay.moueza at do.not.spam.gmail.com
Thu Aug 24 01:56:44 PDT 2006


John Demme a écrit :
> Here's another thought:
> D's in and out function blocks are great, but could we get some
> automagically generated stuff?  For instance,
> void foo(notnull Object o){}
> would automatically put an assert(o) in the in block.  Better yet, what
> about some way to genericize that, so we could have something like in block
> mixins?
> template LessThan(A,B) {
>         in {
>                 assert(A < B);
>         }
> }
> template NotNull(O) {
>         in {
>                 assert(O);
>         }
> }
> void var(Object o, int i, int j) LessThan!(i,j), NotNull!(o) {
>         //o won't be null, and i is less than j!
> }
> 
> 
> I dunno if any of these are decent ideas, but the above slides sparked some
> ideas and real thought about some cool features, and I figured I might as
> well throw some of them out there as food for thought....

These are decent ideas.
In some ways, this looks like aspect oriented programming. LessThan is 
an aspect, the « in » block code is an advice of that aspect, void var ( 
Object, int, int ) is a joinpoint. What we're looking for is a way to 
weave the aspect in D code. However using aspect oriented programming 
for something no more complex than a contract definition is like using a 
rocket launcher to kill a fly.
In the presentation, Tim writes that sometimes developpers need to 
change a framework's base classes. In this situation, aspect oriented 
programming would allow to define totally and exclusively all the 
changes in a separate module and avoid to mess up with the framework's code.


> Real point of the post, I guess:
> 
> Clearly some (err.. all) of these thoughts are quarter-baked, extreme ideas,
> so I what I'm saying is that I'd like to get D 1.0 out there so we can move
> on to some really innovative and extreme features....  D's pretty great as
> is, but it's not the quantum leap forward needed to really assist
> programmers with new challenges; it's got some really great potential to
> get there, though.
> 

I agree.



More information about the Digitalmars-d mailing list