Re: [gnustep/libs-gui] * Source/NSWindow.m (-makeFirstResponder, -sendEvent:): Correct (be12d7b)

2020-05-15 Thread Fred Kiefer



> Am 15.05.2020 um 13:33 schrieb Johannes Brakensiek :
> 
> On 15 May 2020, at 9:30, Fred Kiefer wrote:
> 
> Here we don’t follow this principle and this is dangerous as a view we call 
> this method on may not be as clean as the GNUstep code itself. Patches are 
> welcome :-)
> 
> And why did I write that I „mostly“ agree? I would not follow this advice 
> when the value is completely in our control.
> 
> thank you for your explanation! Just a further question: Would it be safe to 
> just do if([v acceptsFirstMouse: theEvent]) or would that make things worse?

Yes, that would be the right thing to do in that place.

Fred


PS: You signature has expired again.


Re: [gnustep/libs-gui] * Source/NSWindow.m (-makeFirstResponder, -sendEvent:): Correct (be12d7b)

2020-05-15 Thread Johannes Brakensiek
Hi Fred,

On 15 May 2020, at 9:30, Fred Kiefer wrote:

> Here we don’t follow this principle and this is dangerous as a view we call 
> this method on may not be as clean as the GNUstep code itself. Patches are 
> welcome :-)
>
> And why did I write that I „mostly“ agree? I would not follow this advice 
> when the value is completely in our control.

thank you for your explanation! Just a further question: Would it be safe to 
just do ```if([v acceptsFirstMouse: theEvent])``` or would that make things 
worse?

Johannes


smime.p7s
Description: S/MIME digital signature


Re: [gnustep/libs-gui] * Source/NSWindow.m (-makeFirstResponder, -sendEvent:): Correct (be12d7b)

2020-05-15 Thread Fred Kiefer


> Am 15.05.2020 um 08:28 schrieb Johannes Brakensiek :
> 
> I'm new to Objective C, so this is just a question:
> 
> In the NY Times Objective C style guide I am reading:
> 
> Values MUST NOT be compared directly to YES, because YES is defined as 1, and 
> a BOOL in Objective-C is a CHAR type that is 8 bits long (so a value of 
> 1110 will return NO if compared to YES).
> https://github.com/nytimes/objective-c-style-guide
> 
> What do you think of this?

Johannes,

I am replying to the discussion mailing list, as your mail most likely should 
have gone there, replying to a GitHub mail directly makes little sense.

I mostly agree with the style guide you are citing. And I really didn’t know 
that the NY Times was using Objective C, looks like they are even hiring :-) It 
is a shame that there are so few ObjC programmer offerings in Germany.
But back to the topic. This is what is common in all C based programming 
languages and I think Richard is following this principle very strictly in 
GNUstep base. The idea is to be open in what you accept, but strict in what you 
return. As far as I am aware he even makes sure to convert values he gets from 
calls to other methods to YES or NO before returning them. GNUstep qui is not 
that clean in this respect. The one line I just moved in the commit you are 
replying to is an example:

[v acceptsFirstMouse: theEvent] == YES

Here we don’t follow this principle and this is dangerous as a view we call 
this method on may not be as clean as the GNUstep code itself. Patches are 
welcome :-)

And why did I write that I „mostly“ agree? I would not follow this advice when 
the value is completely in our control.

Cheers,
Fred