Re: [fpc-devel] Language extension: absolute for classes
Marco van de Voort wrote: >> I realize that this is only a 'saving-typing' language extension, but it >> does save significant amounts of typing and would make the code more >> readable (IMHO). > > You can achieve the same with generics ? Specialize a class with =G ? No, because A needs an F, so A has already specialized it. Or I don't understand what you're proposing. Micha ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Language extension: absolute for classes
On Saturday 30 September 2006 12:23, Marco van de Voort wrote: > > I realize that this is only a 'saving-typing' language extension, but it > > does save significant amounts of typing and would make the code more > > readable (IMHO). > > You can achieve the same with generics ? Specialize a class with =G ? Something similar can also be done with interfaces (but in this case, generics is probably a cleaner way to do it) -- Regards, Christian Iversen ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Language extension: absolute for classes
> I realize that this is only a 'saving-typing' language extension, but it > does save significant amounts of typing and would make the code more > readable (IMHO). You can achieve the same with generics ? Specialize a class with =G ? ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Shootout
Daniël Mantione wrote: Op Sat, 30 Sep 2006, schreef Marc Weustink: Daniël Mantione wrote: Hi, Encouraged by Vincent I made an attempt to implement the Chameneos benchmark of the Shootout. ??? Last week I submitted chamenos to shootout and it got accepted. Argh, then we have been double work :) It's only the work of one night, so it might need some improvement (it' isn't faster that the C implementation for instance) Mine neither :/ If people are willing to help, I have some suggestions: Create headers for gmp, so we can use gmp instead my own hacked bigint library. There is an header for gpc, but I don't know how compitable it is to fpc: http://www.mingw.org/cgi-bin/info2html/info2html?(gpc.info)GMP Write a working regexpr engine. The one packages doesn't support looking for expressions that contain a "|" for example "ab|c". Vincent ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Shootout
Op Sat, 30 Sep 2006, schreef Marc Weustink: > Daniël Mantione wrote: > > Hi, > > > > Encouraged by Vincent I made an attempt to implement the Chameneos > > benchmark of the Shootout. > > ??? Last week I submitted chamenos to shootout and it got accepted. Argh, then we have been double work :) > It's only the work of one night, so it might need some improvement (it' > isn't faster that the C implementation for instance) Mine neither :/ Daniël___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel] Language extension: absolute for classes
Hi, I want to bring up the following scenario: (need fixed font) B --> G | | A --> F All are classes, and usually A 'owns' F. So A has a field 'Field' of type F. Now, whenever A creates F, B overrides this (in virtual method or class type) to create a G. The problem now is that every time B wants to access G, it has to typecast Field to G. I want to propose something like: type B = class(A) protected Field: G absolute Field; ... end; Whenever the implementation of methods of B (or descendants of B) accesses Field, the compiler will use type G automatically, so that no typecast is necessary. The compiler option -Criot might be used to check whether the type is actually the suggested type, in extension to the current behaviour where class typecasts are converted to 'as' under usage of this switch. I realize that this is only a 'saving-typing' language extension, but it does save significant amounts of typing and would make the code more readable (IMHO). It would be useful in the LCL: TLCLComponent.FWidgetSetClass which is a metaclasstype, and TWinControl (see wincontrol.inc:2053 for current typecast example), TEdit etc. want to use a descendant metaclasstype. It would also be useful in lNet: TLConnection has a FIterator which is a TLSocket, but descendants can choose to create descendants of TLSocket instead. Opinions ? Micha ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel