Re: [Obj-C] if (self) vs. if (self != nil)
If you use double parentheses, you won’t get the warning: if ((self = [super init])) { } ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: ObjC's flat and all-exported namespace, help!
On 10/11/2011, at 12:04 PM, Ian Joyner wrote: It's the old I have a hammer so everything looks like a nail, but in C++'s case it's I have a programming language, so everything gets put in that. We really need to get away from that kind of thinking about programming languages and get back towards the Smalltalk ideal. Objective-C does that, which makes it the nicest flavour of C. The programming community needs to learn what the phrase 'separation of concerns' really means. Hear hear! Sure, Objective C exposes a lot of internals for those who are looking for it. So does any language to somebody with a good debugger. Don’t think you’re safe if you program in C or C++. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: ObjC's flat and all-exported namespace, help!
.. so if you prefix all your classes with your company name, the only conflicts will be with the same class from different bundles, which means that only one instance of any class will be loaded, thus saving memory on every client’s machine… Yes? On 09/11/2011, at 7:14 PM, Andy O'Meara wrote: Unfortunately the problem is that when you sell and ship commercial software, shipped software can't look into the future. The real aspect of this issue, that I raised in my initial post, is that third party developers such as ourselves internally reuse various support classes for multiple bundle products, so when the host loads our products this issue surfaces. And yes, this thread does belong on the objC list and will be moving it there (I didn't realize there was a objC list when I originally posted). On Nov 9, 2011, at 12:08 AM, Karl Goiser wrote: I think there is another solution that doesn’t involve making the language more complicated: I would complain to the suppliers of the bundles with conflicting class names. They know they are delivering into an environment with a flat namespace. It is up to them to defend against this sort of problem. It’s their fault that this problem is occurring. Karl ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/andrew.omeara%40soundspectrum.com This email sent to andrew.ome...@soundspectrum.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: ObjC's flat and all-exported namespace, help!
Your first option looks better to me! :-) All I’m saying is that Objective C is a very mature language now and if it has been able to get by without adding this extra layer of complexity, why introduce it for an edge case to address a situation where people are expecting it to act like C++? Apple, after all is all about being simple and clean, and its language of choice should reflect that because, after all, it’s the developers who create the simple and clean. In my opinion, Objective C is an embodiment of the Apple attitude. My favourite saying of all time is, “to a person with a hammer, everything looks like a nail.” Objective C is a screw, and you use a screwdriver on it, nor a hammer. As far as versioning issues from the same class in two bundles is concerned, if the class works to spec, there’s no problem. If it doesn’t, that’s a bug, and wouldn’t the bundles have to be updated anyway? Karl ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: ObjC's flat and all-exported namespace, help!
I think there is another solution that doesn’t involve making the language more complicated: I would complain to the suppliers of the bundles with conflicting class names. They know they are delivering into an environment with a flat namespace. It is up to them to defend against this sort of problem. It’s their fault that this problem is occurring. Karl ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: ARC and Singletons
Yes they are. They are a kludge that came about because C++ doesn’t implement object behaviour properly. Try this: http://www.google.com/search?hl=enq=Singleton%2Bevil You have not said what about NSFileManager is a great example of the singleton pattern. Of course class methods have their purposes: lots of them! Normally, not even a class method is allowed to break encapsulation. What I think you mean is that a class method sets class properties that all instances of that class refer to.. Of course, class methods aren’t a replacement for the singleton pattern: the singleton pattern is a fix for inadequately designed languages. Karl On 02/08/2011, at 2:02 PM, Kyle Sluder wrote: On Mon, Aug 1, 2011 at 7:14 PM, Karl Goiser li...@goiser.com wrote: Wow, class methods finally get the tick of approval! Only 30+ years after being specified in the Smalltalk standard.. Forget about singletons: they are just a workaround for not having class methods/variables. No, they're not. I mentioned the NSFileManager example above; that was a great example of how the singleton pattern is more flexible than using class methods for the same task. Class methods have their purpose. Cocoa and Cocoa Touch use them to great effect in places like +[UIView setAnimationsEnabled:], where the method logically applies to instances of that class. They help maintain encapsulation, since they are defined inside the class and therefore, following typical good design principles, are allowed to peek behind the public veil of instances. But class methods aren't a replacement for the singleton pattern. Even if we had class storage (which in practice would be no different from static global variables except for scope), class methods would still be appropriate for a different set of tasks. I wouldn't hold my breath waiting for Apple or anyone else to drop the singleton pattern and adopt class methods. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: ARC and Singletons
Hi Greg, Is that wishful thinking or a hint about the future? :-) All I have to say is: yes please!! Regards, Karl On 03/08/2011, at 5:43 AM, Greg Parker wrote: On Aug 1, 2011, at 9:02 PM, Kyle Sluder wrote: if we had class storage (which in practice would be no different from static global variables except for scope), class methods would still be appropriate for a different set of tasks. Not necessarily. Class variables could be defined differently from global variables. If a class variable were defined in the natural way, as an instance variable for the class instance described by the metaclass, then class variables would be inherited in the same way that instance variables are. A subclass object would have its own copy of its superclass's variables, just like a subclass instance object has its own copy of its superclass instance's variables. -- Greg Parker gpar...@apple.com Runtime Wrangler ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: ARC and Singletons
Wow, class methods finally get the tick of approval! Only 30+ years after being specified in the Smalltalk standard.. Forget about singletons: they are just a workaround for not having class methods/variables. Each class is a single object that exists for the life of the application therefore it is, by definition a singleton - and you get it for free! You don’t need to keep and manage variables pointing to the class because you already have it when you send a message to a class method. Karl ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Does anyone else dislike Xcode 4?
How many debugger windows/panes do you want open at a time? I can tell you how many I want and need: 1. I can only debug one app, why should I have 7? All interfering with my editing? I have tabs containing the current set of files that I am editing. Every one of them has an open debugger pane in it… So, I tried the trick with behaviours, assigning debugging to a special tab. Sure it seems to work, but it doesn’t. I still get debugger panes crowding out my editing windows. Worse, I might be editing a file on the far left tab. When I do a test run, it switches to the debug tab on the far right… now, which was the file I was editing? Because when the test has completed, I am left in the debugger tab… With Xcode 3, the last file I was editing was the one directly below the debugger window… UI disaster. Karl ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Does anyone else dislike Xcode 4?
Hi David, On 25/07/2011, at 8:44 AM, David Duncan wrote: On Jul 24, 2011, at 3:34 PM, Karl Goiser wrote: So, I tried the trick with behaviours, assigning debugging to a special tab. Sure it seems to work, but it doesn’t. I still get debugger panes crowding out my editing windows. Make sure you also turn off the other settings in Run* behaviors, or they will modify your current tab when you start debugging. For example if you have Show tab [Debugging] and [Show] debugger with [Current Views] both turned on, then you will get a debugging tab in the last state that you set it in, and the current tab will show the debugger with whatever state you left it in. Nope, all others turned off. It’s when I pause the run. I have only changed the ‘run starts’ behaviour... Worse, I might be editing a file on the far left tab. When I do a test run, it switches to the debug tab on the far right… now, which was the file I was editing? Because when the test has completed, I am left in the debugger tab… With Xcode 3, the last file I was editing was the one directly below the debugger window… Not talking about a new tab. I’m talking about editing a file, then testing it. The behaviour moves me to the debug tab, but because the tabs are all next to each other, not layered windows, you don’t have an indication of the ‘last tab’ you were at, which it what is lost in moving from a windowed to a tabbed environment… Still, what’s the use of more than one debugging environment? Regards, Karl ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Does anyone else dislike Xcode 4?
I think that we need to differentiate between the new features that could easily have been put into Xcode 3, and the changes that have been made (to my mind) to wreck a great UI. Schemes and Git and the like do not justify the damage… Why would I want to see Interface Builder objects when I am editing source code (like I can in Xc4)? Why do I have to choose only one inspector at a time? Why can’t I see a project and a search and/or issues navigator at the same time? In order to get to the project information, why do I have to first open a project navigator, then click on the rot level of the tree? (The doesn’t seem very intuitive). Why is it that when I want want to change some settings about the app that I am testing (like whether to use GDB or LLDB or change some of the diagnostics), I have to go and edit a scheme (hidden away in a menu item, just like an issue that Apple uses to justify changing from Xc3 to 4…). Surely, it makes sense to put this sort of stuff in the UI with the project and target information? This what I think: ‘I need to add a malloc check. I’ll go to the project setting for this. No, hang on a minute, Apple has hidden this stuff elsewhere. I’ll go and have a look in the scheme area that I get to via that obscure menu item…’ I really don’t know how anybody expects people to write insanely brilliant use interfaces when they use one that borrows its cues from the ‘80s. Karl ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: BOOL value in Dictionary
The issue is that a boolean value is not numeric, but the denotation of truth or falsehood. If you take boolVar to represent the proposition that Socrates is a man, then saying: if (boolVar == YES) is equivalent to: if (Socrates is a man == YES) This is obviously a correct expression - it's just that the == YES part is redundant. Again, when asking if a package is at the airport, you don't say, Is it the case that the package is at the airport is true?, you say, is the package at the airport. The problem is that the designers of C (and other languages as well) decided to treat falsehood as zero and truth as non-zero, and implement them using integer types. The trick is that, implemented this way, boolean operators can use arithmetic ones: 'or' as addition and 'and' as multiplication. For example, false or false is false (0 + 0 = 0). This leads to the stripping of information: truth or falsehood gets reduced to numeric values and the logic of what you are coding changes. I have seen examples of C code where logical values are compared to zero (and used in expressions with + etc operators). From the above, this would be like asking: if (Socrates is a man != 0) which is absurd. To this end, I always #import iso646.h and use 'and' and 'or' as much as I can in my logical expressions... Regards, Karl On 22/11/2008, at 2:54 AM, David Blanton wrote: Why is : if ( boolVar == YES) or if ( boolVar == NO) bad form? David Blanton David Blanton ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/lists%40goiser.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Problems when putting a window between desktop and desktop icons
Dear Markus and others, This is a problem that I have had with an application of mine, iCalViewer, which displays a window on the desktop. What happens is that you can find a window level which draws the window under the desktop icons and over the desktop itself. However, at that level, that window captures the mouse events as if it was _over_ the desktop icons. My only solution was to disable mouse interaction with my window. I raised this as a bug with Apple, bug number 3521992 on 5 January, 2004 - coming up to 5 years ago! Regards, Karl On 24/10/2008, at 4:48 AM, Markus Amalthea Magnuson wrote: On Thu, Oct 23, 2008 at 19:26, Matt Neuburg [EMAIL PROTECTED] wrote: Hello, I am trying to put a window above the desktop but below the desktop icons. I have achieved this by using the following code (in my own subclass of NSWindow): [self setLevel:kCGDesktopIconWindowLevel - 1]; I think what you want to say is CGWindowLevelForKey(kCGDesktopWindowLevelKey). This should be more robust than manipulating the level value directly. Thanks for the tip! However, that doesn't really solve my problem, which I am beginning to think is a bug on Apple's behalf. If anyone is interested in some sample code, please download it here: http://data.konstochvanligasaker.se/markus/GiveMeWindow.zip Any other suggestions are welcome. -- Markus Amalthea Magnuson http://konstochvanligasaker.se http://nattlek.se Life... is like a grapefruit. It's orange and squishy, and has a few pips in it, and some folks have half a one for breakfast. – Douglas Adams ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/lists%40goiser.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Core Animation/Layers and Borderless Windows
Hello, I'm creating a borderless window whose content view uses Core Animation... When I do this, the window is drawn without any shadow no matter the alpha of the content. - a borderless window with a normal view draws the window's shadow. - a normal window with a content view which uses core animation shows the window's shadow (for example, the Recipes example). This is probably because it is opaque. If I set the borderless window to opaque, a shadow is drawn. However, I want the window to be transparent - and have a shadow just like can be done with a normal view. Is there something I need to do to get the desired behaviour? Thanks in advance! Karl ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]