type string vs. text
type string vs. text
- Subject: type string vs. text
- From: Mitchell L Model <email@hidden>
- Date: Mon, 27 Jun 2016 18:52:47 -0400
I thought I’d toss this in, hoping it saves at least a few people at least some time. This includes a long discourse on string, text, and some other types, and the history of AppleScript. Basically the point of the post is covered in the two Scripts shown below; you can ignore the rest if you don’t find it interesting.
At some point in the evolution of AppleScript strings became synonymous with text, or text for strings, or maybe they were never any different — I can’t remember. (Whatever happened it was a very long time ago.) Not so cleanly, though: the Language Guide for AppleScript 2.0 is full of the word “string”. (Where “string” is mentioned in the most recent Language Guide is impossible to determine, because there is no single-document version of the Guide to search. Ugh. Bad.)
Having used AppleScript since its inception (which Wikipedia says that was in System 7, 1993), I have only gradually trained myself to use text instead of string, since as far as I could tell, as synonyms the difference was purely stylistic. I have now crashed into the future by running into the following:
Script 1
1 as text — OK
1 as string — OK
Script 2
use scripting additioins
1 as text — OK
1 as string — NOT OK!!
Looking into what is going on here I was surprised to find text defined in Scripting Additions — I always thought it was part of the language. Then again, other types I thought were in the language — Boolean, integer, record, class — are in Scripting Additions. (But the rest of the types are not: date, file, list, number, etc. I don’t understand why any types are in Scripting Additions., and I look forward to be enlightened on this point by someone on the mailing list.)
Strings are NOT in Scripting Additions. They aren’t in the Language Guide’s class reference, but they weren’t for AppleScript 2.0 either. What I don’t get is how strings could be “in the language”, however crudely, but be eliminated by the use of scripting additions. I don’t understand why, or how.
_______________________________________________
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