Deterministic JS output and internal object representation #887
Replies: 4 comments
-
Because we rely on terraform for deployment (currently), it is a preferred DX (including operators experience) not see changes in areas that we haven't really changed when a running I would even claim that it is preferred DX to keep the format stable between all minor versions of wing compiler and sdk resources, and not just between two different executions with the same toolchain Because lambda functions is part of the terraform configuration, I would say that Important to note, that until we release a stable version, we are not backward compatible so we can continue to break both 1 and 2, but I agree it makes sense to build the toolchain that generates a deterministic output |
Beta Was this translation helpful? Give feedback.
-
What are the benefits of having different intermediate JS output on each compile? I feel like consistent JS output (1) may be a prereq for consistent terraform output (2) in many situations. |
Beta Was this translation helpful? Give feedback.
-
No objections at all. -- I think deterministic both is important and Good. |
Beta Was this translation helpful? Give feedback.
-
We're all for deterministic output, of course. This discussion is mainly about whether this means we will change the underlying implementation of Wing's Map type to be an ordered Map impl type. We decided it makes sense to do it and made that change in this PR. |
Beta Was this translation helpful? Give feedback.
-
I think most would agree on (2), but I suspect there is some disagreement on (1). If you agree with (2) but not (1), how can we guarantee (2) without (1)?
This thought came up as a result of usage of BTreeMap instead of HashMap in wingc as an easy way to get deterministly ordered stuff, because otherwise the order may change during each wingc invocation. I think this should be the default way to store things that we plan on iterating for JSification and we should rely on it.
I don't see this solely as a way to ensure snapshot tests pass, but rather as a nice way to guarantee both (1) and (2). Are there objections to this, and if so what are some alternatives?
Beta Was this translation helpful? Give feedback.
All reactions