}
binary_write :: (use bw: ^BinaryWriter, $T: type_expr, v: ^T) {
- stream_write(stream, <[] u8>.{ ~~ v, sizeof T });
+ stream_write(stream, .{ ~~ v, sizeof T });
}
binary_write_slice :: (use bw: ^BinaryWriter, sl: [] $T, output_size := false) {
assert(false, "binary_write_slice is not working at the moment");
if output_size do binary_write(bw, i32, sl.count);
- bytes := <[] u8>.{
+ bytes := ([] u8).{
data = cast(^u8) ^sl.data[0],
count = sizeof T * sl.count,
};
sl := memory.make_slice(u8, size * sizeof T, allocator = allocator);
_, bytes_read := stream_read(stream, sl);
- return <[] T>.{ data = cast(^T) sl.data, count = size };
+ return .{ data = cast(^T) sl.data, count = size };
}
The implementation of `null_proc` is rather simple, but feels a
little verbose an targential compared to everything else being done
- in the compiler.
-
- :TypeValueInterchange
- Angle brackets are being used to specify types in value expressions
- and vice versa. This is just a temporary hack. The long term goal
- is that type expressions are automatically detected in value
- expressions.
\ No newline at end of file
+ in the compiler.
\ No newline at end of file
break;
}
- // :TypeValueInterchange
- case '<': {
- AstTypeAlias* alias = make_node(AstTypeAlias, Ast_Kind_Type_Alias);
- alias->token = expect_token(parser, '<');
- alias->to = parse_type(parser);
- expect_token(parser, '>');
-
- retval = (AstTyped *) alias;
- break;
- }
-
case '[': {
AstType *type = parse_type(parser);
retval = (AstTyped *) type;
foo := Foo.{};
println(foo->get_member2_plus_three());
- ps := <PolyStruct(i32)>.{ 1234 };
+ ps := PolyStruct(i32).{ 1234 };
println(ps.works(ps.member));
plus_one : (i32) -> i32 = PolyStruct.member_function;
}
make_vec :: (data: [$N] $T) -> Vec(T, N) {
- return <Vec(T, N)>.{ data };
+ return .{ data };
}
main :: (args: [] cstr) {
str_member : str = default;
}
- swd := <SimpleWithDefault(i32, "Hello World!")>.{ x = 1234 };
+ swd := SimpleWithDefault(i32, "Hello World!").{ x = 1234 };
println(swd.x);
println(swd.str_member);
poly_match(swd);
printf("PolyStruct<i32, f32>({}, {})\n", ps1.t_data, ps1.r_data);
- // Currently, this is how you have to do this.
- ps2 := <PolyStruct(f32, i32)>.{ 1234, 5678 };
+ ps2 := PolyStruct(f32, i32).{ 1234, 5678 };
printf("PolyStruct<f32, i32>({}, {})\n", ps2.t_data, ps2.r_data);
}
r_data : R = 5678;
}
- PolyStructTyped :: <PolyStruct(i32, f32)>;
+ PolyStructTyped :: PolyStruct(i32, f32);
ps := PolyStructTyped.{};
printf("PolyStruct<i32, f32>({}, {})\n", ps.t_data, ps.r_data);