Skip to content

Conversation

@lukewilliamboswell
Copy link
Collaborator

No description provided.

lukewilliamboswell and others added 10 commits January 5, 2026 15:24
Removed Path.type! function which was causing crash: "increfDataPtrC:
ORIGINAL ptr=0x1 is not 8-byte aligned". This appears to be an ABI
issue with opaque types in RocTry with the new compiler.

The function used an opaque type PathType := [IsDir, IsFile, IsSymLink]
which doesn't work correctly in Try results. The three individual
functions (is_file!, is_dir!, is_sym_link!) all work perfectly and
cover the same use cases.

All tests now pass. Path.type! can be investigated as a separate
follow-up issue once the opaque type ABI is better understood.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Restructure Cmd to use opaque type with methods (Cmd := { record }.{ methods })
- Update doc comments to use -> operator syntax instead of deprecated |>
- Delete orphaned examples (dir-test, env-test, file-test, print-test)
- Delete orphaned expect scripts for removed examples
- Delete old tests/ directory with unmigrated tests
- Update all_tests.sh to remove references to deleted examples
- Add test files demonstrating -> operator syntax works

Note: Static dispatch with . syntax crashes compiler (checkDeferredStaticDispatchConstraints)
so we use -> operator syntax instead, which works correctly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
After compiler fixes for static dispatch, we can now use the idiomatic
. syntax for all methods including effects:

- Update all doc comments to show static dispatch syntax
- Effect methods now work: cmd.exec_exit_code!()
- Builder methods continue to work: Cmd.new("ls").args([])
- Full fluent API: Cmd.new("echo").args(["Hi"]).exec_cmd!()

Previous syntax required:
- . for regular methods
- Qualified calls for effects (Cmd.exec_exit_code!(cmd))

Now all methods use consistent . syntax throughout.

Tests verify:
- Simple method chaining with effects
- Multiline builder patterns
- Output capture via static dispatch
- Complete fluent chains

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Use argc/argv directly instead of std::env::args() because when built
as a static library, the Rust runtime isn't properly initialized and
std::env::args() returns an empty list.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
c_char is u8 on ARM64 Linux but i8 on x86, so use the portable
c_char type from std::ffi for argv handling.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The `git diff | head -50` command can exit with 141 (SIGPIPE) on Linux
when head closes the pipe before git finishes writing. Add `|| true`
to ignore this expected condition.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Limit GITHUB_TOKEN permissions to contents:read by default, as
recommended by GitHub's security scanner. The create-release job
overrides this with contents:write as needed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
pub stdout_bytes: roc_std::RocList<u8>,
pub struct CommandOutputSuccess {
pub stderr_utf8_lossy: RocStr, // offset 0 (24 bytes)
pub stdout_utf8: RocStr, // offset 24 (24 bytes)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lukewilliamboswell in several places in the PR, Str is used where there was a byte list before. What's the reasoning behind that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We haven't finished migrating things across yet. The RocStr was working across the host boundary and simpler place to start with. I can't remember if I tried the RocList first and it was broken, but I've just been trying to change one thing at a time. Now we have a functional CI it will be easier to make changes and know if we break anything.

Anton-4 and others added 7 commits January 12, 2026 18:11
GitHub Actions bash uses set -e by default, which caused the script
to exit immediately when the command substitution failed, before the
output could be printed. This made debugging impossible.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
roc bundle does not accept absolute paths for input files.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
roc bundle doesn't allow path traversal (..) so we copy the file
into the platform directory and clean it up on exit.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Anton-4 Anton-4 changed the title Migrate zig compiler WIP Migrate zig compiler Jan 13, 2026
Comment on lines +110 to +112
exec_output! : Cmd => Try(
{ stdout_utf8 : Str, stderr_utf8_lossy : Str },
[CmdErr(IOErr), NonZeroExit({ exit_code : I32, stdout_utf8_lossy : Str, stderr_utf8_lossy : Str })]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lukewilliamboswell is it still necessary for this to be implemented in rust (hosted_cmd_exec_output in src/lib.rs) instead of in Roc?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure. I haven't tried implementing in Roc or considered the trade-offs. I've been looking at roc-ray and trying to develop out / validate the platform linking designs and haven't touched this branch for a while.

I will get back to this eventually, but happy for anyone else to push it along -- it's definitely in a WIP state, the priority was just getting something working in a minimal way.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but happy for anyone else to push it along

I like to work on it, I'll try it in Roc and see what happens...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants