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

2018-07-18 Thread Simen Kjærås via Digitalmars-d-learn
On Wednesday, 18 July 2018 at 11:28:54 UTC, Timoses wrote: But why is a context pointer a problem? Is it problematic because the context pointer to the main scope can not guarantee `immutable`? E.g. if I happened to use data from main in a function of the immutable struct then... well then what

Re: New to GDC on ARM 32-bit Ubuntu

2018-07-18 Thread Johannes Pfau via Digitalmars-d-learn
Am Tue, 17 Jul 2018 04:51:04 + schrieb Cecil Ward: > 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 do

Re: Configuring DerelictGL3

2018-07-18 Thread Entity325 via Digitalmars-d-learn
Thanks for the help (and sorry for the slow reply, it took longer to get everything tested and configured than I would have liked... sorry if this is frowned upon on this forum...) I do have an odd bug, however, and I'm not sure how to go any further with it. So I'm using the standard proces

Re: crash when using &this in struct constructor

2018-07-18 Thread Eric via Digitalmars-d-learn
On Wednesday, 18 July 2018 at 12:10:18 UTC, baz wrote: Specs are clear : it's a global so it's evaluated at compile time (https://dlang.org/spec/declaration.html#global_static_init) Example code should not compile. Indeed. Inside a function it does actually work. And ofcourse for class Tes

Re: HMAC and toHexString

2018-07-18 Thread Nicholas Wilson via Digitalmars-d-learn
On Wednesday, 18 July 2018 at 11:29:42 UTC, baz@dlang-community wrote: On Wednesday, 18 July 2018 at 11:22:36 UTC, Nicholas Wilson wrote: On Wednesday, 18 July 2018 at 05:54:48 UTC, Nicholas Wilson wrote: [...] Ahh, the joys of memory corruption. You've reached https://issues.dlang.org/show

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

2018-07-18 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 17 July 2018 at 22:10:52 UTC, jmh530 wrote: On Tuesday, 17 July 2018 at 16:39:48 UTC, bachmeier wrote: On Tuesday, 17 July 2018 at 15:55:03 UTC, bachmeier wrote: On Tuesday, 17 July 2018 at 06:57:37 UTC, drug wrote: [...] I'm going to create an issue on Github. This is the output

Re: crash when using &this in struct constructor

2018-07-18 Thread baz via Digitalmars-d-learn
On Wednesday, 18 July 2018 at 11:35:40 UTC, baz wrote: On Wednesday, 18 July 2018 at 11:27:33 UTC, baz@dlang-community wrote: On Monday, 16 July 2018 at 22:21:12 UTC, H. S. Teoh wrote: On Mon, Jul 16, 2018 at 10:08:34PM +, Eric via Digitalmars-d-learn wrote: [...] It's not illegal per se

Re: crash when using &this in struct constructor

2018-07-18 Thread baz via Digitalmars-d-learn
On Wednesday, 18 July 2018 at 11:27:33 UTC, baz@dlang-community wrote: On Monday, 16 July 2018 at 22:21:12 UTC, H. S. Teoh wrote: On Mon, Jul 16, 2018 at 10:08:34PM +, Eric via Digitalmars-d-learn wrote: [...] It's not illegal per se, but a very, very bad idea in general, because in D, s

Re: HMAC and toHexString

2018-07-18 Thread Seb via Digitalmars-d-learn
On Wednesday, 18 July 2018 at 11:22:36 UTC, Nicholas Wilson wrote: On Wednesday, 18 July 2018 at 05:54:48 UTC, Nicholas Wilson wrote: [...] Ahh, the joys of memory corruption. Yep, actually this one is a very common one. However, -dip1000 would warn you here ...

Re: Why does templated interface function return something different than final function?

2018-07-18 Thread Timoses via Digitalmars-d-learn
On Wednesday, 18 July 2018 at 11:09:12 UTC, Timoses wrote: Why is the interface templated function not also returning the class C toString return value "in C"?? interface iface { void toString(scope void delegate(const(char)[]) sink) const; final

Re: crash when using &this in struct constructor

2018-07-18 Thread baz@dlang-community via Digitalmars-d-learn
On Monday, 16 July 2018 at 22:21:12 UTC, H. S. Teoh wrote: On Mon, Jul 16, 2018 at 10:08:34PM +, Eric via Digitalmars-d-learn wrote: [...] It's not illegal per se, but a very, very bad idea in general, because in D, structs are expected to be int-like POD values that can be freely copied

Re: HMAC and toHexString

2018-07-18 Thread baz@dlang-community via Digitalmars-d-learn
On Wednesday, 18 July 2018 at 11:22:36 UTC, Nicholas Wilson wrote: On Wednesday, 18 July 2018 at 05:54:48 UTC, Nicholas Wilson wrote: [...] Ahh, the joys of memory corruption. You've reached https://issues.dlang.org/show_bug.cgi?id=16519 maybe ?

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

2018-07-18 Thread Timoses via Digitalmars-d-learn
On Tuesday, 17 July 2018 at 06:24:12 UTC, Simen Kjærås wrote: That makes sense. The problem is F has a context pointer to the main() block, since it's a non-static struct with methods inside a block. It doesn't actually use the context pointer for anything, so it possibly shouldn't have one,

Re: HMAC and toHexString

2018-07-18 Thread Nicholas Wilson via Digitalmars-d-learn
On Wednesday, 18 July 2018 at 05:54:48 UTC, Nicholas Wilson wrote: ... string key = "blahblahblah"; auto mac = hmac!SHA256(key.representation); string s = ...,t=...u=...,v=...; foreach(w;AliasSeq!(s,t,u,v)) mac.put(w.representation); ubyte[32] s = mac.finish; string sig = toHexString!

Why does templated interface function return something different than final function?

2018-07-18 Thread Timoses via Digitalmars-d-learn
Why is the interface templated function not also returning the class C toString return value "in C"?? interface iface { void toString(scope void delegate(const(char)[]) sink) const; final string convert() inout {

Re: HMAC and toHexString

2018-07-18 Thread Alex via Digitalmars-d-learn
On Wednesday, 18 July 2018 at 05:54:48 UTC, Nicholas Wilson wrote: ... string key = "blahblahblah"; auto mac = hmac!SHA256(key.representation); string s = ...,t=...u=...,v=...; foreach(w;AliasSeq!(s,t,u,v)) mac.put(w.representation); ubyte[32] s = mac.finish; string sig = toHexString!