Re: If Statement with Declaration

2017-07-24 Thread Nick Treleaven via Digitalmars-d
On Monday, 24 July 2017 at 13:12:17 UTC, Nick Treleaven wrote: static if (is(E == enum; alias V)) { // this inserts "V" V v; } The test comes first as it logically should, as the alias is not being used until the following statement. Hmm, it can be used in the test: is(Abc U : U*) is(AA

Re: If Statement with Declaration

2017-07-24 Thread Nick Treleaven via Digitalmars-d
On Monday, 24 July 2017 at 13:12:17 UTC, Nick Treleaven wrote: On Friday, 21 July 2017 at 21:50:02 UTC, Johan Engelen wrote: static if (is(E V == enum)) { // this inserts "V" V v; } ``` Yes, but this is a bit different as the goal is to avoid repeating V Sigh. Repeating E.

Re: If Statement with Declaration

2017-07-24 Thread Nick Treleaven via Digitalmars-d
On Friday, 21 July 2017 at 21:50:02 UTC, Johan Engelen wrote: We do have a construct like that already: ``` static if (is(E V == enum)) { // this inserts "V" V v; } ``` Yes, but this is a bit different as the goal is to avoid repeating V (as it may be complex). Repeating a local variable

Re: If Statement with Declaration

2017-07-24 Thread Olivier FAURE via Digitalmars-d
On Friday, 21 July 2017 at 21:32:48 UTC, Andrei Alexandrescu wrote: with (auto r = makeMeARange) if (!r.empty) with (auto x = r.front) { ... } Andrei I'm being real nitpicky, but this in particular just seems like a slightly worse way to write with (auto r = makeMeARange) if

Re: If Statement with Declaration

2017-07-21 Thread Jonathan M Davis via Digitalmars-d
On Friday, July 21, 2017 17:32:48 Andrei Alexandrescu via Digitalmars-d wrote: > On 07/19/2017 09:30 AM, sontung wrote: > [snip] > > This post: > http://forum.dlang.org/post/vfjlpvpwuyfqoljvp...@forum.dlang.org seems > to be identical to one on November 3, 2016: >

Re: If Statement with Declaration

2017-07-21 Thread Johan Engelen via Digitalmars-d
On Friday, 21 July 2017 at 21:32:48 UTC, Andrei Alexandrescu wrote: It's bizarre even lexically: "If the following ... oh wait let me insert some stuff ... as I was saying, if the following condition happens..." (excuse me for muddying the waters) We do have a construct like that already:

Re: If Statement with Declaration

2017-07-21 Thread Andrei Alexandrescu via Digitalmars-d
On 07/19/2017 09:30 AM, sontung wrote: [snip] This post: http://forum.dlang.org/post/vfjlpvpwuyfqoljvp...@forum.dlang.org seems to be identical to one on November 3, 2016: http://forum.dlang.org/post/dejodpslmjdovstdi...@forum.dlang.org. Hat tip for persistence! Regarding the feature

Re: If Statement with Declaration

2017-07-20 Thread Moritz Maxeiner via Digitalmars-d
On Thursday, 20 July 2017 at 14:18:48 UTC, Jack Stouffer wrote: On Thursday, 20 July 2017 at 14:05:36 UTC, Iakh wrote: It is not about reduce number of lines. It is about binding related things in one statement. Even so, it's already been shown in this thread that the same effect can be

Re: If Statement with Declaration

2017-07-20 Thread Jack Stouffer via Digitalmars-d
On Thursday, 20 July 2017 at 14:05:36 UTC, Iakh wrote: It is not about reduce number of lines. It is about binding related things in one statement. Even so, it's already been shown in this thread that the same effect can be achieved via a block statement (doing exactly what it was designed

Re: If Statement with Declaration

2017-07-20 Thread Iakh via Digitalmars-d
On Wednesday, 19 July 2017 at 15:41:18 UTC, Jack Stouffer wrote: On Wednesday, 19 July 2017 at 13:30:56 UTC, sontung wrote: Thoughts on this sort of feature? To be frank, I don't think that helping the programmer reduce the line count in their program by one line is worth further

Re: If Statement with Declaration

2017-07-20 Thread Iakh via Digitalmars-d
On Wednesday, 19 July 2017 at 15:31:08 UTC, ag0aep6g wrote: On 07/19/2017 03:30 PM, sontung wrote: So I was thinking of some sort of syntax like this: if(int i = someFunc(); i >= 0) { // use i } Thoughts on this sort of feature? I'd prefer a new variant of `with`:

Re: If Statement with Declaration

2017-07-20 Thread Moritz Maxeiner via Digitalmars-d
On Wednesday, 19 July 2017 at 15:31:08 UTC, ag0aep6g wrote: On 07/19/2017 03:30 PM, sontung wrote: So I was thinking of some sort of syntax like this: if(int i = someFunc(); i >= 0) { // use i } Thoughts on this sort of feature? I'd prefer a new variant of `with`:

Re: If Statement with Declaration

2017-07-20 Thread Guillaume Piolat via Digitalmars-d
On Wednesday, 19 July 2017 at 13:30:56 UTC, sontung wrote: Thoughts on this sort of feature? This doesn't enable anything new, and breaks readability conventions.

Re: If Statement with Declaration

2017-07-20 Thread Olivier FAURE via Digitalmars-d
On Wednesday, 19 July 2017 at 20:42:33 UTC, Steven Schveighoffer wrote: I remember reading a discussion about using with statements to do this earlier as well, but I can't find it. -Steve I don't think this is the discussion you're talking about, but this does bring DIP 1005 to mind:

Re: If Statement with Declaration

2017-07-19 Thread Steven Schveighoffer via Digitalmars-d
I thought I remembered reading about this. But apparently, it was *exactly* this. https://forum.dlang.org/post/dejodpslmjdovstdi...@forum.dlang.org And this is, ... well I guess I continue to have the same ideas :) https://forum.dlang.org/post/oknvgb$2nr0$1...@digitalmars.com

Re: If Statement with Declaration

2017-07-19 Thread Jonathan M Davis via Digitalmars-d
On Wednesday, July 19, 2017 1:30:56 PM MDT sontung via Digitalmars-d wrote: > So I was thinking of a way of extending if statements that have > declarations. The following being as example of the current use > of if statements with declarations: > > if(int* weDontPollute = someFunc()) >

Re: If Statement with Declaration

2017-07-19 Thread Steven Schveighoffer via Digitalmars-d
On 7/19/17 11:47 AM, Jonathan Marler wrote: On Wednesday, 19 July 2017 at 15:39:02 UTC, Steven Schveighoffer wrote: On 7/19/17 9:30 AM, sontung wrote: So I was thinking of a way of extending if statements that have declarations. The following being as example of the current use of if

Re: If Statement with Declaration

2017-07-19 Thread H. S. Teoh via Digitalmars-d
On Wed, Jul 19, 2017 at 01:30:56PM +, sontung via Digitalmars-d wrote: [...] > if(int i = someFunc(); i >= 0) > { > // use i > } > Thoughts on this sort of feature? I've been wanting such a feature for a long time now. Though I'd propose a different syntax: if

Re: If Statement with Declaration

2017-07-19 Thread jmh530 via Digitalmars-d
On Wednesday, 19 July 2017 at 15:31:08 UTC, ag0aep6g wrote: I'd prefer a new variant of `with`: Looks much cleaner to me.

Re: If Statement with Declaration

2017-07-19 Thread Dominikus Dittes Scherkl via Digitalmars-d
On Wednesday, 19 July 2017 at 16:49:38 UTC, Jonathan Marler wrote: This would automatically make it work with any statement: with(auto x = 0) if(x) { doSomething } with(auto x = 0) while(x) { doSomething } Could also do multiple with statements with(auto x = 0) with(auto y = 0)

Re: If Statement with Declaration

2017-07-19 Thread Jonathan Marler via Digitalmars-d
On Wednesday, 19 July 2017 at 16:13:28 UTC, Swoorup Joshi wrote: On Wednesday, 19 July 2017 at 15:31:08 UTC, ag0aep6g wrote: On 07/19/2017 03:30 PM, sontung wrote: So I was thinking of some sort of syntax like this: if(int i = someFunc(); i >= 0) { // use i } Thoughts

Re: If Statement with Declaration

2017-07-19 Thread Dominikus Dittes Scherkl via Digitalmars-d
On Wednesday, 19 July 2017 at 16:13:28 UTC, Swoorup Joshi wrote: On Wednesday, 19 July 2017 at 15:31:08 UTC, ag0aep6g wrote: On 07/19/2017 03:30 PM, sontung wrote: So I was thinking of some sort of syntax like this: if(int i = someFunc(); i >= 0) { // use i } Thoughts

Re: If Statement with Declaration

2017-07-19 Thread Swoorup Joshi via Digitalmars-d
On Wednesday, 19 July 2017 at 15:31:08 UTC, ag0aep6g wrote: On 07/19/2017 03:30 PM, sontung wrote: So I was thinking of some sort of syntax like this: if(int i = someFunc(); i >= 0) { // use i } Thoughts on this sort of feature? I'd prefer a new variant of `with`:

Re: If Statement with Declaration

2017-07-19 Thread Seb via Digitalmars-d
On Wednesday, 19 July 2017 at 15:41:18 UTC, Jack Stouffer wrote: On Wednesday, 19 July 2017 at 13:30:56 UTC, sontung wrote: Thoughts on this sort of feature? To be frank, I don't think that helping the programmer reduce the line count in their program by one line is worth further

Re: If Statement with Declaration

2017-07-19 Thread Steven Schveighoffer via Digitalmars-d
On 7/19/17 11:41 AM, Jack Stouffer wrote: On Wednesday, 19 July 2017 at 13:30:56 UTC, sontung wrote: Thoughts on this sort of feature? To be frank, I don't think that helping the programmer reduce the line count in their program by one line is worth further complicating the language. It's

Re: If Statement with Declaration

2017-07-19 Thread Cym13 via Digitalmars-d
On Wednesday, 19 July 2017 at 15:39:02 UTC, Steven Schveighoffer wrote: On 7/19/17 9:30 AM, sontung wrote: [...] I really like the idea. Only thing I don't like is the possibility for abuse/confusion/errors: if(int i = someFunc(); j >= 0) // typo, or weird relationship, or just

Re: If Statement with Declaration

2017-07-19 Thread Jonathan Marler via Digitalmars-d
On Wednesday, 19 July 2017 at 15:39:02 UTC, Steven Schveighoffer wrote: On 7/19/17 9:30 AM, sontung wrote: So I was thinking of a way of extending if statements that have declarations. The following being as example of the current use of if statements with declarations: if(int*

Re: If Statement with Declaration

2017-07-19 Thread Jack Stouffer via Digitalmars-d
On Wednesday, 19 July 2017 at 13:30:56 UTC, sontung wrote: Thoughts on this sort of feature? To be frank, I don't think that helping the programmer reduce the line count in their program by one line is worth further complicating the language.

Re: If Statement with Declaration

2017-07-19 Thread Steven Schveighoffer via Digitalmars-d
On 7/19/17 9:30 AM, sontung wrote: So I was thinking of a way of extending if statements that have declarations. The following being as example of the current use of if statements with declarations: if(int* weDontPollute = someFunc()) { // use weDontPollute } That's

Re: If Statement with Declaration

2017-07-19 Thread ag0aep6g via Digitalmars-d
On 07/19/2017 03:30 PM, sontung wrote: So I was thinking of some sort of syntax like this: if(int i = someFunc(); i >= 0) { // use i } Thoughts on this sort of feature? I'd prefer a new variant of `with`: with (int i = someFunc()) if (i >= 0) { // use i }

Re: If Statement with Declaration

2017-07-19 Thread Seb via Digitalmars-d
On Wednesday, 19 July 2017 at 14:46:31 UTC, Andrea Fontana wrote: On Wednesday, 19 July 2017 at 13:30:56 UTC, sontung wrote: Thoughts on this sort of feature? I think I read this topic a couple of times here, and it went nowhere... Andrea Well someone must take the initiative and submit

Re: If Statement with Declaration

2017-07-19 Thread Jonathan Marler via Digitalmars-d
On Wednesday, 19 July 2017 at 13:30:56 UTC, sontung wrote: So I was thinking of a way of extending if statements that have declarations. The following being as example of the current use of if statements with declarations: if(int* weDontPollute = someFunc()) { // use

Re: If Statement with Declaration

2017-07-19 Thread Andrea Fontana via Digitalmars-d
On Wednesday, 19 July 2017 at 13:30:56 UTC, sontung wrote: Thoughts on this sort of feature? I think I read this topic a couple of times here, and it went nowhere... Andrea

Re: If Statement with Declaration

2017-07-19 Thread Atila Neves via Digitalmars-d
On Wednesday, 19 July 2017 at 13:30:56 UTC, sontung wrote: So I was thinking of a way of extending if statements that have declarations. The following being as example of the current use of if statements with declarations: [...] I like it for C++17 and I like it for D. Atila

Re: If Statement with Declaration

2017-07-19 Thread Nemanja Boric via Digitalmars-d
On Wednesday, 19 July 2017 at 14:26:52 UTC, Dukc wrote: On Wednesday, 19 July 2017 at 13:37:50 UTC, Adam D. Ruppe wrote: I like it. Me too. I think this should also apply to switch and with statements. Perhaps while statements too. Right, C++17 has it also for a switch: ``` If

Re: If Statement with Declaration

2017-07-19 Thread Nemanja Boric via Digitalmars-d
On Wednesday, 19 July 2017 at 13:30:56 UTC, sontung wrote: So I was thinking of a way of extending if statements that have declarations. The following being as example of the current use of if statements with declarations: if(int* weDontPollute = someFunc()) { // use

Re: If Statement with Declaration

2017-07-19 Thread Dukc via Digitalmars-d
On Wednesday, 19 July 2017 at 13:37:50 UTC, Adam D. Ruppe wrote: I like it. Me too. I think this should also apply to switch and with statements. Perhaps while statements too.

Re: If Statement with Declaration

2017-07-19 Thread Adam D. Ruppe via Digitalmars-d
On Wednesday, 19 July 2017 at 13:30:56 UTC, sontung wrote: Thoughts on this sort of feature? I like it.

If Statement with Declaration

2017-07-19 Thread sontung via Digitalmars-d
So I was thinking of a way of extending if statements that have declarations. The following being as example of the current use of if statements with declarations: if(int* weDontPollute = someFunc()) { // use weDontPollute } That's great and all, but it only works by

Re: If Statement with Declaration

2016-11-07 Thread ArturG via Digitalmars-d
On Thursday, 3 November 2016 at 22:29:34 UTC, Jerry wrote: So I was thinking of a way of extending if statements that have declarations. The following being as example of the current use of if statements with declarations: if(int* weDontPollute = someFunc()) { // use

Re: If Statement with Declaration

2016-11-07 Thread Anonymouse via Digitalmars-d
On Sunday, 6 November 2016 at 05:07:10 UTC, Andrei Alexandrescu wrote: // possible future D if ((auto variable = fun()) != 42) { ... } Defining a variable in an expression wouldn't be allowed everywhere (but might be contemplated later as an possibility, which is a nice thing about this

Re: If Statement with Declaration

2016-11-07 Thread Nick Treleaven via Digitalmars-d
On Sunday, 6 November 2016 at 05:07:10 UTC, Andrei Alexandrescu wrote: if (auto variable = fun(); variable != 42) { ... } Why does the word "variable" need to appear twice? It seems simpler to allow punctuation around existing syntax: // possible future D if ((auto variable = fun()) != 42)

Re: If Statement with Declaration

2016-11-06 Thread Enamex via Digitalmars-d
On Sunday, 6 November 2016 at 05:07:10 UTC, Andrei Alexandrescu wrote: The declaration with "if" seems to be a recent fashion. I've first seen it in Go and now C++17 took a shine to it - http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0305r0.html. A DIP would do good to cite that

Re: If Statement with Declaration

2016-11-05 Thread ketmar via Digitalmars-d
On Sunday, 6 November 2016 at 05:07:10 UTC, Andrei Alexandrescu wrote: A more approachable thing to do is allow variable definitions in switch statements: switch (auto x = fun() { ... } It is surprising that doesn't work, which is a good argument in favor of the feature (removal of an undue

Re: If Statement with Declaration

2016-11-05 Thread Andrei Alexandrescu via Digitalmars-d
On 11/5/16 3:52 PM, Jonathan M Davis via Digitalmars-d wrote: Ultimately though, the biggest hurdle is that someone needs to create a DIP for it that strongly argues its case with real world examples of how it would improve code (preferably with code from Phobos and code.dlang.org), and without

Re: If Statement with Declaration

2016-11-05 Thread ketmar via Digitalmars-d
On Saturday, 5 November 2016 at 19:52:05 UTC, Jonathan M Davis wrote: and more importantly, I don't know if Walter or Andrei would think that it's worth it, and they're the ones who need to be convinced. this addition looks like needless overcomplication even for me. and i'm usually

Re: If Statement with Declaration

2016-11-05 Thread Jonathan M Davis via Digitalmars-d
On Thursday, November 03, 2016 22:29:34 Jerry via Digitalmars-d wrote: > if(int i = someFunc(); i >= 0) > { > // use i > } > Thoughts on this sort of feature? Personally, I'd love to have it, and I think that it's been suggested before (though I don't remember how that

Re: If Statement with Declaration

2016-11-05 Thread Jerry via Digitalmars-d
On Friday, 4 November 2016 at 19:26:23 UTC, Steven Schveighoffer wrote: I think it makes it easier to read and it fits with how the for-statement operates. I write code everyday that could utilize this if-statement syntax, so I thought I might as well bring it up. But if there isn't that much

Re: If Statement with Declaration

2016-11-05 Thread Jerry via Digitalmars-d
On Friday, 4 November 2016 at 18:05:51 UTC, Adrian Matoga wrote: On Friday, 4 November 2016 at 15:34:00 UTC, Jerry wrote: On Friday, 4 November 2016 at 14:16:44 UTC, Matthias Bentrup wrote: On Thursday, 3 November 2016 at 22:29:34 UTC, Jerry wrote: if(int i = someFunc(); i >= 0) {

Re: If Statement with Declaration

2016-11-04 Thread Timon Gehr via Digitalmars-d
On 04.11.2016 21:03, Andrej Mitrovic wrote: On Thursday, 3 November 2016 at 22:29:34 UTC, Jerry wrote: So I was thinking of a way of extending if statements that have declarations. The following being as example of the current use of if statements with declarations: if(int* weDontPollute

Re: If Statement with Declaration

2016-11-04 Thread Andrej Mitrovic via Digitalmars-d
On Thursday, 3 November 2016 at 22:29:34 UTC, Jerry wrote: So I was thinking of a way of extending if statements that have declarations. The following being as example of the current use of if statements with declarations: if(int* weDontPollute = someFunc()) { // use

Re: If Statement with Declaration

2016-11-04 Thread Steven Schveighoffer via Digitalmars-d
On 11/4/16 1:46 PM, Jerry wrote: On Friday, 4 November 2016 at 16:15:21 UTC, Steven Schveighoffer wrote: It's just a strawman type, I'm sure there's ways to handle these things, I just didn't put a lot of effort into all the cases. But really it's just syntax to separate the bool check from

Re: If Statement with Declaration

2016-11-04 Thread Adrian Matoga via Digitalmars-d
On Friday, 4 November 2016 at 15:34:00 UTC, Jerry wrote: On Friday, 4 November 2016 at 14:16:44 UTC, Matthias Bentrup wrote: On Thursday, 3 November 2016 at 22:29:34 UTC, Jerry wrote: if(int i = someFunc(); i >= 0) { // use i } Thoughts on this sort of feature? I would

Re: If Statement with Declaration

2016-11-04 Thread Jerry via Digitalmars-d
On Friday, 4 November 2016 at 16:15:21 UTC, Steven Schveighoffer wrote: It's just a strawman type, I'm sure there's ways to handle these things, I just didn't put a lot of effort into all the cases. But really it's just syntax to separate the bool check from the value itself. You can get

Re: If Statement with Declaration

2016-11-04 Thread Jerry via Digitalmars-d
On Thursday, 3 November 2016 at 22:29:34 UTC, Jerry wrote: Thoughts on this sort of feature? Love your name, Jerry ;) Maybe something like this psuedo code: struct Condition(T) { Condition(T val, bool cond) { m_val = val; m_cond = cond; } bool opCast(T)() if(is(T == bool)) {

Re: If Statement with Declaration

2016-11-04 Thread Nick Treleaven via Digitalmars-d
On Friday, 4 November 2016 at 13:56:57 UTC, Andrea Fontana wrote: If you don't like indentation you can simply ignore it or you can use old goto :) { int i = someFunc(); if (i < 0) goto outer; // your code here } outer: BTW there is a trick to avoid goto+label: switch (true) {

Re: If Statement with Declaration

2016-11-04 Thread Steven Schveighoffer via Digitalmars-d
On 11/4/16 11:27 AM, Jerry wrote: On Friday, 4 November 2016 at 14:10:51 UTC, Steven Schveighoffer wrote: Hm... what about something like: struct BoolCond(T, string cond) { T val; bool opCast(B)() if(is(B == bool)) { return mixin("val " ~ cond); } } auto boolcond(string cond,

Re: If Statement with Declaration

2016-11-04 Thread Jerry via Digitalmars-d
On Friday, 4 November 2016 at 14:10:51 UTC, Steven Schveighoffer wrote: On 11/3/16 6:29 PM, Jerry wrote: So I was thinking of a way of extending if statements that have declarations. The following being as example of the current use of if statements with declarations: if(int*

Re: If Statement with Declaration

2016-11-04 Thread Jerry via Digitalmars-d
On Friday, 4 November 2016 at 14:16:44 UTC, Matthias Bentrup wrote: On Thursday, 3 November 2016 at 22:29:34 UTC, Jerry wrote: if(int i = someFunc(); i >= 0) { // use i } Thoughts on this sort of feature? I would prefer the syntax if( (int i = someFunc()) >= 0 ) {

Re: If Statement with Declaration

2016-11-04 Thread Steven Schveighoffer via Digitalmars-d
On 11/4/16 10:10 AM, Steven Schveighoffer wrote: On 11/3/16 6:29 PM, Jerry wrote: So I was thinking of a way of extending if statements that have declarations. The following being as example of the current use of if statements with declarations: if(int* weDontPollute = someFunc()) {

Re: If Statement with Declaration

2016-11-04 Thread Matthias Bentrup via Digitalmars-d
On Thursday, 3 November 2016 at 22:29:34 UTC, Jerry wrote: if(int i = someFunc(); i >= 0) { // use i } Thoughts on this sort of feature? I would prefer the syntax if( (int i = someFunc()) >= 0 ) { // use i } as this matches the already existing assignment

Re: If Statement with Declaration

2016-11-04 Thread Steven Schveighoffer via Digitalmars-d
On 11/3/16 6:29 PM, Jerry wrote: So I was thinking of a way of extending if statements that have declarations. The following being as example of the current use of if statements with declarations: if(int* weDontPollute = someFunc()) { // use weDontPollute } That's great

Re: If Statement with Declaration

2016-11-04 Thread Andrea Fontana via Digitalmars-d
On Friday, 4 November 2016 at 13:38:30 UTC, Superstar64 wrote: On Thursday, 3 November 2016 at 22:32:17 UTC, Stefan Koch wrote: Just Introduce another block { int i = someFunc(); if (i >= 0) { ... } } // i is not visible here That adds 2 indention levels after formatting. Unfortunately

Re: If Statement with Declaration

2016-11-04 Thread Superstar64 via Digitalmars-d
On Thursday, 3 November 2016 at 22:32:17 UTC, Stefan Koch wrote: Just Introduce another block { int i = someFunc(); if (i >= 0) { ... } } // i is not visible here That adds 2 indention levels after formatting. Unfortunately this doesn't work: --- { int i = someFunc(); if (i >= 0):

Re: If Statement with Declaration

2016-11-04 Thread ixid via Digitalmars-d
On Friday, 4 November 2016 at 00:04:28 UTC, mogu wrote: Introducing a block is not intuitive and cause an identation. How is using a block to produce a sub-scope not intuitive? That's using a standard feature to do exactly what it is supposed to do.

Re: If Statement with Declaration

2016-11-03 Thread mogu via Digitalmars-d
On Thursday, 3 November 2016 at 22:32:17 UTC, Stefan Koch wrote: On Thursday, 3 November 2016 at 22:29:34 UTC, Jerry wrote: So I was thinking of a way of extending if statements that have declarations. The following being as example of the current use of if statements with declarations:

Re: If Statement with Declaration

2016-11-03 Thread Stefan Koch via Digitalmars-d
On Thursday, 3 November 2016 at 22:29:34 UTC, Jerry wrote: So I was thinking of a way of extending if statements that have declarations. The following being as example of the current use of if statements with declarations: [...] Just Introduce another block { int i = someFunc(); if (i

If Statement with Declaration

2016-11-03 Thread Jerry via Digitalmars-d
So I was thinking of a way of extending if statements that have declarations. The following being as example of the current use of if statements with declarations: if(int* weDontPollute = someFunc()) { // use weDontPollute } That's great and all, but it only works by