Re: dirEntries within static foreach: memory.d(827): Error: fakePureErrno cannot be interpreted at compile time, because it has no available source code

2019-02-10 Thread Seb via Digitalmars-d-learn
On Monday, 11 February 2019 at 01:05:05 UTC, kdevel wrote: On Monday, 11 February 2019 at 00:54:27 UTC, Seb wrote: On Monday, 11 February 2019 at 00:19:02 UTC, kdevel wrote: [...] You can't read or list files at compile-time. dmd can read files at compile time using the import function

Re: dirEntries within static foreach: memory.d(827): Error: fakePureErrno cannot be interpreted at compile time, because it has no available source code

2019-02-10 Thread kdevel via Digitalmars-d-learn
On Monday, 11 February 2019 at 00:54:27 UTC, Seb wrote: On Monday, 11 February 2019 at 00:19:02 UTC, kdevel wrote: [...] You can't read or list files at compile-time. dmd can read files at compile time using the import function [1] What are you trying to do? Incorporate HTML template

Re: dirEntries within static foreach: memory.d(827): Error: fakePureErrno cannot be interpreted at compile time, because it has no available source code

2019-02-10 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, February 10, 2019 5:19:02 PM MST kdevel via Digitalmars-d-learn wrote: > I am trying to get this code compiled: > > ```TemplateStore.d > module TemplateStore; > import std.path; > import std.conv; > import std.file; > > immutable string[string] template_map; > > static this () > { >

Re: dirEntries within static foreach: memory.d(827): Error: fakePureErrno cannot be interpreted at compile time, because it has no available source code

2019-02-10 Thread Seb via Digitalmars-d-learn
On Monday, 11 February 2019 at 00:19:02 UTC, kdevel wrote: I am trying to get this code compiled: ```TemplateStore.d module TemplateStore; import std.path; import std.conv; import std.file; [...] You can't read or list files at compile-time. What are you trying to do?

dirEntries within static foreach: memory.d(827): Error: fakePureErrno cannot be interpreted at compile time, because it has no available source code

2019-02-10 Thread kdevel via Digitalmars-d-learn
I am trying to get this code compiled: ```TemplateStore.d module TemplateStore; import std.path; import std.conv; import std.file; immutable string[string] template_map; static this () { static foreach (f; dirEntries (``, `*.html`, SpanMode.shallow)) { pragma (msg, `reading template

Re: Handling big FP numbers

2019-02-10 Thread Murilo via Digitalmars-d-learn
On Sunday, 10 February 2019 at 21:27:43 UTC, Dennis wrote: On Sunday, 10 February 2019 at 20:25:02 UTC, Murilo wrote: It seems this is a feature of D I will have to get used to and accept the fact I can't always get the same number as in C What compilers and settings do you use? What you're

Re: Easiest way to display images

2019-02-10 Thread Murilo via Digitalmars-d-learn
On Sunday, 10 February 2019 at 21:26:56 UTC, Adam D. Ruppe wrote: On Sunday, 10 February 2019 at 18:42:59 UTC, Murilo wrote: Adam, is there a place where we can chat? I don't like chatting via this forum. I would like to talk to you about your modules and about the D lang. get on the

Re: Handling big FP numbers

2019-02-10 Thread Dennis via Digitalmars-d-learn
On Sunday, 10 February 2019 at 20:25:02 UTC, Murilo wrote: It seems this is a feature of D I will have to get used to and accept the fact I can't always get the same number as in C What compilers and settings do you use? What you're actually comparing here are different implementations of the

Re: Easiest way to display images

2019-02-10 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 10 February 2019 at 18:42:59 UTC, Murilo wrote: Adam, is there a place where we can chat? I don't like chatting via this forum. I would like to talk to you about your modules and about the D lang. get on the freenode irc, i am in #d like all the time (and will see messages when i

Re: Handling big FP numbers

2019-02-10 Thread Murilo via Digitalmars-d-learn
On Saturday, 9 February 2019 at 05:46:22 UTC, H. S. Teoh wrote: On Sat, Feb 09, 2019 at 03:52:38AM +, Murilo via Digitalmars-d-learn wrote: On Saturday, 9 February 2019 at 03:28:24 UTC, Adam D. Ruppe wrote: [...] > But you can change this with the format specifiers (use > `writefln`

Re: Query for -dip1000

2019-02-10 Thread Per Nordlöw via Digitalmars-d-learn
On Sunday, 10 February 2019 at 20:04:29 UTC, Per Nordlöw wrote: Or do I have to write a trait myself? Oops, I had already posted that and got an answer at https://forum.dlang.org/post/qglynupcootocnnnp...@forum.dlang.org

Query for -dip1000

2019-02-10 Thread Per Nordlöw via Digitalmars-d-learn
Is there a way to query if the -dip1000 flag has been passed to the compiler? I need it for enabling certain DIP-1000 escape analysis tests only when -dip1000 has been passed. For instance static assert(!__traits(compiles, { char[] f() {

Re: Easiest way to display images

2019-02-10 Thread Murilo via Digitalmars-d-learn
On Wednesday, 6 February 2019 at 03:35:03 UTC, Adam D. Ruppe wrote: On Wednesday, 6 February 2019 at 01:04:43 UTC, Murilo wrote: You should later joing the facebook group Programming in D. Eh, I don't really like facebook groups. With my libraries too, I don't really care if anyone uses

Re: Should D file end with newline?

2019-02-10 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, February 10, 2019 2:06:50 AM MST Cym13 via Digitalmars-d-learn wrote: > On Sunday, 10 February 2019 at 02:12:43 UTC, Jonathan M Davis > > wrote: > > On Saturday, February 9, 2019 2:19:27 PM MST Victor Porton via > > > > Digitalmars- d-learn wrote: > >> ISO C++ specifies that the C++

Re: A predicate with different argument types

2019-02-10 Thread psycha0s via Digitalmars-d-learn
auto sorted = object_.assumeSorted!((a, b) => a.name < b.name); Sorry for the copy-paste. It should be "attributes" in place of "object_" here, of course: auto sorted = attributes.assumeSorted!((a, b) => a.name < b.name);

A predicate with different argument types

2019-02-10 Thread psycha0s via Digitalmars-d-learn
Is it possible to make a comparison predicate with different argument types? For instance, suppose I have a struct like this: struct Attribute { string name; variant value; } Also, suppose I have a sorted vector of such values. So I can quickly find one by its name field and I have

Re: Trying to extract string from curl redirected URL

2019-02-10 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 10 February 2019 at 14:12:02 UTC, Josh wrote: Is there something I'm missing? It it possible to access the private handle? Is there a better way to do what I'm trying to achieve? Assuming I'm understanding your question (you want to get the path of a URL after redirects), if

Trying to extract string from curl redirected URL

2019-02-10 Thread Josh via Digitalmars-d-learn
I have a website (say https://website.com) that I need to log in to, it will do a few 302 redirects and then I will end up with a unique session ID in the URL (such as https://website.com/welcome.html?s=636853677441448706). Is there some way of extracting this ID (I'll need it later for other

Re: Should D file end with newline?

2019-02-10 Thread Benjamin Schaaf via Digitalmars-d-learn
On Sunday, 10 February 2019 at 02:12:43 UTC, Jonathan M Davis wrote: On Saturday, February 9, 2019 2:19:27 PM MST Victor Porton via Digitalmars- d-learn wrote: ISO C++ specifies that the C++ file must end with a newline. Should D file end with newline, too? No, there is no need to end D

Re: Should D file end with newline?

2019-02-10 Thread Cym13 via Digitalmars-d-learn
On Sunday, 10 February 2019 at 02:12:43 UTC, Jonathan M Davis wrote: On Saturday, February 9, 2019 2:19:27 PM MST Victor Porton via Digitalmars- d-learn wrote: ISO C++ specifies that the C++ file must end with a newline. Should D file end with newline, too? No, there is no need to end D