Giter VIP home page Giter VIP logo

Comments (5)

joeduffy avatar joeduffy commented on May 14, 2024

One thing that makes this more complicated is deciding precisely when to expand templates.

If we do it after parsing happens, then the YAML/JSON parsers will encounter syntax errors.

If we do it before parsing, on the other hand, we don't yet have type information about the stack's properties; as such, the context object's parameters will be weakly typed during the template's execution (a map[string]interface{} or somesuch). This seems messy.

Catch-22, kinda sorta. More thinking required ...

from pulumi.

joeduffy avatar joeduffy commented on May 14, 2024

After noodling on this more, I wonder whether templates are the right solution. The more I dig into the design/implementation, the more C++ deja vu I get, complete with all the problems known to afflict the preprocessor. (Clang's modules doc lays out many of them.) The challenge is that it's less obvious how JSON/YAML could be used in a more "module-like" way without devolving into template substitution, and without us basically reinventing our own templating system.

from pulumi.

joeduffy avatar joeduffy commented on May 14, 2024

For YAML, it's possible some combination of anchors (&), references (*), and associative array merges (<<) can do part of this. But this would be YAML-specific and obscure and still not as expressive as we may need (e.g., you can't do concatenation, call arbitrary functions, etc).

from pulumi.

joeduffy avatar joeduffy commented on May 14, 2024

Another thought on this. If we think about the metadata, there are actually two discrete sections:

  1. the true metadata about the name, description, properties, and so on;
  2. the blueprint for service construction.

As we consider the DSL extensions (#22), we would still consider 1 to be metadata (in a Mu.yaml file), while 2 would be taken from source code.

And this is the key insight. Perhaps templating should only be allowed within the service blueprint section (services) of the Mu.yaml file, just as "code execution" in the DSL sense is limited to the code we run to create the services. If we took that approach, we could do the templating in a sensible way, although it requires incremental parsing/semantic analysis of multiple artifacts.

from pulumi.

joeduffy avatar joeduffy commented on May 14, 2024

We've decided to move away from templating and instead use a real language approach. Therefore, this work item is obsolete. Closing.

from pulumi.

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.