persistent procedure

Posted by rahul on 15-Aug-2014 15:25

Hi,

 i am a progress beginner and not clear about persistent procedure and its uses.

Can anyone say where it is live project with example

difference between persistent and super procedure

All Replies

Posted by Thomas Mercer-Hursh on 15-Aug-2014 16:16

Running a procedure persistently means that you can then run its public internal procedures from another running procedure i.e., both are available at the same time.  A super procedure is just a special persistent procedure which has been made super so that it extends the name space.   By this I mean that with an ordinary PP containing a IP called X one has to say run X in hPP (where hPP is a handle to the PP).  With an SP, one can just say run X and it will find out where in the super stack it is.

Posted by balaji on 16-Aug-2014 04:41

sorry it quite confusing 

can you say with example code for persistent and super procedure


[collapse]
On Sat, Aug 16, 2014 at 2:47 AM, Thomas Mercer-Hursh <bounce-tamhas@community.progress.com> wrote:
Reply by Thomas Mercer-Hursh

Running a procedure persistently means that you can then run its public internal procedures from another running procedure i.e., both are available at the same time.  A super procedure is just a special persistent procedure which has been made super so that it extends the name space.   By this I mean that with an ordinary PP containing a IP called X one has to say run X in hPP (where hPP is a handle to the PP).  With an SP, one can just say run X and it will find out where in the super stack it is.

Stop receiving emails on this subject.

Flag this post as spam/abuse.


[/collapse]

Posted by Lieven De Foor on 19-Aug-2014 02:23

A persistent procedure can be compared with a class based object.

Just like you "new" an object, you can persistently run a procedure.

The procedure "persists" after the RUN statement (it is still there in memory, and you can run internal procedures in it).

Eg.

DEFINE VARIABLE libraryHandle as HANDLE NO-UNDO.

RUN library.p PERSISTENT SET libraryHandle.

RUN InternalProcedure IN libraryHandle.

Be aware that unlike class based objects, persistent procedures don't get garbage collected when they go out of scope, so you'll have to explicitly delete them to prevent memory leaks:

DELETE PROCEDURE libraryHandle.

Posted by Lieven De Foor on 19-Aug-2014 02:25

And while it might have been interesting at the time, I would advise you not to use super procedures. They only make debugging code harder, and don't favor clean code/design...

Posted by Mike Fechner on 19-Aug-2014 03:24

I do not have the same negative view of persistent procedures and super procedures as Lieven has. I’ve made pretty positive experience with them (also in the ADM2 framework that fully relies on them). When used properly they allow you to structure code pretty much in a similar way as OO would.

But when it comes to a need of writing new code that requires “inheriting” functionality OO (classes) is a much better way to go anyway.

 

Posted by Lieven De Foor on 21-Aug-2014 05:00

I have no problem with persistent procedures, just with using them as super procedure... ;-)

Posted by Thomas Mercer-Hursh on 21-Aug-2014 09:09

Don't you see them as the non-OO version of a STATIC, with all that implies?

Posted by Marian Edu on 21-Aug-2014 12:24

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

not even by far, super procedures can be deleted and one can clean them
out all going through the session/this-procedure supers.

static access is strongly typed, nothing like run x in super where you
don't know/care where the darn procedure in implemented.

persistent/super procedures were great in the pre-oo age, inheritance
could be easily simulated with chain of super procedures just not set
for the session but for the procedure...



On 08/21/2014 05:10 PM, Thomas Mercer-Hursh wrote:
>[collapse] From: Thomas Mercer-Hursh
> Post: RE: persistent procedure
> Posted in: OpenEdge General
> Link: http://community.progress.com/technicalusers/f/26/p/12019/44419.aspx#44419
>
> Don't you see them as the non-OO version of a STATIC, with all that implies?
>
>
> --
> You were sent this email because you opted to receive email notifications when someone created a new thread.
>
> To unsubscribe[collapse] from:
> - ...only this thread, disable notifications at http://community.progress.com/technicalusers/f/26/p/12019/44419.aspx#44419.
> - ...all email notifications from Progress Community, navigate to "Settings", click on the "Email" tab, then under the "Email Configuration" section, set Send Notifications to "No".
>
>


- --
m.edu
keep it simple
http://www.ganimede.ro
http://ro.linkedin.com/in/marianedu
medu@ganimede.ro
mobile: +40 740 036 212
skype: marian.edu
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBAgAGBQJT9ir8AAoJEBZ2TAOnZGSq0pYP/A0I4GEZtwxeUGBNbO2lhjv8
sH73QUqg5+ZyGFLKQ1ZfkDw0k4hpx9osPMMwE55rm4YJlCkicZ8Cm9GF3oauWb1O
dNfj2iOI8Kf1+wqZft5kTPSz+31Y6KRfNnaZ6Jgiba59fOzG+anWPud9WKMdSdjN
8Kmke+AFltBLceDlhjn55qD+rEXeJxjHSarpxF2mNrvNWe+RQ6IRv3gI3ULa9uH/
xz4aBcMelDSeBcgpnckiLVEC4GYJtCy0MA9wUsRPc3YtLJJHthcnu+zNHSokdLgc
wYybe02Y2ymc9Xk9ilkCxsKQCtxo3Hbw5vRZTlMvuONLTvPanwjE2PRNZeQ3h7Yc
B/nquPyj7ranUCGxZba6px7K2H6SaVeF8D3mrpgBL3AuJJivtp73WGs/PLCYzTSh
5XND/YXUzNUi6StZ38myyXPQitvCrN8SRB/Eflnw2qudB6uqZ7ej73QbarKHklpV
1mtORcnci6ERleghNco/EWukQH14Jwv7xSHd+YsRrxYJyPnKkPw+v0ZES6YbfyS8
Ur38mRYx97mC5EWweOBKOoQdJKHbt9AUvs7u2Jn3OeI0IqG7t6gsLYX2SEkJKYFC
ooxCPJaPhdqvjek4h2K1WmdHLhU3AECRC27VTg1vq79rFrIDKC7kdegZIo9sxp4f
AWWpfqxcrDIj8XpWsOSO
=0K++
-----END PGP SIGNATURE--[/collapse][/collapse]

Posted by Thomas Mercer-Hursh on 21-Aug-2014 13:18

You know better than to think that I was suggesting that they were equivalent.   I was just exploring Lieven's objection by suggesting that one used them for similar purposes, i.e., extending the name space for common functions.

This thread is closed