01:03:31 | FromDiscord | <undersquire> there's gotta be a cleaner way of working with object variants in nim |
01:03:53 | FromDiscord | <undersquire> no way the code I just wrote is the best way |
01:04:05 | nrds | <Prestige99> Can you link an example? |
01:04:18 | FromDiscord | <undersquire> yes one sec |
01:04:20 | nrds | <Prestige99> I agree though, it isn't very ergonmic |
01:04:24 | FromDiscord | <undersquire> https://github.com/jet-lang/rocket/blob/main/src/rocket/value.nim |
01:04:30 | FromDiscord | <undersquire> this is a pain |
01:04:34 | FromDiscord | <undersquire> no way this is how ur suppose to do this |
01:05:32 | FromDiscord | <undersquire> is there a way of doing this with generics or something? |
01:06:24 | nrds | <Prestige99> Maybe with a macro? I'm not sure. Maybe Elegantbeef would know |
01:06:55 | FromDiscord | <undersquire> cause there is no way my code there is the proper way of implementing that lol |
01:07:11 | FromDiscord | <undersquire> it feels way to overkill |
01:07:14 | FromDiscord | <undersquire> idk |
01:08:15 | FromDiscord | <TechnoRazor> I'm starting to use nimgl (https://github.com/nimgl/nimgl) and noticed it takes longer to compile than I would like (over 10 seconds). Is there a way to load nimgl dynamically? If so, would it significantly improve the compile-time of my program? |
01:08:23 | FromDiscord | <undersquire> In reply to @nrds "<Prestige> Maybe with a": maybe a macro, but i feel like that would make it more complex |
01:11:03 | FromDiscord | <Elegantbeef> I mean you can use a macro for that and i've got one that could help but i dont really like the API so much so tend to not whore it out https://github.com/jet-lang/rocket/blob/main/src/rocket/value.nim |
01:11:18 | FromDiscord | <Elegantbeef> Sometimes it helps if you copy links properly |
01:11:48 | FromDiscord | <undersquire> idk why it didnt copy the link right lol |
01:12:01 | FromDiscord | <Elegantbeef> I mean i didnt \:D |
01:12:02 | FromDiscord | <undersquire> so the way im doing it is fine then? (disregarding macros) |
01:12:37 | FromDiscord | <Elegantbeef> Well we might be able to clean it up without macros |
01:12:49 | FromDiscord | <Elegantbeef> Gotta get off this unusable WM to actually see if i can help |
01:12:55 | FromDiscord | <undersquire> lmfao |
01:13:22 | FromDiscord | <undersquire> i wish u could use generics in objects |
01:13:33 | FromDiscord | <undersquire> i mean being able to use them in the way im using them |
01:33:52 | FromDiscord | <Elegantbeef> Well if you want to take a look at a manually made unpack method https://play.nim-lang.org/#ix=3vj6 |
01:34:56 | FromDiscord | <undersquire> Oh nice that is a lot cleaner |
01:35:35 | FromDiscord | <undersquire> ty lol ill play around with that |
01:57:07 | nrds | <Prestige99> neat |
01:59:34 | FromDiscord | <undersquire> In reply to @Elegantbeef "Well if you want": ty lol this really worked well |
02:00:18 | FromDiscord | <Elegantbeef> Good |
02:02:14 | FromDiscord | <Elegantbeef> prestige i've got multi monitor support working! \:D |
02:02:23 | FromDiscord | <Elegantbeef> But oh boy are there bugs |
02:02:35 | FromDiscord | <Elegantbeef> But ehhh https://streamable.com/o5axrw |
02:03:25 | nrds | <Prestige99> nice! |
02:05:10 | FromDiscord | <Elegantbeef> Think there are some issues with gnome/electron apps so that's fun |
02:05:41 | FromDiscord | <Elegantbeef> Have 0 atoms enabled presently which i assume is one reason it's odd |
02:06:13 | nrds | <Prestige99> yeah that could be an issue |
02:09:26 | FromDiscord | <@bracketmaster-5a708063d73408ce4> maybe I've just been up to late, but shouldn't this work?↵↵type Cursor\ = tuple[line\_no, col\_no, byte\_index\: uint]↵echo Cursor(line\_no\: 2, col\_no\: 3, byte\_index\: 29) |
02:09:43 | FromDiscord | <Elegantbeef> Tuples dont use object constructors |
02:12:36 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3vjf |
02:12:46 | FromDiscord | <Elegantbeef> Those are how you'd make a cursor tuple, though i'd argue it's silly to use a named tuple |
02:14:28 | * | auxym quit (Ping timeout: 250 seconds) |
02:19:05 | FromDiscord | <theangryepicbanana> I like using named tuples for return types |
02:19:38 | * | arkurious quit (Quit: Leaving) |
02:20:09 | FromDiscord | <Elegantbeef> Well that's more fine since it's not a concrete type that can be abused 😀 |
02:21:10 | FromDiscord | <Elegantbeef> Having a type def for named tuples just is weird to me, sure you get unpacking but anyone joe schmoe can easily and accidentally create a replica that fits the bill |
02:23:10 | FromDiscord | <Elegantbeef> Purely depends on how you use it, so just ignore me as normal |
02:41:48 | FromDiscord | <theangryepicbanana> I think named tuples as return types would be nicer if we could use the "named" part in tuple destructuring |
02:42:16 | FromDiscord | <theangryepicbanana> like `let (a: int, b: string) = ...` or something that maps the label names to the variables |
02:46:37 | FromDiscord | <Elegantbeef> you mean `a: lineNo` for instance? |
02:48:57 | FromDiscord | <theangryepicbanana> yeah kinda |
02:49:06 | FromDiscord | <theangryepicbanana> similar to how you can destructure objects in js for example |
02:53:09 | FromDiscord | <Elegantbeef> \insert macro comment here |
03:01:19 | FromDiscord | <theangryepicbanana> ew |
03:01:32 | FromDiscord | <theangryepicbanana> would be nice to allow it in let/var decls |
03:01:47 | FromDiscord | <Elegantbeef> It would be, but that requires having to restructure those |
03:05:05 | FromDiscord | <theangryepicbanana> would it be a breaking change though? |
03:05:06 | FromDiscord | <Rika> In reply to @haxscramper "In C++ you have": `using RefObj = Obj`? |
03:10:53 | FromDiscord | <TechnoRazor> How would I know which C compiler Nim is using? |
03:11:31 | FromDiscord | <Elegantbeef> I could be wrong but i think it default to gcc everywhere but mac where it uses clang? |
03:13:20 | nrds | <Prestige99> https://nim-lang.org/docs/nimc.html#compiler-selection |
03:16:42 | FromDiscord | <Elegantbeef> Cmon angry banana it works fine 😛 https://play.nim-lang.org/#ix=3vjs |
03:38:05 | FromDiscord | <undersquire> are there any other hobby os/kernels in nim besides dom96's ? |
03:38:08 | FromDiscord | <undersquire> (edit) "dom96's ?" => "dom96's?" |
03:48:20 | FromDiscord | <Elegantbeef> I dont know of any others |
04:04:59 | * | jkl1337 is now known as jkl |
04:06:02 | * | supakeen quit (Quit: WeeChat 3.2) |
04:06:31 | * | supakeen joined #nim |
04:53:47 | FromDiscord | <PsychoClay> is there a way to get the nimble package version as a variable? |
05:26:30 | FromDiscord | <impbox [ftsf]> playing with nim+ctags in vim, would be nice to get procs/methods listed by the type of their first argument, has anyone done this before? |
05:27:00 | FromDiscord | <impbox [ftsf]> since it's common for lots of procs to have the same name in nim just with different arguments |
05:28:14 | FromDiscord | <Rika> Does Nim work with Ctags?? |
05:28:18 | FromDiscord | <impbox [ftsf]> yep |
05:29:11 | nrds | <Prestige99> I didn't know people still used ctags |
05:29:26 | FromDiscord | <impbox [ftsf]> the output is not so useful though |
05:29:39 | FromDiscord | <impbox [ftsf]> maybe i should use something else |
05:30:11 | nrds | <Prestige99> I just use nimlsp with neovim |
05:30:31 | FromDiscord | <impbox [ftsf]> any tips of getting a useful outline of a nim file in vim? |
05:30:48 | FromDiscord | <Rika> I’m thinking of switching to Nim LSP but I want my semantic highlighting so |
05:30:59 | FromDiscord | <Rika> In reply to @impbox "any tips of getting": Via Ctags? |
05:31:31 | FromDiscord | <impbox [ftsf]> @Rika i don't really care how it's implemented as long as the output is useful |
05:32:03 | nrds | <Prestige99> lsp has an outline command or whatever |
05:32:22 | FromDiscord | <impbox [ftsf]> nrds, ok i'll check it out, thanks |
05:32:22 | nrds | <Prestige99> I just press a keybinding and I can fuzzy search stuff like proc names |
05:32:23 | FromDiscord | <Rika> Is it implemented on the Nim LSP server though |
05:32:31 | nrds | <Prestige99> yes |
05:32:47 | FromDiscord | <Elegantbeef> calling prestige nrds is pretty nice |
05:32:53 | nrds | <Prestige99> haha |
05:33:36 | nrds | <Prestige99> I'm using nimlsp and alaviss/nim.nvim impbox - if that helps |
05:33:49 | FromDiscord | <impbox [ftsf]> i like having the sidebar outline, but i'd want it listed by type of first argument https://media.discordapp.net/attachments/371759389889003532/873801145510928384/unknown.png |
05:35:48 | nrds | <Prestige99> I wonder if you can just search with regex and create a quickfix list |
05:35:56 | nrds | <Prestige99> and on save you could update it |
05:42:47 | FromDiscord | <impbox [ftsf]> getting better https://media.discordapp.net/attachments/371759389889003532/873803405762629642/unknown.png |
05:42:53 | FromDiscord | <impbox [ftsf]> i think i can probably do it through ctags |
05:43:25 | FromDiscord | <Rika> Wouldn’t quick fix be better |
05:44:20 | FromDiscord | <impbox [ftsf]> hmm i'm not familiar with quickfix |
06:02:55 | * | rockcavera quit (Remote host closed the connection) |
06:16:49 | FromDiscord | <Rika> Might be time to try to become familiar with it, it’s pretty nice to use |
06:26:19 | FromDiscord | <impbox [ftsf]> seems useful but i can't seem to find any docs on how to generate a quickfix list |
06:26:38 | FromDiscord | <Rika> :h quickfix |
06:26:41 | FromDiscord | <Rika> Perhaps? |
06:27:04 | FromDiscord | <impbox [ftsf]> yeah, that tells me how to use the quickfix window |
06:27:06 | FromDiscord | <Rika> I think you can make one with grep |
06:27:16 | FromDiscord | <impbox [ftsf]> but not how to make a script to output a quickfix list |
06:27:47 | FromDiscord | <Rika> setqflist() |
06:28:00 | FromDiscord | <Rika> Did this one help |
06:28:08 | FromDiscord | <impbox [ftsf]> will read that and have a look |
06:32:48 | FromDiscord | <impbox [ftsf]> ehh, seems really awkward to use quickfix to generate your own list |
06:32:54 | FromDiscord | <impbox [ftsf]> i think i'll stick with ctags |
07:19:52 | FromDiscord | <impbox [ftsf]> woot, kinda what i was going for https://media.discordapp.net/attachments/371759389889003532/873827835272372254/unknown.png |
07:21:15 | FromDiscord | <impbox [ftsf]> it's great except for procs where the first argument shouldn't be treated as their object/class, but rather something passed to them like setState(GameState) |
07:36:59 | * | max22- joined #nim |
07:38:13 | FromDiscord | <PsychoClay> whats the difference between the re and nre library? |
07:39:27 | FromDiscord | <Elegantbeef> I believe Nre is a newer written API due to issues with re, and re remains for legacy support |
07:40:12 | FromDiscord | <Rika> Yet re is the more commonly used library |
07:45:16 | FromDiscord | <Elegantbeef> Yea i'm sorta suprised both are reachable through searching |
07:49:23 | FromDiscord | <Rika> I believe it’s probably because the api of nre is less “usable” to some extent |
07:51:20 | FromDiscord | <PsychoClay> is compile time file reading a thing? |
07:51:32 | FromDiscord | <Elegantbeef> `staticRead` |
07:53:50 | FromDiscord | <konsumlamm> In reply to @Rika "I believe it’s probably": i think the main reason is that re is linked in the stdlib overview and nre isn't |
07:54:05 | FromDiscord | <konsumlamm> i dien't even know that nre exists for a long time |
07:54:16 | FromDiscord | <konsumlamm> (edit) "dien't" => "didn't" |
07:55:33 | FromDiscord | <impbox [ftsf]> and the re module doesn't mention nre exists |
08:29:59 | * | neceve joined #nim |
08:38:27 | * | beshr joined #nim |
08:53:43 | * | Vladar joined #nim |
09:45:06 | * | byanka_ joined #nim |
09:47:12 | * | byanka quit (Ping timeout: 245 seconds) |
09:48:27 | * | mahlon quit (Ping timeout: 245 seconds) |
09:49:38 | * | robertmeta quit (Ping timeout: 272 seconds) |
09:50:21 | * | ormiret quit (Ping timeout: 250 seconds) |
09:51:04 | * | ormiret joined #nim |
10:03:02 | * | fputs quit (Ping timeout: 245 seconds) |
10:06:02 | FromDiscord | <haxscramper> Is there any way to do unsafe conversion of one ref object type to another in VM? I can't do `cast[B](a)` in a macros |
10:06:35 | FromDiscord | <haxscramper> I tried doing it in several steps, like `a -> int -> b`, but this does not work either |
10:07:31 | FromDiscord | <haxscramper> Any hack would be acceptable, I need it to test one idea, so it does not matter how bad the conversion implementation is |
10:08:11 | FromDiscord | <haxscramper> Anything that would let me do `let itemB: TypeB = <???>(itemA)` for arbitrary types |
10:10:36 | * | mahlon joined #nim |
10:12:37 | * | neceve quit (Ping timeout: 245 seconds) |
10:12:53 | * | neceve joined #nim |
10:14:21 | * | robertmeta joined #nim |
10:24:42 | FromDiscord | <top level await> best ws libaries? |
10:25:16 | FromDiscord | <top level await> for server |
10:34:01 | FromDiscord | <top level await> decided to with ws |
10:34:05 | FromDiscord | <top level await> `nimbel install ws` |
10:34:11 | FromDiscord | <top level await> idk if it's gud but i'm gonna use it lol |
10:37:12 | * | auxym joined #nim |
10:44:42 | * | auxym quit (Ping timeout: 245 seconds) |
10:55:32 | * | auxym joined #nim |
10:56:16 | * | lain quit (Quit: kthxbai) |
10:56:59 | * | lain joined #nim |
10:58:53 | FromDiscord | <top level await> How do I turn this into |
10:58:56 | FromDiscord | <top level await> sent a code paste, see https://play.nim-lang.org/#ix=3vmb |
10:59:05 | FromDiscord | <top level await> `[{"m": "ch","_id":"lobby"}] |
10:59:08 | FromDiscord | <top level await> (edit) ""ch","_id":"lobby"}]" => ""ch","_id":"lobby"}]`" |
11:00:57 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix= |
11:01:00 | FromDiscord | <Rika> (edit) |
11:01:04 | FromDiscord | <Rika> (edit) |
11:03:38 | FromDiscord | <top level await> produces |
11:03:40 | FromDiscord | <top level await> `[("m", "ch"), ("_id", "lobby")]` instead |
11:04:33 | FromDiscord | <top level await> oh |
11:04:37 | FromDiscord | <top level await> i'm using `$` |
11:04:43 | FromDiscord | <top level await> not json `$` |
11:04:43 | FromDiscord | <PsychoClay> maybe `json.%` |
11:04:56 | FromDiscord | <top level await> sent a code paste, see https://play.nim-lang.org/#ix=3vmg |
11:05:01 | FromDiscord | <top level await> `await ws.send(json.`$`chans[0])` |
11:05:10 | FromDiscord | <top level await> is this how I'm supposed to use it? |
11:05:26 | FromDiscord | <top level await> (edit) "`await ws.send(json.`$`chans[0])`" => "sent a code paste, see https://play.nim-lang.org/#ix=" |
11:05:30 | FromDiscord | <PsychoClay> possibly |
11:05:57 | FromDiscord | <top level await> @Rika |
11:06:08 | FromDiscord | <top level await> sent a code paste, see https://play.nim-lang.org/#ix=3vmi |
11:06:12 | FromDiscord | <top level await> :thonkspin: |
11:07:37 | FromDiscord | <top level await> oh |
11:07:40 | FromDiscord | <top level await> iIM STUPID LOL |
11:11:38 | * | beshr quit (Read error: Connection reset by peer) |
11:12:01 | FromDiscord | <top level await> fixed |
11:20:06 | FromDiscord | <dom96> In reply to @PsychoClay "is there a way": Yes. Nimble defines NimblePkgVersion for you iirc |
11:22:27 | FromDiscord | <PsychoClay> it appears to be undeclared, do i need to import something? |
11:24:19 | FromDiscord | <haxscramper> https://github.com/nim-lang/nimble/blob/4a2aaa07d/tests/nimbleVersionDefine/src/nimbleVersionDefine.nim |
11:24:49 | FromDiscord | <haxscramper> And you always need to built code with nimble |
11:25:13 | FromDiscord | <PsychoClay> hmm |
11:25:59 | FromDiscord | <PsychoClay> wait so its always "Unknown"? |
11:28:41 | FromDiscord | <PsychoClay> ah nvm i see how it works |
11:48:05 | FromDiscord | <haxscramper> I suppose this would break when your package is imported by another one |
11:48:08 | FromDiscord | <haxscramper> @PsychoClay\: |
11:48:25 | FromDiscord | <haxscramper> Because there can be only one `-d:NimblePkgVersion` at a time |
11:50:02 | FromDiscord | <PsychoClay> i think il stick to manually parsing the nimble file then |
12:03:04 | * | auxym quit (Quit: Konversation terminated!) |
12:03:15 | * | auxym joined #nim |
12:03:23 | * | max22- quit (Ping timeout: 250 seconds) |
12:06:02 | * | supakeen quit (Quit: WeeChat 3.2) |
12:06:30 | * | supakeen joined #nim |
12:29:25 | * | auxym quit (Read error: No route to host) |
12:29:38 | * | auxym joined #nim |
12:52:51 | * | arkurious joined #nim |
13:00:38 | * | neceve quit (Read error: Connection reset by peer) |
13:01:00 | * | auxym quit (Ping timeout: 250 seconds) |
13:06:51 | FromDiscord | <gogolxdong (liuxiaodong)> Anyone knows how to handle this `got 'blst_p1' for 'localPk + farmerPK' [object declared in /home/lingx/.nimble/pkgs/blscurve-0.0.1/blscurve/blst/blst_abi.nim(104, 3)]↵ but expected 'blst_p1 = object' [object declared in /home/lingx/.nimble/pkgs/blscurve-0.0.1/blscurve/blst/blst_abi.nim(104, 3)]` |
13:08:28 | FromDiscord | <rishavs (Rishav Sharan)> does nim have discrimiated unions? |
13:12:31 | FromDiscord | <gogolxdong (liuxiaodong)> sent a code paste, see https://play.nim-lang.org/#ix=3vmQ |
13:18:30 | FromDiscord | <haxscramper> https://nim-lang.org/docs/manual.html#foreign-function-interface-union-pragma↵https://nim-lang.org/docs/manual.html#types-object-variants |
13:19:30 | * | max22- joined #nim |
13:26:50 | * | max22- quit (Ping timeout: 252 seconds) |
13:31:55 | FromDiscord | <rishavs (Rishav Sharan)> Thanks! |
13:47:44 | FromDiscord | <Kermithos> how can I get the strings raw in nim? like \n ? |
13:55:25 | * | xet7 quit (Remote host closed the connection) |
13:56:33 | * | xet7 joined #nim |
13:56:46 | FromDiscord | <juan_carlos> `r"this is raw"` ?. |
13:59:44 | FromDiscord | <Kermithos> In reply to @juan_carlos "`r"this is raw"` ?.": how would I use that with a string? r(string_name) doesnt seem to work |
14:04:23 | FromDiscord | <juan_carlos> I do not understand. You can not access the nul terminator, if thats what you are thinking. You can enforce it being a raw string in arguments of functions, see examples here https://nim-lang.github.io/Nim/manual_experimental.html#term-rewriting-macros-parameter-constraints |
14:05:24 | FromDiscord | <Kermithos> okay, thanks |
14:16:25 | * | xet7 quit (Read error: Connection reset by peer) |
14:17:43 | * | xet7 joined #nim |
14:28:15 | FromDiscord | <TechnoRazor> Is there anything similar to `debugbreak` in Nim? |
14:28:40 | * | xet7 quit (Remote host closed the connection) |
14:30:26 | FromDiscord | <Rika> what does it do |
14:30:37 | FromDiscord | <juan_carlos> For JS theres `debugger()`. |
14:31:17 | FromDiscord | <TechnoRazor> In reply to @Rika "what does it do": It would basically act as a breakpoint, pausing the debugger. |
14:32:01 | FromDiscord | <TechnoRazor> VSCode breakpoints work, but I was wondering if there was a way to include it in the code itself. |
14:34:23 | FromDiscord | <Rika> usually it is the job of the debugger and not the code |
14:46:50 | FromDiscord | <TechnoRazor> Right, I was just curious as I was following a C++ tutorial that used it. I found that `{.emit:"builtin_trap();".}` works well enough with GCC anyway. |
14:46:56 | * | auxym joined #nim |
14:47:01 | FromDiscord | <juan_carlos> Maybe `SIGTRAP` for posix like OS ?. |
14:53:57 | * | rockcavera joined #nim |
14:53:57 | * | rockcavera quit (Changing host) |
14:53:57 | * | rockcavera joined #nim |
14:55:39 | FromDiscord | <TechnoRazor> I could be doing something wrong, but I can't figure out how to use it. |
14:56:30 | FromDiscord | <juan_carlos> https://stackoverflow.com/a/5561015 |
14:56:52 | FromDiscord | <TechnoRazor> I saw that, but I can't find a way to use it within Nim. |
14:57:14 | * | auxym quit (Read error: No route to host) |
14:57:29 | * | auxym joined #nim |
15:04:02 | FromDiscord | <Ayy Lmao> I'm a bit confused where I'm supposed to be putting c headers in my directories. Like supposed I get `glad.c`, which does `#include <glad/glad.h>`, where do I put the two files? |
15:04:16 | FromDiscord | <Ayy Lmao> (edit) "supposed" => "suppose" |
15:11:59 | FromDiscord | <juan_carlos> current dir?. |
15:12:17 | FromDiscord | <juan_carlos> Depends what you are doing. |
15:17:03 | FromDiscord | <Ayy Lmao> Say I'm just doing a simple project that has a top level directory and a `src` directory, I have a nim file in src that I am compiling from the command line at the top level directory which calls `{.compile: "private/glad/glad.c".}` |
15:17:54 | FromDiscord | <Ayy Lmao> Basically my issue is I am unsure where to put c source and headers within my project so that all of the includes are happy |
15:18:11 | FromDiscord | <juan_carlos> You can get the directory at compile time. |
15:18:29 | * | auxym quit (Ping timeout: 252 seconds) |
15:19:31 | * | auxym joined #nim |
15:19:36 | FromDiscord | <Ayy Lmao> What do you mean? `{.compile: "private/glad/glad.c".}` attempts to compile the file, but `glad.c` does `#include <glad/glad.h>`, and the compiler apparently doesn't know where that is. |
15:26:32 | FromDiscord | <Ayy Lmao> How do I get the compiler to know where the header is? |
15:28:02 | FromDiscord | <juan_carlos> `const headerPath = currentSourcePath().splitPath.head / "file.h"` kinda something like that?. |
15:28:19 | FromDiscord | <juan_carlos> Adapt to your folder structure etc |
15:34:02 | FromDiscord | <Ayy Lmao> I see, so it was the `private` folder I had that was messing with it. |
15:34:42 | FromDiscord | <Ayy Lmao> I've seen some libs use a `private` folder though to hold c libs |
15:35:47 | FromDiscord | <brainproxy> trying to use nimterop to ingest a lib. The wrapper gets generated but Nim's compiler trips on `uintmax_t` being undeclared identifier.↵↵In `cOverride:` how should I override it? |
15:42:17 | FromDiscord | <brainproxy> I went with `BiggestUInt` for now |
15:50:38 | FromDiscord | <StefanSalewski (StefanSalewski)> New forum tread by salewski\: https://forum.nim-lang.org/t/8309 |
15:50:58 | * | auxym quit (Ping timeout: 240 seconds) |
16:01:03 | FromDiscord | <top level await> invalid type: 'empty' in this context: 'array[0..0, set[empty]]' for let |
16:01:10 | FromDiscord | <top level await> let users = [] |
16:01:17 | FromDiscord | <top level await> this is supposed to be populated later via users joining |
16:04:46 | FromDiscord | <juan_carlos> `@[]` |
16:05:14 | FromDiscord | <juan_carlos> `array` is fixed size. |
16:12:46 | FromDiscord | <Rika> even then, you need to specify what types go in the seq |
16:16:19 | FromDiscord | <tsoj> sent a code paste, see https://play.nim-lang.org/#ix=3vnW |
16:16:27 | FromDiscord | <tsoj> not "why" but "how" |
16:18:49 | FromDiscord | <⃟⃟> i dont think thats what distinct is supposed to do |
16:19:20 | FromDiscord | <⃟⃟> i think its just to prevent for example here Position to be automatically converted to Velocity |
16:23:43 | FromDiscord | <konsumlamm> if you just want a different name for the same type, leave out the `distinct` |
16:33:27 | FromDiscord | <planetis> {.borrow\: ..} look at the manual |
16:41:21 | * | max22- joined #nim |
16:42:58 | FromDiscord | <Alea> Is there anywhere that I could find some comprehensive examples for httpclient? The docs don't go very in depth |
17:15:52 | FromDiscord | <planetis> it makes sense to use distincts in order to forbid ops like adding points others have already done it |
17:40:19 | FromDiscord | <dom96> In reply to @Alea "Is there anywhere that": What sort of thing are you looking for? |
17:42:18 | FromDiscord | <Alea> In reply to @dom96 "What sort of thing": Mostly extracting and processing the data in a get request |
17:42:30 | FromDiscord | <Alea> The docs cover packing it into a post request pretty well |
17:50:43 | FromDiscord | <Alea> Also of note, the Post example in the httpclient docs seems to be out of date, since the url no longer exists? |
17:54:50 | FromDiscord | <top level await> how do I turn my main thread into async? |
17:59:26 | FromDiscord | <dom96> `proc main() {.async.}` and then use `waitFor main()` |
18:00:07 | FromDiscord | <dom96> In reply to @Alea "Mostly extracting and processing": what data do you want? The headers? |
18:01:06 | FromDiscord | <dom96> just use `get` which will return this https://nim-lang.org/docs/httpclient.html#AsyncResponse |
18:03:39 | FromDiscord | <Alea> aye I dug around some more and saw that I got get mixed up with getContent |
18:04:11 | FromDiscord | <top level await> In reply to @dom96 "`proc main() {.async.}` and": thank you :D |
18:04:25 | FromDiscord | <dom96> In reply to @Alea "aye I dug around": happy to accept more examples in the docs if you want to add them 🙂 |
18:05:47 | FromDiscord | <Alea> In reply to @dom96 "happy to accept more": I'll have to get more familiar with it first (which I will be since I'm about to use it in an interview exercise 😅) |
18:11:58 | FromDiscord | <dom96> You're interviewing for a Nim job? 😮 |
18:14:53 | * | auxym joined #nim |
18:16:06 | FromDiscord | <Alea> No, just using it for the question since they give free choice |
18:39:26 | * | supakeen quit (Remote host closed the connection) |
18:39:50 | * | supakeen joined #nim |
18:43:47 | * | vicfred joined #nim |
18:49:06 | * | notchris quit (Ping timeout: 240 seconds) |
18:50:43 | FromDiscord | <enthus1ast> sent a long message, see http://ix.io/3voG |
18:51:40 | * | notchris joined #nim |
18:52:22 | * | auxym quit (Read error: No route to host) |
18:52:34 | * | auxym joined #nim |
18:55:36 | FromDiscord | <top level await> cute logo |
18:56:31 | FromDiscord | <top level await> sent a code paste, see https://play.nim-lang.org/#ix=3voH |
18:57:38 | FromDiscord | <top level await> await ws.send((%[{↵ "m":"ch",↵ "_id":"esm",↵ }]).getStr()) |
18:57:41 | FromDiscord | <top level await> oh this works |
19:00:05 | FromDiscord | <top level await> that does not work |
19:00:09 | FromDiscord | <top level await> gives me nothing |
19:09:34 | FromDiscord | <top level await> i used |
19:09:37 | FromDiscord | <top level await> ($( instead |
19:09:40 | FromDiscord | <top level await> and that worked |
19:20:22 | * | auxym quit (Ping timeout: 272 seconds) |
19:20:45 | FromDiscord | <top level await> and I'd like to be able to use while true: without blocking |
19:20:48 | FromDiscord | <top level await> sent a code paste, see https://play.nim-lang.org/#ix=3voQ |
19:23:38 | * | auxym joined #nim |
19:25:53 | FromDiscord | <top level await> sent a code paste, see https://play.nim-lang.org/#ix=3voR |
19:32:09 | * | auxym quit (Ping timeout: 258 seconds) |
20:34:57 | * | vicfred quit (Quit: Leaving) |
20:45:40 | FromDiscord | <top level await> how do I use _ in a type? |
20:45:43 | FromDiscord | <top level await> I have a thing called `_id` |
20:45:53 | FromDiscord | <top level await> sent a code paste, see https://paste.rs/XWY |
20:46:07 | FromDiscord | <top level await> (edit) "https://play.nim-lang.org/#ix=3vp6" => "https://paste.rs/iNS" |
20:47:12 | FromDiscord | <Elegantbeef> Nim identifiers cannot start with `_`, even if stropped |
20:48:31 | FromDiscord | <top level await> But i'm pulling this from a websocket |
20:48:38 | FromDiscord | <top level await> so I MUST use `_id` |
20:49:35 | FromDiscord | <Elegantbeef> It looks like you're using json? |
20:49:44 | federico3 | how to set the path for nimdoc.css for "nim doc"? |
20:51:37 | FromDiscord | <Elegantbeef> If you're using json you can make your own json hooks for the object so then you can write/read id as `_id` |
20:51:44 | FromDiscord | <top level await> In reply to @Elegantbeef "It looks like you're": I am! |
20:51:53 | FromDiscord | <top level await> In reply to @Elegantbeef "If you're using json": Hmm, how? |
20:51:58 | FromDiscord | <Elegantbeef> Atleast i think that's what https://nim-lang.org/docs/jsonutils.html enables |
20:52:42 | FromDiscord | <Elegantbeef> Though i do swear there was a json library that allowed giving a string name to the fields |
20:54:36 | FromDiscord | <Elegantbeef> Ah this one seems to support it https://github.com/status-im/nim-json-serialization |
20:54:39 | nrds | <R2D299> itHub: 7"Flexible JSON serialization not relying on run-time type information" |
20:55:19 | FromDiscord | <top level await> i was playing stardust |
20:55:20 | FromDiscord | <top level await> sorry |
20:55:45 | FromDiscord | <top level await> In reply to @Elegantbeef "Ah this one seems": hmm |
20:55:48 | FromDiscord | <top level await> doesn't seem tow ork |
20:55:57 | FromDiscord | <top level await> no place where it's changed |
20:56:02 | FromDiscord | <top level await> where like i can change it to multiple words |
20:56:05 | FromDiscord | <top level await> it's only one rename? |
21:02:59 | FromDiscord | <Elegantbeef> What? |
21:06:05 | FromDiscord | <top level await> In reply to @Elegantbeef "What?": i can't rename it to multiple words\ |
21:06:09 | FromDiscord | <top level await> if i rename it it'll change |
21:06:11 | FromDiscord | <top level await> won it? |
21:07:34 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3vpc |
21:16:26 | FromDiscord | <top level await> elegantbeef |
21:16:29 | FromDiscord | <top level await> that has a issue |
21:16:30 | FromDiscord | <top level await> the libary |
21:16:31 | FromDiscord | <Elegantbeef> Me! |
21:16:38 | FromDiscord | <top level await> it uses `chronos` |
21:16:44 | FromDiscord | <top level await> which has its own `asyncloop` |
21:16:50 | FromDiscord | <top level await> and i dont need that |
21:16:54 | * | xet7 joined #nim |
21:16:56 | FromDiscord | <top level await> cause i need `asycdispatch.async` |
21:17:00 | FromDiscord | <top level await> and now i have aproblem |
21:17:12 | FromDiscord | <top level await> sent a code paste, see https://play.nim-lang.org/#ix=3vpe |
21:17:18 | FromDiscord | <top level await> (edit) "https://play.nim-lang.org/#ix=3vpe" => "https://play.nim-lang.org/#ix=3vpf" |
21:17:19 | FromDiscord | <top level await> `ambiguous call; both asyncloop.async(prc: untyped) [declared in C:\Users\luke\.nimble\pkgs\chronos-3.0.6\chronos\asyncmacro2.nim(391, 7)] and asyncdispatch.async(prc: untyped) [declared in D:\tools\Nim\lib\pure\asyncmacro.nim(289, 7)] match for: ()` |
21:17:50 | FromDiscord | <Elegantbeef> Well then time to use json hooks |
21:22:19 | FromDiscord | <top level await> how do I access a user object's ID? |
21:22:32 | FromDiscord | <top level await> (edit) "ID?" => "ELEMENT?" |
21:22:37 | FromDiscord | <top level await> (edit) "user object's ELEMENT?" => "objets element?" |
21:22:41 | FromDiscord | <top level await> (edit) "objets" => "objects" |
21:25:38 | * | Vladar quit (Remote host closed the connection) |
21:28:30 | * | xet7 quit (Remote host closed the connection) |
21:30:43 | FromDiscord | <Elegantbeef> Here is an impl https://play.nim-lang.org/#ix=3vpn |
21:33:25 | FromDiscord | <top level await> elegantbeef |
21:33:26 | FromDiscord | <top level await> imsuing it |
21:33:27 | FromDiscord | <top level await> here |
21:33:30 | FromDiscord | <top level await> ` user = to(packet{"u"}, User)` |
21:33:35 | FromDiscord | <top level await> to convert a packet to a user |
21:33:56 | FromDiscord | <top level await> ` users = to(packet{"ppl"}, seq[User])` im also using it here |
21:34:03 | FromDiscord | <top level await> to convert players to a sequence |
21:43:59 | FromDiscord | <Alea> @dom96 it was a tough test but I did it! And the httpclient / json modules worked great! |
21:45:17 | FromDiscord | <Alea> Using a language I barely know for an interview was a ballsy move, but it payed off well 😂 |
22:09:23 | * | max22- quit (Quit: Leaving) |
22:10:42 | * | max22- joined #nim |
22:11:17 | * | auxym joined #nim |
22:16:16 | * | lucerne quit (Quit: Ping timeout (120 seconds)) |
22:17:15 | * | lucerne joined #nim |
22:18:51 | FromDiscord | <ynfle (ynfle)> Is there a way to get at value of a tuple with a string? |
22:19:50 | FromDiscord | <ynfle (ynfle)> Like `tupleVar["tupleKeyName"]` |
22:22:05 | * | flynn quit (Read error: Connection reset by peer) |
22:22:06 | * | auxym quit (Ping timeout: 272 seconds) |
22:22:42 | FromDiscord | <undersquire> afaik u can only do that with tables |
22:23:13 | * | flynn joined #nim |
22:24:10 | * | auxym joined #nim |
22:24:49 | FromDiscord | <Elegantbeef> I mean there is a way but if you want to do it with a runtime string there isnt really without an object variant to hold onto it |
22:25:05 | FromDiscord | <ynfle (ynfle)> I'm happy to do untyped |
22:28:51 | FromDiscord | <⃟⃟> how to make a un named function |
22:29:52 | FromDiscord | <Elegantbeef> `let a = proc() = echo "here"` |
22:30:13 | FromDiscord | <Elegantbeef> A macro might be the only way to do this ynfle |
22:30:50 | FromDiscord | <j-james> What is the difference between `pointer` and `ptr`? |
22:33:42 | FromDiscord | <Elegantbeef> 0 type information stored on `pointer` |
22:36:43 | FromDiscord | <ynfle (ynfle)> sent a code paste, see https://play.nim-lang.org/#ix=3vpu |
22:36:58 | FromDiscord | <ynfle (ynfle)> But I get Error\: expression 't.a' is of type 'int' and has to be used (or discarded) |
22:37:04 | FromDiscord | <ynfle (ynfle)> `Error: expression 't.a' is of type 'int' and has to be used (or discarded)` |
22:37:17 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3vpv |
22:37:58 | FromDiscord | <ynfle (ynfle)> Didn't know it needs a return type |
22:38:00 | FromDiscord | <ynfle (ynfle)> Why? |
22:38:09 | FromDiscord | <ynfle (ynfle)> Why wouldn't it just return an error? |
22:38:31 | FromDiscord | <Elegantbeef> You're calling a template and returning a value internally, so to use that value it needs to know the called item returns |
22:38:40 | FromDiscord | <Elegantbeef> Atleast that's what i reason |
22:39:30 | * | auxym quit (Ping timeout: 250 seconds) |
22:40:38 | FromDiscord | <ynfle (ynfle)> A more helpful error message would be helpful |
22:40:51 | FromDiscord | <Elegantbeef> Well go add it |
22:41:02 | FromDiscord | <ynfle (ynfle)> Where? |
22:41:31 | FromDiscord | <ynfle (ynfle)> ie, where is the error emitted? |
22:42:38 | FromDiscord | <Elegantbeef> I dont know |
22:43:22 | FromDiscord | <ynfle (ynfle)> How would I figure that out? |
22:43:38 | FromDiscord | <Elegantbeef> Using a nim compiler with stacktraces |
22:43:47 | FromDiscord | <Elegantbeef> so `./koch temp` from the cloned repo |
22:43:57 | FromDiscord | <Elegantbeef> `/compiler/semstmts.nim(151)` is the location of the error |
22:44:06 | FromDiscord | <Elegantbeef> Which is checking that the `t.key` is unhandled |
22:44:25 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3vpw |
22:46:58 | FromDiscord | <ynfle (ynfle)> Thanks I'll take a look |
22:47:33 | FromDiscord | <top level await> is there a `if OR` in nim? |
22:47:44 | FromDiscord | <Elegantbeef> what do you mean an `ifor` |
22:48:13 | FromDiscord | <top level await> like in javascript |
22:48:32 | FromDiscord | <top level await> if("lol" == "hi" && "bruh" == "bruh") // won't be ran |
22:48:39 | FromDiscord | <Elegantbeef> you mean boolean or? |
22:48:41 | FromDiscord | <top level await> yes |
22:48:54 | FromDiscord | <Elegantbeef> Would be a very annoying language without boolean or |
22:49:00 | FromDiscord | <top level await> Yes. |
22:49:07 | FromDiscord | <Elegantbeef> `or` and `and` are the boolean operators |
22:49:13 | FromDiscord | <top level await> Ah.. |
22:49:14 | FromDiscord | <top level await> Python style. |
22:49:24 | FromDiscord | <top level await> Not python though (REMEMBER THAT) |
22:50:06 | FromDiscord | <j-james> Yup |
22:50:49 | FromDiscord | <j-james> `mod` and `div` instead of `%` and `//` as well |
22:50:56 | FromDiscord | <Elegantbeef> ynfle i dont think the error message can be changed without changing the discard check logic as it doesnt have the the node calling it |
22:51:51 | FromDiscord | <Elegantbeef> So you cannot check if it's a template to say "Undiscardable value in templateName, if wanting to return a value annotated with a return type" |
22:54:03 | FromDiscord | <ynfle (ynfle)> OH ok thanks |
22:55:15 | * | nrds quit (Remote host closed the connection) |
22:56:46 | * | nrds joined #nim |
23:00:26 | * | max22- quit (Remote host closed the connection) |
23:06:00 | * | xet7 joined #nim |
23:06:12 | * | max22- joined #nim |
23:11:10 | FromDiscord | <top level await> is there a nim eval()? |
23:12:28 | FromDiscord | <top level await> parseStmt |
23:12:45 | FromDiscord | <j-james> Not in the way Python has one |
23:12:53 | FromDiscord | <j-james> That's probably your best bet |
23:13:45 | FromDiscord | <top level await> yup |
23:13:47 | FromDiscord | <top level await> uh |
23:13:52 | FromDiscord | <top level await> is threre a .shift() |
23:13:55 | FromDiscord | <top level await> like array.shift() |
23:16:02 | * | auxym joined #nim |
23:16:27 | FromDiscord | <top level await> shift is pretty much |
23:16:35 | FromDiscord | <top level await> dropping the first element and then echoing the first element |
23:19:33 | FromDiscord | <j-james> `pop`, maybe? |
23:19:40 | FromDiscord | <j-james> No you want the opposite |
23:20:04 | * | max22- quit (Remote host closed the connection) |
23:20:29 | FromDiscord | <top level await> yes |
23:20:39 | FromDiscord | <top level await> i can get the first element by [0] |
23:20:41 | FromDiscord | <top level await> removing it though.. |
23:23:44 | FromDiscord | <top level await> figured it out |
23:23:46 | FromDiscord | <top level await> .remove(0) |
23:23:55 | FromDiscord | <top level await> .delete(0) |
23:53:04 | FromDiscord | <@bracketmaster-5a708063d73408ce4> in Nim, are string slices passed by reference to functions? |
23:58:27 | * | auxym quit (Ping timeout: 245 seconds) |