Closed Happypig375 closed 2 years ago
These alternate names come with a cost. To use them you need to know the F# names, and then at some point (reading .Net documentation, using non-language-specific .Net libraries, interop...) will need to learn the true names of the types, and either remember or else repeatedly look up the correspondence. I think they should only be used when there is an exceptionally large benefit that outweighs the cost. The name block
for ImmutableArray
is an example where the cost could be justified, where the type is likely to become ubiquitous and the name being replaced is much longer.
@charlesroddie But those names either already exist or will be added to FSharp.Core.
The broader point here is if we intentionally want to add more and more type abbreviations to F# for the sake of a more F#-friendly name or not. This obviously has a disadvantage because it requires you to understand the underlying type and that there's a mapping to it in the F# world. For things like int
and string
it's obvious enough because they're used everywhere, but the more specialized the construct the less easy that is. I think this is simple enough for .NET experts to manage, but I don't have a sense of how well a newcomer would handle several different kinds of type abbreviations.
Another point is that precedent matters, but just because something was done before doesn't mean it was a good idea. I could see a perfectly valid argument for type abbreviations beyond the primitives being a net-negative.
Lastly I do not think we should preemptively add an abbreviation for something in anticipation of "proper support" for that thing like task
and so on.
Some of these suggestions make a lot of sense because there's already precedent for the proposed name, where it's already somewhere else in the language, be it function names or active pattern names; namely, KeyValue
, dict
, readOnlyDict
. I think these have a stronger case than the other three (though I myself am not opposed to all of them).
Closing for the reasons described by @cartermp here: https://github.com/fsharp/fslang-suggestions/issues/980#issuecomment-779356059
Type abbreviations for types specially supported by F
I propose we add:
The existing way of approaching this problem in F# is to refer to them by their long names while wondering why e.g. type abbreviations like
exn
andLazy<'T>
exist but not the above that are also specially supported.Pros and Cons
The advantages of making this adjustment to F# are
The disadvantages of making this adjustment to F# are none.
Extra information
Estimated cost (XS, S, M, L, XL, XXL): XS
Related suggestions: (None)
Affidavit (please submit!)
Please tick this by placing a cross in the box:
Please tick all that apply:
For Readers
If you would like to see this issue implemented, please click the :+1: emoji on this issue. These counts are used to generally order the suggestions by engagement.