Re: Code Completion suggestion
Re: Code Completion suggestion
- Subject: Re: Code Completion suggestion
- From: Phill Smith <email@hidden>
- Date: Thu, 28 Oct 2004 12:56:08 +1300
I agree that there may be serious technical problems but that is what apple is supposed to be about, solving these things to make make it easy for the user. It is a complex process make
I don't think you examples show these problems though as both of them could come up with useful popup lists containing information from the dictionary. With regards to getting the names or indexes of the objects in the application. Script debugger manages to do this so it must be possible.
On Oct 27, 2004, at 11:15 PM, has wrote:
Phill Smith wrote:
I don't see why the script editor can't read and parse the text of the
script, find the application or script object references then taking
information from the tell block of from th e apostrophe notation.
Interrogate the dictionary or the script objects and come up with a
list of elements and properties.
There may be a speed problem but I don't see why there is a technical
problem. It may require a more structured script using tell blocks or
apostrophes but thats OK
Speed is a non-issue because, as has already been said, there are serious technical problems:
1. There is insufficient type information available in the source code, e.g.:
tell application "TextEdit"
set myRef to document 1's text
...
get myRef's ?????
end tell
here is should come up with
Elements:
character
attribute run
attachment
word
paragraph
Properties:
<Inheritance> item (a list of its properties and elements)
size -- The size in points of the first character.
font Unicode text -- The name of the font of the first character.
color -- The color of the first character.
obviously formatted in as a pop up list.
So there's no way to know what type of value variable myRef contains except by executing the code.
2. There is inadequate information in the application dictionary, e.g.:
tell application "Finder"
get home's folder 1's ( removed entire contents as I'm not sure what it does)
end tell
here is should come up with a popup list like the following
Elements:
item by numeric index, by name
container by numeric index, by name
folder by numeric index, by name, by ID
file by numeric index, by name
alias file by numeric index, by name
application file by numeric index, by name, by ID
document file by numeric index, by name
internet location file by numeric index, by name
clipping by numeric index, by name
package by numeric index, by name
Properties:
<Inheritance> container [r/o] -- inherits some of its properties from the container class
All this information is from the dictionary.
I had to drop a major user-friendly feature from appscript because of this limitation. Very frustrating.
The primary problem is that while it's easy to implement the kind of feature you describe in a statically typed language where the every variable's type can be determined in advance, it'll be virtually impossible to do with any kind of reliability for a dynamically typed language, where a variable's type isn't known until runtime. The best you could get is a guessing system that sort of sometimes works in a few limited situations if you handle it with kid gloves and don't look at it funny and there's a 'T' in the day of the week, etc. And having a "help" system that works badly tends to be worse than not having it at all.
On the other hand, there are good, reliable ways of doing 'dumb' autocompletes (to save typing) and application object model browsing (to aid learning). So it would make much more sense and take far less work to implement those, and play to the language's strengths rather than its weaknesses.
has
--
http://freespace.virgin.net/hamish.sanderson/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden