00:07:38 | * | cyberjpn joined #nim |
00:09:43 | * | hecanjog joined #nim |
00:16:12 | disruptek | shashlick: you around? question about nimterop. |
00:17:17 | * | rayman22201 quit (Quit: Connection closed for inactivity) |
00:22:27 | * | cybj joined #nim |
00:28:47 | * | theelous3 quit (Ping timeout: 245 seconds) |
00:33:58 | * | cyberjpn quit (Quit: WeeChat 2.4) |
00:42:03 | * | kotrcka quit (Ping timeout: 248 seconds) |
00:42:18 | * | kotrcka joined #nim |
01:05:48 | * | rnrwashere joined #nim |
01:30:41 | * | cyberjpn joined #nim |
01:47:02 | * | cyberjpn quit (Ping timeout: 250 seconds) |
01:55:53 | * | jasper joined #nim |
01:56:12 | * | dddddd quit (Remote host closed the connection) |
02:00:17 | * | banc quit (Quit: Bye) |
02:03:25 | * | abm quit (Quit: Leaving) |
02:06:08 | * | cyberjpn joined #nim |
02:11:16 | shashlick | Hey just saw this |
02:11:36 | shashlick | @disruptek ^^ |
02:12:34 | disruptek | shashlick: just trying to wrap some redland stuff, but it's probably too ambitious. |
02:12:58 | shashlick | Taking a look |
02:13:41 | shashlick | Share a link? |
02:13:42 | disruptek | getting a codegen error (well, many) but first one is due to some funky enum specification using a bit field (which is solvable). |
02:14:05 | disruptek | i don't have any paste setup, but i will try to move something by hand. |
02:14:23 | shashlick | http://librdf.org? |
02:14:56 | disruptek | yeah. |
02:16:03 | disruptek | https://gist.github.com/disruptek/43bfc48ca3248ee514c79f4072f0f36c |
02:16:22 | disruptek | so it pukes on the use of | in the rhs. |
02:16:51 | disruptek | Error: target STRING not available |
02:17:06 | disruptek | i really hate trying to paste into alacritty. brb. |
02:17:17 | shashlick | What does your wrapper look like? |
02:17:25 | shashlick | I can try debugging in 30 minutes |
02:17:35 | disruptek | (this is gen'd by nimterop): RASQAL_TRIPLE_SUBJECT | RASQAL_TRIPLE_PREDICATE | RASQAL_TRIPLE_OBJECT* = 12.rasqal_triple_parts |
02:18:29 | disruptek | the wrapper is just 3loc: cIncludeDir("/usr/include/rasqal"); cIncludeDir("/usr/include/raptor2"); cImport("/usr/include/rasqal/rasqal.h") |
02:18:58 | shashlick | Ya that's obviously wrong, must be a bad ast or nimterop is confused |
02:19:02 | disruptek | but, i haven't nimterop'd before, so i don't know if my expectations are correct. |
02:19:12 | shashlick | Can you run toast -ap on that file |
02:19:15 | shashlick | Any errors? |
02:19:55 | * | banc joined #nim |
02:20:05 | disruptek | yeah, that works, so it's a codegen thing on our side, right? |
02:20:35 | disruptek | fwiw, i ran `toast --includeDirs=/usr/include/rasqal --recurse /usr/include/rasqal/rasqal.h -a` |
02:21:50 | * | rnrwashere quit (Remote host closed the connection) |
02:24:11 | shashlick | Well does it print any error nodes? |
02:24:16 | FromGitter | <arnetheduck> shashlick, a thing I hit with the sql wrapper: looks like the function pointers that are struct members didn't get converted (https://github.com/arnetheduck/nim-sqlite3-abi/blob/master/sqlite3.h#L774) and those function pointers that did get convertered were done so with a `nimcall` calling convention which seems a bit odd - wasn't expecting it at least: https://github.com/arne |
02:24:16 | FromGitter | ... theduck/nim-sqlite3-abi/blob/master/sqlite3_abi.nim#L365 |
02:24:22 | disruptek | i mean, toast -ap doesn't work, but -a yields an s-exp. |
02:25:27 | disruptek | hmm, it is tryin to load raptor.h in -ap, which is just a 1-liner including raptor2.h. i guess it doesn't like seemingly-empty includes? |
02:27:12 | disruptek | or maybe i'm just screwing up the include dirs somehow. |
02:27:31 | shashlick | I'll check both in ten |
02:27:55 | shashlick | No it is a nimterop issue mostly |
02:28:52 | disruptek | no rush, and thanks for checking it out. :-) |
02:30:22 | FromGitter | <arnetheduck> and one more thing: if I use a cPlugin to rename some symbol, it should really get an `importc`pragma with the original name.. tried it with a type, it got renamed in the nim file but then it uses the wrong name in the generated code (not the same as the name in the header file) |
02:30:45 | disruptek | yeah, toast needs the raptor2 include. that `|` should fix some of my issues. still missing some identifiers, but i will dig into those. |
02:42:21 | * | rnrwashere joined #nim |
02:45:07 | * | jasper quit (Ping timeout: 256 seconds) |
02:59:32 | * | vlad1777d_ quit (Ping timeout: 255 seconds) |
03:01:49 | * | cyberjpn quit (Ping timeout: 246 seconds) |
03:04:42 | * | rnrwashere quit (Remote host closed the connection) |
03:12:40 | * | Hexeratops quit (Remote host closed the connection) |
03:24:50 | shashlick | okay i'm in |
03:26:33 | disruptek | eager! |
03:27:50 | shashlick | how did you install raptor/rasqal |
03:27:53 | shashlick | which distro |
03:28:20 | disruptek | i'm using gentoo, but i think it's pretty stable everywhere. |
03:31:40 | disruptek | there are some debug statements for some of these identifiers (type aliases) that aren't getting emitted as nim code. :-/ |
03:44:36 | * | rayman22201 joined #nim |
03:54:54 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
04:15:00 | * | nsf joined #nim |
04:35:06 | * | jasper joined #nim |
04:40:46 | shashlick | @disruptek - found a fix for the enum issue |
04:48:23 | shashlick | just pushed the fix |
04:48:30 | shashlick | you need to set recurse=true in cimport |
04:57:17 | shashlick | well, you don't need recurse, but need to declare those type aliases as objects in nim code since they are defined in the c files, not h files |
05:14:15 | * | cyberjpn joined #nim |
05:18:04 | * | narimiran joined #nim |
05:33:32 | shashlick | @arnetheduck - i've put in a fix for sqlite3_io_methods |
05:33:38 | shashlick | basically nimterop didn't know about volatile |
05:34:22 | shashlick | but you need to comment out line 773 - if you don't, nimterop won't make the real struct since it is a duplicate name |
05:39:45 | shashlick | arnetheduck - i don't quite remember why i put in nimcall - should it always be cdecl? |
05:49:49 | * | cyberjpn quit (Ping timeout: 246 seconds) |
05:55:53 | * | kapil____ joined #nim |
05:59:38 | * | krux02 joined #nim |
06:01:59 | * | cyberjpn joined #nim |
06:08:43 | * | jasper quit (Quit: Page closed) |
06:14:21 | * | PMunch joined #nim |
06:17:33 | * | dddddd joined #nim |
06:21:33 | * | solitudesf joined #nim |
06:26:56 | shashlick | @arnetheduck - can you please give an example of the importc pragma bug? |
06:28:54 | FromDiscord_ | <JGiraffe> Hey I'm trying to get nim functional on my new laptop and whenever I try to compile a helloworld.nim file it says " cannot open 'C:\Users\DELL\helloworld.nim' " |
06:29:05 | cy1 | any idea how to unmangle names? |
06:29:49 | FromDiscord_ | <JGiraffe> If you mean me no I'm a beginne |
06:29:55 | FromDiscord_ | <JGiraffe> If you mean me no I'm a beginner |
06:30:12 | FromGitter | <jrfondren> name mangling's not related to whatever your issue is |
06:30:15 | cy1 | f/i valgrind tells me "More than 1000 different errors detected." but all it says is like semTypeSection_7YxUILpPxooC5qqa89a54dw_43 |
06:31:06 | FromGitter | <jrfondren> cy1, you can search for that in your nim cache and then examine it to get an idea of what it is. |
06:31:08 | * | Gertm left #nim ("Leaving") |
06:31:11 | FromDiscord_ | <JGiraffe> Is there somewhere I should've downloaded nim besides the desktop? |
06:31:17 | cy1 | I'm segfaulting the compiler somehow, with this macro. I think some nodes might be getting freed, despite being added elsewhere... |
06:31:29 | cy1 | oh, good idea jrfondren |
06:34:29 | FromDiscord_ | <JGiraffe> I'm gonna try reinstalling if running finish.exe doesn't fix it |
06:34:41 | cy1 | Good luck JGiraffe |
06:35:20 | FromGitter | <alehander42> you can try the readme |
06:35:21 | FromGitter | <alehander42> method |
06:36:18 | cy1 | I don't know what directory nim runs in, or how Microsoft manages that stuff. I'm guessing it's in "C:\Users\DELL" and your helloworld.nim file is not. |
06:39:21 | FromDiscord_ | <JGiraffe> would it need to be in the "DELL" parent folder or does a sub folder work? |
06:40:08 | cy1 | If nim is looking in that folder, then it's looking in that folder. You might be able to use some sort of "change directory" command to move into a subfolder. |
06:40:21 | * | jjido joined #nim |
06:41:24 | FromDiscord_ | <JGiraffe> at the beginning of the guide I'm following it says to "Open your terminal in the same directory where your file is" |
06:41:45 | cy1 | Sounds like a plan. |
06:42:32 | FromDiscord_ | <JGiraffe> So far I haven't been able to figure out how to open command prompt to any location except C:\Users\DELL |
06:43:12 | cy1 | I know there's a command to change to a different directory, aka location or subfolder. Not sure what it is on Microsoft though. Try "help cd"? |
06:44:28 | FromGitter | <alehander42> so cd should work |
06:45:56 | * | lritter joined #nim |
06:49:43 | FromDiscord_ | <JGiraffe> I've noticed that when try to download mingw it stops before 100% and closes the command prompt |
06:50:22 | FromDiscord_ | <JGiraffe> I tried changing the directory and it kept saying path not found |
06:50:38 | FromDiscord_ | <JGiraffe> now after moving the file around a bit it says " invocation of external compiler program failed. The system cannot find the file specified. |
06:50:39 | FromDiscord_ | <JGiraffe> ; Additional info: "Requested command not found: \'gcc.exe -c -w -mno-ms-bitfields -IC:\\Users\\DELL\\Desktop\\NIM\\nim-0.19.4\\lib -o C:\\Users\\DELL\\nimcache\\helloworld_d\\helloworld.c.o C:\\Users\\DELL\\nimcache\\helloworld_d\\helloworld.c\'. OS error:" 2" |
06:52:10 | FromDiscord_ | <JGiraffe> ok I guess it closes it at 100% |
06:54:59 | FromDiscord_ | <JGiraffe> Where would you recommend extracting the nim folder to |
06:55:05 | FromDiscord_ | <JGiraffe> Where would you recommend extracting the nim folder to? |
07:00:00 | * | gmpreussner_ quit (Quit: kthxbye) |
07:02:40 | cy1 | man, this is way too much trouble. Just wanted a thing where you specify options like procedure(foo, bar, baz(42), name("etc")) but my god the complexity of these macros. |
07:03:20 | * | Perkol joined #nim |
07:04:20 | FromDiscord_ | <JGiraffe> Every time I run finish.exe I get this message: No compatible MingW candidates found in the standard locations [Error] |
07:04:32 | * | gmpreussner joined #nim |
07:05:10 | Perkol | In here https://github.com/status-im/nim-byteutils/blob/master/byteutils.nim How do I use variant of hexToByteArray which outputs to open array? |
07:05:55 | FromDiscord_ | <JGiraffe> And that's right after I downloaded it and tried compiling my file, to which it told me nim wasn't a supported expression |
07:06:06 | narimiran | Perkol: array is already an openArray |
07:06:28 | * | cyberjpn quit (Ping timeout: 246 seconds) |
07:07:49 | cy1 | JGiraffe: MingW is an open source C compiler that most people use on Microsoft systems. I'm not sure what it takes for it to be "compatible" though. But Nim compiles to C code, which then needs a C compiler to become machine code. |
07:08:25 | FromDiscord_ | <JGiraffe> And that's right after I downloaded it and tried compiling my file, to which it told me 'nim' is not recognized as an internal or external command, |
07:08:26 | FromDiscord_ | <JGiraffe> operable program or batch file. |
07:08:28 | Perkol | narimiran: what do you mean? |
07:08:57 | narimiran | JGiraffe: did you follow installation instructions from https://nim-lang.org/install_windows.html ? |
07:09:52 | narimiran | Perkol: i mean that if you have some other func which takes an openArray, you can pass the array to it |
07:09:56 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
07:10:19 | Perkol | Let's say I have proc myproc(input: openArray[byte]) How do I pass hexToByteArray to it? |
07:10:26 | cy1 | It's more political than anything, honestly. People just haven't agreed on everything, so you have to put the puzzle pieces together yourself. All the pieces are out there though. |
07:10:50 | narimiran | Perkol: have you tried it? |
07:14:06 | Perkol | narimiran: yes, myproc(hexToByteArray("test")) gives error: cannot instantiate: 'N' |
07:14:44 | narimiran | `func hexToByteArray*[N: static[int]](hexStr: string): array[N, byte]` |
07:15:22 | FromDiscord_ | <JGiraffe> Narimiran: I've run finish.exe multiple times and tried downloading mingw multiple times. First it was saying it couldn't open helloworld.nim, then it couldn't find it after I'd moved it a couple times, and now it's acting like I've never run finish.exe |
07:16:28 | FromDiscord_ | <JGiraffe> I'm manually downloading mingw now but I'm not sure where it'll need to go |
07:16:42 | Perkol | narimiran: problem is I need array which length determined at runtime |
07:17:13 | narimiran | Perkol: would `func hexToSeqByte*(hexStr: string): seq[byte]` then work for you? |
07:17:31 | FromDiscord_ | <JGiraffe> Yeah I have no idea how to install mingw |
07:19:04 | narimiran | JGiraffe back when i was using windows, i just run `finish.exe` and there were no problems. maybe i had to manually add nim to PATH, i don't remember |
07:19:24 | narimiran | but there was no manual installation of mingw involved, that's for sure |
07:19:32 | Perkol | narimiran: I tried it, seems it doesn't work with my library. https://github.com/genotrance/nimmonocypher/blob/master/tests/tnimmonocypher.nim Let's say i want to do something like this, but accept variable length strings? |
07:19:57 | FromDiscord_ | <JGiraffe> Here's what I've got with finish.exe now: bin\nim.exe is already in your PATH [Skipping] |
07:19:57 | FromDiscord_ | <JGiraffe> C:\Users\DELL\.nimble\bin is already in your PATH [Skipping] |
07:19:58 | FromDiscord_ | <JGiraffe> No compatible MingW candidates found in the standard locations [Error] |
07:19:58 | FromDiscord_ | <JGiraffe> Do you want to download MingW from Nim's website? (y/n) |
07:20:12 | FromDiscord_ | <JGiraffe> Here's what I've got with finish.exe now: |
07:20:12 | FromDiscord_ | <JGiraffe> bin\nim.exe is already in your PATH [Skipping] |
07:20:13 | FromDiscord_ | <JGiraffe> C:\Users\DELL\.nimble\bin is already in your PATH [Skipping] |
07:20:13 | FromDiscord_ | <JGiraffe> No compatible MingW candidates found in the standard locations [Error] |
07:20:13 | FromDiscord_ | <JGiraffe> Do you want to download MingW from Nim's website? (y/n) |
07:21:09 | FromDiscord_ | <JGiraffe> After the download it keeps saying: 'nim' is not recognized as an internal or external command, |
07:21:09 | FromDiscord_ | <JGiraffe> operable program or batch file. |
07:21:17 | FromDiscord_ | <JGiraffe> After the download it keeps saying: |
07:21:17 | FromDiscord_ | <JGiraffe> 'nim' is not recognized as an internal or external command, |
07:21:17 | FromDiscord_ | <JGiraffe> operable program or batch file. |
07:22:15 | narimiran | "have you tried turning it off and on again?" |
07:22:37 | FromDiscord_ | <JGiraffe> ok I'll restart |
07:24:20 | FromGitter | <alehander42> ok, but is nim.exe found in C:\Users\..stuff...stuff\bin |
07:24:41 | FromGitter | <alehander42> one thing i notice is \DELL.nimble\ : this doesnt seem good |
07:24:56 | FromGitter | <alehander42> i think it should be \DELL\.nimble but it might be different on windows |
07:25:21 | FromGitter | <alehander42> can you see in your file manager |
07:25:51 | FromGitter | <alehander42> what is the actual path where it's installed ? (and if there is DELL.nimble or DELL/.nimble) and |
07:26:25 | FromGitter | <alehander42> where is actually nim.exe ? because if you find out, you just need to add it to the PATH in the worst case manually |
07:30:04 | FromDiscord_ | <JGiraffe> nim.exe is in downloads > nim-0.19.4 > bin |
07:30:24 | FromGitter | <alehander42> hmm ok |
07:30:40 | FromGitter | <alehander42> so if you add this to path, does it work? |
07:30:41 | FromDiscord_ | <JGiraffe> nimble is there too |
07:31:27 | FromDiscord_ | <JGiraffe> I don't know how to add it to path |
07:31:43 | FromDiscord_ | <JGiraffe> right click didn't bring up anything like that |
07:31:56 | narimiran | LMGTFY ;) |
07:33:18 | FromDiscord_ | <JGiraffe> This is what I get when trying to compile: |
07:33:18 | FromDiscord_ | <JGiraffe> |
07:33:18 | FromDiscord_ | <JGiraffe> Hint: used config file 'C:\Users\DELL\Downloads\nim-0.19.4\config\nim.cfg' [Conf] |
07:33:18 | FromDiscord_ | <JGiraffe> Hint: system [Processing] |
07:33:19 | FromDiscord_ | <JGiraffe> Hint: helloworld [Processing] |
07:33:19 | FromDiscord_ | <JGiraffe> CC: helloworld |
07:33:21 | FromDiscord_ | <JGiraffe> Error: invocation of external compiler program failed. The system cannot find the file specified. |
07:33:25 | FromDiscord_ | <JGiraffe> ; Additional info: "Requested command not found: \'gcc.exe -c -w -mno-ms-bitfields -IC:\\Users\\DELL\\Downloads\\nim-0.19.4\\lib -o C:\\Users\\DELL\\nimcache\\helloworld_d\\helloworld.c.o C:\\Users\\DELL\\nimcache\\helloworld_d\\helloworld.c\'. OS error:" 2 |
07:34:08 | cy1 | JGiraffe: https://helpdeskgeek.com/windows-10/add-windows-path-environment-variable/ |
07:34:24 | FromGitter | <alehander42> yea it seems you need to add the gcc.exe folder to path as well |
07:34:27 | FromGitter | <mratsim> ah windows and environment paths .... |
07:34:46 | FromGitter | <alehander42> they probably should be added by the script automatically, but not sure why it isn't happening |
07:34:58 | cy1 | I think it's simple as something like "PATH=$PATH:/wherever/nim.exe/is" but Microsoft does that different too, so I dunno |
07:35:14 | FromGitter | <alehander42> that's probably just a temporary path change |
07:35:44 | FromGitter | <alehander42> not sure if there is stuff like .cmdrc :O |
07:37:39 | * | clyybber joined #nim |
07:40:27 | FromGitter | <jrfondren> yeah last time I tried Nim on Windows I couldn't get it to work either. Nim's cc installer didn't work and then when I did it myself I didn't do it enough for Nim. |
07:40:30 | Araq | JGiraffe: finish.exe can add it to your PATh |
07:40:44 | Araq | never failed for me |
07:40:57 | FromGitter | <alehander42> but why isn't finish.exe part of the normal install script |
07:41:07 | Araq | because there is no "install script" |
07:41:21 | FromGitter | <alehander42> hmm |
07:41:26 | Araq | check the instructions, it's literally "unzip + finish.exe" |
07:41:34 | FromGitter | <alehander42> the guy was quoting some y/N stuff |
07:41:41 | FromGitter | <alehander42> so i thought he ran a script |
07:41:47 | FromGitter | <alehander42> in this case, maybe he did run finish.exe |
07:41:54 | Araq | well finish.exe does ask questions |
07:41:58 | Araq | that you have to answer |
07:42:02 | FromGitter | <mratsim> maybe choosenim, was the windows install updated to 64-bit? |
07:42:24 | FromGitter | <alehander42> one strange thing in his cmd was that |
07:42:25 | FromGitter | <alehander42> he got |
07:42:28 | FromGitter | <alehander42> ` C:\Users\DELL.nimble\bin is already in your PATH [Skipping]` |
07:42:36 | FromGitter | <alehander42> which doesnt seem right to me |
07:42:38 | FromDiscord_ | <JGiraffe> |
07:42:39 | FromDiscord_ | <JGiraffe> https://cdn.discordapp.com/attachments/371759389889003532/575225956889788416/pathshot1.png |
07:42:43 | FromGitter | <alehander42> shouldn't it be DELL/.nimble |
07:43:04 | FromGitter | <alehander42> hm maybe wrong output escaping then |
07:43:09 | FromGitter | <GULPF> @Araq: is this a bug? https://gist.github.com/GULPF/655c616fd4c19f2f138b8f48a717aa78 |
07:43:19 | FromDiscord_ | <JGiraffe> So should I remove the nim stuff and start over? |
07:43:39 | FromGitter | <alehander42> no, leave it there for now, and add the gcc.exe folder as well |
07:43:50 | FromGitter | <alehander42> finish.exe should do the same you did , but automatically afaik |
07:44:03 | FromGitter | <alehander42> but you say you already ran it(?) |
07:44:11 | FromDiscord_ | <JGiraffe> yeah a few times |
07:45:56 | FromDiscord_ | <JGiraffe> I see a vccexe but no gcc.exe |
07:47:11 | FromGitter | <alehander42> hm, so add the vccexe folder then |
07:50:34 | FromDiscord_ | <JGiraffe> it just adds a duplicate of the bottom one in my screenshot |
07:51:03 | lritter | i just released 0.15 of my language, just in case someone's interested or would like to talk about it; maybe there's something that would be interesting to nimians... nimsters... nimmins http://scopes.rocks |
07:51:12 | FromDiscord_ | <JGiraffe> vccexe is just an application file in my bin folder |
07:51:40 | FromGitter | <alehander42> congrats lritter! |
07:51:57 | lritter | alehandler42: thanks! |
07:51:59 | FromGitter | <alehander42> JGiraffe: hm in this case i am not really sure why nim invokes gcc.exe |
07:52:14 | lritter | this is a 3 week bugfix release, before that i spent like 1 year without a release because we had to completely redo the IL |
07:52:20 | FromGitter | <alehander42> Araq: should nim invoke gcc.exe or vccexe on win? |
07:52:46 | lritter | ...and the bootstrapping core, which was a big chunk of code. the language changed a lot. |
07:53:27 | FromDiscord_ | <JGiraffe> I'm just gonna remove all the nim paths and start with a fresh download |
07:53:58 | * | Perkol quit (Quit: Leaving) |
07:55:56 | clyybber | Araq: What do you think about `static let a = 3` as a replacement for `let a {.compiletime.} = 3` ? |
07:56:41 | clyybber | replacement/syntactic equivalent/whatever |
07:57:04 | FromGitter | <mratsim> @lritter, closures as zero cost abstraction? View propagation seems interesting |
07:59:00 | lritter | mratsim: compile time closures come with a bunch of caveats: the generated code must turn up in the same top level function. |
08:00:03 | FromDiscord_ | <JGiraffe> WOWWWWW I was installing everything to "this pc" instead of DELL |
08:00:41 | clyybber | lritter: I wondered on the hacker thread: How does the view propagation work? |
08:00:46 | FromDiscord_ | <JGiraffe> Though I would like to change my default directory to 'this pc' if possible |
08:00:47 | FromGitter | <mratsim> You might want to talk with @edubart, he used to contribute a lot to my Nim tensor library. He comes from a C++ and Lua background and wanted a higher perf, scripting like language hence he tried Nim but since we had to fight a lot with generics, memory allocation and other stuff at the time he started to play with his own language. It's living there: https://github.com/edubart/euluna-lang |
08:00:54 | lritter | mratsim: concerning view propagation, i don't have an exact description of how it operates yet (the last one is heavily outdated), but i have a writeup of a generic mechanism that i developed as a result https://gist.github.com/paniq/8c39baea49692dcda34b7f031eeaddfe |
08:01:22 | lritter | mratsim: which is strongly inspired by the way view propagation was implemented and can be used to implement that sort of stuff |
08:01:41 | lritter | sidebands aren't implemented yet, but i want to do it. |
08:02:20 | lritter | clyybber, i'll have some eggs for breakfast, then i'll tell you :) bbl |
08:02:29 | clyybber | bon apetit |
08:03:31 | * | Vladar joined #nim |
08:08:15 | FromDiscord_ | <JGiraffe> wait a minute "this pc" and users\DELL have the same files |
08:08:33 | FromDiscord_ | <JGiraffe> yet they are separate directories |
08:10:44 | FromGitter | <alehander42> probably this pc is just an alt name for the same dir |
08:10:49 | FromGitter | <alehander42> to make it simpler for users |
08:11:41 | * | neceve joined #nim |
08:12:42 | FromGitter | <alehander42> lritter: do you have a gitter room for scopes or something like that |
08:13:58 | Araq | GULPF: no, it's not a bug |
08:14:19 | Araq | x is of type 'int' and an 'int' doesn't fit in a (restricted) int8 |
08:14:37 | livcd | What's this Sielo ? |
08:14:41 | livcd | I dont see any Nim code there |
08:15:06 | Araq | 1 is of type 'int literal(1)' and does fit in a int8 |
08:15:58 | FromGitter | <mratsim> @livcd, AFAIK Sielo will rewrite all the core in Nim |
08:16:20 | FromGitter | <mratsim> apart from chromium I guess :p |
08:21:21 | FromDiscord_ | <JGiraffe> Alright I ran finish.exe, downloaded mingw, restarted, and I'm still getting this error: |
08:21:21 | FromDiscord_ | <JGiraffe> |
08:21:22 | FromDiscord_ | <JGiraffe> C:\Users\DELL>nim c helloworld.nim |
08:21:22 | FromDiscord_ | <JGiraffe> Hint: used config file 'C:\Users\DELL\Desktop\nim-0.19.4\config\nim.cfg' [Conf] |
08:21:22 | FromDiscord_ | <JGiraffe> Hint: system [Processing] |
08:21:22 | FromDiscord_ | <JGiraffe> Hint: helloworld [Processing] |
08:21:24 | FromDiscord_ | <JGiraffe> CC: helloworld |
08:21:26 | FromDiscord_ | <JGiraffe> Error: invocation of external compiler program failed. The system cannot find the file specified. |
08:21:30 | FromDiscord_ | <JGiraffe> ; Additional info: "Requested command not found: \'gcc.exe -c -w -mno-ms-bitfields -IC:\\Users\\DELL\\Desktop\\nim-0.19.4\\lib -o C:\\Users\\DELL\\nimcache\\helloworld_d\\helloworld.c.o C:\\Users\\DELL\\nimcache\\helloworld_d\\helloworld.c\'. OS error:" 2 |
08:21:53 | FromDiscord_ | <JGiraffe> The file is literally right on my desktop |
08:22:44 | PMunch | Might be that Nim can't find GCC |
08:22:50 | PMunch | Have you set up your PATH variable properly? |
08:22:54 | livcd | mratsim: oh i gound jennysis |
08:23:11 | * | arecaceae quit (Remote host closed the connection) |
08:23:24 | FromGitter | <mratsim> @JGiraffe cn you check your PATH: https://www.computerhope.com/issues/ch000549.htm |
08:23:29 | livcd | Jgiraffe: it cant be that your has no access to gcc |
08:23:30 | * | arecaceae joined #nim |
08:23:32 | livcd | it can be * |
08:23:36 | FromGitter | <mratsim> seems like finish.exe didn't set it up properly |
08:23:57 | livcd | try as administrator first then fix your user |
08:23:57 | FromGitter | <alehander42> yes he did all of this 20 minutes ago |
08:24:17 | FromGitter | <alehander42> hm can the admin thing be relevant |
08:24:33 | FromGitter | <alehander42> JGiraffe: so where is mingw downloaded? can you find gcc.exe in mingw folder? |
08:24:44 | FromGitter | <mratsim> do you need to log out and log in back again for the path to be taken into account? |
08:25:07 | FromDiscord_ | <JGiraffe> Does it need to be in system because my USER path has both C:\Users\DELL\Desktop\nim-0.19.4\bin and C:\Users\DELL\.nimble\bin in it |
08:25:51 | FromGitter | <alehander42> but is mingw downloaded there? |
08:26:02 | FromGitter | <alehander42> is there an gcc.exe |
08:26:13 | livcd | it needs to be accessible to your user that runs nim c |
08:26:34 | livcd | can you invoke gcc manually? |
08:27:01 | FromDiscord_ | <JGiraffe> there's no mingw in my path or outside of zip files, and no gcc on the computer afaik |
08:27:13 | FromDiscord_ | <JGiraffe> there's no mingw in my path or outside of zip files, and no gcc on the computer as far as I can tell |
08:27:19 | FromGitter | <alehander42> hmm so it didnt download it? or it didnt unzip |
08:27:20 | FromGitter | <alehander42> hm |
08:27:51 | livcd | there is this little app I wanted to rewrite in Nim called Everything.exe |
08:27:58 | livcd | with instant search |
08:28:02 | livcd | you can search for your gcc.exe there |
08:28:12 | FromDiscord_ | <JGiraffe> I have the zip but finish.exe isn't installing it |
08:28:39 | FromDiscord_ | <JGiraffe> I don't know how or where gcc comes from |
08:30:35 | FromDiscord_ | <JGiraffe> I could try installing mingw manually |
08:30:36 | FromGitter | <mratsim> it should be downloaded automatically by finish.exe from here https://nim-lang.org/download/mingw64-6.3.0.7z but it's been 2 months since my last windows install |
08:31:19 | FromGitter | <mratsim> if all else fails, use choosenim: https://github.com/dom96/choosenim#windows |
08:34:34 | FromDiscord_ | <JGiraffe> does that automatically invoke mingw too? |
08:34:40 | livcd | i did my wind install like this -> git clone devel, choco install mingw, done |
08:35:39 | FromDiscord_ | <JGiraffe> Not familiar with the term 'choco' |
08:35:57 | FromGitter | <mratsim> it's a windows package manager |
08:36:05 | FromGitter | <mratsim> choosenim installs mingw and gcc automatically yes |
08:36:32 | FromDiscord_ | <JGiraffe> ok cool I'll try this route thanks |
08:36:40 | livcd | unless it does not and then you need to check all of these things anyway |
08:36:56 | livcd | i just added C:\ProgramData\chocolatey\bin , C:\Nim\bin to my path |
08:40:40 | FromGitter | <GULPF> @Araq: But both statements uses 'x'? there's no 'int literal(1)' involved. I would expect the code to echo false twice |
08:42:36 | FromGitter | <mratsim> the compiler does simple constant propagation |
08:43:37 | FromGitter | <mratsim> int literal(1) is probably a true static bool which is transformed into a int when crossing compile-time -> runtime boundaries |
08:44:06 | FromGitter | <mratsim> similar to: https://github.com/nim-lang/Nim/issues/7375 |
08:47:22 | FromGitter | <GULPF> I don't think that's the cause. Even changing `x` to `1.int16` makes the test print false twice. I think the compiler treats 'int' as 'int literal' here which seems wrong |
08:49:46 | Araq | GULPF: ah, I missed that detail, sorry |
08:49:59 | Araq | you're right, neither should compile, x is of type 'int' |
08:51:23 | Araq | JGiraffe: you can tell finish.exe to install mingw for you, all you have to do is to answer 'y' for all of its questions |
08:53:04 | * | hoijui joined #nim |
08:53:30 | FromDiscord_ | <JGiraffe> I did and for whatever reason mingw wasn't getting installed |
08:53:53 | FromDiscord_ | <JGiraffe> I'm using choosenim now and finally successfully compiled a file |
08:54:13 | clyybber | Araq: Why are there different modes in the vm for static and const expr? |
08:54:22 | FromDiscord_ | <JGiraffe> Thanks everyone for the instruction |
08:54:49 | clyybber | They are effectively the same, aren't they? |
08:54:52 | FromGitter | <mratsim> you're welcome, thank you for the grit :p |
08:55:21 | FromGitter | <mratsim> @clyybber, there is static, const and {.compileTime.} :P it's a bit messy |
08:55:36 | clyybber | mratsim: I know, I'm working rn to unify them |
08:55:57 | FromGitter | <mratsim> btw there is a case where const and let {.compileTime.} does not work |
08:56:06 | FromGitter | <mratsim> does not interchange sorry* |
08:56:09 | FromGitter | <mratsim> for ref objects |
08:56:27 | clyybber | Is ref not allowed for const or the other way around? |
08:56:41 | FromDiscord_ | <JGiraffe> Does anyone have recommendations for a good ui tool I can use to build a simple app? |
08:57:10 | clyybber | mratsim: Effectively the VM calls evalConstExprAux for all of em |
08:57:42 | FromDiscord_ | <JGiraffe> All I want to do is array lookups and small calculations per selection |
08:59:50 | FromGitter | <mratsim> @Clyybber: https://github.com/nim-lang/Nim/issues/11178#issuecomment-489996501 |
09:00:31 | FromGitter | <mratsim> @JGiraffe, maybe: https://github.com/nim-lang/ui |
09:00:52 | FromGitter | <mratsim> see: https://github.com/andlabs/libui#screenshots |
09:02:09 | PMunch | JGiraffe, might be biased, but wxNim or Gtk with genui is pretty good |
09:02:20 | PMunch | (might be biased because I wrote those macros) |
09:04:18 | PMunch | Again regretting that I haven't made my UI toolkit yet.. |
09:04:36 | PMunch | Worst part is that I had something working that made Gtk/Karax UIs |
09:06:06 | clyybber | mratsim: Thanks, I hope to fix that |
09:06:59 | FromGitter | <mratsim> const ref object will impact code generation by the way |
09:07:35 | FromGitter | <mratsim> I like the distinction because I know that {.compileTime.} will never be realized in the binary |
09:10:01 | clyybber | Hmm, yeah. |
09:10:50 | clyybber | But why are you not using static: instead of compileTime, then? |
09:10:57 | clyybber | Because of the added scope? |
09:12:36 | clyybber | Nevermind |
09:15:07 | FromGitter | <mratsim> yes, the scope is an issue |
09:15:25 | FromGitter | <mratsim> static let would be fine |
09:15:44 | FromGitter | <mratsim> with static synonymous with "VM space" |
09:15:54 | clyybber | Yeah, I just implemented that |
09:16:29 | clyybber | mratsim: But I guess the biggest problem that remains, is that you cant assign a {.compileTime.} to a const? |
09:16:33 | FromDiscord_ | <JGiraffe> I'll check those out thanks! |
09:17:07 | FromGitter | <mratsim> @Clyybber I never had to do that |
09:17:48 | FromGitter | <mratsim> basically I use compileTime as input to macros, and then in the macro I can just quote do or newLit the compileTime var |
09:18:22 | FromGitter | <mratsim> so i think it's a non-problem |
09:19:04 | clyybber | mratsim: So essentially it's only the syntax which is a bit ugly/confusing |
09:20:09 | FromGitter | <mratsim> yes, const, static and {.compileTime.} are too much |
09:20:20 | FromGitter | <mratsim> we can keep compileTime for procs |
09:20:33 | FromGitter | <mratsim> but for variables const and static are enough |
09:21:03 | clyybber | Does {.compileTime.} on a proc mean, that it can only be evaluated at compiletime? |
09:21:12 | clyybber | Or that it can be evaluated at compile and run time? |
09:21:33 | FromGitter | <mratsim> and even regarding compileTime procs they only have 2 use cases, the old one was for NimNode procs which is now not needed. And my subversion to enforce compileTime evaluation of the proc |
09:21:46 | FromGitter | <mratsim> no, it means evaluated by the VM |
09:22:10 | FromGitter | <mratsim> I also used static result for that purpose but apparently the fact that it worked is an accident |
09:22:37 | FromGitter | <mratsim> 1) static result might lead to strange static/generics/typedesc codepath which increase compilation time |
09:22:40 | FromGitter | <mratsim> +* |
09:23:16 | clyybber | `static proc name() =` for `proc name() {.compileTime.} =` could work too, I guess |
09:25:01 | FromGitter | <Vindaar> @clybber but you can assign a `var {.compileTime.}` to a const, no? I use it for some checks of existing files at compile time and runtime |
09:26:23 | clyybber | Vindaar: I thought so too: But this seems to indicate otherwise: https://github.com/nim-lang/Nim/issues/10990#issuecomment-481391292 |
09:26:57 | Araq | .compileTime means "compileTimy *only*" |
09:27:24 | FromGitter | <mratsim> no not static proc please :p |
09:27:25 | clyybber | Vindaar: Nevermind, its the inc thats the problem |
09:28:11 | Araq | but it would be useful to mean "I init this in the VM and then use it at runtime as a 'const'" but then why not assign it to a const for this... |
09:28:15 | FromGitter | <mratsim> I think {.compileTime.} for proc should stay to enforce compileTime evaluation of proc and static result should be prevented |
09:28:18 | clyybber | Araq: WDYT about a static prefix for `var`, `let` which acts the same as {.compileTime.} ? |
09:28:31 | Araq | please no. |
09:28:46 | FromGitter | <Vindaar> ah, ok. I just checked again and it still works in my code :) |
09:29:55 | Araq | clyybber, I agree it's bad but I'm afraid you should start with an RFC about how static/compileTime should be used |
09:32:16 | * | kapil____ quit (Quit: Connection closed for inactivity) |
09:32:23 | FromGitter | <mratsim> and const |
09:32:36 | FromGitter | <mratsim> with separate section for var and proc |
09:32:47 | FromGitter | <mratsim> and a topic about scoping |
09:32:55 | FromGitter | <mratsim> and macro parameter :p |
09:34:02 | clyybber | Araq: IMO, static and compileTime for everything that should be done/exist *only* at compile time |
09:34:22 | clyybber | const to embed compile time stuff into the binary for use at runtime |
09:34:36 | clyybber | so just like it is rn |
09:58:31 | * | Travis__ joined #nim |
10:02:19 | * | traviss joined #nim |
10:04:43 | * | Travis__ quit (Ping timeout: 248 seconds) |
10:05:04 | * | traviss quit (Client Quit) |
10:05:27 | * | traviss joined #nim |
10:09:08 | * | kotrcka quit (Ping timeout: 252 seconds) |
10:09:10 | traviss | When trying to run nim-gdb.py, I'm getting 'ImportError: No module named gdb'. Does anyone have any idea which package in need to pip install so I can do 'import gdb'? |
10:09:37 | * | kotrcka joined #nim |
10:18:09 | Araq | krux02, ping? |
10:18:16 | Araq | https://www.youtube.com/watch?v=sBP17HQAQjk slightly offtopic |
10:18:26 | krux02 | Araq: pong |
10:21:16 | krux02 | Araq: sorry I had to go for a while after the meeting |
10:21:19 | krux02 | but I am back now |
10:25:34 | Araq | please help traviss |
10:26:20 | traviss | thank you Araq |
10:29:55 | Zevv | I believe it's the other way around, on my machines the python module is part of the gdb package |
10:30:19 | Zevv | traviss: what's your OS/platform? |
10:30:47 | traviss | windows 10 |
10:31:18 | * | Zevv steps aside for someone with windows knowledge |
10:31:32 | * | vlad1777d_ joined #nim |
10:31:51 | traviss | trying to run from cygwin now... i may have been going about it wrong. i just realized there is a nim-gdb in bin. i was trying to run nim-gdb.py directly before. |
10:32:26 | Zevv | nah, that doesn't work indeed |
10:32:56 | traviss | the command i'm using now is: nim-gdb --debugger:native <file>.exe |
10:33:29 | Zevv | The --debugger:native is a Nim compiler flag |
10:33:43 | Zevv | so first you compile your binary with nim c --debugger:native file.nim |
10:33:49 | Zevv | and then you debug with nim-gdb ./file |
10:34:41 | traviss | oops, ok let me see |
10:38:25 | traviss | so i'm building with nim c -d:debug --debuginfo --lineDir:on --debugger:native <file>.nim |
10:38:39 | clyybber | wow, github is down |
10:38:49 | traviss | then running nim-gdb <file>.exe |
10:39:04 | Zevv | traviss: ack |
10:39:31 | traviss | and i get two errors in gdb: "F:\Users\...<file>.exe": not in executable format: file format not recognized |
10:39:52 | Zevv | can you run your binary without gdb? |
10:40:19 | traviss | yes it runs fine |
10:43:19 | Zevv | hm still something with your setup I guess, but I don't have access to any windows machines here, sorry; lets see if anyone can step in to help you out |
10:43:22 | clyybber | traviss: It could be that you have installed 32bit gdb, but try to debug a 64bit executable |
10:44:45 | traviss | yes, it looks like thats the case... thank you. i'll see if i can get the 64 bit version installed. |
10:52:57 | Zevv | \o/ |
10:55:02 | * | cyberjpn joined #nim |
11:13:14 | * | cyberjpn quit (Quit: WeeChat 2.4) |
11:13:36 | * | nsf quit (Quit: WeeChat 2.4) |
11:23:10 | * | abm joined #nim |
11:35:32 | leorize[m] | don't use cygwin, embrace msys2 instead :p |
11:35:39 | * | Trustable joined #nim |
12:04:16 | * | narimiran quit (Ping timeout: 252 seconds) |
12:04:47 | PMunch | leorize[m], pfft, just use Linux :) |
12:04:55 | PMunch | Well, *nix |
12:06:42 | krux02 | traviss, can you run nim-gdb with an `.exe` file on windows? |
12:07:16 | * | narimiran joined #nim |
12:07:36 | krux02 | nim-gdb is a bash script to start gdb correctly, I never tested or imagined it could be used on windows at all. |
12:08:35 | * | NimBot joined #nim |
12:12:17 | * | narimiran_ joined #nim |
12:12:20 | * | narimiran quit (Ping timeout: 250 seconds) |
12:16:13 | * | deech_ quit (Ping timeout: 246 seconds) |
12:21:50 | FromGitter | <kaushalmodi> Hello, does someone have tips to debug crash in Nim/C++ integration project: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5cd1785d5b3f941aa5f84e97] |
12:22:27 | FromGitter | <kaushalmodi> background: I have a compiled .so of a C++ project. I am wrapping a function in that library in a get_top_config proc in Nim |
12:22:53 | FromGitter | <kaushalmodi> .. I am compiling .so of this Nim project and that's being used by a 3rd party application called xmsim |
12:22:59 | FromGitter | <arnetheduck> why not just remove `compiletime`? |
12:28:14 | clyybber | arnetheduck: It has some use cases, @mratsim can tell you more about |
12:28:37 | FromGitter | <arnetheduck> do these use cases carry their weight? |
12:29:04 | FromGitter | <mratsim> I don't tend to develop useless things :p |
12:29:04 | clyybber | its a global static variable essentially |
12:29:28 | clyybber | if you want it to be global |
12:29:31 | FromGitter | <mratsim> compile-time Hashing to allow NimNode in HashTable sounds like a very useful usecase |
12:29:58 | FromGitter | <mratsim> and you cannot put ref objects in a const but you might need ref object during VM compute |
12:30:56 | * | couven92 joined #nim |
12:31:12 | FromGitter | <mratsim> basically compiletime/const are a bit like the async/await of the VM/runtime domain I guess (since someone was super confused about that on the forum this morning) |
12:41:42 | * | Snircle joined #nim |
12:49:43 | krux02 | @kaushalmodi is the dubugging help still requested? |
12:49:55 | FromGitter | <kaushalmodi> yes |
12:50:01 | FromGitter | <kaushalmodi> nim-gdb.py doesn't work |
12:50:11 | FromGitter | <kaushalmodi> as the gdb is invoked by a 3rd party appl |
12:50:12 | krux02 | how do you use it? |
12:50:37 | FromGitter | <kaushalmodi> xmsim calls nimcompiled.so and nimcompiled.so calls a fn from cppcompiled.so |
12:50:38 | krux02 | well, I use emacs (a 3rd party appl) and nim-gdb.py works |
12:51:09 | FromGitter | <kaushalmodi> but in my case, the code entry into Nim is not from a standalone exec |
12:51:25 | FromGitter | <kaushalmodi> above back trace is all I could get |
12:51:29 | krux02 | but you are right, any gdb integration that I tested screwed gdb support with custom printers up |
12:52:05 | krux02 | you can hook gdb to arbitrary already running processes as well |
12:52:16 | krux02 | you just have to start it differently |
12:52:56 | FromGitter | <kaushalmodi> I get this when I try to source nim-gdb.py (I already compiled the .so using the debugger switches): ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5cd17fa8375bac74706eac1c] |
12:53:10 | FromGitter | <kaushalmodi> the gdb *is* getting hooked |
12:53:16 | FromGitter | <kaushalmodi> just that it's not showing any useful info |
12:53:51 | krux02 | there is a problem in the nim-gdb.py script |
12:54:02 | krux02 | the Traceback should not be there |
12:54:25 | FromGitter | <kaushalmodi> that gdb instance is invoked by the xmsim tool |
12:54:36 | FromGitter | <kaushalmodi> which apparently doesn't populate the "COMPLETE_EXPRESSION" |
12:56:06 | clyybber | mratsim: Did you mistag #9817 in your comment on {.compileTime.}? |
12:56:14 | krux02 | what is your version of gdb? |
12:56:32 | krux02 | I have gdb 8.2.1 |
12:56:43 | FromGitter | <mratsim> @clyybber not a mistag, krux02 mentions incremental compilation concerns |
12:56:46 | * | xet7 joined #nim |
12:57:04 | clyybber | mratsim: Ah, I was confused because #9817 is fixed |
12:57:14 | FromGitter | <kaushalmodi> krux02: GNU gdb 7.6 |
12:57:18 | FromGitter | <mratsim> it was also my main blocker for why I needed static return type vs {.compileTime.} regarding his PR to remove static return type |
12:57:26 | krux02 | well, that is old |
12:57:28 | FromGitter | <kaushalmodi> it further says that it's a modified version for the xmsim tool |
12:57:50 | FromGitter | <kaushalmodi> to invoke gdb on xmsim, I need to run with `xmsim -gdb ..` |
12:58:06 | FromGitter | <kaushalmodi> so it has to use its own gdb |
12:58:38 | FromGitter | <kaushalmodi> that tool then invokes the Nim proc from Nim compiled .so .. and that Nim proc invokes a C++ fn from C++ compiled .so |
12:58:41 | krux02 | well, the pretty printers are not written for a gdb version that old. |
12:58:44 | FromGitter | <kaushalmodi> so it's kind of complicated |
12:58:45 | clyybber | mratsim: AFAIK incremental compilation is per module, so we could just disable incremental compilation for that module if it accesses or modifies a compiletime var |
13:00:01 | leorize[m] | is there anyway to easily check if a variable is within the boundaries of a `range[]` type? |
13:00:14 | FromGitter | <mratsim> mmmm, what are the main expected benefits of incremental compilation? |
13:00:48 | FromGitter | <kaushalmodi> leorize: .high .low would work? |
13:01:26 | FromGitter | <mratsim> because I'm pretty sure lots of stuff that take time to compile are macro code, especially complex one, and most of my complex macro code need a global var for hashtables |
13:02:46 | FromGitter | <mratsim> though in Arraymancer I manage to scope it and store the hashTable in the macro itself and not globally |
13:03:07 | krux02 | you might be able to make nim-gdb.py compatible for older versions of gdb, but I don't have such an old version, so I can't guarantee that I won't break it in the future |
13:03:09 | leorize[m] | @kaushalmodi yea but that's a lot of typing |
13:03:21 | leorize[m] | not to mention that those won't work for distinct ranges |
13:03:42 | FromGitter | <mratsim> anyway it's a reasonable tradeoff I'd say |
13:03:53 | FromGitter | <arnetheduck> well, if the language is not too heavy on forcing things to compile time or not, it could actually make that choice for different compiles.. ie runtime for debug compiles and compile time for the others |
13:05:36 | FromGitter | <kaushalmodi> krux02: even without pretty printers, what does this mean?: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5cd1829fb4700e023d38fced] |
13:05:44 | FromGitter | <kaushalmodi> "0x00000000 in ?? ()" <-- |
13:05:54 | FromGitter | <kaushalmodi> get_top_config is the call to Nim proc |
13:06:17 | FromGitter | <mratsim> you're missing debugging symbols |
13:06:53 | FromGitter | <mratsim> though 0x00000000 so maybe not, I don't remember :p |
13:06:59 | krux02 | mratsim: About the static return types, I was confused when I saw them the first time. First of all I was shocked to see that it is possible, and then I was confused because evaluationg function at compile tiem is supposed to be done with {.compileTime.} procs (or assignment to const), and then I saw static return values has problems that I don't want to fix since it seems to be a redundant feature. |
13:07:06 | clyybber | mratsim: you need the global hashtable to hash nimnodes right? I don't know much about what you are doing exactly, but cooldome implemented some hashing for nimNodes in the vm here: https://github.com/nim-lang/Nim/pull/10819/files#diff-3ff28bbe72b1ab26dbc8ac0d47bc1860R143 |
13:07:21 | krux02 | {.compiteTime.} proc seems to be the canonical way to go there |
13:07:40 | FromGitter | <mratsim> @krux02 I think everyone was surprised as well, and me too, I attempted it completely randomly |
13:07:52 | krux02 | ?? is usually a function pointer |
13:07:55 | FromGitter | <mratsim> TBH that's the only "feature" of static that wasn't buggy the first time I tried :p |
13:08:05 | krux02 | 0x0 in ?? is a nil function pointer |
13:08:12 | FromGitter | <mratsim> but yeah I assume it uses weird code path in semchecks |
13:08:17 | FromGitter | <kaushalmodi> I do have Nim compiled with `-d:debug --debuginfo --lineDir:on --debugger:native` |
13:08:46 | krux02 | put in all the flags ;p |
13:08:56 | FromGitter | <kaushalmodi> I did! see above :) |
13:08:57 | krux02 | --debugger:native should be enough though |
13:09:02 | FromGitter | <kaushalmodi> what else can I add |
13:09:53 | krux02 | and I recently added an alias for --debugger:native, it is -g |
13:10:02 | clyybber | for glorious |
13:10:14 | FromGitter | <mratsim> @krux02: cooldome is using compileTime var for the hash tables >_> https://github.com/nim-lang/Nim/pull/10819/files#diff-74d645617ff7e5dbb145997d95952407R18 |
13:10:20 | krux02 | so you should be able to just used `-g` instead of `-d:debug --debuginfo --lineDir:on --debugger:native` |
13:10:24 | leorize[m] | skim your code for nilable function pointers then :p |
13:10:43 | FromGitter | <mratsim> ah it's clyyber sorry |
13:10:44 | clyybber | mratism: Oh, I see |
13:10:53 | krux02 | I used compile time vars for hash tables as well. |
13:11:02 | krux02 | I know the problem. |
13:11:09 | * | nais314 joined #nim |
13:11:17 | krux02 | The question is just how could it be done with inclemental compilation. |
13:11:22 | FromGitter | <mratsim> there is no problem, just noise and 3 ways to do related thing |
13:11:32 | FromGitter | <mratsim> ah right incremental compilation |
13:12:01 | clyybber | krux02: disable incremental compilation for every codepath reading or modifying a compiletime var? |
13:12:03 | FromGitter | <mratsim> well clyber proposes to not allow incremental compilation on modules that uses a compileTime global var |
13:12:10 | clyybber | yeah |
13:12:32 | krux02 | and that is what I don't like |
13:12:38 | krux02 | I would prefer the inverse |
13:13:08 | krux02 | don't allow compile time var, unless you explicitly enable them as a compilation flag |
13:13:34 | krux02 | but the point is, the compile time var solved a problem, a problem that looks for an alternative solution. |
13:13:46 | * | rnrwashere joined #nim |
13:14:11 | krux02 | because I think hashing in general does not coflict with incremental compilation |
13:15:02 | FromGitter | <mratsim> PRNG needs to keep a state somewhere, if you can't scope that state you need compileTime var, that's the core issue |
13:15:14 | krux02 | I am thinking in the direction of a special symbol hashing type that hides to the compiler that it actually has state |
13:15:33 | krux02 | PRNG? |
13:15:42 | FromGitter | <mratsim> Pseudo Random number Generator |
13:15:44 | clyybber | pseudorandomnumbergenerator |
13:16:12 | krux02 | do you generate random numbers at compile time? |
13:16:40 | FromGitter | <mratsim> var foo {.compileTime.} = initRand(1234) |
13:17:02 | FromGitter | <mratsim> and then this is the source of unique ID for hashed ref objects |
13:17:14 | krux02 | yes for sure you can generate random numbers at compile time, but that is basically doom for all incremental compilation. |
13:18:40 | FromGitter | <mratsim> a compiletime source of unique id that plays well with incremental compilation would go a long way https://github.com/nim-lang/RFCs/issues/131 |
13:19:32 | * | couven92 quit (Quit: Client disconnecting) |
13:20:44 | krux02 | I don't get why you choose a random number generator here, it doesn't really prevent any identifier clashes, they are just very unlikely. |
13:21:18 | FromGitter | <mratsim> less likely than a tsunami is good enough for me ;) |
13:21:25 | krux02 | But then you can instead use the hash value instead, it has the same attributes plus it does not depend on compile time state |
13:21:48 | * | nais314 quit (Quit: Leaving) |
13:21:50 | FromGitter | <mratsim> It won't work the the example at the bottom |
13:21:50 | * | rnrwashere quit (Remote host closed the connection) |
13:22:20 | krux02 | which example? |
13:22:20 | FromGitter | <mratsim> ```code paste, see link``` ⏎ ⏎ The hash at compile time would be the same, but at runtime it would be different [https://gitter.im/nim-lang/Nim?at=5cd1868c6a84d76ed85e46e1] |
13:22:56 | * | rnrwashere joined #nim |
13:23:18 | krux02 | I don't understand that block |
13:23:35 | FromGitter | <mratsim> the a variable are different |
13:23:54 | FromGitter | <mratsim> if using ref semantics |
13:24:22 | FromGitter | <mratsim> this is true at runtime |
13:24:53 | FromGitter | <mratsim> but at compileTime I must resort to a trick to assign them a unique ID |
13:25:16 | krux02 | I still have no clue what you are trying to do with that block |
13:25:25 | FromGitter | <mratsim> or maybe just let a = newRef(1); let b = newRef(1); echo a == b |
13:26:00 | FromGitter | <mratsim> I'm trying to have different IDs for ref types even if the content is the same. |
13:26:14 | krux02 | isn't b supposed to be new instance (different from a) when you call "new"? |
13:26:21 | FromGitter | <mratsim> yes it is |
13:26:53 | FromGitter | <mratsim> if you see the implementation of mEq, it uses rkNodeAddr |
13:26:55 | clyybber | I guess the VM has to take previous invokations into account for its hashing, and then it should work? |
13:27:01 | krux02 | why don't use the address (pointer value) itself as id? |
13:27:18 | FromGitter | <mratsim> but in macros I have no magic to have this address |
13:27:36 | FromGitter | <mratsim> that's why I use compileTime state for hashing |
13:27:45 | FromGitter | <mratsim> otherwise I would just use this VM address |
13:29:41 | FromGitter | <mratsim> having a proc uuidT (x: ref T): Hash {.magic:"mUUID".} that returns the rkNodeAddr as a hash would solve my issues |
13:29:48 | FromGitter | <mratsim> argh |
13:30:03 | FromGitter | <mratsim> `proc uuidT (x: ref T): Hash {.magic:"mUUID".}` |
13:30:20 | FromGitter | <mratsim> or instanceId |
13:31:19 | krux02 | mratsim: well, in the compiler the types already have unique ids, they are just not exported in the macros module, because the id's are not stable, they depend on the order of the processed modules. |
13:31:34 | krux02 | (and on a lot of other factors as well) |
13:32:12 | FromGitter | <mratsim> it can be called instanceId then, we don't need stability for hashing, just that they are uniques |
13:33:04 | krux02 | mratsim: but I am ok, if you would allow to cast ref types to uint/int at compile time, as I think it is really safe to do and when people use cast, they know what they are letting themselfs in to. |
13:33:40 | krux02 | http://ix.io/1IiS |
13:34:59 | FromGitter | <mratsim> that would work as well though it seems overkill for that use case |
13:35:41 | FromGitter | <gogolxdong> https://github.com/microsoft/Terminal |
13:36:22 | FromGitter | <mratsim> @gogolxdong it was discussed in the nim-offtopic (IRC) nim-lang/twitch (Gitter) channel |
13:38:07 | FromGitter | <gogolxdong> nice, will check |
13:41:35 | * | narimiran_ is now known as narimiran |
13:43:59 | * | rnrwashere quit (Remote host closed the connection) |
13:43:59 | krux02 | clyybber: regarding "disable incremental compilation for every codepath reading or modifying a compiletime var?" |
13:44:29 | krux02 | that really defeats the point of incremental compilation. |
13:45:07 | FromGitter | <mratsim> yeah I agree with this concern |
13:45:35 | krux02 | When compile time state is used everywhere, because it is so easy to use, and this affects incremental compilation to be silently turned off, then incremental compilation basically doesn't work. |
13:45:46 | FromGitter | <mratsim> > because I'm pretty sure lots of stuff that take time to compile are macro code, especially complex one, and most of my complex macro code need a global var for hashtables ⏎ > though in Arraymancer I manage to scope it and store the hashTable in the macro itself and not globally |
13:46:24 | krux02 | On the other hand if there is a feature that doesn't work with incremental compilation that has to be explicity turned on while people also read about it's disadvantages. There is friction to use this feature and incremental compilation becomes much more useful. |
13:46:37 | krux02 | But I understand that not everything might be possible with incremental compilation. |
13:47:16 | krux02 | mratsim: yes |
13:47:33 | krux02 | macros are slow to compute. Storing their result will be very beneficial. |
13:48:47 | FromGitter | <mratsim> sounds good, I'm writing a polyhedral compiler implemented as macro :P I would love caching those results :p |
13:50:32 | krux02 | I have no idea what a polyhedral compiler is. |
13:51:07 | krux02 | I didn't know a compiler was flat and had n corners |
13:51:49 | narimiran | :D :D |
13:51:54 | FromGitter | <mratsim> Loops and nested loops can be represented as a polyhedron |
13:52:25 | krux02 | a polyhedron is still a geometry shape in my head |
13:52:27 | FromGitter | <mratsim> and we can use those to modify it without impacting read/write access dependency and also control tiling and optimize memory accesses |
13:52:44 | FromGitter | <mratsim> Yes it is |
13:52:54 | krux02 | and many small shapes compose the letters and words that eventually form the loops |
13:52:55 | FromGitter | <mratsim> we use geometry to optimize loops and result are very good |
13:53:05 | FromGitter | <mratsim> Here is a playground with examples: http://playground.pollylabs.org |
13:53:20 | FromGitter | <mratsim> look into the iteration domains and schedules examples |
13:53:30 | FromGitter | <mratsim> and memory access analyses |
13:57:14 | krux02 | so to sum it up, you span the entire SSA statement and then cut for redundancies? |
13:59:45 | * | PMunch quit (Remote host closed the connection) |
14:00:10 | FromGitter | <mratsim> no, it doesn't work at SSA level |
14:00:36 | FromGitter | <mratsim> I only look at iteration variable, and the statement that accesses them. |
14:01:26 | FromGitter | <mratsim> also it is only applicable to a very specific domain where you don't have control flow that does not depend on the i, j iteration variable of your loop |
14:01:47 | FromGitter | <mratsim> but this domain is perfectly suited to image processing and vector/matrix/tensor processing as well |
14:07:24 | FromGitter | <mratsim> Concrete example: original loop - |
14:08:03 | FromGitter | <mratsim> arg sorry screenshot disappeared |
14:09:16 | FromGitter | <mratsim> (https://files.gitter.im/nim-lang/Nim/2EAi/DeepinScreenshot_select-area_20190507160844.png) |
14:09:44 | FromGitter | <mratsim> And rescheduled one, same final result but different order even though there is data dependency |
14:09:53 | FromGitter | <mratsim> (https://files.gitter.im/nim-lang/Nim/CAFD/DeepinScreenshot_select-area_20190507160815.png) |
14:09:59 | * | rnrwashere joined #nim |
14:10:39 | FromGitter | <mratsim> and you can use that to analyze of to parallelize computation even if there are data dependency (like read after write) |
14:11:04 | FromGitter | <mratsim> introduce loop tiling/blocking to improve memory locality |
14:12:29 | FromGitter | <mratsim> original C loop does not match the "polyhedra" :/ |
14:12:38 | FromGitter | <mratsim> (https://files.gitter.im/nim-lang/Nim/saXP/DeepinScreenshot_select-area_20190507161211.png) |
14:18:05 | FromGitter | <arnetheduck> all this reminds me of the discussions in http://wiki.c2.com/?SufficientlySmartCompiler |
14:20:56 | FromGitter | <mratsim> It can also be useful for list comprehensions :p |
14:24:12 | FromGitter | <mratsim> Well, in that case polyhedral compilation as tremendous benefits on domain suitable for it like for image processing, you can get an order of magniture faster than OpenCV |
14:24:18 | FromGitter | <mratsim> (https://files.gitter.im/nim-lang/Nim/omZX/DeepinScreenshot_select-area_20190507162313.png) |
14:25:09 | FromGitter | <mratsim> reproduction code: https://github.com/bondhugula/polymage-benchmarks and source: http://mcl.csa.iisc.ac.in/polymage.html |
14:26:40 | * | hoijui quit (Remote host closed the connection) |
14:29:26 | * | couven92 joined #nim |
14:39:14 | * | fredrik92 joined #nim |
14:41:24 | shashlick | @arnetheduck did you get my messages from last night? |
14:45:53 | shashlick | @Araq @narimiran regarding 0.19.6 |
14:46:09 | shashlick | will it use the new nimble without compiler? |
14:46:23 | shashlick | will it contain binaries in Linux cause nightlies are built that way now? |
14:46:34 | shashlick | Do you plan on releasing arm binaries as well? |
14:47:08 | Araq | for better or worse 0.19.6 and 0.20 will ship the latest stable Nimble |
14:47:17 | Araq | so it's up to you really |
14:47:42 | Araq | devel always builds nimble master. |
14:49:08 | FromGitter | <iffy> Any specific reason there's no `==` for Table (but there is for OrderedTable and CountTable)? |
14:49:31 | FromGitter | <iffy> I'll submit a PR for it unless there's a reason not to |
14:49:33 | dom96 | shashlick we didn't tag a version |
14:49:38 | dom96 | so I doubt it |
14:49:54 | dom96 | are we certain that it's stable enough? |
14:49:59 | shashlick | I've not seen any new issues with nimble head so it would be nice to use |
14:50:40 | shashlick | But it's been only 10 odd days so I'll go by your judgment |
14:50:54 | FromGitter | <mratsim> if we start to have official ARM binaries we would probably use them in status CI |
14:50:55 | narimiran | when it will become "stable enough"? :P |
14:51:07 | FromGitter | <mratsim> for 0.19.6 |
14:52:10 | shashlick | @mratsim we are already building in nightlies but tests aren't done yet due to time limits and bugs in tests |
14:52:36 | FromGitter | <mratsim> we use 0.19.x though, our codebase is incompatible with 0.20 at the moment. |
14:53:11 | Araq | mratsim: I'm fixing bugs but I can only fix what you reported |
14:53:28 | Araq | shashlick, devel uses Nimble master to test 70 or so Nimble packages daily |
14:53:37 | Araq | that's a pretty good test |
14:53:39 | FromGitter | <mratsim> it's incompatible because 0.20 isn't the stable release |
14:54:05 | FromGitter | <kaushalmodi> shashlick, dom96: As a coincidence, I just tried `nimble publish` and I get: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5cd19c0c6a84d76ed85ee3eb] |
14:54:09 | FromGitter | <mratsim> And we target the latest stable with some stuff we need from devel: https://github.com/status-im/nim-std-shims |
14:54:20 | FromGitter | <mratsim> so we get ambiguous calls on 0.20 |
14:54:27 | FromGitter | <kaushalmodi> it went all the way through create a branch in my fork of *packages* repo, just didn't make the final PR |
14:54:31 | FromGitter | <mratsim> i.e. nothing serious |
14:56:56 | WilhelmVonWeiner | is there a way to access array indices starting from the end? |
14:57:06 | dom96 | kaushalmodi: report it, sounds like a bug. |
14:57:08 | WilhelmVonWeiner | similar to how in some langauges you can access arr[-1] |
14:57:16 | narimiran | WilhelmVonWeiner: ^1 |
14:57:19 | FromGitter | <kaushalmodi> dom96: doing just that right now |
14:58:21 | WilhelmVonWeiner | narimiran: thanks a bunch |
14:59:21 | WilhelmVonWeiner | what explains that syntax? |
15:00:34 | shashlick | @Araq sounds like you are good with using the latest nimble |
15:00:58 | shashlick | if we have a clean way to upgrade nimble in place, i'd argue it is time to do it |
15:01:07 | FromGitter | <mratsim> because -a and indexing from the end are different |
15:01:18 | shashlick | now that it is independent of the compiler, it can evolve faster |
15:01:50 | FromGitter | <mratsim> indexing from the end is not implemented in the compiler but as a standard tool |
15:02:15 | FromGitter | <mratsim> this allows people to support that in their custom types |
15:03:11 | WilhelmVonWeiner | Ooh interesting |
15:03:17 | FromGitter | <mratsim> also you can create arrays indexed with negative indices like var a: array[-10..10, int] |
15:03:18 | * | fredrik92 quit (Quit: Client disconnecting) |
15:03:37 | FromGitter | <mratsim> in that case there is a difference between a[-5] and a[5] |
15:04:07 | FromGitter | <mratsim> a[^5]* |
15:06:52 | disruptek | shashlick: thanks for your help last night, i should be able to get redland running today. :-) |
15:07:01 | * | kotrcka quit (Ping timeout: 268 seconds) |
15:07:11 | narimiran | shashlick: you are on something else other than IRC so you can't see PMs, right? :D |
15:07:57 | shashlick | @disruptek - awesome 🙂 |
15:08:03 | * | kotrcka joined #nim |
15:08:15 | shashlick | @narimiran - if you want to PM, please join #shashlick 🙂 |
15:08:29 | shashlick | of course, make sure no one else is in there 😉 |
15:08:37 | clyybber | lol |
15:08:44 | narimiran | heh, and there i was wondering why you don't reply :D |
15:09:06 | narimiran | then i remembered you said on telegram that you're not really there either :D |
15:09:09 | shashlick | i use matterbridge to bring everything into slack |
15:10:01 | shashlick | i guess gitter and telegram can do PMs, but i'll have to go into those apps to see them |
15:10:18 | zestyr | 7.6.8 I think |
15:10:23 | zestyr | oops, ignore that |
15:10:35 | narimiran | zestyr: i can't ignore it, sorry :P |
15:11:09 | shashlick | @narimiran - so what did I miss? |
15:11:33 | narimiran | shashlick: you will never know! mwahaha |
15:11:46 | shashlick | oh man! |
15:12:45 | FromGitter | <arnetheduck> @shashlick yeah, cool, thanks for the fix. see https://github.com/arnetheduck/nim-sqlite3-abi/commit/38656a3c781e04472e2df270a5f1f78d7005a3ca for `importc` thing - see how the sqlite3 type is lacking its original c name |
15:14:15 | krux02 | mratsim: since we talked about static return types, you reminded me that I still had this PR around where I disabled static return types. |
15:14:24 | krux02 | I think it passes now the tests. |
15:14:56 | shashlick | @arnetheduck - so you capitalized it in cPlugin but it doesn't show up in the importc |
15:16:18 | shashlick | i made some changes last night but it needs more work so i'll have to test it a bit more |
15:16:39 | FromGitter | <arnetheduck> > i don't quite remember why i put in nimcall - should it always be cdecl? ⏎ ⏎ I think it should just be nothing, but I might be wrong here, don't remember what nim does exactly.. it might be that it should be different based on (compiler-specific) attributes from the header file |
15:17:19 | shashlick | i know c2nim gives you flags to tweak them --stdcall and --cdecl for example |
15:17:22 | FromGitter | <mratsim> @krux02 Can we change the error "use the {.compileTime.} pragma instead" |
15:17:25 | FromGitter | <mratsim> to* |
15:18:11 | FromGitter | <mratsim> stdcall is for Visual Studio binary and cdecl for everything alse AFAIK |
15:18:35 | FromGitter | <kaushalmodi> krux02: are you here? |
15:18:46 | FromGitter | <arnetheduck> having to comment out line 773 seems like it goes counter to the goals of nimterop.. in particular, that's a "standard" way in `C` to avoid having to type out "struct bla" every time, sounds like a pattern nimterop should be able to handle |
15:19:09 | shashlick | okay i'll make cdecl the default output and allow for others with flags |
15:19:09 | FromGitter | <kaushalmodi> krux02: About "#3 0x0000000000000000 in ?? ()" that you mentioned being nil pointer to a fn |
15:19:27 | FromGitter | <kaushalmodi> I get get that when calling a fn imported from a c++ compiled .so |
15:19:57 | FromGitter | <kaushalmodi> does that mean that somehow the .so is not found? (but I *am* updating the LD_LIBRARY_PATH as needed ..) |
15:20:00 | FromGitter | <arnetheduck> why make it add anything at all? I don't think there's need for neither cdecl nor anything else.. unless in the c header file, it spells something out, in which case the wrapper should spell it out too |
15:20:34 | shashlick | well, it is being imported from C so nim should have to call it with cdecl |
15:21:16 | krux02 | kaushalmodi: I don't know how you load your shared library |
15:21:24 | FromGitter | <kaushalmodi> dynlib |
15:21:38 | FromGitter | <kaushalmodi> and that library is in LD_LIBRARY_PATH |
15:21:43 | krux02 | there are many ways to load a shared librar/dynlib/dll |
15:22:36 | FromGitter | <kaushalmodi> I am doing: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5cd1a2bc4b4cb471d9c2c777] |
15:22:49 | shashlick | @arnetheduck - i agree on line 773 but it isn't trivial right now |
15:22:59 | krux02 | you can linke it at compile time, then the operating sytem tries to find it when the program is started, but you can also load a dll/lib*.so at runtime and get pointer addresses from individual function names |
15:23:07 | krux02 | (dlopen is the second one) |
15:23:29 | FromGitter | <kaushalmodi> krux02: "you can also load a dll/lib*.so at runtime and get pointer addresses from individual function names" how? |
15:23:58 | krux02 | dlopen |
15:24:06 | FromGitter | <kaushalmodi> also when I do `ldd nimcompiled.so`, I don't see that linked lib? |
15:24:18 | FromGitter | <kaushalmodi> (no question mark in that prev message) |
15:25:07 | krux02 | you can also try to run ldd on your executable |
15:25:08 | FromGitter | <kaushalmodi> I'll need to grep .. `dlopen` doesn't show up on https://nim-lang.github.io/Nim/theindex.html |
15:25:11 | FromGitter | <jrfondren> @kaushalmodi dynlib: means ldopen is used instead of dynamic linking, so there's nothing to see until you run the app |
15:25:13 | krux02 | ldd <binary> |
15:25:23 | krux02 | it will tell you how .so files are resolved |
15:25:37 | FromGitter | <kaushalmodi> krux02: I already mentioned above that that does not show the linked .so |
15:25:54 | FromGitter | <kaushalmodi> summary: I am using `dynlib` pragma, but `ldd` does not show that linked .so |
15:26:00 | FromGitter | <jrfondren> *dlopen. it's a libc function, it needn't be in nim docs |
15:26:10 | FromGitter | <jrfondren> dynlib means dlopen, not dynamic linking. |
15:26:23 | FromGitter | <kaushalmodi> ok .. |
15:26:26 | FromGitter | <kaushalmodi> I am lost |
15:26:40 | FromGitter | <mratsim> @kaushalmodi can you try with {.link: "absolute/path/to/dll".} at the top level? |
15:26:51 | FromGitter | <jrfondren> static linking: links are resolved when app is compiled. dynamic linking: links are resolved by the system linker when the app is started. dlopen: links are resolved at runtime by the app itself. |
15:27:08 | krux02 | look in dyncalls.nim, there dlopen is wrapped in nimLoadLibrary and nimGetProcAddr |
15:27:36 | FromGitter | <kaushalmodi> krux02: But @jrfondren mentioned that dynlib already calls dlopen |
15:27:42 | FromGitter | <jrfondren> a penalty of dlopen is that dlopen can't handle everything the system linker can. fedora has scripts or configuration files or something pretending to be .so files. a benefit of dlopen is that it's the only option that doesn't use a shared namespace. |
15:27:43 | * | Jesin quit (Quit: Leaving) |
15:28:04 | FromGitter | <kaushalmodi> ok, let me start with the `{.link ..` method |
15:28:09 | FromGitter | <mratsim> see: https://github.com/numforge/agent-smith/blob/master/third_party/ale_wrap.nim#L36 |
15:28:47 | FromGitter | <kaushalmodi> @mratsim a complication .. can .link path contain env vars? |
15:29:01 | FromGitter | <kaushalmodi> I cannot hardcode the path as it contains my $USER |
15:29:09 | krux02 | kaushalmodi: I really think shared library are a hassle that should be avoided if possible. So only when you have sound reasons for a shared library, you should go that route, otherwise just to static linking as it really simplifies the build. |
15:29:11 | FromGitter | <mratsim> I don't recommend it though because you can't move things around, in my case it was more of a workaround for dlopen issues I had |
15:29:19 | FromGitter | <kaushalmodi> because the other users will have their $USER in their paths and they cannot see into my $USER path :/ |
15:29:56 | FromGitter | <mratsim> No it won't work, but at least you will now if it works for you and make sure that the DLL works |
15:33:39 | * | Jesin joined #nim |
15:33:52 | FromGitter | <arnetheduck> > well, it is being imported from C so nim should have to call it with cdecl ⏎ ⏎ cdecl might make nim put explicit `cdecl` in the `.c` file it generates which will make the C compiler *not* use its default calling convention.. ie `C` does not always use the `C` calling convention either - it depends, like @mratsim pointed out.. it's a bit of an unfortunate naming thing - `C` happened to be the one that |
15:33:52 | FromGitter | ... introduced the option, but it's not always used |
15:34:16 | FromGitter | <kaushalmodi> @mratsim .link did not work .. note that I had the old .dynlib as well to import the fn symbol |
15:34:57 | FromGitter | <kaushalmodi> by "did not work", it still crashes with SIGSEGV |
15:35:47 | FromGitter | <mratsim> If you don't put cdecl you will probably have nimcall/fastcall, though I'm not sure with importc functions |
15:38:11 | disruptek | kaushalmodi must have one of the trickiest application builds in the nimiverse. |
15:38:39 | FromGitter | <kaushalmodi> disruptek: I bet! |
15:38:56 | disruptek | have you written it up anywhere other than your slides? |
15:38:58 | FromGitter | <kaushalmodi> I'm trying to use Nim in "non-software" land |
15:39:00 | FromGitter | <mratsim> wait for the hot-code reloaded version :p |
15:39:26 | Araq | just fyi Nim only uses fastcall on win32 |
15:39:35 | shashlick | @arnetheduck - so basically i need importc there and that should be good enough |
15:39:38 | FromGitter | <kaushalmodi> disruptek: apart from the slides, the only written form is the actual code |
15:39:38 | Araq | iirc |
15:40:10 | disruptek | i think i read env in nimvm, so why can't you use $USER? |
15:40:14 | Araq | but we'll exploit nimcall further and make it __vectorcall or whatever it's called |
15:40:16 | FromGitter | <kaushalmodi> disruptek: https://github.com/kaushalmodi/nim-systemverilog-dpic <-- but it's not much useful unless you have a systemverilog compiler |
15:40:31 | FromGitter | <mratsim> win32 as in windows (including 64-bit)? |
15:40:46 | FromGitter | <kaushalmodi> disruptek: $USER comes later, so far even the hardcoded path in .link did not work for me |
15:40:53 | disruptek | yeah, i'm just thinking there have to be some magical bits to your flow that someone else is gonna need someday. |
15:42:04 | FromGitter | <kaushalmodi> disruptek: occassionally I need `--gc:none` otherwise Nim tries to garbage collect objects used by the systemverilog compiler |
15:42:12 | shashlick | @arnetheduck is the {.header.} pragma required or when is it optional? |
15:42:13 | FromGitter | <kaushalmodi> but I cannot predict when I would need that |
15:42:46 | disruptek | wow, that seems solvable. |
15:42:57 | disruptek | ie. defective. :-P |
15:43:52 | FromGitter | <jrfondren> @kaushalmodi https://nim-lang.org/docs/gc.html it *should* be predictable. you can avoid the GC with allocations that only systemverilog will know about for times |
15:44:04 | FromGitter | <arnetheduck> shashlick, I have two conflicting opinions about `{.header.}` - on the one hand, since you're parsing the C header file, you should have enough information to make a loss-free conversion from nim to c, and thus, the `{.header.}` is not needed. but on the other hand, nim doesn't support all the features of C (and vendor extensions), so there is potentially some information in the header file that you can't translate |
15:44:04 | FromGitter | ... to `nim`, and therefore, using the header file has advantages |
15:45:48 | shashlick | okay so i'm trying to figure out whether everything should have an importc or not - surely needed if names are changed |
15:45:49 | Araq | mratsim: win32 is windows 32 bits, not win64 |
15:46:07 | FromGitter | <mratsim> mingw somehow disagrees |
15:46:57 | FromGitter | <mratsim> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5cd1a870b489bb6ed7301c3b] |
15:47:15 | shashlick | @arnetheduck - okay, i'll make a branch and make the name importc fix and the nimcall removal - please test it and let me know if it is good |
15:47:37 | FromGitter | <iffy> What's the right way to implement proc `==` for an object? This is endlessly recursive: `a.kind == b.kind and a == b` |
15:48:16 | FromGitter | <jrfondren> compare each field |
15:48:38 | FromGitter | <iffy> right; is there an easy one line way to do that? |
15:48:41 | FromGitter | <mratsim> it's already done for object |
15:48:42 | FromGitter | <jrfondren> https://github.com/jrfondren/modsec/blob/master/src/modsec/actions.nim#L71 |
15:48:51 | FromGitter | <jrfondren> there's an easy way to do that if you don't use variants |
15:49:06 | FromGitter | <jrfondren> the easy way if you don't use variants is to not definite `==` at all |
15:49:07 | FromGitter | <kaushalmodi> @iffy I don't have the full context of your question, but would .fieldPairs work? |
15:49:13 | FromGitter | <mratsim> ah variants |
15:49:31 | FromGitter | <iffy> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5cd1a90ba4ef09747165dc72] |
15:49:41 | FromGitter | <iffy> bah, markdown |
15:50:17 | FromGitter | <mratsim> there is a bug on them iirc, but if you want an easy way equalMem(a.unsafeAddr, b.unsafeAddr, sizeof(a)) |
15:50:17 | shashlick | field names don't really need importc right? |
15:50:19 | FromGitter | <iffy> I'd like to not have to remember to update `==` when I add fields to my `Field` |
15:50:36 | FromGitter | <jrfondren> yeah that's variants so my link basically, with more than a single field tested for Amount |
15:50:44 | FromGitter | <iffy> rats |
15:51:03 | FromGitter | <iffy> but maybe `fieldPairs` will work, like @kaushalmodi said |
15:51:21 | FromGitter | <mratsim> equalMem wil work |
15:51:49 | FromGitter | <mratsim> or maybe not if some garbage is left |
15:51:53 | FromGitter | <mratsim> in raw memory |
15:52:05 | FromGitter | <iffy> let me try `fieldPairs` |
15:52:11 | FromGitter | <jrfondren> is equalMem OK with the strings? You can have two different pointers with the same contents |
15:52:31 | Araq | mratsim: on x86_64 __fastcall is identical to __cdecl. I think (?) |
15:52:34 | FromGitter | <arnetheduck> > okay so i'm trying to figure out whether everything should have an importc or not - surely needed if names are changed ⏎ ⏎ probably needed always when interfacing with c, to disable nim symbol mangling.. else stuff like debug information and the like will be weird (for example the name of a type doesn't matter at all in c - if two structs have the same shape you can use one instead of the other as long as |
15:52:34 | FromGitter | ... their ABI's match) |
15:53:27 | FromGitter | <arnetheduck> calling conventions, like alignments, vary and differ depending on many variables: compiler, platform, compiler flags, etc |
15:53:52 | FromGitter | <mratsim> @jrfondren right equalMem won't work with strings and seq |
15:54:39 | FromGitter | <arnetheduck> > there is a bug on them iirc, but if you want an easy way equalMem(a.unsafeAddr, b.unsafeAddr, sizeof(a)) ⏎ ⏎ this will also fail if the struct members have padding and the padding is different |
15:54:49 | FromGitter | <kaushalmodi> @iffy I learned about fieldPairs as I was coming up with a way to "pretty-print" objects: http://ix.io/1Ijs |
15:55:02 | FromGitter | <jrfondren> the `==` you have to manually write for variants is regular enough that Nim should be able to do it for you, so I feel like the low-effort path is to do it manually. |
15:55:10 | FromGitter | <mratsim> apparently patty as a way: https://github.com/nim-lang/Nim/issues/6674 |
15:55:14 | FromGitter | <mratsim> has* |
15:55:19 | shashlick | @arnetheduck - do struct fields need importc? and does it matter if they are renamed? |
15:55:22 | FromGitter | <iffy> @jrfondren but I'm forgetful :) |
15:56:39 | FromGitter | <mratsim> but that's the main issue with variants (also known as the expression problem). It's easy to add new proc but hard to add kinds because you need to update all existing proc. While with inheritance, it's easy to add new types but adding new proc will require you to also implement them in all types that implement the interface. |
15:57:25 | * | banc quit (Ping timeout: 246 seconds) |
15:57:28 | FromGitter | <iffy> I'm trying to use the `fieldPairs` that accepts two args: https://nim-lang.org/docs/system.html#fieldPairs.i%2CS%2CT but I'm getting `Error: wrong number of variables` |
15:57:51 | FromGitter | <jrfondren> that's the main benefit to them :) if you add new types you get a bunch of errors instead of weird behavior |
15:57:57 | FromGitter | <iffy> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5cd1ab05e416b8451947a711] |
15:58:14 | * | rnrwashere quit (Remote host closed the connection) |
15:58:16 | FromGitter | <kaushalmodi> do `for x, y ..` |
15:58:28 | FromGitter | <iffy> same error |
15:58:30 | FromGitter | <kaushalmodi> fieldPairs returns a tuple of key and val |
15:58:33 | FromGitter | <kaushalmodi> hmm |
15:58:42 | FromGitter | <mratsim> the fieldPairs you are linking to is for 2 tuples |
15:59:08 | FromGitter | <iffy> isn't it `tuple | object` ? |
15:59:27 | FromGitter | <mratsim> this one is for single param |
15:59:30 | FromGitter | <kaushalmodi> it should be `obj.fieldPairs()` |
15:59:41 | FromGitter | <kaushalmodi> where obj is an *object* |
15:59:49 | FromGitter | <mratsim> there are 2 fieldPairs overload, one for a single object and one for 2 tuples |
16:00:12 | FromGitter | <iffy> hmmm... I'm seeing both as for `tuple | object` |
16:00:18 | FromGitter | <jrfondren> the for 2 tuples says object | tuple. maybe that's devel docs not matching with release. |
16:01:02 | FromGitter | <jrfondren> ...no, it's like that in 0.19.4 as well |
16:01:34 | FromGitter | <iffy> maybe the magic implementation doesn't actually support it? |
16:02:59 | FromGitter | <mratsim> oh right |
16:03:11 | FromGitter | <mratsim> ugh it's very hard to read |
16:03:19 | FromGitter | <iffy> well, if I use the single object one, how to I get the field from obj b? |
16:03:22 | FromGitter | <iffy> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5cd1ac4a6a84d76ed85f63de] |
16:03:26 | FromGitter | <arnetheduck> > do struct fields need importc? and does it matter if they are renamed? ⏎ ⏎ not sure actually. generally, `importc` is only "required" for function names - the rest is mostly "quality-of-conversion" kind of stuff that makes the experience "better" |
16:03:27 | * | banc joined #nim |
16:03:40 | FromGitter | <iffy> [] (obviously) doesn't work, but is there an equivalent? |
16:03:51 | FromGitter | <iffy> like getattr? |
16:04:22 | FromGitter | <liquid600pgm> @mratsim faced a similar problem recently iirc |
16:04:23 | FromGitter | <mratsim> template identifier injection |
16:04:53 | FromGitter | <mratsim> but you have to know or compute the field at compile time |
16:06:39 | FromGitter | <iffy> that's the backtick stuff? |
16:10:02 | FromGitter | <arnetheduck> shashlick, do you need an issue opened for the typedef stuff? I'd consider it a blocker almost, considering how prevalent the pattern is in C |
16:10:19 | FromGitter | <mratsim> @iffy yes |
16:11:09 | FromGitter | <mratsim> template getAttr(o: myObj, field: untyped): untyped = o.\`field\`{.inject.} |
16:16:03 | * | krux02 quit (Remote host closed the connection) |
16:17:10 | FromGitter | <kaushalmodi> krux02, @mratsim : I figured out the nil pointer cause and I am at a loss why that is that |
16:17:14 | FromGitter | <kaushalmodi> drumroll .. |
16:17:51 | FromGitter | <kaushalmodi> I have 2 separate Nim projects .. one that wraps different things; both are compiled to separate .so and both are referenced in the xmsim compiler |
16:18:22 | FromGitter | <kaushalmodi> If I remove the reference to the earlier added .so, the current one that I am using (c++ -> nim -> sv) works great! |
16:18:39 | shashlick | @arnetheduck - i almst have a branch ready |
16:18:43 | shashlick | could do with some testing |
16:18:50 | FromGitter | <kaushalmodi> so .. I cannot have 2 (or more) Nim compiled .so live at the same time? |
16:19:48 | FromGitter | <arnetheduck> shashlick - cool - `update.sh` in that repo will fetch latest nimterop and run it on `sqlite.h`, dead simple to test |
16:20:44 | leorize[m] | @kaushalmodi: I think it's generally safe unless you passes ref between then |
16:20:48 | leorize[m] | them* |
16:20:57 | FromGitter | <arnetheduck> for the calling conventions (cdecl vs the rest), the thing about getting them wrong is that your program will crash or misbehave randomly.. I don't remember all the details, it takes some digging if you want to get it right in all (corner) cases) |
16:21:05 | FromGitter | <kaushalmodi> flow for compiling so number 1: Matlab -> C -> .so -> Nim wrapper around that -> 1.so ⏎ flow for compiling so number 2: C++ -> .so -> Nim wrapper around that -> 2.so ⏎ xmsim (systemverilog compiler) reads both 1.so and 2.so |
16:21:41 | FromGitter | <kaushalmodi> If I compile both 1.so and 2.so, I get 0x0000000 (??) SIGSEGV fault |
16:21:52 | FromGitter | <kaushalmodi> If I remove 1.so from compilation, no fault |
16:22:20 | leorize[m] | try using --newruntime on them :p |
16:23:22 | FromGitter | <kaushalmodi> ok .. trying that |
16:23:38 | FromGitter | <kaushalmodi> just wondering if this is a limitation where 2.so treads on 1.so namespace |
16:23:43 | leorize[m] | jk, try eliminating the GC from the .so with --gc:none |
16:23:52 | shashlick | @arnetheduck - do you have a test to check the generated wrapper? |
16:24:02 | leorize[m] | --newruntime is the better solution when it starts working well |
16:24:42 | FromGitter | <jrfondren> @kaushalmodi that might be the problem. look at their symbols with nm |
16:25:08 | leorize[m] | @kaushalmodi: it's certainly possible, I've been bitten by how the init proc in Nim .so is always NimMain (and you can't change that) |
16:25:57 | FromGitter | <dawkot> What can possibly be the cause of me gettings a `The filename, directory name, or volume label syntax is incorrect` on Windows error when trying to compile a file *at random*? |
16:26:14 | * | couven92 quit (Quit: Client disconnecting) |
16:26:39 | FromGitter | <dawkot> The compiler doesn't say much else, just that the unhandled exception is raised in oserr.nim(85) |
16:27:01 | FromGitter | <jrfondren> @kaushalmodi I think your best option will be to have a single Nim .so |
16:27:16 | leorize[m] | try chkdsk? |
16:27:41 | leorize[m] | oh, then that might just be the folder you're pointing the compiler to doesn't exists |
16:27:56 | FromGitter | <kaushalmodi> @jrfondren both have `NimMain` |
16:28:09 | FromGitter | <kaushalmodi> both have `_fini` and `_init` too |
16:28:17 | FromGitter | <arnetheduck> shashlick not really - would probably make sense to add to wrap.nim though at some point, just like it checks that the version number can be called |
16:28:18 | FromGitter | <kaushalmodi> now what? :/ |
16:28:23 | FromGitter | <dawkot> But, as I said, it seems to be random |
16:28:45 | FromGitter | <dawkot> Other than that the error comes up once, it usually persists for some time |
16:28:50 | FromGitter | <dawkot> *when |
16:28:57 | FromGitter | <kaushalmodi> leorize: I have `--gc:none` in both Nim projects .. didn't help |
16:29:27 | FromGitter | <kaushalmodi> Araq: any tips to make this work? https://gitter.im/nim-lang/Nim?at=5cd1b0702e2caa1aa624b3a7 |
16:29:31 | leorize[m] | @kaushalmodi: NimMain can be a problem |
16:29:33 | leorize[m] | the _fini and _init are harmless |
16:29:51 | FromGitter | <kaushalmodi> backup plan: move all code to one Nim project .. but that will make things less portable |
16:29:51 | * | rnrwashere joined #nim |
16:30:54 | * | banc quit (Ping timeout: 246 seconds) |
16:31:26 | leorize[m] | can you look at the full backtrace? |
16:32:05 | FromGitter | <kaushalmodi> this is the full backtrace: https://gitter.im/nim-lang/Nim?at=5cd1785d5b3f941aa5f84e97 |
16:32:22 | FromGitter | <kaushalmodi> the simulation dies as soon as Nim calls the fn from C++ compiled .so |
16:32:25 | leorize[m] | I suspect a recursion of NimMain bouncing between two .so files (got bitten by this on Haiku) |
16:32:52 | FromGitter | <kaushalmodi> ok.. let me experiment moving everything into one .so |
16:32:59 | leorize[m] | stupid matrix lag, well looks not the case |
16:33:31 | * | traviss quit (Quit: Leaving) |
16:34:12 | FromGitter | <iffy> a compile-time `fieldNames` thing would be really handy |
16:34:13 | FromGitter | <kaushalmodi> hmm, there's a `--noMain:on` .. wondering what that does |
16:34:41 | * | leorize joined #nim |
16:35:10 | leorize | it only affects the `main()` proc for nim program |
16:35:25 | leorize | NimMain is hard-coded in the compiler |
16:36:01 | leorize | @iffy: wouldn't that already possible with macros.getType()? |
16:36:52 | FromGitter | <iffy> oooo, maybe yes |
16:37:29 | leorize | nowadays I think those iterators should be made into ForStmtMacros |
16:39:27 | * | Jesin quit (Quit: Leaving) |
16:40:54 | * | banc joined #nim |
16:41:12 | shashlick | @arnetheduck - nimcall needs to stay for fields or they become closures by default |
16:41:49 | Araq | shashlick, no, .cdecl also is not .closure |
16:42:11 | shashlick | so should i make anything that's imported into cdecl by default or should i use nimcal |
16:42:28 | shashlick | importc'd |
16:42:36 | leorize | it depends on the underlying os i believe |
16:42:45 | leorize | iirc windows uses stdcall |
16:43:11 | leorize | or fastcall |
16:43:44 | Araq | https://www.python.org/dev/peps/pep-0590/ |
16:43:56 | Araq | shashlick, .cdecl is the best default |
16:43:56 | FromGitter | <arnetheduck> http://llvm.org/docs/LangRef.html#calling-conventions |
16:45:33 | * | Jesin joined #nim |
16:49:18 | FromGitter | <kaushalmodi> shoot .. one Nim project needs to compile to cpp and another to c |
16:49:23 | FromGitter | <kaushalmodi> so I cannot merge both |
16:50:09 | FromGitter | <kaushalmodi> because one Nim project is importing a C compiled .so and another, a C++ compiled .so |
16:50:17 | shashlick | @arnetheduck - i've created a branch with these changes - please test and confirm i've gotten this right |
16:50:18 | FromGitter | <kaushalmodi> Araq: any help with this? |
16:50:18 | shashlick | https://github.com/nimterop/nimterop/tree/pragma |
16:51:12 | leorize | @kaushalmodi: then compile both as c++? :P |
16:51:25 | FromGitter | <kaushalmodi> that would work? (I haven't tried) |
16:51:35 | FromGitter | <kaushalmodi> but given that I don't see any option .. will give that a go |
16:51:55 | Araq | kaushalmodi: use --cppCompileToNamespace:namespace and compile both as C++ |
16:52:07 | Araq | use two different namespaces |
16:52:19 | Araq | to make two different NimMain |
16:52:21 | cy1 | aww, you can't make recursive iterators? |
16:52:32 | FromGitter | <kaushalmodi> Araq: will try that. Thanks! |
16:53:01 | FromGitter | <kaushalmodi> I hope you got a gist of my flow: https://gitter.im/nim-lang/Nim?at=5cd1b0702e2caa1aa624b3a7 |
16:54:06 | * | neceve quit (Remote host closed the connection) |
16:55:24 | * | rnrwashere quit (Remote host closed the connection) |
16:57:21 | cy1 | You can make closure iterators inside recursive procedures though, hmm... |
16:58:05 | leorize | cy1: can't you just use an another `for` statement to call your current iterator? |
17:01:30 | cy1 | leorize: If you call your current iterator inside your current iterator, it says Error: recursive dependency: |
17:02:30 | leorize | ah, yea, Nim's iterator are inlined |
17:04:34 | cy1 | leorize: not that inline iterators couldn't be recursive... but even if you specify {.closure.} it still errors out. You have to have a procedure wrapping around a closure iterator to get recursion, then add on an extra () like: for X in walk(arg1, arg2)(): |
17:05:25 | cy1 | and... uh... |
17:05:27 | cy1 | Error: cannot generate VM code for breakstate |
17:05:36 | cy1 | can iterators not be used in macros...? |
17:05:42 | leorize | why would you want recursive iterator though? |
17:05:55 | FromGitter | <jrfondren> macros can generate code that uses iterators |
17:05:59 | FromGitter | <kaushalmodi> Araq: with the cppcompiletonamespace, I get: ⏎ ⏎ ```.nimcache/stdlib_os.cpp:31:1: error: ‘NI’ does not name a type ⏎ NI len; ⏎ ^~``` [https://gitter.im/nim-lang/Nim?at=5cd1baf76a84d76ed85fcf76] |
17:06:37 | FromGitter | <kaushalmodi> and the same error for NIM_CHAR, NCSTRING, etc in stdlib_os.cpp |
17:06:57 | * | rnrwashere joined #nim |
17:07:32 | leorize | sounds like a bug |
17:07:43 | leorize | maybe you should try to make a small sample and report it? |
17:08:37 | leorize | cy1: iterators can be used in macros |
17:11:32 | * | rnrwashere quit (Ping timeout: 252 seconds) |
17:13:47 | FromGitter | <kaushalmodi> issue related to cppcompiletonamespaec: https://github.com/nim-lang/Nim/issues/11194 |
17:21:04 | cy1 | leorize: You need a recursive iterator to walk an arbitrary tree structure, or flatten it. |
17:21:11 | * | Vladar quit (Remote host closed the connection) |
17:21:30 | cy1 | Error: no tuple type for constructor |
17:21:52 | cy1 | You... can't use tuples as default values? |
17:23:35 | leorize | cy1: maybe you can look at the walkDirRec iterator? |
17:25:38 | cy1 | leorize: I just switched to accumulating sequences. It shouldn't eat too much memory. |
17:28:53 | leorize | yea, and your iterator will also be stack overflow tolerant |
17:29:30 | leorize | Nim doesn't do tail opt at codegen level iirc |
17:29:44 | * | tribly quit (Quit: WeeChat 2.4) |
17:30:45 | * | tribly joined #nim |
17:33:43 | * | jjido joined #nim |
17:35:15 | * | salewski joined #nim |
17:37:00 | salewski | var x: float; x = math.sqrt(-1.0) # is this the best way to mark x as invalid? |
17:37:36 | salewski | That is to set it to NAN. |
17:45:15 | leorize[m] | isn't there a NaN const in math or fenv already? |
17:46:44 | salewski | Have not seen a const in math, will see fenv... |
17:49:30 | salewski | No, there is stuff to test for results like INF and NAN, but not for setting it. |
17:50:28 | salewski | I am doing test of two lines for intersection, position can be INF |
17:50:33 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
17:50:40 | leorize | salewski: system.NaN :) |
17:51:27 | salewski | That exists? Have searched for NAN with no result. Thanks. |
17:51:44 | leorize | I just typed NaN on the search box :p |
17:52:42 | salewski | Indeed, now I get it. Strange that I did not found it. |
17:53:02 | salewski | Bye. |
17:53:06 | * | salewski quit (Quit: WeeChat 2.3) |
18:08:33 | FromGitter | <iffy> okay @leorize, @mratsim and @jrfondren, here's a template that generates a `==` proc for variant objects. It probably only works for my case :) https://gist.github.com/iffy/092f5b46760d9b4ba62a649afaa69f56 |
18:08:45 | FromGitter | <iffy> (scroll down to see usage) |
18:10:12 | * | theelous3 joined #nim |
18:11:41 | FromDiscord_ | <Avatarfighter> Does anyone know if there is a package that allows you to draw on a canvas sort of like how tkinter canvas works, I've been looking for one for a bit :L |
18:14:18 | FromDiscord_ | <Avatarfighter> Does anyone know if there is a package that allows you to draw on a canvas sort of like how tkinter canvas works, I've been looking for one for a bit but can't seem to find one :L |
18:14:45 | * | jjido joined #nim |
18:23:02 | FromGitter | <mratsim> compileToNamespace? Is that documented, I was always wondering how to combine Nim dlls without NimMain conflicts |
18:23:34 | FromGitter | <mratsim> I hope ownership + destructor will allow one to completely remove NimMain as well when possible |
18:27:02 | shashlick | @mratsim I've had no problems with dlls in feud |
18:27:12 | shashlick | But I am using dynlib to load them |
18:31:20 | Araq | mratsim: NimMain remains but we could make it NimMain_project to prevent clashes |
18:31:45 | Araq | but then every other system.nim identifier also needs to get some prefix and we might as well use C++ namespaces instead |
18:36:41 | FromGitter | <kaushalmodi> @leorize: finally got it working! I have to limit to just one Nim project to avoid that SIGSEGV |
18:36:56 | FromGitter | <kaushalmodi> But it works! |
18:37:31 | FromGitter | <kaushalmodi> The wrapper Nim file is just 1 line: `import foo, bar` |
18:39:24 | * | SenasOzys joined #nim |
18:40:49 | * | rnrwashere joined #nim |
18:44:54 | clyybber | bb |
18:44:59 | * | clyybber quit (Quit: WeeChat 2.4) |
18:45:03 | * | rnrwashere quit (Ping timeout: 245 seconds) |
18:57:48 | * | deech joined #nim |
19:02:39 | * | tribly quit (Quit: WeeChat 2.4) |
19:03:38 | * | tribly joined #nim |
19:10:07 | * | rnrwashere joined #nim |
19:16:42 | * | rnrwashere quit (Remote host closed the connection) |
19:17:50 | * | rnrwashere joined #nim |
19:18:28 | noonien | `Error: parallel 'fields' iterator does not work for 'case' objects`, i'm getting the following error |
19:18:40 | noonien | what's a parallel iterator? |
19:20:18 | noonien | hmm, this seems to happen when i try to `==` two case objects |
19:20:38 | noonien | as part of an unit test |
19:21:31 | FromGitter | <jrfondren> that's described above |
19:21:38 | FromGitter | <jrfondren> there's no default == for variant objects |
19:21:54 | narimiran | btw, krux02 is working on those |
19:22:24 | noonien | fieldPairs seems to work |
19:22:52 | noonien | why would fields not work? |
19:23:23 | FromGitter | <jrfondren> semForObjectFields just explicitly fails on variant objects. |
19:26:29 | * | SenasOzys quit (Remote host closed the connection) |
19:32:20 | FromGitter | <iffy> noonien: I just barely made a `==` proc maker for variant objects if you want to use it: https://gist.github.com/iffy/092f5b46760d9b4ba62a649afaa69f56 |
19:42:50 | FromDiscord_ | <nothing to no one> I have this type: `HttpCode* = distinct range[0 .. 599]` and I would like to print it to stdout. It doesn't have a `$` proc defined for it though. How do I convert the range to a string? |
19:44:28 | FromDiscord_ | <nothing to no one> oh, i might be dumb |
19:44:56 | FromDiscord_ | <nothing to no one> yup, i was just dumb, was trying to print out the actual type instead of the variable lmao |
19:47:00 | * | narimiran quit (Ping timeout: 252 seconds) |
19:52:49 | noonien | given `type Foo = int | uint`, how can i get a list of the typesnames, in this case, int and uint? |
20:00:01 | cy1 | Well that... could be useful I guess |
20:00:27 | cy1 | https://github.com/cyisfor/unquote.nim/blob/master/tests/test_examples.nim |
20:00:53 | cy1 | Takes some code, and finds spots to inject your stuff into it... no homo |
20:03:20 | FromGitter | <Vindaar> @noonien: will probably break for more complicated things, but you can do something like this: http://ix.io/1Il8/nim |
20:04:28 | * | Trustable quit (Remote host closed the connection) |
20:04:44 | noonien | woah, awesome! thanks, that was just what i was looking for! |
20:08:11 | FromGitter | <Vindaar> :) |
20:11:53 | * | Perkol joined #nim |
20:22:46 | cy1 | How would you get nimble to use a package in a subdirectory, as opposed to one uploaded to the package repository? |
20:23:15 | * | SenasOzys joined #nim |
20:23:52 | shashlick | you can just cd to that directory and nimble install |
20:23:58 | shashlick | assuming it has a nimble file |
20:36:58 | * | xet7 quit (Quit: Leaving) |
20:41:50 | noonien | macros are ran before instantiation, right? |
20:42:04 | noonien | before instantiation of generic procs* |
21:00:24 | * | SenasOzys quit (Ping timeout: 246 seconds) |
21:02:06 | * | rnrwashere quit (Remote host closed the connection) |
21:08:29 | * | tribly quit (Quit: WeeChat 2.4) |
21:09:12 | * | tribly joined #nim |
21:15:47 | * | Hexeratops joined #nim |
21:23:09 | * | [rg] joined #nim |
21:26:22 | * | solitudesf quit (Ping timeout: 252 seconds) |
21:30:20 | dom96 | narimiran[m], Araq: why do the docs in https://nim-lang.org/documentation.html lead to the bleeding edge docs? |
21:30:37 | * | deech quit (Ping timeout: 246 seconds) |
21:34:54 | * | tribly quit (Quit: WeeChat 2.4) |
21:35:29 | * | tribly joined #nim |
21:37:06 | * | cybj quit (Quit: WeeChat 2.4) |
21:48:13 | * | cybj joined #nim |
21:53:00 | shashlick | @arnetheduck - i've done quite a bit of cleanup of the pragmas, appreciate a review before i push to master |
21:56:18 | dom96 | yay, Firefox finally fixed the bug that meant I couldn't see who liked my posts on the forum |
21:56:24 | dom96 | Glad I didn't have to do anything myself to fix that |
22:02:24 | dom96 | The amount of inaccuracies in Nim's WP article |
22:02:29 | * | dom96 shakes head |
22:04:09 | dom96 | oh nice to see my name in there now |
22:04:33 | * | Perkol quit (Remote host closed the connection) |
22:06:14 | dom96 | "Nimble package manager was inspired by the success of Perl's package manager" lolwat |
22:07:15 | * | cyberjpn joined #nim |
22:07:22 | FromGitter | <jrfondren> post hoc ergo inspired hoc |
22:10:01 | * | lritter quit (Quit: Leaving) |
22:10:24 | * | rnrwashere joined #nim |
22:10:40 | * | rnrwashere quit (Remote host closed the connection) |
22:10:53 | * | rnrwashere joined #nim |
22:17:15 | dom96 | Our wikipedia page could really use some love |
22:17:28 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
22:22:42 | FromDiscord_ | <exelotl> wow I can't believe nim was created by hatsune miku |
22:24:05 | * | [rg] quit (Read error: Connection reset by peer) |
22:24:44 | FromGitter | <mratsim> Well on Wikipedia at one moment Nemerle language creator was Araq |
22:31:33 | * | [rg] joined #nim |
22:40:41 | * | jjido joined #nim |
22:44:51 | * | Hexeratops quit (Remote host closed the connection) |
22:45:25 | * | jjido quit (Client Quit) |
22:49:30 | FromGitter | <mratsim> Rust finally impolemented static but they also have the type vs value problem: https://github.com/rust-lang/rust/issues/44580#issuecomment-489207594 |
22:50:34 | * | [rg] quit (Quit: Konversation terminated!) |
22:51:31 | FromGitter | <arnetheduck> lol nice to see, they'll finally be able to get rid of those ugly array kludges |
22:52:21 | FromGitter | <mratsim> or not: https://github.com/rust-lang/rust/pull/60466#issuecomment-490228264 |
22:53:57 | dom96 | ugh, I think we should make it an error to export a `proc foo(x: MyType)` if `MyType` isn't exported |
22:54:22 | FromGitter | <mratsim> we can still use it with MyType as a binary blob |
22:54:30 | FromGitter | <mratsim> opaque type* |
22:54:53 | dom96 | Why would you though? |
22:55:56 | dom96 | so I wonder if you guys solved this in Chronos: callbacks waiting forever on a socket becoming readable/writeable, even if that socket is closed |
22:56:14 | FromGitter | <jrfondren> it could be annoying for the user, but it can still work. you can still consumeMyType(generateMyType()) |
22:57:45 | dom96 | I was going to change the type of `asyncdispatch.Callback` to `proc (fd: AsyncFD, isClosing: bool): bool` |
22:58:00 | dom96 | But it's used by exported procs of course... |
22:58:35 | FromGitter | <arnetheduck> shashlick, I'll take a look in a bit, busy now |
22:59:09 | FromGitter | <mratsim> It common in C library to use opaque types for library to avoid users using structs/pointer in a non-blessed way |
22:59:21 | FromGitter | <arnetheduck> dom96 I remember some discussion about a bug like that in chronos but I don't remember the details |
22:59:29 | FromGitter | <arnetheduck> @cheatfate might know better |
22:59:59 | FromGitter | <jrfondren> @mratsim the Nim equivalent there would be exporting the type but not its members |
23:00:02 | FromGitter | <mratsim> unfortunately in Nim it's almost impossible to have things private, just due to the fact that you have to have a "datatypes.nim" that export everything due to the forward declaration requirement |
23:00:30 | dom96 | FYI I implemented https://github.com/status-im/nim-chronos/issues/32 |
23:05:46 | FromGitter | <arnetheduck> oh, nice. we'll likely create a monitoring package as well, though I'm a bit sceptical about prometheus.. might be that we'll do a multi-backend thing so it can interface with eith prom or statsd.. |
23:06:00 | noonien | what's OverflowError? |
23:06:19 | * | [rg] joined #nim |
23:06:22 | FromGitter | <mratsim> when a signed int overflows or underflow |
23:06:40 | noonien | hmm, it was not in the manual, but in `system`, awesome |
23:07:16 | FromGitter | <mratsim> echo high(int) + 1 will overflow |
23:07:17 | noonien | i'm getting an OverflowError in an async function, and for some reason i don't get the stacktrace of where it occurs |
23:07:28 | FromGitter | <mratsim> and not low(int) will underflo |
23:08:31 | FromGitter | <arnetheduck> it goes away if you compile in release mode :) |
23:08:55 | FromGitter | <mratsim> ... :p |
23:08:59 | noonien | hehe, sure, i'm doing some really weird math and i'm expecting over/underflows |
23:09:12 | FromGitter | <mratsim> you're doing async math? |
23:09:26 | noonien | however, since i get the error, i'd like to check if they're in an expected place |
23:09:32 | noonien | perhaps i really do have a bug |
23:10:13 | noonien | mratsim, hehe, i'm doing math in procs that happen to be async, does that count? |
23:10:17 | FromGitter | <mratsim> The stackTrace sometimes get eaten, I never investigated why but this is annoying, some proc names not appearing for example |
23:11:17 | * | jasper joined #nim |
23:11:44 | noonien | argh, this is annoying |
23:12:12 | noonien | well, here goes try: catch: bisection |
23:16:01 | * | rnrwashere quit (Remote host closed the connection) |
23:23:34 | * | rnrwashere joined #nim |
23:27:08 | * | theelous3 quit (Ping timeout: 268 seconds) |
23:27:55 | * | rnrwashere quit (Ping timeout: 248 seconds) |
23:28:38 | * | theelous3 joined #nim |
23:32:42 | noonien | it was indeed an error |
23:35:46 | noonien | this was the culprit: `arr[0..<0'u32]` |
23:36:33 | noonien | weird that the stacktrace did not show it |
23:37:00 | noonien | perhaps it just did, and it was somewhere in system, and i did not check |
23:37:08 | * | rnrwashere joined #nim |
23:41:57 | * | rnrwashere quit (Remote host closed the connection) |
23:43:52 | * | rnrwashere joined #nim |
23:47:36 | FromGitter | <jrfondren> what was the stracktrace? |
23:51:57 | * | cyberjpn quit (Ping timeout: 258 seconds) |
23:57:21 | * | rnrwashere quit (Remote host closed the connection) |
23:58:41 | * | [rg] quit (Quit: Konversation terminated!) |