<< 03-07-2022 >>

00:01:20reversem3[m]What does [U] generic mean ?
00:01:32FromDiscord<Elegantbeef> It doesnt mean anything
00:01:35FromDiscord<Elegantbeef> It's a generic parameter name
00:01:36FromDiscord<retkid> every time someone has mentioned bitwise function i got scared
00:01:44FromDiscord<retkid> im only embracing tensors and linear algebra now
00:01:58reversem3[m]ok so [T] is arbitrary also ?
00:01:59FromDiscord<retkid> (edit) "every time someone has mentioned bitwise function i got scared ... " added "and dont listen"
00:02:07FromDiscord<Elegantbeef> Yes
00:02:23FromDiscord<Elegantbeef> It's no different to parameter names it can be anything
00:02:32FromDiscord<retkid> [T] is arbitrary input, where the type is irrelevant
00:02:33FromDiscord<Generic> bitwise operations are really not much of a big deal
00:02:40FromDiscord<retkid> In reply to @Generic "bitwise operations are really": they have a scary name
00:02:44reversem3[m]Thank you
00:03:04FromDiscord<Generic> it's really just, this number is a bunch of binary digits now
00:03:09FromDiscord<Generic> now do some operations with those
00:03:24FromDiscord<retkid> well ye
00:03:25FromDiscord<retkid> (edit) "ye" => "yes"
00:03:42FromDiscord<retkid> but how would "FF" bitwise yield a binary of FF
00:04:09FromDiscord<Generic> what you mean?
00:04:10FromDiscord<Elegantbeef> `FF or y`
00:04:24FromDiscord<Elegantbeef> Honestly you should just share code
00:04:34FromDiscord<retkid> This is inprincaple
00:04:40FromDiscord<retkid> (edit) "inprincaple" => "in principle"
00:05:00FromDiscord<retkid> i don't understand how i would bitwise from an unprintable character to the digit of FF
00:05:15FromDiscord<Elegantbeef> Who cares if the character is unprintable
00:05:21FromDiscord<retkid> ok
00:05:23FromDiscord<Generic> it's still a number
00:05:25FromDiscord<retkid> a string representing FF
00:05:33FromDiscord<retkid> (edit) "string" => "character"
00:05:38FromDiscord<retkid> to the digit FF
00:05:40FromDiscord<Elegantbeef> Ok so you have `"FF"`?
00:05:50FromDiscord<Generic> the digit FF is a hexadecimal number
00:05:54FromDiscord<retkid> this is an example because this was advice
00:05:58FromDiscord<Generic> it's 1111 1111
00:05:59FromDiscord<retkid> you gave
00:06:01FromDiscord<retkid> ye
00:06:18FromDiscord<Elegantbeef> Well hopefulyl generic can answer cause i dont follow
00:06:44FromDiscord<Generic> ah I think I understand
00:06:55FromDiscord<retkid> but the character "ÿ" yield 11111111 if i bitwised it
00:07:01FromDiscord<retkid> (edit) "but ... the" added "how does"
00:07:18FromDiscord<Generic> two things
00:07:23FromDiscord<Elegantbeef> bitwise ops are relatively simple operations
00:07:29FromDiscord<Generic> first of all, bitwise operations is a category of operations
00:07:44FromDiscord<Elegantbeef> bitwise `or` will return whether a bit is on in that position in either operand
00:07:58FromDiscord<Elegantbeef> bitwise `and` will return whether a bit is on in that position in both operands
00:08:15FromDiscord<Generic> but second of all, you wouldn't convert anything to a string when using bitwise operations to do what you want
00:08:31FromDiscord<Generic> you'd do it something like this:
00:08:36FromDiscord<Elegantbeef> bitwise `xor` returns whether a bit is on in one but off in the other operand at that position
00:08:48FromDiscord<Elegantbeef> Wait is that xor 😄
00:09:05FromDiscord<Elegantbeef> It is xor!
00:09:07FromDiscord<Generic> xor is whether they're different
00:09:15FromDiscord<Yardanico> yes, which is the same
00:09:45FromDiscord<Generic> sent a code paste, see https://play.nim-lang.org/#ix=41tv
00:09:51FromDiscord<Generic> see, no string conversions at all!
00:10:10FromDiscord<Elegantbeef> bitwise ops are not that compilcated
00:10:33FromDiscord<Generic> it only gets complicated when you start doing some arcane tricks which mix bitwise operations with arithmetic operations
00:11:42FromDiscord<Elegantbeef> now if only generic could write valid Nim code 😛
00:11:51FromDiscord<Elegantbeef> left out the `in`
00:12:07FromDiscord<Generic> normally vscode would give me the snippet which would fill that in for me 😛
00:13:07FromDiscord<Generic> reminds me of how I felt recently when the testing period of github copilot ended
00:13:27FromDiscord<Generic> though it was never that good for Nim anyway and constantly suggested me pythonisms
00:13:57FromDiscord<Generic> though better than tabnine which saw all the `proc` and thought this was pascal
00:18:04FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/d6E
00:18:33FromDiscord<Elegantbeef> So then you just do the long version of the above and write any place a `1` appears a `1` in the output and if there are no 1s a `0`
00:19:56FromDiscord<retkid> beef can i copy mem as a way to append to a sequence?
00:20:11FromDiscord<retkid> for should i do it the boring old way of .add
00:20:13FromDiscord<Elegantbeef> Yes grow the sequence by the amount you need then copy the data to there
00:20:48FromDiscord<Elegantbeef> Shit
00:20:50FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=41ty
00:20:55FromDiscord<retkid> so dont start it at the end size
00:20:57FromDiscord<retkid> ?
00:21:07FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=41tz
00:21:18FromDiscord<Elegantbeef> I mean you want to add an element so you grow the sequence
00:22:44FromDiscord<Elegantbeef> you can also do `mySeq.add default(typeof(mySeq[0]))`
00:22:53FromDiscord<Elegantbeef> Whatever floats your boat
00:24:06FromDiscord<Generic> great english idiom
00:33:34FromDiscord<zhmtzhmt> sent a code paste, see https://play.nim-lang.org/#ix=41tD
00:33:54FromDiscord<zhmtzhmt> Is compile with c++ file supported?
00:34:21FromDiscord<Elegantbeef> if you use `nim cpp` yes
00:34:50FromDiscord<zhmtzhmt> cpp is only supported when nim run?
00:35:02FromDiscord<zhmtzhmt> Not for compile?
00:35:10FromDiscord<Elegantbeef> I mean you need to use the c++ backend
00:35:20FromDiscord<Elegantbeef> Nim uses the C backend by default
00:35:43FromDiscord<zhmtzhmt> Thanks, I will try to switch to c++
00:37:39FromDiscord<zhmtzhmt> cpp option cannot be used with compile
00:38:08FromDiscord<zhmtzhmt> Error: arguments can only be given if the '--run' option is selected
00:38:09FromDiscord<Elegantbeef> Are you sure?
00:38:22FromDiscord<Elegantbeef> you're compiling wrong
00:38:34FromDiscord<Elegantbeef> you cannot put arguments after the file name
00:39:27FromDiscord<zhmtzhmt> sent a code paste, see https://play.nim-lang.org/#ix=41tE
00:39:40FromDiscord<zhmtzhmt> Is this right?
00:39:56FromDiscord<Elegantbeef> you dont need `compile`
00:40:12FromDiscord<Elegantbeef> `cpp` is explicitly "compile with cpp"
00:40:40FromDiscord<zhmtzhmt> Thank you
00:40:52FromDiscord<zhmtzhmt> It starts to compile
00:50:53FromDiscord<zhmtzhmt> It compiles successfully. Thanks very much.
01:37:04FromDiscord<demotomohiro> @zhmtzhmt `-std=c++20` is an option for compiler, not for linker isn't it?↵If so, you should use it with passC or localPassC pragma.
01:44:14*pch quit (Read error: Connection reset by peer)
01:45:06*pch joined #nim
01:51:55*wallabra quit (Quit: ZNC 1.8.2 - https://znc.in)
01:53:42*wallabra joined #nim
02:06:36*pch quit (Read error: Connection reset by peer)
02:27:05*pch joined #nim
02:44:38*dtomato quit (Quit: The Lounge - https://thelounge.chat)
02:51:39*wallabra_ joined #nim
02:52:36*wallabra quit (Ping timeout: 276 seconds)
02:53:32*wallabra_ is now known as wallabra
03:09:49FromDiscord<ripluke> In reply to @Elegantbeef "Whatever floats your boat": Coding pun?
03:10:26FromDiscord<Elegantbeef> No, but yes
03:11:43FromDiscord<ripluke> Lol
04:10:41*arkurious quit (Quit: Leaving)
04:35:12FromDiscord<ripluke> Fucking awesome https://media.discordapp.net/attachments/371759389889003532/993012004447076382/IMG_1439.jpg
04:42:01*vicecea quit (Remote host closed the connection)
04:42:32*vicecea joined #nim
04:48:18*rockcavera quit (Remote host closed the connection)
04:52:27FromDiscord<amadan> Wouldn't `sudo pacman -Si {package}` work?
04:53:11FromDiscord<Prestige> or a screenshot
05:07:10*al1ranger joined #nim
05:24:44*al1ranger quit (Quit: Leaving)
05:36:56FromDiscord<Tattva> In reply to @ripluke "Fucking awesome": Is that co-pilot? I couldn't get it to work with Nim. Kept giving me Haskell instead 😦
05:37:38FromDiscord<Elegantbeef> Hopefully it's not cause it's giving bad code advise
05:44:13*dtomato joined #nim
05:45:49FromDiscord<ripluke> In reply to @Avahe "or a screenshot": 💀
05:45:54FromDiscord<ripluke> I'm on wayland
05:46:02FromDiscord<ripluke> We don't have that here 🙂
05:46:02FromDiscord<Elegantbeef> So what
05:46:08FromDiscord<Elegantbeef> I'm on wayland and i can take screen shots
05:46:15FromDiscord<ripluke> With what
05:46:26FromDiscord<ripluke> In reply to @Elegantbeef "Hopefully it's not cause": It is :p
05:46:31FromDiscord<Elegantbeef> I accidently installed gnome so..... let's not talk about that
05:46:48FromDiscord<ripluke> Gnome Wayland isn't the same as wlroots lol
05:46:59FromDiscord<j-james> wlroots has a screenshot api...
05:46:59FromDiscord<Elegantbeef> Well it should just be `execShellCmd("command") == 0`
05:47:11FromDiscord<ripluke> In reply to @Elegantbeef "Well it should just": Ywa
05:47:14FromDiscord<ripluke> (edit) "Ywa" => "Ye"
05:47:19FromDiscord<ripluke> I fixed it after
05:47:22FromDiscord<ripluke> (edit) "Ye" => "Yea"
05:47:42FromDiscord<huantian> In reply to @Tattva "Is that co-pilot? I": I mean they’re quite similar 😛
05:47:52FromDiscord<ripluke> In reply to @huantian "I mean they’re quite": Not really
05:48:08FromDiscord<huantian> (That was a joke)
05:48:12FromDiscord<ripluke> Well then again my experience with it consists of an xmonad config
05:48:17FromDiscord<huantian> I know they are not similar
05:48:17FromDiscord<ripluke> In reply to @huantian "(That was a joke)": Oh 💀
05:48:59FromDiscord<ripluke> In reply to @j-james "wlroots has a screenshot": Ok and what programs use it lol
05:50:16FromDiscord<Prestige> Have you heard of our lord and savior, x11?
05:50:35FromDiscord<Prestige> _is biased_
05:50:42FromDiscord<Elegantbeef> Prestige i'm on gnome/wayland cause I cannot click gui well
05:50:42FromDiscord<j-james> all of them?
05:51:04FromDiscord<Prestige> I don't know what you mean beef?
05:51:08FromDiscord<Elegantbeef> Wayland should be better to implement TWMs in so nimdow-wayland
05:51:18FromDiscord<j-james> grim, flameshot, some kde stuff, etc
05:51:25FromDiscord<Elegantbeef> I installed debian and misclicked gnome instead of a different DE
05:51:44FromDiscord<Prestige> Oh haha
05:51:57FromDiscord<Prestige> I think you can switch that relatively easily without affecting anything else
05:51:57FromDiscord<ripluke> In reply to @j-james "grim, flameshot, some kde": Tried flameshot and the kde one
05:52:01FromDiscord<Prestige> If you care that is
05:52:04FromDiscord<ripluke> In reply to @ripluke "Tried flameshot and the": I'll try grim ig
05:52:05FromDiscord<Elegantbeef> You can but i'm lazy
05:52:14FromDiscord<Prestige> Fair enough man
05:52:26FromDiscord<Elegantbeef> I'd like a tiling window manager but i realize they all have slight things that annoy me 😄
05:52:27FromDiscord<ripluke> In reply to @Elegantbeef "Wayland should be better": If this actually happens lol I'd use it
05:52:50FromDiscord<Elegantbeef> I need to make my own compositor for wayland but i dont want to spend all that time half assing a spec i dont understand
05:52:58FromDiscord<Prestige> I don't know how tedious it is to write a tiling window manager for Wayland, I haven't even tried Wayland because I hear of all the issues it has
05:53:07FromDiscord<ripluke> In reply to @Elegantbeef "I'd like a tiling": Yes that's why I wm hop all the time
05:53:15FromDiscord<Elegantbeef> It's working swell so far havent really noticed any issues as of yet
05:53:51FromDiscord<Prestige> If I were to completely move to Wayland, I'd definitely port Nimdow
05:53:57FromDiscord<ripluke> In reply to @Avahe "I don't know how": Yea x is a lot simpler
05:54:08FromDiscord<j-james> In reply to @Avahe "I don't know how": i've never had issues other than with screen recording
05:54:16FromDiscord<ripluke> In reply to @ripluke "Yea x is a": And Nim has bindings for it
05:54:21FromDiscord<huantian> I’m probably gonna move to wayland when I get my laptop
05:54:23FromDiscord<Elegantbeef> You say that but X is also not documented 😄
05:54:33FromDiscord<ripluke> In reply to @j-james "i've never had issues": I found a good screen recorder
05:54:34FromDiscord<j-james> it gets some heat because the developers left important apis for wlroots
05:54:36FromDiscord<Elegantbeef> Futhark goes brr↵(@ripluke)
05:54:43FromDiscord<Prestige> Figuring out all the crap X wants was super annoying
05:54:46FromDiscord<ripluke> In reply to @Elegantbeef "Futhark goes brr (<@704106773660827690>)": Lol
05:55:21FromDiscord<ripluke> I like Wayland cuz I get less cpu usage lol
05:55:42FromDiscord<Elegantbeef> wayland promises an easier API for things like TWM if that's true and i make one that doesnt piss me off i'd be happy
05:55:43FromDiscord<ripluke> And the foot terminal is super fast
05:56:29FromDiscord<Prestige> Elegantbeef if I get so inclined to try Wayland I could just build one, and you can give input/request features
05:56:49FromDiscord<j-james> In reply to @j-james "it gets some heat": which, granted, did directly cause gnome's implementation fragmentation and most of the issues with screen capture
05:56:59FromDiscord<j-james> but the split's not that bad
05:57:22FromDiscord<Elegantbeef> A big one prestige is using wasm for customisation 😛
05:57:31FromDiscord<Elegantbeef> Have your layout engine be a fucking wasm plugin system
05:57:35FromDiscord<ripluke> https://github.com/ammen99/wf-recorder↵This is what I use for screen recording
05:57:42FromDiscord<ripluke> On wayland
05:57:48FromDiscord<Prestige> If you're down to help figure that out, I think it'd be great to have
05:58:01FromDiscord<Elegantbeef> I mean i have wasm playground implemented so it's done on my part
05:58:17FromDiscord<Prestige> I was actually going to have a nimscript layout engine for nimdow, but wasm would be better
05:58:32FromDiscord<ripluke> In reply to @Elegantbeef "Have your layout engine": That could be cool
05:58:44FromDiscord<ripluke> River has very sad layout engine
05:58:56FromDiscord<ripluke> You have to write them in c/python
05:59:01FromDiscord<Prestige> Damn now you're making me want to do this
05:59:30FromDiscord<Elegantbeef> I want a language agnostic backend cause I do not like non agnostic backends 😄
05:59:45FromDiscord<Elegantbeef> Fuck trying to use X language forced upon you
05:59:57FromDiscord<Prestige> _claps_
06:00:05FromDiscord<Elegantbeef> Well you can checkout this file if you're interested in the API https://github.com/beef331/aiarena/blob/master/src/core/wasmenvs.nim
06:00:29FromDiscord<ripluke> Nim wasm?
06:00:37FromDiscord<Prestige> Beef do you want to help out with a macro, I'm trying to do some nonsense and think it's likely not the correct approach. For nimtest
06:00:37FromDiscord<Elegantbeef> Yes
06:00:50FromDiscord<Elegantbeef> No Nim wasm runtime but wrapped wasmedge and uses it
06:00:55FromDiscord<Elegantbeef> When do i not help?!
06:01:01FromDiscord<Prestige> Ikr
06:01:25FromDiscord<ripluke> In reply to @Elegantbeef "No Nim wasm runtime": Oh
06:01:33FromDiscord<j-james> In reply to @ripluke "You have to write": i don't think that's true?
06:01:40FromDiscord<j-james> doesn't it just need an executable
06:01:44FromDiscord<Elegantbeef> Wasmedge was the only runtime i found that had C documentation and promised nice API
06:01:46FromDiscord<Prestige> https://github.com/avahe-kellenberger/nimtest/issues/1 this is what I'm trying to do, before I even share my broken attempt
06:02:08FromDiscord<j-james> i thought river's layout generators were super flexible
06:02:11FromDiscord<ripluke> In reply to @j-james "doesn't it just need": Well yea💀 but that language has to have wlroots bindings
06:02:29FromDiscord<ripluke> So u can shell script
06:02:50FromDiscord<ripluke> Nim might work with futhark
06:02:59FromDiscord<Elegantbeef> If C works Nim will work
06:03:20FromDiscord<ripluke> Yea
06:03:27FromDiscord<j-james> In reply to @ripluke "Well yea💀 but that": ahh
06:03:33FromDiscord<j-james> well wlroots has a lot of bindings
06:03:42FromDiscord<j-james> under the swaywm github org mostly
06:03:54FromDiscord<ripluke> Oh
06:05:28FromDiscord<j-james> i also have wip bindings for nim here: https://github.com/j-james/wlroots
06:05:36FromDiscord<ripluke> Oh cool
06:05:57FromDiscord<j-james> they are just a c wrapper right now though, and depend on non-existent wayland bindings
06:06:10FromDiscord<j-james> i haven't implemented any high level stuff yet
06:06:31FromDiscord<ripluke> Oh
06:07:50FromDiscord<Phil> In reply to @Elegantbeef "It's working swell so": Wayland has mostly nitpicky issues left imo. E.g. global hotkeys
06:08:04FromDiscord<Elegantbeef> Oh yea that's one big issue with me
06:08:13FromDiscord<Elegantbeef> I use push to talk, just forgot about that pain
06:08:30FromDiscord<Prestige> Elegantbeef in case you didn't see my link above ^
06:08:37FromDiscord<Elegantbeef> I seen i'm writing
06:08:42FromDiscord<Phil> Aye, I rather toggle mute/unmute, but same fundamental issue.
06:09:03FromDiscord<Phil> Can live with it though in exchange for proper three finger gesture support
06:09:22FromDiscord<j-james> ahh yeah that's a bad one
06:09:31FromDiscord<j-james> rebinding keys independent of compositors sucks too
06:09:45FromDiscord<ripluke> In reply to @Isofruit "Wayland has mostly nitpicky": And the fact that keyboard doesn't sync between native and xwayland apps
06:10:05FromDiscord<Phil> keyboards sync?
06:10:14FromDiscord<ripluke> In reply to @Isofruit "keyboards sync?": Clipboard
06:10:22FromDiscord<ripluke> (edit) "keyboard" => "clipboard"
06:10:31FromDiscord<Phil> Hmmm had less of an issue with that in particular
06:10:37FromDiscord<Phil> Didn't notice so far
06:10:47FromDiscord<Phil> But good to know!
06:10:53FromDiscord<ripluke> Lol I can't copy paste to/from discord which can get annoying
06:11:43FromDiscord<Phil> Ah, that might not be as much of an issue for me since I use the browser version of discord under wayland with an explicit command that makes it look like the desktop app
06:12:09FromDiscord<ripluke> Oh
06:12:12FromDiscord<ripluke> Cool
06:12:56FromDiscord<Phil> `alias discordb='chromium --user-data-dir=/home/philipp/.local/discord --class=Discord --app=https://discord.com/app'` ↵If you want to play around with something similar
06:13:07FromDiscord<Phil> naturally your user data dir needs adjustment
06:14:05FromDiscord<ripluke> Nice
06:15:14FromDiscord<Prestige> I have like a million projects I want to work on, I need to just pick one
06:18:20FromDiscord<ripluke> Does Nim have layer-shell bindings
06:18:29FromDiscord<ripluke> Or do I have to use futhark
06:24:39FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=41uu prestige here is the omega lazy variant
06:25:36FromDiscord<Prestige> You're a beast
06:25:41FromDiscord<Elegantbeef> This assumes you write `beforeAll` actually before the code
06:25:57FromDiscord<Elegantbeef> If you want to declare it anywhere and insert it you will need to iterate after to insert the `beforeAll` call
06:27:07FromDiscord<Elegantbeef> If it's not evident i'm a lazy man 😛
06:27:12FromDiscord<Elegantbeef> Write less code not more
06:29:13FromDiscord<Elegantbeef> I dont know if you intend on nesting `it` or if this will work for you so this is what you get for not sharing code
06:32:41FromDiscord<Prestige> nah no it nesting
06:32:57FromDiscord<Prestige> but there is describe nesting, which should be fine
06:33:31FromDiscord<Elegantbeef> Well you should emit dummy variants of the procedures if you dont have any if you use my macro
06:46:38FromDiscord<zhmtzhmt> Is nim(compile to c++) mature enough to be used in production envirenment? ↵I am developing a mobie game.
06:48:05FromDiscord<zhmtzhmt> I want to mix nim and c++.
06:50:56FromDiscord<zhmtzhmt> sent a code paste, see https://play.nim-lang.org/#ix=41uy
06:51:58FromDiscord<zhmtzhmt> I want to use nim this way, but I want to know whether is nim mature enough.
06:53:10FromDiscord<Phil> I'm out on that one, I have 0 knowledge of the industry... other than I had anticipated it'd need something JVM compatible to code a game for mobile
06:53:53FromDiscord<Phil> It's mature enough to be used for webdev, that's the extent of the statement that I can make.
06:53:53FromDiscord<demotomohiro> What "mature enough" means?
06:54:27FromDiscord<Phil> But that doesn't tell you if the tools you need will be there for mobile dev, which I assume encompasses also game engine bindings or whatnot
06:56:19FromDiscord<zhmtzhmt> Will nim won't compile while coding lines growing.
06:56:34FromDiscord<Elegantbeef> Hey people have made android games with godot, so the only feasible engine has bindings 😛
06:56:58FromDiscord<zhmtzhmt> I have c++ bindings
06:57:16FromDiscord<Elegantbeef> Unless you get a C++ gen error the issue is on you
06:57:25FromDiscord<Phil> My webdev project encompasses around 11k loc. I started at the start of the year on nim version 1.5.X I believe and we jumped to 1.6.6. in the meantime, my project never stopped compiling in these 7 months.
06:57:27FromDiscord<zhmtzhmt> So I want to write game logic in nim.
06:57:29FromDiscord<Elegantbeef> that `Next` procedure is wrong it should be `@.Next` afaik
06:57:49FromDiscord<Phil> (edit) "meantime," => "meantime (which my project followed stat),"
06:57:56FromDiscord<zhmtzhmt> Thanks
06:59:14FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#importcpp-pragma-importcpp-for-procs
06:59:15FromDiscord<Elegantbeef> Actually it's `#.`
06:59:26FromDiscord<Elegantbeef> And phil all you need for Nim programs on android is a JVM entry and you're fine to do whatever you want inside the native library
06:59:43FromDiscord<Phil> In reply to @Elegantbeef "And phil all you": TIL!
06:59:45FromDiscord<Elegantbeef> Jesus 11k loc project i dont think i've written 11k loc in my life 😛
07:00:09FromDiscord<Phil> I'm actually not sure where the bulk of those numbers are coming from
07:00:19FromDiscord<Phil> I just ran a command which threw out ~11k
07:00:37FromDiscord<Phil> I'd need to check which of my files is the largest culprit for those numbers
07:00:43FromDiscord<zhmtzhmt> Is compiling to c++ is as mature as compiling to c?
07:01:00FromDiscord<Elegantbeef> Probably not as it isnt as tested but cant say for certain
07:02:53FromDiscord<zhmtzhmt> I'm worrying I'll fall back to c++. I will waste a lot of time.
07:03:18FromDiscord<Phil> Huh, I just have a fuckton of small files.↵My abstraction of norm is the largest file by far so far with 400 loc
07:04:23FromDiscord<Prestige> Or you could just use Nim
07:04:53FromDiscord<Elegantbeef> What prestige that's crazy!
07:04:56FromDiscord<zhmtzhmt> I have 10000+ c++ loc.
07:05:09FromDiscord<Prestige> I'm sorry
07:05:16FromDiscord<zhmtzhmt> I want to reuse them.
07:05:21FromDiscord<Phil> In reply to @Elegantbeef "Jesus 11k loc project": Ironically enough, this is not even that much larger than the equivalent python backend that this reimplements, which was sitting around 7k loc.↵Which isn't saying as much since python has a lot of code in packages that I had to throw together.
07:05:45FromDiscord<Phil> (edit) "together." => "together in nim myself."
07:06:01FromDiscord<Phil> In reply to @Avahe "I'm sorry": Casual murder in chat
07:07:08FromDiscord<zhmtzhmt> I'll try a, hope it doesn't let me down
07:07:40FromDiscord<zhmtzhmt> I'll try nim, hope it doesn't let me down
07:08:01FromDiscord<zhmtzhmt> I will save a lot of time if it works.
07:21:59FromDiscord<haoliang> may i ask what do you want from mixing nim and cpp? and save time on which aspect?
07:22:26FromDiscord<PyryTheBurger> bruh when i specify a type in another module and import it and try to use the type, why does it say its an error type???????
07:22:49FromDiscord<Elegantbeef> Cause you did something wrong
07:23:08FromDiscord<PyryTheBurger> no i didnt
07:23:15FromDiscord<Elegantbeef> Code?
07:23:33FromDiscord<PyryTheBurger> sent a long message, see http://ix.io/41uH
07:23:41FromDiscord<PyryTheBurger> then i import it in a nother nd it says player is an error type
07:24:02FromDiscord<Rika> How do you use it and import it
07:24:10FromDiscord<Rika> What is the content of the second file
07:24:19FromDiscord<PyryTheBurger> var player: Player = Player(hitbox: (float(1280 / 2 - 50), float(720 / 2 - 50), 100.0, 100.0), ↵ velocity: (0.0, 0.0), speed: 400.0)
07:24:28FromDiscord<PyryTheBurger> and its an error type
07:24:31FromDiscord<Rika> How is it imported
07:24:37FromDiscord<Rika> And have you tried compiling it
07:24:45FromDiscord<PyryTheBurger> import playerScript
07:24:49FromDiscord<PyryTheBurger> yes i have
07:24:56FromDiscord<Elegantbeef> have you provided the error to us
07:24:57FromDiscord<Rika> Where is the error pointing to
07:25:00FromDiscord<zhmtzhmt> @haoliang I don't want rewrite these code.
07:25:19FromDiscord<PyryTheBurger> there is no error it just says its an error type and code compiles but does nothing
07:25:28FromDiscord<Rika> Then it’s correct
07:25:37FromDiscord<Rika> There’s nothing wrong if it compiles correctly
07:25:41FromDiscord<PyryTheBurger> what
07:25:46FromDiscord<PyryTheBurger> why is it an error type then
07:25:59FromDiscord<Rika> The suggestion system is not bug free
07:26:04FromDiscord<Phil> .... can I still advocate for using \`\`\` <some code> \`\`\` to copy paste code into for better formatting?
07:29:09FromDiscord<zhmtzhmt> May he is not farmiliar with markdown.
07:29:25FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=41uM
07:30:14FromDiscord<PyryTheBurger> yeah i just had to resrtart vs code
07:30:29FromDiscord<Phil> Hah! The classic! Had that issue a couple times myself as well
07:30:43FromDiscord<Phil> Not this specific one, but that vscode screws up and needs a reboot sometimes
07:30:50FromDiscord<d4rckh> The nim vs code extension is very painful
07:30:56FromDiscord<d4rckh> :(
07:31:26FromDiscord<d4rckh> I think it tries to compile the file I'm currently working in and not the main file
07:31:28FromDiscord<Phil> It's alright, it colors the code that is borked for me, that is enough. The suggestions come too slow to be useful most of the time, I've learned to deal with that
07:31:41FromDiscord<d4rckh> So i am getting 2 different errros in one file depending on the file i edit
07:31:54FromDiscord<d4rckh> (edit) "errros" => "errors"
07:31:57FromDiscord<Elegantbeef> Yes that's how it works if you dont set it up properly↵(@d4rckh)
07:32:07FromDiscord<d4rckh> I need to set it up properly then
07:33:51FromDiscord<Elegantbeef> https://github.com/saem/vscode-nim#example
07:34:10FromDiscord<Elegantbeef> copy the `nim.project` field for you workplace setting and it'll work better
07:35:55FromDiscord<d4rckh> Nice
07:36:00FromDiscord<d4rckh> Will set it up in few hours
07:37:17FromDiscord<aph> can i run a for loop in parallel? thanks
07:39:31FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual_experimental.html#parallel-amp-spawn-parallel-statement there is
07:39:41FromDiscord<aph> thanks :)
07:39:57FromDiscord<Elegantbeef> Though i think https://github.com/status-im/nim-taskpools are more developed
07:40:16FromDiscord<Elegantbeef> There is also weave
07:41:15FromDiscord<aph> In reply to @Elegantbeef "Though i think https://github.com/status-im/nim-tas": oh nice, that seems easier to use, thanks again
08:02:44FromDiscord<untoreh> If I have an async function that calls a non async function that calls an async function with `waitFor`, does it block upstream?↵`async() -> sync() -> waitFor async()`
08:03:23FromDiscord<Elegantbeef> `waitFor` is block until it's done so it should yes
08:08:16FromDiscord<Rika> You must stay in async to not block
08:30:00FromDiscord<untoreh> switching a function to async, I get a bunch of `undeclared identifier` . does async wrapping have issues with dirty templates?
08:34:46FromDiscord<Rika> Kinda because async transforms the function body
09:00:14FromDiscord<untoreh> it disappeared, must have been some stale caches
09:46:03madpropswondering if im doing something wrong here https://github.com/madprops/goldie/blob/main/src/goldie.nim
09:47:08madpropsin nim standards. but it's fast enough for me
09:47:16madpropsit does things like ignore binary files and others
09:47:28FromDiscord<Xzayler> Quick question. What's the function which, called on a string, capitalises the first letter? I know toUpper and toLower exist
09:48:24FromDiscord<demotomohiro> `if foo.len > 0: foo[0] = foo[0].toUpper`
09:49:24FromDiscord<demotomohiro> `toUpperAscii
09:49:30FromDiscord<demotomohiro> https://nim-lang.org/docs/strutils.html
09:49:43FromDiscord<Xzayler> Ah.. I thought it existed already.
09:50:06FromDiscord<Xzayler> toUpper() works as well but couldn't find where it's defined. I saw strutils already
09:50:09FromDiscord<Xzayler> Thanks
10:07:39FromDiscord<phargob> https://nim-lang.org/docs/strutils.html#capitalizeAscii%2Cstring
10:19:18*gsalazar quit (Ping timeout: 240 seconds)
10:19:31FromDiscord<Phil> Argh, somebody shoot me. Apparently it is heavily frowned upon to use alpine glibc docker images for anything since you're very much running the risk of them blowing up in your face at random times
10:20:27FromDiscord<Phil> So now I'm rewriting my docker stuff for a minimalist debian image. But they don't have the most recent glibc version unlike the alpine glibc image I used before.↵Soooo.... how do I link against older glibc versions?
10:21:12FromDiscord<Phil> Found `uClibc` so far, but that doesn't look like the right compiler flag
10:22:30FromDiscord<Phil> Dynlib Override I don't think is correct either, glibc is not statically linked against by default, right?
10:26:43FromDiscord<Spectre> is there a good standard library for classes and mixins in python...
10:27:25FromDiscord<Spectre> ive looked around a found a couple of personal projects that do this... but it would be much nicer if there was an 'official' version
10:27:48FromDiscord<Spectre> sorry new to nim... migrating from python
10:28:33FromDiscord<demotomohiro> As far as I know Nim have no stdlib for python
10:28:44FromDiscord<Phil> In reply to @Spectre "is there a good": You'd need to specify this a bit. Are you asking how to do mixins in nim the same way you did in python?
10:31:13FromDiscord<Spectre> In reply to @Isofruit "You'd need to specify": yes. its nice to add some group of methods with a single keyword associated to the class
10:32:40FromDiscord<Spectre> sorry maybe mixin has a different meaning in nim..
10:33:14FromDiscord<Rika> It does
10:33:35FromDiscord<Rika> Nim also doesn’t really have a concept of classes and bound functions like Python does
10:33:37FromDiscord<Phil> In reply to @Spectre "yes. its nice to": There is no equivalent to the mixin pattern. In fact, you might find there is no need for it.↵You'd be likely very interested in looking at how functions (here called: procedures) can be called through the method call syntax
10:33:44FromDiscord<Phil> https://nim-lang.org/docs/tut2.html#object-oriented-programming-method-call-syntax
10:34:12FromDiscord<demotomohiro> How about to use generics or type class to add procs that works for multiple object types?
10:34:15FromDiscord<Phil> This essentially nets you somewhat the ability of mixins
10:34:30FromDiscord<Phil> (edit) "mixins" => "python-mixins"
10:34:38FromDiscord<fwsgonzo> Hello all. I am having success storing simple function pointers in Nim that async C functions will call for me, in order to get back into Nim after a hardware event happens. Is there a way to store a more complex Nim function, like a std::function that is compatible with C? I suppose there is like an environment argument for Nim that I could store along with the function. How do I express this in C code?
10:34:57FromDiscord<enthus1ast> You could try to use musl↵(@Phil)
10:35:17FromDiscord<Phil> In reply to @enthus1ast "You could try to": Then the next question inevitably becomes how I compile against musl since I have no clue
10:36:00FromDiscord<Phil> A quick CTRL+F over the compiler guide netted me no hits for "musl", that's why I avoided that initially
10:36:29FromDiscord<Spectre> In reply to @Isofruit "There is no equivalent": thank you. is there a way to import a group of functions declared in another file at once?
10:36:58FromDiscord<fwsgonzo> you dont strictly need to compile much against musl
10:37:09FromDiscord<fwsgonzo> just install `musl` or `musl-gcc`
10:37:13FromDiscord<Phil> In reply to @Spectre "thank you. is there": Basically by importing the module, you will automatically import all functions in there that are marked as "public".↵A proc is marked as public if its marked with a ``
10:37:21FromDiscord<fwsgonzo> i dont remember the package name, then just pass every C file that Nim generates to musl-gcc
10:37:26FromDiscord<fwsgonzo> (edit) "i dont remember the package name, then just pass every C file that Nim generates to musl-gcc ... " added "along with -statoc"
10:37:29FromDiscord<fwsgonzo> (edit) "-statoc" => "-static"
10:37:43FromDiscord<Spectre> In reply to @Isofruit "Basically by importing the": thank you. really appreciate it.
10:38:34FromDiscord<Phil> In reply to @Spectre "thank you. really appreciate": No worries, you might appreciate taking a look at general nim docs to get a better overview over language features:↵https://nim-lang.org/docs/tut1.html↵And since you stated your starting language was python:↵https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers
10:38:47FromDiscord<fwsgonzo> sent a code paste, see https://play.nim-lang.org/#ix=41vj
10:38:55FromDiscord<fwsgonzo> just replace `gcc` with `musl-gcc` and youre goldern
10:38:56FromDiscord<fwsgonzo> (edit) "goldern" => "golden"
10:39:14FromDiscord<Phil> In reply to @Spectre "thank you. really appreciate": I would generally recommend bookmarking https://nim-lang.org/documentation.html or various of the links on there since it generally contains a lot of the most useful nim documentation out there
10:39:30FromDiscord<fwsgonzo> (this assumes you have an env folder with a few .c files for some kind of API, you can remove that if you dont need it)
10:40:58FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=41vk
10:41:20FromDiscord<fwsgonzo> in this case it just creates a static library, which you can feed to a C compiler, and produce a static executable with -static
10:41:45FromDiscord<fwsgonzo> the whole-archive option makes sure that the C compiler treats the archive as if you were adding each .o object file manually
10:42:37FromDiscord<demotomohiro> @fwsgonzo If you want to call Nim closure from C: https://nim-lang.org/docs/system.html#rawEnv%2CT↵https://nim-lang.org/docs/system.html#rawProc%2CT
10:42:53FromDiscord<fwsgonzo> if you dont know how archives work, you can actually open them in most Linux distros and looking inside you will find .o files, which are compiled objects
10:43:02*lumidify quit (Quit: leaving)
10:43:08FromDiscord<Phil> And if I want to compile against musl the pipeline basically goes:↵nim source --> static library through nim c --> compile against musl/musl-gcc to get an alpine-useable binary ?
10:43:16FromDiscord<fwsgonzo> yep
10:43:18FromDiscord<fwsgonzo> there you have it
10:43:21*lumidify joined #nim
10:43:43FromDiscord<Spectre> In reply to @Isofruit "I would generally recommend": i did look at these for a couple of days ago... its bit difficult moving to new language when one is so comfortable with another (esp when mixins mean different things)... thanks ill take another look
10:44:10FromDiscord<Phil> In reply to @Spectre "i did look at": Try to do a couple things and consult them as you realize you need X, it's how I went about it
10:44:22FromDiscord<fwsgonzo> its not that musl produces binaries that only alpine can run - musl static executables can run on any Linux ever
10:45:06FromDiscord<fwsgonzo> Linux has a stable ABI similar to Windows, just that most toolchains use dynamic linking which is great for high-availability high-security server applications
10:45:18FromDiscord<fwsgonzo> but if you just want to send your friend a program, static is where its at
10:48:02FromDiscord<Phil> So basically, the main difference is, that binary is then fully self contained
10:49:04FromDiscord<fwsgonzo> yes, unless it uses dynamic linking at runtime to open libraries and things like that
10:49:05FromDiscord<Phil> It would make assumptions on what your filesystem looks like most likely since that is statically compiled into the binary and potentially other things that would be platform dependant, but since the target is alpine docker that doesn't matter too much
10:49:51FromDiscord<Phil> That's how I'm understanding it so far anyway
10:50:07*lumo_e joined #nim
10:50:12FromDiscord<fwsgonzo> it doesnt have to make any assumptions, most things things look the same way in all distros, and they are converging to a set of standards anyway
10:51:00FromDiscord<fwsgonzo> and environment variables help you a lot with many of the basic things like where the home folder is, and the PATH variable gives you access to other programs if you want to make use of common shell programs
10:52:10FromDiscord<Phil> In reply to @fwsgonzo "(this assumes you have": I think this bit I don't quite get yet.↵I don't have an env folder, I have mostly just a crapton of nim code that turns into a webserver with ~150 or so routes.↵What is the env folder's task in this context that is now specifically needed?
10:52:39FromDiscord<fwsgonzo> for my purpose its just the binding that I have made between C and Nim for my own APIs
10:53:14FromDiscord<fwsgonzo> sent a code paste, see https://play.nim-lang.org/#ix=41vp
10:53:18FromDiscord<Phil> I...errr.... don't think I have any?↵I have explicit C interop only really at one time in my code, that is with openssl
10:53:35FromDiscord<fwsgonzo> you will still need a main.c though, so if you look at the `gcc`line it gets passed env/main.c
10:54:08FromDiscord<fwsgonzo> sent a code paste, see https://play.nim-lang.org/#ix=41vq
10:54:34FromDiscord<fwsgonzo> or maybe you can remove --noMain and just skip that step entirely
10:54:53FromDiscord<fwsgonzo> I just always find myself needing to do stuff inside main 🤷‍♂️
10:57:58FromDiscord<rakgew> sent a code paste, see https://play.nim-lang.org/#ix=41vr
10:59:31FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=41vs
11:00:22FromDiscord<fwsgonzo> does --define:ssl link with OpenSSL?
11:00:23FromDiscord<Rika> In reply to @rakgew "hi, is there a": Is the field exported
11:00:44FromDiscord<fwsgonzo> statically linking openssl is a gargantuan task even for me, unless thats the default in alpine (which i doubt)
11:01:33FromDiscord<Rika> https://nim-lang.org/docs/times.html#Time ↵Seconds is not exported
11:01:37FromDiscord<rakgew> @Rika thx for the hint. it is indeed not exported..
11:01:54FromDiscord<Rika> There is to Unix procedure
11:02:41FromDiscord<rakgew> aha nice!! thank you @Rika !
11:03:08FromDiscord<Rika> Sorry, I think it’s called to epoch or something
11:03:10FromDiscord<rakgew> works like a chrm.. \:-D
11:03:26madpropsi just call them unix seconds'
11:03:42FromDiscord<Rika> No it’s called to Unix indeed lol
11:03:44FromDiscord<Rika> https://nim-lang.org/docs/times.html#toUnix%2CTime
11:03:56FromDiscord<Phil> In reply to @fwsgonzo "does --define:ssl link with": > Another common use is the -d:ssl switch to activate SSL sockets.↵Not sure what SSL sockets are, but maybe?
11:04:23madpropssomething i often miss is how easy it is in js to get ms: Date.now()
11:07:43FromDiscord<fwsgonzo> sent a code paste, see https://play.nim-lang.org/#ix=41vv
11:07:54FromDiscord<fwsgonzo> both input and output is the same struct
11:08:09FromDiscord<fwsgonzo> (edit) "both input and output is the same ... struct" added "pointer to this"
11:11:30*mahlon quit (Ping timeout: 268 seconds)
11:15:25FromDiscord<Phil> kinda disappointing that musl is a normal arch package, but musl-gcc is not part of it
11:16:45FromDiscord<Phil> Looking at the hoops you have to jump through just to get musl-gcc going is already sucking the fun out of everything
11:17:18FromDiscord<fwsgonzo> if you are already on alpine, perhaps you have musl as the primary libc already? the only thing to do then is to check if it supports static compilation
11:17:36FromDiscord<fwsgonzo> in that case replace musl-gcc with just gcc and see what happens
11:17:50FromDiscord<Phil> I mean, I'm on arch, my container is alpine
11:17:53FromDiscord<fwsgonzo> the secret to checking if a program is fully static is to `ldd myprogram`
11:18:07FromDiscord<fwsgonzo> ah ok
11:18:17FromDiscord<fwsgonzo> in that case just build it inside your container using folder sharing
11:20:01FromDiscord<fwsgonzo> pass `-volume $PWD:/usr/outside` to docker run - then you can compile your program with `-o /usr/outside/myprogram`
11:20:27FromDiscord<fwsgonzo> and yes, it really is yak shaving all the way down
11:22:01FromDiscord<Phil> In reply to @fwsgonzo "pass `-volume $PWD:/usr/outside` to": Hah! Mountable volumes I even know of and make use of to mount e.g. my sqlite database and media directories to serve through my reverse proxy
11:22:16FromDiscord<Phil> Since I'd never want those to be inside the image
11:22:50FromDiscord<Phil> Turns out if you just go inside an alpine container via `sudo docker container run -it alpine` there is no gcc in there. Neither is there a musl-gcc
11:23:24FromDiscord<Phil> There's not even a musl-gcc package you could download via `apk add musl-gcc`
11:24:06FromDiscord<fwsgonzo> are you sure you need an alpine container for this?
11:24:17FromDiscord<fwsgonzo> i would probably just use an Ubuntu 20.04 image and install musl-gcc
11:25:00FromDiscord<fwsgonzo> once you have the static executable, it really does work everywhere (minus probably OpenSSL stuff that gets dynamically linked at runtime, what do i know)
11:25:40FromDiscord<fwsgonzo> if you're not using networking you can also use gcc itself, no musl necessary - its only the networking stuff in glibc that is completely ass
11:25:50FromDiscord<Rika> Doesn’t Nim have many articles on how to compile statically with musk
11:25:53FromDiscord<Rika> MUSL I mean
11:26:41FromDiscord<fwsgonzo> (edit) "gcc itself," => "glibc,"
11:27:20*lumo_e quit (Ping timeout: 248 seconds)
11:27:31FromDiscord<Phil> sent a long message, see http://ix.io/41vB
11:27:47FromDiscord<Phil> (edit) "http://ix.io/41vB" => "http://ix.io/41vC"
11:28:18FromDiscord<fwsgonzo> I don't see the problem with just using GCC on your arch with -static, unless you are using networking functions (specifically DNS, gethostname etc.)
11:28:23FromDiscord<fwsgonzo> (edit) "gethostname" => "gethostbyname"
11:29:36FromDiscord<Phil> by -static you mean I can just add a `--static` flag to the nim c command?
11:30:00FromDiscord<fwsgonzo> i dont know if thats a thing, but if you look at the way i invoke gcc, i add -static to the compiler arguments
11:30:33FromDiscord<fwsgonzo> i build sandboxed static programs as my $dayjob so i have some insight 🙂
11:31:39FromDiscord<fwsgonzo> are there any Nim guides on how to call a C function that takes a struct pointer as argument?
11:31:54FromDiscord<fwsgonzo> workarounds etc.
11:32:13FromDiscord<Phil> > -t, --passC:OPTION↵> pass an option to the C compiler↵Maybe I can do it with --passC:static
11:32:27FromDiscord<Phil> Then I don't have to do something that feels like a semi-cursed middle step
11:32:44FromDiscord<fwsgonzo> check with `ldd myprogram` after
11:32:54FromDiscord<fwsgonzo> it if it says "not a dynamic ELF" then you did the thing
11:33:25FromDiscord<Phil> > gcc: warning: static: linker input file unused because linking not done↵Time to google
11:33:46FromDiscord<fwsgonzo> can you post the exact commandline that got invoked
11:33:52FromDiscord<fwsgonzo> (edit) "that" => ", how GCC"
11:34:01FromDiscord<fwsgonzo> this is why I like to run GCC myself
11:34:18FromDiscord<fwsgonzo> oh right, you need to add a dash (-), its -static
11:34:23FromDiscord<Phil> sent a long message, see http://ix.io/41vE
11:34:30FromDiscord<fwsgonzo> (edit) "-static" => "-static"
11:34:39FromDiscord<fwsgonzo> its -static
11:34:41FromDiscord<fwsgonzo> not static
11:35:34FromDiscord<Phil> sent a long message, see http://ix.io/41vF
11:36:03FromDiscord<fwsgonzo> verbose doesnt show you how GCC gets invoked?
11:36:44FromDiscord<Phil> nope
11:37:00FromDiscord<fwsgonzo> may I suggest the staticLib option where you are in full control of calling GCC
11:37:25FromDiscord<fwsgonzo> if only to see if it can link the final executable
11:37:26FromDiscord<Phil> gcc staticlib I assume?
11:37:38FromDiscord<Phil> or do you mean :↵> --app:console|gui|lib|staticlib↵> generate a console app|GUI app|DLL|static library
11:37:58FromDiscord<fwsgonzo> nim c --app:staticLib myproject.nim
11:38:31FromDiscord<fwsgonzo> gcc -static -O2 -Wl,--whole-archive lib$myproject.a -Wl,--no-whole-archive -o myproject
11:39:12FromDiscord<fwsgonzo> just tab-complete the .a file
11:39:15FromDiscord<Phil> Alright, so I'll add that flag to my previous nimble task and call gcc afterwards and see how it goes
11:39:38FromDiscord<Phil> with the staticLib flag it should create the .a file if I got that right?
11:39:42FromDiscord<fwsgonzo> indeed
11:41:48FromDiscord<Phil> sent a long message, see http://ix.io/41vH
11:43:08FromDiscord<fwsgonzo> to enable lto add -flto
11:43:12FromDiscord<fwsgonzo> (edit) "-flto" => "`-flto`"
11:43:36FromDiscord<Phil> Well, I think it did without me having added that flag, that's why I was confused
11:43:52FromDiscord<Phil> The flag for lto was in the nim c command, yes, I just didn't expect to carry over to the gcc command then
11:44:06FromDiscord<fwsgonzo> LTO is a different mode of operation in a compiler, even if every compiler argument is a direct object file with no archive resolution
11:44:33FromDiscord<fwsgonzo> it also needs to be passed to the linker (which it does behind the scenes, along with LTO plugins)
11:44:42FromDiscord<fwsgonzo> but for that we add -flto to the GCC commandline
11:48:42FromDiscord<Phil> sent a long message, see http://ix.io/41vI
11:49:24FromDiscord<fwsgonzo> right, if you have something in your code that uses the DNS library, such as getaddrinfo, then it might not work
11:49:54FromDiscord<fwsgonzo> LTO might have obscured where the call came from
11:49:59FromDiscord<Phil> hmm, well my code doesn't, can't guarantee that for my libs
11:50:10FromDiscord<fwsgonzo> > getAddrInfopureZnativesockets_208
11:53:52FromDiscord<Phil> I'll recompile without lto and see how that changes
11:55:48FromDiscord<Phil> Man, the main reason I'm even doing this is that prologue (my webframework) doesn't have a guide on how to deploy a prologue binary and I wanted to write one up for deploying the binary + nginx in a docker container. Then I noticed my current way isn't possibly suitable to make an official guide out of since the base image is bad and gnaaa
11:56:43FromDiscord<Phil> sent a long message, see https://paste.rs/RVn
11:58:47FromDiscord<Phil> Given that it appears I'm not getting around this issue, I can either start looking into guides on how to compile with musl, or I start moving the compilation process into one of the minideb containers so it can compile against the glibc in that damn container
11:59:16FromDiscord<Phil> Let's see if the guides look as painful as I'm imagining them to be
12:01:52*sagax quit (Remote host closed the connection)
12:02:05FromDiscord<locria> Hello, everyone
12:02:42FromDiscord<Phil> In reply to @locria "Hello, everyone": cheers
12:03:36FromDiscord<mratsim> In reply to @fwsgonzo "Hello all. I am": std/tasks
12:06:31FromDiscord<fwsgonzo> i only want a way to pass a C struct to a C function
12:06:52FromDiscord<fwsgonzo> sent a code paste, see https://play.nim-lang.org/#ix=41vN
12:07:05FromDiscord<fwsgonzo> its also the output
12:07:09FromDiscord<mratsim> std/task is a port of std::function to Nim
12:07:20FromDiscord<fwsgonzo> ah ok, will look into it, thanks
12:07:36FromDiscord<fwsgonzo> there is scarce information about how to call a C function with a struct pointer, though
12:07:59FromDiscord<mratsim> otherwise just wrap the struct in Nim or use {.importc.} without defining the fields if it's only manipulated through pointers
12:08:49FromDiscord<fwsgonzo> I guess that's a way to do it, but smells like malloc
12:09:41FromDiscord<mratsim> your struct is over 256 bytes, passing it through the stack is meh anyway
12:10:21FromDiscord<mratsim> also not sure if it helps but here you go for C callbacks:↵↵- https://github.com/mratsim/trace-of-radiance/blob/master/trace_of_radiance/io/mp4.nim#L52-L57=↵- https://github.com/mratsim/trace-of-radiance/blob/master/trace_of_radiance/io/mp4.nim#L115-L126=
12:13:46FromDiscord<fwsgonzo> thanks, lots of good syntax to look at there
12:23:14*lumo_e joined #nim
12:24:27*lumo_e quit (Client Quit)
12:27:53FromDiscord<Phil> How is installing musl on arch so opposite of straightforward.↵Apparently installing musl through pacman installs it.... somewhere nebulous. Literally can't find "musl", even with `find` in the root dir↵Downloading the tar.gz to make and make install suddenly requires you to modify a mysterious config.mak that similarly exists nowhere.↵Now on to figuring out some other method of installing the damn thing
12:35:54FromDiscord<fwsgonzo> @mratsim how do I convert a (cstring, length) to string?
12:36:12FromDiscord<fwsgonzo> I see that there is a $cstring, but it's not a zero-terminated buffer
12:37:26FromDiscord<fwsgonzo> (edit) removed "@mratsim"
12:37:31FromDiscord<Rika> In reply to @fwsgonzo "I see that there": It should be zero terminated
12:37:46FromDiscord<fwsgonzo> sent a code paste, see https://play.nim-lang.org/#ix=41vQ
12:42:53FromDiscord<Rika> Looks right to me
12:43:45FromDiscord<fwsgonzo> sent a code paste, see https://play.nim-lang.org/#ix=41vR
12:43:47FromDiscord<fwsgonzo> such that I can call Curl.fetch(url)
12:45:13FromDiscord<Rika> Technically
12:45:54FromDiscord<Rika> `proc fetch(T: typedesc[Curl], url: string): rettype = ...`
12:46:09FromDiscord<Rika> I think is correft
12:46:12FromDiscord<Rika> (edit) "correft" => "correcr"
12:46:18FromDiscord<Rika> (edit) "correcr" => "correct"
12:47:10*sagax joined #nim
12:48:52FromDiscord<demotomohiro> In C language, static function means a function that is only used in a C file that declares that function.
12:49:35FromDiscord<Rika> They mean “static” in terms of object oriented
12:49:44FromDiscord<Rika> Which means “class function” essentially
12:50:07FromDiscord<Rika> kinda, but not really
12:50:14FromDiscord<demotomohiro> ok
12:50:20FromDiscord<Rika> I believe they’re different but I don’t remember why, I’ve abandoned OOP memories
12:52:39FromDiscord<Phil> For my understanding, when compiling a static binary, is lto even a thing then?
12:53:07FromDiscord<demotomohiro> Nim actually doesn't have a static function. Rika's `proc fetch(T: typedesc[Curl], url: string): rettype =` is closest to static class method.
12:53:34FromDiscord<Rika> In reply to @Isofruit "For my understanding, when": What do you mean?
12:54:00FromDiscord<demotomohiro> Do you mean static library or static executable fine?
12:54:06FromDiscord<demotomohiro> Or static object files?
12:54:16FromDiscord<Rika> Statically linked binary
12:55:40FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=41vU
12:55:58FromDiscord<Phil> nevermind, still bombs even if I remove the lto
12:56:19FromDiscord<Phil> Time to google once again, fml
12:56:49FromDiscord<Rika> Do you need to pass static to the linker I forgot
12:57:10FromDiscord<Phil> I found 1 guide on static linking so far and it uses it, I'm trying to replicate what they're doing
12:57:40FromDiscord<Phil> https://scripter.co/nim-deploying-static-binaries/↵They run:↵`nim --gcc.exe:musl-gcc --gcc.linkerexe:musl-gcc --passL:-static c hello.nim`
12:58:27FromDiscord<Phil> Which must've been at a mystical time where "-static" didn't blow up the compiler, because it does nowadays
12:58:44FromDiscord<Phil> (Explicitly the "-" in there)
12:58:59FromDiscord<Rika> The dash is required isn’t it
12:59:10FromDiscord<Phil> no idea
12:59:11FromDiscord<demotomohiro> `-static` option uses static library and you need to have a static libraries.
12:59:37FromDiscord<demotomohiro> You already have static libraries?
12:59:39FromDiscord<Phil> So put "-static" in quotation marks behind the passL?
12:59:57FromDiscord<Phil> In reply to @demotomohiro "You already have static": I have musl installed and with that musl-gcc.↵I hope that's all because I have no idea what else I could possibly need
13:00:59FromDiscord<demotomohiro> static libraries in Linux have lib.a extension.
13:01:57FromDiscord<demotomohiro> I wrote an article about C static library before: https://internet-of-tomohiro.netlify.app/nim/clibrary.en.html↵It might helps you.
13:02:22FromDiscord<Phil> You mean the thing that fwsgonzo showed me earlier, where you compile your entire project as a static library using:↵> --app:staticLib↵> --noMain↵?
13:02:38FromDiscord<Phil> And then have to separately run that through the gcc compiler?
13:04:23FromDiscord<demotomohiro> No. my article also explains how to use static library from Nim.
13:07:06FromDiscord<demotomohiro> In reply to @Isofruit "It took a bit": I think you need to do `--passL:-static` instead of `--passL:static` so that gcc recognize `static` as link option.
13:07:36FromDiscord<demotomohiro> I think that is what @Rika told you.
13:09:07FromDiscord<Phil> That doesn't work though, as the `-` will throw an error if used inside a nimble command.↵I'm currently trying with `--passL:"-static"` ↵Atm I'm failing with ↵> could not load: libcrypto.so(.1.1|.1.0.2|.1.0.1|.1.0.0|.0.9.9|.0.9.8|.48|.47|.46|.45|.44|.43|.41|.39|.38|.10|)
13:09:24FromDiscord<Phil> That is when starting the binary, it does compile with the above flag
13:10:04FromDiscord<Phil> sent a long message, see http://ix.io/41vZ
13:10:49FromDiscord<Rika> I usually refer to this when static linking with MUSL
13:10:50FromDiscord<Rika> https://github.com/kaushalmodi/hello_musl
13:11:18FromDiscord<demotomohiro> Do you need to link `libcrypto` statically?
13:11:55FromDiscord<Phil> sent a long message, see http://ix.io/41w0
13:15:13FromDiscord<Phil> If I'm reading the github page right, I just need to add the `--define:openssl` flag (or libressl or pcre) ?
13:15:59FromDiscord<Phil> What confuses me slightly is that the bits of my code that need an SMTP client to send emails (I used that to implement password recovery functionality) make `--define:ssl` absolutely mandatory, so I'm currently compiling with both of these flags
13:17:06*sagax quit (Remote host closed the connection)
13:17:27FromDiscord<Phil> Nope, doesn't work, same issue as before, so there's something I missed in the guide hopefully
13:17:35FromDiscord<demotomohiro> https://internet-of-tomohiro.netlify.app/nim/clibrary.en.html
13:18:42FromDiscord<demotomohiro> In general, C Static libraries and shared libraries are different kind of files and they are built different ways.
13:18:43FromDiscord<Phil> I'll keep that article in reserve should I have no simpler options. Because I guarantee you that reading this article will take me hours
13:19:21FromDiscord<Phil> Simply because I don't even have a proper understanding of what header files even are, as an example for how much of the very fundamental C knowledge I do not have, so this article has very high chances of becoming a massive amount of googling for me
13:20:22FromDiscord<demotomohiro> If you want static library, you need to get static library (`lib.a` file) somehow or build it from source.
13:21:47FromDiscord<demotomohiro> This article explains about basic of C and gcc things for Nimmer: https://internet-of-tomohiro.netlify.app/nim/gccguide.en.html
13:21:55FromDiscord<Phil> sent a long message, see http://ix.io/41w2
13:22:08FromDiscord<Phil> (edit) "http://ix.io/41w2" => "https://paste.rs/9kC"
13:22:40FromDiscord<Rika> No stop that’s not what he means
13:22:50FromDiscord<Rika> He means to statically compile OpenSSL
13:23:53FromDiscord<demotomohiro> Building your program as static lib doesn't link shared OpenSSL library as static library.
13:25:34*noeontheend joined #nim
13:26:48FromDiscord<Phil> ... can I just dynamically compile against musl and not want to shoot myself in the leg?
13:27:05FromDiscord<demotomohiro> In most cases, if you want C libraries as static library, you need to read `readme` or some text that explains how to build the library and build it as static library.
13:27:08FromDiscord<Rika> What does that even mean
13:27:30FromDiscord<Rika> You mean not static compile on MUSL
13:27:31FromDiscord<Rika> Okay
13:28:45FromDiscord<Rika> Just remove the static parameter for the linker?
13:29:46FromDiscord<Phil> Wait, no, that doesn't work because ... god damn why can't there just be a simple solution out there. Why is there no simple option (at least when I google for stuff on SO) to tell glibc "Hey, please compile with version X so that a debian container that literally doesn't have access to the arch glibc versions can run this thing"
13:29:48*noeontheend quit (Ping timeout: 246 seconds)
13:30:03FromDiscord<demotomohiro> Most of linux package manager provides shared libraries (`lib.so`) but doesn't provides static link libraries (`lib.a`).↵Just use shared libraries might be easier than build static library from source.
13:30:06FromDiscord<Phil> In reply to @Rika "Just remove the static": I'll try, one sec
13:30:29FromDiscord<Rika> In reply to @demotomohiro "Most of linux package": It’s because static libraries are tool chain specific
13:31:24FromDiscord<Rika> In reply to @Isofruit "Wait, no, that doesn't": Because you need that versions headers I think I don’t know about lib c too well
13:32:29FromDiscord<Phil> sent a long message, see http://ix.io/41w7
13:32:32*sagax joined #nim
13:32:32*sagax quit (Changing host)
13:32:32*sagax joined #nim
13:33:03FromDiscord<Phil> (edit) "http://ix.io/41w7" => "http://ix.io/41w8"
13:33:06FromDiscord<Rika> Then compile in a container of that operating system
13:34:49FromDiscord<Phil> now to figure out how to have multiple docker files in a project
13:36:19FromDiscord<demotomohiro> Or setup same OS in same version used in docker in your PC.
13:37:06FromDiscord<Phil> From what I've skimmed over around the web, it's arguably a better practice anyway to have a container for compiling and another for running our stuff
13:37:16FromDiscord<Phil> (edit) "From what I've skimmed over around the web, it's arguably a better practice anyway to have a container for compiling and another for running our stuff ... " added "and have both be of a similar environment"
13:40:51FromDiscord<Phil> Oh screw me that will also be painful since I now have to set up the entire compilation process in that container
13:46:57FromDiscord<Rika> Good luck
13:49:43*krux02 joined #nim
13:49:47*krux02 quit (Remote host closed the connection)
13:50:47FromDiscord<Phil> Fun fact, neither bitnami/minideb, nor debian have gcc or curl provided in their initial image
13:50:58FromDiscord<Phil> neither does ubuntu
13:54:35FromDiscord<Rika> Makes sense to me
13:55:00FromDiscord<demotomohiro> Gentoo linux provides gcc in default :p
14:00:19FromDiscord<Phil> ... I'm taking another look at the repo. ↵I saw earlier that it requires copy pasting the config.nim and rewriting the command to use the new "musl" task it introduces. ↵Let's see if that does something
14:14:02FromDiscord<Phil> ... I take it downloading and statically compiling openssl is normal to take forever since this has been running for 15 minutes now?
14:14:55*arkurious joined #nim
14:16:27FromDiscord<mratsim> In reply to @Isofruit "... I take it": It's a big library, and the build system uses perl to generate the assembly code
14:21:05FromDiscord<demotomohiro> Building large C project can takes more than a hour.
14:21:20FromDiscord<Phil> So this is what it feels like to run gentoo
14:22:09FromDiscord<demotomohiro> I upgrade packages in gentoo before go to bed.
14:22:50FromDiscord<Phil> Understandable
14:23:13FromDiscord<Phil> Well, I think the downloading is over now since my CPU cores are finally starting to heat up
14:38:30FromDiscord<Phil> No kidding with large project possibly taking more than an hour
14:42:49FromDiscord<PyryTheBurger> how do i iterate over a json array with .pairs
14:43:15FromDiscord<Phil> as in, you have a JsonNode object?
14:43:19FromDiscord<PyryTheBurger> yes
14:45:14FromDiscord<Phil> you might want to take a look at a different iterator:↵https://nim-lang.org/docs/json.html#items.i%2CJsonNode
14:47:06FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=41wp
14:48:01FromDiscord<demotomohiro> https://nim-lang.org/docs/manual.html#iterators-and-the-for-statement-implicit-itemsslashpairs-invocations
14:49:06FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=41wq
14:56:40FromDiscord<Yardanico> In reply to @Isofruit "Wait, no, that doesn't": There is
14:56:59FromDiscord<Yardanico> zig cc can easily cross compile binaries to older glibc versions s
14:57:05FromDiscord<Yardanico> (edit) removed "s"
14:57:35FromDiscord<Yardanico> https://github.com/Yardanico/ircord/blob/master/zig-compile-vps.sh
14:58:03FromDiscord<Phil> So it'd be nim using the zig compiler to tell gcc to use an older glibc version?
14:58:08FromDiscord<Yardanico> No
14:58:19FromDiscord<Yardanico> zig cc bundles clang in itself
14:58:32FromDiscord<Yardanico> and has a lot of headers and source for cross compilation
14:58:44FromDiscord<Phil> So it'd be the nim compiler telling the zig compiler to use its included clang compiler with a specific glibc version
14:58:45FromDiscord<Yardanico> you don't need GCC with zig cc
14:58:51FromDiscord<Yardanico> In reply to @Isofruit "So it'd be the": now
14:58:53FromDiscord<Yardanico> no
14:59:11FromDiscord<Yardanico> you'll be telling zig cc to use specific glibc headers and link against that version dynamically
14:59:57FromDiscord<Yardanico> but that doesn't really matter anyway
15:00:04FromDiscord<Yardanico> In the end you get a binary what does that you want
15:00:16FromDiscord<Yardanico> (edit) "In the end you get a binary ... what" added "that does" | removed "does that"
15:00:23FromDiscord<Phil> I'll... play around with that after openssl finishes compiling. I'm an hour deep into this compilation journey and I'd at least want to give it a chance to work
15:00:37FromDiscord<Yardanico> lol
15:07:04FromDiscord<Phil> !↵It is slowing down and my CPU is no longer baking it 90+ °C!↵Could it be? Is the compilation soon to be finished?
15:07:18FromDiscord<Phil> (edit) "it" => "at"
15:13:03FromDiscord<Phil> It isn't, still going strong, I guess it's downloading some other stuff in the background now
15:13:09FromDiscord<Phil> (edit) "It isn't, still going strong, I guess it's downloading some other stuff in the background now ... " added "and thus less CPU usage"
15:23:40FromDiscord<Nimyth> is nim for apps? or for webs?
15:25:46FromDiscord<Phil> ... so I've just spent the last hour and a half compiling openssl and now it says that the "musl" subcommand isn't working
15:31:03FromDiscord<Phil> Ahh, there we go, the config nims...shouldn't be in /config/config.nims for it to be found it appears? I'm mildly confused, but it's at least doing sth now
15:31:23FromDiscord<Phil> Even if that sth is currently melting all my cpu cores
15:38:30*rtypo_bot joined #nim
15:38:40*rtypo_bot left #nim (#nim)
15:42:10NimEventerNew thread by Mildred: How to use concepts?, see https://forum.nim-lang.org/t/9279
15:43:38FromDiscord<Phil> Aaaaaaaaand I also need to somehow magically compile the sqlite lib into the binary
15:43:49FromDiscord<Phil> If I want to do it statically that is
16:06:57FromDiscord<Phil> In reply to @Yardanico "lol": is it `zigcc` or is it `zig cc` ?↵After installing arch's zig package there appears to be no zigcc, thus the question
16:07:31FromDiscord<Yardanico> It's `zig cc` as I said, but you need to create a wrapper script that won't have spaces because Nim doesn't accept spaces in the compiler binary name
16:09:43FromDiscord<Phil> can that script be just a bash script?
16:10:25FromDiscord<Yardanico> yes of course
16:11:10FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=41wK
16:11:34FromDiscord<Yardanico> Just make sure to use -fno-sanitize=undefined as I showed in the ircord example
16:11:41FromDiscord<Yardanico> And specify the needed glibc version in the target
16:12:19FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=41wL
16:19:00FromDiscord<Phil> Alright, with the bash script moved to /usr/local/bin it compiles into a binary↵Let's set up a docker container
16:24:16NimEventerNew thread by Lancer: Effect system: filtering tags, see https://forum.nim-lang.org/t/9280
16:34:04FromDiscord<fwsgonzo> is there a way to have a default value to a function argument?
16:34:13FromDiscord<Yardanico> `proc test(a = 5) = echo a`
16:34:21FromDiscord<fwsgonzo> sent a code paste, see https://play.nim-lang.org/#ix=41wO
16:34:24FromDiscord<Yardanico> yes that'll just work
16:34:38FromDiscord<Yardanico> `: string` is not required though since the compiler knows the type of `""` anyway
16:35:45FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=41wP
16:36:01FromDiscord<Phil> Though wait, no, nevermind
16:36:04FromDiscord<Yardanico> that's not relevant here
16:36:06FromDiscord<Phil> Doesn't count for proc params
16:36:14FromDiscord<Phil> Urgh, this entire compilershit is mulching my brain
16:36:44FromDiscord<Yardanico> Is there any reason you want to statically link everything?
16:36:53FromDiscord<Yardanico> Alpine has all the libraries in repos
16:37:49FromDiscord<Phil> I have no particular desire whatsoever for any particular compilation method.↵I want stuff to run in an alpine container (or alternatively in bitnami/minideb if I need to compile against glibc)
16:37:57FromDiscord<fwsgonzo> thanks
16:38:05FromDiscord<Phil> The main issue is that nothing effing works
16:38:07FromDiscord<Yardanico> yes, and alpine has openssl, sqlite, etc in repos
16:38:19FromDiscord<Yardanico> So I'm confused as to why you want to statically link those
16:38:28FromDiscord<fwsgonzo> I actually thought that Alpine started out with static everything but moved on to dynamic linking with musl
16:38:35FromDiscord<Yardanico> Also with zig cc you can dynamically link musl
16:39:13FromDiscord<fwsgonzo> and how easy is that with a complex Nim project?
16:39:36FromDiscord<Phil> The main reason I even go through this pain instead of sticking with my alpine glibc frankenstein that I used beforehand was that I wanted to write up a proper deployment guide for prologue in this fashion so that nobody else has to go through the pain
16:39:55FromDiscord<Phil> And I can't really use my frankenstein container in there when there's a dozen and two articles out there why it's a bad idea to mix alpine with glibc
16:39:55FromDiscord<Yardanico> then just use a container with some distro that's glibc
16:39:59FromDiscord<Yardanico> :P
16:40:13FromDiscord<Yardanico> that's the most painless solution, and there are pretty slim debian images for docker
16:40:23FromDiscord<Phil> yeh, thats bitnami/minideb
16:40:45FromDiscord<Phil> The issue I'm currently running into there is that previously I ran nginx under openrc in the alpine-glibc container
16:41:00FromDiscord<Phil> And stuff is silently crashing when I try that
16:41:10FromDiscord<Phil> (edit) "And stuff is silently crashing when I try that ... " added "in the minideb container"
16:41:22FromDiscord<Phil> Which is, yknow, at least a different problem I guess
16:42:58FromDiscord<Phil> In reply to @Yardanico "yes, and alpine has": Truly, the main issue I ran into regarding this was just not knowing how the heck I do a proper compile against musl
16:43:17FromDiscord<Yardanico> you either compile in a musl distro or use zig cc
16:43:48FromDiscord<Yardanico> there's an option of using a c compiler that's built to dynamically link with musl, but zig cc is just easier to use
16:44:24FromDiscord<Phil> sent a long message, see https://paste.rs/Wgr
16:44:31FromDiscord<Phil> (edit) "http://ix.io/41wU" => "http://ix.io/41wT"
16:45:31FromDiscord<Phil> well, lets see if ti runs
16:45:42FromDiscord<Phil> aaaaaand it doesnt
16:46:13FromDiscord<Phil> Ah, likely because musls wrapper is around gcc and that takes flags in a different way or sth
16:46:22FromDiscord<Yardanico> ???
16:46:29FromDiscord<Yardanico> why are you using `musl-gcc`
16:46:35FromDiscord<Yardanico> if you need to use your zigcc script
16:46:38FromDiscord<Phil> It's the one musl thing I know that compiles it
16:46:55FromDiscord<Yardanico> but `target` is not a C compiler option, it's specifically a `zig cc` option
16:47:06FromDiscord<Yardanico> not sure why are you trying to use musl-gcc for glibc
16:47:30FromDiscord<Phil> I'm throwing shit I vaguely believe works together, I don't know either
16:47:39FromDiscord<Yardanico> well but you should understand that this is wrong
16:49:39FromDiscord<Phil> When I set out on this, I originally had not intended to go on a multi-day trip on "learn 4 different compilers and these very specific flags you need to compile them".
16:49:49FromDiscord<Phil> Which this is starting to look like
16:49:52FromDiscord<Yardanico> yes, I don't exactly get why you do it either
16:50:02FromDiscord<Yardanico> if you can just use a normal glibc distro, and solve the nginx issues instead
17:05:19FromDiscord<Phil> Alright, I have a working container... guess I'll have to recommend installing zig in a sidenote should they run into glibc versioning issues
17:19:36FromDiscord<Phil> I'm mildly concerned that the bitnami version of the container has 5 times the size of the alpine-glibc frankenstein
17:20:16FromDiscord<Phil> (edit) "I'm mildly concerned that the bitnami version of the container has 5 times the size of the alpine-glibc frankenstein ... " added "(~170MB vs. ~30MB)"
17:20:25FromDiscord<Phil> (edit) "I'm mildly concerned that the bitnami version of the container has ... 5" added "over"
17:40:01*CyberTailor quit (Quit: Konversation terminated!)
18:26:17NimEventerNew post on r/nim by thindil: Raw Memory Management patterns in Nim language, see https://reddit.com/r/nim/comments/vqnr1d/raw_memory_management_patterns_in_nim_language/
18:44:08*kenran joined #nim
18:52:25NimEventerNew post on r/nim by cuntymccuntlicker: Deeplearning in Nim?, see https://reddit.com/r/nim/comments/vqoa62/deeplearning_in_nim/
18:54:58FromDiscord<d4rckh> is there any proc to convert a `Port` to an `int`?
18:55:06*CyberTailor joined #nim
18:55:32FromDiscord<huantian> If Port is a distinct int, you can use int on it
18:56:33FromDiscord<d4rckh> thanks, it worked
18:59:34*noeontheend joined #nim
19:01:32FromDiscord<bulatz> sent a code paste, see https://play.nim-lang.org/#ix=41xp
19:05:34FromDiscord<huantian> Something like <https://github.com/status-im/questionable#binding-chaining-fallbacks-and-operators>?
19:05:47FromDiscord<huantian> Or maybe you can make your own thing, honestly not sure
19:09:18*kenran quit (Quit: WeeChat info:version)
19:15:19FromDiscord<bulatz> thanks, I don't want to make my own stuff, but only use existing one if any. I thought that prepending "?" should work, but seems it doesn't work for "void"
19:19:11FromDiscord<ripluke> Does Nim have something like rustlings already?
19:30:04FromDiscord<j-james> not to my knowledge
19:32:44FromDiscord<ripluke> Ohk
19:35:31FromDiscord<Elegantbeef> @ripluke\: https://github.com/sergiotapia/nimlings
19:35:52FromDiscord<ripluke> ah
19:40:02FromDiscord<Elegantbeef> To answer the question @TryAngle there is no reason to make char a utf8 rune, they symbolise different things if you want to have a `UnicodeString` Nim gives you all the ability in the world to implemented it. A thing to consider is that people use `string` as a binary buffer so by making `string` unicode aware you now make most operations much more costly cause instead of index look up being O(1) it's now O(n).
19:43:14FromDiscord<ripluke> Now this is just sad https://media.discordapp.net/attachments/371759389889003532/993240520841236581/0E3F31C3-1893-4254-BB13-7477EB1D165C.jpg
19:43:26FromDiscord<ripluke> Might contribute and add more
19:43:33FromDiscord<Elegantbeef> "PRs welcomed"
19:45:02*CyberTailor quit (Remote host closed the connection)
19:45:25FromDiscord<ripluke> In reply to @Elegantbeef ""PRs welcomed"": Am i blind because I don't see where it says that
19:45:35FromDiscord<Elegantbeef> It's a joke
19:45:40FromDiscord<Elegantbeef> Make PRs if you want to add to it
19:46:26*CyberTailor joined #nim
19:50:29FromDiscord<ripluke> Ok
19:50:32FromDiscord<Phil> Nim is the fastest community to make a contributor out of you, I'll say that much
19:50:43FromDiscord<Phil> Which feels kinda nice in the way
19:50:50FromDiscord<Phil> (edit) "the" => "a"
19:51:06*noeontheend quit (Ping timeout: 264 seconds)
19:54:35FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=41xr
19:56:21FromDiscord<Phil> Can't say I ever tried, but I also didn't ever play around with http libs that low level
19:56:21FromDiscord<d4rckh> (talking about std/asynchttpserver)
19:56:30FromDiscord<huantian> Uhh maybe use a closure to capture the server?
19:56:31FromDiscord<Phil> Maybe? Worth a try
19:56:46FromDiscord<d4rckh> never messed around with closures
19:56:55FromDiscord<Elegantbeef> Of course you do you use async 😛
19:57:15FromDiscord<d4rckh> wait
19:57:55FromDiscord<Elegantbeef> I do like that yardanico has advertised my traitor package more than i have
19:58:12FromDiscord<d4rckh> i have a ~~better~~ idea
19:58:30FromDiscord<d4rckh> i have an object that contains a proc for starting the server. the server can be anything really
19:58:40FromDiscord<d4rckh> (edit) "i have an object that contains a proc for starting the server. the server can be anything really ... " added "(http, tcp socket)"
19:58:50FromDiscord<d4rckh> and i want to add more servers without creating new types
19:59:05FromDiscord<d4rckh> before i was thinking that the function that creates these would watch for the boolean
19:59:19FromDiscord<huantian> Why not just store the server?
19:59:25FromDiscord<Phil> I feel like I should use traitor for my generic repository
19:59:26FromDiscord<d4rckh> but what if the proc that started the server returned another proc that closes the server?
20:00:12FromDiscord<huantian> Yeah that’s closures
20:00:45FromDiscord<d4rckh> aha
20:00:46FromDiscord<d4rckh> i see
20:01:24FromDiscord<krisppurg> sent a code paste, see https://play.nim-lang.org/#ix=41xv
20:02:09FromDiscord<Elegantbeef> I mean it's only "unsafe"
20:02:19FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=41xw
20:02:56FromDiscord<Elegantbeef> https://forum.nim-lang.org/t/8188 pick your favourite krisp
20:04:18FromDiscord<d4rckh> (edit) "https://play.nim-lang.org/#ix=41xw" => "https://play.nim-lang.org/#ix=41xx"
20:07:18FromDiscord<krisppurg> wait is it deemed as "unsafe" because if the integer was like 5, but the enum's values can hold up to 2, e.g. `etEnum = 1, etEnumX = 2` then that could lead to range error right?
20:07:30FromDiscord<krisppurg> (edit) "wait is it deemed as "unsafe" because if the integer ... was" added "to parse"
20:07:37FromDiscord<Elegantbeef> I mean if you check the value before hand it's a safe conversion
20:07:54FromDiscord<Elegantbeef> The unsafe part is if you dont check before you leap
20:08:07FromDiscord<krisppurg> ah that's actually nice
20:17:07FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=41xB not the most efficient method but this is a relatively nice check
20:20:51FromDiscord<krisppurg> sent a code paste, see https://play.nim-lang.org/#ix=41xC
20:20:59FromDiscord<Elegantbeef> You will get the warning still
20:21:12FromDiscord<krisppurg> bruh moment
20:21:30FromDiscord<Elegantbeef> You can do the safety check then disable the warning for the block
20:21:45FromDiscord<Elegantbeef> I dont know if there is a way to convert to a enum "safely"
20:22:28FromDiscord<krisppurg> I was thinking of parseEnum[ChannelType]($something)
20:22:44FromDiscord<krisppurg> but I'm not that sure
20:23:00FromDiscord<Elegantbeef> I mean just do the check and if you're really annoyed disable the warning on the line it bitches about
20:24:01FromDiscord<krisppurg> alright
20:24:22FromDiscord<Elegantbeef> No reason to make the code dumber to appease the compiler
20:27:50*pch_ joined #nim
20:27:50*pch quit (Read error: Connection reset by peer)
20:29:57FromDiscord<ripluke> How can I hide all of this output with nim c https://media.discordapp.net/attachments/371759389889003532/993252278943355121/F9438ABF-7800-4426-8070-E6E9B5AADE3D.jpg
20:30:06FromDiscord<ripluke> I only want the hello world or any errors
20:30:12FromDiscord<ripluke> No compiler output
20:30:36FromDiscord<Elegantbeef> `--verbosity: 0`
20:31:04FromDiscord<ripluke> Oh thx
21:00:04FromDiscord<d4rckh> In reply to @d4rckh "is this okay to": Bump 🙃
21:01:26FromDiscord<Elegantbeef> It seems ok httpclient is a ref object which means the procedure can capture it
21:20:28FromDiscord<ripluke> https://github.com/Infinitybeond1/nimlings↵↵i created the first 2 excercises, if you want you can check over the excercises and see if i did anything wrong
21:25:23FromDiscord<Phil> Assert of exercise 1 will bomb because you're asserting "Hello nim" == "Hellow World"
21:25:40FromDiscord<d4rckh> In reply to @Elegantbeef "It seems ok httpclient": Server, you mean
21:32:42FromDiscord<ripluke> In reply to @Isofruit "Assert of exercise 1": the user is suposed to fix it
21:33:02FromDiscord<ripluke> so the function returns hello world
21:34:31FromDiscord<Phil> ahhh check
21:38:27*adium quit (Ping timeout: 256 seconds)
21:48:28FromDiscord<Elegantbeef> Using `run.sh` ah yes welcome to cross platform code
21:49:18FromDiscord<Elegantbeef> Nice that you shamelessly copied the repo then removed the license
21:49:22FromDiscord<Elegantbeef> 10/10
21:50:59Amun-Ra;)
21:52:14FromDiscord<Elegantbeef> Nevermind i cannot read git history
21:52:18FromDiscord<ripluke> In reply to @Elegantbeef "Nice that you shamelessly": The license is still there 💀
21:52:42FromDiscord<ripluke> And I kinda deleted every excercise and made my own lol
21:53:04FromDiscord<ripluke> So all that's left was basically the src folder
21:53:19FromDiscord<ripluke> In reply to @Elegantbeef "Using `run.sh` ah yes": Idk how to write bat 💀
21:53:25FromDiscord<ripluke> Or ps1
21:53:33FromDiscord<Elegantbeef> Dont write either write a nimble task
21:53:47FromDiscord<ripluke> In reply to @Elegantbeef "Dont write either write": Yea I was planning on doing that
21:54:00FromDiscord<Elegantbeef> Then why did you bring up bat or ps1?! 😄
21:54:03FromDiscord<ripluke> But I have the run.sh file temporarily
21:54:21FromDiscord<ripluke> In reply to @Elegantbeef "Then why did you": Because for rn I'm focused more on writing the excercises
22:10:08FromDiscord<Professor Actual Factual> Currently having troubling unmarshalling `DateTime` objects can anyone help? https://play.nim-lang.org/#ix=41xW
22:10:27FromDiscord<Elegantbeef> Use `jsonutils`
22:10:50FromDiscord<Elegantbeef> DateTime has procedures in it's fields so the default json serialiser does not work
22:11:29FromDiscord<Professor Actual Factual> In reply to @Elegantbeef "DateTime has procedures in": I figured I would have to write custom parsers :/
22:11:59FromDiscord<Elegantbeef> You do but it's quite simple with not variants
22:21:00FromDiscord<Elegantbeef> It's not too bad
22:21:02FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=41y1
22:21:22FromDiscord<Elegantbeef> Though this will use serialzation hooks for all date time in your library
22:21:53FromDiscord<Elegantbeef> So you may want to define one for your `Message` or make a distinct type for your DateTime
22:22:50FromDiscord<Professor Actual Factual> sent a code paste, see https://play.nim-lang.org/#ix=41y2
22:22:57FromDiscord<Professor Actual Factual> Im on 1.6.2
22:23:05FromDiscord<Elegantbeef> `std/jsonutils`
22:23:07FromDiscord<Elegantbeef> Cmon get with the times
22:23:26FromDiscord<Elegantbeef> You should import all stdlib libraries with `std`
22:23:36FromDiscord<Elegantbeef> Some newer modules are forced to be imported that way
22:23:56FromDiscord<Professor Actual Factual> Wow, having std qualifies it, wonder what the rational is behind this :/
22:24:10FromDiscord<Professor Actual Factual> 😮
22:24:13FromDiscord<Elegantbeef> Local directory is always preferred over stdlib
22:24:30FromDiscord<Elegantbeef> As such it's quite easy to accidentally import local modules instead of the stdlib and be very confused
22:24:53FromDiscord<Professor Actual Factual> Thanks a bunch beef, you're always very helpful :nim1:
22:25:03FromDiscord<Elegantbeef> Consider you have a module named `macros` that you have all your macros in, you need some mechanism to override local module
22:25:28FromDiscord<Elegantbeef> But yes if you use stdlib you should use `std/` and ideally `[]` but ymmv on the latter
22:26:44FromDiscord<Elegantbeef> A lot of older Nim code/developers do not use `std/` so it's not as common as it ought to be
22:27:28Amun-RaI use std/, I almost never use []
22:27:32FromDiscord<Professor Actual Factual> In reply to @Elegantbeef "A lot of older": I've been on nim since 1.4.0, I'm still a intermediate nim dev at best.
22:27:48FromDiscord<Elegantbeef> amun brings shame to their family!
22:28:03FromDiscord<Elegantbeef> I'm kidding of course i just think it's much nicer to write an import path once and not multiple times
22:28:21FromDiscord<Elegantbeef> You can format it across multiple lines if you prefer
22:28:42FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=41y3
22:28:53FromDiscord<Elegantbeef> There is no way in hell i'm going to write the imports for each of those out verbatim
22:29:16FromDiscord<Elegantbeef> you can also do `pkg/` if you want to specify it's from a package
22:29:21FromDiscord<Professor Actual Factual> In reply to @Amun-Ra "I use std/, I": I used `[]` but it seems like you can't use this for certain import cases like↵`import std/[a, b except bfunc]`↵Or recently ive been using the websock library and you have to import it like this to work↵`import websock/[websock]`
22:29:47FromDiscord<Elegantbeef> "certain import cases" also known as the ones you dont really need
22:30:06FromDiscord<Professor Actual Factual> In reply to @Elegantbeef ""certain import cases" also": ? What does that mean
22:30:07FromDiscord<Elegantbeef> the latter is your own doing
22:30:14FromDiscord<Elegantbeef> Or rather the library author
22:30:21*jmdaemon joined #nim
22:30:31FromDiscord<Professor Actual Factual> In reply to @Elegantbeef "Or rather the library": I see, too bad im not gonna write my own websocket library lol
22:30:36FromDiscord<Elegantbeef> I dont believe in using `import x except y` unless you need it
22:30:40FromDiscord<Elegantbeef> And you hardly ever need it
22:31:41FromDiscord<Elegantbeef> I mean it's just cause they have `websock/websock.nim` as their project path
22:31:48FromDiscord<Professor Actual Factual> sent a code paste, see https://play.nim-lang.org/#ix=41y5
22:31:58FromDiscord<Professor Actual Factual> (edit) "https://play.nim-lang.org/#ix=41y5" => "https://play.nim-lang.org/#ix=41y6"
22:32:06FromDiscord<Elegantbeef> and i'd do `chronos.seconds(1)`
22:32:38FromDiscord<Elegantbeef> I personally do not deal with import collisions using import logic as I feel i generally need those symbols
22:32:39FromDiscord<Professor Actual Factual> In reply to @Elegantbeef "and i'd do `chronos.seconds(1)`": Comn man does it look like I can type 7 more characters. Its too hard lol
22:32:53FromDiscord<Elegantbeef> `except seconds` is more characters
22:33:04FromDiscord<Professor Actual Factual> But you only gotta do it once tho
22:33:27FromDiscord<Elegantbeef> I've personally never really needed the except so i'll shush
22:34:09FromDiscord<Professor Actual Factual> My rationale is to use qualified imports everywhere except for really common functions. For example its understood that `async` is from chronos or asyncdispatch and `newSeq` comes from sequtils
22:34:14FromDiscord<Professor Actual Factual> But to each their own style
22:34:19FromDiscord<Elegantbeef> Ew
22:34:29FromDiscord<Elegantbeef> You dont use UFCS?!
22:34:37FromDiscord<Elegantbeef> The hell are you doing here! 😛
22:35:01FromDiscord<Elegantbeef> Also if you're doing qualified imports why arent you doing `import x as nil`?
22:35:21FromDiscord<Professor Actual Factual> Because ^ with that you can't use `x/[]` notation
22:35:25FromDiscord<Elegantbeef> You can write python to your hearts content
22:35:38FromDiscord<Elegantbeef> of course you want qualified! 😛
22:35:50FromDiscord<Professor Actual Factual> Maybe because I do python in my day job lol
22:36:07FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=41y8
22:37:02FromDiscord<Elegantbeef> I'll eventually stop with the opinionated hyperbolic nonsense
22:37:07FromDiscord<Professor Actual Factual> sent a code paste, see https://play.nim-lang.org/#ix=41y9
22:50:56*wallabra_ joined #nim
22:52:18*wallabra quit (Ping timeout: 264 seconds)
22:52:30*wallabra_ is now known as wallabra
23:11:35*pch_ quit (Quit: Leaving)
23:28:09*adium joined #nim
23:58:39FromDiscord<!Patitotective> beef really likes italic