About removing Beanshell/Javascript (Rhino) ?

Ilmari Lauhakangas ilmari.lauhakangas at libreoffice.org
Sat Jan 22 12:35:18 UTC 2022


On 22.1.2022 13.27, Julien Nabet wrote:
> Hello,
> 
> Reading https://en.wikipedia.org/wiki/BeanShell, specifically:
> 
> "Since Java 9, Java instead includes JShell 
> <https://en.wikipedia.org/wiki/JShell>, a different read–eval–print loop 
> <https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop> 
> (REPL) shell based on Java syntax, indicating that BeanShell will not be 
> continued"
> 
> I wonder if we could remove Beanshell part from LO.
> 
> Also, we use Rhino as Javascript engine (Rhino is written in Java). Some 
> people proposed C/C++ engine like Spidermonkey or V8 (see 
> https://bugs.documentfoundation.org/show_bug.cgi?id=97827) but it seems 
> they may be problematic too because of instable API and specific GC, see 
> Michael's comment here: 
> https://bugs.documentfoundation.org/show_bug.cgi?id=97827#c7
> 
> However, shouldn't we focus on Basic support and Python and remove the 2 
> others or at least Beanshell ?
> 
> Goal: diminish Java dependency and maintaining burden by removing code.
> 
> Now I must recognize I don't know if these 2 features are used or not. 
> Considering number of bugtrackers it doesn't seem so but perhaps it's 
> because there are very few bugs.

Thanks for the heads up regarding JShell.

Indeed, there are engines better suited for embedding, but then the 
question becomes how well they keep up with all the new features 
introduced into JS standard each year.

QuickJS[0] appeared on the scene in 2019 and caused a lot of excitement 
due to the nice support for new JS features. However, it has remained as 
more of a "man throws code over the wall occasionally" type of project.

Duktape[1] is lagging behind in the latest JS features, but is still 
actively developed, is used by many projects[2] and has a very good 
Linux packaging coverage[3]. One widely-deployed project currently 
adopting Duktape is polkit[4] (moving away from mozjs).

For editing JavaScript macros, instead of BeanShell the same approach 
could be taken as with Python, using an external IDE.

Ilmari

0: https://bellard.org/quickjs/
1: https://duktape.org/
2: https://wiki.duktape.org/projectsusingduktape
3: https://repology.org/project/duktape/versions
4: https://gitlab.freedesktop.org/polkit/polkit/-/merge_requests/97
5: https://wiki.documentfoundation.org/Macros/Python_Basics


More information about the LibreOffice mailing list