Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread TServerRequest.Reset request
Thu, Nov 24 2016 9:47 AMPermanent Link

Matthew Jones

Could TServerRequest.Reset be made public please? I am making myself a request manager, and it needs to be able to ask a request to reset back to start. I can't see any harm in it being public.

Thanks!

--

Matthew Jones
Mon, Nov 28 2016 1:11 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< Could TServerRequest.Reset be made public please? I am making myself a request manager, and it needs to be able to ask a request to reset back to start. I can't see any harm in it being public. >>

The short answer is "no". Smile

The long answer is:

Make a TServerRequest descendant class in your request manager unit:

TMyServerRequest = class(TMyRequest)
  end;

Then you'll be able to call it from your request manager class in the same unit.

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Nov 29 2016 7:49 AMPermanent Link

Matthew Jones

Tim Young [Elevate Software] wrote:

> The short answer is "no". Smile

What would be the harm in it? I can't see why it would be a problem as a public thing to be able to reset any request. Sure, if you do it to a request from a RequestQueue then kerboom, but you could manually change it anyway just the same.

--

Matthew Jones
Tue, Nov 29 2016 8:44 AMPermanent Link

Michael Dreher

"Matthew Jones" wrote:

  /// Tim Young [Elevate Software] wrote:
  ///
  /// > The short answer is "no". Smile
  ///
  /// What would be the harm in it? I can't see why it would be a problem as a public thing....

Changing the visibility of members/fields would have an impact on my component derived from TServerRequest. Users of my component (programmers) would be allowed to do thinks I've not considered at the time creating the component.

TServerRequest.Reset is protected. You can derive from it so you call Reset directly, customizing your component. On the other side, it's not possible to derive from a component and "hide" an inherited public member  (in the WebBuilder pascal) from outside calling.

TBase = class
public
 procedure Foo; virtual;
end;

TDerived = class(TBase)
private
 procedure Foo; override; // [Error] Unit1.wbs (17,13): The Foo method has a lower scope than its ancestor method
end;

Michael Dreher
Tue, Nov 29 2016 10:58 AMPermanent Link

Raul

Team Elevate Team Elevate

On 11/29/2016 7:49 AM, Matthew Jones wrote:
> What would be the harm in it? I can't see why it would be a problem as a public thing to be able to reset any request. Sure, if you do it to a request from a RequestQueue then kerboom, but you could manually change it anyway just the same.

Just that - this function should only be called when you "know" its safe
to do so (GetNewRequest is only place this is called in framework and
there is plenty of logic there to ensure it's in known available idle
state).

So if you're writing your own queue manager then it's absolutely trivial
to make a custom descendant and do what you want - however you take full
responsibility for this working.

Classes should have minimum public surface IMHO for a good long term
maintenance.

Raul

Wed, Nov 30 2016 4:27 AMPermanent Link

Matthew Jones

Raul wrote:

> Just that - this function should only be called when you "know" its safe to do so

Harumph. 8-)  Okay, I'll accept your arguments on this. And make the major commitment to make my own override. Which I already have actually, so it is one line, but I'll go kicking and screaming. 8-)


--

Matthew Jones
Image