• 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: number
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: number


  • Subject: Re: number
  • From: "Nigel Garvey" <email@hidden>
  • Date: Mon, 26 Sep 2005 23:02:51 +0100

kai wrote on Sun, 25 Sep 2005 21:12:14 +0100:

>On 23 Sep 2005, at 21:25, Nigel Garvey wrote:
>
>> kai wrote on Thu, 22 Sep 2005 23:17:52 +0100:
>>
>>> Or:
>>>
>>> -(a reference to o's x)
>>>
>>
>> So only _compiled_ references are affected.
>
>I'm not so sure, Nigel. The coercion failure of a real, as well as
>the whole-number real to integer coercion that you identified, both
>manifest themselves in the following reference examples:
>
>--------------
>
>-({x:1.2}'s x)
>--> error number -1700
>
>-({x:1.0}'s x)
>--> -1
>
>--------------
>
>-({1.2}'s item 1)
>--> error number -1700
>
>-({1.0}'s item 1)
>--> -1
>
>--------------
>
>set x to "1.2"
>-(x's text)
>--> error number -1700
>
>set x to "1.0"
>-(x's text)
>--> -1
>
>--------------

Well. Just to argue the point. :-) Those don't look like "coercion
failures of reals" to me, but resolution failures of references. In each
case, the negation is applied to a reference form in the script that
doesn't have an explicit or implied operator to get the value for
negation. Once there's an actual _value_, everything works properly and
any necessary coercions are performed -- even when that value is itself a
reference:

  -(a reference to {x:1.2}'s x)
  --> -1.2

  set x to "1.2"
  -(a reference to x's text)
  --> -1.2

'a reference to' is a run-time operator that returns ("gets") a value of
class reference, as opposed to some compiled script code.

The mystery for me is: why doesn't the "compiled reference" problem apply
when the items referred to have whole-number values, even when those
values are in text form? And why are whole-number reals coerced to integer?

As a related aside, 'contents', although sometimes talked of as an
operator, is in fact a property (according to ASLG). So an expression
like 'contents of myRef' is itself a reference!

  set myRef to a reference to {x:1.2}'s x
  -(myRef) -- negate reference value
  --> -1.2

  -(contents of myRef) -- negate reference form in script
  --> "Can't make 1.2 into type number."

NG

 _______________________________________________
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

  • Follow-Ups:
    • Re: number
      • From: kai <email@hidden>
  • Prev by Date: Records
  • Next by Date: Help with a Unique (?) Mail Sending Script for Entourage, Please?
  • Previous by thread: Re: number
  • Next by thread: Re: number
  • Index(es):
    • Date
    • Thread