<< 07-08-2022 >>

00:33:56NimEventerNew thread by Icedquinn: Math library for renderers and GUIs, see https://forum.nim-lang.org/t/9353
00:37:08FromDiscord<Nerve> sent a long message, see http://ix.io/46RA
00:37:17FromDiscord<Nerve> (edit) "long message," => "code paste," | "http://ix.io/46RA" => "https://play.nim-lang.org/#ix=46RB"
00:37:26FromDiscord<Elegantbeef> They're iterators
00:37:30FromDiscord<Nerve> (edit) "https://play.nim-lang.org/#ix=46RB" => "https://play.nim-lang.org/#ix=46RC"
00:38:02FromDiscord<Nerve> Okay, I guess I'd have to resolve them into sequences, but why am I getting undeclared field?
00:38:19FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46RD
00:38:24FromDiscord<Elegantbeef> Cause iterators are only considered in a few cases
00:38:51FromDiscord<Elegantbeef> iterators are considered inside `typeof`, when the argument is `iterable` and inside for loops
00:39:05FromDiscord<Nerve> So the iterator effectively doesn't exist unless you use it in a special form that handles the iterator?
00:39:23FromDiscord<Elegantbeef> Inlined iterators are templates basically so correct
00:39:42FromDiscord<Nerve> Is there a quick way to resolve an iterator into a list or sequence?
00:39:52FromDiscord<Elegantbeef> `setutils.toSeq`
00:39:58FromDiscord<Elegantbeef> `sequtils`\
00:40:01FromDiscord<Nerve> Thanks, let me try it
00:40:12FromDiscord<Elegantbeef> Generally though it's best to avoid that though
00:40:32FromDiscord<Elegantbeef> Unless you want a collection of your values it's not great for performance(if you care)
00:40:58FromDiscord<Nerve> I'm learning and converting right now, I'll get to idiomatic golfing later
00:41:01FromDiscord<Elegantbeef> Also counttable has `largest` and `smallest`
00:41:09FromDiscord<Nerve> oh, really?
00:41:11FromDiscord<Nerve> that's useful
00:41:15FromDiscord<Elegantbeef> Yep
00:48:34FromDiscord<Elegantbeef> I suppose i should not if an iterator is declared with `{.closure.}` it's a first class iterator and does indeed exist at runtime
00:48:56FromDiscord<Elegantbeef> Which means you can hold onto it in variables or pass it into procedures
00:57:32FromDiscord<Nerve> Is there any way to sort a CountTable by keys instead of values? Or would I need to resolve the keys into a seq and sort that for iteration?
00:59:33FromDiscord<Elegantbeef> The sequence is probably the way to do it
00:59:42FromDiscord<Elegantbeef> Or store the keys sorted in another collection
01:12:43FromDiscord<Nerve> All worked, thanks. Got similar performance to what I was able to get out of D.
01:12:57FromDiscord<Nerve> In less code of course
01:13:02FromDiscord<Elegantbeef> what are you compile flags?
01:13:23FromDiscord<Nerve> just -d:release
01:14:25FromDiscord<Elegantbeef> Always fun to try `--mm:orc` or `--mm:arc`
01:14:41FromDiscord<Elegantbeef> Can even throw in a `-d:lto` if you want to enable link time optimisations
01:21:31FromDiscord<Bubblie> can you do newSeq[cuint] because for some reason that isn't working
01:21:48FromDiscord<Elegantbeef> `newSeq[cuint](10)` should work
01:21:56FromDiscord<Bubblie> the paranthesis is length right?
01:22:03FromDiscord<Elegantbeef> yes
01:22:13FromDiscord<Bubblie> can you make a newSeq without length?
01:22:19FromDiscord<Bubblie> kinda like ArrayLists in java
01:22:28FromDiscord<Elegantbeef> `newSeqWithCap[cuint](capacityHere)`
01:22:36FromDiscord<Elegantbeef> or just do `var mySeq: seq[cuint]`
01:22:42FromDiscord<Bubblie> ah okay :) thank you!
01:24:55FromDiscord<voidwalker> How can I conditionally add something to a string, in a single let x = expression ?
01:25:20FromDiscord<voidwalker> I think I saw something like that, sort of like python
01:25:25FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46RI
01:25:37FromDiscord<voidwalker> oh, I thought it was possible to do oneliner : )
01:25:47FromDiscord<voidwalker> I guess I can oneline that
01:25:50FromDiscord<Elegantbeef> You can i just despise it
01:26:10FromDiscord<voidwalker> despise ?
01:26:20FromDiscord<Elegantbeef> Yes i dislike 1 line if expressions
01:26:34FromDiscord<voidwalker> i like low linecount
01:26:52FromDiscord<voidwalker> 80 char lines + 100 char comments : D
01:26:58FromDiscord<Elegantbeef> So write all your code in `()` and have very few lines
01:27:17FromDiscord<reversem3> nim c -d\:release --passL\:" pkg-config --cflags --lib elementary" enim.nim so --cflags doesn't work
01:27:58FromDiscord<reversem3> does pkg-config have to be in quotes ?
01:28:56FromDiscord<voidwalker> ``nim
01:30:58FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46RJ
01:31:04FromDiscord<domosokrat> reversem3\: it has to be --passL\:"$(pkg-config …)"
01:31:24FromDiscord<voidwalker> This is what I meant Beef, it works. Nice. But I can't get rid of the else:
01:31:28FromDiscord<Elegantbeef> That's what i consider unreadable code
01:31:44FromDiscord<voidwalker> If I remove the else: it tells me i need to use or discard the if string
01:31:55FromDiscord<Elegantbeef> Of course
01:32:01FromDiscord<Elegantbeef> `else: ""`
01:32:14FromDiscord<!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=46RK
01:32:21FromDiscord<!Patitotective> (edit) "https://play.nim-lang.org/#ix=46RK" => "https://play.nim-lang.org/#ix=46RL"
01:32:42*derpydoo quit (Ping timeout: 268 seconds)
01:33:28FromDiscord<voidwalker> hm maybe some other time, doesn't seem fitting atm : )
01:34:29FromDiscord<Tuatarian> is there any reason why it would be a bad idea to use arc and manually free cylic datastructures?
01:35:33FromDiscord<Elegantbeef> You arent guaranteed they're freed
01:37:53*neceve joined #nim
01:38:53FromDiscord<Elegantbeef> You also basically will just make a cycle collector in the end
01:39:03FromDiscord<reversem3> '/home/nixfreak/.choosenim/toolchains/nim-#devel/config/config.nims' [Conf]↵command line(1, 2) Error\: fatal error\: command expects a filename
01:39:05FromDiscord<Elegantbeef> You do realize orc is only ran on types that are possible to be cyclical right?
01:42:42FromDiscord<reversem3> yeah tried that , nim c -d\:release --passL\: $(pkg-config --cflags --libs elementary) enim.nim↵command line(1, 2) Error\: invalid command line option\: '-I'
01:43:20FromDiscord<Elegantbeef> Voidwalker you didnt just make me write a silly fizzbuzz in a single line
01:43:26FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46RO
01:47:01FromDiscord<voidwalker> very elegant : )
01:47:08FromDiscord<Elegantbeef> I hate you
01:47:09FromDiscord<Bubblie> so in java ArrayLists have the ability to get something in it based on sequence
01:47:14FromDiscord<Bubblie> (edit) "sequence" => "index"
01:47:17FromDiscord<Bubblie> is there something like that
01:47:19*neceve quit (Ping timeout: 252 seconds)
01:47:19FromDiscord<Bubblie> in nim seq?
01:47:22FromDiscord<Elegantbeef> Yes
01:47:28FromDiscord<Elegantbeef> `mySeq[i]`
01:47:38FromDiscord<Bubblie> oh 😭
01:47:42FromDiscord<Elegantbeef> Nim isnt a foreign entity try what you're used to 😄
01:47:44FromDiscord<Bubblie> im so use to doing a method like .get
01:47:51FromDiscord<domosokrat> reversem3\: where are the quotes in your call?
01:48:01FromDiscord<voidwalker> I agree with you on readability, but if it's stupid code of little value, i say compress it. The overall module readability wins
01:48:08FromDiscord<Elegantbeef> This is your mind on operator overloading!↵(@Bubblie)
01:48:13FromDiscord<Bubblie> true
01:48:47FromDiscord<Elegantbeef> Vertical \@voidwalker)
01:50:19FromDiscord<domosokrat> sent a code paste, see https://play.nim-lang.org/#ix=46RP
01:50:32FromDiscord<Elegantbeef> That doesnt compile
01:50:45FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46RQ
01:51:54FromDiscord<domosokrat> sent a code paste, see https://play.nim-lang.org/#ix=46RR
01:52:00FromDiscord<Elegantbeef> Yep
01:53:09FromDiscord<domosokrat> But I claim that `let a = b + c` is more readable \:-)
01:54:50FromDiscord<domosokrat> argh, why is it already that late 😴
01:56:28FromDiscord<reversem3> Yep you're right I forgot them ,thanks
01:56:50*arkurious quit (Quit: Leaving)
01:58:43FromDiscord<Bubblie> do you any of you know how to cast a cstring to a normal nim string?
01:58:59FromDiscord<Elegantbeef> You dont cast it you do `$myCstr`
01:59:07FromDiscord<Bubblie> Oh?
01:59:41FromDiscord<Elegantbeef> Nim strings are pascal strings, cstrings are null terminated strings
02:00:12FromDiscord<Bubblie> wait so you put a dollar sign in front of the nim string and it is now a cstring?
02:00:28FromDiscord<Bubblie> sorry im a bit confused 😅
02:00:50FromDiscord<Bubblie> In reply to @Elegantbeef "Nim strings are pascal": ah okay
02:00:53FromDiscord<Elegantbeef> `$` is nim's stringification operator
02:01:10FromDiscord<Elegantbeef> `$myCstring` will convert a null terminated string into a Nim string
02:01:18FromDiscord<Bubblie> oh I need the opposite of that
02:01:29FromDiscord<Bubblie> pascal string to null terminated
02:01:31FromDiscord<Elegantbeef> > cast a cstring to a normal nim string
02:01:44FromDiscord<Elegantbeef> `.cstring` will give you an unsafe cstring
02:02:13FromDiscord<Bubblie> hmm should I try to make this stuff more safe then?
02:02:24FromDiscord<Elegantbeef> No clue what you're doing
02:02:31FromDiscord<Bubblie> vulkan graphics api
02:02:40FromDiscord<Bubblie> handling glfw extensions
02:02:42FromDiscord<Elegantbeef> You're probably fine to use that cstring
02:02:51FromDiscord<Bubblie> okay thank you :)
02:34:55FromDiscord<voidwalker> does this make sense?
02:34:55FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46RU
02:35:23FromDiscord<voidwalker> sent a code paste, see https://paste.rs/xvV
02:35:43FromDiscord<voidwalker> (edit) "https://paste.rs/wxx" => "https://play.nim-lang.org/#ix=46RW"
02:35:45FromDiscord<voidwalker> how do I do the "&" ?
02:36:33FromDiscord<Elegantbeef> `{"bar": "qux", "foo": "baz"}`?
02:37:19FromDiscord<voidwalker> If so, then the examples from the docs suck
02:37:52FromDiscord<Elegantbeef> Why the proc takes a `openArray[(string, string)]`
02:42:32FromDiscord<voidwalker> ok that syntax works
02:42:48FromDiscord<voidwalker> now how do I append my oneliner if true: "=true" else: ?
02:43:06FromDiscord<voidwalker> I now got an URI, not a string, hmm
02:43:09FromDiscord<Elegantbeef> you dont do it in a one liiner
02:43:52FromDiscord<voidwalker> sigh, should've kept it a string 😦
02:44:05FromDiscord<Elegantbeef> no comment
02:44:14FromDiscord<voidwalker> no point in all that fancy schmancy deconstruct/reconstruct
02:44:21FromDiscord<voidwalker> just .replace(" ", "%20")
02:45:09FromDiscord<Elegantbeef> That fails for a ton of characters
02:45:41FromDiscord<voidwalker> maybe you are right...
02:45:58FromDiscord<Elegantbeef> The "proper" way is to use uri cause you arent dealing with a string
02:46:12FromDiscord<Elegantbeef> It might look like a string and quack like a string but it's not a string
02:46:32FromDiscord<voidwalker> all URIs are strings. not all strings are URIs
02:46:53FromDiscord<Elegantbeef> strings are untyped binary blobs, so yes
02:47:23FromDiscord<voidwalker> so are you sure there is no way to put that conditional & at the end, using whatever macro syntactic sugar I use with the / ?
02:47:41FromDiscord<Elegantbeef> That's just a procedure
02:48:01FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46RZ
02:48:12FromDiscord<Elegantbeef> You need to add an element conditionally to an array that's not possible
02:48:13FromDiscord<voidwalker> that breaks something in the parsing
02:50:11FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46S0
02:50:14FromDiscord<Elegantbeef> Dont you dare say "but my one liner"
02:50:35FromDiscord<Elegantbeef> If you want it done in one line make a procedure that handles it
02:50:55FromDiscord<Elegantbeef> Then you can do `let myUri = imdbUri(query, ref_, exact)`
02:51:34FromDiscord<voidwalker> A procedure should not exist for the sole purpose of having a 2 liner somewhere, turn into a 1 liner, once
02:51:49FromDiscord<Elegantbeef> Well then write the code normally and carry on
02:52:00FromDiscord<Elegantbeef> Dont try to make everything one liners on this quest of "code purity"
02:52:14FromDiscord<Elegantbeef> you can also do a block statement if you want it immutable
02:52:15FromDiscord<voidwalker> I cried a bit when I had to disassemble my first glorious mapIt.SplitIt.FuckIt etc :\
02:52:40FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46S1
02:52:55FromDiscord<voidwalker> I never used blcoks.. how would this help me .?
02:53:10FromDiscord<Elegantbeef> It lets you have the variable as an immutable one as i said
02:56:18FromDiscord<voidwalker> check ths out, this compiles
02:56:26FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46S2
02:56:42FromDiscord<Elegantbeef> Thanks i hate it
02:57:09FromDiscord<huantian> 😛
02:57:12FromDiscord<voidwalker> but I am getting just `https://www.imdb.com/find?%26exact=true` from $url
02:57:13FromDiscord<huantian> sent a code paste, see https://play.nim-lang.org/#ix=46S3
02:57:25FromDiscord<huantian> yeah `?` seems to overwrite the existing query
02:59:12FromDiscord<flywind> In reply to @voidwalker "but I am getting": See https://github.com/nim-lang/Nim/issues/19782 and https://github.com/nim-lang/Nim/pull/19800 review welcome.
02:59:37FromDiscord<voidwalker> woah, thank you, there's hope
02:59:42FromDiscord<voidwalker> just gotta switch to nim-git
03:00:08FromDiscord<voidwalker> Totally worth it for such an important code improvement piece : P
03:00:48FromDiscord<huantian> well you can just make your own proc that does that
03:00:56FromDiscord<huantian> at least for now
03:01:59FromDiscord<voidwalker> hm so that code is not merged yet ?
03:02:24FromDiscord<huantian> no the pr is still open
03:04:21FromDiscord<flywind> Giving the PR a thumb up will probably help it merge faster.
03:09:51FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46S9
03:10:01FromDiscord<voidwalker> (edit) "https://play.nim-lang.org/#ix=46S9" => "https://play.nim-lang.org/#ix=46Sa"
03:10:07FromDiscord<voidwalker> so this until the bug squish reaches next version
03:14:54FromDiscord<Elegantbeef> For now it's probably best to just define your own `??` operator that merges queries like you did
03:16:12FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46Sb
03:55:29FromDiscord<voidwalker> ok now I need to pick a html parse lib.. string searching won't cut it here
03:56:18FromDiscord<Elegantbeef> stdlib has one
03:57:31FromDiscord<Bung> anyone face libwinpthread-1.dll not found in run time when turn threads on
03:57:55FromDiscord<Bung> am on win11
03:59:59FromDiscord<flywind> In reply to @Bung "anyone face libwinpthread-1.dll not": Yeah, that dll is in the mingw directory and add that directory to your envs.
04:00:50FromDiscord<flywind> (edit) "directory" => "\bindirectory"
04:01:00FromDiscord<flywind> (edit) "mingw \bindirectory" => "`mingw\bin` directory"
04:02:27FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46So
04:02:30FromDiscord<voidwalker> that is the stdlib htmlparse example
04:02:42FromDiscord<Bung> In reply to @flywind "Yeah, that dll is": oh thanks, it's under nim-1.6.6\dist\mingw64\bin
04:03:08FromDiscord<voidwalker> ` <td class="result_text"> <a href="/title/tt0133093/?ref_=fn_tt_tt_1" >Matrix</a> (1999) </td`
04:03:18FromDiscord<voidwalker> something like this in the html that must be parsed
04:03:47FromDiscord<Prestige> Pixie mentions it has glowing as a feature, but I don't see anything for it. Anyone know if it's actually a thing?
04:04:36FromDiscord<Prestige> I suppose I could just use a shadow somehow
04:04:50FromDiscord<Elegantbeef> Shadow takes colour so yea probably just use shadow
04:21:10FromDiscord<flywind> Lucky, I found the regression for https://github.com/nim-lang/Nim/issues/16933 at the second guess (it is regression from 1.2 to 1.4 but I don't bother to run a git bisect)
04:36:16FromDiscord<!&luke> Would wrapping a c lib like libvips be faster than chroma?
04:36:22FromDiscord<!&luke> (edit) "chroma?" => "pixie?"
04:36:34FromDiscord<Elegantbeef> Benchmark them
04:37:08FromDiscord<!&luke> Hmm yeah wrapping the lib will probably help someone if it doesn't work for me
04:37:22FromDiscord<Elegantbeef> I mean you can use the library in C or another language
04:37:43FromDiscord<!&luke> Yea but c code would be faster than nims generated version
04:37:50FromDiscord<Elegantbeef> No it wouldnt
04:37:55FromDiscord<Rika> Not necessarily
04:37:55FromDiscord<Elegantbeef> I dont know why people say that
04:38:02FromDiscord<Elegantbeef> Nim can be as fast as C
04:38:15FromDiscord<!&luke> In reply to @Elegantbeef "I dont know why": Maybe because the code is a mess 💀 it's computer generated
04:38:25FromDiscord<Elegantbeef> So fucking what
04:38:37FromDiscord<Rika> Almost like saying your handwritten ASM code is probably better than the C compiler’s
04:38:38FromDiscord<!&luke> Nim takes a 10 line fizzbuzz to over 200 lines of js 💀
04:38:41FromDiscord<Rika> Most of the time it isn’t
04:38:52FromDiscord<Elegantbeef> With `-d:danger`?↵(@!&luke)
04:38:52FromDiscord<Rika> Unless you’re already very very well versed in assembly
04:39:06FromDiscord<!&luke> In reply to @Elegantbeef "With `-d:danger`? (<@704106773660827690>)": No I have no idea what that does
04:39:08FromDiscord<Elegantbeef> Also who cares how many lines the code is
04:39:10FromDiscord<Rika> In reply to @ripluke "Maybe because the code": Simpler is not always faster
04:39:12FromDiscord<Elegantbeef> It's all about the speed
04:39:21FromDiscord<huantian> In reply to @ripluke "Nim takes a 10": yeah but I don't die inside multiple times when I write it in nim
04:39:44FromDiscord<!&luke> In reply to @Rika "Simpler is not always": In interprated code the less lines the interpreter has to interperate the better
04:40:02FromDiscord<!&luke> Shouldn't matter in c tho
04:40:26FromDiscord<Rika> This isn’t interpreted code now is it
04:40:39FromDiscord<!&luke> In reply to @ripluke "Shouldn't matter in c": .
04:40:56FromDiscord<!&luke> In js it will definitely make a difference
04:41:35FromDiscord<Rika> No because JS is JIT’ed too
04:41:53FromDiscord<Elegantbeef> Wow my one line fizzbuzz in nim is 400 loc in JS
04:41:56FromDiscord<Elegantbeef> Literally unusable
04:42:16FromDiscord<Rika> Put it through a minifier and it’ll be 1 LOC
04:42:22FromDiscord<Rika> Easy
04:42:24FromDiscord<Elegantbeef> Yea that's the joke
04:42:49FromDiscord<!&luke> Would wrapping the python wrapping of a lib produce a slower result?
04:43:04FromDiscord<Rika> Most likely because you’re going through Python
04:43:09FromDiscord<!&luke> In reply to @Rika "Put it through a": Not a very readable 1 line
04:43:10FromDiscord<Elegantbeef> 6.9kb fizzbuzz, nice
04:43:19FromDiscord<!&luke> In reply to @Elegantbeef "6.9kb fizzbuzz, nice": Lol
04:43:21FromDiscord<Elegantbeef> You act like the Nim was readable
04:43:26FromDiscord<Rika> In reply to @ripluke "Not a very readable": Nim doesn’t intend to produce readable code
04:43:27FromDiscord<!&luke> In reply to @Elegantbeef "You act like the": It was
04:43:36FromDiscord<Elegantbeef> That's garbage
04:43:39FromDiscord<Prestige> With a template, Nim's fizzbuzz can be O(1) runtime
04:43:40FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/bV5
04:43:43FromDiscord<!&luke> In reply to @Rika "Nim doesn’t intend to": Yea that's why windows defender hates it
04:43:48FromDiscord<Elegantbeef> Why template?↵(@Prestige)
04:44:01FromDiscord<huantian> In reply to @ripluke "Yea that's why windows": that's a misguided opinion
04:44:08FromDiscord<Elegantbeef> Static evaluation exists prestige
04:44:11FromDiscord<!&luke> sent a code paste, see https://play.nim-lang.org/#ix=46Su
04:44:14FromDiscord<Tuatarian> In reply to @Elegantbeef "You do realize orc": yes, but there is no disadvantage of manually freeing the cycles beyond what you'd expect in c/c++ or any other langauge right?
04:44:23FromDiscord<!&luke> In reply to @ripluke "Nim or scheme?": Nim can be lisp too
04:44:26FromDiscord<huantian> unreadable != malware
04:44:30FromDiscord<Prestige> Yeah my comment was a joke, you could do the same in any language if you typed it all out
04:44:31FromDiscord<Elegantbeef> No there isnt
04:44:33FromDiscord<huantian> if it did all js would be malware
04:44:42FromDiscord<!&luke> In reply to @huantian "unreadable != malware": Windows defender seems to disagree
04:44:52FromDiscord<Prestige> Windows defender is malware
04:44:57FromDiscord<!&luke> That's why I don't use windows anymore
04:45:05FromDiscord<!&luke> In reply to @Avahe "Windows defender is malware": Most windows antivirus is
04:45:07FromDiscord<Elegantbeef> No prestige i'm saying in nim you can just do `echo static(fizzBuzz(100))`
04:45:15FromDiscord<huantian> In reply to @ripluke "Windows defender seems to": windows defender doesn't detect it because the c code is unreadable
04:45:18FromDiscord<huantian> it has no idea what the c code is
04:45:20FromDiscord<!&luke> In reply to @ripluke "Most windows antivirus is": Norton and macafee definitely are
04:45:37FromDiscord<huantian> it detects it because the code looks like other malware writien in nim
04:45:47FromDiscord<!&luke> There is malware in nim?
04:46:27FromDiscord<Elegantbeef> I think i've successfully made the worlds worst CLI parser
04:46:31FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1005698426794684456/image.png
04:47:02FromDiscord<Tuatarian> is this doom emacs?
04:47:08FromDiscord<huantian> no that's kate
04:47:16FromDiscord<Elegantbeef> Huan knows what's what
04:47:19FromDiscord<Tuatarian> looks like doom tbh
04:47:25FromDiscord<Elegantbeef> It's ayu mirage
04:47:27FromDiscord<Tuatarian> ie not that good (sorry)
04:47:35FromDiscord<Elegantbeef> With iosevka
04:47:39FromDiscord<huantian> hey I like how doom emacs looks
04:47:40FromDiscord<!&luke> I wish Nim had the zig level of c interop
04:47:50FromDiscord<Elegantbeef> It's ok you're free to be wrong, just dont tell me how wrong you are
04:47:51FromDiscord<Elegantbeef> It literally does luke use futhark
04:47:56FromDiscord<!&luke> In reply to @iWonderAboutTuatara "looks like doom tbh": Default doom cs
04:48:05FromDiscord<huantian> I like the purple
04:48:19FromDiscord<!&luke> In reply to @Elegantbeef "It literally does luke": 💀 it's just alot easier in zig
04:48:25FromDiscord<!&luke> 1 function
04:48:28FromDiscord<Elegantbeef> ...
04:48:32FromDiscord<Elegantbeef> It's like 3 lines of code
04:48:38FromDiscord<!&luke> cInclude("lib")
04:48:48FromDiscord<Elegantbeef> Seriously futhark is braindead easy
04:48:50FromDiscord<!&luke> In reply to @Elegantbeef "It's like 3 lines": Ok
04:49:01FromDiscord<Elegantbeef> assuming you dont hit a bug with it 😄
04:49:16FromDiscord<!&luke> Also should I static compile or...
04:49:32FromDiscord<Elegantbeef> Whatever you want
04:49:32FromDiscord<huantian> how would you compile at runtime 🙃
04:49:44FromDiscord<!&luke> I think vips is a bit to big to static compile
04:49:52FromDiscord<Elegantbeef> Why do people ask such unimportant questions
04:50:01FromDiscord<Rika> In reply to @huantian "how would you compile": I think they mean to static link
04:50:04FromDiscord<Elegantbeef> Static compilation is better for larger libraries
04:50:10FromDiscord<!&luke> In reply to @Rika "I think they mean": Oh yea
04:50:30FromDiscord<Elegantbeef> Like... the larger the library the more benefits you get from static linking as your compiler doesnt include unused symbols
04:50:52FromDiscord<!&luke> What
04:51:08FromDiscord<!&luke> But your binary would be huge
04:51:12FromDiscord<Rika> What
04:51:12FromDiscord<Elegantbeef> No
04:51:28FromDiscord<Elegantbeef> Static linking reduces the shipped size as it only uses code that you use
04:51:43FromDiscord<Elegantbeef> A static linked binary is smaller than dynamically linked + binary
04:51:46FromDiscord<Rika> Static linking also has “DCE” in some form yes
04:51:50FromDiscord<!&luke> In reply to @Elegantbeef "A static linked binary": Ok
04:52:04FromDiscord<Rika> In reply to @Elegantbeef "A static linked binary": Unless a lot of binaries use the same library
04:52:20FromDiscord<Elegantbeef> I'm imagining a windows world where no one knows what the purpose of dynamic libraries are
04:53:00FromDiscord<Rika> You mean
04:53:02FromDiscord<Rika> Now
04:53:28FromDiscord<Prestige> I love static linking
04:54:23FromDiscord<Elegantbeef> I'm completely indifferent
04:56:16FromDiscord<!&luke> In reply to @Elegantbeef "I'm imagining a windows": Isn't that what a dll is
04:56:30FromDiscord<Elegantbeef> No one in the windows world understands dlls
04:56:49FromDiscord<Elegantbeef> They're practically static libraries that are dynamically linked
04:57:56FromDiscord<Elegantbeef> The point of dynamic linking if file reuse but most windows applications ship their own libraries so there is -10 reuse
04:58:45FromDiscord<huantian> yeah they have to ship their own because dlls have 0 versioning
04:59:02FromDiscord<huantian> or rather you can only use one version at a time right?
04:59:05*madprops checks out https://nim-lang.org/docs/asynchttpserver.html
04:59:09FromDiscord<Elegantbeef> No fucking clue
04:59:16FromDiscord<Rika> In reply to @madprops "checks out https://nim-lang.org/docs/asynchttpserve": ?
04:59:32madpropsoh i used /me
04:59:44FromDiscord<huantian> ah
04:59:51FromDiscord<huantian> why is that not bridged to discord
05:07:36FromDiscord<j-james> In reply to @Elegantbeef "It's like 3 lines": futhark is ridiculously easy
05:07:46FromDiscord<Forest> Working on creating Nim bindings for WGPU
05:08:13FromDiscord<j-james> it's just that, you don't usually want 1:1 perfect c interop because c function names fucking suck lmfao
05:10:07FromDiscord<Forest> Can futhark output a Nim file from a header file i give it?
05:14:45FromDiscord<Rika> Technically yeah
05:15:33FromDiscord<j-james> but every other line is a `when` statement
05:16:23FromDiscord<Forest> In reply to @Rika "Technically yeah": Technically?
05:16:33FromDiscord<Forest> In reply to @j-james "but every other line": Is that an issue?
05:17:14FromDiscord<Elegantbeef> It's not really an isssue
05:17:32FromDiscord<j-james> yes if you want to use it for the basis of a more idiomatic wrapper
05:17:35FromDiscord<Elegantbeef> https://github.com/beef331/miniaudio/blob/master/src/miniaudio.nim#L5-L8 generates https://github.com/beef331/miniaudio/blob/master/src/miniaudio/futharkminiaudio.nim inside your nimcache
05:17:36FromDiscord<j-james> no if you just want c interop
05:17:54FromDiscord<Elegantbeef> It's not that big of an issue james you can just use templates/procs on top of it
05:18:52FromDiscord<Forest> In reply to @j-james "yes if you want": Ah i do though
05:19:06FromDiscord<Forest> In reply to @Elegantbeef "https://github.com/beef331/miniaudio/blob/master/sr": Ah thanks Elegantbeef!
05:19:08FromDiscord<Elegantbeef> My miniaudio wrapper there is idiomatic Nim code
05:19:53FromDiscord<j-james> In reply to @Elegantbeef "It's not that big": oh i suppose that's true yeah
05:19:59FromDiscord<j-james> probably a better way to do it
05:20:51FromDiscord<Forest> Do ya not need to import futhark before using importc?
05:21:09FromDiscord<Elegantbeef> You do
05:21:15FromDiscord<Elegantbeef> I just forgot to inside that when branch
05:21:59FromDiscord<Forest> Ah okay lmao
05:22:11FromDiscord<Forest> Thanks for the help!
05:22:59FromDiscord<xzntrc> in `proc bar(): int = 3` what does everything after the `:` mean?
05:23:34FromDiscord<xzntrc> not really sure how procs work
05:23:47FromDiscord<Prestige> int is the return type
05:24:18FromDiscord<Prestige> Everything after `=` is code that's executed, in this case the proc just returns 3
05:24:46FromDiscord<xzntrc> and `proc fibonacci(n: int):`
05:24:50FromDiscord<xzntrc> so the n inside is the input?
05:24:55FromDiscord<Prestige> Yep
05:24:56FromDiscord<Elegantbeef> It's a parameter yes
05:25:15FromDiscord<Elegantbeef> `proc name[GenericParameters](parameters): returnType = body`
05:26:11FromDiscord<xzntrc> do procs have to have a return?
05:26:47FromDiscord<Elegantbeef> No
05:27:07FromDiscord<Elegantbeef> Procs dont need `[GenericParameters](parameters): returntype`
05:27:11FromDiscord<Elegantbeef> They need a name and body though
05:27:33FromDiscord<xzntrc> ohhh
05:27:40FromDiscord<xzntrc> this is valid?
05:27:44FromDiscord<xzntrc> sent a code paste, see https://play.nim-lang.org/#ix=46SI
05:27:59FromDiscord<Prestige> Yep
05:28:22FromDiscord<that_dude> Isn't there an eval bot in this channel?
05:28:31FromDiscord<Prestige> There is, yeah
05:28:40FromDiscord<Prestige> @xzntrc check out https://nim-lang.org/documentation.html
05:29:09FromDiscord<Prestige> !eval echo "The bot is alive"
05:29:13NimBotThe bot is alive
05:29:45FromDiscord<that_dude> sent a code paste, see https://play.nim-lang.org/#ix=46SM
05:30:18FromDiscord<that_dude> F
05:30:19FromDiscord<Prestige> Wonder if it doesn't work with multiple lines
05:30:20FromDiscord<Elegantbeef> It only works with single lines since it's on IRC
05:30:54FromDiscord<Prestige> Maybe we should turn it into a discord bot
05:31:23FromDiscord<Elegantbeef> Feel free it just uses nim playground's api so it's easy enough
05:31:38FromDiscord<Prestige> Neat
05:50:10FromDiscord<xzntrc> oh yeah, guessing there is no API wrapper for nim yet?
05:50:12FromDiscord<xzntrc> for discord i mean
05:50:23FromDiscord<Elegantbeef> https://github.com/krisppurg/dimscord
05:52:26FromDiscord<xzntrc> neat
05:52:49FromDiscord<xzntrc> oh also, question, is it good practice to write in seperate files? Like classes in java
05:52:59FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46SO
05:53:05FromDiscord<Elegantbeef> Nim files are modules, use modules as much as makes sense
05:53:20FromDiscord<voidwalker> $a.attrs["href"] yields `/title/tt4167406/?ref_=fn_tt_tt_46`
05:53:32FromDiscord<voidwalker> how to get the next part ? the title/ year
05:53:54*xcodz-dot joined #nim
05:54:16FromDiscord<Forest> The generated futhark file should be fine to distribute, right?
05:54:17FromDiscord<Elegantbeef> the title is the innertext of the node
05:54:23FromDiscord<Elegantbeef> Yea
05:54:27FromDiscord<Forest> Sweet
05:55:45xcodz-dotJust wondering, from which timezone are most nim people are in this community cause I being in India, have a near 12-hour difference from america
05:56:05FromDiscord<xzntrc> im from australia myself.
05:56:24FromDiscord<Forest> I'm fron England
05:56:30FromDiscord<Forest> A true British lass
05:56:32FromDiscord<Elegantbeef> Canada here
05:56:39FromDiscord<voidwalker> Indeed a itself yields `<a href="/title/tt0328832/?ref_=fn_tt_tt_9">The Animatrix</a>`
05:57:36xcodz-dotSo its morning here while its late night in Canada?
05:58:09FromDiscord<xzntrc> timezones suck honestly
05:58:12FromDiscord<xzntrc> it's 3PM here
05:58:24xcodz-dot11:30 AM
05:58:24FromDiscord<Elegantbeef> It's 0\:00 in 2 minutes for me so yes
06:00:07FromDiscord<xzntrc> i'm assuming I dont need to specify a main proc right?
06:00:16FromDiscord<Elegantbeef> Top level code is allowed yes
06:00:22FromDiscord<Elegantbeef> Consider looking at the official tutorials
06:00:28FromDiscord<Elegantbeef> https://nim-lang.org/docs/tut1.html
06:00:41FromDiscord<xzntrc> right sorry
06:01:32xcodz-dotAny opinions on Nimble as it seems to be one of the reasons that other languages do better.
06:01:39xcodz-dotin my opinion*
06:02:11FromDiscord<ajusa> do folks have a preference for testing framework? I was looking at treeform/guzba code and it seems like they just have blocks with asserts rather than using unittest
06:03:48FromDiscord<Prestige> I wrote my own mini testing framework because I didn't like the others
06:04:36FromDiscord<Elegantbeef> Balls is well regarded↵(@ajusa)
06:05:27FromDiscord<ajusa> balls looks pretty interesting
06:05:52FromDiscord<Elegantbeef> You really had to make the joke didnt you
06:06:09FromDiscord<ajusa> joke?
06:09:46FromDiscord<xzntrc> kek
06:10:15xcodz-dotcake?
06:10:36FromDiscord<xzntrc> ?
06:10:43xcodz-dotkek -> Cake?
06:10:53xcodz-dotwhat's kek?
06:11:08xcodz-dotm new to online chat
06:11:10FromDiscord<xzntrc> ohh
06:11:15FromDiscord<xzntrc> it's yeah thats fine
06:11:18FromDiscord<Elegantbeef> It's just a variation of lol practically
06:11:22FromDiscord<xzntrc> yep ^
06:11:50FromDiscord<xzntrc> it's a term from world of warcraft
06:12:10xcodz-dotwell, as bad as it is, I do not play any games
06:12:25xcodz-dotthe most boring of lifes as you could imagine
06:12:53FromDiscord<xzntrc> ah nah I quit playing games a while ago
06:12:57FromDiscord<xzntrc> for the most part.
06:13:33madpropsim playing the swapper
06:13:42madpropsnice puzzle game
06:14:04FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46ST
06:14:08FromDiscord<voidwalker> ok so I found the innerText proc, it works
06:14:15FromDiscord<voidwalker> but how about the year ? what element is that ?
06:15:02xcodz-dot@madprops Are ya from IRC?
06:15:26madpropsyeah im here
06:15:44FromDiscord<Elegantbeef> It might just be the text for the element above the a
06:15:50FromDiscord<Rika> In reply to @voidwalker "but how about the": It’s outside of the a node
06:16:10madpropsxcodz-dot, sup?
06:16:43FromDiscord<voidwalker> @Rika I noticed that.. but can it be pointed by some element or somehow ?
06:16:58FromDiscord<Elegantbeef> might be `.text` of the parent element
06:20:12FromDiscord<Forest> Question: How would i work on making a wrapper around a big C library that's i wanna wrap to be more Nim-like?
06:20:33FromDiscord<Elegantbeef> You start abstracting the procedures to fit with more nim code
06:20:49FromDiscord<Elegantbeef> https://github.com/beef331/wasmedge_playground/blob/master/src/wasmedge.nim#L42 example of this here
06:21:58FromDiscord<voidwalker> is there any way I can enumerate all this xml node thingie, in a structured way? So I can see what keeps what
06:22:13FromDiscord<Elegantbeef> There are iterators
06:22:35FromDiscord<Elegantbeef> There's also find all and similar
06:22:36FromDiscord<voidwalker> as xml file no?
06:22:49FromDiscord<Elegantbeef> You parse the xml file then can interate the xml tree
06:22:55FromDiscord<Elegantbeef> iterate rather
06:23:46FromDiscord<Forest> In reply to @Elegantbeef "https://github.com/beef331/wasmedge_playground/blob": That was wrapped with futhark?
06:23:53FromDiscord<Elegantbeef> Yes
06:24:07FromDiscord<Forest> And generated futhark files in the future, as long as there's no major API breakages, should continue working?
06:24:15FromDiscord<Elegantbeef> Sure
06:24:32FromDiscord<Forest> Sweet
06:25:29FromDiscord<xzntrc> getting the hang of nim now
06:27:11FromDiscord<xzntrc> wait
06:27:15FromDiscord<xzntrc> why does this not discard?
06:27:26FromDiscord<xzntrc> sent a code paste, see https://play.nim-lang.org/#ix=46SX
06:27:34FromDiscord<Rika> What do you mean
06:27:40FromDiscord<Elegantbeef> discard isnt break
06:27:59FromDiscord<Elegantbeef> `discard` is "I dont care about this value" or "here indent overlord here's a statement to parse, dont hurt me"
06:28:49FromDiscord<xzntrc> ohh
06:28:54FromDiscord<xzntrc> I thought discard broke out
06:29:05FromDiscord<Elegantbeef> No `break` breaks
06:35:14FromDiscord<xzntrc> right lol sorry
06:35:33FromDiscord<xzntrc> wait so what is an appropriate use of discared?
06:35:34FromDiscord<xzntrc> (edit) "discared?" => "discard"
06:35:36FromDiscord<xzntrc> (edit) "discard" => "discard?"
06:36:24FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46T3
06:36:29FromDiscord<Elegantbeef> https://nim-lang.org/docs/tut1.html#procedures-discard-statement
06:39:16xcodz-dotif you know Python, "pass" ~= "discard"
06:39:26FromDiscord<xzntrc> ahhh right thanks
06:39:45FromDiscord<Elegantbeef> It has one more semantic but yea
06:41:21FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46T5
06:42:03FromDiscord<Elegantbeef> so you need to use `discard` before any value you dont want
06:42:32xcodz-dotany linux user here?
06:42:40FromDiscord<Elegantbeef> Of course
06:42:50xcodz-dotwhich one?
06:43:02FromDiscord<xzntrc> Arch personally.
06:43:04FromDiscord<Elegantbeef> debian sid
06:43:22xcodz-dotDesktop Environment?
06:43:33FromDiscord<xzntrc> I use gnome
06:43:45FromDiscord<Elegantbeef> Same presently
06:43:56FromDiscord<4zv4l> how can I make a simpler function that takes two string and return a reference to the longest string ?
06:44:00FromDiscord<xzntrc> https://media.discordapp.net/attachments/371759389889003532/1005727994121306152/unknown.png
06:44:02xcodz-dotwdym ElegantBeef, what do you prefer?
06:44:06FromDiscord<4zv4l> it's more for the keyword that I ask
06:44:21FromDiscord<Elegantbeef> I prefer tiling window managers
06:44:41FromDiscord<Elegantbeef> Simpler to what?
06:44:50FromDiscord<xzntrc> i like i3 but never had the time to config
06:46:49FromDiscord<j-james> In reply to @xzntrc "": ayy dash-to-panel
06:48:55xcodz-dot@4zv4l I personally do not think that something so specific exists.
06:48:56FromDiscord<Elegantbeef> What are you after?↵(@4zv4l)
06:49:21FromDiscord<4zv4l> something like this but
06:49:23FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=46T6
06:49:26FromDiscord<4zv4l> it tells me that's it's not correct
06:49:38FromDiscord<Elegantbeef> Of course it's not you cannot make a stack variable a `ref`
06:49:47FromDiscord<Elegantbeef> Nim strings are value semantics
06:50:03FromDiscord<Elegantbeef> So you'd need to declare your strings as `ref string` if you wanted to have a reference to them
06:50:12FromDiscord<xzntrc> do fstrings exist?
06:50:21FromDiscord<4zv4l> In reply to @Elegantbeef "So you'd need to": in the function arguments ?
06:50:24FromDiscord<Elegantbeef> `std/strformat`
06:50:49FromDiscord<xzntrc> so is there anything like %f
06:51:00FromDiscord<4zv4l> In reply to @Elegantbeef "So you'd need to": alright seems to more but then I can't use the `len()` function on them anymore
06:51:14xcodz-dot@xzntrc
06:51:16xcodz-dotyes
06:51:26FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46T7
06:51:32FromDiscord<Elegantbeef> https://nim-lang.org/docs/tut1.html#advanced-types-reference-and-pointer-types
06:51:58*xcodz-dot quit (Quit: Leaving)
06:52:13FromDiscord<4zv4l> why do I need to add [] to get their value ?
06:52:53FromDiscord<Elegantbeef> std/strformat↵(@xzntrc)
06:53:11FromDiscord<Elegantbeef> https://nim-lang.org/docs/lib.html
06:53:17FromDiscord<Elegantbeef> They're references
06:53:30FromDiscord<Elegantbeef> Read the link i sent you before asking any more questions
06:53:40FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=46T8
06:55:10FromDiscord<Elegantbeef> Well nim's strings are considered value types and nim doesnt have views(rust borrowing) working presently so it's what you get when you want a reference
06:55:58FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=46T9
06:56:01FromDiscord<4zv4l> the C version is much more shorter and understandable
06:56:06FromDiscord<4zv4l> I just wanna do the same in Nim
06:56:14FromDiscord<Elegantbeef> Nim is safer than C
06:57:37FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46Ta
06:57:41FromDiscord<Elegantbeef> If you dont care about safety you can get a pointer to the string
06:57:53FromDiscord<Elegantbeef> But it's highly discouraged as it's supremely easy to have issues
06:57:57FromDiscord<valerga> are airplanes with embedded nim safer than c?
06:58:12FromDiscord<4zv4l> xD
06:58:17FromDiscord<Elegantbeef> Probably a tinge
06:58:41FromDiscord<Prestige> I never board an airplane unless it's running NIm instead of C
06:58:43FromDiscord<Elegantbeef> Do not by default have null terminated strings and dont get dangling pointers
06:59:02FromDiscord<Elegantbeef> Eh i dont board a plane unless it runs ada sparks
06:59:25FromDiscord<Prestige> Remember, never board a rusty airplane
06:59:32FromDiscord<4zv4l> xD
06:59:58FromDiscord<Elegantbeef> Point being 4zv4l yes the C way is simpler but the C way is also more unsafe
07:00:20FromDiscord<Elegantbeef> You do not know where the pointer you got came from so you do not know if it's safe to do `dealloc` on it
07:00:23FromDiscord<Elegantbeef> It might be a stack variable
07:00:32FromDiscord<Elegantbeef> In this case it is
07:00:45FromDiscord<Prestige> Isn't there a way to pass strings by address rather than having it do a copy?
07:00:51FromDiscord<Prestige> without having to do what you did
07:00:54FromDiscord<Elegantbeef> `toOpenArray`
07:01:16FromDiscord<Elegantbeef> cursor inference does exist so with arc/orc assignment will move data generally
07:01:40FromDiscord<Prestige> I was thinking like `{.byaddr.}` but I don't recall how it actually functions
07:01:50FromDiscord<4zv4l> In reply to @Elegantbeef "It might be a": what's wrong with stack variable ? the string is given in argument so if the function before called the longest() one giving those string↵the strings are valid at least until the longest() return
07:01:55FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46Tb
07:02:05FromDiscord<4zv4l> (edit) "string↵the" => "strings↵the"
07:02:48FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=46Td
07:02:53FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46Te
07:03:04FromDiscord<Elegantbeef> God damn it
07:03:23FromDiscord<4zv4l> you don't need to cast malloc in C btw (long discussion I know)
07:03:37FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46Tf
07:03:46FromDiscord<Elegantbeef> Cool but that doesnt change the argument
07:04:00FromDiscord<Elegantbeef> The C code is inheritly unsafe as you do not know if it's a static/stack/heap value
07:04:02FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=46Tg
07:04:05FromDiscord<Elegantbeef> It's C code so clearly it's bad
07:04:08FromDiscord<4zv4l> it's not C that is unsafe
07:04:11FromDiscord<4zv4l> your code is unsafe
07:04:25FromDiscord<Elegantbeef> It's C that is unsafe as it doesnt distinguish anything
07:04:29FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=46Th
07:04:38FromDiscord<Elegantbeef> Your argument is invalid cause it compiles without looking off
07:04:50FromDiscord<4zv4l> because the programmer is supposed to think
07:04:54FromDiscord<Elegantbeef> ...
07:05:23FromDiscord<4zv4l> that's better
07:05:27FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=46Ti
07:05:44FromDiscord<4zv4l> C is not unsafe, programmer are unsafe
07:06:12FromDiscord<4zv4l> that's the difference between new languages that takes programmers for idiots and check everything for them (like Rust for example)
07:06:23FromDiscord<4zv4l> C is not unsafe, it's a tool, it's the way you use it that is unsafe
07:07:23FromDiscord<Elegantbeef> cool it's also still going to error
07:07:24FromDiscord<Elegantbeef> Ok whatever
07:08:28FromDiscord<Elegantbeef> Ok
07:08:30FromDiscord<Elegantbeef> It's a terrible language with a terrible type system, so i dont really care about the technicalities
07:09:17FromDiscord<4zv4l> you cannot tell bad from a language that is that old
07:09:23FromDiscord<exelotl> I'm with beef on this one, we have decades of evidence to show that even the smartest programmers can't reliably write C code without security holes
07:09:25FromDiscord<4zv4l> they did what they could with the experience they had
07:09:39FromDiscord<Elegantbeef> No you cant argue that
07:09:40FromDiscord<Elegantbeef> Pascal literally existed
07:09:44FromDiscord<exelotl> ^
07:09:49FromDiscord<Elegantbeef> Like fuck off with the age argument
07:09:56FromDiscord<Elegantbeef> Pascal is as old as C but doesnt have nearly as many flaws
07:10:02FromDiscord<4zv4l> well
07:10:12FromDiscord<4zv4l> why did everyone took C over Pascal if Pascal was that good ?
07:10:15FromDiscord<Rika> Bet he’s gonna pull out the “
07:10:16FromDiscord<Rika> Yeah
07:10:16FromDiscord<Elegantbeef> Cause it has a better type system and more intelligently designed language
07:10:27FromDiscord<Elegantbeef> Cause Unix was written in C and it became the defacto OS base
07:10:28FromDiscord<xzntrc> language please guys :(
07:10:31FromDiscord<Rika> In reply to @4zv4l "why did everyone took": Because Unix took C and everyone went with that
07:10:42FromDiscord<Prestige> In reply to @xzntrc "language please guys :(": Nim
07:11:01FromDiscord<Prestige> beta > vhs
07:11:02FromDiscord<Elegantbeef> xzntrc i swear a lot if you dont like it i guess i'm sorry
07:11:10FromDiscord<xzntrc> nah im kidding
07:11:12FromDiscord<Prestige> classic canada
07:11:30FromDiscord<xzntrc> well i'm finally converting my shell to nim!
07:11:33FromDiscord<Rika> In reply to @Elegantbeef "xzntrc i swear a": No fuck you smh
07:11:37FromDiscord<xzntrc> sent a code paste, see https://play.nim-lang.org/#ix=46Tj
07:11:49FromDiscord<Rika> Have you looked at the terminal module
07:11:56FromDiscord<Elegantbeef> xzntrc look in `terminal` for making your escape code disappear
07:11:56FromDiscord<xzntrc> yes, why?
07:11:57FromDiscord<Elegantbeef> Fuck you rika
07:12:02FromDiscord<Prestige> Lmao
07:12:03FromDiscord<Elegantbeef> You god damn well know what i was going to say
07:12:10FromDiscord<xzntrc> fuck you both
07:12:13FromDiscord<Rika> Yeah your brain too slow
07:12:19FromDiscord<Rika> In reply to @xzntrc "fuck you both": No thanks
07:12:23FromDiscord<Prestige> This is the kinda chat I like to see
07:12:43FromDiscord<Elegantbeef> Anyway for the Pascal vs C argument look at `myStruct` in C what does that mean?
07:12:46FromDiscord<xzntrc> `getCurrentDir()` returns `/home/xzntrc/Documents/nim`, I couldn't find a way to return just the end (`nim`)
07:12:46FromDiscord<Elegantbeef> It's a simple question 😄
07:13:10FromDiscord<Elegantbeef> `getCurrentDir().splitPath.tail`
07:13:22FromDiscord<xzntrc> oh thanks bro
07:13:30FromDiscord<xzntrc> I feel like im leaching off you guys to make this
07:13:32FromDiscord<Rika> “I’m not your bro, pal”
07:13:38FromDiscord<Elegantbeef> You are being spoonfed
07:13:57FromDiscord<Rika> Ditch the spoon eat with your hands
07:14:00FromDiscord<xzntrc> Yeah I'm sorry, I don't like spoonfeeding. It's just the docs are so long, and I only have limited time left to this weekend.
07:14:23FromDiscord<Prestige> The searchability isn't great imo
07:14:39FromDiscord<Prestige> So we just beef as our AI to ask random questions
07:15:07FromDiscord<Elegantbeef> I mean i'd argue but clearly i dont have any intelligence so it must be artificially imposed
07:15:24FromDiscord<xzntrc> kek
07:15:36FromDiscord<Rika> I am a part of beef which is why I can answer at least as well as him
07:15:49FromDiscord<Elegantbeef> Ah explains the small wee-wee
07:16:03FromDiscord<xzntrc> what has this chat descended to
07:16:08FromDiscord<Elegantbeef> Dick jokes
07:16:13FromDiscord<Elegantbeef> Robin williams would be proud
07:16:15FromDiscord<Rika> You’ve seen???
07:16:28FromDiscord<xzntrc> guys, I'm a minor.
07:16:29FromDiscord<Prestige> Beef always carries a magnifying glass
07:16:43FromDiscord<Elegantbeef> Never know when i might run into you↵(@Prestige)
07:16:51FromDiscord<xzntrc> massive rule violation here guys!!
07:16:53FromDiscord<xzntrc> `- No pornographic, disturbing, or any other content that can be considered as questionable or NSFW.`
07:17:14FromDiscord<Elegantbeef> Hey it says no disturbing, i havent post a selfie
07:17:17FromDiscord<Prestige> Where did you read that
07:17:24FromDiscord<xzntrc> In reply to @Avahe "Where did you read": in the fucking rules?
07:17:37FromDiscord<Prestige> Holy shit, there are rules?
07:17:48FromDiscord<Rika> Prestige’s getting banned
07:18:00FromDiscord<Rika> It was nice knowing you
07:18:06FromDiscord<xzntrc> In reply to @Avahe "Holy shit, there are": >quickly deletes all mentions of racism
07:18:26FromDiscord<Rika> In reply to @xzntrc ">quickly deletes all mentions": Sus
07:18:29FromDiscord<Prestige> rip
07:19:02FromDiscord<Prestige> I actually never noticed the rules channel, gotta check this out
07:19:32FromDiscord<Prestige> `- Use common sense.`
07:19:37FromDiscord<Prestige> Half the chat about to get banned
07:19:42FromDiscord<Rika> Ah fuck
07:19:46FromDiscord<Rika> See y’all
07:19:49FromDiscord<xzntrc> can we atone for our sins
07:19:50FromDiscord<Elegantbeef> Jonestown it is
07:20:17FromDiscord<Rika> Take refuge in the disruptek channel
07:20:39FromDiscord<xzntrc> one of my friends recently started making a language, I wanna personally make one soon
07:21:01FromDiscord<Rika> It’s hard if you’re aiming for viability for everyday use
07:21:06FromDiscord<xzntrc> yeah :(
07:21:13FromDiscord<Prestige> Good learning experience I bet
07:21:25FromDiscord<Elegantbeef> Just name it carbon↵(@Rika)
07:21:42FromDiscord<Rika> Naming my next language Carbide
07:21:43FromDiscord<xzntrc> haha
07:21:54FromDiscord<Prestige> Carboff
07:22:03FromDiscord<Elegantbeef> Fork nim add curlies call it carbide
07:22:41FromDiscord<Elegantbeef> What happened to the pascal argument
07:22:44FromDiscord<Rika> Fork Nim add curries call it Nin short for nincompoop
07:22:45FromDiscord<Elegantbeef> It was going to be so fun
07:22:56FromDiscord<Elegantbeef> Also rika re you proud of me i now instinctively write argument
07:23:08FromDiscord<Rika> Congrations
07:23:33FromDiscord<Elegantbeef> Tanks
07:23:48FromDiscord<Prestige> I guess you won
07:23:59FromDiscord<Elegantbeef> I'll be dick twirling if anyone needs me
07:24:11FromDiscord<Prestige> don't lose the tweezers
07:24:16FromDiscord<Rika> Beef is just a watered down Disruptek
07:24:27FromDiscord<Prestige> I miss that guy
07:25:17FromDiscord<Rika> He was fun but I could also see him having scared off a lot of new people lol
07:26:10FromDiscord<Elegantbeef> cannot tell if i should be offended or complimented↵(@Rika)
07:26:15FromDiscord<Prestige> If people are scared off by mildly strong language, I don't really consider it a loss
07:29:08FromDiscord<Elegantbeef> Eh i help more than i scare i'd hope
07:29:30FromDiscord<xzntrc> just confusing why procs use `=` but whiles and shit use `:`
07:29:34FromDiscord<xzntrc> just seems inconsistent
07:30:14FromDiscord<Prestige> `=` is for assignment
07:30:25FromDiscord<Elegantbeef> We'll go with `proc a(): ` is ambiguous if it's type or body
07:30:51FromDiscord<xzntrc> right
07:30:58FromDiscord<xzntrc> so why doesn't it use curly braces tho
07:31:12FromDiscord<Elegantbeef> Why would it?
07:31:12FromDiscord<Prestige> was just a style choice
07:31:16FromDiscord<xzntrc> alg alg
07:31:21FromDiscord<Prestige> but think of `=` as assignment for the proc
07:31:23FromDiscord<xzntrc> also, has anyone made a shell already for nim?
07:31:27FromDiscord<Rika> I believe so
07:31:36FromDiscord<Elegantbeef> https://github.com/search?q=shell+language%3Anim
07:31:39FromDiscord<Elegantbeef> Cmon people!
07:31:40FromDiscord<Rika> I feel like I recall someone asking similar questions to you
07:34:10FromDiscord<Prestige> Elegantbeef: How's your game coming?
07:34:28FromDiscord<Elegantbeef> I havent wrote any code for a few weeks now
07:34:31FromDiscord<xzntrc> In reply to @Elegantbeef "https://github.com/search?q=shell+language%3Anim": those arent like shells like bash and shit tho
07:34:32FromDiscord<Elegantbeef> So... not
07:34:41FromDiscord<xzntrc> for example the top most one is a repl
07:34:57FromDiscord<xzntrc> alr
07:35:23FromDiscord<Prestige> Dang, I was hoping to see a finished game sometime
07:35:30FromDiscord<Elegantbeef> Ok i should say i havent wrote any code that's actually significant anytime recently
07:35:44FromDiscord<Prestige> I'm porting one of my games from Godot to my engine in nim, nearly finished
07:35:53FromDiscord<Elegantbeef> Brag about it why dont you
07:36:31FromDiscord<Elegantbeef> I did write that shitty CLI parser, but aside from that it's pretty much a barren month of lacking want to code
07:36:34FromDiscord<xzntrc> oh yeah shit I got an assignment coming up for IST class, have to make a game
07:36:34FromDiscord<Prestige> I want to move on to a project that I'll actually be marketing, going to be a long term project
07:36:44FromDiscord<xzntrc> should make it in nim when I'm not retarded
07:38:25FromDiscord<Prestige> Could be a good way to learn nim
07:38:49FromDiscord<Elegantbeef> Aw shit you're thinking of learning how to write Nim prestige?!
07:39:06FromDiscord<Prestige> Lol
07:39:11FromDiscord<Prestige> Every day, beef
07:40:54FromDiscord<valerga> smoke beef erryday
07:41:08FromDiscord<Elegantbeef> Even though it's legal no i dont
07:42:10FromDiscord<valerga> having a "everything is invented" moment
07:42:38FromDiscord<valerga> but then i'll read some HN post of something really clever
07:51:14*rockcavera quit (Remote host closed the connection)
07:58:17FromDiscord<untoreh> why does this deadlocks sometimes?
07:58:20FromDiscord<untoreh> sent a code paste, see https://play.nim-lang.org/#ix=46To
07:58:46FromDiscord<untoreh> (edit) "deadlocks" => "deadlock"
08:02:03FromDiscord<Elegantbeef> Why are you using async instead of just a channel?
08:02:55FromDiscord<untoreh> this is like, middleware for an async server
08:03:41FromDiscord<Elegantbeef> Well you return an address to a sequence which is going to get GC'd on function exit
08:04:00FromDiscord<Elegantbeef> So this is why we avoid `ptr`
08:04:14FromDiscord<untoreh> initially it was ptrless
08:04:19FromDiscord<untoreh> same thing
08:04:31FromDiscord<Elegantbeef> So you made it more complicated to share
08:04:46FromDiscord<untoreh> it was just the last iteration :S
08:06:22FromDiscord<Elegantbeef> You have no lock on `qin` but use it from the main thread and secondary thread
08:07:20FromDiscord<Elegantbeef> Same with qout
08:08:15FromDiscord<Elegantbeef> Also worth noting using Async stuff across threads like this probably doesnt work
08:08:57FromDiscord<Elegantbeef> I dont know what the AsyncQueues are so cannot say for certainty
08:09:00FromDiscord<Elegantbeef> This is just all very suspect code
08:09:16FromDiscord<xzntrc> is there an appropriate way to write configs?
08:09:23FromDiscord<xzntrc> I know in rust they use TOML
08:09:28FromDiscord<xzntrc> in js they use JSON, obviously.
08:09:30FromDiscord<Elegantbeef> Nim uses nimscript
08:09:39FromDiscord<PyryTheBurger> how do i get all files in a directory
08:09:39FromDiscord<Elegantbeef> `config.nims`
08:09:45FromDiscord<PyryTheBurger> the number of files
08:09:50FromDiscord<Elegantbeef> `walkDir` inside of os↵(@PyryTheBurger)
08:10:07FromDiscord<xzntrc> ty beef
08:10:21FromDiscord<valerga> beef just answered like 3 questions in 30 seconds
08:10:39FromDiscord<xzntrc> godspeed
08:10:58FromDiscord<Elegantbeef> Yea it's what i do val
08:11:12FromDiscord<xzntrc> wow I think this shell is gonna be a piece of cake
08:11:21FromDiscord<xzntrc> might replace bash with it on my laptop after im done
08:12:22FromDiscord<valerga> you're writing a shell?
08:12:34FromDiscord<valerga> i think fish is fine enough
08:12:46FromDiscord<Elegantbeef> A fellow fish enjoyer
08:13:01FromDiscord<xzntrc> NOOO
08:13:10FromDiscord<xzntrc> I still wanna try it
08:13:30FromDiscord<xzntrc> also i plan to keep this shell minimal
08:13:48FromDiscord<xzntrc> simply one file for now
08:13:52FromDiscord<xzntrc> https://media.discordapp.net/attachments/371759389889003532/1005750611343593523/unknown.png
08:13:57FromDiscord<Rika> You can try it but I don’t think it would be practical in daily use
08:14:04FromDiscord<xzntrc> how so?
08:14:09FromDiscord<xzntrc> If I spend enough time on it
08:14:14FromDiscord<xzntrc> then it may
08:14:34FromDiscord<Rika> Enough time being a lot of time
08:15:59FromDiscord<enthus1ast> "linux shells" "enjoy" \:D
08:16:15FromDiscord<Elegantbeef> Fish is fucking lovely!
08:16:35FromDiscord<enthus1ast> it cant, since its a linux shell, operating on string soups
08:16:35FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1005751297754026025/image.png
08:16:39FromDiscord<Elegantbeef> Look at that autocomplete
08:17:46FromDiscord<Elegantbeef> It's ok to be wrong i wont hold it against you
08:17:50FromDiscord<Rika> It’s not too bad in fish because they also have arrays
08:18:17FromDiscord<Elegantbeef> Fish is quite a good shell though not mainstream and lacks bash support
08:18:46FromDiscord<Rika> The reason it’s good is because it lacks bash support xddddd
08:18:56FromDiscord<Elegantbeef> https://fishshell.com/assets/img/screenshots/scripting.png like it's a readable language
08:19:14FromDiscord<Elegantbeef> Pretty much rika, no backwards compatibility so it can be sensible
08:19:33FromDiscord<enthus1ast> i always feel awkward, setting up systems, splitting and cutting and awking, and grepping in linux/unix shells, ↵the powershell approach is faaar superior (i do not like powershell either btw...)
08:19:52FromDiscord<Elegantbeef> Ok
08:20:09FromDiscord<enthus1ast> since they have real datatypes, like tables
08:20:19FromDiscord<enthus1ast> and commands actually output tables
08:20:24FromDiscord<enthus1ast> not text
08:20:59FromDiscord<enthus1ast> so you can say\: give me this row column, and thats an int
08:21:15FromDiscord<Elegantbeef> I've persoanlly never needed that so... ok
08:21:47FromDiscord<Rika> Well again fish has arrays so
08:21:58FromDiscord<Rika> At least the table part is mitigated
08:22:22FromDiscord<Rika> I think the benefit of powershell dissolves once you use regular executables as commands
08:22:25FromDiscord<enthus1ast> yeah, but the commands the GNU/Linux uses, just outputs text↵(@Rika)
08:23:47FromDiscord<Rika> In reply to @enthus1ast "yeah, but the commands": You mean the same other commands windows uses as well?
08:23:56FromDiscord<Rika> Built ins in fish use the array system
08:25:00FromDiscord<Elegantbeef> Yea i dont have much usage of shells aside from using it as a CLI to say anything
08:25:18FromDiscord<Elegantbeef> Fish makes me happier to use my terminal which makes me feel obligated to say it's better than anything windows has
08:25:47FromDiscord<Elegantbeef> If you're writing programs in shell languages i feel you've strayed from the light
08:26:10FromDiscord<Rika> If you’re programming anything at all you’ve already strayed from the light
08:28:34FromDiscord<enthus1ast> https://gist.github.com/enthus1ast/1cc83ca38c5d5b79cfaa88990711d03c
08:30:08FromDiscord<enthus1ast> yeah, i understand, no bashing on my side; this is only stuff i notice when writing shell scripts on different os'es.
08:31:55FromDiscord<enthus1ast> i'm not fluent in both, linux or windows scritping, but just do the stuff i need in nim or python
08:32:25FromDiscord<xzntrc> still nothing wrong with making a shell right?
08:32:53FromDiscord<enthus1ast> naah
08:33:01FromDiscord<enthus1ast> cool project
08:35:14FromDiscord<xzntrc> so can I make my own .nims files?
08:35:39FromDiscord<xzntrc> https://nim-lang.org/docs/nims.html doesn't help
08:37:02FromDiscord<xzntrc> oh wait nvm: https://nim-lang.org/docs/parsecfg.html
09:11:57*kenran joined #nim
09:13:26*kenran quit (Client Quit)
09:23:23FromDiscord<Phil> Meanwhile, I'm just sitting here, actually really enjoying crapping together 5-10 line scripts to combine 5 commands into 1
09:23:45FromDiscord<Phil> (edit) "Meanwhile, I'm just sitting here, actually really enjoying ... crapping" added "bash and"
09:28:20FromDiscord<!&luke> This server is so active compared to the servers for some other languages
09:28:46FromDiscord<Phil> is it?
09:29:20FromDiscord<!&luke> Yea
09:29:35FromDiscord<Phil> I only have Rust as a comparison 10 months ago, that was almost spammy active but the ratio of askers to helpers was like 5:1
09:29:35FromDiscord<!&luke> 30second response
09:29:55FromDiscord<Phil> Fair point
09:30:36FromDiscord<!&luke> Elixir is still quite active I would say 2 minutes on a good day but usually less than 5 minutes
09:30:43FromDiscord<!&luke> Zig is also quite active
09:30:59FromDiscord<!&luke> Dart is dead
09:32:05FromDiscord<!&luke> Like dead enough that I haven't gotten a response in 2 days
09:32:09FromDiscord<!&luke> https://media.discordapp.net/attachments/371759389889003532/1005770307006627861/IMG_1877.png
09:33:34FromDiscord<xzntrc> In reply to @ripluke "This server is so": bro im in the Jetbrains community, and the last message sent was from me
09:33:36FromDiscord<xzntrc> ... yesterday
09:34:07FromDiscord<xzntrc> https://media.discordapp.net/attachments/371759389889003532/1005770804635643964/unknown.png
09:34:14FromDiscord<xzntrc> mind you there are 800 FUCKING MEMBERS ONLINE RN
09:34:18FromDiscord<Phil> bwahahaha
09:34:40FromDiscord<Phil> Actually, before we derail the channel to much, that kind of convo I think makes sense to have in offtopic to keep the language specific questions in here
09:34:50FromDiscord<xzntrc> right soz
09:35:04FromDiscord<Phil> No worries, I'm not great in that regard either ^^
09:36:09FromDiscord<Phil> Rika yesterday told me about the high level stuff around async await, I'm still wondering on the low-level side is a callback of sorts that one could manipulate.↵I don't have any practical ideas around that, I'm just wondering
09:36:16*pro joined #nim
09:37:00FromDiscord<Phil> (edit) "Rika yesterday told me about the high level stuff around async await, I'm still wondering ... onit" added "whether" | "is" => "it just waits for" | "of sorts" => "to evaluate to tree before it continues the code and whether you can access" | "one could manipulate.↵I" => "callback, maybe even manipulate it.↵I"
09:37:14FromDiscord<Phil> (edit) "tree" => "true"
09:37:22FromDiscord<Phil> God damnit I can not type for shit this day
09:37:34FromDiscord<xzntrc> lol
09:37:43FromDiscord<xzntrc> how is `existsOrCreateDir` supposed to be used?
09:37:49FromDiscord<xzntrc> I cant understand the docs lol
09:38:04FromDiscord<Phil> You mean what it does?
09:38:48FromDiscord<Phil> I assume the string to throw in is a valid file path, depending on the situation a relative or absolute one
09:39:00FromDiscord<xzntrc> how would you use it in code?
09:39:09FromDiscord<xzntrc> im slightly confused on understanding these docs
09:39:17FromDiscord<!&luke> In reply to @xzntrc "how is `existsOrCreateDir` supposed": If the doesn't exist create it
09:39:38FromDiscord<xzntrc> so what I just use:↵`existsOrCreateDir(path)`↵?
09:39:40FromDiscord<xzntrc> that simple?
09:39:44FromDiscord<!&luke> Yea
09:40:00FromDiscord<Phil> `existsOrCreateDir("/home/user/phil/dev/nimstoryfont/newDirIWantToCreate")`
09:40:00FromDiscord<!&luke> Path would be a string
09:40:19FromDiscord<xzntrc> sent a code paste, see https://play.nim-lang.org/#ix=46Tz
09:40:33FromDiscord<!&luke> put discard in front of it
09:40:41FromDiscord<Phil> Ah, check,do you care whether it actually created the dir or did not do so since it already existed?
09:40:46FromDiscord<Phil> If no, just put "discard" in front of it
09:40:53FromDiscord<!&luke> discard existsOrCreareDir(patg)
09:40:58FromDiscord<!&luke> (edit) "existsOrCreareDir(patg)" => "existsOrCreareDir(path)"
09:41:08FromDiscord<!&luke> (edit) "existsOrCreareDir(path)" => "existsOrCreateDir(path)"
09:41:13FromDiscord<xzntrc> ohhh right sorry!
09:41:21FromDiscord<!&luke> Why not just use createDir tho
09:41:28FromDiscord<Phil> Unlike python, nim does not like you using procs that return something and then not doing anything with the return.↵It wants to enforce that you intentionally do not do something with the return instead of risking that you forgot about it
09:41:38FromDiscord<!&luke> In reply to @ripluke "Why not just use": If you don't care about the dir existing
09:41:45FromDiscord<xzntrc> In reply to @ripluke "If you don't care": i do care.
09:41:51FromDiscord<xzntrc> I dont want it to overwrite shit inside it
09:42:06FromDiscord<!&luke> I don't think createDir does that
09:42:13FromDiscord<Rika> In reply to @Isofruit "Rika yesterday told me": The future is registered to the dispatcher and it is checked every few times by the main event loop (that’s what the loop in run forever does)
09:42:46FromDiscord<Rika> Once the future completes it is removed from the registration, which is why run forever raises an exception when all your futures complete
09:43:01FromDiscord<Rika> At least that’s how I know it
09:43:21FromDiscord<Rika> You can get even lower level than this but it goes into the details of how the polling is done in the OS
09:43:49FromDiscord<!&luke> What is the difference between async and a coroutine
09:43:58FromDiscord<Rika> Asynchronous functions are just closure iterators for the “stop here then start here again when needed”
09:44:01FromDiscord<Rika> Functionality
09:44:15FromDiscord<Rika> Functionally none I believe
09:44:26FromDiscord<Rika> More work with the coroutine
09:44:36FromDiscord<!&luke> Oh
09:45:14FromDiscord<Phil> In reply to @xzntrc "I dont want it": Just checked in my playground project:↵If you "create a dir that already exists" the operation does essentially nothing
09:45:26FromDiscord<Phil> It doesn't even change access permission or owners of the folder
09:45:30FromDiscord<!&luke> In reply to @Isofruit "Just checked in my": Yea I always just use createDir
09:45:33FromDiscord<Rika> Async can be a wrapper for coroutines
09:45:40FromDiscord<Rika> Coroutines have more uses than async
09:45:49FromDiscord<!&luke> In reply to @ripluke "Yea I always just": Saves a check of dirExists
09:45:51FromDiscord<Rika> Async can be implemented with a different method than coroutines
09:46:02FromDiscord<xzntrc> In reply to @Isofruit "Just checked in my": cool, I ended up using it as a bool and getting the value anyways
09:46:19FromDiscord<!&luke> In reply to @Rika "Async can be implemented": Oh
09:46:35FromDiscord<!&luke> In reply to @xzntrc "cool, I ended up": Do you use the value for anything?
09:46:42FromDiscord<xzntrc> In reply to @ripluke "Do you use the": yep.
09:46:57FromDiscord<!&luke> Oh ok
09:47:08FromDiscord<Phil> In reply to @Rika "You can get even": Hmmm and once the future completes that triggers an event that informs the await that it is done and the code can continue?↵So it's not like it's calling an evaluating a specific callback over and over again, hmm
09:47:16FromDiscord<xzntrc> sent a code paste, see https://play.nim-lang.org/#ix=46TD
09:48:30FromDiscord<!&luke> sent a code paste, see https://play.nim-lang.org/#ix=46TF
09:48:30FromDiscord<xzntrc> In reply to @ripluke "Why not just use": 😭
09:48:40FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=46TG
09:48:51FromDiscord<xzntrc> sure i'm open to taking feedback
09:49:06FromDiscord<!&luke> In reply to @xzntrc "😭": Saves you and if chech
09:49:08FromDiscord<xzntrc> dumping everything on my git: https://git.kiwifarms.net/xzntrc/xshellNim
09:49:09FromDiscord<!&luke> (edit) "chech" => "check"
09:49:13FromDiscord<Phil> I know more about logging after having to deal with log4j-buggs than I ever wanted to know
09:49:33FromDiscord<!&luke> (edit) "and" => "an"
09:49:47FromDiscord<!&luke> (edit) "an if" => "a"
09:50:18FromDiscord<Phil> At least I'm not the only one today that needs to make use of the edit button way too often
09:51:03FromDiscord<!&luke> What edit button
09:56:55FromDiscord<aph> sent a code paste, see https://play.nim-lang.org/#ix=46TK
09:57:20FromDiscord<aph> (edit) "https://play.nim-lang.org/#ix=46TK" => "https://play.nim-lang.org/#ix=46TL"
09:57:57FromDiscord<Phil> Futhark is out of my wheelhouse, is Pmunch around or beef still around?
09:59:27FromDiscord<aph> ah, ima ask another time when they're here, thx
10:00:07FromDiscord<Phil> Apologies... I really should start actually wrapping something in futhark, solely in order to shake off my fear of C and wrapping its code
10:00:45FromDiscord<Phil> Though just thinking about how apparently for an array you just pass a pointer to the first element makes me angry
10:00:45FromDiscord<Rika> Many people fear the C
10:01:09FromDiscord<aph> In reply to @aph "hiii, i got this": oh wait, i can just add a header file, i think it's just header file hell, once i added unistd.h i'm missing getopt
10:01:14FromDiscord<aph> :)
10:01:25FromDiscord<!&luke> I hate c code, everything is snake_cased
10:01:35FromDiscord<!&luke> It's just unreadable to me
10:02:37FromDiscord<aph> In reply to @Isofruit "Apologies... I really should": lol, me2
10:05:42FromDiscord<Phil> In reply to @Rika "Many people fear the": The very valid fear to drown in it!
10:08:33*xcodz-dot joined #nim
10:08:41xcodz-dotping
10:09:00xcodz-dotanyone?
10:11:41*neceve joined #nim
10:12:03FromDiscord<Phil> pong
10:12:29xcodz-dotHey Phil, are you on the nim compiler team?
10:12:49FromDiscord<Phil> I am way too incompetent for that↵I have understood my first macro around a week ago 😄
10:13:23FromDiscord<Phil> If you want webdev advice I can design you an entire tech stack and architecture advice on prologue though ^^
10:13:48xcodz-dotwell, unfortunately I am a backend guy :)
10:13:51FromDiscord<Phil> And general advice for language capabilities and more in-depth playing around with generics
10:14:05FromDiscord<Phil> Prologue is a backend-server xP
10:14:45xcodz-dotoh, i thought prologue was some sort of english word as you can prolly tell, English isnt my native language.
10:14:46FromDiscord<Phil> I got exposed to a fair amount of what nim can do in the webdev space by writing my backend in it, frontend is angular though
10:15:13xcodz-dotyou can try frontend with nim, it supports js backend
10:16:10FromDiscord<Phil> sent a long message, see http://ix.io/46TQ
10:17:03FromDiscord<Phil> And yeah you can do frontend in nim, but in the end it's all JS anyway and it's not like JS is an incredibly hard language to write.↵Particularly with all the tooling it has I'm pretty comfortable with a separate frontend
10:17:14FromDiscord<Rika> Prologue is indeed an English word
10:17:20FromDiscord<Rika> It coincides with the Nim library
10:17:30xcodz-dothmm
10:18:03xcodz-dotDoes matrix also support anonymous login like IRC does?
10:18:10xcodz-dotthis IRC tech is really ancient
10:18:21FromDiscord<xzntrc> IRC itself is ancient
10:18:38FromDiscord<xzntrc> i personally prefer xmpp
10:21:48xcodz-dotanyone knows how am I suppose to generate docs for my nimble project
10:21:54xcodz-dot?
10:23:56FromDiscord<Rika> No matrix requires a home server and an account I believe
10:24:04*PMunch joined #nim
10:25:21xcodz-dotbtw, nimble doc requires filename, How am I suppose to gen docs then for multimod project?
10:26:35FromDiscord<amadan> If you have a main module that imports the other modules then adding `--project` flag will generate docs for the other modules
10:27:37xcodz-dotthanks, I do infact have a main module.
10:51:36FromDiscord<exelotl> xmpp seems really underrated tbh
10:51:53FromDiscord<exelotl> I set it up recently but don't have any contacts lol
11:02:37*arkurious joined #nim
11:16:12*xcodz-dot quit (Quit: Leaving)
11:32:01FromDiscord<!&luke> Can futhark use pkg-config
11:40:07FromDiscord<Rika> Use what?
11:41:40FromDiscord<!&luke> Package config
11:41:49FromDiscord<!&luke> To dynamically link
11:42:00FromDiscord<!&luke> (edit) "Package config" => "pkg-config"
11:42:08FromDiscord<!&luke> In reply to @ripluke "pkg-config": It's a Linux thing
11:42:22FromDiscord<!&luke> In reply to @ripluke "To dynamically link": It finds your c libraries
11:42:32FromDiscord<!&luke> And gives you their paths
11:43:59FromDiscord<!&luke> Maybe using --passL
11:46:55FromDiscord<hotdog> @!&luke You could call out to `pkg-config` and use the output
11:47:09FromDiscord<hotdog> Should be pretty straightforward
12:18:10FromDiscord<!&luke> I can't get it with passL as I have to set the path in the file itself
12:27:16FromDiscord<!&luke> Pmunch or beef can you help me
12:30:17*pro quit (Quit: pro)
12:31:19PMunchYou can use pkg-config
12:32:42FromDiscord<!&luke> In reply to @PMunch "You can use pkg-config": Yes but how lol because I have to specify the path in the file and not from the command line while compiling
12:34:26PMunchWhat's the output of pkg-config?
12:37:36FromDiscord<!&luke> sent a code paste, see https://play.nim-lang.org/#ix=46Uz
12:38:15PMunchOkay, that all looks fine
12:38:31PMunchThe path you pass to Futhark just needs to contain the header files you want to import
12:39:23FromDiscord<!&luke> what
12:39:26*jmd_ quit (Ping timeout: 240 seconds)
12:40:03FromDiscord<!&luke> i want to use package config so that i can dynamically link
12:40:26PMunchYeah, that's what I do as well
12:40:36PMunchBut you still need to import headers
12:41:12PMunchSo you need the -I statements, not the -L
12:41:20FromDiscord<!&luke> sent a code paste, see https://play.nim-lang.org/#ix=46UE
12:41:49PMunchWhat is that define for?
12:42:02PMunchWhere is the vips path?
12:43:22FromDiscord<!&luke> Like in a c file I would use ↵#include <vips/vips.h>
12:43:42FromDiscord<!&luke> That's why I put vips as the path
12:44:12FromDiscord<!&luke> I don't have a vips dir I thought that pkg-config would be able to find it
12:44:29FromDiscord<!&luke> (edit) "I don't have a vips dir ... I" added "(in that directory)"
12:44:30PMunchSo path needs to be "/usr/include/vips" and then import "vips.h"
12:44:41FromDiscord<!&luke> Oh
12:46:17PMunchYou could of course parse the output of `pkg-config --cflags-only-I` in a macro and pass that to futhark
12:50:32FromDiscord<!&luke> I am not able to run any of the functions from the library lol
12:57:24FromDiscord<!&luke> PMunch: I can't use any of the functions...
12:57:49FromDiscord<!&luke> It says undeclared identifier
12:57:49PMunchThen you've done something wrong
12:58:27FromDiscord<!&luke> Do I passL?
12:58:33PMunchYes
12:58:56FromDiscord<!&luke> And do I pass the file or the directory that the file is
12:59:05PMunchYou do --passsL:"`pkg-config command`"
12:59:12FromDiscord<!&luke> Oh
12:59:58PMunchYou pass the folder where each file you need to import is with `path` and then the files you'd normally import in C with just a normal string at the end
13:00:35FromDiscord<!&luke> What
13:04:31PMunchJust do what I explained earlier
13:10:09FromDiscord<!&luke> In reply to @PMunch "Just do what I": Doing that I get the error invalid command line option -I
13:10:44PMunchDid you pass --libs or whatever it is to pkg-config?
13:11:27FromDiscord<!&luke> In reply to @PMunch "You could of course": I used this command
13:11:29PMunchIt looks like you messed up your passL thing
13:12:06FromDiscord<!&luke> nimble build --passL:"$(pkg-config --cflags-only-I vips)"
13:12:14FromDiscord<!&luke> The command I used
13:12:26PMunchYeah, you can't pass I flags to passL
13:12:38PMunchYou need to use pkg-config --libs I believe
13:12:45FromDiscord<!&luke> oh
13:13:28FromDiscord<!&luke> nope
13:13:44PMunchThe cflags-only-I was in case you wanted to parse the output of that command in a macro and pass it to Futhark instead of using `path`
13:13:44FromDiscord<!&luke> sent a code paste, see https://play.nim-lang.org/#ix=46UR
13:14:02FromDiscord<!&luke> the command: nimble build --passL:"$(pkg-config --libs vips)"
13:14:43PMunchIt doesn't appear to properly encapsulate the output of pkg-config in passL
13:15:06FromDiscord<!&luke> hmm?
13:15:30FromDiscord<!&luke> it does get the output
13:15:37FromDiscord<!&luke> the error shows that
13:15:45PMunchYes put it doesn't properly put it in quotes
13:16:00PMunchSo not everything is passed along to passL, some of it is parsed as commands to Nim, which fails
13:17:07FromDiscord<!&luke> ok yea the passL worked in double quotes
13:17:19FromDiscord<!&luke> but now none of the functions work
13:17:52FromDiscord<!&luke> sent a code paste, see https://play.nim-lang.org/#ix=46US
13:27:19PMunchAnd the error?
13:27:56PMunchAh VIPS_INIT is a macro, not a function
13:28:07PMunchFunction macros aren't well supported
13:28:35PMunchTry to call vips_init instead
13:28:40FromDiscord<!&luke> ok
13:30:57FromDiscord<!&luke> Nope that doesn't work
13:31:11FromDiscord<!&luke> Neither do any of the other functions in the library
13:33:31PMunchAnd /usr/include/vips exists?
13:33:38FromDiscord<!&luke> Yup
13:33:51PMunchAnd it has vips.h in it?
13:33:59FromDiscord<!&luke> Yup
13:34:08PMunchHmm, try to delete your Nim cache
13:34:20FromDiscord<!&luke> vips says this https://www.libvips.org/API/current/binding.html
13:35:13PMunchWell, I'm off to make dinner now
13:35:22PMunchSo I won't be able to help more right now
13:35:53FromDiscord<!&luke> Ok
13:47:47FromDiscord<voidwalker> any way to get an xml file from a XmlNode object I obtained with parseHtml ? I've no idea what I'm doing/looking for, to get the data I need
13:48:30FromDiscord<voidwalker> ` <td class="result_text"> <a href="/title/tt0133093/?ref_=fn_tt_tt_1">Matrix</a> (1999) </td>`
13:50:43FromDiscord<voidwalker> Oh I got it. It's html.findAll("td"), td.innerText
13:51:00Amun-Raif the data structure does not change, perhaps try regexp, it's better than parsing xml with html parser
13:51:20Amun-Rawell, nvm
13:51:36Amun-Raplease disregard what I wrote above
14:30:10FromDiscord<Forest> How do i use a library after compiling with futhark?
14:54:54FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46Vr
14:55:23FromDiscord<voidwalker> would this code be normally be able to cause `SIGSEGV: Illegal storage access. (Attempt to read from nil?)` ?
14:58:23FromDiscord<Phil> is result a ref type?
14:58:24FromDiscord<voidwalker> seems to crash at /usr/lib/nim/pure/strtabs.nim(207) hasKey
14:59:06FromDiscord<voidwalker> happens without that line, if i put discard
14:59:21FromDiscord<voidwalker> /home/sgm/igma/imdb.nim(274) myGetIMDBTitleSearch↵/usr/lib/nim/pure/strtabs.nim(207) hasKey↵/usr/lib/nim/pure/strtabs.nim(133) rawGet↵/usr/lib/nim/pure/strtabs.nim myhash
14:59:39FromDiscord<voidwalker> (edit) "/home/sgm/igma/imdb.nim(274) myGetIMDBTitleSearch↵/usr/lib/nim/pure/strtabs.nim(207) hasKey↵/usr/lib/nim/pure/strtabs.nim(133) rawGet↵/usr/lib/nim/pure/strtabs.nim myhash" => "sent a code paste, see https://play.nim-lang.org/#ix=46Vt"
15:01:15*oprypin quit (Quit: Bye)
15:01:32*oprypin joined #nim
15:03:12FromDiscord<Phil> a is of type XmlNode, which is a ref-type.↵I assume that some of your a's are nil? Did you check for that?
15:03:52FromDiscord<voidwalker> hm nope, I thought they can't be nil if they are found
15:04:00FromDiscord<voidwalker> what is a nil XmlNode anyway
15:04:40FromDiscord<Phil> No clue where it would come from. I can only say what I'm seeing, which is that somewhere you likely have a ref-type that you're accessing but that has no memory allocated for it
15:06:05FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46VC
15:06:10FromDiscord<voidwalker> same crash
15:09:09FromDiscord<Phil> Ohhh XMLAttributes which you nab via attrs is also a ref type
15:09:11FromDiscord<Phil> Check if that is nil?
15:09:36FromDiscord<Phil> Might be nil if your a just doesn't have any attributes I'd assume
15:10:49FromDiscord<Rika> why is xmlattr also a ref type i wonder
15:11:40FromDiscord<Phil> Maybe it can get really large and thus it's better to avoid copies? Guessing on my end really
15:12:50FromDiscord<Rika> i doubt
15:13:15FromDiscord<Rika> its very unlikely for attrs to become large, i dont know many instances where xml attributes exceed a hundred
15:14:08FromDiscord<voidwalker> That was it Phil, the last a had no attributes, and was nil..
15:14:14FromDiscord<voidwalker> (edit) "a" => "`a`"
15:15:03FromDiscord<Phil> In reply to @voidwalker "That was it Phil,": In that case instead of nil-checking I'd recommend writing your own "hasKey" proc once that includes the nil-check
15:15:49FromDiscord<Phil> So you do that only once in a single proc somewhere instead of all the time everywhere
15:15:58FromDiscord<voidwalker> yeah that's how it should be done.. but, too much code
15:16:10FromDiscord<Phil> Isn't it like 4 lines?
15:17:20FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=46VD
15:17:56FromDiscord<Phil> Actually, I bet that could be a oneliner
15:18:39FromDiscord<Phil> `proc hasAttribute(node: XmlNode, key: string): bool = if a.attrs == nil: false else: a.attrs.hasKey(key)`
15:20:06FromDiscord<!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=46VF
15:20:15FromDiscord<Phil> I keep forgetting isNil is a thing
15:20:47FromDiscord<Phil> Good addition Patito!
15:21:13FromDiscord<Phil> Although I would throw in that you're really relying on that implicit return of false
15:21:52FromDiscord<Phil> So personally I'd stick with the if-else
15:25:34FromDiscord<lantos> can someone please help me reset my nim forum account?
15:26:03FromDiscord<Phil> Have you asked moderator?
15:26:38FromDiscord<Phil> As in, pinged them, might give you the fastest reaction ^^
15:27:06FromDiscord<Tuatarian> what's the difference bewteen isNil and `== nil`?
15:27:08FromDiscord<lantos> Is there a list of mods for the forum I tried looking for it
15:27:19FromDiscord<Tuatarian> just ping araq/dom/mratsim/pmunch
15:27:36FromDiscord<Tuatarian> maybe not araq
15:27:36FromDiscord<Phil> In reply to @lantos "Is there a list": Ah, you can just ping with <@&371760044473319454>
15:27:41FromDiscord<lantos> ah 🙂
15:27:43FromDiscord<lantos> thanks phil
15:27:51FromDiscord<Phil> (edit) "In reply to @lantos "Is there a list": Ah, you can just ping with <@&371760044473319454> ... " added "(For context: lantos wants to reset nim account)"
15:27:54FromDiscord<Tuatarian> does that work for pinging anyone other than dom?
15:27:56FromDiscord<Phil> To state your nim account name though
15:27:59FromDiscord<Phil> (edit) "To" => "Do"
15:28:02FromDiscord<Tuatarian> since dom is the only one that uses discord
15:28:04FromDiscord<Phil> So that they know what to do
15:28:09FromDiscord<Rika> In reply to @iWonderAboutTuatara "what's the difference bewteen": its more often that == is overloaded
15:28:31FromDiscord<Phil> In reply to @iWonderAboutTuatara "what's the difference bewteen": isNil is more expressive as in it reads more like proper english
15:28:43FromDiscord<!Patitotective> In reply to @Isofruit "Although I would throw": well, i dont see a problem on relying on it since it will always be false, its a convention i think
15:28:53FromDiscord<Rika> ~~kinda like the == vs .equals debacle on java ig...~~
15:28:57FromDiscord<lantos> <@&371760044473319454> Hey could you please help me gain access back on my nim forum account my acc is Lantos
15:29:07FromDiscord<Rika> double ping moment
15:29:07FromDiscord<Tuatarian> @Rika does it not use the `==` operator in it's defn?
15:29:13FromDiscord<Tuatarian> lmao
15:29:17FromDiscord<Tuatarian> don't delete it tho lantos
15:29:24FromDiscord<Tuatarian> it leaves an incredibly annoying ghost ping
15:29:37FromDiscord<Phil> In reply to @Patitotective "well, i dont see": That's perfectly valid and completely correct! ↵I just prefer things to be explicitly stated and not rely on implicit "invisible" behaviour such as default-instantiation.
15:29:44FromDiscord<Phil> (edit) "default-instantiation." => "default-instantiation values."
15:30:17FromDiscord<lantos> In reply to @iWonderAboutTuatara "don't delete it tho": huh?
15:30:31FromDiscord<Phil> In reply to @Rika "~~kinda like the ==": We had that debate in JS at work recently, it was hilarious to me
15:31:07FromDiscord<Phil> Because in JS we INSIST on never ever using "==" or "!=", it MUST be "===" or "!==", which becomes a massive pain when you want to check for a value existing because that's either null or undefined
15:31:10FromDiscord<Tuatarian> you pinged mods one time more than needed (not a huge deal) but I was saying not to delete the message with the ping since it leaves a ghost ping on their accs
15:31:19FromDiscord<!Patitotective> In reply to @Isofruit "That's perfectly valid and": i agree its clearer but i actually prefer short intuitive stuff hehe
15:31:38FromDiscord<flywind> IRRC there are some bugs where isNil works but not `==`.
15:32:06FromDiscord<Phil> What ended up happening when I pointed out that writing "bla !== null && bla !== undefined" is a massive pain was, that lodash contains an `isNull` function
15:32:25FromDiscord<leorize> isNil might work better in VM due to how it's implemented
15:32:26FromDiscord<Phil> So we should do that instead of the completely inacceptable "bla == null" to check whether something is null or undefined
15:33:35FromDiscord<flywind> Yeah I had a PR intending to remove `isNil` but rejected => https://github.com/nim-lang/Nim/pull/16191
15:33:45FromDiscord<Tuatarian> only tangentially related but I feel like backticks should make a function name a binary identifier
15:33:55FromDiscord<Tuatarian> so that you can define custom operators with word names
15:34:31FromDiscord<Tuatarian> like `sgnmod` for signed modulus or things like that
15:34:58FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=46VM
15:35:05FromDiscord<Tuatarian> lmao
15:35:07FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=46VM" => "https://play.nim-lang.org/#ix=46VN"
15:35:46FromDiscord<Phil> so now I'm using isNil in JS at work instead of the evil `==`
15:36:09FromDiscord<Phil> Which I agree should be banned in general, but for this particular instance I find it somewhat ridiculou
15:36:10FromDiscord<Phil> (edit) "ridiculou" => "ridiculous"
15:41:08Amun-Raso you're using evil JS… ;>
15:41:41*Amun-Ra is using == and != comparisons when checking nil
15:42:47FromDiscord<Phil> In reply to @Amun-Ra "so you're using evil": I think we can agree that all JS is evil to a degree, some just less so than other
15:43:06FromDiscord<Phil> In reply to @Amun-Ra "is using == and": Could you rephrase? I don't think I get that sentence
15:43:37Amun-RaI mean I prefer ==/!= to isNil
15:44:04Amun-Rabut that's just /me
15:44:12FromDiscord<Phil> in nim? or in js?
15:44:35Amun-Ranim
15:44:54Amun-Rajs doesn't have one iirc
15:45:05FromDiscord<Phil> lodash, an often used JS lib, does, thus my question ^^
15:45:32Amun-Raand I usually do not read backlogs completely ;>
15:49:42FromDiscord<Phil> fair
15:51:53FromDiscord<PMunch> In reply to @lantos "<@&371760044473319454> Hey could you": Gain access back?
15:52:25FromDiscord<lantos> Yeah I originally signed up with an email I no longer have access to
15:52:46FromDiscord<lantos> (edit) "to" => "to, I had some random password so can't get back in"
15:53:12FromDiscord<lantos> Are you able to reset the password or email?
16:01:40PMunchSure, I can reset both
16:02:43PMunchHmm, I can't find the account Lantos
16:02:55PMunchI think maybe @dom96 has to help with this one
16:03:22FromDiscord<lantos> https://forum.nim-lang.org/profile/Lantos
16:08:23*rockcavera joined #nim
16:08:23*rockcavera quit (Changing host)
16:08:23*rockcavera joined #nim
16:21:56PMunchHmm, my browser for some reason lowercased the URL..
16:22:35PMunch@lantos, so what was your previous email, and what is the new one?
16:22:43PMunchFeel free to PM me that info
16:34:02FromDiscord<voidwalker> so if I want to combine into a seq[tuple[name: string, id: string]] some text from xmlnodes in a html, that satisfy some conditions... what would be the best approach ? Iterate through each at a time and add to seq.name, seq.id ? or make a custom iterator that yields exactly what I need an iterate through both at once with zip () ?
16:41:42*PMunch quit (Quit: leaving)
16:47:19FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46VZ
16:50:13*ggsx joined #nim
16:50:40FromDiscord<Rika> thats terrifying
16:51:45FromDiscord<Phil> I... what am I even reading
16:52:38FromDiscord<Phil> so you have `seq[XmlNode]` and want to convert to `seq[tuple[name: string, id: string]]`?
16:52:43FromDiscord<dom96> In reply to @PMunch "Hmm, my browser for": lol, why is nimforum's accounts case sensitive
16:52:55FromDiscord<dom96> kinda ironic
16:53:35FromDiscord<voidwalker> nimforum accounts should be first char sensitive only and camelCase
16:53:59FromDiscord<Phil> and underscores are ignored
16:54:56*jmdaemon joined #nim
16:56:45FromDiscord<voidwalker> @Phil actually I realised that all the info I need comes in the "td " html element. It's `<td class="result_text"> <a href="/title/tt0106062/?ref_=fn_tt_tt_2">Matrix</a> (1993) (TV Series) </td>`
16:57:13FromDiscord<voidwalker> this.innerText has Matrix (1993) (TV Series)
16:58:00FromDiscord<voidwalker> can I get the `"/title/tt...` from it somehow ? I was doing findAll("a") before to get that
16:59:31FromDiscord<dom96> In reply to @voidwalker "so if I want": adding to a seq or an iterator are both the simplest, also if you create an iterator then you can also turn it into a seq easily with `sequtils.toSeq`
17:00:53FromDiscord<Tuatarian> is there an easy way to do operations with uint8 and int?
17:01:16FromDiscord<Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=46W6
17:02:04FromDiscord<Rika> do you mean `assert compiles T(y)` instead>
17:02:20FromDiscord<Tuatarian> they're the same thing right?
17:02:35FromDiscord<Tuatarian> but yeah that's what I was going for, didn't know `compiles` was a thing
17:02:41FromDiscord<voidwalker> Woah, figure it out. It's `the_td.child("a").attrs["href"]`
17:03:05FromDiscord<Tuatarian> but it keeps calling itself instead the actual contains function
17:03:07FromDiscord<Sun「無用」> Is there higher order functions?
17:03:13FromDiscord<Tuatarian> yes
17:03:20FromDiscord<Sun「無用」> what's the syntax?
17:03:24FromDiscord<Tuatarian> look at `sugar` module
17:03:35FromDiscord<Elegantbeef> it's a pointless check
17:03:36FromDiscord<Elegantbeef> so if `T(y)` doesnt compile you'll never get the assertion
17:03:36FromDiscord<Elegantbeef> `assert` is done at runtime
17:03:38FromDiscord<Rika> In reply to @iWonderAboutTuatara "but it keeps calling": `[T, V: not T]`?
17:03:51FromDiscord<Rika> i'm not sure what youre trying to do
17:03:54FromDiscord<Rika> converter?
17:04:01FromDiscord<Sun「無用」> In reply to @iWonderAboutTuatara "yes": do you the syntax for it?
17:04:31FromDiscord<Tuatarian> I want to be able to do operations with uint8 and int without typing `.int` or `.uint8` all the time
17:04:35FromDiscord<Tuatarian> it gets annoying after a bit
17:04:44FromDiscord<Tuatarian> In reply to @Sun「無用」 "do you the syntax": look at the `sugar` module in stdlib
17:04:56FromDiscord<Rika> In reply to @iWonderAboutTuatara "I want to be": well why are you converting between the two in the first place
17:04:57FromDiscord<Tuatarian> it provides easy ways of passing procs to other procs
17:05:48FromDiscord<Tuatarian> In reply to @Rika "well why are you": I have a type which is two `set[uint8]` but want to be able to do iterations over ranges and such without having to repeatedly type `i.uint8`
17:06:04FromDiscord<Tuatarian> also, I am not sure I can guarantee that everything I will be iterating over fits into `uint8`
17:06:04FromDiscord<Elegantbeef> `system.contains(x, T(y))` is what you want
17:06:18FromDiscord<Tuatarian> that's still a lot of typing though, right?
17:06:29FromDiscord<Elegantbeef> For your proc
17:06:44FromDiscord<Tuatarian> oh, I see
17:06:46FromDiscord<Elegantbeef> Or i guess rika's generic works aswell
17:06:48FromDiscord<Tuatarian> to make it not call itself
17:06:49FromDiscord<Rika> well i fixed it without that anyway
17:07:01FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=46W8
17:07:04FromDiscord<Rika> forgot to remove the assert
17:07:07FromDiscord<Tuatarian> https://play.nim-lang.org/
17:07:11FromDiscord<Rika> lol
17:07:18FromDiscord<Tuatarian> oh oops
17:07:20FromDiscord<Elegantbeef> The `[T: int]` is cute rika
17:07:20FromDiscord<Tuatarian> I see my mistake
17:07:43FromDiscord<Rika> i mean idk
17:07:48FromDiscord<Elegantbeef> If you ever get a `set[int]` i'm scared at your computer and it's stack size
17:07:51FromDiscord<Tuatarian> wait nevrmind, I don't
17:08:18FromDiscord<Rika> also sorry, you have to `[T; V: not T]`
17:08:40FromDiscord<Tuatarian> what does the semicolon do here?
17:08:41FromDiscord<Rika> its not gonna compile if it cant convert anyway so
17:08:57FromDiscord<Rika> In reply to @iWonderAboutTuatara "what does the semicolon": if you do `[T, V: not T]` then T is not T somehow
17:08:59FromDiscord<Elegantbeef> The same thiing it does anywhere else
17:09:09FromDiscord<Tuatarian> it says `undeclared identifier: 'T'`
17:09:14FromDiscord<Rika> thats why i said
17:09:17FromDiscord<Rika> to use the semicolon
17:09:17FromDiscord<Tuatarian> if you don't do the semicolon
17:09:18FromDiscord<Tuatarian> but why
17:09:24FromDiscord<Tuatarian> thanks btw that works
17:09:24FromDiscord<Rika> because it spreads the not T type
17:09:28FromDiscord<Rika> to T as well
17:09:31FromDiscord<Rika> like in parameters
17:09:34FromDiscord<Rika> `(a, b: int`
17:09:36FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=46Wa
17:09:39FromDiscord<Rika> (edit) "`(a," => "`proc a(a," | "int`" => "int)`"
17:09:40FromDiscord<Rika> same idea
17:09:52FromDiscord<Rika> In reply to @Isofruit "You mean to have": jesus christ
17:10:00FromDiscord<Rika> youre gonna kill the man with java-nim code
17:10:07FromDiscord<Phil> In reply to @Rika "youre gonna kill the": Then write it cleaner
17:10:34FromDiscord<Rika> you dont have to use this example itself though
17:10:41FromDiscord<Elegantbeef> Why doesnt `createUpdateHandler` infer generic parameters?
17:10:55FromDiscord<Phil> In reply to @Elegantbeef "Why doesnt `createUpdateHandler` infer": It does, but the error messages I get when it doesn't work are baaaaaad
17:11:07FromDiscord<Sun「無用」> In reply to @Isofruit "You mean to have": what?
17:11:11FromDiscord<Tuatarian> In reply to @Rika "to T as well": meaning?
17:11:16FromDiscord<Phil> By having these assignments I at least get to know which proc isn't fitting the signature
17:11:42FromDiscord<Elegantbeef> I mean ` result = createUpdateHandler(readProc, checkPermissionProc, updateProc, serialize)`
17:11:43FromDiscord<Phil> If I don't have them all I get from the compiler is "something in there isn't correct"
17:12:15FromDiscord<Rika> In reply to @iWonderAboutTuatara "meaning?": just like in `(a, b: int)` a and b are both ints, `[T, V: not T]` means that T and V are not T
17:12:20FromDiscord<Rika> what does T not being T mean
17:12:26FromDiscord<Phil> That's somewhere between habit and "I never tried it a different way because I got an error once and writing generics in generics finally started working for me once I did it this way"
17:12:26FromDiscord<Rika> i am not me
17:12:51FromDiscord<Elegantbeef> And why do you have type annotations
17:12:53FromDiscord<Phil> In reply to @Sun「無用」 "what?": You asked for a syntax example for higher order functions, well procs
17:13:01FromDiscord<Elegantbeef> Like what's the point there
17:13:39FromDiscord<Sun「無用」> In reply to @Isofruit "You asked for a": Lol, I didn't understand even a bit of it
17:13:53*arkanoid quit (Ping timeout: 255 seconds)
17:14:28FromDiscord<Phil> In reply to @Sun「無用」 "Lol, I didn't understand": Alright, different approach then
17:15:09FromDiscord<Rika> In reply to @Isofruit "You asked for a": as ive said the example you gave was too complicated and had way too much unnecessary inclusions xd
17:15:42FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46Wd
17:15:47FromDiscord<Rika> that works
17:15:48FromDiscord<Rika> beef quick
17:16:04FromDiscord<Sun「無用」> lol
17:16:10FromDiscord<Sun「無用」> sent a code paste, see https://paste.rs/wSS
17:16:14FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=46Wf
17:16:29FromDiscord<Phil> You can combine that with type aliases to make it more readable
17:16:30*ggsx quit (Ping timeout: 252 seconds)
17:16:38FromDiscord<Sun「無用」> Anyways, I won't use that anymore
17:16:41FromDiscord<Phil> So that your procs don't have to eat an entire proc definition
17:16:46FromDiscord<Sun「無用」> Just moved the things to another file
17:16:48FromDiscord<Rika> In reply to @Sun「無用」 "Anyways, I won't use": ?
17:16:50FromDiscord<Rika> okay
17:17:52FromDiscord<Sun「無用」> In reply to @Rika "?": The way I was going to do was unreadable and unusable
17:18:09FromDiscord<Rika> okay
17:18:09FromDiscord<Elegantbeef> phil must really be rubbing off on you
17:18:26FromDiscord<Elegantbeef> Sorry phil i couldnt help myself
17:18:32FromDiscord<Phil> 🙄
17:19:03FromDiscord<Tuatarian> In reply to @Rika "just like in `(a,": OH, that makes a lot of sense
17:19:07FromDiscord<Tuatarian> thanks
17:19:14FromDiscord<Tuatarian> the semicolon separates the statements
17:19:17FromDiscord<Sun「無用」> sent a code paste, see https://play.nim-lang.org/#ix=46Wj
17:19:27FromDiscord<Rika> ye
17:19:37FromDiscord<Tuatarian> In reply to @Sun「無用」 "Lol, I didn't understand": that was possibyl the worst example I've ever seen anyone give of anything, so no worries
17:19:51FromDiscord<Tuatarian> In reply to @Sun「無用」 "I'd have to do": using sugar, you cna avoid a lot of typing
17:19:56FromDiscord<Phil> throws hands in the air↵Apparently I'll just go make dinner then
17:20:30FromDiscord<Elegantbeef> sorry not sorry
17:20:47FromDiscord<Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=46Wk
17:20:57FromDiscord<Tuatarian> (edit) "https://play.nim-lang.org/#ix=46Wk" => "https://play.nim-lang.org/#ix=46Wl"
17:21:02FromDiscord<Rika> cursed spacing
17:21:03FromDiscord<Tuatarian> (edit)
17:21:06FromDiscord<Rika> someone ban him
17:21:08FromDiscord<Rika> smh
17:21:09FromDiscord<Tuatarian> oops lmao
17:21:17FromDiscord<treeform> In reply to @ajusa "do folks have a": Yeah it's very simple, we like it.
17:21:25FromDiscord<Tuatarian> (edit) "https://play.nim-lang.org/#ix=46Wl" => "https://play.nim-lang.org/#ix=46Wm"
17:22:13FromDiscord<Sun「無用」> sent a code paste, see https://play.nim-lang.org/#ix=46Wn
17:22:55FromDiscord<Tuatarian> same amount of readable imo
17:22:58FromDiscord<Sun「無用」> ?
17:23:08FromDiscord<Sun「無用」> in one, I need to pass board, bot and input func
17:23:15FromDiscord<Sun「無用」> the other I just need the game object
17:29:39FromDiscord<voidwalker> was there any special syntax for that `for k, v in ` loop ? so I have a k start starts from 0
17:29:52FromDiscord<voidwalker> (edit) "was there any special syntax ... for" added "or limitations"
17:32:41FromDiscord<Tuatarian> is there a container type?
17:34:52FromDiscord<Rainbow Asteroids> wdym by container type? There's `openArray`
17:35:07FromDiscord<Tuatarian> does openArray encomass sets?
17:36:39FromDiscord<Elegantbeef> No
17:37:38FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46WA
17:47:08FromDiscord<Rika> In reply to @voidwalker "was there any special": wdym?
17:47:41FromDiscord<Rika> `for k, v in x` is just `for a in x.pairs: let (k, v) = a; ...` i believe
17:55:45FromDiscord<Forest> What's the Nim equivalent of Pythonic?
17:55:49FromDiscord<Forest> I've been saying Nimatic lmao
17:56:39FromDiscord<Rika> there is none
17:56:43FromDiscord<Rika> just say idiomatic
17:56:55FromDiscord<Forest> Nimatic it is /lh
17:56:57FromDiscord<Rika> ok
17:58:38FromDiscord<reversem3> Yeah , I'm trying to figure that out also.↵(@Forest)
17:59:15FromDiscord<Phil> In reply to @Forest "I've been saying Nimatic": ~~nimiotic obviously~~
17:59:31FromDiscord<Elegantbeef> You link to it then write the code as you would in C
18:00:04FromDiscord<Forest> In reply to @reversem3 "Yeah , I'm trying": Sweet
18:00:09FromDiscord<Elegantbeef> If it's a dynamic library you pass `-lmyLibName` if it's a static library you pass `-static -lmyLibName` if it's source code you use `{.compile.}`
18:00:24FromDiscord<Forest> {.compile.} on the header file?
18:00:34FromDiscord<Forest> For source code
18:00:43FromDiscord<Forest> Hopefully futhark will work on Windows lmao
18:00:47FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46WG
18:00:51FromDiscord<voidwalker> ` Error: wrong number of variables`
18:00:55FromDiscord<voidwalker> What am I missing here?
18:01:13*wallabra quit (Ping timeout: 268 seconds)
18:01:39FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46WH
18:01:46FromDiscord<voidwalker> where tsv.row is CsvRow type
18:04:35FromDiscord<choltreppe> sent a code paste, see https://paste.rs/th9
18:05:11FromDiscord<Elegantbeef> What's the template definition?
18:05:31FromDiscord<Elegantbeef> Worth noting the error says `exp.right.exp.left.val`
18:05:42FromDiscord<Elegantbeef> not `exp.right, exp.left.val`
18:06:50FromDiscord<choltreppe> sent a code paste, see https://play.nim-lang.org/#ix=46WJ
18:07:24FromDiscord<Elegantbeef> everywhere you see `val` it's replaced with the template parameter
18:07:40FromDiscord<choltreppe> ah yes
18:07:47FromDiscord<choltreppe> ofcourse
18:07:57FromDiscord<Elegantbeef> so that `other.val` is turned into `other.val.exp.left.val`
18:07:57FromDiscord<choltreppe> thanks
18:08:27FromDiscord<Rika> In reply to @voidwalker "What am I missing": needs more info
18:08:33FromDiscord<Rika> cant tell from just this
18:08:46FromDiscord<reversem3> Is there a way to pull out everything from the c file from Futhark ? besides disassembling it?
18:08:54FromDiscord<Elegantbeef> What?
18:09:31FromDiscord<Elegantbeef> Futhark wraps the entire C library so it should be like it's C
18:11:46FromDiscord<reversem3> Ok so what PMunch said to do if leave out the static and just add all the paths to the header files and run , so I did that and now I have a binary file.
18:12:53FromDiscord<Elegantbeef> Yea that's all you should need to do
18:13:05FromDiscord<reversem3> I don't have a c file though
18:13:18FromDiscord<Elegantbeef> I dont follow
18:13:45FromDiscord<Elegantbeef> You have a library futhark wrapped, is it a source, static or dynamic library?
18:14:02FromDiscord<reversem3> file enim↵enim\: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=925a9df422031d32717491fb07a523e68a139a37, for GNU/Linux 4.4.0, with debug\_info, not stripped
18:14:41FromDiscord<reversem3> ok so dynamic
18:15:04FromDiscord<Elegantbeef> So then you have to link the library using `-lmylibname`
18:15:29FromDiscord<voidwalker> In reply to @Rika "`for k, v in": I believe you are right, I had the idea that the k was just an extra increment value so you don't have it inside the loop.
18:15:41FromDiscord<voidwalker> `iterator pairs[T](a: seq[T]): tuple[key: int, val: T] {.inline.}`
18:16:22FromDiscord<Elegantbeef> This should be `--passL:"-lmyLibName"` if unclear
18:16:37FromDiscord<Elegantbeef> Or in nim as `{.passL:"-lmylibName".}`
18:17:20FromDiscord<voidwalker> and because I have filter, which is in an iterator it seems, does not return a new seq.. I cannot use k, val there
18:17:28FromDiscord<Elegantbeef> An example of this https://github.com/beef331/wasmedge_playground/blob/master/src/wasmedge.nim#L33-L40
18:18:57FromDiscord<reversem3> Ok , so this is weird in nim , is there some documentation you can put to me so I can figure this out? Because how can I see what Futhark did or changed?
18:19:17FromDiscord<deech> Why is `hasKeyOrPut` take a `var TableRef` instead of just `TableRef`? A `TableRef` is already a mutable. https://github.com/nim-lang/Nim/blob/efdcc0016913918eb303f5c34ae805b94f270a1a/lib/pure/collections/tables.nim#L920
18:19:57FromDiscord<deech> (edit) removed "a"
18:20:01FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46WN
18:20:06FromDiscord<Elegantbeef> With strict funcs this isnt true↵(@deech)
18:20:36FromDiscord<flywind> In reply to @deech "Why is `hasKeyOrPut` take": I don't know, but we can use git blame
18:21:12FromDiscord<deech> With `strictFuncs` the reference may be immutable but the underlying table should be mutable.
18:21:15FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46WO
18:21:22FromDiscord<Elegantbeef> No it shouldnt be
18:21:40FromDiscord<Elegantbeef> Strict funcs explicitly states pointers do not elude side effect tracking
18:21:57FromDiscord<voidwalker> In reply to @Elegantbeef "Why you dont do": Cause I'm messy dogmeat : D
18:21:58FromDiscord<Elegantbeef> The entire point of it is to make it so you have to declare parameters as `var` to mutate them including references
18:22:27FromDiscord<deech> I see, then with `strrictFuncs` is `ref` simply a signal that it should be ref-counted?
18:22:45FromDiscord<Elegantbeef> Yes `ref` indicates it's a reference with strictFuncs
18:23:23FromDiscord<deech> Great, thanks! That clears it up and I even like it better.
18:23:46FromDiscord<Elegantbeef> Strict funcs is great
18:24:23FromDiscord<Elegantbeef> I have no clue why it's actually `var` but we'll go with my joke answer
18:24:38FromDiscord<deech> It should be the default for the standard library.
18:25:08FromDiscord<voidwalker> In reply to @Elegantbeef "Why you dont do": I will need k to be the actual number of filetered elements though, so I can break when it reaches max
18:25:21FromDiscord<Elegantbeef> So increment a counter?
18:25:27FromDiscord<voidwalker> one more line ? :\
18:25:55FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46WP
18:26:00FromDiscord<Elegantbeef> Yea it's really a shame that code has to be written
18:27:01FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46WQ
18:27:27FromDiscord<Elegantbeef> I'm glad i'm going for a bit cause that's just awful
18:27:54FromDiscord<voidwalker> Would it be the general consensus that it's awful ?
18:28:12FromDiscord<Elegantbeef> You're allocating 3 sequences just cause you dislike vertical code
18:28:16FromDiscord<Elegantbeef> So probably
18:28:37FromDiscord<Forest> How do i make futhark ignore system bindings
18:28:42FromDiscord<Forest> Headers
18:28:43FromDiscord<voidwalker> I thought it's not much more inefficient vs yours
18:28:53FromDiscord<Elegantbeef> It's much more inefficient
18:28:59FromDiscord<Forest> Since i have these showing up, when i only want things related to futhark to show up if possible https://media.discordapp.net/attachments/371759389889003532/1005905411263696996/Screenshot_2022-08-07-19-27-51-997_com.termux.jpg
18:29:05FromDiscord<Elegantbeef> `filter` allocates a sequence `toSeq` allocates a sequence
18:29:13FromDiscord<flywind> In reply to @deech "It should be the": Here is the first commit => https://github.com/nim-lang/Nim/commit/0a3e732b9ffc58d77f8821da64d2a31f8e894e6b
18:29:36FromDiscord<Elegantbeef> The reason it's var is probably due to copy pasting
18:30:22FromDiscord<voidwalker> oh so even if filter is an iterator, is still allocate a sequence ?
18:30:31FromDiscord<Elegantbeef> It's not an iterator
18:30:59FromDiscord<Elegantbeef> Oh nvm there is an iterator variant
18:31:09FromDiscord<Elegantbeef> Ok so never mind you allocate 1 extra sequence
18:32:39FromDiscord<Elegantbeef> So the answer is to quit using `toSeq` and `import std/enumerate` then do `for k, v in enumerate myHtml.findAll(...).filter(...):`
18:33:00FromDiscord<Elegantbeef> And just like that you have a non allocating variation of your code
18:33:13FromDiscord<flywind> In reply to @Elegantbeef "The reason it's var": True, and `mgetOrPut` doesn't have a var until now.
18:33:51FromDiscord<voidwalker> wait, there is a proc filter too.. withe the same parameters.. how does it choose which one to use ?
18:34:03FromDiscord<Elegantbeef> Iterators are only chosen in specific cases
18:34:25FromDiscord<Elegantbeef> inside for loops, inside `typeof`(by default) and when a template has `iterable` as a parameter
18:35:10FromDiscord<flywind> In reply to @flywind "True, and `mgetOrPut` doesn't": https://media.discordapp.net/attachments/371759389889003532/1005906967237251152/unknown.png
18:35:28FromDiscord<flywind> inconsistent
18:45:34FromDiscord<flywind> It is a breaking change though, I hope it can pass the CI. => https://github.com/nim-lang/Nim/pull/20175
18:47:42FromDiscord<deech> Will function dispatch pick the right one if you simply add a `hasKeyOrPut` instead changing the existing one?
18:48:14FromDiscord<flywind> Yeah, it should.
18:49:32FromDiscord<voidwalker> Thank you for the enumerate suggestion Elegantbeef, looks like the right compromise
18:51:14FromDiscord<flywind> In reply to @deech "Will function dispatch pick": Yeah, I should.
18:51:29FromDiscord<flywind> https://play.nim-lang.org/#ix=46WW
18:52:08FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46WX
18:52:34FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46WY
18:52:41FromDiscord<voidwalker> should they not be equivalent ?
18:55:06FromDiscord<voidwalker> seems the first ones keeps downloading that webpage, but why ?
18:55:56FromDiscord<voidwalker> ah, maybe it tries to iterate over the string returned by getContent ?
19:06:28FromDiscord<tandy> @pmunch know how to fix `/usr/bin/ld: cannot find -lclang` when installing futhark?
19:07:56FromDiscord<tandy> i need clang-devel, nvm
19:11:58FromDiscord<EyeCon> What should I use for linting/checking Nim code nowadays?
19:12:09FromDiscord<!&luke> Nimpretty
19:18:08FromDiscord<Rika> That’s for formatting
19:21:16FromDiscord<!&luke> It also check if it won't compile
19:25:36FromDiscord<Rika> You can do that with "nim check"
19:25:55FromDiscord<Mike> I think you're just doing `parseHtml` for every iteration of the loop.↵(@voidwalker)
19:25:59*kenran joined #nim
19:26:15*kenran quit (Client Quit)
19:39:43FromDiscord<Elegantbeef> Yea the enumerate probably causes this
19:44:39*wallabra joined #nim
19:49:18*wallabra_ joined #nim
19:50:59*wallabra quit (Ping timeout: 268 seconds)
19:51:01*wallabra_ is now known as wallabra
19:53:39FromDiscord<reversem3> Elegantbeef\: so basically Futhark created a dynamic library based on all the header files I gave it correct?
20:03:34FromDiscord<Elegantbeef> No
20:03:37FromDiscord<Elegantbeef> Futhark wrapped the C code that's all it did
20:03:57FromDiscord<Elegantbeef> It iterated over the C code extracted the type defs and procedures and imported them into nim
20:25:44FromDiscord<reversem3> so... how would you use them then
20:25:57FromDiscord<Elegantbeef> It depends on what the library is like i've said about 10 times now
20:26:32FromDiscord<Elegantbeef> If it's a static or dynamic library you link those accordingly, if it's source you tell nim to compile a file that includes it
20:28:50FromDiscord<reversem3> Sorry man , just trying to wrap my head around this.
20:29:08FromDiscord<Elegantbeef> Well what library are you attempting to wrap?
20:29:53FromDiscord<reversem3> https://git.enlightenment.org/enlightenment/efl/src/branch/master/src/lib/elementary
20:30:29FromDiscord<Elegantbeef> Ok so i assume you have something like `libelementary.so`?
20:31:34FromDiscord<reversem3> I don't think it works that way , EFL is a bunch of different libraries in order to create EFL apps.
20:32:47FromDiscord<reversem3> Yes I do
20:33:09FromDiscord<Elegantbeef> Then you should be able to just do `{.passL:"-lelementary".}`
20:41:10FromDiscord<Mike> Hey, does anybody have any notion of how to use something like a weak pointer?
20:41:49FromDiscord<matkuki> sent a code paste, see https://play.nim-lang.org/#ix=46Xo
20:43:34FromDiscord<Elegantbeef> With orc/arc you can do `{.cursor.}` which is kinda like a weak pointer
20:43:34FromDiscord<Mike> I saw a mention of that but haven't found any docs. I am using orc so if that works that would be great
20:43:34FromDiscord<Mike> Are there any examples anywhere?
20:43:34FromDiscord<Elegantbeef> https://nim-lang.org/docs/destructors.html#the-dotcursor-annotation
20:43:37FromDiscord<Elegantbeef> It's not identical to C++'s weak pointer as the docs say but it can be somewhat used like it
20:43:39FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46Xp
20:46:04FromDiscord<Mike> So if a goes out of scope and gets destroyed, b becomes nil? Can I just check with `b.isNil` whenever I want to try and use it?
20:46:59FromDiscord<Elegantbeef> No b doesnt become nil
20:47:55FromDiscord<Elegantbeef> Actually it might be considered `isNil` since the ref count is decremented
20:47:57FromDiscord<tandy> sent a code paste, see https://play.nim-lang.org/#ix=46Xr
20:48:07FromDiscord<tandy> sent a code paste, see https://paste.rs/60O
20:48:48FromDiscord<Mike> So is there any way for me to check that whatever b is pointing to hasn't been destroyed yet?
20:51:40FromDiscord<Elegantbeef> No clue
20:52:54FromDiscord<domosokrat> Can this even happen? Since b has to be in the same or deeper scope than a?
20:53:20FromDiscord<domosokrat> Forget it, of course if you destroy a manually
20:54:09FromDiscord<Elegantbeef> No one destroys objects manually with Orc 😛
20:54:38FromDiscord<Mike> Yeah I'm hoping to be able to create a new `ref MyObject`, also create a weak pointer to it, and then when it goes out of scope my weak pointer just becomes nil or invalid or whatever
20:54:57FromDiscord<Mike> Basically I want to be able to do updates to `MyObject`, but not retain it
20:55:41FromDiscord<Elegantbeef> Yea cursor is practically just a pointer, Nim presently doesnt have a weak pointer for refs
20:56:05FromDiscord<Mike> hmm, alright so maybe I just need to let that idea go for now
20:57:26FromDiscord<Mike> Thank you though. At least I have some clarity on that
20:57:59FromDiscord<leorize> if you really want it it can be done with a form of custom "pointer", but it's more trouble than it's worth
20:59:50FromDiscord<Mike> Yeah I think I'm just going to look for alternative ways of doing what I want to do here. I do hope something along those lines makes it into Nim eventually. Coming from C++/Swift/Objective-C it's a nice pattern for certain scenarios
21:01:05FromDiscord<Elegantbeef> It's a weird thing cause you have to invalidate the pointers somehow
21:02:59FromDiscord<leorize> a trick used in game dev for this is a generational array
21:03:22FromDiscord<leorize> your "pointer" is the index with a few bits used for marking its "generation"
21:04:11FromDiscord<leorize> once the array slot is cleared, you update the slot generation, and the "pointer" is now of an older generation and can be treated as invalid
21:06:16FromDiscord<Mike> How do clear the array slot? Are you rebuilding this array every game loop or something?
21:07:31FromDiscord<leorize> you can just mark it as empty, releasing memory is pretty expensive so better avoid it if possible
21:07:44FromDiscord<tandy> oh now it says `Fatal: 'stddef.h' file not found`
21:09:15FromDiscord<Mike> I don't totally get it, but I'll read up on generational arrays a little bit.
21:10:14FromDiscord<leorize> I just realized that the term I use is pretty much ungooglable. I found out about this strategy from here\: https://floooh.github.io/2018/06/17/handles-vs-pointers.html and some other gamedev blogs that I don't remember
21:10:38FromDiscord<Elegantbeef> It's really not idea but you can also do something like https://play.nim-lang.org/#ix=46Xv
21:11:03FromDiscord<leorize> you can also do a `ref ref` \:P
21:11:16FromDiscord<Elegantbeef> The validity of the reference is tracked in yet more GC'd memory either way
21:13:31*adium quit (Quit: Stable ZNC by #bnc4you)
21:13:32FromDiscord<tandy> sent a code paste, see https://play.nim-lang.org/#ix=46Xy
21:14:16FromDiscord<Elegantbeef> Did you provide futhark with the proper path
21:14:25*neceve quit (Ping timeout: 252 seconds)
21:14:45FromDiscord<tandy> just fixed that, back to segfaulting \:)
21:15:06FromDiscord<Elegantbeef> Why do you define `LIBANTUMBRA_H`?
21:15:24FromDiscord<Mike> So when you go to check `a.isValid[]`, what happens if `WeakBase` has been destroyed? Couldn't that be accessing dead memory?
21:15:24FromDiscord<Elegantbeef> https://github.com/TeamAntumbra/libantumbra/search?q=LIBANTUMBRA_H it's not a symbol
21:15:27FromDiscord<tandy> sent a code paste, see https://play.nim-lang.org/#ix=46Xz
21:15:27FromDiscord<tandy> good question
21:15:54FromDiscord<Elegantbeef> You have the `.so` in your library path?
21:16:00FromDiscord<tandy> oh i initially did AN\_LIBANTUMBRA\_H
21:16:06FromDiscord<Elegantbeef> I assume so else it'd error
21:16:09FromDiscord<tandy> cos thats the header definition
21:16:12FromDiscord<Elegantbeef> Yea and that's going to give you nothing
21:16:17FromDiscord<tandy> yesir
21:16:19FromDiscord<tandy> tested
21:16:21FromDiscord<Elegantbeef> The reason that pmunch defines anything in the futhark example is causue the C required it
21:16:46FromDiscord<Elegantbeef> Ok where does it segfault
21:17:48FromDiscord<tandy> opir
21:17:53FromDiscord<tandy> opir -I/usr/lib64/clang/14.0.0/include -I/home/tandy/libantumbra /home/tandy/.cache/nim/antumbra\_d/futhark-includes.h
21:18:24FromDiscord<Elegantbeef> No cause `WeakRef` keeps the `ref bool` alive
21:18:45FromDiscord<Mike> ahhhhh yep, I get it
21:18:57FromDiscord<Elegantbeef> Tandy that means something in the C code is causing opir to crashy crash try with a debug version of opir to see if it helps any
21:19:00FromDiscord<Mike> ...that really isn't the worst idea. I kinda like that
21:19:10FromDiscord<tandy> thanks, will do
21:19:41FromDiscord<Elegantbeef> The ref ref is of course simpler 😄
21:19:52FromDiscord<tandy> can i use nimble to install as debug?
21:19:57FromDiscord<Elegantbeef> No clue
21:26:30FromDiscord<Elegantbeef> Mike this might also give some inspiration https://github.com/zielmicha/collections.nim/blob/master/collections/weakref.nim
21:29:25FromDiscord<Mike> Ah, I also just found this, which is very interesting\: https://github.com/henryas/nptr
21:30:16FromDiscord<Elegantbeef> https://github.com/nim-lang/threading/blob/master/threading/smartptrs.nim and this!
21:31:42FromDiscord<ajusa> Is there a library that supports custom http methods?
21:31:43FromDiscord<Mike> lol what
21:31:55FromDiscord<ajusa> Looks like 1.6 removed them
21:33:02*wallabra quit (Ping timeout: 255 seconds)
21:33:10FromDiscord<tandy> no luck \:k
21:33:39FromDiscord<Elegantbeef> Well make an issue for pmunch to deal with
21:34:56*wallabra joined #nim
21:35:42FromDiscord<Mike> Is this stuff actually shipped with nim, or is this experimental?
21:35:49FromDiscord<Elegantbeef> It's in that package
21:37:25FromDiscord<Mike> ah okay
21:46:05FromDiscord<sekao> In reply to @luteva "Hi! I was trying": this is a ridiculously late reply, but the 100% CPU in nimwave_starter can be fixed by using glfwWaitEvents. i just updated the project to use it
21:54:44FromDiscord<Forest> Question, how do you automate making bindings? Is it just string manipulation?
21:55:04FromDiscord<Elegantbeef> futhark uses clang to parse the C code and emit nim code
21:55:26FromDiscord<Forest> Yeah but futhark isn't exactly the cleanest
21:55:45FromDiscord<Elegantbeef> C2nim operates on the string and parses everything as close as it can
21:55:45FromDiscord<Forest> I'm planning on piggybacking off of futhark's outputted json though
21:56:00FromDiscord<Elegantbeef> You're best to piggyback on the output nim code
21:56:25FromDiscord<Forest> And just clean that up instead? Or make manual bindings ontop of the outputted Nim code?
21:56:29FromDiscord<Forest> Or can it also be automated
21:56:34FromDiscord<Elegantbeef> Manual bindings on top
21:56:39FromDiscord<Forest> Alright, thanks!
21:59:14FromDiscord<Forest> Would using templates for as much as we possibly can be good for speed at all or?
21:59:21FromDiscord<Forest> Just aliasing it to nicer names
21:59:43FromDiscord<Elegantbeef> Templates or annotated inlined procedure is probably fine
22:01:59FromDiscord<Forest> Annotated inline what-
22:02:08FromDiscord<Forest> Ik what a proc is, but never heard of that before
22:02:18FromDiscord<Elegantbeef> `proc myAlias() {.inline.}`
22:02:53FromDiscord<Forest> Huh, and that works the same as templates?
22:03:11FromDiscord<Elegantbeef> It tells the C compiler to inline it if it wants to
22:03:25FromDiscord<Elegantbeef> It generally will be about the same as template if you use release and LTO
22:08:14FromDiscord<Forest> Ah alright, thanks!
22:08:30FromDiscord<Forest> What's the different pros and cons if i can ask?
22:16:12FromDiscord<matkuki> Ok, so I found that changing the `nimbase.h` line 464 from `typedef char NCSTRING;` to `typedef const char NCSTRING;` fixes the Windows MSVC problem. Is there a way to redefine this typedef just for my code, without touching `nimbase.h`?↵Thanks
22:17:58FromDiscord<leorize> note that templates can feature delayed evaluation depends on how you write it, but procedures parameters are always evaluated↵(@Forest)
22:18:11*CyberTailor quit (Remote host closed the connection)
22:18:26FromDiscord<leorize> unfortunately not, what is the issue that you're having?↵(@matkuki)
22:21:18FromDiscord<Forest> In reply to @leorize "note that templates can": Ah okay, thanks!
22:22:40FromDiscord<matkuki> sent a code paste, see https://play.nim-lang.org/#ix=46XN
22:23:22FromDiscord<leorize> hmm, how come strictStrings are enabled by default for you?
22:23:50FromDiscord<leorize> you can add `/Zc:strictStrings-` to `passC` to disable that function
22:24:14FromDiscord<leorize> it makes sense when used with hand-written C, but Nim's C is not handwritten C and safety analysis has already been done at the Nim level
22:26:01FromDiscord<matkuki> I don't have that flag present, but tried addind `/Zc:strictStrings-`, no change.↵Also tried adding the `/permissive` flag, but that conflicts with rest of the `Qt` compilation process.
22:27:04FromDiscord<leorize> that's certainly weird \:/
22:27:57FromDiscord<leorize> while modifying nimbase will fix that particular problem, it might cause issues elsewhere since `NCSTRING` is used for all `cstring` declaration in Nim, and some of them are mutable
22:28:07FromDiscord<huantian> are you using `--cc:vcc`? I think that's the flag
22:28:34FromDiscord<matkuki> @leorize↵Got it, thank you very much for the suggestion!!!! Reversing the flag order fixed it: `/Zc:strictStrings-` has to come last!
22:28:45*CyberTailor joined #nim
22:29:04FromDiscord<matkuki> @huantian Yes, I'm using that flag.
22:29:41FromDiscord<matkuki> (edit) "@leorize↵Got" => "@leorize Got"
23:00:26FromDiscord<Forest> Is retyping (https://github.com/PMunch/futhark#redefining-types) a built-in Nim feature or futhark specific?
23:00:36FromDiscord<Forest> If it's futhark specific, how could i use it without futhark installed?
23:01:34*vicecea quit (Remote host closed the connection)
23:02:05*vicecea joined #nim
23:02:19FromDiscord<leorize> the description pretty much describes what it does \:p
23:03:19FromDiscord<leorize> in short, in C some types are ambiguous\: arrays are pointers, and pointers are arrays, arrays of arrays are double pointers and var array is also double pointers
23:03:57FromDiscord<Forest> Yeah but is `retype <object>.<field>, <Nim type>` a built-in Nim feature? Reading the desc didn't make it clear to me aha
23:04:32FromDiscord<leorize> in Nim we separate it into different concepts, but the underlying representation is the same, so you can use equivalent types to add safety and context in a Nim wrapper
23:05:15FromDiscord<Forest> Ah okay, thanks!
23:20:14FromDiscord<Elegantbeef> It's a futhark feature that replaces the type in the generated nim files↵(@Forest)
23:21:45FromDiscord<Forest> Ah okay
23:21:59FromDiscord<Forest> But wait then how does `retype` know to change the fields?
23:22:30FromDiscord<Elegantbeef> Cause it takes the field access as a parameter?
23:22:46FromDiscord<Elegantbeef> It's wrapping C code `a.b` in C is only one thing
23:23:31FromDiscord<Forest> Wait so, I should put `retype` after the importc statement?
23:23:45FromDiscord<Elegantbeef> Retype only works in the importc macro
23:23:58FromDiscord<Forest> Oh in the macro
23:24:00FromDiscord<Forest> Thanks aha
23:42:26NimEventerNew post on r/nim by junyup: 2 questions about nim memory management, see https://reddit.com/r/nim/comments/witmh3/2_questions_about_nim_memory_management/
23:45:06*adium joined #nim