00:02:30 | FromGitter | <Varriount> Hm, anyone know how I would add a type pragma containing metadata information? |
00:09:46 | * | krux02 quit (Remote host closed the connection) |
00:34:25 | * | MyMind joined #nim |
00:35:02 | * | Sembei quit (Ping timeout: 265 seconds) |
00:49:06 | * | Jesin joined #nim |
00:50:54 | FromGitter | <krux02> @Varriount what do you mean? |
00:51:43 | FromGitter | <krux02> @Varriount I think in untyped macro arguments macro calls are preserved and can be used for metadata |
00:52:15 | FromGitter | <krux02> but a parma is not supposed to "survive" the compilation, pragmas are instructions for the compiler. |
00:57:49 | * | yglukhov quit (Read error: Connection reset by peer) |
00:58:32 | * | yglukhov joined #nim |
01:18:50 | * | NimBot joined #nim |
01:29:59 | FromGitter | <Varriount> @krux02 Would you know how to expand the macro of a template when calling another template? |
01:35:09 | * | Lord_Nightmare quit (Ping timeout: 264 seconds) |
01:38:45 | * | ftsf quit (Ping timeout: 265 seconds) |
01:39:34 | * | Lord_Nightmare joined #nim |
01:44:07 | FromDiscord | <jos> i wish c++ wasn't butthole |
01:44:10 | FromDiscord | <jos> wrong chat whoops haha |
01:45:01 | FromDiscord | <geckojsc> #relatable |
01:45:43 | FromDiscord | <jos> so something i have a bad habit of doing is building really robust metaprogramming things to make menial tasks less boring |
01:45:46 | FromDiscord | <jos> but it is a huge timesink in c++ |
01:46:07 | FromDiscord | <jos> in any other language with reasonable metaprogramming it's practical but in c++ it's always a shitfest, takes way too long, and has way too many compromises |
01:46:10 | FromDiscord | <jos> /end off topic |
01:51:56 | FromDiscord | <geckojsc> I'm still trying to get my head around Nim metaprogramming but it's really hard to know 1) what is possible and 2) how to do it (and those two things seem closely related when it comes to metaprogramming) |
01:54:46 | FromGitter | <Varriount> Metaprogramming in general tends to be a complex task, because languages tend to be very flexible (from a syntactic viewpoint) |
01:55:54 | FromDiscord | <jos> i think AST-based metaprogramming is ez |
01:56:00 | FromDiscord | <jos> template-based metaprogramming is horrific |
01:56:55 | FromGitter | <Varriount> template based from a C++ view? |
01:57:05 | FromGitter | <Varriount> Nim templates tend to be easier than Nim macros. |
01:58:19 | FromDiscord | <jos> i haven't seen another language that has template-based metaprogramming besides c++ |
01:58:24 | FromDiscord | <jos> there might be one but i've never hera of it |
01:58:36 | FromDiscord | <jos> besides nim after this google search |
01:59:02 | FromDiscord | <jos> except i'd hesitate to call them similar, really |
02:02:38 | FromDiscord | <geckojsc> I basically want to make a 2D game engine where all the boilerplate around defining game entities is handled by a macro or something. |
02:02:39 | FromDiscord | <geckojsc> That means all sorts of things like doing `entity Player` instead of `type Player = object of Entity`, automatically inserting {.self:this.} pragma, automatically inserting a call to self.physics.update() whenever you gave the entity a physics component (and the same goes for any other components besides physics) |
02:04:24 | FromDiscord | <geckojsc> I don't know if the `entity Player` thing is possible though, and I don't know if the other things I mentioned are easy or hard, or what's the best way to approach then |
02:09:59 | FromDiscord | <geckojsc> Oops it's {.this: self.} |
02:12:49 | FromDiscord | <jos> rust can do that |
02:12:54 | FromDiscord | <jos> nim can do that |
02:15:48 | FromDiscord | <geckojsc> That's reassuring to hear, I guess a good approach would be to make the engine without such macros and then try to introduce them once I have the basics already working |
02:18:20 | FromDiscord | <geckojsc> I just gotta make sure I don't build it in such a way that the macros are impossible? |
02:27:24 | * | Jesin quit (Remote host closed the connection) |
02:40:56 | * | bodie_ joined #nim |
02:43:02 | * | rockcavera joined #nim |
02:43:55 | FromGitter | <gogolxdong> How to set up a file upload server in Nim? |
02:54:11 | bodie_ | there's a discord right? |
02:54:15 | bodie_ | is that used much? |
02:55:18 | FromDiscord | <claude> its just a bridge to the IRC |
02:55:39 | FromDiscord | <claude> https://discord.gg/y5Y9DM |
02:56:57 | FromDiscord | <bodie> thanks |
03:10:48 | * | endragor joined #nim |
03:11:17 | FromDiscord | <2vg> @gogolxdong using jester (?) should not be so difficult |
03:26:26 | FromGitter | <AjBreidenbach> how to I escape `$` with `importc`? |
03:27:33 | FromGitter | <AjBreidenbach> I want to import a function with a dollar sign |
03:36:50 | FromGitter | <AjBreidenbach> nvm I think I got it |
03:37:04 | FromGitter | <gogolxdong> @2vg yes, just don't know how to save the post body into corresponding name.ext which generated by splitFile() ,there is only a post body right? where does the filename and extension lie? |
03:37:31 | FromGitter | <AjBreidenbach> it's a tuple I thought |
03:38:22 | FromGitter | <AjBreidenbach> it's got [dir, name, ext: string] |
03:39:21 | FromGitter | <gogolxdong> exactly, I mean can I just splitFile(request.body) to get this tuple. |
03:40:46 | FromGitter | <AjBreidenbach> it's a string right? |
03:40:49 | FromGitter | <gogolxdong> we are using a multi-thread async server. |
03:41:35 | FromGitter | <AjBreidenbach> idk what the contents of request.body are |
03:42:33 | FromGitter | <gogolxdong> which I don't know either, but I assume it can be generated like that. |
03:43:00 | FromDiscord | <2vg> need to understand the multi part form |
03:44:26 | FromDiscord | <2vg> Filename should be stored in the Content-Disposition header, filename filed. |
03:44:50 | * | athenot_ quit (Ping timeout: 276 seconds) |
04:01:57 | * | federico3 quit (Ping timeout: 260 seconds) |
04:02:07 | * | federico3 joined #nim |
04:04:51 | * | athenot joined #nim |
04:15:27 | * | miran joined #nim |
04:39:14 | * | user1101 quit (Quit: user1101) |
04:43:03 | * | user1101 joined #nim |
05:39:29 | * | miran quit (Ping timeout: 260 seconds) |
05:45:10 | * | nsf joined #nim |
05:54:39 | * | user1101 quit (Ping timeout: 260 seconds) |
05:55:46 | * | user1101 joined #nim |
06:06:41 | FromGitter | <Varriount> Argh, getCustomPragmaVal is being buggy. |
06:23:32 | * | rokups joined #nim |
06:25:04 | * | leorize joined #nim |
06:26:09 | * | cspar quit (Ping timeout: 260 seconds) |
06:26:57 | * | girvo quit (Ping timeout: 240 seconds) |
06:27:48 | * | girvo joined #nim |
06:47:45 | * | cspar joined #nim |
06:50:27 | FromGitter | <mratsim> well they were added/changed a week ago so ;) I raise a dasCustomPragma bug last week |
06:52:37 | FromGitter | <narimiran> can someone help me with BLAS on windows? |
06:53:09 | FromGitter | <narimiran> i'm trying to use Neo, but can't run my program because of missing BLAS |
06:54:27 | FromGitter | <narimiran> i've downloaded .dll and .lib from here: http://icl.cs.utk.edu/lapack-for-windows/lapack/#libraries_mingw and put it in the same folder where is my program |
06:55:11 | FromGitter | <narimiran> i compile it with `nim c --define:blas=libblas myProgram.nim`, but when i try to run it, i get: `could not load: libblas.dll` |
06:56:23 | FromGitter | <narimiran> that `define` is based on these instructions: https://github.com/unicredit/neo#linking-blas-and-lapack-implementations |
07:07:45 | * | nsf quit (Ping timeout: 248 seconds) |
07:10:29 | * | nsf joined #nim |
07:11:01 | FromGitter | <Varriount> @narimiran Is the built library in your PATH environment variable? |
07:12:00 | FromGitter | <narimiran> @Varriount i have tried putting libblas.dll both in the current folder and in the folder which is in the PATH |
07:12:38 | FromGitter | <Varriount> Hm, did you compile them for the right architecture? |
07:13:21 | FromGitter | <Varriount> The library (32 or 64 bit) needs to be loaded by a (32 or 64 bit) program respectively. |
07:13:32 | FromGitter | <narimiran> i just downloaded them from http://icl.cs.utk.edu/lapack-for-windows/lapack/#libraries |
07:13:47 | FromGitter | <Varriount> I've |
07:13:56 | FromGitter | <narimiran> my nim is 64-bit, so i've downloaded 64-bit version |
07:16:34 | FromGitter | <Varriount> @narimiran From the looks of that webpage, both 32 and 64 bit libraries are present. |
07:17:58 | * | Lord_Nightmare quit (Excess Flood) |
07:18:01 | FromGitter | <Varriount> You might give this a whirl: http://www.dependencywalker.com |
07:18:28 | FromGitter | <Varriount> If you open up the executable and libraries, it should be able to tell you the architecture of each |
07:18:30 | * | Lord_Nightmare joined #nim |
07:21:36 | FromGitter | <narimiran> thanks @Varriount! if i'm reading this correctly, i'm missing LIBGFORTRAN_64-3.DLL |
07:22:00 | FromGitter | <gogolxdong> @2vg We found Content-Disposition is in request.body which is a string, how to filter out the filename? |
07:23:02 | FromGitter | <narimiran> "Your application will also require the GNU runtime DLLs ( both libgfortran-3.dll and libgcc_s_dw2-1.dll are needed.) from MinGW to be available" |
07:23:37 | FromGitter | <narimiran> mingw is downloaded together in nim, but i guess it is not "publicly available" |
07:24:39 | FromGitter | <mratsim> @miran: https://github.com/mratsim/Arraymancer/blob/master/.appveyor.yml |
07:24:48 | FromGitter | <mratsim> this is my test suite for Windows |
07:25:59 | FromGitter | <mratsim> the BLAS package for nuget works |
07:26:15 | FromGitter | <mratsim> and you don’t need to compile it |
07:26:38 | FromGitter | <narimiran> @mratsim what's your recommendation? will installing arraymancer automatically install mingw/blas? :) |
07:26:59 | FromGitter | <mratsim> no, it won't |
07:27:01 | FromDiscord | <2vg> @gogolxdong There is a function to parse form-data in the utils module of jester, but you need to ping @dom96 |
07:27:21 | FromGitter | <narimiran> the problem is that i'm on a computer with no admin rights, so some simple(r) solutions are not available to me.... :( |
07:27:28 | FromGitter | <mratsim> but if you have NuGet, you can follow the exact same instructions as I use in Appveyor |
07:27:42 | FromGitter | <mratsim> nuget install OpenBLAS -o "${env:APPVEYOR_BUILD_FOLDER}" |
07:27:49 | FromGitter | <mratsim> cp OpenBLAS.0.2.14.1/lib/native/bin/x64/libopenblas.dll blas.dll |
07:27:51 | FromGitter | <mratsim> done |
07:28:19 | FromGitter | <mratsim> or just get the .nuget package on the web and extract it manually |
07:28:38 | FromGitter | <mratsim> it’s a weird .tar.something but you can do it. |
07:29:24 | FromGitter | <mratsim> Note how I can’t also test lapack from icl.cs.utk.edu ... |
07:30:15 | FromGitter | <narimiran> i downloaded nuget.exe, but it crashes immediately after i try to run it |
07:31:17 | FromGitter | <mratsim> I can’t help if windows tools developed by Microsoft are crashing on Windows :/ |
07:31:38 | FromGitter | <gogolxdong> @2vg yes,we didn't use jester , is there a parser in http stdlib? |
07:33:08 | FromGitter | <mratsim> side note @miran, I’m trying to put together a neural network DSL, like a hybrid bastard child of Keras + PyTorch but automatically inferring the intermediate output shape of each layers (Convolution, Dense) is hard! |
07:33:26 | * | PMunch joined #nim |
07:34:18 | FromGitter | <narimiran> if it was easy, it wouldn't be interesting :P |
07:34:39 | FromGitter | <narimiran> (that's what i keep telling myself while banging my head because of windows :P ) |
07:36:50 | FromGitter | <mratsim> I probably have to do some kind of finite state machine that tracks the input variable and the transformation that were done to them. |
07:37:08 | FromGitter | <mratsim> I don’t know what happen if I have z = merge(x, y) though |
07:37:38 | FromGitter | <mratsim> Maybe I should write a register based virtual machine :? |
07:38:06 | FromGitter | <narimiran> ok, i've made a step forward - downloaded openblas and that seems to work. now i have problems with LAPACK :D |
07:38:55 | FromGitter | <mratsim> I couldn’t make lapack work on Windows but I don’t have a Windows machine |
07:39:23 | FromGitter | <narimiran> @mratsim i'm not experienced enough to help you with that.... hopefully someone else might have some idea.... |
07:39:51 | * | yglukhov quit (Read error: Connection reset by peer) |
07:40:18 | FromGitter | <narimiran> this is my machine at work. at home on linux i had no problems whatsoever, of course.... |
07:40:26 | * | yglukhov joined #nim |
07:40:53 | FromDiscord | <2vg> @gogolxdong Probably not. However, writing a parser by yourself is not difficult. |
07:40:58 | * | flyx quit (Quit: ZNC - http://znc.in) |
07:45:13 | FromGitter | <narimiran> WOOOOO!!! IT WORKS!!!! |
07:45:23 | FromGitter | <narimiran> `--define:blas=libopenblas --define:lapack=libopenblas` |
07:47:08 | FromGitter | <JohnPeoplefox> Hi all! I am trying to display a simple IUP messagebox. Here is my code ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ The error I am getting is 'Error: expression 'message("Hello World 1", "Wello world from IUP!")' has no type (or is ambiguous)' [https://gitter.im/nim-lang/Nim?at=5add8f7c5f188ccc15931356] |
07:50:43 | PMunch | JohnPeoplefox, yeah it's telling you that iup.message doesn't return anything |
07:50:50 | PMunch | But you're trying to assign it to a variable |
07:53:20 | PMunch | You might be looking for messageDlg, which takes no arguments but returns an integer |
07:53:28 | PMunch | Err, a PIhandle |
07:54:02 | FromGitter | <JohnPeoplefox> Yay it works! Thanks a bunch! |
07:54:24 | FromGitter | <JohnPeoplefox> No I just removed the assignment |
07:55:07 | PMunch | Yeah but you're using it to position it, if you wanted to position it anywhere else you would need to use messageDlg and get a handle for it |
07:56:23 | FromGitter | <narimiran> now, is there a way to make those defines the default for this directory? e.g. if i do `nim c myProg.nim`, to translate it to `nim c --hints:off --verbosity:0 --define:blas=libopenblas --define:lapack=libopenblas myProg.nim`(cc @mratsim ) |
07:57:00 | FromGitter | <narimiran> oh, include `-d:release` too :) |
07:57:02 | FromGitter | <mratsim> @narimiran, use a nim.cfg |
07:57:29 | FromGitter | <narimiran> i have tried to see in the manual how to use .cfg but there's nothing about it.... |
07:57:36 | FromGitter | <mratsim> steal arraymancer's |
07:57:50 | FromGitter | <mratsim> the OpenBLAS from nuget can work as a Lapack lib? |
07:58:05 | FromGitter | <mratsim> is it named libopenblas.dll or blas.dll for you? |
07:58:30 | FromGitter | <narimiran> yeah, it seems it works (at least for my current use case). it is named `libopenblas.dll` |
07:58:37 | FromGitter | <mratsim> https://github.com/mratsim/Arraymancer/blob/master/nim.cfg#L58-L65 |
07:58:49 | FromGitter | <mratsim> seems like I need to fix the lapack part lol |
07:58:59 | FromGitter | <narimiran> i have been looking at arraymancer's .cfg even before i asked ;) |
08:00:08 | FromGitter | <narimiran> but i don't know the syntax needed... i guess i'll try to reverse-engineer yours :) |
08:06:24 | FromGitter | <narimiran> nope, can't just steal it and make it work.... :( |
08:15:21 | * | SenasOzys quit (Ping timeout: 264 seconds) |
08:26:40 | * | Vladar joined #nim |
08:51:50 | * | sendell joined #nim |
09:10:55 | * | Arrrr joined #nim |
09:35:26 | * | xet7 joined #nim |
09:40:52 | * | SenasOzys joined #nim |
09:44:07 | * | SenasOzys quit (Remote host closed the connection) |
09:52:38 | * | Vladar quit (Quit: Leaving) |
09:53:05 | * | Vladar joined #nim |
09:56:16 | * | SenasOzys joined #nim |
09:57:41 | * | yglukhov quit (Read error: Connection reset by peer) |
09:58:17 | * | yglukhov joined #nim |
09:59:46 | FromGitter | <Vindaar> @mratsim "automatically inferring the intermediate output shape of each layers (Convolution, Dense) is hard!" Haha, indeed. In the Theano code I use for my CNN stuff I managed it, but only specifically for LeNets w/ alternating conv and pooling layers. So I can imagine to get it working for a nice DSL is *hard* |
10:03:09 | * | dddddd joined #nim |
10:03:41 | * | yglukhov quit (Read error: Connection reset by peer) |
10:04:16 | * | yglukhov joined #nim |
10:05:53 | * | flyx joined #nim |
10:12:13 | * | leorize quit (Quit: WeeChat 2.1) |
10:18:04 | * | BitPuffin joined #nim |
10:42:11 | * | vantage joined #nim |
10:42:18 | * | vantage quit (Client Quit) |
10:42:53 | * | vantage joined #nim |
10:44:00 | * | vantage quit (Client Quit) |
10:44:27 | * | codevantage joined #nim |
10:44:33 | FromGitter | <mratsim> yeah especially if I have something that is supposed to interleave nicely with normal Nim. |
10:59:53 | codevantage | narimaran, look inside nim's config folder, you can basically just copy your settings in there |
11:01:47 | FromGitter | <narimiran> codevantage: i've tried to copy one part of it (`@if release or quick: ......`), and vscode has highlighted everything as an error.... |
11:02:23 | codevantage | did you install nim extension? |
11:02:47 | FromGitter | <narimiran> for vscode? yes |
11:03:07 | codevantage | is it called nim.cfg? |
11:03:17 | FromGitter | <narimiran> yes |
11:03:23 | codevantage | weird |
11:03:40 | codevantage | did you make a workspace? |
11:03:45 | codevantage | lol |
11:03:46 | FromGitter | <narimiran> yes |
11:04:14 | codevantage | whats the error |
11:06:13 | FromGitter | <narimiran> i just copied these 16 lines (from 55 to 70) and there are 53 errors highligted!! |
11:06:28 | FromGitter | <narimiran> https://github.com/nim-lang/Nim/blob/devel/config/nim.cfg#L55 |
11:07:43 | * | pigmej quit (Ping timeout: 265 seconds) |
11:08:25 | * | pigmej joined #nim |
11:08:41 | codevantage | it either works with false errors? |
11:09:44 | * | vegax87 quit (Ping timeout: 255 seconds) |
11:09:57 | * | cspar quit (Ping timeout: 263 seconds) |
11:10:41 | FromGitter | <narimiran> currently i have another, more important things to worry about, can't debug and/or reverse engineer this, sorry. (and this should be documented in the manual!) |
11:13:37 | * | pigmej quit (Ping timeout: 260 seconds) |
11:13:52 | * | pigmej joined #nim |
11:15:33 | FromGitter | <mratsim> false errors VScode does the same for me, @if is not proper cfg syntax |
11:17:20 | * | athenot quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
11:18:26 | codevantage | cfg has a syntax? |
11:18:33 | codevantage | since when? |
11:19:09 | Arrrr | since always |
11:19:47 | FromGitter | <mratsim> argh we can’t use methods at compile-time :/ https://github.com/nim-lang/Nim/issues/2574. |
11:20:09 | codevantage | yes |
11:20:20 | codevantage | cant you make a shadow proc? |
11:20:31 | FromGitter | <narimiran> wow, this indeed works regardless of all those errors (or "errors") |
11:20:59 | FromGitter | <mratsim> A shadow proc? I wanted to use inheritance within macro so that it can be user extended |
11:21:53 | * | pigmej quit (Ping timeout: 276 seconds) |
11:21:56 | codevantage | why you need a method? |
11:22:03 | codevantage | why not a proc? |
11:22:04 | * | rokups quit (Quit: Connection closed for inactivity) |
11:22:17 | FromGitter | <mratsim> you can have inheritance with a proc. |
11:22:19 | FromGitter | <mratsim> can’t* |
11:22:34 | * | pigmej joined #nim |
11:23:32 | FromGitter | <mratsim> I guess I will use object variants. |
11:23:36 | codevantage | make the first argument a 'type Type' type then its like a classmethod |
11:24:03 | Araq | hi codevantage, welcome |
11:24:23 | codevantage | still vantage |
11:24:29 | codevantage | hi |
11:25:11 | Araq | ah ok lol |
11:25:20 | FromGitter | <mratsim> That may work, have to fiddle a bit, because the type argument will be transformed into a NimNode (since I’m working at compile time) |
11:25:46 | FromGitter | <krux02> I think I will always remain krux02, even if people thing that I am 16 now. |
11:26:06 | * | vegax87 joined #nim |
11:26:08 | FromGitter | <alehander42> still better than alehander42 .. |
11:26:19 | FromGitter | <alehander42> a war veteran |
11:26:40 | FromGitter | <krux02> I use that name since the open beta of Ragnarök Online. |
11:27:02 | Arrrr | That weeb game? |
11:27:03 | FromGitter | <krux02> but back then it was just Krux |
11:27:09 | FromGitter | <krux02> weeb? |
11:27:16 | Araq | mratsim: for loop macros? |
11:27:26 | Arrrr | japanese game |
11:27:34 | FromGitter | <krux02> I think it's korean |
11:27:35 | FromGitter | <mratsim> Korean no? |
11:27:48 | Arrrr | korean, japanese .. |
11:28:09 | FromGitter | <mratsim> @Araq, not since Saturday. Didn’t check the example test yet |
11:28:20 | codevantage | krux02 https://m.9gag.com/gag/aPDKVEV/weeb-test |
11:28:26 | FromGitter | <mratsim> I’ll try in ~2 hours |
11:29:09 | * | vegax87 quit (Changing host) |
11:29:09 | * | vegax87 joined #nim |
11:29:09 | * | vegax87 quit (Changing host) |
11:29:09 | * | vegax87 joined #nim |
11:29:12 | Araq | jezz, what are you doing. sleeping? :P |
11:29:44 | FromGitter | <mratsim> Trying to find new static bugs, I feel like I have been slacking this week :D |
11:30:13 | Araq | can we remove static[T]? |
11:30:53 | FromGitter | <mratsim> I did find a “Cannot infer static parameter” yesterday but that completely blocked me and it seemed to hard to get a small test case |
11:31:03 | Araq | 3 is a value, range[0..2] is a type. |
11:31:05 | FromGitter | <krux02> Araq:what do you want to remove? |
11:31:17 | FromGitter | <krux02> I use static quite a lot |
11:31:24 | Araq | static[T]. I only see it used for arrays in objects |
11:31:45 | Araq | which is fine but it's already covered by Nim's range type. |
11:31:52 | FromGitter | <krux02> that is what I use it for in nim-glm |
11:32:11 | FromGitter | <krux02> N : static[int] |
11:32:15 | * | Arrrr quit (Ping timeout: 256 seconds) |
11:32:28 | FromGitter | <mratsim> I use static[bool] and static[enum] for compile-time dispatch too |
11:33:06 | Araq | yeah, but that's just bad. |
11:33:19 | FromGitter | <krux02> Araq, what is the alternative then? |
11:33:23 | Araq | could use a macro/template instead for these, no? |
11:33:41 | FromGitter | <mratsim> probably |
11:34:02 | FromGitter | <mratsim> Also in mpint I use Static[bits] to get the actual implementation of multi-precision integers: https://github.com/status-im/nim-mpint/blob/master/src/private/uint_type.nim#L99 |
11:34:22 | FromGitter | <krux02> https://github.com/krux02/nim-glm/blob/master/glm/vec.nim#L16 |
11:35:18 | Araq | yeah well, I don't really understand static[T] |
11:35:18 | FromGitter | <mratsim> But as long as we have a way for a type to carry compile-time only information (Phantom types/const integers?) I’m happy |
11:35:22 | FromGitter | <krux02> I am ok if static[int] goes away, if I get a suitable alternative that does basically the same |
11:36:11 | FromGitter | <krux02> well should I write some lines in the macro section about static arguments? |
11:36:18 | Araq | when I say "remove X" I usually mean "replace X by something better" |
11:36:37 | FromGitter | <krux02> that was is this "something better"? |
11:37:06 | FromGitter | <mratsim> ``` type Foo = object ⏎ bits {.compileOnly.} = int ⏎ data: array[bits div 8, byte]``` ⏎ ⏎ works for me [https://gitter.im/nim-lang/Nim?at=5addc562012ff2bf681eb4de] |
11:37:13 | Araq | I am not sure but the fact that 3 is of type int and yet should match static[int] even moreso deeply troubles me |
11:38:12 | Araq | it's like the 'const' design in C++ |
11:38:45 | Araq | when they added 'const', it was too late to make integer literals 'const' |
11:38:52 | FromGitter | <mratsim> Well if you replace by something better I’m all for it. |
11:39:14 | Araq | maybe let's start with the obvious |
11:39:24 | Araq | is it a type or a value? |
11:40:08 | FromGitter | <mratsim> it’s a compile-time only typed value. |
11:40:10 | FromGitter | <krux02> well I would say it is a value |
11:40:40 | Araq | well in the compiler it definitely is a type :P |
11:40:46 | * | Arrrr joined #nim |
11:40:46 | * | Arrrr quit (Changing host) |
11:40:46 | * | Arrrr joined #nim |
11:41:01 | Araq | it's a type that allows values to be passed to generics |
11:41:06 | FromGitter | <krux02> then the compiler is wrong :P |
11:41:24 | FromGitter | <krux02> I would say it's a compiler hack. |
11:41:50 | Araq | no I think it really is a type. |
11:41:59 | FromGitter | <mratsim> I think that was just piggybacking on how array are implemented |
11:42:04 | FromGitter | <krux02> I wouly say it's a generic argument |
11:42:18 | Araq | a generic argument in Nim is a type. |
11:42:30 | FromGitter | <krux02> well then maybe you need generic values? |
11:42:31 | codevantage | its the same as runtime only its used during compile time |
11:42:44 | Araq | it's called tyGenericParam |
11:43:02 | FromGitter | <mratsim> so a GenericParam is a type. |
11:43:11 | Araq | yes. |
11:43:23 | FromGitter | <mratsim> next question? |
11:44:45 | FromGitter | <krux02> well static[T] is for sure a bit awkward |
11:45:30 | Araq | actually there are 2 static[T] usages as I see it: |
11:45:43 | Araq | in generics to pass the buck onto 'array', eventually. |
11:45:58 | FromGitter | <krux02> but the core idea, that an argument has to be known at compile time, and each different argument spawns a new instance of tha procedure, is a very powerful mechanism in the compiler |
11:46:28 | Araq | that is covered 100% by the range type, albeit maybe the syntax is awkward and needs to be improved. |
11:46:43 | Araq | the other use case is what krux02 just described |
11:47:01 | FromGitter | <krux02> did I even tell you, that I hate the range type, and I would like to get rid of it? |
11:47:07 | FromGitter | <mratsim> range are runtime only though? |
11:47:10 | FromGitter | <krux02> it's just awkward. |
11:47:17 | Araq | turning procs into generating procs. |
11:47:27 | FromGitter | <mratsim> also you can’t take a subrange of a range :/ |
11:47:38 | Araq | ranges are awesome :P |
11:47:47 | FromGitter | <krux02> I want them to die |
11:48:13 | Araq | why? ok, they got bugs, but actually the bugs people stumble upon are not range-specific |
11:48:35 | * | SenasOzys quit (Read error: Connection reset by peer) |
11:48:36 | Araq | but instead specific to Nim's type constructors (which we really need to improve) |
11:48:41 | * | SenasOzys__ joined #nim |
11:48:52 | FromGitter | <mratsim> type ⏎ FooRange = range[-1’i16 .. high(int16)] ⏎ BarRange = range[FooRange(0) .. high(int16)] ⏎ ⏎ —> doesn’t work [https://gitter.im/nim-lang/Nim?at=5addc823012ff2bf681eb4ee] |
11:49:22 | FromGitter | <mratsim> anyway back to Static |
11:50:38 | Araq | well turning a proc into a generating proc has considerable overlap with templates |
11:52:24 | FromGitter | <data-man> Removing static [T] will break a large number of libraries. :( |
11:52:32 | FromGitter | <krux02> because I don't know what advantage they provide me. They look awward, they are wrong, because they have an excluding upper bound. They don't support `..<`, they don't work with double. |
11:52:48 | FromGitter | <krux02> I just want the range type to die |
11:53:07 | FromGitter | <krux02> it's just complexity without advantage |
11:53:29 | FromGitter | <krux02> arrays that don't start at 0, I don't want to support that |
11:53:53 | FromGitter | <krux02> I can simplify all usages of the range toye to a single integer. |
11:54:15 | FromGitter | <mratsim> that’s fine. I used array[‘0’..’F’, Register] just fine. |
11:54:25 | FromGitter | <krux02> sorry I mean they are wrong, because they have an inclusive upper bound. |
11:54:39 | FromGitter | <mratsim> and range cannot be passed to construct an array |
11:55:03 | Araq | yeah whatever. you will see the light when you use enums more which don't have a sentinel value. |
11:55:17 | Araq | a design that requires a sentinel value is backwards. |
11:55:26 | Arrrr | enums are overpowered in nim |
11:55:36 | FromGitter | <krux02> Araq: a range that doesn't support floating point values is useless to me |
11:55:39 | Araq | no matter how often you quote Dijkstra on this. |
11:55:48 | FromGitter | <mratsim> I think the current term is “imba” not “overpowered” ;) |
11:55:49 | FromGitter | <krux02> Araq: you will see the light if you have to use floating point numbers |
11:56:06 | FromGitter | <mratsim> I’d like ranges for floating point too |
11:56:06 | Araq | when I use floating point I'll make range work with them :P |
11:56:43 | FromGitter | <krux02> Araq: when you use floating point, you will realize that inclusive upper mounds are stupid |
11:56:46 | FromGitter | <mratsim> how about we tak about Static? no one uses range anyway |
11:57:19 | FromGitter | <mratsim> I did try to play with them but well …: https://github.com/mratsim/golem-prime/blob/77ab560191cccb7d07916958e25f9e8ff0847a31/src/datatypes.nim#L19-L24 |
11:57:27 | Araq | krux02: how so? why would I want 0.0 .. 1.9999999999 ? |
11:58:13 | Araq | mratsim: I understand what 'range' is, it's a subtype. |
11:58:20 | Araq | I don't understand static[T]. |
11:58:39 | Araq | and so I'd rather spend time on making range work well than on static T. |
11:59:22 | FromGitter | <mratsim> I think static has more value than ranges. Or karax for macro ;) |
11:59:23 | FromGitter | <krux02> first of all, I do understand `static[T]` and I need it. But I don't understand `range` it just occupies a name that otherwise could be used for ranges. |
11:59:32 | codevantage | araq, you mean that the programmers intention is not fully convetyed throough using static? |
11:59:55 | codevantage | maybe static should be a macro |
12:00:15 | FromGitter | <zacharycarter> what if we came up with another name for the current range and freed up range? |
12:00:17 | codevantage | static var : type |
12:00:41 | FromGitter | <zacharycarter> like scope or dimension or limits or something |
12:00:45 | Arrrr | I'm getting nervious, last time it happened before Araq killed my friend '<' |
12:00:54 | Araq | well there is definitely a design that unifies range[T] and static[T] making everybody happy. |
12:01:04 | Araq | we just need to find it :P |
12:01:35 | FromGitter | <mratsim> “There is definitely a way to combine AI and blockchain, making everyone billionaires, we just need to find it” ;) |
12:01:53 | Araq | lol |
12:02:14 | FromGitter | <krux02> I would be ok with the current implementation of `range`. But I would like to propose two change. 1. rename it to `InclusiveUpperBoundIntegerRange`, so that the name `range`cat at some point in the future be used fore more flexible ranges. And let arrays have an integer for their size. the array with InclusiveUpperBoundIntegerRange as index can be implemented in a module. |
12:02:42 | Araq | arrays do support an integer for their size. |
12:02:43 | FromGitter | <mratsim> flexible ranges can be called Spans like in C++17 |
12:03:02 | FromGitter | <alehander42> arrays starting from n are great, I was a skeptic, but they are useful |
12:03:09 | Araq | and InclusiveUpperBoundIntegerRange is wrong, it's not just for integers |
12:03:29 | * | athenot joined #nim |
12:04:21 | Araq | also 'inclusive' is the default in Nim anyway, because sentinels suck. |
12:04:35 | FromGitter | <mratsim> allowing ..< in ranges would be nice |
12:04:53 | Araq | wanted to support that |
12:04:59 | Araq | but it's complex to do. |
12:05:20 | Araq | because the compiler is in this section full of bullshit dealing with static[T]. |
12:05:23 | FromGitter | <mratsim> can’t we just transform in .. pred(foo) |
12:05:27 | FromGitter | <mratsim> ah |
12:05:56 | FromGitter | <krux02> Araq: and to come back tou your question why you would want ``[0|2[ ``. That range is easy to map to N equally sized bins, just do `floor(x*0.5*N)` and you have the zero based index, with inclusive upper bounds you think that it works, and it almost works, but with the probability of 2^-52 you make the program crash. |
12:07:28 | Araq | yeah, that escapes me. |
12:08:15 | FromGitter | <krux02> Tho probability of the crash depends on the precision of the float |
12:08:34 | FromGitter | <krux02> That use case is extremely common, two examples are rasterization and tesselation. |
12:08:55 | Araq | isn't that confusing 'real' with 'float' math? |
12:09:28 | FromGitter | <krux02> there is no `real` math |
12:09:37 | FromGitter | <krux02> on computers |
12:09:52 | Araq | yes. |
12:10:08 | FromGitter | <krux02> there is only symbolic transformations, float math, and other discrete data types. |
12:10:53 | FromGitter | <krux02> Rational is for example a useful datatype that uses two integers to represent a fraction precisely. |
12:11:22 | Araq | there is no exclusive upper bound. 0.0 ..< 1.0 is not "anything less than 1.0", it's 0.0 .. 1.0 - epsilon. |
12:11:35 | Araq | because it's floating point math. |
12:11:54 | Araq | for some epsilon I cannot write down. |
12:12:39 | FromGitter | <krux02> Araq you actually point out the exact reason, why you want exclusive uppor bounds. |
12:13:43 | FromGitter | <krux02> Araq: you can't specify epsilon, that is why you can't calculate the "inclusive" uppor bound. And that is why exclusive upper bound is just so much better to use. |
12:14:00 | FromGitter | <alehander42> for floats |
12:14:19 | FromGitter | <krux02> well for integers it is also nicer |
12:14:27 | FromGitter | <arnetheduck> Araq, conceptually, exclusive upper bound is a different thing than 1-epsilon for some specific type |
12:14:39 | FromGitter | <krux02> just think about it, how many elements are in a range from a to b? |
12:14:46 | FromGitter | <krux02> what is the distance from a to b |
12:15:07 | FromGitter | <krux02> wouldn't it be simpler if it would be just (b-a) instead of (b-a+1) |
12:15:18 | FromGitter | <krux02> this +1 is everywhere |
12:15:53 | FromGitter | <krux02> and easiliy forgotten to introduce bugs. |
12:17:35 | FromGitter | <krux02> and the absolute ridiculous range is the empty range |
12:17:41 | FromGitter | <krux02> 0 .. -1 |
12:17:49 | FromGitter | <krux02> wtf |
12:19:37 | FromGitter | <krux02> In my opinion all these special kinds of arrays should be in a module that is not in system: enumArray, IntegerRangeWithInclusiveUpperBoundsArray, etc. |
12:19:38 | FromGitter | <alehander42> oh 0 ..< 0 is so hard |
12:20:14 | FromGitter | <krux02> 0 ..< 0 is what I write, yes. but the raneg it constructs is [0,-1] |
12:20:21 | FromGitter | <krux02> that is the value |
12:20:43 | FromGitter | <krux02> exclusive uppor bound it would just be [0|0[ |
12:20:55 | FromGitter | <krux02> it is instantly visible that that thing is empty. |
12:21:07 | FromGitter | <krux02> it doesn't contait the 0 |
12:21:20 | FromGitter | <alehander42> so when I write for with exclusive range, I'll have to always do `a .. b + 1` ? |
12:21:35 | FromGitter | <alehander42> i've never looked at how does empty range look internally in my life |
12:21:51 | FromGitter | <krux02> @alehander42 well you should |
12:22:19 | FromGitter | <krux02> observe what your program is actually doing to understand it. |
12:22:31 | FromGitter | <alehander42> well it doesn't matter to me if internally it's [0, -1] or [0, 0 |
12:22:37 | FromGitter | <alehander42> it matters what api do i use |
12:22:39 | FromGitter | <krux02> well it does matter |
12:22:58 | FromGitter | <krux02> becaues 0 and -1 are the two bounds stored in the range |
12:23:04 | FromGitter | <krux02> and they are part of the API |
12:23:21 | FromGitter | <alehander42> and how often do you access them directly? |
12:23:35 | * | leorize joined #nim |
12:23:52 | FromGitter | <krux02> it is just that you can hide that ugly detail for a while and pretend it doesn't exist, but if you actually need the two bounds, then don't forget to always append a +1 to b |
12:24:05 | FromGitter | <krux02> @alehander42 often enough |
12:24:58 | * | jaco60 joined #nim |
12:25:17 | FromGitter | <krux02> I think I scared everybody away from this discussion. |
12:26:37 | FromGitter | <krux02> @alehander42 the internal structure of inclusive upper bounds for integer ranges prevents that the range type can easily be extended to also work for float types. |
12:26:50 | FromGitter | <krux02> that is what is bothing me about it. |
12:29:26 | Araq | there is no such thing. |
12:29:45 | FromGitter | <krux02> there is no what thing? |
12:29:47 | Araq | internally x - floatEpsilon is easy enough to use |
12:29:50 | FromGitter | <data-man> I like Boost.Interval https://www.boost.org/doc/libs/1_67_0/libs/numeric/interval/doc/interval.htm ⏎ ⏎ > An interval is a pair of numbers which represents all the numbers between these two. (Intervals are considered closed so the bounds are included.) The purpose of this library is to extend the usual arithmetic functions to intervals. These intervals will be written [a,b] to represent all the numbers between a |
12:29:50 | FromGitter | ... and b (included). a and b can be infinite (but they can not be the same infinite) and a ≤ b. |
12:30:39 | Araq | inclusive math is the nature of the machine. |
12:31:15 | Araq | exclusive upper bounds are fiction. |
12:31:37 | codevantage | is this philosophy? |
12:31:47 | FromGitter | <arnetheduck> the nature of the machine is that it offers both.. |
12:32:16 | Araq | no CPU I know of offers exclusive number types, arnetheduck |
12:32:20 | codevantage | hasnt someone else solved this before? |
12:33:15 | Araq | ok, high time we discuss something with more productive outcomes |
12:33:39 | codevantage | whats the agenda? |
12:34:00 | Araq | spring break |
12:34:31 | FromGitter | <arnetheduck> Araq, they offer greater or equal, or strictly greater operators.. |
12:34:33 | Araq | or spring-cleaning. |
12:34:46 | FromGitter | <arnetheduck> like exceptions? :) |
12:35:20 | shashlick | Araq has been killing issues like crazy! |
12:35:27 | codevantage | i havent heard any support for exceptions |
12:37:10 | Araq | exceptions are in JavaScript and C++, two of the languages we happen to target. |
12:37:35 | Araq | exceptions are faster than ifs sprinkled throughout the codebase |
12:38:14 | codevantage | i thought you wanted to remove exceptions? |
12:38:19 | Araq | when the 90% error handling case is "pass it upwards" then it makes perfect sense to make this the implicit behaviour. |
12:38:46 | Araq | codevantage: as I said, I want to replace it by something better. |
12:38:57 | Araq | and I haven't yet found this "better thing". |
12:39:04 | codevantage | ok |
12:39:44 | codevantage | raising is useful for other things too |
12:39:45 | FromGitter | <krux02> Araq: Well I like this error variable thing |
12:40:10 | codevantage | like if one proc might give numerous errors |
12:40:54 | Araq | krux02: that idea of mine is not even a long-term RFC yet |
12:42:39 | shashlick | I'm liking this issue closure fest |
12:42:55 | shashlick | What can we do to accelerate it |
12:43:41 | Araq | shashlick: fix bugs? |
12:44:42 | shashlick | Yep, can we make it something everyone focuses on for the next week or something? |
12:45:53 | FromGitter | <krux02> @alehander42: about the further development of ast-pattern-matching, you can work on it. |
12:47:13 | FromGitter | <krux02> But I think I change the way how strVal etc is matched, to make it generally more extendable to genaral object members. |
12:47:38 | Araq | RFC: pattern match all the things. |
12:47:53 | Araq | combine ast pattern matching with regexes and make it "consistent" |
12:48:09 | Araq | how? no idea but these things use the same name and so should be consistent. |
12:48:55 | Araq | why? because it makes things easier to learn. Proof? nah, we don't need no proofs. |
12:49:17 | FromGitter | <krux02> Araq: there are two minor things in the language that I would like to talk about |
12:49:41 | FromGitter | <krux02> the nodes for if as an expression and as a statement is different. |
12:49:51 | Araq | actually they aren't. |
12:50:09 | FromGitter | <krux02> well the node kind is a different one, and therefore they are different |
12:50:16 | Araq | they are pretty interchangeable |
12:50:28 | Araq | but yeah, these need to be merged completely. |
12:50:52 | Araq | could be tough for Karax though before we have "semityped" |
12:51:20 | Araq | but go on please. |
12:51:37 | * | simonsolnes quit (Ping timeout: 260 seconds) |
12:51:37 | FromGitter | <krux02> well for the of else brach this is not that case. |
12:52:08 | FromGitter | <krux02> I was thinking to also have it for that ast, so that I can use that information to generate code for a statement or code for an expression. |
12:52:34 | FromGitter | <krux02> but when the goal is to remove this distinction, then I think I have to find another way to distinguish this |
12:54:04 | FromGitter | <krux02> and the other one is, I would like to know if `noreturn` can be used a bit smarter in type inference of case-of and if-else expressions |
12:54:51 | FromGitter | <krux02> ``let myval = if world.isOk: "myValue" else: quit("The World is not OK!!!")`` should be possible. |
12:55:32 | FromGitter | <krux02> when a branch does not return, it's value should not matter for type inference |
12:56:01 | * | simonsolnes joined #nim |
12:56:20 | FromGitter | <alehander42> @krux02 great. what do you mean about strVal exactly? |
12:57:18 | FromGitter | <krux02> well currently when I have the pattern _(strVal = "abcdef") it generates `node.matchValue("abcdef")` and completely ignores the identifier `strVal` |
12:57:48 | FromGitter | <krux02> in other words ``_(integerValue = "abcdef")`` would be exactly identical |
12:58:23 | FromGitter | <krux02> I would like to use this identifier a bit more intelligently now. |
12:59:47 | FromGitter | <alehander42> ah of course |
13:00:15 | planetis[m] | hey! |
13:00:41 | FromGitter | <alehander42> well my idea was that you'd always use the particular field in those checks and you'll generate something like ⏎ `node.strVal == "acdef"` |
13:03:24 | Araq | krux02: that's been implemented |
13:03:36 | Araq | but maybe 'quit' needs a .noreturn annotation |
13:03:37 | * | xkapastel quit (Quit: Connection closed for inactivity) |
13:03:58 | FromGitter | <krux02> Araq: then why didn't it work when I tried to use it? |
13:05:09 | Araq | but maybe 'quit' needs a .noreturn annotation |
13:05:34 | Araq | anyway, Nim needs 2 things most urgently. |
13:05:47 | Araq | (aside from the v1 release, that is) |
13:05:52 | FromGitter | <krux02> I didn't use quit, I used stackTrace in the compiler, and I usded a longer case-of expression |
13:06:02 | Araq | 1. working symbol files. |
13:06:23 | Araq | 2. some sort of semi-typed. |
13:06:42 | FromGitter | <krux02> does 1. mean faster incremental compilation? |
13:06:48 | Araq | yes. |
13:06:53 | FromGitter | <krux02> yay |
13:07:16 | Araq | these 2 features are the big enablers for further language experiments / developments. |
13:07:21 | FromGitter | <alehander42> what are the blockers for incr compilation currently? |
13:07:54 | FromGitter | <krux02> @alehander42 I don't know the details, but afaik macros are evaluated on each compile |
13:07:56 | Araq | no more "but compile-times will suffer" arguments. |
13:08:03 | * | smt` joined #nim |
13:08:16 | FromGitter | <krux02> Araq: well that is not entirely true. |
13:08:38 | FromGitter | <krux02> compile times will still be very relevant |
13:08:38 | Araq | yes but then we can do meaningful measurements. |
13:08:48 | Araq | yes but then we can do meaningful measurements. |
13:09:03 | Araq | currently it's just pathetic, yes, every line you add increases compile-times. |
13:09:56 | FromGitter | <krux02> I already like a lot the the C compilation part is cashed pretty well |
13:10:04 | * | yglukhov_ joined #nim |
13:10:11 | * | yglukhov quit (Read error: Connection reset by peer) |
13:10:36 | FromGitter | <krux02> I think that is the part where most of the expensive optimization algorithms happen. |
13:10:59 | FromGitter | <krux02> but I is just an assumption not knowledge |
13:11:53 | FromGitter | <alehander42> so if you have a dependency graph of all your nim modules, you can load the cached ast/types for those which didn't change from those symbol files? |
13:11:57 | FromGitter | <alehander42> is that the plan @Araq ? |
13:12:01 | * | smt quit (Ping timeout: 248 seconds) |
13:12:05 | FromGitter | <krux02> And when the Nim compiler is a very fast "preprocessor" that compiles very fast, then this approach is not the worst. |
13:12:11 | FromGitter | <krux02> But I know that is not the case |
13:12:11 | Araq | alehander42: exactly. |
13:12:59 | FromGitter | <alehander42> nice, sounds reasonable, so is it just a TODO, or are there some complications |
13:13:19 | FromGitter | <krux02> will this also improve test performance? |
13:13:41 | Araq | yes, once we enable it out of the box. |
13:14:20 | Araq | well the involved internal refactorings are quite heavy, alehander42. |
13:14:59 | FromGitter | <mratsim> Is there a way to hash NimNodes so I can use a Table within macros? integers are cast to Hash but you can’t cast in the NimVM |
13:15:00 | FromGitter | <arnetheduck> Araq, given any thought on the intermediate AST? what it would look like? |
13:15:27 | FromGitter | <krux02> @mratsim I was able to has NimNode |
13:15:50 | planetis[m] | gitter -> IRC is not woking... |
13:15:53 | FromGitter | <krux02> and I already used Table in macros |
13:16:36 | Araq | arnetheduck: it will most likely be Node = object kids: seq[Node] # simplified. it will be a slow painful migration but all the aliasing bugs will go away. |
13:16:59 | FromGitter | <krux02> planetis[m]: that is not true otherwise I could not talk to Araq |
13:18:01 | FromGitter | <krux02> what do you mean by aliasing bugs? |
13:18:08 | FromGitter | <mratsim> @krux02 so what do you use? Otherwise I can probably convert to string and hash that. |
13:18:25 | Araq | mratsim: that's probably your best option for now |
13:19:04 | Araq | krux02: macros can construct acyclic graphs instead of trees |
13:19:23 | * | smt` quit (Read error: Connection reset by peer) |
13:19:32 | FromGitter | <krux02> Araq: well that is true, but it can be declared illegal |
13:19:39 | planetis[m] | well smth not working cause I can read people's messages :p |
13:20:01 | FromGitter | <krux02> wait, I construct acyclic graphs |
13:20:13 | FromGitter | <krux02> hmm, no it still needs to be supported |
13:20:24 | FromGitter | <krux02> I revert it can't be declared illegal. |
13:20:27 | FromGitter | <alehander42> @mratsim can't you generate unique short strings for literal nodes and just comb of kind + children's hashes recursively then? probably similar to repr anyway tho |
13:20:28 | * | smt joined #nim |
13:20:41 | Araq | and in the compiler we do wild node sharing too. Node = object kids: seq[Node] is the one way do enforce correctness |
13:21:26 | FromGitter | <krux02> `` var substitutionTable = newTableNimNode, NimNode ()`` |
13:21:40 | FromGitter | <krux02> is in my codebase (old codebase that I did not look into for almost a year |
13:21:45 | FromGitter | <mratsim> @alehander42 I only need to hash unique nnkIdent so I just put an assert to prevent hashing other kinds by mistake |
13:22:00 | FromGitter | <alehander42> ok then it's easy |
13:22:08 | FromGitter | <arnetheduck> Araq, why btw is it that some current nodes have sons and others have kind-specific fields? astnode instance memory footprint? |
13:22:45 | FromGitter | <alehander42> you'd need to make nimnodes generic to have int/string sons |
13:23:16 | * | smt quit (Read error: Connection reset by peer) |
13:23:16 | Araq | what do you mean? |
13:23:29 | FromGitter | <krux02> @alehander42 nope. there are literal nodes for that |
13:23:43 | * | smt joined #nim |
13:23:53 | FromGitter | <alehander42> @krux02 I know, I am explaining my theory why nodes have kind-specific fields |
13:24:10 | FromGitter | <alehander42> the literal nodes themselves have those intVal strVal etc |
13:24:21 | FromGitter | <krux02> because polymorphism |
13:24:23 | FromGitter | <arnetheduck> ``` ident*: PIdent ⏎ else: ⏎ sons*: TNodeSeq``` [https://gitter.im/nim-lang/Nim?at=5addde876d7e07082b2479d0] |
13:24:46 | FromGitter | <alehander42> ah ident |
13:24:52 | FromGitter | <arnetheduck> and so on for the other kinds.. |
13:25:13 | FromGitter | <krux02> leaf nodes have fields, all other nodes have children |
13:25:27 | FromGitter | <arnetheduck> ie a function call node has 7-8 "fields" but they're stuck in `sons` |
13:25:45 | FromGitter | <alehander42> all non-leaf nodes have sons |
13:25:47 | FromGitter | <arnetheduck> @krux02 if only it were that consistent ;) |
13:25:54 | FromGitter | <alehander42> it is entirely consistent |
13:26:14 | FromGitter | <krux02> well in the compiler it is a little bit messier |
13:26:15 | FromGitter | <alehander42> you either need NimNode[T]: .. sons: seq[T] |
13:26:30 | FromGitter | <alehander42> which I admit might make sense, but probably not in the beginning |
13:26:45 | FromGitter | <krux02> I made the view on the Nodes from the macros module a bit cleaner, but compiler intern there are still symbol objects and stuff |
13:26:50 | FromGitter | <arnetheduck> I'm talking compiler here, not macros |
13:26:51 | FromGitter | <alehander42> or you need to add fields for everything, which isn't great with nim variants |
13:26:55 | FromGitter | <krux02> and maybe compiler intern that makes all sense |
13:27:00 | FromGitter | <krux02> but not in the macros module |
13:27:28 | * | smt` joined #nim |
13:27:44 | * | smt quit (Read error: Connection reset by peer) |
13:27:57 | FromGitter | <alehander42> and also you still need to iterate in order which I am not sure if it's possible with branch fields and metaprogr |
13:28:29 | Araq | you can't use generics here, it requires runtime polymorphism |
13:28:52 | FromGitter | <alehander42> so then having accessors for some `sons[index]` would be probably the best compromise |
13:29:02 | FromGitter | <krux02> Araq: It is compile time polymorphism ;) |
13:29:19 | Araq | krux02: in the compiler that's runtime. |
13:29:46 | * | smt` is now known as smt |
13:29:55 | Araq | Nim's compiletime is the compiler's runtime. <-- put this on a T-shirts |
13:29:56 | FromGitter | <krux02> I know, but it is still at compile time |
13:30:47 | FromGitter | <krux02> There were some Nim merch stuff to buy, I think i am too late for that, am I? |
13:30:52 | FromGitter | <mratsim> Nim compile-time static are Nim macro runtime :P |
13:31:50 | * | flyx quit (Quit: ZNC - http://znc.in) |
13:32:08 | FromGitter | <krux02> in static blocks you can mutate compile time switches |
13:32:25 | Araq | alehander42: accessors would have been a good idea, yeah |
13:32:35 | FromGitter | <krux02> mete programming really is the key selling point for Nim, and that is how it should be advertised. |
13:33:07 | FromGitter | <krux02> meta programming alone is not enough. That is already possible in lisp |
13:33:12 | FromGitter | <alehander42> @Araq well it's still your idea , you showed me macro nimnode accessors for one PR :D |
13:34:09 | FromGitter | <krux02> but the compination of the powerful features of c++, plus metaprogramming, plus a much better compilation model makes it just a much better language (for me). |
13:34:25 | FromGitter | <krux02> Also key selling point is interoparability |
13:34:34 | * | noonien joined #nim |
13:35:47 | FromGitter | <krux02> I haven't done it, but I think a showing people a rust imported module that just allows to import rust packages would be funny. And I think that is possible. |
13:36:15 | codevantage | nice |
13:37:54 | FromGitter | <arnetheduck> > so then having accessors for some `sons[index]` would be probably the best compromise ⏎ that's so hard to find though, when browsing for it |
13:38:42 | FromGitter | <arnetheduck> and as far as macros go, while they're cool and all, they also hurt code readability and predictability badly.. |
13:39:24 | FromGitter | <alehander42> well every powerful feature needs use in moderation |
13:39:49 | FromGitter | <krux02> @alehander42 with power comes resposibility. |
13:39:52 | Araq | just show the AST after the expansions, you argue for better editor integration all day long anyway |
13:40:16 | FromGitter | <krux02> I don't recommend a programming stley that sprinkles little macros everywhere in the codebase |
13:40:44 | Araq | and "predictability" doesn't mean much in a world where a[i] can take 4 cycles or 100. |
13:41:18 | FromGitter | <krux02> I think marcos are required to be documented well. |
13:41:27 | Araq | it's a word for C programmers so they can pretend they have an argument. |
13:41:44 | FromGitter | <krux02> C programming is all fine. |
13:41:57 | FromGitter | <alehander42> yep, I was guilty of that sometimes ⏎ now I try to either: work on macros if they're general purpose enough or macros which might be used less but it's very obvious what they do |
13:42:07 | FromGitter | <krux02> There are just some areas where I would not recommend to use anything else. |
13:43:14 | Araq | C -- the only thing that is convenient is the builtin stuff, every builtin feature comes with undefined behaviour. it's just a bad language. |
13:43:56 | Araq | people who argue for C want Modula 2 instead, it's just that they don't know Modula 2. |
13:44:10 | FromGitter | <krux02> I don't know Modula 2. |
13:44:16 | Araq | I know. |
13:44:17 | FromGitter | <krux02> I know C though. |
13:44:24 | FromGitter | <arnetheduck> predictability as in when I do a, b is likely going to happen, I'm not even talking performance here.. just the amount of places I have to look and the amount of mental stretching I have to do to understand that relationship |
13:44:41 | codevantage | when i saw c i wanted the bracket, and semicolon removed and types, and not having to prefix everything |
13:45:04 | FromGitter | <arnetheduck> the hammer and nail syndrome? :) |
13:45:06 | FromGitter | <krux02> Still I would not recommend anything else than C for microcontroller programming |
13:45:53 | Araq | I would recommend C++ or Rust if you feel Nim is too immature for it. |
13:45:59 | FromGitter | <krux02> I stull miss the {} in Nim |
13:46:38 | Araq | I would never use C for anything, it's just bad. |
13:46:59 | codevantage | i dont mind brackets, but indentation must be enforced |
13:47:15 | FromGitter | <krux02> I was so spoild by gofmt and clang-format to do all my indentation for me and then all of a sudden the indentation is semantic :/ |
13:48:01 | Araq | arnetheduck: ever seen C code full of function calls? I see it everywhere. what's predictable about it. and technically the function calls could even be macro calls. |
13:48:40 | FromGitter | <krux02> Araq: It is predictable that C code has cryptic function names. |
13:48:49 | FromGitter | <arnetheduck> I'm not saying C is good at this - I'm challenging Nim to be better |
13:49:10 | FromGitter | <krux02> but that has nothing to do with the language but with the people who came up with those names and the people who thought to stick to the syle of making function names cryptic. |
13:49:41 | * | SenasOzys__ quit (Remote host closed the connection) |
13:50:32 | FromGitter | <krux02> You won't change my mind. I still like C. I would also not want to write big projects in it. And I know it's weaknesses, but I will not dismiss all the work that has been put into the language C. |
13:50:38 | * | SenasOzys joined #nim |
13:50:59 | FromGitter | <arnetheduck> it has everything to do with the language - which features you promote and make convenient.. ie Nim adding `func` as a keyword gives me a pretty strong guarantee that all I need to do about the function is in the declarations (assuming of course `func` implies `noexcept`) |
13:51:30 | FromGitter | <krux02> The resources to learn the language, the simplicity of it's core features, and the compiler extensions to support all kinds of hardware features |
13:52:23 | Araq | C's simplicity is an illusion cause by insufficient knowledge of C. |
13:52:56 | codevantage | araq c without macros? |
13:53:00 | Araq | you can't even memcpy structs because they are allowed to have non-accessible holes by the spec. |
13:54:11 | FromGitter | <krux02> well I know c++ now for 16 years. I learned C afterwards. And it really misses some core features such as appendable arrays. |
13:54:29 | FromGitter | <krux02> I think c++ is the beast. |
13:54:31 | Araq | and I don't care if I change your opinion on C. it's objectively a bad language, made bearable by the people who actively produce tools for it that ignore the spec. |
13:55:02 | Araq | like coming up with sanitizers for it. |
13:55:12 | FromGitter | <krux02> well the discussion is pointless anyway, it's not like there is anything based on the outcome |
13:55:13 | * | simonsolnes quit (Ping timeout: 248 seconds) |
13:56:30 | FromGitter | <krux02> Araq: I have a killer argument, why C is a great Language that will even convince you. |
13:56:51 | Araq | challenge accepted. |
13:57:56 | FromGitter | <krux02> C has been chosen as the main compilation backend for the Nim programming language, even when every programming language in the world, even assembler or machine code, could have been chosen. |
13:58:48 | Araq | yeah and even as a compiler backend language it is really error prone. |
13:59:11 | FromGitter | <krux02> you could have chosen another backend language |
13:59:16 | FromGitter | <krux02> for example Modula 2 |
13:59:20 | FromGitter | <krux02> you didn't |
13:59:22 | codevantage | llvm? |
13:59:53 | FromGitter | <krux02> codevantage: I think llvm did not exist in it's current state when Nim was initially developed. |
13:59:59 | Araq | check out the commits that changed sizeof(*result) to sizeof(typeof(*result)) (roughly speaking) |
14:00:15 | codevantage | krux oh i forgot |
14:00:24 | Araq | and then come back and tell me about C's virtues. |
14:00:51 | FromGitter | <krux02> Araq: shouldn't that be identical? |
14:01:03 | Araq | heck yes, LLVM's IR is easier to use for human beings than C is. |
14:01:05 | codevantage | araq does nim count as a c sanatizer? |
14:01:41 | Araq | krux02: they are not. |
14:01:45 | FromGitter | <krux02> Araq: the problem is that LLVM's IR has only one backend, and that is LLVM |
14:02:07 | codevantage | llvm is being actively developed |
14:02:26 | FromGitter | <krux02> codevantage: that is not the point/argument |
14:02:46 | * | leorize quit (Ping timeout: 264 seconds) |
14:03:08 | codevantage | so using c is more portable? |
14:03:11 | FromGitter | <krux02> the point is that C can be compiled to Amiga, Dos, ..., PlayStation 3, IBM Mainframes, etc |
14:03:29 | federico3 | ...and microcontrollers |
14:03:43 | FromGitter | <krux02> LLVM can be compiled to ARM and x86 |
14:03:46 | FromGitter | <krux02> I think |
14:04:29 | FromGitter | <krux02> those legacy systems are for most people not really an argument anymore, but for some. |
14:04:53 | codevantage | cant llvm also do that? |
14:04:54 | FromGitter | <krux02> And they are the past. |
14:05:14 | FromGitter | <krux02> codevantage: I don't know |
14:05:22 | federico3 | codevantage: no |
14:05:34 | codevantage | well thats not good |
14:06:26 | codevantage | but maybe it might be better for nim to be less dependant on c? |
14:06:30 | * | rokups joined #nim |
14:06:59 | FromGitter | <krux02> From what I heared from experienced developers, llvm is gread for development, because of sane error messages (as sane as you can get with c++). But for release builts other compilers are just better. |
14:07:01 | codevantage | less magic and importc in builtin |
14:07:08 | FromGitter | <krux02> for example the intel compiler |
14:11:44 | * | miran joined #nim |
14:12:33 | skelett | krux02: they _really_ have awesome error messages |
14:13:51 | * | simonsolnes joined #nim |
14:14:06 | Araq | krux02: well I can like C's tooling/compilers and can try to take advantage of them and loathe C at the same time. And that's exactly what is the case here. |
14:14:50 | * | flyx joined #nim |
14:15:05 | * | rockcavera quit (Ping timeout: 256 seconds) |
14:16:49 | FromGitter | <krux02> I did not live when C was invented. But I think at some point it was made an industry standard, and from that poin onwards the deprecation path for wrong design decisions became a bit complicated. |
14:17:00 | codevantage | maybe one day nim will be the new c |
14:17:05 | codevantage | but not |
14:17:17 | codevantage | u know what i mean |
14:18:49 | FromGitter | <krux02> no |
14:18:53 | FromGitter | <dom96> yay Araq still sees the value in exceptions |
14:19:37 | FromGitter | <krux02> i dont see value in exceptions |
14:19:40 | FromGitter | <dom96> I actually really like how he's explained their purpose |
14:19:52 | FromGitter | <dom96> For reference: https://irclogs.nim-lang.org/23-04-2018.html#12:38:19 |
14:21:20 | FromGitter | <dom96> He also says symbol files are urgent |
14:21:23 | FromGitter | <dom96> I disagree |
14:21:44 | FromGitter | <dom96> This can be done after v1 |
14:23:09 | FromGitter | <krux02> I like symbol files. |
14:23:17 | FromGitter | <krux02> Makes development on the compiler easier. |
14:23:47 | FromGitter | <krux02> It improves the quality of life not just for the core Nim programmers, but also of the entire Nim community. |
14:25:45 | Araq | dom96: well they are mostly orthogonal to v1, unless we take advantage of them to turn more features into macro based implementation. |
14:25:47 | * | leorize joined #nim |
14:27:01 | Araq | then there will be arguments like "but builtin is faster to compile" ;-) |
14:46:59 | FromGitter | <krux02> I like macro based implementations. They are easier to develop. |
14:48:05 | Araq | symbol files are also our ticket to get a better VM. |
14:48:54 | Araq | compile the Nim macro snippet to native code and staticExec() it. |
14:49:13 | Araq | if that process is cached it will be fast enough |
14:49:49 | Araq | and the friction between compiletime and runtime will be mitigated. |
14:50:19 | FromGitter | <dom96> huh, won't that also enable FFI at compile-time? |
14:50:41 | Araq | yes. |
14:52:29 | * | Arrrr quit (Ping timeout: 260 seconds) |
14:53:17 | * | rockcavera joined #nim |
14:57:30 | * | endragor quit (Remote host closed the connection) |
14:58:29 | FromGitter | <krux02> Araq: I wonder how this macro to native code path will look like, because currently there is a clear distinction between C code generation and C code compilation |
14:58:51 | FromGitter | <krux02> especially in use cases where a macro generates code for another macro, for example in ast-pattern-matching |
15:02:18 | * | Arrrr joined #nim |
15:02:18 | * | Arrrr quit (Changing host) |
15:02:18 | * | Arrrr joined #nim |
15:06:00 | Araq | it will just work(TM) of course. |
15:06:05 | Araq | with magic. |
15:06:08 | Araq | ;-) |
15:06:24 | codevantage | controlled magic |
15:07:06 | * | nixfreak joined #nim |
15:09:53 | * | Arrrr quit (Ping timeout: 248 seconds) |
15:10:34 | FromGitter | <krux02> Araq: I know what "magic" in Nim means. It means it is implemented at an undefined location, good luck finding it. |
15:11:56 | codevantage | or implemented in several scattered locations |
15:12:23 | * | endragor joined #nim |
15:13:41 | codevantage | can we add this guide to the docs? https://gist.github.com/zacharycarter/846869eb3423e20af04dea226b65c18f#credits |
15:16:27 | * | endragor quit (Ping timeout: 240 seconds) |
15:16:29 | * | athenot quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
15:19:03 | FromGitter | <Varriount> Araq: What is a nnkHiddenDeref? |
15:19:25 | Araq | a hidden dereference operation |
15:20:07 | Araq | you wrote 'x = 1' and the compiler transformed it into 'x[] = 1' |
15:20:55 | FromGitter | <Varriount> Hm, well getCustomPragmaVal is coming on them. |
15:21:19 | FromGitter | <Varriount> I'll see if I can find out why |
15:23:45 | FromGitter | <Varriount> *complaining about them |
15:24:18 | * | CodeVantage_ joined #nim |
15:28:32 | * | Arrrr joined #nim |
15:28:32 | * | Arrrr quit (Changing host) |
15:28:32 | * | Arrrr joined #nim |
15:30:24 | * | leorize quit (Ping timeout: 260 seconds) |
15:31:30 | * | Trustable joined #nim |
15:40:05 | Araq | krux02: since you know how grepping for magics works you can't be serious. |
15:40:39 | Araq | "or implemented in several scattered locations" well I'm sorry that every codegen needs to have its own way to translate "+ for integers" |
15:40:59 | * | SenasOzys quit (Remote host closed the connection) |
15:44:49 | * | btbytes joined #nim |
15:51:14 | * | PMunch quit (Quit: Leaving) |
15:51:57 | * | SenasOzys joined #nim |
15:53:50 | CodeVantage_ | If there is one thing I'd prefer for the magic procs to be commented (in the source, or get nimsuggest to include it), I don't care to go deeper than that |
15:57:00 | FromGitter | <krux02> Araq: well I wrote a comment that should help people to find where the magics are implemented. but very sortly after I contributed it, it got nerfed to an inferior version of it |
15:57:19 | FromGitter | <krux02> Araq: How do I use `range` |
15:57:44 | FromGitter | <krux02> Range is a type isn't it? |
16:04:49 | * | simonsolnes quit (Ping timeout: 248 seconds) |
16:06:21 | * | DarkArctic joined #nim |
16:12:12 | dom96 | oh damn, I sure got told here: https://www.reddit.com/r/programming/comments/8eat5o/calling_c_constructors_from_d/dxtxvmy/ |
16:13:03 | miran | ouch! |
16:14:57 | * | nsf quit (Quit: WeeChat 2.0.1) |
16:15:20 | * | athenot joined #nim |
16:16:43 | miran | well, we need more nim blogposts, so nim comments won't be offtopic :) |
16:17:05 | * | SenasOzys quit (Ping timeout: 248 seconds) |
16:26:04 | * | SenasOzys joined #nim |
16:29:02 | shashlick | i'm searching for test cases in nim where command line flags are tested, anyone know where I should look? |
16:29:15 | shashlick | also open to suggestions on how to test for https://github.com/nim-lang/Nim/pull/7677 |
16:29:36 | * | jrbrt joined #nim |
16:30:01 | FromGitter | <krux02> http://ix.io/18xD |
16:30:05 | * | simonsolnes joined #nim |
16:30:18 | FromGitter | <krux02> try it. It's great. |
16:30:54 | * | jrbrt quit (Client Quit) |
16:34:39 | * | sendell quit (Remote host closed the connection) |
16:34:59 | * | zahary_ quit (Quit: Connection closed for inactivity) |
16:35:34 | * | jrbrt joined #nim |
16:35:54 | * | simonsolnes quit (Ping timeout: 265 seconds) |
16:40:32 | * | PMunch joined #nim |
16:40:35 | FromGitter | <krux02> (spoiler it will freeze your compiler and maybe even yuor editor when it waits for nimsuggest for a respons) |
16:47:35 | * | MyMind quit (Ping timeout: 240 seconds) |
16:47:36 | * | Pisuke joined #nim |
16:49:25 | CodeVantage_ | I just opened it in the browser and it broke nimsuggest o_o |
16:52:46 | planetis[m] | still not getting messages 😢 |
16:53:58 | FromGitter | <krux02> CodeVantage_: yea, exactly |
16:54:15 | FromGitter | <krux02> planetis: maybe you should switch to irc or gitter |
16:54:24 | * | BitPuffin quit (Remote host closed the connection) |
16:55:09 | * | BitPuffin joined #nim |
16:55:26 | * | Lord_Nightmare quit (Excess Flood) |
16:55:44 | * | Lord_Nightmare joined #nim |
16:57:52 | planetis[m] | sameless self-advertising: https://github.com/notTito/morpheus |
16:58:08 | planetis[m] | its finally completed! |
16:58:28 | miran | b-but we have Neo? |
16:59:34 | FromGitter | <krux02> miran: Neo is my keyboard layout, what do you mean? |
17:00:04 | FromGitter | <krux02> planetis: shameless self-advertising: https://github.com/krux02/ast-pattern-matching |
17:01:21 | FromGitter | <krux02> planetis: what I see instantly that the values to initialize the matrix are not a flat datastructure. So I would instantly suspect that the interal matrices are also not flat datastructures. |
17:01:38 | FromGitter | <krux02> and that would be bad. |
17:01:50 | FromGitter | <krux02> Explain how your datastructures are layed out in memory. |
17:02:21 | planetis[m] | krux02: nice what is this used for? |
17:02:38 | FromGitter | <krux02> not yet anything, it is just completed |
17:02:39 | planetis[m] | but-but get over it lol :) |
17:02:46 | FromGitter | <Vindaar> @krux02 he's talking about https://github.com/unicredit/neo (unless you wanted to make a pun :P ) |
17:03:01 | planetis[m] | friendly poke |
17:05:10 | FromGitter | <krux02> well I also wrote a matrix library for Nim |
17:05:27 | FromGitter | <krux02> nim-glm |
17:07:08 | CodeVantage_ | lol this is how numpy started apparently |
17:09:47 | Araq | krux02: I love your pattern matching but the docs has some typos. do you want to hear them? |
17:10:05 | FromGitter | <krux02> I am not good at typing |
17:10:08 | FromGitter | <krux02> but yes |
17:10:21 | FromGitter | <Vindaar> @CodeVantage_: what do you mean by "this"? don't know the history of numpy :) |
17:10:24 | Araq | "Just literals like 123 will also match any literals with the same value. so it would match on a literal such as 123, but only literals of a different kind such as 123'u32" -- what? |
17:10:44 | Araq | "but only" -- "but not" ? |
17:11:18 | Araq | `somename` @ <pattern> -- I would have used '<pattern> as somename' |
17:11:29 | * | Lord_Nightmare quit (Ping timeout: 248 seconds) |
17:12:12 | Araq | and of course your use of backticks raises the question how to match backticks on their own, but I guess nnkAccQuoted is good enough |
17:12:27 | FromGitter | <krux02> well the @ syntax is just copiel over from scala |
17:12:44 | Araq | "else: the else branch is the code path that is taken when the pattern fails to match. The else branch is optional. When a pattern does not match, an error will be raised." |
17:12:55 | FromGitter | <krux02> and I actually like it, because it has the same argument order as assignments |
17:13:03 | CodeVantage_ | vindaar, basically everyone had their own seperate lib for math then they combined later on |
17:13:10 | FromGitter | <krux02> (identifier) = (expression) |
17:13:14 | Araq | that seems questionable, why not do nothing instead? |
17:13:27 | Araq | I can always write 'else: error' on my own |
17:13:52 | FromGitter | <krux02> Araq: I can say the inverse |
17:14:02 | FromGitter | <krux02> I can always say else: discard |
17:14:19 | planetis[m] | anyway if anyone needs matrix factorization, inverse, linear systems, etc. its very reliable bc its a port of a well known java library |
17:15:09 | Araq | „Maybe at some point the pattern matching library will contain operators to match more flexible patterns with operators such as +, *, |, ?. but that is not implemented. It would be possible though.“ |
17:15:22 | Araq | -- IME it's not worth it. |
17:15:25 | CodeVantage_ | planetis, tests if you want to claim reliability |
17:15:30 | Araq | good that you left it out :-) |
17:15:45 | * | Lord_Nightmare joined #nim |
17:15:52 | FromGitter | <krux02> from my experience with scala that has exactly this behavior I can tell you that error when a patted did not match at all is the better way to do it. Especially when you want to use the pattern matching in an expression |
17:15:58 | CodeVantage_ | nvm, planetis[m] i see you have tests |
17:16:08 | planetis[m] | CodeVantage_: they are right there :p |
17:16:17 | Araq | the binding to variable problem is a tough one for | |
17:17:07 | CodeVantage_ | I wish I could access enums through FileMode.fmWrite and fmWrite, (like with modules) |
17:17:12 | FromGitter | <krux02> what do you mean? |
17:17:33 | FromGitter | <krux02> at the moment I don't use the `|` operator for anything. |
17:18:17 | Araq | I mean "It would just raise the question how are named subexpressions are handled in such optional pattern branches." |
17:18:24 | * | nsf joined #nim |
17:18:37 | Araq | is a tough question with not many obvious solutions |
17:18:52 | FromGitter | <krux02> well that is a question I actually questioned myself, and I decided to not go that route. |
17:19:22 | FromGitter | <krux02> when the branch itself has a name, then I could access that name with member variables |
17:19:30 | FromGitter | <krux02> expr.subexpr |
17:19:44 | FromGitter | <krux02> I think regular expressions can do that |
17:20:40 | * | cspar joined #nim |
17:21:25 | FromGitter | <krux02> but you are right, I think it is really not worth implementinch such patterns, because it is possible to do pattern matching in the of-brach again |
17:25:19 | Araq | yeah. |
17:25:36 | Araq | what is really important and missing though is a 'recurse' keyword in the body parts |
17:25:43 | * | btbytes quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
17:26:03 | FromGitter | <krux02> what do you mean with recurse? |
17:26:36 | * | btbytes joined #nim |
17:26:45 | FromGitter | <krux02> iterating an ast and matching ast nodes is orthogonal to pattern matching |
17:28:28 | Araq | yeah but it's related and 'recurse' is a messy construct otherwise |
17:28:34 | Araq | result = copyNimNode(n) |
17:28:41 | Araq | for c in n: |
17:28:49 | Araq | result.add self(c) |
17:29:00 | * | Arrrr quit (Quit: Leaving.) |
17:29:16 | Araq | where 'self' is the current transformation plus the parameters it might require |
17:29:40 | Araq | match against a, b, c, recurse otherwise. |
17:29:53 | Araq | is the most common thing to do in macros. ever. |
17:30:03 | FromGitter | <krux02> yea I actually thought about it. |
17:31:08 | FromGitter | <krux02> I might implement it. |
17:31:59 | shashlick | krux02: can you please offer a real world example of using the ast pattern matching lib? |
17:33:02 | FromGitter | <krux02> well I have this library here https://github.com/krux02/opengl-sandbox |
17:33:54 | FromGitter | <krux02> the dsl has several constructos |
17:35:38 | FromGitter | <krux02> and these constructs need to be matched |
17:35:51 | FromGitter | <krux02> at the moment there is a lot of if arg.kind == ... |
17:37:55 | FromGitter | <krux02> pattern matching just makes it much easer |
17:38:17 | shashlick | great work :) |
17:38:48 | Araq | yeah, it's great. |
17:39:58 | shashlick | araq: for https://github.com/nim-lang/Nim/pull/7677, do you already have examples of testing flags? |
17:40:32 | * | Vladar quit (Quit: Leaving) |
17:41:56 | Araq | shashlick: tests can have customized compiler commands |
17:42:11 | Araq | check some cpp/ test to see the syntax |
17:47:49 | * | jjido joined #nim |
17:48:39 | * | xkapastel joined #nim |
17:50:57 | * | jjido quit (Client Quit) |
17:52:15 | * | jjido joined #nim |
17:58:05 | shashlick | araq: these are cool but challenge with --genscript is that no executable is compiled, just a bunch of files created in nimcache. so is it good to have two tests - tgenscript.nim uses --genscript to generate the files and then tgenscript2.nim checks that those files were created? |
17:59:40 | * | Senketsu_ joined #nim |
18:00:14 | Araq | cmd: "nim c --genscript $1 && nimcache/foo_script.sh" |
18:00:27 | Araq | os: "linux" |
18:01:03 | Araq | probably testament is a dick and doesn't allow for &&, then you need a customized test "category" but you get the idea |
18:06:01 | shashlick | so we won't be able to test this on windows simultaneously? |
18:06:23 | shashlick | meh, just two test cases I guess |
18:06:54 | FromGitter | <krux02> Araq: I think the best reason why by defalt I raise an error in my match statement is that I don't like to implicitly discard values. |
18:07:22 | FromGitter | <krux02> The entire language Nim doesn't like to implicityl discard values, so it is consistent. |
18:07:23 | * | simonsolnes joined #nim |
18:07:37 | Araq | I will de-deprecate missing 'else: discard' sections for string cases though. |
18:07:54 | Araq | if I haven't already, not sure. |
18:08:11 | FromGitter | <krux02> you should make the missing case raise an error by default. |
18:08:29 | Araq | a "do nothing otherwise" is not the same as discarding a value |
18:08:41 | Araq | but I get your point. |
18:09:16 | FromGitter | <krux02> Just think about using the case-of as an expression. |
18:09:19 | Araq | if itIsRaining: buyAnUmbrella() |
18:09:34 | Araq | # <-- no 'else' required here and Nim doesn't complain. |
18:09:37 | FromGitter | <krux02> let myval = case(mystring): |
18:09:38 | * | Senketsu_ quit (Quit: WeeChat 2.1) |
18:10:05 | Araq | yeah well, expressions are often more annoying to work with :P |
18:10:23 | FromGitter | <krux02> well I like expressions a lot |
18:10:32 | FromGitter | <krux02> especially for initialization |
18:10:53 | FromGitter | <krux02> It's easier to track all the possible code branches in my head |
18:11:03 | FromGitter | <krux02> I will know that a value is initialized |
18:11:36 | FromGitter | <krux02> much better than" var something: XYZ; ... if ...: something = ...; elif: something = ... |
18:11:49 | FromGitter | <krux02> and then in the end you can't be sure that something is initialized |
18:12:04 | FromGitter | <krux02> wel you can, but using the if as an expression ensures it at compiler time |
18:12:08 | Araq | that's actually a language quirk I want to get rid of. |
18:12:23 | FromGitter | <krux02> what do you want to get rid of? |
18:12:30 | * | Senketsu_ joined #nim |
18:12:38 | Araq | the compiler should enforce explicit initialization for locals |
18:12:40 | FromGitter | <krux02> if as an expression? |
18:13:30 | Araq | it already can do that but this code is only active for not-nil types. nonsense, it should be the default for all locals. |
18:13:39 | FromGitter | <krux02> so the compiler should check for all possible code branches? |
18:13:51 | Araq | it can do it already. |
18:14:18 | Araq | the only downside is the asymmetry between stack slots and heap slots |
18:14:53 | FromGitter | <krux02> Ihave no idea what you mean by stack slots and heap slots |
18:15:19 | Araq | take C# or Java for example. |
18:15:49 | Araq | fields in classes are default initialized, local variables are forced to be init'ed explicitly. |
18:16:02 | Araq | why is that? |
18:16:27 | shashlick | araq: nim c ... doesn't allow && since it thinks it's part of the nim commands: arguments can only be given if the '--run' option is selected |
18:16:43 | Araq | because it's harder to do that for class fields (aka the heap) |
18:17:34 | FromGitter | <krux02> aren't locals also default initialized in Java? |
18:17:35 | FromGitter | <Varriount> shashlick: Isn't that `&&` something the shell handles? |
18:17:48 | FromGitter | <krux02> they are 0 by d |
18:17:51 | FromGitter | <krux02> y default |
18:17:54 | FromGitter | <krux02> (null) |
18:17:56 | FromGitter | <Varriount> I know I've used `&&` before with Nim. |
18:17:58 | Araq | krux02: no, the compiler makes you init them. |
18:18:17 | FromGitter | <krux02> I haven't programmed java since java 1.6 |
18:18:25 | Araq | yeah, the tester is not a shell. |
18:18:36 | * | endragor joined #nim |
18:18:39 | Araq | krux02: that feature was in java 1.0. iirc. |
18:19:09 | FromGitter | <krux02> well my memory is not permanent I guess |
18:19:26 | FromGitter | <krux02> I forget details. |
18:20:28 | FromGitter | <krux02> Araq did you see the issue I created: |
18:20:29 | shashlick | So question is whether I should make testament smarter or add a second test case to verify the first worked |
18:20:55 | FromGitter | <krux02> with a fairly short code that doesn't even use marcos, I get the compiler to hang up. |
18:20:57 | shashlick | Eg add a cmds option to testament to allow multiple commands |
18:21:01 | Araq | shashlick: write a custom category for testament. |
18:21:34 | Araq | check category.nim for how to do that, it's rather easy |
18:22:11 | shashlick | Do we have any other test cases in place to validate command line options? Want to make sure any testament enhancements are useful beyond this one test |
18:22:34 | * | Sembei joined #nim |
18:22:51 | * | Pisuke quit (Ping timeout: 255 seconds) |
18:25:56 | Araq | well 'cmd' was good enough until now. |
18:26:13 | Araq | and used to test command line options. |
18:26:54 | Araq | krux02: static[T] bug? :P |
18:28:21 | FromGitter | <krux02> Araq: it was in my example to show you how trivial it is to just implement both the enum indexed array and the range indexed array on an array type thas just has an integer as size |
18:28:37 | FromGitter | <krux02> but aparently it breaks the compiler to do so |
18:28:37 | Araq | I noticed. |
18:29:55 | Araq | but as I said, range[1..2] is a subtype of int, static[int] is a ... that matches even better in overloading resolution? |
18:30:04 | FromGitter | <krux02> and really it is not much code at all to leverage that functionality into nim, it doesn't even need macros |
18:30:23 | Araq | I know how to fix range. |
18:30:25 | * | smt` joined #nim |
18:30:33 | Araq | I don't know how to fix static[T]. |
18:30:55 | Araq | I don't know why we need to replace a simple feature by a beast. |
18:31:24 | Araq | just because you like your arrays to only support simple numbers. |
18:31:43 | FromGitter | <krux02> yes |
18:32:20 | FromGitter | <krux02> I don't know how static[T] is implemented, but it is surely one of nims more powerful features |
18:33:12 | FromGitter | <krux02> but range is one of nims obscure and useless features. |
18:33:37 | Araq | it's only obscure because it doesn't work as well yet as it should |
18:33:46 | * | smt` quit (Read error: Connection reset by peer) |
18:33:58 | shashlick | araq: ok I'll see if categories or a cmds[] option makes more sense |
18:33:58 | FromGitter | <krux02> range could easily be implementey with static[int] |
18:34:03 | Araq | and it doesn't work well yet because it's a more general problem involved here, also affecting object constructors and 'nil' |
18:34:04 | * | smt` joined #nim |
18:34:09 | * | smt quit (Ping timeout: 248 seconds) |
18:34:30 | CodeVantage_ | why does C2NIM remove typedef struct? |
18:34:39 | FromGitter | <krux02> type Range[low,high: static[int]] = distinct int |
18:35:04 | Araq | all these points are not valid points for static[T] which is just in its own category of things. |
18:35:36 | FromGitter | <krux02> CodeVantage_: C2Nim is in no way a "correct" tool it is just a "I do the best I can, but don't hang me, when the result is wrong" tool |
18:35:46 | Araq | you complained about the different type relations in the manual and yet you're happy with the "convertible to static[T]" relation |
18:36:08 | Araq | which the manual doesn't even mention anywhere explicitly afaik. |
18:36:54 | FromGitter | <krux02> Well I am not involved in the compiler, but if you remove static[T], please leave it at least for macros alive. |
18:37:01 | CodeVantage_ | krux02, :'( It just removes the statments. Keeping the comments. |
18:37:02 | FromGitter | <krux02> There it is clearly a value, not a type. |
18:37:05 | CodeVantage_ | oh well |
18:38:20 | FromGitter | <krux02> CodeVantage_: the way to use c2nim is to try it with lots of different arguments until the result is as close to what you want as possileb, and from there on you need to do manual tweaking. |
18:38:55 | Araq | CodeVantage_: because it mistakes it for a pointless forward declaration |
18:38:59 | FromGitter | <krux02> that also means that when the original header changes, you have to alse bring these updates manually into the nim wrapper |
18:39:09 | CodeVantage_ | Ya I just used a multicursor to modify 3 typedefs at once |
18:39:32 | CodeVantage_ | I want a c2nim template thingy |
18:39:53 | CodeVantage_ | I don't want to even touch the original source |
18:40:08 | CodeVantage_ | But its all good as long as you don't update... right? |
18:40:42 | Araq | there is a package on top of c2nim that is more convenient to use but I forgot its name |
18:40:45 | FromGitter | <mratsim> Since people were talking about matrix library, I’ve got this neural net DSL coming soon: https://github.com/mratsim/Arraymancer/issues/214#issuecomment-383676199 |
18:40:47 | FromGitter | <krux02> yes |
18:40:49 | FromGitter | <mratsim> @Araq, nimgen |
18:41:27 | FromGitter | <mratsim> https://github.com/genotrance/nimgen |
18:41:28 | FromGitter | <krux02> neural networks are super trendy at the moment |
18:41:38 | FromGitter | <krux02> as well as bitcoins. |
18:41:43 | FromGitter | <mratsim> blockchain is trendier than neural net though :P |
18:42:17 | FromGitter | <mratsim> I’m spammed on my LinkedIn with people trying to ride the waves ... |
18:42:29 | FromGitter | <krux02> I am happy that we don't have cheap cold fusion energy yet. Otherwise people would put 90% of all cold fusion energy into bitcoin mining. |
18:44:35 | FromGitter | <krux02> If you want to be successful, you have to detect the trends. Go with the flow where it makes sense, and counter the flow where it makes sense to do so. |
18:45:27 | * | yglukhov_ quit (Ping timeout: 240 seconds) |
18:46:03 | CodeVantage_ | nimgen makes me download everything again. internet isnt free :( |
18:46:51 | FromGitter | <krux02> when everybody is doing bitcoin mining and it is super popular, don't invest. When everybody develops an MMORPG, don't do that. But when such a wave really smoothes a technology that helps you in achieving your goals, use it. It will work. |
18:47:13 | FromGitter | <krux02> Using Nim is by the way totally against the flow. |
18:47:24 | FromGitter | <krux02> Rust is booming. |
18:47:32 | FromGitter | <krux02> Rust is the hot shit |
18:47:48 | * | yglukhov joined #nim |
18:50:55 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
18:55:10 | FromGitter | <Varriount> Bah |
18:55:21 | FromGitter | <Varriount> @dom96 Let |
18:55:35 | FromGitter | <Varriount> Let's do Nim advertisement: https://www.selfserve-stackexchange.com/?utm_source=so-owned&utm_medium=house-ad&utm_campaign=selfserve&utm_term=lb1 |
18:55:45 | FromGitter | <Varriount> :P |
18:56:12 | * | nsf quit (Quit: WeeChat 2.0.1) |
18:56:29 | * | nixfreak quit (Remote host closed the connection) |
19:00:22 | * | endragor quit (Remote host closed the connection) |
19:00:59 | shashlick | CodeVantage_: what are you trying with nimgen? you can configure it to do a sparse download |
19:01:51 | shashlick | and if you have a git repo already downloaded, you can just copy it over |
19:01:55 | * | yglukhov quit (Remote host closed the connection) |
19:02:07 | CodeVantage_ | shashlick, how does one do that |
19:02:20 | CodeVantage_ | I already downloaded nimgen |
19:02:24 | CodeVantage_ | I wanted to test it out |
19:02:31 | * | yglukhov joined #nim |
19:02:36 | CodeVantage_ | but nimble install is a bit too involved |
19:02:43 | CodeVantage_ | it wanted me to download nim |
19:02:45 | CodeVantage_ | from git |
19:02:54 | CodeVantage_ | which I've already done |
19:03:03 | shashlick | oh okay, ya it needs the latest nim since it needs c2nim installed |
19:03:28 | shashlick | do you have a working c2nim already? |
19:03:33 | CodeVantage_ | c2nim is already in the normal nim right? |
19:03:37 | CodeVantage_ | in the release version |
19:03:46 | CodeVantage_ | ya and a c2nim repo |
19:03:55 | shashlick | what version of nim do you have? nim -v |
19:07:11 | * | yglukhov quit (Ping timeout: 265 seconds) |
19:07:15 | CodeVantage_ | 0.18 |
19:07:56 | * | jaco60 quit (Ping timeout: 276 seconds) |
19:08:33 | shashlick | and what version of c2nim? c2nim -v |
19:09:31 | CodeVantage_ | 0.9.12 |
19:10:33 | shashlick | okay, so nimgen wants nim >= 0.17.2 and c2nim 0.9.13 and which wants nim >= 0.16.0 so I'm wondering why it wants to upgrade your nim version |
19:10:37 | shashlick | dom96 ^^ |
19:10:49 | shashlick | well, easiest would be to just clone the repo, update the .nimble file and then nimble build |
19:12:31 | CodeVantage_ | because it wants the github version I think |
19:12:51 | CodeVantage_ | True, I'll try it out later |
19:13:05 | * | Lord_Nightmare quit (Ping timeout: 248 seconds) |
19:13:09 | * | Senketsu_ quit (Quit: WeeChat 2.1) |
19:13:13 | CodeVantage_ | THe #@ @# feature with c2nim is convenient though |
19:13:46 | shashlick | so the goal of nimgen is to help automate c2nim so that it is easy to use the latest C lib source |
19:14:03 | shashlick | will help to see the libs that were wrapped with nimgen to understand how to best use it |
19:16:39 | * | Senketsu_ joined #nim |
19:16:55 | * | Lord_Nightmare joined #nim |
19:17:31 | CodeVantage_ | are there some? |
19:17:53 | * | Senketsu_ quit (Client Quit) |
19:18:12 | CodeVantage_ | nvm i see the wrappers |
19:25:20 | FromGitter | <zetashift> @mratsim that DSL thing looks really promising, but usually with those kind of things docs and iteration speed are important no? It's one of the reasons why Python and R are popular(great beginner docs and repl) (I'm no data scientist, so I have no idea how that goes) |
19:25:22 | * | arecaceae quit (Read error: Connection reset by peer) |
19:25:46 | * | arecaceae joined #nim |
19:25:53 | * | Lord_Nightmare quit (Ping timeout: 248 seconds) |
19:26:26 | * | Lord_Nightmare joined #nim |
19:29:39 | * | SenasOzys quit (Read error: Connection reset by peer) |
19:32:04 | * | rokups quit (Quit: Connection closed for inactivity) |
19:37:00 | * | BitPuffin quit (Remote host closed the connection) |
19:37:43 | FromGitter | <tim-st> Does someone has an example code for generating code for a case construct via macros or similiar? |
19:38:58 | Araq | tim-st: https://github.com/Araq/ormin/blob/master/ormin/dispatcher.nim#L34 |
19:39:33 | FromGitter | <tim-st> Thanks! |
19:39:57 | * | cspar quit (Ping timeout: 240 seconds) |
19:40:09 | * | SenasOzys joined #nim |
19:40:18 | FromGitter | <tim-st> I think it's better to use code generation for cases instead of constant tables because then gcc can use gperf minimal perfect hash functions |
19:41:50 | * | jjido joined #nim |
19:50:57 | * | jrbrt quit (Quit: jrbrt) |
19:52:05 | * | Trustable quit (Remote host closed the connection) |
20:04:16 | * | miran quit (Quit: Konversation terminated!) |
20:05:29 | Araq | tim-st: what's usually more important is that 'case' is a control flow construct and a table isn't. |
20:05:54 | Araq | when you have a table of proc vars they all need to have the same signature |
20:06:09 | Araq | 'case' doesn't have this limitation. |
20:09:18 | FromGitter | <tim-st> ok thanks, I didnt meant to make it generally, just for my specific use case i think it's better |
20:14:17 | shashlick | araq: the easiest and lightest change is to simply split cmd by && and || and handle it that way, will give more flexibility to run multiple commands |
20:14:37 | * | yglukhov joined #nim |
20:14:39 | Araq | shashlick: just make it work. |
20:15:16 | Araq | if you split by && that's fine but don't support || then. |
20:15:50 | Araq | or use |
20:15:59 | Araq | cmd: '''first command |
20:16:03 | Araq | second command |
20:16:04 | Araq | ''' |
20:16:17 | Araq | that's how the other things in testament do it |
20:19:59 | shashlick | ok cool |
20:23:14 | * | athenot quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
20:26:09 | * | simonsolnes quit (Ping timeout: 248 seconds) |
20:34:18 | CodeVantage_ | How do you assert that an object has a proc |
20:34:38 | CodeVantage_ | like I want to know whether the object can call "add" |
20:35:29 | * | PMunch quit (Quit: leaving) |
20:36:04 | FromDiscord | <claude> `when compiles(add(obj))` |
20:36:40 | FromDiscord | <claude> or use a concept |
20:38:09 | CodeVantage_ | that's what I'm trying :} |
20:38:11 | CodeVantage_ | :| |
20:39:24 | CodeVantage_ | Well I don't have two variables to try that with |
20:39:32 | FromGitter | <data-man> Wow! Typedesc reforms: https://github.com/nim-lang/Nim/pull/7681 |
20:39:48 | CodeVantage_ | I want to know if there's a proc matching |
20:39:48 | * | yglukhov quit (Remote host closed the connection) |
20:40:42 | FromDiscord | <claude> then you'll need a concept |
20:41:16 | FromDiscord | <claude> ```nim |
20:41:16 | FromDiscord | <claude> type Addable = concept x |
20:41:16 | FromDiscord | <claude> x.add(int) |
20:41:16 | FromDiscord | <claude> ``` |
20:41:34 | CodeVantage_ | THank you :) |
20:42:30 | FromDiscord | <claude> oh i didnt realize, did that code block even pass through correctly |
20:44:17 | CodeVantage_ | yup |
20:44:31 | CodeVantage_ | If it didn't I coulda just visited the link i think |
20:44:46 | CodeVantage_ | How to make a list/seq/openarray of Concept objects? |
20:44:55 | CodeVantage_ | can you even? |
20:46:37 | CodeVantage_ | nvm found it ` type T2 = seq[SomeNumber]` |
20:52:41 | dom96 | you can't |
20:53:19 | * | btbytes quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
20:55:24 | CodeVantage_ | I've realized |
20:56:08 | * | jrbrt joined #nim |
20:57:13 | * | jrbrt quit (Client Quit) |
20:59:16 | * | simonsolnes joined #nim |
21:03:12 | * | jrbrt joined #nim |
21:03:26 | shashlick | are you guys picky about removing "declared but not used" warnings? |
21:03:57 | * | simonsolnes quit (Ping timeout: 255 seconds) |
21:05:29 | FromDiscord | <claude> if you want to remove it for one declaration you can use `{.used.}` |
21:09:22 | Araq | shashlick: usually yes. means I forgot an export marker. |
21:09:51 | Araq | in the compiler I have them turned off, I think. the compiler is not important enough... *cough* |
21:15:16 | shashlick | so testament has a few warnings, minor but while i'm in there, I could either {.used.} them or comment them out |
21:15:52 | Araq | remove them |
21:18:10 | shashlick | cool |
21:18:11 | * | yglukhov joined #nim |
21:18:51 | shashlick | there's no os: "linux" flag, you need to use disabled: "linux" - any way to have different commands by OS or have to have different test files |
21:19:42 | * | yglukhov quit (Read error: Connection reset by peer) |
21:19:50 | Araq | oh yeah, it's |
21:20:02 | Araq | disabled: "windows" then |
21:20:21 | * | yglukhov joined #nim |
21:20:23 | shashlick | sufficient to test on one OS? |
21:20:45 | Araq | well I doubt .bat file generation works |
21:22:52 | shashlick | it works |
21:22:56 | * | nsf joined #nim |
21:27:40 | * | jrbrt quit (Quit: jrbrt) |
21:30:22 | Araq | then don't have 'disabled: windows' |
21:31:17 | shashlick | but the command lines are different, bat vs .sh and also paths |
21:33:02 | Araq | told you to create a category for it :P |
21:33:14 | Araq | declarative programming fails once again. |
21:37:35 | FromGitter | <alehander42> don't say a bad word about decl programing |
21:37:40 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
21:40:28 | Araq | it doesn't work. |
21:41:11 | Araq | the only thing that does work is imperative programming where you get declarative programming on top via a macro system... |
21:41:39 | * | CodeVantage_ quit (Quit: Leaving) |
21:42:03 | Araq | so that you can always have a fallback when the declarative aspect fails. and that happens often. |
21:42:18 | Araq | that's why you cannot build a compiler just with regular expressions. |
21:42:37 | Araq | ok, the Perl people try that... |
21:45:11 | * | simonsolnes joined #nim |
21:45:13 | FromGitter | <alehander42> :D one of my ideas is exactly a set of dsl-s for building not very complicated languages |
21:45:51 | FromGitter | <alehander42> I agree you need imperative programming for everything, but some problem domains/aspects can be modelled pretty well 90% without it |
21:46:51 | FromGitter | <alehander42> you can't build a compiler purely declaratively, but you *can* have a lex/ast spec which generates also a set of helper tools/highlighters etc |
21:47:09 | * | rockcavera quit (Ping timeout: 255 seconds) |
21:47:14 | FromGitter | <alehander42> a lot of simpler type systems can be expressed as a dsl on top of some rules |
21:47:49 | FromGitter | <alehander42> and a big part of code generation can be also declarative |
21:49:34 | FromGitter | <alehander42> now, this would be enough just for a simpler class of "languages', but is still impressive |
21:50:01 | Araq | well yeah, that's what GCC and LLVM do. |
21:50:39 | Araq | the use DSLs to describe the code generation |
21:50:58 | Araq | and lexer and parser generators are a thing too. |
21:51:00 | FromGitter | <alehander42> yeah, I've done it too in some projects, that's the simplest component to model |
21:51:19 | * | user1101 quit (Ping timeout: 260 seconds) |
21:51:38 | shashlick | the reason I'm struggling with a new category is cause i don't know what else could fall in the category for it to be done in a useful manner |
21:51:51 | FromGitter | <alehander42> I've also played with the type system dsl idea, but never had time to really think of a good design, and it always seems to converge into becoming Prolog |
21:52:04 | shashlick | if it is just this one test case I can easily do it with testament as it is with two test.nim files - first is generated, second validates |
21:52:12 | Araq | shashlick: a category is just a special case. a special case for one test is fine. |
21:52:29 | shashlick | okay that's fair |
21:52:48 | FromGitter | <mratsim> @zetashift docs and iteration speed, yes I totally agree, but then when you want to ship something in production, it has to work fast and reliably. And Python and R are not known for that, so usually you have a long development time after research to put that in C, C++, Objective C depending on the target platform |
21:52:58 | FromGitter | <alehander42> i've also used actual prolog to dsl a type system, but this is still not perfect to interop with other langs |
21:53:10 | FromGitter | <mratsim> so Arraymancer is for that gap between research and prod. |
21:53:29 | * | nsf quit (Quit: WeeChat 2.0.1) |
21:53:36 | shashlick | do you still feel the multiple cmds feature is useful or should I ditch that cmd = '''...\n...\n''' |
21:53:40 | FromGitter | <alehander42> but it's pretty cool, e.g. you can model generics with prolog unification etc, its basically builtin |
21:54:37 | Araq | shashlick: every feature in the tester that we don't need now is just cruft that makes the tester harder to understand. |
21:55:05 | federico3 | TIL: https://repology.org/metapackage/nim/badges |
21:55:17 | FromGitter | <mratsim> regarding DeclaredButNotUsed, I’d like to keep them but the push pop pragma to deactivate them selectively doesn’t work. @shashlick |
21:56:21 | * | rockcavera joined #nim |
21:56:21 | * | rockcavera quit (Changing host) |
21:56:21 | * | rockcavera joined #nim |
21:57:59 | shashlick | mratsim: I'll just comment out for now, that way they are still there |
21:58:05 | * | CodeVantage_ joined #nim |
21:58:16 | shashlick | araq: no multiple cmds then, i'll look into a new category |
21:58:30 | Araq | we have git's history for that |
21:58:33 | Araq | but ok. |
21:58:39 | FromDiscord | <claude> are there naming conventions for block labels |
21:59:01 | Araq | block found: |
21:59:08 | FromGitter | <mratsim> or keep them in a gist |
21:59:09 | Araq | that's it. |
21:59:26 | Araq | blocks should be named 'found'. |
21:59:34 | Araq | :-) |
21:59:42 | FromDiscord | <claude> nice |
21:59:50 | * | arecaceae quit (Remote host closed the connection) |
22:00:00 | FromGitter | <mratsim> block tetris: |
22:00:14 | * | arecaceae joined #nim |
22:00:28 | Araq | block spammers: |
22:01:04 | federico3 | is it a game? |
22:01:06 | federico3 | block chain: |
22:01:11 | FromGitter | <mratsim> I called a template to recursively dive into the AST “letsGoDeeper”: https://gist.github.com/mratsim/9d176b7b366fae9b990ff82932756ead#file-wip_nnet_dsl-nim-L220 we need more fantasy. |
22:05:33 | dom96 | in before "omg, version 2? version 1 isn't even out yet, how come they're thinking about v2?!?!?!" https://www.reddit.com/r/programming/comments/8eat5o/calling_c_constructors_from_d/dxuo61n/ |
22:06:15 | shashlick | i'm adding a new tests\flags directory/category - suspect there's other such nim flags which need special test cases |
22:06:16 | dom96 | oops, thought this was -offtopic. Oh well. |
22:06:56 | dom96 | federico3: wow, repology is awesome |
22:07:19 | federico3 | I found it only after putting together https://badges.debian.net/ |
22:08:37 | dom96 | It'd be nice to integrate this tastefully into https://nim-lang.org/install_unix.html |
22:10:06 | FromGitter | <mratsim> so much negativity in that thread @dom96 |
22:10:18 | dom96 | mratsim: yep :( |
22:10:40 | FromGitter | <mratsim> I’m surprised there is no Rust mentions yet |
22:11:37 | * | yglukhov quit (Read error: Connection reset by peer) |
22:12:12 | * | yglukhov joined #nim |
22:12:56 | * | jjido_ joined #nim |
22:13:42 | dom96 | there is :P |
22:13:49 | dom96 | https://www.reddit.com/r/programming/comments/8eat5o/calling_c_constructors_from_d/dxugx7o/ |
22:13:55 | dom96 | Among a list of others, but still |
22:15:40 | * | jjido_ quit (Client Quit) |
22:17:57 | federico3 | well, that repology is going to receive a PR for Nimble |
22:19:06 | * | simonsolnes quit (Ping timeout: 255 seconds) |
22:26:48 | * | skrylar joined #nim |
22:26:54 | skrylar | so i had to live under a rock for a while |
22:28:24 | dom96 | federico3: Is it not just for distros? |
22:28:52 | dom96 | federico3: This already has Nimble support: https://libraries.io/ |
22:29:11 | dom96 | It needs an updated logo oh so badly |
22:29:49 | federico3 | it's tracking language-specific packaging as well |
22:29:55 | * | cspar joined #nim |
22:33:08 | FromDiscord | <claude> go has more packages than npm |
22:33:09 | FromDiscord | <claude> wow |
22:35:07 | FromDiscord | <treeform> that is surprising |
22:35:18 | dom96 | libraries.io offers some nice features actually |
22:40:18 | * | btbytes joined #nim |
22:55:33 | * | cspar quit (Ping timeout: 268 seconds) |
23:00:00 | shashlick | why are the rodfiles tests disabled in testament? |
23:07:57 | * | noonien quit (Quit: Connection closed for inactivity) |
23:08:39 | FromGitter | <Varriount> I believe because the rodfiles functionality is incomplete at the moment. |
23:14:28 | FromGitter | <zacharycarter> well vault went out at work today |
23:14:45 | FromGitter | <zacharycarter> and then the team that manages vault brought down vault because of terraform |
23:17:57 | FromGitter | <zacharycarter> ¯\_(ツ)_/¯ |
23:26:38 | * | max3 joined #nim |
23:32:11 | * | jrbrt joined #nim |
23:32:22 | FromGitter | <krux02> Araq: my ast pattern matching has now recursive matching |
23:33:14 | * | btbytes quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
23:36:19 | * | simonsolnes joined #nim |
23:39:11 | FromDiscord | <bodie> Does anyone know whether there's a healthy Nim implementation of Flatbuffers? |
23:39:51 | FromDiscord | <bodie> Having that "Just Work" in WASM and server would be pretty neat. |
23:45:04 | FromGitter | <zacharycarter> I don't know if there is one bodie - but if not I'd love it if you created one :D |
23:45:33 | FromGitter | <zacharycarter> according to nimble.directory - it doesn't look like there is one pre-existing |
23:49:38 | FromGitter | <krux02> bodie: Implementing something equivalent of flatbuffers with macros is honestly just a few lines of code |
23:50:42 | FromGitter | <zacharycarter> yeah but isn't flatbuffers a spec? |
23:50:50 | FromGitter | <zacharycarter> so like - Nim supporting it - would be a good thing? |
23:51:07 | FromGitter | <krux02> yea, but I said "something equivalent" |
23:51:15 | FromGitter | <krux02> not really |
23:51:47 | FromGitter | <krux02> there is not tons of data out there that is in flat buffer spec encoded |
23:51:58 | FromGitter | <krux02> if you want data in that format you have to define it on your own |
23:52:16 | * | leorize joined #nim |
23:52:47 | FromGitter | <zacharycarter> right right - but like the flatbuffers library has several implementations in different languages and it's best associated with google |
23:53:04 | FromGitter | <zacharycarter> so to like - feed into that ecosystem would suit Nim best right? |
23:53:12 | FromGitter | <krux02> flat buffers might help when you want to share data between several programming languages, and does some code generation afaik, but as long as you don't want to do use multiple programming languages at the same time |
23:53:20 | FromGitter | <zacharycarter> I mean it'd be sweet to see Nim mentioned on the readme - https://github.com/google/flatbuffers |
23:53:24 | FromGitter | <krux02> macros can do the code generation |
23:53:36 | FromGitter | <zacharycarter> okay I see what you mean I think |
23:53:46 | FromGitter | <krux02> yea for Nim advertisement, but I am not sure how well that will work out. |
23:53:57 | FromGitter | <krux02> but sure it is good if nim is mentioned everywhere |
23:54:09 | FromGitter | <zacharycarter> well - I think this is one of the things that Nim developers need to maybe think about more |
23:54:18 | FromGitter | <zacharycarter> is like promoting Nim by providing implementations for popular technologies |
23:54:33 | FromGitter | <zacharycarter> thusly Varriount and I are working on the aws sdk stuff |
23:54:42 | FromGitter | <zacharycarter> It'd be sweet to eventually see a graphql lib for Nim |
23:54:51 | FromGitter | <zacharycarter> more libs supporting things like flatbuffers, etc |
23:55:12 | FromGitter | <zacharycarter> because these are things people look at when they consider Nim as a tech, especially in the enterprise world |
23:55:37 | FromGitter | <zacharycarter> like - I'd like to see us as programmers have access to a native and managed language |
23:56:08 | FromGitter | <zacharycarter> and like - Nim fits that bill perfectly and I'd rather use Nim to get two birds stoned at once rather than adopting something like Rust and Go or C/C++ and Go etc |
23:56:29 | FromGitter | <zacharycarter> but because we can't call AWS services w/Nim yet - it's a nogo - at the most I can use it to write tooling etc |
23:58:27 | FromGitter | <zacharycarter> I feel like Nim developers are currently highly specialized working on very specific projects with use cases that Nim fits really well |
23:59:05 | FromGitter | <zacharycarter> but if we really want Nim to garner the popularity it deserves - it needs to support popular technologies that don't directly fit into the problem domain Nim so elegantly suits |
23:59:21 | FromGitter | <zacharycarter> domains rather |