Hi,guys.
   Regarding `prvoide array result`, for common action or sequence action, i 
have implemented in my local, e.g. for this example: 
https://github.com/apache/openwhisk/blob/master/docs/actions.md#creating-action-sequences

I updated the split.js and sort.js like below and invoked successully
```split.js
function main(msg) {
   var separator = msg.separator || /\r?\n/;
   var payload = msg.payload.toString();
   var lines = payload.split(separator);
   return lines;
}
```
And
```sort.js
function main(msg) {
   var lines = msg || [];
   console.log('sort before: ' + lines);
   lines.sort();
   return lines;
}

```



-----Original Message-----
From: "甯尤刚"<ning.youg...@navercorp.com>
To: <dev@openwhisk.apache.org>;
Cc:
Sent: 2022/5/25周三 11:13 (GMT+08:00)
Subject: Re: [discuss] provide array result
 
Hi, Rabbah, good question.
 
1. Why stop at array, why not any other type?
dictionary and array are very common data type in all languages.
It is natural to think of array.
 
2. composition work in that case? 
Since the action is wrote by user, he can control it?
If applied this feature, he can judge the return data by like `isinstanceof`.

-----Original Message-----
From: "Rodric Rabbah"<rod...@gmail.com>
To: <dev@openwhisk.apache.org>;
Cc:
Sent: 2022/5/25周三 09:01 (GMT+08:00)
Subject: Re: [discuss] provide array result
 
Thanks for the proposal - my immediate reaction is that this changes the
programming model in a potentially disruptive way. The function signature
now is dictionary (string->json) in and same type out. This allows
functions to be composed in a sequence because all functions have a uniform
signature. If you admit a different kind of return, the signature of the
function changes. Why stop at array, why not any other type? And how does
composition work in that case?

I'm not saying we shouldn't consider this but rather that it's a bit more
involved.


On Tue, May 24, 2022 at 8:50 PM 甯尤刚 <ning.youg...@navercorp.com> wrote:

> Hi, guys
>
> Currently, openwhisk supports return json object only,
> I wrote a POEM in openwhisk upstream that allows user to write their own
> action which supports array result. e.g. already implmeneted in my local
> env for python, worked well
> ```
> def main(args):
>
>    try:
>
>        name = args.get("name", "World")
>
>        place  = args.get("place", "Naver")
>
>        return ["a", "b"]
>
>    except Exception as e:
>
>        # please handle exception here
>
>        # you can return or hide an error message
>
>        return {"error": str(e)}
> ```
>
> So the result will support object and array both in future.
> refer to: https://github.com/apache/openwhisk/pull/5244
>
> Welcome to give suggestion
>
>
>
> 此电子邮件及其包含的信息将仅发送给上面列出的收件人,必须加以保护,并且可能包含法律或其他原因禁止披露的信息。
> 如果您不是此电子邮件的预期收件人,未经许可,您不得存储、复制、发送、分发或披露它。 禁止存储、复制、发送、分发或披露电子邮件的任何部分。
> 如果此电子邮件发送不正确,请立即联系 NAVER Security(dl_naversecur...@navercorp.com
> )。然后删除所有原件、副本和附件。谢谢您的合作。
> ​
> This email and the information contained in this email are intended solely
> for the recipient(s) addressed above and may contain information that is
> confidential and/or privileged or whose disclosure is prohibited by law or
> other reasons.
> If you are not the intended recipient of this email, please be advised
> that any unauthorized storage, duplication, dissemination, distribution or
> disclosure of all or part of this email is strictly prohibited.
> If you received this email in error, please immediately contact NAVER
> Security (dl_naversecur...@navercorp.com) and delete this email and any
> copies and attachments from your system. Thank you for your cooperation.​
> 

Reply via email to