On Thursday, 15 October 2015 at 10:11:06 UTC, Andrei Alexandrescu wrote:
On 10/13/15 10:05 PM, Dicebot wrote:
On Tuesday, 13 October 2015 at 18:28:23 UTC, Marco Leise wrote:
Guys, sorry to break into your wishful thinking, but

   synchronized(mutex) {}

already works as you want it to since as long as I can think. Yes, it
takes a parameter, yes it calls lock/unlock on the mutex. :)

Yes, and I am saying that it doesn't justify presence of `synchronized` keyword in the language at all, being historical legacy misfeature.

For a while we were of the opinion that we should let "synchronized" and "shared" be and move on with alternative features. Now we believe an incomplete language definition is damaging the language as a whole so we better make them fully defined and useful within their charter.

Lock-based synchronization has plenty of good uses and the scope locking defined by "synchronized" covers a large useful subset of it. We need to make it usable safely and without contortions, and this particular PR is a step along that way.

It's not a huge priority but since Andrej has only done the work, the main concern left is breakage of existing code, albeit much of that is incorrect or unnecessarily unsafe.

Unless we're going to decide to get rid of synchronized in favor of just using mutexes and guards/autolocks like you would in C++, I think that it's pretty clear that this change is an improvement. And it's what TDPL has said for something like 5 years now. So, in theory, it's publicly been the plan for some time.

- Jonathan M Davis

Reply via email to