Bartosz Milewski Missing post
Tim Matthews
tim.matthews7 at gmail.com
Wed May 27 14:19:09 PDT 2009
This may seem slightly OT but in your blog "I will use syntax similar to
that of the D programming language, but C++ and Java programmers
shouldn’t have problems following it."
class MVar<T> {
private:
T _msg;
bool _full;
public:
// put: asynchronous (non-blocking)
// Precondition: MVar must be empty
void put(T msg) {
assert (!_full);
_msg := msg; // move
_full = true;
notify();
}
// take: If empty, blocks until full.
// Removes the message and switches state to empty
T take() {
while (!_full)
wait();
_full = false;
return := _msg;
}
}
auto mVar = new MVar<owner::self, int>;
Why not MVar!(owner::self, int)? Why go back to ambiguous templates?
Apart from the move operator it looks like c++ to me. Sorry if this
doesn't make sense but I've missed a few previous posts.
More information about the Digitalmars-d
mailing list