Re: Failure due to memcpy being called at compile time

2022-06-20 Thread JG via Digitalmars-d-learn
On Tuesday, 21 June 2022 at 01:39:43 UTC, Paul Backus wrote: On Tuesday, 14 June 2022 at 05:35:46 UTC, JG wrote: On Monday, 13 June 2022 at 21:45:39 UTC, Paul Backus wrote: The call to `move` is coming from `SumType.opAssign`: https://github.com/dlang/phobos/blob/v2.100.0/std/sumtype.d#L681

Re: Failure due to memcpy being called at compile time

2022-06-20 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 14 June 2022 at 05:35:46 UTC, JG wrote: On Monday, 13 June 2022 at 21:45:39 UTC, Paul Backus wrote: The call to `move` is coming from `SumType.opAssign`: https://github.com/dlang/phobos/blob/v2.100.0/std/sumtype.d#L681 I've filed a bugzilla issue for this here:

Re: Enforce not null at compile time?

2022-06-20 Thread Antonio via Digitalmars-d-learn
On Monday, 20 June 2022 at 19:08:32 UTC, max haughton wrote: On Monday, 20 June 2022 at 17:48:48 UTC, Antonio wrote: Is there any way to specify that a variable, member or parameter can't be null? You can use an invariant if it's a member of an aggregate but be warned that these are only

Re: Enforce not null at compile time?

2022-06-20 Thread max haughton via Digitalmars-d-learn
On Monday, 20 June 2022 at 17:48:48 UTC, Antonio wrote: Is there any way to specify that a variable, member or parameter can't be null? You can use an invariant if it's a member of an aggregate but be warned that these are only checked at the boundaries of public member functions.

Re: Enforce not null at compile time?

2022-06-20 Thread Dennis via Digitalmars-d-learn
On Monday, 20 June 2022 at 17:48:48 UTC, Antonio wrote: Is there any way to specify that a variable, member or parameter can't be null? Depends on the type. Basic types can't be null. Pointers and classes can always be `null`, though you could wrap them in a custom library type that doesn't

Enforce not null at compile time?

2022-06-20 Thread Antonio via Digitalmars-d-learn
Is there any way to specify that a variable, member or parameter can't be null?

Re: Calling readln() after readf

2022-06-20 Thread Ali Çehreli via Digitalmars-d-learn
On 6/20/22 07:00, Gary Chike wrote: > Would it be appropriate to forego `readf` > and read input as a string using `readln` ,benefiting from the `strip` > function, then convert to their appropriate datatype Makes sense. The following are related as well:

Re: Calling readln() after readf

2022-06-20 Thread Gary Chike via Digitalmars-d-learn
I should have qualified the above with: _ and I will be performing operations on the numeric datatype, since just outputting simply strings, as in the above example, would require nothing more than string data types. :) ```d module hello_world; import std.stdio; import std.string; // strip()

Re: Calling readln() after readf

2022-06-20 Thread Gary Chike via Digitalmars-d-learn
On Monday, 20 June 2022 at 00:43:17 UTC, Ali Çehreli wrote: ... But when the program interacts with piped data, there may be multiple \n characters and all of those might have to be ignored before reading the next non-empty line. So you may want to do readln.strip multiple times? I don't

Any way to define variables from one scope in another scope?

2022-06-20 Thread Ruby The Roobster via Digitalmars-d-learn
Is there any way to define variables in an outer scope from an inner scope? I was thinking ```d void main() { int .y = 3; } ``` would work, but it doesn't.

Re: std.conv.to

2022-06-20 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/17/22 8:48 AM, harakim wrote: On Friday, 17 June 2022 at 12:31:45 UTC, harakim wrote: I can generically convert a string to a type using to!type. I have a read function that does that. I have simplified the example below: ```d int readNumber() {     return read!int(val =>

Re: nested function overloading

2022-06-20 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/17/22 8:09 AM, Chris Katko wrote: I don't need this functionality, but I wanted to be sure. Does function overloading not work with nested functions? I got a compiler error (something like "function already defined") when I tried it. Correct, it's not allowed. However, you can define a

Re: Window created with Windows API is not visible

2022-06-20 Thread solidstate1991 via Digitalmars-d-learn
It seems I solved most of the problems by modifying event handling. I'll continue solving further ones and adding more functionality.