Re: recursive template expansion: Why does this not compile?

2018-03-20 Thread ag0aep6g via Digitalmars-d-learn
On 03/21/2018 01:47 AM, Ontonator wrote: The following code does not compile: void main() {} class SuperClass {} class TemplatedClass(T : SuperClass) {} class A : SuperClass {     alias T = TemplatedClass!B; } class B : SuperClass {     alias T = TemplatedClass!C; } class C : SuperClass {}

Re: recursive template expansion: Why does this not compile?

2018-03-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, March 21, 2018 00:47:18 Ontonator via Digitalmars-d-learn wrote: > The following code does not compile: > > void main() {} > > > > class SuperClass {} > > > > class TemplatedClass(T : SuperClass) {} > > > > class A : SuperClass { > > > > alias T = TemplatedClass!B; > > > > } > >

recursive template expansion: Why does this not compile?

2018-03-20 Thread Ontonator via Digitalmars-d-learn
The following code does not compile: void main() {} class SuperClass {} class TemplatedClass(T : SuperClass) {} class A : SuperClass { alias T = TemplatedClass!B; } class B : SuperClass { alias T = TemplatedClass!C; } class C : SuperClass {} It gives the error: test.d(12): Error: c

Re: Incomprehensible error message

2018-03-20 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 20 March 2018 at 23:45:20 UTC, H. S. Teoh wrote: The tricky part is, who's going to do the work of going through *all* of dmd's error messages and rewriting them with said metadata. We did it for the stupid syntax highlighting thing... and this has bigger win, though it is also m

Re: Incomprehensible error message

2018-03-20 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Mar 20, 2018 at 11:05:59PM +, Adam D. Ruppe via Digitalmars-d-learn wrote: > On Tuesday, 20 March 2018 at 21:18:01 UTC, H. S. Teoh wrote: > > Which means error messages would need to be constructed as an > > abstract object that the error message printer can then inspect to > > determi

Re: Incomprehensible error message

2018-03-20 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 20 March 2018 at 21:18:01 UTC, H. S. Teoh wrote: Which means error messages would need to be constructed as an abstract object that the error message printer can then inspect to determine which symbol(s) should be FQNs. I've talked before about XML error messages. I'd actually lik

Re: Incomprehensible error message

2018-03-20 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Mar 20, 2018 at 10:04:30PM +0100, Jacob Carlborg via Digitalmars-d-learn wrote: > On 2018-03-19 19:03, H. S. Teoh wrote: > > > Yeah, the compiler really ought to be outputting FQNs in error > > messages, since otherwise you get baffling A != A messages. Though > > outputting FQNs everywh

Re: Packages and module import

2018-03-20 Thread Jacob Carlborg via Digitalmars-d-learn
On 2018-03-19 18:29, Russel Winder wrote: I had assumed that a directory of modules was a package. So for example: A/a.d A/b.d were two modules in package A. Especially given there is a module statement at the beginning of each module: A/a.d has module A.a; A/b.d has module A

Re: Incomprehensible error message

2018-03-20 Thread Jacob Carlborg via Digitalmars-d-learn
On 2018-03-19 19:03, H. S. Teoh wrote: Yeah, the compiler really ought to be outputting FQNs in error messages, since otherwise you get baffling A != A messages. Though outputting FQNs everywhere has the tendency of bloating error messages to unreadable lengths, esp. when templates are involved

Re: Slow start up time of runtime (correction: Windows real-time protection)

2018-03-20 Thread rumbu via Digitalmars-d-learn
On Tuesday, 20 March 2018 at 16:56:59 UTC, Dennis wrote: On Tuesday, 20 March 2018 at 12:18:16 UTC, Adam D. Ruppe wrote: On Tuesday, 20 March 2018 at 09:44:41 UTC, Dennis wrote: I suspect you are seeing the Windows antivirus hitting you. D runtime starts up in a tiny fraction of a second, you

Re: Slow start up time of runtime (correction: Windows real-time protection)

2018-03-20 Thread Dennis via Digitalmars-d-learn
On Tuesday, 20 March 2018 at 12:18:16 UTC, Adam D. Ruppe wrote: On Tuesday, 20 March 2018 at 09:44:41 UTC, Dennis wrote: I suspect you are seeing the Windows antivirus hitting you. D runtime starts up in a tiny fraction of a second, you shouldn't be noticing it. You're totally right, disablin

Re: How to build static linked executable

2018-03-20 Thread Jacob Carlborg via Digitalmars-d-learn
On Tuesday, 20 March 2018 at 10:37:55 UTC, zunkree wrote: So, how to build static binary for macOS? I don't see a need to do that. I build static binaries on Linux because they work across all distros and all versions. But for macOS, there are no distros. For supporting multiple versions, or

Re: Slow start up time of runtime

2018-03-20 Thread HeiHon via Digitalmars-d-learn
On Tuesday, 20 March 2018 at 12:18:16 UTC, Adam D. Ruppe wrote: Go into the Windows security center and uncheck the real time virus check protection. I betcha you'll see this delay (and a similar one on dmd itself, your compiles could be running at half-speed with this too) disappear and everyt

Re: Is there a way to pipeline program with random-access ranges in C#?

2018-03-20 Thread Kagamin via Digitalmars-d-learn
On Tuesday, 20 March 2018 at 15:06:14 UTC, Dukc wrote: Won't quite do it, because that would not iterate backwards. Linq has no chunking, so you would need to write it, maybe similar to SelectMany, but with the opposite meaning. public static IEnumerable> Enumerate(this IEnumerable range) {

Re: Is there a way to pipeline program with random-access ranges in C#?

2018-03-20 Thread Dukc via Digitalmars-d-learn
On Tuesday, 20 March 2018 at 08:05:14 UTC, Kagamin wrote: On Monday, 19 March 2018 at 17:33:31 UTC, Dukc wrote: public static int Foo(int[] input) { int result = 10; for (int i = input.Length / 4; i >= 0; i -= 4) { int sum = 0; for (int j = i; j < i +4 && j < input.Length; j+

Re: Slow start up time of runtime

2018-03-20 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 20 March 2018 at 09:44:41 UTC, Dennis wrote: I suppose initializing the runtime takes a lot of time. I suspect you are seeing the Windows antivirus hitting you. D runtime starts up in a tiny fraction of a second, you shouldn't be noticing it. Go into the Windows security center

Re: Slow start up time of runtime

2018-03-20 Thread bauss via Digitalmars-d-learn
On Tuesday, 20 March 2018 at 10:46:11 UTC, Dennis wrote: On Tuesday, 20 March 2018 at 10:20:55 UTC, Dennis wrote: On Tuesday, 20 March 2018 at 09:51:09 UTC, bauss wrote: Besides if it was and it took 1 second to startup, then it wouldn't matter in practice with an actual application. This is

Re: Slow start up time of runtime

2018-03-20 Thread bauss via Digitalmars-d-learn
On Tuesday, 20 March 2018 at 12:07:12 UTC, bauss wrote: On Tuesday, 20 March 2018 at 10:46:11 UTC, Dennis wrote: On Tuesday, 20 March 2018 at 10:20:55 UTC, Dennis wrote: On Tuesday, 20 March 2018 at 09:51:09 UTC, bauss wrote: Besides if it was and it took 1 second to startup, then it wouldn't

Re: How to build static linked executable

2018-03-20 Thread David Nadlinger via Digitalmars-d-learn
On Tuesday, 20 March 2018 at 10:37:55 UTC, zunkree wrote: On Sunday, 18 March 2018 at 14:36:04 UTC, Jacob Carlborg wrote: FYI, -static is not support on macOS. So, how to build static binary for macOS? Static binaries aren't really supported by Apple (anymore). What do you need it for? —

Re: Slow start up time of runtime

2018-03-20 Thread David Nadlinger via Digitalmars-d-learn
On Tuesday, 20 March 2018 at 09:44:41 UTC, Dennis wrote: Are there ways to reduce this to below 0.1s, or should I just leave idiomatic D and make a betterC program? The best solution would be to profile the startup process and file a bug accordingly. ;) — David

Re: Slow start up time of runtime

2018-03-20 Thread Dennis via Digitalmars-d-learn
On Tuesday, 20 March 2018 at 10:20:55 UTC, Dennis wrote: On Tuesday, 20 March 2018 at 09:51:09 UTC, bauss wrote: Besides if it was and it took 1 second to startup, then it wouldn't matter in practice with an actual application. This is not concerning for large applications indeed. But say, I

Re: How to build static linked executable

2018-03-20 Thread zunkree via Digitalmars-d-learn
On Sunday, 18 March 2018 at 14:36:04 UTC, Jacob Carlborg wrote: On 2018-03-17 16:42, Seb wrote: Yes, use -static Here's how we build the DTour: https://github.com/dlang-tour/core/blob/master/dub.sdl FYI, -static is not support on macOS. So, how to build static binary for macOS?

Re: How to build static linked executable

2018-03-20 Thread zunkree via Digitalmars-d-learn
On Saturday, 17 March 2018 at 15:42:06 UTC, Seb wrote: On Saturday, 17 March 2018 at 14:44:42 UTC, zunkree wrote: Hi, Is there a way to build static linked executable with dub for vibe-d based app? Regards, zunkree Yes, use -static Here's how we build the DTour: https://github.com/dlang-

Re: Slow start up time of runtime

2018-03-20 Thread Dennis via Digitalmars-d-learn
On Tuesday, 20 March 2018 at 09:51:09 UTC, bauss wrote: Besides if it was and it took 1 second to startup, then it wouldn't matter in practice with an actual application. This is not concerning for large applications indeed. But say, I want to implement my own `dir` (= `ls` on Unix) in D. Woul

Re: Slow start up time of runtime

2018-03-20 Thread bauss via Digitalmars-d-learn
On Tuesday, 20 March 2018 at 09:44:41 UTC, Dennis wrote: Simply running a "hello world.exe" takes, on my pc: 1.12s When compiled with dmd 0.62s When compiled with ldc 0.05s When compiled with dmc (C program) or dmd/ldc as a -betterC program I suppose initializing the runtime takes a lot of ti

Slow start up time of runtime

2018-03-20 Thread Dennis via Digitalmars-d-learn
Simply running a "hello world.exe" takes, on my pc: 1.12s When compiled with dmd 0.62s When compiled with ldc 0.05s When compiled with dmc (C program) or dmd/ldc as a -betterC program I suppose initializing the runtime takes a lot of time. When making a simple command line utility, half a sec

Re: Is there a way to pipeline program with random-access ranges in C#?

2018-03-20 Thread Kagamin via Digitalmars-d-learn
On Monday, 19 March 2018 at 17:33:31 UTC, Dukc wrote: public static int Foo(int[] input) { int result = 10; for (int i = input.Length / 4; i >= 0; i -= 4) { int sum = 0; for (int j = i; j < i +4 && j < input.Length; j++) sum += input[j]; sum *= i; result = (r