00:02:19 | * | rauss joined #nim |
00:04:30 | * | ftsf joined #nim |
00:24:24 | * | Nobabs27 quit (Quit: Leaving) |
00:27:08 | * | girvo joined #nim |
00:27:10 | girvo | Hey all |
00:27:24 | ftsf | o/ |
00:36:40 | girvo | I've got kind of a silly question: I've got a cstring (from a C callback) that for certain calls has a real string in it, but for other calls suddenly has a len of 1 and no longer acts as a string |
00:36:50 | * | brson joined #nim |
00:37:01 | girvo | I know exactly how many bytes I need to read: how do I read them out into another buffer? |
00:37:31 | girvo | https://hastebin.com/asulojobiy.nim |
00:37:37 | girvo | This is what I've been trying so far |
00:37:58 | girvo | I'm sort of trying to port this; https://hastebin.com/ebenomareb.c |
00:57:58 | * | shashlick quit (Ping timeout: 240 seconds) |
00:58:33 | * | shashlick joined #nim |
01:14:15 | * | yglukhov joined #nim |
01:17:21 | girvo | Ah I see what I'm having issues with; null terminated strings from the C lib are causing me dramas on the Nim side |
01:18:09 | ftsf | checking for nil? |
01:18:18 | ftsf | on the return value |
01:18:29 | * | yglukhov quit (Ping timeout: 240 seconds) |
01:18:31 | girvo | Ah I see what I'm having issues with; null terminated strings from the C lib are causing me dramas on the Nim side |
01:18:45 | girvo | So I -was- getting the data, "echo" was failing instead |
01:18:49 | girvo | https://github.com/nim-lang/Nim/issues/1137 |
01:19:49 | ftsf | ahh |
01:20:50 | * | sz0 joined #nim |
01:21:24 | girvo | I wonder if I can just grab the cstring buf directly now... |
01:21:55 | girvo | https://hastebin.com/wijotapumu.nim |
01:21:59 | girvo | That's what I've ended up with |
01:23:48 | girvo | Is there a way I can make that a bit safer? Seems a bit... ick, heh. |
01:24:33 | * | Serenit0r joined #nim |
01:25:29 | * | huonw quit (Ping timeout: 240 seconds) |
01:25:49 | * | sz0 quit (Ping timeout: 240 seconds) |
01:26:28 | * | sz0 joined #nim |
01:26:29 | * | StarBrilliant quit (Ping timeout: 240 seconds) |
01:26:37 | girvo | Here's the whole context; Talking to the Docker daemon, via a Unix socket (that speaks HTTP) using the latest version of libcurl - https://hastebin.com/ufafomohoc.nim |
01:26:49 | * | Serenitor quit (Ping timeout: 240 seconds) |
01:28:26 | * | huonw joined #nim |
01:32:18 | * | StarBrilliant joined #nim |
01:33:52 | * | brson quit (Quit: leaving) |
01:35:48 | * | chemist69 quit (Disconnected by services) |
01:35:53 | * | chemist69_ joined #nim |
01:54:30 | girvo | What's the best way of gating features in a wrapper for a C library based on the version _for_ said C lib? |
02:04:12 | FromGitter | <Varriount> girvo: I don't follow |
02:05:11 | FromGitter | <Varriount> girvo: Also, if you're wrapping C structures, you're always going to get 'ick' |
02:10:29 | def-pri-pub | just got done porting my Linux Game Jam entry from desktop to browser: https://16bpp.net/games/pucker-up-lgj-2017 |
02:13:59 | def-pri-pub | (It's still made with Nim) |
02:16:34 | FromGitter | <Varriount> def-pri-pub: Neat! |
02:17:05 | FromGitter | <Varriount> My only gripe is the control scheme. I kept expecting 'qw' to control one ring, and 'op' to control the other |
02:17:30 | def-pri-pub | It did orignally |
02:17:40 | def-pri-pub | If it's frustrating people enough, I might change it back |
02:18:10 | def-pri-pub | you're mind might eventually ease into it |
02:18:46 | def-pri-pub | (I've still got to make a bug fix or tw) |
02:18:47 | * | Serenit0r quit (Quit: Leaving) |
02:18:48 | def-pri-pub | two* |
02:22:10 | girvo | Varriount: Yeah I guess you're right, heh. I'm still trying to find nicer ways of presenting safer interfaces to unsafe C libs. Most wrappers seem to stop at the unsafe side |
02:28:11 | FromGitter | <Varriount> girvo: Well, that's generally because we don't have any tools for generating safe wrappers. |
02:32:52 | girvo | Varriount, of course! I more wonder what a safe (or safer) wrapper would even look like? The nim-csfml wrapper attempted to use ptr objects with destructors to automate some of it; I wonder if RAII-styled semantics would even make sense... /me continues musing |
02:33:53 | FromGitter | <Varriount> Generally, if you want to automatically generate safer behavior, you need to know more about how input/output is used, and/or sacrifice efficiency |
02:40:56 | * | BitPuffin|osx quit (Ping timeout: 246 seconds) |
02:43:46 | * | vendethiel joined #nim |
02:47:41 | * | vendethiel- quit (Ping timeout: 258 seconds) |
03:02:53 | * | girvo quit (Ping timeout: 260 seconds) |
03:24:26 | * | sz0 quit (Quit: Connection closed for inactivity) |
03:47:32 | ldlework | ftsf: when building nimsynth I get: pico.nim(215, 10) Error: type mismatch: got (cint) but expected 'uint8' |
03:47:59 | ftsf | hmm, i suspect that's in an SDL wrapper thing? |
03:48:16 | ftsf | i have some changes i need to PR for the SDL wrapper |
03:49:00 | ldlework | no idea what pico.nim is |
03:50:21 | ftsf | it's a nim approximation of the pico8 api which backs on to SDL |
03:50:51 | ldlework | ftsf: do you just use "make" to build |
03:50:51 | ftsf | which is what i use for the UI and input |
03:51:04 | ftsf | yep |
03:51:08 | ldlework | :( |
03:51:32 | ldlework | ftsf: do you know how to use Docker? |
03:51:42 | ftsf | i've played with it a little at work |
03:59:20 | * | girvo joined #nim |
04:03:29 | * | girvo quit (Ping timeout: 240 seconds) |
04:10:35 | * | vendethiel- joined #nim |
04:11:58 | * | vendethiel quit (Ping timeout: 240 seconds) |
04:16:29 | * | def-pri-pub quit (Quit: leaving) |
04:24:32 | ldlework | ftsf: do you know what I need to compile it correctly? |
04:42:26 | * | vendethiel- quit (Remote host closed the connection) |
04:42:36 | * | vendethiel joined #nim |
04:55:22 | ftsf | https://gist.github.com/ftsf/a56d2f61daba02bf934e5ce445b8ebdc patch for SDL2 wrapper |
05:00:29 | * | girvo joined #nim |
05:04:34 | * | vendethiel- joined #nim |
05:04:37 | * | vendethiel quit (Ping timeout: 268 seconds) |
05:05:09 | * | girvo quit (Ping timeout: 260 seconds) |
05:15:27 | zachcarter | hrm, having some c - nim interop issues |
05:15:40 | zachcarter | for some reason my UncheckedArrays are only being filled with the first element |
05:33:38 | * | girvo joined #nim |
05:49:35 | * | xet7 quit (Quit: Leaving) |
05:50:15 | * | girvo quit (Ping timeout: 268 seconds) |
05:57:56 | * | rokups joined #nim |
06:00:13 | * | gokr joined #nim |
06:19:12 | * | rauss quit (Quit: WeeChat 1.7) |
06:32:23 | * | chemist69_ quit (Quit: WeeChat 1.7) |
06:33:11 | * | chemist69 joined #nim |
06:48:00 | * | Sentreen quit (Read error: Connection reset by peer) |
06:48:38 | * | Sentreen joined #nim |
06:50:31 | * | nsf joined #nim |
07:02:56 | * | Vladar joined #nim |
07:09:40 | * | Tiberium joined #nim |
07:12:49 | Tiberium | sorry, but my question again - how can I parse only one "div" with class "text" from the page (there's like 40 of them, but I need just one of them, random) |
07:14:05 | ldlework | Get all of them and then randomly choose one |
07:15:49 | Tiberium | ldlework, yeah, I just thought there might me another way :) |
07:15:50 | Tiberium | also |
07:16:29 | FromGitter | <TiberiumPY> inside this "div" with class "text" I have html like ⏎ "text" ⏎ <br> ⏎ "more text" ⏎ <br> [https://gitter.im/nim-lang/Nim?at=58da0dcc8e4b63533d6ef907] |
07:16:39 | FromGitter | <TiberiumPY> how to convert all <br> to \n ? |
07:16:44 | FromGitter | <TiberiumPY> how to read them? |
07:17:08 | * | vendethiel- quit (Remote host closed the connection) |
07:17:19 | * | vendethiel joined #nim |
07:17:31 | Araq | yesterday I showed stdlib HTML modules |
07:17:56 | Araq | have you seen it? |
07:18:10 | FromGitter | <TiberiumPY> what do you mean? |
07:18:14 | FromGitter | <TiberiumPY> I know there's htmlparser |
07:18:16 | FromGitter | <TiberiumPY> I use it |
07:18:25 | Araq | good. |
07:22:05 | FromGitter | <TiberiumPY> ah, maybe I need iterate over div's children ? |
07:22:06 | FromGitter | <TiberiumPY> iterator items(n: XmlNode): XmlNode {..} |
07:26:28 | zachcarter | Araq: can you help me with a binding question? |
07:26:46 | zachcarter | c interop really |
07:32:33 | zachcarter | not sure how to handle pointers of pointers |
07:32:36 | zachcarter | or pointers to pointers I guess |
07:33:30 | Araq | ptr ptr T |
07:33:38 | zachcarter | right |
07:33:48 | zachcarter | but let’s say I have C code I’m binding to that has a struct with a member like |
07:33:53 | zachcarter | **foo |
07:34:15 | zachcarter | here one sec I’ll throw up a gist to show what I”m struggling with |
07:36:59 | zachcarter | https://gist.github.com/zacharycarter/8626400320c87e91e64ff44babbdc58b |
07:37:09 | zachcarter | not a great example but it shows the C data type and the Nim equivalent |
07:37:23 | zachcarter | and my Q is at the buttom of the .nim file |
07:37:58 | zachcarter | the pointer to pointer I guess is really pointing to an array of structs in memory |
07:38:09 | zachcarter | not quite sure how to get at them |
07:38:51 | Araq | ptr array[10_000, ptr spPathConstraintData] |
07:39:15 | zachcarter | thank you |
07:39:20 | Araq | the 10_000 is arbitrary, you can also use an unchecked array |
07:39:24 | zachcarter | gotcha |
07:39:36 | Araq | but I wouldn't use unchecked arrays. |
07:39:43 | zachcarter | okay |
07:40:13 | FromGitter | <brechtm> I run into segmentation faults now and then when I access a nil-object. Is there by any chance a compiler flag that points me to the source code line where this happens? |
07:41:10 | Araq | don't you get a stack trace? |
07:41:35 | FromGitter | <brechtm> Don't think so. Let me double-check. |
07:42:15 | FromGitter | <brechtm> Nope |
07:42:27 | FromGitter | <vegansk> @Araq, if the owner thread of the ForeignCell is died, will ``dispose`` lead to crash? |
07:42:52 | FromGitter | <brechtm> Araq: only this: "SIGSEGV: Illegal storage access. (Attempt to read from nil?)" and "Error: execution of an external program failed: ..." |
07:43:06 | FromGitter | <brechtm> @Araq: unless VSCode is not displaying stderr or so |
07:43:21 | FromGitter | <brechtm> Nope, same when running from the terminal. |
07:43:52 | Araq | you should get a stack trace. don't use -d:release. |
07:44:16 | Araq | vegansk: yup. |
07:45:13 | Araq | and now moreso than ever because we changed thread memory management |
07:46:36 | FromGitter | <vegansk> @Araq, that's why I can't implement the scalaz version of Actors in Nim in efficient manner :-( What do you think about the transferring of the ownership to another thread? Is it possible? |
07:46:40 | FromGitter | <brechtm> Aha. The nakefile I'm using has "--stackTrace:off" ... |
07:47:53 | Araq | I'm not sure I understand why 'nake' is as popular as it is :-) |
07:48:38 | Araq | I always thought nimscript will make it obsolete. I guess nim's VM just doesn't support enough features yet |
07:49:46 | Tiberium | how to convert all values in sequence to int? |
07:50:50 | Araq | sequtils.mapIt |
07:52:34 | Tiberium | this doesn't work https://gist.github.com/TiberiumN/ed7ec1337df1c769e79a375ba2b06ed2 |
07:52:47 | Tiberium | it says :type mismatch: got (string) but expected 'int'" |
07:53:38 | * | yglukhov joined #nim |
07:53:49 | Tiberium | ah |
07:53:50 | Tiberium | nvm |
07:53:53 | Tiberium | AGAIN MY BAD |
07:54:01 | Tiberium | oh my god, I forgot that I need to use parseInt |
07:54:03 | Tiberium | jesus |
07:54:47 | Araq | no worries |
07:56:20 | * | bjz joined #nim |
07:56:39 | * | bjz quit (Client Quit) |
07:58:09 | Tiberium | how can I get random number if I have start and end of the range? |
08:03:21 | ldlework | you can probably figure this one out |
08:04:05 | cheatfate | randomnumber = (`start` + someRandomNumberGeneratorFunctionWhichReturnsIntegerValue() mod (`end` - `start`)) |
08:04:18 | Tiberium | cheatfate, many thanks |
08:05:33 | FromGitter | <andreaferretti> @cheatfate not quite |
08:05:46 | FromGitter | <andreaferretti> depending on the modulus you may obtain a non uniform distribution |
08:06:08 | * | couven92 joined #nim |
08:06:34 | FromGitter | <andreaferretti> more like `start + random(max=end - start - 1)` |
08:07:04 | FromGitter | <andreaferretti> assuming `random` returns values uniformly between 0 and max includded |
08:07:28 | Araq | stdlib's random module supports range out of box for this reason |
08:07:34 | Araq | and gets the distribution right. |
08:08:46 | cheatfate | andreaferretti: hardware/os RNGs returns sequence of bytes... not integers and don't care about distribution... so everything with `max` is handled via `and` or `mod` operation |
08:10:22 | FromGitter | <andreaferretti> I know |
08:10:41 | FromGitter | <andreaferretti> still, one does not just blidly do `randomValue mod x` |
08:10:52 | FromGitter | <andreaferretti> it will not be uniform in general |
08:11:20 | FromGitter | <andreaferretti> say you function returns a random `int` distributed uniformly |
08:11:29 | FromGitter | <andreaferretti> and `end-start = 7` |
08:11:41 | cheatfate | andrea please stop |
08:11:46 | FromGitter | <andreaferretti> since the number of ints is not divisible by 7, you will introduce a bias |
08:11:54 | FromGitter | <andreaferretti> uh, why? |
08:12:07 | FromGitter | <andreaferretti> did I say something offensive? |
08:12:20 | cheatfate | lets start from the beginning, for example you got sequence of bytes [n1, n2, n3, n4, n5, n6, n7, n8] |
08:12:30 | FromGitter | <andreaferretti> yup |
08:12:56 | FromGitter | <andreaferretti> just use one byte and cast it to an int in the range [0,255] |
08:13:00 | cheatfate | how you make function random(max) |
08:13:20 | FromGitter | <andreaferretti> you do rejection sampling for instance |
08:13:44 | cheatfate | for example i need max = 16 |
08:13:45 | FromGitter | <andreaferretti> let me make a simple example where you have only on byte, which you convert to `uint8` |
08:13:57 | FromGitter | <andreaferretti> with max=16, everything you said works right |
08:14:05 | FromGitter | <andreaferretti> with max=13 it will not |
08:14:43 | FromGitter | <andreaferretti> there are more integers = 0 mod 13 in the range [0..255] then = 12 mod 13 |
08:14:59 | cheatfate | how so? because some bits of randomness will be lost? |
08:14:59 | * | bjz joined #nim |
08:15:17 | FromGitter | <andreaferretti> no, it's much simpler than that |
08:15:21 | FromGitter | <andreaferretti> forget randomness |
08:15:33 | FromGitter | <andreaferretti> say you have a random number between 0 and 7 inclusive |
08:15:39 | FromGitter | <andreaferretti> and you do it mod 3 |
08:15:55 | FromGitter | <andreaferretti> you have three cases (0, 3, 6) where you get 0 |
08:15:59 | Araq | http://stackoverflow.com/questions/10984974/why-do-people-say-there-is-modulo-bias-when-using-a-random-number-generator |
08:16:06 | FromGitter | <andreaferretti> three cases (1, 4, 7) where you get 1 |
08:16:16 | FromGitter | <andreaferretti> and only two cases (2, 5) where you get 2 |
08:16:29 | FromGitter | <andreaferretti> because 8 is not divisible by 3 |
08:17:28 | FromGitter | <andreaferretti> in this case, you would have to reject the values 6 and 7 to restore uniformity |
08:19:14 | cheatfate | ok thanks for explanation |
08:19:47 | * | zachcarter_ joined #nim |
08:22:28 | * | zachcarter quit (Ping timeout: 240 seconds) |
08:22:28 | * | zachcarter_ is now known as zachcarter |
08:29:19 | Tiberium | hmm, how to get element by key from openarray[tuple[key: string, value: string]] ? |
08:29:35 | Tiberium | loop? |
08:29:40 | def- | Tiberium: yeah |
08:30:10 | cheatfate | Tiberium, are you trolling us? |
08:30:14 | Tiberium | cheatfate, no? |
08:30:22 | def- | Tiberium: if you want to efficiently get value by key you should use a Table[key, value] |
08:30:44 | Tiberium | def-, I know, but with table I need to put .toTable() everywhere in my code |
08:31:12 | cheatfate | Tiberium, i'm sorry, but you are asking question on every simple step in your code |
08:31:26 | Tiberium | cheatfate, not every :) |
08:36:51 | ldlework | hi def- |
08:41:30 | def- | hi ldlework |
08:41:43 | ldlework | def-: how are you? |
08:42:47 | FromGitter | <konqoro> Hey what is more efficient: discard list.pop() or list.delete(^1) ? |
08:45:47 | def- | ldlework: fine, you? |
08:46:28 | def- | konqoro: I'd assume pop to be faster, but probably very similar |
08:46:38 | def- | reading the implementations might help |
08:46:53 | ldlework | def-: I'm OK. Have you seen NimSynth? |
08:47:01 | ldlework | Kinda obsessed with it right now |
08:47:09 | def- | nope |
08:47:46 | ldlework | def-: https://www.youtube.com/watch?v=sDop4JELAhc |
08:52:21 | Tiberium | ldlework, wow |
08:54:22 | ldlework | Tiberium: that was my reaction :) |
09:01:40 | * | vivus joined #nim |
09:05:53 | * | Matthias247 joined #nim |
09:29:07 | * | Tiberium quit (Read error: Connection reset by peer) |
09:29:22 | * | Tiberium joined #nim |
09:30:09 | * | vlad1777d joined #nim |
09:36:30 | * | Arrrr joined #nim |
09:36:30 | * | Arrrr quit (Changing host) |
09:36:30 | * | Arrrr joined #nim |
09:38:55 | * | Andris_zbx joined #nim |
09:40:13 | Tiberium | can I implement something like 3 requests/sec limit for httpclient via queues module? |
09:41:24 | ldlework | I dunno, can you? |
09:41:44 | Tiberium | ldlework, I mean is this module suitable for my task? |
09:41:52 | Tiberium | maybe there's another choice |
09:45:05 | zachcarter | I kind of have spine integration working with frag : http://imgur.com/a/2cjOM |
09:48:06 | Tiberium | why this doesnt work? https://gist.github.com/TiberiumN/28f0183257825e97222cd1dccf4fc9fb someone said I can reference types from each other in types section |
09:48:10 | FromGitter | <brechtm> @zachcarter You seem to be into CG. What would be the CG term for the projectiles in this video: https://youtu.be/2v2Jm9NQ_Yc?t=22? How are they rendered, you think? |
09:48:26 | Tiberium | ah |
09:48:27 | Tiberium | nvm |
09:48:32 | Tiberium | I don't need VkApi in ApiRequest |
09:49:03 | zachcarter | you could do it a number of ways brechtm |
09:49:24 | FromGitter | <brechtm> I was thinking of particles, but I don't think that's correct... |
09:49:43 | zachcarter | shaders |
09:50:13 | zachcarter | although you can get pretty far just rendering textures with multiple passes and blurring |
09:50:20 | FromGitter | <vegansk> @Tiberium, if you use async, you can try something like ``(req1 and req2 and req3) or sleepAsync(1000)`` |
09:50:35 | Tiberium | ok, time to make my app async :) |
09:50:42 | Tiberium | if it would be easier to limit requests then |
09:51:07 | Tiberium | I use one thread and httpclient, so i think it would be *easy* to make my app async |
09:51:52 | FromGitter | <brechtm> @zachcarter ok, thanks |
09:51:58 | zachcarter | np |
09:52:05 | zachcarter | if your’e looking for ideas |
09:52:25 | zachcarter | I’d just google 2d laser beam effect shaders textures blur and glow |
09:52:30 | zachcarter | all good keywords to search for that kind of effect |
09:52:45 | zachcarter | bloom too |
09:53:02 | FromGitter | <vegansk> But if you use sync API, what's the problem? Measure the time between requests, then pause the thread if needed |
09:54:33 | Tiberium | I wanted to use async in future anyway |
09:54:42 | Tiberium | because I have a command bot for social network |
09:54:51 | Tiberium | so with one thread and sync plugins can block whole bot |
09:58:35 | Tiberium | oh wait |
09:58:59 | Tiberium | I can't use async with procs like "proc startBot(bot: var VkBot) {.async.}" ? |
10:00:59 | Tiberium | it says "illegal capture bot" |
10:02:43 | Tiberium | if I try to modify/read bot values |
10:04:12 | euantor | You can't use var parameters with async |
10:04:16 | euantor | Use a ref object instead |
10:04:34 | euantor | so make `type VkBot = ref object` |
10:04:47 | * | dyce[m] quit (Remote host closed the connection) |
10:04:47 | * | MrAxilus[m] quit (Read error: Connection reset by peer) |
10:04:48 | * | jivank[m] quit (Read error: Connection reset by peer) |
10:04:49 | * | hohlerde quit (Read error: Connection reset by peer) |
10:04:49 | * | ehmry[m] quit (Remote host closed the connection) |
10:04:49 | * | M-Quora quit (Read error: Connection reset by peer) |
10:04:49 | * | stisa quit (Read error: Connection reset by peer) |
10:04:49 | * | Guest73656[m] quit (Read error: Connection reset by peer) |
10:04:50 | * | Jipok[m] quit (Remote host closed the connection) |
10:04:50 | * | TheManiac quit (Remote host closed the connection) |
10:04:51 | Tiberium | wpw |
10:04:56 | Tiberium | wtf |
10:05:04 | Tiberium | euantor, thanks |
10:09:36 | * | dyce[m] joined #nim |
10:09:42 | zachcarter | http://imgur.com/a/Gt9Ee |
10:09:46 | zachcarter | not sure why the drawing is screwed up |
10:09:50 | zachcarter | but at least animation is working well |
10:16:11 | FromGitter | <vegansk> Created first version of scalaz like actors in Nim: https://github.com/vegansk/nimfp/blob/master/tests/fp/test_concurrent.nim |
10:17:27 | Tiberium | euantor, what about KeyVal* = ref openarray[tuple[key: string, val: string]] ? I want to use it as parameter in async proc (and I want this parameter to have default value) |
10:17:48 | Tiberium | something like "proc callMethod*(api: VkApi, methodName: string, params: KeyVal = [], token: string = "", flood: bool = false): Future[JsonNode] {.async.}" doesn't work |
10:18:00 | FromGitter | <vegansk> The main feature of this actors library is that messages can be handled synchronously, asynchronously via asyncdispatch, or in another threads using spawn. But if you want, you can create your own strategy :smile: |
10:18:12 | euantor | Probably better as a seq than an openarray |
10:18:22 | Tiberium | ah |
10:18:23 | Tiberium | ok |
10:20:35 | Tiberium | euantor, I used openarray because I can create something like "let data = {"message": body, "peer_id": $msg.peerId}" and then pass this to callmethod |
10:21:08 | euantor | You can do something simialr with seq: |
10:21:40 | euantor | `let data = @[("message", body"), ("peer_id", $msg.peerid)]` |
10:22:03 | euantor | `proc callMethod*(api: VkApi, methodName: string, params: KeyVal = @[], token: string = "", flood: bool = false): Future[JsonNode] {.async.}` |
10:22:11 | Tiberium | euantor, yeah, I figured this out myself :) |
10:22:12 | Tiberium | thanks! |
10:22:13 | euantor | Something like that should work IIRC |
10:22:34 | Tiberium | it works |
10:22:40 | euantor | But if it's a key/value pair, it's probably best to look at using a string table: https://nim-lang.org/docs/strtabs.html |
10:23:17 | euantor | Though the documentation could do with some examples there... |
10:24:04 | Tiberium | euantor, I see :) |
10:24:44 | Tiberium | ah |
10:24:51 | Tiberium | nim tests helps |
10:29:43 | Arrrr | Seems like cyclic detection is stricter now |
10:30:11 | Tiberium | euantor, what I need to do if I need to parse html in async proc? |
10:30:17 | Tiberium | via htmlparser |
10:31:55 | Tiberium | for now it fails "Error: 'cb' is not GC-safe as it accesses 'nameIterVar' which is a global using GC'ed memory" |
10:32:20 | * | arnetheduck joined #nim |
10:33:12 | * | MrAxilus[m] joined #nim |
10:33:15 | * | M-Quora joined #nim |
10:33:15 | * | ehmry[m] joined #nim |
10:33:17 | * | jivank[m] joined #nim |
10:33:19 | * | stisa joined #nim |
10:33:19 | * | hohlerde joined #nim |
10:33:19 | * | TheManiac joined #nim |
10:33:21 | * | Guest73656[m] joined #nim |
10:33:23 | * | Jipok[m] joined #nim |
10:35:42 | Arrrr | Mmm no, it was my mistake |
10:36:43 | euantor | Tiberium: That's a bug/issue in htmlparser then unfortunately. dom96 might have an idea of how to get around/fix it |
10:38:17 | Tiberium | euantor, another error: "lib/pure/includes/asyncfutures.nim(106, 16) Error: attempting to call undeclared routine: 'value='" |
10:38:29 | Tiberium | ah |
10:38:31 | Tiberium | nevermind |
10:38:52 | Tiberium | I've put "return await method()" but method() doesn't return anything |
10:39:25 | * | user0___ joined #nim |
10:40:28 | Tiberium | so i fixed it |
10:40:48 | Tiberium | euantor, can I use parseJson with async? |
10:41:17 | euantor | I think so, but can't remember off the top of my head |
10:42:38 | * | bjz quit (Remote host closed the connection) |
10:44:00 | Tiberium | euantor, "Error: 'cb' is not GC-safe as it accesses 'nameIterVar' which is a global using GC'ed memory" finding this errors in code is fun :D |
10:46:23 | Tiberium | euantor, can "Warning: cannot prove that field 'data["key"].str' is accessible [ProveField]" be the reason of unsafe gc procs? |
10:46:38 | Tiberium | data is proc parameter (data is JsonNode) |
10:46:53 | Tiberium | I don't know what exactly in my proc is gc unsafe |
10:47:52 | * | bjz joined #nim |
10:48:42 | euantor | Can you provide the content of your proc on pastebin or something? |
10:49:16 | Tiberium | euantor, yeah, but I have two files with like ~250 lines of code and one file with types |
10:49:25 | Tiberium | add comments are in russian sadly :( |
10:49:39 | Tiberium | euantor, yeah, sure, will do it right now |
10:50:01 | euantor | Ah, it might not even be in your code unfortunately - it could be a library you're using |
10:50:28 | Tiberium | euantor, I'm using "strfmt" and unpack macro from stackoverflow |
10:51:55 | euantor | I've not tried either of those, so I don't know if either might cause issues |
10:52:07 | * | vendethiel quit (Ping timeout: 240 seconds) |
10:53:10 | * | vendethiel joined #nim |
10:54:56 | Araq | Tiberium: add explicit .gcsafe annotations to see where the compiler thinks you got it wrong |
10:55:42 | Tiberium | Araq, like var test {.gcsafe.} = test() ? |
10:55:53 | Araq | no, like |
10:56:02 | Araq | proc test() {.gcsafe.} = ... |
10:56:31 | zachcarter | getting closer… |
10:56:32 | zachcarter | http://imgur.com/a/3Tgou |
10:57:44 | Tiberium | wwait |
10:57:56 | euantor | Might be being dumb, but is "Frame: 16.xxx[ms]" the length of time a single frame stays on screen for? Saw that on an earlier gif you provided and wondered if that was it |
10:57:58 | Tiberium | it compiled xD |
10:58:09 | zachcarter | euantor: yup that’s the time per frame |
10:58:12 | zachcarter | in ms |
10:58:25 | zachcarter | 16ms = roughly 60fps |
10:58:41 | Tiberium | I don't know how |
10:59:06 | zachcarter | of course the gif recording software messes a bit with my fps it’s usually steadier |
10:59:12 | euantor | Ah, nice. Getting pretty close to 60fps, out of interest what's that running on? |
10:59:29 | zachcarter | my macbook pro |
10:59:35 | euantor | Is it fairly easy to build? I might give it a go on my machine at home with a 1080 |
10:59:36 | zachcarter | I’m actually capping the FPS at 60 |
10:59:43 | zachcarter | FRAG? |
10:59:44 | euantor | ah, fair enough |
10:59:58 | Tiberium | IT WORKS |
11:00:00 | zachcarter | it’s going to be a bit of a struggle probablby until I get docu going |
11:00:09 | zachcarter | but I could help you along if you’d like to try |
11:00:15 | Tiberium | lol, I didn't thought it can be so easy to convert sync to async in a compiled language |
11:00:20 | zachcarter | what OS are you running? |
11:00:28 | euantor | Yeah, that example. If it would be useful to you to try, but don't want to waste your time and I'm at work right now anyway |
11:00:33 | euantor | WIndows 10 x64 |
11:00:38 | Tiberium | zachcarter, I can test on Linux |
11:00:44 | Tiberium | manjaro (based on arch) |
11:00:48 | Tiberium | x64 too |
11:01:06 | zachcarter | ah this example isn’t committed or anything |
11:01:16 | zachcarter | I’m probably not going to pusht he spine stuff up until I fix the holes in the mesh bug |
11:01:24 | zachcarter | Tiberium: awesome |
11:01:36 | zachcarter | I plan to ask as many folks to help test frag as possible once we get the website and documentation going |
11:03:00 | euantor | Ah right, no problem. I'd be interested in giving it a go so I'll watch out for a thread on the forum :) |
11:03:21 | zachcarter | okay cool :) as soon as the spine integration is added I’ll update the frag post |
11:03:33 | zachcarter | by that time hopefully we’ll have some docu |
11:06:48 | Tiberium | vegansk: so how I use this sleepAsync() to limit it for 3 req/s if I have a proc which I call for every API method? |
11:06:58 | Tiberium | add sleepAsync(350) inside this proc? |
11:07:29 | Tiberium | ah |
11:07:40 | Tiberium | my compilation fails in VSCode because it compiles with --threads:on |
11:09:26 | * | yglukhov quit (Remote host closed the connection) |
11:10:22 | * | yglukhov joined #nim |
11:10:36 | * | yglukhov quit (Remote host closed the connection) |
11:12:40 | * | Vladar quit (Excess Flood) |
11:13:07 | * | Vladar joined #nim |
11:13:48 | chemist69 | Tiberium: yeah, had that recently, too. Add --threads:on into a <yourfile>.nim.cfg |
11:19:57 | * | BitPuffin|osx joined #nim |
11:20:27 | FromGitter | <vegansk> @Tiberium. asyncdispatch.all(req1, req2, req3, sleepAsync(1000)) will complete after all 4 futures will complete |
11:21:29 | * | gokr quit (Ping timeout: 240 seconds) |
11:21:48 | Tiberium | vegansk: but I call api requests in different places |
11:22:12 | zachcarter | I’m trying to pack RGBA values in the range of 0-255 into a single uint32 witht he format abgr |
11:22:28 | zachcarter | so for example : 0xFFFFFFFF.uint32 |
11:22:44 | zachcarter | I don’t think my attempt at a funciton to do this is right though: |
11:22:52 | zachcarter | abgr = (`shl`(a, 24) or `shl`(b, 16) or `shl`(g, 8) or r).uint32 |
11:23:01 | zachcarter | abgr = (`shl`(a, 24) or `shl`(b, 16) or `shl`(g, 8 ) or r).uint32 |
11:24:12 | zachcarter | I’m getting results like 254 with that |
11:24:19 | zachcarter | if I echo repr 0xFFFFFFFF.uint32 |
11:24:20 | zachcarter | I get |
11:24:40 | zachcarter | 4294967295 |
11:27:13 | FromGitter | <vegansk> @Tiberium. Then you can store the times of the last three calls and check, if you need to call sleepAsync() before issuing new request |
11:27:36 | * | Tiberium quit (Remote host closed the connection) |
11:28:37 | * | yglukhov joined #nim |
11:44:34 | * | zachcarter_ joined #nim |
11:47:25 | * | zachcarter quit (Ping timeout: 260 seconds) |
11:47:26 | * | zachcarter_ is now known as zachcarter |
11:48:24 | * | yglukhov quit (Remote host closed the connection) |
11:52:06 | FromGitter | <TiberiumPY> Will try it, thanks Anatoly :) |
11:53:11 | * | djellemah_ quit (Ping timeout: 264 seconds) |
11:55:31 | * | yglukhov joined #nim |
11:55:49 | * | yglukhov quit (Remote host closed the connection) |
11:56:42 | * | gokr joined #nim |
11:58:23 | * | yglukhov joined #nim |
11:59:57 | Arrrr | are a, r, g, b defined as uint8 ? |
12:01:56 | * | ftsf quit (Quit: :q!) |
12:02:19 | * | yglukhov quit (Remote host closed the connection) |
12:05:24 | * | djellemah_ joined #nim |
12:05:37 | * | gokr left #nim (#nim) |
12:05:56 | * | yglukhov joined #nim |
12:07:08 | * | yglukhov quit (Read error: Connection reset by peer) |
12:07:14 | * | yglukhov_ joined #nim |
12:09:31 | Arrrr | I didn't have any issue with your snippet zachcarter https://glot.io/snippets/eoergtv3wi, unless i'm missing out anything |
12:11:41 | * | yglukhov_ quit (Ping timeout: 260 seconds) |
12:11:47 | zachcarter | thank you Arrrr |
12:14:27 | * | zachcarter quit (Quit: zachcarter) |
12:14:45 | * | yglukhov joined #nim |
12:19:22 | * | yglukhov quit (Ping timeout: 268 seconds) |
12:25:19 | * | Tiberium joined #nim |
12:29:49 | * | djellemah_ quit (Ping timeout: 240 seconds) |
12:32:38 | * | djellemah_ joined #nim |
12:35:37 | FromGitter | <evacchi> @vegansk re: actors; hey, that's pretty cool! I've been playing around with the same idea a bit, but for now it's just a playground https://github.com/evacchi/nimoy/ |
12:36:17 | FromGitter | <evacchi> (tbf I did stumble upon your lib before, while looking for a conslist impl without having to roll out my own) |
12:39:55 | FromGitter | <evacchi> (i'll have to admit I'm doing this to learn Nim, so bear with me ;-) ) |
12:41:05 | * | djellemah_ quit (Ping timeout: 258 seconds) |
12:41:11 | * | djellemah_ joined #nim |
12:49:26 | * | ftsf joined #nim |
12:53:13 | FromGitter | <vegansk> @evacchi , I see that you prefer Akka actors :-) |
12:53:32 | Tiberium | btw |
12:53:42 | Tiberium | euantor, I know why parseHtml failed xD |
12:53:50 | Tiberium | because I compiled with --threads:on by default in VScode |
12:55:01 | euantor | Yes, that would cause it :) |
12:55:20 | euantor | Though that should be fixed in the parsehtml library |
12:55:34 | Tiberium | euantor, it's htmlparser library :) |
12:55:45 | Tiberium | euantor, and that happens with parseJson() too |
12:55:50 | Tiberium | so it's like a compiler bug maybe? |
12:57:39 | euantor | stdlib bug rather than compiler, but yeah |
12:58:41 | * | yglukhov joined #nim |
13:00:29 | Tiberium | hmm, seems there's also good Nim plugin for Atom |
13:00:31 | Tiberium | let me try it |
13:02:58 | * | yglukhov quit (Ping timeout: 240 seconds) |
13:03:18 | * | vendethiel- joined #nim |
13:03:46 | * | vendethiel quit (Ping timeout: 268 seconds) |
13:05:39 | * | Vladar quit (Remote host closed the connection) |
13:06:08 | * | zachcarter joined #nim |
13:08:46 | * | Vladar joined #nim |
13:16:29 | * | tankfeeder joined #nim |
13:26:03 | * | demian joined #nim |
13:26:12 | * | demian is now known as dmi0 |
13:31:27 | * | Tiberium quit (Remote host closed the connection) |
13:31:43 | * | Tiberium joined #nim |
13:42:13 | FromGitter | <evacchi> @vegansk that's just because I've been using akka a lot lately :^) |
13:42:36 | FromGitter | <brechtm> Does Nim have Python-style proc argument packing/unpacking (*args and **kwargs)? |
13:44:22 | * | tankfeeder quit (Quit: Leaving) |
13:45:16 | * | zahary quit (Quit: Connection closed for inactivity) |
13:46:24 | Tiberium | brechtm as I know you can use varargs |
13:46:28 | Tiberium | at least for *args |
13:51:11 | FromGitter | <brechtm> @Tiberium that requires changes to the proc, right? |
13:51:22 | Tiberium | brechtm yes I think |
13:51:34 | Tiberium | brenchtm https://nim-by-example.github.io/varargs/ |
13:52:17 | Tiberium | brechtm also https://forum.nim-lang.org/t/1324 |
14:05:39 | * | rauss joined #nim |
14:19:51 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
14:25:57 | zachcarter | anyone know how to convert an unchecked array into a safe array? |
14:26:10 | zachcarter | or easily collect all the members of an unsafe array? |
14:26:55 | * | zahary joined #nim |
14:31:59 | * | dmi0 quit (Remote host closed the connection) |
14:38:34 | Tiberium | how to turn all debug settings on maximum? |
14:38:45 | Tiberium | or they're turned on maximum by default? |
14:48:59 | * | couven92 quit (Quit: Client disconnecting) |
14:57:05 | Arrrr | I think they are set by default. Unless you won't to upgrade warnings to compiler errors |
14:58:55 | Arrrr | *want |
15:01:38 | * | yglukhov joined #nim |
15:07:46 | * | gangstaguy joined #nim |
15:17:03 | FromGitter | <andreaferretti> @zachcarter I think you can just cast it if you know the dimension statically |
15:17:23 | zachcarter | ah okay I’ll try that thank you andrea |
15:17:53 | FromGitter | <andreaferretti> otherwise you're out of luck, the dimension is part of the type, you cannot define a concrete array type of unknown dimension |
15:18:02 | FromGitter | <andreaferretti> at most, you can copy the items into a seq |
15:18:25 | FromGitter | <andreaferretti> but in that case, I think you'd best just use a seq from the start |
15:18:32 | * | yglukhov quit (Remote host closed the connection) |
15:18:53 | zachcarter | agreed |
15:21:26 | FromGitter | <Varriount> There's openarray |
15:21:31 | * | yglukhov joined #nim |
15:21:44 | Tiberium | Varriount it's usecases are limited |
15:24:46 | * | yglukhov quit (Remote host closed the connection) |
15:25:21 | * | vendethiel- quit (Ping timeout: 260 seconds) |
15:26:07 | * | yglukhov joined #nim |
15:30:37 | * | onionhammer quit (Read error: Connection reset by peer) |
15:31:00 | * | onionhammer joined #nim |
15:32:30 | * | Trustable joined #nim |
15:38:24 | * | yglukhov quit (Remote host closed the connection) |
15:38:46 | Tiberium | yay, my first public project made with Nim - https://github.com/TiberiumN/NickelVK (comments and readme are in russian) |
15:42:38 | * | yglukhov joined #nim |
15:45:29 | * | shashlick quit (Ping timeout: 240 seconds) |
15:46:15 | * | shashlick joined #nim |
15:46:52 | * | yglukhov quit (Remote host closed the connection) |
15:48:09 | Tiberium | how to find out what system libraries Nim would try to load after start? |
15:48:16 | Tiberium | "ldd" doesn't show OpenSSL for example |
15:49:41 | Vladar | dynamic libraries are not traceable this way. You should either know it beforehand or use some kind of in-progress monitoring tool |
15:50:23 | FromGitter | <barcharcraz> if you look in the C file it will have a list of them |
15:50:28 | * | nsf quit (Quit: WeeChat 1.7) |
15:50:37 | FromGitter | <barcharcraz> nim does dlopen/dlsym in it's init process |
15:50:39 | * | Matthias247 quit (Read error: Connection reset by peer) |
15:50:52 | FromGitter | <barcharcraz> because it's way more consistent than using the platform (we don't need things like import libs on windows) |
15:53:39 | Tiberium | barcharcraz: what C file? |
15:53:44 | Tiberium | there are many of them xD |
15:54:17 | * | yglukhov joined #nim |
15:55:11 | Tiberium | ah, nvm |
15:55:12 | dom96 | Tiberium: Nice! Your code looks very clean and very well commented :) |
15:55:18 | Tiberium | dom96, really? |
15:55:46 | Tiberium | ok, there are dlopen's in stdlib_dynlib.c and stdlib_system.c |
15:56:25 | dom96 | Yeah! Well, I can't read Russian so perhaps I can't judge the comments too accurately. But the code is looking good :) |
15:56:33 | * | yglukhov quit (Remote host closed the connection) |
15:58:08 | * | yglukhov joined #nim |
15:58:55 | FromGitter | <barcharcraz> *grumble* boost *grumble* |
16:08:22 | * | nhywyll joined #nim |
16:09:09 | SusWombat | Anyone knows what nim module i could use to "concatenate images" or "make images ot of other images"? |
16:09:28 | * | zachcarter quit (Ping timeout: 240 seconds) |
16:10:56 | * | yglukhov quit (Remote host closed the connection) |
16:11:42 | * | yglukhov joined #nim |
16:12:28 | * | yglukhov quit (Remote host closed the connection) |
16:12:59 | * | arnetheduck quit (Ping timeout: 256 seconds) |
16:14:48 | FromGitter | <BontaVlad> devil? |
16:15:05 | FromGitter | <BontaVlad> http://openil.sourceforge.net/ |
16:15:54 | FromGitter | <BontaVlad> and nim bindings: https://github.com/Varriount/DevIL |
16:19:51 | SusWombat | Thanks ill look into it |
16:27:31 | Tiberium | well, so Nim seems like a very good language :) speed of C and very user-friendly |
16:27:54 | * | gokr joined #nim |
16:29:21 | * | gokr quit (Client Quit) |
16:38:02 | * | yglukhov joined #nim |
16:40:18 | * | yglukhov quit (Remote host closed the connection) |
16:44:05 | * | Andris_zbx quit (Remote host closed the connection) |
16:46:32 | * | zachcarter joined #nim |
16:54:51 | Sentreen | Is there any way to give `mgetOrPut` of the tables module lazy semantics? |
16:55:22 | * | yglukhov joined #nim |
16:55:26 | Sentreen | As in: `table.mgetOrPut(myKey, expensiveOpHere)` should only execute expensiveOpHere if the key is not present |
16:59:06 | * | yglukhov quit (Remote host closed the connection) |
16:59:40 | * | yglukhov joined #nim |
16:59:57 | * | yglukhov quit (Remote host closed the connection) |
17:00:10 | * | yglukhov joined #nim |
17:02:37 | * | yglukhov quit (Remote host closed the connection) |
17:09:18 | def- | Sentreen: if it was a template that would be easy |
17:10:04 | Tiberium | how can I use "^" and "%" bitwise operations in Nim? |
17:10:20 | Tiberium | something like chr(ord(letter) ^ ord(key[ind % keyLen])) |
17:10:24 | * | brson joined #nim |
17:10:58 | * | brson quit (Client Quit) |
17:11:19 | * | brson joined #nim |
17:11:33 | def- | Tiberium: xor and mod? |
17:12:03 | * | brson_ joined #nim |
17:14:34 | * | yglukhov joined #nim |
17:14:38 | cheatfate | Tiberium, bitwise operations is: and, or, xor, not. Different languages has different symbols for different bitwise operations |
17:15:27 | cheatfate | so what you mean under "^", "%" operations? |
17:15:49 | * | brson quit (Ping timeout: 240 seconds) |
17:16:25 | Tiberium | cheatfate, I want to implement XOR decryption and encryption with key |
17:16:39 | cheatfate | then you need `xor` |
17:16:55 | Sentreen | def-: do you mean if mgetorput was a template? Or if my expensive op was? Because it seems like messing with the table implementation is pretty tricky |
17:17:06 | def- | Sentreen: mgetorput |
17:17:17 | cheatfate | and `%` is mod (but it not bitwise operation) |
17:17:30 | def- | Sentreen: well, for functions the argument is evaluated before calling the function, for templates it's not |
17:17:48 | Tiberium | cheatfate, this is https://gist.github.com/TiberiumN/94e508a3aa3761ffd9e9f4774f64e2c8 xor encryption with python |
17:18:11 | Tiberium | I'm translating it to nim :) |
17:18:30 | * | yglukhov quit (Remote host closed the connection) |
17:19:13 | * | gangstaguy quit (Quit: Connection closed for inactivity) |
17:19:37 | Sentreen | Okay right, just wanted to be sure. I don't think I can do this without rolling out my own table implementation which is something I hope to avoid. But wanted to ask to be sure :) |
17:20:18 | Tiberium | cheatfate, what's wrong with this code? https://gist.github.com/TiberiumN/33b1dde7ac6524730588295c0d04ff8e |
17:20:34 | FromGitter | <barcharcraz> doesn't xor encryption only work if len(key) >= len(message) |
17:20:44 | Tiberium | yeah |
17:20:51 | Tiberium | but i'm doing simple xor |
17:20:53 | Tiberium | and key is long |
17:21:03 | FromGitter | <barcharcraz> also you can only use each key once |
17:21:13 | Tiberium | barcharcraz why? |
17:21:17 | Tiberium | my code doesn't work even with short messages btw |
17:21:34 | Tiberium | barcharcraz: it's not for my app, it's for talking with unofficial web api xD |
17:22:14 | cheatfate | Tiberium, compiler in silence? |
17:22:25 | Tiberium | cheatfate, compiler - yes, throws error at runtime |
17:22:30 | Tiberium | SIGSEGV: Illegal storage access. (Attempt to read from nil?) |
17:22:36 | Tiberium | at line with "result" |
17:22:43 | cheatfate | result = newString() |
17:22:52 | cheatfate | must be first line |
17:22:55 | cheatfate | in the procedure |
17:22:59 | Tiberium | why? |
17:23:14 | Tiberium | lol |
17:23:16 | Tiberium | works now |
17:24:01 | FromGitter | <barcharcraz> because if you reuse keys then someone who intercepts multiple messages can xor them together to recover the key |
17:24:22 | Tiberium | I don't care |
17:24:28 | Tiberium | It's just for talking with web api |
17:24:29 | FromGitter | <barcharcraz> what API is this |
17:24:34 | FromGitter | <barcharcraz> someone should hit them with a fish |
17:24:38 | Tiberium | I mean |
17:24:42 | Tiberium | they've done it |
17:24:52 | Tiberium | just to make sure script kiddies can't use this web api |
17:24:58 | FromGitter | <barcharcraz> oh |
17:24:59 | * | yglukhov joined #nim |
17:25:03 | FromGitter | <barcharcraz> that's just annoying |
17:25:05 | def- | Tiberium: result is initialized to binary 0 by default, so it's a null pointer. then you call the `&=` proc on a null pointer, trying to dereference it. so you have to initialize result first |
17:28:30 | Tiberium | def-, ok, thanks |
17:31:33 | * | yglukhov quit (Remote host closed the connection) |
17:39:34 | * | yglukhov joined #nim |
17:42:00 | * | yglukhov quit (Remote host closed the connection) |
17:47:54 | * | yglukhov joined #nim |
17:48:43 | Sentreen | Okay this is very weird... |
17:49:29 | Sentreen | If I compile my main module which imports my tests, `time` tells me the execution takes slightly less than 3 seconds |
17:49:54 | Sentreen | Now if I directly compile the test file and execute it, it happens in 0.25 seconds |
17:50:18 | Sentreen | This even happens when my main module consists of only that import statement |
17:50:38 | Arrrr | remove nimcache |
17:52:11 | Sentreen | Same thing still happens |
17:53:13 | Arrrr | Mmm |
17:53:17 | * | nhywyll quit (Quit: nhywyll) |
17:54:15 | * | Trustable quit (Remote host closed the connection) |
17:55:22 | * | yglukhov quit (Remote host closed the connection) |
17:56:07 | * | zachcarter quit (Quit: zachcarter) |
17:56:27 | Sentreen | It seems like it's some nimscript error: I have a task that calls `--define:release`, which generates the slow binary |
17:56:59 | Sentreen | manually entering `--define:release` when building seems to produce the fast binary too |
17:59:24 | * | zachcarter joined #nim |
17:59:32 | Sentreen | That is still a pretty big difference between a release and debug build, a racket implementation of the same algorithm does it in less than a second. |
18:00:58 | Arrrr | Which algorithm? maybe you are creating new strings/seqs, which is the common fault in performance with nim |
18:02:36 | Sentreen | Algorithm is probably a misnomer, it's a data-driven interpreter. |
18:03:49 | Sentreen | And I'm creating at least one sequence for every primitive that I execute, but there is no real way around that I'm afraid :/ |
18:04:25 | Arrrr | why not |
18:07:18 | Sentreen | Each operation is triggered when the data it depends on becomes available. The data can be added in pretty much any order. And, since it is an interpreter, you cannot know how much inputs an operation takes in advance. So, at the very least, I need to create a seq for every primitive invocation |
18:09:49 | Arrrr | Can't you have a seq of seqs? |
18:10:41 | Sentreen | Do you mean to have a predefined seq for each operation? |
18:10:51 | ldlework | TRIGGERED |
18:10:54 | ldlework | sorry. |
18:13:35 | Sentreen | If that's what you mean, it is not possible, since an undetermined amount of instances of the same primitives can be active at the same time. So I can't statically determine how seqs I'd need. |
18:14:20 | Araq | putting -d:release in a nimscript file doesn't work. |
18:14:37 | Araq | it cannot, but I can make it an error I guess. |
18:14:57 | Araq | it's immediately obvious why it can't work. -d:release is implemented completely in nim.cfg |
18:15:20 | Araq | so if you set it in your nimscript file, it's already too late and doesn't affect the processing of nim.cfg at all |
18:16:32 | Sentreen | Producing an error would probably be a good idea, you don't want to know how much time this cost me :p |
18:17:44 | Arrrr | Does pragma checks actually do anything? I think it is not working |
18:18:15 | Araq | .push checks:off surely works for me |
18:18:31 | Araq | not sure if it works without the .push |
18:19:20 | * | yglukhov joined #nim |
18:21:12 | Arrrr | It doesn't work for me, outside and inside procs |
18:21:19 | Arrrr | with push |
18:22:00 | Arrrr | And without them |
18:22:16 | Arrrr | And i notice the difference if i define release |
18:23:26 | * | gokr joined #nim |
18:24:18 | Tiberium | how much memory does Nim compiler need for it compilation? |
18:24:34 | FromGitter | <Varriount> Tiberium: Depends on the input files. |
18:24:46 | * | yglukhov quit (Remote host closed the connection) |
18:24:46 | Tiberium | I mean for it to compile itself :) |
18:24:59 | Tiberium | koch boot -d:release |
18:25:06 | Arrrr | I don't think it needs to much |
18:25:10 | Arrrr | *too |
18:26:55 | FromGitter | <Varriount> Sentreen: Why are you trying to define 'release' in your nimscript? Isn't that a switch reserved for the user? |
18:28:24 | Sentreen | I'm using nimscript as a build tool, so the idea is to just say something like `nim buildRelease myproject` instead of `nim build -d:release myproject` |
18:28:46 | Tiberium | Arrrr, I'm trying to compile it at my friend's RPi, firstly I was connected via teamviewer and my friend via vnc, so there was like 400 free memory, and it failed |
18:29:49 | FromGitter | <Varriount> Tiberium: Nim has successfully bootstrapped itself on a Rasberry Pi before. |
18:29:52 | Sentreen | Speaking of which, is it possible to see if -d:release or similar flags have been passed to nim from within nimscript? |
18:31:01 | Arrrr | maybe with `if defined(release):` ? |
18:31:32 | FromGitter | <Varriount> if defined() will work, although the if will be done at runtime. |
18:31:51 | FromGitter | <Varriount> `if defined(release)` == `if true:` |
18:32:00 | FromGitter | <Varriount> or `if false` |
18:32:21 | Arrrr | in nimscript? |
18:32:28 | Sentreen | That works in the code that's gonna be compiled, but not in nimscript |
18:32:37 | FromGitter | <Varriount> :/ |
18:33:07 | dom96 | Tiberium: Add sawp |
18:33:09 | dom96 | *swap |
18:33:24 | dom96 | It will take a while though |
18:33:37 | dom96 | Took at least 30 minutes when I did it last |
18:33:43 | dom96 | But that was on an RPi 1 |
18:33:48 | dom96 | Might be faster on the newest one |
18:34:16 | Araq | Sentreen: the compiler says release or debug build at the end of the compile |
18:35:31 | FromGitter | <Varriount> Araq: Sentreen wants a way to detect the 'release' define in Nimscript. |
18:36:16 | Arrrr | Now that i think about it, i think you can check the args passed from nimscript |
18:36:16 | Sentreen | Varriount: I think Araq was referring to whether or not an error would be wanted/needed if you try to define release from within nimscript |
18:37:12 | Sentreen | Arrrr, you can with `paramStr` indeed. It's what I am looking into now :) |
18:38:37 | * | nsf joined #nim |
18:39:27 | * | Vladar quit (Quit: Leaving) |
18:44:52 | Araq | when defined(release): |
18:45:18 | Araq | ^ should work. pretty sure I've used that before in nimscript |
18:48:51 | Sentreen | It does |
18:50:09 | * | brson_ quit (Quit: leaving) |
18:51:53 | * | vendethiel joined #nim |
18:56:30 | * | dmi0 joined #nim |
18:59:24 | * | zachcarter quit (Quit: zachcarter) |
19:03:55 | Sentreen | @Araq: I still think an error/warning could be useful, since it's pretty easy to miss the message after all the hints. |
19:05:18 | Sentreen | I completely agree that it is a really stupid mistake to make, but it's pretty easy to make that assumption and to miss it when fixing your code a few months after. |
19:05:38 | Araq | no, I wasn't serious |
19:05:56 | Araq | the compiler should error out for --define:release in nimscript/config system |
19:06:05 | Araq | you're not the first one who made this mistake. |
19:06:16 | Araq | I think even the great araq himself did it wrong one day. |
19:06:32 | Araq | I mean, obviously he was completely drunk back then, but still. |
19:09:23 | Sentreen | Haha, I was feeling pretty stupid when I finally found out, so I'm glad that I'm not the only one :p |
19:11:20 | Tiberium | hmm, on friend's RPi I have some strange crash |
19:11:55 | Tiberium | https://gist.github.com/TiberiumN/038a4cbb226712351568cb77754e37f0 |
19:12:04 | Tiberium | src on https://github.com/TiberiumN/NickelVK |
19:12:33 | Tiberium | on vkapi.nim(62) there's code that returns section from json |
19:12:36 | Tiberium | by key |
19:17:55 | Tiberium | ah |
19:17:56 | Tiberium | nvm |
19:18:05 | Tiberium | it disappeared |
19:30:30 | dom96 | seems like a possible bug in strfmt? |
19:32:29 | * | yglukhov joined #nim |
19:35:57 | * | dmi0 quit (Quit: Using Circe, the loveliest of all IRC clients) |
19:36:29 | * | dmi0 joined #nim |
19:37:02 | * | Tiberium quit (Remote host closed the connection) |
19:38:23 | * | yglukhov quit (Remote host closed the connection) |
19:42:16 | * | rokups quit (Quit: Connection closed for inactivity) |
19:42:17 | FromGitter | <TiberiumPY> Maj ⏎ It was because I used int in LongPollData.ts |
19:42:29 | FromGitter | <TiberiumPY> Needed int64 on some machines |
19:42:45 | FromGitter | <TiberiumPY> It fixed the problem on RPI |
19:45:55 | * | bjz joined #nim |
19:47:37 | * | Arrrr quit (Quit: Leaving.) |
19:51:54 | * | hcorion joined #nim |
19:52:36 | * | PMunch joined #nim |
19:56:17 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
20:00:18 | * | nsf quit (Quit: WeeChat 1.7) |
20:01:05 | * | nsf joined #nim |
20:02:52 | dom96 | Our Travis jobs are being terminated because they are taking too long |
20:02:54 | dom96 | This is pretty bad |
20:03:33 | hcorion | Is it just the free version of Travis? |
20:05:24 | FromGitter | <Varriount> dom96: What's the timeout for travis? The full bootstrap process usually takes only a couple of minutes at most. |
20:11:12 | * | Serenitor joined #nim |
20:15:46 | FromGitter | <stisa> dom96: maybe you could split the test suite in different jobs ( eg a job per category ) ? |
20:17:21 | FromGitter | <Varriount> dom96: Has anyone e-mailed Travis support? Perhaps they would be willing to increase the time limit. |
20:17:45 | FromGitter | <Varriount> If not, I think I could spare the 70$ needed for a monthly account |
20:18:02 | FromGitter | <Varriount> (Though, I would rather not pay any money) |
20:18:48 | hcorion | We could also cache the csources build, that takes up quite a bit of time |
20:20:16 | * | Matthias247 joined #nim |
20:22:05 | hcorion | It doesn't seem to be timing out for most builds though |
20:23:23 | * | libman joined #nim |
20:24:47 | * | Matthias247 quit (Read error: Connection reset by peer) |
20:26:09 | * | Matthias247 joined #nim |
20:26:12 | hcorion | I dunno, I think we're pretty OK. |
20:27:09 | hcorion | It seems only to be my PR, which ran for roughly 50 minutes. The previous commit that passed ran for only 30 minutes. I think something odd just happened with travis |
20:28:06 | dom96 | varriount: You already give us a lot through donations :) |
20:30:58 | cheatfate | hcorion, maybe your changes made some incredible waiting or endless cycle? |
20:32:07 | hcorion | @cheatfate, I only changed http -> https in the doc cfg tho |
20:32:56 | cheatfate | hcorion, travis and appveyor has limits to 60 minutes per one job |
20:33:33 | hcorion | The build timed out at 49 min 59 sec |
20:34:20 | cheatfate | looks like travis has 50 minutes limit |
20:34:22 | hcorion | And said: The job exceeded the maximum time limit for jobs, and has been terminated. |
20:34:24 | hcorion | Yet, all the tests had passed, the niminst tool had done it's thing. |
20:34:43 | FromGitter | <stisa> travis is 50 minutes on free and 120 on pro ( https://docs.travis-ci.com/user/customizing-the-build#Build-Timeouts ) |
20:34:47 | hcorion | Maybe travis just has a grudge against me. Wants all my builds to fail |
20:34:54 | dom96 | Could be a weird travis bug |
20:39:56 | * | user0___ quit (Quit: user0___) |
20:40:15 | hcorion | That's what I think. Appveyor is unchanged, actually ran a few minutes faster than the previous build |
20:52:12 | Araq | ugh, reviewing git diffs is just barbaric |
20:53:14 | Araq | git doesn't understand syntax trees, so if I wrap X in an 'if cond:\n X' it's a "big change" |
20:53:20 | * | sz0 joined #nim |
20:53:25 | Araq | pathetic bullshit. plain text simply doesn't work. never has, never will. |
20:53:59 | hcorion | Huh. Build failed. |
21:07:04 | * | zachcarter joined #nim |
21:07:43 | FromGitter | <Varriount> Araq: Try disabling whitespace diffs? |
21:07:44 | * | couven92 joined #nim |
21:10:39 | hcorion | Maybe we do need to work on travis. I think the issue is that the servers are under load and this Nim is given less processing power. |
21:11:27 | Araq | varriount: that's not a solution. |
21:15:46 | Araq | yay, only 20 commits left to review... |
21:29:41 | FromGitter | <Varriount> Araq: :< |
21:31:12 | * | rauss quit (Quit: WeeChat 1.7) |
21:40:10 | * | Jesin quit (Quit: Leaving) |
21:45:13 | FromGitter | <TiberiumPY> dom96: what would you recommend for request per second limiting for async httpclient? I call method, which is doing requests for a web API, from different places, files, but with one instance |
21:45:39 | FromGitter | <TiberiumPY> I need to limit it to 3 req/s |
21:46:48 | dom96 | Create a type to hold a `lastRequest` field which contains the time when the last request was made |
21:47:00 | dom96 | create your own request procedure that checks this field |
21:47:20 | dom96 | use epochTime for the time |
21:48:58 | FromGitter | <TiberiumPY> Ah, thanks :) |
21:50:13 | FromGitter | <TiberiumPY> And for additional learning of Nim I wish to do macro like this |
21:50:18 | FromGitter | <TiberiumPY> Oh sorry |
21:51:24 | FromGitter | <TiberiumPY> Can't delete messages from mobile app, need to do in browser :) |
21:53:54 | FromGitter | <TiberiumPY> So web API allows you to send up to 25 requests in one, so you can process them at web API side via restricted subset of JS (very restricted) |
21:54:06 | FromGitter | <TiberiumPY> And I want to do macro like this: |
21:54:26 | FromGitter | <TiberiumPY> `````` |
21:54:29 | FromGitter | <TiberiumPY> Oh wait |
21:54:43 | FromGitter | <TiberiumPY> 77 |
21:54:52 | FromGitter | <TiberiumPY> I can't put messines newlines |
22:00:58 | * | nsf quit (Quit: WeeChat 1.7) |
22:02:50 | FromGitter | <TiberiumPY> So I want to create macro like that: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=58dadd8908c00c092a26370f] |
22:03:06 | FromGitter | <TiberiumPY> I think it's possible |
22:03:30 | FromGitter | <TiberiumPY> Oh, I meant to put this code block inside "execute" macro block |
22:05:45 | * | tyler569 joined #nim |
22:20:09 | * | gangstacat quit (Ping timeout: 240 seconds) |
22:27:02 | * | zachcarter quit (Quit: zachcarter) |
22:28:21 | * | Jesin joined #nim |
22:29:11 | * | dmi0 quit (Ping timeout: 264 seconds) |
22:37:03 | * | PMunch quit (Quit: leaving) |
22:40:45 | * | couven92 quit (Quit: Client Disconnecting) |
22:41:51 | SusWombat | can i open somehow stdin with openAsync? |
22:43:55 | dom96 | SusWombat: nope |
22:44:06 | dom96 | do what I do here instead https://github.com/dom96/nim-in-action-code/blob/master/Chapter3/ChatApp/src/client.nim#L39 |
22:44:09 | dom96 | 'night |
22:48:37 | cheatfate | SusWombat, it doesn't help you a lot, because stdin available to read/write only when Enter button pressed |
22:50:05 | * | krux02 joined #nim |
22:53:13 | SusWombat | ok ty |
22:54:26 | * | sz0 quit (Quit: Connection closed for inactivity) |
23:00:33 | * | vlad1777d quit (Quit: Leaving) |
23:02:26 | * | zachcarter joined #nim |
23:09:36 | * | zachcarter quit (Ping timeout: 240 seconds) |
23:12:06 | * | zachcarter joined #nim |
23:12:51 | * | niv quit (Remote host closed the connection) |
23:12:59 | krux02 | Araq, do you know if C structs introduce any alignment patterns by default except those to align primitive types? |
23:13:45 | demi- | krux02: that is compiler and platform specific |
23:14:12 | * | butchster_ joined #nim |
23:14:27 | * | niv joined #nim |
23:14:45 | krux02 | demi-, I highly doubt that different C compilers layout C structs differently |
23:15:03 | Araq | structs are always aligned |
23:15:14 | krux02 | that would mean that I could not use link together programs that are compiled by different compilers |
23:15:28 | krux02 | aligned to what? |
23:15:32 | Araq | the alignment is determined by the fields in them |
23:15:54 | Araq | the max alignment of the fields determines the struct alignment |
23:15:55 | krux02 | I intuition tells me that every type has an "alignment" attributes |
23:16:06 | Araq | exactly. |
23:16:10 | krux02 | and the alignment attribute from structs the the maximum of all it's members |
23:16:14 | krux02 | (by default) |
23:16:16 | Araq | yes |
23:16:29 | krux02 | it can be overridden though |
23:16:37 | Araq | yes |
23:16:59 | demi- | krux02: they can, because it is entirely dependent on platform architectures |
23:17:00 | Araq | and for unions nested in structs nested in structs it can become very surprising |
23:17:03 | * | Matthias247 quit (Read error: Connection reset by peer) |
23:17:05 | * | krux02 left #nim ("Leaving") |
23:17:13 | * | krux02 joined #nim |
23:17:59 | * | butchster quit (Ping timeout: 256 seconds) |
23:18:06 | Araq | demi-: it's pretty standardized, I don't know of many cpu specific rules |
23:18:15 | krux02 | Araq, well I don't care for unions so far, but I wouldn't do it differently than with structs |
23:18:29 | * | butchster_ quit (Ping timeout: 240 seconds) |
23:18:41 | Araq | sdl's event type comes to mind |
23:19:04 | demi- | Araq: not that i can name off the top of my head, but i am making the point that you cannot depend on alignment without packing |
23:19:06 | krux02 | It must be standardized otherwise C would not count as the lingua franca for programming languages |
23:19:07 | Araq | has strange alignment for reasons that escaped me |
23:19:46 | demi- | lol |
23:19:49 | Araq | hahaha, it doesn't take facts to create a myth |
23:20:00 | Araq | ("lingua franca" my ass) |
23:20:04 | demi- | yeah really |
23:21:00 | Araq | it's part of the ABI though and C compilers usually adhere to the ABI |
23:21:07 | krux02 | well I exaggerated a bit, but most programming languages do have a C interface |
23:21:33 | krux02 | and that would not work if different compilers would align struct members differently from header files |
23:21:46 | Araq | good C code lacks #align annotations for this reason |
23:22:01 | Araq | it's standardized, don't mess with it |
23:22:11 | Araq | don't outsmart the compiler. |
23:22:24 | Araq | don't create a struct that's less compatible with the others. |
23:22:28 | * | xet7 joined #nim |
23:22:48 | krux02 | I don't want to outsmart the compiler, all I would like to do is to write an offsetof macro that can be evaluated at compile time |
23:22:58 | krux02 | therefore I need to know the alignment rules |
23:23:01 | demi- | krux02: it would work fine in most cases, because you compile the library you are going to use with your compiler and it interfaces with the C struct through a layer of abstraction |
23:23:35 | demi- | and unless you are mapping from data in files or something the alignment of the struct isn't a huge deal |
23:23:46 | demi- | since you aren't accessing based on offset, but via member name instead |
23:23:58 | Araq | demi-: that's not how C interop usually works for a compiled language. usually you're ABI compliant. |
23:24:07 | krux02 | demi-, well I don't think that struct definitions in the header file count as layers of abstraction |
23:24:42 | demi- | krux02: no, but ruby and python, for example, don't interface directly with the struct members, there is a layer in-between for doing that |
23:24:51 | Araq | krux02: yeah and it's a nice goal. |
23:25:04 | Araq | check out sdl's event type |
23:25:13 | Araq | to learn how it really works :-) |
23:25:37 | * | smt quit (Ping timeout: 240 seconds) |
23:25:38 | demi- | Araq: true, for an evaluated language that is the case; for compiled you would have the ABI compliance |
23:26:46 | Araq | yes, but even for Python's FFI via ctypes offsets matter. Ruby has a comparable module. |
23:27:52 | krux02 | I just searched a bit for ABI, and I found out, that different architectures may in fact have different ABI's |
23:28:06 | demi- | yup |
23:28:33 | krux02 | but that doesn't matter because normally you don't interface in binary with different Processor architectures |
23:28:46 | * | smt joined #nim |
23:30:13 | krux02 | but for my implementation it does matter though if I want it to be used on different platforms, too |
23:32:01 | * | user0___ joined #nim |
23:35:32 | * | ftsf_ joined #nim |
23:39:49 | tyler569 | even the same architecture can have different ABIs, Microsoft and *nix use different ones |
23:40:14 | * | ftsf_ quit (Ping timeout: 246 seconds) |
23:40:55 | krux02 | tyler569, well I did find differences in calling conventions, but nothing else |
23:41:16 | krux02 | even for different architectures I could only find that C struct members do self alignment |
23:43:53 | SusWombat | can it be that loadLib behaves differently when used for dlls instead of a .so? |
23:45:18 | Araq | SusWombat: sure. it's OS specific. |
23:46:09 | SusWombat | i have a "spawned" readLine which works under linux with a .so but not with dlls |
23:53:09 | * | ftsf_ joined #nim |
23:54:51 | * | Jesin quit (Quit: Leaving) |
23:57:24 | Araq | I doubt threadpool works in a DLL |
23:58:42 | * | roygbiv joined #nim |
23:58:55 | SusWombat | How can i kill a "spawned readline"? |