Re: Is this a bug? +goto

2018-11-05 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, November 5, 2018 7:55:46 PM MST MatheusBN via Digitalmars-d-learn wrote: > On Tuesday, 6 November 2018 at 01:55:04 UTC, Jonathan M Davis > > wrote: > >> And I found a bit strange that in such code, since "x" is > >> never used, why it isn't skipped. > > > > It's skipped right over. The

Re: Is this a bug? +goto

2018-11-05 Thread MatheusBN via Digitalmars-d-learn
On Tuesday, 6 November 2018 at 01:05:04 UTC, Neia Neutuladh wrote: In C++, if you skip over `int i = 10;` it's an error, but not if you skip over `int i;`. In fact I agree with that rule more than the D one to be honest. Since It isn't initialized and never used, I think a warning should be e

Re: Is this a bug? +goto

2018-11-05 Thread MatheusBN via Digitalmars-d-learn
On Tuesday, 6 November 2018 at 01:04:46 UTC, Stanislav Blinov wrote: ...Even if you don't see any explicit use, it doesn't mean the compiler doesn't see an implicit one. Sorry I don't think that I follow that. How a compiler could see an use when it's not being used/invoked on a program like i

Re: Is this a bug? +goto

2018-11-05 Thread MatheusBN via Digitalmars-d-learn
On Tuesday, 6 November 2018 at 01:55:04 UTC, Jonathan M Davis wrote: And I found a bit strange that in such code, since "x" is never used, why it isn't skipped. It's skipped right over. The goto jumps out of the scope, and the line with int x; is never run. In fact, if you compile with -w o

Re: Is this a bug? +goto

2018-11-05 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, November 5, 2018 5:33:56 PM MST MatheusBN via Digitalmars-d-learn wrote: > On Tuesday, 6 November 2018 at 00:14:26 UTC, Jonathan M Davis > > wrote: > > On Monday, November 5, 2018 4:54:59 PM MST MatheusBN via > > > > Digitalmars-d-learn wrote: > >> Hi, > >> > >> I posted this in another

Re: Is this a bug? +goto

2018-11-05 Thread Neia Neutuladh via Digitalmars-d-learn
On Tue, 06 Nov 2018 00:33:56 +, MatheusBN wrote: > Just to be clear, when you say "x exists at the label Q", you mean at > the same scope, right? The same or an outer scope. It's also invalid to write: goto Y; { int x; { Y: } } > That's interesting but a bit confusing isn't? > > A

Re: Is this a bug? +goto

2018-11-05 Thread Stanislav Blinov via Digitalmars-d-learn
On Tuesday, 6 November 2018 at 00:38:01 UTC, MatheusBN wrote: On Tuesday, 6 November 2018 at 00:13:52 UTC, Stanislav Blinov wrote: But here it's fine: void main(){ { goto Q; S x; } // <--- Q: writeln("a"); } because goto jumps over both initialization *and

Re: Is this a bug? +goto

2018-11-05 Thread MatheusBN via Digitalmars-d-learn
On Tuesday, 6 November 2018 at 00:13:52 UTC, Stanislav Blinov wrote: But here it's fine: void main(){ { goto Q; S x; } // <--- Q: writeln("a"); } because goto jumps over both initialization *and* destruction, i.e. neither would even be performed. I see b

Re: Is this a bug? +goto

2018-11-05 Thread MatheusBN via Digitalmars-d-learn
On Tuesday, 6 November 2018 at 00:14:26 UTC, Jonathan M Davis wrote: On Monday, November 5, 2018 4:54:59 PM MST MatheusBN via Digitalmars-d-learn wrote: Hi, I posted this in another thread but without any response. This code: void main(){ goto Q; int x; Q: writeln("a")

Re: Is this a bug? +goto

2018-11-05 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, November 5, 2018 4:54:59 PM MST MatheusBN via Digitalmars-d-learn wrote: > Hi, > > I posted this in another thread but without any response. > > This code: > > void main(){ > goto Q; > int x; > Q: > writeln("a"); > } > > Gives me this error: "source_file.d(4): Er

Re: Is this a bug? +goto

2018-11-05 Thread Stanislav Blinov via Digitalmars-d-learn
On Monday, 5 November 2018 at 23:54:59 UTC, MatheusBN wrote: Hi, I posted this in another thread but without any response. This code: void main(){ goto Q; int x; Q: writeln("a"); } Gives me this error: "source_file.d(4): Error: goto skips declaration of variable source.ma

Is this a bug? +goto

2018-11-05 Thread MatheusBN via Digitalmars-d-learn
Hi, I posted this in another thread but without any response. This code: void main(){ goto Q; int x; Q: writeln("a"); } Gives me this error: "source_file.d(4): Error: goto skips declaration of variable source.main.x at source_file.d(5)" Now, if I add a pair of brackets:

Re: Accessing LPARAM param from SendMessage acts weird.

2018-11-05 Thread Mark Moorhen via Digitalmars-d-learn
Brilliant! Thanks John !

Re: Implicit cast to const of result returned from findSplit()

2018-11-05 Thread Per Nordlöw via Digitalmars-d-learn
On Monday, 5 November 2018 at 13:26:18 UTC, Per Nordlöw wrote: AFAICT, it looks like a missing bool qualifier on `opCast!bool`, right? Fixed at https://github.com/dlang/phobos/pull/6749

Re: Implicit cast to const of result returned from findSplit()

2018-11-05 Thread Stanislav Blinov via Digitalmars-d-learn
On Monday, 5 November 2018 at 13:26:18 UTC, Per Nordlöw wrote: AFAICT, it looks like a missing bool qualifier on `opCast!bool`, right? ...Like a missing 'const' qualifier ;) auto findSplit(alias pred = "a == b", R1, R2)(R1 haystack, R2 needle) // ... static struct Result(S1, S2) if (isF

Implicit cast to const of result returned from findSplit()

2018-11-05 Thread Per Nordlöw via Digitalmars-d-learn
Why does @safe pure unittest { import std.algorithm.searching : findSplit; if (const split = "a b".findSplit(" ")) { } } error as f.d(4,5): Error: mutable method `std.algorithm.searching.findSplit!("a == b", string, string).findSplit.Result!(string, string).Result.opCast!bool

Re: javascript or typescript

2018-11-05 Thread Dukc via Digitalmars-d-learn
On Monday, 5 November 2018 at 08:49:42 UTC, Laurent Tréguier wrote: On Monday, 5 November 2018 at 02:51:19 UTC, Fred wrote: hi, my javascript skill is bad. but i want to host some nodejs app i am aware that there is converter to js like dtojs. but it is out of date. i'd like to give d a try.

Re: javascript or typescript

2018-11-05 Thread Dukc via Digitalmars-d-learn
On Monday, 5 November 2018 at 02:51:19 UTC, Fred wrote: hi, my javascript skill is bad. but i want to host some nodejs app i am aware that there is converter to js like dtojs. but it is out of date. i'd like to give d a try. is there any other converter available. a decent one. Let me reco

Re: Putting dmd error through grep for dustmite

2018-11-05 Thread Dennis via Digitalmars-d-learn
On Monday, 5 November 2018 at 03:13:26 UTC, Vladimir Panteleev wrote: cmd.exe will interpret \` verbatim (i.e. as \`), so, try not quoting the ` characters (or just replace them with . if you want the command to work in both shells). Of course, the one thing I didn't try. Thanks!

Re: javascript or typescript

2018-11-05 Thread Fred via Digitalmars-d-learn
On Monday, 5 November 2018 at 08:49:42 UTC, Laurent Tréguier wrote: On Monday, 5 November 2018 at 02:51:19 UTC, Fred wrote: hi, my javascript skill is bad. but i want to host some nodejs app i am aware that there is converter to js like dtojs. but it is out of date. i'd like to give d a try.

Re: Profiling with DUB?

2018-11-05 Thread Dukc via Digitalmars-d-learn
On Thursday, 1 November 2018 at 13:59:39 UTC, Guillaume Piolat wrote: On Monday, 29 October 2018 at 10:14:23 UTC, Dukc wrote: I'm trying to profile my program, built like: dub build --build=profile When I run the program, where is the performance profile file supposed to appear? I can find no

Re: javascript or typescript

2018-11-05 Thread Laurent Tréguier via Digitalmars-d-learn
On Monday, 5 November 2018 at 02:51:19 UTC, Fred wrote: hi, my javascript skill is bad. but i want to host some nodejs app i am aware that there is converter to js like dtojs. but it is out of date. i'd like to give d a try. is there any other converter available. a decent one. I haven't p

Re: javascript or typescript

2018-11-05 Thread Fred via Digitalmars-d-learn
On Monday, 5 November 2018 at 05:07:49 UTC, Adam D. Ruppe wrote: On Monday, 5 November 2018 at 02:51:19 UTC, Fred wrote: i'd like to give d a try. Why do you need to convert it to javascript? D can serve up web stuff by itself too. did you mean vibe.d? but i want to use in a shared hosting