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

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Thu Jan 12 2012 - 11:11:55 MST

Hi Griffith,
Sorry for the delay in answering, but I am looking into this problem.
 -dave

On Jan 9, 2012, at 11:55 PM, Griffith Young wrote:

> 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

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jan 12 11:12:09 2012

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