Re:Show HN: Whack – A simply-designed compiled programming l...
by wycliffb on Sunday October 28, 2018 @10:39AM
(#18320764)
Will commence working on a doc to explain some design choices, and what some non-obvious code fragments do; will update here when I commit.
There's no subtyping being done currently.
The 'match type' construct matches the type of an expression at compile time.
I should also add that some design choices may be reviewed before the first release.
[ Parent
| on HN ]
Re:Show HN: Whack – A simply-designed compiled programming l...
by dan-robertson on Sunday October 28, 2018 @07:37PM
(#18323906)
Surely if match type is compile time and there is no subtyping then it is basically a no-op type assert. I.e. it’s like writing (e : t) in ML?
Or is it supposed to allow for some kind of ad-hoc polymorphism like:
func foo(x) string {
match type(x) {
char** : return “an array of strings”
int : return “a number”
default : return “not sure”
}
}
And this gets transformed into something like: func foo(Type x_t, x_t x) string {
match(x_t) {
pointer_t(pointer_t(char_t)) : return ...
...
}
}