Handling call chains starting with a lambda call
See original GitHub issueWe need to make a decision on to handle something such as this:
with(Foo()) {
doFooStuff()
doMoreFooStuff()
}.also {
println("Wow")
println("Amaze")
}
Generally in call chains, we break before a dot, and in the case of a chain with lambdas code looks like this:
fooFoo
.callMethod {
doFooStuff()
doMoreFooStuff()
}
.also {
println("Wow")
println("Amaze")
}
There is an example a .
which is a when
expression:
when (f) {
...
}.exhaustive
A few options we have:
Option 1: dot right after }.
with(Foo()) {
doFooStuff()
doMoreFooStuff()
}.also {
println("Wow")
println("Amaze")
}
Problem: The chain keeps looking different than other types of chains
Option 2
Extra indentation to make it look like if we had a chained call
with(Foo()) {
doFooStuff()
doMoreFooStuff()
}
.also {
println("Wow")
println("Amaze")
}
Problem, might be weird to have the extra indentation
Option 3
Floating dot
with(Foo()) {
doFooStuff()
doMoreFooStuff()
}
.also {
println("Wow")
println("Amaze")
}
What option should we pursue? I have code doing option 2.
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (12 by maintainers)
Top Results From Across the Web
Chaining Together Lambdas: Exploring All the Different Ways ...
This post will walk through a few different methods to chain Lambdas together. ... Let's say you just want to call one Lambda...
Read more >Asynchronous invocation - AWS Lambda
When you invoke a Lambda function asynchronously, Lambda places the request in a queue and returns a success response without additional information.
Read more >Chaining Lambda Functions using the Serverless Framework
In this article I want to show how to chain AWS Lambda Functions which basically means calling a Lambda Function from another Lambda...
Read more >AWS Lambda chaining best practice - Stack Overflow
Lambda A should call lambda B and if no results, it will call lambda C, and then return whatever the results are to...
Read more >How to periodically call a Lambda function
Timing events. Serverless architectures are event-driven, things start processing when there is something that triggers them.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@JavierSegoviaCordoba - GitHub Discussions enabled
I prefer option 1 for the ones you presented.
But also, if it’s formatted differently, I’d go with option 3.
For example: