• 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 Objects - help please!!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Script Objects - help please!!


  • Subject: Re: Script Objects - help please!!
  • From: Simon Forster <email@hidden>
  • Date: Mon, 13 Jun 2005 08:38:20 +0100


On 12 Jun 2005, at 22:12, has wrote:

Dynamic lookup starts at the currently targetted script object and searches along its inheritance chain until it finds the desired variable (or runs out of places to look). Example:

script Foo
    property x : 1
    property y : 2

on getX()
return x -- permanently bound to Foo's property x at compile-time
end getX


on getY()
return my y -- looked up at runtime, starting with original recipient of getY message
end getY
end script


script Bar
    property parent : Foo
    property x : 10
    property y : 20
end script

tell Bar to {getX(), getY()} --> {1, 20}


(Overriding properties is bad design, mind; the above example is merely to demonstrate the differences in how lexical vs dynamic binding works.)




Is this likely to come back and bite me? Should I just go through my library script and delete all these unnecessary "of me"s? (A bit of a shot in the dark for you without seeing the entire context but I'd like to hear your opinion).


I doubt it will make a difference in your case. Though as a general principle of good design, one should avoid unnecessary code.


If you're curious to see practical examples of library and OO design, check out AppleMods' libraries <http:// applemods.sourceforge.net/>; some interesting stuff there. e.g. The Types library has some good basic OO code in it.

Thanks for the info - got it sorted now. I've downloaded the Types library, had a look through it and stored it for future ref.


What can I say... except thank you for your patience and guidance.

ATB

Simon Forster
_____________________________________________________
 LDML Ltd, 62 Pall Mall, London, SW1Y 5HZ, UK
 Tel: +44 (0)70 9230 5244   Fax: +44 (0)70 9230 5247
_____________________________________________________

_______________________________________________
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


References: 
 >Re: Script Objects - help please!! (From: has <email@hidden>)

  • Prev by Date: Re: Script Objects - help please!!
  • Next by Date: get a parameter from script object
  • Previous by thread: Re: Script Objects - help please!!
  • Next by thread: Controlling execution priority of a script
  • Index(es):
    • Date
    • Thread