00:14:29 | * | oddp_ quit (Ping timeout: 265 seconds) |
00:19:40 | * | Cthalupa quit (Ping timeout: 246 seconds) |
00:25:30 | * | Cthalupa joined #nim |
00:36:04 | FromGitter | <deech> Is there `importc`/`importcpp` syntax that splices in the proc name as well? eg. `proc cppFunction(a:cint,b:cint):cint {.importc: "Namespace::<sub-in-cppFunction>(@)".}`? |
00:37:56 | FromGitter | <deech> I can write a macro to support this but just wanted to make sure I wasn't missing something. |
00:43:48 | FromDiscord | <impbox> deech does $1 work? |
00:44:15 | FromDiscord | <impbox> it's not clear from the docs but `$1` seems to be the proc name in importc, maybe also for importcpp? |
00:45:48 | FromDiscord | <Yardanico> oh found an interesting arc codegen bug |
00:47:21 | FromDiscord | <Yardanico> I'm not even sure how this is valid Nim, but |
00:47:29 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2rEV |
00:48:02 | FromGitter | <deech> impbox: oh hoh ... that's interesting. |
00:51:54 | * | NimBot joined #nim |
00:59:40 | FromDiscord | <Rika> how is that valid nim what |
01:00:24 | leorize | it's valid enough :P |
01:01:12 | Prestige | Is that supposed to compile? |
01:01:38 | FromDiscord | <Yardanico> exactly |
01:01:41 | FromDiscord | <Yardanico> that's what I'm wondering |
01:01:47 | FromDiscord | <Yardanico> found it in Moe |
01:01:53 | FromDiscord | <Yardanico> https://github.com/nim-lang/Nim/issues/14985 |
01:01:55 | disbot | ➥ [ARC] proc with both explicit and implicit return results in a C compiler error ; snippet at 12https://play.nim-lang.org/#ix=2rEX |
01:09:15 | shashlick | @Yardanico - can you please use your arc chops to create a reduced version of the segfault with my plugins package? |
01:09:30 | FromDiscord | <Yardanico> I'll try 😛 |
01:09:40 | FromDiscord | <Yardanico> what branch? |
01:09:59 | shashlick | good you asked |
01:10:13 | shashlick | actually master should be fine |
01:10:15 | shashlick | uses channels now |
01:10:25 | FromDiscord | <Yardanico> ah okay I'll try |
01:10:31 | shashlick | peace |
01:12:44 | FromDiscord | <Yardanico> so the error you're getting is /home/dian/Projects/stuff/plugins/src/plugins/api.nim(150) onLoad ? |
01:12:55 | FromDiscord | <Yardanico> key not found: callCommand or something else? |
01:12:55 | shashlick | segfaults |
01:13:13 | FromDiscord | <Yardanico> well it segfaults after that, yes |
01:13:19 | FromDiscord | <Yardanico> but it says key not found: callCommand first for me |
01:13:26 | FromDiscord | <Yardanico> I'm compiling tests/tmain |
01:13:36 | shashlick | let me check again |
01:14:29 | shashlick | first off, just updating boehm to arc in the config.nims is not sufficient |
01:14:34 | shashlick | cause the plugins don't compile |
01:15:10 | FromDiscord | <Yardanico> yeah I changed arc there too |
01:15:16 | shashlick | https://github.com/nim-lang/Nim/issues/14813 had to be changed |
01:15:18 | disbot | ➥ Error compiling with gc:orc and a config.nims file: "system module needs: nimDestroyAndDispose" ; snippet at 12https://play.nim-lang.org/#ix=2rF1 |
01:15:27 | shashlick | have to add --gc:arc to plugin.nim |
01:15:27 | FromDiscord | <Yardanico> I'm passing it explicitly 😛 |
01:15:31 | FromDiscord | <Yardanico> yes |
01:15:35 | shashlick | peace |
01:15:35 | FromDiscord | <Yardanico> line 176 |
01:15:45 | FromDiscord | <Yardanico> so what's the error you're getting after that? |
01:16:18 | shashlick | I get the segfault straight, no callCommand issue |
01:16:52 | FromDiscord | <Yardanico> hrm |
01:16:56 | * | Shucks quit (Quit: Leaving) |
01:16:58 | FromDiscord | <Yardanico> I'm on the very latest devel |
01:17:13 | shashlick | let me update |
01:17:22 | FromDiscord | <Yardanico> Clyybber's PR was merged 13 hours ago |
01:17:34 | FromDiscord | <Yardanico> about some arc fixes |
01:17:44 | shashlick | okay rebuilding |
01:18:15 | FromDiscord | <Yardanico> ah wait actually |
01:18:20 | FromDiscord | <Yardanico> it was probably my fault, now I get a segfault too |
01:18:25 | FromDiscord | <Yardanico> after Plugin1: test2return right? |
01:18:30 | shashlick | yes |
01:18:34 | shashlick | no change |
01:18:38 | shashlick | after updating |
01:18:38 | FromDiscord | <Yardanico> yeah okay |
01:20:40 | FromDiscord | <Yardanico> if I compile with -d:useMalloc, I get "free(): invalid pointer" |
01:20:56 | FromDiscord | <Yardanico> I'll try to minimize |
01:21:08 | shashlick | thanks man |
01:21:12 | shashlick | if I can move to arc, will be awesome |
01:31:57 | * | chemist69 quit (Ping timeout: 260 seconds) |
01:33:59 | * | chemist69 joined #nim |
01:39:50 | FromDiscord | <Yardanico> @shashlick well it's certainly related to destructors, but I think it might not exactly be ARC's fault |
01:40:03 | FromDiscord | <Yardanico> you can get much further if you add GC_ref(cmd) as the last line in pluginLoad |
01:40:20 | FromDiscord | <Yardanico> in plg1.nim |
01:43:31 | FromDiscord | <Yardanico> I think if you're passing something to another library or to the host app you should GC_ref it because otherwise the refcount will be 0 and it will be destroyed |
01:43:36 | FromDiscord | <Yardanico> and in this case maybe something else happens: |
01:43:40 | FromDiscord | <Yardanico> (my speculation) |
01:43:48 | FromDiscord | <Yardanico> you pass cmd from the plugin to the host, and it gets destroyed there |
01:43:54 | FromDiscord | <Yardanico> but it also gets destroyed in the plugin itself |
01:43:59 | FromDiscord | <Yardanico> so we get a classical double free |
01:44:03 | FromDiscord | <Varriount> @reilly I'm here. If you want to control the mouse/keyboard, Nim can use Windows API. |
01:44:32 | shashlick | but its all happening in the same thread |
01:44:42 | FromDiscord | <Yardanico> well but it's different libraries |
01:44:46 | FromDiscord | <Yardanico> it's not about threads really |
01:44:47 | shashlick | and callCommand is in sequence - how is adding a line at the end helping |
01:45:03 | FromDiscord | <Yardanico> it's about destroy calls being injected by the compiler |
01:45:35 | FromDiscord | <Varriount> @reilly I was actually working to wrap the UI automation API, which allows for some more advanced automation constructs than what movemouse and sendkey do, but it's COM based, and I've gone down the rabbit hole of writing a tool to allow more easy generation of Nim wrappers for Windows APIs. |
01:48:59 | FromDiscord | <Yardanico> @shashlick onLoad for plg1 after ARC transformations looks like that: |
01:49:19 | FromDiscord | <Yardanico> https://gist.github.com/Yardanico/5cdd8f3965bc06a8584b0f8221737508 |
01:49:22 | FromDiscord | <Yardanico> with my added GC_ref() |
01:49:29 | FromDiscord | <Yardanico> you can see it destroying cmd |
01:49:45 | FromDiscord | <Yardanico> and now |
01:49:48 | FromDiscord | <Yardanico> for plg2test |
01:50:12 | FromDiscord | <Yardanico> ah, sorry, for callCommand |
01:50:55 | FromDiscord | <Yardanico> hm actually no, I need to find where it is getting destroyed |
01:50:57 | FromDiscord | <Varriount> sent a long message, see http://ix.io/2rF5 |
01:53:18 | FromDiscord | <reilly> That's exactly what I need, thank you very much! |
01:54:51 | FromDiscord | <Varriount> reilly: A big thing to keep in mind is that in Nim, an integer is the size of a pointer. In Windows, it is typically always 32-bit integer |
01:55:16 | FromDiscord | <Varriount> @reilly You might also look at https://github.com/khchen/winim |
01:55:29 | FromDiscord | <reilly> Already installed it 😉 |
01:55:31 | FromDiscord | <Varriount> It may or may not have those functions already wrapped. |
01:57:13 | shashlick | @Yardanico - so is it a bug with my program or arc |
01:57:18 | FromDiscord | <Yardanico> i don't know 😄 |
01:57:38 | FromDiscord | <Yardanico> but yeah, dealing with library boundaries isn't easy |
02:00:33 | FromDiscord | <Yardanico> we'll need to ask 4raq or Clyybber when they go online 😛 |
02:00:59 | shashlick | do you think a minimal example is possible? |
02:01:05 | FromDiscord | <Yardanico> well yeah I can make one |
02:01:15 | FromDiscord | <Yardanico> related to the first issue, not the current crash, I didn't solve it yet |
02:02:40 | FromGitter | <deech> Is it a bug that `expandMacros` doesn't show the `*` after the proc name? eg. `expandMacros newProc(name=nnkPostfix.newTree(ident("*"),ident("myProc")) ...)` prints as `proc myProc(...)` instead of `proc myProc*(...)`. |
02:10:08 | FromGitter | <iffy> @leorize: That's great! I didn't realize you could just change a file descriptor to an AsyncFD like that. I'll play with it and see how it works (because me code currently only includes `--threads:on` for my stdin reading and I'd love to get rid of it) |
02:11:33 | leorize | @iffy here's the only rule that you have to obey: never read from stdin using any stdlib functions |
02:12:21 | leorize | this is because they might buffer and eats up data before the callback can access it |
02:12:51 | leorize | you might be able to walkaround that by disabling the builtin buffers for stdin, but there aren't any cross platform methods afaik |
02:12:55 | FromGitter | <iffy> I do call `setStdIoUnbuffered()` before doing anything; does that mitigate what you're saying? |
02:13:02 | leorize | maybe |
02:13:06 | leorize | I haven't tried :P |
02:13:17 | FromGitter | <iffy> k, I'll test; thanks a bunch! |
02:13:55 | leorize | np, remember to test on windows |
02:14:43 | * | opal quit (Ping timeout: 240 seconds) |
02:16:17 | * | opal joined #nim |
02:16:19 | leorize | this code is not compatible with threading due to the potential of something slurping stdin before or in-between the check and the consumption site |
02:16:44 | leorize | so if you want to use threading then you should spin up a dedicated thread, but since you don't you should be fine :) |
02:17:23 | FromGitter | <ynfle> @Varriount, wanna take a look at my `SIGSEGV` error? |
02:17:48 | FromDiscord | <reilly> So, `GetAsyncKeyState()` basically returns an int16, and I need to check the most significant bit... How? I've never done anything bitwise before. |
02:17:51 | FromGitter | <ynfle> Only because you offered before. If you don't have a chance/don't want to, no worries |
02:19:53 | leorize | @reilly `int16 and 0x8000 != 0` |
02:20:35 | FromDiscord | <reilly> Thank you! |
02:21:43 | * | muffindrake quit (Ping timeout: 272 seconds) |
02:22:18 | FromDiscord | <reilly> Er, actually, that doesn't seem quite right as-is. What is `and` meant to do? |
02:23:05 | leorize[m] | 0x8000 is a 16bit value with the most significant bit set (I might be wrong) |
02:23:19 | * | muffindrake joined #nim |
02:23:48 | leorize[m] | `and` turns off any bits that's not set in both values |
02:24:23 | FromDiscord | <Yardanico> @reilly in nim and/or/not/xor can be used for both booleans and bit operations |
02:24:58 | leorize[m] | you might need to put that in paren |
02:25:20 | FromDiscord | <Yardanico> oh yeah |
02:25:37 | FromDiscord | <Yardanico> well actually not |
02:25:42 | FromDiscord | <Yardanico> ah sorry, yes |
02:25:48 | FromDiscord | <Yardanico> and has lower precedence than != |
02:26:10 | leorize[m] | !eval let i = 0xffffu16; echo (i and 0x8000) != 0 |
02:26:12 | NimBot | true |
02:26:41 | FromDiscord | <reilly> `if bitand(GetAsyncKeyState(VK_SHIFT).int, 0x8000) != 0:` seems to be correct. |
02:27:04 | leorize[m] | that works too :) |
02:28:00 | leorize[m] | !eval let i = 0xffffu16; echo bool(i shr 15) |
02:28:02 | NimBot | true |
02:28:21 | mbuchel | hey did anyone implement DEFLATE algorithm in nim-lang yet? |
02:28:41 | leorize[m] | !repo deflate |
02:28:42 | disbot | https://github.com/jangko/nimz -- 9nimz: 11Modular Deflate Algorithm Implementation 15 4⭐ 0🍴 |
02:29:25 | leorize[m] | and of course it have zero docs :p |
02:29:28 | mbuchel | thank you |
02:29:38 | mbuchel | yep i figured i would have to make my own |
02:29:44 | FromDiscord | <Rika> it has 4 bytes of docs ("nimz" |
02:29:46 | FromDiscord | <Rika> ) |
02:30:01 | mbuchel | hopefully this will help me a bit |
02:30:23 | leorize[m] | or you can see if someone already wrapped a C deflate implementation |
02:30:46 | FromDiscord | <Rika> isnt zlib deflate? |
02:30:49 | mbuchel | checked for that |
02:30:52 | mbuchel | zlib did not work |
02:30:57 | FromDiscord | <Rika> zlibstatic |
02:31:05 | leorize[m] | !repo miniz |
02:31:08 | disbot | https://github.com/richgel999/miniz -- 9miniz: 11miniz: Single C source file zlib-replacement library, originally from code.google.com/p/miniz 15 928⭐ 149🍴 7& 29 more... |
02:31:10 | FromDiscord | <Rika> ive found zlibstatic to work more than zlib lol |
02:31:26 | * | bung joined #nim |
02:32:08 | mbuchel | thank you for the miniz |
02:32:10 | mbuchel | that works |
02:32:18 | mbuchel | hopefully |
02:32:23 | leorize[m] | !repo treeform/miniz |
02:32:23 | disbot | https://github.com/treeform/miniz -- 9miniz: 11Miniz wrapper for nim. 15 10⭐ 1🍴 |
02:33:17 | leorize[m] | disruptek: disbot seems to be getting priorities wrong :p it should pick nim projects first, no? |
02:33:18 | disruptek | iiuc, the nim-lang zlib wrapper is crufty. |
02:33:54 | disruptek | blame github. |
02:34:31 | disruptek | treeform's miniz is 99.2% C and only 0.8% Nim. |
02:36:19 | FromDiscord | <Rika> why not submodules |
02:36:24 | mbuchel | is there a wrapper for the deflate portion? i think this miniz one by treeform skips on that part |
02:36:52 | disruptek | well, we should add it. |
02:37:29 | mbuchel | i likely will have to later today/tomorrow |
02:38:25 | disruptek | it should be pretty copy+paste. |
02:38:33 | disruptek | rika: did you look at gram? |
02:38:58 | disruptek | mbuchel: you should look at the nim-lang zlib, too; it might work fine, i really dunno. |
02:39:15 | mbuchel | it did not |
02:39:19 | FromDiscord | <Rika> yeah but what should i say about it lol i havent used it yet |
02:39:29 | disruptek | araq mentioned to me that it needs attention. |
02:39:30 | mbuchel | i am working on modifying the treeform/ws library to support compression rfc |
02:39:41 | disruptek | yeah, i remember you mentioning that. |
02:39:52 | disruptek | should be pretty straightforward. |
02:40:09 | disruptek | rika: i'm not using it yet myself, hence my interest. |
02:40:13 | mbuchel | the zlib one does not want to work with the test server i wrote |
02:40:41 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
02:41:10 | FromDiscord | <Rika> ah i see, i'm not sure when i'll start using it since i'm still fixing up a CBOR library and i kinda need that first so *shrug* |
02:41:20 | disruptek | okay. |
02:41:46 | disruptek | actually, i do use it in poison. |
02:42:28 | disruptek | i made skiplists for use in gram, too. |
02:42:34 | disruptek | but haven't added them yet. |
02:42:49 | bung | how to provide default value to openarray ? I have `headers: openarray[(cstring, cstring)] = []` |
02:42:59 | * | audiophile quit (Ping timeout: 272 seconds) |
02:43:06 | bung | while inside the proc `for a, b in items(headers):` I got `Error: internal error: genTypeInfo(tyOpenArray)` |
02:44:17 | disruptek | openArray is like a converting typeclass; it's not something you specify for a variable. |
02:44:29 | leorize[m] | bung: any internal error is a bug, please report |
02:44:32 | FromDiscord | <Yardanico> @disruptek bung is specifying it in a argument list |
02:45:03 | disruptek | if that's in a proc() then it's definitely a bug. |
02:45:04 | FromDiscord | <Yardanico> or maybe not |
02:45:10 | FromDiscord | <Yardanico> @Bung can you show proc definition? |
02:45:43 | FromDiscord | <Yardanico> maybei t got fixed in devel |
02:45:44 | FromDiscord | <Yardanico> it * |
02:46:15 | disruptek | i would s/[]/@[]/ |
02:46:27 | FromDiscord | <Yardanico> it doesn't really matter anyway |
02:46:50 | FromDiscord | <Yardanico> !eval let test = (proc(headers: openarray[(string, string)] = [("lol", "yes")]) = echo @headers); test() |
02:46:52 | NimBot | @[("lol", "yes")] |
02:46:54 | bung | https://github.com/bung87/nimvideo/blob/master/src/nimvideo/najax.nim#L130 |
02:47:08 | FromDiscord | <Yardanico> @Bung are you on devel or not? |
02:47:10 | FromDiscord | <Yardanico> what nim version |
02:47:19 | FromDiscord | <Yardanico> or maybe it's only in the JS backend |
02:47:27 | bung | Nim Compiler Version 1.3.5 [MacOSX: amd64] |
02:47:28 | bung | Compiled at 2020-07-07 |
02:47:34 | FromDiscord | <Yardanico> huh |
02:47:54 | bung | so maybe only in js backend |
02:48:35 | FromDiscord | <Yardanico> nah, it works with the JS backend for me too |
02:49:10 | disruptek | did you try @[] instead of []? |
02:49:33 | FromDiscord | <Yardanico> ah nvm I can replicate it |
02:49:36 | FromDiscord | <Yardanico> with nimvideo src 😄 |
02:49:45 | FromDiscord | <Yardanico> @disruptek doesn't fix it |
02:50:14 | FromDiscord | <Yardanico> actually I know why |
02:50:38 | FromDiscord | <Yardanico> or not |
02:50:45 | bung | should I update nim to devel to confirm ? |
02:50:59 | FromDiscord | <Yardanico> no it's okay |
02:51:01 | FromDiscord | <Yardanico> I said i replicated it |
02:52:03 | FromDiscord | <Yardanico> oh I know |
02:52:37 | FromDiscord | <Yardanico> @Bung your code is invalid nim |
02:52:44 | bung | disruptek tried doest avoiding this problem |
02:52:50 | FromDiscord | <Yardanico> it wouldn't compile with the C backend with proper error "Error: 'data' is of type <openArray[(string, string)]> which cannot be captured as it would violate memory safety, declared here: /home/dian/Projects/stuff/ba.nim(1, 9); using '-d:nimWorkaround14447' helps in some cases" |
02:53:02 | FromDiscord | <Yardanico> to replicate - https://gist.github.com/Yardanico/c5a34d6921696fa8e5370ac5578e3068 |
02:53:20 | FromDiscord | <Yardanico> it's easy to fix though |
02:53:34 | FromDiscord | <Yardanico> add as a first line in your najax |
02:53:58 | FromDiscord | <Yardanico> let headers = @headers |
02:54:06 | FromDiscord | <Yardanico> that way you'll convert an openarray to a seq locally in your proc |
02:54:23 | FromDiscord | <Yardanico> like this - https://gist.github.com/Yardanico/3806cf326214e058c24264d53f4f90d8 |
02:56:22 | bung | yeah, it fix, ah, I got the point, the params around headers also cstring |
02:57:08 | FromDiscord | <Yardanico> well it doesn't matter if it's cstring or not |
02:57:13 | bung | or not, it is array of tuple |
02:57:43 | FromDiscord | <Yardanico> that doesn't matter either 🙂 |
02:58:09 | FromDiscord | <Yardanico> same error |
02:58:10 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2rFi |
02:58:27 | FromDiscord | <Yardanico> so yeah, it's about capturing openArray in a closure |
02:59:19 | bung | ok, then I guess you can create PR fix it |
03:00:39 | FromDiscord | <Yardanico> to show an error instead? yeah |
03:01:58 | bung | the second problem I found for js backend. |
03:02:19 | FromDiscord | <Yardanico> well it's not really specific to JS as I already said, it's just a compiler crash instead of an error message 🙂 |
03:03:36 | bung | oh, alright |
03:21:55 | FromGitter | <iffy> leorize: I see how it works now (at least on posix). There's a few edge cases it's getting tripped up on (e.g. readFromStdin(5) then type "a" enter -- it will complete with "a\10" instead of waiting for more). I'm trying to adjust it to keep reading until the buffer is full. |
03:22:22 | leorize | that's by design |
03:22:35 | leorize | all i/o interface works like so |
03:22:51 | FromGitter | <iffy> It's also behaving strangely with this input: `(sleep 1;echo a;sleep 1;echo b;sleep 1;echo c) | nim c -r ~/tmp/leorize.nim` when `isMainModule` contains `readFromStdin(3); readFromStdin(2); readFromStdin(1)` |
03:23:36 | FromGitter | <iffy> @leorize: that first one is fine -- I can work with that. The second problem, though, the readFromStdin(1) call never gets any data before the program exits |
03:24:52 | FromGitter | <iffy> https://play.nim-lang.org/#ix=2rFp anyway, sleep if you need to -- you've already helped me a ton! I'm off to bed |
03:31:00 | disruptek | who wants to fix an easy macros bug? |
03:40:59 | shashlick | Nothing is easy, stuff I figured out last week is also brand new today |
03:41:31 | FromDiscord | <reilly> I'm probably gonna be asking lots of questions tonight. Yet another not-really-Nim-related one: What does the second half of `PMSLLHOOKSTRUCT pMouse = (PMSLLHOOKSTRUCT)lParam;` do? This is C, and `lParam` is of type `LPARAM`. |
03:42:17 | FromDiscord | <Yardanico> casts lParam to PMSLLHOOKSTRUCT type |
03:42:28 | FromDiscord | <Yardanico> it's like cast[PMSLLHOOKSTRUCT](lParam) in Nim |
03:42:36 | FromDiscord | <Yardanico> reinterprets the same memory as if it was of other type |
03:43:07 | leorize | note that C conversion convention is weird, not all types follow that pattern |
03:43:39 | * | maier joined #nim |
03:44:16 | FromDiscord | <reilly> That's what I thought, but I wasn't sure since I've never seen syntax like that before. Also didn't even know that Nim had a `cast[]()` thing. Gonna look into that. |
03:47:22 | FromDiscord | <reilly> For context, I'm rewriting some C code in Nim to figure out how it works. The next line is `if ( NULL != pMouse )`. Is it possible for that last line to return `nil`? I don't really know off the top of my head how Nim handles nil values. |
03:47:55 | * | maier quit (Ping timeout: 246 seconds) |
03:48:43 | FromDiscord | <Yardanico> well not "return nil" |
03:48:46 | FromDiscord | <reilly> Again, sorry for all the questions, I just genuinely don't know what I'm doing. |
03:48:47 | FromDiscord | <Yardanico> but it might be a null pointer |
03:48:51 | FromDiscord | <Yardanico> so in nim you can just do the same |
03:48:55 | FromDiscord | <Yardanico> if pMouse != nil |
03:49:06 | FromDiscord | <Yardanico> or nil != pMouse if you like that style (I don't) |
03:49:33 | FromDiscord | <reilly> Oh, dope. I was worried it might behave differently in Nim. And yes, `pMouse != nil` is *so* much better. |
03:49:45 | FromDiscord | <Yardanico> well you can do if (pMouse != NULL) in C too |
03:51:25 | FromDiscord | <reilly> I know, of course you can. |
03:51:25 | FromDiscord | <Varriount> ynfle: Sure |
03:51:32 | leorize | some C style guide use `NULL != <var>` for some reason |
03:51:37 | FromDiscord | <Varriount> @reilly: Need any help? |
03:52:00 | disruptek | leorize: because <var> = NULL is an easy typo bug. |
03:52:08 | FromDiscord | <reilly> Basically just figuring out some C syntax/symbols I don't know at the moment. |
03:52:24 | leorize | disruptek: ah the good ol' assignment is an expression |
03:52:54 | disruptek | i have nim code where i write 0 == foo: out of habit. |
03:54:06 | FromDiscord | <reilly> Here's yet another symbol I don't recognize: the `->` in `if ( 0 == pMouse->flags )`. Maybe at this point I should just learn C. |
03:54:10 | leorize | I came from pascal where `=` is the comparison op and `:=` is the assignment :P |
03:54:24 | disruptek | reilly: ptr deref. |
03:54:26 | FromDiscord | <Varriount> reilly: That's a dereference + member access |
03:54:31 | leorize | @reilly it's shorthand for `(*pMouse).flags` |
03:54:39 | FromDiscord | <Elegant Beef> It's atrocious 😄 |
03:54:49 | leorize | in Nim you write it as `pMouse[].flags` or `pMouse.flags` (both works iirc) |
03:54:55 | FromDiscord | <Yardanico> yeah, but second is preferred |
03:54:56 | FromDiscord | <Elegant Beef> Yea both do |
03:55:01 | FromDiscord | <Elegant Beef> We automagically dereference |
03:55:08 | FromDiscord | <Yardanico> btw |
03:55:18 | FromDiscord | <Yardanico> didn't know it's possible to specify default value for multiple arguments |
03:55:37 | FromDiscord | <reilly> I'm a big fan of automagically doing things, so that works out. |
03:55:42 | FromDiscord | <Yardanico> !eval let test = (proc (a, b, c = false) = echo b); test() |
03:55:45 | NimBot | false |
03:55:54 | leorize | I abused that so much that I got bit when I write C++ :P |
03:56:22 | leorize | esp when C++ require that all arguments with defaults have to be the last |
03:56:53 | FromDiscord | <Elegant Beef> i really like the tuple unpacking |
03:57:06 | disruptek | don't get used to it. |
03:57:14 | FromDiscord | <Yardanico> why? it's nice |
03:57:22 | FromDiscord | <Elegant Beef> What is it getting removed? |
03:57:26 | FromDiscord | <Yardanico> ? |
03:57:35 | disruptek | i've said too much. |
03:57:38 | FromDiscord | <Yardanico> why would it 😛 |
03:57:42 | FromDiscord | <Elegant Beef> Yea that's my point |
04:00:04 | FromDiscord | <reilly> Tuple unpacking is a godsend, honestly. |
04:03:02 | FromDiscord | <Yardanico> just FYI there's also https://github.com/technicallyagd/unpack |
04:04:45 | FromDiscord | <reilly> This one is just weird. `PKBDLLHOOKSTRUCT keyStruct = lParam;` (`lParam` still being of type `LPARAM`) seems like it would cause a type mismatch, and of course Nim is complaining about it. That's what it says, though. |
04:05:07 | * | leorize quit (Remote host closed the connection) |
04:05:31 | leorize[m] | welcome to C, where pointers are interchangable |
04:05:38 | * | leorize joined #nim |
04:05:41 | leorize[m] | well actually most types are interchangable, not just pointers |
04:05:59 | FromDiscord | <Elegant Beef> Well C is weakly typed |
04:06:02 | * | supakeen quit (Quit: WeeChat 2.8) |
04:06:24 | FromDiscord | <Yardanico> @reilly just use cast again 🙂 |
04:06:41 | * | supakeen joined #nim |
04:06:46 | FromDiscord | <Elegant Beef> And weakly typed sucks! 😄 |
04:07:18 | leorize | even python knows that :P |
04:08:21 | FromDiscord | <reilly> At this point, it's not even figuring out the Nim equivalent, it's just figuring out C's nonsense. Statically typed or bust. |
04:08:32 | FromDiscord | <reilly> *Strongly, I should say. |
04:08:34 | FromDiscord | <Elegant Beef> What're you doing anywho? |
04:08:49 | FromDiscord | <reilly> Basically rewriting some C in Nim. |
04:08:55 | FromDiscord | <Varriount> reilly: Do you know the type definition of PKBDLLHOOKSTRUCT or LPARAM? |
04:09:01 | FromDiscord | <Elegant Beef> Ah RRIN doesnt have the same ring to it 😄 |
04:09:13 | FromDiscord | <Elegant Beef> I mean RIIN |
04:09:17 | FromDiscord | <Elegant Beef> I cant spell |
04:10:29 | FromDiscord | <reilly> `PKBDLLHOOKSTRUCT` is a `ptr KBDLLHOOKSTRUCT`, which in turn is an `object` containing four `DWORD`s and one `ULONG_PTR`. |
04:11:06 | FromDiscord | <reilly> `LPARAM` is a `LONG_PTR`, which is just an `int32`. |
04:11:32 | FromDiscord | <Elegant Beef> Ah yes nice clear and linear |
04:11:45 | FromDiscord | <Elegant Beef> why is longptr 32 bit? |
04:11:49 | FromDiscord | <Elegant Beef> That's fucking weird |
04:11:56 | FromDiscord | <Yardanico> @reilly that's a poor's main alternative to object inheritance or object variants |
04:12:13 | FromDiscord | <reilly> Well that's the Windows API 🤷 |
04:12:27 | FromDiscord | <Elegant Beef> poor man's* 😛 |
04:12:34 | FromDiscord | <Varriount> @Elegant Beef Pointer to a long |
04:12:48 | FromDiscord | <Yardanico> (edit) 'main' => 'man' |
04:12:48 | FromDiscord | <reilly> I'm using Winim for this, but I'm assuming it's basically just as close to a copy of the original as possible. |
04:12:52 | FromDiscord | <impbox> It's longer than a short |
04:12:58 | FromDiscord | <Elegant Beef> Lol impbox |
04:13:04 | FromDiscord | <Varriount> Keep in mind, the Windows API has been around since the 16-bit era |
04:13:11 | FromDiscord | <Elegant Beef> I guess |
04:13:20 | FromDiscord | <reilly> 32-bit is the FUTURE™️ |
04:13:28 | FromDiscord | <Elegant Beef> cant wait for the 48bit future |
04:14:01 | FromDiscord | <reilly> Get this: the Atari Jaguar has a whole *64 bits*. |
04:14:11 | FromDiscord | <reilly> Surely it'll be a great success! |
04:14:14 | FromDiscord | <Elegant Beef> Not possible |
04:14:21 | FromDiscord | <Yardanico> ? |
04:14:36 | FromDiscord | <impbox> Yeah, long is defined to be at least 32 bits |
04:14:57 | FromDiscord | <Yardanico> Atari Jaguar's 64-bit claim is a bit stupid though |
04:15:09 | FromDiscord | <Yardanico> sent a long message, see http://ix.io/2rFy |
04:15:09 | FromDiscord | <reilly> 64 bits != good |
04:15:30 | FromDiscord | <Elegant Beef> Impossible it's twice as good as 32bit |
04:16:21 | leorize | long is defined to be at least 32bit |
04:16:30 | leorize | however if you're on x86_64 it's 64bit :) |
04:16:38 | FromDiscord | <Elegant Beef> Yea |
04:16:56 | FromDiscord | <Elegant Beef> Time to deprecate all old software, let's make a new OS, so we can use.... and we're on 128bit |
04:16:59 | leorize | long is roughly the size of a machine word in practice |
04:17:29 | FromDiscord | <Varriount> @reilly Anyway, `PKBDLLHOOKSTRUCT keyStruct = lParam;` doesn't seem like good code to me. Yes, C allows it, but I'm not sure it isn't undefined behavior somehow. |
04:18:04 | FromDiscord | <Varriount> Anyway, is this what you're copying? https://gist.github.com/Yannicked/23919888d759876221c3 |
04:18:06 | FromDiscord | <reilly> Per @Yardanico you can just cast it. |
04:18:18 | FromDiscord | <Yardanico> I mean it'll probably work |
04:18:20 | FromDiscord | <Yardanico> I'm not sure 😛 |
04:18:29 | leorize | it's not undefined behavior |
04:18:40 | leorize | since those are pointers C will just silently convert it over |
04:18:43 | leorize | just C things |
04:18:51 | FromDiscord | <reilly> That's not it, but it's close enough. |
04:19:12 | FromDiscord | <reilly> Same general idea: Windows API keyboard and mouse stuff. |
04:19:19 | FromDiscord | <Varriount> leorize: It doesn't hit aliasing rules? |
04:20:53 | FromDiscord | <reilly> Somehow we went from the Windows API to the Atari Jaguar |
04:22:16 | FromDiscord | <Yardanico> and all in on-topic :nimrawr: |
04:22:35 | FromDiscord | <Yardanico> good thing there are no moderators online |
04:22:45 | FromDiscord | <reilly> I haven't been able to stop thinking about how the Nim mascot might have been a badger of all things. |
04:22:46 | FromDiscord | <Elegant Beef> Just a server owner |
04:23:31 | FromDiscord | <Yardanico> @reilly well we don't have a mascot at all, yeah that badger was one of the proposed ones I think |
04:23:41 | FromDiscord | <Yardanico> I use it as my github profile picture |
04:23:43 | FromDiscord | <Yardanico> :nimrawr: |
04:23:52 | FromDiscord | <Yardanico> https://avatars3.githubusercontent.com/u/21169548?s=460&u=361f5e29fc762f2e80e69b5f7330ccecfc26d0f3&v=4 |
04:24:18 | FromDiscord | <reilly> I know, you actually told me exactly that just a few days ago. |
04:24:40 | FromDiscord | <reilly> By the way, endless thanks for the contribution. |
04:24:53 | FromDiscord | <Yardanico> ah lol, np 😛 |
04:25:15 | leorize | @Varriount it's casted from a generic pointer (a void*), so it should be fine |
04:25:27 | FromDiscord | <Yardanico> sometimes I just turn into a "nim inspector mode" and find small simple projects to contribute a single PR 😄 |
04:25:38 | FromDiscord | <Yardanico> from github nim repos sorted by when they were last updated |
04:26:35 | Yardanico | !status |
04:26:37 | FromDiscord | Uptime - 6 days, 19 hours, and 32 minutes |
04:26:52 | FromDiscord | <reilly> I'm guessing `toggled = !toggled` would be the same as `toggled = not toggled`? Not sure what else ! would do. |
04:27:03 | FromDiscord | <Yardanico> yeah |
04:27:19 | leorize | @Yardanico are you interested in testing if Nim generates any code with undefined behavior? all the sanitizers stuff are kinda cool if they work :P |
04:27:42 | Yardanico | well I know for sure Clang things (not sure if true) that Nim's default GC does UB |
04:27:46 | Yardanico | thinks* |
04:27:58 | FromDiscord | <Varriount> @reilly `and`, `or`, and `not` are all bit-operators for integers. |
04:28:11 | leorize | gcc got sanitizers too |
04:28:15 | FromDiscord | <Yardanico> i know |
04:28:23 | FromDiscord | <Yardanico> but they're much better in clang AFAIK |
04:28:42 | leorize | not sure, google maintains both iirc |
04:28:44 | FromDiscord | <Varriount> I know that Nim turns off strict aliasing rules |
04:29:19 | FromDiscord | <reilly> As far as I can tell it's actually `bitops.bitand()`, etc. |
04:29:19 | FromDiscord | <Varriount> Yardanico: That's because it scans the stack, I think. |
04:29:47 | FromDiscord | <reilly> That's that threw me off originally, since `and` is for conditions. |
04:30:08 | FromDiscord | <Varriount> reilly: Huh. |
04:30:43 | FromDiscord | <Yardanico> @reilly not really, you don't need bitops |
04:31:02 | FromDiscord | <reilly> Really? Nim complained when I just used `and`. |
04:31:06 | FromDiscord | <Yardanico> bitops is only needed for optimizations 🙂 |
04:31:22 | FromDiscord | <Yardanico> yeah |
04:31:59 | FromDiscord | <Yardanico> !eval echo 0b11111111 and 0b01010101 |
04:32:01 | NimBot | 85 |
04:32:15 | FromDiscord | <Yardanico> 1 + 4 + 16 + 64 |
04:32:19 | FromDiscord | <reilly> Maybe it's because it was part of a condition? |
04:32:29 | FromDiscord | <Yardanico> well maybe, you need to watch out for precedence |
04:32:32 | FromDiscord | <reilly> I mean, whatever the case, I found something that works. |
04:33:30 | leorize | maybe we can try to generate code that uses type punning and remove -fno-strict-aliasing, though I'm not sure if that can give us more performance |
04:34:44 | FromDiscord | <Yardanico> @Varriount @leorize the one I was talking about - https://forum.nim-lang.org/t/6362#39481 |
04:41:22 | FromDiscord | <reilly> sent a long message, see http://ix.io/2rFK |
04:42:41 | FromDiscord | <Yardanico> first one - it's probably a C macro |
04:42:51 | FromDiscord | <Yardanico> second - it takes an address of some value |
04:42:57 | FromDiscord | <Yardanico> "addr val" in Nim |
04:43:06 | FromDiscord | <Varriount> @reilly ↵ - `CALLBACK` is a macro for `__stdcall`, it marks the function as using the stdcall calling convention. If you don't know what a calling convention is, look [here](https://en.wikipedia.org/wiki/Calling_convention).↵ - Creates an address of the MouseeCallback value. |
04:44:15 | FromDiscord | <Varriount> (edit) '[here](https://en.wikipedia.org/wiki/Calling_convention).↵' => 'here: https://en.wikipedia.org/wiki/Calling_convention.↵' | 'Creates an' => 'Gets the' | 'MouseeCallback' => 'MouseCallback' |
04:45:06 | FromDiscord | <Varriount> If you need a Nim procedure that uses the `stdcall` calling convention, use the `stdcall` pragma: https://nim-lang.org/docs/manual.html#types-procedural-type |
04:49:02 | FromDiscord | <reilly> Okay, so I've done the `{.stdcall.}` thing. Don't know if that will actually make a difference. |
04:49:21 | FromDiscord | <Varriount> Well, it should prevent the program from crashing. |
04:49:55 | FromDiscord | <Varriount> Bad things happen when a procedure gets called using an incorrect calling convention. Baaaad things |
04:50:21 | FromDiscord | <Yardanico> @reilly for nim - yes |
04:50:32 | FromDiscord | <Yardanico> it uses fastcall convention on all platforms where it can be used |
04:50:34 | FromDiscord | <Yardanico> by default |
04:50:52 | FromDiscord | <reilly> Fair enough. Don't know what these words mean, but if it works, it works. |
04:50:58 | FromDiscord | <Yardanico> "nimcall is the default convention used for a Nim proc. It is the same as fastcall, but only for C compilers that support fastcall." |
04:51:28 | FromDiscord | <reilly> There's also this other bit: `DWORD WINAPI HookThread(...` where it uses `WINAPI` like it did `CALLBACK`. |
04:51:49 | FromDiscord | <Varriount> Off the stop of my head, that's also __stdcall, but I would have to double-check |
04:52:21 | FromDiscord | <Varriount> @Yardanico That's not necessarily true. A more accurate statement would be "but only for environments that support it" |
04:52:21 | FromDiscord | <Yardanico> isn't that what I said? |
04:52:31 | FromDiscord | <Yardanico> I mean platforms = environments |
04:52:44 | FromDiscord | <Varriount> reilly: Yeah, it's also stdcall |
04:52:49 | FromDiscord | <Yardanico> I know different C compilers can possibly not support fastcall |
04:53:02 | FromDiscord | <reilly> Yay, two different names for the same thing! |
04:54:40 | FromDiscord | <reilly> Back to that `&MouseCallback` thing, Nim's complaining. |
04:55:04 | FromDiscord | <Yardanico> you just pass the nim proc as-is |
04:55:14 | FromDiscord | <Yardanico> or addr myProc if it really wants a pointer |
04:55:17 | FromGitter | <ynfle> @Varriount, if you're still here, the SIGSEGV issue ynfle/nim-test-runner@6cbe299 & https://github.com/ynfle/nim-test-runner/runs/871136877 |
04:55:46 | FromDiscord | <Yardanico> @reilly just pass your nim proc without any symbols |
04:56:05 | FromDiscord | <reilly> Ah, you said to use `addr` earlier and that seems to have been the issue. Now it's complaining about something else. though. |
04:56:20 | FromDiscord | <Yardanico> yeah, you probably don't need addr |
04:56:37 | FromDiscord | <reilly> The exact original call is `SetWindowsHookEx( WH_MOUSE_LL, &MouseCallBack, NULL, NULL );`, but Nim doesn't like that I'm using `nil`. |
04:56:44 | FromDiscord | <Yardanico> nim will auto-convert a proc to a pointer |
04:57:44 | FromDiscord | <Yardanico> @reilly well the definition for it in winim is @reilly you want either SetWindowsHookEx |
04:57:46 | FromDiscord | <Yardanico> sorry |
04:57:55 | FromDiscord | <Yardanico> wrong ctrl+c ctrl+v |
04:57:55 | FromDiscord | <Yardanico> proc SetWindowsHookEx*(idHook: int32, lpfn: HOOKPROC, hmod: HINSTANCE, dwThreadId: DWORD): HHOOK |
04:57:58 | FromDiscord | <Yardanico> that's the nim definition |
04:58:03 | FromDiscord | <Yardanico> and show us the error message 🙂 |
04:58:17 | FromDiscord | <Yardanico> your hook proc must be HOOKPROC* = proc (code: int32, wParam: WPARAM, lParam: LPARAM): LRESULT {.stdcall.} |
04:58:39 | FromDiscord | <reilly> sent a code paste, see https://play.nim-lang.org/#ix=2rFQ |
04:59:40 | FromDiscord | <reilly> I knew it was a type mismatch thing, but I'm not really sure what else I would put there. My only reference is this one C file. |
05:01:14 | FromDiscord | <Yardanico> it should work |
05:01:24 | FromDiscord | <Yardanico> ah wait nvm |
05:01:31 | * | maier joined #nim |
05:01:35 | FromDiscord | <Yardanico> so just try do 0 instead of NULL |
05:01:38 | FromDiscord | <Yardanico> (edit) 'so just try ... do' => 'so just tryto' |
05:01:50 | FromDiscord | <Yardanico> yeah HANDLE is `int` |
05:01:57 | FromDiscord | <Yardanico> HINSTANCE is HANDLE |
05:02:10 | FromDiscord | <Yardanico> and I got all that from winim source code 🙂 |
05:03:13 | FromDiscord | <Yardanico> same for dwThreadId - use 0 insteado f nil |
05:03:17 | FromDiscord | <Yardanico> (edit) 'insteado f' => 'instead of' |
05:05:33 | FromDiscord | <reilly> That did it. That's good to take note of, I expect that'll probably show up again later. |
05:05:46 | FromDiscord | <reilly> And yeah, in retrospect I should've just checked Winim. |
05:06:10 | FromDiscord | <Yardanico> Just search for "SymbolName* = " |
05:06:14 | * | marnix joined #nim |
05:06:29 | FromDiscord | <Yardanico> that's for constants/types |
05:06:54 | FromDiscord | <Yardanico> for procs just "proc procName" for example |
05:06:54 | * | marnix quit (Read error: Connection reset by peer) |
05:07:00 | FromDiscord | <Yardanico> or use goto definition in an editor 🙂 |
05:07:45 | * | marnix joined #nim |
05:07:56 | * | rockcavera quit (Remote host closed the connection) |
05:10:11 | * | Cthalupa quit (Ping timeout: 240 seconds) |
05:12:05 | FromDiscord | <reilly> sent a code paste, see https://play.nim-lang.org/#ix=2rFS |
05:14:06 | FromDiscord | <Varriount> @reilly I believe LPMESSAGE equals a pointer to MSG |
05:14:38 | FromDiscord | <reilly> Now that I've checked, you're exactly right. I can't help but wonder why. |
05:14:51 | FromDiscord | <Varriount> try `while GetMessage(addr msg, <something casted to 0>, 0, 0):` |
05:15:02 | * | Cthalupa joined #nim |
05:15:17 | FromDiscord | <Rika> cant you just use `nil` |
05:15:24 | FromDiscord | <Rika> instead of "something casted to 0" |
05:15:31 | FromDiscord | <Varriount> Not if the parameter type is an integeer |
05:15:37 | FromDiscord | <Varriount> (edit) 'integeer' => 'integer' |
05:15:39 | FromDiscord | <reilly> We just had this issue, nil != 0 |
05:15:44 | FromDiscord | <Rika> i see |
05:15:55 | FromDiscord | <Rika> i'm not following the conversation |
05:16:24 | FromDiscord | <reilly> There's not a whole lot to see. Just questions about C/WinAPI, and a single Atari Jaguar reference. |
05:18:01 | FromDiscord | <reilly> sent a code paste, see https://play.nim-lang.org/#ix=2rFU |
05:18:28 | FromDiscord | <reilly> I have to cast it to a bool cause it returns a `WINBOOL`. Why? The world may never know. |
05:18:41 | FromDiscord | <Varriount> sent a code paste, see https://play.nim-lang.org/#ix=2rFV |
05:19:22 | FromDiscord | <Varriount> Actually, that would be a good contribution to winim, considering the amount of C type conversions the Windows API leverages. |
05:20:01 | FromDiscord | <reilly> That's a really good idea, actually. You're welcome to add that to Winim yourself, I wouldn't want to take credit. |
05:21:08 | FromGitter | <ynfle> Why would I get a `SIGSEGV` at different lines when I run a file again after already being compiled and run? |
05:21:27 | FromDiscord | <Varriount> ynfle: Memory corruption. |
05:22:11 | FromGitter | <ynfle> I don't modify memory directly? |
05:22:34 | FromGitter | <ynfle> How much C would I have to know to properly debug that with gdb? |
05:22:34 | * | marnix quit (Ping timeout: 240 seconds) |
05:22:41 | FromDiscord | <Varriount> ynfle: Can you show me your code? |
05:23:08 | * | letto quit (Quit: Konversation terminated!) |
05:23:18 | FromGitter | <ynfle> Do you want the commit? |
05:23:24 | FromDiscord | <Varriount> ynfle: Not too much. If you compile Nim with `--debugger:native --linedir:on` |
05:24:00 | FromDiscord | <Varriount> ynfle: Sure, although I don't know if LLDB was installed along with Clang on my laptop |
05:24:03 | FromGitter | <ynfle> I just did -g |
05:24:07 | FromGitter | <ynfle> Is that the same? |
05:24:27 | FromDiscord | <Varriount> The Nim compiler accepts `-g`? |
05:24:33 | FromGitter | <ynfle> Yup |
05:24:44 | FromGitter | <ynfle> Produces .dSYM |
05:25:09 | FromDiscord | <Varriount> I guess so? You might also want to add linedir:on though |
05:25:18 | FromGitter | <ynfle> Ok |
05:25:24 | FromDiscord | <Varriount> I don't know if the native debugging flag sets that automatically. |
05:25:41 | FromGitter | <ynfle> Ok thx |
05:26:06 | FromGitter | <ynfle> https://github.com/ynfle/nim-test-runner/commit/6cbe299 is the commit where `nimble test` gives memory corruption |
05:27:10 | FromDiscord | <Varriount> @reilly: Can you do me a favor? For one of the parameters that uses NULL in C, can you try using the `default` procedure: https://nim-lang.org/docs/system.html#default%2Ctypedesc |
05:27:23 | FromDiscord | <Varriount> And see if the compiler accepts that? |
05:28:56 | FromDiscord | <reilly> sent a code paste, see https://play.nim-lang.org/#ix=2rFW |
05:29:16 | FromDiscord | <Varriount> @reilly Yeah, you have to supply the type |
05:29:30 | FromDiscord | <reilly> Oh, duh, I don't know why I thought it would do that for me. |
05:29:39 | FromDiscord | <Varriount> Nim doesn't have return-based type inference |
05:31:10 | FromDiscord | <reilly> You know, I thinkI. I saw an error and just assumed it was a type mismatch in `SetWindowsHookEx()` without even consciously thinking about it. Clearly I'm not thinking straight. |
05:31:23 | FromDiscord | <reilly> Welp, hit the enter key prematurely. |
05:31:35 | FromDiscord | <reilly> *You know, I think I'm getting exhausted at this point. |
05:31:56 | * | Cthalupa quit (Ping timeout: 256 seconds) |
05:32:56 | FromDiscord | <reilly> And yes, that does work, now that I've actually put in the cognitive effort to do it properly. |
05:33:10 | FromDiscord | <reilly> With that said, I clearly need to sleep. |
05:33:18 | FromDiscord | <Varriount> As do I |
05:34:38 | FromDiscord | <Yardanico> me too |
05:34:56 | FromDiscord | <Elegant Beef> Not I |
05:38:17 | * | narimiran joined #nim |
05:39:05 | bung | I got the idea, I can cache karax component myself. |
05:41:17 | FromDiscord | <reilly> Last question of the night, what would be the Nim equivalent of `clock()` in `if ( ( clock() - lastClick ) > randomWaitDelay )`? |
05:42:13 | FromDiscord | <Varriount> Some function in the time module |
05:42:28 | FromDiscord | <reilly> `times`? |
05:43:53 | FromDiscord | <Varriount> https://nim-lang.org/docs/times.html |
05:45:23 | FromDiscord | <Elegant Beef> `cpuTime()` probably |
05:45:34 | FromDiscord | <Rika> best if you use getMonoTime in std/monotimes |
05:46:15 | FromDiscord | <reilly> I was actually looking at monotimes. Does the time start at the moment the program begins? |
05:46:22 | FromDiscord | <Yardanico> no |
05:46:32 | FromDiscord | <Yardanico> monotimes should be used when you want to capture monotonic timestamps |
05:46:43 | FromDiscord | <Yardanico> e.g. how much real-world time passed between two getMonoTime() points |
05:46:55 | FromDiscord | <Elegant Beef> Use `cpuTime()` from `times` |
05:47:15 | FromDiscord | <Yardanico> but yeah, for that code it's enough to use cpuTime |
05:52:40 | FromDiscord | <reilly> Okay, evidently I lied about it being the last question, but this is actually legitimately the last question, for reals. |
05:52:46 | FromDiscord | <Elegant Beef> Suuuure |
05:52:51 | FromDiscord | <impbox> are you sure? |
05:53:00 | FromDiscord | <reilly> I'm sure. |
05:53:19 | FromDiscord | <reilly> This is the last bit of code in the whole thing. |
05:53:28 | FromDiscord | <Rika> if its not, what do we do with you? |
05:53:36 | FromDiscord | <Elegant Beef> I vote ban |
05:54:14 | FromDiscord | <Yardanico> 🤔 |
05:54:17 | FromDiscord | <reilly> Add a feature to Nim where it deletes system32 if I'm the one using it. |
05:54:28 | FromDiscord | <Rika> then you use linux |
05:54:33 | FromDiscord | <Rika> in which case it deletes usr instead |
05:54:39 | FromDiscord | <reilly> `sudo rm -rf /` |
05:54:48 | FromDiscord | <Yardanico> @Rika jokes on you I'm on NixOS /s |
05:54:58 | FromDiscord | <Yardanico> @reilly forgot the * |
05:55:01 | FromDiscord | <Rika> gotta use --no-preserve-root now |
05:55:01 | FromDiscord | <Yardanico> `sudo rm -rf /*` |
05:55:03 | FromDiscord | <Rika> or that yes |
05:55:14 | FromDiscord | <Yardanico> --no-preserve-root is much longer |
05:55:38 | FromDiscord | <reilly> Frankly, I'm glad I can't remember. Means it's not an issue for me. |
05:56:03 | FromDiscord | <reilly> So, the final question: How do I make a new thread out of a proc? |
05:56:25 | FromDiscord | <Elegant Beef> https://nim-lang.org/docs/threads.html |
05:56:43 | * | letto joined #nim |
05:56:50 | FromDiscord | <reilly> I know, and I've tried using `var hook = createThread(HookThread())`, but as usual, Nim is complaining about it. |
05:57:05 | FromDiscord | <Yardanico> well you gotta share the error message with us if you don't understand it yourself 😛 |
05:57:15 | FromDiscord | <Elegant Beef> `createThread(varThread,proc,vars)` |
05:57:16 | FromDiscord | <Elegant Beef> no? |
05:57:51 | FromDiscord | <Yardanico> @reilly 1) compile with --threads:on |
05:58:04 | FromDiscord | <Yardanico> 2) createThread(yourVariable, HookThread) |
05:58:09 | FromDiscord | <Elegant Beef> Yea i was right↵https://nim-lang.org/docs/threads.html#createThread%2CThread%5Bvoid%5D%2Cproc%29 |
05:58:13 | FromDiscord | <Yardanico> var yourVariable: Thread[void] |
05:58:40 | FromDiscord | <reilly> sent a code paste, see https://play.nim-lang.org/#ix=2rFZ |
05:58:41 | FromDiscord | <Yardanico> --threads:on |
05:58:52 | FromDiscord | <Elegant Beef> > Note: This is part of the system module. Do not import it directly. To activate thread support you need to compile with the --threads:on command line switch. |
05:59:06 | FromDiscord | <Yardanico> and since HookThread as an argument |
05:59:15 | FromDiscord | <Yardanico> createThread(myVariable, HookThread, myParam) |
05:59:21 | FromDiscord | <reilly> I would've forgotten about the --threads thing, thanks. And no, I have not done `import threads`. |
05:59:34 | FromDiscord | <Yardanico> myParam being LPVOID or compatible with it |
06:00:17 | FromDiscord | <Elegant Beef> I encourage RTFM too much methinks 😄 |
06:00:21 | FromDiscord | <Varriount> @reilly did the `default` thing work? |
06:00:30 | FromDiscord | <reilly> Yes, the default thing did work. |
06:00:33 | FromDiscord | <Yardanico> yeah nim docs are more useful than some people think they are 🙂 |
06:00:33 | * | Vladar joined #nim |
06:00:46 | FromDiscord | <Elegant Beef> Yea the docs are very helpful imo |
06:00:54 | FromDiscord | <Elegant Beef> I mean they're shittly organized |
06:01:04 | FromDiscord | <Elegant Beef> *looking at this*↵https://nim-lang.org/docs/theindex.html |
06:01:51 | FromDiscord | <Yardanico> I never used index |
06:02:03 | FromDiscord | <reilly> `var hook: Thread[void]` throws `undeclared identifier: 'Thread'` and `no generic parameters allowed for Thread`. |
06:02:10 | FromDiscord | <Yardanico> --threads:on |
06:02:29 | FromDiscord | <Yardanico> if you want your IDE to not show errors, add that to the config |
06:02:37 | FromDiscord | <Elegant Beef> make a `name.nim.cfg` and add it |
06:02:43 | FromDiscord | <Yardanico> e.g. create a config.nims file with "switch("threads", "on")" in it |
06:02:50 | FromDiscord | <Elegant Beef> Or that |
06:03:06 | FromDiscord | <Elegant Beef> Either one will be used to tell your nimsuggest that module is in use |
06:03:21 | FromDiscord | <Elegant Beef> *and compile with it* |
06:03:26 | FromDiscord | <Yardanico> YESS |
06:03:28 | FromDiscord | <Yardanico> I got the zen.su domain |
06:03:40 | FromDiscord | <Elegant Beef> What's so special about that name? |
06:03:46 | FromDiscord | <Yardanico> 3-letter, cool name |
06:03:49 | * | solitudesf joined #nim |
06:03:51 | FromDiscord | <Yardanico> for $9 btw |
06:04:08 | FromDiscord | <Yardanico> it was registered by someone else since long ago but was expiring today |
06:04:15 | FromDiscord | <Yardanico> but there were no websites on it really |
06:04:31 | supakeen | Hola and good morning, I have an "object constructor needs object type" error on this bit of code: https://bpa.st/CG6Q and I'm a bit at a loss as I instantiate objects the same way in other places, can someone explain what's going on (do you need to see the type itself as well?). |
06:04:41 | FromDiscord | <reilly> sent a code paste, see https://play.nim-lang.org/#ix=2rG0 |
06:04:44 | supakeen | Yardanico: I think .su still requires a Russian citizenship to register it doesn't it? |
06:04:47 | FromDiscord | <Yardanico> @supakeen generics? |
06:04:52 | FromDiscord | <Yardanico> @supakeen well I'm Russian 😛 |
06:05:06 | FromDiscord | <Yardanico> @reilly nim has case/of, not switch/case |
06:05:24 | FromDiscord | <reilly> Oh, no, this is the `config.nims`. |
06:05:31 | FromDiscord | <Yardanico> yeah ignore it |
06:05:39 | FromDiscord | <Yardanico> the default vscode extension incorrectly uses nimsuggest on it too |
06:05:50 | FromDiscord | <reilly> The only thing I can say to that is, bruh. |
06:05:51 | FromDiscord | <Elegant Beef> Also runs it 😄 |
06:06:11 | FromDiscord | <Elegant Beef> Could've used the `name.nim.cfg` and wouldnt have it complaining 😛 |
06:06:13 | FromDiscord | <reilly> Well, at the very least, it doesn't seem to be complaining about the threads thing anymore. |
06:06:15 | supakeen | Yardanico: Here's the types involved: https://bpa.st/YXKQ |
06:06:21 | supakeen | Don't think that has generics? :) |
06:06:39 | FromDiscord | <Elegant Beef> Nah that's inheritance |
06:07:06 | FromDiscord | <Elegant Beef> What is going to be the difference between these |
06:07:12 | FromDiscord | <Elegant Beef> you might be able to use object variants |
06:07:28 | supakeen | Now that you say the other objects I'm implementing are inheriting from RootObj, not my own Object. |
06:07:31 | FromDiscord | <Yardanico> @supakeen works for me |
06:07:35 | supakeen | So it must be around that thing. |
06:07:37 | FromDiscord | <reilly> `nim.cfg` works without complaining, although I will note that it doesn't run nimsuggest when saving it. |
06:07:55 | FromDiscord | <Yardanico> @supakeen your issue must be somewhere else |
06:07:57 | FromDiscord | <Elegant Beef> nim.cfg requires it to be `--threads:on` afaik |
06:08:01 | supakeen | Yardanico: Thank you, then I must be doing something else wrong, I'll try to reduce the code to a small example and probably find out what I'm doing wrong that way. |
06:08:03 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2rG1 |
06:08:03 | FromDiscord | <Yardanico> @Elegant Beef doesn't have to |
06:08:06 | FromDiscord | <Elegant Beef> Ah |
06:08:09 | FromDiscord | <Yardanico> threads = on will work too |
06:08:26 | FromDiscord | <Elegant Beef> The nimscript version wont will it? |
06:08:38 | FromDiscord | <Yardanico> no, but --threads:on in .nims config will work |
06:08:59 | FromDiscord | <Elegant Beef> We really need to end the multiple config methods 😄 |
06:09:37 | FromDiscord | <Yardanico> then we also need to end UFCS I guess, because "everyone should write in the One True Way ™️ " |
06:10:09 | FromDiscord | <Elegant Beef> Well no, Uniform is in UFCS 😛 |
06:10:24 | FromDiscord | <Yardanico> but it's still "multiple ways to write the same thing" |
06:10:32 | FromDiscord | <Varriount> 2 ways |
06:10:44 | FromDiscord | <Elegant Beef> To me less about multiple ways, and more multiple files to do the same thing |
06:10:59 | FromDiscord | <impbox> UfCs |
06:11:01 | FromDiscord | <Elegant Beef> Like a single file would be fine if all these were acceptable in it |
06:11:05 | FromDiscord | <Yardanico> @impbox nice |
06:11:09 | FromDiscord | <Yardanico> U_f_C_s |
06:11:10 | FromDiscord | <Yardanico> that's even nicer |
06:11:25 | FromDiscord | <Yardanico> (self promotion - https://forum.nim-lang.org/t/6497) |
06:11:35 | * | marnix joined #nim |
06:12:49 | FromDiscord | <reilly> Well, it's still complaining. |
06:12:58 | FromDiscord | <Elegant Beef> Aboot? |
06:13:58 | FromDiscord | <reilly> sent a code paste, see https://play.nim-lang.org/#ix=2rG2 |
06:14:14 | FromDiscord | <Elegant Beef> you didnt pass arguments |
06:14:26 | FromDiscord | <reilly> To `HookThread()`? |
06:14:29 | FromDiscord | <Elegant Beef> Wait |
06:14:30 | FromDiscord | <Elegant Beef> Im daft |
06:14:31 | FromDiscord | <Elegant Beef> 😄 |
06:14:37 | FromDiscord | <reilly> Welcome to the club. |
06:14:45 | FromDiscord | <Elegant Beef> What's the proc signature of HookThread |
06:14:57 | supakeen | Well that was dumb, Position was a tuple ... more coffee necessary. |
06:15:01 | supakeen | Thanks for rubber ducking. |
06:15:03 | FromDiscord | <reilly> I have no idea what that means. |
06:15:12 | FromDiscord | <reilly> Is it just the definition? |
06:15:17 | FromDiscord | <Elegant Beef> `proc HookThread(args):returnType=` |
06:15:27 | FromDiscord | <reilly> `proc HookThread(): DWORD {.stdcall.} = ...` |
06:15:42 | FromDiscord | <Elegant Beef> oh |
06:15:49 | FromDiscord | <Elegant Beef> Im too tired |
06:15:49 | FromDiscord | <reilly> It originally had an argument, per the C I'm referencing, but it's not actually used anywhere, so 🤷 |
06:15:56 | FromDiscord | <Elegant Beef> I keep having "ooh, wait no" |
06:16:19 | FromDiscord | <Elegant Beef> you're calling the proc |
06:16:21 | FromDiscord | <Elegant Beef> dont call it |
06:16:49 | FromDiscord | <reilly> Uh... How? |
06:17:03 | FromDiscord | <Elegant Beef> `hook.createThread(HookThread)` |
06:17:07 | FromDiscord | <Yardanico> just don't call it |
06:17:11 | FromDiscord | <Elegant Beef> By calling it you're passing the return type |
06:17:17 | FromDiscord | <Yardanico> procedures are first-class citizens in Nim |
06:17:18 | FromDiscord | <Elegant Beef> You want a pass the proc not the return type |
06:17:26 | FromDiscord | <reilly> Okay, well, it's *still* complaining. |
06:17:29 | FromDiscord | <Yardanico> (procvar is default for quite a few years now) |
06:17:53 | FromDiscord | <Yardanico> @reilly well no one's to blame 😛 just don't say "it's complaining" |
06:17:58 | FromDiscord | <Yardanico> post the error message/question |
06:17:59 | FromDiscord | <Yardanico> (edit) 'post the error message/question ... ' => 'post the error message/questionright away' |
06:18:08 | FromDiscord | <Elegant Beef> Yea this is getting annoying imo |
06:18:26 | FromDiscord | <Elegant Beef> Without the error we can only say "RTFM please" 😛 |
06:18:47 | FromDiscord | <reilly> sent a code paste, see https://play.nim-lang.org/#ix=2rG3 |
06:19:04 | FromDiscord | <Yardanico> well yes |
06:19:08 | FromDiscord | <reilly> I tried changing the stuff in brackets for `var hook: Thread[void]`, but that changed nothing. |
06:19:08 | FromDiscord | <Yardanico> a thread proc shouldn't have a return type |
06:19:17 | FromDiscord | <Yardanico> proc HookThread() = # body |
06:19:45 | FromDiscord | <Yardanico> if you want to communicate between threads, you either use channels or raw pointers |
06:20:28 | FromDiscord | <reilly> sent a code paste, see https://play.nim-lang.org/#ix=2rG4 |
06:20:45 | FromDiscord | <Yardanico> it's a nim proc |
06:20:50 | FromDiscord | <Yardanico> it shouldn't have stdcall convention 🙂 |
06:20:54 | FromDiscord | <Yardanico> it's clear from the error |
06:21:08 | FromDiscord | <Yardanico> so just remove {.stdcall.} |
06:22:09 | FromDiscord | <reilly> That first one was my own fault, the second one makes sense I guess, but is a bit contradictory from earlier discussion. I think it should be fine, though. |
06:22:22 | FromDiscord | <Yardanico> It's not really contradictory |
06:22:33 | FromDiscord | <Yardanico> {.stdcall.} should be only for procedures you want to pass as callbacks to the winapi side |
06:22:49 | FromDiscord | <Yardanico> you're still calling this proc from Nim code itself, so it shouldn't really have {.stdcall.} |
06:23:43 | FromDiscord | <reilly> Fair enough. Perhaps I was relying a bit too hard on the reference C code; I mean, some of the functions have arguments that aren't even used in the functions themselves. |
06:24:18 | * | marnix_ joined #nim |
06:24:27 | * | marnix quit (Read error: Connection reset by peer) |
06:30:33 | FromDiscord | <reilly> Thank you all very much for your help. |
06:33:50 | * | marnix joined #nim |
06:33:51 | * | marnix_ quit (Read error: Connection reset by peer) |
06:35:55 | * | Cthalupa joined #nim |
06:36:25 | * | marnix_ joined #nim |
06:38:20 | * | marnix quit (Ping timeout: 258 seconds) |
06:38:51 | FromDiscord | <Elegant Beef> No problem |
06:39:01 | FromDiscord | <Elegant Beef> Although i didnt do much other than sass |
06:44:18 | * | marnix joined #nim |
06:44:18 | * | marnix_ quit (Read error: Connection reset by peer) |
06:49:10 | * | endragor quit (Remote host closed the connection) |
06:49:38 | * | endragor joined #nim |
06:49:44 | * | marnix_ joined #nim |
06:50:14 | * | marnix quit (Read error: Connection reset by peer) |
06:51:22 | * | Cthalupa quit (Ping timeout: 258 seconds) |
06:53:45 | * | Cthalupa joined #nim |
06:54:13 | * | endragor quit (Ping timeout: 264 seconds) |
06:55:09 | * | marnix joined #nim |
06:56:17 | * | endragor joined #nim |
06:58:48 | * | marnix_ quit (Ping timeout: 256 seconds) |
06:58:48 | * | marnix quit (Read error: Connection reset by peer) |
06:59:02 | * | marnix joined #nim |
07:01:58 | * | endragor quit (Ping timeout: 260 seconds) |
07:03:24 | * | marnix quit (Read error: Connection reset by peer) |
07:03:27 | * | endragor joined #nim |
07:05:49 | FromDiscord | <Varriount> @reilly Perhaps, one day, we can make bindings to the Nim API that are actually usable, without being painful. |
07:05:58 | FromDiscord | <Varriount> *Windows API |
07:06:09 | FromDiscord | <Varriount> (edit) 'Nim' => 'Windows' |
07:09:24 | * | marnix joined #nim |
08:08:57 | * | fredrikhr joined #nim |
08:16:42 | * | oddp_ joined #nim |
08:22:21 | * | marnix quit (Read error: Connection reset by peer) |
08:52:06 | * | Shucks joined #nim |
09:09:00 | FromDiscord | <impbox> So I just want a cross platform way to extract a zip file to a directory from my nim app (or nimble script ideally), seems https://nim-lang.org/0.11.0/zipfiles.html is no longer part of stdlib, there's "zip" which seems to require a separate dll, anything that doesn't add a new big dep? native nim would be nice |
09:26:01 | ForumUpdaterBot | New thread by Levlan: (Nimpy) code compiles with no nimpy pragma but doesn't with the pragma, see https://forum.nim-lang.org/t/6544 |
09:27:30 | Araq | impbox: iirc zipfiles also requires a DLL |
09:27:51 | Araq | and you shouldn't mind Nimble package dependencies |
09:28:20 | FromDiscord | <impbox> i don't mind nimble package dependencies |
09:28:28 | FromDiscord | <impbox> but i'd prefer my users don't need to install dlls |
09:28:55 | Araq | well it's Windows, put the DLL next to your .exe and stuff works |
09:29:38 | FromDiscord | <impbox> for windows, but i'd like this to be crossplatform |
09:29:57 | * | Tongir joined #nim |
09:30:05 | FromDiscord | <impbox> i just want people to be able to nimble install |
09:31:13 | Araq | I understand but I think it's hard. On the plus side, Unix users are used to the fact that nothing ever installs nor works so it's ok |
09:31:55 | Araq | nimble can finish with the lovely "to complete the installation run sudo apt-get zlib-dev" |
09:32:30 | FromDiscord | <impbox> for context, my `nico` nim lib has a tool to setup a new directory for their game with a nimble file ready to go to build it, but if they want to do an android build it needs a pretty hefty chunk of files (18MB) which i want to zip and have a tool to download and extract it into their game directory |
09:32:44 | * | Tlanger quit (Ping timeout: 272 seconds) |
09:33:40 | FromDiscord | <impbox> I guess so, i was just hoping there'd be a nice native nim way to do it, but all good if not, i'll find a way =) |
09:34:37 | * | waleee-cl joined #nim |
09:36:45 | FromDiscord | <impbox> interesting, binaries installed by nimble work, but don't seem to be in PATH |
09:37:27 | FromDiscord | <Varriount> @impbox you could write a native zip implementation |
09:37:36 | FromDiscord | <impbox> sent a code paste, see https://play.nim-lang.org/#ix=2rGD |
09:37:55 | FromDiscord | <impbox> @Varriount yeah I could.. I'd prefer not to =) but if someone's gotta do it... |
09:38:47 | FromDiscord | <Varriount> From what I've heard, it's not a terribly hard format to parse. Compression/decompression is the tricky bit. |
09:39:06 | FromDiscord | <impbox> I figure the work has been done, it's just translating it to nim |
09:39:13 | FromDiscord | <exelotl> @impbox lol reminds me of this nightmare i had once https://twitter.com/exelotl/status/641414796546560000/photo/1 |
09:39:48 | Araq | <exelotl> well it's the MingW shell |
09:40:02 | Araq | you deserve to be punished a little :P |
09:40:18 | FromDiscord | <impbox> @exelotl looks like the opposite! |
09:40:35 | Araq | damn. my cursor inference would be better if scope based |
09:40:42 | Araq | oh well |
09:40:58 | FromDiscord | <impbox> the issue I'm actually having is nimble can't exec my nimble installed binary |
09:40:58 | * | Shucks quit (Ping timeout: 272 seconds) |
09:41:34 | Araq | don't write pointer soups, Nim's optimizer will say "yeah, you're on your own" |
09:42:34 | * | debased joined #nim |
09:42:48 | * | debased quit (Client Quit) |
09:43:06 | FromDiscord | <flywind> I remember that I just pass the flags to make zip work in windows. |
09:43:10 | FromDiscord | <flywind> when defined(windows):↵ {.passl: "-lz".} |
09:44:08 | * | Shucks joined #nim |
09:46:36 | FromDiscord | <impbox> flywind, ooh that seems to work even with no .dll |
09:46:38 | FromDiscord | <impbox> awesome |
09:47:10 | Araq | that's a static build against z then or something |
09:47:27 | FromDiscord | <impbox> seems like it |
09:47:32 | FromDiscord | <impbox> close enough ( '')b |
10:01:11 | * | Shucks quit (Quit: Leaving) |
10:10:11 | * | B4s1l3 joined #nim |
10:10:12 | * | B4s1l3 is now known as opDispatch |
10:19:14 | * | sagax quit (Quit: Konversation terminated!) |
10:22:37 | * | nikita` joined #nim |
10:26:17 | * | sagax joined #nim |
10:29:35 | FromDiscord | <Varriount> Araq: What do you think of the PR for detecting stack-escapes? |
10:30:02 | FromDiscord | <impbox> so if i tell nimble `exec "nicoboot.cmd"` it works, but not `exec "nicoboot"` even though both exist in `~/.nimble/bin` |
10:30:28 | FromDiscord | <Varriount> @impbox I would use process monitor to figure out what's going on. |
10:31:00 | FromDiscord | <impbox> hmm never tried that, is it like strace or something? |
10:32:30 | FromDiscord | <Varriount> Pretty much. |
10:33:09 | FromDiscord | <Varriount> It won't trace internal calls (like memcpy, etc) however it does log things like filesystem access, windows API calls, etc. |
10:33:18 | FromDiscord | <impbox> mmm cool, yeah |
10:33:37 | FromDiscord | <impbox> sounds like strace |
10:38:43 | FromDiscord | <dom96> @impbox regarding unzipping, choosenim used to use `unzip` on Linux/macOS and some Windows API on Windows. It worked well. |
10:39:14 | FromDiscord | <dom96> Now it uses nimarchive which statically links against an archive library. You can give it a try if you'd like (but I personally am not fond of it) |
10:39:49 | FromDiscord | <impbox> @dom96 thanks for the info, i'll check those out |
10:40:08 | FromDiscord | <impbox> though currently using "zip" and it seems to work if i tell it to passL:-lz |
10:40:19 | FromDiscord | <impbox> only tested on windows though |
10:41:48 | FromDiscord | <impbox> aha `try: exec fmt"nicoboot installAndroid" except: exec fmt"nicoboot.cmd installAndroid"` |
10:42:02 | FromDiscord | <impbox> dirty but it seems to work |
10:43:49 | FromDiscord | <Varriount> impbox: That's horrible and you should be ashamed. 😛 |
10:46:32 | FromDiscord | <impbox> i am |
10:46:44 | FromDiscord | <impbox> but really want to just get this nico android build support out |
10:52:28 | * | couven92 joined #nim |
10:55:30 | * | fredrikhr quit (Ping timeout: 256 seconds) |
10:57:32 | FromGitter | <tim-st> is there a concept of Reader and Writer in nim like in Go or Rust, or is it planned? |
11:02:39 | FromDiscord | <Varriount> tim-st: You mean, like for a stream? |
11:03:37 | FromDiscord | <impbox> @dom96 is there a way to exec in a subdir in nimble? |
11:03:44 | FromDiscord | <impbox> doesn't seem like setCurrentDir is available |
11:04:03 | FromGitter | <tim-st> Varriount: yes, in this context, but also to allow creating generic Readers and Writers that can be easily replaced in a code based |
11:05:20 | FromGitter | <tim-st> *code base |
11:05:43 | FromGitter | <tim-st> and also chained |
11:09:42 | FromDiscord | <Varriount> tim-st: There is the functionality in the streams module, but unfortunately that is it. |
11:10:38 | FromDiscord | <Varriount> The design of the streams module has merit, but I think it could be revisited and improved, especially with the introduction of concepts and destructors. |
11:11:26 | FromGitter | <tim-st> yes, I hop the concept of Readers and Writers will be introduced or at least like in rust, that's one thing I think is missing in nim |
11:11:45 | FromDiscord | <impbox> tim-st, how do you use it? how does it differ from streams? |
11:11:51 | FromDiscord | <impbox> what advantages does it give? |
11:12:32 | FromGitter | <tim-st> can streams be used to chain multiple streams? |
11:12:46 | FromGitter | <tim-st> uncompress a stream buffered in chunks? |
11:13:30 | FromGitter | <tim-st> and define a common signature that everyone knows and uses to create new Readers in their libraries? |
11:14:08 | FromDiscord | <Varriount> Streams can technically be used in that way, yes. |
11:14:11 | FromDiscord | <impbox> I haven't tried, but you could inherit from `Stream` right? |
11:14:36 | FromDiscord | <impbox> and implement whatever underlying system |
11:14:53 | FromDiscord | <impbox> and anyeone can use the standard stream interface |
11:15:25 | FromDiscord | <impbox> https://github.com/nim-lang/Nim/blob/version-1-2/lib/pure/streams.nim#L109 you just need to implement those procs? |
11:15:51 | FromGitter | <tim-st> for me it's not immediately clear, how this works |
11:15:54 | FromDiscord | <Varriount> The biggest deficiency I see with the streams module is that it combines multiple concepts - such as seekability, etc. |
11:16:05 | FromGitter | <tim-st> in Go it's immediately clear to me, e.g.: https://godoc.org/github.com/tim-st/go-zim#File.BlobReader |
11:16:58 | FromDiscord | <impbox> tim-st look at FileStream's implementation https://github.com/nim-lang/Nim/blob/version-1-2/lib/pure/streams.nim#L1188 you could do something like that for whatever you're interfacing with |
11:16:58 | FromDiscord | <Varriount> Here, let me write up an example. |
11:17:46 | FromDiscord | <impbox> in `newFileStream` they assign the implementation procs (basically function pointers) |
11:18:11 | * | Cthalupa quit (Ping timeout: 240 seconds) |
11:18:14 | FromGitter | <tim-st> Yes, that sounds quite difficult instead of justing passing Reader(otherReader) |
11:18:42 | FromDiscord | <impbox> tim-st i'm talking about creating the other reader, not using it |
11:19:15 | FromDiscord | <impbox> to use it you just call `var foo = newFooStream(pathOrWhatever)` |
11:19:19 | FromDiscord | <impbox> then use foo like any other stream |
11:19:53 | FromDiscord | <impbox> what kind of Reader are you trying to make? |
11:20:15 | FromGitter | <tim-st> ok, that could work, but then there are examples missing that propagate that technique |
11:21:05 | FromGitter | <tim-st> I think a buffered reader would be a good first step |
11:21:23 | FromDiscord | <Varriount> tim-st: Yes, the streams module isn't polished or as built up as Go, Rust, or many other languages. |
11:21:37 | FromGitter | <tim-st> yes |
11:22:17 | FromDiscord | <Varriount> The reality is that, unlike those languages, Nim has very few developers (and even fewer paid developers). Most of the development time is spent focusing on the language. |
11:23:27 | * | Cthalupa joined #nim |
11:23:43 | FromDiscord | <Varriount> If you want to improve the streams module, or write a better replacement, it would be very much welcome. Personally, I dislike the fact that the `streams` type assumes that a stream will support certain features (seekability, etc.), so if that could become a compile-time guarantee, that's one improvement. |
11:24:59 | FromGitter | <tim-st> ok, when I have time the next week, I will try to copy the Go buffered reader with nim's style |
11:25:49 | FromDiscord | <Varriount> Another big improvement would be some way of wrapping a stream object, rather than a stream reference. All the other languages I'm familiar with that have a reader/writer/bufferedstream/etc model require that streams are pointers/references. This is rather inefficient memory-wise, since it means that quite a bit of pointer-chasing is required. |
11:28:30 | FromDiscord | <Varriount> @tim-st : If you do go with the Go model, you will likely need to use the same pattern as seen in the streams module - a structure with a number of procedure values. Nim doesn't have the kind of interface abstraction that Go does (as to why, mainly because such an abstraction costs quite a lot in terms of performance, if the compiler isn't specifically written to optimize it) |
11:29:34 | FromDiscord | <impbox> Couldn't you use a Concept? |
11:29:46 | FromDiscord | <impbox> That seems like the ideal use case |
11:30:16 | FromGitter | <tim-st> concept would work like rust read-trait I think |
11:30:19 | * | vicfred_ joined #nim |
11:30:41 | FromGitter | <tim-st> I think I tried to implement it one time, and it didnt really work |
11:30:49 | FromDiscord | <Rika> Why so? |
11:31:08 | FromGitter | <tim-st> I think it was because the concept wasnt stable enough |
11:31:44 | FromDiscord | <Clyybber> do you want runtime dispatch? |
11:31:51 | FromDiscord | <Clyybber> if not a simple concept should do all the tricks |
11:31:57 | FromDiscord | <Clyybber> simply check for the presence of read |
11:31:59 | FromDiscord | <Clyybber> or write |
11:32:15 | FromGitter | <tim-st> runtime dispatch wouldnt be needed for the read-trait approach, I think |
11:32:30 | FromGitter | <tim-st> yes, this was my idea |
11:32:35 | * | vicfred quit (Ping timeout: 240 seconds) |
11:32:35 | FromDiscord | <Clyybber> That would require inheritance then I think |
11:32:53 | FromGitter | <tim-st> define a nim stdlib concept that is the normal concept everyone should use |
11:33:31 | FromDiscord | <Rika> ? What do you mean |
11:34:37 | FromGitter | <tim-st> like this: https://doc.rust-lang.org/std/io/trait.Read.html |
11:35:13 | FromGitter | <tim-st> clearly defined and everyone uses it in their own reader libraries -> other can easily implement it without researching one week the idea behind it |
11:36:11 | FromDiscord | <Clyybber> seems simple enough. I guess the tricky part is how we define that errors should be handled |
11:36:40 | FromGitter | <tim-st> yes, error handling was the other thing that is currently not perfect in nim, imo |
11:37:01 | FromGitter | <tim-st> but at least it is easy to use |
11:37:23 | FromDiscord | <dawmarkir> bruh, how do you encode binary to text to store it using db_sqlite? |
11:38:16 | FromDiscord | <Clyybber> tim-st: WDYM, how could it be better? |
11:38:33 | FromGitter | <tim-st> you mean exceptions? |
11:38:45 | FromDiscord | <Clyybber> yeah, whatever you use for error handling |
11:39:07 | FromGitter | <tim-st> like java does it: guarantee at each call that there could be an exception |
11:39:39 | FromGitter | <tim-st> or introduce the "error or" like in `v` but that would make nim too different |
11:39:48 | FromDiscord | <Rika> there's the {.raises.} pragma though? |
11:40:00 | FromGitter | <tim-st> yes, but it is optional afaik |
11:40:08 | FromDiscord | <Clyybber> > guarantee at each call that there could be an exception↵wdym? |
11:40:10 | FromDiscord | <Rika> and is that bad? |
11:41:12 | FromGitter | <tim-st> I mean that the user can ignore procs that raise exceptions without showing that it is known to the user |
11:41:18 | FromDiscord | <Rika> its optional, but if you use procs w/o raises in a proc w/ `raises: []` then it still ensures that you catch all exceptions |
11:41:26 | FromDiscord | <Clyybber> what rika said :D |
11:41:29 | FromDiscord | <Rika> yeah, and? |
11:41:36 | FromDiscord | <Rika> you can choose to care or not |
11:41:52 | FromDiscord | <Rika> even if someone who made a library didnt care, you can still choose to care |
11:41:55 | FromDiscord | <Rika> and it will still work |
11:42:11 | FromGitter | <tim-st> yes, but maybe I dont always remember it |
11:42:21 | FromDiscord | <Clyybber> then {.push: raises[].} |
11:42:21 | FromGitter | <tim-st> and then it will crash unexpected |
11:42:55 | FromDiscord | <Clyybber> tim-st: Theres always the tradeoff of actually writing code that handles the cases its designed for or spending hours explicitly handling all failure/unexpected cases |
11:43:00 | FromDiscord | <Clyybber> exceptions allow you to choose |
11:43:23 | FromDiscord | <Clyybber> languages that return error codes and have macros just build exceptions around that |
11:43:28 | FromDiscord | <Clyybber> but then there is no difference |
11:43:30 | FromDiscord | <Rika> you can always push the pragma at the top of your file and it will retain that until you pop |
11:43:48 | FromDiscord | <Clyybber> for example OOM could be an exception |
11:43:59 | FromDiscord | <Clyybber> but would be extremely annoying to be return error |
11:45:21 | * | j4nvkvc joined #nim |
11:48:30 | FromGitter | <tim-st> maybe the error of the concept could be modelled an an optional, I think nim has this type |
11:48:51 | FromGitter | <tim-st> https://nim-lang.org/docs/options.html#Option |
11:49:35 | FromGitter | <tim-st> but this then likely is not compile time anymore |
11:50:58 | FromDiscord | <Clyybber> wdym is not compile time anymore? |
11:51:08 | FromDiscord | <Clyybber> using Options is fine, but they don't have an error field |
11:52:00 | FromDiscord | <Clyybber> What you want is https://github.com/arnetheduck/nim-result |
11:54:47 | FromGitter | <tim-st> yes, this could work, but sounds like chaining wouldnt be that easy |
11:56:28 | shashlick | @impbox you have withDir to exec inside a directory |
11:56:39 | * | rockcavera joined #nim |
11:59:38 | shashlick | Also, nimterop makes it easy to download binaries of zlib with minimal effort, let me know if you want details |
12:03:47 | bung | can I use niv |
12:04:03 | bung | same port as http server |
12:04:10 | bung | https://github.com/niv/websocket.nim |
12:05:18 | * | krux02 joined #nim |
12:06:01 | * | supakeen quit (Quit: WeeChat 2.8) |
12:06:38 | * | supakeen joined #nim |
12:10:40 | * | haxscramper joined #nim |
12:17:45 | * | Trustable joined #nim |
12:19:15 | haxscramper | I have template which uses `deques` interally - in order for it to compile correctly user either has to `import deques` in their code or I need to `export deques` from module where template is defined. |
12:19:16 | haxscramper | Second approach only works once - e.g if someone uses my template in |
12:19:16 | haxscramper | their template it is still necessary to `export deques` again. This is |
12:19:16 | haxscramper | an easy solution but it will cause deques to be imported whenewher I |
12:19:18 | haxscramper | use my module. |
12:19:21 | haxscramper | Is there some way to fix this or I just have to document this as |
12:19:25 | haxscramper | requirement for template? |
12:21:02 | FromDiscord | <Rika> I think mixins have to do with it or something but I don't know how to precisely describe kt |
12:21:02 | FromDiscord | <Rika> It |
12:21:02 | FromDiscord | <Varriount> haxscramper: https://nim-lang.org/docs/manual.html#generics-bind-statement |
12:21:06 | FromDiscord | <Varriount> That might work, although it's more for generics, so I don't know if it will work with templates. |
12:23:02 | haxscramper | No, does not work with templates. |
12:24:00 | haxscramper | Need to test ho much does `export <module>` affects compilation time then |
12:24:54 | FromDiscord | <lqdev> `mixin` works in templates |
12:28:05 | haxscramper | Oh, yes it does. Very strange though - from documentation it seems like they have opposite behaviour and `bind` is what I need here. |
12:49:56 | FromDiscord | <Clyybber> bind statement works in templates |
12:53:35 | FromDiscord | <Clyybber> but maybe not the way you expect it to |
12:53:38 | narimiran | Guido van Rossum has just made Araq's day 1000x better: https://lwn.net/Articles/823292/ :) |
12:54:58 | FromDiscord | <Clyybber> lol, why? |
12:55:17 | FromDiscord | <Clyybber> because it got rejected? |
12:55:37 | narimiran | nah, because he even considered it |
12:55:46 | narimiran | "nim was right. again" |
12:56:10 | FromDiscord | <Clyybber> nim was right. |
12:56:14 | FromDiscord | <Clyybber> and with the rejection |
12:56:20 | FromDiscord | <Clyybber> nim will be the only one right. |
12:56:42 | narimiran | for those that just skimmed through the article, i'm talking specifically about the "Really, *any* method" part |
12:56:47 | Oddmonger | i always type «print» instead of «echo» in nim |
12:57:14 | Oddmonger | because i have fought on the «echo» reflex for years, outside of the shell, and won at the end |
12:57:14 | FromDiscord | <Clyybber> heh, just alias it |
12:57:55 | Oddmonger | is it permit ? Won't you find me at night with torches, ropes and so ? |
12:58:02 | narimiran | we will |
12:59:04 | FromDiscord | <Clyybber> you will hear the echo of your screams |
12:59:14 | narimiran | :) |
12:59:56 | FromDiscord | <KingDarBoja> Lmao, that Python post is sooo Nim |
13:02:08 | * | chemist69 quit (Ping timeout: 256 seconds) |
13:03:02 | * | chemist69 joined #nim |
13:03:12 | * | couven92 is now known as fredrikhr |
13:10:27 | bung | https://github.com/pragmagic/karax/pull/149 I create static server and websocket reload for karax |
13:10:27 | disbot | ➥ add static server,websocket refresh watching mode |
13:18:10 | * | NimBot joined #nim |
13:22:18 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
13:24:33 | * | fredrikhr quit (Read error: Connection reset by peer) |
13:24:57 | * | fredrikhr joined #nim |
13:46:19 | * | vicfred_ quit (Quit: Leaving) |
13:46:38 | * | vicfred joined #nim |
13:47:23 | Araq | narimiran, not sure I get the point |
13:47:38 | Araq | the reaction was predictably silly |
13:59:03 | FromDiscord | <Clyybber> Araq: Should tyAlias be removed? |
13:59:22 | FromDiscord | <Clyybber> So that `type A = B` is internally `type A[] = B[]` |
14:00:13 | FromDiscord | <Clyybber> (edit) 'A[]' => 'A[T]' | 'B[]`' => 'B[T]`' |
14:00:30 | Araq | well tyAlias was introduced as a bugfix |
14:00:46 | Araq | usually things start out as simple and bugfixes introduce the complexity |
14:01:27 | FromDiscord | <Shucks> Im getting crazy with vscode again |
14:01:36 | FromDiscord | <Shucks> gosh |
14:02:02 | FromDiscord | <Clyybber> Araq: Yeah, I'm wondering if theres advantages to treating `type A = B` as an tyAlias instead of a generic |
14:02:27 | FromDiscord | <Clyybber> Or if it was just because generics were too buggy at the time it was introduced |
14:10:21 | * | abm joined #nim |
14:19:30 | * | narimiran quit (Ping timeout: 256 seconds) |
14:20:29 | * | drewr quit (Quit: brb) |
14:24:53 | * | marnix joined #nim |
14:25:05 | * | bung quit (Quit: Lost terminal) |
14:25:34 | * | marnix_ joined #nim |
14:25:42 | * | marnix quit (Read error: Connection reset by peer) |
14:25:54 | * | sentreen quit (Ping timeout: 240 seconds) |
14:29:43 | * | marnix joined #nim |
14:29:59 | Araq | it never occured to me to treat them as generic |
14:30:38 | Araq | tyAlias reflects what's really going on, however. ideally we would eliminate type aliases early |
14:31:01 | Araq | so that type Alias = int; seq[Alias] is always constructed as seq[int] |
14:32:32 | * | drewr joined #nim |
14:32:32 | * | marnix_ quit (Ping timeout: 256 seconds) |
14:36:13 | * | marnix_ joined #nim |
14:38:46 | * | marnix quit (Ping timeout: 256 seconds) |
14:39:36 | Araq | also, a generic type has parameters, an alias does not |
14:43:37 | * | waleee-cl joined #nim |
14:45:20 | FromDiscord | <Clyybber> Yeah, my idea was to replace alias by generic type without parameters |
14:46:37 | FromDiscord | <Clyybber> But I'm not if its a good idea |
14:46:51 | * | chemist69 quit (Quit: WeeChat 2.7) |
14:47:23 | Araq | lol |
14:47:27 | * | chemist69 joined #nim |
14:47:29 | Araq | while line != "": |
14:47:41 | Araq | match(line) # wasMoved(line) ?! |
14:47:50 | Araq | return # DFA rules... |
14:48:16 | Araq | the compiler is getting smarter than me |
14:48:39 | * | chemist69 is now known as apahl |
14:49:27 | * | apahl quit (Client Quit) |
14:50:35 | FromDiscord | <Shucks> 😮 |
14:52:57 | * | maier quit (Ping timeout: 256 seconds) |
14:56:20 | * | sentreen joined #nim |
14:58:49 | * | apahl joined #nim |
14:59:15 | Araq | https://github.com/nim-lang/Nim/issues/14971 *sighs* |
14:59:16 | disbot | ➥ OrderedTable del and pop are slow ; snippet at 12https://play.nim-lang.org/#ix=2ryn |
14:59:48 | Araq | am I the only one who doesn't fill tables with millions of entries? |
15:00:29 | Araq | if you have millions of entries chances are getting high the data is valuable. valuable enough for a database. |
15:01:23 | Prestige | Slightly off topic looking at the issue, does github not have nim syntax highlighting or did they just not format the post correctly? |
15:01:55 | Araq | scroll down and see proper highlighting |
15:02:05 | Prestige | ah, good |
15:02:05 | Araq | it's just that the OP couldn't use ```nim |
15:03:02 | Prestige | I guess there could be use cases for large tables, but there are likely better data structures to use if you have so many entries |
15:06:06 | leorize[m] | guess someone have to implement a SQLite table module that use an in-memory table :P |
15:07:08 | * | Prestige posts a link to Redis |
15:08:30 | leorize[m] | @iffy I think there's an issue with asyncdispatch, I added an `echo` into the callback and it appears to me that it's only called for the first two times |
15:09:07 | * | rockcavera quit (Read error: Connection reset by peer) |
15:09:33 | * | rockcavera joined #nim |
15:10:27 | FromGitter | <iffy> That's what I was seeing, too. I wondered if the callbacks returning `true` cause more than just that callback to be removed from the prior addRead |
15:10:50 | planetis[m] | Would it be an "easy" pr to adapt tables.nim to use sparse list of indeces (like python's dictionaries), or it doesn't fit their implementation? |
15:11:28 | leorize[m] | probably wouldn't fit their implementation, since they require traversal to get to an index iirc |
15:11:34 | planetis[m] | *indices |
15:11:41 | Araq | planetis[m], I would love to see such a PR but beware that Python's impl is suboptimal too |
15:12:03 | leorize[m] | it might be better to name that `get` just so it signify the potential cost |
15:12:18 | leorize[m] | @iffy you might want to try adding some debugging lines into asyncdispatch |
15:12:34 | planetis[m] | I tried to figure it out myself, but there're so many templates, i always give up |
15:12:51 | leorize[m] | the code responsible should be `asyncdispatch.processBasicCallbacks` |
15:12:51 | Araq | yeah I know |
15:13:04 | FromGitter | <iffy> @leorize: good idea -- I'll probably get some time today to test that some more |
15:13:04 | Araq | we can start with a refactoring and remove some templates |
15:13:43 | Araq | however, it might result in code duplication which is almost always worse |
15:14:17 | Araq | see Miran's recent work on "parsePercent" which exists twice in the stdlib, yay |
15:14:25 | Araq | two locations where to fix the bug |
15:14:37 | planetis[m] | But there seems strtabs have survived without all these templates and could be a good place to start |
15:15:53 | Araq | strtabs is so weird |
15:15:55 | planetis[m] | If their implementation is in sync with tables, or they have diversed? |
15:16:07 | Araq | I dunno, strtabs is a zombie |
15:16:21 | Araq | unkillable, it predates Nim's generics |
15:16:55 | FromDiscord | <Clyybber> Araq: https://github.com/nim-lang/Nim/issues/14990 fails as an alias works as an explicit generic |
15:16:57 | disbot | ➥ Alias type forgets implicit generic params depending on order ; snippet at 12https://play.nim-lang.org/#ix=2rHC |
15:18:17 | FromDiscord | <Yardanico> @Clyybber looks a bit similar to my issue |
15:18:27 | FromDiscord | <Yardanico> Where changing the order fixes it too |
15:18:39 | FromDiscord | <Clyybber> oh? which one? |
15:18:48 | leorize | Araq: iirc you have an idea on how concepts should be done, right? any rfc coming from that? :P |
15:19:14 | FromDiscord | <Yardanico> https://github.com/nim-lang/Nim/issues/14758 |
15:19:15 | disbot | ➥ C compiler error with inline and a proc field in an object ; snippet at 12https://play.nim-lang.org/#ix=2qz4 |
15:19:38 | planetis[m] | One more question, compactdict (and python) change the type of the indices depending of the size of the hashtable. I think from int16 up to int64). Do we want to keep this logic, or always use int type? (Since its not idiomatic nim) |
15:20:16 | FromDiscord | <Clyybber> @Yardanico Thanks, I don't think its related, since mine fails in semcheck |
15:20:18 | Araq | always use int, Python only gets away with it since it already pays the heavy price of indirections |
15:20:41 | Araq | well "heavy", Intel moved into the unmeasurable noise level |
15:20:51 | Araq | but I heard ARM is becoming big |
15:22:29 | Araq | proc matchImpl(str: string, pattern: Regex, start, endpos: int, flags: int): Option[RegexMatch] = |
15:22:29 | Araq | var myResult = RegexMatch(pattern : pattern, str : str) |
15:23:04 | Araq | ^ sure, we should always return everything the callee already knows by construction. |
15:23:31 | Araq | objects should always contain everything some fool might need later on, nobody minds bloated code |
15:24:05 | Araq | oh and ':' is an infix operator so we use wrong spacing around it |
15:24:11 | * | Araq sighs |
15:25:48 | FromDiscord | <Yardanico> By the way, is it safe to create a string with newString(64) for example, and pass it to a POSIX call which expects a cstring? Like gethostname(cstring(mystr), 64) |
15:25:49 | * | marnix_ quit (Read error: Connection reset by peer) |
15:26:20 | FromDiscord | <Yardanico> And it'll modify mystr directly (it seems to work, so just asking to be sure) |
15:26:43 | leorize[m] | yes it's safe |
15:26:54 | leorize[m] | the same pattern is used in the stdlib |
15:27:08 | FromDiscord | <Yardanico> Ah okay then |
15:27:14 | * | marnix joined #nim |
15:27:22 | shashlick | @Yardanico - were you able to create a minimal example of the plugins failure with arc? |
15:27:34 | FromDiscord | <Yardanico> Not yet, no :( |
15:27:56 | FromDiscord | <Yardanico> I couldn't find the second place where CMD was getting destroyed yet |
15:28:01 | FromDiscord | <Yardanico> cmd* |
15:28:03 | shashlick | okay but might be able to describe the issue to araq and clyybber and see if it is an issue they will entertain |
15:29:43 | shashlick | Araq / Clyybber if you are around - file in question is https://github.com/genotrance/plugins/blob/master/tests/test1/plg1.nim#L11 - this is compiled with --app:lib and callCommand() is a proc in the main executable that loads the dll |
15:30:03 | shashlick | issue is that cmd gets destroyed and segfaults |
15:30:46 | FromDiscord | <Yardanico> But if we add GC_ref(cmd) it goes further |
15:30:54 | FromDiscord | <Yardanico> So it's getting destroyed here and somewhere else |
15:30:59 | FromDiscord | <Yardanico> Which is weird |
15:34:22 | FromDiscord | <Yardanico> Well actually it's not weird if I'm thinking correctly |
15:34:59 | FromDiscord | <Yardanico> So we pass cmd from a library to the host, and maybe we still use cmd after pluginLoad ended |
15:37:46 | FromDiscord | <Yardanico> @shashlick it's just that it was a bit hard for me to understand how plugins call each other in the example, order and stuff |
15:37:52 | FromDiscord | <Yardanico> Maybe I should just remove unused code first |
15:38:04 | shashlick | sounds fair |
15:38:51 | shashlick | cmd is created in pluginLoad, passed to main exe which modifies it, then returns to pluginLoad where it is printed |
15:39:24 | shashlick | cmd is a ref object and contents are modified in callCommand |
15:43:43 | FromDiscord | <Yardanico> By the way, is it possible to print the refcount of a ref object? I tried with copying stuff from refs_v2 and modifying it to return head(p).rc, but it seems to be some mask rather than just a count |
15:45:00 | FromDiscord | <Clyybber> shashlick: Can you just gc_ref it from the loaded library? |
15:45:16 | FromDiscord | <Clyybber> @Yardanico Hmm it should be possible |
15:45:27 | FromDiscord | <Yardanico> I know about nimArcDebug and traceArc but they didn't help in that case |
15:45:58 | FromDiscord | <Clyybber> @Yardanico you ahve to shift by rcShift |
15:46:02 | FromDiscord | <Clyybber> which is 4 |
15:46:13 | FromDiscord | <Clyybber> or 3 on gc:arc |
15:46:13 | FromDiscord | <Yardanico> Oh okay |
15:46:19 | FromDiscord | <Yardanico> I'll try soon |
15:46:28 | FromDiscord | <Clyybber> head(pc).rc shr rcShift |
15:48:06 | shashlick | Clyybber: i can but users of plugins won't know to call GC_ref like this |
15:48:24 | shashlick | simply interacting between main executable and dlls |
15:48:30 | FromDiscord | <Clyybber> hmm, do you compile with sinkInference on? |
15:48:43 | shashlick | haven't tried |
15:48:56 | FromDiscord | <Clyybber> try with --sinkInference:off and GC_ref from the main executable |
15:49:45 | FromDiscord | <Clyybber> and if that works try removing the sinkInference:off switch again |
15:50:10 | FromDiscord | <Yardanico> I tried without sink inference, but before I found out that GC_ref helps it get further |
15:50:22 | FromDiscord | <Yardanico> So I'll try |
15:52:31 | FromDiscord | <Yardanico> So this is valid Nim in the end https://github.com/nim-lang/Nim/issues/14985 ? |
15:52:33 | disbot | ➥ [ARC] proc with both explicit and implicit return results in a C compiler error ; snippet at 12https://play.nim-lang.org/#ix=2rEX |
15:55:07 | FromDiscord | <Clyybber> sure |
15:58:08 | FromDiscord | <Yardanico> what's interesting is that it seems to free the "cmd" from a library in the main binary |
15:58:27 | FromDiscord | <Yardanico> if I compile libraries without useMalloc, but the main binary with it - it crashes with "free(): invalid pointer" which comes from libc |
16:00:16 | FromDiscord | <Yardanico> but yeah @Clyybber , if I add GC_ref in callCommand it crashes later |
16:00:21 | FromDiscord | <Yardanico> although in same place with/without sinkInference |
16:00:58 | FromDiscord | <Clyybber> hmm ok, weird |
16:01:05 | FromDiscord | <Clyybber> add GC_ref twice :p |
16:01:12 | FromDiscord | <Yardanico> I already debugged a bit, and it crashes in a very different places |
16:01:14 | FromDiscord | <Yardanico> (edit) 'places' => 'place' |
16:01:16 | FromDiscord | <Clyybber> actually, maybe thats not that stupid |
16:01:44 | FromDiscord | <Clyybber> because if its getting sinked into loadPlugin |
16:01:45 | FromDiscord | <Yardanico> it crashes when it tries to access a table with plugins (with their handles and callbacks) |
16:01:52 | FromDiscord | <Clyybber> when you gc_ref it twice? |
16:02:01 | FromDiscord | <Yardanico> doesn't matter |
16:02:04 | FromDiscord | <Clyybber> ok |
16:02:07 | FromDiscord | <Yardanico> it's not related to cmd, that cmd seems to work fine |
16:02:10 | FromDiscord | <Clyybber> ok |
16:02:31 | FromDiscord | <Yardanico> it crashes on this line https://media.discordapp.net/attachments/371759389889003532/732990487379836938/unknown.png |
16:02:50 | * | lritter joined #nim |
16:03:32 | FromDiscord | <Yardanico> that manager.plugins[name] is not nil, but when accessing "depends" it crashes |
16:03:42 | FromDiscord | <Yardanico> depends is a seq[string] though |
16:03:49 | FromDiscord | <Yardanico> so maybe need another GC_ref |
16:03:59 | FromDiscord | <Yardanico> ah actually might be true |
16:04:07 | FromDiscord | <Yardanico> or not 😦 |
16:07:51 | FromDiscord | <Yardanico> also repr for arc can't print closures |
16:16:23 | disruptek | planetis, araq: you should consider using skiplists for the tables optimization. |
16:16:50 | FromDiscord | <Clyybber> hmm? but skiplists are good for ordered datastructores with fast insertion |
16:17:04 | leorize | idk why but writing C++ is making me hates programming |
16:17:05 | FromDiscord | <Clyybber> not necessarily tables where order doesn't matter I think |
16:17:10 | disruptek | yes, but you can define the order any way you want. |
16:17:11 | leorize | when will nim go mainstream to save me |
16:17:25 | FromDiscord | <lqdev> leorize: compile times? |
16:17:35 | leorize | headers |
16:17:39 | FromDiscord | <lqdev> ah. |
16:17:41 | leorize | and the fact that I have to write C++98 |
16:17:42 | FromDiscord | <lqdev> yeah, that's a PITA. |
16:17:57 | FromDiscord | <lqdev> why? |
16:18:02 | leorize | and that templates are pure shit here |
16:18:10 | FromDiscord | <lqdev> oof |
16:18:18 | leorize | the code has to compile on GCC < 3 :) |
16:18:24 | FromDiscord | <lqdev> but templates always were pure shit in c++ |
16:18:47 | disruptek | !repo skiplists |
16:18:47 | disbot | https://github.com/disruptek/skiplists -- 9skiplists: 11generic skip list implementations 15 1⭐ 0🍴 |
16:18:50 | FromDiscord | <Yardanico> @leorize what cursed hardware are you using it for |
16:18:59 | disruptek | it's not done yet, but it's pretty memory-efficient. |
16:19:09 | leorize | I have to write a class/struct to use a conditional expression as a template parameter |
16:19:27 | leorize | @Yardanico x86 |
16:19:30 | FromDiscord | <Clyybber> disruptek: I used skiplists for drawing order in my game |
16:19:44 | leorize | but Haiku's x86, aka BePC |
16:19:45 | FromDiscord | <Clyybber> but that was in lua :d |
16:19:49 | FromDiscord | <Clyybber> (edit) ':d' => ':D' |
16:19:58 | FromDiscord | <Yardanico> @leorize but Haiku supports modern GCC too, doesn't it? |
16:19:59 | FromDiscord | <Yardanico> at least latest betas |
16:20:47 | leorize | ofc it does, but system libraries have to be compatible with GCC 2 for x86 32bit support |
16:20:54 | FromDiscord | <Yardanico> ohh |
16:21:05 | FromDiscord | <Yardanico> so you're working on haiku then? 😛 |
16:21:41 | leorize | yep, I'm fixing their network stack |
16:22:21 | leorize | the api is terrible and I'm juggling with locks because they decided to persue threaded everything |
16:22:53 | FromDiscord | <Yardanico> at least it's better than global kernel lock like in some *BSDs 😛 |
16:22:59 | disruptek | it's annoying that i cannot work with pragmas on anything but procs within our macro system. |
16:23:10 | disruptek | or at least, the interface is different. |
16:23:30 | leorize | yea, proc pragmas remain the most straight forward one |
16:24:16 | leorize | all other forms are weird and practically useless |
16:24:26 | FromDiscord | <Yardanico> wdym |
16:24:33 | FromDiscord | <Yardanico> pragmas for object fields can be very useful |
16:24:52 | FromDiscord | <Yardanico> easiest example being serialization |
16:24:52 | leorize | except that type section pragma is broken :) |
16:25:08 | FromDiscord | <Stuffe> lol i just got geohotz to try Nim live on twitch |
16:25:29 | FromDiscord | <Clyybber> disruptek: Eh, whats the down pointer do? |
16:25:37 | FromDiscord | <Clyybber> Does it point to the same element but in a lower level? |
16:25:40 | FromDiscord | <Yardanico> @Stuffe why brew |
16:25:41 | FromDiscord | <Yardanico> nOOO |
16:25:55 | FromDiscord | <Recruit_main707> > lol i just got geohotz to try Nim live on twitch↵@Stuffe link? |
16:26:00 | FromDiscord | <Yardanico> https://www.twitch.tv/georgehotz seems like |
16:26:01 | leorize[m] | oi, brew got one of the best nim setup |
16:26:07 | FromDiscord | <Stuffe> https://www.twitch.tv/georgehotz |
16:26:08 | FromDiscord | <Stuffe> yeah |
16:26:10 | leorize[m] | it actually works, unlike choosenim |
16:26:25 | disruptek | clyybber: it points to a new element at a lower level that may share the same value. |
16:26:41 | leorize[m] | (actually don't quote me on choosenim, I've only heard people and haven't tried it) :P |
16:27:05 | FromDiscord | <Yardanico> copy-pasting commands 😄 |
16:27:10 | FromDiscord | <Clyybber> disruptek: But it will always share the same value no? |
16:27:15 | leorize[m] | but the brew package is pretty well made |
16:27:40 | disruptek | clyybber: the idea is to "waste" the value but gain the elegance that every skiplist is a skiplist of a skiplist. |
16:28:08 | FromDiscord | <Clyybber> @Stuffe tell him to use https://github.com/alaviss/nim.nvim/ pls |
16:28:31 | disruptek | you could convince me to do it with "tall" elements, or submit a pr that adds them adjacently. |
16:28:46 | FromDiscord | <Stuffe> pasted it |
16:28:53 | FromDiscord | <Yardanico> @Clyybber that's not for vim |
16:28:57 | FromDiscord | <Yardanico> it's for neovim |
16:29:22 | disruptek | i use pragmas to pass information between parts of my cps macro. |
16:29:31 | FromDiscord | <Clyybber> @Yardanico figured he'd use nvim |
16:29:34 | FromDiscord | <Clyybber> neovim |
16:29:36 | FromDiscord | <Yardanico> seems to be plain vim |
16:29:52 | FromDiscord | <Clyybber> disruptek: Theres no elegance in wasting memory :p |
16:29:57 | FromDiscord | <Yardanico> inb4 crash |
16:30:00 | FromDiscord | <Yardanico> compiler crash 😛 |
16:30:05 | FromDiscord | <Clyybber> just use a seq to store the pointers for each level |
16:30:13 | disruptek | i think you'll find it wastes much less memory than a seq. |
16:30:19 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/732997482312630403/unknown.png |
16:30:19 | FromDiscord | <Yardanico> 😛 |
16:30:28 | haxscramper | If generic in other module does not have `mixin` statement on some symbol I have to import that module in caller? For example `sets.difference` internally uses `items` - it is not possible to write generic proc that uses `difference` and use it [proc] without importing `sets`. Or I'm missing something again? Example code: https://play.nim-lang.org/#ix=2rI0 |
16:30:28 | haxscramper | It also works If I add `mixin items` *AND* edit stdlib source code to call `items` explicitly (e.g `for item in items(s1)`). When used implicitly (`for item in s1`) it does not work. |
16:30:41 | FromDiscord | <treeform> mbuchel, thank you for doing the compression part for ws. |
16:30:49 | FromDiscord | <Clyybber> disruptek: No. It wastes O(n) memory |
16:31:06 | leorize | oh hey someone just said they use Nim in production :P |
16:31:19 | FromDiscord | <treeform> I use nim in production? |
16:31:23 | disruptek | no, because it costs no memory at the bottom and only 1-3 ptrs per extra level. |
16:31:28 | leorize | on twitch I mean |
16:31:47 | FromDiscord | <Recruit_main707> someone tell him how to use arrays pls |
16:31:53 | FromDiscord | <Yardanico> to use sequences* |
16:31:56 | FromDiscord | <Stuffe> lol its painful to watch |
16:32:01 | FromDiscord | <Stuffe> ah he found out |
16:32:23 | FromDiscord | <Clyybber> disruptek: Eh, you waste sizeof(value) * levels |
16:32:32 | FromDiscord | <Clyybber> Just store the value once |
16:32:44 | FromDiscord | <Clyybber> And use a seq for the leveled pointers |
16:32:49 | disruptek | yes, but the value is just a ptr. |
16:33:05 | FromDiscord | <Clyybber> How do you know? |
16:33:14 | disruptek | because i'm the one impl it. |
16:33:21 | FromDiscord | <Clyybber> but then its not generic? |
16:33:39 | disruptek | sure it is. the word is "implementations". this is the impl i needed. |
16:33:43 | disruptek | more will follow. |
16:33:56 | disruptek | it's like you guys forget that you can pr projects other than the compiler. |
16:34:14 | FromDiscord | <Clyybber> sent a code paste, see https://play.nim-lang.org/#ix=2rI5 |
16:34:15 | FromDiscord | <Clyybber> Use this ^ |
16:34:25 | disruptek | no. |
16:34:41 | FromDiscord | <Yardanico> @Stuffe he thinks that nim is python |
16:34:42 | FromDiscord | <Clyybber> ¯\_(ツ)_/¯ |
16:34:47 | disruptek | submit a pr. |
16:35:20 | FromDiscord | <Stuffe> he knows it compiled though obviously |
16:35:40 | FromDiscord | <Yardanico> but he thinks it's a python clone or something 😛 |
16:35:56 | FromDiscord | <Stuffe> true |
16:36:03 | FromDiscord | <Yardanico> also len(a) is incorrect |
16:36:05 | FromDiscord | <Yardanico> p ..< len(a) |
16:37:04 | leorize | or `[p..^1]` like a sane person :P |
16:38:08 | FromDiscord | <Yardanico> he doesn't like inclusive slices |
16:38:11 | FromDiscord | <Stuffe> haha |
16:38:14 | FromDiscord | <Yardanico> see |
16:38:19 | FromDiscord | <Yardanico> he thinks nim is python |
16:38:30 | leorize | > "that doesn't match python" lmao |
16:38:49 | FromDiscord | <Yardanico> "let var" 😄 |
16:38:52 | leorize | > `let var` rust confirmed |
16:38:55 | FromDiscord | <Yardanico> i'm waiting for a compiler crash |
16:39:10 | leorize | !eval let var a = 0 |
16:39:12 | NimBot | Compile failed: /usercode/in.nim(1, 5) Error: identifier expected, but got 'keyword var' |
16:39:18 | leorize | nah won't crash |
16:39:35 | FromDiscord | <treeform> why georgehotz has so many viewers? |
16:39:42 | FromDiscord | <Stuffe> All I told him was "nim is so good I can't use python anymore" |
16:39:52 | * | fredrikhr quit (Quit: Client Disconnecting) |
16:39:57 | FromDiscord | <Yardanico> he thinks nim is python and rust ?? |
16:40:05 | FromDiscord | <Clyybber> really annoying when you can't write because paywall |
16:40:08 | leorize | ok I'm not looking at that stream anymore for my sanity :P |
16:40:13 | FromDiscord | <Yardanico> @Clyybber it's not |
16:40:15 | FromDiscord | <Yardanico> follow is free |
16:40:17 | FromDiscord | <Stuffe> he jail broke the first iphone and the playstation |
16:40:19 | FromDiscord | <Clyybber> oh |
16:40:20 | FromDiscord | <Yardanico> but you need to wait 10 minutes after that |
16:40:30 | FromDiscord | <Stuffe> i think thats mainly why he is known |
16:40:41 | FromDiscord | <Yardanico> he could've ported the python impl easily |
16:41:25 | FromDiscord | <Yardanico> well he's having progress 😛 |
16:41:26 | leorize[m] | well don't blame him too much, performing on stream isn't easy :P |
16:41:37 | FromDiscord | <Yardanico> what memory leak? |
16:41:38 | FromDiscord | <Yardanico> LMAO |
16:41:46 | FromDiscord | <Yardanico> he doesn't know about the gc 😛 |
16:42:31 | FromDiscord | <Yardanico> he's done @Shucks |
16:42:44 | FromDiscord | <Yardanico> @Stuffe * |
16:42:46 | FromDiscord | <Shucks> huh |
16:43:52 | FromDiscord | <Yardanico> well there was a person in chat using Nim |
16:43:55 | FromDiscord | <Yardanico> so we're not *that* unpopular 🙂 |
16:44:53 | FromDiscord | <Yardanico> That's this person - https://www.youtube.com/watch?v=jr3W2NCR0AM |
16:44:53 | disruptek | take some notes on what trips up a newbie. |
16:45:14 | FromDiscord | <Yardanico> @disruptek well georgehotz seems to be pretty experienced in programming |
16:45:16 | FromDiscord | <Yardanico> and googled fast |
16:45:23 | FromDiscord | <Stuffe> yeah array vs sequence and the inclusive indexing thing |
16:45:30 | FromDiscord | <Yardanico> but really he tripped on some stuff because he assumed nim to be python and rust |
16:45:32 | FromDiscord | <Stuffe> tripped me up too once I think |
16:45:43 | disruptek | take some notes, please. |
16:45:47 | FromDiscord | <Yardanico> saying "looks like python" is a double-edged sword |
16:45:47 | FromGitter | <alehander92> ohh |
16:45:51 | disruptek | i don't have the bandwidth for video. |
16:46:02 | FromGitter | <alehander92> yeah |
16:46:06 | FromGitter | <alehander92> lisp + python + c++ |
16:46:12 | leorize | we really need to fix our pr material :P |
16:46:12 | FromGitter | <alehander92> seems a bit better to me |
16:46:15 | FromDiscord | <Yardanico> e.g. he used "let var a = 5" |
16:46:20 | FromDiscord | <Yardanico> because he assumed "let" to be "like in rust" |
16:46:26 | FromDiscord | <Yardanico> even though nim had it before rust even existed 😛 |
16:46:39 | FromGitter | <alehander92> but it's very old |
16:46:44 | FromGitter | <alehander92> i think it's lisp |
16:46:52 | FromGitter | <alehander92> the idea of `let` as naming a name |
16:46:56 | FromDiscord | <Yardanico> nonono |
16:47:00 | FromDiscord | <Yardanico> ah well yeah if you mean let |
16:47:07 | FromGitter | <alehander92> we can |
16:47:07 | FromDiscord | <Yardanico> but well, people don't know that usually |
16:47:11 | FromGitter | <alehander92> make a site where |
16:47:11 | FromDiscord | <Yardanico> but it's okay |
16:47:18 | FromGitter | <alehander92> we compare features and their history |
16:47:21 | FromDiscord | <Yardanico> We already have Nim for Python programmers for example |
16:47:26 | FromGitter | <alehander92> i saw a guy comparing cast syntaxes across the languages |
16:47:30 | FromDiscord | <Yardanico> but I don't like the design of that wiki page |
16:47:37 | FromGitter | <alehander92> nah i am interested in more general kind of gallery |
16:47:54 | leorize | we should've make asciidoc the default for those wiki pages |
16:47:57 | FromGitter | <alehander92> like having 30 features and having history for each of them |
16:48:05 | leorize | then you get a free TOC generator |
16:48:06 | FromDiscord | <Yardanico> @leorize I mean this - |
16:48:07 | FromGitter | <alehander92> lang design thing, not only nim |
16:48:11 | FromDiscord | <Yardanico> https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers |
16:48:13 | FromDiscord | <Yardanico> emojis, etc |
16:48:17 | FromDiscord | <SirJosh> sent a code paste, see https://play.nim-lang.org/#ix=2rI6 |
16:48:31 | FromDiscord | <Yardanico> include |
16:48:40 | FromDiscord | <Yardanico> wait, wdym "exists in memory"? |
16:48:43 | FromDiscord | <Yardanico> just save it to a file and compile |
16:48:53 | FromDiscord | <Yardanico> and your boilerplate should be before the actual transpiled code |
16:48:56 | FromDiscord | <SirJosh> sounds yucky |
16:48:59 | FromDiscord | <Yardanico> why? no |
16:49:02 | FromDiscord | <SirJosh> hmm lemme try explain better |
16:49:03 | FromDiscord | <Yardanico> /tmp and friends exist |
16:49:14 | FromDiscord | <SirJosh> eck temp dirs yeah |
16:49:16 | FromDiscord | <SirJosh> i guess that'd work |
16:49:17 | FromDiscord | <Yardanico> and for boilerplate itself you can even use normal imports where possible |
16:49:21 | FromDiscord | <Yardanico> like https://github.com/Yardanico/nimpylib for example |
16:49:28 | FromDiscord | <Yardanico> (the screenshot here is outdated, don't check it) |
16:50:10 | FromDiscord | <Yardanico> so you can just write normal nim modules |
16:50:14 | FromDiscord | <Yardanico> which implement the boilerplate you need |
16:50:22 | disruptek | if it exists in memory, just output it. this makes no sense to me. |
16:50:31 | FromDiscord | <Yardanico> also what's the source language? |
16:50:46 | FromDiscord | <Shucks> I finally got the pluginmanager for neovim running on windows. Did anyone ever tried the nim plugin for neovim on windows? |
16:50:50 | FromDiscord | <SirJosh> you don't want to know :^) (javascript) |
16:51:05 | FromDiscord | <Yardanico> @Bung did some progress on transpiling TypeScript fwiw |
16:51:13 | FromDiscord | <SirJosh> oh neat |
16:51:14 | FromDiscord | <Yardanico> but it was for specific projects I think |
16:51:23 | disruptek | you want to convert javascript to c? |
16:51:23 | FromDiscord | <SirJosh> would be interested to hear |
16:51:36 | FromDiscord | <SirJosh> that'd work sure |
16:51:43 | FromDiscord | <Clyybber> @SirJosh Just put your boilerplate into a file and include it at the top |
16:51:45 | disruptek | what's the actual goal? |
16:51:56 | disruptek | you have some js. what are you trying to do with it? why? |
16:51:58 | FromDiscord | <Clyybber> disruptek: To Nim obviously :p |
16:52:03 | FromDiscord | <Yardanico> yeah, transpiling JS wouldn't be so easy because of the dynamic nature |
16:52:05 | FromDiscord | <Yardanico> just like with Python |
16:52:11 | FromDiscord | <Yardanico> unless you wrap everything in some special "JsObject" |
16:52:18 | disruptek | you can just interop with js. |
16:52:18 | FromDiscord | <lqdev> @Shucks yeah I got it to run |
16:52:26 | FromDiscord | <Yardanico> if you compile to js - sure |
16:52:40 | FromDiscord | <SirJosh> reducing startup overhead of `node script.js` by converting it to native code, and then abandoning some ECMA script compliance through flags for performance reasons |
16:52:44 | disruptek | or use quickjs wrapper. |
16:52:48 | FromDiscord | <SirJosh> so that build tools can be faster |
16:52:51 | FromDiscord | <SirJosh> (edit) 'faster' => 'faster, or whatever else' |
16:52:54 | FromDiscord | <Yardanico> @SirJosh oh I think i saw your repo |
16:52:58 | disruptek | have you looked at quickjs? |
16:53:01 | FromDiscord | <Yardanico> parsing package.json in Nim or something |
16:53:02 | disruptek | !repo quickjs |
16:53:04 | disbot | https://github.com/horhof/quickjs -- 9quickjs: 11Unpacked tarball of Fabrice Bellard's QuickJS Javascript engine 15 1277⭐ 128🍴 7& 29 more... |
16:53:08 | disruptek | !repo quick |
16:53:09 | disbot | https://github.com/alehander92/nim-quicktest -- 9nim-quicktest: 11A quickcheck library for Nim 15 18⭐ 1🍴 7& 21 more... |
16:53:15 | FromDiscord | <Yardanico> fix disbot 😛 |
16:53:19 | disruptek | !repo author:genotrance quick |
16:53:20 | disbot | no results 😢 |
16:53:22 | FromDiscord | <SirJosh> don't think that was me, i only reallly started using nim today |
16:53:25 | FromDiscord | <SirJosh> (edit) 'reallly' => 'really' |
16:53:28 | FromDiscord | <Yardanico> ah okay |
16:53:36 | leorize | @Shucks I got that to work, but iirc you need nvim >= 0.5.0 on windows for stability |
16:53:39 | FromDiscord | <Yardanico> but really node is not the only JS engine out there 🙂 |
16:53:40 | leorize | might be wrong though |
16:53:44 | FromDiscord | <Shucks> @lqdev anything special to do to get code suggestions/completions running? Seems like I even rarely get code highlighting yet. Nimsuggest is in path |
16:53:55 | FromDiscord | <Yardanico> and you can always write run some JS parts in quickjs/dukpate |
16:53:58 | FromDiscord | <Yardanico> and others in native nim code |
16:53:58 | FromDiscord | <SirJosh> also no i haven't seen quickjs |
16:53:58 | disruptek | well, we have a quickjs wrapper somewhere. |
16:54:09 | disruptek | i might have it in a gist. |
16:54:17 | FromDiscord | <Yardanico> https://github.com/ImVexed/quickjs4nim ? |
16:54:23 | FromDiscord | <lqdev> @Shucks you need to set up asyncomplete.vim for completions to work |
16:54:24 | FromDiscord | <Yardanico> updated year ago though |
16:54:32 | disruptek | yep. |
16:54:39 | FromDiscord | <lqdev> https://github.com/alaviss/nim.nvim#auto-completion |
16:54:47 | disruptek | wrappers often don't need often updates. |
16:54:54 | disruptek | wrappers often don't need updates often. |
16:55:19 | FromDiscord | <Yardanico> depends on what you're wrapping really |
16:55:28 | FromDiscord | <Yardanico> it might need an update because nimterop changed itself |
16:55:33 | disruptek | why? |
16:55:35 | FromDiscord | <lqdev> sent a code paste, see https://play.nim-lang.org/#ix=2rI7 |
16:55:41 | FromDiscord | <Shucks> Yea thats what i did ;o |
16:55:44 | FromDiscord | <lqdev> hm |
16:55:56 | * | theelous3 joined #nim |
16:56:31 | FromDiscord | <lqdev> did you save the file to disk? |
16:57:03 | shashlick | here's the quickjs nimterop wrapper - https://gist.github.com/genotrance/4869d1feb53c7ec7be806a2f225d07ab |
16:57:12 | FromDiscord | <Shucks> yup |
16:57:21 | Araq | disruptek, skiplists? when I looked at them benchmarks said they are slower than hash tables |
16:57:33 | FromDiscord | <SirJosh> i'll take a look into the quickjs and nimterop things, thx for the references |
16:57:33 | FromDiscord | <lqdev> hm |
16:57:36 | Araq | I didn't benchmark them myself but still |
16:57:47 | FromDiscord | <lqdev> leorize might be able to help you more with debugging this |
16:57:47 | disruptek | it's just an optimization to trade mem for speed in singly-linked-lists. |
16:57:59 | disruptek | don't think of it as a separate data-type. |
16:58:06 | FromDiscord | <Yardanico> @SirJosh for some real transpilation you would want some JS runtime analyzer (to find out types) or TypeScript type definitions |
16:58:11 | FromDiscord | <Shucks> Alright, thanks |
16:58:15 | FromDiscord | <Yardanico> or wrap everything in some JsObject 😄 |
16:58:32 | leorize | @Shucks can I see some screen cap? |
16:59:01 | FromDiscord | <SirJosh> yeah i've chosen the jsobject approach and figured i could code in edgecases or something weird, not entirely sure yet but it's a \/\/ TODO |
16:59:06 | FromDiscord | <SirJosh> (edit) 'it's' => 'it'll be' |
17:00:19 | FromDiscord | <Shucks> https://prnt.sc/tiejkr |
17:00:23 | FromDiscord | <Shucks> Nothing fancy there |
17:01:18 | FromDiscord | <Shucks> Wait, do I need the qt one |
17:01:58 | * | skrzyp1 is now known as skrzyp |
17:02:06 | FromDiscord | <Shucks> oh yea. that looks better. Gosh thats ugly |
17:02:54 | Araq | who can fix VSCode highlighting? |
17:03:03 | disruptek | new guy. |
17:03:26 | shashlick | Gary M |
17:03:31 | Araq | """"xyz"""" (4 quotes) are allowed |
17:03:31 | FromDiscord | <lqdev> @Shucks also I don't recommend using nvim in windows console, it doesn't have things like mouse support |
17:03:41 | leorize | @Shucks file saved? |
17:03:52 | leorize | and what version of neovim are you on? |
17:04:10 | leorize | `:ver` will tell you |
17:04:15 | FromDiscord | <Shucks> ```nvim --version↵NVIM v0.5.0-593-g1ca67a73c``` |
17:04:44 | FromDiscord | <Shucks> Code suggestions causes a crash atm |
17:04:56 | leorize | so it's working then |
17:05:15 | FromDiscord | <Shucks> more or less ;D |
17:05:41 | leorize | https://github.com/alaviss/nim.nvim/wiki/Support-for-other-completion-plugins#ncm2-ncm2ncm2 |
17:05:53 | leorize | you can try that |
17:06:24 | * | abm quit (Quit: Leaving) |
17:06:30 | FromDiscord | <Shucks> gonna try it. Thanks |
17:06:41 | disruptek | Araq: for orderedtable, why don't we just keep a seq as an index? |
17:07:58 | FromDiscord | <SirJosh> sent a long message, see http://ix.io/2rI9 |
17:08:09 | FromDiscord | <SirJosh> (edit) 'http://ix.io/2rI9' => 'http://ix.io/2rIa' |
17:08:58 | FromDiscord | <SirJosh> (edit) 'http://ix.io/2rIa' => 'http://ix.io/2rIb' |
17:09:10 | FromDiscord | <Yardanico> https://nim-by-example.github.io/ is sadly outdated and not maintained |
17:09:21 | FromDiscord | <Yardanico> "no tool for hierarcy" - "nimble init" |
17:09:41 | FromDiscord | <SirJosh> aww that by example thing is so good |
17:09:49 | FromDiscord | <Yardanico> "+=" - there's no + operator for strings |
17:09:55 | FromDiscord | <Yardanico> you can do s = s & "a" |
17:09:57 | FromDiscord | <Yardanico> or s &= "a" |
17:10:12 | FromDiscord | <Yardanico> - string interpolation requires a package import and function call (fmt("things {yeah}")) - because it would be a bit of bloat to include it by default 🙂 |
17:10:33 | FromDiscord | <Yardanico> "- can all objects just implement like a toString for me or something" well yes, there's a common operator for converting to string - $ |
17:10:43 | FromDiscord | <Yardanico> most libraries and stdlib modules implement it for their types |
17:10:45 | leorize | and there's a default implementation for it |
17:10:45 | FromDiscord | <SirJosh> couldn't you make string interpolation easily accessible and not include it if you realize the user didn't use it |
17:10:58 | FromDiscord | <SirJosh> yeah i saw the `$()` thing but it didn't work for my types so idk if i'm doing things wrong |
17:11:08 | FromDiscord | <Yardanico> if your types are "ref object", you need to dereference |
17:11:10 | FromDiscord | <Yardanico> echo myobj[] |
17:11:16 | FromDiscord | <Yardanico> @SirJosh well nim always has dead code elimination, but that's not the problem |
17:11:27 | FromDiscord | <Yardanico> if you always include strformat the compiler will always need to *process* the source code of strformat |
17:11:28 | FromDiscord | <lqdev> generics being [] is actually a good thing, it prevents ambiguities that occur with <> |
17:11:29 | FromDiscord | <SirJosh> ah yeah they were ref objects |
17:11:37 | FromDiscord | <SirJosh> (edit) 'were' => 'are' |
17:11:40 | FromGitter | <ynfle> use `obj.repr` |
17:11:46 | FromDiscord | <Yardanico> "- * to export things instead of referring to pointers/references really got me at first" - this is not really a problem IMO, same for [] for generics |
17:12:03 | leorize | @ynfle repr is for debugging |
17:12:05 | FromDiscord | <Yardanico> @ynfle no |
17:12:16 | FromDiscord | <lqdev> > no tool like cargo or dotnet to new up a project hierarchy |
17:12:20 | FromDiscord | <lqdev> there's nimble |
17:12:28 | FromDiscord | <lqdev> `nimble init your_project` |
17:12:37 | FromDiscord | <lqdev> koch is used for compiler development |
17:12:43 | FromDiscord | <SirJosh> yeah i just listed my initial experiences |
17:12:47 | FromDiscord | <SirJosh> apparently i found koch before nimble somehow lol |
17:12:53 | FromDiscord | <SirJosh> but good to know it exists |
17:13:08 | FromDiscord | <Yardanico> koch is not for end users |
17:13:14 | FromDiscord | <Yardanico> it's for compiler-related development and debugging |
17:13:23 | FromGitter | <Kvothe87> hi |
17:13:36 | leorize | `do`-notation aside, the chosen syntax makes a lot of sense once you got used to nim |
17:13:47 | FromGitter | <Kvothe87> i have an issue understanding something that i believe should be quite easy |
17:13:49 | FromGitter | <Kvothe87> https://play.nim-lang.org/#ix=2rIc |
17:14:28 | leorize | so what's the issue? :P |
17:14:55 | FromDiscord | <Yardanico> @Kvothe87 on line 16 you're creating a copy |
17:15:16 | FromGitter | <Kvothe87> why is the global variable inputDrivers the same as the local? |
17:15:26 | FromDiscord | <Yardanico> it's not? |
17:15:28 | FromDiscord | <Clyybber> disruptek: WDYM seq as an index? |
17:15:38 | FromDiscord | <Clyybber> Using a literal seq as an index? |
17:15:57 | FromDiscord | <Yardanico> @Kvothe87 ah wait you're right |
17:15:58 | leorize | @Kvothe87 JsonNode is a reference type |
17:16:04 | FromDiscord | <Clyybber> Or do you mean like combined hashes of its elements? |
17:16:08 | FromGitter | <Kvothe87> i create the copy and modify the copy, then why is it changing also the original |
17:16:10 | FromDiscord | <Yardanico> well jsonnode is reference, sorry, I forgot |
17:16:14 | FromDiscord | <Yardanico> yeah you're not creating a copy |
17:16:44 | FromGitter | <Kvothe87> how can i make a copy then? instead of modifying the original? |
17:16:54 | * | Cthalupa quit (Ping timeout: 240 seconds) |
17:16:56 | leorize | https://play.nim-lang.org/#ix=2rIe |
17:17:33 | FromDiscord | <Clyybber> Araq: Whats tyForward? |
17:17:42 | leorize | forward declared |
17:17:45 | FromDiscord | <Yardanico> forward declaration? |
17:17:50 | FromDiscord | <Clyybber> Thats my guess too |
17:17:52 | FromDiscord | <Zachary Carter> https://imgur.com/a/Him6p1L |
17:18:05 | FromDiscord | <Clyybber> But I encounter it in a situation where I wouldn't expect it |
17:18:18 | FromDiscord | <Clyybber> @Zachary Carter nice! |
17:18:28 | leorize | just `git grep tyForward` |
17:18:33 | FromDiscord | <Zachary Carter> thanks! |
17:18:58 | leorize | @Zachary that's cool, generated in nim? :) |
17:19:52 | FromGitter | <Kvothe87> @leorize thanks. It worked also in the more real case |
17:20:36 | Yardanico | !status |
17:20:38 | FromDiscord | Uptime - 1 week, 8 hours, and 26 minutes |
17:20:39 | Yardanico | yay |
17:20:45 | * | Cthalupa joined #nim |
17:20:48 | FromDiscord | <Yardanico> <FromDiscord> Uptime - 1 week, 8 hours, and 26 minutes |
17:20:48 | FromGitter | <Kvothe87> why is it implemented this way? For sure it is present in the documentation, but it was quite unexpected |
17:20:56 | FromDiscord | <Yardanico> because all ref types are like this 🙂 |
17:21:04 | FromDiscord | <Yardanico> so there's much less copies |
17:21:18 | FromDiscord | <Yardanico> and really in most cases when working with json you don't need to do stuff you did in the playground |
17:21:51 | FromGitter | <Kvothe87> probably there was a better way to do it than how i did it. |
17:21:56 | FromGitter | <Kvothe87> thanks |
17:24:55 | * | Trustable quit (Remote host closed the connection) |
17:27:30 | FromDiscord | <Zachary Carter> leorize: I'm using https://github.com/septag/rizz and https://github.com/guillaumeblanc/ozz-animation |
17:27:50 | Oddmonger | what is it, when you call a function with « discard » before ? |
17:28:00 | disruptek | it's nothing. |
17:28:12 | Oddmonger | it ignores result ? |
17:28:16 | leorize | it means you discard the result |
17:28:18 | leorize | yea |
17:28:33 | FromDiscord | <Yardanico> yes, but the code will still be there if there are side effects |
17:28:34 | Oddmonger | but why is it mandatory sometimes, in api ? |
17:28:46 | FromDiscord | <Yardanico> because if you're e.g. interfacing with C libraries |
17:28:49 | FromDiscord | <Yardanico> they usually return an error code |
17:28:57 | FromDiscord | <Yardanico> and you don't always want it, especially when prototyping |
17:29:07 | Oddmonger | ah |
17:29:20 | Oddmonger | ok, thank you |
17:29:31 | FromDiscord | <Yardanico> discard actually still generates code, but the C compiler might just optimize the call with "discard" away if there are no side effects |
17:36:10 | * | tane joined #nim |
17:36:23 | disruptek | i'm going to organize a nim event. |
17:36:28 | disruptek | it works like this: |
17:36:38 | disruptek | we come up with an idea. then we code it together. |
17:36:46 | disruptek | over 48hrs. |
17:37:00 | FromDiscord | <lqdev> cool |
17:37:01 | disruptek | very rapid development. |
17:37:15 | FromDiscord | <lqdev> so it's like a game jam but everyone works on the same thing |
17:37:19 | disruptek | yeah. |
17:39:32 | shashlick | how about focusing on existing packages and fixing bugs, improving them |
17:39:54 | disruptek | it's not fun enough. |
17:40:44 | disruptek | everyone submits ideas and we pick them out of a hat entire majority accepts the mission. |
17:40:52 | disruptek | s/entire/until/ |
17:42:17 | disruptek | this could be really useful to get a sense for how nim scales in larger projects. |
17:44:14 | FromDiscord | <Yardanico> btw, https://github.com/fox0430/moe seems to work with arc and most tests pass |
17:44:28 | FromDiscord | <Yardanico> except two small tests in one file 😛 |
17:44:32 | FromDiscord | <Yardanico> which I'm investigating |
17:47:17 | FromDiscord | <Clyybber> nice! |
17:51:13 | shashlick | by the way, anyone wants to install zlib on any OS, static or shared, here's how you do it with nimterop - http://ix.io/2rIk - cc @impbox |
17:51:53 | disruptek | !last shashlick |
17:51:54 | disbot | shashlick spoke in 12#nim 40 seconds ago 12https://irclogs.nim-lang.org/15-07-2020.html#17:51:13 |
17:52:05 | disruptek | ~zlib is https://irclogs.nim-lang.org/15-07-2020.html#17:51:13 |
17:52:05 | disbot | zlib: 11https://irclogs.nim-lang.org/15-07-2020.html#17:51:13 |
17:55:18 | FromDiscord | <Yardanico> also another problem with arc repr - it doesn't properly repr strings 😦 |
17:55:45 | FromDiscord | <Yardanico> !eval echo repr "\r\n" |
17:55:47 | NimBot | 0x5612c32fe2a0"\13\10"↵"" |
17:56:08 | FromDiscord | <Yardanico> with arc that's "<newline>" |
17:56:10 | disruptek | how is that wrong? |
17:56:16 | FromDiscord | <Yardanico> the default is right |
17:56:19 | FromDiscord | <Yardanico> the arc one is wrong |
17:56:22 | leorize | arc doesn't do escaping |
17:56:22 | FromDiscord | <Yardanico> or at least much less useful |
17:56:23 | disruptek | gotcha. |
17:56:41 | leorize | it's in repr_v2 if you want to do a fix |
17:56:49 | FromDiscord | <Yardanico> yeah I know 😛 |
17:56:58 | FromDiscord | <Yardanico> also ping @Clyybber since he did some repr_v2 fixes 😛 |
17:57:33 | FromDiscord | <Clyybber> oh, it doesn't? |
17:57:38 | FromDiscord | <Yardanico> it doesn't 😦 |
17:57:52 | FromDiscord | <Clyybber> ah, yeah we don't escape that I think |
17:57:55 | FromDiscord | <Yardanico> also can't repr procedures themselves |
17:57:57 | FromDiscord | <Clyybber> I guess we could |
17:58:00 | FromDiscord | <Yardanico> e.g. when you store them in an object |
17:58:17 | FromDiscord | <Clyybber> What does old repr do for procedures? |
17:58:21 | FromDiscord | <Yardanico> address |
17:58:24 | FromDiscord | <Clyybber> I see |
18:03:02 | Araq | when I wrote repr_v2 I wasn't really aware how the old repr does things :P |
18:03:08 | Araq | as I never use 'repr' |
18:04:03 | * | endragor quit (Remote host closed the connection) |
18:04:16 | leorize | repr can also traverse RTTI to figure out the real type |
18:04:22 | leorize | not sure if repr_v2 supports this |
18:04:30 | * | endragor joined #nim |
18:05:39 | Araq | it doesn't |
18:05:48 | FromDiscord | <Yardanico> there's no rtti with arc |
18:05:50 | FromDiscord | <Yardanico> so it doesn't 😛 |
18:06:13 | leorize | there's still a limited form for methods to work |
18:07:02 | FromDiscord | <Yardanico> well yes |
18:07:05 | FromDiscord | <Yardanico> which uses string comparisons 😄 |
18:07:06 | FromDiscord | <Clyybber> @Yardanico escape chars too? |
18:07:13 | FromDiscord | <Yardanico> @Clyybber well yes, special ones |
18:07:19 | FromDiscord | <Yardanico> e.g. \13\10 |
18:07:39 | ForumUpdaterBot | New thread by Salient: What are Nim programmers called?, see https://forum.nim-lang.org/t/6545 |
18:08:51 | leorize | I guess we gotta figure a name out for marketing purposes too :P |
18:08:57 | FromDiscord | <Clyybber> nimmers |
18:09:02 | FromDiscord | <Clyybber> was one I heard |
18:09:16 | disruptek | nimions, what else? |
18:09:16 | leorize | should organize a vote somewhere :P |
18:09:43 | FromDiscord | <Clyybber> nimions is nice too |
18:09:51 | FromDiscord | <Clyybber> but who cares, call yourself what you want |
18:09:56 | FromDiscord | <Clyybber> why should there be an official one |
18:10:07 | Prestige | nimgineers |
18:10:23 | disruptek | nimineers is good. |
18:10:25 | * | endragor quit (Ping timeout: 264 seconds) |
18:10:45 | leorize | it gives people a sense of community I suppose |
18:11:24 | FromDiscord | <lqdev> nimions is perfect. |
18:11:41 | FromDiscord | <Zachary Carter> oh this conversation again lol? |
18:12:10 | FromDiscord | <Zachary Carter> it's like the mascot discussion |
18:12:33 | FromDiscord | <Zachary Carter> I agree with clybber - people can call themselves whatever they want and Nim's mascot can be whatever an individual wants it to be |
18:13:02 | FromDiscord | <Zachary Carter> we don't need to be like rust and tell everyone they have crabs |
18:13:33 | FromDiscord | <lqdev> the only good Nim mascot is :nimrawr: |
18:13:37 | FromDiscord | <Clyybber> @Yardanico I'm gonna leave the string/char escaping to you since you might better know what you want :p (I don't use repr too often)↵The old implementation is in lib/system/repr reprStrAux and reprChar are the interesting ones. |
18:13:47 | Araq | the crabs are the best thing about Rust though |
18:13:58 | FromDiscord | <Clyybber> One question for example is wether we want to print empty strings that are nil internally as nil |
18:14:04 | Prestige | rusty crabs |
18:14:28 | leorize[m] | planetis[m]: how is the matrix.org irc bridge nowadays? do you still experience lag? |
18:15:21 | FromDiscord | <lqdev> crabs are similar to crayfish, and it just so happens that crayfish and cancer share the same word in polish. how peculiar. |
18:15:38 | FromDiscord | <Clyybber> so they do in german |
18:15:39 | Araq | Clyybber: check out my branch and look at this code please |
18:15:41 | Araq | https://gist.github.com/Araq/551262b4ab33630a21b8cd65d944da81 |
18:15:52 | FromDiscord | <Zachary Carter> I was thinking of the vd |
18:15:53 | leorize[m] | I'm gonna create a community on matrix to group our IRC rooms into one place, hopefully lures people away from joining the matrix->gitter bridge all the time :P |
18:16:08 | Araq | I'm too tired to see the issue |
18:16:18 | Araq | it infers the hidden temporaries as cursors |
18:16:32 | Araq | but then it copies from them so that should be fine |
18:17:34 | Araq | it also not an optimization this way but a pessimization :-( |
18:19:54 | Araq | oh never mind it does move |
18:19:57 | Araq | and shouldn't |
18:20:13 | FromDiscord | <Clyybber> heh, just when I was koch temping :p |
18:20:33 | Araq | still. cursors and moving bite |
18:20:43 | FromDiscord | <Clyybber> yeah |
18:20:48 | FromDiscord | <Clyybber> one lets ownership sit |
18:20:51 | FromDiscord | <Clyybber> the other steals it |
18:20:53 | leorize | anyone got a high-resolution image of the nim crown on white bg? |
18:20:55 | * | noonien joined #nim |
18:21:09 | disruptek | leorize: it's svg, isn't it? |
18:21:11 | FromDiscord | <Clyybber> leorize: Maybe theres a vector version in that one repo |
18:21:58 | leorize | I don't have inkscape to render it so was wondering if anyone got one already |
18:22:20 | FromDiscord | <Shucks> So seems like I've found the perfect solution to use nvim with plugins on windows. https://prnt.sc/tig24s |
18:22:38 | leorize | @Yardanico do you have some Nim crown logo samples? iirc you added a few of them to discord |
18:22:58 | leorize | @Shucks: nice |
18:23:35 | FromDiscord | <Shucks> Actually pretty cool. I didn't knew windows has that subsystem linux stuff |
18:24:02 | FromDiscord | <Yardanico> @leorize sadly no |
18:24:05 | FromDiscord | <Yardanico> but yeah, I used the svg |
18:25:50 | planetis[m] | leorize: there was the double posts issue (not sure if related to matrix-irc bridge) but nowdays its kind of okay, fingers crossed... |
18:26:38 | * | arecaceae joined #nim |
18:27:48 | * | marnix quit (Read error: Connection reset by peer) |
18:28:18 | * | marnix joined #nim |
18:31:10 | * | endragor joined #nim |
18:36:16 | * | marnix_ joined #nim |
18:36:22 | * | endragor quit (Ping timeout: 256 seconds) |
18:37:23 | * | marnix quit (Ping timeout: 240 seconds) |
18:39:15 | * | marnix_ quit (Read error: Connection reset by peer) |
18:39:39 | * | leorize[m]1 joined #nim |
18:41:15 | leorize[m]1 | let's see if it's still laggy |
18:41:32 | leorize[m] | seems reasonably fast I'd say |
18:42:08 | leorize[m]1 | around 12s delay :P |
18:43:43 | FromDiscord | <Yardanico> even ircord has less delay ;P |
18:44:23 | leorize | the matrix-irc bridge is never known for good connection :P |
18:45:29 | * | solitudesf quit (Read error: Connection reset by peer) |
18:47:47 | ForumUpdaterBot | New thread by ShalokShalom: Link to documentation in homepage examples, see https://forum.nim-lang.org/t/6546 |
18:48:32 | Prestige | Has there been any discussion on implementing multiple inheritance? |
18:48:39 | leorize[m] | yes iirc |
18:48:44 | leorize[m] | verdict: we won't support it :P |
18:48:58 | * | marnix joined #nim |
18:49:05 | * | solitudesf joined #nim |
18:49:07 | Prestige | Ah, that sucks |
18:49:41 | FromDiscord | <dom96> > @dom96 is there a way to exec in a subdir in nimble?↵@impbox there is a `withDir` IIRC |
18:50:13 | leorize | the matrix.org-irc bridge is so slow that I feel bad for referring people to it :P |
18:51:06 | FromDiscord | <Yardanico> but it's still better than then people connect via matrix - gitter bridge |
18:52:27 | leorize[m]1 | WIP if anyone wanted to help: https://matrix.to/#/+nim:asra.gr |
18:52:48 | leorize | you can join the community then add nim-related channels in I think |
18:52:53 | leorize | first time creating one of those |
18:52:55 | planetis[m] | Prestige: what for would you need multiple inheritance? Don't you experiment with ECS design? |
18:54:00 | leorize | @Yardanico if you add t2bot discord-matrix bridge into discord then I can bridge some discord rooms over too :P |
18:54:10 | Prestige | There's generally a use case for it, which is why interfaces exist in a lot of languages. It's just a cheap partial implementation of multiple inheritance (interfaces are just classes with only abstract functions) |
18:54:44 | leorize | interfaces are different from multiple inheritance |
18:54:54 | Prestige | I'm experimenting with ECS because of the lack of multiple inheritance |
18:54:55 | leorize | it's just how it's done in OOP languages |
18:55:08 | Prestige | Not all |
18:55:18 | leorize | I'd say Go got interfaces done well |
18:55:20 | * | nikita` quit (Ping timeout: 265 seconds) |
18:55:23 | Prestige | Interfaces exist because the creators of the language didn't implement multiple inheritance |
18:55:42 | leorize | I disagree |
18:55:44 | Prestige | Then you have languages like c++ that allow multiple inheritance |
18:56:26 | Prestige | A lot of it is stemming from the creation of java, where the creator didn't implement multiple inheritance, and created interfaces instead. It's pretty much just a work around |
18:56:36 | leorize | interfaces are much simpler than multiple inheritance |
18:56:47 | Prestige | This is also why C# follows the same paradigm, it's just a copy of java |
18:56:54 | Prestige | Yes exactly |
18:57:21 | Prestige | They didn't take the time to implement multiple inheritance, so now we have interfaces |
18:57:34 | leorize | and imo interfaces solves problems better than multiple inheritance |
18:57:39 | leorize | it's too easy to misuse multiple inheritance |
18:58:11 | Prestige | Interfaces don't give you the same capabilities as multiple inheritance |
18:58:25 | leorize | that's why they're better :P |
18:58:35 | Prestige | No, they're limiting |
18:59:11 | leorize | why? |
18:59:18 | leorize | what's the problem that you're trying to solve? |
19:01:08 | Prestige | One case could be creating a game engine with multiple inheritance, just as an example. A number of languages allow for multiple inheritance, I don't know why people would try to avoid it other than it's hard to implement into the language |
19:01:43 | disruptek | it's a constraint that serves no purpose. |
19:02:15 | Prestige | What is, not having MI? |
19:02:36 | disruptek | no, having it. |
19:02:39 | * | narimiran joined #nim |
19:03:58 | Prestige | From a language design perspective? I could see it being difficult to implement, but that doesn't mean multiple inheritance doesn't have its use cases or isn't nice for the programmer to be able to use |
19:04:10 | Prestige | If nobody wanted it, it wouldn't be in multiple languages |
19:04:56 | leorize | well you need to pitch in some use case for them :P |
19:05:04 | * | endragor joined #nim |
19:05:06 | leorize | we won't have those stuff unless there are really good reasons |
19:06:27 | leorize | the potential of ambiguity caused by multiple inheritance (the infamous diamond problem) is usually why they're not welcome |
19:06:41 | Prestige | OOP in Nim seems pretty minimal at the moment, interfaces would be a nice step forward but I would be ecstatic if we had multiple inheritance |
19:07:02 | Prestige | You could even just disallow the diamond unless it's the root object |
19:07:11 | Prestige | Like, just have it be a compiler error |
19:07:38 | planetis[m] | game developers in talks I have seen discourage the use of multiple inheritance |
19:07:38 | disruptek | oop isn't really in favor here. |
19:07:39 | FromDiscord | <Yardanico> we might have vtable concepts, but not multiple inheritance 😛 |
19:07:59 | disruptek | most of us aren't compelled by the oop story, you might say. |
19:08:08 | leorize | well there are also alternatives to multiple inheritance too: rust's traits and interfaces |
19:08:17 | leorize | we really need to weigh these things |
19:08:36 | planetis[m] | because it has issues, like the diamond problem |
19:08:36 | Prestige | I haven't looked into that, I should read up |
19:08:58 | FromDiscord | <Recruit_main707> i think oop should only be accesible for interoping with cpp |
19:09:33 | leorize | designers don't refuse multiple inheritance because it's hard to implement, but because of the issues it might bring |
19:10:04 | Prestige | I can understand individuals not personally caring about OOP, but I think it will affect adoption to some level if we don't have interfaces or some sort of multiple inheritance |
19:10:25 | disruptek | we have concepts. |
19:10:31 | leorize | unless you can write a comprehensive documentation highlighting the ups and downs of MI comparing to other solution, I don't think we will have that anytime soon |
19:11:15 | leorize | appease to the OOP crowd has never been something Nim focus on |
19:11:17 | Prestige | disruptek: concepts? |
19:11:39 | planetis[m] | ECS its own problems like correct ordering, creation and deletion of entities, etc |
19:11:50 | FromDiscord | <Recruit_main707> either to import, export or overload other cpp classes |
19:12:10 | FromDiscord | <Clyybber> Araq: How does your optimizer make sure escaping variables are not cursorified? |
19:12:25 | Prestige | Let's say for a small game, you have a number of objects which all need a location. how do you go about ensuring that these are created with the needed location without rewriting the same code for every type and method? |
19:12:52 | FromDiscord | <Clyybber> Araq: Does it simply look if they are used after a sink or destroy of their source? |
19:14:22 | leorize | Prestige: composition exists for that |
19:14:38 | FromDiscord | <Elegant Beef> Aw shit interfaces |
19:14:39 | leorize | you just add the location object in and initialize it as usual? |
19:14:59 | FromDiscord | <Elegant Beef> They exist to abstract away logic in an easily usable context |
19:15:10 | Prestige | But what about polymorphic methods to perform actions like translating the object? |
19:15:11 | FromDiscord | <Elegant Beef> IE you can have all your IClickable in a list, and just click them |
19:15:57 | FromDiscord | <Elegant Beef> Unity's EC system is a compositional system like you've described |
19:16:03 | FromDiscord | <Elegant Beef> You have an entity and components |
19:16:11 | FromDiscord | <Elegant Beef> All gameobjects have a transform component |
19:16:24 | Prestige | this is the problem I've been trying to solve in writing a game engine in Nim, it seems I'm going to have to develop an entire ECS framework to do so first |
19:16:40 | FromDiscord | <Recruit_main707> arent interfaces the same as our using T bu iwth an extra level of identation? |
19:16:43 | FromDiscord | <Elegant Beef> I mean you really dont need an ECS unless you're having thousands of entities |
19:17:03 | kungtotte | Prestige: There have been previous efforts of writing ECSes in Nim, you might not have to roll your own |
19:17:10 | * | nikita` joined #nim |
19:17:13 | FromDiscord | <Elegant Beef> Nah interfaces in C# atleast let you store all the values that implement it in a single collection |
19:17:19 | FromDiscord | <Elegant Beef> so imagine if concepts worked at runtime |
19:17:40 | kungtotte | You can do that with object variants or type erasure in Nim |
19:17:43 | leorize | Prestige: are you in nim-gamedev? (if that's even bridged to irc, ping @Yardanico) |
19:17:48 | FromDiscord | <Elegant Beef> It is |
19:17:49 | FromDiscord | <Elegant Beef> he is |
19:17:50 | Prestige | Yeah |
19:17:56 | FromDiscord | <Yardanico> @leorize is of course |
19:18:01 | FromDiscord | <Elegant Beef> and no you cant do that with object variants |
19:18:12 | FromDiscord | <Elegant Beef> Object variants can "emulate" a bit of it |
19:18:35 | FromDiscord | <Yardanico> #nim-gamedev on irc |
19:18:42 | FromDiscord | <Elegant Beef> But for the most part you do not get the same behaviour |
19:18:48 | leorize | well I'm certain that many of our members might have figured your problem out Prestige |
19:18:52 | Prestige | So basically my point is, this would be a really simple implementation if we had MI. I know not everybody needs this use case, but it is helpful |
19:18:56 | * | endragor quit (Ping timeout: 246 seconds) |
19:19:00 | FromDiscord | <Elegant Beef> MI? |
19:19:04 | FromDiscord | <Elegant Beef> Fuck inheritance |
19:19:06 | Prestige | Multiple inheritance |
19:19:14 | FromDiscord | <Elegant Beef> Just use↵https://github.com/slangmgh/interfaced |
19:19:18 | FromDiscord | <Elegant Beef> Runtime interfaces |
19:19:18 | disruptek | the problem is that it is arguably bad design. |
19:19:35 | Prestige | How so? I don't know what's bad about it |
19:19:54 | FromDiscord | <Elegant Beef> https://media.discordapp.net/attachments/371759389889003532/733040157116072047/800px-Diamond_inheritance.png |
19:19:54 | FromDiscord | <Elegant Beef> This |
19:19:55 | disruptek | i know, but you should be able to find plenty of arguments against it. |
19:20:13 | disruptek | be open to the idea that there are reasons to shun oop. |
19:20:30 | FromDiscord | <Elegant Beef> I dont think OOP is bad, more just over using inheritance |
19:20:31 | Prestige | I've been working with OOP languages for years, I'm open to the idea of but I haven't heard arguments against it |
19:20:57 | disruptek | i suspected as much. |
19:21:12 | leorize | Prestige: you can restart the discussion on MI by opening an RFC |
19:21:23 | * | nikita` quit (Read error: Connection reset by peer) |
19:21:27 | FromDiscord | <Elegant Beef> See interfaces are nicer than inheritance |
19:21:48 | FromDiscord | <Elegant Beef> Cause you only share what's common and implement what's not |
19:22:05 | leorize | Prestige: an RFC will be a more organized debating ground than IRC, and we can share more details there too |
19:22:12 | FromDiscord | <Elegant Beef> So in a EC system you might have an ID in your base Component and then all the rest can implement any of your interfaces |
19:22:20 | FromDiscord | <Elegant Beef> all without having weird and wacky trees |
19:22:31 | FromDiscord | <Clyybber> eh, IMO OOP needs to be moved *out* of the compiler |
19:22:37 | FromDiscord | <Clyybber> and into library territory |
19:22:49 | FromDiscord | <Clyybber> you can implement your OOP systems on top of case objects |
19:22:51 | FromDiscord | <Clyybber> or unions |
19:22:58 | Prestige | I'd rather have multiple inheritance than interfaces. Good idea leorize, I'd at least like to hear some arguments against oop and other ways this could be implemented |
19:22:59 | FromDiscord | <Clyybber> or ref objects |
19:23:00 | FromDiscord | <Elegant Beef> I mean i think OOP has it's place but without interfaces it will get wacky |
19:23:12 | FromDiscord | <Elegant Beef> Why would you rather have multiple inheritance over interfaces? |
19:23:58 | Prestige | Multiple inheritance gives you the same capability as interfaces (if you can have abstract functions) and more |
19:24:13 | FromDiscord | <Elegant Beef> What's the more |
19:24:13 | FromDiscord | <Clyybber> @Prestige You can implement multiple inheritance like interfaced does interfaces |
19:24:27 | FromDiscord | <Clyybber> I think its best to adopt library OOP solutions for nim if you can |
19:24:28 | kungtotte | Prestige: https://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html < here's a good start for why OOP isn't the be-all, end-all of paradigms (it doesn't touch on MI though, just OOP in general) |
19:24:32 | Prestige | That would be cool, I need to read the library |
19:24:44 | leorize | I'd say we need proper type section macros first |
19:24:48 | FromDiscord | <Elegant Beef> I think MI is just dumb, as it creates even more complex trees |
19:24:52 | leorize | the current implementation isn't really optimal |
19:25:21 | FromDiscord | <Clyybber> @Prestige https://github.com/bluenote10/oop_utils should already have all you want |
19:25:22 | FromDiscord | <Elegant Beef> The entire goal of OOP is composition |
19:25:27 | FromDiscord | <Clyybber> leorize: Yeah, thats true |
19:25:29 | leorize | also there are checks that only the compiler can do |
19:25:37 | FromDiscord | <Clyybber> Which ones? |
19:26:03 | FromDiscord | <Elegant Beef> I'd honestly probably be happy with concepts at runtime, although i doubt that'd be easy to do 😄 |
19:26:09 | FromDiscord | <Recruit_main707> thats fake oop, my idea around oop is maintaining nim's procedural style, while actually emitting classes, kind of what kurx suggested in an rfc |
19:26:14 | leorize | @Clyybber: check against a generic constraints for example |
19:26:30 | FromDiscord | <Clyybber> They would be generic case objects internally |
19:27:11 | FromDiscord | <Recruit_main707> https://github.com/nim-lang/RFCs/issues/174↵id only like to see oop like this in nim, anything else would be unecesary |
19:27:12 | disbot | ➥ C++ interop: cppMethod/cppVirtual/cppOverride ; snippet at 12https://play.nim-lang.org/#ix=2rh9 |
19:27:48 | FromDiscord | <Shucks> I could cry. I finally have some good nim ide... |
19:27:57 | FromDiscord | <Recruit_main707> which is... |
19:28:06 | FromDiscord | <Shucks> vim |
19:28:12 | FromDiscord | <Recruit_main707> """"ide"""" |
19:28:15 | FromDiscord | <Shucks> ;D |
19:28:36 | FromDiscord | <Shucks> Well it makes the job much better than vscode imo |
19:28:37 | FromDiscord | <lqdev> it does very well for me as an ide ;) |
19:29:07 | FromDiscord | <Shucks> and its leightweight and sexy aswell |
19:29:09 | FromDiscord | <Shucks> https://prnt.sc/tih9ne |
19:29:17 | FromDiscord | <Elegant Beef> winblows? 😛 |
19:29:20 | FromDiscord | <Shucks> yea ;D |
19:29:37 | * | haxscramper quit (Remote host closed the connection) |
19:29:57 | FromDiscord | <Elegant Beef> The only RFC that matters is the object variants one 😄 |
19:30:03 | FromDiscord | <Shucks> (edit) 'leightweight' => 'lightweight' |
19:30:11 | FromDiscord | <Elegant Beef> Reduce redundancy, reduce redundancy |
19:30:21 | leorize | welcome to proper semantic highlighting :) |
19:30:48 | FromDiscord | <Elegant Beef> Nim-alt does pretty good for highlighting |
19:31:09 | leorize | you can never beat the compiler in correctness though :) |
19:31:58 | FromDiscord | <Elegant Beef> I asssume the vim highlighting doesnt use regex then? 😄 |
19:32:15 | leorize | a combination of nimsuggest and regex |
19:32:35 | leorize | vim regex is much more powerful than regular regex though :P |
19:34:24 | FromDiscord | <Rika> how tho |
19:35:35 | Prestige | @Clyybber doesn't seem to have MI? |
19:36:15 | * | planetis[m] sobs in the rain, screaming: MI! |
19:46:58 | leorize[m] | @Rika vim regex is slightly context-aware |
19:51:25 | * | opal quit (Remote host closed the connection) |
19:53:02 | * | opal joined #nim |
19:57:00 | FromDiscord | <Yardanico> @Clyybber you're still around? |
19:57:07 | FromDiscord | <Yardanico> So basically I think I understood the moe arc-related test failure |
19:58:24 | FromDiscord | <Yardanico> it's related to sequtils and insert |
20:00:15 | FromDiscord | <Yardanico> sent a code paste, see https://paste.rs/E6y |
20:00:22 | FromDiscord | <Yardanico> I'll open an issue, but I don't know which one is correct here - refc or arc |
20:00:46 | FromDiscord | <Yardanico> basically inserting an empty sequence with sequtils.insert |
20:01:04 | FromDiscord | <Yardanico> with arc it overwrites the old value even if the source sequence is empty |
20:01:36 | FromDiscord | <Clyybber> @Prestige Hmm, I think it should be fairly easy to extend it to support MI |
20:01:44 | FromDiscord | <Clyybber> @Yardanico Huh, interesting |
20:04:05 | FromDiscord | <Yardanico> https://github.com/nim-lang/Nim/issues/14994 |
20:04:07 | disbot | ➥ [ARC} sequtils.insert different behaviour between ARC/refc ; snippet at 12https://play.nim-lang.org/#ix=2rIV |
20:07:50 | * | Senketsu joined #nim |
20:09:22 | FromDiscord | <Yardanico> basically it's self-move vs self-shallow copy |
20:09:26 | FromDiscord | <Clyybber> Yeah |
20:09:31 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2rIY |
20:09:33 | FromDiscord | <Clyybber> self-moves are destructive |
20:09:45 | FromDiscord | <Yardanico> so need to fix sequtils insert then? |
20:09:48 | FromDiscord | <Clyybber> yeah |
20:09:58 | FromDiscord | <Clyybber> either remove the move, since its wrong |
20:10:19 | FromDiscord | <Clyybber> or don't do it if i == j |
20:10:39 | FromDiscord | <Yardanico> we have shallowCopy for arc |
20:10:42 | FromDiscord | <Clyybber> no |
20:10:44 | FromDiscord | <Yardanico> yes |
20:10:46 | FromDiscord | <Yardanico> 😄 |
20:10:54 | FromDiscord | <Clyybber> pretty sure we don't |
20:10:57 | FromDiscord | <Clyybber> if we do its a fake |
20:10:58 | FromDiscord | <Clyybber> :p |
20:10:59 | FromDiscord | <Yardanico> I just checked |
20:11:38 | FromDiscord | <Clyybber> I'm pretty sure its fake |
20:11:50 | FromDiscord | <Yardanico> well but it yields expected results in this case |
20:11:59 | FromDiscord | <Clyybber> yeah, because its an assign probably |
20:14:18 | FromDiscord | <Yardanico> i guess we can even do something like |
20:14:23 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2rJ1 |
20:14:38 | FromDiscord | <Clyybber> yep, thats the fix I have just commited :D |
20:14:39 | FromDiscord | <Yardanico> LOL |
20:14:50 | FromDiscord | <Clyybber> well, I put the if inside the when defined |
20:14:58 | FromDiscord | <Yardanico> well I did first too |
20:15:06 | FromDiscord | <Clyybber> but it doesn't matter |
20:15:06 | FromDiscord | <Yardanico> but maybe we should protect for refc? even if it doesn't matter, idk |
20:15:14 | FromDiscord | <Clyybber> yeah, doesn't matter |
20:15:23 | FromDiscord | <Clyybber> I wonder whats faster though |
20:15:27 | FromDiscord | <Clyybber> for refc |
20:16:11 | FromDiscord | <Clyybber> and yeah, shallowCopy is just asgn in arc |
20:16:18 | FromDiscord | <Clyybber> to make it easier to transition |
20:16:18 | FromDiscord | <Yardanico> heh |
20:16:35 | FromDiscord | <Yardanico> ah yeah I remember having test failures in some libs using shallowCopy in tests |
20:16:49 | FromDiscord | <Clyybber> :D |
20:17:53 | FromDiscord | <Yardanico> ok, feel free to close the issue when you push then 🙂 |
20:18:00 | FromDiscord | <Clyybber> will do |
20:19:39 | FromDiscord | <Yardanico> oh hmm, another test in moe is still failing |
20:20:04 | FromDiscord | <Yardanico> ah nvm no |
20:20:10 | FromDiscord | <Yardanico> I just modified moe when testing, it's all fine now |
20:20:12 | FromDiscord | <Yardanico> all tests pass |
20:20:17 | FromDiscord | <Clyybber> nice \o/ |
20:22:20 | FromDiscord | <Clyybber> hmm, seems like it has an impact on performance on refc |
20:22:23 | FromDiscord | <Clyybber> due to the branching |
20:22:30 | FromDiscord | <Clyybber> I'll only enable it for arc then |
20:24:00 | * | oriba joined #nim |
20:25:52 | FromDiscord | <Yardanico> maybe it only can happen if src seq is empty? |
20:25:59 | FromDiscord | <Yardanico> so we can check for that eariler and just return, idk |
20:26:04 | FromDiscord | <Clyybber> yeah, I thought about that too |
20:26:19 | FromDiscord | <Clyybber> I think thats true |
20:26:47 | FromDiscord | <Clyybber> i and j will be the same if len(src) == 0 |
20:27:06 | * | marnix quit (Ping timeout: 258 seconds) |
20:31:43 | FromDiscord | <Clyybber> heh, I'm sneaking some optimizations in there |
20:33:44 | FromDiscord | <Yardanico> https://github.com/h3rald/min seems to *mostly* work fine (all tests except one pass), but that one is one of the http json tests |
20:33:51 | FromDiscord | <Clyybber> nice |
20:34:31 | FromDiscord | <Yardanico> it either shows bad file descriptor (without sink inference) or ```tests/http.min(20,25) `from-json`: input(1, 1) Error: { expected``` and then the bad file descriptor error |
20:34:43 | FromDiscord | <Clyybber> yeah that error |
20:34:43 | FromDiscord | <Yardanico> ah right, also two fails in [sys] category |
20:34:49 | FromDiscord | <Clyybber> I've seen it in the tests too |
20:35:00 | FromDiscord | <Clyybber> it's very rare |
20:35:26 | FromDiscord | <Clyybber> I'm not sure what actually causes it |
20:35:52 | FromDiscord | <Yardanico> well here it seems to be reproducible every time |
20:35:58 | FromDiscord | <Clyybber> oh, nice |
20:36:03 | FromDiscord | <Clyybber> is it async related? |
20:36:08 | FromDiscord | <Yardanico> ah actually not every time 😦 |
20:36:11 | FromDiscord | <Clyybber> :D |
20:36:16 | FromDiscord | <Yardanico> ah no wait, every time, BUT |
20:36:19 | FromDiscord | <Yardanico> only if you do all tests |
20:36:23 | FromDiscord | <Yardanico> if you only test http - it doesn't happen 😄 |
20:36:24 | FromDiscord | <Clyybber> haha |
20:36:32 | FromDiscord | <Yardanico> well, the json error is still here, but no bad file descriptor |
20:37:07 | FromDiscord | <Yardanico> I don't think it's async related |
20:37:13 | FromDiscord | <Yardanico> that test doesn't use asynchttpclient functionality |
20:37:15 | FromDiscord | <Yardanico> only httpclient |
20:38:13 | FromDiscord | <Yardanico> ```("dir2/test.txt" "dir1" cp "dir1/test.txt" file?) assert``` this one fails from sys |
20:39:12 | FromDiscord | <Yardanico> it copies dir2/test.txt into dir1 |
20:41:34 | FromDiscord | <Yardanico> oh this one seems to be something related to invalid sink |
20:41:38 | FromDiscord | <Yardanico> works with --sinkInference:off |
20:42:27 | FromDiscord | <Rika> for some reason, nim doesnt want to acknowledge that my == function exists or something; i'm getting no print (my == has it) when i try `hasKey`ing a table w/ the correct types |
20:42:52 | FromDiscord | <Yardanico> tables don't use equality |
20:42:54 | FromDiscord | <Yardanico> they use hashes |
20:43:02 | FromDiscord | <Rika> they do in hashcommon |
20:43:03 | FromDiscord | <Yardanico> I mean they don't compare objects, they compare hashes of them |
20:43:20 | FromDiscord | <Clyybber> surely they must be using both? |
20:43:23 | FromDiscord | <Rika> `if t.data[h].hcode == hc and t.data[h].key == key:` |
20:43:33 | FromDiscord | <Clyybber> yeah |
20:43:48 | FromDiscord | <Yardanico> isn't that short-circuited |
20:43:50 | FromDiscord | <Clyybber> hmm, Rika can you try to extract a reproducable example? |
20:44:09 | FromDiscord | <Rika> it's not an `or` though? my hash function works |
20:44:14 | FromDiscord | <Yardanico> ah |
20:44:47 | FromDiscord | <Clyybber> @Rika kind of a sledgehammer method, but you could try looking at the c code |
20:44:56 | FromDiscord | <Clyybber> if it calls the correct == function |
20:45:12 | FromDiscord | <Clyybber> or better |
20:45:17 | FromDiscord | <Clyybber> make yours {.error.} |
20:45:27 | FromDiscord | <Clyybber> if it errors it uses it |
20:45:51 | FromDiscord | <Rika> but i have an echo in it and it doesnt fire |
20:46:05 | FromDiscord | <Yardanico> ```↵@['t', 'e', 's', 't', '.', 't', 'x', 't', '', '.', 't', 'x', 't']↵```↵oh yeah this looks wrong |
20:46:06 | FromDiscord | <Clyybber> a static: echo ? |
20:46:09 | FromDiscord | <Rika> ah |
20:46:10 | FromDiscord | <Rika> okay |
20:46:20 | FromDiscord | <Rika> no not a static error |
20:46:29 | FromDiscord | <Yardanico> that empty character there is null terminator lol |
20:46:34 | FromDiscord | <Clyybber> hmm, then it doesn't get chosen at compile time |
20:46:42 | FromDiscord | <Rika> ah wait |
20:46:45 | FromDiscord | <Rika> no it does error |
20:46:45 | FromDiscord | <Clyybber> :D |
20:46:47 | FromDiscord | <Rika> i miswrotre |
20:46:48 | FromDiscord | <Clyybber> nice |
20:46:55 | FromDiscord | <Clyybber> then its your hash probably :p |
20:46:58 | FromDiscord | <Rika> but the echos dont fire |
20:47:07 | FromDiscord | <Rika> i checked the hash already >_< |
20:48:13 | FromDiscord | <Clyybber> insert an echo into the hash function |
20:48:27 | FromDiscord | <Clyybber> or make a custom == for the hash |
20:52:10 | FromDiscord | <Rika> i checked what `==` does in hashcommon (inserted an echo) and it says false and no prints (my function still has prints) |
20:52:20 | FromDiscord | <Rika> when i do it outside, it prints and says true |
20:52:51 | FromDiscord | <Clyybber> which == ? |
20:52:58 | FromDiscord | <Clyybber> the == for hashes returns false? |
20:53:31 | FromDiscord | <Rika> for the type |
20:53:33 | FromDiscord | <Rika> not the hashes |
20:53:34 | * | narimiran quit (Ping timeout: 240 seconds) |
20:53:37 | FromDiscord | <Rika> the hashes are equal |
20:53:50 | FromDiscord | <Clyybber> now its getting weird |
20:53:56 | FromDiscord | <Clyybber> do you have some code? |
20:54:04 | FromDiscord | <Rika> no i cant actually seem to reproduce it ._. |
20:55:35 | * | fredrikhr joined #nim |
20:55:58 | Araq | it's green! https://github.com/nim-lang/Nim/pull/14962 |
20:55:59 | disbot | ➥ An optimizer for ARC |
20:56:19 | FromDiscord | <Clyybber> Araq: Nice! |
20:56:28 | FromDiscord | <Clyybber> Did you see my previous questions? |
20:56:32 | Araq | no |
20:56:55 | FromDiscord | <Clyybber> How do you determine that a cursor can't escape their sources lifetime? |
20:57:26 | FromDiscord | <Clyybber> Do you simply not allow the cursor to exist after the source is sinked or destroyed? |
20:58:11 | FromDiscord | <Clyybber> Rika: You mean not at all anymore? |
20:58:23 | Araq | if a cursor candidate's dependency is passed to a sink/var T we assume mutation/destruction and this invalidates the cursor candidate |
20:58:29 | FromDiscord | <Rika> i still can with the code i have right now but its not minimal |
20:58:46 | Araq | but currently it's not scope based. it should be. |
20:58:55 | FromDiscord | <Clyybber> ah |
20:59:10 | Araq | might do scope based cursors tomorrow, time to merge and sleep |
20:59:25 | FromDiscord | <Clyybber> heh, is there a switch to turn it off? |
20:59:42 | FromDiscord | <Clyybber> @Rika Is it opensource? |
20:59:59 | FromDiscord | <Rika> not right now since i was preparing it for that lol |
21:00:04 | FromDiscord | <Clyybber> oh :D |
21:00:40 | FromDiscord | <Yardanico> time to find optimizer regressions 😄 |
21:00:59 | Araq | Yardanico: yeah :-) |
21:01:37 | FromDiscord | <Yardanico> also you forgot to remove debug output 🙂 |
21:01:50 | FromDiscord | <Yardanico> well, or make it into a proper hint message I guess |
21:02:22 | FromDiscord | <Clyybber> Araq: Should there be a switch for cursorinference? |
21:02:26 | * | solitudesf quit (Remote host closed the connection) |
21:02:47 | * | solitudesf joined #nim |
21:03:34 | FromDiscord | <Clyybber> Araq: Oh and one last question, why is the #sysAssert in lib/systems/seqs_v2.nim:85 commented out? |
21:03:59 | * | oriba quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
21:04:32 | FromDiscord | <Rika> if i comment out the value `==` in hashcommon it works... |
21:04:51 | FromDiscord | <Rika> what the heck is happening |
21:05:11 | Araq | cursorinference should always be active and is less dangerous than sink inference which influence proc type compatibility |
21:05:51 | FromDiscord | <Yardanico> well moe tests seem to be fine, will check projects in my "compatible arc projects" list |
21:06:00 | Araq | sysAssert doesn't work in seqs_v2 because of include order problems and stuff |
21:06:05 | FromDiscord | <Yardanico> computed as a cursor bufStatus@20945307 {20937058} /home/dian/Projects/stuff/moe/src/moepkg/tabline.nim(31, 16) |
21:06:05 | FromDiscord | <Yardanico> computed as a cursor bufStatus@20955217 {20937058} /home/dian/Projects/stuff/moe/src/moepkg/tabline.nim(51, 9) |
21:06:06 | FromDiscord | <Yardanico> etc |
21:06:09 | FromDiscord | <Yardanico> seems to do stuff 😛 |
21:06:25 | Araq | well check my tests, it's awesome |
21:06:27 | FromDiscord | <Clyybber> :D |
21:06:37 | FromDiscord | <Yardanico> yeah I've seen the test with traverse |
21:06:40 | FromDiscord | <Yardanico> I still don't understand how |
21:06:44 | FromDiscord | <Yardanico> it fully eliminated ref object or what? |
21:07:35 | Araq | I'm not sure it's 100% sound but the compiler does what I would do manually otherwise |
21:08:03 | FromDiscord | <Clyybber> Araq: Are the cursors copy on write? |
21:08:26 | FromDiscord | <Clyybber> Oh, of course they are, disregard that |
21:08:38 | FromDiscord | <Clyybber> Araq: Do cursors of cursors work? |
21:09:04 | FromDiscord | <Clyybber> As in `let a = x #cursor \n let b = a #also cursor` ? |
21:09:07 | Araq | cursors of cursors are a natural outcome of the algorithm |
21:09:10 | FromDiscord | <Clyybber> nice! |
21:09:18 | Araq | but I disabled it for most cases |
21:09:23 | * | Vladar quit (Quit: Leaving) |
21:09:24 | FromDiscord | <Clyybber> oh, why? |
21:09:43 | Araq | because they can make moves less effective |
21:09:59 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=2rJ9 |
21:10:08 | FromDiscord | <Rika> still about the weird == hashcommon thing |
21:10:26 | FromDiscord | <Clyybber> Araq: But cursors can't be move anyways, right? |
21:10:42 | Araq | yeah but that's bad |
21:10:56 | Araq | we like moves more than '=' |
21:11:03 | FromDiscord | <Clyybber> Yeah |
21:11:38 | disruptek | base64 benchmark now 1.83s versus refc at 1.33 |
21:11:41 | FromDiscord | <Clyybber> cursors are the anti-copy initiative of the non-last-reads |
21:11:49 | FromDiscord | <Clyybber> disruptek: With cursorinference? |
21:12:01 | FromDiscord | <Yardanico> nah, it changed after nimStrv2 mutate optimization |
21:12:07 | FromDiscord | <Yardanico> before it was like 3x slower |
21:13:30 | FromDiscord | <Clyybber> I've never seen the benchmark code, but maybe its gotten faster with cursorinference |
21:13:39 | FromDiscord | <Yardanico> lemme check |
21:13:53 | FromDiscord | <Yardanico> it's basically this https://github.com/kostya/benchmarks/blob/master/base64/test.nim |
21:14:57 | Araq | base64 should be updated to use 'var openArray[char]' |
21:15:10 | Araq | this would move the prepareMutation out of the hot loop naturally |
21:15:23 | Araq | and has nothing to do with cursors and moves etc. |
21:16:23 | FromDiscord | <Clyybber> Araq: This prepareMutation exists because of the string literal optimization right? |
21:16:50 | FromDiscord | <Yardanico> so I get 1.45s with refc (8mb peak mem) and ~2.1s with latest arc (2.7mb) |
21:16:59 | FromDiscord | <Yardanico> and yes, it only inferred 1 cursor in strformat 😄 |
21:17:14 | Araq | Clyybber: correct |
21:17:15 | FromDiscord | <Yardanico> for some reason in var xx = "" it inferred xx as a cursor, not sure what that means |
21:17:28 | Araq | it means it works |
21:18:17 | disruptek | no, this is nightly from 15th. |
21:19:03 | disruptek | i'm trying to remember to run it because i cannot be bothered to cron it. |
21:19:04 | FromDiscord | <Clyybber> Araq: Hmm, maybe a stupid idea, but if we can infer something as a cursor, shouldn't we be able to replace the symbol itself? |
21:19:43 | Araq | no. |
21:20:34 | FromDiscord | <Yardanico> well at least kostya/benchmarks default json benchmark is faster with arc (same for refc/arc in packedjson) |
21:20:40 | FromDiscord | <Yardanico> but yeah, time to test real projects |
21:21:22 | Araq | I should sleep now. for the first time this is beginning to feel complete. all big optimizations are implemented. |
21:21:46 | FromDiscord | <Yardanico> congrats 🙂 |
21:21:51 | Araq | cursor inference is totally awesome for ORC btw |
21:22:10 | Araq | no cycle candidates just because you traverse a graph |
21:22:51 | * | leorize[m] left #nim ("User left") |
21:30:25 | FromDiscord | <Shucks> I don't have a clue what happens. But it sounds like my code will be faster in the future. Thanks. |
21:30:41 | FromDiscord | <Yardanico> in short: use arc/orc 😛 |
21:30:47 | FromDiscord | <Shucks> perfect ;D |
21:31:55 | leorize[m]1 | https://matrix.to/#/+nim:asra.gr <- feedback wanted from matrix users |
21:33:19 | * | leorize[m]1 is now known as leorize[m] |
21:39:14 | * | Senketsu quit (Read error: Connection reset by peer) |
21:44:49 | * | tane quit (Quit: Leaving) |
21:48:45 | FromDiscord | <Rika> ok so the issue was something with the devel commit i was at @Clyybber T_T |
21:48:59 | FromDiscord | <Rika> i was using an outdated devel anyway so that's ok |
21:52:39 | FromGitter | <ynfle> @Rika, did you implement `hash` and `==` for you own type? I had a similar issue and had to make it disctinct |
21:52:59 | FromDiscord | <Rika> yes it was a regular `object` and i did implement for both |
21:53:05 | FromDiscord | <Rika> its fixed now |
21:53:13 | FromDiscord | <--HA--> Can I pass an anonymous proc (returning Future[void]) to asyncdispatch.waitFor and how would that look like if so? |
21:53:17 | FromDiscord | <Rika> was on a bad devel commit or something i guess |
21:56:12 | FromDiscord | <Yardanico> @--HA-- |
21:56:21 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2rJi |
21:56:22 | FromDiscord | <Yardanico> for simplest example, but why? |
21:56:30 | FromDiscord | <Yardanico> and you're not passing the proc itself anyway |
21:56:36 | FromDiscord | <Yardanico> you're passing the result of it (the future) |
22:00:01 | FromDiscord | <--HA--> Ah that explains a lot. I didn't get that waitFor needs the Future and I have to execure the proc |
22:00:35 | * | noonien quit (Quit: Connection closed for inactivity) |
22:00:39 | FromDiscord | <Yardanico> well it says that it accepts a future |
22:02:12 | FromDiscord | <--HA--> sent a code paste, see https://play.nim-lang.org/#ix=2rJm |
22:02:44 | FromDiscord | <Yardanico> let rc = waitFor redis.openAsync(port = redisPort) |
22:03:16 | FromDiscord | <Rika> waitFor is the sync version of await |
22:03:20 | FromDiscord | <Rika> basically |
22:03:25 | FromDiscord | <--HA--> that will only work in a proc that is async itself though? and im on the top level |
22:03:29 | FromDiscord | <Yardanico> no |
22:03:34 | FromDiscord | <Yardanico> waitFor doesn't require async context |
22:03:36 | FromDiscord | <Rika> so if you have a sync proc and want to use an async proc you waitFor it |
22:03:38 | FromDiscord | <Yardanico> it'll work at global level just fine |
22:03:44 | FromDiscord | <Yardanico> that's the top place where it's used usually |
22:03:50 | FromDiscord | <--HA--> a i thought it was await, waitFor can be used like that too, nice |
22:04:02 | FromDiscord | <Yardanico> it's 3 lines of code by the way 😛 |
22:04:23 | FromDiscord | <Yardanico> https://github.com/nim-lang/Nim/blob/devel/lib/pure/asyncdispatch.nim#L1924 |
22:05:03 | * | NimBot joined #nim |
22:05:49 | FromDiscord | <--HA--> I feel like I understood a lot in a few minutes, thanks |
22:08:43 | * | leorize quit (Ping timeout: 240 seconds) |
22:11:30 | * | leorize joined #nim |
22:14:36 | * | sschwarzer joined #nim |
22:18:13 | FromDiscord | <Varriount> @Clyybber: Do you know how the recent optimizations relate to orc? |
22:18:41 | FromDiscord | <Yardanico> @Varriount 4raq told just above 🙂 |
22:18:53 | FromDiscord | <Yardanico> > https://discordapp.com/channels/371759389889003530/371759389889003532/733070852547149933 |
22:19:16 | FromDiscord | <Yardanico> but really most arc optimizations = orc optimizations as I see it |
22:21:12 | FromDiscord | <Varriount> @Yardanico I read that, however I'm still in the dark. What exactly is a cursor? |
22:22:16 | * | endragor joined #nim |
22:22:48 | FromDiscord | <--HA--> With HttpClient can I (and should I) keep reusing one client for all my requests or create new clients for new requests? |
22:24:27 | FromGitter | <sealmove> Guys for the 1 hundred time I started writing nimitai from scratch. This time use json (by converting yaml to it) and it works wonders. Should have done it from the beginning instead of trying to parse the stupid yaml. And if we ever get a compile-time yaml parser it should output JsonNode anyway, so it shouldn't be a problem. |
22:26:35 | * | endragor quit (Ping timeout: 240 seconds) |
22:27:37 | FromDiscord | <Yardanico> I told you before that you should do it 😛 |
22:27:49 | FromDiscord | <Yardanico> but yeah, nice 🙂 |
22:27:59 | FromDiscord | <Yardanico> @Varriount it's like an alias |
22:28:05 | FromDiscord | <Yardanico> it doesn't make a copy |
22:28:13 | FromDiscord | <Recruit_main707> nimitai? |
22:28:18 | FromDiscord | <Yardanico> Kaitai for Nim |
22:28:20 | FromDiscord | <Yardanico> @Varriount |
22:28:25 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2rJu |
22:28:27 | FromDiscord | <Yardanico> here the compiler will infer that a is a cursor |
22:29:20 | FromDiscord | <Recruit_main707> cursor? 😅 |
22:29:23 | FromDiscord | <Yardanico> yes |
22:30:04 | FromDiscord | <Recruit_main707> In what way |
22:30:09 | FromDiscord | <Yardanico> in "pointing" way |
22:30:17 | sschwarzer | Recruit: Araq talked about it in his NimConf talk |
22:30:27 | FromDiscord | <Yardanico> yes, but this cursor inference is a bit different I think |
22:30:47 | FromDiscord | <Recruit_main707> > in "pointing" way↵Ah, ok |
22:30:50 | FromDiscord | <lqdev> can't use `pointer` as a pragma because it's a keyword, what's closest to that? `cursor`. |
22:31:00 | FromDiscord | <Yardanico> ez |
22:31:01 | FromDiscord | <Varriount> Ah, I see. |
22:31:06 | FromDiscord | <lqdev> at least, that's where i think that came from. |
22:31:30 | FromDiscord | <Yardanico> right now it's not documented, but will be 😛 |
22:31:40 | FromDiscord | <Yardanico> and it can actually be dangerous when applied manually |
22:31:44 | FromDiscord | <XxDiCaprioxX> type is used to define a new class, correct? |
22:31:49 | FromDiscord | <Varriount> yes |
22:31:53 | FromDiscord | <Yardanico> not "class" really, but yes |
22:31:58 | FromDiscord | <Yardanico> nim doesn't have "classes" in the traditional sense |
22:31:59 | FromDiscord | <Recruit_main707> structure rather |
22:32:02 | FromDiscord | <lqdev> just a new type |
22:32:05 | FromDiscord | <XxDiCaprioxX> So a type |
22:32:27 | FromDiscord | <lqdev> you can also do `type Number = float64` and it will work |
22:32:46 | sschwarzer | XxDiCaprioxX: type is a simpler concept :-) |
22:33:11 | FromDiscord | <XxDiCaprioxX> And if I want to instantiate a type do I write "var x = typename" |
22:33:13 | FromDiscord | <XxDiCaprioxX> ? |
22:33:15 | FromDiscord | <Yardanico> no |
22:33:23 | FromDiscord | <Yardanico> var x = TypeName() or var x: TypeName |
22:33:27 | FromDiscord | <Varriount> Hm, I wonder if it's possible for the compiler to detect acyclic references at compile-time |
22:33:27 | FromDiscord | <Yardanico> better use the first |
22:33:36 | FromDiscord | <Yardanico> well not really |
22:33:40 | FromDiscord | <Yardanico> otherwise orc wouldn't need to exist |
22:33:56 | FromDiscord | <Yardanico> compiler can show a warning if it detects a cyclic structure in simple cases |
22:34:02 | FromDiscord | <Varriount> Yardanico: Perhaps not for all references, but could a subset be suitably optimized? |
22:34:03 | FromDiscord | <Yardanico> (I mean it already does) |
22:35:14 | FromDiscord | <XxDiCaprioxX> Okay, so the concept is similar to other languages |
22:35:20 | FromDiscord | <XxDiCaprioxX> Thanks to y'all |
22:40:21 | FromDiscord | <Clyybber> @Varriount yeah, what yard said, its views. its similar to lent/view |
22:42:12 | FromDiscord | <Clyybber> there are some cases where we can determine at compile time that something will be acyclic |
22:56:43 | * | endragor joined #nim |
22:56:52 | * | solitudesf quit (Ping timeout: 256 seconds) |
22:57:10 | shashlick | @leorize - do you think it's time they reverted this - https://github.com/lz4/lz4/issues/53 |
22:57:10 | disbot | ➥ Can't compile with PIE on 64bit linux |
23:03:00 | ForumUpdaterBot | New thread by Snej: AsyncSocket seems to be dropping data, see https://forum.nim-lang.org/t/6548 |
23:03:14 | leorize | shashlick: not sure |
23:04:15 | * | endragor quit (Ping timeout: 256 seconds) |
23:06:33 | leorize | this new optimization thingy looks cool |
23:06:41 | leorize | any benchmarks done? |
23:07:09 | FromDiscord | <Yardanico> no 😄 |
23:07:13 | FromDiscord | <Yardanico> well, some smol ones |
23:07:24 | FromDiscord | <Yardanico> from https://github.com/kostya/benchmarks not a lot changed |
23:09:05 | leorize | have you tried the brainfuck bench? |
23:09:29 | FromDiscord | <Yardanico> benchmarks there are not really idiomatic though :9 |
23:09:30 | FromDiscord | <Yardanico> 😦 |
23:09:41 | FromDiscord | <Yardanico> the bf one uses a closure (!) iterator for iterating over the code lol |
23:09:49 | FromDiscord | <Yardanico> and it's roughly the same in most implementations |
23:09:59 | leorize | yep, I wrote that part lol |
23:10:15 | FromDiscord | <Yardanico> but yeah with arc it's a bit slower for bench.b |
23:10:31 | leorize | it's actually faster than storing string + position |
23:10:40 | leorize | for default gc at least |
23:11:17 | FromDiscord | <Yardanico> mandel.b with arc is faster though |
23:11:45 | FromDiscord | <Yardanico> but I don't think the ARC optimizer PR will affect microbenchmarks a lot |
23:12:22 | FromDiscord | <Rika> man ARC is magic |
23:12:36 | leorize | have you tested havlak? that one should benefit :P |
23:12:46 | leorize | probably will need orc |
23:12:50 | FromDiscord | <Yardanico> yes I just did |
23:13:01 | FromDiscord | <Yardanico> 1) we have our own havlak implementation in test suite |
23:13:14 | FromDiscord | <Yardanico> 2) the one from kostya benchmarks is faster with orc anyway |
23:13:16 | FromDiscord | <Yardanico> but uses more memory |
23:13:22 | FromDiscord | <Yardanico> ~12s vs ~8s for me |
23:13:23 | disbot | no footnotes for `12s`. 🙁 |
23:13:40 | leorize | more memory probably a side effect of the tslf allocator |
23:13:53 | FromDiscord | <Yardanico> ? |
23:14:00 | FromDiscord | <Yardanico> it's used for all refc/arc/orc, no? |
23:14:24 | leorize | a side effect of the realloc issue |
23:14:36 | leorize | we really need to wire up the reallocator for tslf :P |
23:14:42 | leorize | and fix the deallocator |
23:15:33 | FromDiscord | <Yardanico> ah this regression, I remember 4raq talking about it |
23:16:58 | leorize | if you ever feel like diving in memory management you can try to tackle #14811 |
23:17:00 | disbot | https://github.com/nim-lang/Nim/issues/14811 -- 3Excess memory use for `string` with gc:arc ; snippet at 12https://play.nim-lang.org/#ix=2rJD |
23:17:28 | leorize | I've linked the relevant resources |
23:20:00 | * | krux02_ joined #nim |
23:22:38 | * | krux02 quit (Ping timeout: 256 seconds) |
23:27:22 | leorize | Yardanico are you an IRC OP? |
23:31:24 | FromDiscord | <Yardanico> no |
23:31:35 | FromDiscord | <Yardanico> you can check the list yourself |
23:33:09 | FromDiscord | <Yardanico> "4raq", "d0m96", "def+", "fla viu", "Varri ount", "reactor monk", "PMu nch", "Xe", "ldle work" are OPs |
23:33:13 | FromDiscord | <Yardanico> replaced nicknames to not ping 😛 |
23:33:59 | leorize | I'll need an op to publish the IRC bridge on the matrix.org directory :P |
23:34:02 | FromDiscord | <Rika> "reactor monk"??? |
23:34:19 | leorize | just so people stop using the gitter bridge since that one is published by default |
23:34:38 | FromDiscord | <Yardanico> @Rika yes |
23:35:10 | * | sschwarzer quit (Quit: leaving) |
23:37:34 | * | leorize[m] left #nim ("User left") |
23:37:51 | * | leorize[m] joined #nim |
23:41:22 | * | krux02_ quit (Ping timeout: 260 seconds) |
23:41:59 | FromDiscord | <impbox> @dom96 thanks! withDir works \o/ |
23:53:50 | FromGitter | <sealmove> if I have a macro that produces a unittest suite, can I run the suite without writing it to a file? |
23:55:04 | FromDiscord | <Yardanico> yes, just invoke it? |
23:55:08 | FromDiscord | <Yardanico> call the macro that is |
23:55:22 | FromGitter | <sealmove> oh this would work? |
23:56:02 | FromDiscord | <Yardanico> why wouldn't it? 😛 |
23:56:34 | FromGitter | <sealmove> I don't know, does invoking a macro do the same thing as compiling a module? |
23:57:18 | FromDiscord | <Yardanico> well, the results of a macro get placed in the scope where you called it |
23:57:21 | FromDiscord | <Yardanico> that's how macros work 😄 |
23:57:23 | * | tinandi joined #nim |
23:57:49 | FromGitter | <sealmove> Hmm true, it should work, you are right. That's awesome =) |