Am 04.09.2013 09:13, schrieb Xiangrong Fang:
Thanks. This is sort-of too verbose when use. I have no comments about how to define it, but when use it, can we just use:

ProcessArray(someintarray); ?
No. Generics are specialized with "<SomeType>", so not using it for procedures/functions/methods as well is inconsistent.


The complier should be able to "specialize" it implicitly because it knows someintarray is array of integer?

alternatively,   how about this:

var
proc_ints: specialize ProcessArray<LongInt>;
begin
proc_ints(someintarray);
end;

use it without explicit specialize is best, however.
No. In non-Delphi modes specializations require "specialize". This is for consistency of the language and also for simplification of the parser in those modes.

And just in case: The syntax is not up to debate.

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to