Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
maleldil
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
12 ms
·
301.
▲
by
maleldil
1y ago
> I think being able to take and return futures or promises and handle them how you wish is better ergonomics. You can do that. If you don't await an async call, you have a future object that you can handle however you want.
302.
▲
by
maleldil
1y ago
I'd argue that it is. Use const by default, so it's obvious to the reader if something is mutated or not. It's easier to read code when you don't have to worry about how values may change over time. This is why Rust made
303.
▲
by
maleldil
1y ago
By "the goal", I mean TFA's, not JS's.
304.
▲
by
maleldil
1y ago
There are [1] and [2] for function arguments and loop variables, respectively, but nothing for the general case. Note that a type checker will complain if you re-assign with a different type. Pylint also has [3] for redefining variables fro
305.
▲
by
maleldil
1y ago
Because this isn't immutability. The goal is to have a way to define an object that will never change after initialisation, and JS's const isn't it.
306.
▲
by
maleldil
1y ago
How isn't it transitive in C++? If the variable/reference is const, you can't modify fields, and you can only call const methods. What else do you need?
307.
▲
by
maleldil
1y ago
Not "a resource", but memory specifically. If there's a proper resource (e.g. a file), you should ensure it's explicitly released instead of relying on the GC (using with/close/etc.) And if memory usage is real
308.
▲
by
maleldil
1y ago
> But it's a little too verbose to just sprinkle on every variable in C++ It's worth it, though. Every variable that isn't mutated should be const. Every parameter not mutated should be const, and so should every method th
309.
▲
by
maleldil
1y ago
This is only for redefinitions that change the type. If you re-assign with the same type, there's no warning. However, pylint does issue warnings for other interesting cases, such as redefining function arguments and variables from an
310.
▲
by
maleldil
1y ago
Good old Gell-Mann Amnesia! It doesn't mean he's incompetent in his core area of expertise, though.
311.
▲
by
maleldil
1y ago
> Whenever I see methods with 5+ params I don't see why that's a problem. If a function implements an algorithm with several parameters (e.g. a formula with multiple variables), those values have to be passed somehow. Does it m
312.
▲
by
maleldil
1y ago
eslint has this too: https://eslint.org/docs/latest/rules/prefer-const
313.
▲
by
maleldil
1y ago
JS's const doesn't go far enough since you can still mutate the object via its methods. In C++, you can only call const methods (which can't mutate the object) on const variables.
314.
▲
by
maleldil
1y ago
> there still has to be mutable state somewhere - so where is it moved to? This is one way of thinking about it: https://news.ycombinator.com/item?id=45701901 (Simplify your code: Functional core, imperative shell)
315.
▲
by
maleldil
1y ago
That was 6 years ago. I'd like to see how that feeling developed.
316.
▲
by
maleldil
1y ago
GEO is a thing, too.
317.
▲
by
maleldil
1y ago
That assumes that pyx (or whatever else they come up with) will be enough to sustain the company.
318.
▲
by
maleldil
1y ago
> In terms of formatting etc I rely on tooling which break the CI. That way they don't even surface. Equally if something slips through the CI needs to be updated I also do something similar with lint rules. For Rust, this means tur
319.
▲
by
maleldil
1y ago
Many developers are on Windows, and those tend to prefer GUIs. CLI reliance is mostly a macOS/Linux thing.
320.
▲
by
maleldil
1y ago
Where do you get them instead? eBay?
321.
▲
by
maleldil
1y ago
Relevant link regarding Qt moc and reflection https://wiki.qt.io/C%2B%2B_reflection_(P2996)_and_moc
322.
▲
by
maleldil
1y ago
I generally agree with you, but this is a poor take. Developers, in general, like to write code. Writing prose is incidental. If the job becomes writing prose instead of code, it's easy to see why there's pushback.
323.
▲
by
maleldil
1y ago
You don't need an iPad Pro with M5 for that, though.
324.
▲
by
maleldil
1y ago
The characteristics that make pt-PT sound similar to Russian are largely absent in pt-BR.
325.
▲
by
maleldil
1y ago
Sometimes dynamic Python idioms are incompatible with typed Python. I personally think that's fine, since I consider static typing a significant improvement overall.
326.
▲
by
maleldil
1y ago
I can access https://thepiratebay.org/index.html just fine from Hyperoptic.
327.
▲
by
maleldil
1y ago
> Like, searching for `isLoading` on my frontend (~3444 files) is instant with rg (less than 0.10s) but takes a few minutes with grep. grep will try to search inside .git. If your project is Javascript, it might be searching inside node_
328.
▲
by
maleldil
1y ago
The very first paragraph in ripgrep's README makes that behaviour very clear: > ripgrep is a line-oriented search tool that recursively searches the current directory for a regex pattern. By default, ripgrep will respect gitignore r
329.
▲
by
maleldil
1y ago
> Like 99% of all languages currently in use. That's true about memory, but nearly all mainstream programming languages have problems with null pointers: Java, C#, Go, etc.
330.
▲
by
maleldil
1y ago
I imagine Pycharm would still be better at refactoring (extract method/variable, in-line variable, etc.) LSPs are good at renaming, but not much else. There's a plug-in, but it breaks very often.
More ›