<< 08-08-2021 >>

01:03:31FromDiscord<undersquire> there's gotta be a cleaner way of working with object variants in nim
01:03:53FromDiscord<undersquire> no way the code I just wrote is the best way
01:04:05nrds<Prestige99> Can you link an example?
01:04:18FromDiscord<undersquire> yes one sec
01:04:20nrds<Prestige99> I agree though, it isn't very ergonmic
01:04:24FromDiscord<undersquire> https://github.com/jet-lang/rocket/blob/main/src/rocket/value.nim
01:04:30FromDiscord<undersquire> this is a pain
01:04:34FromDiscord<undersquire> no way this is how ur suppose to do this
01:05:32FromDiscord<undersquire> is there a way of doing this with generics or something?
01:06:24nrds<Prestige99> Maybe with a macro? I'm not sure. Maybe Elegantbeef would know
01:06:55FromDiscord<undersquire> cause there is no way my code there is the proper way of implementing that lol
01:07:11FromDiscord<undersquire> it feels way to overkill
01:07:14FromDiscord<undersquire> idk
01:08:15FromDiscord<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:23FromDiscord<undersquire> In reply to @nrds "<Prestige> Maybe with a": maybe a macro, but i feel like that would make it more complex
01:11:03FromDiscord<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:18FromDiscord<Elegantbeef> Sometimes it helps if you copy links properly
01:11:48FromDiscord<undersquire> idk why it didnt copy the link right lol
01:12:01FromDiscord<Elegantbeef> I mean i didnt \:D
01:12:02FromDiscord<undersquire> so the way im doing it is fine then? (disregarding macros)
01:12:37FromDiscord<Elegantbeef> Well we might be able to clean it up without macros
01:12:49FromDiscord<Elegantbeef> Gotta get off this unusable WM to actually see if i can help
01:12:55FromDiscord<undersquire> lmfao
01:13:22FromDiscord<undersquire> i wish u could use generics in objects
01:13:33FromDiscord<undersquire> i mean being able to use them in the way im using them
01:33:52FromDiscord<Elegantbeef> Well if you want to take a look at a manually made unpack method https://play.nim-lang.org/#ix=3vj6
01:34:56FromDiscord<undersquire> Oh nice that is a lot cleaner
01:35:35FromDiscord<undersquire> ty lol ill play around with that
01:57:07nrds<Prestige99> neat
01:59:34FromDiscord<undersquire> In reply to @Elegantbeef "Well if you want": ty lol this really worked well
02:00:18FromDiscord<Elegantbeef> Good
02:02:14FromDiscord<Elegantbeef> prestige i've got multi monitor support working! \:D
02:02:23FromDiscord<Elegantbeef> But oh boy are there bugs
02:02:35FromDiscord<Elegantbeef> But ehhh https://streamable.com/o5axrw
02:03:25nrds<Prestige99> nice!
02:05:10FromDiscord<Elegantbeef> Think there are some issues with gnome/electron apps so that's fun
02:05:41FromDiscord<Elegantbeef> Have 0 atoms enabled presently which i assume is one reason it's odd
02:06:13nrds<Prestige99> yeah that could be an issue
02:09:26FromDiscord<@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:43FromDiscord<Elegantbeef> Tuples dont use object constructors
02:12:36FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3vjf
02:12:46FromDiscord<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:05FromDiscord<theangryepicbanana> I like using named tuples for return types
02:19:38*arkurious quit (Quit: Leaving)
02:20:09FromDiscord<Elegantbeef> Well that's more fine since it's not a concrete type that can be abused 😀
02:21:10FromDiscord<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:10FromDiscord<Elegantbeef> Purely depends on how you use it, so just ignore me as normal
02:41:48FromDiscord<theangryepicbanana> I think named tuples as return types would be nicer if we could use the "named" part in tuple destructuring
02:42:16FromDiscord<theangryepicbanana> like `let (a: int, b: string) = ...` or something that maps the label names to the variables
02:46:37FromDiscord<Elegantbeef> you mean `a: lineNo` for instance?
02:48:57FromDiscord<theangryepicbanana> yeah kinda
02:49:06FromDiscord<theangryepicbanana> similar to how you can destructure objects in js for example
02:53:09FromDiscord<Elegantbeef> \insert macro comment here
03:01:19FromDiscord<theangryepicbanana> ew
03:01:32FromDiscord<theangryepicbanana> would be nice to allow it in let/var decls
03:01:47FromDiscord<Elegantbeef> It would be, but that requires having to restructure those
03:05:05FromDiscord<theangryepicbanana> would it be a breaking change though?
03:05:06FromDiscord<Rika> In reply to @haxscramper "In C++ you have": `using RefObj = Obj`?
03:10:53FromDiscord<TechnoRazor> How would I know which C compiler Nim is using?
03:11:31FromDiscord<Elegantbeef> I could be wrong but i think it default to gcc everywhere but mac where it uses clang?
03:13:20nrds<Prestige99> https://nim-lang.org/docs/nimc.html#compiler-selection
03:16:42FromDiscord<Elegantbeef> Cmon angry banana it works fine 😛 https://play.nim-lang.org/#ix=3vjs
03:38:05FromDiscord<undersquire> are there any other hobby os/kernels in nim besides dom96's ?
03:38:08FromDiscord<undersquire> (edit) "dom96's ?" => "dom96's?"
03:48:20FromDiscord<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:47FromDiscord<PsychoClay> is there a way to get the nimble package version as a variable?
05:26:30FromDiscord<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:00FromDiscord<impbox [ftsf]> since it's common for lots of procs to have the same name in nim just with different arguments
05:28:14FromDiscord<Rika> Does Nim work with Ctags??
05:28:18FromDiscord<impbox [ftsf]> yep
05:29:11nrds<Prestige99> I didn't know people still used ctags
05:29:26FromDiscord<impbox [ftsf]> the output is not so useful though
05:29:39FromDiscord<impbox [ftsf]> maybe i should use something else
05:30:11nrds<Prestige99> I just use nimlsp with neovim
05:30:31FromDiscord<impbox [ftsf]> any tips of getting a useful outline of a nim file in vim?
05:30:48FromDiscord<Rika> I’m thinking of switching to Nim LSP but I want my semantic highlighting so
05:30:59FromDiscord<Rika> In reply to @impbox "any tips of getting": Via Ctags?
05:31:31FromDiscord<impbox [ftsf]> @Rika i don't really care how it's implemented as long as the output is useful
05:32:03nrds<Prestige99> lsp has an outline command or whatever
05:32:22FromDiscord<impbox [ftsf]> nrds, ok i'll check it out, thanks
05:32:22nrds<Prestige99> I just press a keybinding and I can fuzzy search stuff like proc names
05:32:23FromDiscord<Rika> Is it implemented on the Nim LSP server though
05:32:31nrds<Prestige99> yes
05:32:47FromDiscord<Elegantbeef> calling prestige nrds is pretty nice
05:32:53nrds<Prestige99> haha
05:33:36nrds<Prestige99> I'm using nimlsp and alaviss/nim.nvim impbox - if that helps
05:33:49FromDiscord<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:48nrds<Prestige99> I wonder if you can just search with regex and create a quickfix list
05:35:56nrds<Prestige99> and on save you could update it
05:42:47FromDiscord<impbox [ftsf]> getting better https://media.discordapp.net/attachments/371759389889003532/873803405762629642/unknown.png
05:42:53FromDiscord<impbox [ftsf]> i think i can probably do it through ctags
05:43:25FromDiscord<Rika> Wouldn’t quick fix be better
05:44:20FromDiscord<impbox [ftsf]> hmm i'm not familiar with quickfix
06:02:55*rockcavera quit (Remote host closed the connection)
06:16:49FromDiscord<Rika> Might be time to try to become familiar with it, it’s pretty nice to use
06:26:19FromDiscord<impbox [ftsf]> seems useful but i can't seem to find any docs on how to generate a quickfix list
06:26:38FromDiscord<Rika> :h quickfix
06:26:41FromDiscord<Rika> Perhaps?
06:27:04FromDiscord<impbox [ftsf]> yeah, that tells me how to use the quickfix window
06:27:06FromDiscord<Rika> I think you can make one with grep
06:27:16FromDiscord<impbox [ftsf]> but not how to make a script to output a quickfix list
06:27:47FromDiscord<Rika> setqflist()
06:28:00FromDiscord<Rika> Did this one help
06:28:08FromDiscord<impbox [ftsf]> will read that and have a look
06:32:48FromDiscord<impbox [ftsf]> ehh, seems really awkward to use quickfix to generate your own list
06:32:54FromDiscord<impbox [ftsf]> i think i'll stick with ctags
07:19:52FromDiscord<impbox [ftsf]> woot, kinda what i was going for https://media.discordapp.net/attachments/371759389889003532/873827835272372254/unknown.png
07:21:15FromDiscord<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:13FromDiscord<PsychoClay> whats the difference between the re and nre library?
07:39:27FromDiscord<Elegantbeef> I believe Nre is a newer written API due to issues with re, and re remains for legacy support
07:40:12FromDiscord<Rika> Yet re is the more commonly used library
07:45:16FromDiscord<Elegantbeef> Yea i'm sorta suprised both are reachable through searching
07:49:23FromDiscord<Rika> I believe it’s probably because the api of nre is less “usable” to some extent
07:51:20FromDiscord<PsychoClay> is compile time file reading a thing?
07:51:32FromDiscord<Elegantbeef> `staticRead`
07:53:50FromDiscord<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:05FromDiscord<konsumlamm> i dien't even know that nre exists for a long time
07:54:16FromDiscord<konsumlamm> (edit) "dien't" => "didn't"
07:55:33FromDiscord<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:02FromDiscord<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:35FromDiscord<haxscramper> I tried doing it in several steps, like `a -> int -> b`, but this does not work either
10:07:31FromDiscord<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:11FromDiscord<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:42FromDiscord<top level await> best ws libaries?
10:25:16FromDiscord<top level await> for server
10:34:01FromDiscord<top level await> decided to with ws
10:34:05FromDiscord<top level await> `nimbel install ws`
10:34:11FromDiscord<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:53FromDiscord<top level await> How do I turn this into
10:58:56FromDiscord<top level await> sent a code paste, see https://play.nim-lang.org/#ix=3vmb
10:59:05FromDiscord<top level await> `[{"m": "ch","_id":"lobby"}]
10:59:08FromDiscord<top level await> (edit) ""ch","_id":"lobby"}]" => ""ch","_id":"lobby"}]`"
11:00:57FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=
11:01:00FromDiscord<Rika> (edit)
11:01:04FromDiscord<Rika> (edit)
11:03:38FromDiscord<top level await> produces
11:03:40FromDiscord<top level await> `[("m", "ch"), ("_id", "lobby")]` instead
11:04:33FromDiscord<top level await> oh
11:04:37FromDiscord<top level await> i'm using `$`
11:04:43FromDiscord<top level await> not json `$`
11:04:43FromDiscord<PsychoClay> maybe `json.%`
11:04:56FromDiscord<top level await> sent a code paste, see https://play.nim-lang.org/#ix=3vmg
11:05:01FromDiscord<top level await> `await ws.send(json.`$`chans[0])`
11:05:10FromDiscord<top level await> is this how I'm supposed to use it?
11:05:26FromDiscord<top level await> (edit) "`await ws.send(json.`$`chans[0])`" => "sent a code paste, see https://play.nim-lang.org/#ix="
11:05:30FromDiscord<PsychoClay> possibly
11:05:57FromDiscord<top level await> @Rika
11:06:08FromDiscord<top level await> sent a code paste, see https://play.nim-lang.org/#ix=3vmi
11:06:12FromDiscord<top level await> :thonkspin:
11:07:37FromDiscord<top level await> oh
11:07:40FromDiscord<top level await> iIM STUPID LOL
11:11:38*beshr quit (Read error: Connection reset by peer)
11:12:01FromDiscord<top level await> fixed
11:20:06FromDiscord<dom96> In reply to @PsychoClay "is there a way": Yes. Nimble defines NimblePkgVersion for you iirc
11:22:27FromDiscord<PsychoClay> it appears to be undeclared, do i need to import something?
11:24:19FromDiscord<haxscramper> https://github.com/nim-lang/nimble/blob/4a2aaa07d/tests/nimbleVersionDefine/src/nimbleVersionDefine.nim
11:24:49FromDiscord<haxscramper> And you always need to built code with nimble
11:25:13FromDiscord<PsychoClay> hmm
11:25:59FromDiscord<PsychoClay> wait so its always "Unknown"?
11:28:41FromDiscord<PsychoClay> ah nvm i see how it works
11:48:05FromDiscord<haxscramper> I suppose this would break when your package is imported by another one
11:48:08FromDiscord<haxscramper> @PsychoClay\:
11:48:25FromDiscord<haxscramper> Because there can be only one `-d:NimblePkgVersion` at a time
11:50:02FromDiscord<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:51FromDiscord<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:28FromDiscord<rishavs (Rishav Sharan)> does nim have discrimiated unions?
13:12:31FromDiscord<gogolxdong (liuxiaodong)> sent a code paste, see https://play.nim-lang.org/#ix=3vmQ
13:18:30FromDiscord<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:55FromDiscord<rishavs (Rishav Sharan)> Thanks!
13:47:44FromDiscord<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:46FromDiscord<juan_carlos> `r"this is raw"` ?.
13:59:44FromDiscord<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:23FromDiscord<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:24FromDiscord<Kermithos> okay, thanks
14:16:25*xet7 quit (Read error: Connection reset by peer)
14:17:43*xet7 joined #nim
14:28:15FromDiscord<TechnoRazor> Is there anything similar to `debugbreak` in Nim?
14:28:40*xet7 quit (Remote host closed the connection)
14:30:26FromDiscord<Rika> what does it do
14:30:37FromDiscord<juan_carlos> For JS theres `debugger()`.
14:31:17FromDiscord<TechnoRazor> In reply to @Rika "what does it do": It would basically act as a breakpoint, pausing the debugger.
14:32:01FromDiscord<TechnoRazor> VSCode breakpoints work, but I was wondering if there was a way to include it in the code itself.
14:34:23FromDiscord<Rika> usually it is the job of the debugger and not the code
14:46:50FromDiscord<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:01FromDiscord<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:39FromDiscord<TechnoRazor> I could be doing something wrong, but I can't figure out how to use it.
14:56:30FromDiscord<juan_carlos> https://stackoverflow.com/a/5561015
14:56:52FromDiscord<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:02FromDiscord<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:16FromDiscord<Ayy Lmao> (edit) "supposed" => "suppose"
15:11:59FromDiscord<juan_carlos> current dir?.
15:12:17FromDiscord<juan_carlos> Depends what you are doing.
15:17:03FromDiscord<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:54FromDiscord<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:11FromDiscord<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:36FromDiscord<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:32FromDiscord<Ayy Lmao> How do I get the compiler to know where the header is?
15:28:02FromDiscord<juan_carlos> `const headerPath = currentSourcePath().splitPath.head / "file.h"` kinda something like that?.
15:28:19FromDiscord<juan_carlos> Adapt to your folder structure etc
15:34:02FromDiscord<Ayy Lmao> I see, so it was the `private` folder I had that was messing with it.
15:34:42FromDiscord<Ayy Lmao> I've seen some libs use a `private` folder though to hold c libs
15:35:47FromDiscord<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:17FromDiscord<brainproxy> I went with `BiggestUInt` for now
15:50:38FromDiscord<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:03FromDiscord<top level await> invalid type: 'empty' in this context: 'array[0..0, set[empty]]' for let
16:01:10FromDiscord<top level await> let users = []
16:01:17FromDiscord<top level await> this is supposed to be populated later via users joining
16:04:46FromDiscord<juan_carlos> `@[]`
16:05:14FromDiscord<juan_carlos> `array` is fixed size.
16:12:46FromDiscord<Rika> even then, you need to specify what types go in the seq
16:16:19FromDiscord<tsoj> sent a code paste, see https://play.nim-lang.org/#ix=3vnW
16:16:27FromDiscord<tsoj> not "why" but "how"
16:18:49FromDiscord<⃟⃟> i dont think thats what distinct is supposed to do
16:19:20FromDiscord<⃟⃟> i think its just to prevent for example here Position to be automatically converted to Velocity
16:23:43FromDiscord<konsumlamm> if you just want a different name for the same type, leave out the `distinct`
16:33:27FromDiscord<planetis> {.borrow\: ..} look at the manual
16:41:21*max22- joined #nim
16:42:58FromDiscord<Alea> Is there anywhere that I could find some comprehensive examples for httpclient? The docs don't go very in depth
17:15:52FromDiscord<planetis> it makes sense to use distincts in order to forbid ops like adding points others have already done it
17:40:19FromDiscord<dom96> In reply to @Alea "Is there anywhere that": What sort of thing are you looking for?
17:42:18FromDiscord<Alea> In reply to @dom96 "What sort of thing": Mostly extracting and processing the data in a get request
17:42:30FromDiscord<Alea> The docs cover packing it into a post request pretty well
17:50:43FromDiscord<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:50FromDiscord<top level await> how do I turn my main thread into async?
17:59:26FromDiscord<dom96> `proc main() {.async.}` and then use `waitFor main()`
18:00:07FromDiscord<dom96> In reply to @Alea "Mostly extracting and processing": what data do you want? The headers?
18:01:06FromDiscord<dom96> just use `get` which will return this https://nim-lang.org/docs/httpclient.html#AsyncResponse
18:03:39FromDiscord<Alea> aye I dug around some more and saw that I got get mixed up with getContent
18:04:11FromDiscord<top level await> In reply to @dom96 "`proc main() {.async.}` and": thank you :D
18:04:25FromDiscord<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:47FromDiscord<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:58FromDiscord<dom96> You're interviewing for a Nim job? 😮
18:14:53*auxym joined #nim
18:16:06FromDiscord<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:43FromDiscord<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:36FromDiscord<top level await> cute logo
18:56:31FromDiscord<top level await> sent a code paste, see https://play.nim-lang.org/#ix=3voH
18:57:38FromDiscord<top level await> await ws.send((%[{↵ "m":"ch",↵ "_id":"esm",↵ }]).getStr())
18:57:41FromDiscord<top level await> oh this works
19:00:05FromDiscord<top level await> that does not work
19:00:09FromDiscord<top level await> gives me nothing
19:09:34FromDiscord<top level await> i used
19:09:37FromDiscord<top level await> ($( instead
19:09:40FromDiscord<top level await> and that worked
19:20:22*auxym quit (Ping timeout: 272 seconds)
19:20:45FromDiscord<top level await> and I'd like to be able to use while true: without blocking
19:20:48FromDiscord<top level await> sent a code paste, see https://play.nim-lang.org/#ix=3voQ
19:23:38*auxym joined #nim
19:25:53FromDiscord<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:40FromDiscord<top level await> how do I use _ in a type?
20:45:43FromDiscord<top level await> I have a thing called `_id`
20:45:53FromDiscord<top level await> sent a code paste, see https://paste.rs/XWY
20:46:07FromDiscord<top level await> (edit) "https://play.nim-lang.org/#ix=3vp6" => "https://paste.rs/iNS"
20:47:12FromDiscord<Elegantbeef> Nim identifiers cannot start with `_`, even if stropped
20:48:31FromDiscord<top level await> But i'm pulling this from a websocket
20:48:38FromDiscord<top level await> so I MUST use `_id`
20:49:35FromDiscord<Elegantbeef> It looks like you're using json?
20:49:44federico3how to set the path for nimdoc.css for "nim doc"?
20:51:37FromDiscord<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:44FromDiscord<top level await> In reply to @Elegantbeef "It looks like you're": I am!
20:51:53FromDiscord<top level await> In reply to @Elegantbeef "If you're using json": Hmm, how?
20:51:58FromDiscord<Elegantbeef> Atleast i think that's what https://nim-lang.org/docs/jsonutils.html enables
20:52:42FromDiscord<Elegantbeef> Though i do swear there was a json library that allowed giving a string name to the fields
20:54:36FromDiscord<Elegantbeef> Ah this one seems to support it https://github.com/status-im/nim-json-serialization
20:54:39nrds<R2D299> itHub: 7"Flexible JSON serialization not relying on run-time type information"
20:55:19FromDiscord<top level await> i was playing stardust
20:55:20FromDiscord<top level await> sorry
20:55:45FromDiscord<top level await> In reply to @Elegantbeef "Ah this one seems": hmm
20:55:48FromDiscord<top level await> doesn't seem tow ork
20:55:57FromDiscord<top level await> no place where it's changed
20:56:02FromDiscord<top level await> where like i can change it to multiple words
20:56:05FromDiscord<top level await> it's only one rename?
21:02:59FromDiscord<Elegantbeef> What?
21:06:05FromDiscord<top level await> In reply to @Elegantbeef "What?": i can't rename it to multiple words\
21:06:09FromDiscord<top level await> if i rename it it'll change
21:06:11FromDiscord<top level await> won it?
21:07:34FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3vpc
21:16:26FromDiscord<top level await> elegantbeef
21:16:29FromDiscord<top level await> that has a issue
21:16:30FromDiscord<top level await> the libary
21:16:31FromDiscord<Elegantbeef> Me!
21:16:38FromDiscord<top level await> it uses `chronos`
21:16:44FromDiscord<top level await> which has its own `asyncloop`
21:16:50FromDiscord<top level await> and i dont need that
21:16:54*xet7 joined #nim
21:16:56FromDiscord<top level await> cause i need `asycdispatch.async`
21:17:00FromDiscord<top level await> and now i have aproblem
21:17:12FromDiscord<top level await> sent a code paste, see https://play.nim-lang.org/#ix=3vpe
21:17:18FromDiscord<top level await> (edit) "https://play.nim-lang.org/#ix=3vpe" => "https://play.nim-lang.org/#ix=3vpf"
21:17:19FromDiscord<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:50FromDiscord<Elegantbeef> Well then time to use json hooks
21:22:19FromDiscord<top level await> how do I access a user object's ID?
21:22:32FromDiscord<top level await> (edit) "ID?" => "ELEMENT?"
21:22:37FromDiscord<top level await> (edit) "user object's ELEMENT?" => "objets element?"
21:22:41FromDiscord<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:43FromDiscord<Elegantbeef> Here is an impl https://play.nim-lang.org/#ix=3vpn
21:33:25FromDiscord<top level await> elegantbeef
21:33:26FromDiscord<top level await> imsuing it
21:33:27FromDiscord<top level await> here
21:33:30FromDiscord<top level await> ` user = to(packet{"u"}, User)`
21:33:35FromDiscord<top level await> to convert a packet to a user
21:33:56FromDiscord<top level await> ` users = to(packet{"ppl"}, seq[User])` im also using it here
21:34:03FromDiscord<top level await> to convert players to a sequence
21:43:59FromDiscord<Alea> @dom96 it was a tough test but I did it! And the httpclient / json modules worked great!
21:45:17FromDiscord<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:51FromDiscord<ynfle (ynfle)> Is there a way to get at value of a tuple with a string?
22:19:50FromDiscord<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:42FromDiscord<undersquire> afaik u can only do that with tables
22:23:13*flynn joined #nim
22:24:10*auxym joined #nim
22:24:49FromDiscord<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:05FromDiscord<ynfle (ynfle)> I'm happy to do untyped
22:28:51FromDiscord<⃟⃟> how to make a un named function
22:29:52FromDiscord<Elegantbeef> `let a = proc() = echo "here"`
22:30:13FromDiscord<Elegantbeef> A macro might be the only way to do this ynfle
22:30:50FromDiscord<j-james> What is the difference between `pointer` and `ptr`?
22:33:42FromDiscord<Elegantbeef> 0 type information stored on `pointer`
22:36:43FromDiscord<ynfle (ynfle)> sent a code paste, see https://play.nim-lang.org/#ix=3vpu
22:36:58FromDiscord<ynfle (ynfle)> But I get Error\: expression 't.a' is of type 'int' and has to be used (or discarded)
22:37:04FromDiscord<ynfle (ynfle)> `Error: expression 't.a' is of type 'int' and has to be used (or discarded)`
22:37:17FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3vpv
22:37:58FromDiscord<ynfle (ynfle)> Didn't know it needs a return type
22:38:00FromDiscord<ynfle (ynfle)> Why?
22:38:09FromDiscord<ynfle (ynfle)> Why wouldn't it just return an error?
22:38:31FromDiscord<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:40FromDiscord<Elegantbeef> Atleast that's what i reason
22:39:30*auxym quit (Ping timeout: 250 seconds)
22:40:38FromDiscord<ynfle (ynfle)> A more helpful error message would be helpful
22:40:51FromDiscord<Elegantbeef> Well go add it
22:41:02FromDiscord<ynfle (ynfle)> Where?
22:41:31FromDiscord<ynfle (ynfle)> ie, where is the error emitted?
22:42:38FromDiscord<Elegantbeef> I dont know
22:43:22FromDiscord<ynfle (ynfle)> How would I figure that out?
22:43:38FromDiscord<Elegantbeef> Using a nim compiler with stacktraces
22:43:47FromDiscord<Elegantbeef> so `./koch temp` from the cloned repo
22:43:57FromDiscord<Elegantbeef> `/compiler/semstmts.nim(151)` is the location of the error
22:44:06FromDiscord<Elegantbeef> Which is checking that the `t.key` is unhandled
22:44:25FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3vpw
22:46:58FromDiscord<ynfle (ynfle)> Thanks I'll take a look
22:47:33FromDiscord<top level await> is there a `if OR` in nim?
22:47:44FromDiscord<Elegantbeef> what do you mean an `ifor`
22:48:13FromDiscord<top level await> like in javascript
22:48:32FromDiscord<top level await> if("lol" == "hi" && "bruh" == "bruh") // won't be ran
22:48:39FromDiscord<Elegantbeef> you mean boolean or?
22:48:41FromDiscord<top level await> yes
22:48:54FromDiscord<Elegantbeef> Would be a very annoying language without boolean or
22:49:00FromDiscord<top level await> Yes.
22:49:07FromDiscord<Elegantbeef> `or` and `and` are the boolean operators
22:49:13FromDiscord<top level await> Ah..
22:49:14FromDiscord<top level await> Python style.
22:49:24FromDiscord<top level await> Not python though (REMEMBER THAT)
22:50:06FromDiscord<j-james> Yup
22:50:49FromDiscord<j-james> `mod` and `div` instead of `%` and `//` as well
22:50:56FromDiscord<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:51FromDiscord<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:03FromDiscord<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:10FromDiscord<top level await> is there a nim eval()?
23:12:28FromDiscord<top level await> parseStmt
23:12:45FromDiscord<j-james> Not in the way Python has one
23:12:53FromDiscord<j-james> That's probably your best bet
23:13:45FromDiscord<top level await> yup
23:13:47FromDiscord<top level await> uh
23:13:52FromDiscord<top level await> is threre a .shift()
23:13:55FromDiscord<top level await> like array.shift()
23:16:02*auxym joined #nim
23:16:27FromDiscord<top level await> shift is pretty much
23:16:35FromDiscord<top level await> dropping the first element and then echoing the first element
23:19:33FromDiscord<j-james> `pop`, maybe?
23:19:40FromDiscord<j-james> No you want the opposite
23:20:04*max22- quit (Remote host closed the connection)
23:20:29FromDiscord<top level await> yes
23:20:39FromDiscord<top level await> i can get the first element by [0]
23:20:41FromDiscord<top level await> removing it though..
23:23:44FromDiscord<top level await> figured it out
23:23:46FromDiscord<top level await> .remove(0)
23:23:55FromDiscord<top level await> .delete(0)
23:53:04FromDiscord<@bracketmaster-5a708063d73408ce4> in Nim, are string slices passed by reference to functions?
23:58:27*auxym quit (Ping timeout: 245 seconds)