Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
pansa2
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
43 ms
·
511.
▲
by
pansa2
5y ago
And it only supports assignment statements and keyword statements. What’s a “keyword statement”?
512.
▲
by
pansa2
5y ago
Can’t you rewrite the second of those so it becomes the first, hence rewriting `>` into `<`?
513.
▲
by
pansa2
5y ago
> why use Lua instead of something like mruby The main reason is momentum - Lua has been the de-facto standard embeddable language for at least 15 years. For example, it's used in World of Warcraft which was released in 2004. Anot
514.
▲
by
pansa2
5y ago
> WoW [...] have no interest in dealing with the slow reference VM Does WoW use LuaJIT? I thought it used the reference Lua 5.1 VM, simply because that was the newest version when it was first released. > Plans to further support t
515.
▲
by
pansa2
5y ago
I would expect Luau to be significantly slower than LuaJIT though, because Luau doesn’t include a JIT compiler.
516.
▲
by
pansa2
5y ago
Async functions and generators, in both JavaScript and Python, are forms of (asymmetric) stackless coroutines. Usually the term “fiber” is only used for stackful coroutines.
517.
▲
by
pansa2
5y ago
PHP’s fibers seem to be purely asymmetric - they provide only `resume(fiber)` and `suspend()` functions. Lua’s coroutines are similar. OTOH Ruby’s fibers also provide a symmetric `transfer(fiber)` function. Asymmetric and symmetric coroutin
518.
▲
by
pansa2
5y ago
Like Go, except there's no parallelism (and no preemption). I think Rust's approach requires colored functions.
519.
▲
by
pansa2
5y ago
> Async Ruby is similar to Go's goroutine model. Goroutines are just (lightweight) threads - they can run in parallel. You need locks whenever you access shared data. AFAIK Ruby’s fibers are cooperatively scheduled and can only yi
520.
▲
by
pansa2
5y ago
> Does anyone have any insight into why Python async doesn't work the same way? Ruby async seems to be implemented using stackful coroutines. IIRC Guido has been opposed to adding these to core Python, preferring stack-less corout
521.
▲
by
pansa2
5y ago
On the other hand, if you’re not at the point where you care about maximum performance, you may want to shy away from C++ altogether. This implies that there are very few situations in which C++ with STL is the right choice - which seems
522.
▲
Python PEP 671 (draft) – Syntax for late-bound function argument defaults
(python.org)
2 points
by
pansa2
5y ago
|
1 comments
523.
▲
by
pansa2
5y ago
This story is currently at position 5 with only 3 points: https://news.ycombinator.com/item?id=29024572
524.
▲
by
pansa2
5y ago
> A story needs to accumulate 5 points to appear in the Live List. I don’t think this is right. During quiet times, I’ve definitely seen stories in the “live list”, and even on the front page, with only 3 points.
525.
▲
by
pansa2
5y ago
Eric Lippert explains the reasons why `async` was chosen for C# here: https://docs.microsoft.com/en-au/archive/blogs/ericlippert/a... . Other languages have used the same keyword either for their own good
526.
▲
by
pansa2
5y ago
Thanks for the encouragement, it’s appreciated.
527.
▲
by
pansa2
5y ago
Exactly. IMO we still don't have a good #3 language - in particular, all of the popular languages that can be compiled into native code are in category #1.
528.
▲
by
pansa2
5y ago
> I’m curious if you’re suggesting it would be better to increase complexity by allowing all of C++? No, definitely not. I’m wondering if there might be a language on the horizon that’s suitable for game engine development but which is
529.
▲
by
pansa2
5y ago
> I'm so done with C++. But what to use instead? Especially in an industry like game engine development, where C++ is basically all there is (and almost all there’s ever been)? Are we forever going to be stuck with every company t
530.
▲
by
pansa2
5y ago
No, the visibility of `foo` is the same in both examples. Python’s `if` statements do not introduce a new scope.
531.
▲
by
pansa2
5y ago
That’s exactly the same as this, though. foo = data.get("foo") if foo: handle_foo(foo) The only place I have found the walrus operator useful is in similar `while` loops, where the equivalent code would be:
532.
▲
by
pansa2
5y ago
Actually, I don’t really want the feature. It’s complicated and it doesn’t really fit with the rest of the language (it breaks fundamental rules, as above, and has scoping issues). Worst of all, though, it’s really just another way to write
533.
▲
by
pansa2
5y ago
IMO the match statement has some very unintuitive behaviour: match status: case 404: return "Not found" not_found = 404 match status: case not_found: return "Not found&qu
534.
▲
by
pansa2
5y ago
The walrus operator provides no benefit here. `my_match` is still in scope in both cases. Python’s `if` statements do not introduce a new scope.
535.
▲
by
pansa2
5y ago
With the GIL, for an int i, `i += 1` is not thread-safe, but IIRC for a list l, `l += [1]` (i.e. extend) is. Presumably this patch changes the list implementation in some way so that the extend operation remains thread-safe without the GIL.
536.
▲
by
pansa2
5y ago
Agner Fog’s manual lists a latency/reciprocal-throughput of 15/10 for 64-bit divide on Ivy Lake & Tiger Lake, vs 3/1 for 64-bit multiply. So division is 5-10x slower than multiplication. https://www.agner.org&#
537.
▲
by
pansa2
5y ago
SipHash is considerably slower than an unkeyed hash function, isn’t it? One idea I had to avoid its overhead is to use double hashing, with a fast primary hash and SipHash as the secondary hash. Naïvely this feels as though it should provid
538.
▲
by
pansa2
5y ago
> The packaging ecosystem is still a burning dumpster fire, the performance is still hot garbage and the whole approach to asyncio makes me want to bang my head against a wall. These issues, plus the inability to build a standalone bin
539.
▲
by
pansa2
5y ago
> So if the owner needs to check the shared ref count every time it changes the count of the non-atomic local count, isn't that basically all the negatives of a single shared atomic counter? I think the owner only needs to check t
540.
▲
by
pansa2
5y ago
> Python shouldn't cannibalize the niche it filled It’s too late for that, IMO. Python’s already added async-await because it wants to be C#, type hints because it wants to be Java, and pattern matching because it wants to be Hask
More ›