- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Why are there not prefix types?
Sun, 2009-04-12, 03:11
What is the syntactic reason to not allow single parameter generics
without brackets? If there are infix types, why not prefix types?
This would help to reduce verbosity in very nested collections:
val matrix: Array[Array[Array[Int]]] = ....
would become:
val matrix: Array Array Array Int = ....
In the other hand, less verbose Option values would be defined:
type ?[T] = Option[T]
val str: ?String = Some("hello")
It is such feature planned for future releases?
Regards.
- Andrés
How would you deal with binding precedence if you did that?
-Arthur
On Apr 11, 2009, at 7:10 PM, Andrés Testi
wrote:
> What is the syntactic reason to not allow single parameter generics
> without brackets? If there are infix types, why not prefix types?
> This would help to reduce verbosity in very nested collections:
>
> val matrix: Array[Array[Array[Int]]] = ....
>
> would become:
>
> val matrix: Array Array Array Int = ....
>
> In the other hand, less verbose Option values would be defined:
>
> type ?[T] = Option[T]
>
> val str: ?String = Some("hello")
>
> It is such feature planned for future releases?
>
> Regards.
>
> - Andrés