sciter-sdk / nsciter

sciter bindings for Nim
18 stars 4 forks source link

Failure to Compile with Nim 1.0.2 #1

Open tajmone opened 4 years ago

tajmone commented 4 years ago

Attempts to compile test.nim example fails with the following error:

xdom.nim(47, 12) Error: 'typedesc' metatype is not valid here; typed '=' instead of ':'?

Tested under:

Since the last nsciter commit dates back to July 2016, my guess is that it was last tested with Nim 0.14.2, which is a very old version of Nim indeed — Nim has undergone many radical changes since v0.14, so it's unlikely that if it worked fine back in 2016 it could compile with the current Nim version.

In September 2019 Nim 1.0 was released. The good news is that the Nim language won't be undergoing any backward-breaking changes (except for features marked as experimental); so fixing nsciter to work with current Nim won't require further changes in the future, unless the Sciter API demands it.

In order to update nsciter code it might be useful to look at the changelogs from Nim 0.14.2 to Nim 0.20.2 (the last pre-1.0 release) and try to figure out what needs to be amended.

Links to Nim Changelogs

Nim changelogs up to v1.0 were published on the official blog up to v1.0:

Their Markdown sources are available at:

Changelogs after Nim 1.0 can now be found at:

oskca commented 4 years ago

Good references, this project receives no maintenance recently while Sciter and Nim both release many new versions, are you using nsciter in your own project?

tajmone commented 4 years ago

are you using nsciter in your own project?

I got interested in Nim for a project I had in mind, for I like its philosophy, which lead me to look into a nice GUI framework for Nim, which in turn lead me to Sciter. So I'm new both to Nim and Sciter (although I've been following Sciter for a number of years), and I'm afraid I'm not able to help much with advances topics like wrappers and bindings, since I don't know well enough Nim nor Sciter.

But hopefully nsciter should be fixable rather easily, and I've started going through each error, trying to fix it by reading Nim changelogs, and then look at the next generated error. It seems that most errors are due do slight syntax changes, but a couple of others errors might be affected by deeper changes in Nim philosophy (and here I get stuck).

Once I get a grip on Nim and Sciter, I'm positive that I'll be using them for a long time, so I might contribute to the repository on the long term.

tajmone commented 4 years ago

Current Bindings Are for Sciter 3!

I did some digging, taking into account that the nsciter project was created in 2016/05/31 and that the last commit dates back to 2016/06/24.

So I went looking into the Sciter SDK changelogs and realized that these bindings were written for Sciter 3.

The current Sciter SDK Changelog doesn't cover versions older than June 2017, but from peeking at older revisions of the Changelog we can estimate that it targeted Sciter 3.3.2:

So, even if the current bindings were fixed to work with the current Nim release, they won't work with Sciter 4.

I did some experiments locally, and managed to fix all the compiler errors; but since I was trying to use the Sciter 4 DLL it shouldn't come as a surprise that the test binary would abort with errors.

I've also tried to reconvert the Sciter headers that the Makefile auto-generates via c2nim — both the original headers of this project as well as the latest ones from Sciter SDK repository:

I'm not sure which is the best way to ge here:

From what I gather, working with the Sciter 4 headers is going to require much more manual intervention than just using c2nim.

Any suggestions here? Any tips and advise on how to procede would be much appraciated.

@oskca, are you by any chance commited to update this project? (i.e. do you still work with/on Sciter under Nim?)

mprkins commented 4 years ago

That would be great. I wanted to use sciter for a very long time but it's beyond my technical skills to update the bindings.

mprkins commented 4 years ago

Well just by the look of it all of the bindings are mostly maintained by 2 guys @oskca and @pravic I might try to tackle this myself but I have never done anything like this and I am especially worried about messing up the memory.

Would it be feasible just follow the way the Go bindings are done and translate this to Nim ?

tajmone commented 4 years ago

@mprkins,

I don't know Nim nor Sciter's API well enough to embark on this. I did look at the current bindings and found that Nim has changed a lot in the meantime, that and the changes in Sciter API, you're looking at a rewrite of the whole thing.

I suggest you join the current thread on Nim bindings on the Sciter forums:

where you can get help from Sciter's author on specific questions.

I've personally given up on using Nim with Sciter, and started to look at the Rust bindings instead.

mprkins commented 4 years ago

@pravic Would you be able to guide me if I take the Go bindings as a reference ?

pravic commented 4 years ago

Hey there. I don't know Nim yet but I could take a look. And feel free to ask questions, I'll try to help.

UnnoTed commented 4 years ago

Has anyone tried to generate bindings with nimterop? it seems to require mostly the same info as a compiler asks for: scintilla example.