Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Progrmaming Skill but nothing to code?

Name: Anonymous 2011-06-17 2:01

I learned so much programming and good pretty good at it when I was a teen. I'm 23 now and I don't have any friends or projects. I think some kind of virtual world would be nice but I know there's no point in making it because nobody would join. I guess I'm just lonely and lost. What should I do?

Name: joe 2011-06-19 22:56


/*
 * what about cc without c backcompat...?
 */
import std.io

class stack<T> {
  class node<T> {
    T v; node * next;
  }

  node * head = null;

  push(T e) {
    var n = alloc node(e, .head);
    .head = n;
  }
  pop() {
    var v = .head.v;
    .head = .head.next;
    free .head;
    return v;
  }
  empty() {
    return .head == null;
  }
}

main() {
  var s = alloc stack<int>();
  s.push(11);
  s.push(23);
  s.push(42);
  while (not s.empty()) {
    std.io.print(s.pop());
  }
  free s;
}

/*
 * what i really liked...
 *   var, return and template type inference
 *   "this" pointer is just a '.' prefix
 *   unambiguous null
 *   simple structs without a need for vtables
 * fear the future...
 *   refcounting gc?
 *   syntatic sugar like
 *     foreach, operators, lambdas and '\n' stmt ending?
 *   alternative initialization? "node * n = alloc {e, .head};"
 * and a bonus: with appropriate conventions, we could
 * even import c-style headers and generate c-compatible
 * object files
 */

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List