<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hello Antoine,<br>
      <br>
      I am answering in the thread:<br>
      <br>
      Le 22/02/2017 à 14:28, <a class="moz-txt-link-abbreviated" href="mailto:antoine.elias@scilab-enterprises.com">antoine.elias@scilab-enterprises.com</a> a
      écrit :<br>
    </div>
    <blockquote
      cite="mid:12b52853c7dbebdfb1f0552bc2060ddd@scilab-enterprises.com"
      type="cite">Hello,
      <br>
      <br>
      After some tests, it seems that Scilab 5 loads in local context
      "sub functions" only when you call the main function.
      <br>
    </blockquote>
    <br>
    yes, the first time that the registered function is used.<br>
    <blockquote
      cite="mid:12b52853c7dbebdfb1f0552bc2060ddd@scilab-enterprises.com"
      type="cite">
      <br>
      with your sample, test1 and testa in the same test1.sci file
      <br>
      genlib -> load -> testa -> KO
      <br>
                     -> test1 -> testa -> OK
      <br>
    </blockquote>
    and then, next calls<br>
    -> testa -> OK<br>
    <br>
    <blockquote
      cite="mid:12b52853c7dbebdfb1f0552bc2060ddd@scilab-enterprises.com"
      type="cite">
      <br>
      In Scilab 6, we load "sub functions" as nested functions of the
      main function.
      <br>
      So they can be called in main function but after the call, they
      are "cleared".
      <br>
      <br>
      It is a regression, </blockquote>
    <br>
    Really?! I am very surprised by this assertion. Some (may be many)
    former native Scilab .sci files have been split to work in this new
    way -- for instance ged.sci embedded many subfunctions that have
    been transfered in as many separated files (and moved to the TCL
    module...). And AFAIRemember, this feature was already discussed in
    2015 on users@ or devs@. So, i believed, and still believe that this
    change is <i>intentional</i>.<br>
    By the way, this new behavior has some advantages. Without it,
    making private functions compels to define them a) inside the
    calling one, and b) at its beginning. This was not very smart
    programming.<br>
    The only way to avoid explicitly defining them at the beginning was
    to exec them (still at the beginning).<br>
    I never run any benchmarks to compare timing of exec()uting an
    external definition file at run time:<br>
    <tt><br>
      function test()</tt><tt><br>
    </tt><tt>  exec("mysubfunction.sci")</tt><tt><br>
    </tt><tt>endfunction</tt><tt><br>
    </tt><br>
    versus compiling an embedded function/endfunction as well at run
    time:<br>
    <tt><br>
      function test()</tt><tt><br>
    </tt><tt>
           function mysubfunction(..)</tt><tt><br>
    </tt><tt>         // Its code</tt><tt><br>
    </tt><tt>    endfunction</tt><tt><br>
    </tt><tt>
      endfunction</tt><tt><br>
    </tt><tt>
    </tt><br>
    A priori, i would say that using an external file laying on the disk
    is slower than compiling things in RAM.<br>
    So, imo, this change was not really expected, but it leads to a
    smarter programming, and likely processes subfunctions in a faster
    way.<br>
    So, why do you say that it is a regression ?<br>
    <br>
    BR<br>
    Samuel<br>
    <br>
  </body>
</html>