Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
pkolaczk
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
45 ms
·
571.
▲
by
pkolaczk
5y ago
GC pauses are not the only GC issue. Thrashing the caches and blowing up memory usage by an order of magnitude can be also very bad for performance. In a database system memory is very precious - the more of it you can use for caching /
572.
▲
by
pkolaczk
5y ago
Languages like Rust and Scala learned they lesson: they don't add features, but also remove or fix features. This is why you have editions or major versions, which are not 100% backwards compatible. E.g. Scala 3 comes with a major rede
573.
▲
by
pkolaczk
5y ago
A product type forces the language to have a special "invalid" state for every type like Nil, and this reminds me of all the problems related to null handling I know from java - like forgetting to check for null / Nil. A prod
574.
▲
by
pkolaczk
5y ago
I tried Go and I have an opposite experience. To me Go looked like a very limited, incomplete and non-principled language that makes easy things look easy but hard things ugly or (near) impossible. I put it on the same shelf as Python and B
575.
▲
by
pkolaczk
5y ago
The average devs with 10 years of experience also make ton of mistakes, even when developing the 10th project. Projects are not all the same. I've met people with 10+ years of experience, labeled as seniors who write horrible code. I&#
576.
▲
by
pkolaczk
5y ago
C++ is not Coq, but it is still a lot closer to Coq than C-like Java written for performance. > Naturally it is possible to write static classes that hide the internals of a data structure Which limits you to reusing a single instance wh
577.
▲
by
pkolaczk
5y ago
Memory corruption / safety issues related to memory are not only typical C problems like use after free but also type errors. Optimizing Java for performance means using only primitive types which is significantly less type-safe than C
578.
▲
by
pkolaczk
5y ago
The problem is, Java written in that specific limited way is way less expressive, less safe and less productive than modern C++, not even mentioning Rust.
579.
▲
by
pkolaczk
5y ago
Yeah, I know I can recover, that's why I said they are equivalent of C++ exceptions (which can be caught as well). But this is not a recommended idiomatic way of handling expected errors, e.g. input errors, improper configuration, I&
580.
▲
by
pkolaczk
5y ago
> but it's the whole point ! that's exactly why exceptions are good ! Good for what? For crashing the program with a stacktrace? Probably. But for regular error handling - that's a terrible thing. They break normal control
581.
▲
by
pkolaczk
5y ago
Exception handling may indeed end up with less code, but often it is because the developers forgot to handle most error situations properly. And that's my biggest gripe with exceptions, particularly the unchecked ones, which can just p
582.
▲
by
pkolaczk
5y ago
> You forgot another line, it was actually: No I didn't. That line is totally irrelevant and does not apply to the socket that was passed to the NetworkComponent. It applies to the initial socket you've added which was not eve
583.
▲
by
pkolaczk
5y ago
The playground link confirms the socket is closed after dropping networkComponent. Last two lines of the output: Dropping NetworkComponent Dropping NetworkSocket Btw: you probably fooled yourself by accidentally creating 2 so
584.
▲
by
pkolaczk
5y ago
And what did you try to prove here? There is no use after free and no runtime error in this rust code. The socket stays valid since the moment of its creation and for the whole lifetime of the network component. It gets moved out of nested
585.
▲
by
pkolaczk
5y ago
NetworkComponent foo = new NetworkComponent(); { using my_socket = new NetworkSocket(); foo.socket = my_socket; } foo.do_sth_with_socket(); // oops, runtime failure, socket closed
586.
▲
by
pkolaczk
5y ago
Comparing office work with a WFH situation when kids are at home is unfair - apples to oranges. If you were in the office, where would your kids be? Who would take care of them? If you want a fair comparison, compare to a situation when you
587.
▲
by
pkolaczk
5y ago
Oh yeah, definitely. It is good to have these all escape hatches at hand. But it is not good to default to them - I guess you could program Rust like Java by throwing everything into Arc<RefCell<..>>, but that's not they wa
588.
▲
by
pkolaczk
5y ago
Non-deterministic garbage collection applies to a tiny fraction of the state problem though - the memory part. It does not apply to other types of resources: file descriptors, sockets, database sessions, connections, threads, etc. - general
589.
▲
by
pkolaczk
5y ago
I have written a few parallel, non-trivial Rust programs (actually one of them, fclones seems to be one of the best in class performance-wise, despite many competitors), yet I've never had to use Refcell and runtime-checked borrowing.
590.
▲
by
pkolaczk
5y ago
> The static analysis of the borrow checker is not able to figure out when you're headed for trouble via this route. This route exists purely because you can't statically prove some programs correct. Without it, the compiler wo
591.
▲
by
pkolaczk
5y ago
In practice it is even not true, because there is a non-zero cost of interfacing between managed runtime and native non-managed code. Therefore not every piece of code that would theoretically benefit from writing in a non-managed language,
592.
▲
by
pkolaczk
5y ago
There is a lot being said about productivity gains from GCed languages, but can you actually point me to any research showing these gains are real? My anecdotal, unscientific experience shows that GC is a double-edged sword that maybe makes
593.
▲
by
pkolaczk
5y ago
> I try to reference all the things all the time, cause its ingrained in my brain as more efficient than copying stuff around or/and requesting things from hashmaps. Many people don't realize that actually referencing all the t
594.
▲
by
pkolaczk
5y ago
> A map or pretty much any nontrivial data structure is not a flat region. Not necessarily. A hashmap can be implemented in a way it stores both the keys and values in a flat memory region, as long as keys and values are fixed size, and
595.
▲
by
pkolaczk
5y ago
Unfortunately many programmers underestimate the speed at which computers can copy flat regions of memory these days and overestimate speed of code littered with pointers and indirection. Often using pointers to avoid copying a few bytes le
596.
▲
by
pkolaczk
5y ago
Depends on the language/plugin. They seem to prefer their own plugins instead of using LSP and tools given by the language ecosystem and they often end up with vastly incorrect error highlighting and autocomplete. At least this is what
597.
▲
by
pkolaczk
5y ago
Even with visible lane markings, in the day time, Tesla FSD can't do very basic maneuvers like taking left turns that cross the opposite traffic. Or stopping at red light reliably. Autonomic cars are still inferior to human drivers and
598.
▲
by
pkolaczk
5y ago
In many areas of the world EVs are more expensive to buy, much more expensive to repair, and not really cheaper to drive, because electricity is about the same price as gas. Add to that they are less convenient and slower on large distances
599.
▲
by
pkolaczk
6y ago
If you stuff annotations inside objects in order to locate other objects, you're technicality still making references. Whether you use an integer index, string key, pointer or a thing called "reference" in your language doesn
600.
▲
by
pkolaczk
6y ago
1. You can solve these issues with weak references. 2. A lot of stuff that need doubly-linked lists is enclosed in libraries anyways, so you don't need to worry about it. 3. Reference cycles are ugly even in GCed environments and gener
More ›