Giter Club home page Giter Club logo

Comments (2)

oubidar-Abderrahim avatar oubidar-Abderrahim commented on June 20, 2024

Thank you for reporting this, we'll take a look into it shortly.
Tracked internally on GR 50804

from graaljs.

iamstolis avatar iamstolis commented on June 20, 2024

Is there a way to keep the numeric wrapper class?

Not when you are invoking a Java method that takes Object. When you need a particular primitive type, I suggest you to invoke a (helper) Java method that takes a parameter of the desired type. I understand that this can be clumsy but it is the safe approach.

Some background: JavaScript has just one number type (ignoring bigint). This type corresponds to Java double. That's why graal-js works with the numbers as if they were doubles. It is using various types (like int) internally but that's an implementation detail. The good news is that the internals of graal-js support long in a limited way. So, it was not that difficult to ensure that long is not converted to a different numeric type eagerly (as it was done in your test-case). In other words, your long-based test-case should work with the mentioned change.

I understand that it would be nice to be able to pass other numeric types (byte, short, float) in the same way. Unfortunately, that would require larger and more risky changes within graal-js. So, we are not pursuing this direction (for now). We may revisit this decision if we see some other compelling use-cases.

from graaljs.

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.