scala - Structural subtyping reflection -
Can we use reflections from the outside of the Sculpted with a reflection of the following Cars can also produce socks for structural types: the connected equipment using Tulboksejh and runtime reflection, but it also applies to landscape macros. vals: string type of function < Code> F ?
val f = (r: {val s: string}) => {}
scale & gt; Import Scala. Reflection.artum {Universe = & gt; Ru} import scala.reflect.runtime {Universe = & gt; Ru} skeleton & gt; Import slaal.fact.rontime.incer._ import slailey.frack.timetime.News._scale & gt; Def type [T: Rs. Type] (x: t) = ru Type [T] // Capture- compiled time type information type off: [T] (X: T) (Untrue proof $ 1: Reflect. TIPTAGG [T]) Reflect. Rendime. Music. Type skeleton & gt; Val f = (r: {val s: string}) => {} F: AnyRef {val s: string} = & gt; Unit = & lt; Function 1 & gt; Scala & gt; Val tpe = typeOf (f) tpe: reflect.runtime.universe.Type = scala.AnyRef {val s: string} => Unit Scale & gt; RU.SHRO (TEP) res0: string = Typref (this type (scala), scala.function1, list (refined type (list type (Typref (this type (scala), nuittipam ("ANIRF"), list ()) Scope (Nutteram name ("S"), typewrift (this type (scala), scala unit, list ())) Scale & gt; Val ru.TypeRef (_, _, refinement :: _) = tpe : Reflect .rendime irregular.type = scala. Any rf {val s: string}
Comments
Post a Comment