Closed
Description
I can do
import lang/IO
aFunction: func (value := 2) { value toString() println() }
aFunction(1) // prints 1
aFunction() // prints 2
which is totally awesome, but not mentioned anywhere in the ooc documentation as far as I can tell. I was missing out until another guy tried it assuming it would just work, and it did :)
So then I tried to do
testClass: class {
value: Int
init: func (=value := 4)
}
Which didn't fly:
error Malformed function argument (remember, it's
name: Type
in ooc, notType name
)
Unless anyone thinks this is a terrible idea, I'll see if I can figure out how hard it would be to get this to work (maybe with a slightly different syntax, like init: func (=value = 4)
, dropping the :
). I guess Nagaqueen.c is a good place to start?