Re: Debugging D code with GDB

2021-11-27 Thread Alexey via Digitalmars-d-learn
I found what Nemiver is much better for debugging D programs. With GDB I've got many problems, don't remember exactly. Thou I've used it through ddd, so maybe it's ddd problems, not exactly GDB's

Re: RFC to: my need for 'static switch' and CT 'static variables'

2021-11-25 Thread Alexey via Digitalmars-d-learn
On Friday, 26 November 2021 at 00:41:34 UTC, Elronnd wrote: you are right. thanks

Re: RFC to: my need for 'static switch' and CT 'static variables'

2021-11-25 Thread Alexey via Digitalmars-d-learn
On Thursday, 25 November 2021 at 22:00:15 UTC, Alexey wrote: I would want an static 'switch here', I mean something like ```D static switch (v.mode) { default: static assert(false, "v.mode" is invalid) case "gs_w_d": // etc... } ```

RFC to: my need for 'static switch' and CT 'static variables'

2021-11-25 Thread Alexey via Digitalmars-d-learn
for example, I have the code (code in sample generates different types of Properties dependingly on struct's mode value): ```D struct PropSetting { string mode; string type; string var_name; string title_name; string default_value; } mixin template

Re: How to read a single character in D language?

2021-11-23 Thread Alexey via Digitalmars-d-learn
On Wednesday, 24 November 2021 at 04:51:03 UTC, Alexey wrote: On Wednesday, 24 November 2021 at 04:48:46 UTC, Alexey wrote: oh, also I completely missed what you need it to work without Enter key presses. so here is fixed version ```D import std.stdio; import core.sys.posix.termios; void

Re: How to read a single character in D language?

2021-11-23 Thread Alexey via Digitalmars-d-learn
On Wednesday, 24 November 2021 at 04:48:46 UTC, Alexey wrote: writefln(0x"%c (%1$x %1$d) is inputed", c); sorry: ```diff 10c10

Re: How to read a single character in D language?

2021-11-23 Thread Alexey via Digitalmars-d-learn
On Friday, 19 November 2021 at 17:36:55 UTC, BoQsc wrote: Let's say I want to write a simple program that asks for an input of a single character. After pressing a single key on a keyboard, the character is printed out and the program should stop. ```D import std.stdio; void main() {

Re: mixins

2021-11-21 Thread Alexey via Digitalmars-d-learn
On Wednesday, 17 November 2021 at 14:51:58 UTC, Abby wrote: Hello I would like to create validation mixin or mixin template which would return on error. Something like this: ``` mixin template Validate(a, b) { if(a > b) { writeln("invalid input"); return false; } }

Re: need `this` on trying to use class method with parallelism Task! or task!

2021-11-14 Thread Alexey via Digitalmars-d-learn
On Sunday, 14 November 2021 at 17:42:18 UTC, Imperatorn wrote: Try task() instead of task!() worked! huge thanks!

Re: need `this` on trying to use class method with parallelism Task! or task!

2021-11-14 Thread Alexey via Digitalmars-d-learn
On Sunday, 14 November 2021 at 16:40:58 UTC, Andrey Zherikov wrote: Just do `auto t1 = task()` in `threadCreator` then. Error: value of `this` is not known at compile time ```D import std.stdio; import std.parallelism; class TC { void threadFunc() { import core.thread;

Re: need `this` on trying to use class method with parallelism Task! or task!

2021-11-14 Thread Alexey via Digitalmars-d-learn
On Sunday, 14 November 2021 at 14:24:00 UTC, Andrey Zherikov wrote: On Sunday, 14 November 2021 at 12:01:36 UTC, Alexey wrote: You just need two changes: - make `threadFunc` function static: `static void threadFunc()` - use `task` instead of `Task`: `auto t1 = task!threadFunc;` I need

Re: need `this` on trying to use class method with parallelism Task! or task!

2021-11-14 Thread Alexey via Digitalmars-d-learn
On Sunday, 14 November 2021 at 12:01:36 UTC, Alexey wrote: /home/animuspexus/dlang/d_v2.098.0/dmd/generated/linux/release/64/../../../../../phobos/std/parallelism.d(436): Error: need `this` for `threadFunc` of type `void()` Go example for contrast. Ideally, I'd like something similar; ```Go

Re: need `this` on trying to use class method with parallelism Task! or task!

2021-11-14 Thread Alexey via Digitalmars-d-learn
On Sunday, 14 November 2021 at 12:01:36 UTC, Alexey wrote: auto t1 = Task!threadFunc; if this line rewritten as `auto t1 = Task!(TC.threadFunc, this);` ```text /home/animuspexus/dlang/d_v2.098.0/dmd/generated/linux/release/64/../../../../../phobos/std/parallelism.d(451):

need `this` on trying to use class method with parallelism Task! or task!

2021-11-14 Thread Alexey via Digitalmars-d-learn
/home/animuspexus/dlang/d_v2.098.0/dmd/generated/linux/release/64/../../../../../phobos/std/parallelism.d(436): Error: need `this` for `threadFunc` of type `void()` ./t.d(22): Error: template instance `std.parallelism.Task!(threadFunc)` error instantiating thou documentation says `a function

Re: Inheriting function template from super class

2021-09-27 Thread Alexey via Digitalmars-d-learn
On Monday, 27 September 2021 at 16:10:54 UTC, Adam D Ruppe wrote: This is by design, overloads only consider things declared in the same place. see here https://dlang.org/articles/hijack.html thanks, Adam I'd also like to ask about similar code. If I'm writing code like so, I'm getting

Re: Inheriting function template from super class

2021-09-27 Thread Alexey via Digitalmars-d-learn
On Monday, 27 September 2021 at 14:54:41 UTC, Alexey wrote: hello. here I have some code sample. consequently, If I want C3 to inherit form C2, I'll have to forward template to from C1 to C2 by hand: ```D import std.stdio; class C1 { void writetext() {

Inheriting function template from super class

2021-09-27 Thread Alexey via Digitalmars-d-learn
hello. here I have some code sample. I'm not sure if this is my incorrect code or incorrect dmd behavior. Intention is C2 to inherit C1's `void writetext(alias A1)()` and instantiate it with `this.writetext!(typeof(this))();` ```D import std.stdio; class C1 { void writetext() {

Re: implimenting interface function by inheriting from other class

2021-08-22 Thread Alexey via Digitalmars-d-learn
On Sunday, 22 August 2021 at 12:20:56 UTC, Alexey wrote: On Saturday, 21 August 2021 at 20:35:43 UTC, Alexey wrote: Hello ```D interface Int { void coolFunc(); } class C1 { void coolFunc() { return; } } class C2 : C1, Int { } void main() { auto c = new C2; } ```

Re: implimenting interface function by inheriting from other class

2021-08-22 Thread Alexey via Digitalmars-d-learn
On Saturday, 21 August 2021 at 20:35:43 UTC, Alexey wrote: Hello ```D interface Int { void coolFunc(); } class C1 { void coolFunc() { return; } } class C2 : C1, Int { } void main() { auto c = new C2; } ``` dmd says it's not Ok: t.d(14): Error: class `t.C2`

Re: implimenting interface function by inheriting from other class

2021-08-21 Thread Alexey via Digitalmars-d-learn
On Saturday, 21 August 2021 at 20:35:43 UTC, Alexey wrote: Hello ```D interface Int { void coolFunc(); } class C1 { void coolFunc() { return; } } class C2 : C1, Int { } void main() { auto c = new C2; } ``` dmd says it's not Ok: t.d(14): Error: class `t.C2`

Re: implimenting interface function by inheriting from other class

2021-08-21 Thread Alexey via Digitalmars-d-learn
On Saturday, 21 August 2021 at 23:14:14 UTC, Alexey wrote: I want `this` inside of C1::coolFunc to return C2 if called as C2::coolFunc so executing `cast(C2) this !is null` inside of C1::coolFunc would work If this would work, I'd farther used this like so ```D interface Int { void

Re: implimenting interface function by inheriting from other class

2021-08-21 Thread Alexey via Digitalmars-d-learn
I want `this` inside of C1::coolFunc to return C2 if called as C2::coolFunc so executing `cast(C2) this !is null` inside of C1::coolFunc would work

Re: implimenting interface function by inheriting from other class

2021-08-21 Thread Alexey via Digitalmars-d-learn
On Saturday, 21 August 2021 at 22:56:40 UTC, Bastiaan Veelo wrote: On Saturday, 21 August 2021 at 20:35:43 UTC, Alexey wrote: Hello ```D interface Int { void coolFunc(); } class C1 { void coolFunc() { return; } } class C2 : C1, Int { } void main() { auto c = new

implimenting interface function by inheriting from other class

2021-08-21 Thread Alexey via Digitalmars-d-learn
Hello ```D interface Int { void coolFunc(); } class C1 { void coolFunc() { return; } } class C2 : C1, Int { } void main() { auto c = new C2; } ``` dmd says it's not Ok: t.d(14): Error: class `t.C2` interface function `void coolFunc()` is not implemented how to

Re: How to check if variable of some type can be of null value?

2021-07-24 Thread Alexey via Digitalmars-d-learn
On Saturday, 24 July 2021 at 18:10:07 UTC, Alexey wrote: I've tried to use ```typeof(t) is cast(t)null```, but compiler exits with error and so this can't be used for checking this issue. The goal I with to achieve by this check - is to use template and to assign value to variable basing on

How to check if variable of some type can be of null value?

2021-07-24 Thread Alexey via Digitalmars-d-learn
I've tried to use ```typeof(t) is cast(t)null```, but compiler exits with error and so this can't be used for checking this issue. The goal I with to achieve by this check - is to use template and to assign value to variable basing on it's ability to accept null as a value. some testing

Visual Studio 2019

2021-03-07 Thread Alexey via Digitalmars-d-learn
Does Visual Studio 2019 support D development? If yes, please give me instructions on how to work in this environment.