zzarchive-VisualFSharpPowerTools
zzarchive-VisualFSharpPowerTools copied to clipboard
Open namespace/module and fully-qualified name?
Hey guys,
I noticed something lately.
Let's say User is defined in Namespace.ModuleB, and my cursor is located at $
module Namespace.ModuleA
let f (u: $User) = ()
Then I am suggested to add open ModuleB instead of open Namespace.ModuleB.
Shouldn't we prefer to use the fully qualified name by default, so as to avoid potential ambiguities?
Yes, fully qualified names seem better.
I don't recall why we use short names; maybe @vasily-kirichenko remembers the reason :-).
I do not remember either :) It seems to be the right thing though:
namespace My.Long.Name.Space.Here
module A = let foo x = x
module B =
open A
let x = foo 1
Do you think that the following is better?
namespace My.Long.Name.Space.Here
module A = let foo x = x
module B =
open My.Long.Name.Space.Here.A
let x = foo 1
Can we easily distinguish between 'top level modules' (1 module for the entire file) vs explicit modules like in your example?
I think using open A might be wrong in some cases if there are multiple A modules from different namespaces. But we don't yet see any bug related to this; so keeping short names is good because it is aesthetically pleasing.