by joe_blaze » November 13th, 2013, 12:27 am
Hi Ajay,
Transferring APL+Win data to the C# domain of a CSE instance requires that the creation of a compatible recipient variable on the C# side to contain the APL+Win data.
Execution of a C# method and transfer of data from APL+Win to C# are separate operations.
Here are some ways to accomplish the intent of your example:
[]cse 'ExecStmt' 'Int32 a =0; Int32 b=0; Int32 c=0;'
[]cse 'SetValue' 'a' 123
[]cse 'SetValue' 'b' 456
[]cse 'SetValue' 'c' 789
[]cse 'GetValue' 'add(a,b,c)'
or
[]cse 'ExecStmt' 'Int32[] x = new Int32[]{};'
[]cse 'SetValue' 'x' (123 456 789)
[]cse 'GetValue' 'add(x[0], x[1], x[2])'
or
[]cse 'GetValue' 'add(123, 456, 789)'
The syntax you are requesting: something like: []cse 'GetValue' 'add(a,b,c)' 123 456 689, would require that APL+Win perform parsing of an C# executable statement.
The APL+Win interpreter would have to duplicate all the parsing technology of C# and the .Net Framework.
That is because the C# debugger and compilier only accept valid C# executable statements.
In your example APL+Win would have to convert: []cse 'GetValue' 'add(a,b,c)' 123 456 789 to a valid C# executable statement: []cse 'GetValue' 'add(123,456,789)'.
That analysis by APL+Win may seem simple, but there are many more syntactical possibilities in C# which would have to be performed in APL+Win.
In addition if any argument to the C# method (add(,,) in your example) were not a C# data type analogous to an APL+Win data type, some conversion would have to be performed
or some intermediate C# variables would have to be created.
Duplicating the C# parsing engine in APL+Win would mean that every time there is a Microsoft modification to the .Net Framework, the APL+Win interpreter would need modification too.
That is not the intention of the []cse implementation.
Instead the []cse is an interface to the .Net Framework via the C# programming language.
The []cse system function in APL+Win is designed to send valid C# executable statements (unmodified by the APL+Win interpreter) to the C# debugger and compiler.
The CSE in APL+Win has been implemented this way so that no (code breaking) modifications or syntax were required in APL+Win and transparent access to the full .Net Framework is possible in APL+Win.
This means that the []CSE interface to .Net in APL+Win is not a duplication, reduction or cover for .Net functionality.
APL+Win exposes the full .Net Framework, but APL+Win is not integrated with the .Net Framework (i.e. it is not modified to suit the .Net Framework).
VisualAPL supports the C# syntax that you are requesting in a very direct and simple way,
e.g. in VisualAPL one could just type: add(123, 456, 789) [Enter] and get the result.
That's because VisualAPL is integrated with .Net, VisualAPL has direct access to the C# debugger and compiler and
VisualAPL is a modified form of APL which has numerous additional syntactical options not found in traditional APL, including comma-separated arguments to VisualAPL functions.
Some of the modifications to APL necessary to integrate VisualAPL with the .Net Framework would 'break' traditional APL code.
For APL+Win to have the same benefits of VisualAPL would mean that APL+Win would have to become VisualAPL
with all the modifications to APL which were required in VisualAPL to accommodate the .Net Framework requirements.
The origin of your request is probably a potential parallel in the available syntax for the APL+Win []wi ActiveX interface.
The APL+Win []wi ActiveX interface provides for implied syntactical placeholders and implied intermediate variables between the ActiveX component and APL+Win.
That works with APL+Win and ActiveX because ActiveX components and APL+Win share the same simple data types.
Joe Blaze