Pellentesque nec neque ex. Aliquam at quam vitae lacus convallis pulvinar. Mauris vitae ullamcorper lacus. Cras nisi dui, faucibus non dolor quis, volutpat euismod massa. Donec et pulvinar erat.
It is a long time ago I did all this but let me see. Ignoring most dogmas, What you're doing here looks about right.
A terrible idea is to expose the internal instance of the interpreter to the higher context using addHostObject. It will stay there in that (more) global context after the first call to include. Simply wrap that reference too somewhere or safely delete it afterwards, otherwise
include'file.js'// CSV8 is now availableCSV8.DestroySystem()
I don't know from memory how V8 responds to setting a host object twice but maybe your code will crash if you make a second call to include. (maaaaybe)
Make sure that you can rely on CSFile.Exists because if it is a direct reference to System.IO.File.Exists which expects a String, ...
include({crash:'boom!'})// this was not expected!
You can wrap it somewhere else but I advise to be lazy like me and put the call to CSFile.Exists it inside a try block of include(). Again, only if needed. I don't know the rest of your program.
Maybe have a look at NiL. I never really liked the extra .dll files of v8, also didn't feel like embedding them or building ClearScript every time I test my code. NiL.js is an ECMAScript evaluator written in C# that understands modern ES6/7/8/9/10 and takes only a second to compile. Not that compiling is needed. It also provides APIs to extend the evaluator with your custom syntax which allowed me to implement an include method function keyword natively into the interpreter. Not for beginners though. In the documentation are some examples, they show you how to add an echo keyword or something. It is platform agnostic in the sense that it runs on Mono.
Programmed Canon Canola calculators in 1977. Assorted platforms and languages ever since. Assisting with HOPL.info.
I am NOT looking for work -- I've got more than enough to do.
Location
Perth, WA Australia
Education
A few diplomas.
Work
Software Engineer at [Daisy Digital](https://daisydigital.com.au/)
They've updated their examples a bit since you were last there. There are custom statements and custom operators at github.com/nilproject/NiL.JS/tree/...
Pellentesque nec neque ex. Aliquam at quam vitae lacus convallis pulvinar. Mauris vitae ullamcorper lacus. Cras nisi dui, faucibus non dolor quis, volutpat euismod massa. Donec et pulvinar erat.
Programmed Canon Canola calculators in 1977. Assorted platforms and languages ever since. Assisting with HOPL.info.
I am NOT looking for work -- I've got more than enough to do.
Location
Perth, WA Australia
Education
A few diplomas.
Work
Software Engineer at [Daisy Digital](https://daisydigital.com.au/)
When I get the readme done and a folder with a couple of samples in, I'll send the link. In the meantime, I've got a an enhanced JavaScript called Lychen ("Lichen" is already taken). For some years my work has been using an enhanced JScript using the same technique. I'm now pursuing V8 as a personal project.
Programmed Canon Canola calculators in 1977. Assorted platforms and languages ever since. Assisting with HOPL.info.
I am NOT looking for work -- I've got more than enough to do.
Location
Perth, WA Australia
Education
A few diplomas.
Work
Software Engineer at [Daisy Digital](https://daisydigital.com.au/)
Pellentesque nec neque ex. Aliquam at quam vitae lacus convallis pulvinar. Mauris vitae ullamcorper lacus. Cras nisi dui, faucibus non dolor quis, volutpat euismod massa. Donec et pulvinar erat.
Hey Bruce, it's been some time since you commented on this article. I went to check out Lychen (again) on GitHub today and noticed your last commit was 29 days ago. May I ask, what do you use Lychen for? Why can't you do it with regular JavaScript? What is the use case? Anyone else using it as far as you know? Cyanobacteria sure but what is the objective of this project? :)
Programmed Canon Canola calculators in 1977. Assorted platforms and languages ever since. Assisting with HOPL.info.
I am NOT looking for work -- I've got more than enough to do.
Location
Perth, WA Australia
Education
A few diplomas.
Work
Software Engineer at [Daisy Digital](https://daisydigital.com.au/)
As far as I know, no one is using it. I use it as a test-bed for ideas which I then propagate to our in-house tool, which also uses ClearScript but targets JScript rather than V8. I've recently started fiddling with LychenBASIC, which targets the VBScript engine via ClearScript.
In some respects I work in a backwater. We have a commitment to the Windows platform (which I chafe against from time to time): Azure, SQL Server, C# with JavaScript as the extension language, Visual Studio and Visual Studio Code (when not using Notepad++).
As for "why can't you do it with regular JavaScript?" well-l-l-l, okay, maybe I'll start learning nodejs. Maybe there's some way of using it in our current ecosystem.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
It is a long time ago I did all this but let me see. Ignoring most dogmas, What you're doing here looks about right.
A terrible idea is to expose the internal instance of the interpreter to the higher context using addHostObject. It will stay there in that (more) global context after the first call to include. Simply wrap that reference too somewhere or safely delete it afterwards, otherwise
I don't know from memory how V8 responds to setting a host object twice but maybe your code will crash if you make a second call to include. (maaaaybe)
Make sure that you can rely on CSFile.Exists because if it is a direct reference to System.IO.File.Exists which expects a String, ...
You can wrap it somewhere else but I advise to be lazy like me and put the call to CSFile.Exists it inside a try block of include(). Again, only if needed. I don't know the rest of your program.
Maybe have a look at NiL. I never really liked the extra .dll files of v8, also didn't feel like embedding them or building ClearScript every time I test my code. NiL.js is an ECMAScript evaluator written in C# that understands modern ES6/7/8/9/10 and takes only a second to compile. Not that compiling is needed. It also provides APIs to extend the evaluator with your custom syntax which allowed me to implement an include method function keyword natively into the interpreter. Not for beginners though. In the documentation are some examples, they show you how to add an echo keyword or something. It is platform agnostic in the sense that it runs on Mono.
They've updated their examples a bit since you were last there. There are custom statements and custom operators at github.com/nilproject/NiL.JS/tree/...
What are you working on?
When I get the readme done and a folder with a couple of samples in, I'll send the link. In the meantime, I've got a an enhanced JavaScript called Lychen ("Lichen" is already taken). For some years my work has been using an enhanced JScript using the same technique. I'm now pursuing V8 as a personal project.
Project now on GitHub in a public repo at github.com/axtens/Lychen. Other repos have been deleted.
Hey Bruce, it's been some time since you commented on this article. I went to check out Lychen (again) on GitHub today and noticed your last commit was 29 days ago. May I ask, what do you use Lychen for? Why can't you do it with regular JavaScript? What is the use case? Anyone else using it as far as you know? Cyanobacteria sure but what is the objective of this project? :)
As far as I know, no one is using it. I use it as a test-bed for ideas which I then propagate to our in-house tool, which also uses ClearScript but targets JScript rather than V8. I've recently started fiddling with LychenBASIC, which targets the VBScript engine via ClearScript.
In some respects I work in a backwater. We have a commitment to the Windows platform (which I chafe against from time to time): Azure, SQL Server, C# with JavaScript as the extension language, Visual Studio and Visual Studio Code (when not using Notepad++).
As for "why can't you do it with regular JavaScript?" well-l-l-l, okay, maybe I'll start learning nodejs. Maybe there's some way of using it in our current ecosystem.