Re: understanding Auto-Test

2018-03-21 Thread Seb via Digitalmars-d
On Thursday, 22 March 2018 at 05:00:07 UTC, John Belmonte wrote: On Thursday, 22 March 2018 at 04:25:00 UTC, Seb wrote: - Every time a PR is merged at dmd, druntime or phobos ALL auto-tester results get invalidated If a change on the destination branch causes a PR to require an automatic

Re: understanding Auto-Test

2018-03-21 Thread John Belmonte via Digitalmars-d
On Thursday, 22 March 2018 at 04:25:00 UTC, Seb wrote: - Every time a PR is merged at dmd, druntime or phobos ALL auto-tester results get invalidated If a change on the destination branch causes a PR to require an automatic merge, certainly build and tests should be rerun. But if the two

Re: Manipulate slice or specific element of range and return range

2018-03-21 Thread Seb via Digitalmars-d-learn
On Wednesday, 21 March 2018 at 11:30:28 UTC, Timoses wrote: Hey, I'm struggling to find a way to achieve this. I've looked through std.algorithm but didn't find anything.. Maybe I'm blind. What I would like to do is filter out all spaces in a string and change the front letter to lower

Re: understanding Auto-Test

2018-03-21 Thread Seb via Digitalmars-d
On Thursday, 22 March 2018 at 04:17:52 UTC, Mike Franklin wrote: On Thursday, 22 March 2018 at 04:12:00 UTC, John Belmonte wrote: I'm still rather puzzled. My pull request remains with 8 tests pending after several hours. I can't find any confirmation on the pulls display

Re: understanding Auto-Test

2018-03-21 Thread Seb via Digitalmars-d
On Thursday, 22 March 2018 at 04:12:00 UTC, John Belmonte wrote: On Thursday, 22 March 2018 at 01:51:49 UTC, Mike Franklin wrote: I believe what happened is a different PR was merged. When a PR is merged, all tests are invalidated, and the autotester begins testing them again. There is also

Re: understanding Auto-Test

2018-03-21 Thread Mike Franklin via Digitalmars-d
On Thursday, 22 March 2018 at 04:12:00 UTC, John Belmonte wrote: I'm still rather puzzled. My pull request remains with 8 tests pending after several hours. I can't find any confirmation on the pulls display https://auto-tester.puremagic.com/pulls.ghtml?projectid=1 that it intends to run

Re: understanding Auto-Test

2018-03-21 Thread Mike Franklin via Digitalmars-d
On Thursday, 22 March 2018 at 04:17:52 UTC, Mike Franklin wrote: Let's see what happens after the auto-tester starts testing it again. Note that it could be a while, as there are PRs that will be getting merged in the next 24 hours that will restart the test queue. Mike

Re: Understanding slide

2018-03-21 Thread Seb via Digitalmars-d-learn
On Thursday, 22 March 2018 at 03:58:35 UTC, Seb wrote: On Thursday, 22 March 2018 at 03:39:38 UTC, Jordan Wilson wrote: auto a = iota(5).slide!(Yes.withPartial)(3); auto b = iota(5).slide!(No.withPartial)(3); assert (a.equal(b)); The assert passes, but I would expect it to fail? They both

Re: understanding Auto-Test

2018-03-21 Thread John Belmonte via Digitalmars-d
On Thursday, 22 March 2018 at 01:51:49 UTC, Mike Franklin wrote: I believe what happened is a different PR was merged. When a PR is merged, all tests are invalidated, and the autotester begins testing them again. There is also a priority affecting which PRs get tested first. Those that are

Re: Understanding slide

2018-03-21 Thread Seb via Digitalmars-d-learn
On Thursday, 22 March 2018 at 03:39:38 UTC, Jordan Wilson wrote: auto a = iota(5).slide!(Yes.withPartial)(3); auto b = iota(5).slide!(No.withPartial)(3); assert (a.equal(b)); The assert passes, but I would expect it to fail? They both are: [[0,1,2],[1,2,3],[2,3,4]] Thanks, Jordan See:

Understanding slide

2018-03-21 Thread Jordan Wilson via Digitalmars-d-learn
auto a = iota(5).slide!(Yes.withPartial)(3); auto b = iota(5).slide!(No.withPartial)(3); assert (a.equal(b)); The assert passes, but I would expect it to fail? They both are: [[0,1,2],[1,2,3],[2,3,4]] Thanks, Jordan

Re: #dbugfix 17592

2018-03-21 Thread Adam D. Ruppe via Digitalmars-d
On Thursday, 22 March 2018 at 01:55:48 UTC, 12345swordy wrote: Are you suggesting that we need runtime version of system/user attributes? We already have that in a sense - InvalidMemoryOperationError is thrown if you try to GC allocate from inside a GC destructor. The attributes are supposed

Re: #dbugfix 17592

2018-03-21 Thread Adam D. Ruppe via Digitalmars-d
On Thursday, 22 March 2018 at 02:16:56 UTC, SimonN wrote: Does the compiler infer nogc-ness of `emplace` at instantiation? Yes, it does with all templates, actually. Since their nogcness (and other attributes like nothrow, pure, etc) frequently depend on what arguments they are passed, the

Re: #dbugfix 17592

2018-03-21 Thread SimonN via Digitalmars-d
On Wednesday, 21 March 2018 at 13:55:16 UTC, Adam D. Ruppe wrote: `emplace` is ALREADY `@nogc` Interesting -- I checked the phobos source, and none of the `emplace` or `emplaceRef` are declared `@nogc`, yet the unittests marked as `@nogc` pass. Does the compiler infer nogc-ness of `emplace`

Re: #dbugfix 17592

2018-03-21 Thread 12345swordy via Digitalmars-d
On Thursday, 22 March 2018 at 01:09:56 UTC, Adam D. Ruppe wrote: But @nogc is a compile time thing, meaning it cannot work here. Are you suggesting that we need runtime version of system/user attributes? All classes are dynamic types I do not see it anywhere in the dlang specification

Re: understanding Auto-Test

2018-03-21 Thread Mike Franklin via Digitalmars-d
On Thursday, 22 March 2018 at 01:46:08 UTC, John Belmonte wrote: I'm trying to understand why my pull request was queued in D2 Auto-Test for only 2 of 8 tests, with the remaining left in pending state. https://auto-tester.puremagic.com/pull-history.ghtml?projectid=1=1=8051 Since there

understanding Auto-Test

2018-03-21 Thread John Belmonte via Digitalmars-d
I'm trying to understand why my pull request was queued in D2 Auto-Test for only 2 of 8 tests, with the remaining left in pending state. https://auto-tester.puremagic.com/pull-history.ghtml?projectid=1=1=8051 Since there are pending tests, I'd expect it to appear in the standard priority

[Issue 18600] Regex performance enhancement for repeated matchFirst calls

2018-03-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18600 --- Comment #1 from github-bugzi...@puremagic.com --- Commit pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/4318073f40ae3e82ac1847da5e037ab2f091d6fc Fix issue 18600 Revamp std.regex caching for matchFirst

[Issue 18600] Regex performance enhancement for repeated matchFirst calls

2018-03-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18600 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED

Re: #dbugfix 17592

2018-03-21 Thread Adam D. Ruppe via Digitalmars-d
On Wednesday, 21 March 2018 at 19:21:15 UTC, 12345swordy wrote: That seems to be it's own separate problem, as it involves generating dynamic types at run-time, which it needs run-time equivalent of attribute checking. But @nogc is a compile time thing, meaning it cannot work here. My

Re: -betterC is amazing, make (/keep making) it more sophisticated!

2018-03-21 Thread Seb via Digitalmars-d
On Wednesday, 21 March 2018 at 23:46:19 UTC, jmh530 wrote: On Wednesday, 21 March 2018 at 22:48:36 UTC, Seb wrote: I heard that Walter recently ported his DMC++ to D and I heard that someone was working on this, so chances aren't too bad that this might happen ;-) You might check out

Re: -betterC is amazing, make (/keep making) it more sophisticated!

2018-03-21 Thread Walter Bright via Digitalmars-d
On 3/21/2018 3:48 PM, Seb wrote: I heard that Walter recently ported his DMC++ to D Yes, indeed: https://github.com/DigitalMars/Compiler I want to convert the back end to D, too, but am blocked by https://github.com/dlang/dmd/pull/7714 Seb, can you help with that?

[Issue 18644] [dip1000] escape of outer local not detected

2018-03-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18644 --- Comment #4 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/51565f362fd318ceb0cf94519819c3232b1adb22 fix Issue 18644 - [dip1000] escape of outer local not

[Issue 18644] [dip1000] escape of outer local not detected

2018-03-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18644 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED

Re: -betterC is amazing, make (/keep making) it more sophisticated!

2018-03-21 Thread jmh530 via Digitalmars-d
On Wednesday, 21 March 2018 at 22:48:36 UTC, Seb wrote: I heard that Walter recently ported his DMC++ to D and I heard that someone was working on this, so chances aren't too bad that this might happen ;-) You might check out Atila's github page (I don't think it's ready for release

Re: recursive template expansion: Why does this not compile?

2018-03-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, March 21, 2018 22:50:32 Ontonator via Digitalmars-d-learn wrote: > On Wednesday, 21 March 2018 at 06:39:22 UTC, ag0aep6g wrote: > > On 03/21/2018 01:47 AM, Ontonator wrote: > >> The following code does not compile: > >>> [...] > >> > >> It gives the error: > >>> [...] > >> > >> The

Re: D's type declarations seem to read right to left.

2018-03-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, March 21, 2018 20:07:09 tipdbmp via Digitalmars-d-learn wrote: > D's type declarations seem to read right to left. > > > int an_integer; > > int[10] an_array_of_10_integers; > int[10]* a_pointer_to_an_array_of_10_integers = > _array_of_10_integers; > > int*[10]

[Issue 18634] std.container.rbtree does not work with delegate comparators

2018-03-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18634 --- Comment #2 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/a3f8992766b1baf4d4dd2d57043a734db29c221b Fix issue 18634 - support for delegate comparators in

Re: recursive template expansion: Why does this not compile?

2018-03-21 Thread Ontonator via Digitalmars-d-learn
On Wednesday, 21 March 2018 at 06:39:22 UTC, ag0aep6g wrote: On 03/21/2018 01:47 AM, Ontonator wrote: The following code does not compile: [...] It gives the error: [...] The aliases do not have to be aliases, as long as there is some reference to the class (e.g. method and variable

[Issue 18634] std.container.rbtree does not work with delegate comparators

2018-03-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18634 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED

Re: -betterC is amazing, make (/keep making) it more sophisticated!

2018-03-21 Thread Seb via Digitalmars-d
On Wednesday, 21 March 2018 at 22:33:37 UTC, Aedt wrote: I've been playing with D for a while. I usually write/maintain/contribute to C and C++ applications for *nix. D is low key amazing, it has - C standard library in the standard - continually improving betterC idioms - built in version

[Issue 17906] Use of delete should be allowed without a deprecation in a deprecated scope

2018-03-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17906 Seb changed: What|Removed |Added Keywords||pull --- Comment #5 from Seb

[Issue 17906] Use of delete should be allowed without a deprecation in a deprecated scope

2018-03-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17906 Seb changed: What|Removed |Added CC||greensunn...@gmail.com

-betterC is amazing, make (/keep making) it more sophisticated!

2018-03-21 Thread Aedt via Digitalmars-d
I've been playing with D for a while. I usually write/maintain/contribute to C and C++ applications for *nix. D is low key amazing, it has - C standard library in the standard - continually improving betterC idioms - built in version blocks, unit test and debug blocks - painless doc gen -

Re: Slow start up time of runtime (correction: Windows real-time protection)

2018-03-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 21 March 2018 at 13:26:48 UTC, HeiHon wrote: In Windows Security Center Settings (where you can disable realtime scan) there is also an entry "Exclusions" (in german windows "Ausschlüsse"). I added exclusions for the folder, where I installed dmd and ldc and I added an exclusion

Re: Need example of usage DerelictPQ

2018-03-21 Thread number via Digitalmars-d-learn
On Wednesday, 24 December 2014 at 11:56:40 UTC, Suliman wrote: Could anybody provide any simple examples of usage DerelictPQ. I do not have experience of C, and I can't understand how to use this driver. I need just basics like connect, select and insert.

Re: Slow start up time of runtime (correction: Windows real-time protection)

2018-03-21 Thread Dennis via Digitalmars-d-learn
On Wednesday, 21 March 2018 at 13:26:48 UTC, HeiHon wrote: I added exclusions for the folder, where I installed dmd and ldc and I added an exclusion for the folder, where I compile my D programs. Now startup of dmd and freshly compiled programs is fast again. I've done this too now, thanks

Re: Flaw in DIP1000? Returning a Result Struct in DIP1000

2018-03-21 Thread jmh530 via Digitalmars-d
On Wednesday, 21 March 2018 at 17:13:40 UTC, Jack Stouffer wrote: [snip] How can we return non-scoped result variables constructed from scope variables without copies? If you re-wrote this so that it just had pointers, would it be simpler? Below is my attempt, not sure it's the same...

[Issue 18461] codegen bug - OPbt expressions and assignments to ambiguous symbols

2018-03-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18461 --- Comment #11 from Walter Bright --- https://github.com/dlang/dmd/pull/8065 --

[Issue 18461] codegen bug - OPbt expressions and assignments to ambiguous symbols

2018-03-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18461 Walter Bright changed: What|Removed |Added Summary|codegen bug in dmd -|codegen bug - OPbt

Re: does it scale to have 1 person approve of all phobos additions?

2018-03-21 Thread Andrei Alexandrescu via Digitalmars-d
On 03/20/2018 06:56 PM, Meta wrote: Does it make sense? In my opinion, no, but according to Andrei be has tried being less hands-on before and it resulted in measurably worse quality code in Phobos; thus, he re-established himself as the gatekeeper. I agree that it doesn't scale and think that

Re: OK, I'm stumped on this one: dstep, struct, mixin, bitfields

2018-03-21 Thread Jacob Carlborg via Digitalmars-d-learn
On 2018-03-21 20:30, Russel Winder wrote: Thanks to Adam and Ali, it was clear and obvious. Please report and issue so it's not forgotten. -- /Jacob Carlborg

Re: Packages and module import

2018-03-21 Thread Jacob Carlborg via Digitalmars-d-learn
On 2018-03-21 17:06, Russel Winder wrote: No I wasn't. And it works a treat. Cool :). I recommend having a look at the changelog and the usage information (--help). -- /Jacob Carlborg

Re: D's type declarations seem to read right to left.

2018-03-21 Thread Nick Sabalausky via Digitalmars-d-learn
On Wednesday, 21 March 2018 at 20:07:09 UTC, tipdbmp wrote: D's type declarations seem to read right to left. int an_integer; int[10] an_array_of_10_integers; int[10]* a_pointer_to_an_array_of_10_integers = _array_of_10_integers; int*[10] an_array_of_10_pointers_to_integers; int*[10]*

Re: D's type declarations seem to read right to left.

2018-03-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 21 March 2018 at 20:07:09 UTC, tipdbmp wrote: I think this is a big improvement over C's "spiral" way of reading types: Yes, D is perfect and has achieved sanity where before there was none. You can read basically anything with little knowledge. void function()[]

D's type declarations seem to read right to left.

2018-03-21 Thread tipdbmp via Digitalmars-d-learn
D's type declarations seem to read right to left. int an_integer; int[10] an_array_of_10_integers; int[10]* a_pointer_to_an_array_of_10_integers = _array_of_10_integers; int*[10] an_array_of_10_pointers_to_integers; int*[10]* a_pointer_to_an_array_of_10_pointers_to_integers =

Re: Flaw in DIP1000? Returning a Result Struct in DIP1000

2018-03-21 Thread Jack Stouffer via Digitalmars-d
On Wednesday, 21 March 2018 at 18:50:59 UTC, Jonathan M Davis wrote: The struct being returned would need to be marked with scope (or its members marked with scope) such that the compiler treated the result as containing values from the function arguments. I don't know whether that's possible

Re: Cumulative code coverage?

2018-03-21 Thread H. S. Teoh via Digitalmars-d
On Wed, Mar 21, 2018 at 12:35:08PM -0700, H. S. Teoh via Digitalmars-d wrote: [...] > Cool, passing --DRT-covopt="merge:1" did the trick. [...] Speaking of which, are the --DRT-* options documented anywhere?? I don't even know where to begin to look, besides in the druntime code itself. T --

Re: OK, I'm stumped on this one: dstep, struct, mixin, bitfields

2018-03-21 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Mar 21, 2018 at 07:30:28PM +, Russel Winder via Digitalmars-d-learn wrote: [...] > But :-( > > Why does version have to be a keyword? [...] version(all) { ... } version(none) { ... } version(Posix) { ... } version(Windows) { ... } But yeah, using

Re: Flaw in DIP1000? Returning a Result Struct in DIP1000

2018-03-21 Thread Jack Stouffer via Digitalmars-d
On Wednesday, 21 March 2018 at 19:15:41 UTC, Meta wrote: But the compiler doesn't like that. However, I _did_ get it working by doing this: GetoptResult getopt(T...)(scope T opts) @safe { return GetoptResult([Option(opts[0], opts[1])]); } Which is not ideal, obviously, but the notion that

Re: Cumulative code coverage?

2018-03-21 Thread H. S. Teoh via Digitalmars-d
On Wed, Mar 21, 2018 at 05:34:58PM +, Seb via Digitalmars-d wrote: > On Wednesday, 21 March 2018 at 16:39:48 UTC, H. S. Teoh wrote: > > Is it possible to get cumulative code coverage using dmd? I.e., > > accumulate code coverage stats over a series of runs from an > > external test suite.

Re: OK, I'm stumped on this one: dstep, struct, mixin, bitfields

2018-03-21 Thread Russel Winder via Digitalmars-d-learn
On Wed, 2018-03-21 at 18:11 +, Adam D. Ruppe via Digitalmars-d- learn wrote: > On Wednesday, 21 March 2018 at 18:00:38 UTC, Russel Winder wrote: > > ubyte, "version", 5, > > > version is a D keyword, so I would suggest trying "version_" > there instead and see if it works. (I'm

Re: strip() and formattedRead()

2018-03-21 Thread realhet via Digitalmars-d-learn
On Wednesday, 21 March 2018 at 18:50:18 UTC, Adam D. Ruppe wrote: On Wednesday, 21 March 2018 at 18:44:12 UTC, realhet wrote: Compiling this I get an error: "formattedRead: cannot deduce arguments from (string, string, float, float, float)" What compiler version are you using? The newest

[Issue 17906] Deprecated functions should not cause deprecated warnings for using deprecated features

2018-03-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17906 --- Comment #4 from FeepingCreature --- Huh, seems like you're right. Not sure if this was fixed or it always worked that way. Either way, good to know! I guess this bug report is about Mathias Lang's problem now. --

Re: #dbugfix 17592

2018-03-21 Thread 12345swordy via Digitalmars-d
On Wednesday, 21 March 2018 at 14:04:58 UTC, Adam D. Ruppe wrote: On Wednesday, 21 March 2018 at 13:39:28 UTC, 12345swordy wrote: You can simply check the .dtor symbols at compile time to see if every .dtor symbol from child to root have a .dtor that have the @nogc attribute In Simen's

Re: Flaw in DIP1000? Returning a Result Struct in DIP1000

2018-03-21 Thread Meta via Digitalmars-d
On Wednesday, 21 March 2018 at 17:13:40 UTC, Jack Stouffer wrote: Consider this example simplified from this PR https://github.com/dlang/phobos/pull/6281 -- struct GetoptResult { Option[] options; } struct Option { string optShort; string help; } GetoptResult

[Issue 17906] Deprecated functions should not cause deprecated warnings for using deprecated features

2018-03-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17906 --- Comment #3 from Mathias Lang --- Could you paste the message generated ? In your example, I would expect a deprecation to be generated for the import, but not on the actual function declaration. --

[Issue 17906] Deprecated functions should not cause deprecated warnings for using deprecated features

2018-03-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17906 --- Comment #2 from FeepingCreature --- That's also true, but my example refers specifically to deprecated functions using deprecated types. However, I labelled the bug report wrong, and your example actually fits it

Re: why does this compile fine, but dies when you run it.

2018-03-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 21 March 2018 at 18:53:39 UTC, steven kladitis wrote: int[] array3; array3[0]=4; array3 is empty. You are trying to set a value that doesn't exist..

[Issue 18645] New: DMD segmentation fault

2018-03-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18645 Issue ID: 18645 Summary: DMD segmentation fault Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: major Priority: P1

Calling Windows Command

2018-03-21 Thread Vino via Digitalmars-d-learn
Hi All, Request your help in calling the windows command to delete all file and folders recursively as the D function rmdirRecurse does not delete file in the permission of the file is readonly in windows 2008 R2 import std.process: execute; import std.array: empty; auto RemoveDir () (

why does this compile fine, but dies when you run it.

2018-03-21 Thread steven kladitis via Digitalmars-d-learn
import std.stdio; void main(){ int[3] array1 = [ 10, 20, 30 ]; auto array2 = array1; // array2's elements are different // from array1's array2[0] = 11; int[] array3; //array4[0]=3; array3[0]=4; auto array4 = array3; writeln(array1,'\n',array2,'\n',array3,'\n',array4); } -- windows 7 64 bit (

Re: strip() and formattedRead()

2018-03-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 21 March 2018 at 18:44:12 UTC, realhet wrote: Compiling this I get an error: "formattedRead: cannot deduce arguments from (string, string, float, float, float)" What compiler version are you using? The newest versions allow this code, though the old ones require an intermediate

[Issue 17906] Deprecated functions should not cause deprecated warnings for using deprecated features

2018-03-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17906 Mathias Lang changed: What|Removed |Added CC|

Re: Flaw in DIP1000? Returning a Result Struct in DIP1000

2018-03-21 Thread Jonathan M Davis via Digitalmars-d
On Wednesday, March 21, 2018 17:13:40 Jack Stouffer via Digitalmars-d wrote: > Consider this example simplified from this PR > https://github.com/dlang/phobos/pull/6281 > > -- > struct GetoptResult > { > Option[] options; > } > > struct Option > { > string optShort; > string

Re: strip() and formattedRead()

2018-03-21 Thread Ali Çehreli via Digitalmars-d-learn
On 03/21/2018 11:44 AM, realhet wrote:   float x,y,z;   if(formattedRead("    vertex -5.1 2.4 3.666".strip, "vertex %f %f %f", x, y, z)){     writefln("v(%f, %f, %f)", x, y, z);   } formattedRead wants to modify the source, so it takes it by reference, which rvalues cannot be passed

Re: How to use an associative array with array values.

2018-03-21 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 21 March 2018 at 18:31:29 UTC, tipdbmp wrote: I see. I guess the other would be: { int[8192] bar; int[8192][string] foo; foo["a"] = bar; foo["a"][8191] = -1; } https://run.dlang.io/is/AK2X2t Are you looking to use static arrays or dynamic? You can't use the new

strip() and formattedRead()

2018-03-21 Thread realhet via Digitalmars-d-learn
Hi, I just got this problem and since an hour can't find answer to it. float x,y,z; if(formattedRead("vertex -5.1 2.4 3.666".strip, "vertex %f %f %f", x, y, z)){ writefln("v(%f, %f, %f)", x, y, z); } Compiling this I get an error: "formattedRead: cannot deduce arguments from

Re: #import mapi.h

2018-03-21 Thread nkm1 via Digitalmars-d-learn
On Wednesday, 21 March 2018 at 16:22:45 UTC, Martin Tschierschke wrote: Is there an step by step introduction how to convert a C header of an external lib into the right extern(C){} block? A blog post or tutorial, or chapter in a D book? (I have those from Packt Publishing) (Especially I am

Re: How to use an associative array with array values.

2018-03-21 Thread tipdbmp via Digitalmars-d-learn
I see. I guess the other would be: { int[8192] bar; int[8192][string] foo; foo["a"] = bar; foo["a"][8191] = -1; }

[Issue 10933] findSplitBefore/After should have needle-less overloads

2018-03-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10933 --- Comment #1 from Luís Marques --- Yup, I've ran into the same issue multiple times. This last time with the plain findSplit; I don't recall if also with findSplitBefore/After. This workaround works:

Re: Template condition evaluation (shortcircuit)

2018-03-21 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Mar 21, 2018 at 05:42:34PM +, rumbu via Digitalmars-d-learn wrote: > I tried to define a template: > > enum isFoo(alias T) = > T.stringof.length >= 3 && T.stringof[0..3] == "abc"; > > int i; > pragma(msg, isFoo!i); > > Error: string slice [0 .. 3] is out of bounds > Error:

Re: OK, I'm stumped on this one: dstep, struct, mixin, bitfields

2018-03-21 Thread Ali Çehreli via Digitalmars-d-learn
On 03/21/2018 11:00 AM, Russel Winder wrote: > The code I am playing with generated by DStep involves lots of lots of > structs with mixin bitfields. All of them seem to compile file, except > one. How is it that: > > mixin(bitfields!( > ubyte, "current_next", 1, > ubyte,

Re: OK, I'm stumped on this one: dstep, struct, mixin, bitfields

2018-03-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 21 March 2018 at 18:00:38 UTC, Russel Winder wrote: ubyte, "version", 5, version is a D keyword, so I would suggest trying "version_" there instead and see if it works. (I'm guessing btw, the error message was way to long and illegible, but this is an easy first guess

Re: does it scale to have 1 person approve of all phobos additions?

2018-03-21 Thread Jonathan M Davis via Digitalmars-d
On Wednesday, March 21, 2018 09:45:46 Russel Winder via Digitalmars-d wrote: > D has the Dub repository, so why is Phobos being "batteries included" even > an issue now? Some folks seem to think that something _has_ to be in the standard library, or the language is sub-standard, and some folks

[Issue 10933] findSplitBefore/After should have needle-less overloads

2018-03-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10933 Luís Marques changed: What|Removed |Added CC||l...@luismarques.eu --

OK, I'm stumped on this one: dstep, struct, mixin, bitfields

2018-03-21 Thread Russel Winder via Digitalmars-d-learn
The code I am playing with generated by DStep involves lots of lots of structs with mixin bitfields. All of them seem to compile file, except one. How is it that: mixin(bitfields!( ubyte, "current_next", 1, ubyte, "version", 5, ubyte, "one2", 2)); /* TS ID */ can

Template condition evaluation (shortcircuit)

2018-03-21 Thread rumbu via Digitalmars-d-learn
I tried to define a template: enum isFoo(alias T) = T.stringof.length >= 3 && T.stringof[0..3] == "abc"; int i; pragma(msg, isFoo!i); Error: string slice [0 .. 3] is out of bounds Error: template object.__equals cannot deduce function from argument types !()(string, string), candidates

Re: Cumulative code coverage?

2018-03-21 Thread Seb via Digitalmars-d
On Wednesday, 21 March 2018 at 16:39:48 UTC, H. S. Teoh wrote: Is it possible to get cumulative code coverage using dmd? I.e., accumulate code coverage stats over a series of runs from an external test suite. Currently, it seems that compiling with -cov will just overwrite the *.lst files

Flaw in DIP1000? Returning a Result Struct in DIP1000

2018-03-21 Thread Jack Stouffer via Digitalmars-d
Consider this example simplified from this PR https://github.com/dlang/phobos/pull/6281 -- struct GetoptResult { Option[] options; } struct Option { string optShort; string help; } GetoptResult getopt(T...)(scope T opts) @safe { GetoptResult res; auto o =

Re: #import mapi.h

2018-03-21 Thread Timoses via Digitalmars-d-learn
On Wednesday, 21 March 2018 at 16:22:45 UTC, Martin Tschierschke wrote: Is there an step by step introduction how to convert a C header of an external lib into the right extern(C){} block? A blog post or tutorial, or chapter in a D book? (I have those from Packt Publishing) While googling I

Re: Manipulate slice or specific element of range and return range

2018-03-21 Thread Timoses via Digitalmars-d-learn
On Wednesday, 21 March 2018 at 12:07:49 UTC, Simen Kjærås wrote: On Wednesday, 21 March 2018 at 11:30:28 UTC, Timoses wrote: unittest { assert("my capitalized string".capitalize == "myCapitalizedString"); } auto capitalize(string s) { import std.regex, std.uni; return

Re: Manipulate slice or specific element of range and return range

2018-03-21 Thread Timoses via Digitalmars-d-learn
On Wednesday, 21 March 2018 at 12:53:56 UTC, Ali Çehreli wrote: Here is another one that uses ForwardRange. import std.range; // empty, take, save, chain, popFrontN; import std.uni; // asLowerCase; import std.algorithm; // equal, filter; import std.conv; // text; auto initialLowerCased(R)(R

Re: #import mapi.h

2018-03-21 Thread ketmar via Digitalmars-d-learn
Martin Tschierschke wrote: or tutorial ok, tutorial: 1. learn C. 2. learn D. 3. DO IT! ;-)

Cumulative code coverage?

2018-03-21 Thread H. S. Teoh via Digitalmars-d
Is it possible to get cumulative code coverage using dmd? I.e., accumulate code coverage stats over a series of runs from an external test suite. Currently, it seems that compiling with -cov will just overwrite the *.lst files from previous runs. Do I have to merge the .lst files externally?

Re: Please vote for Dub integration into Sonatype Nexus

2018-03-21 Thread Andre Pany via Digitalmars-d
On Wednesday, 21 March 2018 at 15:30:57 UTC, Russel Winder wrote: On Wed, 2018-03-21 at 11:49 +, Andre Pany via Digitalmars-d wrote: [...] […] [...] JFrog have Artifactory yes, but I do not know if Bintray is actually something different or just a public instance of Artifactory. In

Re: pow

2018-03-21 Thread Adam D. Ruppe via Digitalmars-d
On Wednesday, 21 March 2018 at 16:29:26 UTC, aerto wrote: thanks, a last question in a diffrent function i use use BigInt i = "105312291668557186697918027683670432318895095400549111254310977536"; and it should work. Note the quotation marks - it reads it as a string because a long number

Re: D, Parasail, Pascal, and Rust vs The Steelman

2018-03-21 Thread Martin Tschierschke via Digitalmars-d
On Wednesday, 21 March 2018 at 16:19:35 UTC, H. S. Teoh wrote: [...] I do not understand the meaning of "subscript ranges"? Isn't this slicing? AFAICT, "subscript" in the spec just means the range of valid array indices (it's old terminology from the 70's / 80's). In which case, it is not

Re: pow

2018-03-21 Thread aerto via Digitalmars-d
On Wednesday, 21 March 2018 at 16:00:56 UTC, Adam D. Ruppe wrote: On Wednesday, 21 March 2018 at 15:56:00 UTC, aerto wrote: why pow(256, 27) gives 0, instead of 105312291668557186697918027683670432318895095400549111254310977536L that result is simply too big to fit in the result. Try using a

#import mapi.h

2018-03-21 Thread Martin Tschierschke via Digitalmars-d-learn
Is there an step by step introduction how to convert a C header of an external lib into the right extern(C){} block? A blog post or tutorial, or chapter in a D book? (I have those from Packt Publishing) (Especially I am trying to get this used with D: Montetdb C-API

Re: D, Parasail, Pascal, and Rust vs The Steelman

2018-03-21 Thread H. S. Teoh via Digitalmars-d
On Wed, Mar 21, 2018 at 04:08:07PM +, Martin Tschierschke via Digitalmars-d wrote: > On Wednesday, 21 March 2018 at 12:52:19 UTC, Paulo Pinto wrote: [...] > > [0] - https://en.wikipedia.org/wiki/Steelman_language_requirements > > Interesting! > > Do you understand this: > > > 7H. Formal

[Issue 7930] Static initialization of static-sized array in union fails

2018-03-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=7930 bitter.ta...@gmx.com changed: What|Removed |Added Status|NEW |RESOLVED CC|

Re: pow

2018-03-21 Thread H. S. Teoh via Digitalmars-d
On Wed, Mar 21, 2018 at 03:56:00PM +, aerto via Digitalmars-d wrote: > why pow(256, 27) gives 0, instead of > 105312291668557186697918027683670432318895095400549111254310977536L Because 256, being an int type, can only hold a 32-bit result, the maximum of which is 2^31 (or 2^32 if you use

Re: Incomprehensible error message

2018-03-21 Thread Russel Winder via Digitalmars-d-learn
On Tue, 2018-03-20 at 14:18 -0700, H. S. Teoh via Digitalmars-d-learn wrote: > […] > > Either way, it will require a lot of effort to pull off. > As Rust has shown appreciating that the quality of the error messages define the quality of the compiler, the quality of the error message from rustc

Re: D, Parasail, Pascal, and Rust vs The Steelman

2018-03-21 Thread Martin Tschierschke via Digitalmars-d
On Wednesday, 21 March 2018 at 12:52:19 UTC, Paulo Pinto wrote: An article comparing the above languages as per the DoD language requirements [0]. http://jedbarber.id.au/steelman.html [0] - https://en.wikipedia.org/wiki/Steelman_language_requirements Interesting! Do you understand this:

Re: Packages and module import

2018-03-21 Thread Russel Winder via Digitalmars-d-learn
On Tue, 2018-03-20 at 22:08 +0100, Jacob Carlborg via Digitalmars-d- learn wrote: > […] > Not sure if this will help, but are you aware that DStep can add a > package to the module declaration using "--package"? No I wasn't. And it works a treat. -- Russel.

Re: pow

2018-03-21 Thread Adam D. Ruppe via Digitalmars-d
On Wednesday, 21 March 2018 at 15:56:00 UTC, aerto wrote: why pow(256, 27) gives 0, instead of 105312291668557186697918027683670432318895095400549111254310977536L that result is simply too big to fit in the result. Try using a bigint instead: import std.bigint, std.stdio; void main() {

pow

2018-03-21 Thread aerto via Digitalmars-d
why pow(256, 27) gives 0, instead of 105312291668557186697918027683670432318895095400549111254310977536L

Re: How to use an associative array with array values.

2018-03-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 21 March 2018 at 15:53:32 UTC, tipdbmp wrote: int[10][string] foo; One option is to initialize like this --- void main() { int[10][string] foo; if("a" !in foo) foo["a"] = [0,0,0,0,0,0,0,0,0,0]; // set all to zero to create the key foo["a"][4] = 4; // now valid to

How to use an associative array with array values.

2018-03-21 Thread tipdbmp via Digitalmars-d-learn
// foo is an associative array/hashtable with // key type: string // value type: int[10] // int[10][string] foo; // foo["a"] = new int[10]; // Range violation at runtime // foo["a"][0] = 1; // Range violation at runtime

  1   2   >