Re: Explicit casting of enum -- intentional restriction?

2016-10-01 Thread Namespace via Digitalmars-d-learn
The Code below still works, so I guess it's some problem with the constraint of "exists". import std.stdio; enum Foo { A = "B" } void test(string a) { } void main() { test(Foo.A); Foo.A.test(); }

Explicit casting of enum -- intentional restriction?

2016-10-01 Thread rcorre via Digitalmars-d-learn
I just tried to compile an old project and the following failed: --- enum Paths : string { bitmapDir = "content/image", fontDir = "content/font", soundDir = "content/sound", ... if (Paths.preferences.exists) ... --- It turns out members of Paths are no longer implicitly

Re: How to make rsplit (like in Python) in D

2016-10-01 Thread pineapple via Digitalmars-d-learn
On Saturday, 1 October 2016 at 17:55:08 UTC, Uranuz wrote: On Saturday, 1 October 2016 at 17:32:59 UTC, Uranuz wrote: On Saturday, 1 October 2016 at 17:23:16 UTC, Uranuz wrote: [...] But these example fails. Oops. Looks like a bug( import std.stdio; import std.algorithm; import std.range; im

Re: How can I use heapify in @safe code?

2016-10-01 Thread Burt via Digitalmars-d-learn
On Saturday, 1 October 2016 at 18:36:54 UTC, klmp wrote: On Saturday, 1 October 2016 at 16:59:18 UTC, Burt wrote: [...] It tries too but "heapify" uses the struct "BinaryHeap" that is not safe at all. (either not annotated or @safe not applicable because of what it uses in intern: @system st

Re: How can I use heapify in @safe code?

2016-10-01 Thread klmp via Digitalmars-d-learn
On Saturday, 1 October 2016 at 16:59:18 UTC, Burt wrote: Hi, I'd like to use a binary heap from @safe code. I thought @safe is transitive It tries too but "heapify" uses the struct "BinaryHeap" that is not safe at all. (either not annotated or @safe not applicable because of what it uses in

Re: How to make rsplit (like in Python) in D

2016-10-01 Thread TheFlyingFiddle via Digitalmars-d-learn
On Saturday, 1 October 2016 at 16:45:11 UTC, Uranuz wrote: How to make rsplit (like in Python) in D without need for extra allocation using standard library? And why there is no algorithms (or parameter in existing algorithms) to process range from the back. Is `back` and `popBack` somehow wors

Re: How to make rsplit (like in Python) in D

2016-10-01 Thread cym13 via Digitalmars-d-learn
On Saturday, 1 October 2016 at 17:23:16 UTC, Uranuz wrote: On Saturday, 1 October 2016 at 16:45:11 UTC, Uranuz wrote: How to make rsplit (like in Python) in D without need for extra allocation using standard library? And why there is no algorithms (or parameter in existing algorithms) to proces

Re: How to make rsplit (like in Python) in D

2016-10-01 Thread Uranuz via Digitalmars-d-learn
On Saturday, 1 October 2016 at 17:32:59 UTC, Uranuz wrote: On Saturday, 1 October 2016 at 17:23:16 UTC, Uranuz wrote: [...] But these example fails. Oops. Looks like a bug( import std.stdio; import std.algorithm; import std.range; import std.string; [...] I created bug report on this: http

Re: How to make rsplit (like in Python) in D

2016-10-01 Thread Uranuz via Digitalmars-d-learn
On Saturday, 1 October 2016 at 17:23:16 UTC, Uranuz wrote: On Saturday, 1 October 2016 at 16:45:11 UTC, Uranuz wrote: How to make rsplit (like in Python) in D without need for extra allocation using standard library? And why there is no algorithms (or parameter in existing algorithms) to proces

Re: How to make rsplit (like in Python) in D

2016-10-01 Thread Uranuz via Digitalmars-d-learn
On Saturday, 1 October 2016 at 16:45:11 UTC, Uranuz wrote: How to make rsplit (like in Python) in D without need for extra allocation using standard library? And why there is no algorithms (or parameter in existing algorithms) to process range from the back. Is `back` and `popBack` somehow wors

How can I use heapify in @safe code?

2016-10-01 Thread Burt via Digitalmars-d-learn
Hi, I'd like to use a binary heap from @safe code. I thought @safe is transitive but the following example does not compile: import std.container.binaryheap; @safe // This makes things fail. unittest { // Test range interface. import std.algorithm.comparison : equal; int

How to make rsplit (like in Python) in D

2016-10-01 Thread Uranuz via Digitalmars-d-learn
How to make rsplit (like in Python) in D without need for extra allocation using standard library? And why there is no algorithms (or parameter in existing algorithms) to process range from the back. Is `back` and `popBack` somehow worse than `front` and `popFront`. I've tried to write someth

Re: Get date at compile time

2016-10-01 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 1 October 2016 at 15:00:29 UTC, pineapple wrote: Has there been consideration for adding separate integral tokens for day, month, year, etc? Not that I'm aware of. The purpose of this is more for things like version and help strings (e.g. "MyApp built 1 Oct 2016") than for seriou

Re: Get date at compile time

2016-10-01 Thread pineapple via Digitalmars-d-learn
On Saturday, 1 October 2016 at 14:43:31 UTC, Adam D. Ruppe wrote: On Saturday, 1 October 2016 at 14:41:22 UTC, Andrew wrote: Is there any way to get the system date at compile time. Not exactly, but the special symbol __TIMESTAMP__ gets a string out of the compiler at build time. http://dla

Re: Get date at compile time

2016-10-01 Thread Andrew via Digitalmars-d-learn
On Saturday, 1 October 2016 at 14:43:31 UTC, Adam D. Ruppe wrote: On Saturday, 1 October 2016 at 14:41:22 UTC, Andrew wrote: Is there any way to get the system date at compile time. Not exactly, but the special symbol __TIMESTAMP__ gets a string out of the compiler at build time. http://dla

Re: Get date at compile time

2016-10-01 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 1 October 2016 at 14:41:22 UTC, Andrew wrote: Is there any way to get the system date at compile time. Not exactly, but the special symbol __TIMESTAMP__ gets a string out of the compiler at build time. http://dlang.org/spec/lex.html#specialtokens

Re: Get date at compile time

2016-10-01 Thread rikki cattermole via Digitalmars-d-learn
On 02/10/2016 3:41 AM, Andrew wrote: Hi, Is there any way to get the system date at compile time. I want something like: static string compileDate = Clock.currTime.toString; but that fails. Thanks very much Andrew https://dlang.org/spec/lex.html#specialtokens

Get date at compile time

2016-10-01 Thread Andrew via Digitalmars-d-learn
Hi, Is there any way to get the system date at compile time. I want something like: static string compileDate = Clock.currTime.toString; but that fails. Thanks very much Andrew

Re: Reinstalled Mac

2016-10-01 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-09-30 16:17, Guillaume Piolat wrote: Confusing. For me it's much more common to want a current DMD compiler and a current LDC compiler. My idea was that this would allow to compile using LDC for a build script that was only designed with DMD in mind. Of course the "ldc2" and "ldmd2"

Re: Your connection is not private

2016-10-01 Thread Seb via Digitalmars-d-learn
On Saturday, 1 October 2016 at 11:12:16 UTC, wobbles wrote: On Saturday, 1 October 2016 at 03:21:05 UTC, rikki cattermole wrote: On 01/10/2016 11:51 AM, Joel wrote: I get this when I click Learn at the top of the screen in dlang. This is on Chrome Mac (Sierra 10.12). Yup, you need to be on h

Re: Your connection is not private

2016-10-01 Thread wobbles via Digitalmars-d-learn
On Saturday, 1 October 2016 at 03:21:05 UTC, rikki cattermole wrote: On 01/10/2016 11:51 AM, Joel wrote: I get this when I click Learn at the top of the screen in dlang. This is on Chrome Mac (Sierra 10.12). Yup, you need to be on https. Chrome just started warning when using http in the las