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
Sounds more like a corruption to me. Compile with `-d:useSysAssert
-d:useGcAssert` and without release mode.
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
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?
GC_ref?
[https://nim-lang.org/docs/system.html#GC_ref,string](https://nim-lang.org/docs/system.html#GC_ref,string)
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
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
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)
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
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.
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.
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.
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.
Very interesting! This could also be the cause for the mysterious other
problems with VCC. :-)
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
> 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
16 matches
Mail list logo