Code Monkey home page Code Monkey logo

crimson's People

Contributors

ratmice avatar

Watchers

 avatar

crimson's Issues

quoted maps vs unquoted struct fields

We should probably have some differentiator between when keys are data, and when keys are fields of a structure...
From memory I don't believe there is anything in the current parser which represents fields of structures.

Single pass typechecker

Another weirdness budget issue:

We should implement a type checker for crimson, and try and make it a single pass, which type checks you read.
This should explain some other weird decisions regarding why we chose <type>value rather than value: type.
But anything which prevents type-check-as-you-go... should be considered a defect in the language

Make a decison on order preserving key value collection

Background

Crimson has a dichotomy between ordered and unordered collections,

  • Set: {0, 1, 2}
  • Array: [0, 1, 2]
  • Map: {"foo" = 1, "bar" = 2}

For syntactic consistency it somewhat makes sense to include

  • Tree: ["foo" = 1, "bar" = 2]

This rule is commented out of the grammar here:

crimson/src/crimson.y

Lines 60 to 69 in a0472b0

// The equivalent of an Ordered key value data structure would be some bare form of a tree
// Acting like an array of tuples, It is probably best to just encode this explicitly as a array of tuples,
// or explicitly as a struct.
//
// Essentially it would allow you to write:
// [(1, "foo"), (0, "bar")]
// as [1 = "foo", 0 = "bar"]
//
// I don't really see any motiviation for including it though...
// | '[' KvSeq ']'

Argument for

I think that the biggest argument for allowing it comes from the order_preserving feature of the following libraries:
https://docs.rs/crate/toml/latest/features
https://docs.rs/crate/serde_json/latest/features

These existence of these features here wouldn't actually help much for converting between json or toml and crimson ordered/order preserving types depending upon whether this flag is enabled.
But I think the problems associated with these features, and even their mere existence at least provides some motivation
for having an ordered preserving tree.

Argument against

It is kind of weird, and no other serialization languages I know of include any kind of order preserving tree.
Of those languages that don't include it, I know of zero complaints regarding it, If you need order preserving you probably just use an order preserving parser if not you don't.

This would make crimson -> json a non-injective surjective function where Tree and Map both correspond to json's Object,
however I believe that is already the case regarding Set.

version attribute

Since the syntax is in flux, it may be nice to consider an attribute like #![crimson(version = "0.0.1")] and a way to make such an attribute required, or optionally specified via the parser.

Making required version, would be good for cases like the testsuite where you control the input and implicitly know which version.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.