<< 12-06-2023 >>

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:44FromDiscord<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:39FromDiscord<arathanis> In reply to @heysokam "Is there a way": config.nims?
04:24:14*mahlon joined #nim
04:48:21FromDiscord<kcvinker> Hi all, where I can find some nice examples for declaring an `UncheckedArray` and initializing it, iterating through it, etc.
04:52:32FromDiscord<arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4y25
04:52:37FromDiscord<arathanis> its basically away to use array pointers
04:52:47FromDiscord<kcvinker> a way
04:53:32FromDiscord<arathanis> yeay
04:53:45FromDiscord<arathanis> like if a C lib you are using returns an array of ints as a pointer to an int
04:53:53FromDiscord<arathanis> you would cast it to unchecked array
04:54:08FromDiscord<arathanis> In reply to @kcvinker "a way": missed the space bar, new keyboard :]
04:54:11FromDiscord<arathanis> (edit) "away" => "a way"
04:55:34FromDiscord<arathanis> not a layout im used to haha
04:55:50FromDiscord<kcvinker> @arathanis So alloc0 is the way to create it, right ?
04:56:00FromDiscord<arathanis> or just alloc
04:56:03FromDiscord<arathanis> anything that creates a pointer
04:56:24FromDiscord<kcvinker> IS that garbage collected ?
04:56:26FromDiscord<arathanis> no
04:56:34FromDiscord<arathanis> unchecked arrays are explicitly not for GC memory
04:56:41FromDiscord<graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4y27
04:56:50FromDiscord<arathanis> it says in the manual not to put GC memory in it
04:57:01FromDiscord<arathanis> it wont check this for you
04:57:03FromDiscord<arathanis> you have to just not do it
04:57:45FromDiscord<arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4y28
04:57:46FromDiscord<graveflo> it doesn't check anything anyway. All you lose is explicit control over the time of destruction
04:58:03FromDiscord<kcvinker> I see
04:58:15FromDiscord<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:17FromDiscord<kcvinker> In reply to @arathanis "here is a better": This looks nice
04:58:18FromDiscord<arathanis> causing a segfault
04:58:31FromDiscord<arathanis> this is why it says not to use GC memory
04:58:52FromDiscord<kcvinker> In reply to @arathanis "and because of this": In that case I think I should use a seq
04:58:54FromDiscord<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:02FromDiscord<arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4y29
04:59:27FromDiscord<arathanis> (edit) "https://play.nim-lang.org/#ix=4y29" => "https://play.nim-lang.org/#ix=4y2a"
04:59:41FromDiscord<arathanis> In reply to @kcvinker "In that case I": exactly
04:59:51FromDiscord<arathanis> if you have GCed memory then you already have container types
05:00:05FromDiscord<arathanis> and should use those
05:01:53FromDiscord<kcvinker> I want use the address of contain types like seq
05:02:01FromDiscord<kcvinker> (edit) "contain" => "container"
05:02:19FromDiscord<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:26FromDiscord<arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4y2d
05:02:33*ntat joined #nim
05:02:42FromDiscord<arathanis> (edit) "https://play.nim-lang.org/#ix=4y2d" => "https://play.nim-lang.org/#ix=4y2e"
05:03:40FromDiscord<graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4y2g
05:04:22FromDiscord<arathanis> why would you want to look at the raw memory?
05:04:43FromDiscord<kcvinker> To deal with some win api functions
05:05:24FromDiscord<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:35FromDiscord<kcvinker> @graveflo Does `NimDeqV2` an official nim data type ?
05:06:13FromDiscord<graveflo> yea but you have to be using arc/orc maybe
05:06:28FromDiscord<kcvinker> I am using default gc
05:06:28FromDiscord<graveflo> and you might have to be on #version-2-0 or #devel
05:06:41FromDiscord<kcvinker> I am on 1,6
05:07:10FromDiscord<kcvinker> (edit) "`NimDeqV2`" => "`NimSeqV2`"
05:07:58FromDiscord<arathanis> those functions seem like massive overkill for just getting the heap pointer
05:08:11FromDiscord<graveflo> you would think but nim hides them
05:08:41FromDiscord<arathanis> https://media.discordapp.net/attachments/371759389889003532/1117681857748803654/image.png
05:11:27FromDiscord<graveflo> that's only possible when len > 0
05:12:23FromDiscord<arathanis> if its empty won't it be nil or unallocated?
05:12:39FromDiscord<graveflo> no `newSeqOfCap`
05:14:48FromDiscord<odexine> In reply to @graveflo "that's only possible when": No lol
05:14:49FromDiscord<demotomohiro> when len == 0, `s[0]` throw exception.
05:14:58FromDiscord<odexine> Well IIRC it should work
05:15:05FromDiscord<graveflo> why would that work?
05:15:06FromDiscord<odexine> Or was that for type of I don’t remember anymore
05:15:07FromDiscord<arathanis> what do you do with the heap pointer of to a len 0 seq???
05:15:11FromDiscord<odexine> In reply to @graveflo "why would that work?": Magic
05:15:14FromDiscord<arathanis> (edit) "do" => "would"
05:15:15FromDiscord<odexine> It does happen sometimes
05:15:26FromDiscord<odexine> But yeah I think it only works for type of
05:16:03FromDiscord<demotomohiro> When seq is empty and capacity is also empty, seq doesnt have heap.
05:16:22FromDiscord<odexine> !eval var a: seq[int]; echo typeof a[0];
05:16:28NimBotint
05:16:39FromDiscord<odexine> !eval var a: seq[int]; echo addr a[0];
05:16:41FromDiscord<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:41FromDiscord<arathanis> (edit) removed "of"
05:16:42NimBotCompile failed: /usercode/in.nim(1, 18) Error: type mismatch: got <ptr int>
05:16:49FromDiscord<odexine> Hey
05:16:52FromDiscord<odexine> Look at that 🙂
05:16:53FromDiscord<arathanis> In reply to @graveflo "Hey we are talking": ok that is what i thought
05:17:00FromDiscord<arathanis> the answer being "nothing useful" 😂
05:17:11FromDiscord<arathanis> just railing against the language for the fun of it
05:17:14FromDiscord<demotomohiro> `typeof` or `sizeof` evaluate expression only at compile time not runtime.
05:17:26FromDiscord<odexine> a[0] failing on length 0 only holds for non magic procedures
05:17:37FromDiscord<odexine> Otherwise it can be either it seems
05:17:41FromDiscord<graveflo> In reply to @arathanis "just railing against the": not necessarily. You can learn a lot of grabbing bits of memory sometimes
05:17:47FromDiscord<odexine> In which case it works for addr
05:18:01FromDiscord<odexine> !eval var a: seq[int]; echo repr addr a[0];
05:18:04NimBotCompile failed: /usercode/in.nim(1, 23) Error: type mismatch: got <proc (x: T): string{.noSideEffect.}>
05:18:18FromDiscord<graveflo> In reply to @odexine "In which case it": oh I must have been using `unsafeAddr` but good to know anyway
05:18:27FromDiscord<odexine> Not sure what im doing wrong but it seems like there is a value?
05:18:40FromDiscord<demotomohiro> how about to use `if myseq.len == 0: nil else: myseq[0].addr`?
05:18:46FromDiscord<odexine> !eval var a: seq[int]; echo repr(addr(a[0]))
05:18:52NimBot/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:02FromDiscord<odexine> Huh so it does raise a defecr
05:19:10FromDiscord<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:18FromDiscord<arathanis> when i already finished my beer https://media.discordapp.net/attachments/371759389889003532/1117684528903897158/image.png
05:19:18FromDiscord<odexine> So it is only typeof that works with [0] with length 0
05:19:36FromDiscord<arathanis> it was an IndexDefect this whole time
05:19:48FromDiscord<graveflo> I dont even know whats going on anymore
05:20:22FromDiscord<odexine> addr doesnt work typeof/sizeof does work
05:20:25FromDiscord<odexine> Thats the gisf
05:20:44FromDiscord<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:04FromDiscord<odexine> Do default sequences start with an empty capacity or do they preallocate
05:21:11FromDiscord<odexine> 🤔
05:21:51FromDiscord<graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4y2k
05:21:55FromDiscord<graveflo> bc the `capacity` proc is busted for me
05:22:06FromDiscord<odexine> The which procedure?
05:22:14FromDiscord<graveflo> `capacity`
05:22:26FromDiscord<odexine> Yes where is that found
05:22:33FromDiscord<graveflo> good question
05:22:43FromDiscord<odexine> I don’t remember any procedure like that
05:22:44FromDiscord<graveflo> same place as `NimSeqV2`
05:22:51FromDiscord<odexine> Oh private?
05:22:58FromDiscord<graveflo> I dont think so
05:23:01FromDiscord<graveflo> its new
05:23:07FromDiscord<graveflo> but it also doesn't work
05:24:06FromDiscord<odexine> Seems devel onlt
05:24:18FromDiscord<odexine> What’s broken
05:24:21FromDiscord<graveflo> yea that checks out. I think its on #version-2-0 too
05:24:23FromDiscord<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:45FromDiscord<graveflo> In reply to @demotomohiro "If you still want": really why? it seems to work for me
05:24:51FromDiscord<odexine> In reply to @demotomohiro "If you still want": I don’t think so?
05:25:03FromDiscord<odexine> Why should it be invalid to do so
05:25:29*hexeme joined #nim
05:25:47FromDiscord<demotomohiro> In reply to @graveflo "really why? it seems": if len == 0, myseq[0] throw defect even if cap > 0.
05:26:04FromDiscord<odexine> Yes but why should the capacity procedure fail in that case
05:26:14FromDiscord<odexine> In reply to @demotomohiro "if len == 0,": This is completely sensible
05:26:18FromDiscord<graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4y2m
05:26:33FromDiscord<odexine> Capacity found here https://github.com/nim-lang/Nim/blob/71801c2b8f7eb080421aae9140cd15c5fcc34efd/lib/system/seqs_v2.nim#L141
05:28:55FromDiscord<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:32FromDiscord<odexine> Proper size may not be known until after the function is run (and you can argue it is bad design sure)
05:29:41FromDiscord<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:45FromDiscord<graveflo> and off the rails a bit
05:29:54FromDiscord<odexine> I just don’t think it is sensible to say this behaviour shouldn’t be allowed
05:30:15FromDiscord<graveflo> Yes this is why I have this laying around. New to the lang. Testing stuff
05:30:46FromDiscord<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:47FromDiscord<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:09FromDiscord<graveflo> (edit) "while" => "whole"
05:33:34FromDiscord<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:26FromDiscord<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:56FromDiscord<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:13FromDiscord<odexine> Then again it prolly makes no sense
05:52:44FromDiscord<arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4y2p
05:53:19FromDiscord<arathanis> work in progress
05:53:40FromDiscord<graveflo> yep that looks good so far
05:55:07FromDiscord<arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4y2q
05:57:04FromDiscord<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:18FromDiscord<graveflo> thats the only advantage working directly on the `seq` has ig. but its organized so I like it
05:57:33FromDiscord<arathanis> and you dont have to use private access stuff :P
05:57:43FromDiscord<arathanis> if we are gonna be unsafe
05:57:46FromDiscord<arathanis> lets go all the way
05:57:57FromDiscord<graveflo> well I never needed that. I'm aware of using the offsets its in one of the functions
05:58:02FromDiscord<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:24FromDiscord<graveflo> I didn't know you were a mad lad
05:58:38FromDiscord<arathanis> lol
05:59:57FromDiscord<graveflo> does anyone know if there is a hack that will allow me to install a global `proc` hook?
06:02:14FromDiscord<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:31FromDiscord<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:18FromDiscord<arathanis> In reply to @demotomohiro "You might already know,": this was my reference for pointer arithmetic shenanigans
06:03:26FromDiscord<graveflo> `nimble path niminst` go to source and compile it?
06:03:32FromDiscord<windowsboy111> ok
06:04:01FromDiscord<graveflo> at source route it should be `nim c src/niminst`
06:05:08FromDiscord<windowsboy111> this is confusing…? https://media.discordapp.net/attachments/371759389889003532/1117696064921813022/oshcSE1.png
06:05:13FromDiscord<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:45FromDiscord<graveflo> did you try just `niminst`
06:05:51FromDiscord<graveflo> see if its in path?
06:05:56FromDiscord<windowsboy111> nope
06:05:57FromDiscord<windowsboy111> not in path
06:06:00FromDiscord<windowsboy111> not in nimble bin dir either
06:06:15FromDiscord<graveflo> and you used `nimble install niminst` ?
06:06:18FromDiscord<windowsboy111> yeah
06:06:32FromDiscord<graveflo> might be broken pkg then. Idk what dep its missing there
06:06:50FromDiscord<windowsboy111> from what I see it doesn't have deps…? https://media.discordapp.net/attachments/371759389889003532/1117696493609033849/sQFz9aq.png
06:07:06FromDiscord<arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4y2v
06:07:09FromDiscord<arathanis> we have only just begun to madlad
06:07:49FromDiscord<graveflo> In reply to @windowsboy111 "from what I see": its from 2019.. I think this might be broken or downgrade nim
06:08:07FromDiscord<windowsboy111> damn
06:08:17FromDiscord<graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4y2w
06:08:23FromDiscord<arathanis> In reply to @graveflo "Ok you've actually lost": doin' a little trollin'
06:09:23FromDiscord<graveflo> dont forget to inject it into sys.path and shadow common names
06:10:27FromDiscord<arathanis> for maximum workplace pranking?
06:10:42FromDiscord<arathanis> im on your computer, changing your bashrc
06:11:05FromDiscord<graveflo> or maybe automate a script that adds this into dependency files each time it runs to duplicate itself
06:12:01FromDiscord<arathanis> now we are just making the worlds stupidest virus
06:12:32FromDiscord<graveflo> truth is stupider ones have done dmg. I guess its not that much of a joke
06:12:34FromDiscord<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:15FromDiscord<heysokam> In reply to @arathanis "config.nims?": obviously. but i was meaning without it, if there is a pragma
06:40:32FromDiscord<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:04FromDiscord<odexine> I don’t thinks o
06:41:08FromDiscord<odexine> (edit) "thinks o" => "think so"
06:41:21FromDiscord<odexine> If you mean inside the source file
06:41:34FromDiscord<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:06FromDiscord<heysokam> is there any way to make nimscript become absurdly verbose or something?
06:42:23FromDiscord<heysokam> i just need to know why its failing to resolve the symbol
06:46:07FromDiscord<Elegantbeef> You debug nimscript the same way you do Nim, build a debug compiler and walk up the stack
07:12:25FromDiscord<heysokam> found it, ty beef
07:12:52FromDiscord<heysokam> i was importing the incorrect module, and it was resolving to another proc that required a non nimscript proc
07:14:07FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4y2K
07:15:07FromDiscord<heysokam> oh, might be the command syntax?
07:15:18FromDiscord<graveflo> yea it thinks its a generic i think
07:15:33FromDiscord<heysokam> yep, it was getting the proc, not the output
07:16:24FromDiscord<graveflo> Thats a weird err msg for this problem LOL
07:23:22FromDiscord<windowsboy111> somehow this happens when building niminst https://media.discordapp.net/attachments/371759389889003532/1117715755887247450/n63m5pD.png
07:24:14FromDiscord<windowsboy111> (<https://github.com/terrapkg/packages/actions/runs/5240195365/jobs/9460776884#step:4:28206>)
07:37:35FromDiscord<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:04FromDiscord<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:37FromDiscord<demotomohiro> https://nim-lang.org/docs/manual.html#statements-and-expressions-when-nimvm-statement
09:13:32FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4y39
09:14:08FromDiscord<heysokam> i thought nimvm is only for a binary file being compiled, not for nimscript 🤔
09:14:16FromDiscord<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:43NimEventerNew 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:13FromDiscord<demotomohiro> sent a long message, see http://ix.io/4y3I
14:05:08FromDiscord<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:00FromDiscord<odexine> "just do a cast and call it a day" xd
14:26:02FromDiscord<voidwalker> yeah I did but string to array[byte] is not good it seems
14:28:50FromDiscord<odexine> `cast[ptr array[xxx, byte]](str[0].addr)` doesnt work?
14:29:04FromDiscord<odexine> why array though
14:29:21*PMunch quit (Quit: Leaving)
14:29:23FromDiscord<odexine> you wont suddenly make the string stack-stored by doing this
14:30:17FromDiscord<voidwalker> cause it's fixed length values, lots of them
14:32:11FromDiscord<voidwalker> looking in stew to see if there is something from hex string to array byte
14:34:53FromDiscord<odexine> In reply to @voidwalker "cause it's fixed length": are they compile-time decidable lengths?
14:35:04FromDiscord<odexine> why not openarray
14:35:18FromDiscord<odexine> https://nim-lang.org/docs/system.html#toOpenArray%2Cstring%2Cint%2Cint
14:37:18FromDiscord<voidwalker> this works, phew
14:37:21FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4y4b
14:37:32FromDiscord<voidwalker> playing with the questionable lib for the first time
14:37:47FromDiscord<odexine> thats some... questionable usage
14:37:48FromDiscord<odexine> sorry
14:37:51FromDiscord<voidwalker> : D
14:38:01FromDiscord<voidwalker> how else would one do it
14:38:45FromDiscord<odexine> i was making a joke
14:57:14FromDiscord<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:49FromDiscord<voidwalker> So if the error kind is of no interest, you can return just an Option instead of Result. Am I right ?
15:03:49FromDiscord<odexine> well, it depends; personally if there are any errors i'd prolly never use options for them
15:04:14FromDiscord<odexine> i personally think options are strictly for when your types need a nullary value
15:04:29FromDiscord<odexine> and that none types must never indicate errors
15:10:40FromDiscord<voidwalker> well what if you don't care about the error, like, hex string > 40, or hex string contains non hex chars
15:13:03FromDiscord<voidwalker> what am I gonna do with endlessly nested try excepts
15:18:30Amun-Rahmm, Result?
15:18:51Amun-Raah, I guess it's a thirdparty module
15:25:58FromDiscord<voidwalker> https://github.com/status-im/questionable
15:26:42FromDiscord<arnetheduck> In reply to @voidwalker "So if the error": https://github.com/arnetheduck/nim-results/blob/023375923c655aa3252c52c39efc1a091266539f/results.nim#L152
15:26:44FromDiscord<voidwalker> this stuff is standard in rust, no need to pick your 3rd party lib....
15:30:31FromDiscord<voidwalker> @arnetheduck any words on `questionable` vs your nim-results ?
15:30:37Amun-RaI'll write something like this for my viewer
15:30:56FromDiscord<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:25Amun-Ravoidwalker: is there something like this in std?
15:31:52FromDiscord<voidwalker> just std/options, no results afaik
15:32:04Amun-Ramhm
15:34:02FromDiscord<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:29Amun-RaI like that zig-alike syntax (!)
15:34:29FromDiscord<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:44FromDiscord<arnetheduck> (edit) "providesa" => "provides a" | "provides abit of syntactic ... on" added "sugar"
15:36:25FromDiscord<arnetheduck> (edit) "use" => "uses"
15:37:26FromDiscord<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:29FromDiscord<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:59FromDiscord<voidwalker> I also liked the zig way of handling exceptions and errors. nim is very bad with its ancient try except
15:38:12arkanoidI'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:16Amun-Rayes, zig is great in that compartment
15:39:11Amun-Raarkanoid: well, I recommend starting with {.push raises: [].} at the beginning of every file
15:39:42FromDiscord<arnetheduck> arkanoid: https://status-im.github.io/nim-style-guide/
15:40:02arkanoidAmun-Ra: why that?
15:40:16arkanoidAmun-Ra: what happens to error handling down the road, doing so?
15:40:23Amun-Raarkanoid: to explicit mark every function that raises an exception
15:40:29Amun-Rately*
15:40:36arkanoidAmun-Ra: java like?
15:40:48Amun-Rasomething like that
15:41:26Amun-Rahttps://status-im.github.io/nim-style-guide/errors.exceptions.html
15:42:17arkanoidmakes 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:07FromDiscord<arnetheduck> `func` where you can, `proc` where you must, to adapt an old database normalisation adage
15:43:10Amun-RaI start with func whenever I can
15:43:29Amun-Raunlike modules in std ;>
15:44:04arkanoidYeah in my own project I also stick with func everywhere, I also try to enable al the possible strictness
15:44:12Amun-Rasame
15:45:16arkanoidso, long story short, in status you handle defects/panics with explicit raises pragma, and expected errors with Option/Result?
15:45:47FromDiscord<odexine> raises does not track defects
15:46:04Amun-RaI haven't adopted Result yet, I'll roll my own
15:48:00arkanoidcodexine, right, but if I remember correctly where was some bad mix of error/defect before 1.5 or something
15:51:05FromDiscord<odexine> oh fuck i didnt realise it showed me as odexine now -- i'm rika
15:51:12FromDiscord<odexine> bot needs update i think
15:52:42FromDiscord<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:36arkanoidnevermind, it's just a detail
16:22:37NimEventerNew Nimble package! nimip - Asynchronously lookup IP addresses with this tiny, hybrid Nim application., see https://github.com/hitblast/nimip
16:22:41FromDiscord<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:19FromDiscord<michaelb.eth> sent a code paste, see https://play.nim-lang.org/#ix=4y4B
16:34:35FromDiscord<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:05FromDiscord<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:12FromDiscord<michaelb.eth> (edit) "not" => "note"
16:36:46FromDiscord<voidwalker> so I can use both stew/results and arnetheduck results with questionable ?
16:36:56FromDiscord<voidwalker> I'd rather pick one and use it long term, and questionable looks good to me
16:37:03FromDiscord<michaelb.eth> stew/results is arnetheduck results 😄
16:37:11FromDiscord<voidwalker> omfg this is so confusing : D
16:37:32FromDiscord<michaelb.eth> actually, which one is more up-to-date at this point, checking...
16:38:44FromDiscord<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:06FromDiscord<michaelb.eth> @arnetheduck at this point is one better of with stew/results or the one in the repo under your account?
16:39:35FromDiscord<michaelb.eth> (edit) "of" => "off"
16:40:29FromDiscord<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:02FromDiscord<odexine> In reply to @System64 "Is that normal I": might be that emscripten doesnt have an equivalent for that file
16:41:21FromDiscord<System64 ~ Flandre Scarlet> In reply to @odexine "might be that emscripten": Well, it is in the emscripten files
16:41:30FromDiscord<odexine> idk then
16:41:55FromDiscord<arnetheduck> https://github.com/status-im/nim-stew/pull/185
16:42:51FromDiscord<voidwalker> yeah that stew is way too rich
16:43:15FromDiscord<michaelb.eth> so many lovely treasures in stew
16:43:43FromDiscord<michaelb.eth> byteutils is a fav of mine
16:43:53FromDiscord<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:02FromDiscord<odexine> not sure about emcc
16:44:17FromDiscord<System64 ~ Flandre Scarlet> OOF
16:44:39FromDiscord<odexine> try -H?
16:45:28FromDiscord<odexine> not sure really
16:45:35FromDiscord<odexine> check emcc docs
16:57:27FromDiscord<voidwalker> how do you report a duplicate pkg in nimble ? you pr to remove one of them ? if so, which one ?
17:00:48FromDiscord<voidwalker> also lol, this is a nimble package: https://github.com/HazeCS/geolocation/blob/main/geolocation.nim
17:05:38FromDiscord<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:02FromDiscord<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:17FromDiscord<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:31FromDiscord<starkiller1493> (edit) "`in`" => "`if in`"
17:53:00Amun-Raok, so I wrote my minimalistic result that'll fit my needs https://play.nim-lang.org/#ix=4y4U
17:55:57FromDiscord<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:35FromDiscord<demotomohiro> Maybe you are using template or macro that implicity define procedure.
17:57:37FromDiscord<voidwalker> can anyone figure out how to xor two arrays in functional style, without using extra allocations (except `result`):
17:57:45FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4y4V
17:57:46FromDiscord<michaelb.eth> is it possible to specify that a generic parameter must be type `enum` (obviously not specific to a particular enum)
17:57:48FromDiscord<starkiller1493> In reply to @demotomohiro "I think you got": It's an async procedure
17:59:10FromDiscord<michaelb.eth> can you make it a ref Table?
18:01:30FromDiscord<starkiller1493> yes, but it yields the same error
18:03:01FromDiscord<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:07FromDiscord<michaelb.eth> I think, haven't tried in awhile
18:04:44FromDiscord<starkiller1493> without var it compiles
18:04:57FromDiscord<demotomohiro> In reply to @michaelb.eth "is it possible to": Using enum type class like `foo[E: enum]` doesnt work?
18:05:13FromDiscord<michaelb.eth> doing some experiments, maybe it's that simple
18:05:13FromDiscord<starkiller1493> (edit) "compiles" => "compiles↵gonna test it with Ref"
18:05:56FromDiscord<starkiller1493> (edit) "without var ... it" added "and with Ref" | removed "with Ref"
18:07:27FromDiscord<starkiller1493> In reply to @michaelb.eth "async procs can't have": nice, it works
18:10:30FromDiscord<michaelb.eth> nice
18:10:50*xet7 joined #nim
18:11:47FromDiscord<michaelb.eth> In reply to @demotomohiro "Using enum type class": works great!
18:11:53FromDiscord<michaelb.eth> (edit) "great!" => "great, thanks!"
18:36:27NimEventerNew thread by mantielero: FMU library - fmi2FreeInstance, see https://forum.nim-lang.org/t/10267
18:52:53*krux02 joined #nim
18:56:56FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4y5c
19:04:42NimEventerNew 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:03FromDiscord<voidwalker> I tried zero_functional, but ``nim
19:56:16FromDiscord<voidwalker> (edit) "I tried zero_functional, but ``nim" => "sent a code paste, see https://play.nim-lang.org/#ix=4y5E"
19:56:26FromDiscord<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:59FromDiscord<voidwalker> how do you cast a seq[uint8] to array[uint8] ?
20:30:02FromDiscord<jtv> First you make sure it's not empty, then you cast addr arr[0]
20:30:31FromDiscord<jtv> If the array is empty, that will crash hard 🙂
20:32:28FromDiscord<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:37FromDiscord<voidwalker> I do know the size
20:33:15FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4y5L
20:33:16FromDiscord<voidwalker> this doesn't work for some reason
20:33:26FromDiscord<heysokam> oh you lost me with the map -->
20:33:49FromDiscord<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:06FromDiscord<voidwalker> s is seq[uint8] of len 20
20:34:16FromDiscord<voidwalker> NodeId is array[20, uint8]
20:34:22FromDiscord<Elegantbeef> So why do you need a seq if you want an array?
20:34:52FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4y5N
20:34:55FromDiscord<Elegantbeef> No wacky macros no external package
20:34:56FromDiscord<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:02FromDiscord<Elegantbeef> Just good ol' fashion for loop
20:35:04*azimut joined #nim
20:35:16FromDiscord<Elegantbeef> Right ZF returns a seq cause it knows you want a sequence
20:35:22FromDiscord<voidwalker> yeah I already got the for loop solution, but I was investigating 0 cost functional style for this scenario
20:35:34FromDiscord<Elegantbeef> The for loop is 0 cost 😛
20:35:38FromDiscord<Elegantbeef> You cannot do this 0 cost FP style
20:35:44FromDiscord<Elegantbeef> Since FP assumes dynamic collections
20:36:06FromDiscord<voidwalker> I think it could be coerced, but whatever : )
20:36:12FromDiscord<voidwalker> why doesn't the cast work btw ?
20:36:13FromDiscord<Elegantbeef> Well not all FP but these FP libraries
20:36:20FromDiscord<voidwalker> I get bogus result
20:36:37FromDiscord<Elegantbeef> Well it works
20:36:39FromDiscord<Elegantbeef> It's just not what you want since the seq is destroyed after leaving this procedure
20:36:53FromDiscord<Elegantbeef> You get a dangling pointer
20:37:09FromDiscord<voidwalker> 😮
20:37:15FromDiscord<voidwalker> that's how it works ?
20:37:35FromDiscord<Elegantbeef> Of course you've attempted to hold onto a pointer to the sequence using `cast`
20:38:06FromDiscord<Elegantbeef> `cast`, `pointer`, and `ptr` are unsafe
20:38:08FromDiscord<voidwalker> I thought it creates a new copy if I assign it to a variable, or return it
20:38:19FromDiscord<Elegantbeef> What?
20:38:36FromDiscord<Elegantbeef> You clearly do not understand the sequence memory model, and should not use cast willy nilly
20:38:47FromDiscord<Elegantbeef> Sequences are stack allocated `len, ptr`s
20:39:11FromDiscord<Elegantbeef> you doing `cast[Bleh](s[0].addr)` makes that sequence outlive it's usage
20:39:23FromDiscord<graveflo> bites tongue
20:39:27FromDiscord<Elegantbeef> As such the memory management can freely write over the sequence data
20:39:28FromDiscord<graveflo> but yea listen to beef
20:39:50FromDiscord<voidwalker> ok but how do you force it to make a copy then ?
20:39:57FromDiscord<voidwalker> using the data in the seq
20:40:12FromDiscord<graveflo> the for loop will do that
20:40:25FromDiscord<Elegantbeef> It's not a copy that's the issue
20:40:26FromDiscord<Elegantbeef> The issue is you need to keep the sequence alive
20:40:26FromDiscord<Elegantbeef> Which you cannot do
20:40:26FromDiscord<Elegantbeef> Since you are returning just an array
20:40:47FromDiscord<Elegantbeef> `s` is a sequence, it's only valid to reference `s` aslong as it's alive inside this procedure
20:40:59FromDiscord<voidwalker> that part I understood
20:41:08FromDiscord<voidwalker> and obviously I didn't know exactly how cast works
20:41:15FromDiscord<Elegantbeef> what you want to do is `copyMem(result[0].addr, s[0].addr, sizeof(result))`
20:41:25FromDiscord<Elegantbeef> Which is just `result[0..result.high] = s`
20:41:33FromDiscord<Elegantbeef> Which is just the for loop
20:43:36FromDiscord<voidwalker> so with cast I am creating a ref.. ?
20:43:42FromDiscord<Elegantbeef> No
20:43:52FromDiscord<Elegantbeef> With cast you're creating a dangling pointer
20:44:08FromDiscord<Elegantbeef> `ref` is an explicit memory management feature that is memory safe and does not create this behaviour
20:44:25FromDiscord<Elegantbeef> Only illadvised casts can cause this behaviour in Nim
20:46:38FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4y5Q
20:49:55FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4y5R
20:50:07FromDiscord<Elegantbeef> echo writes over the stack
20:50:10FromDiscord<voidwalker> (edit) "https://play.nim-lang.org/#ix=4y5R" => "https://play.nim-lang.org/#ix=4y5S"
20:50:24FromDiscord<Elegantbeef> Welcome to dangling pointers
20:50:31FromDiscord<Elegantbeef> They depend on your entire program state
20:51:31FromDiscord<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:51FromDiscord<Elegantbeef> Right `cast` and `addr` are unsafe
20:51:53FromDiscord<graveflo> the original entity and ofc because it gets destroyed
20:52:15FromDiscord<Elegantbeef> You cannot cast you way around how computers work 😄
20:52:25FromDiscord<voidwalker> ok, I had no idea it's a ptr, I thought things get copied, just by forcing a type to it
20:52:43FromDiscord<voidwalker> (edit) "by" => ""
20:53:32FromDiscord<Elegantbeef> Hmph actually in this case it perhaps should copy, but regardless what you're doing is wrong
20:53:58FromDiscord<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:04FromDiscord<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:22FromDiscord<graveflo> (edit) "then" => "than"
20:54:31FromDiscord<Elegantbeef> Well seq's cannot be gcrefd in arc/orc
20:54:37FromDiscord<Elegantbeef> There isnt much way of keeping it alive
20:55:01FromDiscord<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:07FromDiscord<graveflo> even if you assign it to a member of an object that was created further up(/down?) the stack?
20:55:27FromDiscord<Elegantbeef> Well that moves the lifetime
20:55:30FromDiscord<graveflo> oh right "value types"
20:55:31FromDiscord<Elegantbeef> We're talking about this specific program
20:55:37FromDiscord<Elegantbeef> There is no way to safely ensure `s` lives
20:55:51FromDiscord<voidwalker> btw what would be your guess about the fastest way to xor two [20, uint8] arrays ?
20:55:59FromDiscord<graveflo> true true.. Ok its bound to origin then
20:56:07FromDiscord<Elegantbeef> Probably simd
20:56:39FromDiscord<Elegantbeef> That's assuming the compiler isnt already optimising it into a simd operation
20:56:48FromDiscord<voidwalker> I was thinking doing two int64 xor + one int32 : D
20:57:44FromDiscord<voidwalker> but probably a bad idea
21:13:33FromDiscord<jtv> If you really need to ensure a seq's lifetime, wrap it in a ref object.
21:16:09FromDiscord<Elegantbeef> dont do that for this problem
21:20:21FromDiscord<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:35FromDiscord<graveflo> is `SymbolFilesOption` in `ConfigRef` only used for the experimental incremental compilation? Its hard to understand what the enum values are for
21:47:46FromDiscord<Elegantbeef> #internals
21:50:50FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4y60
21:53:41FromDiscord<Elegantbeef> You need to `stdout.flushFile`
21:54:04FromDiscord<heysokam> but stdout doesn't exist
21:54:29FromDiscord<Elegantbeef> What?
21:54:31FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4y62
21:55:13FromDiscord<Elegantbeef> Are you using `nimSlimblallsaldlsadlsal`
21:55:23FromDiscord<Elegantbeef> I do not recall what it's called aside from `nimSlim`
21:55:39FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4y63
21:55:44FromDiscord<Elegantbeef> No it's a flag
21:55:52FromDiscord<Elegantbeef> `-d:nimSlimStdlibPreview` or something like that
21:56:00FromDiscord<heysokam> i haven't added that, afaik. or is it active by default?
21:56:19FromDiscord<Elegantbeef> No
21:56:40FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4y64
21:57:05FromDiscord<Elegantbeef> Using `65c412e3f01bc00f5c6f318edfbfe561ab1bf438` though
21:57:49FromDiscord<Elegantbeef> It really sounds like you're using `-d:nimPreviewSlimSystem`
21:57:52FromDiscord<Elegantbeef> I got it eventually
21:58:09FromDiscord<heysokam> but i havent added that flag 🤔
21:58:30FromDiscord<Elegantbeef> Is this nimvm?
21:58:34FromDiscord<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:36FromDiscord<Elegantbeef> If it's nimvm of course stdout doesnt exist
21:58:48FromDiscord<Elegantbeef> It is possible to override
21:58:55FromDiscord<Elegantbeef> It's just buggy inside generics
21:58:57FromDiscord<heysokam> no its compiled 🤷‍♂️
21:59:17FromDiscord<Elegantbeef> Well I can only replicate by passing that flag
21:59:38FromDiscord<heysokam> is there a way to disable it if it has been set by some other lib?
21:59:45FromDiscord<heysokam> im not using anything.... but just in case
21:59:50FromDiscord<Elegantbeef> Elcritch when you do like `if x as y` it errors inside generics due to `y` generally being typed i think
21:59:59FromDiscord<Elegantbeef> `--undef:...`?
22:00:18FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4y65
22:02:40FromDiscord<heysokam> i guess i will just use echo "", because this is weird af
22:03:56FromDiscord<heysokam> well nvm, but i still need to create the `.........` for each file 😭
22:04:15FromDiscord<heysokam> is there some other way to write a dot to cli without a newline?
22:05:11FromDiscord<elcritch> In reply to @Elegantbeef "Elcritch when you do": knew I must've been missing something
22:12:00FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4y69
22:12:02*oldpcuser_ is now known as oldpcuser
22:14:52FromDiscord<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:39FromDiscord<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:03FromDiscord<voidwalker> well because if the int starts with a 1 bit, then the result is also 0
22:18:58FromDiscord<graveflo> you mean the sign bit?
22:19:04FromDiscord<graveflo> cast it to an unsigned int then
22:20:33FromDiscord<voidwalker> it's bitops, doesn't matter if it's signed or not
22:20:54FromDiscord<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:32FromDiscord<Elegantbeef> Or perhaps I'm misremembering and just lulling myself int certainty 😛↵(@elcritch)
22:22:36FromDiscord<jmgomez> `tryAddInheritedFields` was yours right Jason?
22:23:02FromDiscord<Elegantbeef> Sounds like it
22:23:19FromDiscord<jmgomez> any problem that comes to mind for adding a depth limit?
22:23:52FromDiscord<Elegantbeef> I mean I mostly just renamed it and changed behaviour to allow `type Thingy[T, Y] = object of T` compile
22:24:21FromDiscord<Elegantbeef> Don't think a depth limit is that unfeasible
22:24:53FromDiscord<jmgomez> gotcha, ok will try that out
22:26:37FromDiscord<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:51FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4y6b
22:26:57FromDiscord<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:36FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4y6e
22:36:06FromDiscord<jmgomez> that's pretty cool! Congrats
22:36:08FromDiscord<Elegantbeef> Congrats
22:39:44FromDiscord<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:05FromDiscord<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:25FromDiscord<Andreas> Is it possible via a concept to express the fact that a object-field does not exists ?
22:51:49FromDiscord<Elegantbeef> `not compiles(a.field)`
22:51:54FromDiscord<Elegantbeef> `a.field is void`
22:52:12FromDiscord<Andreas> In reply to @Elegantbeef "`a.field is void`": great, both work ?
22:52:25FromDiscord<Elegantbeef> I do not have a degree in conceptology but i think so
22:52:47FromDiscord<Andreas> In reply to @Elegantbeef "I do not have": whats wrong with your degree Prof. Beef ?
22:53:05FromDiscord<Elegantbeef> I'm as uneducated as the swine
22:53:59FromDiscord<Andreas> In reply to @Elegantbeef "I'm as uneducated as": hey, we are fonsies trying smth..
22:54:50FromDiscord<Elegantbeef> I don't have a leather jacket
22:54:53FromDiscord<Elegantbeef> I only have a winter jacket, and it's sure to hot to wear that
22:56:37FromDiscord<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:43FromDiscord<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:23FromDiscord<Elegantbeef> `a.doThing() is void` should work
23:00:17FromDiscord<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:53FromDiscord<Elegantbeef> at the very least you can do `adoThing()`
23:01:15FromDiscord<Elegantbeef> `a.doThing()` won't give you the void assurance but it'll match atleast
23:03:16FromDiscord<Andreas> In reply to @Elegantbeef "`a.doThing()` won't give you": matches now, thx
23:03:40FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4y6j
23:09:00*oldpcuser quit (Ping timeout: 260 seconds)
23:11:08FromDiscord<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:39FromDiscord<elcritch> It'd be a bit of work to get it working for any case type, but it probably could
23:14:35FromDiscord<Elegantbeef> Do try it in a generic procedure
23:15:12FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4y6l
23:15:31FromDiscord<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:01FromDiscord<elcritch> Yep! That seems like a compiler bug no? It should expand it like any other macro.
23:46:12FromDiscord<Reggie <3> hi guys <3
23:46:19FromDiscord<Reggie <3> im kind of new to nim
23:46:21FromDiscord<Reggie <3> what up
23:46:43FromDiscord<Elegantbeef> It might be an inherent issue with that `as` is used for exceptions↵(@elcritch)
23:51:19FromDiscord<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