Re:Checked C
by secondcoming on Wednesday December 21, 2022 @03:07PM
(#34085723)
That nim version isn’t much better IMO, but I am unfamiliar with the language.
[ Parent
| on HN ]
I'm completely unfamiliar with the language but was able to read it from left-to-right very easily:
var signal*: proc (a1: cint; a2: proc (a1: cint)): proc (a1: cint)
That reads to me as:Variable signal is a pointer to a function that that takes two arguments (an int, and a function that takes an int), and returns a function that takes one argument (an int).
Of course, I'm assuming my interpretation is correct... perhaps it's not ;)
That's right. It's actually just an ugly bit of code though it's pragmatic.
Note that Nim uses "*" as a public symbol sigil not a pointer. Its a bit odd at first coming from C but is nice and consistent.
Re:Checked C
by shirleyquirk on Wednesday December 21, 2022 @04:53PM
(#34086882)
I agree, I prefer Nim's alternate syntax for this sort of stuff:
var signal*: (cint,(cint)->void) -> (cint)->void