[fpc-pascal] Pascal is alive!!??
Vinzent Hoefler
JeLlyFish.software at gmx.net
Mon Feb 26 12:09:24 CET 2007
On Monday 26 February 2007 10:13, Matt Emson wrote:
> I had a fairly quick glance through; I think you missed the point.
> Most of your arguments point to something like VB3, not Pascal, ADA
> or C. You mention the syntax of the Java class - Pacal and ADA are
> both more complicated.
Well, let's do the standard:
Pascal:
program
Hello_World;
begin
WriteLn ('Hello world.');
end.
Ada:
with Ada.Text_IO;
procedure Hello_World is
begin
Ada.Text_IO.Put_Line ("Hello World.");
end Hello_World;
Java:
public class HelloWorld {
public static void main(string[] args) {
System.out.println ("Hello World.");
}
}
Java in that respect is definitely harder to grasp. You learn a lot of
keywords in one lesson, though.
> Pascal (okay, mainstream Borland dialect
> Pascal) has the Program and Unit constructs and ADA its Package
> body/specification (which IIRC you could skip, but still needed the
> Program construct similar to the Pascal/Modula3 one.) The Java class
> with a Main function is no more complex than a tradiditional Pascal
> "Program".
So, it isn't? A full bunch of keywords wrapped inside a class to make it
OOP and it's not even close to *any* OOP is *easy*?
Somewhere on the web floats around a HelloWorld.java example that is
supposed to do it the correct (Java) OOP way. Now then you scare
novices ;), but at least they'll get OOP from the very first beginning.
> situations. The difference between program and unit. The sections in
> the unit (interface, implementation) the way the uses clause works.
Well, at that point programming ends and software engineering starts to
emerge. The latter Java already lacks by mixing interface and
implementation into one holy mess.
> Pointers - no, no, no. Java passes by reference. This is not anything
> to do with "pointers"
That's why it's called "NullPointerException" instead of
"NoneReferenceException", I'd suppose?
Well, it's a minor technicality, if you call it pointer or reference.
To express my very personal point of view on that matter: The only
difference is that a reference is guaranteed to be non-NIL by
definition. If it can become NIL/NULL/0, it's a pointer.
> to know about at a beginners level. Passing by reference passes the
> "actual" typed object reference, passing a pointer in C does not.
Yeah, right. And Ada does not have pointers either, because it's called
access type? Actually, some of it's inner workings make clear, that's
it's not just an address as in C - still it's a pointer with all the
implications you get with it.
> different to Java? If you wish to pass integral types by reference,
> box them. It's not exactly rocket science ;-)
It's damn hard rocket science, because even if you do that it's still
not clear, what sort of parameter mode it is supposed to have. :P
Vinzent.
More information about the fpc-pascal
mailing list