<< 07-12-2021 >>

00:00:23FromDiscord<Elegantbeef> Glad i could stand by and just be confused! 😛
00:00:39ehmryanytime
00:02:59ehmryhttps://git.syndicate-lang.org/ehmry/preserves-nim/src/branch/trunk/src/preserves.nim#L639
00:03:39ehmrytranslating Nim types to some binary encoding
00:05:08FromDiscord<codic> Prestige: It doesn't work, Xephyr uses software rendering
00:05:21FromDiscord<codic> I saw somewhere a way to pass through the GPU but I don't remember way
00:05:24FromDiscord<codic> Where
00:09:43arkanoiddoes a converter act more like a template or a proc?
00:09:52FromDiscord<Elegantbeef> It's a proc
00:10:05arkanoidok thanks
00:10:19arkanoidso I bet it's faster to make a template for frequent conversions
00:10:41arkanoid(like for C interop frequent cast)
00:10:52FromDiscord<Elegantbeef> Small procs will get inlined in release/danger builds built with -d\:lto
00:11:17FromDiscord<Elegantbeef> Guess `-d:lto` isnt needed for that but it helps
00:11:25FromDiscord<Elegantbeef> helps performance
00:11:31arkanoidwell, ok, less typing
00:12:59arkanoidmay I ask you a favor? I'm binding libgirepository and I'm testing it against this example here https://gi.readthedocs.io/en/latest/writingbindings/libgirepository.html , but the original example fails with SIGABRT to me
00:13:07arkanoidcould you plese try to compile and run on your box?
00:13:56arkanoidI compile with "gcc example.c -o example -I/usr/include/gobject-introspection-1.0 (pkg-config --cflags --libs glib-2.0) -lgirepository-1.0"
00:17:22FromDiscord<Elegantbeef> Getting an erro it cannot find `glib-object.h`
00:17:29FromDiscord<Elegantbeef> And yes i have the package installed
00:18:30FromDiscord<Elegantbeef> Well actually it bitches about the `()`
00:19:41arkanoidsorry, I use fish shell, you have to $(...) with bash/zsh
00:19:48arkanoidmy fault
00:20:03FromDiscord<Elegantbeef> Prints fine here
00:20:50arkanoidgood! I've just waster 3 hours for a version mismatch
00:20:52arkanoidthanks
00:20:59arkanoidwhat does it print?
00:21:01FromDiscord<Elegantbeef> No problem
00:21:04arkanoidjust for the sake of clarity
00:21:07FromDiscord<Elegantbeef> "Hello world"
00:22:11arkanoidno "domain", no "line 42"?
00:22:27FromDiscord<Elegantbeef> Just "hello world"
00:22:44FromDiscord<Elegantbeef> Wait a minute i'm dumb
00:23:10FromDiscord<Elegantbeef> I had a program i tested earlier that i was running cause i named the C file `test` and forgot c doesnt output a binary with that name
00:23:25arkanoid:D
00:23:28FromDiscord<Elegantbeef> Yep i also get the abort
00:23:29FromDiscord<demotomohiro> Are you trying to make a libgirepository binding in different way from gintro?↔https://github.com/StefanSalewski/gintro
00:24:04arkanoidElegantbeef, ok thanks, so it's just a rubbish example. Not sure
00:25:37arkanoiddemotohiro, I'm just getting my hands dirty with the new automatic nim binding generator futhark, and for my experiment I've been targetting libgirepository to enable generic interfacing to gobject universe. It does work, at least it seems to apart from this bad example
00:28:03FromDiscord<demotomohiro> Nice!
00:28:29arkanoiddemotomohiro, gintro is a lib that not only uses actual GIR files, but creates good nim wrappers. Mine is a raw approch to up a C interop quickly without even using GIR
00:29:10arkanoidI mean, libgirepository uses them, I'm talking about the wrapping of libgirepository
00:33:05nrds<Prestige99> thanks @codic, I think I'll need to get that set up so I can test some things.. without having to restart my running wm after every change lol
00:33:34FromDiscord<codic> what do you need to test with compositor for? curious
00:33:51FromDiscord<codic> btw you could also run 2 x sessions, I often do that
00:34:57FromDiscord<codic> oh it seems that the opengl acceleration is in some forks, not in master
00:35:23nrds<Prestige99> this issue https://github.com/avahe-kellenberger/nimdow/issues/189
00:35:46nrds<Prestige99> having windows hide in the bg when there's a fullscreen window, basically
00:36:24*src quit (Quit: Leaving)
00:36:30FromDiscord<codic> Oh that is an interesting feature, should implement in Worm
00:37:02FromDiscord<codic> Yeah can probably iterate over all clients except the fullscreen one and set that
00:38:30nrds<Prestige99> There are some edge cases that need to be covered - I think I'll just "hide" the windows by moving them offscreen
00:38:44nrds<Prestige99> but annoying to test, I'll check out xephyr forks
00:39:05FromDiscord<Elegantbeef> Does unmapping the window not solve that?
00:39:28nrds<Prestige99> It would, just want to actually test that all edge cases work
00:39:55nrds<Prestige99> Like if I have a fullscreen window open, and another fullscreen app starts, etc
00:42:47FromDiscord<codic> Would the past one be hidden or not?
00:42:55FromDiscord<codic> past = 1st fullscreen one
00:43:00FromDiscord<codic> In reply to @nrds "<Prestige> There are some": why not unmap?
00:43:06FromDiscord<codic> isn't unmap how you implement workspaces too?
00:44:42nrds<Prestige99> I actually just move them offscreen to get around a weird issue I was having, it's the same way dwm handles things
00:45:11nrds<Prestige99> If I get bored enough one day I'm going to restructure how it all works
00:45:15FromDiscord<codic> Oh huh
00:45:17FromDiscord<codic> What was the issue?
00:45:39nrds<Prestige99> Don't recall exactly
00:45:49FromDiscord<codic> yeah weird
00:45:58FromDiscord<codic> have not had any yet
00:56:13*GreaseMonkey quit (Remote host closed the connection)
01:08:46arkanoidis cstring a char* or is a char that requires .addr ?
01:09:51FromDiscord<Elegantbeef> cstring is a ptr char
01:09:58arkanoidthanks
01:10:15arkanoidsorry but I'm not a C programmer but I'm using nim to dive into it
01:11:48FromDiscord<Elegantbeef> Ah i'm very much not a C programmer either so i scream at it until it behaves
01:13:33FromDiscord<Rika> What do you need to qualify as a c programmer
01:14:50FromDiscord<Elegantbeef> Someone that likes writing and using C would be up in the qualifications imo
01:18:24FromDiscord<codic> In reply to @Elegantbeef "Someone that likes writing": You will find a shortage of C programmers
01:18:34FromDiscord<codic> There are almost no C programmers anymore by that definition lol
01:20:14arkanoidis there something already included in nim that does int to bool conversion like in C (true if i !=0 else otherwise) or I have to write my own? I know it's trivial
01:23:04FromDiscord<demotomohiro> !eval var x = 1; echo x!=0
01:23:06NimBottrue
01:25:43FromDiscord<demotomohiro> !eval var x = 1; echo bool(x)
01:25:45NimBottrue
01:27:20FromDiscord<demotomohiro> Anyway, Nim doesn't convert int to bool automatically.
01:27:39FromDiscord<exelotl> arkanoid: you mean implicitly? You can use converters for that, with bool as the example: https://nim-lang.org/docs/manual.html#converters
01:28:13FromDiscord<exelotl> It's not recommended to do this though :P
01:29:04FromDiscord<demotomohiro> Just writing `x != 0` would be fine.
01:29:23FromDiscord<exelotl> Yep, that's the Nim way
01:31:53FromDiscord<demotomohiro> When I learned C language long time ago, there was no bool type in C. int was used as bool type. When int value was 0, it is false, otherwise it is true.
01:32:04arkanoidhow curious, using converter in my context doesn't work, but == 0 does
01:46:02*krux02 quit (Remote host closed the connection)
01:50:42arkanoidI've successfully wrapped and tested libgirepository via futhark! It's so easy not with futhark that I've opened an issue asking what's the proper way to deliver "raw" C bindings, and if is more convenient to distribute autogenerated .nim files or just bring futhark with the package deps: https://github.com/PMunch/futhark/issues/7
02:16:44arkanoids/not/now
02:36:49*vicecea quit (Remote host closed the connection)
02:37:20*vicecea joined #nim
02:44:45FromDiscord<DaiChimpo> if a string contains an escape character, is there a way to print the literal? so "Hello\n" would print as "Hello\n" instead of "Hello" with a newline?
02:46:34FromDiscord<DaiChimpo> .strip(chars={'\n','\r'}) is NOT removing newlines and it's frustrating why
02:59:41FromDiscord<Mocha> If you're trying to print "Hello\n", then you can just escape the backslash: "Hello\\n". Similarly, you can use `strutils`'s `replace` to replace every `'\n'` with a `\\n`. Let me know if that works for you! @DaiChimpo
02:59:57FromDiscord<Mocha> (edit) ""Hello\\n"." => ""Hello\\\n"."
03:00:30FromDiscord<Mocha> (edit) "`'\n'`" => "`"\n"`" | "`\\n`." => "`"\\n"`."
03:01:22FromDiscord<DaiChimpo> well then I can use replace to replace every \ with a \\?
03:01:30FromDiscord<DaiChimpo> that's... a way
03:02:15FromDiscord<Mocha> no, you can't use replace to replace every `\` with `\\`; `\` is not a character on its own, `\n` is the full character.
03:02:43FromDiscord<Mocha> You'd have to replace each escaped character separately, e.g. `\n` -> `\\n` and `\r` -> `\\r`
03:02:59FromDiscord<DaiChimpo> cringe
03:03:12FromDiscord<Mocha> ..?
03:03:43FromDiscord<Mocha> That's how strings work in near every language I know of, the escape character is simply a human-friendly way to represent the newline byte.
03:04:17FromDiscord<Mocha> `\n` is itself a newline byte, if you want to replace that with a `\\n`, then it makes sense that you'd have to use `replace`
03:04:51FromDiscord<Mocha> Anyway, if you have something more constructive to say other than "cringe" then feel free
03:07:37FromDiscord<Mocha> If you are responsible for the string literals themselves, then you can always use raw string literals; however, if you are being passed a string, then `replace` is the only solution afaik.
03:08:54FromDiscord<DaiChimpo> so no conversion from string to raw string?
03:10:45FromDiscord<Mocha> No, once the string is in memory, it is simply a list of numerical values, e.g. the newline is represented as the byte `0x0a`, not as the backslash-n.
03:11:12FromDiscord<Elegantbeef> Dont know what mocha said due to the bridge but you can also do `"""Hello\n"""`
03:11:36FromDiscord<Mocha> ^ Yes if you are able to create the literals themselves then multiple ways to handle it
03:11:36FromDiscord<DaiChimpo> it's reading from file/user input, I do not control what goes into values or this is trivial
03:11:43*[R] quit (Ping timeout: 256 seconds)
03:11:44FromDiscord<Mocha> yep, then just use replace
03:12:00FromDiscord<DaiChimpo> for every escape character
03:12:17FromDiscord<Elegantbeef> User input shouldnt be escaped
03:13:03*arkurious quit (Quit: Leaving)
03:13:43FromDiscord<Mocha> They are talking about line feeds/carriage returns/tabs/other characters represented with an escape code
03:13:54FromDiscord<Mocha> E.g. a file containing newlines
03:14:07FromDiscord<Elegantbeef> Yea but those arent escape sequences
03:14:28FromDiscord<DaiChimpo> reading through I can make readfile() pass back a raw string by giving the filename as a raw string
03:14:32FromDiscord<Elegantbeef> It's just \`replace({'\\0'..'\\032'}\`\`
03:14:59FromDiscord<Mocha> Actually, there is a function in `strutils` called `escape`, hadn't thought of it yet since I've never had to use it but it should do what you want.
03:15:16FromDiscord<Mocha> Or you can use the replace with a sequence like elegantbeef suggested.
03:15:23FromDiscord<Elegantbeef> set
03:15:26FromDiscord<Mocha> (edit) "sequence like" => "setlike"
03:15:30FromDiscord<Mocha> (edit) "setlike" => "set like"
03:15:35FromDiscord<Mocha> :) my brain is totally working
03:15:55FromDiscord<Elegantbeef> Wait i guess there isnt a replace that takes a set
03:15:57FromDiscord<Elegantbeef> So i'm a dumb dumb
03:16:05FromDiscord<DaiChimpo> damn, knew it was too good to be true
03:16:27FromDiscord<Mocha> https://media.discordapp.net/attachments/371759389889003532/917615510273798194/unknown.png
03:16:35FromDiscord<Mocha> just check `strutils`
03:18:13FromDiscord<DaiChimpo> it prints the hex, which is 100% workable. I read through strutils before asking here but must've missed this, thank you
03:18:53FromDiscord<Mocha> np! Glad there was a less painful solution than the replace.
03:19:27FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3HeH it's not too hard to impl
03:21:13FromDiscord<Mocha> oo, Elegantbeef that doesn't quite seem to be a "replace", more like a "remove" o.o
03:21:47FromDiscord<Elegantbeef> I may or may not have misread what they wanted
03:21:56FromDiscord<Elegantbeef> Escape is indeed what they want
03:22:31FromDiscord<Rika> Lol
03:42:48*rockcavera quit (Remote host closed the connection)
04:06:01*supakeen quit (Quit: WeeChat 3.3)
04:06:30*supakeen joined #nim
04:33:28madpropshow do I echo a `ref int` ?
04:40:18FromDiscord<impbox [ftsf]> dereference it with []
04:40:52FromDiscord<retkid> ok so when using --gc:arc
04:41:02FromDiscord<retkid> is everything just bigger?
04:41:24FromDiscord<retkid> im manually dealloc every var i can but the ram usage is still insane?
04:42:37FromDiscord<impbox [ftsf]> Same code but getting higher ram usage?
04:42:44FromDiscord<retkid> well, yea
04:42:46FromDiscord<retkid> as close as it can be
04:42:48FromDiscord<Rika> If the ram usage is still insane then there is something wrong with your algorithm
04:42:51FromDiscord<retkid> cant really run with the normal gc
04:43:25FromDiscord<impbox [ftsf]> Tried orc?
04:43:30FromDiscord<impbox [ftsf]> Do you have cycles?
04:43:32FromDiscord<retkid> In reply to @Rika "If the ram usage": what are some things i should be looking for specifically
04:43:37FromDiscord<retkid> In reply to @impbox "Do you have cycles?": no?
04:43:40FromDiscord<Rika> If you are using async use orc
04:43:41FromDiscord<retkid> In reply to @impbox "Tried orc?": segfault
04:43:59FromDiscord<Rika> If you get a segfault then there is something wrong with your algorithm
04:44:01FromDiscord<impbox [ftsf]> Sounds like problems you should investigate
04:44:17FromDiscord<retkid> so when it works on arc but not orc, i'm fucking up somewhere
04:44:20FromDiscord<impbox [ftsf]> Likewise with why it won't run with normal gc
04:44:40FromDiscord<retkid> remember that lockless thing from earlier
04:50:34FromDiscord<retkid> sent a long message, see http://ix.io/3Hf0
04:50:40FromDiscord<retkid> yea thats not normal
04:50:41FromDiscord<retkid> (edit) "http://ix.io/3Hf0" => "http://ix.io/3Hf1"
04:53:56FromDiscord<retkid> alright actually
04:53:59FromDiscord<retkid> i see tons of places
04:54:02FromDiscord<retkid> everything should be a ptr\
04:54:03FromDiscord<retkid> (edit) "ptr\" => "ptr"
04:55:35FromDiscord<Rika> Pointers do not get tracked by the GC
04:56:02FromDiscord<retkid> In reply to @Rika "Pointers do not get": So I can dealloc it manually
04:58:48*kayabaNerve_ is now known as kayabaNerve
05:00:44FromDiscord<Rika> Sure
05:08:02*Lord_Nightmare quit (Read error: Connection reset by peer)
05:09:58*Lord_Nightmare joined #nim
05:14:03FromDiscord<retkid> is there anyway i can use code as a paramater for a function?
05:14:09FromDiscord<retkid> (edit) "paramater" => "parameter"
05:14:31FromDiscord<Elegantbeef> templates can take code, but functions can only type compilable types
05:14:39FromDiscord<Elegantbeef> take compilable types\
05:14:51FromDiscord<retkid> well i was gonna make a template anyway because i think of it like a function
05:15:03FromDiscord<Elegantbeef> Well they're not
05:17:45FromDiscord<Rika> You cannot think of a template as a function that takes in code; that is a macro (and even then you must further specify)
05:18:39FromDiscord<retkid> In reply to @Rika "You cannot think of": so marcos take code? or can you setup a template to take code?
05:18:49FromDiscord<Rika> They both take code
05:19:32FromDiscord<Rika> But a template isn’t a function, it has very limited ways to modify the code it takes as a parameter
05:50:44*greaser|q joined #nim
05:51:47*greaser|q quit (Changing host)
05:51:47*greaser|q joined #nim
05:51:51*greaser|q is now known as GreaseMonkey
07:01:10FromDiscord<Michal58> Consider this solution to todays aoc https://media.discordapp.net/attachments/371759389889003532/917672064956117002/SPOILER_unknown.png
07:01:30FromDiscord<Michal58> How hard would it be for the compiler to realise that ||numbers.mean.int|| does not depent on it and calculate it only once?
07:01:54FromDiscord<Michal58> (edit) "||numbers.mean.int||" => "||`numbers.mean.int`||" | "it" => "`it`"
07:03:21FromDiscord<Rika> It probably does in the C compiler
07:05:07FromDiscord<Michal58> no it doesn't
07:05:24NimEventerNew thread by Jorjun_arch: Advent of Code Q7 Pt 2, see https://forum.nim-lang.org/t/8685
07:14:14FromDiscord<impbox [ftsf]> In reply to @Michal58 "no it doesn't": You checked the assembly?
07:14:19*[R] joined #nim
07:15:12FromDiscord<impbox [ftsf]> And you're compiling with optimisations?
07:16:15FromDiscord<Rika> You can’t force a C compiler to store extra runtime information implicitly
07:16:25FromDiscord<Rika> So if this is a runtime thing then you must put the extra variable
07:17:34FromDiscord<Rika> In reply to @Rika "You can’t force a": Nim compiler as well
07:18:01FromDiscord<Rika> Though that’s not because “it’s against the philosophy” it’s just it doesn’t
07:18:12FromDiscord<Rika> Most likely most people think it’s not a good idea
07:20:43FromDiscord<Michal58> In reply to @impbox "You checked the assembly?": I didn't but I did check the times. It is numbers.len times slower than if I put it in a variable.
07:23:58FromDiscord<Michal58> In reply to @Rika "Though that’s not because": I see, it might not always be desirable.. if that data would be large... but here it is just 1 int? Seems like a good tradeoff. :D
07:25:01FromDiscord<Rika> Detection is hard
07:25:25FromDiscord<Rika> Would need stronger CFA I assume
07:25:31FromDiscord<Rika> Don’t know the status of that
07:25:31FromDiscord<Michal58> In reply to @Rika "Detection is hard": Yes that's the original question
07:25:50FromDiscord<Rika> I see
07:26:15FromDiscord<Rika> I guess it’s not too difficult
07:26:33FromDiscord<Rika> But the implementation would need to be off by default
07:27:28FromDiscord<Michal58> In reply to @Rika "But the implementation would": IG some compiler flag would be nice
07:29:47*[R] quit (Ping timeout: 265 seconds)
07:29:52FromDiscord<Michal58> In reply to @Rika "Would need stronger CFA": CFA?
07:35:03FromDiscord<Rika> Control flow analysis
07:35:51FromDiscord<Rika> I will have to go, someone else most likely knows the compiler better here
07:36:03FromDiscord<Rika> I’m tired for no obvious reason
07:37:17FromDiscord<impbox [ftsf]> Loop invariant hoisting
07:37:27FromDiscord<impbox [ftsf]> GCC should do it I believe
07:37:45FromDiscord<impbox [ftsf]> Maybe the int conversion breaks it
07:38:36FromDiscord<Michal58> In reply to @impbox "Maybe the int conversion": I will try it with numbers.sum div number.len
07:39:52*jjido joined #nim
07:41:08FromDiscord<Michal58> In reply to @impbox "GCC should do it": It should? It increases the runtime space implicitly?
07:41:32FromDiscord<impbox [ftsf]> If you have speed optimisations on
07:42:05FromDiscord<impbox [ftsf]> -floop-invariant-motion
07:42:34FromDiscord<impbox [ftsf]> -fmove-loop-invariants i mean
07:42:47FromDiscord<impbox [ftsf]> Which is enable in O1 and higher
07:43:27FromDiscord<impbox [ftsf]> But maybe there's something which is causing it to not occur
07:44:47*neurocyte0132889 joined #nim
07:44:47*neurocyte0132889 quit (Changing host)
07:44:47*neurocyte0132889 joined #nim
07:46:28FromDiscord<Rika> I didn’t think it did on O1
07:53:40FromDiscord<Rika> I’m a bit more awake now, I guess a few minutes ago I forgot that optimise flags existed
08:01:31FromDiscord<Michal58> Surely danger implies O1?
08:01:51FromDiscord<Rika> o2
08:01:56FromDiscord<Rika> It implies O2
08:02:01FromDiscord<Rika> So yes
08:02:07FromDiscord<Michal58> In reply to @Michal58 "I will try it": Doesn't work either
08:02:23FromDiscord<Michal58> In reply to @Rika "It implies O2": Yeah I meant at least o1
08:03:06FromDiscord<Rika> Bad wording on my part
08:03:34FromDiscord<Rika> Maybe it needs explicit switch
08:10:49FromDiscord<Hamid Bluri> sent a code paste, see https://paste.rs/cYv
08:11:13FromDiscord<Hamid Bluri> (edit) "https://play.nim-lang.org/#ix=3HfB" => "https://play.nim-lang.org/#ix=3HfC"
08:14:08FromDiscord<Yardanico> iterable is weird, yes
08:14:12FromDiscord<Yardanico> it only works for templates now
08:14:52FromDiscord<Elegantbeef> It has very annoying semantics but is somewhat nice
08:15:17FromDiscord<Hamid Bluri> i wanted to implement something like https://github.com/zero-functional/zero-functional without macros
08:15:29FromDiscord<Elegantbeef> No can do
08:15:41FromDiscord<Elegantbeef> Unless you use closures
08:15:53FromDiscord<Hamid Bluri> closure iterators?
08:16:00FromDiscord<Elegantbeef> Yea
08:16:19FromDiscord<Hamid Bluri> ok, i try :- \
08:16:29FromDiscord<Hamid Bluri> i'll try
08:18:12FromDiscord<Elegantbeef> Really`iterable[T]` should probably be a static generic which would allow for taking in iterators/using values
08:47:00*PMunch joined #nim
09:14:53PMuncharkanoid, you around?
09:39:49*[R] joined #nim
09:53:05FromDiscord<frankzig> can a function work on both openArrays and HSlices?
09:53:25FromDiscord<frankzig> (trying to write generic code on iterable stuff)
09:55:38FromDiscord<Elegantbeef> What do you mean?
10:10:52FromDiscord<frankzig> sent a code paste, see https://play.nim-lang.org/#ix=3HfV
10:11:06FromDiscord<frankzig> is the a way to generalize it?
10:11:14FromDiscord<frankzig> (edit) "the" => "there"
10:12:04FromDiscord<Elegantbeef> use iterable + `items` on `openArray`
10:12:23FromDiscord<frankzig> sorry, i do not understand how...
10:12:25FromDiscord<Elegantbeef> though i guess `s[i]` isnt possible with an iterator
10:13:53*lumo_e joined #nim
10:14:23FromDiscord<Elegantbeef> It's probably just best to make two procs since there will be a lot of `when` statements
10:14:42FromDiscord<Elegantbeef> Plus it'll break the implicit openarray conversion
10:15:27FromDiscord<frankzig> this is a little sad, julia handles this much more nicely, anyway thanks! 🙂
10:20:40FromDiscord<Hamid Bluri> you can do it with templates btw
10:23:21FromDiscord<Hamid Bluri> @frankzig
10:23:22FromDiscord<Hamid Bluri> sent a code paste, see https://play.nim-lang.org/#ix=3Hg1
10:23:55FromDiscord<Hamid Bluri> it's a little dirty, i wanted to do it as fast as possible 😄
10:30:06NimEventerNew thread by Geohuz: Need explanation of static compiling warning message, see https://forum.nim-lang.org/t/8687
10:36:54FromDiscord<Cypheriel> What's the Nim alternative to Python's `sum()`? I'm trying to do something like `sum(@[1, 2, 3])` but that doesn't seems to be working well
10:38:33FromDiscord<Elegantbeef> !eval import std/math; echo sum @[1, 2, 3]
10:38:35NimBot6
10:39:16FromDiscord<Cypheriel> ugh... I think there are other modules fighting over `sum`
10:40:02FromDiscord<Elegantbeef> !eval import std/math echo math.sum(@[1, 2, 3])
10:40:04NimBotCompile failed: /usercode/in.nim(1, 17) Error: invalid module name: 'math echo math.sum(@[1, 2, 3])'
10:40:07FromDiscord<Cypheriel> oh. who knew one could just- yeah...
10:40:13FromDiscord<Cypheriel> oh or not \đŸ˜©
10:40:22FromDiscord<Elegantbeef> More an issue wit hthe bridge i think
10:40:28FromDiscord<Elegantbeef> Nah i left out a semi colon
10:40:30FromDiscord<Cypheriel> yeah
10:41:01FromDiscord<Solitude> In reply to @NimBot "Compile failed: /usercode/in.nim(1, 17)": wtf, you can have spaces in module names?
10:41:06FromDiscord<Solitude> or cant
10:41:16FromDiscord<Solitude> forget about it
10:41:22FromDiscord<Elegantbeef> Lol
10:41:40FromDiscord<Elegantbeef> I'm just an idiot that forgot a semicolon
10:45:01FromDiscord<Solitude> le unicode space has arrived https://media.discordapp.net/attachments/371759389889003532/917728397357096960/unknown.png
10:46:05FromDiscord<tandy> exciting \:)
11:20:03arkanoidPMunch: yeah
11:41:52arkanoidSolitude: are those ascii spaces or weird unicode space characters
11:48:23PMuncharkanoid, I saw you had some questions about Futhark :)
11:48:53arkanoidYes, unsure about what's best for nim ecosystem
11:49:58arkanoidIs c-like bindings a viable package on its own?
11:52:45arkanoidFuthark depends on clang, that's a quite important dependency, on the other hand it is not required once furthark has build its cache. Not sure if I delivered the question clearly enough
11:53:44PMunchI'm typing up a reply in the repo now :)
11:57:39arkanoidThanks!
11:59:52arkanoidBtw how it works now made me peep into the json and clear the cache manually (to re-symlink the last .nim) frequently. Not really sure if opir should stay transparent to the user
12:01:22arkanoidActually the symlink was due to vscode not reading cache folder, so it's not really a general problem, but this also links to the delivery question
12:03:14PMunchNot sure what you mean if Opir should stay transparent to the user
12:04:02PMunchAnd you're not really supposed to have to go digging in the json file and the cache. The idea is that you would use the original C documentation for writing your application, and Futhark just makes it transparently work in Nim.
12:06:02*supakeen quit (Quit: WeeChat 3.3)
12:06:32*supakeen joined #nim
12:09:12arkanoidPMunch: I dig into the json to find out which .h I have to add into importc section after the first one.
12:09:25PMunchAh right
12:09:39PMunchYes this is something that needs to be addressed
12:10:16PMunchBut it shouldn't be needed after I implement either the folder-based approach or something similar
12:11:09arkanoidIt is also to be considered that the smaller the nim file, the faster it is to work with
12:11:28arkanoidThis is why I prefer to include only the required .h
12:13:56arkanoidAlso prettifying opir output json would save some typing :)
12:15:31PMunchThe Opir output isn't really intended to be read though.. However I have piped it through `jq` whenever I wanted to read it
12:15:52PMunch`cat opir.json | jq | grep "someproc"`
12:16:16PMunchMaybe `grep -C` to get some lines around it so I can see where in the object it comes from
12:16:29PMunchI guess I could also use jq to search
12:21:57arkanoidSure, I do python3 -m json.tool, it was just to avoid some typing, pretty json is not slower than minefield one afaik
12:23:36FromDiscord<haxscramper> I want to split my projects into couple of DLLs because it takes a billion years to compile otherwise, and the worst offender is a autogenerated 16k-sloc code that barely ever changes
12:24:24FromDiscord<haxscramper> I just need to do an --app\:lib and somehow important things back? Or this is not possible, since nim can't do header declarations for procs
12:24:44FromDiscord<haxscramper> So everything would have to go through the nim-c-nim layer?
12:25:20PMuncharkanoid, it does take some work for Opir to format it, but only sligthly more work to parse, but it also takes way more space
12:25:29FromDiscord<enthus1ast> this is what i have also though about, would be super cool if there would be a fully automatic way [haxscramper](https://matrix.to/#/@haxscramper:matrix.org)
12:25:30PMunchNot that it matters terribly much these days
12:26:32PMunch@enthus1ast, it would be cool. But you would quickly run into issues with Nim features that don't exist in C
12:26:38FromDiscord<haxscramper> I wonder what would happen if I importc proc that uses nim gc types and so on
12:26:52FromDiscord<enthus1ast> but afaik there is'nt so load library, getSymAddr is the way to go
12:27:17FromDiscord<haxscramper> getSymAddr?
12:27:21PMunch`proc x(a: int or string): string = when a is string: a else: $a` for example would be tough to do over a DLL
12:27:46FromDiscord<haxscramper> Assume no generics then
12:27:54FromDiscord<enthus1ast> or define them in the forward declaration
12:27:56PMunch@haxscramper, if you use ARC it would probably work fine
12:27:59FromDiscord<haxscramper> I codegen this 16k abomination, so I can remove these things
12:28:01FromDiscord<enthus1ast> define/load
12:28:03PMunchOtherwise you need to use nimrtl I believe
12:28:44FromDiscord<haxscramper> Alright, looks like in total I would spend just as much time optimizing compilation as compiling
12:31:47FromDiscord<haxscramper> Hmmm https://github.com/genotrance/plugins that one does also look promising
12:32:20FromDiscord<haxscramper> What is a nimrtl↔(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
12:32:46PMuncharkanoid, something like this can be used to list out all names and the files they come from: cat ~/.cache/nim/epaper_d/opir_134442D73E800BC4.json | jq '.[] | .name, .file'
12:33:14PMunch@haxscramper, a dynamic library containing the garbage collector that has to be used if you want to load a Nim dynamic library in a Nim project
12:33:29PMunchhttps://nim-lang.org/docs/nimc.html#dll-generation
12:34:21PMunchBut again, if you use ARC I don't think you need that
12:34:58PMunchBut who knows, ARC documentation is unfortunately quite lacking..
12:37:37arkanoidIf arc adds memory cleanup at compile time asap, how can it help dealing with the code inside a dll loaded at runtime?
12:38:17FromDiscord<enthus1ast> the dll also contains cleanup code
12:39:40arkanoidWell yes, if it is an arc compiled dll
12:41:37*src joined #nim
12:41:54arkanoidCan nimsuggest give hints to ide from a nim .so/.dll?
12:42:49NimEventerNew thread by Loczaj: For loop using iterator `..`, see https://forum.nim-lang.org/t/8689
12:42:52PMunchNope, it needs sources
12:47:05*rockcavera joined #nim
12:47:05*rockcavera quit (Changing host)
12:47:05*rockcavera joined #nim
12:59:43arkanoidSo it's up to generate the smallest possible .nim file from headers
13:00:44arkanoidThe current approach where you have to explicitly write the headers that you are interested in is not wrong in this context
13:09:08PMunchAh you're back to Futhark :P
13:09:27PMunchIt's not wrong if you want the smallest possible Nim file
13:09:34PMunchBut I'm not sure that is actually a goal..
13:15:56*PMunch quit (Quit: Leaving)
13:28:06arkanoidNever changed topic
13:51:43*rockcavera quit (Remote host closed the connection)
13:53:39*arkurious joined #nim
13:55:13*PMunch joined #nim
13:58:59*lumo_e quit (Quit: Quit)
14:05:07*xet7 joined #nim
14:05:10FromDiscord<haxscramper> Can you upload an example of a `.h`, `.json` and `.nim` file, I want to take a look how they are handled for a moderately complex C libraries
14:07:59arkanoidHaxscramper, I'd be glad to send you the files, but it's better to first address what is a moderately complex c library for you.
14:08:35FromDiscord<haxscramper> just what you are working right now
14:08:35arkanoidAlso, futhark imports only the symbols from an explicit list of .h, that are not handled recursively
14:09:35arkanoidHaxscramper, ok, I have apache libarrow-glib and libgirepository already rolling
14:10:22arkanoidBut the imported .h (and so the size of the generated .nim) depends on the code I'm actually trying to compile
14:11:00FromDiscord<haxscramper> I just want to take a quick look, so no need to try to make it work or anything
14:13:25arkanoidLet me explain. It's quite simple really (and it might change in the future). Now thers opir that given one or multiple .h traverses them like clang would do and generate a big json (and this includes all symbols it encounters recusrively), then futhark reads this json and generates nim code only for the symbols contained in the explicitly listed .h so it won't clutter the .nim.
14:13:38arkanoidLet me pick your poison then
14:16:24arkanoidthis is just a strategy PMunch picked, and it is not wrong in my opinion, but it depends (and we're talking about it) on how it's intended to deliver futhark libs. You can join the discussion here https://github.com/PMunch/futhark/issues/7#issuecomment-987861978
14:17:10PMunchWell that's not really why it's built this way
14:18:08PMunchThe reason is because Futhark would otherwise pull in everything that your library requires. Including stuff that is already defined it Nim, or stuff which might be supplied by other Nim C wrapper libraries (like e.g. posix)
14:18:53FromDiscord<haxscramper> Let me remind you of↔> Sorry, but I really fear the wrappers that come out of it, it doesn't feel like a step in the right direction.
14:19:12FromDiscord<haxscramper> I think I need to wrap something myself them
14:19:14FromDiscord<haxscramper> (edit) "them" => "then"
14:19:23FromDiscord<haxscramper> probably libgit
14:19:49arkanoidwhere do you preder me to send test .json and .nim?
14:19:55arkanoids/predef/prefer
14:20:11PMunch@haxscramper, who's comment was that?
14:20:14FromDiscord<haxscramper> github gist
14:20:19FromDiscord<haxscramper> In reply to @PMunch "<@608382355454951435>, who's comment was": araq
14:20:40FromDiscord<haxscramper> about pulling the world into a wrapper - I think I have a solution to that, but it implies certain model of processing
14:20:51FromDiscord<haxscramper> Let me organize my thoughts,
14:20:53PMunchAh.. Well he doesn't seem to like the concept of automating it to this point it seems
14:21:11arkanoidsure it's c-like interface, not nim-like, but it's something that could be used to generate nim-like wrappers
14:21:49FromDiscord<haxscramper> there are clear benefits to providing a `.nim` wrapper that is commited to the VCS, without any extra build dependencies, but it makes stuff so much more complex on the processing side
14:21:50PMunchI agree that pulling everything into a single wrapper would be a bad idea. I want to add a system in Futhark that only pulls in things defined in a certain folder, that way you can give it a specific folder to include stuff from, and a start .h file and it will wrap an entire library.
14:22:31PMunchThat definitely makes it harder on the processing side, because at that point you have to convert IFDEF logic to Nim logic
14:23:35PMunchDepends of course what you're wrapping, but this can be a major source of problems with a pre-built wrapper
14:25:29NimEventerNew post on r/nim by stefantalpalaru: Windows stack corruption - a journey into the bowels of the beast, see https://reddit.com/r/nim/comments/rb0ab4/windows_stack_corruption_a_journey_into_the/
14:27:06NimEventerNew thread by Stefantalpalaru: Windows stack corruption - a journey into the bowels of the beast, see https://forum.nim-lang.org/t/8690
14:28:56FromDiscord<haxscramper> So, if I take the `iterator.h`, `string.h` and `vector.h`, each one of them defined in a separate header file, but string and vector import iterators, and then subsequently wrap each file, I get three different translation units, where iterator.h was visited three times. I convert all of them and then merge together in the same order as defined.
14:29:37FromDiscord<haxscramper> If I see a type/proc definition that I have already seen earlier, I only compare it structurally, to ensure there are no differences via various translation unit wrappings
14:30:31FromDiscord<haxscramper> If I introduce concept of a "library" in wrapper generator, I can also handle interproject dependencies
14:31:09FromDiscord<haxscramper> For example, imagine iterator.h was defined in the different wrappers. In that case you would probably better doing `import` for it rather than generating it from scratch
14:31:37FromDiscord<haxscramper> So I think the right approach is to try and "cut out" unnecessary parts from the translation units generated by libclang
14:32:08FromDiscord<haxscramper> there is a `isFromMainModule` or something similar check, it would allow to wrap only entries from the main file of the translation file
14:32:11FromDiscord<haxscramper> (edit) "file" => "unit"
14:33:10FromDiscord<haxscramper> This is not realiable nough, because some headers provide a toplevel dispatch into multiple smaller headers, for example `<string>` dispatches into 10+ different files, some of which are also used in the vector
14:33:14PMunchI tried that, but the problem I had with isFromMainModule is that I generate a dummy .h file which includes any defines that are used
14:33:15FromDiscord<haxscramper> and some in the iterator
14:34:04PMunchI have this in one of my projects: http://ix.io/3Hh7/
14:34:08FromDiscord<haxscramper> If I sequentially process the headers I need to either order them manually, or maybe write down dependencies manually and then do topological sorting
14:34:35PMunchThat XUTIL_DEFINE_FUNCTIONS is entered into the .h dummy file and then I run Opir on the dummy file
14:34:47PMunchSo isFromMainModule would give me false for all symbols
14:35:18FromDiscord<haxscramper> yes, that's why I said it is not reliable enough
14:35:55PMunchI guess in Futhark you could create individual x.nim, xutil.nim, xlib.nim, xos.nim, xcomposite.nim, xdamage.nim, damagewire.nim etc. that each just imported one .h file
14:38:13FromDiscord<haxscramper> I want to do this, instead of just one huge file
14:38:51PMunchThat should be possible with Futhark right now
14:39:01PMunchHaven't tried it though
14:39:43NimEventerNew Nimble package! gigi - GitIgnore Generation Interface, see https://github.com/attakei/gigi
14:40:06arkanoidhaxscramper: please find here a quick example https://github.com/arkanoid87/nimarrowglib/
14:42:20FromDiscord<haxscramper> the `_452985878` parts are not from futhark, right?
14:42:34PMunchYes they are
14:43:36FromDiscord<haxscramper> I don't quite understand the `when not declared(Garrowchunkedarrayclassproc):` sections - they exist to handle multiply type declarations in the C code?
14:43:37arkanoidin this example I've imported all the .h referenced in original "arrow-glib.h", so the generated .nim is way larger than required, as the nim code really requires just a dozen of symbols
14:43:40FromDiscord<haxscramper> forward declarations
14:43:56PMunchBasically all types have three identifiers, one which is used for arguments and fields, one which is used for the actual type definition, and one without the numbers which is tied to the definition through a `when not defined(identifier)` check
14:45:35PMunchThey handle a couple things, first off if I have a procedure or type defined in Nim it won't override it (e.g. if I have posix imported and try to import a C file that includes some of the same symbols), they also allow you to manually override types by simply hand-writing their definition before the imports.
14:45:38FromDiscord<tbrekalo> how do I avoid making extra copies of the sequence with the .map procedure? or does the compiler avoid copies? https://media.discordapp.net/attachments/371759389889003532/917788949399863296/unknown.png
14:46:25PMunchSo you would only use the identifier without the numbers in your actual code
14:46:26FromDiscord<haxscramper> ah, so the `.nim` is included, not imported
14:47:02arkanoidtbrekalo try zero-functional https://github.com/zero-functional/zero-functional
14:47:09PMunchYes, the futhark `importc` either returns all that code as a NimNode, or it returns a NimNode which is an include statement for a cached file
14:47:12FromDiscord<haxscramper> Well, I do understand the reasoning, but damn the codegen looks strange
14:47:41PMunchYeah, the codegen is a bit of a mess. But it's similar to Nims C output, it's not really meant to be human-consumable
14:49:11arkanoidand it works out of the box. PMunch so far every time I ended up with some running toy using futhark, I had never to use/cast to *_<hash> types
14:50:00PMunchOf course not :) They aren't meant to ever be used
14:50:15PMunchIt's just a little trick for the compiler to be happy
14:53:45arkanoidPMunch: how different/difficult would be to generate multiple .nim files according to original .h file source of the symbol (name field in json iirc) and rebuild the import hierarchy in the header of each of them? (would this actually work?)
14:54:41PMunchHmm, I guess that could work
14:54:44arkanoidit's actually quite similar to the lantern fish problem. Instead of counting all the fishes, you put them in buckets according to the timer/name in this context
14:55:20PMunchThe only thing is that you might run into issues like circular imports (which are fine in C, but not in Nim)
14:55:41FromDiscord<haxscramper> this won't work
14:55:51FromDiscord<haxscramper> you need to build a whole graph of which fields uses what type
14:56:00FromDiscord<haxscramper> and then clusterize it into nim modules
14:56:19FromDiscord<haxscramper> the `#include` tracing is meaningless, because you can forward-declare a type in C
14:56:19PMunchNah he just means base it off-of which .h file it originally came from
14:56:31FromDiscord<haxscramper> and use pointer to that type, while in nim you can't
14:56:40PMunchWell I only include the actual definitions in the Opir output
14:56:51PMunchSo Futhark doesn't see forward decls
14:59:34*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz
)
15:00:28arkanoidPMunch: I think it's worth leveraging on how clang handles this problem and represent it's structure fragmented in something nim likes
15:04:14FromDiscord<haxscramper> welcome to bullshit
15:04:14FromDiscord<haxscramper> sent a code paste, see https://paste.rs/hWy
15:04:53FromDiscord<haxscramper> `nim c '--hint[Path]:on' --hints:on file`
15:04:58FromDiscord<haxscramper> how does this even work
15:06:29PMunchHmm, that's odd indeed @haxscramper
15:07:02PMunchI assume you're using Nim and not Nimskull there
15:07:16FromDiscord<haxscramper> Yes, I'm using nim
15:07:19FromDiscord<haxscramper> I do have an additional `nim.cfg` file, but it explicitly says it added the a path there
15:07:45PMunchYeah that looks weird
15:08:03PMunchAnyways, I'm off
15:08:12*PMunch quit (Quit: Leaving)
15:10:23FromDiscord<haxscramper> `nimble install --nimbleDir:(pwd)/deps/pkgs futhark`
15:10:29FromDiscord<haxscramper> `/mnt/workspace/clean-clone/hack/nim.cfg(2, 3) Error: invalid package name: /mnt/workspace/clean-clone/hack/deps/pkgs/pkgs`
15:12:31FromDiscord<tbrekalo> sent a long message, see http://ix.io/3Hhv
15:13:06FromDiscord<haxscramper> `for name, field in fieldPairs()` allows to assign to a `field` is object that you iterate on is mutable
15:13:23FromDiscord<haxscramper> so assuming fields are written in the same order you just need to loop through CSV
15:13:35FromDiscord<tbrekalo> ye
15:13:48FromDiscord<tbrekalo> I am gonna try that now then; ↔Thanks @haxscramper
15:15:49FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3Hhz
15:16:00FromDiscord<haxscramper> how do I create a `generaed` file from futhark?
15:17:07FromDiscord<haxscramper> also, how do I import relative file, simple `"file.h"` does not work
15:18:21FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3HhA
15:23:39FromDiscord<haxscramper> If I copy-paste the absolute file path it does not provide A wrapped structs anyway
15:23:52FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3HhD
15:24:01FromDiscord<haxscramper> cache file is empty
15:43:18arkanoidhaxscramper, I'm back
15:43:40arkanoidlet me read your context, I might help. Not helping on internals, but I've done something
15:44:45FromDiscord<haxscramper> First I want to know how to wrap a relative file
15:45:43arkanoidcan you share the .h?
15:48:42FromDiscord<haxscramper> `struct A; struct B; struct A { struct B b; }; struct B { struct A a; };`
15:49:14arkanoidK. One minute
15:52:07FromDiscord<haxscramper> PMunch I think you can also look into interfacing with a conan PM. It can generate `.json` with all the include paths, or create a file with gcc linkage/includepath information
15:52:38arkanoiddone, it works to me
15:53:03FromDiscord<haxscramper> `conan install . --build=missing` generates file that you can then pass as `--passL:"@$(pwd)/conanbuildinfo.gcc"`
15:53:33FromDiscord<haxscramper> and I think clang can also read everything using just `@$(pwd)/conanbuildinfo.gcc` passed to command-line flags
15:53:47FromDiscord<haxscramper> `@/absolute/path/to/the.gcc`
15:53:59FromDiscord<haxscramper> In reply to @arkanoid "done, it works to": can you declare `var a: A` and `var b: B`
15:54:16FromDiscord<haxscramper> relative paths also works?
15:56:26arkanoidhaxscramper: this compiles on my machine https://play.nim-lang.org/#ix=t%20wr
15:56:55arkanoidwhere a_and_b.h is is <nimble_proj_root>/include/a_and_b.h
15:57:04FromDiscord<haxscramper> > `#!/usr/bin/env python` ?
15:57:09arkanoid?
15:57:37arkanoidwhoa! what happened? it must be a play.nim-lang.org app issue
15:57:40FromDiscord<haxscramper> your paste is a python code with some http request
15:58:10arkanoidnope, it doesn't come from my pc, it's a backend thing
15:58:49arkanoidhttp://sprunge.us/ it's a pastebin service
15:59:01arkanoidpossibly a component of play.nim-lang.org
15:59:22arkanoiddoes this work? https://play.nim-lang.org/#ix=3HhL
16:02:06arkanoidI'm also trying to do A.b = objB.addr and B.a = objA.addr, but I'm getting "Error: 'A.b' cannot be assigned to"
16:07:48FromDiscord<Pralkarz> sent a code paste, see https://play.nim-lang.org/#ix=3HhO
16:08:42FromDiscord<Yardanico> yes, you can, but there's "truthy" or "falsey" value for strings by default in nim
16:08:52FromDiscord<Yardanico> if you want to check the length, just do `if str.len > 0`
16:09:55FromDiscord<Pralkarz> In reply to @Yardanico "yes, you can, but": I actually want the truthy/falsey behavior, but `if not "":` doesn't compile.
16:10:07FromDiscord<Yardanico> because "" is not a bool
16:10:23arkanoidif you want to use a specific constant rule to transform a string into a bool, you can write your own converter, but this would apply automatically to the whole scope so use it with grain of salt
16:10:34FromDiscord<Yardanico> yes
16:10:48FromDiscord<Pralkarz> Yup, therefore my question on how I can evaluate empty string to be falsey.
16:10:59FromDiscord<Yardanico> you can write a converter
16:11:04FromDiscord<Pralkarz> In reply to @arkanoid "if you want to": Aw, I'll just stick to `if str.len > 0 `in that case.
16:11:09FromDiscord<Yardanico> but as arkanoid said, it'll apply to the whole scope implicitly
16:11:10FromDiscord<Pralkarz> (edit) "0 `in" => "0` in"
16:11:22FromDiscord<Pralkarz> All right, thanks!
16:11:35arkanoidconverter toBool(s: string): bool = s.len > 0
16:11:38arkanoidfor example
16:16:57FromDiscord<tbrekalo> can I generate an iterator from the seq[T]?
16:18:52FromDiscord<tbrekalo> without having to write my own closure; something like `.items` ?
16:19:42FromDiscord<haxscramper> In reply to @arkanoid "does this work? https://play.nim-lang.org/#ix=3HhL": no, it doesn't work
16:20:03arkanoidhaxscramper, what error do you get?
16:20:11FromDiscord<haxscramper> same error, file not found
16:20:42FromDiscord<haxscramper> anyway, I don't care that much to spend more time on this one, so no big deal
16:21:40arkanoidtbreakalo: maybe this? https://nim-lang.org/docs/iterators.html#items.i%2Carray%5BIX%2CT%5D
16:22:00arkanoidwhich file?
16:22:29arkanoidok, np. If you intend to continue, just give me a ping. Maybe I can help
16:25:38FromDiscord<tbrekalo> In reply to @arkanoid "tbreakalo: maybe this? https://nim-lang.org/docs/it": doesn't seems to work
16:30:38arkanoidtbreakalo, trivial example, but what do you mean? https://play.nim-lang.org/#ix=3HhX
16:31:08FromDiscord<spotlessapple> Is there a recommended way to add rows to a data frame in datamancer? Saw documention for columns, but having a difficult time finding info for rows
16:33:15*xet7 quit (Quit: Leaving)
16:37:41arkanoidspotlessapple, have a look at these templates https://scinim.github.io/Datamancer/dataframe.html#18
16:38:11FromDiscord<tbrekalo> In reply to @arkanoid "tbreakalo, trivial example, but": need it as the closure iterator and want to zip it with another iterator
16:38:30FromDiscord<tbrekalo> can send you the example later today; g2g now :/
16:39:12arkanoidtbreakalo, consider this also https://github.com/zero-functional/zero-functional#zip
16:39:17FromDiscord<tbrekalo> I want to zip values from fieldPairs with seq items iterator; that's the functionality I am looking for
16:39:50FromDiscord<tbrekalo> In reply to @arkanoid "tbreakalo, consider this also": Ye; have it bookmarked; ↔Will check it out
16:40:21*PMunch joined #nim
16:44:23FromDiscord<tandy> is anyone here familiar with coro?
16:44:27FromDiscord<tandy> (coroutines)
16:44:35FromDiscord<tandy> sent a code paste, see https://play.nim-lang.org/#ix=3Hi0
16:44:39FromDiscord<tandy> i dont understand what this proc does
16:45:50FromDiscord<tandy> "how often" what?
16:52:35PMunchHow often to check whether the coroutine is checked for completion I guess
16:53:58PMunchSo who's ready for some AoC streaming?
17:01:15*xet7 joined #nim
17:09:37PMunchStream is live: https://www.twitch.tv/pmunche
17:13:23*rockcavera joined #nim
17:13:23*rockcavera quit (Changing host)
17:13:23*rockcavera joined #nim
17:21:06arkanoidhere we go again, vscode nim extension is not working for unknown reason
17:21:16PMunchTake a break and watch a stream :)
17:24:33FromDiscord<haxscramper> What extension do you most people use?
17:24:35FromDiscord<haxscramper> saem's?
17:25:21FromDiscord<dom96> whatever's the oldest
17:25:28FromDiscord<dom96> haven't tried others though, maybe they are better
17:27:03Amun-Rahaxscramper: Zaitsev's one
17:27:40Amun-Rait's outline pretty suck tho
17:27:46Amun-Ras*
17:29:38arkanoidI use seam, but the real issue is that it doesn't work without any log info
17:29:59arkanoidwhat I use to track down if it's working or not is "ps -ae | grep nimsuggest"
17:31:07FromDiscord<dom96> I don't use nimsuggest at all, only VS Code's dumb auto complete
17:31:39arkanoidwhat I've tracked down so far is that changing config.nims sometimes makes the extension unresponsive no matter if you revert it to previous state
17:31:58Amun-RaI mostly use (n)vim with nim.vim plugin
17:32:00arkanoidso you have to restart, and guess
17:32:46arkanoidvim is a text editor that can be upgraded to ide, vscode is an ide that can also be an advanced text editor
17:33:41arkanoidI bet nim community will always focus in vscode or next available ide (I'm talking as neovim user too, but I'm focusing on what the community uses)
17:40:07FromDiscord<Smarc> Hm, how do you guys treat `case` statements syntactically? Do you indent the `of`'s? Do you place a colon after the `case` line?
17:40:28FromDiscord<dom96> no and no
17:41:27FromDiscord<Smarc> I also think the colon is unneccessary, but why not indenting the of's?
17:41:43FromDiscord<dom96> Because that is not how the BDFL intended it
17:42:18FromDiscord<Smarc> But if the allmighty did not intended it, why is it possible? :x
17:42:37FromDiscord<Solitude> to let you learn on your own mistakes
17:43:07FromDiscord<Smarc> I'm not worthy.
17:43:17FromDiscord<dom96> good question 🙂
17:52:53arkanoidI'm parsing a file of X lines one by one, but I have to skip some during the task. To optimize the proc, I'm using newSeqOfCap(totalLines) to avoid reallocations, but at the end of the proc I might also end up with an empty seq in worst case. Is it better to shrink (by copy?) the seq afterwards, or let seq grow on it's own?
18:00:46FromDiscord<konsumlamm> In reply to @haxscramper "What extension do you": these days everyone recommends saem's (and it also works better ime)
18:00:49*krux02 joined #nim
18:03:11PMunchI'm still thrown by the fact that the case line doesn't need a colon...
18:03:14PMunchI always add one
18:03:40PMuncharkanoid, probably shrink at the end
18:04:46arkanoidPMunch: schrink by copy, or there's some black magic to reshape the malloc to correct size?
18:04:53PMunchAdding as you go will create progressively larger arrays to fit the memory into, and possibly trigger a lot of copies.
18:05:12PMunchNo way to reshape an alloc, but do you actually need to reclaim that space right away?
18:05:38PMunchThe Nim allocator might actually even be able to reuse it if you call setLen, but I kinda doubt it
18:06:02arkanoidnot necessary. I opt for speed, not memory consumption. But so far I fear I'm facing too many copies so I'm focusing on that
18:07:08PMunchIf you're opting for speed just run with gc:none :P
18:07:13PMunchAnd never release memory
18:07:58PMunchNothing says speed like a gc:none party, because a gc:none party don't stop (until you run out of memory and crash)
18:11:05FromDiscord<Yardanico> not allocating memory is also faster than allocating memory :P
18:11:28arkanoidlong live to king stack!
18:12:50FromDiscord<Hamid Bluri> In reply to @dom96 "I don't use nimsuggest": you must have a good memory 😕
18:14:51*terminalpusher joined #nim
18:14:53PMunchGood memory?
18:15:23arkanoidhe is referring about dom96 not using nimsuggest or any autocompletion thingy
18:16:14PMunchYou don't need that good memory :P
18:16:33PMunchWell I guess you need to remember the names of different modules
18:16:42PMunchBut you need that anyways don't you?
18:17:56FromDiscord<IsaacPaul> In reply to @hamidb80 "you must have a": I'm the same. I have terrible memory. I heavily rely on the autocomplete and ide tools when programming.
18:18:25FromDiscord<IsaacPaul> In reply to @PMunch "But you need that": Nope google will remember for you or any notes you keep lol
18:19:10FromDiscord<Hamid Bluri> In reply to @IsaacPaul "Nope google will remember": every time you code you google it ? 😄
18:19:48FromDiscord<Hamid Bluri> i google it and use nimsuggest togother 😄
18:20:21FromDiscord<IsaacPaul> Yea, well I'm always switching between kotlin, java, swift, objc. So I might have done xyz before but its long gone
18:21:40arkanoidI also rely a lot on ide tools. I have to deal daily with 5 or more ecosystems
18:21:58FromDiscord<Hamid Bluri> In reply to @arkanoid "I also rely a": omg
18:22:20FromDiscord<Hamid Bluri> youre super human
18:22:50*jjido joined #nim
18:22:54PMunchMeanwhile I'm here programming Nim and C# in Vim without much in the way of IDE tools :P
18:23:25FromDiscord<Hamid Bluri> In reply to @PMunch "Meanwhile I'm here programming": pmunch what are those red lines on your VIM 😕
18:24:02arkanoidPMunch: I was a C# programmer once, and well, it's a compiled thing. Try to mix interpreted and compiled world, with some functional in the middle. I feel stressed
18:24:03PMunchWhich ones?
18:24:07PMunchThe long vertical ones?
18:24:15FromDiscord<Hamid Bluri> In reply to @PMunch "The long vertical ones?": yes
18:24:21arkanoidcolumn limit
18:24:24PMuncharkanoid, I'm not a C# dev by choice to but it that way :P
18:24:35PMunch@Hamid_Bluri, those are column limits
18:24:56arkanoidPMunch: I was a videogame programmer once, I used to do that in C# (Unity Engine mainly, but not just that)
18:24:58PMunchOne at 80, and one at whatever it is that GitHub wraps at
18:25:21PMunchI've also done game programming in Nim for a job
18:25:57FromDiscord<IsaacPaul> I'm sure you're much more productive when you've internalized everything. I used to work on one code base a few years ago, and it's like you're still thinking about solutions when you're home. Now on several code bases I definitely don't even retain anything lol
18:26:45arkanoidExactly, it's context switching
18:26:56arkanoidI get paid to context switch fast
18:27:30arkanoidonce upon a time, I used to write large codebases. Now is all scripting in different languages
18:27:33PMunchOh well, I've gotta run
18:28:19FromDiscord<Hamid Bluri> @arkanoid , did you find a solution for your async server that couldn;t recover after network corrupt?
18:28:30FromDiscord<Hamid Bluri> it was a month ago i guess
18:29:04arkanoidyes, after a quite large refactor the problem went away, but I upgraded nim in the meanwhile ... who knows
18:29:09arkanoidmaybe was a bug
18:29:31FromDiscord<Hamid Bluri> that's ok : D
18:30:22FromDiscord<Hamid Bluri> pmunch i've got something for you
18:30:23FromDiscord<Hamid Bluri> https://github.com/mitchellh/advent-2021-sql
18:30:36FromDiscord<Hamid Bluri> he's a legend
18:30:42PMunchHaha, yeah I saw that on HN this morning :P
18:32:03*PMunch quit (Quit: leaving)
18:35:00arkanoidwhat?
18:35:18arkanoid:D ninja!
18:52:57arkanoidcan "when" be used as expression/block?
18:53:51FromDiscord<Solitude> !eval echo (when true: 3 else: 4)
18:53:53NimBot3
18:54:31arkanoidthanks!
19:00:49arkanoidand can I use case statement at compile time to discriminate generic parameter T?
19:01:08arkanoidI'm using a long chain of when/elif now
19:01:59arkanoidI'm getting "Error: selector must be of an ordinal type, float or string" but not sure if I'm using it correctly
19:04:34arkanoidnevermind, I've found a good way to layout the long chain
19:04:47arkanoid(using block:)
19:22:34FromDiscord<victorNine> Hi! I'm trying to compile for openWRT using the info here\: https://nivrrex-github-io.translate.goog/posts/crosscompiling-for-openwrt-with-nim/?_x_tr_sch=http&_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=no
19:22:59FromDiscord<victorNine> but I'm getting errors like mips-openwrt-linux-gcc\: error\: unrecognized argument in option '-mtune=generic'
19:23:09FromDiscord<victorNine> any idea what I'm doing wrong
20:12:05arkanoidoh dear, got a "Error: internal error: expr(skModule); unknown symbol" on nim 1.6.0
20:18:26*pch_ joined #nim
20:18:49arkanoid!eval import std/sequtils; sequtils
20:18:51NimBotCompile failed: /usercode/in.nim(1, 22) Error: internal error: expr(skModule); unknown symbol
20:19:24arkanoidI know it's silly, but should this raise an internal error?
20:19:35arkanoid!eval import std/hashes; hashes
20:19:37NimBotCompile failed: /usercode/in.nim(1, 20) Error: internal error: expr(skModule); unknown symbol
20:20:13*pch quit (Ping timeout: 240 seconds)
20:59:00*vicfred joined #nim
21:33:14*terminalpusher quit (Remote host closed the connection)
21:59:48FromDiscord<retkid> Out of memory defects originate from a failed allocation, right?
22:12:11FromDiscord<konsumlamm> In reply to @arkanoid "I know it's silly,": nothing should raise an internal error, ever
22:12:18FromDiscord<konsumlamm> an internal error is always a bug
22:12:39FromDiscord<konsumlamm> arkanoid: i suggest you open an issue for that
22:36:37FromDiscord<IsaacPaul> Shouldn't it be `from module import whatever` or just `import module`
22:37:01FromDiscord<ynfle (ynfle)> As apposed to what?
22:37:16FromDiscord<IsaacPaul> `import std/sequtils; sequtils` mentioned above
22:38:16FromDiscord<ynfle (ynfle)> The `;` is the equivalent (in many cases) of a newline in nim code
22:38:41FromDiscord<ynfle (ynfle)> the `import std/sequtils` is import the `sequtils` module from the standard library
22:39:34FromDiscord<IsaacPaul> ah I think he probably meant to do `std/sequtils as sequtils`
22:41:07FromDiscord<ynfle (ynfle)> There's no reason for that. It's imported as sequtils. The `std/` is just qualifying it as the standard library version
22:49:12FromDiscord<ynfle (ynfle)> @arkanoid what were you trying to do with that?
22:53:52FromDiscord<Rika> Probably just stumbled upon it
22:54:30FromDiscord<retkid> In reply to @PMunch "Nothing says speed like": same
23:17:39*krux02 quit (Remote host closed the connection)
23:52:21*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz
)