00:00:14 | FromDiscord | <sOkam!> can probably modify it further to fit what you need |
00:05:17 | FromDiscord | <sOkam!> can I type be declared in multiple spots in some way, even if its only defined once? |
00:29:38 | * | lumo_e quit (Quit: Quit) |
00:31:04 | FromDiscord | <voidwalker> Didn't know of parseini, will give it a try |
00:34:24 | FromDiscord | <Rika> It’s a derivative of parsecfg |
00:56:21 | FromDiscord | <voidwalker> yep, it works, puts empty string if no value is found, and does not stop on `,` |
01:37:26 | * | ltriant quit (Ping timeout: 246 seconds) |
01:43:42 | FromDiscord | <MetuMortis> sent a code paste, see https://paste.rs/ya2 |
01:48:12 | FromDiscord | <MetuMortis> fixed it, I didn't know mySeq should be mutable |
01:49:24 | FromDiscord | <Rika> `sort` sorts the sequence itself, `sorted` returns a copy of the sequence that is sorted |
02:09:44 | FromDiscord | <auxym> sent a code paste, see https://play.nim-lang.org/#ix=4mon |
02:14:59 | FromDiscord | <MetuMortis> btw solving advent-of-code at 5am with nim is very funny |
02:15:11 | FromDiscord | <MetuMortis> (edit) "funny" => "amazin" |
02:15:11 | FromDiscord | <MetuMortis> (edit) "amazin" => "amazing" |
02:22:13 | FromDiscord | <MetuMortis> Where does "a" and "b" come from here? And is it possible to write a function that takes an operation just like this? https://media.discordapp.net/attachments/371759389889003532/1068717602047795300/image.png |
02:22:30 | FromDiscord | <Rika> a and b are injected by the template |
02:23:03 | FromDiscord | <Rika> it is possible but i dont know why it isnt already in sequtils |
02:23:56 | FromDiscord | <MetuMortis> In reply to @Rika "it is possible but": what isn't already in sequtils |
02:25:26 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=4moq |
02:26:48 | FromDiscord | <Rika> you would pass a function instead of using a and b |
02:27:06 | FromDiscord | <Rika> if you wanted to have the same exact syntax as foldl then it is impossible |
02:27:12 | FromDiscord | <Rika> (edit) "if you wanted to have the same exact syntax as foldl ... then" added "but as a function" |
02:27:56 | FromDiscord | <MetuMortis> In reply to @Rika "if you wanted to": I just wanted to know is it possible to inject variables ("a" and "b" in this example) just like foldl does |
02:28:36 | FromDiscord | <Rika> oh |
02:28:38 | FromDiscord | <Rika> in a template |
02:28:42 | FromDiscord | <Rika> not a function |
02:29:56 | FromDiscord | <Rika> sent a code paste, see https://paste.rs/LOA |
02:32:52 | FromDiscord | <MetuMortis> thankd |
02:32:58 | FromDiscord | <MetuMortis> (edit) "thankd" => "thanks" |
02:41:02 | FromDiscord | <Tuatarian> I have this really strange issue |
02:41:22 | FromDiscord | <Tuatarian> I ahve a reference, which is not nil, but attempting to `deepCopy` it segfaults (gives a maybe reading from nil error) |
02:42:07 | FromDiscord | <MetuMortis> In reply to @Rika "its possible yes, it": it looks like defining things in templates is not a good practice :d https://media.discordapp.net/attachments/371759389889003532/1068722614207520869/image.png |
02:46:49 | FromDiscord | <Tuatarian> I actually have no clue why this is happening |
02:47:10 | FromDiscord | <Tuatarian> I can confirm my reference is not nil |
02:47:13 | FromDiscord | <kots> In reply to @MetuMortis "it looks like defining": Put it inside a `block` |
02:47:14 | FromDiscord | <Tuatarian> but nim for some reason doesn't want to copy it |
02:53:17 | FromDiscord | <Elegantbeef> Nah kots |
02:53:19 | FromDiscord | <Elegantbeef> put it inside of `if true:` |
02:53:24 | FromDiscord | <Elegantbeef> Unless it's supposed to make a new scope |
02:57:18 | FromDiscord | <MetuMortis> Doesn't putting it into if true block or putting it into "block" basically same things? |
02:57:24 | FromDiscord | <kots> We do want each injected `a` to be in its own scope to avoid the redefinition error, isn't it |
02:57:31 | FromDiscord | <MetuMortis> (edit) "Doesn't" => "Aren't" |
02:57:46 | FromDiscord | <MetuMortis> In reply to @kots "We do want each": Yes |
02:57:50 | FromDiscord | <kots> In reply to @MetuMortis "Aren't putting it into": I would have thought so as well |
02:59:54 | FromDiscord | <Elegantbeef> The semantics are different |
03:00:38 | FromDiscord | <Elegantbeef> `break` works with blocks so if you do `if true: break` you can still exit a for loop |
03:00:39 | FromDiscord | <Elegantbeef> if you do `block: break` you cannot |
03:01:59 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4mov |
03:02:17 | FromDiscord | <kots> True enough... |
03:08:02 | * | genpaku quit (Read error: Connection reset by peer) |
03:08:44 | * | genpaku joined #nim |
03:14:50 | FromDiscord | <Tuatarian> does anyone have any idea why nim segfaults trying to `deepCopy` a non-nil ref? |
03:16:13 | FromDiscord | <Elegantbeef> Perhaps it's a complex data type that causes an issue with the deepcopy algo |
03:31:06 | * | ltriant joined #nim |
03:33:08 | FromDiscord | <Tuatarian> it is a complex data type |
03:33:23 | FromDiscord | <Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=4moz |
03:33:26 | FromDiscord | <Tuatarian> though it copies fine in other places |
03:33:32 | FromDiscord | <Tuatarian> not sure why this in particular causes an issue |
03:34:34 | FromDiscord | <Elegantbeef> Might be `cursor`? |
03:35:06 | FromDiscord | <Tuatarian> probably is |
03:35:12 | FromDiscord | <Tuatarian> is there anything I can do about this? |
03:35:26 | FromDiscord | <Tuatarian> I guess I just have to write my own deepcopy for `ASTNode`? |
03:45:15 | FromDiscord | <Tuatarian> beef can you confirm if that's what needs to happen or if there's a potentially better way |
03:45:27 | FromDiscord | <Elegantbeef> I dont know I dont deepcopy |
03:46:14 | * | forest joined #nim |
03:47:08 | * | forest quit (Client Quit) |
03:50:56 | * | genpaku quit (Ping timeout: 248 seconds) |
03:53:46 | * | genpaku joined #nim |
04:14:51 | * | arkurious quit (Quit: Leaving) |
06:04:53 | om3ga | pyolyokh: It's strange, while I understand what you mean about cast conversion, the stuff I want to do has type uint8, which is byte, and I got the same results |
06:06:19 | om3ga | for example eth.etherType = ((data[12] shl 8) or data[13]), and data is seq[uint8] |
06:07:37 | om3ga | data[12] == 8, data[13] == 0, ^--this should assign to eth.etherType value 2048 |
06:08:05 | om3ga | but it assigns 0... |
06:09:22 | FromDiscord | <pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4mp0 |
06:09:33 | FromDiscord | <pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4mp1 |
06:12:41 | om3ga | pyolyokh: this is numeric conversion? |
06:13:15 | om3ga | I mean .int |
06:13:24 | FromDiscord | <pyolyokh> yeah, that's a conversion to int |
06:14:29 | om3ga | thanks. I will try that, but seems it may slow down the pcap parsing. I cannot remember if such conversion was made in C code... |
06:17:57 | om3ga | pyolyokh! it work |
06:18:26 | om3ga | thanks!, is that the same as int(data[12]) ? |
06:18:38 | FromDiscord | <Elegantbeef> yes it's just UFCS |
06:19:36 | om3ga | aha.. where first parameter passes as input to .int(here) |
06:19:40 | om3ga | thanks! |
06:22:32 | * | azimut quit (Ping timeout: 255 seconds) |
06:30:09 | FromDiscord | <tfp> running into a very weird issue.. |
06:30:11 | FromDiscord | <tfp> https://media.discordapp.net/attachments/371759389889003532/1068780004730744852/image.png |
06:30:32 | FromDiscord | <tfp> if i make that random allocation on line 3-- all the glyph sizes are w: 9, h: 15 |
06:30:41 | FromDiscord | <tfp> if i don't make that allocation, no issue. the sizes are correct |
06:30:53 | FromDiscord | <tfp> only happens on orc, doesn't happen with --gc:refc |
06:31:06 | FromDiscord | <tfp> ..any ideas? |
06:31:17 | FromDiscord | <tfp> how can i even debug this |
06:33:02 | FromDiscord | <Elegantbeef> Sounds like some type of heap/stack issue |
06:33:14 | FromDiscord | <Elegantbeef> Run through valgrind |
06:35:49 | FromDiscord | <tfp> hmm, doesn't ORC only collect on allocations? |
06:36:17 | FromDiscord | <Elegantbeef> Orc is deterministic, so it's behaviour might just be showcasing an issue with your logic |
06:36:21 | FromDiscord | <tfp> let me try leaking the font file memory |
06:36:28 | FromDiscord | <tfp> maybe freetype doesn't copy it |
06:39:40 | FromDiscord | <tfp> yeah that was it |
06:39:53 | FromDiscord | <tfp> mm interesting |
06:40:13 | FromDiscord | <tfp> i'm surprised the memory wasn't collected when the string went out of scope |
06:40:19 | FromDiscord | <tfp> or maybe it was but just not reclaimed idk |
06:40:50 | FromDiscord | <Elegantbeef> It's not 0'd likely |
06:40:51 | FromDiscord | <tfp> also surprised that GC_ref doesn't have a method for strings, the docs say it does |
06:41:10 | FromDiscord | <Elegantbeef> Orc/Arc strings are different than refc strings |
06:41:41 | FromDiscord | <tfp> are they value types or COW or something? |
06:42:05 | FromDiscord | <Elegantbeef> They're both value types |
06:42:22 | FromDiscord | <Elegantbeef> But there is no ref counter on string now |
06:43:59 | FromDiscord | <tfp> oh i always assumed they were ref types |
06:44:14 | FromDiscord | <tfp> why is there a ref counter in refc if they're value types in refc? |
06:44:51 | FromDiscord | <tfp> wha.. even seqs are value types |
06:44:54 | FromDiscord | <tfp> that's so weird |
06:44:59 | FromDiscord | <Elegantbeef> Yes |
06:44:59 | FromDiscord | <Rika> Value semantics, internally they’re references |
06:54:23 | FromDiscord | <tfp> https://media.discordapp.net/attachments/371759389889003532/1068786099138330634/image.png |
06:54:33 | FromDiscord | <tfp> coo |
06:56:04 | FromDiscord | <Rika> Are you making a font renderer or something |
06:56:46 | FromDiscord | <tfp> just using freetype in a game engine i'm building |
06:56:55 | FromDiscord | <tfp> those are quads rendered by wgpu-native |
07:07:55 | * | ltriant quit (Ping timeout: 260 seconds) |
07:45:22 | om3ga | tfp: try google sanitizers |
07:45:57 | om3ga | that tools help me a lot almost with any type of program |
07:48:44 | om3ga | use --passC:"-O0 -g3 -fsanitize=address" and --passL:"-O0 -g3 -fsanitize=address" in nim.cfg |
07:49:37 | om3ga | or -fsanitize=leak for memory leaks detection |
08:50:08 | FromDiscord | <Gennadiy> sent a code paste, see https://play.nim-lang.org/#ix=4mpq |
08:51:31 | FromDiscord | <demotomohiro> @Gennadiy https://nim-lang.org/docs/manual.html#statements-and-expressions-case-statement |
08:51:34 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4mpr |
08:51:37 | FromDiscord | <Elegantbeef> Cmon you could've given it a try |
08:52:15 | FromDiscord | <Gennadiy> I particularly need the "Breaking out early statement to print"! |
08:53:01 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#statements-and-expressions-block-statement |
08:54:25 | FromDiscord | <demotomohiro> @Gennadiy https://nim-lang.org/docs/manual.html#statements-and-expressions-block-statement |
08:56:16 | FromDiscord | <Gennadiy> sent a code paste, see https://play.nim-lang.org/#ix=4mps |
08:56:47 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4mpt |
08:56:54 | FromDiscord | <Elegantbeef> Shit |
08:56:56 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4mpu |
08:57:08 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4mpv |
08:57:54 | FromDiscord | <MetuMortis> sent a code paste, see https://play.nim-lang.org/#ix=4mpw |
08:58:00 | FromDiscord | <MetuMortis> (edit) "https://play.nim-lang.org/#ix=4mpw" => "https://play.nim-lang.org/#ix=4mpx" |
08:58:17 | FromDiscord | <Elegantbeef> `str[str..^1]` |
08:58:23 | FromDiscord | <Elegantbeef> whoops `0..^1` |
08:58:37 | FromDiscord | <demotomohiro> !eval echo "Hello"[1..^1] |
08:58:42 | NimBot | ello |
09:00:10 | FromDiscord | <Gennadiy> I guess I will have to resort to the `else` but the problem is the code I am porting (from C++) is full of these at different (Nim) indentation levels so it will be quite messy. Hence, my wanting a means to break out of the whole case statement. |
09:03:31 | FromDiscord | <demotomohiro> @Gennadiy https://nim-lang.org/docs/manual.html#statements-and-expressions-block-statement↵You can break out from nested loop or case statements using block with label and break. |
09:03:45 | FromDiscord | <Elegantbeef> Yea only `for` and `block` are breakable |
09:04:10 | FromDiscord | <Elegantbeef> Nim case statements do not have fall though cause it's generally considered unwanted |
09:06:12 | FromDiscord | <Gennadiy> Ok, thanks both. I will explore the labelled block. |
09:16:11 | * | ltriant joined #nim |
09:27:12 | * | Guest87 joined #nim |
09:27:30 | * | Guest87 quit (Client Quit) |
09:44:23 | * | junaid_ joined #nim |
10:02:10 | * | junaid_ quit (Remote host closed the connection) |
12:36:08 | * | azimut joined #nim |
14:03:24 | * | PMunch joined #nim |
15:01:07 | FromDiscord | <mrgaturus> is there any pragma to avoid dead code elimination on it? |
15:01:29 | FromDiscord | <mrgaturus> sent a code paste, see https://paste.rs/nPy |
15:22:18 | FromDiscord | <Rika> I don’t think constants can be exported in that sense, after all they don’t get put in the c code as a variable |
15:22:40 | FromDiscord | <auxym> `let` should work I think |
15:23:12 | FromDiscord | <rakgew> @mrgaturus does `{.used.}` pragma have an effect? |
15:24:41 | FromDiscord | <Rika> The const will never be in the C code as a variable as I’ve said |
15:24:52 | FromDiscord | <Rika> At least to my understanding |
15:24:54 | FromDiscord | <mrgaturus> In reply to @rakgew "<@320019095426957323> does `{.used.}` pragma": i tried and still discarding |
15:25:33 | FromDiscord | <mrgaturus> sent a code paste, see https://play.nim-lang.org/#ix=4mrn |
15:25:45 | FromDiscord | <Rika> Nim const and C const are completely different concepts |
15:26:17 | FromDiscord | <Rika> Nim const is roughly equivalent to c preprocessor define |
15:26:19 | FromDiscord | <mrgaturus> sent a code paste, see https://play.nim-lang.org/#ix=4mro |
15:26:31 | FromDiscord | <Rika> Because ^ |
15:29:16 | FromDiscord | <Rika> In reply to @auxym "`let` should work I": Use let as said by |
15:29:39 | FromDiscord | <Rika> A related answer, Nim DCE is not optional |
15:30:07 | FromDiscord | <mrgaturus> i see, is a bug that is not fixed yet:↵https://github.com/nim-lang/Nim/issues/17681 |
15:30:35 | FromDiscord | <Rika> Huh, I have never heard of this |
15:45:17 | FromDiscord | <mrgaturus> sent a code paste, see https://play.nim-lang.org/#ix=4mrw |
16:07:13 | * | arkurious joined #nim |
18:09:49 | FromDiscord | <Hel> sent a code paste, see https://play.nim-lang.org/#ix=4ms4 |
18:09:58 | FromDiscord | <Hel> however it works fine if it's not in that function scope |
18:10:25 | FromDiscord | <Hel> (`Error: cannot evaluate at compile time: x`) |
18:10:34 | FromDiscord | <Hel> is it just a proc limitation? |
18:21:04 | FromDiscord | <halc> not sure if I'm missing something, or nico's tilemap loading doesn't work |
18:22:12 | FromDiscord | <halc> isn't this just going to turn all "first tiles" into blanks? https://media.discordapp.net/attachments/371759389889003532/1068959189172498555/image.png |
18:25:20 | FromDiscord | <halc> oh yeah, just confirmed it does |
18:38:22 | FromDiscord | <halc> well I guess it does work, if you leave a blank space at the start of your tilesheet |
18:52:06 | FromDiscord | <Ntsékees> How should one import a file from the parent directory (e.g. `../file.nim`)? |
18:52:57 | PMunch | @Ntsékees, `import ../file` |
18:53:07 | FromDiscord | <Ntsékees> Neato. Thanks. |
18:53:12 | PMunch | Well `import "../file"` I think it is |
18:53:25 | FromDiscord | <Ntsékees> Much better than the Python `sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(file))))` |
18:53:49 | FromDiscord | <Ntsékees> (edit) "`sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(file))))`" => "`sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(file))))↵import file`" |
18:53:56 | PMunch | Is that seriously how you do it in Python? |
18:55:17 | FromDiscord | <Ntsékees> As far as I know |
19:13:25 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4msg |
19:13:56 | FromDiscord | <4zv4l> it executes the callback also↵even if the future isn't completed |
19:14:18 | FromDiscord | <4zv4l> `yes 'Hello' | socat - TCP-LISTEN:8080,fork,reuseaddr`↵this is the command I use for the server |
19:17:13 | FromDiscord | <pyolyokh> what's actually going over the wire is a string like write(6, "llo\nHello\nHello\nHello\nHello\nHello\nHello\nHe↵llo\nHello\nHello\nHello\nHello\nHello\nHello\nHello\nHello\nHello\n"..., 8192) |
19:18:40 | FromDiscord | <4zv4l> I was expecting each of the socket to read one line from it |
19:19:22 | FromDiscord | <pyolyokh> but, asyncnet.recvLine says it reads as long as the socket's open and discards partial strings, so it should always be a complete line yeah |
19:19:58 | FromDiscord | <4zv4l> > Returned future will complete once a full line is read or an error occurs. |
19:20:11 | FromDiscord | <4zv4l> the full line is finished after a `\n` right ? |
19:20:23 | FromDiscord | <4zv4l> so yeah I don't understand what is wrong |
19:20:43 | FromDiscord | <pyolyokh> docs say it's waiting for `\r\n` |
19:21:14 | FromDiscord | <4zv4l> can I change the `newLine` terminator ? |
19:21:48 | FromDiscord | <4zv4l> because `\r\n` is for Windows iirc |
19:21:59 | FromDiscord | <pyolyokh> no, that's for networking protocols in general |
19:22:16 | FromDiscord | <pyolyokh> but, <https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/asyncnet.nim#L556> says it should work the same for \n only |
19:23:01 | FromDiscord | <4zv4l> indeed |
19:23:33 | FromDiscord | <4zv4l> so yeah, I don't get it |
19:27:54 | FromDiscord | <4zv4l> In reply to @4zv4l "`yes 'Hello' | socat": this send all to the first one↵and no remains to the ones after it seems |
19:29:11 | FromDiscord | <pyolyokh> run `ncat localhost 8083|head -2` a few times |
19:29:38 | FromDiscord | <pyolyokh> the worst you get is a partial first line |
19:31:29 | FromDiscord | <4zv4l> `socat TCP-LISTEN:8080,fork,reuseaddr EXEC:"echo 'hello'"` |
19:31:32 | FromDiscord | <4zv4l> this works great |
19:34:39 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4mso |
19:35:14 | * | koltrast quit (Ping timeout: 268 seconds) |
19:35:27 | FromDiscord | <@thatrandomperson5-6310e3b26da03> sent a code paste, see https://play.nim-lang.org/#ix=4msp |
19:36:31 | FromDiscord | <pyolyokh> In reply to @4zv4l "`socat TCP-LISTEN:8080,fork,reuseaddr EXEC:"echo 'h": oh, yeah. so the 'partial first line' was the actual problem all along. add a `discard await recvLine(socket)` to drop it |
19:39:33 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4msq |
19:40:01 | FromDiscord | <4zv4l> In reply to @pyolyokh "oh, yeah. so the": well the command with socat (the new one is much better) the previous one was sending at once a long string↵and because each socket was reading only one line, it was breaking the pipe |
19:41:39 | * | xaltsc quit (Quit: WeeChat 3.7.1) |
19:46:38 | * | koltrast joined #nim |
19:50:00 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4mss |
20:01:51 | FromDiscord | <Arathanis> Anyone understand this warning? It seems to be erroneous as it does in fact match as false. https://media.discordapp.net/attachments/371759389889003532/1068984270586134598/image.png |
20:02:00 | FromDiscord | <Arathanis> (edit) "false." => "false depending on the input." |
20:03:39 | FromDiscord | <Arathanis> Perhaps I am just missing something obvious. |
20:05:33 | * | xet7 quit (Ping timeout: 256 seconds) |
20:18:03 | * | xet7 joined #nim |
20:24:55 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4msD |
20:54:20 | FromDiscord | <MetuMortis> I have a set with one element only, how can I get that element? |
20:56:20 | FromDiscord | <Elegantbeef> `var val: MyType; (for x in mySet: val = x)` |
20:57:11 | FromDiscord | <Arathanis> is there a reason you need to use the set data type if you also need to be able to pop values from it? |
20:57:45 | FromDiscord | <Arathanis> im guessing you are using set arithmetic to trim the set down? |
20:58:10 | FromDiscord | <Arathanis> (edit) "arithmetic" => "~~arithmetic~~ operations" |
20:58:42 | FromDiscord | <MetuMortis> sent a code paste, see https://play.nim-lang.org/#ix=4msQ |
20:59:28 | FromDiscord | <Elegantbeef> There is no need to use a hashset for characters |
20:59:34 | FromDiscord | <Elegantbeef> builtin set works with characters |
21:00:01 | FromDiscord | <Arathanis> hashset does support `pop` though, right? |
21:00:13 | FromDiscord | <MetuMortis> In reply to @Arathanis "hashset does support `pop`": yes but it is immutable |
21:01:06 | FromDiscord | <MetuMortis> oh wait I can assing it to an mutable variable |
21:01:12 | FromDiscord | <MetuMortis> (edit) "assing" => "assign" |
21:01:24 | FromDiscord | <MetuMortis> sent a code paste, see https://play.nim-lang.org/#ix=4msT |
21:02:13 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4msU |
21:02:36 | FromDiscord | <MetuMortis> (edit) |
21:02:50 | FromDiscord | <Elegantbeef> That only works for ascii, for utf8 you need to use strings and `x[0].runes.toHashSet` |
21:06:07 | FromDiscord | <MetuMortis> thanks |
21:06:51 | FromDiscord | <Elegantbeef> Nim has a builtin set type which is preferable to hashsets in many cases |
21:07:01 | FromDiscord | <Elegantbeef> It's a bitset though so if you have a large range a hashset might be better |
21:07:20 | FromDiscord | <MetuMortis> I'm doing advent-of-code, it doesn't really matter I think :d |
21:07:36 | FromDiscord | <Elegantbeef> 2022s? |
21:07:59 | FromDiscord | <MetuMortis> the last one yes |
21:08:05 | FromDiscord | <@thatrandomperson5-6310e3b26da03> sent a code paste, see https://play.nim-lang.org/#ix=4msV |
21:09:35 | FromDiscord | <Elegantbeef> if you're returning a future across the thread barrier that'll do it |
21:22:19 | * | dv^_^ quit (Quit: dv^_^) |
21:22:45 | * | dv^_^ joined #nim |
21:31:57 | FromDiscord | <Ntsékees> What is the correct Nim type for a modifiable C buffer of type `char `? |
21:32:09 | * | azimut quit (Quit: ZNC - https://znc.in) |
21:32:30 | FromDiscord | <Ntsékees> Apparently cstring cannot be modified |
21:34:25 | FromDiscord | <@thatrandomperson5-6310e3b26da03> > if you're returning a future across the thread barrier that'll do it↵How would i do this then? |
21:34:26 | * | azimut joined #nim |
21:41:39 | FromDiscord | <Ntsékees> I guess I should use `ptr UncheckedArray[char]`? |
21:45:04 | FromDiscord | <Elegantbeef> `cstring` |
21:45:26 | FromDiscord | <auxym> var cstring |
21:45:30 | FromDiscord | <Elegantbeef> You wouldnt return a future you'd use a channel or similar from the thread to send the data back |
21:45:56 | FromDiscord | <Elegantbeef> Unless you need to change where the cstring points you do not need `var` |
21:46:31 | FromDiscord | <Ntsékees> without `var` I got error when trying to edit the buffer, but with `var` it does compile. |
21:46:38 | FromDiscord | <Ntsékees> Thanks. |
21:46:51 | FromDiscord | <auxym> nim might treat cstring as a value type like string? not sure tbh |
21:50:39 | FromDiscord | <Elegantbeef> Odd it does seem that way |
21:50:40 | FromDiscord | <Elegantbeef> I guess you can have static cstrings |
21:50:40 | FromDiscord | <Elegantbeef> So it makes sense |
21:50:40 | FromDiscord | <Elegantbeef> like `proc doThing("Hello")` |
21:50:41 | FromDiscord | <Elegantbeef> I'm smart |
21:50:42 | FromDiscord | <Elegantbeef> `doThing("hello")` |
21:50:42 | FromDiscord | <Elegantbeef> Where do thing takes a `cstring` |
22:42:48 | FromDiscord | <voidwalker> Beed wanna do my homework ? : D |
22:45:21 | FromDiscord | <voidwalker> Same problem I been spamming for 2 days now. Need to parse an .ini-like file (works well with parseini lib) |
22:45:43 | PMunch | So why don't you just use parseini? |
22:45:58 | FromDiscord | <voidwalker> yeah, that's the easy part, parsing works nice |
22:46:39 | FromDiscord | <voidwalker> So my questions are.. how do I associate a bunch of strings with another bunch of string (keys in ini settings with [sections] of ini file) ? |
22:46:50 | PMunch | A table? |
22:47:14 | PMunch | `Table[string, seq[tuple[key, value: string]]` |
22:47:28 | PMunch | Or you could do it prettier by having a node hierarchy |
22:47:40 | FromDiscord | <voidwalker> yeah but I need to get from key to string |
22:47:47 | FromDiscord | <voidwalker> (edit) "yeah but I need to get from key to ... string" added "section" |
22:47:59 | FromDiscord | <voidwalker> there's only a few sections, and for each section maybe 10-20 possible keys |
22:48:05 | PMunch | Yeah, that table holds the name of the section and the data of the section |
22:48:43 | FromDiscord | <voidwalker> I don't want to hold the data. My idea is to store all the config structure in an sql database, so it takes up much less space, and is generated on demand |
22:48:56 | FromDiscord | <Elegantbeef> I cannot even work on my own projects but people want me to work on theirs |
22:49:18 | PMunch | @voidwalker, that makes no sense |
22:49:21 | FromDiscord | <voidwalker> so that instead of strings i'd have integers, NULL, etc. Much more compact |
22:49:38 | PMunch | A small ini file would probably be way smaller than an SQL database |
22:49:47 | FromDiscord | <voidwalker> not for 10.000 entries |
22:49:53 | FromDiscord | <Elegantbeef> Faster too |
22:50:00 | PMunch | Depends on what your entries are tbh |
22:50:14 | FromDiscord | <voidwalker> well there's ~10.000 instances of those configs |
22:50:35 | FromDiscord | <voidwalker> with various settings entered, for each entry. a lot of them duplicate as well |
22:51:08 | FromDiscord | <voidwalker> there's also ~150MB worth of XML I want to put in the db as well |
22:51:21 | FromDiscord | <voidwalker> I believe I can cut size 20x |
22:51:30 | FromDiscord | <voidwalker> and sql is faster than xml parsing, or ini parsing 🙂 |
22:51:53 | FromDiscord | <voidwalker> (edit) "or ini parsing 🙂" => "and I would get rid of 10.000 useless files, only generate them on demand" |
22:52:32 | FromDiscord | <voidwalker> step 1 is to convert .ini to sql. then from the sql I need to be able to reconstruct the .ini file |
22:53:51 | FromDiscord | <voidwalker> NULL values in sqlite seem to only take 1 bit, as they use a bitmask for them |
22:54:20 | FromDiscord | <voidwalker> so I can afford to make a column for each key/setting, even if most are unused most of the time |
22:54:38 | FromDiscord | <voidwalker> Makes sense now ? |
22:55:56 | FromDiscord | <voidwalker> So I have two design problems: |
22:56:37 | FromDiscord | <voidwalker> 1. How to associate each setting (key in .ini) with its section. Nothing better than a table with key: section ? It will duplicate `section` a lot of times |
22:57:46 | FromDiscord | <voidwalker> and 2. How to design the association of the key (string) to its respective encode/decode proc |
22:58:15 | PMunch | Yeah that makes more sense :P |
22:58:49 | PMunch | I really depends on the sections |
22:59:30 | FromDiscord | <voidwalker> for example |
22:59:51 | PMunch | You can have a table of sections, each with an id, then have you table of section names and the id in the sections table. This way each unique section only occurs once in the section table |
22:59:58 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4mti |
23:00:14 | FromDiscord | <voidwalker> This will be 1 byte in the database, 0 for default, 1 for surface etc |
23:02:40 | FromDiscord | <voidwalker> so I need a `proc encodeEnum(key, value: string): uint8 =` |
23:03:34 | FromDiscord | <voidwalker> so if I call `encodeEnum("output", "surface")` I'll get 1 |
23:04:18 | FromDiscord | <voidwalker> I remember you can assign strings to enum values hmm |
23:04:39 | FromDiscord | <voidwalker> does this break getting their ordinal value ? |
23:05:03 | FromDiscord | <Elegantbeef> Nope |
23:05:49 | FromDiscord | <voidwalker> I'd still need a way to associate the key string with the corresponding enum type though |
23:11:45 | FromDiscord | <voidwalker> why you can't work on your projects @ElegantBeef ? |
23:11:58 | FromDiscord | <Elegantbeef> -10 motivation |
23:12:10 | FromDiscord | <voidwalker> Oh I thought we were asking too many questions here |
23:12:23 | FromDiscord | <voidwalker> What does usually motivate you to write code ? |
23:14:01 | FromDiscord | <Elegantbeef> If i find out i'll tell you |
23:14:50 | FromDiscord | <voidwalker> I am demotivated cause I have lots of ideas, but it's hard to figure even the most "simple" things like the problem above |
23:17:05 | FromDiscord | <voidwalker> I need someone motived but without ideas : P |
23:21:48 | FromDiscord | <voidwalker> In reply to @PMunch "You can have a": So basically like an index table to not store the whole strings but just a byte ? |
23:28:07 | PMunch | What? |
23:28:36 | PMunch | Either you've done a very poor job of explaining, I've completely misunderstood what you're trying to do, or you have no idea what you're doing yourself :P |
23:34:54 | FromDiscord | <voidwalker> So you mean I should make two tables, one with `const secNames: Table[sectionName: string, id: uint8]` and another with `const key2Sections: Table[key: string, id: uint8]` ? |
23:35:15 | PMunch | No? |
23:35:23 | PMunch | I was talking SQL tables |
23:35:28 | FromDiscord | <voidwalker> Oh lol |
23:36:12 | FromDiscord | <voidwalker> I did not even consider storing the "section" separator part of the columns in sqlite |
23:37:17 | FromDiscord | <voidwalker> I believe it's best to have it in nim code |
23:37:30 | FromDiscord | <voidwalker> as it is structural data |
23:37:40 | PMunch | Didn't you just say that you wanted it in SQL? |
23:37:46 | PMunch | I mean the S in SQL is for structure |
23:38:49 | FromDiscord | <voidwalker> Yeah, I want the data packed in an efficient and flexible sqlite format.. As I imagined it, I would have a column for each possible setting (key) entry. All in one table |
23:39:31 | FromDiscord | <voidwalker> And to define in code what section each key belongs to |
23:39:41 | FromDiscord | <voidwalker> But now that I think of it, I guess this could work nicely |
23:39:53 | FromDiscord | <voidwalker> (edit) "But now that I think of it, I guess this could work nicely ... " added "in SQL as well" |
23:51:05 | * | PMunch quit (Quit: leaving) |
23:52:54 | FromDiscord | <@thatrandomperson5-6310e3b26da03> I have an httpclient going through a proxy and i would like to know if an error code is caused by the (untested) proxy or the actual website. Any help appricated |