Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

F# special quotes? (##)

Tags:

f#

quotations

I just ran across http://frankniemeyer.blogspot.com/2010/04/minimalistic-native-64-bit-array.html Which contains the line

(# "sizeof !0" type('T) : nativeint #)

I believe the technical phrase is "what the heck?" I have never in my (~8 months) of F# programming run across something even resembling that...

FSI tells me something about deprecated constructs, used only for F# libs...

And google with (# does uh...well, not much

Any direction in this?

like image 348
Snark Avatar asked May 04 '11 18:05

Snark


2 Answers

This is the notation for inline IL emission. It used to be a more prominent feature during F#'s earlier years, but has been deprecated. A gentleman named Brian from the F# team has indicated that it is currently used mainly to bootstrap the F# compiler, and that the team had intended to mark this construct as an error, not merely a warning.

See his post here for the full story.

like image 139
Ben Avatar answered Oct 08 '22 16:10

Ben


It's inline IL (intermediate language) code. This construct is used internally by the F# team to implement bits of the F# core library you just can't do any other way. This code will admit a warning saying it shouldn't be used any where other than the F# core libraries, so you probably don't have to worry about it too much as it should never appear in production code.

like image 36
Robert Avatar answered Oct 08 '22 16:10

Robert