dotnet / fsharp

The F# compiler, F# core library, F# language service, and F# tooling integration for Visual Studio
https://dotnet.microsoft.com/languages/fsharp
MIT License
3.82k stars 773 forks source link

Allow #ParsedHashDirectives to have argument types other than strings #17240

Closed KevinRansom closed 1 week ago

KevinRansom commented 1 month ago

ParsedHashDirectives can currently only have string arguments.

This means that the syntax for HashDirectives is constrained to having quoted string arguments.

This makes some of the Hash directive syntax a little clunky.

#time "on"
(* Do lots of stuff here *)
#time "off"

probably would be nicer and perhaps easier to get right first time like this

#time on
(* Do lots of stuff here *)
#time off

Similarly no warn requires numeric error numbers to be integers:

#nowarn "1234" "1235" "99"

Is probably better expressed as:

#nowarn 1234 1235 99
abelbraaksma commented 1 month ago

Hey @KevinRansom, since this is technically a language syntax change (and a welcome one at that), perhaps this should better go through the fslang-suggestions, don't you agree? It appears you already opened and then closed an issue there (see https://github.com/fsharp/fslang-suggestions/issues/1364).

Even if it's a slam dunk and trivial to implement, that way we won't miss it while working on the new F# spec documents, and it gets the proper exposure.

I don't mind creating a quick RFC for this (assuming it'll be approved).

EDIT: I've created a lang suggestion, see: https://github.com/fsharp/fslang-suggestions/issues/1368