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/
{^_^} has quit [Remote host closed the connection]
{^_^} has joined #nix-lang
__monty__ has joined #nix-lang
<gchristensen> it seems to me this should be valid:
<gchristensen> > [ {foo}: foo ]
<{^_^}> error: syntax error, unexpected '}', expecting '.' or '=', at (string):206:7
<ekleog> well, it could be valid… should it really?
<ekleog> related:
<ekleog> > let f = x: x; in f {a}: a
<{^_^}> error: syntax error, unexpected '}', expecting '.' or '=', at (string):206:22
<ekleog> > [ a: a ]
<{^_^}> error: syntax error, unexpected ':', at (string):206:4
<ekleog> > let f = x: x; in f a: a
<{^_^}> error: syntax error, unexpected ':', expecting ')', at (string):206:21
<ekleog> I'd guess it's to make the grammar non-infinite-lookahead
<ekleog> (LL(k) is the word, is that it?)
<gchristensen> ah
pie_ has joined #nix-lang
pie_ has quit [Remote host closed the connection]
pie_ has joined #nix-lang
<infinisil> ekleog: gchristensen: Huh, why should those be valid?
<gchristensen> there is no reason Nix can't figure out where the end of the function is
<gchristensen> the function header + exactly one complete statement
<gchristensen> but ekleog has a good point about non-infinite lookahead
<infinisil> [ a: a b ]
<infinisil> Is this [ (a: a) b ] or [ (a: a b) ]?
<gchristensen> that seems unambiguous to me
<gchristensen> (a: a)
<infinisil> Why not the second one/
<infinisil> ?
<gchristensen> because the statement ends after the a
<gchristensen> just like [ a b ], when a is a function
<infinisil> You mean the expression?
<gchristensen> sure
<gchristensen> :')
<infinisil> But " " is also function application
<infinisil> [ a: a b ] = [ (a: a b) ] can be valid
<gchristensen> yeah, but the operatr precedence inside [..]s is already settled, which is why it is unambiguous
<infinisil> Hmm.. I guess
<infinisil> But it looks weird
<infinisil> It could be valid yeah :)
MichaelRaskin has joined #nix-lang
{^_^} has quit [Read error: Connection reset by peer]
{^_^} has joined #nix-lang
__monty__ has quit [Quit: leaving]