Replies: 1 comment
-
The problem with this solution is that the only problem this solves for end-user is to passing static data inside sub-components. This is already solved with ports and without the problem of losing the flexibility. Once we go this way we have a problem that if component defines some static field we cannot make it dynamic. "Low level" languages are too flexible in comparing to this |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The problem
There is a concept of
MetaMsg
passed intoruntime.FuncCall
atruntime
- this is the way to configure function instance that gives ability to make 2 important things:Const
so it can send it across receivers (this is critical feature)Add
that must be able to (e.g.) work with bothint
andfloat
(just like Go's+
operator) - without overloading we would have to haveAddInt
andAddFloat
(which is fine for many things but not builtin operators)The thing is - we don't have this
MetaMsg
(probably not the best name) at the source code level. That is - end-user (a programmer) have no idea there's some payloads passed down to runtime to make itconst
work. That is fine by itself but lead to more complicated design of a compiler. And the complexity lives in theirgen
layer.Current solution
When we use
Add<T>
orsomeConst -> someNode.port
in our components we rely on irgen to make some magic.For
Add
it must create anFuncCall
instance and pass"int"
or"float"
as a meta message inside (depending on what isT
). You heard this right sir, we have to convert type argument to runtime message which is a little crazy. It would be much better to convertsrc.Msg
toruntime.Msg
instead. If only there would be an option to do it this way...For
const
stuff situation not much better. We allow user to use references to const entities in the component's network just like it's a normal outport. Of course, it's not. There's no magic - runtime program must contain normal connections with normal ports. How do it? The answer is - more magic to the irgen!What we do is we create implicit
const
node withConst
runtime function and use const's value as aMetaMsg
! As a result - user thinks he magically sends constants across the network while under the hood that's a real node.We can do better
It's a good thing that user can do this. The problem is - complexity in irgen. More (probably) elegant design is to implement this via sugar.
The complexity arrises because or difference between two layers of abstraction. One does have concept of meta messages and other don't. While it's okay for abstractions to have different heigh levels, it's not cool to mix things in a way we did.
What if we introduce this concept of meta message at the source code level? The only problem is - what user should do with it?
This is how a program could look after de-sugaring (
pi
node was inserted in the source code, not irgen, irgen can be generated normally, without tricks):Of course it must be allowed for user to create exactly this program by hand, without using of sugar.
Note that we've added some syntax
{...}
here as a last part of node instantiation. Perhaps same (already implemented) syntax for DI could be somehow leveragedThen the question is how to do both DI and meta message passing at the same time.
This feature used by user
...
Beta Was this translation helpful? Give feedback.
All reactions