Giter Site home page Giter Site logo

compiler's Introduction

compiler's People

Contributors

kevinbarabash avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

compiler's Issues

template string support

String with regular template strings with interpolations. We can constrain the interpolations to only accept strings to start with and can figure out what to do about string coercion, .toString(), and Showables later.

spread args support

There are two sub-cases of this:

  • spreading a tuple (should work with variadic and non-variadic functions)
  • spreading an array (should only work with variadic functions)

Intersection types

This is mainly to support:

  • defining common properties across a discriminated union
  • function overloading

Type refinements

Using if statements to change the type of a variable within the then block, e.g.

x: number | undefined
let y = if (x != undefined) {
   x + 5;
} else {
   0;
}

We can shadow x within the then block by setting its type to number in the ctx.env for that block.

This should also work on deep refinements, e.g. if (x.y.z != undefined).

Infer TData and TVariables from `gql` tagged template literal

Given a GraphQL schema and a query/mutation defined using gql we should be able to infer the type of the response and variables (if any are required). Eventually, this could evolve in a plugin architecture for the type system. The key aspect is that the plugin is provide an inferred type based on a string. A more complicated plugin architecture would provide a way for it to also generate a set of constraints for any interpolated values. It could return these constraints in the form of a custom TFun for each call since the number of params would have to match the number of interpolated values.

Optional params

Optional params should be modelled as T | undefined. Need to update unifyFuncs() to look for optional params when deciding whether it's partial application or not.

Optional chaining

a?.b?.c should have the type typeof c | undefined if either a or b can be undefined.

varargs support

Only the last param can be varargs. Any args that are passed this way will be passed to the function as an array. inferFuncs will need to be updated to handle this. We also need a way to mark a param on TFun as variadic. We could introduce an ERest node for this (and then reuse it for object/array/tuple rest).

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.