News for hackers. Stuff that matters.
Re:New Features in C# 7.0 by dep_b on Thursday March 09, 2017 @08:46PM (#13835651)
One feature F# has that would be great is that you can declare primitives as a a type. So you won't mix up your kilometer floats with your miles floats. And kilometers divided by hours ends up being a km/h value.

The other one we'll never see: Non null references as a default, optionals as a special case.

Re:New Features in C# 7.0 by d--b on Friday March 10, 2017 @03:43AM (#13837218)
They specifically avoided that in the early days of designing the language. Typedefs, macros, meta-programmation, overloading operators like () or -> are common in C++ but lead many people to completely change the language. So much so that there are C++ codebases that cant be read by standard C++ developers. The C# guys avoided that pit. As a C# developer I can read any codebase and know what's happening. That's not so true in F# where people are prompt to create their own operators (like ||>) and types.
Re:New Features in C# 7.0 by oblio on Friday March 10, 2017 @06:11AM (#13837763)
Operators, I get, but what's wrong with creating your own types?
Re:New Features in C# 7.0 by profquail on Friday March 10, 2017 @06:49AM (#13837909)
The F# ||> operator is provided by the core library. Over-use of custom operators is something I always push back on in F# codebases; they can sometimes be useful in making code more expressive, but the downside is it makes the code significantly more difficult to comprehend until you're familiar with what each operator does. I prefer readability over concision, and even without the custom operators F# code is fairly terse.
Re:New Features in C# 7.0 by amenghra on Friday March 10, 2017 @01:12AM (#13836743)
In java world, there has been some discussion for something similar: https://jcp.org/en/jsr/detail?id=363
Re:New Features in C# 7.0 by macca321 on Friday March 10, 2017 @05:31AM (#13837626)
I'm hope it will come. In the meantime, you can always create a wrapper type, or use something like the ValueUtils nuget package.