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