View previous topic :: View next topic |
Author |
Message |
pragma
Joined: 28 May 2004 Posts: 607 Location: Washington, DC
|
Posted: Mon Aug 30, 2004 7:21 pm Post subject: Re: my 2c... |
|
|
regan wrote: |
in the above you can use the class as 'auto' so making it a class is perhaps the best approach. I think you could do other cool things with a class like storing a list of methods loaded from the library, perhaps with an AA?
|
It's funny you mention that. Take a look here: http://svn.dsource.org/svn/projects/dsp/trunk/misc/typeLibrary.d
Keep in mind that the Library base class in this case could be meshed with the LibraryCache type (same SVN directory) while keeping it pretty transparent to the user. This *could* have been done with free functions in D, but then I'd loose the ability to work with the callback lists (events) in the Library class.
I guess what I'm getting at is that I agree with many of you that going with one overall library type (classes vs functions) is very dependent on wether or not state is maintained as a free function setup is a degenerate case of a simple class. Overall, it really comes down to a matter of style and utilty, which is stacked squarely on top of that notion.
Quote: |
I don't think choosing OO or non OO is the path to take but rather to choose the best approach per situation/module. If it can be done best as free functions, then do it that way, you can always add a additional class wrapper for those who want pure OO. The best of both worlds IMO.
|
I couldn't agree more. _________________ -- !Eric.t.Anderton at gmail |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|