Support empty-bodied computation expressions
Description
- Add support for empty-bodied computation expressions.
- Language suggestion: https://github.com/fsharp/fslang-suggestions/issues/1232
- RFC FS-1144: https://github.com/fsharp/fslang-design/pull/774 (which see for more explanation of why this specific approach was taken)
- RFC discussion: https://github.com/fsharp/fslang-design/discussions/775
Examples
builder { }
seq { }
Checklist
- [x] Test cases added.
- [x] Release notes entry updated.
[!IMPORTANT] Shoutout to @edgarfgp @fabulous-dev for sponsoring my work on this.
:heavy_exclamation_mark: Release notes required
:white_check_mark: Found changes and release notes in following paths:
Change path Release notes path Description src/Compilerdocs/release-notes/.FSharp.Compiler.Service/8.0.400.md LanguageFeatures.fsidocs/release-notes/.Language/preview.md
Haven't reviewed it yet, but thinking out loud:
How would this play with resumable state machines. I assume it should be fine since it's just a transformation essentially.
And second, orthogonal comment - this feature will encourage more CE use, which my itself is not bad, but might lead to more nested CEs, which will involve more checking = being slower. We really need to do something with it. I made an attempt or two in the past, but change surface was bigger than I anticipated.
How would this play with resumable state machines. I assume it should be fine since it's just a transformation essentially.
That's a good call-out. I'll add some tests to make sure.
/azp run
Azure Pipelines successfully started running 2 pipeline(s).
Cool stuff! Hope to give it a review soon. Can be a nice and intuitive addition to the language.