Re: Convert first char to lower case
Re: Convert first char to lower case
- Subject: Re: Convert first char to lower case
- From: has <email@hidden>
- Date: Wed, 9 Jan 2002 16:19:28 +0000
Nigel Garvey wrote:
>
>Try this and see if it makes a difference:
>
>
>
> character 1 of Variable1
>
> set AppleScript's text item delimiters to result
>
>
Ah yes. That does seem to make it more stable. It looks like another
>
manifestation of the ol' "reference in a list in a line of the script"
>
problem. The tids were getting set to {character 1 of Variable1} rather
>
than to {"T"}. The reference inside the list has to be resolved first by
>
creating the list with a separate instruction. has's suggestion uses an
>
implicit 'get' command. An explicit one also works:
>
>
set AppleScript's text item delimiters to (get {character 1 of
>
Variable1})
Thanks for pinning the problem, Nigel. I knew there was something going on
there but couldn't see quite what. Seems so obvious now. (Note: IIRC it
would break regardless of whether the reference is inside a list or not.
You might want to double-check this.)
>
Maybe not so much a bug as a surprise.
IMHO, if AppleScript's TIDs require a list or string [and nothing else], it
should be their job to make sure that's what they get. I thought part of
the point of loosely-typed languages is that they take care of any
necessary coercions themselves. [<points finger> "You're a smart object;
why don't you know what you need?"]
Otherwise AS breaks in all sorts of unpredictable ways, and all the "strong
typing" advocates get to go "nar-nee-nar, I told you so". And we can't have
that now, can we...?
has
p.s. FWIW, I think AS's use of references is one of the murkiest areas in
some need of a rethink. When I was a novice they caused me no end of
headaches and confusion, not to mention the wasted hours. Come to think of
it, they still do - but at least now I've learnt what the enemy looks like
and can deal with it PDQ. That's no excuse for AS inflicting such pain on
its users in the first place, though (2c).