sciter-sdk / go-sciter

Golang bindings of Sciter: the Embeddable HTML/CSS/script engine for modern UI development
https://sciter.com
2.57k stars 269 forks source link

Things that are not supported #68

Closed dandevelo closed 6 years ago

dandevelo commented 7 years ago

Hi,

First of all congrats for putting up the Go bindings!

The readme mentions:

Things that are not supported:

Sciter Node API
TIScript Engine API

Is this a limitation of how Sciter works or is it something that hasn't been yet implemented due to lack of time?

Thanks!

pravic commented 7 years ago

Hello,

Actually, the most part of the Sciter API is coming from HTMLayout, which is essentially HTML rendering engine driven by native code. TIScript could be glued separately via TIScript API, which allows you to declare native methods and/or to call script ones.

In Sciter, however, all layers (html/css/graphics/database and so on) are glued together by its script, so you just do UI-related things via script (it is much easier) and leave the business logic to the native part.

is it something that hasn't been yet implemented due to lack of time?

Technically, you can do "low-level" event handling or manipulate DOM on the native side as in HTMLayout, but it is useless in most cases.

dandevelo commented 7 years ago

Thank you for the reply.

I am curious about the cgo overhead. After reading on this ( https://www.google.com/search?q=cgo+overhead ) I am wondering about the performance of a Go app using cgo vs a C++ app using Sciter directly.

Do you think there would be a way to use Sciter in a Go app without using cgo?

pravic commented 7 years ago

Well, this article mentions 171ns per cgo call. Is it slow? It depends. Is it significant for UI application? Obsiously not, because UI spends the most of the time waiting for user input.

Another examples: Python itself is slow (very slow) language, but people use it because of its extreme flexibility, productivity and scalability. If you worry about performance, you are writing critical parts in native language (C, C++, whatever) and call them from Python.

So, back to the Sciter, this is yet another point to eliminate low-level operations between UI and native side (such as event handling, DOM manipulating or line/pixel drawing), but incorporate them in high-level calls like "Create window", "Fill UI by this data" or "Ask native side to do something".

dandevelo commented 7 years ago

If you worry about performance, you are writing critical parts in native language (C, C++, whatever) and call them from Python.

Yes, that's the plan. Do you happen to use Go+Sciter in production for any desktop app or know any desktop app that uses Go and Sciter?

pravic commented 7 years ago

Personally, I have never used Go. As for production apps - there are some references to them here or here, but I do not know which language they use. Mostly C++, I guess.