Skip to content

Instantly share code, notes, and snippets.

@seldridge
Created September 21, 2018 03:39
Show Gist options
  • Save seldridge/6391cfb467f1c8ba713b843ab500172e to your computer and use it in GitHub Desktop.
Save seldridge/6391cfb467f1c8ba713b843ab500172e to your computer and use it in GitHub Desktop.
object X {
def f(x: Int): Int = 1
}
object Y {
def f(x: Int): String = "a"
}
import X._
import Y._
val x: Int = f(1)
val y: String = f(1)
@chick
Copy link

chick commented Sep 21, 2018

Ok, I understand this. The trade off is between doing
viewSomeKindOfOptions
vs
SomeKindOfOptionsObject.getView()
The verbiage is nearly equal while the upper one requires more complicated imports which may or may not trip up some programmers.
I don't know that there is a compelling way of settling this.
I'd also throw out that the view method could be more explicitly named as in getFirrtlOptions, it's not as though we are passing things around in way that some other method might take the view type as a parameter (I think).
My two cents

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment