Reply by rickman June 22, 20172017-06-22
David Brown wrote on 6/22/2017 5:24 AM:
> On 21/06/17 20:00, Stephen Pelc wrote: >> On Wed, 21 Jun 2017 19:16:08 +0200, David Brown >> <david.brown@hesbynett.no> wrote: >> >>> On 21/06/17 17:50, Stephen Pelc wrote: >>>> On Mon, 19 Jun 2017 00:47:31 +0200, David Brown >>>> <david.brown@hesbynett.no> wrote: >>>> >>>>> You are still tied to blocks of 16x64 characters. >>>> >>>> I haven't used blocks for decades. You are deeply misinformed. >>>> >>> >>> That was from information from the GA144 website. >> >> You are still deeply misinformed. Surely it's up to you to >> do your own research rather than blather "fake news" across >> the interwires. </g> >> > > It is safe on Usenet - it is the best self-correcting medium :-) > > I am quite happy to learn that modern mainstream Forth does not use > blocks at all, and that the Forth used by the GA144 is a bit weird, > old-fashioned, limited and niche compared to the Forth versions more > commonly used in embedded programming.
It is odd that you rely so much on subjective/emotional words to describe what you like or don't like about a language. -- Rick C
Reply by rickman June 22, 20172017-06-22
Wasell wrote on 6/22/2017 8:02 AM:
> On Thu, 22 Jun 2017 09:20:06 GMT, in article <594b8b84.64117705@news.eternal- > september.org>, Stephen Pelc wrote: >> >> On Wed, 21 Jun 2017 15:05:11 -0400, rickman <gnuarm@gmail.com> wrote: >> >>> If you can try not to tick off Steven you can go to his web site and >>> download a copy that you can work with. Same at Forth, Inc. >> >> You have just ticked off Stephen. Steve or Steven is not my name. >> >> Stephen > > He's obviously not talking about you, but about Steven Seagal, patron saint of > hammy actors. You _really_ don't want to tick him off.
Lol. I can't be too mad at him for anything after he made "Under Siege". -- Rick C
Reply by rickman June 22, 20172017-06-22
Stephen Pelc wrote on 6/22/2017 5:20 AM:
> On Wed, 21 Jun 2017 15:05:11 -0400, rickman <gnuarm@gmail.com> wrote: > >> If you can try not to tick off Steven you can go to his web site and >> download a copy that you can work with. Same at Forth, Inc. > > You have just ticked off Stephen. Steve or Steven is not my name. > > Stephen
Sorry. I would have hoped for a smiley at the end of that post, Mr. Pelc. I think in one post I did refer to you as Mr. Pelc. First time I typed it, it came out Mr. Plec. Good thing I caught it. ;) -- Rick C
Reply by rickman June 22, 20172017-06-22
Albert van der Horst wrote on 6/22/2017 4:26 AM:
> In article <oiefqb$fov$1@dont-email.me>, rickman <gnuarm@gmail.com> wrote: >> David Brown wrote on 6/21/2017 1:29 PM: >>> On 21/06/17 18:54, rickman wrote: >>>> David Brown wrote on 6/20/2017 10:48 AM: >>>>> On 20/06/17 14:12, Anton Ertl wrote: >>>>>> David Brown <david.brown@hesbynett.no> writes: >>>>>>> On 19/06/17 16:44, Anton Ertl wrote: >>>>>>>> A static checker might say that the DROP and the - access a value that >>>>>>>> is not present in the stack effect, so they would be a little more >>>>>>>> precise at pinpointing the problem, but stack depth issues are easy >>>>>>>> enough that nobody found it worthwhile to write such a checker yet. >>>>>>> >>>>>>> I would be much happier to see the language supporting such static >>>>>>> checks in some way (not as comments, but as part of the language), and >>>>>>> tools doing the checking. Spotting such errors during testing is better >>>>>>> than spotting them when running the program, but spotting them during >>>>>>> compilation is far better. >>>>>> >>>>>> Why would that be? I can see that it's far better for programmers who >>>>>> don't test their programs, but what is the advantage for programmers >>>>>> who test their programs? >>>>> >>>>> Honestly? You can't see the advantage of spotting errors at as early a >>>>> stage as possible? >>>>> >>>>> Why would someone bother writing test patterns to catch possible errors >>>>> that the tools can see automatically? That is just a waste of >>>>> everyone's time, and it's easy to forget some tests. >>>> >>>> You are showing your ignorance of Forth. The test code catches the errors >>>> at compile time same as C. >>> >>> That is interesting to know, thank you. I have assumed that the tests being >>> discussed were run-time tests. >> >> What exactly is the difference? You compile a Forth program essentially by >> "running" the source code. So you run the code that defines new words and >> run the code that tests them. >> >> This is at such a basic level of Forth that I find it hard to believe you >> have actually given Forth anything but a cursory glance. > > There is an other indication he has never run Forth. He aks for > argument number checking while in even the most simple test > argument count is implicitly tested. > >> >> >>> Do the compile time tests work correctly even for cross-compiled systems, >>> where there may be different capabilities (say, different sizes for cells) >>> from the host? >> >> More lack of knowledge of Forth. You can use a PC as a compiler for >> embedded Forth, but it is also very common to run Forth on the target with >> the PC just being for file storage and editing. >> >> If you can try not to tick off Steven you can go to his web site and >> download a copy that you can work with. Same at Forth, Inc. >> >> >>>> If you are going to forget tests you are doomed. Every piece of code >>>> should be written to a set of requirements, each of which must be >>>> verified, usually by testing. Forget a test and you have unverified code. >>> >>> I did not suggest that tests should be omitted - >> >> "it's easy to forget some tests." >> >> Does that refresh your memory? > > It is easy to forget some tests .. in C. > Testing in Forth means testing a small word with a few possibilities. > Testing in c means testing a larger word with possibilities that > are overlooked. > > Example: > I'm experimenting with a different looping. > There are 10 words, one of which has more than one line. > There are 17 tests. > This level of testing is rare (if not unheart of) in C. > > I use REGRESS similar to t{ . Anton Ertl is annoyed that I > have made my own words, but the truth is it is so easy that > only compatibility can be a reason not to roll your own. > A few dozen lines at most. > > One liners with one execution path are seldomly separately > tested in C. It's too cumbersome.
The testing thing in Forth is not insignificant. It is a great advantage to be able to test your code interactively (times when you can do that easily) and to test small functions (an advantage because other languages tend to have larger functions). But the examples provided are typically the lowest level routines where the base words are well defined and tested over much use. When the level of words increases they are more abstract. Still they work like the lower level words in many ways. But now the lower level words have only just been written and they may do what they were specified to do, but the process that developed the spec for the word can have flaws. Then these low level words are not doing what the high level word needs and expects. Now the testing is back to finding a bug at lower levels of code while testing the higher levels with all the issues that causes. I'm not saying there isn't advantages in testing small Forth words, I'm just saying unit testing doesn't give a free pass at integration time which seems to be what some people suggest. -- Rick C
Reply by Wasell June 22, 20172017-06-22
On Thu, 22 Jun 2017 09:20:06 GMT, in article <594b8b84.64117705@news.eternal-
september.org>, Stephen Pelc wrote:
> > On Wed, 21 Jun 2017 15:05:11 -0400, rickman <gnuarm@gmail.com> wrote: > > >If you can try not to tick off Steven you can go to his web site and > >download a copy that you can work with. Same at Forth, Inc. > > You have just ticked off Stephen. Steve or Steven is not my name. > > Stephen
He's obviously not talking about you, but about Steven Seagal, patron saint of hammy actors. You _really_ don't want to tick him off.
Reply by David Brown June 22, 20172017-06-22
On 21/06/17 20:00, Stephen Pelc wrote:
> On Wed, 21 Jun 2017 19:16:08 +0200, David Brown > <david.brown@hesbynett.no> wrote: > >> On 21/06/17 17:50, Stephen Pelc wrote: >>> On Mon, 19 Jun 2017 00:47:31 +0200, David Brown >>> <david.brown@hesbynett.no> wrote: >>> >>>> You are still tied to blocks of 16x64 characters. >>> >>> I haven't used blocks for decades. You are deeply misinformed. >>> >> >> That was from information from the GA144 website. > > You are still deeply misinformed. Surely it's up to you to > do your own research rather than blather "fake news" across > the interwires. </g> >
It is safe on Usenet - it is the best self-correcting medium :-) I am quite happy to learn that modern mainstream Forth does not use blocks at all, and that the Forth used by the GA144 is a bit weird, old-fashioned, limited and niche compared to the Forth versions more commonly used in embedded programming. (Have you looked at the GA website and read their stuff?)
Reply by Stephen Pelc June 22, 20172017-06-22
On Wed, 21 Jun 2017 15:05:11 -0400, rickman <gnuarm@gmail.com> wrote:

>If you can try not to tick off Steven you can go to his web site and >download a copy that you can work with. Same at Forth, Inc.
You have just ticked off Stephen. Steve or Steven is not my name. Stephen -- Stephen Pelc, stephenXXX@mpeforth.com MicroProcessor Engineering Ltd - More Real, Less Time 133 Hill Lane, Southampton SO15 5AF, England tel: +44 (0)23 8063 1441, fax: +44 (0)23 8033 9691 web: http://www.mpeforth.com - free VFX Forth downloads
Reply by Albert van der Horst June 22, 20172017-06-22
In article <oiefqb$fov$1@dont-email.me>, rickman  <gnuarm@gmail.com> wrote:
>David Brown wrote on 6/21/2017 1:29 PM: >> On 21/06/17 18:54, rickman wrote: >>> David Brown wrote on 6/20/2017 10:48 AM: >>>> On 20/06/17 14:12, Anton Ertl wrote: >>>>> David Brown <david.brown@hesbynett.no> writes: >>>>>> On 19/06/17 16:44, Anton Ertl wrote: >>>>>>> A static checker might say that the DROP and the - access a value that >>>>>>> is not present in the stack effect, so they would be a little more >>>>>>> precise at pinpointing the problem, but stack depth issues are easy >>>>>>> enough that nobody found it worthwhile to write such a checker yet. >>>>>> >>>>>> I would be much happier to see the language supporting such static >>>>>> checks in some way (not as comments, but as part of the language), and >>>>>> tools doing the checking. Spotting such errors during testing is better >>>>>> than spotting them when running the program, but spotting them during >>>>>> compilation is far better. >>>>> >>>>> Why would that be? I can see that it's far better for programmers who >>>>> don't test their programs, but what is the advantage for programmers >>>>> who test their programs? >>>> >>>> Honestly? You can't see the advantage of spotting errors at as early a >>>> stage as possible? >>>> >>>> Why would someone bother writing test patterns to catch possible errors >>>> that the tools can see automatically? That is just a waste of >>>> everyone's time, and it's easy to forget some tests. >>> >>> You are showing your ignorance of Forth. The test code catches the errors >>> at compile time same as C. >> >> That is interesting to know, thank you. I have assumed that the tests being >> discussed were run-time tests. > >What exactly is the difference? You compile a Forth program essentially by >"running" the source code. So you run the code that defines new words and >run the code that tests them. > >This is at such a basic level of Forth that I find it hard to believe you >have actually given Forth anything but a cursory glance.
There is an other indication he has never run Forth. He aks for argument number checking while in even the most simple test argument count is implicitly tested.
> > >> Do the compile time tests work correctly even for cross-compiled systems, >> where there may be different capabilities (say, different sizes for cells) >> from the host? > >More lack of knowledge of Forth. You can use a PC as a compiler for >embedded Forth, but it is also very common to run Forth on the target with >the PC just being for file storage and editing. > >If you can try not to tick off Steven you can go to his web site and >download a copy that you can work with. Same at Forth, Inc. > > >>> If you are going to forget tests you are doomed. Every piece of code >>> should be written to a set of requirements, each of which must be >>> verified, usually by testing. Forget a test and you have unverified code. >> >> I did not suggest that tests should be omitted - > >"it's easy to forget some tests." > >Does that refresh your memory?
It is easy to forget some tests .. in C. Testing in Forth means testing a small word with a few possibilities. Testing in c means testing a larger word with possibilities that are overlooked. Example: I'm experimenting with a different looping. There are 10 words, one of which has more than one line. There are 17 tests. This level of testing is rare (if not unheart of) in C. I use REGRESS similar to t{ . Anton Ertl is annoyed that I have made my own words, but the truth is it is so easy that only compatibility can be a reason not to roll your own. A few dozen lines at most. One liners with one execution path are seldomly separately tested in C. It's too cumbersome.
>-- > >Rick C
Albert van der Horst -- Albert van der Horst, UTRECHT,THE NETHERLANDS Economic growth -- being exponential -- ultimately falters. albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
Reply by Elizabeth D. Rather June 22, 20172017-06-22
On 6/21/17 9:05 AM, rickman wrote:
> David Brown wrote on 6/21/2017 1:29 PM:
...
>> That is interesting to know, thank you. I have assumed that the tests >> being >> discussed were run-time tests. > > What exactly is the difference? You compile a Forth program essentially > by "running" the source code. So you run the code that defines new > words and run the code that tests them.
It's quite easy to write code that compiles perfectly but the logic is wrong. Most applications require extensive testing even though they compile without error.
>> Do the compile time tests work correctly even for cross-compiled systems, >> where there may be different capabilities (say, different sizes for >> cells) >> from the host? > > You can use a PC as a compiler for > embedded Forth, but it is also very common to run Forth on the target > with the PC just being for file storage and editing.
You write the application to run on the target, respecting its facilities and requirements. Cross-compilers accommodate these things, and the good ones support an umbilical to help you test your program interactively just as though it were running on the host.
>>> If you are going to forget tests you are doomed. Every piece of code >>> should be written to a set of requirements, each of which must be >>> verified, usually by testing. Forget a test and you have unverified >>> code.
Correct. An the important tests are the ones that test the functionality of the application, not trivial compile-time issues.
>
...
>>>> Errors of various sorts can happen when you write code. They can be >>>> everything from misunderstandings of the specifications, to small >>>> typos, >>>> to stylistic errors (which don't affect the running code, but can >>>> affect >>>> maintainability and lead to higher risk of errors in the future), to >>>> unwarranted assumptions about how the code is used. Producing a >>>> correct >>>> program involves a range of methods for avoiding errors, or detecting >>>> them as early as possible. Testing (of many different kinds) is /part/ >>>> of that - but it is most certainly not sufficient. It is /always/ >>>> cheaper and more productive to spot errors at an earlier stage than >>>> at a >>>> later stage - and detecting them at compilation time is earlier than >>>> detecting them at unit test time or system test time.
Compile-time checking happens, but cannot check the kinds of logical errors that thorough functional testing can test. The kinds of compile-time checks that Forth generally does not do (e.g. type mismatches) are, in my experience, easily caught is preliminary functional testing, and not major issues.
>>>> Incorrect code is not a minor detail.
No, but the serious errors aren't detectable by compilers, in my experience.
>>> I've never seen a C editor that would catch anything more complex than >>> mismatched parentheses. Do editors look for missing variable >>> declarations >>> now? >>> >> >> Yes.
So does Forth. ...
>>>>>> And it is perfectly possible to write C code that is portable across >>>>>> 32-bit and 64-bit systems >>>>> >>>>> There is a difference between "it is possible" and "it happens". My >>>>> experience is that, in C, if you have tested a program only on 32-bit >>>>> systems, it will likely not work on 64-bit systems; in Forth, it >>>>> likely will. >>>> >>>> I don't see a way to write portable code that works with known sizes of >>>> data in Forth. All I have seen so far is that you can use single cells >>>> for 16-bit data, and double cells for 32-bit data. This means if you >>>> want to use 32-bit values, your choice is between broken code on 16-bit >>>> systems or inefficient code on 32-bit systems. (And you can only tell >>>> if it is broken on 16-bit systems if you have remembered to include a >>>> test case with larger data values.) >>> >>> Again, you don't understand Forth. You use single cells or double >>> cells. >>> Forth does not specify the cell size just as C does not specify the size >>> of an integer.
In practice, dealing with chars, cells, and double-cells is quite practical. FORTH, Inc. has a fairly vast amount of code that runs without change on 8- 16- and 32-bit processors. As our main business is with microcontrollers, we have not yet felt pressure to address 64-bit systems yet, but do not anticipate serious problems there.
>> I understand that fine. And in a lot of C programming, it is a big pain >> that the language does not specify the size of an int - thus >> size-specific >> types are used (standardised in C99, but used long before that). So >> with C >> you have the choice to use efficient integers whose size depends on the >> target, or integers whose size is known and fixed. >>> >>>> I work on embedded systems. I need to be able to access memory with >>>> /specific/ sizes. I need to be able to make structures with /specific/ >>>> sizes.
Open Firmware addressed that by adding some data types with specific bit-widths. It was straightforward to do. But in the embedded work I've been involved with we haven't really found a need to do that.
>>>> Can you show me how this is possible in Forth, in a clear, simple and >>>> portable manner? >>> >>> Forth has cells (a word) and chars (a byte). I don't find it to be a >>> problem, but then I don't typically jump back and forth between 32 >>> and 16 >>> bit processors. What 16 bit processors do you actually use? >> >> msp430 and AVR (the AVR is 8-bit, but C "ints" and Forth cells are >> 16-bit).
We see both of those a lot. We use a 16-bit cell on those, and have 8-bit operators in addition.
>> It looks like the answer is simply that Forth does not support convenient >> portable programming across different cell sizes in code where you >> need to >> be accurate about your data sizes. It is /possible/ (see Gerry's >> answers), >> but ugly and inconvenient. > > Forth programmers often develop what they need. I don't see many > discussing the issues of porting between AVR and ARM. I guess they > don't often need that. Am I wrong? Mr. Pelc would be one to ask. He > has developed Forth for a very wide range of systems with many different > word sizes from 8051 to Pentiums. Same for Forth, Inc.
Over 90% of the code we run on AVRs and ARMs is portable.
>> OK, that is an answer. It is not the only language with limitations >> like that. >> >> (It is quite possible that particular implementations of Forth, targeted >> specifically for embedded systems and cross-compilation, have >> extensions or >> additional word sets designed to make it easy to get exact sized >> types, to >> access memory in specific sized units, etc.) > > See above. > > >>>>>> On the other hand, you don't seem to be able to write a FLOOR5 >>>>>> definition that will handle 32-bit values efficiently on both 16-bit >>>>>> cell systems and 32-bit cell systems. >>>>> >>>>> Tough luck. Why would I need a double FLOOR5 on a 16-bit platform?
There have been times when we have used doubles on 32-bit systems for portability to/from 16-bit systems. The most prominent example is in the output number conversion words, <# # #S #> etc., which are defined to work on doubles. Open Firmware made special cell-wise equivalents (with different names, of course), as that standard did not support smaller cell sizes. It's a perfectly reasonable accommodation, and trivial to implement.
>>>> That is not for you to worry about. Think of me as a customer asking >>>> for a piece of code written in Forth. I want a FLOOR5 function that >>>> handles 32-bit values, works correctly on 16-bit and 32-bit cell >>>> systems, and is efficient on both sizes of system. Can it be done? >>> >>> No one has customers asking for simple functions.
Yes, if that's the requirement we'd probably use doubles, depending on other requirements of the project. The added inefficiency is trivial. In the 90's, FORTH, Inc. and MPE developed an extensive amount of code for smart card terminals using the full range of processors, from 8051's to x86's. For that project we standardized on a 32-bit cell size for a variety of reasons, and managed to write primitives on the low-end processors that were quite civilized in performance, even doing Triple DES and RSA. Our terminals ran quite a lot faster than the current Java-based ones in use here in the US. Cheers, Elizabeth -- Elizabeth D. Rather FORTH, Inc. 6080 Center Drive, Suite 600 Los Angeles, CA 90045 USA
Reply by rickman June 21, 20172017-06-21
Tom Gardner wrote on 6/21/2017 4:41 PM:
> On 21/06/17 19:34, rickman wrote: >> Tom Gardner wrote on 6/21/2017 1:19 PM: >>> On 21/06/17 17:40, rickman wrote: >>>> David Brown wrote on 6/21/2017 6:10 AM: >>>>> Yes, you basically have a SERDES system for each of the I/O pins, and a >>>>> whole array of hardware timers that can trigger the transfers. >>>> >>>> I think we are starting to see why the XMOS devices are so expensive, very >>>> extensive dedicated hardware. Too bad they don't have a few programmable >>>> digital blocks that can actually do something useful. >>> >>> The SERDES and timers are very simple, so I'm unconvinced >>> they are the reason for any perceived expense. >>> >>> Have a look in the "ports" reference I previously gave you >>> https://www.xmos.com/published/xs1-ports-introduction?version=latest >>> You will see that the >>> - SERDES is only a shift register plus buffer register, >>> - each /port/ timer is only 16 bits and is constantly >>> ticking, plus a register and comparator to enable >>> timed i/o >>> - there's a pinseq/pinsneq register and comparator >>> >>> Scarcely enough to dominate the chip area, especially when >>> you consider the memory and xCONNECT switch fabric. >> >> So there is the equivalent of three 16 bit >> counter/timer/comparator/shifter/whatever for *each* port pin? That may not >> dominate the chip area, but it is going to add up fast. I'll bet it is >> larger >> than a set of fixed peripherals in low end MCUs that can be sold for $1. >> Just >> how much logic do you think is in an SPI port? > > No. > > Read the reference supplied; the relevant bits are > only 9 pages - and are in clear and simple English.
So what you wrote is not correct?
>>> Without knowledge, my guess is that the switch fabric will >>> have a far larger area than the port logic, just as in FPGAs >>> the interconnects are far larger than the IO cells. >> >> Xilinx used to say they sell you the routing and give the logic away for >> free. >> What's your point? How do FPGAs come into the cost basis of the XMOS? > > It is the same principals and cost drivers at work. Your > comment indicates you/Xilinx see the similarity.
This gets tiring. I don't know what "comment" of mine you mean and I *don't* see the similarity. The interconnect in an FPGA is at least an order of magnitude more complex than the I/O routing in an MCU.
>> The real issue is that they just can't compete in the low price end of MCUs >> where I feel they would be most useful. > > .... to you.
Ok, I'll spell it out. At the low end the multiple processors can implement separate tasks on separate processors. This works great simplifying the otherwise complex issues in emulating parallel processing on a sequential processor. Fine. A more complex set of tasks will typically require a more powerful processor although complexity is not synonymous with performance requirements. Once the XMOS device is fully utilized with one process per processor additional tasks require adding back in the complexity of emulating parallel processing on a single processor. So the primary advantage of the XMOS processor end once the tasking is complex enough, i.e. high end. So clearly the XMOS is less useful at the high end and more useful at the low end. If they make some adjustments to the design/architecture to allow low *cost* units to be sold, that would only open more markets for them. One nice thing about the low end is that while you don't make tons of money on even a fairly large number of units sold, it pays to keep the doors open and the machinery running. Then they can pursue other products that have different economics and may be less stable financially, good one year and not so good the next.
>> But they have their niche and I guess >> they aren't going anywhere soon. I wonder what it would take for the XMOS >> concept to be scaled up to cover more at the high end? > > A key decision for /all/ businesses is where /not/ to compete.
So a processor company shouldn't try to compete in the processor business. Good thing ARM didn't try that approach. They definitely started at the small end and worked upward. I understand they are making significant inroads to servers these days. I am feeling that this horse has been flogged quite enough. It's not going to get much deader and I don't think we are expressing much in the way of new thoughts. -- Rick C