On Wed, Jul 16, 2014 at 6:31 PM, Sandro Magi <[email protected]> wrote:

> It seems such a facility would be needed anyway if the compiler will be
> able to produce different declarative layouts, ie. packed structures
> [1]. I think Ada has a decent approach here, with their clause syntax
> for declaring all sorts of type properties, including sizes, alignments,
> storage size, bit order, etc. [2]


The Ada approach does seem to be thoroughly thought out, though they made
some choices that don't appeal to me. The thing is: it's complicated to a
degree that has never seemed (to me) to be motivated.

Fortunately it's something that can be added later.


> It's sub-optimal in some ways though. Ideally, a language would permit
> declarative numeric ranges as in Ada, but to arbitrary precision and
> unboxed. Then the clause syntax would allow you to override the default
> storage and alignment properties for such unboxed fields. This would
> eliminate the unnecessary proliferation of primitive numeric types.
>

We actually played with something similar in BitC at one point, where we
had a whole bunch of field types. It leads to some interesting problems for
inference because of exponential search, but we didn't have a Nat kind at
the time. In the early spec, int32 was sugar for something like "signed
integral field 32", but we abandoned that pretty quickly. It made the
qualified types on integer literals explode.

shap
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to