I haven't heard anyone against type inference. Not saying that it doesn't happen. Every place has it's weird "thing"...just haven't seen it personally.
I guess I'm saying that I don't think it was some kind of conspiracy or anything. I just think that there focus was/is elsewhere.
I have seen C# style guides that forbid var.
var example = new CustomClass();
and style guides the require it unless the code will actually break.To quote the GP:
> Not saying that it doesn't happen. Every place has its weird "thing"
var is an excellent way to reduce redundancy in an assignment expression; it helps avoid stuff like:
Dictionary<int, List<CustomClass>> dictionary = new Dictionary<int, List<CustomClass>>();Basically if I know what the type is by looking at that line of code, I will use var. If I don't, I won't.
People get by with dynamic types. Much better with structural types. You're having full nominal typing and using LHS declaration for documentation. Which if ever needed (typically you shouldn't), hovering over it gives you anyway.
EDIT: It turns out the parent and I agree 100%. Darn double negatives! :)
I personally start with min noise and add stuff (accessibility, explicit types, this, LINQ query syntax) based on the team.
The only hard standard is braces: I like terse but too often you then get massive unreadable blocks.
- It's very easy to hire / train C# developers. Finding someone with a decent amount of F# experience is much more rare, at least in my area.
- F# replaced C++ on the black sheep role from Microsoft languages list, usually missing from their documentation when they list available languages (.NET Native and .NET Core are two examples)
- Lack of GUI tooling forcing any desktop developer to use a mix of C#, VB.NET, C++/CX for the UI + F#, or load XAML files by hand via type providers
- It is easier to gain adaptation at the enterprise level with multi-paradigm languages and existing ones are getting good enough support for FP algorithms, even if it is not clean approach. I rather have this than no FP at all.
- Many enterprise developers and their managers are still quite vocal against type inference and LINQ in C#, VB.NET, let alone allow something like F# on their codebases
- Since F# got type providers, many presentations try to sell the language to C# devs based just on this feature, which doesn't matter at all for the typical ETL and CRUD enterprise applications