New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modularity in tremor script and query #21
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
I like this RFC. It tackles a problem that clearly exists, and does it in a principled way. The whole spectrum of the problem is well devised, from the language-theoretic aspects around the tricky issue of allowing recursion, to the practical issues like In the interest of improving it even further, I provide some "C"s to the "RFC" below. Detailed CommentsOn the PreprocessorI dislike the way that the preprocessor is made part of "the specification" in this RFC. Using a preprocessor as a transparent way of adding modules to Tremor Script/Trickle is great. However, the specification of a In many cases, inlining a module is a great solution. On the other hand, I can envision situations where a different semantics would be desired. By the specification of this RFC, if a large (subtree of) module(s) is used from many scripts in the same Tremor deployment, the runtime has to duplicate all data pertaining to those modules, including
But it's likely that I'm missing some insight. Perhaps related to that, I don't fully get what is meant by
On side-effects in Tremor ScriptsThe RFC, including the statement
leaves open the possibility for side-effecting code in Tremor Script. In practice, only very constrained forms of side-effects exist in Tremor Script. I might be missing something, so to explain my reasoning: The RFC also states that
As mentioned, I don't even really consider these to be side-effects: from the perspective of the script they're just fancy On Partial FunctionsThe part of the RFC specifying "Matching Functions" states that
but also
Does the first quotation refer to On RecursionObviously, not allowing multiple recursion, limits the expressiveness. On the other hand, embedded Tremor scripts probably aren't the place to do a lot of tree-traversals anyway. I support the choice of limiting loops to only A minor "paper-cut" with the current approach of defining functions only when their definition On Terminating when Depth > RECURSION_LIMITThe hardcoded recursion depth feels like the roughest edge in the RFC. It is the only point where the pragmatism threatens the model. It's difficult to add backwards-compatible improvements later, when currently the language semantics boils down to "don't recurse too often, eh". Any theshold that's picked (at language-runtime-compile-time!) will be either too strict for simple recursive functions (say, a factorial), too loose to ensure good throughput with expensive recursive functions, or both. A function that works fine in a test environment might fail in production because the threshold there is lower, or even because the end-user-provided data gives rise to more recursive calls. What's perhaps missing in the RFC is an exposition on the rationale behind this design decision. In decreasing order of strictness, the goal could be
As far as I understand the RFC and its implementation, it currently targets the fifth option. (Is my assessment correct, and) does this behavior align with the expectations of your users? Summary of Comments
Thanks for the awesome work putting out this RFC and its implementation. |
Heya thank you so much for the feedback :) I'll go over it fully tomorrow just a quickly reply here:
Good point! we should probably point out that this is an implementation detail and not to be dependent on!
You are in luck you don't have to return your degree, this is confusing we need to rephrase that!
That's partially based on the implementation we picked but it has the upside that it naturally protects against multi-function recursion that would potentially break the enforced recursion limit and tail-call recursion only. It's a good point that it might feel unnatural to users, I think since both Darach and I have a good bit of erlang background this felt 'natural' to us. That all said this restriction does significantly simply the logic and code, it's a good question however if that's the right tradeoff and it at least should be discussed/spelled out in the RFC!
It is, we should make this at least configurable via a parameter to the runtime instead of hard coding it. An alternative would be a |
No description provided.