Closed FunFunFine closed 3 years ago
Thank you.
This PR adds this example to README, but I guess it would be more convenient if this library would provide some other object of type Nothing to use instead of ???
That's an interesting idea. We could use a placeholder marked compileTimeOnly
to ensure that it's being used in a nameOf
block. Anywhere else you would get a compile time error, which is an improvement over the the runtime error you'd get using ???
.
@compileTimeOnly("`?` placeholder must be used in a `nameOf` block")
def ? : Nothing = ???
println(nameOf[Person](_.sayHello(?)) // "sayHello"
println(nameOf(func(?, ?, ?))) // "func"
println(func(?, ?, ?)) // compile error
It is unclear that istead of writing full function one can use
???
to use underscore notation. For example,This PR adds this example to README, but I guess it would be more convenient if this library would provide some other object of type
Nothing
to use instead of???