Florian Klaempfl het geskryf:
http://en.wikipedia.org/wiki/Factory_method_pattern
Sorry for the sarcasm,
Sarcasm? For sarcasm, you need to have a clue.
No need to be rude.
Maybe I can chip in, because design patterns are right up my alley. Maybe
you forgot, but a design pattern is not a
Vinzent Höfler schrieb:
Florian Klaempfl flor...@freepascal.org:
Vinzent Höfler schrieb:
Florian Klaempfl flor...@freepascal.org:
Graeme Geldenhuys schrieb:
This compiler change will play havoc on the Simple Factory
Method
design
pattern as well - a base class is used as the
Graeme Geldenhuys schrieb:
Florian Klaempfl het geskryf:
http://en.wikipedia.org/wiki/Factory_method_pattern
Sorry for the sarcasm,
Sarcasm? For sarcasm, you need to have a clue.
No need to be rude.
Maybe I can chip in, because design patterns are right up my alley. Maybe
you forgot,
Florian Klaempfl wrote:
... and one uses normally a function and not a var/out parameter.
That also would need a typecast since the function would return a parent
class of the real class that was created, but the somehow the callee
knows it's a descendent, so needs a cast to get to it (or
Micha Nelissen schrieb:
Florian Klaempfl wrote:
... and one uses normally a function and not a var/out parameter.
That also would need a typecast since the function would return a parent
class of the real class that was created, but the somehow the callee
knows it's a descendent, so needs
Graeme Geldenhuys schrieb:
On 18 May 2010 10:12, Florian Klaempfl wrote:
- it is one of the basic programming principles: if a result is returned
by a subroutine, use a function
The function might return a boolean (success/fail), or an error code
etc.. The function result doesn't need to
Florian Klaempfl flor...@freepascal.org:
Nobody doubts this, this is also why I wrote normally in my initial
post. Nevertheless I didn't see a single valid reason yet why
implementing the factory method pattern cannot be done using a function:
- it is one of the basic programming principles:
On Tue, May 18, 2010 at 11:52, Florian Klaempfl flor...@freepascal.org wrote:
Maybe (and really only maybe) the proper solution in this case are C++
styled template methods.
Different languages deal with this problem in different ways:
- C++ (Java) have powerful enough template (generics)
Vinzent Höfler het geskryf:
types needing no finalization, so the compiler should not insert
finalization code when classes are involved (despite of the history of
out coming from reference counted COM objects or whatever).
I don't understand this finalization thing about out parameters
Vinzent Höfler schrieb:
Florian Klaempfl flor...@freepascal.org:
Nobody doubts this, this is also why I wrote normally in my
initial post. Nevertheless I didn't see a single valid reason yet
why implementing the factory method pattern cannot be done using a
function: - it is one of the
Vinzent Höfler schrieb:
was allowed and this code is simply broken, the compiler has to
complain and this was fixed.
Agreed. But in that case a function result of type tc1 wouldn't be
allowed to be assigned to tc3 either. So your previous statement
(use a function instead) didn't make too
On 18 May 2010, at 15:25, Vinzent Höfler wrote:
But that wasn't the problem. The problem I mean is that:
procedure p (out c : tc2)
begin
c := tc3.create;
end;
var
c1 : tc1;
begin
p(c1);
end.
seems not to be allowed anymore.
I guess you mean tc2.create instead of tc3.create. You're
Jonas Maebe schrieb:
It does not apply in the case of classes. Finalisation is only inserted,
at the caller side (hence, where the exact type is known), in case of
reference counted types.
Actually automated types as well (variants).
___
fpc-devel
Florian Klaempfl flor...@freepascal.org wrote:
Nobody doubts this, this is also why I wrote normally in my initial
post. Nevertheless I didn't see a single valid reason yet why
implementing the factory method pattern cannot be done using a function:
- it is one of the basic programming
On Tue, May 18, 2010 at 3:39 AM, Graeme Geldenhuys
graemeg.li...@gmail.com wrote:
Florian Klaempfl het geskryf:
http://en.wikipedia.org/wiki/Factory_method_pattern
Sorry for the sarcasm,
Sarcasm? For sarcasm, you need to have a clue.
No need to be rude.
At first I thought it was rude too.
On Monday 17 May 2010 22:22:13 Den Jean wrote:
Hi,
I am investigating why Qt on armel has problems.
I think that one of the problems is
that when c-functions are called from
pascal that the parameters are not passed
correctly (or not as I expected and accommodated for).
On Tuesday 18
Florian Klaempfl flor...@freepascal.org:
Vinzent Höfler schrieb:
Florian Klaempfl flor...@freepascal.org:
With a function result one can easily use the as-operator.
Yes, and then instead of doing the undefined behaviour thingie, it would
cause an RTE instead. Not much of an improvement,
Florian Klaempfl flor...@freepascal.org:
Vinzent Höfler schrieb:
was allowed and this code is simply broken, the compiler has to
complain and this was fixed.
Agreed. But in that case a function result of type tc1 wouldn't be
allowed to be assigned to tc3 either. So your previous
On 18 May 2010, at 20:06, Vinzent Höfler wrote:
Florian Klaempfl flor...@freepascal.org:
Vinzent Höfler schrieb:
Florian Klaempfl flor...@freepascal.org:
With a function result one can easily use the as-operator.
Yes, and then instead of doing the undefined behaviour thingie, it would
Jonas Maebe jonas.ma...@elis.ugent.be:
On 18 May 2010, at 15:25, Vinzent Höfler wrote:
But that wasn't the problem. The problem I mean is that:
procedure p (out c : tc2)
begin
c := tc3.create;
end;
var
c1 : tc1;
begin
p(c1);
end.
seems not to be allowed
Until a few moments ago i would say yes because it seems logical and fpc
raises an exception when trying to set the value programatically.
But while investigating why TAutoIncField.ReadOnly always returns false,
i found that, regardless of FReadOnly being set to true in the
constructor, this
Jonas Maebe jonas.ma...@elis.ugent.be:
On 18 May 2010, at 20:06, Vinzent Höfler wrote:
Florian Klaempfl flor...@freepascal.org:
Vinzent Höfler schrieb:
Florian Klaempfl flor...@freepascal.org:
With a function result one can easily use the as-operator.
Yes, and then instead
22 matches
Mail list logo