Re: "a reference to"
Re: "a reference to"
- Subject: Re: "a reference to"
- From: has <email@hidden>
- Date: Mon, 28 Jan 2008 22:31:10 +0000
On 28 Jan 2008, at 21:42, Scott Babcock wrote:
There is a 'contents' property under the 'selection-object' class.
How does this apply to the 'reference' class? [...]
That says nothing about the nature of the structure or
implementation of the underlying terminology.
'contents' is defined as a property, and that's all that matters to
AppleScript. See below.
It's a property name, not an operator. ASLG confirms this,
AppleScript's aeut confirms this; the AppleScript compiler's pretty
printer confirms this.
The 'aeut' resource shows that the 'reference' class is completely
devoid of properties. Should I therefore not use the [contents]
property with the 'reference' class? I view the absence of
"contents" under the 'reference' class as an indication that this
language element is implemented through special-case handling, which
would explain its enigmatic nature.
You read way too much into the aeut. The only information AppleScript
takes from a dictionary is name, code and whether it's a type class,
enumerator, property, element, command or parameter, which is all the
compiler needs to compile the script. Other information, such as a
property's description, datatype, flags and the class in which it's
defined are provided for documentation purposes only, and is
completely ignored by AppleScript itself. This info can be wildly
incorrect and AppleScript will continue to run perfectly happily.
Using it where and how the ASLG says it should be used results in
the behaviour described by the ASLG. Using it in ways not
documented by the ASLG results in undocumented behaviour.
The ASLG clearly documents a 'contents of' operator under "Repeat
With (loopVariable) In (list)". The fact that no 'contents of'
operator appears in the "Operations" section doesn't prove that
'contents of' is never treated as an operator. It leads to one of
two conclusions:
1. 'contents of' is an operator, but it was inadvertently omitted
from the "Operations" section; or
2. 'contents of' is not an operator, and the reference to it as such
under "Repeat With (loopVariable) In (list)" is erroneous.
You clearly side with the latter conclusion. Others hold the former
to be true. Only someone with access to the source for the
AppleScript scripting component would be able to answer this
question conclusively.
The aeut says it's a property. The compiler says it's a property (it
highlights as an 'application' keyword, not an AppleScript keyword or
operator). Runtime says it's a property:
tell application "Microsoft Word"
{contents of selection, contents of (a reference to (item 1 of {1, 2,
3}))}
end tell
{"hello", 1}
The ASLG says: "The Contents property is the value of the object
specified by a reference."
5:1 says it's a property, in which case you're seeing special-case
behaviour where there's only undefined behaviour.
Whatever the case, this is a completely semantic argument. The end
result is the same whether it's a property, an operator, or both...
If used on an AppleScript reference object, the result is the object
at the referenced location. If used on an AppleScript object that
doesn't have a 'contents' property, the result is undefined behaviour;
therefore, it's a good idea to avoid using it on such objects.
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