Comments (6)
from nickel.
It looks like contrary to Nix there's no exhaustiveness check in the pattern-matching of records (in the sense that let { x } = { x = 1; y = 2; } in x
is a valid expression). Is that an explicit design choice or an overlook?
from nickel.
It looks like contrary to Nix there's no exhaustiveness check in the pattern-matching of records (in the sense that
let { x } = { x = 1; y = 2; } in x
is a valid expression). Is that an explicit design choice or an overlook?
Indeed. This is deliberate, as in the JavaScript syntax. I guess the question is: is destructuring currently used in Nix and intended to be used in Nickel as just a convenient syntax for extracting some fields from a (probably bigger) record, or is it rather a form of pattern matching and actually used for checking the structure of the matched record. In the former case, the exhaustiveness check is probably an annoyance at best. In the latter, an exhaustiveness check is indeed desirable, and partial matching could probably have the same syntax as in Nix: {foo=bar; ...}
, which is also consistent with the syntax ...rest
.
from nickel.
I'm in favour of {foo; bar}
having a closed semantics, and have a semantics for open matching. We really want both, I think.
from nickel.
I'm not convinced a language that's supposed to be minimalistic should have this (at least not in version 1.0). Even the minimal destructuring supported by Nix isn't really necessary.
from nickel.
from nickel.
Related Issues (20)
- Wrong version is reported by `nickel --version` for release artifacts HOT 7
- Variant of `std.contract.from_predicate` to specify an error message
- Some utilities in `std.array`: `remove_duplicates` and `filter_map` HOT 5
- Allow my users to use contracts shared on GitHub HOT 2
- `nickel doc` overflows the stack with recursive schemas HOT 2
- Forward the metadata when re-exporting a field HOT 1
- Hovering on a record field defined several times will only show the information for the first definition HOT 1
- Filter out the contract annotations on hover/completion when they don't add anything
- Output query results as JSON HOT 4
- Add empty YAML header when exporting
- Encode/decode JSON string HOT 2
- Make record pattern matching recursive HOT 6
- [Question] How to serialize sum type to json? HOT 3
- Bikeshed a name for `apply_as_custom`
- Short-circuiting version of `fold_left`
- Bikesheding: formatting of multi-line expressions enclosed in parentheses HOT 1
- Expose more math functions HOT 2
- Record row polymorphism can be destructive HOT 2
- 1.7.0 retag issue HOT 3
- Typechecking in recursive records shouldn't be confused by variables in an outer scope.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nickel.