Re: [Oorexx-devel] USE ARG default values with references.

2018-04-25 Thread Rony G. Flatscher
Just to make sure that no other misunderstanding occurs: the default value in 
USE ARG has been
used/applied by ooRexx only, if an argument value was left out when invoking 
the routine.

In the current implementation of a variable reference argument must be always 
supplied or otherwise
a runtime error occurs. Hence running:

call test

::routine test
  use arg >a
  a="value from test"
  return

will yield the error:

Error 88 running E:\sandbox_ooRexx\test_a.rex line 4:  Invalid argument.
Error 88.931:  The 1 was omitted. A VariableReference argument is required.

The current implementation will therefore enforce that a variable reference 
value gets always supplied.

---

If a variable reference is supplied, then the argument exists and no defined 
default value should be
applied. Whether the supplied variable reference argument is an alias to an 
uninitialized variable
in the caller or not should not matter, even if that context can be determined.

Hence the current error message for a program like:

say "1. a="a   -- uninitialized variable
call test >a   -- call by VariableReference
say "2. a="a   -- value from assignment in test()

::routine test
  use arg >test="some default value" -- alias the variable reference
  return

yielding the error message:

Error 99 running E:\sandbox_ooRexx\test_b.rex line 6:  Translation error.
Error 99.950:  A USE ARG default value is not allowed for variable 
references.

is therefore the behavior that I would expect.

---

As mentioned, whether the supplied variable reference argument is an alias to 
an uninitialized
variable in the caller or not should not matter. Hence the following program:

say "1. a="a   -- uninitialized variable
call test >a   -- call by VariableReference
say "2. a="a   -- value from assignment in test()

::routine test
  use arg >test-- alias the variable reference
  test="value from test()" -- assign alias variable a new value
  return

yields the expected output:

1. a=A
2. a=value from test()

---

This feature IMHO is very well thought out and extremely helpful e.g. in 
situations where one
creates Rexx packages with closely related/coupled functionality, where in the 
implementations
variable references can help a lot in different use cases, including cases 
where multiple variables
from the caller should be referenced/aliased such that they get directly 
updated in the called routines!

---rony



On 18.04.2018 16:34, Rony G. Flatscher wrote:
> On 17.04.2018 18:53, Rick McGuire wrote:
>> No, you are not understanding the question. If you use 
>>
>> USE ARG >someVar
>>
>> Then the argument is always required.
> If that is the case then I would be surprised that although an argument was 
> supplied
> (unexpectedly) a default value gets applied instead (as you write in your 
> last sentence).
>
> My take, misunderstanding was linked to the expectation that the default 
> value gets applied only,
> if the argument is left out, and then it is just would be a local variable 
> and not a variable
> alias to the caller supplied variable reference. (Expecting that if an 
> argument is supplied, then
> it must be a VariableReference, be it to an initialized or uninitialized one 
> would not matter.)
>
> ---rony
>
>
>> An error will be raised if one is not provided and the reference is not to a 
>> matching type. Right
>> now, if you use ">", the default value expression is not allowed. However, I 
>> was thinking of the
>> situation where the variable being referenced does not have an assigned 
>> value, so it might make
>> sense to initialize that variable to some default value. However, as I was 
>> typing this
>> explanation, I realized that because of the way stem variables are handled, 
>> there would never be
>> a case where a referenced stem variable would not have a backing value, so 
>> it definitely would
>> not apply. 
>>
>> On the other hand, since we know at parsing time what type of variable this 
>> is going to be, it
>> would still be possible to support this for simple variables. My biggest 
>> reservation is that this
>> somewhat redefines the meaning of the default value. 
>>
>> Rick 
>>
>> On Tue, Apr 17, 2018 at 12:33 PM, Rony G. Flatscher > > wrote:
>>
>>
>> On 17.04.2018 16:18, Rick McGuire wrote:
>>> Now that the spelling of the character has been sorted out, does 
>>> anybody have an opinion on
>>> the actual question of this thread?
>>>
>>> Rick
>>>
>>> On Sun, Apr 15, 2018 at 7:45 AM, Rick McGuire >> > wrote:
>>>
>>> I have one additional open issue with my variable references 
>>> prototype, and that's
>>> whether to support a default value or not on USE ARG if aliasing is 
>>> requested.  Right
>>> now I don't support it at all.  
>>>
>>> There is 

Re: [Oorexx-devel] USE ARG default values with references.

2018-04-18 Thread Rony G. Flatscher
On 17.04.2018 18:53, Rick McGuire wrote:
> No, you are not understanding the question. If you use 
>
> USE ARG >someVar
>
> Then the argument is always required.
If that is the case then I would be surprised that although an argument was 
supplied (unexpectedly)
a default value gets applied instead (as you write in your last sentence).

My take, misunderstanding was linked to the expectation that the default value 
gets applied only, if
the argument is left out, and then it is just would be a local variable and not 
a variable alias to
the caller supplied variable reference. (Expecting that if an argument is 
supplied, then it must be
a VariableReference, be it to an initialized or uninitialized one would not 
matter.)

---rony


> An error will be raised if one is not provided and the reference is not to a 
> matching type. Right
> now, if you use ">", the default value expression is not allowed. However, I 
> was thinking of the
> situation where the variable being referenced does not have an assigned 
> value, so it might make
> sense to initialize that variable to some default value. However, as I was 
> typing this
> explanation, I realized that because of the way stem variables are handled, 
> there would never be a
> case where a referenced stem variable would not have a backing value, so it 
> definitely would not
> apply. 
>
> On the other hand, since we know at parsing time what type of variable this 
> is going to be, it
> would still be possible to support this for simple variables. My biggest 
> reservation is that this
> somewhat redefines the meaning of the default value. 
>
> Rick 
>
> On Tue, Apr 17, 2018 at 12:33 PM, Rony G. Flatscher  > wrote:
>
>
> On 17.04.2018 16:18, Rick McGuire wrote:
>> Now that the spelling of the character has been sorted out, does anybody 
>> have an opinion on
>> the actual question of this thread?
>>
>> Rick
>>
>> On Sun, Apr 15, 2018 at 7:45 AM, Rick McGuire > > wrote:
>>
>> I have one additional open issue with my variable references 
>> prototype, and that's
>> whether to support a default value or not on USE ARG if aliasing is 
>> requested.  Right now
>> I don't support it at all.  
>>
>> There is a case for supporting a default value that would be 
>> assigned to the aliased
>> variable if it is currently uninitialized. To me it feels like this 
>> gives a new meaning
>> to the behavior of the default value because technically, the 
>> argument was not omitted.
>> On the other hand, I can see some uses for this. I can go either way.
>>
> If I understand the question correctly it is about handling the case 
> where an argument is left
> out that is supposed to be aliased in cases like, e.g.:
>
>  1. USE ARG >someArg
>  2. USE ARG >someArg=123
>
> If so I would assume/expect in case 1. that "someArg" has not assigned a 
> value. It would be as
> if the ">" operator only gets applied to an argument if an argument was 
> supplied.
>
> In case 2 I would assume/expect that its value would be "123".
>
> In both cases aliasing to another variable would not take place, if the 
> argument was left out.
>
> ---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
> 
>
>
>
>
> --
> 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

-- 
--
__

Prof. Dr. Rony G. Flatscher
Department Informationsverarbeitung und Prozessmanagement
Institut für Betriebswirtschaftslehre und Wirtschaftsinformatik
D2-C 2.086
WU Wien
Welthandelsplatz 1
A-1020  Wien/Vienna, Austria/Europe

http://www.wu.ac.at
__





--
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

Re: [Oorexx-devel] USE ARG default values with references.

2018-04-17 Thread Rick McGuire
No, you are not understanding the question. If you use

USE ARG >someVar

Then the argument is always required. An error will be raised if one is not
provided and the reference is not to a matching type. Right now, if you use
">", the default value expression is not allowed. However, I was thinking
of the situation where the variable being referenced does not have an
assigned value, so it might make sense to initialize that variable to some
default value. However, as I was typing this explanation, I realized that
because of the way stem variables are handled, there would never be a case
where a referenced stem variable would not have a backing value, so it
definitely would not apply.

On the other hand, since we know at parsing time what type of variable this
is going to be, it would still be possible to support this for simple
variables. My biggest reservation is that this somewhat redefines the
meaning of the default value.

Rick

On Tue, Apr 17, 2018 at 12:33 PM, Rony G. Flatscher  wrote:

>
> On 17.04.2018 16:18, Rick McGuire wrote:
>
> Now that the spelling of the character has been sorted out, does anybody
> have an opinion on the actual question of this thread?
>
> Rick
>
> On Sun, Apr 15, 2018 at 7:45 AM, Rick McGuire 
> wrote:
>
>> I have one additional open issue with my variable references prototype,
>> and that's whether to support a default value or not on USE ARG if aliasing
>> is requested.  Right now I don't support it at all.
>>
>> There is a case for supporting a default value that would be assigned to
>> the aliased variable if it is currently uninitialized. To me it feels like
>> this gives a new meaning to the behavior of the default value because
>> technically, the argument was not omitted. On the other hand, I can see
>> some uses for this. I can go either way.
>>
> If I understand the question correctly it is about handling the case where
> an argument is left out that is supposed to be aliased in cases like, e.g.:
>
>1. USE ARG >someArg
>2. USE ARG >someArg=123
>
> If so I would assume/expect in case 1. that "someArg" has not assigned a
> value. It would be as if the ">" operator only gets applied to an argument
> if an argument was supplied.
>
> In case 2 I would assume/expect that its value would be "123".
>
> In both cases aliasing to another variable would not take place, if the
> argument was left out.
>
> ---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
>
>
--
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


Re: [Oorexx-devel] USE ARG default values with references.

2018-04-17 Thread Rony G. Flatscher

On 17.04.2018 16:18, Rick McGuire wrote:
> Now that the spelling of the character has been sorted out, does anybody have 
> an opinion on the
> actual question of this thread?
>
> Rick
>
> On Sun, Apr 15, 2018 at 7:45 AM, Rick McGuire  > wrote:
>
> I have one additional open issue with my variable references prototype, 
> and that's whether to
> support a default value or not on USE ARG if aliasing is requested.  
> Right now I don't support
> it at all.  
>
> There is a case for supporting a default value that would be assigned to 
> the aliased variable
> if it is currently uninitialized. To me it feels like this gives a new 
> meaning to the behavior
> of the default value because technically, the argument was not omitted. 
> On the other hand, I
> can see some uses for this. I can go either way.
>
If I understand the question correctly it is about handling the case where an 
argument is left out
that is supposed to be aliased in cases like, e.g.:

 1. USE ARG >someArg
 2. USE ARG >someArg=123

If so I would assume/expect in case 1. that "someArg" has not assigned a value. 
It would be as if
the ">" operator only gets applied to an argument if an argument was supplied.

In case 2 I would assume/expect that its value would be "123".

In both cases aliasing to another variable would not take place, if the 
argument was left out.

---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


Re: [Oorexx-devel] USE ARG default values with references.

2018-04-17 Thread Rick McGuire
Now that the spelling of the character has been sorted out, does anybody
have an opinion on the actual question of this thread?

Rick

On Sun, Apr 15, 2018 at 7:45 AM, Rick McGuire  wrote:

> I have one additional open issue with my variable references prototype,
> and that's whether to support a default value or not on USE ARG if aliasing
> is requested.  Right now I don't support it at all.
>
> There is a case for supporting a default value that would be assigned to
> the aliased variable if it is currently uninitialized. To me it feels like
> this gives a new meaning to the behavior of the default value because
> technically, the argument was not omitted. On the other hand, I can see
> some uses for this. I can go either way.
>
> One other point I should probably make related to this is that the
> referencing operator (currently spelled "&") does not raise a novalue
> condition if the variable does not have a value. This seems correct to me
> since one would probably be passing the reference to a caller that will be
> returning a value.
>
> Rick
>
--
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


Re: [Oorexx-devel] USE ARG default values with references.

2018-04-16 Thread Mike Cowlishaw
 

carat has some compatibility problems with other Rexx interpreters that
interpreted the carat as a logical not. I'd prefer to stay away from that.
In any event, I just committed the changes to use '>' rather than '&'. 
 

:-)))   Many thanks.
 
Mike 
--
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


Re: [Oorexx-devel] USE ARG default values with references.

2018-04-16 Thread Rony G. Flatscher
On 16.04.2018 16:21, Rick McGuire wrote:
>
>
> On Mon, Apr 16, 2018 at 9:54 AM, Rony G. Flatscher  > wrote:
>
> On 16.04.2018 14:08, Rick McGuire wrote:
>>
>> On Mon, Apr 16, 2018 at 8:04 AM, Mike Cowlishaw > > wrote:
>>
>>  
>>
>> One other point I should probably make related to this is that 
>> the referencing
>> operator (currently spelled "&")   ...
>>  
>>
>> I trust that spelling is still considered an open issue.  :-)
>>  
>> I'm warming to using '>' on both sides .. at least it implies some 
>> sort of movement/look
>> elsewhere.   My second choice would be '*' (as in C).  
>>
>>
>> I could live with '>'. I'm probably as opposed to using '*' as you are 
>> to '&' :-) 
>>
>>  
>> All other characters and character combinations that are currently 
>> not valid as prefix
>> operations could be possibilities, with the exception of '&'...
>>  
>> Mike
>>
> How about using '^' as the operator symbol for "variable reference"?
>
> carat has some compatibility problems with other Rexx interpreters that 
> interpreted the carat as a
> logical not. I'd prefer to stay away from that. In any event, I just 
> committed the changes to use
> '>' rather than '&'.
>
In case someone wants to experiment with this I just created a 64-bit Windows 
version of Rick's
reference sandbox (using '>' rather than '&') which you can download from here:
.

There is a small test script "test_gt.rex" using '>' there as well.

Here

---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


Re: [Oorexx-devel] USE ARG default values with references.

2018-04-16 Thread Rick McGuire
On Mon, Apr 16, 2018 at 9:54 AM, Rony G. Flatscher 
wrote:

> On 16.04.2018 14:08, Rick McGuire wrote:
>
>
> On Mon, Apr 16, 2018 at 8:04 AM, Mike Cowlishaw 
> wrote:
>
>>
>>
>> One other point I should probably make related to this is that the
>> referencing operator (currently spelled "&")   ...
>>
>>
>> I trust that spelling is still considered an open issue.  :-)
>>
>> I'm warming to using '>' on both sides .. at least it implies some sort
>> of movement/look elsewhere.   My second choice would be '*' (as in C).
>>
>
> I could live with '>'. I'm probably as opposed to using '*' as you are to
> '&' :-)
>
>>
>> All other characters and character combinations that are currently not
>> valid as prefix operations could be possibilities, with the exception of
>> '&'...
>>
>> Mike
>>
>> How about using '^' as the operator symbol for "variable reference"?
>
> carat has some compatibility problems with other Rexx interpreters that
interpreted the carat as a logical not. I'd prefer to stay away from that.
In any event, I just committed the changes to use '>' rather than '&'.

Rick




> E.g.:
>
> a = 123
> call foo ^a
> say a  -- displays "124"
>
> ::routine foo
>   use arg ^someVariable
>
>   someVariable += 1
>   return
>
> ---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
>
>
--
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


Re: [Oorexx-devel] USE ARG default values with references.

2018-04-16 Thread Rony G. Flatscher
On 16.04.2018 14:08, Rick McGuire wrote:
>
> On Mon, Apr 16, 2018 at 8:04 AM, Mike Cowlishaw  >
> wrote:
>
>  
>
> One other point I should probably make related to this is that the 
> referencing operator
> (currently spelled "&")   ...
>  
>
> I trust that spelling is still considered an open issue.  :-)
>  
> I'm warming to using '>' on both sides .. at least it implies some sort 
> of movement/look
> elsewhere.   My second choice would be '*' (as in C).  
>
>
> I could live with '>'. I'm probably as opposed to using '*' as you are to '&' 
> :-) 
>
>  
> All other characters and character combinations that are currently not 
> valid as prefix
> operations could be possibilities, with the exception of '&'...
>  
> Mike
>
How about using '^' as the operator symbol for "variable reference"?

E.g.:

a = 123
call foo ^a
say a  -- displays "124"

::routine foo
  use arg ^someVariable

  someVariable += 1
  return

---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


Re: [Oorexx-devel] USE ARG default values with references.

2018-04-16 Thread Rick McGuire
On Mon, Apr 16, 2018 at 8:53 AM, Erich Steinböck  wrote:

> One other point I should probably make related to this is that the
>> referencing operator (currently spelled "&")
>>
>
> Can this maybe done with existing ooRexx syntax?  Like
> `call routine alpha, .Reference~new(beta), gamma` and a simple `use a, b,
> c`
>
> Alternatives to `.Reference~new()` might be `.Alias~new()`or `.Ref[]`or
> such
>

There's a bit of ugliness with trying to do that. The new method never sees
the variable name, only the result of evaluating the variable. That would
require some special mechanism that would somehow make that method a
special case, plus additional magic that would allow the new method to
reach back into the calling context to retrieve the variable reference. One
of the reasons I made the NEW method on VariableReference throw an error
was to prevent situations where resolving a variable did not make sense,
such as in native code.  Using an operator acts as an instruction to the
local context to create a reference and uses minimal amounts of syntax to
do so. We've already seen, for example, that .array~of(1,2,3) is more than
most people want to type, which is why the syntactic sugar array expression
was added for 5.0.0.

As for using the back tick, that really would not work. It's too easily
confused with the other single quote and is almost invisible on some
screens. I actually had to wipe my screen down even to see that that was
what you were proposing.

Rick

>
>
> 
> --
> 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
>
>
--
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


Re: [Oorexx-devel] USE ARG default values with references.

2018-04-16 Thread Erich Steinböck
>
> One other point I should probably make related to this is that the
> referencing operator (currently spelled "&")
>

Can this maybe done with existing ooRexx syntax?  Like
`call routine alpha, .Reference~new(beta), gamma` and a simple `use a, b, c`

Alternatives to `.Reference~new()` might be `.Alias~new()`or `.Ref[]`or such
--
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


Re: [Oorexx-devel] USE ARG default values with references.

2018-04-16 Thread Rick McGuire
On Mon, Apr 16, 2018 at 8:04 AM, Mike Cowlishaw  wrote:

>
>
>
> One other point I should probably make related to this is that the
> referencing operator (currently spelled "&")   ...
>
>
> I trust that spelling is still considered an open issue.  :-)
>
> I'm warming to using '>' on both sides .. at least it implies some sort of
> movement/look elsewhere.   My second choice would be '*' (as in C).
>

I could live with '>'. I'm probably as opposed to using '*' as you are to
'&' :-)

>
> All other characters and character combinations that are currently not
> valid as prefix operations could be possibilities, with the exception of
> '&'...
>
> Mike
>
>
>
> 
> --
> 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
>
>
--
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


Re: [Oorexx-devel] USE ARG default values with references.

2018-04-16 Thread Mike Cowlishaw

 

One other point I should probably make related to this is that the
referencing operator (currently spelled "&")   ...
 

I trust that spelling is still considered an open issue.  :-)
 
I'm warming to using '>' on both sides .. at least it implies some sort of
movement/look elsewhere.   My second choice would be '*' (as in C).   
 
All other characters and character combinations that are currently not valid
as prefix operations could be possibilities, with the exception of '&'...
 
Mike
 
 
--
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