00:12:49 | * | zachcarter joined #nim |
00:21:23 | ldlework | Is there any way to print a typedesc? |
00:21:52 | ldlework | .name |
00:22:09 | ldlework | nope |
00:22:35 | * | Jesin joined #nim |
00:22:42 | ldlework | hmm dang it tells me the lowest type |
00:28:20 | ldlework | If you have some subtype relationships |
00:28:35 | ldlework | and you have a subtype value in a context where it is considered the basetype |
00:28:44 | ldlework | is there anyway at all to check whether it is one of the subtypes? |
00:41:15 | * | nsf quit (Quit: WeeChat 1.7) |
00:44:31 | * | Jesin quit (Quit: Leaving) |
00:47:18 | zachcarter | I think you can try casting it to the subtype |
00:59:35 | ldlework | yeah but how do you test |
01:01:29 | zachcarter | hmm |
01:01:42 | zachcarter | I guess if it’s a ref type you can just check for nil, if it’s an object I’m not sure |
01:02:17 | ldlework | no I mean |
01:02:24 | ldlework | lets say you have a tree structure |
01:02:31 | ldlework | of nodes that all share a base type |
01:02:37 | ldlework | they refer to each other via a base type |
01:02:41 | ldlework | you have a node and you get its parent |
01:02:45 | ldlework | as the base type |
01:02:52 | ldlework | and you wanna do something depending on what kind of parent it has |
01:02:54 | ldlework | how do you know? |
01:04:00 | zachcarter | oh I see |
01:04:48 | zachcarter | do you have a gist or anything I can play with? I’m not 100% sure off the top of my head but I may be able to figure something out |
01:05:44 | * | chemist69 quit (Ping timeout: 256 seconds) |
01:12:29 | * | yglukhov joined #nim |
01:16:59 | * | yglukhov quit (Ping timeout: 260 seconds) |
01:18:06 | * | chemist69 joined #nim |
01:19:53 | ldlework | I have this method, https://gist.github.com/dustinlacewell/f96b00a8434be69826a1b98240fd3120 and I get: Error: for a 'var' type a variable needs to be passed on line 7 |
01:19:59 | ldlework | what does it want me to do? |
01:20:58 | zachcarter | y isn’t mutable |
01:21:20 | zachcarter | does drawPoint take a mutable parameter? |
01:21:42 | ldlework | https://wiki.libsdl.org/SDL_RenderDrawPoint |
01:22:08 | zachcarter | hrm |
01:22:53 | ldlework | makes no sense |
01:23:29 | ldlework | I've literally made everything var |
01:23:43 | zachcarter | try maybe |
01:23:45 | zachcarter | y.cint |
01:23:57 | zachcarter | only other thing I can think of |
01:24:38 | ldlework | the error is on the for-loop line |
01:24:48 | ldlework | if I replace the draw with an echo of a string it still complains |
01:24:57 | zachcarter | ah okay |
01:25:04 | ldlework | var y: int |
01:25:06 | ldlework | for y in top..bottom: |
01:25:08 | ldlework | echo "wtf" |
01:25:10 | ldlework | still complains |
01:26:01 | * | Nobabs27 joined #nim |
01:26:52 | ldlework | zachcarter: isn't that mysterious? |
01:26:58 | zachcarter | it’s confusing me for sure |
01:27:02 | zachcarter | I’m trying to replicate with glot.io |
01:27:05 | zachcarter | not having much luck :/ |
01:27:46 | ldlework | ...I ... I think its the range function? |
01:27:54 | ldlework | when I hardcode numbers instead it works |
01:27:55 | ldlework | wtffff |
01:29:06 | zachcarter | I tried even creating a type |
01:29:14 | zachcarter | with int properties |
01:29:19 | zachcarter | but it worked fine haha |
01:29:24 | zachcarter | you must have done something special :P |
01:29:53 | ldlework | the bigger the application I write the more fragile the compiler becomes |
01:31:18 | zachcarter | there’s *probably* an explanation but everyone that has a lot of knowledge is asleep atm besides like Varriount and ftsf |
01:46:37 | * | rupil joined #nim |
02:01:51 | * | PMunch quit (Quit: leaving) |
02:03:06 | * | chemist69 quit (Ping timeout: 240 seconds) |
02:13:15 | * | Jesin joined #nim |
02:17:03 | * | chemist69 joined #nim |
02:30:10 | * | Jesin quit (Quit: Leaving) |
02:35:10 | zachcarter | what’s up with `shr` vs just shr |
02:42:10 | * | vendethiel- quit (Ping timeout: 260 seconds) |
02:43:11 | * | vendethiel joined #nim |
02:49:44 | zachcarter | https://github.com/zacharycarter/nimrl |
02:56:31 | bozaloshtsh | cool |
02:57:57 | bozaloshtsh | `shr` lets you use the operator as a function syntax if thats what you were asking |
02:58:02 | bozaloshtsh | or rather proc syntax |
02:59:25 | bozaloshtsh | I've only found such syntax to be useful when working with funky templates |
03:11:35 | zachcarter | ah okay thanks you |
03:14:22 | * | yglukhov joined #nim |
03:19:26 | * | yglukhov quit (Ping timeout: 268 seconds) |
03:20:53 | * | shashlick quit (Ping timeout: 240 seconds) |
03:22:02 | * | shashlick joined #nim |
03:48:38 | FromGitter | <Varriount> zachcarter: What are you creating now? |
03:48:52 | zachcarter | well I want to start building my game with frag |
03:49:06 | zachcarter | and my game uses a LOT of procedural generation |
03:49:44 | FromGitter | <Varriount> roguelike ftw! |
03:49:46 | zachcarter | so I’m going to start porting a library I depended on a lot |
03:49:50 | zachcarter | yup! |
03:50:06 | zachcarter | thankfully the author / maintainer of the library is a friend via libgdx |
03:50:12 | zachcarter | so he’s helping me :D |
03:50:28 | FromGitter | <Varriount> libgdx is one of the few libraries that makes working in Java tolerable. |
03:50:36 | zachcarter | agreed |
03:50:51 | zachcarter | this is one class I’ll eventually need to port |
03:50:54 | zachcarter | if I want to support my map generator |
03:51:41 | zachcarter | https://github.com/SquidPony/SquidLib/blob/master/squidlib-util/src/main/java/squidpony/squidmath/GreasedRegion.java |
03:52:43 | zachcarter | https://github.com/zacharycarter/mapgen - is the map generator I was working on for my game, shortly before deciding to drop all my Java work and switch to Nim |
03:59:10 | * | BitPuffin|osx quit (Ping timeout: 260 seconds) |
04:03:08 | ldlework | zachcarter: my game uses a lot of procgen too... |
04:03:32 | zachcarter | Idlework: you may find the lib I’m working on useful then |
04:03:53 | ldlework | zachcarter: we're both working on similar libraries.. |
04:03:59 | zachcarter | ah haha |
04:04:00 | ldlework | here's my map generator in action, http://i.imgur.com/XpfYVLK.png |
04:04:15 | zachcarter | nice |
04:04:54 | ldlework | zachcarter: are you making a roguelike? |
04:05:13 | ldlework | I'm making a clone of Cataclysm DDA, but more bent towards magic realism |
04:05:19 | zachcarter | just figured out I could zoom :P |
04:06:08 | zachcarter | I guess I’m going for a roguelite, it’s definitely going to have some roguelike mechanics |
04:06:41 | ldlework | zachcarter: read this https://www.rockpapershotgun.com/2016/11/14/cataclysm-dark-days-ahead/ |
04:07:10 | zachcarter | reading now |
04:08:20 | FromGitter | <Varriount> I have yet to see a map generator that makes proper oceans. |
04:08:29 | zachcarter | water is hard |
04:08:39 | * | FromGitter * Varriount want *oceans*, not lakes |
04:08:47 | ldlework | If you look at my picture |
04:08:56 | ldlework | you can just imagine the same thing at a different scale |
04:09:01 | ldlework | its just a parameter |
04:09:06 | zachcarter | well technically the maps I made are world wrapping in four dimensions |
04:09:14 | zachcarter | so you could project them onto an icosahedron |
04:09:39 | zachcarter | they use 4d noise to generate so you would have oceans |
04:09:49 | zachcarter | I didn’t do lakes, and I spent way too much time on rivers |
04:10:11 | FromGitter | <Varriount> zachcarter: Perlin, or Simplex? |
04:10:33 | zachcarter | I used a whole bunch of different types of noise I was using the accidental noise library from Josha Tippetts or a port of it anyway |
04:10:48 | zachcarter | and I believe he uses open simplex |
04:10:55 | zachcarter | but I’m not 100% sure on that |
04:11:23 | zachcarter | the world map generator was just a small portion of my plroject |
04:11:24 | zachcarter | project* |
04:11:35 | FromGitter | <Varriount> Neat. I can't say I understand how to implement a noise generator, but I know that simplex is supposed to be an improvement upon perlin |
04:11:41 | zachcarter | shaded ascii planets |
04:11:50 | zachcarter | spaceship dungeons with lock and key puzzles |
04:11:56 | FromGitter | <Varriount> :O |
04:12:02 | zachcarter | zelda-esque dungeons with graph constraint grammars |
04:12:54 | zachcarter | https://twitter.com/Hahaitsfunny/status/801933402849026048 |
04:13:00 | zachcarter | there’s a screenshot of the spaceship dungeons |
04:13:46 | ldlework | cool |
04:14:04 | zachcarter | thanks |
04:14:23 | FromGitter | <Varriount> zachcarter: Amazing. Far beyond my knowledge! |
04:14:51 | zachcarter | Varrount: lots of graph theory :P also studying a lot of other people’s code haha |
04:14:57 | zachcarter | Varriount* |
04:15:39 | FromGitter | <Varriount> I'll have to study yours sometime. :D |
04:17:55 | zachcarter | :D looking forward to getting some stuff working in Nim |
04:44:14 | * | chinchilla joined #nim |
04:52:15 | * | def-pri-pub joined #nim |
04:58:57 | ldlework | Can anyone help me understand this error? https://gist.github.com/dustinlacewell/d2142bac3a0ede5172ba4aa031f167f6 |
04:59:13 | ldlework | the line number in the error is adjusted for the gist |
05:01:36 | ldlework | Varriount any idea? |
05:02:24 | * | rupil quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client) |
05:04:07 | FromGitter | <Varriount> ldlework: Do you define a base method? |
05:04:18 | ldlework | yeah |
05:04:25 | ldlework | https://gist.github.com/dustinlacewell/d2142bac3a0ede5172ba4aa031f167f6#file-resize-nim-L19 |
05:04:48 | FromGitter | <Varriount> I mean, using {.base.} |
05:05:16 | ldlework | it doesn't seem to change anything |
05:05:25 | FromGitter | <Varriount> I'm not sure methods will work with generics though. |
05:06:47 | ldlework | so you can make an inheritance tree, but you can't reuse it for different types |
05:07:24 | * | Nobabs27 quit (Quit: Leaving) |
05:07:56 | FromGitter | <Varriount> ldlework: Let me think. |
05:08:25 | FromGitter | <Varriount> ldlework: Not many people need dynamic dispatch in addition to generics. |
05:08:48 | ldlework | I don't understand how other people write software |
05:08:59 | ldlework | I want every line factored... |
05:09:37 | ldlework | It seems to be mostly working |
05:10:11 | FromGitter | <Varriount> ldlework: Worst case, just add a member storing the procedure you want to call. |
05:10:55 | ldlework | lol |
05:11:06 | FromGitter | <Varriount> I'm still looking on the forum. |
05:12:32 | FromGitter | <Varriount> Once @Araq is on, I'd ask him for more information. |
05:15:47 | FromGitter | <Varriount> ldlework: If you aren't expecting others to create derivative of those types (as in, you will always fully control the inheritance hierarchy) you can use object variants instead. |
05:16:24 | ldlework | I started with object variants |
05:16:29 | ldlework | it was case city |
05:16:43 | * | yglukhov joined #nim |
05:16:44 | ldlework | methods are nice because they allow you to highly factor the implementation |
05:16:49 | ldlework | at least when it works.. |
05:17:18 | ldlework | Varriount, a generic BSP is an interesting data structure challenge |
05:17:30 | ldlework | you have leaves that should be able to hold T |
05:17:33 | FromGitter | <Varriount> ldlework: Use a template to handle the cases for you? |
05:17:50 | ldlework | I'm not satisfied with that answer |
05:18:02 | FromGitter | <Varriount> ldlework: Is that all the code? I'm getting a type undefined error when I try to run the code. |
05:18:10 | ldlework | if I can't make this simple data structure I'm decidedly unhappy with the state of things |
05:18:15 | ldlework | Varriount, no |
05:18:36 | ldlework | I've already backed away from methods for resize |
05:18:40 | ldlework | running into other issues now :) |
05:18:49 | ldlework | for example now that I'm using procs |
05:19:02 | ldlework | the branching node stores its child nodes as the base type |
05:19:10 | ldlework | and now it wants to call .resize on the child node |
05:19:18 | ldlework | but it can't use the right implementation |
05:19:26 | ldlework | because all the .resize's are procs |
05:19:31 | ldlework | if they were methods it would just use the right one |
05:19:41 | FromGitter | <Varriount> ldlework: I can't do much without a look at your current implementation. |
05:19:42 | ldlework | but it couldn't "instantiate" resize |
05:19:52 | FromGitter | <Varriount> It also helps if I can run the implementation. |
05:20:56 | ldlework | well you'll need to clone dadren and install it from source |
05:21:55 | ldlework | Varriount, https://github.com/dustinlacewell/dadren/tree/bsp |
05:22:13 | ldlework | nimble install -y && cd examples/bsp2/ && make run |
05:22:22 | ldlework | This is in the proc state |
05:22:46 | ldlework | where the resize implementations are like, "woah there's no resize for BSPNode" |
05:22:51 | ldlework | of course there isn't |
05:22:59 | ldlework | you can try to make them methods again |
05:23:33 | ldlework | Varriount, basically methods are nice because they put all the type checking into runtime |
05:23:47 | ldlework | into the Runtime |
05:23:50 | * | yglukhov quit (Ping timeout: 260 seconds) |
05:24:04 | ldlework | IE not in your code |
05:24:46 | ldlework | object variants make your code look like a series of ladders as you have the same series of case statements in all the things that touch the variant |
05:25:07 | FromGitter | <Varriount> I understand that. |
05:25:08 | ldlework | you basically take on all that complexity into your own implementation |
05:26:14 | FromGitter | <Varriount> ldlework: You've finally forced me to install Nim on another laptop. |
05:26:51 | FromGitter | <Varriount> Until now I've been able to get away with using glot.io |
05:28:02 | ldlework | hehe |
05:28:50 | ldlework | i appreciate the attention |
05:32:10 | ldlework | Varriount, for your convenience, cd ../../ && nimble install -y; cd examples/bsp2 && make run |
05:32:53 | ldlework | from inside bsp2 |
05:34:35 | FromGitter | <Varriount> I want to work on that method version |
05:35:33 | ldlework | Varriount, the changes are fairly simple |
05:36:00 | ldlework | change them to methods, and make the generic one the base method of BSPNode |
05:36:03 | * | yglukhov joined #nim |
05:37:15 | ldlework | then it will complain that it cannot instantiate resize, and it will point you to the declaration of Leaf |
05:37:22 | ldlework | whatever that's supposed to imply |
05:37:24 | ldlework | lol |
05:44:25 | ldlework | Varriount, I assume you're confounded in a paralyzing coma suffocating on your own bile at this point? |
05:44:35 | ldlework | writhe slowly if that's the case |
05:44:39 | FromGitter | <Varriount> Nah, just testing things. |
05:55:52 | FromGitter | <Varriount> ldlework: Got past the "cannot instantiate" error. |
05:56:29 | ldlework | Varriount, extrodinary |
05:56:58 | FromGitter | <Varriount> The code had signatures like `method deleteT (self: BSPTree[T], target:Leaf)`. The `Leaf` type wasn't being instanted with a type. |
05:59:31 | ldlework | Varriount, I just assume where that's possible that the compiler is implying them |
06:01:30 | FromGitter | <Varriount> ldlework: You're certainly putting the type inferencing system through the wringer. |
06:02:47 | ldlework | inferring |
06:02:53 | ldlework | that's the word I couldn't conjure |
06:09:49 | FromGitter | <Varriount> ldlework: The error I get after that is either a compiler bug, or some type inferencing error. |
06:11:52 | ldlework | Varriount, what is it |
06:13:12 | * | yglukhov quit (Read error: Connection reset by peer) |
06:13:48 | * | yglukhov joined #nim |
06:14:25 | FromGitter | <Varriount> ldlework: It was |
06:14:32 | FromGitter | <Varriount> `````` |
06:14:39 | FromGitter | <Varriount> ```main.nim(150, 10) Error: undeclared field: 'root'`````` |
06:14:57 | FromGitter | <Varriount> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=58e87fe3f22385553d1e1bcb] |
06:15:09 | zachcarter | how do I do for(;;) in Nim? |
06:15:26 | FromGitter | <Varriount> zachcarter: `while True`? |
06:15:28 | ldlework | Varriount, root is a field on the BSPTree |
06:15:31 | zachcarter | ah right thanks |
06:15:58 | FromGitter | <Varriount> ldlework: That error went away once I changed `delete` to a procedure (since it didn't need to be a method) |
06:16:28 | FromGitter | <Varriount> Now I get ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=58e8803db52518ed4def30aa] |
06:17:38 | ldlework | Varriount, welcome to my world |
06:17:49 | ldlework | the world where you have an instance of a subtype in a basemethod |
06:17:59 | ldlework | and you can't use any of your subtype methods |
06:18:01 | ldlework | :( |
06:18:25 | ldlework | Varriount, you didn't change the proc version to a base method |
06:18:54 | FromGitter | <Varriount> That's the system.nim procedure for resizing memory blocks |
06:20:05 | ldlework | Varriount, ah well do you still need a base method? |
06:20:42 | FromGitter | <Varriount> I made `method resizeT (self: Leaf[T], region: Region[float]) {.base.}` the base method. The error doesn't show it. |
06:22:02 | ldlework | Varriount, but Leaf isn't a base class of ParentNode or VSplit or HSplit |
06:22:24 | FromGitter | <Varriount> ldlework: My mistake. |
06:22:36 | FromGitter | <Varriount> ldlework: Are you sure you aren't overcomplicating things? |
06:22:37 | ldlework | hopefully that fixes it |
06:22:48 | ldlework | Varriount, I'm writing code how I think about the code in my head |
06:22:48 | FromGitter | <Varriount> What should be the base then? |
06:22:54 | ldlework | Varriount, look at the types |
06:22:58 | ldlework | BSPNode is the base |
06:23:03 | ldlework | Leaf inherits that |
06:23:07 | ldlework | ParentNode also inherits that |
06:23:18 | ldlework | VSplit and HSplit inherit ParentNode |
06:23:36 | ldlework | BSPNode -> Leaf |
06:23:43 | ldlework | BSPNode -> ParentNode -> VSplit |
06:23:46 | ldlework | BSPNode -> ParentNode -> HSplit |
06:24:14 | ldlework | I don't think its overcomplicated. ParentNode is ideally for code that works on both VSplit and HSplit |
06:24:20 | ldlework | Leaf doesn't contain children |
06:24:24 | ldlework | They all have a region |
06:24:38 | FromGitter | <Varriount> Ok, that fixed it. Now I just get a C compiler error because I'm not targeting the right children. |
06:24:45 | FromGitter | <Varriount> *right architecture |
06:24:48 | ldlework | omg |
06:24:53 | ldlework | <3 <3 <3 <3 <3 |
06:25:44 | FromGitter | <Varriount> ldlework: I hope you appreciate how complicate the compiler code has to be to handle programs like this. |
06:29:36 | ldlework | I do, its the reason I use Nim |
06:29:55 | ldlework | I can't wait to see the PR |
06:31:14 | FromGitter | <Varriount> ldlework: What should the compiled program do? |
06:32:18 | ldlework | Varriount, you can hit h or v to split the currently highlighted region |
06:32:23 | ldlework | d to delete |
06:32:28 | ldlework | hopefully the math is correct |
06:32:34 | ldlework | it should be a proper 2D BSP |
06:32:37 | ldlework | like a tiling window manager |
06:32:42 | ldlework | except you can't resize the partitions yet |
06:32:55 | FromGitter | <Varriount> Only one region seems to exist. It just gets cut in half. |
06:35:29 | ldlework | Varriount, you can keep pressing the keys |
06:35:36 | ldlework | the red highlighted region is the one that gets cut |
06:35:46 | ldlework | if its not working its probably due to you taking over during a refactor |
06:35:52 | ldlework | but if its compiling now I can probably work it |
06:36:45 | FromGitter | <Varriount> "taking over"? |
06:37:08 | ldlework | Varriount, yeah when you started coding on it |
06:37:12 | ldlework | I pushed up what I had |
06:37:26 | ldlework | It was midrefactor trying to get things to work |
06:37:37 | ldlework | so if you got it to compile and it doesn't work as described I'm just saying no big surprise |
06:37:45 | FromGitter | <Varriount> Ah. I thought you were implying I was taking over the project or something. |
06:37:53 | ldlework | also you can hit f to get a printout of the current structure |
06:39:27 | FromGitter | <Varriount> https://github.com/dustinlacewell/dadren/compare/bsp...Varriount:patch-1 |
06:39:27 | * | brson quit (Quit: leaving) |
06:39:46 | FromGitter | <Varriount> https://github.com/dustinlacewell/dadren/pull/2 |
06:41:21 | ldlework | so you really did just add abunch of T's |
06:41:24 | ldlework | :D |
06:42:01 | ldlework | Ah yeah the original bug is still there |
06:42:04 | ldlework | Varriount thank you! |
06:44:38 | * | def-pri-pub quit (Quit: leaving) |
06:53:30 | ldlework | is there a way to turn inference off? |
06:55:59 | zachcarter | The openarray type cannot be nested: multidimensional openarrays are not supported because this is seldom needed and cannot be done efficiently. |
06:56:02 | zachcarter | :P speak for yourself |
06:56:04 | zachcarter | I need it |
06:59:00 | * | rauss quit (Quit: WeeChat 1.7) |
06:59:59 | ldlework | lol |
07:02:21 | ldlework | Varriount, I love you. |
07:03:11 | ldlework | I think we should start a domestic partnership |
07:03:13 | FromGitter | <Varriount> ldlework: Not really. |
07:03:20 | ldlework | ah |
07:03:51 | FromGitter | <Varriount> zachcarter: What are you trying to do? Perhaps there's a workaround. |
07:04:09 | zachcarter | yeah I can use multidimensional sequences |
07:04:22 | zachcarter | just roguelikes often model map data with 2d arrays |
07:04:31 | zachcarter | so multidim openarrays would be nice |
07:05:04 | zachcarter | or I could just pack my 2d arrays into 1d arrays |
07:05:24 | FromGitter | <Varriount> zachcarter: an open array is just a (length, pointer) pair |
07:05:41 | zachcarter | ah okay |
07:06:03 | FromGitter | <Varriount> You can emulate that if you really need to. |
07:06:28 | zachcarter | I think I can just use 1d arrays |
07:09:41 | FromGitter | <Varriount> Zachcarter: that might be more performant too. |
07:09:51 | zachcarter | yeah I agree |
07:10:07 | FromGitter | <Varriount> I assume you meant to use a 1d stay to store the 2d data, and just use multiplication? |
07:10:14 | zachcarter | exactly |
07:10:49 | FromGitter | <Varriount> Don't forget to keep in mind sequence copying semantics |
07:17:50 | * | yglukhov quit (Remote host closed the connection) |
07:18:52 | * | yglukhov joined #nim |
07:23:38 | * | yglukhov quit (Ping timeout: 268 seconds) |
07:31:12 | * | nsf joined #nim |
07:44:45 | * | yglukhov joined #nim |
08:08:28 | * | chinchilla left #nim ("ii - 500 SLOC are too much") |
08:13:46 | Araq | varriount: oh come on now, everybody knows seqs/strings copy on assignment except when the compiler optimizes it away. it's how C++ avoids the GC and Nim may do the very same soon too. It's not the obviously stupid design you think it is. |
08:14:47 | ldlework | Varriount, https://gfycat.com/CompleteIdleCur |
08:16:37 | Araq | besides, the problem exists for any large object, not just strings and seqs |
08:17:19 | FromGitter | <Varriount> Araq: Anyone coming from C#, Java, or Python is going to assume strings and sequences don't copy. |
08:17:53 | Araq | yeah, but we're in #nim here |
08:18:24 | Araq | not in #nim-for-people-assuming-never-reading-anything |
08:19:30 | Araq | or #nim-for-people-requiring-performance-without-knowing-any-profiling-tools |
08:21:34 | ldlework | hopefully nim can grow to be for a wide range of people |
08:34:15 | FromGitter | <couven92> I read sth about the Python to Nim project yesterday... I think that will also help bringing nim to the masses! :) |
08:35:25 | * | Arrrr joined #nim |
08:35:25 | * | Arrrr quit (Changing host) |
08:35:25 | * | Arrrr joined #nim |
08:53:31 | * | zachcarter quit (Quit: zachcarter) |
09:09:26 | dom96 | hello |
09:10:21 | ldlework | hi dom96 |
09:12:42 | FromGitter | <Varriount> Python to Nim project? |
09:13:51 | ldlework | Varriount did you see the gif |
09:17:05 | dom96 | I didn't see the gif |
09:17:45 | ldlework | https://zippy.gfycat.com/CompleteIdleCur.webm |
09:18:42 | dom96 | cool, but what is the end goal of this? |
09:25:50 | ldlework | window management |
09:25:57 | ldlework | think emacs |
09:26:31 | * | Matthias247 joined #nim |
09:26:39 | ldlework | it will be resizable and there will be dropdown so you can change what a pane is looking at |
09:27:12 | dom96 | oh, so you're making a tiling window manager? |
09:28:01 | ldlework | im offering tiling services in my game library |
09:28:11 | ldlework | for viewports etc |
09:28:27 | * | Matthias247 quit (Read error: Connection reset by peer) |
09:29:46 | * | Matthias247 joined #nim |
09:31:50 | dom96 | hrm, I wish text editors had a feature where you can block select an area of whitespace and then paste some stuff in there. |
09:32:05 | ldlework | neat idea |
09:32:17 | dom96 | That way I could easily show the AST and the code that it represents side-by-side. |
09:32:43 | ldlework | dom96 what you working on in general |
09:32:53 | dom96 | deserialisation of JSON |
09:33:06 | ldlework | dont we have that |
09:33:13 | ldlework | oh |
09:33:18 | dom96 | No, we have marshal. |
09:33:22 | ldlework | non marshalled? |
09:33:23 | ldlework | huh |
09:33:29 | dom96 | Marshal only happens to use JSON |
09:33:38 | dom96 | And it doesn't work in the JS target |
09:33:41 | ldlework | how can that even work in type safe lang |
09:33:43 | dom96 | I'm writing a macro to do it. |
09:33:49 | ldlework | i see |
09:34:02 | ldlework | heroic |
09:35:10 | * | gokr joined #nim |
09:35:41 | dom96 | yeah, it's not as easy as I thought |
09:37:45 | * | kunev quit (Quit: е те!) |
09:41:29 | FromGitter | <couven92> @Varriount I came an entry in the nim forum yesterday where someone talked about pypy to nim... iirc |
09:42:34 | * | kunev joined #nim |
09:44:48 | dom96 | did somebody say they were working on it though? |
09:49:18 | dom96 | I don't suppose anyone would know how to get the name of a type from a `Sym` instead of the underlying type structure? (which getType gives me) |
09:52:22 | * | gokr quit (Quit: Leaving.) |
09:53:45 | dom96 | ahh, `getTypeInst` does it. Thanks for the hint in #3681 krux02 :) |
09:56:39 | dom96 | Araq: Should `getType` be deprecated? |
10:08:00 | dom96 | I created a PR https://github.com/nim-lang/Nim/pull/5679 :) |
10:11:24 | * | PMunch joined #nim |
10:17:08 | * | Tiberium joined #nim |
10:18:09 | * | Matthias247 quit (Read error: Connection reset by peer) |
10:43:45 | * | yglukhov quit (Remote host closed the connection) |
10:48:14 | * | zachcarter joined #nim |
10:51:42 | * | yglukhov joined #nim |
10:54:02 | * | yglukhov quit (Remote host closed the connection) |
11:03:46 | * | vlad1777d joined #nim |
11:31:46 | * | nsf quit (Quit: WeeChat 1.7) |
11:37:03 | * | kier quit (Ping timeout: 240 seconds) |
11:38:16 | zachcarter | Python to Nim? |
11:38:54 | Tiberium | zachcarter, yeah |
11:39:11 | Tiberium | I think this would be even more useful in modern world than pas2nim |
11:39:14 | Tiberium | (sorry araq) |
11:39:34 | zachcarter | hrm I need a Java2Nim :P |
11:40:07 | Tiberium | we need <anylang>2nim |
11:40:13 | zachcarter | truth |
11:40:46 | Tiberium | so after we're converting all apps in the world, including linux or some other OS'es, or creating our own |
11:48:15 | zachcarter | hrm |
11:48:27 | zachcarter | still trying to determine if multidimensional sequences are the way to go for holding map data |
11:52:55 | Arrrr | The alternative being? |
11:53:26 | * | kunev quit (Quit: е те!) |
11:54:10 | * | yglukhov joined #nim |
11:57:31 | * | yglukhov quit (Remote host closed the connection) |
11:59:49 | * | kunev joined #nim |
12:01:14 | zachcarter | not sure |
12:01:30 | zachcarter | Arrrr: any suggestions? |
12:03:01 | FromGitter | <Varriount> zachcarter: What kind of map? |
12:03:30 | FromGitter | <Varriount> And how will you need to interact with it? How will it be displayed? |
12:03:49 | zachcarter | well it will be tiled |
12:04:11 | zachcarter | so a very simple example would be - |
12:05:08 | zachcarter | https://gist.github.com/zacharycarter/dd5643d623cc89c9bd0380d52b699011 |
12:05:25 | zachcarter | that would represent say a 5x5 room with walls and an opening |
12:06:23 | zachcarter | essentially all I need for drawing is to be able to iterate over the map and check the content of each cell to know what to draw |
12:06:33 | FromGitter | <Varriount> Will the map need to be mutable? Will it always be rectangular? |
12:06:42 | zachcarter | it will need to be mutable it will always be rectangular |
12:06:55 | zachcarter | its contents will need to be mutable |
12:07:09 | zachcarter | maps generally won’t need to be resized after creation |
12:07:15 | FromGitter | <Varriount> Well then, an array sound like the best choice. |
12:07:22 | zachcarter | I think so too |
12:07:27 | zachcarter | my only problem with arrays is |
12:07:42 | zachcarter | well I guess I don’t actually |
12:07:53 | zachcarter | I was thinking I wouldn’t be able to create literals like in my examples |
12:07:56 | zachcarter | example* |
12:08:05 | zachcarter | but I guess if I just leave off the inner arrays I essentially have the same thing |
12:08:17 | FromGitter | <Varriount> Yep. |
12:08:25 | zachcarter | I just need to use index multiplication to get to the correct row / column |
12:08:48 | zachcarter | amazing what sleep will make you realize :P |
12:08:54 | zachcarter | and talking things through with Varriount :D |
12:09:45 | * | yglukhov joined #nim |
12:11:02 | FromGitter | <Varriount> Just create a procedure that does the multiplication and access for you. Wrap the array in an object type |
12:11:36 | zachcarter | right |
12:11:47 | zachcarter | well I think I’m going to end up using seqs anyway |
12:12:08 | zachcarter | the whole not knowing the array size at compile time is going to force my hand |
12:12:22 | zachcarter | I won’t need to resize them but their size may be calculated at runtime |
12:15:04 | dom96 | Oooh, is this the start of a rogue-like? |
12:15:40 | zachcarter | dom96: https://github.com/zacharycarter/nimrl |
12:15:48 | dom96 | btw guys, Ludum Dare 38 is happening in 2 weeks. |
12:15:58 | dom96 | Nim is perfect for that competition :) |
12:16:12 | zachcarter | yeah I’ll probably build something with frag for it |
12:16:59 | dom96 | cool. I bet ftsf will be competing as well. ftsf placed 4th in the last one IIRC |
12:17:26 | zachcarter | niceeee |
12:18:49 | federico3 | we need a 2D library contest first |
12:19:42 | zachcarter | you have different types of 2D though |
12:20:06 | zachcarter | a large / complex 2d game is not going to be able to be built with SDL2 alone I’m sorry |
12:20:16 | zachcarter | the renderer will NOT keep up |
12:20:34 | dom96 | the renderer? what do you mean? |
12:20:55 | zachcarter | sdl2 abstracts away rendering to the graphics API that the device is running on supports |
12:20:55 | dom96 | An abstraction will certainly help with complex 2D games. |
12:21:03 | zachcarter | which is nice |
12:21:19 | zachcarter | except the renderer does not support draw call batching |
12:21:42 | zachcarter | nor does sdl2 support texture atlases |
12:21:58 | zachcarter | so you’re going to be stuck writing your own OpenGL code if you want to handle either of those scenarios |
12:22:25 | zachcarter | which any large / complex game is going to need |
12:23:18 | dom96 | what are texture atlases? |
12:23:33 | dom96 | is sfml any better in this regard? |
12:23:37 | zachcarter | SFML is not |
12:23:44 | zachcarter | frag is :P |
12:24:08 | zachcarter | texture atlases consist of an atlas file and a large texture file that has been packed with a bunch of smaller texture files |
12:24:19 | zachcarter | so you may have a single texture that actually has 100 other textures packed into it |
12:24:44 | zachcarter | the atlas file will contain the position and UVs of the textures which are packed into the larger texture |
12:25:05 | zachcarter | this prevents the GPU from having to switch textures all the time, which has performance implications if your’e switching textures enough |
12:25:52 | dom96 | cool. |
12:26:03 | zachcarter | even with texture atlasing though, SDL2 suffers from the whole non draw call batching thing |
12:26:12 | zachcarter | where every submission to the renderer gets its own draw cal |
12:26:14 | zachcarter | call |
12:26:15 | dom96 | Good enough for Ludum Dare though, right? |
12:26:32 | zachcarter | oh yeah |
12:27:23 | zachcarter | I don’t think you’d start noticing performance issues with SDl2 alone until you started rendering large maps with lots of textures |
12:27:30 | zachcarter | or large scenes rather |
12:29:00 | zachcarter | the game I’m building (the roguelike game) couldn’t be built with solely sdl2 |
12:29:24 | zachcarter | maybe if I was just drawing colored rectangles / text but I plan on using graphical tiles |
12:35:33 | * | BitPuffin|osx joined #nim |
12:35:59 | * | kier joined #nim |
12:37:43 | dom96 | I actually like the ASCII look that older roguelikes have |
12:37:51 | dom96 | Not that I've tried that many |
12:37:56 | dom96 | Really only NetHack. |
13:03:59 | FromGitter | <Varriount> I like actual art. :| |
13:06:16 | * | Tiberium quit (Remote host closed the connection) |
13:06:36 | * | Tiberium joined #nim |
13:09:29 | Arrrr | you mean realistic art |
13:13:09 | Arrrr | zachcarter, what do you mean when you say 'non draw call batching thing' ? |
13:13:36 | zachcarter | hrm? |
13:13:43 | zachcarter | I mean SDL2 doesn’t do draw call batching |
13:14:48 | Arrrr | It blits the surface, isn't it? |
13:14:59 | zachcarter | it does but think about this |
13:15:41 | zachcarter | every surface blit for a regtangular draw object is essentially sending data for four vertices and texcoords |
13:15:52 | * | dddddd joined #nim |
13:15:53 | zachcarter | I’m not sure if SDL2 uses indexed drawing but I doubt it, even so let’s assume it does |
13:16:02 | zachcarter | and sorry I meant six vertices |
13:16:18 | zachcarter | if it’s using indexed drawing it’s submitting data for 3 verts and then six indices |
13:16:41 | zachcarter | now if you’re drawing 100 textures in one frame |
13:16:54 | zachcarter | what makes more sense - one draw call consisting of 300 vertices and 600 indices? |
13:17:09 | zachcarter | or one hundred draw calls with 3 verts and 6 indices each |
13:17:13 | zachcarter | because SDL2 will do the latter |
13:17:27 | Arrrr | mmm |
13:17:30 | zachcarter | (if it even supports indexed buffers - which I’m guessing it doesn’t) |
13:17:48 | zachcarter | (it’s most likely more like 100 draw calls with 6 vertices and 0 indices) |
13:18:25 | Arrrr | It could draw everything in one texture. For simple 2D things can be faster |
13:18:55 | zachcarter | it could, but chances are you’re not going to have a single texture representing your game scene |
13:19:00 | zachcarter | it’s going to be composed of a bunch of different textures |
13:19:21 | Arrrr | Well, then that's not surface blitting. |
13:19:33 | zachcarter | it is, it’s just blitting multiple surfaces |
13:19:56 | zachcarter | simple trivial example is this |
13:20:07 | zachcarter | frameBegin() |
13:20:10 | zachcarter | drawPlayer() |
13:20:15 | zachcarter | drawMonster() |
13:20:18 | zachcarter | frameEnd() |
13:20:26 | zachcarter | sdl2 would make 2 draw calls |
13:20:32 | zachcarter | when if it was optimized it would make one |
13:22:48 | Arrrr | Well, in that case you are right. |
13:23:55 | zachcarter | yeah :/ I’m not trying to bash sdl2 I just don’t see it being a viable option for larger projects |
13:24:08 | FromGitter | <Varriount> It becomes important when you start having many such calls |
13:24:13 | zachcarter | exactly |
13:24:31 | Arrrr | Well, this game was made in sdl https://www.kag2d.com/en/ |
13:24:38 | Arrrr | At least, the classic version |
13:24:40 | zachcarter | sure |
13:24:44 | zachcarter | but I doubt they used the sdl2 renderer |
13:24:50 | zachcarter | I’m guessing they wrote their own OpenGL rendering code |
13:25:01 | Arrrr | Mmm that makes sense. |
13:28:04 | Tiberium | wow, vscode configured with 1ms save delay feels much smoother |
13:28:09 | Tiberium | because nimsuggest is also fast |
13:28:17 | Tiberium | so new errors are highlighted instantly |
13:28:51 | arnetheduck | @Araq, the tyAlias and sighash stuff sure makes it easier to do types for llvm ;) |
13:41:17 | zachcarter | how do you buffer text in Nim for stdout? |
13:41:26 | zachcarter | or is there an echo w/o a newline? |
13:48:24 | federico3 | zachcarter: stdout.write |
13:50:56 | zachcarter | thank you federico3 |
14:08:11 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
14:11:32 | FromGitter | <cooldome> Gents, could you please give me a push on why this does not compile: macro dseq(len : int) : typed = ⏎ let procTyped = newNimNode(nnkBracketExpr).add(bindSym("newSeq")).add(bindSym("int")) ⏎ result = newCall(procTyped, [len]) ⏎ ⏎ let a = dseq(10) [https://gitter.im/nim-lang/Nim?at=58e8ef95f22385553d1f8f74] |
14:11:46 | zachcarter | can you put that into a gist please? |
14:11:52 | zachcarter | or something similar? |
14:13:56 | FromGitter | <cooldome> sure, here it is as gist https://gist.github.com/cooldome/0f334cc0feaf5ac1c60082b73eec8a25 |
14:14:07 | zachcarter | thanks |
14:27:24 | * | zaquest left #nim ("Leaving") |
14:27:57 | zachcarter | hrm cooldome: macros are my weak point right now, not sure how to fix this |
14:29:56 | FromGitter | <Varriount> I'll take a look in a sec. |
14:30:45 | FromGitter | <cooldome> Thank you, will wait for you answer |
14:35:33 | FromGitter | <Varriount> @cooldome You're creating a procedure call and returning it. I'd the result of that procedure call being assigned to anything? |
14:36:56 | FromGitter | <cooldome> it is assigned to variable 'a', no? |
14:37:21 | FromGitter | <cooldome> and I have tried calling macro with keyword discard, does not help either |
14:41:45 | Tiberium | lol |
14:42:02 | Tiberium | I just translated this script to Nim https://github.com/jhoward/Python-Neural-Network/blob/master/nn.py#L24 |
14:42:06 | Tiberium | wasn't hard |
14:42:12 | Tiberium | I literally copy-pasted entire chunks of code |
14:43:24 | Tiberium | and it worked :D (I forgot that range's equivalent in Nim is "for x in 0..<something") |
14:44:01 | Tiberium | yeah, code isn't efficient as I think |
14:45:28 | FromGitter | <Varriount> @cooldome Ah, found the problem |
14:46:11 | FromGitter | <Varriount> First off, you might want to use `ident` instead of `bindSym` |
14:47:43 | FromGitter | <Varriount> That correctly matches the tree of the expression you want. |
14:48:33 | FromGitter | <Varriount> Second, always make a macros return value `untyped`. Technically `typed` and `untyped` shouldn't matter for a macro, but there are subtle differences due to compiler logic. |
14:50:02 | FromGitter | <Varriount> @cooldome https://glot.io/snippets/eor0inasgv |
14:53:39 | FromGitter | <Varriount> @cooldome @zacharycarter A good function to use in macros is the `quote` operator. https://glot.io/snippets/eor0lt955l |
14:59:20 | FromGitter | <Varriount> @dom96 By the way, you can increase the size of the glot.io editor. Click the gear above the editor on the right-hand side, and you'll see a 'lines' setting. |
15:04:07 | FromGitter | <cooldome> Thanks Varriount, untyped as return typed made a difference |
15:04:08 | Tiberium | wat |
15:04:14 | Tiberium | Nim supports unicode variable names? lol |
15:04:24 | Tiberium | "let π = 3.14" works |
15:04:55 | FromGitter | <Varriount> Tiberium: Why not? |
15:06:38 | Tiberium | just impressed :) |
15:07:48 | Tiberium | not many compiled languages support unicode names |
15:10:05 | Tiberium | just curious (xD): can I change "var" to something else? like "variable a". just curious |
15:10:18 | Tiberium | if it's a part of the syntax, I can't, but I can with macros I think |
15:10:45 | arnetheduck | Tiberium, well, C & C++ to start with? ;) |
15:11:21 | Tiberium | arnetheduck, C has only limited support :) |
15:12:03 | Tiberium | same with C++, it depends on compiler |
15:12:08 | Tiberium | limited support only |
15:12:23 | Tiberium | hmm, let me see if Nim can compile "var = 1" |
15:12:33 | Tiberium | yes, Nim can |
15:15:49 | arnetheduck | ah, well, I guess.. anything > C(++)11 is supposed to support it, but then.. |
15:19:02 | * | gangstacat quit (Quit: Ĝis!) |
15:20:17 | FromGitter | <Varriount> C++: The kitchen sink language |
15:23:57 | Tiberium | can I do something like "if a equals b" so I want to replace == to "equals"? Or I would replace strings? |
15:33:45 | FromGitter | <stisa> Tiberium : Not sure, I think the closest you can get is ``2.equals 2`` (using a template) |
15:34:04 | dom96 | You can try defining proc `equals`(...) |
15:34:08 | dom96 | but I don't think it will work |
15:37:33 | * | zachcarter quit (Quit: zachcarter) |
15:37:55 | * | zachcarter joined #nim |
15:42:40 | * | zachcarter quit (Ping timeout: 260 seconds) |
15:47:14 | * | krux02 joined #nim |
15:50:31 | * | krux02 quit (Remote host closed the connection) |
15:51:05 | * | krux02 joined #nim |
15:53:38 | * | krux02 quit (Remote host closed the connection) |
16:00:06 | * | dddddd quit (Remote host closed the connection) |
16:03:28 | * | krux02 joined #nim |
16:14:33 | * | BitPuffin|osx quit (Ping timeout: 240 seconds) |
16:21:16 | * | Trustable joined #nim |
16:28:25 | FromGitter | <battila7> @dom96 Just bought the book, really looking forward to start playing with it |
16:29:08 | Tiberium | how can I get simple string from readFile() ? |
16:31:55 | dom96 | battila7: awesome, let me know if you have any questions :) |
16:32:01 | dom96 | Tiberium: What's a "simple string"? |
16:32:15 | Tiberium | dom96, a string so I can use "replace" on it |
16:32:42 | Tiberium | oh wait |
16:33:15 | dom96 | readFile returns a TaintedString probably |
16:33:20 | Tiberium | yeah |
16:33:22 | Tiberium | It works now |
16:33:24 | dom96 | TaintedString == string (unless you're in taint mode) |
16:33:25 | Tiberium | it's my fault |
16:37:14 | * | arnetheduck quit (Ping timeout: 260 seconds) |
16:38:22 | * | zachcarter joined #nim |
16:54:54 | krux02 | Tiberium: when you want to have a file that you want to be able to change inplace, memory mapping of the files help you |
16:55:13 | Tiberium | krux02, thanks, but no :) I want to "translate" files |
16:55:17 | Tiberium | so multiple replaces |
16:55:34 | krux02 | but be aware that when you do that, this is not supposed to be used with very big files wher you insert something in the middle |
16:56:01 | krux02 | so you want sed :P |
17:04:16 | * | Matthias247 joined #nim |
17:06:25 | * | Tiberium quit (Remote host closed the connection) |
17:08:58 | * | PMunch quit (Quit: leaving) |
17:11:26 | * | zachcarter quit (Ping timeout: 240 seconds) |
17:39:55 | krux02 | Araq: are you available to be questioned? |
17:41:41 | krux02 | I would like to know how I can bind procs like offsetof alignof sizeof to the function I just edited |
17:43:26 | dom96 | You should really just ask here first. |
17:43:53 | dom96 | Highlighting Araq all the time will discourage him from being here (in fact, I think it already is starting to make him appear in IRC less often) |
17:44:11 | dom96 | If nobody answers then you can highlight someone. |
17:44:47 | dom96 | As for your question, what is "the function [you] just edited?" |
17:57:40 | * | Matthias247 quit (Read error: Connection reset by peer) |
18:01:10 | FromGitter | <battila7> Is there a way to define a parameter type to be *a tuple with a `name` field and some other fields I don't care about*? |
18:02:25 | * | ngc joined #nim |
18:08:06 | * | shashlick quit (Ping timeout: 240 seconds) |
18:09:43 | * | shashlick joined #nim |
18:13:27 | FromGitter | <stisa> @battila7 a Concept maybe? I don't think you can do that otherwise, I don't see how you would declare the type |
18:13:44 | * | Tiberium joined #nim |
18:14:06 | * | yglukhov quit (Remote host closed the connection) |
18:18:09 | FromGitter | <battila7> @stisa I've thought about something inline. But using a Concept seems good idea. |
18:18:17 | FromGitter | <battila7> As I see, Nim lacks interfaces, therefore using Concepts in an interface kind of style is idiomatic, or something I should not do? |
18:19:52 | dom96 | Indeed. Concepts can also be used as an interface. |
18:20:06 | krux02 | dom96: You are right, I think it's much nicer to properly formulate the question in the forum, and that is what I just did |
18:20:21 | krux02 | on that way he (or you if you know it) can answer me any time |
18:20:29 | FromGitter | <stisa> I'm sorry, I haven't used concepts much yet. I think they are something like a restriction on the type, but keep in mind they can't be used in seq/array etc |
18:21:11 | krux02 | stisa: well that is not entirely true |
18:21:30 | krux02 | you can't create an array with an element type of a concept |
18:21:43 | * | yglukhov joined #nim |
18:22:34 | krux02 | but at any time where you declare a function with a concept as type parameter (a generic) you can in fact use the conept on an array type, because in this context the type is actually a single computed type |
18:23:53 | FromGitter | <battila7> That's great! I was a bit scared about this, but Concepts are much more powerful as I see than interfaces |
18:24:02 | FromGitter | <stisa> Yes sorry, that wasn't clear. I meant you can't do something like `var x : seq[MyConcept] = @[myconc1, myconc2 ...]`. |
18:24:26 | FromGitter | <battila7> Actually, I've just tried that and crashed the compiler |
18:24:48 | krux02 | all elements of an array need to be the same type, and a concept on it's own is not yet a type |
18:25:18 | FromGitter | <battila7> So in 1.0 this might be possible? |
18:25:33 | krux02 | you should share you code |
18:25:40 | krux02 | I am sorry I haven't really used concepts yet |
18:26:01 | krux02 | and I think most of the time people use concepts the problem can use used with much simpler design decisions |
18:26:04 | * | yglukhov quit (Remote host closed the connection) |
18:26:16 | dom96 | Concepts are still under development. |
18:26:34 | dom96 | The devel branch implements many improvements and additions to them. |
18:26:53 | krux02 | sure the way you asked the question only leads to conceps as the answer, but I am pretty sure if you share a bit more context of your problem, I might give you a hint on how you can solve your problem without using concepts |
18:27:09 | dom96 | I'm not sure whether this is implemented already, but it is definitely planned: var x: seq[vtref MyConcept] |
18:27:34 | krux02 | cool |
18:27:35 | FromGitter | <battila7> I've been playing around with the language for a week or therefore I don't really have any code, I'm just experimenting |
18:27:41 | krux02 | I did not know it, but it makes senes |
18:28:15 | krux02 | makes compile type polymorphism automatically (and only when needed) into runtime polymorphism |
18:28:25 | FromGitter | <stisa> dom96 uhuh that sounds interesting |
18:28:35 | krux02 | reminds me of my prototype for go interfaces in Nim |
18:28:49 | dom96 | Yep, I think it's pretty cool. |
18:28:58 | dom96 | Although I'm not the biggest fan of the 'vtref' name. |
18:29:18 | * | yglukhov joined #nim |
18:30:00 | dom96 | But in all likelihood you won't be using it this way anyway. We have the 'interface' keyword reserved, so I think it makes sense to define a 'vtref concept' by just writing 'interface'. |
18:30:31 | * | dom96 already suggested that to zahary and Araq :) |
18:31:30 | * | krux02 quit (Remote host closed the connection) |
18:31:32 | FromGitter | <battila7> That'd be great, looks much cleaner |
18:32:09 | * | zachcarter joined #nim |
18:49:54 | * | Ven joined #nim |
18:50:18 | * | Ven is now known as Guest22771 |
18:50:30 | * | Tiberium quit (Remote host closed the connection) |
18:50:54 | * | Tiberium joined #nim |
19:08:58 | * | Guest22771 quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
19:09:08 | FromGitter | <Varriount> dom96: I just read BountySource. It's nice to know the donations are doing something. :D |
19:09:58 | dom96 | Yeah, just paid zahary for his work on concepts :) |
19:10:07 | dom96 | Need to write another update |
19:13:13 | FromGitter | <Varriount> I do wish new features could be discussed in the forum first, but that's up to zahary and araq, not me. |
19:19:21 | dom96 | I wish so too and I try to encourage that. |
19:19:39 | dom96 | If you could do the same it would go a long way :) |
19:20:29 | dom96 | The concept spec is in the manual now though, so do read it if you've got some time and give feedback. |
19:21:39 | FromGitter | <Varriount> dom96: I love reading. :) |
19:24:15 | dom96 | It lives https://github.com/nim-lang/Nim/blob/feature/json-macro/tests/stdlib/tjsonmacro.nim :D |
19:28:38 | FromGitter | <Varriount> dom96: Loading JSON to an object? |
19:28:44 | dom96 | yep |
19:34:34 | FromGitter | <Varriount> dom96: Is there a way for an object to customize how it is loaded? |
19:35:09 | dom96 | What sort of customisation do you have in mind? |
19:36:53 | FromGitter | <Varriount> discarding metadata, reinterpreting the JSON |
19:38:11 | dom96 | It only maps the fields you specify in your type definition |
19:38:19 | dom96 | Not sure what you mean by "reinterpreting the JSON" |
19:43:23 | Araq | concepts have been discussed extensively in the forum |
19:45:17 | dom96 | Araq: Any thoughts on my JSON macro? |
19:46:27 | Araq | seems to be exactly what I wanted to add to the stdlib |
19:46:31 | Araq | :-) |
19:47:54 | dom96 | great :) |
19:49:48 | FromGitter | <Varriount> I wonder if C++ would be able to do anything like your macro. |
19:50:13 | Araq | no, it cannot do it. |
19:51:49 | * | Ven joined #nim |
19:52:12 | * | Ven is now known as Guest89504 |
19:52:19 | FromGitter | <Varriount> zacharycarter: So much for that guys assertions that C/C++ macros are superior to Nim's |
19:53:10 | FromGitter | <Varriount> Araq, dom96: There was this person on a channel in Quakenet that was convinced C-style macros were superior to Nim macros. |
19:53:33 | FromGitter | <Varriount> Needless to say, zacharycarter and I were nonplussed. |
19:53:40 | * | Guest89504 quit (Client Quit) |
20:00:40 | * | zachcarter quit (Quit: zachcarter) |
20:05:23 | ldlework | nim lol holy shit! |
20:05:30 | ldlework | s/nim/dom96 |
20:05:58 | * | Trustable quit (Remote host closed the connection) |
20:06:06 | dom96 | just for you ldlework :P |
20:07:17 | ldlework | Do other languages have this? |
20:07:47 | dom96 | doesn't Go? |
20:07:47 | FromGitter | <Varriount> Have what? |
20:08:17 | dom96 | I assume JSON to object deserialisation |
20:08:32 | * | dom96 isn't sure what to call it, unmarshalling? deserialization? |
20:09:23 | ldlework | Yeah unmarshalling. |
20:09:41 | FromGitter | <Varriount> "This process of serializing an object is also called marshalling an object.[2] The opposite operation, extracting a data structure from a series of bytes, is deserialization (which is also called unmarshalling)." |
20:09:51 | FromGitter | <Varriount> https://en.wikipedia.org/wiki/Serialization |
20:09:56 | ldlework | OKOK |
20:10:17 | ldlework | Go has type-generative json deserialization? |
20:10:26 | ldlework | dom96: that's what your macro is doing right? Generating new types on the fly? |
20:10:38 | Xe | ldlework: by using struct tagging |
20:10:48 | Xe | it's actually really elegant |
20:10:58 | Xe | https://mholt.github.io/json-to-go/ |
20:11:04 | Xe | paste arbitrary json on the left side |
20:11:20 | ldlework | Xe: yes, but do you have to do this as an external step? |
20:11:22 | FromGitter | <Varriount> ldlework: The macro doesn't generate new types, it creates a procedure for loading existing types from json. |
20:11:45 | * | gokr joined #nim |
20:11:50 | ldlework | That sounds like marshalling...? |
20:12:12 | FromGitter | <Varriount> unmarshalling. |
20:12:44 | ldlework | yeah |
20:12:49 | dom96 | You give the macro a type |
20:12:56 | dom96 | It reads the JSON into that type |
20:13:04 | dom96 | s/reads/unmarshals/ |
20:13:04 | ldlework | isnt that whas the marshal module does? |
20:13:09 | FromGitter | <Varriount> reading == deserialization == unmarshalling, writing == serialization == marshalling |
20:13:30 | dom96 | yes, but the marshal module only happens to use JSON |
20:13:35 | dom96 | The underlying format could change |
20:13:44 | FromGitter | <Varriount> ^ |
20:13:51 | dom96 | Plus, the format expects some Nim-specific info |
20:14:04 | dom96 | So your JSON could fail to parse because of that |
20:14:18 | dom96 | And most importantly for me, it doesn't support the JS backend. |
20:14:23 | ldlework | I see |
20:14:25 | FromGitter | <Varriount> dom96: I assume this macro will be in the JSON module? |
20:14:35 | dom96 | yep |
20:16:27 | FromGitter | <Varriount> What about a corresponding serialization macro? |
20:16:45 | dom96 | Don't need a macro for that |
20:16:55 | dom96 | JSON already has `%` for that purpose |
20:17:10 | dom96 | I use it in that test |
20:17:57 | ldlework | Xe: fwiw, struct tagging seems like the hackiest thing I've ever heard of. |
20:18:22 | ldlework | But I'm prone to hate anything related to Golang by default. |
20:18:27 | dom96 | In the future I will probably generalise this macro so that it can be used for other formats. |
20:19:36 | dom96 | You could already use it actually by just converting your format's data type to a JsonNode. |
20:20:00 | FromGitter | <Varriount> Hm. One problem with the current JSON serialization is that it isn't streaming/incremental. |
20:21:07 | FromGitter | <Varriount> You have to generate the entire intermediate representation (JsonNode) before writing to file. |
20:22:00 | * | Arrrr quit (Quit: Leaving.) |
20:22:09 | FromGitter | <Varriount> Actually, it looks like you need to use 2 intermediate representations, object -> JsonNode, JsonNode -> string |
20:23:18 | * | zachcarter joined #nim |
20:23:52 | dom96 | Sure, but then you can always just write the JSON manually. |
20:25:44 | * | zachcarter quit (Read error: Connection reset by peer) |
20:26:27 | * | zachcarter joined #nim |
20:27:02 | * | Tiberium quit (Remote host closed the connection) |
20:30:00 | * | yglukhov quit (Remote host closed the connection) |
20:31:34 | * | Tiberium joined #nim |
20:52:55 | * | yglukhov joined #nim |
20:58:35 | def- | wow, --gc:boehm compiles so much faster |
21:01:54 | * | PMunch joined #nim |
21:07:11 | Araq | for me --gc:markAndSweep produces the fastest compiler |
21:07:24 | Araq | 0.3s bootstrap difference |
21:08:09 | Araq | 4s (refc) vs 3.6s (boehm) vs 3.3s (m&s) |
21:12:23 | FromGitter | <Varriount> What are the performance characteristics of each collector? |
21:13:25 | * | gokr quit (Ping timeout: 240 seconds) |
21:23:47 | * | vlad1777d quit (Quit: Leaving) |
21:23:48 | * | zachcarter quit (Quit: zachcarter) |
21:37:32 | def- | Araq: nono, that's not what I mean. I mean compiling my binaries with --gc:boehm |
21:37:50 | def- | because the Nim compiler can't be reused from nimcache I presume |
21:38:09 | def- | s/Nim compiler/Nim gc/ |
21:43:05 | * | Yuken_ joined #nim |
21:43:55 | ldlework | Yuken_: You can start working through this, https://nim-lang.org/docs/tut1.html |
21:44:00 | ldlework | There's a part 2 |
21:44:12 | Yuken_ | Now, to figure out what editor to use... |
21:44:18 | ldlework | I'm free today so just expect that at least I am here to answer your questions |
21:44:32 | ldlework | Once you make it through the tutorial we can make a simple Dadren app |
21:44:59 | * | yglukhov quit (Remote host closed the connection) |
21:45:33 | FromGitter | <Varriount> Yuken_: I'd recommend Sublime Text, but the plugin has some bugs at the moment that I'm fixing. |
21:45:50 | FromGitter | <Varriount> You could go with the VSCode plugin, if you already have that installed. |
21:45:54 | Yuken_ | Varriount, doubt Sublime would run well on this machine ;o |
21:46:09 | FromGitter | <Varriount> Yuken_: Then VSCode is probably out as well. |
21:46:22 | Yuken_ | It might run, I'm not 100% sure. Rather crappy thing. |
21:46:23 | Yuken_ | CPU: 2 x AMD Athlon(tm) Dual Core Processor 5050e (AuthenticAMD) @ 1000MHz w/ 512 KB L2 Cache ** |
21:46:27 | Yuken_ | with 4GB of RAM and a 6150SE |
21:46:40 | def- | Araq: should I report v2 bugs or are they known? It prints some "introduced bug" stuff |
21:47:04 | FromGitter | <battila7> VSCode and its plugin is pretty stable, I highly recommend them |
21:47:18 | FromGitter | <Varriount> Yuken_: Sublime Text is using 101 Mb of memory on my Macbook |
21:47:37 | FromGitter | <Varriount> Yuken_: There are also plugins for Vim and (I think) emacs |
21:48:05 | FromGitter | <Varriount> Basically, any IDE that is easily language agnostic has a plugin. |
21:48:13 | FromGitter | <Varriount> (IntelliJ doesn't count) |
21:50:16 | * | Tiberium quit (Read error: Connection reset by peer) |
22:02:02 | FromGitter | <TiberiumPY> I use and recommend vscode too - with nimsuggest and 1ms auto save delay error highlights are instant |
22:03:59 | FromGitter | <Varriount> Yes, but VSCode's memory footprint and CPU usage might be a bit too high for such a machine. |
22:04:09 | cheatfate | Yuken_, Sublime Text is the fastest alternative you can get... |
22:06:00 | FromGitter | <TiberiumPY> @Varriount 4gb should be sufficient, but cpu may slow it down |
22:06:24 | ldlework | How do you install nimsuggest for vscode |
22:06:28 | FromGitter | <TiberiumPY> By the way, for me it feels that VSCode is faster than Atom |
22:10:03 | * | Sentreen quit (Ping timeout: 240 seconds) |
22:11:04 | Yuken_ | Mmkay then, I'll try out VSCOde first as that is what I used under Windows on my other PC and very much enjoy it |
22:11:13 | Yuken_ | if that doesn't work, Sublime - and if that doesn't work, I guess nano will have to do :^) |
22:12:16 | FromGitter | <battila7> Startup time is less that Atom's for sure |
22:19:51 | * | bjz joined #nim |
22:21:14 | ldlework | Well if the Nim extenstion on the marketplace is doing anything I can't tell what it s doing |
22:21:20 | ldlework | its certainly not completing anything useful |
22:21:26 | ldlework | for vscodee |
22:22:47 | FromGitter | <TiberiumPY> It can use nimsuggest for errors at least |
22:23:03 | * | Sentreen joined #nim |
22:23:19 | FromGitter | <TiberiumPY> And btw, is there intelligent auto completion? In nimsuggest |
22:23:33 | ldlework | where does nimsugget comefrom? |
22:23:39 | ldlework | do I have to install that separately? |
22:25:10 | * | chatter30 joined #nim |
22:26:17 | FromGitter | <TiberiumPY> If you compile from source, you can compile it to |
22:26:20 | FromGitter | <TiberiumPY> *too |
22:26:22 | * | chatter30 quit (Client Quit) |
22:27:28 | FromGitter | <TiberiumPY> Most useful nimsuggest feature - error highlighting, it helps a lot |
22:27:40 | FromGitter | <TiberiumPY> (compile time errors) |
22:29:00 | * | FromGitter * Varriount will stay faithful to Sublime Text |
22:29:33 | FromGitter | <Varriount> I'd rather have a browser that doesn't eat up half a GB of memory on startup. |
22:29:39 | FromGitter | <Varriount> *editor |
22:31:21 | FromGitter | <TiberiumPY> But unused ram == |
22:31:32 | FromGitter | <TiberiumPY> Useless ram, isn't it? |
22:31:53 | FromGitter | <TiberiumPY> So if I have 4-5gb free I can afford this :) |
22:32:51 | FromGitter | <Varriount> That is, until you need to spin up a virtual machine or two. |
22:33:26 | FromGitter | <TiberiumPY> Ah, then yes |
22:34:30 | FromGitter | <TiberiumPY> I really think about buying additional 8gb's to my 8gb's, because it's doesn't cost much money and it's useful |
22:34:53 | FromGitter | <Varriount> I'm in the group of programmers who think using a browser framework to make an editor is frivolous and wasteful. |
22:35:17 | ldlework | It reuses technology |
22:35:25 | ldlework | Sublime invented his own UX kit |
22:35:32 | ldlework | look at emacs |
22:35:38 | ldlework | no one wants to touch the core |
22:35:51 | FromGitter | <Varriount> ldlework: WxWidgets? |
22:35:57 | ldlework | if you use tech that is guaranteed to be updated as time goes on that's pretty good |
22:35:57 | cheatfate | ldlework, https://en.wikipedia.org/wiki/Skia_Graphics_Engine |
22:36:28 | FromGitter | <Varriount> ^ That's what Sublime Text 3 uses |
22:36:32 | dom96 | Varriount: Sometimes Worse is Better. |
22:36:51 | FromGitter | <Varriount> dom96: I shudder at such a philosophy. |
22:37:12 | ldlework | OK so sublimetext 3 made a better choice than ST2 |
22:37:30 | FromGitter | <Varriount> ldlework: I'm not sure that ST2 doesn't use Skia as well. |
22:37:40 | ldlework | The original used his own at least |
22:37:49 | cheatfate | Varriount this information was obtained only because somebody reverse engineered ST3, but nobody disassembled ST2... |
22:37:49 | ldlework | We're missing the point |
22:38:14 | ldlework | If you're pointing to Skia as saying "Look they didn't roll their own" then surely web-tech is even further along that spectrum |
22:38:31 | cheatfate | There no need in web tech for text editor |
22:38:51 | ldlework | Except now anyone familiar with those technologies can contribute |
22:38:52 | cheatfate | text editor must to be fast and able to handle many lines of code |
22:39:02 | ldlework | I bet that number is several several magnitutdes larger than Skia |
22:39:04 | FromGitter | <Varriount> Web tech was meant to display html pages, which come in all shapes and sizes and need to be able to change entirely. |
22:39:24 | FromGitter | <Varriount> An editor is fairly static by comparison. |
22:39:37 | ldlework | Except now emacs and display gifs and video |
22:39:56 | FromGitter | <battila7> I think introducing web techs in desktop apps such as code editors is one of the best things that happened in the past years |
22:40:22 | FromGitter | <Varriount> I just want memory footprints and CPU usage to be better. |
22:40:37 | ldlework | I don't really run into problems with running out of cpu or memory |
22:40:40 | ldlework | but maybe I'm spoiled |
22:41:00 | FromGitter | <Varriount> I've come close. |
22:41:28 | ldlework | Maybe when I haven't rebooted in weeks and chrome has 98 of my memory for some reason |
22:41:40 | FromGitter | <battila7> I usually do, when using my notebook with 4GBs |
22:41:54 | FromGitter | <TiberiumPY> Maybe some memory leak ldlework |
22:42:03 | ldlework | no doubt |
22:42:11 | FromGitter | <battila7> It's not leaking just being greedy |
22:43:35 | ldlework | I simply don't understand how to get nim completion to work in vscode |
22:43:45 | * | ldlework gives up |
22:44:09 | FromGitter | <TiberiumPY> I'll explain tomorrow for you (i mean later today) |
22:47:10 | dom96 | ldlework: Just make sure you've got nimsuggest in your PATH |
22:47:17 | ldlework | I do |
22:47:28 | dom96 | then I dunno |
22:47:35 | ldlework | oh now its working |
22:47:42 | ldlework | nice |
22:47:46 | FromGitter | <TiberiumPY> :) |
22:47:53 | ldlework | now to get it working in emacs |
22:47:56 | ldlework | lol |
22:48:06 | FromGitter | <TiberiumPY> Also you may want to have auto save |
22:48:32 | ldlework | It needs a side bar on the right |
22:48:35 | FromGitter | <Varriount> In other news, I've seen Windows 10 run with 2 GB of RAM |
22:48:37 | ldlework | with a list of all the top-level names |
22:53:05 | dom96 | No wonder people are still using Windows XP |
22:53:21 | FromGitter | <Varriount> dom96:? |
22:53:47 | dom96 | 2GB seems like a lot to me |
22:58:15 | FromGitter | <battila7> Eventually after backend development with Java and Spring one can not look at RAM the way before |
22:58:59 | FromGitter | <Varriount> @battila7 I have a love/hate relationship with IntelliJ and Pycharm too. Great editors, horribly memory usage. |
22:59:06 | FromGitter | <Varriount> Both use Java. |
23:00:02 | dom96 | wow. VS Code is only using 130MB of RAM |
23:00:08 | FromGitter | <Varriount> Which ultimately leads to one of Nim's characteristics that I greatly appreciate: memory usage. |
23:00:10 | dom96 | Nimsuggest is using... A lot |
23:00:15 | dom96 | And there seem to be like 10 instances of it |
23:00:32 | dom96 | One of them is using 1.1GB |
23:00:34 | FromGitter | <battila7> IntelliJ might be the best Java IDE out there but you should not try running two instances with 4GBs of RAM :smile: |
23:01:20 | FromGitter | <battila7> @dom96 That's a bit scary |
23:02:13 | FromGitter | <Varriount> dom96: Unfortunately, the only way I can see to decrease that is to strip out all the extra compiler behavior. |
23:02:40 | FromGitter | <Varriount> Or have a memory profiling tool |
23:02:49 | dom96 | Varriount: huh? I'm pretty sure it's leaking memory. |
23:03:32 | dom96 | It is an old version though. It's possible that this was fixed already. |
23:08:05 | FromGitter | <Varriount> ldlework: How is dadren going? Anymore odd errors to puzzle out? |
23:08:32 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
23:10:06 | ldlework | nice I got completion working in emacs now |
23:10:26 | ldlework | Varriount, no more odd puzzles yet. Next challenge is making it so you can resize the partitions |
23:10:32 | * | bjz joined #nim |
23:12:52 | ldlework | Varriount, wanna help in general? Or just looking for nim compiler errors to chew on? :D |
23:13:48 | * | Nobabs27 joined #nim |
23:43:27 | * | Matthias247 joined #nim |
23:52:18 | * | zachcarter joined #nim |
23:52:41 | * | nsf joined #nim |
23:54:44 | * | def-pri-pub joined #nim |
23:58:45 | zachcarter | oooo just saw all this talk about dom96’s macro - nice! |