←back to thread

155 points samuell | 2 comments | | HN request time: 0.417s | source
Show context
self_awareness ◴[] No.44748522[source]
It's strange that they sometimes use [] to specify a type, other times they use (). That doesn't look very consistent to me.

I like the use of [] though, it reminds me of Scala, which I liked before they did the scala 3 fork.

replies(3): >>44748835 #>>44749351 #>>44750860 #
1. Arnavion ◴[] No.44748835[source]
`fn partition[T: ...]` uses `[]` to define T. `s: Slice(T)` uses `(T)` to invoke the type constructor `Slice` with the type argument T. So you could say that's fine because these are different operations.

But then defining a type constructor itself still uses `()`, like `class UnsafeAllowDelete(T:! Concrete) { ... }`. It does seem somewhat inconsistent.

replies(1): >>44749368 #
2. cjj_swe ◴[] No.44749368[source]
How is it inconsistent? The square brackets always mean "this was deduced" and the parens always indicate "this was passed in explicitly"