• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: String to multiple-item list coercion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: String to multiple-item list coercion


  • Subject: Re: String to multiple-item list coercion
  • From: has <email@hidden>
  • Date: Fri, 27 Sep 2002 16:09:07 +0100

Paul Skinner wrote:

>The oddity is that the 'result'
>of this statement is not the actual result. The functional result of
>this is that myPath is now <plain text> but the 'result' returned by
>the line is actually the 'result' of the '(text of myPath) as string'
>statement.

That's to be expected; the result is the result of the operation which
occurs on the right. The bit on the left, assuming there is one, is
responsible for assigning that result value to a variable, or variables, of
your own choosing.


Going back to abstract language debating for a moment, I'm not sure if AS's
'result' variable is a good idea or not.

1. It's another of those things in AS that's rather inconsistent: some
operations/structures return a result, others do not. It'd be much more
prudent _always_ to return a result value, or _never_ return one at all.

2. Another problem with AS's 'result' variable is that it's globally
scoped, which can introduce the most perverse and non-obvious bugs for
certain situations.

For these reasons, along with improving legibility (i.e. nowt like sticking
in a well-named variable to clarify a piece of code's purpose), I tend to
use 'result' less and less now, preferring to assign any values I intend to
use again to my own variables. The only real advantage I can think of with
'result' is that it may be very slightly faster than assigning to a user
variable, which might be of value in deeply nested loops where squeezing
every last bit of performance is an absolute requirement. But most cases...
nope.

HTH

has

--
http://www.barple.pwp.blueyonder.co.uk -- The Little Page of AppleScripts
_______________________________________________
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.

  • Follow-Ups:
    • Re: String to multiple-item list coercion
      • From: John W Baxter <email@hidden>
  • Prev by Date: Re: String to multiple-item list coercion
  • Next by Date: Re: Sending Control-T to Terminal
  • Previous by thread: Re: String to multiple-item list coercion
  • Next by thread: Re: String to multiple-item list coercion
  • Index(es):
    • Date
    • Thread