HackerTrans
トップ新着トレンドコメント過去質問紹介求人

faresahmed

no profile record

投稿

C++ Modules Are Here to Stay

faresbakhit.github.io
78 ポイント·投稿者 faresahmed·6 か月前·140 コメント

EĿlipsis, a Language Independent Preprocessor

gustedt.gitlabpages.inria.fr
4 ポイント·投稿者 faresahmed·昨年·1 コメント

コメント

faresahmed
·4 か月前·議論
Take a look at https://contextgeneric.dev, it's as close as one can get to solving this issue without modifying rustc.
faresahmed
·7 か月前·議論
I think that it's a generic programming problem: pointers are easier because the type of the pointee is easy to get (a deref) and also its location (memory) but with index-based handles into containers you can no longer say that given a handle `H` (type H = u32) I can use it to get a type `T` and not only that, you've also introduced the notion of "where", that even if for each type `T` there exists a unique handle type `H` you don't know into which container instance does that handle belong. What you need is a unique handle type per container instance. So "Handle of Pool<T>" != "Handle of Pool<T>" unless the Pool is bound to the same variable.

As far as I know no language allows expressing that kind of thing.
faresahmed
·11 か月前·議論
Off topic, but Notion is a perfect example of how badly you can abuse web standards. This webpage, which is a document with some markup and links (the very thing the web was made for) takes ~600MB RAM, about 10 seconds load, and lags terribly. Just unusable.
faresahmed
·昨年·議論
Not to disagree with you, but even C++ is going through great efforts to improve compile-times through C++20 modules and C++23 standard library modules (import std;). Although no compiler fully supports both, you can get an idea of how they can improve compile-times with clang and libc++

    $ # No modules
    $ clang++ -std=c++23 -stdlib=libc++ a.cpp # 4.8s
    $ # With modules
    $ clang++ -std=c++23 -stdlib=libc++ --precompile -o std.pcm /path/to/libc++/v1/std.cppm # 4.6s but this is done once
    $ clang++ -std=c++23 -stdlib=libc++ -fmodule-file=std=std.pcm b.cpp # 1.5s 
a.cpp and b.cpp are equivalent but b.cpp does `import std;` and a.cpp imports every standard C++ header file (same thing as import std, you can find them in libc++' std.cppm).

Notice that this is an extreme example since we're importing the whole standard library and is actually discouraged [^1]. Instead you can get through the day with just these flags: `-stdlib=libc++ -fimplicit-modules -fimplicit-module-maps` and of course -std=c++20 or later, no extra files/commands required! but you are only restricted to doing import <vector>; and such, no import std.

[^1]: non-standard headers like `bits/stdc++.h` which does the same thing (#including the whole standard library) is what is actually discouraged because a. non-standard and b. compile-times, but I can see `import std` solving these two and being encouraged once it's widely available!
faresahmed
·昨年·議論
Makes you wonder, how many webpages are dependant on such services. The Web has always been brittle, but it's a little sad seeing a website not able to survive ~50k users on its first day online.

Even the least offenders, GitHub Pages, broke links before [0].

[0]: https://github.blog/news-insights/product-news/new-github-pa...
faresahmed
·昨年·議論
Not so much,

    >>> s="1"+"0"*4300
    >>> json.loads(s)
    ...
    ValueError: Exceeds the limit (4300 digits) for integer string conversion: 
    value has 4301 digits; use sys.set_int_max_str_digits() to increase the limit
This was done to prevent DoS attacks 3 years ago and have been backported to at least CPython 3.9 as it was considered a CVE.

Relevant discussion: https://news.ycombinator.com/item?id=32753235

Your sibling comment suggests using decimal.Decimal which handles parsing >4300 digit numbers (by default).
faresahmed
·昨年·議論
It has been kind of made into a movie! The Heptapods [0] in Arrival (2016) written script is a circular shape with each subsection of the shape conveying a different meaning ultimately representing a concept or thought. A quote from the movie:

> Like their ship or their bodies, their written language has no forward or backward direction. Linguists call this "nonlinear orthography", which raises the question: Is this how they think?

While the movie explores philosophical questions other than "Arrival" and does a quiet beautiful job at that, actual linguistic experts have helped making it and it has been praised for its accuracy. I suggest you give it a go.

[0]: https://aliens.fandom.com/wiki/Heptapod
faresahmed
·昨年·議論
I'm not quiet sure why a non-technical person would be engaging in a technical matter such as compiling LLVM, they say they are involved with some Arch Linux derivative but again the question persists.
faresahmed
·昨年·議論
Same here, the title even says "TypeScript" not "Typescript" but whatever.

I think what's somehow interesting about this is in the footer of the page:

    Autonomously crafted in 15m 4s by Leap.new
Could be some form of advertisement (with a click-baity title too? wouldn't be surprised if that also was AI-generated).