2023-03-11 18:08:38 evening folks 2023-03-11 18:12:53 evening 2023-03-11 18:20:27 oddning 2023-03-11 18:23:58 good evening 2023-03-11 20:15:52 what's the most readable forth code you've seen? 2023-03-11 20:16:01 more than a hello world 2023-03-11 20:16:50 it's supposed to be able to write readable code in a way that you read words, everyone having meaning 2023-03-11 20:20:58 https://wiki.c2.com/?ForthFlames 2023-03-11 20:21:00 hahaha 2023-03-11 20:24:07 hehe, that site: "I guess we should take the winner of the Obfuscated Perl contest to use as proof that Perl is not readable." 2023-03-11 20:24:16 i bet most people do exactly that 2023-03-11 20:32:23 : ROBOT CRUSH! KILL! DESTROY! ; 2023-03-11 20:32:44 I think is the most readable code I ever seen 2023-03-11 20:35:54 actually is readable, but can get unreadable very easily 2023-03-11 20:36:45 the moment you start adding sp dup swap etc it starts getting unreadable 2023-03-11 20:37:24 so the goal seems to be to make verbs most of the time 2023-03-11 20:38:32 every time I see forth code I want to use forth 2023-03-11 20:46:40 I think I'll spend some time learning forth 2023-03-11 20:47:01 it is what I should have done from the start xD 2023-03-11 20:47:56 I'd like to be able to give Forth some access to stuff like db, sockets, etc 2023-03-11 20:51:03 i try to learn as many progrmming languages as i can find 2023-03-11 20:51:14 forth is a respectable enemy .. yet 2023-03-11 20:51:18 good night for now 2023-03-11 20:53:14 "Readability sucks, and that's for morons anyway, 'cause real programmers can decipher anything" 2023-03-11 20:53:16 xd 2023-03-11 20:53:20 I'm a moron 2023-03-11 20:53:24 gn tux0r :D 2023-03-11 20:56:53 btw forth is not an enemy :/ 2023-03-11 20:57:03 you are your worst enemy 2023-03-11 20:57:08 forth is a friend :D 2023-03-11 21:02:43 Forth is being used and actively maintained in EVERY NASA satellite orbiting our planet. 2023-03-11 21:02:45 :0 2023-03-11 21:03:09 doubtless the lizard people want it that way for a reason 2023-03-11 21:03:12 I've read also the nasa used lisp and even made remote debugging with an orbiting satelite 2023-03-11 21:46:04 forth can use databases and sockets; I use sqlite3 (via a unix pipe) and sockets in some of my applications, and I know that gforth has some support for sockets 2023-03-11 21:46:49 the channel logger (crc[log]) is written in forth, using a socket based connection to the libera servers 2023-03-11 21:47:07 can't install gforth, and when I can I can't make the ffi part work 2023-03-11 21:47:22 you use your own retro-forth I assume 2023-03-11 21:47:31 which sockets weren't working here for some reason 2023-03-11 21:47:35 I've had a lot of issues with gforth & ffi. I gave up on that 2023-03-11 21:47:42 yes, retroforth 2023-03-11 21:47:55 and you said you might update the netbsd version it has 2023-03-11 21:48:00 but I assume you didn't xD 2023-03-11 21:48:07 I've only really used sockets under OpenBSD 2023-03-11 21:48:20 still the existing one didn't seem to do nothing with sockets 2023-03-11 21:48:36 it said ok, but not blocking when accept I guess 2023-03-11 21:48:48 updates to the copies in the ports trees, pkgsrc, etc are coming (I'm nearing completion on the next version, will be working on the updates to these once done) 2023-03-11 21:48:48 maybe I was dumb? 2023-03-11 21:49:07 still does not matter 2023-03-11 21:49:19 I don't really need to do fancy stuff, but to learn the lang properly 2023-03-11 21:49:39 I can have pforth 2023-03-11 21:50:19 I need to do more testing of sockets on non-OpenBSD systems :( 2023-03-11 21:50:58 don't worry 2023-03-11 21:51:04 I'll use pforth I suppose 2023-03-11 21:51:06 I've got Linux, FreeBSD, and NetBSD VMs set up for testing now, so will write some tests soon 2023-03-11 21:53:31 crc New releases are normally done in January and July. why? 2023-03-11 21:55:11 CELL ngaImage[] = { 1793,19917,20375,20419,202301,417,389,1249,1535,0,10995,0,10,1,10,2,10,3,10, 2023-03-11 21:55:12 wtf 2023-03-11 21:55:38 what are those lines with numbers? 2023-03-11 21:55:40 I was doing quarterly releases in the past. The system is largely stable these days, and due to RSI issues, I work more slowly than I used to. Two releases per year is plenty :) 2023-03-11 21:55:45 bytecode values 2023-03-11 21:56:16 My systems run on an emulated MISC processors 2023-03-11 21:57:01 Each value is either data, or an instruction bundle (four instructions get packed into each memory location) 2023-03-11 21:57:34 The system can use an embedded copy of the actual bytecode, or load this from a file. 2023-03-11 21:58:31 The actual Forth implementation is assembled, then a tool (retro-embedimage) converts the bytecode into that array for inclusion in the VM 2023-03-11 22:01:04 the code is quite readable 2023-03-11 22:02:14 still I'd like to not touch C if possible 2023-03-11 22:04:07 I want to learn forth properly so I can know what I want to steal from it 2023-03-11 22:04:41 mainly cause my lang is quite hard to use and leads to unreadable and unmaintaible code 2023-03-11 22:05:06 when I see forth code it just looks much better than my shit 2023-03-11 22:05:33 maybe because I abuse lists and use them to provide code to execute 2023-03-11 22:05:44 but also funny syntax sugar I suppose 2023-03-11 22:06:32 crc do you have some code in retro forth to share? 2023-03-11 22:06:53 I like forth. I use C (and other languages) mostly to write VMs that run my actual Forth (which is written in assembly & Forth). 2023-03-11 22:07:09 I think I'll try to get rid of words with puntuation marks and alike 2023-03-11 22:07:11 There's various examples at http://retroforth.org/examples 2023-03-11 22:09:44 crc did you use some form of literate programming? 2023-03-11 22:10:11 I remember those ~~~ served to mark code for your lang 2023-03-11 22:10:37 like it was able to read code only between those ~~~? 2023-03-11 22:10:50 yes 2023-03-11 22:10:57 See http://unu.retroforth.org 2023-03-11 22:12:14 did you end targeting mobile platforms? 2023-03-11 22:12:23 Other than those examples, I have a second RetroForth running on a different VM, this one uses blocks. The blocks can be seen at http://forth.works/blocks.txt 2023-03-11 22:12:34 This is a modern system primarily targeting desktop, mobile, and servers, though it can also be used on some larger (ARM, MIPS32) embedded systems. 2023-03-11 22:13:11 I have iOS versions of my systems. They can be built & run on Android under Termux. 2023-03-11 22:13:50 ah, termux 2023-03-11 22:15:41 I'm considering writing an actual Android implementation, but I've only actually had an Android device for a few months now, and I'm not looking forward to dealing with another big development environment. (I already hate Xcode) 2023-03-11 22:17:39 on iOS, I've been rewriting the VM and interface using Swift & SwiftUI so I can avoid using Xcode. Swift Playgrounds on my iPad isn't great, but it's been less irritating than Xcode so far. 2023-03-11 22:17:40 so the compiler makes an executable with embedded bytecode? 2023-03-11 22:18:05 The retro-compiler ? 2023-03-11 22:18:15 yeah 2023-03-11 22:18:24 That does, on systems that use ELF executables 2023-03-11 22:19:08 what ends into the executable? 2023-03-11 22:19:22 that's a cool feature 2023-03-11 22:19:41 it combines a copy of the retro.c vm that can extract the image from an ELF section, and the compiled image 2023-03-11 22:20:38 I use it occasionally at work to build various little tools for others to run 2023-03-11 22:23:33 oh you even made an emacs mode 2023-03-11 22:23:38 https://git.sr.ht/~crc_/retroforth/tree/master/item/retroforth.el 2023-03-11 22:24:34 where's the python version 2023-03-11 22:24:43 I wonder how hard would be to make a perl one 2023-03-11 22:24:49 Philippe made that; I just added it as it's useful 2023-03-11 22:24:58 I see several versions 2023-03-11 22:25:08 pascal c# python c 2023-03-11 22:25:14 https://git.sr.ht/~crc_/retroforth/tree/master/item/vm/nga-python 2023-03-11 22:27:30 hi dave0 2023-03-11 22:27:42 RetroForth/nga has implementations in C, C++, C#, Python, Pascal, Nim, Rust, JavaScript, Swift, and 65c816 assembly. (I also have an Objective-C version used in the current iOS app store version). The C & Python ones have the most features, the others are much more barebones. 2023-03-11 22:27:53 hi vms14, crc 2023-03-11 22:29:14 wtf 2023-03-11 22:29:39 RetroForth/ilo (my block based system) has VM implementations in C, C#, C++, Go, Kotlin, Lua, Nim, Python, Rust, Swift, amd64 assembly, and aarch64 assembly. 2023-03-11 22:30:04 that's why you emulated a misc processor? 2023-03-11 22:30:08 The prior RetroForth/ngaro system (retro11) did have a perl version 2023-03-11 22:30:11 to aid portability 2023-03-11 22:30:23 that's a part of it 2023-03-11 22:30:58 I suppose that perl version was lost 2023-03-11 22:31:03 which is sad :/ 2023-03-11 22:32:18 why so many languages? 2023-03-11 22:32:20 not lost 2023-03-11 22:32:22 forthworks.com:8080/retro-language/file?name=vm/partial/retro.pl&ci=tip 2023-03-11 22:32:35 also the ngaro has that many 2023-03-11 22:32:37 At present, there are full implementations in Assembly (x86), C, F#, Go, Common Lisp, PHP, Python, and Ruby, and minimal implementations in C#, Forth, Lua, JavaScript, Java, Perl, and Scheme. 2023-03-11 22:33:00 I just never got around to writing a version of the perl one for my current systems 2023-03-11 22:33:10 crc, what's the minimum binary size for x86? 2023-03-11 22:33:21 I find it an interesting exercise to play with languages by implementing the vm in them 2023-03-11 22:35:18 MrMobius: for my smaller system, see http://forth.works/sizes.txt 2023-03-11 22:35:48 for amd64, 4,640 bytes; for x86, 5,308 bytes 2023-03-11 22:36:31 (the .jar is for the kotlin version, which bundles a lot of runtime libraries) 2023-03-11 22:38:06 those are static binaries for linux and the bsd variations, so no libc needed 2023-03-11 22:40:44 for the larger vm, the smallest binaries I've built are about 13kb for and amd64 binary 2023-03-11 22:42:19 (I don't maintain a collection of vm binaries for the nga vm, so can't do a full size comparison on this) 2023-03-11 22:43:35 crc in which language was easiest to implement 2023-03-11 22:43:48 and in which ones did you get the most fun? 2023-03-11 22:49:40 C was probably the easiest, but it's the one I have the most experience with outside of Forth. For fun, I enjoyed working on the nim and swift versions, and adapting the C version to run on Macintosh System 6. I found Rust & Kotlin to be frustrating to write. 2023-03-11 22:51:21 (the above is all for ilo; I don't mess much with the nga implementations now, other than the C one) 2023-03-11 22:58:42 hmm 2023-03-11 22:59:22 how does a bytecode interpreter deal with strings? 2023-03-11 22:59:41 it's like an opcode that tells the following stuff is a string + counter? 2023-03-11 23:00:23 or does it store them somewhere 2023-03-11 23:01:51 The nga implementations are somewhat aware of strings. There I use null terminated strings, which are accessed via known pointers in the image or via pointers passed on the stack. 2023-03-11 23:02:39 The ilo implementations aren't aware of anything in the image. On ilo, my Forth uses a count + characters for strings and arrays. 2023-03-11 23:04:14 The nga implementations will extract strings for stuff like filenames, and can inject strings when necessary 2023-03-11 23:05:07 yeah I saw an extract_string(vm, something) 2023-03-11 23:05:15 in the C version 2023-03-11 23:05:31 but I was just looking superficially xD 2023-03-11 23:10:11 I'm not sure if I'll end with a bytecode interpreter 2023-03-11 23:10:17 I do prefer the idea of a transpiler 2023-03-11 23:13:24 I don't feel much comfortable with the idea of a transpiler yet, I need to play with it 2023-03-11 23:13:54 I have immediate words, and code generator words, which are immediate, but return code 2023-03-11 23:14:11 and normal words have a function and a string representing the code 2023-03-11 23:14:22 mainly the function is being built from the string 2023-03-11 23:14:35 the string is returned when compiling, the function executed when interpreting 2023-03-11 23:15:02 as it can interpret stuff when compiling too or just act as an interpreter 2023-03-11 23:15:31 I have colon words which are the main reason I wanted the transpiler 2023-03-11 23:15:49 now colon words have 0 cost and I can factor as much as I want 2023-03-11 23:16:08 but still I need to get a better idea of the whole thing 2023-03-11 23:16:23 it's like when I started with the interpreter xD 2023-03-11 23:16:53 I have three immediate words in my new systems: [ ] ;