00:02:40 | * | auxym_ quit (Ping timeout: 240 seconds) |
00:03:01 | FromDiscord | <Elegantbeef> Uhh smokebomb |
00:03:22 | * | auxym_ joined #nim |
00:04:17 | nrds | <Prestige99> Haha oh |
00:05:52 | FromDiscord | <Elegantbeef> I wanted to run it but i never got around to making it work with the gnome keyrin |
00:06:05 | FromDiscord | <Elegantbeef> So everytime i use it just logs me out of my accounts and it's not fun |
00:09:20 | nrds | <Prestige99> Wait, do you have to do something specific for the gnome keyring? |
00:09:49 | FromDiscord | <Elegantbeef> Uncertain, think you need to start a daemon but i was getting too tired of getting logged out of the accounts to test |
00:10:41 | nrds | <Prestige99> Can you just do it in xephyr? Maybe not since you are already logged in... I never had a problem with it, so idk |
00:10:57 | nrds | <Prestige99> Maybe some verbose logging |
00:12:05 | FromDiscord | <Elegantbeef> I dont know what you mean verbose logging |
00:13:45 | nrds | <Prestige99> Just to find out why you are getting logged out. I just have to enter my password in the gnome key ring GUI |
00:16:30 | FromDiscord | <Elegantbeef> Well i think it's just how i have my wm log me in maybe, doesnt call the proper xinit stuff |
00:20:24 | arkanoid | Elegantbeef, I've successfully converted the template into a macro (quote do and replace vars with `vars` basically). I've also turned the wannabe generated proc name into a myProcName: static[string] macro argument. I do the required transformation of the string before the "quote do", but I'm failing to use the name inside it |
00:22:33 | arkanoid | I keep getting errors on the first like of the quote do like "Error: identifier expected, but found '"getNetworkInterfaces"'" where the string is the wannabe name of the generated proc |
00:22:47 | FromDiscord | <Elegantbeef> If a picture could speak a thousand words why cannot i not see the code? |
00:23:59 | arkanoid | Elegantbeef: https://play.nim-lang.org/#ix=3wSj |
00:24:39 | FromDiscord | <Elegantbeef> you're trying to use a strlit as an ident |
00:25:07 | FromDiscord | <Elegantbeef> `let nameIdent = ident(name)` then use `nameIdent` |
00:25:35 | FromDiscord | <Elegantbeef> what you're doing is writing `proc "getNetworkInterfaces"(args)` instead of `proc getNetworkInterfaces(args)` |
00:26:11 | arkanoid | it works! |
00:26:33 | arkanoid | yes it makes sense, strLit is not ident |
01:06:06 | * | ozzz quit (Ping timeout: 268 seconds) |
01:18:27 | * | auxym_ quit (Ping timeout: 240 seconds) |
01:37:17 | FromDiscord | <JSONBash> In reply to @arkanoid "<@145405730571288577>: https://play.nim-lang.org/#i": are you doing a soap interfacing? |
01:42:28 | FromDiscord | <codic> gnome keyring works fine for me |
02:01:23 | nrds | <Prestige99> we mean on beef's wm |
02:01:29 | nrds | <Prestige99> guess there's an issue |
02:02:23 | FromDiscord | <Elegantbeef> Yea i'm missing something on startup, prestige are you using a login manager? |
02:02:53 | nrds | <Prestige99> nope just startx |
02:18:58 | * | arkurious quit (Quit: Leaving) |
02:31:40 | nrds | <Prestige99> hbu Elegantbeef |
02:36:33 | FromDiscord | <Termer> Hi, how would I go about importing two modules which have the same name, but are in different places? |
02:37:01 | FromDiscord | <Termer> I have `tm_client/private/objects` and `objects` (which is in the same directory as the module I'm importing in) |
02:37:05 | FromDiscord | <Termer> but I can only import noe |
02:37:07 | FromDiscord | <Termer> (edit) "noe" => "one" |
02:37:22 | FromDiscord | <Termer> is there some way to import both, possibly one under an alias? |
02:38:20 | nrds | <Prestige99> import foo as bar ? |
02:38:29 | FromDiscord | <Termer> oh, thanks |
02:40:45 | * | def- quit (Quit: -) |
02:42:32 | * | def- joined #nim |
02:44:31 | FromDiscord | <Rika> you can use relative directories in import names |
03:33:33 | * | rockcavera quit (Remote host closed the connection) |
04:06:02 | * | supakeen quit (Quit: WeeChat 3.2) |
04:06:31 | * | supakeen joined #nim |
04:29:18 | FromDiscord | <codic> > <Prestige> we mean on beef's wm↵yeah I meant I didn't need to do anything special |
04:47:56 | FromDiscord | <retkid> at first i was like |
04:48:14 | FromDiscord | <retkid> "kinda lame we have to make our own iterators, theres not much to do besides just copy pasta the same 5 lines"\ |
04:48:23 | FromDiscord | <retkid> then i was like "holy shit this is actually amazing" |
04:49:10 | FromDiscord | <retkid> because, yes like 90% of the time its just the same 5 lines, but it gives you control over how your code looks, and also you can do really efficient code via not mincing and chaining loops |
04:50:17 | FromDiscord | <Yardanico> btw, if you actually want some pre-defined efficient chaining, there's https://github.com/zero-functional/zero-functional |
04:50:18 | nrds | <R2D299> itHub: 7"A library providing zero-cost chaining for functional abstractions in Nim." |
04:50:40 | FromDiscord | <retkid> why not just make my own library with all the loops i will ever need as i need them |
04:51:05 | FromDiscord | <retkid> oh |
04:51:10 | FromDiscord | <retkid> because theres a fuckton of loops here |
05:18:10 | * | kayabaNerve_ quit (Ping timeout: 252 seconds) |
05:25:45 | FromDiscord | <linux user> nim and js same color |
05:25:50 | FromDiscord | <linux user> colour |
05:28:58 | FromDiscord | <Rika> Discussed before already |
05:45:24 | FromDiscord | <Yardanico> @linux user different :) |
05:45:41 | FromDiscord | <Yardanico> also we had to change the color before GitHub removed the similar color rule |
05:46:01 | FromDiscord | <Yardanico> (in the past you couldn't have a language with the color that's too similar to another language's color) |
05:46:07 | FromDiscord | <Yardanico> but now that restriction doesn't exist |
05:46:49 | FromDiscord | <Yardanico> @linux user see https://forum.nim-lang.org/t/6350 https://github.com/github/linguist/pull/4866 and https://github.com/github/linguist/pull/4900 for more context |
05:47:38 | FromDiscord | <Yardanico> lemme find a project with both nim and js to show you the difference |
05:49:24 | FromDiscord | <Yardanico> @linux user this is how a project with 50% nim 50% js would look like (edited html manually for 50/50 distribution) https://media.discordapp.net/attachments/371759389889003532/879965661944758292/unknown.png |
05:50:19 | FromDiscord | <Yardanico> and on light github theme https://media.discordapp.net/attachments/371759389889003532/879965891230564363/unknown.png |
05:50:47 | FromDiscord | <Bren> Is there a matrix protocol sdk for nim? |
05:51:12 | FromDiscord | <Yardanico> don't think so |
05:51:39 | FromDiscord | <Elegantbeef> Someone was working on one but idk how that's went |
05:52:11 | FromDiscord | <linux user> owo |
05:53:52 | FromDiscord | <linux user> i cant beleie it had cow poop green |
05:53:54 | FromDiscord | <linux user> bruh |
05:54:37 | FromDiscord | <Yardanico> that was set by some github employee in like 2012 |
05:54:52 | FromDiscord | <Yardanico> but it wasn't that bad as you're describing it :) |
06:03:18 | FromDiscord | <Clonkk> https://without.boats/blog/the-problem-of-effects/ an interesting read about effects in programming language |
06:13:05 | FromDiscord | <Rika> If you say it’s interesting then I shall read it |
06:16:36 | FromDiscord | <Rika> It’s fine, but it need some intermediate knowledge about Rust |
06:19:56 | * | PMunch joined #nim |
06:39:34 | FromDiscord | <enthus1ast> i started one but its more like "i throw stuff in there when i need it" and no encryption, and exactly like this it looks ;) .↵https://github.com/enthus1ast/nimMatrix |
06:39:35 | nrds | <R2D299> itHub: 7"matrix chat client library" |
06:40:16 | FromDiscord | <enthus1ast> BUT i use it |
06:54:47 | * | jjido joined #nim |
07:05:53 | * | ozzz joined #nim |
07:06:02 | * | max22- joined #nim |
07:12:21 | FromDiscord | <gogolxdong (liuxiaodong)> How to listen on all address for http/https with Jester or prologue? |
07:13:13 | madprops | if you mean without a port you'd have to reverse proxy i think |
07:13:47 | PMunch | @gogolxdong, what do you mean all addresses? |
07:21:17 | FromDiscord | <enthus1ast> you must listen on 0.0.0.0 |
07:26:21 | * | kayabaNerve joined #nim |
07:44:02 | FromDiscord | <ondrejoda> good morning |
07:44:21 | FromDiscord | <Ondrejoda> hey there |
07:44:40 | FromDiscord | <Ondrejoda> how are you? |
07:44:46 | FromDiscord | <ondrejoda> i'm good |
07:45:18 | FromDiscord | <Elegantbeef> Someone's gone mad |
07:45:26 | FromDiscord | <ondrejoda> yeah, kinda |
07:45:35 | FromDiscord | <ondrejoda> i was just testing what would discord do |
07:45:45 | FromDiscord | <ondrejoda> when i would type in the matrix room |
07:46:51 | FromDiscord | <ondrejoda> and it does seem to work |
07:47:02 | FromDiscord | <ondrejoda> so yeah |
07:47:12 | FromDiscord | <ondrejoda> kind of a cool feature i guess |
07:50:27 | * | stkrdknmibalz quit (Quit: WeeChat 3.0.1) |
07:52:52 | * | stkrdknmibalz joined #nim |
08:06:56 | PMunch | Hmm, is Matrix also bridged through Discord? |
08:07:27 | PMunch | Because to me it appears like you're two different accounts on Discord with the same name just capitalized differently talking to each other |
08:07:54 | FromDiscord | <Elegantbeef> Yea it is |
08:26:58 | FromDiscord | <Rika> Lol |
08:27:04 | FromDiscord | <Rika> That’s hilarious |
08:37:47 | PMunch | Hmm, would this cause a string copy? http://ix.io/3wTy/nim |
08:38:38 | FromDiscord | <Elegantbeef> It should not afaik |
08:39:19 | PMunch | Nice |
08:39:38 | FromDiscord | <ondrejoda> yeah, i got somewhat confused by this |
08:40:12 | FromDiscord | <ondrejoda> and that there was no issue with the same names |
08:42:26 | arkanoid | what's the most convenient way to pass args to a proc generating macro that describes the input arguments of the generated proc? |
08:43:06 | FromDiscord | <haxscramper> I'd just pass proc signature and unparse it in macro |
08:43:32 | FromDiscord | <haxscramper> `macroCall(proc(arg1: int): ReturnType {.MaybeSomeSideEffects.})` |
08:43:59 | arkanoid | witty idea! thanks! |
08:46:20 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
09:19:06 | arkanoid | I have noob question about macros. I have a NimNode of kind nnkProcDef, I need to modify it's nnkFormalParams tree, what's the correct way to access it? I see that it is the 4th child of the nnkProcDef, is it correct to do myProcDef[3]? is there a better way to navigate AST? |
09:31:08 | FromDiscord | <haxscramper> https://nim-lang.org/docs/macros.html#params%2CNimNode |
09:31:17 | FromDiscord | <haxscramper> But usually you do `[3]` |
09:31:32 | FromDiscord | <haxscramper> If you want to deconstruct proc you can use pattern matching |
09:31:48 | FromDiscord | <haxscramper> https://nim-lang.github.io/fusion/src/fusion/matching.html#tree-matching |
09:34:59 | arkanoid | thanks! |
09:35:04 | FromDiscord | <haxscramper> https://github.com/haxscramper/hack/blob/master/testing/nim/compilerapi/test5.nim#L31 |
09:35:23 | arkanoid | but if NimNode is a variant objects, shouldn't it have attributes specific for it's kind? |
09:35:38 | arkanoid | I mean something like myProcDefNode.formalParams |
09:36:15 | arkanoid | or maybe not as it's just a tree of nodes |
09:42:01 | FromDiscord | <haxscramper> It does not have specific attributes, it is a homogeneous ast |
09:42:19 | FromDiscord | <haxscramper> There are some helper procs like `std/macros.params` |
09:43:52 | arkanoid | now I unserstand why you added many many utility funcs for that in your runtime ast generator library |
09:45:47 | FromDiscord | <haxscramper> yes |
09:46:10 | FromDiscord | <haxscramper> Actually I support both use case - homogenous AST via helper functions |
09:46:43 | FromDiscord | <haxscramper> And more structured one that has everything put in separate fields |
09:46:53 | arkanoid | I'm actually puzzle if I should use the helper functions, or just program the way dumpAstGen prints |
09:46:57 | arkanoid | *puzzled |
09:49:45 | FromDiscord | <ondrejoda> how do i do pointers in nim? |
09:50:19 | FromDiscord | <ondrejoda> i'm asking because i am using this sdl `getMouseState()` function and it takes in 2 int pointers |
09:51:06 | FromDiscord | <Yardanico> if you're using sdl2 from nim-lang, you don't need pointers, it has two overloads for getMouseState |
09:51:11 | FromDiscord | <Yardanico> although I'm not sure how correct that usage is |
09:51:14 | FromDiscord | <Yardanico> it has proc getMouseState(x, y: var cint): uint8 {.importc: "SDL_GetMouseState", discardable.} |
09:51:30 | FromDiscord | <Yardanico> so you can do `var x, y: int; getMouseState(x, y)` |
09:51:39 | FromDiscord | <Yardanico> (sent as one line for chat purposes) |
09:51:45 | FromDiscord | <ondrejoda> well i did |
09:52:01 | FromDiscord | <Yardanico> ah sorry, not int but cint |
09:52:06 | FromDiscord | <ondrejoda> and it gives me an error |
09:52:16 | FromDiscord | <ondrejoda> huh |
09:52:16 | FromDiscord | <ondrejoda> cint works |
09:52:21 | FromDiscord | <ondrejoda> gimme a sec |
09:52:22 | FromDiscord | <Yardanico> yeah, because nim's int is not cint |
09:52:42 | FromDiscord | <Yardanico> cint is C's int which is 32-bit even on 64-bit platforms |
09:52:46 | FromDiscord | <Yardanico> nim's int is arch-dependent |
09:53:25 | * | arkanoid raises finger: cint stands for compatible int, not C int! |
09:53:37 | arkanoid | I actually are the noob here, just a joke |
09:53:38 | FromDiscord | <haxscramper> It stands for common int |
09:53:46 | FromDiscord | <haxscramper> cstring is a common string |
09:53:55 | FromDiscord | <ondrejoda> so the var x, y\:cint getMouseState(x, y) doesn't work |
09:54:05 | FromDiscord | <haxscramper> In reply to @arkanoid "I'm actually puzzle if": It depends on your particular use case. For large blocks of code with some injections I use `quote do` (or my own reimplementation). When I need more sophisiticated logic I get to `newTree()` and helper pocs |
09:54:09 | FromDiscord | <Yardanico> then that usage is indeed incorrect I guess |
09:54:13 | FromDiscord | <Yardanico> @ondrejoda then just use it like this |
09:54:21 | FromDiscord | <Yardanico> var x,y: cint; getMouseState(addr x, addr y) |
09:54:29 | FromDiscord | <haxscramper> When I need some nuclear-tear AST transforms I start to add IR that also has own helper functions |
09:54:31 | FromDiscord | <ondrejoda> ah |
09:54:36 | FromDiscord | <Yardanico> addr is for getting a pointer of a variable |
09:54:38 | FromDiscord | <ondrejoda> now that is what i was looking for |
09:54:50 | FromDiscord | <ondrejoda> so addr acts like \ or & in c++? |
09:54:52 | FromDiscord | <Yardanico> yes |
09:54:53 | FromDiscord | <haxscramper> If you want to look at what complicated macros looks like you can see pattern matching implementation and accompanying article |
09:54:55 | FromDiscord | <Yardanico> kind of |
09:55:11 | FromDiscord | <haxscramper> In reply to @ondrejoda "so addr acts like": `addr` is `&`, `expr[]` is `expr` |
09:55:17 | FromDiscord | <ondrejoda> and yes i do know that pointers and references are two different things |
09:56:42 | FromDiscord | <Yardanico> @haxscramper do you think it's valid to do `var cint` for arguments that expect a pointer to a variable on the C side? |
09:56:47 | FromDiscord | <Yardanico> because apparently sdl2 package has an overload like this |
09:57:01 | FromDiscord | <Yardanico> multiple actually |
09:58:55 | FromDiscord | <haxscramper> If compiled to C there is no other way to get `var cint` semantics so yes |
09:59:05 | FromDiscord | <haxscramper> I would assume it is safe to do so |
09:59:15 | FromDiscord | <ondrejoda> praise the person that came up with `any` |
09:59:17 | FromDiscord | <Yardanico> well I just mean that it's essentially relying on an implementation detail but it's highly unlikely to change :P |
09:59:21 | FromDiscord | <Yardanico> @ondrejoda that's not what you think it is |
09:59:34 | FromDiscord | <ondrejoda> In reply to @Yardanico "<@!533966976754909216> that's not what": for proc input args? |
09:59:36 | FromDiscord | <haxscramper> In reply to @Yardanico "well I just mean": yes, it is a bad style by all accounts |
09:59:49 | FromDiscord | <Yardanico> In reply to @Ondrejoda "for proc input args?": for proc arguments it'll essentially create a new instantiation of a proc for every type of that argument |
09:59:49 | FromDiscord | <haxscramper> not everyone knows that `var == ptr` if you compile to C |
10:00:10 | FromDiscord | <Yardanico> it's not a dynamic type, all typing is still static even with `any` |
10:00:15 | FromDiscord | <Yardanico> lemme show you what I mean |
10:00:22 | FromDiscord | <ondrejoda> i think i know what you mean |
10:01:04 | FromDiscord | <ondrejoda> if i have a proc like this `proc something(x, y:any)`↵it makes all of the possible combinations |
10:01:07 | FromDiscord | <ondrejoda> right? |
10:01:11 | FromDiscord | <Yardanico> yes, essentially |
10:01:14 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3wTO |
10:01:24 | FromDiscord | <Yardanico> here test and test2 are effectively the same, it's just that test is a bit shorter |
10:01:26 | FromDiscord | <ondrejoda> so i should use templates? |
10:01:42 | FromDiscord | <haxscramper> what `something` does exactly? |
10:01:50 | FromDiscord | <ondrejoda> lemme show you |
10:01:56 | FromDiscord | <haxscramper> I doubt it is really "can accept any type" proc |
10:02:06 | FromDiscord | <ondrejoda> sent a code paste, see https://play.nim-lang.org/#ix=3wTP |
10:02:08 | FromDiscord | <Yardanico> uhh |
10:02:12 | FromDiscord | <Yardanico> what you want is SomeInteger probably |
10:02:12 | FromDiscord | <haxscramper> `T: SomeInteger` |
10:02:32 | FromDiscord | <ondrejoda> but then again, i sometimes pass a mix of floats and ints |
10:02:45 | FromDiscord | <Yardanico> In reply to @Ondrejoda "but then again, i": then SomeNumber |
10:02:50 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3wTR |
10:02:50 | FromDiscord | <ondrejoda> ah |
10:02:52 | FromDiscord | <Yardanico> !eval (5.0).cint |
10:02:54 | NimBot | Compile failed: /usercode/in.nim(1, 6) Error: expression 'cint(5.0)' is of type 'cint' and has to be used (or discarded) |
10:02:57 | FromDiscord | <ondrejoda> now i didn't know that that existed |
10:03:01 | FromDiscord | <Yardanico> yeah, that works apparently |
10:03:07 | FromDiscord | <Yardanico> In reply to @Ondrejoda "now i didn't know": and no need for `void` return type :) |
10:03:14 | FromDiscord | <ondrejoda> k |
10:03:32 | FromDiscord | <Yardanico> see some generic types here https://nim-lang.org/docs/system.html#SomeSignedInt |
10:03:34 | FromDiscord | <Yardanico> and below |
10:03:46 | FromDiscord | <ondrejoda> huh |
10:03:50 | FromDiscord | <ondrejoda> sent a code paste, see https://play.nim-lang.org/#ix=3wTp |
10:04:02 | FromDiscord | <Yardanico> yeah, because with what I sent you all types must be of the same type |
10:04:06 | FromDiscord | <Yardanico> or even with your any example |
10:04:10 | FromDiscord | <Yardanico> the proper fix would be this: |
10:04:44 | FromDiscord | <Yardanico> but again, IMO in this case you can just make it a template |
10:04:49 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3wTS |
10:05:19 | FromDiscord | <Yardanico> and about why you need separate arguments - if you have "x, y, x1, x2: SomeNumber" it means that all of those arguments must be of one type that is a part of SomeNumber |
10:05:37 | FromDiscord | <ondrejoda> sent a code paste, see https://play.nim-lang.org/#ix=3wTU |
10:05:45 | FromDiscord | <ondrejoda> no wait |
10:05:46 | FromDiscord | <Yardanico> no, that'll be the same as SomeNumber |
10:05:55 | FromDiscord | <Yardanico> as my SomeNumber example |
10:06:04 | FromDiscord | <ondrejoda> there |
10:06:09 | FromDiscord | <ondrejoda> sent a code paste, see https://paste.rs/ZLR |
10:06:29 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3wTW |
10:06:34 | FromDiscord | <Yardanico> ah wait sorry |
10:06:36 | FromDiscord | <Yardanico> that won't work obviously |
10:06:50 | FromDiscord | <ondrejoda> yeah, i still get that error |
10:06:52 | FromDiscord | <Yardanico> because in the end it's still the same as specifying "x, y, x1, x2: SomeNumber" |
10:06:55 | FromDiscord | <Yardanico> because you have only one T |
10:07:08 | FromDiscord | <Yardanico> so you must have 4 arguments specifying the type in each |
10:07:15 | FromDiscord | <Yardanico> as i said, you might as well just make it a template |
10:07:15 | FromDiscord | <ondrejoda> so i need to have [T, T1, T2, T3]? |
10:07:17 | FromDiscord | <Yardanico> yes |
10:07:29 | * | max22- quit (Remote host closed the connection) |
10:07:59 | FromDiscord | <ondrejoda> yeah, that works |
10:08:09 | FromDiscord | <ondrejoda> thanks for the help! |
10:08:11 | FromDiscord | <Yardanico> you might want to skim over https://nim-lang.org/docs/manual.html#generics for more info about generics |
10:08:21 | * | max22- joined #nim |
10:17:30 | FromDiscord | <enthus1ast> i'm currently fighting with a webcrawler it seems that std/htmlparser is not capable of parsing this cra\. ↵Is the fusion/htmlparser any different? |
10:17:59 | FromDiscord | <Yardanico> I think it does have some differences, but not a lot |
10:18:00 | FromDiscord | <enthus1ast> when i diff them they seem quite similar. |
10:18:40 | FromDiscord | <enthus1ast> mh yeah |
10:18:51 | FromDiscord | <enthus1ast> it think i just regex everyhting then \:/ |
10:24:07 | * | stkrdknmibalz quit (Quit: WeeChat 3.0.1) |
10:44:08 | * | auxym_ joined #nim |
10:45:13 | PMunch | @dom96, you around? |
10:50:56 | madprops | can I use block to continue a parent loop? |
10:50:59 | madprops | i have a for inside a for |
10:51:11 | madprops | i want to trigger continue on the parent loop |
10:51:23 | madprops | not just break the inner loop |
10:54:26 | PMunch | You can use a named block that you can break from the inside loop |
10:54:45 | PMunch | If that block extends to the end of the outer for loop that would essentially be the same as a continue |
10:58:05 | madprops | ah cool |
11:00:59 | madprops | I'm trying to add `block exit: discard` at the end |
11:01:05 | madprops | and before that `break exit` but it fails |
11:01:23 | madprops | undeclared identifier |
11:03:28 | PMunch | You have to put your stuff within the block and then you can use `break` to get out of it |
11:08:21 | PMunch | madprops, something like this: https://play.nim-lang.org/#ix=3wUe |
11:08:38 | madprops | yeah, thanks |
11:16:31 | NimEventer | New thread by Kalbhairab: A == b == c format, see https://forum.nim-lang.org/t/8364 |
11:16:50 | arkanoid | Can macros emit code in specific module without generating nim files? |
11:17:53 | FromDiscord | <Rika> You mean macros generating code across another file? |
11:17:59 | FromDiscord | <Rika> I’ve never seen such a thing |
11:19:57 | arkanoid | let me explain. I N xml files, each would generate a nim module. If I would put all the generated code into a single module I'd have overlapping proc names. I'd surely append a prefix to proc names, but it'd be nicer using modules |
11:20:43 | FromDiscord | <enthus1ast> if you want to save the generated nim ast as a nim file your can just print it into a file |
11:22:40 | * | auxym_ quit (Ping timeout: 240 seconds) |
11:22:47 | FromDiscord | <Rika> If you put it into separate modules, you would still have overlapping proc names, and it would probably still be annoying to fully qualify your procs |
11:22:57 | FromDiscord | <Rika> Can you not make them bound to a type? |
11:23:07 | FromDiscord | <Rika> Like perhaps each file is a certain type |
11:23:14 | FromDiscord | <Rika> Because it feels like that would work better |
11:23:49 | arkanoid | no, the splitting logic is namespace |
11:23:53 | arkanoid | not type |
11:24:25 | arkanoid | but you're right, I'd have overlapping proc anyway in the logic if two modules are imported at same time |
11:24:46 | arkanoid | maybe adding prefix is not so bad |
11:26:10 | * | Vladar joined #nim |
11:28:38 | FromDiscord | <Rika> I know, but modules are not exactly namespaces |
11:29:57 | arkanoid | I should create mock type (empty object) just to differentiate procs? I surely can |
11:34:16 | FromDiscord | <Rika> Maybe? You can also, like, use the types for, uh, type stuff |
11:34:22 | FromDiscord | <Rika> Unless you don’t need to I guess |
11:34:52 | arkanoid | let's see what feels better |
11:50:12 | PMunch | Hmm, how do people deal with wrapped libraries and updates? |
11:51:24 | PMunch | For reference I have written a dynamic library in Nim, for this I have created definitions for my C types in Nim. But whenever the library updates there is a chance that they have added a field to an object which then causes my program to segfault or read the wrong data |
11:54:08 | PMunch | I tried to set up c2nim to make the bindings automatically, but the sources are too complex for it to handle |
11:57:00 | PMunch | Hmm, I could set up a test in C that just outputs the sizes and offsets of all the types and fields, and then a similar thing for Nim, and make a diff thing part of my tests |
11:57:39 | arkanoid | PMunch: isn't gintro doing something similar? |
12:00:09 | PMunch | I don't think so, not exactly sure how gintro works |
12:00:27 | PMunch | @StefanSalewski might be able to shed some light on it |
12:00:47 | NimEventer | New thread by Mareklachbc: Does Nim have anything equivalent to Ruby's puts, or Python's print, or Perl's say?, see https://forum.nim-lang.org/t/8365 |
12:01:50 | arkanoid | I'm not into gtk, but I know gintro reads some xml files to generate nim code, and does that when you install gintro |
12:02:23 | arkanoid | xml from libgtk/libgobject, not from gintro |
12:06:01 | * | supakeen quit (Quit: WeeChat 3.2) |
12:06:29 | * | supakeen joined #nim |
12:19:52 | FromDiscord | <MrOkram> When trying to statically compile with "re" library imported it compiles fine but when i try to run it i get "could not load: libpcre.so(.3|.1|)", any recommendations or replacement for that lib ? |
12:22:08 | FromDiscord | <Yardanico> Pure-nim regex - https://github.com/nitely/nim-regex |
12:22:10 | nrds | <R2D299> itHub: 7"Pure Nim regex engine. Guarantees linear time matching" |
12:22:35 | FromDiscord | <Yardanico> https://nitely.github.io/nim-regex/regex.html |
12:24:51 | * | jjido joined #nim |
12:24:53 | FromDiscord | <MrOkram> Thanks, that did the trick. |
12:25:52 | FromDiscord | <Yardanico> also, i'm curious because you said you need to compile your project for routers - what's the project's purpose? of course you don't have to answer if it's a private matter :) |
12:27:01 | FromDiscord | <MrOkram> In reply to @Yardanico "also, i'm curious because": I work at an ISP, we needed something that can run on the end router and send periodic updates to some API, it needed to be light and fast and that's where Nim came into play (Also, not really into coding C/C++ |
12:27:06 | FromDiscord | <MrOkram> (edit) "In reply to @Yardanico "also, i'm curious because": I work at an ISP, we needed something that can run on the end router and send periodic updates to some API, it needed to be light and fast and that's where Nim came into play (Also, not really into coding C/C++ ... " added "\:) )" |
12:27:08 | FromDiscord | <Yardanico> oh, nice |
12:27:10 | FromDiscord | <Rika> Nice |
12:27:18 | FromDiscord | <Yardanico> If you start using it at the company, pls add it to https://github.com/nim-lang/Nim/wiki/Organizations-using-Nim :P |
12:27:30 | FromDiscord | <Yardanico> if sharing the company name is fine |
12:27:49 | FromDiscord | <MrOkram> I'll talk with my supervisor and see if it's fine with him |
12:45:49 | PMunch | Hmm, maybe I should try to get the name of the company I work for on that list as well |
12:45:53 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3wUz |
12:46:04 | FromDiscord | <Yardanico> the more the better :) |
12:46:18 | FromDiscord | <haxscramper> When I add `--debugger:native` code is magically fixed |
12:46:33 | FromDiscord | <Yardanico> well that enables gcc's -g |
12:46:56 | * | rockcavera joined #nim |
12:46:56 | * | rockcavera quit (Changing host) |
12:46:56 | * | rockcavera joined #nim |
12:47:15 | FromDiscord | <haxscramper> Do you think this has an effect? I mean I can literally do `echo str.isSlice` and it reports `false` |
12:47:23 | FromDiscord | <haxscramper> And on the next line `echo str.str` fails |
12:47:27 | FromDiscord | <Yardanico> ah sorry actually -Og |
12:47:43 | FromDiscord | <Yardanico> In reply to @haxscramper "And on the next": maybe it's a result of specific optimizations being enabled/disabled with -Og ? |
12:47:47 | FromDiscord | <Yardanico> in gcc |
12:47:49 | FromDiscord | <Yardanico> can you try with clang? |
12:48:32 | FromDiscord | <haxscramper> alright, clang is working fine without debugger |
12:50:53 | FromDiscord | <enthus1ast> While developing nimja I always thought that it would be a nice match for router websites because it's so lightweight and the heavy lifting is done on compile time.↵(@MrOkram) |
12:51:01 | arkanoid | how to unittest macros? I've a macro that generated a proc*, if I run it into a test block I get "Error: 'export' is only allowed at top level" |
12:51:21 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
12:51:24 | FromDiscord | <enthus1ast> I've done it with testament |
12:51:37 | FromDiscord | <enthus1ast> And matched on the output |
12:51:38 | * | def- quit (Quit: -) |
12:52:19 | FromDiscord | <haxscramper> also test macro functionality |
12:52:53 | FromDiscord | <haxscramper> https://github.com/haxscramper/fusion/blob/matching-fixup/tests/tmatching.nim#L977 |
12:53:10 | FromDiscord | <enthus1ast> https://github.com/enthus1ast/nimja/blob/master/tests/basic/test_tokens_before_extend_error.nim |
12:56:04 | FromDiscord | <Yardanico> searching "httpbeast" in shodan is fun :P |
12:56:07 | FromDiscord | <Yardanico> not a lot of results, but still |
12:56:09 | FromDiscord | <Yardanico> http://103.107.181.156:5005/ |
12:56:30 | FromDiscord | <Yardanico> http://159.138.5.194:8000/ |
12:56:40 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3wUC |
12:56:47 | FromDiscord | <haxscramper> Idenical (obviously) produced code, but fails with gcc |
12:56:57 | FromDiscord | <Yardanico> what's your gcc version? |
12:57:07 | FromDiscord | <Yardanico> maybe somehow try a newer one |
12:57:08 | FromDiscord | <haxscramper> `gcc version 11.1.0 (GCC)` |
12:57:23 | FromDiscord | <Yardanico> it could either be: a bug in clang that it allows this to work, a bug in gcc that it doesn't allow this to work, or some other weird stuff |
12:57:26 | FromDiscord | <Yardanico> but nonetheless it's very fun |
12:57:30 | FromDiscord | <Yardanico> "fun" |
12:57:44 | PMunch | @Yardanico, shodan? |
12:57:48 | FromDiscord | <Yardanico> yes |
12:57:49 | FromDiscord | <Yardanico> shodan.io |
12:57:49 | FromDiscord | <haxscramper> I'm going to try tcc |
12:58:06 | FromDiscord | <Yardanico> a service that scans whole IPv4 space for devices and fetches device banners |
12:58:23 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/880073619479363604/unknown.png |
12:58:53 | FromDiscord | <Yardanico> seems like there are quite a lot of internet-facing chinese web services using httpbeast |
12:58:58 | FromDiscord | <Yardanico> i mean out of 16 |
12:59:18 | FromDiscord | <Yardanico> and i meant hong kong as a part of china (pls no politics :P) |
13:00:14 | FromDiscord | <haxscramper> In reply to @haxscramper "I'm going to try": it fails, but also in different place |
13:00:18 | FromDiscord | <Yardanico> huh |
13:00:43 | FromDiscord | <haxscramper> I'm curious about differences in program control flow due to `!(((1 &((NU8)1<<((NU)((str).isSlice)&7U)))!=0))` code like this |
13:01:09 | FromDiscord | <haxscramper> And different "standart compliant C compilers" having varying interpretations of this |
13:01:35 | FromDiscord | <Yardanico> you can make a minimized C code version and check it on wandbox.org |
13:01:39 | PMunch | Huh, interesting |
13:01:39 | FromDiscord | <haxscramper> And no, I don't think I can minimize it |
13:01:40 | FromDiscord | <Yardanico> with different C compilers and their versions |
13:01:42 | FromDiscord | <haxscramper> Ah, C only |
13:01:59 | FromDiscord | <Yardanico> wandbox has GCC from the latest devel version to 1.27 |
13:02:17 | FromDiscord | <Yardanico> @PMunch yeah, people over the years found a lot of "bad" things here |
13:02:22 | FromDiscord | <Yardanico> like exposed mongodb instances |
13:02:27 | FromDiscord | <Yardanico> VNC without passwords (you can still find those) |
13:02:32 | FromDiscord | <Rika> Lol |
13:03:28 | PMunch | Yikes |
13:03:29 | FromDiscord | <Yardanico> for vnc without password on port 5900 (but that's really for #offtopic ) https://media.discordapp.net/attachments/371759389889003532/880074906300211220/unknown.png |
13:03:38 | FromDiscord | <Yardanico> will continue the discussion about it there |
13:04:21 | FromDiscord | <enthus1ast> why discord and not matrix? |
13:04:25 | FromDiscord | <enthus1ast> Matrix is open |
13:04:33 | FromDiscord | <enthus1ast> discord is like the new facebook |
13:04:44 | FromDiscord | <Yardanico> isn't the offtopic channel bridged to matrix? |
13:05:59 | FromDiscord | <enthus1ast> never seen any traffic there\: https://matrix.to/#/#nim-offtopic:matrix.org |
13:06:10 | FromDiscord | <enthus1ast> but idn maybe this is the wrong room |
13:06:14 | FromDiscord | <Yardanico> isn't nim's matrix in the different server now |
13:06:27 | FromDiscord | <Yardanico> https://matrix.to/#/#nim:envs.net |
13:08:38 | FromDiscord | <enthus1ast> it should not make a difference when the servers are federated |
13:08:59 | * | def- joined #nim |
13:09:14 | FromDiscord | <Yardanico> well, but the channel can only be bridged to a matrix channel on one of the servers |
13:09:40 | FromDiscord | <haxscramper> In reply to @Yardanico "you can make a": ``c |
13:09:47 | * | arkurious joined #nim |
13:09:50 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3wUK |
13:09:53 | FromDiscord | <haxscramper> and of course it does not fail, who could've guessed |
13:10:24 | FromDiscord | <Yardanico> it gives me different results with gcc |
13:10:35 | FromDiscord | <Yardanico> 0 without any compiler flags and 235 (return code I guess? or something) with -Og |
13:11:06 | FromDiscord | <haxscramper> I don't `return` from main explicitly, so |
13:11:27 | FromDiscord | <Yardanico> ah right, it's just a random return value |
13:15:50 | * | jjido joined #nim |
13:28:23 | * | stkrdknmibalz joined #nim |
13:29:52 | * | stkrdknmibalz quit (Client Quit) |
13:36:55 | FromDiscord | <Yardanico> https://news.ycombinator.com/item?id=28293836 |
13:37:01 | FromDiscord | <Yardanico> "I am the Nelua author, and I've used Nim for a reasonable amount of time before creating Nelua, thus Nim served as one of the inspirations for the project and they share similarities. But while Nim resembles Python, Nelua resembles Lua. Also when comparing both, Nelua tries to be more minimal and generate more readable and compact C code." |
13:37:08 | FromDiscord | <Yardanico> Nim mentioned a few times in the comments regarding the GC |
13:51:46 | FromDiscord | <lamersc.com 🐧> In reply to @Yardanico ""I am the Nelua": Gave me a good chuckle this morning |
14:04:18 | FromDiscord | <haxscramper> If it compiled to lua it could be used instead of it |
14:06:15 | * | PMunch quit (Quit: Leaving) |
14:18:25 | FromDiscord | <lamersc.com 🐧> Why would they reinvent the wheel when there’s already languages targeting low level sectors of lua, such as https://terralang.org |
14:21:26 | FromDiscord | <Rika> another comment said this |
14:21:27 | FromDiscord | <Rika> "Telling a programmer there's already a library to do X is like telling a songwriter there's already a song about love." - Pete Cordell |
14:29:30 | FromDiscord | <tandy> i tried that |
14:30:43 | FromDiscord | <tandy> but its hard to know whether its actually working |
14:30:58 | FromDiscord | <lamersc.com 🐧> In reply to @Rika ""Telling a programmer there's": Yeah you bring a good point |
14:30:59 | FromDiscord | <tandy> because the json should be fixed |
14:31:10 | FromDiscord | <Rika> i am merely the messenger |
14:40:14 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3wVb |
15:00:14 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
15:01:25 | NimEventer | New post on r/nim by binaryfor: An alternative Twitter front-end written in Nim, see https://reddit.com/r/nim/comments/pbczm8/an_alternative_twitter_frontend_written_in_nim/ |
15:01:40 | FromDiscord | <Yardanico> well, we do know about nitter already :) |
15:02:00 | FromDiscord | <Yardanico> and the link is borked |
15:03:10 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/880105025878241380/unknown.png |
15:03:19 | FromDiscord | <Yardanico> my bot is too fast for those people :P |
15:03:25 | FromDiscord | <Yardanico> it doesn't give them any time to delete or edit |
15:03:26 | NimEventer | New post on r/nim by prefixcoder: How does standard `set` work?, see https://reddit.com/r/nim/comments/pbd24a/how_does_standard_set_work/ |
15:03:36 | FromDiscord | <Yardanico> wow that is a nice coincidence |
15:03:47 | FromDiscord | <Yardanico> two reddit posts in a short amount of time |
15:04:20 | FromDiscord | <Recruit_main707> too mainstream, time to search for another language |
15:06:11 | FromDiscord | <xflywind> In reply to @Yardanico "well, we do know": I guess it is posted because nitter was on hackernews front page before. |
15:06:34 | FromDiscord | <xflywind> 19 hours ago |
15:06:36 | FromDiscord | <Yardanico> ah right seems like someone reposted it on HN again 19 hours ago |
15:06:53 | FromDiscord | <Ayy Lmao> Does anyone have any advice on how you would structure a gui library in nim? I'm looking for ideas. |
15:21:41 | * | krux02 joined #nim |
15:23:29 | krux02 | leoriz |
15:23:55 | krux02 | sorry, accidental send, can't delete here on IRC |
15:25:26 | * | max22- quit (Quit: Leaving) |
15:27:08 | * | jjido joined #nim |
15:28:08 | FromDiscord | <tandy> is there a function for parsing bools from a string? |
15:28:13 | FromDiscord | <tandy> like "true" = 1? |
15:28:21 | FromDiscord | <tandy> im trying to write a jsony parsehook |
15:30:06 | FromDiscord | <tandy> https://nim-lang.org/docs/strutils.html#parseBool%2Cstring |
15:30:09 | FromDiscord | <tandy> yee |
15:36:43 | FromDiscord | <aep> hi i'm wondering if nim might be useful for microcontrollers, where we only have C. Is compiling to C merely a temporary measure or is this its final form? the website only mentions x86 |
15:39:24 | FromDiscord | <Rika> nim has been compiling to C for a long time already, im pretty sure it is its final form |
15:39:47 | FromDiscord | <Rika> extra backends are being proposed but i dont think that would usurp C |
15:39:54 | FromDiscord | <Rika> (edit) "extra backends are being proposed but i dont think that would usurp ... Cbackend" added "the" | "theC ... " added "backend" |
15:40:01 | FromDiscord | <xflywind> You can find many posts on Nim forum https://forum.nim-lang.org/t/7731 |
15:41:07 | FromDiscord | <xflywind> https://forum.nim-lang.org/t/7636 |
16:23:53 | NimEventer | New thread by Mareklachbc: What's Nim's equivalent of Python's append() method for lists?, see https://forum.nim-lang.org/t/8366 |
16:33:31 | FromDiscord | <dankrad> I've encountered that this issue https://github.com/nim-lang/Nim/issues/15452 is also on arch linux, but it's closed. ↵Do I need to wait before someone reopened it, or can I create a pr nevertheless. |
16:52:42 | * | auxym_ joined #nim |
17:06:02 | NimEventer | New post on r/nim by Ether-naut: Sequence allocations, see https://reddit.com/r/nim/comments/pbfiud/sequence_allocations/ |
17:08:21 | arkanoid | could you give me an example on how can I unittest macros? |
17:10:26 | * | dmu joined #nim |
17:16:04 | * | auxym_ quit (Quit: Konversation terminated!) |
17:16:20 | * | auxym_ joined #nim |
17:26:39 | FromDiscord | <konsumlamm> that heavily depends on the macro |
17:32:42 | arkanoid | konsumlamm, macro that returns a procDef |
17:34:04 | FromDiscord | <konsumlamm> then test the generated proc? |
17:35:54 | * | auxym_ quit (Ping timeout: 250 seconds) |
17:38:39 | arkanoid | konsumlamm, if the the proc is exported, so it fails to be generated within the test block |
17:40:06 | FromDiscord | <haxscramper> Then put things on the toplevel? |
17:40:07 | FromDiscord | <haxscramper> Or make `doExport: static[bool] = true` argument in macro |
17:47:37 | arkanoid | ok, got it, gonna take the long road :D |
17:49:22 | arkanoid | I have question. I'm using proc readFile to read file contents at compile time. It works, but if it raises exception it doesn't get catched and compilation fails |
17:49:39 | arkanoid | I though exceptions were suppoted at compile time |
17:51:23 | FromDiscord | <haxscramper> exceptions are supported at compile time |
17:51:24 | FromDiscord | <haxscramper> But if exception leaves macro body it is turned into compilation errors |
17:53:59 | FromDiscord | <Neko~Neko~ni> i am facing a problem and i think its linux specific(atleast it was with python),↵lets say i am running an infinite loop and taking input from user to do specific things like cmd,in cmd or↵terminal when you press the Up key,that returns the previous command BUT that does not happen when i use the Up key. it just shows me garbled characters(`^[[A`).in python i would import the famous linux specific module called readline to resolv |
17:54:08 | arkanoid | it doesn't leave macro body, is a straight try: parseXml(path.readFile) except: ... |
17:54:34 | * | auxym_ joined #nim |
17:57:05 | FromDiscord | <haxscramper> and what `parseXml` is? |
17:57:37 | arkanoid | is in std/xmltree |
17:58:26 | arkanoid | argument calculated before it, am I wrong? |
17:58:57 | FromDiscord | <haxscramper> I mean, exceptions won't be transferred from compile-time to runtime if that's what you are implying |
17:59:39 | arkanoid | no, I just have a chain of try: .. except: try: ... except: ... in a single static: proc |
18:00:12 | FromDiscord | <Rika> In reply to @Neko~Neko~ni "i am facing a": the up key does not return "previous command". it is a feature of the shell (bash, fish, zsh) |
18:01:01 | FromDiscord | <Rika> the "garbled characters" is the characters that are actually sent by the terminal, the shell just interprets it as "last entry in history" |
18:01:13 | FromDiscord | <Rika> (edit) "is" => "are" |
18:01:13 | arkanoid | haxscramper, here https://play.nim-lang.org/#ix=3wWw |
18:01:31 | FromDiscord | <Rika> there is a linenoise implementation in nim |
18:01:39 | FromDiscord | <Rika> https://nim-lang.org/docs/linenoise.html |
18:01:45 | FromDiscord | <Rika> implementation -> wrapper |
18:01:52 | FromDiscord | <Rika> but there are also implementations |
18:02:27 | FromDiscord | <haxscramper> That runs at compile-time?↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>) |
18:02:40 | FromDiscord | <haxscramper> s/parseXml/findXml/ |
18:02:43 | FromDiscord | <haxscramper> sent a code paste, see https://paste.rs/sT2 |
18:04:14 | FromDiscord | <Neko~Neko~ni> In reply to @Rika "the "garbled characters" are": i see,didn't knew about that,thanks alot |
18:04:30 | arkanoid | haxscramper, no, I call the findXml proc from a static: block |
18:05:08 | arkanoid | it works if it doesn't raise the exception (if it get the paths right on first shot) |
18:05:10 | FromDiscord | <Rika> @Neko~Neko~ni https://nim-lang.org/docs/linenoise.html |
18:05:20 | FromDiscord | <haxscramper> `static:` runs at compile-time |
18:05:48 | FromDiscord | <Rika> the garbled characters are called "terminal escape codes" i believe |
18:05:56 | arkanoid | exactly (am I misinterpreting your question?) |
18:05:57 | FromDiscord | <Rika> this is the reference i usually use https://www.csie.ntu.edu.tw/~r92094/c++/VT100.html |
18:07:40 | FromDiscord | <haxscramper> I don't understand the question then. You raise something in `static:` block, and don't handle it in the same static block, so things propagage upwards and turn into compilation error. Once the exception leaves the static block and turns into error, there is no way to catch it↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>) |
18:07:47 | FromDiscord | <Neko~Neko~ni> In reply to @Rika "the garbled characters are": Been usin linux for a long time but didn't knew that it was a feature of shell.this isn't a problem in windows.i think this feature is already present in windows command-interpreter. |
18:07:58 | FromDiscord | <haxscramper> `static: assert arg is string` etc. |
18:08:02 | FromDiscord | <Rika> windows is, uh, different |
18:08:08 | FromDiscord | <Rika> and i am completely unfamiliar |
18:08:13 | FromDiscord | <Rika> so you will need to figure that out |
18:08:25 | FromDiscord | <haxscramper> Like, you need to run something at compile-time and then unittest it? |
18:08:49 | FromDiscord | <Neko~Neko~ni> i see,thanks anyway! |
18:09:03 | FromDiscord | <haxscramper> The original question was "It works, but if it raises exception it doesn't get catched and compilation fails. I though exceptions were suppoted at compile time" so I assumed you somehow want to catch/test the exception |
18:09:20 | arkanoid | haxscramper, no, you can see here that findXml proc has 3 nested try/except. If first one raises, it doesn't get to the second if findXml is called from a static block |
18:09:24 | arkanoid | https://play.nim-lang.org/#ix=3wWw |
18:10:21 | FromDiscord | <Neko~Neko~ni> one question more,is there an HTTP library like pythons requests,httpx? |
18:10:28 | FromDiscord | <Rika> httpclient |
18:10:30 | FromDiscord | <Neko~Neko~ni> in nim. |
18:10:33 | FromDiscord | <Rika> https://nim-lang.org/docs/httpclient.html |
18:10:43 | arkanoid | the logic is quite simple: try to load from compilation dir, if fails try load from cache dir, otherwise download it. While I don't expect it to reach the third option, it doesn't even get to the second |
18:10:48 | FromDiscord | <Rika> literally called httpclient |
18:11:04 | arkanoid | if I remove the first option it works |
18:14:40 | FromDiscord | <haxscramper> Can you make a reproducible example? It is possible you hit a bug, because nested exceptions work perfectly fine https://wandbox.org/permlink/wMeEVSBEVpvUfjo0 |
18:15:15 | FromDiscord | <haxscramper> Also, does httpclient even work at compile-time? `newHttpClient(timeout = 10000).getContent(schemaLocation)` |
18:16:23 | FromDiscord | <haxscramper> And xml as well, IIRC it uses streams module |
18:16:34 | arkanoid | haxscramper, don't know, I was curious, but I spotted this problem before even reaching it. It's not required to trigger it. Let me reduce it |
18:16:39 | arkanoid | no, xml works at compile time |
18:16:49 | arkanoid | I've been using it a lot |
18:17:09 | arkanoid | talking about xmlparser, xmltree and strtabs |
18:22:30 | arkanoid | haxscramper, here's a minimal version https://play.nim-lang.org/#ix=3wWE |
18:22:39 | arkanoid | no xml, no httpclient, not even an import |
18:23:30 | arkanoid | not sure if it is worth posting, I fear the answer would be "you should use staticRead" |
18:23:51 | arkanoid | but this doesn't explain the broken exception handling |
18:25:02 | arkanoid | what do you suggest? |
18:25:45 | FromDiscord | <haxscramper> Start with minimized example a |
18:28:28 | arkanoid | haxscramper, I've already produced it https://play.nim-lang.org/#ix=3wWE |
18:31:22 | arkanoid | I'll post on the forum |
18:31:43 | FromDiscord | <haxscramper> I guess it is a bug then, because ten nested try-catch work ok https://wandbox.org/permlink/vDjDg5vVLYK9iQnl |
18:31:46 | FromDiscord | <haxscramper> but readFile fails |
18:31:51 | FromDiscord | <haxscramper> and `staticRead` also fails |
18:32:01 | FromDiscord | <haxscramper> But `staticRead` at least has correct stactrace |
18:34:16 | NimEventer | New thread by Giaco: Using readFile at compile time break exceptions, see https://forum.nim-lang.org/t/8367 |
18:35:14 | arkanoid | may I post your wandbox link in forum thread? |
18:36:21 | FromDiscord | <haxscramper> yes, of course |
18:38:18 | arkanoid | thanks |
18:38:50 | arkanoid | have to go now, let's wait for more feedback. Thanks for the help |
18:41:52 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
18:54:11 | FromDiscord | <ondrejoda> sent a code paste, see https://play.nim-lang.org/#ix=3wWP |
18:54:11 | FromDiscord | <ondrejoda> how can i fix this? |
19:00:12 | FromDiscord | <Yardanico> uint8 is not int |
19:00:20 | FromDiscord | <Yardanico> as it says "ptr int" you need var val: int |
19:00:25 | FromDiscord | <Yardanico> and then pass it with addr |
19:00:43 | FromDiscord | <ondrejoda> gives me |
19:00:46 | FromDiscord | <ondrejoda> sent a code paste, see https://play.nim-lang.org/#ix=3wWW |
19:00:56 | FromDiscord | <ondrejoda> `/home/ondrejoda/Nim/Zimmer/engine.nim(35, 28) Error: type mismatch: got <ptr array[0..512, uint8]> but expected 'int'` |
19:01:15 | FromDiscord | <ondrejoda> (edit) "https://play.nim-lang.org/#ix=3wWW" => "https://play.nim-lang.org/#ix=3wWX" |
19:01:18 | FromDiscord | <Yardanico> you're assigning to keyboard |
19:01:29 | FromDiscord | <Yardanico> getKeyboardState returns a pointer to an array |
19:01:35 | FromDiscord | <Yardanico> you can't assign it to keyboard itself |
19:02:30 | FromDiscord | <ondrejoda> got it |
19:02:37 | FromDiscord | <ondrejoda> thanks! |
19:17:20 | FromDiscord | <tandy> is it possible to store a large string as a hash in nim? |
19:17:27 | FromDiscord | <tandy> so i dont have to have a huge string in my test? |
19:20:36 | FromDiscord | <Yardanico> uh, what do you mean by that? |
19:21:04 | FromDiscord | <Yardanico> if your testing only needs a string's hash, then you can use the hash |
19:21:09 | FromDiscord | <Yardanico> but otherwise you need to have the string itself |
19:21:43 | FromDiscord | <tandy> well its json↵(@Yardanico) |
19:21:50 | FromDiscord | <Yardanico> well what exactly are you testing |
19:21:59 | FromDiscord | <tandy> i guess i could get away with calculating hashes |
19:22:01 | FromDiscord | <Yardanico> if you need the original string for the test, then you obviously can't remove it |
19:22:39 | FromDiscord | <tandy> i want to make sure jsony is working so converting json to object, then object to json↵(@Yardanico) |
19:22:53 | FromDiscord | <Yardanico> well why don't you want to have the original string in the test? |
19:23:01 | FromDiscord | <tandy> just cos its so big |
19:23:04 | FromDiscord | <Yardanico> if you don't want to store it in the .nim file itself you can just put it to a different file |
19:23:06 | FromDiscord | <Yardanico> how big? |
19:23:09 | FromDiscord | <tandy> true |
19:23:15 | FromDiscord | <tandy> just like 50 lines or so lol |
19:23:21 | FromDiscord | <Yardanico> well, I mean file size |
19:23:30 | FromDiscord | <tandy> hmm |
19:23:32 | FromDiscord | <Yardanico> 50 lines is small :) |
19:23:41 | FromDiscord | <Yardanico> unless each line has like 5k characters |
19:24:00 | FromDiscord | <tandy> 500 bytes lol |
19:24:06 | FromDiscord | <Rika> small |
19:24:08 | FromDiscord | <lamersc.com 🐧> Waiting for the day we get a system programming dialect of html 👀 |
19:24:12 | FromDiscord | <Yardanico> ? |
19:24:17 | FromDiscord | <Yardanico> use karax server-side rendering |
19:24:34 | FromDiscord | <lamersc.com 🐧> It was a joke :P |
19:24:40 | FromDiscord | <Yardanico> about wat? 🤔 |
19:24:55 | FromDiscord | <lamersc.com 🐧> System programming html |
19:25:01 | FromDiscord | <lamersc.com 🐧> (edit) "System" => "Systems" |
19:26:01 | FromDiscord | <Yardanico> html is not a programming language |
19:27:15 | FromDiscord | <Recruit_main707> i guess thats the joke |
19:28:01 | FromDiscord | <Yardanico> a joke has to be at least a bit funny :/ |
19:28:31 | FromDiscord | <lamersc.com 🐧> Jokes are subjective, no need to hurt my feelings 🥲 |
19:34:34 | NimEventer | New thread by Stefan_Salewski: String expression parsing, see https://forum.nim-lang.org/t/8368 |
19:43:11 | * | PMunch joined #nim |
19:43:30 | FromDiscord | <ondrejoda> i have another question to the people that know how to use the sdl2 wrapper |
19:43:48 | FromDiscord | <ondrejoda> how do you use sdl scancodes in nim? |
19:44:27 | FromDiscord | <ondrejoda> because i can't seem to use the result from `getKeyboardState()` and a scancode in an if statement like i could in c++ |
19:44:36 | FromDiscord | <ondrejoda> so how do i compare these in nim? |
19:47:44 | PMunch | Why aren't you able to use it? |
19:47:55 | FromDiscord | <ondrejoda> `/home/ondrejoda/Nim/Zimmer/main.nim(17, 24) Error: type mismatch: got <int, Scancode>` |
19:48:02 | FromDiscord | <ondrejoda> (edit) "`/home/ondrejoda/Nim/Zimmer/main.nim(17," => "`/main.nim(17," |
19:48:20 | FromDiscord | <ondrejoda> sent a code paste, see https://play.nim-lang.org/#ix=3wXc |
19:48:57 | PMunch | Have you read the documentation for getKeyboardState? |
19:49:17 | FromDiscord | <ondrejoda> yes, i have actually used it like this in c++ |
19:49:18 | PMunch | It returns a pointer to an array indexed by scancodes |
19:49:29 | FromDiscord | <ondrejoda> oh wait |
19:49:33 | FromDiscord | <ondrejoda> i know what's wrong |
19:49:36 | FromDiscord | <ondrejoda> 🤦♂️ |
19:50:06 | FromDiscord | <ondrejoda> no wait that still gives me an error |
19:50:56 | PMunch | Something like this: https://play.nim-lang.org/#ix=3wXd |
19:52:42 | FromDiscord | <ondrejoda> that gives me a `/main.nim(17, 24) Error: type mismatch: got <int, typeof(nil)>` |
19:52:55 | PMunch | It's pretty well explained in the docs: https://github.com/Vladar4/sdl2_nim/blob/master/sdl2/private/keyboard.nim#L46-L58 |
19:53:23 | PMunch | Please share a code snippet, that makes it way easier to see what you're doing wrong |
19:53:54 | FromDiscord | <ondrejoda> ok gimme a sec |
19:56:59 | FromDiscord | <ondrejoda> sent a code paste, see https://play.nim-lang.org/#ix=3wXf |
19:57:09 | FromDiscord | <ondrejoda> here |
19:58:49 | FromDiscord | <ondrejoda> i can't really share all of the code because it's all part of a game engine |
19:59:06 | FromDiscord | <ondrejoda> so if i shared all of it i would fill up this whole chat room :D |
20:00:25 | FromDiscord | <ondrejoda> the error is `/home/ondrejoda/Nim/Zimmer/main.nim(17, 23) Error: type mismatch: got <array[0..512, uint8], Scancode>` |
20:00:35 | FromDiscord | <ondrejoda> (edit) "`/home/ondrejoda/Nim/Zimmer/main.nim(17," => "`/main.nim(17," |
20:01:26 | FromDiscord | <Rika> need to change scancode to int i assume |
20:01:41 | FromDiscord | <ondrejoda> `.toInt` doesn't work |
20:01:45 | FromDiscord | <Rika> `.int` |
20:01:59 | PMunch | Hmm, let me guess, you don't use the wrapper that I linked to? |
20:02:08 | FromDiscord | <ondrejoda> In reply to @PMunch "Hmm, let me guess,": i don |
20:02:11 | FromDiscord | <ondrejoda> t |
20:02:13 | FromDiscord | <ondrejoda> yeah |
20:02:18 | FromDiscord | <ondrejoda> In reply to @Rika "`.int`": that did work! |
20:02:27 | PMunch | But yeah, .int should work for you then |
20:12:28 | * | auxym_ quit (Ping timeout: 252 seconds) |
20:24:19 | FromDiscord | <⃟⃟> can be used for msdos? |
20:38:54 | * | jjido joined #nim |
20:54:55 | * | auxym_ joined #nim |
20:59:15 | * | krux02 quit (Ping timeout: 250 seconds) |
21:15:29 | FromDiscord | <treeform> In reply to @tandy "i want to make": Let me know if you run into any issues with that. I have tests for this in jsony, but more tests always help. |
21:16:51 | FromDiscord | <exelotl> is it normal that you can't do `proc main() {.tags: [].} = ...` |
21:17:05 | FromDiscord | <exelotl> I have to do `proc main() {.tags: [RootEffect].} = ...` instead |
21:19:35 | FromDiscord | <dom96> certainly doesn't seem normal |
21:24:24 | FromDiscord | <exelotl> is there a way to tell where the effect came from? |
21:24:40 | * | flynn quit (Ping timeout: 240 seconds) |
21:25:08 | * | auxym_ quit (Ping timeout: 250 seconds) |
21:27:04 | * | flynn joined #nim |
21:29:48 | * | Gustavo6046 joined #nim |
21:29:54 | Gustavo6046 | is a concept akin to a trait in rust? |
21:31:07 | FromDiscord | <Elegantbeef> Concepts are type classes defined by what they fulfill instead of their name |
21:32:21 | FromDiscord | <dain> like duck typing? |
21:32:40 | FromDiscord | <Elegantbeef> User defined duck typing yes |
21:32:51 | FromDiscord | <Elegantbeef> It's the easiest way to explain it infact |
21:33:43 | FromDiscord | <Elegantbeef> To show a practical example https://forum.nim-lang.org/t/8328#53675 |
21:52:19 | FromDiscord | <⃟⃟> has anyone made a nim application for msdos |
21:59:37 | * | def- quit (Quit: -) |
21:59:50 | * | def- joined #nim |
22:00:49 | FromDiscord | <Ayy Lmao> Are concepts basically just meant to give more helpful error messages than generics, or are there more benefits? |
22:04:49 | FromDiscord | <Recruit_main707> any funtion to reverse a sequence in the stdlb? |
22:07:42 | * | PMunch quit (Quit: leaving) |
22:14:18 | FromDiscord | <Recruit_main707> found the algorithm module |
22:20:01 | FromDiscord | <retkid> > /usr/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: unrecognized option '-z'↵> /usr/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: use the --help option for usage information↵> collect2: error: ld returned 1 exit status |
22:20:13 | FromDiscord | <retkid> i have no clue how to fix this |
22:20:19 | FromDiscord | <retkid> i've updated my system |
22:20:23 | FromDiscord | <retkid> (edit) "i've updated my system ... " added "and uh" |
22:20:24 | FromDiscord | <retkid> dunno |
22:20:55 | FromDiscord | <retkid> google not very usefulk |
22:20:56 | FromDiscord | <retkid> (edit) "usefulk" => "useful" |
22:21:22 | FromDiscord | <Gustavo6046> In reply to @Gustavo6046 "I'll take a deeper": Back! Did anyone figure it out? |
22:22:05 | FromDiscord | <retkid> alright maybe compiling through wine will be easier |
22:22:08 | FromDiscord | <Gustavo6046> In reply to @Elegantbeef "Concepts are type classes": Ahh, I see, like Python's typing.Protocol |
22:22:14 | FromDiscord | <Gustavo6046> or kiinda sorta like a Rust trait |
22:22:28 | FromDiscord | <retkid> Nim is kinda a mix of a lot of language |
22:22:29 | FromDiscord | <retkid> (edit) "language" => "languages" |
22:22:33 | FromDiscord | <Gustavo6046> In reply to @⃟⃟ "has anyone made a": That would be fun |
22:22:38 | FromDiscord | <retkid> i see some rust, then i see some kotlin, and then i see some jva |
22:22:40 | FromDiscord | <retkid> (edit) "jva" => "java" |
22:22:53 | FromDiscord | <retkid> python, even bash stuff |
22:23:17 | FromDiscord | <retkid> obviously strong C and C++\ |
22:23:21 | FromDiscord | <retkid> (edit) "C++\" => "C++" |
22:23:26 | FromDiscord | <retkid> we even got inline asm |
22:23:38 | FromDiscord | <tandy> can you index a seq like \`exampleSeq[1\:]\` to get items after index 1? |
22:23:57 | FromDiscord | <treeform> In reply to @tandy "can you index a": `exampleSeq[1..^1]` |
22:24:26 | FromDiscord | <retkid> hey treeform do you have a guide to install nim underwine |
22:24:29 | FromDiscord | <retkid> (edit) "underwine" => "unde rwine" |
22:24:37 | FromDiscord | <retkid> (edit) "unde rwine" => "under wine" |
22:27:37 | FromDiscord | <Gustavo6046> the issue happens in both stable and devel |
22:28:06 | * | def- quit (Quit: -) |
22:28:16 | * | def- joined #nim |
22:28:25 | FromDiscord | <Gustavo6046> can i use choosenim/nimble to build nim from source (without manually git cloning and such) and apply optimizations like `-O2 -march=native -Xclang -load -Xclang LLVMPolly.so -mllvm -polly7`? |
22:30:53 | FromDiscord | <Gustavo6046> In reply to @Gustavo6046 "the issue happens in": http://ix.io/3wXV |
22:38:32 | FromDiscord | <dom96> no, you can't |
22:39:42 | FromDiscord | <Gustavo6046> oh |
22:39:54 | FromDiscord | <Gustavo6046> also i typoed the last arg |
22:41:19 | * | mjsir911 quit (Remote host closed the connection) |
22:41:37 | * | mjsir911 joined #nim |
22:47:47 | FromDiscord | <RattleyCooper> Anybody have experience using the `triggerTypingIndicator` proc from `dimscord`? |
22:49:42 | FromDiscord | <RattleyCooper> I'm running into an issue with an `OSError` that is hard to reproduce, but it seems to always happen after a call to `triggerTypingIndicator`. What is the difference between a `Future` and an `owned(Future)`? |
22:49:45 | * | Vladar quit (Remote host closed the connection) |
22:53:37 | FromDiscord | <RattleyCooper> The `OSError` is `the network connection was aborted by the local system` |
22:53:54 | FromDiscord | <5271> can i run a terminal command in nim? |
22:54:12 | FromDiscord | <5271> like system("mkdir test") or smth like that |
22:54:26 | FromDiscord | <RattleyCooper> In reply to @5271 "can i run a": Check `osproc` |
22:54:38 | FromDiscord | <5271> okay |
22:54:57 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
22:55:25 | FromDiscord | <RattleyCooper> If you need to read the output check out `execCmdEx`. If running on windows, you may need to prepend `cmd /c` to run the command in it's own `cmd.exe` |
22:56:05 | FromDiscord | <RattleyCooper> Depending on the command. Certain commands are not binaries(or something like that) and it seems like nothing in `osproc` can run these commands |
22:56:41 | FromDiscord | <RattleyCooper> (edit) "Depending on the command. Certain commands are not binaries(or something like that) and it seems like nothing in `osproc` can ... run(and" added "actually" | "actuallyrun these commands ... " added "(and if they can it's not obvioius in the docs)" |
23:27:31 | FromDiscord | <Gustavo6046> if the AUR has -git packages for nim and nimble |
23:27:38 | FromDiscord | <Gustavo6046> and also one for choosenim, but those are incompatible |
23:27:39 | FromDiscord | <Gustavo6046> which should I pick? |
23:27:55 | FromDiscord | <Gustavo6046> I already built nim{,ble}-git (optimized) but it might be a worse idea |
23:28:03 | FromDiscord | <Gustavo6046> I dunno I didn't think it through and I want you to do it for me because I'm big dumb |
23:31:11 | * | auxym_ joined #nim |
23:31:59 | FromDiscord | <Gustavo6046> "function definition not found"? zsh, wut? |
23:35:19 | FromDiscord | <Gustavo6046> As for Nim itself, is there no uint / uint? Only int / uint? |
23:38:40 | * | krux02 joined #nim |
23:52:34 | FromDiscord | <Gustavo6046> Aaaa |
23:52:43 | FromDiscord | <Gustavo6046> I have an object definition with arrays whose size is static at runtime but not at compile time |
23:52:54 | FromDiscord | <Gustavo6046> I don't want to use generics because that screws up with the compiler |
23:53:03 | FromDiscord | <Gustavo6046> I don't want to use a predefined constant because that's lame and potentially inflexible |
23:54:10 | FromDiscord | <Gustavo6046> (I don't want to use an array of structs either, SoA > AoS) |
23:54:44 | FromDiscord | <Gustavo6046> but I can't assign an array to an openarray variable type when constructing this object |
23:58:27 | FromDiscord | <InventorMatt> you could possibly generate it in a macro then |