Discussion:
Still think manual memory management is a good idea? Read this ...
(too old to reply)
Andrew Lentvorski
2007-11-11 18:47:52 UTC
Permalink
A guy went hunting for why Firefox sucks up so much memory, and this is
what he found:

http://www.pavlov.net/blog/archives/2007/11/memory_fragment.html

-a
Gabriel Sechan
2007-11-11 19:06:05 UTC
Permalink
----------------------------------------
Date: Sun, 11 Nov 2007 18:47:29 -0800
Subject: Still think manual memory management is a good idea? Read this ...
A guy went hunting for why Firefox sucks up so much memory, and this is
http://www.pavlov.net/blog/archives/2007/11/memory_fragment.html
This has nothing to do with manual vs automatic memory management. It has to do with cache coherency and fragmentation issues. Using garbage collection would result in no improvement, as the article explicitly states that the data is not leaked. The real problem is doing a rather braindead allocation method- always calling malloc to get a new block, rather than giving each data type a pool to allocate from. Decide on a max size for each cache, allocate it at startup, and allocate from the correct pool. You can even be truely evil and do it automagically by overriding the new keyword. There you do- no more out of control memory issues. When a single cache runs out of memory, you bump old stuff from it to free up memory. Only if that doesn't work do you malloc a bigger cache.

If anything, a Java style automatic memory management would be FAR worse- in C/C++, you can move to a less braindead method. In Java, the system new is all that exists, you're stuck with it.

Gabe
_________________________________________________________________
Climb to the top of the charts!? Play Star Shuffle:? the word scramble challenge with star power.
http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_oct
Chuck Esterbrook
2007-11-11 19:25:13 UTC
Permalink
Post by Gabriel Sechan
----------------------------------------
Date: Sun, 11 Nov 2007 18:47:29 -0800
Subject: Still think manual memory management is a good idea? Read this ...
A guy went hunting for why Firefox sucks up so much memory, and this is
http://www.pavlov.net/blog/archives/2007/11/memory_fragment.html
This has nothing to do with manual vs automatic memory management. It has to do with cache coherency and fragmentation issues. Using garbage collection would result in no improvement, as the article explicitly states that the data is not leaked. The real problem is doing a rather braindead allocation method- always calling malloc to get a new block, rather than giving each data type a pool to allocate from. Decide on a max size for each cache, allocate it at startup, and allocate from the correct pool. You can even be truely evil and do it automagically by overriding the new keyword. There you do- no more out of control memory issues. When a single cache runs out of memory, you bump old stuff from it to free up memory. Only if that doesn't work do you malloc a bigger cache.
If anything, a Java style automatic memory management would be FAR worse- in C/C++, you can move to a less braindead method. In Java, the system new is all that exists, you're stuck with it.
Don't you think the current generation of garbage collectors in Java
and .NET are already making various optimizations like dead pools,
generations, etc.?

With Java, .NET, Python, etc someone has already spent a lot of effort
figuring out how to make allocation quick and smart. With C and C++
you have to repeat this work...

In those really rare cases where that's required, okay. But most
desktop apps would be best done on a system with a modern garbage
collector. Throw in some CPU and memory profiling work by the
developer and after that, the chances that you need a custom allocator
get close to zero.

-Chuck
Gabriel Sechan
2007-11-11 19:44:32 UTC
Permalink
----------------------------------------
Date: Sun, 11 Nov 2007 19:24:46 -0800
Subject: Re: Still think manual memory management is a good idea? Read this ...
Post by Gabriel Sechan
----------------------------------------
Date: Sun, 11 Nov 2007 18:47:29 -0800
Subject: Still think manual memory management is a good idea? Read this ...
A guy went hunting for why Firefox sucks up so much memory, and this is
http://www.pavlov.net/blog/archives/2007/11/memory_fragment.html
This has nothing to do with manual vs automatic memory management. It has to do with cache coherency and fragmentation issues. Using garbage collection would result in no improvement, as the article explicitly states that the data is not leaked. The real problem is doing a rather braindead allocation method- always calling malloc to get a new block, rather than giving each data type a pool to allocate from. Decide on a max size for each cache, allocate it at startup, and allocate from the correct pool. You can even be truely evil and do it automagically by overriding the new keyword. There you do- no more out of control memory issues. When a single cache runs out of memory, you bump old stuff from it to free up memory. Only if that doesn't work do you malloc a bigger cache.
If anything, a Java style automatic memory management would be FAR worse- in C/C++, you can move to a less braindead method. In Java, the system new is all that exists, you're stuck with it.
Don't you think the current generation of garbage collectors in Java
and .NET are already making various optimizations like dead pools,
generations, etc.?
No. Or at least no more so than the default malloc does. Those kinds of optimizations only really work if you know the parameters to optimize for. And given the mailing lists for Java at work, about 60% are from people complaining about the memory allocation or garbage allocation being suboptimal. Usually the solution is to use a completely different garbage collector.

And for that matter, if .NET and Java have these optimizations, what makes you think malloc doesn't? Malloc is an interface, the implementation can be anything it wants.
In those really rare cases where that's required, okay. But most
desktop apps would be best done on a system with a modern garbage
collector. Throw in some CPU and memory profiling work by the
developer and after that, the chances that you need a custom allocator
get close to zero.
Disagree. First off performance isn't there. And performance still matter, until you buy my hardware. For a second, I find that thinking about memory allocation and such issues bring about better designed programs- usually my fist sign that a design is bad is that the memory ownership has become odd. And frankly, memory management is pretty dead fucking simple. I see no advantages to garbage collection, only negatives.

Gabe

_________________________________________________________________
Climb to the top of the charts!? Play Star Shuffle:? the word scramble challenge with star power.
http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_oct
Andrew Lentvorski
2007-11-11 20:24:08 UTC
Permalink
Post by Gabriel Sechan
No. Or at least no more so than the default malloc does. Those
kinds of optimizations only really work if you know the parameters to
optimize for. And given the mailing lists for Java at work, about
60% are from people complaining about the memory allocation or
garbage allocation being suboptimal. Usually the solution is to use
a completely different garbage collector.
References? Or are these internal-only lists.
Post by Gabriel Sechan
And for that matter, if .NET and Java have these optimizations,
Just for reference, they do have these optimizations. Malloc() does not.
Post by Gabriel Sechan
what makes you think malloc doesn't? Malloc is an interface, the
implementation can be anything it wants.
Because malloc() cannot introspect what it is allocating. The JVM and
the .Net virtual machine maintain statistics internally as to allocation
patterns and lifetime duration.
Post by Gabriel Sechan
Disagree. First off performance isn't there. And performance still
matter, until you buy my hardware.
A) You would rather blow the performance of multiple megabytes of memory
than run an occasional mark-and-sweep or even an incremental collect
(bounded delay).

B) You have made this assertion before, and you *still* have no data to
back up your assertion. Worse, you are willing to throw away large
chunks of memory to get this "theoretical" performance without any data
as to how much performance that lack of memory throws onto the floor.
Post by Gabriel Sechan
For a second, I find that
thinking about memory allocation and such issues bring about better
designed programs- usually my fist sign that a design is bad is that
the memory ownership has become odd.
I don't necessarily disagree.
Post by Gabriel Sechan
And frankly, memory management
is pretty dead fucking simple.
If so, I'm sure that the Firefox guys would love the help.

-a
Darren New
2007-11-11 21:40:49 UTC
Permalink
Post by Andrew Lentvorski
Post by Gabriel Sechan
what makes you think malloc doesn't? Malloc is an interface, the
implementation can be anything it wants.
Because malloc() cannot introspect what it is allocating. The JVM and
the .Net virtual machine maintain statistics internally as to allocation
patterns and lifetime duration.
Plus, malloc() isn't allowed to notice three 4K blocks, each with 100
bytes in the middle used, and move them all to the same 4K block and
free up the other two.
Post by Andrew Lentvorski
Post by Gabriel Sechan
Disagree. First off performance isn't there. And performance still
matter, until you buy my hardware.
B) You have made this assertion before, and you *still* have no data to
back up your assertion. Worse, you are willing to throw away large
chunks of memory to get this "theoretical" performance without any data
as to how much performance that lack of memory throws onto the floor.
Plus, there's plenty of research that shows garbage collection is often
*faster* than malloc and free, even when it's "conservative", meaning it
doesn't move things around and doesn't track pointers (i.e., that you
could make it a drop-in replacement in C or C++).
--
Darren New / San Diego, CA, USA (PST)
Remember the good old days, when we
used to complain about cryptography
being export-restricted?
Chuck Esterbrook
2007-11-11 20:35:30 UTC
Permalink
Post by Gabriel Sechan
Post by Chuck Esterbrook
Don't you think the current generation of garbage collectors in Java
and .NET are already making various optimizations like dead pools,
generations, etc.?
No. Or at least no more so than the default malloc does. Those kinds of optimizations only really work if you know the parameters to optimize for. And given the mailing lists for Java at work, about 60% are from people complaining about the memory allocation or garbage allocation being suboptimal. Usually the solution is to use a completely different garbage collector.
How can the default malloc have optimizations like generational
garbage collection? That doesn't make sense.

Maybe Java does have problems in this area. I'm more familiar with
.NET and Python.
Post by Gabriel Sechan
And for that matter, if .NET and Java have these optimizations, what makes you think malloc doesn't? Malloc is an interface, the implementation can be anything it wants.
Based on your comments, I don't think you're familiar with garbage
collection and/or malloc.
Post by Gabriel Sechan
Disagree. First off performance isn't there. And performance still matter, until you buy my hardware. For a second, I find that thinking about memory allocation and such issues bring about better designed programs- usually my fist sign that a design is bad is that the memory ownership has become odd. And frankly, memory management is pretty dead fucking simple. I see no advantages to garbage collection, only negatives.
No advantages at all? Memory management is "pretty dead fucking simple"?

I don't know where to begin...

-Chuck
Tracy R Reed
2007-11-11 21:28:17 UTC
Permalink
Post by Gabriel Sechan
And frankly, memory management is pretty dead fucking simple.
If it were so simple so many programmers wouldn't be screwing it up. Q.E.D.
Post by Gabriel Sechan
I see no advantages to garbage collection, only negatives.
Says the C programmer who worries about the decreasing value of his
skills...
--
Tracy R Reed Read my blog at http://ultraviolet.org
Key fingerprint = D4A8 4860 535C ABF8 BA97 25A6 F4F2 1829 9615 02AD
Non-GPG signed mail gets read only if I can find it among the spam.
Andrew Lentvorski
2007-11-11 22:29:31 UTC
Permalink
Post by Tracy R Reed
Post by Gabriel Sechan
And frankly, memory management is pretty dead fucking simple.
If it were so simple so many programmers wouldn't be screwing it up. Q.E.D.
Post by Gabriel Sechan
I see no advantages to garbage collection, only negatives.
Says the C programmer who worries about the decreasing value of his
skills...
To be fair, this kind of stuff really isn't a threat to C people. You
still do need C in embedded, although I'm staring at Lua a lot lately (I
wish the Scheme folks would do as good a job as the Lua folks at C
integration).

It's the C++ folks who should feel the threat. C++ really needs to die
at this point.

-a
Paul G. Allen
2007-11-12 00:02:56 UTC
Permalink
Post by Andrew Lentvorski
It's the C++ folks who should feel the threat. C++ really needs to die
at this point.
I killed it in my world years ago. :)

PGA
--
Paul G. Allen
Owner, Sr. Engineer
Random Logic Consulting Services
www.randomlogic.com
Christopher Smith
2007-11-12 00:08:17 UTC
Permalink
Post by Andrew Lentvorski
It's the C++ folks who should feel the threat. C++ really needs to
die at this point.
Yes, they should be really threatened by all the other languages that
have been used to implement full featured browsers. Languages like......
Okay, maybe they aren't so worried. ;-)

--Chris
Andrew Lentvorski
2007-11-12 01:44:30 UTC
Permalink
Post by Christopher Smith
Post by Andrew Lentvorski
It's the C++ folks who should feel the threat. C++ really needs to
die at this point.
Yes, they should be really threatened by all the other languages that
have been used to implement full featured browsers. Languages like......
Okay, maybe they aren't so worried. ;-)
Yet businesses who are running much larger codebases seem to be all Java
based. Gee, I wonder why ....

Or maybe, that means we should use a language like C++ for really large,
complicated systems like ... say ... operating systems? Hmmmm, no that
doesn't seem to quite fit either since no large operating system has
been written in C++.

Don't confuse arguments of merit vs. arguments of inertia.

Every current browser that I can think of has a code base that stems
from a time when the only really commercially used languages were Cobol,
FORTRAN, C, C++, Lisp, and Ada. When you then factor in the price of
language compilers other than GNU C/C++ back in the 1988-1994 timeframe,
you have a whopping codebase built around machine assumptions and
economic conditions that haven't held for almost 20 years.

Of course, since C++ doesn't even play well between different compilers,
it's no surprise that those who use C++ are trapped with it.

-a
Christopher Smith
2007-11-12 03:20:43 UTC
Permalink
Post by Andrew Lentvorski
Post by Christopher Smith
Post by Andrew Lentvorski
It's the C++ folks who should feel the threat. C++ really needs to
die at this point.
Yes, they should be really threatened by all the other languages that
have been used to implement full featured browsers. Languages like......
Okay, maybe they aren't so worried. ;-)
Yet businesses who are running much larger codebases seem to be all
Java based. Gee, I wonder why ....
You of course would be referring to business like Google, Adobe, Yahoo,
Microsoft, Symantec,..... ;-)
Post by Andrew Lentvorski
Or maybe, that means we should use a language like C++ for really
large, complicated systems like ... say ... operating systems? Hmmmm,
no that doesn't seem to quite fit either since no large operating
system has been written in C++.
I guess that depends on how you define "large" and "operating system"
(one might claim Linux is written in C, but KDE sure accounts for a lot
of the code ;-), but certainly there are a number of operating systems
primarily written in C++, and they have been high quality
implementations with comparable capabilities to their C breathren.
Post by Andrew Lentvorski
Don't confuse arguments of merit vs. arguments of inertia.
Oh, trust me, I wouldn't.
Post by Andrew Lentvorski
Every current browser that I can think of has a code base that stems
from a time when the only really commercially used languages were
Cobol, FORTRAN, C, C++, Lisp, and Ada. When you then factor in the
price of language compilers other than GNU C/C++ back in the 1988-1994
timeframe, you have a whopping codebase built around machine
assumptions and economic conditions that haven't held for almost 20
years.
Yes, unfortunately back then you could only get free fortran, LISP, and
Ada implementations, so I guess that the only reason we haven't seen the
great Cobol browser is because it wasn't available for free.

There were lots of programming languages one could aspire to write a
browser in back in that era. Heck, before Java took over the scene
everyone was trying to be the "alternative to C++". Certainly, there
were also quality implementations of Objective-C available for free. You
could get Digitalk Smalltalk for $100. Visual Basic was available at
competitive prices. Perl was free. Free versions of Haskell and ML
existed (in the case of ML, even decent ones were available). I don't
recall a free version of Eiffel, but there was Sather. Pascal and Object
Pascal were available (Borland's Delphi showed up right when Java did,
IIRC). Oberon-2 was available. Implementations of Modula-2 and -3 were
available. Python was available. Ruby was too, but I don't think anybody
outside of Japan had heard of it yet (but that wouldn't stop the
Japanese with coming up with a browser). There were several free
implementations of LISP/CLOS and Scheme available (and in the case of
Scheme, you could pretty much build your own in the course of a week),
not to mention some reasonably priced LISP/CLOS implementations. You
could find free versions of Simula and it's descendant: BETA. Sure,
there are better implementations of a lot of these available at lower
costs today (well, those that survived the Java onslaught at least), but
the same is true of C++.

In fact, browsers were written in many of the languages I mentioned, and
they all tended to suck compared to Netscape or even second tier browers
like Mosaic, IE, and Cello. There was a reason the Netscape folks chose
C++ from all the language choices they had back then.

In truth, modern browsers are built on codebases that were largely
rewritten from scratch in the late 90's, so there was a chance for a new
language champion to emerge. Furthermore, the codebases of older
browsers were so small that it didn't take much effort to reach feature
parity of them (indeed, there was an old Dilbert comic strip that
jokingly made reference to the notion that typing randomly at your
computer for a few days would produce a functional web browser).

Java in particular has no real excuse beyond language limitations. The
HotJava browser was written in 1994 and released in 1995 (oh, and Java
was available for free in 1995 too). It was briefly successful due to
its unique support for Applets, but rapidly lost favour once other
browsers obtained the capability. Sun made various attempts to
revitalize the project, and never drew much interest. At the same time
that the Mozilla code base was open source, Netscape open sourced
"Jazilla", their own in-house Java-based browser effort.

While having most modern browsers implemented in C++ doesn't prove much
of anything in terms of its superiority, it does prove much with regards
to arguments about its inferiority. If other languages were so obviously
better than it, surely we wouldn't all be using C++ browsers, e-mail
clients, word processors, spreadsheets, etc. Surely the huge technical
disadvantage you suggest would ensure that developers would come up with
better solutions in other languages, or never think to choose C++ for
their projects to begin with.
Post by Andrew Lentvorski
Of course, since C++ doesn't even play well between different
compilers, it's no surprise that those who use C++ are trapped with it.
I grow tired of this silly statement that you raise again and again.
Heck, most Java implementations are built from the same reference code
base, they have a massive conformance test for branding, and yet you
still run in to problems between the different versions (and the ones
that are from unique codebases are even more problematic). Heck even
Java compilers, despite largely being glorified parsers, run in to
problems (I still recall Sun simply refusing to fix a bug in their VM
back in 2000 on the grounds that the byte code sequence in question
would never be produced by *their* compiler). I've seen first hand the
problems that spring from different implementations in C, Smalltalk,
LISP, ML, Haskell and even Perl back in the early days of the
ActiveState fork (and they had the advantage of full access to the
original version). I'd argue that having such issues is actually a sign
of a language maturing to the point where multiple competing
implementations exist. Eventually, with additional maturity, those
issues begin to diminish (as they have with C++).

--Chris
Chuck Esterbrook
2007-11-12 03:51:10 UTC
Permalink
Post by Christopher Smith
Post by Andrew Lentvorski
Post by Christopher Smith
Post by Andrew Lentvorski
It's the C++ folks who should feel the threat. C++ really needs to
die at this point.
Yes, they should be really threatened by all the other languages that
have been used to implement full featured browsers. Languages like......
Okay, maybe they aren't so worried. ;-)
Yet businesses who are running much larger codebases seem to be all
Java based. Gee, I wonder why ....
You of course would be referring to business like Google, Adobe, Yahoo,
Microsoft, Symantec,..... ;-)
Google does, in fact, run quite a bit of Java and Python (and C++). I
believe Amazon is mostly Java.

Yahoo started their mail application in Python for rapid development
and, after it matured, reimplemented it in C++ for performance. Sadly,
too many languages gravitate towards easy/slow or annoying/fast.
Post by Christopher Smith
There were lots of programming languages one could aspire to write a
browser in back in that era. Heck, before Java took over the scene
everyone was trying to be the "alternative to C++". Certainly, there
were also quality implementations of Objective-C available for free. You
Well, but they *did* write a browser in Objective-C:
http://www.omnigroup.com/applications/omniweb/

It was originally for NeXT and now for Mac. Of course, since it runs
only on Macs and is not the default browser there, it will never be
popular. But please don't say no one ever wrote a fully professional
web browser in anything but C++ or C. That's not true.

You might say it's hardly used, but see below for why that doesn't matter.
Post by Christopher Smith
In fact, browsers were written in many of the languages I mentioned, and
they all tended to suck compared to Netscape or even second tier browers
like Mosaic, IE, and Cello. There was a reason the Netscape folks chose
C++ from all the language choices they had back then.
And popularity was one of them.

And cross platform was another. With some work, you can get C++ to run
on Windows and Unix. Back then that wasn't the case with, for example,
Delphi.
Post by Christopher Smith
In truth, modern browsers are built on codebases that were largely
rewritten from scratch in the late 90's, so there was a chance for a new
language champion to emerge. Furthermore, the codebases of older
browsers were so small that it didn't take much effort to reach feature
parity of them (indeed, there was an old Dilbert comic strip that
jokingly made reference to the notion that typing randomly at your
computer for a few days would produce a functional web browser).
That last statement is false. Don't you remember the *huge* gap in
time between releases of Netscape Navigator when they rewrote it?
There was an article by one of the original developers of the project
about how the decision to rewrite was one of the contributors to IE's
rise and Navigator's fall. Even back in the 90s a capable browser was
a major project.
Post by Christopher Smith
Java in particular has no real excuse beyond language limitations. The
HotJava browser was written in 1994 and released in 1995 (oh, and Java
was available for free in 1995 too). It was briefly successful due to
its unique support for Applets, but rapidly lost favour once other
browsers obtained the capability. Sun made various attempts to
revitalize the project, and never drew much interest. At the same time
that the Mozilla code base was open source, Netscape open sourced
"Jazilla", their own in-house Java-based browser effort.
Yeah well, I'm not really a Java fan. Sun had severe quality issues
from the beginning and I ditched Java early on for Python.
Post by Christopher Smith
While having most modern browsers implemented in C++ doesn't prove much
of anything in terms of its superiority, it does prove much with regards
to arguments about its inferiority. If other languages were so obviously
better than it, surely we wouldn't all be using C++ browsers, e-mail
clients, word processors, spreadsheets, etc. Surely the huge technical
disadvantage you suggest would ensure that developers would come up with
better solutions in other languages, or never think to choose C++ for
their projects to begin with.
I don't agree with this either. NeXT was the best operating system
back in its heyday, but even when they ported it to the PC it never
became popular.

Objective-C has been a better language than C++ this whole time, but
it's not the most popular.

Delphi was better than VB6, but not as popular.

McDonald's is more popular than Boston Market and always will be. But
which you prefer to eat at?

Popularity has never meant a product or service was not inferior. My
observation over the years is that by the time a product has risen to
the #1 popularity spot, enough time has usually passed for people to
come up with something much, much better. At which point the #1
product begins to feel inferior.
Post by Christopher Smith
Post by Andrew Lentvorski
Of course, since C++ doesn't even play well between different
compilers, it's no surprise that those who use C++ are trapped with it.
I grow tired of this silly statement that you raise again and again.
Heck, most Java implementations are built from the same reference code
base, they have a massive conformance test for branding, and yet you
still run in to problems between the different versions (and the ones
that are from unique codebases are even more problematic). Heck even
Java compilers, despite largely being glorified parsers, run in to
problems (I still recall Sun simply refusing to fix a bug in their VM
back in 2000 on the grounds that the byte code sequence in question
would never be produced by *their* compiler). I've seen first hand the
Ah, more evidence that Java does, in fact, suck. I remember when their
library methods were stubbed out with no implementation, but the docs
wouldn't tell you which ones.


-Chuck
Gabriel Sechan
2007-11-12 09:33:17 UTC
Permalink
----------------------------------------
Date: Mon, 12 Nov 2007 03:50:38 -0800
Subject: Re: Still think manual memory management is a good idea? Read this ...
Google does, in fact, run quite a bit of Java and Python (and C++). I
believe Amazon is mostly Java.
I work at Amazon. There's a large amount of Java, but an equally large amount of C++. And pretty much everyone thinking of converting has already done so, the Java isn't really growing. A few other languages running about too- teams are allowed to use whatever they want, although encouraged to make it C++, Java, or perl for maintainability reasons.

Gabe


_________________________________________________________________
Boo!?Scare away worms, viruses and so much more! Try Windows Live OneCare!
http://onecare.live.com/standard/en-us/purchase/trial.aspx?s_cid=wl_hotmailnews
Christopher Smith
2007-11-12 11:07:47 UTC
Permalink
Post by Chuck Esterbrook
Post by Christopher Smith
Post by Andrew Lentvorski
Post by Christopher Smith
Post by Andrew Lentvorski
It's the C++ folks who should feel the threat. C++ really needs to
die at this point.
Yes, they should be really threatened by all the other languages that
have been used to implement full featured browsers. Languages like......
Okay, maybe they aren't so worried. ;-)
Yet businesses who are running much larger codebases seem to be all
Java based. Gee, I wonder why ....
You of course would be referring to business like Google, Adobe, Yahoo,
Microsoft, Symantec,..... ;-)
Google does, in fact, run quite a bit of Java and Python (and C++). I
believe Amazon is mostly Java.
Yahoo started their mail application in Python for rapid development
and, after it matured, reimplemented it in C++ for performance. Sadly,
too many languages gravitate towards easy/slow or annoying/fast.
I work at Google, I used to work at Yahoo, and I know a bunch of people
who worked at Amazon. There is a *lot* of C++ in 'dem 'dar hills. Sure,
they use other languages, as one would hope/expect. The point being,
they all seem to find significant utility in *also* using C++ for a very
significant chunk of their development (indeed most of their most key,
proprietary code is implemented in C++).
Post by Chuck Esterbrook
Post by Christopher Smith
There were lots of programming languages one could aspire to write a
browser in back in that era. Heck, before Java took over the scene
everyone was trying to be the "alternative to C++". Certainly, there
were also quality implementations of Objective-C available for free. You
http://www.omnigroup.com/applications/omniweb/
I love almost everything the Omni guys do. That said, last I used that
thing it had trouble with all kinds of websites. Has it come along since
then?
Post by Chuck Esterbrook
It was originally for NeXT and now for Mac. Of course, since it runs
only on Macs and is not the default browser there, it will never be
popular. But please don't say no one ever wrote a fully professional
web browser in anything but C++ or C. That's not true.
I dunno if I ever consider any browser "professional", but I'll assume
you mean by that the same as I do when I say "full featured".
Post by Chuck Esterbrook
You might say it's hardly used, but see below for why that doesn't matter.
No need. I agree that popularity of an application is far from a
relevant criteria. If there are functional problems with the
implementation that impact its popularity, that's a different story.
Post by Chuck Esterbrook
Post by Christopher Smith
In fact, browsers were written in many of the languages I mentioned, and
they all tended to suck compared to Netscape or even second tier browers
like Mosaic, IE, and Cello. There was a reason the Netscape folks chose
C++ from all the language choices they had back then.
And popularity was one of them.
Popularity of a programming language comes from somewhere. If C++ is
really that horrible and unworkable, people wouldn't use it for
projects. Sure, it is far from perfect, but it seems to fall in to the
"good enough" category more often than not.
Post by Chuck Esterbrook
And cross platform was another. With some work, you can get C++ to run
on Windows and Unix. Back then that wasn't the case with, for example,
Delphi.
Hey, cross platform is an entirely valid and fantastic feature of a
language. Indeed, it is what makes putting up with all those annoying
differences between implementations worth it. ;-)
Post by Chuck Esterbrook
Post by Christopher Smith
In truth, modern browsers are built on codebases that were largely
rewritten from scratch in the late 90's, so there was a chance for a new
language champion to emerge. Furthermore, the codebases of older
browsers were so small that it didn't take much effort to reach feature
parity of them (indeed, there was an old Dilbert comic strip that
jokingly made reference to the notion that typing randomly at your
computer for a few days would produce a functional web browser).
That last statement is false. Don't you remember the *huge* gap in
time between releases of Netscape Navigator when they rewrote it?
Yeah, they did the rewrite in 1998. The original post was referring to
those fantastic initial browsers developed by 1994 providing some
overwhelming advantage to browser projects inheriting that codebase. I'm
sorry, but I wrote a browser back then with a college roommate, and it
just wasn't that hard. Hell, the timeline between when Netscape was
founded and Netscape 0.9 was released was 6 months (admittedly, they had
people working on it who'd written a browser before, but there is no
reason why you couldn't have the same kind of people developing a
browser in a different programming language) and it was already better
than the others! There was so little code to put in to a browser the 2.0
version added a *mail client* for goodness sake!

But your mention of the huge Mozilla rewrite is exactly my point. They
ended up keeping basically zero code from the original code base, so it
was effectively rewritten from scratch in 1998. They, or someone else,
*could* have implemented a browser in some other language at that point,
and been at no additional disadvantage compared to the Mozilla project
(and presumably would have an advantage since they had a significantly
better programming language to work with). Despite this, Mozilla ended
up being the #2 browser out there, and probably one of the best working
ones. All of the ones that I think of even coming close to it are also
written in C++: IE, Opera, and KHTML-based browsers.
Post by Chuck Esterbrook
Post by Christopher Smith
Java in particular has no real excuse beyond language limitations. The
HotJava browser was written in 1994 and released in 1995 (oh, and Java
was available for free in 1995 too). It was briefly successful due to
its unique support for Applets, but rapidly lost favour once other
browsers obtained the capability. Sun made various attempts to
revitalize the project, and never drew much interest. At the same time
that the Mozilla code base was open source, Netscape open sourced
"Jazilla", their own in-house Java-based browser effort.
Yeah well, I'm not really a Java fan. Sun had severe quality issues
from the beginning and I ditched Java early on for Python.
But it's like C++ with automatic memory management.... so surely it
would at least be better than C++ for almost any project, right? ;-)
Post by Chuck Esterbrook
Post by Christopher Smith
While having most modern browsers implemented in C++ doesn't prove much
of anything in terms of its superiority, it does prove much with regards
to arguments about its inferiority. If other languages were so obviously
better than it, surely we wouldn't all be using C++ browsers, e-mail
clients, word processors, spreadsheets, etc. Surely the huge technical
disadvantage you suggest would ensure that developers would come up with
better solutions in other languages, or never think to choose C++ for
their projects to begin with.
I don't agree with this either. NeXT was the best operating system
back in its heyday, but even when they ported it to the PC it never
became popular.
Objective-C has been a better language than C++ this whole time, but
it's not the most popular.
Again, I'm not arguing that C++ is the best language. Far from it. I'm
merely suggesting that it isn't quite so completely useless. It is
popular to trash it largely because it is so widely used. Sure other
languages are better (indeed, because of C++'s popularity, it nearly
impossible for a language that is worse than C++ to survive as anything
but a niche or legacy language), but they clearly aren't overwhelmingly so.

- --Chris
Andrew Lentvorski
2007-11-12 13:12:26 UTC
Permalink
Post by Christopher Smith
Popularity of a programming language comes from somewhere. If C++ is
really that horrible and unworkable, people wouldn't use it for
projects. Sure, it is far from perfect, but it seems to fall in to the
"good enough" category more often than not.
So was Cobol. That doesn't mean it wasn't painful. ;)

The question I would ask is: "What gets chosen when business constraints
are weaker?"

Take a look at the current crop of revision control systems. Git (C and
shell scripts), Bazaar and Mercurial (Python), darcs (Haskell). Games
seem to be moving to more and more Lua and Python while only the
graphics core stays in C/C++. For web stuff, C++ is completely at the
bottom (you would think that something so popular would have spawned an
interpreted version rather than completely new languages, no?).
Post by Christopher Smith
Yeah, they did the rewrite in 1998. The original post was referring to
those fantastic initial browsers developed by 1994 providing some
overwhelming advantage to browser projects inheriting that codebase.
At no point did I claim overwhelming advantage. However, the fact that
it's already *in* C++ is certainly going to change the discussion from
"Should we use Java/Python/Perl/Lisp/etc?" to "Should we really change
from C++?" It changes the dynamics from "go with the flow and avoid
blame" to "take the blame if something goes wrong (and it always does)."

Inertia is powerful.
Post by Christopher Smith
I'm sorry, but I wrote a browser back then with a college roommate, and it
just wasn't that hard. Hell, the timeline between when Netscape was
founded and Netscape 0.9 was released was 6 months (admittedly, they had
people working on it who'd written a browser before, but there is no
reason why you couldn't have the same kind of people developing a
browser in a different programming language) and it was already better
than the others! There was so little code to put in to a browser the 2.0
version added a *mail client* for goodness sake!
jwz would like a word with you ...
Post by Christopher Smith
But your mention of the huge Mozilla rewrite is exactly my point. They
ended up keeping basically zero code from the original code base, so it
was effectively rewritten from scratch in 1998.
No, it wasn't. They pulled out major subsystems and wrote them from
scratch. This means that the new subsystems had to fit into where the
old subsystems sat.

Inertia, again ...
Post by Christopher Smith
and been at no additional disadvantage compared to the Mozilla project
(and presumably would have an advantage since they had a significantly
better programming language to work with). Despite this, Mozilla ended
up being the #2 browser out there, and probably one of the best working
ones. All of the ones that I think of even coming close to it are also
written in C++: IE, Opera, and KHTML-based browsers.
Microsoft wasn't going to use Java if hell froze over, so the only
options were C++ or Visual Basic. Opera targets small systems so is
stuck on C/C++. The KDE guys are "Give me Qt or give me death!" zealots
so nothing other than C++ will do.
Post by Christopher Smith
But it's like C++ with automatic memory management.... so surely it
would at least be better than C++ for almost any project, right? ;-)
Pretty much.

However, it seems that anyone enlightened enough to see the advantage of
Java over C++ is also enlightened enough to see the advantage of
Tcl/Perl/Python/etc. over Java.
Post by Christopher Smith
Again, I'm not arguing that C++ is the best language. Far from it. I'm
merely suggesting that it isn't quite so completely useless. It is
popular to trash it largely because it is so widely used.
Actually, Java has that mantle now.
Post by Christopher Smith
Sure other
languages are better (indeed, because of C++'s popularity, it nearly
impossible for a language that is worse than C++ to survive as anything
but a niche or legacy language), but they clearly aren't overwhelmingly so.
And there we disagree. The combination of context-sensitive grammar,
non-managed environment and static compilation really are major misfeatures.

Even worse, nobody seems really interested in correcting them. There's
no particular reason a C/C++ implementation couldn't gain those things.
However, anybody who would be motivated to do so seems to realize that
other languages have already done so and have more benefits besides.

Maybe CIL or LLVM will help that situation.

-a
Lan Barnes
2007-11-12 13:17:22 UTC
Permalink
-snip-

<sitting here wondering why I got so jumped on when I idly wondered why
MythTV (and I was picking one example) was coded entirely in C/C++ and not
some scripting language supplemented by low level C/C++>
--
Lan Barnes

SCM Analyst Linux Guy
Tcl/Tk Enthusiast Biodiesel Brewer
Andrew Lentvorski
2007-11-12 13:23:09 UTC
Permalink
Post by Lan Barnes
-snip-
<sitting here wondering why I got so jumped on when I idly wondered why
MythTV (and I was picking one example) was coded entirely in C/C++ and not
some scripting language supplemented by low level C/C++>
Did I pick on you for that?

If so, I apologize. I don't know what came over me.

-a
Lan Barnes
2007-11-12 15:27:57 UTC
Permalink
Post by Andrew Lentvorski
Post by Lan Barnes
-snip-
<sitting here wondering why I got so jumped on when I idly wondered why
MythTV (and I was picking one example) was coded entirely in C/C++ and not
some scripting language supplemented by low level C/C++>
Did I pick on you for that?
If so, I apologize. I don't know what came over me.
-a
Nope. It was Gus.
--
Lan Barnes

SCM Analyst Linux Guy
Tcl/Tk Enthusiast Biodiesel Brewer
Gus Wirth
2007-11-12 15:21:02 UTC
Permalink
Post by Lan Barnes
-snip-
<sitting here wondering why I got so jumped on when I idly wondered why
MythTV (and I was picking one example) was coded entirely in C/C++ and not
some scripting language supplemented by low level C/C++>
I picked on you because of the complete unjustified assumption that QT
caused a segfault on your system because it was written in C++.

And I've actually looked into that and discovered that there wasn't a
single valid segfault problem attributable to MythTV out of the 158
references I found on the mythtv-users list for the year 2007. When you
do an actual search most of the references come about because of the
previous/next discussion thread done by the mail list. It also turns out
that Google knows that a segfault is a Segmentation Fault, which it will
also search for.

I did discover that the ivtv drivers have caused segfaults. And that
corrupt MySQL tables can cause segfaults. And that if you manually go
around changing the libraries without matching them to the installation
you will cause segfaults, and if you do that the guy who wrote the
packages will chastise you.

Gus
Lan Barnes
2007-11-12 15:34:03 UTC
Permalink
Post by Gus Wirth
Post by Lan Barnes
-snip-
<sitting here wondering why I got so jumped on when I idly wondered why
MythTV (and I was picking one example) was coded entirely in C/C++ and not
some scripting language supplemented by low level C/C++>
I picked on you because of the complete unjustified assumption that QT
caused a segfault on your system because it was written in C++.
And I've actually looked into that and discovered that there wasn't a
single valid segfault problem attributable to MythTV out of the 158
references I found on the mythtv-users list for the year 2007. When you
do an actual search most of the references come about because of the
previous/next discussion thread done by the mail list. It also turns out
that Google knows that a segfault is a Segmentation Fault, which it will
also search for.
I did discover that the ivtv drivers have caused segfaults. And that
corrupt MySQL tables can cause segfaults. And that if you manually go
around changing the libraries without matching them to the installation
you will cause segfaults, and if you do that the guy who wrote the
packages will chastise you.
Gus
I don't recall mentioning segfaults. I did mention freeze ups, crashes,
and the like.

Your response was that I was in an abusive relationship with cheap POS HW.
My response was that on any given day, I can document 4 - 5 threads on
MythTV Users about freeze ups, crashes, and the like, none of whom are me.

QT may be the soundest library ever created. I hope it is. But C/C++ are
known for giving programmers ample tools to screw themselves. I didn't say
that first.

Again, I never wanted to disparage the amazing job the Myth developers
have done. IIRC my original remark was that they themselves rate it at
release 0.20, and I wondered if a lot of the issues might have been
avoided by doing the interface and control glue in a scripting language.

I really want to go away now and be left alone.
--
Lan Barnes

SCM Analyst Linux Guy
Tcl/Tk Enthusiast Biodiesel Brewer
Christopher Smith
2007-11-12 15:41:23 UTC
Permalink
Post by Lan Barnes
Your response was that I was in an abusive relationship with cheap POS HW.
My response was that on any given day, I can document 4 - 5 threads on
MythTV Users about freeze ups, crashes, and the like, none of whom are me.
In fairness there are a *lot* of issues with the hardware and the
drivers used for a lot of video stuff on Linux. On top of that a lot of
the open source video decoders (not to mention MySQL) don't handle
corrupt data very well. With time, it will probably get better.
Post by Lan Barnes
I really want to go away now and be left alone.
Then you should no better than to post to a mailing list! ;-)

- --Chris
James G. Sack (jim)
2007-11-12 13:48:04 UTC
Permalink
Post by Andrew Lentvorski
..
Take a look at the current crop of revision control systems. Git (C and
shell scripts), Bazaar and Mercurial (Python), darcs (Haskell). Games
seem to be moving to more and more Lua and Python while only the
graphics core stays in C/C++. For web stuff, C++ is completely at the
bottom (you would think that something so popular would have spawned an
interpreted version rather than completely new languages, no?).
What ever happened to things like "QuickC" .. didn't both Borland and
Microsoft have something in that category? Or were they not really
interpreted?

Regards
..jim
Christopher Smith
2007-11-12 14:44:36 UTC
Permalink
Post by Andrew Lentvorski
For web stuff, C++ is completely at the
bottom (you would think that something so popular would have spawned an
interpreted version rather than completely new languages, no?).
Actually, there are interpreted versions of C++ available. Cint and Ch.
Some would argue Java and C# are interpreted versions of C++ as well. ;-)
Post by Andrew Lentvorski
Post by Christopher Smith
Yeah, they did the rewrite in 1998. The original post was referring to
those fantastic initial browsers developed by 1994 providing some
overwhelming advantage to browser projects inheriting that codebase.
At no point did I claim overwhelming advantage.
Okay, so given the horrid problems the Mozilla project has with its
memory management, why isn't the web littered with
Python/Haskell/Java/whatever web browsers that are far more feature rich
and performant, not to mention more secure and bug free?
Post by Andrew Lentvorski
However, the fact that it's already *in* C++ is certainly going to
change the discussion from "Should we use Java/Python/Perl/Lisp/etc?"
to "Should we really change from C++?" It changes the dynamics from
"go with the flow and avoid blame" to "take the blame if something
goes wrong (and it always does)."
Developers, particularly on open source projects, *love* to take such
things on. In particular, they love doing that more than they love
working with obviously bad code. Frankly, it isn't nearly as much of a
risk as you are intimating *if* the language offers nothing but
advantages for solving the problem at hand. Heck, that's how stuff ended
up being written in C++ in the first place.
Post by Andrew Lentvorski
Inertia is powerful.
So are better tools. By your reasoning it is shocking that almost all
software isn't written in assembler.
Post by Andrew Lentvorski
Post by Christopher Smith
But your mention of the huge Mozilla rewrite is exactly my point. They
ended up keeping basically zero code from the original code base, so it
was effectively rewritten from scratch in 1998.
No, it wasn't. They pulled out major subsystems and wrote them from
scratch. This means that the new subsystems had to fit into where the
old subsystems sat.
Actually, that was the original plan, as it turned out they ended up
rewriting all but a few tiny bits of the codebase. Several developers on
the project have commented on the fact that it actually would have been
done sooner if they'd not started with the Netscape 4.x code.
Post by Andrew Lentvorski
Post by Christopher Smith
and been at no additional disadvantage compared to the Mozilla project
(and presumably would have an advantage since they had a significantly
better programming language to work with). Despite this, Mozilla ended
up being the #2 browser out there, and probably one of the best working
ones. All of the ones that I think of even coming close to it are also
written in C++: IE, Opera, and KHTML-based browsers.
Microsoft wasn't going to use Java if hell froze over, so the only
options were C++ or Visual Basic. Opera targets small systems so is
stuck on C/C++. The KDE guys are "Give me Qt or give me death!" zealots
so nothing other than C++ will do.
Hey, don't forget Safari. That one was implemented in C++ because those
guys at Apple are such big C++ fans... er.. ;-)

Opera was not originally targeted at small systems. Indeed, the first
released implementation was a Windows only application. Rather, that is
where they found they could excel. Opera could very well have gone with
a straight C implementation (indeed, if you listen to C proponents, that
was the only logical choice for small systems), but they didn't.

Microsoft had 3 primary languages: C, C++ and VB. They chose C++. You
might ask yourself *why* those were their three primary choices and why
the IE team, which was explicitly given the power to break all the
development rules (and they certainly broke a lot of them) in order to
beat Netscape, wouldn't consider alternative development languages
(certainly Smalltalk was well supported on Windows at the time *and* had
a reputation for rapid application development, same goes for LISP/CLOS,
various flavours of Pascal, etc.).

As for the KDE guys... they've got lots of projects implemented in
languages other than C++, but they seem to prefer it for their core
components. That aside, you have to ask yourself, given their inherently
flawed choice of language tools, why they have been so successful as
compared to say the GNUStep project, which even had an initial inertia
advantage over KDE in the beginning.
Post by Andrew Lentvorski
Post by Christopher Smith
But it's like C++ with automatic memory management.... so surely it
would at least be better than C++ for almost any project, right? ;-)
Pretty much.
However, it seems that anyone enlightened enough to see the advantage of
Java over C++ is also enlightened enough to see the advantage of
Tcl/Perl/Python/etc. over Java.
Yes, and this explains the predominance of these languages in
implementations of core components of the 'net like... mail, dns, web,
bittorrent (I'll give Java props for actually having some decent
bittorrent implementations), etc.
Post by Andrew Lentvorski
Post by Christopher Smith
Again, I'm not arguing that C++ is the best language. Far from it. I'm
merely suggesting that it isn't quite so completely useless. It is
popular to trash it largely because it is so widely used.
Actually, Java has that mantle now.
Nah, the folks who defend Java primarily do so by bashing C++, and the
folks who bash Java are generally just as happy to bash C++, so C++
bashers outnumber Java bashers.
Post by Andrew Lentvorski
And there we disagree. The combination of context-sensitive grammar,
non-managed environment and static compilation really are major misfeatures.
Even worse, nobody seems really interested in correcting them. There's
no particular reason a C/C++ implementation couldn't gain those things.
However, anybody who would be motivated to do so seems to realize that
other languages have already done so and have more benefits besides.
Actually, D is basically those things minus static compilation, and it
could be done even without that if it were deemed important.

- --Chris
Gregory K. Ruiz-Ade
2007-11-12 15:40:48 UTC
Permalink
Post by Christopher Smith
Hey, don't forget Safari. That one was implemented in C++ because those
guys at Apple are such big C++ fans... er.. ;-)
I thought Safari, being a Cocoa app, was written in Objective-C, even
though at its core it uses a C++ rendering engine (KHTML/Webkit) with
Objective-C interfaces.

I may be mistaken, though.

Gregory
--
Gregory K. Ruiz-Ade <***@unnerving.org>
OpenPGP Key ID: EAF4844B keyserver: pgpkeys.mit.edu
Christopher Smith
2007-11-12 15:43:27 UTC
Permalink
Post by Gregory K. Ruiz-Ade
Post by Christopher Smith
Hey, don't forget Safari. That one was implemented in C++ because those
guys at Apple are such big C++ fans... er.. ;-)
I thought Safari, being a Cocoa app, was written in Objective-C, even
though at its core it uses a C++ rendering engine (KHTML/Webkit) with
Objective-C interfaces.
I may be mistaken, though.
It is C++ with an Objective-C wrapper. I believe it was part of what
drove Apple to work on Objective-C++ (the language with something to
offend everyone ;-).

- --Chris
Gregory K. Ruiz-Ade
2007-11-12 15:44:46 UTC
Permalink
Post by Christopher Smith
As for the KDE guys... they've got lots of projects implemented in
languages other than C++, but they seem to prefer it for their core
components. That aside, you have to ask yourself, given their
inherently
flawed choice of language tools, why they have been so successful as
compared to say the GNUStep project, which even had an initial inertia
advantage over KDE in the beginning.
I think the main problem with GNUStep getting traction was that they
were trying to copy, as closely as possible, the NeXTStep APIs. KDE
was really starting from scratch and leveraging an existing toolkit
(Qt).

It seems, from what I've seen, that projects which focus on _copying_
another project always have very low momentum and not much creativity,
whereas projects that start from scratch move a lot faster and tend to
have lots of people experimenting with them.

Gregory
--
Gregory K. Ruiz-Ade <***@unnerving.org>
OpenPGP Key ID: EAF4844B keyserver: pgpkeys.mit.edu
Andrew Lentvorski
2007-11-12 18:12:42 UTC
Permalink
Post by Christopher Smith
Post by Andrew Lentvorski
For web stuff, C++ is completely at the
bottom (you would think that something so popular would have spawned an
interpreted version rather than completely new languages, no?).
Actually, there are interpreted versions of C++ available. Cint and Ch.
Ch is non-Free. Cint has more than a few criticisms leveled at it--the
biggest one being how strongly it is welded to Root.

I would recommend Lua over these any day of the week.
Post by Christopher Smith
Some would argue Java and C# are interpreted versions of C++ as well. ;-)
Not a bad argument, either.
Post by Christopher Smith
Post by Andrew Lentvorski
Post by Christopher Smith
Yeah, they did the rewrite in 1998. The original post was referring to
those fantastic initial browsers developed by 1994 providing some
overwhelming advantage to browser projects inheriting that codebase.
At no point did I claim overwhelming advantage.
Okay, so given the horrid problems the Mozilla project has with its
memory management, why isn't the web littered with
Python/Haskell/Java/whatever web browsers that are far more feature rich
and performant, not to mention more secure and bug free?
Because we have plenty of web browsers? Because the geeks no longer
consider them interesting? Web browsers are exercises in GUI
programming, which geeks traditionally hate with a passion.
Post by Christopher Smith
Developers, particularly on open source projects, *love* to take such
things on. In particular, they love doing that more than they love
working with obviously bad code. Frankly, it isn't nearly as much of a
risk as you are intimating *if* the language offers nothing but
advantages for solving the problem at hand. Heck, that's how stuff ended
up being written in C++ in the first place.
I disagree. Things got written in C++ because new projects got started
in C++, not because someone rewrote a project into C++.

I can't even think of any projects that followed that route ...

Wait, actually, I can. Mentor Graphics rewrote their EDA CAD tools from
C into C++ in the 1994 timeframe.
Post by Christopher Smith
Post by Andrew Lentvorski
Inertia is powerful.
So are better tools. By your reasoning it is shocking that almost all
software isn't written in assembler.
How long did it take to dislodge assembler? How many companies failed
before that lesson got learned? It was quite a bit of pain to drill
that home (Excel wiped out Lotus by moving off of assembler first ...)
Post by Christopher Smith
Actually, that was the original plan, as it turned out they ended up
rewriting all but a few tiny bits of the codebase. Several developers on
the project have commented on the fact that it actually would have been
done sooner if they'd not started with the Netscape 4.x code.
And this refutes my point, how?

Although, Netscape is the poster child for the worst of both worlds.
They dumped a huge chunk of their codebase without dumping it *all* and
revisiting their initial decisions.
Post by Christopher Smith
Hey, don't forget Safari. That one was implemented in C++ because those
guys at Apple are such big C++ fans... er.. ;-)
For the code *Apple* developed, it was all ObjectiveC.
Post by Christopher Smith
As for the KDE guys... they've got lots of projects implemented in
languages other than C++, but they seem to prefer it for their core
components. That aside, you have to ask yourself, given their inherently
flawed choice of language tools, why they have been so successful as
compared to say the GNUStep project, which even had an initial inertia
advantage over KDE in the beginning.
Did it actually? I had never even heard of GNUStep until dealing with
OS X Cocoa stuff. NeXT may have had Studly Caps, but nobody I knew ever
actually had one--if you were going to spend that much, you either got a
Macintosh or a Sun. If you had a Sun, you either programmed in
Suntools/SunWindows or X11/Motif.
Post by Christopher Smith
Post by Andrew Lentvorski
However, it seems that anyone enlightened enough to see the advantage of
Java over C++ is also enlightened enough to see the advantage of
Tcl/Perl/Python/etc. over Java.
Yes, and this explains the predominance of these languages in
implementations of core components of the 'net like... mail, dns, web,
bittorrent (I'll give Java props for actually having some decent
bittorrent implementations), etc.
So, the one thing mentioned actually less than 5 years old and is an
application (as apposed to system software)--Bittorrent--is
demonstrating significant usage of Python and Java.

You're kinda making my point for me.
Post by Christopher Smith
Post by Andrew Lentvorski
Even worse, nobody seems really interested in correcting them. There's
no particular reason a C/C++ implementation couldn't gain those things.
However, anybody who would be motivated to do so seems to realize that
other languages have already done so and have more benefits besides.
Actually, D is basically those things minus static compilation, and it
could be done even without that if it were deemed important.
I looked at D, and it looks okay. It's just coming to the party
*waaaay* late. If D existed 10 years ago, it might have gotten more
traction. We'll see how well it does in an ecosystem with Python, Ruby,
etc.

-a
Christopher Smith
2007-11-12 23:26:15 UTC
Permalink
Post by Andrew Lentvorski
Post by Christopher Smith
Post by Andrew Lentvorski
For web stuff, C++ is completely at the
bottom (you would think that something so popular would have spawned an
interpreted version rather than completely new languages, no?).
Actually, there are interpreted versions of C++ available. Cint and Ch.
Ch is non-Free. Cint has more than a few criticisms leveled at it--the
biggest one being how strongly it is welded to Root.
Wow, a language implementation with more than a few criticisms leveled
at it: will wonders never cease?
Post by Andrew Lentvorski
I would recommend Lua over these any day of the week.
I've been able to use them successfully from time to time, primarily
like Smalltalk workspaces for C++. In general, C and C++ were very much
designed with a compiler in mind, so it is not surprising that one can
construct a better language by letting go of enough of C and C++'s
structure that you can't rightly call it C or C++. That's where
Java/C#/PHP/etc. come in to play.
Post by Andrew Lentvorski
Post by Christopher Smith
Some would argue Java and C# are interpreted versions of C++ as well. ;-)
Not a bad argument, either.
Yup. I've similarly argued that PHP is kind of a scripted C/C++. I think
the specific phrase I used was something along the lines of: "PHP is C
for people who find C too hard, and therefore probably shouldn't program
in C... *or* PHP." ;-)
Post by Andrew Lentvorski
Post by Christopher Smith
Okay, so given the horrid problems the Mozilla project has with its
memory management, why isn't the web littered with
Python/Haskell/Java/whatever web browsers that are far more feature rich
and performant, not to mention more secure and bug free?
Because we have plenty of web browsers? Because the geeks no longer
consider them interesting? Web browsers are exercises in GUI
programming, which geeks traditionally hate with a passion.
When the Mozilla project started, the world was crying out for an
alternative to IE, particularly for non-Windows platforms. There was a
huge amount of developer interest. Sure there were tons of alternative
browsers out there, but they all sucked for one reason or another.
People really wanted a browser that sucked less, and a lot of people
seemed to think they could build one (indeed, a lot of the criticism
levied at the Mozilla project in the early years seemed to be along the
lines of: "I could do this way better").
Post by Andrew Lentvorski
Post by Christopher Smith
Developers, particularly on open source projects, *love* to take such
things on. In particular, they love doing that more than they love
working with obviously bad code. Frankly, it isn't nearly as much of a
risk as you are intimating *if* the language offers nothing but
advantages for solving the problem at hand. Heck, that's how stuff ended
up being written in C++ in the first place.
I disagree. Things got written in C++ because new projects got started
in C++, not because someone rewrote a project into C++.
Right, so why, in say 1997, didn't someone sit down and say, "C++ sucks
for writing browsers, we should really build one in language X." and
then start a new project? Answer: they did, and with the possible
exception of OmniWeb, they failed.
Post by Andrew Lentvorski
I can't even think of any projects that followed that route ...
Sigh, I know of several, which is perhaps why I have a strong
appreciation for the notion that one language having clear advantages
over the other, while alluring at first glance, is perhaps... unwarranted.
Post by Andrew Lentvorski
Post by Christopher Smith
Post by Andrew Lentvorski
Inertia is powerful.
So are better tools. By your reasoning it is shocking that almost all
software isn't written in assembler.
How long did it take to dislodge assembler?
C and Fortran were pretty successful at marginalizing assembly
programming, particularly once RISC processors showed up on the scene.
Post by Andrew Lentvorski
How many companies failed before that lesson got learned?
That's the key point though: they tried and failed. People trying isn't
an indication of much more than a language having appeal to a certain
group of developers. People succeeding is an indicator that perhaps
there is a significant enough advantage that it is worth considering the
language choice issue before making a move.
Post by Andrew Lentvorski
It was quite a bit of pain to drill that home (Excel wiped out Lotus by
moving off of assembler first ...)
Well, that's one man's story. A lot of people would suggest Excel wiped
out Lotus by virtue of being designed from the ground up for the GUI
paradigm.
Post by Andrew Lentvorski
Post by Christopher Smith
Actually, that was the original plan, as it turned out they ended up
rewriting all but a few tiny bits of the codebase. Several developers on
the project have commented on the fact that it actually would have been
done sooner if they'd not started with the Netscape 4.x code.
And this refutes my point, how?
Because, if they derived no advantage from the inertia of the Netscape
4.x code base, then surely they should have been beaten by someone
starting from scratch with a better language tool. Certainly enough
people tried that there was a good chance that would happen.
Post by Andrew Lentvorski
Although, Netscape is the poster child for the worst of both worlds.
They dumped a huge chunk of their codebase without dumping it *all* and
revisiting their initial decisions.
Yup, and despite that, they're one of the best if not arguably the best
browser available on the market today. How can you screw up that badly
*and* use a tool that is so horribly wrong for the job and still beat
everyone else?!
Post by Andrew Lentvorski
Post by Christopher Smith
Hey, don't forget Safari. That one was implemented in C++ because those
guys at Apple are such big C++ fans... er.. ;-)
For the code *Apple* developed, it was all ObjectiveC.
I'm sorry, that's just patently false. Apple contributed back their
non-Objective-C changes to the KDE project, and there was much griping
about how such a massive set of changes wasn't accompanied by
changelogs. When the KDE guys finally pieced together all the changes,
Konqueror passed Acid2, just like... Safari. Read the white paper on the
project: the Objective-C wrapper was a comparatively small portion of
Apple's efforts.
Post by Andrew Lentvorski
Post by Christopher Smith
As for the KDE guys... they've got lots of projects implemented in
languages other than C++, but they seem to prefer it for their core
components. That aside, you have to ask yourself, given their inherently
flawed choice of language tools, why they have been so successful as
compared to say the GNUStep project, which even had an initial inertia
advantage over KDE in the beginning.
Did it actually?
Well, it started before the KDE project did, and there was discussion
when both the KDE project and GNOME project started, about whether it
was more appropriate for people to just work on GNUStep.
Post by Andrew Lentvorski
NeXT may have had Studly Caps, but nobody I knew ever
actually had one--if you were going to spend that much, you either got a
Macintosh or a Sun.
Which is exactly why GNUStep had so much appeal, and exactly why
OpenStep garnered attention and gave Objective-C a real shot (not to
mention should have provided GNUStep with more interest and resources).
Post by Andrew Lentvorski
If you had a Sun, you either programmed in
Suntools/SunWindows or X11/Motif.
A very interesting point considering that OpenStep was available for
Solaris at one point.
Post by Andrew Lentvorski
Post by Christopher Smith
Post by Andrew Lentvorski
However, it seems that anyone enlightened enough to see the advantage of
Java over C++ is also enlightened enough to see the advantage of
Tcl/Perl/Python/etc. over Java.
Yes, and this explains the predominance of these languages in
implementations of core components of the 'net like... mail, dns, web,
bittorrent (I'll give Java props for actually having some decent
bittorrent implementations), etc.
So, the one thing mentioned actually less than 5 years old and is an
application (as apposed to system software)--Bittorrent--is
demonstrating significant usage of Python and Java.
Wait, are you acknowledging there that C++ perhaps isn't inherently
worse than other languages for systems software?
Post by Andrew Lentvorski
You're kinda making my point for me.
Postfix and Qmail were both written from scratch, out of disgust for
Sendmail, 8-10 years ago. They were both immensely successful at being
better solutions than Sendmail for most people, in particular in the
areas of security, configuration and performance. They achieved this
status within a couple of years of their initial release. Why aren't
they written in some other language? Why can't someone come up with an
even better implementation using some other language? Similarly BIND and
Apache have been maligned and people have come up with solutions that
are demonstrably better for most people. Sendmail, Bind and Apache have
all had major rewrites in recent times (although Apache 2.0 still
struggles a bit to problems with its runtime model and scripting
languages). Most of today's successful e-mail clients didn't exist a
dozen years ago. I think it is safe to say that at one time or another
someone has given a go at writing at least a proper e-mail client using
almost every general purpose programming language out there. If C/C++
sucks so much, how did we end up with the ones that were written in C/C++?

- --Chris
Andrew Lentvorski
2007-11-13 02:56:32 UTC
Permalink
Post by Christopher Smith
When the Mozilla project started, the world was crying out for an
alternative to IE, particularly for non-Windows platforms. There was a
huge amount of developer interest. Sure there were tons of alternative
browsers out there, but they all sucked for one reason or another.
People really wanted a browser that sucked less, and a lot of people
seemed to think they could build one (indeed, a lot of the criticism
levied at the Mozilla project in the early years seemed to be along the
lines of: "I could do this way better").
And yet no one did build a better browser, and almost nobody helped
Mozilla. One of the complaints that jwz made a *long* way back was how
little help the community supplied for a very long time.

I remember a couple of those "browser" projects. Generally people
thought they could do a better job. Then they hit font rendering.
Suddenly, things got *hard* and the developers weren't so interested.
Post by Christopher Smith
Right, so why, in say 1997, didn't someone sit down and say, "C++ sucks
for writing browsers, we should really build one in language X." and
then start a new project? Answer: they did, and with the possible
exception of OmniWeb, they failed.
So, why, if there was so much interest, didn't somebody sit down and
write a better browser than Mozilla even using C++. With the exception
of Konqueror, they all failed. And Konqueror didn't start until 1999
when the support libraries were a *lot* more mature.

Maybe because writing a browser is an annoying PITA and doesn't have any
hacker props?
Post by Christopher Smith
Because, if they derived no advantage from the inertia of the Netscape
4.x code base, then surely they should have been beaten by someone
starting from scratch with a better language tool. Certainly enough
people tried that there was a good chance that would happen.
*Did* they try? I could be convinced, but I definitely don't remember
anyone other than Mozilla for a long time.
Post by Christopher Smith
Post by Andrew Lentvorski
Although, Netscape is the poster child for the worst of both worlds.
They dumped a huge chunk of their codebase without dumping it *all* and
revisiting their initial decisions.
Yup, and despite that, they're one of the best if not arguably the best
browser available on the market today. How can you screw up that badly
*and* use a tool that is so horribly wrong for the job and still beat
everyone else?!
They didn't *beat* anyone. IE stood still for how many years while
Mozilla picked its broken bits up off the floor? And who else had a
credible alternative?

And Firefox only really got going after ActiveX became an active disaster...
Post by Christopher Smith
Post by Andrew Lentvorski
Post by Christopher Smith
Post by Andrew Lentvorski
However, it seems that anyone enlightened enough to see the advantage of
Java over C++ is also enlightened enough to see the advantage of
Tcl/Perl/Python/etc. over Java.
Yes, and this explains the predominance of these languages in
implementations of core components of the 'net like... mail, dns, web,
bittorrent (I'll give Java props for actually having some decent
bittorrent implementations), etc.
So, the one thing mentioned actually less than 5 years old and is an
application (as apposed to system software)--Bittorrent--is
demonstrating significant usage of Python and Java.
Wait, are you acknowledging there that C++ perhaps isn't inherently
worse than other languages for systems software?
What I'm pointing out is that in an arena where business and inertia
considerations don't dominate, even the massive differential in
programmer numbers isn't enough to put C++ in the number 1 spot.
Post by Christopher Smith
Postfix and Qmail were both written from scratch, out of disgust for
Sendmail, 8-10 years ago. They were both immensely successful at being
better solutions than Sendmail for most people, in particular in the
areas of security, configuration and performance. They achieved this
status within a couple of years of their initial release. Why aren't
they written in some other language?
First, you should go read DJB's postfix retrospective in which he opines
that he should have chosen a better language. Second, you keep picking
system software which is heavily tied to an operating system rather than
application software. However, ...

I would argue because there was nothing else available.

Come on, even C++ wasn't really a viable contender in 1997. The STL
appeared in 1994, and most compilers couldn't cope. gcc didn't have a
hope. It took *years* to straighten that out.

You are treating this like all of these languages have been around since
1980. In 1997, the only options that had known traction were Fortran,
C, and Ada. Perl 5 (which only came out in 1994?) was finally
entrenched for syadmin, and Tcl had some adherents in the EDA space.
Neither was acceptable for general use programming at the time.

C++ was just finally beginning to look like an alternative. Java was
also coming online in this timeframe.
Post by Christopher Smith
Why can't someone come up with an
even better implementation using some other language?
Because what exists is good enough?

Postfix and Qmail exist because sendmail was *that bad* in terms of
security. That was the itch.

What is the motivation to rewrite Postfix or Qmail in another language?
Even *if* you find an itch to scratch, even a x10 increase in
development speed won't be enough to overcome the sunk cost in terms of
development and community for years.
Post by Christopher Smith
Similarly BIND and
Apache have been maligned and people have come up with solutions that
are demonstrably better for most people.
Really? So why hasn't *any* major open-source OS removed BIND from its
resolver libraries, hmmmm? Apparently BIND isn't *that* bad.

There are community costs to replacing an existing program.

The moment those costs don't exist, suddenly everybody starts running
for languages other than C/C++.

-a
Gregory K. Ruiz-Ade
2007-11-13 10:52:13 UTC
Permalink
Post by Andrew Lentvorski
And yet no one did build a better browser, and almost nobody helped
Mozilla. One of the complaints that jwz made a *long* way back was
how little help the community supplied for a very long time.
My recollection from the other side was that people were complaining
of how staggeringly difficult it was to get up to speed on the
existing Netscape 4 code before they could understand enough to
become useful.

Certainly, not an ideal situation from either side of the fence.

Gregory
--
Gregory K. Ruiz-Ade <***@unnerving.org>
OpenPGP Key ID: EAF4844B keyserver: pgpkeys.mit.edu
Christopher Smith
2007-11-13 11:16:40 UTC
Permalink
Post by Gregory K. Ruiz-Ade
Post by Andrew Lentvorski
And yet no one did build a better browser, and almost nobody helped
Mozilla. One of the complaints that jwz made a *long* way back was
how little help the community supplied for a very long time.
My recollection from the other side was that people were complaining
of how staggeringly difficult it was to get up to speed on the
existing Netscape 4 code before they could understand enough to become
useful.
Certainly, not an ideal situation from either side of the fence.
Yes, and I've heard Mozilla developers describe this as one of the
reasons why having the Netscape 4 code was more of a disadvantage than
an advantage.

--Chris
Andrew Lentvorski
2007-11-13 13:32:08 UTC
Permalink
Post by Christopher Smith
Post by Gregory K. Ruiz-Ade
Post by Andrew Lentvorski
And yet no one did build a better browser, and almost nobody
helped Mozilla. One of the complaints that jwz made a *long* way
back was how little help the community supplied for a very long
time.
My recollection from the other side was that people were
complaining of how staggeringly difficult it was to get up to speed
on the existing Netscape 4 code before they could understand enough
to become useful.
Certainly, not an ideal situation from either side of the fence.
Yes, and I've heard Mozilla developers describe this as one of the
reasons why having the Netscape 4 code was more of a disadvantage
than an advantage.
And, yet, they could have easily written test cases, bugs, etc. to help
bring themselves up to speed.

This complaint was the same as for *any* large project.

I hear this from people who wish to contribute to the kernels of the
free operating systems--both Linux and FreeBSD. I hear this from people
who wish to contribute to X11. This is not new.

This is a continuing failure of most open source projects. It takes
less effort and is more gratifying to write something that kinda works
60% of the time rather than understand all those nasty bits of the code
that works 99% of the time.

Lispniks are *famous* for this.

JWZ has a nice, trenchant comment about this:

http://www.jwz.org/doc/cadt.html
Post by Christopher Smith
In February 2003, a bunch of the outstanding bugs I'd reported
against various GNOME programs over the previous couple of years were
Because of the release of GNOME 2.0 and 2.2, and the lack of interest
in maintainership of GNOME 1.4, the gnome-core product is being
closed. If you feel your bug is still of relevance to GNOME 2, please
reopen it and refile it against a more appropriate component.
Thanks...
This is, I think, the most common way for my bug reports to open
source software projects to ever become closed. I report bugs; they
go unread for a year, sometimes two; and then (surprise!) that module
is rewritten from scratch -- and the new maintainer can't be bothered
to check whether his new version has actually solved any of the known
problems that existed in the previous version.
I'm so totally impressed at this Way New Development Paradigm. Let's
call it the "Cascade of Attention-Deficit Teenagers" model, or "CADT"
for short.
It hardly seems worth even having a bug system if the frequency of
from-scratch rewrites always outstrips the pace of bug fixing. Why
not be honest and resign yourself to the fact that version 0.8 is
followed by version 0.8, which is then followed by version 0.8?
But that's what happens when there is no incentive for people to do
the parts of programming that aren't fun. Fixing bugs isn't fun;
going through the bug list isn't fun; but rewriting everything from
scratch is fun (because "this time it will be done right", ha ha) and
so that's what happens, over and over again.
-a
Darren New
2007-11-12 20:26:22 UTC
Permalink
Post by Christopher Smith
why isn't the web littered with
Python/Haskell/Java/whatever web browsers that are far more feature rich
and performant, not to mention more secure and bug free?
Because you not only have to be performant and feature-rich, you also
have to be bug-compatible. It also helps to be distributed with an OS.

Note that people write tons and tons of web browsers. Every language
that lets you fetch a web page, do SOAP or cURL, is basically a browser.
It just lacks the GUI. Special-purpose stuff may very well overwhelm
general-purpose stuff in quantity of bytes transferred.
--
Darren New / San Diego, CA, USA (PST)
Remember the good old days, when we
used to complain about cryptography
being export-restricted?
Bob La Quey
2007-11-12 20:32:30 UTC
Permalink
Post by Darren New
Post by Christopher Smith
why isn't the web littered with
Python/Haskell/Java/whatever web browsers that are far more feature rich
and performant, not to mention more secure and bug free?
Because you not only have to be performant and feature-rich, you also
have to be bug-compatible. It also helps to be distributed with an OS.
Note that people write tons and tons of web browsers. Every language
that lets you fetch a web page, do SOAP or cURL, is basically a browser.
It just lacks the GUI. Special-purpose stuff may very well overwhelm
general-purpose stuff in quantity of bytes transferred.
--
Darren New / San Diego, CA, USA (PST)
I suspect from cursory inspection of the Firefox code that
dealing with all of the different variants of HTML, CSS and
even Javascript account for a _lot_ of the code. Doing this
in a cross GUI way adds to the issues.

Anyone can write a simple HTML browser that works with
a particular GUI tool kit on a particular OS. Few browsers
can handle all of the above.

BobLQ
Christopher Smith
2007-11-12 23:36:51 UTC
Permalink
Post by Darren New
Post by Christopher Smith
why isn't the web littered with
Python/Haskell/Java/whatever web browsers that are far more feature rich
and performant, not to mention more secure and bug free?
Because you not only have to be performant and feature-rich, you also
have to be bug-compatible. It also helps to be distributed with an OS.
Ah, so all these other languages provide you with development advantages
as long as you are willing to give up performance and features. That
kind of reads to me as, "C++ appears to have some merit relative to
other languages".

As for the OS distribution factor.... Firefox isn't distributed with
Windows or OS X. It is bundled with other operating systems, but most of
them would gladly take another browser if it was better than Firefox and
didn't impact their cost of goods.
Post by Darren New
Note that people write tons and tons of web browsers. Every language
that lets you fetch a web page, do SOAP or cURL, is basically a browser.
It just lacks the GUI. Special-purpose stuff may very well overwhelm
general-purpose stuff in quantity of bytes transferred.
I don't doubt that any language can fairly easily implement a basic HTTP
client (although it is amusing how many of them seem to prefer just
wrapping cURL) with minimal effort. That's essentially a classroom
assignment, and it is simple enough that languages are unlikely to be so
inappropriate as to cause significant shortcomings. I'm talking about a
project whose scale is enough to "separate out the men from the boys" so
to speak. That means competing with the big boys in terms of feature
completeness and quality.

- --Chris
Darren New
2007-11-13 07:49:59 UTC
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Post by Darren New
Post by Christopher Smith
why isn't the web littered with
Python/Haskell/Java/whatever web browsers that are far more feature rich
and performant, not to mention more secure and bug free?
Because you not only have to be performant and feature-rich, you also
have to be bug-compatible. It also helps to be distributed with an OS.
Ah, so all these other languages provide you with development advantages
as long as you are willing to give up performance and features. That
kind of reads to me as, "C++ appears to have some merit relative to
other languages".
Um, no. You really ought to read what I wrote.

The web isn't littered with web browsers *at all*, let alone in
different languages.
I'm talking about a
project whose scale is enough to "separate out the men from the boys" so
to speak. That means competing with the big boys in terms of feature
completeness and quality.
Sure. And if you pick web browsers, or maybe video games, the answer is
"See? C++." If you pick areospace firmware, the answer is "See? Ada."
If you pick banking, the answer is "See? COBOL."

I would be very surprised to discover that NASDAQ is written in C++.

In systems where when it fails, you lose a years worth of GDP or a dozen
lives, C++ isn't all that common. But sure, when a crash means you have
to open all your tabs again? Use C++.

So what are the advantages of C++ over, say, Ada 95?
--
Darren New / San Diego, CA, USA (PST)
Remember the good old days, when we
used to complain about cryptography
being export-restricted?
Stewart Stremler
2007-11-24 15:12:05 UTC
Permalink
begin quoting Darren New as of Tue, Nov 13, 2007 at 07:49:36AM -0800:
[snip]
Post by Darren New
The web isn't littered with web browsers *at all*, let alone in
different languages.
Um...

http://www.smashingmagazine.com/2007/11/21/web-browsers-you-have-never-heard-of/

[snip]
Post by Darren New
I would be very surprised to discover that NASDAQ is written in C++.
I watched a medical billing system get rewritten from COBOL to C++. The
owner of the company vowed "never again".
Post by Darren New
So what are the advantages of C++ over, say, Ada 95?
It has symbols in the name. That's sexy.
--
Catching up as best I can.
Stewart Stremler
Chuck Esterbrook
2007-11-24 16:09:43 UTC
Permalink
Post by Stewart Stremler
[snip]
Post by Darren New
The web isn't littered with web browsers *at all*, let alone in
different languages.
Um...
http://www.smashingmagazine.com/2007/11/21/web-browsers-you-have-never-heard-of/
Well the web still isn't littered with *original* web browsers, right?
These are all engine wrappers... "Let's wrap Gecko and add social
bookmarking..." or "Let's wrap WebKit and scratch Mac itches..." or
"Let's wrap..."

Who says "Let's write a new engine? Yay!"?

-Chuck
Stewart Stremler
2007-11-24 16:51:15 UTC
Permalink
Post by Chuck Esterbrook
Post by Stewart Stremler
[snip]
Post by Darren New
The web isn't littered with web browsers *at all*, let alone in
different languages.
Um...
http://www.smashingmagazine.com/2007/11/21/web-browsers-you-have-never-heard-of/
Well the web still isn't littered with *original* web browsers, right?
These are all engine wrappers... "Let's wrap Gecko and add social
bookmarking..." or "Let's wrap WebKit and scratch Mac itches..." or
"Let's wrap..."
Heh. Point.
Post by Chuck Esterbrook
Who says "Let's write a new engine? Yay!"?
For the lack of that, I blame the W3C's idea of "standards".

That being said, it's on my list of "one day, maybe, if I get the time"
projects. :)
--
And why /shouldn't/ a browser work just fine without a CSS module?
Stewart Stremler
Chuck Esterbrook
2007-11-24 17:30:22 UTC
Permalink
Post by Stewart Stremler
Post by Chuck Esterbrook
Post by Stewart Stremler
[snip]
Post by Darren New
The web isn't littered with web browsers *at all*, let alone in
different languages.
Um...
http://www.smashingmagazine.com/2007/11/21/web-browsers-you-have-never-heard-of/
Well the web still isn't littered with *original* web browsers, right?
These are all engine wrappers... "Let's wrap Gecko and add social
bookmarking..." or "Let's wrap WebKit and scratch Mac itches..." or
"Let's wrap..."
Heh. Point.
Post by Chuck Esterbrook
Who says "Let's write a new engine? Yay!"?
For the lack of that, I blame the W3C's idea of "standards".
That being said, it's on my list of "one day, maybe, if I get the time"
projects. :)
And if you started today which language would you use?

-Chuck
Stewart Stremler
2007-11-24 22:38:39 UTC
Permalink
[on writing a new web-browser engine]
Post by Chuck Esterbrook
Post by Stewart Stremler
That being said, it's on my list of "one day, maybe, if I get the time"
projects. :)
And if you started today which language would you use?
Java.

Maybe Smalltalk.

Possibly Objective-C.
--
Tcl/Tk or Ruby if it were an exercise in using those languages.
Stewart Stremler
David M. Cook
2007-11-25 00:01:13 UTC
Permalink
Post by Stewart Stremler
Java.
Maybe Smalltalk.
Possibly Objective-C.
Memory management in Obj-C is less straightforward than the other two, and
I'm curious how you would plan to handle it. Use auto-release pools? The
Boehm GC? Apple's new garbage collector?

Dave Cook
Chuck Esterbrook
2007-11-25 00:06:30 UTC
Permalink
Post by David M. Cook
Post by Stewart Stremler
Java.
Maybe Smalltalk.
Possibly Objective-C.
Memory management in Obj-C is less straightforward than the other two, and
I'm curious how you would plan to handle it. Use auto-release pools? The
Boehm GC? Apple's new garbage collector?
But if that statement isn't true about Obj-C 2.0, which adds gc, then
the subsequent questions aren't so interesting. Even if GC hasn't come
to GNUstep yet (and I don't know; haven't checked) I doubt it would be
far away now that Apple is pushing it.

-Chuck
Stewart Stremler
2007-11-25 00:47:09 UTC
Permalink
Post by David M. Cook
Post by Stewart Stremler
Java.
Maybe Smalltalk.
Possibly Objective-C.
Memory management in Obj-C is less straightforward than the other two,
Yup.
Post by David M. Cook
and
I'm curious how you would plan to handle it. Use auto-release pools? The
Boehm GC? Apple's new garbage collector?
Dunno. That's why it's #3 in the list. :)

Seriously, I'd probably forgo the Apple GC until that got folded back
into GCC, so the same code could compile and run on OS X, Linux, and
Solaris.

I've never played with the Boehm GC, so I'd probably pick an initial
module or two and try writing it both ways, and then looking at the
resulting code. The least ugly / least painful code would be my
preference.

This presumes that the Boehm GC has been ported to my target platforms -- I
haven't touched anything in ObjC land in a long time -- and trouble here
would result in immediate abandoning of that route. Debugging the compiler
is more work than such a project needs.
--
My Object-C-fu is weak!
Stewart Stremler
Christopher Smith
2007-11-25 02:17:18 UTC
Permalink
Post by Stewart Stremler
Seriously, I'd probably forgo the Apple GC until that got folded back
into GCC, so the same code could compile and run on OS X, Linux, and
Solaris
It has already been folded in. At least on my Gentoo box I have it.

$ equery uses gcc
[ Searching for packages matching gcc... ]
[ Colour Code : set unset ]
[ Legend : Left column (U) - USE flags from make.conf ]
[ : Right column (I) - USE flags packages was installed with ]
[ Found these USE variables for sys-devel/gcc-4.1.2 ]
U I
- - altivec : Adds support for optimizations for G4 and G5/ppc970
processors
- - bootstrap : !!internal use only!! DO NOT SET THIS FLAG YOURSELF!,
used during original system bootstrapping [make stage2]
- - build : !!internal use only!! DO NOT SET THIS FLAG YOURSELF!,
used for creating build images and the first half of bootstrapping [make
stage1]
+ + d : Enable support for the D programming language
+ + doc : Adds extra documentation (API, Javadoc, etc)
+ + fortran : Adds support for fortran (formerly f77)
+ + gcj : Enable building with gcj (The GNU Compiler for the
Javatm Programming Language)
+ + gtk : Adds support for x11-libs/gtk+ (The GIMP Toolkit)
- - hardened : activate default security enhancements for toolchain
(gcc, glibc, binutils)
- - ip28 : Enable building a compiler capable of building a kernel
for SGI Indigo2 Impact R10000 (IP28)
- - ip32r10k : Enable building a compiler capable of building an
experimental kernel for SGI O2 w/ R1x000 CPUs (IP32)
+ + mudflap : Add support for mudflap, a pointer use checking library
- - multilib : On 64bit systems, if you want to be able to compile
32bit and 64bit binaries
- - multislot : Allow for SLOTs to include minor version (3.3.4 instead
of just 3.3)
- - n32 : Enable n32 ABI support on mips
- - n64 : Enable n64 ABI support on mips
+ + nls : Adds Native Language Support (using gettext - GNU
locale utilities)
- - nocxx : Disable support for C++ (DON'T USE THIS UNLESS YOU KNOW
WHAT YOU'RE DOING)
+ + objc : Build support for the Objective C code language
+ + objc++ : Build support for the Objective C++ language
+ + objc-gc : Build support for the Objective C code language Garbage
Collector
- - test : Workaround to pull in packages needed to run with
FEATURES=test. Portage-2.1.2 handles this internally, so don't set it in
make.conf/package.use anymore.
- - vanilla : Do not add extra patches which change default
behaviour; DO NOT USE THIS ON A GLOBAL SCALE as the severity of the
meaning changes drastically

--Chris
Gregory K. Ruiz-Ade
2007-11-25 14:58:25 UTC
Permalink
Post by David M. Cook
Memory management in Obj-C is less straightforward than the other two, and
I'm curious how you would plan to handle it. Use auto-release
pools? The
Boehm GC? Apple's new garbage collector?
I would think, were he to start today, he'd be wise to leverage
Objective-C 2.0 which is shipping with OS X 10.5.x and it's associated
dev kit (XCode). At that point, there's no reason /not/ to use the
garbage collector included with the language.

Unless I'm mistaken, of course.

Gregory
--
Gregory K. Ruiz-Ade <***@unnerving.org>
OpenPGP Key ID: EAF4844B keyserver: pgpkeys.mit.edu
Gus Wirth
2007-11-25 10:42:38 UTC
Permalink
Post by Stewart Stremler
[on writing a new web-browser engine]
Post by Chuck Esterbrook
Post by Stewart Stremler
That being said, it's on my list of "one day, maybe, if I get the time"
projects. :)
And if you started today which language would you use?
Java.
Maybe Smalltalk.
Possibly Objective-C.
What graphical tool kit would you use? Java has at least three: AWT,
Swing and SWT. Since building a browser is creating a GUI, I'm inclined
to believe that the choice of your GUI widget set is more important than
the language.

Gus
Chuck Esterbrook
2007-11-25 11:06:09 UTC
Permalink
Post by Gus Wirth
Post by Stewart Stremler
[on writing a new web-browser engine]
Post by Chuck Esterbrook
Post by Stewart Stremler
That being said, it's on my list of "one day, maybe, if I get the time"
projects. :)
And if you started today which language would you use?
Java.
Maybe Smalltalk.
Possibly Objective-C.
What graphical tool kit would you use? Java has at least three: AWT,
Swing and SWT. Since building a browser is creating a GUI, I'm inclined
to believe that the choice of your GUI widget set is more important than
the language.
Gus
What does Firefox do exactly? It runs on Windows, Mac and Linux. It
doesn't seem to be using Qt or wxWindows.

-Chuck
Christopher Smith
2007-11-25 11:54:13 UTC
Permalink
Post by Chuck Esterbrook
Post by Gus Wirth
Post by Stewart Stremler
[on writing a new web-browser engine]
Post by Chuck Esterbrook
Post by Stewart Stremler
That being said, it's on my list of "one day, maybe, if I get the time"
projects. :)
And if you started today which language would you use?
Java.
Maybe Smalltalk.
Possibly Objective-C.
What graphical tool kit would you use? Java has at least three: AWT,
Swing and SWT. Since building a browser is creating a GUI, I'm inclined
to believe that the choice of your GUI widget set is more important than
the language.
Gus
What does Firefox do exactly? It runs on Windows, Mac and Linux. It
doesn't seem to be using Qt or wxWindows.
They built their own cross-platform GUI effectively: XUL.

--Chris
Stewart Stremler
2007-11-25 11:13:35 UTC
Permalink
Post by Gus Wirth
Post by Stewart Stremler
[on writing a new web-browser engine]
Post by Chuck Esterbrook
Post by Stewart Stremler
That being said, it's on my list of "one day, maybe, if I get the time"
projects. :)
And if you started today which language would you use?
Java.
[snip]
Post by Gus Wirth
What graphical tool kit would you use? Java has at least three: AWT,
Swing and SWT. Since building a browser is creating a GUI, I'm inclined
to believe that the choice of your GUI widget set is more important than
the language.
I'm most familiar with Swing, and have never had the sort of itches that
caused the creation of SWT... so I've never looked at SWT.

That being said, I'm not wedded to Swing. I wouldn't argue FOR Swing,
except if the alternative were AWT.

I have no opinion, good or bad, about SWT.
--
Get the model right, and the View can be easily replaced.
Stewart Stremler
Andrew Lentvorski
2007-11-25 18:48:08 UTC
Permalink
Post by Stewart Stremler
That being said, I'm not wedded to Swing. I wouldn't argue FOR Swing,
except if the alternative were AWT.
I have no opinion, good or bad, about SWT.
It's okay. It sucks differently depending upon OS, that's all.

Until Sun figured out how to build a UI, the fact that SWT mapped more
directly to the OS widgets meant that they worked faster. Of course,
you had to explicitly manage the memory for those widgets.

With Swing, the UI seems to be okay.

The main thing is that the "It's gotta look like Windows on Windows!"
crowd seems to have gone away. Now "Snazzy but violates any useful UI
convention on the planet" seems to be as endemic on Windows as it was on
Mac.

-a

Gregory K. Ruiz-Ade
2007-11-25 14:54:25 UTC
Permalink
Post by Chuck Esterbrook
And if you started today which language would you use?
sh and dd


:D

Gregory
--
Gregory K. Ruiz-Ade <***@unnerving.org>
OpenPGP Key ID: EAF4844B keyserver: pgpkeys.mit.edu
Wade Curry
2007-11-24 18:41:49 UTC
Permalink
(discussing the plethora of web browsers and dearth of browser
engines...)
Post by Stewart Stremler
Post by Chuck Esterbrook
Who says "Let's write a new engine? Yay!"?
For the lack of that, I blame the W3C's idea of "standards".
I'm curious to know how you come to that conclusion. The W3C
doesn't enforce the standards. The adoption of them seems to have
been voluntary, and a vast improvement over older "standards".
Post by Stewart Stremler
That being said, it's on my list of "one day, maybe, if I get the time"
projects. :)
"Never" is easier to type. ;-)
Post by Stewart Stremler
--
And why /shouldn't/ a browser work just fine without a CSS module?
Stewart Stremler
This remark took me by surprise. Well... kind of. I was under the
impression that you thought the structure vs. style distinction was
a good one. As far as I know, style sheets are not required, so
why should the module be required for the browser? Lynx works fine
without 'em.

In lieu of CSS, what would you recommend? Another style-sheet
language? or an entirely different approach?

Wade Curry
syntaxman
Stewart Stremler
2007-11-24 23:08:28 UTC
Permalink
Post by Wade Curry
Post by Stewart Stremler
For the lack of that, I blame the W3C's idea of "standards".
I'm curious to know how you come to that conclusion. The W3C
doesn't enforce the standards. The adoption of them seems to have
been voluntary, and a vast improvement over older "standards".
I like simplicity. I get the impression that the W3C secretly despises it.
Post by Wade Curry
Post by Stewart Stremler
That being said, it's on my list of "one day, maybe, if I get the time"
projects. :)
"Never" is easier to type. ;-)
Heh. Don't deny me my dreams, man.
Post by Wade Curry
Post by Stewart Stremler
And why /shouldn't/ a browser work just fine without a CSS module?
This remark took me by surprise. Well... kind of. I was under the
impression that you thought the structure vs. style distinction was
a good one.
To a point. There are other concerns that need to be taken into account.
Looking at how one does layout with CSS (as opposed to the markup) has
led me to believe that either CSS is The Wrong Way[tm], or the "separate
structure and content" is a poor meme.

Part of this is that I tend to "view source" (and my email is text,
no HTML interpretation at all) a lot, so I'm looking directly at the
content -- and it's getting progressively more and more obscured.

I see a LOT of <div class="topleft"> and <div class="centerright">,
which really does count as structure. The thing is, that's the natural
way to do it, so you can't blame the website creators -- they're working
within the bounds of the tools they have.
Post by Wade Curry
As far as I know, style sheets are not required, so
why should the module be required for the browser? Lynx works fine
without 'em.
Sometimes.

Netscape with CSS disabled got to be unusable -- too many websites would
show up as blank pages. (I had to give up netscape and switch to
mozilla, which didn't make me happy until mozilla got tabbed browsing).
Post by Wade Curry
In lieu of CSS, what would you recommend? Another style-sheet
language? or an entirely different approach?
I'm not sure... I just think it would be wise to slow down and examine
some of the alternatives for awhile, rather than this full-speed-ahead
think-about-the-consequences-later approach we have now. Of course, I
am now fighting industry inertia *and* The Shiny Effect, so I'm doomed.

There's content, there's style, and there's layout. My Ideal Solution
would have content be pretty readable directly; style would be optional
(case, color, shading, font, etc.) and user-settable; and layout would
be succinctly defined and again user-adjustable.
--
Frames may be evil, but they're a better approach to layout than CSS.
Stewart Stremler
Christopher Smith
2007-11-24 19:13:27 UTC
Permalink
Post by Chuck Esterbrook
Post by Stewart Stremler
[snip]
Post by Darren New
The web isn't littered with web browsers *at all*, let alone in
different languages.
Um...
http://www.smashingmagazine.com/2007/11/21/web-browsers-you-have-never-heard-of/
Well the web still isn't littered with *original* web browsers, right?
These are all engine wrappers... "Let's wrap Gecko and add social
bookmarking..." or "Let's wrap WebKit and scratch Mac itches..." or
"Let's wrap..."
Who says "Let's write a new engine? Yay!"?
There are a small number of engines, but most of the successful engines
are buillt on code bases that are at most a decade old.

--Chris
Bob La Quey
2007-11-24 19:21:19 UTC
Permalink
Post by Christopher Smith
Post by Chuck Esterbrook
Post by Stewart Stremler
[snip]
Post by Darren New
The web isn't littered with web browsers *at all*, let alone in
different languages.
Um...
http://www.smashingmagazine.com/2007/11/21/web-browsers-you-have-never-heard-of/
Well the web still isn't littered with *original* web browsers, right?
These are all engine wrappers... "Let's wrap Gecko and add social
bookmarking..." or "Let's wrap WebKit and scratch Mac itches..." or
"Let's wrap..."
Who says "Let's write a new engine? Yay!"?
There are a small number of engines, but most of the successful engines
are buillt on code bases that are at most a decade old.
--Chris
Yeh, cause it is hard.

BobLQ
Chuck Esterbrook
2007-11-12 18:14:13 UTC
Permalink
Post by Andrew Lentvorski
Post by Christopher Smith
Sure other
languages are better (indeed, because of C++'s popularity, it nearly
impossible for a language that is worse than C++ to survive as anything
but a niche or legacy language), but they clearly aren't overwhelmingly so.
And there we disagree. The combination of context-sensitive grammar,
non-managed environment and static compilation really are major misfeatures.
Even worse, nobody seems really interested in correcting them. There's
no particular reason a C/C++ implementation couldn't gain those things.
However, anybody who would be motivated to do so seems to realize that
other languages have already done so and have more benefits besides.
Maybe CIL or LLVM will help that situation.
Herb Sutter and Microsoft are working on this. See "OOPSLA Keynote:
Concrete Languages on Virtual Platforms" at http://www.gotw.ca/

Not that I care. I'd rather use C# or Python.

-Chuck
Chuck Esterbrook
2007-11-12 18:09:27 UTC
Permalink
Post by Christopher Smith
Post by Chuck Esterbrook
http://www.omnigroup.com/applications/omniweb/
I love almost everything the Omni guys do. That said, last I used that
thing it had trouble with all kinds of websites. Has it come along since
then?
Based on reviews, it has. But I haven't used it myself as I tend to
oscillate between Safari and Firefox.
Post by Christopher Smith
Post by Chuck Esterbrook
Post by Christopher Smith
In fact, browsers were written in many of the languages I mentioned, and
they all tended to suck compared to Netscape or even second tier browers
like Mosaic, IE, and Cello. There was a reason the Netscape folks chose
C++ from all the language choices they had back then.
And popularity was one of them.
Popularity of a programming language comes from somewhere. If C++ is
really that horrible and unworkable, people wouldn't use it for
projects. Sure, it is far from perfect, but it seems to fall in to the
"good enough" category more often than not.
Then we can at least agree that C++ is like Windows. :-)
Post by Christopher Smith
Post by Chuck Esterbrook
And cross platform was another. With some work, you can get C++ to run
on Windows and Unix. Back then that wasn't the case with, for example,
Delphi.
Hey, cross platform is an entirely valid and fantastic feature of a
language. Indeed, it is what makes putting up with all those annoying
differences between implementations worth it. ;-)
Agreed.
Post by Christopher Smith
But your mention of the huge Mozilla rewrite is exactly my point. They
ended up keeping basically zero code from the original code base, so it
was effectively rewritten from scratch in 1998. They, or someone else,
*could* have implemented a browser in some other language at that point,
and been at no additional disadvantage compared to the Mozilla project
(and presumably would have an advantage since they had a significantly
better programming language to work with). Despite this, Mozilla ended
up being the #2 browser out there, and probably one of the best working
ones. All of the ones that I think of even coming close to it are also
written in C++: IE, Opera, and KHTML-based browsers.
Hey, I don't know why Objective-C didn't take off. I don't know why
Windows is more popular than Linux and Mac put together. But I know
that those technologies that I like are more capable than their
popular and tortuous alternatives.
Post by Christopher Smith
Post by Chuck Esterbrook
Objective-C has been a better language than C++ this whole time, but
it's not the most popular.
Again, I'm not arguing that C++ is the best language. Far from it. I'm
merely suggesting that it isn't quite so completely useless. It is
popular to trash it largely because it is so widely used. Sure other
languages are better (indeed, because of C++'s popularity, it nearly
impossible for a language that is worse than C++ to survive as anything
but a niche or legacy language), but they clearly aren't overwhelmingly so.
It's also popular to trash it because it sucks. :-)
See: http://yosefk.com/c++fqa/defective.html

By the way, I once became so fed up with crashes in KMail (back when I
used Linux as my desktop) that I filed a bug report contending that
something as important as a mail client should be done in a "protected
programming language", such as Python or Java, so that (a) crashes
were accompanied by a timely, accurate stack trace and (b) corruption
of data was less likely.

My bug report was immediately tagged as WONTFIX or NOTABUG or
something like that and closed. :-)

-Chuck
Andrew Lentvorski
2007-11-12 18:21:43 UTC
Permalink
Post by Chuck Esterbrook
Hey, I don't know why Objective-C didn't take off.
Lack of free compiler, mostly. Objective-C historically cost money.

-a
Christopher Smith
2007-11-12 19:56:50 UTC
Permalink
Post by Andrew Lentvorski
Post by Chuck Esterbrook
Hey, I don't know why Objective-C didn't take off.
Lack of free compiler, mostly. Objective-C historically cost money.
Objective-C has had a free compiler longer than Java has been around.

- --Chris
Christopher Smith
2007-11-12 22:39:33 UTC
Permalink
Post by Chuck Esterbrook
Post by Christopher Smith
Post by Chuck Esterbrook
http://www.omnigroup.com/applications/omniweb/
I love almost everything the Omni guys do. That said, last I used that
thing it had trouble with all kinds of websites. Has it come along since
then?
Based on reviews, it has. But I haven't used it myself as I tend to
oscillate between Safari and Firefox.
Okay then. Perhaps it is possible that C++ provides no redeeming value
over Objective-C. Interestingly, until 2.0, Objective-C *also* didn't
have automatic memory management (and certainly OmniWeb doesn't have it
or they rolled their own on top of Objective-C, as C++ developers
sometimes do). So ironically, we're still left with a perplexing lack of
consistency between reality and the original assertion that started this
thread.
Post by Chuck Esterbrook
Then we can at least agree that C++ is like Windows. :-)
Well, I like C++ more than I like Windows, but yeah, they both have the
aesthetic beauty of... well I'm not sure what the right words are.
Post by Chuck Esterbrook
It's also popular to trash it because it sucks. :-)
See: http://yosefk.com/c++fqa/defective.html
Yes, I'm very familiar with the site. It is not entirely correct, but
certainly it is fair to say that C++ has a lot of syntactic baroqueness,
and this is the result of a deliberate trade off by the designer(s) of
the language. I could write a similar paper (okay, probably a lot less
on the baroque syntax) on any language that I'd used extensively. Use a
language long enough and you start to understand all those horrid warts.

A language designer will tell you that languages are about trade offs,
so you can't come up with a prefect language. They will always have
things they don't do well. Occasionally, someone comes up with a set of
trade offs that seem practical for a useful subset of problems. I've yet
to be convinced that any of those languages is really that much better
than all others for anything but a subset of problems, and I frequently
am left asking the question, "if language A really is so crappy, why
hasn't every widely used application developed in it been replaced by
some version written in a different language?"
Post by Chuck Esterbrook
By the way, I once became so fed up with crashes in KMail (back when I
used Linux as my desktop) that I filed a bug report contending that
something as important as a mail client should be done in a "protected
programming language", such as Python or Java, so that (a) crashes
were accompanied by a timely, accurate stack trace and (b) corruption
of data was less likely.
I've tried using some of the Java mail clients people have come up with.
They always seems to be inferior to their C and C++ counterparts (heck,
often inferior to their *elisp* counterparts!). A few times I've thought
about writing my own just to see if I could make one that really was
better. I've thought of writing one that was largely in a scripting
language with some C++ components, but upon reflection it isn't clear
that its significantly easier to make a high quality mail client in Java
or any other language I've played with than doing so in C++. The primary
challenges have little to do with the language and while C++ presents
problems that the others do not, vice versa is also true.

- --Chris
Darren New
2007-11-13 07:51:40 UTC
Permalink
Post by Christopher Smith
am left asking the question, "if language A really is so crappy, why
hasn't every widely used application developed in it been replaced by
some version written in a different language?"
Because software doesn't wear out.
--
Darren New / San Diego, CA, USA (PST)
Remember the good old days, when we
used to complain about cryptography
being export-restricted?
Darren New
2007-11-13 08:24:42 UTC
Permalink
Post by Christopher Smith
am left asking the question, "if language A really is so crappy, why
hasn't every widely used application developed in it been replaced by
some version written in a different language?"
Oh, and by the way, many have. What do you think all that Java code out
there *is*? Brand new applications that nobody ever thought of before?
Or reworks of something that used to be in other languages?
--
Darren New / San Diego, CA, USA (PST)
Remember the good old days, when we
used to complain about cryptography
being export-restricted?
Darren New
2007-11-13 08:45:11 UTC
Permalink
Post by Darren New
Oh, and by the way, many have. What do you think all that Java code out
there *is*? Brand new applications that nobody ever thought of before?
Or, for that matter, the Javascript stuff. Because, sure, nobody had
mail clients or mapping software or word processors before google
started using javascript to let you do it over the web. :-)
--
Darren New / San Diego, CA, USA (PST)
Remember the good old days, when we
used to complain about cryptography
being export-restricted?
Paul G. Allen
2007-11-12 12:30:39 UTC
Permalink
Post by Christopher Smith
I guess that depends on how you define "large" and "operating system"
(one might claim Linux is written in C, but KDE sure accounts for a lot
of the code ;-), but certainly there are a number of operating systems
primarily written in C++, and they have been high quality
implementations with comparable capabilities to their C breathren.
Linux is written in C, and there's been several discussions over the
years as to why (especially when C++ groupies have wanted to write
[it|parts of it] in C++). KDE is not Linux, it's a suite of applications
that run under X on Linux.

PGA
--
Paul G. Allen, BSIT/SE
Owner, Sr. Engineer
Random Logic Consulting Services
www.randomlogic.com
Christopher Smith
2007-11-12 12:35:17 UTC
Permalink
Post by Paul G. Allen
Post by Christopher Smith
I guess that depends on how you define "large" and "operating system"
(one might claim Linux is written in C, but KDE sure accounts for a lot
of the code ;-), but certainly there are a number of operating systems
primarily written in C++, and they have been high quality
implementations with comparable capabilities to their C breathren.
Linux is written in C, and there's been several discussions over the
years as to why (especially when C++ groupies have wanted to write
[it|parts of it] in C++). KDE is not Linux, it's a suite of applications
that run under X on Linux.
Again, that depends on how you define what an operating system is.
Certainly the Linux kernel is written predominantly in C. Given that
definition, there are certainly kernels of similar size that have been
written in C++. BeOS comes immediately to mind.

- --Chris
Andrew Lentvorski
2007-11-11 19:47:56 UTC
Permalink
Post by Gabriel Sechan
The real problem is
doing a rather braindead allocation method- always calling malloc to
get a new block, rather than giving each data type a pool to allocate
from. Decide on a max size for each cache, allocate it at startup,
and allocate from the correct pool. You can even be truely evil and
do it automagically by overriding the new keyword. There you do- no
more out of control memory issues. When a single cache runs out of
memory, you bump old stuff from it to free up memory.
Umm, how do you "bump old stuff" when everything is referenced by direct
pointers, pray tell?

Do you think the Firefox guys would just write a periodic defragmenter
if it was that easy?
Post by Gabriel Sechan
Only if that doesn't work do you malloc a bigger cache.
Are you reading what you write? You just described a "stop-and-copy
garbage collector" (albeit a primitive one).

I ask this in all seriousness: what do you think a garbage collection is
and does?

-a
Gabriel Sechan
2007-11-11 20:05:18 UTC
Permalink
_________________________________________________________________
Boo!?Scare away worms, viruses and so much more! Try Windows Live OneCare!
http://onecare.live.com/standard/en-us/purchase/trial.aspx?s_cid=wl_hotmailnews
Gabriel Sechan
2007-11-11 20:09:44 UTC
Permalink
Wow, hotmail butchered that one. Sorry, its been cranky since their last big patch. Lets try it again.
Date: Sun, 11 Nov 2007 19:47:32 -0800
Subject: Re: Still think manual memory management is a good idea? Read this ...
The real problem is
doing a rather braindead allocation method- always calling malloc to
get a new block, rather than giving each data type a pool to allocate
from. Decide on a max size for each cache, allocate it at startup,
and allocate from the correct pool. You can even be truely evil and
do it automagically by overriding the new keyword. There you do- no
more out of control memory issues. When a single cache runs out of
memory, you bump old stuff from it to free up memory.
Umm, how do you "bump old stuff" when everything is referenced by direct
pointers, pray tell?
What do you think a reference is? Its a direct pointer.

The data structures discussed are caches. If you bump it, you drop it from the cache, and if its later requested you go to disk or to the net to grab it instead. A browser is semi-unique in that almost all of its memory is used in caches. Only the current webpage really must be resident in memory.
Only if that doesn't work do you malloc a bigger cache.
Are you reading what you write? You just described a "stop-and-copy
garbage collector" (albeit a primitive one).
No, I described a cache with a pool based memory. Its far from a garbage collector.

Gabe



_________________________________________________________________
Peek-a-boo FREE Tricks & Treats for You!
http://www.reallivemoms.com?ocid=TXT_TAGHM&loc=us
Christopher Smith
2007-11-12 00:06:11 UTC
Permalink
Post by Andrew Lentvorski
Post by Gabriel Sechan
The real problem is
doing a rather braindead allocation method- always calling malloc to
get a new block, rather than giving each data type a pool to allocate
from. Decide on a max size for each cache, allocate it at startup,
and allocate from the correct pool. You can even be truely evil and
do it automagically by overriding the new keyword. There you do- no
more out of control memory issues. When a single cache runs out of
memory, you bump old stuff from it to free up memory.
Umm, how do you "bump old stuff" when everything is referenced by
direct pointers, pray tell?
Yes, this is a fairly compelling argument against direct pointers,
although it would be better if there was an alternative implementation
using indirect pointers to compare against (Jazilla would not be a good
one). Of course, there is no need to use direct pointers in anything
other than C, and even in C, we've had at least two decades worth of
platforms with indirect memory references.
Post by Andrew Lentvorski
Do you think the Firefox guys would just write a periodic defragmenter
if it was that easy?
The Firefox guys already have written a garbage collector. A periodic
defragmenter is, by comparison, trivial. Of course, converting over all
your code from making direct references to indirect references... that
takes time.
Post by Andrew Lentvorski
I ask this in all seriousness: what do you think a garbage collection
is and does?
Actually, garbage collection doesn't specify that the memory is
relocatable, nor does lack of garbage collection mean that memory isn't
relocatable.

--Chris
Darren New
2007-11-11 21:20:53 UTC
Permalink
Post by Gabriel Sechan
This has nothing to do with manual vs automatic memory management. It has to do with cache coherency and fragmentation issues.
Actually, it has to do with whether you have a compacting garbage
collector or not.
Post by Gabriel Sechan
If anything, a Java style automatic memory management would be FAR worse-
Nah. All those blocks with one or two objects allocated in them would
get coalesced and the rest would be freed up.
Post by Gabriel Sechan
in C/C++, you can move to a less braindead method. In Java, the system new is all that exists, you're stuck with it.
In Java, you don't have pointers, only (things which people who study
this call) references, so you *can* move stuff around without breaking it.
--
Darren New / San Diego, CA, USA (PST)
Remember the good old days, when we
used to complain about cryptography
being export-restricted?
Continue reading on narkive:
Loading...