News for hackers. Stuff that matters.
Re:Ooc - modern object oriented c by bbb on Thursday October 15, 2009 @10:01AM (#883375)
The second to last example looks like it is incomplete:

    include time // equivalent to #include <time.h> in C
 
    TimeT: cover from time_t
    Tm: cover from struct tm {
       tm_sec, tm_min, tm_hour, tm_mday, tm_mon, tm_year, tm_wday, tm_Tm*
 
    main: func {
      timestamp := time() // timestamp is now a TimeT
      t := localtime(timestamp&) // t is now a Tm*
      printf("It's %dh%d.", t@ tm_hour, t@ tm_min)
    }
I would have expected a closing } in the definition of the TimeT cover.

Generally speaking, ooc looks really promising. Compiled to plain C, hence fast and super compatible, and with syntactical treats borrowed from Python and Ruby. I wanted this for a looong time. :-)

Re:Ooc - modern object oriented c by jcl on Thursday October 15, 2009 @10:14AM (#883399)
Compiled to plain C, hence fast and super compatible...

In the beginning, there was cfront... ;)

Re:Ooc - modern object oriented c by bbb on Thursday October 15, 2009 @10:28AM (#883423)
True, but it wasn't exactly Ruby/Python/IO inspired. ;-)
Re:Ooc - modern object oriented c by swolchok on Friday October 16, 2009 @03:27AM (#884966)
"Compiled to plain C, hence fast" is not actually a great argument. See e.g. lua-jit, which IIRC just generates subroutine-threaded code. (In other words, it "merely" takes a series of lua opcodes generates C code that is a series of calls to the functions that implement these opcodes.)
Re:Ooc - modern object oriented c by nddrylliog on Thursday October 15, 2009 @10:18AM (#883404)
I've added the optional {} after the empty TimeT cover =) Is it clearer now?

I'm really glad to see that it scratches an itch for many people out there. As always, suggestions are welcome.

Re:Ooc - modern object oriented c by bbb on Thursday October 15, 2009 @10:27AM (#883422)
Uh, no. I guess I picked the wrong declaration; I meant Tm. There is a bracket/scope opened after 'struct tm' that, as far as I can tell, is never closed.