Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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. :-)



Compiled to plain C, hence fast and super compatible...

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


True, but it wasn't exactly Ruby/Python/IO inspired. ;-)


"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.)


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.


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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: