Class person/people of not recognized unless Contacts app is running

Hi!
New to this with scripting but I noticed something strange. I was trying to compile an example from a book I am studying, but the code does not compile unless the application Contacts is actually running before I press compile.


tell application "Contacts"
	get name of first person whose ("my_email_address@somewhere.com" is in (value of every email))
end tell

If the Contacts app is not running a get an error message (freely translated from Swedish)
“Expected class name but found identifier.” and the word “person” in the code is highlighted.

If the Contacts app is currently running I get the correct output, i.e. the name of the person that has the given email address.

I do not understand why this is the case? Is this perhaps a bugg or is there something I am missing?

I read that Applescript does not know about the dictionary if I would e.g. write


tell application "Contacts" to get name ...

instead of using it in a tell block. But I thought that putting things in a tell block would somehow make Applescript aware of the classes etc in the dictionary of the corresponding app.

Which system are you running ?

Several applications edited by Apple behave this annoying way.
But here, under 10.11.3 Contacts no longer behave this way.

Yvan KOENIG running El Capitan 10.11.3 in French (VALLAURIS, France) samedi 13 février 2016 18:38:46

Hi!
Thanks for confirming. I have now updated to 10.11.3 and now it is indeed working!

I do not know which system I was running previously, perhaps 10.11.2? Not sure, but I always update quite quickly after a new release.