reification

Any word on reified generics in Java?

╄→尐↘猪︶ㄣ 提交于 2020-01-31 08:42:31
问题 I know this question will probably provoke more discussion than concrete answers (which I know isn't preferable). But with the recent acquisition by Oracle, I was wondering if there's been any word that Java might (someday) get reified generics? I've heard that Oracle wants to give Java a bit of a boost, and I can think of no better way. 回答1: There's a good article on the discussion of reified generics, here, that you should read in regards to Java. Basically it outlines some of the pitfalls

Any word on reified generics in Java?

流过昼夜 提交于 2020-01-31 08:41:47
问题 I know this question will probably provoke more discussion than concrete answers (which I know isn't preferable). But with the recent acquisition by Oracle, I was wondering if there's been any word that Java might (someday) get reified generics? I've heard that Oracle wants to give Java a bit of a boost, and I can think of no better way. 回答1: There's a good article on the discussion of reified generics, here, that you should read in regards to Java. Basically it outlines some of the pitfalls

Can OWL punning help in defining data properties on object property?

两盒软妹~` 提交于 2020-01-24 15:34:07
问题 Punning (which was introduced in OWL 2 DL) allows one to give the same name (IRI) to a Class and an Object Property (see Association Example). Can I use this way of meta-modelling to attach attributes on a relation? For instance, the relation drives connects Person and Vehicle . I want to specify the velocity with which the Vehicle is driven, and this property belongs on drives . Punning allows me to model drives as an association class by specifying both a class and an object property named

Kotlin reified type parameter doesn't smart cast

穿精又带淫゛_ 提交于 2020-01-03 08:32:18
问题 I was experimenting with setting uninitialized values and was trying to get the following to work. This is mostly a curiosity in the power (and limitations) of reified generics. I was attempting to provide default values for optional parameters of data classes. inline fun <reified T> uninitialized(): T = when (T::class) { Long::class -> -1L // Type mismatch. Required: T Found: Long String::class -> "" // Type mismatch. Required: T Found: String // and so on... else -> throw

Casting to a Class which is determined at run-time

╄→尐↘猪︶ㄣ 提交于 2020-01-01 10:49:49
问题 I have a method fetchObjects(String) that is expected to return an array of Contract business objects. The className parameter tells me what kind of business objects I should return (of course this doesn't make sense in this construed case because I already said I will return Contract s, but it's basically the situation I have in my real scenario). So I get the set of entries from somewhere and load the class of the collection's entries (the type of which is specified by className ). Now I

What do “reify” and “reification” mean in the context of (functional?) programming?

这一生的挚爱 提交于 2019-12-31 08:33:27
问题 I read this term a lot in blogs about haskell and functional programming (specially in sigfpe's blog) but I don't have a clue about what it means. I get away with not knowing it most of the times, but I probably would have understood the texts a lot better if I knew. Google didn't help me. I get lost in the technical stuff. Also the non-technical meaning of the world ("turning the abstract concrete") doesn't help me understand what it practically means to reify something in code. I'm kinda

What do “reify” and “reification” mean in the context of (functional?) programming?

a 夏天 提交于 2019-12-31 08:32:50
问题 I read this term a lot in blogs about haskell and functional programming (specially in sigfpe's blog) but I don't have a clue about what it means. I get away with not knowing it most of the times, but I probably would have understood the texts a lot better if I knew. Google didn't help me. I get lost in the technical stuff. Also the non-technical meaning of the world ("turning the abstract concrete") doesn't help me understand what it practically means to reify something in code. I'm kinda

How to implement that generic function with TypeTag in Scala?

南笙酒味 提交于 2019-12-24 10:38:52
问题 Suppose I need to write a function convert[T]: String => Option[T] , which works as follows: import scala.util.Try def toInt(s: String): Option[Int] = Try(s.toInt).toOption def toDouble(s: String): Option[Double] = Try(s.toDouble).toOption def toBoolean(s: String): Option[Boolean] = Try(s.toBoolean).toOption // if T is either Int, Double, or Boolean return // toInt(s), toDouble(s), toBoolean(s) respectively def convert[T](s: String): Option[T] = ??? Should I use TypeTag to implement it ? 回答1:

Kotlin generics Array<T> results in “Cannot use T as a reified type parameter. Use a class instead” but List<T> does not

ぃ、小莉子 提交于 2019-12-21 06:47:04
问题 I have an interface that contains an array (or list) of T and some metadata. interface DataWithMetadata<T> { val someMetadata: Int fun getData(): Array<T> } If I write the simplest implementation of the interface, I get a compile error on the emptyArray() : "Cannot use T as a reified type parameter. Use a class instead." class ArrayWithMetadata<T>(override val someMetadata: Int): DataWithMetadata<T> { private var myData: Array<T> = emptyArray() override fun getData(): Array<T> { return myData

Simple example of reification in RDF

↘锁芯ラ 提交于 2019-12-17 17:44:40
问题 Could anybody be so kind to give me a simple example of reification in RDF? I want to see if I understood it correctly. For example, I propose the following case Tolkien -> wrote -> Lord of the rings /|\ | Wikipedia said that How would you write it with and without reification (i.e. as a simple RDF statement with no need for reification)? 回答1: "Tolkien wrote Lord of the Rings" can be expressed as a simple statement (subject, predicate, object) like this: :Tolkien :wrote :LordOfTheRings . By