Re: class of "foo" is in {string} evaluates to false
Re: class of "foo" is in {string} evaluates to false
- Subject: Re: class of "foo" is in {string} evaluates to false
- From: Paul Berkowitz <email@hidden>
- Date: Tue, 06 Nov 2007 13:21:27 -0800
- Thread-topic: class of "foo" is in {string} evaluates to false
Title: Re: class of "foo" is in {string} evaluates to false
On 11/6/07 2:06 AM, "Harald E Brandt" <email@hidden> wrote:
AppleScript Release Notes for Mac OS X version 10.5
(https://developer.apple.com/leopard/devcenter/docs/releasenotes/AppleScript/RN-AppleScript/index.html)
says that:
[quote]
In addition, text, string, and Unicode text will all compare as equal. For example, class of "foo" is string is true, even though class of "foo" returns text.
[/quote]
However, it does NOT work with the 'is in' construct.
The following evaluates to false:
class of "foo" is in {string}
I call this a bug and have reported it to the Bug Reporter.
(The original script of mine that was bitten by this bug had the construct: 'is in {string, Unicode text}'.)
Read up in the (old) Language Guide. The correct way of doing that is:
{class of "foo"} is in {string, Unicode text}
Does that return true, as it should? (I’m not in Leopard, but it does so in all earlier OS’s.)
You need to have the same class on both sides of the ‘is in’ and ‘contains’ operators. In this case, the class on the right side is a list, so the left side needs to be a list too. You are probably used to the implicit coercion when one side is an (actual) string or text, that AppleScript “understands” that you “meant” to put it into list braces. Same for numbers. But that coercion-to-list doesn’t work for other classes unless a particular application has it implemented for the specific case. It does work for ‘class’ in Tiger, but perhaps not in Leopard. It works without the braces in Tiger. I’m interested to know if it’s just this coercion-to-list that isn’t happening in Leopard, or if it’s another issue.
--
Paul Berkowitz
_______________________________________________
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