Re: Would you recommend TDPL today?

2024-01-15 Thread Mike Shah via Digitalmars-d-learn
On Tuesday, 16 January 2024 at 02:58:03 UTC, Jonathan M Davis wrote: On Monday, January 15, 2024 7:25:32 PM MST matheus via Digitalmars-d-learn wrote: [...] [...] that have since changed or which were never implemented (e.g. synchronized classes never became a thing; synchronized functions

Re: Would you recommend TDPL today?

2024-01-15 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, January 15, 2024 7:25:32 PM MST matheus via Digitalmars-d-learn wrote: > Hi, I'm mostly a lurker in these Forums but sometimes I post here > and there, my first language was C and I still use today together > with my own library (A Helper) which is like a poor version of > STB

Would you recommend TDPL today?

2024-01-15 Thread matheus via Digitalmars-d-learn
Hi, I'm mostly a lurker in these Forums but sometimes I post here and there, my first language was C and I still use today together with my own library (A Helper) which is like a poor version of STB (https://github.com/nothings/stb). I usually use D language sometimes as C on steroids, using

Re: `static` function ... cannot access variable in frame of ...

2024-01-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On Monday, 15 January 2024 at 22:23:27 UTC, Bastiaan Veelo wrote: On Monday, 15 January 2024 at 18:43:43 UTC, user1234 wrote: The two calls are not equivalent. so what is passed as alias need to be static too. Thanks all. I thought a static member function just isn't able to access the

Re: `static` function ... cannot access variable in frame of ...

2024-01-15 Thread user1234 via Digitalmars-d-learn
On Monday, 15 January 2024 at 18:34:58 UTC, H. S. Teoh wrote: On Mon, Jan 15, 2024 at 06:16:44PM +, Bastiaan Veelo via Digitalmars-d-learn wrote: Hey people, I can use some help understanding why the last line produces a compile error. ```d import std.stdio; struct S { static void

Re: `static` function ... cannot access variable in frame of ...

2024-01-15 Thread Bastiaan Veelo via Digitalmars-d-learn
On Monday, 15 January 2024 at 18:43:43 UTC, user1234 wrote: The two calls are not equivalent. so what is passed as alias need to be static too. Thanks all. I thought a static member function just isn't able to access the instance of the struct, but as I understand now it is static all the

Re: Socket handle leak and active handle warning with Vibe-D

2024-01-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On Monday, 15 January 2024 at 18:40:00 UTC, bomat wrote: Sorry, I probably should have mentioned I was on Windows. For testing it under Linux I commented out the call to `connectMongoDB`, since I don't have it installed there - and the warning went away. Interesting, I did not suspect that as

Re: Help optimize D solution to phone encoding problem: extremely slow performace.

2024-01-15 Thread Renato via Digitalmars-d-learn
On Monday, 15 January 2024 at 01:10:14 UTC, Sergey wrote: On Sunday, 14 January 2024 at 17:11:27 UTC, Renato wrote: If anyone can find any flaw in my methodology or optmise my code so that it can still get a couple of times faster, approaching Rust's performance, I would greatly appreciate

Re: `static` function ... cannot access variable in frame of ...

2024-01-15 Thread user1234 via Digitalmars-d-learn
On Monday, 15 January 2024 at 18:16:44 UTC, Bastiaan Veelo wrote: [...] It seems to me this should just work. Thanks! --Bastiaan. The two calls are not equivalent. To be equivalent you need to set `S_foo` static too, otherwise `S_Foo` is instanciated in `main` scope, proof: ```d import

Re: Socket handle leak and active handle warning with Vibe-D

2024-01-15 Thread bomat via Digitalmars-d-learn
On Monday, 15 January 2024 at 17:45:16 UTC, Steven Schveighoffer wrote: Which driver are you using? In the posix driver, it should mention (and use) the debug flag `EventCoreLeakTrace`.

Re: `static` function ... cannot access variable in frame of ...

2024-01-15 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Jan 15, 2024 at 06:16:44PM +, Bastiaan Veelo via Digitalmars-d-learn wrote: > Hey people, I can use some help understanding why the last line > produces a compile error. > > ```d > import std.stdio; > > struct S > { > static void foo(alias len)() [...] The trouble is with the

Re: `static` function ... cannot access variable in frame of ...

2024-01-15 Thread Dukc via Digitalmars-d-learn
On Monday, 15 January 2024 at 18:16:44 UTC, Bastiaan Veelo wrote: Hey people, I can use some help understanding why the last line produces a compile error. ```d import std.stdio; struct S { static void foo(alias len)() { writeln(len); } } void S_foo(alias len)() {

`static` function ... cannot access variable in frame of ...

2024-01-15 Thread Bastiaan Veelo via Digitalmars-d-learn
Hey people, I can use some help understanding why the last line produces a compile error. ```d import std.stdio; struct S { static void foo(alias len)() { writeln(len); } } void S_foo(alias len)() { writeln(len); } void main() { const five = 5; S_foo!five; //

Re: Socket handle leak and active handle warning with Vibe-D

2024-01-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On Monday, 15 January 2024 at 17:24:40 UTC, bomat wrote: On Sunday, 14 January 2024 at 20:36:44 UTC, Steven Schveighoffer wrote: There should be a version you can enable that tells you where that socket handle was allocated. That might give you a further clue as to why it's not closed when the

Re: Socket handle leak and active handle warning with Vibe-D

2024-01-15 Thread bomat via Digitalmars-d-learn
On Sunday, 14 January 2024 at 20:36:44 UTC, Steven Schveighoffer wrote: There should be a version you can enable that tells you where that socket handle was allocated. That might give you a further clue as to why it's not closed when the system shuts down. I think the program tells you which