lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On 10-Aug-05, at 3:50 PM, Glenn Maynard wrote:
Well, beauty is in the eye of the beholder :) Many people might prefer
something like:

  synchronized int value;

although that doesn't give you the option of forgetting to use the
locked version :)

This requires specific support from the language itself to implement, and means the compiler itself has to understand locking, compared to the generic
template solution.


Yes, that's true. On the other hand, it means that a compiler aware of concurrency has to do quite a bit of difficult analysis in order to optimise locking, which would have been easier had the declaration been explicit.

You could say the same thing about exceptions, really. Why should the compiler provide specific support when it could be achieved in the standard library (with setjmp and friends)?

The question of which features should be included in a language and which ones should be relegated to library implementation is not easy, and every language draws its own line. Clearly, there are languages which prefer the synchronization declaration, and it appears that there are programmers who are quite happy to use those languages. :)

You can't forget anything if you use a template type that doesn't initialize
from a pointer:

  locked<int> value = 1;
  value = 2;

Yes, again. In which case, the use of the synchronized attribute would have been precisely equivalent, aside from the issue of whether it should be in the compiler, in a standard template library, or even implemented with a preprocessor.

The license doesn't require renaming on modification. I don't think that's a very good restriction, especially given that modifying Lua to suit the
particular needs of a project is actively encouraged.  It wouldn't be
very nice to publically fork Lua and not rename it (confusing), but there's nothing wrong with a project using a heavily modified core and still saying
"we use Lua".

Hmm. I guess I was still thinking of the Lua 4.0 licence.