Hacker News new | ask | show | jobs
by mrbluecoat 376 days ago
Great job! An impressive set of functionality for an initial release. The syntax is also quite intuitive in general but these were a bit odd to me:

(int,bool,bool) t = (1, true, false) // v: Define a tuple. Access elements using t[0], t[1], t[2]

string? s = null

2 comments

? Commonly used for nullable types.

The tup is an interesting question. I often think about tup(int, bool, string) vs (int, bool, string). I convince myself that there might be a better choice.

`var t = (1 as i8, true, false)` Use automatic inference to replace active type declarations.

t.0 vs t[0] is equally difficult to choose, but t[0] is the more commonly used syntax. Using t[n] consistently across map/vec/set/tup might be the more correct decision.

Can you explain what is odd about this? I think it seems perfectly logical.

The tuple type definition _looks_ like how the tuple will look. The nullable indicator is a symbol with a delightfully appropriate semantic meaning.