00:29:45 | * | xet7 joined #nim |
00:53:59 | * | Gustavo6046_ joined #nim |
00:54:40 | * | Gustavo6046 quit (Ping timeout: 252 seconds) |
00:56:46 | * | Gustavo6046_ is now known as Gustavo6046 |
01:05:56 | * | Egeon quit (Ping timeout: 245 seconds) |
01:07:25 | * | Egeon joined #nim |
01:16:25 | * | Gustavo6046_ joined #nim |
01:17:11 | * | Gustavo6046 quit (Ping timeout: 245 seconds) |
01:19:26 | * | Gustavo6046_ is now known as Gustavo6046 |
01:39:46 | * | Gustavo6046 quit (Ping timeout: 252 seconds) |
01:40:41 | * | Gustavo6046 joined #nim |
02:14:22 | * | Gustavo6046 quit (Read error: Connection reset by peer) |
02:17:02 | * | Gustavo6046 joined #nim |
02:36:59 | * | arkurious quit (Quit: Leaving) |
02:57:51 | * | Gustavo6046 quit (Read error: Connection reset by peer) |
02:58:40 | * | Gustavo6046 joined #nim |
03:20:41 | FromDiscord | <Rika> In reply to @exelotl "hmm I just noticed": sgn looks like a heaviside step that goes into the negative instead of 0 |
03:35:32 | FromDiscord | <geekrelief> Anyone know how I can get the my custom pragma type? https://play.nim-lang.org/#ix=3Cgo |
03:39:21 | * | Gustavo6046 quit (Remote host closed the connection) |
03:39:27 | FromDiscord | <Elegantbeef> Copy the code and dont return a tuple |
03:39:56 | * | Gustavo6046 joined #nim |
03:41:28 | FromDiscord | <geekrelief> In reply to @Elegantbeef "Copy the code and": Sorry I don't follow. What code? What tuple? |
03:42:12 | FromDiscord | <Elegantbeef> in 1.6 this will work https://play.nim-lang.org/#ix=3Cgq |
03:42:44 | FromDiscord | <Elegantbeef> The `getCustomPragmaVal` gets a tuple of `(key: val)` weirdly |
03:43:39 | FromDiscord | <geekrelief> oh, ok, thx |
03:44:05 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Cgr |
03:45:37 | FromDiscord | <Elegantbeef> Soo that `p.len == 2` should actualyl be `p.len == 2 or (p.len == 3 and ($(p[^1]).endsWith(":type")) ` or something more sane |
03:46:15 | FromDiscord | <geekrelief> I'm not familiar with this syntax `cp: typed{nkSym}` does that mean `cp` is a NimNode of kind `nnkSym` or something? |
03:46:33 | FromDiscord | <Elegantbeef> `cp` is typed but will only match if it's a symbol |
03:46:46 | FromDiscord | <Elegantbeef> It's apart of the experimental pattern matching for macros |
03:46:57 | FromDiscord | <Elegantbeef> Actually it might be more than just for macros |
03:47:06 | FromDiscord | <Elegantbeef> But it allows you to do specific operations in specific cases |
03:47:30 | FromDiscord | <geekrelief> is that covered in the docs? |
03:47:37 | FromDiscord | <Elegantbeef> Experimental yes |
03:47:49 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual_experimental.html#term-rewriting-macros-pattern-operators |
03:48:37 | FromDiscord | <Elegantbeef> term rewriting and pattern matching is quite powerful stuff 😀 |
03:49:14 | FromDiscord | <Elegantbeef> But yea make an issue or PR for this issue for this |
03:49:30 | FromDiscord | <geekrelief> ok |
03:49:32 | FromDiscord | <geekrelief> thanks |
03:50:02 | FromDiscord | <Elegantbeef> No problem, the latter fix i mentioned is probably preferable, might be able to do `p[1].symKind == nskType` instead |
03:51:53 | FromDiscord | <Elegantbeef> yea the sym way might be better |
03:51:59 | FromDiscord | <Elegantbeef> Less error prone 😀 |
03:52:13 | FromDiscord | <Elegantbeef> I guess i'm assuming you're making a PR and not just an issue 😛 |
03:53:29 | FromDiscord | <Elegantbeef> Also you'll be happy to know i've actually started on writing tests for nimscripter, so bigrewrite is almost actually released 😀 |
03:54:56 | FromDiscord | <geekrelief> In reply to @Elegantbeef "I guess i'm assuming": I just made an issue. I need to look at the code more closely. It's my first time using custom pragmas, and it's getting late for me. |
03:56:41 | FromDiscord | <Elegantbeef> Yea i've pretty much never used them |
04:00:22 | FromDiscord | <geekrelief> I'll create a PR tomorrow. Thanks beef! 😄 |
04:01:00 | FromDiscord | <Elegantbeef> No problem, really like that `{.all.}` easy fixes, though still think if i see it in any actual code i'll cry |
04:01:53 | FromDiscord | <Elegantbeef> Also where's pmunch, we need 1.6 on playground! |
04:03:26 | FromDiscord | <geekrelief> In reply to @Elegantbeef "No problem, really like": That is nice. |
04:06:02 | * | supakeen quit (Quit: WeeChat 3.3) |
04:06:12 | FromDiscord | <impbox [ftsf]> {.all.} sounds dreamy for working around library issues |
04:06:31 | * | supakeen joined #nim |
04:07:01 | FromDiscord | <Elegantbeef> Yea, i'm using the privateaccess part for getting around private fields in nimscripter |
04:07:06 | FromDiscord | <Elegantbeef> Quite a bit of power with it |
04:30:05 | FromDiscord | <dilawar (Dilawar Singh)> Any `pathlib` (python) like library in nim? I looking for cross-platform way to handle filesystem paths. |
04:31:00 | FromDiscord | <Rika> `os` |
04:31:10 | FromDiscord | <Elegantbeef> `std/os` 😛 |
04:31:59 | FromDiscord | <Rika> `beef you little piece of sh` |
04:32:12 | FromDiscord | <dilawar (Dilawar Singh)> Thanks. I wanted to make sure that std/os is good enough. |
04:32:26 | FromDiscord | <Elegantbeef> It does have the wonderful little `/` operator |
04:32:40 | FromDiscord | <dilawar (Dilawar Singh)> You never know if there is a better option in the wild \:) |
04:33:14 | FromDiscord | <Elegantbeef> The compiler does have typesafe path library, if that's your sort of tea |
04:35:47 | FromDiscord | <dilawar (Dilawar Singh)> I always prefer typesafe addon in my tea 😉. Thanks for info. |
04:40:45 | FromDiscord | <geekrelief> In reply to @Elegantbeef "I guess i'm assuming": created a PR thanks! https://github.com/nim-lang/Nim/pull/19021 Looking forward to the nimscripter update! |
04:41:46 | FromDiscord | <Elegantbeef> Speaking of nimscripter i'm still questioning the usage of `Option[Interpreter]` might move to an exception only version just for consistency across the board |
04:43:06 | * | Gustavo6046 quit (Read error: Connection reset by peer) |
04:46:12 | * | Gustavo6046 joined #nim |
04:53:52 | FromDiscord | <Rika> balls deep in result types, bet you wont |
04:54:29 | FromDiscord | <Elegantbeef> Lol |
05:10:34 | NimEventer | New Nimble package! opencolor - Nim bindings for Open color, see https://github.com/Double-oxygeN/opencolor.nim |
05:19:39 | NimEventer | New thread by Nnahito: Continuous use of parseJson causes software crash, see https://forum.nim-lang.org/t/8518 |
05:34:13 | * | andinus joined #nim |
06:52:43 | * | PMunch joined #nim |
06:54:07 | * | |smlckz| joined #nim |
06:59:24 | * | Yardanico_ joined #nim |
07:03:47 | * | tiorock joined #nim |
07:03:47 | * | tiorock quit (Changing host) |
07:03:47 | * | tiorock joined #nim |
07:03:47 | * | rockcavera is now known as Guest3786 |
07:03:48 | * | Guest3786 quit (Killed (molybdenum.libera.chat (Nickname regained by services))) |
07:03:48 | * | tiorock is now known as rockcavera |
07:09:50 | * | happycorsair[m] quit (Ping timeout: 260 seconds) |
07:09:50 | * | Yardanico quit (Ping timeout: 260 seconds) |
07:17:26 | * | happycorsair[m] joined #nim |
07:37:55 | * | vicfred quit (Quit: Leaving) |
07:54:48 | PMunch | @Yardanico, tried out Sciter in Futhark yet? |
07:55:14 | FromDiscord | <Yardanico> Sorry, not yet, didn't really touch my PC at all in the last few days |
07:55:42 | PMunch | No worries :) I'm just considering to write a small article on Futhark, and I wanted to know if it worked or not :) |
07:56:00 | FromDiscord | <Elegantbeef> Pmunch playground needs updated to 1.6 😛 |
07:56:28 | FromDiscord | <Elegantbeef> Or does it do that automagically? |
07:56:33 | PMunch | Hmm, that should've been done automatically.. |
07:56:55 | PMunch | It should, but it shouldn't take it more than about an hour I think.. |
07:57:45 | PMunch | I mean I've been using Futhark myself for multiple projects already and it's working great! But Sciter is quite different from the things I've been wrapping |
08:48:42 | PMunch | @Elegantbeef, apparently the new Nim version fails to build: /build/Nim/lib/pure/random.nim(221, 11) Error: invalid argument for: high |
08:53:34 | PMunch | Seems like it was caused by using the old csources repo and not csources_v1 |
08:53:43 | PMunch | Are the new csources backwards compatible? |
08:54:54 | PMunch | Ah, and build.sh is gone.. |
08:55:02 | PMunch | So my script can't be backwards compatible any longer.. |
08:55:05 | PMunch | Well that sucks.. |
08:55:28 | |smlckz| | where did it go? ;P |
08:57:20 | PMunch | Ah never mind, it was there I think, I was just cd-ing into the wrong directory |
09:14:18 | FromDiscord | <Hamid Bluri> hey, is there any examples of using `Lock` in Nim? |
09:18:29 | FromDiscord | <Hamid Bluri> In reply to @Rika "`beef you little piece": piece of `shell` |
09:20:29 | NimEventer | New thread by Vsajip: Debugging a SIGSEGV, see https://forum.nim-lang.org/t/8519 |
09:23:36 | FromDiscord | <Rika> Is there a reason many people don’t opt for using Status’ serialisation library? |
09:24:43 | * | Vladar joined #nim |
09:27:36 | FromDiscord | <Hamid Bluri> `status-im` ? |
09:33:22 | FromDiscord | <tandy> what does it mean when someone defines a proc like so? `proc search[T, U](x: T, needle: U): union(U | None) =` |
09:33:37 | FromDiscord | <tandy> the `[]` bit before taking parameters |
09:33:43 | FromDiscord | <Elegantbeef> a generic procedure |
09:34:02 | FromDiscord | <tandy> i see, so the types T, U are generic |
09:34:13 | FromDiscord | <Elegantbeef> Yes |
09:34:21 | FromDiscord | <Elegantbeef> Well generic params |
09:34:26 | FromDiscord | <Elegantbeef> The entire proc is generic |
09:34:43 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#generics |
09:41:28 | FromDiscord | <Hamid Bluri> beef do you know how can i use locks in nim? |
09:41:37 | FromDiscord | <Hamid Bluri> any examples? |
09:41:44 | FromDiscord | <Hamid Bluri> or articles |
09:41:49 | FromDiscord | <Elegantbeef> Using thread locks? |
09:41:55 | FromDiscord | <Hamid Bluri> yes |
09:42:50 | FromDiscord | <Elegantbeef> Small example https://nim-lang.org/docs/threads.html#examples |
09:43:22 | FromDiscord | <Hamid Bluri> thank u |
09:43:28 | FromDiscord | <Elegantbeef> I can also give a small explanation that they're just for preventing threads from accessing resources at the same time so you jut lock/unlock them where an edge case could occur |
09:43:42 | FromDiscord | <Elegantbeef> Aside from that i cannot help much, especially as i'm about to go to sleep, sorry |
09:44:30 | FromDiscord | <Hamid Bluri> it's 13:14 here : D it was really helpful |
09:44:47 | FromDiscord | <Elegantbeef> It's almost 4 am |
09:44:47 | FromDiscord | <Elegantbeef> I'm a terrible human |
10:25:01 | FromDiscord | <impbox [ftsf]> But a great beef |
10:47:07 | FromDiscord | <dilawar (Dilawar Singh)> Is there a way to install a package to non-standard directory using`nimble`? Like `--prefix` option in `pip`? |
10:49:12 | PMunch | !eval echo NimVersion |
10:49:14 | NimBot | 1.6.0 |
10:49:16 | PMunch | @Elegantbeef ^ |
10:49:43 | PMunch | @dilawar_(Dilawar_Singh), --nimbleDir probably |
10:50:21 | FromDiscord | <Yardanico> @PMunch it won't work if you use underscores, instead you can just use the part of a name IIRC |
10:50:29 | FromDiscord | <Yardanico> try just with @dilawar , I think it should work |
10:50:39 | FromDiscord | <Yardanico> ah, nvm, they're from matrix so even that wouldn't work |
10:51:54 | PMunch | Oh right, I've set up my HexChat to extract the username from FromDiscord messages and replace FromDiscord with the nick. Since IRC names can't have spaces it replaces those with underscores |
10:52:11 | PMunch | So to me you all look like IRC users again now :) |
10:52:51 | PMunch | Except that I get a message like: "@Yardanico ([email protected]) has joined" the first time someone talks in the Discord room |
10:53:05 | FromDiscord | <Yardanico> interesting |
10:55:23 | PMunch | Haven't made it change the colour though, so it still uses the FromDiscord nick colour. But it's a start |
11:06:09 | FromDiscord | <geekrelief> In side of a macro, is there a way to get more information about a NimNode that is a typedesc? I have a macro that receives a proc with a custom pragma that takes a typedesc. I want to check if that typedesc is for a proc. |
11:07:04 | FromDiscord | <Rika> What? |
11:07:57 | FromDiscord | <geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3ChH |
11:08:16 | FromDiscord | <geekrelief> I want to be sure `foo` is a proc and not an object |
11:08:39 | FromDiscord | <geekrelief> (edit) "https://play.nim-lang.org/#ix=3ChH" => "https://play.nim-lang.org/#ix=3ChI" |
11:09:37 | FromDiscord | <geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3ChJ |
11:10:06 | FromDiscord | <geekrelief> This is for C interop where `foo` and `bar` are imported types. |
11:10:51 | * | ozzz quit (Remote host closed the connection) |
11:16:33 | FromDiscord | <haxscramper> you have a macro that does `macro zzz(a: proc(typedesc))`? |
11:16:38 | FromDiscord | <geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3ChN |
11:17:48 | FromDiscord | <geekrelief> In reply to @haxscramper "you have a macro": more like `macro zzz(a: proc(){.customPragma.})` |
11:18:06 | FromDiscord | <geekrelief> (edit) "proc(){.customPragma.})`" => "proc(){.customPragma:typedesc.})`" |
11:19:56 | FromDiscord | <haxscramper> I don't think the `tm_type: tm_the_truth_create_types` part is going to be stored in typedesc information anywhere |
11:20:01 | FromDiscord | <haxscramper> certainly not in a type |
11:20:19 | FromDiscord | <haxscramper> you might have a chance if you accept `typed` node, symbol for the proc you defined |
11:20:26 | FromDiscord | <haxscramper> and then `getTypeInst/getTypeImpl/getType` |
11:20:35 | FromDiscord | <haxscramper> basically somehow original definition of the proc |
11:21:00 | FromDiscord | <haxscramper> But even with these `getTypeXXX` I don't really know how to do this |
11:21:19 | FromDiscord | <haxscramper> but with `typedecs[]` it is almost guaranteed to be impossible, since `tm_type: tm_the_truth_create_types` is not a part of the type |
11:21:26 | FromDiscord | <geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3ChP |
11:21:36 | FromDiscord | <geekrelief> Basically the `nnkProcTy` part |
11:22:10 | FromDiscord | <geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3ChQ |
11:22:49 | FromDiscord | <geekrelief> Yeah, I'm afraid I couldn't find anything in `std/macros` to get more info. |
11:23:00 | NimEventer | New Nimble package! xidoc - A consistent markup language, see http://xidoc.nim.town/ |
11:36:56 | FromDiscord | <geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3ChX |
11:37:07 | FromDiscord | <geekrelief> (edit) "https://play.nim-lang.org/#ix=3ChX" => "https://play.nim-lang.org/#ix=3ChY" |
11:37:18 | FromDiscord | <geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3ChZ |
11:40:41 | FromDiscord | <geekrelief> Yeah with that I can check the kind of the third child to see if it's a proc |
11:41:05 | FromDiscord | <lenis> Does anyone know the state of incremental compilation? Importing a large module in nim 1.6.0 still adds seconds to the compile time for every change |
11:41:28 | FromDiscord | <haxscramper> IC is delayed with no concrete release date |
11:41:33 | FromDiscord | <Yardanico> In reply to @lenis "Does anyone know the": there was some work done on it, but it's still not complete and not default |
11:42:15 | FromDiscord | <lenis> That's unfortunate 😦 |
11:48:02 | FromDiscord | <haxscramper> I'm not sure what would be the aim of 1.8 release |
11:48:18 | FromDiscord | <haxscramper> 2021 was supposed to be the year of tooling, at least I remember talks about this |
11:48:41 | FromDiscord | <haxscramper> arc/orc is for 2.0 since they are not ABI compatible |
11:48:53 | FromDiscord | <haxscramper> https://forum.nim-lang.org/t/7983 |
11:49:35 | FromDiscord | <haxscramper> probably some of the features that are currently experimental |
11:49:55 | FromDiscord | <haxscramper> like concepts, IC, lazy compilation, or something else |
12:06:01 | * | supakeen quit (Quit: WeeChat 3.3) |
12:06:55 | * | supakeen joined #nim |
12:20:10 | FromDiscord | <exelotl> it's nice to see that view types are a little more usable now, looking forward to them becoming stable |
12:28:19 | FromDiscord | <exelotl> I have really mixed feelings about custom numeric literals lol |
12:28:34 | FromDiscord | <Rika> Why |
12:29:04 | FromDiscord | <exelotl> `fp(1/32)` is way nicer than `1'fp/32` |
12:29:26 | FromDiscord | <haxscramper> but compare it to fp(1) vs 1'fp |
12:29:42 | FromDiscord | <Rika> You can use both anyway |
12:29:52 | FromDiscord | <haxscramper> you'know usual use case is `<lit>'<suffix>` |
12:29:56 | FromDiscord | <Rika> It’s not like you’re forced to use literals |
12:30:26 | FromDiscord | <haxscramper> also those are two distinct operations |
12:30:32 | FromDiscord | <haxscramper> divide 1'fp by 432 |
12:30:35 | FromDiscord | <haxscramper> and turn 1/32 into fp |
12:30:41 | FromDiscord | <haxscramper> whatever fp is |
12:31:06 | FromDiscord | <exelotl> Fixed point number with 8 bits of precision |
12:31:09 | FromDiscord | <Rika> Probably fixed point |
12:31:12 | FromDiscord | <exelotl> Ye |
12:31:22 | FromDiscord | <impbox [ftsf]> floppy point |
12:31:25 | FromDiscord | <exelotl> It just feels weird mixing the two approaches just to save a single character where previously there was 1 uniform approach |
12:31:32 | FromDiscord | <Rika> Though that makes it ambiguous with “floating point” given they both start with f |
12:31:56 | FromDiscord | <impbox [ftsf]> 1.0'x for fiXed? |
12:32:12 | FromDiscord | <Rika> Also can be confused with hexadecimal |
12:32:14 | FromDiscord | <impbox [ftsf]> 1.0'8.8 |
12:32:20 | FromDiscord | <impbox [ftsf]> For 8.8 fixed? |
12:32:20 | FromDiscord | <exelotl> Yeah x makes me think of hex lol |
12:32:26 | FromDiscord | <Rika> Just use “fix” IMO but whatever that’s besides the point |
12:32:47 | FromDiscord | <impbox [ftsf]> I guess you can't use numbers as the name |
12:32:53 | FromDiscord | <Rika> Custom number literals are useful for numbers that can’t be represented by any built in number types like for big integers |
12:33:02 | FromDiscord | <Yardanico> exactly |
12:33:03 | FromDiscord | <impbox [ftsf]> 1.0'fix8 |
12:36:40 | FromDiscord | <lbart> hi!↵I was away from nim last months, but I miss Nim 🙂↵Have the tools evolved (I'm thinking about code coverage and static analysis. DrNim IIRC?) |
12:38:53 | FromDiscord | <haxscramper> no, not really. Current release was mostly focused on library and core language improvements, not so much on tooling |
12:39:42 | PMunch | Ooh, fixed point literals would be super neat |
12:40:33 | PMunch | And cool, I was just able to use Futhark to wrap Gtk3 and WebKitGtk in order to have a Gtk application which loads a website |
12:40:58 | FromDiscord | <Rika> Cool |
12:43:16 | PMunch | All the wrapping is being done fully automatically, I just tell it which header files I wanted to import, rewrote some sample code to use nil instead of NULL and removed some semicolons and bish bash bosh there's my application |
12:46:08 | FromDiscord | <konsumlamm> In reply to @exelotl "It just feels weird": the point is not to save characters, the point is to have nicer syntax for custom number literals (1/32 is no literal btw), so that you can for example have bigint literals (which would need strings otherwise, since the numbers can be arbitrarily large) |
12:49:20 | FromDiscord | <exelotl> oh yeah sorry, I don't mean in general, just in my own project where I was already using `fp()` everywhere 😅 |
12:55:48 | FromDiscord | <Rika> as ive said |
12:55:50 | FromDiscord | <Rika> you dont need to use it |
13:13:44 | * | andinus quit (Remote host closed the connection) |
13:14:57 | * | arkurious joined #nim |
13:37:52 | NimEventer | New post on r/nim by PMunch: Is Nim a Transpiler?, see https://reddit.com/r/nim/comments/qc11b8/is_nim_a_transpiler/ |
13:38:33 | FromDiscord | <Yardanico> finally, an article |
13:38:46 | PMunch | Finally? |
13:39:27 | FromDiscord | <Yardanico> yes, about nim + "transpiler" |
13:39:57 | PMunch | Ah yes, I wrote it yesterday after someone asked the question for the millionth time :P |
13:40:09 | PMunch | Figured we needed an article we could just link to |
13:40:27 | FromDiscord | <Yardanico> make a forum thread too |
13:40:38 | FromDiscord | <Yardanico> and post on HN :DD |
13:42:55 | PMunch | That sounds like a nice way to get a really nice bikeshedding discussion going :P |
13:43:27 | NimEventer | New thread by PMunch: Is Nim a Transpiler?, see https://forum.nim-lang.org/t/8520 |
13:43:48 | supakeen | well it's easy, you don't need to read the article |
13:43:55 | supakeen | any article with a question as a headline can be ansewred with 'no' |
13:44:24 | FromDiscord | <haxscramper> Is 1+1=2 |
13:44:24 | FromDiscord | <haxscramper> Is 1+1=2? |
13:44:36 | FromDiscord | <tandy> lol |
13:44:55 | FromDiscord | <haxscramper> And also articles with "what/where/when/why" etc. |
13:44:57 | FromDiscord | <haxscramper> "why do X?" |
13:45:05 | FromDiscord | <haxscramper> and the answer is "no" |
13:46:20 | FromDiscord | <Rika> ?? |
13:46:21 | FromDiscord | <Rika> "why use nim?" "no" what? |
13:47:35 | FromDiscord | <Yardanico> In reply to @haxscramper "And also articles with": so in your opinion "Why Nim is not a transpiler" is a better title than "Is Nim a transpiler?" |
13:47:43 | FromDiscord | <Yardanico> i still don't quite get your messages :D |
13:48:22 | FromDiscord | <haxscramper> Need to put this on hn to get the real pointless discussion started |
13:52:34 | FromDiscord | <Rika> please dont |
13:52:41 | FromDiscord | <Rika> im at my limit for today |
13:52:44 | FromDiscord | <Rika> tomorrow is fine |
13:53:15 | FromDiscord | <haxscramper> no, I won't do this of course, because that's the last think I really need |
13:53:23 | PMunch | Too late @Rika: https://news.ycombinator.com/item?id=28930684 |
13:53:53 | FromDiscord | <Rika> man |
13:54:18 | FromDiscord | <Rika> its almost tomorrow, ill just not read it for now |
13:54:25 | FromDiscord | <Rika> no comments yet so yeah thatll be fun |
13:57:30 | FromDiscord | <Yardanico> 🍿 |
13:57:59 | FromDiscord | <Rika> now im fucking nervous god this is gonna be a shitshow |
13:58:17 | FromDiscord | <Yardanico> why are you nervous |
13:59:16 | FromDiscord | <juan_carlos> I remember when someone said that Nim is a C preprocessor... |
13:59:29 | FromDiscord | <Rika> i mean |
13:59:47 | * | Vladar quit (Remote host closed the connection) |
13:59:48 | FromDiscord | <Rika> In reply to @Yardanico "why are you nervous": dunno, just am |
14:00:05 | FromDiscord | <Yardanico> just don't be nervous then :P |
14:00:17 | * | tk joined #nim |
14:02:06 | * | Vladar joined #nim |
14:02:53 | FromDiscord | <Rika> lol |
14:03:54 | PMunch | @juan_carlos, yeah it's not exactly obvious why it isn't at first glance :P |
14:04:07 | PMunch | But I mean that's how C++ started out *shrugs* |
14:04:59 | FromDiscord | <Yardanico> don't tell anyone that C++ was a "transpiler" in the past |
14:06:04 | FromDiscord | <enthus1ast> "No this lang ist just a transpiler, it can't keep up with my magicx haxx0r skills" |
14:06:39 | PMunch | Oh well, I've gotta go. Have fun with the HN post :P |
14:06:40 | * | PMunch quit (Quit: Leaving) |
14:07:25 | FromDiscord | <Yardanico> 9 points already |
14:07:31 | FromDiscord | <Yardanico> time to get my popcorn |
14:08:04 | tk | http://ix.io/3Cjc - is there any way to get the expected behaviour? The documentation claims that conversions between the base type and subrange will be implicit but not that conversions between subranges (even if they have the same range) will be implicit. Is there some way to get strict primitive type subtyping in nim? |
14:10:07 | FromDiscord | <enthus1ast> a = 6 ? |
14:10:22 | FromDiscord | <enthus1ast> is not in the range[0..5] |
14:10:30 | tk | It's commented. That's not what the issue is. |
14:10:50 | tk | The unexpected code is at the bottom. The last 4 lines. |
14:10:53 | FromDiscord | <enthus1ast> "# Does not compile as expected" |
14:11:07 | FromDiscord | <enthus1ast> oh man i must read \:D |
14:11:07 | tk | Right... It doesn't compile, which makes sense. |
14:11:23 | FromDiscord | <Rika> why would these not compile? |
14:11:25 | FromDiscord | <Rika> i mean |
14:11:30 | FromDiscord | <Rika> why would last four be unexpected |
14:11:35 | FromDiscord | <Rika> A and B are aliases |
14:11:42 | FromDiscord | <Rika> if you want them to be different use `distinct` |
14:11:52 | tk | Are they? Where does it say that a type defined the same is the same type? |
14:12:22 | FromDiscord | <Rika> one moment |
14:12:26 | FromDiscord | <Rika> internet slow |
14:12:35 | tk | Okay, I had not gotten so far as to reaching distinct. This does indeed solve my problem. |
14:12:36 | FromDiscord | <enthus1ast> yes that also hit me, once, did also not follow araqs explanation back then |
14:13:12 | tk | cool, thanks! |
14:13:51 | tk | Aside from not having a standard and some other issues relating linking nim is basically the perfect C replacement so far. |
14:15:22 | FromDiscord | <geekrelief> In reply to @tk "Are they? Where does": https://nim-lang.github.io/Nim/manual.html#type-relations-type-equality |
14:15:47 | tk | okay, thanks |
14:15:58 | FromDiscord | <enthus1ast> this enables the tuple i guess? |
14:16:09 | FromDiscord | <geekrelief> yeah |
14:16:10 | FromDiscord | <enthus1ast> tuple behaviour |
14:21:46 | * | notchris quit (Ping timeout: 245 seconds) |
14:22:35 | * | LyndsySimon quit (Ping timeout: 264 seconds) |
14:22:52 | FromDiscord | <haxscramper> 9 comments 21 points |
14:22:55 | FromDiscord | <haxscramper> here we ggo |
14:23:50 | * | notchris joined #nim |
14:24:21 | * | LyndsySimon joined #nim |
14:27:33 | FromDiscord | <Rika> nooooo |
14:28:46 | FromDiscord | <Rika> this one by ivanbakel |
14:28:47 | FromDiscord | <Rika> i like it |
15:02:43 | FromDiscord | <dom96> Good point by k about gatekeeping |
15:03:46 | FromDiscord | <Rika> i like that too |
15:04:02 | FromDiscord | <Rika> also the reply from modernmech |
15:04:11 | FromDiscord | <dom96> also this https://news.ycombinator.com/item?id=28931264 |
15:04:27 | FromDiscord | <Rika> `In actual usage, the main difference between a compiler and a transpiler is usually the speaker's affiliation with JS communities.` |
15:04:29 | FromDiscord | <Rika> lmfao |
15:04:40 | FromDiscord | <dom96> really the title of PMunch's blog post should be "The word transpiler is stupid" |
15:06:57 | FromDiscord | <dom96> some very interesting historical insight in there |
15:10:37 | FromDiscord | <Rika> yeah im not hating the responses as much as i thought i would |
15:14:55 | FromDiscord | <reilly> Can I echo the capacity of a cstring? |
15:16:11 | FromDiscord | <haxscramper> cstring does not have capacity |
15:16:28 | FromDiscord | <haxscramper> cstring is a C string for C backed, and Js string for Js backend |
15:16:31 | FromDiscord | <haxscramper> "common" string |
15:30:28 | FromDiscord | <reilly> sent a long message, see http://ix.io/3CjU |
15:31:34 | FromDiscord | <reilly> I also can't just pass in a string, because no matter the string's capacity (`newStringOfCap()`), entering a single character immediately crashes due to illegal storage access. It ends up implicitly converted to a cstring anyway. |
15:33:11 | FromDiscord | <Yardanico> In reply to @reilly "Okay, well, I'm using": hmm |
15:34:04 | FromDiscord | <Yardanico> @reilly I think the nim definition is a bit wrong in this case then |
15:34:22 | FromDiscord | <Yardanico> if igInputTextWithHint itself creates a string, you should probably pass pointer to a buffer to it |
15:35:26 | FromDiscord | <Yardanico> lemme try to do it myself |
15:36:52 | FromDiscord | <reilly> For the record, if I pass in `buf` as `""` and `buf_size` as some arbitrary number, it will still crash when typing a single character. |
15:37:09 | FromDiscord | <Rika> use string |
15:37:46 | FromDiscord | <Rika> then `str[0].addr.cstring` and `capacity` that you explicitly allocated with `newstringofcap` i guess? |
15:38:01 | FromDiscord | <Rika> maybe no need [0].addr |
15:38:09 | FromDiscord | <Rika> think `str.cstring` is right, i dont know |
15:38:51 | FromDiscord | <Yardanico> no that won't work |
15:39:03 | FromDiscord | <reilly> Nim implicity converts the string to a cstring anyway. |
15:39:10 | FromDiscord | <Yardanico> In reply to @reilly "Nim implicity converts the": that behaviour is deprecated |
15:39:13 | FromDiscord | <Rika> i dont think it does in the future |
15:39:13 | FromDiscord | <Rika> yes |
15:39:17 | FromDiscord | <Yardanico> In reply to @Yardanico "no that won't work": ah actually it will, yeah, if the bufSize is correct |
15:39:23 | FromDiscord | <Yardanico> @reilly |
15:39:28 | FromDiscord | <Yardanico> works for me |
15:39:31 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3CjW |
15:39:43 | FromDiscord | <reilly> In reply to @Yardanico "that behaviour is deprecated": I know it's deprecated, that's why I'm trying to avoid it 😛 |
15:40:01 | FromDiscord | <Rika> the implicit convert is deprecated, the explicit is not |
15:40:08 | FromDiscord | <Yardanico> exactly |
15:40:34 | FromDiscord | <Rika> my english a bit weird right now, probably because i just did some japanese stuff |
15:41:31 | FromDiscord | <reilly> I'm noticing that `sizeof(s)` always returns 8, which is not very helpful... |
15:41:51 | FromDiscord | <Yardanico> In reply to @reilly "I'm noticing that `sizeof(s)`": it returns the size of the reference to the string data which is 8 and is correct, yes |
15:41:57 | FromDiscord | <Yardanico> check `s.len` |
15:42:05 | FromDiscord | <Rika> careful with len for cstring |
15:42:05 | FromDiscord | <Yardanico> oh yeah, actually, that code is a bit wrong |
15:42:17 | FromDiscord | <Rika> len for cstring is not constant time |
15:42:39 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3CjZ |
15:42:46 | FromDiscord | <Yardanico> with newString the string itself will _always_ be 128 chars so you'll have to strip |
15:42:54 | FromDiscord | <Yardanico> and you won't know if the spaces were done by the user or not |
15:43:07 | FromDiscord | <Rika> whats wrong with ofcap? |
15:43:11 | FromDiscord | <Yardanico> it doesn't work |
15:43:13 | FromDiscord | <Rika> does it just not work? |
15:43:28 | FromDiscord | <Rika> i need to test |
15:43:33 | FromDiscord | <Yardanico> well of course, because .len is 0 |
15:43:53 | FromDiscord | <Rika> i see |
15:44:04 | FromDiscord | <Rika> the issue is because internal len is not updated i feel |
15:44:07 | FromDiscord | <Yardanico> one way is to do manual allocation I guess |
15:44:11 | FromDiscord | <Yardanico> @Rika yes, but that's not possible to do really |
15:44:14 | FromDiscord | <Rika> yes |
15:44:15 | FromDiscord | <Rika> i know |
15:44:36 | FromDiscord | <Rika> really think you need to do manual alloc/create |
15:44:44 | FromDiscord | <Rika> i recommend create tho |
15:45:28 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3Ck0 |
15:45:35 | FromDiscord | <Yardanico> and len changes correctly |
15:45:41 | FromDiscord | <Yardanico> because all other bytes are null |
15:45:47 | FromDiscord | <Rika> because len is not internal |
15:45:55 | FromDiscord | <Rika> rather not internally stored |
15:46:10 | FromDiscord | <Rika> its recomputed every call so no need to update anything |
15:46:43 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3Ck1 |
15:46:47 | FromDiscord | <Yardanico> and of course you can define a callback for the input change event in imgui |
15:46:57 | FromDiscord | <Rika> damn double cstring just to make sure |
15:47:02 | FromDiscord | <Yardanico> In reply to @Rika "damn double cstring just": ah yeah :D |
15:47:12 | FromDiscord | <Yardanico> (edit) "https://play.nim-lang.org/#ix=3Ck1" => "https://play.nim-lang.org/#ix=3Ck2" |
15:47:16 | FromDiscord | <Rika> ah yes the cstring is made of cstring |
15:54:14 | * | Gustavo6046 quit (Remote host closed the connection) |
15:54:15 | * | Gustavo6046_ joined #nim |
15:54:37 | FromDiscord | <reilly> Cool, that does work. Not super intuitive, but I'll get over it. |
15:56:36 | FromDiscord | <reilly> sent a code paste, see https://play.nim-lang.org/#ix=3Ck5 |
15:56:52 | * | Gustavo6046_ is now known as Gustavo6046 |
16:01:30 | FromDiscord | <Yardanico> because ImGuiInputTextFlags |
16:01:40 | FromDiscord | <Yardanico> that's not related to nim, it's imgui-specific stuff |
16:01:46 | FromDiscord | <Yardanico> e.g. for callback to fire on edits you have to use CallbackEdit |
16:02:11 | FromDiscord | <Yardanico> ` igInputTextWithHint("", "duration", data, 9, CallbackEdit, cb)` |
16:02:14 | FromDiscord | <Yardanico> for example |
16:02:59 | FromDiscord | <Yardanico> https://github.com/ocornut/imgui/blob/master/imgui.h#L989↵https://github.com/nimgl/imgui/blob/master/src/imgui.nim#L327 |
16:03:15 | FromDiscord | <Yardanico> you'll have to read the original imgui sources plenty :P |
16:08:05 | FromDiscord | <reilly> You have to tell ImGui that you want to use your callback? That's wack. |
16:09:02 | FromDiscord | <IsaacPaul> That's because there are a ton of different reasons for a callback |
16:09:18 | FromDiscord | <Yardanico> exactly, so the default is None |
16:09:28 | FromDiscord | <IsaacPaul> granted, they should ask for a reason when setting up the callback |
16:09:35 | FromDiscord | <Yardanico> In reply to @IsaacPaul "granted, they should ask": they do |
16:09:38 | FromDiscord | <IsaacPaul> oh |
16:09:48 | FromDiscord | <Yardanico> ImGuiInputTextFlags |
16:09:56 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/900415545239810068/unknown.png |
16:10:06 | FromDiscord | <Yardanico> this is both for setting up parameters of the input field and for callbacks |
16:11:13 | FromDiscord | <IsaacPaul> I see it now `..., flags: ImGuiInputTextFlags = 0.ImGuiInputTextFlags, ...`↵lol |
16:11:49 | FromDiscord | <reilly> In reply to @IsaacPaul "That's because there are": That makes enough sense, actually. |
16:18:40 | FromDiscord | <IsaacPaul> Using a literal to hold all the options is an interesting way of doing things... ↵I would at least use an abstraction over it.. |
16:20:03 | FromDiscord | <reilly> sent a code paste, see https://play.nim-lang.org/#ix=3Ckd |
16:20:25 | FromDiscord | <Yardanico> wait you don't need to do this |
16:20:27 | FromDiscord | <Yardanico> just do `or` |
16:20:37 | FromDiscord | <Yardanico> `CharsDecimal or CallbackEdit` for example |
16:20:47 | FromDiscord | <Yardanico> nim's `or` already works as bit or for integers |
16:21:05 | FromDiscord | <reilly> Then why have `bitor()`? 🤨 |
16:22:35 | FromDiscord | <IsaacPaul> bitor is probably inferring the wrong type. Make it explicit? |
16:24:41 | FromDiscord | <reilly> sent a code paste, see https://play.nim-lang.org/#ix=3Cke |
16:24:49 | FromDiscord | <Yardanico> what about `CharsDecimal or CallbackEdit` |
16:27:25 | FromDiscord | <Rika> In reply to @reilly "Then why have `bitor()`?": some people prefer it |
16:27:29 | FromDiscord | <Rika> its more explicit |
16:28:09 | FromDiscord | <Rika> it should work, odd that it doesnt |
16:28:35 | FromDiscord | <reilly> In reply to @Yardanico "what about `CharsDecimal or": `or` has no implementation for enums, so I have to include `ord()`. This still isn't enough though, as there's still a type mismatch between this expression (int literal) vs the argument type (`ImGuiInputTextFlags`). |
16:28:57 | FromDiscord | <IsaacPaul> sent a code paste, see https://play.nim-lang.org/#ix=3Ckl |
16:28:59 | FromDiscord | <Rika> enums are arguably not something to be `or`ed but thats another discussion |
16:29:25 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=3Ckm |
16:31:28 | FromDiscord | <reilly> sent a code paste, see https://play.nim-lang.org/#ix=3Ckp |
16:31:56 | FromDiscord | <Rika> oh |
16:31:58 | FromDiscord | <Rika> remove the generic then |
16:32:25 | FromDiscord | <Rika> AHHHH |
16:32:28 | FromDiscord | <Rika> I GET IT |
16:32:31 | FromDiscord | <reilly> But this is exactly what I was doing before... |
16:32:44 | FromDiscord | <reilly> w/o the generic, I mean. |
16:32:47 | FromDiscord | <Rika> i get it |
16:32:57 | FromDiscord | <IsaacPaul> maybe its passing a function pointer? |
16:32:58 | FromDiscord | <Rika> the or of the two enums is not itself a valid enum |
16:33:13 | FromDiscord | <reilly> But it's not supposed to be a valid enum. |
16:33:19 | FromDiscord | <Rika> the wrapper is simply wrong |
16:33:36 | FromDiscord | <Rika> In reply to @reilly "But it's not supposed": it has to be if you want to convert it to the type |
16:34:11 | FromDiscord | <Rika> the wrapper is wrong, there should be an `ImGuiInputTextFlag = enum ...` and an `ImGuiInputTextFlags = set[ImGuiInputTextFlag]` or so |
16:34:33 | FromDiscord | <IsaacPaul> ah makes sense |
16:35:23 | FromDiscord | <Rika> of course, this has some issues too in some case |
16:35:24 | FromDiscord | <Rika> (edit) "case" => "cases" |
16:35:34 | FromDiscord | <reilly> But just a few lines earlier, I'm doing the same thing with ImGuiWindowFlags. That expression evaluates to `8230`, but there's no valid enum for that... Unless the result just can't be greater than the maximum enum value? |
16:36:17 | FromDiscord | <Rika> ah |
16:36:18 | FromDiscord | <Rika> yes |
16:36:21 | FromDiscord | <Rika> thats perfect |
16:36:26 | FromDiscord | <Rika> yes thats the proper issue |
16:36:34 | FromDiscord | <Yardanico> In reply to @reilly "But just a few": the Nim definition is wrong, it can be bigger than the biggest enum value |
16:36:56 | FromDiscord | <Rika> then what is the issue? |
16:36:57 | FromDiscord | <Yardanico> i mean the arguments of the C function aren't exactly correct |
16:37:58 | FromDiscord | <Yardanico> ` igInputTextWithHint("", "duration", data, 9, ord(CharsDecimal) or ord(CallbackEdit), cb)` this works fine if you change the function definition to `proc igInputTextWithHint(label: cstring, hint: cstring, buf: cstring, buf_size: uint, flags: int = 0, callback: ImGuiInputTextCallback = nil, user_data: pointer = nil): bool {.importc: "igInputTextWithHint".}` |
16:38:10 | FromDiscord | <Yardanico> so it's an int and not ImGuiInputTextFlags |
16:38:23 | FromDiscord | <Yardanico> so as I said, it's yet another issue of the wrapper itself |
16:39:34 | FromDiscord | <reilly> But the arguments for creating a window do use ImGuiWindowFlags... `flags: ImGuiWindowFlags = 0.ImGuiWindowFlags` |
16:39:41 | FromDiscord | <reilly> So, what's the difference? |
16:40:41 | FromDiscord | <Yardanico> In reply to @reilly "So, what's the difference?": if it works, it works by an accident because the values aren't bigger than the biggest value in the enum |
16:40:45 | FromDiscord | <Yardanico> so nim allows it to compile |
16:40:53 | FromDiscord | <Yardanico> as I said, the wrapper definition for this function is wrong |
16:40:58 | FromDiscord | <Yardanico> and for all others that take Flags types too |
16:47:48 | Mister_Magister | man i really gotta learn async |
16:47:51 | Mister_Magister | idk how it works |
16:47:54 | NimEventer | New thread by JPLRouge: Min 1.6 help --passc:-flto problème, see https://forum.nim-lang.org/t/8521 |
16:47:55 | Mister_Magister | i just do waitfor |
16:48:01 | Mister_Magister | or await |
16:50:41 | FromDiscord | <Yardanico> waitFor is for global-level code, you mainly use it to start your async code |
16:50:53 | FromDiscord | <Yardanico> and you use `await` to wait for a completion of an async proc from another async proc |
16:51:18 | Mister_Magister | ye ye but i just gotta learn how to use async |
16:52:56 | FromDiscord | <Rika> you can almost think of `await` as "wait for this proc to finish, feel free to do some other stuff in the mean time |
16:53:40 | Mister_Magister | i know whats await and waitfor lol |
16:54:52 | FromDiscord | <Rika> then whats the issue |
17:01:58 | NimEventer | New thread by Sensanaty: Runtime Regex string replacing, see https://forum.nim-lang.org/t/8522 |
17:08:51 | Mister_Magister | would someone be so kind as to remind me how do you type base in nim? like 0x10 |
17:10:46 | Mister_Magister | 0b |
17:10:49 | Mister_Magister | 0x works too |
17:11:50 | FromDiscord | <reilly> sent a code paste, see https://play.nim-lang.org/#ix=3CkF |
17:11:53 | FromDiscord | <reilly> (edit) |
17:12:50 | Mister_Magister | i just love using $ its like being super lazy just slap $ and boom its a string |
17:12:58 | FromDiscord | <Rika> !eval echo 0o777 |
17:13:02 | NimBot | 511 |
17:13:35 | Mister_Magister | thank @reilly |
17:18:44 | Mister_Magister | ha, i made udp server/client to discover at which ip address is the server |
17:20:15 | Mister_Magister | https://gist.github.com/Michal-Szczepaniak/6f7319c686aaaab1a6a0d273153e7936 feel free to judge me |
17:21:43 | FromDiscord | <dom96> Mister_Magister: what do you want to learn about async? |
17:21:47 | Mister_Magister | also, why can't i put - in file name |
17:21:57 | FromDiscord | <Yardanico> because - is not a valid character for a nim identifier |
17:21:58 | Mister_Magister | @dom96 how does it work, how to use it, how to make async stuff |
17:22:04 | FromDiscord | <Yardanico> and module names must be nim identifiers |
17:22:07 | FromDiscord | <Yardanico> (edit) "and module names must be ... nim" added "valid" |
17:22:55 | Mister_Magister | like, i want to have one program to have one TCP server for communication and one UDP server for discovering TCP server, and i assume i could make them both ASYNC and just do stuff when each of them receives some data |
17:23:10 | Mister_Magister | otherwise i have to use threads |
17:27:50 | FromDiscord | <enthus1ast> then "UDP server for discovering TCP server" could mean that you want to do ip multicast? |
17:28:24 | FromDiscord | <enthus1ast> if yes, then you could have a look at\: https://github.com/enthus1ast/nimMulticast |
17:28:42 | Mister_Magister | not multicast |
17:28:59 | Mister_Magister | also, i fail to find file name naming guidelines |
17:29:38 | FromDiscord | <enthus1ast> then idk what you mean \:) |
17:34:43 | FromDiscord | <dom96> yes, you should be able to have two servers using async |
17:35:02 | FromDiscord | <dom96> but why use UDP for discovery? |
17:38:23 | FromDiscord | <reilly> In reply to @Mister_Magister "also, i fail to": File names just have to be valid Nim identifiers. `file-name` is not a valid identifier because it would not be parsed as a single token, but as `file`, `-`, `name` ("file minus name"). |
17:38:40 | Mister_Magister | oh |
17:38:43 | Mister_Magister | interesting |
17:38:53 | Mister_Magister | @dom96 why not |
17:39:25 | FromDiscord | <reilly> `file_name` is valid, because the underscore character is not used for anything else and causes no ambiguity. |
17:39:36 | Mister_Magister | mhm |
17:42:15 | FromDiscord | <enthus1ast> if you do not use multi/broadcast udp is not needed imho "for discovery", but idk what you're doing, maybe it is.↵One think to keep in mind for udp is that the os cannot tell you if there was someone listening, but for tcp it can |
17:43:12 | Mister_Magister | ofc its broadcast |
17:43:14 | FromDiscord | <enthus1ast> so your application must respond with something |
17:43:18 | Mister_Magister | how would you want to discover it otherwise |
17:43:23 | Mister_Magister | and for broadcast you need udp |
17:43:47 | Mister_Magister | you can't do tcp over broadcast |
17:44:06 | FromDiscord | <enthus1ast> i do not now what "it" is, but you can also do multicast for discovering, thats what i meant |
17:45:01 | FromDiscord | <enthus1ast> @dom96\: is 1.6 already installable via choosenim? |
17:45:11 | FromDiscord | <enthus1ast> latest version is see is 1.4.8 |
17:45:13 | NimEventer | New post on r/nim by al_earner: The virus issue, see https://reddit.com/r/nim/comments/qc6hsz/the_virus_issue/ |
17:45:38 | FromDiscord | <reilly> In reply to @enthus1ast "<@132595483838251008>\: is 1.6 already": Should be, that's what I did. |
17:46:03 | FromDiscord | <reilly> Make sure you're also using the latest version of choosenim: `choosenim update self` |
17:46:25 | FromDiscord | <enthus1ast> a↵choosenim update stable ↵it is |
17:46:43 | Mister_Magister | One question, https://nim-lang.org/docs/asyncnet.html there is proc serve() {.async.} = but i fail to see why is it being executed? asynCheck just adds callback if it fails right? |
17:47:15 | Mister_Magister | or is it because its calling that function it adds to "list of asyncs to process" |
17:47:37 | FromDiscord | <enthus1ast> this example could have use waitFor |
17:47:54 | FromDiscord | <enthus1ast> instead of asyncCheck and runForever |
17:47:56 | Mister_Magister | ye but i wanna keep it async |
17:48:04 | Mister_Magister | waitFor breaks asyncness |
17:48:09 | FromDiscord | <enthus1ast> it still is async |
17:48:10 | FromDiscord | <enthus1ast> no |
17:48:12 | Mister_Magister | yhes |
17:48:22 | FromDiscord | <enthus1ast> not it does not |
17:48:32 | FromDiscord | <enthus1ast> you do not call waitFor INSIDE an async proc |
17:48:53 | Mister_Magister | i mean this code sure but if you were to extend it then waitfor would break tihngs |
17:48:56 | FromDiscord | <reilly> sent a code paste, see https://play.nim-lang.org/#ix=3CkJ |
17:49:05 | Mister_Magister | for example if you wanted to add second serve function |
17:49:50 | Mister_Magister | but ye it doesn't answer my question anyway |
17:51:20 | FromDiscord | <enthus1ast> asynCheck registers the proc to the global dispatcher |
17:51:29 | FromDiscord | <enthus1ast> and runForever runs the async loop |
17:51:47 | Mister_Magister | yee thats what i thought |
17:51:48 | Mister_Magister | thank |
17:52:50 | FromDiscord | <enthus1ast> and if you wanna do your own loop,↵just call poll() every so often |
17:53:10 | Mister_Magister | another question, doesn't infinite loop inside async function break its asyncness? |
17:53:13 | FromDiscord | <enthus1ast> could do this in a eg. gui callback or so |
17:53:28 | FromDiscord | <enthus1ast> you must have a await somewhere |
17:53:37 | FromDiscord | <enthus1ast> eg ↵await sleepAsync(1\_000) |
17:53:43 | Mister_Magister | ah |
17:53:51 | Mister_Magister | await will allow other futures to run |
17:53:56 | FromDiscord | <enthus1ast> yes |
17:54:03 | Mister_Magister | i slowly begin to understand the async |
17:54:15 | Mister_Magister | will try to rewrite my discover example from before into async |
18:09:17 | Mister_Magister | HA IT WORKS |
18:09:20 | Mister_Magister | i love async now |
18:09:23 | Mister_Magister | i finally get it |
18:09:30 | Mister_Magister | thank you guys |
18:10:15 | FromDiscord | <Rika> In reply to @enthus1ast "asynCheck registers the proc": No, merely calling the async proc will register it afaik |
18:10:56 | Mister_Magister | asyncCheck registers callback in case of exception |
18:10:59 | Mister_Magister | thats what docs say |
18:11:24 | FromDiscord | <enthus1ast> yes you're right Rika |
18:14:30 | * | Gustavo6046 quit (Remote host closed the connection) |
18:14:38 | * | Gustavo6046_ joined #nim |
18:16:19 | Mister_Magister | dang i wrote entire client code and it compiled and ran without issue |
18:16:22 | Mister_Magister | holy shite |
18:16:28 | Mister_Magister | you love when that happens |
18:17:40 | Mister_Magister | guys you can be proud of me i understood spirit of async https://gist.github.com/Michal-Szczepaniak/71593051595331bbcbae62a4ce19fb90 |
18:17:53 | * | Gustavo6046_ is now known as Gustavo6046 |
18:18:01 | Mister_Magister | now i have tcp server and udp discovery server without threads |
18:22:32 | Mister_Magister | is it okay to use nonasync methods inside async methods? |
18:24:10 | FromDiscord | <Yardanico> yes, but be aware that if they're CPU intensive they block the whole thread |
18:24:18 | FromDiscord | <Yardanico> so all other background async tasks won't run |
18:25:13 | Mister_Magister | oki |
18:28:09 | Mister_Magister | async simplifies so many things for me |
18:44:04 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3Cl4 |
18:45:15 | FromDiscord | <Yardanico> In reply to @jmgomez "hey guys, so Im": you should compile your nim app with --debugger:native |
18:48:29 | FromDiscord | <RattleyCooper> Anybody have a list of the 15 new stdlib modules that were added? |
18:48:36 | FromDiscord | <RattleyCooper> (edit) "added?" => "added for 1.6?" |
18:48:52 | FromDiscord | <Yardanico> In reply to @RattleyCooper "Anybody have a list": https://github.com/nim-lang/Nim/blob/version-1-6/changelogs/changelog_1_6_0.md#new-and-deprecated-modules |
18:48:56 | FromDiscord | <jmgomez> In reply to @Yardanico "you should compile your": Right, I was doing that |
18:49:07 | FromDiscord | <Yardanico> the blog article shows the link for the full changelog at the bottom |
18:49:09 | FromDiscord | <RattleyCooper> In reply to @Yardanico "https://github.com/nim-lang/Nim/blob/version-1-6/ch": thanks! |
18:50:27 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3Cl6 |
18:50:43 | FromDiscord | <Yardanico> well, -d:debug does nothing and what do you mean "doesn't map symbols well"? |
18:51:06 | FromDiscord | <Yardanico> i mean, it wouldn't be perfect because both Nim and the C compiler optimize a lot of unused stuff away |
18:51:11 | FromDiscord | <jmgomez> https://media.discordapp.net/attachments/371759389889003532/900456129165930536/unknown.png |
18:51:26 | FromDiscord | <Yardanico> and what type is `people`? |
18:51:30 | FromDiscord | <Yardanico> for example |
18:51:52 | FromDiscord | <jmgomez> In reply to @Yardanico "well, -d:debug does nothing": Oh, I just found the cmd line in a repo example |
18:52:02 | FromDiscord | <Yardanico> also, are you sure that nim-gdb is loaded? |
18:52:06 | FromDiscord | <Yardanico> check the debug console |
18:52:10 | FromDiscord | <Yardanico> it should show "Loading Nim Runtime support" |
18:53:36 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3Cl8 |
18:53:40 | FromDiscord | <Yardanico> and yeah, to be honest nim-gdb and nim native debugging isn't really well tested |
18:54:03 | FromDiscord | <Yardanico> In reply to @jmgomez "This is the whole": you need to point miDebuggerPath to nim-gdb |
18:54:10 | FromDiscord | <Yardanico> so full path to the script |
18:54:45 | FromDiscord | <jmgomez> it uses cwd isnt? It is able to pick the target from there without anything else |
18:55:07 | FromDiscord | <jmgomez> Are there any alternatives to debug that I can try out? |
19:00:28 | FromDiscord | <reilly> In reply to @Mister_Magister "async simplifies so many": I was looking at something unrelated and found the exact rules for what counts as an identifier in Nim:↵https://nim-lang.org/docs/manual.html#lexical-analysis-identifiers-amp-keywords |
19:03:10 | FromDiscord | <jmgomez> Magically now works, the strings arent displayed as hex anymore |
19:04:06 | Mister_Magister | @reilly i'm not sure why you pinging me |
19:06:10 | FromDiscord | <reilly> > also, why can't i put - in file name↵You asked about it earlier and I gave a half-answer, but I happened to find the actual specification in case you're interested. |
19:06:35 | Mister_Magister | ah yes |
19:06:38 | Mister_Magister | thanks |
19:07:03 | FromDiscord | <rainbowasteroids> does anyone know how I should turn a seq of bytes/chars into a unicode string? |
19:07:52 | FromDiscord | <leorize> depends on the type of unicode you're looking for |
19:08:06 | FromDiscord | <leorize> if it's utf-8 then just use your byte stream as is |
19:08:36 | FromDiscord | <leorize> if you need utf-16 to deal with windows then winim has widestrings iirc |
19:08:39 | FromDiscord | <enthus1ast> you must know the source encoding, then you can encode it in any other encoding |
19:09:56 | FromDiscord | <Yardanico> In reply to @leorize "if you need utf-16": nim stdlib itself has that :) |
19:10:07 | FromDiscord | <rainbowasteroids> this is what the ID3 docs say\:> All Unicode strings use 16-bit unicode 2.0 (ISO/IEC 10646-1\:1993, UCS-2). Unicode strings must begin with the Unicode BOM ($FF FE or $FE FF) to identify the byte order. |
19:10:07 | FromDiscord | <Yardanico> https://nim-lang.org/docs/widestrs.html |
19:10:11 | FromDiscord | <Yardanico> not exactly well documented |
19:10:48 | FromDiscord | <Yardanico> In reply to @rainbowasteroids "this is what the": I think https://github.com/treeform/encode should work well enough for you |
19:10:54 | FromDiscord | <Yardanico> its simple enough] |
19:10:55 | FromDiscord | <Yardanico> (edit) "enough]" => "enough" |
19:12:07 | FromDiscord | <Yardanico> `fromUTF16LE` specifically |
19:17:54 | FromDiscord | <Yardanico> ah sorry just `fromUTF16` since it reads the byte marker by itself |
19:57:06 | FromDiscord | <treeform> byte order marker is so annoying, but my function will deal with it. |
20:13:25 | FromDiscord | <juan_carlos> BOM go Boom |
20:35:50 | FromDiscord | <deech> Can I use `genAst` to generate "parts" of a type so I can assemble however I want? eg. I'd like a `tuple[i:int, s:string, ...]` but I'd like to produce it in a macro which takes something like `@[("i","int"),("s","string"), ...]`. I realize this can be done with `newColonExpr` but this seems more convenient if it can be done. |
21:06:55 | arkanoid | I'm doing the "smallest statically linked hello world possible game", and I'm realizing that upx fails to compress musl statically linked binaries |
21:07:29 | FromDiscord | <Yardanico> upx doesn't compress really small files, yeah, I tried before ;) |
21:07:40 | arkanoid | oh, well, old bug https://github.com/upx/upx/issues/309 |
21:07:48 | FromDiscord | <Yardanico> this one is fixed |
21:08:01 | FromDiscord | <Yardanico> and it's 30kb |
21:08:10 | FromDiscord | <Yardanico> a fully static nim musl hello world binary can be 5kb |
21:08:17 | arkanoid | is "nim --gc:arc -d:release --opt:size --gcc.exe:musl-gcc --gcc.linkerexe:musl-gcc --passL:-static -o:hello_static_musl c hello.nim" the best I can do? |
21:08:39 | FromDiscord | <Yardanico> what size do you get? |
21:08:41 | FromDiscord | <Yardanico> also -d:danger |
21:08:46 | FromDiscord | <Yardanico> also --panics:on |
21:08:48 | FromDiscord | <Yardanico> also -flto |
21:09:00 | FromDiscord | <Yardanico> read the blog post :P |
21:09:14 | FromDiscord | <Yardanico> and this repo https://github.com/ee7/binary-size |
21:11:51 | arkanoid | oh! |
21:12:00 | arkanoid | zigcc? |
21:12:27 | FromDiscord | <Yardanico> it's a wrapper script for `zig cc` since nim doesn't like compiler commands with space in the name |
21:13:38 | arkanoid | I'm getting much larger binaries |
21:13:44 | arkanoid | but nim 1.6.0 here |
21:14:30 | FromDiscord | <Yardanico> with all the same configs? |
21:14:40 | FromDiscord | <Yardanico> are you sure you're executing the correct command for 4kb? |
21:16:15 | FromDiscord | <Yardanico> I just tested and I get a 4960 bytes binary after the last 4kb command + `strip -s file` |
21:16:18 | arkanoid | no as I'm not even near that. I've a script that tests both glibc and musl, and I'm getting 784K for statically compiled glibc and 26K for musl |
21:16:44 | arkanoid | and with strip -s at the end for both |
21:16:51 | FromDiscord | <Yardanico> well, as you can check in the repo, it uses a lot of additional arguments |
21:17:06 | FromDiscord | <Yardanico> e.g. -d:useMalloc makes nim use malloc instead of its own memory allocator |
21:17:23 | FromDiscord | <Yardanico> --panics:on turns all Defect exceptions into unrecoverable panics |
21:17:26 | FromDiscord | <Yardanico> and so on |
21:20:43 | arkanoid | this is the script I'm using now: https://termbin.com/t5vb |
21:21:15 | arkanoid | according to that table, I should get glibc version 18KB |
21:21:27 | FromDiscord | <Yardanico> no |
21:21:42 | FromDiscord | <Yardanico> the 18kb is dynamically linked with glibc |
21:22:03 | FromDiscord | <Yardanico> the 18kb with static is with musl-clang |
21:22:20 | FromDiscord | <Yardanico> there are two 18kb entries in the table, look carefully :) one is glibc dynamically linked, the other is musl-clang statically linked |
21:22:38 | FromDiscord | <Yardanico> statically-linked glibc will be huge obviously |
21:22:58 | arkanoid | isn't --passL:-s for static? |
21:23:12 | FromDiscord | <Yardanico> that's stripping |
21:23:14 | FromDiscord | <Yardanico> static is -static |
21:23:24 | arkanoid | oh! |
21:29:12 | arkanoid | I should now be in the 22KB case but I'm geetting 26KB https://termbin.com/fjxw |
21:29:44 | FromDiscord | <Yardanico> well, "should" is a broad term |
21:29:49 | FromDiscord | <Yardanico> different compiler versions, musl versions, etc |
21:30:31 | arkanoid | also copypasting that line is 26KB |
21:30:42 | arkanoid | well, not a problem, very happy with this result |
21:30:44 | FromDiscord | <Yardanico> also try stripping still |
21:30:47 | FromDiscord | <Yardanico> `strip -s file` |
21:30:53 | FromDiscord | <Yardanico> `-s` option for gcc doesn't do all of the stripping |
21:31:38 | arkanoid | I've already tried but still 26KB |
21:31:57 | FromDiscord | <Yardanico> well, i can't help |
21:32:08 | FromDiscord | <Yardanico> complain to your nearest musl-gcc maintainer :P |
21:32:39 | arkanoid | with devel upx --best down to 13KB |
21:32:50 | arkanoid | btw really impressive |
21:33:02 | arkanoid | now I can join the demoscene! |
21:33:04 | arkanoid | or maybe not |
21:34:27 | FromDiscord | <Yardanico> does demoscene allow for upx? |
21:34:40 | FromDiscord | <Yardanico> also see https://github.com/demotomohiro/nim-4k-intro-sample |
21:36:33 | FromDiscord | <enthus1ast> @Yardanico\: https://github.com/runestubbe/Crinkler |
21:44:10 | FromDiscord | <DMI-1407> is there already a git api for nim ? |
21:44:18 | FromDiscord | <IsaacPaul> so for c the compiler can remove dead code if you make it separate functions and data with `-ffunction-sections -fdata-sections` then use `--gc-section` to make the linker include only the sections that are (transitively) dependent on an explicitly included section |
21:44:38 | FromDiscord | <IsaacPaul> (edit) "compiler" => "linker" |
21:44:47 | FromDiscord | <Yardanico> but is that better than lto + strip? |
21:44:59 | FromDiscord | <IsaacPaul> No idea haha |
21:47:10 | arkanoid | I'll leave the task to the pro to find out |
21:47:22 | arkanoid | I'm already quite happy with that |
21:47:45 | arkanoid | are there out major knows issues with nim + musl? |
21:50:20 | FromDiscord | <Yardanico> don't think so |
21:57:50 | * | Vladar quit (Quit: Leaving) |
22:02:11 | FromDiscord | <leorize> https://github.com/disruptek/gittyup↵(@DMI-1407) |
22:02:40 | FromDiscord | <DMI-1407> ah nice 🤩 |
22:05:38 | FromDiscord | <demotomohiro> sent a long message, see http://ix.io/3ClV |
22:10:03 | arkanoid | thanks! |
22:20:00 | arkanoid | this thing that demoscene tends to work with windows has always puzzled me |
22:20:53 | * | koltrast_ quit (Quit: ZNC - http://znc.in) |
22:21:15 | * | koltrast joined #nim |
22:22:54 | FromDiscord | <Yardanico> @arkanoid maybe it has to do with the fact that windows has a lot of built-in APIs whereas in Linux libraries are separate from the kernel, so there could be a lot of arguing about "should GTK libraries be counted towards the size" or something similar |
22:27:32 | arkanoid | but I bet most of the scenes are opengl based |
22:29:22 | * | mahlon quit (Ping timeout: 252 seconds) |
22:29:56 | arkanoid | glutCreateWindow is all you need, obviously stripping down everthing else ... I guess |
22:32:39 | * | mahlon joined #nim |
22:38:38 | arkanoid | Yardanico: here it says SDL2 or GTK3 https://benjamin-computer.medium.com/my-first-demoscene-production-6d426764ad22 |
22:53:44 | Mister_Magister | Gotta update nim in opensuse cause noone actively maintains it |
22:53:52 | Mister_Magister | and i need newer version :P |
22:54:09 | Mister_Magister | "but why don't you just use choosenim" arm |
22:54:40 | FromDiscord | <Yardanico> seems like someone does maintain it |
22:54:41 | FromDiscord | <Yardanico> https://build.opensuse.org/package/show/home%3Atux93%3Aleap/nim |
22:55:16 | Mister_Magister | its in some guys home repo |
22:55:19 | Mister_Magister | so no, doesn't seem so |
22:57:00 | FromDiscord | <Yardanico> well you said "maintain", and it's maintained in his home repo :) |
22:57:43 | Mister_Magister | not really no |
22:58:00 | Mister_Magister | anyway i'll be updating it soon |
22:58:19 | Mister_Magister | i'm already contributor :P |
23:47:04 | Mister_Magister | https://build.opensuse.org/request/show/926630 now we waitin |