Is it possible to return string[,] from a VisualAPL function

General discussions related to APLNext's VisualAPL.

Moderators: Tech Support, phpbb_admin

Is it possible to return string[,] from a VisualAPL function

Postby Chris McIntosh » January 25th, 2011, 3:37 pm

I've been trying to call a VisualAPL function, from C#, with a 2D string array as input, update this input, and then return this updated input array.

There are workarounds, as per this thread - http://forum.apl2000.com/viewtopic.php?t=705. I can return a VisualAPL string array to C# as an object[,], then use ObjectVar[x,y].ToString() to get data out. That works.

But unless it is possible to directly return a string[,] object, it means that every non-VisualAPL program that calls a VisualAPL routine, and wants a 2D string array back, will have to go through extra work to get the data out.

Is it not possible to return a string[,] from VisualAPL? I don't mean the trivial example below:

public static String[,] WantToReturnStringVector(String[,] input)
{
// Return the input.
return input
}

Of course this is possible. I mean the case where ANY operation is done to modify input, or to create a VisualAPL variable which is then INSIDE VisualAPL cast or converted to a string[,] variable and then returned?

I don't want calling programs to have to go to any extra conversion work.

Yes, I realize I could write a wrapper routine in C#, and I will do that if I have to. It seems like a lot of extra work for what seems, on the surface, like it should be an easy thing to do.

Thanks for any help.

Chris
Chris McIntosh
 

Rissue esearch in progress

Postby joe_blaze » January 27th, 2011, 9:20 pm

Hi Chris,

Jairo is researching this issue to see if it is possible to support a simple case from Cvar to string[,]. We will report on our progress shortly.

Thanks for identifying you need so clearly.

Joe
joe_blaze
 
Posts: 382
Joined: February 11th, 2007, 3:09 am
Location: Box 361 Brielle, NJ 08730-0361

Postby Chris McIntosh » January 31st, 2011, 2:50 pm

Hi, Joe,

Thanks very much for looking into this.

In a certain sense, it's unfortunate (for me!) that this is the first thing I tried. If I'd tried using any other input/output type, I suspect I'd have had no problems at all, and gone whizzing along making tons of progress.

Unfortunately, this was the first thing I needed, and I ran into this roadblock.

Even so, as a workaround, I have written a wrapper class, and am using it. I'm finding it's still much, much quicker to use VisualAPL and live with this (perhaps temporary) requirement, than to do work entirely in C#.

If it's any help, I was able to do this in your previous version.

Let me know of any progress you make. Thanks again for looking into this.

Chris
Chris McIntosh
 

Postby Chris McIntosh » January 31st, 2011, 3:17 pm

Hi again, Joe,

One other quick comment.

When you're working on this, I think it is somewhat important to be consistent, if you possibly can be.

What I mean by this, is that string[] is supported in VisualAPL. You can create, return, cast, and do all the things you'd expect. It would be nice if this existing functionality could be extended to string[,] rather than having to do one thing for string[], but then converting cvars to string[,] for the 2D case.

Here's an example of one dimensional vectors of string[] that does work in VisualAPL:

public static String[] WantToCreateStringVector()
{
// Declare variables.
string[] Output

// Initialize the variable. This works just fine in the 1D case.
Outputâ†
Chris McIntosh
 

VisualAPL enhanced

Postby joe_blaze » August 16th, 2011, 2:16 am

This report is resolved by an enhanced version of VisualAPL which has been published for production use. See http://forum.apl2000.com/viewtopic.php?t=710 for details.
joe_blaze
 
Posts: 382
Joined: February 11th, 2007, 3:09 am
Location: Box 361 Brielle, NJ 08730-0361


Return to VisualAPL

Who is online

Users browsing this forum: No registered users and 1 guest

cron