fsharp icon indicating copy to clipboard operation
fsharp copied to clipboard

Support empty-bodied computation expressions

Open brianrourkeboll opened this issue 1 year ago • 6 comments

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.

brianrourkeboll avatar Jun 26 '24 16:06 brianrourkeboll

:heavy_exclamation_mark: Release notes required


:white_check_mark: Found changes and release notes in following paths:

Change path Release notes path Description
src/Compiler docs/release-notes/.FSharp.Compiler.Service/8.0.400.md
LanguageFeatures.fsi docs/release-notes/.Language/preview.md

github-actions[bot] avatar Jun 26 '24 16:06 github-actions[bot]

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.

vzarytovskii avatar Jun 26 '24 18:06 vzarytovskii

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.

brianrourkeboll avatar Jun 26 '24 18:06 brianrourkeboll

/azp run

psfinaki avatar Jun 27 '24 11:06 psfinaki

Azure Pipelines successfully started running 2 pipeline(s).

azure-pipelines[bot] avatar Jun 27 '24 11:06 azure-pipelines[bot]

Cool stuff! Hope to give it a review soon. Can be a nice and intuitive addition to the language.

psfinaki avatar Jun 27 '24 11:06 psfinaki