<< 24-05-2022 >>

00:47:15FromDiscord<!Patitotective> ImTemplate _v0.2.0_ is finally out! :]↵with data resources support, windows support and updateable AppImage support↵and now implementing the 7GUIs tasks and Dear ImGui's demo basic widgets for a more complete example :]↵https://github.com/Patitotective/ImTemplate/releases/tag/0.2.0
02:09:38FromDiscord<Zectbumo> is there something built in or easy way to convert array[byte] to string?
02:09:52FromDiscord<Zectbumo> or even array[char]
02:11:26FromDiscord<Zectbumo> oh maybe I can use a union struct. I haven't looked into those
02:11:50FromDiscord<Elegantbeef> !eval import std/strbasics; echo (var a = ""; a.add cast[array[3, char]](['a', 'b', 'c']); a)
02:11:50FromDiscord<Elegantbeef> 😄
02:11:52NimBotabc
02:12:33FromDiscord<Rika> What the fuck when did we get this module
02:12:39FromDiscord<Zectbumo> neat
02:12:49FromDiscord<Elegantbeef> No idea but it's fasssst
02:28:33FromDiscord<ambient> is it possible to compile native arm64 binaries with Nim on Apple M1 or am I just doing it wrong?
02:29:15FromDiscord<Elegantbeef> Given that it generates C code i'd imagine so
02:29:45FromDiscord<ambient> how do i see what compile flags nim uses to compile the C file?
02:29:47FromDiscord<Rika> Should be able to
02:29:57FromDiscord<Rika> Turn verbosity up?
02:30:05FromDiscord<Elegantbeef> `--listCmd` iirc
02:31:03FromDiscord<Elegantbeef> Assuming you used choosenim i think it ships a x86 binary, so you may have a hiccup there
02:31:25FromDiscord<ambient> i already compiled it, nim -v shows arm64, and arch in console also shows arm64
02:31:32FromDiscord<Elegantbeef> Ah ok
02:31:49FromDiscord<Elegantbeef> The compiled binary then should be arm but idk
02:35:10FromDiscord<ambient> i had to put "-arch arm64" into both compile and link flags with --passC --passL
02:35:18FromDiscord<ambient> so now it compiles as arm64
02:36:57FromDiscord<ambient> got only 10% boost. rosetta is really good
02:37:32FromDiscord<Rika> Were you using clang
02:37:38FromDiscord<ambient> yes
02:37:47FromDiscord<ambient> the one that comes with xcode
02:37:58FromDiscord<ambient> i would assume, as i have installed no others
02:49:40*toluene5 joined #nim
02:49:43*toluene quit (Ping timeout: 246 seconds)
02:49:44*toluene5 is now known as toluene
03:17:13FromDiscord<huantian> In reply to @Rika "What the fuck when": There’s so many random modules lmao
03:17:32FromDiscord<Elegantbeef> strbasic isnt that random 😄
03:37:46FromDiscord<j-james> how can i create a reference to an arbitrary variable?
03:42:34FromDiscord<Rika> You copy it then stop using the old variable
03:49:15FromDiscord<j-james> is there no way to use it by reference because it's a primitive type?
03:49:48FromDiscord<j-james> oh, in my example the arbitrary variable was a string
03:51:20FromDiscord<j-james> (edit) "example" => "head"
03:57:59FromDiscord<Rika> Strings have value semantics
03:58:03FromDiscord<Rika> Copy is still required
03:58:30FromDiscord<j-james> do all primitive types have value semantics?
03:58:39FromDiscord<Rika> As far as I recall yes
03:58:43FromDiscord<Rika> This includes sequences
03:59:39FromDiscord<j-james> i see, thanks
04:00:11FromDiscord<j-james> and then if you wanted to move by reference it'd have to be for a `type name = ref object`?
04:00:34FromDiscord<Rika> Usually yes
04:17:52FromDiscord<j-james> sent a code paste, see https://play.nim-lang.org/#ix=3YtG
04:19:27FromDiscord<Elegantbeef> reference semantics
04:20:30FromDiscord<Elegantbeef> `a = b` makes `a` point to `b`'s data, which is like `a = b` with values
04:21:02FromDiscord<Elegantbeef> The same happens without references
04:21:17FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3YtI
04:28:27FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=3YtK
04:30:41FromDiscord<j-james> hmm okay, so it's the compiler being smart?
04:31:26FromDiscord<j-james> i'm trying to understand how refs work by comparing them to rust's ownership
04:31:44FromDiscord<Elegantbeef> No references aren ownership
04:31:45FromDiscord<Elegantbeef> arent
04:31:56FromDiscord<Elegantbeef> References are heap allocated gc'd types
04:32:50FromDiscord<demotomohiro> Mutiple references can refers one object on heap and they are managed by Nim's Memory Management.
04:32:51FromDiscord<huantian> if b went out of scope and was immediately destroyed, the memory a now points to is gone
04:33:31FromDiscord<huantian> I think it's a tad bit like rust Rc<T>?
04:33:32FromDiscord<huantian> iirc
04:35:01FromDiscord<j-james> how are those managed with arc?
04:36:11FromDiscord<Elegantbeef> Scoped based destructors and a reference counter
04:36:20FromDiscord<huantian> statically added to the code
04:36:51FromDiscord<demotomohiro> https://nim-lang.org/docs/mm.html
04:39:16FromDiscord<j-james> ah, i see
04:39:27FromDiscord<j-james> so then the reference counter prevents double free errors
04:40:24FromDiscord<Rika> ~~yeah that’s the point of a GC~~
04:40:53FromDiscord<j-james> yeah i was caught up by rust's model being strict where it doesn't need to be
04:41:25FromDiscord<Elegantbeef> Well rust mostly borrows and doesnt allow some of the relationships Nim's ref does
04:42:25FromDiscord<demotomohiro> Reference counter keeps objects alive as long as there is a reference to it. And free it only when there is no reference to it.
04:42:44FromDiscord<Elegantbeef> And with arc/orc this is done somewhat deterministically
04:43:03FromDiscord<Elegantbeef> arc is deterministic orc's cycle breaker is not
04:43:16FromDiscord<huantian> just leak the cycles it's fine
04:43:26FromDiscord<Elegantbeef> We cant all be V
04:44:26FromDiscord<j-james> yet rust's borrow checker doesn't handle cycles either, right
04:44:37FromDiscord<Elegantbeef> Nope borrows cannot be cyclical
04:44:49*noeontheend joined #nim
04:44:54FromDiscord<j-james> so what's the point of the extra strictness in borrowing 🤷
04:45:02FromDiscord<j-james> i suppose it makes good practice
04:45:10FromDiscord<huantian> i'd assume performance too?
04:45:25FromDiscord<huantian> but I don't use rust so I don't know what you mean by "extra strictness"
04:45:27FromDiscord<Elegantbeef> memory reuse and program safety
04:46:12FromDiscord<Elegantbeef> Well memory reuse gives performance 😄
04:46:36FromDiscord<Elegantbeef> The strictness is to ensure the lifetime of the references and ensuring no memory leaks or dangling pointers
04:47:12FromDiscord<j-james> wrt. extra strictness, rust doesn't allow b to go out of scope or be used again after it's moved into a (in the earlier example)
04:47:55FromDiscord<j-james> (edit) removed "go out of scope or"
04:48:20FromDiscord<Elegantbeef> Well Nim's move semantics work differently
04:48:35FromDiscord<Elegantbeef> If you the flow of the program forces a copy a move is a copy instead
04:48:55FromDiscord<j-james> oh even for a ref object?
04:49:22FromDiscord<Elegantbeef> Eh refs arent really moved much 😄
04:49:31FromDiscord<huantian> you just point at it from different places
04:49:39FromDiscord<j-james> oh true lol
04:51:07FromDiscord<j-james> In reply to @Elegantbeef "memory reuse and program": how does borrowing use less memory than reference counting?
04:51:25FromDiscord<Elegantbeef> Borrowing lets you safely reuse memory
04:51:39*noeontheend quit (Ping timeout: 258 seconds)
04:52:18FromDiscord<Elegantbeef> Borrowing ensures you dont have pointers that outlive the source which means you do not have dangling pointers in a safe static way
04:52:21FromDiscord<demotomohiro> Borrowing doesn't use counter like reference counting
04:52:38FromDiscord<Elegantbeef> Borrowing is a static anaylsis
04:53:19FromDiscord<huantian> as opposed to a reference counter which counts refs at runtime
04:53:42FromDiscord<Elegantbeef> Yep two different things
04:54:12FromDiscord<Elegantbeef> Rust's strictness is due to their borrowing not due to a RAII like system
04:56:58FromDiscord<j-james> hmm, i was under the impression that nim's reference counting was done at compile time
04:57:08FromDiscord<j-james> and that's why it injects destructors
04:57:22FromDiscord<j-james> why does it need to be done at runtime?
04:58:18FromDiscord<Rika> I’m under the impression that it does the compile time destructor injection only for the scope the variable is sure to stay in
04:58:27FromDiscord<Rika> If it escapes it cannot do anything about it
05:00:43FromDiscord<j-james> how does a variable escape a scope?
05:00:59FromDiscord<j-james> (edit) "how does a variable escape a scope? ... " added "when it's a `var` parameter?"
05:01:51FromDiscord<huantian> In reply to @j-james "another question: what is": well sometimes it definitely won't, but this is an example
05:02:02FromDiscord<huantian> you assign b to something outside of its scope
05:03:07FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=3YtQ
05:04:24FromDiscord<huantian> sent a code paste, see https://paste.rs/lag
05:04:40FromDiscord<Elegantbeef> That's not borrowing as much as move semantics
05:05:22FromDiscord<huantian> yeah true
05:05:31FromDiscord<j-james> In reply to @Rika "If it escapes it": in that case, what makes arc deterministic for everything but cycles
05:05:36FromDiscord<Elegantbeef> View types is Nim's borrow
05:05:48FromDiscord<Elegantbeef> Arc doesnt have a cycle collector it just leaks them
05:08:06FromDiscord<j-james> sent a code paste, see https://paste.rs/zE6
05:09:48FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3YtS
05:10:08FromDiscord<demotomohiro> I think arc stays deterministic if `runtimeProc()` and `runtimeProc2()` are deterministic.
05:10:18FromDiscord<Elegantbeef> It's always deterministic
05:10:24FromDiscord<Elegantbeef> The garbage collection procedures are placed deterministically
05:11:05FromDiscord<Rika> Reference counting is deterministic in when the object is deallocated
05:13:02FromDiscord<j-james> but not deterministic in if the object is deallocated?
05:13:06FromDiscord<j-james> okay, that makes sense
05:13:34FromDiscord<j-james> i had the idea that destructors would absolutely deallocate the object no matter what for some reason
05:13:56FromDiscord<Rika> If a cycle exists then the reference count never hits 0 unless the cycle is explicitly broken so yeah it won’t deallocate everything
05:14:09FromDiscord<Rika> But once the reference count hits 0 it is getting deallocated
05:16:16FromDiscord<j-james> sent a code paste, see https://play.nim-lang.org/#ix=3YtT
05:16:19FromDiscord<Rika> Indeed
05:16:26FromDiscord<Elegantbeef> Yes if an object references itself internally
05:19:07FromDiscord<huantian> So if there could be no references at a point, Nim doesn’t collect it, but waits until it’s sure there are no references, right?
05:19:34FromDiscord<Elegantbeef> I mean it's called inside the object destructor
05:19:58FromDiscord<Elegantbeef> Destructors check if references are `nil` and if they have reference count of \> 0 then deallocate afaik
05:21:54FromDiscord<Elegantbeef> Anyway i think the best way to explain determinism is that "Given the same program state the deallocations will allways happen at the same point"
05:27:03FromDiscord<huantian> Right so not necessarily given the same code, but the same input as well
05:28:19FromDiscord<Rika> Input, code, potentially environment as well
05:28:40FromDiscord<Rika> Usually doesn’t matter though, the environment
05:31:26FromDiscord<j-james> so now if deallocations are guarenteed to happen at the same point with arc: what benefits do move semantics give?
05:31:32FromDiscord<j-james> earlier deallocations?
05:32:11FromDiscord<Zectbumo> if I have `args: varargs[auto]` how do I get the inside type without subscripting like `args[0].type`
05:32:24FromDiscord<Elegantbeef> you have to subscript it
05:32:27FromDiscord<Elegantbeef> use a generic
05:32:41FromDiscord<Zectbumo> time to learn about generics. I've been waiting for this day
05:33:37FromDiscord<Elegantbeef> I mean it's the same thing as auto
05:33:38FromDiscord<Elegantbeef> you just explicitly state what part is auto
05:35:40FromDiscord<huantian> In reply to @j-james "so now if deallocations": For value semantics, usually you would copy the value when you say pass it into a proc. With move, if you know it won’t be used after the proc you get better performance
05:36:09FromDiscord<Elegantbeef> This is especially important for `seq`, `string`
05:36:14FromDiscord<Zectbumo> In reply to @Elegantbeef "I mean it's the": oh, that sped up my learning 1000%. thanks. I get it now
05:37:06FromDiscord<Elegantbeef> I was going to give an example but i'm busy
05:37:12FromDiscord<Elegantbeef> So i'll take sarcasm into account
05:37:50FromDiscord<Zectbumo> I kept looking at T and skipping it because I just didn't get it. but you said "just state what part is auto" and that made it click
05:38:14FromDiscord<Elegantbeef> Oh shit that wasnt sarcasm 😄
05:38:25FromDiscord<j-james> In reply to @huantian "For value semantics, usually": what's an example where the compiler doesn't know to optimize a copy into a sink, but you do?
05:40:22FromDiscord<Elegantbeef> The compiler can do sink inference so uhhh sometime
05:40:52FromDiscord<huantian> Sink inference is still “experimental” iirc but like half of the language is so who knows
05:40:55FromDiscord<Zectbumo> sent a code paste, see https://paste.rs/HDm
05:41:45FromDiscord<Yardanico> In reply to @Elegantbeef "The compiler can do": sink inference is disabled for user code by default
05:41:54FromDiscord<Yardanico> since it breaks closure proc types
05:42:07FromDiscord<Yardanico> it is enabled for the stdlib though (at least parts of it)
05:42:16FromDiscord<Yardanico> and you can enable it for your code with `--sinkInference:off`
05:42:19FromDiscord<Yardanico> (edit) "`--sinkInference:off`" => "`--sinkInference:on`"
05:48:40FromDiscord<Elegantbeef> Sooo uhhh anyone want to redesign my GUI API for me thanks... 😄
05:49:40FromDiscord<huantian> In reply to @Yardanico "and you can enable": What if I just put sink on all my parameters nothing can go poorly right ??
05:50:13FromDiscord<Elegantbeef> Nim copies when it cannot sink, but you'll get type mismatches as sink procedures are different types to non sink versions
05:53:17FromDiscord<Zectbumo> In reply to @Elegantbeef "Sooo uhhh anyone want": do we have something like XCode has with some visual editor?
05:53:42FromDiscord<Elegantbeef> No clue i prefer it in code
05:53:50FromDiscord<Elegantbeef> I'm talking about game gui anyway 😄
05:53:57FromDiscord<Zectbumo> ah, custom
05:54:15FromDiscord<Zectbumo> send the screenshot
05:54:26FromDiscord<huantian> In reply to @Elegantbeef "Nim copies when it": Huh interesting
05:54:33FromDiscord<Elegantbeef> You get video
05:54:35FromDiscord<Elegantbeef> simplescreenrecorder-2022-05-23\_01.14.09.mp4 https://media.discordapp.net/attachments/371759389889003532/978536468760920104/simplescreenrecorder-2022-05-23_01.14.09.mp4
05:55:06FromDiscord<Zectbumo> nice and responsive
05:55:34FromDiscord<Elegantbeef> That's of course just a placeholder nineslice image
05:55:54FromDiscord<huantian> “This does not even fit”↵Fits
05:56:14FromDiscord<Elegantbeef> I quite like how it looks in the actual project
05:56:15FromDiscord<Elegantbeef> simplescreenrecorder-2022-05-21\_19.23.42.mp4 [simplescreenrecorder-2022-05-21_19.23.42.mp4](https://t2bot.io/_matrix/media/r0/download/matrix.org/JJlRRUzuNVOiJTXDqTWKTzYs)
05:57:23FromDiscord<Bung> In reply to @Zectbumo "do we have something": https://github.com/nim-lang/Nim/wiki/Editor-Support check nim wiki first
05:57:45FromDiscord<Zectbumo> lol, after the video stopped my eyes were in a trans and the waves were still moving
05:59:17FromDiscord<Zectbumo> @Bung thanks, that's quite a list. I was thinking more along the lines of editor for GUI manipulations
05:59:26FromDiscord<huantian> Huh I wonder how’s clion’s extension’s sematic highlighting
06:01:21FromDiscord<Zectbumo> I think I messed up in saying "XCode" when I meant Interface Builder (I just looked it up)
06:02:15FromDiscord<huantian> Are you sure you don’t want a proprietary closed ecosystem ide made by apple but for Nim?
06:02:39FromDiscord<Zectbumo> 😄 yes, ehrm, no
06:03:14FromDiscord<Zectbumo> I've seen an open source version of interface builder. I'll see if I can find it
06:03:53FromDiscord<huantian> I haven’t used this tool so unfortunately I have nothing useful to add to this convo
06:04:58FromDiscord<Zectbumo> it's amazing and I would love to see something like this in Nim. It is toolkit specific (as one would imagine) but I was imagining why stop there and maybe make it multi-target. just like nim
06:05:18FromDiscord<Zectbumo> ah well, it's nice to dream
06:05:51FromDiscord<huantian> I think I’m just dreaming of more editor tooling in general lol
06:08:58FromDiscord<Zectbumo> it would be cool to do a little demo but I would need to know how hotpatching works in nim
06:18:55FromDiscord<Bung> there's a cool editor write in nim https://github.com/fox0430/moe if it is something you are looking for
06:24:42*jjido joined #nim
06:35:52FromDiscord<Zectbumo> In reply to @Zectbumo "I've seen an open": okay so I found something. it was very hard to find. old videos were in flash \:D so they wouldn't play (blast to the past). but here is a youtube that someone demos it a bit↵https://youtu.be/g8G79gIbqSw?t=361
06:53:13*PMunch joined #nim
06:58:20*redj joined #nim
07:27:15*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
07:29:38*gsalazar joined #nim
07:36:59FromDiscord<Zectbumo> sent a code paste, see https://play.nim-lang.org/#ix=3Yub
07:41:12FromDiscord<Rika> What the heck is that T J stuff lol
07:41:22FromDiscord<Rika> Something up with how you copied your code
07:42:48FromDiscord<Bung> I use vscode most of time , so moe is fast enough for me : )
07:53:03PMunch@Rika, probably just copied something directly from a terminal :P
07:53:18FromDiscord<Yardanico> okay, so a question
07:53:34FromDiscord<Elegantbeef> No answers here
07:53:48FromDiscord<Yardanico> why is strformat implemented in a way that it calls parses the formatting specifier _at runtime_ even though you can only really specify them at compile time
07:53:54FromDiscord<Yardanico> (edit) "it calls parses" => "itparses"
07:54:16PMunchI mean you could specify it at runtime
07:54:22FromDiscord<Yardanico> could you?
07:54:29FromDiscord<Yardanico> strformat formatting string is compile time only
07:54:37PMunchOh
07:54:43FromDiscord<Yardanico> you can't pass a formatting string to strformat at runtime (i mean & and fmt)
07:55:00FromDiscord<Yardanico> yes, formatValue is exported in the API, but I think almost no one uses it, and optimizing strformat is a better target anyway
07:56:03PMunchHmm, strformatImpl seems to be compile-time
07:56:17FromDiscord<Yardanico> yes, but the macro transforms the expression into calls to `add` and `formatValue`
07:56:34FromDiscord<Yardanico> and it gives the specifier for the value as an argument for `formatValue` which is a runtime value
07:56:46FromDiscord<Yardanico> and it's parsed at the runtime with `let spec = parseparseStandardFormatSpecifier(specifier)`
07:56:47FromDiscord<Elegantbeef> Well the add is fine
07:56:50FromDiscord<Yardanico> yes add is fine
07:56:56FromDiscord<Yardanico> since it preallocates the string
07:57:02PMunchAaah I see what you mean
07:57:18PMunchYeah that's dumb..
07:57:24FromDiscord<Yardanico> just seems like a weird oversight
07:57:38FromDiscord<Yardanico> it should just be done in the macro itself i think
07:57:59FromDiscord<Yardanico> as a workaround you can make the `spec` argument for the proc `static string` and make `const spec` but that'll lead to code bloat, so the proper solution is to parse the specifiers in the macro itself
07:58:11PMunchYeah, like it goes through all that work of reading everything out as a macro, then it just immediately reverts back to runtime work for no apparent reason
07:58:18FromDiscord<Yardanico> (it'll lead to code bloat since formatValue will be copied for each different specifier)
07:58:55PMunchSure, but you'd sort of be doing that anyways by putting it in the macro
07:59:24PMunchOh wait, if it's a string it might be a problem
07:59:35PMunchWell, you would copy that code anyways
08:02:50FromDiscord<Yardanico> seems like it's been that way since the start - https://github.com/nim-lang/Nim/commit/26198e4ee74807d7ac24df0e1266ab3280413f8a
08:05:26PMunchHow about this, implement a "parseSpecifier" procedure, then use that in the "formatValue" procedures (for backwards compatibility), and then use the same procedures on compile-time to generate the code statically
08:12:59FromDiscord<Yardanico> ill open an issue so at least I don't forget about it :)
08:14:02FromDiscord<my mom said,> In reply to @Elegantbeef "simplescreenrecorder-2022-05-21\_19.23.42.mp4 [simp": what is this made in?
08:14:07FromDiscord<my mom said,> nico?
08:16:07FromDiscord<Yardanico> In reply to @uncle jim "nico?": his own engine
08:16:14FromDiscord<Yardanico> https://github.com/beef331/truss3d/
08:16:15FromDiscord<my mom said,> In reply to @Yardanico "his own engine": dayum
08:22:01*jjido joined #nim
08:22:02*jjido quit (Client Quit)
08:27:31FromDiscord<Yardanico> @PMunch feel free to comment in https://github.com/nim-lang/Nim/issues/19823
08:27:58FromDiscord<Yardanico> btw, another annoying effect of this issue is that if you have a wrong specifier, your code will throw an error at runtime (!)
08:28:07FromDiscord<Yardanico> not compile time, because specifiers are parsed at runtime as we figured :P
08:28:34FromDiscord<Yardanico> getting some python vibes from this (your code failing at runtime because of something being wrong in your code, like a specifier)
08:29:34PMunchYeah that's definitely not great
08:29:49PMunchNot sure what more I could add to that issue, but I gave it a thumbs up :)
08:32:26FromDiscord<Yardanico> @PMunch thinking about it, parsing the specifier in the macro would also allow to know the _exact_ length of the resulting string in some cases, like in my example code
08:32:55FromDiscord<Yardanico> ah, not really
08:33:11FromDiscord<Yardanico> maybe for some rare cases only
08:37:59PMunchIt could provide better logic for calculating the length though
09:09:07FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3Yul
09:09:59FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3Yum
09:11:08FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3Yun
09:15:00FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Yuo
09:15:05FromDiscord<Elegantbeef> You cannot put params there as it doesnt know it's supposed to be a field
09:17:29FromDiscord<jmgomez> amazing
09:17:33FromDiscord<jmgomez> thanks!
09:17:48FromDiscord<jmgomez> how would you approach the &? any hints on that?
09:24:44FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Yuq
09:26:01*haliucinas joined #nim
09:28:41FromDiscord<jmgomez> crazy stuff, thank you!
09:36:39FromDiscord<Zectbumo> how do you run runnableExamples on a single proc?
09:37:06FromDiscord<Elegantbeef> You cannot afaik you docgen the entire file
09:43:20FromDiscord<qb> Does someone have experience with nimpy and performance optimizations? Any recommend compile flags? Recommend gc?
09:43:33madpropscubey
10:05:03FromDiscord<geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3Yuv
10:08:01FromDiscord<my mom said,> Guys can someone explain me how shells(eg: pwsh, fish, bash) work?
10:08:08FromDiscord<geekrelief> sent a code paste, see https://paste.rs/cF7
10:08:59PMunchmy_mom_said,, what do you mean how they work?
10:09:11FromDiscord<Yardanico> In reply to @uncle jim "Guys can someone explain": as I've said last time, please ask such questions in #offtopic
10:10:23PMunchYardanico, eh as long as no one actually needs help here it's fine
10:10:42PMunchBut I see @geekrelief might be asking something (I can only see paste links on IRC)
10:11:38FromDiscord<geekrelief> In reply to @PMunch "But I see <@109484839480107008>": I was asking about the use of `newStmtList` here to produce an expression in a macro: https://play.nim-lang.org/#ix=3Yuw
10:12:42FromDiscord<geekrelief> it seems like typing this out "normally" wouldn't be possible, but in a macro `newStmtList` creates an expression?
10:13:28FromDiscord<geekrelief> (edit) "an expression?" => "a block?"
10:13:34PMunchIt's almost like a block
10:13:47FromDiscord<geekrelief> yeah I tried {.inject.} on the variable
10:13:56FromDiscord<geekrelief> and printing it works!
10:13:57FromDiscord<geekrelief> wow!
10:16:58FromDiscord<geekrelief> hmm but if I try to put an echo in the statement list it doesn't run, so it's as you say "almost like a block"
10:29:47*jmdaemon quit (Ping timeout: 240 seconds)
10:33:58FromDiscord<Andreas> hi, can one make a template/macro that runs at compiletime and takes a value/tuple `(hashsize_in_byte: int, level_0: int, branch_factor: int )` and ↵1) makes sure that `((hash_value 8) - level_0 ) mod branch_factor == 0` holds↵2) and returns a `proc( hash: SomeUnsignedInt, level: int ): int` that returns a bitslice of hash.↵I'd like to try that myself if its doable.
10:34:56FromDiscord<Yardanico> i don't know how to actually implement the 2nd (which algo), but yes, it's possible
10:36:54FromDiscord<Rika> What’s a bit slice of a hash? A hash where the bits are masked and shifted appropriately?
10:39:12FromDiscord<Andreas> sent a code paste, see https://paste.rs/IM7
10:40:00FromDiscord<Rika> Do you know of this https://nim-lang.org/docs/bitops.html#bitsliced%2CT%2CSlice%5Bint%5D
10:40:03FromDiscord<Rika> Just making sure
10:40:18FromDiscord<Rika> Oh you did say it
10:40:21FromDiscord<Rika> I missed it somehow
10:40:46FromDiscord<Rika> What is that of size part?
10:41:38FromDiscord<Rika> I’m still unsure what this does, I think it would be better if someone who understands it could help
10:42:30FromDiscord<Andreas> In reply to @Rika "What is that of": imagine a 32-bit Hashvalue and you want to use a branchfactor of 5-bit. Having 7-bits for the first-slice and 5 x 5-bit == 32-bit.
10:43:47FromDiscord<Andreas> (edit) "32-bit." => "32-bit.↵And the proc returns the appropriate slice for 6 possible indices between 0-5"
11:47:19*jjido joined #nim
11:49:43*dithpri quit (Quit: '); DROP TABLE Users;--)
11:51:21FromDiscord<Zectbumo> @Yardanico sorry, am I only to make changes on one repository for one PR?
11:51:35FromDiscord<Yardanico> you can have different branches for different PRs
11:51:44FromDiscord<Yardanico> in your fork repo
11:51:47FromDiscord<Zectbumo> okay so I need to create a branch for every PR
11:51:51FromDiscord<Yardanico> yes
11:51:54FromDiscord<Zectbumo> got it
11:52:34FromDiscord<Zectbumo> I will do that moving forward
11:52:55FromDiscord<Yardanico> well, you have to do it for your current PR as well, because currently it has two different unrelated changes
11:53:01FromDiscord<Yardanico> usually PRs like that don't get merged :P
11:53:20FromDiscord<Zectbumo> ah, they have two commits. one for each. that doesn't count?
11:54:38FromDiscord<Zectbumo> it's fine. I'll separate them tomorrow (I just jammed it all up like 30 min ago too)
11:55:07FromDiscord<Zectbumo> or maybe I can rollback that latest commit...
12:00:56FromDiscord<Zectbumo> In reply to @Yardanico "well, you have to": fixed, I reversed the last commit
12:10:05FromDiscord<Yardanico> @Zectbumo your separator fix issue still has the posix thing
12:10:09FromDiscord<Yardanico> (edit) "issue" => "pr"
12:10:44FromDiscord<Zectbumo> 🤦
12:13:34FromDiscord<Zectbumo> In reply to @Yardanico "<@157415492812800000> your separator fix": okay I think I uncrossed the wires now 🤞
12:15:36FromDiscord<Zectbumo> I'll be using github more often now so I'll get the hang of this
12:22:19*arkurious joined #nim
12:37:23FromDiscord<eulores> In reply to @Andreas "imagine a 32-bit Hashvalue": Did you check out https://github.com/sealmove/bitstreams ?
13:02:35*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
13:55:12FromDiscord<d4rckh> what's the best way of enumerating all portable drives connected to the computer?
13:55:42*PMunch quit (Quit: Leaving)
13:59:52FromDiscord<d4rckh> or at least the drives
14:18:30FromDiscord<demotomohiro> Search for C library that can do it or learn OS APIs that can do it.
14:26:26*rockcavera quit (Ping timeout: 255 seconds)
14:28:56NimEventerNew thread by Sixte: Mysterious error message, see https://forum.nim-lang.org/t/9169
14:30:10*gsalazar quit (Ping timeout: 240 seconds)
14:42:09FromDiscord<jmgomez> Is there a way to alter the order of macro resolution?
14:42:54FromDiscord<d4rckh> hm, how would i parse a dword bitmask?
14:43:48FromDiscord<jmgomez> In reply to @jmgomez "Is there a way": i.e I have a macro that produces a pragma and another macro that generates code based on that pragma
15:08:29FromDiscord<d4rckh> okay, turns out i cant compare a char to a string in nim?
15:08:32FromDiscord<d4rckh> how would i do that?
15:08:50FromDiscord<Yardanico> do you want to check if the string has 1 char and that char is the one you want to compare to
15:08:58FromDiscord<Yardanico> or to check if the first char of the string is the same as that char?
15:09:08FromDiscord<Yardanico> if the former, mystring == $mychar
15:09:12FromDiscord<d4rckh> just `if myChar == "X"`
15:09:20FromDiscord<Yardanico> `if myChar == 'X'`
15:09:24FromDiscord<Yardanico> chars are single-quoted
15:09:34FromDiscord<d4rckh> ah, thanks
15:09:42FromDiscord<Yardanico> and if you have multiple if branches, it's better to use the case statement
15:09:56FromDiscord<d4rckh> nah, i only need an if else
15:10:05FromDiscord<d4rckh> its 2 cases
15:10:24FromDiscord<d4rckh> thanks for the suggestion
15:18:46FromDiscord<d4rckh> to convert a string to a lpcwstr should i use `$cast[WideCString](myString)`?
15:18:54*rockcavera joined #nim
15:18:55*rockcavera quit (Changing host)
15:18:55*rockcavera joined #nim
15:19:05FromDiscord<d4rckh> (edit) "`$cast[WideCString](myString)`?" => "`cast[WideCString](myString)`?"
15:20:03FromDiscord<d4rckh> nvm
15:20:07FromDiscord<d4rckh> i didnt need to do that at all
15:34:58rockcaveracast don't "convert"
15:35:02rockcaverasee this https://nim-lang.org/docs/widestrs.html
15:43:55FromDiscord<eyecon> How can I iterate the characters of a buffer of `LPWSTR`, like `GetLogicalDriveStringsW` Win32 API function fills with null-terminated strings?
15:44:18FromDiscord<eyecon> Reference: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getlogicaldrivestringsw
15:46:50FromDiscord<Yardanico> create a WideCString out of it and iterate over that
15:48:02FromDiscord<eyecon> Create meaning `cast()`?
15:49:06FromDiscord<eyecon> If I understand correctly the buffer is filled with multiple strings back to back, all null-terminated. Wouldn't casting just take up to the first null?
15:50:03FromDiscord<eyecon> > [out] lpBuffer↵> ↵> A pointer to a buffer that receives a series of null-terminated strings, one for each valid drive in the system, plus with an additional null character. Each string is a device name.
15:51:18FromDiscord<Yardanico> In reply to @eyecon "Create meaning `cast()`?": no, use `newWideCString`
15:51:45FromDiscord<Yardanico> In reply to @eyecon "If I understand correctly": well, then you first have to split it into separate strings
15:53:17FromDiscord<eyecon> But then, how do I iterate in any form so that I can detect a double null (wide string termination marker) and cut from there? LPWSTR can't be indexed.
15:53:34FromDiscord<Yardanico> wdym can't be indexed? you can check for the null byte
15:53:48*Stink left #nim (Textual IRC Client: www.textualapp.com)
15:53:53FromDiscord<Yardanico> if you mean the type itself can't be indexed, just case it to `ptr UncheckedArray[int16]`
15:55:37FromDiscord<eyecon> Ah, that's the missing piece, `UncheckedArray`. I always forget that this thing exists, ty
15:56:18FromDiscord<eyecon> I'mma alias this internally to something like `CastDammit`
16:37:03FromDiscord<gibson> How can I discover the os of the compiling computer when cross-compiling? My host is linux, cross compiling to windows. Some of the nimble packages I'm using break because they use DirSep at compile time to get paths to internal c libs and the forward/backward slashing logic is breaking. I'm wondering how to fix it.
16:37:40FromDiscord<gibson> my compile command working for simple nim files is `nim c --cc.linker=gcc-win --cc.linkerexe=gcc-win ...`
16:37:55FromDiscord<gibson> (edit) "my compile command working for simple nim files is `nim c ... --cc.linker=gcc-win" added "--os:windows"
16:38:52FromDiscord<Yardanico> hostOS/hostCPU
16:39:01FromDiscord<gibson> Thanks!
16:39:12FromDiscord<Yardanico> oh sorry maybe that's not the right one, lemme check
16:39:58FromDiscord<gibson> shoot, that is the same as defined(...)
16:40:34FromDiscord<demotomohiro> There are `buildOS`/`buildCPU` in nimscript module: https://nim-lang.org/docs/nimscript.html#buildCPU
16:41:28FromDiscord<demotomohiro> Build it seems there is no corresponding constants in system module.
16:42:18FromDiscord<gibson> okay, I may have to ditch my compiler and install mingw and do what has worked for others in the past.
16:42:20FromDiscord<gibson> Thanks for looking
16:42:23FromDiscord<demotomohiro> system module or other module should have `buildOS`/`buildCPU` and `targetOS`/`targetOS` for cross compilation?
16:53:06NimEventerNew Nimble package! mouse - Mouse interactions in nim, see https://github.com/hiikion/mouse
16:58:40NimEventerNew post on r/nim by mavavilj: Anyone attempted to make Nim serve R's role? How is it currently?, see https://reddit.com/r/nim/comments/uwvfmg/anyone_attempted_to_make_nim_serve_rs_role_how_is/
17:11:24FromDiscord<gibson> sent a code paste, see https://play.nim-lang.org/#ix=3Yw2
17:17:10om3gaHello! So I excluded possible problems that might be caused by nim bindings to C fcgi lib. And found the reason why I got corrupted buffers and request vars
17:18:12om3gasomething happens with locks, they don't work unfortunately. So I wrote small test code https://play.nim-lang.org/#ix=3Yw4
17:18:39om3gawith enabled ThreadSanitizer it reports data race conditions
17:19:58om3gaI used playground just to share the code, please don't run it there :)
17:20:56om3gaWhy that happens, the locks should work, or I'm doing something wrong?
17:22:37om3gaI also tried phread mutex as I usually do in C, ThreadSanitizer reports problems too
17:24:10om3gaHopefully futhark C imports binder helped to exclude other possible issues. Thanks to PMunch
17:36:51NimEventerNew post on r/nim by mavavilj: Any objective references as to how much more productive would Nim be over C++ in similar tasks?, see https://reddit.com/r/nim/comments/uwwasb/any_objective_references_as_to_how_much_more/
17:40:12FromDiscord<Yardanico> In reply to @NimEventer "New Nimble package! mouse": https://github.com/hiikion/mouse/pull/1
17:44:27FromDiscord<huantian> Yard not using if expressions for calc relative? Disappointed
17:44:40FromDiscord<Yardanico> In reply to @huantian "Yard not using if": i wanted to, but didn't do it
17:44:55FromDiscord<Yardanico> thought that they might want to expand it in the future, idk
17:46:25FromDiscord<huantian> Yeah ig
17:49:55FromDiscord<huantian> The best way would probably be to use abs() but no need to completely rewrite the code when it’s already fine
17:50:04FromDiscord<Yardanico> ofc yeah, i'm already rewriting it with abs :)
17:52:49*vicfred quit (Quit: Leaving)
17:53:30FromDiscord<federico3> @Yardanico\: I'm trying to understand what platforms require LibreSSL and why regarding https://github.com/nim-lang/Nim/pull/19814
17:54:14FromDiscord<Yardanico> I understand the complexity, but I fear that some people might see their code become unusable when new Nim versions without support for OpenSSL 1.0 become released.
17:54:29FromDiscord<Yardanico> And a note about LibreSSL was just a side-note, I'm mainly worried about OpenSSL 1.0 itself
17:54:44FromDiscord<Yardanico> LibreSSL's usecase is static linking, it's used for that more than OpenSSL I think
17:55:40FromDiscord<federico3> I added some comments on the related issue. For example Python even removed compatibility \< 1.1.1 (not 1.1.0) because older libraries are vulnerable
17:56:39FromDiscord<federico3> 1.1.0 reached end of life in 2018
17:57:29FromDiscord<Yardanico> ms-dos reached the end of life in the last century, but we still have PRs adding support for it :P
17:57:58om3gawhy you use ms-dos?
17:58:14FromDiscord<Yardanico> i don't, but that person does apparently
17:58:49FromDiscord<Yardanico> but yeah, I'm just saying that as a suggestion, I know that the code can become messier
17:58:57FromDiscord<federico3> @Yardanico\: yes but this is a library used for TLS. Supporting deprecated/weak versions of the protocol family introduces security risks.
18:00:35FromDiscord<federico3> (generally speaking I'm on the side of software longevity, but this is an exception)
18:01:36FromDiscord<Andreas> In reply to @om3ga "why you use ms-dos?": cos" there are still buisness or other app that still work. In the last century we setup multiple ms-dos-boxes running inside linux and there was a multitaskin-dos-clone to some customers. These DOS-apps were out-of-support at the time we made these setups..
18:01:57FromDiscord<Andreas> (edit) "app" => "apps"
18:02:19FromDiscord<Andreas> (edit) "cos"" => "cos'"
18:02:41FromDiscord<Andreas> (edit) "multitaskin-dos-clone" => "multitasking-dos-clone"
18:04:20om3gaAndreas, I can understand if source code of that software is lost. Or developer died suddenly. But why not to re-write, or port old software on modern os?
18:04:33FromDiscord<demotomohiro> I thought people who still writing code for ms-dos are hobbyist and there are no practial reason.
18:07:41om3gamaybe that software was too expensive back then, and to claim and motivate the shareholders to buy upgrade, company should await a little more time
18:08:30om3gaI never got into it...
18:09:16FromDiscord<Generic> my workflow just depends on lotus 1 2 3
18:09:21FromDiscord<Generic> I cannot replace it
18:09:53om3gaLotus! I thought I will never hear that word again :) sorry..
18:10:40FromDiscord<Andreas> In reply to @om3ga "<@754284517316886598>, I can understand": well yes, many reasons why these old-apps prevail - btw did u know that in germany pensions were been calculated on mainframes until 2006 ;). Sometimes its just too expensive or the people actually using the SW say 'no'.
18:10:55FromDiscord<Andreas> (edit) "been" => ""
18:11:12FromDiscord<Generic> I mean this is the sole reason ibm is still around
18:12:04FromDiscord<Andreas> In reply to @Generic "I mean this is": IMHO thats why there should be NIM-bindings to e.g. GNU-Cobol.
18:13:25om3gaAndreas, yes... I cannot argue with that. The same is in US army, and in other municipal automated services. They still use 1980's software
18:13:25FromDiscord<Generic> I didn't knew GNU Cobol was a thing
18:16:33FromDiscord<demotomohiro> But when people create a PR to Nim, most of them cannot test it on msdos. Nim's testaments can be run on ms-dos or dosbox?
18:19:14FromDiscord<Andreas> In reply to @demotomohiro "But when people create": hmm, we recommended dos-boxes in linux, they ran faster and each app had max-memory. One could secure the linux-host well into the server-env (logging, backups etc.).
18:19:21FromDiscord<demotomohiro> Even if Nim merge the PR that add suppprt to msdos, it can break if some PRs get merged that are not tested on msdos.
18:19:53FromDiscord<Andreas> (edit) "etc.)." => "etc.).↵Some if some nim-code works in a Linux-DOS-Box - which is testable - thats good-enough."
18:20:18FromDiscord<Andreas> (edit) "etc.).↵Some if" => "etc.).↵If"
18:21:09FromDiscord<Andreas> (edit) "app" => "DOS-app" | removed ""
18:24:23FromDiscord<demotomohiro> So, cross compiling Nim to ms-dos on Linux and run tests on dosbox.
18:26:49om3gahopefylly I code for linux/mac and work with both for more than 10 yrz
18:27:18FromDiscord<Andreas> In reply to @demotomohiro "So, cross compiling Nim": jepp, test inside DOS-Box in linux. I don't think that you can find network-adapters with drivers so that you can setup a DOS-machine. BTW - does Win 10/11 still have DOS-boxes ?
18:27:54FromDiscord<Andreas> (edit) "In reply to @demotomohiro "So, cross compiling Nim": jepp, test inside DOS-Box in linux. I don't think that you can find network-adapters with drivers so that you can setup a ... DOS-machine." added "networked"
18:28:25om3gaI have old P2
18:29:04om3gathe network interface is 3com, isa. still works
18:29:10FromDiscord<demotomohiro> I ran dosbox on windows 8.1 long time ago.
18:29:32FromDiscord<Andreas> In reply to @om3ga "the network interface is": they did the best stuff - unbreakable
18:30:32om3gayes. High quality stuff.
18:37:30FromDiscord<michaelb.eth> sent a code paste, see https://play.nim-lang.org/#ix=3Ywe
18:38:55*xet7 joined #nim
18:40:41*xet7 quit (Remote host closed the connection)
18:41:47*xet7 joined #nim
18:42:33FromDiscord<treeform> In reply to @federico3 "<@177365113899057152>\: I'm trying to": I looked at nim's SSL stuff back in 2019, and it was very confusing: https://media.discordapp.net/attachments/371759389889003532/978729734714314762/unknown.png
18:42:59FromDiscord<treeform> Nim claims support of versions that never existed and does not support versions that do.
18:43:35FromDiscord<treeform> it supports them in strange order too
18:43:43FromDiscord<treeform> meaning it might load older versions when newer ones are around
18:44:07FromDiscord<treeform> Main reason why I made puppy: https://github.com/treeform/puppy
18:45:42FromDiscord<Yardanico> In reply to @treeform "I looked at nim's": wdym "unclear which version" for libressl?
18:45:48FromDiscord<Yardanico> those are all actual libressl versions
18:45:57FromDiscord<michaelb.eth> there's also nim-bearssl
18:46:02FromDiscord<michaelb.eth> which is what chronos uses
18:46:12FromDiscord<Yardanico> yes, but it doesn't integrate with the stdlib at all
18:46:30FromDiscord<michaelb.eth> fair enough
18:47:30FromDiscord<treeform> In reply to @Yardanico "wdym "unclear which version"": the newer libreSSL have openSSL compatibility versions, but for those ones I did not find it
18:47:55FromDiscord<treeform> libressl v43 is sames as openssl 2.5.3
18:48:18FromDiscord<treeform> but librassl v38 is ???
18:49:28FromDiscord<Yardanico> 2.3.4
18:49:46FromDiscord<Yardanico> but this is libressl version, not openssl version
18:49:48FromDiscord<Yardanico> it's not "the same" really
18:49:54FromDiscord<Yardanico> since libressl forked from openssl back in 2014
18:50:39FromDiscord<treeform> I was going to make a system that downloads the lib nim claims to support and tests it.
18:50:50FromDiscord<treeform> But got bored
18:50:53FromDiscord<Yardanico> why not just use the officially supported openssl libs?
18:50:55FromDiscord<Yardanico> that are shipped in dlls.zip
18:51:07FromDiscord<Yardanico> i mean officially supported by nim
18:51:18FromDiscord<Yardanico> https://nim-lang.org/download/dlls.zip
18:51:22FromDiscord<treeform> why does nim claim support of lib ssl versions we dont?
18:51:33FromDiscord<Yardanico> which ones?
18:51:33FromDiscord<treeform> dlls are not linux so?
18:51:40FromDiscord<treeform> each linux usually ships their own
18:51:54FromDiscord<Yardanico> you can always LD_LIBRARY_PATH and make it use yours
18:52:09FromDiscord<treeform> the problem I had is that I could not make the libpg lib do that
18:52:51FromDiscord<arnetheduck> SSL stuff in nim remains very simple: use https://github.com/status-im/nim-bearssl/ and you have no compatibility issues whatsoever 🙂
18:53:14FromDiscord<Yardanico> In reply to @arnetheduck "SSL stuff in nim": except that then you are forced to use status libraries for IO and network :)
18:53:19FromDiscord<treeform> https://github.com/nim-lang/Nim/pull/11272
18:53:23FromDiscord<treeform> ^ see here
18:54:17FromDiscord<treeform> and my attempt to fix order of loading them:
18:54:17FromDiscord<treeform> https://github.com/nim-lang/Nim/pull/10230
18:54:20FromDiscord<arnetheduck> In reply to @Yardanico "except that then you": well, the path is open for anyone to write a _better_ network layer than the status libs on top of bearssl
18:54:23FromDiscord<treeform> was reverted
18:55:12FromDiscord<treeform> In reply to @arnetheduck "well, the path is": well I kind of already did, just use the OS APIs then your system is up-to-date with certs and other stuff.
18:55:18FromDiscord<Yardanico> In reply to @treeform "was reverted": but didn't alaviss explain the problem
18:56:26FromDiscord<arnetheduck> In reply to @treeform "well I kind of": there's no os api for SSL in general though - openssl is one of many SSL libs out there
18:56:50FromDiscord<treeform> In reply to @arnetheduck "there's no os api": false, each OS gives you its own API.
18:57:01FromDiscord<Yardanico> In reply to @treeform "false, each OS gives": you mean a HTTP specific api, not a generic SSL api
18:57:14FromDiscord<arnetheduck> what is the OS API of my Linux?
18:57:22FromDiscord<treeform> libcurl
18:57:37FromDiscord<treeform> sent a code paste, see https://play.nim-lang.org/#ix=3Ywh
18:59:01FromDiscord<arnetheduck> libcurl is a random library that many linux (and mac) users have installed - what makes that a canonical os API?
18:59:21FromDiscord<treeform> True you can have linux without libcurl
18:59:28FromDiscord<treeform> I would says linux is the most odd one of all the OSes
18:59:43FromDiscord<treeform> but you also usually use it as a server os, so you have way more control
18:59:50FromDiscord<huantian> Linux itself is very modular which allows for a lot of control but also defragmentation
19:00:07FromDiscord<arnetheduck> and curl and firefox on my linux os don't use the same certificate stores in general
19:01:19FromDiscord<arnetheduck> on the opposite end you have the fact that windows/mac api:s tend to not have consistent support for certain ciphers and standards, which indeed is the reason why many applications choose to not use them
19:01:50FromDiscord<treeform> yeah ssl just sucks everywhere
19:02:39FromDiscord<treeform> I think it all steps from the fact that openSSL is very popular and very bad: https://www.reddit.com/r/programming/comments/dcgry/openssl_is_written_by_monkeys/
19:02:39FromDiscord<arnetheduck> that's more accurate - on top, you have the fact that nim shoots from the hip when it comes to loading dll:s / so:s in general, hoping that the ABI hasn't changed even though by definition, different .so versions mean different ABI:s
19:03:56FromDiscord<arnetheduck> well, the combination of openssl being .. tricky and nim having very poor dll support means ... the chances of pursuing solutions in the openssl direction will continue to be littered with issues
19:04:15FromDiscord<treeform> here is working link: https://web.archive.org/web/20201118080948/http://www.peereboom.us/assl/assl/html/openssl.html
19:04:53FromDiscord<treeform> Yeah nim would be better if it adopted bearSSL that guy is super smart.
19:04:55FromDiscord<arnetheduck> bearssl is really a pragmatic choice we made early on, for this reason, and we haven't looked back really - it's _so nice_ to just magically have the `c` files of bearssl be part of the compilation process and not care
19:05:09FromDiscord<treeform> I totally a gree
19:06:52FromDiscord<arnetheduck> in other news, nlvm is now following 1.6.x
19:08:03FromDiscord<treeform> I think the only issues with bearSSL is that it does not use the OS cert stores.
19:08:18FromDiscord<treeform> If you ship your own certs file, it will never update.
19:08:37FromDiscord<arnetheduck> In reply to @treeform "I think the only": yeah, this is .. messy indeed - we might add that support at some point
19:09:24FromDiscord<treeform> if bearSSL had a flag to ship your own certs or use OS ones, it would be 👌
19:10:44FromDiscord<treeform> Also this issue in Nim keeps me puzzled: https://github.com/status-im/nim-bearssl/issues/22
19:11:10FromDiscord<treeform> Why do the C files not cache... no idea.
19:11:15FromDiscord<Yardanico> @arnetheduck is nlvm kind of a hobby to you?
19:11:20FromDiscord<Yardanico> or do you use it for something at status
19:11:44FromDiscord<Yardanico> In reply to @treeform "Why do the C": the cache works for me
19:11:53FromDiscord<arnetheduck> pre-status hobby - don't really have that much time for it any more
19:11:54FromDiscord<Yardanico> in most cases :)
19:12:08FromDiscord<treeform> for some reason some thing in bearssl causes the cache to break
19:13:05FromDiscord<arnetheduck> In reply to @treeform "for some reason some": any `{.compile.}` breaks the same way .. there was at least one bug in nims caching layer we a few months back but there might be more
19:13:20FromDiscord<arnetheduck> (edit) "In reply to @treeform "for some reason some": any `{.compile.}` breaks the same way .. there was at least one bug in nims caching layer we ... a" added "fixed"
19:46:05om3gaWell I checked with the book Nim in Action, and definitely I don't use locks wrong. Is this data race - known issue?
19:46:41om3gaWhy withLock don't works sometimes?
19:46:59om3gaor I should ask this question somewhere else?
19:53:42FromDiscord<dom96> In reply to @treeform "why does nim claim": Best answer to that probably lies in the git blame :)
20:03:46FromDiscord<Andreas> In reply to @om3ga "or I should ask": i added a `sleep(50)` into the worker-loop. Otherwise all core show 100-%. With the `sleep 50` everything stays calm - maybe that help
20:03:51FromDiscord<Andreas> (edit) "help" => "helps"
20:04:03FromDiscord<Andreas> (edit) "core" => "cores"
20:05:07om3gaAndreas, I did that on purpose
20:05:41om3gacompile with -fsanitize=thread enabled
20:09:28FromDiscord<federico3> bearssl is not very popular, and from its website\: "Current version is 0.6. It is now considered beta-quality software"
20:10:42om3gaAndreas, sleep may add randomness and minimize the probability of data race events, but it shouldn't happen
20:11:24FromDiscord<Yardanico> In reply to @om3ga "Well I checked with": I've never heard anyone say that nim locks have data races, but frankly I don't really remember anyone running stuff with -fsanitize=thread
20:11:36FromDiscord<Yardanico> so I don't think most people can help you on this, maybe you can post it on the forum or open an issue in the repo?
20:11:45FromDiscord<Yardanico> there is also the chance that sanitizer itself is wrong
20:11:58FromDiscord<Yardanico> they're not bug-free at all, they get bugfixed every compiler release in both gcc and clang
20:12:24om3gaYardanico, I don't think the TSan will report false errors
20:12:30FromDiscord<Yardanico> why?
20:12:39FromDiscord<Yardanico> it can do that as well as other sanitizers
20:13:09om3gaI see that request counter misses some counts, while httperf sucessfully generated 10 000 requests
20:13:28om3gaand that with disabled thread sanitizer
20:15:03FromDiscord<Yardanico> for example about similar issues - https://github.com/oneapi-src/oneTBB/issues/358#issuecomment-793480036
20:15:13FromDiscord<Yardanico> i'm not saying it's a false positive, I simply don't know
20:15:49FromDiscord<Yardanico> your best bet would be to try (i know it won't be easy) to make a small example to reproduce (by small I mean not being dependent on any third-party libs except the nim stdlib, and even then just the minimal amount of code)
20:17:35FromDiscord<Ayy Lmao> What's the best way to ensure that c headers are included in a certain order?
20:18:05FromDiscord<Yardanico> emit with all the needed headers with INCLUDESECTION
20:18:26FromDiscord<Yardanico> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-emit-pragma
20:18:31FromDiscord<Ayy Lmao> But then do I declare all my FFI functions with nodecl?
20:18:35FromDiscord<Yardanico> no?
20:18:42FromDiscord<Yardanico> you declare them with header as usual
20:18:58FromDiscord<Yardanico> but just doing importc without header should then actually work I think
20:19:15FromDiscord<Ayy Lmao> For whatever reason I'm getting c linker errors saying there are multiple implementations. I'll have to tinker around with it more.
20:19:35FromDiscord<Yardanico> maybe your header doesn't correctly handle the case of being included multiple times?
20:20:42FromDiscord<Ayy Lmao> I was trying to make a header that had all of them included in the right order and use that, but maybe that messes with the include guards.
20:22:26FromDiscord<Ayy Lmao> I'll try just using specific headers with the emit pragma.
20:29:33FromDiscord<sharpcdf> whats the difference between nake and .nims/.nimble files? they look like they do the same thing
20:30:23FromDiscord<Yardanico> nake scripts are compiled as normal nim programs and then run
20:30:31FromDiscord<Yardanico> nims/nimble don't need compilation, they're run by the Nim VM
20:30:40FromDiscord<sharpcdf> ok
20:30:49FromDiscord<sharpcdf> but then why would people use nake instead of nimscript?
20:30:55FromDiscord<Yardanico> nake has the advantage of having access to all of the stdlib (even native FFI), and being faster
20:31:01FromDiscord<sharpcdf> ohhh
20:31:03om3gaYardanico, https://play.nim-lang.org/#ix=3Ywu
20:31:05FromDiscord<sharpcdf> makes sense
20:31:06FromDiscord<Yardanico> In reply to @sharpcdf "but then why would": i think really the only projects that use nake use it because they're quite old
20:31:12om3gahere is small example
20:31:27FromDiscord<Yardanico> @sharpcdf what's the project in question?
20:31:33om3gaI doubt that I can do more simplier than this
20:31:46FromDiscord<Yardanico> In reply to @om3ga "I doubt that I": thanks, i'll look into it
20:34:47om3gamaybe definitely better to open issue in the github? Only in case if you confirm the issue of course
20:36:08FromDiscord<Yardanico> you can just open it for now so it's there
20:47:50FromDiscord<sharpcdf> In reply to @Yardanico "<@459463405636419594> what's the project": im talking about in general
20:47:57FromDiscord<sharpcdf> no specific project
20:48:01FromDiscord<Yardanico> in general nake isn't really used anymore
20:48:14FromDiscord<sharpcdf> 👍
21:58:44FromDiscord<Professor Actual Factual> I currently have a nim program that calls on a C-based lib using a dylib. Is there a way to compile my nim program so that the nim program is standalone (e.g. run without the dylib present on the computer or different computer of same os and cpu). I tried `--passL:'-static' but that didn't seem to work
22:01:38FromDiscord<Elegantbeef> You need the static library
22:01:58FromDiscord<Elegantbeef> If you have the static library you can use `dynlibOverride`
22:02:16FromDiscord<Elegantbeef> https://nim-lang.org/docs/nimc.html#dynliboverride
22:03:02FromDiscord<Professor Actual Factual> In reply to @Elegantbeef "https://nim-lang.org/docs/nimc.html#dynliboverride": Thank you for the quick response 🙂
22:11:04*jjido joined #nim
22:15:22*vicfred joined #nim
22:22:49*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
22:37:49*vicfred quit (Quit: Leaving)
23:04:34NimEventerNew post on r/nim by momoPFL01: grammar spec help, see https://reddit.com/r/nim/comments/ux3jgb/grammar_spec_help/
23:14:39FromDiscord<sharpcdf> is there a way to make a static import of sorts where you have to use the syntax `module.function()`?
23:15:19FromDiscord<Elegantbeef> `import module as nil`
23:15:50FromDiscord<Elegantbeef> It ruins the method call syntax so try not to ruin people's day 😄
23:27:23FromDiscord<sharpcdf> In reply to @Elegantbeef "`import module as nil`": doesnt that just mean you dont do `module.function()`?
23:27:30FromDiscord<sharpcdf> i want to know the opposite
23:27:52FromDiscord<Elegantbeef> what
23:27:59FromDiscord<Elegantbeef> `import module as nil` requires using `module.name`
23:28:34FromDiscord<sharpcdf> oh ok
23:28:44FromDiscord<sharpcdf> it looks like it would do the opposite
23:38:51*arkurious quit (Quit: Leaving)
23:41:20FromDiscord<Alea> what are the compiler flags for a maximum speed optimization?
23:41:31FromDiscord<ynfle> -d:danger
23:41:47FromDiscord<Alea> I also recall people mentioning something like -d:lto or something
23:41:53FromDiscord<ynfle> Ya
23:41:59FromDiscord<ynfle> Doesn't work on macos
23:42:12FromDiscord<ynfle> I think you need `--passL:-flto`
23:43:23FromDiscord<Alea> Does -d:etc. only affect stdlib or your code too? The wiki isn't entirely clear
23:43:34FromDiscord<ynfle> What do you mean?
23:43:41FromDiscord<ynfle> It affects the optimizations of the compiler
23:44:46FromDiscord<Alea> Wiki said "The standard library supports a growing number of useX conditional defines" for that section, so I wasn't sure
23:44:58FromDiscord<ynfle> They are custom
23:45:16FromDiscord<ynfle> You own code can use `-d:useMyCustomFeature`
23:45:24FromDiscord<ynfle> They are just regular nim cod
23:45:25FromDiscord<ynfle> (edit) "cod" => "code"
23:54:51FromDiscord<exelotl> is there a way to do `a = move(b)` where I _know_ that `a` is uninitialized so `=destroy` doesn't need to be called on it?
23:59:11FromDiscord<Elegantbeef> I dont think so