FSharp.Data.SqlClient icon indicating copy to clipboard operation
FSharp.Data.SqlClient copied to clipboard

Question: Why is FSharp.Data.SqlClient.DesignTime implemented as a class

Open chinwobble opened this issue 6 years ago • 1 comments

I was wondering why FSharp.Data.SqlClient.DesignTime and friends are implemented as a class with a private constructor instead of simply being a module with let bound functions.

Wouldn't this be more terse?

// static class 
type DesignTime private() = 
  static member internal GetRecordType(columns: Column list, ?unitsOfMeasurePerSchema) =
  ...
// module 
module DesignType = 
  let internal GetRecordType(columns: Column list, ?unitsOfMeasurePerSchema) =
  ...

I was thinking its because the members can use each other?

chinwobble avatar Sep 22 '19 09:09 chinwobble

Not sure about original decision, but yes it seems calls to those static members happen in some of those.

Looking for DesignTime. in that file brings few calls although they are probably just top level calling lower level or utility functions, those same members are called in the provider themselves.

I haven't spent time trying to figure out if there are logical groups of functions that would be better grouped in a module, but if you have some good suggestions or a PR to review, please let us know.

smoothdeveloper avatar Sep 22 '19 10:09 smoothdeveloper