Skip to content

Scope Path Goodness

Compare
Choose a tag to compare
@zhiayang zhiayang released this 04 Oct 17:18
· 1630 commits to 1b6e5a822d83e0f73986675c311a37dc74ec7389 since this release
  1. exports and imports can now refer to paths, eg. import foo::bar will look for foo/bar.flx.
    Exporting a path will simply place the (public) contents of the file into a namespace with the same name. Bits of the new std library use this, for example class map is in map.flx, but it exports std -- meaning the definition of map will live in std::.
    Note that importing a string literal is still supported, but they no longer add the extension if missing -- you would need to import "foo/bar.flx"!

  2. Identifier paths (eg foo::bar) can now start with :: to refer to the root scope, and include ^ to refer to the parent scope. For example:

fn main()
{
    let foo = 10
    do {
        let foo = 20
        libc::printf("^::foo = %d!\n", ^::foo) // prints 10!
    }
}
  1. Implicit method calls (ie. calling a method without doing self.method(...)) work again

  2. Floating point values can now be compared with each other (oops)