/tech/ - Technology and Computing

Technology, computing, and related topics (like anime)

Site was down because of hosting-related issues. Figuring out why it happened now.

Build Back Better

Sorry for the delays in the BBB plan. An update will be issued in the thread soon in late August. -r

Max message length: 6144

Drag files to upload or
click here to select them

Maximum 5 files / Maximum size: 20.00 MB

More

(used to delete files and postings)


API's and Bindings thread Anonymous 07/16/2020 (Thu) 01:22:40 No.3001
Holy shit, I just started using Lua 5.3's C api and it's so much cleaner than the 5.1 api I was using before. It makes it so easy to build out metatables for all the types that you're trying to bind. the luaL_checkX functions are a godsend too, it's a real breath of fresh air coming from certain other scripting languages. I think the SLOC I needed for binding easily went down at least 20% using this new interface. It's still got some warts like the lua_tolstring caveats, and the weird proxies and function metamethods for getters and setters, but I think it's a big improvement. ITT Talk about binding things to other languages. Do any api's stand out to you as particularly clean, effective or clever?
>>3001 I know very little about this topic, but I have a C++ program I'm working on that I'd like to provide a reduced & simplistic Python API for so users can script the most basic parts. ATM I'm assuming the Boost library for this would be a reasonable choice, though I haven't yet reached the stage where I'll need to do serious investigation and prototyping for it.
Guile's bindings are nice. Even withing C you can do very lispy things with it. It has a problem in which the "context" is implicit and pretty much invisible, so you can't use it as-is but you have to pass a function pointer to a function which initialized the context; when your function is called, you can use Guile's API however you want, until your function terminates. Under normal cirumstances it wouldn't be too much of a hassle, but I'm using it in a program with a lot of asynchronous operations, so I ended up writing a function which is called when the asynchronous task is executed, which calls the function to temporarily intialize the Guile context (for various reasons I can't keep the whole program in Guile mode all the time) so that the Guile API can be used. In the worst case the callback chain can reach more than three functions just to iterate over a list.

Report/Delete/Moderation Forms
Delete
Report