January 15, 2004
This code compiles and delivers the right result
<code>
import std.regexp;
import std.string;

void main()
{
  RegExp octDigit=new RegExp("[0-7]",null);
  char[] s="1234";
  char[] o;

  o=format("%d %s\n",octDigit.test(s[2..4]),s[2..4]);
  printf(o);
  o=format("%d %s\n",octDigit.test(s[1..4]),s[1..4]);
  printf(o);
  o=format("%d %s\n",octDigit.test(s[0..4]),s[0..4]);
  printf(o);
}
</code>


But changing the order of evaluation:
<code>
import std.regexp;
import std.string;

void main()
{
  RegExp octDigit=new RegExp("[0-7]",null);
  char[] s="1234";
  char[] o;

  o=format("%d %s\n",octDigit.test(s[0..4]),s[0..4]);
  printf(o);
  o=format("%d %s\n",octDigit.test(s[1..4]),s[1..4]);
  printf(o);
  o=format("%d %s\n",octDigit.test(s[2..4]),s[2..4]);
  printf(o);
}
</code>

Leads to: "Internal error: ..\ztc\cgcod.c 2241"


Deleting the superfluos slicing `[0..4]':
<code>
import std.regexp;
import std.string;

void main()
{
  RegExp octDigit=new RegExp("[0-7]",null);
  char[] s="1234";
  char[] o;

  o=format("%d %s\n",octDigit.test(s),s);
  printf(o);
  o=format("%d %s\n",octDigit.test(s[1..4]),s[1..4]);
  printf(o);
  o=format("%d %s\n",octDigit.test(s[2..4]),s[2..4]);
  printf(o);
}
</code>

again compiles but delivers the wrong result `0' at the third
execution:
<protocol>
1 1234
1 234
0 34
</protocol>

So long.
-- 
Fight Spam! Join EuroCAUCE: http://www.euro.cauce.org/ 2EA56D6D4DC41ABA311615946D3248A1