top | item 38551182

(no title)

nodogoto | 2 years ago

So long as you consider "empty strings" to be "strings" in the first place. String of what?

It's like saying you have an "empty cup of water".

discuss

order

smsm42|2 years ago

As long as you consider cups of water and cups of milk be different objects (i.e. cups are not interchangeable, and you can't just throw out milk and fill it with water) it is a completely sensible statement.

For example, in Jewish religious families, there are often two sets of kitchen utensils - for meat products and for dairy/other products, since mixing those makes the food unfit for consumption by a religious person. In this situation, if you said "I have an empty meat pot" and somebody answered you "No, I need an empty milk pot, give me another one!" - it would make a total sense. Even though both pots are empty, they are not the same kind of pot for their users.

Similarly, if a string is a sequence of certain objects (characters, bytes, runes, graphemes, whatever you please) then empty sequence of such objects is not the same as an empty sequence of other objects - you could append a character to it, but you can't append a database connection to it, for example, and expect something sane to happen.

So yes, "empty cup of water" is exactly what it is, because in most programming languages, empty cups are not all alike. In some languages, there are sequence types that are agnostic towards their elements, and then an empty sequence of that kind wouldn't be a sequence of anything - it'd be just a separate entity. But strings rarely are implemented this way, for many practical reasons.

account42|2 years ago

People can come up with whatever weird believes they want, that doesn't mean this actually makes sense.

cfiggers|2 years ago

You just... Blew my mind.

So, but wait... Is the genitive "of water" functioning like an assertion? "All of the contents of the cup are water."

And wouldn't that assertion, in the case where the cup has no contents, be a vacuous truth?[0]

In other words, a cup of water, if it actually has water in it, cannot also be a cup of magma. But there's nothing stopping an cup with no contents at all being "of" both.

[0] https://en.wikipedia.org/wiki/Vacuous_truth

lgeorget|2 years ago

It holds true mathematically speaking. You can make (mathematical) sets of everything but there's only one empty set.

It's a bit like that with pointers in C: a char* is not a int* but null pointers are convertible to any pointer type.

mistercheph|2 years ago

It's time to put down the encyclopedia and pick up Plato and Aristotle