00:47:15 | FromDiscord | <!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:38 | FromDiscord | <Zectbumo> is there something built in or easy way to convert array[byte] to string? |
02:09:52 | FromDiscord | <Zectbumo> or even array[char] |
02:11:26 | FromDiscord | <Zectbumo> oh maybe I can use a union struct. I haven't looked into those |
02:11:50 | FromDiscord | <Elegantbeef> !eval import std/strbasics; echo (var a = ""; a.add cast[array[3, char]](['a', 'b', 'c']); a) |
02:11:50 | FromDiscord | <Elegantbeef> 😄 |
02:11:52 | NimBot | abc |
02:12:33 | FromDiscord | <Rika> What the fuck when did we get this module |
02:12:39 | FromDiscord | <Zectbumo> neat |
02:12:49 | FromDiscord | <Elegantbeef> No idea but it's fasssst |
02:28:33 | FromDiscord | <ambient> is it possible to compile native arm64 binaries with Nim on Apple M1 or am I just doing it wrong? |
02:29:15 | FromDiscord | <Elegantbeef> Given that it generates C code i'd imagine so |
02:29:45 | FromDiscord | <ambient> how do i see what compile flags nim uses to compile the C file? |
02:29:47 | FromDiscord | <Rika> Should be able to |
02:29:57 | FromDiscord | <Rika> Turn verbosity up? |
02:30:05 | FromDiscord | <Elegantbeef> `--listCmd` iirc |
02:31:03 | FromDiscord | <Elegantbeef> Assuming you used choosenim i think it ships a x86 binary, so you may have a hiccup there |
02:31:25 | FromDiscord | <ambient> i already compiled it, nim -v shows arm64, and arch in console also shows arm64 |
02:31:32 | FromDiscord | <Elegantbeef> Ah ok |
02:31:49 | FromDiscord | <Elegantbeef> The compiled binary then should be arm but idk |
02:35:10 | FromDiscord | <ambient> i had to put "-arch arm64" into both compile and link flags with --passC --passL |
02:35:18 | FromDiscord | <ambient> so now it compiles as arm64 |
02:36:57 | FromDiscord | <ambient> got only 10% boost. rosetta is really good |
02:37:32 | FromDiscord | <Rika> Were you using clang |
02:37:38 | FromDiscord | <ambient> yes |
02:37:47 | FromDiscord | <ambient> the one that comes with xcode |
02:37:58 | FromDiscord | <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:13 | FromDiscord | <huantian> In reply to @Rika "What the fuck when": There’s so many random modules lmao |
03:17:32 | FromDiscord | <Elegantbeef> strbasic isnt that random 😄 |
03:37:46 | FromDiscord | <j-james> how can i create a reference to an arbitrary variable? |
03:42:34 | FromDiscord | <Rika> You copy it then stop using the old variable |
03:49:15 | FromDiscord | <j-james> is there no way to use it by reference because it's a primitive type? |
03:49:48 | FromDiscord | <j-james> oh, in my example the arbitrary variable was a string |
03:51:20 | FromDiscord | <j-james> (edit) "example" => "head" |
03:57:59 | FromDiscord | <Rika> Strings have value semantics |
03:58:03 | FromDiscord | <Rika> Copy is still required |
03:58:30 | FromDiscord | <j-james> do all primitive types have value semantics? |
03:58:39 | FromDiscord | <Rika> As far as I recall yes |
03:58:43 | FromDiscord | <Rika> This includes sequences |
03:59:39 | FromDiscord | <j-james> i see, thanks |
04:00:11 | FromDiscord | <j-james> and then if you wanted to move by reference it'd have to be for a `type name = ref object`? |
04:00:34 | FromDiscord | <Rika> Usually yes |
04:17:52 | FromDiscord | <j-james> sent a code paste, see https://play.nim-lang.org/#ix=3YtG |
04:19:27 | FromDiscord | <Elegantbeef> reference semantics |
04:20:30 | FromDiscord | <Elegantbeef> `a = b` makes `a` point to `b`'s data, which is like `a = b` with values |
04:21:02 | FromDiscord | <Elegantbeef> The same happens without references |
04:21:17 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3YtI |
04:28:27 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=3YtK |
04:30:41 | FromDiscord | <j-james> hmm okay, so it's the compiler being smart? |
04:31:26 | FromDiscord | <j-james> i'm trying to understand how refs work by comparing them to rust's ownership |
04:31:44 | FromDiscord | <Elegantbeef> No references aren ownership |
04:31:45 | FromDiscord | <Elegantbeef> arent |
04:31:56 | FromDiscord | <Elegantbeef> References are heap allocated gc'd types |
04:32:50 | FromDiscord | <demotomohiro> Mutiple references can refers one object on heap and they are managed by Nim's Memory Management. |
04:32:51 | FromDiscord | <huantian> if b went out of scope and was immediately destroyed, the memory a now points to is gone |
04:33:31 | FromDiscord | <huantian> I think it's a tad bit like rust Rc<T>? |
04:33:32 | FromDiscord | <huantian> iirc |
04:35:01 | FromDiscord | <j-james> how are those managed with arc? |
04:36:11 | FromDiscord | <Elegantbeef> Scoped based destructors and a reference counter |
04:36:20 | FromDiscord | <huantian> statically added to the code |
04:36:51 | FromDiscord | <demotomohiro> https://nim-lang.org/docs/mm.html |
04:39:16 | FromDiscord | <j-james> ah, i see |
04:39:27 | FromDiscord | <j-james> so then the reference counter prevents double free errors |
04:40:24 | FromDiscord | <Rika> ~~yeah that’s the point of a GC~~ |
04:40:53 | FromDiscord | <j-james> yeah i was caught up by rust's model being strict where it doesn't need to be |
04:41:25 | FromDiscord | <Elegantbeef> Well rust mostly borrows and doesnt allow some of the relationships Nim's ref does |
04:42:25 | FromDiscord | <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:44 | FromDiscord | <Elegantbeef> And with arc/orc this is done somewhat deterministically |
04:43:03 | FromDiscord | <Elegantbeef> arc is deterministic orc's cycle breaker is not |
04:43:16 | FromDiscord | <huantian> just leak the cycles it's fine |
04:43:26 | FromDiscord | <Elegantbeef> We cant all be V |
04:44:26 | FromDiscord | <j-james> yet rust's borrow checker doesn't handle cycles either, right |
04:44:37 | FromDiscord | <Elegantbeef> Nope borrows cannot be cyclical |
04:44:49 | * | noeontheend joined #nim |
04:44:54 | FromDiscord | <j-james> so what's the point of the extra strictness in borrowing 🤷 |
04:45:02 | FromDiscord | <j-james> i suppose it makes good practice |
04:45:10 | FromDiscord | <huantian> i'd assume performance too? |
04:45:25 | FromDiscord | <huantian> but I don't use rust so I don't know what you mean by "extra strictness" |
04:45:27 | FromDiscord | <Elegantbeef> memory reuse and program safety |
04:46:12 | FromDiscord | <Elegantbeef> Well memory reuse gives performance 😄 |
04:46:36 | FromDiscord | <Elegantbeef> The strictness is to ensure the lifetime of the references and ensuring no memory leaks or dangling pointers |
04:47:12 | FromDiscord | <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:55 | FromDiscord | <j-james> (edit) removed "go out of scope or" |
04:48:20 | FromDiscord | <Elegantbeef> Well Nim's move semantics work differently |
04:48:35 | FromDiscord | <Elegantbeef> If you the flow of the program forces a copy a move is a copy instead |
04:48:55 | FromDiscord | <j-james> oh even for a ref object? |
04:49:22 | FromDiscord | <Elegantbeef> Eh refs arent really moved much 😄 |
04:49:31 | FromDiscord | <huantian> you just point at it from different places |
04:49:39 | FromDiscord | <j-james> oh true lol |
04:51:07 | FromDiscord | <j-james> In reply to @Elegantbeef "memory reuse and program": how does borrowing use less memory than reference counting? |
04:51:25 | FromDiscord | <Elegantbeef> Borrowing lets you safely reuse memory |
04:51:39 | * | noeontheend quit (Ping timeout: 258 seconds) |
04:52:18 | FromDiscord | <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:21 | FromDiscord | <demotomohiro> Borrowing doesn't use counter like reference counting |
04:52:38 | FromDiscord | <Elegantbeef> Borrowing is a static anaylsis |
04:53:19 | FromDiscord | <huantian> as opposed to a reference counter which counts refs at runtime |
04:53:42 | FromDiscord | <Elegantbeef> Yep two different things |
04:54:12 | FromDiscord | <Elegantbeef> Rust's strictness is due to their borrowing not due to a RAII like system |
04:56:58 | FromDiscord | <j-james> hmm, i was under the impression that nim's reference counting was done at compile time |
04:57:08 | FromDiscord | <j-james> and that's why it injects destructors |
04:57:22 | FromDiscord | <j-james> why does it need to be done at runtime? |
04:58:18 | FromDiscord | <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:27 | FromDiscord | <Rika> If it escapes it cannot do anything about it |
05:00:43 | FromDiscord | <j-james> how does a variable escape a scope? |
05:00:59 | FromDiscord | <j-james> (edit) "how does a variable escape a scope? ... " added "when it's a `var` parameter?" |
05:01:51 | FromDiscord | <huantian> In reply to @j-james "another question: what is": well sometimes it definitely won't, but this is an example |
05:02:02 | FromDiscord | <huantian> you assign b to something outside of its scope |
05:03:07 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=3YtQ |
05:04:24 | FromDiscord | <huantian> sent a code paste, see https://paste.rs/lag |
05:04:40 | FromDiscord | <Elegantbeef> That's not borrowing as much as move semantics |
05:05:22 | FromDiscord | <huantian> yeah true |
05:05:31 | FromDiscord | <j-james> In reply to @Rika "If it escapes it": in that case, what makes arc deterministic for everything but cycles |
05:05:36 | FromDiscord | <Elegantbeef> View types is Nim's borrow |
05:05:48 | FromDiscord | <Elegantbeef> Arc doesnt have a cycle collector it just leaks them |
05:08:06 | FromDiscord | <j-james> sent a code paste, see https://paste.rs/zE6 |
05:09:48 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3YtS |
05:10:08 | FromDiscord | <demotomohiro> I think arc stays deterministic if `runtimeProc()` and `runtimeProc2()` are deterministic. |
05:10:18 | FromDiscord | <Elegantbeef> It's always deterministic |
05:10:24 | FromDiscord | <Elegantbeef> The garbage collection procedures are placed deterministically |
05:11:05 | FromDiscord | <Rika> Reference counting is deterministic in when the object is deallocated |
05:13:02 | FromDiscord | <j-james> but not deterministic in if the object is deallocated? |
05:13:06 | FromDiscord | <j-james> okay, that makes sense |
05:13:34 | FromDiscord | <j-james> i had the idea that destructors would absolutely deallocate the object no matter what for some reason |
05:13:56 | FromDiscord | <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:09 | FromDiscord | <Rika> But once the reference count hits 0 it is getting deallocated |
05:16:16 | FromDiscord | <j-james> sent a code paste, see https://play.nim-lang.org/#ix=3YtT |
05:16:19 | FromDiscord | <Rika> Indeed |
05:16:26 | FromDiscord | <Elegantbeef> Yes if an object references itself internally |
05:19:07 | FromDiscord | <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:34 | FromDiscord | <Elegantbeef> I mean it's called inside the object destructor |
05:19:58 | FromDiscord | <Elegantbeef> Destructors check if references are `nil` and if they have reference count of \> 0 then deallocate afaik |
05:21:54 | FromDiscord | <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:03 | FromDiscord | <huantian> Right so not necessarily given the same code, but the same input as well |
05:28:19 | FromDiscord | <Rika> Input, code, potentially environment as well |
05:28:40 | FromDiscord | <Rika> Usually doesn’t matter though, the environment |
05:31:26 | FromDiscord | <j-james> so now if deallocations are guarenteed to happen at the same point with arc: what benefits do move semantics give? |
05:31:32 | FromDiscord | <j-james> earlier deallocations? |
05:32:11 | FromDiscord | <Zectbumo> if I have `args: varargs[auto]` how do I get the inside type without subscripting like `args[0].type` |
05:32:24 | FromDiscord | <Elegantbeef> you have to subscript it |
05:32:27 | FromDiscord | <Elegantbeef> use a generic |
05:32:41 | FromDiscord | <Zectbumo> time to learn about generics. I've been waiting for this day |
05:33:37 | FromDiscord | <Elegantbeef> I mean it's the same thing as auto |
05:33:38 | FromDiscord | <Elegantbeef> you just explicitly state what part is auto |
05:35:40 | FromDiscord | <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:09 | FromDiscord | <Elegantbeef> This is especially important for `seq`, `string` |
05:36:14 | FromDiscord | <Zectbumo> In reply to @Elegantbeef "I mean it's the": oh, that sped up my learning 1000%. thanks. I get it now |
05:37:06 | FromDiscord | <Elegantbeef> I was going to give an example but i'm busy |
05:37:12 | FromDiscord | <Elegantbeef> So i'll take sarcasm into account |
05:37:50 | FromDiscord | <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:14 | FromDiscord | <Elegantbeef> Oh shit that wasnt sarcasm 😄 |
05:38:25 | FromDiscord | <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:22 | FromDiscord | <Elegantbeef> The compiler can do sink inference so uhhh sometime |
05:40:52 | FromDiscord | <huantian> Sink inference is still “experimental” iirc but like half of the language is so who knows |
05:40:55 | FromDiscord | <Zectbumo> sent a code paste, see https://paste.rs/HDm |
05:41:45 | FromDiscord | <Yardanico> In reply to @Elegantbeef "The compiler can do": sink inference is disabled for user code by default |
05:41:54 | FromDiscord | <Yardanico> since it breaks closure proc types |
05:42:07 | FromDiscord | <Yardanico> it is enabled for the stdlib though (at least parts of it) |
05:42:16 | FromDiscord | <Yardanico> and you can enable it for your code with `--sinkInference:off` |
05:42:19 | FromDiscord | <Yardanico> (edit) "`--sinkInference:off`" => "`--sinkInference:on`" |
05:48:40 | FromDiscord | <Elegantbeef> Sooo uhhh anyone want to redesign my GUI API for me thanks... 😄 |
05:49:40 | FromDiscord | <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:13 | FromDiscord | <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:17 | FromDiscord | <Zectbumo> In reply to @Elegantbeef "Sooo uhhh anyone want": do we have something like XCode has with some visual editor? |
05:53:42 | FromDiscord | <Elegantbeef> No clue i prefer it in code |
05:53:50 | FromDiscord | <Elegantbeef> I'm talking about game gui anyway 😄 |
05:53:57 | FromDiscord | <Zectbumo> ah, custom |
05:54:15 | FromDiscord | <Zectbumo> send the screenshot |
05:54:26 | FromDiscord | <huantian> In reply to @Elegantbeef "Nim copies when it": Huh interesting |
05:54:33 | FromDiscord | <Elegantbeef> You get video |
05:54:35 | FromDiscord | <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:06 | FromDiscord | <Zectbumo> nice and responsive |
05:55:34 | FromDiscord | <Elegantbeef> That's of course just a placeholder nineslice image |
05:55:54 | FromDiscord | <huantian> “This does not even fit”↵Fits |
05:56:14 | FromDiscord | <Elegantbeef> I quite like how it looks in the actual project |
05:56:15 | FromDiscord | <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:23 | FromDiscord | <Bung> In reply to @Zectbumo "do we have something": https://github.com/nim-lang/Nim/wiki/Editor-Support check nim wiki first |
05:57:45 | FromDiscord | <Zectbumo> lol, after the video stopped my eyes were in a trans and the waves were still moving |
05:59:17 | FromDiscord | <Zectbumo> @Bung thanks, that's quite a list. I was thinking more along the lines of editor for GUI manipulations |
05:59:26 | FromDiscord | <huantian> Huh I wonder how’s clion’s extension’s sematic highlighting |
06:01:21 | FromDiscord | <Zectbumo> I think I messed up in saying "XCode" when I meant Interface Builder (I just looked it up) |
06:02:15 | FromDiscord | <huantian> Are you sure you don’t want a proprietary closed ecosystem ide made by apple but for Nim? |
06:02:39 | FromDiscord | <Zectbumo> 😄 yes, ehrm, no |
06:03:14 | FromDiscord | <Zectbumo> I've seen an open source version of interface builder. I'll see if I can find it |
06:03:53 | FromDiscord | <huantian> I haven’t used this tool so unfortunately I have nothing useful to add to this convo |
06:04:58 | FromDiscord | <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:18 | FromDiscord | <Zectbumo> ah well, it's nice to dream |
06:05:51 | FromDiscord | <huantian> I think I’m just dreaming of more editor tooling in general lol |
06:08:58 | FromDiscord | <Zectbumo> it would be cool to do a little demo but I would need to know how hotpatching works in nim |
06:18:55 | FromDiscord | <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:52 | FromDiscord | <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:59 | FromDiscord | <Zectbumo> sent a code paste, see https://play.nim-lang.org/#ix=3Yub |
07:41:12 | FromDiscord | <Rika> What the heck is that T J stuff lol |
07:41:22 | FromDiscord | <Rika> Something up with how you copied your code |
07:42:48 | FromDiscord | <Bung> I use vscode most of time , so moe is fast enough for me : ) |
07:53:03 | PMunch | @Rika, probably just copied something directly from a terminal :P |
07:53:18 | FromDiscord | <Yardanico> okay, so a question |
07:53:34 | FromDiscord | <Elegantbeef> No answers here |
07:53:48 | FromDiscord | <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:54 | FromDiscord | <Yardanico> (edit) "it calls parses" => "itparses" |
07:54:16 | PMunch | I mean you could specify it at runtime |
07:54:22 | FromDiscord | <Yardanico> could you? |
07:54:29 | FromDiscord | <Yardanico> strformat formatting string is compile time only |
07:54:37 | PMunch | Oh |
07:54:43 | FromDiscord | <Yardanico> you can't pass a formatting string to strformat at runtime (i mean & and fmt) |
07:55:00 | FromDiscord | <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:03 | PMunch | Hmm, strformatImpl seems to be compile-time |
07:56:17 | FromDiscord | <Yardanico> yes, but the macro transforms the expression into calls to `add` and `formatValue` |
07:56:34 | FromDiscord | <Yardanico> and it gives the specifier for the value as an argument for `formatValue` which is a runtime value |
07:56:46 | FromDiscord | <Yardanico> and it's parsed at the runtime with `let spec = parseparseStandardFormatSpecifier(specifier)` |
07:56:47 | FromDiscord | <Elegantbeef> Well the add is fine |
07:56:50 | FromDiscord | <Yardanico> yes add is fine |
07:56:56 | FromDiscord | <Yardanico> since it preallocates the string |
07:57:02 | PMunch | Aaah I see what you mean |
07:57:18 | PMunch | Yeah that's dumb.. |
07:57:24 | FromDiscord | <Yardanico> just seems like a weird oversight |
07:57:38 | FromDiscord | <Yardanico> it should just be done in the macro itself i think |
07:57:59 | FromDiscord | <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:11 | PMunch | Yeah, 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:18 | FromDiscord | <Yardanico> (it'll lead to code bloat since formatValue will be copied for each different specifier) |
07:58:55 | PMunch | Sure, but you'd sort of be doing that anyways by putting it in the macro |
07:59:24 | PMunch | Oh wait, if it's a string it might be a problem |
07:59:35 | PMunch | Well, you would copy that code anyways |
08:02:50 | FromDiscord | <Yardanico> seems like it's been that way since the start - https://github.com/nim-lang/Nim/commit/26198e4ee74807d7ac24df0e1266ab3280413f8a |
08:05:26 | PMunch | How 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:59 | FromDiscord | <Yardanico> ill open an issue so at least I don't forget about it :) |
08:14:02 | FromDiscord | <my mom said,> In reply to @Elegantbeef "simplescreenrecorder-2022-05-21\_19.23.42.mp4 [simp": what is this made in? |
08:14:07 | FromDiscord | <my mom said,> nico? |
08:16:07 | FromDiscord | <Yardanico> In reply to @uncle jim "nico?": his own engine |
08:16:14 | FromDiscord | <Yardanico> https://github.com/beef331/truss3d/ |
08:16:15 | FromDiscord | <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:31 | FromDiscord | <Yardanico> @PMunch feel free to comment in https://github.com/nim-lang/Nim/issues/19823 |
08:27:58 | FromDiscord | <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:07 | FromDiscord | <Yardanico> not compile time, because specifiers are parsed at runtime as we figured :P |
08:28:34 | FromDiscord | <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:34 | PMunch | Yeah that's definitely not great |
08:29:49 | PMunch | Not sure what more I could add to that issue, but I gave it a thumbs up :) |
08:32:26 | FromDiscord | <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:55 | FromDiscord | <Yardanico> ah, not really |
08:33:11 | FromDiscord | <Yardanico> maybe for some rare cases only |
08:37:59 | PMunch | It could provide better logic for calculating the length though |
09:09:07 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3Yul |
09:09:59 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3Yum |
09:11:08 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3Yun |
09:15:00 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Yuo |
09:15:05 | FromDiscord | <Elegantbeef> You cannot put params there as it doesnt know it's supposed to be a field |
09:17:29 | FromDiscord | <jmgomez> amazing |
09:17:33 | FromDiscord | <jmgomez> thanks! |
09:17:48 | FromDiscord | <jmgomez> how would you approach the &? any hints on that? |
09:24:44 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Yuq |
09:26:01 | * | haliucinas joined #nim |
09:28:41 | FromDiscord | <jmgomez> crazy stuff, thank you! |
09:36:39 | FromDiscord | <Zectbumo> how do you run runnableExamples on a single proc? |
09:37:06 | FromDiscord | <Elegantbeef> You cannot afaik you docgen the entire file |
09:43:20 | FromDiscord | <qb> Does someone have experience with nimpy and performance optimizations? Any recommend compile flags? Recommend gc? |
09:43:33 | madprops | cubey |
10:05:03 | FromDiscord | <geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3Yuv |
10:08:01 | FromDiscord | <my mom said,> Guys can someone explain me how shells(eg: pwsh, fish, bash) work? |
10:08:08 | FromDiscord | <geekrelief> sent a code paste, see https://paste.rs/cF7 |
10:08:59 | PMunch | my_mom_said,, what do you mean how they work? |
10:09:11 | FromDiscord | <Yardanico> In reply to @uncle jim "Guys can someone explain": as I've said last time, please ask such questions in #offtopic |
10:10:23 | PMunch | Yardanico, eh as long as no one actually needs help here it's fine |
10:10:42 | PMunch | But I see @geekrelief might be asking something (I can only see paste links on IRC) |
10:11:38 | FromDiscord | <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:42 | FromDiscord | <geekrelief> it seems like typing this out "normally" wouldn't be possible, but in a macro `newStmtList` creates an expression? |
10:13:28 | FromDiscord | <geekrelief> (edit) "an expression?" => "a block?" |
10:13:34 | PMunch | It's almost like a block |
10:13:47 | FromDiscord | <geekrelief> yeah I tried {.inject.} on the variable |
10:13:56 | FromDiscord | <geekrelief> and printing it works! |
10:13:57 | FromDiscord | <geekrelief> wow! |
10:16:58 | FromDiscord | <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:58 | FromDiscord | <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:56 | FromDiscord | <Yardanico> i don't know how to actually implement the 2nd (which algo), but yes, it's possible |
10:36:54 | FromDiscord | <Rika> What’s a bit slice of a hash? A hash where the bits are masked and shifted appropriately? |
10:39:12 | FromDiscord | <Andreas> sent a code paste, see https://paste.rs/IM7 |
10:40:00 | FromDiscord | <Rika> Do you know of this https://nim-lang.org/docs/bitops.html#bitsliced%2CT%2CSlice%5Bint%5D |
10:40:03 | FromDiscord | <Rika> Just making sure |
10:40:18 | FromDiscord | <Rika> Oh you did say it |
10:40:21 | FromDiscord | <Rika> I missed it somehow |
10:40:46 | FromDiscord | <Rika> What is that of size part? |
10:41:38 | FromDiscord | <Rika> I’m still unsure what this does, I think it would be better if someone who understands it could help |
10:42:30 | FromDiscord | <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:47 | FromDiscord | <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:21 | FromDiscord | <Zectbumo> @Yardanico sorry, am I only to make changes on one repository for one PR? |
11:51:35 | FromDiscord | <Yardanico> you can have different branches for different PRs |
11:51:44 | FromDiscord | <Yardanico> in your fork repo |
11:51:47 | FromDiscord | <Zectbumo> okay so I need to create a branch for every PR |
11:51:51 | FromDiscord | <Yardanico> yes |
11:51:54 | FromDiscord | <Zectbumo> got it |
11:52:34 | FromDiscord | <Zectbumo> I will do that moving forward |
11:52:55 | FromDiscord | <Yardanico> well, you have to do it for your current PR as well, because currently it has two different unrelated changes |
11:53:01 | FromDiscord | <Yardanico> usually PRs like that don't get merged :P |
11:53:20 | FromDiscord | <Zectbumo> ah, they have two commits. one for each. that doesn't count? |
11:54:38 | FromDiscord | <Zectbumo> it's fine. I'll separate them tomorrow (I just jammed it all up like 30 min ago too) |
11:55:07 | FromDiscord | <Zectbumo> or maybe I can rollback that latest commit... |
12:00:56 | FromDiscord | <Zectbumo> In reply to @Yardanico "well, you have to": fixed, I reversed the last commit |
12:10:05 | FromDiscord | <Yardanico> @Zectbumo your separator fix issue still has the posix thing |
12:10:09 | FromDiscord | <Yardanico> (edit) "issue" => "pr" |
12:10:44 | FromDiscord | <Zectbumo> 🤦 |
12:13:34 | FromDiscord | <Zectbumo> In reply to @Yardanico "<@157415492812800000> your separator fix": okay I think I uncrossed the wires now 🤞 |
12:15:36 | FromDiscord | <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:23 | FromDiscord | <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:12 | FromDiscord | <d4rckh> what's the best way of enumerating all portable drives connected to the computer? |
13:55:42 | * | PMunch quit (Quit: Leaving) |
13:59:52 | FromDiscord | <d4rckh> or at least the drives |
14:18:30 | FromDiscord | <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:56 | NimEventer | New 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:09 | FromDiscord | <jmgomez> Is there a way to alter the order of macro resolution? |
14:42:54 | FromDiscord | <d4rckh> hm, how would i parse a dword bitmask? |
14:43:48 | FromDiscord | <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:29 | FromDiscord | <d4rckh> okay, turns out i cant compare a char to a string in nim? |
15:08:32 | FromDiscord | <d4rckh> how would i do that? |
15:08:50 | FromDiscord | <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:58 | FromDiscord | <Yardanico> or to check if the first char of the string is the same as that char? |
15:09:08 | FromDiscord | <Yardanico> if the former, mystring == $mychar |
15:09:12 | FromDiscord | <d4rckh> just `if myChar == "X"` |
15:09:20 | FromDiscord | <Yardanico> `if myChar == 'X'` |
15:09:24 | FromDiscord | <Yardanico> chars are single-quoted |
15:09:34 | FromDiscord | <d4rckh> ah, thanks |
15:09:42 | FromDiscord | <Yardanico> and if you have multiple if branches, it's better to use the case statement |
15:09:56 | FromDiscord | <d4rckh> nah, i only need an if else |
15:10:05 | FromDiscord | <d4rckh> its 2 cases |
15:10:24 | FromDiscord | <d4rckh> thanks for the suggestion |
15:18:46 | FromDiscord | <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:05 | FromDiscord | <d4rckh> (edit) "`$cast[WideCString](myString)`?" => "`cast[WideCString](myString)`?" |
15:20:03 | FromDiscord | <d4rckh> nvm |
15:20:07 | FromDiscord | <d4rckh> i didnt need to do that at all |
15:34:58 | rockcavera | cast don't "convert" |
15:35:02 | rockcavera | see this https://nim-lang.org/docs/widestrs.html |
15:43:55 | FromDiscord | <eyecon> How can I iterate the characters of a buffer of `LPWSTR`, like `GetLogicalDriveStringsW` Win32 API function fills with null-terminated strings? |
15:44:18 | FromDiscord | <eyecon> Reference: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getlogicaldrivestringsw |
15:46:50 | FromDiscord | <Yardanico> create a WideCString out of it and iterate over that |
15:48:02 | FromDiscord | <eyecon> Create meaning `cast()`? |
15:49:06 | FromDiscord | <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:03 | FromDiscord | <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:18 | FromDiscord | <Yardanico> In reply to @eyecon "Create meaning `cast()`?": no, use `newWideCString` |
15:51:45 | FromDiscord | <Yardanico> In reply to @eyecon "If I understand correctly": well, then you first have to split it into separate strings |
15:53:17 | FromDiscord | <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:34 | FromDiscord | <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:53 | FromDiscord | <Yardanico> if you mean the type itself can't be indexed, just case it to `ptr UncheckedArray[int16]` |
15:55:37 | FromDiscord | <eyecon> Ah, that's the missing piece, `UncheckedArray`. I always forget that this thing exists, ty |
15:56:18 | FromDiscord | <eyecon> I'mma alias this internally to something like `CastDammit` |
16:37:03 | FromDiscord | <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:40 | FromDiscord | <gibson> my compile command working for simple nim files is `nim c --cc.linker=gcc-win --cc.linkerexe=gcc-win ...` |
16:37:55 | FromDiscord | <gibson> (edit) "my compile command working for simple nim files is `nim c ... --cc.linker=gcc-win" added "--os:windows" |
16:38:52 | FromDiscord | <Yardanico> hostOS/hostCPU |
16:39:01 | FromDiscord | <gibson> Thanks! |
16:39:12 | FromDiscord | <Yardanico> oh sorry maybe that's not the right one, lemme check |
16:39:58 | FromDiscord | <gibson> shoot, that is the same as defined(...) |
16:40:34 | FromDiscord | <demotomohiro> There are `buildOS`/`buildCPU` in nimscript module: https://nim-lang.org/docs/nimscript.html#buildCPU |
16:41:28 | FromDiscord | <demotomohiro> Build it seems there is no corresponding constants in system module. |
16:42:18 | FromDiscord | <gibson> okay, I may have to ditch my compiler and install mingw and do what has worked for others in the past. |
16:42:20 | FromDiscord | <gibson> Thanks for looking |
16:42:23 | FromDiscord | <demotomohiro> system module or other module should have `buildOS`/`buildCPU` and `targetOS`/`targetOS` for cross compilation? |
16:53:06 | NimEventer | New Nimble package! mouse - Mouse interactions in nim, see https://github.com/hiikion/mouse |
16:58:40 | NimEventer | New 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:24 | FromDiscord | <gibson> sent a code paste, see https://play.nim-lang.org/#ix=3Yw2 |
17:17:10 | om3ga | Hello! 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:12 | om3ga | something happens with locks, they don't work unfortunately. So I wrote small test code https://play.nim-lang.org/#ix=3Yw4 |
17:18:39 | om3ga | with enabled ThreadSanitizer it reports data race conditions |
17:19:58 | om3ga | I used playground just to share the code, please don't run it there :) |
17:20:56 | om3ga | Why that happens, the locks should work, or I'm doing something wrong? |
17:22:37 | om3ga | I also tried phread mutex as I usually do in C, ThreadSanitizer reports problems too |
17:24:10 | om3ga | Hopefully futhark C imports binder helped to exclude other possible issues. Thanks to PMunch |
17:36:51 | NimEventer | New 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:12 | FromDiscord | <Yardanico> In reply to @NimEventer "New Nimble package! mouse": https://github.com/hiikion/mouse/pull/1 |
17:44:27 | FromDiscord | <huantian> Yard not using if expressions for calc relative? Disappointed |
17:44:40 | FromDiscord | <Yardanico> In reply to @huantian "Yard not using if": i wanted to, but didn't do it |
17:44:55 | FromDiscord | <Yardanico> thought that they might want to expand it in the future, idk |
17:46:25 | FromDiscord | <huantian> Yeah ig |
17:49:55 | FromDiscord | <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:04 | FromDiscord | <Yardanico> ofc yeah, i'm already rewriting it with abs :) |
17:52:49 | * | vicfred quit (Quit: Leaving) |
17:53:30 | FromDiscord | <federico3> @Yardanico\: I'm trying to understand what platforms require LibreSSL and why regarding https://github.com/nim-lang/Nim/pull/19814 |
17:54:14 | FromDiscord | <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:29 | FromDiscord | <Yardanico> And a note about LibreSSL was just a side-note, I'm mainly worried about OpenSSL 1.0 itself |
17:54:44 | FromDiscord | <Yardanico> LibreSSL's usecase is static linking, it's used for that more than OpenSSL I think |
17:55:40 | FromDiscord | <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:39 | FromDiscord | <federico3> 1.1.0 reached end of life in 2018 |
17:57:29 | FromDiscord | <Yardanico> ms-dos reached the end of life in the last century, but we still have PRs adding support for it :P |
17:57:58 | om3ga | why you use ms-dos? |
17:58:14 | FromDiscord | <Yardanico> i don't, but that person does apparently |
17:58:49 | FromDiscord | <Yardanico> but yeah, I'm just saying that as a suggestion, I know that the code can become messier |
17:58:57 | FromDiscord | <federico3> @Yardanico\: yes but this is a library used for TLS. Supporting deprecated/weak versions of the protocol family introduces security risks. |
18:00:35 | FromDiscord | <federico3> (generally speaking I'm on the side of software longevity, but this is an exception) |
18:01:36 | FromDiscord | <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:57 | FromDiscord | <Andreas> (edit) "app" => "apps" |
18:02:19 | FromDiscord | <Andreas> (edit) "cos"" => "cos'" |
18:02:41 | FromDiscord | <Andreas> (edit) "multitaskin-dos-clone" => "multitasking-dos-clone" |
18:04:20 | om3ga | Andreas, 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:33 | FromDiscord | <demotomohiro> I thought people who still writing code for ms-dos are hobbyist and there are no practial reason. |
18:07:41 | om3ga | maybe 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:30 | om3ga | I never got into it... |
18:09:16 | FromDiscord | <Generic> my workflow just depends on lotus 1 2 3 |
18:09:21 | FromDiscord | <Generic> I cannot replace it |
18:09:53 | om3ga | Lotus! I thought I will never hear that word again :) sorry.. |
18:10:40 | FromDiscord | <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:55 | FromDiscord | <Andreas> (edit) "been" => "" |
18:11:12 | FromDiscord | <Generic> I mean this is the sole reason ibm is still around |
18:12:04 | FromDiscord | <Andreas> In reply to @Generic "I mean this is": IMHO thats why there should be NIM-bindings to e.g. GNU-Cobol. |
18:13:25 | om3ga | Andreas, 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:25 | FromDiscord | <Generic> I didn't knew GNU Cobol was a thing |
18:16:33 | FromDiscord | <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:14 | FromDiscord | <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:21 | FromDiscord | <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:53 | FromDiscord | <Andreas> (edit) "etc.)." => "etc.).↵Some if some nim-code works in a Linux-DOS-Box - which is testable - thats good-enough." |
18:20:18 | FromDiscord | <Andreas> (edit) "etc.).↵Some if" => "etc.).↵If" |
18:21:09 | FromDiscord | <Andreas> (edit) "app" => "DOS-app" | removed "" |
18:24:23 | FromDiscord | <demotomohiro> So, cross compiling Nim to ms-dos on Linux and run tests on dosbox. |
18:26:49 | om3ga | hopefylly I code for linux/mac and work with both for more than 10 yrz |
18:27:18 | FromDiscord | <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:54 | FromDiscord | <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:25 | om3ga | I have old P2 |
18:29:04 | om3ga | the network interface is 3com, isa. still works |
18:29:10 | FromDiscord | <demotomohiro> I ran dosbox on windows 8.1 long time ago. |
18:29:32 | FromDiscord | <Andreas> In reply to @om3ga "the network interface is": they did the best stuff - unbreakable |
18:30:32 | om3ga | yes. High quality stuff. |
18:37:30 | FromDiscord | <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:33 | FromDiscord | <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:59 | FromDiscord | <treeform> Nim claims support of versions that never existed and does not support versions that do. |
18:43:35 | FromDiscord | <treeform> it supports them in strange order too |
18:43:43 | FromDiscord | <treeform> meaning it might load older versions when newer ones are around |
18:44:07 | FromDiscord | <treeform> Main reason why I made puppy: https://github.com/treeform/puppy |
18:45:42 | FromDiscord | <Yardanico> In reply to @treeform "I looked at nim's": wdym "unclear which version" for libressl? |
18:45:48 | FromDiscord | <Yardanico> those are all actual libressl versions |
18:45:57 | FromDiscord | <michaelb.eth> there's also nim-bearssl |
18:46:02 | FromDiscord | <michaelb.eth> which is what chronos uses |
18:46:12 | FromDiscord | <Yardanico> yes, but it doesn't integrate with the stdlib at all |
18:46:30 | FromDiscord | <michaelb.eth> fair enough |
18:47:30 | FromDiscord | <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:55 | FromDiscord | <treeform> libressl v43 is sames as openssl 2.5.3 |
18:48:18 | FromDiscord | <treeform> but librassl v38 is ??? |
18:49:28 | FromDiscord | <Yardanico> 2.3.4 |
18:49:46 | FromDiscord | <Yardanico> but this is libressl version, not openssl version |
18:49:48 | FromDiscord | <Yardanico> it's not "the same" really |
18:49:54 | FromDiscord | <Yardanico> since libressl forked from openssl back in 2014 |
18:50:39 | FromDiscord | <treeform> I was going to make a system that downloads the lib nim claims to support and tests it. |
18:50:50 | FromDiscord | <treeform> But got bored |
18:50:53 | FromDiscord | <Yardanico> why not just use the officially supported openssl libs? |
18:50:55 | FromDiscord | <Yardanico> that are shipped in dlls.zip |
18:51:07 | FromDiscord | <Yardanico> i mean officially supported by nim |
18:51:18 | FromDiscord | <Yardanico> https://nim-lang.org/download/dlls.zip |
18:51:22 | FromDiscord | <treeform> why does nim claim support of lib ssl versions we dont? |
18:51:33 | FromDiscord | <Yardanico> which ones? |
18:51:33 | FromDiscord | <treeform> dlls are not linux so? |
18:51:40 | FromDiscord | <treeform> each linux usually ships their own |
18:51:54 | FromDiscord | <Yardanico> you can always LD_LIBRARY_PATH and make it use yours |
18:52:09 | FromDiscord | <treeform> the problem I had is that I could not make the libpg lib do that |
18:52:51 | FromDiscord | <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:14 | FromDiscord | <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:19 | FromDiscord | <treeform> https://github.com/nim-lang/Nim/pull/11272 |
18:53:23 | FromDiscord | <treeform> ^ see here |
18:54:17 | FromDiscord | <treeform> and my attempt to fix order of loading them: |
18:54:17 | FromDiscord | <treeform> https://github.com/nim-lang/Nim/pull/10230 |
18:54:20 | FromDiscord | <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:23 | FromDiscord | <treeform> was reverted |
18:55:12 | FromDiscord | <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:18 | FromDiscord | <Yardanico> In reply to @treeform "was reverted": but didn't alaviss explain the problem |
18:56:26 | FromDiscord | <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:50 | FromDiscord | <treeform> In reply to @arnetheduck "there's no os api": false, each OS gives you its own API. |
18:57:01 | FromDiscord | <Yardanico> In reply to @treeform "false, each OS gives": you mean a HTTP specific api, not a generic SSL api |
18:57:14 | FromDiscord | <arnetheduck> what is the OS API of my Linux? |
18:57:22 | FromDiscord | <treeform> libcurl |
18:57:37 | FromDiscord | <treeform> sent a code paste, see https://play.nim-lang.org/#ix=3Ywh |
18:59:01 | FromDiscord | <arnetheduck> libcurl is a random library that many linux (and mac) users have installed - what makes that a canonical os API? |
18:59:21 | FromDiscord | <treeform> True you can have linux without libcurl |
18:59:28 | FromDiscord | <treeform> I would says linux is the most odd one of all the OSes |
18:59:43 | FromDiscord | <treeform> but you also usually use it as a server os, so you have way more control |
18:59:50 | FromDiscord | <huantian> Linux itself is very modular which allows for a lot of control but also defragmentation |
19:00:07 | FromDiscord | <arnetheduck> and curl and firefox on my linux os don't use the same certificate stores in general |
19:01:19 | FromDiscord | <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:50 | FromDiscord | <treeform> yeah ssl just sucks everywhere |
19:02:39 | FromDiscord | <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:39 | FromDiscord | <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:56 | FromDiscord | <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:15 | FromDiscord | <treeform> here is working link: https://web.archive.org/web/20201118080948/http://www.peereboom.us/assl/assl/html/openssl.html |
19:04:53 | FromDiscord | <treeform> Yeah nim would be better if it adopted bearSSL that guy is super smart. |
19:04:55 | FromDiscord | <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:09 | FromDiscord | <treeform> I totally a gree |
19:06:52 | FromDiscord | <arnetheduck> in other news, nlvm is now following 1.6.x |
19:08:03 | FromDiscord | <treeform> I think the only issues with bearSSL is that it does not use the OS cert stores. |
19:08:18 | FromDiscord | <treeform> If you ship your own certs file, it will never update. |
19:08:37 | FromDiscord | <arnetheduck> In reply to @treeform "I think the only": yeah, this is .. messy indeed - we might add that support at some point |
19:09:24 | FromDiscord | <treeform> if bearSSL had a flag to ship your own certs or use OS ones, it would be 👌 |
19:10:44 | FromDiscord | <treeform> Also this issue in Nim keeps me puzzled: https://github.com/status-im/nim-bearssl/issues/22 |
19:11:10 | FromDiscord | <treeform> Why do the C files not cache... no idea. |
19:11:15 | FromDiscord | <Yardanico> @arnetheduck is nlvm kind of a hobby to you? |
19:11:20 | FromDiscord | <Yardanico> or do you use it for something at status |
19:11:44 | FromDiscord | <Yardanico> In reply to @treeform "Why do the C": the cache works for me |
19:11:53 | FromDiscord | <arnetheduck> pre-status hobby - don't really have that much time for it any more |
19:11:54 | FromDiscord | <Yardanico> in most cases :) |
19:12:08 | FromDiscord | <treeform> for some reason some thing in bearssl causes the cache to break |
19:13:05 | FromDiscord | <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:20 | FromDiscord | <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:05 | om3ga | Well I checked with the book Nim in Action, and definitely I don't use locks wrong. Is this data race - known issue? |
19:46:41 | om3ga | Why withLock don't works sometimes? |
19:46:59 | om3ga | or I should ask this question somewhere else? |
19:53:42 | FromDiscord | <dom96> In reply to @treeform "why does nim claim": Best answer to that probably lies in the git blame :) |
20:03:46 | FromDiscord | <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:51 | FromDiscord | <Andreas> (edit) "help" => "helps" |
20:04:03 | FromDiscord | <Andreas> (edit) "core" => "cores" |
20:05:07 | om3ga | Andreas, I did that on purpose |
20:05:41 | om3ga | compile with -fsanitize=thread enabled |
20:09:28 | FromDiscord | <federico3> bearssl is not very popular, and from its website\: "Current version is 0.6. It is now considered beta-quality software" |
20:10:42 | om3ga | Andreas, sleep may add randomness and minimize the probability of data race events, but it shouldn't happen |
20:11:24 | FromDiscord | <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:36 | FromDiscord | <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:45 | FromDiscord | <Yardanico> there is also the chance that sanitizer itself is wrong |
20:11:58 | FromDiscord | <Yardanico> they're not bug-free at all, they get bugfixed every compiler release in both gcc and clang |
20:12:24 | om3ga | Yardanico, I don't think the TSan will report false errors |
20:12:30 | FromDiscord | <Yardanico> why? |
20:12:39 | FromDiscord | <Yardanico> it can do that as well as other sanitizers |
20:13:09 | om3ga | I see that request counter misses some counts, while httperf sucessfully generated 10 000 requests |
20:13:28 | om3ga | and that with disabled thread sanitizer |
20:15:03 | FromDiscord | <Yardanico> for example about similar issues - https://github.com/oneapi-src/oneTBB/issues/358#issuecomment-793480036 |
20:15:13 | FromDiscord | <Yardanico> i'm not saying it's a false positive, I simply don't know |
20:15:49 | FromDiscord | <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:35 | FromDiscord | <Ayy Lmao> What's the best way to ensure that c headers are included in a certain order? |
20:18:05 | FromDiscord | <Yardanico> emit with all the needed headers with INCLUDESECTION |
20:18:26 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-emit-pragma |
20:18:31 | FromDiscord | <Ayy Lmao> But then do I declare all my FFI functions with nodecl? |
20:18:35 | FromDiscord | <Yardanico> no? |
20:18:42 | FromDiscord | <Yardanico> you declare them with header as usual |
20:18:58 | FromDiscord | <Yardanico> but just doing importc without header should then actually work I think |
20:19:15 | FromDiscord | <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:35 | FromDiscord | <Yardanico> maybe your header doesn't correctly handle the case of being included multiple times? |
20:20:42 | FromDiscord | <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:26 | FromDiscord | <Ayy Lmao> I'll try just using specific headers with the emit pragma. |
20:29:33 | FromDiscord | <sharpcdf> whats the difference between nake and .nims/.nimble files? they look like they do the same thing |
20:30:23 | FromDiscord | <Yardanico> nake scripts are compiled as normal nim programs and then run |
20:30:31 | FromDiscord | <Yardanico> nims/nimble don't need compilation, they're run by the Nim VM |
20:30:40 | FromDiscord | <sharpcdf> ok |
20:30:49 | FromDiscord | <sharpcdf> but then why would people use nake instead of nimscript? |
20:30:55 | FromDiscord | <Yardanico> nake has the advantage of having access to all of the stdlib (even native FFI), and being faster |
20:31:01 | FromDiscord | <sharpcdf> ohhh |
20:31:03 | om3ga | Yardanico, https://play.nim-lang.org/#ix=3Ywu |
20:31:05 | FromDiscord | <sharpcdf> makes sense |
20:31:06 | FromDiscord | <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:12 | om3ga | here is small example |
20:31:27 | FromDiscord | <Yardanico> @sharpcdf what's the project in question? |
20:31:33 | om3ga | I doubt that I can do more simplier than this |
20:31:46 | FromDiscord | <Yardanico> In reply to @om3ga "I doubt that I": thanks, i'll look into it |
20:34:47 | om3ga | maybe definitely better to open issue in the github? Only in case if you confirm the issue of course |
20:36:08 | FromDiscord | <Yardanico> you can just open it for now so it's there |
20:47:50 | FromDiscord | <sharpcdf> In reply to @Yardanico "<@459463405636419594> what's the project": im talking about in general |
20:47:57 | FromDiscord | <sharpcdf> no specific project |
20:48:01 | FromDiscord | <Yardanico> in general nake isn't really used anymore |
20:48:14 | FromDiscord | <sharpcdf> 👍 |
21:58:44 | FromDiscord | <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:38 | FromDiscord | <Elegantbeef> You need the static library |
22:01:58 | FromDiscord | <Elegantbeef> If you have the static library you can use `dynlibOverride` |
22:02:16 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/nimc.html#dynliboverride |
22:03:02 | FromDiscord | <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:34 | NimEventer | New post on r/nim by momoPFL01: grammar spec help, see https://reddit.com/r/nim/comments/ux3jgb/grammar_spec_help/ |
23:14:39 | FromDiscord | <sharpcdf> is there a way to make a static import of sorts where you have to use the syntax `module.function()`? |
23:15:19 | FromDiscord | <Elegantbeef> `import module as nil` |
23:15:50 | FromDiscord | <Elegantbeef> It ruins the method call syntax so try not to ruin people's day 😄 |
23:27:23 | FromDiscord | <sharpcdf> In reply to @Elegantbeef "`import module as nil`": doesnt that just mean you dont do `module.function()`? |
23:27:30 | FromDiscord | <sharpcdf> i want to know the opposite |
23:27:52 | FromDiscord | <Elegantbeef> what |
23:27:59 | FromDiscord | <Elegantbeef> `import module as nil` requires using `module.name` |
23:28:34 | FromDiscord | <sharpcdf> oh ok |
23:28:44 | FromDiscord | <sharpcdf> it looks like it would do the opposite |
23:38:51 | * | arkurious quit (Quit: Leaving) |
23:41:20 | FromDiscord | <Alea> what are the compiler flags for a maximum speed optimization? |
23:41:31 | FromDiscord | <ynfle> -d:danger |
23:41:47 | FromDiscord | <Alea> I also recall people mentioning something like -d:lto or something |
23:41:53 | FromDiscord | <ynfle> Ya |
23:41:59 | FromDiscord | <ynfle> Doesn't work on macos |
23:42:12 | FromDiscord | <ynfle> I think you need `--passL:-flto` |
23:43:23 | FromDiscord | <Alea> Does -d:etc. only affect stdlib or your code too? The wiki isn't entirely clear |
23:43:34 | FromDiscord | <ynfle> What do you mean? |
23:43:41 | FromDiscord | <ynfle> It affects the optimizations of the compiler |
23:44:46 | FromDiscord | <Alea> Wiki said "The standard library supports a growing number of useX conditional defines" for that section, so I wasn't sure |
23:44:58 | FromDiscord | <ynfle> They are custom |
23:45:16 | FromDiscord | <ynfle> You own code can use `-d:useMyCustomFeature` |
23:45:24 | FromDiscord | <ynfle> They are just regular nim cod |
23:45:25 | FromDiscord | <ynfle> (edit) "cod" => "code" |
23:54:51 | FromDiscord | <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:11 | FromDiscord | <Elegantbeef> I dont think so |