Re: terminology conflicts, etc. [was: Re: A date IS a date]
Re: terminology conflicts, etc. [was: Re: A date IS a date]
- Subject: Re: terminology conflicts, etc. [was: Re: A date IS a date]
- From: has <email@hidden>
- Date: Sun, 10 Feb 2008 16:51:57 +0000
On 10 Feb 2008, at 03:52, Mark J. Reed wrote:
Given that the correct choice of attribute or whatever can't be made
until runtime, it seems like the design flaw lies in allowing the same
English word to compile to different things in different contexts.
Yes. Exactly.
Seems like it'd be easier to just pass strings around at runtime.
This is basically what (e.g.) Ruby appscript does: all application-
defined keywords are represented as ordinary Ruby identifiers, and are
translated to raw AE codes when needed. While this approach doesn't
avoid all of the pitfalls created by Mac OS's troublesome human-
readable keyword/raw AE code division, it does at least avoid most of
them.
For example, if you run the following:
some_object = [1, 2, 3, 4, 5]
puts some_object.length
Ruby will call the array object's 'length' method which will return
the array's length (5). If you run the following:
some_object = app('Adobe InDesign CS3').documents[1].stories[1]
puts some_object.length
Ruby returns a reference to the story object's length property.
'length' is just an ordinary method name just like any other, and Ruby
doesn't secretly assign it additional hidden meanings just because
InDesign happens to define a 'length' property in its dictionary or
the Array class defines a 'length' method in its implementation. It's
completely up to each individual object upon which 'length' is called
to decide what 'length' means to it and what to do in response, which
is the correct way to bind names in a dynamically typed language.
has
--
http://appscript.sourceforge.net
http://rb-appscript.rubyforge.org
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden