Re: How to exclude function from being imported in D language?

2022-03-19 Thread Salih Dincer via Digitalmars-d-learn
On Tuesday, 8 March 2022 at 18:38:47 UTC, Paul Backus wrote: On Tuesday, 8 March 2022 at 17:47:47 UTC, BoQsc wrote: For example, you could use a [`version` condition][1]: ```d module otherprogram; version (Otherprogram_NoMain) { // no main function } else { void main(string[] args)

Re: Nested Classes with inheritance

2022-03-19 Thread Salih Dincer via Digitalmars-d-learn
On Sunday, 20 March 2022 at 01:28:44 UTC, Era Scarecrow wrote: Inheritance and Polymorphism is one of the hardest things to grasp mostly because examples they give in other books of 'objects' is so far unrelated to software that it doesn't really compare. `"An object is like a book which you ca

Re: Nested Classes with inheritance

2022-03-19 Thread Era Scarecrow via Digitalmars-d-learn
On Saturday, 19 March 2022 at 12:23:02 UTC, user1234 wrote: I think OP is learning OOP. His error looks like that for the least. True. Looking at the code it shouldn't spaghetti in on itself infinitely and is basically clean in his intent. Inheritance and Polymorphism is one of the hardest

Re: I like dlang but i don't like dub

2022-03-19 Thread mee6 via Digitalmars-d-learn
On Friday, 18 March 2022 at 21:04:03 UTC, H. S. Teoh wrote: Review the code you say? Ha! If you were that diligent, you'd have written the code yourself in the first place. Not likely. That logic doesn't make sense. Reading code takes way less time than writing good code, especially for large

Re: Help needed to learn templates

2022-03-19 Thread Stanislav Blinov via Digitalmars-d-learn
On Saturday, 19 March 2022 at 13:38:42 UTC, Vinod K Chandran wrote: On Saturday, 19 March 2022 at 11:47:53 UTC, Stanislav Blinov wrote: No. First of all Thanks for the reply. The answer "No" is a wonder to me. Because, from my point of view, `U` is coming from nowhere. My understanding is, w

Re: I like dlang but i don't like dub

2022-03-19 Thread Guillaume Piolat via Digitalmars-d-learn
On Friday, 18 March 2022 at 04:13:36 UTC, Alain De Vos wrote: Dlang includes some good ideas. But dub pulls in so much stuff. Too much for me. I like things which are clean,lean,little,small. But when i use dub it links with so many libraries. Are they really needed ? And how do you compare to py

Re: Help needed to learn templates

2022-03-19 Thread Vinod K Chandran via Digitalmars-d-learn
On Saturday, 19 March 2022 at 16:08:33 UTC, Ali Çehreli wrote: Here is the clickable url: http://ddili.org/ders/d.en/is_expr.html I just read it again and I still like what I wrote there. :) (Usually it is the other way around.) Ali Thanks. Let me read that chapter.

Re: Help needed to learn templates

2022-03-19 Thread Vinod K Chandran via Digitalmars-d-learn
On Saturday, 19 March 2022 at 15:58:25 UTC, Ali Çehreli wrote: I wrote a chapter about the is expression but it's still mysterious to me. :) ddili.org/ders/d.en/is_expr.html Thanks for the reply. I think I choose the wrong book. I knew about your book but I thought this one is specially

Example of Windows SSL with Secure Channel?

2022-03-19 Thread Anonymouse via Digitalmars-d-learn
Does anyone have an example snippet code connecting to, reading from and writing to a server using SSL under Windows with Secure Channel? Something in a personal project you wouldn't mind sharing a part of to let me dissect? My project (IRC bot) supports connecting to a server using SSL, for

Re: Help needed to learn templates

2022-03-19 Thread Ali Çehreli via Digitalmars-d-learn
On 3/19/22 08:58, Ali Çehreli wrote: > I wrote a chapter about the is expression but it's still mysterious to > me. :) > >ddili.org/ders/d.en/is_expr.html Here is the clickable url: http://ddili.org/ders/d.en/is_expr.html I just read it again and I still like what I wrote there. :) (Usua

Re: Help needed to learn templates

2022-03-19 Thread Ali Çehreli via Digitalmars-d-learn
On 3/19/22 06:38, Vinod K Chandran wrote: > On Saturday, 19 March 2022 at 11:47:53 UTC, Stanislav Blinov wrote: >> >> No. >> > First of all Thanks for the reply. The answer "No" is a wonder to me. I wrote a chapter about the is expression but it's still mysterious to me. :) ddili.org/ders/d.

Cross-compilation for Linux from Windows using DMD

2022-03-19 Thread Preetpal via Digitalmars-d-learn
Is this supposed to work out of the box (see: [Reddit Post](https://www.reddit.com/r/d_language/comments/sypgaj/dmd_supports_crosscompilation_with_os_switch/))? Trying to cross-compile a hello world program for Linux on Windows with the command **dmd -os=linux main.d** which gives no output on

Re: Help needed to learn templates

2022-03-19 Thread Vinod K Chandran via Digitalmars-d-learn
On Saturday, 19 March 2022 at 08:49:02 UTC, Salih Dincer wrote: Thanks for the reply. You explained the idea very well and it's easy to understand for a novice.

Re: Help needed to learn templates

2022-03-19 Thread Vinod K Chandran via Digitalmars-d-learn
On Saturday, 19 March 2022 at 11:47:53 UTC, Stanislav Blinov wrote: No. First of all Thanks for the reply. The answer "No" is a wonder to me. Because, from my point of view, `U` is coming from nowhere. My understanding is, we can use any parameter of a template inside the template. So in thi

Re: Nested Classes with inheritance

2022-03-19 Thread user1234 via Digitalmars-d-learn
On Saturday, 19 March 2022 at 05:25:01 UTC, Era Scarecrow wrote: On Saturday, 19 March 2022 at 00:16:48 UTC, user1234 wrote: That crashes because of the creation of `Bar b` member, which itself has a Bar b member, which itself... Mhmm... So There's Foo with Bar b, which has Bar b which has B

Re: Help needed to learn templates

2022-03-19 Thread Stanislav Blinov via Digitalmars-d-learn
On Saturday, 19 March 2022 at 05:54:26 UTC, Vinod K Chandran wrote: Question 1 - `U` is appearing in the first static if statement. But we had to write `U` on the template line, right? Like - `template rank(T, U)` No. Question 2 - The statif if test is - `T t == U[ ]` What does that mean ?

Re: Nested Classes with inheritance

2022-03-19 Thread Salih Dincer via Digitalmars-d-learn
On Saturday, 19 March 2022 at 00:16:48 UTC, user1234 wrote: ```d if (typeid(this) !is typeid(Bar)) this.b = new Bar(this.i); ``` A very clever and ingenious solution. Thanks... SDB@79

Re: Help needed to learn templates

2022-03-19 Thread Salih Dincer via Digitalmars-d-learn
On Saturday, 19 March 2022 at 05:54:26 UTC, Vinod K Chandran wrote: Question 1 - `U` is appearing in the first static if statement. But we had to write `U` on the template line, right? Like - `template rank(T, U)` Question 2 - The statif if test is - `T t == U[ ]` What does that mean ? Question