Reconsider both curried and tupled overloads on dsharp.add etc.
See original GitHub issueThis pattern of having both curried and tupled methods is not recommended F# design and will likely cause problems (I noticed it in strange doc generation). I think we will probably have to just choose one or another
static member add(a:Tensor, b:Tensor) = a.add(b)
static member add(b:Tensor) = fun (a:Tensor) -> a.add(b)
static member sub(a:Tensor, b:Tensor) = a.sub(b)
static member sub(b:Tensor) = fun (a:Tensor) -> a.sub(b)
static member mul(a:Tensor, b:Tensor) = a.mul(b)
static member mul(b:Tensor) = fun (a:Tensor) -> a.mul(b)
static member div(a:Tensor, b:Tensor) = a.div(b)
static member div(b:Tensor) = fun (a:Tensor) -> a.div(b)
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
F#: curried overload/tupled overload issue
The reason for the change is in the detailed release notes: Optimizations for Curried Methods. A curried member looks like this: type C()...
Read more >Dependently Typed Programming with Domain-Specific Logics
The central notion in logic is consequence—entailment from premises to conclusions—and two notions of conse- quence are necessary for ...
Read more >The Glorious Glasgow Haskell Compilation System User's ...
GHC has two main components: an interactive Haskell interpreter (also known as GHCi), described in Chapter 2, and a batch.
Read more >The Haskell School of Music - Computer Science
ample, it does not make much sense to add together two characters, so the expression 'a'+'b' is ill-typed. The best news is that...
Read more >Church Board WE FOUND DREAM HOME OF OUR
the local high school last rear, la back as a member of the regular teaching staff and has tba B squad freshmen and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Proposal from discussion with @gbaydin - make an explicit open to get the pipelined notation
There are multiple potential problems:
Order of arguments is confusing, e.g.
dsharp.sub x y
isy - x
notx - y
. That’s really very confusing to people, and there’s nothing to force currying to be used for this overload. It’s ok for the API author - they know what to do - but other people won’t get this.F# type inference and tooling is not really designed for APIs like this. I just don’t know if it will be that great. Certainly F# type inference just works much better if there are fewer overloads. Also will parameter help work? I don’t know.
2x the documentation
It might be fine for div/add/mul/… etc. with two arguments but get whacky with other things that have more arguments. What’s the general rule?
Intellisense will be more confusing to people. 2x the entries and they won’t know which to choose
The curried methods will look confusing to people in intellisense
If we add shape inference, then we have 2x the API surface area
Too many ways to do the same thing
Are user-defined binary operators also meant to follow this pattern?
Of these (1) is to me too severe to embrace this on anything non-commutative.
There’s commonly also a problem where things like this combine: a 2x multiplication of your API surface area becomes 4x then 8x… when combined with something else (like overloading on scalars).
Anyway I’d recommend against building this in for now for all the above reason. In your example just write the lambda
and separately advocate for solving this at the F# language level, e.g. via
_.x(args)
notation: