views:

154

answers:

2

A complicated-sounding term with no good explanations from a simple google search... are there any more academically-oriented folk who could explain this one?

A: 

Okay, just going to hazard a COMPLETE guess here, based on this

http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=4276578

I'd say it's a mathematical representation of parametric polymorphism (generics).

Duncan
+1  A: 

Relational parametricity seems to be the property that a function abstracted over types (like a generic in Java) can have. If it has this property, it means it never inspects its type argument or deconstructs it / uses it in some special way. For example, the function "id or inc" here is not relationally parametric:

public class Hey<T>
{
    public T idOrInc(T var)
    {
        if (var instanceof Integer)
            return (T)(new Integer(((Integer)var).intValue()+1));
        return var;
    }
    public static void main(String[] args) {
        Hey<Integer> h = new Hey<Integer>();
        System.out.println(h.idOrInc(new Integer(10)));
        Hey<Double> h2 = new Hey<Double>();
        System.out.println(h2.idOrInc(new Double(10)));
    }
}

The output is:

$ java Hey
11
10.0
Claudiu