00:08:18 | * | endragor joined #nim |
00:13:27 | * | endragor quit (Ping timeout: 260 seconds) |
00:15:47 | * | jsgrant joined #nim |
00:20:09 | * | nattefrost quit (Remote host closed the connection) |
00:38:54 | FromGitter | <mratsim> for some not having to worry about type is a feature |
00:39:26 | FromGitter | <mratsim> then you get Python division "bug" when using integers |
00:41:11 | FromGitter | <zacharycarter> hrm I need a hash set where I can have an mitems iterator or a sequence where I can delete by object, or something similar to that |
00:41:22 | FromGitter | <zacharycarter> trying to implement a graph for my dungeon generator |
00:49:08 | * | endragor joined #nim |
00:51:44 | FromGitter | <zacharycarter> @Varriount any idea? |
00:53:04 | FromGitter | <Varriount> @zacharycarter Is there a reason you can't use the tables module? |
00:53:21 | * | endragor quit (Ping timeout: 248 seconds) |
00:53:29 | FromGitter | <zacharycarter> hrm I guess a table could work |
00:53:56 | FromGitter | <zacharycarter> not sure what I'd store as the value in this case |
01:00:58 | FromGitter | <Varriount> Or do you mean you need a set? |
01:01:13 | FromGitter | <Varriount> There's a sets module |
01:02:52 | FromGitter | <zacharycarter> yeah but I need a set where I can also like pop the first element off or retrieve an element by index |
01:03:50 | FromGitter | <zacharycarter> I guess that's not a thing |
01:06:27 | FromGitter | <zacharycarter> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59bf1c12210ac2692043a0e4] |
01:06:57 | FromGitter | <zacharycarter> https://play.nim-lang.org/?gist=7f1cf643e4be2608cf87b0afb0411e7e better yet |
01:08:37 | FromGitter | <zacharycarter> neighbors could be a seq for all I care |
01:08:48 | FromGitter | <zacharycarter> if I could remove objects from a seq by the object |
01:08:58 | FromGitter | <zacharycarter> instead of by index |
01:09:41 | * | Sembei joined #nim |
01:12:12 | FromGitter | <zacharycarter> I guess this works - https://play.nim-lang.org/?gist=5648836f3c80b2ec33ffaf05b88cb8de |
01:16:35 | * | endragor joined #nim |
01:22:03 | FromGitter | <edubart> @Varriount is the stable NimLime autocompletion supposed to work with the latest sublime text 3 (build 3144)? |
01:23:02 | FromGitter | <Varriount> @edubart I last tested it a long time ago, on a modified version of nimsuggest |
01:23:52 | FromGitter | <Varriount> It probably needs to be modified to work with the current nimsuggest |
01:24:10 | FromGitter | <edubart> you aren't maintaining it anymore? are your using something else to have nim autocompletion? |
01:24:33 | FromGitter | <Varriount> Yes, the built-in autocomplete |
01:25:13 | FromGitter | <Varriount> I would maintain, if I had the time. |
01:25:41 | FromGitter | <Varriount> As it is, I put out a request on the forum for someone else to help - the code isn't that complex |
01:25:51 | FromGitter | <Varriount> No one volunteered though |
01:26:37 | * | endragor quit (Read error: Connection reset by peer) |
01:27:18 | * | endragor joined #nim |
01:27:28 | * | Ven`` joined #nim |
01:28:51 | * | MyMind joined #nim |
01:28:52 | * | Sembei quit (Ping timeout: 240 seconds) |
01:33:11 | FromGitter | <Varriount> @edubart 'Fixing' Nimsuggest integration is not a quick fix. |
01:34:08 | FromGitter | <Varriount> Currently, the stdout and tcp protocols for NimLime only accept one 'command', then close the connection/quit. So you either face having to start a process rapidly as someone types, or make a TCP connection. |
01:34:38 | FromGitter | <Varriount> The only sane protocol it has is the epc protocol. |
01:36:33 | * | Ven`` quit (Ping timeout: 248 seconds) |
01:38:00 | FromGitter | <edubart> =( |
01:39:32 | FromGitter | <Varriount> Wait, that's slightly inaccurate. |
01:40:06 | FromGitter | <Varriount> stdin mode is for interactive use, and displays formatting that makes it hard to parse, tcp quits after one command |
01:42:04 | FromGitter | <edubart> Auto completion for Nim didn't work in Sublime Text, neither Visual Studio Code, neither Atom for me and all plugins in each editor claimed to have autocompletion |
01:43:50 | * | yglukhov joined #nim |
01:47:29 | FromGitter | <Varriount> @edubart I love Nim as a language, but there are many things in the codebase that annoy me. Nimsuggest is one of them. |
01:47:52 | * | yglukhov quit (Ping timeout: 240 seconds) |
01:50:18 | FromGitter | <Varriount> Documentation is another. My greatest fear for this project is that Araq gets hit by a bus. If that happens, there won't be anyone who understands the compiler code. |
01:58:44 | FromGitter | <Varriount> @zacharycarter Found a solution yet? |
01:58:51 | * | chemist69 quit (Ping timeout: 252 seconds) |
02:00:29 | FromGitter | <edubart> Indeed, I feel in a similar way, there are great things in the language, but every now and then you encounter something that annoys |
02:01:40 | FromGitter | <zacharycarter> I think so varriount |
02:02:04 | * | ipjk_ joined #nim |
02:04:41 | * | ipjk quit (Ping timeout: 240 seconds) |
02:12:42 | * | chemist69 joined #nim |
02:17:48 | FromGitter | <zacharycarter> @Varriount have you seen my spaceship maps? |
02:33:42 | * | relax joined #nim |
02:34:39 | * | shashlick quit (Ping timeout: 248 seconds) |
02:44:02 | * | pilne quit (Quit: Quitting!) |
02:47:35 | * | shashlick joined #nim |
02:52:51 | * | dddddd quit (Remote host closed the connection) |
02:54:11 | FromGitter | <Varriount> @zacharycarter Yes, they are quite interesting |
03:00:03 | * | Serenit0r joined #nim |
03:03:21 | * | Serenitor quit (Ping timeout: 240 seconds) |
03:04:29 | * | mahmudov joined #nim |
03:06:21 | FromGitter | <superfunc> @Varriount I'd be interested in maintaining nimlime |
03:23:36 | * | rauss joined #nim |
03:31:59 | shashlick | what happens if you return from a function that's executing a bunch of spawns before they are done? |
03:32:39 | shashlick | using flowvars to track the return values that is |
03:37:42 | FromGitter | <zacharycarter> why doesn't this work? https://play.nim-lang.org/?gist=991e0d777a5e96d0628e90bb6e911e7e |
04:06:09 | * | Serenit0r quit (Quit: Leaving) |
04:20:17 | FromGitter | <superfunc> @zacharycarter might be this: https://nim-lang.org/docs/manual.html#templates-limitations-of-the-method-call-syntax |
04:20:23 | FromGitter | <superfunc> @zacharycarter this works: https://play.nim-lang.org/?gist=0158db261ed1564357f0bbb732f04036 |
04:22:24 | nohusuro | how do I pass a NULL to a c function that's expecting a const char *? The nim library specifies it as a cstring |
04:31:01 | FromGitter | <zacharycarter> thanks @superfunc |
04:31:04 | FromGitter | <zacharycarter> man concepts are weird |
04:31:26 | FromGitter | <zacharycarter> I think I understand them, then I try to change one thing about them and I blow them up entirely |
04:43:34 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
04:45:11 | * | Tanger joined #nim |
04:46:00 | Tanger | Hey guys! Does anybody have an idea on how to pass a null value through the FFI? |
04:46:07 | Tanger | ie http://termbin.com/pc7d |
04:50:07 | * | relax quit (Ping timeout: 248 seconds) |
04:52:30 | nohusuro | hah Tanger , I also asked this |
05:00:33 | * | shashlick quit (Ping timeout: 246 seconds) |
05:19:14 | * | Vladar joined #nim |
05:25:57 | nohusuro | got it working, forgot to call SSL_init method |
05:50:33 | * | solitudesf joined #nim |
05:51:10 | * | renarc joined #nim |
05:57:37 | * | BigEpsilon joined #nim |
06:04:02 | * | couven92 joined #nim |
06:12:31 | * | rauss quit (Quit: WeeChat 1.9) |
06:14:06 | * | PMunch joined #nim |
06:23:16 | FromGitter | <superfunc> nohusuro, was the answer to pass nil? |
06:38:40 | * | nsf joined #nim |
06:49:47 | * | gokr joined #nim |
07:14:19 | nohusuro | superfunc, yeah, nil worked just fine, but I was previously getting an error even when doing that because I didn't SSL_init |
07:14:49 | nohusuro | turns out, that after all that work I did, the SSL stuff exported by nim doesn't verify the hostname in the subject alternate names anyway |
07:15:02 | nohusuro | so I'm gonna have to write a function for that |
07:15:07 | * | LargeEpsilon joined #nim |
07:17:21 | * | BigEpsilon quit (Ping timeout: 240 seconds) |
07:22:25 | * | skrylar joined #nim |
07:23:05 | * | claudiuinberlin joined #nim |
07:24:30 | * | madmalik joined #nim |
07:29:41 | * | yglukhov joined #nim |
07:31:37 | * | LargeEpsilon quit (Quit: Leaving) |
07:37:34 | gokr | Did some propaganda: https://www.quora.com/What-is-your-review-of-Nim-programming-language/answer/G%C3%B6ran-Krampe |
07:37:36 | gokr | :) |
07:40:46 | * | Arrrr joined #nim |
07:40:46 | * | Arrrr quit (Changing host) |
07:40:46 | * | Arrrr joined #nim |
07:45:04 | FromGitter | <Varriount> @superfunc Thanks. If you have any questions about the code, feel free to ask |
07:46:09 | FromGitter | <Varriount> The settings system and the send_self decorator are probably the most complex pieces. |
07:47:32 | FromGitter | <Varriount> However I believe send_self is documented. The settings system probably needs to be rewritten to be simpler, but it works for the most part. |
07:50:50 | * | Pisuke joined #nim |
07:52:33 | * | MyMind quit (Ping timeout: 248 seconds) |
07:56:02 | * | Pisuke quit (Ping timeout: 260 seconds) |
08:01:46 | skrylar | bloop. |
08:14:24 | * | claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
08:14:39 | * | nattefrost joined #nim |
08:17:27 | * | claudiuinberlin joined #nim |
08:21:19 | * | PMunch quit (Ping timeout: 248 seconds) |
08:25:01 | * | PMunch joined #nim |
08:37:31 | * | Pisuke joined #nim |
08:37:35 | * | claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
08:39:02 | * | claudiuinberlin joined #nim |
08:42:29 | * | Yardanico joined #nim |
08:44:43 | FromGitter | <superfunc> nohusuro, thanks, I was just curious since I haven't really interacted with the ffi stuff at all yet |
08:45:37 | FromGitter | <superfunc> @Varriount Cool, i'll give it a full read this upcoming weekend and ping you |
08:49:17 | Yardanico | gokr, upvoted |
08:49:30 | Yardanico | quora is a nice website |
08:49:33 | gokr | :) |
08:49:37 | Yardanico | but not always :) |
08:49:42 | FromGitter | <superfunc> Sometimes haha |
08:50:08 | gokr | Two people actually requested an answer from me, you can evidently do that somehow. |
08:50:44 | Yardanico | yeah, you can |
08:50:59 | * | claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
08:51:20 | Yardanico | you can request an answer from anyone, but it's completely optional (e.g. you're not forced to answer it) |
08:51:50 | FromGitter | <ghego> hey guys, I'm very new to nim and I have a question. I'm trying to use this program to extract text from wikipedia: https://github.com/rspeer/wiki2text and it's written in nim. The question I have is: what is the encoding that nim uses to save the text in output? I thought it was utf-8 but when I try to read the output with utf-8 encoding I get an error at some point. Any ideas? |
08:52:16 | Yardanico | strings is just a sequence of bytes :) |
08:52:46 | FromGitter | <superfunc> There is a separate type for unicode, but the default string is just bytes |
08:52:47 | Araq | ghego: are you on windows? |
08:53:34 | Yardanico | Araq, I think this code is written with only ascii in mind |
08:53:44 | Yardanico | e.g. slices like text[pos .. <found] where "text" is just string |
08:53:49 | * | claudiuinberlin joined #nim |
08:54:07 | Yardanico | or no |
08:54:22 | Yardanico | ok, I'll try myself |
08:54:35 | Yardanico | I have a pretty fast internet on my VPS (~50-100 megabytes/sec) |
08:56:47 | FromGitter | <ephja> almost 4k stars on github |
08:56:59 | Yardanico | ohhh |
08:57:05 | Yardanico | well actually |
08:57:13 | Yardanico | yesterday it was 3984 |
08:57:16 | Yardanico | today it's 3983 lol |
08:57:35 | FromGitter | <superfunc> im compiling my work project right now(c++) and its so depressing compared to my personal nim stuff. it takes 40 minutes to build on my machine :( |
08:57:39 | FromGitter | <ephja> oh no |
08:58:07 | FromGitter | <superfunc> It has all of the usual suspects, unnecessary includes, boost usage, and hella templates |
08:59:07 | * | claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
08:59:21 | Yardanico | ehh, wikipedia dumps are slow to download :( only 6 megabytes/sec |
09:00:17 | FromGitter | <ephja> man, that sucks |
09:00:53 | Yardanico | well probably it's very costly for them to host these dumps |
09:01:19 | FromGitter | <superfunc> and nobody ever clicks on the link with the wikipedia guys face to give them money |
09:01:26 | Yardanico | oh wait, there's a mirror |
09:02:10 | Yardanico | yay |
09:02:17 | Yardanico | 130 mb/sec |
09:02:21 | Yardanico | lol |
09:02:36 | Yardanico | ah, no, I'm wrong :P |
09:03:07 | FromGitter | <ghego> @Araq no, I'm on linux (CentOS) |
09:03:44 | * | claudiuinberlin joined #nim |
09:04:25 | FromGitter | <ephja> @superfunc they should hire a hot chick and put her face there instead |
09:04:43 | FromGitter | <superfunc> I feel like I still wouldn't click |
09:04:45 | FromGitter | <ephja> @Varriount doesn't zah know the codebase well by now? |
09:06:59 | Yardanico | also, again, about backwards compat: https://github.com/rspeer/wiki2text was written using nim 0.11 |
09:07:06 | Yardanico | and it just works noqw |
09:07:47 | FromGitter | <superfunc> I left my first nim package, written against 11 or so, came back and rebuilt on 16 and it just worked, was cool |
09:07:56 | Yardanico | ghego, Araq : can confirm that wiki2text extracts unicode text just fine |
09:07:59 | Yardanico | tested on russian wiki |
09:12:02 | FromGitter | <ghego> @Yardanico did you test it on the whole en wikipedia dump? I thought so too, but when I load the output in python I get an error at some point |
09:12:15 | Yardanico | what error? |
09:12:56 | FromGitter | <ghego> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59bf8e18bc4647297449e198] |
09:13:33 | FromGitter | <Yardanico> can you post the text which triggered this error? |
09:13:46 | FromGitter | <Yardanico> it can be that wiki has invalid unicode chars itself :P |
09:14:42 | FromGitter | <ephja> is the unicode support as bad in 2.7? |
09:14:58 | Yardanico | also, ghego, you may also want to just ignore unicode errors |
09:15:00 | FromGitter | <ghego> yes. I don't know yet which line generated itself because my script didn't catch the error (and since it's python it's very slow and the error occurred after 10 hours of running just fine :) ) I will modify the script to catch the exception and re-run |
09:15:07 | Yardanico | AFAIK python unicode allows that |
09:15:10 | Yardanico | just ignore errors |
09:15:59 | FromGitter | <ghego> thank you all for the suggestions. I will post the line later if I catch it |
09:16:20 | Yardanico | well I mean you can decode utf8 with ignoring errors in it |
09:16:26 | Yardanico | python allows that |
09:21:49 | Yardanico | lol, https://github.com/alehander42/breeze |
09:22:07 | * | renarc quit (Ping timeout: 248 seconds) |
09:22:16 | Yardanico | macro dsl to ease writing of macros :P |
09:24:03 | FromGitter | <ghego> @Yardanico yep, that's exactly what I'll do now |
09:24:08 | FromGitter | <ghego> th |
09:24:09 | FromGitter | <ghego> x |
09:25:55 | Araq | Yardanico: awesome! I love breeze |
09:26:02 | Yardanico | yeah |
09:26:49 | Yardanico | Araq, so we'll have easier-to-write macros in the future? :) |
09:26:54 | Yardanico | based on karax or breeze? |
09:27:31 | Araq | karax includes a DSL for DOM construction |
09:27:45 | Araq | breeze does the same for NimNode construction |
09:27:56 | Yardanico | and it's less than 100 loc ! |
09:30:01 | FromGitter | <Grabli66> Hi. I dont understand. Is Nim object oriented language, or module oriented, or component oriented, or maybe functional language? I dont understand what to choose. :) |
09:30:22 | Araq | yeah but it does it wrong a bit :-) it needs to copy karax more, karax interacts well with Nim's control flow constructs |
09:31:01 | Yardanico | Grabli66: multi-paradigm |
09:31:32 | Araq | grabli66: Nim is a meta programming based on an imperative/procedural core with some support for OO and FP added. |
09:32:01 | Araq | but the focus is (and always was) proc+meta |
09:33:57 | * | renarc joined #nim |
09:38:20 | * | dddddd joined #nim |
09:39:15 | gokr | Ha, insanity full circle: https://github.com/alehander42/miv |
09:40:14 | gokr | Just kidding of course, we use Electron for Evothings Studio, but... its still an insane thing. |
09:40:15 | Yardanico | https://github.com/PMunch/nim-electron |
09:40:30 | Yardanico | well yeah |
09:40:38 | Yardanico | it would make much more sense to use C++ side of electron with nim |
09:41:13 | skrylar | electron because every app needs to be its own 200mb chrome install |
09:41:40 | Yardanico | true |
09:41:56 | Yardanico | but open-source apps can benefit from electron in package managers |
09:42:00 | gokr | I am quite torn by the whole electron thing. Exactly. It's kinda weird that we invent this whole layer so that desktop apps can be written using web tech. |
09:42:14 | FromGitter | <superfunc> electron makes me sad |
09:42:26 | Yardanico | lol |
09:42:35 | Yardanico | imagine developers will use web assembly in electron |
09:42:41 | Yardanico | weird |
09:42:46 | gokr | It is somehow the singularity of what has been going on since late 1990s. |
09:43:27 | gokr | The browser eating up the OSes, turning into a cross platform OS itself. |
09:43:55 | Araq | the problem is that desktop APIs suck and are mostly highly OS specific |
09:44:32 | Araq | plus haven't caught up with the layouting features of HTML/CSS |
09:46:20 | euantor | I wouldn't mind Electron if it didn't mean a whole Chrome instance per app - imagine if you could use HTML/CSS/JS but the rendering and stuff was done by the OS |
09:46:22 | skrylar | i blame electron on the lack of choice in GUI frameworks |
09:46:35 | skrylar | and that gui frameworks tend to give you a handful of widgets and then abandon you when you need a custom one |
09:46:48 | skrylar | i mean they're all deep heirarchy premade stuff, they're not compositional like Self/Morphic |
09:47:22 | skrylar | so you need a custom widget, as everyone does, have fun learning how to do all the font and layout crap yourself 'cause all the nice layout stuff your gui lib might have had doesn't have a generic version you can use for your own stuff |
09:47:45 | skrylar | electron at least gives you the layout stuff from css/html when you need to do something weird |
09:49:04 | gokr | yeah. WebOS (web tech in the OS itself) was a bit fun, but went the way of the Dodo. Now in TVs :) FirefoxOS cancelled. Are there any other OS attempt around that integrates web tech as main UI model? |
09:50:18 | gokr | The "problem" of course with web tech - is that you will have basically zero streamlining. Your OS will end up feeling like a hodge podge I guess. |
09:57:07 | federico3 | gokr: and it has been a mess since the very beginning |
10:05:35 | PMunch | Yardanico, can you use Electron with only C++ |
10:08:41 | Araq | any "protocol" experts around? I'm writing some websocket server and I would like "reply to client" vs "broadcast this message to all clients" |
10:08:57 | FromGitter | <ephja> trying to fix an overloading bug. this will be fun |
10:11:58 | couven92 | Araq, I have experimented further with the debug info in VCC (https://github.com/nim-lang/Nim/pull/6397) and by using `/Z7` we get parallel compilation **WITH** full debug info |
10:12:19 | * | claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
10:12:23 | Yardanico | Araq oh, it seems this isn't the easiest task https://stackoverflow.com/questions/16280747/sending-message-to-a-specific-connected-users-using-websocket |
10:13:49 | Yardanico | couven92, yay |
10:14:01 | euantor | WebSockets are a mess. I've looked at them in C# in the past and gave up |
10:14:02 | Yardanico | but I'm afraid you would need to check if this works with older VCCs |
10:16:52 | couven92 | Yardanico, this is a REALLY old feature that pre-dates PDB file generation, so this will work on older VCCs as well |
10:20:41 | * | claudiuinberlin joined #nim |
10:27:35 | * | claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
10:27:48 | Araq | euantor: uh, can you elaborate? |
10:28:27 | euantor | The C# libraries for desktop apps are extremely limited |
10:28:52 | euantor | I was also trying to send a message to a single client, but none of them at the time would let you do that - broadcast was the only option |
10:29:03 | couven92 | euantor, WPF is pretty advanced though? |
10:29:09 | euantor | Yeah, it is |
10:29:30 | euantor | There's also SignalR that achieves similar things |
10:30:08 | euantor | But I couldn't find any way to get that working in a desktop app rather than an ASP web site |
10:30:14 | euantor | Or no easy way at least |
10:30:51 | * | claudiuinberlin joined #nim |
10:31:51 | euantor | The project I was working on was fairly unique though as it involved sending binary data from a web page (audio capture from JS) to a backend server to save the audio and transmit it to another machine over TCP. In the end I had a node.js server with a websocket server that received the audio then streamed it to my .net app |
10:35:33 | * | claudiuinberlin quit (Client Quit) |
10:36:49 | * | claudiuinberlin joined #nim |
10:37:40 | * | dyce[m] quit (Ping timeout: 240 seconds) |
10:40:32 | * | abeaumont quit (Ping timeout: 260 seconds) |
10:40:54 | * | dyce[m] joined #nim |
10:40:57 | * | abeaumont joined #nim |
10:40:58 | * | claudiuinberlin quit (Client Quit) |
10:53:18 | federico3 | euantor: why websockets tho? You can stream binary data over HTTP |
10:58:57 | euantor | It was the easiest way to do what I needed to do in the 2 days I had to get it working ;) |
11:03:31 | FromGitter | <Grabli66> What's the problem with websockets? It's pretty easy to use them. :) |
11:07:05 | * | nsf quit (Quit: WeeChat 1.9) |
11:10:44 | FromGitter | <Bennyelg> @Araq why Karax has almost no documentation? |
11:10:53 | FromGitter | <Bennyelg> Its under creation? |
11:11:41 | Araq | yeah |
11:12:10 | FromGitter | <Bennyelg> @Araq The only thing I can say now, is this: Its look very very promising |
11:18:48 | Yardanico | Araq, is there a way to make this work? https://gist.github.com/Yardanico/83cd162750bee375289dd25fbc3c1c99 |
11:19:06 | Yardanico | it works with a seq, but not with array |
11:27:47 | Araq | Yardanico: it should |
11:28:25 | Yardanico | Araq, i've also tried to do it with an array |
11:28:36 | Yardanico | *template |
11:31:26 | * | Yardanico quit (Remote host closed the connection) |
11:33:53 | * | Yardanico joined #nim |
11:34:03 | * | Yardanico quit (Remote host closed the connection) |
11:34:21 | * | PMunch quit (Ping timeout: 240 seconds) |
11:35:03 | * | PMunch joined #nim |
11:38:20 | * | Snircle joined #nim |
11:38:21 | * | arnetheduck joined #nim |
11:43:52 | * | Arrrr1 joined #nim |
11:43:52 | * | Arrrr quit (Disconnected by services) |
11:49:20 | * | claudiuinberlin joined #nim |
11:52:17 | * | ShalokShalom_ joined #nim |
11:54:13 | * | nsf joined #nim |
11:54:52 | * | ShalokShalom quit (Ping timeout: 240 seconds) |
11:54:54 | * | claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
12:01:50 | * | claudiuinberlin joined #nim |
12:03:47 | * | claudiuinberlin quit (Client Quit) |
12:07:35 | * | claudiuinberlin joined #nim |
12:12:03 | * | nsf quit (Quit: WeeChat 1.9) |
12:18:26 | * | BitPuffin|osx joined #nim |
12:31:22 | * | Arrrr1 quit (Quit: Leaving.) |
12:36:11 | * | salewski joined #nim |
12:37:16 | salewski | Araq, can you give us a hint for https://github.com/StefanSalewski/gintro/issues/15#issuecomment-330186450 |
12:37:24 | salewski | (last post) |
12:37:46 | * | claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
12:38:18 | salewski | I have the feeling that for a C library call that notation with = nil works. |
12:38:51 | salewski | But for a call of a Nim proc not. |
12:39:03 | * | relax joined #nim |
12:39:31 | salewski | Would be very convenient when we can use one single proc to pass object or nil. |
12:39:40 | Araq | salewski: I cannot follow you |
12:40:01 | Araq | but (T | ptr T) is not a type that accepts 'nil' |
12:40:06 | Araq | it's an "OR" type |
12:42:06 | * | pwntus joined #nim |
12:42:31 | * | pwntus quit (Changing host) |
12:42:31 | * | pwntus joined #nim |
12:42:34 | * | claudiuinberlin joined #nim |
12:46:11 | salewski | OK, then I have to provide that procs twice... |
12:46:29 | salewski | proc iterNChildren*(self: TreeModel; iter: TreeIter): int = discard |
12:46:31 | salewski | and |
12:46:42 | * | skrylar quit (Remote host closed the connection) |
12:46:52 | salewski | proc iterNChildren*(self: TreeModel; iter: ptr TreeIter = nil): int = discard |
12:50:05 | salewski | Just to be sure, there is no notation for the case that one parameter can be an object |
12:50:25 | salewski | on the stack passed by ref, or that it can be nil? |
12:51:31 | FromGitter | <zacharycarter> hrm I have a section of code when I move inside a parallel block it segfaults |
12:51:46 | FromGitter | <zacharycarter> when I run it sequentially it's fine |
12:52:18 | salewski | The use case is passing simple object to GTK, for example an color struct with 3 rgb color, or nil for default. |
12:57:47 | FromGitter | <zacharycarter> here's the code |
12:58:28 | FromGitter | <zacharycarter> https://play.nim-lang.org/?gist=4afe30d15186f66a123e03fd4edbdd29 |
12:58:34 | FromGitter | <zacharycarter> it blows up in the first parallel block |
12:59:43 | * | ShalokShalom_ is now known as ShalokShalom |
13:00:48 | Araq | salewski: no there is no such notion, I'm afraid |
13:01:10 | Araq | but I'm thinking about adding 'Option' as a first class type to Nim and then we could support that too |
13:04:00 | salewski | OK, thanks. I just tried to reread about the exact definition of | OR type, its not easy to find in manual... |
13:04:09 | salewski | Have not yet found it. |
13:05:36 | FromGitter | <zacharycarter> finally got a stacktrace |
13:05:45 | FromGitter | <zacharycarter> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59bfc4a87b7d98d30d0d0155] |
13:06:30 | FromGitter | <zacharycarter> anyone have any ideas? |
13:11:39 | FromGitter | <zacharycarter> I tried sticking a lock on stepSets thinking maybe two threads were trying to resize the sequence at the same time or something |
13:11:42 | FromGitter | <zacharycarter> but that didn't fix it :/ |
13:14:01 | * | relax quit (Ping timeout: 255 seconds) |
13:14:09 | * | claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
13:14:14 | * | Yardanico joined #nim |
13:15:23 | Araq | salewski: yeah, it needs to be documented, that feature grew into existance, it started as a system.nim specific extension for generics |
13:15:25 | * | renarc quit (Remote host closed the connection) |
13:15:34 | Araq | to make certain magics easier to handle |
13:23:23 | Yardanico | so "int | string" would result in an implicit generic parameters? |
13:23:40 | Araq | yes |
13:24:08 | Araq | zacharycarter: crash aside ^spawn misses the point :-) |
13:24:30 | Araq | that spawns and waits for the result to come back, no parallelization whatsoever |
13:25:10 | FromGitter | <zacharycarter> oh |
13:25:36 | FromGitter | <zacharycarter> hopefully my example is clear enough as to what I"m tryin gto do |
13:25:53 | FromGitter | <zacharycarter> i'd like to run the A* operations in parallel and collect their results |
13:26:11 | FromGitter | <Yardanico> spawn threads and wait for all results? |
13:26:39 | FromGitter | <zacharycarter> so just get rid of parallel then and use spawn? |
13:28:48 | FromGitter | <zacharycarter> if someone could provide me with a trivial example I'd be much appreciative |
13:33:42 | * | rauss joined #nim |
13:36:34 | PMunch | Released the Game Jam game that I created with Nim by the way: https://pmunch.itch.io/hold-the-line |
13:37:04 | FromGitter | <Yardanico> probably this isn't the best way, but still: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59bfcc001081499f1f476cad] |
13:37:17 | dom96 | PMunch: needs a Mac OS X version :) |
13:37:36 | PMunch | I unfortunatuly don't have a Mac, so I can't build a version for it :( |
13:37:38 | Yardanico | it's open-source IIRC |
13:37:44 | Yardanico | PMunch's game |
13:37:55 | PMunch | Or I could possibly build a version for it, but I wouldn't have any way to test if it actually worked |
13:38:15 | Yardanico | yay, works for me |
13:38:16 | PMunch | Oh yeah, the source is on GitHub, but it's missing a couple patches ATM. |
13:38:25 | Yardanico | on antergos (basically arch linux) |
13:38:46 | PMunch | The game? I built in on Manjaro, so no surprise that it works on Antergos :) |
13:38:49 | FromGitter | <zacharycarter> thanks Yardanico |
13:39:12 | * | salewski quit (Quit: WeeChat 1.9) |
13:39:53 | Yardanico | PMunch, so executable itself is just 750kb on linux? |
13:40:00 | PMunch | Yup |
13:40:18 | PMunch | Most of the size is the uncompressed audio clips :P |
13:41:00 | PMunch | Yardanico, on Linux you install SDL from your software manager, so no need to ship all the DLLs like on Windows. |
13:41:06 | Yardanico | PMunch, yeah, I know |
13:41:40 | PMunch | Hmm, not even sure if that is compiled with -d:release when I think about it |
13:41:45 | Yardanico | :D |
13:41:50 | FromGitter | <zacharycarter> thank you Yardanico w/ your changes I came up with this and it works |
13:42:05 | FromGitter | <zacharycarter> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59bfcd2d7b7d98d30d0d365b] |
13:42:35 | FromGitter | <Yardanico> well it may be not the best way :) |
13:43:10 | Yardanico | I've never wrote any reall app which uses threads/spawn in nim |
13:43:12 | Yardanico | only async |
13:43:45 | FromGitter | <zacharycarter> https://imgur.com/a/Pxb8B |
13:43:57 | FromGitter | <zacharycarter> well it seems fast and ships have hallways now so we're good :P |
13:44:19 | * | relax joined #nim |
13:45:53 | * | vivus joined #nim |
13:50:32 | FromGitter | <zacharycarter> parallel doesn't seem to make it any faster |
13:50:37 | FromGitter | <zacharycarter> I guess I'll just stick with spawn |
13:51:02 | Yardanico | yeah, you don't need parallel for spawn |
13:52:29 | * | adam_ is now known as adam12 |
13:55:41 | FromGitter | <zacharycarter> I'm going to end up generating lock and key puzzles for these dungeons |
13:55:55 | FromGitter | <ephja> speaking of default values for type class arguments, should this work? https://github.com/nim-lang/Nim/issues/1201 |
13:56:00 | FromGitter | <zacharycarter> the spaceship ones anyway |
13:56:14 | PMunch | Are you creating a text based game in Nim zachary? |
13:56:31 | FromGitter | <zacharycarter> No this is just a library for various map generation algorithms |
13:56:40 | PMunch | Aah |
13:56:42 | FromGitter | <zacharycarter> I'll eventually use zengine to render sprites for these maps |
13:56:44 | FromGitter | <ephja> maybe as long as there's no ambiguity. T|ptr T is ambiguous, right? |
13:58:12 | FromGitter | <ephja> regarding first class option types: T|void could be used instead in some cases, if only there was a 'void' singleton |
14:06:01 | * | endragor quit (Remote host closed the connection) |
14:06:39 | FromGitter | <ephja> ```code paste, see link``` ⏎ ⏎ won't this work anymore? maybe the macro should expect 'case' statements to be present then [https://gitter.im/nim-lang/Nim?at=59bfd2ef177fb9fe7ed6dcd6] |
14:07:54 | * | couven92 quit (Quit: Client disconnecting) |
14:08:07 | * | endragor joined #nim |
14:11:49 | * | shashlick joined #nim |
14:12:21 | * | endragor quit (Ping timeout: 240 seconds) |
14:13:15 | * | claudiuinberlin joined #nim |
14:14:25 | * | PMunch quit (Quit: Leaving) |
14:15:30 | * | nattefrost quit (Remote host closed the connection) |
14:18:54 | * | claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
14:23:50 | * | salewski joined #nim |
14:25:07 | salewski | thanks ephja for the term "type class arguments" and the link to the old issue. |
14:26:25 | salewski | So it is and old, known problem. I just tried a very strange construct to get the default nil pointer value: |
14:26:35 | salewski | proc iterNChildren*(self: TreeModel; iter: TreeIter = cast[ptr TreeIter](nil)[]): int = |
14:27:49 | salewski | I have some hope that it may indeed work. So I could avoid providing an additional overloaded proc with default nil pointer. |
14:28:45 | Yardanico | maybe you can make a pragma which will do what you want? or they can't modify proc declaration? |
14:30:11 | salewski | Have never make my own pragmas yet. Was not even aware that we can make pragmas. |
14:30:40 | Yardanico | oh wait |
14:30:44 | Yardanico | it seems you actually can |
14:30:44 | Yardanico | hmm |
14:31:50 | Yardanico | lol |
14:32:13 | Yardanico | salewski, https://gist.github.com/Yardanico/22bc1ae0c253db8a140171a33a8076a5 |
14:32:31 | Yardanico | well normally you would copy entire tree and iterate over all parameters, but it's just a quick example :) |
14:33:22 | Yardanico | btw, why async doesn't do that? |
14:33:32 | Yardanico | changing return type from T to Future[T] automatically |
14:34:18 | Araq | it does? |
14:34:27 | Yardanico | Araq, it doesn't |
14:34:42 | Yardanico | lib/pure/asyncmacro.nim(301, 10) Error: Expected return type of 'Future' got ' |
14:34:52 | Yardanico | lib/pure/asyncmacro.nim(301, 10) Error: Expected return type of 'Future' got 'int' |
14:35:04 | Yardanico | https://gist.github.com/Yardanico/5b4eae59bc129065a13de312cf444929 |
14:35:45 | Yardanico | I just didn't knew that you can modify proc definition with pragma |
14:36:19 | Araq | well it's really simple: If we do something then it's because Nim is awesome and avoids boilerplate everywhere. If we don't then it's because we value readability and explicitness over clever code. |
14:36:56 | Yardanico | Araq, so it should be as it is now ? |
14:38:08 | dom96 | yes |
14:38:35 | Araq | er ... I was kidding. |
14:38:42 | Araq | not obvious? |
14:38:55 | Yardanico | well developers would still see that this is an {.async.} proc |
14:38:56 | * | claudiuinberlin joined #nim |
14:39:23 | * | couven92 joined #nim |
14:40:14 | dom96 | It's a nice hint for developers to see the real return type. |
14:40:30 | Yardanico | maybe allow both ? :) |
14:40:32 | dom96 | And I'm going to pull out the ultimate defense: other languages do it the same way. |
14:40:38 | dom96 | Er no. |
14:40:43 | dom96 | That's even more confusing. |
14:41:12 | * | salewski quit (Quit: WeeChat 1.9) |
14:41:45 | couven92 | dom96, shouldn't we actually have #nim-nologs in the TOPIC here? |
14:42:08 | shashlick | why does Nim default to fastcall? When interop'ing with C, I end up having to use cdecl or stdcall or end up running into issues. I'm on Windows. https://stackoverflow.com/questions/5479362/why-is-fastcall-slower-than-stdcall |
14:42:32 | dom96 | couven92: Nobody reads the topic anyway, but sure :) |
14:42:45 | Yardanico | shashlick, because it can be faster ? :) |
14:42:58 | Yardanico | https://nim-lang.org/docs/manual.html#types-procedural-type |
14:43:12 | shashlick | Yardanico: per the stackoverflow, that's not really true, though I'm very far from an expert on that |
14:43:23 | couven92 | dom96, appearently **I** read the topic... :P |
14:43:45 | * | couven92 feels stupid for actually reading the topic of the channels he's joined in |
14:44:10 | vivus | dom96: hello mate |
14:45:03 | FromGitter | <ephja> Yardanico: I'm not an expert, but I know that it's definitely faster than slowcall |
14:45:36 | Araq | shashlick: because it's good style? we can switch to __vectorcall internally this way |
14:45:49 | Araq | and are not hold back by C's legacies |
14:45:57 | Yardanico | ephja yes, exactly ! :D |
14:46:45 | Araq | it won't be the last time C with its support for not giving prototypes will pick some mediocre default |
14:46:45 | Yardanico | https://msdn.microsoft.com/en-us/library/dn375768.aspx |
14:46:47 | FromGitter | <ephja> which icc uses when optimizing for AMD processors |
14:52:01 | shashlick | Araq: so are you saying that this way, when we interop with C, we have to be explicit? |
14:52:18 | shashlick | that way, in the future if Nim changes, it won't break existing code |
14:54:18 | * | mahmudov quit (Remote host closed the connection) |
14:54:42 | * | Arrrr joined #nim |
14:55:36 | Araq | yes. |
14:56:09 | * | Jesin quit (Quit: Leaving) |
14:56:12 | Araq | we like magic but interop with other languages is always explicit, see also the 'exportc' annotation |
15:03:53 | * | claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
15:04:24 | shashlick | makes sense, I think it will help to put some documentation around this - it's the second time I've interop'd and struggled since I wasn't explicit. At least for us lesser folks :) |
15:05:32 | * | Jesin joined #nim |
15:05:56 | Yardanico | Araq, what are your thoughts about string interpolation in stdlib? |
15:07:21 | Araq | Yardanico: I have an i18n module but it's for the JS backend |
15:07:41 | Araq | we need to decide if string interpolation is related to i18n or not |
15:08:56 | Yardanico | well I think we *should* have some string interpolation in stdlib |
15:09:06 | Yardanico | even a simple one :) |
15:09:18 | Yardanico | I found 3 different libraries in nim for string interpolation |
15:09:35 | Yardanico | strfmt / richstring from boost / printf-like interpolation implemented in nim |
15:09:52 | Yardanico | maybe there's more |
15:11:15 | yglukhov | Araq: how can interpolation be related to i18n? |
15:12:00 | * | tax joined #nim |
15:12:52 | Araq | yglukhov: how can't it? once you have an interpreted string, you can change it at runtime |
15:13:57 | Araq | "x+y is {x+y}" can be rewritten to "x+y is " & $(x+y) but then you can't i18n that |
15:14:21 | Yardanico | so you want to have a library which contains both i18n and string interpolation? :) |
15:14:36 | Araq | if you rewrite it to "x+y is $1" % [$(x+y)] instead, i18n remains possible |
15:14:55 | yglukhov | err, interpolation is just a handier printf/sprintf, which doesn't care about i18n except float formatting, no? |
15:15:44 | yglukhov | Araq: yep, and your second sample is no longer interpolation. just formatting. |
15:16:01 | Araq | well surely you agree this requires some thoughts? |
15:16:36 | yglukhov | do you think its possible to do anything about it? |
15:16:51 | yglukhov | do you think its worth thinking? =) |
15:17:26 | * | Trustable joined #nim |
15:18:44 | Yardanico | yglukhov, string interpolation is generally more readable and can be implemented so it doesn't affect runtime performance |
15:18:47 | * | xet7 quit (Ping timeout: 260 seconds) |
15:18:58 | Yardanico | (almost doesn't affect runtime performance) |
15:19:02 | Araq | somebody needs to try karax's i18n module and give some feedback |
15:19:13 | yglukhov | Yardanico: why are you telling me this? =) |
15:19:37 | Araq | if it's good enough, we can make it work with string interpolation |
15:19:54 | Araq | and then we know how string interpolation needs to work (maybe?) |
15:21:17 | Araq | https://craiggrummitt.com/2015/02/13/localization-playing-nicely-with-string-interpolation-in-swift/ |
15:21:43 | yglukhov | Araq: there's one problem with that. |
15:22:15 | yglukhov | the keys in the *.strings are the strings in the code |
15:22:31 | yglukhov | which is not as efficient as nim could get. |
15:23:21 | yglukhov | e.g. in our project we're using different keys like $ALERT_BUTTON_OK |
15:23:40 | yglukhov | and such interpolation would not cover our case. |
15:24:09 | yglukhov | while we could go further and turn the keys to string array indexes at compile time. |
15:24:23 | yglukhov | so that there's even no need for hash tables. |
15:24:39 | yglukhov | and that nim could do, and shine in its compile time glory |
15:24:41 | * | gokr quit (Ping timeout: 240 seconds) |
15:24:59 | Araq | er ... wtf, where is my i18n.nim? |
15:25:05 | Yardanico | :D |
15:25:14 | Araq | I mean the real complete one. |
15:25:28 | Yardanico | you mean no one have implemented it yet? |
15:25:45 | Yardanico | https://github.com/search?q=i18n+language%3Anim |
15:28:55 | Araq | argh, spent a day writing this and its design was good, where is it... |
15:29:20 | * | gokr joined #nim |
15:29:51 | Yardanico | Araq, search it on your entire HDD ? :) |
15:30:28 | FromGitter | <jilee210> ===how to assign the file lines to this set without each line assignment?=== ⏎ ⏎ ===old_lines_set.incl(file1.lines)=== ⏎ ⏎ ===new_lines_set.incl(file2.lines)=== ... [https://gitter.im/nim-lang/Nim?at=59bfe694614889d475127b64] |
15:32:22 | Yardanico | https://nim-lang.org/docs/sets.html#union ? |
15:32:28 | Yardanico | Returns the union of the sets s1 and s2. |
15:32:35 | Araq | Yardanico: likely it's on some other computer :P |
15:32:45 | Yardanico | ah sorry |
15:32:48 | Yardanico | not union |
15:32:53 | Yardanico | you can use incl |
15:33:03 | Yardanico | proc incl[A](s: var HashSet[A]; other: HashSet[A]) |
15:33:54 | FromGitter | <jilee210> the loop section taking too long. is there a better way to assign a file.lines to a set. I got syntax errors. |
15:34:26 | FromGitter | <Yardanico> yourSet.incl(file.lines) ? |
15:34:53 | FromGitter | <Varriount> jilee210: I'm assuming you want to have a unique set of lines in a file? |
15:35:19 | FromGitter | <jilee210> yes |
15:35:41 | FromGitter | <Varriount> Hm |
15:36:31 | FromGitter | <Varriount> Do you have a test file I can work with? |
15:36:32 | Yardanico | do you actually use https://nim-lang.org/docs/sets.html ? |
15:36:46 | Yardanico | jilee210 |
15:37:02 | Yardanico | if you're trying to use built-in set type - you can't store strings in it |
15:37:14 | FromGitter | <jilee210> if paramCount() != 2: ⏎ echo "mydiff file1 file2" ⏎ quit() ⏎ ⏎ let file1 = open(paramStr(1)) # cf. open: file ... [https://gitter.im/nim-lang/Nim?at=59bfe82ac101bc4e3ae097ad] |
15:37:32 | FromGitter | <Yardanico> can you please post it using ``` syntax? |
15:37:58 | Yardanico | well doesn't matter |
15:38:02 | Araq | Yardanico: found it ... :-) |
15:38:06 | Yardanico | Araq, yay! |
15:38:17 | Araq | yeah we got languages.nim and i18n.nim and they need to move to the stdlib |
15:38:31 | FromGitter | <Yardanico> @jilee210 you want to show different lines of two files ? |
15:38:33 | FromGitter | <jilee210> sorry I am having a hard time to understand docs, not very familiar with nim. I am trying to recreate mydiff.py to nim |
15:38:36 | * | yglukhov quit (Remote host closed the connection) |
15:38:47 | FromGitter | <Yardanico> can you link your mydiff.py ? |
15:39:05 | Araq | diffing cannot use unordered sets, can it? |
15:39:18 | * | Sentreen quit (Ping timeout: 246 seconds) |
15:39:37 | FromGitter | <jilee210> old_lines = file1.read().split('\n') ⏎ new_lines = file2.read().split('\n') ⏎ file1.close() ⏎ file2.close() ⏎ ... [https://gitter.im/nim-lang/Nim?at=59bfe8b9c101bc4e3ae09a37] |
15:39:51 | FromGitter | <Yardanico> oh |
15:39:56 | FromGitter | <Yardanico> can you post it on gist? |
15:40:04 | FromGitter | <Yardanico> but yeah, this is easy to do in nim |
15:40:32 | FromGitter | <jilee210> sorry i am not familiar with gist yet |
15:41:52 | FromGitter | <jilee210> mydiff.py takes only 4-5 seconds to process 1.8 millon rows files while my version of nim takes 28 seconds. all due to the loop section. |
15:42:15 | FromGitter | <jilee210> in python, you simply old_lines_set = set(old_lines) ⏎ new_lines_set = set(new_lines) |
15:42:46 | Yardanico | in nim you do almost the same |
15:43:08 | * | couven92 quit (Ping timeout: 240 seconds) |
15:43:27 | FromGitter | <jilee210> But this got errors: |
15:43:34 | FromGitter | <jilee210> ===old_lines_set.incl(file1.lines)=== ⏎ ⏎ ===new_lines_set.incl(file2.lines)=== |
15:43:57 | FromGitter | <jilee210> is it because i did this? |
15:44:04 | FromGitter | <jilee210> let file1 = open(paramStr(1)) # cf. open: file ⏎ let file2 = open(paramStr(2)) |
15:44:05 | Yardanico | yes, there's no such thing "lines" |
15:44:32 | * | haha_ joined #nim |
15:44:44 | FromGitter | <jilee210> then how do you assign all lines to a set |
15:44:59 | FromGitter | <jilee210> 2 million lines fast |
15:45:02 | FromGitter | <Varriount> @jilee210 Please use the code syntax (`like this`) using bold notation is annoying. |
15:45:28 | FromGitter | <jilee210> ok i was cut/paste |
15:45:39 | FromGitter | <Varriount> It's likely because when you diff the sets, the strings are duplicated |
15:46:02 | FromGitter | <Varriount> Since in Python, strings are references, but in Nim, strings are values |
15:46:42 | FromGitter | <jilee210> so no way to speed up diffing two large files? |
15:47:01 | FromGitter | <jilee210> with sets I mean |
15:47:13 | FromGitter | <Yardanico> there is, please don't spam :) |
15:47:59 | FromGitter | <Yardanico> wait a bit |
15:48:51 | FromGitter | <jilee210> thanks for your inputs, I wish faster way to assign a file lines to a set quickly without looping/reading each line to add to a set |
15:49:25 | FromGitter | <Varriount> Anyone have a test file I can work with? |
15:49:30 | FromGitter | <Varriount> I have a sample program |
15:49:35 | Yardanico | any file? |
15:50:37 | FromGitter | <jilee210> a: |
15:51:01 | FromGitter | <jilee210> a: new line ⏎ hello joe ⏎ hi dear |
15:51:13 | FromGitter | <jilee210> b: |
15:51:18 | FromGitter | <jilee210> hi dear ⏎ b: extra line ⏎ hello joe ⏎ b: new line [https://gitter.im/nim-lang/Nim?at=59bfeb751081499f1f483613] |
15:51:20 | FromGitter | <Varriount> I need a large file. Small ones will be fast anyway. |
15:51:50 | FromGitter | <jilee210> mydiff a b: |
15:52:08 | FromGitter | <jilee210> mydiff a b ⏎ ⏎ 1) a: new line ⏎ ⏎ 1) b: extra line ... [https://gitter.im/nim-lang/Nim?at=59bfeba8b59d55b8230fa2ff] |
15:52:40 | * | couven92 joined #nim |
15:53:02 | * | Sentreen joined #nim |
15:53:03 | FromGitter | <Yardanico> This can be rewritten to be much more readable, but it looks like your version in Python: |
15:53:10 | FromGitter | <Yardanico> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59bfebe67b7d98d30d0dfa20] |
15:53:28 | * | claudiuinberlin joined #nim |
15:53:35 | FromGitter | <Yardanico> also, splitLines would handle not only \n, but any newline character |
15:54:00 | FromGitter | <Varriount> @Yardanico You might get a speedup if you put the logic in a main() function, and use shallow() |
15:54:06 | FromGitter | <Yardanico> @Varriount yeah, I know |
15:54:13 | FromGitter | <Yardanico> this is just straight code port from python version |
15:54:20 | FromGitter | <Yardanico> and you need to compile your program with -d:release to make it faster (if you didn't do this before) |
15:54:29 | FromGitter | <Yardanico> nim c -d:release -r myprogra.nim a.txt b.txt |
15:54:36 | FromGitter | <Varriount> @jilee210 Also remember to use `-d:release` when compiling code that you will be benchmarking. |
15:54:52 | FromGitter | <zacharycarter> https://imgur.com/a/Hn3ti |
15:55:03 | Yardanico | wow |
15:57:38 | * | TjYoco joined #nim |
15:58:13 | * | Jesin quit (Quit: Leaving) |
15:59:43 | FromGitter | <jilee210> thanks for your nim version for me to learn. However, the speed is almost same 27 sec to compare 2 million lines of two files. python version is 5 sec or so. |
15:59:54 | Yardanico | you need to compile it using -d:release |
15:59:57 | * | Jesin joined #nim |
16:00:09 | FromGitter | <jilee210> I did |
16:00:17 | Yardanico | are you sure ? :) |
16:00:26 | * | couven92 quit (Read error: Connection timed out) |
16:00:39 | Yardanico | then please upload your two big files so we can benchmark it ourselves :) |
16:00:45 | FromGitter | <jilee210> yes: |
16:00:52 | FromGitter | <jilee210> nim c -d:release mydiff_chat.nim ⏎ Hint: used config file '/autofs/oracledba/jlee/Nim/nim-0.16.0/config/nim.cfg' [Conf] ⏎ Hint: system [Processing] ⏎ Hint: mydiff_chat [Processing] ⏎ Hint: os [Processing] ... [https://gitter.im/nim-lang/Nim?at=59bfedb47b7d98d30d0e049e] |
16:00:55 | * | couven92 joined #nim |
16:01:43 | euantor | `let old_lines = file1.readAll().splitLines()` - you are reading the whole file into memory, then splitting it by line |
16:01:54 | Yardanico | well I just rewrote his python version |
16:01:59 | euantor | Would probably be faster with a `FileSTream` and reading a line at a time |
16:02:08 | Yardanico | I know that it can be easily optimized |
16:03:39 | * | Sentreen quit (Ping timeout: 252 seconds) |
16:05:01 | * | nitely joined #nim |
16:06:05 | Yardanico | jilee210: if you want to speed it up, don't write it in the same way :) |
16:07:24 | FromGitter | <jilee210> at least I learned how to assign all lines to a set using toSet and strutils |
16:08:57 | * | Pisuke quit (Ping timeout: 260 seconds) |
16:09:49 | FromGitter | <jilee210> thanks anyway. if you have your optimized version of mydiff.py, that's will be great. I was going to use this case to encourage co-workers to learn python and nim! |
16:09:59 | euantor | Is this any faster? https://www.irccloud.com/pastebin/IRzmbFaz/test.nim |
16:10:42 | Yardanico | jilee210: what is your main language? |
16:10:49 | Yardanico | I mean programming language |
16:12:00 | euantor | And that could probably be optimised to minimise the number of loops happening, you might be able to do it with 2 loops only |
16:12:31 | FromGitter | <jilee210> error compiling: mydiff_chat2.nim(14, 12) Error: undeclared identifier: 'fs' |
16:13:30 | Yardanico | rename first fs to file1 |
16:13:35 | Yardanico | and rename second fs to file2 |
16:13:38 | euantor | Oops, try this? https://www.irccloud.com/pastebin/tK8YFvEh/mydiff.nim |
16:13:41 | FromGitter | <jilee210> ok |
16:14:36 | FromGitter | <jilee210> mydiff_chat2.nim(33, 19) Error: undeclared identifier: 'old_lines_set' |
16:15:13 | Yardanico | rename it to old_lines |
16:15:19 | Yardanico | and rename new_lines_set to new_lines |
16:15:42 | FromGitter | <jilee210> got it |
16:16:09 | euantor | Also add `= ""` after `line: string` |
16:16:23 | * | claudiuinberlin quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
16:16:23 | euantor | https://www.irccloud.com/pastebin/Jyx5FrO4/mydiff.nim |
16:16:26 | * | Sentreen joined #nim |
16:16:39 | euantor | Easy to forget that string is nil by default |
16:16:46 | * | vlad1777d joined #nim |
16:17:25 | FromGitter | <jilee210> compifled OK but when I ran it, got this error: |
16:17:30 | FromGitter | <jilee210> SIGSEGV: Illegal storage access. (Attempt to read from nil?) |
16:17:35 | euantor | See the above fix |
16:20:13 | FromGitter | <jilee210> seems like taking longer ... |
16:21:40 | FromGitter | <jilee210> perhaps python reference vs nim values ... |
16:21:50 | FromGitter | <jilee210> thanks anyway, learned a lot |
16:22:30 | * | claudiuinberlin joined #nim |
16:23:06 | Yardanico | well you didn't give us your test files :( |
16:23:09 | Yardanico | so we can't benchmark it |
16:23:14 | * | solitudesf quit (Remote host closed the connection) |
16:24:04 | FromGitter | <Bennyelg> @jilee210 Hey just entered, what you are trying to achive |
16:31:03 | FromGitter | <zacharycarter> minimaps hehe |
16:31:20 | FromGitter | <zacharycarter> https://imgur.com/a/0H3pv |
16:31:33 | * | nsf joined #nim |
16:31:40 | FromGitter | <zacharycarter> although things are slowing down considerably now with all these drawrectangle calls |
16:32:29 | * | claudiuinberlin quit (Quit: Textual IRC Client: www.textualapp.com) |
16:32:53 | FromGitter | <mratsim> Is importcpp working for you? My imported function doesn’t get launched at all |
16:37:00 | * | Ven`` joined #nim |
16:40:32 | FromGitter | <Bennyelg> Hey, when I create nim docs , how Do I terminate line when I explain what does to proc do |
16:40:54 | FromGitter | <Bennyelg> ---hello--- ⏎ ⏎ ---sup--- ⏎ ⏎ when I run nim doc the out put is : hello sup in same line [https://gitter.im/nim-lang/Nim?at=59bff716614889d47512e022] |
16:42:52 | * | Demos joined #nim |
16:42:54 | FromGitter | <mratsim> it’s restructured syntax |
16:44:27 | FromGitter | <zacharycarter> @mratsim are you trying to importcpp c++ code or js? I've only tried with js not c++ |
16:45:13 | FromGitter | <Bennyelg> @mratsim so nothing to do? ⏎ And what is the best practice, where should I save the html doc file? |
16:45:35 | Yardanico | nonono, you just do an empty line |
16:45:38 | Yardanico | e.g. |
16:45:43 | Yardanico | ## something |
16:45:43 | Yardanico | ## |
16:45:46 | Yardanico | ## new line |
16:45:49 | FromGitter | <Bennyelg> oh |
16:46:21 | * | yglukhov joined #nim |
16:46:52 | Yardanico | it's RST syntax |
16:47:23 | FromGitter | <mratsim> @zacharycarter templated C++ function (that I’m writing myself) |
16:47:50 | FromGitter | <mratsim> a non-template import works, checking the rest … |
16:48:00 | FromGitter | <zacharycarter> gotcha |
16:48:46 | FromGitter | <mratsim> @Bennyelg save it in a gh-pages branch so that it’s published on your project.github.io |
16:49:21 | * | Sentreen quit (Ping timeout: 240 seconds) |
16:49:30 | FromGitter | <Bennyelg> so it just need to be present in the git repo for example in master branch among the rest of my files? |
16:50:41 | * | yglukhov quit (Ping timeout: 248 seconds) |
16:51:01 | FromGitter | <mratsim> it’s a different special branch for github, things pushed in that branch will be on a website |
16:51:15 | FromGitter | <mratsim> and html/js will be served by their server |
16:51:47 | FromGitter | <mratsim> you might want to use “git subtree” so that you have 1 master branch folder on your computer and one “gh-pages” folder/branch |
16:51:55 | * | yglukhov joined #nim |
16:51:58 | FromGitter | <mratsim> changing folder will automatically change your branch |
16:52:13 | FromGitter | <Bennyelg> I never did that, can you explain or give me some small tutorial ? |
16:52:26 | FromGitter | <mratsim> https://gist.github.com/cobyism/4730490 (I saw better tutos but I couldn’t find it again) |
16:52:35 | FromGitter | <Bennyelg> thanks |
16:53:36 | FromGitter | <mratsim> ah this one: https://dev.to/letsbsocial1/deploying-to-gh-pages-with-git-subtree |
16:53:43 | FromGitter | <mratsim> is a bit better in my opinion |
16:53:46 | * | EastByte quit (Ping timeout: 264 seconds) |
16:54:30 | FromGitter | <mratsim> or that, in a condensed presentation: https://github.com/PrismJS/prism/issues/231 |
16:57:21 | Yardanico | mratsim: you can store gh-pages on master branch too :) |
17:00:30 | * | Demos quit (Read error: Connection reset by peer) |
17:02:08 | * | Ven`` quit (Ping timeout: 240 seconds) |
17:02:34 | * | Sentreen joined #nim |
17:03:09 | * | Ven`` joined #nim |
17:04:24 | FromGitter | <mratsim> A Nim tool to automate gh-pages would be nice :P |
17:04:34 | FromGitter | <mratsim> @zacharycarter small test case: https://gist.github.com/mratsim/afe5604ec96433fe7909079164207bd2 |
17:07:38 | FromGitter | <mratsim> compiles but it seems like the template function is not called :/ |
17:08:41 | * | relax quit (Ping timeout: 240 seconds) |
17:09:29 | shashlick | why do you need to do a crazy cast to get the value out off a FlowVarBase? val = cast[FlowVar[float]](responses[index]).`^`() |
17:09:37 | Yardanico | ehm? |
17:09:51 | Yardanico | just ^responses[index] |
17:09:54 | Yardanico | lol |
17:11:09 | * | Demos joined #nim |
17:11:44 | shashlick | doesn't compile since var responses = newSeq[FlowVarBase](5) |
17:11:58 | shashlick | and ^ expects FlowVar |
17:12:08 | Yardanico | ehm |
17:12:11 | Yardanico | why do you have FlowVarBase ? |
17:12:21 | * | Ven`` quit (Ping timeout: 240 seconds) |
17:12:29 | Yardanico | var responses = newSeq[FlowVar[float]]() |
17:12:41 | shashlick | that's the example in the docs under Spawn in the manual |
17:12:55 | shashlick | plus if I put in FlowVar for responses, that doesn't compile |
17:14:26 | Yardanico | this code wouldn't compile |
17:14:31 | Yardanico | because tellServer isn't defined :P |
17:14:52 | Yardanico | paste all your code please |
17:14:54 | Yardanico | on gist |
17:15:36 | FromGitter | <mratsim> oh @zacharycarter you can’t select the cpp backend in play.nim-lang.org btw |
17:21:03 | shashlick | Yardanico: https://gist.github.com/genotrance/397479572eed0dbb554d026d9d3d5286 |
17:21:05 | FromGitter | <mratsim> mmm the C++ code generated is like this. Arguments got eaten? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=59c000817b7d98d30d0e7483] |
17:21:20 | shodan45 | I built kotlin-native on a whim yesterday. I was surprised it worked. And surprised it took 2.9GB of space. |
17:21:45 | shodan45 | guess I was spoiled by nim ;) |
17:22:20 | Yardanico | shodan45,ah |
17:22:24 | Yardanico | oh sorry, wrong person |
17:22:33 | Yardanico | shashlick, you forgot to import threadpool |
17:22:57 | Yardanico | shodan45, well I can't help you without all code :( |
17:23:12 | Yardanico | make a small example of something you want to make work |
17:23:52 | * | haha_ quit (Quit: haha_) |
17:24:24 | shodan45 | Yardanico: wrong person, 2x :P |
17:24:41 | shashlick | Yardanico: it's there at the top in my file, this is just a subset |
17:25:33 | Yardanico | shashlick, well your code would work, change FlowVarBase to FlowVar[whatevertypeyouhave] |
17:25:47 | shashlick | I see, let me try |
17:26:59 | shashlick | type mismatch: got (seq[FlowVar[system.float]]) |
17:26:59 | shashlick | but expected one of: |
17:26:59 | shashlick | proc awaitAny(flowVars: openArray[FlowVarBase]): int |
17:28:36 | Yardanico | shashlick, would it be better for you to wait for all threads to be completed ? |
17:29:04 | Yardanico | well I don't know why it doesn't work :P |
17:29:31 | shashlick | if I get a good value from one of the threads, I can return |
17:29:39 | shashlick | i don't care to wait for all |
17:31:38 | * | nitely quit (Quit: Page closed) |
17:32:26 | * | zama joined #nim |
17:34:07 | * | sz0 joined #nim |
17:40:45 | FromGitter | <mratsim> Oh I think I found out from the manual. It’s a completely different syntax from imports ⏎ ⏎ > mportcpp for procs ⏎ >Note that the importcpp variant for procs uses a somewhat cryptic pattern language for maximum flexibility: ⏎ >A hash # symbol is replaced by the first or next argument. ... [https://gitter.im/nim-lang/Nim?at=59c0051dc101bc4e3ae14b98] |
17:41:42 | FromGitter | <mratsim> Yes, `{.importcpp: "dummy_templated_print<'1>(@)”.}` instead of `{.importcpp: "dummy_templated_print<'1>”.}` works |
17:45:35 | * | TjYoco quit (Ping timeout: 248 seconds) |
17:50:04 | * | TjYoco joined #nim |
17:52:56 | * | Pisuke joined #nim |
17:55:14 | shashlick | Yardanico: thanks for your help though! |
17:55:28 | Yardanico | shashlick, well it seems it really doesn't work with specific flow vars |
17:58:47 | Yardanico | mratsim: for future - you may compile small code snippets with -d:release to have smaller C source code |
17:59:01 | Yardanico | e.g. ti wouldn't contain nimln_ calls and other debugging features |
18:00:31 | Yardanico | e.g. here https://github.com/nim-lang/Nim/issues/6399 if compiled with -d:release NimMainModule will only contain 4 calls to C++ code |
18:00:34 | Yardanico | and no other calls at all |
18:00:38 | * | ketralnis left #nim ("Textual IRC Client: www.textualapp.com") |
18:01:06 | FromGitter | <mratsim> oh good idea |
18:01:25 | Yardanico | well in this example it doesn't matter, just saying :) |
18:01:34 | FromGitter | <mratsim> it doesn’t make sense to compile with release while debugging though ;) |
18:02:38 | Yardanico | also I'm surprised that nim compiles for c++ by default if there's importcpp pragmas |
18:02:46 | Yardanico | I mean it's good |
18:03:03 | FromGitter | <mratsim> it’s not by default |
18:03:15 | Yardanico | ? |
18:03:32 | FromGitter | <mratsim> I did nim cpp instead of nim c to compile this example |
18:03:48 | Yardanico | well it works with "nim c foo" |
18:03:50 | Yardanico | for me |
18:03:54 | FromGitter | <mratsim> oh |
18:04:14 | FromGitter | <mratsim> it doesn’t work on play.nim-lang.org, are you on master/devel? |
18:04:26 | Yardanico | devel |
18:04:38 | Yardanico | but AFAIK there weren't any changes about this |
18:14:11 | * | relax joined #nim |
18:23:51 | * | vlad1777d quit (Ping timeout: 240 seconds) |
18:26:02 | * | Yardanico quit (Remote host closed the connection) |
18:29:45 | FromGitter | <ino76> hi .. does anybody know some easy algorithm to show "speed" through languages? I tried `for` and add to variable hundred milion times but Nim vas so fast compared to other languages that I think it did some optimalizations and just print result (I hardcoded values). PS: btw did you try Crystal lang?? What do you guys think about it compared with Nim? |
18:31:46 | * | nsf quit (Quit: WeeChat 1.9) |
18:36:05 | subsetpark | https://github.com/ivankoster/nimbench - ino76: this is a good library to start with setting up well-defined benchmarks |
18:42:38 | FromGitter | <ino76> thank you |
18:45:34 | FromGitter | <Varriount> Yardanico: My dream for string interpolation would be a macro like Python's f-strings or javascripts string interpolation. |
18:49:46 | * | haha_ joined #nim |
18:52:41 | * | Vladar quit (Ping timeout: 240 seconds) |
18:54:21 | FromGitter | <Yardanico> @ino76 yeah, C compiler probably took away this loop and computed the sum of it |
18:55:35 | * | madmalik quit (Quit: Connection closed for inactivity) |
18:57:07 | * | xet7 joined #nim |
19:04:37 | * | Sentreen quit (Quit: WeeChat 1.6) |
19:19:40 | * | Trustable quit (Remote host closed the connection) |
19:34:47 | * | Sentreen joined #nim |
19:40:56 | obadz | anyone want to help me instantiate an ifreq? |
19:41:11 | obadz | not sure what the constructor syntax is for this C-union |
19:42:05 | * | Sentreen quit (Ping timeout: 240 seconds) |
19:46:44 | * | claudiuinberlin joined #nim |
19:49:30 | * | claudiuinberlin quit (Client Quit) |
19:52:05 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
19:52:41 | * | Snircle joined #nim |
19:55:03 | * | Sentreen joined #nim |
20:10:06 | * | Sentreen quit (Quit: WeeChat 1.6) |
20:12:46 | * | Sentreen joined #nim |
20:14:59 | Demos | is there a typeclass for key value containers of any type |
20:16:09 | * | ipjk_ quit (Read error: Connection reset by peer) |
20:20:54 | FromGitter | <ephja> @Varriount https://lyro.bitbucket.io/strfmt/#string-interpolation-interp |
20:23:16 | * | claudiuinberlin joined #nim |
20:27:03 | * | Nobabs27 joined #nim |
20:27:12 | * | vlad1777d joined #nim |
20:29:33 | * | yglukhov quit (Remote host closed the connection) |
20:34:20 | obadz | Demos: there are no typeclasses. |
20:34:33 | FromGitter | <mratsim> but you can create a concept |
20:35:03 | FromGitter | <mratsim> there is an example either in the forum, manual or directly in one of the concept tests folder iirc |
20:35:13 | obadz | or just embrace unstructured overloading :) |
20:36:45 | FromGitter | <mratsim> mmmh, actually that was a design question, who knows if you can do it: https://forum.nim-lang.org/t/2396/6 |
20:37:31 | Demos | I would just use the type x = Table or OrderedTable thing |
20:37:40 | Demos | but w/e I'll just pick a type for now |
20:38:11 | Demos | does nim still default to auto for params where you don't specify a type? |
20:39:23 | * | solitudesf joined #nim |
20:40:02 | FromGitter | <Varriount> Not anymore |
20:40:39 | Demos | :( |
20:40:51 | * | Sentreen quit (Ping timeout: 240 seconds) |
20:42:27 | obadz | Demos: you shouldn't have to pick a type |
20:42:55 | Demos | I don't have to, but this is an internal function and I'm lazy |
20:43:25 | obadz | too lazy to put [A] after the function name? |
20:44:48 | Demos | yep |
20:44:56 | FromGitter | <mratsim> [A] ? I always use T |
20:45:01 | Demos | I mean I'll do that if I ever need to use another type |
20:45:04 | Demos | but not now |
20:45:50 | FromGitter | <mratsim> I find having to add type a feature actually, I mean, it’s static typing. And it feeds nimsuggest |
20:46:10 | FromGitter | <Yardanico> you could make a pragma which will put "auto" in arguments without types :P |
20:46:43 | FromGitter | <mratsim> Lazyness can go a long way ;) |
20:52:13 | Araq | Demos: => from future creates proc (a, b: auto): auto = ... |
20:52:30 | Araq | and that's why we got rid of the "auto auto" feature |
20:53:53 | * | Sentreen joined #nim |
20:53:56 | ehmry | Araq: whats the difference between the current asyncdispatch and upcoming? |
20:56:12 | ehmry | or how soon will upcoming/asyncdispatch be asyncdispatch? |
20:59:22 | * | Demos quit (Quit: Demos) |
20:59:35 | * | solitudesf quit (Ping timeout: 240 seconds) |
20:59:49 | * | Demos joined #nim |
21:00:58 | ehmry | I think I may reimplement the dispatcher for genode |
21:03:32 | * | relax quit (Ping timeout: 260 seconds) |
21:04:00 | * | claudiuinberlin quit (Quit: Textual IRC Client: www.textualapp.com) |
21:06:19 | * | TjYoco quit (Quit: Leaving) |
21:08:01 | dom96 | ehmry: why are you considering reimplementing it? |
21:11:40 | ehmry | its complicated, I want to support native asynchronous signaling that happens independently of file discriptors |
21:12:59 | ehmry | and perhaps someday use the native file-system interface rather than POSIX |
21:14:38 | ehmry | by reimplement I mean add a third variation to the windows and unix versions |
21:22:21 | * | Demos quit (Quit: Demos) |
21:35:18 | * | Arrrr quit (Read error: Connection reset by peer) |
21:38:41 | * | Pisuke quit (Ping timeout: 240 seconds) |
21:49:30 | * | Pisuke joined #nim |
21:55:39 | * | Nobabs27 quit (Quit: Leaving) |
21:57:51 | * | Pisuke quit (Ping timeout: 252 seconds) |
22:07:13 | * | Pisuke joined #nim |
22:19:23 | FromGitter | <zacharycarter> @mratsim as soon as cloudfront cache clears you should have c++ compilation option on the playground |
22:22:13 | FromGitter | <zacharycarter> and it should work heh |
22:22:17 | FromGitter | <zacharycarter> but until it clears it's borked |
22:40:40 | * | vivus quit (Quit: Leaving) |
22:56:47 | * | relax joined #nim |
23:03:05 | * | relax quit (Ping timeout: 240 seconds) |
23:07:05 | * | relax joined #nim |
23:14:41 | * | relax quit (Ping timeout: 248 seconds) |
23:15:45 | * | relax joined #nim |
23:30:09 | * | relax quit (Ping timeout: 248 seconds) |
23:39:00 | * | relax joined #nim |
23:43:42 | * | sz0 quit (Quit: Connection closed for inactivity) |