Re: What does std.traits.hasAliasing do

2018-07-28 Thread Venkat via Digitalmars-d-learn
On Sunday, 29 July 2018 at 01:05:19 UTC, Venkat wrote: struct SomeStruct { string p; string q; string[] pq; } Session session = req.session; session.get!SomeStruct("registerBody"); /home/venkat/.dub/packages/vibe-d-0.8.4/vibe-d/http/vibe/http/session.d(83,3): Error: s

What does std.traits.hasAliasing do

2018-07-28 Thread Venkat via Digitalmars-d-learn
struct SomeStruct { string p; string q; string[] pq; } ErrorMessage[] pq; session.set("registerBody", pq); /home/venkat/.dub/packages/vibe-d-0.8.4/vibe-d/http/vibe/http/session.d(83,3): Error: static assert: "Type SomeStruct contains references, which is not supported f

Re: dynamically loading a dynamic library from the program

2018-07-28 Thread Michal Kozakiewicz via Digitalmars-d-learn
On Saturday, 28 July 2018 at 22:47:33 UTC, Adam D. Ruppe wrote: On Saturday, 28 July 2018 at 22:30:38 UTC, Michal Kozakiewicz wrote: 1. In this case, can I use this library in the D language program? 2. How to create initialization? You can load it exactly the same way you would from C. The

Re: dynamically loading a dynamic library from the program

2018-07-28 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 28 July 2018 at 22:30:38 UTC, Michal Kozakiewicz wrote: 1. In this case, can I use this library in the D language program? 2. How to create initialization? You can load it exactly the same way you would from C. The article you linked is about writing a DLL in D itself, but using

dynamically loading a dynamic library from the program

2018-07-28 Thread Michal Kozakiewicz via Digitalmars-d-learn
I read this article: https://dlang.org/articles/dll-linux.html However, I did not find the answer to my questions. = = = = Facts: a. I have closed-source dynamic library (DLL) on Windows (e.g.: AutoItScript). b. I do not know the language and compiler in which it was created. c

Re: How to get an inout constructor working with a template wrapper

2018-07-28 Thread aliak via Digitalmars-d-learn
On Friday, 27 July 2018 at 14:34:54 UTC, Steven Schveighoffer wrote: The problem here is that inout(immutable(int)) is equivalent to immutable(int). That is, all flavors of mutability are equivalent to immutable(int): /*mutable*/(immutable(int)) => immutable(int) const(immutable(int))

Re: How to avoid inout type constructor with Optional type wrapper undoing string type

2018-07-28 Thread aliak via Digitalmars-d-learn
On Friday, 27 July 2018 at 14:52:20 UTC, Steven Schveighoffer wrote: On 7/23/18 2:39 PM, aliak wrote: Hi, I'm playing around with an Optional wrapper type. It stores a type T and a bool that defines whether a value is defined or not: struct Optional(T) {   T value;   bool defined = false;

Re: How to get an inout constructor working with a template wrapper

2018-07-28 Thread aliak via Digitalmars-d-learn
On Friday, 27 July 2018 at 14:38:27 UTC, Steven Schveighoffer wrote: On 7/27/18 9:29 AM, aliak wrote: Ok, thanks to Simen from another post [0], I just figured out what the correct constructor and factory method for a template wrapper should be: https://run.dlang.io/is/S4vHzL struct W(T) {

Re: How to best implement a DSL?

2018-07-28 Thread rikki cattermole via Digitalmars-d-learn
On 29/07/2018 4:53 AM, Robert M. Münch wrote: On 2018-07-28 15:43:12 +, rikki cattermole said: * Could I somehow call an external program during compilation which gets the DSL block as input and returns D code? No. But you can pre-process. Yes, sure, but this complicates the buil

Re: A vibe.d thing

2018-07-28 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2018-07-27 at 15:58 -0400, Steven Schveighoffer via Digitalmars-d-learn wrote: > […] > Haha, I don't blame you. The docs should say in bold letters (NOT > IMPLEMENTED). In the end I used the deprecated leastSize property to create a right size buffer so the read function never tries to r

Re: How to best implement a DSL?

2018-07-28 Thread Robert M. Münch via Digitalmars-d-learn
On 2018-07-28 15:43:12 +, rikki cattermole said: * Could I somehow call an external program during compilation which gets the DSL block as input and returns D code? No. But you can pre-process. Yes, sure, but this complicates the build-system. I preferr to use as few parts as possib

Re: How to best implement a DSL?

2018-07-28 Thread rikki cattermole via Digitalmars-d-learn
On 29/07/2018 2:59 AM, Robert M. Münch wrote: Hi, I'm seeking for ideas/comments/experiences how to best implement a DSL in D. What I would like to do is something like this: ... my D code ... my-dsl {     ... my multi-line DSL code ...     trade 100 shares(x) when (time <

How to best implement a DSL?

2018-07-28 Thread Robert M. Münch via Digitalmars-d-learn
Hi, I'm seeking for ideas/comments/experiences how to best implement a DSL in D. What I would like to do is something like this: ... my D code ... my-dsl { ... my multi-line DSL code ... trade 100 shares(x) when (time < 20:00) and timingisright()

Re: A vibe.d thing

2018-07-28 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2018-07-27 at 15:58 -0400, Steven Schveighoffer via Digitalmars-d-learn wrote: > […] > > I'm guessing they don't use it, but use peek instead (or maybe peek > to > get the size, and then read to get the data). I tried using req.bodyReader.peek, but that only works for situations where th