James Lewis on Nostr: Oh! Of course! Rust itself doesn't have `null`, but I can totally make more falsy ...
Oh! Of course! Rust itself doesn't have `null`, but I can totally make more falsy Options, and that would enable me to have a lot more control about exceptions, like "missing," (API doesn't know it should be there) "empty," (API failed to give a value) or actually `false` (API knew it should be there and set it to `false`) being different, usable cases.
That should be better code than my go-to of negative INTs to communicate a specific error type.
Published at
2023-12-29 15:17:52Event JSON
{
"id": "34591403b39f4f02e9c273c745b4e05975804d54cae6f07410ec1147499d4e92",
"pubkey": "9a4acdeb978565e27490dca65c83e9f65745eaec1d9a0405a52d198c1489913b",
"created_at": 1703863072,
"kind": 1,
"tags": [
[
"p",
"da761b4153a1844dc03ad505fc08d125d4bb054d7cf4a4fe06de3df77a45fd85",
"wss://relay.nostr.band/",
"Janis"
],
[
"p",
"da761b4153a1844dc03ad505fc08d125d4bb054d7cf4a4fe06de3df77a45fd85",
"wss://relay.nostr.band/",
"Janis"
],
[
"p",
"9a4acdeb978565e27490dca65c83e9f65745eaec1d9a0405a52d198c1489913b",
"wss://relay.nostr.band/",
"James Lewis"
],
[
"e",
"1c5db59df3cf4dc451f5fa0c23bcec9fa6460667663d2d97da9729d23ce9292a",
"",
"root"
],
[
"e",
"941014683972b681968afbfe3f99435d70b6013831721dae59603ce4842688ac",
"wss://eden.nostr.land/",
"reply"
]
],
"content": "Oh! Of course! Rust itself doesn't have `null`, but I can totally make more falsy Options, and that would enable me to have a lot more control about exceptions, like \"missing,\" (API doesn't know it should be there) \"empty,\" (API failed to give a value) or actually `false` (API knew it should be there and set it to `false`) being different, usable cases.\n\nThat should be better code than my go-to of negative INTs to communicate a specific error type.",
"sig": "800857c4d69dad7ffa5a5658aa67ec86fb5a215d8279edf753a2245764014ecca414859e149f56ae6ce34d9b542429b237ce7dd5709bd4afaf9c1cb9651c339b"
}