Re: How do I delete the 1st three characters from a variable
Re: How do I delete the 1st three characters from a variable
- Subject: Re: How do I delete the 1st three characters from a variable
- From: has <email@hidden>
- Date: Thu, 5 Jan 2006 14:54:18 +0000
Shane Stanley wrote:
> > However, I'd consider _requiring_ this form a bit of a bug in the application,
>> as it really should be intelligent enough to determine the start and end
>> references ('character 4' and 'character -1' in this case) automatically.
>>
>> It is, after all, what users are led to expect will work.
>
>Where are they led to expect that "text x thru y" will return a string and
>not a list? Where else, apart from "text x thru y", does use of thru return
>other than a list?
You seem to have misread - I was addressing your comment about some applications requiring users to write:
text (character x) thru (character y)
instead of:
text x thru y
and not the merits or otherwise of providing such a reference form in the first place.
>As far as I can see, the ASLG only documents the "text from ... to ..."
>form.
That's not a shortcut, that's a synonym; a cute but functionally-useless syntactic parlour trick. Shortcuts actually serve a useful purpose, for example, allowing users to omit the self-evident 'at end of documents' parameter in a 'make new document' command.
In the case of by-range references, the AEOM actually requires start and end points to be provided as references relative to the elements' container, but it's usually possible to collapse these down so that scripters need only write 'elements x thru y' instead of the ugly, verbose 'elements (element x) thru (element y)'.
Hope that clarifies what's what I mean by 'shortcut'.
>The shortcut's use of the term normally used to return lists only
>causes confusion, IMO. It's too late, but I'd rather have seen the "text
>from ..." form required everywhere; any shortcut should have avoided the
>word through/thru.
Creating such a distinction in the original AppleScript and AEOM specs might have been useful. One can certainly make a good case that those specs should've been more restrictive in their design - some loss in freedom hopefully being more than compensated for by improved reliability, consistency and simplicity.
Under the current loose guidelines it's up to the individual language/application/osax command to return whatever sort of value(s) makes most sense for a particular query. And one can also make a pretty good case for this approach; either way it's a tradeoff. Bear in mind that excess dogmatism can also be counterproductive; e.g. witness the general lameness of the default Cocoa Text Suite: it may follow the letter of the law, but that doesn't mean it was the right or useful thing to do for users.
As usual, in almost all cases the major problem is the lack of user documentation worth a damn. Without adequate documentation, users are left with little but guesswork, folk wisdom and old wives' tales to rely on, so it's no surprise they should end up making all sorts of potentially unsafe assumptions - or be bitten by some of them later on. (But I'm sure folk already know my recommended solution to that.)
Regards,
has
--
http://freespace.virgin.net/hamish.sanderson/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden