[M3devel] [M3commit] CVS Update: cm3

Jay K jay.krell at cornell.edu
Wed Jul 22 03:22:55 CEST 2009


Until the kernels, libc, X-Windows, etc. are written in Modula-3, or come with Modula-3 *.i3 files provided by their maintainers, or perhaps completely stop changing, or perhaps we drop support for all but one target, all of which I predict to be never, it behooves us /significantly/ to interoperate with them via C.
 
 
Otherwise you trade an impractical purist notion of using Modula-3 for portability and safety. The system is now tremendously more portable and safe with the replacement of a bunch of Modula-3 with far less portable clean safe C.
 
 
It is true there is an extra layer when things are done this way, sometimes even extra copying. But it is worth it. Heck, it makes things more debuggable too because C tends to be more debuggable by gdb.
 
 
Besides:
The compiler front end is written in Modula-3.
The garbage collector is written in Modula-3.
The NT386 backend is written in Modula-3, and we should adapt that to all x86 targets.
The compiler back-end is a //huge// piece of C (and M4, and Make, and Bourne shell...)
The untraced heap is implemented in C.
The "build scripts" are written in Bourne shell, Python, Cmd.
They interact with a server written in at least Perl and C.
 
 
You don't need the entire system to be in Modula-3 to prove that it is a "systems" language. You will never get there.
 
Yes, I know people write web servers in other languages, including that cm3ide is essentially a web server written in Modula-3, but still, you won't get there.
 
We should perhaps consider using the web server underpinnings of cm3ide to run modula3.elegosoft.com. Really. If it is close to already having the required functionality.
 
We can actually have a bit more Modula-3 and less C.
For example we could have our own untraced heap.
We could implement Cstring.i3 ourselves in Modula-3.
 
Besides all that, I've been using C a lot lately. I believe is far more tractable than most people think. Modula-3's safety and esp. its syntax get in my way. It isn't bad as, say, Java, but..
 
 
 - Jay


----------------------------------------
> From: hosking at cs.purdue.edu
> To: rcoleburn at scires.com
> Date: Tue, 21 Jul 2009 20:19:02 -0400
> CC: m3devel at elegosoft.com
> Subject: Re: [M3devel] [M3commit] CVS Update: cm3
>
> I generally agree, but in this case we are probably dependent on a
> large number of C header files on the various different targets.
> Jay's efforts have reduced the burned of cloning C header files into
> Modula-3 interfaces. It is a fine line to tread though, and I think
> it is important to resist gratuitous rewrites into C code. In this
> case, I haven't had the chance to look at the code for Term.m3 and
> understand what is being attempted.
>
>
> On 21 Jul 2009, at 17:53, Randy Coleburn wrote:
>
>> Jay:
>>
>> I guess this topic is just a pet peeve of mine.
>> We tout Modula-3 as a systems programming language and that it has
>> all these great features that make it superior to languages that
>> lack them, yet when we "don't practice what we preach" and use
>> another language it weakens the argument.
>>
>> IMO, using C instead of Modula-3 is kind of like saying that we love
>> baseball, but we have to use soccer to play baseball the right way.
>> It just doesn't add up.
>>
>> I think we should always use Modula-3 in developing and enhancing
>> the CM3 system.
>>
>> I must also disagree with you and state that for a TRUE Modula-3
>> fan, C is indeed "nasty."
>>
>> All that said, I haven't looked at the code in question here. I
>> simply commented on the idea of replacing M3 code with C code.
>>
>> Regards,
>> Randy
>>
>>>>> 7/21/2009 1:53 PM>>>
>> I might have left it able to be called safe. Honestly I look more for
>> human verifiable safety and correctness and it lacked those before and
>> now does not. If that coincides with machine verifable safety, great.
>> Either way you need C here for correctness and safety. It isn't
>> 'nasty'. Not using C here would be nasty. I think you have it
>> backwards. UNLESS the sizes and constants here are well known but
>> reading docs quickly I didn't see that. Unsafe does not imply not
>> portable.
>>
>> - Jay (phone)
>>
>> On Jul 21, 2009, at 9:03 AM, Tony Hosking 
>> wrote:
>>
>>> Hear, hear!
>>>
>>>
>>> Sent from my iPhone
>>>
>>> On Jul 21, 2009, at 11:17 AM, "Randy Coleburn"
>>> wrote:
>>>
>>>> Granted, I see that Term.m3 is an UNSAFE module, so that by
>>>> definition means it is not portable.
>>>> Why though do we want to replace it by nasty C code where non-
>>>> portable stuff can be easily hidden? This is Modula-3. Why not
>>>> fix the Modula-3 code so that it doesn't have to be UNSAFE? (My 2
>>>> cents.)
>>>> --Randy
>>>>
>>>>>>> Jay Krell 7/21/2009 11:55 AM>>>
>>>> CVSROOT:/usr/cvs
>>>> Changes by:jkrell at birch.09/07/21 11:55:36
>>>>
>>>> Added files:
>>>> cm3/caltech-parser/term/src/: TermC.c
>>>>
>>>> Log message:
>>>> initial copy of dangerous non portable Term.m3 to rewrite portably
>>>> and have it do nothing silently on Win32 which should suffice, or
>>>> if not, can probably be done better, specifically the MakeRaw
>>>> function
>>>>
>>>>
>>>
>>
>


More information about the M3devel mailing list