chris@umcp-cs.UUCP (07/12/86)
In article <1003@zog.cs.cmu.edu> dlc@zog.cs.cmu.edu (Daryl Clevenger) writes: > I dislike Pascal as much as the next C hacker, but one feature >that could be useful to add to C is something akin to the Pascal >"WITH" statement. ... By using such a construct, one avoids long >statements when using deeply nested structures/unions or the kludgy >method of using defines. I never did like `with'. I would like it a lot more if . . . well, let me see if I can construct a good bad example first. type x = record ... end; y = record ... end; z = record ... end; var foo : x; zarog : y; prullo : z; { several hundred pages of code } with foo, zarog, prullo do begin ... { next three statments use fields } snert := 5 * bazzi; bibble := 10; roj := klewp mod snert; ... end; ... To which variables do those fields refer? If `with' is intended as shorthand, I would like to see it used in more this way: with a = foo, b = zarog, c = prullo do begin ... b.snert = 5 * a.bazzi; c.bibble := 10; a.roj := c.klewp mod b.snert; Note that this allows member name `collisions' to be disambiguated: b.snert = 5 * a.bazzi; c.bibble := 10; a.roj = c.klewp mod a.snert; ---if that is in fact what is meant. (I have a feeling that `WITH' originally meant `Listen, compiler, put a pointer to this here record into a machine register now, because I am about to use it a whole bunch.') -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1516) UUCP: seismo!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris@mimsy.umd.edu
chris@umcp-cs.UUCP (07/12/86)
In article <2366@umcp-cs.UUCP> I wrote: > b.snert = 5 * a.bazzi; > c.bibble := 10; > a.roj = c.klewp mod a.snert; Whoops: my C-mindset is showing. Make that those all `:=' (and likewise for the one unquoted b.snert line). -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1516) UUCP: seismo!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris@mimsy.umd.edu