Skip to content

Commit

Permalink
breaking syntax change: ??x to x.? (#1095)
Browse files Browse the repository at this point in the history
See #1023

This also renames Nullable/Maybe to Optional
  • Loading branch information
andrewrk committed Jun 10, 2018
1 parent d464b25 commit ec1b6f6
Show file tree
Hide file tree
Showing 51 changed files with 489 additions and 482 deletions.
2 changes: 1 addition & 1 deletion build.zig
Expand Up @@ -75,7 +75,7 @@ pub fn build(b: *Builder) !void {
cxx_compiler,
"-print-file-name=libstdc++.a",
});
const libstdcxx_path = ??mem.split(libstdcxx_path_padded, "\r\n").next();
const libstdcxx_path = mem.split(libstdcxx_path_padded, "\r\n").next().?;
if (mem.eql(u8, libstdcxx_path, "libstdc++.a")) {
warn(
\\Unable to determine path to libstdc++.a
Expand Down
8 changes: 4 additions & 4 deletions doc/codegen.md
Expand Up @@ -6,7 +6,7 @@ Every type has a "handle". If a type is a simple primitive type such as i32 or
f64, the handle is "by value", meaning that we pass around the value itself when
we refer to a value of that type.

If a type is a container, error union, maybe type, slice, or array, then its
If a type is a container, error union, optional type, slice, or array, then its
handle is a pointer, and everywhere we refer to a value of this type we refer to
a pointer.

Expand All @@ -19,7 +19,7 @@ Error union types are represented as:
payload: T,
}

Maybe types are represented as:
Optional types are represented as:

struct {
payload: T,
Expand All @@ -28,6 +28,6 @@ Maybe types are represented as:

## Data Optimizations

Maybe pointer types are special: the 0x0 pointer value is used to represent a
null pointer. Thus, instead of the struct above, maybe pointer types are
Optional pointer types are special: the 0x0 pointer value is used to represent a
null pointer. Thus, instead of the struct above, optional pointer types are
represented as a `usize` in codegen and the handle is by value.

0 comments on commit ec1b6f6

Please sign in to comment.