24 ms·
I stopped everything and started writing C again
- OutOfHere 2y agoThe point is that much of the defensive programming you would have to do in C is unnecessary and automatic in Rust.
- elif 2y agoSo this is a journey where starting in ruby, going through an SICP phase, and then eventually compromising that it isn't viable. it kinda seems like C is just the personal compromise of trying to maintain nerdiness rather than any specific performance needs. I think it's a pretty normal pattern I've seen (and been though) of learning-oriented development rather than thoughtful engineering. But personally, AI coding has pushed me full circle back to ruby. Who wants to mentally interpret generated C code which could have optimisations and could also have fancy looking bugs. Why would anyone want to try disambiguating those when they could just read ruby like English?
- dkersten 2y ago> But personally, AI coding has pushed me full circle back to ruby. This happened to me too. I’m using Python in a project right now purely because it’s easier for the AI to generate and easier for me to verify. AI coding saves me a lot of time, but the code is such low quality there’s no way I’d ever trust it to generate C.
- somewhereoutth 2y ago> AI coding saves me a lot of time, but the code is such low quality Given that low quality code is perhaps the biggest time-sink relating to our work, I'm struggling to reconcile these statements?
- dkersten 2y agoIt depends on what you need the code for. If it’s something mission critical, then using AI is likely going to take more time than it saves, but for a MVP or something where quality is less important than time to market, it’s a great time saver. Also there’s often a spectrum of importance even within a project, eg maybe some internal tools aren’t so important vs a user facing thing. Complexity also varies: AI is pretty good at simple CRUD endpoints, and it’s a lot faster than me at writing HTML/CSS UI’s (ie the layout and styling, without the logic). If you can isolate the AI code to code that doesn’t need to be high quality, and write the code that doesn’t yourself, it can be a big win. Or if you use AI for an MVP that will be incrementally replaced by higher quality code if the MVP succeeds, can be quite valuable since it allows you to test ideas quicker. I personally find it to be a big win, even though I also spend a lot of time fighting the AI. But I wouldn’t want to build on top of AI code without cleaning it up myself. There are also some tasks I’ve learned to just do myself: eg I do not let the AI decide my data model/database schema. Data is too important to leave it up to an AI to decide. Also outside of simple CRUD operations, it generates quite inefficient database querying so if it’s on a critical path, perhaps write the queries yourself.
- codr7 2y agoBecause Ruby can't handle most of the problems C is used for? Because they're implementing Ruby, for example?
- hehbot 2y ago[flagged]
- rubymamis 2y agoI would use Mojo - you get the type and memory safety of Rust, the simplicity of Python and the performance of C/C++.
- pansa2 2y ago> simplicity of Python Python isn’t simple, it’s a very complex language. And Mojo aims to be a superset of Python - if it’s simple, that’s only because it’s incomplete.
- dkersten 2y agoExcept complexity of language
- juliangmp 2y agoI'll take good complexity over bad simplicity any day.
- LeonidasXIV 2y agoAt least apparent complexity. See "Expert C Programming: Deep C Secrets" which creeps up on you shockingly fast because C pretends to be simple by leaving things to be undefined but in the real life things need some kind of behavior.
- uecker 2y agoThis book seems horrible outdated. A lot has changed since then.
- desdenova 2y agoYou can ignore most of the complexity that's not inherent to the program you're trying to write. The difference is C also lets you ignore the inherent complexity, and that's where bugs and vulnerabilities come from.
- kqr 2y agoI started programming with C a long time ago, and even now, every few months, I dream of going back to those roots. It was so simple. You wrote code, you knew roughly which instructions it translated to, and there you went! Then I try actually going through the motions of writing a production-grade application in C and I realise why I left it behind all those years ago. There's just so much stuff one has to do on one's own, with no support from the computer. So many things that one has to get just right for it to work across edge cases and in the face of adversarial users. If I had to pick up a low-level language today, it'd likely be Ada. Similar to C, but with much more help from the compiler with all sorts of things.
- anta40 2y agoDon't forget Pascal is still alive.
- wruza 2y agoFrom what I remember about Ada, it is basically Pascal for rockets.
- sgt 2y agoAnd some call it Boomer Rust, if I recall.
- enriquto 2y agoHahaha! I'll start calling Rust "Zoomer Ada"
- kevin_thibedeau 2y agoWith operator precedence fixed to not be an annoyance.
- int_19h 2y agoOnly in terms of syntax. Feature-wise it's more like C++ but everything is explicit.
- lqet 2y agoI fully understand that sentiment. For several years now, I have also felt the strong urge to develop something in pure C. My main language is C++, but I have noticed over and over again that I really enjoy using the old C libraries - the interfaces are just so simple and basic, there is no fluff. When I develop methods in pure C, I always enjoy that I can concentrate 100% on algorithmic aspects instead of architectural decisions which I only have to decide on because of the complexity of the language (C++, Rust). To me, C is so attractive because it is so powerful, yet so simple that you can hold all the language features in your head without difficulty. I also like that C forces me to do stuff myself. It doesn't hide the magic and complexity. Also, my typical experience is that if you have to write your standard data structures on your own, you not only learn much more, but you also quickly see possibly performance improvements for your specific use case, that would have otherwise been hidden below several layers of library abstractions. This has put me in a strange situation: everyone around me is always trying to use the latest feature of the newest C++ version, while I increasingly try to get rid of C++ features. A typical example I have encountered several times now is people using elaborate setups with std::string_view to avoid string copying, while exactly the same functionality could've been achieved by fewer code, using just a simple raw const char* pointer.
- chronogram 2y agoVariety is good. I got so used to working in pure C and older C++ that for a personal project I just started writing in C, until I realised that I don't have to consider other people and compatibility, so I had a lot of fun trying new things.
- brucehoult 2y agoTry doing C with a garbage collector ... it's very liberating. Do `#include <gc.h>` then just use `GC_malloc()` instead of `malloc()` and never free. And add `-lgc` to linking. It's already there on most systems these days, lots of things use it. You can add some efficiency by `GC_free()` in cases where you're really really sure, but it's entirely optional, and adds a lot of danger. Using `GC_malloc_atomic()` also adds efficiency, especially for large objects, if you know for sure there will be no pointers in that object (e.g. a string, buffer, image etc). There are weak pointers if you need them. And you can add finalizers for those rare cases where you need to close a file or network connection or something when an object is GCd, rather than knowing programmatically when to do it. But simply using `GC_malloc()` instead of `malloc()` gets you a long long way. You can also build Boehm GC as a full transparent `malloc()` replacement, and replacing `operator new()` in C++ too.
- TurboHaskal 2y agoThis reads like a cautionary tale about getting nerdsniped, without a happy ending.
- CrimsonCape 2y agoYeah, I think every programmer experiences the "I should write a language" moment when the solution to the problem is abstracted to be the language itself.
- codr7 2y agoI think every programmer should at some point write their own language.
- wolfspaw 2y ago" I was gaining a lot of money with Ruby on Rails Then, I decided to move to Common Lisp and start gaining less and less money Then, I decided to move to C and got Nerd Snipped " Well, atleast he seems more happy xD C is cool though
- pmontra 2y ago504 Gateway Timeout Archived at https://archive.is/zIZ8S https://archive.is/zIZ8S
- contificate 2y agoI sometimes write C recreationally. The real problem I have with it is that it's overly laborious for the boring parts (e.g. spelling out inductive datatypes). If you imagine that a large amount of writing a compiler (or similar) in C amounts to juggling tagged unions (allocating, pattern matching over, etc.), it's very tiring to write the same boilerplate again and again. I've considered writing a generator to alleviate much of the tedium, but haven't bothered to do it yet. I've also considered developing C projects by appealing to an embeddable language for prototyping (like Python, Lua, Scheme, etc.), and then committing the implementation to C after I'm content with it (otherwise, the burden of implementation is simply too high). It's difficult because I do believe there's an aesthetic appeal in doing certain one-off projects in C: compiled size, speed of compilation, the sense of accomplishment, etc. but a lot of it is just tedious grunt work.
- anymouse123456 2y agoI've been discovering that the grunt work increases logarithmically with how badly I OO the C. When I simplify and think in terms of streams, it starts getting nice and tidy.
- ManBeardPc 2y agoC was my first language and I quickly wrote my first console apps and a small game with Allegro. It feels incredibly simple in some aspects. I wouldn’t want to go back though. The build tools and managing dependencies feels outdated, somehow there is always a problem somewhere. Includes and the macro system feels crude. It’s easy to invoke undefined behavior and only realizing later because a different compiler version or flag now optimizes differently. Zig is my new C, includes a C compiler and I can just import C headers and use it without wrapper. Comptime is awesome. Build tool, dependency management and testing included. Cross compilation is easy. Just looks like a modern version of C. If you can live with a language that is still in development I would strongly suggest to take a look. Otherwise I use Go if a GC is acceptable and I want a simple language or Rust if I really need performance and safety.
- randomNumber7 2y agoDespite what some people religiously think about programming languages, imo C was so successful because it is practical. Yes it is unsafe and you can do absurd things. But it also doesn't get in the way of just doing what you want to do.
- bamboozled 2y agoSounds a bit like perl but at a lower level ?
- high_priest 2y agoSounds a bit like JavaScript, but at a tower level?
- TingPing 2y agoI wouldn’t compare them, C is very simple.
- codr7 2y agoYes, but there are similarities, it has the same hacker mind set imo.
- ThinkBeat 2y agoYou can certainly do entirely absurd things in Perl. But it is a lot easier / safer work with. You get / can get a wealth of information when you the wrong thing in Perl. With C segmentation fault is not always easy to pinpoint. However the tooling for C, with sone if the IDEs out there you can set breakpoints/ walk through the code in a debugger, spot more errors during compile time. There is a debugger included with Perk but after trying to use it a few times I have given up on it. Give me C and Visual Studio when I need debugging. On the positive side, shooting yourself in the foot with C is a common occurrence. I have never had a segmentation fault in Perl. Nor have I had any problems managing the memory, the garbage collector appears to work well. (at least for my needs)
- 2y ago
- a_random_user 2y ago[flagged]
- markus_zhang 2y agoC, or more precisely a constrained C++ is my go to language for side projects. Just pick the right projects and the language shines.
- codr7 2y agoI've tried, but never succeeded in doing that; the complexity eventually seeps in through the cracks. C++'s stdlib contains a lot of convenient features, writing them myself and pretending they aren't there is very difficult. Disabling exceptions is possible, but will come back to bite you the second you want to pull in external code. You also lose some of the flexibility of C, unions become more complicated, struct offsets/C style polymorphism isn't even possible if I remember correctly. I love the idea though :)
- ryandrake 2y ago> C++'s stdlib contains a lot of convenient features, writing them myself and pretending they aren't there is very difficult. I've never understood the motivation behind writing something in C++, but avoiding the standard library. Sure, it's possible to do, but to me, they are inseparable. The basic data types and algorithms provided by the standard library are major reasons to choose the language. They are relatively lightweight and memory-efficient. They are easy to include and link into your program. They are well understood by other C++ programmers--no training required. Throughout my career, I've had to work in places where they had a "No Standard Library" rule, but that just meant they implemented their own, and in all cases the custom library was worse. (Also, none of the companies could articulate a reason for why they chose to re-implement the standard library poorly--It was always blamed on some graybeard who left the company decades ago.) Choosing C++ without the standard library seems like going skiing, but deliberately using only one ski.
- codr7 2y agoThe stdlib makes choices that might not be optimal for everyone. Plenty of code bases also predate it, when I started coding C++ in 1995 most people were still rolling their own.
- keepamovin 2y agoThe author's github profile: https://github.com/thodg https://github.com/thodg The way he writes about his work in this article, I think he's a true master. Very impressive to see people with such passion and skill.
- kuon 2y agoTry zig, it is C with a bit of polish.
- sgt 2y agoWhy zig and not Rust? Just to throw the question out there :-)
- kelnos 2y agoZig is a much simpler language than Rust. I'm a big Rust fan, but Rust is not even close to a drop-in replacement for C. It has a steep learning curve, and often requires thinking about and architecting your program much differently from how you might if you were using C. For a C programmer, learning and becoming productive in Zig should be a much easier proposition than doing the same for Rust. You're not going to get the same safety guarantees you'd get with Rust, but the world is full of trade offs, and this is just one of them.
- nyrikki 2y agoFor me, where linked lists, graphs and other structures are a common need, zig gives me slices and deferred frees. Rust is double expensive in this case. You have to memorize the borrow checker and be responsible for all the potential undefined behavior with unsafe code. But I am not a super human systems programmer. Perhaps if I was the calculus would change. But personally when I have to drop down below a GC language, it is pretty close to the hardware. Zig simply solves more of my personal pain points... but if rust matures in ways that help those I'll consider it again.
- codedokode 2y ago> You have to memorize the borrow checker Correct me if I am wrong, but Rust at least has a borrow checker while in C (and Zig) one has to do the borrow checking in their head. If you read a documentation for C libraries, some of them mention things like "caller must free this memory" and others don't specify anything and you have to go to the source code to find out who is responsible for freeing the memory.
- tromp 2y agoHere's what kc3 code looks like (taken from [1]): def route = fn (request) { if (request.method == GET || request.method == HEAD) do locale = "en" slash = if Str.ends_with?(request.url, "/") do "" else "/" end path_html = "./pages#{request.url}#{slash}index.#{locale}.html" if File.exists?(path_html) do show_html(path_html, request.url) else path_md = "./pages#{request.url}#{slash}index.#{locale}.md" if File.exists?(path_md) do show_md(path_md, request.url) else path_md = "./pages#{request.url}.#{locale}.md" if File.exists?(path_md) do show_md(path_md, request.url) end end end end } [1] https://git.kmx.io/kc3-lang/kc3/_tree/master/httpd/page/app/controllers/page_controller.kc3 https://git.kmx.io/kc3-lang/kc3/_tree/master/httpd/page/app/...
- cgh 2y agoYeah, I'm not sure a lot of people read the article. This isn't really a back to basics, going back to C, forgoing complexity type of article, but instead it's about developing a new programming language called KC3 to make use of ideas he originally developed in Lisp.
- jkhdigital 2y agoThe author mentions being deeply inspired and influenced by Jose Valim; I guess this means (approximately) that KC3 is to C as Elixir is to Erlang?
- relistan 2y agoMaybe early return isn’t allowed in that language, but it sure would make that a heck of a lot easier to read.
- deleted 2y ago[deleted]
- FrustratedMonky 2y agoMaybe the moral here is learning Lisp made him a better C programmer. Could he have jumped right into C and had amazing results, if not for the Journey learning Lisp and changing how he thought of programming. Maybe learning Lisp is how to learn to program. Then other languages become better by virtue of how someone structures the logic.
- codr7 2y agoI would definitely recommend any programmer to learn both Lisp and C at some point.
- neuroelectron 2y agoWhat's with the toggle grid at the bottom of the article? Is it just a fidget toy?
- csimai 2y agoI've read through your website and thinking processes. Your work is genius! I hope KC3 can be adopted widely, there is great potential.
- deleted 2y ago[deleted]
- wvh 2y agoGoing from mid-90s assembly to full stack dev/sec/ops, getting back to just a simple Borland editor with C or assembly code sounds like a lovely dream. Your brain works a certain way, but you're forced to evolve into the nightmare half-done complex stacks we run these days, and it's just not the same job any more.
- bArray 2y ago> Virtual machines still suck a lot of CPU and bandwidth for nothing but emulation. Containers in Linux with cgroups are still full of RCE (remote command execution) and priviledge escalation. New ones are discovered each year. The first report I got on those listed 10 or more RCE + PE (remote root on the machine). Remote root can also escape VMs probably also. A proper virtual machine is extremely difficult to break out of (but it can still happen [1]). Containers are a lot easier to break out of. I virtual machines were more efficient in either CPU or RAM, I would want to use them more, but it's the worst of both. [1] https://www.zerodayinitiative.com/advisories/ZDI-23-982/ https://www.zerodayinitiative.com/advisories/ZDI-23-982/
- rainmaking 2y agoI like Nim- compiles to C so you get similarly close to the instructions and you can use a lot of high level features if you want to, but you can also stay close to the metal.
- deleted 2y ago[deleted]
- kelnos 2y agoI'm kinda in the opposite camp. After doing a bunch of VB in my tweens and teens, I learned Java, C, and C++ in college, settling on mostly C for personal and professional projects. I became a core developer of Xfce and worked on that for 5 years. Then I moved into backend development, where I was doing all Java, Scala, and Python. It was... dare I say... easy! Sure, these kinds of languages bring with them other problems, but I loved batteries-included standard libraries, build systems that could automatically fetch dependencies -- and oh my, such huge communities with open-source libraries for nearly anything I could imagine needing. Even if most of the build systems (maven, sbt, gradle, pip, etc.) have lots of rough edges, at least they exist. Fast forward 12 years, and I find myself getting back in to Xfce. Ugh. C is such a pain in the ass. I keep reinventing wheels, because even if there's a third-party library, most of the time it's not packaged on many of the distros/OSes our users use. Memory leaks, NULL pointer dereferences, use-after-free, data races, terrible concurrency primitives, no tuples, no generics, primitive type system... I hate it. I've been using Rust for other projects, and despite it being an objectively more difficult language to learn and use, I'm still much more productive in Rust than in C.
- cryptonector 2y agoBut TFA is not writing in C. TFA is writing in a language that compiles to C.
- kstrauser 2y agoI think Rust is harder to learn, but once you grok it, I don't think it's harder to use, or at least to use correctly. It's hard to write correct C because the standard tooling doesn't give you much help beyond `-Wall`. Rust's normal error messages are delightfully helpful. For example, I just wrote some bad code and got: --> src/main.rs:45:34 | 45 | actions.append(&mut func(opt.selected)); | ---- ^^^^^^^^^^^^ expected `&str`, found `String` | | | arguments to this function are incorrect | help: consider borrowing here | 45 | actions.append(&mut func(&opt.selected)); | I even had to cheat a little to get that far, because my editor used rust-analyzer to flag the error before I had the chance to build the code. Also, I highly recommend getting into the habit of running `cargo clippy` regularly. It's a wonderful tool for catching non-idiomatic code. I learned a lot from its suggestions on how I could improve my work.
- ein0p 2y agoAt this point one should choose a C-like subset of Rust, if they have this particular urge. A lot fewer rakes under the leaves.
- WhereIsTheTruth 2y agoI'm on the same boat, i now use exclusively C, and D (with the -betterC flag) for my own projects I refuse to touch anything else, but i keep an eye on the new languages that are being worked on, Zig for example
- henning 2y ago> Defensive programming all the way : all bugs are reduced to zero right from the start Has it been fuzzed? Have you had someone who is very good at finding bugs in C code look at it carefully? It is understandable if the answer to one or both is "no". But we should be careful about the claims we make about code.
- Yie1cho 2y agohe may be good at C but not that good. no one's that good. and this stupid overconfidence leads to sec holes.
- fungiblecog 2y agoSo nobody would use code written in common lisp... but they will use code written in an entirely new language.... right...
- codr7 2y agoI love Common Lisp, but I would definitely think twice before implementing anything I want other people to use on their machines in it. A tiny C executable is pretty nimble in comparison to anything you'll get out of Common Lisp.
- vindarel 2y agoI understand, it isn't that bad though: a web app of mine with dozens of dependencies and all templates and static assets is 35MB with SBCL and core compression (that includes the compiler and debugger, useful to connect to a running app and exploring its state (or even hot reloading code)). I suppose that's in the ballpark of a growing Go application. LispWorks has a tree shaker that builds a hello world in 5MB.
- tmtvl 2y agoEh, you can just distribute a .lisp file as though it were a ruby or perl script. CL is faster than the usual scripting languages, but admittedly not as fast as C or Rust.
- codr7 2y ago'Just' is overdoing it a tiny bit :) Assuming everyone has a CL installed is going to limit the audience pretty drastically. And what about dependencies? Assume they have quicklisp installed as well? Like I said, I love Common Lisp, but every language is some kind of compromise.
- Yie1cho 2y ago"and all was bounds-checked at memory cost but the results were awesome. Defensive programming all the way : all bugs are reduced to zero right from the start." a bit LOL, isn't it? also the part about terraform, ansible and the other stuff.
- ustad 2y agoTools should enable creativity and problem-solving, not become problems themselves. The best languages fade into the background, becoming almost invisible as you express your solution. When the language constantly demands center stage, something has gone fundamentally wrong with its design philosophy.
- ternaryoperator 2y agoIn the abstract, the simplicity of C has a definite appeal. However, pragmatically, the sense that I am mowing the lawn with a pair of scissors gets tiring quickly.
- BirAdam 2y agoLinux/UNIX distributions are essentially C development environments, and their package managers are basically C language package managers… so, you needn’t do everything yourself, just grab the source packages.
- codedokode 2y agoWriting code in C is very unpleasant, verbose and repetative. For example, if I want to have a structure in C and have a way to print its contents, or free its memory and memory of nested structures, or clone it recursively, it is very difficult to make automatically. I found only two options: either write complicated macros to define the structure and functions (feels like writing a C++ compiler from scratch), or define structure in Python and generate the C code from it. I looked at C++, but it seems that despite being more feature-rich, it also cannot auto-generate functions/methods for working with structures? Also returning errors with dynamically allocated strings (and freeing them) makes functions bloated. Also Gnome infrastructure (GObject, GTK and friends) requires writing so much code that I feel sorry for people writing Gnome. Also, how do you install dependencies in C? How do you lock a specific version (or range of versions) of a dependency with specific build options, for example?
- codr7 2y agoSimplify. If you try to write the same complicated mess in C as you would in any other language it's going to hurt. Not having a package manager can be a blessing, depends on your perspective.
- int_19h 2y agoThere's no amount of simplification that'll free you from the need to manually check and handle/propagate errors or deallocate resources in C. You might be able to reduce the amount of code you need to write, but it's still several lines of C versus one line of something else - and if you make a mistake or even forget something in those several lines, things will often compile and run fine, but you'll have memory leaks or sporadic crashes.
- codr7 2y agoI don't have these issues in C, you're projecting. Not that I write bug free software by any means; no one does, though some like to pretend.
- moron4hire 2y agoAbout a year ago, I had gotten fed up with what felt like overlyb strict context requirements basically giving me to abandon years of work and thought I'd try my hand at C++ again. I wanted to do this on Linux, because I my main laptop is a Linux machine after my children confiscated my Windows laptop to play Minecraft with the only decent GPU in the house. And I just couldn't get past the tooling. I could not get through to anything that felt like a build setup that I'd be able to replicate in my own. On Windows, using Visual Studio, it's not that bad. It's a little annoying compared to a .NET project, and there are a lot more settings to worry about, but at the end of the day VS makes the two but very different from each other. I actually didn't understand that until I tried to write C++ on Linux. I thought C++ on Windows was worlds different than C#. But now I've seen the light. I honestly don't know how people do development with on Linux. Make, Cmake, all of that stuff, is so bad. IDK, maybe someone will come along and tell me, "oh, no, do this and you'll have no problems". I hope so. But without that, what a disgusting waste of time C and C++ is on Linux.
- edye 2y agoI find make, cmake, and the other stuff annoying also. For personal stuff I just use a build.sh file. For debugging I use gf2, which is a gdb frontend. Hopefully raddebugger gets ported to linux soon. One nice tool I like on linux for prototyping is the tiny c compiler, because it compiles 7x faster than gcc or clang. It is also much faster than the visual studio compiler. I remember trying to get the tiny c compiler to work on windows; it can compile things, but I couldn't get it to generate pdb files for debug info.
- moron4hire 2y agoWow, I'm surprised you were able to make out what I was saying through all those drunk smartphone keyboard typos (it's the keyboard that was drunk, not me, no sir). I just don't understand why people want to live like that in C++ land. It almost feels like masochism. Especially considering VC++ basically "just works" in comparison. Why do Linux users hate DevEx so much?
- davidwf 2y ago
- teleforce 2y ago> Garbage collectors suck, and all my Common Lisp projects have very limited applications just because of the garbage collector. If only a very tiny fraction of the resources effort, research, time, money etc of all ML/AI funds are directed for the best design of high performance GC, it will make a software world a much better place. The fact that we have a very few books dedicated on GC design and thousands of books now dedicated on AI/ML, it is quite telling. For real-world example and analogy, automotive industry dedicated their resources on the best design of high performance automatic transmission and now it has a faster auto transmission than manual for rally and racing. For normal driving auto is what the default and available now, most of the cars do not sell in manual transmission version. > Linux is written in C, OpenBSD is written in C, GTK+ is object-oriented pure C, GNOME is written in C. Most of the Linux desktop apps are actually written in plain old C. So why try harder ? I know C C is the lingua-franca of all other programming languages including Python, Julia, Rust, etc. Period. D language has already bite the bullet and made C built-in by natively supporting it. Genius. D language also has GC by default for more sane and intuitive programming, it's your call. It also one of the fastest compilation time and execution time languages in existence. From the KC3 language website, "KC3 is a programming language with meta-programmation and a graph database embedded into the language." Why you want to have a graph database embedded into the language? Just support associative array built-in since it has been proven to be the basis of all common data representations of spreadsheet, SQL, NoSQL, matrices, Graph database, etc. [1] Associative Array Model of SQL, NoSQL, and NewSQL Databases: https://arxiv.org/pdf/1606.05797 https://arxiv.org/pdf/1606.05797 [2] Mathematics of Big Data: Spreadsheets, Databases, Matrices, and Graphs: https://mitpress.mit.edu/9780262038393/mathematics-of-big-data/ https://mitpress.mit.edu/9780262038393/mathematics-of-big-da...
- cryptonector 2y ago> It was supposed to be a short mission I thought I could learn Common Lisp in ten days and hack a quick server management protocol. I ended up writing throw-away Common Lisp code that generated C for a fully-fledged ASN.1 parser and query system for a custom Common Lisp to C SNMP server. I believe it. And I'd love to see it and hack on it, if it were open source. This whole kc3 thing looks pretty interesting to me. I agree with the premise. It's really just another super-C that's not C++, but that's a pretty good idea for a lot of things because the C ABI is just so omnipresent.
- mistyvales 2y agoWhat's the best way to learn C? Any good modern book recommendations, or sites?
- Lyngbakr 2y agoThere's a second edition of the legendary K&R book¹ to get you started. ¹https://www.amazon.com/Programming-Language-2nd-Brian-Kernighan/dp/0131103628 https://www.amazon.com/Programming-Language-2nd-Brian-Kernig...
- armitron 2y agoSee my previous comment, anyone learning C from K&R should not be writing C period. That book is legendary only in the magnitude of financial damages it (directly and indirectly) enabled, caused by people who read it and thought that they could now write C.
- davidwf 2y agoI highly recommend Zed Shaw's "Learn C the Hard Way": https://learncodethehardway.org/c/ https://learncodethehardway.org/c/ I worked through this and felt well-prepared to actually use C in anger when I had to.
- armitron 2y agoTerrible overall and entirely wrong in multiple places. If you learn C from this book, you should't be writing C. The last bit is also true for K&R The C Programming Language (avoid at all costs). You're better off with: - Modern C (whatever edition is current) - Seacord's Effective C: Introduction to professional C programming - C Programming: Modern Approach 2nd edition (bible)
- lemonwaterlime 2y agoI second "Modern C" by Jen Gustedt. - Get the `cdecl` tool to build intuition about function signatures. What does "int( * ( *foo)(void))[3]" mean? - Write it yourself. - Be disciplined. Develop good hygiene with compiler flags, memory/address checks, and even fuzzing. - Read good source code such as the linux kernel. This is an amusing header file from the git source code that defines some banned functions. This is wisdom if you choose to follow it: https://github.com/git/git/blob/master/banned.h https://github.com/git/git/blob/master/banned.h - Push the language to its limits. Play with memory and data structures. Inspect everything. This book "Data-Oriented Design" by Richard Fabien is a great to explore as well. It's about organizing your data for efficient processing.
- DeathArrow 2y agoI still think in the right tool for the job. Trying to write some web application in C will drive me mad. Also will trying to write some low level stuff in Java.
- Tractor8626 2y agoNothing make sense. What is your killer app? What CL has to do with no one running it? What problem you had with garbage collectors? Why is C is the only option? Are you sure all those RCEs because of VMs and containers and not because it all written in C? "There are no security implications of running KC3 code" - are you sure?
- daitangio 2y agoJava was created to solve some frequent troubles you have in C-code. I do not want to be rude, but C has some error-prone syntax: if you forget a *, you will be in trouble. If you do 1 byte offset error on an array in the stack, you get erratic behavior, core dump if you are lucky. Buffer overlflows also poses security risks. try...catch was not present on C, and it is one of the most powerful addition of C++ for code structuring. Thread management/async programming without support from the language (which is fine, but if you see Erlang or Java, they have far more support for thread monitors). Said that, there are very high quality library in C (pthreads, memory management and protection, lib-eventio etc) which can overcome most of its limit but... it is still error-prone
- intrasight 2y agoI learned computer engineering bottom-up and top-down. Bottom-up as a teen reading books and manuals. Since no one I knew had an actual computer in 1979, like Ada Lovelace, I built the computers in my mind, LOL. Then in college I did some top-down too by writing C and then compiling to assembly and then compiling to machine code. we also had to build a CPU from discrete bit-slice components and then program it. One of the most time intensive courses I took at CMU. Do computer engineers still have to do that? I would certainly encourage all computer engineers, and perhaps even software engineers, to learn the "full stack". But as to programming and C, I haven't done that in almost 30 years. It would be an interesting experiment to see how much of that skill if any I still possess.
- aadhavans 2y agoFor those who like C because of the simplicity, I can wholeheartedly recommend Go. It's replaced C as my go-to for personal CLI projects - while it is more complex than C, the core language features fit in my head pretty well. Add to that the excellent tooling, primitive OOP and clean syntax, and it's a damn good replacement.
- le-mark 2y ago> GLib is a general-purpose, portable utility library, which provides many useful data types, macros, type conversions, string utilities, file utilities, a mainloop abstraction, and so on. Glib is c batteries included library I really like. Does anyone have any others they prefer? https://docs.gtk.org/glib/ https://docs.gtk.org/glib/
- cassepipe 2y agoI did come back to C after some years. I liked it because it made me suffer but in the I prevailed so I felt good about it. Now that I am back at it I remember all the pain of trying to enforce abstractions at compile-time with the C preprocessor. I am now considering Zig or suicide.
- gatane 2y agoC++ has long compilation times, when you have long code base.
- account-5 2y agoIs this about C or Common Lisp? I'm confused the title suggest C but common lisp appears to be what the article is about.
- thodg 2y ago[dead]
- las_balas_tres 2y agoI started writing C code again because i started using gstreamer and needed to write a modem plugin for ModemManager. This meant i had to get familiar with glib. Even thought the learning curve has been steep it been worth and I am really enjoying writing in C again, even going so far as to refactor some existing code of mine use glib and make it GObject based. The end goal here is to use gir to use my code from scriptable languages like python.
- Sunspark 2y agoWithout reading the comments here, I read the blog entry first. After I finished I was puzzled, "what is the author trying to communicate to the reader here?" As near as I can determine, enough people weren't using the author's program/utility because it was written in a language that hasn't been blessed by the crowd? It is hinted at that there might be issues involving memory consumption. The author does not write lessons learned or share statistics of user uptake after the re-write. No new functionality was gained, presumably this exercise was done as practice reps because the author could do it and had time. No argument was made that the author has seen the light and now only C from this point on.
- thodg 2y ago[dead]
- sim7c00 2y agolove this sentiment. i tried a lot of languages after C, and am also back to C. it does force me to pencil out all kinds of stuff rather than relying on third party code or compiler error help, but i find that delightful. good upfront coding on a piece of paper, slowly (compared to other langs) implementing it, and diligently testing because you know its very needed in C. it forces you to do things right, and if you do you get an ultimate reward. blazin fast , well behaved code. yes, my life is still full of segfaults as many segfaults as ignorance and impatience. so its delightful because it helps me overcome those 2 things, slowly and steadily =)
- bob1029 2y ago> who can write a strategy game with thousands of units each having their own vision of the world, without having a garbage collector running like hell Even in ecosystems where you don't have a way to opt-out of GC, there are strategies for dramatically minimizing the impact. Just because you have some aspects of the product rely on it should not be fatal unless we are being a bit hyperbolic about the purity of tech. If your allocation rate is <1 megabyte per minute and you are expressly forcing GC to run along the grain of the allocations (i.e., after each frame or sim tick), then it is exceedingly unlikely you will experience the canonical multiple-second, stop-the-world GC boogeyman. Additionally, I don't think this is a fair take on how an RTS game would be engineered in practice. Each unit should be part of a big contiguous array in memory somewhere. The collection of garbage can be made largely irrelevant in the scenario of managing game state if you are willing to employ approximately the same approach you'd use in many other languages. Nothing stops you from newing up a 2 gig byte array and handing out spans to consumers just because you have GC turned on.
- thodg 2y ago[dead]
- curtisszmania 2y ago[dead]
- thodg 2y ago[dead]