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

The purpose of effect handlers, direct-style effects etc, is to let the type-checker/type-inferencer do most of the reasoning about side-effects.

Using such techniques requires an upfront investment of learning how this works, but once that mountain is climbed, programming becomes easier, faster and less error prone in many cases.


I agree with it becoming less error prone and more composable. But faster and easier? The examples I've seen in this and other articles about effect systems use many more lines of code just to print a single line than you would use in a language like Python, and that's excluding the definition of the effect types themselves. Ideally, I'd like to get all the benefits of an effect system, but without the verboseness that seems to come with it.


Clearly, effect systems, as we know them today, are very heavyweight, and not worth the effort in the small. That's not controversial. But we have to present the ideas to beginners somehow. Those complex types come into their own in (some) large-scale programs, and especially as large-scale programs evolve, as they are being changed by programmers other than the original authors. (Not all programming tasks may be suitable, see the article on Rust for games programming that's on the front page RN.) All that said, the whole point of the article, and the research on direct style effects is to make effect typing much more lightweight. Effect types as we do them today metastasise along the call graph, and that is a big problem (this is also why Java-style exception specifications are considered a mistake). Direct-style effects essentially use implicit arguments, as popularised by Haskell and Scala, to hide much of this complexity. Whether this experiment will succeed, or direct style effects suffer from other problems is unclear and we have to wait until we have enough experience with them. And that can only start, once there is a language that implements support for first class direct style effects.

The article suggests that this is coming to Scala, and I'm looking forward to being a guinea pig.


> The examples I've seen in this and other articles about effect systems use many more lines of code just to print a single line than you would use in a language like Python

This seems to me a bit like complaining that defining C functions and for-loops are so much more verbose than just using JMP instructions in assembly language, so why go to all the trouble of bothering with functions?

The point is that effects and effect handlers are a new form of structured programming, but for effects instead of values. New structure seems heavyweight for trivial things, but ultimately scales and composes better for realistic programs.


> defining C functions and for-loops are so much more verbose than just using JMP instructions in assembly language

Are you sure? It's not just a JMP; for a loop you need a compare and increment/decrement instruction at the very least, and calling a function is way more complex than a JMP: you have to place the function arguments in the right registers and/or on the right place on the stack, you need to save registers that might get clobbered, and you need to push a return address before you jump. So in C these things are definitely more compact to write.

I did get the point about effects introducing a new form of structure and composability, and I'd really like to see that. But at the moment it looks like it is as much work as actually implementing a function call in assembler, the only benefit is that the compiler will check the correctness for you.


The abstract concept here is liveness, aka "eventually something good will happen". In practise, liveness alone is insufficient because a locked up program/processor is indistinguishable from a very slow program/processor. So you really want bounded liveness, along the lines of "within X time units, something good will happen".


Every good book on compilers. I learned this from [1]. The (hard to read) original papers include [2, 3]. Interesting tidbit: Gary Kildall, one of the pioneers of abstracting dataflow analyses, later played a role in the (in)famous deal between Microsoft and IBM that became the starting point for the dominance of the former. The foundational theory behind this is abstract interpretation for which you have many introductions, including [5, 6], with the (hard to read) original being [7].

[1] https://cs.au.dk/~amoeller/spa/

[2] G. A. Kildall, Global expression optimization during compilation.

[3] G. A. Kildall, A Unified Approach to Global Program Optimization.

[4] https://en.wikipedia.org/wiki/Gary_Kildall

[5] F. Nielson, H. Riis Nielson, C. Hankin, Principles of Program Analysis.

[6] X. Rival, K. Yi, Introduction to Static Analysis: An Abstract Interpretation Perspective.

[7] P. Cousot, R. Cousot, Abstract interpretation: A unified lattice model for static analysis of programs by construction or approximation of fixpoints.


LLMs today still struggle to met specifications exactly, which is what synthesis is good at.


There is interesting research in having LLMs cull the search space (for instance, asking the llm to provide which instructions are needed to complete the spec and provide an implementation) and then using more traditional techniques like ilp (or other symbolic means) to find the final program that corresponds to the spec. That way the result meets the spec but converges much (much!) faster than the traditional way for far complexer cases. Sometimes the llm gets it right in one shot (and the engine just verifies it is correct), sometimes it will never get it correct but ilp will finish the job just fine.


I agree this is an interesting direction. IIRC the top (open) bitvector synthesiser works like this (albeit not with ILP).

Trouble with ILP is that it doesn't work on GPUs (as of April 2024) and on CPUs synthesis and other forms of learning are hopeless. That may change in the future ...


Survey propagation works primarily with random SAT instances, but isn't competitive with SAT instances that arise in industrial verification, where CDCL shines. Some gossip: survey propagation was proposed by Mezard, Parisi, and Zecchina [1], and G. Parisi won the physics Nobel price in 2021 [2].

[1] M. Mezard, G. Parisi, R. Zecchina, Analytic and Algorithmic Solution of Random Satisfiability Problems. https://aiichironakano.github.io/cs653/Mezard-RSAT-Science02...

[2] https://en.wikipedia.org/wiki/Giorgio_Parisi


Unfortunately, Harrison's book, despite its many other merits, doesn't really treat CDCL (= conflict-driven clause learning), which is really what makes SAT solvers fly.


I'll be happy to circle back to more modern methods once the core parts of the field are addressed. The point of the library is not really to deliver a competitive solver (yet).


> Lobotomy was generally not voluntary on the part of the patient [...] curious how you feel about other forms of body modification

In what sense can children consent to genital mutilation, since they do not understand at all human sexuality and the human sex drive, since the have had absolutely no experience with it? Virtually all other forms of body modification are also not legal for children.


> In what sense can children consent to genital mutilation

First, I think it’s important to draw a distinction between the practice of genital mutilation - a practice that is alive and well in various cultures and maims significant numbers of kids every year in the name of religious superstition - from sex change operations.

Regardless of what you think about the appropriate age for such a decision, reducing this to “genital mutilation” trivializes the issue and tries to draw a comparison with a barbaric practice despite there being no connection between the two.

Almost all forms of surgery would appear barbaric on the surface if not for the significant utility of undergoing those surgeries. That doesn’t mean we should equate cutting someone open and removing their appendix with a ritualistic religious practice that appears similar at face value.

That said, I made no claims about the appropriateness of these surgeries for minors, nor do I believe someone at that age is mature enough to understand the implications of such.

That doesn’t change anything that I wrote though, even if it’s an important factor to consider for a subset of potential patients.


(1) it is a sex change operation, please do not misrepresent modern genital mutilation. Sex is a biological phenomenon to do with reproduction and, simplifying a small bit: there are two sexes, male and female. A man whose genitals are mutilated does not become a women (i.e. gains the ability to give birth to children).

(2) the purpose of modern genital mutilation for the mutilatee is to facilitate sex fraud, and for the mutilator is, one imagines, money.

(3) if believe someone at that age is mature enough to understand the implications of modern genital mutilation, you will have to face the question why you trivialise it. Your writing here may, directly or indirectly lead to more modern genital mutilation. Speech has consequences.


Whoops, typo. "(1) it is a sex change operation ..." should be: "(1) it is not a sex change operation"


There’s no difference- it all leaves kids infertile and orgasm naïve


Contrary to popular hysteria, it's extraordinary rare that anyone under the age of medical consent is given what you would call "bottom surgery".

As far as parents forcing children into genital mutilation, this is actually very popular and common elective medical procedure, but the word you're looking for is circumcision.


"extraordinary rare" is still too much, and trivialises the issue. There is serious lobbying in place in many countries to make it happen more. As you know, the only acceptable rate is 0. One important stepping stone in getting this rate back down to 0 is to make it illegal tout court even for adult. There should not even be medical infrastructure for such mutilation.

Aside, your user name here is after an organisation founded by one of world history's worst mass murderers. Can I suggest to show empathy with his victims, and not use this term? Using it trivialises his crimes.


> "extraordinary rare" is still too much

I'm just being generous, I'm not technically aware of a single instance.

> even for adult

Is this a theocratic totalitarianism thing or a hatred for humanity and hatred of personal freedom thing?


[flagged]


Murder and bank robbery are fundamentally criminal acts. There is no version of these acts that become acceptable upon reaching the age of majority.

Calling out the fact that the majority of sex change operations happen at the behest of an adult who elects to have the operation is not derailing the discussion, but inserting a rather critical point of context when examining the issue broadly.

That doesn't mean the concern about minors is not legitimate, but clarifies that the conversation is much broader than this subset.

> Neither male nor female circumcision affects the ability to have children.

Why is this relevant? I have not been mutilated, but I choose not to have children either. I haven't yet undergone a vasectomy, but plan to do so at some point in the future so I don't have to worry about it. But this seems like a non-sequitur, unless you're implying there is some moral compulsion to procreate.

> Female circumcision is forbidden almost everywhere.

It's estimated that ~200 million girls/women alive today have undergone FGM, and a significant number still undergo this yearly. While the practice is in decline in many places, there are countries where no such decline has started.

But regardless of that, it's an orthogonal issue, and no more belongs in a conversation about sex change operations than bringing up ritual organ harvesting in a conversation about appendectomies.

> Too much apologia of child abuse!

Again, acknowledging that surgery is often necessary is not the equivalent of apologizing for non-consensual ritual sadism.


How is letting consenting adults make their own medical decisions "child abuse"?


Children don't get gender surgeries. Stop spreading misinformation


I went through a similar learning trajectory.

I think one has to experience it oneself though, my friends and relatives who never left the suburbs pity me for my restricted living space, and don't believe me when I tell them live is easier with less baggage and it a walkable center of town. I suspect they think I'm rationalising an inability to afford a suburban McMansion.


> building a high trust society is more culture than demographics

This is the kind of question that benefits from a probabilistic analysis: does ethnic homogeneity, on average, help or hinder building and maintaining a high trust society?

Many conflicts in world history have an ethnic dimension. Many substantial social cleavages, even if they are not ethnically based, over time may evolve an ethnic dimension. For example some religions have an ethnic dimension, most religions require members to marry only within the own religion etc. Moreover, people are more likely to procreate with people they spend a lot of time with. So even linguistic differences can lead to ethnicisation, since it's easier to socialise with people you can easily communicate with.


It seems save to say that ML has been moving further and further away from what neuroscience suggests, and towards efficient execution on fast GPUs and TPUs. That's in part b/c neuroscience is currently not equipped to explain how human high-level intelligence works.


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

Search: