From: Chris M. Thomasson on
"BGB / cr88192" <cr88192(a)hotmail.com> wrote in message
news:hfibl2$ai8$1(a)news.albasani.net...
>
> "Pascal J. Bourguignon" <pjb(a)informatimago.com> wrote in message
> news:87skbnfs6r.fsf(a)galatea.local...
>> James Harris <james.harris.1(a)googlemail.com> writes:
>>
>>> On 5 Dec, 23:59, "Bill Cunningham" <nos...(a)nspam.invalid> wrote:
>>>
>>>> One reason why I am so attracted to C and not just markup languages
>>>> scripts and java is that C is for designing OS's. What exactley is it
>>>> about
>>>> C that makes it good to right operating systems?
>>>
>>> Most answers seem to focus on C's performance.
>>
>> Which I disqualified in my previous answers, for at least two reasons:
>>
>> - the processors are so much more powerful nowdays than when C was
>> invented.
>>
>
> and, this is, irrelevant...
>
> by this reasoning, data compression would also have no reason to exist
> anymore, since we have so much more RAM and HD space...
>
> just because there are more clock cycles does not mean programmers are
> free to needlessly waste them, as it does not take long before one finds
> themselves writing code where speed does actually matter...

Good point!

[...]

From: Pascal J. Bourguignon on
"Chris M. Thomasson" <no(a)spam.invalid> writes:

> Why do I like C:
>
> http://groups.google.com/group/comp.lang.c/browse_frm/thread/b11dafcbe1079934

In Common Lisp, you just use (declare (dynamic-extend <variable>)),
and the compiler implements this "region" allocation (or any other
similar scheme) automatically.

--
__Pascal Bourguignon__
From: Pascal J. Bourguignon on
"James" <no(a)spam.invalid> writes:

> "Pascal J. Bourguignon" <pjb(a)informatimago.com> wrote in message
> news:87ws0zfxgf.fsf(a)galatea.local...
>> "BGB / cr88192" <cr88192(a)hotmail.com> writes:
>>
>> [... basically that GC and big runtimes is a drag to system
>> programming ...]
>>
>> Have a look at Modula-3. This is a language specifically designed for
>> system programming and specifically including a garbage collector.
>
> Garbage collected bootloader and Kernel?

Well, if you really need to manage so much memory to write a bootloader, why not.

And for a kernel, you definitely need to manage memory, so a garbage
collector may indeed be quite useful.

> Can I really use Haskell or Modula-3 to create that? What about a
> garbage collected Kernel with exceptions that beats the heck out of
> a Kernel written in CO and assembly language? Is that possible?

Of course. In general, the quality of the kernels and systems written
in other languages than C is higher.

(Perhaps an interlude with "The Unix Haters Handbook"
http://simson.net/ref/ugh.pdf would be in order here ;-))


>> And for the run-times, I don't see the point of having to rewrite
>> printf in the kernel... If you don't have a run-time library, then
>> you will be re-implementing it yourself. (See Greenspun's Tenth Law).
>
> Are you saying that I can take an existing C runtime and use it in the
> Kernel as-is?

There may be some "implementation specific" differences, but for the
most part, yes.


> BTW, what language is the runtime for Haskell or Modula-3 generally
> written in?

Haskell or Modula-3.


> Can I write a high-performance JVM in Logo?

Yes. A typical example is Squeak. The virtual machine of Squeak is
implemented in Smalltalk, and it is so fast that multimedia
applications with 3D and sound are implemented on it (always in
Smalltalk).


--
__Pascal Bourguignon__
From: Pascal J. Bourguignon on
"BGB / cr88192" <cr88192(a)hotmail.com> writes:

>> That C is not better than high level programming languages for system
>> programming since it needs the same extensions to be effective.
>>
>
> not really, since most of these "extensions" are part of the core language
> by default, and so not seen as extensions by those using the language.
>
> for example, pointer arithmetic, ... is just another part of the job...

This is not a discriminating example. I've been doing pointer
arithmetic with languages such as Pascal or Common Lisp with no
problem.


>> There's no reason why the system should be programmed the C way. All
>> the niceties of high level languages are good for system programming
>> too, and shouldn't be disabled.
>>
>
> they would need to be disabled in order to be able to get the language to be
> able to bootstrap itself...

Bootstrapping a language has little in common with bootstrapping a
system or a run-time environment.


> for example, you can't use the GC before the GC is operational, and you
> can't use the GC for the code implementing the GC. this much is essentially
> a hard limit.

Actually, you can use a garbage collected heap before the garbage
collector is active. Allocation on garbage collected heaps is usually
much more simplier than with a non garbage collected heap, so you can
start allocating memory for a good amount of work (think that you've
got 4GB or RAM in low end CPUs nowadays) before starting to need the
garbage collector.

Two other points:

- the Common Lisp specification doesn't mandate garbage collection.
Garbage collection or memory management is just not mentionned by
the standard. If you need to have a sys:free function to free
memory managed without a garbage collector, you can have that in a
fully conformant Common Lisp implementation.

- most implementations who provide a garbage collector, also provide a
way to disable it (temporarily).



> such a restricted subset is then needed, and the system can switch to a more
> full-featured form only after bootstrapping...

It is trivial to write the code to generate the lower level code
needed to load a run-time environment.



> this would be analogous to how C usually requires a runtime library to be
> written before one can use the runtime library. granted, it can be noted
> that one can write pretty much the entire runtime library (apart from a few
> small pieces) in C.
>
> any language capable of doing similarly also needs to be able to do
> similarly.
>
>
> while this allows an implementation of a language designed for the task, it
> does not allow one not designed for this...
>
>
> for example, system programming in Java would be possible, but apart from a
> specialized compiler with a lot of extensions, one would need a fairly large
> amount of ASM (maybe 10-15 kloc?...) to be able to essentially bootstrap the
> language (such as the garbage collector, core language facilities, OO and
> Interface machinery, ...).

But this amount of "assembler" can be generated easily with a compiler
written in Java for the subset of Java needed to bootstrap the system,
like it is done in Squeak for Smalltalk.


> why is it then that, in such efforts, it is far more common to bootstrap
> Java via C?...

The only reason, is that we bootstrap always on POSIX (unix) systems
written in C, and that C is the designated portable assembler for
these systems. But this technical point is of no importance: the Java
system is till written in Java.


> granted, Java is a poor example of a non-C HLL, but FWIW, it is about the
> only one at present which poses that much of a threat...

"Threat"?


> nearly everything else has become marginal...

"Unpopular"?

Are we discussing popularity? I though we were on a technical newsgroup.



--
__Pascal Bourguignon__
From: James on
"Pascal J. Bourguignon" <pjb(a)informatimago.com> wrote in message
news:87k4wzf72o.fsf(a)galatea.local...
> "James" <no(a)spam.invalid> writes:
[...]


Thanks for the info.




>> Can I write a high-performance JVM in Logo?
>
> Yes.

Okay. But, I still can't quite see how a JVM written in Logo would out
perform, or even perform as good as, a JVM written in C++ and assembly
language. E.g., SUN's HotSpot JVM.


What am I missing?




> A typical example is Squeak. The virtual machine of Squeak is
> implemented in Smalltalk, and it is so fast that multimedia
> applications with 3D and sound are implemented on it (always in
> Smalltalk).

Is it good enough to create a modern FPS game? Something along the lines of
Crysis:

http://www.gametrailers.com/video/e3-09-crysis-2/50066