1 Aug 2006 15:30
Re: C-style condition expressions
Ingo <i.maier <at> gmx.de>
2006-08-01 13:30:48 GMT
2006-08-01 13:30:48 GMT
Lex Spoon wrote: > Andrew Lentvorski <bsder <at> allcaps.org> writes: >> As an aside, what stops ":" from being an operator? This seems like a >> larger problem of being unable to add reasonable syntax >> extensions. Although, that's probably treading close to Lisp-macro >> territory. > > ":" means that you are about to see a type, e.g.: > > 3 + 4 > (3:int) + 4 > (3 : int) + 4 > > > Switching worlds between types and values is highly significant. > Reusing ":" for anything else would seem at least as confusing as your > description of reusing "!" . > > > Other ideas? > > bool ? truecase _____ falsecase > > > What should go in the blank? Or maybe the ? should be changed as > well, if the C implication is just too strong? Here's a funny > one: > > > bool -> truecase !-> falsecase > > > Other ideas? > > > -Lex > > I really like the question mark, seems quite intuitive to me. ":" or "!" is used to separate alternatives, so: "/" is sometimes used to indicate an alternative, like in "Mr/Ms ____" for example. Unfortunately, "/" is used as the division operator and "//" as a comment intro, so maybe some other sequence containing it, e.g., well ? yes -/- no but I can't think of one I prefer over "!". BTW, is backslash "\" reserved or used somewhere other than escape sequences? Maybe one of these: well ? yes \ no well ? yes \\ no Ingo
RSS Feed