Comments (3)
@rightfold: Field names will definitely appear in serialized data. My plan is to make Plate useful for describing meaningful-on-their-own formats like https://en.wikipedia.org/wiki/ICalendar, not to compete with Protocol Buffers-style formats that do very efficient serialization by dropping field names.
If field names appear in the serialized data, you can tag schemas and serialized data with version numbers using semver. You can check statically that versions are backwards-compatible, and if they aren't, require a major verison bump.
I think the simplest thing to do is to leave versioning out of the core of Plate. I really like the idea of doing static analysis on version compatibility though, once we get the core of Plate finished this would be a great tool to build.
from plate.
Also @rightfold your twitter comments are super relevant:
In PureScript, additional fields are only allowed if you explicitly allow them. You can't pass {x: 1, y: 2} to f :: {x :: Int} -> Int
You need to write f :: forall r. { x :: Int | r } -> Int
Maybe we should have each product type say explicitly whether it allows extra rows or not.
from plate.
If field names appear in the serialized data, you can tag schemas and serialized data with version numbers using semver. You can check statically that versions are backwards-compatible, and if they aren't, require a major verison bump. All the versions would remain in the schema.
foo#1.0 = {x :: Int}
foo#1.1 = {x :: Int, y :: Int}
foo#2.0 = {a :: Int}
If you have constrained types, such as Int where * >= 0
, you can use an SMT solver like Z3 to check compatibility. For example, A where P(*)
is backwards-compatible with B where Q(*)
if A
is backwards compatible with B
and forall x. P(x) implies Q(x)
. But I don't know if Plate has this or if this is planned.
I have never actually implemented the compatibility checks but I don't see why it shouldn't work. It's analogous to subtyping where upcasts are coercions.
from plate.
Related Issues (6)
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 plate.