4 ms·
Sorry, but Object Pascal has been providing most of this for everything. So this shows that you haven't really informed yourself. Even smart-pointers can be im
by bero1985 4y ago
Sorry, but Object Pascal has been providing most of this for everything. So this shows that you haven't really informed yourself.
Even smart-pointers can be implemented in Object Pascal quite fast with a Generics class together with a Reference Counting interface, because, admittedly, such a thing is >not yet< implemented in the Object Pascal Standard Library itself.
Exceptions have ObjectPascal (try finally end; try except an; TException etc.), namespaces too (unit Foo.Bar.Thing.Stuff; TClass.TSubClass.TSubSubClass etc.), generics too (type TClass<T>=class ... end; function Func<A, B>(Foo: A; Bar: B):Boolean; etc.), lambdas (anonymous functions, BlaVar := function:integer begin result := 123; end; ) also, collection literals also (BlaVar := [1, 2, 3];
BlaVar := BlaVar + [42, 23]; FooTValueArray := ['v', 2, 3.14159]), destructured bindings also via RTTI magic, sum types also in the form of Variant or TValue, and so on.
Only type inference a la C++'s auto is not, but in my opinion this is a bad anti-pattern anyway, because Object Pascal code should always be readable, where something like "auto Foo := Bar;" would only interrupt the reading flow, where you would have to think about what data type it is in the end.
Here one sees again what I wrote in my blogpost, that people like you don't really know Object Pascal or because of their arrogant attitude don't want to know what it includes and what not.
- moloch-hai 4y agoI am corrected. But the importance of type inference (which does not, BTW, originate in C++) is that it enables declarations in circumstances where the type cannot be named, or even just not conveniently.