00:11:14 | FromGitter | <gogolxdong> @dom96 Your guess about the websocket frame data size limit is probably right. |
00:31:17 | * | yglukhov quit (Read error: Connection reset by peer) |
00:31:53 | * | yglukhov joined #nim |
00:54:12 | FromGitter | <sivakon> @mratsim genetic algorithms would be nice. Open AI gym stuff |
01:00:50 | shashlick | sherjilozair: nope, c2nim doesn't and nimgen uses c2nim |
01:04:20 | CodeVance | shashlick comments are included |
01:04:32 | CodeVance | If you don't tell c2nim to remove them |
01:22:51 | FromGitter | <sherjilozair> Can nimgen show the c2nim command it's using? I'm using nimgen and the comments do get removed. |
01:38:12 | FromGitter | <sherjilozair> Can I have both C and Nim code in a project and compile with nim? |
01:38:50 | CodeVance | sherjilozair, only the C code inside nimcache gets compiled |
01:39:55 | FromGitter | <sherjilozair> That doesn't really answer my question. In principle, `nim` could copy the C code to nimcache, and then compile it. Is it not common practice to have mixed-source codebases? |
01:40:10 | * | bwlang_ joined #nim |
01:40:36 | FromGitter | <sherjilozair> i.e. without going the shared library route. I want to write both C and Nim code, and have Nim call C functions, without create intermediate libraries. |
01:44:05 | bwlang_ | i’m just trying out nim… when i read lines from stdin (https://bpaste.net/show/2310325dc35a ) the first line is 0x00,0x00 until a chunk of the way through the line, then it looks like a normal string. Am I mssing something here? |
01:44:38 | bwlang_ | unicode vs ascii mode or somesuch? |
01:49:04 | shashlick | Sherjilozair u can pass flags to c2nim |
01:49:55 | shashlick | You can also refer to c code in your Nim file with a compile pragma |
01:58:32 | shashlick | If you see other nimgen projects, you can see how it refers to c files |
02:11:57 | * | leorize joined #nim |
02:30:17 | FromGitter | <sherjilozair> Thanks @shashlick |
02:34:30 | bwlang_ | i thought it would be pretty simple to just read from stdin and write to stdout… |
02:35:00 | bwlang_ | when i add an empty line to my file i get expected output… @[""] |
02:35:00 | bwlang_ | @["chr1", "450564", "450764", "0.270000", "200", "-1", "-1", ".", "ATGACTCATTTTGAACAAGGAATATATTCATCATATATTCATCAGATAAGAATTATGTTACAGGTCTAATAACATTCAAATCAATACATAATGTCTCATAGTTCCTGAATCTAAAATATCAAAGAAAGAAACATAAAGCCATATCATGTTTAATGAGAAGGGCTTATTATATCATTTATGAGATCCTCTTGTAAATCACT"] |
02:35:57 | bwlang_ | i don’t think is is input… checked it over with hexdump. nothing strange in there. |
02:40:29 | FromGitter | <sherjilozair> bwlang_ Can you show code? |
02:40:56 | bwlang_ | sherjilozair: from above… https://bpaste.net/show/2310325dc35a |
02:43:39 | FromGitter | <sherjilozair> bwlang_: does it happen when you write to stdin manually? or is it only happening when you pipe from another program? |
02:44:00 | FromGitter | <sherjilozair> I think this is due to something other than nim in your pipeline. |
02:44:11 | bwlang_ | tried that , did not notice anything when i type in |
02:44:22 | bwlang_ | ran it like this: nim compile --run calc_exp_meth_pct < ../test/test.bed |
02:44:39 | bwlang_ | also tried cat ../test/test.bed | ./calc_exp_meth_pct |
02:44:58 | bwlang_ | same result |
02:45:13 | bwlang_ | python handles this same file just fine. |
02:51:10 | leorize | bwlang_: looks like there's a bug with readLine(file, var string), if you use line = readLine(stdin) then it's fine |
02:52:40 | bwlang_ | whoa - what are the chances that i find a bug in my very first toy nim program… I actaully tried while line = reaLine(stdin) first but got wierd output (one line per character). |
02:53:09 | bwlang_ | er. . for line in readLIne(stdin): |
02:53:29 | leorize | you would want `for l in lines(stdin):` |
02:54:21 | * | vivus quit (Quit: Leaving) |
02:57:35 | bwlang_ | huh? yep - that seems towork.. but i don’t grok what readLine is doing then. docs say it gives back a TaintedString. https://nim-lang.org/docs/streams.html#readLine,Stream. same as lines… what am i missing ? |
02:57:38 | leorize | readLine(stdin) returns a string, so doing a `for in` loop with it would actually becomes `for line in items(readLine(stdin))`, which would yield each character of the string |
03:00:40 | leorize | readLine is not an iterator, please take a look at https://nim-lang.org/docs/manual.html#iterators-and-the-for-statement |
03:01:41 | bwlang_ | leorize: welp - thanks for ublocking me… i’ll keep plugging away |
03:15:36 | * | endragor joined #nim |
03:45:01 | * | bwlang_ quit (Quit: bwlang_) |
03:50:06 | FromGitter | <gogolxdong> @PMunch Does protobuf-nim compile to js? |
04:00:21 | * | leorize quit (Quit: WeeChat 2.1) |
04:02:05 | FromGitter | <sherjilozair> How can I import a module but change its name and not import any of its contents? I basically want the effects of `from module import nil` and `import module as m` combined. |
04:10:53 | FromGitter | <sherjilozair> How can I convert an int to enum? |
04:26:36 | * | dddddd quit (Remote host closed the connection) |
04:35:18 | * | leorize joined #nim |
04:36:32 | FromGitter | <gogolxdong> load local file cause `Failed to load file:///D:/cmp-frontend/management/cmp.proto: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.` |
04:36:48 | FromGitter | <gogolxdong> in karax |
04:39:56 | * | endragor_ joined #nim |
04:42:21 | * | endragor quit (Ping timeout: 264 seconds) |
04:53:35 | * | leorize quit (Quit: WeeChat 2.1) |
04:56:51 | * | CodeVance quit (Quit: Leaving) |
04:58:28 | * | CodeVance joined #nim |
05:15:43 | * | avsej quit (*.net *.split) |
05:15:43 | * | zielmicha_ quit (*.net *.split) |
05:15:51 | * | avsej joined #nim |
05:15:51 | * | avsej quit (Changing host) |
05:15:51 | * | avsej joined #nim |
05:16:11 | * | zielmicha_ joined #nim |
05:22:01 | * | leorize joined #nim |
05:35:45 | * | yglukhov quit (Read error: Connection reset by peer) |
05:36:21 | * | yglukhov joined #nim |
05:41:20 | * | nsf joined #nim |
05:44:59 | * | leorize quit (Quit: WeeChat 2.1) |
06:06:55 | * | CodeVance quit (Quit: Yaaic - Yet another Android IRC client - http://www.yaaic.org) |
06:25:03 | * | leorize joined #nim |
06:27:43 | * | icebattl1 joined #nim |
06:30:21 | * | icebattle quit (Ping timeout: 240 seconds) |
06:30:39 | * | jjido joined #nim |
06:42:55 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
06:49:15 | Tanger | Hey folks, so I was thinking of messing around with templates and compile time. What I was thinking of doing was setting up a decorator of sorts (using a template), that would register decorated procs at compile time and add them to a compile-time defined seq or array or whatnot |
06:51:37 | Tanger | So if I have a .compiletime. pragma on a template that would pass in name: string and a pointer to a procToregister: untyped, do those procs have to also be .compiletime.'d, or does the fact that it's a pointer make that not matter? |
07:26:36 | FromGitter | <Varriount> Tanger: You wouldn't use a template, just a compile time proc |
07:29:07 | FromGitter | <Varriount> What is your end goal? |
07:32:16 | * | PMunch joined #nim |
07:34:37 | Tanger | Varriount: Haha, that makes sense. A template does seem overkill |
07:35:01 | Tanger | I'm making a super duper basic shell. But I wanted to make any builtin commands kinda modular |
07:35:44 | Tanger | So I guess I wanted to be able to be able to register a proc definition and have the system know about it come run-time |
07:41:39 | FromGitter | <survivorm> Can anyone name the downsides of this: ⏎ ⏎ ```proc `+=`*[T,U](a:var T, b:U) = ⏎ a = a + b``` [https://gitter.im/nim-lang/Nim?at=5aec0eb31eddba3d04d000de] |
07:42:37 | FromGitter | <survivorm> If i understand correctly, `+` existance for the chosen types is checked at compile-time |
07:42:54 | * | floppydh joined #nim |
07:44:22 | FromGitter | <survivorm> and it's return type, of cause |
07:46:04 | PMunch | data-man: https://github.com/dloss/binary-parsing/pull/6 |
07:49:25 | * | Vladar joined #nim |
07:57:51 | livcd | yay 2vg fixed mofuw for me! |
07:58:01 | FromGitter | <gogolxdong> @PMunch protobuf.nim doesn't support package statement? |
08:01:23 | * | sendell joined #nim |
08:03:40 | PMunch | It should |
08:06:32 | FromGitter | <gogolxdong> Have you ever sent protobuf data through websocket? |
08:20:47 | FromGitter | <mratsim> @sivakon, great suggestion, I definitely want to be able to do something OpenAI gym like |
08:21:46 | FromGitter | <mratsim> @sherjilozair you can run C or C++ code along with Nim just use {.compile: “foo.c”.} Nim will copy foo.c and anything it includes (headers …) during compilation |
08:22:24 | FromGitter | <mratsim> there are several mixed codebases, for example: https://github.com/status-im/nim-secp256k1 |
08:23:27 | * | wishi_ quit (Ping timeout: 240 seconds) |
08:23:32 | FromGitter | <mratsim> or another: https://github.com/status-im/nim-decimal |
08:27:27 | * | wishi joined #nim |
08:29:39 | FromGitter | <sherjilozair> @mratsim Would I also need to add declarations for all the functions like `proc func_name*() {.stdcall, importc.}` ? |
08:32:06 | FromGitter | <mratsim> I just used c2nim to generate that |
08:32:47 | FromGitter | <mratsim> if you {.compile: “foo.c”.} at least you don’t need to declare importc: “mpdecimal_add”.} |
08:32:59 | FromGitter | <mratsim> if the function have the same name |
08:33:22 | FromGitter | <mratsim> for call convention I’m just blind guessing between cdecl and stdcall :D |
08:35:03 | FromGitter | <mratsim> also you can use a template if you do the same custom thing all over again |
08:35:59 | FromGitter | <mratsim> here is a basic example to lift a unary function so that it works on Tensor: https://github.com/mratsim/Arraymancer/blob/master/src/tensor/ufunc.nim#L28 |
08:38:09 | FromGitter | <mratsim> And here is an example of how I use template to wraps C++ Cuda function: https://github.com/mratsim/Arraymancer/blob/master/src/tensor/private/p_kernels_interface_cuda.nim#L23 |
08:38:44 | PMunch | gogolxdong, no I haven't tried websockets |
08:39:07 | PMunch | Did you figure out the package statement by the way? |
08:39:53 | FromGitter | <gogolxdong> add package statement just goes wrong. |
08:42:18 | PMunch | example1 uses a package statement |
08:43:27 | FromGitter | <sherjilozair> Thanks a lot @mratsim ! |
08:47:40 | FromGitter | <gogolxdong> @PMunch , package statement have to be behind syntax="proto3" |
08:48:22 | PMunch | Yes, as per the spec |
08:49:01 | PMunch | The first line of the file specifies that you're using proto3 syntax: if you don't do this the protocol buffer compiler will assume you are using proto2. This must be the first non-empty, non-comment line of the file. |
08:49:13 | PMunch | ^ From the protobuf specification |
08:49:51 | PMunch | And my implementation only supports proto3, hence you must have the syntax line as the first non-whitespace, non-comment line in your definition |
08:52:39 | * | floppydh quit (Remote host closed the connection) |
08:53:29 | * | floppydh joined #nim |
08:59:35 | * | brainproxy quit (Ping timeout: 240 seconds) |
09:04:47 | FromGitter | <Varriount> Tanger: Hmm. Well, the simplest way would be to have a macro that is used as a pragma |
09:05:25 | FromGitter | <Varriount> It would take in the procedure definition, and output the same definition + a call to add the procedure pointer to the sequence. |
09:06:46 | FromGitter | <Varriount> The downside is that this would be done at runtime. A compile-time approach is possible, but would be more complex. |
09:11:09 | * | Trustable joined #nim |
09:27:36 | * | CodeVance joined #nim |
09:28:57 | FromGitter | <xmonader> @dom96 can you review https://github.com/nim-lang/nimble/pull/483/files ? nimble enhancement to show pr url after successfully executing nim publish? |
09:37:55 | FromGitter | <sherjilozair> Is this not possible `proc f(x = 0, y = 0) = return 'something'; echo f(y=0)` ? |
09:38:19 | FromGitter | <xmonader> echo after return? |
09:40:58 | FromGitter | <narimiran> you didn't define the return type |
09:41:11 | FromGitter | <sherjilozair> No, passing later default arguments. Never mind, it was another issue. |
09:49:08 | FromGitter | <mratsim> yes it works |
09:51:38 | * | leorize quit (Quit: WeeChat 2.1) |
10:00:59 | * | Vladar quit (Quit: Leaving) |
10:31:41 | * | kier quit (Read error: Connection reset by peer) |
10:32:50 | * | kier joined #nim |
10:35:23 | * | bwlang_ joined #nim |
10:44:01 | * | NimBot joined #nim |
10:57:41 | * | natrys joined #nim |
11:13:16 | * | brainproxy joined #nim |
11:15:43 | FromGitter | <sherjilozair> So the manual lists a "Horrible example" of interfacing with a C++ library, but no good way. Where can I find a good way of interfacing with c++ library? |
11:17:47 | PMunch | Link? |
11:17:51 | PMunch | To the horrible example? |
11:18:05 | PMunch | Most of the time you would use c2nim on the header file for the library |
11:18:14 | FromGitter | <sherjilozair> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-importcpp-pragma |
11:18:20 | PMunch | That should create a Nim/C++ binding |
11:18:51 | FromGitter | <sherjilozair> Does c2nim also create objects for classes? |
11:19:57 | PMunch | I think so |
11:20:25 | PMunch | The idea is to only have to run it through c2nim to be able to use it in Nim. But it's not always 100% |
11:21:12 | FromGitter | <sherjilozair> Is there an example `package.cfg` I can see? |
11:22:53 | PMunch | package.cfg? |
11:23:22 | FromGitter | <sherjilozair> To use with nimgen. |
11:24:45 | PMunch | Oh with nimgen.. |
11:24:53 | PMunch | Uhm, not sure really. Haven't used it myself |
11:26:25 | FromGitter | <sherjilozair> I've never been able to run c2nim, only nimgen. |
11:26:50 | FromGitter | <sherjilozair> I called gcc -E on the header file, and then `c2nim -cpp process_header.h` and that gave me an error. |
11:27:01 | * | bwlang_ quit (Quit: bwlang_) |
11:27:07 | FromGitter | <sherjilozair> `/Users/sherjilozair/nim-sfml/binding/window.h(57, 23) Error: identifier expected, but found '( (pxParLe)'` |
11:33:51 | PMunch | Hmm, not quite sure what that is. Haven't used c2nim all that much myself |
11:34:11 | PMunch | Maybe check with dom96 if he can help |
11:34:16 | FromGitter | <data-man> @sherjilozair: c2nim don't supports all horrible constructions of C |
11:34:34 | PMunch | Are you wrapping SFML by the way? |
11:34:37 | FromGitter | <sherjilozair> Yes. |
11:34:53 | PMunch | Oh hi data-man, did you see my PR to the repo you sent me yesterday? |
11:35:01 | PMunch | Cool! |
11:35:05 | FromGitter | <sherjilozair> I'm trying to use nimgen now. How can I get it to include <> includes ? |
11:35:26 | FromGitter | <data-man> @PMunch: Hi! Yes, thanks! |
11:37:40 | FromGitter | <data-man> @sherjilozair: For examples look at other bindings by genotrance: nimssl, ssh, rax, bass, ... |
11:38:32 | FromGitter | <data-man> E.g. https://github.com/genotrance/nimssh2/blob/master/nimssh2.cfg |
11:39:32 | FromGitter | <sherjilozair> All of them are C, not c++. |
11:39:55 | PMunch | data-man, I also wrote this: https://peterme.net/handling-files-in-nim.html which is mostly about binaryparse |
11:41:25 | PMunch | You know that https://github.com/oprypin/nim-csfml exists right? Trying to get away from the destructor stuff I assume? |
11:43:54 | FromGitter | <data-man> @PMunch: Yesterday you already boasted by this. :-D |
11:44:31 | PMunch | Oh right, you were on yesterday :P |
11:44:53 | PMunch | I was getting tired and heading off for bed, just dropped the link and walked away from the machine more or less |
11:46:40 | dom96 | So I haven't used c2nim for C++ wrapping |
11:46:45 | dom96 | Not sure how well it works |
11:47:24 | FromGitter | <sherjilozair> Doesn't seem to be working at all, @dom96. Let me know if you try and it works for you. |
11:47:49 | dom96 | sherjilozair: what issues are you seeing? |
11:48:25 | FromGitter | <sherjilozair> @dom96 I get parse errors. I was using it on SFML, which is a fairly typical C++ library. |
11:50:02 | dom96 | c2nim needs some help sometimes |
11:50:26 | dom96 | so you may need to patch the header a little |
11:54:15 | FromGitter | <sherjilozair> I'm trying nimgen on a C library now (csfml), and it seems to have stuck in an infinite recursion. |
11:54:33 | FromGitter | <sherjilozair> Hasn't returned after 10 minutes on a 500 lines header file. |
12:08:38 | * | floppydh quit (Quit: WeeChat 2.1) |
12:09:31 | FromGitter | <narimiran> very nice to see more activity on /r/nim in recent days |
12:11:39 | * | floppydh joined #nim |
12:18:27 | * | bwlang_ joined #nim |
12:21:58 | * | xkapastel quit (Quit: Connection closed for inactivity) |
12:24:21 | PMunch | narimiran, yes indeed |
12:24:52 | PMunch | I particularily enjoy the "Nim day #" stuff, interesting to always have a new little project to look through in the morning :) |
12:32:20 | CodeVance | I dont see nim day one |
12:33:02 | CodeVance | Is it going to be a nim week or a nim month |
12:33:47 | * | vivus joined #nim |
12:34:14 | shashlick | sherjilozair: check out nimfuzz which is processed using --cpp |
12:34:29 | shashlick | https://github.com/genotrance/nimfuzz |
12:35:08 | shashlick | gcc -E includes all the standard include file defs which have to be filtered out, nimgen does that for you |
12:35:12 | PMunch | I think this was day one CodeVance: https://www.reddit.com/r/nim/comments/8facba/dmidecode_parsing_library_and_a_walkthrough/ |
12:36:09 | shashlick | sherjilozair: post what you have so far in your cfg and I can take a look in a couple hours |
12:39:23 | shashlick | Also nimgen is far from performant, if someone can code review and suggest improvements, will be appreciated. Lots of string manipulation which could do with optimization |
12:40:16 | FromGitter | <narimiran> @CodeVance: "nim week #" might be interesting too. to see some more complex projects done each week |
12:40:39 | FromGitter | <sherjilozair> shashlick: https://gist.github.com/sherjilozair/fd008b91f633d47e43f8aaea4f76093d |
12:41:25 | FromGitter | <sherjilozair> And this is the file: https://github.com/SFML/CSFML/blob/master/include/SFML/Window/VideoMode.h |
12:45:59 | * | Vladar joined #nim |
12:46:06 | CodeVance | Shashlick, you develop nimgen? |
12:46:11 | shashlick | Ya |
12:47:06 | CodeVance | Performant in what sense, like the output or nimgens execution? |
12:51:39 | yglukhov | which is faster? "myVar > 0" or "myVar != 0". @mratsim? ;) |
12:52:12 | FromGitter | <xmonader> @CodeVance dmidecode library was day 1 but I couldn't change the title sadly |
12:52:19 | Araq | myVar != 0 might produce slightly shorter code |
12:52:32 | Araq | depending on the architecture. |
12:53:54 | FromGitter | <xmonader> @CodeVance I hope I keep it can keep the nim day going for a while to have enough as introductory material for people coming to nim |
12:54:28 | yglukhov | Araq: does it make any difference for i386 or amd64? |
12:54:56 | FromGitter | <xmonader> Interestingly, today i was trying to use mdbook project to generate an online book but the underlying library doesn't support nim :'( |
12:58:28 | PMunch | You might have luck with adoc |
12:58:45 | CodeVance | Xmonader, its good, small yet illustrative code |
12:59:38 | FromGitter | <xmonader> @Pmunch adoc? asciidoc? |
13:00:38 | Araq | yglukhov: no. |
13:01:16 | FromGitter | <xmonader> @CodeVance thanks, hopefully more to come :) |
13:01:23 | * | athenot joined #nim |
13:02:20 | PMunch | xmonader, yes asciidoc |
13:03:25 | FromGitter | <xmonader> I'll check it, thank you:) |
13:03:28 | * | leorize joined #nim |
13:03:50 | PMunch | xmonader, or even use RST which is the format used for Nim's documentation |
13:03:58 | PMunch | It should be convertible to most things as well |
13:04:52 | PMunch | https://rsmith.home.xs4all.nl/miscellaneous/making-my-first-epub.html < RST to EPUB |
13:04:53 | FromGitter | <xmonader> @PMunch, I prefer markdown because of the easy syntax :( |
13:05:08 | PMunch | RST isn't that much harder when you get used to it |
13:05:37 | FromGitter | <xmonader> also, today i tried softcover.io today, and it's amazing generating beautiful html, couldn't get the other builders to run :S |
13:09:28 | FromGitter | <xmonader> wow, in mdbook nim is supported but under the old name `nimrod` :D |
13:09:57 | PMunch | Yeah, that's a common theme :P |
13:14:39 | * | ieatnerds joined #nim |
13:14:39 | * | ieatnerds quit (Remote host closed the connection) |
13:18:38 | * | ieatnerds joined #nim |
13:18:40 | * | dddddd joined #nim |
13:26:12 | * | endragor_ quit (Remote host closed the connection) |
13:29:59 | * | BitPuffin joined #nim |
13:34:24 | PMunch | Hmm, in a template, is there a way to turn an identifier into a string? |
13:35:03 | PMunch | Say I call my template with "myTemplate(hello_world)" I want to both access a variable named hello_world but also use "hello_world" in an error message. |
13:37:03 | Araq | system.astToStr() |
13:39:21 | Araq | https://github.com/nim-lang/Nim/pull/7770 congrats yglukhov for winning the "Nim pure gold" award that I just invented |
13:40:50 | FromGitter | <data-man> Need new labels for awards :) |
13:42:27 | PMunch | Nice, thanks Araq |
13:44:44 | PMunch | Hmm, with that I get a nice erro message with a trace through my templates. When I passed it a string I didn't get that. How come? |
13:45:09 | yglukhov | thanks, Araq :) |
13:45:30 | PMunch | Oh wait, no |
13:45:31 | PMunch | Hmm |
13:46:34 | PMunch | I was getting an error message on my usage.. Is there a way I can make the exception include the position of an identifier? |
13:47:32 | FromGitter | <data-man> Whose PR will have a number 7777? :) |
13:49:31 | yglukhov | data-man: or bug... :) |
13:53:23 | FromGitter | <data-man> Then it most likely will be @mratsim :-D |
13:55:04 | * | miran joined #nim |
13:57:02 | * | xkapastel joined #nim |
14:22:08 | * | floppydh quit (Quit: WeeChat 2.1) |
14:23:24 | FromDiscord | <2vg> awesome yglukhov ... 🎉 |
14:24:17 | dom96 | yeah, this is a really awesome PR |
14:25:02 | * | thor77 quit (Quit: ZNC 1.6.6 - http://znc.in) |
14:25:17 | * | thor77 joined #nim |
14:36:31 | * | max3 joined #nim |
14:37:14 | yglukhov | thanks guys, now who's gonna try and break it? ;) |
14:39:56 | Araq | Status? |
14:41:30 | yglukhov | haha, probably :) |
14:43:35 | FromGitter | <data-man> Oh, Arch got gcc 8.1 |
14:45:07 | * | bwlang_ quit (Quit: bwlang_) |
14:48:41 | * | bwlang_ joined #nim |
14:49:51 | dom96 | yglukhov: You should really join the 2-space indent party :) |
14:50:52 | dom96 | Any ideas whether this affects the performance much? |
14:51:33 | dom96 | I was going to try and break it but your tests look discouragingly thorough :) |
14:53:45 | PMunch | Can someone tell me why this works: http://ix.io/19pB/nim, while this doesn't: http://ix.io/19pC/nim ? It fails with this error http://ix.io/19pD/ |
14:53:51 | * | avsej quit (Ping timeout: 240 seconds) |
14:58:59 | * | avsej joined #nim |
14:58:59 | * | avsej quit (Changing host) |
14:58:59 | * | avsej joined #nim |
15:03:07 | yglukhov | dom96: about performance, i don't think it will be noticeable. while the old code could technically flow straight between the states, that was unlikely, as most of the time the iter is interrupted anyway. the new code technically jumps between the states by breaking the loop an starting all over. this should not really be noticeable, and in reality it should be equal to the overhead of old iters. yields in try-catch-finally surely impliy just a |
15:03:08 | yglukhov | bit more overhead, as there is additional control flow logic. It is designed to work as fast as possible when no exceptions happen. propagating exception through multiple levels of try-catch-finally blocks is somewhat expensive, as every propagation reraises. |
15:04:00 | dom96 | sounds good :D |
15:04:15 | dom96 | I'm going to start ripping out the crappy try transformation in the async macro now |
15:05:05 | * | vegax87 quit (Changing host) |
15:05:05 | * | vegax87 joined #nim |
15:05:05 | * | vegax87 quit (Changing host) |
15:05:05 | * | vegax87 joined #nim |
15:06:15 | dom96 | Araq: Is this worth marking as high priority? https://github.com/nim-lang/Nim/issues/5617 |
15:06:43 | * | smt quit (Read error: Connection reset by peer) |
15:12:12 | yglukhov | dom96: i was also willing to simplify asyncmacro by making await a template |
15:12:41 | yglukhov | and by removing try-catch transforms of course =) |
15:13:02 | dom96 | One step at a time :) |
15:13:03 | yglukhov | so, just keep in mind we need a nice await template ;) |
15:14:55 | dom96 | I think I now remember the reason why I didn't use a template for await in the first place: Nim didn't support (yield x; x.read()) back then. |
15:15:05 | yglukhov | ;) |
15:15:25 | yglukhov | now nim supports yield (yield 1; 2) |
15:15:36 | dom96 | :D |
15:15:54 | yglukhov | (yield (yield (yield 0; 1)); 2) |
15:16:02 | dom96 | yieldception |
15:16:39 | yglukhov | i guess i'll add a few more tests... |
15:16:48 | dom96 | hehe |
15:17:39 | yglukhov | and reindent :P |
15:32:59 | * | smt joined #nim |
15:38:19 | FromDiscord | <awr> so like all of the nim code I've ever seen seems to stick to the standard "style" (that is https://nim-lang.org/docs/nep1.html) but I have to ask, who isn't using this style? |
15:40:35 | FromDiscord | <awr> i like that nim provides the case insensitivity stuff but i've noticed nim code doesn't share C/C++'s stylistic variability |
15:41:59 | FromDiscord | <awr> "braces on the same line!" "braces on the next line!" "4-space!" "2-space!" "snake_case!" "camelCase!" "hungarian notation!" "_t prefix!" |
15:42:22 | FromGitter | <kayabaNerve> I don't use the result variable most times. I use 4 spaces. |
15:43:07 | FromGitter | <kayabaNerve> I've been told I have very nice code though. https://github.com/kayabaNerve/Pacman3d |
15:44:04 | dom96 | kayabaNerve: far too much indentation in the object constructors IMO |
15:44:49 | dom96 | otherwise nice |
15:44:50 | FromGitter | <kayabaNerve> Boi, I don't care I bought your book, fite me |
15:45:12 | FromGitter | <kayabaNerve> Thanks for the feedback ;p |
15:45:32 | miran | waaay too much indentation, indeed |
15:45:51 | FromDiscord | <awr> when i do indentation for parameters i usually keep the first parameter on the same line as the open parens |
15:46:03 | FromDiscord | <awr> and put the closing parens on the same line as the final parameter |
15:46:04 | dom96 | kayabaNerve: https://media1.giphy.com/media/pp33lEFcdDGRG/giphy.gif |
15:46:30 | FromGitter | <kayabaNerve> The indentation is because I was trying to line up the parantheses for all my one lined math formulas. |
15:46:54 | FromGitter | <kayabaNerve> And then I did it once so it become practice for everything |
15:47:47 | Araq | dom96: that is part of the plan (TM) |
15:48:06 | Araq | but I would fix the contruction APIs instead of adding a setter |
15:48:07 | FromDiscord | <awr> also wrt https://github.com/kayabaNerve/PacMan3D/blob/master/main.nim#L79 have you seen filterIt() before |
15:48:21 | dom96 | Araq: Okay, marking as high priority then |
15:48:39 | miran | kayaba: and if you change the name of your type (so its length changes), you'll need to re-align everything.... |
15:48:45 | * | PMunch quit (Quit: Leaving) |
15:49:29 | dom96 | We need to get nimpretty up and running ASAP |
15:49:32 | FromGitter | <xmonader> the pegs documentations needs tons of work :S how do i visit the nodes? any idea? |
15:49:36 | FromGitter | <kayabaNerve> miran: Worth it |
15:49:57 | miran | ok, i surrender |
15:50:24 | FromGitter | <kayabaNerve> have I met a French person now |
15:50:34 | Araq | xmonader: pegs don't have "nodes" |
15:50:35 | miran | hahaha no |
15:50:59 | FromGitter | <kayabaNerve> You are a person that surrenders. What's the difference? *I'll stop* |
15:51:00 | dom96 | Yardanico: Internal error already :) |
15:51:28 | FromGitter | <kayabaNerve> Been a few months since I've spoken here. |
15:51:42 | * | CodeVance quit (Ping timeout: 256 seconds) |
15:51:45 | * | leorize quit (Quit: WeeChat 2.1) |
15:51:48 | FromGitter | <xmonader> @Araq so visiting the matching rules isn't possible? |
15:51:50 | FromGitter | <kayabaNerve> Trying to remember why I reopened Gitter. Have had it open for a few days now |
15:51:50 | Araq | dom96: nimpretty would be good, alternatively we can try to convince people that "tooling" is not the same as a freaking pretty printer which exist since the 80ies and found no love back then |
15:52:04 | * | leorize joined #nim |
15:52:18 | dom96 | Araq: Not sure what you mean |
15:52:22 | Araq | now they are more important than a type checker, I know, I know |
15:55:02 | dom96 | er, why did I write Yardanico. |
15:55:14 | dom96 | yglukhov: Internal error already :) https://github.com/nim-lang/Nim/pull/7770#issuecomment-386645116 |
15:55:22 | * | vivus quit (Quit: Leaving) |
15:55:53 | Araq | huh? why was this closed? |
15:56:08 | yglukhov | found some bugs. fixing... |
15:56:13 | yglukhov | dom96: thanks |
16:01:58 | * | xkapastel quit (Quit: Connection closed for inactivity) |
16:10:06 | FromGitter | <arnetheduck> yapf port FTW! it works - it's magic - it's the greatest invention and time-saver since.. compilers! |
16:15:08 | * | CodeVance joined #nim |
16:16:41 | * | jxv joined #nim |
16:21:54 | FromGitter | <xmonader> @Araq I checked couple of libraries on Peg, lots of them provide a way to create a pegged parse tree? |
16:36:11 | Araq | arnetheduck: so much for the "code is read much more often than written" argument huh. writing code now takes so much time we need to tool the heck out of it |
16:38:37 | * | Ven`` joined #nim |
16:39:59 | * | CodeVance quit (Ping timeout: 256 seconds) |
16:42:03 | * | Trustable quit (Remote host closed the connection) |
16:42:14 | FromGitter | <brentp> the new zero-copy interoperability with cstring will avoid a copy for $cstring? |
16:44:12 | leorize | brentp: It's not new and only applies to string -> cstring IIRC. I think $cstring w still needs a copy, as we can't be sure that the cstring would stay allocated |
16:44:40 | FromGitter | <brentp> that makes sense. |
16:49:02 | * | smt` joined #nim |
16:49:05 | * | sendell quit (Remote host closed the connection) |
16:51:32 | * | xkapastel joined #nim |
16:53:01 | * | smt quit (Ping timeout: 256 seconds) |
16:54:08 | * | leorize quit (Quit: WeeChat 2.1) |
16:57:56 | * | jxv left #nim ("string can snapped") |
17:02:39 | * | smt` quit (Read error: Connection reset by peer) |
17:08:15 | * | leorize joined #nim |
17:09:38 | * | Jesin joined #nim |
17:11:07 | * | CodeVance joined #nim |
17:27:22 | * | PMunch joined #nim |
17:28:01 | * | CodeVance quit (Ping timeout: 248 seconds) |
17:32:40 | shashlick | does anyone know how to get the --docSeeSrcUrl to work? |
17:34:41 | * | noonien joined #nim |
17:38:16 | PMunch | https://github.com/nim-lang/Nim/blob/devel/config/nimdoc.cfg#L62 |
17:38:54 | PMunch | Basically HTML to output with three substitution variables |
17:39:50 | PMunch | shashlick ^ |
17:40:03 | * | Jesin quit (Remote host closed the connection) |
17:40:29 | shashlick | so i tried running without changing the file on an existing .nim file and it generates no src urls |
17:42:17 | shashlick | I also tried changing nimdoc.cfg (cached copy in the same dir as .nim file, assuming it works similar to nim.cfg overrides) and that did nothing either |
17:45:31 | PMunch | Ahh, it appears you need both a nimdoc.cfg file specifying the pattern, and a docSeeSrcUrl option |
17:46:00 | * | CodeVance joined #nim |
17:50:00 | * | yglukhov quit (Remote host closed the connection) |
17:50:36 | * | yglukhov joined #nim |
17:55:05 | * | yglukhov quit (Ping timeout: 240 seconds) |
17:56:37 | * | yglukhov joined #nim |
17:59:00 | shashlick | i did that, but does it have to be the global file or can you simply edit the local copy? |
17:59:30 | shashlick | anyway, i don't see where this option is used, if you check tools\nimweb.nim, it too doesn't actually run a nim command with that flag |
17:59:44 | * | yglukhov quit (Read error: Connection reset by peer) |
18:00:20 | * | yglukhov joined #nim |
18:00:43 | * | lukas_ joined #nim |
18:04:55 | FromGitter | <data-man> @shashlick: grep seesrc in the compiler's dir |
18:07:59 | * | natrys quit (Ping timeout: 276 seconds) |
18:14:47 | * | yglukhov quit (Remote host closed the connection) |
18:20:22 | * | Sembei joined #nim |
18:21:35 | * | Pisuke quit (Ping timeout: 240 seconds) |
18:23:01 | * | jrbrt joined #nim |
18:23:34 | * | ieatnerds quit (Quit: Leaving) |
18:23:41 | * | Hycryon joined #nim |
18:23:55 | * | Hycryon quit (Client Quit) |
18:24:11 | * | Hycryon joined #nim |
18:32:22 | miran | is the author of NiGui here? |
18:34:44 | shashlick | data-man: looking at the code |
18:39:08 | * | Sembei quit (Quit: WeeChat 2.2-dev) |
18:40:07 | * | Sembei joined #nim |
18:42:05 | * | natrys joined #nim |
18:46:24 | * | Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
19:03:04 | * | jrbrt quit (Quit: jrbrt) |
19:03:20 | Araq | miran: he used to be around iirc |
19:03:38 | FromGitter | <xmonader> my pipe operator ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5aecae8a1eddba3d04d24835] |
19:03:46 | FromGitter | <xmonader> definitely should be part of nim xD |
19:04:12 | miran | xmonader: pipe in nim is.... wait for it.... `.` (yeah, dot) |
19:04:33 | FromGitter | <xmonader> . :/ as in compose `dot` ? |
19:04:53 | FromGitter | <xmonader> oh u mean for the ufcs |
19:04:53 | miran | you can do `"hello".toUpperAscii().reverse().whatever()` |
19:05:25 | FromGitter | <xmonader> yea yea u r right, i only think of piping through |> or >>= operators |
19:05:29 | * | bwlang_ quit (Ping timeout: 260 seconds) |
19:09:08 | FromGitter | <Vindaar> @miran @xmonader and in most (?) cases you can even leave out the `()` |
19:09:54 | FromGitter | <xmonader> btw if i leave the parens how do i get a reference to the proc? |
19:10:42 | Araq | f a # call |
19:10:49 | Araq | f # proc pointer |
19:11:05 | Araq | f a, b # call with 2 args, only valid in a statement context |
19:11:31 | Araq | g f a, h y # g(f(a), h(y)) |
19:11:53 | FromGitter | <xmonader> and .len gives a pointer not a proc call? |
19:11:56 | Araq | dunno why so many people stumble upon this, it just works (TM) |
19:12:11 | miran | Araq: why can't we do `let a = f b, c`? |
19:12:16 | Araq | x.len same as len x |
19:12:26 | Araq | or len(x) for that matter. |
19:12:49 | Araq | the feature is called "syntactic harmony" in my book |
19:12:55 | Araq | lol |
19:13:07 | FromGitter | <xmonader> Your book? Which book :D |
19:13:23 | miran | his figurative book :D |
19:13:42 | Araq | "Learning Nim as your first and only language" |
19:14:30 | FromGitter | <xmonader> thought that was lisp xD |
19:14:45 | Araq | miran: because we were conservative, we left 'let a = f b, c' for the future |
19:15:06 | miran | hopefully this future will come soon :) |
19:15:52 | FromGitter | <data-man> I hope that this book will be read more easily than the works of Knuth. :) |
19:15:53 | Araq | well as a start you could fix the downright embarrassing issue with unary operators |
19:16:09 | Araq | f -3 doesn't parse iirc |
19:16:18 | miran | ouch! |
19:16:55 | * | lukas_ quit (Quit: leaving) |
19:17:03 | miran | is this related? https://github.com/nim-lang/Nim/issues/7685 |
19:17:32 | Araq | not sure, I still need to look into that one |
19:17:49 | Araq | but the rule is rather clear, be consistent in the spacing around binary operators |
19:18:10 | Araq | so i-1 and i - 1 are valid and i- 1 is not |
19:18:15 | miran | i usually am. i have discovered this after making a typo (leaving a space out) |
19:18:19 | Araq | and i -1 would be "apply -1 to i" |
19:18:35 | Araq | and probably the error message could be improved |
19:18:49 | Araq | well they always can. |
19:21:22 | shashlick | araq: can nimdoc.cfg be overridden like nim.cfg? |
19:22:14 | * | smt joined #nim |
19:23:19 | PMunch | Hmm, that feeling when you have a problem in a >1500 line project and you are just completely unable to figure out what causes it or create a minimal example.. |
19:27:32 | miran | PMunch: it is friday night, that should be postponed ;) |
19:27:46 | PMunch | I know, but it's been bugging me for ages.. |
19:28:01 | miran | btw, i'll have the first "beta version" of my tutorial for you hopefully by the end of this weekend |
19:28:08 | PMunch | Oh nice |
19:28:55 | miran | this took waaaaay too long time, and it is time to hear some feedback.... |
19:29:20 | PMunch | Looking forward to it :) |
19:29:42 | PMunch | http://ix.io/19qw <- that's the output of the macro, along with the error. Is it just me or does that look correct? |
19:30:56 | PMunch | The error is on the line that calls the macro, and the last thing it does before returning is to create that output |
19:33:31 | Araq | shashlick: it can. |
19:34:01 | shashlick | ok, it wasn't clear that you needed --git.url also on the command line, had to look thru code to figure that out |
19:35:29 | Araq | PMunch: gimme something complete |
19:35:45 | dom96 | shashlick: If you can please update the docs for this. |
19:36:02 | shashlick | sure |
19:39:39 | * | smt quit (Read error: Connection reset by peer) |
19:39:52 | FromGitter | <xmonader> ok who is ready for nim day 6? |
19:40:25 | * | smt joined #nim |
19:41:56 | * | jrbrt joined #nim |
19:44:08 | dom96 | I'm ready :) |
19:45:08 | dom96 | So guys, I will finally be investing some development time into our forum. Apart from a refreshed design what features should be prioritised? |
19:45:24 | FromGitter | <xmonader> nice ^_^ |
19:45:29 | shashlick | mobile view! |
19:45:50 | miran | make `quote` work as it has worked 15 years ago on most forums ;) |
19:45:59 | shashlick | araq: I don't think the --docSeeSrcUrl param is consumed at all, you need to use --git.url: and --git.commit: and that's good enough |
19:46:19 | dom96 | miran: `> ...` not good enough? :) |
19:46:46 | miran | nope, as i don't see the author of quoted text nor i can easily click to go to the original comment |
19:47:01 | dom96 | Fair. I was thinking about adding something a bit more detailed. |
19:47:20 | dom96 | Probably integrated into RST, but I'll add a little editor UI that will make it easy to insert |
19:47:45 | miran | without exaggeration, forums in 2003 had this feature |
19:48:02 | dom96 | miran: yes, well, Reddit nor HN have this feature :P |
19:49:56 | shashlick | do we have a nim => html code view generation? |
19:50:05 | dom96 | yes, many |
19:50:34 | dom96 | htmlgen module in stdlib, filters, multiple Nimble packages |
19:51:13 | shashlick | no I mean, a syntax highlighted output of nim code in html format |
19:51:32 | miran | another thing: when i click on a user, it would be nice to see his/her post history |
19:51:37 | dom96 | yes, the doc gen has a syntax highlighter |
19:51:51 | dom96 | miran: oh yes, that's a must |
19:52:58 | dom96 | On a scale of GNU Mailman to Discourse, how much JS should I utilize? :P |
19:53:34 | dom96 | My opinion on this is that Discourse relies on JS far too much (just like most "web apps" these days) |
19:53:50 | FromGitter | <data-man> It would be great to have subforums. But this will require a lot of work for migrating existing messages. |
19:53:53 | dom96 | But of course, using JS is useful for certain features. |
19:53:58 | miran | as little as possible (but not 'littler') :D |
19:54:13 | dom96 | data-man: I'd rather go the Discourse "categories" route |
19:54:27 | dom96 | and host multiple instances if necessary |
19:54:55 | dom96 | btw I'm amazed that Discourse are charging $100/month for hosted instances of Discourse |
19:54:59 | miran | btw, see this forum thread for some inspiration :) https://forum.nim-lang.org/t/3534/ |
19:56:00 | shashlick | dom96: what I want is to generate a static html file that contains all the nim code highlighted, similar to how code shows up in github, not the docgen output, the actual source code |
19:57:30 | dom96 | shashlick: https://github.com/nim-lang/Nim/blob/devel/lib/packages/docutils/highlite.nim |
19:57:56 | dom96 | I don't think it generates HTML though |
19:57:58 | FromGitter | <data-man> Is it so important to have a forum engine written on Nim? |
19:58:03 | dom96 | But you can see how it's used in the related modules |
19:58:23 | dom96 | data-man: no, but it's a great opportunity to test Nim |
19:58:33 | shashlick | thanks :) |
19:58:56 | dom96 | data-man: I don't want to spend hours writing Ruby plugins for Nim code eval for example |
19:59:26 | FromGitter | <data-man> Why Ruby? |
19:59:48 | FromGitter | <data-man> I prefer FluxBB or SimpleMachineForum |
20:00:05 | dom96 | Because Discourse is currently the best |
20:00:06 | FromGitter | <data-man> Both on PHP :) |
20:00:17 | dom96 | I can safely say that PHP is even worse :) |
20:03:43 | shashlick | https://prismjs.com |
20:03:59 | FromGitter | <data-man> @shashlick: https://github.com/andre-simon/highlight supports Nim |
20:04:00 | dom96 | SSL error |
20:04:24 | dom96 | So it seems people also really want emails for forum threads |
20:05:05 | dom96 | We might have to start paying mailgun :( |
20:05:39 | * | athenot quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
20:06:03 | federico3 | :( |
20:06:17 | federico3 | why mailgun? |
20:06:30 | dom96 | what else is there? |
20:08:11 | federico3 | postfix |
20:08:28 | dom96 | yeah, been there |
20:08:42 | dom96 | I don't want to deal with maintaining my own outgoing MTA |
20:09:39 | shashlick | thanks data-man, will check it out |
20:10:15 | dom96 | shashlick: If the language for the syntax highlighter doesn't matter then I would suggest pygments |
20:12:13 | shashlick | good idea, i'll check dom96 |
20:14:04 | FromGitter | <data-man> Chroma for Go also supports Nim. Based on Pygments. |
20:16:30 | federico3 | dom96: why do you have to send mails directly to people? We were using an external mailing list until you stopped smtp |
20:17:29 | dom96 | federico3: I need to send emails directly to people at least for email confirmation/password resets. |
20:17:45 | * | miran quit (Ping timeout: 264 seconds) |
20:18:01 | federico3 | ah that's a different use-case |
20:18:25 | dom96 | But sending emails when people are mentioned or maybe "follow" a thread (if that feature ever shows up) would be useful |
20:18:59 | dom96 | Most users won't want an email for every new thread |
20:19:26 | dom96 | also I wonder if RSS doesn't cover that use case already |
20:21:44 | shashlick | pygments is simple enough |
20:24:19 | FromGitter | <data-man> Or to add new command src2html to the compiler :) |
20:32:56 | * | Vladar quit (Quit: Leaving) |
20:34:10 | * | BitPuffin quit (Remote host closed the connection) |
20:36:10 | * | ldlework quit (Ping timeout: 256 seconds) |
20:43:18 | Araq | dom96: if you add a column "markup" to every post it's easy to support both "real" markdown and RST |
20:43:54 | dom96 | Araq: I'd rather fork the RST parser and make it support more markdown |
20:44:02 | Araq | I don't mind markdown, what I do mind is if the old posts don't continue to work |
20:44:49 | Araq | why fork it though, as long as it doesn't cause conflicts with RST most features you add would be welcome to Nim's doc generator too |
20:45:02 | dom96 | yay, looks like httpclient is now broken thanks to the latest Nim string changes :( |
20:45:32 | Araq | looks like it didn't have enough tests :P |
20:45:57 | Araq | I touched pretty much every stdlib module after these string changes. don't be so lazy and do the same. |
20:46:16 | dom96 | This is concerning though |
20:46:23 | dom96 | Everything will have this bug |
20:46:38 | Araq | --laxStrings:on for the transition |
20:47:35 | dom96 | Here is what we should do: add a check for this case and print a nicer error message |
20:47:38 | dom96 | in debug mode at least |
20:47:45 | dom96 | and include the information about --laxStrings |
20:48:06 | dom96 | That way we won't have to guess what the problem is |
20:48:52 | Araq | since it was an unusual feature to begin with I'm not sure how much code outside of Nim's core is affected |
20:49:37 | dom96 | You've taught me to rely on this so it undoubtedly rubbed off on others |
20:49:43 | dom96 | it's worth to make the error message more user friendly |
20:50:02 | * | nsf quit (Quit: WeeChat 2.0.1) |
20:50:22 | dom96 | can I do it? |
20:50:39 | Araq | many don't parse strings at all or use the stdlib's parsers or "parse" via "split" (terrible) |
20:51:04 | Araq | but sure do it. |
20:51:35 | dom96 | where is the relevant proc? |
20:52:16 | Araq | there is none, it's generic index checking, you would need to introduce one |
20:52:28 | Araq | chckIndex() compilerproc iirc |
20:52:58 | dom96 | argh |
20:53:21 | Araq | lol |
20:53:57 | Araq | btw soon --laxStrings:on will produce worse code :P |
20:54:04 | Araq | I mean |
20:54:15 | Araq | won't see the new optimizations I'm working on |
20:54:15 | * | jrbrt quit (Quit: jrbrt) |
20:55:55 | dom96 | These changes are soooo horrible https://github.com/nim-lang/Nim/commit/0fad659bf72a48d076978655dd23fe369c2d232e :'( |
20:56:05 | dom96 | length checks everywhere |
21:00:16 | * | bwlang joined #nim |
21:00:20 | Araq | could have introduced a shortcut but I was lazy |
21:00:32 | Araq | and mindlessly corrected everything instead |
21:01:06 | FromGitter | <xmonader> Day 6: https://github.com/xmonader/nistow writing stow in nim |
21:01:08 | dom96 | Yay, can't wait for the imminent off-by-one errors |
21:01:13 | Araq | personally I would have used s{i} or something but I know how much #nim likes my own notations |
21:01:27 | * | jsomedon joined #nim |
21:01:45 | dom96 | ugh, adding this friendly message is a PITA |
21:02:01 | Araq | "booh, that notation is new/Perlish/not-in-Python/not-in-C, can't be good" |
21:02:41 | dom96 | oh well, maybe I'll end up wasting hours of my life trying to figure out a bug caused by this breaking change |
21:02:54 | dom96 | Then I'll decide to add this friendly message... or maybe just rage quit |
21:03:24 | Araq | sorry I listen to my community. |
21:03:39 | dom96 | btw the changelog entry for this should be under "breaking changes" not under "language changes"! |
21:05:19 | * | jjido joined #nim |
21:06:21 | * | Sembei quit (Ping timeout: 264 seconds) |
21:08:54 | * | jrbrt joined #nim |
21:09:05 | shashlick | yay, documentation for nimgen wrappers is finally up: e.g. http://nimgen.genotrance.com/nimssl/ |
21:11:59 | * | Sembei joined #nim |
21:17:42 | Araq | shashlick: no NEP-1? :-( |
21:18:06 | * | jsomedon left #nim ("WeeChat 2.1") |
21:26:14 | shashlick | baby steps :) |
21:27:21 | shashlick | that website's actually code generated by c2nim of the .h files, are you talking about that? |
21:31:07 | Araq | c2nim without its --nep1 flag, yes |
21:32:12 | shashlick | oh I didn't know that existed |
21:32:13 | Araq | muhahaha found a GC/codegen bug. one of these bugs which lurk in the code for a decade |
21:32:18 | CodeVance | nice work xmonader |
21:32:42 | shashlick | does the generated code completely change? |
21:34:46 | shashlick | wow, changes all the generated output |
21:35:46 | shashlick | i guess i'll leave this as is, else it is hard to refer to the upstream documentation. anyway I'm planning on writing convenience procs over the C api eventually for these wrappers |
21:35:50 | * | jrbrt quit (Quit: jrbrt) |
21:36:02 | shashlick | raw wrappers aren't easy to use with the c interop |
21:38:15 | FromGitter | <xmonader> @CodeVance thanks :) |
21:38:26 | * | jrbrt joined #nim |
21:39:00 | CodeVance | xmonader, where you get your idea? |
21:39:36 | * | jrbrt quit (Client Quit) |
21:40:07 | FromGitter | <xmonader> @CodeVance https://www.gnu.org/software/stow/ for some reason it stopped working for me and i rolled my own https://github.com/xmonader/dotman then thought i'd port it to nim |
21:40:39 | * | jrbrt joined #nim |
21:40:52 | CodeVance | heh XD |
21:41:03 | * | natrys quit (Quit: natrys) |
21:41:13 | CodeVance | I made a micro PR |
21:42:14 | FromGitter | <xmonader> and I merged super quickly xD |
21:43:19 | shashlick | mratsim: when you get a chance, do check out the docs for the nimgen wrappers |
21:43:39 | shashlick | linked from https://github.com/genotrance/nimgen <= i'll update the individual repos in a few hours |
21:44:26 | dom96 | httpbeast started 32 threads on travis :o |
21:46:29 | * | Hycryon quit (Ping timeout: 260 seconds) |
21:51:44 | * | bwlang quit (Quit: bwlang) |
22:21:40 | * | Ven`` joined #nim |
22:23:08 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
22:41:29 | FromGitter | <Varriount> Is that good? |
22:42:09 | * | shield joined #nim |
22:42:36 | shield | hello |
22:43:01 | shield | I have a question if anybody is willing to answer |
22:43:11 | def- | shield: hi. go ahead |
22:44:13 | PMunch | Araq, sorry I was playing borderlands. If you want something complete there's this: https://github.com/PMunch/protobuf-nim/blob/optionmessages/src/protobuf.nim#L648 |
22:44:44 | PMunch | That's he point where it calls the part of that macro that creates the . and .= macros |
22:44:54 | PMunch | shield, don't ask to ask, just fire away |
22:46:28 | shield | oh thanks, well, is there a way to map objects by their types? as in, a table of objects that is hashed by the type of said objects |
22:48:00 | shield | when you add an element it checks if the right sequence is initialized, if so it will append them, then when you need to pull objects of certain types you just write something like getObjects(T) |
22:50:29 | shield | mainly to make creating sequences of objects automatic, when you add a new type of object it will create a new sequence to hold it |
22:50:41 | def- | shield: that sounds an awful lot like a dynamically-typed approach |
22:51:29 | def- | but with a getObjects[T]() you could use generics to achieve something like that |
22:52:57 | def- | if you want runtime-behaviour instead of compile-time though, you might want to go with some wrapper like JsonNodeKind: https://nim-lang.org/docs/json.html#JsonNodeKind |
22:53:17 | FromGitter | <mratsim> @yglukhov, sorry was away until now, !=0 will be faster but that’s like a super micro optimization |
22:55:30 | shield | i'm not trying to fit different kinds of objects in the same array, just make a new array per object type, the equivalent for that in c# would be Dictionary<Type, List<Type>> |
22:56:52 | * | skrzyp1 is now known as skrzyp |
22:57:29 | FromGitter | <mratsim> so you will have an object that will hold one Table for each typekind you can have? |
22:58:05 | FromGitter | <mratsim> dictionary are Table in the tables module btw |
22:58:06 | shield | yes |
23:00:16 | PMunch | https://stackoverflow.com/questions/38133424/any-types-in-tables-table-like-sets-in-nim |
23:00:16 | FromGitter | <mratsim> the fields of the object must be known at compile time, do you know how much type you will have to support? Also do you mind if they go unused (because it will still occupy at least a nil pointer of space even if you don’t associate a seq to it.) |
23:00:25 | PMunch | That's pretty much what you'll end up with |
23:02:14 | FromGitter | <mratsim> yeah the object variant seems to be the cleanest solution |
23:03:01 | * | Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
23:03:42 | shield | I don't mind having a nil pointer, this will only be used in a scene that will hold all kind of objects, i prefer if there was an automatic way to add new types and initialize the correct array for it |
23:05:25 | * | rockcavera quit (Read error: Connection reset by peer) |
23:05:29 | shashlick | @mratsim: got the docs up on all wrappers, hope it makes them a bit more useful |
23:05:46 | * | rockcavera joined #nim |
23:08:49 | FromGitter | <mratsim> @shield I’m not sure I understand if you need that at run-time or at compile-time |
23:09:41 | FromGitter | <mratsim> if types are known beforehand or come say from a DB query or a Json object |
23:10:57 | shield | I want it at run-time, this is for a game so a scene will have to hold different types of objects at different times |
23:12:18 | FromGitter | <mratsim> just use a seq or table or whatever for each types you need in your context/world object |
23:12:55 | FromGitter | <mratsim> and have procs doFoo(scene: var Scene, obj1: YourCustomObject1) = |
23:13:20 | FromGitter | <mratsim> doFoo(scene: var Scene, obj2: YourCustomObject2) = |
23:15:12 | dom96 | For games the natural architecture is to use inheritance with methods |
23:15:53 | PMunch | shield, if you want you could also do something like this: https://github.com/PMunch/SDLGamelib/blob/master/gamelib/ticker.nim |
23:15:55 | dom96 | I personally would just keep everything static though. Have multiple overloaded 'draw' calls, and multiple lists of objects if necessary. |
23:16:23 | PMunch | Depends on your use case of course, but what it does is register a procedure to call instead of an object to call it on |
23:16:32 | shield | so I have to manually add a seq for every new class I add? or it's better to have a type field which I can use to cast to the correct type? |
23:17:10 | PMunch | This is the same but for rendering: https://github.com/PMunch/SDLGamelib/blob/master/gamelib/scenegraph.nim |
23:18:40 | PMunch | Since these only store procs you are able to nest them as well, so you could have a scenegraph with a scenegraph inside to create layers, or if you want to be able to hide all things of one kind for example. |
23:19:29 | PMunch | Might be practical for a particle effect. Create a renderer that draws a lot of particles, add it to the renderer, when they are all done you simply remove the one render proc. |
23:22:59 | shield | i was dealing with collision with certain type of objects, checking the link, it seems that it escaped my radar, thanks! |
23:24:34 | PMunch | If you're looking for collisions you could also take a llook at http://ix.io/19qw |
23:24:44 | PMunch | Woops: https://github.com/PMunch/SDLGamelib/blob/master/gamelib/collisions.nim |
23:25:28 | shield | random question, is dealing with proc references expensive performance wise? |
23:26:11 | PMunch | Don't think so, but I'm not entirely sure.. |
23:26:44 | * | vegax87 quit (Ping timeout: 256 seconds) |
23:27:27 | * | pigmej quit (Ping timeout: 240 seconds) |
23:29:49 | * | pigmej joined #nim |
23:32:05 | * | leorize quit (Quit: WeeChat 2.1) |
23:33:08 | PMunch | Found this on C function pointers "I've looked into the difference of calling a function directly or via a pointer, and on the CPUs I looked at, the overhead was 1 cycle or even 0, meaning the overhead is negligible if any." |
23:33:21 | PMunch | So if Nim just creates C function pointers it should be very fast |
23:33:33 | PMunch | That quote is from here by the way: http://insanecoding.blogspot.no/2007/05/secrets-to-optimization-function.html |
23:34:35 | PMunch | But then there's also this which is a valid point "The main performance impact when using a function pointer will be that the compiler will generally be unable to optimize the call, e.g. by inlining it." |
23:34:42 | PMunch | From here: https://www.reddit.com/r/C_Programming/comments/3nkcps/function_pointers_overhead/ |
23:35:13 | PMunch | But for this case I doubt that the compiler would be able to inline anything since these pointers can come and go at runtime. |
23:38:55 | shield | I guess it's still useful, thanks for the help! |
23:39:24 | PMunch | No problem, and feel free to look around in the SDLGamelib repo, even if you're not using SDL |
23:39:38 | PMunch | There are a lot of generic solutions there that doesn't have anything to do with SDL |
23:39:39 | * | pigmej quit (Ping timeout: 260 seconds) |
23:41:49 | shield | I am using it so this is a great find for me |
23:43:02 | PMunch | I unfortunately haven't been able to do much in it myself, apart from writing the library :P |
23:43:08 | PMunch | But I did do this for a gamejam: https://github.com/PMunch/TromsoGameJam2017 |
23:43:43 | PMunch | Almost all of the game is in this file: https://github.com/PMunch/TromsoGameJam2017/blob/master/src/sgtest.nim |
23:46:40 | * | PMunch quit (Quit: leaving) |
23:47:45 | shield | cool! |
23:56:54 | * | bwlang joined #nim |
23:57:51 | * | bwlang quit (Client Quit) |
23:58:49 | * | pigmej joined #nim |
23:59:19 | * | shield quit (Ping timeout: 260 seconds) |