- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Promoting Dependent Method Types out of experimental status?
Thu, 2009-10-08, 20:51
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
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: