Quirky behaviour that I can't explain [SEC=UNCLASSIFIED]

From: Griffith Young <G.Young_at_nyahnyahspammersnyahnyah>
Date: Mon Jan 09 2012 - 23:55:40 MST

The following code in NCL generates an error on the second call to get_xx(). Why?

;-------------------------------------------------------------------

undef("get_x")
function get_x(x:string)
begin
return x
end

undef("get_xx")
function get_xx()
begin
return get_x("x")
end

print(get_xx())

print(get_xx())

;-------------------------------------------------------------------

I suspect that it is because the string ceases to exist for the second call, but I don't understand why.

;-------------------------------------------------------------------

undef("get_x")
function get_x(x:string)
begin
return (/ x /)
end

;-------------------------------------------------------------------

Wrapping the argument in braces fixes the problem.

Regards,
  Griffith Young.
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jan 9 23:55:53 2012

This archive was generated by hypermail 2.1.8 : Wed Jan 18 2012 - 09:21:55 MST