Join Kit Eason for an in-depth discussion in this video Byref Returns, part of What's New in Visual Studio 2017 for F# For Developers.
- [Instructor] Now let's take a quick look at ByRef Returns,…which is basically an interoperability feature…to let us catch up with C# seven,…and allow us to consume a particular type…that C# seven can then produce.…Unfortunately I can't demonstrate this to you for real,…simply because I haven't yet got a version…of Visual Studio 2017 that correctly supports solutions…that mix C# and F#.…So I'm simply going to steal…some online documentation to show you this.…So let's imagine a class that's called RefClass,…and the key lines where it says…return, ref, values,…brackets, I for index.…
So that's returning an element from an array,…but not actually the value simply appointed to that element,…which might be used with some circumstances.…And prior to F# 4.1, we couldn't have consumed that value.…Now we can.…The reason we've got a red squiggly here, by the way,…is because again, I'm in version of Visual Studio…that doesn't quite let me mix these project types.…That wouldn't happen in real use.…The point is that result is of type byref of int…
Kit Eason discusses the new value types that provide an opportunity for performance gains, the new result type which gives you access to the railway oriented programming style of error handling, and program organization and readability changes. Plus, he explores the evolution of tooling for F#, and explains how F# tooling has changed in Visual Studio 2017. To wrap up the course, he shares how you can contribute to the F# language and tooling by getting involved in the open-source community.
- Working with struct tuples
- Marking a record type as a struct value
- Marking a discriminated union as a struct type
- Using the fixed keyword to mark a value
- F# result type and associated functions
- Resolving potential naming clashes between modules and types
- Error message improvements
- The past and future of visual F# tooling in Visual Studio
- Reviewing F# tooling changes