News for hackers. Stuff that matters.
Re:Clay: A new language for generic programming (based on LLVM) by Raphael_Amiard on Monday July 26, 2010 @09:11AM (#1547897)
Looks like a very interresting language to me. I think it superficially looks a lot like rpython, with way more options to restrict and specify types on top of it. I'm very eager to see more documentation, specifically on types and memory management.

What is the syntax for pointers for example ?

Re:Clay: A new language for generic programming (based on LLVM) by kssreeram on Monday July 26, 2010 @09:28AM (#1547947)
Hi. Pointers to type T have the type Pointer[T]. '&' operator is for getting the address of a lvalue, and the '^' operator is for dereferencing. '^' is a better choice than C's '*' for dereferencing because, I can conveniently use the same operator for dereferenced field-access too, whereas C had to invent another operator "->" for that.

    record Point[T] {
        x : T;
        y : T;
    }
    
    updateViaPointer(ptr) {
        ptr^.x += 1;
        ptr^.y += 2;
    }
    
    test() {
        var p = Point(10, 20);  // type will be inferred as Point[Int]
        updateViaPointer(&p);
    }