Bartosz Milewski Missing post

Robert Fraser fraserofthenight at gmail.com
Wed May 27 15:21:45 PDT 2009


Tim Matthews wrote:
> 
> 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.

I think most of Bartoz's readers are C++ users. The "I will use syntax 
similar to that of the D programming language" was probably put there in 
a first draft and after revision it was changed to more C++y example 
code, but the sentence wasn't removed.



More information about the Digitalmars-d mailing list