00:19:07 | FromDiscord | <Livingstone> sent a code paste, see https://play.nim-lang.org/#ix=2TmJ |
00:19:48 | FromDiscord | <Yardanico> shortest would be with https://nim-lang.org/docs/algorithm.html#sortedByIt.t%2Cuntyped%2Cuntyped |
00:19:54 | FromDiscord | <Yardanico> distances.sortedByIt(it[1]) |
00:20:53 | FromDiscord | <Yardanico> I mean var distances = distances.sortedByIt(it[1]) |
00:20:55 | FromDiscord | <Yardanico> that makes a copy though |
00:21:03 | * | rockcavera joined #nim |
00:21:42 | FromDiscord | <Yardanico> https://nim-lang.org/docs/algorithm.html#sort,openArray[T],proc(T,T) for an in-place one |
00:22:06 | FromDiscord | <Livingstone> what does an in place one mean? |
00:22:16 | FromDiscord | <Yardanico> modifies the original variable without creating a copy |
00:22:21 | FromDiscord | <Yardanico> "in-place" - modifies the original variable |
00:22:32 | FromDiscord | <Yardanico> "out-of-place" - creates a "new variable" |
00:22:52 | FromDiscord | <Yardanico> in-place operations are usually more efficient because you don't need to make copies |
00:26:40 | * | Vladar quit (Quit: Leaving) |
00:33:23 | * | abm joined #nim |
00:49:05 | ForumUpdaterBot | New thread by Bonesinger: Experimenting with reflections to create SQL statements, got some questions, see https://forum.nim-lang.org/t/7659 |
01:04:54 | * | Tanger joined #nim |
01:06:26 | * | rockcavera is now known as Guest70980 |
01:06:26 | * | Guest70980 quit (Killed (verne.freenode.net (Nickname regained by services))) |
01:06:27 | * | rockcavera joined #nim |
01:20:10 | * | njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
01:20:28 | * | njoseph joined #nim |
01:26:40 | FromDiscord | <Livingstone> sent a code paste, see https://paste.rs/o0o |
01:27:09 | FromDiscord | <Livingstone> (edit) "https://play.nim-lang.org/#ix=2Tnd" => "https://play.nim-lang.org/#ix=2Tnc" |
01:41:49 | * | icebattle quit (Quit: leaving) |
02:17:35 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2Tnr |
02:17:43 | FromDiscord | <Yardanico> ah wait |
02:18:19 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2Tns |
02:19:35 | * | Jjp137 quit (Quit: Leaving) |
02:22:42 | * | Jjp137 joined #nim |
02:26:40 | * | jxy quit (Remote host closed the connection) |
02:26:58 | * | jxy joined #nim |
02:54:24 | * | abm quit (Quit: Leaving) |
03:13:17 | FromDiscord | <Livingstone> thanks, how would you make a list including two different data types are arrays my only option? |
03:13:29 | FromDiscord | <Livingstone> distances.add(train_row,dist) |
04:09:39 | * | spiderstew_ joined #nim |
04:10:03 | * | rockcavera quit (Remote host closed the connection) |
04:10:50 | * | spiderstew quit (Ping timeout: 264 seconds) |
04:33:24 | * | SofarUpYa joined #nim |
04:48:32 | * | Gustavo6046 quit (Ping timeout: 240 seconds) |
04:52:19 | ForumUpdaterBot | New post on r/nim by nuL808: Overloaded procs interfering?, see https://reddit.com/r/nim/comments/m89koq/overloaded_procs_interfering/ |
05:14:53 | * | lritter joined #nim |
05:22:48 | * | derfnok joined #nim |
05:32:50 | * | rockcavera joined #nim |
05:35:38 | FromDiscord | <Daniel> Imagine av1 encoder made in nim. |
05:36:19 | FromDiscord | <ElegantBeef> Well go make it then we wont have to |
05:40:22 | FromDiscord | <jfmonty2> Is it impossible to make a copy of an `openArray` param within a proc? |
05:40:45 | FromDiscord | <jfmonty2> I'd like to make a copy, mutate the copy, etc. but I get `invalid type: 'openArray[int]' for var` |
05:43:21 | FromDiscord | <ElegantBeef> I believe this is the best way to copy it↵https://play.nim-lang.org/#ix=2TnJ |
05:45:37 | FromDiscord | <jfmonty2> ok, and we have to make it a seq because you can always convert an array to a seq but not necessarily vice versa? |
05:47:18 | FromDiscord | <ElegantBeef> You dont have any size information from the openarray at compile time so you cannot make an array |
05:47:29 | FromDiscord | <jfmonty2> right |
05:47:39 | FromDiscord | <ElegantBeef> Atleast assuming you want the entire collection copied |
05:48:22 | FromDiscord | <jfmonty2> as an aside, I notice you have `import std/sequtils`, is there an official guideline on when to use `std/` and when not? |
05:50:35 | FromDiscord | <ElegantBeef> if you're importing system you should be using `std` |
05:50:40 | FromDiscord | <ElegantBeef> (edit) "system" => "stdlib" |
05:51:06 | FromDiscord | <ElegantBeef> New packages are only accessible with it, and generally it's just the proper way to do it now |
05:51:29 | FromDiscord | <jfmonty2> huh, ok. So the examples that don't have it are just old? |
05:51:45 | FromDiscord | <ElegantBeef> Yea, also not everyone has adopted that method |
05:52:17 | FromDiscord | <ElegantBeef> worth noting you can also do `import std/[sequtils, math, strutils]` which makes it pretty neat |
05:53:08 | FromDiscord | <jfmonty2> oh nice, that's good to know |
05:53:30 | FromDiscord | <jfmonty2> seems like one-line-per-namespace might be a nice style then |
05:53:50 | FromDiscord | <jfmonty2> (I've been wondering how to break up lists of imports, since Nim obviously doesn't follow the python convention of one per line) |
05:55:55 | FromDiscord | <ElegantBeef> Yep it even works for packages in the current project assuming they're in the same folder |
05:56:18 | FromDiscord | <jfmonty2> like `./[a, b, c]`? |
05:57:35 | FromDiscord | <ElegantBeef> Yea though the `./` might not be needed |
05:57:50 | FromDiscord | <ElegantBeef> By same folder i meant next to eachother |
05:58:05 | FromDiscord | <ElegantBeef> Since the module system works off the directory |
06:26:13 | * | superbia joined #nim |
06:32:18 | * | narimiran joined #nim |
06:43:45 | * | johannes joined #nim |
06:56:54 | * | letto quit (Quit: Konversation terminated!) |
06:57:40 | * | SofarUpYa quit (Quit: I couldn't repair your brakes, so I made your horn louder.) |
07:00:35 | ForumUpdaterBot | New thread by Drkameleon: Easiest way of charting module inter-dependencies, see https://forum.nim-lang.org/t/7660 |
07:11:53 | * | johannes quit (Read error: Connection reset by peer) |
07:12:53 | * | superbia quit (Quit: WeeChat 3.1) |
07:20:33 | * | Tanger quit (Quit: Leaving) |
07:22:53 | * | letto joined #nim |
07:24:38 | FromDiscord | <Varriount> Anyone know what the state of multi-threading and/or CPS is? |
07:25:35 | FromDiscord | <Varriount> And if it can be sponsored? |
07:26:03 | Prestige | Idk who is taking it on now that disruptek left |
07:27:27 | FromDiscord | <InventorMatt> I believe mratsim has plans for it currently |
07:30:59 | saem | Yup, last I heard mratsim was reviewing the transform code. |
07:31:29 | saem | In terms of sponsorship what were you thinking? |
07:32:43 | * | PMunch joined #nim |
07:32:59 | Prestige | hello PMunch |
07:33:10 | PMunch | Hi :) |
07:33:24 | Prestige | Happy Friday |
07:33:34 | PMunch | Yay! |
07:33:56 | PMunch | Unfortunately I'm redoing my bathroom, so the weekend will likely be spent on that :( |
07:33:58 | saem | Sup |
07:34:23 | saem | Yeah, butt you get an upgraded bathroom. |
07:34:32 | PMunch | True |
07:34:39 | PMunch | That feels further and further away though :P |
07:34:49 | saem | That's normal. |
07:34:49 | PMunch | Had quite a large setback yesterday |
07:34:52 | PMunch | Super annoying |
07:35:49 | saem | I've done a few of those, they're a whole thing. |
07:36:14 | FromDiscord | <ElegantBeef> It's only a setback if you care how it looks 😛 |
07:42:30 | PMunch | Not quite, I'm putting up something akin to respatex on the walls. Two of the panels didn't connect properly and I ended up breaking one in the process of forcing them together. So now I have to get another pack which needs 3 days of conditioning indoors |
07:43:13 | PMunch | Meaning I'm 3 days behind schedule, not counting the half day I spent struggling with that and taking the panelling up and down.. |
07:44:47 | saem | Hmm, I wonder what's a good approach to memoize type relations (converters). Currently thinking an ordered table and counters to know how many to remove when scope changes. 🤔 |
07:45:02 | saem | Ugh, that sounds painful. |
07:45:41 | saem | Still gotta benchmark or after to see if I make a dent in compile time afterwards. |
07:52:47 | * | berknok joined #nim |
07:55:38 | * | derfnok quit (Ping timeout: 260 seconds) |
08:12:45 | ForumUpdaterBot | New thread by Dabod: How do I get a reference to a object, see https://forum.nim-lang.org/t/7661 |
09:05:12 | PMunch | Plumber just finished! Looks great. Now I just need to finish the walls and such :) |
09:10:58 | FromDiscord | <ElegantBeef> resisting making the german plumber joke 😄 |
09:14:20 | PMunch | German plumber joke? |
09:15:50 | FromDiscord | <ElegantBeef> "Hopefully if it was a german plumber you check to see the gas isnt hooked to the shower" |
09:17:13 | PMunch | Haha, is this a thing? |
09:17:20 | FromDiscord | <ElegantBeef> It's a joke yes |
09:17:25 | PMunch | German plumber jokes I mean |
09:17:38 | FromDiscord | <ElegantBeef> I mean jokes about german plumbers yes |
09:20:19 | * | rockcavera quit (Read error: Connection reset by peer) |
09:20:46 | * | rockcavera joined #nim |
09:22:18 | * | fredrikhr joined #nim |
09:28:13 | * | xet7 quit (Quit: Leaving) |
09:29:39 | * | xet7 joined #nim |
09:55:19 | Clonkk[m] | Is there foreseeable issues to use both pragmas "header" and "dynlib" when importing symbol from C ? Some symbol will be declared in header, defined in lib, others will be fully defined in header. I'm wondering if I can just use ``{.push header: header.h, dynlib. lib.so.}`` without troubles |
10:03:06 | ForumUpdaterBot | New thread by Mantielero: Json - update, see https://forum.nim-lang.org/t/7662 |
10:18:57 | ForumUpdaterBot | New question by Saeed Baig: Import a specific macro from a module in Nim, see https://stackoverflow.com/questions/66706277/import-a-specific-macro-from-a-module-in-nim |
10:27:02 | * | Vladar joined #nim |
10:53:21 | * | superbia joined #nim |
11:06:33 | * | Gustavo6046 joined #nim |
11:11:02 | * | Gustavo6046 quit (Ping timeout: 256 seconds) |
11:12:03 | * | superbia quit (Quit: WeeChat 3.1) |
11:30:18 | * | nokrealm joined #nim |
11:33:06 | * | berknok quit (Ping timeout: 260 seconds) |
11:43:36 | PMunch | @Clonkk[m], not sure, we really should have better documentation for this kind of stuff.. |
11:57:29 | ForumUpdaterBot | New thread by Wongboo: Compile a nim single file to a single c file that only depends standard c header and lib, see https://forum.nim-lang.org/t/7663 |
11:58:20 | FromDiscord | <Yardanico> ^ again people trying to use Nim when they're only allowed to use C :) |
11:58:29 | FromDiscord | <Yardanico> i mean it's true it's sometimes needed, but still |
11:59:21 | Clonkk[m] | Compile your nim program for the target platform and write a C file with the elf binary as a const that execute the elf from C |
12:00:39 | * | nokrealm quit (Quit: Leaving) |
12:01:30 | PMunch | Haha |
12:02:28 | FromDiscord | <Yardanico> but anyway, the idea to create single C might be interesting |
12:02:34 | FromDiscord | <Yardanico> aren't there tools to combine multiple C files into one |
12:02:52 | PMunch | Indeed, if for nothing else to make it easier to link Nim into other projects |
12:05:39 | PMunch | Seems to be some suggestions here: https://stackoverflow.com/questions/5995773/merge-c-files-into-a-single-source-file |
12:10:19 | FromDiscord | <Yardanico> from that link there's https://github.com/cil-project/cil |
12:10:24 | FromDiscord | <Yardanico> but seems to be quite abandoned |
12:10:31 | PMunch | Yeah I'm looking into that one |
12:11:42 | FromDiscord | <Goel> Does nim compiler and nimble auto-update when installed with choosenim? |
12:12:15 | PMunch | Define auto-update? |
12:12:27 | FromDiscord | <Yardanico> @Goel no, that would be quite bad |
12:12:40 | FromDiscord | <Yardanico> The following dependencies couldn't be met: - cil → ocaml < 4.06.0 |
12:12:41 | FromDiscord | <Yardanico> hehe |
12:12:41 | FromDiscord | <Goel> For example, when there will be a new release of Nim, lets say 1.4.5 or 1.5 |
12:12:50 | FromDiscord | <Yardanico> @Goel you could update with a single command then, but not automatically |
12:13:01 | FromDiscord | <Yardanico> automatic updates are not a good thing for languages |
12:13:12 | FromDiscord | <Yardanico> also 1.4.5 and 1.5 aren't stable releases |
12:13:23 | FromDiscord | <Yardanico> in nim odd versions = development releases |
12:13:26 | FromDiscord | <Yardanico> even = stable |
12:13:37 | FromDiscord | <Yardanico> that's why we have 1.0... 1.2 ... 1.4... and soon we'll have 1.6 ... |
12:13:39 | FromDiscord | <Goel> Indeed, thats why i was asking. I don't want to work on a project with dependencies for 1.4.4 and then it auto update to another newer version |
12:15:02 | FromDiscord | <Goel> Why passing from 1.4.5 to 1.6 and not 1.5? What happend with 1.5? |
12:15:04 | FromDiscord | <Yardanico> @PMunch oh apparently opam can auto-downgrade ocaml, let's see how far that goes |
12:15:12 | FromDiscord | <Yardanico> @Goel read above |
12:15:39 | PMunch | Hmm, sure the dependency is real? |
12:16:01 | FromDiscord | <Yardanico> well, opam install cil told me so |
12:16:06 | FromDiscord | <Yardanico> I think it's building an older ocaml compiler now |
12:16:08 | PMunch | Might be easier to just tell CIL to allow a newer version if there isn't actually an issue :P |
12:17:24 | FromDiscord | <Yardanico> also seems like CIL doesn't work with newer gcc without a patch |
12:17:35 | FromDiscord | <Yardanico> https://github.com/cil-project/cil/issues/30 |
12:18:04 | PMunch | This is starting to feel like more work than it's worth :P |
12:18:07 | FromDiscord | <Yardanico> oh cil installed |
12:19:42 | FromDiscord | <Yardanico> oh it seems to work as described in https://people.eecs.berkeley.edu/~necula/cil/merger.html |
12:19:45 | FromDiscord | <Yardanico> now lets try on a nim program :P |
12:22:11 | FromDiscord | <Yardanico> i forgot, is there a way to make nim accept gcc.exe and gcc.linkerexe with spaces? |
12:22:44 | PMunch | Hmm, I tried the codingame-merge JS thingy |
12:22:52 | PMunch | It created a file but didn't write anything to it :P |
12:22:57 | FromDiscord | <Yardanico> guess I need to use the same workaround as with zig |
12:23:06 | FromDiscord | <Yardanico> (create a script with no spaces in the name for calling cilly) |
12:23:12 | PMunch | Can't you just escape them? |
12:23:19 | PMunch | With a backslash? |
12:23:44 | FromDiscord | <Yardanico> no |
12:23:53 | FromDiscord | <Yardanico> nim quotes the compiler binary when calling it |
12:23:59 | FromDiscord | <Yardanico> ''cilly --merge --keepmerged' -c -w -fmax-errors=3 |
12:24:02 | PMunch | Ah.. |
12:24:41 | FromDiscord | <Rika> y tho |
12:25:02 | FromDiscord | <Yardanico> @Rika for security I guess? |
12:25:05 | FromDiscord | <Yardanico> @PMunch got further |
12:25:05 | FromDiscord | <Yardanico> /home/dian/Things/Nim/lib/nimbase.h[327:15-16] : syntax error |
12:25:09 | FromDiscord | <Yardanico> (comes from CIL) |
12:25:15 | FromDiscord | <Yardanico> that line is NIM_STATIC_ASSERT(sizeof(NIM_BOOL) == 1, ""); // check whether really needed |
12:25:20 | FromDiscord | <Yardanico> ill try to comment :D |
12:25:55 | FromDiscord | <Yardanico> hm it still fails, maybe the error isn't on that line |
12:26:42 | PMunch | Welp, that script seems broken.. |
12:28:38 | FromDiscord | <Yardanico> wait I'm confused, even if I move nimbase.h the error is still the same |
12:28:50 | FromDiscord | <Yardanico> oh it caches stuff |
12:28:51 | FromDiscord | <Yardanico> got it |
12:29:31 | FromDiscord | <Yardanico> "/usr/include/stdlib.h[140:8-16] : syntax error" uhh |
12:30:01 | FromDiscord | <Rika> uhhh |
12:30:03 | FromDiscord | <Rika> lmao |
12:30:33 | FromDiscord | <Rika> whats the line? lol |
12:31:12 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2ToX |
12:31:39 | ForumUpdaterBot | New thread by Pumpus: F6 on visual studio code, see https://forum.nim-lang.org/t/7664 |
12:31:56 | FromDiscord | <Rika> isnt that a cpp thing |
12:32:03 | FromDiscord | <Yardanico> how so? |
12:32:12 | FromDiscord | <Rika> nvm, prolly delusional |
12:33:11 | PMunch | It kinda seem to not like macros Yardanico |
12:34:33 | FromDiscord | <Yardanico> yeah :( |
12:34:54 | FromDiscord | <Yardanico> wait |
12:34:57 | FromDiscord | <Yardanico> there's a maintained fork I think |
12:34:58 | FromDiscord | <Yardanico> https://github.com/goblint/cil |
12:35:03 | FromDiscord | <Yardanico> I checked the fork network to see maintained ones |
12:35:09 | FromDiscord | <Yardanico> this one is 223 commits ahead |
12:35:31 | PMunch | Ooh, seems promising |
12:38:32 | FromDiscord | <Yardanico> trying to install it now |
12:39:20 | FromDiscord | <Yardanico> oo, I think I built it |
12:43:28 | PMunch | The suspense is killing me! |
12:44:41 | FromDiscord | <Yardanico> same error :( |
12:45:36 | FromDiscord | <Yardanico> hmmmmm |
12:45:37 | FromDiscord | <Yardanico> https://github.com/goblint/cil/pull/24 |
12:46:29 | PMunch | Are you compiling to C or Cpp? |
12:47:36 | FromDiscord | <Yardanico> c of course |
12:48:06 | PMunch | So your trying to build that version now? |
12:48:29 | FromDiscord | <Yardanico> I'll try it from this PR, yeah |
12:48:43 | FromDiscord | <Yardanico> but I think that the most reliable way would be to try with an older gcc |
12:48:44 | FromDiscord | <Yardanico> like 7 or 8 |
12:48:48 | FromDiscord | <Yardanico> I have 10.2 |
12:50:11 | PMunch | What does GCC do in this case? |
12:50:26 | PMunch | Where you able to generate the single file already? Just not compile it? |
12:50:54 | FromDiscord | <Yardanico> no, as I said cil parsing fails |
12:51:13 | FromDiscord | <Yardanico> extern _Float32 strtof32 (const char restrict nptr, |
12:51:16 | FromDiscord | <Yardanico> it fails to parse _Float32 here |
12:51:44 | FromDiscord | <Yardanico> that said, I found https://github.com/stephenrkell/cil/commit/7c550e93438b52ea3859e4e261d530c34ca9907b which might be able to help |
12:55:45 | FromDiscord | <Goel> Is it possible to have several procedures with the same name? What happens once i call it? All the procedures with the same name will be called together? I'm asking this because i noticed this between the procs made to convert the OpenGL procs from C to Nim↵`proc toGlEnum(hint: Hint)`↵`proc toGlEnum(facing: Facing)`↵`proc toGlEnum(mode: AccessMode)` |
12:56:11 | FromDiscord | <Yardanico> yes of course it's totally fine |
12:56:21 | FromDiscord | <Yardanico> nim has overloading |
12:56:28 | FromDiscord | <Yardanico> based on the number of arguments, types of arguments, names of arguments |
12:56:41 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual.html#overloading-resolution |
12:56:46 | FromDiscord | <aryn> you can overload based on names? |
12:56:46 | FromDiscord | <aryn> nice |
12:56:53 | FromDiscord | <Yardanico> yeah |
12:57:12 | FromDiscord | <aryn> i came from the JVM so not too used to stuff like that |
12:57:19 | FromDiscord | <Yardanico> https://github.com/nim-lang/Nim/wiki/Lesser-known-Nim-features#overloading-based-on-the-named-argument |
12:57:42 | FromDiscord | <aryn> ah ofc, because you can name the args |
12:58:18 | PMunch | Huh, even I didn't know about that one :P |
13:04:26 | PMunch | Okay, if you pass arguments solely like this then there's something wrong with you: https://github.com/nim-lang/Nim/wiki/Lesser-known-Nim-features#less-known-examples-of-nim-argument-passing-syntax |
13:04:57 | FromDiscord | <Yardanico> XDDD |
13:05:06 | PMunch | But I can see it being practical if you want to call one procedure with the result of a longer statement that you really don't want to keep in a variable |
13:06:03 | FromDiscord | <aryn> In reply to @PMunch "Okay, if you pass": D: |
13:06:35 | FromDiscord | <Rika> i will make sure to code like that just to irritate everyone |
13:07:30 | FromDiscord | <Goel> and will comment it with # You're welcome |
13:08:57 | * | Vladar quit (Quit: Leaving) |
13:09:43 | PMunch | Okay, this is just wrong.. https://github.com/nim-lang/Nim/wiki/Lesser-known-Nim-features#lvalue-type-conversion-for-distinct-or-equivalent-types-better-explained-with-code |
13:10:08 | FromDiscord | <Yardanico> why? :P |
13:10:17 | PMunch | I guess a.int = 3 kinda makes sense, but still.. |
13:10:24 | PMunch | Why not 3.Dollar |
13:10:30 | FromDiscord | <Yardanico> shorter to write :P |
13:10:36 | PMunch | Maybe for generic programming.. |
13:10:40 | FromDiscord | <Yardanico> but anyway most of these are just some cool things |
13:10:50 | PMunch | You could accept something that's not strictly an int, but int-compatible |
13:11:01 | PMunch | Oh for sure |
13:11:12 | PMunch | I'm just trying to find some use for them |
13:11:20 | FromDiscord | <Rika> pmunch the example doesnt do it justice but the usecases are there |
13:11:30 | PMunch | Like what? |
13:15:09 | FromDiscord | <clyybber> PMunch: For giving us bugs like https://github.com/nim-lang/Nim/issues/14160 of course! |
13:16:00 | PMunch | Wait, what's a RootRef? |
13:17:22 | * | Gustavo6046 joined #nim |
13:17:30 | PMunch | Would be interesting if you could miss an index when they where explicitly defined: https://github.com/nim-lang/Nim/wiki/Lesser-known-Nim-features#using-enums-as-array-indexes |
13:17:35 | FromDiscord | <clyybber> the object that every object inherits from |
13:18:17 | FromDiscord | <clyybber> is RootObj, and I guess RootRef is the same thing but as a ref object |
13:18:40 | FromDiscord | <clyybber> it doesn't matter what you use most of the time since `object of X` is lenient like that |
13:18:45 | FromDiscord | <clyybber> (edit) "`object" => "`type = object" |
13:22:31 | FromDiscord | <Yardanico> @PMunch I made it work but not sure how viable is that |
13:22:39 | PMunch | Oh really? |
13:22:46 | PMunch | How'd you do it? |
13:22:50 | FromDiscord | <Yardanico> basically I had to comment lines 78-80, 327, 546 in nimbase.h |
13:22:51 | FromDiscord | <Yardanico> that's all |
13:23:06 | PMunch | And are those, uhm, important? |
13:23:06 | FromDiscord | <Yardanico> 78-80 defines _GNU_SOURCE if possible |
13:23:09 | FromDiscord | <Yardanico> idk :P |
13:23:13 | PMunch | Haha :P |
13:23:47 | FromDiscord | <Yardanico> that said, cil amalgamates EVERYTHING |
13:23:50 | FromDiscord | <Yardanico> all includes, even system ones |
13:24:11 | PMunch | Oooh |
13:24:25 | PMunch | How big is the end result? |
13:24:35 | PMunch | For lets say a simple "hello world" |
13:25:43 | FromDiscord | <Yardanico> full debug hello world build (no compiler switches) - 15k lines of C code, but there are #line directives everywhere, without them ~10k lines |
13:25:51 | FromDiscord | <Yardanico> -d:danger 6.6k lines |
13:25:58 | FromDiscord | <Yardanico> with arc - 4.5k lines |
13:26:16 | FromDiscord | <Yardanico> with useMalloc on top of that - 2.6k lines |
13:26:25 | * | spiderstew joined #nim |
13:26:41 | FromDiscord | <Yardanico> the result for 2.6k lines - https://gist.github.com/Yardanico/65f192e6b861634bcdd275549ece06a7 |
13:26:44 | FromDiscord | <Goel> sent a code paste, see https://play.nim-lang.org/#ix=2Tpn |
13:26:54 | FromDiscord | <Yardanico> @Goel you're compiling from the wrong folder |
13:26:57 | FromDiscord | <Goel> (edit) "https://play.nim-lang.org/#ix=2Tpn" => "https://play.nim-lang.org/#ix=2Tpo" |
13:27:03 | FromDiscord | <Yardanico> you should compile from the root pixie folder, not from the "examples" folder |
13:28:10 | PMunch | Haha, well that's an easy way to annoy your TA and fail your assignment :P |
13:28:16 | FromDiscord | <Yardanico> nimbase diff https://gist.github.com/Yardanico/1d4170877f0d3c0c777cc0505742c5ae |
13:28:30 | FromDiscord | <Yardanico> (forgot to mention line 22, it's here though) |
13:28:47 | * | oprypin_ joined #nim |
13:29:09 | FromDiscord | <Yardanico> but still, it's cool that it works |
13:29:14 | FromDiscord | <Yardanico> need to try some more advanced programs |
13:29:15 | PMunch | Yeah, pretty neat |
13:29:38 | * | lritter quit (Ping timeout: 245 seconds) |
13:29:56 | PMunch | Hmm, so objects inherited from RootObj has run-time type information right? Any way to access that information? |
13:30:10 | FromDiscord | <Yardanico> https://nim-lang.org/docs/typeinfo.html |
13:32:12 | PMunch | Hmm |
13:33:52 | * | letto quit (*.net *.split) |
13:33:52 | * | spiderstew_ quit (*.net *.split) |
13:33:52 | * | FromGitter quit (*.net *.split) |
13:33:52 | * | oprypin quit (*.net *.split) |
13:34:14 | * | FromGitter joined #nim |
13:34:33 | FromDiscord | <Yardanico> HAHAHAHHA |
13:34:45 | FromDiscord | <Yardanico> i amalgamated the compiler itself |
13:34:51 | FromDiscord | <Yardanico> guess how many lines are in the amalgamated file |
13:35:00 | FromDiscord | <Yardanico> in a single C file for the whole compiler |
13:35:44 | FromDiscord | <clyybber> half a million? |
13:36:03 | FromDiscord | <Yardanico> HOW DID YOU GUESS THAT? |
13:36:05 | FromDiscord | <Yardanico> it's 504k |
13:36:17 | FromDiscord | <Yardanico> gcc surely took a long time to compile that |
13:36:27 | FromDiscord | <Gary M> Hey clyybber |
13:36:31 | FromDiscord | <clyybber> hey |
13:36:34 | FromDiscord | <Gary M> you seen the vulkan progress? |
13:36:45 | FromDiscord | <clyybber> oh, you drawn the monke right? |
13:36:49 | FromDiscord | <Gary M> ye |
13:36:51 | FromDiscord | <clyybber> pretty awesome |
13:36:58 | FromDiscord | <Gary M> I'm working on wrapping a C gltf importer now too. |
13:37:00 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2Tpv |
13:37:01 | FromDiscord | <Gary M> It's going really well |
13:37:13 | FromDiscord | <Goel> How much RAM does it need to open a single file of 21m? |
13:37:22 | FromDiscord | <Yardanico> @Goel who? |
13:37:26 | FromDiscord | <Gary M> we'll see if it's actually easy to parse into my Meshes or not yet but the wrapping is going well |
13:37:30 | FromDiscord | <Yardanico> the compiler does much more than just open a file |
13:37:32 | PMunch | Damn, that was a good guess! |
13:37:35 | FromDiscord | <Gary M> using c2nim |
13:37:40 | FromDiscord | <clyybber> nice |
13:37:47 | FromDiscord | <Yardanico> I had to patch 1 line in stdlib, that's all |
13:37:53 | FromDiscord | <Gary M> Question is, should a c type just be a single `ptr` in nim |
13:37:57 | FromDiscord | <Yardanico> make this branch false https://github.com/nim-lang/Nim/blob/version-1-4/lib/pure/hashes.nim#L99 |
13:37:58 | FromDiscord | <Goel> No i just on your system, to open a text file of 504k lines |
13:38:06 | FromDiscord | <Goel> (edit) "i just" => "I mean" |
13:38:07 | FromDiscord | <Yardanico> since cil doesn't seem to support uint128_t |
13:38:17 | PMunch | That's pretty damn cool |
13:38:21 | FromDiscord | <Yardanico> now lets try to compile the nim compiler from this compiled one |
13:38:23 | FromDiscord | <Yardanico> to see if it broke |
13:38:38 | PMunch | Oh you didn't actually try to compile it? |
13:38:43 | FromDiscord | <clyybber> PMunch, Yardanico: Heh, tbf I had something like that in the back of my mind, probably because I sometimes use git init/diff in the nimcache to debug compiler stuff |
13:38:54 | FromDiscord | <Yardanico> @PMunch nonono |
13:39:11 | FromDiscord | <Yardanico> I compiled it successfully, I want to see if the nim compiler from the amalgamation will be able to compile itself |
13:39:31 | FromDiscord | <Yardanico> `compiler/nim c -o:nim_test -d:danger compiler/nim.nim` |
13:39:34 | * | letto_ joined #nim |
13:39:52 | * | letto_ quit (*.net *.split) |
13:40:02 | FromDiscord | <Yardanico> it actually works |
13:40:09 | FromDiscord | <clyybber> nice haha |
13:40:10 | FromDiscord | <Yardanico> amazing |
13:40:22 | FromDiscord | <Yardanico> who wants nim compiler in a single, EASY TO DISTRIBUTE c file? |
13:40:25 | FromDiscord | <Gary M> `cgltf_node joints;` this is the c code being wrapped to nim which naively tried to do `ptr ptr cgltf_node` which is obviously invalid |
13:40:30 | FromDiscord | <Gary M> should it just be a single ptr |
13:40:34 | FromDiscord | <Yardanico> @Gary M why invalid? |
13:40:35 | FromDiscord | <Yardanico> this is valid |
13:40:38 | FromDiscord | <clyybber> In reply to @Yardanico "who wants nim compiler": compress it with a C uglifier |
13:40:40 | PMunch | Haha, I mean for what it's worth that is pretty cool |
13:40:51 | FromDiscord | <Yardanico> but it's probably a ptr ptr UncheckedArray[cgltf_node] |
13:41:00 | FromDiscord | <Gary M> oh it's valid? 😄 then something else wasn't parsed |
13:41:07 | FromDiscord | <Yardanico> @clyybber hm |
13:41:29 | FromDiscord | <Gary M> `typedef struct cgltf_node cgltf_node;` |
13:41:57 | FromDiscord | <Gary M> I remember wrapping something like that in Vulkan Memory Allocator |
13:42:35 | FromDiscord | <Yardanico> lol https://media.discordapp.net/attachments/371759389889003532/822465073682448494/unknown.png |
13:42:49 | FromDiscord | <Yardanico> (I remember dom had a project like that, didn't know it would pop up in google search) |
13:43:00 | FromDiscord | <Gary M> I think I literally just used a `pointer` for those typedef structs lol |
13:43:03 | * | letto_ joined #nim |
13:43:17 | FromDiscord | <Gary M> `ptr ptr pointer` sounds amazing |
13:43:30 | FromDiscord | <clyybber> In reply to @Yardanico "lol": haha nice, doesn't show up with ddg tho, so it's probably google knowing you are related to nim |
13:43:39 | FromDiscord | <Yardanico> 👀 |
13:43:48 | FromDiscord | <Yardanico> it shows up in DDG |
13:43:50 | FromDiscord | <Yardanico> just not at the top |
13:43:51 | FromDiscord | <Yardanico> but first page |
13:43:55 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/822465409227030658/unknown.png |
13:44:04 | FromDiscord | <Yardanico> 8th result |
13:44:11 | FromDiscord | <clyybber> oh |
13:44:58 | FromDiscord | <clyybber> should find one that has an option to make identifiers as short as possible |
13:45:03 | FromDiscord | <clyybber> as opposed to hashing them |
13:45:14 | FromDiscord | <Yardanico> i wonder if it's possible to do simple amalgamation by just merging files together |
13:45:17 | FromDiscord | <Yardanico> since nim has mangling by itself |
13:45:33 | FromDiscord | <clyybber> probably |
13:46:10 | * | superbia joined #nim |
13:46:10 | PMunch | Hmm, quite possible |
13:47:19 | FromDiscord | <Gary M> is there a way to get c2nim to convert snake_case to camel and pascal case? |
13:48:09 | FromDiscord | <clyybber> @Gary M nope, but I have this hack: perl -pi -e 's/(?<!")(VK|PFN)|\G_([[:alnum:]]+)/\1\L\u\2/g' $output #Convert snake case to camel case, but not in string literals: VK_SOME_THING -> VKSomeThing |
13:48:37 | FromDiscord | <Gary M> whoa that's some cursed regex |
13:48:40 | FromDiscord | <clyybber> yeah lol |
13:49:01 | FromDiscord | <clyybber> you wouldn't want to see what sed/perl shit my wrapper used to be built on |
13:49:08 | FromDiscord | <Gary M> I bet I could do this with nim lol |
13:49:12 | FromDiscord | <clyybber> that's why I switched to the xml generating approach |
13:54:20 | FromDiscord | <Yardanico> documented stuff in https://forum.nim-lang.org/t/7663#48655 |
13:54:25 | FromDiscord | <Yardanico> also there's a link if you want to download that C file |
13:54:32 | FromDiscord | <Yardanico> be careful though, it's 504k lines |
13:54:58 | FromDiscord | <Yardanico> I had to kill the VSCode C tokenizer extension process after opening the file because I didn't know that it would actually try to tokenize the file |
13:55:05 | FromDiscord | <Yardanico> it got to like 10GB RAM usage before I killed it |
13:58:30 | FromDiscord | <Yardanico> GCC compiles that file in 14.2 seconds on my machine and uses 678MB RAM |
13:58:33 | FromDiscord | <Yardanico> (max resident) |
13:59:52 | PMunch | Wait what?! Didn't ever consider that these can have multiple arguments: https://github.com/nim-lang/Nim/wiki/Lesser-known-Nim-features#python-style-indexing-operators-with-commas |
14:01:23 | FromDiscord | <Yardanico> XDDDD |
14:01:26 | FromDiscord | <Yardanico> :) |
14:06:23 | FromDiscord | <Gary M> so I can use strutils' `replace` but is there a way to make it capitalize the following char after the substring? |
14:06:30 | FromDiscord | <Gary M> or do I need to do things more manually |
14:07:44 | FromDiscord | <Seedofarson> man |
14:07:51 | FromDiscord | <Seedofarson> Nim is so often |
14:07:54 | FromDiscord | <Seedofarson> (edit) "often" => "awesome" |
14:08:31 | FromDiscord | <Seedofarson> the only drawback personally is the immaturity of the language, it seems entirely amazing though |
14:10:38 | FromDiscord | <Yardanico> guess I should finally make a real blog post on my forum, will do it about this amalgamation thing |
14:10:54 | FromDiscord | <Yardanico> (edit) "forum," => "blog," |
14:12:41 | * | azed joined #nim |
14:14:46 | FromDiscord | <InventorMatt> with the compiler all in one file could it then be converted into wasm and run directly in the browser? |
14:15:33 | * | lritter joined #nim |
14:16:01 | Prestige | @ElegantBeef are you around? I'm getting an error with nimscripter (just following the video on github), cannot open file: strutils |
14:16:05 | PMunch | Oh shit, that might possibly work.. |
14:16:30 | FromDiscord | <aryn> you can ping people from IRC? neat |
14:16:59 | Prestige | I have strutils in ./stdlib/pure/strutils.nim so idk what's wrong here |
14:17:13 | PMunch | Prestige, not sure how relevant it is to nimsripter but this might help: https://peterme.net/how-to-embed-nimscript-into-a-nim-program-embedding-nimscript-pt-2.html |
14:17:34 | PMunch | @aryn, yeah the bot is pretty clever :) |
14:23:29 | Prestige | aha, the stdlib directory has to be very particular.. |
14:24:12 | * | lritter quit (Ping timeout: 260 seconds) |
14:24:33 | PMunch | Well, it has to be the stdlib :P |
14:24:57 | Prestige | parts of it, and some parts can't be in directories |
14:25:11 | FromDiscord | <Seedofarson> what is nimscript? |
14:26:19 | PMunch | The subset of Nim that the compiler can run |
14:26:21 | FromDiscord | <hamidb80> does anyone here know `npeg`? |
14:26:24 | PMunch | Yes |
14:27:00 | PMunch | Pretty much the part of Nim that you can use an a macro or static procedures. It is also possible to import the Nim compiler into your own project and load NimScript from files on runtime. |
14:27:33 | PMunch | @hamidb80, that yes was for you by the way :P |
14:29:08 | Prestige | I don't think I'm going to get this working without input from Beef |
14:29:40 | PMunch | What's the issue? |
14:29:50 | PMunch | Still just not being able to load strutils? |
14:29:57 | saem | Hmm, for the single C file, I wonder if people are aiming for something like wherever there is an import treat it as an include and do that recursively. |
14:29:59 | FromDiscord | <hamidb80> i want to know the recursion level in `npeg`, is that possible? |
14:30:20 | Prestige | I got that part working PMunch but now his exportToScript pragma doesn't seem to be working |
14:30:34 | Prestige | just following the first example on the README |
14:30:38 | PMunch | @hamidb80, not without some trickery I think |
14:30:47 | PMunch | You can try to ping @Zevv |
14:31:05 | FromDiscord | <hamidb80> for example the recursion level of `(2)` ↵1 + (12 + `(2)` ) |
14:31:13 | FromDiscord | <hamidb80> is 2 |
14:31:38 | FromDiscord | <hamidb80> In reply to @PMunch "You can try to": ping by IRC? |
14:31:57 | PMunch | Just mentioning him does that, but he's not in here atm |
14:32:23 | FromDiscord | <hamidb80> ok tnx |
14:32:57 | FromDiscord | <hamidb80> another quesiton |
14:33:16 | FromDiscord | <hamidb80> can i have optional catures? |
14:33:21 | PMunch | Yes |
14:33:31 | FromDiscord | <hamidb80> like i wanna check is $1 exists or not |
14:33:42 | FromDiscord | <hamidb80> (edit) removed "is" |
14:33:59 | FromDiscord | <hamidb80> how? |
14:34:20 | FromDiscord | <hamidb80> (edit) "catures?" => "captures?" |
14:34:28 | FromDiscord | <Yardanico> did you see the npeg docs in readme ? |
14:34:35 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/822478160578871356/unknown.png |
14:34:37 | PMunch | Prestige, hmm I get /home/peter/.nimble/pkgs/nimscripter-0.1.0/nimscripter/nimscripter.nim(178, 9) Error: attempting to call undeclared routine: 'registerErrorHook' |
14:34:50 | FromDiscord | <Yardanico> you can check the length of the returned sequence |
14:35:05 | FromDiscord | <Yardanico> also don't forget that there's always $0 which is the full match of the current rule |
14:35:31 | FromDiscord | <hamidb80> In reply to @Yardanico "": no thats not the case |
14:35:35 | FromDiscord | <Yardanico> ?? |
14:35:37 | Prestige | I fixed it PMunch I needed -d:scripted even though I was already using -d:debugScript |
14:35:54 | FromDiscord | <hamidb80> In reply to @hamidb80 "like i wanna": i want this |
14:36:09 | FromDiscord | <Yardanico> yes, you will be able to do it with this |
14:36:17 | PMunch | Hmm, the docs for NimScripter could be better.. |
14:36:27 | PMunch | Prestige, what are you planning on using it for? |
14:36:38 | FromDiscord | <Yardanico> just check if len of the seq returned from captures is more than 1 ($0 which always exists, and $1, and possibly other captures) |
14:36:41 | saem | Righteous hacks |
14:36:43 | Prestige | An irc bot, hot reloading scripts (plugins) |
14:37:33 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2TpW |
14:37:35 | FromDiscord | <Yardanico> in npeg $0, $1, etc are just sugar for capture[i] |
14:37:58 | FromDiscord | <aryn> In reply to @PMunch "<@637032376731566082>, yeah the bot": nice |
14:38:04 | FromDiscord | <aryn> can you lot see replies aswell? |
14:38:11 | FromDiscord | <Yardanico> yes |
14:38:16 | FromDiscord | <aryn> nice |
14:38:21 | FromDiscord | <Yardanico> only a start of them though, since inserting the full original message wouldn't be very good |
14:38:28 | FromDiscord | <Yardanico> the bridge is https://github.com/Yardanico/ircord/ |
14:38:39 | FromDiscord | <aryn> oh you made it? lol |
14:38:54 | FromDiscord | <aryn> ah dimscord |
14:39:16 | FromDiscord | <aryn> is there not a seperate webhook lib? or is it all in dimscord |
14:39:25 | FromDiscord | <Yardanico> wdym "webhook lib"? |
14:39:35 | FromDiscord | <Yardanico> I don't use dimscord for webhooks at all, webhooks are just simple GET/POST requests |
14:39:43 | FromDiscord | <Gary M> if you want http requests that's in the nim libs |
14:39:59 | FromDiscord | <Gary M> async too |
14:40:05 | FromDiscord | <Yardanico> for IRC -> Discord you don't need dimscord, you only need webhoks, but for Discord -> IRC you need dimscord (or write your own Discord API library) |
14:40:07 | FromDiscord | <aryn> oh ofc, you need the bot to get the messages here |
14:40:11 | FromDiscord | <Yardanico> https://github.com/Yardanico/ircord/blob/master/src/ircord.nim#L43 |
14:41:22 | * | icebattle joined #nim |
14:43:42 | * | icebattle quit (Client Quit) |
14:44:02 | * | icebattle joined #nim |
14:45:57 | * | PMunch quit (Quit: leaving) |
14:47:50 | FromDiscord | <Gary M> what's the easiest way to parse cli args |
14:50:06 | leorize[m] | you use a parser like argparse or cligen |
14:50:06 | FromDiscord | <Gary M> or just one string arg 😄 |
14:51:07 | FromDiscord | <exelotl> For simple programs "parseopt" in the standard library is not so bad |
14:51:58 | FromDiscord | <exelotl> If you're looking to avoid dependencies |
14:52:12 | FromDiscord | <Gary M> I'm really just doing something quick and dirty |
14:54:33 | FromDiscord | <Gary M> so initOptParser then next() on it? |
14:56:40 | FromDiscord | <aryn> sent a code paste, see https://play.nim-lang.org/#ix=2Tq8 |
15:01:32 | FromDiscord | <exelotl> @Gary M here's how I use it: https://gist.github.com/exelotl/9789c77253db296f2622196ae991cf8f#file-gbafix-nim-L99 |
15:02:35 | FromDiscord | <aryn> the noval stuff is handy |
15:04:58 | Prestige | crap. I can't send objects to scripts with nimscripter |
15:05:54 | FromDiscord | <exelotl> sent a code paste, see https://play.nim-lang.org/#ix=2Tqi |
15:06:01 | FromDiscord | <aryn> i was just playing about with it |
15:06:08 | FromDiscord | <aryn> but yeah that could be handy |
15:06:18 | FromDiscord | <aryn> the doc mentioned the OS module aswell |
15:12:02 | * | superbia quit (Quit: WeeChat 3.1) |
15:28:08 | liblq-dev | any news on 1.6 progress? |
15:28:09 | * | Simon[m]4 joined #nim |
15:28:23 | FromDiscord | <Gary M> are enums idiomatically lowercase? |
15:28:52 | liblq-dev | @Gary they're camelCase, prefixed with an abbreviated name of the enum |
15:35:10 | FromDiscord | <Gary M> woo! |
15:35:16 | FromDiscord | <Gary M> another C lib wrapped |
15:36:33 | * | shmorgle quit (Ping timeout: 264 seconds) |
15:42:27 | * | icebattl1 joined #nim |
15:46:28 | * | icebattle quit (Ping timeout: 260 seconds) |
15:46:44 | FromDiscord | <Rika> congrats |
15:50:53 | FromDiscord | <aryn> what would the best way to approach regex in nim be? cursory google search brings up a few git repos but i'm not sure whats good and whats not |
15:52:07 | FromDiscord | <Kiloneie> @narimiran could you share my last video on nim_lang pretty please? I did @ mention |
15:53:08 | FromDiscord | <exelotl> In reply to @aryn "what would the best": this one is the best I think: https://github.com/nitely/nim-regex↵but I personally find it hard to figure out how to use it for basic tasks :( |
15:53:35 | FromDiscord | <aryn> yeah i saw that, although nimble didnt want to work. was complaining about SSL. so i grabbed the source but appear to be missing deps |
15:53:41 | FromDiscord | <aryn> >import pkg/unicodedb/properties↵↵is dead |
15:53:55 | FromDiscord | <exelotl> oh, hmm |
15:54:01 | FromDiscord | <aryn> wait i think i got tio |
15:54:04 | FromDiscord | <aryn> (edit) "tio" => "it" |
15:54:23 | FromDiscord | <aryn> ya, found the dep |
15:54:24 | narimiran | @Kiloneie sure, i thought giving it some more days in between |
15:54:28 | FromDiscord | <aryn> made by the same guy |
15:55:40 | FromDiscord | <exelotl> in the stdlib it's worth checking out https://nim-lang.org/docs/strscans.html and https://nim-lang.org/docs/pegs.html |
15:55:51 | FromDiscord | <exelotl> you can often use them instead of regex |
15:56:10 | FromDiscord | <aryn> its a fairly complex regex |
15:59:20 | Clonkk[m] | Is there any github actions wizard that could help me understand why executing tests github actions refuse to link properly (when locally it works) ? |
15:59:30 | Clonkk[m] | * Is there any github actions wizard that could help me understand why executing tests with github actions refuse to link properly (when locally it works) ? |
16:00:08 | * | zazi[m] quit (Quit: Idle for 30+ days) |
16:00:08 | * | Zoom[m] quit (Quit: Idle for 30+ days) |
16:00:50 | FromDiscord | <aryn> hm, on the regex lib i'm getting warns about IndexError being deprecated, anyone familiar with its replacement? |
16:00:59 | FromDiscord | <aryn> or should i ignore it |
16:04:14 | * | icebattle joined #nim |
16:04:55 | liblq-dev | IndexDefect |
16:05:08 | * | icebattl1 quit (Ping timeout: 260 seconds) |
16:05:27 | FromDiscord | <aryn> thank |
16:05:46 | FromDiscord | <aryn> (edit) "thank" => "thanks" |
16:07:33 | * | timdorohin joined #nim |
16:07:51 | * | haxscramper joined #nim |
16:17:42 | FromDiscord | <Yardanico> well, I finished writing the post about amalgamations |
16:17:46 | FromDiscord | <Yardanico> since my blog needs some posts at least |
16:17:49 | FromDiscord | <Yardanico> even if not that interesting |
16:25:03 | * | shmorgle joined #nim |
16:25:13 | FromDiscord | <Kiloneie> In reply to @narimiran "<@605421432083709952> sure, i thought": Not a bad idea, imma do a reupload today myself gotta add some pictures, also an excuse to bump myself again xD |
16:25:55 | FromDiscord | <Kiloneie> I thought that you forgot :P |
16:30:13 | FromDiscord | <Yardanico> https://zen.su/posts/amalgamating-nim-programs/ |
16:36:29 | * | superbia joined #nim |
16:50:07 | liblq-dev | yard please |
16:50:08 | * | liblq-dev uploaded an image: (6KiB) < https://matrix.org/_matrix/media/r0/download/gacko.pl/cfJxjDWlGbWnxbAcxoaLhJpL/image.png > |
16:50:19 | liblq-dev | i know you have better taste than using light fonts with small font sizes |
16:51:09 | FromDiscord | <Yardanico> wat |
16:51:13 | FromDiscord | <Yardanico> it looks fine for me 🤔 |
16:51:26 | liblq-dev | perhaps you're not using subpixel rgb rendering |
16:51:34 | FromDiscord | <Yardanico> which wont should I use? |
16:51:37 | FromDiscord | <Yardanico> (edit) "wont" => "font" |
16:51:52 | * | NimBot joined #nim |
16:52:00 | FromDiscord | <Yardanico> also does the actual page content look fine for you? |
16:52:02 | liblq-dev | i mean up the font weight |
16:52:03 | liblq-dev | with 300 it looks fine |
16:52:09 | liblq-dev | yeah |
16:52:11 | liblq-dev | just the headings |
16:52:50 | FromDiscord | <Yardanico> done |
16:53:07 | FromDiscord | <Yardanico> lemme reset the cache |
16:53:40 | FromDiscord | <Yardanico> done |
16:57:55 | FromDiscord | <Rika> thats better thanks |
16:58:21 | FromDiscord | <Yardanico> i guess I'll also post on dev.to with canonical url for better publicity: P |
16:58:23 | FromDiscord | <Yardanico> (edit) "publicity: P" => "publicity :P" |
17:04:29 | * | DaKnig[m] joined #nim |
17:04:51 | DaKnig[m] | does nim have C unions? |
17:05:12 | FromDiscord | <clyybber> yep |
17:05:24 | FromDiscord | <clyybber> we have {.union.} and case objects, which are tagged unions |
17:08:23 | DaKnig[m] | it would be useful if I end up writing an emulator in nim- for registers on x86-like architectures |
17:09:23 | FromDiscord | <Yardanico> the amalgamation seems to be pretty portable https://media.discordapp.net/attachments/371759389889003532/822517116015083520/unknown.png |
17:09:33 | FromDiscord | <Yardanico> testing on online compilers it works just fine with gcc 4.4.7 and clang 3.1 |
17:13:46 | * | Perkol joined #nim |
17:19:30 | FromDiscord | <Rika> 69 warnings |
17:19:42 | FromDiscord | <Yardanico> @Rika they don't affect anything |
17:19:49 | FromDiscord | <Yardanico> ah |
17:19:50 | FromDiscord | <Yardanico> nice :) |
17:19:56 | FromDiscord | <Yardanico> 🥴 |
17:30:05 | FromDiscord | <Rika> lmao |
17:32:48 | * | rockcavera quit (Remote host closed the connection) |
17:47:17 | * | superbia quit (Quit: WeeChat 3.1) |
17:50:09 | * | fredrikhr quit (Quit: Client Disconnecting) |
17:50:45 | FromDiscord | <Goel> sent a code paste, see https://play.nim-lang.org/#ix=2Trt |
17:52:44 | FromDiscord | <Hi02Hi> its an or for types, so this is a `Red8` or `Rg8` or ... |
17:52:56 | FromDiscord | <haxscramper> https://nim-lang.org/docs/manual.html#generics-type-classes |
18:12:52 | FromDiscord | <Seedofarson> is it possible to have a Nodejs/electron frontend and a Nim backend? |
18:12:53 | FromDiscord | <Seedofarson> Nim is a compiled language |
18:13:11 | FromDiscord | <Seedofarson> I cant just compile to JS cuz some modules wont work with compiling to JS |
18:13:38 | FromDiscord | <Yardanico> what do you mean by "Nodejs/electron"? |
18:13:44 | FromDiscord | <sealmove> You know there is a JS backend :ρ |
18:13:47 | FromDiscord | <Yardanico> you want to create GUI apps with Electron and Nim? |
18:13:53 | FromDiscord | <Yardanico> @sealmove "I cant just compile to JS cuz some modules wont work with compiling to JS" |
18:15:05 | FromDiscord | <Seedofarson> yeah |
18:15:13 | FromDiscord | <Seedofarson> I want to create a GUI app with electron and nim |
18:15:30 | FromDiscord | <Yardanico> well, then go ahead |
18:15:34 | FromDiscord | <Yardanico> there's nothing stopping you |
18:15:53 | FromDiscord | <Yardanico> learn how to do FFI in Electron, compile Nim part as a library, use it from Electron side |
18:16:04 | FromDiscord | <Yardanico> or you can also go the websockets/http/etc route |
18:18:47 | FromDiscord | <Seedofarson> In reply to @Yardanico "learn how to do": compile nim as a libary? |
18:18:50 | FromDiscord | <Yardanico> yes |
18:18:52 | FromDiscord | <Yardanico> --app:lib |
18:19:01 | FromDiscord | <Yardanico> or, if you go the websockets/http route, then as a normal program |
18:20:05 | FromDiscord | <Seedofarson> nim c --app:lib -d:ssl exmaple.nim |
18:25:40 | FromDiscord | <Seedofarson> omgggg |
18:25:43 | FromDiscord | <Seedofarson> thats so awesome |
18:31:16 | timdorohin | Seedofarson: WASM is always an option |
18:31:51 | * | icebattle quit (Read error: Connection reset by peer) |
18:32:04 | * | icebattle joined #nim |
18:34:48 | FromDiscord | <Seedofarson> web assembly?!? |
18:35:07 | FromDiscord | <Yardanico> yes?>!?!? |
18:35:40 | FromDiscord | <Seedofarson> can nim transpile to web assembly? |
18:35:47 | FromDiscord | <Seedofarson> (edit) "transpile" => "compile" |
18:36:44 | FromDiscord | <Yardanico> via emscripten or clang's wasm32 backend or nlvm's wasm32 target |
18:38:11 | FromDiscord | <Seedofarson> but |
18:38:19 | FromDiscord | <Seedofarson> wouldnt some modules not work |
18:38:23 | FromDiscord | <Seedofarson> cuz of C stuff? |
18:38:30 | FromDiscord | <Seedofarson> like the JS compiler |
18:38:39 | timdorohin | C compiles to WebAssembly |
18:39:38 | stefantalpalaru | Any idea what introduced "Error: unguarded access" for a bound template var, in version-1-4, but after 1.4.4 was tagged? |
18:41:17 | stefantalpalaru | This seems to have touched binding: https://github.com/nim-lang/Nim/commit/cf1ecee79419e532680ef01693c2ee7779e835c1 |
18:42:50 | FromDiscord | <Seedofarson> In reply to @timdorohin "C compiles to WebAssembly": I didnt think about this |
18:43:33 | FromDiscord | <Seedofarson> Nim ---> C |
18:43:39 | FromDiscord | <Seedofarson> C ----> webassembly |
18:43:44 | FromDiscord | <Seedofarson> C -----> golang |
18:43:48 | FromDiscord | <Yardanico> no |
18:43:50 | FromDiscord | <Seedofarson> C -----> Rust |
18:43:52 | FromDiscord | <Yardanico> again, no |
18:44:14 | FromDiscord | <Seedofarson> Nim --> C --> Webassembly? |
18:44:25 | FromDiscord | <Yardanico> also, deleting messages is useless since they've already been bridged and logged. and please try to not write too much short messages, instead make longer messages :) |
18:44:37 | FromDiscord | <Seedofarson> okay, sorry! |
18:48:00 | FromDiscord | <Seedofarson> @DefinitelyNotYardanico well why not? I suppose the compilers arent perfect, so, like, maybe something would get lost along the way? As far as I have experienced the nim --> C compiler has almost no limitations, so why when you get that C code could you not compile to WASM? no disrepect haha, just curious |
18:48:08 | FromDiscord | <haxscramper> In reply to @haxscramper "I have a small": @Seedofarson |
18:48:18 | FromDiscord | <Yardanico> @Seedofarson I replied to your "C -> Rust" and "C -> Go" |
18:48:53 | FromDiscord | <Yardanico> These make no real sense, however C -> WASM does and it already exists, and above I described the main 3 options you could use to use Nim for WASM - Emscripten, Clang's wasm32 backend, nlvm's wasm32 target |
18:49:07 | FromDiscord | <haxscramper> In reply to @haxscramper "<@!798398880584171530>": On compiling nim to wasm. As you can see even nim compiler itself (at least parser part) can be compiled to wasm and runs perfectly fine |
18:55:06 | FromDiscord | <Seedofarson> In reply to @Yardanico "These make no real": https://github.com/immunant/c2rust↵https://github.com/elliotchance/c2go↵https://github.com/yanghuan/CSharp.lua |
18:55:16 | FromDiscord | <Seedofarson> (edit) "https://github.com/immunant/c2rust↵https://github.com/elliotchance/c2go↵https://github.com/yanghuan/CSharp.lua" => "https://github.com/immunant/c2rust↵https://github.com/elliotchance/c2go↵https://github.com/yanghuan/CSharp.lua↵hmmm" |
18:55:25 | FromDiscord | <Seedofarson> (edit) "https://github.com/immunant/c2rust↵https://github.com/elliotchance/c2go↵https://github.com/yanghuan/CSharp.lua↵hmmm" => "https://github.com/immunant/c2rust↵https://github.com/elliotchance/c2go↵https://github.com/yanghuan/CSharp.lua↵idk" |
18:55:26 | FromDiscord | <Yardanico> and neither of them are actually complete |
18:55:57 | FromDiscord | <Yardanico> but really, we're not talking about them, we're talking about Nim -> WASM, not sure why you brought other languages up |
18:56:55 | FromDiscord | <Seedofarson> just curious to be honest |
18:57:05 | FromDiscord | <Seedofarson> if i am being annoying or anthing Its tottally fine and i will stop |
19:01:29 | FromDiscord | <Ayy Lmao> How can I read in a big endian uint16 from a string? |
19:05:37 | FromDiscord | <Ayy Lmao> I'm trying to port over this thing from Python and the code did `np.ndarray((1,), ">H", event_bytes, location)[0]` and I can't seem to find any similar way in Nim. |
19:06:03 | FromDiscord | <Yardanico> @Ayy Lmao https://nim-lang.org/docs/streams.html or https://github.com/treeform/flatty/blob/master/src/flatty/binny.nim |
19:06:55 | FromDiscord | <Yardanico> https://nim-lang.org/docs/endians.html https://github.com/status-im/nim-stew/blob/master/stew/endians2.nim |
19:07:03 | nisstyre | doesn't casting it require you know the cpu endianness? |
19:07:05 | nisstyre | for it to be correct? |
19:07:16 | FromDiscord | <Yardanico> you can just swap later |
19:07:19 | FromDiscord | <Yardanico> since the size is the same |
19:07:45 | FromDiscord | <Ayy Lmao> I will take a look at those links. Thanks! |
19:08:43 | nisstyre | I had done it this way before https://play.nim-lang.org/#ix=2TrW |
19:08:51 | nisstyre | probably not the most efficient though |
19:09:01 | FromDiscord | <Yardanico> @haxscramper me trying compiler as an api - eval nimscript https://media.discordapp.net/attachments/371759389889003532/822547225095045230/unknown.png |
19:09:12 | FromDiscord | <Yardanico> @nisstyre huh |
19:09:26 | FromDiscord | <Yardanico> you can just swap based on https://nim-lang.org/docs/system.html#Endianness |
19:09:42 | FromDiscord | <Yardanico> https://nim-lang.org/docs/system.html#cpuEndian |
19:09:43 | nisstyre | yeah that is probably more efficient |
19:09:48 | nisstyre | since if the architectures match it will be a noop |
19:10:36 | * | krux02 joined #nim |
19:10:47 | FromDiscord | <Yardanico> well you must do it that way |
19:11:01 | FromDiscord | <Yardanico> since if you try to swap a little-endian int on little-endian, you'll get incorrect results |
19:11:11 | nisstyre | true yeah |
19:11:14 | FromDiscord | <Yardanico> unless you only care about little endian :P |
19:11:16 | nisstyre | I just meant you won't have to swap anything |
19:11:29 | nisstyre | well usually it's big endian to little endian |
19:11:33 | FromDiscord | <Yardanico> i was referring to your code I mean |
19:11:38 | nisstyre | oh, yeah |
19:12:04 | nisstyre | the code that came from only cared about little endian |
19:13:04 | FromDiscord | <haxscramper> In reply to @Yardanico "<@!608382355454951435> me trying compiler": `make run` and then open `http://0.0.0.0:8000/main.html` |
19:13:18 | FromDiscord | <Yardanico> I'm trying out myself, not from your example :P |
19:13:41 | FromDiscord | <Yardanico> do you do anything special? |
19:13:42 | FromDiscord | <haxscramper> ah, well, then I can't say anything |
19:13:53 | FromDiscord | <haxscramper> what do you mean "special"? |
19:14:32 | FromDiscord | <Yardanico> yeah, sorry, I mean the parser might work |
19:14:35 | FromDiscord | <Yardanico> I was trying nimscript |
19:14:41 | FromDiscord | <Yardanico> and the browser tab just SIGSEGVs |
19:14:59 | FromDiscord | <Yardanico> i didn't ping you to ask for help, just to show :P |
19:15:06 | FromDiscord | <haxscramper> Ah, yes, I've just misunderstood. I though this thing doesn't even build for you |
19:15:15 | FromDiscord | <haxscramper> `s/thing/my example` |
19:16:08 | FromDiscord | <Yardanico> apparently in firefox it doesn't crash but there's out of bounds |
19:16:15 | FromDiscord | <Yardanico> anyway, nim compiler still has bugs when compiled with arc |
19:24:25 | Mister_Magister | Hi i want to iterate through a…z, A…Z, 0…9, i could use Letters and Digits from strutils but idk how to connect them |
19:25:00 | Mister_Magister | ah so + works |
19:25:03 | Mister_Magister | nice, nvm |
19:35:28 | jfondren[m] | yep, those are documented at https://nim-lang.org/docs/manual.html#types-set-type |
19:49:32 | Mister_Magister | how can i run httpclient post in thread? tried using spawn from threadpool but that closes connection for some reason |
19:53:35 | FromDiscord | <ElegantBeef> Prestige like i said you need to make your own stdlib and point the interpreter to it, i have an example version in the repo |
19:53:48 | Prestige | Yeah I got that bit working |
19:54:04 | FromDiscord | <ElegantBeef> So you resolved the strutils? |
19:54:10 | Prestige | I just had to mess with the structure of the directory, don't really know how it's trying to resolve modules |
19:54:26 | FromDiscord | <Yardanico> @Mister_Magister it should work just fine |
19:54:29 | FromDiscord | <Yardanico> threads don't affect it |
19:54:33 | Prestige | Yeah I had to pull everything from core and pure up a level |
19:54:34 | Mister_Magister | oh |
19:54:34 | FromDiscord | <ElegantBeef> Think it jusut needs all first level inside the stdlib folder |
19:54:45 | Mister_Magister | then maybe server rejects me lol |
19:54:46 | FromDiscord | <Yardanico> maybe the issue is something different? |
19:55:01 | Mister_Magister | well, it works without threads |
19:55:02 | Prestige | btw I wanna talk at some point about nimscripter if you have time |
19:55:02 | Mister_Magister | so idk |
19:56:37 | * | icebattle quit (Quit: leaving) |
20:00:36 | FromDiscord | <dom96> Miste_Magister: why do you need threads? 🙂 |
20:01:03 | Mister_Magister | @dom96 SPEED |
20:01:13 | Mister_Magister | btw, how do i get last letter of a string? |
20:01:18 | Mister_Magister | does it work like array? |
20:01:22 | FromDiscord | <ElegantBeef> I'll be back in a bit prestige and we can talk then |
20:01:26 | FromDiscord | <ElegantBeef> Yep `s[^1]` |
20:01:27 | Prestige | Kk thanks |
20:01:42 | Mister_Magister | thanks |
20:01:45 | Prestige | I'm still at work but I'll be free in an hour |
20:02:04 | FromDiscord | <dom96> Have you actually benchmarked it without threads to be too slow? Premature optimisation is the root of all evil you know 😛 |
20:03:06 | FromDiscord | <exelotl> https://twitter.com/pervognsen/status/1252736617510350848 |
20:04:21 | FromDiscord | <Livingstone> anyone got a code for checking run time on nim? |
20:04:33 | FromDiscord | <Yardanico> https://nim-lang.org/docs/monotimes.html |
20:05:15 | FromDiscord | <Yardanico> sent a code paste, see https://paste.rs/WdB |
20:06:06 | FromDiscord | <Yardanico> Although you might want to use libs like https://github.com/treeform/benchy for benchmarking |
20:19:30 | * | SebastianM joined #nim |
20:23:31 | * | gpanders quit (Ping timeout: 268 seconds) |
20:24:53 | * | gpanders joined #nim |
20:30:32 | * | narimiran quit (Ping timeout: 240 seconds) |
20:34:51 | * | fputs joined #nim |
20:36:06 | * | SebastianM quit (Quit: -a- Bye Bye) |
20:38:37 | FromDiscord | <Valor> did treeform wake up one day and be like |
20:38:45 | FromDiscord | <Valor> "Im just going to make an entire standard library" |
20:38:51 | FromDiscord | <Valor> "All on my own." |
20:39:37 | FromDiscord | <Yardanico> no, he is just making a big project :) |
20:39:41 | FromDiscord | <Yardanico> a lot of the libs are byproducts |
20:40:32 | FromDiscord | <Valor> oh |
20:50:20 | FromDiscord | <zidsal> sent a long message, see http://ix.io/2Tsy |
20:52:45 | * | Perkol quit (Quit: Leaving) |
20:56:15 | * | superbia joined #nim |
21:00:07 | * | jess is now known as JESS |
21:12:14 | * | JESS is now known as jess |
21:37:14 | * | haxscramper quit (Remote host closed the connection) |
21:37:38 | * | haxscramper joined #nim |
21:43:27 | * | haxscramper quit (Remote host closed the connection) |
21:51:38 | * | azed quit (Quit: WeeChat 3.0.1) |
21:54:16 | FromDiscord | <ElegantBeef> Hey prestige! |
21:55:47 | Prestige | Hey Beef, I'm about to eat but can we talk this evening? |
21:56:29 | FromDiscord | <ElegantBeef> I suppose |
21:56:44 | FromDiscord | <ElegantBeef> If i'm alive i'm reachable 😛 |
21:57:00 | FromDiscord | <ElegantBeef> The "benefits" of being a leach |
21:57:02 | FromDiscord | <ElegantBeef> (edit) "leach" => "leech" |
22:12:20 | * | NimBot joined #nim |
22:12:56 | * | nekits07 quit (Read error: Connection reset by peer) |
22:13:45 | * | teasea quit (Ping timeout: 264 seconds) |
22:14:03 | * | teasea joined #nim |
22:15:16 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2TsU |
22:15:46 | FromDiscord | <ElegantBeef> Making the `seq[seq[T]]` with the `: tuple` means any tuple can be placed at compile time and it'l work |
22:15:49 | FromDiscord | <ElegantBeef> (edit) "it'l" => "it'll" |
22:23:38 | FromDiscord | <ElegantBeef> @Casey.McMahon worth noting to make it less tedious to construct this simple procedure will work https://play.nim-lang.org/#ix=2TsY |
22:30:52 | FromDiscord | <Casey.McMahon> Ah, nice. Thanks for the assistance, ElegantBeef! |
22:32:10 | FromDiscord | <ElegantBeef> Also worth noting you can just use a `seq[T]` assuming each element is supposed to be a single pixel |
22:33:15 | FromDiscord | <ElegantBeef> I attempt to avoid nested collections, mostly cause it's rather easy to reason about it 1 dimensionally |
22:35:59 | * | superbia quit (Ping timeout: 260 seconds) |
22:39:43 | * | abm joined #nim |
22:39:57 | FromDiscord | <Casey.McMahon> I think I see what you mean, just read each row by using the image.width. |
22:46:59 | * | abm quit (Read error: Connection reset by peer) |
22:47:36 | FromDiscord | <ElegantBeef> Yep or height depending on how you want to index it |
23:28:29 | FromGitter | <redblack3_gitlab> Would be cool if `varargs[auto]` worked for procs: https://play.nim-lang.org/#ix=2Tt8. Crashes at the moment. |
23:31:28 | FromDiscord | <ElegantBeef> well that cannot be done, but you can do `varargs[T, operator]` like echo does `varargs[string, '$']` which invokes the operator on all passed in values if they arent string |
23:32:08 | FromGitter | <redblack3_gitlab> I saw you mention something about tuples and tried this: https://play.nim-lang.org/#ix=2Ttc. another cool trick. it compiles |
23:32:38 | FromDiscord | <ElegantBeef> Well yea cause it turns into `test(args: (int, int, string))` |
23:33:36 | FromDiscord | <ElegantBeef> Well you did find a bug with `varArgs[auto]` it does throw an internal error |
23:33:59 | FromDiscord | <ElegantBeef> Though auto is a shitty keyword and should only be used when absolutely required 😄 |
23:35:58 | FromGitter | <redblack3_gitlab> Ya agreed, very hard to read what a function does if u use it. I just use it with macros to avoid having to compute types that are passed around, so it's pretty useful there. |
23:50:48 | FromDiscord | <ShadowElf37> sent a code paste, see https://play.nim-lang.org/#ix=2Tti |
23:51:38 | FromDiscord | <ElegantBeef> Well give the code so we can reinstate the happiness |
23:52:22 | FromDiscord | <ElegantBeef> Unless that was sincerity and not sarcasm |
23:52:24 | FromDiscord | <ShadowElf37> sent a code paste, see https://play.nim-lang.org/#ix=2Ttj |
23:52:28 | FromDiscord | <ShadowElf37> it was 😉 |
23:52:45 | FromDiscord | <ShadowElf37> anyway is there a way to force X to be >3 |
23:52:55 | FromDiscord | <ShadowElf37> or would i have to limit that myself in newShape() |
23:53:03 | FromDiscord | <ElegantBeef> What is vector's typedef? |
23:53:18 | FromDiscord | <ShadowElf37> sent a code paste, see https://play.nim-lang.org/#ix=2Ttk |
23:53:19 | FromDiscord | <ShadowElf37> vector works fine |
23:54:14 | FromGitter | <bung87> Downloading Official package list ⏎ 9 ⏎ ⏎ ``` ... Could not download: No SSL/TLS CA certificates found.``` [https://gitter.im/nim-lang/Nim?at=605539a69ebdfd164086dbb7] |
23:54:26 | FromDiscord | <ElegantBeef> Windows? |
23:54:27 | FromGitter | <bung87> how to solve this on GitHub CI |
23:54:58 | FromGitter | <bung87> yeah, occurs on ci's windows |
23:55:42 | FromDiscord | <ElegantBeef> Wonder if it's the 1.4.4 fix for the openssl certs |
23:56:02 | FromDiscord | <ElegantBeef> https://forum.nim-lang.org/t/7551#48663 |
23:56:13 | FromDiscord | <ElegantBeef> Damn it linked the comment |
23:58:55 | FromDiscord | <ShadowElf37> sent a code paste, see https://play.nim-lang.org/#ix=2Ttn |
23:58:57 | FromGitter | <bung87> thanks, I think I need make ci allow fails on windows |
23:59:00 | FromDiscord | <ShadowElf37> so maybe the compiler hates .. in generics? |
23:59:11 | FromDiscord | <ElegantBeef> Well yea `3..high(int)` is a shortcut for range creation |
23:59:21 | FromDiscord | <ElegantBeef> Nah |