Re: std.digest toHexString

2017-03-20 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 20 March 2017 at 21:04:30 UTC, Ali Çehreli wrote: Agreed. Surprisingly, there are quite a number of issues that request exactly that, mostly thanks to our old friend bearophile. The following may be the reason for this WAT: This is another case where I can kinda get it in

Re: std.digest toHexString

2017-03-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, March 20, 2017 22:47:24 Adam D. Ruppe via Digitalmars-d-learn wrote: > The rules make sense alone, but together, they are just bizarre. That's frequently where the language design pitfalls lie. Well-meaning features that seem perfectly reasonable on their own (possibly even

Re: exceptions thrown when running app with failed unittests

2017-03-20 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-03-20 00:49, Ervin Bosenbacher wrote: On Sunday, 19 March 2017 at 23:23:48 UTC, Adam D. Ruppe wrote: On Sunday, 19 March 2017 at 22:33:26 UTC, Ervin Bosenbacher wrote: Is it normal to see the long trace output instead of just a failed unit test message? Yeah, it is normal, though IMO

Re: Inplace toLower()

2017-03-20 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-03-19 22:32, Nordlöw wrote: Is there an in-place version of std.uni.toLower() If not, how do I most elegantly construct one? I would recommend against toLower and toUpper as in-place versions. Not all letters can be converted in-place, i.e. they might require more storage. --

Re: Does "dub test" run tests?

2017-03-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, March 20, 2017 07:51:09 Russel Winder via Digitalmars-d-learn wrote: > I have a Meson build for a D program project with a single main.d file > that has some unit tests. Both executable and test executable are > created and work as expected. > > I created a minimal Dub file for this

Re: std.digest toHexString

2017-03-20 Thread Ali Çehreli via Digitalmars-d-learn
On 03/20/2017 09:31 AM, Adam D. Ruppe wrote: On Monday, 20 March 2017 at 16:04:10 UTC, Kagamin wrote: https://dpaste.dzfl.pl/eafa86c5426d Unbelievable, we're both right, sort of. So it is true that typeof(static[]) == dynamic. But the language also allows implicit conversion in the other

Re: exceptions thrown when running app with failed unittests

2017-03-20 Thread Ervin Bosenbacher via Digitalmars-d-learn
On Monday, 20 March 2017 at 07:36:47 UTC, Jacob Carlborg wrote: On 2017-03-20 00:49, Ervin Bosenbacher wrote: On Sunday, 19 March 2017 at 23:23:48 UTC, Adam D. Ruppe wrote: On Sunday, 19 March 2017 at 22:33:26 UTC, Ervin Bosenbacher wrote: Is it normal to see the long trace output instead of

Does "dub test" run tests?

2017-03-20 Thread Russel Winder via Digitalmars-d-learn
I have a Meson build for a D program project with a single main.d file that has some unit tests. Both executable and test executable are created and work as expected. I created a minimal Dub file for this project. Using Dub the program runs as expected. However when I run "dub test" it claims to

Re: Does "dub test" run tests?

2017-03-20 Thread Russel Winder via Digitalmars-d-learn
On Mon, 2017-03-20 at 00:58 -0700, Jonathan M Davis via Digitalmars-d- learn wrote: > […] > I haven't spent the time to dig in and report it properly, but based > on some > of what I saw recently on a project I have, the module with main in > it > didn't have its tests run, as if dub's didn't

Re: Does "dub test" run tests?

2017-03-20 Thread Russel Winder via Digitalmars-d-learn
On Mon, 2017-03-20 at 08:39 +, Russel Winder wrote: > […] > Actually it seems worse than that. Even with "dub -b unittest" it > appears that Dub  compiles main.d without the -unittest flag to ldc2 > and so the normal application runs. And different behaviour with different build options, at

Re: Does "dub test" run tests?

2017-03-20 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-03-20 10:07, Russel Winder via Digitalmars-d-learn wrote: And different behaviour with different build options, at least when using dmd, but I think the same is true for ldc2: |> dub test No source files found in configuration 'library'. Falling back to "dub -b unittest". Performing

Re: std.digest toHexString

2017-03-20 Thread Kagamin via Digitalmars-d-learn
On Monday, 20 March 2017 at 15:46:10 UTC, Adam D. Ruppe wrote: On Monday, 20 March 2017 at 15:38:26 UTC, Kagamin wrote: This explicit slice won't work, because a slice of a fixed size array results in a fixed size array. No, it doesn't. int[4] a; typeof(a[] == int[]) You can try yourself in

Re: Is it std.regex, or is it me.

2017-03-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, March 20, 2017 14:36:32 Russel Winder via Digitalmars-d-learn wrote: > Given the following, where X and Y mark the spot: > > X epochRegex = regex("([0-9])+:"); > Y aEpochCapture = matchFirst(aVersionString, epochRegex); > Y bEpochCapture = matchFirst(bVersionString, epochRegex);

Re: std.digest toHexString

2017-03-20 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 20 March 2017 at 16:04:10 UTC, Kagamin wrote: https://dpaste.dzfl.pl/eafa86c5426d Unbelievable, we're both right, sort of. So it is true that typeof(static[]) == dynamic. But the language also allows implicit conversion in the other direction WTF. If you put a variable in

Re: Is it std.regex, or is it me.

2017-03-20 Thread Kagamin via Digitalmars-d-learn
A file stream would be another example of a thing that can't be naturally const even if you opened it for reading.

Is it std.regex, or is it me.

2017-03-20 Thread Russel Winder via Digitalmars-d-learn
Given the following, where X and Y mark the spot: X epochRegex = regex("([0-9])+:"); Y aEpochCapture = matchFirst(aVersionString, epochRegex); Y bEpochCapture = matchFirst(bVersionString, epochRegex); If X or Y are const or immutable the code fails to compile. Only if

Re: std.digest toHexString

2017-03-20 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 20 March 2017 at 15:38:26 UTC, Kagamin wrote: This explicit slice won't work, because a slice of a fixed size array results in a fixed size array. No, it doesn't. int[4] a; typeof(a[] == int[]) You can try yourself in the compiler, it is easy to verify.

Re: std.digest toHexString

2017-03-20 Thread Kagamin via Digitalmars-d-learn
On Monday, 20 March 2017 at 04:03:20 UTC, Vladimir Panteleev wrote: https://issues.dlang.org/show_bug.cgi?id=9279 Has it not been fixed? That's specific to the return statement. Like you can assign an address of a local variable, but you can't return it.

Re: std.digest toHexString

2017-03-20 Thread Kagamin via Digitalmars-d-learn
On Thursday, 16 March 2017 at 17:50:45 UTC, Adam D. Ruppe wrote: string s = func()[]; // I'd allow it, at least the user wrote `[]` meaning they realized it was stack data and presumably knows what that means about the slice's lifetime This explicit slice won't work, because a slice of a

Re: GitHub detects .d source as Makefile?

2017-03-20 Thread XavierAP via Digitalmars-d-learn
On Sunday, 19 March 2017 at 21:53:17 UTC, Seb wrote: FWIW this has been fixed by Martin last summer, but the people at GitHub aren't very responsive. The PR is still pending :/ More info: https://trello.com/c/g9PB3ISG/233-improve-d-language-recognition-on-github

Issue with typeof

2017-03-20 Thread StarGrazer via Digitalmars-d-learn
typeof() fails unless method is static. Says & requires this. But for typeof, it shouldn't matter and should pass. So how to get a function pointer to a non static member function(of an interface)? I've tried creating the type like T t; typeof() fptr; but same issue. It may be because T

Re: Issue with typeof

2017-03-20 Thread Moritz Maxeiner via Digitalmars-d-learn
On Monday, 20 March 2017 at 17:58:32 UTC, Moritz Maxeiner wrote: 2) Create a template that can be used like this (you'll want to consult std.traits for this): void foo (delegateOf!(T.method) fptr) {} This may sound harder that it is, btw. A template that does exactly that is the following

Re: Issue with typeof

2017-03-20 Thread StarGrazer via Digitalmars-d-learn
On Monday, 20 March 2017 at 18:27:39 UTC, Moritz Maxeiner wrote: On Monday, 20 March 2017 at 17:58:32 UTC, Moritz Maxeiner wrote: [...] This may sound harder that it is, btw. A template that does exactly that is the following (template constraints that verify `method` to actually be a