This is a autopost bolg frinds we are trying to all latest sports,news,all new update provide for you
Thursday, June 26, 2025
Show HN: I built a JSON-RPC library for Zig with compile time reflection https://ift.tt/gyEKN3T
Show HN: I built a JSON-RPC library for Zig with compile time reflection Doing dynamic dispatching in a strict static typing language is hard. Something as simple as, map.put("add", add); map.put("hello", hello); fn add(a: i32, b: i32) i32 { return a + b; } fn hello() []const u8 { return "Hello World"; } is impossible because the value type of key/value of the map needs to be the same but all the function types are different. Calling functions with different number of parameters, different parameter types, and different return type dynamically is difficult. Other languages either use dynamic typing, runtime reflection, macro, or passing in one big generic parameter and let the function figure it out. In ZigJR, I use Zig's comptime feature to do compile time reflection to figure out a function's parameter types, return types, and return errors. I package them up into a specific call object and use the interface pattern to produce a uniformly typed object to be put into the map. It's not easy but doable. [1] [1] https://ift.tt/TZ5eXfg... https://ift.tt/SENLgf7 June 26, 2025 at 11:54PM
Subscribe to:
Post Comments (Atom)
Show HN: tltv – Federation protocol for 24/7 TV channels https://ift.tt/KMVr6Ng
Show HN: tltv – Federation protocol for 24/7 TV channels I spent six years trying to build a tv channel server. rewrote it eight times. flas...
-
Show HN: A directory of 800 free APIs, no auth required Explore reliable free APIs for developers — ideal for web and software development, ...
-
Show HN: I built Dirac, Hash Anchored AST native coding agent, costs -64.8 pct Fully open source, a hard fork of cline. Full evals on the gi...
-
Show HN: I built a FOSS tool to run your Steam games in the Cloud I wanted to play my Steam games but my aging PC couldn’t keep up, so I bui...
No comments:
Post a Comment