Re: Understanding a repeat loop (strings/characters)
Re: Understanding a repeat loop (strings/characters)
- Subject: Re: Understanding a repeat loop (strings/characters)
- From: Steven Angier <email@hidden>
- Date: Mon, 24 Feb 2003 14:00:17 +1100
On 24/2/03 12:48 PM, "John W Baxter" <email@hidden> wrote:
>
At 9:37 +1100 2/24/2003, Steven Angier wrote:
>
> On 23/2/03 12:35 PM, "has" <email@hidden> wrote:
>
>
>
>> ...And since in strings 'item' is synonymous
>
>> with 'character', what you end up with is a reference to each
>
>> character.
>
>
>
> It is a shame that 'item' is not synonymous with 'text item'.
>
>
I don't see it that way.
>
>
"Text item" takes interpretation of the contents of the string, item
>
doesn't (beyond the ability to recognize what one character means in the
>
multi-byte case).
>
>
I think both capabilities are useful...making item synonymous with text
>
item would remove the simpler case from the language, requiring the use of
>
"character" and making strings less like lists.
I would not have a problem with this: why shouldn't one have to specify how
their string should be used as a list -- sometimes the user might want
characters, sometimes, words, sometimes lines, sometimes paragraphs.
Lower level languages like C make us think of strings as lists (arrays of
int) -- something which I believe is inherently ugly and counter-intuitive.
AppleScript, being a higher-level language, does a pretty good job of
abstracting all of that ugliness away.
As I am sure Has and others will attest to, I don't consider the ability to
get an "item" of a string (returning a character) a feature. Again, because
it exposes the ugliness of C strings. And since the synonymous expression
"character" already exists, "item" then becomes superfluous. And if "item"
is then up for grabs, why not make it synonymous with "text item" -- a
user-definable, dynamic, and truly useful term?
How long is a piece of string?
Is it 3 feet?
Is it 36 inches?
Is it half a spool?
Or is it 34,567 individual fibres?
The best answer should obviously depend on the context.
Steven Angier
Macscript.com
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.