Sciter for D

c-smile andrew at sciter.com
Tue May 26 19:34:08 UTC 2026


On Tuesday, 26 May 2026 at 17:42:57 UTC, Dejan Lekic wrote:
> On Tuesday, 26 May 2026 at 16:42:16 UTC, c-smile wrote:
>>
>> widget tree is DOM tree by any means.
>>
>
> 1) Mutability
>
> In many GUI toolkits widget trees are completely immutable 
> (Flutter is perfect example), while DOM is complete opposite - 
> it is highly mutable

GTK has exactly the same set of DOM/WOM tree mutating operations 
(append,prepend,remove):

```c
GtkWidget *button = gtk_button_new_with_label("Click Me");
gtk_container_add(GTK_CONTAINER(page), button);
```
And JS (and you can that in D):
```js
let button = document.createElement("button","Click Me");
page.append(button);
```

So what does immutability mean for you?

> where DOM node is a HEAVY, long-lived object!

One more urban legend, sigh ...

Sciter's DOM element is about `sizeof(void*) * 12 = 96 bytes` on 
x64.

While `sizeof(struct _GtkWidget)` is 280–380 bytes per widget.

Here is 
[sciter-internals.pptx](http://sciter.com/docs/sciter-internals.pptx) - slides of PowerPoint presentation if you want to know more.

>
> 2) Structural purpose
> DOM is "the end". It holds everything (styles, layout, 
> structure). In widget-based world widget-tree is actually 
> high-level abstraction, while at lower layers you _MUST_ have 
> element-tree and at the lowest layer the "render-objects".

Quite opposite, it is `struct _GtkWidget` that holds everything 
styles, layout, structure.

GTK4’s GtkWidgetPrivate contains (summarized):

* Pointers: parent, layout manager, CSS node, first child, next 
sibling, controllers, action groups, tooltip, cursor, etc.
* Geometry: allocation struct (4 ints), baseline, margins, expand 
flags
* State flags (bitfields)
* Event delivery flags
* Opacity (double)
* Name pointer
* Tick callback list
* Transform cache
* Snapshot data
* Misc bookkeeping

>
> 3) Memory footprint
> Creating and destroying DOM nodes is super slow.

Sorry, but that is untrue, real numbers:

* Create 10k DOM nodes : 3–10 ms (Chrome/Firefox)
* Create 10k Win32 HWND :	20–40 ms

> "dress to impress" stances...

Check my [Sciter.Notes](https://notes.sciter.com/) application:

![Sciter.Notes](https://notes.sciter.com/wp-content/uploads/2023/03/notes-front.jpg)

There is nothing fancy in its UI... Pure productive application, 
I deliberately made it matching e-mail app style for the least 
astonishment.

But without Sciter it is quite hard to achieve. You do need to 
render HTML (note view), you do need WYSIWYG and Markdown 
editing. For Markdown you will need MD->HTML and HTML->MD parsers 
and the most mature libs for that are in JS.
For the storage you would need something like NoSQL DB as data 
associated with notes and overall DB structure is fluid, etc.



More information about the Digitalmars-d-announce mailing list