[m-users.] String comparison when compiling to C

Sean Charles (emacstheviking) objitsu at gmail.com
Sat Aug 24 18:44:40 AEST 2024


> 
> Given that background, I will be *fascinated* to see what a strongly
> typed Forth looks like.

Me too    :D

The general idea is that instead of one stack per type (nightmarish), a single data stack holds all the guff as it happens, then, I have mulled over either:

1. Reworking "{" and "}" so that you have to specify the types, eg { val1:int val2:str } sort of thing

OR

2. Introduce a word, SIGNATURE (or SIG) so that you can specify the type signature i.e the stack expectation when the word gets called, it will then, using (1) above as the example, 

        "int uint8 str" SIGNATURE [WordName]

  * ensure there are two items on the stack
  * ensure the types are as expected

Something like that, for now I am just getting the basics down, I've done IF/ELSE/THEN(ENDIF), DO...LOOP to see how control words pan out, nicely, as it happens. As I am not a real CPU, the internal representation of a word is a tree containing the various VM opcodes, so an if then is

    if_then(VmTrue, VmFalse)

so, if TOS is 'true' I execute the first code block, else the second.

Yes, I can't wait to see what it looks like either, I might be tempted to make a YT video? Been putting it off for years...

Sean.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20240824/95e350d8/attachment.html>


More information about the users mailing list