00:14:26 | * | ltriant joined #nim |
00:19:04 | * | ltriant quit (Ping timeout: 256 seconds) |
00:23:18 | * | ltriant joined #nim |
00:45:42 | * | derpydoo quit (Ping timeout: 256 seconds) |
00:46:44 | FromDiscord | <voidwalker> awesome @Yepoleb let me know if you need sample code to run |
00:46:54 | FromDiscord | <Yepoleb> sample code is always good |
00:59:32 | * | ltriant quit (Ping timeout: 248 seconds) |
01:03:06 | FromDiscord | <TurtleP> sent a code paste, see https://play.nim-lang.org/#ix=4hxT |
01:11:12 | * | TakinOver quit (Ping timeout: 256 seconds) |
01:11:35 | * | TakinOver joined #nim |
01:12:05 | FromDiscord | <!!sharpcdf!!> not really nim but im matching in nim, why does `(?==\s?)\S+` match with `=` in `arg = hello` only? |
01:12:13 | * | arkanoid joined #nim |
01:16:36 | arkanoid | I have a project that does some float testing using math.almostEqual. I have a test that pass on a x86_64 ubuntu laptop, but fails on another x86_64 ubuntu laptop. If I dump the argument something quite weird happens: "check almostEqual(2.35619, 1.5708, 2^9)" fails on first machine, passes on the second |
01:17:03 | arkanoid | I will never develop satellite firmware with Nim :P |
01:23:21 | arkanoid | I'm quite sure I'm looking at a bug here, problem is thay my effort in reducing to small case fails |
01:25:28 | FromDiscord | <Yepoleb> do you think it should pass or fail? |
01:27:12 | * | ltriant joined #nim |
01:27:51 | FromDiscord | <Yepoleb> are you copying the same file between two computers or is it different |
01:28:06 | FromDiscord | <Yepoleb> @Arkanoid |
01:28:52 | arkanoid | Yepoleb, it should fail! The whole project is 1:1 between the two machines (git sync) |
01:29:06 | arkanoid | I'm writing a small play.nim-lang |
01:29:49 | FromDiscord | <Yepoleb> In reply to @arkanoid "<@144300201857777664>, it should fail!": but do you recompile? |
01:31:04 | arkanoid | Yepoleb, yes |
01:31:16 | arkanoid | heres how I'm generating the issue https://play.nim-lang.org/#ix=4hxY |
01:31:31 | arkanoid | I'm trying to replicate it in a minimal, external case, but yet no cake |
01:32:21 | arkanoid | I'm running "nimble -f test" on both machines |
01:32:42 | FromDiscord | <Yepoleb> if you just do the almostEqual it fails both times? |
01:34:55 | arkanoid | Yepoleb, this fails on both machines https://play.nim-lang.org/#ix=4hy0 (quite obvious) |
01:35:15 | arkanoid | but same thing inside that "test generator" function generates that weird case |
01:36:52 | FromDiscord | <Yepoleb> maybe the comparison never happens |
01:36:58 | FromDiscord | <Yepoleb> and the test exits eariler |
01:37:25 | FromDiscord | <Yepoleb> if you send over the two files i can disassemble them |
01:42:12 | arkanoid | the check happens, because the test run ends on both machine. Just one prints ALL PASS, the other prints 1 ERROR |
01:44:01 | FromDiscord | <Yepoleb> "ALL PASS" doesn't tell you how many checks were run |
01:47:57 | arkanoid | I'm creating an alternative version of almostEqual dumping all the internal checks, I want to find the one that glitches away |
01:50:32 | FromDiscord | <Yepoleb> The fact that the math behaves identically in isolation is a strong indication that the bug is actually in your testing and not the math |
01:54:12 | arkanoid | I do agree, but my only way to debug starting from the nearest branch |
01:57:14 | arkanoid | I've copypasted the function almostEqual from math.nim and renamed fooEqual. now I have "dump almostEqual(A,B, 2^9); dump fooEqual(A,B,2^9)" printing "true, false" |
01:57:41 | arkanoid | something really weird is going on |
02:00:47 | arkanoid | https://play.nim-lang.org/#ix=4hy5 |
02:01:10 | arkanoid | sorry, forgot to rename some vars in dump |
02:01:38 | arkanoid | this is correct https://play.nim-lang.org/#ix=4hy6 |
02:02:10 | arkanoid | damn, I've inverted true/false |
02:02:29 | arkanoid | finally right: https://play.nim-lang.org/#ix=4hy7 |
02:09:11 | arkanoid | there must be something special if the function is called from math.almostEqual, or from somewherelse.almostEqual |
02:09:27 | arkanoid | as copypaste 1:1 fixes the problem |
02:10:54 | FromDiscord | <Yepoleb> you're not calling it with `math.almostEqual` |
02:13:57 | arkanoid | you're also right, and using math.almostEqual explicitly also solves the problem ... but I don't have another almostEqual declared in my namespace and "go to reference" takes me to math.nim in vscode |
02:14:34 | arkanoid | so ... what am I calling when I do almostEqual(a,b) vs math.almostEqual(a,b)? |
02:15:36 | FromDiscord | <Yepoleb> 🤔 |
02:17:35 | arkanoid | Yepoleb, apparently I have another almostEqual definition imported into my namespace that takes precedence over math.almostEqual, but I don't know which one as vscode take me to math.almostEqual, but repr clearly shows two different function addresses |
02:18:57 | arkanoid | found it! https://github.com/SciNim/Unchained/blob/6956150343fa9f738224fe8af4375266d3d2f3dc/src/unchained/utils.nim#L41 |
02:19:43 | arkanoid | but now the question is: why one machine runs math.almostEqual, but the other runs unchained.utils.almostEqual, when code just calls almostEqual(a,b)? |
02:24:36 | FromDiscord | <Yepoleb> the new almostEqual was added just 15 days ago |
02:24:42 | FromDiscord | <Yepoleb> you have an older package somewhere |
02:24:52 | arkanoid | I've been fighting a polluted namespace from an update of an external lib for hours ... this due to vscode not pointing me to the right code used for that call |
02:28:20 | FromDiscord | <Elegantbeef> Something something lockfiles one day |
02:28:49 | arkanoid | both machines have installed the same version of that lib. The dilemma why one machine prefers math. and the other the other machine prefers unchained. remains |
02:31:35 | FromDiscord | <Yepoleb> i think the library version gets chosen because it is not generic |
02:32:10 | arkanoid | both machine have same libs installed, can't be that |
02:35:01 | arkanoid | what's the current solution for this kind of problem? |
02:35:27 | arkanoid | I need to assure machine A and machine B compiles the same code with same sources |
02:35:55 | FromDiscord | <Yepoleb> just specify the module explicitly |
02:36:27 | FromDiscord | <Yepoleb> does you compiler maybe have different versions? |
03:05:51 | * | crem quit (Read error: Connection reset by peer) |
03:08:38 | * | droidrage joined #nim |
03:32:15 | arkanoid | no, 1.6.10 both |
03:40:59 | * | nyeaa492842 quit (Ping timeout: 268 seconds) |
03:46:10 | FromDiscord | <salt rock lamp> maybe i missed it, but is there no `sum()` function for `array`s? i only see one in `std/math` for `openArray` |
03:51:22 | FromDiscord | <Tuatarian> if I have a `pointer` to a a bunch of procs (of differing types) stored in a `Table` how would I deref properly at runtime? |
03:55:21 | FromDiscord | <Elegantbeef> `cast[procType](myProc)(args)` |
03:55:26 | FromDiscord | <Elegantbeef> Arrays are openarrays |
03:56:08 | FromDiscord | <salt rock lamp> oh i see. thank you |
04:07:43 | * | droidrage quit (Remote host closed the connection) |
04:07:43 | * | ixmpp quit (Remote host closed the connection) |
04:10:59 | * | arkurious quit (Quit: Leaving) |
04:19:33 | * | ixmpp joined #nim |
04:29:30 | FromDiscord | <Tuatarian> Right beef but the question is how would I generate that programmatically at runtime |
04:29:49 | FromDiscord | <Tuatarian> Given any procname, proctype (known, but not at comp time) |
04:30:04 | FromDiscord | <Elegantbeef> You cannot |
04:30:16 | FromDiscord | <Elegantbeef> You need to know at compiletime what proc you're going to call |
04:30:19 | FromDiscord | <Elegantbeef> Since you need to invoke it |
04:48:14 | FromDiscord | <ChocolettePalette> You can do this in C at runtime doe... |
04:51:16 | FromDiscord | <Elegantbeef> Uhh |
05:00:32 | FromDiscord | <ChocolettePalette> So here we come to a conclusion that Nim is less expressive than C, don't we? |
05:00:44 | FromDiscord | <Elegantbeef> Not really |
05:00:50 | FromDiscord | <Elegantbeef> How do you do it in C? |
05:02:13 | FromDiscord | <ChocolettePalette> With void\ pointers for both functions and their argument, e.g. `void func(void data)` or smth |
05:03:06 | FromDiscord | <ChocolettePalette> Well it can be done in Nim too, but it won't be a Nim way to do this |
05:04:54 | FromDiscord | <ChocolettePalette> Just like Rust can do many stuff but requires using unsafe which makes the solution weird considering Rust philosophy |
05:05:52 | FromDiscord | <Elegantbeef> You can make the proc a `proc(data: ref)` and it's a bit cleaner |
05:06:45 | FromDiscord | <Elegantbeef> But yea it's still bleh |
05:06:56 | FromDiscord | <Elegantbeef> You're doing something inherently not statically typed |
05:07:17 | FromDiscord | <ChocolettePalette> Will it be a GC-safe data which can be casted to what one needs? |
05:08:32 | FromDiscord | <Elegantbeef> sorta |
05:08:42 | FromDiscord | <Elegantbeef> But with orc you need `pointer` anyway atleast on the calling side |
05:21:40 | * | ltriant quit (Ping timeout: 256 seconds) |
05:25:09 | * | ltriant joined #nim |
05:41:14 | * | ltriant quit (Ping timeout: 260 seconds) |
06:33:37 | FromDiscord | <tbrekalo> anyone good good neovim setup with nim? |
06:34:00 | FromDiscord | <tbrekalo> working with default nimlsp and pooling syntax from somewhere? |
07:11:28 | Zevv | Plug 'alaviss/nim.nvim' |
07:11:44 | Zevv | if (&ft=='nim' ) |
07:11:47 | Zevv | let g:nim_noremap = 1 |
07:11:47 | Zevv | nmap <C-]> <Plug>NimGoToDefBuf |
07:11:47 | Zevv | nmap <M-]> <Plug>NimOutline |
07:11:48 | Zevv | endif |
07:12:04 | Zevv | it's a good neovim setup, but does no check your other boxes :) |
07:25:17 | FromDiscord | <tbrekalo> Oh; might need to do it on my own then |
07:44:21 | * | junaid_ joined #nim |
07:54:17 | * | pro joined #nim |
08:57:06 | * | jmdaemon quit (Ping timeout: 252 seconds) |
08:59:33 | * | jmdaemon joined #nim |
09:12:36 | FromDiscord | <Phil> unit testing question into the round |
09:12:43 | FromDiscord | <Phil> I'd like to test my procs individually |
09:13:01 | FromDiscord | <Phil> So basically the typical one testfile for each module file |
09:13:20 | FromDiscord | <Phil> How do I actually import that module file into the test? |
09:14:38 | FromDiscord | <Phil> Because imports like `import ../../src/snorlogue/filePathType` don't really work |
09:25:54 | * | pro quit (Ping timeout: 256 seconds) |
09:35:21 | FromDiscord | <Rika> ? |
09:35:28 | FromDiscord | <Rika> I don’t understand the question |
09:40:33 | NimEventer | New thread by fxn: Sequtils.nim(786, 15) Error: expected: ':', but got: 'result', see https://forum.nim-lang.org/t/9685 |
09:40:37 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4hzD |
09:40:44 | FromDiscord | <.tochka> wonder is it possible to instruct require nimble package only when certain module is imported. probably not as nimble is executed before compiler? |
09:40:49 | * | derpydoo joined #nim |
09:41:20 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4hzD" => "https://play.nim-lang.org/#ix=4hzE" |
09:42:05 | FromDiscord | <.tochka> In reply to @Isofruit "How do I actually": usually you have config.nims with `switch("path", "$projectDir/../src")` |
09:43:17 | FromDiscord | <.tochka> if you're doing nimble way of course |
09:43:19 | FromDiscord | <Phil> I do, does that change the available import paths? |
09:43:46 | FromDiscord | <.tochka> ye, `import module` should work instead of `import ../src/module` |
09:44:30 | FromDiscord | <Phil> It did! Got to keep that one in mind |
09:45:35 | FromDiscord | <Phil> The nice thing about nim procs is that an entire type of tests ("How does it handle null") just evaporates due to excessive usage of non-ref types everywhere |
09:50:32 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4hzF |
09:51:39 | FromDiscord | <.tochka> probably better to separate cases to different test files, and do it without define |
09:52:08 | FromDiscord | <.tochka> could just have some file you include with shared test implementation for both |
09:53:11 | FromDiscord | <Phil> "testRepository" basically.↵Fair, I was mostly asking though if there's a clean way to check that defining `-d:sqlite` leads to importing and exporting the `sqliteRepository` module etc. |
09:53:26 | FromDiscord | <.tochka> ahh |
09:53:34 | FromDiscord | <Phil> Which means that the test would need to do the compilation and be able to define flags |
09:54:39 | FromDiscord | <.tochka> probably gotta check for availability of some specific symbols |
09:55:06 | FromDiscord | <.tochka> and for export testing would need to import that and test again or something |
09:55:20 | FromDiscord | <.tochka> not sure by what doe |
09:56:17 | FromDiscord | <Phil> I think either way I might just have to run the same test-suite twice, once with each compiler-flag |
10:02:45 | FromDiscord | <Phil> I may need to rewire my brain on how to do testing.↵In Java you typically mock all the internal components used from elsewhere away so that only the code in that specific file remains. I can't really do that in nim, I can only take a function as it is available and test its entire functionality |
10:10:37 | NimEventer | New thread by ingo: Ftpclient download problem., see https://forum.nim-lang.org/t/9686 |
10:29:46 | * | pro joined #nim |
10:55:36 | * | Simon[m]12345 joined #nim |
11:01:40 | * | junaid_ quit (Remote host closed the connection) |
11:11:47 | * | ltriant joined #nim |
11:16:40 | * | ltriant quit (Ping timeout: 252 seconds) |
11:24:42 | * | AMIGrAve joined #nim |
11:25:11 | AMIGrAve | Hi there, I remember reading somewhere that there was a meta module which includes usual stuff such as strformat, parseutils, ... but I can't remember it's name, can't find it on google, and I've browsed a bit the files in the stdlib but nothing triggered any "gotcha!", has this module been removed ? |
11:26:03 | FromDiscord | <ringabout> it is called prelude |
11:26:20 | AMIGrAve | ringabout: Thank you so much ! |
11:26:43 | FromDiscord | <ringabout> Np |
11:27:55 | NimEventer | New question by A.K _ThePortal: Nim: expression &#39;a&#39; is of type &#39;int&#39; and has to be used (or discarded), see https://stackoverflow.com/questions/74666275/nim-expression-39a39-is-of-type-39int39-and-has-to-be-used-or-disc |
11:29:48 | AMIGrAve | and indeed 'prelude' didn't rang a bell. Is it worth for me to do a PR in order to specify in the heading doc comment of each included module that it is included by prelude, or such a PR would not be accepted ? |
11:32:44 | * | ltriant joined #nim |
11:38:54 | * | ltriant quit (Ping timeout: 268 seconds) |
11:40:08 | * | AMIGrAve quit (Ping timeout: 268 seconds) |
11:41:54 | * | jmdaemon quit (Ping timeout: 256 seconds) |
11:58:53 | FromDiscord | <ambient> Why do these two different iterators return the same value? If I comment out the other echo line, it works fine. (Advent of Code spoilers) https://github.com/amb/aoc2022/blob/master/3/s.nim |
12:03:29 | * | ltriant joined #nim |
12:08:30 | * | ltriant quit (Ping timeout: 268 seconds) |
12:13:47 | * | AMIGrAve joined #nim |
12:15:01 | NimEventer | New thread by pposca: Forum subscription feature, see https://forum.nim-lang.org/t/9687 |
12:20:27 | * | PMunch joined #nim |
12:25:21 | FromDiscord | <メッリーレイムー 🎄> do you guys prefix enum members or just use {.pure.}\ |
12:25:22 | FromDiscord | <メッリーレイムー 🎄> (edit) "{.pure.}\" => "{.pure.}?" |
12:25:42 | FromDiscord | <Generic> overloadable enums |
12:25:46 | FromDiscord | <Generic> so neither |
12:25:50 | FromDiscord | <メッリーレイムー 🎄> In reply to @Generic "overloadable enums": wdym |
12:26:27 | FromDiscord | <Rika> Pure does not enforce qualification anymore as far as I know |
12:26:35 | FromDiscord | <ezquerra> In reply to @AMIGrAve "Hi there, I remember": @AMIGrabe, using orelude has a few drawbacks, such as the fact that you must include instead of importing it like most other packages. Instead you could use the “batteries” module that I created (and which you can install using nimble). Batteries is similar to prelude but you can import it and it also imports a few additional modules that prelude doesn’t include |
12:26:45 | FromDiscord | <ezquerra> (edit) "orelude" => "prelude" |
12:27:13 | FromDiscord | <Generic> In reply to @メッリーレイムー 🎄 "wdym": https://nim-lang.org/docs/manual.html#types-overloadable-enum-field-names |
12:29:06 | FromDiscord | <Yardanico> In reply to @ezquerra "@AMIGrabe, using prelude has": include fact is no longer true |
12:29:12 | FromDiscord | <Yardanico> nowadays you can import prelude instead of including it |
12:29:24 | FromDiscord | <Yardanico> but yes, it's better to just use batteries or write your own file yourself with modules you think you frequently need |
12:30:11 | FromDiscord | <メッリーレイムー 🎄> im using a mix of `pure` enums for the AST LiteralKind enum and non pure enums because otherwise `not` would conflict w/ the languages `not` keyword |
12:30:21 | FromDiscord | <メッリーレイムー 🎄> so i prefix token not w/ `tk` |
12:30:41 | FromDiscord | <メッリーレイムー 🎄> this is what i do for my ast tho |
12:30:48 | FromDiscord | <メッリーレイムー 🎄> sent a code paste, see https://play.nim-lang.org/#ix=4hAm |
12:31:15 | FromDiscord | <Yardanico> any reason you're using a mix of object variants and inheritance instead of just using one of them? |
12:31:21 | FromDiscord | <メッリーレイムー 🎄> wdym? |
12:31:30 | FromDiscord | <Yardanico> just curious |
12:31:40 | FromDiscord | <Yardanico> you're using both inheritance (ref object of ..) and object variants (case kind: of ) |
12:31:50 | FromDiscord | <Yardanico> why not e.g. make IntLiteral and StringLiteral as sub types of Literal? |
12:32:35 | FromDiscord | <メッリーレイムー 🎄> im only using OOP for the ast nodes because it makes slightly more sense to me than having everything be an object variant under one node |
12:33:16 | FromDiscord | <メッリーレイムー 🎄> @Yardanico how would u structure this? |
12:33:30 | FromDiscord | <Yardanico> i don't have a strict opinion, I was just curious, that's all :P |
12:35:01 | * | AMIGrAve quit (Ping timeout: 268 seconds) |
12:35:26 | FromDiscord | <ezquerra> In reply to @Yardanico "include fact is no": I don’t think that’s the case. I made a PR to fix that some time ago but I don’t think it was accepted. Checking the current std/prelude code does not show any call to export which is what would be needed to support import… |
12:36:15 | FromDiscord | <Yardanico> In reply to @ezquerra "I don’t think that’s": ah yeah you're right, I got confused by runnableExamples automatically inserting the import statement of the current module |
12:36:57 | FromDiscord | <メッリーレイムー 🎄> i mean would u use object variants instead? |
12:39:25 | * | AMIGrAve joined #nim |
12:47:25 | * | AMIGrAve quit (Ping timeout: 260 seconds) |
12:53:14 | * | AMIGrAve joined #nim |
12:57:50 | * | AMIGrAve quit (Ping timeout: 256 seconds) |
13:17:06 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4hAD |
13:18:17 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4hAE |
13:18:50 | FromDiscord | <ringabout> const closure function doesn't always work. |
13:20:26 | FromDiscord | <ringabout> `let` works. |
13:21:14 | FromDiscord | <ringabout> `let generatedProc {.compileTime.} : DummyProc = generateProc(string)↵` works too. |
13:26:18 | FromDiscord | <Rika> If you don’t need a closure, annotate your types and return value with nimcall |
13:26:33 | * | AMIGrAve joined #nim |
13:31:10 | * | AMIGrAve quit (Ping timeout: 260 seconds) |
13:33:08 | * | derpydoo quit (Ping timeout: 248 seconds) |
13:36:26 | FromDiscord | <ringabout> A known issue https://github.com/nim-lang/Nim/issues/20545 |
13:37:31 | FromDiscord | <ringabout> Or https://github.com/nim-lang/Nim/issues/19005 |
13:43:01 | * | ltriant joined #nim |
13:43:08 | Zevv | PMunch: https://note89.github.io/the-advent-of-code-ai-edition/#day-1--challenge-1 |
13:47:47 | * | ltriant quit (Ping timeout: 268 seconds) |
13:50:25 | * | AMIGrAve joined #nim |
13:55:04 | * | AMIGrAve quit (Ping timeout: 256 seconds) |
13:56:37 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4hAY |
13:57:15 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4hAY" => "https://play.nim-lang.org/#ix=4hAZ" |
13:57:33 | FromDiscord | <ringabout> irrc the tests of Prologue check it too. |
13:58:00 | FromDiscord | <Phil> Ahhh, so stealing from prologue tests, I'll be back after diving in there |
13:58:38 | FromDiscord | <ringabout> In reply to @Isofruit "Ahhh, so stealing from": Here you are => https://github.com/planety/prologue/blob/533c393f19f73b8e9ded18873d6721985ed2f9ae/tests/server/tserver_application.nim#L34 |
14:00:15 | FromDiscord | <ringabout> that file is not well written though. |
14:00:23 | * | krux02 joined #nim |
14:03:01 | * | pro left #nim (#nim) |
14:06:42 | FromDiscord | <Phil> Okay, so have a file that defines the server to boot.↵Define the CLI command to compile it with `execCmd` to a binary and run it with `startProcess`, which will boot the server (why not spawn btw?).↵Now the big question for me is, when does `startProcess` return and your code continue running?↵When the new process has been created and the binary has started to execute (which is not yet when the server is up, it'll take the server sta |
14:07:01 | FromDiscord | <Phil> Basically how can you be sure when your client-code starts running that the prologue server isn't still in the "booting up" phase? |
14:12:18 | FromDiscord | <ringabout> https://github.com/planety/prologue/blob/533c393f19f73b8e9ded18873d6721985ed2f9ae/tests/server/tserver_application.nim#L41 It uses `asynchttpclient` to check whether the server is ready or not and repeat until the address can be pinged. |
14:16:42 | FromDiscord | <ringabout> > (why not spawn btw?).↵Yeah, that is a better idea. Nim is new to me when I wrote the code. Perhaps I didn't even |
14:16:51 | FromDiscord | <ringabout> (edit) "is" => "was" |
14:17:10 | FromDiscord | <ringabout> (edit) removed "Perhaps I didn't even" |
14:17:42 | FromDiscord | <ringabout> (edit) "> (why not spawn btw?).↵Yeah, that is a better idea. ... Nimmuch" added "I didn't know" | "was new to me" => "much" |
14:27:33 | FromDiscord | <Phil> Ahhh that's what the async client is for |
14:28:23 | FromDiscord | <Phil> Does it need to be an async client though? Seems like a normal client could do the same job |
14:30:06 | FromDiscord | <ringabout> Yeah, `HttpClient` should suffice. |
14:32:54 | FromDiscord | <Phil> gnaa, spawn enforces gcsafety |
14:48:39 | * | qwr quit (Ping timeout: 260 seconds) |
14:55:44 | FromDiscord | <deech> sent a code paste, see https://play.nim-lang.org/#ix=4hBb |
15:08:06 | * | ltriant joined #nim |
15:12:54 | * | ltriant quit (Ping timeout: 260 seconds) |
15:39:43 | * | ltriant joined #nim |
15:44:24 | * | ltriant quit (Ping timeout: 260 seconds) |
16:11:17 | * | ltriant joined #nim |
16:17:01 | * | ltriant quit (Ping timeout: 268 seconds) |
16:26:52 | FromDiscord | <Phil> In reply to @ringabout "> (why not spawn": I set up my tests based on your code.↵Did a bit of renaming and refactoring to suit my needs. ↵https://github.com/PhilippMDoerner/Snorlogue/tree/main/tests/utils↵In case you would want to use any of it |
16:27:38 | FromDiscord | <!!sharpcdf!!> does anyone know why `l.match(re"=(\s)?\w+")` keep returning false? `l = "arg = hello"` |
16:27:48 | FromDiscord | <!!sharpcdf!!> it works in two regex testers ive used but not in nim |
16:27:52 | FromDiscord | <Phil> It might actually be a nice idea to make a little package out of that for "testing prologue" or sth |
16:28:00 | FromDiscord | <Phil> Noted for later |
16:28:31 | FromDiscord | <ringabout> In reply to @Isofruit "I set up my": Nice, it is the time for a CI workflow 🎉 |
16:29:03 | FromDiscord | <Phil> One after the other, I actually need to figure out how I'd want to perform postgres tests |
16:29:40 | FromDiscord | <Phil> Likely a container will need to be started as part of the tests, meaning the test-suite would need to include docker commands for downloading and running one |
16:36:02 | FromDiscord | <ringabout> https://github.com/PhilippMDoerner/Snorlogue#installation says that you can use `nimble install -y snorlogue`. But Snorlogue hasn't been added to nimble packages. |
16:38:34 | FromDiscord | <Phil> That's why the first line of the Readme exists 😄 |
16:38:47 | FromDiscord | <Phil> Maybe I should put it in h1 tags |
16:42:48 | FromDiscord | <ringabout> lol, I see |
16:44:07 | * | ltriant joined #nim |
16:48:52 | * | ltriant quit (Ping timeout: 248 seconds) |
17:07:31 | FromDiscord | <メッリーレイムー 🎄> what's the best way of representing Haskell/Rust enums/ADTs in Nim? If I use object variant then I still have to use a case of to check where as in Haskell Expr is it's own type |
17:08:10 | FromDiscord | <メッリーレイムー 🎄> using inheritance instead seems not the best idea so i'd like to use object variants but not sure how to |
17:09:16 | FromDiscord | <メッリーレイムー 🎄> (edit) "what's the best way of representing Haskell/Rust enums/ADTs in Nim? If I use object variant then I still have to use a case of ... to" added "everywhere" |
17:09:33 | FromDiscord | <メッリーレイムー 🎄> (edit) "using inheritance instead ... seems" added "would achieve what i'm looking for but" |
17:13:53 | FromDiscord | <メッリーレイムー 🎄> or am i misunderstanding |
17:14:41 | FromDiscord | <Phil> Finally getting to somewhere where the test code feels somewhat okay https://media.discordapp.net/attachments/371759389889003532/1048648481511833730/image.png |
17:17:26 | FromDiscord | <メッリーレイムー 🎄> basically I want a Sum type |
17:17:38 | FromDiscord | <deech> In reply to @メッリーレイムー 🎄 "what's the best way": Yes you can get some surface level emulation of ADTs using macros and various pattern matching libraries but you don't get exhaustiveness checking. IMO it's best to just them as a Pascal style variant. |
17:17:52 | FromDiscord | <メッリーレイムー 🎄> In reply to @deech "Yes you can get": could you give an example? |
17:18:13 | FromDiscord | <メッリーレイムー 🎄> of the pascal style variant |
17:19:59 | FromDiscord | <deech> In reply to @メッリーレイムー 🎄 "of the pascal style": That's what Nim's object variant is modeled after so Nim itself is the best example. |
17:20:06 | FromDiscord | <メッリーレイムー 🎄> oh ok |
17:20:16 | * | AMIGrAve joined #nim |
17:21:21 | PMunch | Getting ready for streaming day three :) |
17:21:24 | FromDiscord | <deech> In reply to @メッリーレイムー 🎄 "oh ok": But I do agree that it's a shame Nim doesn't have native ADTs with pattern matching. It would a huge improvement. |
17:21:56 | FromDiscord | <deech> (edit) "improvement." => "improvement but it seems like the author of Nim doesn't like either." |
17:23:02 | * | PMunch quit (Quit: leaving) |
17:23:29 | FromDiscord | <メッリーレイムー 🎄> i may just use inheritance then so I can pass around Expr instead of having to use a million case of variants |
17:23:35 | FromDiscord | <メッリーレイムー 🎄> not an ideal solution at all |
17:24:03 | FromDiscord | <メッリーレイムー 🎄> nim with ADTs and pattern matching would be a dream |
17:24:15 | FromDiscord | <メッリーレイムー 🎄> it could even complement the existing variant system |
17:25:24 | * | PMunch joined #nim |
17:25:39 | FromDiscord | <deech> In reply to @メッリーレイムー 🎄 "it could even complement": You could write up an RFC but right now I suspect it won't go very far unfortunately. |
17:30:09 | FromDiscord | <メッリーレイムー 🎄> kinda surpised it doesnt have pattern matching when even java and python has it |
17:30:41 | FromDiscord | <メッリーレイムー 🎄> @PMunch where are you streaming |
17:30:50 | FromDiscord | <spoon> sl is a seq of seq of ints, why does this give me the error "expression expected but found ')'"?↵`echo sl.map(proc(x: seq[int]): int = for i in x:(result += i))` |
17:31:09 | FromDiscord | <メッリーレイムー 🎄> (edit) "kinda surpised it doesnt have pattern matching when even java and python has it ... " added "now" |
17:31:54 | FromDiscord | <spoon> or thats what my lsp is telling me, executing says it requires indentation, for loop should work with parentheses, no? |
17:32:16 | FromDiscord | <メッリーレイムー 🎄> i think for is a statement but i could be wrong |
17:34:13 | FromDiscord | <spoon> well i've done code golfing in nim and parens around for loop statements have worked before... |
17:34:35 | PMunch | On Twitch: https://www.twitch.tv/pmunche and on YouTube: https://www.youtube.com/watch?v=jQ6gFQ5a1DI メッリーレイムー 🎄 |
17:45:42 | FromDiscord | <メッリーレイムー 🎄> @PMunch i just dropped a sub btw on YT |
17:45:52 | FromDiscord | <メッリーレイムー 🎄> do u stream often? |
17:50:35 | arkanoid | question: is nims (VM) == compile time execution? https://nim-lang.org/docs/nims.html I mean, all I can do in nims I can do at compile time in nim program? |
17:54:15 | FromDiscord | <Yardanico> yes |
17:54:30 | FromDiscord | <spoon> found out there was a much much simpler way of doing what i was doing, trying to learn rust was my downfall |
17:54:50 | FromDiscord | <メッリーレイムー 🎄> is nims the scripting language variant |
17:54:52 | FromDiscord | <spoon> never do rust not even once |
17:55:01 | FromDiscord | <メッリーレイムー 🎄> agreed rust is bad |
17:55:05 | FromDiscord | <spoon> yes, it runs in a vm and you can embed it |
17:55:21 | FromDiscord | <メッリーレイムー 🎄> its community is annoying too |
17:55:23 | FromDiscord | <Yardanico> In reply to @メッリーレイムー 🎄 "is nims the scripting": nim in the vm is called nimscript |
17:55:29 | FromDiscord | <Screentapper> Is there a way to autocomplete `import` statements in vscode - eg to list system libraries or even libraries from nimble? |
17:56:15 | FromDiscord | <Yardanico> yes, the nimsaem extension does that already for nimble packages |
17:56:18 | FromDiscord | <メッリーレイムー 🎄> @spoon i sent u a dm fellow 2hu enjoyer |
17:56:20 | FromDiscord | <Yardanico> but it doesn't do it for the stdlib |
17:56:37 | FromDiscord | <Yardanico> https://marketplace.visualstudio.com/items?itemName=nimsaem.nimvscode |
17:56:43 | FromDiscord | <Yardanico> you should use this extension if you're using nim |
17:56:46 | FromDiscord | <Yardanico> (edit) "you should use this extension if you're using nim ... " added "in vscode" |
17:57:11 | FromDiscord | <メッリーレイムー 🎄> theres another one |
17:57:16 | FromDiscord | <メッリーレイムー 🎄> by konstantin something |
17:57:21 | FromDiscord | <Yardanico> i know, that was the main one |
17:57:24 | FromDiscord | <Yardanico> and it's unmaintained now |
17:57:27 | FromDiscord | <Yardanico> that's why you should use this one |
17:57:41 | FromDiscord | <Yardanico> this extension is a port of the original nim extension from js to nim (since nim has a js backend) and has other improvements |
17:58:00 | FromDiscord | <Yardanico> err, right, the original was in typescript, not much different though |
17:58:00 | FromDiscord | <Screentapper> In reply to @Yardanico "yes, the nimsaem extension": Maybe I need to set it up or something |
17:58:11 | FromDiscord | <Yardanico> no, it should just work if you have nim correctly set up |
17:58:52 | FromDiscord | <メッリーレイムー 🎄> ah |
17:58:56 | FromDiscord | <メッリーレイムー 🎄> ill switch then |
17:59:29 | FromDiscord | <メッリーレイムー 🎄> whats the difference between them? |
17:59:31 | FromDiscord | <Screentapper> In reply to @Yardanico "err, right, the original": I'm on Linux, `nim` and `nimble` are in my path... |
17:59:37 | FromDiscord | <Yardanico> what about `nimsuggest` ? |
17:59:45 | FromDiscord | <Yardanico> and are you sure it doesn't work? |
17:59:54 | FromDiscord | <Yardanico> as I said, in nimsaem's extension it only works for nimble pkgs that you have installed |
18:02:04 | FromDiscord | <メッリーレイムー 🎄> does it autocomplete stdlib? |
18:02:11 | FromDiscord | <Yardanico> no as i said |
18:02:25 | FromDiscord | <Yardanico> it shouldn't be that hard to add that though I guess |
18:06:14 | * | derpydoo joined #nim |
18:16:56 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4hCd |
18:17:19 | FromDiscord | <jmgomez> besides doing another overload oc |
18:17:51 | FromDiscord | <Screentapper> https://media.discordapp.net/attachments/371759389889003532/1048664379031302195/nim-autocomplete1.mp4 |
18:19:44 | FromDiscord | <Screentapper> In reply to @Yardanico "as I said, in": Ahhh, that might be the issue 😅 |
18:23:30 | FromDiscord | <Gumbercules> In reply to @jmgomez "how can one make": make `options` an `Option[FModifyContextOptions]` and supply a default value of `none(FModifyContextOptions)` for the parameter |
18:23:51 | FromDiscord | <Gumbercules> then inside `addMappingContext` you can do `isSome(options)` or `isNone(options` |
18:23:58 | FromDiscord | <Gumbercules> that or use a pointer |
18:24:09 | FromDiscord | <Gumbercules> (edit) "pointer" => "pointer/ref" |
18:24:41 | FromDiscord | <jmgomez> In reply to @Gumbercules "make `options` an `Option[FModifyContextOptions]`": I prefer to avoid changing the API, since it's an automatic binding |
18:24:49 | FromDiscord | <Gumbercules> other hackery might involve adding a field to `FModifyContextOptions` and initializing it to -1 or some bs, that or you could just check to see if you're dealing with an uninitialized object |
18:24:51 | FromDiscord | <Gumbercules> well then you're a bit out of luck |
18:25:04 | FromDiscord | <Gumbercules> because you can't have `nil` non ref var parameters |
18:25:21 | FromDiscord | <Gumbercules> you'd have the same problem in C |
18:25:52 | FromDiscord | <Gumbercules> best bet is probably just to see if options = FModifyContextOptions() |
18:25:53 | FromDiscord | <jmgomez> Okay, that's what I suspected but wanted to be sure. Will do an overload and praise to dont have lots of these on the same signature |
18:25:56 | FromDiscord | <Gumbercules> (edit) "=" => "==" |
18:26:16 | FromDiscord | <jmgomez> thanks for looking into it! |
18:26:20 | * | wallabra quit (Ping timeout: 260 seconds) |
18:26:22 | FromDiscord | <Gumbercules> yeah this is where I usually just say fuck it and use `ptr` |
18:26:36 | FromDiscord | <Gumbercules> sure thing! have been to this rodeo once or twice 😉 |
18:27:23 | FromDiscord | <jmgomez> thing is in cpp probably they expect it to dont be nil |
18:27:53 | FromDiscord | <Gumbercules> what is the C++ function signature> |
18:27:55 | FromDiscord | <Gumbercules> (edit) "signature>" => "signature?" |
18:28:35 | FromDiscord | <jmgomez> let me check |
18:28:38 | FromDiscord | <Gumbercules> https://docs.unrealengine.com/5.0/en-US/API/Plugins/EnhancedInput/IEnhancedInputSubsystemInterface/AddMappingContext/ ? |
18:28:51 | FromDiscord | <Gumbercules> https://docs.unrealengine.com/5.0/en-US/API/Plugins/EnhancedInput/IEnhancedInputSubsystemInterface/AddMappingContext/2/ |
18:28:55 | FromDiscord | <Gumbercules> looks like it |
18:29:12 | FromDiscord | <Gumbercules> yeah they're passing a reference there |
18:29:15 | FromDiscord | <jmgomez> yeah |
18:30:02 | * | wallabra joined #nim |
18:30:28 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4hCg |
18:30:53 | FromDiscord | <Gumbercules> right which returns a const ref |
18:31:02 | FromDiscord | <Gumbercules> so on the Nim side I would just use a `ptr` |
18:31:33 | FromDiscord | <Gumbercules> You can't use a `ref` because the Nim runtime doesn't own that allocation |
18:31:48 | FromDiscord | <Gumbercules> well it works both ways |
18:32:01 | FromDiscord | <Gumbercules> if UE5 is calling into Nim, Nim won't own the allocation and will try to GC the ref and you'll run into issues |
18:32:10 | FromDiscord | <jmgomez> yes I know Im passing pointers around anyways, I just want the api to be safe |
18:32:14 | FromDiscord | <Gumbercules> if you're calling into UE5 and passing a Nim owned ref, Nim might try to GC it while UE5 is accessing it |
18:32:21 | FromDiscord | <jmgomez> Im doing ptr for the interop and copy semantics |
18:32:22 | FromDiscord | <Gumbercules> well what you're doing is unsafe anyway so |
18:32:28 | FromDiscord | <jmgomez> dont use ref types at all |
18:32:57 | FromDiscord | <Gumbercules> yeah I'd avoid them and just use `ptr` if you can't live with `ptr` then a `var` type is your best bet but you live with the fact that the raw pointer is hidden from you |
18:35:45 | FromDiscord | <jmgomez> I mean, there are two kind of semantics on Unreal. UObject which is pretty much all ptr and they are GCd by UE. On those in the nim side of things it's pointers all the way down. The other kind of semantics are FStructs which are mostly copied but sometimes they are passed as reference. So in that case I just use var. Thing is now with optional values.. maybe I do as you suggest and I will just change the api for those var FStucts |
18:36:18 | * | wallabra_ joined #nim |
18:36:27 | FromDiscord | <Gumbercules> yeah Unreal won't care if you use `ptr` or `var` |
18:36:29 | FromDiscord | <jmgomez> The way the interop is done is via their reflection system rather than binding cpp directly, Im sending over mostly "fake types" that matchs the memory layout |
18:36:33 | FromDiscord | <Gumbercules> `var` is a pointer under the hood anyway |
18:36:38 | FromDiscord | <Gumbercules> sure |
18:36:42 | FromDiscord | <Gumbercules> yeah this is the way to interop in C++ anyway |
18:37:01 | FromDiscord | <jmgomez> In reply to @Gumbercules "`var` is a pointer": yeah I know but wanted to respect the semantics as much as I can |
18:37:09 | FromDiscord | <jmgomez> var ref are kinda close |
18:37:12 | FromDiscord | <Gumbercules> well using `ptr` is coming closer to matching C++ semantics |
18:37:15 | FromDiscord | <jmgomez> (cpp ref I meant) |
18:37:25 | FromDiscord | <Gumbercules> C++ has nothing like Nim's `var` |
18:37:41 | FromDiscord | <jmgomez> hmm I think & (ref) is quite close |
18:37:51 | FromDiscord | <Gumbercules> that's more like Nim's `ref` |
18:38:11 | FromDiscord | <Gumbercules> but obviously a `ref` isn't going to work outside of Nim's runtime without calling `gc_ref` etc.... |
18:38:17 | FromDiscord | <jmgomez> when you say ref dont you refer to gc types? |
18:38:20 | FromDiscord | <Gumbercules> and that's a whole nother world of pain |
18:38:24 | * | wallabra quit (Ping timeout: 256 seconds) |
18:38:31 | * | wallabra_ is now known as wallabra |
18:38:35 | FromDiscord | <Gumbercules> yes, but I mean you can always pass a Nim GC'd object to C/C++ |
18:38:42 | FromDiscord | <Gumbercules> it's just, don't expect the C/C++ side of things to understand what it is |
18:38:54 | FromDiscord | <Gumbercules> or for Nim's runtime to know that you've passed it to C/C++ code |
18:38:57 | FromDiscord | <Gumbercules> this is on the programmer |
18:39:38 | FromDiscord | <jmgomez> ohh yeah, I know.. done that but as ptr. I meant before the closest reasonable thing to & semantics is var that what I did that mapping but yeah got what you are saying |
18:39:44 | FromDiscord | <Gumbercules> I gotcha |
18:40:23 | FromDiscord | <Generic> In reply to @Gumbercules "that's more like Nim's": that's not true |
18:40:26 | FromDiscord | <Gumbercules> yeah if it's a struct being passed by reference, then `var` / `pte` works |
18:40:33 | FromDiscord | <Gumbercules> (edit) "`pte`" => "`ptr`" |
18:40:34 | FromDiscord | <Generic> Nim's ref is like std::shared_ptr |
18:40:43 | FromDiscord | <Gumbercules> yes I was confused by the Unreal types, excuse me |
18:41:44 | FromDiscord | <Gumbercules> and no it's not really |
18:41:56 | FromDiscord | <Gumbercules> at least not under the old memory model |
18:42:08 | FromDiscord | <Gumbercules> thus the existence of the smart_ptrs module |
18:42:18 | FromDiscord | <Generic> well it isn't atomic |
18:42:36 | FromDiscord | <Generic> but otherwise it is pretty similar |
18:42:51 | FromDiscord | <Gumbercules> again not under the default gc, but whatever |
18:42:58 | FromDiscord | <メッリーレイムー 🎄> sent a code paste, see https://play.nim-lang.org/#ix=4hCj |
18:47:08 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4hCl |
18:47:20 | PMunch | メッリーレイムー 🎄, not sure if you watched the stream where I replied to your question. But I try to stream my AoC solutions every day, otherwise I only do occasional streams, haven't done any for quite a while |
18:48:18 | FromDiscord | <jmgomez> (edit) "https://play.nim-lang.org/#ix=4hCl" => "https://play.nim-lang.org/#ix=4hCm" |
18:48:35 | FromDiscord | <メッリーレイムー 🎄> In reply to @PMunch "メッリーレイムー 🎄, not sure if": i was watching then got distracted' |
19:18:16 | arkanoid | how to print an object variant? `$` is not defined, only repr works out of the box, which is not ideal |
19:19:57 | FromDiscord | <Generic> define your own |
19:20:21 | FromDiscord | <メッリーレイムー 🎄> whats a good name for a object holding both the type information for an AST node, as well as any specifiers like if it is constant or not |
19:35:57 | arkanoid | k |
19:41:44 | FromDiscord | <Phil> Do we have a convenience function to remove unnecessary whitespace from HTML? |
19:42:23 | FromDiscord | <Phil> Mostly asking because I'm testing HTTP responses from my prologue server and I'd like to cut down the sheer fuckton of whitespace noise I added elsewhere to make the templates there read nicely |
19:42:53 | FromDiscord | <Phil> Because I'm printing said HTML to console/error logs if an assertion fails |
19:55:20 | FromDiscord | <c4ulmu> Hey, how do I copy seq ? I can't find it |
19:58:41 | Amun-Ra | var b = a? |
19:59:18 | Amun-Ra | there's also system/shallowCopy |
19:59:26 | Amun-Ra | and deepCopy, too |
19:59:36 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4hCE |
19:59:38 | FromDiscord | <Phil> Typed together in inim |
20:00:02 | * | sagax quit (Read error: Connection reset by peer) |
20:00:28 | Amun-Ra | assigning to var copies seq, whether it's a deep or shallow copy I don't know (I bet it's shallow one) |
20:00:39 | FromDiscord | <Horizon [She/Her]> What would be the best way to do webdev with Nim? I want to test my app fast but Nim isn't exactly super fast when compiling aha |
20:00:51 | FromDiscord | <Phil> In what sense? |
20:00:55 | FromDiscord | <Phil> What's the featurescope you want? |
20:00:58 | FromDiscord | <Phil> What's your userscope |
20:01:54 | FromDiscord | <Horizon [She/Her]> Wdym by that? I just want quick compilation to test my app (I'm using a local web server to serve my files so) |
20:02:01 | FromDiscord | <c4ulmu> Cool. But why nim uses this approach. I mean usually list or big vector doesn't copied but uses pass by reference. It can be very expensive perfomance wise |
20:02:23 | FromDiscord | <c4ulmu> and how do I pass it to function without copying? |
20:02:34 | FromDiscord | <Horizon [She/Her]> `var seq[type]` |
20:02:42 | FromDiscord | <Horizon [She/Her]> `type` being the actual type |
20:02:48 | FromDiscord | <Horizon [She/Her]> Note this needs the list to be mutable |
20:02:52 | Amun-Ra | c4ulmu: because it's a "var", if you do let b = a it won't make a copy |
20:02:55 | FromDiscord | <Horizon [She/Her]> And also means the list can be edited |
20:03:08 | Simon[m]12345 | Nim can run interpreted, fast to test in webdev context. |
20:03:18 | FromDiscord | <Horizon [She/Her]> In reply to @Event Horizon "And also means the": (In the function) |
20:03:27 | FromDiscord | <Horizon [She/Her]> In reply to @Simon "Nim can run interpreted,": In the web? How? |
20:04:01 | FromDiscord | <Phil> I mean, you just need a dummy-webserver to spin up with ideally a route that can react to stuff I assume? |
20:04:23 | FromDiscord | <Phil> I'm trying to wrap my head around what you mean by "application", so far I'm guessing you got a native application that pings to a server somewhere? |
20:04:29 | FromDiscord | <Phil> Or is this about karax? |
20:04:32 | FromDiscord | <c4ulmu> Thank you. I guess I get the idea |
20:04:33 | FromDiscord | <Phil> Or something else entirely |
20:06:00 | FromDiscord | <Horizon [She/Her]> No i mean, I just want to use clientside Nim (so JS backend) for my app, I'm just doing a lot of DOM-related things, and i want to be able to test my Nim code very quickly, but compilation of big projects tend to slow down quite a lot so i want to know if there's a quicker way to compile Nim to JS |
20:06:13 | FromDiscord | <Horizon [She/Her]> I'm not having issues with the code at all |
20:06:37 | * | ltriant joined #nim |
20:07:00 | FromDiscord | <Phil> Ohhhhhh okay... I'm out when it comes to "quicker compile speeds". I mean, devel compiles pretty quickly for me these days (1.7.3), you on that yet? |
20:07:23 | FromDiscord | <Horizon [She/Her]> Ah fair, I'll use Nim devel then |
20:07:29 | FromDiscord | <Horizon [She/Her]> Thanks anyway aha |
20:07:45 | FromDiscord | <Phil> Try it out first, I actually did not take any data, but to me it felt like compile speeds bumped up |
20:08:04 | FromDiscord | <Horizon [She/Her]> Yeah fair |
20:08:23 | FromDiscord | <Horizon [She/Her]> Is there a way to run a command after a file hasn't been edited for 5 seconds? :p |
20:11:20 | FromDiscord | <Horizon [She/Her]> Ah found a VSC extension for that |
20:11:21 | * | ltriant quit (Ping timeout: 268 seconds) |
20:12:00 | FromDiscord | <demotomohiro> @c4ulmu `a = b` copys seq does not means they are passed by copy when you call procedures. Nim optimize how parameters are passed based on sizeof parameter type.↵Also `a = b` can also optimized to move:↵https://nim-lang.org/docs/destructors.html |
20:16:10 | FromDiscord | <Horizon [She/Her]> VSC's Nim extension is really hating using the `dom` module rn, so many errors even after i added `--define:js` in the config file :p |
20:17:49 | FromDiscord | <Horizon [She/Her]> any tips to supress most of those errors? :p |
20:19:13 | FromDiscord | <Require Support> sent a code paste, see https://play.nim-lang.org/#ix=4hCK |
20:20:26 | * | junaid_ joined #nim |
20:21:07 | FromDiscord | <huantian> it rhymed it with it |
20:23:08 | NimEventer | New thread by choltreppe: Parser generator, see https://forum.nim-lang.org/t/9690 |
20:23:17 | * | arkurious joined #nim |
20:46:14 | FromDiscord | <Jessa> could i preview the actual nim code if i have just the ast tree? / nimNode tree |
20:54:02 | FromDiscord | <skaracic> sent a long message, see http://ix.io/4hCP |
20:54:42 | FromDiscord | <メッリーレイムー 🎄> theres `repr` but its kinda messy or you could override `$` |
20:57:31 | FromDiscord | <huantian> `echo fmt"{x = }"` |
20:58:10 | FromDiscord | <huantian> !eval import std/strformat; let x = 1; echo fmt"{x = }" |
20:58:14 | NimBot | Compile failed: x = 1 |
20:58:47 | FromDiscord | <skaracic> Thst doesnt work with a y variable 🙂 |
20:59:03 | FromDiscord | <huantian> !eval import std/strformat; let y = 1; echo fmt"{y = }" |
20:59:07 | NimBot | Compile failed: y = 1 |
20:59:25 | FromDiscord | <huantian> wonder why it says Compile failed, but still prints the correct thing lmao |
21:00:58 | FromDiscord | <skaracic> Are you trolling me or do you not understand what I'm asking for? |
21:01:42 | FromDiscord | <huantian> uh I guess the latter cus I thought that was what you're asking for |
21:02:16 | FromDiscord | <huantian> if you want to debug the value of a variable by printing, use `strformat` or treeform's `print` |
21:02:32 | FromDiscord | <huantian> (edit) "if you want to debug the value of a variable by printing, use `strformat` ... or" added "`{variable = }`" |
21:03:28 | FromDiscord | <skaracic> sent a long message, see http://ix.io/4hCS |
21:03:34 | FromDiscord | <skaracic> I guess I want a macro 😄 |
21:03:40 | FromDiscord | <huantian> right you want treeform's `print` |
21:03:48 | FromDiscord | <skaracic> I'll look into that, thanks 🙂 |
21:03:58 | FromDiscord | <huantian> strformat is generic over the variable name though |
21:04:05 | FromDiscord | <huantian> you can give it any variable name and it'll do what you want |
21:04:22 | FromDiscord | <skaracic> I'm too lazy to strformst all the time 😉 |
21:04:31 | FromDiscord | <demotomohiro> !eval import sugar; dump 1 + 2 + 3 |
21:04:36 | NimBot | 1 + 2 + 3 = 6 |
21:05:22 | FromDiscord | <demotomohiro> !eval import sugar; var a = 1; dump a + 1 |
21:05:28 | NimBot | a + 1 = 2 |
21:05:51 | FromDiscord | <huantian> but it doesn't have colors like `print`! |
21:06:40 | FromDiscord | <skaracic> Close, but no cigar @demotomohiro ↵!eval import sugar; var x = 1; dump x |
21:06:55 | FromDiscord | <skaracic> Print seems like the thing! |
21:06:58 | FromDiscord | <メッリーレイムー 🎄> In reply to @huantian "right you want treeform's": holy shit this is amazing I thought I would have to write an AST pretty printer just to debug |
21:07:07 | FromDiscord | <skaracic> (edit) removed "↵!eval import sugar; var x = 1; dump x" |
21:07:11 | FromDiscord | <skaracic> !eval import sugar; var x = 1; dump x |
21:07:16 | NimBot | x = 1 |
21:07:20 | FromDiscord | <huantian> yeah it even works for `ptr`s and such |
21:08:13 | FromDiscord | <メッリーレイムー 🎄> @huantian i get this tho |
21:08:15 | FromDiscord | <メッリーレイムー 🎄> `/home/rem/Documents/Coding/tsuki/src/tsuki.nim(7, 8) Error: cannot open file: print↵` |
21:08:23 | FromDiscord | <skaracic> In reply to @NimBot "x = 1": Heeey, thst doesnt work on my machine?? I get `Error: undeclared identifier: 'PNimType'` |
21:08:32 | FromDiscord | <メッリーレイムー 🎄> sent a code paste, see https://play.nim-lang.org/#ix=4hCU |
21:08:44 | FromDiscord | <huantian> did you `nimble install print` and/or add `print` to your `.nimble` file? |
21:09:11 | FromDiscord | <メッリーレイムー 🎄> it didnt add it automatically |
21:09:42 | FromDiscord | <huantian> yeah `nimble install` only installs the package globally, it doesn't add it to your project |
21:10:32 | FromDiscord | <メッリーレイムー 🎄> ah ok |
21:11:27 | FromDiscord | <demotomohiro> !eval import print; var a = 3; print a |
21:11:31 | NimBot | Compile failed: /usercode/in.nim(1, 8) Error: cannot open file: print |
21:11:46 | FromDiscord | <huantian> don't think `print` is included on playground |
21:13:32 | FromDiscord | <skaracic> The dark blue output of the variables is hard to read against my terminal background 😛↵Maybe I'll create a PR to change the default to something brighter ↵↵Anyway, thanks again everyone |
21:14:30 | FromDiscord | <Jessa> Can i reconstruct Nim code that i can read from AST / NimNode tree?↵Basically the inverse of `dumpAstGen` |
21:15:17 | * | ltriant joined #nim |
21:15:17 | FromDiscord | <メッリーレイムー 🎄> !eval echo "nim is pog" |
21:15:22 | NimBot | nim is pog |
21:15:29 | FromDiscord | <メッリーレイムー 🎄> good bot |
21:18:30 | FromDiscord | <Phil> Writing yourself tooling for testing is pretty tedious work I must say |
21:20:25 | FromDiscord | <Horizon [She/Her]> So in my program, I'd be able to generate code for multiple programming languages, but I need to figure out a way to have 'arguments', which just let you input data (think about it like how scratch lets you put variables into a block), what would be the most ideal way? |
21:21:07 | FromDiscord | <Horizon [She/Her]> Since it'd need to work for primitive types at least |
21:24:14 | FromDiscord | <demotomohiro> @Jessa Probably this can do it: https://nim-lang.org/docs/macros.html#astGenRepr%2CNimNode |
21:24:34 | FromDiscord | <Jessa> Oo |
21:24:49 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4hD0 |
21:25:34 | FromDiscord | <Jessa> In reply to @demotomohiro "<@268111216277323779> Probably this can": ah, nvm↵that just prints the ast |
21:26:18 | FromDiscord | <voidwalker> or at least have a default return type that I don't have to specify ? |
21:27:54 | FromDiscord | <demotomohiro> @voidwalker I dont it is possible because there are different types in same size like int and float. |
21:28:42 | FromDiscord | <voidwalker> Yes but I am only interested in the int types for return value |
21:29:47 | FromDiscord | <demotomohiro> Also a length of string is determined at runtime but type must be determined at compile type. |
21:30:15 | FromDiscord | <voidwalker> I think a template can be written for this though, to compute the length of the string range, and pass parameter based on that ? |
21:31:06 | FromDiscord | <メッリーレイムー 🎄> In reply to @Event Horizon "So in my program,": what program u writing |
21:33:45 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4hD5 |
21:35:08 | FromDiscord | <Horizon [She/Her]> In reply to @メッリーレイムー 🎄 "what program u writing": It's a website i mean, using Nim |
21:35:19 | FromDiscord | <Horizon [She/Her]> It's a scratch-like code builder |
21:35:25 | FromDiscord | <Horizon [She/Her]> For languages like Python |
21:38:29 | FromDiscord | <Gumbercules> In reply to @Event Horizon "So in my program,": I'm not really sure what you're trying to do - this description is pretty vague but I'd just store them in a buffer with enough reflection information to cast the data in the buffer into whatever type(s) I need |
21:39:19 | FromDiscord | <Gumbercules> for a function I'd probably just create a type to represent the args, then store the arg data in a buffer along with the type name so I'd know how to cast the data in the buffer back into the appropriate type |
21:39:26 | FromDiscord | <Gumbercules> but again, hard to discern what you're really trying to do with that description |
21:40:43 | FromDiscord | <Jessa> In reply to @Jessa "Can i reconstruct Nim": while this would still massively help me, i finally managed to debug it properly |
21:40:51 | FromDiscord | <Jessa> so what i wanted, now works |
21:41:21 | FromDiscord | <Gumbercules> In reply to @Jessa "while this would still": this already exists? |
21:41:36 | FromDiscord | <Jessa> what exists? |
21:42:10 | FromDiscord | <Jessa> the ast structure to readable nim code? |
21:43:21 | FromDiscord | <Gumbercules> mmm, sorry I think I misunderstood |
21:43:53 | FromDiscord | <demotomohiro> If you just want to print AST in a macro, you can do `echo someast.treeRepr`. |
21:44:09 | FromDiscord | <Gumbercules> thought you meant something like - https://nim-lang.org/docs/macros.html#toStrLit%2CNimNode |
21:44:14 | FromDiscord | <Jessa> No, not the ast.↵↵re-constructed nim code from ast tree |
21:44:15 | FromDiscord | <Gumbercules> or maybe you do.... |
21:44:41 | FromDiscord | <Gumbercules> or `treeRepr` |
21:44:50 | FromDiscord | <Jessa> In reply to @Gumbercules "thought you meant something": omg that is it |
21:44:51 | FromDiscord | <Gumbercules> but yeah, you just cleared that up for us 🙂 |
21:45:07 | FromDiscord | <Gumbercules> oh, well then yay! |
21:45:47 | FromDiscord | <Elegantbeef> `.repr`? |
21:48:44 | FromDiscord | <voidwalker> In reply to @voidwalker "is there any hopes": @ElegantBeef will you take a look at this please ? Is a template that rewrites the proc to be called like msg2byteGeneric[uint16], by computing the range length (eg, p..p+3 = 4 -> uint32), the right way to go about this, if I want it "truly" generic ? |
21:49:20 | FromDiscord | <Elegantbeef> Demo gave you the answer |
21:50:25 | FromDiscord | <voidwalker> Not really, he told me how stuff works, I am asking if there's any way I can go around the limitation, by using a template, or macro, for this specific case where length of parameter and thus type of return can be determined at compile time |
21:50:48 | FromDiscord | <voidwalker> Also my parameter is not static (const or literal) |
21:51:23 | FromDiscord | <Elegantbeef> Nim is statically typed you cannot branch the type system dynamically |
21:51:59 | FromDiscord | <Elegantbeef> To branch the type system it has to be flow control that is compiled |
21:52:00 | FromDiscord | <Phil> Do we have a simple, elegant way to map Exceptions to HTTP-Statuscodes? |
21:52:05 | FromDiscord | <Phil> (edit) "Do we have a simple, elegant way to map Exceptions to HTTP-Statuscodes? ... " added "(In Prologue)" |
21:52:06 | FromDiscord | <voidwalker> no, but you can reroute a proc call with a template, based on info you can determine at compile time, no ? |
21:52:41 | FromDiscord | <Elegantbeef> You want to depending on the contents of `s` change the return type of a procedure |
21:53:02 | FromDiscord | <voidwalker> depending on the length of s |
21:53:10 | FromDiscord | <Elegantbeef> That's the content |
21:53:15 | FromDiscord | <Elegantbeef> That's dynamic typing |
21:53:25 | FromDiscord | <Elegantbeef> The type of a procedure call would be untyped until runtime |
21:53:35 | FromDiscord | <voidwalker> which is always a range, I do not call it with a whole string variable, but a range, like 1..3, or p+1..p+3 |
21:53:50 | FromDiscord | <voidwalker> I think that can be computed at compile time |
21:54:00 | FromDiscord | <Elegantbeef> If you want a single path use a object variant |
21:54:05 | FromDiscord | <Elegantbeef> Otherwise you cannot do what you want |
21:54:23 | FromDiscord | <Elegantbeef> It's just against static typing to have runtime information change the type a procedure returns |
21:54:25 | FromDiscord | <voidwalker> why my idea wouldn't work ? |
21:54:31 | FromDiscord | <c4ulmu> I've read that nim uses merge sort. Tried to write quick sort and got faster sort times. cool |
21:54:34 | FromDiscord | <Elegantbeef> Let's simplify |
21:55:04 | FromDiscord | <voidwalker> I am talking about compile time, not runtime. I know runtime it's impossible with static typing |
21:55:16 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4hDf |
21:55:30 | FromDiscord | <Elegantbeef> You may have worded it poorly but that is what i understand you're trying to do |
21:56:06 | FromDiscord | <Elegantbeef> The above obviously does not work |
21:56:11 | FromDiscord | <voidwalker> I want to use the fact that I can compute the length of the parameter at compile time, as it's simple ranges in the form of x..x+4 |
21:56:33 | FromDiscord | <voidwalker> And the length of the parameter can be used to call myGenericProc[uint16], [uint32], etc based on that |
21:57:00 | FromDiscord | <voidwalker> so I have a bit cleaner code, that is the whole reason |
21:57:08 | FromDiscord | <voidwalker> pretend to be python : ) |
21:59:45 | FromDiscord | <voidwalker> I never wrote a template or macro. I just want to know if my idea is sound before studying further, for the purpose of implementing this |
22:00:34 | FromDiscord | <Elegantbeef> I still dont understand what you're after |
22:01:13 | FromDiscord | <Elegantbeef> You just want to remove the case statement and call a proc directly? |
22:01:17 | FromDiscord | <albassort> is it bad code to mix c direct c bindings with a c wrapped library? |
22:01:26 | FromDiscord | <albassort> (edit) removed "c" |
22:01:57 | FromDiscord | <albassort> im doing x11 stuff, and theres something I wanna do that I don't know how I would implement in C efficiently, so im using the x11 bindings |
22:02:03 | FromDiscord | <albassort> but i also have native x11 code already written |
22:02:10 | FromDiscord | <albassort> is this bad |
22:02:15 | FromDiscord | <voidwalker> welp. basically a template/macro that I can use to replace calls of the form `msg2byteGeneric[uint16](x[p+4..p+5])` with just `msg2byteGeneric(x[p+4..p+5])` - it would compute length of the range and call the already generic proc with the appropiate type prefix |
22:02:52 | FromDiscord | <voidwalker> (p+5)-(p+4) +1 |
22:02:59 | FromDiscord | <Elegantbeef> You technically could make `msg2byte` a macro which then introspects the syntax |
22:03:15 | FromDiscord | <Elegantbeef> But then that means you Have to slice |
22:03:30 | FromDiscord | <voidwalker> yes, they are all slice calls |
22:03:55 | FromDiscord | <Elegantbeef> god that's awful |
22:04:35 | FromDiscord | <Elegantbeef> `toOpenArray` doesnt allocate |
22:05:00 | FromDiscord | <voidwalker> I am also researching into alternatives, as this is only a tiny annoyance with the code structure I have now |
22:05:50 | FromDiscord | <voidwalker> (de)serializing streams of network data, that follow a specific protocol/sequence (including big endian conversion) |
22:06:46 | FromDiscord | <voidwalker> https://github.com/sealmove/nimitai - at first glande this looks like something I'd want to use |
22:06:51 | FromDiscord | <voidwalker> (edit) "glande" => "glance" |
22:07:29 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4hDg |
22:07:40 | FromDiscord | <Elegantbeef> https://github.com/sealmove/binarylang |
22:09:58 | FromDiscord | <albassort> I can use async timeouts with non async code, right? |
22:10:29 | FromDiscord | <albassort> do... i have to do a thread timeout? |
22:11:33 | FromDiscord | <albassort> oh this is gonna be nasty |
22:11:37 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4hDi |
22:13:36 | FromDiscord | <albassort> i basically want to keep an updated x11 event |
22:13:45 | FromDiscord | <albassort> which, would poll every like 100 ms |
22:14:00 | FromDiscord | <albassort> but it blocks, so i want to stop it if it doesn't find it after x |
22:14:03 | FromDiscord | <albassort> its c so it cant be async |
22:14:16 | FromDiscord | <Elegantbeef> A selector with 100ms timeout 😄 |
22:14:20 | FromDiscord | <albassort> so, my new idea is to make a thread for it and have it update a pointer on the shared heap |
22:14:40 | FromDiscord | <albassort> In reply to @Elegantbeef "A selector with 100ms": ok you're right thats a bit extreme but i would play with it |
22:15:08 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4hDl |
22:15:21 | FromDiscord | <albassort> In reply to @Elegantbeef "A selector with 100ms": i take it, that since you're joking, you don't see a easy way to do this |
22:15:33 | FromDiscord | <Elegantbeef> I mean i'm only slightly joking |
22:15:43 | FromDiscord | <Elegantbeef> I hardly ever need to do two things at once |
22:15:49 | FromDiscord | <Elegantbeef> So i'm the worst person here |
22:16:14 | FromDiscord | <albassort> beef, doesn't how slow a parallelizable task can operate ever stress you out? |
22:16:22 | FromDiscord | <albassort> dont you ever go |
22:16:27 | FromDiscord | <Elegantbeef> I mainly make games |
22:16:29 | FromDiscord | <albassort> "I want to do this 400% faster" |
22:16:36 | FromDiscord | <albassort> beef that can be threaded asf |
22:16:39 | FromDiscord | <Elegantbeef> No amount of threading can make my games faster |
22:16:46 | FromDiscord | <albassort> tell that to ss14 |
22:16:57 | FromDiscord | <Elegantbeef> My main blocker is the opengl api |
22:17:05 | FromDiscord | <albassort> ez write it in vulkan |
22:17:12 | FromDiscord | <Elegantbeef> It's a single threaded api, and even if it wasnt it's not worth my time |
22:17:58 | FromDiscord | <Elegantbeef> Throwing more threads also doesnt make a programmer faster |
22:18:11 | FromDiscord | <Elegantbeef> Designing it smarter does |
22:19:17 | FromDiscord | <Arouzing> I mean optimize single threaded first then add threads if possible right? |
22:19:38 | FromDiscord | <Elegantbeef> Correct |
22:19:46 | FromDiscord | <Elegantbeef> Unless the task requires threads of course 😄 |
22:20:04 | FromDiscord | <albassort> In reply to @Elegantbeef "Throwing more threads also": not always but most of the time |
22:20:07 | FromDiscord | <Elegantbeef> Atleast that's my view i'm sure others differ |
22:20:27 | FromDiscord | <Elegantbeef> "I'm going to spool up multiple threads to make `find` faster" |
22:21:51 | FromDiscord | <albassort> In reply to @Elegantbeef ""I'm going to spool": I've done that |
22:21:53 | FromDiscord | <albassort> distrbute go brr |
22:22:00 | FromDiscord | <albassort> 200% increase |
22:22:09 | FromDiscord | <albassort> (each thread is 50% as efficient due to startup times) |
22:23:12 | * | ltriant quit (Ping timeout: 256 seconds) |
22:24:18 | FromDiscord | <Elegantbeef> You left out the best part that now you have to ensure you dont mutate the data |
22:29:14 | FromDiscord | <albassort> In reply to @Elegantbeef "You left out the": I left out that timehole, yes |
22:29:26 | FromDiscord | <albassort> it is sometimes such a pain the ass to write that code |
22:29:32 | FromDiscord | <albassort> i still need to write my templates and macros for that |
22:29:33 | FromDiscord | <albassort> lazyyy |
22:49:41 | * | junaid_ quit (Remote host closed the connection) |
22:58:40 | FromDiscord | <Yepoleb> In reply to @voidwalker "welp. basically a template/macro": i have a better idea, you give the proc the type and it calculates the slice instead |
22:59:13 | FromDiscord | <Yepoleb> which is what the streams module already does |
23:11:44 | FromDiscord | <voidwalker> not sure what you mean @Yepoleb ,but I am on a better track. There seem to be two DSL libraries for defining binary parsing structurs. binarylang and binaryparser.. trying to decide which one is better now |
23:11:49 | AMIGrAve | ezquerra & Yardanico: sorry, just reading your messages 11 hours ago :) thanks for your responses ! |
23:17:17 | * | krux02 quit (Remote host closed the connection) |
23:19:44 | NimEventer | New thread by curioussav: Don't understand why ref is marked cyclic, see https://forum.nim-lang.org/t/9691 |
23:36:33 | FromDiscord | <伊弉冉の恵み> windows defender said it found a thread named "wacapew.c! ml" on nimgrab.exe (just re-installed nim after formatting my system) - is it something I should worry about or it's just a false positive? |
23:36:38 | FromDiscord | <伊弉冉の恵み> (edit) "thread" => "threat" |
23:36:50 | FromDiscord | <伊弉冉の恵み> (edit) "it's" => "is it" |
23:36:52 | * | AMIGrAve quit (Quit: leaving) |
23:37:11 | FromDiscord | <huantian> false positive |
23:37:26 | FromDiscord | <Phil> That's it, mapping errors to HTTP Error codes is too painful and error prone to test for, getting HTTP500 when you send bad data is now intended behaviour |
23:38:00 | FromDiscord | <demotomohiro> In reply to @伊弉冉の恵み "windows defender said it": https://internet-of-tomohiro.netlify.app/nim/faq.en.html#nim-compiler-is-nimslashnimble-virus-or-malwareqmark |
23:42:25 | * | nimcurious joined #nim |
23:45:38 | FromDiscord | <albassort> OH NO MORE JAPANESE |
23:45:50 | nimcurious | Anybody know why https://forum.nim-lang.org/t/9688 was moderated? According to the json it was posted by: https://forum.nim-lang.org/profile/N4v - looks like a legit post. Thanks.. |
23:45:52 | FromDiscord | <Phil> It is fine |
23:45:58 | FromDiscord | <Phil> THe japanese characters can't eat you |
23:46:04 | FromDiscord | <albassort> they're eating my time |
23:46:17 | FromDiscord | <albassort> currently im pretty sure japanese is top 5 languages here |
23:46:38 | FromDiscord | <albassort> sent a long message, see http://ix.io/4hDv |
23:46:49 | FromDiscord | <Elegantbeef> Posts by new users i think are forced to be moderated to reduce spam |
23:47:08 | nimcurious | Ah okay |
23:47:36 | FromDiscord | <伊弉冉の恵み> In reply to @demotomohiro "https://internet-of-tomohiro.netlify.app/nim/faq.en": alright thanks |
23:49:15 | * | nimcurious quit (Quit: leaving) |