I start programming with pick and multivalue databases and I have a question, can arguments in subroutine be optional??
--
You received this message because you are subscribed to
the "Pick and MultiValue Databases" group.
To post, email to: mvd...@googlegroups.com
To unsubscribe, email to: mvdbms+un...@googlegroups.com
For more options, visit http://groups.google.com/group/mvdbms
---
You received this message because you are subscribed to the Google Groups "Pick and MultiValue Databases" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mvdbms+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mvdbms/06a9e18d-c04d-4d29-9361-cd6700b8177fn%40googlegroups.com.
If most of the routines are going to be fine not passing in the value you can instead write another version of the subroutine that takes 2 parameters and make this the real subroutine. Then in the version with a single parameter, change it to a single line routine that calls the 2 param version with the 2nd param defaulted.
Now you can choose to use the single param or 2 param version but the single param version is really just calling the 2nd param version. This way you have the logic in just one place.
From: mvd...@googlegroups.com <mvd...@googlegroups.com>
On Behalf Of Marcin Kusmirek
Sent: Wednesday, June 28, 2023 2:49 AM
To: Pick and MultiValue Databases <mvd...@googlegroups.com>
Subject: Re: [mvdbms] Optional arguments in subroutine
Hi , I have a subroutine with one parameter and I need to add a new parameter . Unfortunately, I have to add this parameter to all calls . Thanks wtorek, 27 czerwca 2023 o 21:43:32 UTC+2 Brian Speirs napisał(a): As always, there are exceptions. OpenQM allows subroutines to be declared with a VAR.ARGS parameter, which means that you do not have to pass all the declared arguments: SUBROUTINE name { ( arg1 { , arg2 ...} ) { VAR.ARGS }} Not only that, the arguments can be given default values in the
|
External Sender This email was sent from outside your organization. Reply only if you know this sender and trust the content. |
Hi , I have a subroutine with one parameter and I need to add a new parameter . Unfortunately, I have to add this parameter to all calls .
Thanks
wtorek, 27 czerwca 2023 o 21:43:32 UTC+2 Brian Speirs napisał(a):
As always, there are exceptions. OpenQM allows subroutines to be declared with a VAR.ARGS parameter, which means that you do not have to pass all the declared arguments:
SUBROUTINE name { ( arg1 { , arg2 ...} ) { VAR.ARGS }}
To view this discussion on the web visit https://groups.google.com/d/msgid/mvdbms/cee53c90-18da-4eb5-ac22-d971d460d021n%40googlegroups.com .
Specifically for UniVerse, I implemented hashmaps that will let you do something similar except you use a single dimensioned array and then you can pass as many key value pairs as you like and they can be anything themselves. It removes the need to juggle the raise and lowers.
You can see it in action under the Hashmap Subroutines.
From: mvd...@googlegroups.com <mvd...@googlegroups.com>
On Behalf Of Mike Preece
Sent: Wednesday, June 28, 2023 4:59 AM
To: Pick and MultiValue Databases <mvd...@googlegroups.com>
Subject: Re: [mvdbms] Optional arguments in subroutine
One technique to bear in mind, although it might not be applicable in your case, is to code subroutines to have two arrays as arguments. One is a list of variable names and the other a corresponding list of variable values. That allows for total flexibility.You might have to use LOWER and RAISE instructions to allow for sending items as attributes, attributes as values, values as subvalues, and use char(251)s to separate subvalues within the value argument. On Wednesday, June 28, 2023 at 9:40:53
|
External Sender |
|
This email was sent from outside your organization. Reply only if you know this sender and trust the content. |
One technique to bear in mind, although it might not be applicable in your case, is to code subroutines to have two arrays as arguments. One is a list of variable names and the other a corresponding list of variable values. That allows for total flexibility.You might have to use LOWER and RAISE instructions to allow for sending items as attributes, attributes as values, values as subvalues, and use char(251)s to separate subvalues within the value argument.
On Wednesday, June 28, 2023 at 9:40:53 AM UTC+1 marcin_...@interia.pl wrote:
Hi , I have a subroutine with one parameter and I need to add a new parameter . Unfortunately, I have to add this parameter to all calls .
Thanks
wtorek, 27 czerwca 2023 o 21:43:32 UTC+2 Brian Speirs napisał(a):
As always, there are exceptions. OpenQM allows subroutines to be declared with a VAR.ARGS parameter, which means that you do not have to pass all the declared arguments:
SUBROUTINE name { ( arg1 { , arg2 ...} ) { VAR.ARGS }}
To view this discussion on the web visit https://groups.google.com/d/msgid/mvdbms/661b9119-c6c8-42ac-830a-0ba7851821bdn%40googlegroups.com .
DIRECT SENDER IS HERE LETS DEAL.
Dane Christian Neilson
MT103/202 DIRECT WIRE TRANSFER
PAYPAL TRANSFER
CASHAPP TRANSFER
ZELLE TRANSFER
TRANSFER WISE
WESTERN UNION TRANSFER
BITCOIN FLASHING
BANK ACCOUNT LOADING/FLASHING
IBAN TO IBAN TRANSFER
MONEYGRAM TRANSFER
SLBC PROVIDER
CREDIT CARD TOP UP
SEPA TRANSFER
WIRE TRANSFER
GLOBALPAY INC US
Thanks.
NOTE; ONLY SERIOUS / RELIABLE RECEIVERS CAN CONTACT.
DM ME ON WHATSAPP FOR A SERIOUS DEAL.
+14234753476
To view this discussion on the web visit https://groups.google.com/d/msgid/mvdbms/b2a2ef17-bc35-4e3a-8f38-47cb9c21f902n%40googlegroups.com.