Re: [fpc-pascal] pointer to anything

2010-04-23 Thread Frank Peelo
On 23/04/2010 14:08, spir ☣ wrote: On Fri, 23 Apr 2010 08:17:21 -0400 Doug Chamberlin wrote: On 4/23/2010 3:33 AM, spir ☣ wrote: Say I want to implement a kind of linked list which node data may be anything. Thus I cannot store data on place (in nodes), indeed; so it should be referenced.

Re: [fpc-pascal] pointer to anything

2010-04-23 Thread tcoq
1° Using the root class TObject might be a good alternative? Storing any object within the structure is easy. Getting the object back will need a type overwrite. 2° Concerning standard structures, you might want to look at TList, TObjectList, TInterfacedList, TComponentList, TStringList which prov

Re: [fpc-pascal] pointer to anything

2010-04-23 Thread spir ☣
On Fri, 23 Apr 2010 08:17:21 -0400 Doug Chamberlin wrote: > On 4/23/2010 3:33 AM, spir ☣ wrote: > > Say I want to implement a kind of linked list which node data may be > > anything. Thus I cannot store data on place (in nodes), indeed; so it > > should be referenced. But pointers themselves ar

Re: [fpc-pascal] pointer to anything

2010-04-23 Thread Doug Chamberlin
On 4/23/2010 3:33 AM, spir ☣ wrote: Say I want to implement a kind of linked list which node data may be anything. Thus I cannot store data on place (in nodes), indeed; so it should be referenced. But pointers themselves are supposed to be typed. So, how can I do that? The key to solving

Re: [fpc-pascal] pointer to anything

2010-04-23 Thread ik
Try the following: type list = ^node; node = record data : Variant; next : list; end; Variant can store a lot pf data types, however please note that it's very slow type. You also must remember that Pascal is Strong typed, unlike C or duck type languages. The Pointer type st