www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Is this a bug or a feature?

reply Daniel Murphy <yebbliesnospam gmail.com> writes:
The following code compiles under dmd v2.037, no closing brace required.

---------------
import std.stdio;

void main()
{
	while(true)
		writeln("Bug!");
---------------

Bug, or feature for the extremely lazy?
Jan 07 2010
next sibling parent "Lars T. Kyllingstad" <public kyllingen.NOSPAMnet> writes:
Daniel Murphy wrote:
 The following code compiles under dmd v2.037, no closing brace required.
 
 ---------------
 import std.stdio;
 
 void main()
 {
 	while(true)
 		writeln("Bug!");
 ---------------
 
 Bug, or feature for the extremely lazy?
It could be the same as bug 3542: http://d.puremagic.com/issues/show_bug.cgi?id=3542 -Lars
Jan 07 2010
prev sibling next sibling parent reply =?UTF-8?B?UGVsbGUgTcOlbnNzb24=?= <pelle.mansson gmail.com> writes:
On 01/07/2010 02:04 PM, Daniel Murphy wrote:
 The following code compiles under dmd v2.037, no closing brace required.

 ---------------
 import std.stdio;

 void main()
 {
 	while(true)
 		writeln("Bug!");
 ---------------

 Bug, or feature for the extremely lazy?
I bumped into this myself the other day, I find it being quite a feature. If nothing else, it's kinda cool!
Jan 07 2010
parent Bane <branimir.milosavljevic gmail.com> writes:
Pelle MÃ¥nsson Wrote:

 On 01/07/2010 02:04 PM, Daniel Murphy wrote:
 The following code compiles under dmd v2.037, no closing brace required.

 ---------------
 import std.stdio;

 void main()
 {
 	while(true)
 		writeln("Bug!");
 ---------------

 Bug, or feature for the extremely lazy?
I bumped into this myself the other day, I find it being quite a feature. If nothing else, it's kinda cool!
It is new neural reader algorithm. It completes source code in the moment of compilation by analyzing coder's brain waves. It is not documented yet, so many people assume it is bug.
Jan 07 2010
prev sibling next sibling parent Sean Kelly <sean invisibleduck.org> writes:
Daniel Murphy Wrote:

 The following code compiles under dmd v2.037, no closing brace required.
 
 ---------------
 import std.stdio;
 
 void main()
 {
 	while(true)
 		writeln("Bug!");
 ---------------
 
 Bug, or feature for the extremely lazy?
That's just in there to put a new spin on the halting problem.
Jan 07 2010
prev sibling parent reply Ellery Newcomer <ellery-newcomer utulsa.edu> writes:
On 01/07/2010 07:04 AM, Daniel Murphy wrote:
 The following code compiles under dmd v2.037, no closing brace required.

 ---------------
 import std.stdio;

 void main()
 {
 	while(true)
 		writeln("Bug!");
 ---------------

 Bug, or feature for the extremely lazy?
in parse.c, Parser::parseStatement, around line 3533, there be case TOKlcurly: { nextToken(); Statements *statements = new Statements(); while (token.value != TOKrcurly && token.value != TOKeof) { statements->push(parseStatement(PSsemi | PScurlyscope)); } ..... don't know why the TOKeof is there, but that's what's causing the issue.
Jan 07 2010
parent Don <nospam nospam.com> writes:
Ellery Newcomer wrote:
 On 01/07/2010 07:04 AM, Daniel Murphy wrote:
 The following code compiles under dmd v2.037, no closing brace required.

 ---------------
 import std.stdio;

 void main()
 {
     while(true)
         writeln("Bug!");
 ---------------

 Bug, or feature for the extremely lazy?
in parse.c, Parser::parseStatement, around line 3533, there be case TOKlcurly: { nextToken(); Statements *statements = new Statements(); while (token.value != TOKrcurly && token.value != TOKeof) { statements->push(parseStatement(PSsemi | PScurlyscope)); } ..... don't know why the TOKeof is there, but that's what's causing the issue.
It's there to prevent malformed mixins from causing an infinite loop. Seems like it should be replaced with an error message: while (token != rcurly) { if (token==TOKeof) { error("} expected"); break;} statements->push() }
Jan 07 2010