00:01:38 | * | nsf quit (Quit: WeeChat 1.9) |
00:12:49 | * | zolk3ri quit (Quit: Lost terminal) |
00:16:13 | * | dddddd quit (Remote host closed the connection) |
00:28:50 | * | derlafff quit (Read error: Connection reset by peer) |
00:32:40 | * | vlad1777d quit (Ping timeout: 258 seconds) |
00:42:12 | * | derlafff joined #nim |
00:49:35 | * | derlafff quit (Remote host closed the connection) |
00:51:15 | * | derlafff joined #nim |
01:13:44 | * | yglukhov joined #nim |
01:14:05 | * | gokr quit (Ping timeout: 240 seconds) |
01:17:53 | * | yglukhov quit (Ping timeout: 248 seconds) |
01:20:36 | * | chemist69 quit (Ping timeout: 246 seconds) |
01:27:56 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
01:33:14 | * | chemist69 joined #nim |
02:08:01 | * | derlafff quit (Ping timeout: 255 seconds) |
02:17:40 | * | HoloIRCUser2 joined #nim |
02:18:28 | * | HoloIRCUser2 is now known as nitely |
02:24:02 | * | chemist69 quit (Ping timeout: 246 seconds) |
02:38:07 | * | chemist69 joined #nim |
02:49:26 | * | derlafff joined #nim |
02:49:39 | * | yglukhov joined #nim |
02:53:51 | * | yglukhov quit (Ping timeout: 248 seconds) |
02:55:56 | * | cspar joined #nim |
02:58:20 | * | cspar_ quit (Ping timeout: 258 seconds) |
03:25:01 | captainkraft | I'm getting "SIGSEGV: Illegal storage access. (Attempt to read from nil?)" When trying to use a string in a loop. Is there a common reason for this? It may be the library I'm using. |
03:32:54 | captainkraft | When I make the variable a cstring and pass it to a function using $, it doesn't crash. |
03:33:16 | captainkraft | Some sort of lifetime issue? |
04:25:53 | FromGitter | <Varriount> captainkraft: Could you post your code? |
04:29:21 | captainkraft | https://gist.github.com/CaptainKraft/22074175f89e391f53851f5bc6c37355 The variable `txt` is declared as a cstring here, so this code runs. If I make it a string and remove the `$` from the text() call, it fails. |
04:31:00 | FromGitter | <Varriount> Well, cstring's aren't tracked by the garbage collector. Normally you store your string data as a string, and then use cstring(var) when passing it into a C procedure. |
04:34:17 | FromGitter | <Varriount> Interesting, so you're creating your user interface using SDL and OpenGL? |
04:34:39 | captainkraft | Yes |
04:35:23 | FromGitter | <Varriount> Any particular reason? |
04:35:52 | captainkraft | I like the imgui paradigm. |
04:38:20 | captainkraft | Why do you ask? |
04:39:16 | FromGitter | <Varriount> captainkraft: It's just interesting to see the various design decisions people make. |
04:39:47 | FromGitter | <Varriount> I have an interest in the design-aspect of programs |
04:40:00 | captainkraft | Are you familiar with imgui? There is a semi-populare C++ lib called Dear imgui. The one I'm using is in C and it's called Nuklear. |
04:43:03 | FromGitter | <Varriount> I've heard of it. |
04:43:24 | FromGitter | <Varriount> The biggest GUI library I've used is Qt (although that was with Python). |
04:43:45 | FromGitter | <Varriount> I keep meaning to explore the QML wrapper someone made for Nim |
04:44:54 | * | yglukhov joined #nim |
04:49:19 | * | yglukhov quit (Ping timeout: 252 seconds) |
05:19:24 | * | Snircle joined #nim |
05:27:16 | GitDisc | <GooRoo> I also have a strong passion for design aspect of software |
05:27:35 | GitDisc | <GooRoo> Or rather for UX stuff |
05:28:45 | * | vlad1777d joined #nim |
05:28:47 | GitDisc | <GooRoo> Since I know QML, can't convince myself to use anything else for GUI |
05:29:05 | * | skrylar joined #nim |
05:29:12 | skrylar | skub. |
05:29:12 | FromGitter | <Varriount> GooRoo: Well, by design I mean the design of a program. |
05:29:49 | FromGitter | <Varriount> GooRoo: For example, I enjoy reading about all the parts of an operating system. |
05:30:11 | GitDisc | <GooRoo> Have you ever seen Haiku OS |
05:30:13 | GitDisc | <GooRoo> ? |
05:30:36 | GitDisc | <GooRoo> Really like its API |
05:36:46 | hogeland | hm, i'll have to catch araq's next stream |
05:37:26 | hogeland | i'm watching the (linked earlier) "random bugfixing" vod and it's interesting watching his dev/test process |
05:39:01 | GitDisc | <GooRoo> @Varriount by UX I meant ease of use of smth |
05:39:15 | GitDisc | <GooRoo> And "handiness" |
05:39:42 | GitDisc | <GooRoo> It can be applied to everything. It's not about UI |
05:39:51 | GitDisc | <GooRoo> Not only |
05:41:22 | GitDisc | <GooRoo> Some library can also have bad UX if its API is not convenient |
05:44:47 | FromGitter | <citycide> @Araq, @dom96: ICYMI #6473 (https://github.com/nim-lang/Nim/pull/6473) for `removePrefix` was updated to the latest feedback, let me know if there's anything else. would also be cool to hear thoughts on the other proposal in there about having both composable & in-place `strip` variants |
05:52:44 | FromGitter | <mdehavensift> Hi, I've got a question about development using Nim. Is something equivalent to virtualenv for python, where a person can create different environments with different packages installed? |
05:54:53 | FromGitter | <citycide> @mdehavensift I'm only aware of choosenim (https://github.com/dom96/choosenim) but that's only for Nim / Nimble. not sure there's something for packages |
05:54:59 | FromGitter | <exts> does anyone know why lua's `print` gets called last to stdout even though nim's `echo` is the last thing being called from within nim? eyes are getting droopy so I'm taking a break from googling c++ articles on how this lib works https://gist.github.com/exts/2209af478f006cc320116f080f0ab746 |
05:57:20 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
05:59:39 | * | yglukhov joined #nim |
06:00:52 | FromGitter | <mdehavensift> Thanks, @citycide. I was looking at choosenim, and my understanding of it was what you said - for different versions of Nim/Nimble, not packages. I just wanted to make sure I wasn't missing something. |
06:04:06 | * | yglukhov quit (Ping timeout: 246 seconds) |
06:06:10 | FromGitter | <exts> works if i make a print alias which calls nim's `echo` though, strange. |
06:25:15 | * | miran joined #nim |
06:27:35 | FromGitter | <mratsim> @exts maybe lua run in a different thread? Try to put Nim to sleep to confirm |
06:31:24 | FromGitter | <mratsim> Btw, regarding design, what's the proper way to do a game loop/polling (say while true) that waits for events and doesn't use 100% CPU doing nothing on the main screen of a game |
07:08:51 | * | yglukhov joined #nim |
07:09:19 | * | Arrrr joined #nim |
07:09:19 | * | Arrrr quit (Changing host) |
07:09:19 | * | Arrrr joined #nim |
07:13:05 | * | yglukhov quit (Ping timeout: 240 seconds) |
07:13:58 | * | tdc joined #nim |
07:24:47 | * | smt` joined #nim |
07:27:49 | * | smt quit (Ping timeout: 258 seconds) |
07:29:26 | hogeland | @mratsim Use a framework that has figured it out already (like sdl or sfml). If you're trying to do this totally from scratch, depends on the context. There's xlib's XNextEvent, conio.h's kbhit, getch. Generally any library that handles input will give you a blocking nextEvent() function of some kind that you can just put in a while true. |
07:31:14 | hogeland | But at some level, there's gotta be some code in a tight loop. ¯\_(ツ)_/¯ |
07:32:21 | FromGitter | <mratsim> Well it’s not for me, but most of the games I play that uses Unity max CPU during main screen … (and it’s card games like Solforge or Eternal with almost no animation during main screen) |
07:34:00 | hogeland | That's probably people being bad and busy waiting... |
07:35:05 | hogeland | Just putting a 1ms sleep is enough to let the CPU spend cycles on other things |
07:36:14 | * | rauss quit (Read error: Connection reset by peer) |
07:37:24 | * | rauss joined #nim |
07:45:37 | * | vlad1777d quit (Ping timeout: 248 seconds) |
07:51:35 | * | rauss quit (Read error: Connection reset by peer) |
07:52:25 | * | skrylar quit (Remote host closed the connection) |
07:52:42 | Arrrr | https://gafferongames.com/post/fix_your_timestep/ |
07:53:33 | * | rauss joined #nim |
08:04:12 | miran | Arrrr: oooh, numerical integration, something i do for work currently :) |
08:04:52 | miran | currently = for most part of this year |
08:05:48 | * | claudiuinberlin joined #nim |
08:18:56 | * | Viktor joined #nim |
08:18:58 | * | Viktor quit (Client Quit) |
08:23:30 | * | gokr joined #nim |
08:25:08 | * | MyMind quit (Ping timeout: 240 seconds) |
08:25:27 | * | Pisuke joined #nim |
08:33:29 | * | yglukhov joined #nim |
08:38:07 | * | yglukhov quit (Ping timeout: 260 seconds) |
08:43:42 | * | Vladar joined #nim |
08:47:15 | * | couven92 joined #nim |
08:57:37 | * | yglukhov joined #nim |
08:58:15 | FromGitter | <mratsim> it’s been like 10 years since I saw Runge Kutta equations |
09:03:16 | * | aziz_ joined #nim |
09:06:49 | * | Arrrr quit (Disconnected by services) |
09:06:49 | * | Arrrr1 joined #nim |
09:06:54 | * | Arrrr1 quit (Client Quit) |
09:20:05 | * | Trustable joined #nim |
09:27:46 | * | aziz_ quit (Quit: Ex-Chat) |
09:35:00 | miran | mratsim - it's been like 10 hours for me :D |
09:45:14 | FromGitter | <data-man> @Araq: Thanks for merging! ⏎ Maybe add the TinyC repository as a git submodule? ⏎ I don't really know if github allows to connect to a repository from other sites. |
09:46:20 | * | ibutra joined #nim |
09:46:51 | FromGitter | <data-man> Oh, I'm sorry. Good day to all! |
09:52:31 | * | ibutra quit (Quit: My iMac has gone to sleep. ZZZzzz…) |
10:26:26 | * | claudiuinberlin quit (Read error: Connection reset by peer) |
10:37:45 | * | elrood joined #nim |
10:50:53 | * | nsf joined #nim |
11:01:23 | * | dddddd joined #nim |
11:02:20 | * | Snircle joined #nim |
11:30:28 | * | gokr quit (Ping timeout: 258 seconds) |
11:33:19 | * | nitely quit (Ping timeout: 248 seconds) |
11:36:35 | dom96 | For those of you still missing a Nim in Action ebook, you can get 50% with HalloweenEB50 :) |
11:36:54 | * | vlad1777d joined #nim |
11:37:54 | FromGitter | <exts> @mratsim to be completely honest, I don't know enough about threads to know what im looking for when putting nim to sleep |
11:42:28 | GitDisc | <GooRoo> @dom96 what software did you use in order to write the book? |
11:43:15 | dom96 | asciddoc + asciidoctor |
11:43:49 | GitDisc | <GooRoo> I'm wondering how code listings with explanations are made |
11:44:06 | * | PMunch joined #nim |
11:44:08 | GitDisc | <GooRoo> 'cause I really like it |
11:45:04 | dom96 | https://raw.githubusercontent.com/nim-lang/website/master/jekyll/_posts/2017-10-02-documenting-profiling-and-debugging-nim-code.adoc |
11:45:07 | dom96 | Here is an example |
11:45:17 | dom96 | For this guide: https://nim-lang.org/blog/2017/10/02/documenting-profiling-and-debugging-nim-code.html |
11:45:18 | GitDisc | <GooRoo> never heard about asciidoc, thanks for reference |
11:47:04 | PMunch | Hmm, is there a reason why there is no way to call a template or macro from a macro? Like if I'm parsing through the various nodes and find a call to a template or macro it would be useful if I was able to call it and get the AST from it instead. This would allow many more macros to have the possibility of working properly with other templates and macros. |
11:47:45 | GitDisc | <GooRoo> @dom96 nice! why not LaTeX btw? |
11:48:01 | dom96 | My publisher didn't offer that option |
11:48:07 | dom96 | But that sounds like it would be a pain |
11:48:21 | PMunch | What? LaTeX is great :) |
11:48:37 | GitDisc | <GooRoo> No, it's not |
11:48:48 | dom96 | I don't want to be thinking about layout too much when writing |
11:48:57 | dom96 | Manning worries about that :) |
11:49:11 | PMunch | Eh, fair enough |
11:49:46 | GitDisc | <GooRoo> once I decided to write a book. And in order to do that I decided to learn LaTeX first. Well... the end of story |
11:49:54 | PMunch | An example of where calling templates and macros from within a macro would be helpful is in solving this: https://github.com/dom96/jester/issues/34 |
11:50:00 | miran | PMunch: latex is great, but for stuff like this, it might be more trouble than help |
11:50:52 | PMunch | miran, yeah. I've used it extensively for writing my papers and such in university. But for something where you don't have full control over the output medium I can see why it would be a pain |
11:50:54 | dom96 | PMunch: That's something you need to ask Araq for I guess |
11:51:05 | miran | i've heard some nice stuff about asciidoc, but have never tried it myself - it is either markdown (for simple stuff) or latex for me |
11:52:32 | PMunch | dom96, yeah I guess. I did try to get something working with a combination of getAst and expandMacros, but best I could get was it executing in the scope of the macro definition. |
11:52:59 | dom96 | asciidoc is actually very nice. There are some rough edges though. |
11:53:16 | PMunch | That obviously didn't work for Jester as you include the route macro from another module which doesn't know about templates you've defined yourself |
11:53:17 | dom96 | For example, try writing "C++" in an asciidoc document and you will hit a rough edge :) |
11:53:52 | PMunch | Yeah, all of the markdown variants have some trouble when you start writing things with symbols in them :P |
11:54:06 | dom96 | I bet Araq would never let me do this, but I would love to allow asciidoc in nim doc comments. |
11:54:26 | * | smt_ joined #nim |
11:55:38 | GitDisc | <GooRoo> @PMunch on the other hand MS Word doesn't have these problems lol |
11:56:57 | PMunch | GooRoo, yeah. Neither does paper.. |
11:57:11 | PMunch | Or cave painting |
11:57:31 | miran | :D |
11:58:25 | * | smt` quit (Ping timeout: 255 seconds) |
11:58:29 | GitDisc | <GooRoo> and it's still quite popular in prisons |
11:59:51 | PMunch | dom96, is there something that's not working with --app:lib for Mac? |
11:59:59 | dom96 | no idea |
12:00:01 | dom96 | never used it |
12:00:04 | PMunch | Hmm |
12:00:09 | PMunch | https://github.com/h3rald/min/issues/6#issuecomment-340181731 |
12:00:23 | PMunch | He's having some trouble getting a dylib to load on Mac |
12:01:14 | * | nsf quit (Quit: WeeChat 1.9) |
12:01:57 | dom96 | Wish I could help, gonna have to delegate to Araq again :) |
12:02:09 | * | nsf joined #nim |
12:04:56 | FromGitter | <exts> man that's strange, seems like all the stdout messages from embedding lua gets called last, but everything else runs in the correct order. |
12:06:55 | GitDisc | <awr> why does echo() emit the contents of a seq but not an array? |
12:09:18 | * | PMunch quit (Quit: leaving) |
12:13:52 | GitDisc | <awr> i dont understand why system.nim does not define stringify operator for arrays |
12:16:21 | GitDisc | <awr> [1, 2, 3].mapit($it).join(", ") seems to work |
12:19:33 | GitDisc | <GooRoo> maybe I'd like to use space as a delimeter |
12:19:49 | * | obadz quit (Quit: WeeChat 1.9.1) |
12:20:18 | GitDisc | <awr> well seqs use ", " as a delimiter |
12:21:49 | GitDisc | <GooRoo> hmm |
12:22:03 | GitDisc | <GooRoo> then you can use $(@arr) |
12:23:16 | GitDisc | <awr> i mean technically that works too |
12:24:06 | GitDisc | <GooRoo> yep, a little bit inconsistent |
12:24:25 | GitDisc | <awr> but $ not being defined for arrays seems unusual to me |
12:26:08 | * | obadz joined #nim |
12:29:57 | GitDisc | <GooRoo> if I suggest you to create a proposal on GitHub, Araq or dom96 will appear in the chat and tell that it's either already reported as an issue or it's planned or it won't be ever implemented |
12:31:03 | GitDisc | <GooRoo> I have rather a philosophical question. |
12:31:04 | GitDisc | <GooRoo> Let's imagine I have a sockets library, say, asyncnet. It assumes some implicit invariants. For instance, I have to call `bindAddr()` before `listen()` for a socket. Is there any way to check this invariant in compile time? As a developer of a library, how can I restrict it? Does Nim provide some mechanisms that can help me with this? |
12:37:49 | FromGitter | <mratsim> @PMunch you can call a macro/template from another macro with getAST |
12:39:31 | FromGitter | <Yardanico> awr: it does |
12:39:37 | FromGitter | <Yardanico> there's $ for arrays in devel |
12:39:39 | FromGitter | <Yardanico> but not in 0.17.2 |
12:40:17 | FromGitter | <mratsim> @Pmunch example, this macro https://github.com/mratsim/Arraymancer/blob/8db1ce895070e91378a566f5410245775efeb255/src/tensor/accessors_macros_read.nim#L72 calls this one, https://github.com/mratsim/Arraymancer/blob/master/src/tensor/private/p_accessors_macros_desugar.nim#L27 |
12:41:06 | GitDisc | <Yardanico> @awr it's defined for arrays in devel |
12:41:13 | FromGitter | <mratsim> @exts try with os.sleep: https://nim-lang.org/docs/os.html#sleep,int |
12:41:15 | GitDisc | <Yardanico> but this change was made after 0.17.2 |
12:41:54 | GitDisc | <Yardanico> so it only will be in 0.18.0 (1.0 release candidate 1 IIRC) |
12:42:03 | GitDisc | <awr> oh ok! |
12:42:11 | GitDisc | <awr> thanks |
12:43:24 | GitDisc | <Yardanico> you can still use devel version of the compiler |
12:43:37 | GitDisc | <Yardanico> choosenim supports nim devel too |
12:59:11 | FromGitter | <exts> @mratsim yeah I called os.sleep and lua's stdout still called at the end. I even tested w/ lua's io.read() and it read fine from the cmd line, but the message to stdout called after anyways lol io.write and print for w/e reason gets called last when i embed lua in nim, but everything else gets called in the order that I load the lua script even my nim procs that i registered inside lua O_o |
13:00:49 | FromGitter | <exts> @dom96 does the discardable pragma not work? Found #5374 |
13:03:59 | FromGitter | <exts> hmm, nvm. strange was just giving me a compile error now it's working w/ void procs |
13:05:15 | FromGitter | <exts> ignore that :) |
13:45:01 | FromGitter | <Yardanico> lol |
13:45:02 | FromGitter | <Yardanico> https://github.com/AdamNiederer/base100/ |
13:56:17 | * | cspar_ joined #nim |
13:59:12 | * | cspar quit (Ping timeout: 258 seconds) |
14:02:44 | * | cspar joined #nim |
14:03:43 | * | cspar_ quit (Ping timeout: 248 seconds) |
14:13:54 | FromGitter | <mratsim> =} |
14:20:19 | FromGitter | <data-man> @Yardanico: Don't want to port this to Nim? :) |
14:29:32 | FromGitter | <data-man> Oh, Travis CI, my brain can be dislocated... |
14:35:59 | FromGitter | <Yardanico> @data-man maaybe |
14:47:45 | * | cspar_ joined #nim |
14:49:05 | * | cspar quit (Ping timeout: 240 seconds) |
14:50:27 | * | dddddd quit (Remote host closed the connection) |
15:21:46 | livcd | not sure if someone mentioned it already |
15:22:01 | livcd | but you can buy nim in action fr 1/2 the price :3 with the halloween code |
15:22:46 | * | arecaceae quit (Remote host closed the connection) |
15:23:05 | * | arecaceae joined #nim |
15:24:55 | * | smt joined #nim |
15:26:41 | livcd | ah yeah dom mentioned it already |
15:27:29 | * | smt_ quit (Ping timeout: 248 seconds) |
15:32:00 | livcd | dom96: are code snippets readable on Kindle ? |
15:48:57 | * | craigger quit (Ping timeout: 240 seconds) |
15:50:45 | * | Sentreen quit (Ping timeout: 258 seconds) |
15:51:53 | * | craigger joined #nim |
15:55:12 | FromGitter | <Varriount> GooRoo: You might be able to implement such a check using static globals |
15:56:17 | FromGitter | <Varriount> Along with templates, macros, or static blocks in a procedure |
15:57:35 | * | PMunch joined #nim |
16:03:34 | * | Sentreen joined #nim |
16:04:25 | * | enthus1ast- joined #nim |
16:17:39 | * | def-pri-pub joined #nim |
16:18:11 | dom96 | livcd: they should be, otherwise that's a bug that Manning needs to fix |
16:18:14 | enthus1ast- | guys how would you let an asynchttpserver callback access another object? (To archive something like this https://gist.github.com/enthus1ast/f878e3ec23cb9d267ca2b3439ea2bc90 ) it looks like last compiler changes leaves asynchttpserver pretty awkward to use. |
16:18:16 | dom96 | But I don't own a Kindle |
16:18:18 | dom96 | so I can't say |
16:19:15 | dom96 | enthus1ast-: the call back is a closure, can't you capture that var? |
16:20:13 | enthus1ast- | i want to have a html view on an changing object |
16:20:15 | enthus1ast- | mhh |
16:20:28 | livcd | dom96: oh...well they did not for at least 2 books i own :/ |
16:20:41 | dom96 | livcd: then you should complain :) |
16:20:49 | dom96 | and ask for a refund |
16:21:58 | enthus1ast- | dom96: so declare the handler inside an someObj proc? |
16:22:07 | dom96 | no |
16:22:14 | dom96 | import future |
16:22:29 | miran | dom96: i can check how it looks on kindle if you send me .mobi file :P |
16:22:33 | dom96 | waitFor server.serve(Port(8080), (req) => (manageUiCallback(req, someObj)) |
16:22:50 | dom96 | miran: hah, yeah, I can't do that |
16:23:07 | enthus1ast- | thanks dom96 'll try that |
16:23:24 | dom96 | You might have to put your code into a 'main' proc too |
16:24:02 | enthus1ast- | thats the "do" notation right? |
16:24:23 | dom96 | some constructive criticism for Nim here: https://news.ycombinator.com/item?id=15575143 |
16:24:35 | dom96 | enthus1ast-: sure, but I dislike it |
16:39:40 | enthus1ast- | ty again dom96, works fine! |
16:43:24 | GitDisc | <GooRoo> @Varriount sound not really like a clean solution. But I'll think this way more |
16:43:27 | GitDisc | <GooRoo> *sounds |
16:44:51 | FromGitter | <Varriount> GooRoo: it's not foolproof anyway, as you would be limited to the linear path the compiler takes |
16:45:09 | FromGitter | <Varriount> Though, perhaps you could abuse the not nil checker? |
16:47:42 | GitDisc | <GooRoo> Probably it should be possible to split these entities on type level, i.e. to have `Socket` with `proc bindAddr(self: Socket, ...): BoundSocket` and actually `BoundSocket` with `proc listen(self: BoundSocket, ...)` |
16:47:56 | GitDisc | <GooRoo> not really convenient though |
16:55:58 | * | yglukhov quit (Remote host closed the connection) |
17:04:47 | * | Jesin joined #nim |
17:05:06 | * | Jesin quit (Remote host closed the connection) |
17:09:33 | GitDisc | <GooRoo> Perhaps I should stop thinking about this in a haskell way. But I like when a compiler is able to do “smart” things |
17:16:37 | * | vivus joined #nim |
17:23:49 | * | enthus1ast- quit (Quit: Lost terminal) |
17:27:37 | FromGitter | <Varriount> GooRoo: Wouldn't you just have one type that carries the entire state? |
17:28:25 | FromGitter | <Varriount> Or better yet, listen just creates the new socket object/ref |
17:29:51 | dom96 | The best way to solve this is to have a TcpServer type with a simpler API |
17:30:18 | dom96 | I like the Python approach: teach the programmer how the C api looks somewhat |
17:30:25 | livcd | i'd like to hear araq's opinion about the criticism on hn :) |
17:31:06 | * | yglukhov joined #nim |
17:36:38 | captainkraft | What is the simplest way to read a file line-by-line? |
17:44:51 | PMunch | for line in open("myfile.txt"): |
17:45:42 | PMunch | https://rosettacode.org/wiki/Read_a_file_line_by_line#Nim |
17:46:11 | * | PMunch quit (Quit: leaving) |
17:47:14 | FromGitter | <x86128> @dom96 Is any way to use {.async.} await when transpiling to JS with nim compiler? |
17:48:21 | dom96 | afraid not |
17:50:07 | FromGitter | <x86128> it would be great to use webplatform without any js at all:) |
17:50:44 | dom96 | agreed, working async await on JS would be nice |
17:51:55 | vivus | where is the criticism on HN? |
17:51:58 | vivus | link? |
17:54:30 | * | Jesin joined #nim |
17:54:41 | dom96 | vivus: https://news.ycombinator.com/item?id=15575143 |
17:57:12 | vivus | interesting thread. I would guess if you want the flexibility of a dynamic language that is web-supported, static and compiled, Crystal is a better option than Nim right now |
18:02:05 | * | def-pri-pub quit (Quit: Leaving.) |
18:05:22 | * | enthus1ast- joined #nim |
18:07:40 | FromGitter | <exts> mm, crystal. i wish their web frameworks were nicer, time will tell. |
18:11:31 | FromGitter | <alehander42> @dom96 actually I even made a kind of a fork of nim that maintains jsawait / jsasync syntax for js and also something similar to `object[x: Type, y: Type]` similar to typescript-s `{x: Type, y: Type}` annotation, very useful for one-off uses of js api-s ⏎ are there any specific plans to support stuff like this in the language ? |
18:12:06 | * | xet7 quit (Quit: Leaving) |
18:17:17 | * | thomasross joined #nim |
18:17:51 | dom96 | isn't that just a tuple? |
18:21:15 | FromGitter | <alehander42> no! a tuple doesn't work here because the field accesses are compiled to `.FieldN` |
18:21:37 | FromGitter | <alehander42> you pass `{x: 4}` and `.x` doesn't work (in the js target) |
18:22:31 | dom96 | hrm, I don't get it :( |
18:27:02 | FromGitter | <alehander42> ok, you define in your nim code ⏎ ⏎ ```proc a*(b: tuple[x: int]) = ⏎ echo b.x``` [https://gitter.im/nim-lang/Nim?at=59f4cbf6f7299e8f5343ade6] |
18:27:21 | FromGitter | <alehander42> you compile it to js script, and `a` is called by some js code |
18:27:34 | FromGitter | <alehander42> and your goal is to work when it passes `{x: 4}` |
18:27:43 | FromGitter | <alehander42> however the code is compiled to |
18:28:02 | FromGitter | <alehander42> `rawEcho(cstrToNimstr((b_64005.Field0)+""));` |
18:28:12 | FromGitter | <alehander42> not to `b_64005.x ..` |
18:28:24 | FromGitter | <alehander42> so your only two options are: |
18:28:59 | FromGitter | <alehander42> 1) define a special type only for that case : ⏎ ⏎ ```type Ugh = object ⏎ x: int``` [https://gitter.im/nim-lang/Nim?at=59f4cc6bd6c36fca31aab686] |
18:29:03 | dom96 | ahh, this is for exporting Nim functions to other JS code |
18:29:15 | FromGitter | <alehander42> or cast which gets ugly quickly |
18:29:16 | FromGitter | <alehander42> yes |
18:30:28 | FromGitter | <alehander42> not only exporting, it's sometimes useful even if all your code is nim, e.g. in electron you communicate between main and renderer process passing little objects like that and you don't want to define special type each time |
18:31:01 | dom96 | hrm, might be a good idea to create a bug for this |
18:33:04 | FromGitter | <alehander42> ok |
18:43:14 | * | jl joined #nim |
18:45:45 | GitDisc | <JL> hello. I was wondering if there is a good ide to use with nim ? |
18:47:10 | dom96 | Visual Studio Code with a Nim extension is probably best right now |
18:47:29 | GitDisc | <JL> thanks ! |
18:50:13 | * | jl quit (Quit: Page closed) |
19:11:47 | * | def-pri-pub joined #nim |
19:21:50 | * | Vladar quit (Remote host closed the connection) |
19:25:46 | * | def-pri-pub quit (Quit: Leaving.) |
19:30:07 | * | def-pri-pub joined #nim |
19:35:39 | * | def-pri-pub quit (Quit: Leaving.) |
19:38:09 | GitDisc | <JL> also: I want to give the language a try, is there websites and tools to know beside the official one and nim and nimble ? |
19:38:58 | GitDisc | <GooRoo> There is a book |
19:46:13 | * | nicpeckman joined #nim |
19:51:53 | FromGitter | <Varriount> JL: Nim in Action |
19:52:52 | * | dddddd joined #nim |
19:54:50 | * | nicpeckman quit (Quit: leaving) |
19:54:53 | * | def-pri-pub joined #nim |
19:56:04 | * | def-pri-pub quit (Client Quit) |
20:07:58 | GitDisc | <JL> thanks. I will not buy anything for the moment though |
20:11:35 | * | enthus1ast- quit (Ping timeout: 240 seconds) |
20:13:39 | * | enthus1ast- joined #nim |
20:23:22 | * | miran quit (Ping timeout: 260 seconds) |
20:32:01 | * | tdc quit (Ping timeout: 248 seconds) |
20:34:38 | * | Ace_Emerald joined #nim |
20:38:12 | Ace_Emerald | Just started learning nim last week, picked up Nim in Action today because of the sale :) thanks dom96 |
20:38:27 | dom96 | awesome, thanks for picking it up :) |
20:40:46 | * | Jesin quit (Quit: Leaving) |
20:41:52 | dom96 | Araq: Why does merely specifying --threads:on mean that two extra threads are executed? |
20:42:33 | dom96 | oh, it's threadpool doing it |
20:49:08 | * | nitely joined #nim |
20:58:31 | nitely | Hey y'all! |
20:59:03 | nitely | Quick question, is there something like python's io.TextIOWrapper in nim? |
20:59:13 | FromGitter | <Yardanico> what TextIOWrapper does? |
20:59:46 | FromGitter | <Yardanico> ah, I see |
20:59:52 | FromGitter | <Yardanico> use "streams" module, it's in stdlib |
20:59:53 | nitely | it's a buffered text stream |
20:59:59 | FromGitter | <Yardanico> it has string stream |
21:00:08 | FromGitter | <Yardanico> https://nim-lang.org/docs/streams.html |
21:00:16 | nitely | but will it yield unicode chars? |
21:00:52 | * | gokr joined #nim |
21:00:57 | FromGitter | <Yardanico> what do you mean "yield" ? |
21:01:05 | nitely | i.e runes |
21:01:09 | FromGitter | <Yardanico> no |
21:01:36 | nitely | I mean if I iterate over the stream will I get unicode chars |
21:01:45 | nitely | I see :) |
21:01:51 | FromGitter | <Yardanico> you will get bytes, as usual |
21:01:56 | FromGitter | <Yardanico> well they're also chars |
21:01:58 | FromGitter | <Yardanico> but also bytes :) |
21:02:06 | FromGitter | <Yardanico> and then you can get runes from your string |
21:02:17 | FromGitter | <Yardanico> via unicode module |
21:02:21 | nitely | io.TextIOWrapper will get yield unicode chars |
21:02:48 | FromGitter | <Yardanico> I understand, but you can use streams + unicode in Nim |
21:02:51 | nitely | hum, but how do you know when you have a full unicode char? |
21:03:21 | nitely | right, but AFAIK unicode chars have variable length of bytes |
21:03:49 | FromGitter | <Yardanico> what's your use-case btw? |
21:04:15 | nitely | I'm implementing a regex engine that works on streams |
21:04:55 | dom96 | I think the stdlib is lacking here |
21:05:02 | FromGitter | <Yardanico> you can always implement something like https://github.com/nim-lang/Nim/blob/master/lib/pure/unicode.nim#L42 for string stream |
21:05:20 | dom96 | I think you should implement this for a string stream https://nim-lang.org/docs/unicode.html#runes.i,string |
21:05:25 | dom96 | (or a general stream really) |
21:05:29 | nitely | I'm porting https://github.com/nitely/regexy |
21:05:32 | dom96 | And create a PR :) |
21:06:14 | dom96 | And if you could create a native Nim regex engine I will give you many virtual and real high fives if I ever meet you :D |
21:06:28 | nitely | I'm working on it |
21:06:34 | FromGitter | <Yardanico> well as I said, it's not hard to edit https://github.com/nim-lang/Nim/blob/master/lib/pure/unicode.nim#L42 for a string stream |
21:06:42 | nitely | currently working on the unicode data base |
21:06:53 | dom96 | brilliant! |
21:07:07 | nitely | python's unicodedata basically |
21:07:08 | dom96 | Welcome to #nim btw :) |
21:07:10 | * | rauss quit (Read error: Connection reset by peer) |
21:07:48 | nitely | but I wanted to make sure the textwrapper was not in stdlib before getting into that |
21:07:53 | FromGitter | <Yardanico> dom96: well I want to see a native Nim regex engine created from scratch, and not ported from python :) because every language has its own way of doing thing (mostly performance-wise ) |
21:07:59 | nitely | thanks :) |
21:08:08 | FromGitter | <Yardanico> nitely: nim actually doesn't have that much common with python except indentation and "import" |
21:08:20 | nitely | Ah, won't be a port |
21:08:20 | FromGitter | <Yardanico> and maybe if statements |
21:08:28 | FromGitter | <Yardanico> nitely: well it's still fine |
21:08:29 | FromGitter | <Varriount> @Gooseus Do you have the AWS v4 signing code? Could I take a look? |
21:08:33 | nitely | but it will be based on that one, since I made it |
21:08:45 | dom96 | I'm sure nitely is knowledgeable enough to apply the correct optimisations for Nim. |
21:08:46 | * | rauss joined #nim |
21:09:09 | FromGitter | <Varriount> Just don't let the strings bite. :D |
21:09:19 | nitely | I just bought your book btw. Thanks for the discount headsup |
21:09:33 | dom96 | yay, thanks for buying a copy :) |
21:12:21 | FromGitter | <Yardanico> nitely: for example: in nim you usually use object variants for different AST node types :) |
21:12:32 | FromGitter | <Yardanico> it's more efficient than object inheritance |
21:16:07 | dom96 | Bah, benchmarking is so difficult |
21:17:37 | FromGitter | <Yardanico> use nimbench :P |
21:20:58 | nitely | @Yardanico, thanks for the tip |
21:21:32 | nitely | I've read OOP is not the best way to do things in nim (performance-wise) |
21:21:42 | FromGitter | <Yardanico> well it's not for nim |
21:21:53 | FromGitter | <Yardanico> I mean pure objects are almost always faster than OOP |
21:22:24 | FromGitter | <Yardanico> nim's objects are compiled to C structs |
21:23:37 | nitely | Yeah, I saw that |
21:23:43 | * | salewski joined #nim |
21:24:38 | * | gokr quit (Ping timeout: 258 seconds) |
21:24:57 | FromGitter | <Yardanico> because for classes and methods you need runtime dispatch |
21:25:02 | salewski | We have pop() for removing and returning the last el of a seq. Do we already have a shift for first element? Maybe with different name? |
21:25:07 | nitely | I'm still in the face where I check what C code gets generated |
21:25:56 | nitely | *face <-> phase |
21:26:02 | FromGitter | <Yardanico> why? |
21:26:03 | FromGitter | <Yardanico> ah, ok |
21:26:11 | FromGitter | <Yardanico> but you rarely need that really |
21:26:25 | FromGitter | <Yardanico> it's only needed if you hit some codegen bugs/slow performance |
21:26:49 | nitely | still making sure I'm not doing something stupid :P |
21:27:05 | FromGitter | <Yardanico> well still |
21:27:05 | salewski | Will read your answers tomorrow in logs, bye. |
21:27:13 | * | salewski quit (Client Quit) |
21:27:25 | FromGitter | <Yardanico> you wouldn't check compiled python bytecode from python code ? :) |
21:28:13 | nitely | ahaha I probably wouldn't |
21:29:03 | FromGitter | <Yardanico> as I said, it's rarely needed until you really want the highest performance possible. I think you should firstly port your python project without bothering with performance too much and then start optimizing it :) |
21:29:48 | FromGitter | <Yardanico> or you would need to look at C code if you hit a codegen bug :D |
21:29:54 | FromGitter | <Yardanico> (to report it) |
21:30:53 | nitely | got it. Make it work, make it fast, make it pretty :D |
21:38:08 | * | gokr joined #nim |
21:42:41 | FromGitter | <mratsim> Basically if you absolutely need inheritance you can but usually composition + generics + overloading can get you very far |
21:43:53 | FromGitter | <mratsim> So far I’ve needed inheritance only for a collection of heterogeneous types |
21:50:43 | dom96 | I usually use object variants for that use case :) |
21:53:51 | FromGitter | <mratsim> In my case it should be user extensible :) |
21:59:40 | * | HoloIRCUser1 joined #nim |
22:16:48 | * | kunev quit (Ping timeout: 240 seconds) |
22:19:24 | * | kunev joined #nim |
22:36:37 | * | Trustable quit (Remote host closed the connection) |
22:42:27 | * | gokr quit (Ping timeout: 240 seconds) |
22:42:56 | FromGitter | <Gooseus> @Varriount this is what I got so far - https://gist.github.com/Gooseus/460ccc1b7d4551d7beba75ffc286cef1 |
22:45:37 | FromGitter | <Gooseus> got a sigv4 module that will do some signing methods... api is still kind of a mess and think there isa better way to do a bunch of it |
22:48:07 | FromGitter | <Gooseus> the awscore module just implements a generic aws_request proc that takes the credentials/scope/request params and returns the AsyncResponse future which is a first pass at that core function that you can plug a generated API into and the s3_request is the example that I got working... haven't tried anything but an s3 get though |
22:49:39 | FromGitter | <Varriount> Hey, if we can get basic API calls working, that would be solid |
22:49:42 | FromGitter | <Gooseus> also, haven't tested the sigv4 on more complicated requests that have query string parameters, multiple headers with the same name or non-empty payloads |
22:51:29 | FromGitter | <Gooseus> yeah, it's a start... ideally what do you think the core API would look like? think it should follow the boto3 model? |
22:54:35 | * | elrood quit (Remote host closed the connection) |
23:10:39 | FromGitter | <Gooseus> @Varriount simple change for the s3 object PUT with a payload works, so that means I think I should be able to make use of some nim code at my job |
23:21:52 | * | enthus1ast- quit (Ping timeout: 248 seconds) |
23:22:55 | * | enthus1ast- joined #nim |
23:31:20 | * | yglukhov quit (Read error: Connection reset by peer) |
23:36:28 | * | dddddd quit (Ping timeout: 240 seconds) |
23:36:53 | * | nsf quit (Quit: WeeChat 1.9.1) |
23:48:44 | FromGitter | <Gooseus> @Varriount so I think my next exploration is going to be into some nim OO... thoughts on these components, instead of my mess: ⏎ ⏎ 1) AWSClient type that inherits from AsyncHttpClient ⏎ 2) newAWSClient constructor proc that takes the credentials ⏎ 3) request proc overload that takes AWSClient, the scope and the request params [https://gitter.im/nim-lang/Nim?at=59f5175c5a1758ed0f605503] |
23:49:27 | * | dddddd joined #nim |
23:55:29 | * | nitely quit (Ping timeout: 260 seconds) |
23:57:42 | subsetpark | if I want to define a variable with a dynamic name, do I have to use a full macro for that, or can I use a template? |
23:58:59 | FromGitter | <mratsim> @subsetpark template, look for identifier constructor |
23:59:04 | FromGitter | <mratsim> In the manual |
23:59:39 | subsetpark | Great! |