Re: blocks and id

2012-12-16 Thread Andreas Grosam
On 15.12.2012, at 01:44, Uli Kusterer wrote: > > On 15.12.2012, at 01:38, Uli Kusterer wrote: > >> On 12.12.2012, at 10:03, Andreas Grosam wrote: >>> How can I check at runtime whether an object (id) is actually a block, and >>> not another kind of object? >> >> Not a good idea. What are yo

Re: blocks and id

2012-12-14 Thread Uli Kusterer
On 15.12.2012, at 01:38, Uli Kusterer wrote: > On 12.12.2012, at 10:03, Andreas Grosam wrote: >> How can I check at runtime whether an object (id) is actually a block, and >> not another kind of object? > > Not a good idea. What are you really trying to do? Here's a few common cases > and su

Re: blocks and id

2012-12-14 Thread Uli Kusterer
On 12.12.2012, at 10:03, Andreas Grosam wrote: > How can I check at runtime whether an object (id) is actually a block, and > not another kind of object? Not a good idea. What are you really trying to do? Here's a few common cases and suggestions on how to do it better, and why: 1) Serializin

Re: blocks and id

2012-12-12 Thread Jens Alfke
On Dec 12, 2012, at 5:24 AM, Andreas Grosam wrote: > And, it can be a block as well, where the block is responsible to feed the > consumer (the id) with data when it has bytes > available when the request is active. > You can do this with the same method, same API. Well, it MUST, otherwise the

Re: blocks and id

2012-12-12 Thread Mike Abdullah
On 12 Dec 2012, at 14:14, Jean Suisse wrote: > On 12 déc. 2012, at 13:02, Mike Abdullah wrote: > >> Why does your code care if some unknown object is a block? This is a strong >> sign of a bad design. > > > As far as I am concerned, I can think of at least two or three legitimate > reasons

Re: blocks and id

2012-12-12 Thread Jean Suisse
On 12 déc. 2012, at 13:02, Mike Abdullah wrote: > Why does your code care if some unknown object is a block? This is a strong > sign of a bad design. As far as I am concerned, I can think of at least two or three legitimate reasons to care wether an unidentified object is a block or not. But

Re: blocks and id

2012-12-12 Thread Mike Abdullah
On 12 Dec 2012, at 13:24, Andreas Grosam wrote: > > On 12.12.2012, at 13:02, Mike Abdullah wrote: > >> >> On 12 Dec 2012, at 09:57, Andreas Grosam wrote: >> >> Why does your code care if some unknown object is a block? This is a strong >> sign of a bad design. > > Oh, then a lot of common C

Re: blocks and id

2012-12-12 Thread Andreas Grosam
On 12.12.2012, at 13:02, Mike Abdullah wrote: > > On 12 Dec 2012, at 09:57, Andreas Grosam wrote: > > Why does your code care if some unknown object is a block? This is a strong > sign of a bad design. Oh, then a lot of common Cocoa patters like dug typing and the usage -respondsToSelector:,

Re: blocks and id

2012-12-12 Thread Mike Abdullah
On 12 Dec 2012, at 09:57, Andreas Grosam wrote: > > On 12.12.2012, at 10:19, Charles Srstka wrote: > >> On Dec 12, 2012, at 3:03 AM, Andreas Grosam wrote: >> >>> How can I check at runtime whether an object (id) is actually a block, and >>> not another kind of object? >> >> I don't think th

Re: blocks and id

2012-12-12 Thread Gwynne Raskind
On Dec 12, 2012, at 6:36 AM, jonat...@mugginsoft.com wrote: > On 12 Dec 2012, at 09:57, Andreas Grosam wrote: >> On 12.12.2012, at 10:19, Charles Srstka wrote: >>> On Dec 12, 2012, at 3:03 AM, Andreas Grosam wrote: >>> How can I check at runtime whether an object (id) is actually a block, a

Re: blocks and id

2012-12-12 Thread Andreas Grosam
On 12.12.2012, at 12:36, jonat...@mugginsoft.com wrote: > You could perhaps make this a little less fragile. > >typedef void (^MyBlockType)(void); > >// we know this is a block >void (^isaBlock)(void) = ^(void) {}; > >MyBlockType aBlock = ^(void) {NSLog(@"I am a block");}; > >

Re: blocks and id

2012-12-12 Thread jonat...@mugginsoft.com
On 12 Dec 2012, at 09:57, Andreas Grosam wrote: > > On 12.12.2012, at 10:19, Charles Srstka wrote: > >> On Dec 12, 2012, at 3:03 AM, Andreas Grosam wrote: >> >>> How can I check at runtime whether an object (id) is actually a block, and >>> not another kind of object? >> >> I don't think t

Re: blocks and id

2012-12-12 Thread Andreas Grosam
On 12.12.2012, at 10:19, Charles Srstka wrote: > On Dec 12, 2012, at 3:03 AM, Andreas Grosam wrote: > >> How can I check at runtime whether an object (id) is actually a block, and >> not another kind of object? > > I don't think there's any good way of doing that right now. You could check >

Re: blocks and id

2012-12-12 Thread Charles Srstka
On Dec 12, 2012, at 3:03 AM, Andreas Grosam wrote: > How can I check at runtime whether an object (id) is actually a block, and > not another kind of object? I don't think there's any good way of doing that right now. You could check the class of the block, but since the block classes are comp

blocks and id

2012-12-12 Thread Andreas Grosam
How can I check at runtime whether an object (id) is actually a block, and not another kind of object? Andreas ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the