NodeBB <> Lemmy federation issue (re: nullable image/icon)
-
@julian there's no difference on the consuming side (and in many programming languages you can check for truthiness with something like `if x.get("totalItems")` which defaults to returning null if missing anyway)
functionally, you either have the information, or you don't
trwnh@mastodon.social as someone working on the consuming side, that is not correct.
If my AP lib automatically assumed null when requesting an object property that didn't exist I'd consider that a bug.
-
@julian this wouldn't be your AP lib, it would be your programming language itself
-
@julian this wouldn't be your AP lib, it would be your programming language itself
trwnh@mastodon.social I'm coding in js, which has all sorts of footguns, but even that won't return null when I attempt to access the non-existent property of an object... 😛
-
@julian what does js return instead? in most cases i'm familiar with, programming languages use null or nil or None for anything that doesn't have a value, or any reference which doesn't point anywhere. hence a null pointer exception when you try to dereference a null. if you try to get a value for a key that isn't in the dictionary, you get null by default because there is no value for a missing key. how would you consume a null value? if you have nothing to say, why say anything?
-
@julian what does js return instead? in most cases i'm familiar with, programming languages use null or nil or None for anything that doesn't have a value, or any reference which doesn't point anywhere. hence a null pointer exception when you try to dereference a null. if you try to get a value for a key that isn't in the dictionary, you get null by default because there is no value for a missing key. how would you consume a null value? if you have nothing to say, why say anything?
trwnh@mastodon.social
undefinedand perhaps that's why we're disagreeing on our interpretations of how these values should be handled.nullin JavaScript is very explicitly a declaration that there is no value or "intentionally empty".nullandundefinedare two separate things here at least. -
@julian that might be it, yeah. languages outside of javascript generally don't make a distinction between null and undefined, and even in javascript these are used inconsistently. for example localStorage.getItem will return null for a missing key. practically speaking, the "intentionally" distinction is a distinction without a difference in most processing contexts.