A bunch of cunts, mostly in the Australian sense. Except that one guy.

How shoud we replace C?

C++?

Wayne sounds like a clever guy. He should design one and call it crazy.
Permalink Rick in BC 
July 19th, 2010 2:04am
I've written my own language / compiler / virtual machine before but I'm not enough of a systems programmer to come up with a replacement for C.  I think the person best qualified for the job would probably Linus Torvalds.  When he couldn't find a good enough version control system, he wrote git.  I image he could come up with a language that gets the job done right without adding a lot of unnecessary fluff.

Linux uses a boat-load of GCC extensions (http://www.ibm.com/developerworks/linux/library/l-gcc-hacks/) -- might be nice to have a language where some of this part of the standard features.

Any new C replacement language would have to be extremely ABI compatible with C.  It should even be close enough for reasonable one-time source translation from C.  If it's fast enough, small enough, and smart enough it might get some traction.  However, the vast majority of programmers probably feel that it's not broken enough to replace (likely including Linus himself).
Permalink Wayne 
July 19th, 2010 2:29am
who says we need to?
Permalink eek 
July 19th, 2010 3:25am
Rick, maybe you could elaborate on why you think C needs to be replaced? I'm not aware of any major pains experienced by people who a.) are using it as intended b.) know their arse from their elbow. In fact those people tend to love C.

As I can only guess at your motivation from your past postings, I'd recommend having a look at Turtle Basic.
Permalink Send private email a2800276 
July 19th, 2010 4:32am
Also this: http://www.simplecodeworks.com/website.html looks like it would appeal to your intellect.
Permalink Send private email a2800276 
July 19th, 2010 4:35am
And they called it: Java!

Seriously, with Perl, Python, PHP -- we don't NEED another language.  The Object-Oriented Ghetto is being explored with C++ and Java.

C is a 'good enough' low-level language to implement other languages in.  C++ adds way too much complexity and performance hits (depending on how you use it).  Java is MUCH "safer" than C++, but well-written C will usually be twice as fast as well-written Java.  Of course, when something takes 250 mSec to run in Java, getting it to run in 125 mSec in C isn't much help.

Frankly, I'm still fond of the Borland version of Pascal -- simple, efficient, easy to read.

Also, it's taken us since 1978 to 2000 to get a public domain OS (linux) programmed in a public domain language (C) using public domain libraries (The Standard Lib).  Why would you want to abandon all that infrastructure, just for the dubious benefit of "replacing C"?
Permalink SaveTheHubble 
July 19th, 2010 8:36am
How should we replace the US$?

How should we replace the metric system?

How should we fix English spelling?
Permalink not CC 
July 19th, 2010 11:01am
"Rick, maybe you could elaborate on why you think C needs to be replaced?"

Basically Wayne said in the C++ thread that C may be replaced since it was designed in 1972 and a lot has changed since then.

Now I am going to ask you to refrain yourself from making drive by comments. This site basically is for CoT slaves. No one is required to explain to you everything that is happening here.
Permalink Rick in BC 
July 19th, 2010 11:07am
"Now I am going to ask you to refrain yourself from making drive by comments"

Ah, Rick, CoT is FOR "drive by comments".  Never change, dude, such naivete is endearing.  aka "it's cute when you're clueless".
Permalink SaveTheHubble 
July 19th, 2010 11:14am
I am giving this fellow a nice treatment since I know who he is.

See, why don't you go away? Obviously you don't treasure this place but you still want to make fun and belittle those who participate here frequently.
Permalink Rick in BC 
July 19th, 2010 11:21am
Yes, I'm the one that said C could be replaced in another thread and Rick just started a new thread on it.
Permalink Wayne 
July 19th, 2010 11:25am
Reply to http://www.crazyontap.com/topic.php?TopicId=77433#694147 from Hubble

"In 1972 we had the CPU, memory, stack, interrupts, I/O chips, RS-232 serial ports, etc."

Yes, but in 1972 the *text* of your program would have been considered large.  We also went from 8bit to 16bit to 32bit and now 64bit -- those are exponential jumps.

"So, to me, 'C' is a survivor."

My opinion is C was "good enough" or "worse is better" in terms of system programming language.  It filled the cross platform assembler niche.  However, it's far from perfect.  In fact, it's terribly flawed in areas and can trip up even experienced developers.

"It has weaknesses, which have attempted to be addressed by C++, Java, and all the 'scripting languages'."

I disagree.  C++, Java, and scripting languages are all intended for entirely different purposes that C.  They aren't replacements for C.  We don't have a replacement for C because nobody ever even attempts one.

A replacement for C wouldn't have to be too different.  It shouldn't leave anything undefined or implementation specific.  It should have an easier to follow declaration syntax.  It should better handle pointer aliasing.  It should allow, inherently in the design, more low level control such as inlining, etc.  It should directly support everything that's currently a GCC extension as part of the language.  It should have namespaces.  It should have hygienic macros that are an integrated part of the language.

I hesitate to say it should have direct support for multithreading because every platform handles that differently.  But perhaps it should have a better way to add, though libraries, those primitives directly into the language that's more natural to work with than just function calls.
Permalink Wayne 
July 19th, 2010 11:40am
Inlining, namespaces and "hygenic macros" -- I think if you include those features, you've just repeated the worst mistakes made in 'C' and C++ (and Java, except it has no macros).

You seem to be largely ignoring my arguments -- I didn't say 'C' was 'excellent' or even 'good', just that it's the mix of features that survived.

You keep saying "nobody's tried to replace it", which sounds nonsensical to me -- LOTS of people have tried to replace 'C', it is SUCH a pain in the ass.  Borland tried to replace it with Pascal and Delphi.  Microsoft tried to replace it with Visual Basic.

Whatever.  It sounds like you've defined the problem so that there's one correct answer -- replace 'C'.  If you're the first one who tried to replace it, it should be an open field for you, go for it.

Meanwhile, the rest of us will continue to try to be productive in our own environments.  I'll look eagerly to what you produce, because I don't really LIKE 'C', it's bit me in the ass way too often. 

It's just the implementation language used for Unix, Linux, Windows, the Perl run-time, the Java run-time, and what C++ is built on top of.  Not to mention the various "small-C" variants used for PIC, Arduino, and Mindstorms-NXT.  And I'm not saying any of these have any extreme virtue either (though I'm VERY fond of Perl), just that "good-enough" and "available almost everywhere" trumps a lot of other more theoretical virtures.
Permalink SaveTheHubble 
July 19th, 2010 11:54am
"You seem to be largely ignoring my arguments"

That's because I mostly agree with them. 

"Borland tried to replace it with Pascal and Delphi."

Pascal is very much a competitor (Delphi is OO, so an entirely different beast).  But Pascal always had it's own flaws.

"Microsoft tried to replace it with Visual Basic."

See, this is what I mean.  Visual Basic is not a system programming language.  You wouldn't write an operating system in it.  It's not a replacement for C in the way I'm trying to describe here.  Neither is C++, Java, or C#.  Where are the other cross platform assemblers?

"It sounds like you've defined the problem so that there's one correct answer -- replace 'C'."

I thought I was pretty clear on the desire of wants?  Is it too surprising that in 2010, namespaces might be a good idea?  Or standards that define every aspect of the language leaving nothing undefined or implementation specific?  I don't think I'm being particularly picky.

"If you're the first one who tried to replace it, it should be an open field for you, go for it."

I'm not much of a systems developer -- I do dome hobby embedded work but it's on a system too small for even C.  I'm sure someone else could do a better job.  You seem to making this somewhat personal: "Oh you hate C, so *you* write a replacement".  It's like even having a discussion about the potential of improving C is like suggesting rewriting the bible.

"just that 'good-enough' and 'available almost everywhere' trumps a lot of other more theoretical virtures."

I don't disagree, it's just too bad you feel this even trumps a discussion of theoretical virtues.  If someone, somewhere, were to write a really good replacement for C -- enough that people jump ship, this entire post of your will seem pretty short sighted.  In this history of computing, this has happened many times.

My God, who could have predicted a few years ago that Objective-C would suddenly become one of the most relevant languages.
Permalink Wayne 
July 19th, 2010 12:06pm
Fair enough.  You want somebody to replace 'C'.  My point of view is that it would be a fool's errand.

Other than that, we appear to agree.  We both agree 'C' has warts.  We both agree it "would be nice" to have some other system development language without 'C's warts.

I guess part of my resistance to the idea is that I would really-really LIKE to have a better software-engineering basis for our systems than 'C'.  And I've wanted that since 1978, when I first tried to use 'C' and began to be bitten by its idiosyncracies.

When you've wanted something very badly for 32 years, and it hasn't happened yet, it's very tempting to to say "look, that's just part of the landscape, after 32 years of wishing it would change, and efforts to change it have not succeeded in the marketplace, I'm not going to follow yet another wild-goose chase and be victimized yet again." -- like happened with Ada, for instance.

But I wish you luck with it, and should you succeed I'll support you in that.
Permalink SaveTheHubble 
July 19th, 2010 12:23pm
"I guess part of my resistance to the idea is that I would really-really LIKE to have a better software-engineering basis for our systems than 'C'."

You made the point in the previous thread: "the 'state of the art' of hardware and software has not changed that much since 1972.  In 1972 we had the CPU, memory, stack, interrupts, I/O chips..."  As long as the hardware is the same, the bottom of the stack of computing will always be something C-like.

You've mentioned dozens of alternatives to C that aren't really alternatives to C.  They're all endeavors to replace C and then do half a dozen other experimental things.  Nobody has ever focused on developing a languages that's just a nice procedural systems languages that fixes the problems with C and does nothing more.  It's classic second system syndrome and of course they're all doomed to failure.
Permalink Wayne 
July 19th, 2010 12:33pm
There has always been Pascal, which has all that you ask for: procedural and more readable. And it could always do what C could.

But in the USA it was somehow not cool enough.
Permalink Attila 
July 19th, 2010 1:12pm
Well, to be fair Atilla, "Standard Pascal" had more warts than 'C' ever did.  But Borland and Turbo Pascal corrected almost all those warts -- good string handling, access to the underlying machine, a built-in assembler, $INCLUDE facilities, flexible ordering of TYPE/VAR/CONST sections -- if ONLY that had become part of "Standard Pascal" back in 1978, and Unix implemented in it, things might have been very different today.
Permalink SaveTheHubble 
July 19th, 2010 2:09pm
Alas, maybe we all wouldn't have had to track down memory leaks all these years.
Permalink not CC 
July 19th, 2010 3:36pm
"A replacement for C...should have...standards that define every aspect of the language leaving nothing undefined or implementation specific"

How could this be possible in a language suitable for systems programming? By definition such a language should be able to optimize for the hardware it is targeting and yet hardware varies. If you abstract away hardware details that might change from one platform to another you are introducing potential inefficiencies in the code. I am not sure that is desirable.
Permalink Q 
July 19th, 2010 4:00pm
C is already an abstraction away from the details of the underlying platform.  ARM, for example, don't have an integer divide opcode but you can still divide in C. 

I'm not saying that language should abstract away the details so much as provide for them all.
Permalink Wayne 
July 19th, 2010 4:31pm
Implementation specific will stay, but it'd be desirable to remove undefined behavior.
Permalink Rick in BC 
July 19th, 2010 9:46pm
You cannot leave in implementation specific behavior without also leaving in undefined behavior.
Permalink Aaron 
July 19th, 2010 10:38pm
Probably very difficult, but may not be impossible.
Permalink Rick in BC 
July 20th, 2010 12:05am
I don't agree that C should be replaced. Nor even that it can be, although that depends on how you define "replace". Do agree it has shortcomings, which are well documented. Don't agree with defining away implementation-specific behaviour.

C grew dominant because of what it was, which was small and easily extended. Any change that calls itself an improvement will respect that and not seek to change it. This limits the actual changes that can be made. The best approach might be a second standard library that adds functionality.

A few things to reduce development time would be nice. You can already do OO programming in C using structs but function pointers are not an ideal mode of programming so adding classes would be logical and useful. This opens up lots of options for improving perceived flaws. Buffer overruns and pointers are two areas that slow down development but could benefit from this approach.

Named scopes would be nice. My compiler has those.

It would be nice to do away with header files and macros since they resulted from architectural decisions that would be made differently today. Maybe a schizophrenic compiler that via a switch can either use the old way or the new way? Better discipline on the part of the programmer is probably the more practical route, though.
Permalink less is more 
July 20th, 2010 7:29am
Metadata compiled into the binary can help with that.  Java class files and .Net go a long way toward it, but .tlb type libraries predate both of those.  It's damned ugly, but done properly, it can help remove the need for header files.
Permalink Aaron 
July 20th, 2010 9:49am
People. C will never be replaced. If we still have electricity and computers in 2100, people will be programming in C.

Heck, there'll still be mainframes and Cobol then.
Permalink not CC 
July 20th, 2010 10:20am
Effectively, mainframes and COBOL have been replaced -- in that the vast majority of programmers don't use them.  Even if C is replaced with something better (and nearly everyone on this topic agrees something better is possible), C won't just go away.
Permalink Wayne 
July 20th, 2010 1:23pm
I think the Order of Liebowitz will be using Cobol and C on pen and paper long after all the lights go out.
Permalink Aaron 
July 20th, 2010 4:10pm
A Canticle for Liebowitz would have made a great movie (or trilogy). I tried convincing my uncle (at the time, a major movie exec), but he was a salesman, not a creative.

Oh well.
Permalink not CC 
July 20th, 2010 5:28pm
hi,

if you do not want to program in C then you should try
Ada 2005.
Benefits:
(1) type safety
(2) high semantic level
(3) OOP
(4) parallelism
(5) normalization
(6) used in many "safety critical" or "mission-critical"
applications (Boeing, Airbus, TGV, Satellites,...)
(7) bindings with C, C++
(8) interface with Java
(9) low level (bit manipulation)
etc...

In fact Ada 2005 is simply the most powerful imperative
language today so far.

Google "Ada" & "Gnat" if you want more details.

Regards
Gilbert
An old Ada / Fortran / C / Pascal programmer
Permalink Send private email gilbert vissio 
July 21st, 2010 8:08am

This topic is archived. No further replies will be accepted.

Other topics: July, 2010 Other topics: July, 2010 Recent topics Recent topics