Page 1 of 1

SubString inconsistancy

Posted: Fri Aug 07, 2009 1:08 pm
by ConvertFromOldNGs
by . >> Mon, 21 May 2007 22:21:54 GMT

Why does the following script not give an error
vars
str : String;
begin
str := null;
write str[6];


While this one does (as I would expect)?
vars
str : String;
begin
str := 'a';
write str[6];

Re: SubString inconsistancy

Posted: Fri Aug 07, 2009 1:08 pm
by ConvertFromOldNGs
by dcooper@jade.co.nz >> Mon, 21 May 2007 23:03:51 GMT

Quite a while ago now we actually changed JADE so that it raised an exception in the null case. But this caused code in a number of applications to break (they were relying on not getting the exception), so we reverted back to the current behaviour. This behaviour for null strings is consistent across a number of methods (eg: String::pos).

Dean.

<. (JADE Tech General)> wrote in message news:4860@news.jadeworld.com...

Why does the following script not give an error
vars
str : String;begin

str := null;
write str[6];


While this one does (as I would expect)?
vars
str : String;begin

str := 'a';
write str[6];

Re: SubString inconsistancy

Posted: Fri Aug 07, 2009 1:08 pm
by ConvertFromOldNGs
by . >> Mon, 21 May 2007 23:46:38 GMT

Thanks Dean - that explains it ...