<< 10-04-2022 >>

00:03:39FromDiscord<Elegantbeef> Anyone know the proper define for checking when arc/orc?
00:04:56*zeus-supreme1 joined #nim
00:05:40*SamuelMarks joined #nim
00:07:56FromDiscord<Elegantbeef> seems it's `gcArc` or `gcOrc`
00:08:11*zeus-supreme quit (Read error: Connection reset by peer)
00:59:54*SamuelMarks quit (Ping timeout: 246 seconds)
01:01:48FromDiscord<TryAngle> does readFile work well with /proc/<pid>/maps↵or should I use a different function?
01:02:07FromDiscord<Elegantbeef> It should work with them
01:02:32FromDiscord<TryAngle> In reply to @Elegantbeef "It should work with": hmm because I wonder the file constantly changes 🤔
01:06:04*lumo_e quit (Ping timeout: 268 seconds)
01:07:14FromDiscord<Elegantbeef> There is a API for it i think, could be wrong
01:09:59*lumo_e joined #nim
01:21:17*neurocyte8614492 quit (Ping timeout: 256 seconds)
01:21:21FromDiscord<Ace Emerald> Is there a constant for the current module? I thought there was but I'm struggling to find it in the docs
01:22:14FromDiscord<Elegantbeef> What do you mean?
01:23:46FromDiscord<Ace Emerald> Like if I'm in the module `foo.nim` a constant string "foo" representing the name of the module
01:24:06FromDiscord<Elegantbeef> there is not
01:24:23FromDiscord<Ace Emerald> ah okay thanks
01:32:17FromDiscord<Elegantbeef> Why do you need the module name anyway?
01:38:10FromDiscord<Ace Emerald> Easy way to automatically add a scoping element to html ids and classes if I have an existing string constant for the module
01:42:29FromDiscord<TryAngle> how do I enable threading in nimble?
01:42:41FromDiscord<Elegantbeef> you dont
01:42:52FromDiscord<TryAngle> :c
01:43:11FromDiscord<Elegantbeef> you make a config file with `--threads:on`
01:44:19FromDiscord<TryAngle> may u show how 🥺
01:44:34FromDiscord<TryAngle> config.nims in src?
01:44:35FromDiscord<Elegantbeef> make a `config.nims` with `--threads:on`
01:44:37FromDiscord<TryAngle> and just add this line?
01:44:45FromDiscord<TryAngle> thanks!
01:45:02FromDiscord<Elegantbeef> Root or next the nim file
01:55:25FromDiscord<TryAngle> In reply to @Elegantbeef "Root or next the": works thanks
01:56:03FromDiscord<ITR> weird, the debugger doesn't work for me in vscode, but last time I programmed sometime last year it worked automatically. I wonder if that was on my laptop.
01:56:11FromDiscord<ITR> Does anybody know what I have to do?
01:56:59FromDiscord<TryAngle> sent a code paste, see https://paste.rs/ulf
01:57:07*arkurious quit (Quit: Leaving)
01:57:12FromDiscord<TryAngle> (edit) "https://play.nim-lang.org/#ix=3UJl" => "https://play.nim-lang.org/#ix=3UJm"
01:57:17FromDiscord<Elegantbeef> `@args`
01:57:37FromDiscord<Elegantbeef> Why is this a template?
01:57:49FromDiscord<TryAngle> In reply to @Elegantbeef "Why is this a": nim has log as a template
01:57:50FromDiscord<TryAngle> idk
01:57:57FromDiscord<TryAngle> so I thought I just do the same
01:58:43FromDiscord<Elegantbeef> Well anyway yea `@` should be all you need
01:58:51FromDiscord<Elegantbeef> You're alos doing `let`
01:58:56FromDiscord<Elegantbeef> Immutable args and all
01:59:05FromDiscord<Elegantbeef> What's the issue↵(@ITR)
02:00:15FromDiscord<TryAngle> In reply to @Elegantbeef "You're alos doing `let`": also insert(0, "") seems to be wrong 🤔
02:00:27FromDiscord<Elegantbeef> swap the args
02:01:08FromDiscord<ITR> In reply to @Elegantbeef "What's the issue (<@285422640540418059>)": It's just not stopping at any breakpoints, but I'm trying a random tutorial to set it up so I'll check if that works. Maybe I just remember wrong
02:01:38FromDiscord<Elegantbeef> https://github.com/saem/vscode-nim#debugging may help
02:03:27*SamuelMarks joined #nim
02:06:27FromDiscord<TryAngle> In reply to @Elegantbeef "swap the args": lol
02:06:38FromDiscord<TryAngle> I was thinking 5 min now what u mean
02:06:41FromDiscord<TryAngle> now I get it finally
02:06:43FromDiscord<TryAngle> XDDDDDDDDDDDD
02:08:40FromDiscord<ITR> In reply to @Elegantbeef "https://github.com/saem/vscode-nim#debugging may he": o, ty, other one suddenly started talking about python
02:11:04FromDiscord<ITR> eyy, that worked, ty <2
02:15:07FromDiscord<TryAngle> do threads get closed when I close the program or do I have to lcose them myself?
02:15:22FromDiscord<Elegantbeef> The OS will handle them but you're supposed to close them
02:19:12*adigitoleo left #nim (#nim)
02:27:50FromDiscord<TryAngle> does channels. tryRecv return 0 like peek if nothing is there? the docs seem a little odd written
02:28:00FromDiscord<TryAngle> (edit) "does channels. tryRecv return 0 like peek if nothing is there? the docs seem a little odd written ... " added "like it would wait"
02:28:12FromDiscord<TryAngle> (edit) "does channels. tryRecv return 0 like peek if nothing is there? the docs seem a little odd written like it would wait ... " added "and only fail in weird cases"
02:28:14FromDiscord<Elegantbeef> Try recv is a non blocking check
02:28:29FromDiscord<TryAngle> ok ty
02:28:42*lumo_e quit (Ping timeout: 268 seconds)
02:29:28FromDiscord<TryAngle> is there also some way to give a "timout limit" to channel recv?
02:30:05FromDiscord<Elegantbeef> Nope
02:30:16FromDiscord<Elegantbeef> You use tryrecv and sleep ideally
02:32:13*anoxc2og joined #nim
02:33:53*anoxc2og quit (Remote host closed the connection)
03:11:17FromDiscord<TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3UJv
03:11:17FromDiscord<TryAngle> what can I do with this error?
03:11:44FromDiscord<Elegantbeef> Read the error and realize "hey my thread isnt mutable"
03:12:04FromDiscord<TryAngle> In reply to @Elegantbeef "Read the error and": but it is
03:12:07FromDiscord<Elegantbeef> If that's nto the case, realize "Hey my proc isnt annotated `{.thread,}`"
03:12:16FromDiscord<TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3UJw
03:12:41FromDiscord<Elegantbeef> It's not threadsafe then
03:13:08FromDiscord<Elegantbeef> You can annotate it with `{.thread.}` orto see why it's not or `{.gcsafe.}` if you know more than the compiler
03:13:47FromDiscord<TryAngle> ah when I remove the registerLoggers it works 🤔
03:14:06FromDiscord<Elegantbeef> to see why it's not\
03:14:31FromDiscord<TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3UJx
03:15:14FromDiscord<Elegantbeef> Not access global variables
03:15:45FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UJy
03:16:03FromDiscord<TryAngle> so its' a different logger for each thread then 🤔
03:16:12FromDiscord<Elegantbeef> > The list of handlers is a thread-local variable. If the given handler will be used in multiple threads, this proc should be called in each of those threads.
03:16:23FromDiscord<Elegantbeef> If you're using `std/logging` yes that's the case
03:16:37FromDiscord<TryAngle> In reply to @Elegantbeef "> The list of": ye that's why I did registerLogger in each thread
03:17:08FromDiscord<Elegantbeef> https://nim-lang.org/docs/logging.html#basic-usage-notes-when-using-multiple-threads
03:17:24FromDiscord<TryAngle> ok but don't I have 2 loggers writing the same file / output then ?
03:17:28FromDiscord<Elegantbeef> Well accessing global heap variables is not thread safe
03:17:36FromDiscord<TryAngle> is fmAppend safe here?
03:18:37FromDiscord<Elegantbeef> No clue
03:18:57FromDiscord<TryAngle> ok guess I will test it lol
03:19:02FromDiscord<Elegantbeef> You probably need a lock to make it safe
03:19:05FromDiscord<Elegantbeef> Or just write to different files
03:28:11FromDiscord<TryAngle> hmmm I'm getting a weird SIGSEGV error 🤔
03:28:25FromDiscord<TryAngle> (edit) "hmmm I'm getting a weird SIGSEGV error ... 🤔" added "(attempt to read from nil) when I try to send to the channel from main thread"
03:28:47*SamuelMarks quit (Ping timeout: 256 seconds)
03:32:34FromDiscord<Elegantbeef> Is it a ref?
03:34:27FromDiscord<TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3UJC
03:35:05FromDiscord<TryAngle> both are in different files
03:35:28FromDiscord<TryAngle> the send in main() crashes
03:35:37FromDiscord<TryAngle> trySend crashes also
03:35:39FromDiscord<TryAngle> with same error
03:35:51FromDiscord<Elegantbeef> you dont init the channel
03:36:12FromDiscord<TryAngle> OHHHHH
03:36:46FromDiscord<TryAngle> thanks
03:36:50FromDiscord<TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3UJD
03:37:59FromDiscord<TryAngle> now it works 🥺 thank u
03:39:59*rockcavera quit (Read error: Connection reset by peer)
03:40:24*rockcavera joined #nim
03:40:24*rockcavera quit (Changing host)
03:40:24*rockcavera joined #nim
03:51:04FromDiscord<TryAngle> @ElegantBeef I tested now, using two files in two different threads just override each other
04:30:11*slowButPresent quit (Quit: leaving)
04:53:15FromDiscord<!Patitotective> how can i get the current datetime in a specific `TimeZone`?
04:53:59*rockcavera quit (Remote host closed the connection)
04:56:21FromDiscord<!Patitotective> `n`
04:56:24FromDiscord<Elegantbeef> `zonedTimeFromTime(myTZ, now().toTime)`?
04:56:47FromDiscord<!Patitotective> i think `now().inZone(myTZ)` works too
06:11:58*jmd_ quit (Ping timeout: 260 seconds)
06:35:15*zeus-supreme joined #nim
06:37:43*zeus-supreme1 quit (Read error: Connection reset by peer)
06:50:42*SamuelMarks joined #nim
06:55:37*SamuelMarks quit (Ping timeout: 256 seconds)
06:58:49*jjido joined #nim
07:14:58*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
08:13:08*jjido joined #nim
08:50:35*PMunch joined #nim
08:57:15FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3UKw
09:00:10FromDiscord<Elegantbeef> `staticExec`
09:03:37FromDiscord<d4rckh> thanks! is there any way to run code based on which platform im compiling on?
09:04:16FromDiscord<Elegantbeef> `when defined(linux)`
09:04:55FromDiscord<d4rckh> 👍
09:11:29Amun-Rayou rarely need to be as specific, when defined posix: is fine
09:14:08*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
09:48:05*lumo_e joined #nim
09:55:27PMunchHmm, I'm trying to run MPFIT from Vindaar on some data
09:56:22PMunchFor the most part it works fine, but sometimes, if there is something wrong with the formula I feed it, it just runs forever
09:57:08PMunchThrew in some debugEcho statements in the formula function and it shows that it sweeps over the weights, then calls it once with all NaNs, and then starts over
10:15:27*jjido joined #nim
10:15:58*jjido quit (Client Quit)
10:26:54*SamuelMarks joined #nim
10:27:16*Gustavo6046 quit (Quit: Goodbye! Leave messages at my XMPP @ [email protected] or my Discord Gustavo6046#9009 or possibly my Mastodon [email protected] – I don't check my email often since it's full of crap, but in any case, [email protected])
10:31:21*SamuelMarks quit (Ping timeout: 248 seconds)
10:54:22*lumo_e quit (Ping timeout: 268 seconds)
11:16:27*oddish quit (Quit: nyaa~)
11:24:27*oddish joined #nim
11:33:08*lumo_e joined #nim
12:00:19PMunch`Error: low(kind) must be 0 for discriminant` is this to "fix" the default value for enum is 0 problem?
12:02:41PMunchHmm, it's really annoying that we can't share the same name for two fields in different cases. I have three different cases, and two of them share quite some fields that the third one doesn't have
12:19:29*slowButPresent joined #nim
13:04:28*zeus-supreme1 joined #nim
13:07:37*zeus-supreme quit (Ping timeout: 248 seconds)
13:13:18FromDiscord<System64 ~ Flandre Scarlet> I have an header and a library written in C++, can I use them in Nim?
13:13:50PMunchYes
13:15:58FromDiscord<System64 ~ Flandre Scarlet> In reply to @PMunch "Yes": ah alright, even if I don't use the C++ compiler?
13:16:27PMunchWell, if you can compile it into a dynamic or shared library you can use the C compiler, otherwise you'd need the C++ compiler
13:17:47FromDiscord<System64 ~ Flandre Scarlet> In reply to @PMunch "Well, if you can": my DLL is written in C++, and my header is HPP, but I want to use the C compiler in Nim
13:18:05PMunchThat should be fine
13:18:24FromDiscord<System64 ~ Flandre Scarlet> ah alright
13:18:33PMunchI believe, you might have some trouble getting all the types right though
13:18:40PMunchDepends on the interface it exposes over the DLL
13:18:41FromDiscord<System64 ~ Flandre Scarlet> but there is no Extern C
13:18:56FromDiscord<System64 ~ Flandre Scarlet> https://media.discordapp.net/attachments/371759389889003532/962703227340591154/vgmplayer.hpp
13:19:21PMunchTry to share links instead of images
13:19:28PMunchI assume it's this file: https://github.com/ljmccarthy/fmplay/blob/master/include/vgmplayer.hpp
13:19:32FromDiscord<System64 ~ Flandre Scarlet> it's not an image
13:19:42PMunchOh sorry, instead of files..
13:19:59PMunchDiscord creates silly links that don't work for us non-discord users when you do that
13:20:25PMunchAh, yeah that'll be a pain to wrap with pure C I believe
13:29:10FromDiscord<System64 ~ Flandre Scarlet> Yeah, I think it will be pain
13:35:54NimEventerNew post on r/nim by veloxVolpes: Chrome blocks download?, see https://reddit.com/r/nim/comments/u0hp0k/chrome_blocks_download/
13:44:35FromDiscord<Valdar> In reply to @PMunch "Ah, yeah that'll be": I didn't think you could use the C backend with a C++ lib↵Isn't that why we have a cimgui dll as well as a imgui.dll? No one(as far as I know) has been able to use the C backend without using the cimgui version
13:46:40PMunchWell it's technically possible
13:47:05PMunchIf the DLL was only using C stuff it would even be pretty straight forward I believe
13:47:20PMunchBut as soon as it exposes C++ data over the DLL interface then it starts getting tricky
13:47:21*arkurious joined #nim
13:48:12PMunchIt's like passing a seq[] over a DLL, if the receiver is Nim then you're fine, but if it's C it's still technically possible to read the data, but you need to reimplement Nim seq logic in C.
13:50:28FromDiscord<Valdar> Well, technically true, yeah, but I don't see many modern C++ libs that stick close to straight C
14:11:51FromDiscord<!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3ULz
14:12:03FromDiscord<!Patitotective> (edit) "https://play.nim-lang.org/#ix=3ULz" => "https://paste.rs/LgU"
14:14:41FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3ULB
14:15:46FromDiscord<enthus1ast> `del` is faster i guess but it changes the order of elements
14:24:30FromDiscord<Phil> ... I have the faint feeling that orc may be garbage collecting my global variable table that stores pointers to various procs
14:24:32FromDiscord<Phil> squint
14:24:59FromDiscord<Solitude> no hecking way
14:25:52FromDiscord<Rika> In reply to @Isofruit "... I have the": <:thinking_slightly_more_intently:312535068990242816>
14:26:33FromDiscord<Phil> Look, I coded this while using the normal gc and when swapping to orc it didn't explode in my face so I had the vague assumption it wouldn't silently collect my globals out from under my ass
14:28:09FromDiscord<Phil> I'm actually not quite sure how else to build a signal system equivalent if I can't have a global variable that nobody points to outside of a single generic proc (triggerSignal) that is called in other generic procs
14:28:19FromDiscord<Phil> Not while using orc at least
14:28:52FromDiscord<!Patitotective> sent a code paste, see https://paste.rs/CKa
14:30:42FromDiscord<enthus1ast> a delete that removes from the original list and returns a copy of the list with the item deleted?
14:30:52FromDiscord<enthus1ast> sounds strange \:)
14:31:19FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3ULE
14:35:06FromDiscord<eversinc33> How can I/can I pass a type to a template? I want to have a template that unmarshalls JSON into a type (using to() on a jsonNode) and pass that type as an argument
14:36:12FromDiscord<!Patitotective> sent a code paste, see https://paste.rs/MbV
14:38:17FromDiscord<Solitude> In reply to @eversinc33 "How can I/can I": what do you mean? just pass it? as typedesc or untyped, whatever fits you better.
14:39:15FromDiscord<Rika> in this case you can use sugar.dup now no?
14:39:35FromDiscord<enthus1ast> yes i also though so↵(@Rika)
14:40:49FromDiscord<eversinc33> sent a code paste, see https://play.nim-lang.org/#ix=3ULJ
14:40:56FromDiscord<Rika> `typedesc`
14:41:08FromDiscord<eversinc33> oh, thanks! didnt know the kwyword
14:41:17FromDiscord<Solitude> man...
14:41:17FromDiscord<eversinc33> (edit) "kwyword" => "keyword :)"
14:41:32FromDiscord<Rika> solitude literally said typedesc lol
14:42:17FromDiscord<eversinc33> yea just wanted to clarify thats why i replied. sorry
14:43:55*xet7 quit (Read error: Connection reset by peer)
15:13:09FromDiscord<Phil> Head --> Desk↵Sometimes overloading can be painful
15:14:41FromDiscord<Phil> Spent the last 15 minutes troubleshooting only to realize that a generic proc of mine took a proc as a parameter called `delete`, which very much overlaps in name with norm/sqlite's `delete` proc. And given that the passed delete was a generic proc, naturally it took sqlite's proc, which lead to all sorts of fun behaviour because both have the same signature
15:15:07FromDiscord<Phil> (edit) "proc," => "delete,"
15:20:31FromDiscord<gerwy> Just from curiosity
15:20:58FromDiscord<gerwy> Did anyone ever tried to make nim compile to c↵And instead od gcc or clang, use zig as c compiler?
15:21:06FromDiscord<gerwy> Does it work out well?
15:23:25FromDiscord<hmmm> hmm you mean compile to zig which compiles to c ? 🤔
15:28:07PMunch@gerwy, yes someone have tried: https://github.com/nim-lang/Nim/pull/13757
15:32:35*xet7 joined #nim
15:38:42*xet7 quit (Quit: Leaving)
15:43:18FromDiscord<Zoom> No, Zig compiler can compile C code itself, so gerwy meant what he wrote.↵(@hmmm)
15:44:26FromDiscord<hmmm> oh I didn't know. Looks like zig is getting some traction lately
15:49:08*lumo_e quit (Ping timeout: 268 seconds)
15:50:42*Gustavo6046 joined #nim
15:51:40*Gustavo6046 quit (Remote host closed the connection)
15:52:18*Gustavo6046 joined #nim
15:52:35*lumo_e joined #nim
15:53:04FromDiscord<Yardanico> In reply to @Life Sucks "Did anyone ever tried": that works since forever, and you don't need to make "nim compile to c", because it already does
15:53:55FromDiscord<Yardanico> you can easily use zig cc with nim nowadays, just create a script called zigcc.sh or something (important that it doesn't have spaces), put the call to zig cc there
15:54:09FromDiscord<Yardanico> and then for nim do `--cc:clang --clang.exe:zigcc.sh` etc
15:54:25FromDiscord<Yardanico> ofc linkerexe too
15:54:34FromDiscord<Yardanico> see for example https://github.com/Yardanico/ircord/blob/master/zig-compile-vps.sh
15:55:03FromDiscord<Yardanico> -fno-sanitize=undefined is needed because zig enables UBSAN by default, and UBSAN doesn't always play well with Nim
16:01:29*rockcavera joined #nim
16:01:29*rockcavera quit (Changing host)
16:01:29*rockcavera joined #nim
16:02:12Amun-Rais there way of getting custom pragma of an object type in a macro?
16:02:38FromDiscord<Yardanico> https://nim-lang.org/docs/macros.html#hasCustomPragma.m%2Ctyped%2C
16:02:44FromDiscord<Yardanico> https://nim-lang.org/docs/macros.html#getCustomPragmaVal.m%2Ctyped%2C
16:07:39Amun-Rathat doesn't seem to work, hmm, let me make a test case
16:12:26Amun-RaYardanico: https://play.nim-lang.org/#ix=t%20wr (that's probably a pebkac, I'm still fairly new to macros)
16:12:45Amun-Rawrong link
16:12:46FromDiscord<Yardanico> please post again, it didn't go through correctly :)
16:13:14Amun-Rasometimes play.nim-lang.org replaces the code with a random one
16:13:23Amun-RaI have to type it again
16:13:54Amun-RaYardanico: https://play.nim-lang.org/#ix=3UMl
16:15:57FromDiscord<Yardanico> hm
16:16:06FromDiscord<Yardanico> maybe it's because hasCustomPragma is supposed to work in normal procedures? not sure
16:16:19Amun-RaI guess so
16:16:57Amun-RaI writing my custom macro to read all big endian/little endian fields from a stream an reaturn a ready object
16:31:22FromDiscord<gerwy> In reply to @PMunch "<@347345994217816066>, yes someone have": Nicee
16:33:05FromDiscord<gerwy> In reply to @Yardanico "that works since forever,": No i know, it was just my shortcut for idea that you can use zig as a compiler in nim↵And if its as easy as just putting it in the cc flag then great :D
16:33:53FromDiscord<Yardanico> zig cc compiler is only useful for cross compiling, since it's just clang at the end of the day
16:38:24FromDiscord<gerwy> Yeah it has very good cross compiling
17:16:01FromDiscord<ITR> Bit confused, why does it complained about {.memoized.} having side effects when I call binomial, but not when I call nCr?
17:16:03FromDiscord<ITR> https://media.discordapp.net/attachments/371759389889003532/962762901289058375/unknown.png
17:16:25FromDiscord<ITR> (Rat being Rational[int])
17:19:44*Guest81 joined #nim
17:20:17*Guest81 quit (Client Quit)
17:37:40*averell quit (Quit: .)
17:45:03FromDiscord<Rika> is this in relation to the primer game
17:45:45FromDiscord<Zoom> Maybe cecause binomial affects the cache living outside (the one of `nCr`)
17:46:41FromDiscord<Rika> memoized probably works for ncr because it rewrites recursive calls, perhaps
17:47:30FromDiscord<Zoom> Does `{.memoized.}` just declare a global-pragma'd var inside a proc body?
17:47:50FromDiscord<Rika> probably not `{.global.}` but an actual global
17:48:25FromDiscord<Zoom> Then both should be caught by the effect tracking. Hm...
17:51:41NimEventerNew thread by Llamas2: Shared memory with ARC, see https://forum.nim-lang.org/t/9099
17:53:24FromDiscord<Zoom> Just checked, locally declared {.global.} vars are also get caught by the tracking. It's probably right, but disputable
17:54:25FromDiscord<Zoom> If you think about it, your func just becames a poor-man's object by having a state. And it shouldn't be accessible from any other place in the code.
17:55:41FromDiscord<Rika> i just thought of smth cursed as fuck
17:56:04FromDiscord<Zoom> Yeah, it's definitely right to curse at {.global.} local vars...
17:56:06FromDiscord<Rika> actually no nvm it wouldnt work
17:56:21FromDiscord<Rika> no it was something worse but i thought again and it wouldnt work
17:58:01FromDiscord<Yardanico> sanest nim developer
17:58:57FromDiscord<Rika> tfw reacts to own message
17:59:45FromDiscord<Yardanico> sanest nim moderator
18:00:18FromDiscord<Rika> least abusive nim moderator
18:01:53FromDiscord<Yardanico> that'd be pmunc (censored to not ping), not me
18:02:42FromDiscord<huantian> What does the Mega role even mean
18:02:54FromDiscord<Rika> it means you're Mega
18:03:13FromDiscord<Yardanico> In reply to @huantian "What does the Mega": legacy of this discord server
18:03:19FromDiscord<huantian> I see
18:03:34FromDiscord<Yardanico> back then people thought no one would use it and we had a bad bridge bot that didn't even bridge the users separately
18:03:44FromDiscord<Yardanico> https://forum.nim-lang.org/t/3272
18:03:48FromDiscord<Yardanico> (edit) "then" => "when"
18:04:04FromDiscord<Yardanico> also not "channel" but "server"
18:04:10FromDiscord<Yardanico> (that's my old forum account)
18:04:28FromDiscord<huantian> Wow 2017 huh
18:05:06FromDiscord<huantian> At some point I gotta join the telegram channel and see what that’s like
18:05:36FromDiscord<Yardanico> In reply to @huantian "At some point I": 1.5 people talking about nim and the rest are memes
18:06:03FromDiscord<Yardanico> https://t.me/nim_lang feel free to check
18:07:15FromDiscord<huantian> I should commission some Nim related sticker w
18:07:19FromDiscord<huantian> (edit) "sticker w" => "stickers"
18:07:20FromDiscord<Yardanico> those already exist :P
18:07:23FromDiscord<huantian> Ah
18:07:32FromDiscord<Yardanico> although some of them are not that good in my opinion :)
18:07:53FromDiscord<Yardanico> a proper nim sticker pack would be welcome, yes
18:08:35FromDiscord<Solitude> In reply to @Yardanico "although some of them": shut up
18:08:42FromDiscord<Yardanico> In reply to @Solitude "shut up": im not talking about your sticker pack
18:08:48FromDiscord<Yardanico> im talking about juan's
18:10:43FromDiscord<huantian> Then I should make a fursona and commission stickers of my sona coding Nim
18:11:02FromDiscord<Rika> why
18:11:20FromDiscord<Rika> i mean ok sure if you want
18:11:43FromDiscord<Zoom> Guys, this is not #offtopic
18:12:52FromDiscord<Solitude> this guy doesnt know
18:16:54FromDiscord<vSkyleX> Does Nim have an LTS version?
18:17:18FromDiscord<Yardanico> In reply to @vSkyleX "Does Nim have an": technically 1.2 is an LTS
18:17:28FromDiscord<Yardanico> status are still using it for their projects so it gets some critical bugfixes
18:17:41FromDiscord<vSkyleX> alright, thanks
18:18:09FromDiscord<Yardanico> but anyway they're not really updated regularly
18:18:25FromDiscord<vSkyleX> so its better to use the 1.6.4?
18:18:34FromDiscord<Yardanico> generally of course, a lot of new bugfixes and features
18:18:52FromDiscord<Yardanico> the only reason to use older nim versions is if your project was written with them and has a lot of issues with newer nim
18:19:07FromDiscord<vSkyleX> thanks!!
18:26:22FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3UMJ
18:30:13FromDiscord<Yardanico> nope, to force it you can use special comments
18:30:22FromDiscord<Yardanico> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-emit-pragma
18:30:36FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/962781658019405864/unknown.png
18:31:12FromDiscord<Rika> damn nim docs still has no-fullstop close pragma?
18:31:16FromDiscord<Yardanico> ?
18:31:27FromDiscord<Rika> {.pragma}
18:31:48FromDiscord<Yardanico> apparently not
18:31:58FromDiscord<Yardanico> tbh I think that this syntax shouldn't be popularized anyway :)
18:32:06FromDiscord<Yardanico> it makes less sense than {.pragma.}
18:32:10FromDiscord<Rika> thats my point, i think it shouldnt
18:32:18FromDiscord<Rika> also it does, your picture has it right there
18:32:36FromDiscord<Yardanico> old code example :P
18:33:39FromDiscord<d4rckh> On Windows, my nim program requires some DLLs, like libcrypto-1_1-x64.dll and libwinpthread-1.dll. How can I make it so when others download my program they don't need to download those dlls, I think I kinda need to link them or something right?
18:34:20FromDiscord<enthus1ast> pack them in a zip file
18:34:40FromDiscord<d4rckh> there isn't any other way? oof
18:35:03FromDiscord<enthus1ast> use an installer creator like nsis or inno setup
18:35:53FromDiscord<d4rckh> I don't think I can add nsis or inno in my github actions so ig ill go with zipping them
18:35:58FromDiscord<jmgomez> In reply to @Yardanico "": ouch wasnt expected a comment for something like that in a lang that take types seriosly lol. Thanks!
18:35:59FromDiscord<d4rckh> (edit) "in" => "to"
18:36:11FromDiscord<jmgomez> (edit) "take" => "takes"
18:38:37FromDiscord<enthus1ast> @d4rckh\: you can also link everything statically sure, but it can be a lot of work, since you must build all the used libs to static libraries first (which itself can be a project on its own) or somehow aquire the static libs.
18:39:57FromDiscord<jmgomez> but this is not something specific to nim, that happens in c/cpp too
18:40:58FromDiscord<d4rckh> oof
18:41:25FromDiscord<enthus1ast> i mean, the stuff he mentioned is c↵(@jmgomez)
18:41:46FromDiscord<jmgomez> In reply to @Yardanico "": but are you sure that also works for includes? doesnt seem to be the case
18:43:17FromDiscord<jmgomez> may be the header pragma evaluated before the code within the mofule/file?
18:44:41FromDiscord<jmgomez> in the docs it's used in conjuntion with importcpp but not with the headers, Araq pointed out in the forums that you can do it in the headers but it feel worst
18:44:54FromDiscord<jmgomez> (edit) "headers," => "header pragma"
18:45:08FromDiscord<jmgomez> (edit) "headers" => "header pragma"
18:48:00*jmdaemon joined #nim
18:55:05*elph joined #nim
18:56:28FromDiscord<Daan Breur> hello, what is the best way for interthreadcommunication. So that the threads report back to the main loop? I found the channels modules `https://nim-lang.org/docs/channels_builtin.html` but how can i send objects / custom types across it
18:59:03FromDiscord<Zoom> If you use arc/orc for memory menagement, go with https://github.com/nim-lang/threading/↵(@Daan Breur)
19:00:33FromDiscord<Zoom> Channels are generic, so send what you like
19:02:17FromDiscord<Daan Breur> Thanks
19:02:21FromDiscord<Daan Breur> Didnt know that
19:20:36FromDiscord<jmgomez> Ok no, I was doing something wrong. Thing is I can use the type ptr or the stack but if I do a new (which I dont plan to do anyways, but to call a helper in the cpp side of thigs due to the GC is there) the compiler start asking for more stuff. Not sure why is that
19:24:31*jjido joined #nim
19:30:55*lumidify joined #nim
19:34:42*zeus-supreme joined #nim
19:37:49*zeus-supreme1 quit (Read error: Connection reset by peer)
19:37:56*Gustavo6046 quit (Remote host closed the connection)
19:38:37*Gustavo6046 joined #nim
20:00:12FromDiscord<luteva> sent a long message, see http://ix.io/3UMT
20:01:26FromDiscord<luteva> (edit) "http://ix.io/3UMT" => "http://ix.io/3UMW"
20:09:40FromDiscord<vSkyleX> Can anyone tell me if current Nim version has some cons. I need it for my written report
20:09:57FromDiscord<Rika> Cons in what sense
20:10:02FromDiscord<Rika> For what application
20:10:06FromDiscord<vSkyleX> cons of using nim generally speaking
20:10:13FromDiscord<Rika> It’s kinda like asking if there are cons to apples
20:10:20FromDiscord<Rika> Like okay, what about it
20:10:46FromDiscord<Rika> I still don’t know what your intent is with “generally speaking@
20:11:21FromDiscord<vSkyleX> if we take python for instance you can say that one of it's cons is that it's slow because it's interpreted
20:11:32FromDiscord<Rika> Okay
20:11:38FromDiscord<Rika> Okay I get it
20:11:39FromDiscord<vSkyleX> im looking for something like this
20:11:42FromDiscord<Rika> Nim has a small ecosystem
20:11:43FromDiscord<vSkyleX> nothing too specific
20:11:55FromDiscord<Rika> The developer team is kinda small, so progress is relatively slow
20:12:09FromDiscord<Rika> Progress as in bug fixes and features
20:12:23FromDiscord<Rika> Then support from larger companies is limited
20:12:55FromDiscord<Rika> The ideology is relatively different to the standard languages
20:13:03FromDiscord<Rika> So it might take time to get used to
20:13:19FromDiscord<Rika> There are some surface level controversial features
20:13:48FromDiscord<Rika> In reply to @Rika "The developer team is": Because of this, they’re overloaded with work pretty much
20:14:01FromDiscord<Rika> We really need more supporters ngl
20:14:17FromDiscord<vSkyleX> Noted. I appreciate your help!
20:15:23FromDiscord<Rika> I’m not sure of any more
20:15:34FromDiscord<Rika> Not coming to the surface of my mind’s ocean
20:16:55FromDiscord<ynfle> A con is the sometimes people mistake it's easy, readable syntax with simplicity and shoot themselves in the foot or are confused why it doesn't work like python, but I'm not sure if that's what you're after
20:17:51FromDiscord<vSkyleX> In reply to @ynfle "A con is the": I done some Nim coding and I didn't really notice the difference
20:18:42FromDiscord<vSkyleX> In reply to @Rika "We really need more": I don't understand why Nim is not getting Python's popularity imo its way better and efficient than python
20:18:42FromDiscord<Rika> In reply to @vSkyleX "I done some Nim": You’re lucky or smart
20:18:50FromDiscord<Rika> In reply to @vSkyleX "I don't understand why": Because it’s controversial
20:18:58FromDiscord<Rika> Oh what? Style insensitivity? Eww
20:19:02FromDiscord<Rika> Oh what? Macros? The fuck?
20:19:06FromDiscord<vSkyleX> lolll
20:19:12FromDiscord<Rika> Oh what? Indentation? Seriously?
20:19:24FromDiscord<Rika> You know how much time it took for Python indentation to be considered fine??
20:19:30FromDiscord<Rika> And it still isn’t
20:19:35FromDiscord<vSkyleX> In reply to @Rika "You’re lucky or smart": more like spent a year working with lisp ada prolog ... and all of them old languages
20:19:55FromDiscord<Rika> You still get people here asking if there are braces options and yes I understand it’s fine that they want it
20:19:59FromDiscord<Rika> But I don’t know
20:20:09FromDiscord<Rika> In reply to @vSkyleX "more like spent a": So you didn’t get culture shock then
20:20:16FromDiscord<vSkyleX> nop lmao
20:20:23FromDiscord<Rika> Since we take lots of inspiration from those
20:20:27FromDiscord<Rika> Yeah that’s nice
20:20:32FromDiscord<Rika> I didn’t really either, I don’t know why
20:20:50FromDiscord<vSkyleX> if you were writing code in java or c your entire life
20:21:11FromDiscord<vSkyleX> u would say the stuff u said above
20:21:16FromDiscord<vSkyleX> its tough macros etc
20:21:35FromDiscord<vSkyleX> just bc I think ppl think that Java C C++ are the top languages
20:21:59FromDiscord<vSkyleX> but anyways
20:22:01FromDiscord<vSkyleX> thanks guys
20:22:26FromDiscord<Rika> Yeah
20:26:30FromDiscord<luteva> "I think ppl think that Java C C++ are the top languages"↵well they still are.... for having a job, working with damn boring languages that are the opposite of nice/clean/cool/save 😄
20:27:15FromDiscord<Rika> Well in the end companies care about maturity and stability
20:28:09FromDiscord<ynfle> And Oracle has tons of money
20:28:56FromDiscord<luteva> well not only. They also care about having the code in a language they are able to find new devs. But that way nothing will ever change....
20:30:37FromDiscord<ynfle> I mean java was marketed, supported and built out like crazy with tons of money. So they can easily change the system
20:35:51*SamuelMarks joined #nim
20:36:55FromDiscord<Zoom> Citation needed↵(@Rika)
20:37:07FromDiscord<huantian> I mean new langs have been developed as alternatives to java
20:37:31FromDiscord<Rika> In reply to @Zoom "*Citation needed* (<@259277943275126785>)": Look at the languages Nim is inspired by and compare them to the popular ones
20:40:05*PMunch quit (Quit: leaving)
20:40:56FromDiscord<Zoom> So? What do you consider Nim's ideology to be? "Copying bad design is not good design"?
20:41:20FromDiscord<huantian> Use a bunch of macros!
20:42:48FromDiscord<Zoom> Yeah, just was typing this. Active encouraging of metaprogramming is probably the only controversial stance I know of.
20:43:23FromDiscord<Generic> there's this notion that clever things are bad
20:44:36FromDiscord<Generic> which Nim is pretty much the opposite to
20:44:59FromDiscord<Generic> I've had so many cases where I could massively reduce code duplication with templates
20:45:08*acidsys is now known as crameleon
20:45:14FromDiscord<Zoom> But this is mostly the cultural thing of the community, it, fortunately, only slightly reflects on the language and standard library. You're free to code without macros. The only thing where it's obvious is reliance on templates instead of higher-order functions
20:45:25FromDiscord<Generic> but I guess that would be considered "clever code" by many people
20:46:31FromDiscord<Zoom> Clever things != smart things. If you reduced the loc not reduced the efficiency and the code reads fine, it's just smart.
20:47:12FromDiscord<Zoom> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/962815542304047165): But this is mostly the cultural thing of the community, it, fortunately, only slightly reflects on the language and standard library. You're free to code without macros. The only thing where it's obvious is reliance on templates instead of higher-order functions in the standard library.
20:47:48FromDiscord<huantian> There is also a focus on using metaprogramming instead of building things into the compiler
20:48:44FromDiscord<Generic> well, some people would say that it would be better to just write the code down from top to bottom
20:51:24FromDiscord<Generic> another thing Nim doesn't follow which in some parts of the mainstream languages is relatively common is not making OOP constructs first class
20:51:54FromDiscord<Generic> this isn't that controversial, as many newer languages take a step back from a Java like approach
20:53:00FromDiscord<Zoom> I think DRY is more or less and accepted idea. But what do I know... 🤷↵(@Generic)
20:54:11FromDiscord<Generic> you would think so
20:54:53FromDiscord<Zoom> I think having no clear preference to one of the two mainstream coding styles in opposition (OOP/FP) is as uncontroversial as it gets.↵(@Generic)
20:54:56FromDiscord<Phil> DRY, but also make sure that whatever abstraction you're doing is as intuitive and simple as possible. Or rather that it behaves as intuitively as possible.
20:55:45FromDiscord<Zoom> Yep, that's what I wrote above (clever!=smart).↵(@Phil)
20:56:01*lumo_e quit (Remote host closed the connection)
20:56:14FromDiscord<Generic> Zoom, it's not, in many Uni courses OOP design is presented as the way to make software
20:56:24*lumo_e joined #nim
20:57:46FromDiscord<Generic> while a more procedural approach is declared as not long term maintanable, etc.
20:57:51FromDiscord<Phil> In reply to @Zoom "Yep, that's what I": Yeh, I tend to focus more on the readability than the performance, but that's me coming from webdev.
20:57:52FromDiscord<Zoom> UNI courses always lag, and OOP is surely more common both in currently written and legacy code, so it's the right choice when you think about your students getting a job
20:58:25FromDiscord<Phil> Ironically enough, nim modules can most certainly feel like a java object though without the inheritance.
20:58:53FromDiscord<Phil> (edit) "inheritance." => "inheritance and a smidge less global state.."
20:59:02FromDiscord<Phil> (edit) "global" => "internal"
20:59:32FromDiscord<Generic> I very much like programming in Nim like I did in C
21:02:40FromDiscord<Zoom> The thing is, we were talking about ideology of a language. It's something inherent to the language and how it's constructed, which pushes you to use it in one way or the other. I think there's no real clear one in Nim - the language is very flexible and you can do many things in different ways. May bd that's its ideology. This and macros.
21:03:08FromDiscord<Phil> Hmmm
21:06:43FromDiscord<Phil> I think there are some very opinionated direction nim pushes you towards.↵Being null-free↵Being explicit (this shows in avoiding inheritance and favouring composition, also in how there's multiple ways to declare a function with different keywords for different purposes)
21:07:17FromDiscord<Phil> But I agree with those directions, so that works for me
21:07:23*Figworm joined #nim
21:07:46FromDiscord<Generic> Nim isn't null free, it just has proper value types
21:07:57*Figworm quit (Client Quit)
21:08:06FromDiscord<Phil> I haven't said it is null-free, mostly that it's trying to push you towards avoiding it
21:08:25FromDiscord<Phil> (edit) "it" => "null"
21:08:34FromDiscord<Generic> ah well, I like that too
21:09:08FromDiscord<Phil> The usage of optionals is so integrated it honestly feels very odd and starts ringing "this shouldn't be" alarm bells whenever I encounter nil
21:10:42FromDiscord<Elegantbeef> Yea i only use `ref` when i need reference semantics
21:12:25FromDiscord<Zoom> What Nim doesn't do is promoting error handling. Coming from Rust it's a stark contrast.
21:12:42FromDiscord<Elegantbeef> Yea needing to annotate raises and even allowing naked try excepts
21:12:47FromDiscord<Elegantbeef> Not great
21:14:02FromDiscord<Zoom> On paper ignoring errors exist looks great though - very minimal code \:)
21:14:25FromDiscord<Elegantbeef> To be fair i fall into the category that often disregards exceptions
21:14:54FromDiscord<Generic> me too
21:15:28FromDiscord<Generic> best error handling I do is plastering everything with panics
21:15:29FromDiscord<Generic> 😄
21:16:15Amun-RaElegantbeef: oh, hi, is there a way to get custom pragma annotation of an object in a macro and not proc/fun?
21:16:23*SamuelMarks quit (Ping timeout: 256 seconds)
21:17:09FromDiscord<Elegantbeef> Yes, need to see if micros gives this API dont recall
21:17:32FromDiscord<Elegantbeef> Ah yes it does https://github.com/beef331/micros/blob/master/src/micros/definitions/objectdefs.nim#L230-L236
21:18:02FromDiscord<Elegantbeef> I know there are no docs but take your typed node and do `for pragma in objectDef(myTypedNode).pragmas`
21:18:21Amun-Rahmm, thanks, I'll give it a try
21:18:45FromDiscord<Elegantbeef> You then can do `val` and get a nimnode of the pragma's right hand if it has one, else an empty node
21:19:08FromDiscord<Elegantbeef> Damn i dont have a way to get the name yet, so i guess 'PRs welcomed' 😛
21:19:24FromDiscord<Elegantbeef> I really like the micros api as it makes macros much more approachable imo, ymmv
21:20:47FromDiscord<Phil> Glancing over it, I get the feeling it makes my life easier and looks nicely expressive, which is great! But I'd still want to "get" macros beforehand. Which is a point in time approaching sooner and sooner as my backend nears completion
21:21:03FromDiscord<Phil> ~~well, v1 does, after that there's still refactors~~
21:22:46Amun-RaElegantbeef: hmm, I'm getting nnkEmpty
21:23:04*xet7 joined #nim
21:24:20Amun-Rahttps://play.nim-lang.org/#ix=3UNb
21:28:33Amun-Rait works, thanks Elegantbeef https://play.nim-lang.org/#ix=3UNe
21:38:52FromDiscord<Elegantbeef> No problem
21:39:29FromDiscord<Elegantbeef> I personally think there isnt much to "get" the issue is mostly that you get an untyped API for all macros that makes it difficult↵(@Phil)
21:39:39FromDiscord<Elegantbeef> Most of the things you use macros for can be better represented in a typed API
21:43:15*wyrd quit (Ping timeout: 240 seconds)
21:44:57*xet7 quit (Remote host closed the connection)
21:45:57*xet7 joined #nim
21:48:48FromDiscord<yoyojambo> how do you create a 2d openarray parameter?
21:49:10FromDiscord<Zoom> You can't↵(@yoyojambo)
21:49:11FromDiscord<yoyojambo> I tried `openarray[openarray[bool]]` but it seems it is not a valid type
21:49:17FromDiscord<Elegantbeef> You cannot, you have to have an internal concrete one
21:49:27FromDiscord<Generic> it's probably possible with view types
21:49:46FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/JIH
21:50:08*xet7 quit (Remote host closed the connection)
21:50:16*wyrd joined #nim
21:50:27FromDiscord<Elegantbeef> Even with views it's not possible
21:50:28FromDiscord<yoyojambo> sent a code paste, see https://play.nim-lang.org/#ix=3UNh
21:50:32FromDiscord<Elegantbeef> `openArray` isnt a typeclass
21:50:59FromDiscord<Elegantbeef> Despite all outward appearances it's a distinct type that requires conversion to
21:51:12FromDiscord<Elegantbeef> `openarray[openarray[T]]` doesnt make anysense as it's imposible to instantiate
21:51:13FromDiscord<yoyojambo> what is that `concept a` part?
21:51:17*xet7 joined #nim
21:51:40FromDiscord<Elegantbeef> concepts are a 'experimental feature' which allow you to describe type constraints that are based off implementation instead of name
21:52:11FromDiscord<Elegantbeef> It's basically a check list of what a type needs to fulfil instead of what it needs to be written ass
21:52:14FromDiscord<Elegantbeef> written as\ 😛
21:52:19FromDiscord<yoyojambo> will I have to enable the flag for a experimental feature?
21:52:34FromDiscord<Elegantbeef> No
21:53:06FromDiscord<Generic> https://play.nim-lang.org/#ix=3UNi
21:53:21FromDiscord<Generic> this fails at C stage
21:53:26FromDiscord<Elegantbeef> It shouldnt work afaik
21:53:35FromDiscord<Elegantbeef> I could be wrong
21:53:45FromDiscord<Elegantbeef> I guess i'm wrong
21:54:05FromDiscord<Elegantbeef> openarray requires conversion which is why i figured it wouldnt worrk
21:54:39FromDiscord<Generic> you definitely should be eable to capture a seq or a slice into a (non parameter) local variable with views
21:55:00FromDiscord<Generic> though no idea if putting those again into arrays/seqs should work
21:55:04FromDiscord<Elegantbeef> Yea it makes sense now
21:55:22FromDiscord<Elegantbeef> Well you should use openarray everywhere anyway 😛
21:55:27FromDiscord<Elegantbeef> But in the above case they just need a typeclass
21:56:04FromDiscord<yoyojambo> yeah thanks a lot it worked
22:01:06FromDiscord<yoyojambo> thanks for teaching me that
22:01:08FromDiscord<yoyojambo> sent a code paste, see https://paste.rs/wIv
22:02:40FromDiscord<Generic> if the seqs in the seq are all the same length (like a matrix), it's probably more efficient to use a single seq
22:03:11FromDiscord<yoyojambo> they are not, but thats very true
22:14:01*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
22:22:59*xet7 quit (Remote host closed the connection)
22:27:04FromDiscord<Elegantbeef> @Phil\: you about?
22:28:09FromDiscord<Elegantbeef> For norm's nimibook i got it from 40s down to 10s on my machine
22:29:08Amun-RaElegantbeef: I got something slightly harder - get a pragma of object field ;>
22:30:09FromDiscord<Elegantbeef> I have fields iterator and `name` accessor, though dont presently have a `pragmas` on an ident def
22:30:22FromDiscord<Elegantbeef> Though it should exist so guess i'll add it after i make nimibook faaaaaast
22:31:08FromDiscord<Elegantbeef> If you want to follow the logic i have https://github.com/beef331/micros/blob/master/src/micros/definitions/objectdefs.nim#L216-L228
22:31:31FromDiscord<Elegantbeef> That retrieves all fields including recCased ones
22:31:33Amun-Raah, I was blind: https://play.nim-lang.org/#ix=3UNp
22:46:34*Gustavo6046_ joined #nim
22:46:50*Gustavo6046_ quit (Client Quit)
22:47:00FromDiscord<yoyojambo> can I instantiate let variables with an if in any way? or is it only possible to instantiate them with the `let x: T = y` syntax?
22:47:28FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UNq
22:47:34FromDiscord<Elegantbeef> In Nim statements are expressions if they return values
22:48:32FromDiscord<yoyojambo> can I apply that to a bunch of variables at the same time?
22:48:49FromDiscord<Elegantbeef> What do you mean?
22:48:52*Gustavo6046 quit (Ping timeout: 260 seconds)
22:49:26FromDiscord<yoyojambo> I want to declare like 6 variables with one of two options for each basically
22:49:56FromDiscord<huantian> Oh
22:49:58FromDiscord<huantian> sent a code paste, see https://play.nim-lang.org/#ix=3UNr
22:50:12FromDiscord<Elegantbeef> yes you can do `let x, y, z, w = 100`
22:50:14FromDiscord<Elegantbeef> you can also do \`let (x, y, z, w) = (10, 20, 30, 10)\`\`
22:50:54FromDiscord<yoyojambo> sent a code paste, see https://play.nim-lang.org/#ix=3UNs
22:50:57FromDiscord<yoyojambo> lemme see if I can make it work with that
22:57:35FromDiscord<yoyojambo> it worked! thanks again
23:02:29FromDiscord<mratsim> you can use views of views
23:03:19FromDiscord<Elegantbeef> Mratsim you're a bit late
23:03:23FromDiscord<mratsim> if you create your own view type ptr+len https://github.com/mratsim/constantine/blob/master/research/kzg_poly_commit/strided_views.nim#L23-L29=
23:03:58FromDiscord<mratsim> I'm never late. I arrive when I'm needed
23:04:07FromDiscord<Elegantbeef> Suuuure
23:04:27FromDiscord<yoyojambo> what is a view? and also, what does `lent` mean in the `data: lent UncheckedArray[T]` line?
23:04:49FromDiscord<Elegantbeef> Views are borrowed memory `lent` is a read view into a collection
23:04:57FromDiscord<mratsim> lent is an unowned borrow checked ptr
23:05:10FromDiscord<Elegantbeef> It's like rust's borrow semantics
23:06:55FromDiscord<yoyojambo> In reply to @Elegantbeef "Views are borrowed memory": so does that mean that it can only read the data but not write to it?
23:07:04FromDiscord<Elegantbeef> Yes
23:07:11FromDiscord<yoyojambo> In reply to @Elegantbeef "It's like rust's borrow": Not really familiar with them :(
23:07:28FromDiscord<Elegantbeef> Nim has an experimental borrow checker and borrowing, which often causes Cgen issues
23:08:48FromDiscord<Elegantbeef> The point being to reduce copies and increase performance safely
23:10:51FromDiscord<Elegantbeef> Anyway in your case you are just looking for the typeclass part of `openArray`
23:13:32FromDiscord<huantian> One day Nim borrow checker will be perfect
23:13:40FromDiscord<Elegantbeef> Perhaps
23:13:53FromDiscord<Elegantbeef> When that day comes i'll be a happy boy
23:14:12FromDiscord<Elegantbeef> Especially if closures can also borrow
23:14:37FromDiscord<huantian> Would be juicy
23:15:51FromDiscord<yoyojambo> I think i get it now. data points to the UncheckedArray but it does not have ownership of that unchecked array, so data cannot be modified?
23:16:01FromDiscord<Elegantbeef> Yep
23:16:13FromDiscord<Elegantbeef> `lent` is a pointer that cannot mutate
23:16:25FromDiscord<Elegantbeef> It's also ensured that it doesnt dangle
23:16:29FromDiscord<yoyojambo> how do you lend something?
23:16:43FromDiscord<Elegantbeef> I think you just assign it
23:16:48FromDiscord<yoyojambo> or is it just part of the declaration of the variable?
23:16:53FromDiscord<Elegantbeef> View types are experimental so not going to talk about it
23:17:04FromDiscord<Elegantbeef> think it's `var a: lent int = myInt` for instance
23:17:10FromDiscord<Elegantbeef> or in an object you just set the field
23:17:41FromDiscord<Elegantbeef> Think that's how it was no clue if it's changed 😀
23:17:59FromDiscord<yoyojambo> In reply to @Elegantbeef "think it's `var a:": can you declare it as `var` even if you cannot change it because its lent?
23:18:09FromDiscord<yoyojambo> (edit) "lent?" => "borrowed?"
23:18:47FromDiscord<mratsim> you can modify lent UncheckedArray https://github.com/mratsim/constantine/blob/master/research/kzg_poly_commit/strided_views.nim#L34-L40=
23:19:09FromDiscord<mratsim> ah no I'm casting to ptr
23:20:07FromDiscord<yoyojambo> wait so what cant mutate? the data it points to or the pointer itself?
23:20:39FromDiscord<Elegantbeef> The data that's pointed at
23:20:51FromDiscord<Elegantbeef> `a[] = 300` would error but `a = myOtherInt` shouldnt afaik
23:21:01FromDiscord<Elegantbeef> I could be wrong with how this works think Araq had issues with this logic
23:21:38FromDiscord<huantian> I think if the compiler knows something Is lent it wouldn’t let you modify it, but it’s being casted?
23:23:15FromDiscord<Elegantbeef> Let's be honest no one really knows how it'll work in the end 😛
23:24:46FromDiscord<yoyojambo> In reply to @Elegantbeef "think it's `var a:": in this line, is `a` the same memory address than `myInt`?
23:25:30FromDiscord<yoyojambo> so like you can make `a` point to something else but if you `a[]` now its trying to change the lent `myInt`?
23:25:53FromDiscord<Elegantbeef> Like i said i dont think this stuff is overly concrete yet
23:26:22FromDiscord<Elegantbeef> But yes the `a` would point to `myInt`
23:26:22FromDiscord<Elegantbeef> That's what borrowing is afterall
23:26:38FromDiscord<Elegantbeef> They're just pointers assured to be safe
23:27:27FromDiscord<yoyojambo> thanks for your time
23:27:39FromDiscord<yoyojambo> I get it now
23:44:19*fallback joined #nim
23:45:48fallbackhello nim ppl :)
23:45:59FromDiscord<Elegantbeef> Hello nim person
23:46:45fallbackdoes nim build on openbsd 7.0?
23:47:07FromDiscord<Elegantbeef> Likely it does, but no clue
23:48:34fallbackofficial version is 1.2 but this is too old for nitter
23:48:58FromDiscord<Elegantbeef> Does choosenim work on bsd?
23:48:58FromDiscord<Elegantbeef> Dont recall
23:51:30fallbackidk what that is
23:51:49FromDiscord<Elegantbeef> https://github.com/dom96/choosenim
23:51:52FromDiscord<Elegantbeef> The better way of installing nim
23:58:02fallback/usr/src/Nim/compiler/nim.nim(10, 11) Error: cannot open file: std/os
23:58:11fallbackFAILURE
23:58:37fallbackthis is new git clone