Hi,
Attempting to coerce an object of almost any class to type “null” results in an error message “Can’t make the_object’s_value into type null.” That message can be parsed to get the value of almost any object (including lists and records) as a string, which can then be displayed in a dialog box, etc. While working with this technique, I stumbled upon a bizarre coercion:
-- As expected:
{"a"} as null --> Error: "Can't make "a" into type null."
{a:1} as null --> Error: "Can't make {a:1} into type null."
{1, 2} as null --> Error: "Can't make {1,2} into type null."
{{a:1}, 2} as null --> Error: "Can't make {{a:1}, 2} into type null."
-- Appears to coerce single-item numeric list or list of a list to an integer before attempting to coerce to type null:
{1} as null --> Error: "Can't make 1 into type null."
{{1}} as null --> Error: "Can't make 1 into type null."
-- And the bizarre coercion:
{{a:1}} as null --> No error message, returns «script» instead!
script a
{{a:1}} as null --> No error message, returns «script a» instead!
end script
run a
({{a:1}} as null) is me --> true!!
Thus, for the specific case where the object to be coerced is a single-item list and that item is a record, attempting to coerce that object to type null returns the containing script object! What is going here? Have I stumbled upon something with some meaning, or is it a completely irrelevant idiosyncrasy of AppleScript?
bmose