Not sure that it is all that generally useful. With the VariableReference
enhancement, it is something easily added as an external routine if you
truly want do do this.

Rick

On Fri, Sep 7, 2018 at 11:00 AM Rony G. Flatscher <rony.flatsc...@wu.ac.at>
wrote:

> On 05.09.2018 15:23, Rick McGuire wrote:
>
> On Wed, Sep 5, 2018 at 9:21 AM Rony G. Flatscher <rony.flatsc...@wu.ac.at>
> wrote:
>
>>
>> ... cut ...
>
> It would allow for assigning the content of an array to multiple variables
>> in one statement as is a
>> feature of the Rexx PARSE keyword statement, adjusting for ooRexx array
>> objects and semantics (like
>> using .nil not an empty string if referring to a non existent item as
>> ooRexx users would expect etc.).
>>
>> One application of this would allow conceptually to implement the multi
>> return idea, if an array
>> gets returned that will be parsed according to the template and assigned
>> to the variables in the
>> template in one single statement.
>>
>
> As a general multiple assignment solution, adding this to the PARSE
> instruction does not make sense, since it
> would only allow assignment of string values. PARSE always coerces the
> object being parsed into a string first.
>
> Rick
>
>
> It has not occurred to me that the PARSE keyword statement would imply to
> work on string values only.
>
> Thinking about this for some time now, how about the following: Object
> Rexx introduced the "USE ARG" statement which in order to allow for
> assigning the references to the argument objects, which was not possible
> with "PARSE ARG", which works on the string values of the argument objects
> only. The new ooRexx "USE" keyword statement was later extended with the
> useful "USE LOCAL" variant.
>
> So, how about the idea of introducing another new variant "USE ARRAY arr
> var1, var2, var3, ..." instead to allow for multiple assigments?
>
> A program might then look like (just a sketch, details would have to be
> defined):
>
>     myArr=test()    -- routine returns an array
>
>     USE ARRAY myArr one, two, , four -- assign array items to variables
>
>     say "one->"one", two->"two", four->"four
>
>     ::routine test  -- returns an array
>       return "eins", "due", "troi", "four", "pet"  -- multi-return
>
>
> This would yield:
>
>     one->eins, two->due, four->four
>
> What do you think about such a USE variant?
>
> ---rony
>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Oorexx-devel mailing list
> Oorexx-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to