2024-10-23 00:33:19 I was trying waforth but I have no idea on how to "make it mine" in order to embed it into an html page and load my own code there 2024-10-23 00:34:41 and even if I were able to embed gforth with emscripten the "documented" ffi uses libtool which generates code at runtime, compiles it and links it every time you run the application 2024-10-23 00:34:59 quit isn't state-smart is it? 2024-10-23 00:35:18 maybe pforth would be a good option for emscripten as long as I learn how to add bindings 2024-10-23 00:35:43 I'm not in a state to make my own forth yet, since there are a lot of things to learn 2024-10-23 00:37:18 There's this scripting language for the web that's pretty powerful I've heard, and runs in IE6 2024-10-23 00:37:37 I could try to see if I can add websockets to gforth and I could control the web application, but also would require to make a server 2024-10-23 00:37:54 veltas you mean that lnguage named javascript? I've heard of it 2024-10-23 00:38:06 Yeah that's the one 2024-10-23 00:39:14 I made several rpn concat langs on it, but they are not forth, I suppose I will have to wait to learn forth more properly and be able to implement it properly 2024-10-23 00:39:31 veltas> quit isn't state-smart is it? 2024-10-23 00:39:41 the "conventional" outer interpreter loop as i understand it is 2024-10-23 00:40:26 I wouldn't consider using STATE as being STATE-smart, if that's what you're saying 2024-10-23 00:40:43 then what does state-smart mean?? 2024-10-23 00:41:34 Trying to provide different semantics for a word based on STATE, to 'do' the same thing in context 2024-10-23 00:41:53 QUIT doesn't need to do that, it ignores STATE when it's run and clobbers it 2024-10-23 00:42:43 I want a junior forth programming job 2024-10-23 00:42:54 I already know how to swap two elements on the stack 2024-10-23 00:43:01 shit you're right, quit should reset state. i don't think i've ever done that... what an oversight. 2024-10-23 00:45:53 The big state-smart word I'd think of in the standard is S" 2024-10-23 00:46:17 I'm not keen on state-smart stuff, I think it's unnecessary 2024-10-23 00:50:54 veltas: I don't think s" is required to work in interpretation state 2024-10-23 00:51:46 It is if you implement the file words, which most ANS forths do 2024-10-23 00:52:02 Specifically so you can do S" myfile" INCLUDED etc 2024-10-23 01:11:04 vms14: I can offer you a junior forth volunteer role 2024-10-23 01:12:49 "we need to hire a forth expert" "but sir, there are only the two of us on payroll" 2024-10-23 01:14:00 veltas that would be cool actually, for some reason forth seems to be the only language I want to focus on 2024-10-23 01:14:12 yet my level is not good even for a junior positionn 2024-10-23 01:14:57 I don't mind working for free to get experience, but in this case it would be counterproductive for you 2024-10-23 01:14:58 Ah yes it's 2024 when junior positions require 10 years experience in industry 2024-10-23 01:15:36 yeah, if we were in the 90s I would be a perl dev right now, writing ver dirty cgi scripts 2024-10-23 01:15:46 very* 2024-10-23 01:16:46 Here's your jira sprint board https://github.com/Veltas/zenv/issues 2024-10-23 01:16:55 Standups are every day at 4am 2024-10-23 01:18:17 it's when I'm most awaken 2024-10-23 01:20:20 awake* 2024-10-23 01:20:58 And if you patch zenv I'll give you exclusive access to my in-dev x86-64 forth so you can fix that for me too 2024-10-23 01:21:04 it's funny btw because linkedin says there are +4000 forth job positions 2024-10-23 01:22:26 https://i.imgur.com/7OxgLKC.png 2024-10-23 01:25:30 The main way to work with Forth is to start a business 2024-10-23 01:27:09 There's been at least one person here working with Forth who doesn't run their own business or consultancy, but their opportunity simply wouldn't exist today 2024-10-23 01:28:17 Weirdly enough I met someone who worked at MPE Forth in my job, who retired a few years ago now 2024-10-23 01:28:48 He gave me his old Forth stuff from attic, which was Starting Forth 2nd ed, and an MPE manual / floppy 2024-10-23 01:29:21 Well not that weird given I work in embedded, so more likely to meet old Forthers 2024-10-23 01:29:33 Less likely every day though, they're all retiring now 2024-10-23 01:29:39 nie 2024-10-23 01:29:41 *nice 2024-10-23 01:38:54 yeah I suppose it aligns with "the main way to learn forth is implementing it" 2024-10-23 01:42:06 I always wanted a language that resembles pseudocode or just English and forth seems to be the nearest thing 2024-10-23 01:42:18 depends on your choice of words 2024-10-23 01:43:12 I like specially the encouragement to factor and to build everything with very little pieces that do one thing 2024-10-23 01:43:29 That's definitely how it's sold in Thinking Forth 2024-10-23 01:44:04 I think it's how the classic user-facing Forths apps are written 2024-10-23 01:44:22 I saw chuck stating forth is the best language in hop 2024-10-23 01:44:56 https://colorforth.github.io/HOPL.html 2024-10-23 01:45:02 at the end 2024-10-23 01:45:24 I know Forth is the best language so far. I'm pleased at its success, especially in the ultra-conservative arena of Artificial Intelligence. I'm disturbed that people who should, don't appreciate how it embodies their own description of the ideal programming language. 2024-10-23 01:46:27 I want to trust him, as for now I have to realize it by myself yet 2024-10-23 01:46:47 forth is more of a state of mind 2024-10-23 01:46:58 if it's the best language why I would use another lang 2024-10-23 01:47:18 Chuck's been wrong about plenty of things 2024-10-23 01:47:21 vms14: I would actually disagree he was saying it was ideal, he said it embodied their description of the ideal 2024-10-23 01:47:21 and if I learn to implement it I can steal all the features I want from the host language 2024-10-23 01:47:26 forth is the best language for a certain subset of tasks 2024-10-23 01:47:49 plausibly one of those things is the idea that there's a single best language for everything 2024-10-23 01:47:54 for some reason in my mind I want to think it's true 2024-10-23 01:48:07 the trick with forth is it's very easy to expand 2024-10-23 01:48:07 that is not only for embedded devices or low level stuff 2024-10-23 01:48:14 so while forth might not be the best language 2024-10-23 01:48:14 Oh I missed the first line where he says "best language so far" lol 2024-10-23 01:48:18 or even a good language 2024-10-23 01:48:21 for the task at hand 2024-10-23 01:48:42 you can extend forth into a language that is good for the current task 2024-10-23 01:48:44 if it's not the best language, did you fail to extend it properly? 2024-10-23 01:48:55 Yeah it's true Forth is a mindset, I take *that* to work, not Forth itself 2024-10-23 01:49:20 Forth is a lot of fun 2024-10-23 01:49:22 one of the underappreciated aspects of domain-specific language design is error messages 2024-10-23 01:49:48 Forth's error message stuff is quite good IMO 2024-10-23 01:49:51 ideally you want your DSL to report errors in DSL programs in terms meaningful within the domain 2024-10-23 01:50:54 the other thing is that the main objective advantage of forth (its small size) is becoming less and less relevant as memory gets cheaper 2024-10-23 01:51:05 But you can't put millions of boards with megabytes of sram 2024-10-23 01:51:28 stupid world and its limitations 2024-10-23 01:51:38 Also your L1 cache is very Forth-sized 2024-10-23 01:52:05 an arm mcu with hundreds of kB on board isn't that much more expensive than something like an avr or pic with much less memory 2024-10-23 01:52:32 and when you can just throw some c++ at it and save money on development time, writing good software starts to look less attractive 2024-10-23 01:52:50 C++ would increase dev costs 2024-10-23 01:52:58 would it? 2024-10-23 01:53:02 everybody knows c++ 2024-10-23 01:53:05 Depends what you're doing 2024-10-23 01:53:07 it can 2024-10-23 01:53:09 lol not in embedded 2024-10-23 01:53:48 C is the middleground, in my opinion 2024-10-23 01:54:09 what, not CircuitPython? 2024-10-23 01:54:11 probably worth pointing out that the arduino software environment uses c++ 2024-10-23 01:54:55 Does it use C++ or a subset? 2024-10-23 01:55:02 a superset 2024-10-23 01:55:05 well, sort of 2024-10-23 01:55:29 it's C++ with an extra preprocessor so you don't have to declare things before you use them 2024-10-23 01:55:47 for files ending in .ino 2024-10-23 01:56:03 and some headers automatically included 2024-10-23 01:56:04 IMO the cost effective low-level embedded language is C with GCC 2024-10-23 01:56:04 right 2024-10-23 01:56:06 but you can also easily link in C or C++ files into your project by using the appropriate extension 2024-10-23 01:56:17 generally Arduino uses GCC 2024-10-23 01:57:13 I personally would recommend against C++ for most things 2024-10-23 01:57:51 so would i 2024-10-23 01:59:00 I'm not a big fan of C++ either, generally preferring C 2024-10-23 01:59:14 but there are things for which C++ is the only viable option 2024-10-23 01:59:38 I used to think that :P 2024-10-23 02:10:55 well, like using the Arduino libraries 2024-10-23 07:56:54 I have like 1 hour just to write two lines of code 2024-10-23 07:57:03 and they do almost nothing xd 2024-10-23 07:57:31 vms14: the other day i was coding all day and only wrote 10 lines 2024-10-23 07:57:35 : str.allot here over 1+ allot place ; 2024-10-23 07:57:35 : make.item here >r c, str.allot r> ; 2024-10-23 07:58:11 it's just to: s" some description" 0 make.item 2024-10-23 07:58:20 where 0 is an id 2024-10-23 07:58:31 ah 2024-10-23 07:58:32 dave0 in my case is because I have to learn 2024-10-23 07:58:40 so you can refer to a string by id ? 2024-10-23 07:59:09 no, actually I want to create some sort of data structure, I suppose I should learn how to use gforth structs 2024-10-23 07:59:26 I just wanted an item with id + description 2024-10-23 07:59:32 ah i see 2024-10-23 07:59:43 and I want to add more data on them 2024-10-23 08:00:12 mainly I want to try with a simple point of sale system to practice 2024-10-23 08:00:56 so I need to add at least a price, and maybe the quantity of those items in stock 2024-10-23 08:01:19 but if I spend one hour just for that... xd 2024-10-23 08:01:42 anyways I really need to get used to forth, so it's worth 2024-10-23 08:02:16 I've spent most of the time trying to implement place, not knowing it existed 2024-10-23 08:03:29 I'm lucky because I'm masochist so I do not mind 2024-10-23 08:04:30 but it's being quite hard for me to use forth for now, even the most simple things 2024-10-23 08:11:36 also I should avoid r> >r as much as I could I guess 2024-10-23 08:35:20 how do I know the size of a float? 2024-10-23 08:36:31 I'm using f, to store it into that element, but now I do not know how to get the size to increment in order to get the element after it, which is the string 2024-10-23 08:41:05 oh there is "floats" 2024-10-23 08:44:18 make.item here >r c, f, str.allot r> ; : price 1+ f@ f. ; : id c@ ; : name 1+ 1 floats + count type ; 2024-10-23 08:46:22 float+ in this case 2024-10-23 14:36:26 vms14: I don't think there is a standard way to know the size of a float. It's almost certainly either four or eight bytes, but usually you will just know that, rather than "finding out." 2024-10-23 14:36:45 I suppose you could test one to see how many digits it appeared able to store, but that's kind of round-about. 2024-10-23 14:37:12 I'm not aware of a Forth "sizeof()." 2024-10-23 14:37:32 `float` is normally binary32 2024-10-23 14:37:50 in fact i'm unaware of any language where `float` doesn't refer to binary32 2024-10-23 14:38:04 Yeah. And double for 64 bits. 2024-10-23 14:38:08 aha 2024-10-23 14:38:15 i know of one exception for double 2024-10-23 14:38:32 in arduino c++, `double` means binary32 2024-10-23 14:38:33 I guess double might be a larger int in some systems. 2024-10-23 14:38:42 because their softfloat only does 32 bit 2024-10-23 14:38:49 i've never heard of double being an bigger int 2024-10-23 14:38:52 I usually just do floats as 64 bits and don't fuss with single precision floating point. 2024-10-23 14:39:17 single precision float is probably good enough 2024-10-23 14:39:20 I think I've seen that in older Forths that didn't have floating point at all. 2024-10-23 14:39:31 yeah 2024-10-23 14:39:39 you use rationals or fixeds 2024-10-23 14:39:41 I've just gotten spoiled over the years. Single precision is 6 or so digits, and I just want more than that. 2024-10-23 14:40:15 But you're right - for a lot of purposes it's fine. 2024-10-23 14:40:31 for a lot of purposes you want fixed point numbers 2024-10-23 14:40:49 because you know what range your numbers will be in statically 2024-10-23 14:40:53 Yeah, I'm pretty interested in how far fixed point can be taken and still be "convenient." 2024-10-23 14:41:04 like if you're making a coordinate system for a game 2024-10-23 14:41:11 you know how much precision you need 2024-10-23 14:41:18 And as Chuck was fond of pointing out you really can do anything with fixed point; you just have to pay attention to a few more details. 2024-10-23 14:41:19 and you know that you need the same precision everywhere 2024-10-23 14:41:38 float is attractive because you can just throw float at the problem and it works 2024-10-23 14:41:39 So in a way floating point is "lazy." 2024-10-23 14:41:41 until it doesn't 2024-10-23 14:41:48 Exactly - until it doesn't. 2024-10-23 14:41:50 :-) 2024-10-23 14:42:02 (cf. minecraft going weird when you get far from the world origin) 2024-10-23 21:20:38 KipIngram there is floats, the same way as cells, and float+ as cell+ 2024-10-23 21:20:57 that was what I wanted 2024-10-23 21:21:16 anyways I've spend two hours to write 20 lines that I've removed xd 2024-10-23 21:21:51 spent* 2024-10-23 21:33:17 I think I was doing forth the c way, using structures and alike 2024-10-23 21:42:45 i still don't understand what "the forth way" is in that context 2024-10-23 21:43:19 i've tried writing code with a bunch of : >foo >bar cell+ cell+ ; bullshit all over the place and it's nothing but an incomprehensible disaster 2024-10-23 21:47:29 well in my case I was emulating c structs by adding stuff on memory and making accessors and I wonder if it was a right choice 2024-10-23 21:48:00 at the end I thought I should be simplifying it, but do not really know how 2024-10-23 21:48:33 I was considering something as simple as : coffee 1.5e ; 2024-10-23 21:49:37 but I guess I would have to store them in memory with their name string 2024-10-23 21:50:54 what are you trying to do? 2024-10-23 21:51:19 a simple point of sale system to make orders and compute the price 2024-10-23 21:51:39 and about the c way, I say it because I was reading this https://www.reddit.com/r/Forth/s/fE9LqICsUP 2024-10-23 21:52:04 without even clicking it i bet i know what post that is 2024-10-23 21:52:35 yes, i've read this one several times 2024-10-23 21:52:38 and i don't get it 2024-10-23 21:53:29 vms14_: create does> may be of use to you here 2024-10-23 21:53:35 I only grasp that forth has better ways to abstract stuff than using structs 2024-10-23 21:54:15 although i also often find myself questioning the value of create does> 2024-10-23 21:54:47 I think is a powerful mechanism that I have to learn how to apply correctly 2024-10-23 21:55:46 i think its power is oversold tbh 2024-10-23 21:56:18 it's just a template generator 2024-10-23 21:58:04 but it can help you to make the syntax a little cleaner depending on your opinion. : coffee 1.5e price ; can become 1.5e for coffee 2024-10-23 21:58:46 or maybe 1.5e buys coffee :) 2024-10-23 23:04:57 vms14_: Don't avoid R> and R> 2024-10-23 23:05:14 R> and >R I mean 2024-10-23 23:05:45 I was thinking I would abuse them if I do not try to avoid them if I can 2024-10-23 23:06:59 I meant mainly that I should try to do it without it as long as I can and use them only when they make sense 2024-10-23 23:07:14 because if I abuse them it would be similar to using locals 2024-10-23 23:08:18 I mean they're basically PUSH and POP, I don't see why not to use them 2024-10-23 23:08:34 They make a lot of things easier 2024-10-23 23:09:07 Also I like putting an important address or value on top of return stack and recalling it throughout with R@ and finally R> 2024-10-23 23:09:32 yeah, that's why I fear if I do not restrain myself (since I have to learn to manipulate the stack) I would use them to avoid using rot over etc 2024-10-23 23:10:54 in your case you already are comfortable with the stack, but I need to practice 2024-10-23 23:10:54 I'm not that good with the stack 2024-10-23 23:11:30 not harder, but sometimes I can factor or find a better way to organize the elements and I would not find it if my way to go is to abuse r> and >r 2024-10-23 23:12:03 Sometimes I'll refactor forth and end up removing R> and >R 2024-10-23 23:12:12 I just know I'm lazy and I will reach for that every time 2024-10-23 23:12:21 Lazy is good IMO 2024-10-23 23:12:47 using them when it makes sense is cool, but I think I should not overuse them 2024-10-23 23:13:17 at least while I'm learning 2024-10-23 23:21:43 vms14: I think you're thinking right about it. >r and r> are there if you have to have them, but often a good clean design will let you avoid them. Maybe just take "needing them" as a clue that you might be able to do better if you think again. 2024-10-23 23:25:34 sometimes it makes sense, specially when you would be adding a lot of stack manipulation just to keep the elements when throwing one of them on the return stack will avoid all this trouble 2024-10-23 23:25:53 but it is so convenient that I know I will abuse it 2024-10-23 23:26:48 so at least I should question myself if I could avoid it when I'm going to use that 2024-10-23 23:36:50 I try to avoid them since they complicate factoring when for example you realize you actually do need to use the loop index but now you've pushed something into the R stack so you use J instead of I to step over them or some other nonsense 2024-10-23 23:42:21 I suppose I might be biased because I find it easy switching stuff like that around 2024-10-23 23:42:53 Only because I don't write good code first time, and refactor a lot 2024-10-23 23:43:29 Lots of older Forth code I respect definitely doesn't make any special effort to avoid pushing/popping to the return stack 2024-10-23 23:47:37 well "make it work" is a good way to get results 2024-10-23 23:48:00 at least you will not spend two hours to write 20 lines of code that you will remove later