Re: safe way to hold traced reference of unknown type?

2019-01-31 Thread mratsim
You can use: proc foo() = let myRef = createMyRef() GC_ref(myRef) defer: GC_unref(myRef) doWork() doMore() # No need to remember to decrease ref count thanks to defer. Run

Re: Sqlite out of memory error when compiling with -d:release flag

2019-01-31 Thread Araq
Sounds more like a corruption to me. Compile with `-d:useSysAssert -d:useGcAssert` and without release mode.

Re: Karax question: how to update input field on the fly

2019-01-31 Thread dom96
That's a hack. You shouldn't be modifying DOM nodes from underneath Karax. That said, I can't blame you because I ran into this too. The way Karax handles this isn't ideal and I created an issue for this: [https://github.com/pragmagic/karax/issues/61](https://github.com/pragmagic/karax/issues/61

Re: safe way to hold traced reference of unknown type?

2019-01-31 Thread deansher
To me, it feels cleaner to actually hold onto a reference than to increment a reference count that must be carefully decremented later. Is there a benefit to the `GC_ref` approach for this use case? Or am I just thinking about this wrong?

Re: safe way to hold traced reference of unknown type?

2019-01-31 Thread mratsim
GC_ref? [https://nim-lang.org/docs/system.html#GC_ref,string](https://nim-lang.org/docs/system.html#GC_ref,string)

safe way to hold traced reference of unknown type?

2019-01-31 Thread deansher
I want a value that holds onto a traced reference of an unknown type, to protect it from being garbage collected while I access it through an `Any`. Is this the best way to do that? Any other feedback on this code? import typeinfo type DynKind* = enum dkInt

Re: Karax question: how to update input field on the fly

2019-01-31 Thread stedi
To answer my own question. The following code does the trick: include karax / prelude from dom import getElementById, setAttribute type Model = object value_1: string value_2: string var model: Model proc setInput(ev: Event, node:VN

Re: Regex source code filter

2019-01-31 Thread juanv
The [documentation](https://nim-lang.org/docs/filters.html) says that there are three available filters: Replace, Strip and StdTmpl. But can I create my own filter? how? (I want to create a RegexReplace filter)

Sqlite out of memory error when compiling with -d:release flag

2019-01-31 Thread revilotom
When compiling with -d:release I get the following error when attempting to access the sqlite database. Without the flag it works as expected. Can anyone explain what I'm doing wrong? nimble v0.9.0 Nim Compiler Version 0.19.9 [Linux: amd64] ERROR ../../../../../Nim/lib/impure/db_s

Re: Regex source code filter

2019-01-31 Thread kaushalmodi
The examples in the linked manual worked for me when I last needed to use SCF. Can you paste a minimal working example of what you tried and didn't work? Then someone can help you out.

Karax question: how to update input field on the fly

2019-01-31 Thread stedi
Hope this is the right place for my question. I'm trying to update a text input. Having entered something in "input_1", I'd like to update the text that's shown in "input_2". With the code shown below, I'd expect "Auto text" to appear in input_2's text field. But that does not happen.

Re: Regex source code filter

2019-01-31 Thread juanv
In order to create my own Source Code Filter, it would be enough if someone could give a trivial example on how to build a personal SCF. I have not been able to figure it out by looking at the documentation. And searching the web I could not find any example.

Re: A bug of vcc compiler

2019-01-31 Thread slangmgh
I don't think so. 1. With x64, the call convention is all same. 2. The __fastcall is fast than __cdecl indeed. 3. The lastest compiler from vs 2013 has fixed this bug. 4. This is only happened with vcc. 5. It happened rarely.

Re: A bug of vcc compiler

2019-01-31 Thread Araq
Very interesting! This could also be the cause for the mysterious other problems with VCC. :-)

A bug of vcc compiler

2019-01-31 Thread slangmgh
Yesterday, I am testing nim destructor thing, and find a strange bug. Look at the code modified from tests/destrcutor/tcustomstrings.nim type mystring = object len, cap: int data: ptr UncheckedArray[char] var allocCount, deallocCount: int

Re: Compile Nim compiler to JS?

2019-01-31 Thread Libman
> Is it possible to compile the Nim compiler to Javascript? Given enough foolishness, [all things are possible](https://www.xkcd.com/505/). But it would probably be _unbearably slow_. And definitely very inefficient. Heck, one can even run [Qemu in the browser](https://github.com/atrosinenko/qe