• 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: script object properties: seeking confirmation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: script object properties: seeking confirmation


  • Subject: Re: script object properties: seeking confirmation
  • From: Arthur J Knapp <email@hidden>
  • Date: Wed, 06 Mar 2002 16:11:35 -0500

> Date: Wed, 6 Mar 2002 15:20:43 +0000
> From: has <email@hidden>
> Subject: Re: script object properties: seeking confirmation

>>> Bill Hoffman wrote:
>>>
>>>> I can't dynamically create a new property of an object at
>>>> runtime in this manner (like I could in JavaScript, for example, with
>>>> "this.income = 500;")
>>
>>> Don't think so. I'm curious though why you'd want to avoid declaring your
>>> object's properties at compile time.

> Arthur J Knapp wrote:
>
>> I am surprised at you, has. ;-)


> Oh tsk, Arthur. You of all people should know that:
>
> this.income != this["income"]

Do you have a JavaScript runtime environment handy?

function Obj( income_amount )
{ this.income = income_amount;
}

var o1 = new Obj( 500 )

var o2 = new Object;
o2.income = 500;

var o3 = {"income":500}

o1.toSource() // "({income:500})"
o2.toSource() // "({income:500})"
o3.toSource() // "({income:500})"

> The underlying implementation may be similar (hash tables, etc), but how
> they act is not.

This is exactly the opposite of what I was saying. Regardless of
implementation, there is no *conceptual* reason for someone to have to
think of an object's properties as being different from a record's:

set ASRecord to {a:1, b:2}

script ASObject
property a : 1
property b : 2
end script

a of ASRecord = a of ASObject -- true

*Conceptually*, an object is simply a more powerful type of
record, in that it carries around it's own commands.

In this sense, I don't see why any future upgrade to AppleScript
that includes dynamically settable record-properties should be
lacking in dynamically settable object-properties.


{ Arthur J. Knapp, of <http://www.STELLARViSIONs.com>
<mailto:email@hidden>
try
<http://www.facespan.com/>
on error number -128
end try
}
_______________________________________________
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: script object properties: seeking confirmation
      • From: Andy Wylie <email@hidden>
  • Prev by Date: Re: Palm Desktop & Eudora
  • Next by Date: Re: Distiller Joboptions
  • Previous by thread: Re: script object properties: seeking confirmation
  • Next by thread: Re: script object properties: seeking confirmation
  • Index(es):
    • Date
    • Thread