RetroForum Welcome, Guest. Please login or register.
March 14, 2010, 02:20:48 PM
Home Help Search Calendar Login Register

RetroForth Discussion  |  Main  |  Discussion  |  Topic: Some thoughts... « previous next »
Pages: 1 Go Down Print
Author Topic: Some thoughts...  (Read 4528 times)
Charles Childers
Administrator
Sr. Member
*****

Karma: +2/-0
Offline Offline

Posts: 745


View Profile WWW
Some thoughts...
« on: August 28, 2004, 02:04:16 PM »

A lot of contributions have been made recently. I think that this is a good time to bring up the philosophical goals I set for RetroForth. And perhaps explain some things as well. I strive for a balance between simplicity and features. I'm not out to create a standardized Forth, so incompatibilities can and will exist between RetroForth and all of the various Forth standards.

At the same time, I don't want a totally minimal Forth. The core (core.asm, core.dict, rf.asm, macros.fasm, and the bootstrap code in blocks/*) is intended to be as small as possible without sacrificing practicality. When possible words are written and saved in Forth (+ inline machine code) rather than in assembly. This is an intentional decision that should serve to help with ports to other processors, and also reduce our dependence on a specific assembler.

I don't want complex control structures. That's why words like else are missing. I used tail recursion and conditional exits successfully for a long time. But it's nice to have some real loops once in a while. Deep nesting should not be done. You should factor your code when feasible. I don't advocate extreme factoring. But it does help to keep the code clean, understandable, and simple.

for and next are good. They take little from the stack (just a count) and don't complicate things too much. The repeat and again loops are also useful for many things.

With the words for comments, I chose based on readability. Consider these samples:

[code]: loop
 
« Last Edit: September 25, 2005, 07:35:56 PM by Charles Childers » Logged
RogerLevy
Full Member
****

Karma: +1/-0
Offline Offline

Posts: 55


View Profile
Re:Some thoughts...
« Reply #1 on: December 02, 2004, 05:24:28 AM »

thank you Charles.

i totally believe in a simple, non bloated core with the possibility for lots of extensions. because it just gives people more options! and when it comes to "libraries", if you don't like one camp's way of doing things you can try something else, while still keeping the "glue" the same. writing code in forth is so easy there's no point in getting anything done once and for all - you can just write new code to solve each problem, no big deal.

Logged
Andrew Price
Member
**

Karma: +0/-0
Offline Offline

Posts: 7

=B-)


View Profile WWW
Re:Some thoughts...
« Reply #2 on: January 03, 2005, 03:00:35 AM »

Learnability and simplicity are the two main virtues that attract me to retro.

For the past year I have been searching for a forth I can write simulations in, and which could output graphics. Later, I would like to use the same forth to control rather complex industrial robots. I tried Win32Forth, but it has thousands of words. So does BigForth, which is an amazing accomplishment, but you need to learn a lot to use it. GForth is a little better and I spent some time trying to get OpenGL/GLUT to work with it, mostly without success. I keep trying to use the brutally beautiful ColorForth (as XColorForth), but the i/f is simply so ferocious that I can't get over the initial learning hump (I am lazy). Enth is better, but Sean seems to be moving on. So I am stuck using Java (yuck), but cannot get more than 50 fps out of it and it is bloated beyond belief.

I came across retroforth in the freshmeat list last night and like it most of all, however I need some more facilities.

I think your goals are right on Charles and I commend everyone who has contributed to RF.

While the core needs to be very sparse, I would suggest the following areas where small toolkits are essential to making RF a tool that can take on a variety of useful tasks. I would encourage us all to try to establish these almost-core 'packages' as being quite standard so that somewhat sophisticated RF programs can be portable.

1. File I/O (seems well under way)
2. Graphics -- OpenGL seems like a logical target, but a small set of words that can use either OpenGL or DirectX would be cool (Chuck's warnings about LCDs notwithstanding). I might be able to help with this on Linux.
3. USB access (keyboard/mouse/sound/maybe net/etc etc)
4. net IP access
5. Multitasking/IPC

A common set of words for similar parts of 1,3 and 4 might be good. Words for async/sync/connection oriented/connectionless/stream/block might be the same for all.

With those 4 packages as standard (within retro, not externally) as possible I think retro would be usable for a huge range of projects, and need not be very large.

I love how clean the core is, please keep it that way and please don't worry about external compatibility (ANS etc) either.

I would also appreciate worked examples to go with every entry in the word list, and can try to chip some in for those I understand properly.

Regards

Andy

« Last Edit: January 03, 2005, 03:34:29 AM by Andrew Price » Logged

CTO, HealthSpace
Charles Childers
Administrator
Sr. Member
*****

Karma: +2/-0
Offline Offline

Posts: 745


View Profile WWW
Re:Some thoughts...
« Reply #3 on: January 03, 2005, 12:31:39 PM »

Quote
While the core needs to be very sparse, I would suggest the following areas where small toolkits are essential to making RF a tool that can take on a variety of useful tasks. I would encourage us all to try to establish these almost-core 'packages' as being quite standard so that somewhat sophisticated RF programs can be portable.

I am finally getting to a point where I'm satisfied with the basic wordset. With 8.0 (where the major cleanups are being implemented/tested), some things will be much cleaner and more modular, but next month you'll start to see some of the changes. Until 8.0 gets to a semi-stable state, I'll be continuing active development of the 7.x codebase. 7.7 will bring a few of the internal cleanups, as well as some of the improved modularity.

Basically, I like having a small, simple core, but I do agree that we need some internal standards for things like file I/O. (I use blockfiles, but most people seem to prefer normal files, so I make a concession there...).

Quote
1. File I/O (seems well under way)

File I/O is coming to Linux, Windows, and FreeBSD in 7.7 or 7.8. My words for this won't be ANS compatible, but Ron and others have been doing work towards ANS-compatible file words, so that's not  a major deal for me.

Quote
2. Graphics -- OpenGL seems like a logical target, but a small set of words that can use either OpenGL or DirectX would be cool (Chuck's warnings about LCDs notwithstanding). I might be able to help with this on Linux.

Alexey has done some work on supporting OpenGL under Windows. I'll be porting that over to the Generic/DL port sometime this month, and then fleshing out the functionality as I have time. In addition, Roger has been working with the Allegro gameing library for graphics, and Chris Walton has been experimenting with libSDL.

I'd like to put together a set of fairly generic drawing words that can be adapted to work with OpenGL, libSDL, or Allegro, so that we have a lot of flexibility on the backend used.

Quote
3. USB access (keyboard/mouse/sound/maybe net/etc etc)
4. net IP access
5. Multitasking/IPC

These are harder. The USB protocols are quite complex. The native version, where I'm focusing on writing drivers, can use USB devices if the BIOS has settings to make them appear as "traditional" devices. Under Linux, you could communicate with them via syscalls though. Windows makes things even harder Angry

Network access depends on at least cooperative multitasking to be functional, though you can use tcpclient under Linux to do some network-oriented things. (See http://www.retroforth.org/irc.f for the start of an irc client using retroforth and tcpclient. The primary author of the irc code is working on net access without tcpclient IIRC)

Multitasking and IPC depend on the host OS. I could probably do some basic multitasking & IPC words under Linux, and possibly FreeBSD, but Windows is just a pain to deal with, no matter how you cut it.

Quote
I would also appreciate worked examples to go with every entry in the word list, and can try to chip some in for those I understand properly.

Anything you can help with there would be appreciated. I'm getting short of time these days (Me and my family are busy preparing for our new child, which will be born in a few weeks...)

I'll expand on what's coming in the modularity and cleanups a bit over the next few days.

Charles
Logged
Andrew Price
Member
**

Karma: +0/-0
Offline Offline

Posts: 7

=B-)


View Profile WWW
Re:Some thoughts...
« Reply #4 on: January 05, 2005, 09:34:15 AM »

Quote
Basically, I like having a small, simple core, but I do agree that we need some internal standards for things like file I/O. (I use blockfiles, but most people seem to prefer normal files, so I make a concession there...).

I agree and would not suggest adding these extra 'packages' or vocabularies into the core. Rather I would prefer to see them be as consistent among themselves as is consistent with their real differences. At least for me, any kind of compatibility with other forths is very low priority.

So for example, I would expect that USB, file, ipc and net vocabs might all have a 'locate'  or 'exists?' word that returns an error/success code,  and an 'open' word that returns a handle to a file, stream or connection. The same word might take different parameters in each package, but would behave in much the same way.

Similarly, when the same 'package' exists in different implementations for different platforms, I would prefer to see them be 'mostly compatible' rather than identical. Someone wishing to do graphics on windows using directx after developing on linux ogl, or on SDL after ogl should expect to have to do a little tweaking. The core, however, should be compatible across platforms. This is consistent with keeping retroforth simple and yet not succumbing to the lowest common denominator effect that Chuck warns of.

Obviously multitasking and graphics might not have much in common with the other packages.

Quote
Alexey has done some work on supporting OpenGL under Windows. I'll be porting that over to the Generic/DL port sometime this month, and then fleshing out the functionality as I have time. In addition, Roger has been working with the Allegro gameing library for graphics, and Chris Walton has been experimenting with libSDL.

I'd like to put together a set of fairly generic drawing words that can be adapted to work with OpenGL, libSDL, or Allegro, so that we have a lot of flexibility on the backend used.

I think this is exactly the right approach -- develop a common toolset for each that reduces the time to port, without attempting to eliminate it, since that last few percent of difference is where the majority of function will be lost by forcing all to conform.

Quote
(use,net and ipc) are harder. The USB protocols are quite complex. The native version, where I'm focusing on writing drivers, can use USB devices if the BIOS has settings to make them appear as "traditional" devices. Under Linux, you could communicate with them via syscalls though. Windows makes things even harder

Yes, I would not expect the protocols within USB to be standard, simply the way of acquiring devicies and reading and writing the data. Linux has a devusb filesystem that may help make usb more tractable.

Note that I say all of this from the comfort and safety of my armchair, since I cannot provide much help at present. Wink

Good luck with the new baby and keep up the great work, I am lost in admiration that you do so much already.

btw, take a look at http://www.beepcore.org/ for a highish level tcp kit. Thanks for the pointers, I shall certainly look at the irc stuff.

Cheers

Andy
Logged

CTO, HealthSpace
mimizukujin
Member
**

Karma: +0/-0
Offline Offline

Posts: 6


View Profile
Re:Some thoughts...
« Reply #5 on: May 25, 2005, 07:55:59 PM »

While the core needs to be very sparse, I would suggest the following areas where small toolkits are essential to making RF a tool that can take on a variety of useful tasks. I would encourage us all to try to establish these almost-core 'packages' as being quite standard so that somewhat sophisticated RF programs can be portable.

1. File I/O (seems well under way)
2. Graphics -- OpenGL seems like a logical target, but a small set of words that can use either OpenGL or DirectX would be cool (Chuck's warnings about LCDs notwithstanding). I might be able to help with this on Linux.
3. USB access (keyboard/mouse/sound/maybe net/etc etc)
4. net IP access
5. Multitasking/IPC

This is exactly what I was talking about in the 'libraries' thread.  Now I know that in Forth, they are called toolkits.
Logged
Charles Childers
Administrator
Sr. Member
*****

Karma: +2/-0
Offline Offline

Posts: 745


View Profile WWW
Re: Some thoughts...
« Reply #6 on: May 26, 2005, 01:59:38 AM »

RetroForth 8 provides some of these in the library:

Quote
1. File I/O (seems well under way)

lib/files provides the ability to read a file under Linux and Windows. The ability to save files is coming in June.

Quote
2. Graphics -- OpenGL seems like a logical target, but a small set of words that can use either OpenGL or DirectX would be cool (Chuck's warnings about LCDs notwithstanding). I might be able to help with this on Linux.

I'm currently evaluating my options here. I expect to have access to a framebuffer in place for the major ports by late summer, if not sooner.

Quote
3. USB access (keyboard/mouse/sound/maybe net/etc etc)

Still considering how to do this.

Quote
4. net IP access

See lib/sockets if you're using Linux. We can do simple, single-user servers and even a bit of client stuff. The guys at forthology.com are working to make this a useful library.

Quote
5. Multitasking/IPC

I should have reliable, cooperative multitasking in place sometime this summer. A few early experiments are in lib/tasks
Logged
Charles Childers
Administrator
Sr. Member
*****

Karma: +2/-0
Offline Offline

Posts: 745


View Profile WWW
Re: Some thoughts...
« Reply #7 on: June 13, 2005, 02:32:50 AM »

Quote
2. Graphics -- OpenGL seems like a logical target, but a small set of words that can use either OpenGL or DirectX would be cool (Chuck's warnings about LCDs notwithstanding). I might be able to help with this on Linux.

RetroForth 8 now has support for initializing a framebuffer and drawing to it via the Allegro library. The code for this is in lib/allegro, and will work under Windows or Generic+FFI with modification to only one line (setting the name of the library file to use).
Logged
Pages: 1 Go Up Print 
RetroForth Discussion  |  Main  |  Discussion  |  Topic: Some thoughts... « previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1 RC2 | SMF © 2001-2005, Lewis Media Valid XHTML 1.0! Valid CSS!