Nix: Nix parses `1.` as `1` which makes it look like range syntax is a thing

Created on 6 Jan 2020  路  2Comments  路  Source: NixOS/nix

nix-repl> assert (map (_: "x") [1..2]) == [ "x" "x" ]; 1
1
nix-repl> 1..2
error: attempt to call something which is not a function but a float, at (string):1:1
nix-repl> [1..2]
[ 1 0.2 ]

I think 1. probably should be a parsing error.

improvement

All 2 comments

Hmm :)

nix-repl> [1.2.3.4]
[ 1.2 0.3 0.4 ]

Parsing 1. as 1 appears to be consistent with other languages (C/C++, Python, Perl, ...).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LisannaAtHome picture LisannaAtHome  路  42Comments

copumpkin picture copumpkin  路  41Comments

Profpatsch picture Profpatsch  路  73Comments

domenkozar picture domenkozar  路  53Comments

lukego picture lukego  路  34Comments