Index: libcfa/src/vec/vec2.hfa
===================================================================
--- libcfa/src/vec/vec2.hfa	(revision 9ec35db6a499e60a80f6b8a9a1732b678c8fa11e)
+++ libcfa/src/vec/vec2.hfa	(revision 1dd929e5b6f43607cda0fc28bc6feab1dc9ec530)
@@ -3,14 +3,33 @@
 #include <iostream.hfa>
 
-trait vec2_t(otype T) {
+trait zeroassn(otype T) {
+    T ?=?(T&, zero_t);
+};
+trait fromint(otype T) {
     void ?{}(T&, int);
+};
+trait zero_assign(otype T) {
     T ?=?(T&, zero_t);
+};
+trait subtract(otype T) {
     T ?-?(T, T);
     T -?(T);
+};
+trait add(otype T) {
     T ?+?(T, T);
+};
+trait multiply(otype T) {
     T ?*?(T, T);
+};
+trait divide(otype T) {
     T ?/?(T, T);
+};
+trait lessthan(otype T) {
+    int ?<?(T, T);
+};
+trait equality(otype T) {
     int ?==?(T, T);
-    int ?<?(T, T);
+};
+trait sqrt(otype T) {
     T sqrt(T);
 };
@@ -31,5 +50,5 @@
 }
 
-forall(otype T | vec2_t(T)) {
+forall(otype T) {
     struct vec2 {
         T x, y;
@@ -37,6 +56,5 @@
 }
 
-/* static inline { */
-forall(otype T | vec2_t(T)) {
+forall(otype T) {
     static inline {
 
@@ -46,10 +64,14 @@
         v.[x, y] = [x, y];
     }
+
+    forall(| zero_assign(T))
     void ?{}(vec2(T)& vec, zero_t) with (vec) {
         x = y = 0;
     }
+
     void ?{}(vec2(T)& vec, T val) with (vec) {
         x = y = val;
     }
+
     void ?{}(vec2(T)& vec, vec2(T) other) with (vec) {
         [x,y] = other.[x,y];
@@ -60,4 +82,5 @@
         [x,y] = other.[x,y];
     }
+    forall(| zero_assign(T))
     void ?=?(vec2(T)& vec, zero_t) with (vec) {
         x = y = 0;
@@ -67,4 +90,6 @@
 
     // Subtraction
+
+    forall(| subtract(T)) {
     vec2(T) ?-?(vec2(T) u, vec2(T) v) { // TODO( can't make this const ref )
         return [u.x - v.x, u.y - v.y];
@@ -77,6 +102,8 @@
         return [-x, -y];
     }
+    }
 
     // Addition
+    forall(| add(T)) {
     vec2(T) ?+?(vec2(T) u, vec2(T) v) { // TODO( can't make this const ref )
         return [u.x + v.x, u.y + v.y];
@@ -86,6 +113,8 @@
         return u;
     }
+    }
 
     // Scalar Multiplication
+    forall(| multiply(T)) {
     vec2(T) ?*?(vec2(T) v, T scalar) with (v) { // TODO (can't make this const ref)
         return [x * scalar, y * scalar];
@@ -98,7 +127,8 @@
         return v;
     }
-
+    }
 
     // Scalar Division
+    forall(| divide(T)) {
     vec2(T) ?/?(vec2(T) v, T scalar) with (v) {
         return [x / scalar, y / scalar];
@@ -108,5 +138,8 @@
         return v;
     }
+    }
+
     // Relational Operators
+    forall(| equality(T)) {
     bool ?==?(vec2(T) u, vec2(T) v) with (u) {
         return x == v.x && y == v.y;
@@ -115,21 +148,27 @@
         return !(u == v);
     }
-
+    }
+
+    forall(| add(T) | multiply(T))
     T dot(vec2(T) u, vec2(T) v) {
         return u.x * v.x + u.y * v.y;
     }
 
+    forall(| sqrt(T) | add(T) | multiply(T))
     T length(vec2(T) v) {
        return sqrt(dot(v, v));
     }
 
+    forall(| add(T) | multiply(T))
     T length_squared(vec2(T) v) {
        return dot(v, v);
     }
 
+    forall(| subtract(T) | sqrt(T) | add(T) | multiply(T))
     T distance(vec2(T) v1, vec2(T) v2) {
         return length(v1 - v2);
     }
 
+    forall(| sqrt(T) | divide(T) | add(T) | multiply(T))
     vec2(T) normalize(vec2(T) v) {
         return v / sqrt(dot(v, v));
@@ -137,4 +176,5 @@
 
     // Project vector u onto vector v
+    forall(| sqrt(T) | divide(T) | add(T) | multiply(T))
     vec2(T) project(vec2(T) u, vec2(T) v) {
         vec2(T) v_norm = normalize(v);
@@ -143,4 +183,5 @@
 
     // Reflect incident vector v with respect to surface with normal n
+    forall(| sqrt(T) | divide(T) | add(T) | multiply(T) | subtract(T) | fromint(T))
     vec2(T) reflect(vec2(T) v, vec2(T) n) {
         return v - (T){2} * project(v, n);
@@ -151,4 +192,5 @@
     // entering material (i.e., from air to water, eta = 1/1.33)
     // v and n must already be normalized
+    forall(| sqrt(T) | add(T) | multiply(T) | subtract(T) | fromint(T) | lessthan(T) | zeroassn(T))
     vec2(T) refract(vec2(T) v, vec2(T) n, T eta) {
         T dotValue = dot(n, v);
@@ -166,7 +208,9 @@
     // i is the incident vector
     // ng is the geometric normal of the surface
+    forall(| add(T) | multiply(T) | lessthan(T) | fromint(T) | subtract(T))
     vec2(T) faceforward(vec2(T) n, vec2(T) i, vec2(T) ng) {
         return dot(ng, i) < (T){0} ? n : -n;
     }
+
     }
 }
