Re: Should unreachable code be considered an error?

2011-08-19 Thread Bernard Helyer
On Sat, 20 Aug 2011 01:42:56 +0100, Stewart Gordon wrote: > So essentially you're looking to catch cases where, if you consider the > function as a flow chart, there is no chain of arrows from the start of > the function to the statement in question. That should be > straightforward. But you're

Re: Native Client in Chrome Beta

2011-08-19 Thread Nick Sabalausky
"Marco Leise" wrote in message news:op.v0f018nh9y6...@dslb-088-070-152-209.pools.arcor-ip.net... > >"By not adopting a technology capable of competing with native apps on iOS, Android, Windows, and Mac, web vendors are preventing important classes of applications such as high-end games and simula

Re: More name hiding

2011-08-19 Thread bearophile
nsf: > Well, D currently says I can't shadow variables: Right, that's a third way to shadow variables that D forbids, thank you. But in my post I've shown other kinds of shadowing that currently D accepts. Shadowing global variables has caused some problems in my C code. One good commercial C

Re: More name hiding

2011-08-19 Thread nsf
On Fri, 19 Aug 2011 11:07:12 -0400 bearophile wrote: > Some ways to face this problem: > > 1) Do nothing. > 2) Give optional explicit information about the source of all variable names > used in a function, using the optional @outer() I have proposed elsewhere. > 3) Statically disallow (gives a

Allocators in Phobos

2011-08-19 Thread David Simcha
I've massively improved my RegionAllocator (formerly TempAlloc) module thanks to the excellent suggestions from Andrei and from Dimitri Olshansky (the GSoC student working on regexes). For the curious: http://cis.jhu.edu/~dsimcha/d/phobos/std_regionallocator.html https://github.com/dsimcha/TempAl

Re: Optional braces

2011-08-19 Thread Mehrdad
On 8/19/2011 8:29 AM, Timon Gehr wrote: On 08/19/2011 05:12 PM, Andrei Alexandrescu wrote: On 8/19/11 1:50 AM, Jacob Carlborg wrote: This might sound like a crazy idea. I don't expect everyone to drop what they're doing and start to implement this, it's just an idea. In Java (C, C++ and other

Re: More name hiding

2011-08-19 Thread Mehrdad
On 8/19/2011 8:17 AM, Andrej Mitrovic wrote: It's not just globals. It's hiding fields as well: class A { int x; this() { int x; //<- hides this.x } } I've had this happen during a cut/paste session, which happens when I'm refactoring my code. I actually use this o

Re: Should unreachable code be considered an error?

2011-08-19 Thread Stewart Gordon
On 18/08/2011 13:19, Bernard Helyer wrote: I'm talking about the unambiguous cases, the ones where a basic block has no parents (i.e. there is no way to enter that code block). So essentially you're looking to catch cases where, if you consider the function as a flow chart, there is no chain

Re: CURL review request

2011-08-19 Thread Jonathan M Davis
On Friday, August 19, 2011 15:27 Timon Gehr wrote: > On 08/19/2011 10:36 PM, Jonathan M Davis wrote: > > On Friday, August 19, 2011 04:58 Timon Gehr wrote: > >> On 08/19/2011 01:50 AM, Jonathan M Davis wrote: > >>> On Thursday, August 18, 2011 16:00 Timon Gehr wrote: > On 08/19/2011 12:35 AM,

Re: newsgroup availability

2011-08-19 Thread Jeff Nowakowski
On 08/19/2011 02:51 PM, filgood wrote: Yes, I've also had the same error in the last few days...maybe we can have a mirror (that is sync'd regularly)? ~filgood It's available through Gmane: nntp://news.gmane.org/gmane.comp.lang.d.general

Re: CURL review request

2011-08-19 Thread Timon Gehr
On 08/19/2011 10:36 PM, Jonathan M Davis wrote: On Friday, August 19, 2011 04:58 Timon Gehr wrote: On 08/19/2011 01:50 AM, Jonathan M Davis wrote: On Thursday, August 18, 2011 16:00 Timon Gehr wrote: On 08/19/2011 12:35 AM, Jonathan M Davis wrote: On Thursday, August 18, 2011 14:33 jdrewsen w

Re: CURL review request

2011-08-19 Thread Jonathan M Davis
On Friday, August 19, 2011 04:58 Timon Gehr wrote: > On 08/19/2011 01:50 AM, Jonathan M Davis wrote: > > On Thursday, August 18, 2011 16:00 Timon Gehr wrote: > >> On 08/19/2011 12:35 AM, Jonathan M Davis wrote: > >>> On Thursday, August 18, 2011 14:33 jdrewsen wrote: > Den 17-08-2011 18:21, Ti

Re: CURL review request

2011-08-19 Thread jdrewsen
Den 18-08-2011 20:12, Martin Nowak skrev: On Tue, 16 Aug 2011 13:48:57 +0200, Jonas Drewsen wrote: Hi all, This is a review request for the curl wrapper. Please read the "known issues" in the top of the source file and if possible suggest a solution. We also need somebody for running the rev

Re: CURL review request

2011-08-19 Thread jdrewsen
Den 19-08-2011 00:55, Timon Gehr skrev: On 08/18/2011 11:33 PM, jdrewsen wrote: Den 17-08-2011 18:21, Timon Gehr skrev: On 08/17/2011 05:58 PM, Jonathan M Davis wrote: On Wednesday, August 17, 2011 11:30:06 Steven Schveighoffer wrote: On Wed, 17 Aug 2011 11:05:56 -0400, jdrewsen wrote: Den 1

Re: newsgroup availability

2011-08-19 Thread Steven Schveighoffer
On Fri, 19 Aug 2011 15:18:34 -0400, Marco Leise wrote: Am 19.08.2011, 17:15 Uhr, schrieb Stijn Herreman : On 19/08/2011 16:18, kennytm wrote: Timon Gehr wrote: On 08/19/2011 03:44 PM, Steven Schveighoffer wrote: Has there been some strange issue with the newsgroup lately? Frequently, I

Re: newsgroup availability

2011-08-19 Thread Marco Leise
Am 19.08.2011, 17:15 Uhr, schrieb Stijn Herreman : On 19/08/2011 16:18, kennytm wrote: Timon Gehr wrote: On 08/19/2011 03:44 PM, Steven Schveighoffer wrote: Has there been some strange issue with the newsgroup lately? Frequently, I'm getting load errors (I assume this means the NG load is

Re: newsgroup availability

2011-08-19 Thread filgood
On 19/08/2011 14:44, Steven Schveighoffer wrote: Has there been some strange issue with the newsgroup lately? Frequently, I'm getting load errors (I assume this means the NG load is too large to deal with my communication). It seems to be happening daily... -Steve Yes, I've also had the same

Re: newsgroup availability

2011-08-19 Thread Jacob Carlborg
On 2011-08-19 15:44, Steven Schveighoffer wrote: Has there been some strange issue with the newsgroup lately? Frequently, I'm getting load errors (I assume this means the NG load is too large to deal with my communication). It seems to be happening daily... -Steve I'm getting the same error.

Re: Optional braces

2011-08-19 Thread Jacob Carlborg
On 2011-08-19 16:33, kennytm wrote: Trass3r wrote: Am 19.08.2011, 14:16 Uhr, schrieb Timon Gehr: I think this makes code harder to read for no obvious benefit. I don't think this is any better than class Foo{ private int a_; int a(){return a_;} int a(int a){return a_ = a;} }

Re: Optional braces

2011-08-19 Thread Jacob Carlborg
On 2011-08-19 17:12, Andrei Alexandrescu wrote: On 8/19/11 1:50 AM, Jacob Carlborg wrote: This might sound like a crazy idea. I don't expect everyone to drop what they're doing and start to implement this, it's just an idea. In Java (C, C++ and others) braces are optional for statements like if

Re: Should unreachable code be considered an error?

2011-08-19 Thread Sean Kelly
On Aug 18, 2011, at 10:29 AM, Nick Sabalausky wrote: > "Bernard Helyer" wrote in message > news:j2ithq$12kd$1...@digitalmars.com... >> I asked the Ars forums ( http://arstechnica.com/civis/viewtopic.php? >> f=20&t=1153378&p=21965411 ) and I ask the same of you: should >> unambiguously unreachabl

Re: Why do struct literals count as lvalues?

2011-08-19 Thread Trass3r
Am 19.08.2011, 14:50 Uhr, schrieb Timon Gehr : void foo(ref S); ... foo(S(...)); is equivalent to one explicitly declaring the temporary: {auto __temp=S(...); foo(__temp);} The difference is that the first is more pleasant to write. If temporaries would become rvalues everyone would always h

Re: Optional braces

2011-08-19 Thread Timon Gehr
On 08/19/2011 05:12 PM, Andrei Alexandrescu wrote: On 8/19/11 1:50 AM, Jacob Carlborg wrote: This might sound like a crazy idea. I don't expect everyone to drop what they're doing and start to implement this, it's just an idea. In Java (C, C++ and others) braces are optional for statements like

Re: Should unreachable code be considered an error?

2011-08-19 Thread maarten van damme
Why not a warning but when compiling using the -release flag throw an error? Sounds logical to me as unreachable code can be there because of debugging,etc but any released executable should not contain unreachable code. 2011/8/18 Don > Timon Gehr wrote: > >> On 08/18/2011 02:38 PM, Bernard Hely

Re: newsgroup availability

2011-08-19 Thread Stijn Herreman
On 19/08/2011 16:18, kennytm wrote: Timon Gehr wrote: On 08/19/2011 03:44 PM, Steven Schveighoffer wrote: Has there been some strange issue with the newsgroup lately? Frequently, I'm getting load errors (I assume this means the NG load is too large to deal with my communication). It seems to

Re: More name hiding

2011-08-19 Thread Andrej Mitrovic
It's not just globals. It's hiding fields as well: class A { int x; this() { int x; // <- hides this.x } } I've had this happen during a cut/paste session, which happens when I'm refactoring my code.

Re: Optional braces

2011-08-19 Thread Andrei Alexandrescu
On 8/19/11 1:50 AM, Jacob Carlborg wrote: This might sound like a crazy idea. I don't expect everyone to drop what they're doing and start to implement this, it's just an idea. In Java (C, C++ and others) braces are optional for statements like if, while, for and so on, containing only one expre

More name hiding

2011-08-19 Thread bearophile
After translating some buggy C code (full of gotos and global variables) to D and going hunting for bugs for some time, I have grown a desire to write this post. Variable name hiding is a source of bugs. A typical example: int x; void foo() { int x = 5; // lot of code code here x++

Re: Why do struct literals count as lvalues?

2011-08-19 Thread Timon Gehr
On 08/19/2011 04:33 PM, kennytm wrote: Timon Gehr wrote: On 08/19/2011 03:46 PM, kennytm wrote: Timon Gehr wrote: auto ref currently treats struct literals as lvalues too. (therefore, as ref). And passing by value would be considerably less efficient for large structs. As I understand it

Re: Optional braces

2011-08-19 Thread kennytm
Trass3r wrote: > Am 19.08.2011, 14:16 Uhr, schrieb Timon Gehr : >> I think this makes code harder to read for no obvious benefit. >> I don't think this is any better than >> >> class Foo{ >> private int a_; >> int a(){return a_;} >> int a(int a){return a_ = a;} >> } > > +1 > > Op

Re: Why do struct literals count as lvalues?

2011-08-19 Thread kennytm
Timon Gehr wrote: > On 08/19/2011 03:46 PM, kennytm wrote: >> Timon Gehr wrote: >> >>> auto ref currently treats struct literals as lvalues too. (therefore, as >>> ref). And passing by value would be considerably less efficient for large >>> structs. >>> >>> As I understand it, the only issue

Re: newsgroup availability

2011-08-19 Thread kennytm
Timon Gehr wrote: > On 08/19/2011 03:44 PM, Steven Schveighoffer wrote: >> Has there been some strange issue with the newsgroup lately? Frequently, >> I'm getting load errors (I assume this means the NG load is too large to >> deal with my communication). >> >> It seems to be happening daily... >

Re: newsgroup availability

2011-08-19 Thread Jesse Phillips
On Fri, 19 Aug 2011 15:52:40 +0200, Timon Gehr wrote: > On 08/19/2011 03:44 PM, Steven Schveighoffer wrote: >> Has there been some strange issue with the newsgroup lately? >> Frequently, I'm getting load errors (I assume this means the NG load is >> too large to deal with my communication). >> >>

Re: Optional braces

2011-08-19 Thread Ulrik Mikaelsson
There is one case where it might make sense. I've brought up a variation of this before, but basically; Object getMeSome() try { // Really try } catch (SpecificFailure e) { return null; } vs. Object getMeSome() { try { // Really try } catch (SpecificFailure e) { return null; }

Re: Why do struct literals count as lvalues?

2011-08-19 Thread kenji hara
2011/8/19 Timon Gehr : > Oh, interesting. So why were they implemented with different semantics then? I don't know the background, sorry. > Also, how would they work in a non-templated function? In my opinion, that might work like C++ const T&, that allows receiving a rvalue argument. > Would th

Re: Why do struct literals count as lvalues?

2011-08-19 Thread Timon Gehr
On 08/19/2011 03:46 PM, kennytm wrote: Timon Gehr wrote: auto ref currently treats struct literals as lvalues too. (therefore, as ref). And passing by value would be considerably less efficient for large structs. As I understand it, the only issue with allowing literals and function results

Re: newsgroup availability

2011-08-19 Thread Timon Gehr
On 08/19/2011 03:44 PM, Steven Schveighoffer wrote: Has there been some strange issue with the newsgroup lately? Frequently, I'm getting load errors (I assume this means the NG load is too large to deal with my communication). It seems to be happening daily... -Steve It has been the same for

Re: Why do struct literals count as lvalues?

2011-08-19 Thread kennytm
Timon Gehr wrote: > auto ref currently treats struct literals as lvalues too. (therefore, as > ref). And passing by value would be considerably less efficient for large > structs. > > As I understand it, the only issue with allowing literals and function > results as lvalues is that generic cod

newsgroup availability

2011-08-19 Thread Steven Schveighoffer
Has there been some strange issue with the newsgroup lately? Frequently, I'm getting load errors (I assume this means the NG load is too large to deal with my communication). It seems to be happening daily... -Steve

Re: Why do struct literals count as lvalues?

2011-08-19 Thread Timon Gehr
On 08/19/2011 03:04 PM, kenji hara wrote: 2011/8/19 Timon Gehr: On 08/19/2011 02:16 PM, Steven Schveighoffer wrote: On Thu, 18 Aug 2011 18:56:01 -0400, bearophile wrote: Jonathan M Davis: I see _zero_ reason to treat a newly constructed object as any different from one which is returned

Re: Why do struct literals count as lvalues?

2011-08-19 Thread kenji hara
2011/8/19 Timon Gehr : > On 08/19/2011 02:16 PM, Steven Schveighoffer wrote: >> >> On Thu, 18 Aug 2011 18:56:01 -0400, bearophile >> wrote: >> >>> Jonathan M Davis: >>> I see _zero_ reason to treat a newly constructed object as any different from one which is returned from a fu

Re: Why do struct literals count as lvalues?

2011-08-19 Thread Timon Gehr
On 08/19/2011 02:16 PM, Steven Schveighoffer wrote: On Thu, 18 Aug 2011 18:56:01 -0400, bearophile wrote: Jonathan M Davis: I see _zero_ reason to treat a newly constructed object as any different from one which is returned from a function. I have not followed fully this thread, so I am no

Re: Clang with SAFECode

2011-08-19 Thread Walter Bright
bearophile wrote: I'd like some optional functionality like SAFECode in the D compiler too. Very little code in a D program needs to be @system, so I see little need for this.

Re: Optional braces

2011-08-19 Thread Trass3r
Am 19.08.2011, 14:16 Uhr, schrieb Timon Gehr : I think this makes code harder to read for no obvious benefit. I don't think this is any better than class Foo{ private int a_; int a(){return a_;} int a(int a){return a_ = a;} } +1 Optional braces should be limited to statements.

Re: Why do struct literals count as lvalues?

2011-08-19 Thread Steven Schveighoffer
On Thu, 18 Aug 2011 18:56:01 -0400, bearophile wrote: Jonathan M Davis: I see _zero_ reason to treat a newly constructed object as any different from one which is returned from a function. I have not followed fully this thread, so I am not sure what you are talking about, so sorry if

Re: Optional braces

2011-08-19 Thread Timon Gehr
On 08/19/2011 08:50 AM, Jacob Carlborg wrote: This might sound like a crazy idea. I don't expect everyone to drop what they're doing and start to implement this, it's just an idea. In Java (C, C++ and others) braces are optional for statements like if, while, for and so on, containing only one e

Re: CURL review request

2011-08-19 Thread Timon Gehr
On 08/19/2011 01:50 AM, Jonathan M Davis wrote: On Thursday, August 18, 2011 16:00 Timon Gehr wrote: On 08/19/2011 12:35 AM, Jonathan M Davis wrote: On Thursday, August 18, 2011 14:33 jdrewsen wrote: Den 17-08-2011 18:21, Timon Gehr skrev: On 08/17/2011 05:58 PM, Jonathan M Davis wrote: On W

Re: Is std.log ready for review?

2011-08-19 Thread Jose Armando Garcia
Sorry guys for disappearing. I'll put some time into this... On Wed, Aug 10, 2011 at 12:52 AM, Jonathan M Davis wrote: > Jose, are you ready for std.log to be reviewed? I believe that it's the item > which has been in the review queue the longest at this point. So, if you're > ready, then it shou