Live data from Hacker News

A new F# compiler feature: graph-based type-checking

devblogs.microsoft.com

81–90 of 118 posts

Re: A new F# compiler feature: graph-based type-checking

#81

Earlier quoted context omitted.

I'm not talking about that JS output, I mean the F# itself. While I'm not the most familiar with F#, I've enjoyed other languages that transpile to JS a lot more. For whatever reason, F# to me looks surprisingly verbose in Fable, which is odd because it's pretty terse on the backend.

Oh, I see. You said "resulting code", that's why I thought otherwise.

My mistake!

Re: A new F# compiler feature: graph-based type-checking

#82

Earlier quoted context omitted.

Type providers are boss. Why doesn’t every language type system have this feature by now?!

Because they are pretty annoying to implement and most are quite fragile

Yep, implementing one (a solid one) is hardcore. But think about it. Building, say, an XML or SQL type provider is a big deal. Doing it right requires special talent, because you are essentially building a transpiler to seamlessly interface with F#.

But this is also it’s greatest strength. Having direct, type-safe access to structured data is truly awesome. What else compares? Certainly not conventional code gen.

Re: A new F# compiler feature: graph-based type-checking

#84

Earlier quoted context omitted.

Because they are pretty annoying to implement and most are quite fragile

Yep, implementing one (a solid one) is hardcore. But think about it. Building, say, an XML or SQL type provider is a big deal. Doing it right requires special talent, because you are essentially building a transpiler to seamlessly interface with F#. But this is also it’s greatest strength. Having direct, type-safe access to structured data is truly awesome. What else compares? Certainly not conventional code gen.

Oh, don't get me wrong: Type providers are absolutely fantastic. Just, they are such a complex beast, most implementations I used so far are pretty fragile, at best. But tbh, even a fragile one is surprisingly useful

Re: A new F# compiler feature: graph-based type-checking

#85

Earlier quoted context omitted.

In fairness it is rather terrifying :P personally I pull all necessary information into some form of version-controlled storage, and then have a test to assert that the remote information is consistent with the stored version. Life's too short to have nondeterministic builds.

yeah that's fair. That's what I landed on too, and would think anyone using it seriously would be doing the same. But the fact that you could extend the compiler to program your own code generation in F# itself is amazing. Comptime in Zig reminds me of this too. I'd have to think OCaml has something similar, but I'm not too familiar with it.

Java has this too with the Manifold[1] project. It’s mind blowing.

1. https://github.com/manifold-systems/manifold

Re: A new F# compiler feature: graph-based type-checking

#86

Earlier quoted context omitted.

No. > How do Source Generators compare with Type Providers in F#? > If you’re an F# programmer (or familiar with the language), then you might have heard of Type Providers. Source Generators were inspired in part by Type Providers, but there are several differences that make them distinct. The main difference is that Type Providers are a part of the F# language proper and emit types, properties, and methods in-memory…

I get that the mechanisms are different, but the end result is the same. Edit: sample here with a JSON template: https://github.com/CharlieDigital/dn7-source-generators

Ah, okay I thought that source generators had more limitations compared to F#. Turns out they can make arbitrary calls, including across a network, which previously I thought was only in the domain of type providers:

> For Schema.NET, we do a HTTP request to get the JSON we need to build

https://turnerj.com/blog/the-pain-points-of-csharp-source-ge...

Also phillipcarter says yes so I'll happily take his view over mine.

Re: A new F# compiler feature: graph-based type-checking

#87
It would be nice if I stopped needing to update the fsproj file for imports and hierarchy. If this could be dynamically built using a topological graph approach that would be a huge improvement. I don't use a heavy IDE so it's kinda tedious to need to update the fsproj file when i want to add a new file.

Re: A new F# compiler feature: graph-based type-checking

#88

Earlier quoted context omitted.

for console apps, F# sadly suffers from general .NET issues for console apps. Very large size (>150MB for a simple app) and at least 400-700msec startup time

My CLI is 180-185ms startup time, and about 10-20MB for a complex app (with a runtime dependency).

keyword: with a runtime dependency :)

For CLIs I much prefer self-contained build outputs which is quite huge when it comes to .NET unfortunately.

Re: A new F# compiler feature: graph-based type-checking

#89

It would be nice if I stopped needing to update the fsproj file for imports and hierarchy. If this could be dynamically built using a topological graph approach that would be a huge improvement. I don't use a heavy IDE so it's kinda tedious to need to update the fsproj file when i want to add a new file.

Personally I strongly prefer F#'s way, and I always enable it manually in C# by setting `` to `false`. It's so much easier to debug e.g. compiler deficiencies/bugs when you can just binary chop to find the file that's causing a problem, and the reason you can do this is the linear ordering of explicitly listed files. (In C# I generally just give up and hope that someone else will do it, because it takes so much longer; in F# it's trivial.)

What are you using as your development environment? Personally I don't find the overhead in Vim to be too onerous (`yypf"ci"NewFile.fs`), and even in Rider I routinely edit fsproj files manually. (I even create new projects mostly by hand.)

Re: A new F# compiler feature: graph-based type-checking

#90

Earlier quoted context omitted.

yeah that's fair. That's what I landed on too, and would think anyone using it seriously would be doing the same. But the fact that you could extend the compiler to program your own code generation in F# itself is amazing. Comptime in Zig reminds me of this too. I'd have to think OCaml has something similar, but I'm not too familiar with it.

Java has this too with the Manifold[1] project. It’s mind blowing. 1. https://github.com/manifold-systems/manifold

woah, I had no idea. That seems pretty cool
Post reply on HN