Xojo Conferences
XDCMay2019MiamiUSA

Possible to pass ParamArray argument as a ParamArray? (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: Getting the path to Unix tools in OSX
Next thread: Missing glibc 2.4 error


FolderItem--IsReadable   -   Claude Stone
  Possible to pass ParamArray argument as a ParamArray?   -   Dennis Birch
   Re: Possible to pass ParamArray argument as a ParamArray?   -   David Grogono
   Re: Possible to pass ParamArray argument as a ParamArray?   -   Dennis Birch
   Re: Possible to pass ParamArray argument as a ParamArray?   -   Joe Strout
   Re: Possible to pass ParamArray argument as a ParamArray?   -   Dennis Birch

Possible to pass ParamArray argument as a ParamArray?
Date: 28.07.08 19:23 (Mon, 28 Jul 2008 11:23:42 -0700)
From: Dennis Birch
I'm not having any success in my efforts to pass a ParamArray argument
from one method to another.

In other words, I have one method that has a signature like:

Sub DoSomethingWithAParamArray(postProcess As Boolean, ParamArray args
As String)
// do some stuff

if postProcess Then
PostProcessParamArray args
end if
End Sub

Sub PostProcessParamArray(paramArray args As String)
// do stuff
End Sub

But I get a compile time error that "Parameters are not compatible
with this function", pointing at the "args" parameter in
DoSomethingWithAParamArray.

I tried concatenating args into a comma-delimited list in
DoSomethingWithAParamArray, but that passed a single parameter.

Is there a way to accomplish passing a ParamArray argument?

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Possible to pass ParamArray argument as a ParamArray?
Date: 28.07.08 19:40 (Mon, 28 Jul 2008 13:40:37 -0500)
From: David Grogono

On Jul 28, 2008, at 1:23 PM, Dennis Birch wrote:

> I'm not having any success in my efforts to pass a ParamArray argument
> from one method to another.
>
> In other words, I have one method that has a signature like:
>
> Sub DoSomethingWithAParamArray(postProcess As Boolean, ParamArray args
> As String)
> // do some stuff
>
> if postProcess Then
> PostProcessParamArray args
> end if
> End Sub
>
> Sub PostProcessParamArray(paramArray args As String)
> // do stuff
> End Sub
>
> But I get a compile time error that "Parameters are not compatible
> with this function", pointing at the "args" parameter in
> DoSomethingWithAParamArray.
>
> I tried concatenating args into a comma-delimited list in
> DoSomethingWithAParamArray, but that passed a single parameter.
>
> Is there a way to accomplish passing a ParamArray argument?

You could try changing the signature of your second method to:
Sub PostProcessParamArray(args() As String)

Best regards, David

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Possible to pass ParamArray argument as a ParamArray?
Date: 28.07.08 19:50 (Mon, 28 Jul 2008 11:50:35 -0700)
From: Dennis Birch
On Mon, Jul 28, 2008 at 11:40 AM, David Grogono <<email address removed>> wrote:

>> Is there a way to accomplish passing a ParamArray argument?
>
> You could try changing the signature of your second method to:
> Sub PostProcessParamArray(args() As String)

Yes, I have considered that. But I'm eventually calling a library
routine, which I would like to not have to corrupt.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Possible to pass ParamArray argument as a ParamArray?
Date: 28.07.08 20:08 (Mon, 28 Jul 2008 13:08:54 -0600)
From: Joe Strout
On Jul 28, 2008, at 12:23 PM, Dennis Birch wrote:

> I'm not having any success in my efforts to pass a ParamArray argument
> from one method to another.

That's because you can't.

> Yes, I have considered that. But I'm eventually calling a library
> routine, which I would like to not have to corrupt.

Library routines should either not take ParamArrays, or should be
overloaded to take both a ParamArray and a regular array (and the
former can simply call through to the latter).

Best,
- Joe

Re: Possible to pass ParamArray argument as a ParamArray?
Date: 28.07.08 20:14 (Mon, 28 Jul 2008 12:14:51 -0700)
From: Dennis Birch
On Mon, Jul 28, 2008 at 12:08 PM, Joe Strout <<email address removed>> wrote:

> Library routines should either not take ParamArrays, or should be overloaded
> to take both a ParamArray and a regular array (and the former can simply
> call through to the latter).

As usual, a great solution. Thanks!

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>