Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
masklinn
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
46 ms
·
961.
▲
by
masklinn
2y ago
> printf-style formatting ("foo %s" % "bar") feels the most ready to be retired (except insofar as it probably never will, because it's a nice shortcut). It’s also the only one which is anything near safe for bei
962.
▲
by
masklinn
2y ago
Seems like exactly the situation where you’d want parsers, because they can do any form of quoting \ escaping you want and have no reason to care about newlines any more than they do any other character.
963.
▲
by
masklinn
2y ago
> Only PCREs are exponential time, in service of a feature you basically never need. Regexes are always linear time. Any re dialect which supports backtracking necessarily has a non-linear worst case, and while a select few have very hig
964.
▲
by
masklinn
2y ago
> Rust is supposed to replace C++, not C, right? Rust is intended as a systems langage. To the extent that it’s “supposed” to replace anything, it’s both.
965.
▲
by
masklinn
2y ago
There’s also Lightyear. But so far the Zero (formerly One) ran into the ground after a barely existent production run, and the Two I’m not sure exists in any way.
966.
▲
by
masklinn
2y ago
It can. Rust does. That requires a way to opt out tho, because there are situations where you need a specific field ordering, so now the langage needs to provide way to tune struct compilation behaviour.
967.
▲
by
masklinn
2y ago
Ggp is not talking about structural typing, but about sync.Pool type erasing (it takes `any` values, and returns `any` values). So you can put (and will retrieve) random garbage from it.
968.
▲
by
masklinn
2y ago
> It didn't, do what? Reintroduce “packing into interfaces”. It did a completely different thing. Small integers remain not inlined.
969.
▲
by
masklinn
2y ago
It didn't, actually. Instead go 1.15 has a static array of the first 256 positive integers, and when it needs to box one for an interface it gets a pointer into that array instead: https://go-review.googlesource.com/c&#
970.
▲
by
masklinn
2y ago
Go did use to do that, it was removed years ago, in 1.4: https://go.dev/doc/go1.4#runtime
971.
▲
by
masklinn
2y ago
Pure hydrogen peroxide will do a lot worse than burn on contact with an open sore, unless you mean "set your sore on fire" (though it's more likely to detonate, or spontaneously dissociate into steam and pure oxygen). Usual
972.
▲
by
masklinn
2y ago
That’s part of it, but compilers also use the information more directly especially in languages with inexpressive type systems e.g. dereferencing a null pointer is UB so the compiler will tag a dereferenced pointer as “non-null”, then will
973.
▲
by
masklinn
2y ago
> Since it's UB this gives a license to do whatever the f we want, including something that's clearly not at all what the dev intended That’s really not how it works. Compilers rather works in terms of UBs being constraints (on
974.
▲
by
masklinn
2y ago
> the presence of an implicit conversion rule `T -> T?` amounts to the observation that `T <: T?`, where <: is the subtyping relation So you assert that numbers and strings are the same type because PHP and Javascript will impli
975.
▲
by
masklinn
2y ago
> If a function accepts a value that can be String or null, it is ok to pass it a value that is guaranteed to be a String and not null. Or in other words, String is a subtype of String?! That's... not true? The language can just hav
976.
▲
by
masklinn
2y ago
Usually it's used for saying something is heap allocated. In this case it doesn't seem very relevant, it looks like the article just assumes boxed records are dynamically or structurally typed, even though that's completely u
977.
▲
by
masklinn
2y ago
> It's a mystery why we didn't simply reuse XPath for selectors... it's all in there!! It's not really a mystery: > CSS was first proposed by Håkon Wium Lie on 10 October 1994. [...] discussions on public mailing l
978.
▲
by
masklinn
2y ago
On the other hand: - XPath literally didn't exist when CSS selectors were introduced - XPath's flexibility makes it a lot more challenging to implement efficiently, even more so when there are thousands of rules which need to be d
979.
▲
by
masklinn
2y ago
> Then you have PyPy which you’d have to accommodate somehow. Adding pypy support to a pyo3 + maturin project was literally just a matter of telling maturin to build that wheel. And I added graal while at it. Hopefully they eventually ad
980.
▲
by
masklinn
2y ago
> In that case, sure, but if you have an entire async framework you don't want that blocking call. What “entire async framework”, do you mean asyncio or some other third party library? In the former case, are you using it just to fe
981.
▲
by
masklinn
2y ago
That’s pretty much irrelevant given urllib3 is a third party dependency as well.
982.
▲
by
masklinn
2y ago
It’s way older than that. It used to live in urllib2, which dates back to at least Python 2.1, released in April 2001.
983.
▲
by
masklinn
2y ago
requests is really useful for non-trivial http requests (especially as urllib has terrible defaults around REST style interactions). But here all the script is going is a trivial GET, that’s urllib.request.urlopen(url)
984.
▲
by
masklinn
2y ago
There’s absolutely no need for async http here. The script does one http request at the top of main. And a trivial one too (just a simple GET). response = urlopen(url) return json.load(response) is what they’re saving themselve
985.
▲
by
masklinn
2y ago
> is this something like template specialisation No. > I wish more languages supported that, we did some crazy things with template metaprogramming. Which is exactly why most langages don’t.
986.
▲
by
masklinn
2y ago
> every interface being zeroable seems to be embedded quite deeply in the language. Not just every interface, every single type. And it’s at the very core of the language. For any type T you can name, you can write var v T And i
987.
▲
by
masklinn
2y ago
> E.g. that whole `iota` thing is hardly a good example of "simple and obvious" language design compared to enums in... just about everything else. I actually disagree with this specific take. I do agree that iota is an unnece
988.
▲
by
masklinn
2y ago
Yes.
989.
▲
by
masklinn
2y ago
> I don't get how this is not widely used as standard. It requires bespoke tools for edition, and while CSV is absolute garbage it can be ingested and produced by most spreadsheet software, as well as databases.
990.
▲
by
masklinn
2y ago
> The issue related to using a growth factor of 2 appear when you have a single very big array And a linear coalescing allocator of which that collection is essentially the only user. That is, the allocator needs to be a single bytes arr
More ›