[TxMt] TM & UBB code some questions
Chris Thomas
chris at m-audio.com
Tue Jan 25 19:44:59 UTC 2005
On Jan 25, 2005, at 10:35 AM, Allan Odgaard wrote:
> On Jan 25, 2005, at 19:28, Allan Odgaard wrote:
>
>> AS integrates with other applications which one may use in
>> combination with TextMate, like Automator, Script Editor [...]
>>
>>
>
> Also a point I forgot to mention, AS has been refined over many years
> to be an application extension language, this means it has stuff like
> event handlers, so not only can a script call TM, but a script can
> setup hooks for TM to call (at least to the best of my knowledge) --
> the infrastructure for all this is already defined and partially
> implemented, TM only needs to make use of it.
>
> There is no language I'm aware of which has similar capabilities, so
> I'd have to invent a lot myself, which is more work and a bad idea.
What capabilities are you referring to? I mean, there's no functional
difference between:
(1) Ruby, invoked using rb_call, IIRC
def save_hook( path, encoding, etc )
end
(2) AppleScript, invoked as described at
http://www.scifihifi.com/weblog/mac/Cocoa-AppleEvent-Handlers.html
on save_hook( path, encoding, etc )
end save
To be clear, I believe that AppleScript support is a useful and
TextMate should have it. I suspect, however, that it might be
ultimately orthogonal to the question of an embedded scripting
language. AppleScript requires a lot of overhead to perform the
simplest of tasks. AppleScript also does not provide much in the way of
object-oriented language features. For just one example, one way to get
wide-ranging SCM support might be to export a simple Ruby object:
module TextMate
class VersionControlSystem
def file_remote_status(paths*)...
def file_editable?...
def commit_files!(paths*)...
...
end
end
Then it would be possible for users to subclass this object to support
the less-popular RCS systems -- Perforce, svk, darcs... This sort of
thing would be downright painful to implement with AppleScript.
Chris
More information about the textmate
mailing list