infinisil changed the topic of #nix-lang to: Channel for discussing Nix as a language - https://nixos.org/nix/manual/#chap-writing-nix-expressions - Logs: https://logs.nix.samueldr.com/nix-lang/
Synthetica has quit [Quit: Connection closed for inactivity]
ddellacosta has quit [Ping timeout: 246 seconds]
infinisil has quit [Quit: Configuring ZNC, sorry for the joins/quits!]
infinisil has joined #nix-lang
ddellacosta has joined #nix-lang
infinisil has quit [Quit: Configuring ZNC, sorry for the joins/quits!]
infinisil has joined #nix-lang
infinisil has quit [Client Quit]
infinisil has joined #nix-lang
ddellacosta has quit [Ping timeout: 246 seconds]
pie_ has quit [Ping timeout: 257 seconds]
pie_ has joined #nix-lang
pie__ has joined #nix-lang
pie_ has quit [Ping timeout: 258 seconds]
__monty__ has joined #nix-lang
Synthetica has joined #nix-lang
<pie__> sooo...apparently function equality isnt even reflexive
<pie__> > let f = a: a; in f == f
<{^_^}> false
<pie__> how do i write my tests nw
<pie__> now
<infinisil> pie___: Almost every language doesn't allow function comparison, because it can't be done in general
<pie__> i know
<pie__> but maybe something reasonable can be done
<pie__> i think it might be ok to return true where its literally the same function
<pie__> and by literally i mean the same object in memory
<pie__> i know we had the purity discussion about pointers yesterday but
<Taneb> That means your optimizer can change your semantics in ways you don't want it to
<pie__> does it?
<Taneb> Yeah
<pie__> / * it does?
<pie__> what happens
<Taneb> Say you've got something like "(x: x) == (y: y)". If your optimizer is fairly naive, this'll be false
<pie__> i meant only allowing f = x: x, f == f
<Taneb> But if your optimizer can realise that they're both the identity function and stores them in the same place, it'll be true
<Taneb> Then that's not necessarily same object in memory
<pie__> if you construct a new function, no guarantee its the same object (or, its possible, with more work)
<pie__> (as you said)
<pie__> i dont know how the f == f stuff would work
<Taneb> As far as I know there's not even a guarantee that let f = x: x; in f == f will only store f once
<Taneb> To do this you'd have to make more guarantees about memory which will impact optimization, or you'll have to store more stuff which will also impact optimization
<Taneb> Like, consider "let f = x: x; g = a: b: a == b; in g f f"
<Taneb> In your scheme, is that true or false?
<pie__> why do you need g
<pie__> theres obviously some purpose in it being there
<pie__> i dont know how this stuff actually gets evaluated
<pie__> i just imagine all f are a pointer to the function's code
<pie__> for some notion of pointer
<pie__> there isnt even a different operator for "are these objects the same" (afaik), so i cant just do that one thing either
<infinisil> I'm 99% sure you can code the thing without function equality
<infinisil> And I don't even know what you're coding
<infinisil> It's just that nobody ever needed it
<pie__> im writing tests
<pie__> for my weird thing :p
pie__ has quit [Remote host closed the connection]
pie__ has joined #nix-lang
pie__ has quit [Ping timeout: 252 seconds]
ddellacosta has joined #nix-lang
pie_ has joined #nix-lang
pie__ has joined #nix-lang
pie_ has quit [Ping timeout: 258 seconds]
ddellacosta has quit [Ping timeout: 258 seconds]
pie__ has quit [Ping timeout: 244 seconds]
pie_ has joined #nix-lang
ddellacosta has joined #nix-lang
__monty__ has quit [Quit: leaving]
ddellacosta has quit [Ping timeout: 244 seconds]