Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
joeycumines
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
6 ms
·
1.
▲
Ask HN: Protobuf in TS/JS, Terrifying?
1 points
by
joeycumines
1y ago
|
0 comments
2.
▲
Show HN: Smartpoll – A Dynamic, Reactive "Task Scheduler" for Go
(github.com)
1 points
by
joeycumines
3y ago
|
0 comments
3.
▲
by
joeycumines
3y ago
Addendum: My first attempt would drift over time, if the receiver was slow. Hurt my head a little, but it's fixed now, and I'm at least moderately confident it's correct - unit tested the behavior step by step using `ts-chan`
4.
▲
by
joeycumines
3y ago
Actually, it was fun, so I've made it into an actual package. The one I slapped together works, but this one is better (fixes issues with actually stopping it properly): https://github.com/joeycumines/generator-tic
5.
▲
by
joeycumines
3y ago
What makes data races not a "real race condition"? Anyhow, do what you will. I don't get the impression that you are genuinely interested in this topic.
6.
▲
by
joeycumines
3y ago
Sure do, I haven't actually used this one (I implemented it just then) but it should do the trick: https://gist.github.com/joeycumines/6206f2a6cd79875c7c164738...
7.
▲
by
joeycumines
3y ago
Generators have lots of really nice uses, yep. I'm not sure what specifically you were imagining, but I've added an example of how "vanilla JS" can achieve fan-in, using an AsyncGenerator: https://github.com&#
8.
▲
by
joeycumines
3y ago
First instalment of docs/examples complete, feedback appreciated: https://news.ycombinator.com/item?id=38183241
9.
▲
by
joeycumines
3y ago
Concurrency != Parallel execution
10.
▲
by
joeycumines
3y ago
An operation may take longer than a single tick of the event loop, and may have it's own rules regarding state transitions. To be clear, I'm not saying "don't do any communication by sharing state", just that there
11.
▲
by
joeycumines
3y ago
I'm working on improving documentation and examples, still a WIP, but you may find this interesting: https://news.ycombinator.com/item?id=38183241
12.
▲
Ask HN: Fan-in pattern in JavaScript, ts-chan docs, feedback requested
(github.com)
1 points
by
joeycumines
3y ago
|
1 comments
13.
▲
by
joeycumines
3y ago
Hey HN, Based on feedback on my last post: https://news.ycombinator.com/item?id=38156519 I've been working on better documentation and examples, aimed at JavaScript developers without significant knowledge of concurren
14.
▲
by
joeycumines
3y ago
Hey, that's a neat little trick to implement locking in JS, thanks. I oversimplified my example perhaps - it also involved handling interruptions (certain system events), maintaining a lifecycle (set up and tear down), and scenarios wh
15.
▲
by
joeycumines
3y ago
Fan-in is the other way, but yeah you can do batches of concurrent operations in JS fairly easily. I still like "pipelining" over that, but that can also be implemented with just an iterator, pretty trivially.
16.
▲
by
joeycumines
3y ago
I am working on better examples, but they are going to take me a while, at the rate I'm currently going. To be clear, `ts-chan` is not intended to target any use case already addressed by promises or async/await. You mentioned CSP
17.
▲
by
joeycumines
3y ago
I'd agree with you for personal projects, but there are plenty of companies etc using TS/JS for backend systems, my current place of work included.
18.
▲
by
joeycumines
3y ago
Yep, JS is still single threaded, and all that. I agree async iteration is pretty good - the `Chan` class implements both `Iterable` and `AsyncIterable`. For quite a few scenarios, async generators are a better choice. They do have limitati
19.
▲
by
joeycumines
3y ago
I might be completely wrong, but the impression I got from your comment is that you haven't been exposed to many implementations using non-trivial concurrency :) Fair call though, I guess. It doesn't really matter, but I'm ce
20.
▲
by
joeycumines
3y ago
From the concurrent prime sieve example? That's just something I copy and pasted from the documentation for the benchmark package I used. Allegedly, it is to prevent "certain compiler optimisations", which is something I'
21.
▲
by
joeycumines
3y ago
Concurrency is just the ability to handle multiple tasks at the same time, to use my quickly googled definition. JavaScript already supports concurrency, e.g. handling more than one HTTP request concurrently, despite the runtime being singl
22.
▲
by
joeycumines
3y ago
I'll definitely keep that in mind, thanks :)
23.
▲
by
joeycumines
3y ago
If you want it to run on exiting the function in reverse order, something like Python's context managers would probably be necessary. I've dabbled in that too, though I don't actually use it for anything, currently: https:&#
24.
▲
by
joeycumines
3y ago
That one is actually pretty easy in JavaScript - in the past I've implemented the same sort of behavior using async generators. (I also like Go's time.Ticker behavior quite a lot)
25.
▲
by
joeycumines
3y ago
Sure, I intend to give it a shot. I will say though, I personally get the impression that attempts at "concurrency" in JavaScript (in production code) are quite rare, which I attribute to how difficult it is. That is to say, I don
26.
▲
by
joeycumines
3y ago
I think y'all have very fair points, for the record. Unfortunately it is a lot easier to write documentation for an audience that shares the same context / background / experience. The README was written with an audience in m
27.
▲
by
joeycumines
3y ago
Ah, that example is demonstrating an internal mechanism used to ensure the high-level asynchronous API calls take at least one tick of the event loop to complete. There is no `result` variable - I was just attempting to convey that "so
28.
▲
by
joeycumines
3y ago
I actually considered including one in the README, but there were (are) lots of other topics to consider. The tl;dr is that there is some cross over, but the use cases and patterns they support are largely different. Message channels are tw
29.
▲
by
joeycumines
3y ago
I've been considering adding a `select` function, but I was concerned with the overhead of recreating the select case each time, and wanted to reserve it for a time once I've mulled over my options (I'm aiming to avoid making
30.
▲
by
joeycumines
3y ago
The concurrency comes from providing mechanisms to communicate between independent, asynchronous chains of operations. Here is an example, that I based on an example from within the Go spec: https://github.com/joeycumines&#x
More ›