D - Parentheses for assert
- Piotr Fusik (3/3) Mar 12 2004 Why the parentheses are required for the assert's parameter?
- J Anderson (6/10) Mar 12 2004 I guess that could be made optional but how much would we gain from this...
- =?ISO-8859-1?Q?Sigbj=F8rn_Lund_Olsen?= (6/18) Mar 12 2004 It would look a lot more like *my favourite language* - isn't that the
- Piotr Fusik (5/13) Mar 13 2004 1. Shorter code, easier to write and read.
- C. Sauls (15/35) Mar 13 2004 From the D specification, Overview, under "Features to Keep...":
- J Anderson (5/8) Mar 13 2004 Both will cause termination of the current function, although assert
- Piotr Fusik (4/9) Mar 14 2004 .. and both take just one expression as a parameter, thus making the
- Matthew (7/18) Mar 14 2004 so far. There is lots of work to do with asserts, and it is highly likel...
- Manfred Nowak (7/9) Mar 15 2004 What about locally inhibiting the usual LR lexical analysis? May allow
Why the parentheses are required for the assert's parameter? It looks like using parentheses for return - some people do it. In Java, I'm used to writing assert without parentheses.
Mar 12 2004
Piotr Fusik wrote:Why the parentheses are required for the assert's parameter?It's something inherited from C.It looks like using parentheses for return - some people do it. In Java, I'm used to writing assert without parentheses.I guess that could be made optional but how much would we gain from this style change? -- -Anderson: http://badmama.com.au/~anderson/
Mar 12 2004
J Anderson wrote:Piotr Fusik wrote:It would look a lot more like *my favourite language* - isn't that the only reason worth paying attention to? Cheers, Sigbjørn Lund Olsen (Beware: This post contains irony.)Why the parentheses are required for the assert's parameter?It's something inherited from C.It looks like using parentheses for return - some people do it. In Java, I'm used to writing assert without parentheses.I guess that could be made optional but how much would we gain from this style change?
Mar 12 2004
C's assert is a macro, not a language construct. If I understood well, strict compatibility with C at source level is not a design goal of D.Why the parentheses are required for the assert's parameter?It's something inherited from C.1. Shorter code, easier to write and read. 2. No problems for people that are used to writing no parentheses after assert. 3. Consistency with return.It looks like using parentheses for return - some people do it. In Java, I'm used to writing assert without parentheses.I guess that could be made optional but how much would we gain from this style change?
Mar 13 2004
Comments imbedded: Piotr Fusik wrote:From the D specification, Overview, under "Features to Keep...": - The general look and feel of C/C++ will be maintained.C's assert is a macro, not a language construct. If I understood well, strict compatibility with C at source level is not a design goal of D.Why the parentheses are required for the assert's parameter?It's something inherited from C.assert (someObj.member != someConst); assert someObj.member != someConst; Mm.1. Shorter code, easier to write and read.It looks like using parentheses for return - some people do it. In Java, I'm used to writing assert without parentheses.I guess that could be made optional but how much would we gain from this style change?2. No problems for people that are used to writing no parentheses after assert. 3. Consistency with return.What is the relationship between assert(); and return; though? I don't remember there being any connection between the foundation contract statement and the procedure conclusion statement... Personally I'm a fan of parenthesis in certain places... like if(), for(), foreach(), while(), assert(), and yes I've even been known to do return(). -C. Sauls -Invironz
Mar 13 2004
C. Sauls wrote:What is the relationship between assert(); and return; though? I don't remember there being any connection between the foundation contract statement and the procedure conclusion statement...Both will cause termination of the current function, although assert will cause termination of the current program as well. -- -Anderson: http://badmama.com.au/~anderson/
Mar 13 2004
.. and both take just one expression as a parameter, thus making the parentheses redundant. The parentheses are needed for if() and like to make the syntax unambiguous. For all the fans of parentheses out there, why not support break(), continue() etc.? ;-))What is the relationship between assert(); and return; though? I don't remember there being any connection between the foundation contract statement and the procedure conclusion statement...Both will cause termination of the current function, although assert will cause termination of the current program as well.
Mar 14 2004
"Piotr Fusik" <Piotr_member pathlink.com> wrote in message news:c31ubr$t5t$1 digitaldaemon.com...so far. There is lots of work to do with asserts, and it is highly likely that there'll be multi-parameter versions coming along thus making the.. and both take just one expression as a parameter,What is the relationship between assert(); and return; though? I don't remember there being any connection between the foundation contract statement and the procedure conclusion statement...Both will cause termination of the current function, although assert will cause termination of the current program as well.parentheses redundant. The parentheses are needed for if() and like tomake thesyntax unambiguous. For all the fans of parentheses out there, why notsupportbreak(), continue() etc.? ;-))
Mar 14 2004
Piotr Fusik wrote: [...]1. Shorter code,What about locally inhibiting the usual LR lexical analysis? May allow even shorter code by not needing spaces :-)easier to write and read.[...] Do you have an objective measure for `easy'? So long.
Mar 15 2004