7 ms·
That nim version isn’t much better IMO, but I am unfamiliar with the language.
by secondcoming 4y ago
That nim version isn’t much better IMO, but I am unfamiliar with the language.
- kelnos 4y agoI'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 ;)
- elcritch 4y agoThat'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.
- shirleyquirk 4y agoI agree, I prefer Nim's alternate syntax for this sort of stuff: var signal*: (cint,(cint)->void) -> (cint)->void