<< 23-04-2018 >>

00:02:30FromGitter<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:54FromGitter<krux02> @Varriount what do you mean?
00:51:43FromGitter<krux02> @Varriount I think in untyped macro arguments macro calls are preserved and can be used for metadata
00:52:15FromGitter<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:59FromGitter<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:07FromDiscord<jos> i wish c++ wasn't butthole
01:44:10FromDiscord<jos> wrong chat whoops haha
01:45:01FromDiscord<geckojsc> #relatable
01:45:43FromDiscord<jos> so something i have a bad habit of doing is building really robust metaprogramming things to make menial tasks less boring
01:45:46FromDiscord<jos> but it is a huge timesink in c++
01:46:07FromDiscord<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:10FromDiscord<jos> /end off topic
01:51:56FromDiscord<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:46FromGitter<Varriount> Metaprogramming in general tends to be a complex task, because languages tend to be very flexible (from a syntactic viewpoint)
01:55:54FromDiscord<jos> i think AST-based metaprogramming is ez
01:56:00FromDiscord<jos> template-based metaprogramming is horrific
01:56:55FromGitter<Varriount> template based from a C++ view?
01:57:05FromGitter<Varriount> Nim templates tend to be easier than Nim macros.
01:58:19FromDiscord<jos> i haven't seen another language that has template-based metaprogramming besides c++
01:58:24FromDiscord<jos> there might be one but i've never hera of it
01:58:36FromDiscord<jos> besides nim after this google search
01:59:02FromDiscord<jos> except i'd hesitate to call them similar, really
02:02:38FromDiscord<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:39FromDiscord<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:24FromDiscord<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:59FromDiscord<geckojsc> Oops it's {.this: self.}
02:12:49FromDiscord<jos> rust can do that
02:12:54FromDiscord<jos> nim can do that
02:15:48FromDiscord<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:20FromDiscord<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:55FromGitter<gogolxdong> How to set up a file upload server in Nim?
02:54:11bodie_there's a discord right?
02:54:15bodie_is that used much?
02:55:18FromDiscord<claude> its just a bridge to the IRC
02:55:39FromDiscord<claude> https://discord.gg/y5Y9DM
02:56:57FromDiscord<bodie> thanks
03:10:48*endragor joined #nim
03:11:17FromDiscord<2vg> @gogolxdong using jester (?) should not be so difficult
03:26:26FromGitter<AjBreidenbach> how to I escape `$` with `importc`?
03:27:33FromGitter<AjBreidenbach> I want to import a function with a dollar sign
03:36:50FromGitter<AjBreidenbach> nvm I think I got it
03:37:04FromGitter<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:31FromGitter<AjBreidenbach> it's a tuple I thought
03:38:22FromGitter<AjBreidenbach> it's got [dir, name, ext: string]
03:39:21FromGitter<gogolxdong> exactly, I mean can I just splitFile(request.body) to get this tuple.
03:40:46FromGitter<AjBreidenbach> it's a string right?
03:40:49FromGitter<gogolxdong> we are using a multi-thread async server.
03:41:35FromGitter<AjBreidenbach> idk what the contents of request.body are
03:42:33FromGitter<gogolxdong> which I don't know either, but I assume it can be generated like that.
03:43:00FromDiscord<2vg> need to understand the multi part form
03:44:26FromDiscord<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:41FromGitter<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:27FromGitter<mratsim> well they were added/changed a week ago so ;) I raise a dasCustomPragma bug last week
06:52:37FromGitter<narimiran> can someone help me with BLAS on windows?
06:53:09FromGitter<narimiran> i'm trying to use Neo, but can't run my program because of missing BLAS
06:54:27FromGitter<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:11FromGitter<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:23FromGitter<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:01FromGitter<Varriount> @narimiran Is the built library in your PATH environment variable?
07:12:00FromGitter<narimiran> @Varriount i have tried putting libblas.dll both in the current folder and in the folder which is in the PATH
07:12:38FromGitter<Varriount> Hm, did you compile them for the right architecture?
07:13:21FromGitter<Varriount> The library (32 or 64 bit) needs to be loaded by a (32 or 64 bit) program respectively.
07:13:32FromGitter<narimiran> i just downloaded them from http://icl.cs.utk.edu/lapack-for-windows/lapack/#libraries
07:13:47FromGitter<Varriount> I've
07:13:56FromGitter<narimiran> my nim is 64-bit, so i've downloaded 64-bit version
07:16:34FromGitter<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:01FromGitter<Varriount> You might give this a whirl: http://www.dependencywalker.com
07:18:28FromGitter<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:36FromGitter<narimiran> thanks @Varriount! if i'm reading this correctly, i'm missing LIBGFORTRAN_64-3.DLL
07:22:00FromGitter<gogolxdong> @2vg We found Content-Disposition is in request.body which is a string, how to filter out the filename?
07:23:02FromGitter<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:37FromGitter<narimiran> mingw is downloaded together in nim, but i guess it is not "publicly available"
07:24:39FromGitter<mratsim> @miran: https://github.com/mratsim/Arraymancer/blob/master/.appveyor.yml
07:24:48FromGitter<mratsim> this is my test suite for Windows
07:25:59FromGitter<mratsim> the BLAS package for nuget works
07:26:15FromGitter<mratsim> and you don’t need to compile it
07:26:38FromGitter<narimiran> @mratsim what's your recommendation? will installing arraymancer automatically install mingw/blas? :)
07:26:59FromGitter<mratsim> no, it won't
07:27:01FromDiscord<2vg> @gogolxdong There is a function to parse form-data in the utils module of jester, but you need to ping @dom96
07:27:21FromGitter<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:28FromGitter<mratsim> but if you have NuGet, you can follow the exact same instructions as I use in Appveyor
07:27:42FromGitter<mratsim> nuget install OpenBLAS -o "${env:APPVEYOR_BUILD_FOLDER}"
07:27:49FromGitter<mratsim> cp OpenBLAS.0.2.14.1/lib/native/bin/x64/libopenblas.dll blas.dll
07:27:51FromGitter<mratsim> done
07:28:19FromGitter<mratsim> or just get the .nuget package on the web and extract it manually
07:28:38FromGitter<mratsim> it’s a weird .tar.something but you can do it.
07:29:24FromGitter<mratsim> Note how I can’t also test lapack from icl.cs.utk.edu ...
07:30:15FromGitter<narimiran> i downloaded nuget.exe, but it crashes immediately after i try to run it
07:31:17FromGitter<mratsim> I can’t help if windows tools developed by Microsoft are crashing on Windows :/
07:31:38FromGitter<gogolxdong> @2vg yes,we didn't use jester , is there a parser in http stdlib?
07:33:08FromGitter<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:18FromGitter<narimiran> if it was easy, it wouldn't be interesting :P
07:34:39FromGitter<narimiran> (that's what i keep telling myself while banging my head because of windows :P )
07:36:50FromGitter<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:08FromGitter<mratsim> I don’t know what happen if I have z = merge(x, y) though
07:37:38FromGitter<mratsim> Maybe I should write a register based virtual machine :?
07:38:06FromGitter<narimiran> ok, i've made a step forward - downloaded openblas and that seems to work. now i have problems with LAPACK :D
07:38:55FromGitter<mratsim> I couldn’t make lapack work on Windows but I don’t have a Windows machine
07:39:23FromGitter<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:18FromGitter<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:53FromDiscord<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:13FromGitter<narimiran> WOOOOO!!! IT WORKS!!!!
07:45:23FromGitter<narimiran> `--define:blas=libopenblas --define:lapack=libopenblas`
07:47:08FromGitter<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:43PMunchJohnPeoplefox, yeah it's telling you that iup.message doesn't return anything
07:50:50PMunchBut you're trying to assign it to a variable
07:53:20PMunchYou might be looking for messageDlg, which takes no arguments but returns an integer
07:53:28PMunchErr, a PIhandle
07:54:02FromGitter<JohnPeoplefox> Yay it works! Thanks a bunch!
07:54:24FromGitter<JohnPeoplefox> No I just removed the assignment
07:55:07PMunchYeah 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:23FromGitter<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:00FromGitter<narimiran> oh, include `-d:release` too :)
07:57:02FromGitter<mratsim> @narimiran, use a nim.cfg
07:57:29FromGitter<narimiran> i have tried to see in the manual how to use .cfg but there's nothing about it....
07:57:36FromGitter<mratsim> steal arraymancer's
07:57:50FromGitter<mratsim> the OpenBLAS from nuget can work as a Lapack lib?
07:58:05FromGitter<mratsim> is it named libopenblas.dll or blas.dll for you?
07:58:30FromGitter<narimiran> yeah, it seems it works (at least for my current use case). it is named `libopenblas.dll`
07:58:37FromGitter<mratsim> https://github.com/mratsim/Arraymancer/blob/master/nim.cfg#L58-L65
07:58:49FromGitter<mratsim> seems like I need to fix the lapack part lol
07:58:59FromGitter<narimiran> i have been looking at arraymancer's .cfg even before i asked ;)
08:00:08FromGitter<narimiran> but i don't know the syntax needed... i guess i'll try to reverse-engineer yours :)
08:06:24FromGitter<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:46FromGitter<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:33FromGitter<mratsim> yeah especially if I have something that is supposed to interleave nicely with normal Nim.
10:59:53codevantagenarimaran, look inside nim's config folder, you can basically just copy your settings in there
11:01:47FromGitter<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:23codevantagedid you install nim extension?
11:02:47FromGitter<narimiran> for vscode? yes
11:03:07codevantageis it called nim.cfg?
11:03:17FromGitter<narimiran> yes
11:03:23codevantageweird
11:03:40codevantagedid you make a workspace?
11:03:45codevantagelol
11:03:46FromGitter<narimiran> yes
11:04:14codevantagewhats the error
11:06:13FromGitter<narimiran> i just copied these 16 lines (from 55 to 70) and there are 53 errors highligted!!
11:06:28FromGitter<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:41codevantageit 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:41FromGitter<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:33FromGitter<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:26codevantagecfg has a syntax?
11:18:33codevantagesince when?
11:19:09Arrrrsince always
11:19:47FromGitter<mratsim> argh we can’t use methods at compile-time :/ https://github.com/nim-lang/Nim/issues/2574.
11:20:09codevantageyes
11:20:20codevantagecant you make a shadow proc?
11:20:31FromGitter<narimiran> wow, this indeed works regardless of all those errors (or "errors")
11:20:59FromGitter<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:56codevantagewhy you need a method?
11:22:03codevantagewhy not a proc?
11:22:04*rokups quit (Quit: Connection closed for inactivity)
11:22:17FromGitter<mratsim> you can have inheritance with a proc.
11:22:19FromGitter<mratsim> can’t*
11:22:34*pigmej joined #nim
11:23:32FromGitter<mratsim> I guess I will use object variants.
11:23:36codevantagemake the first argument a 'type Type' type then its like a classmethod
11:24:03Araqhi codevantage, welcome
11:24:23codevantagestill vantage
11:24:29codevantagehi
11:25:11Araqah ok lol
11:25:20FromGitter<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:46FromGitter<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:08FromGitter<alehander42> still better than alehander42 ..
11:26:19FromGitter<alehander42> a war veteran
11:26:40FromGitter<krux02> I use that name since the open beta of Ragnarök Online.
11:27:02ArrrrThat weeb game?
11:27:03FromGitter<krux02> but back then it was just Krux
11:27:09FromGitter<krux02> weeb?
11:27:16Araqmratsim: for loop macros?
11:27:26Arrrrjapanese game
11:27:34FromGitter<krux02> I think it's korean
11:27:35FromGitter<mratsim> Korean no?
11:27:48Arrrrkorean, japanese ..
11:28:09FromGitter<mratsim> @Araq, not since Saturday. Didn’t check the example test yet
11:28:20codevantagekrux02 https://m.9gag.com/gag/aPDKVEV/weeb-test
11:28:26FromGitter<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:12Araqjezz, what are you doing. sleeping? :P
11:29:44FromGitter<mratsim> Trying to find new static bugs, I feel like I have been slacking this week :D
11:30:13Araqcan we remove static[T]?
11:30:53FromGitter<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:03Araq3 is a value, range[0..2] is a type.
11:31:05FromGitter<krux02> Araq:what do you want to remove?
11:31:17FromGitter<krux02> I use static quite a lot
11:31:24Araqstatic[T]. I only see it used for arrays in objects
11:31:45Araqwhich is fine but it's already covered by Nim's range type.
11:31:52FromGitter<krux02> that is what I use it for in nim-glm
11:32:11FromGitter<krux02> N : static[int]
11:32:15*Arrrr quit (Ping timeout: 256 seconds)
11:32:28FromGitter<mratsim> I use static[bool] and static[enum] for compile-time dispatch too
11:33:06Araqyeah, but that's just bad.
11:33:19FromGitter<krux02> Araq, what is the alternative then?
11:33:23Araqcould use a macro/template instead for these, no?
11:33:41FromGitter<mratsim> probably
11:34:02FromGitter<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:22FromGitter<krux02> https://github.com/krux02/nim-glm/blob/master/glm/vec.nim#L16
11:35:18Araqyeah well, I don't really understand static[T]
11:35:18FromGitter<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:22FromGitter<krux02> I am ok if static[int] goes away, if I get a suitable alternative that does basically the same
11:36:11FromGitter<krux02> well should I write some lines in the macro section about static arguments?
11:36:18Araqwhen I say "remove X" I usually mean "replace X by something better"
11:36:37FromGitter<krux02> that was is this "something better"?
11:37:06FromGitter<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:13AraqI 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:12Araqit's like the 'const' design in C++
11:38:45Araqwhen they added 'const', it was too late to make integer literals 'const'
11:38:52FromGitter<mratsim> Well if you replace by something better I’m all for it.
11:39:14Araqmaybe let's start with the obvious
11:39:24Araqis it a type or a value?
11:40:08FromGitter<mratsim> it’s a compile-time only typed value.
11:40:10FromGitter<krux02> well I would say it is a value
11:40:40Araqwell 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:01Araqit's a type that allows values to be passed to generics
11:41:06FromGitter<krux02> then the compiler is wrong :P
11:41:24FromGitter<krux02> I would say it's a compiler hack.
11:41:50Araqno I think it really is a type.
11:41:59FromGitter<mratsim> I think that was just piggybacking on how array are implemented
11:42:04FromGitter<krux02> I wouly say it's a generic argument
11:42:18Araqa generic argument in Nim is a type.
11:42:30FromGitter<krux02> well then maybe you need generic values?
11:42:31codevantageits the same as runtime only its used during compile time
11:42:44Araqit's called tyGenericParam
11:43:02FromGitter<mratsim> so a GenericParam is a type.
11:43:11Araqyes.
11:43:23FromGitter<mratsim> next question?
11:44:45FromGitter<krux02> well static[T] is for sure a bit awkward
11:45:30Araqactually there are 2 static[T] usages as I see it:
11:45:43Araqin generics to pass the buck onto 'array', eventually.
11:45:58FromGitter<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:28Araqthat is covered 100% by the range type, albeit maybe the syntax is awkward and needs to be improved.
11:46:43Araqthe other use case is what krux02 just described
11:47:01FromGitter<krux02> did I even tell you, that I hate the range type, and I would like to get rid of it?
11:47:07FromGitter<mratsim> range are runtime only though?
11:47:10FromGitter<krux02> it's just awkward.
11:47:17Araqturning procs into generating procs.
11:47:27FromGitter<mratsim> also you can’t take a subrange of a range :/
11:47:38Araqranges are awesome :P
11:47:47FromGitter<krux02> I want them to die
11:48:13Araqwhy? 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:36Araqbut instead specific to Nim's type constructors (which we really need to improve)
11:48:41*SenasOzys__ joined #nim
11:48:52FromGitter<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:22FromGitter<mratsim> anyway back to Static
11:50:38Araqwell turning a proc into a generating proc has considerable overlap with templates
11:52:24FromGitter<data-man> Removing static [T] will break a large number of libraries. :(
11:52:32FromGitter<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:48FromGitter<krux02> I just want the range type to die
11:53:07FromGitter<krux02> it's just complexity without advantage
11:53:29FromGitter<krux02> arrays that don't start at 0, I don't want to support that
11:53:53FromGitter<krux02> I can simplify all usages of the range toye to a single integer.
11:54:15FromGitter<mratsim> that’s fine. I used array[‘0’..’F’, Register] just fine.
11:54:25FromGitter<krux02> sorry I mean they are wrong, because they have an inclusive upper bound.
11:54:39FromGitter<mratsim> and range cannot be passed to construct an array
11:55:03Araqyeah whatever. you will see the light when you use enums more which don't have a sentinel value.
11:55:17Araqa design that requires a sentinel value is backwards.
11:55:26Arrrrenums are overpowered in nim
11:55:36FromGitter<krux02> Araq: a range that doesn't support floating point values is useless to me
11:55:39Araqno matter how often you quote Dijkstra on this.
11:55:48FromGitter<mratsim> I think the current term is “imba” not “overpowered” ;)
11:55:49FromGitter<krux02> Araq: you will see the light if you have to use floating point numbers
11:56:06FromGitter<mratsim> I’d like ranges for floating point too
11:56:06Araqwhen I use floating point I'll make range work with them :P
11:56:43FromGitter<krux02> Araq: when you use floating point, you will realize that inclusive upper mounds are stupid
11:56:46FromGitter<mratsim> how about we tak about Static? no one uses range anyway
11:57:19FromGitter<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:27Araqkrux02: how so? why would I want 0.0 .. 1.9999999999 ?
11:58:13Araqmratsim: I understand what 'range' is, it's a subtype.
11:58:20AraqI don't understand static[T].
11:58:39Araqand so I'd rather spend time on making range work well than on static T.
11:59:22FromGitter<mratsim> I think static has more value than ranges. Or karax for macro ;)
11:59:23FromGitter<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:32codevantagearaq, you mean that the programmers intention is not fully convetyed throough using static?
11:59:55codevantagemaybe static should be a macro
12:00:15FromGitter<zacharycarter> what if we came up with another name for the current range and freed up range?
12:00:17codevantagestatic var : type
12:00:41FromGitter<zacharycarter> like scope or dimension or limits or something
12:00:45ArrrrI'm getting nervious, last time it happened before Araq killed my friend '<'
12:00:54Araqwell there is definitely a design that unifies range[T] and static[T] making everybody happy.
12:01:04Araqwe just need to find it :P
12:01:35FromGitter<mratsim> “There is definitely a way to combine AI and blockchain, making everyone billionaires, we just need to find it” ;)
12:01:53Araqlol
12:02:14FromGitter<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:42Araqarrays do support an integer for their size.
12:02:43FromGitter<mratsim> flexible ranges can be called Spans like in C++17
12:03:02FromGitter<alehander42> arrays starting from n are great, I was a skeptic, but they are useful
12:03:09Araqand InclusiveUpperBoundIntegerRange is wrong, it's not just for integers
12:03:29*athenot joined #nim
12:04:21Araqalso 'inclusive' is the default in Nim anyway, because sentinels suck.
12:04:35FromGitter<mratsim> allowing ..< in ranges would be nice
12:04:53Araqwanted to support that
12:04:59Araqbut it's complex to do.
12:05:20Araqbecause the compiler is in this section full of bullshit dealing with static[T].
12:05:23FromGitter<mratsim> can’t we just transform in .. pred(foo)
12:05:27FromGitter<mratsim> ah
12:05:56FromGitter<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:28Araqyeah, that escapes me.
12:08:15FromGitter<krux02> Tho probability of the crash depends on the precision of the float
12:08:34FromGitter<krux02> That use case is extremely common, two examples are rasterization and tesselation.
12:08:55Araqisn't that confusing 'real' with 'float' math?
12:09:28FromGitter<krux02> there is no `real` math
12:09:37FromGitter<krux02> on computers
12:09:52Araqyes.
12:10:08FromGitter<krux02> there is only symbolic transformations, float math, and other discrete data types.
12:10:53FromGitter<krux02> Rational is for example a useful datatype that uses two integers to represent a fraction precisely.
12:11:22Araqthere 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:35Araqbecause it's floating point math.
12:11:54Araqfor some epsilon I cannot write down.
12:12:39FromGitter<krux02> Araq you actually point out the exact reason, why you want exclusive uppor bounds.
12:13:43FromGitter<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:00FromGitter<alehander42> for floats
12:14:19FromGitter<krux02> well for integers it is also nicer
12:14:27FromGitter<arnetheduck> Araq, conceptually, exclusive upper bound is a different thing than 1-epsilon for some specific type
12:14:39FromGitter<krux02> just think about it, how many elements are in a range from a to b?
12:14:46FromGitter<krux02> what is the distance from a to b
12:15:07FromGitter<krux02> wouldn't it be simpler if it would be just (b-a) instead of (b-a+1)
12:15:18FromGitter<krux02> this +1 is everywhere
12:15:53FromGitter<krux02> and easiliy forgotten to introduce bugs.
12:17:35FromGitter<krux02> and the absolute ridiculous range is the empty range
12:17:41FromGitter<krux02> 0 .. -1
12:17:49FromGitter<krux02> wtf
12:19:37FromGitter<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:38FromGitter<alehander42> oh 0 ..< 0 is so hard
12:20:14FromGitter<krux02> 0 ..< 0 is what I write, yes. but the raneg it constructs is [0,-1]
12:20:21FromGitter<krux02> that is the value
12:20:43FromGitter<krux02> exclusive uppor bound it would just be [0|0[
12:20:55FromGitter<krux02> it is instantly visible that that thing is empty.
12:21:07FromGitter<krux02> it doesn't contait the 0
12:21:20FromGitter<alehander42> so when I write for with exclusive range, I'll have to always do `a .. b + 1` ?
12:21:35FromGitter<alehander42> i've never looked at how does empty range look internally in my life
12:21:51FromGitter<krux02> @alehander42 well you should
12:22:19FromGitter<krux02> observe what your program is actually doing to understand it.
12:22:31FromGitter<alehander42> well it doesn't matter to me if internally it's [0, -1] or [0, 0
12:22:37FromGitter<alehander42> it matters what api do i use
12:22:39FromGitter<krux02> well it does matter
12:22:58FromGitter<krux02> becaues 0 and -1 are the two bounds stored in the range
12:23:04FromGitter<krux02> and they are part of the API
12:23:21FromGitter<alehander42> and how often do you access them directly?
12:23:35*leorize joined #nim
12:23:52FromGitter<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:05FromGitter<krux02> @alehander42 often enough
12:24:58*jaco60 joined #nim
12:25:17FromGitter<krux02> I think I scared everybody away from this discussion.
12:26:37FromGitter<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:50FromGitter<krux02> that is what is bothing me about it.
12:29:26Araqthere is no such thing.
12:29:45FromGitter<krux02> there is no what thing?
12:29:47Araqinternally x - floatEpsilon is easy enough to use
12:29:50FromGitter<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:50FromGitter... and b (included). a and b can be infinite (but they can not be the same infinite) and a ≤ b.
12:30:39Araqinclusive math is the nature of the machine.
12:31:15Araqexclusive upper bounds are fiction.
12:31:37codevantageis this philosophy?
12:31:47FromGitter<arnetheduck> the nature of the machine is that it offers both..
12:32:16Araqno CPU I know of offers exclusive number types, arnetheduck
12:32:20codevantagehasnt someone else solved this before?
12:33:15Araqok, high time we discuss something with more productive outcomes
12:33:39codevantagewhats the agenda?
12:34:00Araqspring break
12:34:31FromGitter<arnetheduck> Araq, they offer greater or equal, or strictly greater operators..
12:34:33Araqor spring-cleaning.
12:34:46FromGitter<arnetheduck> like exceptions? :)
12:35:20shashlickAraq has been killing issues like crazy!
12:35:27codevantagei havent heard any support for exceptions
12:37:10Araqexceptions are in JavaScript and C++, two of the languages we happen to target.
12:37:35Araqexceptions are faster than ifs sprinkled throughout the codebase
12:38:14codevantagei thought you wanted to remove exceptions?
12:38:19Araqwhen the 90% error handling case is "pass it upwards" then it makes perfect sense to make this the implicit behaviour.
12:38:46Araqcodevantage: as I said, I want to replace it by something better.
12:38:57Araqand I haven't yet found this "better thing".
12:39:04codevantageok
12:39:44codevantageraising is useful for other things too
12:39:45FromGitter<krux02> Araq: Well I like this error variable thing
12:40:10codevantagelike if one proc might give numerous errors
12:40:54Araqkrux02: that idea of mine is not even a long-term RFC yet
12:42:39shashlickI'm liking this issue closure fest
12:42:55shashlickWhat can we do to accelerate it
12:43:41Araqshashlick: fix bugs?
12:44:42shashlickYep, can we make it something everyone focuses on for the next week or something?
12:45:53FromGitter<krux02> @alehander42: about the further development of ast-pattern-matching, you can work on it.
12:47:13FromGitter<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:38AraqRFC: pattern match all the things.
12:47:53Araqcombine ast pattern matching with regexes and make it "consistent"
12:48:09Araqhow? no idea but these things use the same name and so should be consistent.
12:48:55Araqwhy? because it makes things easier to learn. Proof? nah, we don't need no proofs.
12:49:17FromGitter<krux02> Araq: there are two minor things in the language that I would like to talk about
12:49:41FromGitter<krux02> the nodes for if as an expression and as a statement is different.
12:49:51Araqactually they aren't.
12:50:09FromGitter<krux02> well the node kind is a different one, and therefore they are different
12:50:16Araqthey are pretty interchangeable
12:50:28Araqbut yeah, these need to be merged completely.
12:50:52Araqcould be tough for Karax though before we have "semityped"
12:51:20Araqbut go on please.
12:51:37*simonsolnes quit (Ping timeout: 260 seconds)
12:51:37FromGitter<krux02> well for the of else brach this is not that case.
12:52:08FromGitter<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:34FromGitter<krux02> but when the goal is to remove this distinction, then I think I have to find another way to distinguish this
12:54:04FromGitter<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:51FromGitter<krux02> ``let myval = if world.isOk: "myValue" else: quit("The World is not OK!!!")`` should be possible.
12:55:32FromGitter<krux02> when a branch does not return, it's value should not matter for type inference
12:56:01*simonsolnes joined #nim
12:56:20FromGitter<alehander42> @krux02 great. what do you mean about strVal exactly?
12:57:18FromGitter<krux02> well currently when I have the pattern _(strVal = "abcdef") it generates `node.matchValue("abcdef")` and completely ignores the identifier `strVal`
12:57:48FromGitter<krux02> in other words ``_(integerValue = "abcdef")`` would be exactly identical
12:58:23FromGitter<krux02> I would like to use this identifier a bit more intelligently now.
12:59:47FromGitter<alehander42> ah of course
13:00:15planetis[m]hey!
13:00:41FromGitter<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:24Araqkrux02: that's been implemented
13:03:36Araqbut maybe 'quit' needs a .noreturn annotation
13:03:37*xkapastel quit (Quit: Connection closed for inactivity)
13:03:58FromGitter<krux02> Araq: then why didn't it work when I tried to use it?
13:05:09Araqbut maybe 'quit' needs a .noreturn annotation
13:05:34Araqanyway, Nim needs 2 things most urgently.
13:05:47Araq(aside from the v1 release, that is)
13:05:52FromGitter<krux02> I didn't use quit, I used stackTrace in the compiler, and I usded a longer case-of expression
13:06:02Araq1. working symbol files.
13:06:23Araq2. some sort of semi-typed.
13:06:42FromGitter<krux02> does 1. mean faster incremental compilation?
13:06:48Araqyes.
13:06:53FromGitter<krux02> yay
13:07:16Araqthese 2 features are the big enablers for further language experiments / developments.
13:07:21FromGitter<alehander42> what are the blockers for incr compilation currently?
13:07:54FromGitter<krux02> @alehander42 I don't know the details, but afaik macros are evaluated on each compile
13:07:56Araqno more "but compile-times will suffer" arguments.
13:08:03*smt` joined #nim
13:08:16FromGitter<krux02> Araq: well that is not entirely true.
13:08:38FromGitter<krux02> compile times will still be very relevant
13:08:38Araqyes but then we can do meaningful measurements.
13:08:48Araqyes but then we can do meaningful measurements.
13:09:03Araqcurrently it's just pathetic, yes, every line you add increases compile-times.
13:09:56FromGitter<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:36FromGitter<krux02> I think that is the part where most of the expensive optimization algorithms happen.
13:10:59FromGitter<krux02> but I is just an assumption not knowledge
13:11:53FromGitter<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:57FromGitter<alehander42> is that the plan @Araq ?
13:12:01*smt quit (Ping timeout: 248 seconds)
13:12:05FromGitter<krux02> And when the Nim compiler is a very fast "preprocessor" that compiles very fast, then this approach is not the worst.
13:12:11FromGitter<krux02> But I know that is not the case
13:12:11Araqalehander42: exactly.
13:12:59FromGitter<alehander42> nice, sounds reasonable, so is it just a TODO, or are there some complications
13:13:19FromGitter<krux02> will this also improve test performance?
13:13:41Araqyes, once we enable it out of the box.
13:14:20Araqwell the involved internal refactorings are quite heavy, alehander42.
13:14:59FromGitter<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:00FromGitter<arnetheduck> Araq, given any thought on the intermediate AST? what it would look like?
13:15:27FromGitter<krux02> @mratsim I was able to has NimNode
13:15:50planetis[m]gitter -> IRC is not woking...
13:15:53FromGitter<krux02> and I already used Table in macros
13:16:36Araqarnetheduck: 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:59FromGitter<krux02> planetis[m]: that is not true otherwise I could not talk to Araq
13:18:01FromGitter<krux02> what do you mean by aliasing bugs?
13:18:08FromGitter<mratsim> @krux02 so what do you use? Otherwise I can probably convert to string and hash that.
13:18:25Araqmratsim: that's probably your best option for now
13:19:04Araqkrux02: macros can construct acyclic graphs instead of trees
13:19:23*smt` quit (Read error: Connection reset by peer)
13:19:32FromGitter<krux02> Araq: well that is true, but it can be declared illegal
13:19:39planetis[m]well smth not working cause I can read people's messages :p
13:20:01FromGitter<krux02> wait, I construct acyclic graphs
13:20:13FromGitter<krux02> hmm, no it still needs to be supported
13:20:24FromGitter<krux02> I revert it can't be declared illegal.
13:20:27FromGitter<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:41Araqand in the compiler we do wild node sharing too. Node = object kids: seq[Node] is the one way do enforce correctness
13:21:26FromGitter<krux02> `` var substitutionTable = newTableNimNode, NimNode ()``
13:21:40FromGitter<krux02> is in my codebase (old codebase that I did not look into for almost a year
13:21:45FromGitter<mratsim> @alehander42 I only need to hash unique nnkIdent so I just put an assert to prevent hashing other kinds by mistake
13:22:00FromGitter<alehander42> ok then it's easy
13:22:08FromGitter<arnetheduck> Araq, why btw is it that some current nodes have sons and others have kind-specific fields? astnode instance memory footprint?
13:22:45FromGitter<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:16Araqwhat do you mean?
13:23:29FromGitter<krux02> @alehander42 nope. there are literal nodes for that
13:23:43*smt joined #nim
13:23:53FromGitter<alehander42> @krux02 I know, I am explaining my theory why nodes have kind-specific fields
13:24:10FromGitter<alehander42> the literal nodes themselves have those intVal strVal etc
13:24:21FromGitter<krux02> because polymorphism
13:24:23FromGitter<arnetheduck> ``` ident*: PIdent ⏎ else: ⏎ sons*: TNodeSeq``` [https://gitter.im/nim-lang/Nim?at=5addde876d7e07082b2479d0]
13:24:46FromGitter<alehander42> ah ident
13:24:52FromGitter<arnetheduck> and so on for the other kinds..
13:25:13FromGitter<krux02> leaf nodes have fields, all other nodes have children
13:25:27FromGitter<arnetheduck> ie a function call node has 7-8 "fields" but they're stuck in `sons`
13:25:45FromGitter<alehander42> all non-leaf nodes have sons
13:25:47FromGitter<arnetheduck> @krux02 if only it were that consistent ;)
13:25:54FromGitter<alehander42> it is entirely consistent
13:26:14FromGitter<krux02> well in the compiler it is a little bit messier
13:26:15FromGitter<alehander42> you either need NimNode[T]: .. sons: seq[T]
13:26:30FromGitter<alehander42> which I admit might make sense, but probably not in the beginning
13:26:45FromGitter<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:50FromGitter<arnetheduck> I'm talking compiler here, not macros
13:26:51FromGitter<alehander42> or you need to add fields for everything, which isn't great with nim variants
13:26:55FromGitter<krux02> and maybe compiler intern that makes all sense
13:27:00FromGitter<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:57FromGitter<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:29Araqyou can't use generics here, it requires runtime polymorphism
13:28:52FromGitter<alehander42> so then having accessors for some `sons[index]` would be probably the best compromise
13:29:02FromGitter<krux02> Araq: It is compile time polymorphism ;)
13:29:19Araqkrux02: in the compiler that's runtime.
13:29:46*smt` is now known as smt
13:29:55AraqNim's compiletime is the compiler's runtime. <-- put this on a T-shirts
13:29:56FromGitter<krux02> I know, but it is still at compile time
13:30:47FromGitter<krux02> There were some Nim merch stuff to buy, I think i am too late for that, am I?
13:30:52FromGitter<mratsim> Nim compile-time static are Nim macro runtime :P
13:31:50*flyx quit (Quit: ZNC - http://znc.in)
13:32:08FromGitter<krux02> in static blocks you can mutate compile time switches
13:32:25Araqalehander42: accessors would have been a good idea, yeah
13:32:35FromGitter<krux02> mete programming really is the key selling point for Nim, and that is how it should be advertised.
13:33:07FromGitter<krux02> meta programming alone is not enough. That is already possible in lisp
13:33:12FromGitter<alehander42> @Araq well it's still your idea , you showed me macro nimnode accessors for one PR :D
13:34:09FromGitter<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:25FromGitter<krux02> Also key selling point is interoparability
13:34:34*noonien joined #nim
13:35:47FromGitter<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:15codevantagenice
13:37:54FromGitter<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:42FromGitter<arnetheduck> and as far as macros go, while they're cool and all, they also hurt code readability and predictability badly..
13:39:24FromGitter<alehander42> well every powerful feature needs use in moderation
13:39:49FromGitter<krux02> @alehander42 with power comes resposibility.
13:39:52Araqjust show the AST after the expansions, you argue for better editor integration all day long anyway
13:40:16FromGitter<krux02> I don't recommend a programming stley that sprinkles little macros everywhere in the codebase
13:40:44Araqand "predictability" doesn't mean much in a world where a[i] can take 4 cycles or 100.
13:41:18FromGitter<krux02> I think marcos are required to be documented well.
13:41:27Araqit's a word for C programmers so they can pretend they have an argument.
13:41:44FromGitter<krux02> C programming is all fine.
13:41:57FromGitter<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:07FromGitter<krux02> There are just some areas where I would not recommend to use anything else.
13:43:14AraqC -- 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:56Araqpeople who argue for C want Modula 2 instead, it's just that they don't know Modula 2.
13:44:10FromGitter<krux02> I don't know Modula 2.
13:44:16AraqI know.
13:44:17FromGitter<krux02> I know C though.
13:44:24FromGitter<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:41codevantagewhen i saw c i wanted the bracket, and semicolon removed and types, and not having to prefix everything
13:45:04FromGitter<arnetheduck> the hammer and nail syndrome? :)
13:45:06FromGitter<krux02> Still I would not recommend anything else than C for microcontroller programming
13:45:53AraqI would recommend C++ or Rust if you feel Nim is too immature for it.
13:45:59FromGitter<krux02> I stull miss the {} in Nim
13:46:38AraqI would never use C for anything, it's just bad.
13:46:59codevantagei dont mind brackets, but indentation must be enforced
13:47:15FromGitter<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:01Araqarnetheduck: 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:40FromGitter<krux02> Araq: It is predictable that C code has cryptic function names.
13:48:49FromGitter<arnetheduck> I'm not saying C is good at this - I'm challenging Nim to be better
13:49:10FromGitter<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:32FromGitter<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:59FromGitter<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:30FromGitter<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:23AraqC's simplicity is an illusion cause by insufficient knowledge of C.
13:52:56codevantagearaq c without macros?
13:53:00Araqyou can't even memcpy structs because they are allowed to have non-accessible holes by the spec.
13:54:11FromGitter<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:29FromGitter<krux02> I think c++ is the beast.
13:54:31Araqand 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:02Araqlike coming up with sanitizers for it.
13:55:12FromGitter<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:30FromGitter<krux02> Araq: I have a killer argument, why C is a great Language that will even convince you.
13:56:51Araqchallenge accepted.
13:57:56FromGitter<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:48Araqyeah and even as a compiler backend language it is really error prone.
13:59:11FromGitter<krux02> you could have chosen another backend language
13:59:16FromGitter<krux02> for example Modula 2
13:59:20FromGitter<krux02> you didn't
13:59:22codevantagellvm?
13:59:53FromGitter<krux02> codevantage: I think llvm did not exist in it's current state when Nim was initially developed.
13:59:59Araqcheck out the commits that changed sizeof(*result) to sizeof(typeof(*result)) (roughly speaking)
14:00:15codevantagekrux oh i forgot
14:00:24Araqand then come back and tell me about C's virtues.
14:00:51FromGitter<krux02> Araq: shouldn't that be identical?
14:01:03Araqheck yes, LLVM's IR is easier to use for human beings than C is.
14:01:05codevantagearaq does nim count as a c sanatizer?
14:01:41Araqkrux02: they are not.
14:01:45FromGitter<krux02> Araq: the problem is that LLVM's IR has only one backend, and that is LLVM
14:02:07codevantagellvm is being actively developed
14:02:26FromGitter<krux02> codevantage: that is not the point/argument
14:02:46*leorize quit (Ping timeout: 264 seconds)
14:03:08codevantageso using c is more portable?
14:03:11FromGitter<krux02> the point is that C can be compiled to Amiga, Dos, ..., PlayStation 3, IBM Mainframes, etc
14:03:29federico3...and microcontrollers
14:03:43FromGitter<krux02> LLVM can be compiled to ARM and x86
14:03:46FromGitter<krux02> I think
14:04:29FromGitter<krux02> those legacy systems are for most people not really an argument anymore, but for some.
14:04:53codevantagecant llvm also do that?
14:04:54FromGitter<krux02> And they are the past.
14:05:14FromGitter<krux02> codevantage: I don't know
14:05:22federico3codevantage: no
14:05:34codevantagewell thats not good
14:06:26codevantagebut maybe it might be better for nim to be less dependant on c?
14:06:30*rokups joined #nim
14:06:59FromGitter<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:01codevantageless magic and importc in builtin
14:07:08FromGitter<krux02> for example the intel compiler
14:11:44*miran joined #nim
14:12:33skelettkrux02: they _really_ have awesome error messages
14:13:51*simonsolnes joined #nim
14:14:06Araqkrux02: 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:49FromGitter<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:00codevantagemaybe one day nim will be the new c
14:17:05codevantagebut not
14:17:17codevantageu know what i mean
14:18:49FromGitter<krux02> no
14:18:53FromGitter<dom96> yay Araq still sees the value in exceptions
14:19:37FromGitter<krux02> i dont see value in exceptions
14:19:40FromGitter<dom96> I actually really like how he's explained their purpose
14:19:52FromGitter<dom96> For reference: https://irclogs.nim-lang.org/23-04-2018.html#12:38:19
14:21:20FromGitter<dom96> He also says symbol files are urgent
14:21:23FromGitter<dom96> I disagree
14:21:44FromGitter<dom96> This can be done after v1
14:23:09FromGitter<krux02> I like symbol files.
14:23:17FromGitter<krux02> Makes development on the compiler easier.
14:23:47FromGitter<krux02> It improves the quality of life not just for the core Nim programmers, but also of the entire Nim community.
14:25:45Araqdom96: 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:01Araqthen there will be arguments like "but builtin is faster to compile" ;-)
14:46:59FromGitter<krux02> I like macro based implementations. They are easier to develop.
14:48:05Araqsymbol files are also our ticket to get a better VM.
14:48:54Araqcompile the Nim macro snippet to native code and staticExec() it.
14:49:13Araqif that process is cached it will be fast enough
14:49:49Araqand the friction between compiletime and runtime will be mitigated.
14:50:19FromGitter<dom96> huh, won't that also enable FFI at compile-time?
14:50:41Araqyes.
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:29FromGitter<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:51FromGitter<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:00Araqit will just work(TM) of course.
15:06:05Araqwith magic.
15:06:08Araq;-)
15:06:24codevantagecontrolled magic
15:07:06*nixfreak joined #nim
15:09:53*Arrrr quit (Ping timeout: 248 seconds)
15:10:34FromGitter<krux02> Araq: I know what "magic" in Nim means. It means it is implemented at an undefined location, good luck finding it.
15:11:56codevantageor implemented in several scattered locations
15:12:23*endragor joined #nim
15:13:41codevantagecan 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:03FromGitter<Varriount> Araq: What is a nnkHiddenDeref?
15:19:25Araqa hidden dereference operation
15:20:07Araqyou wrote 'x = 1' and the compiler transformed it into 'x[] = 1'
15:20:55FromGitter<Varriount> Hm, well getCustomPragmaVal is coming on them.
15:21:19FromGitter<Varriount> I'll see if I can find out why
15:23:45FromGitter<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:05Araqkrux02: since you know how grepping for magics works you can't be serious.
15:40:39Araq"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:50CodeVantage_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:00FromGitter<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:19FromGitter<krux02> Araq: How do I use `range`
15:57:44FromGitter<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:12dom96oh damn, I sure got told here: https://www.reddit.com/r/programming/comments/8eat5o/calling_c_constructors_from_d/dxtxvmy/
16:13:03miranouch!
16:14:57*nsf quit (Quit: WeeChat 2.0.1)
16:15:20*athenot joined #nim
16:16:43miranwell, 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:02shashlicki'm searching for test cases in nim where command line flags are tested, anyone know where I should look?
16:29:15shashlickalso open to suggestions on how to test for https://github.com/nim-lang/Nim/pull/7677
16:29:36*jrbrt joined #nim
16:30:01FromGitter<krux02> http://ix.io/18xD
16:30:05*simonsolnes joined #nim
16:30:18FromGitter<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:35FromGitter<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:25CodeVantage_I just opened it in the browser and it broke nimsuggest o_o
16:52:46planetis[m]still not getting messages 😢
16:53:58FromGitter<krux02> CodeVantage_: yea, exactly
16:54:15FromGitter<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:52planetis[m]sameless self-advertising: https://github.com/notTito/morpheus
16:58:08planetis[m]its finally completed!
16:58:28miranb-but we have Neo?
16:59:34FromGitter<krux02> miran: Neo is my keyboard layout, what do you mean?
17:00:04FromGitter<krux02> planetis: shameless self-advertising: https://github.com/krux02/ast-pattern-matching
17:01:21FromGitter<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:38FromGitter<krux02> and that would be bad.
17:01:50FromGitter<krux02> Explain how your datastructures are layed out in memory.
17:02:21planetis[m]krux02: nice what is this used for?
17:02:38FromGitter<krux02> not yet anything, it is just completed
17:02:39planetis[m]but-but get over it lol :)
17:02:46FromGitter<Vindaar> @krux02 he's talking about https://github.com/unicredit/neo (unless you wanted to make a pun :P )
17:03:01planetis[m]friendly poke
17:05:10FromGitter<krux02> well I also wrote a matrix library for Nim
17:05:27FromGitter<krux02> nim-glm
17:07:08CodeVantage_lol this is how numpy started apparently
17:09:47Araqkrux02: I love your pattern matching but the docs has some typos. do you want to hear them?
17:10:05FromGitter<krux02> I am not good at typing
17:10:08FromGitter<krux02> but yes
17:10:21FromGitter<Vindaar> @CodeVantage_: what do you mean by "this"? don't know the history of numpy :)
17:10:24Araq"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:44Araq"but only" -- "but not" ?
17:11:18Araq`somename` @ <pattern> -- I would have used '<pattern> as somename'
17:11:29*Lord_Nightmare quit (Ping timeout: 248 seconds)
17:12:12Araqand 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:27FromGitter<krux02> well the @ syntax is just copiel over from scala
17:12:44Araq"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:55FromGitter<krux02> and I actually like it, because it has the same argument order as assignments
17:13:03CodeVantage_vindaar, basically everyone had their own seperate lib for math then they combined later on
17:13:10FromGitter<krux02> (identifier) = (expression)
17:13:14Araqthat seems questionable, why not do nothing instead?
17:13:27AraqI can always write 'else: error' on my own
17:13:52FromGitter<krux02> Araq: I can say the inverse
17:14:02FromGitter<krux02> I can always say else: discard
17:14:19planetis[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:09Araq„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:22Araq-- IME it's not worth it.
17:15:25CodeVantage_planetis, tests if you want to claim reliability
17:15:30Araqgood that you left it out :-)
17:15:45*Lord_Nightmare joined #nim
17:15:52FromGitter<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:58CodeVantage_nvm, planetis[m] i see you have tests
17:16:08planetis[m]CodeVantage_: they are right there :p
17:16:17Araqthe binding to variable problem is a tough one for |
17:17:07CodeVantage_I wish I could access enums through FileMode.fmWrite and fmWrite, (like with modules)
17:17:12FromGitter<krux02> what do you mean?
17:17:33FromGitter<krux02> at the moment I don't use the `|` operator for anything.
17:18:17AraqI 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:37Araqis a tough question with not many obvious solutions
17:18:52FromGitter<krux02> well that is a question I actually questioned myself, and I decided to not go that route.
17:19:22FromGitter<krux02> when the branch itself has a name, then I could access that name with member variables
17:19:30FromGitter<krux02> expr.subexpr
17:19:44FromGitter<krux02> I think regular expressions can do that
17:20:40*cspar joined #nim
17:21:25FromGitter<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:19Araqyeah.
17:25:36Araqwhat 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:03FromGitter<krux02> what do you mean with recurse?
17:26:36*btbytes joined #nim
17:26:45FromGitter<krux02> iterating an ast and matching ast nodes is orthogonal to pattern matching
17:28:28Araqyeah but it's related and 'recurse' is a messy construct otherwise
17:28:34Araqresult = copyNimNode(n)
17:28:41Araqfor c in n:
17:28:49Araq result.add self(c)
17:29:00*Arrrr quit (Quit: Leaving.)
17:29:16Araqwhere 'self' is the current transformation plus the parameters it might require
17:29:40Araqmatch against a, b, c, recurse otherwise.
17:29:53Araqis the most common thing to do in macros. ever.
17:30:03FromGitter<krux02> yea I actually thought about it.
17:31:08FromGitter<krux02> I might implement it.
17:31:59shashlickkrux02: can you please offer a real world example of using the ast pattern matching lib?
17:33:02FromGitter<krux02> well I have this library here https://github.com/krux02/opengl-sandbox
17:33:54FromGitter<krux02> the dsl has several constructos
17:35:38FromGitter<krux02> and these constructs need to be matched
17:35:51FromGitter<krux02> at the moment there is a lot of if arg.kind == ...
17:37:55FromGitter<krux02> pattern matching just makes it much easer
17:38:17shashlickgreat work :)
17:38:48Araqyeah, it's great.
17:39:58shashlickaraq: 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:56Araqshashlick: tests can have customized compiler commands
17:42:11Araqcheck 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:05shashlickaraq: 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:14Araqcmd: "nim c --genscript $1 && nimcache/foo_script.sh"
18:00:27Araqos: "linux"
18:01:03Araqprobably testament is a dick and doesn't allow for &&, then you need a customized test "category" but you get the idea
18:06:01shashlickso we won't be able to test this on windows simultaneously?
18:06:23shashlickmeh, just two test cases I guess
18:06:54FromGitter<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:22FromGitter<krux02> The entire language Nim doesn't like to implicityl discard values, so it is consistent.
18:07:23*simonsolnes joined #nim
18:07:37AraqI will de-deprecate missing 'else: discard' sections for string cases though.
18:07:54Araqif I haven't already, not sure.
18:08:11FromGitter<krux02> you should make the missing case raise an error by default.
18:08:29Araqa "do nothing otherwise" is not the same as discarding a value
18:08:41Araqbut I get your point.
18:09:16FromGitter<krux02> Just think about using the case-of as an expression.
18:09:19Araqif itIsRaining: buyAnUmbrella()
18:09:34Araq# <-- no 'else' required here and Nim doesn't complain.
18:09:37FromGitter<krux02> let myval = case(mystring):
18:09:38*Senketsu_ quit (Quit: WeeChat 2.1)
18:10:05Araqyeah well, expressions are often more annoying to work with :P
18:10:23FromGitter<krux02> well I like expressions a lot
18:10:32FromGitter<krux02> especially for initialization
18:10:53FromGitter<krux02> It's easier to track all the possible code branches in my head
18:11:03FromGitter<krux02> I will know that a value is initialized
18:11:36FromGitter<krux02> much better than" var something: XYZ; ... if ...: something = ...; elif: something = ...
18:11:49FromGitter<krux02> and then in the end you can't be sure that something is initialized
18:12:04FromGitter<krux02> wel you can, but using the if as an expression ensures it at compiler time
18:12:08Araqthat's actually a language quirk I want to get rid of.
18:12:23FromGitter<krux02> what do you want to get rid of?
18:12:30*Senketsu_ joined #nim
18:12:38Araqthe compiler should enforce explicit initialization for locals
18:12:40FromGitter<krux02> if as an expression?
18:13:30Araqit 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:39FromGitter<krux02> so the compiler should check for all possible code branches?
18:13:51Araqit can do it already.
18:14:18Araqthe only downside is the asymmetry between stack slots and heap slots
18:14:53FromGitter<krux02> Ihave no idea what you mean by stack slots and heap slots
18:15:19Araqtake C# or Java for example.
18:15:49Araqfields in classes are default initialized, local variables are forced to be init'ed explicitly.
18:16:02Araqwhy is that?
18:16:27shashlickaraq: 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:43Araqbecause it's harder to do that for class fields (aka the heap)
18:17:34FromGitter<krux02> aren't locals also default initialized in Java?
18:17:35FromGitter<Varriount> shashlick: Isn't that `&&` something the shell handles?
18:17:48FromGitter<krux02> they are 0 by d
18:17:51FromGitter<krux02> y default
18:17:54FromGitter<krux02> (null)
18:17:56FromGitter<Varriount> I know I've used `&&` before with Nim.
18:17:58Araqkrux02: no, the compiler makes you init them.
18:18:17FromGitter<krux02> I haven't programmed java since java 1.6
18:18:25Araqyeah, the tester is not a shell.
18:18:36*endragor joined #nim
18:18:39Araqkrux02: that feature was in java 1.0. iirc.
18:19:09FromGitter<krux02> well my memory is not permanent I guess
18:19:26FromGitter<krux02> I forget details.
18:20:28FromGitter<krux02> Araq did you see the issue I created:
18:20:29shashlickSo question is whether I should make testament smarter or add a second test case to verify the first worked
18:20:55FromGitter<krux02> with a fairly short code that doesn't even use marcos, I get the compiler to hang up.
18:20:57shashlickEg add a cmds option to testament to allow multiple commands
18:21:01Araqshashlick: write a custom category for testament.
18:21:34Araqcheck category.nim for how to do that, it's rather easy
18:22:11shashlickDo 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:56Araqwell 'cmd' was good enough until now.
18:26:13Araqand used to test command line options.
18:26:54Araqkrux02: static[T] bug? :P
18:28:21FromGitter<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:37FromGitter<krux02> but aparently it breaks the compiler to do so
18:28:37AraqI noticed.
18:29:55Araqbut as I said, range[1..2] is a subtype of int, static[int] is a ... that matches even better in overloading resolution?
18:30:04FromGitter<krux02> and really it is not much code at all to leverage that functionality into nim, it doesn't even need macros
18:30:23AraqI know how to fix range.
18:30:25*smt` joined #nim
18:30:33AraqI don't know how to fix static[T].
18:30:55AraqI don't know why we need to replace a simple feature by a beast.
18:31:24Araqjust because you like your arrays to only support simple numbers.
18:31:43FromGitter<krux02> yes
18:32:20FromGitter<krux02> I don't know how static[T] is implemented, but it is surely one of nims more powerful features
18:33:12FromGitter<krux02> but range is one of nims obscure and useless features.
18:33:37Araqit'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:58shashlickaraq: ok I'll see if categories or a cmds[] option makes more sense
18:33:58FromGitter<krux02> range could easily be implementey with static[int]
18:34:03Araqand 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:30CodeVantage_why does C2NIM remove typedef struct?
18:34:39FromGitter<krux02> type Range[low,high: static[int]] = distinct int
18:35:04Araqall these points are not valid points for static[T] which is just in its own category of things.
18:35:36FromGitter<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:46Araqyou complained about the different type relations in the manual and yet you're happy with the "convertible to static[T]" relation
18:36:08Araqwhich the manual doesn't even mention anywhere explicitly afaik.
18:36:54FromGitter<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:01CodeVantage_krux02, :'( It just removes the statments. Keeping the comments.
18:37:02FromGitter<krux02> There it is clearly a value, not a type.
18:37:05CodeVantage_oh well
18:38:20FromGitter<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:55AraqCodeVantage_: because it mistakes it for a pointless forward declaration
18:38:59FromGitter<krux02> that also means that when the original header changes, you have to alse bring these updates manually into the nim wrapper
18:39:09CodeVantage_Ya I just used a multicursor to modify 3 typedefs at once
18:39:32CodeVantage_I want a c2nim template thingy
18:39:53CodeVantage_I don't want to even touch the original source
18:40:08CodeVantage_But its all good as long as you don't update... right?
18:40:42Araqthere is a package on top of c2nim that is more convenient to use but I forgot its name
18:40:45FromGitter<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:47FromGitter<krux02> yes
18:40:49FromGitter<mratsim> @Araq, nimgen
18:41:27FromGitter<mratsim> https://github.com/genotrance/nimgen
18:41:28FromGitter<krux02> neural networks are super trendy at the moment
18:41:38FromGitter<krux02> as well as bitcoins.
18:41:43FromGitter<mratsim> blockchain is trendier than neural net though :P
18:42:17FromGitter<mratsim> I’m spammed on my LinkedIn with people trying to ride the waves ...
18:42:29FromGitter<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:35FromGitter<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:03CodeVantage_nimgen makes me download everything again. internet isnt free :(
18:46:51FromGitter<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:13FromGitter<krux02> Using Nim is by the way totally against the flow.
18:47:24FromGitter<krux02> Rust is booming.
18:47:32FromGitter<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:10FromGitter<Varriount> Bah
18:55:21FromGitter<Varriount> @dom96 Let
18:55:35FromGitter<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:45FromGitter<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:59shashlickCodeVantage_: what are you trying with nimgen? you can configure it to do a sparse download
19:01:51shashlickand 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:07CodeVantage_shashlick, how does one do that
19:02:20CodeVantage_I already downloaded nimgen
19:02:24CodeVantage_I wanted to test it out
19:02:31*yglukhov joined #nim
19:02:36CodeVantage_but nimble install is a bit too involved
19:02:43CodeVantage_it wanted me to download nim
19:02:45CodeVantage_from git
19:02:54CodeVantage_which I've already done
19:03:03shashlickoh okay, ya it needs the latest nim since it needs c2nim installed
19:03:28shashlickdo you have a working c2nim already?
19:03:33CodeVantage_c2nim is already in the normal nim right?
19:03:37CodeVantage_in the release version
19:03:46CodeVantage_ya and a c2nim repo
19:03:55shashlickwhat version of nim do you have? nim -v
19:07:11*yglukhov quit (Ping timeout: 265 seconds)
19:07:15CodeVantage_0.18
19:07:56*jaco60 quit (Ping timeout: 276 seconds)
19:08:33shashlickand what version of c2nim? c2nim -v
19:09:31CodeVantage_0.9.12
19:10:33shashlickokay, 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:37shashlickdom96 ^^
19:10:49shashlickwell, easiest would be to just clone the repo, update the .nimble file and then nimble build
19:12:31CodeVantage_because it wants the github version I think
19:12:51CodeVantage_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:13CodeVantage_THe #@ @# feature with c2nim is convenient though
19:13:46shashlickso the goal of nimgen is to help automate c2nim so that it is easy to use the latest C lib source
19:14:03shashlickwill 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:31CodeVantage_are there some?
19:17:53*Senketsu_ quit (Client Quit)
19:18:12CodeVantage_nvm i see the wrappers
19:25:20FromGitter<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:43FromGitter<tim-st> Does someone has an example code for generating code for a case construct via macros or similiar?
19:38:58Araqtim-st: https://github.com/Araq/ormin/blob/master/ormin/dispatcher.nim#L34
19:39:33FromGitter<tim-st> Thanks!
19:39:57*cspar quit (Ping timeout: 240 seconds)
19:40:09*SenasOzys joined #nim
19:40:18FromGitter<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:29Araqtim-st: what's usually more important is that 'case' is a control flow construct and a table isn't.
20:05:54Araqwhen you have a table of proc vars they all need to have the same signature
20:06:09Araq'case' doesn't have this limitation.
20:09:18FromGitter<tim-st> ok thanks, I didnt meant to make it generally, just for my specific use case i think it's better
20:14:17shashlickaraq: 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:39Araqshashlick: just make it work.
20:15:16Araqif you split by && that's fine but don't support || then.
20:15:50Araqor use
20:15:59Araqcmd: '''first command
20:16:03Araqsecond command
20:16:04Araq'''
20:16:17Araqthat's how the other things in testament do it
20:19:59shashlickok 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:18CodeVantage_How do you assert that an object has a proc
20:34:38CodeVantage_like I want to know whether the object can call "add"
20:35:29*PMunch quit (Quit: leaving)
20:36:04FromDiscord<claude> `when compiles(add(obj))`
20:36:40FromDiscord<claude> or use a concept
20:38:09CodeVantage_that's what I'm trying :}
20:38:11CodeVantage_:|
20:39:24CodeVantage_Well I don't have two variables to try that with
20:39:32FromGitter<data-man> Wow! Typedesc reforms: https://github.com/nim-lang/Nim/pull/7681
20:39:48CodeVantage_I want to know if there's a proc matching
20:39:48*yglukhov quit (Remote host closed the connection)
20:40:42FromDiscord<claude> then you'll need a concept
20:41:16FromDiscord<claude> ```nim
20:41:16FromDiscord<claude> type Addable = concept x
20:41:16FromDiscord<claude> x.add(int)
20:41:16FromDiscord<claude> ```
20:41:34CodeVantage_THank you :)
20:42:30FromDiscord<claude> oh i didnt realize, did that code block even pass through correctly
20:44:17CodeVantage_yup
20:44:31CodeVantage_If it didn't I coulda just visited the link i think
20:44:46CodeVantage_How to make a list/seq/openarray of Concept objects?
20:44:55CodeVantage_can you even?
20:46:37CodeVantage_nvm found it ` type T2 = seq[SomeNumber]`
20:52:41dom96you can't
20:53:19*btbytes quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
20:55:24CodeVantage_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:26shashlickare you guys picky about removing "declared but not used" warnings?
21:03:57*simonsolnes quit (Ping timeout: 255 seconds)
21:05:29FromDiscord<claude> if you want to remove it for one declaration you can use `{.used.}`
21:09:22Araqshashlick: usually yes. means I forgot an export marker.
21:09:51Araqin the compiler I have them turned off, I think. the compiler is not important enough... *cough*
21:15:16shashlickso testament has a few warnings, minor but while i'm in there, I could either {.used.} them or comment them out
21:15:52Araqremove them
21:18:10shashlickcool
21:18:11*yglukhov joined #nim
21:18:51shashlickthere'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:50Araqoh yeah, it's
21:20:02Araqdisabled: "windows" then
21:20:21*yglukhov joined #nim
21:20:23shashlicksufficient to test on one OS?
21:20:45Araqwell I doubt .bat file generation works
21:22:52shashlickit works
21:22:56*nsf joined #nim
21:27:40*jrbrt quit (Quit: jrbrt)
21:30:22Araqthen don't have 'disabled: windows'
21:31:17shashlickbut the command lines are different, bat vs .sh and also paths
21:33:02Araqtold you to create a category for it :P
21:33:14Araqdeclarative programming fails once again.
21:37:35FromGitter<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:28Araqit doesn't work.
21:41:11Araqthe 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:03Araqso that you can always have a fallback when the declarative aspect fails. and that happens often.
21:42:18Araqthat's why you cannot build a compiler just with regular expressions.
21:42:37Araqok, the Perl people try that...
21:45:11*simonsolnes joined #nim
21:45:13FromGitter<alehander42> :D one of my ideas is exactly a set of dsl-s for building not very complicated languages
21:45:51FromGitter<alehander42> I agree you need imperative programming for everything, but some problem domains/aspects can be modelled pretty well 90% without it
21:46:51FromGitter<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:14FromGitter<alehander42> a lot of simpler type systems can be expressed as a dsl on top of some rules
21:47:49FromGitter<alehander42> and a big part of code generation can be also declarative
21:49:34FromGitter<alehander42> now, this would be enough just for a simpler class of "languages', but is still impressive
21:50:01Araqwell yeah, that's what GCC and LLVM do.
21:50:39Araqthe use DSLs to describe the code generation
21:50:58Araqand lexer and parser generators are a thing too.
21:51:00FromGitter<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:38shashlickthe 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:51FromGitter<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:04shashlickif 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:12Araqshashlick: a category is just a special case. a special case for one test is fine.
21:52:29shashlickokay that's fair
21:52:48FromGitter<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:58FromGitter<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:10FromGitter<mratsim> so Arraymancer is for that gap between research and prod.
21:53:29*nsf quit (Quit: WeeChat 2.0.1)
21:53:36shashlickdo you still feel the multiple cmds feature is useful or should I ditch that cmd = '''...\n...\n'''
21:53:40FromGitter<alehander42> but it's pretty cool, e.g. you can model generics with prolog unification etc, its basically builtin
21:54:37Araqshashlick: every feature in the tester that we don't need now is just cruft that makes the tester harder to understand.
21:55:05federico3TIL: https://repology.org/metapackage/nim/badges
21:55:17FromGitter<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:59shashlickmratsim: I'll just comment out for now, that way they are still there
21:58:05*CodeVantage_ joined #nim
21:58:16shashlickaraq: no multiple cmds then, i'll look into a new category
21:58:30Araqwe have git's history for that
21:58:33Araqbut ok.
21:58:39FromDiscord<claude> are there naming conventions for block labels
21:59:01Araqblock found:
21:59:08FromGitter<mratsim> or keep them in a gist
21:59:09Araqthat's it.
21:59:26Araqblocks should be named 'found'.
21:59:34Araq:-)
21:59:42FromDiscord<claude> nice
21:59:50*arecaceae quit (Remote host closed the connection)
22:00:00FromGitter<mratsim> block tetris:
22:00:14*arecaceae joined #nim
22:00:28Araqblock spammers:
22:01:04federico3is it a game?
22:01:06federico3block chain:
22:01:11FromGitter<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:33dom96in 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:15shashlicki'm adding a new tests\flags directory/category - suspect there's other such nim flags which need special test cases
22:06:16dom96oops, thought this was -offtopic. Oh well.
22:06:56dom96federico3: wow, repology is awesome
22:07:19federico3I found it only after putting together https://badges.debian.net/
22:08:37dom96It'd be nice to integrate this tastefully into https://nim-lang.org/install_unix.html
22:10:06FromGitter<mratsim> so much negativity in that thread @dom96
22:10:18dom96mratsim: yep :(
22:10:40FromGitter<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:42dom96there is :P
22:13:49dom96https://www.reddit.com/r/programming/comments/8eat5o/calling_c_constructors_from_d/dxugx7o/
22:13:55dom96Among a list of others, but still
22:15:40*jjido_ quit (Client Quit)
22:17:57federico3well, 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:54skrylarso i had to live under a rock for a while
22:28:24dom96federico3: Is it not just for distros?
22:28:52dom96federico3: This already has Nimble support: https://libraries.io/
22:29:11dom96It needs an updated logo oh so badly
22:29:49federico3it's tracking language-specific packaging as well
22:29:55*cspar joined #nim
22:33:08FromDiscord<claude> go has more packages than npm
22:33:09FromDiscord<claude> wow
22:35:07FromDiscord<treeform> that is surprising
22:35:18dom96libraries.io offers some nice features actually
22:40:18*btbytes joined #nim
22:55:33*cspar quit (Ping timeout: 268 seconds)
23:00:00shashlickwhy are the rodfiles tests disabled in testament?
23:07:57*noonien quit (Quit: Connection closed for inactivity)
23:08:39FromGitter<Varriount> I believe because the rodfiles functionality is incomplete at the moment.
23:14:28FromGitter<zacharycarter> well vault went out at work today
23:14:45FromGitter<zacharycarter> and then the team that manages vault brought down vault because of terraform
23:17:57FromGitter<zacharycarter> ¯\_(ツ)_/¯
23:26:38*max3 joined #nim
23:32:11*jrbrt joined #nim
23:32:22FromGitter<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:11FromDiscord<bodie> Does anyone know whether there's a healthy Nim implementation of Flatbuffers?
23:39:51FromDiscord<bodie> Having that "Just Work" in WASM and server would be pretty neat.
23:45:04FromGitter<zacharycarter> I don't know if there is one bodie - but if not I'd love it if you created one :D
23:45:33FromGitter<zacharycarter> according to nimble.directory - it doesn't look like there is one pre-existing
23:49:38FromGitter<krux02> bodie: Implementing something equivalent of flatbuffers with macros is honestly just a few lines of code
23:50:42FromGitter<zacharycarter> yeah but isn't flatbuffers a spec?
23:50:50FromGitter<zacharycarter> so like - Nim supporting it - would be a good thing?
23:51:07FromGitter<krux02> yea, but I said "something equivalent"
23:51:15FromGitter<krux02> not really
23:51:47FromGitter<krux02> there is not tons of data out there that is in flat buffer spec encoded
23:51:58FromGitter<krux02> if you want data in that format you have to define it on your own
23:52:16*leorize joined #nim
23:52:47FromGitter<zacharycarter> right right - but like the flatbuffers library has several implementations in different languages and it's best associated with google
23:53:04FromGitter<zacharycarter> so to like - feed into that ecosystem would suit Nim best right?
23:53:12FromGitter<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:20FromGitter<zacharycarter> I mean it'd be sweet to see Nim mentioned on the readme - https://github.com/google/flatbuffers
23:53:24FromGitter<krux02> macros can do the code generation
23:53:36FromGitter<zacharycarter> okay I see what you mean I think
23:53:46FromGitter<krux02> yea for Nim advertisement, but I am not sure how well that will work out.
23:53:57FromGitter<krux02> but sure it is good if nim is mentioned everywhere
23:54:09FromGitter<zacharycarter> well - I think this is one of the things that Nim developers need to maybe think about more
23:54:18FromGitter<zacharycarter> is like promoting Nim by providing implementations for popular technologies
23:54:33FromGitter<zacharycarter> thusly Varriount and I are working on the aws sdk stuff
23:54:42FromGitter<zacharycarter> It'd be sweet to eventually see a graphql lib for Nim
23:54:51FromGitter<zacharycarter> more libs supporting things like flatbuffers, etc
23:55:12FromGitter<zacharycarter> because these are things people look at when they consider Nim as a tech, especially in the enterprise world
23:55:37FromGitter<zacharycarter> like - I'd like to see us as programmers have access to a native and managed language
23:56:08FromGitter<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:29FromGitter<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:27FromGitter<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:05FromGitter<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:21FromGitter<zacharycarter> domains rather