April 30, 2011
On 30/04/11 8:29 PM, Walter Bright wrote:
> On 4/23/2011 4:43 PM, bearophile wrote:
>> First, they impose a full word of overhead on each and every object,
>> just in
>> case someone somewhere sometime wants to grab a lock on that object.
>> What,
>> you say that you know that nobody outside of your code will ever get a
>> pointer to this object, and that you do your locking elsewhere, and
>> you have
>> a zillion of these objects so you'd like them to take up as little
>> memory as
>> possible? Sorry. You're screwed. [I have not yet understood why D
>> shared this
>> Java design choice.]
>
> The extra pointer slot is a handy place for all kinds of things, not
> just a mutex. Currently, it is also used for the "signals and slots"
> implementation. Andrei and I have discussed using it for a ref counting
> system (though we decided against that for other reasons).

That may be so, but it would be nice if the programmer had control over whether or not they want to use that slot.
May 01, 2011
They kinda already do. Look into how core.mutex works.

Sent from my iPhone

On Apr 30, 2011, at 1:43 PM, Peter Alexander <peter.alexander.au@gmail.com> wrote:

> On 30/04/11 8:29 PM, Walter Bright wrote:
>> On 4/23/2011 4:43 PM, bearophile wrote:
>>> First, they impose a full word of overhead on each and every object,
>>> just in
>>> case someone somewhere sometime wants to grab a lock on that object.
>>> What,
>>> you say that you know that nobody outside of your code will ever get a
>>> pointer to this object, and that you do your locking elsewhere, and
>>> you have
>>> a zillion of these objects so you'd like them to take up as little
>>> memory as
>>> possible? Sorry. You're screwed. [I have not yet understood why D
>>> shared this
>>> Java design choice.]
>> 
>> The extra pointer slot is a handy place for all kinds of things, not just a mutex. Currently, it is also used for the "signals and slots" implementation. Andrei and I have discussed using it for a ref counting system (though we decided against that for other reasons).
> 
> That may be so, but it would be nice if the programmer had control over whether or not they want to use that slot.
1 2
Next ›   Last »