<< 06-02-2022 >>

00:18:38FromDiscord<ynfle> @ckennedy I have a macro solution to your problem
00:19:16FromDiscord<ckennedy> In reply to @ynfle "<@!296348328122384386> I have a": Oh yeah?
00:20:21FromDiscord<ynfle> https://media.discordapp.net/attachments/371759389889003532/939676856473505902/types.nim https://media.discordapp.net/attachments/371759389889003532/939676856687423538/main.nim
00:20:48FromDiscord<ynfle> In reply to @ckennedy "Oh yeah?": โ˜๏ธ
00:28:14FromDiscord<ckennedy> Whoa, nice work! So it loops over the fields and generates the `fieldName` and `setName` for each one?
00:32:29FromDiscord<ynfle> In reply to @ckennedy "Whoa, nice work! So": Ya
00:32:29FromDiscord<ynfle> sent a code paste, see https://play.nim-lang.org/#ix=3OLV
00:35:09FromDiscord<ckennedy> sent a code paste, see https://play.nim-lang.org/#ix=3OLW
00:36:27FromDiscord<ynfle> In reply to @ckennedy "Got it. Great starting": ๐Ÿ‘
00:46:07FromDiscord<noow> templates and inlined procs should have roughly the same overhead (= close to none), right?
00:47:00FromDiscord<noow> is there a flag which makes all procs that can be inlined inlined?
00:48:43FromDiscord<Elegantbeef> The C compiler already will when doing `release`/`danger`
00:48:44FromDiscord<Elegantbeef> Inline procedures may not be inlined though, whereas templates always will be
00:57:39FromDiscord<noow> In reply to @Elegantbeef "The C compiler already": ah makes sense
01:30:36FromDiscord<auxym> templates are inlined by nim, inline procs are inlined by gcc (at its discretion)
02:16:25FromDiscord<gibson> Karax question: How is it direct dom alterations like HTMX or AlpineJS do not confuse Karax's virtual dom functionality?
02:35:49*krux02 quit (Remote host closed the connection)
03:08:00*jsef5 quit (Quit: CoreIRC for Android - www.coreirc.com)
03:20:41*Gustavo6046 joined #nim
03:24:35FromDiscord<Sabena Sema> The main reason you use templates instead of a normal proc (that gets inlined, you can use pragmas to add an attribute that will _force_ it to always be inlined, unless you use msvc) is that they don't open new scopes
03:25:49FromDiscord<Sabena Sema> so like an "assert" procedure that takes a bool can't print the expression that failed, as it's evaluated before the procedure is called and is not longer accessible, and assert macro can access it
03:43:21*arkurious quit (Quit: Leaving)
03:59:08FromDiscord<Evrensel KiลŸilik> sooooooooooooooooooooooo
03:59:12FromDiscord<Evrensel KiลŸilik> i wrote this
03:59:14FromDiscord<Evrensel KiลŸilik> https://rohanrhu.github.io/gdb-frontend/tutorials/makefile-integration/
04:05:08FromDiscord<noow> is there a way to tell nim that function calls are illegal within a certain region of code
04:05:40FromDiscord<noow> (if i want to force myself to rewrite everything in terms of templates)
04:05:42FromDiscord<Elegantbeef> What do you mean?
04:06:08FromDiscord<Sabena Sema> yes, but it's not a good idea
04:06:21FromDiscord<noow> isn't inlining always faster?
04:06:24FromDiscord<Sabena Sema> no
04:06:58FromDiscord<noow> oh god
04:07:24FromDiscord<Sabena Sema> it makes the generated code larger
04:07:48FromDiscord<Sabena Sema> like if you have a huge function and call it twice it's faster to not inline it
04:08:13FromDiscord<Sabena Sema> because if you don't inline then the second call executes code that's probably already in the instruction cache
04:08:17FromDiscord<Sabena Sema> if you inline then it doesn't
04:08:26FromDiscord<noow> ah thanks
04:08:27FromDiscord<Sabena Sema> there are other reasons it can be slower too
04:08:33FromDiscord<noow> that's reasonable
04:09:02FromDiscord<Sabena Sema> in fact, one of the biggest reason you inline in the first place is that it helps _other_ optimizations down the line
04:09:23FromDiscord<noow> i thought it was to avoid the overhead of a function clal
04:09:27FromDiscord<noow> (edit) "clal" => "call"
04:09:30*vicecea quit (Remote host closed the connection)
04:09:50FromDiscord<Sabena Sema> the compiler has to generate the non-inlined code to be suitable for any situation, but after in-lining it can optimize for the specific callsite
04:09:53FromDiscord<Sabena Sema> that's part of it
04:10:01*vicecea joined #nim
04:10:24FromDiscord<Elegantbeef> c compilers generally do inline intelligently
04:10:24FromDiscord<Sabena Sema> but for smaller functions with few parameters modern calling conventions don't have much more overhead than any other indirect jump
04:10:30FromDiscord<Sabena Sema> yeah
04:10:38FromDiscord<Sabena Sema> if you just care about performance it's best to leave it to the compiler
04:11:14FromDiscord<Sabena Sema> though, sometimes, it can be worth forcing inlining for some functions, especially if you care about debug-mode performance
04:11:38FromDiscord<Sabena Sema> stuff like c++ style metaprogramming that generates deep callchains of small functions
04:13:28FromDiscord<noow> thanks for the knowledge
04:13:35FromDiscord<noow> i shall try to use it the best i can
04:13:52FromDiscord<Elegantbeef> I tend to think "performance is only an issue when it's an issue"
04:14:13FromDiscord<Elegantbeef> Write code that works then make it fast
04:14:36FromDiscord<noow> of course correctness is where most of my time goes
04:14:45FromDiscord<noow> i just want to learn to profile and optimize
04:15:04FromDiscord<Sabena Sema> I'm a very "I want the code the look just so" kinda person, but inlining is definitely something where you should let the optimizer do it's thing
04:15:14FromDiscord<Elegantbeef> Well then get a profiler and profile
04:15:15FromDiscord<Elegantbeef> Dont just inline cause "I think it's faster"
04:15:23FromDiscord<Sabena Sema> yeah
04:15:54FromDiscord<noow> the overhead of calling functions is not something that shows up with valgrind, or?
04:16:03FromDiscord<Sabena Sema> I mean stuff like C style resizeable arrays having insertion functions that don't double copy the tail and stuff
04:16:18FromDiscord<Sabena Sema> I think valgrind is an instramentation based profiler (not sure)
04:16:36FromDiscord<Sabena Sema> if so, it's not great at identifying ... well most perf problems
04:16:41FromDiscord<Sabena Sema> you want a sampling profiler
04:16:59FromDiscord<Sabena Sema> you use instrumentation when you really need exact execution traces and callcounts
04:17:23FromDiscord<noow> ah okay
04:17:35FromDiscord<Sabena Sema> the usual linux solution is "perf"
04:17:38FromDiscord<Elegantbeef> If calling functions is what needs optimized you're in a good state
04:17:42FromDiscord<Sabena Sema> the gold standard imo is intel V-Tune
04:17:46FromDiscord<Sabena Sema> but it only really works on intel CPUs
04:17:58FromDiscord<noow> but a sampling profiler would still only tell me which lines are being spent on the most
04:18:02FromDiscord<noow> right?
04:18:20FromDiscord<noow> yeah i'm on intel, thanks for the tip for "perf"
04:18:28FromDiscord<Sabena Sema> In reply to @Elegantbeef "If calling functions is": yeah, but if you use an instrumentation based is can appear you're spending all your time calling functions when you actually are not
04:18:41FromDiscord<Sabena Sema> perf works on all (almost all) chips
04:18:45FromDiscord<Sabena Sema> perf is also just cool
04:18:47FromDiscord<noow> (edit) "intel," => "intel/linux,"
04:19:06FromDiscord<Sabena Sema> you can install debug symbols and run "perf top" and just see like globally where _everything_ on your system is spending time
04:19:20FromDiscord<noow> lol
04:19:39FromDiscord<noow> In reply to @Sabena Sema "you can install debug": probably needs root permissions then though
04:20:03FromDiscord<Rika> In reply to @Sabena Sema "the gold standard imo": AMD UProf
04:20:14FromDiscord<Sabena Sema> imo v-tune is mcuh, much better than uprof
04:20:26FromDiscord<Rika> Itโ€™s same same to me
04:20:36FromDiscord<Rika> If I canโ€™t use it itโ€™s basically worse to me xd
04:20:48FromDiscord<Sabena Sema> yeah ๐Ÿ˜„
04:20:59FromDiscord<noow> https://media.discordapp.net/attachments/371759389889003532/939737408390451240/scrn-2022-02-06-05-20-42.png
04:21:00FromDiscord<noow> lol
04:21:07FromDiscord<Sabena Sema> that's fine
04:21:15FromDiscord<Sabena Sema> it can sample from the wrapper
04:21:27FromDiscord<Rika> Performance tools usually need root for the really good kinda sampling lol
04:21:28FromDiscord<Sabena Sema> it just won't tell you where in the kernel you're spending time after making a syscall
04:21:50FromDiscord<Sabena Sema> yeah, you can get basic sampling with just like, the ability to ptrace your own processes
04:22:10FromDiscord<Sabena Sema> for the like, full uarch overview stuff yeah
04:22:39FromDiscord<Sabena Sema> (good profilers can sample not just time spent, but also the status of various CPU bits)
04:34:28FromDiscord<noow> i think perf does not like linux-hardened
04:37:24FromDiscord<noow> but i finally got a sample
04:37:38FromDiscord<Rika> oh it wont like hardened kernels
04:39:05FromDiscord<noow> what would eqcopy stand for
04:39:31FromDiscord<noow> (edit) "eqcopy" => "eqcopysystem"
04:44:28FromDiscord<Rika> `=copy` in system.nim
04:46:27*fowl quit (Quit: cya pals)
04:57:02*fowl joined #nim
05:12:41*fowl quit (Quit: cya pals)
05:18:02*fowl joined #nim
05:28:32*fowl quit (Quit: cya pals)
05:29:13*fowl joined #nim
05:54:49FromDiscord<Hamid_Bluri> hey, why do i get `invalid pragma: dynlib: "..."` ?
05:55:40FromDiscord<Hamid_Bluri> sent a code paste, see https://play.nim-lang.org/#ix=3OMT
05:55:58FromDiscord<Elegantbeef> Showing code is wonderful
05:56:32FromDiscord<Elegantbeef> types arent stored in dynamic libs afaik
05:56:36FromDiscord<Hamid_Bluri> sent a code paste, see https://play.nim-lang.org/#ix=3OMU
05:56:40FromDiscord<Elegantbeef> So using `dynlib` for a type makes 0 sense
05:57:01FromDiscord<Hamid_Bluri> Oh, thanks
05:57:13FromDiscord<Sabena Sema> yeah types are a convention, they are not stored in object code at all
05:57:17FromDiscord<Sabena Sema> (rtti excluded)
05:57:23FromDiscord<slackaduts> Can someone explain to me the difference between a sequence and an array (coming from python, VERY much a novice in Nim)
05:57:34FromDiscord<Elegantbeef> arrays are static sized
05:57:57FromDiscord<slackaduts> Oh. I'm assuming sequences can be iterated through as arrays can, correct?
05:57:57FromDiscord<Elegantbeef> sequences are not
05:57:57FromDiscord<Elegantbeef> That's all you really need to know
05:58:03FromDiscord<Elegantbeef> There are more differences but not that should bother you really
05:58:05FromDiscord<Elegantbeef> Yes
05:58:11FromDiscord<Elegantbeef> Arrays are compile time fixed collections of T
05:58:12FromDiscord<slackaduts> cool ty
05:58:17FromDiscord<Elegantbeef> Sequences are dynamically sized collections of T
05:58:34FromDiscord<Elegantbeef> Arrays can also be indexed by any ordinal
05:58:51FromDiscord<Elegantbeef> So you can make `array[bool, int]` for instance
05:59:05FromDiscord<slackaduts> ah, cool
05:59:12FromDiscord<Hamid_Bluri> i didn't know bool is ordinal
05:59:23FromDiscord<Elegantbeef> It's an enum
05:59:30FromDiscord<Elegantbeef> !eval echo bool is enum
05:59:32NimBotfalse
05:59:43FromDiscord<Elegantbeef> Hey fuck you nimbot
05:59:47FromDiscord<Hamid_Bluri> lol
06:00:03FromDiscord<slackaduts> In reply to @Elegantbeef "Hey fuck you nimbot": Matrix 4: Resurrections
06:00:22FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/P4N
06:00:44FromDiscord<Elegantbeef> Bool being magic means it doesnt abide to `enum` typeclass
06:00:53FromDiscord<Elegantbeef> Ponders if that's a bug
06:02:17FromDiscord<slackaduts> sent a code paste, see https://paste.rs/7mZ
06:02:29FromDiscord<Elegantbeef> Yea
06:02:45FromDiscord<Elegantbeef> `ClientHandler` is a type
06:02:45FromDiscord<Elegantbeef> Oh nevermind i see the error ๐Ÿ˜€
06:02:57FromDiscord<Elegantbeef> My reading skills are second to all
06:03:34FromDiscord<slackaduts> sent a code paste, see https://play.nim-lang.org/#ix=3ON1
06:03:46FromDiscord<Elegantbeef> What's `ClientHandler`'s type definition
06:03:53FromDiscord<Elegantbeef> Did you forget to do `clients: seq[Client]`?
06:04:10FromDiscord<Hamid_Bluri> export postfix ``
06:04:20FromDiscord<slackaduts> sent a code paste, see https://play.nim-lang.org/#ix=3ON2
06:04:24FromDiscord<Elegantbeef> Despite outward appearances Nim is not Python, it actually has module export levels
06:04:36FromDiscord<slackaduts> I do not know what that means
06:04:38FromDiscord<slackaduts> anyway
06:04:47FromDiscord<Elegantbeef> `clients: seq[Client]` is how you make a field accessible from another module
06:04:52FromDiscord<slackaduts> oh
06:05:03FromDiscord<Elegantbeef> It's the opposite of the `_thing` in python, but enforced
06:05:24FromDiscord<Elegantbeef> all top level symbols in Nim are by default private and need `` to export
06:05:35FromDiscord<Rika> i mean technically its "enforced" in python but here there is no workaround other than exporting
06:05:50FromDiscord<Elegantbeef> It's not enforced it's a programmer contract the last i checked
06:06:01FromDiscord<Elegantbeef> The runtime doesnt say "No stop it get some help"
06:06:09FromDiscord<Rika> not really, you have to do some fuckery to get there
06:06:23FromDiscord<Elegantbeef> I thought it was just doing `myObject._myField`
06:07:47FromDiscord<Rika> no
06:07:52FromDiscord<Rika> it does some mangling too afaik
06:07:57FromDiscord<Rika> or was that double underscore?
06:08:03FromDiscord<Rika> one or the other is doing mangling
06:08:24FromDiscord<Elegantbeef> two underscores mangles
06:08:31FromDiscord<Elegantbeef> and the mangle is `classNamefieldName`
06:08:58FromDiscord<Elegantbeef> Actually seems either
06:09:05FromDiscord<Elegantbeef> > Any identifier of the form \_\_geek (at least two leading underscores or at most one trailing underscore) is replaced with \_classname\_\_geek
06:09:45FromDiscord<Elegantbeef> So i guess it's safe to say "it's the opposite of Python's `_Field`
06:10:13FromDiscord<Elegantbeef> Cause you can also technically get the other fields if you really wanted to outside of the base module
06:11:09FromDiscord<Elegantbeef> As usual i'm still rambling and the person asking for help is in another universe
06:11:44*fowl quit (Quit: cya pals)
06:11:53FromDiscord<slackaduts> In reply to @Elegantbeef "As usual i'm still": sorry
06:12:07FromDiscord<Elegantbeef> Why are you apologizing i'm the one rambling
06:12:21FromDiscord<slackaduts> oh, nvm then
06:12:26FromDiscord<Rika> xd
06:12:30FromDiscord<slackaduts> "fuck you, I'm not sorry" xd
06:12:36FromDiscord<Elegantbeef> There we go
06:12:37FromDiscord<Rika> thats the spirit
06:12:42FromDiscord<Elegantbeef> You'll fit right in if you keep that behaviour
06:13:08FromDiscord<Elegantbeef> Atleast that's pretty much how the few active people act ๐Ÿ˜›
06:14:03FromDiscord<Elegantbeef> cept evo, he's too positive
06:14:11FromDiscord<Elegantbeef> Always thanking me for helping, fucking weirdo
06:14:37FromDiscord<slackaduts> always say crew off to someone who helps you
06:14:40FromDiscord<slackaduts> :gigachad:
06:14:49FromDiscord<slackaduts> (edit) "crew" => "screw"
06:14:50FromDiscord<Elegantbeef> There you go
06:14:55FromDiscord<Elegantbeef> Make them stay humble
06:15:46FromDiscord<slackaduts> also holy shit Nim's docs are awfulโ†ตโ†ตlike I have nothing against the person/people who wrong them but damn
06:15:57FromDiscord<slackaduts> (edit) "wrong" => "wrote"
06:16:05FromDiscord<Elegantbeef> "PRs welcome" ๐Ÿ˜€
06:16:18FromDiscord<Elegantbeef> Which docs btw?
06:16:57FromDiscord<slackaduts> I'm looking at nim for python programmers
06:17:07FromDiscord<slackaduts> it's been genuinely wrong about some things
06:17:11FromDiscord<Elegantbeef> Ah the wiki github
06:17:33FromDiscord<Elegantbeef> Feel free to modify it ๐Ÿ˜€
06:18:13FromDiscord<slackaduts> sent a code paste, see https://paste.rs/tk8
06:18:17FromDiscord<Elegantbeef> I dont know python much so cant say much about it ๐Ÿ˜€
06:18:25FromDiscord<Elegantbeef> seems like you did `for Client in clients`
06:18:44FromDiscord<slackaduts> sent a code paste, see https://play.nim-lang.org/#ix=
06:18:51FromDiscord<Elegantbeef> Hard to say the issure without the code with an error
06:18:54FromDiscord<slackaduts> (edit)
06:19:15FromDiscord<Elegantbeef> Well what's the line it's erroring on
06:19:15FromDiscord<Elegantbeef> It's clearly not that one
06:19:41FromDiscord<slackaduts> oh, it's not even erroring in my project
06:19:50FromDiscord<slackaduts> this is so strange
06:20:06FromDiscord<Elegantbeef> What's the entire error and what's the code?
06:20:13*fowl joined #nim
06:20:32FromDiscord<slackaduts> getting it, will take a sec
06:20:42FromDiscord<Rika> whats wrong with the wiki? ill look at it
06:21:07FromDiscord<Rika> also full error is always appreciated, most lines are pretty useful
06:21:08FromDiscord<slackaduts> sent a code paste, see https://play.nim-lang.org/#ix=3ON5
06:21:11FromDiscord<Rika> ok
06:21:15FromDiscord<slackaduts> lemme get code now
06:21:39FromDiscord<Elegantbeef> Issue is you dont have hashes imported
06:21:43FromDiscord<Rika> you're doing something with `[]` that you put a client instead of a string or w/e
06:22:19FromDiscord<Elegantbeef> They're using a `Table[Client, T]` and did not export `hashes` so cannot do `a[client]` i assume
06:22:29FromDiscord<Rika> or dont have a hash for client
06:22:33FromDiscord<slackaduts> sent a code paste, see https://play.nim-lang.org/#ix=3ON6
06:22:41FromDiscord<Rika> is client your own type
06:22:46FromDiscord<Elegantbeef> I think 1.6.0 made it so hash works on refs by default
06:22:47FromDiscord<Rika> you have to implement a hash function for it
06:23:00FromDiscord<slackaduts> it's not my type it's from a library
06:23:02FromDiscord<slackaduts> but yes
06:23:14FromDiscord<slackaduts> (edit) "it's not my type it's from a ... library" added "yet to be finished"
06:23:48FromDiscord<Elegantbeef> Is the library public?
06:23:49FromDiscord<Elegantbeef> Wait nevermind
06:24:04FromDiscord<Elegantbeef> `import std/[tables, hashes]`
06:24:04FromDiscord<Elegantbeef> That should resolve the issue
06:24:55FromDiscord<slackaduts> In reply to @Elegantbeef "`import std/[tables, hashes]`": same error
06:25:10FromDiscord<Elegantbeef> then implement a hash procedure for `Client`
06:25:11FromDiscord<slackaduts> In reply to @Rika "you have to implement": that sounds very complex
06:25:21FromDiscord<Elegantbeef> https://nim-lang.org/docs/hashes.html
06:25:24FromDiscord<Elegantbeef> Explains how
06:25:31FromDiscord<Elegantbeef> Uses obscure operators cause fuck you i guess
06:26:45FromDiscord<slackaduts> gotta love how a simple thing like an iterator is massively overcomplicated for no real reason
06:26:53FromDiscord<Elegantbeef> It's not the iterator
06:27:02FromDiscord<slackaduts> client is the iterator here
06:27:17FromDiscord<slackaduts> sent a code paste, see https://play.nim-lang.org/#ix=
06:27:43FromDiscord<Elegantbeef> That's not causing this
06:27:53FromDiscord<Rika> thats not the issue
06:28:04FromDiscord<Rika> `var client_speeds {.global.} = initTable[Client, int]()` this is technically your issue
06:28:07FromDiscord<Elegantbeef> the issue is that there isnt a `hash` procedure declared for your `Client`
06:28:08FromDiscord<Elegantbeef> `nim -v`?
06:28:26FromDiscord<slackaduts> In reply to @Rika "`var client_speeds {.global.} =": I just looked up how to create an empty table here
06:28:42FromDiscord<Rika> tables need hashes
06:29:00FromDiscord<Rika> client doesnt have a hash function
06:29:08FromDiscord<Rika> therefore you cant use it as a key in a table
06:29:10FromDiscord<slackaduts> how does one make a hash function
06:29:17FromDiscord<Rika> In reply to @Elegantbeef "https://nim-lang.org/docs/hashes.html": elaborated here
06:30:12FromDiscord<Elegantbeef> You can do `-d:nimPreviewHashRef` as a compiler flag
06:31:08FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/Ymn
06:31:18FromDiscord<Elegantbeef> Though i dont recall if it hashes the pointer or the fields
06:31:32FromDiscord<Elegantbeef> It hashes the pointer
06:31:43FromDiscord<slackaduts> this language sure is great at giving you the illusion of simplicity
06:32:13FromDiscord<Rika> In reply to @Elegantbeef "It hashes the pointer": of course it does, two same objects but different refs musnt be ==
06:32:21FromDiscord<Elegantbeef> It's a systems programming language afterall ๐Ÿ˜›
06:32:23FromDiscord<Rika> In reply to @slackaduts "this language sure is": so does python, so does js, so does ...
06:32:39FromDiscord<Elegantbeef> And to be fair making your own hash isnt the most complex thing
06:32:49FromDiscord<slackaduts> In reply to @Elegantbeef "And to be fair": sure is seeming like it lmao
06:33:19FromDiscord<Rika> did you at least read the documentation
06:33:28FromDiscord<slackaduts> what documentation, it's very scattered
06:33:36FromDiscord<slackaduts> I've been looking up shit as I can
06:33:42FromDiscord<Elegantbeef> https://nim-lang.org/docs/hashes.html
06:33:42FromDiscord<Elegantbeef> https://nim-lang.org/docs/hashes.html
06:33:43FromDiscord<Rika> we sent you a link
06:33:45FromDiscord<Elegantbeef> https://nim-lang.org/docs/hashes.html
06:33:47FromDiscord<slackaduts> yes
06:33:51FromDiscord<Rika> did you open it
06:33:52FromDiscord<slackaduts> I've been reading that
06:33:56FromDiscord<Rika> did you read it wholly
06:33:59FromDiscord<Rika> not skim
06:34:00FromDiscord<Elegantbeef> It explains in there how to hash it
06:34:00FromDiscord<Elegantbeef> The first example
06:34:01FromDiscord<Rika> not skip
06:34:01FromDiscord<slackaduts> I thought you meant docs in general, you never specified
06:34:10FromDiscord<slackaduts> im fucking reading it
06:34:15FromDiscord<Elegantbeef> We referenced the hash docs 3 times ๐Ÿ˜€
06:34:45FromDiscord<Rika> then ask instead of complain, what dont you understand from it
06:35:00FromDiscord<Rika> so at least we can get somewhere instead of argue
06:35:16FromDiscord<Elegantbeef> Arguing is fun!
06:35:19FromDiscord<Rika> its a waste of your time to argue, you'd really prefer to get on with it right? so let us help you
06:36:25FromDiscord<Elegantbeef> https://nim-lang.org/docs/tables.html#basic-usage-hashing also explains the issue
06:43:30FromDiscord<slackaduts> In reply to @Elegantbeef "https://nim-lang.org/docs/tables.html#basic-usage-h": so what isf there's fields within the Client type that also don't have a hashing function
06:43:35FromDiscord<slackaduts> (edit) "isf" => "if"
06:44:04FromDiscord<slackaduts> sent a code paste, see https://play.nim-lang.org/#ix=3ONa
06:44:57FromDiscord<Elegantbeef> the procedure needs to be named `hash` btw
06:45:34FromDiscord<Elegantbeef> Depending on the behaviour you want is what you need to hash
06:45:36FromDiscord<slackaduts> In reply to @Elegantbeef "the procedure needs to": oh.
06:45:55FromDiscord<Elegantbeef> If you want an object with the same value fields to match you only need to hash the value fields
06:46:19FromDiscord<Elegantbeef> If you just want a pointer to match you can use the `-d:nimPreviewHashRef`
06:46:56FromDiscord<Rika> In reply to @slackaduts "so what if there's": then they also need a hash function
06:47:10FromDiscord<slackaduts> oh boy.
06:47:11FromDiscord<Rika> beef whip the hash generating macro smh
06:47:16FromDiscord<Rika> (edit) "beef whip ... the" added "out"
06:47:21FromDiscord<Rika> you better have on
06:47:22FromDiscord<Rika> (edit) "on" => "one"
06:47:31FromDiscord<Elegantbeef> I dont cause i dont use reference objects much ๐Ÿ˜€
06:47:41FromDiscord<slackaduts> I heard macro's have the potential to break stuff a ton so I haven't looked into them
06:47:45FromDiscord<slackaduts> (edit) "macro's" => "macros"
06:48:03FromDiscord<Rika> hammers have the potential to break stuff a ton
06:48:06FromDiscord<Rika> people still use them
06:48:08FromDiscord<Elegantbeef> They dont "break stuff a ton"
06:48:19FromDiscord<Elegantbeef> Anyway the solution could just be that CLI flag
06:48:24FromDiscord<Elegantbeef> depends on the behaviour you want
06:48:36FromDiscord<slackaduts> In reply to @Elegantbeef "depends on the behaviour": I don't know enough to answer this
06:49:15FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3ONb
06:49:58FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3ONc
06:50:25FromDiscord<slackaduts> I just want a client to correspond to an integer in a table
06:50:34FromDiscord<slackaduts> I don't know what either of those even do
06:50:47FromDiscord<slackaduts> (edit) removed "even"
06:51:32FromDiscord<Elegantbeef> Then try the compiler flag and if that doesnt work for you implement your own hash for the `Client`
06:51:47FromDiscord<Elegantbeef> The diference is that any instantiation of your object with the same fields gets the same entry in the table, versus each unique instance of client gets it's own entry
06:52:10FromDiscord<Elegantbeef> Are fields the important delimiter or are instances is the basic question
06:52:24FromDiscord<slackaduts> In reply to @Elegantbeef "The diference is that": the latter is what I want
06:53:16FromDiscord<Elegantbeef> Then there you go the compiler flag will work
06:53:27FromDiscord<slackaduts> ok thanks
06:54:45FromDiscord<Elegantbeef> Table relations can be complicated depending on what you're after ๐Ÿ˜€
06:54:46FromDiscord<Elegantbeef> You can have it behave like a value object or like an integer
06:54:52FromDiscord<Elegantbeef> By like an integer i mean the pointer is hashed and used
06:55:23FromDiscord<Elegantbeef> inane ramblings again
06:55:29FromDiscord<slackaduts> I'm listening
06:57:01FromDiscord<Rika> beef i dont think what you said is clear
06:57:16FromDiscord<Elegantbeef> Have i ever been?
06:57:22FromDiscord<Rika> basically what he means is when it comes to hashing ref objects, you can either hash the inner regular object or the pointer value
06:57:41FromDiscord<slackaduts> ah
06:58:20FromDiscord<Rika> the former means that any object (as long as the data is the same) would have the same hashโ†ตthe latter means that if the pointers are the same, the hashes are the same, regardless of data (or you can also incorporate the data if wanted, theres a lot of options)
06:58:49FromDiscord<slackaduts> yeah
06:59:20FromDiscord<Elegantbeef> There's a reason that by default refs werent automatically done ๐Ÿ˜€
07:00:26FromDiscord<Elegantbeef> But now we have a flag that allows us to easily do it and overload if we need to
07:01:17FromDiscord<Elegantbeef> The flag wont be needed for the next minor nim version iirc, just here for migration
07:04:49FromDiscord<slackaduts> welp I'm going to bed, my mind and patience are fading fast and I have shit to do tomorrowโ†ตthanks for the help
07:29:55*[R] quit (Ping timeout: 256 seconds)
07:30:16*[R] joined #nim
07:55:13*pro joined #nim
08:04:23FromDiscord<Zajt> In reply to @enthus1ast "maybe also add --gc\:arc": Added those two but doesn't work when I add them. What do you mean with host application?
08:05:51NimEventerNew post on r/nim by timrichardson: Debugging, see https://reddit.com/r/nim/comments/slrk7w/debugging/
08:07:27FromDiscord<xx_ns> In reply to @Zajt "Added those two but": think he meant to ask whether the application that loads the 64-bit dll is also by itself 64-bit
08:08:22FromDiscord<Zajt> yeah it is
08:23:01FromDiscord<0000> i have aids
08:35:48*jjido joined #nim
08:55:29*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzzโ€ฆ)
08:56:36*Kitsune_ joined #nim
08:57:27*Kitsune_ quit (Client Quit)
09:38:12*xaltsc quit (Remote host closed the connection)
09:49:13FromDiscord<Phil> Hmm my google-fu is disappointing me once again
09:49:28FromDiscord<Phil> Do we have a library for converting a jpeg/png or whatever to webp?
09:49:50FromDiscord<Phil> I've found pixie so far but I don't think that's what I'm looking for. I just need conversion not image creation
09:50:57FromDiscord<Elegantbeef> Well pixie can handle conversion but webp isnt supported by it
09:51:41FromDiscord<Phil> Hmmmmmmmmmmmโ†ตhmmmmmmmmmmm
09:52:08FromDiscord<Elegantbeef> `libwebp` exists
09:52:11FromDiscord<Phil> I've never looked into it but am contemplating whether I should just write a python script
09:52:15FromDiscord<Elegantbeef> But you'd need to wrap it
09:52:16FromDiscord<Phil> And call that
09:52:36FromDiscord<Elegantbeef> What kinda bumfuckery are you doing
09:52:46FromDiscord<Elegantbeef> https://developers.google.com/speed/webp/docs/api
09:52:59FromDiscord<Elegantbeef> It's like 2 functions
09:53:02FromDiscord<Phil> I think asking which bumfuckery I'm not doing is a question with an easier answer
09:53:18FromDiscord<Phil> Mostly I just want, if users upload images to my webserver, for them to be webp
09:53:49FromDiscord<Phil> I allow myself to be tyrannical enough that I force webp upon them if they don't.โ†ตMostly because I've got some overview pages where I display a decent amount of images and I want them to be loading decently fast.
09:54:11*PMunch joined #nim
09:54:43FromDiscord<Phil> UI like this https://media.discordapp.net/attachments/371759389889003532/939821399340625940/Screenshot_from_2022-02-06_10-54-23.png
09:54:47FromDiscord<Elegantbeef> Well you can use cwebp if you're lazy
09:54:47FromDiscord<Elegantbeef> But the proper thing would be to wrap libwebp
09:55:10FromDiscord<Phil> ... I guess it would teach me how to wrap libraries
09:55:22FromDiscord<Phil> Which is a skillset I don't have in nim and is likely to come in handy
09:55:38*krux02 joined #nim
09:56:02FromDiscord<Elegantbeef> Well it's a simple API so have at -er
09:56:13FromDiscord<Phil> Given that I haven't wrapped anything ever
09:56:22FromDiscord<Phil> Is there any sort of stuff I can read into to get an introduction?
09:56:28FromDiscord<Elegantbeef> Thought it's a windows library so it's a fucking pain to get the library
09:56:29FromDiscord<Elegantbeef> I mean a google library ๐Ÿ˜€
09:56:53FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#foreign-function-interface-importc-pragma there isnt much to it really
09:57:35FromDiscord<Elegantbeef> Oh nice they have easily downloaded libraries
09:58:02FromDiscord<Elegantbeef> The encode file is 500 loc and heavily commented
09:59:52FromDiscord<Phil> So there I was
09:59:54FromDiscord<Elegantbeef> Oh they ship the static libraries
09:59:58FromDiscord<Phil> Googling if somebody already did the work for me
10:00:03FromDiscord<Phil> I found juancarlospaco
10:00:17FromDiscord<Phil> and he apparently only wraps the CLI stuff
10:00:24FromDiscord<Phil> Dangit!
10:00:36FromDiscord<Elegantbeef> Let's see if c2nim works with it
10:00:42FromDiscord<Elegantbeef> It's simple so i assume so
10:04:17FromDiscord<Phil> I just downloaded the source code tar
10:04:35FromDiscord<Elegantbeef> You dont need the sourcee code
10:04:35FromDiscord<Elegantbeef> https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html
10:04:36FromDiscord<Phil> I'm really noticing my lack of experience in C because I'm immediately getting overwhelmed by the fucktons of files in there
10:04:44FromDiscord<Elegantbeef> You can download the library here
10:04:53FromDiscord<Elegantbeef> You want the library not the source
10:04:59FromDiscord<Elegantbeef> There are like 6 C files for the library
10:05:08FromDiscord<Elegantbeef> You only need to wrap `types.h` `encode.h` and `decode.h`
10:08:48FromDiscord<Elegantbeef> Let's see if i can get c2nim to work on it and explain how before i sleep
10:10:24FromDiscord<Phil> So include/webp and...err
10:10:29FromDiscord<Phil> Well I got the files, I'm seeing the manual
10:10:33FromDiscord<Phil> I'm not seeing which command to execute
10:10:49FromDiscord<Elegantbeef> Yea that's it
10:10:49FromDiscord<Elegantbeef> `c2nim file.h` will convert it
10:10:56FromDiscord<Elegantbeef> Looking at it further `types` is pretty much useless in Nim
10:12:21FromDiscord<Phil> It is certainly keeping one of my CPU cores occupied
10:12:38FromDiscord<Elegantbeef> It took my cpu like 1ms
10:12:56FromDiscord<Phil> huh, that was the speed I had for encode.h
10:13:00FromDiscord<Phil> Types.h is still running strong
10:13:13FromDiscord<Elegantbeef> types.h is empty and useless
10:13:16FromDiscord<Phil> Look, I know my Lenovo T440 is a potato
10:13:39FromDiscord<Phil> Can't wait for the frame.work to finally arrive
10:14:01*jjido joined #nim
10:14:41FromDiscord<Phil> Okay I just CTRL+C'd it, there's no way it takes 5 minutes to decode a flipping 2 kb file, must've bugged out onme
10:15:21FromDiscord<Phil> Particularly not for like 70 lines of file
10:15:52FromDiscord<Elegantbeef> Ok so replacing `WEBPB_EXTERN` inside `encode.h` gets us on the path of proper code
10:16:44FromDiscord<Phil> What did you replace it with?
10:16:58FromDiscord<Elegantbeef> Nothing
10:17:27FromDiscord<Elegantbeef> It's for exporting C code
10:18:52*mjsir911 quit (Quit: Goodbye, World!)
10:19:07*mjsir911 joined #nim
10:19:33FromDiscord<Elegantbeef> Havent used c2nim much so i'm not the best to walk through it
10:19:34FromDiscord<Elegantbeef> Generally you want to make c2nim work with the C code so it can generate the wrapper
10:20:23FromDiscord<Phil> So for wrapping my choices are c2nim (I assume that one is preferred?) and wrapping myself
10:21:12FromDiscord<Elegantbeef> https://github.com/nim-lang/c2nim/blob/master/doc/c2nim.rst there is the manual
10:21:12FromDiscord<Elegantbeef> You can try futhark, or nimterop
10:21:20FromDiscord<Elegantbeef> The code is relatively simple so wrapping yourself isnt a tremendous effort
10:22:22FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3ONT
10:22:28FromDiscord<Elegantbeef> But i mean c2nim is faster ๐Ÿ˜›
10:22:34FromDiscord<Phil> I'll do lunch, maybe let some time pass and in the end try wrapping myself simply because it'd mean learning more
10:23:13FromDiscord<Phil> It's faster but I think gaining some understanding before using tools that remove the step could be beneficial
10:23:16FromDiscord<Elegantbeef> Here's what the C file looked like https://play.nim-lang.org/#ix=3ONU
10:23:18FromDiscord<Phil> If I have to do tweaking either way
10:23:40FromDiscord<Elegantbeef> The tweaking isnt much
10:23:45FromDiscord<Phil> ... That was c2nim right?
10:23:49FromDiscord<Elegantbeef> Yea
10:24:06FromDiscord<Elegantbeef> You have to do a few things but it's relatively simple
10:24:07FromDiscord<Phil> For a second there I believed you hand translated literally 200 lines of code in less than a minute while talking with me
10:24:14FromDiscord<Elegantbeef> Lol
10:24:48FromDiscord<Elegantbeef> It will need a `{.push: header: "encode.h".}` and a `{.link: "libwebp.a".}` and the like for windows/mac
10:25:17FromDiscord<Phil> Ahhh check, so the header provides the proc signatures
10:25:28FromDiscord<Phil> And the pragma provides the point to where you actually call those procs
10:25:46FromDiscord<Phil> (edit) "And the pragma provides the point to where you actually call ... those" added "the content of"
10:26:09FromDiscord<Phil> Is that how all C works? A header to define the interface in your binary blob and then you just trust that header?
10:26:36FromDiscord<Elegantbeef> That's how libraries work yes
10:26:46FromDiscord<Elegantbeef> System libraries are declared using a C header, your programming language says "Ok that's what this library has" and then you use it like that
10:27:50FromDiscord<Elegantbeef> the `.a` file on linux is a static library which is compiled into the binary
10:28:00FromDiscord<Phil> Man
10:28:04FromDiscord<Elegantbeef> The fun part is you can relatively easily use this with pixie when it's wrapped
10:28:46FromDiscord<Elegantbeef> Use pixie to load png/jpegs, then pass them to webp to be output as you want
10:28:54FromDiscord<Phil> Short moment of contemplation here.โ†ตIt really speaks for nim that as someone with no compsci experience that is just a python js java webdev can pick up nim and get a relatively complex project going and even start learning about C interop
10:29:11FromDiscord<Phil> (edit) removed "as"
10:29:12FromDiscord<Elegantbeef> Hey i'm 100% Self taught so... uhhh ๐Ÿ˜€
10:29:18*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzzโ€ฆ)
10:29:38FromDiscord<Elegantbeef> People learn what they need
10:30:00FromDiscord<Phil> I'm just gushing a bit about the really nice learn curve
10:30:49FromDiscord<Phil> for somebody that already has development experience. I think without that you'd have a tough time either way due to the sheer amount of concepts you have to understand like objects and such
10:31:44FromDiscord<Elegantbeef> Anyway hopefully this puts you on the path to doing the rest
10:31:47FromDiscord<Phil> Thanks for the nim file btw! I'll take a stab it and see if I can replicate it after lunch
10:32:46FromDiscord<Elegantbeef> You wont need it as messy as this but this is what you'll kinda want https://github.com/treeform/staticglfw/blob/master/src/staticglfw.nim#L1-L89
10:32:58FromDiscord<Elegantbeef> linking the files per OS
10:33:08FromDiscord<Elegantbeef> passing any flags that are needed
10:33:40FromDiscord<Elegantbeef> Hopefully when you get around to it someone that knows better is around else i'll have to help tomorrow when i get on
10:33:48FromDiscord<Rika> With regards to the learning curve
10:33:58FromDiscord<Rika> I believe itโ€™s just because you are interacting with the community
10:34:15FromDiscord<Rika> Otherwise itโ€™s probably just as miserable or a little less as every other language
10:35:27FromDiscord<Elegantbeef> Probably more in this case
10:35:38FromDiscord<Elegantbeef> Cause converting C into Nim is pretty much a "Here are pragmas help yourself"
10:36:51FromDiscord<noow> i tried writing a game in C with sdl once
10:37:03FromDiscord<noow> i couldn't get it to link on windows with mingw
10:37:09FromDiscord<noow> worked first try on linux
10:37:22FromDiscord<noow> linking is an arch enemy of mine i guess
10:37:39FromDiscord<noow> (edit) "linking ... is" added "on windows"
10:38:37FromDiscord<Rika> It is for all of us
10:38:45FromDiscord<Rika> Itโ€™s miserable there Iโ€™d say
10:39:09FromDiscord<noow> oh?
10:39:25FromDiscord<noow> so it's not just me being stupid?
10:40:12FromDiscord<noow> the task that i was doing is actually non-trivial? wow
10:40:27FromDiscord<Rika> I mean I think it is trivial
10:40:35FromDiscord<Rika> Itโ€™s just weโ€™re all dumb
10:40:50FromDiscord<Rika> I guess that actually means itโ€™s non trivial then lol
10:44:34FromDiscord<Phil> Regarding the learning curve I'm not sure I'd agree. โ†ตYeah a lot of my journey is eased by asking you guys, but (outside of macros, that's a book with seven seals) a lot of those could reasonably also be solved by bashing my head against the problem for a couple hours. โ†ตโ†ตThe same just didn't hold true for Rust for me when i tried it out.You couldn't even get a damn settings import to work without feeling like half a master thesis to le
10:44:57FromDiscord<Rika> Rust is a massive outlier
10:45:00*jjido joined #nim
10:45:11FromDiscord<Rika> That motherfucker is essentially impossible to learn in a month or whatever
10:45:38FromDiscord<Rika> You probably would have a quicker learning experience if you got a lobotomy first before learning
10:46:04FromDiscord<Phil> I like to express it more like Rust's learning curve being a flat wall, but I fully agree with you
10:46:18FromDiscord<Phil> I think I just gave up after week 6 or sth
10:47:26FromDiscord<Rika> I tried it before too and yeah, itโ€™s basically โ€œyour brain better be made for this or you ainโ€™t having funโ€
10:47:53FromDiscord<Rika> There are a lot of nice concepts from rust that Iโ€™d love for Nim to have
10:49:20FromDiscord<noow> if Rust's learning curve is a flat wall, Haskell's is angled backwards
10:49:50FromDiscord<Phil> Does nim have something for stupid easy parallelization? Like doing multi threaded work for a "map" operation on an array? I recall rust having a lib for that which was literally trivial to use
10:49:53FromDiscord<Rika> I learned Haskell easier than rust
10:50:26FromDiscord<Phil> Ray something or another it was called in rust IIRC
10:52:12FromDiscord<Rika> Probably weave is the closest to โ€œdead easyโ€
10:52:27FromDiscord<noow> would there be a problem with just using sequtils' map and threads
10:53:31FromDiscord<Rika> Well itโ€™s not too easy to use just map and threads
10:59:46FromDiscord<Elegantbeef> Anyway i go to sleep
10:59:47FromDiscord<Elegantbeef> https://github.com/mratsim/weave#data-parallelismโ†ต(@Phil)
11:02:22FromDiscord<Phil> In reply to @Elegantbeef "Anyway i go to": Sleep well!โ†ตAlso looks really cool!
11:02:32FromDiscord<Rika> I was ignored sadge
11:02:49FromDiscord<Phil> I saw yours as well, I was just brought back by the ping because I was reading the weave docs at the time
11:03:13FromDiscord<apahl> In reply to @Isofruit "Does nim have something": Have a look at https://nim-lang.org/docs/system.html#%7C%7C.i%2CS%2CT%2CPositive%2Cstaticstring
11:03:20FromDiscord<Phil> Naturally thanks to you as well for the pointing out that got me to the initial finding
11:03:45FromDiscord<noow> why are there no compiler errors for procs that have a return type but 1. contain no return statements 2. no result = 3. no expression at the end
11:04:25FromDiscord<Rika> Implicit result = default(T) at the start
11:04:34FromDiscord<noow> any way to turn that off?
11:04:38FromDiscord<Rika> No
11:04:44FromDiscord<Rika> Not that I know of
11:06:20FromDiscord<Tetralux> sent a long message, see https://paste.rs/Zsz
11:06:40FromDiscord<Tetralux> (edit) "http://ix.io/3OO7" => "http://ix.io/3OO6"
11:08:08FromDiscord<noow> do we know that that library uses threads and not just coroutines/async
11:08:34FromDiscord<noow> ah nevermind i re-read the message
11:08:40FromDiscord<noow> sorry i am half asleep
11:08:41FromDiscord<Tetralux> If it doesn't use threads, it might not even be faster in the first place ๐Ÿ˜
11:08:55FromDiscord<Tetralux> In fact, probably likely not. ๐Ÿคฃ
11:09:15FromDiscord<noow> well if it's 10 I/O bound activities, maybe yes
11:09:22FromDiscord<noow> like 10 GUI elements
11:09:33FromDiscord<noow> altho arrays are a weird data structure for them
11:42:49PMunchHmm, are there any way to see where a module is imported into my project?
11:43:31PMunchI try to run polymorph on a microcontroller but I get /home/peter/.choosenim/toolchains/nim-1.6.2/lib/pure/concurrency/cpuinfo.nim(100, 14) Error: undeclared identifier: 'sysconf'
11:43:40PMunchBut I can't figure out where it is imported
11:47:26FromDiscord<Phil> Outside of running grep with an appropriate regex / opening that dir in vscode to search with a regex I can't think of anything
11:47:45FromDiscord<Phil> Assuming you can get the folder structure on your microcontroller onto a normal PC
11:48:04FromDiscord<Phil> It it must be CLI tools I can only think of grepping
12:01:07*jmdaemon quit (Ping timeout: 256 seconds)
12:07:38FromDiscord<enthus1ast> https://nim-lang.org/docs/posix.html#sysconf%2Ccint
12:11:49PMunchHmm, Nim really needs better tracking of when things are actually used..
12:12:15FromDiscord<Phil> there's a nimgrep binary
12:12:16FromDiscord<Phil> No idea what it does
12:12:21FromDiscord<Phil> But has the word "grep" in the name
12:12:49PMunchNimgrep is essentially a way to grep for things with Nims style insensitivity
12:13:32PMunchI found the error, it is a `from std/cpuinfo import countProcessors`
12:13:50PMunchBut that happens in a macro of a branch that shouldn't be evaluated
12:14:56PMunchOh wait, it's not in a macro
12:15:04PMunchThen I see why this doesn't work
12:17:42PMunchBummer, I really wanted to see if I could get something like polymorph or pararules to run on an Arduino Uno, would be cool to have a completely different paradigm running on one of these controllers
12:19:05PMunchPararules seemed to compile correctly, but it failed because the program it generated was too big
12:26:06FromDiscord<Phil> pmunch, are you familliar with c2nim?
12:26:30FromDiscord<Phil> Or how to figure out what a macro stands for
12:26:41FromDiscord<Phil> (edit) "Or how to figure out what a macro ... stands" added "in C in a header file"
12:28:54PMunch@Phil, familiar enough that I decided to not use it and wrote Futhark instead..
12:29:28FromDiscord<Phil> Assuming I wanted to wrap this by hand
12:29:38FromDiscord<Phil> Because I'm dilligent and would like to have any comprehension of what I'm doing
12:29:44PMunchOh you're into punishment? Kinky
12:30:05FromDiscord<Phil> It's 3 very small files
12:30:13PMunchBut seriously, if you're diligent you want things to be done right, the manual process is very error prone
12:30:13FromDiscord<Phil> But for example
12:30:24FromDiscord<Phil> `WEBP_EXTERN int WebPPictureImportRGBX(`โ†ตI've got this
12:30:34FromDiscord<Phil> I have no idea what WEBP_EXTERN is, I think it's a macro
12:30:44PMunchDo you know what is very good at reading and understanding C code? A C compiler, and Futhark uses Clang to read and understand the C files for you
12:31:00PMunchMhm, Futhark knows what WEBP_EXTERN is
12:31:04FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3OON
12:31:09FromDiscord<Phil> How the heck did he know that macro turns into "static x"?
12:31:20FromDiscord<Rika> He probably didnโ€™t
12:31:40PMunchIt's probably a macro that turns on the `extern` flag in C under some conditions
12:31:44FromDiscord<Phil> But... but he added it to the encode.h file !
12:32:08FromDiscord<Phil> That c2nim block wasn't there before, I'm comparing the two side by side at the moment to wrap my head around it
12:32:23FromDiscord<Phil> (edit) "That c2nim block wasn't there before, I'm comparing the two ... side" added "(original vs beefs version)"
12:32:26PMunchDo you know what you don't need to do if you use Futhark? Modify the .h source files
12:33:07PMunchThat way you can just pull new versions and it automatically wraps the new version
12:33:17*PMunch waves hand and whispers *magic*
12:33:40FromDiscord<Phil> There's a subtle message somewhere in there
12:33:42FromDiscord<Phil> I can feel it
12:34:23PMunchThis is at least one definition of it: https://github.com/webmproject/webp-wic-codec/blob/main/src/libwebp/webp/types.h#L39
12:34:36PMunchIt just adds `extern` to the definition
12:34:57FromDiscord<Phil> So he just looked through the source code for a definition and accordingly added the block? Huh
12:35:00FromDiscord<Phil> Fair
12:35:26PMunchYup, whether or not he grabbed the correct one for your setup is anyones guess though
12:36:21PMunchDo you know what would grab the correct version so that you're guaranteed that it will work? Even if you change to a different system which has a different definition? You know like the DEFINE in C is supposed to do?
12:36:36PMunchI'll give you one guess
12:37:45FromDiscord<Phil> Is it...
12:37:46FromDiscord<Phil> hmm
12:37:52FromDiscord<Phil> I'll need to think on that one
12:37:56FromDiscord<Phil> Is it my internet connection?
12:38:21FromDiscord<Phil> Okay okay, fair I actually just read through the first 3 sections of the docs in the meantime
12:39:21FromDiscord<Phil> The current idea I'm getting is: open new project that uses futhark to deal with c and provides a nicer interface to anyone using it
12:39:29FromDiscord<Phil> (edit) "project" => "lib-project"
12:39:37PMunchPretty much
12:40:22FromDiscord<Phil> ... nimble install futhark fails? Huh
12:40:27PMunchI mean I've used it directly a couple of times, but normally I create a module that uses Futhark to wrap a C library and add some utility functions/wrappers
12:40:32PMunchFails with what?
12:40:47FromDiscord<Phil> Ohhh can't find clang
12:40:49PMunchForgot to install libclang first?
12:40:54FromDiscord<Phil> yup
12:41:26FromDiscord<Phil> I just assumed ubuntu might already have it
12:42:29FromDiscord<Phil> hmmmm lclang
12:46:41PMunchHuh?
12:46:56PMunchapt install libclang-dev
12:47:11PMunch@Phil ^
12:47:46FromDiscord<Phil> Huh, I tried sudo apt install clang
12:48:17FromDiscord<Phil> That installed... something worth 290Mb at least, still didn't make it compile. Libclang also installed something, lets see
12:48:19PMunchYes, that gets you the clang compiler, not the clang library
12:48:23*kobi7 joined #nim
12:48:32kobi7hi
12:48:35PMunchHello
12:48:48kobi7hey PMunch how are you doing?
12:49:18PMunchPretty good, just chilling with some FOSDEM talks
12:50:41kobi7cool
12:50:57kobi7I am trying to stream from http. How do I do that in Nim?
12:51:07kobi7https
12:53:51kobi7nobody knows :-)
12:54:06PMunchStream?
12:57:20FromDiscord<Phil> Welp, let's first go finding that libclang.lib file
12:57:27FromDiscord<Phil> Oh stream
12:57:28FromDiscord<Phil> Err
12:57:43FromDiscord<Phil> Yeah no idea, I stream audiofiles through apache because apache can, that's around it
12:58:42kobi7I mean, as a client
12:58:55kobi7this is what i want to do:https://lichess.org/api#operation/tvFeed
12:59:25kobi7it works in curl, but not in nim, or i don't know how to do it
13:00:17FromDiscord<Phil> Errr fair, sadly can't help there, I use JS/HTML for my GUI when streaming audiofiles
13:00:35FromDiscord<Phil> Essentially it's Angular
13:00:53PMunchMake a request, get the response stream, and read it line by line?
13:02:37kobi7it doesn't return
13:02:50kobi7i think because it's a stream, so it's not over yet
13:04:03kobi7a user asked this before here: https://forum.nim-lang.org/t/6103
13:04:28kobi7but recvLine shows nothing... a mystery!
13:04:43FromDiscord<Phil> Okay I'm dumb, I can't find a `libclang.lib` file. I can find my clang dir with the clang binary in `/usr/lib/llvm-6.0/bin`
13:05:23PMunch@Phil, yes that is the clang compiler, not the clang library
13:05:41PMunchAnd you're not looking for a .lib file, you're looking for a .so file
13:06:09PMunchBut you shouldn't have to look for it at all, if you installed it via apt like I showed you earlier I think it should find it automatically
13:06:18FromDiscord<Phil> Found it
13:06:29kobi7is there a way to get more verbose information from the socket?
13:07:46FromDiscord<Phil> sent a long message, see http://ix.io/3OOW
13:08:44PMunch@kobi7, well you can use Wireshark
13:09:41PMunch@Phil, do you have a file called /usr/lib/libclang.so?
13:10:46FromDiscord<Phil> nope, I've got /usr/lib/llvm-6.0/lib/libclang.so though
13:13:58FromDiscord<Phil> just made a symlink (`ln -s /usr/lib/llvm-6.0/lib/libclang.so /usr/lib`) to try it out but that didn't change anything, hmm
13:14:25PMunchAh, try --passL:"-L/usr/lib/llvm-6.0/lib"
13:14:38FromDiscord<Phil> Wait, quotation marks?
13:14:48FromDiscord<Phil> That might explain a lot
13:15:22PMunchNot sure if you need them tbh
13:15:26*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzzโ€ฆ)
13:17:44FromDiscord<Phil> That did it, may I make a pull request to adjust the command in the readme from `nimble install --passl:-L<path to libclang.lib> futhark` to `nimble install --passL:"-L<path to libclang.lib>" futhark` and maybe as an example for the pattern `nimble install --passL:"-L/usr/lib/llvm-6.0/lib" futhark`
13:17:50FromDiscord<Phil> (edit) "That did it, may I make a pull request to adjust the command in the readme from `nimble install --passl:-L<path to libclang.lib> futhark` to `nimble install --passL:"-L<path to libclang.lib>" futhark` and maybe as an example for the pattern `nimble install --passL:"-L/usr/lib/llvm-6.0/lib" futhark` ... " added "?"
13:19:10kobi7it seems only curl works
13:21:42PMunchThose instructions are actually for Windows
13:22:00PMunch"To install Futhark you first need to have clang installed. On Linux this is as simply as just grabbing it from your package manager."
13:22:09PMunchThat's the only part of that which applies to Linux
13:22:16PMunchBut yes, feel free to rewrite that section :)
13:29:57kobi7hmm.. doesn't work. no matter
13:31:59FromDiscord<Phil> Actually, pmunch, ignore my PR, I'll add another commit to it to split linux and windows section
13:33:47*kobi7 quit (Quit: Leaving)
13:35:51PMunchHmm, just watched an interesting talk on GUI in Ada
13:36:36PMunchOne takeaway which I thought was interesting is that he added all GUI events to a queue instead of using callbacks
13:37:06PMunchThis meant that his main program was essentially just a simple state machine that could go between states that handled various events and discarded any other events
13:37:27PMunchAnd it should be able to handle pretty much any UI layer on top
13:37:48PMunchI think I might have found one of the missing puzzle pieces for my Nim GUI library
13:39:29FromDiscord<Phil> Alright, did the minimal readme update
13:48:53FromDiscord<BhamidipatiNikhil> This code that i wrote is outputting EOF error in the nim playground.... https://media.discordapp.net/attachments/371759389889003532/939880330792402944/unknown.png
13:49:16FromDiscord<BhamidipatiNikhil> but working fine in my vscode environment https://media.discordapp.net/attachments/371759389889003532/939880426221223997/unknown.png
13:49:50FromDiscord<BhamidipatiNikhil> I am using the same version of nim(1.6.2) in both.... Any idea guys why this is happening?
13:51:30FromDiscord<BhamidipatiNikhil> Actually i received runtime error on the atcoder.jp platform too... I have no idea why this EOF error is coming...
13:52:50PMunchReally hard to know without seeing the code
13:53:24PMunchBut the playground is a fairly limited environment, just the fact that you managed to get an EOF without really having any files available is interesting
13:56:00FromDiscord<BhamidipatiNikhil> sent a code paste, see https://play.nim-lang.org/#ix=3OPe
13:56:22FromDiscord<Phil> \`\`\`nimโ†ต\`\`\`
13:56:50FromDiscord<Phil> works on github, stackoverflow (well, not for nim but most other language) and maybe even reddit
13:57:41FromDiscord<Phil> essentially just write the language (here nim) after the backticks
13:58:19FromDiscord<Phil> Given that you're crashing playground though, you could just post a link from there that contains your code
13:58:23FromDiscord<BhamidipatiNikhil> sent a code paste, see https://play.nim-lang.org/#ix=3OPi
13:58:28*jjido joined #nim
13:58:59FromDiscord<Phil> yeeeeee playground link might be a better idea
14:00:11FromDiscord<BhamidipatiNikhil> In reply to @Isofruit "yeeeeee playground link might": https://play.nim-lang.org/#ix=3OPj
14:01:54FromDiscord<BhamidipatiNikhil> https://atcoder.jp/contests/abc238/tasks/abc238_e This is the problem i was attempting to solve!
14:02:08FromDiscord<Phil> I have some fundamental questions on why you're even using templates
14:02:28FromDiscord<Phil> But that's not the point
14:03:02PMunchAnd there you have your problem, line 112 as it says: stdin.readLine
14:03:23PMunchThe playground doesn't send anything to the program over stdin, so it doesn't have anything to read
14:04:35FromDiscord<Phil> Ah, dang, Pmunch was faster
14:04:53FromDiscord<Phil> Just got to that point
14:05:02FromDiscord<BhamidipatiNikhil> I gave input in the atcoder platform.... https://media.discordapp.net/attachments/371759389889003532/939884392627707924/unknown.png
14:05:27FromDiscord<BhamidipatiNikhil> Still the same error https://media.discordapp.net/attachments/371759389889003532/939884500769472572/unknown.png
14:06:28FromDiscord<enthus1ast> well you must break out of your iterator
14:07:17FromDiscord<BhamidipatiNikhil> In reply to @Isofruit "I have some fundamental": I was using templates because i wanted just readability of code here... and i know i was not applying any procedure...!
14:07:27FromDiscord<BhamidipatiNikhil> In reply to @enthus1ast "well you must break": Which line... line number?
14:08:53FromDiscord<enthus1ast> from what i see in the images line 8
14:09:39FromDiscord<enthus1ast> might be as easy as catch the EOFError and break
14:11:23FromDiscord<BhamidipatiNikhil> sent a code paste, see https://play.nim-lang.org/#ix=3OPr
14:11:49FromDiscord<BhamidipatiNikhil> In reply to @enthus1ast "from what i see": Line 8 worked very well lot of times!
14:12:37FromDiscord<BhamidipatiNikhil> currently its commented out.. https://media.discordapp.net/attachments/371759389889003532/939886300444643389/unknown.png
14:12:56FromDiscord<BhamidipatiNikhil> Still the same error!! EOF error!
14:15:55*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzzโ€ฆ)
14:17:08FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=3OPw
14:17:58FromDiscord<BhamidipatiNikhil> This one? https://media.discordapp.net/attachments/371759389889003532/939887648879820820/unknown.png
14:18:03*jjido joined #nim
14:18:31FromDiscord<Rika> yes
14:18:41FromDiscord<Rika> its reading too much info
14:21:35*jjido quit (Client Quit)
14:22:38FromDiscord<Waldecir Santos> How do I set async pragma in a proc var ? I'm doing this and no luck
14:22:46FromDiscord<Waldecir Santos> sent a code paste, see https://play.nim-lang.org/#ix=3OPy
14:22:58FromDiscord<BhamidipatiNikhil> 2 inputs.... is that too much? https://media.discordapp.net/attachments/371759389889003532/939888903563927573/unknown.png
14:23:04FromDiscord<BhamidipatiNikhil> 2 per line
14:24:21FromDiscord<enthus1ast> this code works for meโ†ต(@Waldecir Santos)
14:24:49FromDiscord<Waldecir Santos> Oh I need to import asyncdispatch I keep forgetting the imports ๐Ÿคฆโ€โ™‚๏ธ
14:24:56FromDiscord<enthus1ast> \:)
14:25:07NimEventerNew thread by Icedquinn: Using distinct types for windowed access (ex. index operator abuse), see https://forum.nim-lang.org/t/8871
14:25:23FromDiscord<Waldecir Santos> Ty
14:27:11*pro quit (Quit: pro)
14:29:21*arkurious joined #nim
14:37:22FromDiscord<Phil> Okay
14:37:50FromDiscord<Phil> so of futhark I comprehend so far that I can use either "path" or "absPath" to define the directory that contains the header files I want to import
14:38:35FromDiscord<Phil> (edit) "so of futhark I comprehend so far that ... I" added "within the `importc` macro"
14:39:20FromDiscord<Phil> I use define for... sth? I have no comprehension of what goes in there. Is that a name of sth in the C-file? Can I just name that whatever I want?
14:39:35FromDiscord<Phil> And at the end of the block I give the name of the header file
14:40:07FromDiscord<Phil> sent a code paste, see https://paste.rs/0SL
14:40:11FromDiscord<Phil> I think? Pmunch?
14:42:40PMunchSounds about right
14:42:42FromDiscord<Phil> For reference, this is in a file `/home/isofruit/dev/nimlibwebp/src/nimblibwebp/libwebp.nim`โ†ตThe resources folder is in `/home/isofruit/dev/nimlibwebp/resources/libwebp-1.2.2-linux-x86-64/include/webp`
14:42:52FromDiscord<Phil> The docs said path is relative to the project
14:43:17PMunch`define` adds C `#DEFINE` statements to your import. This is sometimes used similarly to how we do `-d:something` in Nim
14:43:22FromDiscord<Phil> I'm not sure whether that means relative to the file that calls futhark or the root folder of the project (which would be `/home/isofruit/dev/nimlibwebp`
14:44:09PMunchUhm, should be relative to the root of the project IIRC
14:44:25PMunchOr maybe the main module of the compilation
14:44:48FromDiscord<Phil> Check, so that path should just start with /resources or start with ../resources
14:44:56FromDiscord<Phil> I'll keep that in mind!
14:48:25FromDiscord<Phil> Fun fact, the level to which I acknowledged "-d" so far was "Ah, when I pass this I can manipulate the mode in which my program is compiled", I saw it as little more than just a flag that you can access within the code to see if it's defined or not like a normal flag
14:49:27FromDiscord<Phil> Just namespaced so that custom flag stuff can be dealt with in any -d flag
14:49:38FromDiscord<Phil> (edit) "Just namespaced so that custom flag stuff can be dealt with in any -d flag ... " added "while the rest stays reserved for nim in general"
14:51:23FromDiscord<Phil> Either way, that looks to me like it's a way to manipulate how the lib is called and not if I just want to use it without any special flags
14:51:32FromDiscord<Phil> (edit) "flags" => "flags. So for now not necessary"
14:51:55FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3OPQ
14:52:34PMunchWell I mean that is pretty much how the -d flag works
14:52:48PMunchIt's just a way to define arbitrary values to things during compile-time
14:53:48PMunchYou probably need an absPath to the clang stdlib as well
14:53:52PMunchLike I do in my example
14:54:03PMunchOtherwise it won't be able to find the definition of normal C types :P
14:54:11FromDiscord<Phil> Ahhhh fair
14:54:49FromDiscord<Phil> ... if I ever make this a public package I'll likely have to have the user pass that as an argument somehow, whatever they're compiling for
14:55:35FromDiscord<Phil> Because I think throwing the clang stdlib into the package might make it too large
15:01:19FromDiscord<Phil> ... at least I think that generates source code?
15:01:22FromDiscord<Phil> (edit) "https://paste.rs/yx4" => "https://paste.rs/iry"
15:01:27FromDiscord<Phil> sent a code paste, see https://paste.rs/Ii4
15:02:41FromDiscord<Goel> We want a full tutorial on "How to use Futhark" asap
15:03:23FromDiscord<enthus1ast> lolโ†ต(@Goel)
15:03:29FromDiscord<Phil> I'll... write an example.md file for pmunch from whatever I learn?
15:04:15FromDiscord<Phil> I think I'm just severely limited here because this is pretty much the first time I'm even interacting with C or any low level language for the matter, a lot of the moving parts are whiffing past me
15:05:09PMunch@Phil, if you have a dynamic library you don't need that part
15:05:20PMunchSimply `passL:"-lmylib"`
15:05:40PMunchThat' just a little bit of logic to compile stb and link it statically
15:05:59PMunch@Goel, I definitely should..
15:06:40PMunchAnd @Phil, you don't have to worry about the clang libraries, they don't get included in your Futhark output, clang just needs to know about them when it is compiling
15:07:01FromDiscord<Phil> Errr.... I think weblibp is static? Beef mentioned something like that, let me read in the docs if that's mentioned somewhere
15:07:27FromDiscord<Phil> Oh, it has both dynamic and static libs
15:08:32PMunchYeah you probably just need to pass -lwebp on compile-time as long as you have it installed
15:08:59PMunchYup, at least on Arch
15:09:35FromDiscord<Phil> With dynamic library being the superior option for it means that lib is only called as needed and can be updated independently of my wrapper
15:10:39FromDiscord<Phil> Wait, that means what I did with putting a resources folder into my project was pointless
15:11:46FromDiscord<Phil> Because I should have the weblibp in... one of my system's lib folders I think and use the path to that weblibp folder to get the header file
15:21:54PMunchYes
15:24:57FromDiscord<Phil> Alright I'll go with static for now. Mostly because I misunderstood and if you want to compile the binary with dynamic linking you'll have to do it yourself, so I've got no .dll files in the folder I downoaded, only .a
15:25:59FromDiscord<Phil> (edit) "Alright I'll go with static for now. Mostly because I misunderstood and if you want ... tothem" added "compiled weblibp dll filesyou'll have" | "the binary with dynamic linking you'll have to do it" => "them"
15:26:06FromDiscord<adokitkat> Hi, a quick question, I couldn't find it. How do I "unpack" a seq of strings to fill a proc varargs parameter?
15:26:25FromDiscord<adokitkat> (edit) "it." => "answer."
15:26:41PMunch@adokitkat, I think you can just pass a seq to a varargs parameter directly
15:27:11FromDiscord<Rika> yeah, you dont need to "unpack" it
15:27:20PMunch@Phil, you're on Linux, if you end up with .dll files you've done something very wrong
15:27:40FromDiscord<Rika> on linux shared/dynamic libs are .so
15:27:45PMunchIf you install libwebp through your package manager you should have libwebp.so in your /usr/lib folder
15:28:01PMunchAnd then it's just a matter of `--passL:"-lwebp"` and it should find it
15:28:30FromDiscord<Phil> Sadly not in apt
15:28:37FromDiscord<adokitkat> In reply to @PMunch "<@216745055770116106>, I think you": that is unfortunately broken
15:28:47PMunchFor Futhark though you do need some header files to generate the definitions, these are typically installed under "/usr/include/webp" for example
15:28:58FromDiscord<adokitkat> atleast in one gintro function
15:29:28FromDiscord<Rika> In reply to @Isofruit "Sadly not in apt": debian based distros usually dont have the best package list
15:30:03PMunchSo if you just name them and then `--passC:"-I/usr/include/webp"` I believe clang should find the .h file directly
15:30:03FromDiscord<Phil> Currently checking if I can have apt install the package for me by passing it the url somehow
15:30:29PMunch`apt install libwebp` didn't work?
15:30:54FromDiscord<adokitkat> there is a varargs parameter but it is a binding to C's GTK3 and when I pass a seq there it just passes it literally like "@[abc]" as a whole string
15:30:57FromDiscord<Phil> > Reading package lists... Doneโ†ต> Building dependency tree โ†ต> Reading state information... Doneโ†ต> E: Unable to locate package libwebp
15:31:03FromDiscord<adokitkat> when I pass only one string, it works good
15:31:20FromDiscord<Phil> Did find a command that can add a repository though
15:32:42FromDiscord<Phil> Oh screw me it's called libwebp-dev
15:32:46FromDiscord<Rika> libwebp-dev?
15:32:47FromDiscord<Rika> yeah
15:32:48FromDiscord<Rika> i was thinking
15:32:49FromDiscord<Rika> lmao
15:33:02FromDiscord<Rika> maybe use apt search first next time ๐Ÿ˜›
15:33:39FromDiscord<Phil> I've honestly never ever had to
15:34:03FromDiscord<Phil> package was either named so I got it the first time or the webpage of the package included the package name to look for
15:36:20FromDiscord<pmunch> Typically development headers and such normally have the -dev postfix on Ubuntu
15:36:48FromDiscord<Phil> ~~Learning about the C ecosystem is the hardest part of this exercise~~
15:43:05FromDiscord<Phil> one import c per header file I assume
15:43:11FromDiscord<Phil> (edit) "import c" => "importc call"
15:50:49*jjido joined #nim
15:53:01FromDiscord<Skeleton> Im trying to install Nim from nim-lang.org, specifically the 64 bit version for use on Win10 and Windows defender is flagging some part of it as "potentially unwanted software"โ†ตIs this normal?โ†ตIt says the file in question is called `Program:Win32/Uwamson.A!ml`
15:53:23FromDiscord<Skeleton> Im a noob so sorry if I left out some important info
15:54:16FromDiscord<Rika> it is a false positive. av heuristics are not very smart
15:55:34FromDiscord<Skeleton> Ah, thanks. Should be all safe then?
15:57:57FromDiscord<auxym> Yes, there's a long forum thread on the issue
15:58:07FromDiscord<Phil> Pretty much. What you're describing is sadly a known issue but neight impossible to properly fix since AV's are just throwing machine learning and flagging everything that isn't on a tree by the count of three
15:58:15FromDiscord<Phil> (edit) "neight" => "neigh"
15:58:27FromDiscord<Phil> (edit) "Pretty much. What you're describing is sadly a known issue but neigh impossible to properly fix since AV's are just throwing machine learning ... and" added "at everything"
15:58:29FromDiscord<auxym> https://forum.nim-lang.org/t/7885
15:59:24FromDiscord<auxym> short story is, some people wrote exploits in Nim, now AVs are flagging a bunch of stuff compiled by Nim as a virus
15:59:37*Gustavo6046 quit (Remote host closed the connection)
16:00:29FromDiscord<Skeleton> Sad. I've only used Ruby so far but after looking into some other languages, Nim looks very promising. I am going to try it anyways, I believe you guys.
16:00:42*Gustavo6046 joined #nim
16:00:47FromDiscord<Skeleton> Eventually I am going to switch to some linux distro instead of Win10 and then it wont be an issue I imagine
16:02:16FromDiscord<Phil> Pretty much
16:05:39FromDiscord<Skeleton> While Im around, can you guys suggest any digital books that go over Nim's features? Often times when Im not at home I used to read a pdf on a kindle about Ruby to try and understand more, It would be nice to have a Vim equivalent but It seems that Vim is much lower population than Ruby
16:05:53FromDiscord<Phil> On the one hand, I'm pretty sure giving my normal user write access to `/usr/bin` is a bad idea
16:06:10FromDiscord<Phil> On the other, it is really annoying me I can't do `nimble install futhark` without sudo
16:07:54FromDiscord<Phil> https://www.manning.com/books/nim-in-actionโ†ตโ†ตNot a free book, but a book.
16:13:20FromDiscord<Phil> ... I've been stupid with futhark somewhere
16:13:27FromDiscord<Skeleton> In reply to @Isofruit "https://www.manning.com/books/nim-in-action Not a": Thank you!
16:13:36FromDiscord<Phil> > Error: Unable to parse output of opir:โ†ต> /bin/sh: 1: opir: not found
16:13:48FromDiscord<Phil> Back to reading the docs !
16:20:33FromDiscord<pmunch> Nope, you can list as many headers as you like in one callโ†ต(@Phil)
16:21:16FromDiscord<pmunch> How did you install it? If you have the .nimble/bin folder in your path then that should workโ†ต(@Phil)
16:24:08FromDiscord<Phil> sent a long message, see http://ix.io/3ORM
16:26:28FromDiscord<Phil> sent a long message, see http://ix.io/3ORN
16:28:08FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3ORO
16:29:34NimEventerNew thread by Sekao: Two-way communication with the new ORC-friendly channels, see https://forum.nim-lang.org/t/8872
16:44:27PMunchUhm, you shouldn't install nimble packages with ude
16:44:28PMunchsudo*
16:44:53PMunchThat probably put them in the root users home folder and not in your users home folder where they're supposed to go
16:45:17FromDiscord<Phil> So the solution thus is to changing permissions it seems
16:48:33FromDiscord<Phil> In reply to @PMunch "That probably put them": Hmmm okay, the error message for not installing with sudo changed to this:โ†ต> Error: unhandled exception: cannot open: /home/isofruit/.cache/nim/opir_r/opir.json [IOError]โ†ต... I'll just give myself read and write to `~/.cache`
16:49:45PMunchUhm, try deleting that folder instead
16:50:02PMunchProbably when you ran as sudo you messed up the permissions in that folder
16:50:20PMunchJust "sudo rm -rf /home/isofruit/.cache/nim/opir_r"
16:50:22FromDiscord<Phil> huh
16:50:25FromDiscord<Phil> Yeah that did it
16:50:38FromDiscord<Phil> just sudo rm -r ~/.cache
16:51:07Amun-Rasudo and ~?
16:51:43FromDiscord<Phil> ah, sorry, I was already in the correct dir, yeah that would lead to the wrong thing
16:51:56FromDiscord<Phil> So strictly speaking "sudo rm -r .cache"
16:52:07FromDiscord<Phil> Since my cwd was /home/isofruit
17:02:37FromDiscord<Phil> Oh wow
17:02:51FromDiscord<Phil> Rika wasn't kidding when they said debian doesn't use the most up to date libs
17:03:34FromDiscord<Phil> Just realized the example has clang 12.0, meanwhile my default install of clang is 6.0
17:03:41FromDiscord<Rika> lol
17:03:46PMunch6.0?
17:04:14FromDiscord<Phil> > /usr/lib/llvm-6.0/lib/clang/6.0.0
17:04:22PMunchFrom 2018 :P
17:04:54PMunchMeanwhile my machine has updated to 13.0.0
17:05:14FromDiscord<Phil> Flexing his fancy arch up-to-datedness ๐Ÿ˜„
17:05:15FromDiscord<cigolog> One can import nim modules inside python via nimpy and nimporter. Is there some library to do the opposite - use python code inside nim?
17:06:42FromDiscord<Phil> HAH! New error message!
17:07:38FromDiscord<Phil> cigolog there's nimpy (I have not used it): https://github.com/yglukhov/nimpy
17:09:29FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3ORX
17:09:58FromDiscord<Yepoleb> In reply to @Isofruit "Just realized the example": you can pin that specific package to testing or unstable
17:10:05FromDiscord<apahl> In reply to @cigolog "One can import nim": Nimpy can do that as well.
17:10:21FromDiscord<Yepoleb> or just upgrade fully to unstable, i wouldn't do development work on stable
17:10:29FromDiscord<Yepoleb> it's just a pain
17:10:34FromDiscord<cigolog> In reply to @apahl "Nimpy can do that": How does it deal with the fact most python code lacks type annotations?
17:11:20FromDiscord<Phil> In reply to @Yepoleb "or just upgrade fully": I've never ever done any work with C whatsoever, so I assume that's... a flag in apt somewhere to point the repositories to more up-to-date stuff?
17:11:56FromDiscord<apahl> In reply to @cigolog "How does it deal": Sorry, I am not familiar with the inner workings of Nimpy, just know about this: https://github.com/yglukhov/nimpy#calling-python-from-nim
17:12:15FromDiscord<Yepoleb> are you familiar with apt beyond basic commands?
17:13:05FromDiscord<Phil> Not really, apt search, apt autoremove/autoclean/clean, apt install, apt update, apt upgrade, them's the basics and I didn't go much beyond.
17:15:05*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzzโ€ฆ)
17:15:37FromDiscord<cigolog> In reply to @apahl "Sorry, I am not": Looking into tests, it seems like it only honors standard python lib
17:18:18FromDiscord<Yepoleb> so debian has these 3 branches:โ†ตunstable, where packages are introduced, this is kinda like the arch branchโ†ตtesting, where unstable packages go once there are no major bugs anymoreโ†ตstable, which is released every couple years as a polished snapshot of testing and only gets stability and security updates, no new versions
17:18:45FromDiscord<Yepoleb> you specify the branches you want to have available in /etc/apt/sources.list
17:19:44FromDiscord<apahl> In reply to @cigolog "Looking into tests, it": I guess that is just because it would be difficult to maintain tests on non-stdlib packages?
17:19:59FromDiscord<Phil> In reply to @Yepoleb "you specify the branches": Checking, reading through that file atm
17:20:49FromDiscord<Yepoleb> https://wiki.debian.org/DebianTesting this is a more in-depth summary of how the debian release cycle works
17:24:52PMunch@Phil https://github.com/PMunch/futhark/issues/11
17:25:20PMunchEssentially there's a bug in the current stable version of Nim (1.6.2). Try the release candidate for 1.6.4, or use devel
17:25:30PMunchhttps://github.com/PMunch/futhark/issues/11#issuecomment-1018470611
17:27:25FromDiscord<Yepoleb> @Phil imo for development you should use at least testing, because a stable release will keep the same old library version indefinitely (which is also the whole point of it, you don't want to update a server and a new version introduces new bugs)
17:34:57*jjido joined #nim
17:36:55*Gustavo6046_ joined #nim
17:38:03*Gustavo6046 quit (Ping timeout: 256 seconds)
17:43:22FromDiscord<Ayy Lmao> Is it possible to send a ref through a c api expecting a void pointer? I'm trying to send it in with `addr` and then cast it back on the other side but I'm getting out of bounds errors.
17:44:21PMunchIt should work, but refs are GCed so you need to make sure the object you have a ref to isn't being GCed while in C-land
17:45:13FromDiscord<Ayy Lmao> I'm building to emscripten and running `--gc:arc` so maybe that has something to do with it?
17:46:19FromDiscord<Phil> In reply to @Yepoleb "<@!180601887916163073> imo for development": I'll potentially play around with debian testing or so on my next machine. Since I have a new one incoming in the next couple weeks I don't think I'm willing to invest the time to do it right now
17:48:48PMunch@Ayy_Lmao, do you keep a reference to it when you pass it off to C-land?
17:49:16PMunchOr do you just allocate an object in Nim, pass the pointer to a C library, and then let Nim forget about it at which point it deallocates it?
17:49:55FromDiscord<Phil> Oh... oh wow, choosenim update devel really hammers your CPU
17:51:31FromDiscord<Ayy Lmao> In reply to @PMunch "Or do you just": I'm keeping a reference to it. I'm trying to pass it to `emscripten_set_mousedown_callback` and get back the reference inside that callback. I might be making a problem where there isn't one though, I have a couple other things I can try.
17:52:36PMunch@Phil, yes it compiles Nim. The GCC compiler likes CPU cycles :P
17:52:54FromDiscord<Ayy Lmao> Yeah it seems to work to store a hash table of pointer to references and get the reference from the table instead of trying to cast to it
17:53:13PMunchI think you where just doing it wrong somehow..
17:53:40PMunchBut it's hard to tell without any code
17:55:13*Gustavo6046_ is now known as Gustavo6046
17:55:39FromDiscord<Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=3OSb
17:56:45FromDiscord<Phil> Well... new nim new error, let me check first if that already has an issue
17:58:09FromDiscord<Phil> Cache clearing was once more the issue, that fixed it yehaw
18:00:01FromDiscord<Phil> sent a long message, see http://ix.io/3OSf
18:01:31FromDiscord<Phil> (edit) "http://ix.io/3OSf" => "http://ix.io/3OSj"
18:11:33PMunchIt's definitely one of those two
18:12:42PMunchCould you share you libwebp.nim file and I could try to build it here
18:12:51PMunchThat would narrow it down to one possibility
18:12:58FromDiscord<Phil> Sure, it's like 6 lines
18:13:10FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3OSl
18:16:36PMunchCompiles fine here
18:17:02PMunchFor me it looks like this: http://ix.io/3OSm
18:18:24PMunchBy the way, you can just delete `/home/isofruit/.cache/nim/project_d/r`
18:18:44PMunchUhm, that is d/r as in -d:debug or -d:release
18:19:01PMunchYou don't have to wipe the cache of every single program on your machine
18:21:20FromDiscord<Phil> No think!โ†ตJust delete!
18:21:51PMunch`sudo rm -rf /` woooo
18:21:56PMunchDid that by mistake once..
18:22:13FromDiscord<Phil> it's an older meme, but of quality
18:22:28PMunchI think actually new version of rm doesn't allow you to do that :P
18:22:34FromDiscord<Phil> I didn't do that, I did delete some central dir once though
18:22:55FromDiscord<Phil> Don't recall which one anymore though, I think after that my sudo just was nonexistant
18:48:48FromDiscord<mlokis> something pinged me , do you know what it was?
18:48:59FromDiscord<mlokis> on this channel of cource
18:49:06FromDiscord<mlokis> (edit) "cource" => "course"
18:49:22FromDiscord<Phil> When did you last look?
18:49:29FromDiscord<huantian> you can do a mentions search in discord
18:49:31FromDiscord<Phil> Because there was a ping yesterday for FOSDEM talks
18:49:48FromDiscord<huantian> ^ it was probably that though
18:52:28PMunch@Phil, I hade once unpacked the root structure for an SD card I was going to boot from. And by accident I copied the whole thing not into `./` as I had intended, but rather to `/`. So `sudo cp` set to work copying all the nice ARM binaries into my x86 system..
18:52:30PMunchThat was fun
18:58:08FromDiscord<Yepoleb> a friend once ran `chmod -R 777 /` because he got tired of using root to change files
18:58:48FromDiscord<Yepoleb> unfortunately a lot of tools check config file permissions and the system was unrecoverable
18:59:28FromDiscord<Yepoleb> like you can't sudo if the sudoers file is writable by everyone
19:01:01FromDiscord<slackaduts> sent a code paste, see https://play.nim-lang.org/#ix=3OSy
19:06:37FromDiscord<demotomohiro> I forget `^=` in python.
19:07:09FromDiscord<slackaduts> I loved it for "toggling" boolean values
19:08:05NimEventerNew thread by Planetis: Is it a good idea to downcast Hash, see https://forum.nim-lang.org/t/8873
19:08:10nrds<Prestige99> Like, foo = not foo?
19:08:58FromDiscord<slackaduts> i can't tell who's a person here and who's a regular bot lmao
19:10:56FromDiscord<Phil> Nimevener is bot
19:11:06FromDiscord<Phil> nrds is a portal for prestige to talk through to us
19:11:09FromDiscord<Phil> (edit) "to" => "with"
19:11:30FromDiscord<Phil> (edit) "Nimevener" => "Nimeventer"
19:11:46FromDiscord<slackaduts> In reply to @nrds "<Prestige> Like, foo =": foo ^= Trueโ†ตIIRC is the same as setting it to true if it's false, and setting it to false if it's true
19:12:18FromDiscord<demotomohiro> So `^` is used as bitwise xor operator in both C and python. Nim has `xor` binary bitwise xor operator.
19:12:53FromDiscord<demotomohiro> But Nim doesn't have `xor=` operator.
19:13:02FromDiscord<slackaduts> damn
19:13:21nrds<Prestige99> `foo = not foo` should work for that use case though
19:13:26FromDiscord<slackaduts> oh
19:14:49FromDiscord<Phil> The way prestige wrote it also looks a lot more readable to me
19:15:04FromDiscord<slackaduts> yeah
19:17:28FromDiscord<Phil> ... I maybe should've updated to ubuntu 20 sooner
19:17:29FromDiscord<Phil> maybe
19:17:39FromDiscord<slackaduts> I used to use ubuntu
19:17:49FromDiscord<slackaduts> like 7 years ago
19:17:52FromDiscord<slackaduts> (edit) "like 7 years ago ... " added "roughly"
19:18:23FromDiscord<Phil> It's been doing its job pretty well for me so far
19:19:25FromDiscord<Phil> But I did want to at least try a rolling release at one point before I fully settle on something... after having used ubuntu for 5 years now
19:19:37FromDiscord<slackaduts> yeah I use a debloated and mostly de-spyware'd windows 11 with startallback since the new start menu is complete pisswater
19:20:08FromDiscord<Arathanis> Using the VS Code Nim extension. Anyone know if there is a way to fix up `config.nims` and other NimScript files so they don't report incorrect errors w/ missing symbols?
19:20:31FromDiscord<slackaduts> I wish that extension did anything for me
19:20:44FromDiscord<Arathanis> In reply to @slackaduts "I wish that extension": agreed... it is lacking
19:20:48FromDiscord<Phil> I've never had any issues ith it so hard for me to say
19:20:56FromDiscord<Arathanis> but better than nothing, its got most of the basic
19:20:57FromDiscord<Arathanis> (edit) "basic" => "basics"
19:20:58FromDiscord<Phil> I'd like for the intellisense to work a bit more consistently but...eh
19:21:09FromDiscord<Arathanis> yeah the intellisense is a little off
19:21:25FromDiscord<Arathanis> it almost needs you to reference a symbol in a library first before it starts picking up the symbols in that library
19:21:51FromDiscord<Phil> The only time I get proper intellisense is right after typing the import statement
19:21:57FromDiscord<Phil> If I compile in between it's over
19:22:09FromDiscord<Arathanis> lol yeah its not great
19:22:11FromDiscord<Phil> After that, I only get name suggestions from stuff I typed previously
19:22:40FromDiscord<Arathanis> pretty much my experience as well
19:22:45FromDiscord<Arathanis> at least we got syntax highlighting, right?
19:22:53FromDiscord<Phil> Yeh, it's nice
19:24:09FromDiscord<Arathanis> well i found a workaround for `.nims` files
19:24:16FromDiscord<Arathanis> so that it stops complaining
19:24:27FromDiscord<Arathanis> its only a little hacky but i guess its better than red lines under everything
19:28:04FromDiscord<Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=3OSE
19:28:25FromDiscord<Arathanis> this ext seems to be actively maintained, so maybe ill post a github issue for it see if we can't get it to mature with feedback over time
19:46:55FromDiscord<Gustavo6046> In reply to @slackaduts "foo ^= True IIRC": wat, that's a bitwise operator, not a logical one
19:47:03FromDiscord<Gustavo6046> it makes sense if you want bitfields, though
19:52:07PMunch@slackaduts, I'm a bot though
19:52:41FromDiscord<slackaduts> lmao
19:52:57*PMunch bleep bloop
19:52:58FromDiscord<Phil> See, some bots tell the truth
19:53:01FromDiscord<Phil> Like NimEventer
19:53:05FromDiscord<Phil> And some bots are dirty fucking liars
19:58:23FromDiscord<Phil> Uh, shiny, Ubuntu 20 comes with clang 10
19:58:57PMunchYour use of shiny troubles me
19:58:57FromDiscord<Phil> Which now makes me only... like... 2 years and 3 versions behind
19:59:24PMunchThat's patinated at best
19:59:55FromDiscord<Phil> Fuck I didn't expect this stomach muscle laughter workout this evening ๐Ÿ˜„
20:02:02FromDiscord<Phil> In reply to @PMunch "Your use of shiny": OSholm Syndrome makes so many things shiny
20:07:11FromDiscord<Phil> Yeeeee either way, Clang 10 is not the solution
20:08:02PMunchOSholm?
20:09:16FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3OSR
20:09:28FromDiscord<Phil> So clang 12 or 13 likely are the target
20:11:52FromDiscord<Phil> In reply to @PMunch "OSholm?": By the fact I never left Debian for being unwilling to leave my Linux comfort zone while I was dealing with other things
20:13:00PMunchAaah :P
20:14:09PMunchI'm curious, could you send me the JSON file within the cache directory?
20:14:22PMunchI wonder what is actually stored as unexposed
20:15:17FromDiscord<Phil> https://media.discordapp.net/attachments/371759389889003532/939977567342059640/opir_FB883BC581E5EE78.json
20:16:47FromDiscord<Phil> That was the json you wanted right?โ†ต`.cache/nim/nimlibwebp_d/opir_lotsofnumbers.json`?
20:17:47FromDiscord<Phil> Here in case the opir.json from `.cache/nim/opir_r/opir.json` https://media.discordapp.net/attachments/371759389889003532/939978197133570058/opir.json
20:17:53FromDiscord<Phil> (edit) "Here in case the opir.json from `.cache/nim/opir_r/opir.json` ... https://media.discordapp.net/attachments/371759389889003532/939978197133570058/opir.json" added "was your goal"
20:30:22PMunchThe first one was what I was looking for
20:33:05PMunchHmm, not entirely sure why clang isn't able to read that one
20:33:31PMunchThe line is `typedef int (*WebPWriterFunction)(const uint8_t* data, size_t data_size, const WebPPicture* picture);`
20:35:23FromDiscord<Phil> I'm on my way to Ubuntu 21.10 so I'll tell you afterwards if that helped or not
20:41:54FromDiscord<Elegantbeef> It seems iso is moving to futhark for wrapping webp?
20:42:15FromDiscord<Phil> Pretty much. Not that I got far so far mind you
20:42:49FromDiscord<Phil> I think atm it's getting wrapping with futhark to work in general
20:43:14FromDiscord<Phil> For weblibp anyway, given my clang was just so insanely out of date I'm jumping from 18.04 to 21.10
20:43:25FromDiscord<Elegantbeef> It's a relatively simple API like i said ๐Ÿ˜€
20:43:46FromDiscord<Phil> Generally yes
20:43:53FromDiscord<Phil> But I relatively quickly get open questions
20:44:04FromDiscord<Phil> Like "How do I translate uint8 to nim"
20:44:10FromDiscord<Elegantbeef> `uint8`
20:44:24FromDiscord<Phil> I need an emoji that blinks right now
20:44:24FromDiscord<Elegantbeef> webp uses fixed size types
20:44:27FromDiscord<Elegantbeef> You can use the Nim types in that case
20:44:39FromDiscord<Phil> What do you mean there's a uint
20:44:49FromDiscord<Elegantbeef> Nim has unsigned integers
20:45:34FromDiscord<Phil> I just... never tried. I though they were discouraged due to the easily unintended behaviour they can cause and thus everything is just int
20:45:43FromDiscord<Elegantbeef> Sure but this is cinterop
20:45:45FromDiscord<Phil> Thus didn't even know they were implemented
20:45:47FromDiscord<Elegantbeef> You need types that match
20:46:09FromDiscord<Phil> That makes sense I guess I just didn't think that far
20:51:48FromDiscord<that_dude> Is there a way I can easily suppress only these error messages? https://media.discordapp.net/attachments/371759389889003532/939986758995677264/unknown.png
20:52:13FromDiscord<Elegantbeef> Those arent error messages
20:52:22FromDiscord<Elegantbeef> you can do `--warning[HoleEnumConv]:off`
20:52:47FromDiscord<that_dude> True not errors, but kinda like warnings right
20:52:49FromDiscord<that_dude> Thanks!
20:53:01FromDiscord<that_dude> oh lol
20:55:07FromDiscord<Elegantbeef> You can also do it in code just for the import but i dont know how that works with generics
20:55:46FromDiscord<that_dude> How would I do that?
20:56:08FromDiscord<that_dude> Is it kinda like the way I put in experimental pragmas at the top?
20:56:30FromDiscord<Elegantbeef> `{.push warning[HoleEnumConv]: off.}` followed by a `{.pop.}` where you want it to end
20:56:42FromDiscord<that_dude> Thanks!
21:04:25NimEventerNew thread by Ryback08: Strutils count function bug with non ascii table ?, see https://forum.nim-lang.org/t/8874
21:06:37FromDiscord<Arathanis> rip importing nimscript and qualifying the procs doesn't actually work, i guess ill just deal with all the errors in `.nims` files for now
21:08:38FromDiscord<Elegantbeef> What?
21:09:01FromDiscord<Arathanis> im on VS Code using the nims extension for sytax highlighting and the like
21:09:16FromDiscord<Arathanis> `config.nims` files report missing symbol errors all over the place
21:09:22FromDiscord<Arathanis> even though they execute just fine
21:09:37FromDiscord<Arathanis> seems to be unaware of the automatic imports when `config.nims` get executed
21:10:05FromDiscord<Elegantbeef> Think there was a fix for that in devel
21:10:16FromDiscord<Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=3OT5
21:10:19FromDiscord<Arathanis> for nimsuggest?
21:10:29FromDiscord<Arathanis> In reply to @Elegantbeef "Think there was a": for nimsuggest?
21:10:50FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/pull/19444
21:11:20FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/issues/19440 issue is here
21:13:23FromDiscord<Arathanis> ok cool so a fix is coming
21:16:28FromDiscord<Phil> Huh
21:16:34FromDiscord<Phil> Ubuntu 21.10 comes with clang 13
21:19:33FromDiscord<Arathanis> you can also almost always add dev / future ppa to ubunutu
21:19:51FromDiscord<Arathanis> its like 1 line, then you get lots of fully updated things
21:21:03FromDiscord<Phil> pmunch! Clang 13 was indeed the solution
21:22:22FromDiscord<Phil> Now to comprehend how on earth to use that API
21:23:33FromDiscord<Elegantbeef> Well you still need to get to link it ๐Ÿ˜›
21:24:45FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3OT9
21:25:39FromDiscord<Elegantbeef> But it doesnt link the library does it?
21:26:28FromDiscord<Phil> I have no comprehension of anything, so the answer to that lies with pmunch and you
21:26:36FromDiscord<Phil> My thought level so far is:
21:27:02FromDiscord<Elegantbeef> Well the header doesnt have the implementation so you need to do `{.link: "libweb.a".}` for \nix afaik
21:27:03FromDiscord<Phil> C --> C-like nim through futhark --> procs from me that call the C-like nim procs
21:27:28FromDiscord<Phil> Ah, that
21:27:50FromDiscord<Phil> I pass `--passL:'-lwebp'` , I was under the impression that gives the compiler the lib for dynamic linking
21:28:05FromDiscord<Elegantbeef> That'd be for static linking
21:28:12FromDiscord<Elegantbeef> Afaict this library is shipped only statically
21:29:06FromDiscord<Phil> sh....orts
21:30:33FromDiscord<xx_ns> what
21:30:44FromDiscord<xx_ns> what is the purpose of a library you can't link against
21:31:16FromDiscord<Elegantbeef> What?
21:32:42FromDiscord<xx_ns> I dunno, I literally just jumped in here
21:32:59*Onionhammer quit (Quit: The Lounge - https://thelounge.chat)
21:33:08FromDiscord<Elegantbeef> We're talking about linking webp, it's shipped as a static library due to googles supreme intellect ๐Ÿ˜€
21:33:10FromDiscord<Elegantbeef> So they need to link it before using it
21:35:03FromDiscord<xx_ns> I always thought a static library is.. well, code, which is included in your project. You can still compile the library, export symbols and link against that
21:35:23FromDiscord<Elegantbeef> Well it's a library that needs to be linked statically
21:35:36FromDiscord<Elegantbeef> It has it's own format, and works similar to a dynamic library
21:35:44FromDiscord<Elegantbeef> The difference is it's inside your final binary
21:37:07*jjido quit (Quit: Textual IRC Client: www.textualapp.com)
21:37:10FromDiscord<noow> In reply to @Elegantbeef "We're talking about linking": if a webp vuln drops, all programs will be like recompiling aggressively
21:37:46FromDiscord<xx_ns> I'm not sure I follow. Static libraries (.a) can still be linked against
21:37:57FromDiscord<Elegantbeef> No one said they couldnt?
21:38:02FromDiscord<xx_ns> oh
21:38:12*jmdaemon joined #nim
21:38:22FromDiscord<xx_ns> misinterpreted then, sorry
21:38:22FromDiscord<Elegantbeef> Both libraries need to be linked, it's in the name afterall
21:38:36*Onionhammer joined #nim
21:39:06FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3OTe
21:39:26FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=3OTe" => "https://play.nim-lang.org/#ix=3OTf"
21:39:27FromDiscord<Elegantbeef> Anway you should be able to do `{.link: "libwebp.a".}`
21:40:25FromDiscord<Elegantbeef> Assuming the libwebp.a is next to your file i think
21:40:41FromDiscord<Phil> Was about to say whether it infers the files location or I have to give the path
21:40:54FromDiscord<Phil> .... Yeah it needs the path
21:41:23FromDiscord<Elegantbeef> Well there is no path for storing static libraries on linux
21:41:31FromDiscord<Elegantbeef> Dont know the best way to handle this anyway
21:41:37FromDiscord<Elegantbeef> I dont know if pmunch is still about
21:41:39FromDiscord<Elegantbeef> He probably knows
21:42:28FromDiscord<Phil> Oh wait, there is a dynamic version that you can install from the repo, libwebp-dev... that is just version 0.6 vs 1.2.2
21:43:15FromDiscord<Phil> 0.6.1-2.1, whatever that means
21:44:34FromDiscord<Waldecir Santos> can someone point me to a example for the use of `closure` pragma ?
21:45:19FromDiscord<Waldecir Santos> (edit) "a" => "an"
21:45:36FromDiscord<Elegantbeef> generally ime you dont use closure manually
21:46:25FromDiscord<Waldecir Santos> Sure, but I just want to understand how it works, and what are the usages for it
21:46:30FromDiscord<Elegantbeef> I guess except for iterators
21:47:20FromDiscord<noow> closures are functions with references to local variables outside the function body
21:48:27FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3OTj
21:48:29FromDiscord<Elegantbeef> Here is an example of what a closure iterator can do
21:48:43FromDiscord<Elegantbeef> They're first class iterators which means they can be stored
21:48:53FromDiscord<Elegantbeef> They also hold state which means you can use them like functions
21:50:06FromDiscord<noow> /unrelated is it possible to read the state of an iterator, like whether it's finished/dead or still has yields to do
21:50:12FromDiscord<Waldecir Santos> Sure but where `{.closure.}` pragma fits in it ?
21:50:16FromDiscord<Elegantbeef> functions that remember what's going on \
21:50:32FromDiscord<Elegantbeef> `iterator: int` is implicitly `iterator: int {.closure.}`
21:50:49FromDiscord<Elegantbeef> closure is implicitly applied to proc definitions and iterators
21:51:14FromDiscord<Waldecir Santos> Ohh I see, got it
21:52:02FromDiscord<Elegantbeef> https://github.com/beef331/goodwm/blob/58c67eca84a86aa9ded6c1d5362129b737ddde9a/src/goodwm/layouts.nim an example of why you might want to use closure iterators is something like this
21:52:19FromDiscord<Elegantbeef> It allows you to instantiate them with data then just work with that data as you go
21:52:58FromDiscord<Elegantbeef> Though i now have a `asClosure` macro i'd just use here to reduce the proc factory
21:53:42FromDiscord<Waldecir Santos> perfect, thank you
21:54:45FromDiscord<Elegantbeef> https://github.com/beef331/slicerator/blob/master/tests/test1.nim#L73-L159 for more examples of what closures let you do
21:55:22FromDiscord<Elegantbeef> Ah i guess i have the unrelated "Range iters" test there ;D
22:02:25FromDiscord<Phil> If something in C blobbers about "returns the size of the compressed data" are they just talking about "this is a count of bytes" or "this is all the output bytes" ?
22:03:38FromDiscord<Phil> Is the documentation within the header file seriously all the API documentation you get for the individual procs?
22:03:46FromDiscord<Elegantbeef> the amount of bytes in the output data
22:04:11FromDiscord<Elegantbeef> Yes it is
22:04:11FromDiscord<Elegantbeef> What proc are you using?
22:06:20FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3OTn
22:07:13FromDiscord<Elegantbeef> stride is the distance between pixel data
22:07:21FromDiscord<Elegantbeef> if it's tightly packed data it'll be 0
22:07:23FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=3OTn" => "https://play.nim-lang.org/#ix=3OTo"
22:07:38FromDiscord<Elegantbeef> the `output` is a pointer to a int byte array the program will write to
22:07:48FromDiscord<Elegantbeef> This is a common way of C to operate
22:08:58FromDiscord<Elegantbeef> The reason stride exists is incase your pixel data is non contiguous so you can easily interact with this api
22:09:12FromDiscord<Elegantbeef> Aslong as your rgb data is next to it and next elements are the same distance apart
22:10:14FromDiscord<Phil> So for any person like me before I went down this rabbit hole I'll definitely want to use WebPEncodeRGB and whatever the proc is called that converts... I dunno, JPEG bytes from whatever they have into RGB together just so I can have a simple API proc of "convertJpegToWebP"
22:12:37NimEventerNew thread by Mrgaturus: NPainter: progress report 2020 & 2021, see https://forum.nim-lang.org/t/8875
22:14:00FromDiscord<Elegantbeef> Ew using procedure name to dictate flow ๐Ÿ˜›
22:14:04FromDiscord<Elegantbeef> But yea
22:15:57FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3OTr
22:17:13FromDiscord<Phil> data is ptr seq[uint8]?
22:17:30FromDiscord<Elegantbeef> data is a `ptr uint8`
22:17:46FromDiscord<Elegantbeef> it's the address to the first element in your array
22:17:51FromDiscord<Phil> I may be interpreting this wrong
22:17:52FromDiscord<Phil> Ohhhh
22:17:56FromDiscord<Phil> That was what was confusing me
22:18:07FromDiscord<Phil> because the type is an array so why do I have a single uint8 there
22:18:16FromDiscord<noow> you can also cast it to ptr UncheckedArray[uint8]
22:18:32FromDiscord<Elegantbeef> Eh no point casting it here
22:18:57FromDiscord<noow> probably
22:19:20FromDiscord<Elegantbeef> A lot of C array passing is just pointer to the first element
22:19:24FromDiscord<Phil> why make the output width x height x 3? for rgb?
22:19:38FromDiscord<Elegantbeef> We know at max it'll be that size
22:19:53FromDiscord<noow> no alpha? ๐Ÿ˜›
22:19:56FromDiscord<Elegantbeef> There is some compression with webp but at max it will be the size of the image times 3 due to 0 compression
22:20:25FromDiscord<Phil> times 3 because full uint8 for individual values of r, g and b I assume
22:20:36FromDiscord<Phil> (edit) "times 3 because full uint8 for individual values of r, g and b ... I" added "for every pixel"
22:20:39FromDiscord<Elegantbeef> yes
22:20:50FromDiscord<Elegantbeef> That's just an assumption though
22:20:54FromDiscord<Elegantbeef> I should read the comment
22:22:23FromDiscord<Elegantbeef> Oh wait i'm wrong
22:22:27FromDiscord<Elegantbeef> You dont need the sequence
22:22:35FromDiscord<Elegantbeef> It allocates the data for you
22:23:00FromDiscord<Elegantbeef> So then after encoding you need to call `WebPFree(output)`
22:23:44FromDiscord<Phil> Don't I have to store the output somewhere first?
22:24:03FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3OTs
22:24:06FromDiscord<Elegantbeef> Then you can do whatever you want with that
22:24:27FromDiscord<Elegantbeef> Welcome to C where a `ptr ptr uint8` is actually a `ptr uint8[]`
22:24:42FromDiscord<Elegantbeef> Cause "fuck type safety"
22:27:51FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3OTw
22:28:15FromDiscord<Elegantbeef> Welcome to a type safe language
22:28:35FromDiscord<Elegantbeef> do `cast[ptr ptr uint8](output)`
22:29:17FromDiscord<Phil> How do I just... get the pointer from the data? I'd like for users of nim to not have to ever even see the ptr show up in the proc signature, so I'd like for them to hand me data and then I just specifically pass on the pointer to it
22:29:38FromDiscord<Elegantbeef> This is where wrapping the stuff idiomatically happens
22:29:56FromDiscord<Elegantbeef> you expose one that takes an `openArray[uint8]` then do `myOA[0].addr`
22:30:22FromDiscord<Elegantbeef> You will either have to return a pointer or copy it to a sequence for the return value
22:30:33FromDiscord<Phil> Ohhhh .addr is the proc that returns the pointer
22:30:44FromDiscord<Elegantbeef> Yes it's address
22:30:53FromDiscord<Elegantbeef> Much more clear than `&` methinks ๐Ÿ˜›
22:31:16FromDiscord<Phil> I fully agree
22:34:17FromDiscord<Phil> This is the kind of stuff that makes me believe you need to know C first to wrap C
22:34:32FromDiscord<Phil> I can't thank you enough for the explanations
22:35:04FromDiscord<Phil> That's more gotchas in the last hour than I've seen in JS since I started coding in it... and I'm not particularly a fan of JS
22:35:34FromDiscord<Elegantbeef> I dont know C
22:35:48FromDiscord<Phil> squints
22:36:16FromDiscord<Elegantbeef> I mean it's semantics of a manual allocated language ๐Ÿ˜›
22:37:36FromDiscord<Phil> to copy from UncheckedArray to a seq[uint8]
22:37:48FromDiscord<Phil> Do I just loop over the uncheckedArray or do we have some sort of copy operator ?
22:38:11FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3OTx
22:42:40FromDiscord<Phil> It is officially impossible for C to become obsolete fast enough
22:42:52FromDiscord<Elegantbeef> Zig and Odin are trying
22:43:04FromDiscord<Phil> They have to try harder if this is what sane people need to deal with
22:43:18FromDiscord<Elegantbeef> I mean C is the interop language
22:43:31FromDiscord<Elegantbeef> So this will happen even if no one used C directly
22:46:43NimEventerNew thread by Aquachain: Get unicode codes of a string, see https://forum.nim-lang.org/t/8876
22:53:48FromDiscord<Phil> oh.... oh god... this isn't even the only lib I'll need. I need to also get stuff that converts from jpeg to rgb as that's not in the lib
22:53:50FromDiscord<Phil> Welp
22:55:53FromDiscord<Phil> Yeah I'm not delaing with that today. I'll keep what you said in mind. I'm writing myself notes of what I've learned so far and then head to bed
22:56:00FromDiscord<Phil> (edit) "delaing" => "dealing"
22:58:36FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3OTC
22:58:53FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=3OTC" => "https://play.nim-lang.org/#ix=3OTD"
22:59:31FromDiscord<Elegantbeef> The fuck are you on about? ๐Ÿ˜€
22:59:48FromDiscord<Elegantbeef> the sequence is allocated to it's `len`
23:00:05FromDiscord<Elegantbeef> so we know for certain that `size` will fit inside the sequence
23:00:16FromDiscord<Phil> Ohhhhhhhhh right
23:00:19PMunchYou're still having fun I see @Phil :P
23:00:34FromDiscord<Phil> In reply to @PMunch "You're still having fun": I have no idea how C dev survive
23:00:40FromDiscord<Phil> (edit) "dev" => "devs"
23:00:56PMunchIt's not that bad once you get used to
23:01:11FromDiscord<Elegantbeef> Is stockholm nice this time of year?
23:01:48PMunchOnce you get your head inside the machine, understand how everything works, then you sorta start to think about what the other languages are doing under the hood.
23:01:51PMunchHaha :P
23:01:52FromDiscord<Phil> So far every second word in C has been a gotcha
23:02:11PMunchIt's a dense language, but if you think C is bad don't try Forth :P
23:02:32PMunchSomeone crashed a spaceship because they mistook a , for a . in Forth
23:02:39PMunchCouple million dollars right out the window
23:03:14FromDiscord<Elegantbeef> Well C is a "simple" language
23:03:23FromDiscord<Elegantbeef> The simple means it doesnt have many mechanisms ๐Ÿ˜€
23:03:52FromDiscord<Elegantbeef> If only pascal won
23:03:55FromDiscord<Phil> Nim is my fourth language and with it I've got my bases covered. Nim for fun and performance, python for fun and ecosystem, Java to make money and JS/TS for web
23:05:14PMunchIf only I could make money with Nim..
23:05:39FromDiscord<Elegantbeef> Dont you use Nim at your job you jester
23:06:34FromDiscord<Elegantbeef> Oh and pmunch this is my level editor now https://streamable.com/z3ny3a it's 100% more sensible now
23:07:09PMunchWell yes, but only when I manage to sneak it past management :P
23:07:57PMunchWait, this is a new game?
23:08:07PMunchLooks really solid!
23:08:19FromDiscord<Elegantbeef> "New game"
23:08:30FromDiscord<Elegantbeef> It's a 2D project that i made forever ago
23:08:52FromDiscord<Elegantbeef> Ported it to 3D in november, then got back to it again recently
23:09:22PMunchBefore the one you wrote in Nico which I can never remember the name of?
23:09:31PMunchBut which I played waaay too much
23:09:37FromDiscord<Elegantbeef> Linerino
23:09:42PMunchThat's the one!
23:10:42FromDiscord<Elegantbeef> Nah i made it after linerino but stopped working on it for whatever reason
23:10:49FromDiscord<Phil> Alright, heading to bed, have a good time you guys and thank you both very much for the support!
23:11:16FromDiscord<Elegantbeef> https://streamable.com/pj725f was the 2D version
23:11:25FromDiscord<Elegantbeef> No problem
23:12:09FromDiscord<Elegantbeef> Buh bye
23:17:48PMunchOh yeah, I remember you sharing some screenshots of that
23:18:02PMunchThe 3D version looks super tight though
23:18:26PMunchSorry for the slow response, got stuck playing Linerino on the hardest difficulty (again)
23:18:31PMunchBut I'm off to bed as well
23:18:35*PMunch quit (Quit: leaving)
23:18:39FromDiscord<Elegantbeef> Buh bye
23:21:38*jmdaemon quit (Ping timeout: 250 seconds)
23:45:19FromDiscord<noow> why does strtok modify its argument
23:45:22FromDiscord<noow> C ๐Ÿ˜ญ
23:48:03FromDiscord<noow> it's okay it's okay <string.h> is a what string manipulation libraries should look like
23:59:08FromDiscord<Yepoleb> C is cursed stuff