News for hackers. Stuff that matters.
Re:Linus vs C++, again by desponsible on Thursday June 10, 2010 @04:31PM (#1421543)
> One of the absolute worst features of C++ is how it makes a lot of things so context-dependent - which just means that when you look at the code, a local view simply seldom gives enough context to know what is going on.

Good point. Very good point.

Having spent few years developing for the Linux kernel I can say that the most cluttered code I dealt with was the network stack. And exactly because it was done in C++-ish way. It makes an extensive use of tables of function pointers, which is basically an analog of a C++ virtual table. A socket depending on its type would get a pointer to a different table and that table would define the actual flow, say, of the recv() call in the kernel. The concept is very elegant, and it translates into a more compact code, but it also makes tracing the code by hand hard.

So, yeah, Linus got a point there :)

Re:Linus vs C++, again by stcredzero on Thursday June 10, 2010 @05:03PM (#1421671)
I started designing a language where you had lexically scoped "contexts" to specify the meanings of words. In general a package/library would be a context, and could declare its dependency on other contexts. Any words with conflicting interpretations would have to use its full global specifier to compile.
Re:Linus vs C++, again by chromatic on Thursday June 10, 2010 @05:46PM (#1421850)
Perl does this, Perl 6 especially.
Re:Linus vs C++, again by alnayyir on Thursday June 10, 2010 @06:31PM (#1421986)
Sadly x86/arm/mips/sparc/power processors aren't Perl machines and Perl6 thusly can't be used to make a kernel for a Unix derivative.
Re:Linus vs C++, again by stcredzero on Thursday June 10, 2010 @07:31PM (#1422156)
One could probably get Scheme to do this and use it to make a kernel. But what would be the point of making it a Unix machine then? Make it a Scheme machine.
Re:Linus vs C++, again by eru on Thursday June 10, 2010 @07:36PM (#1422174)
They aren't C machines, either. But I agree, that Perl is probably harder to compile to native code than C.
Re:Linus vs C++, again by bdr on Thursday June 10, 2010 @06:53PM (#1422053)
Yes, I think we all wept when we first learned that.
Re:Linus vs C++, again by jrockway on Thursday June 10, 2010 @04:43PM (#1421591)
Actually, you refute his point. If they were actual classes instead of ad-hoc vtables, the flow would be clear.
Re:Linus vs C++, again by bnoordhuis on Thursday June 10, 2010 @04:53PM (#1421631)
No, he didn't. A call to ipv4_recv() is obvious, a call to impl->recv() less so.
[deleted]
Re:Linus vs C++, again by cakeface on Thursday June 10, 2010 @05:34PM (#1421802)
This post makes me wish that I had enough karma to downvote.
Re:Linus vs C++, again by KirinDave on Thursday June 10, 2010 @07:06PM (#1422097)
You can save your spiteful single clicks. That post sinks its own ship plenty well.
Re:Linus vs C++, again by alnayyir on Thursday June 10, 2010 @11:52PM (#1422712)
It got deleted, a little context so that I understand?
Re:Linus vs C++, again by tree_of_item on Friday June 11, 2010 @02:07PM (#1424150)
I was under the impression things were easier to understand without context.
Re:Linus vs C++, again by alnayyir on Monday June 14, 2010 @02:15AM (#1429039)
Maybe if you find it easier to work with figments of your own imagination rather than operating on actual data, perhaps.
Re:Linus vs C++, again by mikeklaas on Thursday June 10, 2010 @08:01PM (#1422234)
I think your example proves that it is how features are used, not the mere fact of the possibility for use in a language, that creates the problems linus refers to.