Re: [fpc-pascal] generics class hierarchy

2010-12-19 Thread David Emerson
> @David: Maybe you can restructure your class hierarchy to something like > this (you'll need to be a bit creative here ^^): heh, no, my solution is to abandon generics :-) I used a find/replace script to make alternate classes with real values. Thanks for all your input, though. Thanks to you

Re: [fpc-pascal] generics class hierarchy

2010-12-19 Thread Honza
2010/12/19 Sven Barth : > While I DO agree with you (after some thinking about the consequences) that > a base class should not be allowed to be specified by a template parameter > (and this is the way it already is), I don't agree with you that the > documentation states this as clearly as you pro

Re: [fpc-pascal] generics class hierarchy

2010-12-19 Thread Sven Barth
On 19.12.2010 13:03, Honza wrote: 2010/12/19 Sven Barth: "There is a single placeholder _T. It will be substituted by a type identifier when the generic class is specialized. The identifier _T *may not be used for anything else than a placehoder*. " According to the documentation I'd say that

Re: [fpc-pascal] generics class hierarchy

2010-12-19 Thread Honza
2010/12/19 David Emerson : Please see my just sent reply to Sven. -- bflm freepascal-bits.blogspot.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] generics class hierarchy

2010-12-19 Thread Honza
2010/12/19 Sven Barth : >> "There is a single placeholder _T. It will be substituted by a type >> identifier when the generic class is specialized. The identifier _T >> *may not be used for anything else than a placehoder*. " >> > > According to the documentation I'd say that it should succeed, bec

Re: [fpc-pascal] generics class hierarchy

2010-12-19 Thread David Emerson
On Sat 18 Dec 2010, Honza wrote: > 2010/12/19 David Emerson : > > type > >  generic gt_box<_t_point,_num> = class (_t_point)   // FAILS :-( > > f_width, f_height : _num; > > end; > > I think it should fail according to the docs, see: > > http://www.freepascal.org/docs-html/ref/refse42.html >

Re: [fpc-pascal] generics class hierarchy

2010-12-19 Thread Sven Barth
On 19.12.2010 08:34, Honza wrote: 2010/12/19 David Emerson: type generic gt_box<_t_point,_num> = class (_t_point) // FAILS :-( f_width, f_height : _num; end; I think it should fail according to the docs, see: http://www.freepascal.org/docs-html/ref/refse42.html "There is a single

Re: [fpc-pascal] generics class hierarchy

2010-12-19 Thread Sven Barth
On 19.12.2010 02:51, David Emerson wrote: Sven Barth wrote: I've now looked at your example code in more detail (I was working the last time I wrote you). Where did you define "_t_point"? I only found a "t_point" in your second mail. _t_point is part of the template list. Eh... yes, I've mi

Re: [fpc-pascal] generics class hierarchy

2010-12-18 Thread Honza
2010/12/19 David Emerson : > type >  generic gt_box<_t_point,_num> = class (_t_point)   // FAILS :-( > f_width, f_height : _num; > end; I think it should fail according to the docs, see: http://www.freepascal.org/docs-html/ref/refse42.html "There is a single placeholder _T. It will be substi

Re: [fpc-pascal] generics class hierarchy

2010-12-18 Thread David Emerson
Sven Barth wrote: > I've now looked at your example code in more detail (I was working the > last time I wrote you). Where did you define "_t_point"? I only found a > "t_point" in your second mail. _t_point is part of the template list. I guess it's a limitation. Conceptually it doesn't seem th

Re: [fpc-pascal] generics class hierarchy

2010-12-18 Thread Sven Barth
On 18.12.2010 22:22, David Emerson wrote: Would you please state your FPC version the next time? (If you have stated I, but I haven't seen it: I'm sorry) Some problems might be fixed in the development version while they aren't in the latest release. I tried with both 2.4.2 and 2.5.1 (fetched v

Re: [fpc-pascal] generics class hierarchy

2010-12-18 Thread David Emerson
> Would you please state your FPC version the next time? (If you have > stated I, but I haven't seen it: I'm sorry) Some problems might be fixed > in the development version while they aren't in the latest release. I tried with both 2.4.2 and 2.5.1 (fetched via svn and compiled. Took me quite s

Re: [fpc-pascal] generics class hierarchy

2010-12-17 Thread Sven Barth
Am 17.12.2010 03:30, schrieb David Emerson: err... my mistake. the error message was referring to a different problem, which I was blind to in my hurry. Sorry for all the messages. I'll shut up now. :) Would you please state your FPC version the next time? (If you have stated I, but I haven't

Re: [fpc-pascal] generics class hierarchy

2010-12-16 Thread David Emerson
err... my mistake. the error message was referring to a different problem, which I was blind to in my hurry. Sorry for all the messages. I'll shut up now. :) On Thu 16 Dec 2010, David Emerson wrote: > Well, I'm guessing generics aren't really ready to be fully used... I'm getting > an error "T

Re: [fpc-pascal] generics class hierarchy

2010-12-16 Thread David Emerson
Well, I'm guessing generics aren't really ready to be fully used... I'm getting an error "There is no method in an ancestor class to be overridden" where the ancestor class was a specialized generic. Doesn't seem very promising for actual use. So I'm abandoning generics for now. Hopefully they'

Re: [fpc-pascal] generics class hierarchy

2010-12-16 Thread David Emerson
I'll give a little more detail... Right now I have these non-generic types: t_point = class f_left, f_top : longint; // so named for descendents // several fields and methods to manage it as I need end; t_box = class (t_point) f_width, f_height : longint; // more fields and methods to

[fpc-pascal] generics class hierarchy

2010-12-16 Thread David Emerson
Hi all, How can I use inheritance with generics? e.g. type generic gt_point<_num> = class ... end; generic gt_box<_tpoint,_num> = class (_tpoint) ... end; The above gives me an error; I've tried some other variations but haven't yet found anything that works Thanks, David