cognate
                                
                                
                                
                                    cognate copied to clipboard
                            
                            
                            
                        Documentation for Cognate words??
There isn't any documentation on each builtin word, and so for the ones that take and/or return blocks, the semantics are very confusing. Case in particular. What are the semantics of that, and everything else? Writing it as Forth stack-effect diagrams or just some example code would help.
i can try to help with documentation, if only the admins will want to
I'm currently at university so I'm a tad busy, but I'll be able to write some more documentation once the term finishes - as well as actually finish the compiler rewrite!
Also, the behaviour of some combinators such as Case might change in future, as the current iteration is very difficult to optimise and can be a bit confusing.
I might use the "old" (i.e. current) behavior of Case in TEHSSL, because then you don't have to write ( ) around a function that is comprised entirely of a large Case switch.
Well that part of the behavior I'm keeping. The bit I'm concerned about is the fact that you can do this, maxing blocks and value types.
Def F as
   Case 1 is 2
   Case (> 3) is (+ 1)
   Case -1 is (+ 3)
   otherwise 5;
The problem with this being that it has to do dynamic dispatch on the type passed to it, and it's very difficult to generate good code from this.
Well that part of the behavior I'm keeping. The but I'm concerned about is the fact that you can do this, maxing blocks and value types.
Def F as
   Case 1 is 2
   Case (> 3) is (+ 1)
   Case -1 is (+ 3)
   otherwise 5;
The problem with this being that it has to do dynamic dispatch on the type passed to it, and it's very difficult to generate good code from this.
Perhaps a better solution would be to have variants of Case that take differing combinations of blocks and values.
This is uglier but generates much better code, since types are more deterministic:
Def F as
   Case (== 2) then (3 Drop)
   Case (> 3) then (+ 1)
   Case (== -1) then (+ 3)
   otherwise (5 Drop);
                                    
                                    
                                    
                                
Unfortunately I can't find any other languages that implement anything like the Case combinator here (closest is probably Factor) so I haven't got much to work with.