Git Product home page Git Product logo

js-slang's People

Contributors

bobbyzhouzijian avatar c-likethis123 avatar dependabot-preview[bot] avatar dependabot[bot] avatar geshuming avatar hcwong avatar j0 avatar jiachen247 avatar leowwb avatar martin-henz avatar maylim17 avatar meowzz95 avatar ning-y avatar openorclose avatar podocarp avatar remo5000 avatar richardson0694 avatar swampertx avatar thomastanck avatar urieltan avatar yyc avatar

Watchers

 avatar

js-slang's Issues

Allow lenient code in function declaration

Should we go ahead and do it?
Pros:

  • Closer to Source 1 specs
  • We learn how to extend type inference support to union types

Cons:

  • Harder to implement
  • Enforcing same types for every return statement helps to enforce correctness of programs

Inference for Blocks

Implement Type Inference for blocks:

  • Separate type environment for each block (Scoping)
  • Need to take note of functions as well.

Implement polymorphic type support for function declarations/applications

The following test cases shouldn't work:

// Should throw error at x === 1
function someFunction2(x) {
    if (x === 1) {
        return x;
    } else {
        return x;
    }
}
someFunction2(true);
// TODO: Implement polymorphic types for functions
// Type variables in function declarations are polymorphic
// function identity(x) {
//     return x;
// }
// identity(3);
// identity("string") + "string";

Infer Literals

Infer literals, such as

  • Numbers
  • Strings
  • Booleans
  • Undefined

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.