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

Promoting Dependent Method Types out of experimental status?

1 reply
Ben Hutchison
Joined: 2009-01-21,
User offline. Last seen 42 years 45 weeks ago.

This morning I stumbled on the need to enable the Dependent Method
Types feature of Scala (activated via compiler flag -Yexperimental)
while trying to define a path-dependent method return type.

In the process of Googling my issue, I gathered from
[http://lampsvn.epfl.ch/trac/scala/ticket/128] that this feature is
approximately 2 years old. I also have seen a (published?) paper on
polymoprhic DSLs that requires this flag be activated to compiler its
code samples.

I wonder if the feature is sufficiently mature that it can be promoted
out of experimental status?

The cost of keeping it in experimental, if it is fairly stable, is
that users have to enable a whole lot of other experimental stuff (and
they probably wont know actually know what they are), just to use the
path dependent types.

To illustrate that cost concretely, since enabling -Yexperimental, my
previously compiling project is now showing baffling errors around
packages/imports not found, although the method signature with the
dependent type is now accepted. (based on 2.8 nightly)

-Ben

Jorge Ortiz
Joined: 2008-12-16,
User offline. Last seen 29 weeks 4 days ago.
Re: Promoting Dependent Method Types out of experimental statu
Huh, I had no idea -Xexperimental could do that. That's cool.

It's still buggy. I can get it to crash the interpreter (but not, so far, the compiler).

Even if full dependent method types don't work, it'd be nice to have a kind of "type widening" in these situations. For example:

  class A {
    type B = Int
    val b: B = 10
  }

  def foo(a: A) = a.b
  error: illegal dependent method type
         def foo(a: A) = a.b

It would be nice if the type inferencer automatically inferred "Int" as a valid, wider, non-parameter dependent, type.

  def foo(a: A): Int = a.b
  foo: (A)Int

--j

On Thu, Oct 8, 2009 at 12:50 PM, Ben Hutchison <ben [at] playscapegames [dot] com> wrote:
This morning I stumbled on the need to enable the Dependent Method
Types feature of Scala (activated via compiler flag  -Yexperimental)
while trying to define a path-dependent method return type.

In the process of Googling my issue, I gathered from
[http://lampsvn.epfl.ch/trac/scala/ticket/128] that this feature is
approximately 2 years old. I also have seen a (published?) paper on
polymoprhic DSLs that requires this flag be activated to compiler its
code samples.

I wonder if the feature is sufficiently mature that it can be promoted
out of experimental status?

The cost of keeping it in experimental, if it is fairly stable, is
that users have to enable a whole lot of other experimental stuff (and
they probably wont know actually know what they are), just to use the
path dependent types.

To illustrate that cost concretely, since enabling -Yexperimental, my
previously compiling project is now showing baffling errors around
packages/imports not found, although the method signature with the
dependent type is now accepted. (based on 2.8 nightly)

-Ben

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