与吉米先生站在一起

蒂姆布雷回应很好地对待我的“为什么Apple不会开源其应用程序“几周前,有趣地说,像Mail,iCal和iChat这样的开源采购应用程序不会对Mac OS X升级销售造成不利影响:

If there were an enhanced guerrilla version of, for example, Mail.app, that did message-selection correctly and had a next-unread button, both these fixes being provided by a community member, some things would happen首先,我会用它Second, the vast majority of Mac users wouldn’tThird, when the Leopard release of Mail.app, presumably with new goodies, came out, it would be back-ported to TigerFourth, I and most of the other people using the variant Mail.app would upgrade to Leopard anyhow.

如果这个逻辑中存在漏洞,我会说“绝大多数Mac用户都不会”参与其中(贾斯汀布兰顿提出了类似的论点.) I agree that most Mac users would not install these enhanced guerrilla versions and that they probably wouldn’t even know they existed — but there are, what?, 10 to 20 million total Mac users? The “vast” majority could ignore them and it would still leave a sizable number of Mac users.

很多 - 不是,只是许多- Mac用户占据计算机用户频谱中经常被忽视的位置:非技术爱好者的位置从计算机科学的角度来看,这些人并不真正理解计算机是如何工作的,而是谁从Mac OS UI隐喻的角度理解Macintosh的工作方式即他们是Mac书呆子但不是计算机书呆子。

早在2002年回应Joel Spolsky关于Mac是否是商业软件开发商足够大的市场的一篇文章,我写道:

Sure, some Macs are used in corporate settings, and some are used at home by the “I just use the web and email” crowdBut Macs are much more likely to be used by computer enthusiastsYou pretty much have to go out of your way to end up with a Mac on your desk (or lap)If you walk into CompUSA and say, “I’d like to buy a computer”, you’re probably going to walk out with a Wintel boxIf you do that at Wal-mart, you无疑将。

Let’s divide computer users into two groups — people who think computers are fun, and people who just happen to use a computer. Which group do you think buys more software (even including all the Linux nerds in the first group)? Which group do you think most Mac users are in?

Mac users may only constitute four percent of the total number of computer users; but they constitute a significantly higher percentage of the total number of users who do things like install and purchase third-party application software.

Considering that these users already do things like installing plug-ins and unsupported system extensions like APE haxies and input manager hacks, I find it hard to believe many of them wouldn’t install enhanced guerrilla versions of these apps, too, if Apple were to release them as open source再一次,不是Mac用户,但是,我认为,不仅仅是Bray(或Blanton,或许多通过电子邮件发送给我的人)怀疑。

考虑到这个想法的实际意义,在布雷的情景中会出现一些棘手的技术问题For example, what happens if someone releases a patched version of Mail that replaces the system’s official version from Apple? What happens then when the next software or security update from Apple contains an updated version of Mail from Apple? Collision.

所以,有人可能会争辩说,有一些规则,开源游击队版本不会被允许取代Apple的正式版本/应用/But how would such a rule be enforced? By stating it as a rule in the license? Good luck with that第2c节Mac OS X软件许可协议例如,明确禁止逆向工程或反汇编软件,但这似乎并没有让任何人使用逆向工程来创建输入管理器黑客和haxies。

(当然,它不能让任何人都不要对系统进行逆向工程,因为它是非法反向工程软件just because it says you can’t in the EULA; software license agreements are full of bullshit restrictions that aren’t enforceable and are contrary to established copyright law我只是说你不能指望遵守规则,因为它是在许可证中说明的。)

即使开发人员确实发布了具有唯一名称(更重要的是,唯一的包标识符)的游击队分支,您也会遇到其他问题比方说,如果您决定切换到从Mail派生的分支,它不会替换您的Applications文件夹中的Mail,因为它的名称是“JoeMail”But now what would happen when you clicked the email button in iPhoto? It would still fire up Mail, is what would happen.1

Or if you were to switch to a modified offshoot of iCal but were still using Apple’s standard version of Mail, and then receive a message with an event invitation, and you click the button to agree to attend — Mail would send you to iCal, not FooCal or whatever the name is of your guerrilla version of iCal.

重点是,除非你切换所有Apple的官方应用程序是一个集成和协调的分支派生套件,它们已被重新调整,以各种方式与Apple自己的应用程序相互作用,会在用户体验中产生漏洞因此,开发人员只能制作出有意义的应用程序更换苹果在这一点上,您遇到了上述问题,其中软件更新将使事情变得混乱。

我知道她会遇到她的联系

不过,我过去几周一直在思考的问题是,为什么我不像Bray那样对现状感到困扰我可以写一点代码,我的大脑是chockablock与我使用的软件有关的小问题和功能请求但我并不强烈希望看到我使用的任何闭源应用程序作为开源发布为什么?

前几天,在修补Script Debugger中的一个小项目时,答案让我感到震惊 - 我已经通过脚本编写,对我使用的软件进行微小的添加和修改对于更严重的扩展,我依赖的许多应用程序都有插件API。

Mac OS X is a very hackable platform; it just isn’t hackable by means of the raw source code to the software这是Mac OS X继承其家族双方良好方面的一个领域从经典的Mac OS,它继承了AppleScript以及丰富的插件API的传统,适用于主要应用程序从Next开始,它继承了整个(高度可编写脚本的)Unix层以及非常可破解和模块化的Objective-C运行时系统Cocoa的神奇之处,以及它对开发人员的吸引力的一个主要方面是,它是动态的 - Cocoa应用程序可以在它们发布后以非常重要的方式即时更改例如,这就是输入管理器破解工作的方式查看F-脚本- 一个基于Smalltalk的Cocoa开源脚本层 - 这是一个动态的例子。

Popular examples abound:

  • The entire desktop publishing software industry revolves around the plug-in APIs provided by the 800-pound gorilla2applications: QuarkXPress, InDesign, Photoshop, and Illustrator(My complete switch from QuarkXPress to InDesign, for example, was made possible only through the use of Em Software’s outstandingXtags and InFlow plug-ins for InDesignI’d rather switch back to Quark than use InDesign without Xtags.

  • Kinkless GTDis Ethan Schoonover’s free set of AppleScripts and outliner templates for OmniOutliner Pro that turns it into a task management app for implementing David Allen’s mega-popular Getting Things Done system.

  • 有没有曾经been a successful text editor that wasn’t richly scriptable? That’s certainly the key to BBEdit’s success, and it’s also the key reason why TextMate has emerged as a worthy arch-rivalNeither is open source; both are deeply extensible in numerous ways(E.g.: BBEdit doesn’t support a built-in auto-complete feature, but Michael Tsai’s excellentBBAutoCompletegives you one that works via AppleScript. Plus, because it works via AppleScript, I can use it just about any properly scriptable editor, including Mailsmith, too.)

  • Apps like Quicksilver and LaunchBar can radically alter the way you launch applications and open documentsQuicksilver, particularly — it’s more of a framework for plug-in interface hacks.

Apple的一些应用程序也在其中:Frasier Speirs的FlickrExport是iPhoto的插件,增加了Flickr集成;的MailTags是Apple Mail的插件,可添加标记和任务管理功能Safari没有插件界面3我现在已经掌握了三年多了Safari的糟糕的AppleScript支持,但多亏了Cocoa的动态运行时,还有一个大量的Safari修改黑客

此外,值得注意的是,WebKit使开发人员能够将HTML呈现视图用于远远超出网上冲浪的目的NetNewsWire和Adium等应用程序为知道HTML和CSS的人提供了设计和自定义部分应用程序UI的能力而且因为它们是通过包含HTML和CSS文件的简单包来实现的,所以它们的工作与脚本或插件一样容易共享。

I stated earlier that there’s a long history of this sort of scriptability, extensibility, and hackability on the Mac; but these are by no means Mac-specific tenets上述桌面发布应用程序与Windows是跨平台的,其插件API也是如此即使在开源Unix世界中,流行度和可扩展性之间也存在很高的相关性Tim Bray自己的首选文本编辑器(以及Mark Pilgrim的,就此而言),Emacs,通过其内部可编写脚本Lisp实现Yes, Emacs is open source, but Emacs hackers don’t typically tweak their editor by writing C code and compiling their own custom emacs binary — no, they write Lisp extensions.

Firefox也是如此开源,是的,但是当用户向Firefox添加新功能时,他们不会下载源代码并编译自己的Web浏览器他们写扩展或者,更常见的是,他们安装meta-hack Greasemonkey扩展,然后在运行Greasemonkey的JavaScript中编写脚本(这带给我们的回到Mark Pilgrim再次。)

当然,这并不是说开源是无关紧要的偶尔会有人编译自己的Emacs二进制文件 - 例如著名Emacs / XEmacs fork),和类似的东西碳Emacs适用于Mac OS X的端口关于Mozilla和Firefox,有类似的分支卡米诺

But those examples only help make my point: Camino and Flock aren’t just minor deviations from Firefox; they’re entirely separate and different applicationsCarbon Emacs也是如此:它的重点 - 提供与标准Mac OS X GUI环境的一些集成度 - 本质上超出了Emacs的岛屿Lisp扩展机制的范围。

打开应用程序的源代码可以修改或调整应用程序创建插件或脚本API不仅使其成为可能,而且使其相对容易像Flock和Camino这样的开源分支是关于他们的父应用程序的架构或用户界面的根本改变,并不是Bray所讨论的那种东西。

Plus, doing your guerrilla UI hacking by way of scripting and plug-ins solves all the forking issues mentioned earlier — you’re not modifying the application itself, on disk, so you won’t interfere with system updates or the interaction between the app and the rest of the system并且与其他人分享您的工作更容易 - “尝试我的脚本”比“尝试我的iCal自定义二进制文件”更具吸引力。

唱歌,'我​​们要发泄我们的挫折'

And so now we’ve arrived at a way of looking at Bray’s gripe with Apple that I can sign onto — by restating it from “Apple should open source their apps” to “Apple should enable someone like me to make small tweaks to their apps by writing a few dozen lines of code”因为关于Mac OS X的可编程性和可扩展性文化的所有好处,还有很大的改进空间Apple在自己的应用程序中对AppleScript的支持遍布全球我之前提到Safari的AppleScript支持很差,但它肯定比预览更好,而预览则没有甚至还有一本脚本词典,所以你甚至不能做一些简单的事情,要求预览最前面窗口文档的路径。

我之前提到过Mail的MailTags插件,但它使用的插件API完全是没有证件,正式私人对苹果而基于输入管理器的Safari攻击几乎不像黑客那样得到支持但是虽然没有任何文档或批准对这些技术的支持,但我完全怀疑在Bray假设的开源场景中,Cupertino中丢弃的源代码也没有任何文档或支持。

Scripting and (officially sanctioned) plug-in APIs are implicit commitments; once you release an API, the developer of the app is pretty much on the hook to continue supporting it going forward然而,如果Apple Mail的下一个版本完全打破了MailTags目前使用的API,那么对于MailTags(及其用户)来说,这是一个艰难的愚蠢行为。

不过,这并不一定是坏事Apple的资源有限,即使整个公司完全致力于尽可能多地为其软件添加支持,记录的脚本和插件API,但当天只有这么多时间官方支持的报道总会出现漏洞这些漏洞中的一些漏洞可以通过非官方的,不受支持的方式访问,而不是根本不可访问。

Apple对AppleScript的支持似乎因团队而异与视觉用户界面不同,显然没有任何关于Apple软件中最小可编程性的标准的授权当我在这里谈到“视觉用户界面标准”时,我不是在谈论视觉一致性- 这显然不再是Apple的优先考虑事项 - 而是所有团队都将时间和精力投入到软件的外观上你可能不会喜欢来自Apple的每个应用程序的用户界面,但我不认为你可以指出一个并且认为根本没有对它进行任何思考或努力AppleScript有许多应用程序根本不支持AppleScript,但显然应该这样做。

来自尖头发老板的一个常见争论是花费时间来设计和开发良好的脚本界面,大多数用户从不编写脚本这是事实,但这不是反对支持脚本的好理由良好的脚本支持的好处不仅仅是那些编写脚本的用户,而且也是那些编写脚本的用户使用他们它只花了一个Ethan Schoonover来写kGTD,但现在有成千上万的OmniOutliner Pro用户使用它。

即使是很棒的脚本支持也不是灵丹妙药 - 有些看似微不足道的任务是不可能的,因为没有API可以预见到所有可能的需求例如,Tim Bray对Mail的抱怨之一就是关于multiple-message selection via the keyboard:如果您使用Shift-Down选择邮箱中的多条消息但是意外超调并且走得太远,那么点击Shift-Up来补偿过冲,会发生什么,而不是将选择缩小一个而不是成长the selection in the other directionBut this isn’t a beef with Mail; it’s actually a beef with the system’s standard list controls (Data Browser in Carbon, NSTableView in Cocoa)我同意Bray的观点,认为这种行为既错误又无休止地令人沮丧,4但这就是列表项选择如何在任何使用默认行为的标准列表控件的应用程序中工作(包括Finder,iCal和系统范围的打开和保存对话框,仅举几个例子)Could it be fixed with access to Mail’s source code? Of course — it’s all just typing但我怀疑它无法轻易修复,因为它不是提供列表选择的Mail换句话说,这是一个比它看起来要难以解决的问题,我承认一个优秀的脚本界面无法帮助你改变它(我不知道你是否可以通过Mail的未记录的插件界面破解它。)

但至于Bray关于Mail的另一个抱怨 - 它应该有一个“Go to Next Unread Message”命令 - 这应该可以用AppleScript我不知道能够完成(因为我不使用邮件,我没有费心去调查),但如果不可能,它应该是(LazyWeb第一个DF读者的名气和财富为Mail实现了这个。更新:这里的Bruce Phillips和“Qwerty Denzel”的良好实施在MacScripter论坛上。)

没有是灵丹妙药,包括开源如果它的源代码被关闭但是扩展接口仍然比源保持打开但扩展接口被删除的话,Firefox会更加黑客攻击对于Apple和Mac OS X,最佳位置是为典型用户提供简单,清晰,一致的默认功能和行为,但为黑客提供尽可能多的可扩展性。

在每个连续的主要版本中,Mac OS X在这方面都有所改进And Apple’s unscriptable apps don’t always remain unscriptable; Apple Remote Desktop added a very decent scripting dictionary in the recent version 3.0 upgrade(你知道这很好约翰C.韦尔奇喜欢它。)谁知道,也许其中一年Safari会给我们脚本访问标签。

Apple应该满足那些希望编写小块代码来定制环境的用户,以及不仅愿意,而且渴望与他人分享工作的用户。I don’t want the source code to their software; I just want to be able to script the hell out of it.


  1. Bundle identifiers uniquely identify every application; for example, “com.apple.textedit”, or “com.barebones.bbedit”在众多其他目的中,包标识符用作您的首选项文件的名称库/首选项/夹。↩︎

  2. 这种短语的选择是由于在同一篇文章中同时使用“游击队”和“大猩猩”的毫无意义的愿望所促成的。↩︎

  3. Plug-ins for browser content (like Flash and QuickTime) don’t count; those are content rendering plug-ins, not plug-ins for the application itself.↩︎

  4. 是否任何人actually prefer this behavior? This is one of the most baffling design decisions in all of Mac OS X, because I just can’t see how anyone would want it to work this wayI can’t recall a single instance ever of wanting to use Shift-Down to select items and then Shift-Up to select more from the other end of the selection range; whereas overshooting by one or two items and wanting to reverse direction and shrink the selection range is a pretty common situation.↩︎