Setting finalizer on object hierarchy won't compile with --gc:arc

2022-01-19 Thread filcuc
The problem original problem is with finalizers and arc. Not destructors and refc. Usually refc seems to work fine with both destructors/finalizers

Atomics: attempting to call undeclared routine: 'testAndSet'

2022-01-19 Thread Nycto
Follow up: I submitted a PR to fix this:

Update on compiling to asmjs or wasm through emscripten...

2022-01-19 Thread treeform
What are your thoughts on ?

Setting finalizer on object hierarchy won't compile with --gc:arc

2022-01-19 Thread boia01
This works with `--gc:arc`: type Parent* = object of RootObj Child* = object of Parent proc `=destroy`*(self: var Parent) = echo "Parent delete" proc `=destroy`*(self: var Child) = echo "Child delete"

profiler for mac?

2022-01-19 Thread evoalg
Since I'm on a mac and I wanted to try & write a simple profiler myself to just spit out times. eg if I have this example code (just a quick example that does nothing): import std/[sequtils] proc A(x: seq[int]) = for _ in 0 .. x.high var y = x proc B(

Privacy offensive - remove Google Analytics from the Nim website

2022-01-19 Thread federico3
The website is also using Cloudflare, which breaches visitors privacy by acting as a proxy. Cloudflare is also hostile to visitors using Tor.

Setting finalizer on object hierarchy won't compile with --gc:arc

2022-01-19 Thread Hlaaftana
To make runtime branching for `delete` work you need to make it a `method`. [See manual](https://nim-lang.org/docs/manual.html#methods)

Setting finalizer on object hierarchy won't compile with --gc:arc

2022-01-19 Thread giaco
@filcuc if what @guibar says this is real, this is a showstopper for current NimQml design + arc. Better to stick with --gc:refc and consider it a requirement, or branch code ad compile time: * when arc use =destroy * when refc use finalizers Maybe there's a third option to use =destroy

Working with tables and strict funcs

2022-01-19 Thread Hlaaftana
I edited my post to properly answer your question.

Bug of newSeqWith with Slice

2022-01-19 Thread Hlaaftana
`typeof` has default TypeOfMode `typeOfIter` which evaluates as `int` for `0 .. 10` since `0 .. 10` is also an integer iterator as well as a slice constructor. Use `typeOfProc`. [typeof docs](https://nim-lang.org/docs/system.html#typeof%2Cuntyped) template newSeqWith*(len: int, ini

Working with tables and strict funcs

2022-01-19 Thread Hlaaftana
Use `var` and `var Foo`. {.experimental: "strictFuncs".} import tables type Foo = ref object data: Table[string, int] func readData(f: var Foo, k: string): int = f.data[k] if isMainModule: var f = Foo(data: initTable[string

Privacy offensive - remove Google Analytics from the Nim website

2022-01-19 Thread pietroppeter
Note that there is a repo issue about this: I think plausible is an excellent alternative, one of the things I like particularly is the fact that dashboards can be made public (as shown by Hugo) I actually reached out to @dom96 some time ago and

Working with tables and strict funcs

2022-01-19 Thread jayv
Yes, that clears the compiler error, but it's actually the opposite of what I want. I want the compiler to see that `f` is immutable, so in a more complicated scenario it can catch any errors where I do mutate it by accident.

Privacy offensive - remove Google Analytics from the Nim website

2022-01-19 Thread hugogranstrom
Plausible is really nice, here's an example of the analytics for SciNim's getting-started page (which @pietroppeter is kindly providing us with) of what kind of stats you get: [Plausible Analytics](https://plausible.io/scinim.github.io%2Fgetting-started)

Working with tables and strict funcs

2022-01-19 Thread jayv
I like the strict funcs experimental feature, and I like using it in my side projects. But I'm having a small issue and wanted to see what others think about it. Here's the setup: I have a reference type with a private member that is a table. I want a pure function to be able to read from that

Atomics: attempting to call undeclared routine: 'testAndSet'

2022-01-19 Thread Nycto
> Here: > while location.guard.testAndSet(moAcquire): discard > It should > probably be rewritten > while testAndSet(location.guard, moAcquire) Yup -- you're right about this. Updating the file locally resolved the issue. > This can only be guaranteed if the value has up to the native machine si

Atomics: attempting to call undeclared routine: 'testAndSet'

2022-01-19 Thread mratsim
Seems like you've been hit by a generic symbol resolution bug: Here: `while location.guard.testAndSet(moAcquire): discard` It should probably be rewritten `while testAndSet(location.guard, moAcquire)` due to a limitation with method call syntax in templates. That or you've been hit with the i

Atomics: attempting to call undeclared routine: 'testAndSet'

2022-01-19 Thread mratsim
Now the real question is, what do you want to do?

libmysqlclient.so Not Found

2022-01-19 Thread dom96
I hate to be that person but this is easily googleable... in any case try `sudo apt-get install libmysqlclient-dev`.

Bug of newSeqWith with Slice

2022-01-19 Thread mratsim
Probably a symbol resolution issue with typeof.

libmysqlclient.so Not Found

2022-01-19 Thread dbaron4
1) I've installed the MySQL client: sudo apt install mysql-client-core-8.0 2) And can log into my database: mysql -h 127.0.0.1 -P 3306 -u dbaron -p mysql> 3) I'm using db_mysql in my code, but get the following runtime error: libmysqlclient.so: cannot open shared object file: No such file or

Atomics: attempting to call undeclared routine: 'testAndSet'

2022-01-19 Thread Nycto
I started playing with the [atomics](https://nim-lang.org/docs/atomics.html) module this morning, but I hit a roadblock pretty quick. I've got two files in my project... a src file and a test file: # src/OpenAddrTable.nim import std/atomics type OpenAddrTab

nimscript - import configuration file

2022-01-19 Thread exelotl
With a bit of `include` trickery you can actually use Nimscript as the config language (without the overhead of booting up the Nim compiler more than once). This is nice because you get proper typechecking and error messages, and you can use procs/templates to introduce additional rules and cons

Bug of newSeqWith with Slice

2022-01-19 Thread chaemon
I found that the newSeqWith may fail when init is constant Slice like 0..10 . I also found that if init is typed, it can be compiled. Should it be untyped? template newSeqWith*(len: int, init: untyped): untyped = var result = newSeq[typeof(init)](len) for i in 0 ..< len:

cannot instantiate: 'T' with importcpp generic

2022-01-19 Thread bj0
I tried that, it didn't seem to effect the generated line at all.

Unescape string

2022-01-19 Thread Patitotective
So, there is no easy solution? is [multiReplace](https://nim-lang.org/docs/strutils.html#multiReplace%2Cstring%2Cvarargs%5B%5D) my best option?

Unescape string

2022-01-19 Thread konradmb
It won't work this way:

Privacy offensive - remove Google Analytics from the Nim website

2022-01-19 Thread mratsim
Status uses Fathom Analytics for privacy-preserving analytics: /

Privacy offensive - remove Google Analytics from the Nim website

2022-01-19 Thread sauerbread
Hello everyone, so lately the Austrian Data Protection Authority [ruled against the use of Google Analytics](https://noyb.eu/en/austrian-dsb-eu-us-data-transfers-google-analytics-illegal), as it violates the GPDR. Since the Nim website uses Google Analytics, we should hop on a GDPR friendly alt

Unescape string

2022-01-19 Thread Patitotective
It doesn't actually work.

Update on compiling to asmjs or wasm through emscripten...

2022-01-19 Thread GordonBGood
It has been over two years since there has been much posted on the forum about compiling from Nim to asmjs or wasm for node applications or web Single Page Applications's (SPA's), so I'd like to update on what I've found to work, as follows:. 1. Install [emscripten](https://emscripten.org/do

Setting finalizer on object hierarchy won't compile with --gc:arc

2022-01-19 Thread filcuc
Honestly i don't get why it should not work conceptually. Child and Parent are two diffrent types each one with its own finalizer/destructor.

nimscript - import configuration file

2022-01-19 Thread PMunch
You can use `readFile` from the OS module at least: import os echo readFile("test.nims") Run [peter /tmp ] 19055 $ nim e test.nims Hint: used config file '/home/peter/.choosenim/toolchains/nim-1.6.2/config/nim.cfg' [Conf] Hint: used config

How to dynamically link LGPL nim library to closed-source nim application?

2022-01-19 Thread konradmb
I haven't tried it, but it seems provides a solution for case A.

nimscript - import configuration file

2022-01-19 Thread alexgustafson
Hi, We are using nimscript as a task runner for various (non nim ) projects. Typical tasks might be to deploying a docker based project to a remote server, or synchronizing data between local test servers and remote servers. I would like to be able to have a configuration file that is separate

Man pages?

2022-01-19 Thread flint
I've been looking into this as I tried to convert the RST doc scattered in several files into one org-mode doc. I first thought Pandoc was the culprit but then found that the RST syntax **requires a blank line between the block declaration and the content** like so: .. code-block:

How to dynamically link LGPL nim library to closed-source nim application?

2022-01-19 Thread federico3
Unfortunately MPL does not protect against tivoization, patents and does not grant trademark usage rights. See It could be useful to have a "standard" LGPLv3-with-static-linking-exception license in the project initialization step

Setting finalizer on object hierarchy won't compile with --gc:arc

2022-01-19 Thread guibar
I think it is a bug but possibly unfixable, --gc:arc tries to turn finalizers into destructors but the design of these two features is different. A workaround is to use explicit destructors: type Parent* = ref object of RootObj Child* = ref object of Parent proc

Unescape string

2022-01-19 Thread kobi
btw, how do I unescape all html entities to utf8 in a large text?

Unescape string

2022-01-19 Thread PMunch
Have you tried [unescape](https://nim-lang.org/docs/strutils.html#unescape,string,string,string) from the same module as multiReplace?