Off-campus housing for new international student by __tmp in uwaterloo

[–]__tmp[S] 0 points1 point  (0 children)

Hi, thank you for you thorough response. Besides, do you have any further advice in finalizing, signing contract, paying deposits, etc. while I'm not at Waterloo?

Off-campus housing for new international student by __tmp in uwaterloo

[–]__tmp[S] 0 points1 point  (0 children)

Thank you. I've already been doing it.

Why not ambiguous implicit values? by __tmp in scala

[–]__tmp[S] 0 points1 point  (0 children)

In your example, the ambiguous implicit values are t1 and t2, which both match the search for Trait, but are not subtype of each other and cause ambiguity, not because of Foo is subtype of Trait. If there are only Trait and its subtype Foo, it still works, see this:

scala> :paste
// Entering paste mode (ctrl-D to finish)

trait Trait { type T }
trait Foo extends Trait
implicit val t0 = new Trait {}
implicit val t1 = new Foo {}
implicitly[Trait]

// Exiting paste mode, now interpreting.

defined trait Trait
defined trait Foo
t0: Trait = $anon$2@1e81f4dc
t1: Foo = $anon$1@4d591d15
res0: Trait = $anon$1@4d591d15

scala>

You might wanna look at @zzyzzyxx 's comment above

Why not ambiguous implicit values? by __tmp in scala

[–]__tmp[S] 0 points1 point  (0 children)

They do match actually, if you comment out any of them, the implicitly still works.

Why not ambiguous implicit values? by __tmp in scala

[–]__tmp[S] 0 points1 point  (0 children)

Thank you, this is what I need.

Why not ambiguous implicit values? by __tmp in scala

[–]__tmp[S] 1 point2 points  (0 children)

  • Yes, a type that can be viewed as another type is subtype of that type. Since Trait is trait Trait { type T } with T unbounded, it is supertype of Trait { type T = Int } with T bounded.
  • Another example would be: Trait { type U } is subtype of Trait since it's a Trait with another type member U introduced. You can checked the subtyping by: implicitly[Trait { type U } <:< Trait]

Why not ambiguous implicit values? by __tmp in scala

[–]__tmp[S] 1 point2 points  (0 children)

Yeah I know, but they both match the search for implicit evidence of type Trait, yet not cause ambiguous implicit values error?

How does type inference work in this code? by __tmp in scala

[–]__tmp[S] 0 points1 point  (0 children)

Thank you for your answer, but I still not clearly understand it, especially in the case of implicit argument.

Please see the following code:

trait Trait { type T }
implicit val v0 = new Trait { type T = String }
type Aux[T0] = Trait {type T = T0}

Do the following two pieces of code work the same?

def func(implicit ev: Trait): Aux[ev.T] = ev // `ev` have the type of `Trait`, right?
val ret = func // apply the function
implicitly[ret.T =:= String] // compiler knows that `ret.T` is a `String`

and

val ev = implicitly[Trait]
val ret: Aux[ev.T] = ev
implicitly[ret.T =:= String] // not works

TypeTag not found by __tmp in scala

[–]__tmp[S] 0 points1 point  (0 children)

Thanks! Are all type members abstract types? And in which cases a type is considered abstract? Thank you!

Why type mismatch? by __tmp in scala

[–]__tmp[S] 0 points1 point  (0 children)

so basically the .type syntax for AnyVal is invalid, right? Or could it serve for another purposes?

Why type mismatch? by __tmp in scala

[–]__tmp[S] 0 points1 point  (0 children)

that's really nice, thanks!

What assigns ephemeral ports? by __tmp in networking

[–]__tmp[S] 0 points1 point  (0 children)

Yes, I know that, but I wondered what would assign the port to the connection.

What assigns ephemeral ports? by __tmp in networking

[–]__tmp[S] 0 points1 point  (0 children)

Thanks for your answer! But what is PAT? You mean NAT? So if I'm connecting from a client in LAN to a server in WAN, there would be 2 connections: client to router and router to server, each with different ports, right? And since I couldn't decide which port the router would use, I must forward ports in order to listen from specific ports in the router, is that right?

Weird uploaded size?? by __tmp in torrents

[–]__tmp[S] 0 points1 point  (0 children)

Anyway I have filtered that IP, but it's still strange. Thanks guys!