Adds support for aliases for types ("typename aliases"). Aliases must currently be listed before macros before the expression representing the Weld program:
type int = i32;
type pair = {i32,i32};
# Define macros here.
|v: int, p: pair| v + p.$0 + p.$1
Typename aliases can be used within other typename aliases (as long as they are defined before):
type int = i32;
type pair = {int,int};
|v: int, p: pair| v + p.$0 + p.$1
Macros can also use typename aliases:
type int = i32;
macro addOne(a) = (
cudf[addOneUdf,int](a)
);
# Expands to |v: i64| cudf[addOneUdf,i64](v)
|v: int| addOne(v)
Currently, typename aliases are treated similarly to macros: when a program is compiled, type typenames are replaced with their true types, and the naming information is lost. This means that dumping code, logging messages, etc. will currently show the actual type rather than the typename. We hope to propagate type name information through the compiler soon.
Adds support for aliases for types ("typename aliases"). Aliases must currently be listed before macros before the expression representing the Weld program:
Typename aliases can be used within other typename aliases (as long as they are defined before):
Macros can also use typename aliases:
Currently, typename aliases are treated similarly to macros: when a program is compiled, type typenames are replaced with their true types, and the naming information is lost. This means that dumping code, logging messages, etc. will currently show the actual type rather than the typename. We hope to propagate type name information through the compiler soon.