poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC] Changing the unit of an offset


From: Bruno Haible
Subject: Re: [RFC] Changing the unit of an offset
Date: Sat, 06 Feb 2021 17:01:45 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-197-generic; KDE/5.18.0; x86_64; ; )

Hi José,

> But that gives us a magnitude, not an offset.  It would of course be
> possible to write:
> 
>   (poke) (anoffset/#B)#B
>   16#B
> 
> But that is too cumbersome.
> 
> So, what about having some short convenient syntax to change the unit of
> an offset?
>
> Note we would need to variants.  One equivalent to
> 
>   (offset/#UNIT)#UNIT
> 
> And the other equivalent to
> 
>   (offset/^#UNIT)#UNIT
> 
> The first uses truncating division, the second ceiling division.
> 
> Anybody has any suggestion for the syntax?

First, note that it's more than "changing the unit", because — as you say —
it may lose some bits.

I therefore dislike an attribute-like syntax

    offset'floor_as(#UNIT)
and offset'ceil_as(#UNIT)

and instead prefer see a syntax like the one used for casts:

    offset floor_as #UNIT
and offset ceil_as #UNIT

or — if you can accommodate 3-character operators in the lexer —

    offset /_* #UNIT
and offset /^* UNIT

Note that the latter is confusing, because /* is not an operator.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]