Hacker Newsnew | past | comments | ask | show | jobs | submit | robto's commentslogin

I've been meaning to try this out, from my read it's a declarative way to get some structured concurrency. I work in a codebase that heavily uses core.async channels to manage concurrency and you really need to pay close attention to error handling. When you're spawning new threads you need to set up your own custom machinery to re-throw errors on a chans, close chans, and it looks like core.async.flow is a way to do all of this declaratively.

Just like `core.async` itself was a frontrunner of Virtual Threads on the JVM, I view `core.async.flow` as the Clojure version of the upcoming [0]Structured Concurrency JEP. I do wonder if it will use that under the hood once it becomes stable, the same way `core.async` is planning to move away from the `go` macro to just have it dispatch a virtual thread.

[0]https://openjdk.org/jeps/453


I don't think it would be feasible or wise to structure core.async to use Structured Concurrency, although Structured Concurrency is trying to tackle some of the same problems as flow but in a different way (more akin to data flow style concurrency).


We've been looking at virtual threads in a project at work and what we found is that it is quite difficult to adapt existing code to run with virtual threads.

For example, class initialization pins a thread so any singleton defined in the standard, recommended Java way (using a static inner instance of an inner class) can hang your program forever if the singleton definition suspends. And because they worked really hard on making async colourless, there is no way to know that a method call will suspend. This is a known issue with a workaround if the suspend is due to a network call,

https://bugs.openjdk.org/browse/JDK-8355036

which is useful for some applications (web servers). Figuring out that this is why my program was hanging required quite a bit of work too. We are still frustratingly far from the ergonomics of Go concurrency (all threads are virtual threads, hangs automatically panic).


Clojure's focus on immutable data and pure functions side-step a lot of the trickiest issues with virtual threads. It's often not hard to isolate the I/O parts of your program into flow processes at the edges that can be mapped to the :io pool using virtual threads.


The trickiest problems with VT aren't due to mutability. Mutability is problematic with any kind of concurrent programs.

The difficult problems are execution problems like pinning. There are plenty of existing concurrency libraries on the JVM (Cats Effect, clojure async, Kotlin coroutines, RxJava, quarkus, etc etc). The promise of VT is that you will no longer need those for scheduling and execution of work (whether that's tasks, fibers, coroutines, actors etc.) This only works if you use VTs throughout, not just on IO pools.


> can hang your program forever if the singleton definition suspends

I am no expert on the topic, but this seems like a very edge case scenario, that is not trivial to reproduce on even the linked bug ticket. Do you think it really is that big of an issue?


It's really not hard to reproduce,

- vt1 locks lock1

- vt1 suspends on lock2

- n VTs attempt to initialize a singleton that requires lock1, so they all suspend within pinning class init.

- you release lock2.

- all platform threads are pinned, so vt1 can't run and you hang forever.

There is no lock inversion and progress would have been entirely possible with platform threads, even with just one.

It happened on our system because we have parallel streams that all access the same singleton at the same time, which is fairly easy to do (you have lots of parallelism, you have a map operation that needs a value from your singleton and that's it.)

The solution is to never suspend while in a static block, but it's hard to generalize because... any method may suspend, and there is no way to know that it will because of colourlessness. And also the singleton pattern is common, often involve accessing expensive resources or IO (and suspending) and doing so with class init lock is recommended and common,

https://shipilev.net/blog/2014/safe-public-construction/#_sa...

In our case this involves scala's object {} which is a singleton defined using class init. Kotlin probably works the same way.


Thanks for the reply, I see!

Hopefully it will be solved, similarly to the other pinning issues then! Though wouldn't reserving a few platform threads solve the issue?


I think the RDF standards have produced many useful tools for those that work with graph data. And the W3C is a useful coordination place for new standards like Verifiable Credentials[0] and Decentralized identifiers[1] and JSON Linked Data[2], which are all being used in ActivityPub, Bluesky, and a lot of other decentralizing projects.

[0]https://en.wikipedia.org/wiki/Verifiable_credentials [1]https://en.wikipedia.org/wiki/Decentralized_identifier [2]https://en.wikipedia.org/wiki/JSON-LD


Clojure atoms use STM, though. I've been writing Clojure for almost a decade now, it's not that STM isn't great, it's just that immutable data will carry you a very long way - you just don't need coordinated mutation except in very narrow circumstances. In those circumstances STM is great! I have no complaints. But it just doesn't come up very often.


That’s incorrect. Only refs+dosync use stm. https://clojure.org/reference/refs

Not atoms.

From Hickey’s History of Clojure paper:

“ Taking on the design and implementation of an STM was a lot to add atop designing a programming language. In practice, the STM is rarely needed or used. It is quite common for Clojure programs to use only atoms for state, and even then only one or a handful of atoms in an entire program. But when a program needs coordinated state it really needs it, and without the STM I did not think Clojure would be fully practical.”

https://dl.acm.org/doi/pdf/10.1145/3386321

Atoms do an atomic compare and swap. It’s not the same thing.


Haha, I read The Joy of Clojure way back in 2013 and conflated the different reference types with STM. So thanks for mentioning that, I always thought it weird that you'd need STM for vars and atoms too.

That said, I have never used a ref, nor seen one in use outside of a demo blogpost.


Totally! They are rare. Cheers


PS I agree atoms and stm are both solid though — and that you can go a very long way without touching either!


I would say to the contrary it would come up all the time if the right idioms were in place.

For example, when it comes to concurrent access to a map the Clojure community generally forces a dichotomy, either stick a standard Clojure map in an atom and get fully atomic semantics at the expense of serial write performance or use a Java ConcurrentMap at the expense of inter-key atomicity (or do a more gnarly atom around a map itself containing atoms which gets quite messy quite fast).

Such a stark tradeoff doesn't need to exist! In theory STM gives you exactly the granularity you need where you can access the keys that you need atomicity for and only those keys together while allowing concurrent writes to anything else that doesn't touch those keys (this is exactly how e.g. the stm-containers library for Haskell works that's linked elsewhere).


One of the fun things about Clojure that reinforces this "trivially true" perspective is that maps and sets are functions:

    ;; "maps" the keys to the values
    (map {1 "a" 2 "b"} (take 5 (cycle 1 2))) ;;=> '("a" "b" "a" "b" "a")
    ;; acts as a predicate that tests for membership
    (filter #{"a" "b" "c"} ["a" "b" "c" "d" "e" "f"]) ;;=> '("a" "b" "c")
Once you get used to this idiom you naturally start thing of other functions (or applicative functors) the same way. The syntax sugar makes for some very concise and expressive code too.


I wonder if there's any chance of technology like Verifiable Credentials[0] getting any adoption because of these laws. I think there are legitimate use cases where you would want to say, "hey, some third-party authority can vouch for me that ____", and not reveal to the third party who's asking for verification and not reveal to the party requiring verification any other claim besides the specific one that they need (say, age in this case).

[0]https://en.wikipedia.org/wiki/Verifiable_credentials


What's insane is that, in France, we have France Connect, which is exactly what you describe: a third-party authentication platform maintained by the government.

Lately, a new law just passed to force porn websites to check the age of visitors. I would have been fine with an authentication going through France Connect:

- the gov knows which website you went to, just like your DNS provider would, but it doesn't which content - and the website knows which content you've watched but not who's watching.

Best of both worlds!

But no, we have to send a copy of our ID card to the website, which is INSANE because the website knows WHO you are and WHAT you're watching.


We need this in the US. Otherwise, once laws like this https://apnews.com/article/utah-app-store-age-verification-7... go into effect, 3rd party app stores, like apkmirror.com, etc. are going to need to pull out of the US unless there's a service like that in the country. It's starting with Utah, but many states and even the feds are planning similar laws.


What knock on effects do you see here, for state-led legislation about online privacy? Do we see privacy-conscious vs restrictive US states, and do folks in the (let’s say it, blue) states host US-centric Mullvads? Like out of state abortions.

Going further, how might this effect folks having “freedom is more important than safety” beliefs, given they reside in areas more likely to deny civil liberties-ish rights in the name of family values-ish rights, when this starts to really hit them where it hurts? Everything they do or say online becomes traceable to them, for a notoriously vocal-on-social media set.


It's mind boggling that governments don't offer that service for a lump sum per month


Is the Cybersecurity Fabric an open standard? I didn't see any licenses in the Github repository. Is Tidecloak just an implementation of an open protocol? Or is it entirely proprietary?


Tricky question, because the answer to this will evolve in time (as planned). First, thanks for pointing out the license issue on Github. We'll fix that right away. The Cybersecurity Fabric operates based on the Tide Protocol: our WIP open standard. TideCloak is exactly that: just an implementation of that protocol on a Keycloak IAM. The protocol is "source available" but "commercially restricted" - similar to the BSL modus operandi. It'll take us some time to properly document that protocol to a level adequate for release - but in the meantime, we'll provide office hours and direct interactions with the community to share that knowledge.


I could see using one of these as a landline replacement. I was lamenting with another parent the expense of a landline and how difficult it is for kids to call each other to arrange a park meetup or other games - this could fill that gap perfectly.


All data is a graph, and so graph query languages work well for this. SPARQL is my tool of choice but cypher and maybe GQL (though that's new).


interesting! that's a mathematically provable statement? or do you mean, most data can be represented as a graph? (I'm not asking antagonistically; I'm genuinely interested in the statement you made)


I will not address your question directly, but if you are interested in the mathematical treatment of equivalence between schemas, maybe category theory and the categorical query language (Spivak from MIT if I remember correctly) may be of interest.


I taught my kids how to read pretty early (4, not 2) using the Teach Your Child to Read in 100 Easy Lessons book, which was astoundingly easy.

Both kids are now in school and reading significantly above grade level and I have different concern - their ability far outstrips their experience. So even though they can read large unfamiliar words, the subject matter of the stories that are challenging enough to be interesting to them deal with themes and experiences that are pretty foreign. Books that deal more with their experiences and interests are written at a much more basic reading level and are not interesting to them.

They seem to really enjoy reading but sometimes I wonder if early reading is really beneficial in the long run. On the other hand, I certainly read some books too young, but I don't really regret that, so maybe I'm just making up problems to worry about.


> On the other hand, I certainly read some books too young, but I don't really regret that, so maybe I'm just making up problems to worry about.

Don't have kids but I agree, this sounds part of growing up. I believe adult books as a precursor help understand real experiences better.

Being a fan of BFG and Matilda, I accidentally ended up picked up Roald Dahl's "Skin" (his adult short stories collection) when I spotted it as a preteen in my school library.

I didn't understand half of it but I still devoured it in a day.

I only started understanding when I was much older and actually experienced similar things in life.



This is the one that I stumbled upon: https://en.m.wikipedia.org/wiki/Skin_and_Other_Stories


I started with that book but moved to https://reading.com - it is the same pedagogy and essentially the same curriculum but with more engaging stories, larger fonts, and interactive sliders my kids enjoyed.

To be super clear this isn’t an app you hand your kids. You still sit side by side and teach the lessons.


That looks pretty nice - my youngest lost interest once the stories started, and I think that was partly because the stories weren't particularly engaging. But overall I was extremely impressed with the pedagogy, it was so easy it felt like cheating!

Now I need to figure out a fun way to do spelling, since both of the kids like to write but English is really tricky to spell.


My kids are motivated by writing letters to friends and family which we either mail or send a photo of via Signal. All the writing motivates spelling.


We used the same book with our kids, and are encountering the same issue. The books that are at the proper reading level are often not appropriate from a content perspective.

I work in literacy and am aware of a number of companies that are working to develop solutions that allow teachers/parents to level up/down reading materials to address this mismatch.


Can you share some search terms / company names? I'm very interested in this as a parent


Check out Diffit, which takes URLs or text and re-levels the text and gives comprehension questions. [1]

Also check out Quill, which is a nonprofit mostly focused on writing but moving into the reading comprehension area as well. [2]

There are others as well, but it's not clear which will emerge as winners.

1: https://app.diffit.me/

2: https://www.quill.org/


sounds like something genai would be good at


I tried using that book with a kid with adhd and it wasn't working, but I have tried to use its lessons while reading other books. If anybody reads this that has success despite adhd, please let me know if you have any advice.

4 is still pretty young so I'm not stressing about it.


For what it's worth, the oldest got all the way through on his own power, asking to do it each day. The next kid petered out around day 45 and we didn't try to force it, but she's even more advanced than the first one was at her age now. Not stressing about it seems to be a good approach : )


My young son also has ADHD (diagnosed but no need for medical intervention). When Covid came and we stayed at home, he got bored, so I decided to teach him to read. We are non-native speakers, so it's natural for us to look for a phonics method. Luckily, I stumbled upon the right one: Reading Egg. It's a reading app based on a scientific phonics-based approach with very engaging activities and a library to choose from.

In the beginning, I worked with my son, but after about a week he was able to continue on his own. We started very light with 2 lessons per weak + maths lessons (oh, they have maths too. But the reading app is much better, IMO). Later it was probably 3 lessons per weak, IIRC. I still do the reading with him in the first month, but in the later months he could read (the task) on his own.

After 3 months my son could read independently and he ventured out to read books outside the app. Today he is an avid reader with a wide range of interests (business and marketing is the currentbhot topic :D ). He scores in the top 3% in reading (measured twice a year by the MAPS tests) and in the top 0.001% in maths. Considering his developmental problems, I think it's remarkable progress. And not least thanks to the Reading Eggs app.

I always find the discussion about how to teach reading in the US superfluous because there is a proven better way and it is so cheap. So maybe give it a try.

Disclaimer: I am in no way affiliated with Reading Eggs. Just a happy customer.


Thanks, I'm going to give it a shot.


> I'm just making up problems to worry about.

Isn’t that what parenthood is all about?


I had a collegiate reading level at age 5 and still struggled to read many kinds of fiction books which were rooted in familiarity with the human experience. I could get through the books, but I didn't really comprehend them well until I'd read and watched enough media to piece together a more robust model of the world.


I read every books in the house as soon as I could read adult books (by age 5). Some books even multiple times. I was offered a lots of fiction books growing up.

Age 7, I would read the dictionary at night, one word definition at a time, out of sheer curiosity.

By age 14 I stopped reading books. I could never relate to any of the human emotions. I did learn that money, fame, and sex was a big deal perhaps. But you don't need books to learn that if you have a social life instead of reading books all day.

All this made me appear smart for my age, but that doesn't mean I was. I merely appeared smart.

Hitting the plateau was rough.


Can definitely relate to the dictionary thing. I enjoyed that exercise.

Age 14 is when I transitioned from primarily fiction books to almost exclusively non-fiction material, including history, news, biographies, STEM etc.

Fiction really stopped clicking for me, I appreciate the genre but it just no longer captivated my interest. Games and some visual media entirely consumed that need for fantasy. There's just so much more to nerd about with those formats.

Lots of little details that come from such massive collaborative efforts, whereas with fiction books I started to feel like I was encountering the same tropes over and over again.

> All this made me appear smart for my age, but that doesn't mean I was. I merely appeared smart.

I feel like I'm having the opposite effect. I'm looking backward at how intelligent I was during school and wondering where it all went. I think becoming jaded and traumatized from sheer stress and emotional pain really blunted my mind. I still consume lots of reading material but something just feels different.


This is odd. One of the ways kids learn to read early is by starting off being expiated to fairytales and other fiction then later learning to read those same stories. That useless sets them up to enjoy fiction.


Fairytales didn't do anything for me. I was more interested in books by authors such as Dr. Seuss, Shel Silverstein, etc. as the focus was more on the manipulation of language itself. The substance mattered very little at the time, it was the form which entranced me. Which is funny, because with visual art I prefer substance over form.


Feels like something an LLM could help with, turn the sinoler texts with appropriate subject matter into slightly more advanced writing while retaining the appropriate subject matter?


This is my goto:

webserver: ring-jetty9-adapter[0]

routing: reitit[1]

html templates: hiccup[2]

never used an ORM, but happily used HugSQL for making composable queries[3].

[0]https://github.com/sunng87/ring-jetty9-adapter [1]https://github.com/metosin/reitit [2]https://github.com/weavejester/hiccup [3]https://www.hugsql.org/


Those all look great, including HugSQL, thanks!


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: