| I'm using it for my current project, currently ~6k semicolons. Stream of thought time! Forgive the sloppy writing, which will be full of interjections. Obj-J is more verbose than regular JavaScript. More use of objects and method selectors than callback functions. I usually prefer callbacks to delegate objects. It's easy to just make a catch-all object and use that with an anonymous function if you'd rather not specify a class for something that requires a delegate method, though it's not idiomatic Cappuccino/Cocoa. Cappuccino is almost identical to Cocoa. If you have experience with Cocoa you can just switch off the part of your brain that wonders how you should be doing something and just do it like you would have with Cocoa, and it'll just work, as they say. Not terribly exciting, but it works – and frighteningly well. I spent over a month working on my app, testing exclusively in WebKit and Firefox. Lots of what would be called advanced behavior "for a browser app" (but nothing that would be called advanced for a desktop app from 5 years ago) and making it work in IE required just a few tweaks, most of which were unrelated to Cappuccino (comet longpolling library I was using, Orbited.) Good stuff: Awesome, responsive, feels-right GUI stuff. Can't break objects by clicking and dragging around. No weird jumping around behavior. Stuff doesn't get dislodged, misaligned, etc. Don't have to work with the DOM. At all. This is a huge deal if you have a background in desktop GUI stuff – if all you've ever used is the DOM you have no idea what you're missing. It's pretty terrible for anything except vertically scrolling pages of text. Working with the DOM was like having someone beat on your shins with a baseball bat. "No I want the box to go there. There! THERE! ARGHOSOIJSD" Built-in serialization for Cappuccino classes. Canvas/vector abstractions. GUI building in Apple's Interface Builder. IE, WebKit, Opera, Firefox all work from the same code without apologies. Much more finessed event handling. Bad stuff: Awful debugging. Worse than regular JS debugging. Usually can't even easily tell what line a syntax error is on. Still has tons of stupid JS problems – implicit globals, type coercion everywhere (with JS primitives), slow as molasses. About a 10% performance hit on tight loops if you use Obj-J message sending in them. Mostly non-existent documentation. Still in rapid development, things change a lot. If you don't already know how to use Cocoa, expect to be totally lost. Other stuff: Has its own event loop. Allows for more flexibility than only DOM events, but it might cause problems if you use other JS code that uses events. Building Cappuccino in Linux had a few hiccups, but I got it working (they were related to Ruby 1.9.) Just Works in OS X without any tweaking necessary. Best reason to use it: Cocoa is not perfect by any measure, but we know it works for GUI apps. Cappuccino is like Cocoa; it works. A lot of effort has gone into Cappuccino. Behind the scenes, a lot is going on to maintain the transparent layer of browser compatibility that you get to work with. There are warts and issues, but you can absolutely build something with it right now and it will work. |
The Safari 4 / WebKit debugger is actually getting quite good. Add on top of that the profiler and support for native method names we added to WebKit, and you've got what I consider the best debugging environment in any browser.
Break on exception works well, and even though you are seeing post-processed code, it looks nearly identical to the original.
(The parse error problem is just a generic Safari problem, and Firefox reports much better context for that particular class of error, just something that's useful to know)
About this statement:
There are plenty of globals, but they are intentional. If there are a few strays becoming global, they are bugs we'd be happy to fix. In user code, the global situation is actually slightly better than vanilla JS because we give any top level vars file level scope rather than global scope.And finally:
That sounds off to me. You can't blindly trust the WebKit or Firebug profilers, because they are not time based, but rather call based, which disproportionately affects short methods.But even if its true, if a 5-10% performance hit on a critical loop is important, there's nothing stopping you from grabbing the method implementation and calling it directly, completely negating any potential performance hit.
One line of code will grab and store a method implementation, then you can just call it directly in your code:
In general, on the scale of an entire application, the overhead of message sends is much less than 10%.