Hipreme's #2 Tip of the day - Reducing .di files dependency

2022-10-23 Thread Hipreme via Digitalmars-d-learn
For reducing a D Interface file dependency when generating it with the `-H` flag for DMD, you can't import a module on the top level. Take a look at that example: ```d module a; import std.stdio; void printSomething(string a) { writeln(a); } ``` If you generate the .di interface file while u

Re: Design question regarding saving changes in the original array and/or returning a new set

2022-10-23 Thread matheus via Digitalmars-d-learn
On Sunday, 23 October 2022 at 17:36:25 UTC, Paul Backus wrote: On Sunday, 23 October 2022 at 13:32:44 UTC, matheus wrote: ... You say your idea is "like passing some argument", so why not actually pass an argument? For example: ... Hi, thanks for the example, and yes I'd like to do that,

Re: Design question regarding saving changes in the original array and/or returning a new set

2022-10-23 Thread matheus via Digitalmars-d-learn
On Sunday, 23 October 2022 at 16:16:55 UTC, Sergey wrote: On Sunday, 23 October 2022 at 15:47:27 UTC, matheus wrote: Hi H. S. Teoh, I think you misunderstood my question, since English is not my first language maybe this was a problem from my part, but anyway, I'm not talking about "sort" fro

Re: Design question regarding saving changes in the original array and/or returning a new set

2022-10-23 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 23 October 2022 at 13:32:44 UTC, matheus wrote: I have a design question and I'd like to hear some advice. Let's say that I want to create a method to sort an array: arr.sort(asc); I think usually this would usually return a new set of that array but now sorted. But If I want

Re: Design question regarding saving changes in the original array and/or returning a new set

2022-10-23 Thread Sergey via Digitalmars-d-learn
On Sunday, 23 October 2022 at 15:47:27 UTC, matheus wrote: Hi H. S. Teoh, I think you misunderstood my question, since English is not my first language maybe this was a problem from my part, but anyway, I'm not talking about "sort" from main library. This example was if I had designed my "ow

Re: Design question regarding saving changes in the original array and/or returning a new set

2022-10-23 Thread matheus via Digitalmars-d-learn
Hi H. S. Teoh, I think you misunderstood my question, since English is not my first language maybe this was a problem from my part, but anyway, I'm not talking about "sort" from main library. This example was if I had designed my "own version". Matheus.

Re: Design question regarding saving changes in the original array and/or returning a new set

2022-10-23 Thread H. S. Teoh via Digitalmars-d-learn
On Sun, Oct 23, 2022 at 01:32:44PM +, matheus via Digitalmars-d-learn wrote: > Hi, > > I have a design question and I'd like to hear some advice. Let's say > that I want to create a method to sort an array: > > arr.sort(asc); > > I think usually this would usually return a new set of tha

Design question regarding saving changes in the original array and/or returning a new set

2022-10-23 Thread matheus via Digitalmars-d-learn
Hi, I have a design question and I'd like to hear some advice. Let's say that I want to create a method to sort an array: arr.sort(asc); I think usually this would usually return a new set of that array but now sorted. But If I want to do this in the original, I think I would do this: