Re: Implicit conversion of struct with methods to immutable in pure function fails

2018-07-16 Thread Simen Kjærås via Digitalmars-d-learn
On Monday, 16 July 2018 at 13:13:53 UTC, Timoses wrote: On Monday, 16 July 2018 at 12:00:57 UTC, Simen Kjærås wrote: On Monday, 16 July 2018 at 11:43:03 UTC, Timoses wrote: Why does this fail? It doesn't. Not using DMD 2.081.1 under Windows, at least. I tried adding a bitfield since you ment

New to GDC on ARM 32-bit Ubuntu

2018-07-16 Thread Cecil Ward via Digitalmars-d-learn
I am getting an error when I try and compile anything with the GDC compiler which is coming up associated with source code within a D include file which is not one of mine I am using a Raspberry Pi with Ubuntu 16.04 and have just done an "apt-get install gdc". Using ldc works fine. The error

Re: Is there any tool that will auto publish my changes.

2018-07-16 Thread Venkat via Digitalmars-d-learn
Thankyou Ali. Timoses. I did try DiamondMVC for a bit, but I found that there is more help out there for Vibe.d. So I reverted back to using that. And the Dependency Injection in Diamond MVC brings all the obscurity that spring has which makes debugging more of a guessing game than a logical

Re: crash when using &this in struct constructor

2018-07-16 Thread Ali Çehreli via Digitalmars-d-learn
On 07/16/2018 03:08 PM, Eric wrote: This makes the compiler crash. Always a compiler bug: https://issues.dlang.org/show_bug.cgi?id=19089 Ali

Re: crash when using &this in struct constructor

2018-07-16 Thread Eric via Digitalmars-d-learn
On Monday, 16 July 2018 at 22:16:10 UTC, Adam D. Ruppe wrote: On Monday, 16 July 2018 at 22:08:34 UTC, Eric wrote: This makes the compiler crash. Is it illegal code? Yes, a struct can be moved at any time by the compiler which means pointers to it can be invalidated at random. Unless you al

Re: crash when using &this in struct constructor

2018-07-16 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Jul 16, 2018 at 10:08:34PM +, Eric via Digitalmars-d-learn wrote: > This makes the compiler crash. Is it illegal code? > > struct List { > private List* head; > private List* tail; > > this(int x) { > head = null; > tail = &this; // <-- crasher > } > } > > List2 ls =

Re: crash when using &this in struct constructor

2018-07-16 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 16 July 2018 at 22:08:34 UTC, Eric wrote: This makes the compiler crash. Is it illegal code? Yes, a struct can be moved at any time by the compiler which means pointers to it can be invalidated at random. Unless you always allocate it externally yourself...

Re: crash when using &this in struct constructor

2018-07-16 Thread Eric via Digitalmars-d-learn
Pasted slightly wrong code, last line should be: List ls = 2; Question still stands.

crash when using &this in struct constructor

2018-07-16 Thread Eric via Digitalmars-d-learn
This makes the compiler crash. Is it illegal code? struct List { private List* head; private List* tail; this(int x) { head = null; tail = &this; // <-- crasher } } List2 ls = 2;

Re: CJK problem when using console outputs

2018-07-16 Thread ag0aep6g via Digitalmars-d-learn
On 07/16/2018 11:30 AM, zhani wrote: i got some problem about using CJK in windows10 console. here my code(a code file encoded the utf-8): -- import std.stdio; /* static this(){ core.stdc.wchar_.fwide(core.stdc.stdio.stdout, 1); setlocale

Re: @safe - why does this compile?

2018-07-16 Thread ketmar via Digitalmars-d-learn
Johan Engelen wrote: On Friday, 13 July 2018 at 14:51:17 UTC, ketmar wrote: yeah. in simple words: safe code is *predictable*, but not "segfault-less". segfaults (null dereferences) in safe code are allowed, 'cause they have completely predictable behavior (instant program termination). @

Re: @safe - why does this compile?

2018-07-16 Thread ketmar via Digitalmars-d-learn
Johan Engelen wrote: On Friday, 13 July 2018 at 14:51:17 UTC, ketmar wrote: yeah. in simple words: safe code is *predictable*, but not "segfault-less". segfaults (null dereferences) in safe code are allowed, 'cause they have completely predictable behavior (instant program termination). @

Re: @safe - why does this compile?

2018-07-16 Thread Johan Engelen via Digitalmars-d-learn
On Friday, 13 July 2018 at 14:51:17 UTC, ketmar wrote: yeah. in simple words: safe code is *predictable*, but not "segfault-less". segfaults (null dereferences) in safe code are allowed, 'cause they have completely predictable behavior (instant program termination). @safe doesn't free you f

Re: Is it feasible to slowly rewrite a C++ codebase in D?

2018-07-16 Thread bachmeier via Digitalmars-d-learn
On Friday, 13 July 2018 at 19:53:45 UTC, Laeeth Isharc wrote: On Wednesday, 20 June 2018 at 18:47:10 UTC, Jordi Gutiérrez Hermoso wrote: What are your ideas? If you would like to expose C function and type declarations to D, you could take a look at DPP, which allows you to just #include a

Re: Implicit conversion of struct with methods to immutable in pure function fails

2018-07-16 Thread Seb via Digitalmars-d-learn
On Monday, 16 July 2018 at 13:13:53 UTC, Timoses wrote: On Monday, 16 July 2018 at 12:00:57 UTC, Simen Kjærås wrote: On Monday, 16 July 2018 at 11:43:03 UTC, Timoses wrote: Why does this fail? It doesn't. Not using DMD 2.081.1 under Windows, at least. I tried adding a bitfield since you ment

Re: Is it feasible to slowly rewrite a C++ codebase in D?

2018-07-16 Thread Seb via Digitalmars-d-learn
On Monday, 16 July 2018 at 13:15:56 UTC, Timoses wrote: On Monday, 16 July 2018 at 11:31:32 UTC, Seb wrote: On Monday, 16 July 2018 at 11:12:20 UTC, Dukc wrote: On Saturday, 14 July 2018 at 03:08:50 UTC, Vladimir Panteleev wrote: I'll follow up with Alawain. Regardless, dscripten-tools borrows

Re: Is it feasible to slowly rewrite a C++ codebase in D?

2018-07-16 Thread Timoses via Digitalmars-d-learn
On Monday, 16 July 2018 at 11:31:32 UTC, Seb wrote: On Monday, 16 July 2018 at 11:12:20 UTC, Dukc wrote: On Saturday, 14 July 2018 at 03:08:50 UTC, Vladimir Panteleev wrote: I'll follow up with Alawain. Regardless, dscripten-tools borrows very little from the redistributable parts of dscripten

Re: Implicit conversion of struct with methods to immutable in pure function fails

2018-07-16 Thread Timoses via Digitalmars-d-learn
On Monday, 16 July 2018 at 12:00:57 UTC, Simen Kjærås wrote: On Monday, 16 July 2018 at 11:43:03 UTC, Timoses wrote: Why does this fail? It doesn't. Not using DMD 2.081.1 under Windows, at least. I tried adding a bitfield since you mentioned it, but it compiles nicely for me. Which version o

Re: Implicit conversion of struct with methods to immutable in pure function fails

2018-07-16 Thread Simen Kjærås via Digitalmars-d-learn
On Monday, 16 July 2018 at 11:43:03 UTC, Timoses wrote: Why does this fail? It doesn't. Not using DMD 2.081.1 under Windows, at least. I tried adding a bitfield since you mentioned it, but it compiles nicely for me. Which version of DMD are you using, and are you having the issues with the e

Implicit conversion of struct with methods to immutable in pure function fails

2018-07-16 Thread Timoses via Digitalmars-d-learn
Why does this fail? struct F { int i; ushort _x; void x(ushort v) pure {_x = v;} ushort x() const { return _x; } } immutable F f1 = () pure { F lf = F(); return lf; }(); // Error: cannot implicitly convert expression del

Re: Is it feasible to slowly rewrite a C++ codebase in D?

2018-07-16 Thread Seb via Digitalmars-d-learn
On Monday, 16 July 2018 at 11:12:20 UTC, Dukc wrote: On Saturday, 14 July 2018 at 03:08:50 UTC, Vladimir Panteleev wrote: I'll follow up with Alawain. Regardless, dscripten-tools borrows very little from the redistributable parts of dscripten - mostly the "minimalistic runtime", which I think

Re: Is it feasible to slowly rewrite a C++ codebase in D?

2018-07-16 Thread Dukc via Digitalmars-d-learn
On Saturday, 14 July 2018 at 03:08:50 UTC, Vladimir Panteleev wrote: I'll follow up with Alawain. Regardless, dscripten-tools borrows very little from the redistributable parts of dscripten - mostly the "minimalistic runtime", which I think was itself borrowed from somewhere else. Indeed, it

Re: CJK problem when using console outputs

2018-07-16 Thread zhani via Digitalmars-d-learn
On Monday, 16 July 2018 at 09:30:22 UTC, zhani wrote: howdy :-) i got some problem about using CJK in windows10 console. [...] oh, sorry for my mistake. here: -- writeln("你好"); // C writeln("こんにちは"); // J writeln("안

Re: Is there any tool that will auto publish my changes.

2018-07-16 Thread aliak00 via Digitalmars-d-learn
On Monday, 16 July 2018 at 08:28:06 UTC, Timoses wrote: On Sunday, 15 July 2018 at 00:25:22 UTC, Venkat wrote: [...] I don't believe there currently exists a tool to rebuild the Diet templates on the fly. The Diet templates require a step during compilation (I think), so that the entire appl

CJK problem when using console outputs

2018-07-16 Thread zhani via Digitalmars-d-learn
howdy :-) i got some problem about using CJK in windows10 console. here my code(a code file encoded the utf-8): -- import std.stdio; /* static this(){ core.stdc.wchar_.fwide(core.stdc.stdio.stdout, 1); setlocale(0, cast(char*)"korea

Re: UFCS confusion

2018-07-16 Thread vit via Digitalmars-d-learn
On Friday, 13 July 2018 at 11:37:09 UTC, Michael wrote: On Friday, 13 July 2018 at 11:17:32 UTC, Radu wrote: On Friday, 13 July 2018 at 11:12:47 UTC, Michael wrote: On Friday, 13 July 2018 at 10:52:54 UTC, Radu wrote: On Friday, 13 July 2018 at 10:21:54 UTC, Michael wrote: [...] Do you try

Re: Is there any tool that will auto publish my changes.

2018-07-16 Thread Timoses via Digitalmars-d-learn
On Sunday, 15 July 2018 at 00:25:22 UTC, Venkat wrote: I am writing a simple vibe.d app. The following is what I do right now. - I make changes. - build - Restart the server. Is there any tool that will auto publish my changes as I save them ? I am using Visual Studio Code. Thanks Venkat