00:00:01 | * | Vladar quit (Quit: Leaving) |
00:07:12 | * | Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzzβ¦) |
00:12:25 | rockcavera | deepend https://nim-lang.org/docs/strutils.html#insertSep%2Cstring%2Cchar%2Cint |
00:13:21 | deepend | oh jeez, I read that page and everything. thanks, rockcavera |
00:16:42 | * | krux02_ joined #nim |
00:19:03 | * | krux02 quit (Ping timeout: 245 seconds) |
00:38:26 | * | endragor joined #nim |
00:39:02 | * | endragor quit (Remote host closed the connection) |
00:39:46 | * | endragor joined #nim |
00:45:16 | zedeus | Yardanico: don't forget to close those http clients, otherwise you'll slowly gather many open file descriptors |
01:02:06 | * | ng0 quit (Quit: leaving) |
01:36:21 | Yardanico | zedeus: ah, right, forgot about it |
01:56:28 | * | Zevv quit (Ping timeout: 260 seconds) |
02:02:22 | * | Jjp137 quit (Read error: Connection reset by peer) |
02:04:00 | * | Jjp137 joined #nim |
02:06:19 | * | uu91 joined #nim |
02:07:52 | * | Zevv joined #nim |
02:07:52 | * | Zevv quit (Changing host) |
02:07:52 | * | Zevv joined #nim |
02:07:54 | * | krux02_ quit (Remote host closed the connection) |
02:09:54 | * | Jjp137 quit (Read error: Connection reset by peer) |
02:13:15 | disruptek | i could never remember the address to the directory and so i'd go to nimble's github repo to find out but it's almost impossible to find there, also. |
02:56:42 | leorize | it's in the "Learn" page in nim-lang.org |
03:28:41 | * | icebattl1 joined #nim |
03:32:19 | * | icebattle quit (Ping timeout: 268 seconds) |
03:33:25 | * | icebattl1 quit (Ping timeout: 258 seconds) |
03:33:38 | * | endragor_ joined #nim |
03:34:36 | disruptek | i wonder what that is. |
03:36:50 | * | endragor quit (Ping timeout: 240 seconds) |
03:38:08 | disruptek | oh, i see. i see, i see. |
03:40:18 | * | MightyJoe joined #nim |
03:42:11 | * | cyraxjoe quit (Ping timeout: 268 seconds) |
03:57:32 | * | muffindrake quit (Ping timeout: 260 seconds) |
03:59:47 | * | muffindrake joined #nim |
04:03:39 | * | cyraxjoe joined #nim |
04:05:48 | * | MightyJoe quit (Ping timeout: 268 seconds) |
04:08:23 | * | Jjp137 joined #nim |
04:18:33 | Yardanico | i'm gonna run the discord-irc nim bridge in #nim-offtopic for now, it's linked to #offtopic on Nim discord server, so you can try to break it (and you'll probably succeed but I made it restart on crash, and I'll get some logs :P) |
04:19:40 | disruptek | neat, i'll try to mess with it somehow. |
04:20:23 | Yardanico | oh no |
04:33:37 | * | chemist69 quit (Ping timeout: 252 seconds) |
04:35:38 | * | chemist69 joined #nim |
04:43:31 | * | gangstacat quit (Quit: Δis!) |
04:45:05 | * | thomasross joined #nim |
04:50:03 | * | marmotini_ joined #nim |
04:52:09 | * | nsf joined #nim |
04:55:10 | * | icebattle joined #nim |
05:00:04 | * | icebattle quit (Ping timeout: 268 seconds) |
05:00:11 | * | gangstacat joined #nim |
05:03:48 | * | marmotin_ joined #nim |
05:03:48 | * | marmotin_ quit (Remote host closed the connection) |
05:04:14 | * | marmotini_ quit (Read error: Connection reset by peer) |
05:04:16 | * | marmotin_ joined #nim |
05:09:36 | * | marmotin_ quit (Remote host closed the connection) |
05:10:01 | * | uu91 quit (Ping timeout: 258 seconds) |
05:10:18 | * | marmotini_ joined #nim |
05:15:26 | * | narimiran joined #nim |
05:31:20 | * | dddddd quit (Ping timeout: 268 seconds) |
05:45:36 | * | ltriant quit (Quit: leaving) |
05:50:07 | * | marmotini_ quit (Remote host closed the connection) |
05:51:59 | * | marmotini_ joined #nim |
05:52:00 | * | marmotini_ quit (Remote host closed the connection) |
05:52:16 | * | marmotini_ joined #nim |
05:53:03 | * | leorize quit (Ping timeout: 240 seconds) |
05:57:55 | * | marmotini_ quit (Remote host closed the connection) |
05:58:28 | * | marmotini_ joined #nim |
06:00:57 | FromDiscord | <treeform> Yardanico, is the bridge made with nim? |
06:02:38 | disruptek | !repo Yardanico/ircord |
06:02:39 | disbot | https://github.com/Yardanico/ircord -- 9ircord: 11Discord <-> IRC bridge in Nim 15 2β 0π΄ |
06:02:50 | * | marmotini_ quit (Ping timeout: 240 seconds) |
06:14:56 | * | Zevv quit (Quit: leaving) |
06:15:20 | * | Zevv joined #nim |
06:21:44 | * | gmpreussner joined #nim |
06:23:19 | * | gmpreussner_ quit (Ping timeout: 268 seconds) |
06:25:41 | * | gmpreussner_ joined #nim |
06:26:18 | * | gmpreussner quit (Ping timeout: 258 seconds) |
06:30:10 | * | ptdel quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
07:00:20 | * | solitudesf joined #nim |
07:04:10 | * | PMunch joined #nim |
07:06:59 | * | narimiran quit (Quit: leaving) |
07:08:09 | * | narimiran joined #nim |
07:12:53 | * | marmotini_ joined #nim |
07:43:30 | * | marmotini_ quit (Remote host closed the connection) |
07:43:56 | * | marmotini_ joined #nim |
07:46:51 | * | marmotini_ quit (Remote host closed the connection) |
07:46:57 | * | marmotini_ joined #nim |
07:54:12 | * | marmotini_ quit (Remote host closed the connection) |
07:54:38 | * | marmotini_ joined #nim |
07:57:17 | * | marmotini_ quit (Remote host closed the connection) |
07:57:24 | * | marmotini_ joined #nim |
08:00:00 | * | gmpreussner_ quit (Quit: kthxbye) |
08:05:04 | * | gmpreussner joined #nim |
08:14:43 | PMunch | Another thing I miss from Nim, the `$` operator.. |
08:14:54 | PMunch | Seriously, I can't print out an array of strings? |
08:21:19 | Zevv | and not just being able to .repr anything |
08:21:55 | Zevv | araq: what is the plan with the os:standalone rework, will there be an RFC for that? |
08:28:21 | FromDiscord | <Rika> Is there an async semaphore in the stdlib |
08:33:23 | PMunch | Yep, repr is nice |
08:34:34 | * | krux02 joined #nim |
08:38:10 | * | kungtotte quit (Quit: WeeChat 2.7) |
08:42:37 | * | NimBot joined #nim |
08:44:04 | Araq | repr is dead, arc doesn't have it :P |
08:44:23 | Araq | we could write a new repr though that is not based on the old RTTI |
08:44:30 | Araq | same for marshal.nim |
08:44:53 | Araq | there is no technical reason this won't work, but it's too much work for us |
08:45:01 | Araq | so please PR ahead |
08:45:54 | * | kungtotte joined #nim |
08:46:40 | PMunch | Oh repr is based on RTTI? |
08:48:24 | Araq | yep |
08:51:17 | * | ng0 joined #nim |
08:51:17 | * | ng0 quit (Changing host) |
08:51:17 | * | ng0 joined #nim |
09:01:26 | Araq | repr should be in its own module and could be based on $'s implementation |
09:01:34 | Araq | then you could also override it for custom types |
09:07:50 | * | floppydh joined #nim |
09:22:33 | PMunch | Isn't that sorta the point with repr though? That it isn't something that has to be implemented? |
09:27:12 | * | marmotini_ quit (Remote host closed the connection) |
09:27:38 | * | marmotini_ joined #nim |
09:28:31 | * | icebattle joined #nim |
09:32:27 | * | marmotini_ quit (Ping timeout: 268 seconds) |
09:33:13 | * | icebattle quit (Ping timeout: 260 seconds) |
09:41:23 | lqdev[m] | make it a macro, problem solved ;) |
09:44:52 | * | solitudesf quit (Ping timeout: 258 seconds) |
10:00:15 | * | marmotini_ joined #nim |
10:00:32 | FromGitter | <Varriount> PMunch: or imported |
10:10:07 | Araq | Zevv, I'll tinker with an implementation before writing an RFC |
10:17:29 | * | letto quit (Quit: Konversation terminated!) |
10:18:14 | * | letto joined #nim |
10:26:50 | PMunch | True enough, but if you have already imported the module a type is in then the `repr` implementation should logically be right there next to it |
10:29:44 | * | marmotini_ quit (Remote host closed the connection) |
10:29:52 | * | marmotini_ joined #nim |
10:36:06 | Araq | extensible or not, how system.`$` does it would work for repr too |
11:01:33 | FromDiscord | <inv> Hello, can I duplicate here from telegram? |
11:01:47 | FromDiscord | <inv> ```nim |
11:01:48 | FromDiscord | <inv> var c = 0 |
11:01:48 | FromDiscord | <inv> var s = "" |
11:01:48 | FromDiscord | <inv> try: |
11:01:48 | FromDiscord | <inv> let s_in = newFileStream("1.json", fmRead) |
11:01:48 | FromDiscord | <inv> while not s_in.atEnd(): |
11:01:49 | FromDiscord | <inv> s_in.read(s) |
11:01:50 | FromDiscord | <inv> echo s |
11:01:51 | FromDiscord | <inv> c += 1 |
11:01:53 | FromDiscord | <inv> except IOError: |
11:01:54 | FromDiscord | <inv> echo getCurrentExceptionMsg() |
11:01:56 | FromDiscord | <inv> finally: |
11:01:57 | FromDiscord | <inv> echo c |
11:01:58 | FromDiscord | <inv> ``` |
11:02:14 | FromDiscord | <inv> echo s do SIGSEGV: Illegal storage access. |
11:02:34 | FromDiscord | <inv> is I remove echo s then: |
11:02:34 | FromDiscord | <inv> cannot read from stream |
11:02:34 | FromDiscord | <inv> 83516 |
11:04:01 | Araq | use packedjson to deal with JSON |
11:06:57 | FromDiscord | <inv> Please ignore json here - it is just a file I found in current ditr |
11:07:06 | FromDiscord | <inv> Please ignore json here - it is just a file I found in current dir |
11:08:41 | FromDiscord | <yewpad> Can somebody tell me which one of these styles is easier to read? Not just visually but also contextually, the ease to grasp what this code is doing. I find it pretty hard to find the right "mixture" of which syntax style to use. I always tell myself "Use whatever is easier to read" but that would mean to use both styles in your codebase and that feels pretty inconsistent and inconsistency isn't what I want. https://imgur.com/a/kaKH2LA |
11:09:17 | FromDiscord | <yewpad> Thank you in advance |
11:09:57 | Araq | inv: newFileStream returns nil if the file does not exist iirc |
11:10:33 | FromDiscord | <inv> it exists, because counter is 83516 |
11:11:42 | Araq | yewpad: use the callHere(path) syntax |
11:11:48 | FromDiscord | <inv> I added ```nim if not isNil(s_in):``` but it is the same |
11:11:56 | FromDiscord | <inv> I added ```nim if not isNil(s_in):``` but result is the same |
11:12:07 | Araq | inv: you don't close the stream and run out of file handles |
11:12:15 | FromDiscord | <yewpad> Araq: You mean the style on the first image? |
11:12:25 | Araq | yes |
11:12:53 | Araq | especially removeDir(x) stresses the removeDir operation |
11:12:55 | FromDiscord | <yewpad> Why? Is it easier to read or is it easier to grasp the context |
11:13:08 | Araq | and since that's quite some effect, it's wise to stress it |
11:13:33 | FromDiscord | <inv> ```nim |
11:13:33 | FromDiscord | <inv> var c = 0 |
11:13:34 | FromDiscord | <inv> var s = "" |
11:13:34 | FromDiscord | <inv> let s_in = newFileStream("1.json", fmRead) |
11:13:34 | FromDiscord | <inv> try: |
11:13:34 | FromDiscord | <inv> if not isNil(s_in): |
11:13:34 | FromDiscord | <inv> while not s_in.atEnd(): |
11:13:36 | FromDiscord | <inv> s_in.read(s) |
11:13:37 | FromDiscord | <inv> # echo s |
11:13:39 | FromDiscord | <inv> c += 1 |
11:13:40 | FromDiscord | <inv> except IOError: |
11:13:42 | FromDiscord | <inv> echo getCurrentExceptionMsg() |
11:13:43 | FromDiscord | <inv> finally: |
11:13:44 | FromDiscord | <inv> s_in.close() |
11:13:46 | FromDiscord | <inv> echo c |
11:13:47 | FromDiscord | <inv> ``` |
11:13:48 | FromDiscord | <inv> and it is still the same π¦ |
11:13:51 | narimiran | yay, discord paste |
11:14:18 | FromDiscord | <inv> Araq, but I check for .atEnd |
11:14:37 | Araq | yewpad: Also I avoid 'continue' like the plague and I use case\nof without the additional indentation |
11:14:42 | * | skelett1 quit (Quit: WeeChat 2.5) |
11:15:09 | * | skelett joined #nim |
11:15:12 | FromDiscord | <yewpad> I already figured that with the additional indentation. I wanted to fix this already but didn't get to it just yet |
11:15:33 | * | dddddd joined #nim |
11:15:57 | FromDiscord | <yewpad> The thing is with not using 'continue' is that I have to cover the case in some sort. What do I do instead? Use 'discard'? |
11:16:05 | Araq | yes. |
11:16:37 | FromDiscord | <yewpad> well... yeah.. obvious. thank you for the tip |
11:16:40 | FromDiscord | <yewpad> hint* |
11:18:08 | FromDiscord | <Clyybber> Araq: I think I found the solution to my storing of PNodes/PSym problem. I will use a tree structure for them |
11:18:22 | FromDiscord | <Clyybber> Where field accesses are childs |
11:18:30 | FromDiscord | <inv> ```nim |
11:18:30 | FromDiscord | <inv> var c = 0 |
11:18:31 | FromDiscord | <inv> var s = "" |
11:18:31 | FromDiscord | <inv> let s_in = newFileStream("1.txt", fmRead) |
11:18:31 | FromDiscord | <inv> try: |
11:18:31 | FromDiscord | <inv> if not isNil(s_in): |
11:18:31 | FromDiscord | <inv> echo "stream is ok" |
11:18:33 | FromDiscord | <inv> while not s_in.atEnd(): |
11:18:34 | FromDiscord | <inv> s_in.read(s) |
11:18:36 | FromDiscord | <inv> # echo s |
11:18:37 | FromDiscord | <inv> c += 1 |
11:18:39 | FromDiscord | <inv> except IOError: |
11:18:40 | FromDiscord | <inv> echo getCurrentExceptionMsg() |
11:18:41 | FromDiscord | <inv> finally: |
11:18:43 | FromDiscord | <inv> s_in.close() |
11:18:44 | FromDiscord | <inv> echo c |
11:18:45 | FromDiscord | <inv> ``` |
11:18:47 | FromDiscord | <inv> stream is ok |
11:18:48 | FromDiscord | <inv> cannot read from stream |
11:18:49 | FromDiscord | <inv> 83516 |
11:19:06 | FromDiscord | <yewpad> inv: Discord code snippets are discouraged. Please use a code paste service such as pastebin, hastebin or even Nim's playground. π |
11:19:16 | FromDiscord | <inv> ok, np |
11:19:24 | FromDiscord | <Clyybber> Araq: Btw, I spotted a bug along the way, we optimize `b = a[i]; i += 1; a[i] = b` even though i is not constant and could have changed along the way |
11:19:38 | FromDiscord | <Clyybber> This may be the source of the bugs disruptek is seeing |
11:19:49 | FromDiscord | <Clyybber> because they were all related to iterators/loops in some way |
11:20:08 | FromDiscord | <Clyybber> I'm gonna fix it along the way |
11:20:30 | Araq | orginally the code was specially crafted to prevent this from happening :P |
11:20:51 | Araq | and then somebody "fixed" it |
11:21:09 | FromDiscord | <Clyybber> lol |
11:22:03 | FromDiscord | <inv> https://play.nim-lang.org/#ix=26Oz |
11:23:15 | Araq | inv: unless you also give us your 1.txt nobody can reproduce it |
11:23:25 | * | uu91 joined #nim |
11:23:59 | Araq | and even then it's likely that it works for most of us, streams are used quite a bit |
11:31:26 | FromDiscord | <inv> 1.txt: https://gist.github.com/inv2004/64ac2f2536f851aef0dd5247711ef3b5 |
11:31:42 | FromDiscord | <inv> 1.txt: https://gist.githubusercontent.com/inv2004/64ac2f2536f851aef0dd5247711ef3b5/raw/67b54b56ac7ceb3eae95bd5537e59e6e61e6b93a/1.txt |
11:31:57 | FromDiscord | <inv> please ignore that it is json - just file I found |
11:32:05 | FromDiscord | <inv> please ignore that it is really json - just file I found |
11:32:06 | FromDiscord | <krptr> quick question from a noob: is there a way to declare a converter from literals? Simple example: https://play.nim-lang.org/#ix=26OC |
11:32:54 | FromDiscord | <krptr> tried to find in docs, but didn't find how |
11:36:55 | Araq | krptr: proc makeCustomType(v: int): CustomType = CustomType(value: uint32(v)) |
11:37:11 | Araq | or maybe |
11:37:29 | Araq | proc makeCustomType(v: range[0..int(high(uint32))]): CustomType = CustomType(value: v) |
11:38:35 | Araq | I would use 12'u32 though or simply don't use uint32, I usually don't need modulo arithmetic |
11:38:48 | FromDiscord | <yewpad> Is this discouraged? I think I have read something about that in the docs but I really like it. It is visually more "appealing" to me https://imgur.com/a/iWwu1PM |
11:43:41 | FromDiscord | <krptr> @araq: aham... I'm ok with the range snippet, thanks (using uints is 'mandatory' when LLE of old consoles :P) |
11:43:58 | * | lritter joined #nim |
11:44:20 | Araq | yewpad: I personally don't use the first red line |
11:44:29 | Araq | but the other two red lines are fine |
11:44:38 | FromDiscord | <yewpad> aight, thanks! |
11:44:56 | FromGitter | <alehander92> PMunch i think `$` should work for every value |
11:45:23 | FromGitter | <alehander92> because otherwise its the same now (i cant print ref object? ) |
11:53:55 | Araq | yewpad: In general I try not to confuse beauty with readability. Readability is about stressing the important parts, beauty is more about uniformity. |
11:57:25 | FromGitter | <sheerluck> I like to write beautiful code. That's why I hate Golang |
12:02:31 | * | abm joined #nim |
12:04:41 | * | ng0 quit (Quit: leaving) |
12:07:54 | planetis[m] | is it wise to have an Exception with a ``kind`` field, like ``CairoError(kind: NullPointer)`` (not a case object btw) so that i can avoid the extra if statements that map status codes to raise newException? |
12:10:36 | planetis[m] | pbl not because the user will have to do ``except CairoError as e: case e.kind``,... |
12:15:25 | planetis[m] | is it recommented to remove the prefix from exceptions ``CairoWriteError`` ? |
12:18:08 | Araq | it's always recommended to remove prefixes |
12:19:32 | * | marmotini_ quit (Remote host closed the connection) |
12:19:59 | * | marmotini_ joined #nim |
12:24:38 | * | marmotini_ quit (Ping timeout: 265 seconds) |
12:25:42 | Zevv | If/when `$` is available for every value, what reason does repr have to live then? |
12:27:24 | Araq | $ is not avaiable for every value. |
12:30:58 | FromGitter | <alehander92> Zevv, repr can be a lower level including addresses thing, but i admit i am not sure why its needed |
12:34:10 | planetis[m] | is it possible to map (WriteFunc, closure) to nim closures or provide a nim api for it? closure here is data pointer and writedfunc a proc pointer which takes as first parameter the closure data. here is an example https://github.com/freedesktop/cairo/blob/61122127943dcaff41501e1b06df2a852c576e9b/test/imagediff.c |
12:35:33 | * | chemist69 quit (Quit: WeeChat 2.6) |
12:37:32 | * | marmotini_ joined #nim |
12:37:32 | planetis[m] | look for ``stdio_write_func`` and ``write_png`` |
12:47:20 | planetis[m] | better make a forum post for this one |
12:55:38 | FromDiscord | <krptr> for some reason I cannot make it work (the int literal converter) when using ranges @araq... π¦ probably I'm doing something wrong https://play.nim-lang.org/#ix=26OY |
12:56:06 | planetis[m] | one more question and i leave you guys alone :), the rust bindings convert procs that have in/out parameters to return tuples https://github.com/gtk-rs/cairo/blob/c88d6d39a46fe7f58e31bcfbb4267f4185b61d18/src/matrices.rs#L106 and only out https://github.com/gtk-rs/cairo/blob/c88d6d39a46fe7f58e31bcfbb4267f4185b61d18/src/patterns.rs#L217 does the same changes make sense for a more nim like api? |
12:56:13 | FromDiscord | <krptr> anyway, I'll keep using XXXX'u32 for now, not really a problem |
13:04:04 | * | Vladar joined #nim |
13:26:09 | FromDiscord | <Rika> ar*q (anti ping lol), is there a benefit of not using a colon'ed case (aka has addtl indentation) vs to what you usually use? |
13:26:25 | FromDiscord | <Rika> i mean vs the other* |
13:35:09 | * | solitudesf joined #nim |
13:36:01 | FromGitter | <alehander92> but if you dont ping him, how would he see it |
13:37:43 | PMunch | Uhm: Error: ambiguous call; both common.data(option: CustomOptions[uint32 or float32, system.uint32]) and common.data(option: CustomOptions[uint32 or float32, uuids.UUID]) match for: (ptr CustomOptionsImpl[system.int32, system.uint32]) |
13:44:19 | FromDiscord | <Rika> alehander92, if he checks the server, then he sees it. if he doesnt, then ill ask some other time |
13:45:24 | FromGitter | <alehander92> fair! |
13:45:28 | * | marmotini_ quit (Remote host closed the connection) |
13:45:54 | * | marmotini_ joined #nim |
13:48:29 | Araq | Rika: after ':' a list of statements follows, but after 'case x' a list of 'of' sections follows |
13:48:36 | Araq | so my way is more consistent |
13:50:47 | * | marmotini_ quit (Ping timeout: 260 seconds) |
14:03:41 | * | marmotini_ joined #nim |
14:09:57 | * | sagax quit (Ping timeout: 268 seconds) |
14:11:31 | * | sagax joined #nim |
14:23:51 | * | kitech1 quit (Remote host closed the connection) |
14:24:09 | * | kitech1 joined #nim |
14:24:13 | FromDiscord | <Rika> i see |
14:27:36 | Araq | planetis[m], I like in/out parameters more fwiw but it depends |
14:32:40 | planetis[m] | I think where there is ``red, green, blue, alpha: var float64`` I should use a RGBA color type but i'm not sure about the down conversion to float32 |
14:34:04 | planetis[m] | and in general i'm not sure if float64 should be used or do float -> cdouble conversion |
14:35:47 | narimiran | float == float64 |
14:37:52 | planetis[m] | really!? |
14:38:10 | narimiran | look at system.nim, line 41 :) |
14:38:22 | narimiran | (and lines 37 and 39) |
14:38:56 | planetis[m] | narimiran :) |
14:52:14 | Araq | https://forum.nim-lang.org/t/5784 new year, new forum post |
14:52:38 | * | kitech1 quit (Max SendQ exceeded) |
14:53:03 | * | kitech1 joined #nim |
14:58:01 | * | ng0 joined #nim |
14:58:01 | * | ng0 quit (Changing host) |
14:58:01 | * | ng0 joined #nim |
15:01:50 | * | PMunch quit (Quit: Leaving) |
15:13:39 | * | ng0_ joined #nim |
15:15:19 | * | ng0 quit (Ping timeout: 268 seconds) |
15:16:47 | Zevv | you're late |
15:18:42 | Araq | ikr, time to do --os:standalone properly |
15:18:48 | Zevv | \o/ |
15:20:57 | FromGitter | <alehander92> yess |
15:21:24 | FromGitter | <alehander92> i might use that in lodka |
15:21:41 | * | ng0_ is now known as ng0 |
15:26:20 | Araq | planetis[m], well *out* parameters are to be kept in the return type, *in out* parameters are 'var T' |
15:28:52 | * | couven92 joined #nim |
15:32:21 | * | nsf quit (Quit: WeeChat 2.7) |
15:32:35 | Zevv | look look, you're on reddit/programming fp already |
15:54:19 | Araq | er ... what's the problem again? --os:standalone sucks? yes it does, so don't use it |
15:55:27 | Araq | we only use Ansi C features with --gc:arc, what's the trouble you're having? |
15:55:51 | Araq | esp what #include file(s) do we have to avoid? |
15:56:15 | Zevv | The trouble I was having now is that memory allocation is being too smart |
15:56:51 | Zevv | https://github.com/nim-lang/Nim/blob/master/lib/system/osalloc.nim#L278 |
15:57:52 | Araq | yes but that's under hostOS == "standalone" |
15:57:53 | Zevv | IMHO we should either just assume malloc/free/realloc will do the work, or make some method for explicitly registring these functions for nim to use |
15:57:57 | Zevv | sure |
15:58:09 | Araq | so why do you use --os:standalone |
15:58:09 | Zevv | but we don't have a hostOs == "nothing" |
15:58:18 | FromGitter | <alehander92> yeah i tweaked that for lodka somehow |
15:58:33 | Zevv | alehander92: same for me when running inside the linux kernel |
15:58:40 | Zevv | araq: what should I use then? |
15:58:42 | Araq | is lodka the wodka with love? |
15:58:52 | Araq | --os:linux |
15:59:01 | Zevv | but I'm not running on linux |
15:59:11 | Zevv | I'm runing on some bare metal chip with a half baked libc implementation |
15:59:18 | Zevv | like PMunch with his atmel |
15:59:30 | Araq | yeah ok, so we need a new --os switch |
15:59:36 | FromGitter | <alehander92> :D it's boat in bulgarian/probably russian |
15:59:36 | FromGitter | <alehander92> it seems we do have many words in -odk |
15:59:36 | FromGitter | <alehander92> odka, because why not |
16:00:02 | Araq | but --os:linux is not really Linux specific |
16:00:02 | Zevv | right, --os:custom, --os:none, or whatever |
16:00:26 | Zevv | ok, but there are no posixy-things available as well. It's basically ansi C with nothing |
16:00:26 | FromGitter | <alehander92> if yours is half baked mine is probably raw flour |
16:00:52 | Araq | Zevv, do you have stdio.h? |
16:00:56 | Zevv | alehander92: I have them in all levels from raw to well-done |
16:01:05 | FromGitter | <bung87> how can I check `net_connections(pid = 461)` programatically ? Iβm porting psutil support mac |
16:01:06 | Zevv | Araq: usually yes, and if not, I'm willing to provide one |
16:01:19 | Zevv | and put in whatever is needed. |
16:02:14 | FromGitter | <bung87> using thread or child process ? |
16:03:06 | FromGitter | <sheerluck> @alehander92 Russian here, lodka is a boat |
16:05:28 | FromGitter | <sheerluck> Ukrainian |
16:05:46 | * | marmotini_ quit (Remote host closed the connection) |
16:07:05 | * | marmotini_ joined #nim |
16:07:59 | * | ptdel joined #nim |
16:09:38 | FromGitter | <sheerluck> I have a feeling that I put a damper on this chat :( |
16:11:14 | * | marmotini_ quit (Ping timeout: 240 seconds) |
16:15:15 | Araq | Zevv, do you have pthreads.h or something? |
16:17:08 | Araq | maybe we should name it --os:ansic |
16:19:56 | Zevv | nope, no threads |
16:20:08 | Zevv | think turbo C 1.0 |
16:21:25 | Zevv | --os:ansic would be a good fit I think. If users want to go lower then that they coul/should provide or stub the necessities |
16:22:21 | * | icebattle joined #nim |
16:22:34 | * | Trustable joined #nim |
16:25:11 | Araq | Zevv, can you add it? I'm afraid I cannot test it afterwards anyway |
16:25:39 | Araq | I had something else in mind, where you can import a custom runtime implementation detached from system.nim |
16:25:58 | Araq | but that's more work and I should work on something else |
16:26:37 | FromGitter | <alehander92> @sheerluck yep, in bulgarian to |
16:27:32 | FromGitter | <alehander92> i think the custom runtime thing might make sense as well in theory |
16:27:36 | shashlick | how can I check if a type has a specific field? |
16:27:48 | shashlick | like if object has field x: |
16:31:56 | Zevv | araq: ok |
16:32:38 | Zevv | did/does nim ever run on msdos? |
16:37:26 | Araq | never tried it, but good old DOS always had a place in the implementation, see doslikeFileSystem |
16:37:29 | * | floppydh quit (Quit: WeeChat 2.6) |
16:39:01 | FromDiscord | <Skaruts> @Araq, do you think it would be worth it for me to suggest adding a python-like "range" iterator to Nim? I implemented one for myself, and tbh I can't think of a reason why Nim shouldn't provide such a thing out of the box (and I know about `countup` and `countdown` but they aren't python-like). I could potentially offer mine for Nim, if people like it |
16:41:04 | FromDiscord | <mratsim> If we are allowed to use the "range" keyword for new things, Range would be quite useful once we have first class openarrays for the C++/D-like ranges. |
16:41:53 | FromDiscord | <mratsim> but then if we say "use ranges" we will have 3 kinds of ranges: the range for the type constraint (imo the less useful) the range for iterator, the range for streams |
16:42:10 | FromDiscord | <Skaruts> or "xrange", I just named mine range for the moment because I didn't think of xrange sooner (although I had no issues with conflicts with system range) |
16:42:18 | FromDiscord | <mratsim> no xrange is bad |
16:42:28 | FromDiscord | <Skaruts> why so? |
16:42:33 | FromDiscord | <mratsim> why x? |
16:43:01 | FromDiscord | <Skaruts> because it excludes the upper limit, so it could stand for "exclusive range" (in contrast to other Nim ranges) |
16:43:39 | FromDiscord | <Skaruts> personally I prefer range anyway, xrange is just the next best thing I could think of |
16:44:01 | FromDiscord | <Skaruts> to avoid confusion and stuff |
16:44:31 | FromDiscord | <Skaruts> I don't like repeat, or iter |
16:44:41 | FromDiscord | <Skaruts> or iterate, which is leaning on verbosity |
16:44:41 | FromDiscord | <mratsim> ah I see |
16:44:49 | FromDiscord | <mratsim> never made the connection with exclusive |
16:44:58 | FromDiscord | <Skaruts> me neither π |
16:45:06 | narimiran | @Skaruts you're not the first one to propose excluding ranges (and you'll not be the last one who Araq will reject :P) |
16:45:10 | FromDiscord | <Skaruts> I just thought of it like 10 miuntes ago |
16:45:28 | FromGitter | <alehander92> interesting |
16:45:40 | Araq | 1. It's true that I have good arguments against exclusive ranges. |
16:45:51 | FromDiscord | <Skaruts> I got a list of good reasons for it lined up for the suggestion post |
16:45:52 | Araq | 2. Nim already offers them though, written as ..< |
16:46:04 | Araq | (which is IMHO beautiful) |
16:46:08 | FromDiscord | <Rika> "they arent pythonic" i'm gonna guess |
16:46:27 | FromDiscord | <Skaruts> pythonic? screw pythonic... |
16:46:38 | FromGitter | <alehander92> his idea is kinda valid in that its hard to use custom step |
16:46:55 | FromDiscord | <Skaruts> a wise man once said *"if it's readable it's not pythonic enough"* |
16:47:00 | FromGitter | <alehander92> so some way to do it would be ok |
16:47:00 | FromDiscord | <mratsim> In Weave, it's exclusive range all the way down :p |
16:47:42 | FromDiscord | <mratsim> even in the random stdlib, the inclusive ranges cause problem in the uniform sampling algorithm |
16:48:35 | FromDiscord | <Skaruts> @Araq, none of that is a good reason why Nim couldn't provide it, anyone can use whichever they prefer, and I disagree with 2 ..< has a few disadvantages |
16:49:21 | FromDiscord | <Rika> i feel like xrange is too far of a name to countup to not make it confusing for new devs |
16:49:59 | narimiran | `countupto` |
16:50:09 | FromDiscord | <Skaruts> xrange is unified, it counts in either direction |
16:50:13 | narimiran | `countuptill` |
16:50:34 | FromDiscord | <mratsim> counting in either direction is bug-prone though |
16:50:36 | Araq | mratsim: In no language I know of does a[a.len] actually work |
16:50:42 | Araq | I mean |
16:50:49 | Araq | in no language that uses 0 based indexing |
16:50:55 | FromDiscord | <Rika> haha |
16:51:05 | Araq | so that's the root cause for this "exclusive is superior" idea |
16:51:05 | FromDiscord | <Rika> was about to say "but julia" |
16:51:10 | FromDiscord | <mratsim> but what's the link with exclusive range? |
16:51:43 | Araq | the link is obvious to me, indexing is close to slicing |
16:52:37 | Araq | not to mention that exlusive countup is not symmetric to countdown |
16:52:57 | Araq | (countdown with an exclusive starting point is unheard of) |
16:53:08 | FromDiscord | <Skaruts> that's true, but Nim offers other ways to loop that are |
16:53:15 | Araq | but this is all besides the point |
16:53:20 | FromDiscord | <Skaruts> https://play.nim-lang.org/#ix=26PV |
16:53:23 | Araq | we do have ..< and it's beautiful |
16:53:28 | Araq | so what's wrong with ..< ? |
16:53:48 | FromDiscord | <mratsim> it's not about ..< |
16:53:52 | narimiran | i feel this is an another "& is too hard to reach" |
16:53:58 | FromDiscord | <mratsim> it's about countup(0, n-1, 2) |
16:54:07 | FromDiscord | <Skaruts> no narimiran, it's not |
16:54:12 | Araq | ok, so you need the step argument |
16:54:16 | FromDiscord | <mratsim> no |
16:54:17 | Araq | is it about the step? |
16:54:22 | FromDiscord | <mratsim> it's the n-1 that is error prone |
16:54:35 | narimiran | and having two ranges is not error prone? |
16:54:57 | Araq | if the step doesn't matter there is already ..< |
16:54:58 | narimiran | how can i be sure that author really wanted excluding/including range at some point in their code? |
16:55:17 | FromDiscord | <mratsim> Having ..< which is exclusive and countup which is inclusive is error prone yes |
16:55:18 | Araq | I'm waiting for Skaruts's reply |
16:55:20 | FromDiscord | <Rika> ~~especially when one is called xrange and the other is countup~~ π not serious here |
16:55:21 | disbot | no footnotes for `~especially`. π |
16:55:28 | FromDiscord | <Rika> ????? |
16:55:34 | FromDiscord | <Rika> disbot wtf |
16:55:36 | FromDiscord | <mratsim> ~Rika is a footnote |
16:55:37 | Araq | ignore disbot |
16:55:37 | disbot | Rika: 11a footnote |
16:55:47 | FromDiscord | <Skaruts> Arraq, when I was starting learning nim I had a real beef with `..<`, because I would forget many `<`s and then I struggled to find the source of errors becuse it's really easy to overlook a missing `<`. Plus, the difference between `..<` and `..` in the loop lines is very subtle, makes the code less readable than `range(10)` vs `range(10+1)` |
16:55:53 | FromDiscord | <Rika> i am now a footnote |
16:56:22 | FromDiscord | <Rika> skaruts, i'd say a +1 or -1 is just as hard to spot as a < |
16:56:22 | FromDiscord | <mratsim> `..<` `..` is OK for me though |
16:56:39 | shashlick | Araq: I have created an nkIdent("cchar") but in renderer.nim, it gets converted into a cstring - is this a known issue? |
16:56:39 | Araq | Ruby uses .. vs ... |
16:56:45 | narimiran | "I would forget many `<`s" -- and you're telling me this is not "& is too hard to reach" :) |
16:57:21 | FromDiscord | <mratsim> it's the constant jump between "a ..< b" and "countup(a,b-1,step)" that I find annoying |
16:57:32 | FromDiscord | <Rika> γγγ¦γ |
16:57:48 | FromDiscord | <Rika> ~~im not even N5, i should not use japanese...~~ |
16:57:48 | disbot | no footnotes for `~im`. π |
16:57:52 | FromDiscord | <Rika> damn it |
16:58:01 | Araq | ok so for mratsim it is all about the 'step', a fair point |
16:58:12 | FromDiscord | <Rika> the step one is a compelling argument yes |
16:59:17 | * | marmotini_ joined #nim |
16:59:26 | FromDiscord | <mratsim> in Weave I use "for i in 0 ..< 100, stride = 10:" (pseudocode, with my own parallel for) |
16:59:47 | Araq | for in strided(0, N, 3) |
16:59:57 | FromDiscord | <mratsim> you forgot the N-1 |
17:00:00 | Araq | would be an acceptable addition |
17:00:13 | Araq | mratsim: no, it's exclusive |
17:00:19 | FromDiscord | <mratsim> ~-~ |
17:00:20 | disbot | no footnotes for `-~`. π |
17:00:31 | FromDiscord | <Rika> strided sounds |
17:00:36 | Araq | for i in strided(0, N, 3) # my proposal |
17:00:37 | FromDiscord | <Rika> kinda cryptic to me |
17:00:43 | FromDiscord | <Clyybber> if something is exclusive I think it should always get the x prefix |
17:00:45 | Araq | but a better name would be nice |
17:00:46 | FromDiscord | <Clyybber> so xstrided |
17:00:59 | FromDiscord | <Rika> why strided anyway? |
17:01:06 | FromDiscord | <Clyybber> right |
17:01:12 | Araq | dunno, so come up with something better |
17:01:13 | FromDiscord | <Clyybber> thats what I was about to ask |
17:01:22 | Araq | but remember: no more additions to system.nim ... |
17:01:26 | FromDiscord | <mratsim> Strided is common in machine learning/linear algebra/scientific computing |
17:01:27 | FromDiscord | <Clyybber> I mean why does ..< not suffice? |
17:01:41 | Araq | because it lacks the 'step', Clyybber |
17:01:42 | FromDiscord | <Skaruts> narimiran, is a noob's perspective only valuable when you agree with it? Because I didn't see you arguing against anyone who defends something with "this might confuse noobs", well ..< confused me as a noob |
17:01:55 | FromDiscord | <Clyybber> Aah |
17:01:55 | FromDiscord | <mratsim> when you jump by more than 1 in matrix accesses we call that a stride |
17:02:30 | FromDiscord | <mratsim> and in low-level programming it's a strided memory access |
17:02:41 | narimiran | eh, if i wanted to fix everything that was confusing to me when i started with nim, not much would be left by now :D |
17:03:08 | Araq | Swift also has ..< iirc |
17:03:19 | Araq | Rust choose .. vs ..= |
17:03:20 | FromDiscord | <Skaruts> I'm not trying to fix everything that confused me, so your point is moot |
17:03:23 | Araq | *chose |
17:03:35 | FromDiscord | <mratsim> ..= is ugly |
17:03:38 | FromDiscord | <Clyybber> @Skaruts ..< is not gonna go away |
17:03:43 | FromDiscord | <Clyybber> we agreed yesterday |
17:03:46 | FromDiscord | <Clyybber> didn't we? |
17:03:50 | FromDiscord | <Skaruts> I'm not trying to make it go away!!!! |
17:03:52 | FromDiscord | <Clyybber> that its better to have .. be inclusive |
17:03:53 | FromDiscord | <Skaruts> geeez |
17:04:05 | Araq | Skaruts: please relax |
17:04:12 | FromDiscord | <mratsim> it's about replacing countup/or add an alternative to countup |
17:04:16 | FromDiscord | <Skaruts> and I'm not arguing against the inclusive loops |
17:04:24 | FromDiscord | <Skaruts> I'm just suggesting adding a python like one. |
17:04:32 | FromDiscord | <Clyybber> ok |
17:04:41 | FromDiscord | <Clyybber> xcountup xcountdown? |
17:04:56 | FromDiscord | <mratsim> xup xup |
17:05:02 | FromDiscord | <Skaruts> sorry Araq, but I begin feeling like it's hard to talk about things here |
17:06:29 | Araq | well we are trying to ensure a non-toxic environment |
17:06:43 | Araq | anyhow, what do you think about xcountup? |
17:07:03 | FromDiscord | <mratsim> anyway, I find the iterator OK, probably in sugar. |
17:07:03 | FromDiscord | <mratsim> I don't know about the names |
17:07:13 | FromDiscord | <Rika> xcountup sounds ok yeah |
17:07:17 | FromDiscord | <Skaruts> well the point of the iterator was to be unified, you can count either up or down, and also choose the step |
17:07:30 | FromDiscord | <Skaruts> (and to exclude the limit) |
17:07:38 | FromDiscord | <mratsim> how would xrange work when counting down? |
17:07:54 | FromDiscord | <Skaruts> https://play.nim-lang.org/#ix=26PV |
17:07:58 | FromDiscord | <mratsim> do you exclude the beginning or the end? |
17:08:12 | FromDiscord | <Rika> end i assume |
17:08:22 | FromDiscord | <Skaruts> it's like python's |
17:08:38 | FromDiscord | <Rika> so end |
17:08:43 | FromDiscord | <Clyybber> the fact that its not intuitively clear which end we should exclude makes it not a good idea IMO |
17:08:53 | FromDiscord | <mratsim> it's always the end |
17:08:57 | FromDiscord | <Skaruts> yea |
17:08:59 | FromDiscord | <Rika> yeah |
17:09:07 | FromDiscord | <mratsim> that's easier than in some case the begining and in the other the end |
17:09:33 | FromDiscord | <Rika> i dont know any language that excludes the start when counting down |
17:10:06 | FromDiscord | <Clyybber> then it wont be much useful to counting down |
17:10:16 | FromDiscord | <Clyybber> for indexes |
17:10:45 | FromDiscord | <Clyybber> since you'd have to do: xrange(a.len-1, -1) ? |
17:11:06 | FromDiscord | <Rika> yeah |
17:11:11 | FromDiscord | <Rika> thats what i thought too |
17:11:13 | FromDiscord | <Skaruts> I suppose you can see the code I posted on nim-playground? (@Clyybber was telling me yesterday that they couldn't) |
17:11:20 | FromDiscord | <Skaruts> I can post elswhere if needed |
17:11:31 | FromDiscord | <Rika> i should have left 30 minutes ago |
17:11:32 | FromDiscord | <Clyybber> was probably some ff bug, it worked the second time |
17:11:35 | FromDiscord | <Rika> goodbye for real |
17:11:36 | narimiran | IIRC the reason why we have both countup and countdown is that you can do `countup(someLargeNo, someSmallNo)` and there will be nothing to iterate |
17:11:41 | FromDiscord | <Clyybber> bb |
17:12:02 | narimiran | this won't play nice if you have only one xrange for both up and down |
17:12:07 | FromDiscord | <Skaruts> well you already have those, so |
17:12:22 | FromDiscord | <mratsim> it's an addition not a all-encompassing replacement |
17:12:25 | FromDiscord | <Clyybber> its just not a good candidate for the stdlib IMO |
17:12:33 | FromDiscord | <Skaruts> I'm not asking to take anything away from Nim, only to add something more |
17:12:39 | FromDiscord | <mratsim> I think it's good in sugar |
17:12:42 | FromGitter | <alehander92> but sometimes this is bad |
17:12:48 | FromGitter | <alehander92> because it gives you too many options |
17:12:56 | FromGitter | <alehander92> and makes code less uniform |
17:13:14 | FromGitter | <alehander92> i dont want to see both 0 ..< n and range(0, n) everywhere, its good to have certain style |
17:13:15 | FromDiscord | <Skaruts> well that would be an argument against macros... |
17:13:33 | FromGitter | <alehander92> not really |
17:13:41 | FromDiscord | <Clyybber> this whole where do we cut 1 off, is evidence that a range iterator would be better than an xrange iterator |
17:13:50 | FromDiscord | <mratsim> but you have to even today due to ..< not supporting counting down or steps |
17:13:51 | FromGitter | <alehander92> you can have both original and just replacing api-s created with macros |
17:14:04 | FromDiscord | <Clyybber> because having the -1 or +1 will be less confusing than having to know how xrange behaves |
17:14:10 | FromDiscord | <Skaruts> yea you already have differnt code as it is |
17:14:15 | FromGitter | <alehander92> but i agree that range might be useful in sugar, just tried to point out |
17:14:21 | FromDiscord | <mratsim> the -1 is very annoying |
17:14:48 | FromGitter | <alehander92> Skaruts i am talking about different ways to do the same very simple thing |
17:14:53 | FromDiscord | <Clyybber> @mratsim keep in mind I'm talking about range, not xcountup or xcountdown |
17:14:53 | FromGitter | <alehander92> cant see what macros have to do with it |
17:15:03 | FromDiscord | <Clyybber> xrange(a.len-1, -1) this is even more annoying |
17:15:05 | FromGitter | <alehander92> just tried to show you that there are many possible angles |
17:15:12 | Araq | one thing that I will never accept is basing the iteration order on a runtime value |
17:15:14 | FromGitter | <alehander92> otherwise i agree range in sugar might be ok |
17:15:16 | FromDiscord | <mratsim> but then you can use countdown |
17:15:35 | FromGitter | <alehander92> but you also have to accept other people's views |
17:15:46 | FromDiscord | <mratsim> for generic code that needs to support iterating in multiple direction, xrange would be useful |
17:15:49 | FromDiscord | <Clyybber> @mratsim You can always use countdown and countup, no range required |
17:15:50 | Araq | because I've never seen a convincing example of its usefulness |
17:15:54 | FromDiscord | <Clyybber> @mratsim no it wouldn't |
17:16:02 | FromDiscord | <Clyybber> because youd still have to special case it |
17:16:07 | FromDiscord | <Clyybber> xrange(a.len-1, -1) ? |
17:16:23 | FromDiscord | <Skaruts> if that's annoying on xrange, it's annoying on ..< and countdown |
17:16:24 | FromDiscord | <mratsim> no, it's just exclusive |
17:16:46 | FromDiscord | <Clyybber> @Skaruts no because countdown is inclusive and ..< only counts up |
17:17:10 | FromDiscord | <Clyybber> @mratsim Exclusive can have two meanings, and which one you want depends on the case |
17:17:17 | FromDiscord | <Skaruts> and besides, it's just (a.len, 0) in my implementation, you don't need the steping in that case |
17:17:22 | FromDiscord | <Clyybber> so that makes it a bad candidate for the sdtlib iMO |
17:17:33 | FromDiscord | <Skaruts> actually no, you need the -1 on a.len |
17:17:41 | FromDiscord | <Clyybber> exactly |
17:18:00 | FromDiscord | <Skaruts> but the stepping is the optional 3rd argument, not second, second is the limit |
17:18:11 | FromDiscord | <Clyybber> in my case too |
17:18:15 | FromDiscord | <mratsim> Well all my use cases: Arraymancer slicing and Parallel For loop are much more naturall mapped with exclusive range and strides |
17:18:31 | FromDiscord | <Clyybber> @Skaruts Its counting down from a.len -1 to 0 |
17:18:44 | FromDiscord | <Skaruts> everything just fits into place with exclusive ranges... hence why every nim loop includes a `<` |
17:18:44 | FromDiscord | <Clyybber> but since it will exclude the zero you have to do -1 |
17:18:58 | FromDiscord | <Skaruts> (I'm generalizsing of course, there are exceptions) |
17:19:03 | FromDiscord | <Clyybber> nothing fits |
17:19:40 | FromDiscord | <Skaruts> then why is everyone using `<` all the time? |
17:19:42 | FromDiscord | <Clyybber> Either you do exclude the upper bound, or you say always exclude the end and end up with this: xrange(a.len-1, -1) |
17:19:50 | FromDiscord | <Clyybber> @Skaruts BECAUSE IT ONLY COUNTS UP |
17:19:53 | FromDiscord | <mratsim> personally I wrote much more loops that needs the a.len-1 than those that countdown to 0 |
17:20:01 | FromDiscord | <mratsim> please @Clyybber don't shout |
17:20:12 | FromDiscord | <Clyybber> its not meant as shouting |
17:20:17 | FromDiscord | <Clyybber> just as bold text |
17:20:19 | FromDiscord | <Clyybber> or something |
17:20:26 | FromDiscord | <Skaruts> countdowns don't fit but count downs are rare cases @Clyybber |
17:20:58 | FromDiscord | <mratsim> anyway, I think we should stop the bikeshedding there |
17:21:20 | FromDiscord | <mratsim> I propose that you open a PR in sugar.nim, and use xrange for the name |
17:21:47 | planetis[m] | for anyone who wants to help https://github.com/b3liever/cairo2 these are cairo bindings for nim, it compiles and works @treefrom |
17:22:42 | FromDiscord | <Skaruts> I've never opened a PR, tbh I have no clue what to do |
17:23:03 | FromDiscord | <Clyybber> @Skaruts IMO consistency and logic > I need this often spare me two keypresses |
17:23:45 | FromGitter | <alehander92> Skaruts sorry i was very nervous its a very interesting discussion keep motivation |
17:24:04 | FromDiscord | <Skaruts> no worries mate |
17:24:37 | FromDiscord | <Skaruts> @Clyybber xrange is consistent with Nim's tendency to make things implicit in favor of readibility and clean code, unlike countup and countdown which require typing both ends explicitly |
17:24:52 | FromDiscord | <Skaruts> (always) |
17:25:10 | FromGitter | <alehander92> thanks, so about PR-s, you clone the repository, use devel branch ! (optionally you create a new branch), and you add the new function in the code on your computer, add eventually a test file and then push, and in github you will see UI for PR |
17:25:12 | FromDiscord | <Clyybber> no |
17:25:39 | FromDiscord | <Clyybber> @Skaruts we don't make things explicit to make them logically ambiguous |
17:25:56 | FromDiscord | <Skaruts> there's nothing ambiguous about xrange mate |
17:26:12 | FromDiscord | <Clyybber> there is |
17:26:14 | FromDiscord | <Skaruts> people have been using it in python for ages |
17:26:22 | FromDiscord | <Clyybber> it is not clear wether you exclude the end or the upper bound |
17:26:33 | FromDiscord | <Skaruts> it's always the end |
17:26:45 | FromDiscord | <Clyybber> yeah but thats arbitrarily defined |
17:27:09 | FromDiscord | <Clyybber> in fact I'd argue excluding the upper bound makes more sense |
17:27:21 | Araq | Clyybber: don't fight it too much, if it's called 'xrange' like in Python it should behave like in Python |
17:27:30 | FromDiscord | <Skaruts> alehander, thanks gonna take a look |
17:27:32 | FromDiscord | <Clyybber> But its illogical |
17:27:40 | FromDiscord | <Clyybber> or not illogical |
17:27:44 | FromDiscord | <Skaruts> Araq, exactly (although I made two slight improvements) |
17:27:49 | FromDiscord | <Clyybber> but there is no justification for the behaviour |
17:27:57 | Araq | and it's not about saving "-1" as keystrokes, it's that you can forget them and get a runtime error |
17:27:58 | FromDiscord | <Clyybber> so IMO it should just not exist in nim |
17:28:35 | FromDiscord | <Clyybber> Araq: Forgetting the x in xrange is about equally likely I'd argue |
17:29:02 | FromDiscord | <Skaruts> countup(a.len-1)? |
17:29:14 | FromDiscord | <Skaruts> xrange(a.len) |
17:29:24 | FromDiscord | <Clyybber> @Skaruts there is no countup with one arg |
17:29:33 | FromDiscord | <Skaruts> yuo get the point mate |
17:29:36 | FromDiscord | <Clyybber> no |
17:29:40 | FromDiscord | <Skaruts> but that help my point further |
17:29:46 | FromDiscord | <Clyybber> because if there is xrange there would also be range |
17:29:56 | FromDiscord | <Skaruts> countup(0, a.len) vs xrange(a.len) |
17:30:02 | FromDiscord | <mratsim> come on, let's stop |
17:30:12 | FromDiscord | <Skaruts> correction: countup(0, a.len-1) vs xrange(a.len) |
17:30:22 | * | tane joined #nim |
17:30:40 | FromDiscord | <Clyybber> @Skaruts My point was that when range exists, it is equally easy to miss the x in xrange and write range instead |
17:31:01 | FromDiscord | <mratsim> range doesn't exist though |
17:31:19 | FromDiscord | <Skaruts> ok but that's a compiler error saying the error is right thre, and not a out of bounds somewhere else |
17:31:20 | FromDiscord | <mratsim> and in python range used to exist and has been deprecated to xrange during Python 2.1 iirc |
17:31:22 | FromDiscord | <Clyybber> @mratsim If xrange existed it would be weird to have range not exist, wouldnt it? |
17:31:43 | FromDiscord | <Clyybber> @Skaruts No it would not |
17:31:52 | FromDiscord | <Clyybber> Because if range existed it would just be an oob |
17:31:54 | FromDiscord | <Clyybber> error |
17:32:09 | FromDiscord | <mratsim> ah, Python 3 removed incluive range, only kept xrange and renamed it range |
17:32:19 | FromDiscord | <Clyybber> oh god |
17:32:29 | FromDiscord | <Skaruts> undeclared identified range (or maybe ambiguuous call with system range or whatever), it's very different from an obscure segmentation fault |
17:32:45 | FromDiscord | <mratsim> actually no |
17:32:47 | FromDiscord | <Skaruts> yup, xrange = python 2, range python 3 |
17:32:56 | FromDiscord | <mratsim> range vs xrange was about list vs generator |
17:33:04 | FromDiscord | <Skaruts> that too |
17:33:05 | FromDiscord | <mratsim> not about inclusive/exclusive |
17:33:15 | FromDiscord | <Clyybber> @Skaruts Please listen to me. |
17:33:32 | FromDiscord | <Clyybber> I said if xrange and range existed you could miss the x and then end up calling range |
17:33:38 | FromDiscord | <Clyybber> it wont be a compile time error |
17:33:51 | FromDiscord | <mratsim> but there is no range |
17:34:02 | FromDiscord | <mratsim> and no reason to add it |
17:34:21 | FromDiscord | <Skaruts> range does exist (in system), so if you miss the x you'll get an error, I got it while developing this |
17:34:35 | FromDiscord | <mratsim> yes but it's a type |
17:34:37 | FromDiscord | <Skaruts> but it tells the proper line |
17:34:43 | FromDiscord | <Skaruts> yes |
17:35:40 | FromDiscord | <Skaruts> while missing a `<` may give you either undefined behavior or an out of bounds index somewhere else which makes it harder to find the source |
17:35:57 | FromDiscord | <Skaruts> or bugs |
17:35:59 | FromDiscord | <Clyybber> no, no undefined behaviour |
17:36:27 | FromDiscord | <Clyybber> @mratsim if there is no reason to add range there is no reason to add xrange either |
17:36:30 | FromDiscord | <Skaruts> if you're drawing a terminal emulator you'll draw beyond the screen |
17:36:39 | FromDiscord | <Clyybber> so we should just add xcountup and xcountdown |
17:36:50 | FromDiscord | <Clyybber> @Skaruts Ok, fair enough |
17:36:57 | FromDiscord | <Skaruts> no thanks, too verbose names |
17:37:07 | FromDiscord | <Clyybber> what the hell |
17:37:27 | FromDiscord | <Skaruts> I prefer shorter names, and I prefer the unified thing tbh |
17:37:33 | * | Trustable quit (Remote host closed the connection) |
17:37:42 | FromDiscord | <Clyybber> are you aware that xrange has a runtime impact?? |
17:37:45 | FromDiscord | <Skaruts> *"one iterator to rule them all!"* |
17:37:48 | FromDiscord | <mratsim> Nim iterators take a large inspiration from Python. |
17:37:48 | FromDiscord | <mratsim> xrange/range are also in Python. |
17:37:48 | FromDiscord | <mratsim> They also address a pattern that is demanded but missing, exclusive iteration with steps |
17:38:43 | FromDiscord | <Skaruts> do function overloads have overhead? |
17:38:46 | FromDiscord | <Skaruts> proc* |
17:38:49 | FromDiscord | <Clyybber> no |
17:38:57 | FromDiscord | <mratsim> Ideally, I'd like a coherent iteration/sequtils/C++-like ranges design, but since we have none, something in sugar is the next best thing |
17:39:04 | FromDiscord | <Skaruts> then what's the runtime impact? |
17:39:06 | FromDiscord | <Clyybber> but range must decide at runtime which direction to iterate in |
17:39:14 | FromDiscord | <mratsim> the overhead is the if/else switch |
17:39:38 | FromDiscord | <Skaruts> ok. fair enough. It tests the condition only once though |
17:39:44 | FromDiscord | <mratsim> And there is a codebloat overhead as well |
17:39:53 | FromDiscord | <mratsim> because you inline the iterator code twice |
17:40:15 | FromDiscord | <Skaruts> not sure what you mean by that |
17:40:15 | FromDiscord | <mratsim> this one is a bit more worrying |
17:40:36 | FromDiscord | <mratsim> the body of the for loop is inlined in the iterator |
17:40:43 | FromDiscord | <mratsim> but you have 2 branches |
17:40:50 | FromDiscord | <mratsim> so the body will be inlined twice |
17:41:08 | FromDiscord | <Skaruts> by inlined you mean the body of the loop is in the same line? |
17:41:33 | FromDiscord | <Skaruts> as the for |
17:42:37 | FromDiscord | <mratsim> What I mean is that when you create an iterator with branching, take a big for loop with lots of stuff inside, compile it, and ensure that that big body is not duplicated. |
17:43:32 | FromDiscord | <Clyybber> so disadvantages of having xrange: Excluding end is arbitrarily defined, runtime impact. |
17:43:42 | FromDiscord | <Clyybber> advantages: not having to write xcountup, xcountdown |
17:43:52 | solitudesf | is this "i used to how its done in python, so i refuse to adjust" round infinity? |
17:44:11 | FromDiscord | <mratsim> that's not the only advantages, you don't need to write the beginning, it's implictly 0, and you don't need to do len-1 |
17:44:21 | * | rockcavera quit (Read error: Connection reset by peer) |
17:44:32 | FromDiscord | <mratsim> It's about reusing good design as well. |
17:44:36 | FromDiscord | <Skaruts> I'm still not getting it tbh... π |
17:44:36 | * | rockcavera joined #nim |
17:44:52 | FromDiscord | <Clyybber> not writing the beginning is even worse |
17:44:57 | FromDiscord | <mratsim> put "echo "There can only be one"" |
17:45:11 | FromDiscord | <Clyybber> even more ambiguity yay!!! |
17:45:13 | FromDiscord | <mratsim> and check in the C code that this line is outputted one or twice |
17:45:35 | FromDiscord | <mratsim> if it's outputted twice, it means that anythin in that loop will be duplicated |
17:45:52 | FromDiscord | <Clyybber> IMO a seperate `repeat` iterator would be a much better idea |
17:46:02 | FromDiscord | <mratsim> not critical but some crazy people put crazy stuff in iterators |
17:46:08 | FromDiscord | <mratsim> (like me) |
17:46:09 | FromDiscord | <Skaruts> I checked with an echo before the for loops and it was only once |
17:46:13 | FromDiscord | <mratsim> good |
17:46:24 | FromDiscord | <Skaruts> although, I will check again because I made some changes meanwhile |
17:47:41 | * | nsf joined #nim |
17:50:57 | FromDiscord | <Skaruts> echoes only once on all cases |
17:51:27 | FromDiscord | <Skaruts> I suppose you meant it in this order `if cond: echo "bla"; for bla bla` |
17:52:38 | Araq | can we end the discussion now? you can write a PR and we can vote about it |
17:54:31 | FromDiscord | <mratsim> seconded |
17:54:33 | FromDiscord | <Skaruts> kinda seems like it already ended, mratsim was just giving me some tips on the code I wrote |
17:56:19 | FromDiscord | <mratsim> btw @Araq, is that data structure something that cannot be supported at all in C++ and I'm doomed or fixing the Nim codegen will make my code great again? https://github.com/nim-lang/Nim/issues/13062 |
17:56:21 | disbot | β₯ C++ Atomics in union: ::<unnamed union>::<unnamed struct>::field with constructor not allowed in anonymous aggregate ; snippet at 12https://play.nim-lang.org/#ix=26Qh |
18:01:59 | Araq | mratsim: I've been thinking about it |
18:07:55 | Yardanico | Maybe some people already know it, but there's a neat Chrome extension (which will of course work on any chromium-based browser) which creates links for stdlib modules on github and even works on local modules of the project (sometimes) https://chrome.google.com/webstore/detail/module-linker/dglofghjinifeolcpjfjmfdnnbaanggn |
18:08:18 | Yardanico | Sadly it has some issues like it doesn't know about std/module or "from module import something", and looks like that: https://i.imgur.com/RB9SGir.png |
18:08:38 | Yardanico | Light green are "local" modules (in the same folder, if you click you'll go directly to them), deep green are stdlib modules |
18:08:53 | Yardanico | (by clicking on them you go directly to the stdlib docs) |
18:09:16 | Yardanico | The developer probably just used Python import syntax parsing as a base for this, but it works pretty well :P |
18:10:58 | FromGitter | <Albus70007> why do asyncnet sockects return Future[system.string]?? |
18:11:08 | Yardanico | because you need to "await" them |
18:11:29 | FromGitter | <Albus70007> so i cant print the data recieved? |
18:11:32 | Yardanico | or asyncCheck, or some other thing, but that's how async works |
18:11:49 | Yardanico | you can, check https://nim-lang.org/docs/asyncnet.html#examples-chat-server |
18:11:55 | Yardanico | "let line = await client.recvLine()" |
18:12:12 | FromGitter | <Albus70007> but i am recieving a buffer of data |
18:13:39 | Yardanico | then it's await client.recv(size) |
18:14:03 | FromGitter | <Albus70007> await seems to throw me an error |
18:14:18 | Yardanico | Basically that's the main difference between async and sync, with async you can let IO-heavy tasks kinda run in the background |
18:14:23 | FromGitter | <Albus70007> undeclared identifier: await |
18:14:28 | Yardanico | did you import asyncdispatch ? |
18:14:38 | Yardanico | That's the nim stdlib module used for writing async code |
18:15:17 | FromGitter | <Albus70007> ok |
18:15:37 | disruptek | the difference between range and xrange in python has nothing to do with "exclusivity". |
18:15:44 | Araq | mratsim: for now my only idea is the usual solution |
18:15:58 | disruptek | one the pre-alloc'd and xrange is generated jit. |
18:16:02 | Araq | move the ' impl: PledgeImpl' declaration out of the 'case' |
18:16:19 | Araq | in your example this causes no further memory overhead |
18:16:32 | FromGitter | <Albus70007> it says: rootsocket.recv(1024) has no type (or is ambiguous) |
18:18:14 | Yardanico | Can you show us the code? maybe paste it on ix.io or bpaste.net or paste.debian.net or del.dog or whatever paste service you like :) |
18:18:49 | FromGitter | <Albus70007> i think i had to put {.async.} in the functions |
18:18:58 | Yardanico | Ah, yeah, of course, to make them async you need to do that |
18:19:31 | Yardanico | I'd suggest you to read some docs or examples from asyncdispatch :) |
18:22:00 | * | rauss quit (Quit: WeeChat 2.7) |
18:27:17 | FromDiscord | <mratsim> @Araq, the full example is there: https://github.com/mratsim/weave/blob/master/weave/channels/pledges.nim#L150-L158, there is no memory overhead because I allocate from a fixed size block from a memory pool but I lose the safety of variants |
18:27:30 | FromDiscord | <mratsim> *if I move outside of the case |
18:29:36 | Araq | sure but I have no other solution for now |
18:30:17 | Araq | so weird that Atomic has a non-trivial constructor |
18:31:46 | Yardanico | A guy in telegram just found out that if you put ; instead of # in nim.cfg the compiler segfaults :D |
18:32:40 | Araq | what? |
18:32:48 | Yardanico | yes |
18:32:50 | Araq | gotta try this |
18:32:52 | FromGitter | <Varriount> Araq: If runtime type information is no longer present in ARC, how will modules such as marshal work? |
18:33:12 | Araq | Varriount: by code generation through macros |
18:33:30 | Araq | or maybe by good old overloading and fieldPairs() |
18:50:29 | Zevv | Pff lot of hairy cases in the allocator code in system lib |
18:50:42 | disruptek | if you put ; instead of # ??? |
18:50:46 | disruptek | wut |
18:51:09 | disruptek | that's such a lame bug. |
18:51:10 | disruptek | jesus. |
18:51:44 | disruptek | back in my old shop, we had a special shrine to nouns like that. |
18:51:49 | disruptek | the wall of shame. |
18:51:52 | Araq | disruptek, fix it already |
18:51:55 | disruptek | it actually wasn't even a wall. |
18:52:06 | Yardanico | I wonder how that guy actually stumbled upon it :D |
18:52:17 | disruptek | it was a window. and we'd line up all our trophies of confidence there. |
18:52:26 | disruptek | and also amazing finds from customer cars. |
18:52:34 | narimiran | Yardanico: just some lisper using ; for comments? |
18:52:47 | solitudesf | my editor thinks that default comment symbol for cfg files is ; |
18:52:52 | disruptek | ; is a comment in the .ini format nimble used to use, right? |
18:53:19 | Yardanico | it also crashes with & |
18:53:26 | disruptek | can't quite fathom the relation. |
18:53:43 | disruptek | i'll fix it. man, that's awesome. |
18:54:04 | Araq | Zevv, as I said -d:useMalloc --gc:arc avoids Nim's custom allocator |
18:55:08 | Zevv | yeah but there's nooks and crannies |
18:55:13 | Zevv | I'm fine but it takes some digging |
18:55:22 | Yardanico | I'll test with all printable ASCII characters right now, I'm really curious |
18:55:32 | disruptek | nooks and crannies, huh |
18:55:49 | disruptek | i think that's a new one on me. |
18:56:15 | disruptek | zevv, if you need some help over there, just ask, buddy. |
18:56:26 | Zevv | nah, just need to do some code reading |
18:56:53 | Zevv | there's just tons of whens() which all depend on other things which depend |
18:56:53 | Zevv | etc |
18:57:38 | disruptek | oh, i guess that does sound kinda tricky. |
18:57:49 | Araq | I'm patching the code with 'and not defined(StandaloneHeapSize)' |
18:58:12 | Araq | because that's the one piece of logic in all of --os:standalone that makes sense |
18:58:48 | Araq | so you can do |
18:58:50 | Araq | nim c --d:StandaloneHeapSize=50 -r --gc:arc temp.nim |
18:58:52 | Araq | or |
18:58:59 | Araq | nim c --d:useMalloc -r --gc:arc temp.nim |
18:59:26 | Zevv | but we do need an --os:somethingnew probably, right |
18:59:39 | Araq | right. |
18:59:51 | Zevv | I don't want to pull in mmdisp for example |
19:00:08 | Araq | mmdisp is only whens |
19:00:18 | Araq | it doesn't produce any code |
19:00:26 | Araq | safe to keep it around |
19:01:28 | Yardanico | so nim.cfg crashes with all of these at the start of the line |
19:01:29 | Yardanico | 40:(, 41:), 44:,, 48:0, 49:1, 50:2, 51:3, 52:4, 53:5, 54:6, 55:7, 56:8, 57:9, 59:;, 91:[, 93:], 96:`, 123:{, 125:}, |
19:02:07 | Zevv | leorize[m]: got another situation with """ parsing |
19:02:18 | Yardanico | https://play.nim-lang.org/#ix=26RI |
19:02:33 | Yardanico | be careful, it will create 255 folders :P |
19:06:29 | narimiran | Zevv: please, no more improvements for you :P the last one made highlighting of system.nim awful (it is now fixed) |
19:07:14 | disruptek | wut |
19:07:18 | disruptek | 255 folders? |
19:07:27 | disruptek | is this some kind of practical joke? |
19:07:37 | Yardanico | ? |
19:07:45 | disruptek | am i on camera right now? |
19:07:58 | solitudesf | you are, im recording and streaming this irc right now |
19:08:09 | Yardanico | hey mom im on the tv |
19:08:18 | disruptek | get a load of this guy. |
19:09:56 | disruptek | i repro'd with a ; at the end of a line. |
19:10:25 | FromGitter | <Albus70007> i have an issue i commented yesterday with some c++ server sending me json data, can someone help me? |
19:10:47 | disruptek | sure, albus, but please use a pastebin. |
19:11:09 | FromGitter | <Albus70007> yes, i already have one |
19:11:11 | Yardanico | pastebin is not cool, they have ands :( |
19:11:13 | Yardanico | *ads |
19:11:28 | disruptek | well, whatever the kids are calling it these das. |
19:11:32 | disruptek | ^days |
19:11:38 | FromGitter | <Albus70007> https://pastebin.com/u13H9MYe |
19:11:41 | Yardanico | :( |
19:11:43 | FromGitter | <Albus70007> thats my nim client |
19:11:46 | disruptek | lol |
19:12:14 | Yardanico | @Albus70007, well, from the start, your toJson can be greatly simplified if you use %* or json.to |
19:12:15 | disruptek | you guys are hilarious to me today for some reason. |
19:12:20 | Zevv | narimiran: well, don't go to system.nim line 3558 then |
19:12:40 | disruptek | i dare you to go there. |
19:13:06 | disruptek | what are you waiting for? |
19:13:14 | FromGitter | <Albus70007> which is able to recieve data from the server (which i can only provide the executable) a few iterations, 3 with C backend and 27 with C++ backend |
19:13:14 | disruptek | do not deny me this. |
19:13:44 | disruptek | albus: really? the c backend produces different results? |
19:14:12 | disruptek | that's pretty interesting. |
19:14:13 | FromGitter | <Albus70007> and also the number of echos i have between iterations |
19:14:22 | Yardanico | @Albus70007 can you give the executable? maybe upload it on transfer.sh or something |
19:14:26 | Yardanico | I'll try to run it via wine :P |
19:15:04 | Yardanico | also please give PlayerInputs module :) |
19:15:10 | FromGitter | <Albus70007> ill try, ok |
19:15:40 | FromGitter | <Albus70007> PlayerInputs its just a type with those fields i fill, i will add it to the pastebin |
19:17:06 | FromGitter | <Albus70007> not gonna lie, idk how to use transfer.sh :p |
19:17:31 | disruptek | it doesn't matter. π |
19:18:17 | Zevv | araq: am I supposed to fall into the 'elif defined(nimV2) or usesDestructors:' branch in mmdisp:511 ? |
19:18:26 | Yardanico | you can just upload fiels via the browser on https://transfer.sh :) |
19:18:35 | Yardanico | or use any other file sharing platform like google drive |
19:18:48 | Yardanico | transfer.sh has this "click to browse." button |
19:19:07 | * | narimiran went to line 3558 and never came back |
19:19:38 | Zevv | and please, can you disable the message at exit about the nimsuggest termination |
19:19:40 | Zevv | it is noise |
19:19:43 | Zevv | and not informative |
19:19:55 | Araq | Zevv, yeah |
19:20:04 | lqdev[m] | is there any way of "flattening" generic types in macros? eg. I have a glm `Vec2[float]`, and I'd like to get the final object implementation. simply doing `x[0].getTypeInst[1].getTypeImpl` doesn't help, because I get a typedesc for an nnkGenericBody, but I'd like an nnkObject |
19:20:24 | FromGitter | <Albus70007> ok, it says, Uploading... loopback.exe has it finished yet? |
19:20:34 | Yardanico | well it will show a progress bar :) |
19:20:34 | Zevv | Araq: ok, that's good then. |
19:20:36 | lqdev[m] | this works for variables, eg. calling `getTypeImpl` on `var a: Vec2[float]` works fine |
19:20:48 | Zevv | This basically works, although I probably touched stuff I shouldn't have |
19:20:48 | Yardanico | and is that server yours or is it available publicly anywhere? |
19:20:54 | lqdev[m] | :s/works fine/does what I want/ |
19:21:01 | Yardanico | or did you get the protocol stuff by reverse engineering (just curious)? |
19:21:35 | FromGitter | <Albus70007> progress bar is at 100% |
19:21:44 | Yardanico | well upload it using your own file sharing platform |
19:21:53 | FromGitter | <Albus70007> ok |
19:21:59 | Yardanico | the one you like |
19:22:59 | FromGitter | <Albus70007> https://drive.google.com/file/d/1loaTp5P4KwIPDdbofAAgsodfmSbmQmiB/view?usp=sharing |
19:23:43 | FromGitter | <Albus70007> this will run the server for a thousand iterations i think and will return some stats |
19:23:51 | FromGitter | <Albus70007> usage is like this: |
19:24:35 | FromGitter | <Albus70007> loopback.exe -port myportnumber(8085 hardcoded in my program) -num_cars 2 |
19:25:58 | FromGitter | <Albus70007> also PlayerInputs are in the pastebin now |
19:26:17 | federico3 | https://nim-lang.org/araq/gotobased_exceptions.html "In the goto based exceptions mode checked runtime errors like Index out of bounds or integer overflows are not catchable" ... this is a very big drawback |
19:26:38 | Yardanico | ok it seems I got it to run in wine lemme check |
19:27:12 | Yardanico | "n = n or pair.b.uint16 shl pair.a" undeclared b here |
19:27:30 | FromGitter | <Albus70007> in my code? |
19:27:35 | Yardanico | yes |
19:27:42 | FromGitter | <Albus70007> line? |
19:27:57 | Yardanico | 46-47 on pastebin |
19:28:01 | Yardanico | "n = n or pair.b.uint16 shl pair.a" |
19:28:24 | FromGitter | <Albus70007> i guess its bs |
19:28:49 | Yardanico | maybe it's pair[1] and pair[0]? |
19:29:06 | Yardanico | at least it compiles that way |
19:29:36 | FromGitter | <Albus70007> i borrowed that code from someone in here, idk |
19:29:47 | Yardanico | what to do after starting both? |
19:30:21 | FromGitter | <Albus70007> nothing, it should print a few times the inputs and then stop |
19:30:51 | Yardanico | well yeah it only prints one time and hangs |
19:30:57 | FromGitter | <Albus70007> i commented every echo maybe |
19:31:36 | Yardanico | no |
19:31:57 | FromGitter | <Albus70007> whats your nim version? |
19:32:39 | Yardanico | latest devel, it hangs on bot.rootsocket.recv after first iteration |
19:32:42 | Yardanico | I'll do some things to check why |
19:32:47 | Zevv | ar_q: is there a way to avoid instantiation of a 13Kb MemRegion object? |
19:35:11 | FromGitter | <Albus70007> @Yardanico , b is just a type that zip() returns |
19:35:21 | Yardanico | what's your nim version btw? |
19:35:30 | FromGitter | <Albus70007> 1) 0.4 |
19:35:43 | FromGitter | <Albus70007> the one on the web basically |
19:36:07 | Yardanico | And can I read about the protocol of that loopback.exe somewhere? |
19:36:10 | Araq | Zevv, not with TLSF |
19:36:13 | Yardanico | or a working example |
19:36:15 | Yardanico | in another language |
19:36:15 | Araq | that its cost |
19:36:26 | FromGitter | <Albus70007> @Yardanico python one |
19:36:31 | Yardanico | well, can you give it? |
19:36:38 | FromGitter | <Albus70007> sure |
19:37:37 | FromGitter | <Albus70007> https://drive.google.com/file/d/1B-jXzXaEZcaOo2enwFNcBO33-Z-FPikv/view?usp=sharing |
19:38:16 | FromDiscord | <Clyybber> Hey, goto exceptions are looking great |
19:38:46 | Yardanico | and what is expected to happen when I run this python script? |
19:38:51 | Yardanico | it seems to run forever too |
19:39:21 | FromGitter | <Albus70007> correctly or freezed |
19:39:35 | Yardanico | well it just runs 10 iterations in the while loop and then freezes |
19:39:39 | Yardanico | with nothing happening |
19:39:53 | Yardanico | maybe your program loopback.exe itself is not correct? |
19:40:08 | FromGitter | <Albus70007> let me check |
19:40:48 | FromGitter | <Albus70007> mine runs fine the python one at least |
19:41:03 | Zevv | Araq: so how do I get rid of that then? |
19:42:06 | FromGitter | <Albus70007> Maybe its not compatible with linux/wine |
19:42:12 | FromGitter | <Albus70007> i will ask |
19:42:22 | FromGitter | <codenoid> hellow, i'm new in Nim |
19:42:28 | FromDiscord | <Clyybber> sup |
19:42:29 | FromGitter | <Albus70007> welcome then |
19:44:09 | disruptek | ~codenoid is new in Nim |
19:44:10 | disbot | codenoid: 11new in Nim |
19:45:09 | FromGitter | <Albus70007> @Yardanico answer might take long unfortunatley |
19:46:31 | FromGitter | <Albus70007> you are passing the args i told you right? and this: β 1048 bytes / packet β RLBot controller connected! β appears on the exe's console? [https://gitter.im/nim-lang/Nim?at=5e1631970ba7b60f20468dbd] |
19:48:28 | * | marmotini_ quit (Remote host closed the connection) |
19:48:42 | Yardanico | it tells me 1050 bytes / packet though |
19:49:03 | FromGitter | <Albus70007> thats definetely wrong |
19:49:23 | FromGitter | <Albus70007> try pasing 1 in the bots_num |
19:49:58 | FromGitter | <Albus70007> that should be 737 |
19:50:30 | * | marmotini_ joined #nim |
19:50:30 | * | marmotini_ quit (Remote host closed the connection) |
19:50:49 | lqdev[m] | uh? https://play.nim-lang.org/#ix=26S1 |
19:50:56 | lqdev[m] | so how am I supposed to know what `float` really is? |
19:50:57 | disruptek | ~goto is a new high-performance, zero-drawback exception system in Nim's devel branch; see https://forum.nim-lang.org/t/5784 |
19:50:57 | disbot | goto: 11a new high-performance, zero-drawback exception system in Nim's devel branch; see https://forum.nim-lang.org/t/5784 |
19:51:03 | * | marmotini_ joined #nim |
19:52:03 | disruptek | lqdev: i dunno, it's like there's always a black art to getting type data, somehow. |
19:52:12 | krux02 | lqdev[m], yea you got a typedesc sneak in. |
19:52:39 | krux02 | typdesc are wrapper symbols that pretend to be the symbol that you are looking for, but they are not |
19:52:45 | FromGitter | <codenoid> is nim have exact function like https://golang.org/pkg/encoding/binary/#Read |
19:52:45 | lqdev[m] | krux02: after playing with macros for a while I know why you hate typedesc so much. |
19:52:45 | krux02 | you have to unwrap them |
19:52:59 | lqdev[m] | ikr, but getImpl yields a nilLit in case of primitives |
19:53:05 | krux02 | yes |
19:53:13 | Araq | Zevv, via -d:useMalloc |
19:53:28 | krux02 | when you have a typedesc, you have to access the first child |
19:53:36 | krux02 | and call getImpl on that. |
19:53:55 | krux02 | I opened an issue about that a very long time ago |
19:54:00 | * | marmotini_ quit (Remote host closed the connection) |
19:54:07 | lqdev[m] | seems like I have to do `x.getTypeImpl[1].typeKind` in that case |
19:54:25 | * | marmotini_ joined #nim |
19:54:34 | krux02 | the symbol and the typedesc appear the same. They show equal when compared, they print that they are the same symbol, but nope they are not. |
19:54:45 | krux02 | yes |
19:54:48 | krux02 | you understood it. |
19:55:04 | FromDiscord | <Clyybber> Araq: Do you know why we check ins.n aliases loc *and* loc aliases ins.n here: https://github.com/nim-lang/Nim/blob/devel/compiler/dfa.nim#L628 |
19:55:58 | * | leorize joined #nim |
19:56:06 | Zevv | Araq: nope |
19:56:52 | FromGitter | <codenoid> i'm trying to do this `endians.bigEndian64(@[196, 175, 160, 214, 14], p)` just like golang `binary.Read()` |
19:56:55 | Zevv | I do fall into that branch of ifs I just asked, and that is where the MemRegion comes from |
19:57:18 | FromGitter | <codenoid> i have no idea what i do now |
19:57:56 | leorize | Zevv: what's the highlighting prob? |
19:58:28 | Zevv | wrong """ long strings again, but let me first check if I'm properly up to date |
19:58:36 | Zevv | but first first I have to get my wifi fixed because this is borked here |
19:58:46 | leorize | if it's in system.nim, then I fixed that yesterday |
19:59:12 | FromGitter | <matrixbot> `grantmwilliams` is there a type i can use for iterating over a seq, array, openArray or string? |
19:59:24 | Araq | Zevv, strange, beyond my knowledge then |
19:59:39 | Araq | well it's a bug I think |
19:59:50 | leorize | @grantmwilliams: can you please connect via the freenode bridge :p |
19:59:58 | leorize | anyhow, wdym by type for iterating? |
20:00:00 | Yardanico | @grantmwilliams what do you mean "type"? |
20:00:05 | Yardanico | you just use for loops for any of them |
20:00:20 | Yardanico | they all have items() iterators defined for them |
20:00:30 | FromGitter | <Albus70007> @Yardanico , any news? β wine compatibility hasnt been tested |
20:00:45 | leorize | Zevv: also, you want me to hide nimsuggest crashing? |
20:00:55 | Yardanico | you mean num_cars? |
20:00:56 | leorize | oh just the one on exit |
20:01:00 | FromGitter | <Albus70007> yes |
20:01:05 | FromGitter | <matrixbot> `grantmwilliams` yeah ill try the freenode bridge again in a bit. it didnt work for me last time.. |
20:01:10 | Yardanico | if I pass 1 instead of 2 I get 739 bytes / packet |
20:01:33 | FromGitter | <matrixbot> `grantmwilliams` i wanted a generic function that takes something you can iteratre through (an array of numbers a string of characters) and lets you create an iterable of an infinite cycle of it |
20:01:53 | FromGitter | <Albus70007> i am asking for the source code, not sure if i can get it |
20:01:55 | Yardanico | for 1 you use openArray |
20:02:03 | FromGitter | <matrixbot> `grantmwilliams` was wondering if there was some type T that worked for an iterable container similar to how someNumber works for floats and ints |
20:02:14 | Yardanico | openArray :) |
20:02:22 | FromGitter | <matrixbot> `grantmwilliams` beautiful |
20:02:24 | FromGitter | <matrixbot> `grantmwilliams` thank you |
20:02:29 | Yardanico | it works for strings, arrays, sequences |
20:02:59 | FromGitter | <matrixbot> `grantmwilliams` that is exactly what i wanted. thank you |
20:03:08 | leorize | https://play.nim-lang.org/#ix=26Se |
20:03:09 | leorize | :P |
20:03:15 | FromGitter | <Albus70007> maybe try printing what do you receive, probably the header is not being encoded |
20:04:49 | Yardanico | leorize: Error: 'a' is of type <openArray[char]> which cannot be captured as it would violate memory safety, declared here: /usercode/in.nim(1, 17) |
20:04:50 | Yardanico | 0_0 |
20:05:03 | Yardanico | ah wait maybe I'm using it the wrong way |
20:05:15 | leorize | make it a template |
20:05:18 | leorize | problem solved lol |
20:08:07 | FromGitter | <matrixbot> `grantmwilliams` yeah i just did openArray[T] because i also want it to work with numeric values |
20:08:44 | * | marmotini_ quit (Remote host closed the connection) |
20:10:49 | leorize | Zevv: alright, hidden that message on latest nim.nvim |
20:11:18 | FromGitter | <Albus70007> @Yardanico Thanks for trying anyway, ill investigate it |
20:11:50 | FromDiscord | <Clyybber> Araq: ping |
20:11:54 | FromGitter | <matrixbot> `grantmwilliams` Nim doesnt have union types does it? |
20:12:04 | FromDiscord | <Clyybber> we have case objects |
20:12:33 | FromDiscord | <Clyybber> they are implemented using union types |
20:12:48 | FromGitter | <matrixbot> `grantmwilliams` interesting |
20:12:52 | leorize | if you want C-style bit-reinterpreting union type, then we don't have that |
20:13:09 | leorize | `cast` can be used for that purpose though |
20:13:38 | FromGitter | <matrixbot> `grantmwilliams` i was curious if you could have a proc or func that took string | int32 or something similar |
20:13:44 | Yardanico | yes |
20:13:54 | leorize | not at runtime, but yes |
20:14:12 | FromGitter | <matrixbot> `grantmwilliams` i think you can do it erlang style right? |
20:15:26 | leorize | what's erlang style :P |
20:15:28 | Yardanico | you just check for types in the proc compile-time if which is "when" |
20:15:34 | Yardanico | and I don't know what is erlang style :P |
20:15:56 | Yardanico | basically doing string | int32 is the same as making two procedures with same name when one accepts string and other one accepts int32 |
20:16:11 | FromGitter | <matrixbot> `grantmwilliams` yeah thats what you'd do in erlang |
20:16:12 | Yardanico | it's just that in some cases it might be better to make them into one proc if they share a lot of code |
20:16:26 | * | lxbarbosa joined #nim |
20:16:40 | FromGitter | <matrixbot> `grantmwilliams` in erlang its also common to have a variable number of arguments |
20:18:18 | * | sagax quit (Ping timeout: 265 seconds) |
20:18:24 | lxbarbosa | is Nim in action still a good start even after Nim 1.0? tx |
20:19:00 | narimiran | lxbarbosa: yeah |
20:19:05 | Yardanico | why not? all nim in action code is checked in the test suite |
20:19:11 | Yardanico | so it'll still work :) |
20:20:13 | lxbarbosa | oh, great! getting it late, thanks! |
20:20:50 | Zevv | leorize: no, sure, reporting crashes makes sense |
20:20:57 | * | nsf quit (Quit: WeeChat 2.7) |
20:21:02 | Zevv | but normal termination could be silent i guess |
20:21:20 | leorize | yea, I've just done that :P |
20:21:30 | Zevv | sweet, takk |
20:21:49 | leorize | it's actually tricky to detect when neovim is exiting without the use of autocmd :P |
20:26:53 | * | lxbarbos` joined #nim |
20:27:46 | Yardanico | lol https://github.com/nim-lang/Nim/issues/13074 |
20:27:48 | disbot | β₯ Think about the title, twice ; snippet at 12https://play.nim-lang.org/#ix=26Sw |
20:27:48 | * | lxbarbosa quit (Ping timeout: 248 seconds) |
20:27:58 | FromGitter | <matrixbot> `grantmwilliams` i should probably read that book. right now im just writing code and occasionally checking the docs or here... |
20:28:23 | * | sagax joined #nim |
20:32:08 | * | filcuc joined #nim |
20:36:28 | * | lxbarbos` quit (Ping timeout: 260 seconds) |
20:42:26 | * | sagax quit (Ping timeout: 240 seconds) |
20:54:26 | * | narimiran quit (Ping timeout: 240 seconds) |
21:09:21 | * | sagax joined #nim |
21:20:30 | FromGitter | <Albus70007> how can i set an string to be ascii / encode it as ascii |
21:24:38 | lqdev[m] | strings are encoded as ascii |
21:25:08 | FromGitter | <Albus70007> so how do i convert them to utf8, unicode, etc |
21:25:27 | lqdev[m] | with the unicode module, https://nim-lang.org/docs/unicode.html |
21:25:36 | FromGitter | <Albus70007> thank you |
21:25:44 | lqdev[m] | but you rarely need this, as UTF-8 was built to be compatible with ASCII |
21:26:18 | FromGitter | <Albus70007> ok, its for learning purposes more than actually using it |
21:26:18 | FromDiscord | <IanIAnIAN> Readting r/nim I feel it is a bad time to ask for some help with about exceptions |
21:27:56 | Zevv | as good or bad as any time I guess? |
21:28:57 | Araq | there is also encodings.nim for converting between encodings |
21:30:35 | Araq | IanIAnIAN: please ask but I'm about to leave |
21:36:19 | Zevv | araq: I seem to get away with only https://github.com/zevv/Nim/commit/33fae452ec18a9dd48e6e9c65277c4133bc28a45 |
21:36:45 | Zevv | but strv2 does not use my osalloc memory functions but those from getLocalAllocator() |
21:37:12 | Zevv | so I need to do some more learning to see what the philosophy behind all that is |
21:38:31 | FromDiscord | <mratsim> @leorize @grantmwilliams we have both tagged and untagged unions |
21:38:54 | FromDiscord | <mratsim> tagged unions / ADTs are called object variants in Nim |
21:39:25 | FromDiscord | <mratsim> untagged unions are objects with fields and the pragma {.union.}, fields share the underlying memory buffer |
21:40:53 | FromDiscord | <IanIAnIAN> I was reading https://sergio.dev/posts/how-to-parse-rss-feeds-with-nim/ and well it was useful till I got here https://play.nim-lang.org/#ix=26SY |
21:45:49 | disruptek | i want named else branches. |
21:45:55 | disruptek | that i can break from. |
21:45:57 | FromDiscord | <Clyybber> what |
21:46:04 | FromDiscord | <Clyybber> why? |
21:46:12 | disruptek | if foo: else bakery: ... break bakery |
21:46:34 | FromDiscord | <Clyybber> what is the use case? |
21:46:39 | FromDiscord | <Clyybber> why not put a block into the else? |
21:46:49 | FromDiscord | <mratsim> can't you wrap the whole thing in a bakery? |
21:46:52 | disruptek | also i want while foo: else: bar and for foo in bar: else: |
21:46:57 | FromDiscord | <mratsim> and ship it while it's hot |
21:47:14 | FromDiscord | <Clyybber> hes messin with us |
21:47:14 | disruptek | for one thing, it adds an indent to both clauses. |
21:47:23 | FromDiscord | <mratsim> aren't you asking for a duff's device? |
21:47:23 | disruptek | c'mon, be serious. |
21:48:23 | FromDiscord | <Clyybber> while cond: ... else: ... is not thaat crazy |
21:48:34 | FromDiscord | <Clyybber> but for foo in bar: ... else: ... |
21:48:50 | disruptek | it's exactly the same. |
21:49:04 | disruptek | while/else doesn't mean "do this if the loop never ran". |
21:49:04 | FromDiscord | <Clyybber> oh |
21:49:24 | FromDiscord | <Clyybber> what else would it mean then? |
21:49:24 | disruptek | it means, "do this if we did not prematurely terminate the loop". |
21:49:50 | * | NimBot joined #nim |
21:50:08 | FromDiscord | <Clyybber> disruptek: Wrap the loop in a block and break? |
21:50:22 | disruptek | because if the loop exits normally, that's essentually truthy, right? and if we terminate it early, that's false. |
21:50:22 | Araq | your gist is ok except your patch to osalloc.nim |
21:50:38 | disruptek | clyybber: this is what i do now. i just want to do it more elegantly. |
21:50:59 | FromDiscord | <Clyybber> its as elegant as it gets |
21:51:01 | FromDiscord | <IanIAnIAN> I wondered what the correct way to handle an rss feed with no pubDate in this code was? My attempt was b0rked https://play.nim-lang.org/#ix=26T6 |
21:51:05 | FromDiscord | <Clyybber> else is just confusing IMO |
21:51:25 | FromDiscord | <Clyybber> I would have never guessed the behaviour you are looking for |
21:51:28 | disruptek | hmm, maybe we should look at some examples. |
21:51:35 | disruptek | this is a feature of python, fwiw. |
21:52:07 | FromDiscord | <IanIAnIAN> Some features aren't worth having π |
21:52:16 | Araq | IanIAnIAN: sorry, not in my domain |
21:52:52 | FromDiscord | <IanIAnIAN> too simple, eh? |
21:53:02 | Araq | I would avoid the empty 'except' though and only catch exceptions you saw happening |
21:53:10 | Araq | like ValueError, IOError, OSError |
21:53:48 | FromDiscord | <mratsim> @disruptek, the main issue with your proposal is that it breaks the AST and parser |
21:54:01 | FromDiscord | <Clyybber> and that its redundant |
21:54:21 | FromDiscord | <Clyybber> and kind of confusing IMO |
21:54:58 | Araq | 'else' on a 'for' loop in Python always was a WTF moment for me |
21:54:59 | FromDiscord | <mratsim> it's OK, but I'm not even sure I've seen it in the wild in Python |
21:55:02 | disruptek | https://gist.github.com/disruptek/272e966152bb3c46f964939ab6803c2b |
21:55:16 | Araq | mratsim: it's actually common in Python |
21:55:30 | FromDiscord | <mratsim> well maybe not in data science code then π |
21:55:40 | disruptek | i mean, i use it all the time in python, so that's why i write nim the way i do. |
21:55:54 | FromDiscord | <Clyybber> disruptek: Hmm, I guess a macro that accomplishes that would be a better idea |
21:56:05 | disruptek | yes, i would obviously start with a macro. |
21:56:09 | disruptek | !repo disruptek/forelse |
21:56:10 | disbot | https://github.com/disruptek/forelse -- 9forelse: 11a macro adding `for: else:` and `while: else:` syntax to nim 15 0β 0π΄ |
21:56:14 | FromDiscord | <Clyybber> Nice! |
21:56:20 | disruptek | well, i haven't written yet. |
21:56:22 | Araq | somebody should review and merge this, https://github.com/nim-lang/Nim/pull/13069 |
21:56:23 | disbot | β₯ System cleanup, part 1 |
21:56:53 | FromDiscord | <Clyybber> Araq: Sorry, busy with the dfa thingy |
21:57:07 | Araq | fair enough |
21:57:10 | FromDiscord | <mratsim> Sorry trying to generate docs while staying sane |
21:57:13 | kungtotte | Don't name it 'else' though :P Lots of people get tripped up by the naming in Python |
21:57:25 | disruptek | what do you propose? |
21:57:26 | FromDiscord | <mratsim> want to get a stable release of Arraymancer before I break everything |
21:57:33 | FromDiscord | <mratsim> otherwise |
21:57:39 | FromDiscord | <Clyybber> disruptek: Call it search and found |
21:57:45 | FromDiscord | <Clyybber> search for the loop |
21:57:48 | kungtotte | disruptek: a common suggestion in the Python world is nobreak |
21:57:49 | FromDiscord | <Clyybber> found for the else |
21:57:50 | FromDiscord | <mratsim> nah, otherwise is better |
21:58:14 | disruptek | otherwise sounds better to me. |
21:58:18 | FromDiscord | <mratsim> nobreak? wow I wouldn't even understand what it would mean |
21:58:20 | FromDiscord | <IanIAnIAN> if else wrong |
21:58:20 | Araq | for x in bar: echo "y" |
21:58:23 | FromDiscord | <treeform> Hey dom96, when you submitted openSSL 9 years it had a huge `when true` disabling a huge part of the code and it's still there. Is that on purpose? Can I enable some functions? https://github.com/nim-lang/Nim/commit/d68782cd38142be328e4df41e782654cebafc8b7#diff-09ce05d4800aaaa6014de76809a63957R224 should we remove the rest? |
21:58:25 | Araq | empty: echo "n" |
21:58:51 | disruptek | empty. that's interesting. |
21:58:57 | Araq | "for ... in ...: body empty: body" |
21:59:07 | disruptek | but it's only when the iterator is empty, right? |
21:59:09 | Araq | or maybe "ifempty" |
21:59:29 | Araq | why do you ask me? I can barely remember the Python idiom |
21:59:42 | disruptek | we're talking about nim 2020 here, not python. π€£ |
21:59:42 | kungtotte | mratsim: https://news.ycombinator.com/item?id=17169331 |
21:59:51 | kungtotte | (and everyone else too for that matter) |
22:00:55 | * | Vladar quit (Quit: Leaving) |
22:01:23 | disruptek | do you think the current idiom is more readable? |
22:03:00 | kungtotte | disruptek: with the block found? No, for-else makes more sense to me. But then I'm experienced in Python and I've internalised for-else as a concept. It looked really strange to me when I first encountered it because I hadn't seen it anywhere else. I had nothing to go on and my intuition about it was wrong. |
22:03:40 | disruptek | i use a ton of named block: and i like how explicit it is. |
22:03:59 | disruptek | but the current idiom is more wtf to me than the proposal. |
22:04:30 | Araq | fwiw block+break was based on a paper that I lost |
22:04:54 | disruptek | updated with otherwise and named otherwise: https://gist.github.com/disruptek/272e966152bb3c46f964939ab6803c2b |
22:05:00 | Araq | it was about how to get control flow primitives right |
22:05:22 | disruptek | well, i'm glad you impl it. |
22:06:08 | FromDiscord | <mratsim> ah the for else in python is indeed very strange |
22:06:24 | disruptek | funny that some people think it's weird. |
22:06:59 | disruptek | it's neat to think that we can even have opinions on structures this simple. |
22:07:11 | FromGitter | <Albus70007> how can i optimise my code? |
22:07:19 | FromDiscord | <mratsim> !repo documentation |
22:07:19 | disbot | https://github.com/FedericoCeratto/nim-package-directory -- 9nim-package-directory: 11Nim package directory - documentation builder 15 24β 9π΄ 7& 4 more... |
22:07:32 | FromDiscord | <mratsim> !repo docgen |
22:07:33 | disbot | https://github.com/reactjs/react-docgen -- 9react-docgen: 11A CLI and toolbox to extract information from React component files for documentation generation purposes. 15 2522β 233π΄ 7& 29 more... |
22:07:41 | FromDiscord | <mratsim> :/ |
22:07:49 | disruptek | what are you looking for? |
22:07:57 | FromDiscord | <mratsim> I guess I'm gonna generate my documentation like a caveman again |
22:08:08 | FromDiscord | <Clyybber> asciidoc |
22:08:09 | disruptek | just do it in version-1-0. |
22:08:19 | disruptek | is it that bad? |
22:09:18 | FromDiscord | <mratsim> something to avoid having to do this: https://github.com/mratsim/Arraymancer/blob/master/nimdoc.cfg#L40 and this: https://github.com/mratsim/Arraymancer/blob/master/arraymancer.nimble#L221 and avoid having to learn CSS mouse-over and resizing rules: https://mratsim.github.io/Arraymancer/ |
22:09:40 | FromDiscord | <mratsim> this way I can put that in CI |
22:10:41 | FromGitter | <matrixbot> `grantmwilliams` iterators arent lazy in nim right? seeing some conflicting results online |
22:11:03 | disruptek | they are lazy. |
22:11:10 | Zevv | so am I |
22:11:35 | disruptek | ~zevv is lazy and so is he. |
22:11:36 | disbot | zevv: 11lazy and so is he. |
22:12:39 | Zevv | ehm, but how can an iterator *not* be lazy? |
22:13:02 | Zevv | isnt that the whole point? otherwise you just generate a seq of something? |
22:13:15 | disruptek | this nimdoc.cfg is blowing my mind right now. |
22:13:37 | FromDiscord | <mratsim> it's just a big hack that was left for 2 years |
22:15:02 | disruptek | but this is pretty cool. |
22:15:19 | disruptek | and it actually renders fairly nicely on my display, which is not the case for the default docs for whatever reason. |
22:15:37 | Zevv | albus7007: optimize how? |
22:15:45 | disruptek | ~compiler |
22:15:46 | disbot | compiler: 11https://nim-lang.org/docs/nimc.html -- the Nim Compiler User Guide -- disruptek |
22:17:03 | FromDiscord | <mratsim> it's broken on resize @disruptek |
22:17:10 | FromDiscord | <mratsim> you need to have a widescreen |
22:17:21 | disruptek | is that what i'm doing wrong? |
22:17:40 | disruptek | i'm on 4k and i view almost everything at 2up. |
22:17:45 | FromDiscord | <mratsim> the docs is completely broken on mobile :p |
22:17:50 | FromDiscord | <mratsim> are* |
22:18:18 | FromDiscord | <mratsim> @Albus70007 what are you developing? |
22:18:22 | disruptek | actually, it seems to be rendering okay right now. |
22:18:38 | disruptek | i guess the site renders a little better for whatever reason. |
22:18:48 | FromDiscord | <mratsim> the mouse over shoul be annoying |
22:19:02 | FromDiscord | <mratsim> but well if it works better and I didn't do anything I guess I'll take the win |
22:19:59 | FromGitter | <Albus70007> well, we have a community of rocket league bot designers, and the framework will soon change to use json, i am working on a nim one (basically a socket client, but its being very slow compared to its c++ brother) |
22:20:06 | FromDiscord | <mratsim> but in general a good doc generation library or bondings to Sphinx would be quite helpful |
22:20:30 | FromDiscord | <mratsim> maybe naive but do you compile with -d:release or -d:danger? |
22:20:41 | FromGitter | <Albus70007> nope |
22:20:45 | FromGitter | <Albus70007> let me see |
22:20:52 | FromDiscord | <mratsim> easy win there ; |
22:21:01 | FromGitter | <Albus70007> i hope |
22:23:14 | FromGitter | <Albus70007> it says Debug Build) so i guess i am not compiling it as i should |
22:26:20 | FromDiscord | <mratsim> just do nim c -d:release yourfile.nim |
22:26:41 | FromDiscord | <mratsim> the difference is that with -d:release Nim passes -O3 to gcc |
22:27:05 | FromDiscord | <mratsim> and with -d:danger it also disables assertions, bound checks stacktraces |
22:27:06 | Zevv | -d:danger will bring you more, but it will omit runtime out of bounds checks |
22:27:23 | FromDiscord | <mratsim> danger is similar to C/C++ release |
22:27:34 | FromDiscord | <mratsim> but it's hard to debug |
22:27:51 | Zevv | nope, you can just mix with --debugger:native |
22:28:02 | Zevv | thats the funny part |
22:28:09 | FromDiscord | <mratsim> yes that works |
22:28:22 | FromDiscord | <mratsim> it's actually the only sane way to debug Weave :p |
22:28:37 | FromDiscord | <mratsim> Nim stacktraces in remote threads tend to get eaten on exceptions |
22:29:10 | Araq | use -d:noSignalHandler |
22:29:27 | Araq | our signal handler is not "signal handling safe" |
22:29:37 | FromGitter | <Albus70007> almost no improvement, i will try danger |
22:29:44 | Araq | whatever that actually means |
22:31:36 | FromGitter | <Albus70007> AYE! now thats better! THX |
22:31:59 | * | tane quit (Quit: Leaving) |
22:33:33 | Araq | time to optimize -d:release |
22:33:57 | Araq | esp since I almost never use -d:danger anymore |
22:34:07 | * | lritter quit (Quit: Leaving) |
22:34:55 | shashlick | Araq: going nuts, need your help with compiler AST |
22:36:15 | FromDiscord | <mratsim> @Araq, @stefantalpalaru works on libbacktrace should help a lot, in Nimbus Nim stacktraces are among the top contenders for slowness |
22:36:22 | FromGitter | <Albus70007> i still want to point out that my code reaches 0.0791937ms while the c++ one reaches 0.00138526ms |
22:37:23 | FromDiscord | <mratsim> Unless your code deals with string which are a pain to optimize, or you use dynamic dispatch, there is no reason for Nim code to be slower than C or C++ |
22:37:39 | shashlick | Araq: https://pastebin.com/6gRkdywP - I'm generating compiler AST from tree-sitter's AST |
22:38:08 | shashlick | note how A14 has a field a1 of type cchar and the associated AST |
22:38:20 | FromGitter | <Albus70007> mratsim, actually sending and receiving json packets so is that bad? |
22:38:21 | * | Lord_Nightmare quit (Quit: ZNC - http://znc.in) |
22:38:45 | FromDiscord | <mratsim> ah for json, try packedjson from !rep packedjson |
22:38:48 | shashlick | and when I add A1 which has a field a2 with cstring type, A14's a1 also gets modified but not the field name in the AST |
22:38:51 | FromDiscord | <mratsim> !repo packedjson |
22:38:52 | disbot | https://github.com/Araq/packedjson -- 9packedjson: 11packedjson is an alternative Nim implementation for JSON. The JSON is essentially kept as a single string in order to save memory over a more traditional tree representation. 15 38β 4π΄ |
22:39:08 | FromDiscord | <mratsim> Nim json is optimized for ergonomics |
22:39:19 | disruptek | that's a nice way of putting it. |
22:39:20 | FromDiscord | <mratsim> but it allocates a table at each tree node |
22:39:35 | FromDiscord | <mratsim> i.e. it's mega slow |
22:40:13 | FromGitter | <Albus70007> swapping will be as easy as changing the import? |
22:40:44 | FromDiscord | <mratsim> who knows, ask @Araq |
22:41:57 | * | ltriant joined #nim |
22:42:37 | * | Lord_Nightmare joined #nim |
22:47:43 | * | solitudesf quit (Ping timeout: 260 seconds) |
22:48:46 | FromGitter | <Albus70007> there is a very slight improvement, but since its compatible with my code out of the box i will use it, thank you, now i only need to unhardcode the headers and it should be done |
22:49:11 | * | cyraxjoe quit (Ping timeout: 268 seconds) |
22:49:14 | * | MightyJoe joined #nim |
22:51:51 | FromGitter | <Albus70007> we are actually still below python's speed XD by x2 |
23:02:22 | FromDiscord | <mratsim> pretty sure Python json is implemented in pure C so |
23:03:05 | FromGitter | <Albus70007> yeah, thats what i read i think, could i do the same with nim though? |
23:03:21 | disruptek | you /are/ doing the same in nim. |
23:03:42 | FromGitter | <Albus70007> then why it is slower? |
23:04:53 | FromDiscord | <mratsim> Fast json parsing is hard, see https://github.com/lemire/simdjson and https://arxiv.org/abs/1902.08318 (this is a very good read) |
23:05:47 | FromGitter | <Albus70007> ok, i will also ask other people to run my code in their computers, they probably have better ones |
23:06:31 | FromDiscord | <mratsim> even D json was slower than python π https://forum.dlang.org/thread/20151014090114.60780ad6@marco-toshiba |
23:07:13 | FromDiscord | <mratsim> anyway, the code and the explanations are out there and we could just Nimify some C code. It's just a question of time/interest |
23:07:28 | FromGitter | <Albus70007> good news, in my machine python is actually slower than nim so nim +1 |
23:07:43 | FromGitter | <Albus70007> i hope in theirs nim is fast af |
23:09:17 | * | abm quit (Quit: Leaving) |
23:16:37 | FromDiscord | <exelotl> uhhh so I forgot to add a {.compile:"foo.c".} in my code |
23:17:43 | FromDiscord | <exelotl> have a bunch of {.importc, extern:"xyz".} variables which are only defined in foo.c |
23:18:05 | FromDiscord | <exelotl> yet my code compiled anyway |
23:18:22 | FromDiscord | <exelotl> and my program crashed because it was reading garbage |
23:19:12 | FromDiscord | <exelotl> how could this even happen? shouldn't it have failed at link time/ |
23:19:15 | FromDiscord | <Clyybber> probably because you at some point had foo.c compiled |
23:19:24 | FromDiscord | <Clyybber> and it was still in your cache |
23:19:27 | FromDiscord | <Clyybber> I presume |
23:19:59 | FromDiscord | <exelotl> I'm using a local nimcache and I cleaned the project many times |
23:20:44 | FromDiscord | <Clyybber> hmm |
23:34:55 | * | filcuc quit (Remote host closed the connection) |
23:44:09 | FromDiscord | <exelotl> on the plus side I got this cool gif https://cdn.discordapp.com/attachments/312199400875360256/664605561152864258/GIF24.gif |
23:44:25 | FromDiscord | <Clyybber> is that on the gba? |
23:44:30 | FromDiscord | <exelotl> ye |
23:44:33 | FromDiscord | <Clyybber> damn |
23:44:35 | FromDiscord | <Clyybber> amazing |
23:44:46 | FromDiscord | <exelotl> haha you should see it when it's working ;) |
23:45:14 | FromDiscord | <Clyybber> I checked yours/or your artists twitter some time ago, your game really looks amazing |
23:45:26 | disruptek | i wanna see. |
23:45:34 | FromDiscord | <Clyybber> I also want to make a game for the gba with nimone day |
23:45:59 | FromDiscord | <Clyybber> its just such a nice console |
23:46:02 | FromDiscord | <mratsim> Arraymancer 0.6 tagged: https://github.com/mratsim/Arraymancer/releases/tag/v0.6.0 |
23:46:27 | FromDiscord | <Clyybber> @mratsim Nice! |
23:46:29 | FromDiscord | <mratsim> One day I want to finish my snes emulator |
23:46:39 | FromDiscord | <mratsim> and my go playing bot |
23:46:45 | FromDiscord | <Clyybber> one day arraymancer is gonna run on the gba |
23:47:01 | FromDiscord | <Clyybber> lol |
23:47:03 | disruptek | oh, i know what my next project'll be. |
23:47:06 | FromDiscord | <mratsim> crawl maybe, run, that's quite optimistic |
23:47:17 | disruptek | test coverage reports. |
23:47:25 | FromDiscord | <Clyybber> oh no |
23:47:41 | FromDiscord | <Clyybber> I don't want test coverage reports |
23:47:56 | disruptek | you're gonna love them. |
23:48:01 | FromDiscord | <mratsim> there was something to plug cov or whatever it's called to Nim using debugger:native |
23:48:03 | FromDiscord | <Clyybber> I dont want to see those pesky 0.0% |
23:48:11 | disruptek | !report coco |
23:48:24 | FromDiscord | <Clyybber> !repo coco |
23:48:27 | disbot | https://github.com/cocos2d/cocos2d-x -- 9cocos2d-x: 11Cocos2d-x is a suite of open-source, cross-platform, game-development tools used by millions of developers all over the world. 15 14055β 6821π΄ 7& 29 more... |
23:48:30 | disruptek | oh, it's html according to github. |
23:48:37 | disruptek | !repo coco nim |
23:48:38 | disbot | https://github.com/samuelroy/coco -- 9coco: 11Code coverage for Nim lang (CLI + library) 15 21β 1π΄ 7& 1 more... |
23:48:47 | FromDiscord | <Clyybber> did you just misuse your own bot? |
23:48:54 | disruptek | yeah. |
23:49:22 | disruptek | i just made some cookies last night and they are kinda blowing my mind right now. |
23:49:25 | FromDiscord | <demotomohiro> Can I rerun azure-pipeline without commit? |
23:49:25 | FromDiscord | <demotomohiro> Some checks were not successful, but I think it is not related to my PR. |
23:49:25 | FromDiscord | <demotomohiro> https://github.com/nim-lang/Nim/pull/13011 |
23:49:55 | FromDiscord | <Clyybber> disruptek: canabutter or what? |
23:50:11 | disruptek | actually, shortening. |
23:50:15 | FromDiscord | <exelotl> disruptek: here's a rather old gif from last year https://twitter.com/hot_pengu/status/1137819284246323203 |
23:50:32 | disruptek | right, i saw that one. π |
23:50:33 | * | lxbarbosa joined #nim |
23:50:38 | FromDiscord | <exelotl> there's another gif I like more but it seems to have vanished :\ |
23:51:01 | disruptek | it's always cool seeing parallax on these things. |
23:51:33 | disruptek | i can't believe how much time we spent on sidescrollers. |
23:51:43 | FromDiscord | <Clyybber> the art is so damn nice, and I suspect the code must be magic too, to run all that on a gba |
23:53:56 | FromDiscord | <exelotl> the code was pretty subpar when this gif was made... enemy spawning and stuff was super janky, and the levels are supposed to loop horizontally/vertically which lead to nasty bugs |
23:54:43 | FromDiscord | <exelotl> this is why we haven't been putting out more gifs... we had to take a step back and figure out how to do this stuff properly, so that the game can grow |
23:58:36 | FromDiscord | <Clyybber> @exelotl how much can the game grow before you hit size constraints? |
23:59:56 | FromDiscord | <exelotl> it's currently 2MB, max is 32MB |