返回资讯中心
外部精选
软件工程
#开发者实时流

Red 语言登陆 Apple Silicon,Red Delicious 移植版支持原生编译

来源标题:Red Delicious – An Apple Silicon Port of the Red Language

独立移植项目 Red Delicious 让 Red 语言程序可在 Apple Silicon 上原生编译运行。该移植新增 AArch64 代码生成器和 Darwin-ARM64 的 64 位运行时,编译器改跑在 Rebol 3 上,因为 Rebol 2 没有 64 位 macOS 版本。项目基于官方 red/red 仓库提交 e5af90a3(2026-09-25),与 Red 团队无关联,按现状提供且无支持或发布计划。

Hacker News 最新jhderaigniac2026/12/6 · 今天25 分钟阅读

以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。

With Red Delicious, you can compile Red programs that run natively on Apple Silicon. You can start by running an example in HowTo, try a function in Reference, and then build a program of your own with the same toolchain.

Red first shipped in 2011 and produced only 32-bit programs for fifteen years. Current macOS runs 64-bit programs, so this port adds an AArch64 code generator and a 64-bit runtime for the Darwin-ARM64 target. Draw and View use AppKit for graphics and windows. The compiler now runs on Rebol 3 because Rebol 2 has no 64-bit macOS version. Rebol 3

The port starts from the official red/red commit e5af90a3 (2026-09-25). You can use the official project to learn about the language and find its documentation and community. The preserved upstream README describes the Rebol 2 toolchain. For this port, follow the Rebol 3 setup below. Official repository · Red website · Upstream README

Red Delicious is an independent port without affiliation with the Red team. It's shared as is, without warranties, support, or a release schedule. AI agents assisted with the port.

Requirements

Get the sources

Get a Rebol 3 host

A first bite of Red

Building the desktop apps

Comparing Red with other languages

Compiling your own program

Generating the API reference

Findings shared with upstream

Scope

Standalone Red toolchain

Licenses

Requirements

You'll need a Mac with Apple Silicon and the Command Line Tools to build Red programs. You can install the tools with xcode-select --install.

You'll build the apps and run the examples from the checkout. Clone the macos-arm64 branch and enter its directory.

git clone -b macos-arm64 https://github.com/JeanHuguesdeRaigniac/red-delicious.git cd red-delicious

Run the remaining commands from this directory.

Before you can compile Red, you need a Rebol 3 executable to run the compiler. You can download the official 3.22.1 release with the first script, which checks the release's SHA-256 checksums.

scripts/setup.sh --install

Use Rebol 3.22.1 for the commands in this README. Build the matrix development host only if you need to encapsulate a large program with red.r -e. Rebol 3.22.1 can crash in that mode beyond about 16,000 top-level values. The script builds the host in about 30 seconds from the pinned revision. Its fixes are expected in the next Rebol 3 release. Pinned Rebol 3 revision

utils/build-rebol3-host.sh --install

The first script stores the release in .local/host. The second one builds and stores its host in ~/Library/Caches/red-rebol3-host, or in the directory given with --work DIR; it doesn't need the 3.22.1 release. With --install, the script sets the rebol link at the root of your checkout and keeps any existing rebol file as rebol.previous. Run either script with --help to see its options.

Open HowTo to read a chapter and work through its examples in the same window. You can edit an example, run it again, and see how the result changes. Browse the HowTo sources

"$(./scripts/setup.sh)" scripts/build-apps.red howto --run

When you encounter a function you want to understand, open Reference. You can look up the function and try it alongside its documentation. Browse the Reference sources

"$(./scripts/setup.sh)" scripts/build-apps.red reference --run

Try append [1 2 3] 4 in Reference. You'll get [1 2 3 4].

Both apps use VID, Red's GUI dialect, to describe their windows. The next section gives the build commands and bundle locations.

Run the command for each app you want to build. The first call to setup.sh downloads and verifies Rebol 3.22.1 if needed and builds a small Red interpreter. Later calls reuse the interpreter while its inputs are unchanged.

"$(./scripts/setup.sh)" scripts/build-apps.red howto "$(./scripts/setup.sh)" scripts/build-apps.red reference "$(./scripts/setup.sh)" scripts/build-todo.red app

Open the bundles in Finder or pass their paths to open from the checkout.

In a clean export on an M2, downloading and verifying the host took about 1 second and building the interpreter took 63 seconds. Both are shared by the three apps. With setup complete, we measured the following times.

The first windows appeared within about one second of starting the built executables. Including initial setup and the first opening gives about 4 min 09 s for HowTo, 3 min 15 s for Reference, or 3 min 09 s for Todo when built first. Reopen the bundle from Finder. Each run of a build command recompiles the app.

The scripts sign each bundle ad hoc on your Mac. Each bundle uses a Material Symbols icon under the Apache License 2.0. App icons and license

Once you've tried a few Red expressions, compare how different languages solve the same problem. Each of the six examples has a Python version, and some also have a JavaScript or Racket version. Start with a task you know, such as parsing a log line, and compare how each program represents the data and operates on it.

To compare the Red results with the expected output, run all six examples. Each example has an expected.txt file.

"$(./scripts/setup.sh)" scripts/run-examples.red

The setup script builds a small Red interpreter once and prints its path. It uses the rebol host from your checkout when available. Otherwise, it downloads the 3.22.1 release into .local/.

To focus on one example, use scripts/run-example.red dates with the same interpreter. To run the Python, JavaScript, or Racket versions, use scripts/run-comparisons.red and install the interpreters those versions need.

To compare complete desktop apps, try Todo. The two versions implement the same app. The Red version describes its interface in VID and stores tasks in SQLite. The Electron version uses JavaScript. The example's README shows how to run the Electron version and compare the implementations. Todo example

Build and open the Red version with these commands.

"$(./scripts/setup.sh)" scripts/build-todo.red app ./.local/todo/Todo.app/Contents/MacOS/Todo

Todo stores tasks in a local database through the macOS SQLite library (3.54.0 on the test Mac). The companion uses Electron 45.6.1 and its built-in SQLite 3.54.1.

When you're ready to turn a Red source file into a standalone executable, compile it from the root of your checkout with -r.

./rebol red.r -r path/to/program.red

On Apple Silicon, the compiler selects Darwin-ARM64 by default. To target 32-bit macOS, pass -t Darwin. During development, you can use -c to link your program against libRedRT. A standalone build compiles the runtime even for a one-line program. With -c, the first build creates libRedRT. Keep using the same output directory so later builds can reuse it.

Testing covered only 64-bit macOS. No verification on 32-bit macOS was possible.

Compiled code evaluates all the arguments of a call before the function checks their types. The interpreter checks each argument as soon as it evaluates it. A valid program gives the same result either way. For a call that is already in error, the error reported and the side effects of the later arguments can differ: append 1 probe "x" prints "x" when compiled, but not in the console. Upstream Red behaves the same way.

To consult this port's API reference, generate it locally. It covers the functions in system/words and Red's datatypes and typesets. First, use your Rebol 3 host to build a batch console with help and the JSON and CSV codecs.

./rebol red.r -r --no-view -t Darwin-ARM64 -o /tmp/docgen-console docgen/console.red

Then use the compiled console to generate the reference. A versioned directory lets you keep references from different versions side by side. Choose a directory that doesn't already exist.

/tmp/docgen-console docgen/run.red docs/api-0.6.6

Omit the output argument to use docs/api. Open index.html in the generated directory to browse the reference. The function pages include examples, console output, and a button for copying code. Docgen labels examples it leaves for you to try yourself, such as opening a browser or reading your clipboard. The directory also contains Markdown pages and JSON indexes.

While bringing Red to Apple Silicon, the port uncovered behavior that also occurs in the official project. For most of those findings, the port includes a change that was written and tested. You can read the findings and follow the corresponding upstream issues where available. Findings shared with upstream

The versions and timings in this README are current as of December 4, 2026. The build measurements used an Apple M2 Mac running macOS 27.2.1 (26B131), Xcode 27.2, the macOS 27.2 SDK, Apple clang 21.0.0 (clang-2100.4.1.1), and Rebol 3.22.1.

When you debug a Red/System program on Apple Silicon with -d, runtime diagnostics can show the source file and line. The native stack trace shows function names and omits argument values on AArch64.

The commands in this README use Rebol 3 to run red.r from your checkout. To distribute the compiler and console as a single executable, the legacy packaging script uses enpro from the Rebol 2 SDK. It packages the Rebol interpreter and the Red toolchain sources into build/bin/red, which users can run without a separate Rebol interpreter or Red checkout. That packaging path still needs validation on Apple Silicon. Legacy build script

Red uses the BSD 3-Clause license, and its runtime uses the Boost Software License 1.0. The port's additions use the same licenses. BSD 3-Clause · Boost Software License 1.0

The normalization and grapheme cluster tables of the runtime come from the Unicode Character Database 18.0.0, and the locale data from CLDR 49, both under the Unicode License V3. UCD license · CLDR license

The SQLite module's C declarations come from a subset of David "Oldes" Oliva's binding, which uses the BSD 3-Clause license. SQLite binding

The Electron Todo example downloads npm dependencies under their own licenses. Rebol 3 is distributed separately under Apache 2.0.

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →