Hacker Newsnew | past | comments | ask | show | jobs | submit | AlectronikLabs's commentslogin

Why don't they start to support units instead of these ugly header files to finally stop duplicating code? I see this might break stuff but you could implement it side by side with the preprocessor so old code would continue to work.


Walter Bright says he was able to implement modules in C with 10 lines of code. That probably works with C but it'd make C incompatible with C++. Most people think that's reason enough not to do it. I think breaking compatibility with C++ would be like cutting the ropes to a sinking ship to save your own.


> That probably works with C but it'd make C incompatible with C++.

C is not a subset of C++. The simplest example:

> int new = 1;

Perfectly valid C, but not valid C++.

Now, modules would obviously be a bigger break than a few keyword incompatibilies, but at that point you'd also massively increase complexity and basically start creating C++ again, which is probably the actual reason it hasn't happened yet.


Modula-2 had modules in 1978, and it was still a pretty simple language. They don't necessarily imply recreating C++.


If you listen to the C++ people it's obvious they think the incompatible changes are a terrible mistake. They can't undo them but they're adamant no other breaking changes be allowed. They don't want things to get worse for them. Meaning better for everyone else.

And no modules wouldn't make C more like C++. It's just make C a bit saner and faster to compile. Because modules are complete and don't depend on code compiled before the import. Which means you can compile your modules exactly once and only once. Well written C code bases you could probably just change #include to #import and reap the benefits.


TBF, C doesn't suffer from the "headers cause slow builds" problem of C++, because C headers usually only contain a handful of declarations (e.g. the C stdlib headers are a couple of hundred lines of function prototypes and struct declarations, not tens of thousands of lines of gnarly template code like C++ stdlib headers).


When I've looked at what's going on with gcc what I see is most of the code being compile is header files. It's probably 90% headers and 10% actual code. And then there is all the dependency files it's reading. Though to be fair I think a lot of that is not so much trying to make C compile fast but to make C++ compile fast.


Might not be a popular opinion, but I actually like that C headers only contain the public API declaration of a "module" while the implementation and private declarations live in a separate file. Makes it easy to figure out the public API just by reading the header and without having to sift through unimportant implementation code.

In other languages you need IDE support for extracting the public API of a module.


That's orthogonal to the module system. OCaml for example has `.ml` and `.mli` files for the same purpose, but `.mli` can be automatically generated from `.ml` if you want. And that's absolutely nothing to do with OCaml's great module system.


Does the .mli file preserve documentation comments? IMHO the header file should be written for human consumption first. Documenting the implementation isn't by far as important.


The main OCaml implementation doesn't, but I believe there are several third-party tools that automate this. And as you've mentioned, comments in `.ml` and `.mli` do tend to differ, so even the default auto-generation may be useful because it will do as many jobs as possible without a human intervention.


why not introduce an "import" keyword and keep the include keyword for old headers?


If you mean #import, it already exists as a keyword (though the meaning is different between GCC/Clang and MSVC).


Brave browser worked for some time but stopped as of today. The ad speedup extension (https://chromewebstore.google.com/detail/ad-speedup-skip-vid...) is the only thing that still works afaik.


Yeah this really sucks. Part of my plan was to just use brave mobile but this stopped working as well yesterday.

I refuse to give google a dime of revenue though. If it were some other company I would have bought the paid service a long time ago but I absolutely will not in this case.


I would love to see a systems programming language with classes which were usable on bare metal, like with c++ and unlike e.g. D or free pascal where a runtime is required.

Any homepage of your project @OP to check for the alpha?


I registered rylang.net, but I have not put anything there yet. I'll put something there when I get further along. Only just added destructors for now.


Looks very interesting! I just wish there was a possibility to run nested Weston sessions to avoid always having to switch to command line first before trying out a new compositor.


Yeah that would be nice. Hopefully the author adds it. That makes the whole development flow with wlroots based compositors quite pleasant (although difficult still)


This project is awesome! Just recently began to get these anti-adblock notices on YT and while one can still skip them by reloading the page I assume this won't be so for long. Awesome that Odysee even comes with different related videos than YT itself so one can discover new stuff outside of YT's algorithmic bubble.


You're right, just tried it & worked. But I imagine they'll "fix" this pretty soon.


hi


Yeah, this is one of the reasons why I think a microkernel would be excellent for today's computing.


I wanted to trash dump into the electronics at the local disposal center in Switzerland and they told me I couldn't because they need to destroy the stuff by law and punishable with 10.000 CHF if not. Don't know about an university though.


Based on LCC but no source code :/


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: