<< 28-04-2023 >>

00:06:05FromDiscord<&_dükk ™> have a `set[string]`, getting error `ordinal type expected`, any thoughts?
00:07:01FromDiscord<Elegantbeef> `set` is a bitset not a hashset
00:07:01FromDiscord<Elegantbeef> look at `std/sets`
00:09:24FromDiscord<&_dükk ™> ah, i see
00:09:24FromDiscord<&_dükk ™> thanks!
00:23:52*rockcavera quit (Remote host closed the connection)
00:47:37*lucasta joined #nim
01:08:13FromDiscord<spikeisaac> In reply to @michaelb.eth "do you have any": maybe assembly
01:08:31FromDiscord<Elegantbeef> Nlvm might be for you
01:08:33FromDiscord<nwb^3> can anyone tell me if sequences really for have a builtin .find lambda or should i just give up using chatgpt as learning resource for nim 😛
01:08:47FromDiscord<Elegantbeef> There is a built in procedure for `fin`
01:08:50FromDiscord<nwb^3> sent a code paste, see https://paste.rs/J3k
01:08:54FromDiscord<michaelb.eth> In reply to @spikeisaac "maybe assembly": maybe not exactly what you have in mind, but see nlvm: https://github.com/arnetheduck/nlvm
01:08:59FromDiscord<Elegantbeef> Yea that's not how find works
01:09:14FromDiscord<Elegantbeef> `people.find(Person(name: "John", age: 25))`
01:09:58FromDiscord<Elegantbeef> One could make a find proc that took a procedure instead of course
01:10:28FromDiscord<nwb^3> thanks i see
01:11:24FromDiscord<nwb^3> its creating a tmp_person and doing a quick iteration using tmp_person in people
01:11:30FromDiscord<nwb^3> thanks for the help
01:11:50*beholders_eye quit (Ping timeout: 260 seconds)
01:11:52*cm quit (Ping timeout: 252 seconds)
01:12:12FromDiscord<spikeisaac> In reply to @michaelb.eth "maybe not exactly what": oh that’s cool
01:12:27FromDiscord<Elegantbeef> Not that there is much benefit to using LLVM 😄
01:12:59*cm joined #nim
01:17:40FromDiscord<auxym> nim already has a native backend, just happens to be called gcc 😉
01:20:19FromDiscord<Elegantbeef> Or clang, or msvc
01:20:19FromDiscord<Elegantbeef> Or zig 😛
01:44:15FromDiscord<michaelb.eth> In reply to @Elegantbeef "Or zig 😛": you mean via zig's compiler toolchain? or is someone working on a "transpiler" of Nim code to Zig code?
01:45:58FromDiscord<Elegantbeef> I mean using zig as a C compiler
01:45:58FromDiscord<Elegantbeef> Though Saem was interested in using Zig as a backend for the fork that shall not be named
01:45:58FromDiscord<Elegantbeef> No clue if he'll push that way 😄
01:52:40*rockcavera joined #nim
02:17:31*rockcavera quit (Remote host closed the connection)
02:18:02*rockcavera joined #nim
02:20:25systemdsucksthere's a fork of nim?
02:22:44FromDiscord<demotomohiro> https://github.com/nim-works/nimskull
02:33:43systemdsucksthanks
02:35:34*rockcavera quit (Remote host closed the connection)
02:35:58*rockcavera joined #nim
02:54:03FromDiscord<ArchGelod> it's weird: why would they leave unchanged nim icon and nim-related names if they want to make something "entirely different" and just forked for a compiler?
02:54:41FromDiscord<Elegantbeef> Cause they're still working on it and are dedicating time to more important things
03:52:04*TakinOver joined #nim
05:06:37*rockcavera quit (Remote host closed the connection)
05:45:01*ormiret quit (Read error: Connection reset by peer)
05:45:24*ormiret joined #nim
05:45:48*robertmeta quit (Ping timeout: 265 seconds)
05:47:24*robertmeta joined #nim
06:08:30FromDiscord<Yardanico> Beef look, nimscripter is taking over the world
06:08:32FromDiscord<Yardanico> http://github.com/gabbhack/nimplay↵↵https://nimplay.gabb.eu.org/
06:08:47FromDiscord<Yardanico> Nim compiler running in the browser, right now Nimscript only
06:08:51FromDiscord<Yardanico> still funny
06:09:01FromDiscord<Elegantbeef> Nice
06:09:27FromDiscord<Yardanico> 0 modifications to the compiler itself apparently
06:09:37FromDiscord<Yardanico> emscripten is too good at emulating libc and stuff
06:09:40FromDiscord<Elegantbeef> Yea i knew Nim -\> Wasm worked 😄
06:09:57FromDiscord<Elegantbeef> https://www.jasonbeetham.com/snake/nicoscripter.html has existed for quite some time
06:10:26FromDiscord<Elegantbeef> Someone really should take drawim and merge it with this 😄
06:11:06FromDiscord<Yardanico> Now to compile Clang and LLVM into WASM so we can compile Nim into C into WASM and execute right in the browser
06:11:11FromDiscord<Yardanico> But first JS backend
06:11:19FromDiscord<Yardanico> Shouldn't be too hard
06:11:41FromDiscord<Elegantbeef> Yea the JS backend shouldnt be too bad
06:12:33FromDiscord<Elegantbeef> The real awesome thing is how small their file is
06:12:42FromDiscord<Elegantbeef> https://github.com/gabbhack/nimplay/blob/master/src/wasm.nim all it took
06:14:15*arkurious quit (Quit: Leaving)
06:15:34FromDiscord<Elegantbeef> Anywho thanks for sharing, quite chuffed to see Nimscripter in use
06:16:11FromDiscord<huantian> chuffed to bits
06:16:29FromDiscord<Elegantbeef> I do still need to cleanup the `parseObject` macro cause that is fugly
06:18:30*Guest9040 joined #nim
06:19:04*Guest9040 quit (Client Quit)
06:20:14FromDiscord<Elegantbeef> Hmm i might have a way to axe that now that i'm looking at this code again
07:11:59FromDiscord<Chronos [She/Her]> In reply to @Elegantbeef "Though Saem was interested": Oh? Why use Zig instead of C? Especially since zig has a fork of clang that works
07:12:51FromDiscord<Elegantbeef> Zig has better features and has a cross platform linker
07:13:06FromDiscord<Chronos [She/Her]> Hm fair
07:14:06FromDiscord<Chronos [She/Her]> I'm interested in Nimskull/Cyo but the Cyo ecosystem won't be as big as Nim, and considering they removed async (for now, due to difficulty in maintaining it and stuff) it kinda removes what I'd use it for anyway
07:26:25*PMunch joined #nim
07:39:25*beholders_eye joined #nim
07:47:01*advesperacit joined #nim
08:01:39*Notxor joined #nim
08:08:24*lucasta quit (Ping timeout: 252 seconds)
08:09:06*lucasta joined #nim
08:20:59*jmdaemon quit (Ping timeout: 248 seconds)
08:31:13FromDiscord<Rika> I’ve been ruined by OTP to use any other language for asynchrony or networking ever again
08:34:48PMunchOTP?
08:38:19FromDiscord<Andreas> In reply to @PMunch "OTP?": AFAIK https://en.wikipedia.org/wiki/Open_Telecom_Platform
08:45:39*cyraxjoe quit (Ping timeout: 255 seconds)
08:45:48*lucasta quit (Quit: Leaving)
08:47:06PMunchAh Erlang stuff
08:47:08PMunchMakes sense
08:47:36PMunchWhat makes it so great @Rika? Or rather why wouldn't it be possible to implement something similar in Nim?
08:48:16FromDiscord<Andreas> In reply to @PMunch "What makes it so": It's all in the movie :=}} https://www.youtube.com/watch?v=xrIjfIjssLE
08:48:30FromDiscord<Rika> In reply to @PMunch "What makes it so": Well first is to adopt the process system and the ideology no? That is pretty Herculean I’d say
08:49:14PMunchOh sorry, I'm on IRC so didn't realise that comment was in reference to something :P
08:51:22FromDiscord<Yardanico> hm? it wasn't
08:51:27FromDiscord<Yardanico> the irc bridge shows you replies
08:51:35FromDiscord<Yardanico> this is how it looks in discord https://media.discordapp.net/attachments/371759389889003532/1101430499353829437/image.png
08:53:12FromDiscord<Amun-Ra> And if you have a nice relay script this is how it may look on IRC: https://media.discordapp.net/attachments/371759389889003532/1101430905605718016/irc.png
08:53:16PMunchOh, my bad again I guess. I thought someone had posted the Erlang movie before Rikas comment..
08:53:34PMunchOoh, I like those paragraphs
08:53:54PMunchMine just shows as normal users
08:54:02PMunchGotta update my script :)
08:54:19Amun-RaI'm using weechat with parse_relayed_msg.pl
08:54:30Amun-Ra§ is my char of choice
08:54:58Amun-Rayou just have to add the nick of the bot to the list and et voila
08:55:46FromDiscord<PMunch> I'm using a similar thing for HexChat
08:55:55FromDiscord<PMunch> With a Python script that I've modified
08:56:58PMunchThere, I believe it should append a paragraph symbol now
08:57:02Amun-Ra:)
08:57:26Amun-Rathe nice thing is weechat autocompletes relayed nicks, too
08:57:36PMunchDitto for HexChat
08:58:02Amun-Raalthough relayed message containing the nick has to be fairly recent
08:59:35PMunchHexChat does all of them :)
08:59:40Amun-Ranice :)
09:01:21NimEventerNew thread by shirleyquirk: Type binding generic alias with extra parameter, see https://forum.nim-lang.org/t/10140
09:17:14FromDiscord<Yardanico> @beef have you noticed that arc/orc don't work with emscripten?
09:17:16FromDiscord<Yardanico> which is weird
09:17:21FromDiscord<Yardanico> I think they should work just fine
09:17:39FromDiscord<Yardanico> simple programs do compile, but e.g. the compiler or nimes (nim nes emulator) throw memory out of bounds at runtime in the browser
09:17:47FromDiscord<Yardanico> (edit) "compile," => "compile and run just fine,"
09:22:08FromDiscord<Elegantbeef> I have not noticed that
09:47:56FromDiscord<PMunch> So, anything fun happened this past week while I was gone?
10:27:48*ltriant quit (Ping timeout: 255 seconds)
10:28:45NimEventerNew thread by drkameleon: Using named blocks with break instead of exceptions for targetted exception handling, see https://forum.nim-lang.org/t/10141
11:07:42FromDiscord<spikeisaac> In reply to @Elegantbeef "Not that there is": well I want to compile to machine code, not c or c++
11:14:26PMunchspikeisaac, well the C/C++ can be compiled to machine code..
11:14:35PMunchWhich is how Nim typically compiles stuff
11:17:47PMunchHmm, Amun-Ra slight problem with my script. It now auto-completes with the paragraph symbol :P
11:22:00Amun-RaPMunch: haha :D
11:34:16FromDiscord<spikeisaac> In reply to @PMunch "<@847850563604840488>, well the C/C++": yup
11:34:39FromDiscord<spikeisaac> but we compile our nim code to c or c++ than compile to machine code
11:35:57PMunchHuh?
11:36:14FromDiscord<spikeisaac> ?
11:36:27PMunchNot sure what you meant by that
11:36:50PMunchYou want machine code, Nim can generate machine code, it just takes a mostly transparent step of going by a C compiler
11:37:05FromDiscord<spikeisaac> oh ok
11:37:32FromDiscord<spikeisaac> so using something like GCC or Clang?
11:38:19PMunchYup
11:38:46PMunchWhen you run `nim c myprogram` you get a binary file. Behind the scenes Nim creates C code and invokes the C compiler
11:39:05PMunchBy default it uses GCC, but you can easily swap in another
11:39:57PMunchFor example you could use Clang, or the AVR compiler for doing stuff for Arduino, or even some other small C compilers like whatever they use for creating GBA games in Nim (I assume that's a separate compiler)
11:40:22FromDiscord<spikeisaac> So whats the difference between using that or LLVM? Isn't LLVM faster for compiling to machine code?
11:40:55PMunchWell the reason Nim uses C as a middle step is basically just because LLVM wasn't around/stable by the time Nim was created
11:41:33FromDiscord<Rika> In reply to @spikeisaac "So whats the difference": well is it?
11:42:01PMunchThere are pros and cons to both approaches, but going with C compilers as a target means that you get a lot of optimisations for free because of how much time has been spent on creating fast compilers. And you get a lot of flexibility because C runs pretty much everywhere
11:42:34FromDiscord<spikeisaac> so is it just as fast as if I were to use LLVM
11:42:49PMunchTo compile or to run?
11:45:09PMunchNim both compiles and runs plenty fast
11:45:48PMunchThe compilation can be slowed down quite a bit if you use a ton of macros, but that's just because you're actually doing work during compile-time :P
11:46:25PMunchAnd the binaries can be optimised just as much as C/C++ if you want to spend the time
12:11:24FromDiscord<jmgomez> Plus it allows for seamless interop which is one of the key features of Nim
12:20:54FromDiscord<planetis> How do you translate the asm statement in nim: https://stackoverflow.com/questions/15041519/benchmarking-code-reordering-volatile `asm volatile ("" : "+r" (m) : "r" (result));`
13:47:42*progranner joined #nim
13:49:07*progranner quit (Client Quit)
13:49:32*PMunch quit (Quit: Leaving)
13:52:21*progranner joined #nim
13:57:34*rockcavera joined #nim
14:03:32FromDiscord<demotomohiro> In reply to @spikeisaac "well I want to": Here is why Nim generate C/C++ code:↵https://internet-of-tomohiro.netlify.app/nim/faq.en.html#language-design-why-nim-generate-cslashcplusplus-codeqmark
14:26:11FromDiscord<Nerve> sent a long message, see http://ix.io/4usU
14:38:46FromDiscord<Yardanico> https://github.com/nim-lang/Nim/issues/21744
14:38:56FromDiscord<Yardanico> you know what's funny? i didn't know that .nimcfg is valid either
14:39:12FromDiscord<Yardanico> and searching through github and all nimble packages - absolutely no one has ever used .nimcfg except the coro module in nim stdlib
14:39:19FromDiscord<Yardanico> :DD
14:39:20*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
14:39:56FromDiscord<Yardanico> at least there are no instances of .nimcfg on github other than for nim repo forks for coro.nimcfg, same goes for packages in nimble
14:43:44FromDiscord<sOkam!> has anyone cross-compiled nim apps for mac?↵would love to take a look at the compiler setup required to do so, since the docs are very sparse on information about it↵also, how does nim work natively on a mac? if i install with choosenim (is it even possible to do so?) then what compiler will nim on mac by default? 🤔
14:44:01FromDiscord<sOkam!> (edit) "has anyone cross-compiled nim apps for mac?↵would love to take a look at the compiler setup required to do so, since the docs are very sparse on information about it↵also, how does nim work natively on a mac? if i install with choosenim (is it even possible to do so?) then what compiler will nim ... on" added "use"
14:44:35FromDiscord<Yardanico> In reply to @sOkam! "has anyone cross-compiled nim": > "then what compiler will nim use on mac by default?"
14:44:43FromDiscord<Yardanico> clang of course, nim supports clang just as well as gcc
14:44:55FromDiscord<sOkam!> clang is native for mac? didn't know
14:45:01FromDiscord<Rika> yes its what xcode uses
14:45:03FromDiscord<Yardanico> it is, apple are using clang for all of their stuff
14:45:14FromDiscord<Yardanico> swift uses llvm as the backend example
14:45:14FromDiscord<sOkam!> i barely know anything about apple software, so probably the question is super noob
14:45:16FromDiscord<Rika> iirc clang is partially also an apple creation
14:45:18FromDiscord<Yardanico> and for all native stuff they use clang
14:45:29FromDiscord<sOkam!> ah makes senses
14:45:29FromDiscord<Yardanico> In reply to @Rika "iirc clang is partially": it wasn't initially created by apple, but they did contribute heavily, yeah
14:45:36FromDiscord<Yardanico> because of permissive licensing compared to gcc
14:46:42FromDiscord<Yardanico> they did use GCC in the past, but of course not the way FSF would want GCC to be used :)
14:46:50*progranner joined #nim
14:47:25FromDiscord<sOkam!> #classic
14:47:42FromDiscord<Yardanico> actually sorry, it was even that way with NeXT
14:47:45FromDiscord<Yardanico> <https://en.wikipedia.org/wiki/Objective-C#Popularization_through_NeXT>
14:48:15FromDiscord<sOkam!> so, compiler question answered↵now, does choosenim have support for mac? i don't see it in the git readme 🤔
14:48:43FromDiscord<Yardanico> again, it does
14:49:21FromDiscord<sOkam!> nice, that's great news to find build-testers easier ✍️ tyty
14:49:43FromDiscord<sOkam!> for crosscompiling to mac, what are the options?
14:49:58FromDiscord<Yardanico> for simple console apps you can use zig cc
14:50:10FromDiscord<sOkam!> its a game engine
14:50:27FromDiscord<Yardanico> In reply to @sOkam! "its a game engine": you're using Metal?
14:50:32FromDiscord<sOkam!> wgpu
14:50:45FromDiscord<Yardanico> uhh
14:50:54FromDiscord<Yardanico> yeah it should work, seems like wgpu supports metal
14:51:14FromDiscord<sOkam!> it uses metal in the background when running on mac, vulkan on linux and don't know what on windows
15:13:32FromDiscord<dlesnoff> How do we get random chars? rand('a'..'z') returns me a cryptic error.
15:16:17FromDiscord<dlesnoff> Oh sorry this works, I have to do a MWE before asking 😓
15:37:04*xet7 joined #nim
15:38:26FromDiscord<0ffh> In reply to @Nerve "You seem pretty hell-bent": I've heard the argument being made that "transpilation" is limited to syntactic translation that does not change or add to the semantics.↵I think that's a good suggestion on where to draw a line, if one must.
15:40:16FromDiscord<Yardanico> In reply to @0ffh "I've heard the argument": that is partially true - e.g., with the C backend you can't fully control the alignment/ordering of fields in your structs
15:40:22FromDiscord<Nerve> In reply to @0ffh "I've heard the argument": Yeah, something like Babel.js or Coffeescript
15:40:55FromDiscord<Nerve> In this sense though, Python is definitely compiled to bytecode, though the bytecode is then interpreted
15:40:56FromDiscord<Yardanico> and Rust can do it because it uses LLVM
15:41:19FromDiscord<Yardanico> <https://camlorn.net/posts/April%202017/rust-struct-field-reordering/>
15:41:32FromDiscord<Nerve> Also herb Sutter's CppFront is a good transpiler example
15:41:37FromDiscord<Nerve> (edit) "herb" => "Herb"
15:41:43FromDiscord<Yardanico> sent a long message, see http://ix.io/4uto
15:43:51FromDiscord<Yardanico> but again, the C backend OTOH gives tons of interoperability with existing software, like emscripten :)
15:44:14FromDiscord<Yardanico> for example there's a game written in FreePascal, and because they don't have a C backend, you can't just take a game made with FPC + SDL2 and compile it for the web
15:44:25FromDiscord<Yardanico> they do have a wasm backend and llvm backend, but I think it will still be a big effort to make emscripten work with it
15:46:35FromDiscord<dlesnoff> sent a code paste, see https://play.nim-lang.org/#ix=4utr
15:47:31FromDiscord<0ffh> In reply to @Yardanico "but again, the C": Also it's essential for targeting all kinds of CPUs and uControllers.
15:47:39FromDiscord<dlesnoff> Oh is that due to limit oh I am dumb
15:47:49FromDiscord<Yardanico> In reply to @0ffh "Also it's essential for": yeah that is the main part for having a C backend :)
15:48:03FromDiscord<Yardanico> wasm, esp, gba, niche OSes, whatever
15:48:16FromDiscord<dlesnoff> (edit) "https://play.nim-lang.org/#ix=4utr" => "https://play.nim-lang.org/#ix=4uts"
15:48:36FromDiscord<Yardanico> if some target exists, there's probably a C compiler for it
15:50:15FromDiscord<Anuke> Is there a way to force nimble to uninstall a package despite being dependent upon by other packages?
15:51:05FromDiscord<Anuke> I have (my) package A that depends on cligen@[older version]; I `nimble install cligen` to get a newer one, and attempt to uninstall the older one, but it fails with `Cannot uninstall cligen (1.5.32) because`...
15:51:57FromDiscord<Yardanico> In reply to @Anuke "I have (my) package": shouldn't you instead just update your package to depend on a newer cligen version?
15:52:02FromDiscord<Yardanico> in the .nimble file
15:52:10FromDiscord<Yardanico> then next time you do install or build it should just get that version
15:52:50FromDiscord<Anuke> so here's the funny thing: when I do that, nimble still uses the old one as a dependency in the actual code, and the only way to fix it is to go into `.nimble` and delete the old package folder
15:53:02FromDiscord<Yardanico> In reply to @Anuke "so here's the funny": and you're compiling with nim or nimble?
15:53:09FromDiscord<Anuke> nimble
15:53:24FromDiscord<Yardanico> that's really weird then, but yeah, I don't actually know if you can force nimble to delete a package even though other packages depend on it
15:53:33FromDiscord<Anuke> well, a nimble task that calls `nim r`
15:53:38FromDiscord<Yardanico> oh
15:53:50FromDiscord<Yardanico> not sure if the nimble dependencies will get resolved properly then
15:55:17FromDiscord<Anuke> ~~guess it's time for manual package management then~~ https://media.discordapp.net/attachments/371759389889003532/1101537130104234166/image.png
16:00:29*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
16:01:56*progranner joined #nim
16:07:07*lucasta joined #nim
16:10:51NimEventerNew thread by choltreppe: A problem with refs on the js backend, see https://forum.nim-lang.org/t/10142
16:21:29*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
16:21:54*progranner joined #nim
16:38:54*arkurious joined #nim
16:38:55*arkurious quit (Remote host closed the connection)
16:43:52FromDiscord<ricky> In reply to @Anuke "~~guess it's time for": is it ever time for that?
16:43:54FromDiscord<ricky> 😟
16:46:25*arkurious joined #nim
17:12:25FromDiscord<Anuke> unfortunately yes
18:27:30*xet7 quit (Ping timeout: 265 seconds)
18:27:48FromDiscord<ieltan> Can someone explain to me `var T` vs `ref T`, like which one should I use?
18:35:12*Notxor quit (Remote host closed the connection)
18:37:15*Notxor joined #nim
18:38:12FromDiscord<JSONBash> might be mistaken, but `ref` is for `ptr`, if you're using it as a function argument then you'd most likely want `var` - allows for mutability but also passes as a reference (what i'm assuming you want). Anyone feel free to correct me
18:38:23*xet7 joined #nim
18:41:13FromDiscord<Yardanico> yes, object + var is generally if you just want to mutate something inside
18:41:23FromDiscord<Yardanico> ref is for shared ownership or where you can't use var, e.g. async or closures
18:42:42FromDiscord<ieltan> Okay, thanks you for answering
18:44:55FromDiscord<Yardanico> of course you should also use `ref object` if you want to allocate something specifically on the heap
18:51:01FromDiscord<ieltan> In reply to @Yardanico "of course you should": Well I don't think i need too, I just learned about `var T` while reading nim code for my binding code
18:51:27FromDiscord<Yardanico> but yeah, in most cases you don't actually need ref object
18:51:36FromDiscord<Yardanico> as well as you don't need TableRef or somilar (just Table is ok)
18:51:42FromDiscord<Yardanico> ah, right, forgot one more usecase for ref object
18:51:49FromDiscord<Yardanico> if you want object to possibly have itself
18:52:09FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4utX
18:52:11FromDiscord<Yardanico> so you need to use ref object here instead
18:57:06FromDiscord<ieltan> sent a code paste, see https://play.nim-lang.org/#ix=4utZ
18:57:34*xet7 quit (Quit: Leaving)
18:58:16FromDiscord<ieltan> In reply to @Yardanico "so you need to": the binding code that directly interop with my C header uses ptr instead, is it bad ?
18:58:26FromDiscord<Yardanico> In reply to @ieltan "the binding code that": no, it's good to be explicit
18:58:54FromDiscord<Yardanico> In reply to @ieltan "It's my first time": that's fine, but you also need to have a custom =copy
18:59:03FromDiscord<halc> can someone explain to a dummy what the heck is "atomic reference counting" and how Nim is not doing that?
18:59:06FromDiscord<halc> I am the dummy
18:59:30FromDiscord<halc> specifically I have no clue what "atomic" means
18:59:46FromDiscord<ieltan> In reply to @Yardanico "that's fine, but you": Ah, alright, thanks for pointing this out !
18:59:50FromDiscord<leorize> I take it that you already understand reference counting?
18:59:55FromDiscord<halc> yes
18:59:58*xet7 joined #nim
19:00:18FromDiscord<Yardanico> In reply to @ieltan "Ah, alright, thanks for": because otherwise it might happen that someone passes a copy of the variable to some other proc, the original gets destroyed so the other object also becomes invalid
19:00:33FromDiscord<leorize> "atomic" means "one action" at any given time
19:00:33FromDiscord<halc> I've looked at fusion's `SharedPtr` and I get it, I just don't know what Nim does that differs from it
19:00:51FromDiscord<leorize> this is useless in single-threaded world, so we will look at multi-threading
19:01:11FromDiscord<leorize> so imagine `var i: int; inc(i)`
19:01:19FromDiscord<leorize> what exactly is happening?
19:01:53FromDiscord<halc> you're probably setting i to zero, and then adding one to it
19:03:28FromDiscord<leorize> `i` is read into a register, then the register is incremented by one, then it is written back into `i`
19:03:30FromDiscord<leorize> suppose that 2 threads are doing this at the same time, with an initial `i` of `0`
19:04:47FromDiscord<leorize> sent a code paste, see https://play.nim-lang.org/#ix=4uu1
19:05:17FromDiscord<leorize> so `i` is supposed to be `2` here, but due to a race condition, `i` is `1` after both thread has done their deeds
19:06:00FromDiscord<leorize> "atomic" in this case refers to the use of atomic synchronization primitives
19:06:38FromDiscord<leorize> modern processors have the capability to perform the entire `inc(i)` dance in a single operation with no races
19:07:59FromDiscord<leorize> this is slower than the regular stuff (a whole lot slower), but now you can do your counting in `n` threads without losing data like this
19:09:43FromDiscord<leorize> Nim don't do atomic ref count since it's very slow and instead rely on "moving" memory
19:09:58FromDiscord<leorize> that's the theory at least, in practice this "moving" magic doesn't work yet
19:10:09FromDiscord<ieltan> In reply to @Yardanico "because otherwise it might": Correct me if i'm wrong but If it's a copy should it be disctinct in memory from the original ?
19:10:34FromDiscord<Yardanico> i mean if the code wants to make a copy, you need to handle that, the C library probably provides a way to copy the C struct
19:11:19FromDiscord<ieltan> Yeah you're right
19:11:21*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
19:11:36FromDiscord<ieltan> thanks man !
19:14:29*progranner joined #nim
19:43:11*xet7 quit (Ping timeout: 246 seconds)
19:43:38FromDiscord<halc> scuse me, had to go for a sec, thanks for the explanation
19:59:59*lucasta quit (Read error: Connection reset by peer)
20:03:41FromDiscord<Gabben> sent a code paste, see https://paste.rs/voG
20:03:59FromDiscord<Yardanico> shouldn't it be a ref object if it's a JS object?
20:04:02FromDiscord<Yardanico> since they all have ref semantics in JS
20:04:19FromDiscord<Yardanico> i've had a similar issue but it got fixed when I switched to `ref object` in Nim for the JS type
20:06:13FromDiscord<Gabben> In reply to @Yardanico "shouldn't it be a": You're right, thank you
20:22:00FromDiscord<Elegantbeef> @Anuke\: perhaps you might want to use atlas(depending on the version of Nim you're using), it's much simpler than nimble
20:23:57FromDiscord<Elegantbeef> Nimble 0.14 has so many annoying 'features'
20:24:15FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/blob/devel/tools/atlas/atlas.md
20:59:52*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
21:02:39*progranner joined #nim
21:13:36*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
21:48:37*advesperacit quit ()
21:54:57FromDiscord<michaelb.eth> there's also the nimbus-build-system, which can be used for any Nim project, if you're not afraid of Makefiles and git submodules
21:55:27FromDiscord<michaelb.eth> https://github.com/status-im/nimbus-build-system
21:55:33FromDiscord<michaelb.eth> granted it has some rough edges here and there
22:01:19FromDiscord<Elegantbeef> Yea just what a sane person wants... make
22:39:46*Notxor quit (Remote host closed the connection)
22:47:11*lucasta joined #nim