Re: Larkin, Power BASIC cannot be THAT good:
- From: Nobody <nobody@xxxxxxxxxxx>
- Date: Sat, 20 Jun 2009 12:22:04 +0100
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).
.
- Follow-Ups:
- Re: Larkin, Power BASIC cannot be THAT good:
- From: John Larkin
- Re: Larkin, Power BASIC cannot be THAT good:
- References:
- Re: Larkin, Power BASIC cannot be THAT good:
- From: Jasen Betts
- Re: Larkin, Power BASIC cannot be THAT good:
- From: Bob Larter
- Re: Larkin, Power BASIC cannot be THAT good:
- From: AZ Nomad
- Re: Larkin, Power BASIC cannot be THAT good:
- From: Tim Williams
- Re: Larkin, Power BASIC cannot be THAT good:
- Prev by Date: Re: stable trimmed resistor
- Next by Date: Re: technical question about harddisks
- Previous by thread: Re: Larkin, Power BASIC cannot be THAT good:
- Next by thread: Re: Larkin, Power BASIC cannot be THAT good:
- Index(es):
Relevant Pages
|