00:01:13 | * | oldpcuser_ quit (Ping timeout: 255 seconds) |
00:45:08 | * | oldpcuser_ joined #nim |
00:45:42 | * | oldpcuser_ quit (Remote host closed the connection) |
00:48:30 | * | oldpcuser quit (Ping timeout: 260 seconds) |
00:52:27 | * | oldpcuser joined #nim |
00:53:27 | * | oldpcuser quit (Max SendQ exceeded) |
00:54:07 | * | oldpcuser joined #nim |
00:55:44 | * | azimut quit (Ping timeout: 240 seconds) |
01:07:58 | * | krux02 quit (Remote host closed the connection) |
02:07:03 | * | oldpcuser_ joined #nim |
02:09:37 | * | oldpcuser quit (Ping timeout: 240 seconds) |
02:13:34 | * | oldpcuser_ is now known as oldpcuser |
02:35:44 | * | fallback quit (Ping timeout: 248 seconds) |
02:43:29 | * | fallback joined #nim |
03:09:25 | * | def- quit (Quit: -) |
03:09:37 | * | def- joined #nim |
03:20:44 | FromDiscord | <heysokam> Is there a way to pass `--noMain` to nimc from inside the file that is being compiled, like with `--passL:...` that can also be `{.passL: "...".}` |
03:41:54 | * | oldpcuser_ joined #nim |
03:45:15 | * | oldpcuser quit (Ping timeout: 260 seconds) |
03:51:04 | * | oldpcuser joined #nim |
03:51:52 | * | oldpcuser quit (Remote host closed the connection) |
03:52:02 | * | oldpcuser_ is now known as oldpcuser |
04:23:36 | * | mahlon quit (Server closed connection) |
04:23:39 | FromDiscord | <arathanis> In reply to @heysokam "Is there a way": config.nims? |
04:24:14 | * | mahlon joined #nim |
04:48:21 | FromDiscord | <kcvinker> Hi all, where I can find some nice examples for declaring an `UncheckedArray` and initializing it, iterating through it, etc. |
04:52:32 | FromDiscord | <arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4y25 |
04:52:37 | FromDiscord | <arathanis> its basically away to use array pointers |
04:52:47 | FromDiscord | <kcvinker> a way |
04:53:32 | FromDiscord | <arathanis> yeay |
04:53:45 | FromDiscord | <arathanis> like if a C lib you are using returns an array of ints as a pointer to an int |
04:53:53 | FromDiscord | <arathanis> you would cast it to unchecked array |
04:54:08 | FromDiscord | <arathanis> In reply to @kcvinker "a way": missed the space bar, new keyboard :] |
04:54:11 | FromDiscord | <arathanis> (edit) "away" => "a way" |
04:55:34 | FromDiscord | <arathanis> not a layout im used to haha |
04:55:50 | FromDiscord | <kcvinker> @arathanis So alloc0 is the way to create it, right ? |
04:56:00 | FromDiscord | <arathanis> or just alloc |
04:56:03 | FromDiscord | <arathanis> anything that creates a pointer |
04:56:24 | FromDiscord | <kcvinker> IS that garbage collected ? |
04:56:26 | FromDiscord | <arathanis> no |
04:56:34 | FromDiscord | <arathanis> unchecked arrays are explicitly not for GC memory |
04:56:41 | FromDiscord | <graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4y27 |
04:56:50 | FromDiscord | <arathanis> it says in the manual not to put GC memory in it |
04:57:01 | FromDiscord | <arathanis> it wont check this for you |
04:57:03 | FromDiscord | <arathanis> you have to just not do it |
04:57:45 | FromDiscord | <arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4y28 |
04:57:46 | FromDiscord | <graveflo> it doesn't check anything anyway. All you lose is explicit control over the time of destruction |
04:58:03 | FromDiscord | <kcvinker> I see |
04:58:15 | FromDiscord | <arathanis> In reply to @graveflo "it doesn't check anything": and because of this the GC might rugpull the memory while you still have a reference in your unchecked array |
04:58:17 | FromDiscord | <kcvinker> In reply to @arathanis "here is a better": This looks nice |
04:58:18 | FromDiscord | <arathanis> causing a segfault |
04:58:31 | FromDiscord | <arathanis> this is why it says not to use GC memory |
04:58:52 | FromDiscord | <kcvinker> In reply to @arathanis "and because of this": In that case I think I should use a seq |
04:58:54 | FromDiscord | <graveflo> In reply to @arathanis "and because of this": yea that's what I'm saying. You can manually dealloc or make sure that your ref is alive for the duration of the pointer. Both are the same |
04:59:02 | FromDiscord | <arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4y29 |
04:59:27 | FromDiscord | <arathanis> (edit) "https://play.nim-lang.org/#ix=4y29" => "https://play.nim-lang.org/#ix=4y2a" |
04:59:41 | FromDiscord | <arathanis> In reply to @kcvinker "In that case I": exactly |
04:59:51 | FromDiscord | <arathanis> if you have GCed memory then you already have container types |
05:00:05 | FromDiscord | <arathanis> and should use those |
05:01:53 | FromDiscord | <kcvinker> I want use the address of contain types like seq |
05:02:01 | FromDiscord | <kcvinker> (edit) "contain" => "container" |
05:02:19 | FromDiscord | <graveflo> Yea if you are creating the memory yourself you might want to be careful. For low level introspection it's still a pretty good choice regardless of what you are analyzing. Just have to be aware of gc |
05:02:26 | FromDiscord | <arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4y2d |
05:02:33 | * | ntat joined #nim |
05:02:42 | FromDiscord | <arathanis> (edit) "https://play.nim-lang.org/#ix=4y2d" => "https://play.nim-lang.org/#ix=4y2e" |
05:03:40 | FromDiscord | <graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4y2g |
05:04:22 | FromDiscord | <arathanis> why would you want to look at the raw memory? |
05:04:43 | FromDiscord | <kcvinker> To deal with some win api functions |
05:05:24 | FromDiscord | <graveflo> I use it for debugging and although I wouldn't use it on a seq very often it is a convenient way to cast a bin blob |
05:05:35 | FromDiscord | <kcvinker> @graveflo Does `NimDeqV2` an official nim data type ? |
05:06:13 | FromDiscord | <graveflo> yea but you have to be using arc/orc maybe |
05:06:28 | FromDiscord | <kcvinker> I am using default gc |
05:06:28 | FromDiscord | <graveflo> and you might have to be on #version-2-0 or #devel |
05:06:41 | FromDiscord | <kcvinker> I am on 1,6 |
05:07:10 | FromDiscord | <kcvinker> (edit) "`NimDeqV2`" => "`NimSeqV2`" |
05:07:58 | FromDiscord | <arathanis> those functions seem like massive overkill for just getting the heap pointer |
05:08:11 | FromDiscord | <graveflo> you would think but nim hides them |
05:08:41 | FromDiscord | <arathanis> https://media.discordapp.net/attachments/371759389889003532/1117681857748803654/image.png |
05:11:27 | FromDiscord | <graveflo> that's only possible when len > 0 |
05:12:23 | FromDiscord | <arathanis> if its empty won't it be nil or unallocated? |
05:12:39 | FromDiscord | <graveflo> no `newSeqOfCap` |
05:14:48 | FromDiscord | <odexine> In reply to @graveflo "that's only possible when": No lol |
05:14:49 | FromDiscord | <demotomohiro> when len == 0, `s[0]` throw exception. |
05:14:58 | FromDiscord | <odexine> Well IIRC it should work |
05:15:05 | FromDiscord | <graveflo> why would that work? |
05:15:06 | FromDiscord | <odexine> Or was that for type of I don’t remember anymore |
05:15:07 | FromDiscord | <arathanis> what do you do with the heap pointer of to a len 0 seq??? |
05:15:11 | FromDiscord | <odexine> In reply to @graveflo "why would that work?": Magic |
05:15:14 | FromDiscord | <arathanis> (edit) "do" => "would" |
05:15:15 | FromDiscord | <odexine> It does happen sometimes |
05:15:26 | FromDiscord | <odexine> But yeah I think it only works for type of |
05:16:03 | FromDiscord | <demotomohiro> When seq is empty and capacity is also empty, seq doesnt have heap. |
05:16:22 | FromDiscord | <odexine> !eval var a: seq[int]; echo typeof a[0]; |
05:16:28 | NimBot | int |
05:16:39 | FromDiscord | <odexine> !eval var a: seq[int]; echo addr a[0]; |
05:16:41 | FromDiscord | <graveflo> In reply to @arathanis "what would you do": Hey we are talking about analyzing memory of safe objects in an unsafe way. This is code for shenanigans and shenanigans only |
05:16:41 | FromDiscord | <arathanis> (edit) removed "of" |
05:16:42 | NimBot | Compile failed: /usercode/in.nim(1, 18) Error: type mismatch: got <ptr int> |
05:16:49 | FromDiscord | <odexine> Hey |
05:16:52 | FromDiscord | <odexine> Look at that 🙂 |
05:16:53 | FromDiscord | <arathanis> In reply to @graveflo "Hey we are talking": ok that is what i thought |
05:17:00 | FromDiscord | <arathanis> the answer being "nothing useful" 😂 |
05:17:11 | FromDiscord | <arathanis> just railing against the language for the fun of it |
05:17:14 | FromDiscord | <demotomohiro> `typeof` or `sizeof` evaluate expression only at compile time not runtime. |
05:17:26 | FromDiscord | <odexine> a[0] failing on length 0 only holds for non magic procedures |
05:17:37 | FromDiscord | <odexine> Otherwise it can be either it seems |
05:17:41 | FromDiscord | <graveflo> In reply to @arathanis "just railing against the": not necessarily. You can learn a lot of grabbing bits of memory sometimes |
05:17:47 | FromDiscord | <odexine> In which case it works for addr |
05:18:01 | FromDiscord | <odexine> !eval var a: seq[int]; echo repr addr a[0]; |
05:18:04 | NimBot | Compile failed: /usercode/in.nim(1, 23) Error: type mismatch: got <proc (x: T): string{.noSideEffect.}> |
05:18:18 | FromDiscord | <graveflo> In reply to @odexine "In which case it": oh I must have been using `unsafeAddr` but good to know anyway |
05:18:27 | FromDiscord | <odexine> Not sure what im doing wrong but it seems like there is a value? |
05:18:40 | FromDiscord | <demotomohiro> how about to use `if myseq.len == 0: nil else: myseq[0].addr`? |
05:18:46 | FromDiscord | <odexine> !eval var a: seq[int]; echo repr(addr(a[0])) |
05:18:52 | NimBot | /usercode/in.nim(1) in↵/playground/nim/lib/system/fatal.nim(54) sysFatal↵Error: unhandled exception: index out of bounds, the container is empty [IndexDefect] |
05:19:02 | FromDiscord | <odexine> Huh so it does raise a defecr |
05:19:10 | FromDiscord | <graveflo> In reply to @demotomohiro "how about to use": that would be fine unless you want the address of the allocated seq of len 0 |
05:19:18 | FromDiscord | <arathanis> when i already finished my beer https://media.discordapp.net/attachments/371759389889003532/1117684528903897158/image.png |
05:19:18 | FromDiscord | <odexine> So it is only typeof that works with [0] with length 0 |
05:19:36 | FromDiscord | <arathanis> it was an IndexDefect this whole time |
05:19:48 | FromDiscord | <graveflo> I dont even know whats going on anymore |
05:20:22 | FromDiscord | <odexine> addr doesnt work typeof/sizeof does work |
05:20:25 | FromDiscord | <odexine> Thats the gisf |
05:20:44 | FromDiscord | <demotomohiro> In reply to @graveflo "that would be fine": If you always want a pointer to heap, you need to preallocate heap and you need to care about reallocating heap if you keep holding that pointer. |
05:21:04 | FromDiscord | <odexine> Do default sequences start with an empty capacity or do they preallocate |
05:21:11 | FromDiscord | <odexine> 🤔 |
05:21:51 | FromDiscord | <graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4y2k |
05:21:55 | FromDiscord | <graveflo> bc the `capacity` proc is busted for me |
05:22:06 | FromDiscord | <odexine> The which procedure? |
05:22:14 | FromDiscord | <graveflo> `capacity` |
05:22:26 | FromDiscord | <odexine> Yes where is that found |
05:22:33 | FromDiscord | <graveflo> good question |
05:22:43 | FromDiscord | <odexine> I don’t remember any procedure like that |
05:22:44 | FromDiscord | <graveflo> same place as `NimSeqV2` |
05:22:51 | FromDiscord | <odexine> Oh private? |
05:22:58 | FromDiscord | <graveflo> I dont think so |
05:23:01 | FromDiscord | <graveflo> its new |
05:23:07 | FromDiscord | <graveflo> but it also doesn't work |
05:24:06 | FromDiscord | <odexine> Seems devel onlt |
05:24:18 | FromDiscord | <odexine> What’s broken |
05:24:21 | FromDiscord | <graveflo> yea that checks out. I think its on #version-2-0 too |
05:24:23 | FromDiscord | <demotomohiro> If you still want a pointer to seq's heap even if len == 0 as long as cap > 0, that looks like you are doing wrong thing. |
05:24:36 | * | hexeme quit (Server closed connection) |
05:24:45 | FromDiscord | <graveflo> In reply to @demotomohiro "If you still want": really why? it seems to work for me |
05:24:51 | FromDiscord | <odexine> In reply to @demotomohiro "If you still want": I don’t think so? |
05:25:03 | FromDiscord | <odexine> Why should it be invalid to do so |
05:25:29 | * | hexeme joined #nim |
05:25:47 | FromDiscord | <demotomohiro> In reply to @graveflo "really why? it seems": if len == 0, myseq[0] throw defect even if cap > 0. |
05:26:04 | FromDiscord | <odexine> Yes but why should the capacity procedure fail in that case |
05:26:14 | FromDiscord | <odexine> In reply to @demotomohiro "if len == 0,": This is completely sensible |
05:26:18 | FromDiscord | <graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4y2m |
05:26:33 | FromDiscord | <odexine> Capacity found here https://github.com/nim-lang/Nim/blob/71801c2b8f7eb080421aae9140cd15c5fcc34efd/lib/system/seqs_v2.nim#L141 |
05:28:55 | FromDiscord | <demotomohiro> If you want a C function to write something to seq's heap, why don't you call `setLen` or `newSeq` with proper size? |
05:29:32 | FromDiscord | <odexine> Proper size may not be known until after the function is run (and you can argue it is bad design sure) |
05:29:41 | FromDiscord | <graveflo> that would be the smart thing to do.. or perhaps just use the functions that @arathanis suggested. This was in response to seqs in question specifically |
05:29:45 | FromDiscord | <graveflo> and off the rails a bit |
05:29:54 | FromDiscord | <odexine> I just don’t think it is sensible to say this behaviour shouldn’t be allowed |
05:30:15 | FromDiscord | <graveflo> Yes this is why I have this laying around. New to the lang. Testing stuff |
05:30:46 | FromDiscord | <odexine> Maybe it would be nice to be able to set length without zeroing (ex. Maybe it is already zeroed by the foreign function) |
05:32:47 | FromDiscord | <graveflo> usually there is some sort of way to do that. Even if its just for the fact that you are going to fill the while thing shortly anyway |
05:33:09 | FromDiscord | <graveflo> (edit) "while" => "whole" |
05:33:34 | FromDiscord | <mratsim> In reply to @odexine "Maybe it would be": it doesn't zero if no realloc was needed and the type T ``supportsCopyMem`` though I know that was the case for seqsV1 can't say for seqsV2 |
05:35:26 | FromDiscord | <demotomohiro> In reply to @odexine "Maybe it would be": Doesn't `newSeqUninitialized` do so? https://nim-lang.org/docs/system.html#newSeqUninitialized%2CNatural |
05:49:56 | FromDiscord | <odexine> In reply to @demotomohiro "Doesn't `newSeqUninitialized` do so?": I knew about that but I was thinking more of after the sequence was made |
05:52:13 | FromDiscord | <odexine> Then again it prolly makes no sense |
05:52:44 | FromDiscord | <arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4y2p |
05:53:19 | FromDiscord | <arathanis> work in progress |
05:53:40 | FromDiscord | <graveflo> yep that looks good so far |
05:55:07 | FromDiscord | <arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4y2q |
05:57:04 | FromDiscord | <graveflo> that's pretty neat I like it. Its a state snapshot. Only issue us that re-alloc can break the pointers which some people might not anticipate |
05:57:18 | FromDiscord | <graveflo> thats the only advantage working directly on the `seq` has ig. but its organized so I like it |
05:57:33 | FromDiscord | <arathanis> and you dont have to use private access stuff :P |
05:57:43 | FromDiscord | <arathanis> if we are gonna be unsafe |
05:57:46 | FromDiscord | <arathanis> lets go all the way |
05:57:57 | FromDiscord | <graveflo> well I never needed that. I'm aware of using the offsets its in one of the functions |
05:58:02 | FromDiscord | <arathanis> if you are gonna cross the line, you might as well go so far passed it you can't even see it anymore 😎 |
05:58:24 | FromDiscord | <graveflo> I didn't know you were a mad lad |
05:58:38 | FromDiscord | <arathanis> lol |
05:59:57 | FromDiscord | <graveflo> does anyone know if there is a hack that will allow me to install a global `proc` hook? |
06:02:14 | FromDiscord | <demotomohiro> You might already know, data structure of seq is defined here: https://github.com/nim-lang/Nim/blob/devel/lib/system/seqs_v2.nim |
06:02:31 | FromDiscord | <windowsboy111> I am not so sure how I can run an executable I just installed from nimble https://media.discordapp.net/attachments/371759389889003532/1117695407259127838/RKf0Rg0.png |
06:03:18 | FromDiscord | <arathanis> In reply to @demotomohiro "You might already know,": this was my reference for pointer arithmetic shenanigans |
06:03:26 | FromDiscord | <graveflo> `nimble path niminst` go to source and compile it? |
06:03:32 | FromDiscord | <windowsboy111> ok |
06:04:01 | FromDiscord | <graveflo> at source route it should be `nim c src/niminst` |
06:05:08 | FromDiscord | <windowsboy111> this is confusing…? https://media.discordapp.net/attachments/371759389889003532/1117696064921813022/oshcSE1.png |
06:05:13 | FromDiscord | <graveflo> In reply to @demotomohiro "You might already know,": yea I was looking for this earlier thx. Hard to find the mods tucked away sometimes |
06:05:45 | FromDiscord | <graveflo> did you try just `niminst` |
06:05:51 | FromDiscord | <graveflo> see if its in path? |
06:05:56 | FromDiscord | <windowsboy111> nope |
06:05:57 | FromDiscord | <windowsboy111> not in path |
06:06:00 | FromDiscord | <windowsboy111> not in nimble bin dir either |
06:06:15 | FromDiscord | <graveflo> and you used `nimble install niminst` ? |
06:06:18 | FromDiscord | <windowsboy111> yeah |
06:06:32 | FromDiscord | <graveflo> might be broken pkg then. Idk what dep its missing there |
06:06:50 | FromDiscord | <windowsboy111> from what I see it doesn't have deps…? https://media.discordapp.net/attachments/371759389889003532/1117696493609033849/sQFz9aq.png |
06:07:06 | FromDiscord | <arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4y2v |
06:07:09 | FromDiscord | <arathanis> we have only just begun to madlad |
06:07:49 | FromDiscord | <graveflo> In reply to @windowsboy111 "from what I see": its from 2019.. I think this might be broken or downgrade nim |
06:08:07 | FromDiscord | <windowsboy111> damn |
06:08:17 | FromDiscord | <graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4y2w |
06:08:23 | FromDiscord | <arathanis> In reply to @graveflo "Ok you've actually lost": doin' a little trollin' |
06:09:23 | FromDiscord | <graveflo> dont forget to inject it into sys.path and shadow common names |
06:10:27 | FromDiscord | <arathanis> for maximum workplace pranking? |
06:10:42 | FromDiscord | <arathanis> im on your computer, changing your bashrc |
06:11:05 | FromDiscord | <graveflo> or maybe automate a script that adds this into dependency files each time it runs to duplicate itself |
06:12:01 | FromDiscord | <arathanis> now we are just making the worlds stupidest virus |
06:12:32 | FromDiscord | <graveflo> truth is stupider ones have done dmg. I guess its not that much of a joke |
06:12:34 | FromDiscord | <arathanis> guido is on his way to smite us as we speak |
06:19:30 | * | advesperacit joined #nim |
06:30:19 | * | PMunch joined #nim |
06:40:15 | FromDiscord | <heysokam> In reply to @arathanis "config.nims?": obviously. but i was meaning without it, if there is a pragma |
06:40:32 | FromDiscord | <heysokam> (edit) "In reply to @arathanis "config.nims?": obviously. but i was meaning without it, if there is a pragma ... " added "that can add switch options" |
06:41:04 | FromDiscord | <odexine> I don’t thinks o |
06:41:08 | FromDiscord | <odexine> (edit) "thinks o" => "think so" |
06:41:21 | FromDiscord | <odexine> If you mean inside the source file |
06:41:34 | FromDiscord | <heysokam> how do you debug nimscript?↵im giga stuck in a "symbol cannot be resolved at compile time" error with nothing more. been stuck all day, cant seem to figure it out 😔 |
06:42:06 | FromDiscord | <heysokam> is there any way to make nimscript become absurdly verbose or something? |
06:42:23 | FromDiscord | <heysokam> i just need to know why its failing to resolve the symbol |
06:46:07 | FromDiscord | <Elegantbeef> You debug nimscript the same way you do Nim, build a debug compiler and walk up the stack |
07:12:25 | FromDiscord | <heysokam> found it, ty beef |
07:12:52 | FromDiscord | <heysokam> i was importing the incorrect module, and it was resolving to another proc that required a non nimscript proc |
07:14:07 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4y2K |
07:15:07 | FromDiscord | <heysokam> oh, might be the command syntax? |
07:15:18 | FromDiscord | <graveflo> yea it thinks its a generic i think |
07:15:33 | FromDiscord | <heysokam> yep, it was getting the proc, not the output |
07:16:24 | FromDiscord | <graveflo> Thats a weird err msg for this problem LOL |
07:23:22 | FromDiscord | <windowsboy111> somehow this happens when building niminst https://media.discordapp.net/attachments/371759389889003532/1117715755887247450/n63m5pD.png |
07:24:14 | FromDiscord | <windowsboy111> (<https://github.com/terrapkg/packages/actions/runs/5240195365/jobs/9460776884#step:4:28206>) |
07:37:35 | FromDiscord | <mratsim> In reply to @odexine "Then again it prolly": It does, it would be a nice to have exactly here:↵- https://github.com/mratsim/constantine/blob/8efbc03/constantine/trusted_setups/gen_eth_kzg_testing_setups.nim#L109↵↵There are production use case with the length being 2^26, so 67M items, each of size 96 bytes so we're looking at 6.4GB being zero-ed by Nim. |
07:43:04 | FromDiscord | <heysokam> how do you recognize that `nimscript` is active, from a module imported from the nims file?↵seems to not be recognizing it with `defined(nimscript)` for some reason 🤔 |
08:15:37 | FromDiscord | <demotomohiro> https://nim-lang.org/docs/manual.html#statements-and-expressions-when-nimvm-statement |
09:13:32 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4y39 |
09:14:08 | FromDiscord | <heysokam> i thought nimvm is only for a binary file being compiled, not for nimscript 🤔 |
09:14:16 | FromDiscord | <heysokam> but nimscript is failing me for whatever reason 🤷♂️ |
10:05:41 | * | oisota quit (Server closed connection) |
10:05:58 | * | oisota joined #nim |
10:25:41 | * | anddam quit (Server closed connection) |
10:26:00 | * | anddam joined #nim |
10:34:59 | * | xet7 quit (Ping timeout: 268 seconds) |
10:40:40 | * | xet7 joined #nim |
11:05:19 | * | derpydoo quit (Quit: derpydoo) |
11:51:43 | NimEventer | New thread by IvanS: DebugEcho to stderr ? osproc.startProcess debugging..., see https://forum.nim-lang.org/t/10266 |
12:07:36 | * | azimut joined #nim |
12:23:53 | * | Guest99 joined #nim |
12:24:12 | * | Guest99 quit (Client Quit) |
12:45:13 | FromDiscord | <demotomohiro> sent a long message, see http://ix.io/4y3I |
14:05:08 | FromDiscord | <voidwalker> blah is there some cheatsheet somehwere with different seq/array bytec char string etc conversions ? |
14:11:06 | * | advesperacit quit () |
14:18:47 | * | cm quit (Ping timeout: 246 seconds) |
14:19:56 | * | cm joined #nim |
14:25:00 | FromDiscord | <odexine> "just do a cast and call it a day" xd |
14:26:02 | FromDiscord | <voidwalker> yeah I did but string to array[byte] is not good it seems |
14:28:50 | FromDiscord | <odexine> `cast[ptr array[xxx, byte]](str[0].addr)` doesnt work? |
14:29:04 | FromDiscord | <odexine> why array though |
14:29:21 | * | PMunch quit (Quit: Leaving) |
14:29:23 | FromDiscord | <odexine> you wont suddenly make the string stack-stored by doing this |
14:30:17 | FromDiscord | <voidwalker> cause it's fixed length values, lots of them |
14:32:11 | FromDiscord | <voidwalker> looking in stew to see if there is something from hex string to array byte |
14:34:53 | FromDiscord | <odexine> In reply to @voidwalker "cause it's fixed length": are they compile-time decidable lengths? |
14:35:04 | FromDiscord | <odexine> why not openarray |
14:35:18 | FromDiscord | <odexine> https://nim-lang.org/docs/system.html#toOpenArray%2Cstring%2Cint%2Cint |
14:37:18 | FromDiscord | <voidwalker> this works, phew |
14:37:21 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4y4b |
14:37:32 | FromDiscord | <voidwalker> playing with the questionable lib for the first time |
14:37:47 | FromDiscord | <odexine> thats some... questionable usage |
14:37:48 | FromDiscord | <odexine> sorry |
14:37:51 | FromDiscord | <voidwalker> : D |
14:38:01 | FromDiscord | <voidwalker> how else would one do it |
14:38:45 | FromDiscord | <odexine> i was making a joke |
14:57:14 | FromDiscord | <voidwalker> so basically option is for when you have value or don't have value. on/off. And result is for when you have value, and an error variable which can hold a certain value of a certain type ? |
14:57:49 | FromDiscord | <voidwalker> So if the error kind is of no interest, you can return just an Option instead of Result. Am I right ? |
15:03:49 | FromDiscord | <odexine> well, it depends; personally if there are any errors i'd prolly never use options for them |
15:04:14 | FromDiscord | <odexine> i personally think options are strictly for when your types need a nullary value |
15:04:29 | FromDiscord | <odexine> and that none types must never indicate errors |
15:10:40 | FromDiscord | <voidwalker> well what if you don't care about the error, like, hex string > 40, or hex string contains non hex chars |
15:13:03 | FromDiscord | <voidwalker> what am I gonna do with endlessly nested try excepts |
15:18:30 | Amun-Ra | hmm, Result? |
15:18:51 | Amun-Ra | ah, I guess it's a thirdparty module |
15:25:58 | FromDiscord | <voidwalker> https://github.com/status-im/questionable |
15:26:42 | FromDiscord | <arnetheduck> In reply to @voidwalker "So if the error": https://github.com/arnetheduck/nim-results/blob/023375923c655aa3252c52c39efc1a091266539f/results.nim#L152 |
15:26:44 | FromDiscord | <voidwalker> this stuff is standard in rust, no need to pick your 3rd party lib.... |
15:30:31 | FromDiscord | <voidwalker> @arnetheduck any words on `questionable` vs your nim-results ? |
15:30:37 | Amun-Ra | I'll write something like this for my viewer |
15:30:56 | FromDiscord | <voidwalker> I wanted to try this option/results thing for a long time, but the issue was I couldn't decide which one to use :\ std, nim-results, questionable |
15:31:25 | Amun-Ra | voidwalker: is there something like this in std? |
15:31:52 | FromDiscord | <voidwalker> just std/options, no results afaik |
15:32:04 | Amun-Ra | mhm |
15:34:02 | FromDiscord | <odexine> In reply to @voidwalker "well what if you": i would still use results even if i do not care about the error |
15:34:29 | Amun-Ra | I like that zig-alike syntax (!) |
15:34:29 | FromDiscord | <arnetheduck> In reply to @voidwalker "<@449019668296892420> any words on": `questionable` only providesa bit of syntactic on top of `std/options` and `nim-results` - ie the `Result` support it has is imported from `nim-results` .. it's a matter of taste, how much magic syntax you're comfortable with (at status, only one of several projects use questionable) |
15:34:44 | FromDiscord | <arnetheduck> (edit) "providesa" => "provides a" | "provides abit of syntactic ... on" added "sugar" |
15:36:25 | FromDiscord | <arnetheduck> (edit) "use" => "uses" |
15:37:26 | FromDiscord | <arnetheduck> ie almost all our projects use `nim-results` - one adds `questionable` on top for the shorthand syntaxes and we've _mostly_ stopped using `std/options` |
15:37:29 | FromDiscord | <voidwalker> well I picked it cause the syntax was reminiscent of the rust one, even though i never used rust, that simplicity clicked with me from the start |
15:37:59 | FromDiscord | <voidwalker> I also liked the zig way of handling exceptions and errors. nim is very bad with its ancient try except |
15:38:12 | arkanoid | I'd like to hear from people who use nim in medium sized team how they managed to keep the project together. Talking about style, conventions, avoiding traps, and so on |
15:38:16 | Amun-Ra | yes, zig is great in that compartment |
15:39:11 | Amun-Ra | arkanoid: well, I recommend starting with {.push raises: [].} at the beginning of every file |
15:39:42 | FromDiscord | <arnetheduck> arkanoid: https://status-im.github.io/nim-style-guide/ |
15:40:02 | arkanoid | Amun-Ra: why that? |
15:40:16 | arkanoid | Amun-Ra: what happens to error handling down the road, doing so? |
15:40:23 | Amun-Ra | arkanoid: to explicit mark every function that raises an exception |
15:40:29 | Amun-Ra | tely* |
15:40:36 | arkanoid | Amun-Ra: java like? |
15:40:48 | Amun-Ra | something like that |
15:41:26 | Amun-Ra | https://status-im.github.io/nim-style-guide/errors.exceptions.html |
15:42:17 | arkanoid | makes sense. What about effects? I like the fun vs proc thing, but the questionable meaning of "pure functions" makes me aware that some of the team would disagree about the purity of anything |
15:43:07 | FromDiscord | <arnetheduck> `func` where you can, `proc` where you must, to adapt an old database normalisation adage |
15:43:10 | Amun-Ra | I start with func whenever I can |
15:43:29 | Amun-Ra | unlike modules in std ;> |
15:44:04 | arkanoid | Yeah in my own project I also stick with func everywhere, I also try to enable al the possible strictness |
15:44:12 | Amun-Ra | same |
15:45:16 | arkanoid | so, long story short, in status you handle defects/panics with explicit raises pragma, and expected errors with Option/Result? |
15:45:47 | FromDiscord | <odexine> raises does not track defects |
15:46:04 | Amun-Ra | I haven't adopted Result yet, I'll roll my own |
15:48:00 | arkanoid | codexine, right, but if I remember correctly where was some bad mix of error/defect before 1.5 or something |
15:51:05 | FromDiscord | <odexine> oh fuck i didnt realise it showed me as odexine now -- i'm rika |
15:51:12 | FromDiscord | <odexine> bot needs update i think |
15:52:42 | FromDiscord | <odexine> In reply to @arkanoid "codexine, right, but if": not sure what you mean by this |
15:55:54 | * | xet7 quit (Quit: Leaving) |
15:57:36 | arkanoid | nevermind, it's just a detail |
16:22:37 | NimEventer | New Nimble package! nimip - Asynchronously lookup IP addresses with this tiny, hybrid Nim application., see https://github.com/hitblast/nimip |
16:22:41 | FromDiscord | <arnetheduck> In reply to @arkanoid "so, long story short,": we use `raises` to avoid ordinary exceptions, specially in code that uses `Result` - `Defect` indeed is not covered by `raises` (for historical context, nim 1.2 _sometimes_ saw `raises` apply to `Defect` but it was pretty broken) |
16:34:19 | FromDiscord | <michaelb.eth> sent a code paste, see https://play.nim-lang.org/#ix=4y4B |
16:34:35 | FromDiscord | <odexine> it kinda doesnt make sense to catch defects either, what are you gonna do about it other than cast the check away? its not like raises is smart enough to know that your if statements make it so that the defects are unreachable |
16:36:05 | FromDiscord | <michaelb.eth> also @voidwalker I didn't see this mentioned above, so not that stew/results provides `Opt` which you can use just like std/options `Option`, i.e. if you have use cases for `Result[T, E]` and `Option[T]` you get support for both with stew/results |
16:36:12 | FromDiscord | <michaelb.eth> (edit) "not" => "note" |
16:36:46 | FromDiscord | <voidwalker> so I can use both stew/results and arnetheduck results with questionable ? |
16:36:56 | FromDiscord | <voidwalker> I'd rather pick one and use it long term, and questionable looks good to me |
16:37:03 | FromDiscord | <michaelb.eth> stew/results is arnetheduck results 😄 |
16:37:11 | FromDiscord | <voidwalker> omfg this is so confusing : D |
16:37:32 | FromDiscord | <michaelb.eth> actually, which one is more up-to-date at this point, checking... |
16:38:44 | FromDiscord | <System64 ~ Flandre Scarlet> Is that normal I have this error while I try to target Emscriptem? https://media.discordapp.net/attachments/371759389889003532/1117855514093682882/message.txt |
16:39:06 | FromDiscord | <michaelb.eth> @arnetheduck at this point is one better of with stew/results or the one in the repo under your account? |
16:39:35 | FromDiscord | <michaelb.eth> (edit) "of" => "off" |
16:40:29 | FromDiscord | <arnetheduck> whichever your transitive dependency tree leads you to 😉 we're looking at ways to unify them, ie stop using the stew one |
16:41:02 | FromDiscord | <odexine> In reply to @System64 "Is that normal I": might be that emscripten doesnt have an equivalent for that file |
16:41:21 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @odexine "might be that emscripten": Well, it is in the emscripten files |
16:41:30 | FromDiscord | <odexine> idk then |
16:41:55 | FromDiscord | <arnetheduck> https://github.com/status-im/nim-stew/pull/185 |
16:42:51 | FromDiscord | <voidwalker> yeah that stew is way too rich |
16:43:15 | FromDiscord | <michaelb.eth> so many lovely treasures in stew |
16:43:43 | FromDiscord | <michaelb.eth> byteutils is a fav of mine |
16:43:53 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @odexine "idk then": Is there something I can to to make the compiler displayiing where it looks for the file? |
16:44:02 | FromDiscord | <odexine> not sure about emcc |
16:44:17 | FromDiscord | <System64 ~ Flandre Scarlet> OOF |
16:44:39 | FromDiscord | <odexine> try -H? |
16:45:28 | FromDiscord | <odexine> not sure really |
16:45:35 | FromDiscord | <odexine> check emcc docs |
16:57:27 | FromDiscord | <voidwalker> how do you report a duplicate pkg in nimble ? you pr to remove one of them ? if so, which one ? |
17:00:48 | FromDiscord | <voidwalker> also lol, this is a nimble package: https://github.com/HazeCS/geolocation/blob/main/geolocation.nim |
17:05:38 | FromDiscord | <System64 ~ Flandre Scarlet> Alright I think I solved this error, but now I have this https://media.discordapp.net/attachments/371759389889003532/1117862284715380766/message.txt |
17:50:02 | FromDiscord | <starkiller1493> I'm passing a table to a function with `pin_cache: var Table[string, seq[string]]` and doing `if id in pin_cache` raises an error `Error: 'pin_cache' is of type <var Table[system.string, seq[string]]> which cannot be captured as it would violate memory safety, using '-d:nimNoLentIterators' helps in some cases` and using `-d:nimNoLentIterators` doesn't help.↵How can pass a table to a function so I can do `in` and also mutate it? |
17:50:17 | FromDiscord | <starkiller1493> (edit) "I'm passing a table to a function with `pin_cache: var Table[string, seq[string]]` and doing `if id in pin_cache` ... raises" added "which" |
17:50:31 | FromDiscord | <starkiller1493> (edit) "`in`" => "`if in`" |
17:53:00 | Amun-Ra | ok, so I wrote my minimalistic result that'll fit my needs https://play.nim-lang.org/#ix=4y4U |
17:55:57 | FromDiscord | <demotomohiro> In reply to @starkiller1493 "I'm passing a table": I think you got that error because you use that paremeter in inner procedure. You shoud be able to use `in` and mutate it if it is not inner procedure. |
17:57:35 | FromDiscord | <demotomohiro> Maybe you are using template or macro that implicity define procedure. |
17:57:37 | FromDiscord | <voidwalker> can anyone figure out how to xor two arrays in functional style, without using extra allocations (except `result`): |
17:57:45 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4y4V |
17:57:46 | FromDiscord | <michaelb.eth> is it possible to specify that a generic parameter must be type `enum` (obviously not specific to a particular enum) |
17:57:48 | FromDiscord | <starkiller1493> In reply to @demotomohiro "I think you got": It's an async procedure |
17:59:10 | FromDiscord | <michaelb.eth> can you make it a ref Table? |
18:01:30 | FromDiscord | <starkiller1493> yes, but it yields the same error |
18:03:01 | FromDiscord | <michaelb.eth> async procs can't have var params, but if it's a ref you should be able to mutate even if it's not a var param |
18:03:07 | FromDiscord | <michaelb.eth> I think, haven't tried in awhile |
18:04:44 | FromDiscord | <starkiller1493> without var it compiles |
18:04:57 | FromDiscord | <demotomohiro> In reply to @michaelb.eth "is it possible to": Using enum type class like `foo[E: enum]` doesnt work? |
18:05:13 | FromDiscord | <michaelb.eth> doing some experiments, maybe it's that simple |
18:05:13 | FromDiscord | <starkiller1493> (edit) "compiles" => "compiles↵gonna test it with Ref" |
18:05:56 | FromDiscord | <starkiller1493> (edit) "without var ... it" added "and with Ref" | removed "with Ref" |
18:07:27 | FromDiscord | <starkiller1493> In reply to @michaelb.eth "async procs can't have": nice, it works |
18:10:30 | FromDiscord | <michaelb.eth> nice |
18:10:50 | * | xet7 joined #nim |
18:11:47 | FromDiscord | <michaelb.eth> In reply to @demotomohiro "Using enum type class": works great! |
18:11:53 | FromDiscord | <michaelb.eth> (edit) "great!" => "great, thanks!" |
18:36:27 | NimEventer | New thread by mantielero: FMU library - fmi2FreeInstance, see https://forum.nim-lang.org/t/10267 |
18:52:53 | * | krux02 joined #nim |
18:56:56 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4y5c |
19:04:42 | NimEventer | New thread by dlesnoff: Is there any utility to output a graphical representation of a Nim Abstract Syntax Tree?, see https://forum.nim-lang.org/t/10268 |
19:05:35 | * | xet7 quit (Ping timeout: 268 seconds) |
19:11:36 | * | nyeaa492842301 quit (Server closed connection) |
19:11:52 | * | nyeaa492842301 joined #nim |
19:18:41 | * | xet7 joined #nim |
19:32:05 | * | ntat quit (Quit: Leaving) |
19:56:03 | FromDiscord | <voidwalker> I tried zero_functional, but ``nim |
19:56:16 | FromDiscord | <voidwalker> (edit) "I tried zero_functional, but ``nim" => "sent a code paste, see https://play.nim-lang.org/#ix=4y5E" |
19:56:26 | FromDiscord | <voidwalker> (edit) "https://play.nim-lang.org/#ix=4y5E" => "https://play.nim-lang.org/#ix=4y5F" |
20:24:08 | * | azimut quit (Ping timeout: 240 seconds) |
20:27:59 | FromDiscord | <voidwalker> how do you cast a seq[uint8] to array[uint8] ? |
20:30:02 | FromDiscord | <jtv> First you make sure it's not empty, then you cast addr arr[0] |
20:30:31 | FromDiscord | <jtv> If the array is empty, that will crash hard 🙂 |
20:32:28 | FromDiscord | <heysokam> In reply to @voidwalker "how do you cast": if you don't know the array size in advance, you can make a generic for it |
20:32:37 | FromDiscord | <voidwalker> I do know the size |
20:33:15 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4y5L |
20:33:16 | FromDiscord | <voidwalker> this doesn't work for some reason |
20:33:26 | FromDiscord | <heysokam> oh you lost me with the map --> |
20:33:49 | FromDiscord | <voidwalker> trying zero_functional for the first time.. bugs me that i cannot have 0 cost functional for such a simple thing : D |
20:34:06 | FromDiscord | <voidwalker> s is seq[uint8] of len 20 |
20:34:16 | FromDiscord | <voidwalker> NodeId is array[20, uint8] |
20:34:22 | FromDiscord | <Elegantbeef> So why do you need a seq if you want an array? |
20:34:52 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4y5N |
20:34:55 | FromDiscord | <Elegantbeef> No wacky macros no external package |
20:34:56 | FromDiscord | <voidwalker> I don't need a seq, I want an array. But that zero functional macro returns a seq, I believe because of the zip, or maybe map changing type of previous zip. |
20:35:02 | FromDiscord | <Elegantbeef> Just good ol' fashion for loop |
20:35:04 | * | azimut joined #nim |
20:35:16 | FromDiscord | <Elegantbeef> Right ZF returns a seq cause it knows you want a sequence |
20:35:22 | FromDiscord | <voidwalker> yeah I already got the for loop solution, but I was investigating 0 cost functional style for this scenario |
20:35:34 | FromDiscord | <Elegantbeef> The for loop is 0 cost 😛 |
20:35:38 | FromDiscord | <Elegantbeef> You cannot do this 0 cost FP style |
20:35:44 | FromDiscord | <Elegantbeef> Since FP assumes dynamic collections |
20:36:06 | FromDiscord | <voidwalker> I think it could be coerced, but whatever : ) |
20:36:12 | FromDiscord | <voidwalker> why doesn't the cast work btw ? |
20:36:13 | FromDiscord | <Elegantbeef> Well not all FP but these FP libraries |
20:36:20 | FromDiscord | <voidwalker> I get bogus result |
20:36:37 | FromDiscord | <Elegantbeef> Well it works |
20:36:39 | FromDiscord | <Elegantbeef> It's just not what you want since the seq is destroyed after leaving this procedure |
20:36:53 | FromDiscord | <Elegantbeef> You get a dangling pointer |
20:37:09 | FromDiscord | <voidwalker> 😮 |
20:37:15 | FromDiscord | <voidwalker> that's how it works ? |
20:37:35 | FromDiscord | <Elegantbeef> Of course you've attempted to hold onto a pointer to the sequence using `cast` |
20:38:06 | FromDiscord | <Elegantbeef> `cast`, `pointer`, and `ptr` are unsafe |
20:38:08 | FromDiscord | <voidwalker> I thought it creates a new copy if I assign it to a variable, or return it |
20:38:19 | FromDiscord | <Elegantbeef> What? |
20:38:36 | FromDiscord | <Elegantbeef> You clearly do not understand the sequence memory model, and should not use cast willy nilly |
20:38:47 | FromDiscord | <Elegantbeef> Sequences are stack allocated `len, ptr`s |
20:39:11 | FromDiscord | <Elegantbeef> you doing `cast[Bleh](s[0].addr)` makes that sequence outlive it's usage |
20:39:23 | FromDiscord | <graveflo> bites tongue |
20:39:27 | FromDiscord | <Elegantbeef> As such the memory management can freely write over the sequence data |
20:39:28 | FromDiscord | <graveflo> but yea listen to beef |
20:39:50 | FromDiscord | <voidwalker> ok but how do you force it to make a copy then ? |
20:39:57 | FromDiscord | <voidwalker> using the data in the seq |
20:40:12 | FromDiscord | <graveflo> the for loop will do that |
20:40:25 | FromDiscord | <Elegantbeef> It's not a copy that's the issue |
20:40:26 | FromDiscord | <Elegantbeef> The issue is you need to keep the sequence alive |
20:40:26 | FromDiscord | <Elegantbeef> Which you cannot do |
20:40:26 | FromDiscord | <Elegantbeef> Since you are returning just an array |
20:40:47 | FromDiscord | <Elegantbeef> `s` is a sequence, it's only valid to reference `s` aslong as it's alive inside this procedure |
20:40:59 | FromDiscord | <voidwalker> that part I understood |
20:41:08 | FromDiscord | <voidwalker> and obviously I didn't know exactly how cast works |
20:41:15 | FromDiscord | <Elegantbeef> what you want to do is `copyMem(result[0].addr, s[0].addr, sizeof(result))` |
20:41:25 | FromDiscord | <Elegantbeef> Which is just `result[0..result.high] = s` |
20:41:33 | FromDiscord | <Elegantbeef> Which is just the for loop |
20:43:36 | FromDiscord | <voidwalker> so with cast I am creating a ref.. ? |
20:43:42 | FromDiscord | <Elegantbeef> No |
20:43:52 | FromDiscord | <Elegantbeef> With cast you're creating a dangling pointer |
20:44:08 | FromDiscord | <Elegantbeef> `ref` is an explicit memory management feature that is memory safe and does not create this behaviour |
20:44:25 | FromDiscord | <Elegantbeef> Only illadvised casts can cause this behaviour in Nim |
20:46:38 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4y5Q |
20:49:55 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4y5R |
20:50:07 | FromDiscord | <Elegantbeef> echo writes over the stack |
20:50:10 | FromDiscord | <voidwalker> (edit) "https://play.nim-lang.org/#ix=4y5R" => "https://play.nim-lang.org/#ix=4y5S" |
20:50:24 | FromDiscord | <Elegantbeef> Welcome to dangling pointers |
20:50:31 | FromDiscord | <Elegantbeef> They depend on your entire program state |
20:51:31 | FromDiscord | <voidwalker> so basically you cannot cast something and assign to a var, and expect to use it beyond the lifetime of the casted entity |
20:51:51 | FromDiscord | <Elegantbeef> Right `cast` and `addr` are unsafe |
20:51:53 | FromDiscord | <graveflo> the original entity and ofc because it gets destroyed |
20:52:15 | FromDiscord | <Elegantbeef> You cannot cast you way around how computers work 😄 |
20:52:25 | FromDiscord | <voidwalker> ok, I had no idea it's a ptr, I thought things get copied, just by forcing a type to it |
20:52:43 | FromDiscord | <voidwalker> (edit) "by" => "" |
20:53:32 | FromDiscord | <Elegantbeef> Hmph actually in this case it perhaps should copy, but regardless what you're doing is wrong |
20:53:58 | FromDiscord | <Elegantbeef> `copyMem` for when you want to copy data `cast` for when you have low level conversions that do not abide by the type system and you know are 'safe' |
20:54:04 | FromDiscord | <graveflo> it gets implicitly copied if its a "value type" under normal conditions. But here if you want the data or a copy of the data to survive longer then the gc tracked reference you either need to have the ref kept alive longer by another gc ref inc or you need a copy that will live longer by its own ref |
20:54:22 | FromDiscord | <graveflo> (edit) "then" => "than" |
20:54:31 | FromDiscord | <Elegantbeef> Well seq's cannot be gcrefd in arc/orc |
20:54:37 | FromDiscord | <Elegantbeef> There isnt much way of keeping it alive |
20:55:01 | FromDiscord | <Elegantbeef> You could make it a ref seq and gcref it, but now since you're returning data you cannot unref it so you leak |
20:55:07 | FromDiscord | <graveflo> even if you assign it to a member of an object that was created further up(/down?) the stack? |
20:55:27 | FromDiscord | <Elegantbeef> Well that moves the lifetime |
20:55:30 | FromDiscord | <graveflo> oh right "value types" |
20:55:31 | FromDiscord | <Elegantbeef> We're talking about this specific program |
20:55:37 | FromDiscord | <Elegantbeef> There is no way to safely ensure `s` lives |
20:55:51 | FromDiscord | <voidwalker> btw what would be your guess about the fastest way to xor two [20, uint8] arrays ? |
20:55:59 | FromDiscord | <graveflo> true true.. Ok its bound to origin then |
20:56:07 | FromDiscord | <Elegantbeef> Probably simd |
20:56:39 | FromDiscord | <Elegantbeef> That's assuming the compiler isnt already optimising it into a simd operation |
20:56:48 | FromDiscord | <voidwalker> I was thinking doing two int64 xor + one int32 : D |
20:57:44 | FromDiscord | <voidwalker> but probably a bad idea |
21:13:33 | FromDiscord | <jtv> If you really need to ensure a seq's lifetime, wrap it in a ref object. |
21:16:09 | FromDiscord | <Elegantbeef> dont do that for this problem |
21:20:21 | FromDiscord | <jtv> Yeah surely not |
21:32:12 | * | oldpcuser_ joined #nim |
21:34:12 | * | oldpcuser_ quit (Max SendQ exceeded) |
21:34:16 | * | oldpcuser quit (Ping timeout: 250 seconds) |
21:34:51 | * | oldpcuser_ joined #nim |
21:45:35 | FromDiscord | <graveflo> is `SymbolFilesOption` in `ConfigRef` only used for the experimental incremental compilation? Its hard to understand what the enum values are for |
21:47:46 | FromDiscord | <Elegantbeef> #internals |
21:50:50 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4y60 |
21:53:41 | FromDiscord | <Elegantbeef> You need to `stdout.flushFile` |
21:54:04 | FromDiscord | <heysokam> but stdout doesn't exist |
21:54:29 | FromDiscord | <Elegantbeef> What? |
21:54:31 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4y62 |
21:55:13 | FromDiscord | <Elegantbeef> Are you using `nimSlimblallsaldlsadlsal` |
21:55:23 | FromDiscord | <Elegantbeef> I do not recall what it's called aside from `nimSlim` |
21:55:39 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4y63 |
21:55:44 | FromDiscord | <Elegantbeef> No it's a flag |
21:55:52 | FromDiscord | <Elegantbeef> `-d:nimSlimStdlibPreview` or something like that |
21:56:00 | FromDiscord | <heysokam> i haven't added that, afaik. or is it active by default? |
21:56:19 | FromDiscord | <Elegantbeef> No |
21:56:40 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4y64 |
21:57:05 | FromDiscord | <Elegantbeef> Using `65c412e3f01bc00f5c6f318edfbfe561ab1bf438` though |
21:57:49 | FromDiscord | <Elegantbeef> It really sounds like you're using `-d:nimPreviewSlimSystem` |
21:57:52 | FromDiscord | <Elegantbeef> I got it eventually |
21:58:09 | FromDiscord | <heysokam> but i havent added that flag 🤔 |
21:58:30 | FromDiscord | <Elegantbeef> Is this nimvm? |
21:58:34 | FromDiscord | <elcritch> @elegantbeef when we were talking about possible matching operators I thought `as` wasn't possible to override? It looks like Nim 1.6.12 it's possible to define as an infix operator! (?) |
21:58:36 | FromDiscord | <Elegantbeef> If it's nimvm of course stdout doesnt exist |
21:58:48 | FromDiscord | <Elegantbeef> It is possible to override |
21:58:55 | FromDiscord | <Elegantbeef> It's just buggy inside generics |
21:58:57 | FromDiscord | <heysokam> no its compiled 🤷♂️ |
21:59:17 | FromDiscord | <Elegantbeef> Well I can only replicate by passing that flag |
21:59:38 | FromDiscord | <heysokam> is there a way to disable it if it has been set by some other lib? |
21:59:45 | FromDiscord | <heysokam> im not using anything.... but just in case |
21:59:50 | FromDiscord | <Elegantbeef> Elcritch when you do like `if x as y` it errors inside generics due to `y` generally being typed i think |
21:59:59 | FromDiscord | <Elegantbeef> `--undef:...`? |
22:00:18 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4y65 |
22:02:40 | FromDiscord | <heysokam> i guess i will just use echo "", because this is weird af |
22:03:56 | FromDiscord | <heysokam> well nvm, but i still need to create the `.........` for each file 😭 |
22:04:15 | FromDiscord | <heysokam> is there some other way to write a dot to cli without a newline? |
22:05:11 | FromDiscord | <elcritch> In reply to @Elegantbeef "Elcritch when you do": knew I must've been missing something |
22:12:00 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4y69 |
22:12:02 | * | oldpcuser_ is now known as oldpcuser |
22:14:52 | FromDiscord | <voidwalker> do we have something like https://nim-lang.org/docs/bitops.html#countLeadingZeroBits%2CSomeInteger somehwere but which returns `sizeof(someInt) 8` if the int is 0 ? |
22:17:39 | FromDiscord | <graveflo> In reply to @voidwalker "do we have something": you mean like adding an `if` statement that checks if `x` is zero and then returning `sizeof(someInt) 8` ? Why not just write that? |
22:18:03 | FromDiscord | <voidwalker> well because if the int starts with a 1 bit, then the result is also 0 |
22:18:58 | FromDiscord | <graveflo> you mean the sign bit? |
22:19:04 | FromDiscord | <graveflo> cast it to an unsigned int then |
22:20:33 | FromDiscord | <voidwalker> it's bitops, doesn't matter if it's signed or not |
22:20:54 | FromDiscord | <voidwalker> if first bit is 1, result is 0; if all bits are 0, result is also 0 (or undefined, depending on flag) |
22:21:32 | FromDiscord | <Elegantbeef> Or perhaps I'm misremembering and just lulling myself int certainty 😛↵(@elcritch) |
22:22:36 | FromDiscord | <jmgomez> `tryAddInheritedFields` was yours right Jason? |
22:23:02 | FromDiscord | <Elegantbeef> Sounds like it |
22:23:19 | FromDiscord | <jmgomez> any problem that comes to mind for adding a depth limit? |
22:23:52 | FromDiscord | <Elegantbeef> I mean I mostly just renamed it and changed behaviour to allow `type Thingy[T, Y] = object of T` compile |
22:24:21 | FromDiscord | <Elegantbeef> Don't think a depth limit is that unfeasible |
22:24:53 | FromDiscord | <jmgomez> gotcha, ok will try that out |
22:26:37 | FromDiscord | <graveflo> In reply to @voidwalker "if first bit is": I'm getting confused about the `int`s here and their purpose but you can mask the first bit I guess |
22:26:51 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4y6b |
22:26:57 | FromDiscord | <voidwalker> this works, but not optimal : P that if shouldn't be needed |
22:29:54 | * | Guest78 joined #nim |
22:31:05 | * | calebtj joined #nim |
22:31:36 | * | Guest78 left #nim (#nim) |
22:35:36 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4y6e |
22:36:06 | FromDiscord | <jmgomez> that's pretty cool! Congrats |
22:36:08 | FromDiscord | <Elegantbeef> Congrats |
22:39:44 | FromDiscord | <jmgomez> Where is the repo @heysokam? |
22:41:50 | * | oldpcuser_ joined #nim |
22:42:16 | * | oldpcuser quit (Killed (NickServ (GHOST command used by oldpcuser_))) |
22:42:22 | * | oldpcuser_ is now known as oldpcuser |
22:47:50 | * | cedb quit (Server closed connection) |
22:48:14 | * | cedb joined #nim |
22:50:05 | FromDiscord | <heysokam> In reply to @jmgomez "Where is the repo": Haven't published today's changes yet, will do that in a sec↵https://github.com/heysokam/confy↵And the quake3 repo is still to be made. I had one already, but its a big mess, so I will probably revamp it entirely to get rid of the horrible mess I made with scons |
22:51:25 | FromDiscord | <Andreas> Is it possible via a concept to express the fact that a object-field does not exists ? |
22:51:49 | FromDiscord | <Elegantbeef> `not compiles(a.field)` |
22:51:54 | FromDiscord | <Elegantbeef> `a.field is void` |
22:52:12 | FromDiscord | <Andreas> In reply to @Elegantbeef "`a.field is void`": great, both work ? |
22:52:25 | FromDiscord | <Elegantbeef> I do not have a degree in conceptology but i think so |
22:52:47 | FromDiscord | <Andreas> In reply to @Elegantbeef "I do not have": whats wrong with your degree Prof. Beef ? |
22:53:05 | FromDiscord | <Elegantbeef> I'm as uneducated as the swine |
22:53:59 | FromDiscord | <Andreas> In reply to @Elegantbeef "I'm as uneducated as": hey, we are fonsies trying smth.. |
22:54:50 | FromDiscord | <Elegantbeef> I don't have a leather jacket |
22:54:53 | FromDiscord | <Elegantbeef> I only have a winter jacket, and it's sure to hot to wear that |
22:56:37 | FromDiscord | <jmgomez> In reply to @heysokam "Haven't published today's changes": cool, will save it just in case some day I have to mess with a make file. Hope that day never come though 😛 |
22:58:43 | FromDiscord | <Andreas> @elegantbeef i tried `void` for a proc that returns nuthing, but that failed. A proc that must exist in a concept but does not return anything ? Is that expressable ? |
22:59:23 | FromDiscord | <Elegantbeef> `a.doThing() is void` should work |
23:00:17 | FromDiscord | <Andreas> In reply to @Elegantbeef "`a.doThing() is void` should": did not for me on devel-latest. changed to `:bool` then,, i'll retry |
23:00:53 | FromDiscord | <Elegantbeef> at the very least you can do `adoThing()` |
23:01:15 | FromDiscord | <Elegantbeef> `a.doThing()` won't give you the void assurance but it'll match atleast |
23:03:16 | FromDiscord | <Andreas> In reply to @Elegantbeef "`a.doThing()` won't give you": matches now, thx |
23:03:40 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4y6j |
23:09:00 | * | oldpcuser quit (Ping timeout: 260 seconds) |
23:11:08 | FromDiscord | <elcritch> In reply to @Elegantbeef "Or perhaps I'm misremembering": haha, well I took it upon myself to play with a `as` macro: https://gist.github.com/elcritch/8e454c3269ba6d6a62793ddfab30da66 |
23:11:39 | FromDiscord | <elcritch> It'd be a bit of work to get it working for any case type, but it probably could |
23:14:35 | FromDiscord | <Elegantbeef> Do try it in a generic procedure |
23:15:12 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4y6l |
23:15:31 | FromDiscord | <Elegantbeef> I think you're going to run into a fun \`undeclared y" |
23:17:30 | * | m5zs7k quit (Server closed connection) |
23:17:49 | * | m5zs7k joined #nim |
23:46:01 | FromDiscord | <elcritch> Yep! That seems like a compiler bug no? It should expand it like any other macro. |
23:46:12 | FromDiscord | <Reggie <3> hi guys <3 |
23:46:19 | FromDiscord | <Reggie <3> im kind of new to nim |
23:46:21 | FromDiscord | <Reggie <3> what up |
23:46:43 | FromDiscord | <Elegantbeef> It might be an inherent issue with that `as` is used for exceptions↵(@elcritch) |
23:51:19 | FromDiscord | <elcritch> In reply to @Elegantbeef "It might be an": Nah I'd doubt that it'd be a fundamental issues. Probably just a corner case that's not handled |
23:55:36 | * | oldpcuser joined #nim |
23:58:30 | * | blackbeard420 quit (Server closed connection) |
23:58:46 | * | blackbeard420 joined #nim |