00:00:00 --- log: started forth/20.02.29 00:14:13 --- join: dys joined #forth 00:37:50 --- quit: dys (Ping timeout: 255 seconds) 01:07:01 --- join: dys joined #forth 01:17:26 --- quit: iyzsong (Ping timeout: 255 seconds) 01:17:30 --- join: iyzsong- joined #forth 01:22:02 --- join: iyzsong joined #forth 01:22:09 --- quit: iyzsong- (Ping timeout: 240 seconds) 01:57:25 --- quit: _whitelogger (Remote host closed the connection) 02:00:28 --- join: _whitelogger joined #forth 02:03:12 You're wordy 02:16:29 --- quit: dave0 (Quit: dave's not here) 03:00:25 --- quit: _whitelogger (Remote host closed the connection) 03:02:49 --- quit: xek__ (Ping timeout: 240 seconds) 03:03:29 --- join: _whitelogger joined #forth 03:29:29 --- join: xek joined #forth 03:35:57 --- quit: WickedShell (Remote host closed the connection) 04:32:08 --- join: dddddd joined #forth 04:33:32 Do people spend a lot of time refactoring Forth to make it as short as possible? 04:34:13 probably 04:34:48 Forth does engender efficiency 04:34:48 I feel like I am refactoring a lot as I go to keep the code more readable 04:35:05 yeah me too 04:35:20 i think it becomes a bit of an obsession 04:35:26 I think it is to do with how difficult the code becomes to understand when it's not properly factored 04:35:33 absolutely 04:35:39 It is a good thing in a way, but it does remind me a lot of how I write assembly as well 04:35:45 agreed 04:35:49 I can see why people compare the experience to writing assembly 04:35:56 --- join: gravicappa joined #forth 04:36:18 well Forth covers the entire spectrum 04:36:29 from assembly like to hll 04:36:39 Hmm 04:36:58 from "0 bit I2C1_CR1 \ I2C1_CR1_PE, Peripheral enable" 04:37:13 to "on fill wash spin off" 04:38:18 Forth always looks different, C, Python, assembly always looks the same 04:38:24 and so on 04:39:13 in a way 'reading Forth is like reading in a dream where the writing is always changing" 04:40:51 I like how the high level examples are always washing machines 04:41:34 Thats only so C coders can follow the example ;-) 04:41:39 lol 04:42:19 we cant use it on micropython coders as they dont know what a washing machine is 04:43:31 One of the things I liked about Lua was the flexibility and ability to create a pseudo-DSL 04:44:07 but lua isnt as flexible as Forth is in area ? 04:44:30 Er I think the way it's not as flexible is mostly not important 04:44:51 Like it's true that Forth is more powerful here but mostly in ways that don't matter 04:45:15 I mean, C user washing machine is like this "on(); fill(); wash(); spin(); off();" 04:45:16 You can define +.... but not redefine + for numbers etc 04:45:34 In Lua it would be "on() fill() wash() spin() off()" 04:45:39 whats the washing machine look like in lua ? 04:45:43 ahh 04:45:53 But you could also write it like "plan{on, fill, wash, spin, off}" 04:45:55 the brackets really mess with the PDL imho 04:45:57 And numerous other ways 04:46:36 some think it is the language that makes the solution possible 04:46:37 Well if you want an example of a total failure at using Lua as a DSL have a look at awesome window manager's rc.lua 04:46:58 re: short words; I try to keep things compact, but not if it makes things harder to read and understand. 04:47:11 crc, agree 04:47:33 i have no problem with massively long words if needed 04:47:47 https://github.com/awesomeWM/awesome/blob/master/awesomerc.lua 04:47:58 An example of a bad attempt to use Lua as a DSL 04:48:05 long enough to explain the function without ambiguity, but no longer 04:49:17 Even the C file that Lua file is based on is more readable and DSL-like https://git.suckless.org/dwm/file/config.def.h.html 04:49:22 Really sad 04:49:56 hahah 04:50:13 I liked Lua personally, but not for embedded 04:50:41 This is a good example of Lua as a DSL https://leafo.net/guides/dsl-in-lua.html 04:50:58 people have been trying to replicate Forth functionality a lot lately, and failing imho 04:53:24 If you used the spacing of their DSL example you could probably write a reimplementation of what they had in Forth 04:53:35 Changing the strings slightly to start with " or something 04:54:21 but what do you get when you alter LUA to behave exactly like Forth ? ... Forth! 04:54:38 Well Lua was designed from the start as a DSL writer 04:54:50 And it's based on their in-house work 04:55:01 It's a sequel to SOL 04:55:26 When they originally wrote it the language was not aimed at programmers 04:55:32 Forth is actually aimed at programmers 04:56:00 i tested elua a while back 04:56:29 http://www.eluaproject.net current V0.9 260KB minimum flash needed, cant run on cortex-m0 04:56:46 If you are interested in the history and design of Lua then you should read https://www.lua.org/doc/hopl.pdf 04:56:52 Forth was made to control telescopes 04:57:10 by an astronomer 04:57:11 By the authors, interesting case of programming language design 04:57:53 naturally to control any machinery with a computer, programming is needed 04:58:00 Lua is a replacement for a DSL that was pretty much a Brazillian dBase replacement with simple validation on input 04:58:06 aha 04:58:48 I'm not interested in Lua now, I tested it on embedded but it's unsuitable for me 04:58:56 I also tested micropython 04:59:03 eLISP 04:59:39 nothing is as suitable as Forth which is substantially smaller and faster than all of the above 04:59:54 luajit is probably faster than Forth but how often does that matter 04:59:56 Forth is perfect for small embedded I'm my opinion 05:00:02 And it is very platform specific 05:00:20 in my tests Forth is about 3x slower than C 05:00:35 luajit is the reason Lua has as much interest as it does, a small project produced a JIT compiler that is better than the mainstream JavaScript JITs 05:00:49 but then Forth is interactive and the compiler is built in 05:01:08 Hmm 05:01:11 so a 19kB Forth also includes the compiler 05:01:17 no PC is needed 05:01:32 you could use a dumb terminal, tho no one does thesedays 05:02:17 the Forth development environment I use definitely needs a pc tho 05:13:39 tpbsd, 3x faster on m0 for example? 05:14:18 MrMobius, yes, thats what I used for my test 05:15:10 3x kept happening when I did comparisons and it's been mentioned in other literature 05:15:33 but it's still only anecdotal in my case 05:16:20 I find Forth on M3 is 3 - 4.8x faster than a M0 also 05:16:40 but speed is rarely a issue for me 05:24:50 --- join: iyzsong- joined #forth 05:25:08 --- quit: iyzsong (Ping timeout: 240 seconds) 05:32:42 --- quit: rdrop-exit (Quit: Lost terminal) 05:58:30 --- quit: iyzsong- (Quit: ZNC 1.7.1 - https://znc.in) 06:04:10 tpbsd, interesting. im doing a C to forth comparison myself now 06:04:31 did you use -o3 or -os? 06:04:45 MrMobius, cool, be interesting to see your results 06:05:11 I think I used the one that resulted in smallest code 06:05:27 -Os then probably 06:05:38 yes I think that was it 06:05:55 my initial tests were mainly about binary code size 07:30:13 --- join: TwoNotes joined #forth 07:55:03 --- join: xek_ joined #forth 07:56:28 --- quit: xek (Ping timeout: 240 seconds) 08:03:04 Fiance is learning programming, doing a Python tutorial. Did anyone here learn Forth as their first programming language? 08:07:19 pretty sure v8 is now equal to lua, but it required an entire team to produce a jit while lua was just one person 08:11:22 I wonder how e.g. gforth compares to gcc 08:14:39 it doesn't 08:14:48 gforth is slower 08:15:57 I know Forth is generally slower 08:16:05 Although I can imagine that it could be as fast as or faster 08:16:21 I know often JITs can be faster than compiled languages, so going off of that principle 08:16:48 you planning on building a JIT forth or something? 08:16:52 No 08:17:52 I haven't written much forth, but I did try euler problem one in many forths, the fastest one was ficl, all the other ones were slow 08:18:03 slower than lua 08:18:09 not luajit either 08:18:21 Hey lol that is what I was doing to learn Forth at the start 08:18:29 Project Euler stuff 08:19:03 I didn't know how to use big numbers in forth so I gave up 08:19:26 I just googled it and referred to gforth docs 08:19:46 And then for arbitrary length integers I stopped and decided I would write my own eventually 08:19:59 There is a big int for forth, I've seen it on github 08:26:49 JIT forth, now that's an idea 08:28:47 Well by JIT forth all I mean is optimising your words 08:28:50 seems like the benefit of a JIT to forth would be a lot less since youre not using many registers 08:29:44 since one thing a JIT apparently does is decide what gets put in registers and what goes elsewhere like the stack 08:29:52 (not a JIT expert though) 08:30:06 Yeah but that is a good description for a normal language 08:30:43 what do you mean? 08:30:47 In Forth I think a lot of effort would go into figuring out which stack operations can be optimised out, and which stack contents can be done with registers instead of actually going to a stack 08:31:07 An example is a function uses >R and then R>, well '>R' might as well just write to a register 08:31:21 A word I mean sorry I can't break the habit 08:33:10 http://ficl.sourceforge.net/index.html Ficl also features blindingly fast "just in time" compiling, removing the "compile" step from the usual compile-debug-edit iterative debugging cycle. 08:33:43 my code doesn't work in it... the hell 08:34:54 Forth is actually highly optimised inherently... for space. And that matters a lot more to me on my 8-bit computers. 08:38:53 veltas, compared to what though? 08:39:15 Did anyone here learn Forth as their first language? 08:39:37 MrMobius: compared to native languages and assembly 08:54:04 I don't know what its doing, I just know its faster and has better performance than gforth 08:55:55 or it had, except now it doesn't work for some reason 08:55:57 wtf 08:59:00 I am still enjoying Forth more than any other language in a while 09:03:02 --- quit: dys (Ping timeout: 260 seconds) 09:03:58 --- quit: xek_ (Ping timeout: 260 seconds) 09:04:47 veltas, neat. which 8 bit system? 09:04:55 ZX Spectrum 09:05:25 nice 09:13:13 the zx spectrum would probably be nicer if it wasn't for the keyboard 09:19:30 I've heard about ZX Spectrum the other day: https://hardware.slashdot.org/story/20/02/24/2139245/zx-spectrum-next-an-advanced-version-of-the-original-8-bit-home-computer-has-been-released 09:33:48 makes me wonder about https://en.wikipedia.org/wiki/Jupiter_Ace#ACE's_Forth 09:50:50 --- quit: TwoNotes (Quit: Leaving) 09:58:06 --- quit: dddddd (Ping timeout: 260 seconds) 10:05:16 I was wrong about ficl, its about the same 10:05:18 bah 10:06:27 even awk is faster than forth 10:06:29 ha 10:14:06 veltas: http://lua-users.org/lists/lua-l/2012-12/msg00289.html also this is how you build a DSL in lua 10:14:28 like wtf is that 10:14:34 that looks awful 10:16:27 its in pure lua, but its not gonna look great, because you're trying to hijack the parser 10:16:59 well, it looks fine, but still 10:37:38 also awesomerc.lua is not a DSL either, its pure lua... you can easily build a DSL in lua though, I built one for vis by just editing its visrc, the same could be done for awesome if you wanted to and make it more legible or just not use lua at all 10:38:07 visrc.lua http://tpaste.us/adOq DSL for keybindings: http://tpaste.us/qlpw 10:52:08 --- join: smokeink joined #forth 10:52:08 --- quit: smokeink (Client Quit) 11:30:10 --- quit: gravicappa (Ping timeout: 258 seconds) 11:33:43 --- join: dys joined #forth 12:32:26 --- quit: jsoft (Ping timeout: 255 seconds) 13:29:33 Kumool: ficl isn't a native code Forth 13:29:57 whereas, say, the Forth I am working on is an SRT 13:30:11 /NCI Forth 13:45:16 --- join: xek_ joined #forth 13:52:25 --- join: dddddd joined #forth 14:13:16 --- join: jsoft joined #forth 14:15:23 --- quit: dave9 (Quit: dave's not here) 14:16:08 --- quit: tabemann (Ping timeout: 240 seconds) 14:19:43 --- join: dave9 joined #forth 14:30:00 --- join: dave0 joined #forth 14:35:54 --- join: tabemann joined #forth 15:23:26 --- quit: xek_ (Ping timeout: 255 seconds) 15:40:05 --- quit: tabemann (Ping timeout: 255 seconds) 15:40:58 --- join: tabemann joined #forth 16:05:02 --- quit: tabemann (Ping timeout: 256 seconds) 16:11:48 --- join: tabemann joined #forth 16:12:01 --- join: X-Scale` joined #forth 16:12:41 --- quit: X-Scale (Ping timeout: 258 seconds) 16:12:42 --- nick: X-Scale` -> X-Scale 16:26:16 tabemann, plus ficl is being replaced with lua as the FreeBSD bootloader in FreeBSD 13.0 17:09:12 ugh 17:09:41 * tabemann is trying to get compiling to flash to work 17:10:23 tabemann, actually ficl does look to be a bit of a mess and Ive found it buggy on this pc 17:11:01 FreeBSD should have used Retro instead! 17:12:30 ficl apparently uses some switch-case-based token threading 17:12:46 and it's written in C 17:12:50 yes 17:12:52 as you said earlier 17:12:57 for portability I guess 17:13:16 perhaps 17:13:54 I was dismayed by how often ficl crashed when I was testing it 17:14:16 but then it was written around 1998 17:14:26 I remember playing around with ficl when I was a teenager 17:15:15 for some reasons, many x86 forths seem very buggy 17:15:29 to me 17:16:06 I think I used it on the Mac 17:16:15 which was PPC at the time 17:19:59 ugh 17:20:06 for some reason my flash-write code isn't working 17:20:18 despite that I copied it directly from matthias's code 17:20:35 aside from some stupid parts where I did things differently 17:20:53 which I changed to match how he does them 17:22:05 --- quit: dave0 (Quit: dave's not here) 17:29:39 consult the tech manual ? 17:31:11 I find the mecrisp-stellaris cortex-m4 flash writing diferent to the cortex-m0 17:31:33 I based mine off his stm32l476 code 17:32:04 the cortex-m0 is really fast and so is the m3 but the m4 seems slower and less smooth 17:32:17 do you have a l476 ? 17:32:44 I know he has to change the flash code with most models 17:33:26 and flash is meh to work with compared to ram 17:46:19 I have a l476 17:47:06 ah 17:47:09 I had to write a bunch of code to make working with flash almost like working with ram -almost 17:47:12 should work then 17:47:21 almost ? 17:47:44 where it will remember how you've written to flash, and write out blocks when you finish writing each byte to a block, automatically 17:47:49 the flash issues as i see them are minimum size blocks 17:48:08 i think it's 1024 bytes in the m3 17:48:34 there's also a routine to finish writing to a block if you've finished all your writes, even if it is not complete 17:48:41 so to erase one byte, I have to erase 1024 bytes at a time 17:49:03 on here writes are 16 bytes at a time, even though matthias's comments allude to there also being an 8 byte mode 17:49:13 thats cool 17:49:16 however, IIRC, to erase you can only erase 2K at time 17:49:41 yeah that kinda stuff 17:50:06 I think a lot of 'fudging' goes on with flash 17:50:55 of course I just use matthias words to flash in my code anway 17:51:53 in my Forth powered f103 diagnostics I use it to test flash bytes by writing to each one, erasing writing again, erasing again etc 17:54:46 okay, gotta get going, the coffee shop I'm at is closing 17:54:48 bbl 17:55:32 cya 18:00:28 --- quit: tabemann (Ping timeout: 240 seconds) 18:13:53 --- join: tabemann joined #forth 18:22:34 --- join: boru` joined #forth 18:22:37 --- quit: boru (Disconnected by services) 18:22:40 --- nick: boru` -> boru 18:33:54 --- join: iyzsong joined #forth 18:38:29 --- quit: iyzsong (Ping timeout: 240 seconds) 18:38:44 --- join: iyzsong- joined #forth 18:42:44 --- quit: iyzsong- (Client Quit) 19:05:48 --- join: iyzsong joined #forth 19:54:34 --- join: gravicappa joined #forth 21:16:28 --- quit: iyzsong (Ping timeout: 240 seconds) 21:17:06 --- join: iyzsong joined #forth 22:04:14 --- quit: iyzsong (Quit: ZNC 1.7.1 - https://znc.in) 22:04:56 --- join: iyzsong joined #forth 22:22:08 --- quit: Croran (Ping timeout: 240 seconds) 22:41:09 --- join: iyzsong- joined #forth 22:42:01 --- quit: iyzsong (Ping timeout: 260 seconds) 23:12:25 --- quit: _whitelogger (Remote host closed the connection) 23:15:28 --- join: _whitelogger joined #forth 23:59:59 --- log: ended forth/20.02.29