Giter VIP home page Giter VIP logo

Comments (15)

caitp avatar caitp commented on March 29, 2024

es5 assignment ~= expression | 0 to force smi mode?

from angular.

vicb avatar vicb commented on March 29, 2024

"int" is not an ES6 type, right ?

from angular.

caitp avatar caitp commented on March 29, 2024

not in the language itself, but it can sometimes be useful to force the VM to treat a value as an integer

from angular.

vicb avatar vicb commented on March 29, 2024

What I meant is that "int" is not currently supported by traceur. Does the original issue imply adding "int" support to traceur also ?

from angular.

caitp avatar caitp commented on March 29, 2024

What exactly would traceur do to "support int"? it doesn't really exist as a concept/type in es6. You have these: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values

But under the hood of the VM it's a bit more complicated, so we may see advantages (sort of a microoptimization) if we say that declaring a type as an int will ensure that all assignments to it convert it to an SMI representation

from angular.

caitp avatar caitp commented on March 29, 2024

it's hard to say whether this would hurt more than it would help or not, but it could be interesting if we want to have typenames

from angular.

vicb avatar vicb commented on March 29, 2024

Section 6.1 right below your link:

The ECMAScript language types are Undefined, Null, Boolean, String, Symbol, Number, and Object

I think that Traceur could complain when the "assertTypes" option is enabled "x:int" would be interpreted as x is an instance of the class int.

from angular.

caitp avatar caitp commented on March 29, 2024

I mean there's no class, and implementing a class would probably be problematic/not that helpful. Asserting that a type is an int in traceur would probably look more like assert(typeof x === 'number' && (x % 1) === 0) --- which is certainly doable (node null % 1 does === 0, which isn't great). But ultimately I'm just not sure this assertion is super helpful in JS-land

from angular.

mhevery avatar mhevery commented on March 29, 2024

We should support int as number. We can assert that it is int by typeof x == number && x === Math.round(x) We very much need this.

from angular.

vicb avatar vicb commented on March 29, 2024

fixed

from angular.

tbosch avatar tbosch commented on March 29, 2024

@vicb With which commit?

from angular.

vicb avatar vicb commented on March 29, 2024

Apparently this was fixed in 3482fb1 (PR #49)

from angular.

tbosch avatar tbosch commented on March 29, 2024

The current solution is only a workaround and should be moved into rtts-assert. Also, the transpiler should be changed to automatically refer to assert.int so we don't need the import for int.

from angular.

vojtajina avatar vojtajina commented on March 29, 2024

Yes, we should put this into rtts_assert or Traceur runtime. I will take care of it.

from angular.

angular-automatic-lock-bot avatar angular-automatic-lock-bot commented on March 29, 2024

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

from angular.

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.