November 01, 2006
Thomas Kuehne wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Kristian schrieb am 2006-11-01:
>> Or if there were 'local object members' for classes, just like in C++. For  example:
>>
>>      class Foo {
>>          Bar m_obj;  //automatically constructed & destroyed with 'Foo'
>>      };
> 
> How about Object.notifyRegister and Object.notifyUnRegister? sample use:
> http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.learn&artnum=5016
> 
> Thomas
> 
> 
> -----BEGIN PGP SIGNATURE-----
> 
> iD8DBQFFSKq/LK5blCcjpWoRAv0VAJ4hvZtQo+wZR64qRsgqlJVs29ZsSQCfe1Dt
> Z9/vZzgRPHl79zJzViJIkMU=
> =9HhU
> -----END PGP SIGNATURE-----

Oh crap I wish I knew about this undocumented feature before. Thank you this could be very useful, at least until weak references are part of the language.

I'll update the thing soon with some minor improvements and then start yet another rewrite / refactoring round.
November 01, 2006
Lutger wrote:
> Thomas Kuehne wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Kristian schrieb am 2006-11-01:
>>> Or if there were 'local object members' for classes, just like in C++. For  example:
>>>
>>>      class Foo {
>>>          Bar m_obj;  //automatically constructed & destroyed with 'Foo'
>>>      };
>>
>> How about Object.notifyRegister and Object.notifyUnRegister? sample use:
>> http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.learn&artnum=5016 
>>
>>
>> Thomas
>>
>>
>> -----BEGIN PGP SIGNATURE-----
>>
>> iD8DBQFFSKq/LK5blCcjpWoRAv0VAJ4hvZtQo+wZR64qRsgqlJVs29ZsSQCfe1Dt
>> Z9/vZzgRPHl79zJzViJIkMU=
>> =9HhU
>> -----END PGP SIGNATURE-----
> 
> Oh crap I wish I knew about this undocumented feature before. Thank you this could be very useful, at least until weak references are part of the language.

It was added in DMD 170-172, so it hasn't been around for long.


Sean
November 01, 2006
Sean Kelly wrote:
> Lutger wrote:
>> Thomas Kuehne wrote:
>>> How about Object.notifyRegister and Object.notifyUnRegister? sample use:
>>> http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.learn&artnum=5016 
>> Oh crap I wish I knew about this undocumented feature before. Thank you this could be very useful, at least until weak references are part of the language.
> 
> It was added in DMD 170-172, so it hasn't been around for long.

It was added to support signals and slots, which will be in the next update. The whole thing then becomes almost trivial (!)
November 01, 2006
Walter Bright wrote:
> Sean Kelly wrote:
>> Lutger wrote:
>>> Thomas Kuehne wrote:
>>>> How about Object.notifyRegister and Object.notifyUnRegister? sample use:
>>>> http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.learn&artnum=5016 
>>>
>>> Oh crap I wish I knew about this undocumented feature before. Thank you this could be very useful, at least until weak references are part of the language.
>>
>> It was added in DMD 170-172, so it hasn't been around for long.
> 
> It was added to support signals and slots, which will be in the next update. The whole thing then becomes almost trivial (!)

You are the man! I have been experimenting with hooking into object destruction by replacing the dtor pointer in the classinfo. I came across the monitor reference today in the ABI docs and have been looking into it - wondering what you are up to. This is Very Cool! Thanks!
November 01, 2006
J Duncan wrote:
> You are the man! I have been experimenting with hooking into object destruction by replacing the dtor pointer in the classinfo.

I looked into that, too, and decided that it was never going to work. Everything I thought of just cost too much memory and runtime for all objects, not just hooked ones.

> I came across the monitor reference today in the ABI docs and have been looking into it - wondering what you are up to. This is Very Cool! Thanks!

I had a flash of inspiration one day that I was trying to hook in the wrong place. Since the monitor is an opaque type, that could be hooked with only a bit of casting, and it wouldn't affect anything else. Best of all, it only costs if it is used, not for the usual case. The monitors even still work with hooked objects.

I didn't like having to tinker around under the hood like that, but it was in a good cause.
November 01, 2006
Walter Bright wrote:
> Sean Kelly wrote:
>> Lutger wrote:
>>> Thomas Kuehne wrote:
>>>> How about Object.notifyRegister and Object.notifyUnRegister? sample use:
>>>> http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.learn&artnum=5016 
>>>
>>> Oh crap I wish I knew about this undocumented feature before. Thank you this could be very useful, at least until weak references are part of the language.
>>
>> It was added in DMD 170-172, so it hasn't been around for long.
> 
> It was added to support signals and slots, which will be in the next update. The whole thing then becomes almost trivial (!)

Now that is great! Didn't expect this so soon, I'll wait until then to see if this lib is still relevant.
Some very useful features are getting into D lately, especially for library development.
November 01, 2006
Walter Bright wrote:
> J Duncan wrote:
>> You are the man! I have been experimenting with hooking into object destruction by replacing the dtor pointer in the classinfo.
> 
> I looked into that, too, and decided that it was never going to work. Everything I thought of just cost too much memory and runtime for all objects, not just hooked ones.

I agree.  Ares allows object destruction in general to be hooked, but it's really more for detecting memory 'leaks' (non-deterministic destruction) and for conditionally special handling of the destruction of certain object types.  While I haven't used the new hooking mechanism yet, it does seem to be the most appropriate solution for signals/slots.

>> I came across the monitor reference today in the ABI docs and have been looking into it - wondering what you are up to. This is Very Cool! Thanks!
> 
> I had a flash of inspiration one day that I was trying to hook in the wrong place. Since the monitor is an opaque type, that could be hooked with only a bit of casting, and it wouldn't affect anything else. Best of all, it only costs if it is used, not for the usual case. The monitors even still work with hooked objects.

Yup, this was definitely a nice way to do it.  And it came with a rewrite of the monitor code to boot :-)  I think the result is cleaner overall than what we had before.


Sean
November 02, 2006
Walter Bright wrote:
> Sean Kelly wrote:
>> Lutger wrote:
>>> Thomas Kuehne wrote:
>>>> How about Object.notifyRegister and Object.notifyUnRegister? sample use:
>>>> http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.learn&artnum=5016 
>>>
>>> Oh crap I wish I knew about this undocumented feature before. Thank you this could be very useful, at least until weak references are part of the language.
>>
>> It was added in DMD 170-172, so it hasn't been around for long.
> 
> It was added to support signals and slots, which will be in the next update. The whole thing then becomes almost trivial (!)

Wow!  Excellent.  Any chance you'll run the API by the newsgroup for feedback before the actual release?

--bb
November 02, 2006
Bill Baxter wrote:
> Wow!  Excellent.  Any chance you'll run the API by the newsgroup for feedback before the actual release?

I'd like to wait a bit first, I'm not ready yet.
1 2
Next ›   Last »