Path: utzoo!attcan!uunet!mcsun!sunic!draken!ianf From: ianf@nada.kth.se (Ian Feldman) Newsgroups: comp.sys.mac.hypercard Subject: Re: "Initialize" for HyperTalk Keywords: wish list Message-ID: <2371@draken.nada.kth.se> Date: 21 Nov 89 21:11:09 GMT References: <1827@gazette.bcm.tmc.edu> Reply-To: ianf@nada.kth.se (Ian Feldman) Organization: Royal Institute Of Technology, Stockholm, Sweden Lines: 50 Cc: ianf@draken jgsmith@watson.bcm.tmc.edu (James G. Smith) writes: > >Dear Apple, > > One thing I would like for Christmas is an "Initialize" command for >HyperTalk. I'm tired of scripting: > >put empty into temp1 >put empty into temp2 >put empty into temp3 > >when I could just say > >initialize temp1,temp2,temp3 I have to disagree with that, strongly. The present requirement of conceptually putting "empty" into a container is, how strange it may sound, at least consistent with the rest of the HyperTalk syntax. Replacing that with an express "initialization" of same would introduce a concept that is quite foreign to the way people start up processes, in coding as well as in life. We do not, after all, initialize a car before going on a journey, nor do we initialize a book prior to reading it. HyperCard is supposed to be a common man's software erector kit. No need therefore to complicate matters further. There is enough complexity in the HyperTalk as it is. You might consider the following construct as the solution to your personal wish: Create a hidden, background, field that holds the names of all your variables to be initialized, delimited by commas ("items"). Put the following two handlers in the Scrapbook for import into each and every one of your stacks' scripts (select stack- or first-card's background scripts). The code will work in any stack as long as there is a field in the hierarchy, corresponding to the given name. on action -- pick a condition that's true only once per run initialize -- name of handler in same, or higher placed, script end action on initialize repeat with i= 1 to the number of items in fld "variables_to_init" put empty into (item i of fld "variables_to_init") end repeat end initialize --Ian Feldman / ianf@nada.kth.se || uunet!nada.kth.se!ianf / "Let's get out of this place and nuke it from orbit" -- Alien