diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-02-20 02:18:36 +0200 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-02-20 02:18:36 +0200 |
| commit | 89a907ddd0b7f6b888c61d54e3e41a8cee00b971 (patch) | |
| tree | e18577c5a1153a4c167290feb486c08d1aef3539 /examples | |
| parent | b8eb76ef8efb2b000cb53d4d92d0c0df509cbdb8 (diff) | |
| download | ek-89a907ddd0b7f6b888c61d54e3e41a8cee00b971.tar.gz ek-89a907ddd0b7f6b888c61d54e3e41a8cee00b971.zip | |
expand type expansion
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/std.ek | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/examples/std.ek b/examples/std.ek index f9eb58c..dbf3a8c 100644 --- a/examples/std.ek +++ b/examples/std.ek @@ -92,6 +92,10 @@ pub typedef string { *i9 buf; } +pub define string(s) { + {.len = sizeof(s), .buf = s} as string; +} + /* result import */ pub typedef result[any T] { *i9 err; @@ -116,7 +120,7 @@ pub define fmt[] { str(*fmt p => string) { /* is this a loop? allowed? */ /* alternative would be {.len = 0, .buf = ""} as string I guess*/ - const r = p.fmt("".str()); + const r = p.fmt(string!("")); if r.err() { abort("error converting to string"); } |
