<< 30-07-2021 >>

00:09:03*thunder quit (Remote host closed the connection)
00:13:44*thunder joined #nim
00:20:16*Mister_Magister quit (Quit: bye)
00:26:33*Mister_Magister joined #nim
00:27:40*vicfred_ quit (Quit: Leaving)
00:42:46*stkrdknmibalz joined #nim
00:50:45*Mister_Magister quit (Quit: bye)
00:52:36*Mister_Magister joined #nim
00:52:44*Mister_Magister quit (Remote host closed the connection)
00:54:36*Mister_Magister joined #nim
01:50:32*arkurious quit (Quit: Leaving)
02:03:55FromDiscord<jfmonty2> How do I set the size of an UncheckedArray? I'm looking to implement a stack-allocated sequence-ish type of a fixed size, and since I'm checking the bounds myself I want to use an UncheckedArray so that I'm not doing unnecessary work. But I can't find much information on how to actually use UncheckedArrays.
02:05:54FromDiscord<Elegantbeef> uncheckedarrays do not store size, you store that elsewhere
02:08:58FromDiscord<jfmonty2> ok, so how do I actually access its elements?
02:14:32FromDiscord<Elegantbeef> Super lazy showcase of how to make your own seq https://play.nim-lang.org/#ix=3urE
02:15:28FromDiscord<Elegantbeef> Of course this is heap allocated cause stack allocation is scary 😛
02:16:42FromDiscord<carmysilna> wouldn't a fairly easy optimization be using something like SmallVec in Rust, where it uses a small stack-allocated array for short vecs and an actual heap-allocated vec when it grows past that?
02:17:44FromDiscord<Elegantbeef> Well you can do a bunch of optimizations, but you also could just use a larger array/seq than you need at the start and be mostly fine
02:18:10FromDiscord<Elegantbeef> Like for instance is there really any reason to not just use an distinct array
02:20:50FromDiscord<Elegantbeef> I take it back distinct array doesnt work \:D
02:22:01FromDiscord<jfmonty2> so `create(T, size)` seems to be the magic that I was missing here
02:22:08FromDiscord<Elegantbeef> Well that's heap allocated
02:22:15FromDiscord<jfmonty2> right, I was about to ask about that
02:22:41FromDiscord<jfmonty2> do I need to use `alloca` or something? Is that stack-allocated?
02:23:48FromDiscord<Elegantbeef> I dont know, generally it's not advised to stack alloc manually afaik
02:25:21FromDiscord<jfmonty2> ok I've found this, which seems to be doing exactly what I'm looking for: https://github.com/bpr/vla/blob/master/src/vla.nim
02:27:10FromDiscord<Elegantbeef> Yea looks like it's what you want
04:06:02*supakeen quit (Quit: WeeChat 3.2)
04:06:34*supakeen joined #nim
04:18:11FromDiscord<Rika> In reply to @Elegantbeef "I dont know, generally": Can you even manually allocate stack memory after entering a proc
04:21:54*rockcavera quit (Remote host closed the connection)
04:21:59FromDiscord<Elegantbeef> https://www.man7.org/linux/man-pages/man3/alloca.3.html yea but it can cause UB
04:23:57FromDiscord<Rika> So don’t use it
04:24:13FromDiscord<Rika> Well I guess it has to be used if you’re making a language from scratch
04:39:20*thunder quit (Remote host closed the connection)
04:48:33*thunder joined #nim
05:19:34*jkl quit (Quit: ZNC 1.8.2 - https://znc.in)
05:20:56*jkl joined #nim
06:16:20*max22- joined #nim
06:39:44*neceve joined #nim
06:50:29*thunder quit (Remote host closed the connection)
06:50:51*thunder joined #nim
08:42:52FromDiscord<arnetheduck> In reply to @Elegantbeef "https://www.man7.org/linux/man-pages/man3/alloca.3.": I like reviewing code that uses `alloca` - it's so easy to find security issues 🙂
08:59:20FromDiscord<Elegantbeef> the implication being dont use alloca?
08:59:42*max22- quit (Remote host closed the connection)
08:59:56FromDiscord<Rika> Don’t use it if you have only a bit of an idea of what you’re doing
09:00:01*max22- joined #nim
09:00:19FromDiscord<Rika> Has as many guns that’ll shoot you as malloc
09:00:22FromDiscord<Elegantbeef> Ah so i'll never be allowed to use it
09:16:53FromDiscord<arnetheduck> In reply to @Rika "Has as many guns": the funniest ones are the ones where the compiler miscompiles (in optimizations) it and causes the bugs, because not even compiler developers are in the "know what they're doing" category of people
09:17:30FromDiscord<Rika> Ah yeah this is the inline issue right?
09:17:52FromDiscord<arnetheduck> yeah, inline-in-a-loop
09:17:55FromDiscord<Rika> Where a compiler inlines a function with alloca into a for loop and causes an overflow
09:19:11FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3ut2
09:20:15FromDiscord<Rika> What
09:20:28FromDiscord<Rika> That’s evil
09:23:57FromDiscord<mlokis> interesting thing is that using struct to hold stack is less efficient then using multiple variables as struct cannot be promoted to register. When i run clang with -O3 it gets rid of structures whenever it can.
09:24:42*max22- quit (Remote host closed the connection)
09:25:02*max22- joined #nim
09:25:20FromDiscord<mlokis> and instead of using stack for mutable variables it uses phi nodes
09:26:13FromDiscord<mlokis> stack is cheap but i guess not that cheap as you still have to load from it
09:26:57FromDiscord<Elegantbeef> So in summary stack is scary
09:28:14FromDiscord<mlokis> well llvm has specialized optimization passes that focus on getting rid of stack allocations and use
09:29:47FromDiscord<mlokis> the c calling convention still allocates stack because for some reason thats a convention
09:31:17FromDiscord<mlokis> sent a code paste, see https://play.nim-lang.org/#ix=3ut4
09:33:31FromDiscord<generic linux user> tested now,it doesnt happen on nim
09:33:52FromDiscord<mlokis> what does not happen?
09:34:54FromDiscord<mlokis> the stack overflow or infinite recursion? nim compiles to c which uses c calling convention (yes)
09:36:20FromDiscord<generic linux user> it exits doing nothing
09:36:34FromDiscord<generic linux user> return code 0
09:36:48FromDiscord<generic linux user> let me try cpp
09:36:50FromDiscord<mlokis> gues it optimized the call away
09:37:02FromDiscord<mlokis> thats agressive
09:37:24FromDiscord<generic linux user> same in cpp
09:38:18FromDiscord<mlokis> sent a code paste, see https://paste.rs/Oyd
09:38:24FromDiscord<generic linux user> sent a code paste, see https://paste.rs/1uX
09:38:25FromDiscord<generic linux user> why main = main()
09:38:39FromDiscord<generic linux user> wait
09:38:45FromDiscord<generic linux user> 🗿.
09:38:46FromDiscord<mlokis> you did not call it
09:38:51FromDiscord<mlokis> YOU
09:39:03FromDiscord<generic linux user> sorry
09:39:17FromDiscord<generic linux user> yes it is doing something
09:39:25FromDiscord<generic linux user> 100% cpu
09:39:34FromDiscord<mlokis> interesting
09:39:38FromDiscord<generic linux user> infinite recursion probably
09:40:07FromDiscord<generic linux user> when you compile using c++ it doesnt happen
09:40:26FromDiscord<generic linux user> thats cool, now there is a reason for c++ backend
09:40:55FromDiscord<mlokis> c++ is better for multiple reasons
09:41:10FromDiscord<mlokis> it has better error handling
09:41:15FromDiscord<mlokis> c has none
09:44:04FromDiscord<generic linux user> what
09:44:11FromDiscord<generic linux user> a bit faster to compile you know
09:44:21FromDiscord<generic linux user> a biit
09:44:55FromDiscord<mlokis> i cant believe how wrong the cpp went with syntax
09:45:05FromDiscord<generic linux user> yes
09:45:15FromDiscord<mlokis> literally unparsable
09:46:36FromDiscord<mlokis> syntax should be in balance between efficiency and expressiveness, cpp has none of that.
09:47:22FromDiscord<generic linux user> is it ggettimg offtopic tho
09:47:48FromDiscord<mlokis> sent a code paste, see https://play.nim-lang.org/#ix=3ut8
09:48:16FromDiscord<mlokis> lets shut then
09:49:28FromDiscord<generic linux user> i wouldnt want to
09:49:36FromDiscord<generic linux user> its so fun to make fun of cpp
10:11:45FromDiscord<Rika> In reply to @mlokis "thats why in rust": Doesn’t Nim technically have the same issue
10:16:35FromDiscord<demotomohiro> myproc[3](args) vs myarray[4](argsForProcTypes)
10:26:42FromDiscord<exelotl> Is there a way to make a field of an object not have any overflow checking?
10:27:34FromDiscord<exelotl> I have a Point16 type and I want it to be ok for it to overflow
10:28:06FromDiscord<exelotl> (edit) "it" => "the x and y fields"
11:18:02FromDiscord<demotomohiro> iirc, unsigned int types are not overflow checked.
11:22:05*max22- quit (Ping timeout: 268 seconds)
11:23:58arkanoidwould you suggest unitest or testament?
11:29:03FromDiscord<Rika> One is simpler the other is more flexible
11:41:57*thunder quit (Remote host closed the connection)
11:46:57FromDiscord<bolino> Hi! Is there an elegant way to transform a table keys into a sequence of string? I can do it in a loop, but I guess there must be a better way in Nim, right? Thanks!
11:47:28FromDiscord<bolino> (edit) removed "a table" | "into" => "to create" | "string?" => "strings from table keys?"
11:48:01FromDiscord<enthus1ast> maybe "toSeq(yourTable.keys)
11:48:18FromDiscord<enthus1ast> toSeq is from the sequtils module
11:50:54FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3uts
12:06:02*supakeen quit (Quit: WeeChat 3.2)
12:06:34*supakeen joined #nim
12:08:05FromDiscord<bolino> Aaah thanks. Works like a charm
12:46:59arkanoidI'm calling a template that generates ad exported proc in a unittest, but I'm getting Error: 'export' is only allowed at top level
12:55:00arkanoidnevermind, solved
13:08:14*arkurious joined #nim
13:20:49*rockcavera joined #nim
13:20:49*rockcavera quit (Changing host)
13:20:49*rockcavera joined #nim
13:27:16*pjzz joined #nim
13:27:16arkanoidis it possible to do proc [T]() = case T: ... ?
13:27:37*federico3_ joined #nim
13:27:42FromDiscord<Rika> What? What would that mean
13:28:02arkanoiduse case for handling different types T
13:28:02*redj_ joined #nim
13:28:05FromDiscord<haxscramper> `when T is int`
13:28:10FromDiscord<haxscramper> or I have a typecase macro
13:28:24FromDiscord<haxscramper> that allows to do `typecase T: of int ...`
13:28:40FromDiscord<Rika> Oh did the bridge clobber the text you sent again
13:29:28FromDiscord<haxscramper> https://play.nim-lang.org/#ix=2Vj2
13:29:50arkanoidyeah that's actually what I was looking for. But I prefer not to introduce a macro just for that
13:30:32FromDiscord<haxscramper> it is a syntax sugar over `when T is int`
13:30:42FromDiscord<haxscramper> `when T is int or T is array`
13:34:08*redj quit (*.net *.split)
13:34:08*nisstyre quit (*.net *.split)
13:34:08*pjz quit (*.net *.split)
13:34:08*federico3 quit (*.net *.split)
13:35:04*redj_ quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
13:35:38*redj joined #nim
13:39:05*nisstyre joined #nim
13:50:37arkanoidwhat's the most idiomatic way to do partial function application in nim?
13:53:17FromDiscord<haxscramper> probably hack carrying with closures
13:53:30FromDiscord<haxscramper> there is is no "idiomatic" way
13:54:44arkanoidmmm, you mean like the python way?
13:55:01arkanoidpartial(myproc, arg0, arg1, arg2, ...)
13:55:13arkanoidreturning a closure
13:55:49FromDiscord<haxscramper> yes
13:55:54arkanoidk
13:56:10arkanoidlets see if I end up with a sufficient generic solution
14:16:38arkanoidI'm trying to improve the debug output of my async based server. If the exception happens inside the async, I'm getting very little help from the stacktrace and I'm interested in knowing if this is the expected behaviour or there's something wrong with my code
14:30:22arkanoidhm, I was writing a simple test to expose the problem, but my machine returns a different output than play.nim-lang https://play.nim-lang.org/#ix=3uu6
14:34:20arkanoidI've found the issue, it's gc arc
14:35:00arkanoidif you use gc arc you get very bad async stacktraces, if you use default one you get much more data to debug
14:37:08FromDiscord<@bracketmaster-5a708063d73408ce4> It seems nimterop doesn't really do C++ at the moment?
14:37:54FromDiscord<haxscramper> It does, partially. But there is no solution that really does C++ right now
14:38:11FromDiscord<haxscramper> I'm working on it, but it is far from complete
14:39:12arkanoidalso ORC gives same bad stacktraces
14:39:42arkanoidis ARC/ORC not to be used with async? I though it was fixed since ARC introduction in 2019
14:49:02arkanoidnot sure if this is a bug or a feature request
14:49:58FromDiscord<haxscramper> You can ask on forum about async stacktraces
14:50:28FromDiscord<haxscramper> Since there is usually not that much people around here that might provide concrete detailed answer about async
14:50:46FromDiscord<haxscramper> dom, maybe someone else
14:55:01arkanoidgood idea
15:02:20fn<ForumUpdaterBot99> New thread by Giaco: Stacktrace when using async with arc/orc is not helpful, see https://forum.nim-lang.org/t/8285
15:02:38FromDiscord<Rika> it still takes a moment for me to realise that arkanoid is giaco
15:03:47FromDiscord<dankrad> Thanks, I'm going to play a round with your approach. You helped me a lot!
15:04:23*max22- joined #nim
15:08:37arkanoidRika, yeah we do have split personality disorders
15:44:27FromDiscord<carmysilna> Is there a nim GitHub Actions file I could copy off of? Ideally I would build release versions and then use another action off of marketplace to upload to releases
15:58:22*stkrdknmibalz quit (Quit: WeeChat 3.0.1)
16:06:25FromDiscord<@bracketmaster-5a708063d73408ce4> @haxscramper\:matrix.org - can I have nim read an entire file and dumptree?
16:07:02FromDiscord<haxscramper> std/macros.parseStmt on the readFile content
16:17:26*rockcavera quit (Remote host closed the connection)
16:30:44*thunder joined #nim
16:41:22FromDiscord<@bracketmaster-5a708063d73408ce4> gives me\: rror\: request to generate code for .compileTime proc\: parseStmt
16:41:27FromDiscord<@bracketmaster-5a708063d73408ce4> sent a long message, see http://ix.io/3uv4
16:43:52FromDiscord<@bracketmaster-5a708063d73408ce4> haxscramper, do you have a code snippet with dumptree and parsestmt?
16:45:16FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3uv5
16:45:29FromDiscord<haxscramper> `parseStmt()` is a compile-time proc, you can't use it in macros
16:45:38FromDiscord<haxscramper> Otherwise you can use compiler API
16:49:48*stkrdknmibalz joined #nim
16:50:17FromDiscord<@bracketmaster-5a708063d73408ce4> have you tried npeg?
16:50:17FromDiscord<@bracketmaster-5a708063d73408ce4> https://github.com/zevv/npeg
16:50:18fn<R2D299> itHub: 7"PEGs for Nim, another take"
16:50:29FromDiscord<@bracketmaster-5a708063d73408ce4> It seems to allow for defining grammars in nim
17:27:22*max22- quit (Ping timeout: 240 seconds)
17:31:52*max22- joined #nim
17:39:33*max22- quit (Ping timeout: 276 seconds)
17:40:14FromDiscord<dankrad> I think this question is needless, but I would like still ask. Is it possible to get the nnkSym from a nnkIdent? I guess not, because the name lookup isn't done. Is that right?↵I would like to check if the attribute type (in tree as nnkIdent) is of type nnkObjectTy.
17:42:36FromDiscord<dankrad> sent a code paste, see https://play.nim-lang.org/#ix=3uvo
17:43:50FromDiscord<mlokis> sent a code paste, see https://play.nim-lang.org/#ix=3uvp
17:45:06*flynn quit (Read error: Connection reset by peer)
17:46:13*flynn joined #nim
17:47:57*vicfred joined #nim
17:51:25nixfreak_nim[m]So I took a look a pixie and wondering if pixie and opengl could be a good start to creating component GUI's, like a slider, buttons, and so on
17:52:47nixfreak_nim[m]I know fidgit is being worked on for a second version but what is everyone's opinion on a LCL (Lazarus Component Library) for Nim ?
18:24:22nixfreak_nim[m] * So I took a look at pixie and wondering if pixie and opengl could be a good to create a component library sort of like the LCL(lazarus component library) without the IDE of course.
18:26:20nixfreak_nim[m]https://lazarus-ccr.sourceforge.io/docs/lcl/
18:28:26FromDiscord<haxscramper> [dankrad](https://matrix.to/#/@dankrad:matrix.code0.xyz)\: Correct, you can't get Sym from Ident, it is just not possible. You need to operate op `typed` ast in order to get `Resolution` to be a symbol.
18:30:58FromDiscord<codic> sent a code paste, see https://play.nim-lang.org/#ix=3uvC
18:31:02FromDiscord<codic> or well, a postcondition
18:39:47FromDiscord<leorize> no, `of` branches have to evaluate constant values
18:41:51FromDiscord<codic> sent a code paste, see https://play.nim-lang.org/#ix=3uvE
18:42:23FromDiscord<codic> but I have to move the f to it's own line
18:42:28FromDiscord<codic> (edit) "f" => "if"
18:42:31FromDiscord<codic> which makes it very messy
18:43:26FromDiscord<codic> sent a code paste, see https://play.nim-lang.org/#ix=3uvG
18:43:57FromDiscord<leorize> move that single condition into an `if` of its own
18:46:44FromDiscord<codic> that adds too much indentation
18:46:46FromDiscord<codic> sent a code paste, see https://play.nim-lang.org/#ix=3uvH
18:46:50FromDiscord<codic> or do you mean use if for the whole thing?
18:47:23FromDiscord<codic> sent a code paste, see https://play.nim-lang.org/#ix=3uvI
18:47:38FromDiscord<leorize> yea, unfortunately that's the only way
18:48:25FromDiscord<leorize> sent a code paste, see https://paste.rs/Q9W
18:50:36FromDiscord<codic> it's weird you can't break outo f a case
18:50:39FromDiscord<codic> (edit) "outo f" => "out of"
18:57:29FromDiscord<RattleyCooper> How can I pass a procedure definition to a macro without it always showing up as a void type?
18:58:02FromDiscord<RattleyCooper> I want to create a statament list of procedures and then use the procedure name to map the procedures to a table.
18:58:22FromDiscord<RattleyCooper> sent a code paste, see https://play.nim-lang.org/#ix=3uvL
18:58:44FromDiscord<RattleyCooper> `type mismatch: got <Table[system.string, proc (r: Rpc, data: string, conn: Connection, sock: Reactor){.closure.}], string, void>`
19:00:02FromDiscord<RattleyCooper> sent a code paste, see https://play.nim-lang.org/#ix=3uvM
19:01:14FromDiscord<RattleyCooper> Issue is when I try to add the procedure to the table in the `quote do`
19:18:40FromDiscord<TechnoRazor> In reply to @codic "which makes it very": I don't have a ton of experience with Nim myself, but isn't this the sort of thing you could use a template or macro to make cleaner?
19:39:30FromDiscord<RattleyCooper> Is what I'm trying to do even possible? I'm at the point where I'm just going to give up on the idea. It's not even really required it would just be cool to have but idk. I've been trying to figure this out for a couple days now
19:43:29*supakeen quit (Remote host closed the connection)
19:43:53*supakeen joined #nim
19:56:21FromDiscord<leorize> @RattleyCooper\: you need to convert the nnkProcDef into nnkLambda
19:56:24FromDiscord<leorize> here you go\: https://play.nim-lang.org/#ix=3uvZ
19:56:41FromDiscord<RattleyCooper> Oh, odd. I actually just got it working by using the Ident
19:56:51FromDiscord<RattleyCooper> sent a code paste, see https://play.nim-lang.org/#ix=3uw0
19:57:30FromDiscord<leorize> sure, that works as well
19:57:37FromDiscord<RattleyCooper> I like your solution more tbh
19:58:26FromDiscord<RattleyCooper> Thank you for the example btw. I've really been beating my head against this for a few days so I really appreciate it!
19:58:48FromDiscord<leorize> you're welcome \:)
19:59:24FromDiscord<dankrad> Alright, thanks again. \: )
20:06:44FromDiscord<codic> In reply to @TechnoRazor "I don't have a": yeah but I wouldn't write a full fledged case/of macro just for that
20:13:05FromDiscord<j-james> What is the proper way to deal with nested structs when wrapping C code?
20:15:55FromDiscord<leorize> just move the definition to an outer object then refer to it
20:21:01*max22- joined #nim
20:23:32fn<ForumUpdaterBot99> New thread by Jocker: C lib binding guide, see https://forum.nim-lang.org/t/8286
21:15:56*neceve quit (Ping timeout: 268 seconds)
21:55:48*supakeen quit (Remote host closed the connection)
21:56:12*supakeen joined #nim
21:56:52arkanoidI have a long enum to list byte commands like icHeader = (0x78AB, "CMDA"). As soon as I receive the 2 bytes I convert them and I'm getting the "warning: conversion to enum with holes is unsafe". I never realised this warning before so it must be something in last stable nim. How would you solve this?
22:00:02FromDiscord<konsumlamm> what happens if there is no enum variant for the bytes?
22:02:35FromDiscord<leorize> remember to check them to see if they're in your enum, then cast
22:02:58FromDiscord<leorize> enumutils have a set constructor that you can use for that
22:06:20arkanoidit just errors out and exception is grabbed on the edge, I'm just reading that enum with holes is a bad nim design and araq wants to deprecate them
22:10:42FromDiscord<theangryepicbanana> TIL you can't make a distinct type of a distinct type
22:10:53FromDiscord<theangryepicbanana> that's 2 hours I'll never get back
22:11:36FromDiscord<theangryepicbanana> -_-
22:12:37FromDiscord<konsumlamm> wdym? seems to work for me
22:13:25FromDiscord<theangryepicbanana> In reply to @konsumlamm "wdym? seems to work": I was hoping that if I had `type A = distinct int, B = distinct A`, then `B.distinctBase` would be `A`, not `int`
22:13:42FromDiscord<leorize> distinctBase unwraps a bit far
22:14:00FromDiscord<theangryepicbanana> is there a way to not have it unwrap all the way down?
22:14:11FromDiscord<leorize> open an issue in nim \:p
22:14:25FromDiscord<theangryepicbanana> oof ok
22:18:10arkanoiddamn, I shouldn't have used enums in first place, now I'm stuck with an enum with holes that would take hours to transform into a table
22:18:41FromDiscord<leorize> you can try timothee's enum map
22:18:54FromDiscord<leorize> @timotheecour ^
22:19:43FromDiscord<Elegantbeef> Yea you can always get around that using a array of enum -\> holey enum
22:20:01FromDiscord<Elegantbeef> Or a table holey enum -\> enum
22:20:20FromDiscord<Elegantbeef> I did it for the sdl inputs using a macro
22:20:20FromDiscord<Elegantbeef> Cause i'm a lazy git
22:21:40*Schnouki quit (Quit: WeeChat 3.2)
22:21:42*Typewriter joined #nim
22:22:29FromDiscord<timotheecour> In reply to @theangryepicbanana "I was hoping that": see https://github.com/nim-lang/Nim/pull/8531#discussion_r207764878 I wanted it non-recursive but @Araq did not want it to be recursive; but I'd support adding a flag to allow at least making it non-recursive as an option (should be non-controversial, nothing would break)
22:22:32*sagax quit (Ping timeout: 268 seconds)
22:22:42arkanoidmmm, thanks
22:23:02*Typewriter quit (Client Quit)
22:25:28FromDiscord<timotheecour> In reply to @leorize "you can try timothee's": refs https://github.com/nim-lang/fusion/pull/23↵@Araq closed this one too; IMO it's very useful
22:26:20FromDiscord<timotheecour> (edit) "In reply to @leorize "you can try timothee's": refs https://github.com/nim-lang/fusion/pull/23↵@Araq closed this one too; IMO it's very useful ... " added "and should be re-opened"
22:26:42arkanoidI don't see enummaps available in fusion yet
22:26:59FromDiscord<leorize> you can make it a nimble package↵(@timotheecour)
22:27:04FromDiscord<leorize> not everything has to be in the stdlib
22:27:24FromDiscord<theangryepicbanana> In reply to @timotheecour "see https://github.com/nim-lang/Nim/pull/8531#discu": yeah a flag would be nice, hopefully that can be changed soon-ish
22:27:25FromDiscord<leorize> and we should use more packages so there are incentives to work on making nimble reliable
22:27:43arkanoidok, it's in your fusion fork
22:27:45FromDiscord<timotheecour> In reply to @theangryepicbanana "yeah a flag would": please make a PR
22:28:11FromDiscord<theangryepicbanana> In reply to @timotheecour "please make a PR": can do that soon-ish 👍
22:29:03FromDiscord<timotheecour> nimble packages also means you can't use it in stdlib, and lots of tiny dependencies makes things more complicated
22:29:56FromDiscord<Elegantbeef> There are many trade offs both ways, we could be here all day arguing which is better
22:29:57FromDiscord<leorize> well but usable is always better than not usable
22:30:20FromDiscord<leorize> the issue with tiny deps is just a nimble issue
22:31:01FromDiscord<leorize> a good pm should make deps indistinguishable from just using stdlib
22:42:07arkanoidcompiler manual says "--warningAsError[X]:on|off" but how can I enable errors for ALL warnings?
22:44:04FromDiscord<timotheecour> you can't, I had to disable it here: https://github.com/nim-lang/Nim/pull/18311
22:44:26FromDiscord<timotheecour> (edit) "you can't, I had to disable it here: https://github.com/nim-lang/Nim/pull/18311 ... " added "to avoid a revert of https://github.com/nim-lang/Nim/pull/17852"
22:46:27arkanoid:-|
22:49:02arkanoidthanks
22:57:57FromDiscord<timotheecour> sent a code paste, see https://play.nim-lang.org/#ix=3uwS
22:58:35FromDiscord<timotheecour> (edit) "https://play.nim-lang.org/#ix=3uwS" => "https://play.nim-lang.org/#ix=3uwT"
22:59:20FromDiscord<timotheecour> (edit) "https://play.nim-lang.org/#ix=3uwT" => "https://play.nim-lang.org/#ix=3uwU"
23:04:47FromDiscord<leorize> we can also just make everything a package
23:05:58FromDiscord<leorize> I don't see why stdlib has to be special other than the parts that have tight coupling with the compiler
23:12:48FromDiscord<timotheecour> the problem i'm solving is the case where a module (from stdlib/compiler/tools) needs to depend on a nimble package; the way i proposed will work, and not clash with user installed packages (stdlib or compiler module `foo` needs regex version 1, user has a different version installed); what is your proposed alternative that would make it work in this case?
23:14:11FromDiscord<leorize> make the compiler and its tools uses a proper nimble manifest
23:14:32arkanoidwell I'm really unsure if I should replace the enum with hole with: 1) a table [uint16, string] 2) a long list of constant uint16 3) a long list of contants tuple[uint16,string]
23:15:01FromDiscord<leorize> with a proper package manager, what the compiler imports will be constrained to what it declared in its nimble manifest
23:15:21arkanoidI've tried all the three options but yet the enum with holes seems the cleanest and more idiomatic
23:15:34FromDiscord<leorize> clashing with user packages is a bug, not a feature
23:19:51FromDiscord<timotheecour> wait so you would prevent a user from using pkg/regex at version 1.3 if compiler/stdlib needs a locked down dependency at version 0.9 ?
23:20:08FromDiscord<timotheecour> (edit) "wait so you would prevent a user from using pkg/regex at version 1.3 if compiler/stdlib needs a locked down dependency ... at" added "of pkg/regex"
23:20:26FromDiscord<leorize> why would I do that?
23:20:54FromDiscord<leorize> if the compiler needs regex 0.9, well that's compiler (the program) business, not mine
23:21:34FromDiscord<timotheecour> if stdlib module foo requires pkg/regex 0.9
23:22:27FromDiscord<leorize> then yes, if the user use that module, then they are locked to regex 0.9, or assuming that we adopt MVS and support multi versioning, then stdlib and the user can simultaneously import `0.9` and `1.3`
23:22:55FromDiscord<leorize> and there's no reason to keep stdlib being a big blob
23:23:25FromDiscord<leorize> why does it have to be stdlib module `foo` and not package `foo`?
23:23:54FromDiscord<timotheecour> stdlib will most likely want to locked down every dependency for stability reasons, so this is not hypothetical scenario
23:23:58FromDiscord<leorize> all stdlib modules that are not part of the core language can easily be put into packages and evolved outside of the compiler
23:24:11FromDiscord<leorize> see MVS as described in nimble RFC
23:24:20FromDiscord<leorize> it's meant exactly for this
23:27:32FromDiscord<timotheecour> what i propose is a form of MVS and can be built on top of it if it gets implemented, but doesn't require one to adopt MVS: all it does it have stdlib/compiler (arguable an important special case) have its own locked down versions that don't clash with user installed packages.↵↵whether the same exact approach can be done outside of stdlib/compiler is possible, but not a requirement
23:27:58FromDiscord<timotheecour> (edit) "what i propose is a form of MVS and can be built on top of it if it gets implemented, but doesn't require one to adopt MVS: all it does it have stdlib/compiler (arguable an important special case) have its own locked down versions that don't clash with user installed packages.↵↵whether the same exact approach can be done outside of stdlib/compiler ... is" added "down the line"
23:28:17FromDiscord<leorize> I would propose to not half-ass the implementation and do it properly
23:28:21FromDiscord<leorize> and we should, really
23:28:32FromDiscord<leorize> the language evolves faster than both the compiler and the stdlib
23:29:42FromDiscord<leorize> we are tying ourselves down trying to ship a stdlib that have to support all of our mistakes
23:30:08FromDiscord<timotheecour> what's the link to the MVS RFC
23:31:06FromDiscord<leorize> it's a part of this excellent piece from haxscramper\: https://github.com/nim-lang/RFCs/issues/398
23:31:45FromDiscord<leorize> search "minimal" if you wanna jump to that part
23:36:28arkanoidthis "take everything out to stdlib" path was taken by haskell in the past, and now we need a parallel repository to know which set of modules are compatible with version X of the compiler
23:36:48FromDiscord<timotheecour> there is very little discussion about the multiple versions of the same package in that RFC
23:37:22FromDiscord<leorize> yea, it's left out since hax wanna keep it doable
23:37:41FromDiscord<timotheecour> right but this is the core of what i'm suggesting for stdlib
23:37:44FromDiscord<leorize> you can read the full go's description of the algorithm, they also describe multi versioning
23:40:33FromDiscord<timotheecour> > this "take everything out to stdlib" path was taken by haskell in the past, and now we need a parallel repository to know which set of modules are compatible with version X of the compiler↵this would not be a problem with locked down dependencies; these would be version controlled in nim repo (much like git submodules btw)
23:40:57FromDiscord<timotheecour> (edit) "btw)" => "btw); and they would live in a different namespace so wouldn't clash with user installed packages"
23:41:50arkanoidcan I get the name of a const as a string?
23:42:19FromDiscord<leorize> astToStr is your friend
23:42:41FromDiscord<leorize> it can turn any piece of ast into string, not just your const \:p
23:43:56arkanoidyeah! this way the enum with hole -> const list becomes the most efficient and simple one
23:44:09arkanoidI was not quite happy of the table solution
23:47:37FromDiscord<Elegantbeef> The table solution is needed for very large holey enums, accidently made a super large array that crashed my pc with the array -\> holey enum
23:48:39arkanoidI just have a list of 50 uint16 packet heades that I need to case switch
23:48:48FromDiscord<timotheecour> @ElegantBeef this should be the fastest to deal with enum with holes: https://github.com/nim-lang/Nim/pull/18044
23:49:20FromDiscord<timotheecour> (edit) "@ElegantBeef this should be the fastest to deal with enum with holes: https://github.com/nim-lang/Nim/pull/18044 ... " added "(there is a benchmark too)"
23:50:17arkanoidproblem with const tables is that using it in case switch scenario is not same as with enum holes or list of const
23:51:38FromDiscord<Elegantbeef> Yea considering my use case here tim dont think the overhead is an overly large concern https://github.com/beef331/truss3d/blob/master/src/truss3D/inputs.nim#L46
23:52:16FromDiscord<Elegantbeef> I made a new enum to make an enum array for all my interactions, and let SDL use it's own enum with the LUT for my sanity
23:53:17FromDiscord<Elegantbeef> So all my interactions are cheap and SDL's are expensive 😛
23:54:18arkanoidwhere's the astToStr defined?
23:54:46FromDiscord<Elegantbeef> https://nim-lang.org/docs/system.html#astToStr%2CT
23:55:54arkanoidstraight in system?! whoa, I was expecting it somewhere in macro
23:56:01arkanoidthanks a lot
23:56:21FromDiscord<Elegantbeef> Some comment about people viewing the system module being bloated