IronLanguages / dlr

Dynamic Language Runtime
Apache License 2.0
369 stars 84 forks source link

Is `ParamDictionaryAttribute` in the right namespace? #245

Open BCSharp opened 3 years ago

BCSharp commented 3 years ago

ParamDictionaryAttribute is declared in namespace Microsoft.Scripting. However the file in which this class is defined, is Src/Microsoft.Scripting/Runtime/ParamDictionaryAttribute.cs. All other attribute classes are defined in namespaces that match their location in the directory structure (although it is not true in a general case: Src/Microsoft.Scripting/Runtime contains a few other classes that are defined in Microsoft.Scripting).

Looking at other attributes, all of them but two are defined in Microsoft.Scripting.Runtime. It seems to me that ParamDictionaryAttribute conceptually belongs to the same group. And unlike some other "misplaced" types, it is used in many places, so for instance code that uses [ParamDictionary, NotNull] has to open two namespaces.

Should ParamDictionaryAttribute be moved to namespace Microsoft.Scripting.Runtime? Can it be done without causing a breaking change?

Or maybe the .cs file should be moved one directory up? Do we care?

And in general, what are the rules of matching namespaces to directories, if any?

slozier commented 3 years ago

I'm not aware of any mechanism that allows moving a type from one namespace to another without it being a breaking change (see .NET Core guidelines https://docs.microsoft.com/en-us/dotnet/core/compatibility/). Although we obviously don't need to be as strict as the BCL, I'm very reluctant to do this type of change to the DLR (whereas with ipy3 anything is fair game since it hasn't been released).

I would go with the standard .NET convention of matching the folder to the namespace. So that would mean moving it up one directory would be fine.