<< 26-03-2023 >>

00:01:19FromDiscord<Elegantbeef> If you really care about the performance copying this addition i made to arturo will catch some performance issues https://github.com/arturo-lang/arturo/blob/44127899d8e8c353fe73c54e5c571154b5e2e699/src/vm/ast.nim#L82
00:04:31FromDiscord<Elegantbeef> Getting these objects small in arturo's case helped a ton for performance since they use plenty of heap allocated objects
00:05:08FromDiscord<Dale> It's not so much the size I was worried about, but whether this is the right way to achieve this
00:05:23FromDiscord<Elegantbeef> It is indeed
00:05:30FromDiscord<Dale> The other option is polymorphs, but that is yucky
00:06:08FromDiscord<Dale> Using a switch to define the fields is a bit weird, but that's how it goes in nim I see
00:06:50FromDiscord<Elegantbeef> Insert reference to fungus here 😄
00:07:08FromDiscord<Dale> I guess the idea behind it is that a switch is the interface we're used to using, so why not reuse the familiar syntax
00:07:30FromDiscord<Elegantbeef> Yea, though compared to other languages using a case statement does give you more capabillities
00:08:07FromDiscord<Elegantbeef> You can limit a field to a specific range of ordinals, or have even more discriminated types internally
00:08:20FromDiscord<Dale> Yeah it gives some macro-like control
00:11:34FromDiscord<Dale> sent a code paste, see https://play.nim-lang.org/#ix=4rPh
00:11:47FromDiscord<Dale> I forgot to store the string though >.<
00:12:25FromDiscord<Dale> Also why is the EOF storing stuff. I'd have never noticed if I didn't apste it here
00:12:30FromDiscord<Dale> (edit) "apste" => "paste"
00:13:35FromDiscord<Dale> 🦆
00:46:59FromDiscord<firasuke> ok I am trying to calculate the hash of a file using hashlib, previously I was using `hashlib` and the following worked `$count[HASH_TYPE](newFileStream("someFile", fmRead))`, but now I am getting wrong hashes, and the file is intact, what am I doing wrong?
00:56:44FromDiscord<Elegantbeef> I assume it's getting the hash of the reference of `newFIleStream`
00:57:33FromDiscord<firasuke> oh
00:57:36FromDiscord<firasuke> how do I fix it?
00:57:40FromDiscord<firasuke> and why was it working before?
00:58:26FromDiscord<Elegantbeef> Oh if it was working i'm wrong and something else is the culprit
00:58:33FromDiscord<Elegantbeef> It lacks usable docs so it's hard to say
00:59:21FromDiscord<firasuke> ok then, how do you read a file entirely into memory in nim, so you can hash it?
00:59:26FromDiscord<firasuke> or convert it to a stream?
00:59:53FromDiscord<Elegantbeef> you can `readAll` or `readFile` but yea it seems this stream api should work
01:00:34FromDiscord<firasuke> oh ok
01:09:04FromDiscord<firasuke> Weird it's still not working
01:09:22FromDiscord<Elegantbeef> Are you sure it's not
01:09:35FromDiscord<firasuke> I don't know tbh
01:10:36FromDiscord<firasuke> I ran a lot of tests and I am getting a weird hash that is not the hash of the original file
01:10:54FromDiscord<Elegantbeef> Are you using the same stream over and over?
01:11:34FromDiscord<firasuke> I am doing a string comparison between the known hash and the calculated hash
01:11:54FromDiscord<Elegantbeef> And you're using the same algorithm?
01:12:02FromDiscord<firasuke> Yes
01:12:05FromDiscord<Elegantbeef> You're also not using a stream that's at the end?
01:13:18FromDiscord<firasuke> sent a code paste, see https://paste.rs/Rzc
01:13:30FromDiscord<firasuke> (edit)
01:15:50FromDiscord<firasuke> Oh wait, does it follow symlinks by default?
01:16:15FromDiscord<firasuke> I must've been hashing the symlink 😔
01:22:02FromDiscord<Dale> Where is the `in` keyword documented? Its hard to search for
01:22:18FromDiscord<Elegantbeef> https://nim-lang.org/docs/system.html#in.t%2Cuntyped%2Cuntyped
01:22:31FromDiscord<Elegantbeef> https://nim-lang.org/docs/theindex.html#%60in%60 isnt too hard to search fore 😄
01:23:11FromDiscord<Dale> I was looking in the manual, not the std docs
02:01:51FromDiscord<Diogenes of Toronto> line[line.len - 1] is there a more idiomatic way to get the end of a string
02:01:58FromDiscord<Elegantbeef> `line[^1]`
02:02:15FromDiscord<Diogenes of Toronto> THANKS
02:03:07FromDiscord<Elegantbeef> NO
02:05:59FromDiscord<Dudugz> lol
02:06:16FromDiscord<Elegantbeef> Also you may have encouraged me to make this work https://github.com/beef331/fungus/blob/commonfields/tests/tcommmand.nim
02:06:29FromDiscord<Elegantbeef> Much more succinct 😄
02:06:44FromDiscord<Elegantbeef> Still dislike that we cannot do `short, long, help: string`
02:07:23FromDiscord<demotomohiro> In Nim, `^` or `in` are operators. Operators are defined in system module and they are explained in: https://nim-lang.org/docs/system.html#%5E.t,int
02:20:53FromDiscord<Diogenes of Toronto> sent a code paste, see https://play.nim-lang.org/#ix=4rPH
02:20:55*nanxiao joined #nim
02:21:05FromDiscord<Elegantbeef> Oh of course it works
02:21:16FromDiscord<Elegantbeef> The ADT macros is a different approach of course
02:21:28FromDiscord<Elegantbeef> Do you actually need the `ref` object?
02:22:30FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4rPI
02:22:34FromDiscord<Diogenes of Toronto> i tried to add short, long, help: string↵ required: bool to cmd object with the cases but it didnt work
02:22:39FromDiscord<Elegantbeef> This allows `StrCmd.init` or `FloatCmd.init`
02:23:04FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4rPJ
02:23:25FromDiscord<Diogenes of Toronto> this didnt work
02:23:31FromDiscord<Elegantbeef> To be clear i'm not trying to sway you to use fungus, just it provided a interesting problem that i realise would work
02:23:35FromDiscord<Elegantbeef> could work\
02:23:37FromDiscord<Elegantbeef> It certainly does
02:23:45FromDiscord<Diogenes of Toronto> fungus looks cool not gonna lie
02:23:59FromDiscord<Elegantbeef> Yea that code does work
02:24:06FromDiscord<Diogenes of Toronto> i wanted to try doing it regurlar nim first as i am still a begginer
02:24:20FromDiscord<Elegantbeef> Yea i do not blame you
02:24:32FromDiscord<Elegantbeef> Using macros isnt the end all be all, but it can be nice
02:25:05FromDiscord<Dale> Whoop, I got my lexer to not only read numbers, but also different notations, which is not in the book. It can read scientific, hex, and binary too
02:25:23FromDiscord<Elegantbeef> Thought you wrote "whoops" accidently
02:25:33FromDiscord<Elegantbeef> I was like ah yes the good old "Whoops i made a shelf"
02:25:37FromDiscord<Diogenes of Toronto> In reply to @Elegantbeef "Yea that code does": okay it was my editor giving me fake errors i checked again after reloading vscode
02:25:42FromDiscord<Dale> I should've said Whoop!
02:25:56FromDiscord<Elegantbeef> With Nim you can only really trust the compiler
02:26:00FromDiscord<Elegantbeef> It's a shame of course
02:26:03FromDiscord<Elegantbeef> But it is what it is
02:32:02*nanxiao quit (Quit: Client closed)
02:43:46FromDiscord<Dale> The book also states that it doesn't un-escape the strings. Maybe I should pop that in as well, shouldn't be too hard
02:48:40FromDiscord<Diogenes of Toronto> proc createCommitFile(file: string, n: Natural, h: string) {.raises: [Exception].} =↵ ↵↵how would i make h an optional value?
02:49:00FromDiscord<Elegantbeef> `n: Natural = yourDefault`
02:49:09FromDiscord<Elegantbeef> Or you use `std/options` if a sentinel doesnt work
03:00:52FromDiscord<Diogenes of Toronto> omg its coming tgether
03:00:57FromDiscord<Diogenes of Toronto>
03:01:48FromDiscord<Diogenes of Toronto> I think i might be able to actually mostly finish this project by the end of the weekend for work tomorrow and propose this as an option in or ci pipeline
03:02:01FromDiscord<Diogenes of Toronto> (edit) "or" => "our"
03:02:19FromDiscord<Diogenes of Toronto> hoepfully i can seek nim into work and also gain some users
03:02:33FromDiscord<Diogenes of Toronto> (edit) "hoepfully" => "hopefully" | "seek" => "sneak"
04:14:47FromDiscord<Hourglass [She/Her]> If I'm reading and writing a file format that has to be big endian, and I'm on a little endian system, how does that code look? Kinda confused
04:15:53FromDiscord<Elegantbeef> use `std/endian` or similar api
04:16:02FromDiscord<Elegantbeef> I know @auxym loves bringing up a C api
04:28:06FromDiscord<Hourglass [She/Her]> sent a code paste, see https://paste.rs/biZ
04:28:14FromDiscord<Hourglass [She/Her]> Gives different results on read/write
04:29:22FromDiscord<Elegantbeef> The fact your using case is quite abbhorent 😄
04:30:17FromDiscord<Elegantbeef> you're\
04:34:17FromDiscord<Elegantbeef> Works here
04:34:19FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4rQ5
04:37:45FromDiscord<Hourglass [She/Her]> Why are you using `when` instead?
04:38:07*azimut_ joined #nim
04:38:09FromDiscord<Hourglass [She/Her]> Wait am I dumb
04:38:28FromDiscord<Elegantbeef> Cause a binary cannot run on a BE cpu if it's a LE binary
04:38:43FromDiscord<Hourglass [She/Her]> That makes sense 🤦‍♀️ thanks Beef!
04:41:17*azimut quit (Ping timeout: 255 seconds)
04:43:18FromDiscord<Hourglass [She/Her]> This is odd... When comparing the magic number, for some reason the number being read is `741223470`, but it should be `1651402347`
04:45:04FromDiscord<Hourglass [She/Her]> Wait
04:45:22FromDiscord<Hourglass [She/Her]> Yeah okay, idk what the issue is
04:46:55FromDiscord<Hourglass [She/Her]> `strm.readUint32().fromBigEndian()` and `strm.write(MAGIC.toBigEndian)` should work but... Nope
04:47:11FromDiscord<Hourglass [She/Her]> MAGIC is defined as a uint32 so that shouldn't be causing me issues
04:47:20FromDiscord<Elegantbeef> Can you reproduce using my code?
04:48:33FromDiscord<Hourglass [She/Her]> Nope, yours works perfectly
04:48:47FromDiscord<Hourglass [She/Her]> I'm writing to a stream then writing to a file but that shouldn't be an issue?
04:49:32FromDiscord<Dale> Man, nim really makes making DSLs and such easy
04:49:35FromDiscord<Elegantbeef> It's no different
04:49:42FromDiscord<Dale> `IdenStartChars` !
04:49:46FromDiscord<Dale> (edit) "`IdenStartChars`" => "`IdendStartChars`"
04:49:48FromDiscord<Elegantbeef> Yea macros and templates are magical
04:49:52FromDiscord<Dale> (edit) "`IdendStartChars`" => "`IdentStartChars`"
04:50:53FromDiscord<Dale> I currently have this line also `gobError(state.path, state.line, "Unexpected character '" & nextChar & "'")`, is there another way to do string interp?
04:51:09FromDiscord<Elegantbeef> `strformat` and `strutils.%`
04:51:21FromDiscord<Hourglass [She/Her]> `cast[array[4, char]](toBigEndian(MAGIC))` shows `bnfk`, and `cast[array[4, char]](MAGIC)` shows `kfnb` so I'm stumped
04:51:53FromDiscord<Hourglass [She/Her]> `MAGIC.toBigEndian.fromBigEndian` also works as intended and shows `kfnb`
04:52:19FromDiscord<Elegantbeef> Show your code writing/reading
04:55:08FromDiscord<Hourglass [She/Her]> Alright
04:56:39FromDiscord<Hourglass [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4rQa
04:57:08FromDiscord<Elegantbeef> file streams exist
04:57:16FromDiscord<Hourglass [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4rQb
04:57:22FromDiscord<Hourglass [She/Her]> In reply to @Elegantbeef "*file streams exist*": Broken on Termux/my Nim install
04:57:42FromDiscord<Hourglass [She/Her]> Segfaults when writing bytes, for some reason
04:58:23FromDiscord<Hourglass [She/Her]> The opcode is an enum but I did `Label = 0.byte` and then defined the rest
04:59:09FromDiscord<Hourglass [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4rQc
05:01:27FromDiscord<Elegantbeef> Is the file you wrote what you expect
05:01:37FromDiscord<Elegantbeef> Pull up a hex editor and ensure it's what you expect
05:02:31FromDiscord<Hourglass [She/Her]> Yeah, it is
05:02:51FromDiscord<Elegantbeef> So then debug each step from file to big endian
05:02:52FromDiscord<Hourglass [She/Her]> First few bytes are `bnfk`, which is the magic number but in BE order
05:03:31FromDiscord<Hourglass [She/Her]> In reply to @Elegantbeef "So then debug each": Alright, I'll do that when I wake up then because I'm probably not making any progress like this lol
05:03:34FromDiscord<Hourglass [She/Her]> Gn everyone
05:12:34FromDiscord<Dale> sent a code paste, see https://play.nim-lang.org/#ix=4rQf
05:12:50FromDiscord<Dale> 0x20 is space
05:13:03FromDiscord<Dale> So all the control codes and whatnot below that are banned
05:13:58FromDiscord<Elegantbeef> Unicode space has entered the chat
05:14:00FromDiscord<Dale> Oh, ASCII FF is delete? I should ban that
05:14:19FromDiscord<Dale> There's a unicode space?!
05:14:31FromDiscord<Elegantbeef> Multiple
05:14:37FromDiscord<Elegantbeef> https://en.wikipedia.org/wiki/Whitespace_character
05:15:03FromDiscord<Dale> WHY OH WHY
05:15:08FromDiscord<Dale> I might just leave those in
05:15:30FromDiscord<Dale> Trust the programmer, 'cause y'know that worked out great for C :P
05:16:18FromDiscord<Elegantbeef> https://github.blog/changelog/2021-10-31-warning-about-bidirectional-unicode-text/ 😄
05:17:32FromDiscord<Dale> I have heard about this, things like malicious whitespace or bash that contains ninja unicode commands
05:18:09FromDiscord<Elegantbeef> Even homoglyphs
05:19:26FromDiscord<Dale> SO, what do you propose?
05:19:44FromDiscord<Dale> It seems easier to just allow alphanumeric
05:20:59FromDiscord<Elegantbeef> Oh i'm just bringing these responses up mostly in jest
05:21:06FromDiscord<Elegantbeef> Support what you want to disallow what you want
05:24:22FromDiscord<Dale> I'll just allow anything that isn't a control code or reserved I guess
05:24:24FromDiscord<Dale> See what happens
05:25:32FromDiscord<Dale> If you put those unicode whitespace things into your source and turn it into brainfuck then whatever
05:25:45FromDiscord<Dale> Actually there is a whitespace lang isn't there
05:26:06FromDiscord<Dale> https://en.wikipedia.org/wiki/Whitespace_%28programming_language%29
05:26:16FromDiscord<Dale> Imagine a UTF-8 expansion
05:26:27FromDiscord<Dale> The complexity would flourish
05:29:51FromDiscord<Dale> sent a code paste, see https://play.nim-lang.org/#ix=4rQi
05:50:47FromDiscord<Dale> UGH
05:50:52FromDiscord<Dale> There is a discardable pragma?!
05:51:00FromDiscord<Dale> So I can remove all these discard for this one func
06:02:41FromDiscord<Dudugz> Yup
06:02:51FromDiscord<Dudugz> {.discardable.}
06:03:31FromDiscord<Dudugz> And like ElegantBeef I think you shouldn't only allow characters you support, working with blacklist is harder than with whitelist
06:03:42FromDiscord<Dudugz> There are several unicode characters
06:03:59FromDiscord<Dudugz> (edit) "shouldn't" => "should"
06:04:39FromDiscord<Dudugz> For identifiers the best would be to support only letters of the Latin alphabet, numbers and ``_``
06:05:49FromDiscord<Dudugz> Later if you want you can try to add support for other alphabets too
06:06:16FromDiscord<firasuke> I am using the try except blocks to assign values to a variable, would it be possible to output a message as well, doing any functionality that doesn't return that value seems to not work for me
06:07:11FromDiscord<Dudugz> 🤔 try..except is to catch errors, is there anything unstable in your declarations?
06:07:33FromDiscord<firasuke> sent a code paste, see https://play.nim-lang.org/#ix=4rQo
06:07:58FromDiscord<firasuke> (edit) "https://play.nim-lang.org/#ix=4rQo" => "https://play.nim-lang.org/#ix=4rQp"
06:08:12FromDiscord<Dudugz> I think it makes sense, in which case you are bound to return an error
06:08:13FromDiscord<firasuke> Sorry about the indentation but I'm on mobile
06:08:21FromDiscord<Dudugz> (edit) "error" => "value"
06:08:40FromDiscord<firasuke> Well I want to assign the value and outout an ereor
06:08:56FromDiscord<firasuke> It is telling me that the echo doesn't return a value of type int to be assigned
06:09:14FromDiscord<Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4rQq
06:09:43FromDiscord<firasuke> Oh I see, don't define the variable
06:09:59FromDiscord<Dudugz> It's because what you're doing expects the expression to return some value, it's the same thing as a ternary operator
06:10:01FromDiscord<firasuke> What if I wanted it to exist but be empty or of another value and still outout
06:10:09FromDiscord<firasuke> In reply to @Dudugz "It's because what you're": Oh ok
06:10:15FromDiscord<Dudugz> = nil?
06:10:17FromDiscord<firasuke> What should I do then?
06:11:18FromDiscord<firasuke> sent a code paste, see https://play.nim-lang.org/#ix=4rQr
06:12:07FromDiscord<Dudugz> Yup
06:12:43FromDiscord<Dudugz> but again it makes no sense to have an error to declare a variable unless a proc is called
06:13:07FromDiscord<firasuke> Oh ok
06:13:14FromDiscord<firasuke> Flawed logic
06:13:16FromDiscord<Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4rQs
06:13:25FromDiscord<firasuke> Thanks
06:27:27FromDiscord<Phil> Exceptions/Errors are for exceptional, non standard control flow behaviour where failures aren't necessarily due to your own code (e.g. network request fails because no internet, bad input was given, database has bad data or the like). ↵If it is forseeable that you will have errors, you should ideally overthink your overall control flow, maybe introduce guard clauses if you can check ahead of time if that error will crop up under the given
06:31:34FromDiscord<Elegantbeef> IE `continue` if inside a loop, or a `break`, ....
06:31:35FromDiscord<Elegantbeef> the 0 branch can also be `return` a `raise` or any other definite flow
06:31:38FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4rQy
06:32:40FromDiscord<Dale> In reply to @Dudugz "Later if you want": The book I'm following presents two ways for making the interpreter. For this first one, I'm being more loose and experimental with it, so I'm not too fussed about unicode weirdness
06:34:14FromDiscord<Dudugz> Sure
06:34:27FromDiscord<Dale> I appreciate the advice though, thanks
06:34:53FromDiscord<Dale> Think I should stop now anyways, I've been at this for about 12 hours
06:50:09*arkurious quit (Quit: Leaving)
07:15:20*nanxiao joined #nim
07:18:42*kas quit (Quit: bbl)
07:22:06*nanxiao quit (Quit: Client closed)
07:22:14*rockcavera quit (Remote host closed the connection)
08:43:01FromDiscord<vmawz> Using httpclient.DownloadFile, can i get a jpeg file from url and save it as a png to a specific path?
08:59:07FromDiscord<Phil> I mean, it allows downloading files, though I've heard puppy often recommended for fetching things
08:59:36FromDiscord<Phil> I can't make any statement about the latter, that involves image manipulation that I have no knowledge about
09:03:04*nanxiao joined #nim
09:07:39FromDiscord<Dudugz> just remembering that changing the extension of an image does not change its format since who determines this are the headers of the image.
09:08:16FromDiscord<Dudugz> So changing a jpg file to a png doesn't make the image a png, it remains a jpg.
09:09:09FromDiscord<Dudugz> (edit) "So changing a jpg file ... to" added "ext" | removed "a"
09:13:05FromDiscord<Hourglass [She/Her]> Trying to implement GOTO statements is a pain
09:13:48FromDiscord<Hourglass [She/Her]> I could simply not implement them and instead have loops but...
09:31:16*ixmpp quit (Ping timeout: 276 seconds)
09:47:30*ixmpp joined #nim
09:50:49FromDiscord<laker31> How would I go about updating choosenim to a non-release version? i.e. I need this (https://github.com/dom96/choosenim/pull/301), otherwise I cannot use many modules on the M1
09:55:06FromDiscord<Phil> I can't say I have done so. First grasp would be to clone the repo, checkout the PR branch and run a "nimble install" in the main project directory while on that branch
09:55:13FromDiscord<Phil> (edit) "grasp" => "idea"
09:56:17FromDiscord<Phil> (edit) "so." => "so, so take that with a grain of salt."
10:04:16*kenran joined #nim
10:11:39*nanxiao quit (Quit: Client closed)
10:17:25FromDiscord<QuiteQuietQ> In reply to @Hourglass, When the Hour Strikes "Trying to implement GOTO": With line numbers it gets easy
10:17:49*nanxiao joined #nim
10:18:34FromDiscord<Hourglass [She/Her]> I'm using character positions from source code
10:18:56FromDiscord<Hourglass [She/Her]> And it's my first time trying to make a VM, making one for BrainFuck :p
10:22:46*nanxiao quit (Quit: Client closed)
10:28:24FromDiscord<Hourglass [She/Her]> Yeah, screw gotos
10:28:31FromDiscord<Hourglass [She/Her]> Will try doing it later probably
10:32:47*derpydoo joined #nim
11:30:28*xet7 quit (Read error: Connection reset by peer)
11:33:22*kenran quit (Remote host closed the connection)
11:39:15*nanxiao joined #nim
11:44:27*nanxiao quit (Quit: Client closed)
11:55:21FromDiscord<faldor20> sent a code paste, see https://paste.rs/KED
11:56:13*jmdaemon quit (Ping timeout: 276 seconds)
11:57:01FromDiscord<planetis> In reply to @faldor20 "Hey, I'm new to": change the first item to 0x00'i8
11:57:22FromDiscord<Recruit_main707> add u8 the first element in the array
11:57:58FromDiscord<planetis> yea u8 not i8
11:58:43FromDiscord<Recruit_main707> or be explicit when declaring it:↵`var ssdblablabla: array[ X, uint8] = [..., ....]`
11:58:47FromDiscord<faldor20> oh... well that was easy
11:59:02FromDiscord<faldor20> I tried that just has an error
11:59:28FromDiscord<faldor20> (edit) "that" => "the explicit approach first"
11:59:36FromDiscord<faldor20> (edit) "first" => "first,"
12:00:02FromDiscord<Recruit_main707> probably not specifing the correct number of elements, but both ways work
12:00:53FromDiscord<Recruit_main707> actually, does it?
12:00:58FromDiscord<faldor20> no
12:01:18FromDiscord<faldor20> It doesn't 😅 ↵I did ensure it was the right number
13:09:33FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4rS4
13:10:05FromDiscord<ringabout> consts have some issues with type inference.
13:29:59FromDiscord<Recruit_main707> so that was the issue, i could swear it worked, i rarely used constants
13:35:09FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4rS7
13:35:29FromDiscord<Phil> Maybe one of those doesn't work on the current stable version ? (I'm on devel)
14:10:41FromDiscord<faldor20> sent a code paste, see https://play.nim-lang.org/#ix=4rSh
14:22:45FromDiscord<Phil> In reply to @faldor20 "on my nim": Hmmm seems like devel improves a bit on inferring datatypes like here.
14:55:46*Notxor joined #nim
15:25:05FromDiscord<Recruit_main707> maybe because he is using 0x00 instead of plain numbers?
15:31:54FromDiscord<Rika> i doubt that
15:56:28*arkurious joined #nim
16:04:18*beholders_eye joined #nim
16:12:39*rockcavera joined #nim
16:27:54*beholders_eye quit (Ping timeout: 250 seconds)
16:39:31NimEventerNew Nimble package! lv2 - Nim bindings for LV2, see https://gitlab.com/lpirl/lv2-nim
16:41:02FromDiscord<Rika> wait as in the audio plugin shit? cool
16:43:48*beholders_eye joined #nim
16:44:33FromDiscord<starkiller> sent a code paste, see https://play.nim-lang.org/#ix=4rT4
16:46:27FromDiscord<Gumbercules> Because enum members don't need to be fully qualified
16:46:40FromDiscord<Gumbercules> Unless you tag them with a pure pragma
16:49:31FromDiscord<starkiller> I thought pure was for referring to enum values without naming the enum (just Bar instead of Foo1.Bar)
16:49:49FromDiscord<starkiller> (edit) removed ""
16:50:37FromDiscord<starkiller> So it's the opposite?
16:50:47FromDiscord<Gumbercules> Right and without that you have enum member collisions
16:51:26FromDiscord<Gumbercules> How will the compiler know if when you type Bar you're referring to Foo1 or Foo2?
16:52:04FromDiscord<Gumbercules> This is why folks prefixing enum members with some abbreviation
16:52:16FromDiscord<Gumbercules> Like f1Bar and f2Bar
16:52:30FromDiscord<Rika> I believe pure doesn’t do anything nowadays
16:52:52FromDiscord<Rika> Not very sure though, I just heard about something like that being so
16:52:54FromDiscord<starkiller> In reply to @Rika "I believe pure doesn’t": it does
16:53:09FromDiscord<starkiller> (edit) "does" => "does, i just tried it"
16:54:38FromDiscord<starkiller> In reply to @Gumbercules "This is why folks": imo doing Foo1.Bar is more clear than f1Bar
16:54:51FromDiscord<Gumbercules> Whatever you prefer
16:55:16FromDiscord<starkiller> yeah, thanks for clearing that up
16:55:22FromDiscord<Gumbercules> 💯
17:06:51*xet7 joined #nim
17:24:07FromDiscord<Yardanico> In reply to @Rika "I believe pure doesn’t": yes you're right
17:24:13FromDiscord<Yardanico> In reply to @Gumbercules "How will the compiler": it actually knows nowadays
17:24:46FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4rTu
17:25:13FromDiscord<Yardanico> of course this is specific to placed where you are passing the enum to somewhere like a proc
17:25:16FromDiscord<Yardanico> (edit) "placed" => "places"
17:26:07FromDiscord<Dale> I've found the nim compiler to very good at disambiguation
17:26:17FromDiscord<Dale> (edit) "I've found the nim compiler to ... very" added "be"
17:26:19FromDiscord<qb> I'm trying to parse the output from wmctrl (actually just the pid and the window title). Behind the pid could be more or less whitespaces which gives me trouble to use `split`. I actually don't want to use anything else than strutils. Any Idea? https://play.nim-lang.org/#ix=4rTp
17:26:57FromDiscord<Dale> Isn't there trim procs?
17:26:58FromDiscord<Yardanico> In reply to @qb "I'm trying to parse": strscans, not sure why you're so keen on only using strutils
17:27:08FromDiscord<Yardanico> imo using split here is uglier than using strscans (which just uses parseutils)
17:27:56FromDiscord<Dale> Oh yeah, strscans is pattern matching, looks perfect
17:32:08FromDiscord<Yardanico> ah actually hm, strscans might have a problem in your case too
17:32:59FromDiscord<Yardanico> ah this works
17:33:05FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4rTD
17:33:06FromDiscord<Yardanico> $s is optional whitespace
17:33:46FromDiscord<Yardanico> strscans compiles the pattern string into a series of parseutils proc calls, so it's not like regexes
17:33:52FromDiscord<qb> I've tried strscans also but failed. And what I don't get about strscans is how I could skip matches. Like I don't want to assign all matches to a variable
17:34:35FromDiscord<Yardanico> not sure what you mean? you assign it to a temporary variable first, and then if it's all good you add the data to your own variables
17:35:26FromDiscord<qb> Like how would the pattern look like if you want to do `let (ok, pid, title)`
17:35:28FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4rTF
17:36:33FromDiscord<Yardanico> I don't think you can do that, but you can just not assign variables you don't like
17:36:40FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4rTG
17:36:58FromDiscord<Yardanico> also maybe later you'd just rewrite this to interface with X directly (nim has a binding lib) to not depend on wmctrl
17:37:23*beholders_eye quit (Ping timeout: 264 seconds)
17:38:41FromDiscord<qb> Well that helps already thank you. I want to find a window title by the pid. I didn't found a good x way. And I don't think any `/proc/pid/` file has some useful window information
17:38:54FromDiscord<qb> not sure how wmctrl does it 😄
17:40:29FromDiscord<Yardanico> In reply to @qb "not sure how wmctrl": https://media.discordapp.net/attachments/371759389889003532/1089604799667900486/image.png
17:40:39FromDiscord<Yardanico> <https://unix.stackexchange.com/questions/5478/what-process-created-this-x11-window> seems to suggest the same, but says that it's not 100% reliable
17:42:19FromDiscord<huantian> Yeah, that’s what I’ve used in tbe past for finding by pid, just go through windows recursively and check that property
18:08:03*beholders_eye joined #nim
18:16:01*derpydoo quit (Ping timeout: 240 seconds)
18:18:19*kenran joined #nim
18:34:39NimEventerNew thread by Angluca: Must add array quick assignment init method , see https://forum.nim-lang.org/t/10037
18:34:41NimEventerNew Nimble package! nimitheme - make nimib look beautiful with nimitheme, see https://neroist.github.io/nimitheme/index.html
18:36:54*jmdaemon joined #nim
18:46:03FromDiscord<Phil> In reply to @NimEventer "New Nimble package! nimitheme": @pietroppeter the package above could be interesting for you just because
18:46:16FromDiscord<Phil> (edit) "interesting" => "cool to see"
18:57:47FromDiscord<Rexford> .nimble/pkgs/nimassimp-0.1.2/assimp.nim(25, 8) Error: cannot open file: unsigned ↵↵Does anyone has a suggestion on how to fix this unsigned error
19:01:28FromDiscord<Diogenes of Toronto> how do i publish a nimble package?
19:01:44FromDiscord<Elegantbeef> make a pr to nim-lang/packages
19:01:56FromDiscord<sabrus> Hi,↵how can i check a json file by jsonschema file in Nim ? is where are stable package for it?
19:02:09FromDiscord<Diogenes of Toronto> In reply to @Elegantbeef "make a pr to": oh shit its that easy
19:06:22FromDiscord<Elegantbeef> Well yea nimble is a decentralised package manager, so technically even if your package isnt on the registry it's already published 😄
19:07:00FromDiscord<Phil> In reply to @Diogenes of Toronto "how do i publish": You can make it even easier, there's a nimble command to automatically do it for you called "nimble publish"
19:07:30FromDiscord<Phil> That one requires you to provide a GH token so that it can create the PR from you from the account that the token is for
19:07:52FromDiscord<Diogenes of Toronto> Oh sick
19:08:15FromDiscord<sOkam!> In reply to @Isofruit "You can make it": that is sure handy ✍️
19:24:14FromDiscord<pietroppeter> In reply to @Isofruit "<@588390287810887693> the package above": Oh I have seen that’s great 😃 neroist has been doing great work on nimib itself recently!
19:28:43*kenran quit (Remote host closed the connection)
19:42:03FromDiscord<Verdagon> hey yall, i heard a while ago that nim might be switching from nonatomic RC to atomic RC, is that still the case?
19:42:25FromDiscord<Verdagon> i think ive finally succeeded making a prototype of something that perhaps might factor into that decision
19:43:13FromDiscord<Elegantbeef> I do not think Araq has ever said that
19:43:25FromDiscord<Verdagon> aye it was someone else in this server
19:43:32FromDiscord<Verdagon> ill search back, maybe i misunderstood
19:44:18FromDiscord<Elegantbeef> https://forum.nim-lang.org/t/9646#63380
19:45:26FromDiscord<Verdagon> In reply to @leorize "nim is moving away": there it is ^
19:45:59FromDiscord<Elegantbeef> > i was delighted to hear that nim has shared-nothing heaps
19:46:06FromDiscord<Elegantbeef> That was in response to share nothing heaps
19:46:11FromDiscord<Elegantbeef> Arc/Orc share heaps
19:47:29FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4rUj
19:47:50FromDiscord<Verdagon> i see! somehow i (still) conflate shared-nothing with nonatomic
19:48:03FromDiscord<Elegantbeef> Simple example but yea point is shared heap, as i'm sure you know the implications
19:48:26FromDiscord<Verdagon> so nim has shared heap, but still nonatomic?
19:48:37FromDiscord<Elegantbeef> Indeed the ref count is not atomic
19:48:52FromDiscord<Elegantbeef> One can use the `SharedPtr` not too disimilar from C++ for atomic ref counting
19:49:07FromDiscord<Verdagon> got it, that helps a bit
19:49:32FromDiscord<Elegantbeef> https://github.com/nim-lang/threading is the 'future' of nim threading
19:51:00FromDiscord<jmgomez> In reply to @Elegantbeef "https://github.com/nim-lang/threading is the 'futur": Do you know if it will ship with 2?
19:51:21FromDiscord<Elegantbeef> How many times do i have to say I have no more insight than you? 😄
19:54:53*fallback joined #nim
19:55:05FromDiscord<Elegantbeef> Like i said yesterday though i sure hope not, much more tedious to have a library in the stdlib
19:55:19FromDiscord<Elegantbeef> Though i do not use multi threading ever, so why do i care?!
19:56:02FromDiscord<jmgomez> I bet you do have more insight 😛
19:56:29FromDiscord<Elegantbeef> I only have the same information at my disposal as you do!
19:56:45FromDiscord<jmgomez> In reply to @Elegantbeef "Though i do not": just for the sake of knowing, arent you beefGpt?
19:57:14FromDiscord<Elegantbeef> I'm GptVeganBeef
19:57:29FromDiscord<jmgomez> well, to be fair you have being around way longer than me
19:57:44*Notxor quit (Remote host closed the connection)
19:58:27FromDiscord<Yepoleb> In reply to @jmgomez "Do you know if": it's not on the roadmap https://github.com/nim-lang/RFCs/issues/503
19:59:05FromDiscord<Yepoleb> also for inside info ask ringabout
19:59:05FromDiscord<Elegantbeef> Not like the roadmap is the most pure form of what will be worked on 😄
19:59:33FromDiscord<Ayy Lmao> Is it possible to check at compile time if a function exists?
20:00:37FromDiscord<jmgomez> In reply to @Ayy Lmao "Is it possible to": `compiles`?
20:00:53FromDiscord<Elegantbeef> `declared`
20:00:56FromDiscord<Elegantbeef> or `compiles(myProc(args))`
20:01:23FromDiscord<Ayy Lmao> `compiles` seems to work, thanks!
20:03:39*Notxor joined #nim
20:04:18FromDiscord<Elegantbeef> @Verdagon does this insight mean that we can expect another blog post? 😛
20:05:07*cornfeedhobo left #nim (when i leave, come together like butt cheeks)
20:05:08FromDiscord<Elegantbeef> to that end it's a bit of a shame you didnt mention Nim's Orc when talking about cyclical ref count in your last post
20:05:24FromDiscord<Verdagon> hopefully!
20:05:31FromDiscord<Verdagon> last post... which one was that
20:05:38FromDiscord<Verdagon> the dev velocity one?
20:05:46FromDiscord<Elegantbeef> Yea
20:06:12FromDiscord<Elegantbeef> > It does have one drawback\: any cycle of references pointing at each other could cause a memory leak, wasting the available memory. This can be largely mitigated with good tooling that detects these cycles in development.↵No reference of Nim doing just that 😄
20:06:17FromDiscord<Verdagon> looks like i mentioned nim, and one of the main conclusions was that RC/GC'd languages were best for dev velocity
20:06:39FromDiscord<Verdagon> i admit, im not super familiar with how nim works
20:06:52FromDiscord<Verdagon> isnt ORC a performance improvement? i didnt know it detected cycles as well
20:07:03FromDiscord<Elegantbeef> Nim's orc is a deterministic RC with a cycle collector
20:07:04FromDiscord<Verdagon> doesnt nim have a backup cycle collector?
20:07:31FromDiscord<Verdagon> does it report cycles, or just clean them up?
20:07:36FromDiscord<Elegantbeef> So it detects possible cyclic types at compile time and has the mark and sweep handle them when it needs to
20:07:36FromDiscord<Verdagon> i always assumed it just cleaned them up
20:07:45FromDiscord<Verdagon> iirc swift can detect cycles in dev mode and report them
20:08:00FromDiscord<Elegantbeef> Araq was somewhat interested in using the same algorithim to detect them for arc
20:08:18FromDiscord<Verdagon> In reply to @Elegantbeef "So it detects possible": wait tell me more about this
20:08:29FromDiscord<Verdagon> you mean like, cyclic definitions such as in a doubly linked list?
20:08:35FromDiscord<Elegantbeef> It's not like it's that complicated to turn a cycle collector into a cycle checker
20:08:38FromDiscord<Elegantbeef> Yea
20:08:42FromDiscord<Verdagon> how does that work in the presence of open interfaces where we dont know what they might contain?
20:08:52FromDiscord<Elegantbeef> Nim actually has the `{.acyclic.}` pragma to disable cycle collector for specific types
20:08:59FromDiscord<Elegantbeef> Open interfaces like what?
20:09:13FromDiscord<Verdagon> er sorry, non-`sealed` interfaces (to use scala terminology)
20:09:25FromDiscord<Verdagon> im not sure if nim has an open/sealed distinction
20:09:45FromDiscord<Elegantbeef> Given I've only written C# and Nim, you're barking up the wrong tree 😛
20:10:04FromDiscord<Verdagon> pretend i just said "interfaces"
20:10:18FromDiscord<Elegantbeef> Ah Nim does not have runtime interfaces
20:10:41FromDiscord<Verdagon> traits then?
20:11:12FromDiscord<Elegantbeef> Nah the closest it has built in is single parent inheritance
20:11:20FromDiscord<Verdagon> ah, okay good
20:11:27FromDiscord<Elegantbeef> Which I imagine forces the cycle collector on
20:11:37FromDiscord<Verdagon> a language without run-time polymorphism would be crazy
20:11:45FromDiscord<Verdagon> zig goes without it, which still kinda blows my mind
20:11:55FromDiscord<Verdagon> (though its also the reason they can do colorless concurrency, so maybe not so crazy)
20:12:24FromDiscord<Verdagon> thats pretty interesting that nim can know via type system where it would need to look for cycles
20:12:37FromDiscord<Verdagon> ive never heard of that, i assume nim's the first?
20:13:02FromDiscord<Elegantbeef> I do not know that, but looking around I do not see a RC + cycle collector only for cyclical types
20:16:14FromDiscord<jmgomez> In reply to @Elegantbeef "Given I've only written": what do you use C# for?
20:16:25FromDiscord<Verdagon> im adding a side note to that last article: "Nim has a particularly fascinating approach here: it only runs its backup cycle collector for types that could possibly be cyclic." (rewording welcome!)
20:18:47FromDiscord<Elegantbeef> The obvious benefit of Orc being that you get that nice and fast deterministic gc for most types, but when you have a cyclic graph you do not have any leaks or awful UX it's just cyclical references that are freed 😄
20:18:48FromDiscord<Elegantbeef> Plus you still get destructors and move hooks in that same environment
20:18:48FromDiscord<Elegantbeef> There is no enforcement of this presently, but araq didnt seem opposed to turning the cycle collector into a cycle detector
20:18:50FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4rUt
20:21:07FromDiscord<ElegantBeef> Nice matrix bridge slowed down a lot
20:21:20FromDiscord<Verdagon> "Nim has a particularly fascinating approach here: it only runs its backup cycle collector for types that could possibly be cyclic. This helps ensure faster deterministic cleanup, and lets us use destructors too."
20:21:21FromDiscord<ElegantBeef> Just to be faster than the bridge https://media.discordapp.net/attachments/371759389889003532/1089645285086601306/image.png
20:21:45FromDiscord<Verdagon> does this also have implications for systems programming and knowing we wont have unbounded heap usage?
20:22:02FromDiscord<ElegantBeef> Most embedded work uses Arc
20:22:19FromDiscord<Elegantbeef> I started programming in Unity using C#
20:22:19FromDiscord<Elegantbeef> I do not use C# anymore
20:22:19FromDiscord<Elegantbeef> I do not know if i'd call it a "backup" myself
20:22:20FromDiscord<Elegantbeef> If you statically know that a graph can be cyclic is it really a backup to treat it that way?
20:22:25FromDiscord<ElegantBeef> Lol the bridge can be fickle
20:22:27FromDiscord<jmgomez> That's interesting that you only used Nim and C#, how long ago was that?
20:22:32FromDiscord<Verdagon> there they are! lol
20:22:43FromDiscord<ElegantBeef> Damn that bot types fast
20:23:02FromDiscord<ElegantBeef> I started with Nim in 2020 after going "You know i want to learn a system language"
20:23:16FromDiscord<ElegantBeef> And now i've drank the kool-aid too much and do not want to use anything else
20:23:29FromDiscord<Verdagon> means its a good language ;)
20:23:49FromDiscord<ElegantBeef> Perhaps or I'm an idiot 😄
20:24:11FromDiscord<jmgomez> Have to say that you know quite a bit for someone that only used two langs in its live. What a shame that you dont use commercial engine anymore, NUE could benefit 😛
20:24:20*fallback quit (Read error: Connection reset by peer)
20:25:37FromDiscord<ElegantBeef> Well i've briefly written JS, Python, C, C++
20:25:53FromDiscord<ElegantBeef> I guess i've also written GLSL and CG, but that's not much
20:26:44FromDiscord<ElegantBeef> Well picking up Nim was quite great overall for me, self directed learning system programming is a magical thing
20:27:25FromDiscord<ElegantBeef> Comically the first thing i tried to write in Nim was a basic ECS... it was full of heap based inheritance and references
20:27:40FromDiscord<ElegantBeef> My toy ecs I made recently with very few macros is much much smarter 😄
20:27:47FromDiscord<Verdagon> (just added the note https://verdagon.dev/blog/when-to-use-memory-safe-part-2#note31, thanks @ElegantBeef!)
20:28:35FromDiscord<ElegantBeef> No problem, though I still do not know about the term backup 😛
20:28:57FromDiscord<Verdagon> oh, i see what you meant above now
20:29:14FromDiscord<Verdagon> yeah, its not really a backup if we know at compile time itll never be needed for a certain type
20:29:20FromDiscord<Verdagon> ill take that word out
20:30:50FromDiscord<ElegantBeef> Swift doesnt have move semantics does it?
20:31:00FromDiscord<jmgomez> In reply to @ElegantBeef "Well picking up Nim": Yeah, I feel that. Also nothing like getting your hands dirty to learn stuff. I feel like I improved quite a bit since I started NUE last year, the fact that you are pretty much on your own in Nim makes you revisit fundamentals, and as in every other skill, they are the building blocks to be mastered
20:31:25FromDiscord<ElegantBeef> See i just attribute it to using a system language
20:31:54FromDiscord<ElegantBeef> I imagine you gain the same knowledge and skills regardless what you use since the same problems arise just painted in a different colour
20:32:15FromDiscord<jmgomez> Not sure, I did quite a bit of cpp in the context of UE before (almost two years) and didnt grown that much
20:32:34FromDiscord<ElegantBeef> UE C++ is practically bad C#
20:33:29FromDiscord<jmgomez> Well, I like it to see it as regular C++ with some questionable goodies
20:34:10FromDiscord<ElegantBeef> My point is sorta that it's quite distant from normal C++, but I guess most people that use C++ do not use it bare and use it with like QT, Boost or similar stdlib
20:35:09FromDiscord<jmgomez> Yeah, but that only applies to UClasses and that sort of reflected stuff. And if you want to understand what's going on the trip is way longer than regular C++ which is not a good trait
20:36:32FromDiscord<Nilts> I have two questions:↵1. How do i make a static c library in nim↵2. How do i do basic c codegen in nim, i am making a compiler
20:37:41FromDiscord<ElegantBeef> "static c library"
20:38:00FromDiscord<ElegantBeef> `--app:staticlib` gives you a static library
20:38:18FromDiscord<ElegantBeef> "basic c codegen"
20:38:21FromDiscord<ElegantBeef> What does that mean
20:38:29FromDiscord<Nilts> Code to help you make code
20:38:48FromDiscord<Nilts> or do I just use abunch of formatted strings
20:39:14FromDiscord<Nilts> In reply to @ElegantBeef "What does that mean": How does nim generate code to pass to the c compiler?
20:39:38FromDiscord<ElegantBeef> It uses multiple files prefixed with cgen you can read on the github repo
20:40:09FromDiscord<ElegantBeef> I do have a dumb C header generator that is much more simple https://gitlab.com/beef331/seeya/-/blob/main/src/seeya.nim
20:40:19FromDiscord<Elegantbeef> Hmm this seems to work fine now
20:41:23FromDiscord<Nilts> In reply to @ElegantBeef "I do have a": why is it on gitlab and is it just the file or the whole package.
20:42:08FromDiscord<Elegantbeef> It's on gitlab cause I was considering using gitlab instead of github
20:42:47FromDiscord<Nilts> and i found the file in the compiler: https://github.com/nim-lang/Nim/blob/devel/compiler/cgen.nim
20:43:01FromDiscord<Elegantbeef> That's one part
20:43:11FromDiscord<Elegantbeef> like i said all files prefixed cgen are used for C generation
20:44:03FromDiscord<Nilts> seems to complicated XD
20:44:08FromDiscord<Nilts> how do i use your lib
20:44:46FromDiscord<Elegantbeef> It's not a lib
20:44:58FromDiscord<Nilts> what is it
20:45:14FromDiscord<Elegantbeef> It's a proof of concept program that compiles a Nim program to a C Header based of `exportC` procedures and types
20:45:40FromDiscord<Nilts> oh, so that is for my first quesion
20:45:42FromDiscord<Elegantbeef> https://gitlab.com/beef331/seeya/-/blob/main/tests/basicproc.nim↵generates↵https://gitlab.com/beef331/seeya/-/blob/main/tests/testlib.h
20:45:46FromDiscord<Nilts> (edit) "quesion" => "question"
20:45:53FromDiscord<Elegantbeef> No
20:45:58FromDiscord<Elegantbeef> You asked how to do C code gen
20:46:00FromDiscord<Elegantbeef> I provided an example of how
20:46:25FromDiscord<Nilts> In reply to @Elegantbeef "You asked how to": Oh, like how your lib does it
20:46:27FromDiscord<Nilts> ok
20:46:31FromDiscord<Nilts> let me look
20:46:50FromDiscord<Nilts> what is the license btw
20:47:11FromDiscord<Elegantbeef> We'll say MIT
20:48:14FromDiscord<Nilts> it looks just as confusing as the nim compiler :(
20:50:19FromDiscord<Elegantbeef> Turns out code generation is complex
20:50:46FromDiscord<Nilts> what will happen if i use formatted strings?
20:51:04FromDiscord<Elegantbeef> What happens if you do not generate valid C code?
20:51:07FromDiscord<Nilts> lol, i just wanted to like build a syntax tree and have code be made
20:51:14FromDiscord<Nilts> In reply to @Elegantbeef "What happens if you": idk\
20:51:51FromDiscord<Dale> Regarding gitlab, is their projects tool any good?
20:52:24FromDiscord<Dale> Last time I tried it it didn't really square up to the github one, and their kanban/matrix view is so good, it's the only thing keeping me on the platform
20:56:28FromDiscord<Yardanico> olala, nim-regex fails on devel
20:56:46FromDiscord<Yardanico> was using my nim pgo script again and nim-regex failed to compile, let's see
20:59:19FromDiscord<Yardanico> @beef do you remember if this got changed in devel any time recently? https://play.nim-lang.org/#ix=4rUB
20:59:27FromDiscord<Yardanico> basically implicit hslice -> slice conversion
20:59:33*junaid_ joined #nim
21:00:39FromDiscord<Yardanico> @ringabout if you have time please check too, I guess it should be an easy fix in nim-regex code, but would be nice to check if it's a compiler bug or not
21:01:44FromDiscord<Yardanico> ah wait the problem might be different
21:02:06FromDiscord<Yardanico> yeah my bad, it's because the size of array is 0 for some reason in nim-regex code
21:02:27FromDiscord<Diogenes of Toronto> In reply to @Elegantbeef "https://gitlab.com/beef331/seeya/-/blob/main/tests/": Do you have a similar zig example?
21:02:43FromDiscord<Elegantbeef> Why would i have a zig example
21:03:37FromDiscord<Diogenes of Toronto> Curious if someone built a nim to zig version
21:05:12FromDiscord<Elegantbeef> I mean it's the same thing just replace with zig types
21:05:23FromDiscord<Elegantbeef> But why does it matter? Zig can import C code directly
21:06:44*junaid_ quit (Remote host closed the connection)
21:08:12FromDiscord<Diogenes of Toronto> hmm that is true
21:14:19*Notxor quit (Remote host closed the connection)
21:26:17*xet7 quit (Remote host closed the connection)
21:27:48*xet7 joined #nim
21:34:31FromDiscord<Nilts> anyone have a basic nim sdl2 example?
21:36:12*beholders_eye quit (Quit: WeeChat 3.6)
21:38:15FromDiscord<Yardanico> <https://github.com/nim-lang/sdl2/blob/master/examples/pong.nim>
21:38:31FromDiscord<Yardanico> <https://github.com/Vladar4/sdl2_nim/tree/master/examples> another sdl2 lib
21:39:57FromDiscord<Takemichi Hanagaki> Is there any performance difference between `if/else` and `case/of`?
21:41:56FromDiscord<Nilts> In reply to @Yardanico "<https://github.com/nim-lang/sdl2/blob/master/examp": How would I set the fps?
21:42:25FromDiscord<Nilts> and i thought there was a builtin event loop thing
21:57:32FromDiscord<Yardanico> In reply to @not logged in "How would I set": not sure, haven't really used it myself
21:57:38FromDiscord<Elegantbeef> The C compiler might be able to handle case statements better, but likely nope↵(@Takemichi Hanagaki)
21:57:42FromDiscord<Yardanico> @ElegantBeef found the cause
21:57:48FromDiscord<Yardanico> it's to do with int type
21:57:54FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4rUX
21:57:55FromDiscord<Yardanico> the error is totally unclear btw
21:58:25FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/1089669716043386880/image.png
21:58:33FromDiscord<Takemichi Hanagaki> In reply to @Elegantbeef "The C compiler might": Thanks!!
22:11:05FromDiscord<Nilts> I get endless errors from gcc after trying to compile a c program which imports a nim lib compiled with --app:staticlib
22:11:48FromDiscord<Elegantbeef> Did you properly import and link the library?
22:11:54FromDiscord<Yardanico> https://nim-lang.org/docs/backends.html#interfacing-nim-code-calling-the-backend
22:12:13FromDiscord<Elegantbeef> Otherway around yard
22:12:15FromDiscord<Yardanico> although it shows using a nim static lib from nim itself
22:12:16FromDiscord<Yardanico> yeah
22:12:23FromDiscord<Nilts> In reply to @Elegantbeef "Did you properly import": probably not
22:12:38FromDiscord<Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4rV6
22:12:39FromDiscord<Nilts> is how i imported
22:12:42FromDiscord<Yardanico> ..
22:12:45FromDiscord<Elegantbeef> You do not include static libraries that way
22:12:47FromDiscord<Elegantbeef> Lol
22:12:52FromDiscord<Yardanico> is there a usecase for you to use C?
22:12:54FromDiscord<Elegantbeef> "How to use static libraries C"
22:13:09FromDiscord<Yardanico> at least in the context of Nim
22:13:27FromDiscord<Nilts> In reply to @Yardanico "is there a usecase": just toying around
22:13:39FromDiscord<Nilts> and emscripten does not work with nim
22:13:39FromDiscord<Yardanico> well as beef said, you'd have to know how to use static libraries in C first
22:13:42FromDiscord<Yardanico> it does
22:14:05FromDiscord<Yardanico> <https://hookrace.net/nimes/> does that not look "working" enough for you :)
22:14:09FromDiscord<Nilts> not the one from treeform's tutorial. It gives lots of errors
22:14:21FromDiscord<Elegantbeef> "I do not know how tools work and blame them"
22:14:31FromDiscord<Yardanico> generally there are not a lot of detailed step-by-step instructions for doing things with Nim
22:14:35FromDiscord<Nilts> In reply to @Elegantbeef ""I do not know": yes
22:14:38FromDiscord<Yardanico> in a lot of cases you need to figure some stuff out by yourself
22:14:49FromDiscord<Elegantbeef> Emscripten works fine for Nim
22:14:51FromDiscord<Yardanico> that's the issue of having a small userbase
22:14:55FromDiscord<Elegantbeef> I use it for my wasm interop
22:15:05FromDiscord<Elegantbeef> I also know someone uses raw clang to generate wasm from Nim
22:15:22FromDiscord<Yardanico> but with emscripten + sdl2 it's usually just as simple as passing the right compiler flags <https://github.com/def-/nimes/blob/master/src/nim.cfg>
22:15:36FromDiscord<Yardanico> just pass gc: orc instead of gc: none here btw, orc works fine with emscripten
22:15:38FromDiscord<Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4rVa
22:16:02FromDiscord<Elegantbeef> https://forum.nim-lang.org/t/10000 elcritch claimed post 10000 😄
22:16:09FromDiscord<Yardanico> and where's the error message itself?
22:16:18FromDiscord<Elegantbeef> So you went "I need a static library" instead of "Emscripten no main"
22:16:27FromDiscord<Yardanico> also this isn't the complete config
22:16:31FromDiscord<Nilts> In reply to @Elegantbeef "So you went "I": yes
22:16:38FromDiscord<Elegantbeef> https://github.com/beef331/wasm3/blob/master/wasmsources/maths.nim is compiled with https://github.com/beef331/wasm3/blob/master/wasmsources/config.nims just fine
22:16:45*fallback joined #nim
22:17:00FromDiscord<Elegantbeef> I swear some people do not know search engines exist
22:17:42FromDiscord<Nilts> In reply to @Elegantbeef "https://github.com/beef331/wasm3/blob/master/wasmso": there is a library for this?
22:17:52FromDiscord<Yardanico> it's not for making games though
22:18:00FromDiscord<Yardanico> err, it can be used for this
22:18:09FromDiscord<Yardanico> but the primary use-case is quite different
22:18:44FromDiscord<Nilts> In reply to @Yardanico "it's not for making": wasm or the lib
22:18:53FromDiscord<Yardanico> the beef's library
22:18:59FromDiscord<Nilts> ah ok
22:19:02FromDiscord<Elegantbeef> "the beef" i'm a fucking human
22:19:13FromDiscord<Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4rVb
22:19:18FromDiscord<Nilts> In reply to @Elegantbeef ""the beef" i'm a": I always thought you were a dog
22:19:24FromDiscord<Elegantbeef> Lol it told you how to fix it and you ignored it
22:19:29FromDiscord<Nilts> because of the pfp
22:19:40FromDiscord<Nilts> In reply to @Elegantbeef "Lol it told you": not ignored, missed it.
22:19:47FromDiscord<Nilts> or did not recognize
22:20:35FromDiscord<Nilts> anyways, i think i found it
22:21:06FromDiscord<Elegantbeef> To be fair it's less of a library and more of just wasm3 bindings with nim features↵(@Yardanico)
22:21:23FromDiscord<Nilts> PermissionError: [Errno 13] Permission denied: '/nix/store/fif8p12nknb7cw8ffbxbsbrhr2gml3v4-emscripten-3.1.17/share/emscripten/cache/build/crt1_reactor'
22:22:21FromDiscord<Elegantbeef> This is why you do not use nix kids
22:22:35FromDiscord<Nilts> well how do i fix
22:22:53FromDiscord<Elegantbeef> Do i sound like i use nix?
22:23:07FromDiscord<Nilts> 100%
22:45:38*fallback quit (Read error: Connection reset by peer)
23:21:16FromDiscord<firasuke> what is the default hashing algorithm that nim uses? is it still wyhash?
23:21:33FromDiscord<firasuke> is it available in `hashes`?
23:35:26FromDiscord<firasuke> I need a fast hashing algorithm that verifies the integrity of downloaded files