00:03:36 | * | banc joined #nim |
00:05:24 | * | stefanos82 quit (Remote host closed the connection) |
00:07:12 | * | craigger quit (Quit: bye) |
00:12:55 | * | craigger joined #nim |
00:13:07 | * | craigger quit (Remote host closed the connection) |
00:21:19 | * | craigger joined #nim |
00:41:46 | * | kinkinkijkin quit (Ping timeout: 246 seconds) |
00:45:56 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
00:50:08 | * | SenasOzys joined #nim |
00:50:51 | * | SenasOzys quit (Remote host closed the connection) |
00:51:14 | * | SenasOzys joined #nim |
00:52:04 | * | SenasOzys quit (Client Quit) |
01:27:58 | * | Cthalupa quit (Ping timeout: 245 seconds) |
01:29:45 | * | Cthalupa joined #nim |
01:53:40 | * | abm quit (Quit: Leaving) |
01:55:28 | * | SenasOzys joined #nim |
01:55:36 | * | SenasOzys quit (Client Quit) |
01:56:48 | * | SenasOzys joined #nim |
01:57:12 | * | SenasOzys quit (Client Quit) |
01:59:41 | * | SenasOzys joined #nim |
02:00:00 | * | SenasOzys quit (Remote host closed the connection) |
02:04:58 | * | SenasOzys joined #nim |
02:05:17 | * | SenasOzys quit (Remote host closed the connection) |
02:12:11 | * | kapil____ quit (Quit: Connection closed for inactivity) |
02:29:29 | FromGitter | <gogolxdong> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c26dc0993cce97d3bb2889a] |
02:30:33 | FromGitter | <gogolxdong> How do compare e.data with string value?I tried kstring, cstring, and with/without $. |
02:34:19 | * | endragor joined #nim |
02:36:50 | leorize | gogolxdong: what type was `e.data`? |
02:38:34 | * | endragor quit (Ping timeout: 250 seconds) |
02:39:35 | FromGitter | <gogolxdong> jwebsockets.nim of karax ⏎ ⏎ ```type ⏎ MessageEvent* {.importc.} = ref object ⏎ data*: cstring``` [https://gitter.im/nim-lang/Nim?at=5c26de6737975e7ca93d58bb] |
02:42:42 | leorize | then I believe converting the cstring with `$` then compare with `string` should work |
02:43:47 | leorize | there's also [this](http://nim-lang.github.io/Nim/cstrutils.html) module that allows comparing cstrings directly, but I don't think it's of much use in the js backend |
02:47:42 | FromGitter | <gogolxdong> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c26e04e92cf4d22420e064e] |
02:50:00 | * | endragor joined #nim |
02:50:23 | FromGitter | <gogolxdong> well, it's subtle, echo e.data is "1", but it's kind of JsonNode cstring, cannot compare directly with string or cstring, I guess should parse it to JsonNode then getStr and compare, it works. |
02:54:41 | * | endragor quit (Ping timeout: 268 seconds) |
03:00:11 | * | banc quit (Quit: Bye) |
03:05:39 | * | endragor joined #nim |
03:09:47 | * | endragor quit (Ping timeout: 240 seconds) |
03:15:57 | * | banc joined #nim |
03:21:18 | * | endragor joined #nim |
03:23:30 | * | Ven`` joined #nim |
03:25:48 | * | endragor quit (Ping timeout: 250 seconds) |
03:30:29 | * | zachk quit (Quit: Leaving) |
03:33:26 | * | kapil____ joined #nim |
03:34:28 | * | Ven`` quit (Ping timeout: 250 seconds) |
03:36:57 | * | endragor joined #nim |
03:41:24 | * | endragor quit (Ping timeout: 250 seconds) |
03:46:54 | * | dddddd quit (Remote host closed the connection) |
03:50:55 | * | Tyresc quit (Quit: WeeChat 2.4-dev) |
03:52:32 | * | endragor joined #nim |
03:55:04 | * | quipa joined #nim |
03:56:43 | * | endragor quit (Ping timeout: 245 seconds) |
04:01:47 | * | quipa quit (Read error: Connection reset by peer) |
04:08:12 | * | endragor joined #nim |
04:12:36 | * | endragor quit (Ping timeout: 250 seconds) |
04:23:19 | * | bevo009 quit (Quit: Page closed) |
04:23:50 | * | endragor joined #nim |
04:27:58 | * | endragor quit (Ping timeout: 245 seconds) |
04:30:18 | * | bevo quit (Quit: Leaving) |
04:39:29 | * | endragor joined #nim |
04:43:48 | * | endragor quit (Ping timeout: 250 seconds) |
04:55:08 | * | endragor joined #nim |
05:00:06 | * | endragor quit (Ping timeout: 272 seconds) |
05:10:45 | * | endragor joined #nim |
05:15:00 | * | endragor quit (Ping timeout: 250 seconds) |
05:37:37 | * | narimiran joined #nim |
05:42:00 | * | endragor joined #nim |
05:46:32 | * | darithorn quit (Quit: Leaving) |
05:46:44 | * | endragor quit (Ping timeout: 268 seconds) |
05:55:01 | * | nsf joined #nim |
05:56:24 | * | Vladar joined #nim |
05:57:38 | * | endragor joined #nim |
06:01:51 | * | endragor quit (Ping timeout: 250 seconds) |
06:13:21 | * | endragor joined #nim |
06:18:11 | * | endragor quit (Ping timeout: 268 seconds) |
06:35:26 | * | wildlander quit (Quit: Konversation terminated!) |
06:44:17 | * | kungtotte quit (Remote host closed the connection) |
06:44:36 | * | endragor joined #nim |
06:46:14 | * | vlad1777d joined #nim |
06:48:47 | * | endragor quit (Ping timeout: 246 seconds) |
07:09:10 | * | endragor joined #nim |
07:13:27 | * | endragor quit (Ping timeout: 240 seconds) |
07:19:15 | * | endragor joined #nim |
07:20:00 | * | tefter joined #nim |
07:23:27 | * | endragor quit (Ping timeout: 240 seconds) |
07:29:18 | * | endragor joined #nim |
07:33:35 | * | endragor quit (Ping timeout: 246 seconds) |
07:39:19 | * | endragor joined #nim |
07:43:41 | * | endragor quit (Ping timeout: 250 seconds) |
07:49:25 | * | endragor joined #nim |
07:52:16 | * | Cthalupa quit (Ping timeout: 246 seconds) |
07:52:57 | * | Cthalupa joined #nim |
07:53:17 | FromGitter | <gogolxdong> How to compare the karax JsonNode with "undefined" ? There is a JObject in jsffi, can I cast JsonNode to JObject? |
07:53:34 | FromGitter | <gogolxdong> JsObject* |
07:53:36 | * | endragor quit (Ping timeout: 250 seconds) |
07:54:23 | leorize | gogolxdong: IIRC someone added "undefined" support for `isNil` |
07:54:35 | leorize | so you could just `isNil` a JsObject? |
07:58:59 | FromGitter | <gogolxdong> I'm afraid not. |
07:59:13 | FromGitter | <gogolxdong> Uncaught TypeError: Cannot read property 'description' of undefined |
07:59:29 | FromGitter | <gogolxdong> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5c27296009b8066849801c91] |
08:01:51 | FromGitter | <gogolxdong> tasks if of type JsonNode. |
08:03:57 | FromGitter | <gogolxdong> previous way is tasks[$id].toJson != "undefined" |
08:07:34 | FromGitter | <gogolxdong> oh, it doesn't work neither. |
08:14:59 | FromGitter | <alehander42> yes, I added isNil for undefined |
08:15:02 | FromGitter | <alehander42> but it's still not merged |
08:15:08 | FromGitter | <alehander42> I am not sure why |
08:15:24 | FromGitter | <alehander42> there was an unrelated(I think) CI error, I'll force push again |
08:23:54 | * | d10n-work quit (Quit: Connection closed for inactivity) |
08:35:38 | * | hoijui joined #nim |
08:46:43 | * | hoijui quit (Ping timeout: 268 seconds) |
08:51:16 | FromGitter | <gogolxdong> What's the implementation? I mean I need to check undefined for testing now. |
08:52:16 | FromGitter | <alehander42> well you can just define your own isUndefined temporarily |
08:52:19 | FromGitter | <alehander42> using importcpp |
08:52:42 | FromGitter | <gogolxdong> ok |
08:52:44 | FromGitter | <alehander42> a very useful pattern for quick wrapping of functions |
08:53:03 | FromGitter | <gogolxdong> copy from jsffi :) |
08:53:15 | FromGitter | <alehander42> something like proc isUndefinedT (a: T): bool {.importcpp: "(# === undefined)".} |
08:53:58 | FromGitter | <alehander42> (means replace this with (<first arg> === undefined)) |
08:56:24 | FromGitter | <gogolxdong> yeah, Andreas tought me about importcpp. |
09:09:26 | * | shpx joined #nim |
09:21:23 | * | shpx quit (Ping timeout: 246 seconds) |
09:38:16 | * | hoijui joined #nim |
09:38:28 | * | vlad1777d quit (Ping timeout: 250 seconds) |
09:39:23 | Araq | narimiran, can you please backport the lastest commits that are marked as such? |
09:39:42 | narimiran | Araq: will do |
09:40:33 | narimiran | it was on my todo for this weekend, i'll just move it to the top of the queue |
09:47:06 | * | stefanos82 joined #nim |
09:54:01 | narimiran | Araq: done |
10:14:08 | Araq | yay |
10:14:15 | Araq | are the nightlies working again? |
10:14:22 | Araq | (except the Windows stuff) |
10:25:41 | * | Vladar quit (Remote host closed the connection) |
10:27:19 | * | narimiran quit (Ping timeout: 268 seconds) |
10:32:25 | * | kapil____ quit (Quit: Connection closed for inactivity) |
10:40:45 | FromGitter | <survivorm> Happy new year to everyone! ⏎ As that's my last minutes in office for this year, i'm wishing it to all nimmers now (not sure my lazy ass will be opening this channel from home on holidays :-) ) |
10:43:04 | Araq | thanks |
10:43:21 | Araq | you should though. Open source thrives on holidays too ;-) |
10:50:21 | * | xet7 joined #nim |
10:51:27 | FromDiscord_ | <exelotl> hey does anyone know how to specify a palette using nimPNG? |
10:53:00 | FromDiscord_ | <exelotl> I created a 4bpp image from raw pixel data using encodePNG, I'm looking at the available procedures and I can't see a way to set up the palette |
11:34:29 | * | dddddd joined #nim |
12:07:23 | * | nc-x joined #nim |
12:07:33 | nc-x | Araq: You there? |
12:09:01 | Araq | nc-x, here |
12:11:01 | nc-x | I was having a go at https://github.com/nim-lang/Nim/issues/9331. The reason for that issue is that for vars/lets/consts whole node is not stored in the ast. Why is that so? (For procs the whole node is stored https://github.com/nim-lang/Nim/blob/devel/compiler/semstmts.nim#L1613)) |
12:12:12 | Araq | because I found it more natural to model it this way |
12:13:00 | nc-x | So now the deprecated message is getting lost for vars/lets/consts |
12:13:12 | nc-x | So what would be the best way to solve this |
12:14:32 | * | Snircle joined #nim |
12:15:34 | Araq | as you suggested, fixing the sym.ast |
12:19:45 | nc-x | I mean what ast should I produce? Should I change it to be like procs, where whole node is copied or something else? |
12:20:35 | * | hoijui quit (Ping timeout: 250 seconds) |
12:22:37 | Araq | sym.ast should contain the nkConstDef etc |
12:22:44 | * | dorelix joined #nim |
12:27:38 | sendell[m] | Are the "opt[T]" owning pointers already implemented in devel? Can we expect to have them in next release? :) |
12:38:03 | * | hoijui joined #nim |
12:41:55 | sendell[m] | I'm also wondering if we might build other kinds of smart_ptr using the new destructors, like shared+weak |
12:42:53 | * | Vladar joined #nim |
12:52:24 | sendell[m] | (maybe spt[T], wpt[T]?) |
12:54:46 | * | hoijui quit (Ping timeout: 250 seconds) |
13:05:32 | * | kapil____ joined #nim |
13:10:24 | FromGitter | <arnetheduck> in `nim.cfg`, can I access the project path somehome? imagine I want to add an include directory relative to the `nim` file I'm compiling.. |
13:13:37 | * | nc-x quit (Quit: Page closed) |
13:21:47 | FromGitter | <Clyybber> Araq: Statics or const's dont make much sense in the VM right? |
13:25:41 | Araq | no they do |
13:25:54 | Araq | but I don't know if static T is a value or a type in the VM |
13:26:19 | Araq | I've complained about this before, remember ;-) |
13:26:35 | FromGitter | <Clyybber> Yeah :D |
13:27:03 | Araq | sendell[m]: yeah, they are made possible by this feature |
13:27:39 | Araq | and opt[T] doesn't have to be builtin anymore, I added it before I figured out how move semantics should be done |
13:28:22 | Araq | arnetheduck: iirc that's not possible due to phase ordering problems |
13:28:43 | FromGitter | <Clyybber> Araq: Wouldn't it be possible to treat static T in the VM just like (an immutable) T ? |
13:30:07 | Araq | well after my rant I understand it much better now :P, proc foo[T: static int]() = echo T is expected to "work" (as terrible as it is) so you can treat it as a value in the VM. I think. |
13:31:23 | FromGitter | <Clyybber> Araq: Have you seen https://github.com/nim-lang/Nim/issues/10085#issuecomment-450489356 ? |
13:32:21 | Araq | yes |
13:32:31 | Araq | I don't have an opinion though. |
13:32:41 | FromGitter | <Clyybber> Understandable |
13:33:45 | Araq | arrays are of fixed size though, 'static: var i = 3, a: array[i, int]; inc i' is invalid |
13:34:01 | FromGitter | <Clyybber> But in the VM couldn't it be valid? |
13:34:08 | FromGitter | <Clyybber> assuming i is immutable |
13:34:10 | FromGitter | <Clyybber> so not var? |
13:34:29 | FromGitter | <Clyybber> 'static: let i = 3, a: array[i, int]; inc i' |
13:34:59 | Araq | I think what we have here is a "staged" notion of compile-time |
13:35:16 | FromGitter | <Clyybber> There are multiple layers of compile time there |
13:35:22 | Araq | exactly |
13:35:29 | FromGitter | <Clyybber> But compile time for a VM doesn't make sense does it? |
13:35:46 | Araq | it does, the VM can inline constants, for example |
13:35:54 | FromGitter | <Clyybber> Oh ok. |
13:35:59 | Araq | but not vars, whether in a static block or not |
13:36:13 | FromGitter | <Clyybber> That makes sense |
13:36:17 | Araq | the VM is much like a real machine in this sense |
13:36:31 | Araq | a different 'target' architecture |
13:37:12 | Araq | and we must be careful that it stays this way so we have more freedom in the VM implementation. |
13:37:48 | Araq | for example, I'd love to tinker with producing C code fragments and running them, avoiding a VM altogether |
13:38:06 | FromGitter | <Clyybber> Yeah that would be awesome |
13:38:10 | FromGitter | <Clyybber> Conceptually |
13:40:26 | FromGitter | <Clyybber> We could leverage TCC for that, i suppose |
13:42:22 | Araq | yeah, for example |
13:42:51 | * | whaletechno quit (Quit: ha det bra) |
13:47:04 | FromGitter | <Clyybber> Cern's https://root.cern.ch/ uses a C interpreter too |
13:49:30 | * | narimiran joined #nim |
13:51:14 | FromDiscord_ | <Semenikhin_> Sex Dating > http://discord.amazingsexdating.com |
13:54:21 | * | Ven`` joined #nim |
13:59:14 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
14:07:29 | FromGitter | <zacharycarter> looks like spammers are back? |
14:23:23 | * | natrys joined #nim |
14:27:29 | FromGitter | <zetashift> from the discord side this time :/ |
14:30:29 | FromGitter | <zacharycarter> I imagine that's an easier problem to solve :P just disable the bridge |
14:30:51 | * | xet7 quit (Ping timeout: 240 seconds) |
14:30:55 | FromGitter | <zacharycarter> although it seems like maybe it's just a rogue spammer - and not a fleet of them like freenode was suffering from |
14:31:37 | * | Trustable joined #nim |
14:41:49 | * | nsf quit (Quit: WeeChat 2.3) |
14:43:11 | sendell[m] | Araq: cool, so does that mean that we will have a "smartpointers" lib inside stdlib? :) How far is all this from usable right now? :) |
14:45:36 | Araq | I don't know, not very far away, give it another month |
14:45:58 | sendell[m] | hehe nice to hear, can't wait to try it |
14:47:34 | * | xet7 joined #nim |
14:50:08 | FromGitter | <zacharycarter> I started over on the graphics pipeline for my game / engine and I like this approach much better than how I was organizing things before |
14:51:03 | FromGitter | <zacharycarter> pipelines will be a composable series of steps and then different constructs will be constructed from the pipeline steps - like different renderers |
14:51:31 | FromGitter | <zacharycarter> hopefully I'll have something to play with by the end of the weekend, and by play with, I mean I'll be able to draw something to the screen |
15:13:57 | FromGitter | <alehander42> :D |
15:14:05 | FromGitter | <alehander42> sounds interesting |
15:14:12 | FromGitter | <alehander42> is this still in the zeal engine |
15:20:36 | * | kungtotte joined #nim |
15:21:20 | FromGitter | <zacharycarter> mmhmm |
15:23:27 | FromGitter | <alehander42> btw if I want to make a game with simple 2d graphics (very minimal, not even shades and stuff, almost child-drawing-like ), what would be the best graphic level choice : OpenGL? Vulcan?(too low level?) Something else? (I even wonder about just using webgl libs + canvas) |
15:23:54 | FromGitter | <alehander42> I am very green in gamedev, but brainstorming for an eventual gamejam thing |
15:26:58 | Araq | use SDL2 |
15:34:58 | FromDiscord_ | <j$> yo is there a way to get the version from your nimble file? |
15:36:45 | Vladar | alehander42, I've completed a couple of one-week gamejams with this: https://vladar4.github.io/nimgame2/ |
15:47:51 | * | wildlander joined #nim |
15:53:17 | * | tefter quit (Remote host closed the connection) |
15:58:45 | FromGitter | <zetashift> nimgame2 is indeed really nice and well documentated. SDL2 requires a bit more plumbing but PMunch also had some nice stuff for that |
15:59:28 | FromGitter | <zacharycarter> @alehander42 - SDL2 has a OpenGL based rendering API that is pretty high level |
15:59:44 | FromGitter | <zacharycarter> Nimgame2 is basically a library on top of SDL2 |
16:00:04 | FromGitter | <zacharycarter> if your game is that simple - I'd probably use Nimgame2 |
16:00:27 | FromGitter | <zacharycarter> everyone's goals with game dev differ though generally |
16:01:36 | FromGitter | <zacharycarter> the SDL2 rendering API does not handle large complex scenes well, with lots of draw calls per-frame |
16:01:50 | FromGitter | <zacharycarter> but it doesn't sound like you need to worry about ^ |
16:06:53 | FromGitter | <alehander42> yeah, it can't batch stuff to send it all to the gpu? |
16:14:53 | FromGitter | <zetashift> you have sdl-gpu which can do that(it is included in Vladar's Nim bindings) |
16:46:20 | narimiran | Vladar: nimgame2 looks quite nice! and big kudos to you for writing the tutorials/documentation! |
16:51:40 | Araq | „I Know i <= min(len(s), len(other)) + -4 and wonder about i <= len(s) + -1“ |
16:51:55 | * | Araq is teaching the Nim compiler more basic algebra |
16:52:02 | Vladar | thanks, narimiran =) |
16:52:14 | Araq | seems to be true, right |
16:54:36 | Araq | if i is smaller than min(a, b)-4 then it is smaller than a-4 which is smaller than a-1 |
16:55:54 | narimiran | right :) |
16:56:20 | * | MightyJoe joined #nim |
16:57:47 | * | cyraxjoe quit (Ping timeout: 240 seconds) |
17:12:17 | FromGitter | <alehander42> bounds checking? |
17:12:35 | Araq | yup |
17:14:08 | * | kapil____ quit (Quit: Connection closed for inactivity) |
17:16:50 | FromGitter | <alehander42> how is it goin |
17:18:19 | FromDiscord_ | <j$> does anyone know a way to get clipboard content, seems sdl2 clipboard doesn't work |
17:20:13 | FromDiscord_ | <j$> nvm |
17:20:17 | * | nsf joined #nim |
17:21:13 | * | kungtotte quit (Quit: leaving) |
17:21:45 | * | kungtotte joined #nim |
17:21:45 | * | kungtotte quit (Client Quit) |
17:21:47 | FromDiscord_ | <j$> forgot to init sdl |
17:24:00 | Araq | alehander42: it can prove |
17:24:02 | Araq | for i in 0 ..< min(s.len, other.len) - 3: |
17:24:02 | Araq | echo s[i], other[i] |
17:25:21 | Araq | works pretty well |
17:26:30 | FromGitter | <alehander42> nice, so which operations are magic? min/max/len/`+`/`-` ? |
17:34:38 | * | Tyresc joined #nim |
17:45:36 | * | awal quit (Quit: ZNC 1.6.4 - http://znc.in) |
17:47:11 | FromDiscord_ | <exelotl> I think I ran into a bug: https://gist.github.com/geckojsc/579699a42db4ebc590bf09a53d086ff5 |
17:47:54 | FromDiscord_ | <exelotl> that is, type conversion, not casting |
17:49:52 | Araq | alehander42: * and div too, that's about it |
17:50:51 | Araq | but I need to extend it to user-defined [] and len operations |
17:51:40 | Araq | exelotl: please report it properly |
17:55:30 | FromDiscord_ | <exelotl> will do, just wanted to check here in case it's already known |
18:00:16 | FromGitter | <alehander42> Araq, nice, is it in a branch somewhere |
18:00:48 | * | kungtotte joined #nim |
18:02:34 | Araq | no, still fixing the regressions |
18:05:22 | * | Vladar quit (Remote host closed the connection) |
18:06:38 | * | Jesin quit (Quit: Leaving) |
18:07:14 | * | smitop joined #nim |
18:10:14 | Araq | pretty impressive |
18:10:21 | Araq | it knows that |
18:10:23 | Araq | if s.len > 0: |
18:10:23 | Araq | echo s[0] |
18:10:28 | Araq | works but |
18:10:36 | Araq | if s.len > 0 or other.len > 0: |
18:10:37 | Araq | echo s[0] |
18:10:40 | Araq | doesn't :-) |
18:11:17 | FromGitter | <alehander42> nice |
18:11:44 | FromGitter | <alehander42> does it know |
18:11:50 | FromGitter | <alehander42> if s.len == 0: ⏎ .. ⏎ else: ⏎ echo s[0] [https://gitter.im/nim-lang/Nim?at=5c27b8e60b7fc97caabae0d4] |
18:11:51 | FromGitter | <alehander42> is ok |
18:12:13 | FromGitter | <alehander42> this kind of stuff works in my ref nilcheck branch but not sure if i can generalize it easily |
18:15:30 | * | OrganicAnywhere joined #nim |
18:15:33 | * | vlad1777d joined #nim |
18:15:54 | OrganicAnywhere | Is it just me, or does running things through vsc take longer? |
18:18:10 | Araq | alehander42: doesn't work. Not hard in theory though |
18:18:41 | Araq | if s.len <= 0: |
18:18:41 | Araq | echo "zero" |
18:18:41 | Araq | else: |
18:18:43 | Araq | echo s[0] |
18:18:47 | Araq | does work though :-) |
18:22:37 | FromGitter | <alehander42> huh, strange, but it makes sense :D |
18:23:07 | FromGitter | <alehander42> btw can you take a look at the test cases in https://github.com/nim-lang/Nim/pull/10127/files#diff-824cf3fb6b2b0f6d5aec5dd4b416f2b0 later, they're kinda similar so you might be able to think of situations i am forgetting about |
18:29:27 | Araq | if a != nil and b != nil: |
18:29:35 | Araq | deref(a); deref(b) |
18:29:41 | Araq | needs to be tested |
18:30:02 | Araq | and depending on your control flow analysis you need to support |
18:30:09 | Araq | if a == nil: return |
18:30:11 | Araq | deref(a) |
18:30:38 | Araq | another obvious test: |
18:30:41 | Araq | while a != nil: |
18:30:45 | Araq | deref(a) |
18:30:48 | Araq | a = a.next |
18:33:50 | Araq | another devious example is |
18:34:00 | Araq | var x: ref int |
18:34:00 | Araq | try: |
18:34:00 | Araq | couldRaise() |
18:34:02 | Araq | new(x) |
18:34:04 | Araq | finally: |
18:34:06 | Araq | deref(x) |
18:36:38 | FromGitter | <arnetheduck> it's funny you mention that kind of analysis.. been thinking about it a it lately - for the ethereum spec we have a bunch of values coming in over the network, and there's a big state object updated every time - now, the interesting part is that the spec is expressed in unbounded signed bigint arithmetic, while the serialization is mostly `uint64`.. basically that means that incoming values are bounded to `uint64` - |
18:36:38 | FromGitter | ... then along the way, the state transition code enforces certain other limits on the values etc - one thing generally done through formal analysis would be to collect those limiting expressions so you can make claims about the safe value ranges etc - any thoughts on how to approach this? |
18:39:08 | Araq | I remember that LLVM analyses the signed/unsigned variants at the same time |
18:39:36 | Araq | it tracks the bit patterns and then in the end the signed or unsigned representation is choosen |
18:40:05 | * | thumbs_scum joined #nim |
18:41:23 | * | OrganicAnywhere quit (Quit: Get schwifty) |
18:41:24 | Araq | er s/representation/interpretation |
18:42:46 | FromGitter | <arnetheduck> I'm more thinking about analysis like this: `if a * 3 > b * 2` - that means a must be `<high(uint64)` for the expression to be meaningful, placing a practical upper bound on what `a` can be without running into overflows |
18:43:01 | Araq | but in general unsigned wraparound arithmetic is so terrible that I pretend it doesn't exist, i+1 > i does not hold |
18:43:41 | FromGitter | <Varriount> I wish saturated arithmetic was the norm |
18:44:00 | Araq | likewise if you knnow that a > b then it is possible that a*3 < b*2 |
18:44:45 | FromGitter | <arnetheduck> collecting all such expressions should yield function that I can apply during deserialization to check if the value is in bounds and safe for all the operations that follow |
18:45:43 | Araq | what I would probably do is to inject basic sanity checks like |
18:45:58 | Araq | abortIf(x + 1 < x) |
18:46:30 | Araq | and then proceed as if the arithmetic rules are not broken beyond repair |
18:47:05 | FromGitter | <arnetheduck> yeah, but I'd like to: ⏎ ⏎ 1) have a guarantee that the code will not abort ⏎ 2) avoid checking intermediate values as far as possible [https://gitter.im/nim-lang/Nim?at=5c27c1282863d8612baa74dd] |
18:48:25 | FromGitter | <arnetheduck> things like the `k` framework model expressions that way - fuzzers tend to look at them to stress border conditions etc - was just curious if you knew of any good research on the subject (else yeah, the engineering solution is to sprinkle tests everywhere) |
18:49:43 | Araq | no, I consider "freedom of overflows" proofs an unsolved problem |
18:50:59 | FromGitter | <arnetheduck> and yeah, what you say is sounds about right - `llvm` has analysis like that for optimization, to establish some local information about what value something holds, and yeah, bitfield rings a bell |
18:59:48 | livcd | does anyone know if there are Nim bindings for Sciter ? |
19:16:38 | Araq | arnetheduck, another idea that probably doesn't work out: Ensure your inputs are below e.g. 0xFFFF_FFFF and then assume/ensure your loops don't run more than 0xFFFF* iterations and in the loop body only allow x + N for small N, likewise for other arithmetic operations |
19:16:54 | Araq | this becomes overly restrictive very very quickly though |
19:17:06 | * | Jesin joined #nim |
19:20:49 | Araq | https://stackoverflow.com/questions/47227900/spark-integer-overflow-check |
19:23:31 | * | nsf quit (Quit: WeeChat 2.3) |
19:27:56 | * | Ven`` quit (Ping timeout: 246 seconds) |
19:30:00 | * | kapil____ joined #nim |
19:51:52 | * | Ven`` joined #nim |
19:58:43 | FromGitter | <alehander42> Araq: I think I support all of your examples |
20:00:16 | * | endragor joined #nim |
20:00:19 | FromGitter | <alehander42> the while thing, maybe only this has to be refined |
20:00:24 | FromGitter | <alehander42> I support it for if |
20:00:32 | FromGitter | <alehander42> but i have to apply the same logic for after while |
20:01:02 | * | SenasOzys joined #nim |
20:01:08 | Araq | my index prover points out tons of questionable Nim code in system.nim |
20:01:15 | Araq | :-) |
20:01:30 | * | SenasOzys quit (Remote host closed the connection) |
20:01:56 | * | SenasOzys joined #nim |
20:05:21 | FromGitter | <Clyybber> Araq: Is the reason why ⏎ ⏎ ```if s.len == 0: ⏎ .. ⏎ else: ⏎ echo s[0]``` ⏎ ⏎ that the index prover isn't aware that len must be (0 or )positive? [https://gitter.im/nim-lang/Nim?at=5c27d38192cf4d224213ad37] |
20:10:20 | * | zachk joined #nim |
20:11:38 | * | zachk quit (Changing host) |
20:11:38 | * | zachk joined #nim |
20:18:35 | FromGitter | <alehander42> Araq, the thing I see about index is that e.g. for ref-s i can add type information so I can pass `not nilness` through calls because they have `not nil` types: one can't do the same for seq-s, as you can't say, this takes `seq[>=4, int]` |
20:25:23 | Araq | alehander42: {.requires: s.len >= 4.} |
20:25:40 | Araq | not implemented, of course |
20:26:19 | Araq | Clyybber: exactly. |
20:29:08 | FromGitter | <Clyybber> Araq: What procs does a VM implementation have to provide? I think I want to try using TCC or a C interpreter for the VM. |
20:29:39 | Araq | vmgen.nim covers the required magics |
20:30:07 | FromGitter | <Clyybber> Ok, thanks! |
20:30:54 | Araq | also macros.getType() will make your efforts a PITA :P |
20:32:22 | FromGitter | <Clyybber> :O |
20:33:44 | Araq | well don't suppport macros.getType() in the first version, rely on --incremental:on for a database of types that the generated program can query |
20:43:45 | FromGitter | <Clyybber> I like how https://github.com/nim-lang/Nim/blob/devel/compiler/readme.txt has not changed since 4 years :P |
20:56:28 | shashlick | @livcd: I can wrap it for you if it isn't already |
20:56:53 | FromGitter | <alehander42> Araq: `{.requires a.len op value.}` sounds interesting |
20:56:53 | * | smitop quit (Quit: Connection closed for inactivity) |
20:57:10 | FromGitter | <alehander42> btw, do you process e.g. `add` `delete` |
20:57:16 | FromGitter | <alehander42> e.g. a loop adding n elements means |
20:57:20 | FromGitter | <alehander42> n-1 is fine |
20:57:23 | FromGitter | <alehander42> n+1 maybe not |
20:57:36 | shashlick | But looks like one exists already |
20:57:37 | shashlick | https://github.com/oskca/nsciter |
21:11:28 | * | nsf joined #nim |
21:12:27 | * | Ven`` quit (Read error: Connection reset by peer) |
21:13:45 | * | Ven`` joined #nim |
21:22:38 | * | narimiran quit (Ping timeout: 250 seconds) |
21:28:18 | * | Calinou quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
21:43:37 | * | Calinou joined #nim |
21:52:23 | * | endragor quit (Remote host closed the connection) |
21:57:44 | * | MyMind joined #nim |
21:57:59 | * | Sembei quit (Ping timeout: 268 seconds) |
22:06:32 | * | SenasOzys quit (Quit: Leaving) |
22:10:15 | * | dorelix quit (Remote host closed the connection) |
22:10:52 | Araq | alehander42: the facts concerned with a.len must not be invalidated by a mutation to 'a' |
22:11:16 | Araq | Nim's parameter passing semantics help here |
22:12:03 | Araq | but aliasing analysis enters the picture here quickly |
22:36:37 | * | stefanos82 quit (Remote host closed the connection) |
22:43:27 | * | thomasross joined #nim |
22:45:04 | * | thomasross quit (Max SendQ exceeded) |
22:45:42 | * | thomasross joined #nim |
22:47:31 | dom96 | Should nimsuggest really be hogging 100% of my CPU for dozens of minutes at a time? |
22:48:00 | dom96 | I don't know if this is the VS code plugin's fault but it sure is annoying |
22:49:21 | dom96 | I start typing... it launches nimsuggest |
22:51:37 | dom96 | And then it somehow manages to highlight my file even after i've killed nimsuggest |
22:58:40 | * | Ven`` quit (Read error: Connection reset by peer) |
22:59:25 | * | Ven`` joined #nim |
23:04:30 | * | nsf quit (Quit: WeeChat 2.3) |
23:04:54 | * | xet7 quit (Quit: Leaving) |
23:07:24 | Araq | dom96: we should give nimlsp a try |
23:23:43 | FromGitter | <zurs> Hi everyone, quick question. I use threadpool and spawn to launch a lot of workers, but sometimes it just stops spawning new ones while waiting for the ones already spawned(which makes a lot of sense). But I have put sleep() in the worker functions but it doesn't seem to allow for more workers to spawn at the same time |
23:25:42 | FromGitter | <zurs> Should sleep() let other workers spawn and do their work or is it someting else I should be using to allow for a large amount of workers to be run at the same time. Btw the sleep() is in the loop which does the work |
23:26:51 | * | Trustable quit (Remote host closed the connection) |
23:34:24 | Araq | use setMin/MaxThreadPoolSize or whatever it's called |
23:34:54 | Araq | don't use sleep() the threadpool uses CPU activity to determine whether new threads should be created and sleep doesn't increase CPU activity |
23:37:40 | FromGitter | <zurs> The setMinPoolSize() was exactly what I needed, thanks! |
23:38:32 | FromGitter | <zurs> Yeah, I removed the sleep and now it just flies |
23:40:11 | * | NimBot joined #nim |
23:41:47 | * | natrys quit (Quit: natrys) |
23:43:18 | FromGitter | <deansher> And here's a very different question: I am working on a macro package that will allow a user to declare a "field" in module A and then use it from module B. A field has an identifier, a fully qualified name, and a type. The fully qualified name is constructed from the module name and the identifier. (This is inspired by Clojure's namespaced maps.) I am trying to figure out what underlying Nim thing I can export from |
23:43:18 | FromGitter | ... module A and reference in module B to represent the field. ⏎ ⏎ That thing's name should be the field's identifier, so that the import works as the programmer would expect. I was hoping it could be a const containing a tuple of the field's fully qualified name and the field's type. But I'll need to use the type in s ... [https://gitter.im/nim-lang/Nim?at=5c2806968dafa715c7121c95] |
23:49:46 | FromGitter | <timotheecour> hi @araq ; any other comments on https://github.com/nim-lang/Nim/pull/10071 ? |
23:51:36 | FromGitter | <timotheecour> i have a number of green PR’s with no un-addressed comments (or no comments at all) that I’d really like to get merged |
23:54:08 | * | kapil____ quit (Quit: Connection closed for inactivity) |