2024-06-24 02:00:05 guys, why is forth<->dynamic library support terrible 2024-06-24 02:00:13 it should be amazing 2024-06-24 02:00:53 zelgomer: i think most good programmers think from both sides yes. 2024-06-24 02:01:04 there is no one true way. 2024-06-24 03:46:06 well to answer your question, probably because where forth is most commonly used there is no such thing as dynamic libraries 2024-06-24 03:54:17 lf94: How would you expect dynamic library support to work? After you brought a binary blob of code into RAM, how would you access it? 2024-06-24 03:54:45 I'm not saying there wouldn't be a way - I just think that the Forth idea would be just to load source when you needed it. 2024-06-24 03:54:54 You already have the machinery to do that, and it solves the problem. 2024-06-24 03:55:16 The main advantage I see in binary vs. source load is that binary lets you keep secrets more readily. 2024-06-24 03:55:27 I don't think that's part of Forth's "orientation." 2024-06-24 03:55:50 I just want to be able to use .so like other language 2024-06-24 03:56:18 GForth at least has a C interface method, doesn't it? 2024-06-24 04:53:11 It does 2024-06-24 04:53:16 and I guess vfx too 2024-06-24 04:53:26 I think I wish we had more popular forths lol. 2024-06-24 07:14:42 lf94: It's easier than you probably think to do this 2024-06-24 07:18:30 Link to dlopen statically, have some words compatible with typical ABI layouts e.g. 0-8 register parameters, maybe some for floating point parameters as needed 2024-06-24 07:19:23 Use dlsym to get the desired functions 2024-06-24 07:20:35 libdl apparently contains dlopen on Linux for instance 2024-06-24 13:09:05 dlopen() and such are part of the standard libc on BSD 2024-06-24 13:58:45 lf94: my guess would be that most Forth programmers aren't using Forth to write programs that run on systems with an FFI 2024-06-24 13:59:07 (e.g., most uses I see reported are around embedded systems) 2024-06-24 14:00:12 Some of the common hosted ANS systems (gforth, swift, vfx) have FFI models. Some less popular systems (e.g., reva & the old x86 versions of my retro system) do as well 2024-06-24 14:02:46 In the paste, I used the FFI words in x86 retro extensively; I had a number of programs written using it to provide interfaces via GTK+ back in the 2004-2006 timeframe 2024-06-24 14:24:50 in my current retroforth, I have an optional FFI, but it requires creating a .so with bridging code to deal with ABI translation for the functions being used 2024-06-24 14:25:26 afaik it's not actually been used for anything other apart from some small tests 2024-06-24 20:44:39 Yo, anyone know of any JSON Forth packages 2024-06-24 20:44:57 or HashMap packages 2024-06-24 20:47:18 Also does anyone use TheForthNetwork or whatever? 2024-06-24 20:47:22 lf94: https://github.com/irdvo/ffl/blob/master/ffl/jis.fs 2024-06-24 20:47:23 That package manager 2024-06-24 20:52:23 Thank you crc 2024-06-24 20:52:32 crc am I correct in thinking this is non-reentrant? 2024-06-24 20:52:48 (Sorry I confuse this term) 2024-06-24 20:52:55 It relies on a global state right 2024-06-24 20:53:02 hence jis-set-string, etc 2024-06-24 20:53:10 This is something I'm not fond of still in Forth... 2024-06-24 20:54:28 that would be my assumption 2024-06-24 20:56:13 lf94: just because it uses global state doesn't mean it isn't reentrant. it may push global vars onto the return stack before using them and pop them back into memory before it returns. 2024-06-24 20:56:54 https://irdvo.nl/FFL/docs/jis.html has some docs on jis.fs 2024-06-24 21:03:36 zelgomer: right right, true 2024-06-24 21:03:48 Pretty sure that's the case here though 2024-06-24 21:04:00 Why aren't there combinator parsers more popular in Forth? 2024-06-24 21:04:08 I feel like it'd be a match made in heaven 2024-06-24 21:11:50 because you haven't written one! 2024-06-24 21:16:40 lol