On Wednesday, 20 July 2022 at 13:35:14 UTC, Kagamin wrote:
On Tuesday, 19 July 2022 at 18:05:34 UTC, Antonio wrote:
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 foreign
key
On Tuesday, 19 July 2022 at 18:05:34 UTC, Antonio wrote:
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 foreign keys)
based on it. Trying to "mix" this concepts in a databas
On Tuesday, 19 July 2022 at 16:55:39 UTC, Kagamin wrote:
As I understand, in your scenario there's no difference between
null string and empty string, they both work like empty string,
and D treats them as empty string. That's what I mean when I
said that distinction between null and empty is
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
Also what's the difference between null and empty phone number?
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
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
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
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,
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
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
On Monday, 18 July 2022 at 17:20:04 UTC, Kagamin wrote:
... If you want such difference, use the Nullable wrapper or
Algebraic.
I do :-) In fact, I use algebraic types supporting Null and
Undefined for DTOs representation (and REST APIs). But I
discovered some "rare" side effects in librari
On Monday, 18 July 2022 at 17:20:04 UTC, Kagamin wrote:
Difference between null and empty is useless.
Not really. `null` typically means that the value is missing,
irrelevant and not usable, which is quite different from having
"" as a usable value.
On Tuesday, 12 July 2022 at 20:36:03 UTC, Antonio wrote:
Honestly, it is difficult to understand for newcomers... there
is a reason, but there is a reason in javascript for `0 == ''`
too
People would have different preferences there. Difference between
null and empty is useless. D does the ri
On Friday, 15 July 2022 at 11:12:07 UTC, Steven Schveighoffer
wrote:
Note that the term `null` and `[]` are special tokens that
morph type to whatever is most appropriate at the time. `null`
implicitly can be typed as any pointer type, or any array type.
`[]` can be typed as any array type. How
On Friday, 15 July 2022 at 06:38:58 UTC, Salih Dincer wrote:
Consider null type array which is a related topic but it cannot
get a null element! The first is ok, but the second is legal.
So no effect, is it normal?
```d
auto p = [ null, null ];//*
assert(
is(typeof(null)[] :
type
On Tuesday, 12 July 2022 at 22:58:32 UTC, Steven Schveighoffer
wrote:
```d
string a = "abcabc";
assert(a[0 .. 3] == a[3 .. $])
assert(a[0 .. 3] !is a[3 .. $])
```
The point is, `==` compares *value*, `is` always compares
*identity*.
Consider null type array which is a related topic but it ca
Hi @Steven Schveighoffer,
Yes solution looking useful and sure it will work.
Thanks.
On 7/12/22 4:36 PM, Antonio wrote:
On Tuesday, 12 July 2022 at 18:56:43 UTC, Paul Backus wrote:
On Tuesday, 12 July 2022 at 16:40:38 UTC, H. S. Teoh wrote:
Because an empty string is, by default, represented by an empty slice
of the null pointer.
Do not rely on this, however; it's possible so
On Tuesday, 12 July 2022 at 20:36:03 UTC, Antonio wrote:
Honestly, it is difficult to understand for newcomers... there
is a reason, but there is a reason in javascript for `0 == ''`
too
Correction
```d
string a = null;
assert(a is null);
assert(a == "");
string b = "";
assert(b !is null);
a
On Tuesday, 12 July 2022 at 18:56:43 UTC, Paul Backus wrote:
On Tuesday, 12 July 2022 at 16:40:38 UTC, H. S. Teoh wrote:
Because an empty string is, by default, represented by an
empty slice of the null pointer.
Do not rely on this, however; it's possible sometimes to get
an empty string that
On Tuesday, 12 July 2022 at 19:55:46 UTC, ag0aep6g wrote:
On Tuesday, 12 July 2022 at 19:02:01 UTC, user1234 wrote:
On Tuesday, 12 July 2022 at 16:40:38 UTC, H. S. Teoh wrote:
[...]
Do not rely on this, however;
Absolutely. I'd like to add: especially as default parameter
value that's an ar
On 12.07.22 22:14, H. S. Teoh wrote:
Pedantically, no, they're not the same. You can assign null to a
pointer, but you can't assign [] to a pointer. `null` is a supertype of
`[]`.
But probably nobody actually cares about this distinction. :-D
If we're ignoring context, "null" has four characte
On Tue, Jul 12, 2022 at 07:55:46PM +, ag0aep6g via Digitalmars-d-learn
wrote:
> On Tuesday, 12 July 2022 at 19:02:01 UTC, user1234 wrote:
> > On Tuesday, 12 July 2022 at 16:40:38 UTC, H. S. Teoh wrote:
> [...]
> > > Do not rely on this, however;
> >
> > Absolutely. I'd like to add: especially
On Tuesday, 12 July 2022 at 19:02:01 UTC, user1234 wrote:
On Tuesday, 12 July 2022 at 16:40:38 UTC, H. S. Teoh wrote:
[...]
Do not rely on this, however;
Absolutely. I'd like to add: especially as default parameter
value that's an array. Never use null. use `[]` (empty array
literal).
Jus
On Tuesday, 12 July 2022 at 16:40:38 UTC, H. S. Teoh wrote:
On Tue, Jul 12, 2022 at 04:27:44PM +, Antonio via
Digitalmars-d-learn wrote:
It works
```d
void main()
{
assert(null=="");
}
```
why?
Because an empty string is, by default, represented by an empty
slice of the null pointer.
On Tuesday, 12 July 2022 at 16:40:38 UTC, H. S. Teoh wrote:
Because an empty string is, by default, represented by an empty
slice of the null pointer.
Do not rely on this, however; it's possible sometimes to get an
empty string that isn't null, e.g., if you incrementally shrink
a slice over a
On 7/12/22 10:11, Steven Schveighoffer wrote:
> The algorithm to compare *any* arrays is first verify the lengths are
> the same. Then for each element in the array, compare them. Since there
> are 0 elements in both the empty string and the null string, they are
> equal.
Checking .empty() cover
On 7/12/22 12:40 PM, H. S. Teoh wrote:
Because an empty string is, by default, represented by an empty slice of
the null pointer.
No, it's not a null pointer. It's a pointer to a zero-character. But it
is indeed an empty slice.
-Steve
On 7/12/22 12:27 PM, Antonio wrote:
It works
```d
void main()
{
assert(null=="");
}
```
why?
A string is not exactly a reference type. It's a length and a pointer.
This can be confusing to newcomers, especially ones that come from
languages that treat arrays and strings as object refere
On Tuesday, 12 July 2022 at 16:40:38 UTC, H. S. Teoh wrote:
On Tue, Jul 12, 2022 at 04:27:44PM +, Antonio via
Digitalmars-d-learn wrote:
It works
```d
void main()
{
assert(null=="");
}
```
why?
Because an empty string is, by default, represented by an empty
slice of the null pointer.
On Tue, Jul 12, 2022 at 04:27:44PM +, Antonio via Digitalmars-d-learn wrote:
> It works
>
> ```d
> void main()
> {
>assert(null=="");
> }
> ```
>
> why?
Because an empty string is, by default, represented by an empty slice of
the null pointer.
Do not rely on this, however; it's possible
It works
```d
void main()
{
assert(null=="");
}
```
why?
33 matches
Mail list logo