Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Dumb newbie Rebol question

From: andrew:martin:colenso:school at: 5-Sep-2003 15:31

parki wrote:
> 2. Any way to enforce some sort of Singleton idiom? I suspect that
asking this (and perhaps the above) are caused by not enough indoctrination to the Rebol way of doing things, but wondering... I am going to put the serial connection code into an object (again, keep namespaces clean) and in Java, I'd make this a Singleton, as I only want one serial connection open. Not sure how this should be tackled in Rebol. I'd have it something like this: Your outside script does something like this: do %X10.r ; Call the X10 script. And your %X10.r script looks something like this: Rebol [ File: %X10.r ;... ] if not value? 'X10 [ X10: make object! [ ] ] So, even if the outside script does silly things like this: do %X10.r ; Call the X10 script. do %X10.r ; Call the X10 script. do %X10.r ; Call the X10 script. You'll only get the one object referred to by the word 'X10. I hope that helps! Andrew J Martin Attendance Officer & Information Systems Trouble Shooter Colenso High School Arnold Street, Napier. Tel: 64-6-8310180 ext 826 Fax: 64-6-8336759 DISCLAIMER: Colenso High School and its Board of Trustees is not responsible (or legally liable) for materials distributed to or acquired from user e-mail accounts. You can report any misuse of an e-mail account to our ICT Manager and the complaint will be investigated. (Misuse can come in many forms, but can be viewed as any material sent/received that indicate or suggest pornography, unethical or illegal solicitation, racism, sexism, inappropriate language and/or other issues described in our Acceptable Use Policy.) All outgoing messages are certified virus-free by McAfee GroupShield Exchange Phone: +64 6 843 5095 or Fax: +64 6 833 6759 or E-mail: [postmaster--colenso--school--nz]