DEV Community

[Comment from a deleted post]
Collapse
 
shimmer profile image
Brian Berns • Edited

This is great idea for a first project in F#. Congrats for getting it to work. I have a bunch of comments, starting with:

The Tuples module needs the rec keyword, so the two contained types can reference each other.

This is a cool feature that I didn't know about, but do you really need it in this case? It looks to me like Vector doesn't depend on Point at all, but I could be missing something. In general, I think it's a good idea to avoid circular references in F# where at all possible. Sometimes it can be frustrating, but it usually leads to clearer, simpler code. In this case, for example, I think you would no longer need a top-level Tuples module at all.

Also, I'm curious about your decision to nest all your types as .T under the corresponding module. I've seen this before, but I don't really see the benefit now that you can define both type and module at the top level and give them the same name (e.g. type Vector and module Vector). That way the name of the type is just Vector instead of Vector.T.

I'll stop there for now. Again, nice work!