[M3devel] Oops, forgot to ask

Tony Hosking hosking at cs.purdue.edu
Wed Dec 16 22:31:00 CET 2009


On 16 Dec 2009, at 15:48, Peter Eiserloh wrote:

> Hi Gang,
> 
> 0 - CARDINALs are an integral type defined by the language
> spec to be from 0 (zero) to MAXINT (not MAXCARD).  Recently,
> a change was made to CM3 to extend the language it recognizes
> beyond the original language spec (SPWM3), now CM3 understands
> a LONGINT.  
> 
> Was there a corresponding LONGCARD defined?

No.  But you can write:

[0L..LAST(LONGINT)]

just as

CARDINAL=[0..LAST(INTEGER)]


> Can is use all 64-bits, or is it restricted to 63, like
> the CARDINAL is only 31-bits.

63 bits, since its underlying base type is LONGINT.

> 1 - How does one write a WIDECHAR literal?  Are WIDECHAR
> currently only 16-bits?  If so they are limited to only 
> the basic multilingual plane (BMP).  Unicode characters 
> are 20-bits, which is why encodings such as USC-32 exist.
> If a WIDECHAR is only 16-bits, are they encoded as UTF-16,
> which is a similar scheme to UTF-8?  If they are currently
> only 16-bits, are there plans to expand it to fully support 
> unicode character encodings?

I don't know...  ?  Probably should.

> 2 - Recently there was discussion about creating a new type, 
> that is halfway a REFANY, and halfway a value itself.  I 
> myself dislike unions, and fortran equivalences, and any 
> other aliasing techniques, but if the compiler supports it, 
> we should document it.
> 
> What was it finally called?
> How does one declare an item of this type?
> How does one use it?

There is no new type like this.  But, there is provision in the current implementation of the run-time system to ignore any reference value that has a low-bit set.  The only way to use it is to LOOPHOLE values with low-bit set into REFANY.  TYPECODE(r) for such tagged values returns what would be TYPECODE(REFANY) (but that expression is a compile-time error to write).  So, anyone wanting to compare the typecode must use RT0.RefanyTypecode.  The implications of all of this are that tagged REFANYs are implementation-dependent, and can only be used with the unsafe LOOPHOLE.  In other words, it is not part of the language definition.  And, the implementation may not support it in future...

> 
> 
> 
> 
> 
> +--------------------------------------------------------+
> | Peter P. Eiserloh                                      |
> +--------------------------------------------------------+
> 
> 
> 




More information about the M3devel mailing list