frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Gemini Diffusion

https://simonwillison.net/2025/May/21/gemini-diffusion/
202•mdp2021•2h ago•31 comments

Show HN: Display any CSV file as a searchable, filterable, pretty HTML table

https://github.com/derekeder/csv-to-html-table
71•indigodaddy•2h ago•13 comments

Getting a paper accepted

https://maxwellforbes.com/posts/how-to-get-a-paper-accepted/
24•stefanpie•2h ago•0 comments

For algorithms, a little memory outweighs a lot of time

https://www.quantamagazine.org/for-algorithms-a-little-memory-outweighs-a-lot-of-time-20250521/
205•makira•7h ago•46 comments

Gemini figured out my nephew’s name

https://blog.nawaz.org/posts/2025/May/gemini-figured-out-my-nephews-name/
47•BeetleB•3d ago•12 comments

In the past year my illustration business has dropped more half

https://reverentgeek.com/ai-really-is-taking-my-job/
40•cebert•1h ago•33 comments

Tales from Mainframe Modernization

https://oppi.li/posts/tales_from_mainframe_modernization/
34•todsacerdoti•3h ago•8 comments

Google releases Material 3 Expressive, a more emotional UI design system

https://m3.material.io/blog/building-with-m3-expressive
8•nativeforks•2d ago•2 comments

ITXPlus: A ITX Sized Macintosh Plus Logicboard Reproduction

https://68kmla.org/bb/index.php?threads/itxplus-a-itx-sized-macintosh-plus-logicboard-reproduction.49715/
57•zdw•5h ago•12 comments

Devstral

https://mistral.ai/news/devstral
397•mfiguiere•13h ago•83 comments

CERN gears up to ship antimatter across Europe

https://arstechnica.com/science/2025/05/cern-gears-up-to-ship-antimatter-across-europe/
77•ben_w•2d ago•26 comments

Rocky Linux 10 Will Support RISC-V

https://rockylinux.org/news/rockylinux-support-for-riscv
94•fork-bomber•6h ago•30 comments

Collaborative Text Editing Without CRDTs or OT

https://mattweidner.com/2025/05/21/text-without-crdts.html
199•samwillis•10h ago•53 comments

OpenAI to buy AI startup from Jony Ive

https://www.bloomberg.com/news/articles/2025-05-21/openai-to-buy-apple-veteran-jony-ive-s-ai-device-startup-in-6-5-billion-deal
655•minimaxir•10h ago•893 comments

Show HN: Confidential computing for high-assurance RISC-V embedded systems

https://github.com/IBM/ACE-RISCV
76•mrnoone•7h ago•5 comments

How AppHarvest’s indoor farming scheme imploded (2023)

https://www.lpm.org/investigate/2023-11-16/a-celebrated-startup-promised-kentuckians-green-jobs-it-gave-them-a-grueling-hell-on-earth
18•andrewrn•2h ago•4 comments

Animated Factorization (2012)

http://www.datapointed.net/visualizations/math/factorization/animated-diagrams/
233•miniBill•12h ago•53 comments

The curious tale of Bhutan's playable record postage stamps (2015)

https://thevinylfactory.com/features/the-curious-tale-of-bhutans-playable-record-postage-stamps/
91•ohjeez•8h ago•6 comments

Sorcerer (YC S24) Is Hiring a Lead Hardware Design Engineer

https://jobs.ashbyhq.com/sorcerer/6beb70de-9956-49b7-8e28-f48ea39efac6
1•maxmclau•6h ago

The Machine Stops (1909)

https://standardebooks.org/ebooks/e-m-forster/short-fiction/text/the-machine-stops
59•xeonmc•6h ago•12 comments

Possible new dwarf planet found in our solar system

https://www.minorplanetcenter.net/mpec/K25/K25K47.html
113•ddahlen•8h ago•73 comments

LLM function calls don't scale; code orchestration is simpler, more effective

https://jngiam.bearblog.dev/mcp-large-data/
180•jngiam1•10h ago•69 comments

Show HN: ClipJS – Edit your videos from a PC or phone

https://clipjs.vercel.app/
95•mohyware•7h ago•41 comments

Did Akira Nishitani Lie in the 1994 Capcom vs. Data East Lawsuit?

https://www.thrillingtalesofoldvideogames.com/blog/akira-nishitani-capcom-data-east-lawsuit
25•danso•2d ago•1 comments

An upgraded dev experience in Google AI Studio

https://developers.googleblog.com/en/google-ai-studio-native-code-generation-agentic-tools-upgrade/
115•meetpateltech•9h ago•66 comments

Storefront Web Components

https://shopify.dev/docs/api/storefront-web-components
130•maltenuhn•10h ago•38 comments

ZEUS – A new two-petawatt laser facility at the University of Michigan

https://news.engin.umich.edu/2025/05/the-us-has-a-new-most-powerful-laser/
95•voxadam•12h ago•94 comments

I have tinnitus. I don't recommend it

https://blog.greg.technology/2025/05/20/tinnitus.html
78•gregsadetsky•4h ago•74 comments

London’s water pumps: Where strange history flows freely (2024)

https://londonist.com/london/features/london-s-water-pump
17•joebig•3d ago•0 comments

Introducing the Llama Startup Program

https://ai.meta.com/blog/llama-startup-program/?_fb_noscript=1
160•mayalilpony10•11h ago•60 comments
Open in hackernews

What Is the Difference Between a Block, a Proc, and a Lambda in Ruby? (2013)

https://blog.awaxman.com/what-is-the-difference-between-a-block-a-proc-and-a-lambda-in-ruby
71•Tomte•3d ago

Comments

vidarh•3d ago
Separating out blocks this way is pretty meaningless. Blocks are a syntactical construct that can be optimized a certain way, and is in MRI.

You can obtain a value of a block by naming it, and when you do, what you obtain is a proc.

A Ruby implementation could if it chooses make any block a proc, because you shouldn't be able to tell the difference without extensive contortions (e.g. you could iterate over ObjectSpace and show that a block causes the creation - or not - of an object of the Proc class). And in-fact my (woefully buggy and incomplete) Ruby compiler prototype does just that.

jez•3h ago
I think this is the important point. Something I've mentioned about blocks in Ruby before: if you’re prototyping a new interpreted language and don’t want to have to build a JIT that can optimize code, but still want some semblance of good performance, the block approach Ruby picks can be pretty useful.

Ruby doesn’t haven to allocate a full-on, garbage-collected, closure object every time a function accepts a block: it only has to do this if the block gets stored to a variable. If the block is only ever yield’d to, the allocation can be skipped.

And when your language’s primary looping mechanism is done with blocks, the difference adds up:

    xs.each do |ys|
      # with normal closures and no fancy JIT,
      # the VM has to allocate a closure once per loop:
      ys.each do |y|
      end
    end
Ruby was able to get away with its closure-heavy standard library APIs without a JIT for almost 3 decades because of the affordances that blocks provide over procs/lambdas.
drnewman•1h ago
That's insightful
HellzStormer•9h ago
For those unaware, Ruby blocks (and procs) are more flexible than anonymous functions as most language implement them. The article briefly goes over that, mentioning that lambda (regular anonymous functions) and procs (blocks) don't treat execute `return` the same way. There are also particularities with regard to next (continue) and break.

I made a post about the niceties of blocks: https://maxlap.dev/blog/2022/02/10/what-makes-ruby-blocks-gr...

jbverschoor•5h ago
Which is exactly what I don’t like about them. They should’ve used a different keyword or something.

This runs you into problems similar to missing a break in such statements with many language

chowells•5h ago
Flexible in a way, sure. But non-locality is generally a bad property, not good. Adding it is a workaround for all the enumeration methods using blocks in a way that makes people think they're weird looping syntax instead of a fundamentally different idea.

People want to do early returns from looping over a collection, so take the easy solution of adding more messy language semantics instead of finding a semantically simple solution instead. (For that matter, have fun working out the semantics of break and next when used in a block that isn't an argument to an enumeration method. How do you as a method author opt in to distinguishing between the two after yielding to a block?)

This is generally the case with Ruby everywhere. Why does that thing have an edge case with weird semantics? To work around the edge case with weird semantics somewhere else. It's all fine if you want to just try things until something works. But if you want to really understand what's going on and write code that's a first-class participant in the language features, it gets really frustrating to try to deal with it all.

vidarh•5h ago
It's really not that complex.

For my (buggy, unfinished, languishing without updates) prototype Ruby compiler, lambda and proc (and blocks) are all implemented nearly the same way, with the exception that for proc/blocks, return/break/next will act as if having unwound the stack to the scope where the proc was defined first (or throw an error if escaped from there).

The distinction is very obvious when you think of it in that way - a proc acts as if called in the context/scope it was defined, while a lambda acts as if called in the scope it is called in.

> How do you as a method author opt in to distinguishing between the two after yielding to a block?

You don't. A block acts as a proc, not a lambda. If you want lambda semantics, then take a lambda as an argument - don't take a block/proc and be surprised it doesn't act like something it isn't.

chowells•4h ago
Given that you completely ignored what I said I wanted to do and gave an answer for some other question, I'm pretty sure it's more complicated than you think.

I want to write a method that takes a block and distinguishes between next and break, exactly like the methods of enumeration do. It's obviously possible because a super common interface does it.

Last time I looked, that interface does it by being written in native code that interfaces with the interpreter. That is, it's not part of the language semantics. It's a special case with weird rules unlike what anything else gets to do.

Or at least it was. Maybe the language has actually made it accessible since then, but I'm not optimistic. That's not the ruby way.

kayodelycaon•4h ago
I think you’re seeing the base language.

Effectively blocks are self-contained chunks of code. You can change things around them, but you can’t change how keywords work inside them. Because you’re crossing a method boundary when you call a block you’re not able to access next and break. (Or capture return.)

Ruby is defining scope here and C methods are not limited by the language they define.

drnewman•4h ago
It seems you're pretty upset about your experience with Ruby. I'm sorry that's been the case for you.

However, in Ruby blocks aren't just about flexibility, more importantly they're about generality. They're not there to resolve an edge case at all (Ruby also has keywords for loops). They're a generalization of control flow that is just slightly less general than continuations. In practical use they provide an alterative to Lisp macros for many use cases.

These were some of the problems Matz was trying to sort out with his design of Ruby--creating a language that was fun and easy to use for day-to-day programming, with as much of the meta-programming power of Lisp and Smalltalk as possible. Blocks are one of his true innovatations that came from trying to balance that tension.

igouy•3h ago
> Blocks are one of his true innovatations …

How do they differ from Smallalk blocks? (I don't know.)

https://drcuis.github.io/TheCuisBook/Block-syntax.html

drnewman•1h ago
Blocks in Smalltalk (to my understanding) are closures. Blocks in Ruby are closures that also bring the call stack they were created in with them.

One way to think of about it is this: anonymous functions as originally implemented in early Lisps are code as an object, closures are code with its lexical environment as an object. You can think of a Ruby block as code with its lexical environment and its call stack as an object.

So they don't just handle return differently than closures, they have access to the call stack of the site where they're created like a continuation. This is why they handle return differently, but this is just one of the things that falls out from that. It also comes with other control flow features like "redo", "retry", "next", "rescue", "finally", and others. These are all call stack control (control flow) conveniences, just like return is. All of them can be thought of as being abstractions built on top of continuations (just ask a Scheme hacker).

Originally Ruby was basically a Lisp without macros, but with continuations, a Smalltalk like object system and a lot of syntactic affordances inspired by Perl, and other languages. Blocks are one of the conveniences built on top of the Lispy semantics.

Note that I'm explaining how blocks work as an abstraction (vidarh below explains how they work as a concretion, as implemented in MRI).

igouy•1h ago
> … other control flow features like "redo", "retry", "next", "rescue", "finally", and others.

At-a-glance afaict Smalltalk provides those features too, so I would guess Smalltalk blocks may have access to the call stack too?

https://drcuis.github.io/TheCuisBook/The-Debugger.html

drnewman•1h ago
Yes Smalltalk has continuations. So it can do all of those things as well. But I don't think they're explicitly tied to blocks like they are in Ruby. This really isn't a problem for Smalltalk since it's not as syntax oriented as Ruby.

The invovation is to have those features tied to convenient syntax.

igouy•1h ago
So is the innovation to make something that was available in Lisps / Smalltalks, available within the different constraints of Ruby.

(I should check how Smalltalk blocks behave.)

chowells•2h ago
No, return exiting the enclosing function scope from a block is the special case that's there to resolve an edge case.

Blocks should be nothing special. They're anonymous functions that capture the environment mutably. The only new part is all the special bits added to handle the weird edge cases that they're trying to pretend don't exist.

pmahoney•3h ago
Can you explain further? I'm not sure I follow.

> How do you as a method author opt in to distinguishing between [break and next] after yielding to a block?

I don't use Ruby much lately, but if I yield to a block which calls break, control will pass to the code following the block (and not back to my method). If the block calls next or simply finishes, control passes back to me though I cannot know if next was called or not (but do I care? I can go ahead and yield the next element of a collection either way)

chowells•2h ago
Ah, you're right. They do have observably different behavior. But I can't even close an open file handle after a break. That's still pretty miserable.
paulddraper•8h ago
tl;dr

A block is a part of the AST. Like a pair of braces.

A proc is a function.

A lambda is a proc that treats args and returns differently.

endorphine•7h ago
> Lamdas check the number of arguments, while procs do not

FWIW, Matz himself called this difference "a design mistake".

weaksauce•7h ago
which way would he have liked to be the "correct way"
drnewman•1h ago
I'd think the preferred way would be to implement them as a separate class. That'd be more in line with the design of other core classes (like TrueClass & FalseClass). It'd also have created the opportunity to create a "Callable" protocol early in the design which would have been great, and would harmonize with the design of Ruby's many other protocols Enumerable, Comparable, Range-compatible values, etc.
jez•3h ago
Do you have a source for this?
drnewman•1h ago
Yeah, I think I've heard that too.
kubb•6h ago
What happens when you return from a proc when the enclosing function has already returned?
lcnPylGDnU4H9OF•6h ago
You can't call return from inside a Proc inside a method; you will encounter a LocalJumpError.
vidarh•5h ago
You can call return from inside a proc all you want. You can't do so if you return the proc to an outside scope without getting LocalJumpError.

E.g, given:

    def foo = proc do 42 end
    def bar = proc do return 42 end
Then `foo.call` is fine, but `bar.call` will indeed give a LocalJumpError as you say.

But a return in a proc that hasn't escaped its defining scope is fine:

    def baz = proc do return 42 end.call
Calling `baz` here will just return 42 to the surrounding scope.
vidarh•5h ago
This example:

    def foo
      proc do
        return 42
      end.call
    end

    def bar
      proc do
        return 42
      end
    end
    
    p foo
    p bar.call
Will produce:

    42
    test.rb:11:in `block in bar': unexpected return (LocalJumpError)
from test.rb:16:in `<main>'

So in other words, it's handled.

whalesalad•5h ago
This is the biggest wart on the Ruby language by far.