veepee-oss / Vp.FSharp.Sql

Generic F# ADO Provider Wrapper
https://github.com/veepee-oss/Vp.FSharp.Sql
ISC License
35 stars 3 forks source link

Add support for tasks and breaking changes #26

Open natalie-o-perret opened 3 years ago

natalie-o-perret commented 3 years ago

Poor decision design of mine leading to inconsistent naming, what we should have instead:

Blocked by https://github.com/veepee-oss/Vp.FSharp.Sql/issues/25 => main feature of V2

akhansari commented 3 years ago

Opinionated: Since async is the first class feature and network calls should be asynchronous, I would say:

natalie-o-perret commented 3 years ago

Opinionated: Since async is the first class feature and network calls should be asynchronous, I would say:

  • blahblah: 'T -> Async<'U>
  • blahblahTask: 'T -> Task<'U>
  • blahblahSync: 'T -> 'U

The issue is that our solution at the moment is not consistent with the construction part, building functions such as:

akhansari commented 3 years ago

IMOH, I'm not a big fan of prefixes and suffixes like I was in C#. I could not associate them to types and instead see them as alternatives to main functions. For the sake of simplicity we can support only Async<>. Or since we usually don't mix them, we can use shadowing to switch from one to another. Like:

On the other hand, source functions are all Task<> and it's a bit ugly to do Task -> Async -> Task.

natalie-o-perret commented 3 years ago

Or since we usually don't mix them, we can use shadowing to switch from one to another. Like:

Point taken.

That being said I like the idea of providing Task support. Some people (a sizeable number, which I would be really keen to get my hands on it), in the F# community use Tasks as their day-to-day async driver.

It's one thing to be opinionated about pushing Async first, and it's another to support Tasks without polluting extra layers in stack traces.

natalie-o-perret commented 3 years ago

On the other hand, source functions are all Task<> and it's a bit ugly to do Task -> Async -> Task.

Absolutely, that was my point (i.e. stack traces).

The same can be said about synchronous calls => less pollution when you don't have to force Async.RunSynchronously and perf-wise it's still better than endlessly wrapping everything.

akhansari commented 3 years ago

Shadowing FTW (:

natalie-o-perret commented 3 years ago

Shadowing FTW (:

My mileage may drastically vary on that one.