return scope ref outlives the scope of the argument

2019-06-25 Thread Eugene Wissner via Digitalmars-d-learn
struct Container { } static struct Inserter { private Container* container; private this(return scope ref Container container) @trusted { this.container = } } auto func()() { Container container; return Inserter(container); } void main() { static

How to prepare and generate a simple lightweight binary?

2019-06-25 Thread BoQsc via Digitalmars-d-learn
There are lots of talks on this forum about Statical linking, Dynamic linking. There are even shouts: "use the ldc compiler instead, it can do all that and even more than the default dmd compiler!!!" and bunch of compiler flags, no instructions on how to start or even steps on how to reproduce

Re: return scope ref outlives the scope of the argument

2019-06-25 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, June 25, 2019 1:32:58 AM MDT Eugene Wissner via Digitalmars-d- learn wrote: > struct Container > { > } > > static struct Inserter > { > private Container* container; > > private this(return scope ref Container container) @trusted > { > this.container = > }

Re: return scope ref outlives the scope of the argument

2019-06-25 Thread Eugene Wissner via Digitalmars-d-learn
On Tuesday, 25 June 2019 at 11:16:47 UTC, Jonathan M Davis wrote: On Tuesday, June 25, 2019 1:32:58 AM MDT Eugene Wissner via Digitalmars-d- learn wrote: struct Container { } static struct Inserter { private Container* container; private this(return scope ref Container container)

How to use template Object in interface?

2019-06-25 Thread zoujiaqing via Digitalmars-d-learn
hunt-cache current version use template implemention adapter changes. I want use Interface to define Adapter, this master code unable to comple. How to do it? D programming language design flaws? ```bash git clone https://github.com/huntlabs/hunt-cache cd hunt-cache/example dub run -v ...

Re: How to convert array of structs to JSON

2019-06-25 Thread zoujiaqing via Digitalmars-d-learn
On Tuesday, 25 June 2019 at 05:33:57 UTC, mark wrote: I have the following array of structs: struct Person { string name; int age; }; Person people[]; Person p; Person p1 = { "Bob", 12 }; Person p2 = { "Bob", 12 }; people ~= p1; people ~= p2; I've read through the

Conversion problem.

2019-06-25 Thread Den_d_y via Digitalmars-d-learn
Hello! Here I am again, with my problem ... In my program, I cannot manage to convert from "double" to "int". Here is the code: << ++ struct Animation - the structure that implements the animation + / struct Animation { private List! (Image) img; /// List of pictures in the animation private

Re: return scope ref outlives the scope of the argument

2019-06-25 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, June 25, 2019 1:32:58 AM MDT Eugene Wissner via Digitalmars-d- learn wrote: > struct Container > { > } > > static struct Inserter > { > private Container* container; > > private this(return scope ref Container container) @trusted > { > this.container = > }

Re: How to use template Object in interface?

2019-06-25 Thread zoujiaqing via Digitalmars-d-learn
On Tuesday, 25 June 2019 at 12:11:47 UTC, zoujiaqing wrote: hunt-cache current version use template implemention adapter changes. I want use Interface to define Adapter, this master code unable to comple. How to do it? D programming language design flaws? ```bash git clone

Re: return scope ref outlives the scope of the argument

2019-06-25 Thread Eugene Wissner via Digitalmars-d-learn
On Tuesday, 25 June 2019 at 12:04:27 UTC, Jonathan M Davis wrote: On Tuesday, June 25, 2019 1:32:58 AM MDT Eugene Wissner via Digitalmars-d- learn wrote: struct Container { } static struct Inserter { private Container* container; private this(return scope ref Container container)

Re: is there any micro-service library in D?

2019-06-25 Thread zoujiaqing via Digitalmars-d-learn
On Wednesday, 19 June 2019 at 08:29:15 UTC, dangbinghoo wrote: hi there, Does anyone know the micro-service oriented design library or framework in D? thanks! binghoo dang You can try hunt-service: hunt-service is distributed RPC framework for DLang based on gRPC and neton.

Blog Post #0047: ScaleButton and VolumeButton

2019-06-25 Thread Ron Tarrant via Digitalmars-d-learn
There are a couple of things to watch out for with the ScaleButton and its offspring, the VolumeButton. Read all about it here: https://gtkdcoding.com/2019/06/25/0047-scalebutton-and-volumebutton.html

Re: How to prepare and generate a simple lightweight binary?

2019-06-25 Thread kinke via Digitalmars-d-learn
On Tuesday, 25 June 2019 at 13:13:34 UTC, BoQsc wrote: What I would expect: A simple executable program that does a writeln and do not weight tons of megabytes. Thanks. void main() { import std.stdio; writeln("Hello world!"); } Ubuntu 18.04, LDC v1.16: ldc2 hello.d => ~1.7 MB

Re: Casting to interface not allowed in @safe code?

2019-06-25 Thread Eugene Wissner via Digitalmars-d-learn
On Tuesday, 25 June 2019 at 16:51:46 UTC, Nathan S. wrote: On Sunday, 23 June 2019 at 21:24:14 UTC, Nathan S. wrote: https://issues.dlang.org/show_bug.cgi?id=2. The fix for this has been accepted and is set for inclusion in DMD 2.080. 088 :)

Re: Conversion problem.

2019-06-25 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Jun 25, 2019 at 12:08:07PM +, Den_d_y via Digitalmars-d-learn wrote: > Hello! Here I am again, with my problem ... In my program, I cannot manage > to convert from "double" to "int". Here is the code: [...] Did you try this? import std.conv : to; double d = ...;

Re: Casting to interface not allowed in @safe code?

2019-06-25 Thread Nathan S. via Digitalmars-d-learn
On Sunday, 23 June 2019 at 21:24:14 UTC, Nathan S. wrote: https://issues.dlang.org/show_bug.cgi?id=2. The fix for this has been accepted and is set for inclusion in DMD 2.080.

Re: return scope ref outlives the scope of the argument

2019-06-25 Thread Eugene Wissner via Digitalmars-d-learn
On Tuesday, 25 June 2019 at 07:32:58 UTC, Eugene Wissner wrote: struct Container { } static struct Inserter { private Container* container; private this(return scope ref Container container) @trusted { this.container = } } auto func()() { Container container;

Re: return scope ref outlives the scope of the argument

2019-06-25 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, June 25, 2019 6:32:35 AM MDT Eugene Wissner via Digitalmars-d- learn wrote: > On Tuesday, 25 June 2019 at 12:04:27 UTC, Jonathan M Davis wrote: > > On Tuesday, June 25, 2019 1:32:58 AM MDT Eugene Wissner via > > > > Digitalmars-d- learn wrote: > >> struct Container > >> { > >> } > >> >

Re: Conversion problem.

2019-06-25 Thread Den_d_y via Digitalmars-d-learn
On Tuesday, 25 June 2019 at 16:44:28 UTC, H. S. Teoh wrote: On Tue, Jun 25, 2019 at 12:08:07PM +, Den_d_y via Digitalmars-d-learn wrote: Hello! Here I am again, with my problem ... In my program, I cannot manage to convert from "double" to "int". Here is the code: [...] Did you try this?