<html>
<head>
</head>
<body class='hmmessage'><div dir='ltr'>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style>
<div dir="ltr">I think go has untyped constants.<br>But I think Modula-3 constants (expressions) always have a type independent of their use.<br><br> - Jay<br><br><br><div><div id="SkyDrivePlaceholder"></div>> Date: Thu, 20 Dec 2012 13:08:08 -0500<br>> From: hendrik@topoi.pooq.com<br>> To: m3devel@elegosoft.com<br>> Subject: Re: [M3devel] BITSIZE on constants?<br>> <br>> On Thu, Dec 20, 2012 at 11:16:32AM -0600, Rodney M. Bates wrote:<br>> > <br>> > <br>> > On 12/19/2012 11:08 PM, Jay wrote:<br>> > >Eh? isn't bitsize(type) valid? It is in C and seems confroversy-free.<br>> > <br>> > BITSIZE(type) (and BYTESIZE and ADRSIZE) is indeed valid on a _type_ in<br>> > Modula-3. At the last paragraph of 2.6.13, it is defined as the size of a<br>> > _variable_ of that type. The whole idea is that a compiler should not be<br>> > obligated to store a constant in memory.<br>> > <br>> > Presumably, you know statically what the type of a CONST is, so can't you<br>> > just use BITSIZE(TypeOfConst)? If you later changed the constant<br>> > to a different type, it wouldn't self-adapt, but likely other places wouldn't<br>> > either, or maybe would, but not correctly for your program.<br>> <br>> Consider BITSIZE(-3). Doesn't it make a difference whether this -3 is <br>> to be considered as of type -3..0 or INTEGER, or even -3..-3? THis <br>> isn't inherent in the constant, and might on some implementations give <br>> BITSIZEs of 2, 64, or even 0, respectively, if meaningful. <br>> <br>> And if you were to change the language syntax so you'd always have to <br>> write something like (-3..0)(-3) to be explicit you'd end up writing <br>> everything you's write with BITSIZE(TypeOfConst) and more. What you <br>> might gain is a static check that the constant isn't out of bounds.<br>> <br>> -- hendrik<br></div></div>
</div></body>
</html>