Zach Leatherman on Nostr: is there really no low-level mechanism to intercept boolean primitive coercion in ...
Published at
2025-10-01 20:30:10 UTCEvent JSON
{
"id": "d92e31a1ff50531d6072f66edd3404f601badda0930c6d5a6eaaaae2c263f593",
"pubkey": "2b05fd2c694b9bfcb922a77b35f58d9d0138c130afc974d0091c961ba323388d",
"created_at": 1759350610,
"kind": 1,
"tags": [
[
"proxy",
"https://fediverse.zachleat.com/@zachleat/115300801628689509",
"web"
],
[
"proxy",
"https://fediverse.zachleat.com/users/zachleat/statuses/115300801628689509",
"activitypub"
],
[
"L",
"pink.momostr"
],
[
"l",
"pink.momostr.activitypub:https://fediverse.zachleat.com/users/zachleat/statuses/115300801628689509",
"pink.momostr"
],
[
"-"
]
],
"content": "is there really no low-level mechanism to intercept boolean primitive coercion in JavaScript?\n\nwhy can’t I extend `Boolean` to make `new MyBoolean(false)` be `falsy`? (I understand why it isn’t, but I want to make it so)\n\n\u003e Note: Unlike other type conversions like string coercion or number coercion, boolean coercion does not attempt to convert objects to primitives by calling user methods.\n\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean#boolean_coercion",
"sig": "6cf44219d9b3c49c25115ed860eab5a703b200f158b87eec677e3b1f689cc89dfd2933310e86ca0c3c8ff8f313880a948d91fbfb135f9de1a12a2d703b523e24"
}