<< 28-10-2017 >>

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:01captainkraftI'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:54captainkraftWhen I make the variable a cstring and pass it to a function using $, it doesn't crash.
03:33:16captainkraftSome sort of lifetime issue?
04:25:53FromGitter<Varriount> captainkraft: Could you post your code?
04:29:21captainkraft 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:00FromGitter<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:17FromGitter<Varriount> Interesting, so you're creating your user interface using SDL and OpenGL?
04:34:39captainkraftYes
04:35:23FromGitter<Varriount> Any particular reason?
04:35:52captainkraftI like the imgui paradigm.
04:38:20captainkraftWhy do you ask?
04:39:16FromGitter<Varriount> captainkraft: It's just interesting to see the various design decisions people make.
04:39:47FromGitter<Varriount> I have an interest in the design-aspect of programs
04:40:00captainkraftAre 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:03FromGitter<Varriount> I've heard of it.
04:43:24FromGitter<Varriount> The biggest GUI library I've used is Qt (although that was with Python).
04:43:45FromGitter<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:16GitDisc<GooRoo> I also have a strong passion for design aspect of software
05:27:35GitDisc<GooRoo> Or rather for UX stuff
05:28:45*vlad1777d joined #nim
05:28:47GitDisc<GooRoo> Since I know QML, can't convince myself to use anything else for GUI
05:29:05*skrylar joined #nim
05:29:12skrylarskub.
05:29:12FromGitter<Varriount> GooRoo: Well, by design I mean the design of a program.
05:29:49FromGitter<Varriount> GooRoo: For example, I enjoy reading about all the parts of an operating system.
05:30:11GitDisc<GooRoo> Have you ever seen Haiku OS
05:30:13GitDisc<GooRoo> ?
05:30:36GitDisc<GooRoo> Really like its API
05:36:46hogelandhm, i'll have to catch araq's next stream
05:37:26hogelandi'm watching the (linked earlier) "random bugfixing" vod and it's interesting watching his dev/test process
05:39:01GitDisc<GooRoo> @Varriount by UX I meant ease of use of smth
05:39:15GitDisc<GooRoo> And "handiness"
05:39:42GitDisc<GooRoo> It can be applied to everything. It's not about UI
05:39:51GitDisc<GooRoo> Not only
05:41:22GitDisc<GooRoo> Some library can also have bad UX if its API is not convenient
05:44:47FromGitter<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:44FromGitter<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:53FromGitter<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:59FromGitter<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:52FromGitter<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:10FromGitter<exts> works if i make a print alias which calls nim's `echo` though, strange.
06:25:15*miran joined #nim
06:27:35FromGitter<mratsim> @exts maybe lua run in a different thread? Try to put Nim to sleep to confirm
06:31:24FromGitter<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:26hogeland@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:14hogelandBut at some level, there's gotta be some code in a tight loop. ¯\_(ツ)_/¯
07:32:21FromGitter<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:00hogelandThat's probably people being bad and busy waiting...
07:35:05hogelandJust 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:42Arrrrhttps://gafferongames.com/post/fix_your_timestep/
07:53:33*rauss joined #nim
08:04:12miranArrrr: oooh, numerical integration, something i do for work currently :)
08:04:52mirancurrently = 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:15FromGitter<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:00miranmratsim - it's been like 10 hours for me :D
09:45:14FromGitter<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:51FromGitter<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:35dom96For those of you still missing a Nim in Action ebook, you can get 50% with HalloweenEB50 :)
11:36:54*vlad1777d joined #nim
11:37:54FromGitter<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:28GitDisc<GooRoo> @dom96 what software did you use in order to write the book?
11:43:15dom96asciddoc + asciidoctor
11:43:49GitDisc<GooRoo> I'm wondering how code listings with explanations are made
11:44:06*PMunch joined #nim
11:44:08GitDisc<GooRoo> 'cause I really like it
11:45:04dom96https://raw.githubusercontent.com/nim-lang/website/master/jekyll/_posts/2017-10-02-documenting-profiling-and-debugging-nim-code.adoc
11:45:07dom96Here is an example
11:45:17dom96For this guide: https://nim-lang.org/blog/2017/10/02/documenting-profiling-and-debugging-nim-code.html
11:45:18GitDisc<GooRoo> never heard about asciidoc, thanks for reference
11:47:04PMunchHmm, 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:45GitDisc<GooRoo> @dom96 nice! why not LaTeX btw?
11:48:01dom96My publisher didn't offer that option
11:48:07dom96But that sounds like it would be a pain
11:48:21PMunchWhat? LaTeX is great :)
11:48:37GitDisc<GooRoo> No, it's not 
11:48:48dom96I don't want to be thinking about layout too much when writing
11:48:57dom96Manning worries about that :)
11:49:11PMunchEh, fair enough
11:49:46GitDisc<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:54PMunchAn 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:00miranPMunch: latex is great, but for stuff like this, it might be more trouble than help
11:50:52PMunchmiran, 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:54dom96PMunch: That's something you need to ask Araq for I guess
11:51:05mirani'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:32PMunchdom96, 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:59dom96asciidoc is actually very nice. There are some rough edges though.
11:53:16PMunchThat 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:17dom96For example, try writing "C++" in an asciidoc document and you will hit a rough edge :)
11:53:52PMunchYeah, all of the markdown variants have some trouble when you start writing things with symbols in them :P
11:54:06dom96I 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:38GitDisc<GooRoo> @PMunch on the other hand MS Word doesn't have these problems lol
11:56:57PMunchGooRoo, yeah. Neither does paper..
11:57:11PMunchOr cave painting
11:57:31miran:D
11:58:25*smt` quit (Ping timeout: 255 seconds)
11:58:29GitDisc<GooRoo> and it's still quite popular in prisons
11:59:51PMunchdom96, is there something that's not working with --app:lib for Mac?
11:59:59dom96no idea
12:00:01dom96never used it
12:00:04PMunchHmm
12:00:09PMunchhttps://github.com/h3rald/min/issues/6#issuecomment-340181731
12:00:23PMunchHe's having some trouble getting a dylib to load on Mac
12:01:14*nsf quit (Quit: WeeChat 1.9)
12:01:57dom96Wish I could help, gonna have to delegate to Araq again :)
12:02:09*nsf joined #nim
12:04:56FromGitter<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:55GitDisc<awr> why does echo() emit the contents of a seq but not an array?
12:09:18*PMunch quit (Quit: leaving)
12:13:52GitDisc<awr> i dont understand why system.nim does not define stringify operator for arrays
12:16:21GitDisc<awr> [1, 2, 3].mapit($it).join(", ") seems to work
12:19:33GitDisc<GooRoo> maybe I'd like to use space as a delimeter
12:19:49*obadz quit (Quit: WeeChat 1.9.1)
12:20:18GitDisc<awr> well seqs use ", " as a delimiter
12:21:49GitDisc<GooRoo> hmm
12:22:03GitDisc<GooRoo> then you can use $(@arr) 
12:23:16GitDisc<awr> i mean technically that works too
12:24:06GitDisc<GooRoo> yep, a little bit inconsistent
12:24:25GitDisc<awr> but $ not being defined for arrays seems unusual to me
12:26:08*obadz joined #nim
12:29:57GitDisc<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:03GitDisc<GooRoo> I have rather a philosophical question.
12:31:04GitDisc<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:49FromGitter<mratsim> @PMunch you can call a macro/template from another macro with getAST
12:39:31FromGitter<Yardanico> awr: it does
12:39:37FromGitter<Yardanico> there's $ for arrays in devel
12:39:39FromGitter<Yardanico> but not in 0.17.2
12:40:17FromGitter<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:06GitDisc<Yardanico> @awr it's defined for arrays in devel
12:41:13FromGitter<mratsim> @exts try with os.sleep: https://nim-lang.org/docs/os.html#sleep,int
12:41:15GitDisc<Yardanico> but this change was made after 0.17.2
12:41:54GitDisc<Yardanico> so it only will be in 0.18.0 (1.0 release candidate 1 IIRC)
12:42:03GitDisc<awr> oh ok!
12:42:11GitDisc<awr> thanks
12:43:24GitDisc<Yardanico> you can still use devel version of the compiler
12:43:37GitDisc<Yardanico> choosenim supports nim devel too
12:59:11FromGitter<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:49FromGitter<exts> @dom96 does the discardable pragma not work? Found #5374
13:03:59FromGitter<exts> hmm, nvm. strange was just giving me a compile error now it's working w/ void procs
13:05:15FromGitter<exts> ignore that :)
13:45:01FromGitter<Yardanico> lol
13:45:02FromGitter<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:54FromGitter<mratsim> =}
14:20:19FromGitter<data-man> @Yardanico: Don't want to port this to Nim? :)
14:29:32FromGitter<data-man> Oh, Travis CI, my brain can be dislocated...
14:35:59FromGitter<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:46livcdnot sure if someone mentioned it already
15:22:01livcdbut 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:41livcdah yeah dom mentioned it already
15:27:29*smt_ quit (Ping timeout: 248 seconds)
15:32:00livcddom96: 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:12FromGitter<Varriount> GooRoo: You might be able to implement such a check using static globals
15:56:17FromGitter<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:11dom96livcd: they should be, otherwise that's a bug that Manning needs to fix
16:18:14enthus1ast-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:16dom96But I don't own a Kindle
16:18:18dom96so I can't say
16:19:15dom96enthus1ast-: the call back is a closure, can't you capture that var?
16:20:13enthus1ast-i want to have a html view on an changing object
16:20:15enthus1ast-mhh
16:20:28livcddom96: oh...well they did not for at least 2 books i own :/
16:20:41dom96livcd: then you should complain :)
16:20:49dom96and ask for a refund
16:21:58enthus1ast-dom96: so declare the handler inside an someObj proc?
16:22:07dom96no
16:22:14dom96import future
16:22:29mirandom96: i can check how it looks on kindle if you send me .mobi file :P
16:22:33dom96waitFor server.serve(Port(8080), (req) => (manageUiCallback(req, someObj))
16:22:50dom96miran: hah, yeah, I can't do that
16:23:07enthus1ast-thanks dom96 'll try that
16:23:24dom96You might have to put your code into a 'main' proc too
16:24:02enthus1ast-thats the "do" notation right?
16:24:23dom96some constructive criticism for Nim here: https://news.ycombinator.com/item?id=15575143
16:24:35dom96enthus1ast-: sure, but I dislike it
16:39:40enthus1ast-ty again dom96, works fine!
16:43:24GitDisc<GooRoo> @Varriount sound not really like a clean solution. But I'll think this way more
16:43:27GitDisc<GooRoo> *sounds
16:44:51FromGitter<Varriount> GooRoo: it's not foolproof anyway, as you would be limited to the linear path the compiler takes
16:45:09FromGitter<Varriount> Though, perhaps you could abuse the not nil checker?
16:47:42GitDisc<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:56GitDisc<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:33GitDisc<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:37FromGitter<Varriount> GooRoo: Wouldn't you just have one type that carries the entire state?
17:28:25FromGitter<Varriount> Or better yet, listen just creates the new socket object/ref
17:29:51dom96The best way to solve this is to have a TcpServer type with a simpler API
17:30:18dom96I like the Python approach: teach the programmer how the C api looks somewhat
17:30:25livcdi'd like to hear araq's opinion about the criticism on hn :)
17:31:06*yglukhov joined #nim
17:36:38captainkraftWhat is the simplest way to read a file line-by-line?
17:44:51PMunchfor line in open("myfile.txt"):
17:45:42PMunchhttps://rosettacode.org/wiki/Read_a_file_line_by_line#Nim
17:46:11*PMunch quit (Quit: leaving)
17:47:14FromGitter<x86128> @dom96 Is any way to use {.async.} await when transpiling to JS with nim compiler?
17:48:21dom96afraid not
17:50:07FromGitter<x86128> it would be great to use webplatform without any js at all:)
17:50:44dom96agreed, working async await on JS would be nice
17:51:55vivuswhere is the criticism on HN?
17:51:58vivuslink?
17:54:30*Jesin joined #nim
17:54:41dom96vivus: https://news.ycombinator.com/item?id=15575143
17:57:12vivusinteresting 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:40FromGitter<exts> mm, crystal. i wish their web frameworks were nicer, time will tell.
18:11:31FromGitter<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:51dom96isn't that just a tuple?
18:21:15FromGitter<alehander42> no! a tuple doesn't work here because the field accesses are compiled to `.FieldN`
18:21:37FromGitter<alehander42> you pass `{x: 4}` and `.x` doesn't work (in the js target)
18:22:31dom96hrm, I don't get it :(
18:27:02FromGitter<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:21FromGitter<alehander42> you compile it to js script, and `a` is called by some js code
18:27:34FromGitter<alehander42> and your goal is to work when it passes `{x: 4}`
18:27:43FromGitter<alehander42> however the code is compiled to
18:28:02FromGitter<alehander42> `rawEcho(cstrToNimstr((b_64005.Field0)+""));`
18:28:12FromGitter<alehander42> not to `b_64005.x ..`
18:28:24FromGitter<alehander42> so your only two options are:
18:28:59FromGitter<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:03dom96ahh, this is for exporting Nim functions to other JS code
18:29:15FromGitter<alehander42> or cast which gets ugly quickly
18:29:16FromGitter<alehander42> yes
18:30:28FromGitter<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:01dom96hrm, might be a good idea to create a bug for this
18:33:04FromGitter<alehander42> ok
18:43:14*jl joined #nim
18:45:45GitDisc<JL> hello. I was wondering if there is a good ide to use with nim ?
18:47:10dom96Visual Studio Code with a Nim extension is probably best right now
18:47:29GitDisc<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:09GitDisc<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:58GitDisc<GooRoo> There is a book
19:46:13*nicpeckman joined #nim
19:51:53FromGitter<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:58GitDisc<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:12Ace_EmeraldJust started learning nim last week, picked up Nim in Action today because of the sale :) thanks dom96
20:38:27dom96awesome, thanks for picking it up :)
20:40:46*Jesin quit (Quit: Leaving)
20:41:52dom96Araq: Why does merely specifying --threads:on mean that two extra threads are executed?
20:42:33dom96oh, it's threadpool doing it
20:49:08*nitely joined #nim
20:58:31nitelyHey y'all!
20:59:03nitelyQuick question, is there something like python's io.TextIOWrapper in nim?
20:59:13FromGitter<Yardanico> what TextIOWrapper does?
20:59:46FromGitter<Yardanico> ah, I see
20:59:52FromGitter<Yardanico> use "streams" module, it's in stdlib
20:59:53nitelyit's a buffered text stream
20:59:59FromGitter<Yardanico> it has string stream
21:00:08FromGitter<Yardanico> https://nim-lang.org/docs/streams.html
21:00:16nitelybut will it yield unicode chars?
21:00:52*gokr joined #nim
21:00:57FromGitter<Yardanico> what do you mean "yield" ?
21:01:05nitelyi.e runes
21:01:09FromGitter<Yardanico> no
21:01:36nitelyI mean if I iterate over the stream will I get unicode chars
21:01:45nitelyI see :)
21:01:51FromGitter<Yardanico> you will get bytes, as usual
21:01:56FromGitter<Yardanico> well they're also chars
21:01:58FromGitter<Yardanico> but also bytes :)
21:02:06FromGitter<Yardanico> and then you can get runes from your string
21:02:17FromGitter<Yardanico> via unicode module
21:02:21nitelyio.TextIOWrapper will get yield unicode chars
21:02:48FromGitter<Yardanico> I understand, but you can use streams + unicode in Nim
21:02:51nitelyhum, but how do you know when you have a full unicode char?
21:03:21nitelyright, but AFAIK unicode chars have variable length of bytes
21:03:49FromGitter<Yardanico> what's your use-case btw?
21:04:15nitelyI'm implementing a regex engine that works on streams
21:04:55dom96I think the stdlib is lacking here
21:05:02FromGitter<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:20dom96I think you should implement this for a string stream https://nim-lang.org/docs/unicode.html#runes.i,string
21:05:25dom96(or a general stream really)
21:05:29nitelyI'm porting https://github.com/nitely/regexy
21:05:32dom96And create a PR :)
21:06:14dom96And 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:28nitelyI'm working on it
21:06:34FromGitter<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:42nitelycurrently working on the unicode data base
21:06:53dom96brilliant!
21:07:07nitelypython's unicodedata basically
21:07:08dom96Welcome to #nim btw :)
21:07:10*rauss quit (Read error: Connection reset by peer)
21:07:48nitelybut I wanted to make sure the textwrapper was not in stdlib before getting into that
21:07:53FromGitter<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:59nitelythanks :)
21:08:08FromGitter<Yardanico> nitely: nim actually doesn't have that much common with python except indentation and "import"
21:08:20nitelyAh, won't be a port
21:08:20FromGitter<Yardanico> and maybe if statements
21:08:28FromGitter<Yardanico> nitely: well it's still fine
21:08:29FromGitter<Varriount> @Gooseus Do you have the AWS v4 signing code? Could I take a look?
21:08:33nitelybut it will be based on that one, since I made it
21:08:45dom96I'm sure nitely is knowledgeable enough to apply the correct optimisations for Nim.
21:08:46*rauss joined #nim
21:09:09FromGitter<Varriount> Just don't let the strings bite. :D
21:09:19nitelyI just bought your book btw. Thanks for the discount headsup
21:09:33dom96yay, thanks for buying a copy :)
21:12:21FromGitter<Yardanico> nitely: for example: in nim you usually use object variants for different AST node types :)
21:12:32FromGitter<Yardanico> it's more efficient than object inheritance
21:16:07dom96Bah, benchmarking is so difficult
21:17:37FromGitter<Yardanico> use nimbench :P
21:20:58nitely@Yardanico, thanks for the tip
21:21:32nitelyI've read OOP is not the best way to do things in nim (performance-wise)
21:21:42FromGitter<Yardanico> well it's not for nim
21:21:53FromGitter<Yardanico> I mean pure objects are almost always faster than OOP
21:22:24FromGitter<Yardanico> nim's objects are compiled to C structs
21:23:37nitelyYeah, I saw that
21:23:43*salewski joined #nim
21:24:38*gokr quit (Ping timeout: 258 seconds)
21:24:57FromGitter<Yardanico> because for classes and methods you need runtime dispatch
21:25:02salewskiWe 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:07nitelyI'm still in the face where I check what C code gets generated
21:25:56nitely*face <-> phase
21:26:02FromGitter<Yardanico> why?
21:26:03FromGitter<Yardanico> ah, ok
21:26:11FromGitter<Yardanico> but you rarely need that really
21:26:25FromGitter<Yardanico> it's only needed if you hit some codegen bugs/slow performance
21:26:49nitelystill making sure I'm not doing something stupid :P
21:27:05FromGitter<Yardanico> well still
21:27:05salewskiWill read your answers tomorrow in logs, bye.
21:27:13*salewski quit (Client Quit)
21:27:25FromGitter<Yardanico> you wouldn't check compiled python bytecode from python code ? :)
21:28:13nitelyahaha I probably wouldn't
21:29:03FromGitter<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:48FromGitter<Yardanico> or you would need to look at C code if you hit a codegen bug :D
21:29:54FromGitter<Yardanico> (to report it)
21:30:53nitelygot it. Make it work, make it fast, make it pretty :D
21:38:08*gokr joined #nim
21:42:41FromGitter<mratsim> Basically if you absolutely need inheritance you can but usually composition + generics + overloading can get you very far
21:43:53FromGitter<mratsim> So far I’ve needed inheritance only for a collection of heterogeneous types
21:50:43dom96I usually use object variants for that use case :)
21:53:51FromGitter<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:56FromGitter<Gooseus> @Varriount this is what I got so far - https://gist.github.com/Gooseus/460ccc1b7d4551d7beba75ffc286cef1
22:45:37FromGitter<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:07FromGitter<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:39FromGitter<Varriount> Hey, if we can get basic API calls working, that would be solid
22:49:42FromGitter<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:29FromGitter<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:39FromGitter<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:44FromGitter<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:42subsetparkif 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:59FromGitter<mratsim> @subsetpark template, look for identifier constructor
23:59:04FromGitter<mratsim> In the manual
23:59:39subsetparkGreat!