Comments (4)
As a slight aside, we should consider getting rid of nested records because they make things unnecessarily complicated. For example, with Nixpkgs overlays, it's easy to override a top-level package foo
, but good luck figuring out how to override perlPackages.foo
.
So the record { a = 1; b.c = 2; }
shouldn't be a record containing fields a
and b
(where b
is a record containing c
), but a record containing fields a
and b.c
. This removes ambiguity about what self
refers to, e.g. in { a = 1; b.a = 2; b.c = self.a; }
, b.c
would evaluate to 1, since self
refers to the entire record.
Edit: this is more relevant to #84, since it means a.b.c = {e="bar"};
is something different than a.b.c.e = "bar";
.
from nickel.
I think my preference would be for something that behaves like the NixOS module system, but without any special syntax like rec
or config.<attr>
or self
. So you could write { a = 1; b = a; }
, and the value of b
depends on whether this record is later extended with a definition that overrides a
.
from nickel.
Is this closed by #135? Sounds like the decision was made there to not require an explicit rec
keyword. The rest of this issue appears to be obsolete.
from nickel.
Closed by #135 for records, superseded by #525 for let-binding.
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.