Re: range algorithms on container class

2020-01-08 Thread rikki cattermole via Digitalmars-d-learn
On 09/01/2020 6:28 PM, Alex Burton wrote: I am writing a specialised container class, and want to make it work like a normal array with range functions. After some struggle, I look at the code for std.container.array and see this comment : When using `Array` with range-based functions like tho

range algorithms on container class

2020-01-08 Thread Alex Burton via Digitalmars-d-learn
I am writing a specialised container class, and want to make it work like a normal array with range functions. After some struggle, I look at the code for std.container.array and see this comment : When using `Array` with range-based functions like those in `std.algorithm`, * `Array` must be

Re: Calling D code from C

2020-01-08 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 8 January 2020 at 22:00:03 UTC, H. S. Teoh wrote: On Wed, Jan 08, 2020 at 09:42:03PM +, Ferhat Kurtulmuş via Digitalmars-d-learn wrote: [...] What is going on here? The original post date appears as to be of 2005 :D. [...] Haha yeah, I'm not sure why Stefan replied to a post

Re: @disable("reason")

2020-01-08 Thread Marcel via Digitalmars-d-learn
On Wednesday, 8 January 2020 at 07:03:26 UTC, Jonathan M Davis wrote: On Tuesday, January 7, 2020 5:23:48 PM MST Marcel via Digitalmars-d-learn wrote: [...] In terms of an error message? Not really. You can put a pragma(msg, ""); in there, but that would always print, not just when someone t

Re: Calling D code from C

2020-01-08 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jan 08, 2020 at 09:42:03PM +, Ferhat Kurtulmuş via Digitalmars-d-learn wrote: [...] > What is going on here? The original post date appears as to be of 2005 > :D. [...] Haha yeah, I'm not sure why Stefan replied to a post dating from 2005. T -- Just because you can, doesn't mean y

Re: Calling D code from C

2020-01-08 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Wednesday, 8 January 2020 at 19:05:29 UTC, H. S. Teoh wrote: On Wed, Jan 08, 2020 at 06:12:01PM +, Stefan via Digitalmars-d-learn wrote: [...] But you can easily do the initialization in your D code, by calling rt_init() and rt_term(), like this: [...] extern(C) int rt_init(); extern(C

Re: linkererrors when reducion phobos with dustmite

2020-01-08 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Jan 06, 2020 at 10:27:09AM +, berni44 via Digitalmars-d-learn wrote: > As mentioned on the dustmite website [1] I copied the folder std from > Phobos in a separate folder and renamed it to mystd. The I changed all > occurences of std by mystd in all files. > > That works most of the ti

Re: Practical parallelization of D compilation

2020-01-08 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jan 08, 2020 at 09:13:18AM +, Chris Katko via Digitalmars-d-learn wrote: > On Wednesday, 8 January 2020 at 06:51:57 UTC, H. S. Teoh wrote: [...] > > Generally, the recommendation is to separately compile each package. [...] > What's the downsides / difficulties / "hoops to jump through

Re: Practical parallelization of D compilation

2020-01-08 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jan 08, 2020 at 06:56:20PM +, Guillaume Lathoud via Digitalmars-d-learn wrote: > Thanks to all for the answers. > > The package direction is precisely what I am trying to avoid. It is > still not obvious to me how much work (how many trials) would be > needed to decide on granularity,

Re: Calling D code from C

2020-01-08 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jan 08, 2020 at 06:12:01PM +, Stefan via Digitalmars-d-learn wrote: [...] > But you can easily do the initialization in your D code, by calling > rt_init() and rt_term(), like this: [...] > extern(C) int rt_init(); > extern(C) int rt_term(); > extern(C) __gshared bool rt_initialized = f

Re: Practical parallelization of D compilation

2020-01-08 Thread Guillaume Lathoud via Digitalmars-d-learn
Thanks to all for the answers. The package direction is precisely what I am trying to avoid. It is still not obvious to me how much work (how many trials) would be needed to decide on granularity, as well as how much work to automatize the decision to recompile a package or not ; and finally,

Re: Calling D code from C

2020-01-08 Thread Stefan via Digitalmars-d-learn
On Thursday, 26 May 2005 at 20:41:10 UTC, Vathix wrote: The problem is that D's main() initializes things. Using a C main() bypasses that startup code. Put the main() in the D file (with D extern) and have it call a function in the C file that you will treat as main. That's correct, but not

Re: @disable("reason")

2020-01-08 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jan 08, 2020 at 06:06:33AM -0700, Jonathan M Davis via Digitalmars-d-learn wrote: > On Wednesday, January 8, 2020 4:54:06 AM MST Simen Kjærås via Digitalmars-d- > learn wrote: [...] > > struct S { > > @disable this(); > > @disable static S init(); > > } > > > > This will give sen

Re: What is the difference between a[x][y] and a[x,y]?

2020-01-08 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jan 08, 2020 at 09:09:23AM +0100, Robert M. Münch via Digitalmars-d-learn wrote: > On 2020-01-07 19:06:09 +, H. S. Teoh said: > > > It's up to you how to implement all of this, of course. The language > > itself doesn't ship a built-in type that implements this, but it > > does provid

Re: Practical parallelization of D compilation

2020-01-08 Thread user1234 via Digitalmars-d-learn
On Wednesday, 8 January 2020 at 04:40:02 UTC, Guillaume Lathoud wrote: Hello, One of my D applications grew from a simple main and a few source files to more than 200 files. Although I minimized usage of templating and CTFE, the compiling time is now about a minute. I did not find any solutio

Re: @disable("reason")

2020-01-08 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 8 January 2020 at 00:23:48 UTC, Marcel wrote: I would like to tell the user why they can't instantiate the struct. Is there a way to do that? I'd love to have exactly what you said for this reason, but D doesn't really have it. You just have to hope they read the docs (my doc g

Re: Practical parallelization of D compilation

2020-01-08 Thread kinke via Digitalmars-d-learn
On Wednesday, 8 January 2020 at 04:40:02 UTC, Guillaume Lathoud wrote: * first run (compiling everything): 50% to 100% slower than classical compilation, depending on the hardware, resp. on an old 4-core or a more recent 8-core. If parallel compiler invocations for each source file are

Re: @disable("reason")

2020-01-08 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, January 8, 2020 4:54:06 AM MST Simen Kjærås via Digitalmars-d- learn wrote: > On Wednesday, 8 January 2020 at 07:03:26 UTC, Jonathan M Davis > > wrote: > > you could just document that no one should ever use its init > > value explicitly, and that they will have bugs if they do > > Yo

Re: @disable("reason")

2020-01-08 Thread Simen Kjærås via Digitalmars-d-learn
On Wednesday, 8 January 2020 at 07:03:26 UTC, Jonathan M Davis wrote: you could just document that no one should ever use its init value explicitly, and that they will have bugs if they do You also create a static init member marked @disable: struct S { @disable this(); @disable static

Re: @disable("reason")

2020-01-08 Thread Simen Kjærås via Digitalmars-d-learn
On Wednesday, 8 January 2020 at 08:26:51 UTC, user1234 wrote: class Example { @disable this() { pragma(msg, "not allowed..."); } } void main() { new Example(); } outputs: not allowed... /tmp/temp_7F8C65489550.d(12,5): Error: constructor `runnable.Example.this` cannot be used because

Re: Practical parallelization of D compilation

2020-01-08 Thread Chris Katko via Digitalmars-d-learn
On Wednesday, 8 January 2020 at 06:51:57 UTC, H. S. Teoh wrote: On Wed, Jan 08, 2020 at 04:40:02AM +, Guillaume Lathoud via Digitalmars-d-learn wrote: [...] [...] Generally, the recommendation is to separately compile each package. E.g., if you have a source tree of the form: sr

Re: @disable("reason")

2020-01-08 Thread user1234 via Digitalmars-d-learn
On Wednesday, 8 January 2020 at 00:23:48 UTC, Marcel wrote: Hello! I'm writing a library where under certain conditions i need all the default constructors to be disabled. I would like to tell the user why they can't instantiate the struct. Is there a way to do that? class Example { @dis

Re: What is the difference between a[x][y] and a[x,y]?

2020-01-08 Thread Robert M. Münch via Digitalmars-d-learn
On 2020-01-07 19:06:09 +, H. S. Teoh said: It's up to you how to implement all of this, of course. The language itself doesn't ship a built-in type that implements this, but it does provide the scaffolding for you to build a custom multi-dimensional array type. Hi, thanks for your extensiv