felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Derek Baum (JIRA)" <j...@apache.org>
Subject [jira] Created: (FELIX-2337) [gogo] no way to access array[] elements produced by assignment
Date Wed, 12 May 2010 22:00:51 GMT
[gogo] no way to access array[] elements produced by assignment

                 Key: FELIX-2337
                 URL: https://issues.apache.org/jira/browse/FELIX-2337
             Project: Felix
          Issue Type: Bug
          Components: Gogo
            Reporter: Derek Baum
            Assignee: Derek Baum
            Priority: Minor
             Fix For: gogo-0.6.0

the following two alternative assignments, should be equivalent:

x = command args ...

x = (command args ..)

but they are not, if the result is an array:

% x = [a b c] toarray
% $x get 0
IllegalArgumentException: Cannot coerce get[0] to any of []
% x = ([a b c] toarray)
% $x get 0

This is because gogo normally converts any array result into a list (Closure.java:228):

        if (last.result instanceof Object[])
            return Arrays.asList((Object[]) last.result);

but the assignment without () bypasses this conversion, and results in a real array.

I can obviously fix this so that the conversion to a List occurs in all cases, but I was wondering
whether gogo should be performing this conversion in the first place? If the conversion is
not performed, then we'll need to support ($array $index) to access arrays.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message