GM-Free Programming and the Matriculation of K...

Products and tips

Moderator: Site Mods

Post Reply
Kilmatead
Platinum Member
Platinum Member
Posts: 4569
Joined: 2008 Sep 30, 06:52
Location: Dublin

GM-Free Programming and the Matriculation of K...

Post by Kilmatead » 2015 Sep 18, 15:30

A writer and an editor were walking across the desert, both of them dying of thirst...

"Not to interrupt you or anything, but before you get started on one of your long boring introductions, I should point out that I already scrolled down to the picture and this looks suspiciously like that thing you wrote before... what's the deal?"

Yeah, it's basically the same thing. If anything, it actually has less functionality.

"But why are you always rewriting things you already wrote? Have you run out of original ideas? And of all the things to rewrite, why choose the one that nobody ever used in the first place?"

You don't know what it's like - every day Nikos sends me hateful email calling me a "script kiddie" and generally denigrating my endeavours with AutoIt - he throws sand in my face and everything - he's just a big bully and it begins to wear down my self-esteem. So I seek comfort in the things I know. :wink:

"Well, ok, I can understand that - he always did come across as a bit aloof - but what's so special about this utility thing? Most people don't even know what Reparse-Points are, never mind want to mess around with them. Can't you just write nice pleasant helpful script for once that doesn't involve all your usual technical rigmarole? Not everything needs to be explained in excruciating detail you know!"

They say the devil is in the details, and there's a few things about this project that aren't immediately obvious to the casual reader; it contained all the ingredients that I needed: 1) The stuff "behind the scenes" was sufficiently complex to be challenging, yet familiar enough to be achievable, and 2) the GUI element was both simple and yet deceptively complex at the same time. It's really this last thing that was the crux.

"Ok, fine, I'll hear you out: make it good though, my attention span hasn't improved in recent years. And since Google went and changed their logo last week, nothing has been the same in my life - why does everyone always feel the need to mess with crap that doesn't need fixing?"

And that, curiously enough, is what it's all about. In the last few years the AutoIt scripts that I've been writing have begun to develop a rather schizophrenic disposition: on the one hand they're containing more and more technical esoterica from the Windows API, while on the other being smothered in the simplicity of scripting where everything is designed (to put it bluntly) for idiots. So I decided to finally do something about this imbalance, and therein started a little adventure of getting sidetracked by one thing after another. :D

So, to put it simply, the last time I wrote a programme in a non-scripting language was at least 25 years ago. Back then there weren't any GUI's - or, rather, there were, but they were Windows made of textually drawn elements and inverted-colour backgrounds meant to give the impression of dimensionality - but, well, like the rest of life, it was all just clever fakery.

And then I put aside my childhood toys and walked away from computers (and everything else) never to touch another one for about 16 years. You'll never see or experience anything of the real world (the subtlety of pain, the deception of suffering, real loneliness in a historical perspective) if you're using a computer, or computerised toy. Throw away your smart-phones kids! Let thee delude thyself no longer! :wink:

But about 7 years ago I built a PC from parts for a lark, just to see what's new and different. And I thought to myself, "I know, I'll get myself a copy of Visual Studio and get back into this C thing!" Well, it turns out that in the intervening years all sorts of bullshit was added to Windows: ATL, MFC, WTL, .NET and some idiot even added "++" to the good old trusty C language! Ugh, the audacity of change and so-called progress! Fakery! Nonsense! Balderdash!

To put a long story short, I never could get comfortable with Visual Studio. It always seemed to install gigabytes of so-called "helpful" rubbish that I never wanted... I don't need services for managing SQL, thank you... no, I won't be developing "Web-Apps" or "Phone-Apps", no, I don't think I need my code "managed" whatever that means, and what do you mean I have to actually pay for MFC just to make a GUI? And why do all my users have to install the MS C++ Runtimes just to run something I wrote? Isn't the whole idea of "dependencies" something we should be trying to get away from? What the heck had the world come to? "Just In Time" used to mean you actually caught the bus, or didn't show up late to a funeral. Put a bunch of technocrats in charge of the world and you don't get a technological wonderland, you get a hegemony of "our way or the highway". Who put them in charge, anyway?

"Yo, dude, chill out. This is just the way it is. If you dislike it so much, maybe you should have just stayed lost in the woods for another decade, no? And are you anywhere near getting to a point? Talk about missing the bus..."

Indeed. Back when I was about 10 I attended a "hobbyist's course" in assembly language programming for the Z80 CPU architecture - because I wanted to make video games, like every other 10 year old kid, and Basic just wasn't cutting it, having no access to interrupts or screen memory, or any of that good stuff.

So I sat quietly through about 3 meetings of the club dutifully taking notes on mnemonic instructions, popping of registers, and all the other stuff - until I finally got fed up and asked for a real world example that could make a segmented-caterpillar float across the screen smoothly. I was just one of those people who learned better "backwards" by taking a working sample of something and backtracking until it was broken down into its component parts. Now, naturally, this didn't work with everything - like I never really understood how all those funny-smelling glowing television-tubes resulted in Bugs Bunny or Gilligan's Island. That was just hocus-pocus... but I reckoned that if I could grasp the relationship of balanced-byte mnemonic coding and this thing appearing on the screen I would have a foothold to work with.

The same thing applies these days. Did you ever try to read one of those books like "C++ for Dummies"? I just can't get enthused copying console programmes about converting Celsius to Fahrenheit and back again. And besides, I always had this sneaky suspicion that traditional ANSI C was like Chess, and C++ was kind of like what would happen if someone said "Wouldn't it be great if we could create a cross between Chess, Scrabble, and some crazy card-game? That would be really cool!" Turns out that it's not very cool - it's just 99.9% unnecessary. It's beyond me how it ever caught on. And then there's C# which doesn't seem to have anything to do with C at all... it doesn't even have pointers... it's kind of like a dumbed-down version of Java re-branded for grown-ups (because no one would take a Java-clone seriously on its own so they renamed it after a respected language thinking more people would use it). What a mess.

But I digress.

Probably the most astonishing open-source project known to the computer world is the GCC. On the Windows end of things, that means MinGW, or, better yet, one of its forks, the TDM-GCC MinGW Compiler which allows for seamless x86/x64 target compilations, without any of the nonsense that Visual Studio throws at you. Combine that with a decent IDE, such as CodeBlocks, and you've got yourself a party - a few hundred MB's of disc-space used, and absolutely no installation (of anything!) is required. Kinds of makes you wonder exactly what all that crap in Visual Studio really is - they don't even allow off-line documentation anymore.

"Now hold on a minute! I know all those projects - I used Audacity back in the day, and Gimp, and all that good stuff the cool kids are using instead of paying for other things. I hate the interfaces, though - they always look so old and small, and never seem to act like native Windows applications."

That's because (just like Windows and its MFC, ATL/WTL stuff) they're not creating GUI's natively, they're using wrappers and substitute functions and cross-platform libraries which are designed to make life easier. After all, you don't want to maintain two or three code-bases for Linux, Mac, and Windows just for some silly GUI nonsense, do you? I mean, if some widget-class makes things easier, and doesn't add too much flab to the EXE, what's the harm?

"But I don't care about Linux or Mac - I just want to write stuff for Windows - and these free-compiler things won't go near the proprietary MFC stuff, and (no matter what Nikos says) WTL still looks like rubbish! Isn't writing things in 'pure API' too hard for beginners?"

Yeah, that's what I thought. And don't get me wrong: it's not easy. The Win32API is a scary place when you don't know what you're doing, and you don't even have a resource editor to work with.

"Wait - no resource editor? You mean I have to design a GUI by hand? How does that work? I thought everyone just dragged and dropped controls (checkboxes, combo-boxes, labels, etc) around a grid and let the system take care of the funny stuff?"

Well, yes, most people do it that way - they've never really known anything else. And beginners love it - designing a GUI using a proper resource-editor (say, in Visual Studio) is a really easy thing to do.

"But...? I can hear the sound of a 'But' coming on... What's wrong with just pointing me at something like The Forger's Win32 API Tutorial and jumping in?"

And that's exactly what I'm doing. A great place to start learning - simple examples, etc. Except - there are a few things they don't tell you that are necessary for the modern age.

For instance, the API has no built-in adaptation for high DPI adjustments - you either rely upon Windows awful DPI-Virtualisation or do it manually. Except they don't tell you how to do it manually. And to be honest, I don't know how to do it either, I've seen some examples where it's done in the WM_PAINT callback, but that doesn't always end up the way it seems like it should - so I used the Bull-In-The-China shop approach and did it myself, which works perfectly.

Another thing (that everyone takes for granted) is that when a GUI window's borders are "adjustable" the controls therein grow/shrink move according to certain docking parameters as the user drags the edges around. What they don't tell you is that there's absolutely no relative control docking built into the API. You have to do it manually. And so I did. :D

Basically what you're looking at here is a gigantic "proof of concept" (much like the original script was!), which serves as an example of how to do some of the more esoteric (yet still necessary) stuff of GUI design, that the Win32API tutorials don't usually address. (For example, for someone used to a scripting environment, just getting a bit of text to change colour according to certain conditions is surprisingly difficult!)

Remember, this GUI looks simple, but there's a lot of stuff "under the hood" which is not immediately obvious.

Image

Download: Touch Reparse-Point (C-Version) 1.0.1.0 (Last updated 18-Sep-2015)

Points of interest for the perusing user:

- 100% pure WinAPI ("Doin' it the hard way!")
- No MFC, ATL/WTL or 3rd-party dependencies
- 100% C-Language from the ground up, without any external DLL's, etc
- Made with 100% portable free tools (nothing need be "installed" to build it from scratch)
- Fully DPI-ratio adaptive
- Full (horizontal) control docking when expanding/contracting
- Unicode (everything, including the stuff you can't see)
- Embedded manifest allowing for DPI and theme adaptation
- Expected information when mousing-over the EXE in a file-manager
- Tooltips
- Correctly sized icon extraction for GUI and taskbar
- Multiple font sizes/types throughout, none default
- Multiple types of accelerator handling (not done as a resource!)
- Menus done manually (again, not as a resource!)
- Drag-n-Drop items from a file-manager
- Copy text from static label into clipboard just by clicking on it
- Command-line options and sub-options
- Auto-moving pointer to default controls (respecting user's choice in system settings)
- Auto-centring of main window (again DPI adaptive)
- GUI designed and created entirely without a resource-editor of any kind

Now, any normal developer would just look at that and say, "Yeah, so what?" And true - nothing in this list is ground-breaking - but for beginners these things are not easy to do when the internet does not provide as many examples as one would hope. And we will also note that very few developers could do it all without a resource-editor, and using only what the API gives them. :wink:

And remember - I haven't written a C programme in 25 years: this is just my humble version of Hello World for the modern age. :D

Naturally, all the functions of the programme work as expected (it is meant to be a practical example after all), though they are somewhat limited (it's a proof of concept, remember). But overall there's enough here to be interesting... numerous user-selectable timestamp formats, millisecond-display, etc.

Also, the original foundation for the project (the function that returns the target and type of any Reparse-Point) has been translated into C and is all the better for it, including auto-matching Mount-Point GUID's to logical hard-drives, etc.

One last thing of interest to developers:

As part of the GetReparseTarget() functionality, I had a line that detected a GUID by RegExp to differentiate Mount-Points from mere Junctions. While this was a simple thing to do in a scripting language, proper C does not have regular expressions. It is available as part of the C++11 standard (at the cost of some absurd EXE bloat and non-PERL compatibility), and - to be honest - is not really even necessary for this project (I could leave it out altogether and no one would notice), but in case anyone wanted an example of how to statically-link and use a RegExp in C, I decided to add it in. (It increases the EXE sizes by about 70KB which is ridiculous for just one function call, but again, this is all intended as a working-example and proof-of-concept project at the end of the day.

Of the numerous RegExp libraries available, I chose the well-known PCRE2 project, which I recompiled myself, and have included the necessary 10.20 version 16-bit (wchar_t) x64 and x86 static-linking libraries in the download.

For the curious, I also played around with the out-of-development (and C++ only) DEELX library too, which (at a single file) is rather easy to self-compile, though in small tests is slightly slower than PCRE. I prefer PCRE simply because it's still in development (and has been for the last 18 years) with a recent update just this summer. It's also the same library used in AutoIt, so it's compatible with everything I already learned about RegExp patterns. :wink:

Final note:

For anyone interested in building this project from scratch (the download includes x86 and x64 EXE's, and all necessary source-code, plus the specific PCRE libraries mentioned above) I have included the .CBP file which is the fully-configured project-file for CodeBlocks IDE, prefigured for the TDM-GCC compiler flags setup, etc. You'll need one of the recent nightly-builds of CodeBlocks (no installation required) to take the -F pe-i386 flag which keeps the x86 build happy with its resources.

For anyone else with other compilers, there shouldn't be anything funny that you can't figure out on your own - I have used some C99 notation, but that's not enough to break anything.

Also, if anyone needs some tips for independently compiling PCRE from source, just ask. Took me a little while to figure it out before I got it right.

Thanks for reading. Image

"Wait, you didn't finish your joke..."

A Writer and an Editor were walking across the desert, both of them dying of thirst. When they crested a hill and found an oasis with a pool of water, the Writer rushed forward and thrust his face into the pool to drink.

At the same time, he heard the Editor behind him and looked up, astonished at what he saw, for the Editor was standing there urinating into the pool of water.

"What the heck are you doing?!" the Writer decried.

"It's okay," the Editor said, "I'm making it better."

* * *

And that, for anyone who has read this far, is my comment on how the "++" got into C, and how the MFT/ATL/WTL got in the way of learning about the API and how Windows really works.
Last edited by Kilmatead on 2017 Mar 25, 11:44, edited 1 time in total.

Brig
Silver Member
Silver Member
Posts: 212
Joined: 2002 Aug 05, 16:01
Location: Michigan

Re: GM-Free Programming and the Matriculation of K...

Post by Brig » 2015 Sep 18, 18:00

1. As an editor I am deeply offended by your joke.
2. The best joke in your . . . offering is this:
To put a long story short, . . .
3. What does your program do?
4. :D

Kilmatead
Platinum Member
Platinum Member
Posts: 4569
Joined: 2008 Sep 30, 06:52
Location: Dublin

Re: GM-Free Programming and the Matriculation of K...

Post by Kilmatead » 2015 Sep 18, 18:40

Brig wrote:1. As an editor I am deeply offended by your joke.
It's actually derived from an old army joke, but I can't find the original reference. :shrug:

It must be frustrating to know that you only get <Edit> buttons for your own posts, eh? You are a hunted species, you know that? Never mind that the idea of a lad from the Lake District editing stuff in America is just begging to be made into a malapropist manifesto. Species <> Specious, etc... you begin to get my drift. :wink: I mean, there's a reason no one asked Hunter S. Thomson to edit the posthumous letters of C.S. Lewis, and vice-versa.

God bless the rise of vanity press, eh? <Cough>

And, actually, I meant to include a (true!) story about how when I went looking for some information on C Strings (of the wchar_t vector variety), I inadvertently discovered it has been a very long time since I was at the beach. I am seriously getting old.
Brig wrote:3. What does your program do?
Not sure if you're serious, but just in case others are confused, it's derived from this script, which (purely coincidentally, another rambling tome of a failed dialectic) is a utility that correlates the timestamps of Reparse-Points with the timestamps of those objects they point to, if they have somehow drifted apart over time, like all young lovers must. (It's harder to do through manual user-intervention than you might otherwise think.)

If that idea does not fill your heart with unmitigated joy for man's triumph over the perils of nature's indifference, then I don't know what would. I mean, who wouldn't think such a programme could become more popular than sliced bread? Strangely enough, my original goal of using it as a chick-magnet has yet to pan-out as I had once hoped.

'Tis a mystery to me, but I soldier on in despite the forces of evil weighed against me. :D
Proverbs {26:11} wrote:Sicut canis, qui revertitur ad vomitum suum, sic imprudens, qui iterat stultitiam suam.

Brig
Silver Member
Silver Member
Posts: 212
Joined: 2002 Aug 05, 16:01
Location: Michigan

Re: GM-Free Programming and the Matriculation of K...

Post by Brig » 2015 Sep 18, 21:13

Kilmatead wrote:
Proverbs {26:11} wrote:Sicut canis, qui revertitur ad vomitum suum, sic imprudens, qui iterat stultitiam suam.
Dogs don't mind it one bit. If they could read our facial expressions and speak they'd say, "What? Why not?" And we're all dogs. Arf arf.

Also, remember: All the great authors had/have editors.

User avatar
nikos
Site Admin
Site Admin
Posts: 14648
Joined: 2002 Feb 07, 15:57
Location: UK
Contact:

Re: GM-Free Programming and the Matriculation of K...

Post by nikos » 2015 Sep 19, 06:45

bravo :)
next time I should expect nothing less from you but something done in pure assembly language
extra credits for doing it in punch cards too!

Kilmatead
Platinum Member
Platinum Member
Posts: 4569
Joined: 2008 Sep 30, 06:52
Location: Dublin

Re: GM-Free Programming and the Matriculation of K...

Post by Kilmatead » 2016 Aug 19, 11:05

As part of the transition to lingua-franca C coding, the plugin manager for xplorer2/TC Plugins was another step in the process, but I never got around to releasing the source-code for it - and seems reasonable it should live in this thread.

From a WinAPI GUI perspective, this includes everything from context-menus with in-menu-icons to colour-coding individual listview cells to child-windows to drag/drop from elevated processes, etc, etc - none of which is particularly easy to do as a beginner nor to find source-code examples for on the 'net.

We will note that there have been a few unannounced updates to x2PluginConsul since it was first released last year, so the current version is 1.0.0.7 for anyone interested. These changes have been minor (hence the reason they were not announced), but things add up. :wink:

Get the latest version of the EXE from the blog above (and try out some plugins!), while the latest source-code (for those who wish to peruse or compile it themselves) can always be found from the link below.

x2PluginConsul Sources
Last edited by Kilmatead on 2017 Mar 25, 11:46, edited 1 time in total.

Tuxman
Platinum Member
Platinum Member
Posts: 1492
Joined: 2009 Aug 19, 07:49

Re: GM-Free Programming and the Matriculation of K...

Post by Tuxman » 2016 Aug 19, 17:59

Kilmatead wrote:As part of the transition to lingua-franca C coding
Which is generally considered a horrible idea. Did you know that C is so small because it's not much more than a crippled ALGOL60? :shrug:
Tux. ; tuxproject.de ; Windows 10 x64
registered xplorer² pro user since Oct 2009, ultimated in Mar 2012

Kilmatead
Platinum Member
Platinum Member
Posts: 4569
Joined: 2008 Sep 30, 06:52
Location: Dublin

Re: GM-Free Programming and the Matriculation of K...

Post by Kilmatead » 2016 Aug 19, 19:20

And in turn Algol (in one form or another) was the lingua-franca of its own bygone era of the Fortran and Cobol religions. That it influenced Pascal so heavily made it rather practical for the kids to retroactively write their own Algol interpreters in Pascal itself, once that language made it to the home-machine market (it was more fun than Pong, to be sure!).

But, all things must come to an end and eventually one of your children must surpass the others - and in the current era, that language is C. Sure, the actual use of pure C is diminished these days, because the kids are always drawn to the shiny and the new, but pretty much all modern languages have (if nothing else) a syntactical heritage to come to terms with, and syntax is always at the heart of learning.

Personally, I consider almost all these pretenders to be over-valued tosh (C++, and C# in particular), but that's me, and I'm happy in the conservative little world of my own making. :wink: As it's not my place to tell others what to use, I don't worry much about the tides and vicissitudes of so-called "progress".

That C is small is not because it's a cut-down Algol (which, we will note didn't even have built in IO as part of the standard), C is small because it's one-step up from the assembly underpinning the modern age for which it was meant to predictably simplify. "Predictively" being the operative term there... one can look at C-code and reliably predict how the compiler will (usually) break down, optimise, or otherwise mangle the programmer's original intent. This is rather important on the machine level. But, as always, few people care about that in these days of sloth, waste, and excess where everything is abstracted away behind mountains of objects with so few noble objectives left to pursue.

While it's fun to be aggressively retro from time to time (ah, those interpreters!, be still my heart), there are practical considerations to the real world, and the shiny tosh and froth the kids so enjoy have claimed the day. Let them have it, I say, for the source ultimately shines through in the end, and ever since the days of the pyramid-builders it's pretty clear that easier never means better, no matter how loud the shouting. But then, there are always limits to one's masochism the older one gets. :D

Tuxman
Platinum Member
Platinum Member
Posts: 1492
Joined: 2009 Aug 19, 07:49

Re: GM-Free Programming and the Matriculation of K...

Post by Tuxman » 2016 Aug 19, 20:24

Kilmatead wrote:And in turn Algol (in one form or another) was the lingua-franca of its own bygone era of the Fortran and Cobol religions.
COBOL is interesting because of its (seeming) total lack of actual syntax, except "please leave room for line numbers and punch holes on the sides". I wrote a website in COBOL with FastCGI a few weeks ago just because I wanted to know how it feels (plus, you can't ever know too many languages, can you?). I'm still shocked. A few days later I found a small TCP server/client application written in COBOL. I'm still unsure if I should go deeper. :shrug:

But probably, some day, I will be the last hope for a large financial company with old mainframes in their cellar. My day will come.
Kilmatead wrote:That it influenced Pascal so heavily made it rather practical for the kids to retroactively write their own Algol interpreters in Pascal itself, once that language made it to the home-machine market (it was more fun than Pong, to be sure!).
Pascal being a "teaching language" (actually, just like Python...) doesn't make things easier. I still plan to give Free Pascal another try after not having touched Delphi for almost two decades. It's funny to see that people recommend to start programming in Go "because it compiles so fast", which has been a major advantage of Wirth's compiler half a century ago.

I don't get that hipster fashion.
Kilmatead wrote:But, all things must come to an end
No, they don't.
Kilmatead wrote:That C is small is not because it's a cut-down Algol
Yes, it is. :biggrin:

The Universities of London and Cambridge were among the first to implement aspects of ALGOL60 into a language named CPL as their upcoming Titan computer desperately needed software and Fortran was - more or less - an IBM thing. One of the major problem was that their EDSAC "computer", which was what they had before Titan could even be built, lacked sufficient resources to keep on pace. Thus, CPL was abandoned and reinvented as BCPL, more or less a "less complex CPL, but with pointers". (Yay, pointers.)

Accidentally, other people at Cambridge were working on Multics at that time, so BCPL was added as an alternative for EPL, Multics's primary language (some PL/1 dialect). When Bell Labs cancelled Multics in 1969 (just to sell it to Honeywell some time later), Ken Thompson and Dennis Ritchie were "degraded" from their 36-bit machines (GE-600) to 18-bit PDP-7s, meaning that Multics wouldn't work there, nor did BCPL. Thompson decided to cut down BCPL further so he could, at least, use it somehow. A couple of weird syntax changes later, the B language was ready and somewhat usable, although it didn't really come to shine yet as the new Unics/Unix project took a good part of their time. (There are reasons why the first three Unix releases were mostly written in Assembly, don't you think?)

Someone made the mistake :biggrin: to grant them access to a PDP-11 machine during that time. The PDP-11 was byte-oriented while the PDP-7 was word-oriented. B was "ported" with a good number of changes again, resulting in the first version of C, optimized for a couple of very specific tasks, namely to be "good enough" for Unix. In 1973, struct was added, and in 1977 there were finally attempts to make Unix (and C) portable to a wider variety of platforms. (Somehow, it was the year Bill Joy decided to release 1BSD, so Unix started to become "a big thing".) So, no, C was not a "step up from the assembly underpinning the modern age", C was a step down from its ALGOL roots so it could run on low-end hardware.

I doubt there even is hardware weak enough to require such decisions in 2016.
Tux. ; tuxproject.de ; Windows 10 x64
registered xplorer² pro user since Oct 2009, ultimated in Mar 2012

Kilmatead
Platinum Member
Platinum Member
Posts: 4569
Joined: 2008 Sep 30, 06:52
Location: Dublin

Re: GM-Free Programming and the Matriculation of K...

Post by Kilmatead » 2016 Aug 19, 22:03

Nice history: it's about time you wrote something contributively cogent! 8) Normally you spend too much time thinking this place is a damn chatroom. :wink:
Tuxman wrote:So, no, C was not a "step up from the assembly underpinning the modern age", C was a step down from its ALGOL roots so it could run on low-end hardware.
I'll contend that, but on the balance of lithe perspective, not pedantic history. Sure, the language was born to adapt to new practical limitations, but that's part of its magic, as at the time no one could conceive of not only how quickly, but how thunderously final the PDP-11 was (a wonderous machine, in my mind, before I saw and played with a VAX) in the cloistered computer world of that era. Like you say, "low end hardware" was on the horizon - except no one could imagine how low it needed to really go before the linguistic pendulum would swing again.

And then things really began to change.

And C was primed perfectly to suit a role that neither its designers nor its progenitors ever imagined: massive miniature PCB proliferation. It isn't the historical weight of the Unix legacy which underpins C's dominance (as much as the history books and neckbeard's would have us believe), it's how surprisingly well suited it was to being portable, which was an idea the corporate owned, IBM-inspired behemoths weren't prepared for (and ultimately never adapted to). It wasn't just the portability of the code, nor even the portability of the programmer himself (though that was no small freedom), it was the ability of anyone with even the most vague familiarity with Pascal to learn and deploy with relative ease on a platform independent medium.

And that platform independence owes its strengths to - yup, you guessed it - "the assembly underpinning the modern age." :wink: As the power of computers first splintered from one large centralised machine into a thousand smaller quasi-independent machines, platform "independence" called out for a cross-platform paradigm (where the real power was). And the public proliferation of what was once a cabal adopted the only language "high enough" to be learnt easily by laypersons, yet also low enough to be easily compiled for-and-upon the new architectures the PCB revolution churned out with assemblies which were themselves somewhat splintered and challenging for those same laypersons to learn.

Granted, I'm skipping a few steps and washing over others, and dismissing still more (the mainframe never really died, it just went further out of sight) but that's beside the point - hardware passes, language endures, and the sheer size of the C codebase (despite MS's best efforts to replace it with "child-friendly" functions) provides the momentum of what is - for lack of a better term - genetic memory. The trick is to be high-level enough to span the gap, yet not so feature/minutia-bloated as to be too abstracted from (and out of touch with) the hardware itself.

So, yeah - I never said C was born perfect and was somehow magically transcendent: what I did say was that it was in the right place at the right time (with the right size and shape) to adapt to the changing world - and change it did.

Most importantly, and highly relevant today, is that C is highly scalable. The languages before it (and especially now, after it) have lost sight of that, often specialising themselves in such a rut that people don't even think in terms of general-purpose anymore - it's all just pigeon-holing and secularisation. Where "general purpose" is frowned upon, the Renaissance spirit is lost. :cry:
Tuxman wrote:I doubt there even is hardware weak enough to require such decisions in 2016.
To name but one, the ARM/RISC world is nowhere near as robust nor empowered as its proliferation would suggest. Hardware "weakness" is a relative thing... as the (current) 10 and 14-nanometre SKU's challenge the very weight of Ohm's Law (electron drift), the "stall factor" is already upon us (evidenced by Intel [the current market leader, for better or worse] scrapping its tick-tock). People often make the mistake of assuming that trillions of IPC's, cheaply populated inter operative resources (motherboard design) will continue to spell out the strength of progress - largely because that's all they've ever known. That you doubt there is hardware "weak enough" in 2016 to inspire the same kind of linguistic evolution is short-sighted: a quantum world will always want for a quantum paradigm. The pity (and therefore inspiration) of progress is that the two are doomed ever unlikely to arrive at the same time. :wink:
Kilmatead wrote:...all things must come to an end
Tuxman wrote:No, they don't.
Yes, they do. :D Entropy is very real, everyone feels the truth of it in their bones eventually.

Tuxman
Platinum Member
Platinum Member
Posts: 1492
Joined: 2009 Aug 19, 07:49

Re: GM-Free Programming and the Matriculation of K...

Post by Tuxman » 2016 Aug 20, 00:11

Kilmatead wrote:Normally you spend too much time thinking this place is a damn chatroom. :wink:
lol

u funny

Seriously, though: just like in real life, I prefer to try and make my point straight away while you try to demonstrate your knowledge of English literature, Greek philosophers - no, not you, nikos - and weird economists every time before you try to tell us what you're up to. I'm probably just afraid that my humanist school education is too long gone. :shrug:
Kilmatead wrote:Sure, the language was born to adapt to new practical limitations
... which makes my statement true ...
Kilmatead wrote:"low end hardware" was on the horizon - except no one could imagine how low it needed to really go before the linguistic pendulum would swing again.
That linguistic pendulum was already in full swing not much later, at least measured in percentage, as the golden era of the device-specific operating systems had already faded away about a decade earlier: IBM had Fortran and (quite some) COBOL, there were a couple of assembly dialects and, of course, ALGOLs (e.g. Burroughs, one of those companies no one talks about anymore, had some), ... according to my (shortish) lookups, a couple of languages were invited per year, most of them at least released once. The most amusing aspect is that the century we are currently living in has not seen any new language which would not just mix up a couple of features already seen back then. I must admit that I'm somewhat disappointed by quite all of Rob Pike's later decisions. Inventing new languages for food. Sometimes I'm sad to have been born so late.

They could just have taken ALGOL68 instead because their PDP-11 would actually have been capable of running a decent version of it. NIH was invented quite early, it seems. I'm still convinced that Pascal (the one without the mandatory OOP overhead) does a lot of things better than C even on weaker machines. The ability for PCB proliferation was, obviously, only an accident while building C; in fact, the designers never planned to use C outside their new-and-shiny PDP-11 machine which was quite happy with anything according to reports.
Kilmatead wrote:it's how surprisingly well suited it was to being portable, which was an idea the corporate owned, IBM-inspired behemoths weren't prepared for (and ultimately never adapted to).
Taking into consideration that the Multics/BCPL (Unix/C) team was basically using existing public domain ideas (and probably code, it's unlikely that BCPL (and B) was (and were) started from scratch - memo to myself: I should remember to contact BCPL's author some day) by other people to help corporate owned behemoths - here: Bell Labs - to make some (success and) money, the romantic David vs. Goliath analogy might or might not collapse quite a bit. Good old times when code was just available to anyone who could afford a machine to process it.

C was "surprisingly portable" because someone invested a sufficient amount of time to avoid another incarnation of Thompson's mistake (the BCPL incident). Platform independence was never in their minds, but some day the good old ALGOL was dumbed down enough by them to not even have any non-portable features anymore, at least that's what it seems like. It's easy to port any code to a language and processor of your choice as long as it has not too many features, but C went the contrary way.

That said, Pascal was even designed to be more portable than C could ever be. :shrug: Without the historical weight of Unix, C would probably have been replaced by the next letter in the alphabet rather soon. Sadly, the PDP-11 (and, not too much after, the VAXen at the UCB) lived long enough this time so Thompson could finally stop scrapping everything whenever a new platform was available. The last actual Unix release happened in 1979 (with a number of theory papers following, ultimately leading to the Plan 9 and Inferno operating systems), leaving the rest of the work to Bill Joy's team who could just build on the now portable Unix so they didn't have to care as much about all the new machines which started to appear quite soon; to be fair, it's actually great that he didn't try to invent just another language for the next BSD Unices. His most famous approach to computer linguistics resulted in Java. He shouldn't have done that.
Kilmatead wrote:And that platform independence owes its strengths to - yup, you guessed it - "the assembly underpinning the modern age." :wink:
Yes, but, as C is not much more than a glorified collection of assembly macros, I wonder if this step between real assembly and real languages (C++, Lisp, ...) is actually required anymore. C had the major advantage of having been built for a machine which somehow gained some market share early enough, so lazyness, probably humankind's most impressive skill, could win. After having played with a number of languages from that time, I can almost safely say that being easy to learn is not really one of C's strengths compared to its contemporaries.

Some accidents have long-term consequences.
Kilmatead wrote:the mainframe never really died, it just went further out of sight
And they even try and place interesting operating systems on it. IBM still seems to make quite some money with AIX, COBOL (whyever) and room-filling computers (whyever). At least that gives me hope that being a professional developer will not be a relict of past times before my regular death arrives.
Kilmatead wrote:To name but one, the ARM/RISC world is nowhere near as robust nor empowered as its proliferation would suggest.
Mixing terms, aren't we? ;) ARM is highly overrated (acceptable for embedded machines, awful for real work), but RISC has always been the superior instruction set. Intel's CISCs (now with integrated RISC subsets so they won't have to admit that CISC is actually horrible) never gained so much traction for their superior technology; POWER and SPARC - whyever they have to capslock at me - would surely eat Intel's CPUs for breakfast. The only thing standing between them is that Intel is not actually a relevant player in their territory, which has very good reasons.

But, sticking to your example, even a cheap consumer ARM is able (and sometimes forced) to run a degenerated Java VM and a whole, sufficiently modern operating system written in blood, tears and C at the same time. If that's the minimum of how low we can go, we could as well stop using C altogether. There is no actual reason not to do that.

Except that it looks nice on your CV. Sometimes people are easy to impress.
Tux. ; tuxproject.de ; Windows 10 x64
registered xplorer² pro user since Oct 2009, ultimated in Mar 2012

Kilmatead
Platinum Member
Platinum Member
Posts: 4569
Joined: 2008 Sep 30, 06:52
Location: Dublin

Re: GM-Free Programming and the Matriculation of K...

Post by Kilmatead » 2016 Aug 20, 09:44

Tuxman wrote:I prefer to try and make my point straight away while you try to demonstrate your knowledge of English literature, Greek philosophers [...] and weird economists every time before you try to tell us what you're up to. I'm probably just afraid that my humanist school education is too long gone.
You've got your own little Wagnerian thing going on in your head, don't you? :D Then again, don't we all; keeps the neighbours and cobwebs away, at least. Germans used to have a grand intellectual tradition of questioning everything there was to question, especially the awful limited shell of the human experience. Doesn't anyone (besides musicians) read Schopenhauer anymore? I mean, seriously, I spent years trying desperately to get beyond the rancid personalities of the French writers by embracing the joyfully remote Germans... (and yes, I shamefully admit I spent at least one summer with my head in a guitar and at least two well-thumbed Nietzschean treatises) - it isn't just people who are easily impressed with a polytheist CV, it's women. :wink:

(And name just one "weird economist" I may have mentioned. Just one! Not my bag, man, Hobbes and Voltaire don't count, since they, like you, only used economics to "get their point across straight away"... and they, like you, forgot about the unfairness of the fog of war in intellectual volleyball.)

Now, where were we? Ah yes...
Tuxman wrote:The most amusing aspect is that the century we are currently living in has not seen any new language which would not just mix up a couple of features already seen back then.
Lingua-bloody-franca my good man, there's a reason S. I. Hayakawa is the defacto "go-to guy" for semantic inquiry. He would have loved ALGOL, not for the monolithic block approach it took to regularising the painful details of Fortran, but for its ability to invite (yet not quite achieve) that context-free grammar so beloved of (God, I really want to say "economists" here just for fun, but my brain is fighting my fingers)... of... of... pointer ambiguity. (There, that should impress a girl or two. :D The weird ones, maybe. :shrug:)
Tuxman wrote:I'm still convinced that Pascal (the one without the mandatory OOP overhead) does a lot of things better than C even on weaker machines. The ability for PCB proliferation was, obviously, only an accident while building C
True, but a happy accident... functional/procedural languages really make the girls swoon if you focus on getting something done and getting something else back at roughly the same time - but when many machines (or "cores", these days) are bedfellows, the old lectures on concurrency begin to resurrect bad memories... just the other day I was experimenting with what would happen if a function launched a thread of itself recursively. That it gets messy was the least my problems (I like breaking things :D), but I learned great respect for the void pointer concept along the way.

Weirdly, that's one of the things I like about C... it's pretty forgiving when you've got that "self-harm" look in your eye and you want to pass a whole bunch of parameters in a structure without worrying about all the variable types conflicting by a byte or two. C just says, "ah here, void the damn thing and get on with it - sure it's going to bite you in the arse later but have fun".
Tuxman wrote:It's easy to port any code to a language and processor of your choice as long as it has not too many features, but C went the contrary way. [...] That said, Pascal was even designed to be more portable than C could ever be.
As pretty much most of your examples have shown (historically), the gulf between what was designed and what actually came out of it are two different things (one of the reasons ALGOL was more influential in its disappearance than it was in its life, outside of academic programme design). I think Pascal promised a lot (I loved learning it, but for me it was just a stepping stone into C, which is just dirty enough to make me laugh and tear my hair out at the same time). Pascal never gave me that feeling, but then to be honest I didn't stick with it that long. Once I hit C and pointers (and girls and guitars and Nietzsche :D), it all just made sense. But that's the way my brain works...
Tuxman wrote:...as C is not much more than a glorified collection of assembly macros, I wonder if this step between real assembly and real languages (C++, Lisp, ...) is actually required anymore.
Aside from proving my point (and thank you for that), you wound me, sir! Wound, I say! Oh, the humanity of it all. :cry: (But don't confuse higher-level with real... power is a relative thing when you praise the secularising of the faint, and miss the proverbial forest for the trees.)
Tuxman wrote:I can almost safely say that being easy to learn is not really one of C's strengths
But, in your own words, it's so small... if there's a question of fault here, ease-of-learning is without a doubt in the eye-of-the-beholder; we always bemoan that (perceived simplicity) which was lost to history - no more so than when someone who isn't us decides on the compromise.
Tuxman wrote:Mixing terms, aren't we? ("ARM/RISC")
Well, yeah - that's my point. So many tech-angles these days are looking for simpler architectures (used to be time vs. money now it's just about heat) that it gets kind of blurry unless you have an investment in the outcome. I don't. You (as a starving developer), do. Or at least you're told you do by your peers. Bloody peers. Annoying entities, those. :D
Tuxman wrote:But, sticking to your example, even a cheap consumer ARM is able (and sometimes forced) to run a degenerated Java VM and a whole, sufficiently modern operating system written in blood, tears and C at the same time. If that's the minimum of how low we can go, we could as well stop using C altogether. There is no actual reason not to do that.
Which brings us back, full circle, to lingua-bloody-franca. Nobody likes Java (well, I suppose somebody must, but they are the God-forsaken few) - so (as you said earlier) in the current century where no language has really done anything others hadn't before (Erlang for better or worse?) it's an interregnum-state and while there are no end of pretenders hoping to get a look-in, as long as manufacturers keep serving up their amalgamated-soup down at the homeless shelter, we each have to find our own nourishment.

So, mixed metaphors aside... ah, hell, no, we can't put them aside. We're drowning in the bloody things. You may find comfort in the unwed arms of Pascal (always a bridesmaid...), and I in the diseased prostitutions of C ("Damn kids, get off my lawn!"), but here's to tilting at windmills. At least somebody's still fighting against the tide!

Tuxman
Platinum Member
Platinum Member
Posts: 1492
Joined: 2009 Aug 19, 07:49

Re: GM-Free Programming and the Matriculation of K...

Post by Tuxman » 2016 Aug 20, 20:00

Kilmatead wrote:You've got your own little Wagnerian thing going on in your head, don't you? :D
I hate operas. Shrill shrieks make my head want to die. I prefer to call it Epicurean for my own safety. -- And yes, of course Hobbes (not that tiger guy, I guess) was an economist in a way - a weird one, compared to regular economists like Keynes, Friedman, von Hayek and, to some extent, Marx (presuming that Marxism is not much more than a economic theory which has gone really wrong).
Kilmatead wrote:He would have loved ALGOL (...) for its ability to invite (yet not quite achieve) that context-free grammar so beloved of (...) pointer ambiguity. (There, that should impress a girl or two. :D The weird ones, maybe. :shrug:)
Telling a girl that I can't sleep with her because she doesn't embrace the glory of pointerless but performant programming still feels sad every time, but life goes on.
Kilmatead wrote:functional/procedural languages really make the girls swoon if you focus on getting something done and getting something else back at roughly the same time
You'll gain much more happiness with hybrid languages. Why choose when you can have everything? C won't let you choose, C is unforgiving in at least one important way, namely the freedom of art. Stick to the rules or you won't come anywhere near the prospected result (nor the knickers of a lady). Working around these rules by throwing more code on them will eventually make the compiler forgive you because he knows you are pretty much doomed at this point. C hates you. If you think you have tamed C at any point, you better start to find a good excuse for yourself.

At least some of the assembly macros called "C" include a big red button with an automatic self-pressing subroutine.
Kilmatead wrote:As pretty much most of your examples have shown (historically), the gulf between what was designed and what actually came out of it are two different things (...).
True; the designed things are those which are reliable, durable and hardened against the storm of pseudo-correct implementations. A historically grown heap of things whose heritage no one can explain anymore because it just works and it had always been done that way probably could not stand a single earthquake, which is why they usually come with a giant box of airbags, gently absorbing the impact. Sadly not yours, though.

Misusing the safe and warm haven of Pascal - when I was young, Turbo Pascal was the lingua franca being taught in schools, so I had no choice anyway - as a stepping stone into C might be an interesting experience for extreme athletes, but I never liked sports. C is a nice stepping stone for actual assembly code if your target is a microcontroller and the project manager strictly denied using Pascal for anything. While my latest diving (and almost instant jumping out again) into C was only a few weeks ago, I am always happy to have the choice. A language which needs your help to find the end of a string is not worth my attention.\0

(That's the theory, at least. Sometimes C is the better choice even for me, but I always regret it.)
Kilmatead wrote:Aside from proving my point (and thank you for that), you wound me, sir! Wound, I say! Oh, the humanity of it all. :cry:
If your point still is that Lazy Man's Assembly (I just invented the "Find a great alias for C" game) - "it's so small", oh my - is not a feature-restricted bastardization of its great old ancestors, you surely deserve this rare act of humanity. ;) Humanity always got its strength from helping people to stop making cruel mistakes. --

As a starving developer I rarely choose what's the best but what's the best available. I would probably instantly replace my i7 laptop by a SPARC laptop if only they would build any, but they don't. They left the field to make room for worse companies to spread. Windows used to work on DEC Alphas once. Nostalgia! My peers say I'm crazy for not just being interested in using what everyone else in their bubble uses. Connection reset by peer, I guess.
Kilmatead wrote:You may find comfort in the unwed arms of Pascal (always a bridesmaid...), and I in the diseased prostitutions of C ("Damn kids, get off my lawn!"), but here's to tilting at windmills. At least somebody's still fighting against the tide!
It's rather a question of the right tool for the - sometimes - at least well-meant job. I need (at least that's what I am told by the other me) more practice in Pascal again, C++ had me in its firty claws over the past few months. I'm beginning to fight the urge to just stay in the flow, to examine what's behind its borders again. It was much easier to let Python go. My brief intermezzo with Lisp (and, recently, COBOL) opened a door to a whole house of prostitutions. I guess I still have a couple of decades to fill.
Tux. ; tuxproject.de ; Windows 10 x64
registered xplorer² pro user since Oct 2009, ultimated in Mar 2012

Post Reply