It appears that the compiler does not like a $INSERT to be on the first line -
If I compile this -
FUNCTION DEMOTE (FIELD, DUMMY)
_ $INSERT ARGNOSIS_INSERTS, ARRAY_PROMOTION
_ DEMOTED=FIELD
_ CONVERT PROMOTED_ARRAY@ TO DEMOTED_ARRAY@ IN DEMOTED
RETURN DEMOTED
I get this error message -
B102: Line 2. Illegal Statement: $INSERT ARGNOSIS_INSERTS,ARRAY_PROMOTION.
If I compile this -
FUNCTION DEMOTE (FIELD, DUMMY)
**
_ $INSERT ARGNOSIS_INSERTS, ARRAY_PROMOTION
_ DEMOTED=FIELD
_ CONVERT PROMOTED_ARRAY@ TO DEMOTED_ARRAY@ IN DEMOTED
RETURN DEMOTED
It compiles just fine.
P.S. Note the astute use of the DUMMY argument
P.S. Note the astute use of the DUMMY argument
Why was that necessary?
Off the top of my head, two reasons
1. I like DUMMY arguments so much that I can foresee Revtech enforcing
255 arguments per Subroutine (and 254 for Functions of course),
so I am including a DUMMY argument in ALL calls.
2. The dummy argument allows me to extend the language syntax.
E.g.
The DIRLIST function can now be both local and global -
_ DECLARE SUBROUTINE DIRLIST
_ FILES=DIRLIST()
_ ECHIDNAS=DIRLIST(DUMMY)
Wow!
That is
DECLARE FUNCTION DIRLIST, not SUBROUTINE - sorry about that
Peter,
By Odin, you're right.
An empty line also does the trick. That's what's kept me from discovering it. I always have an empty line after the function or subroutine statement.
Btw - here's something else the compiler doesn't like: a comment line between begin case and the first case.
- Oystein -
Peter,
That's a relief. I feared you'd taken my ramblings about dummy arguments a month ago seriously.
![]()
- Oystein -
—– DUMMY header ——–
I enjoy a productive argument.
I like the topic.
—– DUMMY trailer ——-