Show HN:すべてが値渡しの小さなプログラミング言語
## Japanese Translation:
Herd は軽量の趣味向けプログラミング言語で、値を明示的に可変(`var`)と宣言しない限りすべて不可変として扱います。書き込み時には参照カウントを使って値がコピーされるため、隠れた副作用や参照循環はありません。この設計により GC は参照カウントのみで動作でき、ロックなしで予測可能な並行コードを書くことができます。変更は `set` 関数を介してのみ発生します。
構文は意図的に最小限です:匿名関数(`\a b …`)は可変長引数(`..rest`)をサポートし、パターンマッチングではリスト/辞書の分解に `!` を使用し、`switch … on {}` 構文を備えています。パイプ演算子 `|` は呼び出しを連鎖させ、`|=` は変数を直接変更します。モジュールはテーブル(`return {…}`)を返してエクスポートされ、`import 'file'` でインポートします。
Herd はシステムコール、IO、コレクション(List, Dict)、数学、ビット演算、乱数生成、文字列操作、ファイル操作の標準ライブラリを備えており、さらに `Parallel.parallelMap` と `parallelRun` を通じた並行実行も可能です。動的型付けでユーザー定義型はなく、言語をシンプルに保っています。
内部では Cranelift に基づく単一パス Just‑In‑Time コンパイラとプリミティブ用の NaN‑boxing を使用しています。ベンチマークでは CPython や Node.js と競合する速度(例:binarytrees は JS より高速、mandelbrot は遅い)が示されており、同時に明確でレースフリーな並行性を提供します。
## Text to translate
(incorporating missing elements):**
Herd is a lightweight hobby‑programming language that treats every value as immutable unless you explicitly declare it mutable (`var`). Values are copied on write using reference counting, so there are no hidden side‑effects or reference cycles—this lets the GC rely solely on ref‑counting and makes concurrent code predictable without locks. Mutation occurs only via the `set` function.
The syntax is deliberately minimal: anonymous functions (`\a b …`) support variadic arguments (`..rest`); pattern matching uses `!` for destructuring lists/dicts and a `switch … on {}` construct; the pipe operator `|` chains calls, with `|=` mutating variables in place. Modules export by returning a table (`return {…}`) and are imported with `import 'file'`.
Herd ships with standard libraries for system calls, IO, collections (List, Dict), math, bitwise ops, randomness, strings, files, and parallel execution via `Parallel.parallelMap` and `parallelRun`. It is dynamically typed with no user‑defined types, keeping the language simple.
Internally it uses a single‑pass Just‑In‑Time compiler built on Cranelift and NaN‑boxing for primitives. Benchmarks show speeds competitive with CPython and Node.js (e.g., binarytrees faster than JS; mandelbrot slower), while still offering clear, race‑free parallelism.