Re: Examples from "Programming in D" book

2025-07-25 Thread Brother Bill via Digitalmars-d-learn
On Friday, 25 July 2025 at 18:47:19 UTC, Ali Çehreli wrote: On 7/25/25 4:10 AM, Brother Bill wrote: > On Friday, 25 July 2025 at 10:56:08 UTC, novicetoo wrote: >> check https://ddili.org/ders/d.en/index.html >> under "Code samples as a .zip file" > > Checked that out. These are not in order, nor

Re: How do I pass a variables as data with gtkd signals ?

2025-07-25 Thread Dejan Lekic via Digitalmars-d-learn
On Friday, 25 July 2025 at 16:44:13 UTC, huangyy wrote: I want to write a small program with gtkd. I need to use Signals.connectData to transfer an int type parameter to the callback function. I don't know how to write it. I hope someone can help me. It would be best if you can provide a sample

Re: Examples from "Programming in D" book

2025-07-25 Thread Ali Çehreli via Digitalmars-d-learn
On 7/25/25 4:10 AM, Brother Bill wrote: > On Friday, 25 July 2025 at 10:56:08 UTC, novicetoo wrote: >> check https://ddili.org/ders/d.en/index.html >> under "Code samples as a .zip file" > > Checked that out. These are not in order, nor exhaustive. > > I'll create my own code samples, then post t

Re: Inherited constructor

2025-07-25 Thread Brother Bill via Digitalmars-d-learn
On Friday, 25 July 2025 at 03:57:34 UTC, Andy Valencia wrote: On Friday, 25 July 2025 at 02:40:35 UTC, H. S. Teoh wrote: In D, constructors are not inherited, so yes, unfortunately you have to write a forwarding ctor that passes the arguments along to the base class. My OO worldview goes bac

Re: Inherited constructor

2025-07-25 Thread Jerry via Digitalmars-d-learn
Another way to forward any constructor call is to do this: import std.stdio; class A { int x; this(int x) { this.x = x; } } class B : A { this(Args...)(Args args) { super(args); } } void main() { auto b = new B(42); b.x.writeln; }

How do I pass a variables as data with gtkd signals ?

2025-07-25 Thread huangyy via Digitalmars-d-learn
I want to write a small program with gtkd. I need to use Signals.connectData to transfer an int type parameter to the callback function. I don't know how to write it. I hope someone can help me. It would be best if you can provide a sample code. Thank!

Re: Eiffel like reports for Design by Contract contracts

2025-07-25 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
Some notes: 1. The ``Identifier :`` syntax is used for labels within a statement list. 2. The feature in question you are asking about is assertion clauses. D does not have this. https://www.eiffel.org/doc/solutions/Design_by_Contract_and_Assertions https://www.eiffel.org/doc/eiffel/Eiffel_pr

Re: Examples from "Programming in D" book

2025-07-25 Thread Brother Bill via Digitalmars-d-learn
On Friday, 25 July 2025 at 10:56:08 UTC, novicetoo wrote: check https://ddili.org/ders/d.en/index.html under "Code samples as a .zip file" Checked that out. These are not in order, nor exhaustive. I'll create my own code samples, then post them here first.

Re: Examples from "Programming in D" book

2025-07-25 Thread novicetoo via Digitalmars-d-learn
check https://ddili.org/ders/d.en/index.html under "Code samples as a .zip file"

Eiffel like reports for Design by Contract contracts

2025-07-25 Thread Brother Bill via Digitalmars-d-learn
In Eiffel, it is trivial to get a report for Subject Matter Experts (SMEs) that will provide feedback that the DbC contracts are what they agreed to. It would be nice to have this in D. Does D already have this, or should this be added to DIP Ideas forum? Imagine a sample contract for Vats

Examples from "Programming in D" book

2025-07-25 Thread Brother Bill via Digitalmars-d-learn
Has anyone already published the D examples from the "Programming in D" book? If not, I'll do it, and publish it here first. It would be good to have this on dlang.org for D newbies.

Re: std.random.uniform(1, 101) crashes. Why, and workaround.

2025-07-25 Thread Brother Bill via Digitalmars-d-learn
On Friday, 25 July 2025 at 07:16:55 UTC, evilrat wrote: On Friday, 25 July 2025 at 01:04:31 UTC, Brother Bill wrote: From "Programming in D" book: import std.stdio; import std.random; void main() { int number = uniform(1, 101); writeln("Edit source/app.d to start your proj

Re: std.random.uniform(1, 101) crashes. Why, and workaround.

2025-07-25 Thread evilrat via Digitalmars-d-learn
On Friday, 25 July 2025 at 01:04:31 UTC, Brother Bill wrote: From "Programming in D" book: import std.stdio; import std.random; void main() { int number = uniform(1, 101); writeln("Edit source/app.d to start your project."); } Running it generates: phobos64.lib