Git Product home page Git Product logo

Comments (7)

leo-guinan avatar leo-guinan commented on May 3, 2024

It seems to me that a more logical way to write this would be to have a count that both templates would use. In the "dime" variant, the count is of dimes, whereas the "nickel" variant count would refer to nickels. I believe it is not allowed like that, since we don't know at compile time which delegate we would use, so any delegate would need to support all possible parameters.

from closure-templates.

nicks avatar nicks commented on May 3, 2024

it's a toy example, don't be silly.

all delegates do support all possible parameters. they just ignore some of those parameters. I shouldn't have to declare that I'm ignoring a parameter.

from closure-templates.

leo-guinan avatar leo-guinan commented on May 3, 2024

Of course it is a toy example, but it does not demonstrate any reason to desire that behavior. These templates are very strict about requiring parameters, and using the required parameters. It blows up at compile time if the required parameter is not there. If you have several options for templates to choose, how can soy decide whether or not the specific parameter is required? In my eyes, it is a bit like overloading methods in Java. In order to overload, it is necessary to match signatures exactly.

from closure-templates.

nicks avatar nicks commented on May 3, 2024

"It blows up at compile time if the required parameter is not there." - Just for the record, this is simply not true for deltemplates.

shrug, if the team feels that this warning adds value, that's fine. We've already forked our version of closure-templates to remove this warning.

from closure-templates.

leo-guinan avatar leo-guinan commented on May 3, 2024

Correct, sorry I did not explain my thinking very well on that. My point was that given the strictness of the regular template, keeping in line with that with the deltemplate makes sense.

Now, given that your team feels the warnings are extraneous, and have already disabled them, this starts to make sense. Perhaps it would be beneficial to define a strict mode, in which all of these are enforced, whereas if disabled, it wouldn't try to enforce all these rules. Thanks for that clarification.

from closure-templates.

Ubehebe avatar Ubehebe commented on May 3, 2024

@nicks This seems like a pretty reasonable change, and it seems unlikely to cause much (any?) breakage in our existing templates. Can you send a PR? (Looks like it's been a while since you merged Medium's fork.)

from closure-templates.

nicks avatar nicks commented on May 3, 2024

sure, i'll try to put a PR together soon.

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.