News for hackers. Stuff that matters.
Re:Why F#? by shortrounddev2 on Tuesday April 01, 2025 @11:42AM (#43548150)
It's absolutely not exactly the same; let! is only available within a computation block. If you want to return some value from the computation block and return to Functional land without having to pause the thread you need to use a continuation, which C# has built in syntactic sugar for in async/await and F# does not.
Re:Why F#? by sparkie on Tuesday April 01, 2025 @12:02PM (#43548389)
`await` can only be used in an `async` function. How is that so different from `let!` only being available in a computation expression?
Re:Why F#? by shortrounddev2 on Tuesday April 01, 2025 @12:40PM (#43548847)
because an async function doesn't require you to change syntaxes to get them to work
Re:Why F#? by Smaug123 on Tuesday April 01, 2025 @02:55PM (#43550216)
It's actually sort of the other way round. C# has hardcoded syntax for async/await. F#'s syntax for async/await is a fully-general user-accessible mechanism.
Re:Why F#? by sparkie on Wednesday April 02, 2025 @03:26AM (#43554413)
They're not so different in that regard. C# `await` can be adapted by making an awaitable and awaiter type[1], which isn't to dissimilar to how a computation expression in F# needs to implement methods `Bind`, `Return`, `Yield`, etc.

In both languages these patterns make up for the absence of typeclasses to express things like a functor, applicative, monad, comonad, etc.

[1]https://ecma-international.org/wp-content/uploads/ECMA-334_7...

Re:Why F#? by xigoi on Tuesday April 01, 2025 @12:51PM (#43548964)
A computation block is the equivatent of an async function;