[fpc-pascal] a proposal about "with" syntax
Flávio Etrusco
flavio.etrusco at gmail.com
Sun Mar 17 06:00:41 CET 2013
On Sun, Mar 17, 2013 at 12:16 AM, Daniel Gaspary <dgaspary at gmail.com> wrote:
> On Sun, Mar 17, 2013 at 12:07 AM, 印場 乃亜 <shiruba at galapagossoftware.com> wrote:
>> On 2013/03/17, at 11:37, Flávio Etrusco <flavio.etrusco at gmail.com> 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 :-/
More information about the fpc-pascal
mailing list