<MrMobius>
crc, do you know how that kind of optimization is done?
<MrMobius>
like generally what I should google
jsoft has joined #forth
cheater has quit [Ping timeout: 258 seconds]
cheater has joined #forth
cheater has quit [Changing host]
cheater has joined #forth
cheater has quit [Client Quit]
cheater has joined #forth
reepca has quit [Ping timeout: 255 seconds]
reepca has joined #forth
reepca has quit [Remote host closed the connection]
reepca has joined #forth
reepca has quit [Remote host closed the connection]
tabemann has joined #forth
reepca has joined #forth
reepca has quit [Remote host closed the connection]
reepca has joined #forth
<crc>
MrMobius: no idea; I've not looked at the code for it
dave0 has quit [Quit: dave's not here]
reepca has quit [Ping timeout: 260 seconds]
<tabemann>
hey crc
<tp>
hey tabemann congrats on your Forth progress
<tabemann>
now IF THEN ELSE works
<tabemann>
*IF ELSE THEN
<tabemann>
I tried BEGIN AGAIN and... well... it repeats for a bit, then exits, leaving the RAM dictionary corrupted
<tabemann>
BEGIN UNTIL acts funny
<tabemann>
okay, this is stupid
<tabemann>
the code looks correct, but those just act really weirdly
<tabemann>
I thought for a sec that it was . that was the problem, so I tried : foo 0 begin 1 + dup 10 = until ; and it caused it to freeze
<tabemann>
my guess is it caused the stack to explode, causing a memfault
<rdrop-exit>
good morning Forthwrights :)
<tabemann>
hey rdrop-exit
<rdrop-exit>
hi tabemann
* tabemann
is busy debugging zeptoforth
<rdrop-exit>
cool
<tabemann>
it now compiles code to RAM and executes it, but loops are acting funny
<rdrop-exit>
funny how?
<tabemann>
I'm not sure how to describe it; I think it may actually be that something is goofing up the stack, which is interfering with the exit conditions for the loops
<rdrop-exit>
I see
<tabemann>
: baz 0 begin 1 + dup 10 = until ;
<tabemann>
followed by
<tabemann>
baz
<tabemann>
causes a hang for instance
<rdrop-exit>
insert a dup . so you can at least see the progress
<rdrop-exit>
I haven't done any Forthing for the past week or so, today I'm looking into the possibility of switching my host forth to x11
<tabemann>
making it graphical?
<rdrop-exit>
Not graphical, two main reasons are to get key release events and using a special font
<rdrop-exit>
I'm getting tired of the limitations of terminals when it comes to keyboard input
<rdrop-exit>
I figure x11 is my best bet for key release events that will work with any unix flavor
iyzsong has joined #forth
<tabemann>
ah
<rdrop-exit>
I haven't done anything with x11 since the 80s, I'm dedicating this afternoon to a refresher
<tabemann>
I've never done anything with raw x11
<tabemann>
from what I've heard it's best left alone
<tabemann>
I've done stuff with GTK+ and OpenGL
<tabemann>
old-school OpenGL, not the modern-day fancy schmancy GPU-centric OpenGL of today
<rdrop-exit>
X has always been a mess, I'm not sure if there's a viable alternative that will meet my needs across the different unices (including MacOS)
<tabemann>
I'd say find a toolkit like GTK+ that fits your needs, write a frontend using it, and communicate with that frontend with sockets or pipes or like to separate your Forth code from the language that the frontend would have to be written in (e.g. C for instance)
<rdrop-exit>
I was planning on just writing to the wire protocol
<tabemann>
that is another option
<tabemann>
except that from what I gather dealing with X11 in the raw is a pain in the ass
<tabemann>
thirty-something years of history layered on itself
<rdrop-exit>
I used the wire protocol in a project in the 80s, no longer have the code though
<rdrop-exit>
I also have an idea for a custom ASCII font I'd like to use
<rdrop-exit>
two birds with one stone I'm hoping
<rdrop-exit>
X is definitely long in the tooth
<rdrop-exit>
If anyone knows of an alternative that works on Unices and Macs, I'd appreciate a heads up
<tabemann>
GTK+/Pango/Cairo is my go-to if I ever need to write 2D GUI code
<tabemann>
I'd write a terminal with those in C, then talk to my Forth code with said terminal over some wire protocol
<tabemann>
actually, it need not be C
<tabemann>
my last two graphical projects used those and were written in Haskell (aside from my sixel work, which was in Forth)
<tabemann>
(I am using an IRC client right now written in Haskell using GTK+)
<rdrop-exit>
I may be wrong, but I don't think I need GTK+
<tabemann>
to me the main factor is that GTK+ is pain-free compared with raw X11
<rdrop-exit>
you're right I'm sure
<rdrop-exit>
My initial googling tells me x11 is the common denominator between the different unices, although on Mac it's an optional add on to Quartz
<tp>
heyhey
<rdrop-exit>
hello Master Forth Technician (tm)!
<tp>
rdrop-exit, there is a new x windowing system called 'wayland'
<rdrop-exit>
or is it Forth Master Technician (tm)? I forget :)
<tp>
i think it's made by ex windows x haters but I dont know
<rdrop-exit>
thanks tp, will check it out
<tp>
just 'natural born electronics tech' will do :)
<tabemann>
does anyone actually use wayland
<rdrop-exit>
ok :)
<tabemann>
I think they haven't yet decided how to do screenshots
<tp>
wayland is supposed to replace all the layers of X with a nice unified and homogeneous system
<tabemann>
because they're confused about how to permission processes so they're allowed to do screenshots
<tabemann>
also there is no remote wayland either
<tabemann>
rather you're supposed to use something like RDP for remote
<tp>
tabemann, yeah, i bet it's useless compared to the X we all use everyday to good effect
<tp>
exactly, thats why I think it's a Windows users system
<rdrop-exit>
The thing I like about X is that there's a wire protocol spec, so you don't have to deal with libraries
<tp>
X windows without remote X would be utterly useless to me
<tabemann>
I like it how they from on high just decided that This was The replacement for what we've been relying on for the last thirty-odd years
<tp>
I imagine Linux will become more and more windows like as more and more windows people have a say
<rdrop-exit>
kids always think they now better, hindsight is always 20/20
<tabemann>
ugh
<tp>
in the same way that C users try and make Forth look like C, windows users try and make Linux more like windows
<tabemann>
like systemd
<tp>
rdrop-exit, so true, and it's driven by those kids
<tp>
tabemann, yes
<Kumool>
systemd is not a bad idea though, it does speedup boot time
<tabemann>
damn you Poettering
<Kumool>
i'll take anything as long as its faster
<tp>
Kumool, thats fine for a car radio I guess
<tabemann>
there were other alternatives they could have taken
<tabemann>
like parallel init
<tp>
windows users typically shut down their PC/laptop after use, Unix users typically leave their running 24/7
<Kumool>
well. shit, I'm gonna shut down my laptop right now
<Kumool>
and am running linux
<tp>
and in the latter case, bootup time is utterly irrelevant
<tp>
I never shut this box down
<tp>
it's uptime equals exactly the local power company outages
<Kumool>
yeah but that's because you live in a first world country that's not constantly having blackouts
<rdrop-exit>
I only shut down my mac a couple times a year
<Kumool>
also I doubt this is a windows thing, because windows 10 takes like 10 minutes of booting for me
<Kumool>
probably why its windows 10!
<tp>
Kumool, I like in rural new south wales, the power here isnt very reliable, tho probably better than yours
<rdrop-exit>
except for watching videos and surfing, I mostly use a terminal
<Kumool>
tp: oh is your country trying desperately to sell and privatize its power plants too?
<tp>
Kumool, they have sold them all years ago
<tp>
after which power costs went up and up ...
<Kumool>
:S
<Kumool>
power generation is one of those things that should not be privatized
<tp>
and now the power companies are in a death spirel
<tp>
spiral
<tp>
Kumool, oh I agree 100%
<tp>
the Australian govt didnt ask for permission, they just did it
<rdrop-exit>
I don't think there's a Wayland for mac yet
<Kumool>
:(
<tp>
solar power really took off here with massive govt subsidies and so the electricity companies struggle, raising prices to survive as more and more people go to solar
<Kumool>
I better go, 1am now, bb
<rdrop-exit>
unless my google-fu is lacking
<tp>
Kumool, cya!
<Kumool>
:)
<rdrop-exit>
ciao Kumool
<tp>
rdrop-exit, Im sure you can buy it for mac, just $300 plus yearly subscriptions ;)
<rdrop-exit>
I've never bought any software for mac
<rdrop-exit>
You're thinking Windows
<rdrop-exit>
Mac is basically a BSD underneath all the GUI stuff
<tp>
Sergey Bugaev @bugaevc@mastodon.technology
<tp>
I have ported Wayland (that is libwayland-client, libwayland-server, libwayland-cursor, and wayland-scanner) from Linux to Darwin (Mac OS X 10.6 Snow Leopard to be exact).
<tp>
Wayland relies on many little things that are specific to Linux (examples: epoll, timerfd, SO_PEERCRED, <linux/input-event-codes.h>), so I had to try and come up with ways to make it work without them.
<tp>
when the binary hits the metal, it's the same
<tp>
yeah, typical of Forth, everyone has their own methods and names that work for them
<tp>
you can do it in C like this if you like "GPIOA->AFR[0] |= (0x3 << (4*1)) + (0x3 << (4*2)); //enable AF3 for PA1 and PA2"
<rdrop-exit>
yes, the difference usually comes down to what you leave up to the optimizer to figure out
<tp>
which the C people seem to think is self explanatory
<tp>
ahh, good point
<rdrop-exit>
C style varies a lot too I guess
<tp>
yes, especially historically
<tp>
Ive been working thru a Cortex-m0 'touch' peripheral config
<tp>
you know, where it has a copper pad on a pcb, about the size of a fingertip, and the pad is electrically isolated under plastic or glass etc
<tp>
a finger touch on the pad is then detected
<rdrop-exit>
what are you using it for?
<tp>
the code I followed is naturally in C, by STM around 2010
<tp>
as a alternative to a button for a project
<rdrop-exit>
interesting
<tp>
and in those days, STM defined 'bits' like this "TSC_CR_PGPSC_2" and "TSC_CR_PGPSC_0" right up to "TSC_CR_PGPSC_31" I guess
<rdrop-exit>
seems redundant
<tp>
yeah
<tp>
then in the next C revision they stared using the "TSC->IOHCR &= ~(0x06);" stuff
<tp>
or maybe "<<" etc
<tp>
whats crazy is that now, if one looks up the STM code example for how to use the 'touch' peripheral, there is no code
<tp>
it's all pictures of GUI windows, HAL etc
<rdrop-exit>
the reason they're using the and complement idiom is that it doesn't knowing how wide machine word is
<rdrop-exit>
i.e. ~(0x06) generates a mask with bits 2 and 3 off and all other bits on regardless of the machine word width you're dealing with
<rdrop-exit>
sorry I meant bits 1 and 2 off
<tp>
i can see why Boeings ISS astronaut capsule failed to make orbit now "we used the wrong version of HAL in our STM32CUBE ide, and the clock got the wrong data"
<tp>
in ceneral when I read the embedded forums, I see two things 1) a universal love for and godlike respect for The C programming Language
<tp>
2) users struggling with basic operations on bitfields
nonlinear has quit [Ping timeout: 260 seconds]
<tp>
3) users with almost zero hardware experience
<tp>
oh and 4) even tho none of them have ever used Forth, they think they know all about it and as a result avoid it like the plague
<rdrop-exit>
TSC->IOHCR &= -7
<tp>
Forth is 'read only', 'untyped', 'ancient', 'unsuitable for teams' and 'arcane' didn't you know ?
<rdrop-exit>
I tend to see it the other way around, they are unsuitable for forth ;-)
<tp>
hahaha
<tp>
me too :)
<tp>
I did mention that after 58 days a C user managed to provide partial functionality of my Forth binary, but it's very cut down.
<tp>
he reads the chip registers, makes a conclusion, then outputs it in a USB 'identification' string when the device is queried
<tp>
it's pretty clever I admit, but the actual source requires quite a few libraries
<tp>
and it has no 'fancy menu' like mine ;-)
<rdrop-exit>
there was a short window of time when C interpreters were popular, the users of such interpreters were more likely to understand the benefits of a variable level interactive system such as Forth
<rdrop-exit>
but then C got complicated and C interpreters died out
<rdrop-exit>
late 70s, early 80s timeframe
<rdrop-exit>
is when the C interpreters were popular IIRC
<tp>
i missed all that somehow
<tp>
probably too busy being a newlywed and having kids
<rdrop-exit>
I probably have some old magazines with articles on them, maybe Computer Language or early Dr. Dobbs
<rdrop-exit>
one of them was called C-terp IIRC
<tp>
one advantage is he doesnt need a serial terminal, but then Im always hearing C embedded people explaining how they use print statements on a serial terminal to debug their code
WickedShell has quit [Remote host closed the connection]
nonlinear has quit [Ping timeout: 260 seconds]
gravicappa has quit [Remote host closed the connection]
dys has joined #forth
jsoft has quit [Ping timeout: 265 seconds]
nonlinear has joined #forth
nonlinear has quit [Ping timeout: 240 seconds]
xek__ has joined #forth
rdrop-exit has quit [Quit: Lost terminal]
jsoft has joined #forth
jsoft has quit [Ping timeout: 255 seconds]
iyzsong has quit [Remote host closed the connection]
iyzsong has joined #forth
proteus-guy has joined #forth
iyzsong has quit [Ping timeout: 245 seconds]
dave0 has joined #forth
dave0 has quit [Quit: dave's not here]
gravicappa has joined #forth
proteus-guy has quit [Ping timeout: 240 seconds]
Lord_Nightmare is now known as LordNLptp
LordNLptp is now known as LordNAway
LordNAway is now known as Lord_Nightmare
Lord_Nightmare is now known as Lord_Nightmare2
Lord_Nightmare2 is now known as Lord_Nightmare
dddddd has joined #forth
tabemann has quit [Ping timeout: 240 seconds]
proteus-guy has joined #forth
cheater has quit [Ping timeout: 260 seconds]
cheater has joined #forth
cheater has quit [Ping timeout: 260 seconds]
cheater has joined #forth
cheater has quit [Ping timeout: 265 seconds]
cheater has joined #forth
dys has quit [Ping timeout: 248 seconds]
X-Scale` has joined #forth
<veltas>
>Forth is 'read only', 'untyped', 'ancient', 'unsuitable for teams' and 'arcane' didn't you know ?
<veltas>
I hear those same excuses for almost every tool I know that actually works well and isn't bloated
<veltas>
I have to be honest though I would not trust most of the programmers I know to write Forth, there is such a thing as 'read-only' code and most such code I've read is in C, and you can achieve it in any language
X-Scale has quit [Ping timeout: 265 seconds]
X-Scale` is now known as X-Scale
_whitelogger has joined #forth
dave0 has joined #forth
<dzho>
don't we mean "write only"?
<ecraven>
I was just pondering what read-only code is... APL? because you cannot type it? :P
proteus-guy has quit [Ping timeout: 260 seconds]
WickedShell has joined #forth
<crc>
my code isn't write only (or read only) and has normally plenty of comments
gravicappa has quit [Ping timeout: 265 seconds]
xek__ has quit [Ping timeout: 258 seconds]
<tp>
veltas, youre right, I misquoted, Forth is normally accused of being "write only"
<tp>
dzho, oops also meant yourself and ecraven, my mistake, I did mean to type "write only". Crc your source is totally readable along with your own literate source extraction tool and documentation
<veltas>
Well read-only usually means unchangeable so it works as well
<tp>
just a brain fart on my part
<veltas>
It made sense to me anywya
<tp>
thats Forth people for ya, they can understand most things :)
<tp>
i was just ranting after transcribing some C examples to Forth
<veltas>
Right
<veltas>
I skimmed those logs it was an interesting rant
<veltas>
I have opinions about C code too ;)
<veltas>
But not a strong opinion on Forth since I am brand new to it
<tp>
oh!
<tp>
just the fact that you're looking at Forth puts you in a quite exclusive group
<veltas>
I have seen it mentioned multiple times over the years and it seemed interesting, I didn't learn anything other than it can have very minimal implementations, is stack-based, reverse-polish, and can extend/rewrite itself
<veltas>
The last few weeks I suddenly got the inspiration to go learn it from Starting FORTH and I have been enjoying the experience
<veltas>
It is highly unconventional but still very capable and worth trying just for that reason alone, most programming languages are too similar
<tp>
starting Forth is quite old now and some of the examples wont work on modern Forths, so don't immediately assume it's you when that happens
<veltas>
Yeah I get that
<veltas>
The beautiful thing about it is that the implementation is so simple in Starting FORTH that I can kind of tell how it worked on their system, and can guess why it doesn't always work now
<tp>
I guess "it can have very minimal implementations, is stack-based, reverse-polish, and can extend/rewrite itself" are some of the very important points, but one of the main ones is 'its interactive'
<veltas>
Like 'forget' not working on gforth makes sense that the dictionary would be a bit more sophisticated now (although it needn't be)
<veltas>
tp: Well that was my impression before learning it
<tp>
Im a poor fit in this channel because I'm a electronics technician and not a programmer. I only use Forth on small embedded systems
<tp>
and in that field, interactivity is everything
<tp>
yet the points you mentioned above cant be stressed enough in my opinion also
<veltas>
I work with electrical engineers every day
<tp>
the ability to rewrite itself is a MASSIVE thing shared only with LISP
<tp>
aha
<veltas>
It's not as novel anymore, LISP is the other 'old' language that really took this to the limit, and Haskell maybe since Haskell is quite old and can extend its syntax
<tp>
the Forth I use is very small, fits in 19kB and runs on ARM cortex-M microprocessors
<veltas>
The impressive thing about Forth is how it can rewrite itself *and* it's really tiny
<veltas>
I believe I have spent a lot of time on a Cortex-M microprocessor
<tp>
haskep could do something like rewrite itself so one equals 2 in such a way that "1 + 1 = 3 " ?
<tp>
Haskel I mean
<tp>
veltas, really ? youre familiar with cortex-m, awesome
<veltas>
Not too familiar with the details
<tp>
I mainly use cortex-m0 but have done some stuff lately with cortex-m3
<veltas>
Just did a lot of work on a real-time system on a smartfusion
<veltas>
SmartFusion was Cortex-M3 I think
<tp>
yeah, m0 is very small but ideal for what I do
<tp>
in my tests, m3 is usually 3 - 5 times faster than m0, not that it matters for me
<veltas>
Hmm it didn't matter for me either probably
<tp>
most of the bigger dev environments need at least M3 and bigger
<tp>
but Im at the really small end, tho I'd like a M0 with a couple of MB of flash just to fit all the Forth dev aids I have built
<veltas>
tp: Was that a question about Haskell? I missed that
<veltas>
I'm not sure honestly, I don't know Haskell well
<tp>
yeah it was
<veltas>
But you can add operators and define e.g. precedence, and I have seen some weird stuff in Haskell that implies a lot of control over syntax
<tp>
I dont know Haskell at all
<tp>
it sounds very complicated, and I try and avoid complicated things, hence my love for Forth (not that Forth isnt complicated in areas)
<veltas>
Yes that is what I was saying earlier really by saying Forth was minimal
<tp>
I started learning Forth in 2014 myself, Im slow but steady
<veltas>
Because if something is really tiny then it can only be so complicated (well, that logic is somewhat true anyway)
<tp>
after 6 years I have a basic understanding I feel
<tp>
I used to use C, but nowdays it's all Forth for me
<veltas>
I have been enjoying Forth a lot, I hope I do keep using it
<tp>
but when learning about how to configure a unfamiliar Cortex-m0 peripheral I have to wade thru C examples
<tp>
if youve just started and youre liking it, you may now be on a journey that will last decades :)
<tp>
sadly almost all of the STMicro tech docs only give C examples as tho C is the 'language of microprocessors'
<veltas>
Hmm
<tp>
and that supplies a lot of the ammunition for my rants
<veltas>
C is the language of a PDP-11
<tp>
I mean it's bad enough to read examples that dont actually explain a particular C syntax, such as "TSC_CR_PGPSC_2"
<tp>
I have nothing against C, I know it and I like it but for me thesedays it's just too complex and limited for small embedded in comparison to Forth
<veltas>
It is an alright 'portable assembler' and general systems language in my opinion.
<veltas>
Probably the biggest issue with C is the standard
<tp>
the "TSC_CR_PGPSC_2" is from a 2014 tech document example, and STMicro have gone thru about 4 different systems since then in their search for the one easy method ... theyre still trying
<tp>
yeah I agree, on larger systems C is great and very portable
<veltas>
Do you know K&R C at all?
<veltas>
I mean pre-standard C
<tp>
I always thought Id only use Perl,Tk/tcl, and C on my PC when writing apps, but of late Ive begun using Forth thanks to CRC's "retro"
<tp>
yeah, thats what I started with when I learnt C in 1997
<tp>
I still have that blue book
<veltas>
I don't mean the book
<veltas>
I mean the style of C that was supported and defined in the first edition of that book
<tp>
oh, in that case I'm probably not familiar
<veltas>
It is pre-1989 standard
<veltas>
Before e.g. prototypes were defined
<veltas>
If you can find the first edition of K&R online (it is not hard on google) then have a look, very interesting read
<veltas>
C used to be much less verbose, and you can see how they were so productive with it in the early days
<veltas>
We took a long time to come back to that kind of syntax now in languages with type inference, in the 70s they just had very weak types and they managed fine
<tp>
ahh!
<tp>
I pretty much just learnt enough C to use in simple embedded programs
<veltas>
One of the reasons I like Forth is it reminds me of that ... even in Forth 2012
<tp>
thats a excellent point you raise
<tp>
'they managed fine'
<tp>
consider 1969 ? the USA landed men on mars and their 'computer' was all discrete components, the assembly was written by one man
<tp>
it had zero bugs
<veltas>
Was that the one they had to debug and modify live to work around some issue (hardware issue maybe, if the code had 0 bugs)?
<tp>
they had problems, serious ones as they were landing, but they were hardware ones, the computer and software was bug free and even allowed a workaround for the most serious hardware bug
<tp>
thats the one
<veltas>
Yeah I read about that, very cool
<tp>
and that was 1969
<veltas>
I think it was in an article about the nature of 'real time' programming
<tp>
yet now in 2020, Boeing fail to get a capsule into orbit because of a 'clock sync error'
<veltas>
The program was one big continuous loop, simple flat state, so it was real time for free
<veltas>
Honestly Boeing's biggest fail is the decision that their products don't need to be owned and maintained by dedicated teams
<tp>
the lander problem was caused by a faulty switch
<veltas>
And that you can just purchase work from anyone based on management's requirements and expect good code to come out of it
<veltas>
They have dropped all sense and rely entirely on the 'process', it turns out the process is not good enough
<veltas>
on its own
<tp>
and that switch wanted to cause a abort which meant rocketing away from moon while attempting to land
<tp>
no one even new what the error code meant, only the one guy who wrote it all
<tp>
knew
<veltas>
If I wrote 'requirements' for my garden and then hired different people every day to come and 'implement' the maintainance for my garden derived from those high-level requirements they probably would mess it up and leave it horribly inconsistant and ugly
<tp>
and he quickly designed a workaround to prevent the switch aborting everything
<tp>
yeah, I can see that
<veltas>
If they can't even get that right then how are they meant to write mission critical software
<tp>
well Boeing has had a number of fatal issues of late so it seems to me that modern software development is going backwards
<veltas>
I think the issue is more to do with corporatism
<tp>
good point
<tp>
Im a one man band, my own development is easy and straightforward in Forth, life is easy
<tp>
and thats the thing with forth, no one uses my system because I built it for myself
<tp>
no one wants to use it either, other Forth users have their own systems, and theyre all different
<tp>
and theyre all different because Forth is so malleable
<tp>
we make what we want
<tp>
if I really want 1 to actually be 2, with Forth I can
<veltas>
Forth users are all too busy talking to the computer to bother talking to other Forth users apparantly
<veltas>
Can you make 1 + 1 = 3?
<tp>
Forth users are the most independent free thinkers Ive ever met
<tp>
sure
<veltas>
You would have to redefine +, not '1' to do that, right?
<tp>
if I use fixed point :)
<veltas>
Good point
<veltas>
Well also depending on the size of your floats but yes
<veltas>
Wait ... is that right?
<tp>
I dont use floating point, only fixed point
<veltas>
You would still need to redefine + because it's for single word integers
<tp>
youre also right, there are multiple ways to do it
<veltas>
Hmmm
<tp>
+ also works with fixed point
<veltas>
Forth has just one thing to say about this