View mode: basic / threaded / horizontal-split · Log in · Help
May 17, 2004
Re: mixins
Walter wrote:
> "Tony" <talktotony@email.com> wrote in message
> news:c89gd4$19nf$1@digitaldaemon.com...
> 
>>The mixin example overrides the definition of "x" within the function
>>"test()".
>>
>>Doesn't this violate the D rule that a symbol can't be multiply defined
>>within a function?
> 
> That rule is probably going to have to go away :-(

Looks very promising, but it could also cause quite a bit of unexpected 
behavior as the implementation details of a mixin can affect the calling 
function.  I don't suppose there are scope resolution operators to allow 
the caller to specify which instance of x he wants to access?

Sean
May 17, 2004
Re: mixins
Sean Kelly wrote:
>
> Looks very promising, but it could also cause quite a bit of unexpected 
> behavior as the implementation details of a mixin can affect the calling 
> function.

I take it back.  The variable overriding feature pretty much takes care 
of this.

Sean
May 17, 2004
Re: mixins
Great work! Apart from my comments about the general problem that the
untyped compile-time language of D will probably prove to be extremely hard
to debug, I really like this absolutely powerful concept of mixins.

Anybody who knows Sather will realize, that mixins contain the complete
concept of implementation inheritance!

To those unfamiliar with Sather: in that highly interesting language,
inheritance is completely split up into interface inheritance and
implementation inheritance. Interface inheritance is just what we have in D
already. Implementation inheritance is just that kind of parameterized
cut-and-paste operation that mixins allow. Taking both together, it becomes
obvious, that direkt inheritance is not necessary at all any more!

All the problems of multiple-inheritance in C++ come from binding together
the inheritance of the class interface and the implementation of its
routines. As you can easily see in D: neither interfaces nor mixins have
problems with multiple inheritance (resp. inclusion of several mixins into
one class definition)

Conclusion: multiple interface inheritance and mixins taken together are a
complete replacement for the multiple inheritace that was dropped!
May 17, 2004
Re: mixins
This is a great feature for D.

Coming from an enterprise software background, I can tell you that it may
have a lot of use for cross-cutting concerns.  OOP generally puts tight
coupling between a system-level concern and the business logic of an
application, but with mixins, you could theoretically define a solution to a
problem and apply it generically across business classes.  I'll play more
and hopefully post something demonstrating some aspect-oriented programming
techniques with D and mixins.

"Walter" <newshound@digitalmars.com> wrote in message
news:c876sh$10r7$1@digitaldaemon.com...
> I have this mostly implemented. It's been based on a lot of your
> suggestions. The way I did it is, I think, pretty unexplored territory.
That
> means there may be some pretty cool uses for it I've never thought of. Let
> me know what you think, and if I missed the boat completely <g>.
>
> www.digitalmars.com/d/mixin.html
>
>
May 17, 2004
Re: mixins
Greg Vanore wrote:
> 
> Coming from an enterprise software background, I can tell you that it may
> have a lot of use for cross-cutting concerns.  OOP generally puts tight
> coupling between a system-level concern and the business logic of an
> application, but with mixins, you could theoretically define a solution to a
> problem and apply it generically across business classes.  I'll play more
> and hopefully post something demonstrating some aspect-oriented programming
> techniques with D and mixins.

Excellent point.  This may make implementing Aspect Oriented Programming 
in D fairly easy, which is a technique that IMO has tremendous potential.

Sean
May 17, 2004
Re: mixins
I do a lot of GUI programming (in C++ mostly, a little C#) and the first use
that comes to mind for mixins is doing data validation... no code at hand,
sorry, but think of doing an IntValidator, DoubleValidator, RangeValidator
mixins (which would work kinda like MFC's DDX_Validate) and so on, and just
mix 'em into your form class appropriately for each control you'd like to
validate...

> > Walter wrote:
> >
> > > I have this mostly implemented. It's been based on a lot of your
> > > suggestions. The way I did it is, I think, pretty unexplored
territory.
> That
> > > means there may be some pretty cool uses for it I've never thought of.
> Let
> > > me know what you think, and if I missed the boat completely <g>.
> > >
> > > www.digitalmars.com/d/mixin.html
> > >
> > >
> >
> > Oh yeah, forgot to mention: THANKS very much for implementing this! I
> > think this is a kick-ass feature!
>
> You're welcome! Now, I want to see a kick-ass use for this, so I can write
a
> magazine article about it! A use that is cool, not easilly expressed in
> other languages, and so would highlight the capabilities of D.
May 18, 2004
Re: mixins
"Walter" <newshound@digitalmars.com> wrote in message
news:c889f4$2io2$1@digitaldaemon.com...
>
> "Hauke Duden" <H.NS.Duden@gmx.net> wrote in message
> news:c87go0$1f8j$2@digitaldaemon.com...
> > Walter wrote:
> >
> > > I have this mostly implemented. It's been based on a lot of your
> > > suggestions. The way I did it is, I think, pretty unexplored territory.
> That
> > > means there may be some pretty cool uses for it I've never thought of.
> Let
> > > me know what you think, and if I missed the boat completely <g>.
> > >
> > > www.digitalmars.com/d/mixin.html
> > >
> > >
> >
> > Oh yeah, forgot to mention: THANKS very much for implementing this! I
> > think this is a kick-ass feature!
>
> You're welcome! Now, I want to see a kick-ass use for this, so I can write a
> magazine article about it! A use that is cool, not easilly expressed in
> other languages, and so would highlight the capabilities of D.

I've got one of those - and the article half planned - as soon as I have an
implementation that works. ;)
Next ›   Last »
1 2 3 4
Top | Discussion index | About this forum | D home