CheckWilliamOut wrote:
> Thanks to all who replied. I'm a beginner to Pascal--sorry for asking
> a "blonde" question. So why don't the tutorials tell you that? I'm
> practically exhausted all the basic online tutorials, can someone tell
> me where to get more advanced stuff.
Did they not make you buy a textbook for this class or provide
lecture notes or something?
Anyway, don't be unduly discouraged. This is just one of the things
you have to learn. The hard way more likely than not. I recall that when
I took that Pascal course 20 some years ago I had a slightly related
problem with enumerated types and identifiers. E.g. it seemed to me that
it would be soooooo useful be able to do things like
type
color=(blue, white, red, black);
var
this_color:color;
and after these declaration simply
this_color:=red;
write(this_color);
hope that the word 'red' would appear neatly printed
(we had paper terminals at the time :-).
My classmates had to take their time explaining my misunderstanding
to me: "The strings that you use as identifiers, names of the
variables etc, are used just between you and the compiler. The
executable does not know of them, so cannot print them out. Nor does it
need to know of them, if you write quality code ...."
Learning Pascal (or whatever your first language is) is so much more
efficient in a classroom/computer class setting, because you learn from
your own mistakes as well as from those of the others.
If you are learning by yourself, I'm sure you can do it, but progress
will be somewhat slower. Also the mistakes like mine above are something
you are not likely to repeat when learning your next language. E.g.
my mistake is not particular to Pascal, it simply came from not
understanding what the compiler does, and what the computer does with
the stuff produced by the compiler.
So nowadays I write procedures like
procedure write_color(c:color);
begin
case c of
blue: write('blue');
white: write('white');
....
end;
end;
as a matter of routine. Felt clumsy at some stage, but necessary,
and also actually very convenient. Say, if I want to switch the output
to be in my native Finnish, I only need to rewrite this one procedure.
If I want to sup****t several languages that can also be easily added.
If I wanted to do this "my original way", not only would I need to
rewrite the definition of this enumerated type, but I would need to
search thru the entire program to replace the identifiers with their
new counterparts. Of course, a decent compiler would help immensely,
as after re-enumerating the type the old identifiers would become
unknown to the compiler, and e.g. the line numbers would be marked
as errorneous (or whatever). Anyway, my point was that this kind of
initially unnatural things are there for a reason. And once you
understand the reason, you will be well placed to take advantage!
In some ways your error was similar to mine. After you have grasped
this, you will understand your new tool so much better.
I would love to get a copy of the
> Borland Turbo Pascal Manuals, but being copyrighted they're not
> available online (as far as I know), and being outdated, there's few
> people who are willing to part with them or even have them.
>
Probably true. But aren't the language guides/manuals mostly meant to
be reference books? IOW a place for a relatively experienced programmer
to check how this rare feature worked again, or how it works WITH THIS
PARTICULAR COMPILER. IOW manuals for the compiler rather than for
learning a language. Well, yes they can attempt to do both, but
my admittedly limited experience is that the language guides and manuals
are not very helpful, if you are learning your first language. My other
employer insists that I code in C and/or Matlab (I only need to do
relatively short snippets together with the testbench), and I might have
been able to pick up enough C from the on-line manuals to do well
enough, but yet I preferred to use the (possibly somewhat outdated)
textbook I bought "accidentally" fifteen years ago.
> CheckWilliamOut
>
Courage!
Jyrki


|