I suggest we ...

Allow extension members in namespaces, without requiring an enclosing module

Now it's impossible to declare extension members directly in namespaces, except in the same file and namespace where the type is defined. Please consider eliminating that limitation of the language on the expression of developer's ideas. That limitation does not serve any reasonable purpose, I think. Nobody needs to create a module with [<AutoOpenAttribute>] to hold declarations of extension members only in order to circumvent that limitation of the language. I believe that if a developer needs to create an extension method for a type, he/she should be able to do it directly in any namespace of the application he/she is developing.

1 vote
Vote
Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
You have left! (?) (thinking…)
Alexei Odeychuk shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

2 comments

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

    Because of a considerable amount of technical detail, and because of how extension members are compiled, this is actually quite difficult. As a result I don't think we are going to make this change.

  • Alexei Odeychuk commented  ·   ·  Flag as inappropriate

    If such a wrapper module is needed for compilation reasons, let the compiler create such a module with [<AutoOpenAttribute>] automatically.

F# Language

Feedback and Knowledge Base