Re: Better debugging?

2021-10-09 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 3 October 2021 at 23:17:25 UTC, Basile B. wrote: On Sunday, 3 October 2021 at 22:21:45 UTC, Tim wrote: [...] 1. LDC2 generate better debug infos, especially for classes, although this might change from the next DMD version (it will include the inherited fields, just like LDC2).

Re: Obtain pointer from static array literal

2021-10-09 Thread Imperatorn via Digitalmars-d-learn
On Friday, 8 October 2021 at 14:07:27 UTC, russhy wrote: https://run.dlang.io/is/S8uMbp It's such a shame that ``[0,1,2,3].ptr`` allocates using GC, even if using ``func(scope const void* ptr)`` Can't something be done to make this ``[0,1,2,3]`` a static array literal? Who thought making

Re: Obtain pointer from static array literal

2021-10-09 Thread Some Guy via Digitalmars-d-learn
On Friday, 8 October 2021 at 14:07:27 UTC, russhy wrote: https://run.dlang.io/is/S8uMbp Maybe this is kind of unrelated, but what is happening here and why does it work? It looks like you've replaced the GC's allocation functions with custom ones, but I couldn't find any documentation on h

Re: Obtain pointer from static array literal

2021-10-09 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 9 October 2021 at 10:44:30 UTC, Some Guy wrote: On Friday, 8 October 2021 at 14:07:27 UTC, russhy wrote: https://run.dlang.io/is/S8uMbp Maybe this is kind of unrelated, but what is happening here and why does it work? It looks like you've replaced the GC's allocation functions

Re: Obtain pointer from static array literal

2021-10-09 Thread russhy via Digitalmars-d-learn
On Saturday, 9 October 2021 at 10:44:30 UTC, Some Guy wrote: On Friday, 8 October 2021 at 14:07:27 UTC, russhy wrote: https://run.dlang.io/is/S8uMbp Maybe this is kind of unrelated, but what is happening here and why does it work? It looks like you've replaced the GC's allocation functions

Re: Obtain pointer from static array literal

2021-10-09 Thread Some Guy via Digitalmars-d-learn
On Saturday, 9 October 2021 at 13:11:29 UTC, Imperatorn wrote: Look in core.memory (https://github.com/dlang/druntime/blob/master/src/core/memory.d) Does this technique work for all D runtime (or std) functions? Can we just define what the function is and then the compiler uses our definition

UFC creating name conflict

2021-10-09 Thread Chris Piker via Digitalmars-d-learn
Hi D I have and old C structure that I have to wrap that has a member named '.seconds', and in the module that handles this I also have conversion functions to go from an internal time representation to struct SysTime values. Unfortunately importing `core.time` brings in a seconds function,

Re: UFC creating name conflict

2021-10-09 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 9 October 2021 at 21:26:52 UTC, Chris Piker wrote: Unfortunately importing `core.time` brings in a seconds function, which due to UFC is confused with a structure member of the same name. How can I explicitly tell the compiler that I'm referring to: ```d thing.seconds # The struc

Re: UFC creating name conflict

2021-10-09 Thread Chris Piker via Digitalmars-d-learn
On Saturday, 9 October 2021 at 21:37:27 UTC, Paul Backus wrote: On Saturday, 9 October 2021 at 21:26:52 UTC, Chris Piker wrote: A struct member always takes priority over a UFCS function, so there must be something else going on that you've left out of your explanation. Can you post a complet

Create array from range

2021-10-09 Thread Greg Strong via Digitalmars-d-learn
This should be a simple question, but I'm having difficult finding an answer. How do I filter some elements of an array into a new array? The filter! function returns a range, but I can't seems to assign it to a new array. I get: Cannot implicitly convert expression of type FilterResult!(_

Re: Create array from range

2021-10-09 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Oct 09, 2021 at 11:58:14PM +, Greg Strong via Digitalmars-d-learn wrote: > This should be a simple question, but I'm having difficult finding an > answer. How do I filter some elements of an array into a new array? > The filter! function returns a range, but I can't seems to assign it

Re: Create array from range

2021-10-09 Thread jfondren via Digitalmars-d-learn
On Saturday, 9 October 2021 at 23:58:14 UTC, Greg Strong wrote: This should be a simple question, but I'm having difficult finding an answer. How do I filter some elements of an array into a new array? The filter! function returns a range, but I can't seems to assign it to a new array. I get

Re: Create array from range

2021-10-09 Thread Ali Çehreli via Digitalmars-d-learn
On 10/9/21 4:58 PM, Greg Strong wrote: How do I filter some elements of an array into a new array? This doesn't answer your specific question but std.algorithm.remove may be usable in some cases: https://dlang.org/phobos/std_algorithm_mutation.html#remove If it matters, the following sol