Scope Path Goodness
-
export
s andimport
s can now refer to paths, eg.import foo::bar
will look forfoo/bar.flx
.
Exporting a path will simply place the (public) contents of the file into a namespace with the same name. Bits of the newstd
library use this, for exampleclass map
is inmap.flx
, but it exportsstd
-- meaning the definition ofmap
will live instd::
.
Note that importing a string literal is still supported, but they no longer add the extension if missing -- you would need toimport "foo/bar.flx"
! -
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!
}
}
-
Implicit method calls (ie. calling a method without doing
self.method(...)
) work again -
Floating point values can now be compared with each other (oops)