-
Notifications
You must be signed in to change notification settings - Fork 0
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
Change the way destructuring works #17
Comments
It is this recurring issue with destructuring. I think we should solve this now once and for all. I believe everything is already in place in the compiler to make this a fairly quick and easy change. |
Generating this kind of code is not the problem. I think the only reason we held off is because we wanted to wait until fusion was ready, so that we can optiomize the |
We are putting this in now, so it is a good time to resolve this issue. |
I have a few things to remark that I feel we must consider in this case OperatorWe must decide on how the operator(s) themselves work. Either we have a universal index operator, such as In the former case we need some kind of mechanism for generating the index. In the latter the backend needs to recognize the special operator and handle it accordingly. Graph structureIf we implement this to be the general destructuring mechanism this means every operator only has one output port. Which certainly makes the graph easier. This could potentially also mean changes (simplification) for ALang. However some operators need the multiple ports, or at least @sertel said tail recursion needs it. Which means ExtensibilityWhat I would like very much about this is that it would make it much easier to implement other kinds of destructuring in the future, if we so desire. |
These are very good points, especially the aspects under "Operator", we need to discuss. With this in place, the backend becomes simpler (because an sf can have only a single output port) and I can remove some rather complicated code from the JVM integration and the ALang becomes simpler because we can even consider removing the I did not get the point with multiple output ports because what we describe here was meant to address only stateful functions. Operators are still dataflow operators and can have any number of input and output ports. I agree with the extensibility point too. We should iterate the first part to make sure, we have a clever design. Let me start: |
We (@sertel and me) propose/commit to the following road map: Necessary changes
Optional, later changes
|
@JustusAdam in class HasEnvExpr m =>
MonadRecordEnvExpr m
where
addEnvExpression :: EnvExpr m -> m HostExpr
default addEnvExpression :: ( MonadTrans t
, Monad n
, MonadRecordEnvExpr n
, t n ~ m
, EnvExpr m ~ EnvExpr n
) =>
EnvExpr m -> m HostExpr
addEnvExpression = lift . addEnvExpression Can we use this |
Just as a comment to be considered for this: In the new generic backend, an integer literal is part of almost every syntax for the languages that we target. |
I thought about this again and think that we should go with the proposal from @JustusAdam to introduce IntegerLiterals (and thereby Literals in general) into the compiler. These have to be propagated to the backend which then implements them. |
I think we addressed all the points in the above list and therefore I'm closing this issue. Please open separate ones for the tasks that may still be pending. |
Currently, the sequence
generates a stateful function with two output ports with ids 1 and 2.
But the new implementation requires sfns to only have output port(s) with id -1. So the above should be transformed into:
The text was updated successfully, but these errors were encountered: