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:55 | FromDiscord | <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:54 | FromDiscord | <Elegantbeef> uncheckedarrays do not store size, you store that elsewhere |
02:08:58 | FromDiscord | <jfmonty2> ok, so how do I actually access its elements? |
02:14:32 | FromDiscord | <Elegantbeef> Super lazy showcase of how to make your own seq https://play.nim-lang.org/#ix=3urE |
02:15:28 | FromDiscord | <Elegantbeef> Of course this is heap allocated cause stack allocation is scary 😛 |
02:16:42 | FromDiscord | <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:44 | FromDiscord | <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:10 | FromDiscord | <Elegantbeef> Like for instance is there really any reason to not just use an distinct array |
02:20:50 | FromDiscord | <Elegantbeef> I take it back distinct array doesnt work \:D |
02:22:01 | FromDiscord | <jfmonty2> so `create(T, size)` seems to be the magic that I was missing here |
02:22:08 | FromDiscord | <Elegantbeef> Well that's heap allocated |
02:22:15 | FromDiscord | <jfmonty2> right, I was about to ask about that |
02:22:41 | FromDiscord | <jfmonty2> do I need to use `alloca` or something? Is that stack-allocated? |
02:23:48 | FromDiscord | <Elegantbeef> I dont know, generally it's not advised to stack alloc manually afaik |
02:25:21 | FromDiscord | <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:10 | FromDiscord | <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:11 | FromDiscord | <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:59 | FromDiscord | <Elegantbeef> https://www.man7.org/linux/man-pages/man3/alloca.3.html yea but it can cause UB |
04:23:57 | FromDiscord | <Rika> So don’t use it |
04:24:13 | FromDiscord | <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:52 | FromDiscord | <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:20 | FromDiscord | <Elegantbeef> the implication being dont use alloca? |
08:59:42 | * | max22- quit (Remote host closed the connection) |
08:59:56 | FromDiscord | <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:19 | FromDiscord | <Rika> Has as many guns that’ll shoot you as malloc |
09:00:22 | FromDiscord | <Elegantbeef> Ah so i'll never be allowed to use it |
09:16:53 | FromDiscord | <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:30 | FromDiscord | <Rika> Ah yeah this is the inline issue right? |
09:17:52 | FromDiscord | <arnetheduck> yeah, inline-in-a-loop |
09:17:55 | FromDiscord | <Rika> Where a compiler inlines a function with alloca into a for loop and causes an overflow |
09:19:11 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3ut2 |
09:20:15 | FromDiscord | <Rika> What |
09:20:28 | FromDiscord | <Rika> That’s evil |
09:23:57 | FromDiscord | <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:20 | FromDiscord | <mlokis> and instead of using stack for mutable variables it uses phi nodes |
09:26:13 | FromDiscord | <mlokis> stack is cheap but i guess not that cheap as you still have to load from it |
09:26:57 | FromDiscord | <Elegantbeef> So in summary stack is scary |
09:28:14 | FromDiscord | <mlokis> well llvm has specialized optimization passes that focus on getting rid of stack allocations and use |
09:29:47 | FromDiscord | <mlokis> the c calling convention still allocates stack because for some reason thats a convention |
09:31:17 | FromDiscord | <mlokis> sent a code paste, see https://play.nim-lang.org/#ix=3ut4 |
09:33:31 | FromDiscord | <generic linux user> tested now,it doesnt happen on nim |
09:33:52 | FromDiscord | <mlokis> what does not happen? |
09:34:54 | FromDiscord | <mlokis> the stack overflow or infinite recursion? nim compiles to c which uses c calling convention (yes) |
09:36:20 | FromDiscord | <generic linux user> it exits doing nothing |
09:36:34 | FromDiscord | <generic linux user> return code 0 |
09:36:48 | FromDiscord | <generic linux user> let me try cpp |
09:36:50 | FromDiscord | <mlokis> gues it optimized the call away |
09:37:02 | FromDiscord | <mlokis> thats agressive |
09:37:24 | FromDiscord | <generic linux user> same in cpp |
09:38:18 | FromDiscord | <mlokis> sent a code paste, see https://paste.rs/Oyd |
09:38:24 | FromDiscord | <generic linux user> sent a code paste, see https://paste.rs/1uX |
09:38:25 | FromDiscord | <generic linux user> why main = main() |
09:38:39 | FromDiscord | <generic linux user> wait |
09:38:45 | FromDiscord | <generic linux user> 🗿. |
09:38:46 | FromDiscord | <mlokis> you did not call it |
09:38:51 | FromDiscord | <mlokis> YOU |
09:39:03 | FromDiscord | <generic linux user> sorry |
09:39:17 | FromDiscord | <generic linux user> yes it is doing something |
09:39:25 | FromDiscord | <generic linux user> 100% cpu |
09:39:34 | FromDiscord | <mlokis> interesting |
09:39:38 | FromDiscord | <generic linux user> infinite recursion probably |
09:40:07 | FromDiscord | <generic linux user> when you compile using c++ it doesnt happen |
09:40:26 | FromDiscord | <generic linux user> thats cool, now there is a reason for c++ backend |
09:40:55 | FromDiscord | <mlokis> c++ is better for multiple reasons |
09:41:10 | FromDiscord | <mlokis> it has better error handling |
09:41:15 | FromDiscord | <mlokis> c has none |
09:44:04 | FromDiscord | <generic linux user> what |
09:44:11 | FromDiscord | <generic linux user> a bit faster to compile you know |
09:44:21 | FromDiscord | <generic linux user> a biit |
09:44:55 | FromDiscord | <mlokis> i cant believe how wrong the cpp went with syntax |
09:45:05 | FromDiscord | <generic linux user> yes |
09:45:15 | FromDiscord | <mlokis> literally unparsable |
09:46:36 | FromDiscord | <mlokis> syntax should be in balance between efficiency and expressiveness, cpp has none of that. |
09:47:22 | FromDiscord | <generic linux user> is it ggettimg offtopic tho |
09:47:48 | FromDiscord | <mlokis> sent a code paste, see https://play.nim-lang.org/#ix=3ut8 |
09:48:16 | FromDiscord | <mlokis> lets shut then |
09:49:28 | FromDiscord | <generic linux user> i wouldnt want to |
09:49:36 | FromDiscord | <generic linux user> its so fun to make fun of cpp |
10:11:45 | FromDiscord | <Rika> In reply to @mlokis "thats why in rust": Doesn’t Nim technically have the same issue |
10:16:35 | FromDiscord | <demotomohiro> myproc[3](args) vs myarray[4](argsForProcTypes) |
10:26:42 | FromDiscord | <exelotl> Is there a way to make a field of an object not have any overflow checking? |
10:27:34 | FromDiscord | <exelotl> I have a Point16 type and I want it to be ok for it to overflow |
10:28:06 | FromDiscord | <exelotl> (edit) "it" => "the x and y fields" |
11:18:02 | FromDiscord | <demotomohiro> iirc, unsigned int types are not overflow checked. |
11:22:05 | * | max22- quit (Ping timeout: 268 seconds) |
11:23:58 | arkanoid | would you suggest unitest or testament? |
11:29:03 | FromDiscord | <Rika> One is simpler the other is more flexible |
11:41:57 | * | thunder quit (Remote host closed the connection) |
11:46:57 | FromDiscord | <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:28 | FromDiscord | <bolino> (edit) removed "a table" | "into" => "to create" | "string?" => "strings from table keys?" |
11:48:01 | FromDiscord | <enthus1ast> maybe "toSeq(yourTable.keys) |
11:48:18 | FromDiscord | <enthus1ast> toSeq is from the sequtils module |
11:50:54 | FromDiscord | <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:05 | FromDiscord | <bolino> Aaah thanks. Works like a charm |
12:46:59 | arkanoid | I'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:00 | arkanoid | nevermind, 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:16 | arkanoid | is it possible to do proc [T]() = case T: ... ? |
13:27:37 | * | federico3_ joined #nim |
13:27:42 | FromDiscord | <Rika> What? What would that mean |
13:28:02 | arkanoid | use case for handling different types T |
13:28:02 | * | redj_ joined #nim |
13:28:05 | FromDiscord | <haxscramper> `when T is int` |
13:28:10 | FromDiscord | <haxscramper> or I have a typecase macro |
13:28:24 | FromDiscord | <haxscramper> that allows to do `typecase T: of int ...` |
13:28:40 | FromDiscord | <Rika> Oh did the bridge clobber the text you sent again |
13:29:28 | FromDiscord | <haxscramper> https://play.nim-lang.org/#ix=2Vj2 |
13:29:50 | arkanoid | yeah that's actually what I was looking for. But I prefer not to introduce a macro just for that |
13:30:32 | FromDiscord | <haxscramper> it is a syntax sugar over `when T is int` |
13:30:42 | FromDiscord | <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:37 | arkanoid | what's the most idiomatic way to do partial function application in nim? |
13:53:17 | FromDiscord | <haxscramper> probably hack carrying with closures |
13:53:30 | FromDiscord | <haxscramper> there is is no "idiomatic" way |
13:54:44 | arkanoid | mmm, you mean like the python way? |
13:55:01 | arkanoid | partial(myproc, arg0, arg1, arg2, ...) |
13:55:13 | arkanoid | returning a closure |
13:55:49 | FromDiscord | <haxscramper> yes |
13:55:54 | arkanoid | k |
13:56:10 | arkanoid | lets see if I end up with a sufficient generic solution |
14:16:38 | arkanoid | I'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:22 | arkanoid | hm, 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:20 | arkanoid | I've found the issue, it's gc arc |
14:35:00 | arkanoid | if you use gc arc you get very bad async stacktraces, if you use default one you get much more data to debug |
14:37:08 | FromDiscord | <@bracketmaster-5a708063d73408ce4> It seems nimterop doesn't really do C++ at the moment? |
14:37:54 | FromDiscord | <haxscramper> It does, partially. But there is no solution that really does C++ right now |
14:38:11 | FromDiscord | <haxscramper> I'm working on it, but it is far from complete |
14:39:12 | arkanoid | also ORC gives same bad stacktraces |
14:39:42 | arkanoid | is ARC/ORC not to be used with async? I though it was fixed since ARC introduction in 2019 |
14:49:02 | arkanoid | not sure if this is a bug or a feature request |
14:49:58 | FromDiscord | <haxscramper> You can ask on forum about async stacktraces |
14:50:28 | FromDiscord | <haxscramper> Since there is usually not that much people around here that might provide concrete detailed answer about async |
14:50:46 | FromDiscord | <haxscramper> dom, maybe someone else |
14:55:01 | arkanoid | good idea |
15:02:20 | fn | <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:38 | FromDiscord | <Rika> it still takes a moment for me to realise that arkanoid is giaco |
15:03:47 | FromDiscord | <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:37 | arkanoid | Rika, yeah we do have split personality disorders |
15:44:27 | FromDiscord | <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:25 | FromDiscord | <@bracketmaster-5a708063d73408ce4> @haxscramper\:matrix.org - can I have nim read an entire file and dumptree? |
16:07:02 | FromDiscord | <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:22 | FromDiscord | <@bracketmaster-5a708063d73408ce4> gives me\: rror\: request to generate code for .compileTime proc\: parseStmt |
16:41:27 | FromDiscord | <@bracketmaster-5a708063d73408ce4> sent a long message, see http://ix.io/3uv4 |
16:43:52 | FromDiscord | <@bracketmaster-5a708063d73408ce4> haxscramper, do you have a code snippet with dumptree and parsestmt? |
16:45:16 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3uv5 |
16:45:29 | FromDiscord | <haxscramper> `parseStmt()` is a compile-time proc, you can't use it in macros |
16:45:38 | FromDiscord | <haxscramper> Otherwise you can use compiler API |
16:49:48 | * | stkrdknmibalz joined #nim |
16:50:17 | FromDiscord | <@bracketmaster-5a708063d73408ce4> have you tried npeg? |
16:50:17 | FromDiscord | <@bracketmaster-5a708063d73408ce4> https://github.com/zevv/npeg |
16:50:18 | fn | <R2D299> itHub: 7"PEGs for Nim, another take" |
16:50:29 | FromDiscord | <@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:14 | FromDiscord | <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:36 | FromDiscord | <dankrad> sent a code paste, see https://play.nim-lang.org/#ix=3uvo |
17:43:50 | FromDiscord | <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:25 | nixfreak_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:47 | nixfreak_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:22 | nixfreak_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:20 | nixfreak_nim[m] | https://lazarus-ccr.sourceforge.io/docs/lcl/ |
18:28:26 | FromDiscord | <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:58 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3uvC |
18:31:02 | FromDiscord | <codic> or well, a postcondition |
18:39:47 | FromDiscord | <leorize> no, `of` branches have to evaluate constant values |
18:41:51 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3uvE |
18:42:23 | FromDiscord | <codic> but I have to move the f to it's own line |
18:42:28 | FromDiscord | <codic> (edit) "f" => "if" |
18:42:31 | FromDiscord | <codic> which makes it very messy |
18:43:26 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3uvG |
18:43:57 | FromDiscord | <leorize> move that single condition into an `if` of its own |
18:46:44 | FromDiscord | <codic> that adds too much indentation |
18:46:46 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3uvH |
18:46:50 | FromDiscord | <codic> or do you mean use if for the whole thing? |
18:47:23 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3uvI |
18:47:38 | FromDiscord | <leorize> yea, unfortunately that's the only way |
18:48:25 | FromDiscord | <leorize> sent a code paste, see https://paste.rs/Q9W |
18:50:36 | FromDiscord | <codic> it's weird you can't break outo f a case |
18:50:39 | FromDiscord | <codic> (edit) "outo f" => "out of" |
18:57:29 | FromDiscord | <RattleyCooper> How can I pass a procedure definition to a macro without it always showing up as a void type? |
18:58:02 | FromDiscord | <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:22 | FromDiscord | <RattleyCooper> sent a code paste, see https://play.nim-lang.org/#ix=3uvL |
18:58:44 | FromDiscord | <RattleyCooper> `type mismatch: got <Table[system.string, proc (r: Rpc, data: string, conn: Connection, sock: Reactor){.closure.}], string, void>` |
19:00:02 | FromDiscord | <RattleyCooper> sent a code paste, see https://play.nim-lang.org/#ix=3uvM |
19:01:14 | FromDiscord | <RattleyCooper> Issue is when I try to add the procedure to the table in the `quote do` |
19:18:40 | FromDiscord | <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:30 | FromDiscord | <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:21 | FromDiscord | <leorize> @RattleyCooper\: you need to convert the nnkProcDef into nnkLambda |
19:56:24 | FromDiscord | <leorize> here you go\: https://play.nim-lang.org/#ix=3uvZ |
19:56:41 | FromDiscord | <RattleyCooper> Oh, odd. I actually just got it working by using the Ident |
19:56:51 | FromDiscord | <RattleyCooper> sent a code paste, see https://play.nim-lang.org/#ix=3uw0 |
19:57:30 | FromDiscord | <leorize> sure, that works as well |
19:57:37 | FromDiscord | <RattleyCooper> I like your solution more tbh |
19:58:26 | FromDiscord | <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:48 | FromDiscord | <leorize> you're welcome \:) |
19:59:24 | FromDiscord | <dankrad> Alright, thanks again. \: ) |
20:06:44 | FromDiscord | <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:05 | FromDiscord | <j-james> What is the proper way to deal with nested structs when wrapping C code? |
20:15:55 | FromDiscord | <leorize> just move the definition to an outer object then refer to it |
20:21:01 | * | max22- joined #nim |
20:23:32 | fn | <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:52 | arkanoid | I 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:02 | FromDiscord | <konsumlamm> what happens if there is no enum variant for the bytes? |
22:02:35 | FromDiscord | <leorize> remember to check them to see if they're in your enum, then cast |
22:02:58 | FromDiscord | <leorize> enumutils have a set constructor that you can use for that |
22:06:20 | arkanoid | it 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:42 | FromDiscord | <theangryepicbanana> TIL you can't make a distinct type of a distinct type |
22:10:53 | FromDiscord | <theangryepicbanana> that's 2 hours I'll never get back |
22:11:36 | FromDiscord | <theangryepicbanana> -_- |
22:12:37 | FromDiscord | <konsumlamm> wdym? seems to work for me |
22:13:25 | FromDiscord | <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:42 | FromDiscord | <leorize> distinctBase unwraps a bit far |
22:14:00 | FromDiscord | <theangryepicbanana> is there a way to not have it unwrap all the way down? |
22:14:11 | FromDiscord | <leorize> open an issue in nim \:p |
22:14:25 | FromDiscord | <theangryepicbanana> oof ok |
22:18:10 | arkanoid | damn, 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:41 | FromDiscord | <leorize> you can try timothee's enum map |
22:18:54 | FromDiscord | <leorize> @timotheecour ^ |
22:19:43 | FromDiscord | <Elegantbeef> Yea you can always get around that using a array of enum -\> holey enum |
22:20:01 | FromDiscord | <Elegantbeef> Or a table holey enum -\> enum |
22:20:20 | FromDiscord | <Elegantbeef> I did it for the sdl inputs using a macro |
22:20:20 | FromDiscord | <Elegantbeef> Cause i'm a lazy git |
22:21:40 | * | Schnouki quit (Quit: WeeChat 3.2) |
22:21:42 | * | Typewriter joined #nim |
22:22:29 | FromDiscord | <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:42 | arkanoid | mmm, thanks |
22:23:02 | * | Typewriter quit (Client Quit) |
22:25:28 | FromDiscord | <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:20 | FromDiscord | <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:42 | arkanoid | I don't see enummaps available in fusion yet |
22:26:59 | FromDiscord | <leorize> you can make it a nimble package↵(@timotheecour) |
22:27:04 | FromDiscord | <leorize> not everything has to be in the stdlib |
22:27:24 | FromDiscord | <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:25 | FromDiscord | <leorize> and we should use more packages so there are incentives to work on making nimble reliable |
22:27:43 | arkanoid | ok, it's in your fusion fork |
22:27:45 | FromDiscord | <timotheecour> In reply to @theangryepicbanana "yeah a flag would": please make a PR |
22:28:11 | FromDiscord | <theangryepicbanana> In reply to @timotheecour "please make a PR": can do that soon-ish 👍 |
22:29:03 | FromDiscord | <timotheecour> nimble packages also means you can't use it in stdlib, and lots of tiny dependencies makes things more complicated |
22:29:56 | FromDiscord | <Elegantbeef> There are many trade offs both ways, we could be here all day arguing which is better |
22:29:57 | FromDiscord | <leorize> well but usable is always better than not usable |
22:30:20 | FromDiscord | <leorize> the issue with tiny deps is just a nimble issue |
22:31:01 | FromDiscord | <leorize> a good pm should make deps indistinguishable from just using stdlib |
22:42:07 | arkanoid | compiler manual says "--warningAsError[X]:on|off" but how can I enable errors for ALL warnings? |
22:44:04 | FromDiscord | <timotheecour> you can't, I had to disable it here: https://github.com/nim-lang/Nim/pull/18311 |
22:44:26 | FromDiscord | <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:27 | arkanoid | :-| |
22:49:02 | arkanoid | thanks |
22:57:57 | FromDiscord | <timotheecour> sent a code paste, see https://play.nim-lang.org/#ix=3uwS |
22:58:35 | FromDiscord | <timotheecour> (edit) "https://play.nim-lang.org/#ix=3uwS" => "https://play.nim-lang.org/#ix=3uwT" |
22:59:20 | FromDiscord | <timotheecour> (edit) "https://play.nim-lang.org/#ix=3uwT" => "https://play.nim-lang.org/#ix=3uwU" |
23:04:47 | FromDiscord | <leorize> we can also just make everything a package |
23:05:58 | FromDiscord | <leorize> I don't see why stdlib has to be special other than the parts that have tight coupling with the compiler |
23:12:48 | FromDiscord | <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:11 | FromDiscord | <leorize> make the compiler and its tools uses a proper nimble manifest |
23:14:32 | arkanoid | well 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:01 | FromDiscord | <leorize> with a proper package manager, what the compiler imports will be constrained to what it declared in its nimble manifest |
23:15:21 | arkanoid | I've tried all the three options but yet the enum with holes seems the cleanest and more idiomatic |
23:15:34 | FromDiscord | <leorize> clashing with user packages is a bug, not a feature |
23:19:51 | FromDiscord | <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:08 | FromDiscord | <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:26 | FromDiscord | <leorize> why would I do that? |
23:20:54 | FromDiscord | <leorize> if the compiler needs regex 0.9, well that's compiler (the program) business, not mine |
23:21:34 | FromDiscord | <timotheecour> if stdlib module foo requires pkg/regex 0.9 |
23:22:27 | FromDiscord | <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:55 | FromDiscord | <leorize> and there's no reason to keep stdlib being a big blob |
23:23:25 | FromDiscord | <leorize> why does it have to be stdlib module `foo` and not package `foo`? |
23:23:54 | FromDiscord | <timotheecour> stdlib will most likely want to locked down every dependency for stability reasons, so this is not hypothetical scenario |
23:23:58 | FromDiscord | <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:11 | FromDiscord | <leorize> see MVS as described in nimble RFC |
23:24:20 | FromDiscord | <leorize> it's meant exactly for this |
23:27:32 | FromDiscord | <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:58 | FromDiscord | <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:17 | FromDiscord | <leorize> I would propose to not half-ass the implementation and do it properly |
23:28:21 | FromDiscord | <leorize> and we should, really |
23:28:32 | FromDiscord | <leorize> the language evolves faster than both the compiler and the stdlib |
23:29:42 | FromDiscord | <leorize> we are tying ourselves down trying to ship a stdlib that have to support all of our mistakes |
23:30:08 | FromDiscord | <timotheecour> what's the link to the MVS RFC |
23:31:06 | FromDiscord | <leorize> it's a part of this excellent piece from haxscramper\: https://github.com/nim-lang/RFCs/issues/398 |
23:31:45 | FromDiscord | <leorize> search "minimal" if you wanna jump to that part |
23:36:28 | arkanoid | 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 |
23:36:48 | FromDiscord | <timotheecour> there is very little discussion about the multiple versions of the same package in that RFC |
23:37:22 | FromDiscord | <leorize> yea, it's left out since hax wanna keep it doable |
23:37:41 | FromDiscord | <timotheecour> right but this is the core of what i'm suggesting for stdlib |
23:37:44 | FromDiscord | <leorize> you can read the full go's description of the algorithm, they also describe multi versioning |
23:40:33 | FromDiscord | <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:57 | FromDiscord | <timotheecour> (edit) "btw)" => "btw); and they would live in a different namespace so wouldn't clash with user installed packages" |
23:41:50 | arkanoid | can I get the name of a const as a string? |
23:42:19 | FromDiscord | <leorize> astToStr is your friend |
23:42:41 | FromDiscord | <leorize> it can turn any piece of ast into string, not just your const \:p |
23:43:56 | arkanoid | yeah! this way the enum with hole -> const list becomes the most efficient and simple one |
23:44:09 | arkanoid | I was not quite happy of the table solution |
23:47:37 | FromDiscord | <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:39 | arkanoid | I just have a list of 50 uint16 packet heades that I need to case switch |
23:48:48 | FromDiscord | <timotheecour> @ElegantBeef this should be the fastest to deal with enum with holes: https://github.com/nim-lang/Nim/pull/18044 |
23:49:20 | FromDiscord | <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:17 | arkanoid | problem with const tables is that using it in case switch scenario is not same as with enum holes or list of const |
23:51:38 | FromDiscord | <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:16 | FromDiscord | <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:17 | FromDiscord | <Elegantbeef> So all my interactions are cheap and SDL's are expensive 😛 |
23:54:18 | arkanoid | where's the astToStr defined? |
23:54:46 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/system.html#astToStr%2CT |
23:55:54 | arkanoid | straight in system?! whoa, I was expecting it somewhere in macro |
23:56:01 | arkanoid | thanks a lot |
23:56:21 | FromDiscord | <Elegantbeef> Some comment about people viewing the system module being bloated |