| 19:17 | <sffc> | I strongly oppose a toString function having default behavior that is not round-trippable to the type it was created from, for a number of reasons. I didn't think this was a controversial position, but if it would help, I'll make another writeup like I did with #175 (why precision is important) and #181 (why Decimal isn't the only solution for representing exact numbers) |
| 19:22 | <sffc> |
so that e.g. new Decimal(amount) would work without any special Amount-detection code.
This is based on the potentially flawed premise that new Decimal(amount) would call ToString on the amount, but TC39 has ruled that we don't want this type of implicit conversion.
|
| 19:27 | <sffc> | Besides that point, I don't find the new Decimal(amount) argument to be convincing because:
- Brand checking is easy and ECMA does it all the time now, and even without brand checking, it could check for e.g. a
.decimal field or a Symbol.toDecimal function
- Amount can have a
toDecimal function, which looks nicer in chaining (people like method chaining)
|