[M3devel] what to do about file sizes being 32bits?
Rodney M. Bates
rodney_bates at lcwb.coop
Fri Jan 8 02:37:39 CET 2010
Tony Hosking wrote:
> On 7 Jan 2010, at 06:22, Jay K wrote:
>
>> I'm working on this..
>> Attached is what I have so far.
>> Posix needs work.
>> Most code continues to not work for files >4GB on 32bit, but it is a
>> start.
>> It seems to me I shouldn't have o use VAL(i, LONGINT) to convert an
>> INTEGER to a LONGINT, as all INTEGER values fit.
>> Similarly I should be able to compare a LONGINT to 0 directly, instead
>> of 0L.
>
> Again, I discourage this as not in the spirit of the Modula-3 type
> system which abhors implicit casts.
>
Indeed, Modula-3 has no implicit casts at all. But it does have something
that sometimes accomplishes the same result in a way that is far simpler
to define and represents a higher level of abstraction, namely, the
concept of assignability. A value, e.g. 10, can be in the value set of
many types (INTEGER, many of its subranges, and now LONGINT and many if
its subranges too). If so, it can in certain carefully specified cases,
be assigned from one of these types to another, without any syntactically
explicit notation required of the programmer.
This represents the more abstract view that 10 is 10, as opposed to the
usual view that 10 sitting in a byte is not the same as 10 in a word.
Of course, at the machine level. they are not the same, but in Modula-3,
that is only a representation matter that the compiler must take care of,
not a high-level language matter that needs pages of rules to define.
It took me years to fully understand the implications of replacing implicit
type conversions by the assignability concept, but I now consider it one
of Modula-3's great ideas, even if it is a small thing.
More information about the M3devel
mailing list