I suggest we ...

allow use to not bind the expression to a name

In C#, one can use using(CreateSomeDisposable()) without binding the expression to a name.

Same construct in F# is not allowed, forcing a workaround such as

use __ = CreateSomeDisposable()

allow to make it like this:

use CreateSomeDisposable()

6 votes
Vote
Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
You have left! (?) (thinking…)
Gauthier Segay shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

1 comment

Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
Submitting...
  • lr commented  ·   ·  Flag as inappropriate

    In my opinion the bigger annoyance is that a use expression can't even be bound to _ (single underscore), so if I want to use multiple uses, I need to write something like

    use _1 = CreateSomeDisposable()
    use _2 = CreateSomeDisposable()

    If I could instead bind it to the wildcard character _, then I would be happy:
    use _ = CreateSomeDisposable()
    use _ = CreateSomeDisposable()

F# Language

Feedback and Knowledge Base