On Sun, Mar 17, 2013 at 12:16 AM, Daniel Gaspary <[email protected]> wrote:
> On Sun, Mar 17, 2013 at 12:07 AM, 印場 乃亜 <[email protected]> wrote:
>> On 2013/03/17, at 11:37, Flávio Etrusco <[email protected]> wrote:
>>> Daniel, I find this hack as ingenious as atrocious ;-)
>>> But thinking about it a bit, when FPC gets generic methods you can
>>> make this kind of workable!
>
> I was thinking about this, not specifically generic methods, but some
> new generic resource.
Indeed. What I was thinking would actually need generic functions,
bounded generics and generics with type-erasure ;-)
So you'd write, say:
>>>>
type generic TAlias1<T: TObject> = class(TObject)
function Alias1: T;
end;
function<T: TObject> Alias1(Source: T): TAlias1<T>;
<<<<
And yet you wouldn't be able to name the alias...
-Flávio
PS. I can't believe Embarcadero went for ":" instead of "=" for
declaring bounded/restricted generics :-/
_______________________________________________
fpc-pascal maillist - [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal