procedure name quirk [message #49082] |
Mon, 12 June 2006 17:17 |
rother
Messages: 9 Registered: April 2000
|
Junior Member |
|
|
Dear Gurus,
as I had just failed to keep myself in lurking mode,
I want to come with a funny question (seems to
be difficult to search for by google):
it is possible to write a procedure named '!'.
I'm using one (in *nix) to have 'comment like'
print-statements in toplevel batches and functions
(can be switched of by '!quiet' here...):
PRO !, m
IF !quiet EQ 0 THEN return
help, calls = stack & n = n_elements(stack)
CASE n OF
2: print, '! '+m
ELSE: print, (strtok(stack[1],' ',/ex))[0]+': '+m
ENDCASE
END
looks like
PRO test_bang
!,'very much like a comment'
a = 0
!,'and bye...'
return
END
works as:
(X). .r !.pro
(X). .r test_bang.pro
(X). !,'a toplevel comment'
! a toplevel comment
(X). test_bang
TEST_BANG: like a comment
TEST_BANG: and bye...
(X). !quiet = 0
(X). test_bang
(X).
are there *other* 'special'-characters,
known to allow to be procedure names?
I tried with '+' to get a perlish 'die',
but that didn't work somehow...
best regards,
martin.
--
Martin Rother (rother@gfz-potsdam.de) +331 / 288-1272 Section 2.3
GeoForschungsZentrum Potsdam, Germany
|
|
|