3 ms·
I like having the linearity of definitions and files. It makes reading unfamiliar code bases much easier, as it means the code has a "beginning" and "end." To
by Nelkins 10y ago
I like having the linearity of definitions and files. It makes reading unfamiliar code bases much easier, as it means the code has a "beginning" and "end." To me it fits well with the F# theme of sensible defaults.
If you do need to get around it though, you can have mutually referential types in F# if you use the "and" keyword (although the definitions of the types have to be right next to one another). And in the next update to F# you'll be able to have mutually referential types and modules within the same file which is often good enough for most other things you might need that sort of thing for.[1]
[1] https://blogs.msdn.microsoft.com/dotnet/2016/07/25/a-peek-into-f-4-1/ https://blogs.msdn.microsoft.com/dotnet/2016/07/25/a-peek-in...
- johncolanduoni 10y agoI think the linearity can force you to streamline things, but personally I often have to resist the urge to bike-shed the order in which I write functions in the same file, let alone what order I want to put my files in. I end up being torn between different orders I would want in different situations, and would love a language or IDE that would let me view definitions in different orders depending on what I'm looking for.