Join Kit Eason for an in-depth discussion in this video Caller info, part of What's New in Visual Studio 2017 for F# For Developers.
- [Instructor] Our final section…in the Program Organization chapter of this course…is to do with CallerInfo.…We do need a little bit of code for this one,…and CallerInfo is a way of retrieving the line number…and source code file name…of something which has called some function.…Typically, that'll be a logging function…or something in a tool.…Here we're looking at some code…which firstly opens on line 5,…opens the System.Runtime.CompilerServices name space,…which is where we need to be for this.…
Then it's declaring a logger type,…and that logger type has a member on line 11,…and that member's called traceMessage,…and that takes an argument of message, which is a string,…which is the message we actually want to output.…But then an optional argument of line,…an optional argument is one that the caller…doesn't need to provide,…in fact, in this case, it won't provide it explicitly,…it'll be filled in for us,…that was a type of integer,…and a path, which is going to be filled in, again, for us,…of this source file where the line of code…
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