Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!cmcl2!harvard!seismo!mcvax!ukc!cstvax!db From: db@cstvax.UUCP (Dave Berry) Newsgroups: net.lang Subject: Re: and if you put this in your language ... Message-ID: <87@cstvax.UUCP> Date: Tue, 25-Mar-86 12:12:01 EST Article-I.D.: cstvax.87 Posted: Tue Mar 25 12:12:01 1986 Date-Received: Sun, 20-Apr-86 07:29:06 EST References: <1187@mmintl.UUCP> <800009@ccvaxa> <6843@boring.UUCP> Reply-To: db@cstvax.UUCP (Dave Berry) Organization: Comp. Sc., Edinburgh Univ., Scotland Lines: 39 In article <6843@boring.UUCP> lambert@boring.UUCP (Lambert Meertens) writes: >In article <800009@ccvaxa> aglew@ccvaxa.UUCP writes: >> but if Z is not simply a function call then you have to make sure that two >> copies of code get updated. That's what macros are for [...] > >Some languages have "refinements", which are somewhat like macros but they >really are part of the language and do not get expanded by a preprocessor. Isn't it simpler to have a parameterless procedure with no local variables and a compiler that recognises such things? Maybe with pragmas giving the user control over the optimisation if you want it? Procedures handle sequential abstraction fine. Want you seem to be after is greater control over the way they're implemented. You don't have to allocate a new frame on the stack just because you call a procedure, if there is nothing to put in it! Maybe I've spent too long programming in functional languages, where you have to do things like this (and tail recursion optimisation similarly) to get decent performance. (Lambert's example, to refresh your memories. This is the last I say). > > SELECT: > a: > X > SELECT: > b: Y > ELSE: Z > ELSE: Z > ... > X: > Y: > Z: > >X and Y may be expanded in place, but for Z this gives code duplication. -- Dave Berry. CS postgrad, Univ. of Edinburgh ...mcvax!ukc!cstvax!db