<< 13-11-2017 >>

00:01:48bkerinis there a way to iterate over all members of a class?
00:02:03bkerinincluding inherited ones?
00:02:25FromGitter<Varriount> bkerin: https://nim-lang.org/docs/system.html#fields.i,T
00:04:23bkerinthx
00:19:58*couven92 quit (Quit: Client Disconnecting)
00:33:45*skrylar joined #nim
00:38:58*SenasOzys_ joined #nim
00:40:35*SenasOzys_ quit (Remote host closed the connection)
00:40:56*SenasOzys_ joined #nim
00:41:05*SenasOzys quit (Ping timeout: 248 seconds)
00:44:11*jdhorwitz joined #nim
00:47:06skrylarfirebird/ibase headers seem to have this annoying habit of not naming parameters in function calls
00:47:21*bkerin quit (Quit: Confucius say: Many man smoke, but Fu Man Chu.)
00:52:49*vlad1777d_ quit (Ping timeout: 248 seconds)
00:56:22*vlad1777d_ joined #nim
01:03:59*SenasOzys_ quit (Ping timeout: 248 seconds)
01:06:31*vlad1777d_ quit (Ping timeout: 240 seconds)
01:07:37*vlad1777d_ joined #nim
01:10:37jdhorwitzFor a simple REST server are most people using Jester?
01:11:59GitDisc<treeform> Varriount, day can be any length because of daylight savings time and governments moving timezones midday. Most days are 24 hours though.
01:13:17skrylarshould be storing datetime in UTC anyway
01:16:37skrylarhttps://github.com/Skrylar/rfc3339 self horn tooting. implemented one of the RFCs for storing date/time and timezones
01:20:31*jdhorwitz quit (Ping timeout: 248 seconds)
01:38:11*martinium quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
01:42:43*kalkin-- joined #nim
01:43:43*arecaceae quit (Remote host closed the connection)
01:44:31*arecaceae joined #nim
01:46:01*kalkin--- quit (Ping timeout: 240 seconds)
01:46:52skrylarOh. I did confirm, debian/sid's package for nim 0.17 works
01:46:55skrylarNot sure why arch's doesnt
01:47:05skrylar0.17 is also in stretch-backports
01:55:27*jna quit (Quit: leaving)
02:05:48*chemist69 quit (Ping timeout: 240 seconds)
02:14:23*vlad1777d_ quit (Ping timeout: 248 seconds)
02:19:54*chemist69 joined #nim
02:26:09*JappleAck quit (Quit: Leaving)
02:39:11*craigger quit (Ping timeout: 240 seconds)
02:39:48*craigger joined #nim
02:40:03*jdhorwitz joined #nim
02:43:26*vivus quit (Quit: Leaving)
02:43:29*arnetheduck joined #nim
02:45:18skrylarwell. types and consts and enums dealt with. just have to deal with the functions and firebird wrapper is a thing
02:50:19*endragor joined #nim
02:55:32skrylarshould probably formally test that `foo: out cint` is a valid replacement for `int* foo`
03:02:48*chemist69 quit (Ping timeout: 240 seconds)
03:09:41*cspar joined #nim
03:11:28GitDisc<treeform> elrood, I have fixed the issue, thank you for noticing.
03:13:12GitDisc<treeform> wow, skrylar so many people implementing their own time classes in nim.
03:16:46*chemist69 joined #nim
03:20:02GitDisc<treeform> and we are all slightly different
03:27:26*jdhorwitz quit (Ping timeout: 268 seconds)
03:37:08skrylartreeform: i only did it because it was needed for TOML
03:37:20skrylarpeople were wanting a toml parser and thats the date format he used
03:37:22GitDisc<treeform> What is TOML?
03:37:43skrylarhttps://github.com/toml-lang/toml fancy version of INI
03:37:44GitDisc<treeform> the existing times cant parse that?
03:38:15GitDisc<treeform> Looks like standard iso date: 1979-05-27T07:32:00-08:00 ?
03:39:27GitDisc<treeform> its interesting how you parse it in your version
03:40:28GitDisc<treeform> I wrote a very bit fiddly version for mine: https://github.com/treeform/chrono/blob/master/chrono/calendars.nim#L108
03:41:26GitDisc<treeform> I don't call parseInt, I just bit add up their ascii value
03:45:37*rauss quit (Read error: Connection reset by peer)
03:46:46*rauss joined #nim
03:56:25*skrylar quit (Remote host closed the connection)
04:03:49*rauss quit (Read error: Connection reset by peer)
04:05:05*rauss joined #nim
04:08:18*rauss quit (Read error: Connection reset by peer)
04:09:42*rauss joined #nim
04:27:42*jdhorwitz joined #nim
04:35:52jdhorwitzif I wanted to iterate over a seq of ints, such as @[1,2,3,4,5], would a for i, v in 0..<x.len:
04:35:57jdhorwitzecho(v) work?
04:38:33jdhorwitzJust answered my own question, but to iterate over an array of ints, what is the best way to do that?
04:58:09*jdhorwitz quit (Ping timeout: 248 seconds)
05:01:20*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
05:20:54*gmpreussner quit (Ping timeout: 268 seconds)
05:21:07*jdhorwitz joined #nim
05:23:12*dddddd quit (Remote host closed the connection)
05:24:21*martinium joined #nim
05:30:58*sz0 joined #nim
05:33:01*jdhorwitz quit (Ping timeout: 240 seconds)
05:33:12*endragor quit (Remote host closed the connection)
05:36:00GitDisc<treeform> for v in x: echo v
05:52:40*endragor joined #nim
06:06:47*skrylar joined #nim
06:17:22*gmpreussner joined #nim
06:19:03*bkerin joined #nim
06:20:05bkerinis it possible to make e.g. a global list that gets added to each time a macro is instantiated?
06:20:46bkerinah looks like the global needed to be under a static: thingy
06:24:05*BitPuffin|osx quit (Ping timeout: 240 seconds)
06:38:40*nsf joined #nim
06:46:24*martinium quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
06:51:56*bkerin quit (Quit: "Girl who is wallflower at party is dandelion in bed.")
06:59:14FromGitter<alehander42> I think I've done something like it
06:59:52FromGitter<alehander42> about the time libs, I've wondered before
07:00:17FromGitter<alehander42> how would a time library supporting other planets in solar space work :D with all the different orbits
07:05:43*endragor quit (Remote host closed the connection)
07:23:25*jdhorwitz joined #nim
07:26:13*endragor joined #nim
07:27:35*jdhorwitz quit (Ping timeout: 240 seconds)
07:30:00*endragor quit (Remote host closed the connection)
07:30:32*gokr joined #nim
07:36:16*endragor joined #nim
07:52:17*endragor quit (Remote host closed the connection)
08:02:11*SenasOzys_ joined #nim
08:07:06*PMunch joined #nim
08:08:49*Arrrr joined #nim
08:08:49*Arrrr quit (Changing host)
08:08:49*Arrrr joined #nim
08:15:42*claudiuinberlin joined #nim
08:19:29*vlad1777d_ joined #nim
08:19:38skrylarBleh. I think I appreciate postgres even more after doing this favor
08:20:23skrylarFirebird seems to have either forgotten to document the API or to have hidden it. There are examples, but i'm having to figure out what these parameter names are from interbase help files on embarcadero -_-
08:41:22*yglukhov joined #nim
08:47:18*endragor joined #nim
08:52:02*endragor quit (Ping timeout: 260 seconds)
08:56:37*sz0 quit (Quit: Connection closed for inactivity)
08:56:44FromGitter<data-man> @skrylar: Maybe the source code of the FireBird will help you? https://github.com/FirebirdSQL/firebird/tree/master/src
09:06:53skrylardata-man: maybe. i've been piecing it together from interbase help and other articles online
09:06:59*jinshil quit (Quit: Good-bye!)
09:07:36skrylarthen ran in to a trouble where arch doesn't actually have firebird3, but it seems the changes in API between 2.5 and 3 aren't significant
09:12:52*jdhorwitz joined #nim
09:14:28*couven92 joined #nim
09:17:21*jdhorwitz quit (Ping timeout: 248 seconds)
09:19:48*vlad1777d_ quit (Ping timeout: 240 seconds)
09:27:33*endragor joined #nim
09:27:34*endragor quit (Remote host closed the connection)
09:27:41*endragor joined #nim
09:47:26ArrrrThis hslice and < deprecation worst ideas in 2017
09:52:12AraqArrrr: ouch, why?
09:54:45ArrrrBecause i have to rewrite a lot of code. And for some reason, int16 -> int conversion was performed by the compiler before. I guess this is no longer the case.
09:56:19*Vladar joined #nim
09:57:00ArrrrNo, it was another issue and i'm blind
09:58:44Arrrrmmm i will paste my compiler log, and you will see how funny it is
09:58:44skrylarwhat is '< deprecation'
09:59:01*kier quit (Ping timeout: 240 seconds)
09:59:17cremIs there a way to find a page https://nim-lang.org/araq/destructors.html without knowing the direct link?
10:05:53*craigger quit (Ping timeout: 248 seconds)
10:06:50*MagpieMcGraw joined #nim
10:08:01*craigger joined #nim
10:10:22ArrrrI'm glad i can define my own `<` but i'll have to wait until the one in system is actually removed https://pastebin.com/zkUMws96
10:14:32AraqArrrr: sorry about that, you can do something like
10:14:37Araqimport system except `<`
10:14:52Araqbut that excludes the binary < too :D
10:17:03MagpieMcGrawhello. I'm trying to use the nim wrapper for iup. It's the only nim gui library that works on my computer. But it opens an empty command window when I run a compiled example program. s there any way to get rid of that?
10:18:50*kier joined #nim
10:23:36*ShalokShalom joined #nim
10:26:27*ShalokShalom_ quit (Ping timeout: 240 seconds)
10:27:41*xkapastel quit (Quit: Connection closed for inactivity)
10:31:34skrylarI don't get it. why should 'i < x' be broken
10:32:07skrylarthis sounds retarded unless i'm missing some important context
10:36:04Araqskrylar: the context here is "unary < "
10:36:27*MagpieMcGraw quit (Quit: Leaving)
10:36:30AraqMagpieMcGraw: --app:gui iirc
10:47:39*endragor quit (Remote host closed the connection)
11:08:04*endragor joined #nim
11:08:56*endragor quit (Remote host closed the connection)
11:09:03*endragor joined #nim
11:22:09FromGitter<xomachine> I wonder, why the first enum in code below has size of 2? 255 still can be placed into one byte ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a098061505b630c05d7e9a8]
11:25:17FromGitter<data-man> @Araq: Can be used unsafeAddr for js backend? Need for "better hashing" 
11:30:02Araqdata-man: take a look at hashes.nim, it tries to give a good hash value for pointers via a hack :-)
11:33:43*skrylar quit (Remote host closed the connection)
11:41:56FromGitter<data-man> Oh, I found that unsafeAddr used in streams.write. Streams worked in js?
11:42:05*elrood joined #nim
11:43:42FromGitter<xomachine> @data-man afaik they dont
11:45:33FromGitter<data-man> @Araq @xomachine Thanks!
11:55:08*jdhorwitz joined #nim
11:59:52*jdhorwitz quit (Ping timeout: 260 seconds)
12:04:35*Vladar quit (Quit: Leaving)
12:18:09*Snircle joined #nim
12:23:27*dddddd joined #nim
12:31:02*sz0 joined #nim
12:57:22*claudiuinberlin quit (Quit: Textual IRC Client: www.textualapp.com)
13:19:44*Arrrr quit (Quit: Leaving.)
13:25:22FromGitter<data-man> How to compile for i386 architecture on x64 platform? ⏎ Error: typedef int Nim_and_C_compiler_disagree_on_target_architecture[sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof(NI)*8 ? 1 : -1];
13:36:57FromGitter<Yardanico> build64.bat if on windows
13:36:59couven92@data-man you need to have a xplat compiler and then you need to specify `--cpu:i386` on the command-line
13:41:18*jdhorwitz joined #nim
13:43:07*SenasOzys_ quit (Ping timeout: 260 seconds)
13:43:21FromGitter<data-man> @Yardanico: No, Linux ⏎ @couven92: I tried to set --cpu:i386 and got the above error. What is "xplat compiler"?
13:43:52couven92sry, xplat = cross-platform compiler
13:44:39FromGitter<Yardanico> you can overwrite detected cpu
13:44:42FromGitter<Yardanico> try --cpu i386
13:44:46FromGitter<Yardanico> without `:`
13:45:12couven92Yardanico, that error has nothing to do with nim, it's a compiler message
13:45:35*jdhorwitz quit (Ping timeout: 240 seconds)
13:45:57couven92So if you want to compile against x86 (or i386) you need a compiler that compiles to that architecture. If you're on Linux and x64, your gcc binary is probably the 64-bit version of gcc which compiles for the x64 platform
13:46:12*claudiuinberlin joined #nim
13:46:14*Jesin quit (Quit: Leaving)
13:46:18couven92so you basically need to install the GCC x86 toolchain
13:47:08couven92The architecture of the nim binary is irrelevant here, since Nim knows how to emit valid code for different cpus and oses. That's what the command-line `--cc:i386` does
13:48:08couven92@Yardanico what you mean, with passing `--cpu i386` to the build step, only applies for the csources bootstrapping of the nim executable
13:48:16FromGitter<Yardanico> yes I know
13:49:52*floppydh joined #nim
13:50:32*SenasOzys_ joined #nim
13:52:28*fredrik92 joined #nim
13:53:21*couven92 quit (Disconnected by services)
13:53:27*fredrik92 is now known as couven92
13:56:45*Calinou quit (Remote host closed the connection)
13:57:54*Calinou joined #nim
13:59:31*JappleAck joined #nim
14:09:03couven92so the actual bitness of the nim executable is pretty much irrelevant, since both x86 and x64 binaries will run on x64 CPUs... So, here the options for the build.sh are really only for the few cases where uname does not detect the OS correctly, which is an issue that currently only comes up with Android, the CPU option is strictly not necessary here, since uname is pretty good on detecting the CPU architecture reliably and consistently
14:12:05FromGitter<data-man> @couven92: Thanks, but not worked. Although gcc with -m32 option compiles a C source successfully.
14:12:26*Vladar joined #nim
14:12:58couven92@data-man okay, then you need to do `nim compile --cpu:i386 -passC:-m32 --passL:-m32 <your_nim_file>`
14:13:44couven92Because that means that your gcc is a 64-bit compiler with cross-compilation capability for x86.
14:14:54couven92--cpu:i386 simply gets Nim to emit code for a compiler x86-compiler. So if you need to pass aditional options for compilation, you use `--passC` and `--passL`
14:17:28AraqPRs are welcome btw
14:17:44Araq--cpu:i386 could set -m32 for GCC and clang at least
14:20:47FromGitter<couven92> @Araq, no, you wouldn't want the compiler to go into cross-platform mode if you actually were using a native x86 compiler
14:21:25Araqmaybe, I dunno
14:22:02FromGitter<couven92> So the same way we don't have -m64 on --cpu:amd64 we don't want that on x86 either
14:22:41FromGitter<data-man> @couven92: Thanks, --cpu:i386 --passC:-m32 --passL:-m32 is worked.
14:23:05*jdhorwitz joined #nim
14:25:18FromGitter<couven92>
14:27:25*endragor quit (Remote host closed the connection)
14:27:35*jdhorwitz quit (Ping timeout: 240 seconds)
14:27:37*Arrrr joined #nim
14:27:37*Arrrr quit (Changing host)
14:27:37*Arrrr joined #nim
14:29:48*endragor joined #nim
14:34:05*endragor quit (Ping timeout: 240 seconds)
14:34:05FromGitter<data-man> Who will do a PR for this? 
14:35:32FromGitter<couven92> There shouldn't be a PR for this
14:36:37*sz0 quit (Quit: Connection closed for inactivity)
14:38:38FromGitter<couven92> cross-platform compilation is difficult, you need the correct toolchain, correct special compiler options, and depending on the toolchain even the compiler executable name might be different
14:39:24FromGitter<couven92> All these edge-cases should IMO not be covered by the default nim.cfg
14:39:57FromGitter<couven92> Compiler options for native compilation is hard enough to get right and maintain
14:40:03hohlerdewhen using "import windows" for oldwinapi I get the following compiler error: Error: cannot open 'windows'
14:40:04hohlerdehas anyone also experienced that?
14:42:31FromGitter<Yardanico> did you try import oldwinapi/windows
14:42:32FromGitter<Yardanico> ?
14:42:40FromGitter<Yardanico> "import oldwinapi/windows"
14:43:32hohlerdeoh, good point, that seems to work
14:43:49hohlerdeI get other errors, but now at least the import is found
14:44:21FromGitter<Yardanico> try this https://github.com/nim-lang/oldwinapi/pull/5/files
14:44:29FromGitter<Yardanico> change HRESULT type
14:45:36FromGitter<couven92> Can I make a nimble package that is not alone in its repo? I.e. must the nimble be at the repo root? No way to specify sub-dir in a repo?
14:45:40FromGitter<data-man> @couven92: Or at least describe it in the docs. Maybe in the "FAQ".
14:46:11hohlerdethx yardanico
14:47:01FromGitter<couven92> @data-man hmm, maybe. But why? This is not an issue with Nim, this is very specific to how your particular compiler handles cross-compilation
14:47:28dom96couven92: yes
14:47:53FromGitter<couven92> @dom96 how?
14:48:12dom96no, I mean, it has to be in the repo root
14:48:41FromGitter<couven92> Ah, but only the nimble file, right?
14:49:03dom96yes
14:49:45FromGitter<couven92> Can I have multiple nimble files in the same repo root?
14:50:00FromGitter<data-man> Here's where to add https://nim-lang.org/docs/nimc.html#cross-compilation
14:51:08FromGitter<couven92> @data-man how is the information there not sufficient?
14:52:09dom96no
14:53:27FromGitter<data-man> @couven92: There is an example with nim c - cpu: i386, which did not work for me.
14:54:55*fredrik92 joined #nim
14:55:39FromGitter<Yardanico> "Then move the C code and the compile script compile_myproject.sh to your Linux i386 machine and run the script."
14:57:31FromGitter<data-man> That is, it is proposed to have several PCs? 
14:57:51*couven92 quit (Ping timeout: 240 seconds)
14:59:08AraqI documented what I did back then for bootstrapping...
14:59:22Araqhttps://forum.nim-lang.org/t/3329 somebody please help him
15:03:47fredrik92@data-man, if your gcc binary was a x86 binary that would have worked
15:03:54*fredrik92 is now known as couven92
15:04:29couven92your gcc binary is not however, therefore you have to change your settings, specific to you particular setup
15:04:54couven92That's basically the essence of the ARM part of that section
15:04:56*jdhorwitz joined #nim
15:05:33couven92in your case this was just much simpler, simply because your GCC just happened to be able to compile against x86 if you specify -m32
15:05:53couven92That won't always be the case however
15:07:07FromGitter<Yardanico> Araq: I already helped him
15:07:47FromGitter<Yardanico> (in IRC)
15:09:11*jdhorwitz quit (Ping timeout: 240 seconds)
15:14:45FromGitter<data-man> @fredrik92: No, gcc is x86-64 ⏎ @couven92: Well, suppose that the developer distributes his app for multiple platforms. Information about a correctly cross-compilation would be useful.
15:15:53couven92@data-man that's what I am saying! There is no **correctly** doing cross-compilation! It is always very specific to your particular setup
15:17:05hohlerdefrogEye is sitting next to me. we were too dumb to see that there is the oldwinapi folder under the pkg folder. thanks again.
15:17:19*Jesin joined #nim
15:17:26couven92It is always a pain, and most importantly, it's not something that is controlled by Nim! nim will emit the correct C code for your OS, CPU and compiler backend just fine. You just have to set up your compiler toolchain to deal with it
15:19:01couven92(*and sorry for shortly showing up as `fredrik92`, I lost internet connection there for a moment, prompting my IRC client to choose a new nick*)
15:20:01hohlerdecross compiling is even a pain with languages like go, if you use c code or interface c libraries.
15:20:11FromGitter<data-man> @couven92: ok, let's have a сup of coffee 
15:20:17couven92:)
15:22:18couven92hohlerde, yeah, that's actually one of the benefits of languages like C# and Java, you have CPU independent intermediate bytecode
15:23:02couven92and even though P/Invoke is a pain in C#, it oddly enough is not that much worse when doing it across different platforms
15:25:56FromGitter<Yardanico> @data-man https://github.com/vk-brain/Nickel/blob/master/src/nim.cfg#L14 :D
15:27:26couven92ironically, vcc is actually pretty nice with cross-compilation setup... vccexe makes vcvarsall to automatically setup your toolchain correctly
15:28:09couven92And no, I am not saying that because I am the author of vccexe, that part is actually all done my the Microsoft tools themselves
15:28:23couven92*by
15:30:40FromGitter<data-man> @Yardanico:  is it for windows only?
15:32:18couven92@data-man, it's for the edge case where you have the MinGW x86-x64 GCC cross-compiler installed on Windows
15:32:40couven92with the MinGW 32-bit toolchain, I might add
15:33:27couven92so all these parameters are very relevant here: MinGW 32-bit, GCC, x86-x64 cross-compiler
15:33:34*zolk3ri joined #nim
15:33:36couven92change one of these, and it doesn't work anymore
15:34:23couven92Ah, wait... @Yardanico that's is using the Linux to cross-compile to Windows as well, doesn't it?
15:34:57*BitPuffin|osx joined #nim
15:35:28*willc joined #nim
15:36:56zolk3riwillc: hey :)
15:37:03willchello
15:37:06zolk3riit's usually pretty active :D
15:38:00willcI'll keep the tab open for next time
15:40:17*couven92 quit (Quit: Client disconnecting)
15:40:28GitDisc<treeform> alehander42, on other planets months would be pretty arbetrary.They would probably just have a day-year calendar with more often leap years?
15:41:25FromGitter<alehander42> well yeah but hours in day and years would be different
15:42:34FromGitter<alehander42> but that's nothing compared to making a chat for jupiter <-> earth and deciding which message is before which one :D
15:44:57*jdhorwitz joined #nim
15:45:01GitDisc<treeform> jupiter will just use seconds utc from 1970...
15:46:41FromGitter<alehander42> eh ?
15:46:47*willc quit (Ping timeout: 260 seconds)
15:50:41GitDisc<treeform> space will just use earth time
15:51:06FromGitter<alehander42> that's the easy part, but time is relative
15:51:54FromGitter<alehander42> a message from Jupiter might be first on Europe(moon)
15:51:58FromGitter<alehander42> but second on Phobos
15:52:58FromGitter<mratsim> People are used to relative things, absolute is difficult (besides Absolut Vodka)
15:55:38FromGitter<alehander42> my family is full of relatives
15:55:40FromGitter<alehander42> pretty used to it
16:02:27FromGitter<mratsim> :D
16:10:08*Jesin quit (Ping timeout: 240 seconds)
16:10:34*PMunch quit (Quit: Leaving)
16:11:26*Jesin joined #nim
16:17:13*Trustable joined #nim
16:46:25*jdhorwitz quit (Ping timeout: 248 seconds)
16:48:24*yglukhov quit (Remote host closed the connection)
16:51:17*yglukhov joined #nim
16:52:08*rauss quit (Read error: Connection reset by peer)
16:52:43*yglukhov quit (Read error: Connection reset by peer)
16:52:54*yglukhov joined #nim
16:54:12*rauss joined #nim
16:56:51*yglukhov quit (Ping timeout: 240 seconds)
17:03:32*jdhorwitz joined #nim
17:04:31*gokr quit (Ping timeout: 240 seconds)
17:07:41*jdhorwitz quit (Ping timeout: 240 seconds)
17:12:12shashlickcan you declare a variable within a template and consume it in the body? doesn't seem to work for me
17:13:28shashlickhttps://play.nim-lang.org/?gist=354349bcf274c5084ae9195a604a9f07
17:13:39*claudiuinberlin quit (Quit: Textual IRC Client: www.textualapp.com)
17:15:48shashlicklooks like manual is quite thorough
17:16:00dom96var content {.inject.}= contentOrig
17:19:44shashlickdom96: thanks, just figured it out from the manual - should check there first :)
17:21:43*PMunch joined #nim
17:35:56*floppydh quit (Quit: WeeChat 1.9.1)
17:38:09*couven92 joined #nim
17:44:23*jdhorwitz joined #nim
17:48:41*jdhorwitz quit (Ping timeout: 240 seconds)
17:49:13*Snircle_ joined #nim
17:49:16*Snircle quit (Ping timeout: 252 seconds)
18:08:02*yglukhov joined #nim
18:11:12*vivus joined #nim
18:12:17*yglukhov quit (Ping timeout: 248 seconds)
18:14:16*yglukhov joined #nim
18:17:40*Trustable quit (Remote host closed the connection)
18:21:23*jdhorwitz joined #nim
18:23:59jdhorwitzAFternoon all
18:26:55FromGitter<xomachine> Does anybody participating in RussianAICup (http://russianaicup.ru/?locale=en)? I've just wrote the Nim language pack (https://github.com/xomachine/nim-cgdk) for it. Could somebody test it under Windows? (or even support it on forum (http://russianaicup.ru/forum/index.php?topic=815.0) to get the organizers attention)
18:27:25*yglukhov quit (Read error: Connection reset by peer)
18:27:57*yglukhov joined #nim
18:41:06*rauss quit (Read error: Connection reset by peer)
18:43:07*rauss joined #nim
18:48:17jdhorwitzWish I could, I don't have Windows to test.
18:59:13*SenasOzys_ quit (Ping timeout: 268 seconds)
19:00:37jdhorwitzWhat is the difference between using ref object and just plain object?
19:10:56*jdhorwitz quit (Ping timeout: 268 seconds)
19:12:47FromGitter<Varriount> jdhorwitz: A 'ref' object is a reference type - the memory for the object is stored on the heap, and assignment of the object doesn't copy the underlying data, just the actual reference (pointer)
19:13:14FromGitter<Varriount> A references is a traced/garbage collected pointer
19:37:27FromGitter<jaccarmac> @xomachine: Fails for me under Windows with `netinet/in.h: No such file or directory`
19:37:58*SenasOzys_ joined #nim
19:44:30FromGitter<xomachine> @jaccarmac thank you for testing! Started investigation...
19:45:48*claudiuinberlin joined #nim
19:52:33*Sentreen quit (Ping timeout: 248 seconds)
19:58:57*JappleAck quit (Ping timeout: 240 seconds)
20:01:41FromGitter<xomachine> Hm, it looks like we dont have the TCP_NODELAY socket option for windows =\
20:04:11FromGitter<Varriount> @dom96
20:04:17FromGitter<Varriount> ^
20:04:46FromGitter<Varriount> @xomachine What are you writing?
20:06:45*Sentreen joined #nim
20:07:11*enigmeta joined #nim
20:08:36FromGitter<xomachine> @Varriount the Nim language pack (https://github.com/xomachine/nim-cgdk) for RussianAICup (http://russianaicup.ru/?locale=en). ⏎ I'm not sure if this option is necessary, but it present (https://github.com/Russian-AI-Cup-2017/python3-cgdk/blob/master/RemoteProcessClient.py#L34) in other language packs.
20:11:26*willc joined #nim
20:18:18FromGitter<jaccarmac> I'm totally unfamiliar with TCP but it seems that option has something to do with optimizing for lots of little packets?
20:18:34FromGitter<jaccarmac> @xomachine Do you mean the problem is in the Nim compiler or in the library somewhere?
20:23:02*vlad1777d_ joined #nim
20:24:06FromGitter<xomachine> The problem initially was in the language pack (it takes the TCP_NODELAY from posix (https://nim-lang.org/docs/posix.html), which does not work with windows as far as I can understand). And unfortunately I can not fix it because there is no analogue in winlean (https://nim-lang.org/docs/winlean.html).
20:28:04FromGitter<xomachine> I am not very familiar with TCP too, but If it is a performance option it may be important, due to restrictions applied to the execution time by championship rules
20:31:56*yglukhov quit (Remote host closed the connection)
20:35:35FromGitter<mratsim> the foldl template seems to give the a and b parameter as HSlice in some curious cases
20:37:59*gokr joined #nim
20:41:04dom96xomachine: make a PR that adds it to winlean :)
20:42:22FromGitter<xomachine> I'd like to, but I have no idea where to take it from on windows
20:42:49*yglukhov joined #nim
20:43:57FromGitter<xomachine> I even dont have a windows computer/VM to test if it works
20:44:12FromGitter<data-man> Testing, please https://github.com/nim-lang/Nim/pull/6740
20:44:50FromGitter<mratsim> ah silly me I forgot a toSeq before my range
20:48:59*Arrrr quit (Read error: Connection reset by peer)
20:50:38*willcdot joined #nim
20:53:48*willc quit (Ping timeout: 240 seconds)
20:59:03*willcdot quit (Ping timeout: 250 seconds)
21:01:44GitDisc<treeform> TCP games cannot work without TCP_NODELAY, i am surprised its not implemented.
21:02:14GitDisc<treeform> It exists in windows as well: https://msdn.microsoft.com/en-us/library/windows/desktop/ms740476(v=vs.85).aspx
21:04:16GitDisc<treeform> TCP_NODELAY does is stop buffering with TCP, buffering is bad for games because they usually send little packets. But its important for them to come in on time and come in consistently. Other wise you get lag and jitter which kills using TCP for games.
21:04:47GitDisc<treeform> It turns off this thing: https://en.wikipedia.org/wiki/Nagle%27s_algorithm
21:04:56dom96In what situation would you use TCP instead of UDP?
21:05:03dom96(For games)
21:05:14GitDisc<treeform> Tons of games use TCP.
21:05:28GitDisc<treeform> I have to use it in my game because websockets are TCP only.
21:05:53dom96Do websockets support TCP_NODELAY?
21:05:57GitDisc<treeform> TCP has other nice properties is if your game is not super twitchy you can just use it with TCP_NODELAY.
21:06:20GitDisc<treeform> On the servers side they do because you can set it on the server.
21:07:49*marenz__ joined #nim
21:09:22GitDisc<treeform> On the client side you cannot set it. But it is not as big problem on client side in practice.
21:09:53GitDisc<treeform> When using websockets. If you had a native client you would absolutely set it.
21:10:28GitDisc<treeform> You usually grab the underlying socket and set it there.
21:10:41GitDisc<treeform> When you using a websocket library.
21:11:43FromGitter<xomachine> @treeform thanks for explanation! But wait... In all language packs for the championship the option is set on client side, so it means that this setting is redundant?
21:13:16GitDisc<treeform> I have implemented reliable communication over UDP, and its not easy. Its not just simple ACKing and deduplication. If you want to transmit a big chunk of data, say a new level or images that can some times flood the connection etc...
21:13:47*JappleAck joined #nim
21:15:12*Jesin quit (Quit: Leaving)
21:16:10GitDisc<treeform> xomachine, it should be set on both sides. But its more important to set server side.
21:18:06FromGitter<xomachine> ah, now I see
21:20:17GitDisc<treeform> I will use UDP for my games written in nim though. Not because UDP is better but hard to use, but because I like the challenge.
21:24:06*arnetheduck quit (Remote host closed the connection)
21:26:35*JappleAck quit (Ping timeout: 240 seconds)
21:33:17*Trustable joined #nim
21:38:55*yglukhov quit (Remote host closed the connection)
21:40:03*JappleAck joined #nim
21:43:18FromGitter<jaccarmac> @xomachine I have Windows access and will take a look at this later today :)
21:43:37FromGitter<jaccarmac> Thank you @dom96 and @treeform for input
21:44:08*Trustable quit (Remote host closed the connection)
21:45:24dom96our UDP support also could be improved actually :)
21:46:54*r4vi_ joined #nim
21:47:56*MightyJoe joined #nim
21:48:58*Rush joined #nim
21:51:48*r4vi quit (Ping timeout: 255 seconds)
21:51:50*odc quit (Ping timeout: 255 seconds)
21:51:50*gsingh93 quit (Ping timeout: 255 seconds)
21:51:51*planetis[m] quit (Ping timeout: 255 seconds)
21:51:51*cyraxjoe quit (Ping timeout: 255 seconds)
21:51:51*RushPL quit (Ping timeout: 255 seconds)
21:51:51*r4vi_ is now known as r4vi
21:52:15*rauss quit (Quit: WeeChat 1.9.1)
21:52:37*gsingh93 joined #nim
21:54:57*kunev quit (Ping timeout: 240 seconds)
21:56:48*kunev joined #nim
21:59:32*notdekka[m] quit (Ping timeout: 240 seconds)
21:59:34*Miguelngel[m] quit (Ping timeout: 252 seconds)
21:59:44*byteflame quit (Ping timeout: 250 seconds)
21:59:44*hohlerde quit (Ping timeout: 250 seconds)
21:59:44*TheManiac quit (Ping timeout: 250 seconds)
21:59:44*MrAxilus[m] quit (Ping timeout: 250 seconds)
21:59:44*Jipok[m] quit (Ping timeout: 250 seconds)
21:59:46*jivank[m] quit (Ping timeout: 264 seconds)
21:59:48*macsek1911[m] quit (Ping timeout: 240 seconds)
21:59:53*watzon quit (Ping timeout: 248 seconds)
22:00:05*ehmry quit (Ping timeout: 255 seconds)
22:00:06*shashlick quit (Ping timeout: 246 seconds)
22:00:22*Demos[m] quit (Ping timeout: 264 seconds)
22:00:22*unclechu quit (Ping timeout: 264 seconds)
22:00:22*dyce[m] quit (Ping timeout: 264 seconds)
22:01:57*Amrykid quit (Ping timeout: 240 seconds)
22:03:35*Vladar quit (Quit: Leaving)
22:04:47*Amrykid joined #nim
22:04:52*rauss joined #nim
22:09:57*Jipok[m] joined #nim
22:14:25*beatmox quit (Remote host closed the connection)
22:14:37*beatmox joined #nim
22:17:32*MrAxilus[m] joined #nim
22:17:32*ehmry joined #nim
22:17:32*dyce[m] joined #nim
22:17:32*unclechu joined #nim
22:17:33*Miguelngel[m] joined #nim
22:17:33*Demos[m] joined #nim
22:17:33*watzon joined #nim
22:17:39*planetis[m] joined #nim
22:17:39*jivank[m] joined #nim
22:17:39*hohlerde joined #nim
22:17:40*shashlick joined #nim
22:17:40*macsek1911[m] joined #nim
22:17:40*TheManiac joined #nim
22:17:40*byteflame joined #nim
22:17:40*notdekka[m] joined #nim
22:19:39GitDisc<treeform> I find it strange that TCP and UDP has such similar API at the OS level.
22:20:21*rauss quit (Quit: WeeChat 1.9.1)
22:20:31GitDisc<treeform> What is wrong with the UDP support though?
22:21:26*yglukhov joined #nim
22:23:11*Jesin joined #nim
22:24:17*claudiuinberlin quit (Quit: Textual IRC Client: www.textualapp.com)
22:30:07*Ven joined #nim
22:30:30*Ven is now known as Guest78171
22:31:26*xkapastel joined #nim
22:34:37FromGitter<jdhorwitz> Hey all, I'm not sure why this isn't working.
22:35:42FromGitter<jdhorwitz> ```proc getAlphabetO: string = ⏎ for letter in 'A'..'Z': ⏎ result.add(letter)``` [https://gitter.im/nim-lang/Nim?at=5a0a1e3e614889d4757834d6]
22:37:16Calinoudom96: honestly, there's no point in using TCP for a game at all
22:37:23Calinoujust use ENet if you want reliable UDP without writing it yourself
22:37:29Calinou(you need a fork of it to support IPv6, though)
22:37:45Calinoualso, transfering large data should be done using HTTP, I guess
22:37:48*skrylar joined #nim
22:37:50Calinoudirect transfers are slow anyway
22:38:15skrylarso an update on the firebird stuff: interbase seems to like doing weird things with varargs and strings, so having to pave over that :\
22:38:57dom96Calinou: it seems you and treeform disagree :)
22:39:07dom96treeform: no async UDP support
22:39:20Calinouwell, play some Minecraft and you may end up agreeing with me
22:39:59skrylarso an update on the firebird stuff: interbase seems to like doing weird things with varargs and strings, so having to pave over that :\
22:40:01skrylaroops
22:40:03*PMunch quit (Quit: leaving)
22:40:07skrylaralt-tab up <RET> the wrong window
22:40:37skrylarcalinou, dom96: what's going on? voxel stuff?
22:44:32*willc joined #nim
22:46:15*salewski joined #nim
22:47:40salewskijdhorwitz, I guess you solved your problem yourself in the last ten minutes. If not:
22:48:13salewskiBefore you can add to the result string, you have to create the string, for
22:48:29salewskiexample with result = "".
22:49:34*nsf quit (Quit: WeeChat 1.9.1)
22:50:08*salewski quit (Client Quit)
22:54:33Calinouskrylar: no, network protocols
22:54:39Calinou(and Minecraft indeed uses TCP and always did so)
22:56:41*Guest78171 quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
23:00:55*jdhorwitz joined #nim
23:00:56GitDisc<treeform> dom96, UDP never blocks, so I don't think it needs async support.
23:01:37GitDisc<treeform> Calinou, UDP is better option I agree, but why do most games use TCP?
23:02:54GitDisc<treeform> Oh I forgot about firewalls, so many people live behind firewalls and don't know how to work around them. That is why my game uses ports 443 and 80 as thats the only ports that are not usually blocked.
23:03:10dom96it surely blocks when you're receiving data
23:03:20federico3treeform: UDP does not have congestion control - that's the tricky bit (not retransmissions)
23:03:24dom96and I bet if you send data fast enough it will block too
23:04:05GitDisc<treeform> federico3 , yes i just choose not to worry about congestion control.
23:04:33GitDisc<treeform> I think if you send data so fast to block UDP, your game going to have a bad time :(.
23:04:43federico3treeform: sure (I was answerknig your question on why games use TCP)
23:04:57*jdhorwitz quit (Ping timeout: 240 seconds)
23:05:05GitDisc<treeform> Oh yeah. Congestion control could be a good reason.
23:05:18GitDisc<treeform> I don't know myself. Why they choose TCP.
23:05:45FromGitter<jdhorwitz> I tried that as well, doing result="" and it still was not working
23:06:09FromGitter<jdhorwitz> ah, I see my mistake, I did `var result = ""`
23:06:36GitDisc<treeform> dom96 with udp, you generally don't send data, block on read, send data, block on read, like you do with TCP which is why async is very important there.
23:06:46GitDisc<treeform> because packs come at random you need to deal with them at random
23:06:57GitDisc<treeform> packets*
23:08:00Calinouusing ports 80/443 is not a matter of blocking
23:08:03Calinou1) you should never do this)
23:08:10Calinou2) people have trouble hosting servers because of NATs
23:08:14Calinou(and not the port numbers)
23:08:24Calinou(in fact, forwarding port 80 is sometimes blocked by ISPs)
23:08:39dom96treeform: recvfrom still blocks though
23:08:47Calinoufederico3: I'd argue it's "they don't know better", but that's just me :)
23:09:15dom96I also don't get the distinction, TCP packets come at random too
23:12:50*elrood quit (Quit: Leaving)
23:13:06federico3Calinou: don't know how to implement congestion control? There are commercial libraries that do congestion / multiplexing / priorities over UDP (kind of like the QUIC protocol) otherwise implementing your own it's still expensive for many
23:13:12Calinouindeed
23:13:16CalinouENet does it for most people :)
23:20:57*JappleAck quit (Ping timeout: 240 seconds)
23:35:37skrylarraknet is open source now
23:35:49*yglukhov quit (Remote host closed the connection)
23:42:12GitDisc<treeform> dom96, sorry you are right, I have always used select with UDP. I think everyone else that does game did too. Because there is only one socket select works really well. No need for kpoll or epoll or whatever.
23:42:48GitDisc<treeform> You only have one socket, you open it, select on it. When you get a packet it tells you were the packet is from, and when you send a packet you tell it to who it goes.
23:43:05GitDisc<treeform> socket really does not matter and gets abstracted. Its all just packet in and packet out type of thing.
23:43:26dom96Makes sense. You could probably just use the selectors module in Nim then for ultimate efficiency
23:43:36dom96I did that for httpbeast
23:43:47*odc joined #nim
23:43:56GitDisc<treeform> If when your layer does some thing smart like split your game packet into several UDP packets and stitches them together. You still think in terms of packets.
23:44:10dom96But I benchmarked it recently and was surprised to see that it performed not that significantly better than asynchttpserver
23:44:20GitDisc<treeform> What mechanism does selectors use?
23:44:38dom96it supports epoll/kqueue/poll/select
23:45:08GitDisc<treeform> I don't think epoll/kqueue/poll do anything that the simple select does not.
23:45:15GitDisc<treeform> They might even be worse for UDP.
23:45:31GitDisc<treeform> You only have one socket to select on.
23:45:46dom96I doubt there is much difference
23:46:13GitDisc<treeform> You are probably right.
23:46:28skrylarstarting to wonder how odbc can be so buggy if most sql libs have similar apis :|
23:46:39dom96skrylar: what are you working on?
23:46:45GitDisc<treeform> Having an ENet or a raknet style UDP based lib implemented in nim might be cool.
23:46:53skrylardom96, the firebird code that was requested a few days ago
23:47:42skrylarthere are some archaic parts, but those are.. i dunno.
23:48:01skrylarlike it asks for string length "or zero if null terminated", and that's easy enough to just inline proc over
23:48:04dom96nice. I've never used firebird
23:48:33skrylardom96, well documenting it is more the pain than anything else now
23:48:40dom96In fact I'm curious what reason there is for its usage
23:48:41skrylari've got the headers "done" but none of the procs had parameter names
23:48:59skrylardom96, if you want more than sqlite but still want it embedded (ex. not postgres)
23:49:10skrylaror if you're dealing with old delphi users. because they apparently fielded a lot of interbase
23:50:27skrylari think we already have postgres client wrappers
23:52:01skrylarthe nimized version looks a little cleaner, 'cause we have default args
23:52:26dom96We definitely do want to attract old delphi users :)
23:52:34skrylarInterestingly some of these parameters look like a 1990s C version of Functional Options
23:53:18skrylarlike they create 'parameter strings' with appending tokens and strings together; it looks horrid (because its ANSI C) but recognizing Go's version of the same approach.. not bad
23:53:42skrylarThey can be done in Nim as well. I tested it once
23:54:21skrylarsomething.foo(width(320), height(240), toast_eaten_by("dom96"))
23:56:41skrylardom96, well, araq was one AFAICT. Not sure what all the delphinis want out of life though
23:57:02*vivus quit (Quit: Leaving)
23:57:06dom96Nim was written in Pascal initially IIRC
23:57:15skrylarhe said he used a delphi compiler
23:57:39dom96oh, well, close enough
23:57:57skrylari managed to eat the texinfo manual, so did a little doc work for nfltk (and this firebird thing)