Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
deredede
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
18 ms
·
181.
▲
by
deredede
4y ago
Can you explain how inheritance makes more sense here? I don't see much practical difference between Circle/Path/etc. inheriting from base class Shape or implementing trait Shape here. The only difference is that AFAIK the la
182.
▲
by
deredede
4y ago
I'd say "unsurprising" rather than "under control", but yeah, I think that's a big part of it. If it's slow, you have time to see and anticipate what's going on, even if you don't control it. It&
183.
▲
by
deredede
4y ago
If that is an animation that plays often, you might want to consider a trade-off between how good it feels the first time you play it and the 100th time you play it. This may not apply to your situation but I'd wager the time lost to s
184.
▲
by
deredede
4y ago
Yeah for-else as implemented in Python is... not actually that useful. It's the right tool to inline std::find_if and that's basically it. I think the behavior you had in mind would actually be more intuitive and more useful. OTOH
185.
▲
by
deredede
4y ago
For-else could be useful, but I don't think Python's semantics would actually help here? Python's for-else runs when the for loop did not break (even if nonempty), but what would be needed here would be to run when the for lo
186.
▲
by
deredede
4y ago
I didn't know that was possible, thanks. It's worse than in other languages imo but better than the existing C++ alternatives, I will use it.
187.
▲
by
deredede
4y ago
Whatever is implemented by operator[] in a given language is going to be implicitly encouraged by the language, and that's what most novices will use.
188.
▲
by
deredede
4y ago
My C++ is a bit rusty (no puns intended), I didn't know your first syntax was possible now (another comment states it comes from C++17), that's much nicer than the alternative that pollutes the scope indeed. Having to repeat both
189.
▲
by
deredede
4y ago
If you only implement operator[]() it should do the same thing as only implementing Index in Rust, thanks to implicit cast conversion. Whether it causes "the correct things to fail and everything else to work" is up to interpret
190.
▲
by
deredede
4y ago
My only gripe with find() is that you can't do `if (auto it = map.find(key))`. Otherwise yes, that's the way.
191.
▲
by
deredede
4y ago
Insert on lookup is convenient but encourages either double-lookup patterns (contains + get) or unintentional inserts. I very much like Python's setdefault -- except for its 10-chars name.
192.
▲
by
deredede
4y ago
To be fair, you could achieve the same in C++ by only implementing `operator[]() const`.
193.
▲
by
deredede
4y ago
You can (almost) always set up different registries, this is not what GP is talking about. Java packages are named according to (reversed) domain names, e.g. the standard library is in net.java.*, and Java registries allow/require you
194.
▲
by
deredede
4y ago
ODBC doesn't help you if you use any sort of pgsql-specific extension, however.
195.
▲
by
deredede
4y ago
Flask seems to be a very stable and feature-complete framework (I see about 3 commits per year for the last few years). At this point isn't it easier and just as safe to manually review the code, pin the hash in a lockfile, and manua
196.
▲
by
deredede
4y ago
Sorry for the late reply. It doesn't matter that this set of addresses is undecidable: so is the halting problem and yet we can precisely define the set of halting programs. You don't have to know these adresses beforehand, so you
197.
▲
by
deredede
4y ago
It's easy to argue that an impractical mechanism we know how to make is easier to modify and refine into a practical mechanism compared to an existing impractical mechanism we don't know how to replicate.
198.
▲
by
deredede
4y ago
Take the set of addresses that are pointed to by the program counter during execution. They are off-limit. Things are a bit more murky with variable-length instructions, but basically you are not allowed to read as data any address that is
199.
▲
by
deredede
4y ago
I disagree, a database interface is a format boundary at which a transformation occurs (from text to SQL) and so is globbing (from text to pattern).
200.
▲
by
deredede
4y ago
That doesn't make sense to me and I agree with GP. If I consume HTML and I escape all HTML input I'm given, I'm utterly useless. Now when I consume text and convert that text into HTML for further treatment, I'm produc
201.
▲
by
deredede
4y ago
If the libs are called Barracuda and Seagull you'll have to spend years telling people "although you have heard of Barracuda, the lib you want to use now is Seagull", I don't see that as very different. People don't
202.
▲
by
deredede
4y ago
I love bland and uninspiring names. What's libcamera? A library for dealing with cameras, I'd wager. What's AXIOM? Not sure... My first guess would be a proof assistant. It's also not just FOSS, Apple for instance has ma
203.
▲
by
deredede
4y ago
I have no tips, but I share the pain. My intuitive reaction when seeing an arrow is that it changes the text direction, and I do not give semantic meaning to the arrow direction. Iow, my brain essentially treats `a <- b` and `b -> a`
204.
▲
by
deredede
4y ago
I had the same initial reaction as you but actually think that in such situations asking people not to interact with the members of the organization is appropriate. Sometimes people do need to be put in timeout, and I read this as a formal
205.
▲
by
deredede
4y ago
Te article mentions `list` as being inadequate, and I tend to agree. It needs to be typed in repeatedly, breaking the flow each time, and replacing the "last command" executed with an empty line.
206.
▲
by
deredede
4y ago
> (I wish GDB could print a source listing around the breakpoint as context, like Delve, but no such feature exists. The woeful list command is inadequate.) I don't know what Delve does, but learning about GDB's Terminal User I
207.
▲
by
deredede
4y ago
On CPUs you can't really force data to stay on the cache, but if you access it frequently and there is not too much load, it will stay there anyways. Some architectures (e.g. GPUs) provide local "scratchpad" memories instead
208.
▲
by
deredede
5y ago
Oh I was not aware of this syntax in C, thanks for bringing it up! I still think the pattern is more common and known in Rust but I might be wrong :) Re: your other points, "reusing a pre-allocated struct from a buffer" is basical
209.
▲
by
deredede
5y ago
I'm not saying you shouldn't reuse allocated objects. I'm talking about building a local object (no dynamic allocation) and assigning it to the pointer at once. This has the same runtime behavior (assuming -O1) as assigning t
210.
▲
by
deredede
5y ago
This is only partially fair. In Rust you would probably have assigned a new object into *buf here instead of overwriting the fields manually. It is good practice to do this (if the code is logically an object initialization, it should actu
More ›