| 06:28 | <annevk> | Not sure then 😟 |
| 11:51 | <JakeA> | I'm never quite sure in specs when I should use "the" vs "a new". Eg "Let foo be the empty string", "Let bar be a new map". My assumption is to use "the" for immutable types that are ===, and "a new" otherwise. |
| 11:51 | <JakeA> | The empty string === the empty string. This is fine with strings, but seems wrong with maps since they can be mutated. |
| 11:53 | <annevk> | JakeA: I'm pretty sure I've been inconsistent around lists at least |
| 11:54 | <annevk> | JakeA: these days I might use the shorthand << >> (but with the Unicode characters) instead |
| 11:54 | <annevk> | JakeA: and yeah, there's only one empty string |
| 11:55 | <annevk> | However, we mutate strings too, so... |
| 11:55 | <JakeA> | Hah, I guess string mutations should be a new string each time |
| 11:57 | <annevk> | Maybe, https://url.spec.whatwg.org/#concept-url-serializer |
| 11:58 | <andreubotella> | ideally, this would depend of a concept of equality/identity: if you create two strings/maps and populate them somehow, can they be equal? |
| 11:58 | <annevk> | And more importantly: https://github.com/whatwg/infra/issues/91 |
| 11:58 | <andreubotella> | for strings, presumably so |
| 11:59 | <annevk> | Equality is defined on a per-type basis |
| 12:01 | <JakeA> | I've definitely used "if a is b" on types that don't define equality, and I expect referential equality |
| 12:02 | <annevk> | Yeah, that's fair (and should maybe be documented as a thing) |
| 12:02 | <JakeA> | I'll write up an issue for infra |
| 12:02 | <annevk> | And is also why sometimes it's useful to have "equals" for things like hosts or URLs as they are not "is" but are "equals" to each other |
| 12:03 | <JakeA> | Agreed |
| 12:03 | <andreubotella> | There's also the fact that I don't think anyone is comfortable with strings being mutable, but as discussed before, something like a StringBuilder would be more cumbersome |
| 12:04 | <JakeA> | Seems easy to write: Set foo to foo concatenated with "hello" |
| 12:12 | <annevk> | Yeah, we could probably rewrite some things along those lines, might be more straightforward than some of the alternatives considered in that issue |
| 12:14 | <andreubotella> | I was thinking that this was closely tied to https://github.com/whatwg/infra/issues/319, since if we define strings as lists, that would probably mean they couldn't be immutable |
| 12:15 | <andreubotella> | and on the other hand, if they're not lists but we define conversions back and forth, and maybe add a few helper operations, it could make building modified strings easier |
| 12:19 | <JakeA> | Filed https://github.com/whatwg/infra/issues/326 |