function interface design and namespaces
Open672050ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 23 years ago
Descriptionplain2003-01-21 21:10:10
The programming interface for the thread package consists of
several functions that are grouped into a few namespaces. A lot of
functions have got a parameter/argument that specifies a
subcommand at the first position.
How do you think about the
following suggestion?
I would like to try an interface design like
that:
Examples...
1. thread::mutex lock
instead of
thread::mutex::lock
2. thread::cond::create
instead
of
thread::cond create
3. tsv::array::names
instead
of
tsv::array names
Does the increased use of
namespace functions make a valuable difference in speed and
maintenance?
Is it a step nearer to an object oriented TCL class
library for thread programming?
nobodyplain2003-01-22 15:32:30
Logged In: NO I have nothing against that. It will however yield no speed imporvements. Ok, the maintenance might be simpler. The ideal OO-like approach would be: set mutex [thread::mutex new] $mutex lock But, this would defeat the byte-compiler and impose speed limits. Also, since the "$mutex" command will then be limited to single interpreter, you'd loose the transparency of the item (in this case the mutex) among threads, so it will even more complicate the matter. Therefore, this is the approach I've dropped from further considerations. Which leaves us with your proposed change. As I said, I see no real problems in that. Zoran
dkfplain2003-10-15 22:05:15
Logged In: YES user_id=79902 What about leveraging TIP#112 in Tcl 8.5?
elfringplain2003-10-16 15:22:01
Logged In: YES user_id=572001 TIP #112: Ensembles are Namespaces are Commands http://www.tcl.tk/cgi-bin/tct/tip/112.html This will be an useful interface for the threads library, too.
Log in (anonymous is fine) to add a comment.