FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Channel and templates

 
Post new topic   Reply to topic     Forum Index -> Concurrent
View previous topic :: View next topic  
Author Message
BenHinkle



Joined: 27 Mar 2004
Posts: 76

PostPosted: Tue May 04, 2004 6:04 pm    Post subject: Channel and templates Reply with quote

I don't know if Mike's going to be reading this or not, but here goes...

Mike's Channel port at http://www.csis.gvsu.edu/~swietonm/concurrent.tar.bz2 uses templates and he asked if this is a good idea or not.

It sounds ok to me but I think the generic version should be called something like TChannel and the Object versions should be aliased to Channel. So users who just want to put/take Objects can declare
Channel x = ...
and users who want more control can declare
TChannel!(my_data_structure) x = ...
Back to top
View user's profile Send private message
swieton



Joined: 05 May 2004
Posts: 1

PostPosted: Wed May 05, 2004 5:09 pm    Post subject: Type-safety versus easy use Reply with quote

First off, I noticed I had some inconsistancies in argument order in the new API, so that will definitely change.

Anyway, the advantage of templates is type-safety. The disadvantage of templates is that the code should support variables with value semantics (primitives, etc), which means no more 'just return null'-style reporting, which is why I moved to returning booleans and using out parameters.

I'm not sure I like the change, because it makes it hard to use. Now, I *do* like the idea of using templates to restrict the types. I am somewhat tempted to have a templated version that only allows reference types that follows Doug's API more faithfully, and maybe keeping a second version that's more generic.

An alias could be made to Channel!(Object) for a Java-style channel.

Thoughts?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Concurrent All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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