logoalt Hacker News

cb321last Saturday at 5:45 PM1 replyview on HN

I see from `test/test_suite/compile_time_introspection/paramsof.c3t` that there is a way to get names & types of function parameters [1]. The language also seems to support default values { e.g. `int foo(int a, int b = 2) {...}` } and even call with keyword arguments/named parameters [2], but I couldn't find any `defaultof` or similar thing in the code. Does anyone know if this is just an oversight / temporary omission?

[1] https://github.com/c3lang/c3c/blob/master/test/test_suite/co...

[2] https://c3-lang.org/language-fundamentals/functions/


Replies

Windeycastlelast Saturday at 7:23 PM

I don't think it is available no, and it's the first time I heard about such an idea. Thinking on it, this would allow such cursed code (love that :D). I'll put it up for discussion in the Discord as I'm interested in hearing whether `.defaultof` is a good idea or not.

show 1 reply