Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

could this be a F# 6 indexer bug?

Tags:

f#

let's consider this code:

type T =
    {
        a: int
    }    

let d =
    [
        "a", [{a = 0}; {a = 1}; {a = 2}]
        "b", [{a = 3}; {a = 4}; {a = 5}]
    ] |> Map

If I want to access the data with a = 0:

d.["a"].[0].a  <- works
d["a"].[0].a   <- now works with F#6
d["a"][0]      <- returns {a = 0}

but

d["a"][0].a    <- typecheck error This value is not a function and cannot be applied.

if I wrap the expression in parenthesis:

(d["a"][0]).a  <- it works

Is this expected, or could it be a F#6 parsing bug?

like image 566
Thomas Avatar asked Dec 27 '21 22:12

Thomas


People also ask

Can anything beat a F-22?

That was likely the case of the Fairey Swordfish pilots who sunk Germany's Bismarck, and it is likely the case of a French fighter pilot who has the bragging rights of being the only one in his squadron to successfully have “killed” an American F-22 Raptor stealth fighter – albeit in mock combat.

How many F-22 Raptors does the US have?

There are a total of 186 F-22s in the Air Force, 36 of which are Block 20s. If all retirements are authorized, the Raptor fleet will be reduced to 153 aircraft. Kendall said he doesn't expect any more F-22s to be retired until the NGAD is ready to take its place.

HOW MUCH IS F 35 fighter jet?

The first F-35A cost $221 million when it came off the production line in 2007. Since then, production quantities and know-how have increased, helping the price of the stealthy fifth-generation fighter fall to $79 million as it gained buyers.

What would happen if the F-14 Tomcat met the 5th generation fighter?

“What would likely happen is the pilot flying the 5th generation fighter would work in behind the F-14, leverage their stealth capabilities, and kill the Tomcat with a missile from far away. There is no cool dog fight or any sort of other engagement.

Is the F-14 Tomcat back in Top Gun 2022?

It might be 2022, but the star of new the movie Top Gun: Maverick, a sequel to the 1986 original Top Gun, seems to be once again the now very old F-14 Tomcat.

What kind of planes are in the movie F-14?

Sure, all of the film’s trailers show off the much newer and cooler F/A-18 Super Hornet, the SR-72 Blackbird, and even the Su-57 Felon from Russia (more on that in a second), but the old F-14 is back in a very big way.


Video Answer


1 Answers

In the end, this was done for compatibility reasons; see the reply by Don Syme:

https://github.com/dotnet/fsharp/issues/12549#event-5840475607

A request to allow this notation was posted and seems approved.

https://github.com/fsharp/fslang-suggestions/issues/1109

like image 200
Thomas Avatar answered Oct 09 '22 09:10

Thomas