00:00:01 | * | junland quit (Quit: %ZNC Disconnected%) |
00:00:45 | * | junland joined #nim |
00:01:03 | * | onionhammer1 is now known as onionhammer |
00:17:05 | * | stefanos82 quit (Quit: Quitting for now...) |
00:23:41 | FromGitter | <Obround> How do you print a seq as an array? |
00:33:05 | * | actuallybatman quit (Ping timeout: 268 seconds) |
01:02:15 | * | ng0_ joined #nim |
01:04:03 | * | ng0_ quit (Client Quit) |
01:04:56 | * | ng0 quit (Ping timeout: 260 seconds) |
01:12:33 | rayman22201 | @Obround: http://ix.io/1OqI/nim |
01:12:50 | rayman22201 | just remove the '@' from the string? |
01:16:29 | * | sniffdtek quit (Remote host closed the connection) |
01:26:34 | skrylar[m] | @zacharycarter yes there were some warnings around the net about that; ktx is well specified (dds is just sorta.. half-ass specified, but hasn't changed) but there were notes in the unity/crunch posts that ktx tools tend to be bugtastic |
02:11:03 | FromDiscord_ | <jos> was the nimble file format changed recently hahaha |
02:11:25 | FromDiscord_ | <jos> reading as ini failed, interpreting as nimscript failed |
02:11:26 | FromDiscord_ | <jos> 😃 |
02:15:03 | * | laaron- quit (Remote host closed the connection) |
02:17:37 | FromDiscord_ | <jos> lol even the generated config made with nimble init is failing to parse |
02:17:41 | FromGitter | <Obround> <rayman22201> -- Thanks! |
02:17:54 | FromDiscord_ | <jos> I just installed nimble from the arch repo |
02:18:12 | FromGitter | <Obround> How do you delete a variable? |
02:19:20 | * | laaron joined #nim |
02:29:39 | rayman22201 | Set it to nil |
02:46:08 | * | laaron- joined #nim |
02:46:22 | * | laaron quit (Quit: ZNC 1.7.1 - https://znc.in) |
03:18:21 | * | lritter quit (Ping timeout: 268 seconds) |
03:19:01 | * | lritter joined #nim |
03:22:54 | * | dddddd quit (Remote host closed the connection) |
03:50:10 | * | laaron- quit (Quit: ZNC 1.7.1 - https://znc.in) |
03:52:17 | * | PMunch quit (Remote host closed the connection) |
03:54:53 | * | laaron joined #nim |
03:57:06 | * | laaron quit (Client Quit) |
03:58:48 | * | laaron joined #nim |
04:00:36 | * | laaron quit (Client Quit) |
04:02:32 | * | laaron joined #nim |
04:03:29 | * | laaron quit (Remote host closed the connection) |
04:06:24 | * | laaron joined #nim |
04:10:38 | * | laaron quit (Client Quit) |
04:11:51 | * | laaron joined #nim |
04:13:03 | * | laaron quit (Remote host closed the connection) |
04:16:35 | * | laaron joined #nim |
04:32:05 | * | sniffdtek joined #nim |
05:11:12 | * | lritter quit (Ping timeout: 268 seconds) |
05:15:59 | * | narimiran joined #nim |
05:41:52 | * | solitudesf joined #nim |
05:48:26 | * | MH026 quit (Remote host closed the connection) |
05:59:58 | * | absolutejam3 joined #nim |
06:13:41 | leorize[m] | @jos I'd recommend using choosenim on Arch |
06:14:21 | leorize[m] | iirc the maintainer hasn't updated nim to 0.20.0 |
06:16:08 | FromGitter | <zacharycarter> skrylar[m] - I wouldn't be surprised if author of raylib just didn't write his load / save methods correctly |
06:16:28 | FromGitter | <zacharycarter> also - I added bc7 compression as a supported compression format to the dds loader you wrote |
06:16:41 | FromGitter | <zacharycarter> not sure if you want me to PR it or not |
06:17:10 | FromDiscord_ | <Skaruts> ChooseNim vs Nimble? |
06:17:52 | FromGitter | <zacharycarter> I think he's saying to install nimble - use choosenim |
06:18:00 | FromGitter | <zacharycarter> not trying to say use choosenim over nimble - they are not 1:1 |
06:18:20 | FromDiscord_ | <Skaruts> yea I don't know the difference |
06:18:54 | FromDiscord_ | <Skaruts> that's what I'm asking, sorry, I could've asked more clearly |
06:18:57 | FromGitter | <zacharycarter> Choosenim is like rustup - it allows you to manage different install versions of Nim |
06:19:10 | FromGitter | <zacharycarter> nimble is Nim's package manager |
06:19:12 | rayman22201 | They are totally different. Choosenim installs the Nim compiler for you. Nimble is a package manager. |
06:19:23 | FromDiscord_ | <Skaruts> oh |
06:19:36 | FromGitter | <zacharycarter> so with choosenim you can have like 5 different versions of Nim installed |
06:19:42 | FromGitter | <zacharycarter> and easily switch between which version you use |
06:20:07 | FromGitter | <zacharycarter> with Nimble - someone can develop a package and then you can reference that package in your nimble file, and use it as a dependency - just like with NPM in the JS world |
06:20:16 | FromGitter | <zacharycarter> except nimble doesn't suck nearly as hard as NPM does |
06:20:27 | FromGitter | <zacharycarter> nor does Nim suck nearly as hard as JS does :P |
06:20:35 | rayman22201 | Zacharycarter you got this. Didn't mean to jump in on your toes lol |
06:20:38 | FromDiscord_ | <Skaruts> hmmm, I can't remember how I installed nim before |
06:21:01 | FromGitter | <zacharycarter> hahaha no worries at all :) was just being thorough in my explanation I guess :P |
06:21:18 | FromGitter | <zacharycarter> in case Skaruts has never used rustup / a package manager before |
06:21:27 | FromDiscord_ | <Skaruts> I did a bit |
06:21:40 | FromDiscord_ | <Skaruts> I tried rust a bit a while ago |
06:21:51 | FromGitter | <zacharycarter> ah cool |
06:21:56 | FromDiscord_ | <Skaruts> oh wait no, actually I used cargo |
06:22:07 | FromDiscord_ | <Skaruts> but yea I get what you're saying |
06:23:51 | FromGitter | <zacharycarter> yeah cargo is rust's package manager |
06:24:21 | FromGitter | <zacharycarter> I went to be around 3 last night - my dog woke me up around 8:45 and was back in bed by 9 |
06:24:25 | FromGitter | <zacharycarter> wtf |
06:24:29 | FromGitter | <zacharycarter> dog |
06:26:49 | * | Senketsu joined #nim |
06:31:23 | FromGitter | <eptification> @Skaruts dont forget to add to path |
06:32:17 | FromDiscord_ | <Skaruts> yup |
06:38:42 | * | gangstacat quit (Quit: Ĝis!) |
06:55:59 | * | nsf joined #nim |
07:00:00 | * | gmpreussner quit (Quit: kthxbye) |
07:02:41 | FromGitter | <arnetheduck> @zacharycarter which features of `nimble` do you prefer over `npm` / what does `nimble` do better? |
07:03:49 | FromGitter | <zacharycarter> it might just be a scale factor - but npm has historically had several issues with packages breaking which screws up everyone downstream |
07:04:10 | FromGitter | <zacharycarter> also - I dislike how NPM allows you to store configuration inside your projects definition |
07:04:39 | * | gmpreussner joined #nim |
07:04:43 | FromGitter | <zacharycarter> dev dependencies vs dependencies suck |
07:04:55 | * | absolutejam3 quit (Ping timeout: 246 seconds) |
07:05:21 | FromGitter | <zacharycarter> I think my distaste for it is more of a distaste for the entire JS tooling ecosystem |
07:08:43 | * | Trustable joined #nim |
07:09:39 | FromGitter | <zacharycarter> it does have some nice features too - like the CI feature is pretty sweet |
07:09:45 | FromGitter | <zacharycarter> but I think nimble already does that out of the box |
07:16:58 | * | absolutejam3 joined #nim |
07:22:51 | FromDiscord_ | <Skaruts> trying to figure out when `methods` are actually needed. According to Nim tutorial, they're needed for dynamic dispatch. |
07:22:51 | FromDiscord_ | <Skaruts> |
07:22:52 | FromDiscord_ | <Skaruts> How do I know when I require dynamic dispatch for my object? Inheritance seems to work fine with procs, as I've just tested. |
07:23:10 | FromDiscord_ | <Skaruts> (simple inheritance at least) |
07:24:22 | FromDiscord_ | <Skaruts> (I just forgot about not using multi-line messages on discord... sorry about that) |
07:29:15 | * | Senketsu quit (Quit: WeeChat 2.5) |
07:29:35 | Zevv | rayman22201: it's all complicated. getData() is used to access the data of type T that was passed when registering the fd, and is indexed by fd itself. |
07:29:45 | Zevv | So the only way around is an unique fake fd for each event handler |
07:29:47 | Zevv | bah |
07:40:58 | * | gangstacat joined #nim |
07:48:11 | FromGitter | <mratsim> @Skaruts, if it's in the same module, and only that specific proc is visible to your inherited type only it can be called so it will work |
07:48:24 | FromGitter | <mratsim> but otherwise, it might become a mess |
07:48:56 | * | NiCad joined #nim |
07:49:13 | * | absolutejam3 quit (Ping timeout: 258 seconds) |
07:53:00 | * | Trustable quit (Remote host closed the connection) |
07:55:01 | FromDiscord_ | <Skaruts> well in my test they're both in the same module, but all the procs are visible too |
07:59:09 | FromDiscord_ | <Skaruts> https://play.nim-lang.org/#ix=1Os3 |
08:13:58 | * | Senketsu joined #nim |
08:17:50 | FromGitter | <mratsim> try with the test in a different file |
08:18:38 | FromGitter | <mratsim> btw I opened the RFC on removing the `[]` dereference operator to replace it by `deref`: https://github.com/nim-lang/RFCs/issues/154 |
08:21:24 | FromGitter | <mratsim> Woot: so we can implement a threading library in newruntime? https://github.com/nim-lang/Nim/commit/416ba133ad1e62cc8ce7241c85e89d5707b5736f |
08:25:22 | * | brakmic joined #nim |
08:26:00 | * | actuallybatman joined #nim |
08:30:36 | * | brakmic_ joined #nim |
08:31:49 | * | NiCad quit (Remote host closed the connection) |
08:32:56 | FromGitter | <alehander42> wow i decided to use `deref` in my hobby lang |
08:33:14 | * | brakmic quit (Ping timeout: 272 seconds) |
08:33:31 | FromGitter | <alehander42> but just because i cant think of a good letter |
08:33:45 | FromGitter | <alehander42> actually using it in a real lang sounds really verbose to me |
08:34:09 | FromGitter | <alehander42> (but is [] used often actually) |
08:35:32 | FromGitter | <mratsim> I do lots of lowlevel stuff and I'm mostly using addr/unsafeAddr |
08:38:07 | FromGitter | <mratsim> the only places I'm using `[]` is when when initializing/deallocating an object that contains a ref, for example: https://github.com/mratsim/Arraymancer/blob/master/src/tensor/data_structure.nim#L58, https://github.com/mratsim/Arraymancer/blob/master/src/tensor/backend/cuda.nim#L30 |
08:38:12 | FromDiscord_ | <Skaruts> by `deref` you mean `deref(pointer)` ? |
08:38:16 | FromGitter | <mratsim> yes |
08:38:31 | FromDiscord_ | <Skaruts> not a fan of that tbh |
08:38:40 | FromDiscord_ | <Skaruts> not a fan of `[]` though |
08:38:46 | FromDiscord_ | <Skaruts> either |
08:39:26 | FromDiscord_ | <Skaruts> generally I'm not a fan of explicit function calls when symbols could be used |
08:39:42 | FromDiscord_ | <Skaruts> shl, shr, div, mod, etc, not a fan of any of that... |
08:39:49 | FromDiscord_ | <Skaruts> not as readable |
08:41:07 | FromDiscord_ | <Skaruts> is it impossible for Nim to implement * for dereferencing? |
08:43:18 | FromGitter | <mratsim> Nim philosophy is to prefer names to symbol unless there is wide recognition. That leaves operators free for libraries. |
08:44:26 | FromGitter | <mratsim> you can do `proc `*`(x: ptr T or ref T): var T = x[]` |
08:45:20 | FromDiscord_ | <Skaruts> well one could do that for `deref` as well I guess |
08:46:04 | FromDiscord_ | <Skaruts> I would argue that there's wide recognition for `*` though |
08:46:42 | FromGitter | <mratsim> Or maybe this: ⏎ ⏎ `proc *(x: ptr T or ref T): var T {magic:"Deref"}` assuming that's the name of the compiler builtin |
08:46:57 | FromGitter | <mratsim> Only in the C/C++ community |
08:47:12 | FromGitter | <mratsim> Stuff like >> can mean very different thing in say Haskell |
08:47:31 | FromDiscord_ | <Skaruts> yea but nearly everyone and their mothers has at least poked into C++ 😄 |
08:47:41 | FromDiscord_ | <Skaruts> or C |
08:47:54 | FromDiscord_ | <Skaruts> anyway that's among my biggest peeves with Nim though, I prefer symbols to names because names blend in with the rest of the code, making it less discernible |
08:48:00 | FromGitter | <alehander42> i dont like `*` for deref |
08:48:04 | FromGitter | <mratsim> Many people in Python don't want to touch C++, it's "scary" |
08:48:08 | FromGitter | <alehander42> i dont understand why they use it |
08:48:27 | FromGitter | <alehander42> wait, it is `&` |
08:48:36 | FromGitter | <mratsim> I'm pretty sure it was to save bytes or use less space when code was on perforated stuff |
08:48:37 | FromDiscord_ | <Skaruts> tbh I don't mind `[]` for being different, just for being two characters that in my keyboard require a mod key |
08:48:39 | FromGitter | <alehander42> no, exactly, you mean deref |
08:48:53 | FromGitter | <alehander42> its `a*` which just seems counterintuitive to me |
08:49:12 | FromGitter | <mratsim> it's unary so it should be preceding the variable |
08:49:43 | FromGitter | <alehander42> yeah |
08:49:44 | FromGitter | <mratsim> anyway C has contraints that code should fit in a couple of kB of memory at the time |
08:49:48 | FromGitter | <mratsim> had* |
08:50:02 | FromGitter | <alehander42> yeah, maybe its a good opeator |
08:50:06 | FromDiscord_ | <Skaruts> @alehander42 my best guess is that `*` kinda looks like a point, so pointer... |
08:50:14 | FromGitter | <alehander42> i am not sure why i dislike it |
08:50:31 | FromGitter | <alehander42> no, i disliked the fact that e.g. |
08:50:39 | FromGitter | <alehander42> you could say that `addr` is * |
08:50:47 | FromGitter | <mratsim> addr is & |
08:50:49 | FromGitter | <alehander42> because `&a` also produced a `*` |
08:50:55 | FromGitter | <alehander42> so why isnt it `*a` in c |
08:50:59 | FromGitter | <alehander42> in this kind of sense |
08:51:19 | FromGitter | <alehander42> i am not sure why exactly dereferencing deserves it more compared to getting an address |
08:51:21 | FromGitter | <mratsim> I'm more annoyed by *(myObject.myRefField) = something() |
08:51:40 | FromGitter | <alehander42> this makes sense, how would you design it |
08:51:54 | FromGitter | <mratsim> but anyway, we shouldn't take valuable operator space with that |
08:52:23 | FromGitter | <mratsim> I think deref is fine and people can remap that to `*` in their own code |
08:52:45 | FromDiscord_ | <Skaruts> can that be done with a template btw? |
08:52:57 | FromGitter | <mratsim> but `[]` is annoying me left and right when I'm always overloading `[]` in my libraries |
08:53:06 | FromGitter | <mratsim> yes you can do that with a template or macro |
08:54:36 | FromGitter | <mratsim> This is a nice read on Rust concurrency library: https://stjepang.github.io/2019/01/29/lock-free-rust-crossbeam-in-2019.html |
08:55:10 | * | Senketsu quit (Quit: WeeChat 2.5) |
08:55:16 | FromDiscord_ | <Skaruts> `template * (x: ptr T or ref T): var T = x[]`? |
08:55:24 | FromDiscord_ | <Skaruts> I just replaced proc |
08:56:28 | FromGitter | <mratsim> yes that should work as well |
08:56:43 | FromGitter | <mratsim> with a \[T\] |
08:56:44 | FromDiscord_ | <Skaruts> nice |
09:02:15 | FromDiscord_ | <Skaruts> but I'm wondering, using a symbol doesn't exactly "take operator space", since it can always be overloaded by any other part of any code for its specific needs |
09:04:53 | FromDiscord_ | <Skaruts> with a [T] like this: `template * [T](x: ptr T or ref T): var T = x[]`? |
09:08:22 | * | actuallybatman quit (Ping timeout: 245 seconds) |
09:16:16 | FromDiscord_ | <Skaruts> hmm, there's more to it than that though, something needs to be done about `foo[].bar` and `echo foo[]`, which that expression alone doesn't cover |
09:16:47 | * | MH026 joined #nim |
09:16:57 | FromDiscord_ | <Skaruts> the latter as `echo foo*` gives me an indentation error in the next line |
09:17:35 | FromDiscord_ | <Skaruts> but disregard this anyway, I'm fine with using `[]` for now, I was just curious about it |
09:21:38 | * | sammich quit (Ping timeout: 248 seconds) |
09:22:50 | * | sammich joined #nim |
09:22:50 | * | sammich quit (Changing host) |
09:22:50 | * | sammich joined #nim |
09:25:10 | * | crem quit (Ping timeout: 276 seconds) |
09:26:50 | * | crem joined #nim |
09:39:39 | leorize[m] | well anyone going for `foo^`? (pascal-style deref) |
09:40:54 | leorize[m] | it's easier to distinguish and doesn't have the problem of sharing precedence with `*` |
09:51:39 | * | laaron quit (Quit: ZNC 1.7.1 - https://znc.in) |
09:54:23 | * | laaron joined #nim |
10:09:53 | * | ng0 joined #nim |
10:12:40 | * | Senketsu joined #nim |
10:13:00 | Zevv | Hm I hardly ever deref explicitly, I'm not bothered by the occasional [] |
10:13:12 | * | stefanos82 joined #nim |
10:16:33 | * | Senketsu quit (Client Quit) |
10:20:07 | * | Perkol joined #nim |
10:20:49 | * | jjido joined #nim |
10:28:48 | * | Perkol quit (Remote host closed the connection) |
10:36:27 | * | shomodj joined #nim |
10:42:00 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
10:42:41 | * | shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
10:42:47 | FromDiscord_ | <kodkuce> who is timotheecour |
10:43:07 | FromDiscord_ | <kodkuce> i just now noticed he posted issue on my github 😃 |
10:44:55 | * | shomodj joined #nim |
10:47:34 | alexander92 | well, having an issue is great actually! |
10:49:03 | * | Senketsu joined #nim |
10:50:17 | * | jjido joined #nim |
10:50:30 | * | Senketsu quit (Client Quit) |
10:50:39 | FromGitter | <mratsim> the pascal deref would require postfix operator support |
10:50:54 | FromGitter | <mratsim> 1) is special cased for export marker, I don't tink deref is worth it |
10:52:23 | leorize[m] | personally I don't think there's a need for any deref ops other than `[]` |
10:52:27 | alexander92 | i like the pascal one |
10:52:28 | * | shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
10:53:27 | Zevv | how often do you actually *do* a deref explictly? objects are sugared for you, and scalars are seldom reffed. Mostly doing FFI I guess? |
10:54:09 | * | Senketsu joined #nim |
10:54:35 | FromGitter | <mratsim> I'm not asking for a new deref op, I'm asking for changing the deref op to "deref" instead of `[]` |
10:57:00 | leorize[m] | well `[]` works fine enough |
10:57:37 | leorize[m] | and it's not annoying to use when derefs are needed |
10:59:00 | FromGitter | <mratsim> My arguments are there: https://github.com/nim-lang/RFCs/issues/154 ⏎ ⏎ It's very annoying when building array libraries with varargs arguments |
11:01:39 | * | brakmic_ quit (Read error: Connection reset by peer) |
11:01:44 | FromGitter | <zacharycarter> @krux02 - do you think your AST pattern matching library could be extended to support NimScript's AST? |
11:01:50 | * | brakmic joined #nim |
11:04:15 | * | bozaloshtsh quit (Ping timeout: 250 seconds) |
11:05:49 | FromGitter | <mratsim> he is in vacation |
11:11:55 | * | Trustable joined #nim |
11:13:00 | FromGitter | <mratsim> So I was investigating a regression where my matrix multiplication lost 5.5x performance out of the blue (it was competitive with Intel and state-of-the-art implementation but in pure Nim with no assembly). Turns out the -d:danger flag is worth 5.5x perf. |
11:18:48 | * | PrimHelios_ quit (Quit: ZNC - https://znc.in) |
11:19:06 | * | PrimHelios joined #nim |
11:20:06 | * | pbb joined #nim |
11:24:30 | dom96 | Nim used to use the pascal deref |
11:24:45 | dom96 | it's better to keep it reserved for pow |
11:25:02 | * | sagax quit (Ping timeout: 258 seconds) |
11:26:43 | alexander92 | i often forgot nim started with pas2nim |
11:32:12 | * | couven92 joined #nim |
11:36:29 | * | Senketsu quit (Quit: WeeChat 2.5) |
11:46:18 | * | Senketsu joined #nim |
11:47:40 | pbb | Hi everyone, I recently started using nim and ran into an issue with calling closures from an asynchttpserver handler and the garbage collector |
11:48:34 | pbb | I have a reproducable example: https://termbin.com/jgco |
11:48:45 | pbb | code is at https://git.pbb.lc/petabyteboy/smartied |
11:50:01 | pbb | First I throught using threadvars might solve the problem by making all my code gcsafe. Now the compiler doesn't warn me about my functions not being gcsafe anymore, but it still crashes. |
11:51:16 | pbb | I am seeing the same issue with procedures called from an asyncdispatch setTimer callback |
11:51:25 | pbb | I mean addTimer |
11:53:11 | pbb | The crash happened from time to timer when the gc was running during the procedure call from the callback. |
11:53:41 | pbb | So I added an explicit GC_fullCollect call and it crashes reliably |
11:56:26 | * | Senketsu quit (Quit: WeeChat 2.5) |
12:01:53 | * | dddddd joined #nim |
12:02:21 | dom96 | pbb: you need to initialise your variables for each thread |
12:02:28 | * | Senketsu joined #nim |
12:02:32 | dom96 | threadvar means your var is thread-local |
12:02:42 | pbb | I only have on thread |
12:02:56 | pbb | and I have initialized the vars on the main thread in the respective modules using them |
12:03:02 | dom96 | then it should be fine, there must be some other reason that `server.state` is nil |
12:03:08 | dom96 | have you tried debugging that? |
12:03:39 | pbb | where do you see that server.state is nil? |
12:04:08 | dom96 | SIGSEGV: Illegal storage access. (Attempt to read from nil?) |
12:04:15 | dom96 | That usually means you're reading from nil |
12:04:29 | dom96 | https://git.pbb.lc/petabyteboy/smartied/src/branch/master/src/backend_powermeter.nim#L19 |
12:04:32 | dom96 | Points to server.state |
12:05:36 | pbb | sorry it seems like I did not commit everything properly |
12:06:07 | pbb | go there again |
12:06:22 | pbb | the line contains GC_fullCollect() |
12:06:45 | pbb | when it's commented the code works as excepted most of the time but randomly crashes when the GC kicks in |
12:10:05 | * | absolutejam3 joined #nim |
12:11:25 | pbb | @dom96 it crashes in a gc function. When I compile with --gc:markAndSweep, I get this: https://termbin.com/m0zu |
12:13:55 | * | leorize quit (Quit: WeeChat 2.3) |
12:14:06 | * | Senketsu quit (Quit: WeeChat 2.5) |
12:14:53 | dom96 | pbb, Interesting. Are you using 0.20.0? |
12:15:06 | dom96 | oh I see the version in the paths |
12:15:13 | pbb | I'm using a nightly build |
12:15:22 | pbb | because it fixes another issue that prevented compilation |
12:15:57 | pbb | (https://github.com/nim-lang/Nim/issues/11523) |
12:16:10 | * | noonien joined #nim |
12:16:25 | dom96 | Try compiling with -d:useSysAssert -d:useGcAssert |
12:16:27 | noonien | hello folks |
12:16:40 | dom96 | and report this on the issue tracker |
12:16:58 | dom96 | if you can, come up with a step-by-step reproduction of this |
12:16:59 | noonien | how can I read an entire utf-8 file into memory, as seq[Rune]? |
12:17:04 | dom96 | even if it involves cloning your project |
12:18:01 | pbb | yes I can come up with a reproduction example, I will include it in the report |
12:18:10 | pbb | using the parameters you mentioned makes it crash even earlier |
12:18:33 | pbb | https://termbin.com/tg70 |
12:19:59 | noonien | ah, `readFile().toRunes()`, would have been nice to minimise allocations |
12:28:27 | * | leorize joined #nim |
12:28:52 | dom96 | pbb, yeah, I think that should help Araq or someone else find the issue |
12:32:05 | * | Senketsu joined #nim |
12:37:58 | * | absolutejam3 quit (Ping timeout: 245 seconds) |
12:47:10 | * | Senketsu quit (Quit: WeeChat 2.5) |
12:48:18 | Araq | var data = [0u32] |
12:48:18 | Araq | mb.modbus_set_slave(cint(ad)) |
12:48:18 | Araq | let status = mb.modbus_read_input_registers(cint(reg), 2, data.addr) |
12:48:18 | Araq | let res = modbus_get_float_dcba(data.addr) |
12:48:30 | Araq | ^ passed ptr to stack location that escapes? |
12:58:54 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
13:03:31 | pbb | let me try to comment out all calls to the libmodbus functions |
13:03:35 | * | jjido joined #nim |
13:05:49 | * | Senketsu joined #nim |
13:10:17 | * | Senketsu quit (Client Quit) |
13:10:41 | pbb | @Araq: good point, I will have to change that, but it doesn't seem to be the cause for the crashes I am getting |
13:11:34 | * | Trustable quit (Remote host closed the connection) |
13:12:30 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
13:12:54 | * | Skaruts joined #nim |
13:14:58 | FromGitter | <mratsim> ugh modbus ... |
13:17:48 | pbb | :D |
13:19:09 | * | Senketsu joined #nim |
13:25:30 | Skaruts | @mratsim, that inheritance thing still works in two files |
13:25:46 | FromGitter | <mratsim> oh, interesting |
13:25:58 | Skaruts | I also instantiated the second derived type to be sure |
13:26:16 | Skaruts | I wonder if it works with a deeper inheritance tree |
13:26:17 | FromGitter | <mratsim> my experience is that it breaks at some point but maybe it was because I used generics type |
13:30:12 | Skaruts | http://ix.io/1Ou0/nim |
13:30:44 | * | jjido joined #nim |
13:31:39 | * | jjido quit (Client Quit) |
13:31:42 | * | alexander92 quit (Ping timeout: 245 seconds) |
13:33:41 | FromGitter | <mratsim> test is in file 3? :p |
13:33:59 | Skaruts | hmm, let me try that |
13:34:06 | * | jjido joined #nim |
13:34:29 | * | Senketsu quit (Quit: WeeChat 2.5) |
13:34:45 | * | sniffdtek quit (Remote host closed the connection) |
13:34:58 | * | sniffdtek joined #nim |
13:40:16 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
13:43:31 | pbb | thanks everyone I found the culprit. my reference to the modbus context was stored as a ref object, which the garbage collector was trying to touch I guess |
13:43:42 | pbb | changing the type to pointer solves the issue |
13:43:56 | disruptek | nice. |
13:44:55 | disruptek | i wonder if we can come up with a better way to identify that error case and provide a little more detail into what happened. |
13:45:22 | disruptek | do we know if pointers are foreign? |
13:46:17 | * | Perkol joined #nim |
13:46:42 | disruptek | feels technically impossible, but the compiler is a mysterious place. |
13:46:53 | pbb | what do you mean y foreign? |
13:46:57 | FromGitter | <mratsim> There used to be a feature that no one used that associated pointers to a memory region and prevented mixing them |
13:46:58 | pbb | *by |
13:47:04 | * | Perkol quit (Client Quit) |
13:47:14 | Skaruts | @mratsim so far so good, I have type Person in file 4, Woman in 3, Man in 2, and I instantiate both and they find their respective procs |
13:47:27 | * | jjido joined #nim |
13:47:32 | disruptek | how could you prevent the assignment of an "invalid" pointer when it's just an integer to twiddle at whim? |
13:47:47 | FromGitter | <mratsim> it was part of the type |
13:47:59 | * | brakmic quit (Read error: Connection reset by peer) |
13:48:33 | disruptek | is your modbus context a native nim object? i got the impression this was a c interop issue, but i didn't follow it closely. i just logged... |
13:48:37 | * | brakmic joined #nim |
13:49:22 | disruptek | mratsim: oh, so that was a special blessed pointer type? |
13:49:42 | disruptek | or was it an operator? |
13:50:02 | FromGitter | <mratsim> https://github.com/nim-lang/Nim/blob/v0.18.0/doc/manual/types.txt#L874-L889 |
13:50:28 | FromGitter | <mratsim> it was an annotation for ref and ptr types |
13:50:51 | FromGitter | <mratsim> I think you can reproduce most of the functionality with distinct types though |
13:50:58 | disruptek | i use my trackball so infrequently that every time i do, it delays a second or two while it resumes from sleep. 1st world problems. |
13:51:59 | disruptek | a distinct pointer type? if you could annotate that, then you could ensure it doesn't mix in the heap. |
13:52:34 | pbb | disruptek: my modbus context is a c struct |
13:52:42 | * | vlad1777d joined #nim |
13:53:16 | FromGitter | <mratsim> I use distinct pointer to differentiate between pointers coming from an immutable view and coming from a mutable view: https://github.com/numforge/laser/blob/master/laser/tensor/datatypes.nim#L13-L14 |
13:53:32 | FromGitter | <mratsim> and avoid mutation by accident. |
13:53:43 | * | Senketsu joined #nim |
13:54:14 | disruptek | yeah, so it's a pointer to a c value. just wondering if the compiler is smart enough to know the difference. |
13:54:41 | disruptek | i'm just not convinced that it's technically possible, given the necessary semantics of a pointer. |
13:55:46 | FromGitter | <mratsim> my distinct pointers work if you're talking to me, I didn't define a proc that allows mutation for the immutable view: https://github.com/numforge/laser/blob/master/laser/tensor/datatypes.nim#L104-L111 |
13:56:04 | FromGitter | <mratsim> and it's tested: https://github.com/numforge/laser/blob/master/tests/test_tensor_immutability.nim#L15 |
14:00:29 | * | Senketsu quit (Quit: WeeChat 2.5) |
14:01:58 | disruptek | i don't get it; what does this have to do with differentiating between pointers to foreign code objects and object we've created in our gc? i mean, how does this problem even manifest? |
14:02:03 | * | __Myst__ left #nim ("WeeChat 2.5-dev") |
14:03:15 | FromGitter | <mratsim> you can always create a distinct type for pointers to forein object with a restricted set of proc. |
14:04:02 | disruptek | yeah, but that's closing the barn doors behind the horse. we're talking about a way to detect this issue before it happens and warn about it at compile time. |
14:04:08 | * | dwdv left #nim ("User left") |
14:06:46 | disruptek | to put this another way, i feel like the gc shoulda known better. |
14:09:05 | Zevv | rayman22201: https://github.com/zevv/Nim/commits/zevv-events |
14:10:12 | Zevv | not really happy, but it seems to be the most obvious way to go. io selector now passes a uint64 id through trigger() and poll(), which ends up in ReadyKey. (only implemented for epoll for now). |
14:11:41 | Zevv | Asyncdispatch only creates one global SelectEvent and each AsyncEvent gets an unique ID. Triggering the asyncEvent triggers the selectEvent with the unique ID, and the async runOnce then calls the proper callback. I made a new callback type because the fd makes no sense there |
14:15:03 | * | Senketsu joined #nim |
14:21:31 | * | Senketsu quit (Quit: WeeChat 2.5) |
14:27:36 | Araq | ping Zevv |
14:28:53 | Zevv | here |
14:29:07 | Zevv | but traveling, so on and off |
14:30:03 | Cadey | is there an automatic formatting tool for Nim? |
14:30:36 | lqdev[m] | yes, nimpretty |
14:33:29 | Araq | Zevv: please take a look: https://ci.appveyor.com/project/dom96/nim/builds/25884387/job/cmfhjt0ugx4087pa/tests |
14:33:38 | Araq | is 'Inst' a ref type? |
14:33:52 | Araq | (or does it contain a 'ref') |
14:36:49 | Zevv | is contains a NimNode, is that a ref? |
14:36:58 | Zevv | cant check now on mobile |
14:36:59 | lqdev[m] | yes |
14:37:05 | Zevv | there you have it |
14:37:08 | lqdev[m] | NimNode = ref NimNodeObj |
14:37:24 | Zevv | right. why does your test break, is that newruntime? |
14:40:09 | Araq | I fixed a bug :P |
14:40:22 | Araq | and now the compiler is picky about 'const' |
14:41:19 | Zevv | hm it doesnt need to be const, let should be fine |
14:41:26 | Zevv | Ill change when I get home |
14:42:24 | * | Vladar joined #nim |
14:43:06 | Zevv | the nimnode is in a variant branch that is not used be the const though, does that matter? |
14:46:19 | dom96 | Zevv: oh cool, you've made async event use less FDs? |
14:49:26 | * | gangstacat quit (Ping timeout: 252 seconds) |
14:52:11 | * | Senketsu joined #nim |
14:52:26 | Zevv | tried to. But it's a prickly business, some legacy stuff making things not so nice |
14:53:52 | dom96 | A good approach might be to do it in a similar way to sleepAsync vs. addTimer |
14:54:12 | dom96 | where addTimer creates an fd, whereas sleepAsync uses a lightweight mechanism that is handled by the dispatcher |
14:54:40 | * | gangstacat joined #nim |
14:55:00 | Zevv | it is pretty lightweight now I guess, take a look at my branch and description, does that make sense? |
14:55:58 | Zevv | @Araq: hmm, if I drop the const npeg can't make compile time parsers anymore... |
14:57:35 | * | Senketsu quit (Quit: WeeChat 2.5) |
14:59:47 | * | MH026 quit (Remote host closed the connection) |
14:59:50 | disruptek | Zevv: is that really important? 🙄 |
15:00:22 | Zevv | it's a nice feature, imho |
15:00:34 | disruptek | agree; i'm just teasing. :-P |
15:01:28 | disruptek | i'm sure araq has 3-4 alternatives teed up. |
15:01:48 | Zevv | hm I'm not sure how to fix this. I use NimNode to pass a code block around, no idea how to do this any other way. ideas? |
15:03:30 | Zevv | oh look, I fixed it :) |
15:03:42 | disruptek | ? |
15:05:00 | Zevv | I had a const table with things that were built at const time. I now defer the building of things to a later moment. Still at compile time, but that does work |
15:05:14 | dom96 | bah, when you add `if true: quit()` into httpclient for testing, and then 3 days later wonder why your programs stop working... |
15:05:31 | FromGitter | <rtnlmeme-DestroyerOfDeath> hi, newcomer here. With choosenim, I installed "stable" just fine. But when I try to install "devel" I run into this: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5d2b44bb54d338393706c4cb] |
15:05:49 | disruptek | ouch, been there, but with a microservice. *facepalm* |
15:06:31 | dom96 | @rtnlmeme-DestroyerOfDeath guessing devel is broken. Araq? |
15:06:53 | FromGitter | <mratsim> there is a quit somewhere in the VM if you try to access a variant field from the wrong kind .... |
15:07:37 | disruptek | surely someone here has commit. |
15:09:05 | Zevv | @Araq: npeg is fixed for araq-fixes-5870 |
15:09:53 | Zevv | dom96: I'll discuss and rework the async stuff with rayman22201, if we both agree we'll ask you for a review, is that ok with you? |
15:10:01 | dom96 | sure |
15:10:14 | Zevv | sweet |
15:10:35 | dom96 | Please make my job easier though and make the PR(s) as small as possible :) |
15:11:09 | Zevv | there's always a tradeoff. Small PRs are nice, but sometimes refactoring stuff is nice too. |
15:11:31 | Zevv | There's also a bug in the epoll selector event handling imho. It uses eventfd(), but does not check how many times it has been written |
15:11:39 | Zevv | so it drops events |
15:12:33 | Araq | dom96: oh hmm |
15:12:52 | * | lritter joined #nim |
15:15:09 | Araq | try again |
15:15:45 | Araq | Zevv: bah that sucks though, I can make Nim smarter about NimNode instead |
15:16:49 | Zevv | well, I'm fine for now, I just moved some small thing around and all is ok |
15:17:10 | Zevv | just pushed new nimble version 0.12 with fix |
15:20:33 | * | vlad1777d quit (Ping timeout: 248 seconds) |
15:21:41 | * | Senketsu joined #nim |
15:22:46 | * | Skaruts quit (Remote host closed the connection) |
15:23:53 | dom96 | hrm, i'm seeing this really strange bug with Table.clear(). Where I am effectively doing: let copy = myTable; myTable.clear; for key, val in copy. And the iterator doesn't iterate over the values, it's as if the copy was also cleared but I checked the len and it hasn't changed. |
15:25:07 | disruptek | maybe the new code that turns off mutability for unsafe table ops? what type of table? |
15:29:14 | * | dankrad joined #nim |
15:29:20 | * | Senketsu quit (Quit: WeeChat 2.5) |
15:32:39 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
15:33:10 | dankrad | hi, how can i call a `$` proc from a specific module? I'm getting an ambiguous call error. I've tried modulname.$(value) and modulename.`$`(value). |
15:33:34 | FromGitter | <mratsim> that should work |
15:33:49 | FromGitter | <mratsim> the last one |
15:35:47 | dankrad | The last one gives me (im using winim): undeclared identifier: 'winstr'. My code snippet: winstr.`$`(process.szExeFile) |
15:36:55 | dankrad | ohh, sorry. i forgot to import winstr o.O |
15:37:01 | dankrad | ;) |
15:37:15 | dankrad | but thanks anyway mratism : ) |
15:37:22 | * | alexander92 joined #nim |
15:44:06 | rayman22201 | @Dom96 the reason @Zevv is doing this asynFD thing is because the flowVar PR exposed a bug. It won't pass the CI tests because flowVar creates a new asyncEvent for every spawn, and thus a new FD for every spawn. If you have a lot of spawns it quickly eats up all the FDs on your system. |
15:45:12 | * | laaron quit (Quit: ZNC 1.7.1 - https://znc.in) |
15:45:17 | dom96 | rayman22201, yeah, I skimmed the convo |
15:45:42 | dom96 | Maybe we could create the async event only when the callback is set? |
15:45:54 | dom96 | we should probably do this anyway to be honest |
15:46:02 | rayman22201 | Ok cool. Just making sure you were up to date. 😁 |
15:46:25 | * | laaron joined #nim |
15:46:50 | * | Senketsu joined #nim |
15:47:27 | rayman22201 | I agree. It's technically a feature, but it can also be seen as a terrible resource leak. |
15:47:42 | dom96 | it's yet another allocation |
15:47:56 | dom96 | doing it only when await is called would be better |
15:49:59 | rayman22201 | How can we know? |
15:50:21 | dom96 | when await is called the callback is set |
15:53:45 | * | dankrad quit (Ping timeout: 258 seconds) |
15:55:33 | rayman22201 | So override the setter in the flowVar |
15:56:33 | Zevv | makes sense |
15:58:35 | Zevv | is cheatfate on irc? |
16:00:38 | rayman22201 | Lol. @Zevv, reading your capde. the global FD is basically what I suggested yesterday 😜 |
16:01:18 | rayman22201 | S/capde/code/ |
16:02:35 | * | jjido joined #nim |
16:03:15 | rayman22201 | You meh, but I told you so 😆 |
16:03:44 | rayman22201 | Joking aside, I think it looks good. We should continue with the other poll impls |
16:04:51 | rayman22201 | bbl |
16:05:36 | * | dankrad joined #nim |
16:12:12 | * | dankrad quit (Quit: Lost terminal) |
16:16:28 | * | Senketsu quit (Quit: WeeChat 2.5) |
16:20:12 | Zevv | Me not meh, me bah |
16:38:39 | * | sagax joined #nim |
16:47:50 | * | Senketsu joined #nim |
17:10:44 | * | kungtotte quit (Quit: WeeChat 2.5) |
17:18:09 | * | Senketsu quit (Quit: WeeChat 2.5) |
17:29:30 | * | laaron quit (Remote host closed the connection) |
17:30:01 | * | Senketsu joined #nim |
17:32:07 | * | laaron joined #nim |
17:37:07 | * | Senketsu quit (Quit: WeeChat 2.5) |
17:41:10 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
17:50:42 | * | actuallybatman joined #nim |
17:54:39 | FromGitter | <ratiotile> I'm getting a type mismatch: `proc `+`*T; Scale: static[cint (this: Point[T, Scale], p: Point[T, Scale])` called with `Pointcint, POSITION_SCALE (x:1, y:2) + Pointcint, POSITION_SCALE (x:1, y:0)` |
17:57:37 | FromGitter | <ratiotile> simplified: `Pointtypedesc[int (x:1, y:2) + Pointtypedesc[int (x:1, y:0)` |
17:59:25 | FromGitter | <ratiotile> required type: Point[+.T, +.Scale] but expression 'Pointcint, 1 (x: 1, y: 2)' is of type: Point[system.cint, 1] |
18:03:33 | * | Senketsu joined #nim |
18:04:48 | FromGitter | <ratiotile> trying to wrap: `Point<T, Scale> operator + (const Point<T, Scale> &p) const` |
18:05:31 | * | Senketsu quit (Client Quit) |
18:09:05 | * | Senketsu joined #nim |
18:13:58 | FromGitter | <ratiotile> here's a small reproduction : https://pastebin.com/X3MbmM9j |
18:14:11 | * | Swedneck2 is now known as Swednec6 |
18:14:42 | * | Swednec6 is now known as Swednec8 |
18:18:47 | * | huuskes joined #nim |
18:20:31 | Araq | https://github.com/nim-lang/Nim/issues/7209 is the bug |
18:21:38 | FromGitter | <ratiotile> Good to know, so copy+paste wrapping it is! |
18:32:11 | * | Senketsu quit (Quit: WeeChat 2.5) |
18:33:33 | FromGitter | <ratiotile> Shouldn't this `proc `==`*T: Position|WalkPosition|TilePosition (this, pos: T): bool ` be more specific than the builtin op ==? It gives me ambiguous error |
18:35:39 | FromGitter | <ratiotile> never mind, i got it: `proc `==`*(this, pos: Position|WalkPosition|TilePosition): bool ` |
19:04:58 | * | Senketsu joined #nim |
19:07:59 | * | Senketsu quit (Client Quit) |
19:11:11 | * | natrys joined #nim |
19:20:03 | * | Senketsu joined #nim |
19:23:42 | * | kungtotte joined #nim |
19:24:31 | * | absolutejam3 joined #nim |
19:25:17 | * | Senketsu quit (Quit: WeeChat 2.5) |
19:28:19 | * | Senketsu joined #nim |
19:30:43 | * | Senketsu quit (Client Quit) |
19:31:26 | * | nsf quit (Quit: WeeChat 2.4) |
19:35:32 | * | Senketsu joined #nim |
19:40:11 | * | Senketsu quit (Client Quit) |
19:49:32 | * | laaron- joined #nim |
19:50:23 | * | laaron quit (Quit: ZNC 1.7.1 - https://znc.in) |
19:52:10 | * | kungtotte quit (Quit: WeeChat 2.5) |
19:53:04 | * | kungtotte joined #nim |
19:57:10 | * | absolutejam4 joined #nim |
19:57:58 | * | absolutejam3 quit (Ping timeout: 268 seconds) |
20:01:24 | * | Senketsu joined #nim |
20:04:38 | * | Senketsu quit (Client Quit) |
20:15:32 | * | narimiran_ joined #nim |
20:16:29 | * | narimiran_ quit (Remote host closed the connection) |
20:17:40 | * | narimiran quit (Ping timeout: 246 seconds) |
20:18:27 | * | jjido joined #nim |
20:19:13 | * | brakmic quit () |
20:35:34 | * | PMunch joined #nim |
20:47:11 | * | Senketsu joined #nim |
20:55:38 | * | shomodj joined #nim |
21:00:34 | * | shomodj quit (Ping timeout: 272 seconds) |
21:03:20 | * | shomodj joined #nim |
21:09:31 | * | sniffdtek quit (Remote host closed the connection) |
21:13:12 | * | Vladar quit (Remote host closed the connection) |
21:16:31 | * | sniffdtek joined #nim |
21:18:55 | FromGitter | <zacharycarter> Will deques in the future not need to be initialized (like tables and sequences)? |
21:26:55 | Araq | sure, was an oversight |
21:27:23 | * | solitudesf quit (Ping timeout: 268 seconds) |
21:28:21 | PMunch | How was that implemented by the way? Compiler magic, or just some checks to ensure that a completely null element would be treated correctly? |
21:35:51 | * | shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
21:35:52 | * | matti quit (Quit: Reconnecting) |
21:36:05 | * | matti joined #nim |
21:36:06 | * | matti quit (Changing host) |
21:36:06 | * | matti joined #nim |
21:44:24 | PMunch | Hmm http://ix.io/1OwF |
21:46:26 | PMunch | This issue is really annoying.. |
21:55:43 | * | matti quit (Quit: Oh dear ...) |
21:56:39 | * | matti joined #nim |
21:57:01 | FromGitter | <zacharycarter> cool! |
21:57:33 | * | sniffdtek quit (Remote host closed the connection) |
21:57:43 | FromGitter | <zacharycarter> got a lot done today - got a terrain shader written and I started actually buffering vertex data :D hopefully by tomorrow I can actually draw something to the screen besides GUI stuff |
21:59:42 | Araq | PMunch, just some checks added |
21:59:43 | dom96 | heh, looks like I underestimated how much using JSON for a real-time multiplayer game would cost |
21:59:53 | dom96 | This is where all my perf was going |
22:00:58 | PMunch | Okay cool, so the same idea can be applied to any data structure :) |
22:01:08 | * | absolutejam4 quit (Ping timeout: 244 seconds) |
22:01:13 | FromGitter | <zacharycarter> could check out WebRTC |
22:01:32 | dom96 | JSON is the problem, not websockets |
22:01:46 | dom96 | but yeah, WebRTC is an option |
22:01:56 | PMunch | What are you using the JSON for? |
22:01:57 | FromGitter | <zacharycarter> well I mean - what else are you going to use? msgpack or something? |
22:02:14 | PMunch | Maybe protobuf could help? |
22:03:19 | FromGitter | <zacharycarter> it will probably help - but how much is the question |
22:03:27 | dom96 | WebRTC is just a transport, no? |
22:03:47 | dom96 | It will help a lot. Currently I'm literally using `$(%msg)` |
22:04:00 | dom96 | Which means I allocate JsonNode's + strings |
22:04:10 | dom96 | which sucks a lot for performance |
22:04:35 | FromGitter | <zacharycarter> yes it's just a transport - but I imagine it's magnitudes faster than websockets if you use something like - http://w3c.github.io/webrtc-pc/#peer-to-peer-data-api |
22:05:05 | dom96 | I'd have to implement a webrtc server though |
22:05:09 | FromGitter | <zacharycarter> yeah |
22:05:11 | dom96 | websockets should do |
22:05:35 | FromGitter | <zacharycarter> I mean other people use websockets for multiplayer games so I imagine you should be able to as well |
22:05:37 | dom96 | That would be a good option if I get sick of the websockets package though :) |
22:05:47 | dom96 | I won't have to reinvent the wheel |
22:06:07 | FromGitter | <zacharycarter> http://buildnewgames.com/optimizing-websockets-bandwidth/ - might be a good article |
22:06:10 | dom96 | surprisingly webrtc has good web browser support too |
22:06:34 | dom96 | I might implement thrift or something |
22:06:56 | dom96 | (Mainly because FB uses it internally a lot so it would be nice to support it first class) |
22:09:24 | * | natrys quit (Ping timeout: 244 seconds) |
22:19:21 | Araq | dom96: try packedjson? |
22:21:34 | dom96 | yeah, I'll try that |
22:21:50 | dom96 | I don't want to send this data with JSON in the long run though anyway |
22:23:01 | * | natrys joined #nim |
22:25:19 | * | natrys quit (Client Quit) |
22:25:57 | * | abm joined #nim |
22:34:59 | FromGitter | <Obround> In Nim, is there someway you can access a variable before it is assigned (forward deceleration for variables)? |
22:43:50 | * | abm quit (Read error: Connection reset by peer) |
22:49:32 | PMunch | Obround, what would that look like? |
22:50:51 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
22:53:10 | FromGitter | <Obround> Like this: |
22:53:25 | * | disruptek quit (Ping timeout: 246 seconds) |
22:54:11 | FromGitter | <Obround> Like this: ⏎ ⏎ ```var x = 0 ⏎ echo x ⏎ x = 10``` ⏎ ⏎ The output should be `10` [https://gitter.im/nim-lang/Nim?at=5d2bb29354d338393709dc6e] |
22:54:12 | * | disruptek joined #nim |
23:03:59 | PMunch | Uhm.. |
23:04:07 | PMunch | And what do you plan on using this for? |
23:05:07 | PMunch | I guess it would be possible to implement something like that.. |
23:24:13 | FromGitter | <Obround> <PMunch> -- Just a little project ;) |
23:24:28 | PMunch | Sounds like a weird design decision :P |
23:24:36 | PMunch | Would create some really interesting bugs |
23:24:42 | FromGitter | <Obround> Yea |
23:25:06 | PMunch | So by default it's not possible. But with metaprogramming you can definitely do something like that |
23:25:24 | FromGitter | <Obround> Could you give an example? |
23:25:42 | PMunch | Well I'm still not 100% what behaviour you'd want |
23:25:55 | PMunch | var x: int; echo x; x = 10; x = 20 |
23:26:03 | PMunch | What would it output in this case for example? |
23:26:26 | FromGitter | <Obround> It would output 20 |
23:26:32 | FromGitter | <Obround> or 10 |
23:26:47 | FromGitter | <Obround> I didn't think of that... |
23:26:53 | PMunch | Haha :P |
23:26:56 | FromGitter | <Obround> :D |
23:28:12 | FromGitter | <Obround> Maybe there could be something like Python's global statement... |
23:28:18 | PMunch | I meany you could use defer to do something like that: https://play.nim-lang.org/#ix=1OwV |
23:28:42 | PMunch | But that just moves the echo x to the end of the procedure body |
23:29:01 | FromGitter | <Obround> hmm... |
23:30:13 | PMunch | How would this be anything like a Python global? |
23:30:20 | PMunch | And Nim already has global variables.. |
23:36:55 | FromGitter | <Obround> I wasn't 100% sure of what python's global statement did... |
23:37:47 | FromGitter | <Obround> I was 80% sure it was something like a forward deceleration. |
23:37:57 | FromGitter | <Obround> :) |
23:38:22 | FromGitter | <Obround> .. |
23:42:22 | PMunch | Oh no, it's just a way to access global variables |
23:49:00 | FromGitter | <ratiotile> Having trouble getting the value out of an std::iterator ⏎ `proc `[]`*T (this: ListIter[T]): T {.importcpp: "(*#)", header: "<iterator>".}` |
23:49:56 | FromGitter | <ratiotile> `Error: expression 'it[]' has no type (or is ambiguous)` |