Re: Larkin, Power BASIC cannot be THAT good:



On Sat, 20 Jun 2009 03:09:05 -0500, Tim Williams wrote:

No two versions of BASIC, even from the same company are compatible.
At one point, microsoft even made visual basic incompatible with it's
last major release. BASIC is only good for throwaway code. Write it;
run it; toss it. Toss anything you learn too.

So what's your obsession over throwaway code, anyway? The whole premise of
"portable code" is silly to begin with. Yes, C _can_ be written to compile
on, say, different compilers and different OSs, but that's just /hiding/ the
throwaway bits inside #defines. That's worse than maintaining individual
copies of the same source, written specifically for their intended
compiler-OS combination, because you have to wade through #ifs, #defines and
.h's to find out what the hell is going on. In seperate copies, everything
is *there* to see, plain and simple. Between copies, the structure is
(presumably) identical, differing only in those key places which would
otherwise be #defined, so it's no harder to compare them.

You have a lot of misconceptions about what portable code looks like. I
regularly write code which works on Windows, MacOSX (x86 & PPC), Linux and
Solaris, and the code very rarely uses macros.

Dealing with architectural differences is mostly an issue of not making
any assumptions about widths of primitive types, byte-order, padding, etc.
Stick to what's valid according to the language rather than "this compiler
on this CPU behaves like this".

For dealing with API differences, I'll just write Unix and Windows
versions of key functions, with the different versions in different source
files.

For the project which is in front of me right now, out of 53 C
source files (not including headers), 2 are Unix-specific, 2 are
Windows-specific, the other 49 are portable. There are precisely 6
#if[def] directives in the entire code (mostly for platform-specific
headers), and no platform-specific macros.

Finally, since code always has to be rewritten to reuse it anyway,

It doesn't. It might have to be modified, but that's not the same as
rewritten.

what
difference does it make what language it's in before you rewrite it? From C
to C, or C++, or Java, or to many of the other braces type languages, you
might only need to refactor some keywords to make it fit.

Or you might (and probably will) need to completely rewrite it. C doesn't
have classes, Java doesn't have pointers, or half of C++'s OO features, or
many of the libraries available to C/C++ code. C and C++ don't have
garbage collection.

But when you have
to rewrite the whole damn thing, it doesn't make much difference what
language it's in -- BASIC, C, Java, etc. all share the same imperative
program flow structure, and share much of the same syntax and control
statements. The program structure and algorithm flowcharts are identical.
Converting BASIC to C is very simple; the standard libraries for both are
even fairly similar (too bad BASIC has more powerful libraries!).

Except that most BASICs are even more primitive than C: not only no OO,
but no structures, unions, pointers, function pointers, dynamic
allocation, threads, ...

If you're used to BASIC, you won't miss these things, but your code
will typically be full of hacks and workarounds (although it won't seem
this way until you've programmed in a language with more structure).

.



Relevant Pages

  • Re: The Case Against RosAsm (#2)
    ... BASIC there's ever been that is _identical_ in syntax on all ... perhaps...except that such a command is next ... total mess...in language theory terms, ... The reason being that where other BASICs had commands like "COLOR" to ...
    (alt.lang.asm)
  • Re: Code generation from the Gospel according to f0dder
    ... direct pushes of memory over register loads then pushing the register, ... knew a little of the old fashioned basics but its fair to say that ... C is by no means an easy language to learn or write ... object modules so writing assembler in PB is writing its native code ...
    (alt.lang.asm)
  • Re: BASIC vs Python
    ... This was in a misguided effort to make computers ... They could have just as easily used a real language. ... > The BASICs of my youth also supported graphics and sounds. ... >> unmarketable, except as a basic programmer, as you unlearn its ...
    (comp.lang.python)
  • Re: Resources for education (was Re: Operating systems at war?)
    ... programming in a language in which structure is a requirement can be ... What is wrong with Python? ... advanced programming techniques like object oriented programming it is ... To learn Python basics is only a matter of days ...
    (comp.sys.acorn.advocacy)
  • Re: consciousness, was Re: etc.
    ... What constitutes an explanation? ... been writing in a foreign language. ... The basics of conditioning are simple and trivial. ...
    (comp.ai.philosophy)