00:18:37 | FromDiscord | <mratsim> should I nil a pointer after a destruction with arc/newruntime? |
00:18:45 | FromDiscord | <Clyybber> not needed |
00:19:07 | FromDiscord | <Clyybber> But you should during destruction |
00:19:28 | FromDiscord | <mratsim> and with the normal runtime is it zero-ed? (i.e. due to the seq not respecting =destroy, i call them manually) |
00:19:40 | FromDiscord | <mratsim> ah in the destructor I nil stuff |
00:20:19 | FromDiscord | <Clyybber> I don't know about the normal runtime |
00:20:34 | FromDiscord | <Clyybber> sorry |
00:21:15 | FromDiscord | <mratsim> well if I want compatibility between both normal and new I have to nil |
00:21:23 | FromDiscord | <mratsim> and in destroy i check if it's not nil |
00:21:39 | FromDiscord | <mratsim> so that I don't double destroy (in my case decrement refcount multiple time) |
00:46:14 | skrylar[m] | disruptek: mumble mumble delta debugger mumble |
00:46:23 | disruptek | oh yeah? |
00:46:45 | disruptek | this is what golden is supposed to do, if anyone would get a round tuit. |
00:47:15 | skrylar[m] | i've used picire on nim code. although that was with linewise |
00:47:31 | skrylar[m] | if you have an antlr grammar it will use that to try and fuzz stuff with the syntax tree instead |
00:48:33 | disruptek | you're a wildman, but i'm not too worried about fuzz. |
00:48:48 | skrylar[m] | it doesn't do fuzz testing |
00:49:15 | skrylar[m] | if it has a parser it will try to use the ast nodes for the remove and test steps, otherwise it has to use either blocks of lines or chars |
00:49:40 | disruptek | oh, that's nuts. |
00:49:51 | disruptek | i am okay with commit resolution. |
00:50:07 | skrylar[m] | bisects? |
00:50:11 | disruptek | yeah. |
00:50:44 | skrylar[m] | those are also nice, but the dd will strip a test case down to the minimum function to exhibit a breakage, assuming the test script is looking for the right thing |
00:50:53 | disruptek | right, i get it now. |
00:51:09 | disruptek | maybe something to add once bisects work. |
00:51:23 | skrylar[m] | bisects don't work? o.O |
00:51:27 | disruptek | it should be pretty awesome to watch it hone in on performance regressions. |
00:51:34 | disruptek | i mean, when golden can run unattended. |
00:51:54 | skrylar[m] | well, now you know of the tools to exhibit less effort. i dun care why you don't use it ^^ |
00:52:03 | disruptek | lol thanks. |
01:00:54 | * | ng0 quit (Quit: leaving) |
01:09:20 | disruptek | nimph needs more windows users. |
01:12:24 | * | smitop quit (Quit: Connection closed for inactivity) |
01:20:19 | * | Lord_Nightmare quit (Read error: Connection reset by peer) |
01:31:51 | * | d-nice2[m] joined #nim |
02:21:14 | * | dwdv quit (Ping timeout: 240 seconds) |
02:32:13 | * | couven92 quit (Ping timeout: 260 seconds) |
02:38:44 | FromGitter | <beshrkayali> Hey folks! I'm a new Nim fan! started writing something and wanted to share: https://github.com/beshrkayali/webdavclient/ :) |
02:39:02 | disruptek | neat, welcome. |
02:39:22 | disruptek | how are you finding the github actions? |
02:39:39 | FromGitter | <beshrkayali> thanks! |
02:40:12 | FromGitter | <beshrkayali> pretty neat, had some trouble with sdl stuff for another project, but for this one it worked fine |
02:40:47 | disruptek | did you just muddle through it from scratch? |
02:43:50 | FromGitter | <beshrkayali> more or less yeah, had to because of work, but my use is still pretty basic for it |
02:44:04 | disruptek | does it seem fast? |
02:44:49 | FromGitter | <beshrkayali> yeah, you'd get queued up sometimes, but I haven't had to wait for more than a minute |
02:45:11 | FromGitter | <beshrkayali> and i assume orgs / paying customers have special treatment |
02:45:39 | disruptek | nice. i think i want to integrate nimph into actions directly. |
02:48:52 | FromGitter | <beshrkayali> it works nicely so far for me, also kind of easier to have ci close to repo |
02:50:35 | disruptek | right; i like it. i don't like that it's graphql, but what can you do... |
02:53:30 | * | endragor joined #nim |
02:54:51 | FromGitter | <beshrkayali> oh, you mean github api? graphql is pretty nice i think :) |
02:55:27 | disruptek | it's more work for me to support. |
02:55:53 | disruptek | iirc, we don't have a native graphql yet, either. |
02:58:34 | * | endragor quit (Ping timeout: 258 seconds) |
03:00:28 | FromGitter | <beshrkayali> ah true, I don't think i've encountered something like that... |
03:00:49 | FromGitter | <beshrkayali> there's a native c query parser tho |
03:01:00 | disruptek | shashlick has a lib, but nimql is empty iirc. |
03:09:16 | FromGitter | <beshrkayali> i guess it'd be easier to just make a wrapper for the official c parser |
03:10:28 | disruptek | that's what shashlick's lib is. |
03:10:38 | disruptek | !repo genotrance/nimgraphql |
03:10:39 | disbot | https://github.com/genotrance/nimgraphql -- 9nimgraphql: 11Nimgraphql is a Nim wrapper for the libgraphqlparser library 15 15β 2π΄ |
03:14:24 | FromGitter | <beshrkayali> ah cool, didn't know |
03:15:38 | disruptek | it's tricky; we can't be choosey yet as to how we get this stuff working, but on the other hand, non-native libs are significantly harder to support. |
03:21:26 | FromGitter | <beshrkayali> true |
03:22:18 | FromGitter | <beshrkayali> just remembered, for github actions, found this action before that sets up a nim env, works great https://github.com/marketplace/actions/setup-nim-environment |
03:22:53 | disruptek | nice, that'll help. |
03:45:52 | * | endragor joined #nim |
03:53:43 | * | dddddd quit (Remote host closed the connection) |
04:00:36 | * | muffindrake quit (Ping timeout: 248 seconds) |
04:02:49 | * | muffindrake joined #nim |
04:09:14 | * | endragor quit (Remote host closed the connection) |
04:09:20 | * | endragor joined #nim |
04:11:31 | * | sagax quit (Remote host closed the connection) |
04:25:05 | * | marmotini_ joined #nim |
04:38:28 | * | chemist69 quit (Ping timeout: 248 seconds) |
04:40:44 | * | chemist69 joined #nim |
04:53:25 | FromDiscord | <snluu> when I ran `nim js` with `-d:release`, i'm getting the error `/usr/local/Cellar/nim/1.0.4/nim/lib/system.nim(3411, 42) Error: 'asmNoStackFrame' should be: 'asmNoStackframe'` |
04:53:42 | FromDiscord | <snluu> compiles just fine in debug mode |
05:13:16 | * | cyraxjoe joined #nim |
05:13:16 | * | marmotini_ quit (Remote host closed the connection) |
05:13:50 | * | marmotini_ joined #nim |
05:15:38 | * | MightyJoe quit (Ping timeout: 268 seconds) |
05:16:18 | * | marmotini_ quit (Remote host closed the connection) |
05:16:36 | * | marmotini_ joined #nim |
05:22:32 | * | sagax joined #nim |
05:24:24 | * | marmotini_ quit (Remote host closed the connection) |
05:25:00 | * | marmotini_ joined #nim |
05:28:32 | disruptek | this is kinda horrible. |
05:28:36 | disruptek | !code in:file "proc reverse" algorithm |
05:28:37 | disbot | https://github.com/nim-lang/Nim/blob/b03de8a4d9926b03da2ed5cd8cde16ab22d31a97/lib/pure/algorithm.nim -- 11lib/pure/algorithm.nim |
05:28:49 | disruptek | !code in:file isTurnedOn |
05:28:50 | disbot | https://github.com/nim-lang/Nim/blob/0ff23e696c1e239214dfc2f1d2bb3e8fc6bf9493/compiler/pragmas.nim -- 11compiler/pragmas.nim |
05:29:40 | disruptek | !code in:path pure/sugar |
05:29:40 | disbot | no results π’ |
05:29:50 | disruptek | !code in:path sugar |
05:29:51 | disbot | https://github.com/nim-lang/Nim/blob/a0aa8fa857b5bd6db4395ca62e2b4618f6876873/lib/pure/sugar.nim -- 11lib/pure/sugar.nim |
05:30:00 | * | marmotini_ quit (Ping timeout: 268 seconds) |
05:31:32 | * | marmotini_ joined #nim |
05:36:35 | FromDiscord | <Stuffe> Normally when I compile it only takes a second or two. But every few times it takes a full minute, which very painful. Does anyone have any idea why? |
05:38:40 | disruptek | no, but is it reproducible? |
05:40:13 | disruptek | i've never heard of such a thing, fwiw. |
05:52:43 | FromDiscord | <crates> any of you guys use godot-nim? Getting an error when I try to build it: |
05:52:43 | FromDiscord | <crates> https://cdn.discordapp.com/attachments/371759389889003532/662896167348076544/unknown.png |
05:52:54 | FromDiscord | <crates> I've checked the directory it's searching for the c file in and there is a nim file but no c file |
05:54:56 | * | marmotini_ quit (Remote host closed the connection) |
05:55:25 | FromDiscord | <Stuffe> disruptek, No it is not reproducible. It happens regardless of the code |
05:55:29 | * | marmotini_ joined #nim |
06:00:02 | * | marmotini_ quit (Ping timeout: 268 seconds) |
06:11:30 | * | marmotini_ joined #nim |
06:17:08 | * | vesper11 quit (Ping timeout: 248 seconds) |
06:17:19 | * | vesper joined #nim |
06:52:11 | * | marmotini_ quit (Remote host closed the connection) |
06:53:17 | * | marmotini_ joined #nim |
06:53:18 | * | marmotini_ quit (Remote host closed the connection) |
06:53:31 | * | marmotini_ joined #nim |
07:02:55 | Araq | Stuffe: antivir software? |
07:10:20 | * | narimiran joined #nim |
07:39:32 | * | jjido joined #nim |
07:41:47 | * | solitudesf joined #nim |
07:50:02 | FromDiscord | <Stuffe> No antivirus. Do "echo" commands flush and show up in the terminal immediately? I am echoing first thing in my code, but the hang occurs between compile warning messages and the first echo message |
07:54:39 | Zevv | Stuffy: I assume you use `nim c -r` to compile and run in one go? |
07:55:02 | Zevv | Split them up, first compile with `nim c stuff.nim` and then run with `./stuff` |
07:55:14 | * | marmotini_ quit (Ping timeout: 240 seconds) |
07:55:15 | Zevv | then you can tell if its the compilation or the running |
07:55:21 | Zevv | (although its probably the first) |
07:55:31 | * | sealmove joined #nim |
07:55:55 | * | marmotini_ joined #nim |
07:57:55 | Zevv | leorize[m]: https://github.com/brammool/vim9/blob/master/README.md |
07:58:53 | * | icyphox left #nim ("Leaving") |
08:00:00 | * | gmpreussner quit (Quit: kthxbye) |
08:01:23 | sealmove | hola Zevv, happy 2020! |
08:05:18 | * | gmpreussner joined #nim |
08:06:09 | Zevv | same dude! |
08:06:37 | * | nsf joined #nim |
08:08:36 | Zevv | My accountant warned be to be explicit about writing dates this year, always write out the full "2020" because "20" can be changed in any other year. He's not wrong. |
08:09:07 | Zevv | so you made a good start, otherwise I could have changed your best wishes in "happy 2019", imagine that! |
08:16:47 | FromDiscord | <Stuffe> Zevv, Ok I will try that |
08:17:31 | sealmove | oh that's smart |
08:43:35 | * | endragor quit (Remote host closed the connection) |
08:45:43 | sealmove | if you have a nim expression as a NimNode, is there a magical way to get the type it resolve to? |
08:49:45 | sealmove | basically I want to do type algebra T_T |
08:49:49 | sealmove | terrifying |
08:58:50 | FromDiscord | <Stuffe> Zevv and Araq, in case you want to know, I was compiling with -d:debug and --debuginfo, turning that off seems to have fixed it |
09:02:18 | sealmove | nim's equivelant of C++ auto is auto? |
09:02:22 | sealmove | or any? |
09:06:56 | * | marmotini_ quit (Remote host closed the connection) |
09:07:29 | * | marmotini_ joined #nim |
09:12:26 | * | marmotini_ quit (Ping timeout: 268 seconds) |
09:14:16 | Araq | Stuffe: are you on OSX? |
09:14:51 | FromDiscord | <Stuffe> Yes, OSX Catalina |
09:15:08 | Araq | are you on Nim devel? |
09:15:23 | FromDiscord | <Stuffe> no, stable |
09:16:33 | FromDiscord | <Stuffe> it says: 1.0.4 [MacOSX: amd64] |
09:16:48 | sealmove | Araq: can I somehow reuse Nim's typechecker to obtain an expressions type? |
09:16:58 | sealmove | expression's* |
09:17:04 | FromDiscord | <Stuffe> You can use macros |
09:17:21 | FromDiscord | <Stuffe> https://nim-lang.org/docs/tut3.html |
09:18:36 | sealmove | I have a nim expression as NimNode and want to get the type it resolves to so I can implement a type declaration of a variable of that type in a macro. |
09:21:54 | sealmove | can `proc getType(n: NimNode): NimNode` help me? |
09:23:10 | lqdev[m] | only if the expression is literal or `typed` |
09:23:50 | sealmove | I am constructing the expression myself |
09:24:00 | lqdev[m] | though I think it can work for any `untyped` expressions without nnkIdent |
09:24:28 | sealmove | makes sense |
09:24:36 | sealmove | but |
09:24:45 | sealmove | I have stuff like nnkInfix |
09:24:53 | lqdev[m] | otoh this only includes literals, once you start adding operators you use idents |
09:25:23 | FromDiscord | <Stuffe> sealmove, I don't know if "getType" is the compile time type or the run time type, but why don't you just write a little test for it? |
09:25:25 | sealmove | :( so what do I do? Am I on my own? |
09:25:34 | lqdev[m] | no, there's another way |
09:25:47 | sealmove | Stuffe: it's CT |
09:25:54 | FromDiscord | <Stuffe> Oh, ok |
09:26:29 | lqdev[m] | that way is to somehow force the compiler to do a semcheck on the expression, the way you do that is generate the expression from one macro, and generate an nnkCall calling your macro |
09:27:23 | lqdev[m] | protip: if you don't want the extra macro to be public, use bindSym |
09:27:25 | sealmove | well, I want to generate an object declaration. The typed or its fields depend on some expression I've got |
09:27:38 | sealmove | The types* |
09:27:44 | sealmove | types of its fields* |
09:28:30 | sealmove | `auto` of course doesn't work in this case |
09:30:45 | sealmove | lqdev: how does this help? |
09:31:23 | lqdev[m] | if you already have the expression in the macro that generates the declaration, you can make that parameter `typed` |
09:32:58 | sealmove | and if it's typed I have access to? the type? how? |
09:34:08 | sealmove | basically I generate the expression by hand |
09:34:25 | sealmove | it's not automatically created by Nim's parser |
09:34:30 | lqdev[m] | `untyped` parameters are not semchecked, while `typed` parameters are. semchecking includes resolving types, that's why the params are called `typed` |
09:35:04 | sealmove | so it's a NimNode that includes some AST I make using procs in macros module |
09:35:19 | lqdev[m] | how do you have it set up now? there's just one macro with untyped parameters that processes some DSL? |
09:35:44 | sealmove | no, I parse the DSL with npeg |
09:35:53 | sealmove | it's in a file |
09:36:00 | sealmove | Nim can't parse the DSL |
09:36:06 | lqdev[m] | I see |
09:37:59 | sealmove | so... I suppose nim can't help me here and I have to implement some sort of type algebra on the DSL expression, right? |
09:38:17 | lqdev[m] | so what you can do in this case is to split the macro into two, I'll call them `parsePeg` and `genObject`. `parsePeg` handles the parsing and expression generation, `genObject` handles the object declaration generation |
09:38:36 | lqdev[m] | the trick is to make `genObject`'s parameters typed |
09:38:57 | lqdev[m] | and call it indirectly by generating an nnkCall from `parsePeg` |
09:39:17 | FromDiscord | <Skaruts> is there a way to tell the compiler to automatically discard a return value if the user doesn't explicitly do so? |
09:39:47 | lqdev[m] | @Skaruts annotate the proc that returns something with {.discardable.} |
09:40:31 | Araq | don't use .discardable |
09:40:44 | * | endragor joined #nim |
09:41:05 | lqdev[m] | Araq: then why is it a thing? |
09:41:12 | sealmove | for interop? |
09:42:15 | sealmove | lqdev thanks a lot for the help, I'll try your suggestion <3 |
09:42:35 | Araq | lqdev[m], C interop |
09:42:47 | FromDiscord | <Skaruts> is there an alternative? |
09:42:56 | Araq | good API design |
09:43:01 | lqdev[m] | sealmove: np, feel free to ask for help if you have any trouble |
09:43:11 | FromDiscord | <Skaruts> I made a few procs that returns the object it's associated with, so that one can chain during instatiation like |
09:43:14 | FromDiscord | <Skaruts> `var img = new_image():merge_layers():set_transparency()` |
09:43:31 | FromDiscord | <Skaruts> but then it becomes a nuissance to use them separately |
09:43:35 | Araq | yeah I know, it's junk |
09:43:38 | lqdev[m] | Araq: what about macros.add? |
09:43:48 | Araq | for chaining use a chain macro |
09:43:59 | FromDiscord | <Skaruts> oh |
09:44:04 | Araq | chaining shouldn't have any influence on API design whatsoever |
09:44:34 | Araq | chaining also bites with ownership, in C++ you return unowned and unchecked &'s everywhere because of this |
09:44:42 | FromDiscord | <Skaruts> not sure where to look for it in the docs |
09:45:10 | Araq | lqdev[m], macros.add was a mistake, newTree is the much better design |
09:46:04 | lqdev[m] | Araq: I stopped using macros.add after a while but sometimes it's still necessary. though, I don't need its return val in these cases |
09:46:13 | Araq | exactly |
09:46:47 | Araq | Skaruts: the stdlib has no 'chain' (yet!) |
09:46:59 | Araq | Zevv has a 'with' package for it iirc |
09:47:00 | lqdev[m] | I need to fix initRWindow in rapid, it's a mess. default parameters are a way better option |
09:47:12 | lqdev[m] | right now it makes use of chaining |
09:47:31 | FromDiscord | <Skaruts> can you give me a quick example of how to make chaining possible? |
09:48:57 | Araq | https://github.com/zevv/with this does something else |
09:49:10 | Araq | but maybe useful for inspiration |
09:52:25 | FromDiscord | <Skaruts> hmm... was hoping for something that could already be available in the language itself |
09:52:41 | Araq | PRs are accepted |
09:53:36 | Araq | but the point remains: enabling chaining in the API directly is bad for all sort of reasons |
09:54:57 | * | endragor quit (Remote host closed the connection) |
09:54:58 | FromDiscord | <Skaruts> this is for a very simple script that loads/parses files from another app, so would it still make a difference? |
10:00:44 | Araq | if you don't publish your code, it's fine ;-) |
10:00:56 | FromDiscord | <Skaruts> lol |
10:01:26 | Araq | still sugar.chain would be nice, anybody up for that? |
10:02:53 | FromDiscord | <Skaruts> I just tried using .discardable and everything seems to be working 100% |
10:03:11 | FromDiscord | <Skaruts> what exactly could go wrong with using it? |
10:03:23 | Araq | the 'auto' return type inference, for example |
10:04:02 | * | solitudesf quit (Ping timeout: 240 seconds) |
10:04:11 | FromDiscord | <Skaruts> meaning that if the proc in question doesn't explicitly say "return", the compiler could miss it? |
10:04:28 | Araq | that too |
10:04:45 | * | ng0 joined #nim |
10:05:17 | FromDiscord | <Skaruts> well nothing exploded, but I can live with making it explicit |
10:05:46 | FromDiscord | <Skaruts> actually they already are lol |
10:06:15 | FromDiscord | <mratsim> only if you are in a typed context |
10:06:25 | FromDiscord | <mratsim> argh, wasn't at the bottom |
10:06:42 | Zevv | so you were, like, in the wrong context |
10:06:46 | FromDiscord | <mratsim> was replying to the type algebra comment |
10:06:59 | FromDiscord | <mratsim> since @Skaruts is still there I can save π |
10:07:25 | Araq | so mratsim, how do your 'yield points' look like? |
10:10:12 | FromDiscord | <Skaruts> here's what I'm doing: <https://gist.github.com/Skaruts/c219fe3f8fdd3292596ecd95af9a391a#file-rpnim-nim-L149> |
10:11:02 | Araq | as I said, why return confusing redundant information? |
10:11:12 | Araq | the caller already has the RPImage |
10:11:24 | Araq | total messy design just so that you can save some keystrokes |
10:12:17 | FromDiscord | <Skaruts> so that one could do it all in one line |
10:12:39 | Araq | and what's up with the 'warn's? |
10:13:06 | FromDiscord | <Skaruts> just so I don't have to type "\n"s all over the place |
10:13:19 | Araq | use 'assert' |
10:13:51 | FromDiscord | <Skaruts> the warns aren't supposed to stop the app, just inform the user about something |
10:14:10 | Araq | when I'm on Linux I sometimes run GTK apps |
10:14:15 | Araq | they do the same |
10:14:25 | Araq | endless junk on my terminal |
10:14:33 | Araq | don't do it. |
10:14:38 | FromDiscord | <Skaruts> the whole thing about the discarding, is just so that, if possible, I would't mind supporting this: |
10:14:39 | FromDiscord | <Skaruts> let rp_img = load_xp("data/thief map3.xp").set_transparency(0, 0, 0, 0).merge() |
10:14:52 | Araq | I know |
10:15:19 | Araq | I really understand it. And I really dislike it. |
10:15:27 | FromDiscord | <Skaruts> π |
10:15:41 | Araq | your RPColor is a ref object and holds 4 integers |
10:16:06 | FromDiscord | <Skaruts> I only don't like it when overdone (ahem, rust...) |
10:16:11 | Araq | remove the 'ref' please |
10:16:37 | FromDiscord | <Skaruts> hmm, why so? |
10:17:12 | FromDiscord | <Skaruts> I usually just make everything ref tbh |
10:17:32 | Araq | var colorB = colorA |
10:17:38 | FromDiscord | <Skaruts> basically because I don't quite know when to and when not to |
10:17:42 | Araq | colorB.r = 4 # mutates colorA |
10:18:00 | FromDiscord | <Skaruts> ah yes, that |
10:18:10 | Araq | 'ref' introduces aliasing |
10:18:16 | FromDiscord | <Skaruts> Maybe I should do that to the cells too |
10:18:19 | FromDiscord | <Skaruts> good point |
10:18:25 | Araq | sometimes that's what you want, most of the time it's not |
10:18:39 | Araq | and even if you want it *now*, later on it becomes a liability |
10:18:50 | Araq | see the Nim compiler for a good example for that... |
10:19:09 | FromDiscord | <Skaruts> both ref object and object are GC'd? |
10:19:26 | Araq | nope, objects are not GC'd |
10:19:59 | FromDiscord | <Skaruts> so what do I do with them? |
10:20:14 | Araq | nothing, they are handles by the stack |
10:20:23 | Araq | *handled |
10:20:40 | Araq | so they are automatically freed too |
10:20:49 | FromDiscord | <Skaruts> oh ok, nice then |
10:21:09 | FromDiscord | <Skaruts> btw I used SomeInt and SomeFloat, is that proper? |
10:21:12 | * | natrys joined #nim |
10:21:51 | Araq | dunno, seems ok for now |
10:27:16 | * | krux02 joined #nim |
10:28:41 | FromDiscord | <Skaruts> yea there's an element of redundancy to those warnings... |
10:29:25 | Araq | Listen to me. Warnings are bad. Either 'assert' on wrong API usage or don't |
10:30:41 | sealmove | lqdev: your github description is confusing |
10:31:13 | sealmove | people might think you are 15-year-old who has been programming games from when he was 12. |
10:31:20 | * | krux02 quit (Remote host closed the connection) |
10:31:54 | sealmove | ':) |
10:32:52 | lqdev[m] | lol |
10:33:33 | lqdev[m] | but I clearly wrote `since`, not `from` :) |
10:36:59 | FromDiscord | <Skaruts> @Araq using object for colors seems to clash with nil default values (line 113) |
10:37:55 | sealmove | i meant the part "15 years old passionate programmer" |
10:38:08 | FromDiscord | <Skaruts> `rpnim.nim(153, 63) Error: type mismatch: got <typeof(nil)> but expected 'RPColor = object'` |
10:38:19 | FromDiscord | <Skaruts> (113 on the gist) |
10:38:33 | sealmove | "passionate programmer for 15 years" instead would avoid misunderstandings :P |
10:39:18 | * | endragor joined #nim |
10:39:24 | Araq | Skaruts: you said it yourself ("create overloads if not") |
10:39:58 | FromDiscord | <Skaruts> well I was wondering if it could be done -- I'm still a noob at nim π |
10:40:12 | * | owl_000 joined #nim |
10:40:35 | FromDiscord | <Skaruts> overloading it is then |
10:40:43 | Araq | you can also use an Option[T] |
10:40:47 | sealmove | gtg, bye all |
10:40:50 | * | sealmove quit (Quit: WeeChat 2.7) |
10:41:13 | * | dwdv joined #nim |
10:41:35 | lqdev[m] | sealmove: dude, but I am 15 years old |
10:42:02 | lqdev[m] | how else can I say this |
10:42:52 | dom96 | Just noticed this on our wiki: https://en.wikipedia.org/wiki/Wikipedia:Articles_for_deletion/Nim_(programming_language)_(4th_nomination) |
10:43:15 | dom96 | Some guy arguing that even the book doesn't prove notability because I wrote it so it's a primary source lol |
10:43:27 | * | marmotini_ joined #nim |
10:43:39 | dom96 | Looks like this person was just trying to get revenge for their page being deleted |
10:44:30 | * | endragor quit (Remote host closed the connection) |
10:45:34 | FromDiscord | <Skaruts> @Arak I don't know how to use that though |
10:45:37 | dom96 | also, TIL this book has a section on Nim https://books.google.co.uk/books?id=xrd9DwAAQBAJ&pg=PA18#v=onepage&q&f=false |
10:45:39 | * | beshr joined #nim |
10:46:09 | * | endragor joined #nim |
10:47:42 | dom96 | It mentions Nimble pretty heavily, guess I should buy it |
10:52:54 | * | endragor quit (Remote host closed the connection) |
10:53:25 | FromDiscord | <Skaruts> I'm thinking of buying your book, but man... it delves into technical web stuff, which to me is the boring stuff in programming π |
10:55:17 | dom96 | That's fair, I figured it would be the easiest to get into (and most popular) but I can understand if some find it boring |
10:55:41 | FromDiscord | <Stuffe> if it explains how to get the step debugger in VS code to work with nim I would buy it |
10:55:49 | FromDiscord | <Stuffe> literally wasted hours and failed |
10:56:20 | Araq | gdb works ok'ish |
10:56:27 | FromDiscord | <Skaruts> well to be fair, it's like Stephen King once said "write what you know". If you made the book about something you weren't soversed on it might not be as good |
10:56:42 | FromDiscord | <Skaruts> so versed on* |
10:57:18 | FromDiscord | <Skaruts> maybe it is easy, maybe it's just that I never went there |
10:58:47 | FromDiscord | <Stuffe> Araq, you mean in the terminal, right? |
10:58:56 | Araq | yeah |
10:59:01 | FromDiscord | <Stuffe> Its all C symbols though? |
10:59:10 | Araq | no, we have a script |
10:59:31 | FromDiscord | <Stuffe> Oh, any link about that? |
10:59:44 | Araq | tools/nim-gdb.py |
11:00:04 | * | Trustable joined #nim |
11:00:38 | FromDiscord | <Stuffe> Ah ok, I will check that out later |
11:10:01 | dom96 | https://twitter.com/d0m96/status/1213417218169593857 |
11:12:05 | dom96 | Nim's popularity is growing :) |
11:12:39 | FromDiscord | <Skaruts> indeed, I found quite a few tutorials on youtube from ~2 months ago |
11:12:47 | FromDiscord | <Skaruts> people seem to be picking it up |
11:27:29 | FromGitter | <Albus70007> does a nim socket decode the information by itself? |
11:27:40 | * | nsf quit (Quit: WeeChat 2.7) |
11:28:15 | * | natrys quit (Quit: natrys) |
11:35:31 | * | endragor joined #nim |
11:40:19 | dom96 | Albus70007: decode how? It gives you whatever the POSIX/WinAPI returns |
11:40:34 | dom96 | (or openSSL for SSL) |
11:41:16 | FromGitter | <Albus70007> i am having issues trying to receive information supposedly encoded in utf8 from a python socket server, nim will just throw me an string |
11:42:02 | dom96 | that should just work, Nim's strings are basically UTF8 |
11:42:28 | FromGitter | <Albus70007> but i need the data as bytes to properly read the header |
11:43:54 | dom96 | !eval var x = "π"; echo(x[0].repr) |
11:43:57 | NimBot | '\240' |
11:45:57 | FromGitter | <Albus70007> ill try it, thank you and lets see if we can pass D in popularity soon! |
11:46:16 | dom96 | :D |
11:48:26 | * | endragor quit (Remote host closed the connection) |
11:53:39 | FromGitter | <Albus70007> and if i want to revert the bytes to string again? |
11:55:27 | FromDiscord | <mratsim> @Araq, my yield points are there: https://github.com/mratsim/weave/blob/059d4521fd285b393339bd916f85588c97c5da75/weave/runtime.nim#L82-L122 |
11:55:27 | FromDiscord | <mratsim> A worker polls for incoming steal requests, send tasks if it has some or forward them to another poor victim if it has none, and then back to user code. |
11:57:04 | FromDiscord | <mratsim> there shouldn't be any problem to add an IO task queue that I can check as well there |
12:01:46 | * | endragor joined #nim |
12:03:37 | FromDiscord | <mratsim> or just yield to asyncdispatch event loop |
12:04:55 | FromDiscord | <Skaruts> is there a way to get an object from a seq by reference? (it's not a ref object) |
12:05:16 | FromDiscord | <mratsim> mySeq[i].addr |
12:05:24 | FromDiscord | <Skaruts> ah thanks |
12:06:34 | FromDiscord | <mratsim> you can also have an accessor that return a var T. |
12:07:22 | FromDiscord | <mratsim> proc indexMut(s: var seq[T], index: int): var T = s[index] |
12:08:14 | FromDiscord | <mratsim> but you can assign it, you have to pass it as a var param |
12:08:17 | FromDiscord | <mratsim> can't* |
12:10:12 | * | chemist69 quit (Ping timeout: 248 seconds) |
12:10:57 | * | chemist69 joined #nim |
12:13:26 | FromGitter | <Varriount> Skaruts: Are you coming from Go? |
12:15:01 | * | endragor quit (Remote host closed the connection) |
12:15:11 | * | jjido quit (Quit: Textual IRC Client: www.textualapp.com) |
12:16:58 | * | lritter joined #nim |
12:23:25 | Araq | mratsim: can you make this without the '_' typedesc parameter? |
12:23:58 | * | marmotini_ quit (Remote host closed the connection) |
12:24:08 | Araq | and can we make this a .compilerProc and patch the compiler to call it automatically? |
12:24:33 | * | marmotini_ joined #nim |
12:28:50 | * | marmotini_ quit (Ping timeout: 240 seconds) |
12:31:02 | * | endragor joined #nim |
12:31:24 | * | endragor quit (Remote host closed the connection) |
12:36:59 | FromDiscord | <inv> Hello, just first 3 hours in nim, but did the same like in 1 month in Rust π |
12:41:42 | FromDiscord | <inv> I have a question: I see that nim has a lot of for meta-programming. Is it possible to handle this thing somehow: |
12:41:42 | FromDiscord | <inv> type T = tuple: a: int; b: int; c: int |
12:41:42 | FromDiscord | <inv> var counter = initTable[string, T]() |
12:41:42 | FromDiscord | <inv> |
12:41:42 | FromDiscord | <inv> I have a stream of string data which includes key:string and values: which is enum of "a","b","c" |
12:41:43 | FromDiscord | <inv> Is it possible to do something like counter.mgetOrPut(data.key, (0,0,0))[data.value] += 1 for it? |
12:41:46 | FromDiscord | <inv> I understand that tuples does not work this way and all information about fields are lost after compilation, but, probably I can do some template-trick for it ? |
12:42:14 | FromDiscord | <inv> I suppose I can define function which would return ref to thee tuple-field, but not sure if it is the best way |
12:45:04 | FromDiscord | <Generic> can you give an example of one your entries? |
12:51:23 | * | endragor joined #nim |
12:57:01 | FromDiscord | <mratsim> @Araq yes I can |
12:57:37 | FromDiscord | <mratsim> by the way, would it be interesting to allow multiple Weave or scheduler instances |
12:57:55 | FromDiscord | <mratsim> like weave1.spawn foo(a, b, c) |
12:58:07 | FromDiscord | <mratsim> and weave2.spawn bar(a, b, v) |
12:58:39 | FromDiscord | <mratsim> I know one use case, testing π |
12:58:53 | FromDiscord | <mratsim> (testing weave, globals are a pain to test) |
13:00:08 | * | dddddd joined #nim |
13:00:14 | FromDiscord | <mratsim> @inv, from you description I don't see any issue |
13:00:31 | FromDiscord | <mratsim> you don't need template or metaprogramming either |
13:01:02 | FromDiscord | <inv> just a sec, will try playground |
13:01:28 | FromDiscord | <inv> does not work π¦ |
13:01:52 | FromDiscord | <Generic> https://play.nim-lang.org/#ix=26nn |
13:02:18 | FromDiscord | <Generic> I used a template π |
13:02:30 | FromDiscord | <Generic> but only because of what I call Nim's greatest weakness |
13:02:37 | FromDiscord | <inv> @Generic I would like to avoid the boiler-plate (not so big really) |
13:03:22 | FromDiscord | <inv> I have tupple with named fields. and would like to put into the field by string-variable |
13:04:29 | FromDiscord | <inv> to do ```entry[value]``` somehow, but I know - it is tupple, not dict |
13:06:31 | FromDiscord | <mratsim> use enums values as a map |
13:07:21 | FromDiscord | <inv> I was sure it is not so easy |
13:07:56 | FromDiscord | <Generic> https://play.nim-lang.org/#ix=26np |
13:08:01 | FromDiscord | <Generic> you can try this instead |
13:08:11 | FromDiscord | <Generic> this is a bit more general solution |
13:08:45 | FromDiscord | <inv> oh, interesting, thank you |
13:09:02 | FromDiscord | <mratsim> example: https://play.nim-lang.org/#ix=26nq |
13:09:34 | FromDiscord | <Generic> @mratsim this only works, because you supply a constant as the index |
13:09:38 | FromDiscord | <mratsim> or use an array instead of a tuple |
13:09:58 | FromDiscord | <inv> have to understand how it works π Thank you |
13:10:15 | FromDiscord | <mratsim> right, let me change it then |
13:10:45 | FromDiscord | <Generic> @inv https://nim-lang.org/docs/iterators.html#fieldPairs.i%2CT this explains most of it |
13:11:01 | FromDiscord | <mratsim> here you go: https://play.nim-lang.org/#ix=26ns |
13:11:29 | FromDiscord | <mratsim> if a tuple works and type are homegeneous, you can use an Array indexed by enums instead |
13:11:39 | FromDiscord | <inv> is it reaaly necessary to iterate over it? |
13:11:56 | FromDiscord | <inv> looks like so, but I suppose it is not very good |
13:11:57 | * | arecaceae joined #nim |
13:12:17 | arecaceae | is there something similar to golang interfaces? |
13:12:38 | FromDiscord | <Generic> @inv you're just seeing the real cost of it for the first time |
13:13:40 | FromDiscord | <Generic> arecaceae: you can make an object with function pointers in it |
13:13:59 | arecaceae | ahhh, that is the recommended way? |
13:14:12 | FromDiscord | <Generic> well there are libraries like this one: https://github.com/andreaferretti/interfaced |
13:14:32 | FromDiscord | <Generic> but a lot of the time you can generics instead |
13:14:40 | FromDiscord | <Generic> what are you trying to archive? |
13:15:21 | FromDiscord | <Generic> there are a lot of situations where interfaces a the "solution" in go when other languages (especially Nim) have better ways of doing it |
13:15:51 | arecaceae | basically an exported type that consumers like other packages can reimplement |
13:16:03 | FromDiscord | <inv> Y, I suppose it is too complicate - I just do += 1 on one of the tupple fields |
13:16:18 | arecaceae | I guess I could just use `object of` ? |
13:16:23 | arecaceae | even with a final object type |
13:18:31 | FromDiscord | <Generic> arecaceae: for example see: https://github.com/nim-lang/Nim/blob/version-1-0/lib/system.nim#L3154 |
13:18:58 | arecaceae | Generic: ah gotcha, thanks |
13:18:59 | FromDiscord | <Generic> find doesn't need an interface for T |
13:20:26 | FromDiscord | <Generic> @inv inc is for ints synonymous with += 1 |
13:21:22 | FromDiscord | <Generic> if this is what you asked |
13:26:09 | * | koltrast quit (Quit: ZNC - http://znc.in) |
13:28:14 | FromDiscord | <inv> is it possible to covert ```proc mget(stat: var Stat, name: string): var int =``` |
13:28:15 | FromDiscord | <inv> into `[]=` ? |
13:30:11 | FromDiscord | <Generic> this is your proc |
13:30:12 | FromDiscord | <Generic> ? |
13:30:38 | FromDiscord | <Rika> Why do you need to get it if you're only modifying |
13:31:11 | FromDiscord | <Rika> mget would be a `[]=` and a `[]` in the rhs |
13:31:21 | FromDiscord | <Generic> by standard naming definitions that proc would have to be named ``[]`` |
13:31:41 | FromDiscord | <Generic> ````[]```` |
13:31:54 | FromDiscord | <Rika> Yeah I think it's a `[]` with a var first argument |
13:32:17 | FromDiscord | <Rika> And returns a var T |
13:32:31 | FromDiscord | <inv> ``` Error: cannot evaluate at compile time: value``` |
13:32:43 | FromDiscord | <inv> ^^^ is I change mget to `[]` |
13:32:50 | FromDiscord | <inv> ^^^ if I change mget to `[]` |
13:33:15 | FromDiscord | <Rika> Copy the proc signature again |
13:33:43 | FromDiscord | <inv> ```nim |
13:33:44 | FromDiscord | <inv> proc mget(stat: var Stat, name: string): var int = |
13:33:44 | FromDiscord | <inv> case name |
13:33:44 | FromDiscord | <inv> of "full": return stat.full |
13:33:44 | FromDiscord | <inv> of "ticker": return stat.ticker |
13:33:44 | FromDiscord | <inv> of "heartbeat": return stat.heartbeat |
13:33:45 | FromDiscord | <inv> ``` |
13:33:54 | FromDiscord | <Rika> No I mean |
13:34:01 | FromDiscord | <Rika> The top line, after changing it to [] |
13:34:16 | FromDiscord | <inv> counter.mgetOrPut(pid,(0,0,0)).mget(typ).inc() |
13:34:30 | FromDiscord | <inv> ``` |
13:34:30 | FromDiscord | <inv> counter.mgetOrPut(pid,(0,0,0)).mget(typ).inc() |
13:34:30 | FromDiscord | <inv> of Opcode.Ping: |
13:34:30 | FromDiscord | <inv> echo "ping" |
13:34:31 | FromDiscord | <inv> of Opcode.Pong: |
13:34:31 | FromDiscord | <inv> echo "pong" |
13:34:31 | FromDiscord | <inv> else: |
13:34:33 | FromDiscord | <inv> echo "else" |
13:34:34 | FromDiscord | <inv> ``` |
13:34:35 | FromDiscord | <Generic> btw you don't need the return |
13:34:44 | FromDiscord | <Rika> What are you even sending now |
13:34:54 | FromDiscord | <inv> @Generic I was trying to do without it |
13:35:30 | FromDiscord | <Generic> you need to make else an exception |
13:35:48 | FromDiscord | <Generic> this way the Nim compiler recognises that the case statement always evaluates to a value |
13:36:08 | FromDiscord | <Rika> @inv you can remove the returns AFTER adding an `else: 0 # do something` and substituting the 0 with any desired value |
13:36:26 | FromDiscord | <Rika> An exception, a 0, another int, can be anything |
13:36:31 | FromDiscord | <inv> I was not sure should I create result.new or new exception // tryng to find how to make custom except now |
13:36:55 | * | koltrast joined #nim |
13:37:09 | FromDiscord | <Rika> raise newException(ValueError, "error text") |
13:37:15 | FromDiscord | <inv> I was sure I cannot return 0 because it is var, 1 sec, I will check |
13:38:17 | FromDiscord | <inv> ```nim |
13:38:17 | FromDiscord | <inv> proc mget(stat: var Stat, name: string): var int = |
13:38:17 | FromDiscord | <inv> case name |
13:38:17 | FromDiscord | <inv> of "full": stat.full |
13:38:17 | FromDiscord | <inv> of "ticker": stat.ticker |
13:38:17 | FromDiscord | <inv> of "heartbeat": stat.heartbeat |
13:38:19 | FromDiscord | <inv> else: raise newException(ValueError, "error field-name") |
13:38:19 | FromDiscord | <inv> ``` |
13:38:21 | FromDiscord | <inv> Error: expression has no addres |
13:38:26 | FromDiscord | <inv> like with case name |
13:38:32 | FromDiscord | <inv> line with case name |
13:38:37 | * | Vladar joined #nim |
13:39:01 | FromDiscord | <Rika> What, that's odd |
13:39:03 | FromDiscord | <inv> the same with return 0 |
13:39:43 | FromDiscord | <Generic> that's odd indeed |
13:40:07 | FromDiscord | <inv> but return works π |
13:40:21 | FromDiscord | <Rika> I usually use the block version of case (add a colon to the end of the case name line and indent everything one level) but I doubt that would change anything |
13:41:21 | FromDiscord | <Generic> I think it's a compiler bug |
13:41:24 | FromDiscord | <Generic> it should work |
13:42:14 | FromDiscord | <Generic> it works if the return type is changed to only int |
13:43:17 | narimiran | 0 is not `var int` |
13:43:25 | FromDiscord | <Generic> but an exception should work |
13:43:36 | FromDiscord | <Clyybber> probably |
13:44:44 | FromDiscord | <Rika> It should work for the exception |
13:44:54 | FromDiscord | <Rika> That's what's making me confused |
13:45:06 | FromDiscord | <Rika> Did I somehow not get the syntax right lmao |
13:45:13 | FromDiscord | <Generic> @inv your first compiler bug π |
13:45:15 | FromDiscord | <Rika> I'm on mobile, pls forgif |
13:45:44 | FromDiscord | <Clyybber> @Generic hmm, not sure if its a bug |
13:46:11 | FromDiscord | <Clyybber> if we allow it you could do memory corruption I think |
13:46:27 | FromDiscord | <Generic> oh I see |
13:46:34 | FromDiscord | <Clyybber> by catching the exception and writing to the returned var |
13:47:16 | FromDiscord | <Clyybber> maybe I'm wrong though |
13:47:46 | FromDiscord | <Generic> hm, the only case I can come up with |
13:48:27 | FromDiscord | <Generic> oh, that was stupid what I thought |
13:49:05 | FromDiscord | <Generic> hm, though the var T can only occur in a scope which is left by the exception |
13:49:24 | FromDiscord | <inv> @Generic I had a lot of bugs even in rust π |
13:49:28 | planetis[m] | btw some stuff is done for a nim friendly cairo interface https://github.com/b3liever/cairo2 |
13:50:07 | FromDiscord | <Clyybber> @Generic You could do `try: mget(...) = something except e: ...` |
13:50:29 | FromDiscord | <Clyybber> I'm not sure if the assignment will continue though, if mget raises |
13:50:38 | FromDiscord | <Clyybber> lemme test that |
13:51:05 | FromDiscord | <Generic> I would expect this to work fine, the lhs is evaluated before the rhs |
13:51:09 | FromDiscord | <inv> will run away for 1/2h |
13:51:16 | FromDiscord | <Generic> bye |
13:51:20 | FromDiscord | <Clyybber> bb |
13:51:22 | Zevv | PMunch here? |
13:51:32 | FromDiscord | <Clyybber> @Generic yeah, probably |
13:51:38 | FromDiscord | <Clyybber> ok, then it may be safe |
13:51:51 | FromDiscord | <Generic> I file a bug report then |
13:53:06 | planetis[m] | could someone tell me if thats the correct way to wrap a reference counted type with destructors? https://github.com/b3liever/cairo2/blob/master/cairo2.nim#L15-L23 |
13:54:33 | FromDiscord | <inv> could you explain there is a bug? Do not undesrstand what nim checks here |
13:55:01 | FromDiscord | <inv> ... and is it possible to make `[]` |
13:55:21 | FromDiscord | <Generic> that has nothing to do with the ``[]`` |
13:55:22 | planetis[m] | isn't bad that a library does its own memory management btw? |
13:55:49 | FromDiscord | <Generic> planetism other wrapper do that as well |
13:56:05 | FromDiscord | <Generic> @inv did you put backtick around the []? |
13:56:25 | FromDiscord | <Generic> that's incredible hard to write on discord |
13:59:26 | * | endragor quit (Remote host closed the connection) |
14:01:51 | skrylar[m] | planetism is an awesome name |
14:02:28 | FromDiscord | <Clyybber> believer in planetism |
14:02:32 | * | endragor joined #nim |
14:05:25 | planetis[m] | pbl should make them match |
14:06:44 | planetis[m] | but thanks skrylar, what yours mean? It reminds me of a musician |
14:07:42 | * | endragor quit (Remote host closed the connection) |
14:10:13 | FromDiscord | <Rika> @Generic \`[] \` |
14:10:21 | FromDiscord | <Rika> Oops, space |
14:10:48 | * | endragor joined #nim |
14:11:49 | FromDiscord | <Generic> yes, it's supposed to be this way |
14:12:09 | lqdev[m] | skrylar, @Clyybber: his name is actually planetis, it's just the matrix freenode bridge that appends [m] to our names |
14:12:47 | FromDiscord | <Clyybber> I know |
14:13:04 | FromDiscord | <Clyybber> but I think its done on purpose |
14:13:53 | lqdev[m] | yeah, to notify people that this is a bridge user |
14:14:49 | FromDiscord | <Clyybber> nah, I mean like having the m complete your name |
14:15:00 | * | sagax quit (Read error: Connection reset by peer) |
14:21:18 | lqdev[m] | well, lqdevm doesn't sound that good. |
14:21:50 | lqdev[m] | the [m] stands for matrix. |
14:21:52 | FromDiscord | <Clyybber> liqde[m] |
14:22:48 | FromDiscord | <Rika> xirta[m] |
14:25:41 | planetis[m] | relax its only a name, he pbl didn't want to ping me for no reason, no big deal. |
14:26:59 | FromDiscord | <Rika> Is it me or are diff libraries kinda obscure and hard to find |
14:29:22 | FromDiscord | <Clyybber> yeah, its you, you are obscure; not but really: https://nim-lang.github.io/Nim/diff |
14:29:26 | FromDiscord | <Clyybber> its in the stdlib :p |
14:35:02 | planetis[m] | i want to use that dark theme, but its broken when running ``nim doc`` π₯ |
14:35:45 | planetis[m] | it so good |
14:36:03 | planetis[m] | π |
14:36:37 | FromDiscord | <Clyybber> now if only it would remember to stay dark |
14:36:40 | FromDiscord | <Clyybber> on firefox that is |
14:37:29 | FromDiscord | <inv> @Generic I put ``, it started to const it |
14:38:26 | FromDiscord | <Rika> @Clyybber i meant binary diffing/delta |
14:38:29 | FromDiscord | <Rika> sorry |
14:38:33 | FromDiscord | <Clyybber> oh, sorry |
14:39:01 | FromDiscord | <inv> counter.mgetOrPut(pid,(0,0,0))[typ].inc() cannot evaluate at compile time: typ |
14:39:03 | FromDiscord | <Rika> those are much harder to find |
14:39:17 | FromDiscord | <Clyybber> @Rika I think you can use it for binary data too though |
14:39:41 | FromDiscord | <Rika> i'd have to convert it into a seq[int] lmao |
14:40:19 | FromDiscord | <mratsim> @planetis check there: reviewed by Araq yesterday: https://github.com/mratsim/weave/pull/92/commits/4aad01ed9b09354e183c0a8f225c6ed06da8f725 |
14:40:20 | disbot | β₯ [WIP] Dataflow graph parallelism |
14:41:07 | FromDiscord | <mratsim> replace the fetchAdd/fetchSub by inc/dec if you don't need atomic refcounting |
14:42:01 | FromDiscord | <mratsim> see: https://irclogs.nim-lang.org/03-01-2020.html#21:24:21 |
14:47:24 | * | nsf joined #nim |
14:50:23 | planetis[m] | mratsim: i think the destructors should be attached to an stack object that references heap allocated memory |
14:51:41 | planetis[m] | although i am confused |
14:52:19 | * | solitudesf joined #nim |
14:54:56 | FromDiscord | <Clyybber> thats how mratsim does it |
14:55:22 | FromDiscord | <Clyybber> lp is a ptr object |
14:57:31 | planetis[m] | what about this line: system.`=sink`(dst.lp, src.lp) |
14:59:37 | FromDiscord | <Clyybber> what about it? |
15:00:20 | FromDiscord | <Clyybber> its not really necessary |
15:00:41 | planetis[m] | very intersting library though, mratsim good one! |
15:00:41 | FromDiscord | <Clyybber> a memCopy with zeroing src.lp would do it too |
15:00:45 | FromDiscord | <Clyybber> but its more succint |
15:01:02 | * | letto quit (Quit: Konversation terminated!) |
15:03:59 | planetis[m] | clybber: do you think this is correct https://github.com/nim-lang/cairo/issues/13#issuecomment-570685009 |
15:04:00 | disbot | β₯ Use destructors for automaticaly closing of resources ; snippet at 12https://play.nim-lang.org/#ix=26eu |
15:05:15 | FromDiscord | <Clyybber> planetis[m]: Yeah, afaict |
15:05:23 | FromDiscord | <Clyybber> Your `=` could be a little simpler |
15:05:30 | FromDiscord | <Clyybber> if it would use `=destroy` |
15:06:16 | planetis[m] | good point |
15:06:18 | FromDiscord | <Clyybber> well, depends on what cairo_reference does |
15:06:40 | planetis[m] | thanks, i appreciate it |
15:06:51 | FromDiscord | <Clyybber> I mean it depends on what cairo_reference does, wether or not this is correct |
15:06:58 | FromDiscord | <Clyybber> planetis[m]: Np π |
15:07:57 | FromDiscord | <Clyybber> planetis[m]: I think dispose is wrong though |
15:08:08 | FromDiscord | <Clyybber> It shouldn't destroy it, I think, just unref it |
15:08:13 | FromDiscord | <Clyybber> so set it to nil |
15:08:48 | FromDiscord | <Clyybber> oh, I'm apparently too dumb to read your post π |
15:08:52 | FromDiscord | <Clyybber> nvrmind |
15:09:30 | * | letto joined #nim |
15:09:43 | * | ng0_ joined #nim |
15:09:43 | * | ng0_ quit (Changing host) |
15:09:43 | * | ng0_ joined #nim |
15:09:44 | * | marmotini_ joined #nim |
15:10:10 | * | sagax joined #nim |
15:12:22 | lqdev[m] | does assigning a `var` object from one variable to another copy it? |
15:12:42 | planetis[m] | nonsense programmers are not dumb, but maybe tired and overworked :) |
15:12:59 | disruptek | i beg to differ. |
15:13:02 | * | ng0 quit (Ping timeout: 258 seconds) |
15:13:14 | planetis[m] | lqdev: yes |
15:13:35 | FromDiscord | <mratsim> it's interesting but head scratching, now I have distributed system problems in my library :/. btw, I need a good way to represent a dependency graph. |
15:13:35 | FromDiscord | <mratsim> |
15:13:36 | FromDiscord | <mratsim> If I use your patgraph lib, is there a way if I give an input value "A" to iterate on all nodes connected to it, and also check if we are the last remaining connection? |
15:15:06 | disruptek | compare with these: |
15:15:09 | disruptek | !repo graflib |
15:15:10 | disbot | https://github.com/mashingan/graflib -- 9graflib: 11Very simple graph implementation library. 15 1β 0π΄ |
15:15:11 | planetis[m] | haha, in which part disruptek ? |
15:15:23 | disruptek | !repo graph-analysis |
15:15:24 | disbot | https://github.com/D-K-E/graph-analysis -- 9graph-analysis: 11A repo on analysis of graphs as in graph theory 15 1β 0π΄ |
15:15:53 | disruptek | i'm neither tired or overworked: explain my stupidity. |
15:16:49 | planetis[m] | mratsim: its actually a rewrite of petgraph btw |
15:17:17 | disruptek | hearts and minds, people; hearts and minds! |
15:17:33 | * | ng0_ is now known as ng0 |
15:17:54 | planetis[m] | should mention it in readme |
15:18:07 | FromDiscord | <inv> ok, can I ask another question I did not find in google: |
15:18:07 | FromDiscord | <inv> I have a table - I want to output in sort order by tuple-value |
15:18:18 | FromDiscord | <inv> better immutable, but mutable is also ok |
15:19:02 | FromDiscord | <inv> table[string, (int,int,int)] . I would like to output in order by sum of tuple |
15:19:05 | FromDiscord | <mratsim> you need to use an OrderedTable and before output sort it (there is a proc for that) |
15:19:21 | * | letto quit (Quit: Konversation terminated!) |
15:19:36 | FromDiscord | <mratsim> There is no SortedTable (that keeps insertion order automatically) at the moment |
15:19:36 | FromDiscord | <Clyybber> Araq: I imagine a chain macro could be easily implemented by inserting strategic outplace's |
15:19:49 | disruptek | !repo sorta |
15:19:49 | disbot | https://github.com/narimiran/sorta -- 9sorta: 11SortedTables in Nim, based on B-Trees 15 12β 1π΄ |
15:20:09 | FromDiscord | <inv> @mratsim thanks! |
15:20:09 | FromDiscord | <Clyybber> beat me to it |
15:20:10 | narimiran | yeah, more testers for that needed :) |
15:20:11 | planetis[m] | the're many other procs that i didn't port though |
15:20:48 | FromDiscord | <inv> Does the channel has cross-post with telegram? I prefer telegram π |
15:21:01 | narimiran | no, telegram is separated |
15:21:08 | FromDiscord | <Clyybber> nope |
15:21:19 | narimiran | but you can ask questions there if you want/prefer |
15:21:36 | disruptek | itym if you want/prefer cats. |
15:21:37 | narimiran | some of us are in both |
15:24:23 | * | Vladar quit (Quit: Leaving) |
15:26:18 | planetis[m] | mratsim: if you have a node "a' and want to know if neighbor "b" has only one edge, you check if edge.next has invalid index |
15:26:25 | planetis[m] | so i think its possible |
15:30:26 | FromDiscord | <inv> are there any way to put tuple fields in proc definition? proc ((a,b):(string, int)) ... ? |
15:31:56 | lqdev[m] | inv: `proc p(a: tuple[x, y: int])` |
15:32:04 | lqdev[m] | or `proc p(a: (int, int))` |
15:32:14 | FromDiscord | <inv> hm, I way trying |
15:32:17 | * | ng0 quit (Ping timeout: 265 seconds) |
15:32:51 | FromDiscord | <inv> ah |
15:33:55 | FromDiscord | <inv> ```nim |
15:33:55 | FromDiscord | <inv> proc cmp(x:tuple[xx: string, a: Stat], b: (string, Stat)): int = |
15:33:55 | FromDiscord | <inv> system.cmp(a.full,b[1].full) |
15:33:55 | FromDiscord | <inv> ``` |
15:33:55 | FromDiscord | <inv> does not work |
15:34:30 | narimiran | the latter is anonymous tuple |
15:34:31 | FromDiscord | <inv> I wanted to match fields of tuple in declaration |
15:34:44 | FromDiscord | <inv> Sorry, did not get |
15:35:14 | narimiran | and shouldn't it be `cmp(xx.a.full, ...)`? |
15:35:23 | * | beshr quit (Ping timeout: 268 seconds) |
15:35:38 | narimiran | (make that just one `x`, not two) |
15:36:38 | FromDiscord | <inv> @gitterirc it is cmp for table => (key,value), but I do not need key |
15:36:47 | narimiran | btw, did you know you can do something like `a, b: tuple[xx: string, a: Stat]`? |
15:36:55 | FromDiscord | <inv> ```proc sort[A, B](t: var OrderedTable[A, B]; cmp: proc (x, y: (A, B)): int;``` |
15:37:07 | planetis[m] | mratsim: only one edge ```for edge in nodeA.neighbors: graph.nodes[edge.node[1]].next[1] == edix`` |
15:37:16 | narimiran | (gitterirc is bot, not a person) |
15:39:23 | FromDiscord | <inv> it works if I do a.a.full, but I wanter to apply simple pattern-matching here: |
15:39:23 | FromDiscord | <inv> proc((x,a):(string, Stat), (y,b):(string, Stat)): int = system.cmp(a,b) |
15:39:45 | * | beshr joined #nim |
15:39:58 | FromDiscord | <inv> a.a.full is ~ the same like a[1].full |
15:40:44 | planetis[m] | uhm no you need a HashSet |
15:40:48 | FromDiscord | <mratsim> @planetis thanks. |
15:43:41 | FromDiscord | <exelotl> Is there a portable way to get the path to nimbase.h (regardless of how nim was installed) |
15:45:35 | FromDiscord | <exelotl> Feels like there should be a compiler flag that would output the path to the lib directory |
15:46:03 | planetis[m] | also consider this: https://github.com/petgraph/petgraph/blob/master/src/matrix_graph.rs |
15:47:19 | narimiran | `(x,a):(string, Stat)` - you can't do tuple unpacking there, AFAIK |
15:48:02 | * | beshr quit (Ping timeout: 240 seconds) |
15:48:28 | FromDiscord | <mratsim> I think I have a protocol which wouldn't require me to use a graph library: https://github.com/mratsim/weave/pull/92#issuecomment-570795718 |
15:48:28 | disbot | β₯ [WIP] Dataflow graph parallelism |
15:53:36 | shashlick | exelotl: there's https://github.com/nimterop/nimterop/blob/master/nimterop/docs.nim#L13 |
15:54:22 | shashlick | There's also $nim substitution |
15:56:57 | * | drewr quit (Ping timeout: 260 seconds) |
15:58:33 | FromDiscord | <inv> Are there any way to do: for k,v in table.take(10): echo k,v ? |
15:58:50 | FromDiscord | <inv> ... without defining own iterator |
16:03:29 | FromDiscord | <Rika> thats not how the take proc works |
16:04:00 | * | letto joined #nim |
16:05:10 | FromDiscord | <Rika> @inv ordinary tables dont have an order so a `take` proc like that wouldnt work |
16:05:24 | FromDiscord | <Rika> prolly make a proc for `OrderedTable` |
16:06:17 | * | ng0 joined #nim |
16:06:17 | * | ng0 quit (Changing host) |
16:06:17 | * | ng0 joined #nim |
16:06:24 | FromDiscord | <inv> But I have OrderedTable - doesn't it mean that it has iterator? I would like to output only first 10 from the table |
16:06:30 | FromGitter | <timotheecour> is there a way to convert a `Slice` to a `Set` (eg: smthg like `toSet`) ? use case: β β ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5e10b806c23234403cca63bf] |
16:08:18 | FromDiscord | <mratsim> @inv, you need to implement your own, it's not too hard, you just do like the "items" iterator with a counter and break when it reaches the limit |
16:08:55 | FromDiscord | <inv> @mratsim Yes, I did it already, I was tryng to find build-in solution. Thank you |
16:08:59 | FromDiscord | <mratsim> @timotheecour, doesn't {1..3} work? |
16:09:32 | FromDiscord | <mratsim> but then you can't use "in" with case of |
16:12:34 | FromGitter | <timotheecour> @mratsim thanks, duh, didntβ think of that :) β β > but then you can't use "in" with case of β β what do u mean? [https://gitter.im/nim-lang/Nim?at=5e10b9724e9ea12051b3e66b] |
16:13:37 | * | ng0 quit (Ping timeout: 268 seconds) |
16:16:26 | FromGitter | <timotheecour> Oh, and to answer my own question, this works; probably should be in stdlib β β ``` proc toSet[T](s: Slice[T]): set[T] = β {s.a .. s.b}``` [https://gitter.im/nim-lang/Nim?at=5e10ba5a316c147327157c08] |
16:17:22 | FromGitter | <timotheecour> (although for above use case the simplest is `of {nkCharLit..nkUInt64Lit} - {nkIntLit}` ; but there are use cases for `toSet` |
16:22:01 | FromDiscord | <mratsim> or so "of {1..3}" works? |
16:22:19 | FromDiscord | <mratsim> I'm always confused with case of because .. is builtin so ..< doesn't work for example |
16:22:49 | FromDiscord | <mratsim> toSet will conflict with the old deprecated toSet (which is no toHashSet) |
16:22:53 | FromDiscord | <mratsim> now* |
16:23:36 | FromDiscord | <Clyybber> Araq: I have implemented the loop analysis using an extra instruction, but it misses one case: |
16:23:58 | FromDiscord | <Clyybber> ``` |
16:23:58 | FromDiscord | <Clyybber> while cond: |
16:23:59 | FromDiscord | <Clyybber> var a = ... |
16:23:59 | FromDiscord | <Clyybber> b = a |
16:23:59 | FromDiscord | <Clyybber> #b = a |
16:23:59 | FromDiscord | <Clyybber> ``` |
16:24:37 | FromDiscord | <Clyybber> Here `var a = ...` is technically a firstWrite, but that depends on `b = a` being a lastRead which in turn depends on `#b = a` being commented out |
16:25:02 | FromDiscord | <Clyybber> Analysing the loop thrice would solve the problem |
16:25:42 | FromDiscord | <mratsim> but a is shadowed |
16:25:47 | FromDiscord | <mratsim> so it's not the same a |
16:25:56 | FromDiscord | <Clyybber> no, it is |
16:26:08 | FromDiscord | <Clyybber> it gets extracted out of the loop later on |
16:26:10 | FromDiscord | <Clyybber> afaik |
16:26:19 | FromGitter | <alehander92> hmm, when is needed to do it thrice |
16:26:21 | FromDiscord | <mratsim> ah, compiler magic |
16:26:26 | FromGitter | <alehander92> ahh thats interesting |
16:26:34 | FromDiscord | <Clyybber> Yeah, indeed |
16:26:35 | FromGitter | <alehander92> i thought twice is enough in cfg-s |
16:27:29 | * | NimBot joined #nim |
16:27:39 | FromGitter | <alehander92> btw |
16:27:48 | FromGitter | <alehander92> nvm offtopic |
16:28:27 | FromDiscord | <mratsim> i've seen much worse offtopic than that on the nim channel |
16:29:29 | FromDiscord | <Clyybber> all ontopic and no play makes clyybber a dull boy |
16:29:32 | FromGitter | <alehander92> no i planned |
16:29:35 | FromGitter | <alehander92> to say somethign! |
16:29:39 | FromGitter | <alehander92> but said it in offtopic |
16:32:14 | FromDiscord | <mratsim> btw, if someone is bored, I could use another pair of eyes on this protocol: https://github.com/mratsim/weave/pull/92#issuecomment-570795718 |
16:32:14 | FromDiscord | <mratsim> |
16:32:14 | FromDiscord | <mratsim> The idea is to represent data dependencies between parallel tasks via a promise. Pseudo code for the expected syntax is there: https://github.com/mratsim/weave/pull/92#issuecomment-570779099 |
16:32:15 | disbot | β₯ [WIP] Dataflow graph parallelism |
16:32:16 | disbot | β₯ [WIP] Dataflow graph parallelism |
16:32:56 | FromDiscord | <mratsim> This is something that has been plaguing me for a month now: https://github.com/mratsim/weave/issues/31 |
16:32:59 | disbot | β₯ Nested for-loops: Expressing reads-after-writes and writes-after-writes dependencies ; snippet at 12https://play.nim-lang.org/#ix=26ok |
16:33:18 | FromDiscord | <mratsim> (only read the last link if you have a LOT of time) |
16:40:46 | FromDiscord | <Clyybber> ``` |
16:40:46 | FromDiscord | <Clyybber> if cond: |
16:40:46 | FromDiscord | <Clyybber> var a = ... |
16:40:46 | FromDiscord | <Clyybber> b = a |
16:40:47 | FromDiscord | <Clyybber> if cond: |
16:40:47 | FromDiscord | <Clyybber> var a = ... |
16:40:47 | FromDiscord | <Clyybber> b = a |
16:40:48 | FromDiscord | <Clyybber> if cond: |
16:40:50 | FromDiscord | <Clyybber> var a = ... |
16:40:50 | FromDiscord | <Clyybber> b = a |
16:40:51 | FromDiscord | <Clyybber> #b = a |
16:40:53 | FromDiscord | <Clyybber> ``` |
16:40:54 | FromDiscord | <Clyybber> sry, mispaste |
16:41:05 | * | owl_000 quit (Remote host closed the connection) |
16:41:53 | FromGitter | <timotheecour> @mratsim β β > or so "of {1..3}" works? β β Yes :) [https://gitter.im/nim-lang/Nim?at=5e10c050865af87363ba5a0c] |
16:48:28 | FromDiscord | <Clyybber> alehander92: Hmm, I fear not even analyzing it unrolled thrice will solve this |
16:50:02 | FromGitter | <alehander92> Clyybber please .. no pastes here |
16:50:21 | FromDiscord | <Clyybber> Ah, sorry, it was a misclick, I didn't mean to press enter |
16:51:00 | FromGitter | <alehander92> no problem, just pastes dont seem to look good at irc/gitter afaik |
16:51:09 | FromDiscord | <Clyybber> yeah |
16:54:11 | * | ikan-keli_ quit (Quit: ZNC 1.8.x-git-125-e415d9f5 - https://znc.in) |
16:54:13 | FromDiscord | <Clyybber> ah, nevermind, unrolling the loop is the solution |
16:54:26 | * | ikan-keli_ joined #nim |
16:57:07 | * | kobi joined #nim |
16:57:16 | kobi | howdy |
16:57:33 | * | Simerax joined #nim |
16:57:55 | kobi | lol, it's raining and connection becomes so sporadic |
16:58:35 | FromDiscord | <Clyybber> I hate when it rains into my internet pipes |
17:01:00 | kobi | hehe, it's israel. so primitive :-) |
17:01:51 | kobi | even if it returns every year, it feels unexpected. the mentality of arid country is too strong to forget :) |
17:02:19 | kobi | so roads become rivers etc :-) |
17:02:45 | kobi | anyway, forgive me if I disconnect mid-sentence |
17:03:55 | kobi | Does anyone know the state of py2nim? is it able to translate something big like django for example? |
17:05:15 | kobi | nowadays, there are apparently a few ways of adding type annotations to python. mypy, and MonkeyType |
17:06:08 | FromDiscord | <Clyybber> kobi: alehander92 is the guy to ask |
17:06:31 | kobi | I wonder if it makes it easier to port. Nim after all lacks a large "eco system" of libraries. Python code is readable and high level. Maybe that's the answer? |
17:07:20 | kobi | Thanks Clybber |
17:07:23 | FromGitter | <alehander92> wow kobi israel seems interesting i planned to go there one day |
17:07:40 | FromGitter | <alehander92> so yeah the thing is |
17:07:58 | FromGitter | <alehander92> we have a older py2nim which is in the py2nim_deprecated repo |
17:09:35 | FromGitter | <alehander92> buut |
17:10:22 | FromGitter | <alehander92> we tried to make it more general with "frontends" like py2nim and rb2nim, but its a little bit unmaintained / unfinished (we mostly worked on the rb2nim thing last time): so say if you have a concrete project in mind |
17:11:21 | kobi | well, I imagine it can be a good coordinated effort, to port packages and dependencies. |
17:11:50 | kobi | figure out which ones bring most results in shortest time.... stuff like that |
17:12:11 | FromGitter | <alehander92> i think we found out its not really so obvious |
17:12:26 | kobi | hmmm |
17:12:35 | FromGitter | <alehander92> like, its an useful idea if you want to port many similar programs(like plugins or rubocop lints) |
17:12:38 | FromGitter | <alehander92> and script it a bit |
17:12:50 | FromGitter | <alehander92> or for porting algorithms/logic |
17:13:03 | FromGitter | <alehander92> but you still need to think of a nim-ish API/dsl on top to make a quality lib |
17:13:05 | FromGitter | <alehander92> / tool |
17:13:18 | disruptek | mratsim: i would use promise semantics if you call it a promise; else, give it your own name. |
17:13:44 | disruptek | s/semantics/syntax/ |
17:13:51 | FromGitter | <alehander92> you can take a look at https://metacraft-labs.github.io/fast-rubocop/ruby-kaigi-2019 |
17:14:02 | FromGitter | <alehander92> from slide 23 => kobi |
17:14:15 | FromGitter | <alehander92> for some examples of our rb2nim experiments |
17:14:26 | kobi | I think quality could be less important, in this pragmatic endeavor. |
17:14:30 | FromGitter | <alehander92> which might be applicable to py2nim porting |
17:14:33 | kobi | I also think it's a very cool project that you did |
17:14:51 | kobi | I saw that nimterop used treesitter |
17:15:36 | disruptek | maybe you could port some transforms from py2nim into nimterop. |
17:15:39 | kobi | but if i understand correctly - mostly used the querying part, instead of actual stepping thru the code |
17:16:02 | kobi | right now nimterop is c/c++ only |
17:16:04 | FromGitter | <alehander92> disruptek py2nim/rb2nim are absed on `languist` |
17:16:12 | FromGitter | <alehander92> which is supposed to be a more general framework for |
17:16:17 | FromGitter | <alehander92> X => Y porting |
17:16:31 | FromGitter | <alehander92> but it just lacks people/time |
17:16:39 | disruptek | i know languist, but iirc treesitter is further along. |
17:16:48 | FromGitter | <alehander92> languist is completely different thing |
17:16:56 | FromGitter | <alehander92> treesitter is just for parsing |
17:16:58 | kobi | but tree-sitter has language parsers for go-lang, lua, java, c# .. |
17:17:06 | disruptek | yes, that's what i meant. |
17:17:10 | FromGitter | <alehander92> but the point of languist is that |
17:18:17 | FromGitter | <alehander92> different no |
17:18:23 | shashlick | Yes it might be possible to translate from other langs to Nim with tree-sitter |
17:18:33 | FromGitter | <alehander92> it defines a language-independent stdlib/API |
17:18:40 | kobi | I wonder if tree-sitter uses the same "AST" in all these languages, it may be possible to kind of "normalize" them to Nim constructs, and generate from that. maybe. i haven't explored yet. |
17:18:45 | shashlick | But I have limited my efforts to wrapping |
17:18:52 | FromGitter | <alehander92> and makes it easier to define "rules" and "idioms" mapping from X language to Intermediate and Intemediate to Y |
17:19:08 | FromGitter | <alehander92> so if you define such X supports for e.g. Nim, Python, Ruby and Rust |
17:19:25 | FromGitter | <alehander92> it gives you Nim -> Ruby Rust -> Python Rust -> Ruby etc port-ers |
17:19:45 | shashlick | Unclear if it has the same tree structure across languages |
17:19:52 | FromGitter | <alehander92> and additionally some middleware to make it easier to define additional pass-es specific to your project |
17:20:00 | FromGitter | <alehander92> shashlick its not about the tree or parsing |
17:20:05 | FromGitter | <alehander92> its more high level |
17:20:14 | kobi | that's really smart, alehander92 |
17:20:20 | FromGitter | <alehander92> the "frontend" task is to return a intermediate AST |
17:20:44 | FromGitter | <alehander92> so yes, in the frontend you use whatever you can: treesitter/nim compiler's parser/the lang specific parser etc |
17:20:52 | FromGitter | <alehander92> iirc |
17:21:12 | shashlick | I'm not a fan of full translation |
17:21:36 | FromGitter | <alehander92> but its mostly about some local type rules/idiom translation / scripting how you want your project to be translated |
17:21:36 | shashlick | Assumes languages always have equivalent structures to map across |
17:21:47 | FromGitter | <alehander92> but i agree its a very opinionated thing |
17:21:57 | FromGitter | <alehander92> shashlick it doesnt really assume this |
17:22:17 | FromGitter | <alehander92> please, try to not assume |
17:23:16 | shashlick | I am telling you just based on C to Nim, nothing else |
17:23:18 | FromGitter | <timotheecour> > *<shashlick>* I'm not a fan of full translation β β @shashlick note: for handling C++ templates, full translation is needed anyways Iβm afraid |
17:23:27 | FromGitter | <alehander92> by design it should be possible to translate between relatively different styles e.g. functional => oop, error code return => exceptions etc |
17:23:37 | FromGitter | <alehander92> so the idea is not to just blindly map stuff to stuff |
17:23:48 | FromGitter | <alehander92> but as i said in the beginning i agree with your conclusion |
17:24:25 | FromGitter | <alehander92> its good for porting similar files that your scripted it a bit for (like lints/plugins/etc) or to automatize ~X% of the work on porting something |
17:24:53 | FromGitter | <alehander92> but it still is just a tool that eventually might help with the always needed manual work |
17:24:54 | shashlick | just mapping simple structures from C to Nim is a pain, and C has a variety of ways to define a simple thing |
17:25:11 | FromGitter | <alehander92> but i think its a bit different, as nimterop is supposed to be automatic |
17:25:37 | FromGitter | <alehander92> while here at least i dont see realistically languist working without manual refinements |
17:25:52 | FromGitter | <alehander92> yes, we tried to do that to some extent, but i admit its much harded indeed |
17:26:26 | FromGitter | <alehander92> and if the goal of nimterop was to kinda get you 50-80% of the way with requiring manual finishing |
17:26:32 | shashlick | even if it was easy to implement |
17:26:35 | FromGitter | <alehander92> i guess nimterop would be very very simple |
17:27:02 | shashlick | I don't see the value in reimplementing libs and then sitting and maintaining it when the upstream is already managed by a dedicated person or team |
17:27:13 | FromGitter | <alehander92> i agree , but i more see it for |
17:27:17 | FromGitter | <alehander92> bootstrapping a new lib |
17:27:26 | FromGitter | <alehander92> or porting a project once |
17:27:44 | shashlick | I'm sure there are valid reasons and use cases |
17:27:48 | FromGitter | <timotheecour> ya, definitely use cases for it |
17:27:58 | FromGitter | <timotheecour> (and C++ templates is a big big reason) |
17:27:59 | FromGitter | <alehander92> the rubocop example was focused on the maintanence thing indeed and there were some ideas about patching and stuff but it just didnt go far |
17:28:02 | FromGitter | <alehander92> so i am a skeptic |
17:28:20 | FromGitter | <alehander92> but i think c++ templates are more nimterop-like level |
17:28:28 | shashlick | I've said the same point to many people, and I've spent the last two years dedicated to just wrapping C libs |
17:28:34 | shashlick | and it's been a long long road |
17:29:06 | shashlick | I've not even touched C++, let alone other langs |
17:29:29 | shashlick | of course, you can say I'm doing this on the side so someone who is dedicated or more experienced in the domain can pull it off faster |
17:29:34 | FromGitter | <timotheecour> (parts of) opencv would be a usability milestone |
17:30:07 | * | ng0 joined #nim |
17:30:07 | * | ng0 quit (Changing host) |
17:30:07 | * | ng0 joined #nim |
17:32:12 | FromGitter | <alehander92> kobi but sorry again for going offtopic, if you need it for particular projects maybe one can fix a more stable version of py2nim just to semitranslate the syntax/types for easier manual work |
17:34:47 | * | couven92 joined #nim |
17:35:23 | FromGitter | <alehander92> i admit its just a bit vaporware currently :( :D |
17:36:12 | disruptek | today is a good day to build something awesome. |
17:36:26 | FromDiscord | <Clyybber> I agree, but the days about to end |
17:36:30 | FromDiscord | <Clyybber> at least here |
17:37:57 | * | ng0 quit (Ping timeout: 265 seconds) |
17:39:37 | FromDiscord | <Clyybber> gotta hurry |
17:40:15 | Zevv | Remember, farts and grinds people, sharts and blinds! |
17:54:40 | FromGitter | <alehander92> okk |
17:54:40 | disruptek | you be you, zevv. |
17:54:44 | FromGitter | <alehander92> no |
17:54:50 | FromGitter | <alehander92> disruptek where are you |
17:54:57 | FromGitter | <alehander92> in a truck somewhere in illinois? |
17:55:00 | Zevv | disruptek: sure, that's what I'm best at :) |
17:55:20 | FromGitter | <alehander92> i always imagine you .. maybe a bit like those hurricane catchers |
17:55:20 | Zevv | And you be you, you'll never know how much I appreciate you! |
17:55:37 | FromGitter | <alehander92> sitting on a computer somewhere in the back of a truck in the middle of rural .. um something |
17:55:43 | disruptek | i'm in philly until we can get this house sold. |
17:55:55 | Zevv | and where you're heading then? |
17:55:56 | FromGitter | <alehander92> i am in philly too |
17:56:02 | disruptek | are you? |
17:56:09 | FromGitter | <alehander92> phillipopolis |
17:56:17 | FromGitter | <alehander92> :( bad pun, its called plovdiv now |
17:56:54 | FromDiscord | <exelotl> bleh I have an annoying structural issue with my game |
17:57:00 | disruptek | that looks like a typo. |
17:57:34 | FromDiscord | <exelotl> basically every room/area has a file that looks like this: https://gist.github.com/exelotl/3e3ce45b02e82f77de3dd512b510eafd |
17:57:49 | FromGitter | <alehander92> you need an interior designer man |
17:57:55 | FromGitter | <alehander92> my rooms dont look like this |
17:58:16 | FromGitter | <alehander92> oh sorry your sentence said `file`, i really have to take a rest from puns |
17:58:25 | FromDiscord | <exelotl> lmao |
17:58:39 | Zevv | disruptek: where will you be moving to? |
17:59:35 | disruptek | my sister's last name is O'Neill. she got a tattoo `&39;` on her shoulder 'cause she is always getting mail addressed to Hilary O&39;Neill. |
17:59:51 | * | beshr joined #nim |
18:00:06 | FromDiscord | <exelotl> it just gets really unweildy as I add more systems to the game, cause I need to manually call open/close/update/draw for each one... if I add a new system I have to make the change in every single scene that uses it |
18:00:08 | Zevv | pics or it didn't happen! |
18:00:10 | disruptek | i am planning on taking a southern route to vegas. |
18:00:20 | disruptek | wanna buy shashlick a drink in austin. |
18:01:50 | disruptek | thinking of opening a new shop in vegas so i can be closer to rayman. |
18:01:51 | Zevv | ha |
18:02:28 | * | kobi quit (Quit: Leaving) |
18:03:49 | FromGitter | <alehander92> raymanshop |
18:04:01 | FromGitter | <alehander92> for ramen and xray scanners |
18:06:38 | FromDiscord | <Clyybber> alehander92 shop; for bad puns :p |
18:07:12 | disruptek | i think this'll be more like a hackspace where you can share tools, equipment, and dubious "expertise". |
18:07:30 | FromDiscord | <Clyybber> dubios.. |
18:07:32 | shashlick | Long way from Vegas man |
18:07:57 | disruptek | i've been back and forth across the country many time. |
18:08:01 | disruptek | times, too. |
18:08:48 | FromGitter | <alehander92> Clyybber i am trying to stop but i just shop |
18:09:35 | FromDiscord | <Clyybber> snap |
18:15:53 | FromDiscord | <mratsim> @disruptek, what is a Promise syntax? |
18:16:17 | disruptek | you know, the whole then/done thing. |
18:16:53 | FromDiscord | <mratsim> that can come after |
18:17:15 | FromDiscord | <mratsim> same with futures "andThen" |
18:18:43 | FromDiscord | <mratsim> I can call it "pledge" π |
18:18:45 | disruptek | i guess i'm just responding to not having expected terms, in the same way that we all know what `await` means. |
18:18:57 | disruptek | yeah, i use pledge, vow in my code. |
18:19:41 | FromDiscord | <mratsim> It's use the same as in habanero java i think |
18:20:01 | FromDiscord | <inv> are there any possibility to work with table in functional way? trying sequtils+sugar, but cannot make it work on tables |
18:20:09 | disruptek | naming is hard. |
18:20:26 | FromDiscord | <mratsim> at its core a Promise is a placeholder and you can attach deferred function to it |
18:20:39 | disruptek | yep. |
18:20:48 | FromDiscord | <mratsim> contrary to futures which are deferred results |
18:21:16 | * | couven92 quit (Ping timeout: 268 seconds) |
18:21:17 | FromDiscord | <mratsim> but I'll leave name bikeshedding for another time, it's a luxury problem |
18:21:39 | FromDiscord | <mratsim> @inv what's a functional way to use tables? |
18:22:05 | FromDiscord | <inv> table.map((k,v) => v).sum() |
18:22:40 | FromDiscord | <inv> table.map(x => x[1]).foldl(a+b) |
18:22:47 | FromDiscord | <mratsim> myTable.foldIt(0, a + b) |
18:23:03 | FromDiscord | <mratsim> something like this |
18:23:40 | FromDiscord | <inv> cannot find foldit for table |
18:24:08 | FromDiscord | <mratsim> it's a template, it works for any collection for which the "items" iterator is defined |
18:24:23 | FromDiscord | <mratsim> though templates use values so maybe it wouldn't work |
18:24:49 | * | odc left #nim (#nim) |
18:24:53 | FromDiscord | <Clyybber> I guess you could define items yourself |
18:25:03 | FromDiscord | <Clyybber> and use values for it |
18:25:18 | FromDiscord | <Clyybber> or keys |
18:25:22 | FromDiscord | <Clyybber> depending on what you need |
18:26:06 | FromDiscord | <inv> do you have any example? |
18:27:37 | FromDiscord | <Clyybber> ``` |
18:27:37 | FromDiscord | <Clyybber> iterator items*[A, B](t: Table[A, B]): A = |
18:27:37 | FromDiscord | <Clyybber> for k in t.keys: yield k |
18:27:37 | FromDiscord | <Clyybber> ``` |
18:28:09 | * | FromGitter quit (Read error: Connection reset by peer) |
18:28:28 | * | FromGitter joined #nim |
18:28:34 | FromDiscord | <inv> is n't implemented for tables already? |
18:28:47 | FromDiscord | <Clyybber> no, only keys and values |
18:29:20 | FromDiscord | <Clyybber> it kinda surprised me too tbh, but I guess it makes sense, since it isn't clear wether items should iterate over the keys or the values |
18:29:22 | disruptek | pairs is impl, silly. |
18:30:33 | FromDiscord | <inv> I think the same - pairs |
18:40:46 | disruptek | Zevv: https://imgur.com/gallery/9w6Qia3 |
18:41:12 | Zevv | dude! |
18:41:17 | Zevv | that's pretty cool :) |
18:44:21 | disruptek | yeah, she's an angular chick. |
18:44:52 | * | couven92 joined #nim |
18:45:32 | * | Vladar joined #nim |
18:53:12 | rayman22201 | lol disruptek. I will definitely take you out for a beer if you come down :-) |
18:55:04 | Zevv | and his sister! |
18:55:31 | rayman22201 | Well of course! I'm a gentleman :-P |
18:59:44 | FromGitter | <timotheecour> @araq how about: `nilsafe` ? |
19:00:25 | FromGitter | <timotheecour> notnil already has other meanings... |
19:01:04 | FromGitter | <timotheecour> or `nilwrap` |
19:09:38 | * | couven92 quit (Ping timeout: 240 seconds) |
19:11:07 | * | couven92 joined #nim |
19:15:46 | * | Minimisthupper joined #nim |
19:16:05 | * | nsf quit (Quit: WeeChat 2.7) |
19:20:43 | Minimisthupper | Hey, I've got this error: type mismatch: got (Row) but expected 'string' and wrote a little toString proc. But how can I find the data type of the "(Row)" (there is a string in it). |
19:20:45 | * | marmotini_ quit (Remote host closed the connection) |
19:21:17 | * | marmotini_ joined #nim |
19:26:48 | * | sp4c38 joined #nim |
19:27:02 | * | abm joined #nim |
19:27:23 | * | endragor quit (Remote host closed the connection) |
19:28:03 | * | marmotini_ quit (Ping timeout: 268 seconds) |
19:29:40 | * | sp4c3851 joined #nim |
19:30:38 | * | sp4c3851 quit (Remote host closed the connection) |
19:34:44 | FromGitter | <alehander92> .ensure ? |
19:34:47 | FromGitter | <alehander92> @timotheecour ? |
19:34:57 | FromGitter | <alehander92> maybe too common |
19:37:57 | rayman22201 | Hey @timotheecour, that mongodb guy never responded to my PR request and it's now been months... I think the project is dead. Any thoughts on forking it? |
19:43:08 | * | ng0 joined #nim |
19:43:20 | * | ng0 quit (Client Quit) |
19:45:33 | * | couven92 quit (Ping timeout: 265 seconds) |
19:46:18 | * | couven92 joined #nim |
19:46:34 | * | Minimisthupper quit (Remote host closed the connection) |
19:48:09 | * | sp4c38 quit (Quit: sp4c38) |
19:51:47 | FromDiscord | <Clyybber> Araq: Since I now go through the entire CFG I'm encountering infinite recursion with this: https://hastebin.com/geyaciruka.pl |
19:53:02 | FromDiscord | <Clyybber> Oh, wait. Thats my bug |
20:03:59 | * | fredrik92 joined #nim |
20:04:19 | * | couven92 quit (Read error: Connection reset by peer) |
20:04:46 | * | Vladar quit (Quit: Leaving) |
20:06:59 | * | Simerax quit (Quit: https://quassel-irc.org - Komfortabler Chat. Γberall.) |
20:08:03 | * | Vladar joined #nim |
20:11:04 | * | endragor joined #nim |
20:16:02 | * | endragor quit (Ping timeout: 240 seconds) |
20:28:11 | * | abm quit (Quit: Leaving) |
20:31:12 | FromDiscord | <sealmove> Guys, can you explain this C++ syntax? `std::ifstream ifs ("text.txt", std::ifstream::in);` |
20:33:14 | FromGitter | <alehander92> didnt this replace define |
20:33:20 | FromGitter | <alehander92> ifs as an input stream |
20:33:24 | FromGitter | <alehander92> or replace stdin |
20:33:27 | FromGitter | <alehander92> not sure |
20:35:18 | FromDiscord | <sealmove> No I meant the initialization syntax |
20:35:23 | FromDiscord | <sealmove> Without new |
20:35:39 | FromDiscord | <sealmove> Is it stack allocation like nim? |
20:38:02 | FromDiscord | <sealmove> `Type varname (arg1)` |
20:39:18 | FromDiscord | <sealmove> Instead of say `Type varname` = `Type(arg1)` |
20:39:30 | FromDiscord | <sealmove> Pretty weird... |
20:40:35 | FromDiscord | <sealmove> I don't understand why C++ must have such an incoherent syntax. |
20:40:45 | * | ng0 joined #nim |
20:41:24 | FromDiscord | <sealmove> Or rather semantics |
21:01:07 | * | robin1 joined #nim |
21:01:29 | * | robin1 quit (Client Quit) |
21:17:51 | * | fredrik92 is now known as couven92 |
21:29:57 | * | narimiran quit (Ping timeout: 265 seconds) |
21:31:00 | * | couven92 quit (Ping timeout: 258 seconds) |
21:36:56 | disruptek | I MADE IT |
21:36:59 | * | rockcavera quit (Remote host closed the connection) |
21:45:51 | * | nsf joined #nim |
21:47:39 | * | sschwarzer joined #nim |
21:49:09 | Zevv | GOOD FOR YOU! |
21:50:21 | sschwarzer | Hi everyone, happy new year! |
21:50:25 | sschwarzer | :-) |
21:54:12 | Zevv | "Making sure procs work; spoiler: they do" |
21:54:23 | Zevv | who puts puns in their commit messages?! |
21:54:50 | * | Trustable quit (Remote host closed the connection) |
21:55:50 | sschwarzer | Zevv: *lol* Ouch |
22:01:38 | disruptek | "add HubCode and hope i die in my sleep" |
22:03:35 | sschwarzer | disruptek :-D |
22:03:53 | disruptek | sup sshwarzer |
22:03:58 | disruptek | ^c |
22:04:25 | disruptek | it's not enough to move bad code into new files. |
22:04:30 | disruptek | we must move it into new libraries. |
22:04:31 | sschwarzer | disruptek: I sent you a PM :) |
22:04:41 | disruptek | was there money inside? |
22:05:00 | sschwarzer | disruptek: no :) on IRC |
22:05:24 | disruptek | why no money? |
22:05:38 | disruptek | WHY NO |
22:06:44 | disruptek | how about `ifen` instead of `maybe`? |
22:07:48 | * | ptdel joined #nim |
22:08:47 | disruptek | !repo todotxt |
22:08:50 | disbot | https://github.com/benrhughes/todotxt.net -- 9todotxt.net: 11An implementation of todo.txt for Windows using the .NET framework 15 401β 99π΄ 7& 29 more... |
22:09:08 | disruptek | what does it all mean? |
22:11:27 | * | gangstacat quit (Quit: Δis!) |
22:15:18 | * | gangstacat joined #nim |
22:24:24 | skrylar[m] | should redefining something defined with `let` really be an error :thonk: |
22:25:30 | disruptek | yes, but we should be able to define a let in one scope and set it (once) in another. |
22:33:50 | disruptek | so devel doesn't require a mutable table for clear() but 1.0 does? |
22:35:31 | * | endragor joined #nim |
22:35:40 | skrylar[m] | Β―\_(γ)_/Β― @freenode_disruptek:matrix.org: typically functional languages (of which let is borrowed from) don't throw a fuss if you re-bind a name, since they just consider the old binding obsolete |
22:36:09 | skrylar[m] | inb4 someone says someting stupid like 'were not haskell' |
22:36:36 | disruptek | you can rebind using a new let in a new scope. |
22:36:45 | disruptek | otherwise, use var. |
22:37:43 | disruptek | my question is, why can i not define a let's type at the top of a scope and then assign it a value later in the same (or lower) scope? |
22:38:09 | skrylar[m] | i guess i need to start appending a standard disclaimer to messages now because i was explicitly not asking for workarounds (i know how to use `var`, thanks, i did not write five something public modules now by being a retard) i was pointing out it doesn't make sense that you can't replace a constant binding with another constant binding |
22:38:24 | * | skrylar[m] goes back to writing cbor encoders |
22:38:30 | disruptek | i don't think `constant` means what you think it means. |
22:39:44 | FromDiscord | <Clyybber> offtopic, but is someone here familiar with java streams? |
22:40:00 | * | endragor quit (Ping timeout: 258 seconds) |
22:45:17 | * | Lord_Nightmare joined #nim |
22:47:57 | * | Vladar quit (Quit: Leaving) |
23:01:29 | sschwarzer | !repo npeg |
23:01:30 | disbot | https://github.com/zevv/npeg -- 9npeg: 11PEGs for Nim, another take 15 75β 4π΄ |
23:14:35 | * | nsf quit (Quit: WeeChat 2.7) |
23:16:55 | sschwarzer | !help |
23:20:24 | * | lritter quit (Quit: Leaving) |
23:22:05 | * | solitudesf quit (Ping timeout: 265 seconds) |
23:25:11 | FromDiscord | <sealmove> Clyybber yes, java streams |
23:25:45 | * | sealmove joined #nim |
23:29:23 | * | sschwarzer quit (Quit: leaving) |
23:36:50 | * | couven92 joined #nim |
23:38:30 | FromGitter | <matrixbot> `arkaroo` Hrm, I feel like I'm missing something here. I'm trying to use Jester, Redis and nim-metrics together. Nim-metrics requires me to run with --threads:on, which means that jester starts to encorce the {.gcsafe.} pragma. That means that I can't use the redis client from within the jester routes functions, because I get errors like the following: `Error: 'matchIter' is not GC-safe as it calls 'smembers'` |
23:38:31 | FromDiscord | <Clyybber> ah, great. I basically solved the issue I having myself, but boy did I have to dig through documentation |
23:38:45 | FromDiscord | <Clyybber> all in all, I think streams are the best part about java though |
23:39:08 | FromGitter | <matrixbot> `arkaroo` does that mean that the redis client is not thread-safe and I'm just screwed/need to find a different redis library, or is there something I can do to make redis gc-safe? |
23:39:43 | FromGitter | <matrixbot> `arkaroo` * Hrm, I feel like I'm missing something here. I'm trying to use Jester, Redis and nim-metrics together. Nim-metrics requires me to run with --threads:on, which means that jester starts to enforce the {.gcsafe.} pragma. That means that I can't use the redis client from within the jester routes functions, because I get errors like the following: `Error: 'matchIter' is not GC-safe as it calls 'smembers'` |
23:39:48 | disruptek | try --gc:boehm for starters. |
23:40:11 | FromDiscord | <Clyybber> @sealmove Ah, nevermind, still got a question; can I get the count() of a stream without consuming it? |
23:40:27 | disruptek | clyybber: who are you? |
23:40:46 | FromDiscord | <Clyybber> disruptek: ? |
23:40:51 | sealmove | Clyybber: java typically uses methods like hasInt etc |
23:40:54 | FromDiscord | <Clyybber> I hate java but I have to bear with it |
23:40:56 | sealmove | nextInt * |
23:41:07 | FromDiscord | <Clyybber> I mean the size |
23:41:11 | FromDiscord | <Clyybber> the size of a stream |
23:41:11 | disruptek | peeking? |
23:41:17 | sealmove | hasNextInt |
23:41:19 | sealmove | yes |
23:41:32 | disruptek | he wants to know how many more bytes he could read, in total. |
23:41:37 | disruptek | nutjob. |
23:41:53 | disruptek | he wants file semantics on his stream. |
23:41:59 | FromDiscord | <Clyybber> basically yeah |
23:42:04 | FromDiscord | <Clyybber> dumb thing I know |
23:42:14 | FromDiscord | <Clyybber> well, I'll guess I'll just read the file twice |
23:42:29 | FromDiscord | <Clyybber> one time to print out the amount of entries |
23:42:41 | FromDiscord | <Clyybber> and another time to print out the entries lol |
23:42:52 | sealmove | that's lame :| |
23:43:05 | sealmove | but of course you can cache results and print at the end |
23:43:05 | FromDiscord | <Clyybber> not sure how to do it otherwise |
23:43:12 | disruptek | the file/entries are too big for memory but you're willing to i/o it twice? |
23:43:16 | FromDiscord | <Clyybber> I have to print the size before |
23:43:24 | FromDiscord | <Clyybber> disruptek: Nah, its tiny |
23:43:27 | sealmove | yeah so don't print while iterating file |
23:43:51 | FromDiscord | <Clyybber> ah, university assignment, not my idea |
23:44:13 | disruptek | output it backwards and ask your use to flip their display. |
23:44:19 | FromDiscord | <Clyybber> lol |
23:44:30 | FromDiscord | <Clyybber> or quit university |
23:44:33 | FromDiscord | <Clyybber> problem solved |
23:44:58 | disruptek | glad i never went to school. |
23:45:12 | FromGitter | <matrixbot> `arkaroo` @disruptek no change, but does changing the gc mode change what the gcsafe pragma errors on? |
23:45:22 | sealmove | well Clyybber |
23:45:36 | sealmove | did you try the typical C way? |
23:45:45 | disruptek | i don't think so, but it may let you hack the lib to let it be looser with gc demands. |
23:45:50 | FromDiscord | <Clyybber> nope, I have to use streams |
23:45:50 | disruptek | (and yet not crash) |
23:45:52 | sealmove | going to end of stream, get position, then go back? |
23:45:56 | FromDiscord | <Clyybber> oof |
23:45:56 | disruptek | boehm is more thread-friendly. |
23:46:07 | FromDiscord | <Clyybber> i'm too lazy, im just gonna read it twice heh |
23:46:22 | disruptek | i thought you already graduated. |
23:46:54 | FromGitter | <matrixbot> `arkaroo` it continues to give the same error even with gc:none |
23:47:18 | disruptek | yes, you will have to modify the lib. |
23:47:58 | sealmove | https://www.geeksforgeeks.org/stream-count-method-java/ |
23:48:00 | sealmove | this> |
23:48:02 | sealmove | ?* |
23:48:02 | FromDiscord | <Clyybber> disruptek: from college (or whatever the equivalent of germanys "gymnasium" is) |
23:49:10 | FromGitter | <matrixbot> `arkaroo` @Clyybber: is there any chance the file will mutate under you while you do that? I'd suggest reading it into a buffer and then working on the buffer to make sure it doesn't |
23:49:46 | FromDiscord | <Clyybber> nah, it wont. its a dumb assignment, I don't want to waste time on that shit |
23:50:05 | FromDiscord | <Clyybber> but thanks for all the help |
23:50:53 | sealmove | yeah there is no clean way without consuming, but if you consume twice then at least use count() since it's the simplest/most obvious way |
23:51:26 | FromDiscord | <Clyybber> yeah, doing that now |
23:52:29 | FromGitter | <matrixbot> `arkaroo` @disruptek: sadface, I might shop around for different redis libraries then I guess, cheers for the info |
23:56:41 | * | Lord_Nightmare quit (Quit: ZNC - http://znc.in) |