Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
creata
on Oct 20, 2020
|
parent
|
context
|
favorite
| on:
Assorted Thoughts on Zig and Rust
Can you please provide an example of Zig "working out the dependency"? I'm struggling to make sense of your comment.
patrec
on Oct 20, 2020
[–]
I could write a concrete example that will work in zig and fail in common lisp, but maybe this link is enough?
https://ziglang.org/#Order-independent-top-level-declaration...
creata
on Oct 20, 2020
|
parent
[–]
Oh, so is the point that in Zig, functions with comptime parameters are more or less identical to regular functions in that regard?
dnautics
on Oct 20, 2020
|
root
|
parent
[–]
Exactly. You can
also
use non-comptime functions in comptime, if it avoids certain types of stateful behaviour.
dinglejungle
on Oct 20, 2020
|
root
|
parent
[–]
An example of this in the Zig math tests, where it tests calling the same function at both comptime and runtime:
https://github.com/ziglang/zig/blob/33c4ad7f3a79aad5d7ea481a...
patrec
on Oct 20, 2020
|
root
|
parent
[–]
In common-lisp you could do something equivalent, but you'd have to wrap the definitions you want to be able at both compile and and run time in eval-when.
Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: