divnix / pop Goto Github PK
View Code? Open in Web Editor NEWPure Object Prototypes
License: MIT License
Pure Object Prototypes
License: MIT License
Best idea I've come up with to do this is to have yants export a function that generates a type checking pop. This pop will simply have an extension that does nothing but type check a series of values. If there are any problems, yants check functions will throw errors, otherwise the extension can just return an empty attrset. This could be implemented in yants itself.
nix-repl> pop.lib.pop { supers = [ { a = throw "err"; b = 5; } ]; }
error: err
An attribute in a pop containing an error shouldn't error out the entire pop. Other attributes should still be accessible even if one attribute errors out.
The following code should print out 5
, but it would just error out now.
p = pop.lib.pop { supers = [ { a = throw "err"; b = 5; } ]; }
p.b
cc @fare
let
a = pop { defaults.n = 1; extension = self: super: { n = super.n + 1; }; }
b = pop { supers = [ a ]; }
in
b.n
evaluates to 3
when it should be 2
Many times there are attributes you want to include in a POP for utility purposes, but they shouldn't be in the end result(after unpopping). There should be some way to mark certain attributes as special.
This could also replace #1 since you can just add extenders in a pop's extension
and mark those attributes as "special", so they get removed when unpopping.
p = pop {
defaults.value = 0;
extension = self: super: {
# Mark increment as "special" somehow
increment = pop { supers = [ self ]; extension = _: _: { value = super.value + 1; }; };
};
}
unpop (p.increment.increment) => { value = 2; }
or with #7
pop {
defaults.value = 0;
extension = self: super: {
increment = self (self: super: { value = super.value + 1; });
};
}
cc @fare
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.