Skip to content

Conversation

@MangelMaxime
Copy link
Contributor

@MangelMaxime MangelMaxime commented Jan 22, 2025

Summary

Hello,

when reading the documentation for F# nullable I found the second snippet equivalent to the one above.

CleanShot 2025-01-22 at 10 19 28

This seems suspicious to me, so I am mostly opening this PR to trigger a discussion with the F# team to check if this is expected or not.

After experimenting with the code, I think the intended snippet is something like proposed in this PR:

open System
open FSharp.Linq

let nullableFloat = Nullable 10.0
let standardFloat = float nullableFloat

printfn $"value is %f{float standardFloat}"

Can someone from the F# team confirm or invalidate my suspicions?


Internal previews

📄 File 🔗 Preview link
docs/fsharp/language-reference/nullable-value-types.md docs/fsharp/language-reference/nullable-value-types

@dotnetrepoman dotnetrepoman bot added this to the January 2025 milestone Jan 22, 2025
@dotnet-policy-service dotnet-policy-service bot added dotnet-fsharp/svc community-contribution Indicates PR is created by someone from the .NET community. labels Jan 22, 2025
@T-Gro
Copy link
Member

T-Gro commented Jan 22, 2025

You are correct @MangelMaxime , this has been a copy-paste mistake in the docs most likely.
The second example should indeed use an operator like float to convert.

Copy link
Member

@BillWagner BillWagner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @MangelMaxime

This LGTM, and I'll :shipit: now.

@BillWagner BillWagner merged commit e17b19e into dotnet:main Jan 22, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Indicates PR is created by someone from the .NET community. dotnet-fsharp/svc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants