Any special reason to Advanced Records be available only in Delphi Mode ?
Mailing lists / fpc-pascal / 2012-01
Advanced Records - Why not available by default?
20 messages · 10 people · –
- DDaniel Gaspary 4
- JJ.-c. Chu 4
- SSven Barth 3
- JJürgen Hestermann 2
- MMarco van de Voort 2
- FFelipe Monteiro de Carvalho 1
- +4 more
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Daniel Gaspary wroteAny special reason to Advanced Records be available only in Delphi Mode ?
You can always enable them in other modes via {$modeswitch andvancedrecords}
Jonas
Any special reason to Advanced Records be available only in Delphi Mode ?
Daniel Gaspary wroteAny special reason to Advanced Records be available only in Delphi Mode ?
Personally, I'm getting sick of all the new features added to delphi that don't add anything meaningful, and just add complexity to the compiler. why didn't borland just make people use old borland objects with methods instead of new advanced records? Old borland objects are advanced records..
Ticking me off more: why do we even have objects and classes? what is an object? what are classes? I would have preferred if borland would have just called old borland objects "Extended records" from day one. Now we have this feature overload in the language and it's becoming more and more complex of a language (needlessly). Objects, Classes, records.. aren't they all the same thing? I don't even personally buy the idea that objects even exist.. i think they are just extended records. What is an object? an instance of a class? if so, why did borland call the type definition "object" if it was supposed to be a class? Ugh. Ugly language - it is becoming - sorry to say!
Lars wrote 10 lines
+1
Show quoted text 5 lines
+1 again.
I agree that becoming the language more and more complex needlessly.
Objects, Classes, records.. aren't they all the same thing?
As I think you know, record type defines a "data group"; (old) object is a record with functions; classe type is the improvement of both.
I don't even personally buy the idea that objects even exist.. i think they are just extended records.
Oh, they exist... but you also right, they are extended records, we can say.
What is an object? an instance of a class? if so, why did borland call the type definition "object" if it was supposed to be a class? Ugh. Ugly language - it is becoming - sorry to say!
I think Borland erred in definition of object type. So they improved to class type! =)
Marcos Douglas
Personally, I'm getting sick of all the new features added to delphi that don't add…
Lars wrotePersonally, I'm getting sick of all the new features added to delphi that don't add anything meaningful, and just add complexity to the compiler.
I agrre with you. I like some features of advanced records.
But a lot of things seems a big redundancy.
The possibility of "class var"s specially surprised me ? For What purpose that could be good for ?
For one thing, class variables, class methods, and class properties are subject to visibility controls and inheritance.
So you can, for example, have a private class variable initialized with class constructor (which avoids code in the INITIALIZATION section) and accessed via a read-only class property (which is impossible with unit-level variables).
These “advanced” features are there to provide better encapsulation. And if you don’t need object-oriented programming, I don’t think they’re going to harm you or your programs, either.
Daniel Gaspary wrote 13 lines
Personally, I'm getting sick of all the new features added to delphi that don't add…
Show quoted text 18 lines
I agree wholeheartly with you!!
Lots of nonsense is added that is already available otherwise (or only saves some keystrokes).
In the past Pascal was an easy to learn (still powerfull) language. Today the direction goes
into increased complexity as all the other languages and nobody realy understands it anymore
so programmers code in a suboptimal manner more and more.
Some may say: You don't have to use it. That's true. But I am also no longer able to read
foreign code (i.e. Lazarus program code) because all these strange concepts are used there.
Frankly, every new feature will be a mere increase of complexity if you reject learning about it.
There is a listing, despite not up-to-date, of new language features since Delphi 7, at <http://edn.embarcadero.com/article/34324>. Not all of them are currently implemented in FPC. Could you point out which of them is “nonsense” or “only saves some keystrokes”?
Jürgen Hestermann wrote 43 lines
Personally, I'm getting sick of all the new features added to delphi that don't add…
"Lars" wroteDaniel Gaspary wrote: > Any special reason to Advanced Records be available only in Delphi Mode
?
Show quoted text 7 lines
Although I don't know why Borland did it that way (and I'm also not that a big fan of that extension (but I use them)), I can assure you that advanced records and objects are not the same:
* objects support inheritance and destructors
* advanced records support the declaration of operators inside them (important for genetics) and variant parts
Show quoted text 11 lines
Objects were introduced in Turbo Pascal. There were no classes yet, only objects. When they introduced classes they realized that the object concept wasn't powerful enough, but because of backwards compatibility they decided not to "fix" the objects (or adding a compilerswitch for changing the functionality) but to introduce a new language construct. The advanced records were AFAIK introduced, because they added them for Delphi.Net and they wanted to unify the two platforms a bit.
And yes, the word "object" now has two meanings in case of Pascal:
* the old OOP concept
* an instance of a type of the new concept
I also can assure you that at least in the FPC compiler (advanced) records and objects are not the same.
A little sidenote at the end: in mode MacPascal types declared as "object" are handled like "class", because the objects in MacPascal are closer to Delphi's classes than to TP's objects.
Regards,
Sven
For one thing, class variables, class methods, and class properties are subject to…
J.-c. Chu wrote 7 lines
Interesting, thank you for share this use case.
Frankly, every new feature will be a mere increase of complexity if you reject learning…
J.-c. Chu wroteThere is a listing, despite not up-to-date, of new language features since Delphi 7, at <http://edn.embarcadero.com/article/34324>. Not all of them are currently implemented in FPC.
I believe could be really useful to have a grid style in just one page with compability status.
Is there something similar to this page at fpc wiki ?
Frankly, every new feature will be a mere increase of complexity if you reject learning…
In our previous episode, J.-c. Chu said:
Show quoted text 6 lines
Which ones aren't?
Could you point out which of them is ?nonsense? or ?only saves some keystrokes??
Below is a link to a very old discussion of the above article:
class abstract?
Marco van de Voort wroteWhich ones aren't?
Frankly, every new feature will be a mere increase of complexity if you reject learning…
Frankly, every new feature will be a mere increase of complexity if you reject learning about it.
So how should in your opinion (Object) Pascal look like in say 10 or 15 years?
If new "features" are added with the same speed as in the past, it would become
a monster that only those who grew up with it (without gap) or who invest months
of learning can control.. Every novice would surrender because the learning curve
is so steep. It's no surprise that other scipting languages are so popular. In general they are much easier to learn.
Borland/Embacadero was the driving force behind all these changes and FPC had
to follow if it wanted to stay compatible. But Borland added all these features
just for one reason: They had to sell new versions of Delphi. Not the new users
were the target but the existing (who should upgrade). The new ones are (were)
coming anyway because they were forced to (by the existing users). But if one
day FPC frees from Delphi then I hope that this annoying feature-creep stops.
There is a listing, despite not up-to-date, of new language features since Delphi 7, at <http://edn.embarcadero.com/article/34324>. Not all of them are currently implemented in FPC. Could you point out which of them is “nonsense” or “only saves some keystrokes”?
I may not be a standard user (but in the end, who is?) but I have never used
(nor missed) any of the mentioned concepts, nor collections, nor objects nor
classes nor whatever has been added in the last 20 years and I have never missed any of them. My programs are lightning fast and easy to understand.
The only thing that changed was that the number (and mightiness) of used libraries. But I can use them all with Pascal concepts that exist since Turbo Pascal.
class abstract? J.-c. Chu
J.-c. Chu wrote 5 lines
Implemented since 2.4.2 or 2.4.4 AFAIK.
Regards,
Sven
In our previous episode, J.-c. Chu said: Which ones aren't? Below is a link to a very old…
Marco van de Voort wrote 9 lines
They should all be part of FPC now (only if they meant "TMyClass = record" in their operator overloading example though - the example given as is is AFAIK not compileable neither by FPC nor by Delphi).
Segards,
Sven
So how should in your opinion (Object) Pascal look like in say 10 or 15 years? If new…
I’m not brave enough to predict what Pascal is going to look like in a decade. It’s true that features should not be added promiscuously, but I don’t think Delphi is a fair target of blame.
Let’s again have a look at the table in
<http://edn.embarcadero.com/article/34324>. Basically we can group those features as follows.
1. Catching up with other langauges: operator overloading.
Operator overloading makes certain code more readable.
2. Finer scoping and encapsulation: class-local types, variables, constants, and properties; “advanced” record syntax; STRICT
visibilities; STATIC CLASS methods; class helpers; CLASS ABSTRACT;
CLASS SEALED; and FINAL methods.These really are refinements of long-existed concepts, which cannot be elegantly reduced to pre-existing constructs.
3. Misc: routine inlining; FOR–IN loops.
The FOR–IN loop is the only thing that I personally find objectionable; that’s one in 17 (according to the table in the article).
There is no substantially new concepts. None of them are difficult to understand, certainly not requiring “months of learning”. And if you need some help, a simple Google query with “site:embarcadero.com” will almost do the job.
I understand that for someone who’s been avoiding OOP in the past 20 years these new features may be annoying. But in the meantime there are people who grew up with object-oriented languages, and they might welcome these changes.
Jürgen Hestermann wrote 49 lines
Implemented since 2.4.2 or 2.4.4 AFAIK. Sven
The attached file does not compile in my trunk-version compiler.
Sven Barth wrote 14 lines
In our previous episode, J.-c. Chu said:
The attached file does not compile in my trunk-version compiler.
As Sven already said, that example doesn't compile in Delphi either.
Embarcadero Delphi for Win32 compiler version 22.0 Copyright (c) 1983,2010 Embarcadero Technologies, Inc. xxx.dpr(8)
xxx.dpr(3) Error: E2065 Unsatisfied forward or external declaration: 'TTestClass.TestMethod'
Personally, I'm getting sick of all the new features added to delphi that don't add…
Lars wrotePersonally, I'm getting sick of all the new features added to delphi that don't add anything meaningful, and just add complexity to the compiler.
Why is compiler complexity relevant (if true at all that the new features add significant complexity)? Are you sending patches to the compiler and finds that the new features disturb this?
About adding something meaningful, this varies from one person to another one. For me new features might not be useful now, but if there is a chance they might be useful in the future, then they are good features to have. Use cases are often not obvious. I would normally not think that static class methods are useful, but they were very useful for me in the early days of PasCocoa. And if a features will never be useful to me, then they will be for someone else (if they were useful for noone, then noone would have written the code to support them in the first place)
And if you dont like them, you dont need to use them. The LCL rarely uses newer compiler features. I would say the same for most code in the FCL.
