- AuthorPosts
- May 23, 2025 at 2:58 am #30245
Patrick C
ParticipantContext
Before the V8 engine, variables could only be declared withvar
.
V8 adds declaration withconst
andlet
.Issue
jseeFile1
jseeFile2
←#include jseeFile1
jseeFile3
←#include jseeFile1
,#include jseeFile2
In
jseeFile3
EmEditor’s#include
directive is smart enough not to includejseeFile1
twice, but only with respect to declarations withfunction
andvar
.It appears that EmEditor’s
#include
directive has not yet been updated to treat declarations withconst
andlet
the same way as it treatsvar
.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
Changingvar defaultVal = "Hello!";
Tolet defaultVal = "Hello!";
orconst 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.
- AuthorPosts
- You must be logged in to reply to this topic.