This now type checks. It's starting to feel real... union IntOrPtr { i: int; p: int*; } var u1 = IntOrPtr{i = 42} var u2 = IntOrPtr{p = cast(int*, 42)} var a: int[256] = {1, 2, ['a'] = 3}
-
-
Replying to @pervognsen
Awesome except for those “var” keywords. Why not eliminate that and use a=1 or a:int=1 for new declarations and a:=1 for writes to existing symbols? Or better yet require explicit mutability through a TVar/IOVar style abstraction?
3 replies 0 retweets 3 likes -
-
Replying to @pervognsen @TimSweeneyEpic
I like having keywords signposting each declaration at the top level, and the local shorthand is available inside function bodies.
1 reply 0 retweets 1 like -
Replying to @pervognsen
Here, let me redesign that syntax for you :-) IntOrPtr=union{ i: int; p: ^int; } u1=IntOrPtr{i = 42} u2=IntOrPtr{p = cast(^int, 42)} a:[256]int={1, 2, ['a'] = 3}
1 reply 0 retweets 1 like -
This Tweet is unavailable.
If the whole language (types and values) have a uniform syntax, then it’s impossible to parse x*, *x, and x*y unambiguously. Thus it’s necessary to use a symbol for pointers that’s not also a binary operator.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.