Stefan Tilkov's Random Stuff

A New Generation of Features for Programming Languages

Dare Obasanjo has an interesting post about programming language features, especially with regards to . This does indeed seem rather smart:

Take the following class definition as an example:
    public class Buffer {
       public async Put(string s);
       public string Get() & Put(string s) { return s; }
    }
In the Buffer class a call to the Put() method blocks until a corresponding call to a Get() method is made. Once this happens the parameters to the Put() method are treated as local variable declarations in the Get() method and then the code block runs. Similarly a call to a Get() method blocks until a corresponding Put() method is called. This assumes that each corresponding Put() call has a corresponding Get() call and vice versa.

Comments

On January 10, 2005 2:24 PM, Ashley McNeile said:

FYI: Dare Obasanjo has changed (I assume corrected) the description of the way this class works.

On January 10, 2005 10:41 PM, Stefan Tilkov said:

Thanks for pointing it out …