-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 01/12/2015 10:47 AM, Toby wrote:
> Thus the fact that the [_] ignores any upper bound defined in the
> type definition is stated, though in my view this is still
> illogical because it requires duplication of Upper Bound
> information wherever the class is used, even if no new information
> is added.
This is in fact extremely annoying when working with F-bounded types
as you'll have to restate the bound each and everywhere.
It would be great if one could use a type member instead, but I have
never managed to get this to work as seamlessly as the type
constructor parameter.
https://stackoverflow.com/questions/23481991/attempting-to-model-f-bounded-polymorphism-as-a-type-member-in-scala?rq=1
trait Sys { me =>
import me.{S => S1}
type S <: Sys { type S = S1 } // ???
type Tx <: Txn[S]
type Vr[A] <: Var[S#Tx, A]
}
trait Txn[S <: Sys] {
def newVar[A]: S#Vr[A]
}
trait Var[Tx, A] {
def apply()(implicit tx: Tx): A
def update(value: A)(implicit tx: Tx): Unit
}
trait Foo[S <: Sys] {
def test(implicit tx: S#Tx): Unit = {
val v = tx.newVar[Int]
v() = 33 // FAIL
assert(v() == 33) // FAIL
}
}
best, .h.h.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAEBAgAGBQJUs5sWAAoJEKZFmaPaYk6QYsQP/2gt4BJprsd5CRbHK6b0HltY
67yuCL/HWs7oGv5exsIB5Pkd/0Bi8piF3WlwKHQtO0MvRkZoU2fvlKCAdam/CSUK
VTznIXoVrJpSu1QoGpJQo6PCeTVK8sI0CLFceHRnuUc+SsEX7ZskpyJkKyvFU4Me
bYSUky1bJ8GlTaALDqcO80fBoVNimDXo8+9tmhaSde3srQPBZ34Gmb71Nvl1yVjb
fAnp8V4X4iaU2ngn6wGTwULOBQ3hKqHjkA4a6y+qINxwiEAXmi3A9w6jj2CO8Pdy
xIldahKPbdX1Zx+BNwF9kJ+jV9Yj4DhKpOwywUvh25jQRaIWj4twoSyKefWcMg2g
JJ2mFMoK/Tjh2UZ0/U/izlVa2geoy0crTx1nWvd9KEZioW60XOGnQhggnvCR7w06
s/uwcEDtSfTM0wGPXxJ/V6xJQLrq3Eeo8vnSeE9iZtiRmP7KoEPKp+VokiftZD0R
jByNiwKg/SYgmOYGVV4qDAdvaArDD/ZV0i4Jr8+buaf4NHlkYvQtq5k4sgkTkIb7
HAPnOtw24r3zB27Qa3uKQYhKbSEa811l6Z0YQLvtGla4Gx1dCoC+6F7GmicjF2ZL
Mbdx8SGhMLU88aSsuIPt4xFL/csq59r11IYimHAQGD0R5VcdsOGWMCB8y/JZWtQ8
OJgh3VfOccIrH7GvHTKr
=KV/C
-----END PGP SIGNATURE-----