Re: need article: How is working D-GC?

2019-06-11 Thread rikki cattermole via Digitalmars-d-learn
On 12/06/2019 11:40 AM, Rémy Mouëza wrote: If I recall correctly, there is (or was) also a precise GC in the work, but I currently don't have any links to it. Its already in. Its a modification on the conservative GC to make it more efficient. https://github.com/dlang/druntime/blob/master/src

Re: Elegant way to test if members of array A are present in array B?

2019-06-11 Thread Murilo via Digitalmars-d-learn
On Tuesday, 11 June 2019 at 17:12:17 UTC, Robert M. Münch wrote: Is there a simple and elegant way to do this? Or is just using a foreach(...) with canFind() the best way? I made it this way, I consider it elegant. I don't know if others will like it. Here it is: import std.stdio : writeln; i

Re: need article: How is working D-GC?

2019-06-11 Thread Rémy Mouëza via Digitalmars-d-learn
On Tuesday, 11 June 2019 at 18:20:59 UTC, KnightMare wrote: please write some explanation about subj. - what exactly it scans? - why it scan data-segment? https://issues.dlang.org/show_bug.cgi?id=15723 https://issues.dlang.org/show_bug.cgi?id=19947 precise GC doesn't help with issues. - maybe add

Re: Elegant way to test if members of array A are present in array B?

2019-06-11 Thread KnightMare via Digitalmars-d-learn
On Tuesday, 11 June 2019 at 18:39:38 UTC, KnightMare wrote: probably strstr https://dlang.org/library/core/stdc/string/strstr.html implemented over it. there is a tendency to remove dependency from C-runtime. *FIX* strpbrk https://dlang.org/phobos/core_stdc_string.html#.strpbrk

Re: Elegant way to test if members of array A are present in array B?

2019-06-11 Thread KnightMare via Digitalmars-d-learn
On Tuesday, 11 June 2019 at 17:12:17 UTC, Robert M. Münch wrote: Is there a simple and elegant way to do this? Or is just using a foreach(...) with canFind() the best way? not elegant, not simple. for byte/short/ubye/ushort only https://www.strchr.com/strcmp_and_strlen_using_sse_4.2 https://dla

need article: How is working D-GC?

2019-06-11 Thread KnightMare via Digitalmars-d-learn
please write some explanation about subj. - what exactly it scans? - why it scan data-segment? https://issues.dlang.org/show_bug.cgi?id=15723 https://issues.dlang.org/show_bug.cgi?id=19947 precise GC doesn't help with issues. - maybe add new type like gcpointer or something (making word "pointer"

Re: Elegant way to test if members of array A are present in array B?

2019-06-11 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 11 June 2019 at 17:12:17 UTC, Robert M. Münch wrote: Is there a simple and elegant way to do this? Or is just using a foreach(...) with canFind() the best way? It's a space/time tradeoff. foreach with canFind is O(n^2) time and O(1) space. If you use an associative array or a set,

Re: Elegant way to test if members of array A are present in array B?

2019-06-11 Thread Alex via Digitalmars-d-learn
On Tuesday, 11 June 2019 at 17:12:17 UTC, Robert M. Münch wrote: Is there a simple and elegant way to do this? Or is just using a foreach(...) with canFind() the best way? There is also find_among, but the performance is the same, I assume. https://dlang.org/library/std/algorithm/searching/fi

Elegant way to test if members of array A are present in array B?

2019-06-11 Thread Robert M. Münch via Digitalmars-d-learn
Is there a simple and elegant way to do this? Or is just using a foreach(...) with canFind() the best way? -- Robert M. Münch http://www.saphirion.com smarter | better | faster

Re: D compiler need -nogc witch and document of library also need nogc button

2019-06-11 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Jun 11, 2019 at 02:46:03PM +, dangbinghoo via Digitalmars-d-learn wrote: > On Tuesday, 11 June 2019 at 12:40:39 UTC, Adam D. Ruppe wrote: > > On Tuesday, 11 June 2019 at 08:59:01 UTC, dangbinghoo wrote: > > > We need to make sure we use only @nogc API when writing code, not > > > when

Re: D compiler need -nogc witch and document of library also need nogc button

2019-06-11 Thread dangbinghoo via Digitalmars-d-learn
On Tuesday, 11 June 2019 at 10:24:05 UTC, KnightMare wrote: On Tuesday, 11 June 2019 at 08:05:31 UTC, dangbinghoo wrote: I think that D compiler needs -nogc switch to fully disable gc for a project, LDC -nogc? thanks for help. It's a shame that I didn't look in details of the LCD help inf

Re: D compiler need -nogc witch and document of library also need nogc button

2019-06-11 Thread KnightMare via Digitalmars-d-learn
On Tuesday, 11 June 2019 at 14:44:20 UTC, KnightMare wrote: Stroustrup said about C++ (not exactly quote. I translated it from my lang not English): since C and C ++ will be used by the same people on many years, the differences between languages should be either minimal or maximal to minimize t

Re: D compiler need -nogc witch and document of library also need nogc button

2019-06-11 Thread KnightMare via Digitalmars-d-learn
On Tuesday, 11 June 2019 at 12:42:03 UTC, Adam D. Ruppe wrote: On Tuesday, 11 June 2019 at 10:24:05 UTC, KnightMare wrote: people who are interested only in betterC/nogc shouldn't see documentation to api that they are not suitable. I've considered doing that before, but it is actually imposs

Re: D compiler need -nogc witch and document of library also need nogc button

2019-06-11 Thread dangbinghoo via Digitalmars-d-learn
On Tuesday, 11 June 2019 at 12:40:39 UTC, Adam D. Ruppe wrote: On Tuesday, 11 June 2019 at 08:59:01 UTC, dangbinghoo wrote: We need to make sure we use only @nogc API when writing code, not when running the app. That's what the @nogc annotation does, statically forces you to only use other @n

Re: Variadic template parameters, refactor a long chain of static if's to 'functions'.

2019-06-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 11 June 2019 at 09:26:56 UTC, realhet wrote: static bool processId(bool captureIntId, alias r, alias a)(){ mixin("alias ta = typeof("~a.stringof~");"); As I have been saying a lot, mixin and stringof should almost never be used together. You could write this a lot easier: a

Re: D compiler need -nogc witch and document of library also need nogc button

2019-06-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 11 June 2019 at 08:59:01 UTC, dangbinghoo wrote: We need to make sure we use only @nogc API when writing code, not when running the app. That's what the @nogc annotation does, statically forces you to only use other @nogc stuff via compiler errors.

Re: D compiler need -nogc witch and document of library also need nogc button

2019-06-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 11 June 2019 at 10:24:05 UTC, KnightMare wrote: people who are interested only in betterC/nogc shouldn't see documentation to api that they are not suitable. I've considered doing that before, but it is actually impossible to get right in the general case due to attribute inference

Re: D compiler need -nogc witch and document of library also need nogc button

2019-06-11 Thread KnightMare via Digitalmars-d-learn
On Tuesday, 11 June 2019 at 08:05:31 UTC, dangbinghoo wrote: I think that D compiler needs -nogc switch to fully disable gc for a project, LDC -nogc? and document of phobos also needs a friendly way to list-out all @nogc API. +1 people who are interested only in betterC/nogc shouldn't see

Variadic template parameters, refactor a long chain of static if's to 'functions'.

2019-06-11 Thread realhet via Digitalmars-d-learn
Hi again, I'm trying to do variadic parameter processing, and I have the following function that works fine: static bool same(T1, T2)(){ pragma(msg, "same? "~T1.stringof~" "~T2.stringof); return is(immutable(T1)==immutable(T2)); } Btn btn(T...)(string params, T args){ enum c

Blog Post #0043 - File Dialog IX - Custom Dialogs (2 of 3)

2019-06-11 Thread Ron Tarrant via Digitalmars-d-learn
This is the second in a series (Custom Dialogs) within a series (Dialogs) and deals with the action area. It's available here: http://gtkdcoding.com/2019/06/11/0043-custom-dialog-ii.html

Re: D compiler need -nogc witch and document of library also need nogc button

2019-06-11 Thread dangbinghoo via Digitalmars-d-learn
On Tuesday, 11 June 2019 at 08:16:31 UTC, Basile B. wrote: On Tuesday, 11 June 2019 at 08:08:14 UTC, Basile B. wrote: you can do this with a druntime switch or by calling GC.disable in your main() the druntime switch is "--DRT-gc=gc:manual". You pass it the compiled program after its own

Re: D compiler need -nogc witch and document of library also need nogc button

2019-06-11 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 11 June 2019 at 08:08:14 UTC, Basile B. wrote: On Tuesday, 11 June 2019 at 08:05:31 UTC, dangbinghoo wrote: hi there, I think that D compiler needs -nogc switch to fully disable gc for a project, and document of phobos also needs a friendly way to list-out all @nogc API. we alre

D compiler need -nogc witch and document of library also need nogc button

2019-06-11 Thread dangbinghoo via Digitalmars-d-learn
hi there, I think that D compiler needs -nogc switch to fully disable gc for a project, and document of phobos also needs a friendly way to list-out all @nogc API. we already have -betterC, and betterC disabled GC, why we could not have a standalone option for doing this? binghoo da

Re: D compiler need -nogc witch and document of library also need nogc button

2019-06-11 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 11 June 2019 at 08:05:31 UTC, dangbinghoo wrote: hi there, I think that D compiler needs -nogc switch to fully disable gc for a project, and document of phobos also needs a friendly way to list-out all @nogc API. we already have -betterC, and betterC disabled GC, why we could no