diku-dk / smlfut

Call Futhark programs from Standard ML
GNU General Public License v3.0
10 stars 1 forks source link

Create substructure "Opaque" that contains all the structures for opaque types. #4

Closed athas closed 1 year ago

athas commented 1 year ago

This is instead of having all the structures for opaque types immediately inside the top level structure. It is the difference between the Futhark type foo being called Futhark.Opaque.foo.t and Futhark.opaque_foo.t. In particular, it means the Futhark type name maps directly to a (structure) identifier in SML. In particular, this means you can actually follow the SML Basis Library naming scheme if you also pick your Futhark type names appropriately. The downside is a yet more nested module structure.

@kfl, Martin appointed you as having good SML taste. What do you think?

@shwestrick, you are also the target audience here. Do you think this is better?

shwestrick commented 1 year ago

It seems alright to me. For small projects I don't think it makes a big difference. But I can imagine, for a large project with lots of imported type definitions, separate structures could be important for organization.

Newcomers might prefer the flatter interface? In my experience, highly nested modules can cause people a bit of distress.

But, I'd say go for it. If there's ever an issue with this sort of thing in the future, a solution could be to make smlfut configurable, e.g., smlfut --flat-imports ... for a very simple, flat interface, and smlfut --structured-imports ... for the fancy well-structured interface.

athas commented 1 year ago

Now of course the question becomes whether something similar should be done for arrays...