[m-dev.] Adding standard integer types

Paul Bone pbone at csse.unimelb.edu.au
Fri Sep 19 08:44:40 AEST 2008


On Fri, Sep 19, 2008 at 12:48:32AM +1000, Julien Fischer wrote:
> On Thu, 18 Sep 2008, Paul Bone wrote:
> >On Thu, Sep 18, 2008 at 11:04:19PM +1000, Julien Fischer wrote:
> >>
> >>int         word sized signed
> >
> >Is this the current 'int' type we already have.  Changes to it may break
> >things.
> 
> Yes, but I'm not proposing any changes to it.

Cool.

> >>
> >>For uints, literals would be as they are for the signed versions
> >>except that would have either `u' or`U' appended.  For the fixed size
> >>types something like the following might be used:
> >>
> >>	42s8	- signed 8-bit integer with decimal value 42
> >>	42U64	- unsigned 64-bit integer with decimal value 42
> >>	42S32	- signed 32-bit integer with decimal value 42
> >>
> >
> >Urgh, that's a little clumbsy,
> 
> It's less clumsy than not providing type-specific integer literals.
> Then you have to use type qualifiers to resolve ambiguities.  It
> has the additional advantage that literals that are out of range
> for a specific type can be caught during lexing rather than at
> a later stage.
> 
> >can we infer this information from how
> >the constant is used?
> 
> Hopefully.
> 
> >If we can infer it 95% of the time why not
> >require this markup in the remaining 5% only?
> 
> Sure, but you still need something to handle that 5%.  In a sense it
> shouldn't be that different to how C handles it.

This sounds good.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mercurylang.org/archives/developers/attachments/20080919/43adc43b/attachment.sig>


More information about the developers mailing list