fmease / lushui

The reference compiler of the Lushui programming language
Apache License 2.0
5 stars 0 forks source link

Opaque by default (aka abstract by default) #115

Open fmease opened 2 years ago

fmease commented 2 years ago

Make all bindings opaque (formerly abstract) by default. In case of data declarations, restrict access to constructors to the module the type is defined in. In case of function declarations, make the binding irreducible/neutral for type-level evaluation/normalization/computation. Make bindings transparent (the opposite of opaque) with the attribute @transparent (alternative name floating around: @open (but what would its antonym and its hypernym be?)). Nomenclature: Data type and function bindings are associated with a transparency: They are either opaque or transparent.

Intuitively, @public means making the type of a binding accessible to other modules and @public @transparent means making (the type and) the definition (constructors or expression) accessible to other modules.

Further, the type of @public bindings is not allowed to contain private bindings and the definition (the constructors or the expression) of @public @transparent bindings is not allowed to contain private or @public opaque bindings.

It should be an error to specify @transparent without @public (I think).

This is basically a copy of public in Idris (via):

Implementation Steps

Open questions