Welcome to Web-News
A Web-based News Reader
Subject mixins rock
From Ben Hinkle <bhinkle4@juno.com>
Date Thu, 09 Sep 2004 22:44:25 -0400
Newsgroups digitalmars.D

Here I thought mixins were a pain but I've been going through mintl and
experimenting with consolidating shared code into mixins and they've been
working great. I'd like to really say thanks to Walter for adding mixins. I
wasn't convinced before but I'm really liking them now. In my sandbox mintl
now has three mixins:
- one for opCat-like functions (6 functions)
- one for opApply overloads and variations (8 functions)
- one for backwards opApply and toSeq variations (5 functions)

They cut way down on the cut-and-paste aspect of mintl that had been
bothering me. It's to the point where there isn't any "boilerplate" code in
the individual containers.

I've found using public mixins to be more successful that using private
mixins. Private symbols seem to trip up mixins. The rules are probably
obvious but I haven't taken the time to figure them out so I've gotten in
the habit of only mixing in public declarations and having the mixins only
reference public symbols.

-Ben

Recent messages in this thread
 
-# mixins rock (Current message) Ben Hinkle 09-Sep-2004 10:44 pm
.-# Re: mixins rock Walter 09-Sep-2004 11:10 pm
.|-# Re: mixins rock Regan Heath 10-Sep-2004 01:19 am
.|||# Re: mixins rock Ben Hinkle 10-Sep-2004 08:09 am
.||\# Re: mixins rock Walter 10-Sep-2004 12:31 pm
.|\# Re: mixins rock Marcello Gnani<ma... 10-Sep-2004 05:46 am
.|# Re: mixins rock Sean Kelly 09-Sep-2004 11:19 pm
.\# Re: mixins rock Ivan Senji 10-Sep-2004 02:41 am