News for hackers. Stuff that matters.
Re:Why the world needs Haskell by ajuc on Wednesday July 10, 2013 @07:22AM (#6018695)
It's possible, no matter where the object lives:

    #include <cstdio>
    using namespace std;
    class Type {
      public:
        Type(int a):_a(a){};
        int _a;
    };
    
    Type& getType(int a) {
      Type* t = NULL;
      t = new Type(a);
      return (*t);
    }
    Type& doSthWith(Type& t) {
      //no need (and no way) to check if t is reference to proper object
      t._a=t._a+1;
      return t;
    }
    
    int main() {
      Type& t = doSthWith(getType(5));
      printf("%d\n",t._a);
      return 0;
    };
This can be broken of course, for example by

    Type& getType(int a) {
      Type* t = NULL;
      return (*t);
    }
But that's another matter.
Re:Why the world needs Haskell by chongli on Wednesday July 10, 2013 @07:59AM (#6018865)
Right. What makes Haskell special is not that it has option types, it's the fact that most types in Haskell cannot be null. This allows us to write pure (and total) functions, knowing that the compiler will enforce it; giving us a high degree of assurance that our function will not fail.