Re: [fpc-pascal] Implementing Factory Method with Pascal

2015-11-27 Thread Marcos Douglas
On Fri, Nov 27, 2015 at 10:16 PM, Anthony Walter wrote: > if Animal is IBarkable then (Animal as IBarkable).Bark; Your approach is much better, but don't use casting is even better when we working with a true object oriented, because casting is a "procedural command" for the compiler. Marcos Do

Re: [fpc-pascal] Implementing Factory Method with Pascal

2015-11-27 Thread Marcos Douglas
On Fri, Nov 27, 2015 at 10:15 PM, luciano de souza wrote: > If I want to change the type of the instance, better is to use > generics. A factory is only a batch builder of the same objects. OK, but you don't need generics either ;) Marcos Douglas ___ f

Re: [fpc-pascal] Implementing Factory Method with Pascal

2015-11-27 Thread Anthony Walter
type IBarkable = interface(IInterface) ['{B241068F-2ED9-43C7-066B-778B94CB58F9}'] procedure Bark; end; TAnimal = class(IInterface) end; TDog = class(TAnimal, IBarkable) public procedure Live; override; procedure Bark; end; and later ... if Animal is IBarkable then (A

Re: [fpc-pascal] Implementing Factory Method with Pascal

2015-11-27 Thread luciano de souza
Marcos, Your answer and the excelent article of Graeme clarify the question. If I want to change the type of the instance, better is to use generics. A factory is only a batch builder of the same objects. Graeme, your article opened my mind. The mappings and the registers caused me a very strong

Re: [fpc-pascal] Implementing Factory Method with Pascal

2015-11-27 Thread Marcos Douglas
On Fri, Nov 27, 2015 at 7:44 PM, luciano de souza wrote: > If I need to do "TAnimalFactory.create(atDog) as Tdog", perhaps, it > would be better not to use a factory, doing simply "TDog.create". You're right, use simply TDog.Create. Why do you have a factory to create different types of animals (

Re: [fpc-pascal] Implementing Factory Method with Pascal

2015-11-27 Thread Graeme Geldenhuys
On 2015-11-27 21:21, luciano de souza wrote: > I'd like to understand how to implement the Factory Method pattern in Pascal. See my "Simple Factory Pattern" article. I've written about many other design patterns too. http://geldenhuys.co.uk/articles/ Regards, - Graeme - -- fpGUI Toolkit -

Re: [fpc-pascal] [fpc-other] FPC Pestering Peacock (3.0.0) release

2015-11-27 Thread Ralf Quint
On 11/26/2015 7:59 AM, Michael Van Canneyt wrote: Judging by my own behaviour: I think the requirement to log in is a bit too much for people to actually perform an upvote. Well, I did. I even had to sign up (again) to be able to log in first...;-) Ralf --- This email has been checked for vi

Re: [fpc-pascal] Implementing Factory Method with Pascal

2015-11-27 Thread luciano de souza
Yes, it works. But in this case, I don't understand the sense of the pattern. If I need to do "TAnimalFactory.create(atDog) as Tdog", perhaps, it would be better not to use a factory, doing simply "TDog.create". I don't understand if I have implemented the pattern wrongly or if this pattern, beco

Re: [fpc-pascal] Implementing Factory Method with Pascal

2015-11-27 Thread Mattias Gaertner
One solution: var animal: TDog; BEGIN animal := TAnimalFactory.create(atDog) as TDog; try animal.bark; finally animal.free; end; END. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi

[fpc-pascal] Implementing Factory Method with Pascal

2015-11-27 Thread luciano de souza
Hello all, I'd like to understand how to implement the Factory Method pattern in Pascal. In my example, there are four classes: 1. TAnimal - The parent and abstract class; 2. TDog and TCat - The specialized classes; 3. TAnimalFactory - The class which creates instances of animals, having received

Re: [fpc-pascal] FPC 3.0 + MIPS Linux

2015-11-27 Thread Sven Barth
Am 27.11.2015 11:50 schrieb "Juha Manninen" : > I believe there will be more MIPS TV-box class computers in future. Smart TVs are already either ARM or MIPS (both running Linux)... Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.or

Re: [fpc-pascal] FPC 3.0 + MIPS Linux

2015-11-27 Thread Mark Morgan Lloyd
Juha Manninen wrote: According to this : http://forum.lazarus.freepascal.org/index.php/topic,30500.msg194271.html FPC 3.0 MIPS version for Linux works through cross-compilation. It is not mentioned in release notes. Android + MIPS is mentioned. I may buy a MIPS gadget later to see why Lazarus

Re: [fpc-pascal] FPC Pestering Peacock (3.0.0) release

2015-11-27 Thread Jonas Maebe
Juha Manninen wrote on Fri, 27 Nov 2015: How to get ARM Linux version for Raspberry Pi? Nobody built it yet. BTW, you really should improve the download links. Now a user can select his CPU / platform from here: http://www.freepascal.org/download.var It looks good so far. Then he selects

[fpc-pascal] FPC 3.0 + MIPS Linux

2015-11-27 Thread Juha Manninen
According to this : http://forum.lazarus.freepascal.org/index.php/topic,30500.msg194271.html FPC 3.0 MIPS version for Linux works through cross-compilation. It is not mentioned in release notes. Android + MIPS is mentioned. I may buy a MIPS gadget later to see why Lazarus does not work. I belie

Re: [fpc-pascal] [fpc-other] FPC Pestering Peacock (3.0.0) release

2015-11-27 Thread Vincent Snijders
2015-11-26 22:44 GMT+01:00 Jonas Maebe : > On 26/11/15 22:39, Florian Klämpfl wrote: > >> Am 26.11.2015 um 22:31 schrieb Jonas Maebe: >> >>> It just got posted on Slashdot too: >>> >>> http://developers.slashdot.org/story/15/11/26/1544243/free-pascal-compiler-300-is-out-adds-support-for-16-bit-ms-

Re: [fpc-pascal] FPC Pestering Peacock (3.0.0) release

2015-11-27 Thread Juha Manninen
How to get ARM Linux version for Raspberry Pi? BTW, you really should improve the download links. Now a user can select his CPU / platform from here: http://www.freepascal.org/download.var It looks good so far. Then he selects eg. Intel/i386 - FreeBSD. There is a top link for SourceForge which l