frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Show HN: A small programming language where everything is pass-by-value

https://github.com/Jcparkyn/herd
37•jcparkyn•2h ago
This is a hobby project of mine that I started a few years ago to learn about programming language implementation. It was created 95% without AI, although a few recent commits include code from Gemini CLI.

I started out following Crafting Interpreters, but gradually branched off that until I had almost nothing left in common.

Tech stack: Rust, Cranelift (JIT compilation), LALRPOP (parser).

Original title: "A small programming language where everything is a value" (edited based on comments)

Comments

discarded1023•1h ago
At the risk of telling you what you already know and/or did not mean to say: not everything can be a value. If everything is a value then no computation (reduction) is possible. Why? Because computation stops at values. This is traditional programming language/lambda calculus nomenclature and dogma. See Plotkin's classic work on PCF (~ 1975) for instance; Winskel's semantics text (~ 1990) is more approachable.

Things of course become a lot more fun with concurrency.

Now if you want a language where all the data thingies are immutable values and effects are somewhat tamed but types aren't too fancy etc. try looking at Milner's classic Standard ML (late 1970s, effectively frozen in 1997). It has all you dream of and more.

In any case keep having fun and don't get too bogged in syntax.

jcparkyn•54m ago
Thanks, some interesting reading there that I will check out (I wasn't aware of PCF). Perhaps I should've used more precise wording: "All types are value types".

> Standard ML [...] It has all you dream of and more

The main thing here that's missing in Standard ML (and most other functional languages) is the "mutable" part of "mutable value semantics" - i.e., the ability to modify variables in-place (even nested parts of complex structures) without affecting copies. This is different from "shadowing" a binding with a different value, since it works in loops etc.

doug-moen•32m ago
I am unable to extract any meaning from your post. You appear to be making a general claim: it is impossible to design a programming language where everything is a value. You at least admit that "data thingies" can be values. Are you claiming that it is not possible for functions to be values? (If we assume that the argument and the result of a function call is a value, then this would mean higher order functions are impossible, for example.) If not that, then what? Please give a specific example of something that can never be a value in any programming language that I care to design.
ekipan•1h ago
(Edit: in the old post title:) "everything is a value" is not very informative. That's true of most languages nowadays. Maybe "exclusively call-by-value" or "without reference types."

I've only read the first couple paragraphs so far but the idea reminds me of a shareware language I tinkered with years ago in my youth, though I never wrote anything of substance: Euphoria (though nowadays it looks like there's an OpenEuphoria). It had only two fundamental types. (1) The atom: a possibly floating point number, and (2) the sequence: a list of zero or more atoms and sequences. Strings in particular are just sequences of codepoint atoms.

It had a notion of "type"s which were functions that returned a boolean 1 only if given a valid value for the type being defined. I presume it used byte packing and copy-on-write or whatever for its speed boasts.

https://openeuphoria.org/ - https://rapideuphoria.com/

p1necone•49m ago
> It had a notion of "type"s which were functions that returned a boolean 1 only if given a valid value for the type being defined.

I've got a hobby language that combines this with compile time code execution to get static typing - or I should say that's the plan, it's really just a tokenizer and half of a parser at the moment - I should get back to it.

The cool side effect of this is that properly validating dynamic values at runtime is just as ergonomic as casting - you just call the type function on the value at runtime.

jcparkyn•12m ago
Thanks, I updated the post title based on this and another comment. Thanks for the pointer to Euphoria too, looks like an interesting language with a lot of similar ideas.
rvba•1h ago
> In herd, everything is immutable unless declared with var

So basucally everything is var?

jcparkyn•49m ago
I'm not sure if I understand the question?

There are two ways to define a variable binding:

    x = 1; // declares x as immutable
    var y = 2; // declares y as mutable
The "default" behaviour (if no keyword is used) is to define a new immutable variable.
fjfaase•37m ago
I have implemented similar behavior in some of my projects. For one, I also have also implemented 'cursors' that point to some part of a value bound to a variable and allow you to change that part of the value of the variable. I have used this to implement program transformations on abstract parse (syntax) trees [1]. I also have implemented a dictionary based on a tree where only part of the tree is modified that needs to be modified [2]. I have also started working on a language that is based on this, but also attempts to add references with defined behavior [3].

[1] https://github.com/FransFaase/IParse/?tab=readme-ov-file#mar...

[2] https://www.iwriteiam.nl/D1801.html#7

[3] https://github.com/FransFaase/DataLang

drnick1•34m ago
Small programming language with everything passed by value? You reinvented C?
jcparkyn•25m ago
Not everything in C is pass-by-value. Sure, you can argue that a pointer itself is passed by value, but the data it points to is definitely not.
jbritton•3m ago
The article mentions shallow copy, but does this create a persistent immutable data structure? Does it modify all nodes up the tree to the root?

Over 36,500 killed in Iran's deadliest massacre, documents reveal

https://www.iranintl.com/en/202601255198
63•mhb•56m ago•15 comments

Clawdbot - open source personal AI assistant

https://github.com/clawdbot/clawdbot
49•KuzeyAbi•1h ago•24 comments

First, make me care

https://gwern.net/blog/2026/make-me-care
318•andsoitis•6h ago•105 comments

Scientists identify brain waves that define the limits of 'you'

https://www.sciencealert.com/scientists-identify-brain-waves-that-define-the-limits-of-you
20•mikhael•1h ago•0 comments

A macOS app that blurs your screen when you slouch

https://github.com/tldev/posturr
463•dnw•10h ago•160 comments

Show HN: A small programming language where everything is pass-by-value

https://github.com/Jcparkyn/herd
37•jcparkyn•2h ago•12 comments

Case study: Creative math – How AI fakes proofs

https://tomaszmachnik.pl/case-study-math-en.html
27•musculus•2h ago•14 comments

Guix for Development

https://dthompson.us/posts/guix-for-development.html
23•clircle•5d ago•1 comments

Doom has been ported to an earbud

https://doombuds.com
341•arin-s•13h ago•106 comments

Oneplus phone update introduces hardware anti-rollback

https://consumerrights.wiki/w/Oneplus_phone_update_introduces_hardware_anti-rollback
345•validatori•4h ago•155 comments

Spanish track was fractured before high-speed train disaster, report finds

https://www.bbc.com/news/articles/c1m77dmxlvlo
129•Rygian•6h ago•114 comments

Using PostgreSQL as a Dead Letter Queue for Event-Driven Systems

https://www.diljitpr.net/blog-post-postgresql-dlq
161•tanelpoder•9h ago•50 comments

The '3.5% rule': How a small minority can change the world (2019)

https://www.bbc.com/future/article/20190513-it-only-takes-35-of-people-to-change-the-world
172•choult•4h ago•129 comments

I was right about ATProto key management

https://notes.nora.codes/atproto-again/
111•todsacerdoti•6h ago•65 comments

Show HN: An interactive map of US lighthouses and navigational aids

https://www.lighthouses.app/
30•idd2•7h ago•8 comments

Show HN: FaceTime-style calls with an AI Companion (Live2D and long-term memory)

https://thebeni.ai/
7•summerlee9611•2h ago•0 comments

Bitwise conversion of doubles using only FP multiplication and addition (2020)

https://dougallj.wordpress.com/2020/05/10/bitwise-conversion-of-doubles-using-only-floating-point...
19•vitaut•10h ago•1 comments

Show HN: Elo ranking for landing pages

https://landingleaderboard.com/
10•Intragalactic•54m ago•1 comments

Turbopack: Building faster by building less

https://nextjs.org/blog/turbopack-incremental-computation
16•feross•5d ago•11 comments

Web-based image editor modeled after Deluxe Paint

https://github.com/steffest/DPaint-js
177•bananaboy•12h ago•15 comments

The behavioral cost of personalized pricing

https://digitalseams.com/blog/the-behavioral-cost-of-personalized-pricing
54•bobbiechen•6h ago•32 comments

Infinite pancakes, anyone?

https://www.nytimes.com/2026/01/20/science/infinite-pancake-math-puzzle.html
18•cainxinth•3d ago•4 comments

ICE using Palantir tool that feeds on Medicaid data

https://www.eff.org/deeplinks/2026/01/report-ice-using-palantir-tool-feeds-medicaid-data
866•JKCalhoun•7h ago•515 comments

Introduction to PostgreSQL Indexes

https://dlt.github.io/blog/posts/introduction-to-postgresql-indexes/
291•dlt•17h ago•14 comments

Show HN: Bonsplit – Tabs and splits for native macOS apps

https://bonsplit.alasdairmonk.com
206•sgottit•13h ago•26 comments

Hackable personal news reader in bash pipes

https://github.com/haron/news.sh
22•haron•5d ago•5 comments

Optimizing GPU Programs from Java Using Babylon and Hat

https://openjdk.org/projects/babylon/articles/hat-matmul/hat-matmul
26•pjmlp•5d ago•2 comments

Show HN: Netfence – Like Envoy for eBPF Filters

https://github.com/danthegoodman1/netfence
41•dangoodmanUT•10h ago•6 comments

Nango (YC W23, Dev Infrastructure) Is Hiring Remotely

https://jobs.ashbyhq.com/Nango
1•bastienbeurier•13h ago

A flawed paper in management science has been cited more than 6k times

https://statmodeling.stat.columbia.edu/2026/01/22/aking/
625•timr•16h ago•329 comments