Options for unit testing in D?

2019-06-20 Thread Mike Brockus via Digitalmars-d-learn
If you never herd about Meson before: 樂. https://mesonbuild.com/ I am wondering as to what options are available for a Meson build user when unit testing? What I am trying todo is simply rewrite my C17 project reference templates to D versions so I may show other developers the basic

Re: Range violation error when reading from a file

2019-06-20 Thread Samir via Digitalmars-d-learn
On Tuesday, 18 June 2019 at 09:42:41 UTC, aliak wrote: On Tuesday, 18 June 2019 at 01:15:54 UTC, Samir wrote: On Monday, 17 June 2019 at 03:46:11 UTC, Norm wrote: That's because you're using write*ln*. So even though line is empty, you still output a new line. Curious. I am going to have to

Re: Transform a function's body into a string for mixing in

2019-06-20 Thread Dennis via Digitalmars-d-learn
On Thursday, 20 June 2019 at 19:09:11 UTC, Emmanuelle wrote: Is there any trait or Phobos function for transforming a function/delegate/lambda/whatever's body into a string suitable for `mixin(...)`? For example: See: https://forum.dlang.org/post/kozwskltzidfnatbp...@forum.dlang.org If not,

Re: Transform a function's body into a string for mixing in

2019-06-20 Thread Max Haughton via Digitalmars-d-learn
On Thursday, 20 June 2019 at 19:09:11 UTC, Emmanuelle wrote: Hello! Is there any trait or Phobos function for transforming a function/delegate/lambda/whatever's body into a string suitable for `mixin(...)`? For example: --- __traits(getBody, (int a, int b) => a + b); // returns "(int a,

Transform a function's body into a string for mixing in

2019-06-20 Thread Emmanuelle via Digitalmars-d-learn
Hello! Is there any trait or Phobos function for transforming a function/delegate/lambda/whatever's body into a string suitable for `mixin(...)`? For example: --- __traits(getBody, (int a, int b) => a + b); // returns "(int a, int b) => a + b" //

Re: make C is scriptable like D

2019-06-20 Thread Jonathan Marler via Digitalmars-d-learn
On Thursday, 20 June 2019 at 06:20:17 UTC, dangbinghoo wrote: hi there, a funny thing: $ cat rgcc #!/bin/sh cf=$@ mycf=__`echo $cf|xargs basename` cat $cf | sed '1d' > ${mycf} gcc ${mycf} -o a.out rm ${mycf} ./a.out $ cat test.c #!/home/user/rgcc #include

Re: make C is scriptable like D

2019-06-20 Thread Cym13 via Digitalmars-d-learn
On Thursday, 20 June 2019 at 06:20:17 UTC, dangbinghoo wrote: hi there, a funny thing: $ cat rgcc #!/bin/sh cf=$@ mycf=__`echo $cf|xargs basename` cat $cf | sed '1d' > ${mycf} gcc ${mycf} -o a.out rm ${mycf} ./a.out $ cat test.c #!/home/user/rgcc #include

Re: DIP 1016 and const ref parameters

2019-06-20 Thread Nicholas Wilson via Digitalmars-d-learn
On Wednesday, 19 June 2019 at 19:25:59 UTC, Jonathan M Davis wrote: Aside from looking through the newsgroup/forum for discussions on DIPs, that's pretty much all you're going to find on that. Andrei's talk is the most up-to-date information that we have about this particular DIP. The

Re: create and initialise array

2019-06-20 Thread Alex via Digitalmars-d-learn
Thanks Matheus, thats what i needed. I added a PR to mention this function in the language documentation about arrays.

Re: Where can find fix length array memory layout document

2019-06-20 Thread XavierAP via Digitalmars-d-learn
On Tuesday, 18 June 2019 at 12:26:14 UTC, lili wrote: Hi guys: Is the Dlang fix-length array alloc on stack? when a test writeln([1]).sizeof //16 writeln([2]).sizeof //16 Why, What is the fix-length array memory layout. You are quite confused... [...] is an array literal, not

Re: create and initialise array

2019-06-20 Thread KnightMare via Digitalmars-d-learn
On Thursday, 20 June 2019 at 01:32:04 UTC, matheus wrote: import std.stdio; import std.array; void main(){ auto s = uninitializedArray!(float[])(100); s[] = 0.0f; writeln(s[0]); } another version: auto arr = new double[ 10 ]; writeln( arr[5] ); // NaN arr.length += 10; writeln(

Re: is there any micro-service library in D?

2019-06-20 Thread dangbinghoo via Digitalmars-d-learn
On Wednesday, 19 June 2019 at 11:19:17 UTC, Marco de Wild wrote: On Wednesday, 19 June 2019 at 08:29:15 UTC, dangbinghoo wrote: hi there, Does anyone know the micro-service oriented design library or framework in D? thanks! binghoo dang What do you need from such a library? Some

make C is scriptable like D

2019-06-20 Thread dangbinghoo via Digitalmars-d-learn
hi there, a funny thing: $ cat rgcc #!/bin/sh cf=$@ mycf=__`echo $cf|xargs basename` cat $cf | sed '1d' > ${mycf} gcc ${mycf} -o a.out rm ${mycf} ./a.out $ cat test.c #!/home/user/rgcc #include int main() { printf("hello\n"); }