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[2]: [fpc-pascal] stuck with untyped pointer

2010-05-28 Thread José Mejuto
Hello FPC-Pascal, Saturday, May 29, 2010, 12:34:38 AM, you wrote: >> TObject is the base class, it inherits from nobody. To make the whole >> weel run a base class must exists which provide basic functionality >> like Create/Destroy and other methods/events like "ClassName", >> "InheritsFrom"; so

Re[2]: [fpc-pascal] stuck with untyped pointer

2010-05-28 Thread José Mejuto
Hello FPC-Pascal, Saturday, May 29, 2010, 12:03:46 AM, you wrote: >> 3) Variable name "val" (Use Value instead, there is a function called >> val). s> Naming problems in object pascal... I could not use "value" s> because it's the name of a method that returns a value, lol! So, I s> used "val". B

Re: [fpc-pascal] stuck with untyped pointer

2010-05-28 Thread Alberto Narduzzi
TObject is the base class, it inherits from nobody. To make the whole weel run a base class must exists which provide basic functionality like Create/Destroy and other methods/events like "ClassName", "InheritsFrom"; so if no class is specified it automatically inherits from TObject. I see, and

Re[2]: [fpc-pascal] stuck with untyped pointer

2010-05-28 Thread José Mejuto
Hello FPC-Pascal, Saturday, May 29, 2010, 12:09:50 AM, you wrote: >> Struct is declared as "class" so it inherits from TObject if not other >> class is especified. AN> is that true? I don't mean not to trust you, but is the compiler AN> assuming that, or is it a FPC rule? IMO a class is a class,

[fpc-pascal] Re: ISO Standard Pascal I/O

2010-05-28 Thread Roger Bailey
Me: > ... nextcharacter := input^ ... Does FPC not support this standard Pascal > feature? Jonas: > No, it does not. FPC mainly supports Borland-style Pascal dialects, and they > are not ISO Standard/Extended Pascal compliant. I can live with that, but it would save newcomers a lot of troubl

Re: [fpc-pascal] stuck with untyped pointer

2010-05-28 Thread Alberto Narduzzi
Hi, Struct is declared as "class" so it inherits from TObject if not other class is especified. is that true? I don't mean not to trust you, but is the compiler assuming that, or is it a FPC rule? IMO a class is a class, and doesn't inherit from anything else. Unless specified. BTW, From who

Re: [fpc-pascal] stuck with untyped pointer

2010-05-28 Thread spir ☣
On Fri, 28 May 2010 23:07:35 +0200 José Mejuto wrote: > 3) Variable name "val" (Use Value instead, there is a function called > val). Naming problems in object pascal... I could not use "value" because it's the name of a method that returns a value, lol! So, I used "val". But now I cannot use

Re[2]: [fpc-pascal] stuck with untyped pointer

2010-05-28 Thread José Mejuto
Hello FPC-Pascal, Friday, May 28, 2010, 11:24:44 PM, you wrote: AN> I have no more suggestions but the one about deriving your TStruct from AN> TObject, as almost everything in the LCL (and/or VCL, I guess I name AN> them right) is a descendant of it. Struct is declared as "class" so it inherits

Re: [fpc-pascal] stuck with untyped pointer

2010-05-28 Thread Alberto Narduzzi
ok, now the code fragments look more clear. I have no more suggestions but the one about deriving your TStruct from TObject, as almost everything in the LCL (and/or VCL, I guess I name them right) is a descendant of it. Again. maybe it's not the best thing you'll like to do, but this way IMHO

Re: [fpc-pascal] stuck with untyped pointer

2010-05-28 Thread José Mejuto
Hello FPC-Pascal, Friday, May 28, 2010, 6:57:42 PM, you wrote: s> s> program __essai__; s> {$mode objfpc}{$H+} s> uses s> Classes, SysUtils; s> type Struct= Class s> val: Integer; s> constructor struct(i:Integer); s> function text : St

Re: [fpc-pascal] {SOLVED} stuck with untyped pointer

2010-05-28 Thread spir ☣
Hello, It was a stupid naming issue: since I couldn't use "new", I had called the Struct constructor "struct" (found it logical, since it returns a struct). But because of case insensibility, I guess, when I wanted to cast back a pointer to Struct, the compiler denoted the constructor instead -

Re: [fpc-pascal] stuck with untyped pointer

2010-05-28 Thread spir ☣
On Fri, 28 May 2010 20:51:10 +0300 Alberto Narduzzi wrote: > >i := self.names.indexOf(name); > >val := Struct(self.values[i]); > > raises "got untyped expected Struct". Sure, that's why I'm trying to > > cast... Without casting to Struct, the compiler indeed throws "got pointer > > expe

Re: [fpc-pascal] Re: fpc-pascal Digest, Vol 71, Issue 69

2010-05-28 Thread Jürgen Hestermann
Roger Bailey schrieb: OK, I give up. How do you handle standard input and output files in FPC? When I write something like: nextcharacter := input^ I get "error: 1: Illegal qualifier". Does FPC not support this standard Pascal feature? I have never seen such a syntax before. Shouldn

Re: [fpc-pascal] stuck with untyped pointer

2010-05-28 Thread Alberto Narduzzi
i := self.names.indexOf(name); val := Struct(self.values[i]); raises "got untyped expected Struct". Sure, that's why I'm trying to cast... Without casting to Struct, the compiler indeed throws "got pointer expected Struct". I'm very surprised since I already did this. in first place, you

[fpc-pascal] ISO Standard Pascal I/O

2010-05-28 Thread Jonas Maebe
On 28 May 2010, at 19:27, Roger Bailey wrote: > OK, I give up. How do you handle standard input and output files in FPC? When > I write something like: > > nextcharacter := input^ > > I get "error: 1: Illegal qualifier". Does FPC not support this standard > Pascal feature? No, it does

[fpc-pascal] Re: fpc-pascal Digest, Vol 71, Issue 69

2010-05-28 Thread Roger Bailey
OK, I give up. How do you handle standard input and output files in FPC? When I write something like: nextcharacter := input^ I get "error: 1: Illegal qualifier". Does FPC not support this standard Pascal feature? The documentation is extremely unhelpful in this area. The LRG just says

Re: [fpc-pascal] stuck with untyped pointer

2010-05-28 Thread Michael Van Canneyt
On Fri, 28 May 2010, spir ☣ wrote: Hello, While waiting for more information about how to use "associated objects" with TStringList, I started to implement // lists for names (TString) and values (TFPList). This builds a kind of flexible record type, I called "Struct" because the name "Reco

[fpc-pascal] stuck with untyped pointer

2010-05-28 Thread spir ☣
Hello, While waiting for more information about how to use "associated objects" with TStringList, I started to implement // lists for names (TString) and values (TFPList). This builds a kind of flexible record type, I called "Struct" because the name "Record" is not available ;-) Values are in

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] fpweb fcgi: auto shutdown feature

2010-05-28 Thread Michael Van Canneyt
On Fri, 28 May 2010, Bee Jay wrote: Hi all, After a bit studying fpWeb package, especially the FCGI application, I have a feature request to it. Would you (Joost? Michael?) please add auto shutdown (after some idle time) feature to TFCGIApplication? If you had looked at ExtPascal's FCGI im

[fpc-pascal] fpweb fcgi: auto shutdown feature

2010-05-28 Thread Bee Jay
Hi all, After a bit studying fpWeb package, especially the FCGI application, I have a feature request to it. Would you (Joost? Michael?) please add auto shutdown (after some idle time) feature to TFCGIApplication? If you had looked at ExtPascal's FCGI implementation, it offers this feature. Thi

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

Re: [fpc-pascal] FPC bug or brain bug ?

2010-05-28 Thread Yann Bat
> It is allowed in Delphi and TP because they allow declaring typed constants > of objects. Exactly what I wanted to use. I'll have to use constructors so. Thank you for your help. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://list