https://terrainformatica.com/2021/04/25/sciter-uses-javascript-from-now-and-on/ Search for: [ ] Search Skip to content Terra Informatica Software UI and frontend software design and consulting since 1991 Menu * Home * About * Contact Sciter uses JavaScript from now and on Posted on April 25, 2021April 25, 2021 by c-smile [68747470733a2f2f7363697465722e636f6d2f77702d636f6e74656e742f75706c6f6164732f323032302f31302f5363697465722e4a532e43616c635f2d65313630323339303] Without too much fanfares Sciter has officially transitioned from TIScript to JavaScript this week. To be precise, there are two Sciter's at the moment: Sciter.TIS and Sciter.JS. It is just from now and on Sciter is a synonym of Sciter.JS. And so Sciter.JS is the official, mainstream version. But Sciter.TIS is still supported and maintained until I have customers that use it. TIScript was serving Sciter exceptionally well all these 10 years, however 6 months ago I decided to switch to JavaScript. Reasons of why: * In ES2020 specification JavaScript finally has reached feature set of TIScript. * Fabrice Bellard have created his QuickJS embeddable JS engine, pretty compact and fast and Sciter uses slightly modified QuickJS version. * We've got tons of JavaScript libraries that can be used as they are in Sciter context. * Sciter can be used by any creative Web Front End developer without the need to learn new language. Paying tributes to TIScript TIScript is rooted at David Betz' Bob Language that was published in DDJ in 2002. While I've made TIScript syntax explicitly close to JavaScript, its architecture and implementation inherits original structure and features of Bob: * Single pass compiler that produces bytecodes; * Stack based VM executing those bytecodes; * Compacting (copying) GC; Such foundation worked very well and allowed to evolve original Bob to TIScript with a lot of features of modern PL: real classes, iterators and generators, await/async, built-in persistability, symbols, etc. TIScript is good and is close to JavaScript but it is not JavaScript though. You cannot take existing JS library and use it in Sciter as it is. So, not without regret, I have decided to switch to JavaScript. QuickJS in particular. QuickJS, new kid in the block QuickJS is relatively recent addition to the list of JS implementations . And here are key reasons why I decided to use it: * API and integration principles are close to what TIScript uses - it took me just 1 month to add QuickJS to Sciter core. And 4 months more to expose HTML/CSS runtime to JS. * Relatively compact implementation - QuickJS is slightly more fatty (by 100 kb) but still in acceptable range. For the note: full version of V8 is about 40 mb - 5 times larger than Sciter itself; * Liberal MIT license. Sciter cannot use GPL/LGPL code - many customers expressed this requirement; * Readable source code. Well... almost readable. Architecture of QuickJS: * Almost single pass bytecode compiler with additional bytecode passes; * Stack based VM; * Reference counting GC with loops detection; If to compare with TIScript the only major difference is reference counting GC and I have mixed feeling about it. RC memory management has as pros as cons , in context of HTML/CSS/UI in particular. Anyway Python uses it all these years in similar circumstances so it definitely will work. Major benefit of RC GC is that memory management is more deterministic. For example: an object created inside a function can be freed at its exit (if it is not stored anywhere). This may lead to better memory consumption. On other hand there is a possibility of memory fragmentation on long runs. But we can use other than default memory allocator in QuickJS if this will be a problem. We will see. TIScript features that are not in JavaScript. Yet? JavaScript in general is quite foreign to HTML and CSS. While I've added better HTML support to QuickJS by adding JSX and reactivity (VNode literals), at the same time CSS constructs are still can be expressed only by their string representations. This involves parsing at runtime when you need to set CSS properties from script - not that good. TIScript syntax and runtime has the following CSS helper features in this regard: * Length, Duration, Angle units. In TIScript we can write something like this element.timer(20ms, function() {}) where 20ms is a literal of type Duration. Same thing for length units : element.style.width = 10em; Pretty convenient and expressive as for me... * Tuples. Tuples are tagged immutable arrays. Tuples are used in CSS to represent "CSS functions" like transform: translate(100px, 20px); which, with tuples, can be written as element.style.transform = [translate: 100px, 20px]; Not an exact match of course, but close. * CSS name tokens. Name token in CSS is almost a JS one with the only exception: name token in CSS may contain dashes (-). It is problematic to use such name tokens in JS - dash there is operator minus, but with the only exception: we can safely add support of such name tokens to object literals so this will be possible: element.style.set { border-width: 3px } We can live without all these of course, sky will not fall on us, but aesthetics of our sources is what makes us, developers, at least a bit more happier among boring pages full of JSON and the like constructs. So welcome to new Sciter! CategoriesHTML and CSS, Sciter, Script, Web Application Techologies Post navigation PreviousPrevious post: QuickJS + DyBase = JavaScript persistence Leave a Reply Cancel reply Your email address will not be published. Required fields are marked * [ ] [ ] [ ] [ ] [ ] [ ] [ ] Comment [ ] Name * [ ] Email * [ ] Website [ ] Please enter an answer in digits: eight + eight = [ ] [Post Comment] Currently you have JavaScript disabled. In order to post comments, please make sure JavaScript and Cookies are enabled, and reload the page. Click here for instructions on how to enable JavaScript in your browser. Search Search for: [ ] Search Home of Sciter Embeddable HTML/CSS/script UI engine for modern desktop applications HTML Notepad Handy HTML WYSIWYG editor. Sciter Notes Personal notes and documents manager Sciter Script (a.k.a. TIScript) - scripting language and engine used by Sciter HTMLayout Minimalistic HTML/CSS rendering component RSS RSS Feed * Sciter uses JavaScript from now and on April 25, 2021 * QuickJS + DyBase = JavaScript persistence March 2, 2021 * What makes a great nation great? November 21, 2020 * Sciter.JS and QuickJS++ October 27, 2020 * Real End of Flash Era September 20, 2020 * UI friendly JavaScript. Part I. September 18, 2020 Archives * April 2021 (1) * March 2021 (1) * November 2020 (1) * October 2020 (1) * September 2020 (3) * August 2020 (1) * May 2020 (2) * April 2020 (1) * March 2020 (1) * January 2020 (1) * November 2019 (2) * October 2019 (2) * September 2019 (2) * July 2019 (1) * December 2018 (2) * November 2018 (1) * October 2018 (2) * July 2018 (1) * December 2017 (1) * October 2017 (5) * September 2017 (1) * August 2017 (1) * April 2017 (1) * March 2017 (1) * October 2016 (2) * May 2016 (3) * February 2016 (2) * October 2015 (3) * September 2015 (3) * August 2015 (8) * July 2015 (1) * May 2015 (2) * April 2015 (4) * February 2015 (2) * January 2015 (2) * December 2014 (3) * October 2014 (1) * September 2014 (1) * July 2014 (5) * June 2014 (2) * May 2014 (3) * April 2014 (3) * March 2014 (1) * February 2014 (2) * January 2014 (1) * November 2013 (2) * October 2013 (1) * September 2013 (3) * August 2013 (2) * June 2013 (1) * April 2013 (3) * March 2013 (4) * February 2013 (4) * January 2013 (2) * December 2012 (1) * November 2012 (4) * September 2012 (2) * August 2012 (1) * June 2012 (1) * May 2012 (1) * March 2012 (6) * February 2012 (2) * December 2011 (1) * October 2011 (3) * August 2011 (1) * July 2011 (1) * April 2011 (1) * March 2011 (2) * February 2011 (1) * January 2011 (2) * November 2010 (1) * September 2010 (2) * August 2010 (1) * June 2010 (1) * April 2010 (1) * March 2010 (2) * February 2010 (1) * January 2010 (2) * December 2009 (1) * October 2009 (2) * July 2009 (1) * April 2009 (1) * February 2009 (1) * January 2009 (1) * December 2008 (2) * November 2008 (1) * August 2008 (1) * July 2008 (2) * June 2008 (1) * May 2008 (1) * March 2008 (3) * February 2008 (3) * January 2008 (2) * December 2007 (2) * November 2007 (3) * October 2007 (2) * September 2007 (3) * August 2007 (2) * July 2007 (3) * June 2007 (1) * May 2007 (3) * April 2007 (2) * March 2007 (7) * February 2007 (1) * December 2006 (3) * November 2006 (5) * October 2006 (5) * August 2006 (10) Search Search for: [ ] Search Find Us Address Richmond British Columbia Canada Hours Monday--Friday: 9:00AM-6:00PM About This Site This may be a good place to introduce yourself and your site or include some credits. Proudly powered by WordPress