When writing this, the above links got me the below list. For consistency (as you cannot save URLs for prior versions in the WayBack machine because a brain-dead robots.txt setting which archive.is luckily ignores):
Delphi does indeed so some type inference as Primoz found out below. It has been doing this for a long time, improved over time, but has a long road ahead.
This is a reminder to myself to write some more example code on what kinds of inference work and which do not, especially because of the comments from David Heffernan, Marco Cantu and Stefan Glienke, especially since the improvement over time has been small. I am curious to see how the promised “working on it” by now lives up to reality.
David Heffernan
This is a rare piece of code where type inference actually works. Mostly it does not which is very frustrating.
It’s a little ironic that you ask why you don’t need to include <T>. Normally people ask about the much more frequent instances where you do need to include <T> because the compiler’s type inference is so weak.
David Heffernan
+Marco Cantù Much more commonly there are times when you want the compiler to infer the type, but it won’t. It would really make a difference to us if the compiler was better at this.
Marco Cantù
+David Heffernan I tend to agree the compiler should be much better at type inference. Working on it!
Stefan Glienke
Infering the generic argument from a constructed generic type would be great.
GuessTheType<T>(const x: TArray<T>);
var
a: TArray<Integer>;
begin
GuessTheType(a);
does not work although the compiler could infer the parameter for GuessTheType from its x parameter but currently it does not know that a originally was a TArray<T> (yes, I know array of T as signature works but that is a different thing).
P.S. +Marco Cantù btw how hard can it be to finally implement generic standalone routines without that ugly static type? Probably one of the highest voted feature requests: https://quality.embarcadero.com/browse/RSP-13724)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Warning: I posted this without doing a proper copyright check on the linked github repository, and it looks like this library heavily copies code from copyrighted materials.
So better not use them, for one because they contain copyrighted material, and also because the copyrighted units are not current.
At least these units are Copyright by Embarcadero:
Androidapi.JNI.Environment.pas:4:{ Copyright(c) 2014 Embarcadero Technologies, Inc. }
Better_JSON.pas:5:{ Copyright(c) 2016 Embarcadero Technologies, Inc. }
Bluetoothcomponentthreaded.pas:4:{ Copyright(c) 2016 Embarcadero Technologies, Inc. }
FMX.Better.Controls.pas:5:{ Copyright(c) 2011-2013 Embarcadero Technologies, Inc. }
FMX.Better.ListBox.pas:5:{ Copyright(c) 2011-2013 Embarcadero Technologies, Inc. }
Generics.Collections.Fixed.pas:5:{ Copyright(c) 1995-2014 Embarcadero Technologies, Inc. }
HTTPClient_2019.pas:6:{ Copyright(c) 1995-2018 Embarcadero Technologies, Inc. }
InetWinSocketReg.pas:5:{ Copyright(c) 1995-2012 Embarcadero Technologies, Inc. }
pngimage_fmx.pas:5:{ Copyright(c) 1995-2014 Embarcadero Technologies, Inc. }
SocketsEditor.pas:5:{ Copyright(c) 1995-2012 Embarcadero Technologies, Inc. }
Logging is everything… unless you never wrote a bug in your program! Let us introduce a new logging class: logging with a set of levels; fast, low execution overhead; can load
Luis Navarro from Embacadero just explained to me:
Close the IDE, then delete the OmniThread folder from MyDocuments\Embarcadero\Studio\17.0\CatalogRepository After that, you have to edit the registry and delete also the Omnithread folder from HKEY_CURRENT_USER\SOFTWARE\Embarcadero\BDS\17.0\CatalogRepository\Elements
As I one day likely need to pas a dynamically created array of const from scratch (which behind the scenes actually is an array of TVarRec, where each element is, TVarRec which is a variant record that can have both values and pointers to values. So the result will be kind of a mess :)