<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.3" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: PyObjC</title>
	<link>http://www.wilcoxd.com/blog/pyobjc.html</link>
	<description>Blog for project status and lab notes</description>
	<pubDate>Fri, 04 Jul 2008 15:52:37 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.3</generator>

	<item>
		<title>by: Bill Bumgarner</title>
		<link>http://www.wilcoxd.com/blog/pyobjc.html#comment-14</link>
		<pubDate>Thu, 11 Dec 2003 19:50:28 +0000</pubDate>
		<guid>http://www.wilcoxd.com/blog/pyobjc.html#comment-14</guid>
					<description>Ian,

    Such an experiment was already done.  See the Java-ObjC bridge.  While the heuristic is not automatic-- there is a manual mapping to ensure consistency-- the end result is the same in that the ObjC APIs are mapped to more &quot;Java-esque&quot; APIs.

   It sucks.

   The end result is an API that is different enough from the original API that the developer now has the exciting task of having to learn an all new API.

   It also lacks consistency.  There will always be cases where the mapping rules had to be bent just slightly because of some method naming conflict or API issue.

   As a result of that need to manually &quot;bend&quot; the mapping, it yields a bridge that requires lots of tedious &quot;detail&quot; maintenance over time.  It also guarantees a significant lag between changes to the underlying layer and updates to the bridge.

   There is also a huge hit to dispatch performance.  It requires algorithmic string manipulation, including concatenation, comparisons and lookups, before an attempt to dispatch can be made.

  In the end, a bridge that perpetuates a very simple and completely consistent mapping rule -- substitute '_' for ':', you're done -- is far easier to maintain and will track releases of the mapped API much more closely.

</description>
		<content:encoded><![CDATA[<p>Ian,</p>
<p>    Such an experiment was already done.  See the Java-ObjC bridge.  While the heuristic is not automatic&#8211; there is a manual mapping to ensure consistency&#8211; the end result is the same in that the ObjC APIs are mapped to more &#8220;Java-esque&#8221; APIs.</p>
<p>   It sucks.</p>
<p>   The end result is an API that is different enough from the original API that the developer now has the exciting task of having to learn an all new API.</p>
<p>   It also lacks consistency.  There will always be cases where the mapping rules had to be bent just slightly because of some method naming conflict or API issue.</p>
<p>   As a result of that need to manually &#8220;bend&#8221; the mapping, it yields a bridge that requires lots of tedious &#8220;detail&#8221; maintenance over time.  It also guarantees a significant lag between changes to the underlying layer and updates to the bridge.</p>
<p>   There is also a huge hit to dispatch performance.  It requires algorithmic string manipulation, including concatenation, comparisons and lookups, before an attempt to dispatch can be made.</p>
<p>  In the end, a bridge that perpetuates a very simple and completely consistent mapping rule &#8212; substitute &#8216;_&#8217; for &#8216;:&#8217;, you&#8217;re done &#8212; is far easier to maintain and will track releases of the mapped API much more closely.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Ian Bicking</title>
		<link>http://www.wilcoxd.com/blog/pyobjc.html#comment-13</link>
		<pubDate>Tue, 09 Dec 2003 17:58:06 +0000</pubDate>
		<guid>http://www.wilcoxd.com/blog/pyobjc.html#comment-13</guid>
					<description>Objective C's (or Smalltalk's) keywords seem more novel than they are.  Internally each keyword invokation is compressed into a single string/symbol and the arguments are a simple tuple.  So this:

    [RWError errorWithString: myString going:kToFile to:filepath];

Becomes:

    RWError.errorWithString:going:to:(myString, kToFile, filepath)

This isn't just a PyObjC transformation, but the actual transformation underlying Objective C.  You'll see experienced programmers refer to methods this way (i.e., simple as errorWithString:going:to:), and some of the introspective techniques (at least in Smalltalk) involve creating these method symbols combined with a tuple of arguments.  So PyObjC is really doing the minimal work, providing a one-to-one mapping from Objective C to Python (with _'s).  

It would be interesting if PyObjC used heuristics to figure out how to parse keyword arguments, essentially testing all possible combinations, then saved that mapping, dynamically creating functions like:

def errorWithString(self, string, going, to):
&amp;#160;    self.errorWithString_going_to_(string, going, to)

going and to can't magically attain default arguments, though if there are also methods like errorWithString:, or errorWithString:to:, then you might have to grow the method over time, ending up with something like:

def errorWithString(self, string, going=NoDefault, to=NoDefault):
&amp;#160;    if going is NoDefault and to is NoDefault:
&amp;#160; &amp;#160;       return self.errorWithString_(string)
&amp;#160;    elif going is NoDefault:
&amp;#160; &amp;#160;        return self.errorWithString_to_(string, to)
&amp;#160;    elif to is NoDefault:
&amp;#160; &amp;#160;       assert 0, &quot;errorWithString:going: does not exist&quot;
&amp;#160;    else:
&amp;#160; &amp;#160;        return self.errorWithString_going_to_(string, going, to)

Or maybe instead of that assert, we recreate the method, trying to find errorWithString_going_; we could also add a **kw argument, and rebuild the method if unknown keywords are passed.  I don't know how doable this all is, or what the performance change would be (maybe not too bad, so long as the keyword to method mappings were cached)... anyway, it might be a fun little experiment, and can probably be done mostly in Python, so long as some Objective C introspection is already available.</description>
		<content:encoded><![CDATA[<p>Objective C&#8217;s (or Smalltalk&#8217;s) keywords seem more novel than they are.  Internally each keyword invokation is compressed into a single string/symbol and the arguments are a simple tuple.  So this:</p>
<p>    [RWError errorWithString: myString going:kToFile to:filepath];</p>
<p>Becomes:</p>
<p>    RWError.errorWithString:going:to:(myString, kToFile, filepath)</p>
<p>This isn&#8217;t just a PyObjC transformation, but the actual transformation underlying Objective C.  You&#8217;ll see experienced programmers refer to methods this way (i.e., simple as errorWithString:going:to:), and some of the introspective techniques (at least in Smalltalk) involve creating these method symbols combined with a tuple of arguments.  So PyObjC is really doing the minimal work, providing a one-to-one mapping from Objective C to Python (with _&#8217;s).  </p>
<p>It would be interesting if PyObjC used heuristics to figure out how to parse keyword arguments, essentially testing all possible combinations, then saved that mapping, dynamically creating functions like:</p>
<p>def errorWithString(self, string, going, to):<br />
&nbsp;    self.errorWithString_going_to_(string, going, to)</p>
<p>going and to can&#8217;t magically attain default arguments, though if there are also methods like errorWithString:, or errorWithString:to:, then you might have to grow the method over time, ending up with something like:</p>
<p>def errorWithString(self, string, going=NoDefault, to=NoDefault):<br />
&nbsp;    if going is NoDefault and to is NoDefault:<br />
&nbsp; &nbsp;       return self.errorWithString_(string)<br />
&nbsp;    elif going is NoDefault:<br />
&nbsp; &nbsp;        return self.errorWithString_to_(string, to)<br />
&nbsp;    elif to is NoDefault:<br />
&nbsp; &nbsp;       assert 0, &#8220;errorWithString:going: does not exist&#8221;<br />
&nbsp;    else:<br />
&nbsp; &nbsp;        return self.errorWithString_going_to_(string, going, to)</p>
<p>Or maybe instead of that assert, we recreate the method, trying to find errorWithString_going_; we could also add a **kw argument, and rebuild the method if unknown keywords are passed.  I don&#8217;t know how doable this all is, or what the performance change would be (maybe not too bad, so long as the keyword to method mappings were cached)&#8230; anyway, it might be a fun little experiment, and can probably be done mostly in Python, so long as some Objective C introspection is already available.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Ryan Wilcox</title>
		<link>http://www.wilcoxd.com/blog/pyobjc.html#comment-12</link>
		<pubDate>Wed, 03 Dec 2003 14:51:22 +0000</pubDate>
		<guid>http://www.wilcoxd.com/blog/pyobjc.html#comment-12</guid>
					<description>&quot;&quot;Frankly, I think it's a crying shame that Apple hasn't done more to push AppleEvents/Open Scripting Architecture support for other languages such as Perl, Python, Ruby, etc&quot;&quot;

I played with a Python OSA component by Bill Fancher a few years back (2001). It was really cool being able to write Python in the Script Editor.

This was back in the pre 10.1 days - so there wasn't even Python on machines by default then. It was certainly be an interesting thing to resurrect now, as we have a decent install of 2.3 by default on Panther.

But yes, it's very sad we have so few OSA languages. Applescript, and Javascript - that's it (not including Bill's Python one, because well, it's not out).</description>
		<content:encoded><![CDATA[<p>&#8220;&#8221;Frankly, I think it&#8217;s a crying shame that Apple hasn&#8217;t done more to push AppleEvents/Open Scripting Architecture support for other languages such as Perl, Python, Ruby, etc&#8221;"</p>
<p>I played with a Python OSA component by Bill Fancher a few years back (2001). It was really cool being able to write Python in the Script Editor.</p>
<p>This was back in the pre 10.1 days - so there wasn&#8217;t even Python on machines by default then. It was certainly be an interesting thing to resurrect now, as we have a decent install of 2.3 by default on Panther.</p>
<p>But yes, it&#8217;s very sad we have so few OSA languages. Applescript, and Javascript - that&#8217;s it (not including Bill&#8217;s Python one, because well, it&#8217;s not out).
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: has</title>
		<link>http://www.wilcoxd.com/blog/pyobjc.html#comment-11</link>
		<pubDate>Wed, 03 Dec 2003 12:50:10 +0000</pubDate>
		<guid>http://www.wilcoxd.com/blog/pyobjc.html#comment-11</guid>
					<description>&quot;&quot;&quot;Calling an arbitrary handler in some Applescript to deal with an action should be just as easy as calling an &quot;on clicked&quot; method, programmically speaking.&quot;&quot;&quot;

Absolutely. And I think this approach would've made Studio much nicer for folk who have a bit of programming experience, but - crucially - at the expense of those who don't. So I guess I'm glad for Studio users - if not myself - that they didn't. (And I have to say, something I dislike about IB's Connections system is it somehow seems to make things look rather more complicated and intimidating than they actually are. Though I can't quite put my finger on why I feel like this.)


&quot;&quot;&quot;For me, Applescript makes an OK (but verbose) glue language.&quot;&quot;&quot;

AppleScript's &quot;verbosity&quot; is actually a feature, and a key one at that. Again, you have to consider it in context of its core market, i.e. non-programmers who just want to get something done. For them, a verbose keyword-oriented syntax is far easier to read than a terse, symbol-laden syntax. It enables non-programmers to grok what a script does just by reading the thing - even if they're not yet familiar with the AppleScript language itself! This is incredibly important to them as it lets them get that first foot in the door with almost zero effort. [1]

That said, there's no shortage of other areas in which AppleScript does genuinely suck. But let's not spend the next week going there...;)



&quot;&quot;&quot;I hesitated to write that line about poor object oriented support. Because, in a way, it's great. You talk to an application (an object) and get its frontmost state (a property). Whose statements are great (where they're supported).&quot;&quot;&quot;

Actually, none of the above are features of the AppleScript language itself. They're all features of the Mac's high-level interapplication communication mechanism as provided by the AppleEvent Manager, which AppleScript hooks into via the Open Scripting Architecture. (This is an incredibly common misconception, btw, so don't feel bad about it.;)

Basically, any language that can hook into the OS can do application scripting [2]; it just so happens that AppleScript is the most well-known - as well as having what is probably the best and [with some caveats] easiest to use implementation.

One of the interesting things about the AEM is that the application scripting interface works more like a query language than a conventional object model [3]. It just so happens that AppleScript (and, I suppose, others) happen to dress this mechanism up in different clothes. It could just as easily have been done by having embedded SQL-style statements, 



&quot;&quot;&quot;A programmer can make their own modules/script objects, with state (properties) as well.&quot;&quot;&quot;

Yup, and it's great fun for prototype-based OOP. Terrifically liberating. Even if it does feel a bit like running down the public high street with no pants on.:)

--

[1] Just as C's extremely terse syntax is a key feature for professional programmers who want to avoid getting the dreaded &quot;Cobol fingers&quot;. :)

[2] Frankly, I think it's a crying shame that Apple hasn't done more to push AppleEvents/Open Scripting Architecture support for other languages such as Perl, Python, Ruby, etc. While the actual implementation is less than perfect (IMO), the general concept is absolutely brilliant and doesn't deserve to be hogged by just a single minor language (especially not one as flawed as AppleScript).

[3] Unless you're talking about one of the more exotic OO implementations that also have array proccessing-style features built in (e.g. F-Script). The AppleScript language isn't one of these, however.</description>
		<content:encoded><![CDATA[<p>&#8220;&#8221;"Calling an arbitrary handler in some Applescript to deal with an action should be just as easy as calling an &#8220;on clicked&#8221; method, programmically speaking.&#8221;"&#8221;</p>
<p>Absolutely. And I think this approach would&#8217;ve made Studio much nicer for folk who have a bit of programming experience, but - crucially - at the expense of those who don&#8217;t. So I guess I&#8217;m glad for Studio users - if not myself - that they didn&#8217;t. (And I have to say, something I dislike about IB&#8217;s Connections system is it somehow seems to make things look rather more complicated and intimidating than they actually are. Though I can&#8217;t quite put my finger on why I feel like this.)</p>
<p>&#8220;&#8221;"For me, Applescript makes an OK (but verbose) glue language.&#8221;"&#8221;</p>
<p>AppleScript&#8217;s &#8220;verbosity&#8221; is actually a feature, and a key one at that. Again, you have to consider it in context of its core market, i.e. non-programmers who just want to get something done. For them, a verbose keyword-oriented syntax is far easier to read than a terse, symbol-laden syntax. It enables non-programmers to grok what a script does just by reading the thing - even if they&#8217;re not yet familiar with the AppleScript language itself! This is incredibly important to them as it lets them get that first foot in the door with almost zero effort. [1]</p>
<p>That said, there&#8217;s no shortage of other areas in which AppleScript does genuinely suck. But let&#8217;s not spend the next week going there&#8230;;)</p>
<p>&#8220;&#8221;"I hesitated to write that line about poor object oriented support. Because, in a way, it&#8217;s great. You talk to an application (an object) and get its frontmost state (a property). Whose statements are great (where they&#8217;re supported).&#8221;"&#8221;</p>
<p>Actually, none of the above are features of the AppleScript language itself. They&#8217;re all features of the Mac&#8217;s high-level interapplication communication mechanism as provided by the AppleEvent Manager, which AppleScript hooks into via the Open Scripting Architecture. (This is an incredibly common misconception, btw, so don&#8217;t feel bad about it.;)</p>
<p>Basically, any language that can hook into the OS can do application scripting [2]; it just so happens that AppleScript is the most well-known - as well as having what is probably the best and [with some caveats] easiest to use implementation.</p>
<p>One of the interesting things about the AEM is that the application scripting interface works more like a query language than a conventional object model [3]. It just so happens that AppleScript (and, I suppose, others) happen to dress this mechanism up in different clothes. It could just as easily have been done by having embedded SQL-style statements, </p>
<p>&#8220;&#8221;"A programmer can make their own modules/script objects, with state (properties) as well.&#8221;"&#8221;</p>
<p>Yup, and it&#8217;s great fun for prototype-based OOP. Terrifically liberating. Even if it does feel a bit like running down the public high street with no pants on.:)</p>
<p>&#8211;</p>
<p>[1] Just as C&#8217;s extremely terse syntax is a key feature for professional programmers who want to avoid getting the dreaded &#8220;Cobol fingers&#8221;. <img src='http://www.wilcoxd.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>[2] Frankly, I think it&#8217;s a crying shame that Apple hasn&#8217;t done more to push AppleEvents/Open Scripting Architecture support for other languages such as Perl, Python, Ruby, etc. While the actual implementation is less than perfect (IMO), the general concept is absolutely brilliant and doesn&#8217;t deserve to be hogged by just a single minor language (especially not one as flawed as AppleScript).</p>
<p>[3] Unless you&#8217;re talking about one of the more exotic OO implementations that also have array proccessing-style features built in (e.g. F-Script). The AppleScript language isn&#8217;t one of these, however.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Michael Hudson</title>
		<link>http://www.wilcoxd.com/blog/pyobjc.html#comment-10</link>
		<pubDate>Wed, 03 Dec 2003 11:21:17 +0000</pubDate>
		<guid>http://www.wilcoxd.com/blog/pyobjc.html#comment-10</guid>
					<description>&amp;#62; Michael Hudson said:
&amp;#62; 
&amp;#62; &quot;If your PyObjC is at all recent, you don't need 
&amp;#62; to inherit from NSApplicationDelegate.&quot;
&amp;#62; 
&amp;#62; This makes sense - I probably only have to do that 
&amp;#62; for delegate objects, which this isn't. (or is it 
&amp;#62; totally obsolete now?)

I hadn't twigged that this wasn't a delegate object.  Inheriting from NSApplicationDelegate when instances of the class aren't going to be application delegates is just silly :-)

The point was that you don't need to inherit from NSApplicationDelegate ever any more.</description>
		<content:encoded><![CDATA[<p>&gt; Michael Hudson said:<br />
&gt;<br />
&gt; &#8220;If your PyObjC is at all recent, you don&#8217;t need<br />
&gt; to inherit from NSApplicationDelegate.&#8221;<br />
&gt;<br />
&gt; This makes sense - I probably only have to do that<br />
&gt; for delegate objects, which this isn&#8217;t. (or is it<br />
&gt; totally obsolete now?)</p>
<p>I hadn&#8217;t twigged that this wasn&#8217;t a delegate object.  Inheriting from NSApplicationDelegate when instances of the class aren&#8217;t going to be application delegates is just silly <img src='http://www.wilcoxd.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>The point was that you don&#8217;t need to inherit from NSApplicationDelegate ever any more.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Ryan Wilcox</title>
		<link>http://www.wilcoxd.com/blog/pyobjc.html#comment-9</link>
		<pubDate>Tue, 02 Dec 2003 16:10:21 +0000</pubDate>
		<guid>http://www.wilcoxd.com/blog/pyobjc.html#comment-9</guid>
					<description>Has has some interesting comments about Studio. The 'the-technology-is-like-that-because-of-the-users' argument is a good take on the situation. Calling an arbitrary handler in some Applescript to deal with an action should be just as easy as calling an &quot;on clicked&quot; method, programmically speaking.

For me, Applescript makes an OK (but verbose) glue language. Studio also allows you to use Objective-C/Cocoa concepts when it's useful (and I've done it before - see &lt;a href=&quot;http://www.wilcoxd.com/blog/archives/000017.html&quot; rel=&quot;nofollow&quot;&gt;http://www.wilcoxd.com/blog/archives/000017.html&lt;/a&gt; ). That part is pretty cool, to tell the truth.

I hesitated to write that line about poor object oriented support. Because, in a way, it's great. You talk to an application (an object) and  get its frontmost state (a property). Whose statements are great (where they're supported). A programmer can make their own modules/script objects, with state (properties) as well. 

I guess my experiences with Applescript Studio (currently finishing up an application that's about 3500 lines of Applescript, and 300 lines of Objective-C) are much different from the normal Applescripter who wants a window with a progress bar for their Quark solution.</description>
		<content:encoded><![CDATA[<p>Has has some interesting comments about Studio. The &#8216;the-technology-is-like-that-because-of-the-users&#8217; argument is a good take on the situation. Calling an arbitrary handler in some Applescript to deal with an action should be just as easy as calling an &#8220;on clicked&#8221; method, programmically speaking.</p>
<p>For me, Applescript makes an OK (but verbose) glue language. Studio also allows you to use Objective-C/Cocoa concepts when it&#8217;s useful (and I&#8217;ve done it before - see <a href="http://www.wilcoxd.com/blog/archives/000017.html" rel="nofollow"><a href='http://www.wilcoxd.com/blog/archives/000017.html' rel='nofollow'>http://www.wilcoxd.com/blog/archives/000017.html</a></a> ). That part is pretty cool, to tell the truth.</p>
<p>I hesitated to write that line about poor object oriented support. Because, in a way, it&#8217;s great. You talk to an application (an object) and  get its frontmost state (a property). Whose statements are great (where they&#8217;re supported). A programmer can make their own modules/script objects, with state (properties) as well. </p>
<p>I guess my experiences with Applescript Studio (currently finishing up an application that&#8217;s about 3500 lines of Applescript, and 300 lines of Objective-C) are much different from the normal Applescripter who wants a window with a progress bar for their Quark solution.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: has</title>
		<link>http://www.wilcoxd.com/blog/pyobjc.html#comment-8</link>
		<pubDate>Tue, 02 Dec 2003 15:00:13 +0000</pubDate>
		<guid>http://www.wilcoxd.com/blog/pyobjc.html#comment-8</guid>
					<description>Sounds like PyObj-C could really hit the sweet spot for an awful lot of people. A few sideways thoughts re. Studio and AppleScript:

&quot;&quot;Part of this probably has to do with AppleScript's poor object-oriented support.&quot;&quot;

AppleScript's OOP support - which is prototype-based, not class-based, incidentally - is one of its nicer (less unpleasant?) features imo. Doesn't have a huge featureset, but all the essentials are there and there's plenty you can do with it. Rather, I think the reason Studio works as it does is due to the limitations of its target userbase. 

To elaborate: most AS users aren't trained programmers and just don't know (or care) about stuff like OOP, abstraction, top-down design, etc, etc. So there's no way they're going to think as far ahead as MVC, connections and all the other stuff that goes into professional GUI app design - heck, there's an awful lot that don't even grok &quot;basic&quot; concepts like &quot;What are subroutines and why are they used?&quot;(!) Therefore Studio has to use a model that's accessible to such folk. I guess you could call it a &quot;literal, reactive interface&quot; or something if you wanted to put a label on it. Thus [e.g.] clicking a button fires a generic on-clicked event at the script - i.e. the event describes the literal action rather than its intent - and it's left to the script to react to this event as it sees fit, figuring out where it came from and behaving appropriately. 

Klunky? Definitely. But a good fit for the existing knowledge and thinking processes of your average AppleScripter, because (1) it takes relatively little abstract thought to grok such a simple and direct cause-effect relationship, and (2) it gives them an object, which is something they already know how to manipulate, that they can beat and hammer at with nothing more than the basic control structures (i.e. conditionals and loops) until they get it to do what they want it to.

To be honest, I don't like Studio either, but that's because I think its users would have been much better served by a HyperCard-style environment where there's even less separation between GUI and code, so even less abstract design and thought required. I guess like anything Apple does these days it's more a practical compromise than an ideal solution to the problem: long on pragmatism; bit short on vision. (But hey, you pays your money...;)</description>
		<content:encoded><![CDATA[<p>Sounds like PyObj-C could really hit the sweet spot for an awful lot of people. A few sideways thoughts re. Studio and AppleScript:</p>
<p>&#8220;&#8221;Part of this probably has to do with AppleScript&#8217;s poor object-oriented support.&#8221;"</p>
<p>AppleScript&#8217;s OOP support - which is prototype-based, not class-based, incidentally - is one of its nicer (less unpleasant?) features imo. Doesn&#8217;t have a huge featureset, but all the essentials are there and there&#8217;s plenty you can do with it. Rather, I think the reason Studio works as it does is due to the limitations of its target userbase. </p>
<p>To elaborate: most AS users aren&#8217;t trained programmers and just don&#8217;t know (or care) about stuff like OOP, abstraction, top-down design, etc, etc. So there&#8217;s no way they&#8217;re going to think as far ahead as MVC, connections and all the other stuff that goes into professional GUI app design - heck, there&#8217;s an awful lot that don&#8217;t even grok &#8220;basic&#8221; concepts like &#8220;What are subroutines and why are they used?&#8221;(!) Therefore Studio has to use a model that&#8217;s accessible to such folk. I guess you could call it a &#8220;literal, reactive interface&#8221; or something if you wanted to put a label on it. Thus [e.g.] clicking a button fires a generic on-clicked event at the script - i.e. the event describes the literal action rather than its intent - and it&#8217;s left to the script to react to this event as it sees fit, figuring out where it came from and behaving appropriately. </p>
<p>Klunky? Definitely. But a good fit for the existing knowledge and thinking processes of your average AppleScripter, because (1) it takes relatively little abstract thought to grok such a simple and direct cause-effect relationship, and (2) it gives them an object, which is something they already know how to manipulate, that they can beat and hammer at with nothing more than the basic control structures (i.e. conditionals and loops) until they get it to do what they want it to.</p>
<p>To be honest, I don&#8217;t like Studio either, but that&#8217;s because I think its users would have been much better served by a HyperCard-style environment where there&#8217;s even less separation between GUI and code, so even less abstract design and thought required. I guess like anything Apple does these days it&#8217;s more a practical compromise than an ideal solution to the problem: long on pragmatism; bit short on vision. (But hey, you pays your money&#8230;;)
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Michael Hudson</title>
		<link>http://www.wilcoxd.com/blog/pyobjc.html#comment-7</link>
		<pubDate>Tue, 02 Dec 2003 12:40:28 +0000</pubDate>
		<guid>http://www.wilcoxd.com/blog/pyobjc.html#comment-7</guid>
					<description>If your PyObjC is at all recent, you don't need to inherit from NSApplicationDelegate.

Also, everyone thinks &quot;why not use keyword arguments?&quot; when they first see PyObjC.  Everyone is wrong, but it's hard to articulate why.</description>
		<content:encoded><![CDATA[<p>If your PyObjC is at all recent, you don&#8217;t need to inherit from NSApplicationDelegate.</p>
<p>Also, everyone thinks &#8220;why not use keyword arguments?&#8221; when they first see PyObjC.  Everyone is wrong, but it&#8217;s hard to articulate why.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Michael Tsai</title>
		<link>http://www.wilcoxd.com/blog/pyobjc.html#comment-6</link>
		<pubDate>Sun, 30 Nov 2003 15:00:27 +0000</pubDate>
		<guid>http://www.wilcoxd.com/blog/pyobjc.html#comment-6</guid>
					<description>One problem with:

errorWithString(myString, going = kToFile, to= filepath)

is that -errorWithString:going:to: and -errorWithString:to:going: are different selectors in Objective-C, whereas the order doesn't matter in Python. Also, you can have selectors like –performSelector:withObject:withObject:. Keyword arguments are not the same thing as interspersing the parameters with the name.

The underscore scheme has some nice consequences. For instance, in Python the value of RWError.errorWithString_going_to_ is a callable object that does exactly what you would expect. It would be messier to get that object using the keyword scheme. It's nice to have a one-to-one correspondence between methods and selectors.</description>
		<content:encoded><![CDATA[<p>One problem with:</p>
<p>errorWithString(myString, going = kToFile, to= filepath)</p>
<p>is that -errorWithString:going:to: and -errorWithString:to:going: are different selectors in Objective-C, whereas the order doesn&#8217;t matter in Python. Also, you can have selectors like –performSelector:withObject:withObject:. Keyword arguments are not the same thing as interspersing the parameters with the name.</p>
<p>The underscore scheme has some nice consequences. For instance, in Python the value of RWError.errorWithString_going_to_ is a callable object that does exactly what you would expect. It would be messier to get that object using the keyword scheme. It&#8217;s nice to have a one-to-one correspondence between methods and selectors.
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
