00:31:37
##forth
<xentrac>
vms14: well, another simple example is my : field create , does> @ + ; 0 field name 20 field phone from above
00:32:20
##forth
<xentrac>
that defines field as a defining word which adds a number to the number on the top of the stack
00:32:46
##forth
<xentrac>
which might be an address, for example
00:33:13
##forth
<vms14>
I see different ways to create fields in this book
00:33:15
##forth
<xentrac>
that is designed for john-doe phone rather than phone john-doe
00:33:23
##forth
<vms14>
and saw something cool in a way
00:34:36
##forth
<xentrac>
essentially that's like : name 0 + ; : phone 20 + ; and in general you can use create does> to create a family of words that follow a pattern like that
00:35:52
##forth
<xentrac>
same as a closure in languages like Python, Perl, or JS, but with explicit rather than implicit capture
00:35:56
##forth
<vms14>
but the : and ; cannot be seen in the code examples
00:37:17
##forth
<vms14>
that field example in the book autogrows total.size so at the end the object knows its size once all the fields are defined
00:37:21
##forth
<xentrac>
that's a nice way of doing it. -{ and }- are delimiting a "with" block
00:37:49
##forth
<vms14>
14 field name
00:38:28
##forth
<xentrac>
right
00:39:49
##forth
<vms14>
the book is on the archive btw so it should be free
00:40:27
##forth
<xentrac>
what's the book called?
00:43:10
##forth
<xentrac>
aha
01:26:08
##forth
<forthBot>
Environment for cleobuline inactive, freeing...
05:22:52
##forth
<MrMobius>
I decided to go with circular stacks for this calculator forth since it absolutely should never crash. im wondering now though if it makes sense to allocate extra space at either end of the stack and only check for out of bounds every 5 or 10 primitives
05:23:09
##forth
<MrMobius>
since I decided not to have PICK or ROLL
05:23:41
##forth
<MrMobius>
then just allocate enough extra memory for the worst case scenario where all 10 primitives push or pop the max number of elements
09:42:10
##forth
<veltas>
I've realised 16-bit Forths are easy to do on x86-32 and x86-64 because the high part of registers is unaffected by 16-bit operations, so you can just reserve a page aligned to 2^16 and keep the address in high 48-bits of all registers, and then 64-bit registers work immediately for memory accesses in the 16-bit memory area
09:42:52
##forth
<veltas>
I'm working on a 16-bit FORTH-79, will see if it gets anywhere but the core is smaller/simpler than other standards so should be alright
09:43:25
##forth
<veltas>
16-bit because FORTH-79 assumes 16-bit cells. That way I can try running FORTH-79 programs in the wild
09:43:38
##forth
<veltas>
And native so I can use graphics etc potentially
09:44:08
##forth
<veltas>
So this will be my X konilo
09:45:32
##forth
<veltas>
I'll probably have some words for accessing 48-bit addresses and interoperating with C libraries, I/O, provide blocks access to larger amounts of RAM than 64K etc
14:02:26
##forth
<xentrac>
veltas: ingenious!
14:03:30
##forth
<xentrac>
so you get zero-overhead address offsetting
15:06:08
##forth
<veltas>
Just stumbled upon it while playing with the assembly, saves me a register for some mental overhead
15:06:47
##forth
<veltas>
Should hopefully make instructions faster, will definitely make them smaller
15:11:06
##forth
<xentrac>
it's too bad it's pretty x86 specific
15:42:37
##forth
<MrMobius>
that's a pretty slick idea actually
15:43:17
##forth
<MrMobius>
not to be a naysayer but I would also profile. apparently part of why loading a 32 bit register on x86 clears the top bits is to prevent a dependency that slows down the hardware magic
15:53:39
##forth
<veltas>
Yeah I agree it might be slower than it seems
15:53:45
##forth
<veltas>
I had considered that
15:54:22
##forth
<veltas>
Apparently misaligned access can be *faster* on new x86
15:54:26
##forth
<veltas>
I found out
15:59:53
##forth
<MrMobius>
neat
16:55:33
##forth
<veltas>
I'll be profiling on my older Core 2 Mobile processor, which I believe will have a more severe penalty
16:56:12
##forth
<veltas>
If I have some code to test and a profile script I guess I can share in here and someone with a 'real computer' can try
17:40:22
##forth
<xentrac>
weird, why would misaligned access be faster?
17:42:55
##forth
<MrMobius>
hehe
20:06:15
##forth
<vms14>
KipIngram I keep thinking about your temporary words
20:06:59
##forth
<vms14>
you mentioned something like having words that disappear but you can use them to compose other words
20:08:22
##forth
<vms14>
I guess I should try something similar
20:09:44
##forth
<vms14>
like allowing nested : and make those temporary for compiling purposes
21:51:58
##forth
<cleobuline>
forthBot: : test 100000 0 DO I DROP LOOP ;
21:55:35
##forth
<cleobuline>
forthBot: MICRO test MICRO SWAP -
21:55:40
##forth
<cleobuline>
forthBot: .
21:55:40
##forth
<forthBot>
4265
22:21:39
##forth
<veltas>
If you follow that thread upwards there's a little more about this
22:22:35
##forth
<veltas>
So vague rumours but x86 is so complicated now I wouldn't be surprised if there was a very contrived situation where it's faster
22:23:07
##forth
<veltas>
FUZxxl is a regular in ##asm so you can always ask them there
22:49:56
##forth
<xentrac>
thanks!
23:21:39
##forth
<vms14>
I have created this if
23:21:43
##forth
<vms14>
if 0 then oh else meh end
23:22:08
##forth
<vms14>
the test code is between if and then
23:22:59
##forth
<vms14>
so you can put arbitrary code if 1 2 + 3 = then ... end
23:23:48
##forth
<vms14>
I saw in the book I was mentioning the other day that the author hates the then word in forth
23:24:00
##forth
<vms14>
and changes it for endif using forth itself
23:25:48
##forth
<vms14>
"Finally, I detest the use of THEN in the IF...ELSE...THEN control structure so vehemently that I refuse to publish code containing it."
23:26:30
##forth
<vms14>
: ENDIF [COMPILE] THEN ; IMMEDIATE
23:27:00
##forth
<vms14>
so I stole both and created a new if from them
23:27:13
##forth
<vms14>
it makes more sense in my mind
23:28:24
##forth
<vms14>
if you leave it like: if then ... end it behaves like in forth, taking one element from the stack to test for truth
23:29:24
##forth
<vms14>
at the end is the usual if of other languages using rpn
23:55:40
##forth
<forthBot>
Environment for cleobuline inactive, freeing...