On 4/21/2017 11:53 PM,
hughag...@gmail.com wrote:
> On Friday, April 21, 2017 at 9:12:47 PM UTC-7, Cecil - k5nwa wrote:
>> Go for creating a Forth VM is off the table for now, Go flunked my test
>> of pointers to create stacks.
>>
>> You cannot use a pointer to go through an array of data by using
>> increment, and decrement operation on the pointer like you can in C.
>> Pointers in Go are basically used to pass data around without copying it
>> but you can't use pointer arithmetic in any fashion including increment
>> and decrement operators.
>>
>> In C it's easy to create a stack by having a pointer to an array of
>> data, read the data and increment the pointer is a pop, increment the
>> pointer and write the data is a push. That can be very efficient as
>> increment or decrement of a pointer is a fast instruction. In Go I can
>> do it by incrementing or decrementing an index into an array but the
>> address calculations are not as fast, it could be close to the same but
>> I can't see the generated code to be able to tell one way or the other.
>> I can see their point of limiting pointers for safety reasons, in C one
>> needs to add code to check and make sure the pointers stay pointing
>> within the array but the same applies to using an array index, one needs
>> to make sure the index is valid.
>
> I wouldn't dismiss Go because of this --- I would expect that incrementing and decrementing an array index would be almost as fast as incrementing and decrementing a pointer --- the difference is like one or two extra instructions, but the instructions may parallelize so they don't actually take any extra time.
>
> This is premature optimization!
>
That why I wish I could see the generated code, it might not make a
difference after optimization but I don't have a way of finding out
right now,
> Also, a Forth VM written in any high-level language is going to be significantly slower than generating machine-code with an STC Forth --- so the difference between C and Go in speed doesn't matter --- so long as you don't think that Perl (John Passaniti) or Python (Juergen Pintaske) is a good language to write a Forth VM in, you should get reasonable speed.
>
>> So its back to using C for now and finish what I started, I'm pretty
>> close anyway with the C code to start testing the VM.
>
> C has a lot of problems of its own --- Anton Ertl complains about this continually --- I wouldn't use C.
There are few system languages available that generate decent code,
C/C++, Pascal, Go, Oberon, and Forth, other higher level languages are
way too slow and require massive resources. I own several commercial
copies of C/C++, and some old copies of Delphi, and various Forth
Systems including Swift, and MPE VFX. C and Forth are the most viable
and maybe Go. I like Delphi I dug it out and installed it but my old
versions had problems with Windows 10 so I then started looking at Go,
C++ is not under consideration. I might try loading Delphi in a Windows
7 Virtual PC and see how that works out tomorrow. Too many choices can
be a major problem.
>
> I am learning Go right now. I hadn't considered writing a Forth VM in Go, because I think FASM is better --- I had just been thinking of Go as a practical language for writing programs --- Python is very popular, but it is also very slowwwwww, so Go may eventually replace it as the most supported language available (supported in the sense of having code-libraries).
I want to use Go for other purposes and I will but it would have been
interesting to use this a learning experience, I might still do it
anyway after I finish the C code so I have something to compare it
against. The whole purpose of this is to have it be easy to move to a
new PC without having to deal with a different assembler for each processor.
>
> Forth is just a weird hobby. It is soooooo dead! There are fewer than 20 ANS-Forth programmers in the world, and none of them are writing programs, but instead they spend their time on the Forth-200x mailing list pretending to be leaders. There are fewer than 200 Forth programmers in the world, but most of them are like Ilya Tarasov in that they write their own non-standard Forth system and have only a handful of users, and (unlike Ilya TArasov) they stay away from comp.lang.forth because it is annoying to be attacked by Elizabeth Rather's sycophants who call them stupid and tell lies about them.
You read any of the articles by Charles Moore or his discussions and he
sees Forth as a set of tools that are customized to the needs of the
hour, I don't see him nailed to a Standard, he does as he pleases to get
the job done. That is how I feel about Forth myself, it's nice to have a
standard but it better be a good one or I will ignore it. I'm ignoring
it for the most part, I can't stand all this ambiguity in it, I like
simplicity.
>
> I should learn a popular language such as Go or Python that people actually use --- nobody considers me to be a programmer right now --- my Forth experience doesn't count for anything in the real world.
>
Poor baby, not being loved. I firmly believe that the only one that can
make one happy is oneself, others can help, but most are in the way.
Python is handy for small programs that can afford to run slow, Go looks
interesting it is fast, and has nice libraries, I would learn both, I
intend to.
--
Cecil - k5nwa