Re: [fpc-pascal] flexible record design

2010-05-28 Thread David Emerson
Spir wrote: > I need the simplest and most efficient version, because the type I'm now > designing will be the elementary building block of a rather big system. If you design your class hierarchy well, it ought to be possible to switch the base later on. Personally, I reinvented the wheel by cre

Re: [fpc-pascal] flexible record design

2010-05-28 Thread Michael Van Canneyt
On Fri, 28 May 2010, spir ☣ wrote: On Fri, 28 May 2010 16:03:28 +0200 (CEST) Michael Van Canneyt wrote: TStrings provides an abstract interface. It allows you to associate an object with each string in the list. This means you can do a L.Strings[i]:=Key; L.Objects[i]:=MyObject; Or

Re: [fpc-pascal] flexible record design

2010-05-28 Thread spir ☣
On Fri, 28 May 2010 16:03:28 +0200 (CEST) Michael Van Canneyt wrote: > TStrings provides an abstract interface. It allows you to associate an > object with each string in the list. > > This means you can do a > >L.Strings[i]:=Key; >L.Objects[i]:=MyObject; > > Or, in 1 statement: > >

Re: [fpc-pascal] flexible record design

2010-05-28 Thread Michael Van Canneyt
On Fri, 28 May 2010, spir ☣ wrote: On Fri, 28 May 2010 12:25:59 +0200 Felipe Monteiro de Carvalho wrote: I would like to know the underlying structure of TString (linked list, "flexible-ised" dynamic array, what else?). TStrings provides no storage. I think that TStringList should be wh

Re: [fpc-pascal] flexible record design

2010-05-28 Thread spir ☣
On Fri, 28 May 2010 12:25:59 +0200 Felipe Monteiro de Carvalho wrote: > > I would like to know the underlying structure of TString (linked list, > > "flexible-ised" dynamic array, what else?). > > TStrings provides no storage. > > I think that TStringList should be what you are looking for.

Re: [fpc-pascal] flexible record design

2010-05-28 Thread Felipe Monteiro de Carvalho
Hello, 2010/5/28 spir ☣ : > Side-question: What is the purpose of introducing unimplemented methods? > Sub-classes can extend a super-class anyway, no? Is it just an incentive to > implement those methods? TStrings is a an abstract class, which means that you shouldn't use it directly. It only

[fpc-pascal] flexible record design

2010-05-28 Thread spir ☣
Hello, I'm looking for a "convenient" way to implement a type for kinds of flexible records. "Best" means simple and efficient. A flexible record is a kind of set of name:value symbol, but completely modifyable at runtime. The necessary untyped aspect of the question is handled by values beeing