Anomalous?

General discussions related to using the C# Script Engine in APL+Win.

Moderators: Tech Support, phpbb_admin

Anomalous?

Postby Ajay Askoolum » April 24th, 2016, 3:09 am

Simple APL+Win variables do not survive the round trip:

Code: Select all
    ∇ Anomalous
[1]   ⍝ Ajay Askoolum
[2]   ⎕cself←'c' ⎕cse 'Init' 'System' 'System.Data'
[3]   ←⎕cse 'ExecStmt' 'using System;'
[4]
[5]   ←⎕cse 'ExecStmt' 'Object x;'
[6]
[7]   ⍝ Are these behaviours expected?
[8]   'Example 1: A literal array of rank 2 does not make the round trip - simple array returns as nested and transposed'
[9]
[10]  ←⎕cse 'SetValue' 'x' (⎕nl 2 3)
[11]  (⎕nl 2 3)≡⎕←⎕cse 'GetValue' 'x'
[12]
[13]  'Example 2: A literal scalar does not make the round trip - scalar returns as vector'
[14]  ←⎕cse 'SetValue' 'x' 'A'
[15]  'A'≡⎕cse 'GetValue' 'x'
    ∇
Is is behaviour expected or is it a bug?
Ajay Askoolum
 
Posts: 884
Joined: February 22nd, 2007, 2:16 am
Location: United Kingdom

Re: Anomalous?

Postby joe_blaze » April 27th, 2016, 10:16 pm

Hi Ajay:

We are researching your report and will report back asap.

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

Re: Anomalous?

Postby joe_blaze » May 30th, 2016, 2:09 pm

Hi Ajay,

Thanks for the report of these issues.

The preservation of the shape of character scalars in the round trip via the CSE 'SetValue' and 'GetValue' can be resolved and will be included in the next version of the CSE.

The non-preservation of the shape of character arrays of rank 2 or greater is a limitation of the Win32 ActiveX interface and is not inherent in the []cse.
This limitation applies to the []wi ActiveX client interface to COM servers as well as the []cse ActiveX client interface to the SignalR server.
Resolving this for []wi and APL+Win as the COM server can be done using the 'apldata' property, because both sides of the interface are APL+Win.
There is no resolution for []wi when the COM server is not APL+Win.
Resolving this for []cse is non-trivial. There is no possibility of changing C#, so using the Win32 ActiveX interface directly as is done now is not a possibility.
It is an interesting issue of which we are aware and will consider some options in a future version of the CSE.

See below for a []wi example which illustrates how the 'apldata' property can be used with []wi and APL+Win on both sides of an ActiveX interface:

⎕wself←'apl'⎕wi 'Create' 'APLW.WSEngine'
⎕wi 'xVisible' 1

⎕wi 'xVariable' 'mat1' (mat1←2 3⍴'abcdef')
mat1Returned←⎕wi 'xVariable' 'mat1'
⍴⎕←mat1⋄⍴⎕←mat1Returned
abc
def
2 3
abc def
2

⎕wi 'xVariable' 'mat2' (mat2←2 3 4⍴'abc')
mat2Returned←⎕wi 'xVariable' 'mat2'
⍴⎕←mat2⋄⍴⎕←mat2Returned
abca
bcab
cabc

abca
bcab
cabc
2 3 4
abca bcab cabc
abca bcab cabc
2 3
⎕wi 'apldata' 1
⎕wi 'xVariable' 'mat1' (mat1←2 3⍴'abcdef')
mat1Returned←⎕wi 'xVariable' 'mat1'
⍴⎕←mat1⋄⍴⎕←mat1Returned
abc
def
2 3
abc
def
2 3
⎕wi 'xVariable' 'mat2' (mat2←2 3 4⍴'abc')
mat2Returned←⎕wi 'xVariable' 'mat2'
⍴⎕←mat2⋄⍴⎕←mat2Returned
abca
bcab
cabc

abca
bcab
cabc
2 3 4
abca
bcab
cabc

abca
bcab
cabc
2 3 4
joe_blaze
 
Posts: 384
Joined: February 11th, 2007, 3:09 am
Location: Box 361 Brielle, NJ 08730-0361


Return to APL+Win & The C# Script Engine

Who is online

Users browsing this forum: No registered users and 18 guests

cron