-
Notifications
You must be signed in to change notification settings - Fork 24
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
feat(compiler): Abilities #731
Conversation
# Conflicts: # aqua-src/antithesis.aqua # parser/src/main/scala/aqua/parser/lexer/ValueToken.scala # parser/src/test/scala/aqua/parser/StructValueExprSpec.scala # semantics/src/main/scala/aqua/semantics/expr/ArrowTypeSem.scala # semantics/src/main/scala/aqua/semantics/expr/DataStructSem.scala # semantics/src/main/scala/aqua/semantics/expr/FieldTypeSem.scala # semantics/src/main/scala/aqua/semantics/expr/ScopeSem.scala # semantics/src/main/scala/aqua/semantics/rules/abilities/AbilitiesAlgebra.scala # semantics/src/main/scala/aqua/semantics/rules/abilities/AbilitiesInterpreter.scala # semantics/src/main/scala/aqua/semantics/rules/abilities/AbilitiesState.scala # semantics/src/main/scala/aqua/semantics/rules/locations/DummyLocationsInterpreter.scala # semantics/src/main/scala/aqua/semantics/rules/locations/LocationsState.scala # semantics/src/main/scala/aqua/semantics/rules/types/TypesAlgebra.scala # semantics/src/main/scala/aqua/semantics/rules/types/TypesInterpreter.scala # semantics/src/main/scala/aqua/semantics/rules/types/TypesState.scala
LNG-123 Introduce `scope` expression
On the early days of Fluence development, Aqua programs were very low-level, taking every service, every topology move as a first class citizen. Now we have Workers, Clients, CLI, builtins like Registry, Spells, and so on. It brings new requirements on the table:
This proposal provides one more approach to solve better composability, help organizing libraries and reusing emergent behaviors, and simplify developers live. Let's make two new top-level expressions, Example might look like the following:
|
# Conflicts: # model/inline/src/main/scala/aqua/model/inline/RawValueInliner.scala # model/inline/src/main/scala/aqua/model/inline/TagInliner.scala # model/inline/src/main/scala/aqua/model/inline/raw/CallArrowRawInliner.scala # semantics/src/main/scala/aqua/semantics/rules/ValuesAlgebra.scala
# Conflicts: # model/inline/src/main/scala/aqua/model/inline/ArrowInliner.scala
# Conflicts: # build.sbt # model/inline/src/main/scala/aqua/model/inline/TagInliner.scala # model/inline/src/main/scala/aqua/model/inline/raw/ApplyPropertiesRawInliner.scala # semantics/src/main/scala/aqua/semantics/rules/types/TypesInterpreter.scala
(ops, rets) = opsAndRets | ||
} yield SeqModel.wrap(ops.reverse: _*) -> rets.reverse | ||
) | ||
): State[S, (SeqModel.Tree, List[ValueModel], Map[String, ValueModel], Map[String, FuncArrow])] = |
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.
Please, add comment on what this function returns. Also I think it would be better to define a case class
for return type at this point.
Exports[S].exports.flatMap { oldExports => | ||
getOutsideStreamNames.flatMap { outsideDeclaredStreams => |
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.
nit:
(Exports[S].exports, getOutsideStreamNames).flatMapN { (oldExports, outsideDeclaredStreams) =>
(with import cats.syntax.apply
)
strInFunc2 <- SomeService.getStr(s) | ||
<- strInFunc, strInFunc2 | ||
|
||
func handleSecAb {SomeAb, SecondAb}() -> string, string, string, u32: |
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.
Is it possible to have several abilities of the same type passed to a single function?
strInFunc2 <- SomeService.getStr(s) | ||
<- strInFunc, strInFunc2 | ||
|
||
func handleSecAb {SomeAb, SecondAb}() -> string, string, string, u32: |
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.
Is it possible to pass an array of abilities?
model/inline/src/main/scala/aqua/model/inline/ArrowInliner.scala
Outdated
Show resolved
Hide resolved
model/inline/src/main/scala/aqua/model/inline/ArrowInliner.scala
Outdated
Show resolved
Hide resolved
model/inline/src/main/scala/aqua/model/inline/ArrowInliner.scala
Outdated
Show resolved
Hide resolved
model/inline/src/main/scala/aqua/model/inline/ArrowInliner.scala
Outdated
Show resolved
Hide resolved
model/inline/src/main/scala/aqua/model/inline/ArrowInliner.scala
Outdated
Show resolved
Hide resolved
model/inline/src/main/scala/aqua/model/inline/ArrowInliner.scala
Outdated
Show resolved
Hide resolved
model/inline/src/main/scala/aqua/model/inline/ArrowInliner.scala
Outdated
Show resolved
Hide resolved
@@ -136,25 +136,37 @@ object ArrowInliner extends Logging { | |||
arrowsToSave <- Arrows[S].pickArrows(returnedArrows) | |||
} yield { | |||
val (valsFromAbilities, arrowsFromAbilities) = returnedFromAbilities | |||
InlineResult(SeqModel.wrap(ops.reverse: _*), rets.reverse, valsFromAbilities, arrowsFromAbilities ++ arrowsToSave) | |||
InlineResult( | |||
SeqModel.wrap(ops.reverse: _*), |
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.
SeqModel.wrap(ops.reverse: _*), | |
SeqModel.wrap(ops.reverse), |
No description provided.