This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Why are there not prefix types?

1 reply
Andrés Testi
Joined: 2009-01-22,
User offline. Last seen 42 years 45 weeks ago.

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

Arthur Chan
Joined: 2009-04-12,
User offline. Last seen 42 years 45 weeks ago.
Re: Why are there not prefix types?

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

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland