00:03:39 | FromDiscord | <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:56 | FromDiscord | <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:48 | FromDiscord | <TryAngle> does readFile work well with /proc/<pid>/maps↵or should I use a different function? |
01:02:07 | FromDiscord | <Elegantbeef> It should work with them |
01:02:32 | FromDiscord | <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:14 | FromDiscord | <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:21 | FromDiscord | <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:14 | FromDiscord | <Elegantbeef> What do you mean? |
01:23:46 | FromDiscord | <Ace Emerald> Like if I'm in the module `foo.nim` a constant string "foo" representing the name of the module |
01:24:06 | FromDiscord | <Elegantbeef> there is not |
01:24:23 | FromDiscord | <Ace Emerald> ah okay thanks |
01:32:17 | FromDiscord | <Elegantbeef> Why do you need the module name anyway? |
01:38:10 | FromDiscord | <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:29 | FromDiscord | <TryAngle> how do I enable threading in nimble? |
01:42:41 | FromDiscord | <Elegantbeef> you dont |
01:42:52 | FromDiscord | <TryAngle> :c |
01:43:11 | FromDiscord | <Elegantbeef> you make a config file with `--threads:on` |
01:44:19 | FromDiscord | <TryAngle> may u show how 🥺 |
01:44:34 | FromDiscord | <TryAngle> config.nims in src? |
01:44:35 | FromDiscord | <Elegantbeef> make a `config.nims` with `--threads:on` |
01:44:37 | FromDiscord | <TryAngle> and just add this line? |
01:44:45 | FromDiscord | <TryAngle> thanks! |
01:45:02 | FromDiscord | <Elegantbeef> Root or next the nim file |
01:55:25 | FromDiscord | <TryAngle> In reply to @Elegantbeef "Root or next the": works thanks |
01:56:03 | FromDiscord | <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:11 | FromDiscord | <ITR> Does anybody know what I have to do? |
01:56:59 | FromDiscord | <TryAngle> sent a code paste, see https://paste.rs/ulf |
01:57:07 | * | arkurious quit (Quit: Leaving) |
01:57:12 | FromDiscord | <TryAngle> (edit) "https://play.nim-lang.org/#ix=3UJl" => "https://play.nim-lang.org/#ix=3UJm" |
01:57:17 | FromDiscord | <Elegantbeef> `@args` |
01:57:37 | FromDiscord | <Elegantbeef> Why is this a template? |
01:57:49 | FromDiscord | <TryAngle> In reply to @Elegantbeef "Why is this a": nim has log as a template |
01:57:50 | FromDiscord | <TryAngle> idk |
01:57:57 | FromDiscord | <TryAngle> so I thought I just do the same |
01:58:43 | FromDiscord | <Elegantbeef> Well anyway yea `@` should be all you need |
01:58:51 | FromDiscord | <Elegantbeef> You're alos doing `let` |
01:58:56 | FromDiscord | <Elegantbeef> Immutable args and all |
01:59:05 | FromDiscord | <Elegantbeef> What's the issue↵(@ITR) |
02:00:15 | FromDiscord | <TryAngle> In reply to @Elegantbeef "You're alos doing `let`": also insert(0, "") seems to be wrong 🤔 |
02:00:27 | FromDiscord | <Elegantbeef> swap the args |
02:01:08 | FromDiscord | <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:38 | FromDiscord | <Elegantbeef> https://github.com/saem/vscode-nim#debugging may help |
02:03:27 | * | SamuelMarks joined #nim |
02:06:27 | FromDiscord | <TryAngle> In reply to @Elegantbeef "swap the args": lol |
02:06:38 | FromDiscord | <TryAngle> I was thinking 5 min now what u mean |
02:06:41 | FromDiscord | <TryAngle> now I get it finally |
02:06:43 | FromDiscord | <TryAngle> XDDDDDDDDDDDD |
02:08:40 | FromDiscord | <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:04 | FromDiscord | <ITR> eyy, that worked, ty <2 |
02:15:07 | FromDiscord | <TryAngle> do threads get closed when I close the program or do I have to lcose them myself? |
02:15:22 | FromDiscord | <Elegantbeef> The OS will handle them but you're supposed to close them |
02:19:12 | * | adigitoleo left #nim (#nim) |
02:27:50 | FromDiscord | <TryAngle> does channels. tryRecv return 0 like peek if nothing is there? the docs seem a little odd written |
02:28:00 | FromDiscord | <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:12 | FromDiscord | <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:14 | FromDiscord | <Elegantbeef> Try recv is a non blocking check |
02:28:29 | FromDiscord | <TryAngle> ok ty |
02:28:42 | * | lumo_e quit (Ping timeout: 268 seconds) |
02:29:28 | FromDiscord | <TryAngle> is there also some way to give a "timout limit" to channel recv? |
02:30:05 | FromDiscord | <Elegantbeef> Nope |
02:30:16 | FromDiscord | <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:17 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3UJv |
03:11:17 | FromDiscord | <TryAngle> what can I do with this error? |
03:11:44 | FromDiscord | <Elegantbeef> Read the error and realize "hey my thread isnt mutable" |
03:12:04 | FromDiscord | <TryAngle> In reply to @Elegantbeef "Read the error and": but it is |
03:12:07 | FromDiscord | <Elegantbeef> If that's nto the case, realize "Hey my proc isnt annotated `{.thread,}`" |
03:12:16 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3UJw |
03:12:41 | FromDiscord | <Elegantbeef> It's not threadsafe then |
03:13:08 | FromDiscord | <Elegantbeef> You can annotate it with `{.thread.}` orto see why it's not or `{.gcsafe.}` if you know more than the compiler |
03:13:47 | FromDiscord | <TryAngle> ah when I remove the registerLoggers it works 🤔 |
03:14:06 | FromDiscord | <Elegantbeef> to see why it's not\ |
03:14:31 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3UJx |
03:15:14 | FromDiscord | <Elegantbeef> Not access global variables |
03:15:45 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UJy |
03:16:03 | FromDiscord | <TryAngle> so its' a different logger for each thread then 🤔 |
03:16:12 | FromDiscord | <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:23 | FromDiscord | <Elegantbeef> If you're using `std/logging` yes that's the case |
03:16:37 | FromDiscord | <TryAngle> In reply to @Elegantbeef "> The list of": ye that's why I did registerLogger in each thread |
03:17:08 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/logging.html#basic-usage-notes-when-using-multiple-threads |
03:17:24 | FromDiscord | <TryAngle> ok but don't I have 2 loggers writing the same file / output then ? |
03:17:28 | FromDiscord | <Elegantbeef> Well accessing global heap variables is not thread safe |
03:17:36 | FromDiscord | <TryAngle> is fmAppend safe here? |
03:18:37 | FromDiscord | <Elegantbeef> No clue |
03:18:57 | FromDiscord | <TryAngle> ok guess I will test it lol |
03:19:02 | FromDiscord | <Elegantbeef> You probably need a lock to make it safe |
03:19:05 | FromDiscord | <Elegantbeef> Or just write to different files |
03:28:11 | FromDiscord | <TryAngle> hmmm I'm getting a weird SIGSEGV error 🤔 |
03:28:25 | FromDiscord | <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:34 | FromDiscord | <Elegantbeef> Is it a ref? |
03:34:27 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3UJC |
03:35:05 | FromDiscord | <TryAngle> both are in different files |
03:35:28 | FromDiscord | <TryAngle> the send in main() crashes |
03:35:37 | FromDiscord | <TryAngle> trySend crashes also |
03:35:39 | FromDiscord | <TryAngle> with same error |
03:35:51 | FromDiscord | <Elegantbeef> you dont init the channel |
03:36:12 | FromDiscord | <TryAngle> OHHHHH |
03:36:46 | FromDiscord | <TryAngle> thanks |
03:36:50 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3UJD |
03:37:59 | FromDiscord | <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:04 | FromDiscord | <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:15 | FromDiscord | <!Patitotective> how can i get the current datetime in a specific `TimeZone`? |
04:53:59 | * | rockcavera quit (Remote host closed the connection) |
04:56:21 | FromDiscord | <!Patitotective> `n` |
04:56:24 | FromDiscord | <Elegantbeef> `zonedTimeFromTime(myTZ, now().toTime)`? |
04:56:47 | FromDiscord | <!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:15 | FromDiscord | <d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3UKw |
09:00:10 | FromDiscord | <Elegantbeef> `staticExec` |
09:03:37 | FromDiscord | <d4rckh> thanks! is there any way to run code based on which platform im compiling on? |
09:04:16 | FromDiscord | <Elegantbeef> `when defined(linux)` |
09:04:55 | FromDiscord | <d4rckh> 👍 |
09:11:29 | Amun-Ra | you 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:27 | PMunch | Hmm, I'm trying to run MPFIT from Vindaar on some data |
09:56:22 | PMunch | For 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:08 | PMunch | Threw 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:19 | PMunch | `Error: low(kind) must be 0 for discriminant` is this to "fix" the default value for enum is 0 problem? |
12:02:41 | PMunch | Hmm, 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:18 | FromDiscord | <System64 ~ Flandre Scarlet> I have an header and a library written in C++, can I use them in Nim? |
13:13:50 | PMunch | Yes |
13:15:58 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PMunch "Yes": ah alright, even if I don't use the C++ compiler? |
13:16:27 | PMunch | Well, 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:47 | FromDiscord | <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:05 | PMunch | That should be fine |
13:18:24 | FromDiscord | <System64 ~ Flandre Scarlet> ah alright |
13:18:33 | PMunch | I believe, you might have some trouble getting all the types right though |
13:18:40 | PMunch | Depends on the interface it exposes over the DLL |
13:18:41 | FromDiscord | <System64 ~ Flandre Scarlet> but there is no Extern C |
13:18:56 | FromDiscord | <System64 ~ Flandre Scarlet> https://media.discordapp.net/attachments/371759389889003532/962703227340591154/vgmplayer.hpp |
13:19:21 | PMunch | Try to share links instead of images |
13:19:28 | PMunch | I assume it's this file: https://github.com/ljmccarthy/fmplay/blob/master/include/vgmplayer.hpp |
13:19:32 | FromDiscord | <System64 ~ Flandre Scarlet> it's not an image |
13:19:42 | PMunch | Oh sorry, instead of files.. |
13:19:59 | PMunch | Discord creates silly links that don't work for us non-discord users when you do that |
13:20:25 | PMunch | Ah, yeah that'll be a pain to wrap with pure C I believe |
13:29:10 | FromDiscord | <System64 ~ Flandre Scarlet> Yeah, I think it will be pain |
13:35:54 | NimEventer | New post on r/nim by veloxVolpes: Chrome blocks download?, see https://reddit.com/r/nim/comments/u0hp0k/chrome_blocks_download/ |
13:44:35 | FromDiscord | <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:40 | PMunch | Well it's technically possible |
13:47:05 | PMunch | If the DLL was only using C stuff it would even be pretty straight forward I believe |
13:47:20 | PMunch | But as soon as it exposes C++ data over the DLL interface then it starts getting tricky |
13:47:21 | * | arkurious joined #nim |
13:48:12 | PMunch | It'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:28 | FromDiscord | <Valdar> Well, technically true, yeah, but I don't see many modern C++ libs that stick close to straight C |
14:11:51 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3ULz |
14:12:03 | FromDiscord | <!Patitotective> (edit) "https://play.nim-lang.org/#ix=3ULz" => "https://paste.rs/LgU" |
14:14:41 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3ULB |
14:15:46 | FromDiscord | <enthus1ast> `del` is faster i guess but it changes the order of elements |
14:24:30 | FromDiscord | <Phil> ... I have the faint feeling that orc may be garbage collecting my global variable table that stores pointers to various procs |
14:24:32 | FromDiscord | <Phil> squint |
14:24:59 | FromDiscord | <Solitude> no hecking way |
14:25:52 | FromDiscord | <Rika> In reply to @Isofruit "... I have the": <:thinking_slightly_more_intently:312535068990242816> |
14:26:33 | FromDiscord | <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:09 | FromDiscord | <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:19 | FromDiscord | <Phil> Not while using orc at least |
14:28:52 | FromDiscord | <!Patitotective> sent a code paste, see https://paste.rs/CKa |
14:30:42 | FromDiscord | <enthus1ast> a delete that removes from the original list and returns a copy of the list with the item deleted? |
14:30:52 | FromDiscord | <enthus1ast> sounds strange \:) |
14:31:19 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3ULE |
14:35:06 | FromDiscord | <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:12 | FromDiscord | <!Patitotective> sent a code paste, see https://paste.rs/MbV |
14:38:17 | FromDiscord | <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:15 | FromDiscord | <Rika> in this case you can use sugar.dup now no? |
14:39:35 | FromDiscord | <enthus1ast> yes i also though so↵(@Rika) |
14:40:49 | FromDiscord | <eversinc33> sent a code paste, see https://play.nim-lang.org/#ix=3ULJ |
14:40:56 | FromDiscord | <Rika> `typedesc` |
14:41:08 | FromDiscord | <eversinc33> oh, thanks! didnt know the kwyword |
14:41:17 | FromDiscord | <Solitude> man... |
14:41:17 | FromDiscord | <eversinc33> (edit) "kwyword" => "keyword :)" |
14:41:32 | FromDiscord | <Rika> solitude literally said typedesc lol |
14:42:17 | FromDiscord | <eversinc33> yea just wanted to clarify thats why i replied. sorry |
14:43:55 | * | xet7 quit (Read error: Connection reset by peer) |
15:13:09 | FromDiscord | <Phil> Head --> Desk↵Sometimes overloading can be painful |
15:14:41 | FromDiscord | <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:07 | FromDiscord | <Phil> (edit) "proc," => "delete," |
15:20:31 | FromDiscord | <gerwy> Just from curiosity |
15:20:58 | FromDiscord | <gerwy> Did anyone ever tried to make nim compile to c↵And instead od gcc or clang, use zig as c compiler? |
15:21:06 | FromDiscord | <gerwy> Does it work out well? |
15:23:25 | FromDiscord | <hmmm> hmm you mean compile to zig which compiles to c ? 🤔 |
15:28:07 | PMunch | @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:18 | FromDiscord | <Zoom> No, Zig compiler can compile C code itself, so gerwy meant what he wrote.↵(@hmmm) |
15:44:26 | FromDiscord | <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:04 | FromDiscord | <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:55 | FromDiscord | <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:09 | FromDiscord | <Yardanico> and then for nim do `--cc:clang --clang.exe:zigcc.sh` etc |
15:54:25 | FromDiscord | <Yardanico> ofc linkerexe too |
15:54:34 | FromDiscord | <Yardanico> see for example https://github.com/Yardanico/ircord/blob/master/zig-compile-vps.sh |
15:55:03 | FromDiscord | <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:12 | Amun-Ra | is there way of getting custom pragma of an object type in a macro? |
16:02:38 | FromDiscord | <Yardanico> https://nim-lang.org/docs/macros.html#hasCustomPragma.m%2Ctyped%2C |
16:02:44 | FromDiscord | <Yardanico> https://nim-lang.org/docs/macros.html#getCustomPragmaVal.m%2Ctyped%2C |
16:07:39 | Amun-Ra | that doesn't seem to work, hmm, let me make a test case |
16:12:26 | Amun-Ra | Yardanico: https://play.nim-lang.org/#ix=t%20wr (that's probably a pebkac, I'm still fairly new to macros) |
16:12:45 | Amun-Ra | wrong link |
16:12:46 | FromDiscord | <Yardanico> please post again, it didn't go through correctly :) |
16:13:14 | Amun-Ra | sometimes play.nim-lang.org replaces the code with a random one |
16:13:23 | Amun-Ra | I have to type it again |
16:13:54 | Amun-Ra | Yardanico: https://play.nim-lang.org/#ix=3UMl |
16:15:57 | FromDiscord | <Yardanico> hm |
16:16:06 | FromDiscord | <Yardanico> maybe it's because hasCustomPragma is supposed to work in normal procedures? not sure |
16:16:19 | Amun-Ra | I guess so |
16:16:57 | Amun-Ra | I writing my custom macro to read all big endian/little endian fields from a stream an reaturn a ready object |
16:31:22 | FromDiscord | <gerwy> In reply to @PMunch "<@347345994217816066>, yes someone have": Nicee |
16:33:05 | FromDiscord | <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:53 | FromDiscord | <Yardanico> zig cc compiler is only useful for cross compiling, since it's just clang at the end of the day |
16:38:24 | FromDiscord | <gerwy> Yeah it has very good cross compiling |
17:16:01 | FromDiscord | <ITR> Bit confused, why does it complained about {.memoized.} having side effects when I call binomial, but not when I call nCr? |
17:16:03 | FromDiscord | <ITR> https://media.discordapp.net/attachments/371759389889003532/962762901289058375/unknown.png |
17:16:25 | FromDiscord | <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:03 | FromDiscord | <Rika> is this in relation to the primer game |
17:45:45 | FromDiscord | <Zoom> Maybe cecause binomial affects the cache living outside (the one of `nCr`) |
17:46:41 | FromDiscord | <Rika> memoized probably works for ncr because it rewrites recursive calls, perhaps |
17:47:30 | FromDiscord | <Zoom> Does `{.memoized.}` just declare a global-pragma'd var inside a proc body? |
17:47:50 | FromDiscord | <Rika> probably not `{.global.}` but an actual global |
17:48:25 | FromDiscord | <Zoom> Then both should be caught by the effect tracking. Hm... |
17:51:41 | NimEventer | New thread by Llamas2: Shared memory with ARC, see https://forum.nim-lang.org/t/9099 |
17:53:24 | FromDiscord | <Zoom> Just checked, locally declared {.global.} vars are also get caught by the tracking. It's probably right, but disputable |
17:54:25 | FromDiscord | <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:41 | FromDiscord | <Rika> i just thought of smth cursed as fuck |
17:56:04 | FromDiscord | <Zoom> Yeah, it's definitely right to curse at {.global.} local vars... |
17:56:06 | FromDiscord | <Rika> actually no nvm it wouldnt work |
17:56:21 | FromDiscord | <Rika> no it was something worse but i thought again and it wouldnt work |
17:58:01 | FromDiscord | <Yardanico> sanest nim developer |
17:58:57 | FromDiscord | <Rika> tfw reacts to own message |
17:59:45 | FromDiscord | <Yardanico> sanest nim moderator |
18:00:18 | FromDiscord | <Rika> least abusive nim moderator |
18:01:53 | FromDiscord | <Yardanico> that'd be pmunc (censored to not ping), not me |
18:02:42 | FromDiscord | <huantian> What does the Mega role even mean |
18:02:54 | FromDiscord | <Rika> it means you're Mega |
18:03:13 | FromDiscord | <Yardanico> In reply to @huantian "What does the Mega": legacy of this discord server |
18:03:19 | FromDiscord | <huantian> I see |
18:03:34 | FromDiscord | <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:44 | FromDiscord | <Yardanico> https://forum.nim-lang.org/t/3272 |
18:03:48 | FromDiscord | <Yardanico> (edit) "then" => "when" |
18:04:04 | FromDiscord | <Yardanico> also not "channel" but "server" |
18:04:10 | FromDiscord | <Yardanico> (that's my old forum account) |
18:04:28 | FromDiscord | <huantian> Wow 2017 huh |
18:05:06 | FromDiscord | <huantian> At some point I gotta join the telegram channel and see what that’s like |
18:05:36 | FromDiscord | <Yardanico> In reply to @huantian "At some point I": 1.5 people talking about nim and the rest are memes |
18:06:03 | FromDiscord | <Yardanico> https://t.me/nim_lang feel free to check |
18:07:15 | FromDiscord | <huantian> I should commission some Nim related sticker w |
18:07:19 | FromDiscord | <huantian> (edit) "sticker w" => "stickers" |
18:07:20 | FromDiscord | <Yardanico> those already exist :P |
18:07:23 | FromDiscord | <huantian> Ah |
18:07:32 | FromDiscord | <Yardanico> although some of them are not that good in my opinion :) |
18:07:53 | FromDiscord | <Yardanico> a proper nim sticker pack would be welcome, yes |
18:08:35 | FromDiscord | <Solitude> In reply to @Yardanico "although some of them": shut up |
18:08:42 | FromDiscord | <Yardanico> In reply to @Solitude "shut up": im not talking about your sticker pack |
18:08:48 | FromDiscord | <Yardanico> im talking about juan's |
18:10:43 | FromDiscord | <huantian> Then I should make a fursona and commission stickers of my sona coding Nim |
18:11:02 | FromDiscord | <Rika> why |
18:11:20 | FromDiscord | <Rika> i mean ok sure if you want |
18:11:43 | FromDiscord | <Zoom> Guys, this is not #offtopic |
18:12:52 | FromDiscord | <Solitude> this guy doesnt know |
18:16:54 | FromDiscord | <vSkyleX> Does Nim have an LTS version? |
18:17:18 | FromDiscord | <Yardanico> In reply to @vSkyleX "Does Nim have an": technically 1.2 is an LTS |
18:17:28 | FromDiscord | <Yardanico> status are still using it for their projects so it gets some critical bugfixes |
18:17:41 | FromDiscord | <vSkyleX> alright, thanks |
18:18:09 | FromDiscord | <Yardanico> but anyway they're not really updated regularly |
18:18:25 | FromDiscord | <vSkyleX> so its better to use the 1.6.4? |
18:18:34 | FromDiscord | <Yardanico> generally of course, a lot of new bugfixes and features |
18:18:52 | FromDiscord | <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:07 | FromDiscord | <vSkyleX> thanks!! |
18:26:22 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3UMJ |
18:30:13 | FromDiscord | <Yardanico> nope, to force it you can use special comments |
18:30:22 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-emit-pragma |
18:30:36 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/962781658019405864/unknown.png |
18:31:12 | FromDiscord | <Rika> damn nim docs still has no-fullstop close pragma? |
18:31:16 | FromDiscord | <Yardanico> ? |
18:31:27 | FromDiscord | <Rika> {.pragma} |
18:31:48 | FromDiscord | <Yardanico> apparently not |
18:31:58 | FromDiscord | <Yardanico> tbh I think that this syntax shouldn't be popularized anyway :) |
18:32:06 | FromDiscord | <Yardanico> it makes less sense than {.pragma.} |
18:32:10 | FromDiscord | <Rika> thats my point, i think it shouldnt |
18:32:18 | FromDiscord | <Rika> also it does, your picture has it right there |
18:32:36 | FromDiscord | <Yardanico> old code example :P |
18:33:39 | FromDiscord | <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:20 | FromDiscord | <enthus1ast> pack them in a zip file |
18:34:40 | FromDiscord | <d4rckh> there isn't any other way? oof |
18:35:03 | FromDiscord | <enthus1ast> use an installer creator like nsis or inno setup |
18:35:53 | FromDiscord | <d4rckh> I don't think I can add nsis or inno in my github actions so ig ill go with zipping them |
18:35:58 | FromDiscord | <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:59 | FromDiscord | <d4rckh> (edit) "in" => "to" |
18:36:11 | FromDiscord | <jmgomez> (edit) "take" => "takes" |
18:38:37 | FromDiscord | <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:57 | FromDiscord | <jmgomez> but this is not something specific to nim, that happens in c/cpp too |
18:40:58 | FromDiscord | <d4rckh> oof |
18:41:25 | FromDiscord | <enthus1ast> i mean, the stuff he mentioned is c↵(@jmgomez) |
18:41:46 | FromDiscord | <jmgomez> In reply to @Yardanico "": but are you sure that also works for includes? doesnt seem to be the case |
18:43:17 | FromDiscord | <jmgomez> may be the header pragma evaluated before the code within the mofule/file? |
18:44:41 | FromDiscord | <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:54 | FromDiscord | <jmgomez> (edit) "headers," => "header pragma" |
18:45:08 | FromDiscord | <jmgomez> (edit) "headers" => "header pragma" |
18:48:00 | * | jmdaemon joined #nim |
18:55:05 | * | elph joined #nim |
18:56:28 | FromDiscord | <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:03 | FromDiscord | <Zoom> If you use arc/orc for memory menagement, go with https://github.com/nim-lang/threading/↵(@Daan Breur) |
19:00:33 | FromDiscord | <Zoom> Channels are generic, so send what you like |
19:02:17 | FromDiscord | <Daan Breur> Thanks |
19:02:21 | FromDiscord | <Daan Breur> Didnt know that |
19:20:36 | FromDiscord | <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:12 | FromDiscord | <luteva> sent a long message, see http://ix.io/3UMT |
20:01:26 | FromDiscord | <luteva> (edit) "http://ix.io/3UMT" => "http://ix.io/3UMW" |
20:09:40 | FromDiscord | <vSkyleX> Can anyone tell me if current Nim version has some cons. I need it for my written report |
20:09:57 | FromDiscord | <Rika> Cons in what sense |
20:10:02 | FromDiscord | <Rika> For what application |
20:10:06 | FromDiscord | <vSkyleX> cons of using nim generally speaking |
20:10:13 | FromDiscord | <Rika> It’s kinda like asking if there are cons to apples |
20:10:20 | FromDiscord | <Rika> Like okay, what about it |
20:10:46 | FromDiscord | <Rika> I still don’t know what your intent is with “generally speaking@ |
20:11:21 | FromDiscord | <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:32 | FromDiscord | <Rika> Okay |
20:11:38 | FromDiscord | <Rika> Okay I get it |
20:11:39 | FromDiscord | <vSkyleX> im looking for something like this |
20:11:42 | FromDiscord | <Rika> Nim has a small ecosystem |
20:11:43 | FromDiscord | <vSkyleX> nothing too specific |
20:11:55 | FromDiscord | <Rika> The developer team is kinda small, so progress is relatively slow |
20:12:09 | FromDiscord | <Rika> Progress as in bug fixes and features |
20:12:23 | FromDiscord | <Rika> Then support from larger companies is limited |
20:12:55 | FromDiscord | <Rika> The ideology is relatively different to the standard languages |
20:13:03 | FromDiscord | <Rika> So it might take time to get used to |
20:13:19 | FromDiscord | <Rika> There are some surface level controversial features |
20:13:48 | FromDiscord | <Rika> In reply to @Rika "The developer team is": Because of this, they’re overloaded with work pretty much |
20:14:01 | FromDiscord | <Rika> We really need more supporters ngl |
20:14:17 | FromDiscord | <vSkyleX> Noted. I appreciate your help! |
20:15:23 | FromDiscord | <Rika> I’m not sure of any more |
20:15:34 | FromDiscord | <Rika> Not coming to the surface of my mind’s ocean |
20:16:55 | FromDiscord | <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:51 | FromDiscord | <vSkyleX> In reply to @ynfle "A con is the": I done some Nim coding and I didn't really notice the difference |
20:18:42 | FromDiscord | <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:42 | FromDiscord | <Rika> In reply to @vSkyleX "I done some Nim": You’re lucky or smart |
20:18:50 | FromDiscord | <Rika> In reply to @vSkyleX "I don't understand why": Because it’s controversial |
20:18:58 | FromDiscord | <Rika> Oh what? Style insensitivity? Eww |
20:19:02 | FromDiscord | <Rika> Oh what? Macros? The fuck? |
20:19:06 | FromDiscord | <vSkyleX> lolll |
20:19:12 | FromDiscord | <Rika> Oh what? Indentation? Seriously? |
20:19:24 | FromDiscord | <Rika> You know how much time it took for Python indentation to be considered fine?? |
20:19:30 | FromDiscord | <Rika> And it still isn’t |
20:19:35 | FromDiscord | <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:55 | FromDiscord | <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:59 | FromDiscord | <Rika> But I don’t know |
20:20:09 | FromDiscord | <Rika> In reply to @vSkyleX "more like spent a": So you didn’t get culture shock then |
20:20:16 | FromDiscord | <vSkyleX> nop lmao |
20:20:23 | FromDiscord | <Rika> Since we take lots of inspiration from those |
20:20:27 | FromDiscord | <Rika> Yeah that’s nice |
20:20:32 | FromDiscord | <Rika> I didn’t really either, I don’t know why |
20:20:50 | FromDiscord | <vSkyleX> if you were writing code in java or c your entire life |
20:21:11 | FromDiscord | <vSkyleX> u would say the stuff u said above |
20:21:16 | FromDiscord | <vSkyleX> its tough macros etc |
20:21:35 | FromDiscord | <vSkyleX> just bc I think ppl think that Java C C++ are the top languages |
20:21:59 | FromDiscord | <vSkyleX> but anyways |
20:22:01 | FromDiscord | <vSkyleX> thanks guys |
20:22:26 | FromDiscord | <Rika> Yeah |
20:26:30 | FromDiscord | <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:15 | FromDiscord | <Rika> Well in the end companies care about maturity and stability |
20:28:09 | FromDiscord | <ynfle> And Oracle has tons of money |
20:28:56 | FromDiscord | <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:37 | FromDiscord | <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:55 | FromDiscord | <Zoom> Citation needed↵(@Rika) |
20:37:07 | FromDiscord | <huantian> I mean new langs have been developed as alternatives to java |
20:37:31 | FromDiscord | <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:56 | FromDiscord | <Zoom> So? What do you consider Nim's ideology to be? "Copying bad design is not good design"? |
20:41:20 | FromDiscord | <huantian> Use a bunch of macros! |
20:42:48 | FromDiscord | <Zoom> Yeah, just was typing this. Active encouraging of metaprogramming is probably the only controversial stance I know of. |
20:43:23 | FromDiscord | <Generic> there's this notion that clever things are bad |
20:44:36 | FromDiscord | <Generic> which Nim is pretty much the opposite to |
20:44:59 | FromDiscord | <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:14 | FromDiscord | <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:25 | FromDiscord | <Generic> but I guess that would be considered "clever code" by many people |
20:46:31 | FromDiscord | <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:12 | FromDiscord | <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:48 | FromDiscord | <huantian> There is also a focus on using metaprogramming instead of building things into the compiler |
20:48:44 | FromDiscord | <Generic> well, some people would say that it would be better to just write the code down from top to bottom |
20:51:24 | FromDiscord | <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:54 | FromDiscord | <Generic> this isn't that controversial, as many newer languages take a step back from a Java like approach |
20:53:00 | FromDiscord | <Zoom> I think DRY is more or less and accepted idea. But what do I know... 🤷↵(@Generic) |
20:54:11 | FromDiscord | <Generic> you would think so |
20:54:53 | FromDiscord | <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:56 | FromDiscord | <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:45 | FromDiscord | <Zoom> Yep, that's what I wrote above (clever!=smart).↵(@Phil) |
20:56:01 | * | lumo_e quit (Remote host closed the connection) |
20:56:14 | FromDiscord | <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:46 | FromDiscord | <Generic> while a more procedural approach is declared as not long term maintanable, etc. |
20:57:51 | FromDiscord | <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:52 | FromDiscord | <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:25 | FromDiscord | <Phil> Ironically enough, nim modules can most certainly feel like a java object though without the inheritance. |
20:58:53 | FromDiscord | <Phil> (edit) "inheritance." => "inheritance and a smidge less global state.." |
20:59:02 | FromDiscord | <Phil> (edit) "global" => "internal" |
20:59:32 | FromDiscord | <Generic> I very much like programming in Nim like I did in C |
21:02:40 | FromDiscord | <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:08 | FromDiscord | <Phil> Hmmm |
21:06:43 | FromDiscord | <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:17 | FromDiscord | <Phil> But I agree with those directions, so that works for me |
21:07:23 | * | Figworm joined #nim |
21:07:46 | FromDiscord | <Generic> Nim isn't null free, it just has proper value types |
21:07:57 | * | Figworm quit (Client Quit) |
21:08:06 | FromDiscord | <Phil> I haven't said it is null-free, mostly that it's trying to push you towards avoiding it |
21:08:25 | FromDiscord | <Phil> (edit) "it" => "null" |
21:08:34 | FromDiscord | <Generic> ah well, I like that too |
21:09:08 | FromDiscord | <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:42 | FromDiscord | <Elegantbeef> Yea i only use `ref` when i need reference semantics |
21:12:25 | FromDiscord | <Zoom> What Nim doesn't do is promoting error handling. Coming from Rust it's a stark contrast. |
21:12:42 | FromDiscord | <Elegantbeef> Yea needing to annotate raises and even allowing naked try excepts |
21:12:47 | FromDiscord | <Elegantbeef> Not great |
21:14:02 | FromDiscord | <Zoom> On paper ignoring errors exist looks great though - very minimal code \:) |
21:14:25 | FromDiscord | <Elegantbeef> To be fair i fall into the category that often disregards exceptions |
21:14:54 | FromDiscord | <Generic> me too |
21:15:28 | FromDiscord | <Generic> best error handling I do is plastering everything with panics |
21:15:29 | FromDiscord | <Generic> 😄 |
21:16:15 | Amun-Ra | Elegantbeef: 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:09 | FromDiscord | <Elegantbeef> Yes, need to see if micros gives this API dont recall |
21:17:32 | FromDiscord | <Elegantbeef> Ah yes it does https://github.com/beef331/micros/blob/master/src/micros/definitions/objectdefs.nim#L230-L236 |
21:18:02 | FromDiscord | <Elegantbeef> I know there are no docs but take your typed node and do `for pragma in objectDef(myTypedNode).pragmas` |
21:18:21 | Amun-Ra | hmm, thanks, I'll give it a try |
21:18:45 | FromDiscord | <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:08 | FromDiscord | <Elegantbeef> Damn i dont have a way to get the name yet, so i guess 'PRs welcomed' 😛 |
21:19:24 | FromDiscord | <Elegantbeef> I really like the micros api as it makes macros much more approachable imo, ymmv |
21:20:47 | FromDiscord | <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:03 | FromDiscord | <Phil> ~~well, v1 does, after that there's still refactors~~ |
21:22:46 | Amun-Ra | Elegantbeef: hmm, I'm getting nnkEmpty |
21:23:04 | * | xet7 joined #nim |
21:24:20 | Amun-Ra | https://play.nim-lang.org/#ix=3UNb |
21:28:33 | Amun-Ra | it works, thanks Elegantbeef https://play.nim-lang.org/#ix=3UNe |
21:38:52 | FromDiscord | <Elegantbeef> No problem |
21:39:29 | FromDiscord | <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:39 | FromDiscord | <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:48 | FromDiscord | <yoyojambo> how do you create a 2d openarray parameter? |
21:49:10 | FromDiscord | <Zoom> You can't↵(@yoyojambo) |
21:49:11 | FromDiscord | <yoyojambo> I tried `openarray[openarray[bool]]` but it seems it is not a valid type |
21:49:17 | FromDiscord | <Elegantbeef> You cannot, you have to have an internal concrete one |
21:49:27 | FromDiscord | <Generic> it's probably possible with view types |
21:49:46 | FromDiscord | <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:27 | FromDiscord | <Elegantbeef> Even with views it's not possible |
21:50:28 | FromDiscord | <yoyojambo> sent a code paste, see https://play.nim-lang.org/#ix=3UNh |
21:50:32 | FromDiscord | <Elegantbeef> `openArray` isnt a typeclass |
21:50:59 | FromDiscord | <Elegantbeef> Despite all outward appearances it's a distinct type that requires conversion to |
21:51:12 | FromDiscord | <Elegantbeef> `openarray[openarray[T]]` doesnt make anysense as it's imposible to instantiate |
21:51:13 | FromDiscord | <yoyojambo> what is that `concept a` part? |
21:51:17 | * | xet7 joined #nim |
21:51:40 | FromDiscord | <Elegantbeef> concepts are a 'experimental feature' which allow you to describe type constraints that are based off implementation instead of name |
21:52:11 | FromDiscord | <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:14 | FromDiscord | <Elegantbeef> written as\ 😛 |
21:52:19 | FromDiscord | <yoyojambo> will I have to enable the flag for a experimental feature? |
21:52:34 | FromDiscord | <Elegantbeef> No |
21:53:06 | FromDiscord | <Generic> https://play.nim-lang.org/#ix=3UNi |
21:53:21 | FromDiscord | <Generic> this fails at C stage |
21:53:26 | FromDiscord | <Elegantbeef> It shouldnt work afaik |
21:53:35 | FromDiscord | <Elegantbeef> I could be wrong |
21:53:45 | FromDiscord | <Elegantbeef> I guess i'm wrong |
21:54:05 | FromDiscord | <Elegantbeef> openarray requires conversion which is why i figured it wouldnt worrk |
21:54:39 | FromDiscord | <Generic> you definitely should be eable to capture a seq or a slice into a (non parameter) local variable with views |
21:55:00 | FromDiscord | <Generic> though no idea if putting those again into arrays/seqs should work |
21:55:04 | FromDiscord | <Elegantbeef> Yea it makes sense now |
21:55:22 | FromDiscord | <Elegantbeef> Well you should use openarray everywhere anyway 😛 |
21:55:27 | FromDiscord | <Elegantbeef> But in the above case they just need a typeclass |
21:56:04 | FromDiscord | <yoyojambo> yeah thanks a lot it worked |
22:01:06 | FromDiscord | <yoyojambo> thanks for teaching me that |
22:01:08 | FromDiscord | <yoyojambo> sent a code paste, see https://paste.rs/wIv |
22:02:40 | FromDiscord | <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:11 | FromDiscord | <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:04 | FromDiscord | <Elegantbeef> @Phil\: you about? |
22:28:09 | FromDiscord | <Elegantbeef> For norm's nimibook i got it from 40s down to 10s on my machine |
22:29:08 | Amun-Ra | Elegantbeef: I got something slightly harder - get a pragma of object field ;> |
22:30:09 | FromDiscord | <Elegantbeef> I have fields iterator and `name` accessor, though dont presently have a `pragmas` on an ident def |
22:30:22 | FromDiscord | <Elegantbeef> Though it should exist so guess i'll add it after i make nimibook faaaaaast |
22:31:08 | FromDiscord | <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:31 | FromDiscord | <Elegantbeef> That retrieves all fields including recCased ones |
22:31:33 | Amun-Ra | ah, 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:00 | FromDiscord | <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:28 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UNq |
22:47:34 | FromDiscord | <Elegantbeef> In Nim statements are expressions if they return values |
22:48:32 | FromDiscord | <yoyojambo> can I apply that to a bunch of variables at the same time? |
22:48:49 | FromDiscord | <Elegantbeef> What do you mean? |
22:48:52 | * | Gustavo6046 quit (Ping timeout: 260 seconds) |
22:49:26 | FromDiscord | <yoyojambo> I want to declare like 6 variables with one of two options for each basically |
22:49:56 | FromDiscord | <huantian> Oh |
22:49:58 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=3UNr |
22:50:12 | FromDiscord | <Elegantbeef> yes you can do `let x, y, z, w = 100` |
22:50:14 | FromDiscord | <Elegantbeef> you can also do \`let (x, y, z, w) = (10, 20, 30, 10)\`\` |
22:50:54 | FromDiscord | <yoyojambo> sent a code paste, see https://play.nim-lang.org/#ix=3UNs |
22:50:57 | FromDiscord | <yoyojambo> lemme see if I can make it work with that |
22:57:35 | FromDiscord | <yoyojambo> it worked! thanks again |
23:02:29 | FromDiscord | <mratsim> you can use views of views |
23:03:19 | FromDiscord | <Elegantbeef> Mratsim you're a bit late |
23:03:23 | FromDiscord | <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:58 | FromDiscord | <mratsim> I'm never late. I arrive when I'm needed |
23:04:07 | FromDiscord | <Elegantbeef> Suuuure |
23:04:27 | FromDiscord | <yoyojambo> what is a view? and also, what does `lent` mean in the `data: lent UncheckedArray[T]` line? |
23:04:49 | FromDiscord | <Elegantbeef> Views are borrowed memory `lent` is a read view into a collection |
23:04:57 | FromDiscord | <mratsim> lent is an unowned borrow checked ptr |
23:05:10 | FromDiscord | <Elegantbeef> It's like rust's borrow semantics |
23:06:55 | FromDiscord | <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:04 | FromDiscord | <Elegantbeef> Yes |
23:07:11 | FromDiscord | <yoyojambo> In reply to @Elegantbeef "It's like rust's borrow": Not really familiar with them :( |
23:07:28 | FromDiscord | <Elegantbeef> Nim has an experimental borrow checker and borrowing, which often causes Cgen issues |
23:08:48 | FromDiscord | <Elegantbeef> The point being to reduce copies and increase performance safely |
23:10:51 | FromDiscord | <Elegantbeef> Anyway in your case you are just looking for the typeclass part of `openArray` |
23:13:32 | FromDiscord | <huantian> One day Nim borrow checker will be perfect |
23:13:40 | FromDiscord | <Elegantbeef> Perhaps |
23:13:53 | FromDiscord | <Elegantbeef> When that day comes i'll be a happy boy |
23:14:12 | FromDiscord | <Elegantbeef> Especially if closures can also borrow |
23:14:37 | FromDiscord | <huantian> Would be juicy |
23:15:51 | FromDiscord | <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:01 | FromDiscord | <Elegantbeef> Yep |
23:16:13 | FromDiscord | <Elegantbeef> `lent` is a pointer that cannot mutate |
23:16:25 | FromDiscord | <Elegantbeef> It's also ensured that it doesnt dangle |
23:16:29 | FromDiscord | <yoyojambo> how do you lend something? |
23:16:43 | FromDiscord | <Elegantbeef> I think you just assign it |
23:16:48 | FromDiscord | <yoyojambo> or is it just part of the declaration of the variable? |
23:16:53 | FromDiscord | <Elegantbeef> View types are experimental so not going to talk about it |
23:17:04 | FromDiscord | <Elegantbeef> think it's `var a: lent int = myInt` for instance |
23:17:10 | FromDiscord | <Elegantbeef> or in an object you just set the field |
23:17:41 | FromDiscord | <Elegantbeef> Think that's how it was no clue if it's changed 😀 |
23:17:59 | FromDiscord | <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:09 | FromDiscord | <yoyojambo> (edit) "lent?" => "borrowed?" |
23:18:47 | FromDiscord | <mratsim> you can modify lent UncheckedArray https://github.com/mratsim/constantine/blob/master/research/kzg_poly_commit/strided_views.nim#L34-L40= |
23:19:09 | FromDiscord | <mratsim> ah no I'm casting to ptr |
23:20:07 | FromDiscord | <yoyojambo> wait so what cant mutate? the data it points to or the pointer itself? |
23:20:39 | FromDiscord | <Elegantbeef> The data that's pointed at |
23:20:51 | FromDiscord | <Elegantbeef> `a[] = 300` would error but `a = myOtherInt` shouldnt afaik |
23:21:01 | FromDiscord | <Elegantbeef> I could be wrong with how this works think Araq had issues with this logic |
23:21:38 | FromDiscord | <huantian> I think if the compiler knows something Is lent it wouldn’t let you modify it, but it’s being casted? |
23:23:15 | FromDiscord | <Elegantbeef> Let's be honest no one really knows how it'll work in the end 😛 |
23:24:46 | FromDiscord | <yoyojambo> In reply to @Elegantbeef "think it's `var a:": in this line, is `a` the same memory address than `myInt`? |
23:25:30 | FromDiscord | <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:53 | FromDiscord | <Elegantbeef> Like i said i dont think this stuff is overly concrete yet |
23:26:22 | FromDiscord | <Elegantbeef> But yes the `a` would point to `myInt` |
23:26:22 | FromDiscord | <Elegantbeef> That's what borrowing is afterall |
23:26:38 | FromDiscord | <Elegantbeef> They're just pointers assured to be safe |
23:27:27 | FromDiscord | <yoyojambo> thanks for your time |
23:27:39 | FromDiscord | <yoyojambo> I get it now |
23:44:19 | * | fallback joined #nim |
23:45:48 | fallback | hello nim ppl :) |
23:45:59 | FromDiscord | <Elegantbeef> Hello nim person |
23:46:45 | fallback | does nim build on openbsd 7.0? |
23:47:07 | FromDiscord | <Elegantbeef> Likely it does, but no clue |
23:48:34 | fallback | official version is 1.2 but this is too old for nitter |
23:48:58 | FromDiscord | <Elegantbeef> Does choosenim work on bsd? |
23:48:58 | FromDiscord | <Elegantbeef> Dont recall |
23:51:30 | fallback | idk what that is |
23:51:49 | FromDiscord | <Elegantbeef> https://github.com/dom96/choosenim |
23:51:52 | FromDiscord | <Elegantbeef> The better way of installing nim |
23:58:02 | fallback | /usr/src/Nim/compiler/nim.nim(10, 11) Error: cannot open file: std/os |
23:58:11 | fallback | FAILURE |
23:58:37 | fallback | this is new git clone |