Path: utzoo!mnetor!uunet!husc6!cca!g-rh From: g-rh@cca.CCA.COM (Richard Harter) Newsgroups: comp.lang.c Subject: Re: The D Programming Language: cases Message-ID: <25200@cca.CCA.COM> Date: 3 Mar 88 05:12:05 GMT References: <222965b9@ralf.home> <2403@umd5.umd.edu> Reply-To: g-rh@CCA.CCA.COM.UUCP (Richard Harter) Organization: Computer Corp. of America, Cambridge, MA Lines: 38 In article <2403@umd5.umd.edu> chris@trantor.umd.edu (Chris Torek) writes: >-In article <24996@cca.CCA.COM> g-rh@cca.CCA.COM (Richard Harter) writes: >-}As a side point, I like the suggestion that someone made that there be >-}a fallthrough statement rather than automatic fallthrough. >While this would work, if we assume D has aggregate constructors, >there is a handsomer way: > switch (e) { > case [1, 2, 3, 5, 7, 13, 19, 23]: ... > } > /* syntax above is only for demonstration */ Well, yes, one ought to be able to do that. However it is isn't quite as strong as fallthrough, where one can say switch (e) { case foo: some code; fallthrough; case baz: some more code; } In C as it stands now you can do this -- indeed, the complaint is that one can do this unintentionally. If one adds aggregate constructors and takes away automatic fallthrough, it seems to me that you weaken the language. No doubt there are purists that say you shouldn't do the sort of thing given above. I wouldn't go that far, but I would agree that one should be able to use aggregate constructors when cases actually share code. -- In the fields of Hell where the grass grows high Are the graves of dreams allowed to die. Richard Harter, SMDS Inc.