On 11/15/2017 2:10 AM, David Brown wrote:
> On 15/11/17 00:19, Rick C. Hodgin wrote:
>> On Tuesday, November 14, 2017 at 5:13:13 PM UTC-5, Lynn McGuire wrote:
>>> "The long goodbye to C" by Eric Raymond
>>>
http://esr.ibiblio.org/?p=7711
>>>
>>> "I was thinking a couple of days ago about the new wave of systems
>>> languages now challenging C for its place at the top of the
>>> systems-programming heap – Go and Rust, in particular. I reached a
>>> startling realization – I have 35 years of experience in C. I write C
>>> code pretty much every week, but I can no longer remember when I last
>>> started a new project in C!"
>>>
>>> I doubt it.
>>>
>>> Lynn
>>
>> It's true. Unless C evolves, it will be slowly relegated to only
>> niche markets, and will die as a language for any real projects.
>
> So what? If a language is not suitable for new projects, then that is
> because there are better choices - so use them. Lots of languages and
> tools that were fantastic in their day are no longer particularly
> relevant. How many new projects are written in Pascal? Fortran?
> Basic? The answer is a few - they are still the best choice in niche cases.
>
> C needs to evolve to allow us to work with existing C code, and to allow
> us to write code in C in situations where C is still the best language
> choice. It does not need to move into new areas, or make big changes -
> that would reduce its usefulness in existing situations where simplicity
> and stability are key. C will /never/ be a modern language, and no
> amount of "evolution" will make it one - when you put enough into C to
> get a modern language you end up with C++, Objective-C, Rust, etc. - all
> fine languages for their use, and all tracing their roots back to C, but
> none of them /are/ C.
>
I tried before doing a variant of C with more aggressive tweaks (which I
had called "C-Aux"), but even if it worked with "90% of the code", that
last "10%" was enough to sort of ruin things, causing me to later
back-track and make it (semantically at least) a more proper C.
I generally needed something which "compiled C"; and some of the more
aggressive features ran into roadblocks, *1. it wasn't really sufficient
if it looked like C but still required fairly extensive editing to get
things to compile in it.
as well, had ended up implementing some features I hadn't originally
intended on, namely support for K&R decl's, missing prototypes, and
implicit int, as I was running into code which needed them.
though a few extensions remain:
__float16 / "short float"
__int128 and __float128
__variant (dynamically-typed tagged references)
...
a lot of these are implemented internally mostly using runtime calls;
and __variant exists mostly because I wanted to possibly target my BS2
language to the same backend, and by this point it is more of a "may as
well" feature (and at this point makes no claim of being particularly
fast nor all that useful).
the partial exception is float16, which in nearly every context is
equivalent to float; the main exceptions being arrays, pointers, and
structs.
there are various other extension, but most aren't too far off from
things which already exist in GCC and MSVC, and in most cases serve
basically the same purpose (though, for various reasons, the language
features and similar more closely align with those of MSVC than those of
GCC).
*1: I had originally planned to, in some cases, defer parts of the
preprocessor to a much later stage (such as load-time or AOT/JIT time);
and also to try to blur the line between 32 and 64-bit code enough that
the same IL code could be used with either width.
one problem that became a bit problematic was that different typedef's
for various types would exist depending on architecture-related
#define's, struct fields (or sometimes entire structs) may exist or not
exist depending on these defines, ... and the relevant machinery for
dealing with this never got implemented (and, without this, the code is
basically already target-specific once it comes out of the preprocessor).
my BS2 language has this mechanism, but differs in that it is actually
built into the language (and its capabilities are much more narrowly
defined than the C preprocessor).
this has become less relevant though, as now I am mostly using it to
spit out native-code PE/COFF binaries (albeit not for x86 or similar).
albeit, the internal compiler pipeline is very different from more
traditional compilers (eg: translation units are all compiled together;
there is no separate assembler or linker stage; ...).
the closest it has to object files is basically a stack-machine bytecode
it can spit out, basically as a IL for dealing with statically-linked
libraries (given it would be kind of silly to pull in and compile the
source for the C runtime library and similar every time the program is
being recompiled).
>>
>> The whole purpose of CAlive is to inject new life into C by bringing
>> forward some of the features of other languages, and to introduce new
>> features, while maintaining backward compatibility.
>
>
> CAlive is not C - it is a totally different language designed in a
> different way for a different purpose. That is absolutely fine - we
> don't need another C, because we already /have/ C. Make your language
> the way you want, but stop trying to kid yourself that it is the "future
> of C" or "evolved C". Adding some way to support C code does not make
> it an enhanced C any more than a C compiler's "asm" statement means that
> C is an enhanced assembly.
>
I had thought a few times of basically trying to go the other direction
with my BS2 language, and basically try to make it work "bare-metal".
haven't done so though as there is basically "too much other stuff going
on":
doing a C compiler for both a 32-bit and 64-bit versions of an ISA;
and the CPU emulator for both ISA variants;
and trying to do CPU Core implementations in Verilog;
...
is basically enough to eat a mountain of time as-is, so, "make BS2
usable as a systems" language has sort of fallen by the wayside.
could describe the ISA's, but this would basically be somewhat OT here,
but will say that they are basically tweaked/extended variants of the SH
ISA (the 32-bit ISA deriving fairly directly from the Hitachi SH4).
though, if I had infinite time/energy, I might also consider targeting
ARM/Thumb and RISC-V.
>>
>> It is obvious to anyone who is looking: C is dying quickly due to
>> the age of visual languages, and computers fast enough to run much
>> slower code written in other languages faster than the fastest C
>> could do on the CPUs available earlier this century.
>>
>
> Again, so what? If it makes more sense to write a program in Python, or
> Rust, or APL - then write the program in those languages. There can be
> many good reasons for choosing C as the language for a new project -
> "because it is C" is /not/ one of them.
>
I suspect it is more a case of "C has the properties which make it C"
rather than "C because it is named C".
many of the languages which have aimed to replace C fail in one or more
ways to make them an attractive alternative for much of what I am doing.
admittedly, one of the closest of the "mainstream" languages to seem
like a viable alternative (at least for tools and application software)
is probably C#; if for no other reason that it is slightly less stupidly
painful to write code in than Java.
there is "C++", which while not a terrible language per-se, it has the
big drawback of the whole "Modern C++" community (where it is a
discouragement to use the language in the face of crowds of people being
like "You are doing it wrong!"; and me being like "but I want build
times and memory usage that aren't sh**..."; and want code that is not
some cryptic mess of template gobbledygook).
I sort of like my own language, but this is probably a given, and it
still isn't really a great language for writing "serious" software in
(doesn't produce standalone native binaries and its approach to
"library" has thus far basically been more of "lol, yeah, just use the
FFI to call into C land"; had sort of intended at one point to make it
import/export COM interfaces, but never really got around to it, ...).
>> The times, they are a changin'.
>>
>
> True. So change with them, rather than clinging on to the past.
>
> There are plenty of "niche areas" for C as yet. People who want to
> program in C will find lots to do for a long time to come. It is only
> the people that insist that they will use C regardless of the task, that
> will have trouble.
>
personally, most of the time I still end up using C though (and
sometimes C++, but I prefer to keep quiet about this...).
haven't encountered too many scenarios where these don't work
adequately, or where there is an obvious "more clearly better"
alternative. (well, nevermind special-purpose languages, like G-Code and
Verilog and similar).