Conversation

in your ideal programming language, which of these would be falsey?

0
3
5

@kasdeya voting everything except false to maximize chaos ablobcatnodfast

(just kidding, I voted false only)

0
0
2

@kasdeya empty list and nil are the same thing

1
0
2
@kasdeya null and false. Lua does it well
0
0
2

@kasdeya Answered everything except NaN and Zero, because integers and floats probably shouldn’t be directly true/false anyway imo. Empty data structures (string, list, dict/hashmap) make sense because then you’re checking for if they contain something. null and false are of course obvious.

0
0
2

@mir @kasdeya ooh... i gotta harshly disagree with that

1
0
1

@kasdeya my ideal programming language doesn't have the concept of falsiness!

0
0
2

@mir @kasdeya but should it be? i've seen use cases for them being different. like, you have a struct that represents a set of updates you want to make, so every field is nullable, and null means "don't change", whereas empty list means "set to empty list"

1
0
2

@evin @kasdeya for properties that need to be changed you would just. not include the ones that aren’t changing?

2
0
1

@evin @kasdeya for interop with things that treat empty list and nil separately there are keywords like :json-false which the tokenizers are hardcoded to respect. but generally using empty list as false works fine. lets you do (if var (do-thing-with var)) inside functions and lexically-bound environments - if var isn’t set it’s treated as false and fails gracefully. iirc

0
0
1

@mir @kasdeya well yeah, if you're sending it over a network that makes sense. but if you have the struct in memory, all fields have to have a value

0
0
2