zetzit / zz

πŸΊπŸ™ ZetZ a zymbolic verifier and tranzpiler to bare metal C
MIT License
1.6k stars 52 forks source link

Reference to module root #89

Closed jwerle closed 4 years ago

jwerle commented 4 years ago

It would be pretty convenient to support an identifier or keyword that references the root of the module much like certain usage of Rust's crate keyword.

@aep what are your thoughts?

aep commented 4 years ago

Yes!

aep commented 4 years ago

Actually an absolute path might work already.

using ::string;
jwerle commented 4 years ago

hmm, it doesn't seem to work if I want to do something like:

// a.zz

export fn foo() -> int {
  return 123;
}

// b.zz

export fn bar() -> int {
  return ::a::foo();
}
// lib.zz
export using a::{ foo }
export using b::{ bar }
aep commented 4 years ago

oh in b.zz you can just do "using a"

and the lib can be accessed by its module name.