Re: null == "" is true?

2022-07-19 Thread Kagamin via Digitalmars-d-learn
On Monday, 18 July 2022 at 21:23:32 UTC, Antonio wrote: I will study it in detail and report (if required). May be, I will write the DTO problem with D article if I find time in august. In my experience null and empty in DTOs usually play the same logical role. It's a very contrived technical

Re: null == "" is true?

2022-07-19 Thread Antonio via Digitalmars-d-learn
On Tuesday, 19 July 2022 at 08:10:25 UTC, Kagamin wrote: On Monday, 18 July 2022 at 21:23:32 UTC, Antonio wrote: I will study it in detail and report (if required). May be, I will write the DTO problem with D article if I find time in august. In my experience null and empty in DTOs usually pl

Re: null == "" is true?

2022-07-19 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Tuesday, 19 July 2022 at 10:29:40 UTC, Antonio wrote: NULL is not the same that UNDEFINED The distintion is really important: NULL is a valid value (i.e.: The person phonenumber is NULL in database)... Of course, you can represent this concept natively in you language (Nullable, Optional,

Choosing the correct compiler version

2022-07-19 Thread Alexander Zhirov via Digitalmars-d-learn
Hello everyone I want to install the `ldc2` compiler on a specific machine `i586`: ```sh ~ $ strings /lib/libc.so.6 | grep GLIBC GLIBC_2.0 GLIBC_2.1 GLIBC_2.1.1 GLIBC_2.1.2 GLIBC_2.1.3 GLIBC_2.2 GLIBC_2.2.1 GLIBC_2.2.2 GLIBC_2.2.3 GLIBC_2.2.4 GLIBC_2.2.6 GLIBC_2.3 GLIBC_2.3.2 GLIBC_2.3.3 GLIBC_

Re: null == "" is true?

2022-07-19 Thread Bienlein via Digitalmars-d-learn
why? Because an empty string is, by default, represented by an empty slice of the null pointer. I don't program in D. I just read from time to time posts in the D forum because of the good quality of what people write. So, I'm not proficient in D, but in general internals should not boil up

Re: Choosing the correct compiler version

2022-07-19 Thread Alexander Zhirov via Digitalmars-d-learn
On Tuesday, 19 July 2022 at 15:28:44 UTC, Alexander Zhirov wrote: I'm trying to install dmd with my hands in order to build ldc2 from the sources, but I can't: I need to build a compiler under x32 in order to compile a program for the same machine. ```sh dmd2/src/dmd# make -f posix.mak posix

Re: null == "" is true?

2022-07-19 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Tuesday, 19 July 2022 at 15:30:30 UTC, Bienlein wrote: If the destination of a carrier was set to null, it implied that the destination was currently undefined. Then the robot brought the carrier to some rack where it was put aside for a while till the planning system had created a new produ

Re: null == "" is true?

2022-07-19 Thread Kagamin via Digitalmars-d-learn
On Tuesday, 19 July 2022 at 10:29:40 UTC, Antonio wrote: The summary is that a DTO that works like a Map needs to represent the absent key ant this is not the same that the Null value Example: ```d struct Null { /*...*/ } struct Undefined { /*...*/ } struct ContactDto { DtoVal!(Undefined, str

Re: null == "" is true?

2022-07-19 Thread Kagamin via Digitalmars-d-learn
Also what's the difference between null and empty phone number?

Re: null == "" is true?

2022-07-19 Thread Antonio via Digitalmars-d-learn
On Tuesday, 19 July 2022 at 17:05:27 UTC, Kagamin wrote: Also what's the difference between null and empty phone number? In a relational database, `NULL` is not the same that `""`... and `NULL` is not the same that `0`. Are semantically different and there are database invariants (like fore

Expanding CTFE code during compilation

2022-07-19 Thread Azi Hassan via Digitalmars-d-learn
Hello, Apologies in advance if this has been asked before. I can't find the right words to express what I'm looking for, but essentially, I'm wondering if the offers has the option of executing the parts that can be evaluated at compile time and then replacing them with the result of this eva

Re: Expanding CTFE code during compilation

2022-07-19 Thread Dennis via Digitalmars-d-learn
On Tuesday, 19 July 2022 at 21:43:01 UTC, Azi Hassan wrote: I'm wondering if the offers has the option of executing the parts that can be evaluated at compile time and then replacing them with the result of this evaluation. Try the `-vcg-ast` flag: ```D import object; import std; void main() {

Re: Expanding CTFE code during compilation

2022-07-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/19/22 5:43 PM, Azi Hassan wrote: Just in case this is a consequence of the XY problem, the reason why I'm looking for this is to make sure that the code I wrote did evaluate to what I'm expecting it to. Right now I do this with an enum assignment followed by static asserts, but I'd love i

Re: Choosing the correct compiler version

2022-07-19 Thread jfondren via Digitalmars-d-learn
On Tuesday, 19 July 2022 at 15:33:59 UTC, Alexander Zhirov wrote: On Tuesday, 19 July 2022 at 15:28:44 UTC, Alexander Zhirov wrote: I'm trying to install dmd with my hands in order to build ldc2 from the sources, but I can't: I need to build a compiler under x32 in order to compile a program

Re: Expanding CTFE code during compilation

2022-07-19 Thread Azi Hassan via Digitalmars-d-learn
On Tuesday, 19 July 2022 at 22:27:56 UTC, Dennis wrote: On Tuesday, 19 July 2022 at 21:43:01 UTC, Azi Hassan wrote: I'm wondering if the offers has the option of executing the parts that can be evaluated at compile time and then replacing them with the result of this evaluation. Try the `-vcg

Re: Expanding CTFE code during compilation

2022-07-19 Thread Azi Hassan via Digitalmars-d-learn
On Tuesday, 19 July 2022 at 22:41:43 UTC, Steven Schveighoffer wrote: On 7/19/22 5:43 PM, Azi Hassan wrote: Just in case this is a consequence of the XY problem, the reason why I'm looking for this is to make sure that the code I wrote did evaluate to what I'm expecting it to. Right now I do

Re: Expanding CTFE code during compilation

2022-07-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/19/22 8:33 PM, Azi Hassan wrote: Nice, a compile time console.log. Thanks a lot, this will come in handy. I wonder if it can be combined with version(debug) to only run the pragma line if compiled with -g, this way we can keep the printEnum! line as it is. Then again, the code would beco

Re: Expanding CTFE code during compilation

2022-07-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/19/22 8:57 PM, Steven Schveighoffer wrote: There's a slight bloat in the compiler symbol table when  but other than that it should be effective. Obviously I didn't finish that thought... "when `-debug` isn't used on the command line" -Steve