|
|
First off (the on-topic part): nice IOTDs. It is nice to see ppl using (object) pascal again for games. GLScene rocks, as do JEDI-xxxxxx and all the other open source packages mentioned. You took a nice pick out of the available packages/libraries.
Keep up the good work.
As for the off-topic part (?):
dmulligan wrote:
Fluff:
redundant keywords. What on Earth is the need for the keyword "then" and "do"? Why is the language itself so verbose? Repeatedly typing begin and end really starts to grate after a while.
etc.
It is so verbose, because it was a language that was designed to be readable (in contrast to hexcodes or assembly) back in the days. Niclaus Wirth also designed it to be a language to teach procedural (or structured) programming principles.
Back in those days it mattered, and original pascal was nothing that could be modularised. ie: the entire program was in one file
And, no ... this was all before OO came in to the picture.
With Turbo Pascal, in the later versions, including borland pascal 7.0, there were new features and language elements added as years went on during all of the 80's and the first half of the 90's. (modularisation and rudimentary OO (constructors, destructors), much like c-structs with constructors and methodpointers = classes
The came Delphi, which is in fact OBJECT PASCAL (with a twist -> so similar, but different enough to deserve an own name).
As for the verboseness. Just for readability. When I first read a C(++) piece of code, I found it weird, unnatural and very cryptic (and it still IS pretty much unreadable).
And to be blunt, you can set your ide quite easily to generate stubs for you as well with one keystroke, so it is not such a valid argument to call it a hindrance.
Templates
Maybe there is a need for them. Maybe not. Macro's are also not supported,
although conditional defines and conditional compilation is (so suggestion
of a precompiler/filter). Java for instance only has one since its latest
inception (jdk 1.5, aka java 5.0). But as the other post suggests, it gets
in the way of one thing that Object Pascal, Pascal and their nephews are
good at (better than any compilable language) => compilation speed; which
also counts in a business world.
Operator overloading
Operator overloading is actually just like calling a virtual method.
(now, if only you made those operator methods virtual in your class
definition). So, maybe you like typing some shortcut as
aMatrixInstance *= anotherMatrixInstance;
but for a compiler this actually reads the same as:
aMatrixInstance.MultiplyBy( anotherMatrixInstance )
And to be frank, except for C++ there are not that many languages that
support operator overloading (except for that language I like to call
"we only know C++, although we do not implement the specs fully, so let's
steal the inventor of Delphi and let him invent a language that gives us
an answer to Java (and Borland/Inprise/whatever they like to call themselves
tomorrow). But we still need to be able to recognise it as C++-like with all
its discomforts." and thus C# was born).
Class variables.
I assume you mean those static class variables, and not instance members.
Actually, in other languages these are 'scoped' global variables. You know,
the things you get thought in programming 101 never to use?
Ofcourse they can be emulated in Delphi/(Free) Pascal (but not original Pascal), because of the concept of 'unit'. You have 2 scopes in every unit:
things that are a public interface to the stuff you put inside. And then
there are the private stuff (along with implementation) and those 2 blocks
are bizarrely enough called 'interface part' and 'implementation part'
and respectively denoted by keywords 'interface' and 'implementation'.
You cannot extend a class that you defined in 'interface' with other methods,
but neither can you extend a class in C++ after the '};'.
So, you can have class members, just use global vars in your unit's implementation part.
Ofcourse if you want to be able to access those, you could write getters
and setters that are class (static) methods that access those.
But for anything other than implementation of a singleton pattern i have
never used it (nor did I need it). Nor in C++, or any other language, except
for Java ( no enums there, or 'global constants' ).
Why are you unable to name a method after a variable? (I can guess why, probably to disambiguate method call which do not use the brackets from object member variables).
etc.
Correct. This is one thing I found weird as well when I came back from C++
to code Delphi (professionally). But it is something that you get used to.
Another thing I really mis in Delphi is RTTI (ok, you can get rtti for all
your published and automated properties, fields (members) and methods if
you derive from TPersistent or subclasses; but that's it). But then again,
you *usually* do not need a lot more than this.
In the end, you need to remember that what you take for granted in one
language, you might not find in another, but in this same end: all current
languages are equally powerful. they just might miss some conveniences.
(VCL/Kylix vs templating/write-everything-yourself ... I take VCL any day,
including over .Net's WinForms)
kind regards,
DaGongo
|