static assert("nothing")

2022-05-31 Thread realhet via Digitalmars-d-learn
Hi, In my framework I just found a dozen of compile time error handling like: ...else static assert("Invalid type"); This compiles without error. And it was useless for detecting errors because I forgot the first "false" or "0" parameter. I think it is because of the weird case of "every

Re: static assert("nothing")

2022-05-31 Thread bauss via Digitalmars-d-learn
On Tuesday, 31 May 2022 at 09:11:41 UTC, JG wrote: On Tuesday, 31 May 2022 at 08:51:45 UTC, realhet wrote: Hi, In my framework I just found a dozen of compile time error handling like: ...else static assert("Invalid type"); This compiles without error. And it was useless for detecting

Re: static assert("nothing")

2022-05-31 Thread bauss via Digitalmars-d-learn
On Tuesday, 31 May 2022 at 08:51:45 UTC, realhet wrote: Hi, In my framework I just found a dozen of compile time error handling like: ...else static assert("Invalid type"); This compiles without error. And it was useless for detecting errors because I forgot the first "false" or "0"

Re: static assert("nothing")

2022-05-31 Thread JG via Digitalmars-d-learn
On Tuesday, 31 May 2022 at 08:51:45 UTC, realhet wrote: Hi, In my framework I just found a dozen of compile time error handling like: ...else static assert("Invalid type"); This compiles without error. And it was useless for detecting errors because I forgot the first "false" or "0"

Re: Execute the Shell command and continue executing the algorithm

2022-05-31 Thread frame via Digitalmars-d-learn
On Monday, 30 May 2022 at 11:18:42 UTC, Alexander Zhirov wrote: if (here is my condition termination of the program) OT: Wouldn't it be great to have ArnoldC support? ;-)

Re: static assert("nothing")

2022-05-31 Thread realhet via Digitalmars-d-learn
On Tuesday, 31 May 2022 at 09:35:30 UTC, Andrea Fontana wrote: On Tuesday, 31 May 2022 at 08:51:45 UTC, realhet wrote: Check if that string is init. assert("", "cool"); assert("ehh", "cool"); assert(string.init, "Not cool"); I feel some "JavaScript equality operator" vibes in this :D Anyways,

Re: static assert("nothing")

2022-05-31 Thread Andrea Fontana via Digitalmars-d-learn
On Tuesday, 31 May 2022 at 08:51:45 UTC, realhet wrote: Hi, In my framework I just found a dozen of compile time error handling like: ...else static assert("Invalid type"); This compiles without error. And it was useless for detecting errors because I forgot the first "false" or "0"

Re: static assert("nothing")

2022-05-31 Thread Tejas via Digitalmars-d-learn
On Tuesday, 31 May 2022 at 08:51:45 UTC, realhet wrote: Hi, In my framework I just found a dozen of compile time error handling like: ...else static assert("Invalid type"); This compiles without error. And it was useless for detecting errors because I forgot the first "false" or "0"

Re: Execute the Shell command and continue executing the algorithm

2022-05-31 Thread Christian Köstlin via Digitalmars-d-learn
On 2022-05-30 15:25, Ali Çehreli wrote: On 5/30/22 04:18, Alexander Zhirov wrote: > I want to run a command in the background The closest is spawnShell: import std.stdio; import std.process; import core.thread; void main() {   auto pid = spawnShell(`(sleep 1 & echo SLEEP >> log)`);  

Re: static assert("nothing")

2022-05-31 Thread Andrea Fontana via Digitalmars-d-learn
On Tuesday, 31 May 2022 at 09:52:10 UTC, realhet wrote: On Tuesday, 31 May 2022 at 09:35:30 UTC, Andrea Fontana wrote: On Tuesday, 31 May 2022 at 08:51:45 UTC, realhet wrote: Check if that string is init. assert("", "cool"); assert("ehh", "cool"); assert(string.init, "Not cool"); I feel some

Re: Execute the Shell command and continue executing the algorithm

2022-05-31 Thread Jack via Digitalmars-d-learn
On Tuesday, 31 May 2022 at 15:29:16 UTC, frame wrote: On Monday, 30 May 2022 at 11:18:42 UTC, Alexander Zhirov wrote: if (here is my condition termination of the program) OT: Wouldn't it be great to have ArnoldC support? ;-) i'm pretty sure the terminattor is more efficient than kill

Templatized delegates

2022-05-31 Thread Andrey Zherikov via Digitalmars-d-learn
I have tightly coupled code which I'd like to decouple but I'm a bit stuck. For simplicity, I reduced the amount of code to something simple to understand. So I have a struct `S` that has templated member function that does something. On the other side I have delegate holder `R` - this

Re: Tracing/Profiling D Applications

2022-05-31 Thread Christian Köstlin via Digitalmars-d-learn
On 2022-05-29 23:08, Ali Çehreli wrote: On 5/29/22 13:47, Christian Köstlin wrote: > Our discussion with using TLS for the > collectors proposed to not need any lock on the add method for > collector, because its thread local and with that thread safe? It would be great that way but then

Re: Tracing/Profiling D Applications

2022-05-31 Thread Christian Köstlin via Digitalmars-d-learn
On 2022-05-29 23:00, Ali Çehreli wrote: On 5/29/22 13:53, Christian Köstlin wrote: > According to > https://www.schveiguy.com/blog/2022/05/comparing-exceptions-and-errors-in-d/ > its bad to catch Errors ... Correct in the sense that the program should not continue after catching Error.

Re: Templatized delegates

2022-05-31 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 31 May 2022 at 21:15:24 UTC, Andrey Zherikov wrote: I have tightly coupled code which I'd like to decouple but I'm a bit stuck. For simplicity, I reduced the amount of code to something simple to understand. So I have a struct `S` that has templated member function that does

Re: Templatized delegates

2022-05-31 Thread Christian Köstlin via Digitalmars-d-learn
On 2022-05-31 23:15, Andrey Zherikov wrote: I have tightly coupled code which I'd like to decouple but I'm a bit stuck. For simplicity, I reduced the amount of code to something simple to understand. So I have a struct `S` that has templated member function that does something. On the other

Re: Templatized delegates

2022-05-31 Thread Andrey Zherikov via Digitalmars-d-learn
On Tuesday, 31 May 2022 at 21:53:17 UTC, Paul Backus wrote: If you want compile-time polymorphism, three's no other way. Yes, I want compile-time polymorphism. ```d import std.stdio; struct S { // function that should be called from delegate void doSomething(T)(T value) {

Re: Templatized delegates

2022-05-31 Thread Andrey Zherikov via Digitalmars-d-learn
On Tuesday, 31 May 2022 at 22:34:41 UTC, Christian Köstlin wrote: Would it help to not create the delegate in R's constructor, but feed the delegate into it (and create the delegate outside). This would also resemble your description (R is a delegate holder) more. That's possible but the

Basic SQLite Application

2022-05-31 Thread harakim via Digitalmars-d-learn
I'm creating an application in D to do some purchase management stuff and I ran into a snag pretty early on. I'm trying to use sqlite via [this library](https://github.com/adamdruppe/arsd/blob/master/sqlite.d). I started trying to get it to compile in another directory structure but since I've

Re: Templatized delegates

2022-05-31 Thread Andrey Zherikov via Digitalmars-d-learn
On Tuesday, 31 May 2022 at 23:15:24 UTC, Andrey Zherikov wrote: On Tuesday, 31 May 2022 at 21:53:17 UTC, Paul Backus wrote: If you want compile-time polymorphism, three's no other way. Yes, I want compile-time polymorphism. In case if `S.doSomething` is NOT template function then the