Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to Compile with Nim 1.0.2 #1

Open
tajmone opened this issue Nov 3, 2019 · 9 comments
Open

Failure to Compile with Nim 1.0.2 #1

tajmone opened this issue Nov 3, 2019 · 9 comments

Comments

@tajmone
Copy link

tajmone commented Nov 3, 2019

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:

  • Windows 10 x64
  • Nim 1.0.2
  • GCC 6.3.0

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
Copy link
Member

oskca commented Nov 3, 2019

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
Copy link
Author

tajmone commented Nov 3, 2019

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
Copy link
Author

tajmone commented Nov 4, 2019

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:

  • Sciter 3.3.2.2 (released in 2016/04/25)
  • Sciter 3.3.2.6 (released in 2016/06/12)

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:

  • With the original project headers, the output files seem more up-to-date with the current Nim syntax. But, unfortunately, all the compiler errors are from the manually edited Nim files, not those from c2nim.
  • With the latest headers (from Sciter 4.4.0.1) c2nim fails to convert some files due unsupported C++ syntaxes and features.

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

  • Fix the Sciter 3 headers to work with Nim 1.x? or
  • Rewrite the bindings from scratch, using Sciter 4?

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
Copy link

mprkins commented Nov 9, 2019

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
Copy link

mprkins commented Nov 22, 2019

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
Copy link
Author

tajmone commented Nov 22, 2019

@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
Copy link

mprkins commented Dec 9, 2019

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

@pravic
Copy link
Member

pravic commented Dec 9, 2019

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
Copy link

UnnoTed commented Jun 16, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants