Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!brl-adm!brl-smoke!smoke!rbbb@rice.ARPA From: rbbb@rice.ARPA (David Chase) Newsgroups: net.lang.c Subject: Another stupid language proposal Message-ID: <3129@brl-smoke.ARPA> Date: Mon, 18-Aug-86 09:13:02 EDT Article-I.D.: brl-smok.3129 Posted: Mon Aug 18 09:13:02 1986 Date-Received: Wed, 20-Aug-86 05:07:36 EDT Sender: news@brl-smoke.ARPA Lines: 34 As long as people are talking about using expressions as conditionals (the ? void : void discussion), how about using commands as expressions? I'm not talking about little, wimpy commands like "a = b"; I'm talking about real commands, like "{ ... }" where that little ellipsis might be pages of code. I'm talking about VALOF/RESULTIS (get out your history books, C hackers. That's BCPL there). As a quick review, this construction is used in this manner: a = VALOF command where "command" is any command that can contain a RESULTIS command. Thus you can have SWITCH statements, FOR loops, WHILE loops, or just compound statements that return values, with no restriction on the number of RESULTIS's or their placement, as long as they are in the block. The command executes until a "RESULTIS expression" is encountered, at which point the value of "expression" is returned as the value of the VALOF. Actually, in C that would be VALOF/RETURN, except that RETURN isn't guaranteed to return a value, and I'm sure many people would feel terribly constrained by not being able to blow clean out of a subroutine with one statement. It's unlikely that many C programmers have used such an animal, so many people reading this list probably won't appreciate it. I have used it, and it is very handy. Other than the fuss and bother of adding another piece of gunk to the language, is there any reason NOT to add this? I also realize that this is a bit of a hefty feature to go proposing for ANSI C, so I am just asking people to think about it. Maybe in the future, you know. Fortran made it from 66 to 77 and they're planning an 88 (I've seen a draft of the standard, though it doesn't specifically mention 1988 yet, you KNOW it will happen then). David