Git Product home page Git Product logo

Comments (4)

dcodeIO avatar dcodeIO commented on September 23, 2024

Longs are meant to be immutable. For example, there is a cache for small integer values which is likely to become corrupted otherwise.

If you need something like that you should do this by using your own high/low values as a 32 bit integer, eventually putting that back into a new Long, but never assign something to Long#low/high.

from long.js.

jung-kim avatar jung-kim commented on September 23, 2024

Hmm... Totally missed Longs are meant to be immutable. I maybe have to come up with our own implementation of unsigned int64 "sequence id" that does ++.

p.s. Thanks for doing protobuf.js, long.js and bytebuffer.js. It made my life so much easier.

from long.js.

dcodeIO avatar dcodeIO commented on September 23, 2024

As this came up a couple of times recently, I tested out a couple of ideas in 59a3dbd but only ended up with https://github.com/dcodeIO/long.js/blob/master/src/long.js#L312

from long.js.

jung-kim avatar jung-kim commented on September 23, 2024

Surprise discovery was that that Long.js is immutable. That answered several questions and would have me taking different approach for this problem rather then opening this issue. If feel that if this is not in the documentation it should.

Also, thanks for the somewhat indirect solution but I don't think I should depends on this method as it may get deprecated, understandably.

from long.js.

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.