Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!att!cbnewsk!ech From: ech@cbnewsk.ATT.COM (ned.horvath) Newsgroups: comp.sys.mac.programmer Subject: Re: Standard File and Desk Accessories Message-ID: <446@cbnewsk.ATT.COM> Date: 12 Jun 89 21:28:15 GMT References: <13855@dartvax.Dartmouth.EDU> Organization: AT&T Bell Laboratories Lines: 46 > In article <2024@husc6.harvard.edu> siegel@endor.UUCP (Rich Siegel) writes: > This is not self-modifying code, because the location that's modified >is never executed. It's actually storing data in code space; this particular >trick WILL fail once an OS comes out that has separate code and data spaces, >but it's reasonably far off. From article <13855@dartvax.Dartmouth.EDU>, by earleh@eleazar.dartmouth.edu (Earle R. Horton): > Aha! So one of you A4-relative types admits that the trick will > fail someday! This makes my day... > It's just not real nice to write computer software which has a > shorter lifetime than it could have, had you coded it differently. > Modifying code space to store variables or Handles to variables seems > to save a lot of work in writing code for desk accessories and other > code resources today, but is the work saved worth the inevitable > aggravation that users will experience if and when the OS makes that > technique invalid? Will you be around to make sure the software you > have written gets re-coded properly at that time, and will you be able > to make sure that users receive upgrades in a timely manner? Perhaps > not... Are you having fun, Earle? Smugness ill-becomes you, unless you have a solution to the problem...if you do, please share it. The "A4-relative" bit is a perfectly wonderful technique for a non-app to maintain access to its global variables. All I need now is someplace for A4 to point at -- that's easy, there are two heaps to do NewHandle in -- and some mechanism in the OS to preserve the value of A4 when I'm not executing. Apple provides no such mechanism. For APPLs, there's A5. For DRVRs, there's the Device control block, and the Handle to data storage. For everything else, there's nada. Not even owned resources for most things. What Aztec, and lately Think, have done is to store the handle to the globals in the only place that belongs to a CODE resource: in the resource itself. Someday Apple may want to separate data from code, so the latter can be write-protected. Presumably, at least 90 days prior to that day, Apple will give us the means to tell the OS just where one ends and the other begins. And if there's anybody sane in charge, along with that, will go some way for the code to find the data. Unless you can propose a mechanism that both works with the benevolent neglect the OS provides today, and is also going to work when the OS grows up. =Ned Horvath=