[comp.lang.rexx] exposing a stem passed as a arguement

ets@wrkgrp.uucp (Edward T Spire) (11/01/90)

The VM/CMS implementation seems to support a syntax which doesn't
look legal with respect to Cowlishaw's definition of the language:

name: arg stem .
      interpret 'procedure expose' stem'.'

Cowlishaw specifies that "(the procedure instruction) must be the
first instruction executed after the call or function invocation",
so how can that arg instruction sit between the procedure name and
the interpreted procedure instruction?

I tried this under Unix and it doesn't work.  What I had to do was

name: interpret 'procedure expose' arg(1)'.'

It's still shakey that this works at all, since one could argue that
the interpret instruction is "between" the label and the procedure
instruction, but I suppose one could also argue that the interpret
instruction isn't actually executed at all, and that it's operand
instruction(s) are.

Can anyone explain why the former works?
Is this kind of thing in common use?
Anybody know how the other implementations stack up on this?
Anybody know of other things that work when the language spec says
they should not?

Any comments would be greatly appreciated.

========================================================================

Ed Spire                           email: ets@wrkgrp.com      (on uunet)
The Workstation Group              voice: 800-228-0255
6300 River Road, Suite 700            or  708-696-4800
Rosemont, Illinois  60018            fax: 708-696-2277

jdege@ (Jeff Dege) (11/01/90)

In article <1990Oct31.173237.895@wrkgrp.uucp> ets@wrkgrp.uucp (Edward T Spire) writes:
>The VM/CMS implementation seems to support a syntax which doesn't
>look legal with respect to Cowlishaw's definition of the language:
>
>name: arg stem .
>      interpret 'procedure expose' stem'.'
>
>Cowlishaw specifies that "(the procedure instruction) must be the
>first instruction executed after the call or function invocation",
>so how can that arg instruction sit between the procedure name and
>the interpreted procedure instruction?
>
>I tried this under Unix and it doesn't work.  What I had to do was
>
>name: interpret 'procedure expose' arg(1)'.'
>
>It's still shakey that this works at all, since one could argue that
>the interpret instruction is "between" the label and the procedure
>instruction, but I suppose one could also argue that the interpret
>instruction isn't actually executed at all, and that it's operand
>instruction(s) are.
>
>Can anyone explain why the former works?
>Is this kind of thing in common use?
>Anybody know how the other implementations stack up on this?
>Anybody know of other things that work when the language spec says
>they should not?
>
>Any comments would be greatly appreciated.
>
  I tried this using Arexx version 1.10 (the Amiga version of REXX, and
got similar behavior.  "name: arg stem; ..." successfully exposed the
stem variable passed, but lost the 'stem' variable inside the routine,
so you couldn't access it.  I.e., with "foo. = 0; call name foo", 
foo. is exposed, but stem is hidden after the procedure command, so
I can't access it.  Using arg(1), it all works fine.
 
  I'd been looking for a way to pass a stem variable to a function,
this may be it.  Seems a bit twisted, though...
 
-------------------------------------

eric@sunic.sunet.se (Eric Thomas SUNET) (11/02/90)

The REXX book only defines things which work in all implementations, or rather
are supposed to. If it says you may not put anything between the label and the
PROCEDURE statement, it means you should expect that this will not work with
all implementations, although it might work with some.

Anyway the construct in question worked on the CMS REXX up to and including
release 5. It does not work with the compiler, and was made invalid by release
6 of the interpreter for compatibility.

  Eric

MADIF@ROHVM1.BITNET (Jim Foster) (11/02/90)

In article <1990Oct31.173237.895@wrkgrp.uucp>, ets@wrkgrp.uucp (Edward T Spire)
says:
>
>The VM/CMS implementation seems to support a syntax which doesn't
>look legal with respect to Cowlishaw's definition of the language:
>
>name: arg stem .
>      interpret 'procedure expose' stem'.'
>
>Cowlishaw specifies that "(the procedure instruction) must be the
>first instruction executed after the call or function invocation",
>so how can that arg instruction sit between the procedure name and
>the interpreted procedure instruction?
>
It depends on the level of REXX implemented.  IBM CMS 5.6 implements
REXX v3.4.  Cowlishaw book (1st Edition) describes 3.5.  IBM OS/2
1.2 EE implements 4.0.  Quoting from the System Product Interpreter
Reference for VM/XA SP 1 and 2 (SC23-0374) page 46:

    "It is suggested that the PROCEDURE instruction should be the
     first instruction executed after the CALL or function invocation
     - that is, it should be the first instruction following the label.
     This is not enforced."

I think the REXX Compiler does enforce this.