on.target is chosen when compiling, and a branch it rules out is not compiled at all; on.machine asks the actual machine once, when running.
on_target.zg
# Code for one target (owner, 2026-10-06): `on.target` is chosen when compiling, and a branch it rules# out is not compiled at all; `on.machine` asks the actual machine once, when running.# The oracle's target is aarch64-macos.on.target.oswindows{fnwhere[]->str.utf8{return"windows";}}else{fnwhere[]->str.utf8{return"not windows";}}MAIN{on.targetaarch64-macos{std::print.useful["built for aarch64-macos",newln];}elseon.target.chipx86_64{let'n':int64=5;no_checkinline.ASM{negrax}with['n'->rax,'n'<-rax];# never compiled here: x86 assembly}else{std::print.useful["built for something else",newln];}on.target.chipaarch64{std::print.useful["an ARM chip, ",where[],newln];}on.machine.chipaarch64{std::print.useful["running on ARM",newln];}else{std::print.useful["running elsewhere",newln];}}
Output
built for aarch64-macos
an ARM chip, not windows
running on ARM