Questions tagged [reification]

Reification refers to process of taking an abstract concept and making a concrete representation out of it.

63 questions
371
votes
1 answer

Scala: What is a TypeTag and how do I use it?

All I know about TypeTags is that they somehow replaced Manifests. Information on the Internet is scarce and doesn't provide me with a good sense of the subject. So I'd be happy if someone shared a link to some useful materials on TypeTags including…
Sergey Weiss
  • 5,674
  • 7
  • 27
  • 40
167
votes
4 answers

What is reification?

I know that Java implements parametric polymorphism (Generics) with erasure. I understand what erasure is. I know that C# implements parametric polymorphism with reification. I know that can make you write public void dosomething(List input)…
Martijn
  • 11,183
  • 10
  • 46
  • 92
103
votes
13 answers

Why should I care that Java doesn't have reified generics?

This came up as a question I asked in an interview recently as something the candidate wished to see added to the Java language. It's commonly-identified as a pain that Java doesn't have reified generics but, when pushed, the candidate couldn't…
oxbow_lakes
  • 129,207
  • 53
  • 306
  • 443
83
votes
6 answers

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

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…
75
votes
4 answers

What are Reified Generics? How do they solve Type Erasure problems and why can't they be added without major changes?

I've read Neal Gafter's blog on the subject and am still unclear on a number of points. Why is it not possible to create implementations of the Collections API that preserve type information given the current state of Java, the JVM and existing…
sal
  • 22,528
  • 15
  • 64
  • 84
50
votes
4 answers

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

I have an interface that contains an array (or list) of T and some metadata. interface DataWithMetadata { val someMetadata: Int fun getData(): Array } If I write the simplest implementation of the interface, I get a compile error on…
Nate Vaughan
  • 2,537
  • 1
  • 22
  • 33
28
votes
4 answers

Simple example of reification in RDF

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…
Stefano Borini
  • 125,999
  • 87
  • 277
  • 404
25
votes
2 answers

How can I call Kotlin methods with reified generics from Java?

I have the following method in Kotlin: inline fun foo() { } If I try to call this from Java like this: myObject.foo(); OR like this: myObject.foo(); I get the following error: java: foo() has private access in…
Adam Arold
  • 26,256
  • 18
  • 92
  • 176
15
votes
6 answers

Versioned RDF store

Let me try rephrasing this: I am looking for a robust RDF store or library with the following features: Named graphs, or some other form of reification. Version tracking (probably at the named graph level). Privacy between groups of users, either…
Mat
  • 67,636
  • 33
  • 83
  • 106
11
votes
3 answers

Scala: Method overloading over generic types

In C# I can overload methods on generic type as shown in the example below: // http://ideone.com/QVooD using System; using System.Collections.Generic; public class Test { public static void Foo(List ints) { Console.WriteLine("I just…
Miguel Fernandez
  • 191
  • 1
  • 2
  • 5
11
votes
2 answers

Why does Function.identity() break type reification but t -> t does not?

Answers found at Java 8 lambdas, Function.identity() or t->t seem to imply that Function.identity() is almost always equivalent to t -> t. However, in the testcase seen below, replacing t -> t by Function.identity() results in a compiler error. Why…
Gili
  • 76,473
  • 85
  • 341
  • 624
11
votes
1 answer

What do C# generic methods on a non-generic class boil down to?

If I have a class like this: - static class Foo { public static void Bar(T item) { Console.WriteLine(item.ToString(); } } I know that in this example it's unnecessary to use T since all Types have ToString() on them etc. - it's simply a…
Isaac Abraham
  • 3,082
  • 1
  • 20
  • 25
10
votes
1 answer

For Scala are there any advantages to type erasure?

I've been hearing a lot about different JVM languages, still in vaporware mode, that propose to implement reification somehow. I have this nagging half-remembered (or wholly imagined, don't know which) thought that somewhere I read that Scala…
Nathan Hughes
  • 85,411
  • 19
  • 161
  • 250
10
votes
1 answer

Kotlin reified type parameter doesn't smart cast

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…
Jason Dunkelberger
  • 1,104
  • 12
  • 18
10
votes
4 answers

How does C# generics affect collections with primitives

As I understand it, C#/.Net generics support some degree of reification. So, if I have the following code: List list = new List(); list.Add(1); Will the value 1 be autoboxed or will the 'list' object handle primitive ints efficiently?
Michael Barker
  • 13,163
  • 4
  • 43
  • 51
1
2 3 4 5