Viewing 1 post (of 1 total)
  • Author
    Posts
  • #30245
    Patrick C
    Participant

    Context
    Before the V8 engine, variables could only be declared with var.
    V8 adds declaration with const and let.

    Issue
    jseeFile1
    jseeFile2#include jseeFile1
    jseeFile3#include jseeFile1, #include jseeFile2

    In jseeFile3 EmEditor’s #include directive is smart enough not to include jseeFile1 twice, but only with respect to declarations with function and var.

    It appears that EmEditor’s #include directive has not yet been updated to treat declarations with const and let the same way as it treats var.

    Detailed example
    jseeFile1_params.jsee

    #language = "V8"
    #async = "off"
    
    var defaultVal = "Hello!";   // «const» & «let» fail; «var» works

    jseeFile2_functions.jsee

    #language = "V8"
    #async = "off"
    #include "jseeFile1_params.jsee"
    
    function greet(greeting = defaultVal) {
      alert(greeting);
    }

    jseeFile3_main.jsee

    #language = "V8"
    #async = "off"
    #include "jseeFile1_params.jsee"
    #include "jseeFile2_functions.jsee"
    
    status = "defaultVal = " + defaultVal;
    greet();

    In jseeFile1_params.jsee
    Changing var defaultVal = "Hello!";
    To let defaultVal = "Hello!";
    or const defaultVal = "Hello!";
    results in jseeFile3_main.jsee no longer working.

    In this simple example the workaround is to not include jseeFile1 in jseeFile3_main, but this can get tricky once the dependencies get more complex.

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.