Welcome, Guest. Please login or register.

Author Topic: BASIC language for AmigaOS4.. AMOS/Blitz  (Read 16259 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Waccoon

  • Hero Member
  • *****
  • Join Date: Apr 2002
  • Posts: 1057
    • Show all replies
Re: BASIC language for AmigaOS4.. AMOS/Blitz
« on: April 11, 2003, 09:49:35 AM »
Quote
AMOS' While...Wend is nothing easier than C's or Pascal's; but AMOS had commands like "Screen Open", which immediately allows the programmer to open a screen and play with it knowing nothing about Intuition.

Well, there's really not much difference between BASIC and C in terms of actual coding structure.  More "advanced" versions of BASIC, like AMOS and Blitz, offer function calls and limit variable scope, things which are not part of the BASIC standard (which I believe was established in the 70's).  I found C an easy language to use in my college programming classes.  The worst part is initializing all your "strings" as "arrays of characters".  Oh yeah, and every computer stores datatypes differently, so an integer on one machine may be different than an integer on another machine.  Stupid niggling stuff like that gets in the way, but on the whole, understanding C structure is pretty easy.

When I started programming with AMOS, I was really frustrated with the concept of variable scope, and didn't understand why you'd want to write a program with anything but global variables.  I found out the answer VERY quickly when I started using C.  BASIC leads to a lot of NASTY coding habits that are hard to break if you want to move on to a better language later.  BASIC is definately easy, but it's *too* easy and makes it VERY hard to move on to something more sophisticated.  If I had started programming in C instead of AMOS, I'd probably be a computer scientist now, instead of a photo restorist.  I got good grades in my C language classes, but I got very spoiled with the excellent IDE that AMOS offered.  Doing everything from a UNIX shell prompt and typing out long compile commands bugged the hell out of me!

What really annoys me about C, though, is that you have to tell the compiler everything.  That's great if you're looking for maximum efficiency, but it really limits freesyling.  I'm sure with a bit of creativity, it would be possible to retain the efficiency of C while still letting the compiler handle all the includes.  With BASIC, all your standard includes (like stdio), are already... um, included.  Several hundred API calls are already in the interpreter and you don't have to load them up and initialize them one by one.  Technically, you CAN use a ScreenOpen() function in C, but you have to explicitly define links to the code before you can use it.  In BASIC, ScreenOpen() can be the very first line of your program.  The drawback with BASIC is that you have to use what the developers give you.  Adding custom APIs to BASIC is very difficult (like in AMOS), or simply not possible at all.  With C, you're EXPECTED to use all kinds of custom APIs.

The one thing I REALLY hate about C is that it cannot be used as an interpreted language.  The thing I really love about BASIC is that it is pretty universal.  It's designed to run on an interpreter, and that makes it architecture independent.  I wouldn't mind going through the trouble of reserving all my datatypes manually for performance, if I could run my programs on both a PC and a Mac without having to re-compile everything and worry about low-level conflicts and OS dependencies.

You can do that now with languages like PHP and Perl, but coding those languages is a NIGHTMARE!!!  I have a BBS written in Perl, and I'm trying to make modifications to the code.  Even after working with C for four years, just looking at Perl code makes my head spin!  I can't understand why anyone would make such a wretched, ineffecient language!

Purists say that pre-compiling your applications is the best way to write code, because it "forces" you to proofread your code and promotes good, clean coding habits.  I disagree, for the same reason I think a computer is still better than a typewriter.  A typewriter forces you to rewrite your documents, but with a computer, it's your OWN responsibility to review your words and rewrite, to make sure your document is as good as can be.  If you're lazy, it doesn't matter what tools you use -- your products will suck.

A person becomes a good programmer because they put in effort to make good code.  Personally, I think the AMOS interpreter was a great way to test code.  C programs, on the other hand, really drove me nuts, and it was an endless battle of going back into your code and setting test points.  What a pain!  Don't even get me started about backtracing machine code and breakpoints!  I like the structure of C, but when it comes to debugging, ordinary ANSI C really drives me nuts (I haven't tried more anvanced versions of C, yet).  I think programmers make application and compiler errors intentionally cryptic, just to cover their stupid mistakes!

If I were to make a new language, it would have the modularity and datatype handling of C.  It would be an interpreted language that can be optionally compiled.  The first line of the program would be an "environment definition", where you tell the interpreter what modules you want to use for your program.  With BASIC, all the graphics stuff is always available, so you have too much overhead (on the PC, a Blitz Basic executable is 750K, no matter how small your program is).  In my ideal language, you can say right away if you're making a command-line program or if you need accelerated graphics.  Or, you can define everything manually, like you do in C.

As for object oriented programming, I don't know exactly how that works, and I've never needed it because my programs are not big enough.

Do keep in mind that when I mention "C", I'm really referring to the ANSI C standard.  I've never used more elaborate C compilers like Visual C, Borland C, or any C++ compiler.  Maybe C++ compilers are a lot more streamlined than ANSI C.  I never bothered to check.  I gave up programming to make photographs, and I'm perfectly happy with that career choice!   :-D
 

Offline Waccoon

  • Hero Member
  • *****
  • Join Date: Apr 2002
  • Posts: 1057
    • Show all replies
Re: BASIC language for AmigaOS4.. AMOS/Blitz
« Reply #1 on: May 15, 2003, 09:03:10 AM »
Well, it's hard to say that the world needs BASIC, when hardly anything is akin to the original BASIC standard developed in the 70's.  Put a piece of AMOS code next to Blitz or GWA or Power Basic, and you'll hardly see many similarities.

What I like most about the "revamped" BASIC languages is:

- Integrated IDE:  realtime syntax checking.  Some BASIC IDEs also use color-coded text like Visual C, and auto-indent.

- Interpretation:  Compiling is great for a speed improvement, but raw code allows true architecture independence, so long as an interpreter is available.

- Realtime debugging:  Interactive debugging and tracing is easier than in true compiler languages.

- More fun:  Let's face it, you don't really WANT to start off with C.  BASIC lets you do cool stuff right away.

- Simple structure:  Writing whole apps in BASIC is a pain, but if you want to run little programs to handle mundane tasks, you don't want to do all that memory management by hand, do you?  BASIC gives you results quickly.

What I hate about BASIC:

- You have to compile the whole program.  C and other real languages allow you to compile your program in manageable parts, as object files.

- BASIC is an "idiot's" language:  Unless someone really puts in effort to make BASIC more usable, which is definately possible.

- Bad habbits:  When I gave up on BASIC and moved to C and the Allegro library, I learned a lot about real programming.  I had to toss out most of my BASIC knowledge and re-learn everything.  Instead of making a new language tailored to amateur programmers, couldn't we take C and make it easier, and then open source it so it could be ported to all sorts of platforms?

Bugs:  BASIC compilers are generally buggier than other languages.  AMOS has trashed more than a few of my programs over the years, thanks to a really screwed up editor that insisted that certain lines didn't exist and there was a syntax error when there clearly wasn't.

- Games:  All BASIC languages these days are specifically designed for making games.  There's very little out there for serious GUI applications.  In fact, if you want a standard GUI in Blitz BASIC, you have to buy a totally seperate version!  There's Blitz, Blitz 3D, and Blitz Plus.  Come on...  GUIs aren't complicated enough so you have to buy a whole seperate compiler!

- Huge executables:  BASIC is generally not modular, so when you write a program, the compiler just throws in the entire runtime library.  Blitz Basic executables are 750K minimum, no matter what.  What if you only need command-line support and no graphics?  750K.  Period.

I haven't tried Visual Basic.  I want something portable, and Visual Basic is pretty expensive.
 

Offline Waccoon

  • Hero Member
  • *****
  • Join Date: Apr 2002
  • Posts: 1057
    • Show all replies
Re: BASIC language for AmigaOS4.. AMOS/Blitz
« Reply #2 on: May 28, 2003, 06:04:48 PM »
Quote
Atheist:  Could it have something to do with the authors of the SW? They don't take it seriously, because everyone slags it and sales stay low? It's just the way it is. I've found a couple of problems with the ide, as well (Amos Pro, I still love it). 3 at least.

Yes.  AMOS had lots of bugs in its editor, and it saved all its programs in binary format.  If your program file got corrupt, the whole thing was screwed.  AMOS was a lot of fun back when I had no knowledge of more powerful languages like C and Perl.  Looking back, I realize AMOS was pretty horrible for anything other than games.   I have lots of fond memories, but it sure was a harsh learning experience.  ;-)

Quote
The Amiga version? I've never used it (Blitz, any version), but you must be refering to the windoze version? Anything on windoze is MAMMOTH!!!! I found a commercial Ram Disk: program for w98se. It was 114K in size and required a 1.4 Meg DLL file to run!?!?!!!! The DLL didn't come with the Ram Disk, I had to track it down on the internet. Then, you find out it was programmed in visual basic!

The PC version, actually.  I've seen some Windows programs that are small and effecient (Notepad, for example), but they don't really use the GUI well, and usually call lots of external libraries.  Windows has WAAAAAAY too many DLLs!  Blitz compiles most of its environment into your program executable, therefore, you can't even fit two compiled programs on a floppy.   :-P

Quote
Why can't an ide in C/C++ open a window, everytime you type a keyword in, asking you which library you want to use, tick off a checkbox beside the library, and it automatically puts it in as an include at the beginning of the source code?

Oh my God... Clippy for programming!  That would work only in tutorial mode.  Once you learn what you need, you'd better be able to turn that feature off!

What I'd like to see is auto formatting for subroutine headers and a clickable drop-down list of all global and local variables in your program.  That's what REALLY drives me nuts about reading Perl code from other people.  Nobody does a good job labeling their headers or outlining their variable usage!

And, of course, you should be able to turn it off if you don't use it.  How about the ability to create sub header templates, and let the IDE fill in the blanks?  Being able to read your code in any text editor is nice, but I really hate writing code in a plain text editor.  I write most my Perl code in Win32Pad.  I'm STILL looking for a simple Notepad clone that colors text and matches brackets automatically.

Quote
mdwh2:  How big is a Hello World program in AMOS on the Amiga, for example?

If I remember correctly, a compiled AMOS Pro executable is a minimum of 53K.  Remember that AMOS doesn't seriously use any OS libraries, so a PC version of AMOS Pro would be much, much bigger by default.  Hence, Blitz Basic on the PC makes executables about 750K in size.

Quote
Don't get me wrong - I think BASICs, or other "beginner" languages, have their place - but there are plenty of reasons why ppl move onto other languages.

Yeah.  I just wish people weren't so prejeduce against BASIC.  If it wasn't for interpreted languages like BASIC, you'd have to imagine that scipting languages like Perl would still be in the stone age.  I love writing interpreted code instead of compiled code.

Quote
What a total nonsense...
First don't confuse C with C++. C++ is targetted mainly for appliaction development and it would be a nightmare to write lowlevel OS stuff in it.

Here here.  Since I've started learning C++, I've realized why people are so upset with it:  they're trying to use C++ when plain C will do.  Use what works.

Quote
Bloodline:  This is a good reason why I think the world does need a BASIC.

No, the world needs a better BASIC!   :-D