SubString inconsistancy

For questions and postings not covered by the other forums
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

SubString inconsistancy

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:08 pm

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];

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: SubString inconsistancy

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:08 pm

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];

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: SubString inconsistancy

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:08 pm

by . >> Mon, 21 May 2007 23:46:38 GMT

Thanks Dean - that explains it ...


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 7 guests