Comment 3 for bug 997230

Revision history for this message
Dennis Knochenwefel (dennis-knochenwefel) wrote :

Even this doesn't work:

  import module namespace file = "http://expath.org/ns/file";
  declare variable $file := "C:\data.txt";
  let $data := file:read-text($file)
  return $data;
  file:delete($file);

I think that even if scoping worked it wouldn't be sufficient. A user should be able to read data into a global variable and delete a file, no? In this case the user wants materialization in memory not only on windows but also on any other OS, right?

This example throws an error even on linux:

  import module namespace file = "http://expath.org/ns/file";
  declare variable $file := "/home/dknochen/test.txt";
  declare variable $data := ();
  $data := file:read-text($file);
  file:delete($file);
  $data

As the streaming part is hidden from the user, the materialization part could be hidden as well, don't you think? For this we need to identify the operations that force materialization. Would that make sense? Is it feasible?