Git Product home page Git Product logo

Comments (4)

nicks avatar nicks commented on May 3, 2024

also, would you accept a patch to fix this?

from closure-templates.

lukesandberg avatar lukesandberg commented on May 3, 2024

We are evaluating the expression because it is part of our tree simplifying pass where we 'preevaluate' constant expressions

the runtime error is a bit weird, soy does most of its calculations on integers using java longs, but at various points we assert that it isn't 'too big' I believe the goal is all about server/client consistency. We don't want a server rendered template to give different results because it has higher precision integers (64 vs. 52 bits). imho it is a bit misguided, but I also didn't add these checks so i am not entirely sure about the motivation.

@Ubehebe any opinion on this?

from closure-templates.

lukesandberg avatar lukesandberg commented on May 3, 2024

ok, just took a quicker look at the specific code in question and there are additional bits of weirdness.

apparently soy only allows integer constants to be declared if they fit in 32 bits. as a work around you should be able to add a '.0' suffix to any one of those numbers and flip into double math.

imho we should probably just switch all soy integer math to use 'long's instead of ints. There are a few places where we need 'int's (like indexing into collections), but unchecked downcasts should be fine in those places.

from closure-templates.

nicks avatar nicks commented on May 3, 2024

fwiw, there's already an exception catch that tells the simplifier to back off and leave the expression alone.

I was going to suggest that we move the convertPrimitiveDataToExpr call into the exception block. That fixes the obvious problem without turning this into a referendum on how soy represents numbers, or on the whole SimplifyExpr enterprise.

from closure-templates.

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.