News for hackers. Stuff that matters.
Re:What's New in F# 4.1? [video] by alkonaut on Friday December 09, 2016 @04:21PM (#13141960)
Wait what, doing this as an alias

   type ProductId = ProductId of int
Meant it allocated an instance on the heap for it before 4.1? Wow.
Re:What's New in F# 4.1? [video] by edgyswingset on Friday December 09, 2016 @04:27PM (#13141998)
That isn't actually an alias. That is constructing a single-case discriminated union. DUs are compiled into classes and have a few things automatic equality.

Generally speaking, it's better to use Units of Measure[0] when you want some compile-time semantics around numeric literals, as these don't incur the performance penalty of creating a class.

[0]: https://docs.microsoft.com/en-us/dotnet/articles/fsharp/lang...

Re:What's New in F# 4.1? [video] by alkonaut on Friday December 09, 2016 @04:41PM (#13142092)
Yeah I realize there are more efficient aliases, but even so - just defaulting immutable data structures with only primitive types in them to cretae reference types feels like a massive foot gun performance wise. I couldn't imagine doing C# without value types, so for F# where things are usually more immutable, it has to be painful if e.g. a normal point(x,y) record is a class...
Re:What's New in F# 4.1? [video] by justneedvodka on Friday December 09, 2016 @07:04PM (#13143007)
You could use a struct, record, or tuple for a point. I've done all of these before.
Re:What's New in F# 4.1? [video] by alkonaut on Friday December 09, 2016 @07:29PM (#13143146)
Yes, and now they can be done right (as CLR structs)! It's just odd that this took until now.

I suppose it just shows that those of us that are using .NET to do "C++ work" (always CPU and GC bound, almost never IO bound) are pretty few...