November 8, 2007
More on New Language Features
There has been an interesting debate between Allen Bauer and Luigi Sandon in response to my post on Handbook Note 34 on new Language Features. The first comment by Allen clarifies my post (whcih being a book note, was not very articulated). But I understand and second Luigi's desire for more language features. That's somethign oly CodeGear can do, while for nice components we can also look to third parties and free libraries.
In my post, I didn't mean that new language features are useless: I do like them a lot. Those mentioned in the post (strict private, class var) are certainly very nice to have. But think, for example, of operators overloading. For years there were cries because Delphi didn't have them, and now very few people are using them because, well, they are not terribly useful after all. The priority is not to match features in other languages per se. It is to introduce valuable features that are sound for Object Pascal.
As an opposite example, a great feature like class helpers, that's been introduced in Delphi *before* several other popular languages (and not following them) is mostly unnoticed when doing language comparisons. I saw few people praising class helpers... while the matching feature of Ruby is highly esteemed.
I'm looking into Ruby a little bit and finding out more and more that Delphi as a language does have extra value compared to some of those "curly brace" languages that are so popular. Another element it its dynamic nature due to the presence of variants, I'm using those in one of the demos for my CodeRage II DSL (Domain Specific Language) talk! More about this after the conference...
The real problems no one is addressing is how to teach Delphi developers to leverage their language... sounds like an interesting book project after all.
6 Comments
More on New Language Features
Heck, I use operator overloading CONSTANTLY. Heck, they even get combined with default parameters on occasion. I've even used them in component libraries. Doing that makes your baseline D4, and that seemed reasonable even in D7 days. While it is true that new features tend to be avoided by component writers due to support issues, eventually you can write off older versions and finally move forward. After all, if someone is still using D1, D2, D5, heck, even D7, what are the chances that they are going to spend money on components? Pretty slim. Give it a few versions, even the component writers start using the new features.Comment by C Johnson on November 9, 02:47
More on New Language Features
"The real problems no one is addressing is how to teach Delphi developers to leverage their language... sounds like an interesting book project after all." Shall I throw down the gauntlet and challenge you to help fill this need ;-)? If you look at other languages and tools in the market, the best information for how to *really* leverage a tool or language is often provided by the community. Delphi should be no different in this regard as it allows more people to participate in the economy that the tool generates. Who learns how to get the most out of their new sports car by reading the little manual* in the glove box? The best place to learn is attending a third-party performance driving school. I had to do the car analogy.. only because Nick hates them :-). Allen. *Of course if that little manual sucks and, for instance, doesn't even tell the user where to fill up the fuel tank... well that is a different matter and the fault of the manufacturer.Comment by Allen Bauer [http://blogs.codegear.com/abauer] on November 9, 03:26
Overloaded Operators
Peter and C, OK I was a bit extreme... I was never particularly fond of operators overloading in C++, I think they have a limited usage. Truly having them for classes would be nice.Comment by Marco Cantù [http://www.marcocantu.com] on November 9, 07:35
More on New Language Features
IMHO the Language Guide was one of the most useful books in Delphi - not the most entertaining book, perhaps, but a very good source to understand how Delphi really works - always the first one I read when a new Delphi was delivered - I always read the manual in the glove box before attending anything - just to be sure the instructor is qualified enough ;) Peer/community help is useful, but there should be a "reference" - maybe you could drive a car without reading its manual, but you can't do that for an airplane, for example - even with training and not only once. I second the challenge of writing a book about really "writing" Delphi code, exploiting the language fully. And yes - operating overloading must support classes :)Comment by Luigi D. Sandon on November 9, 13:17
More on New Language Features
I would have liked to use operator overloading in
several cases, but it just does't work the way I'd
like it to work:
type
TMetre = extended;
TKilometre = extended;
type
TDistance = record
private
FMetres: extended;
public
class operator Implicit(a: TMetre): TDistance;
class operator Implicit(a: TKilometre): TDistance;
end;
...
class operator TDistance.Implicit(a: TMetre):
TDistance;
begin
Result.FMetres := a;
end;
class operator TDistance.Implicit(a: TKilometre):
TDistance;
begin
Result.FMetres := a * 1000;
end;
This doesn't work because the compiler does not
distinguish between TMetre and TKilometre.
Comment by Thomas Mueller
[http://www.dummzeuch.de]
on November 9, 21:45
Post Your Comment
Click here for posting your feedback to this blog.
There are currently 0 pending (unapproved) messages.


More on New Language Features
Comment by Peter on November 9, 01:34