Giter Site home page Giter Site logo

Missing handler about mlogjs HOT 3 OPEN

hsaturn avatar hsaturn commented on May 25, 2024
Missing handler

from mlogjs.

Comments (3)

JeanJPNM avatar JeanJPNM commented on May 25, 2024

The compiler does know that javascript has classes, but it doesn't know what to do with them, so it throws an error.

The main problem with allowing "implicit" formatting is that the compiler can't trust the types of variables, except those that are constant, because you can cast a value to any and then cast it into some other type.

Besides that, I still need to figure out what to do about allowing mutable objects and allowing objects to be assigned to mutable variables (#212 is a possible solution, but it comes with its own drawbacks).

from mlogjs.

hsaturn avatar hsaturn commented on May 25, 2024

Ha, yes, the message is so clear. There is no handler for classes, I should have guess myself ! grr

Doesn't the compiler can trust variables or argument ' types when the type is declared

function foo(a : Point, b : Square)

You can close this issue after (if) you answer.

Thanks

from mlogjs.

JeanJPNM avatar JeanJPNM commented on May 25, 2024

Doesn't the compiler can trust variables or argument ' types when the type is declared

function foo(a : Point, b : Square)

The main reason for the compiler not trusting type annotations is typescript unsoundness, that allows you to perform type casts on variables that originally have incompatible types.

Another reason is that typescript uses structural typing, meaning that a value being compatible with a class does not necessarily imply that such value is an instance of that class.

from mlogjs.

Related Issues (20)

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.