00:00:01 | FromDiscord_ | <Shield> can you use pointers with seqs and strings or they have to be reimplemented for the manual memory management? |
00:05:05 | FromGitter | <zetashift> what a nice read Cadey |
00:05:28 | * | faiXX quit (Ping timeout: 245 seconds) |
00:07:32 | * | faiXX joined #nim |
00:09:49 | Cadey | zetashift: i'm currently writing up a longer "Jester: The Missing Manual" post too |
00:10:27 | FromGitter | <zetashift> I haven't done any web stuff with Nim except what was mentioned in the book, so I'm looking forward to that post then! :D |
00:14:44 | * | dddddd quit (Read error: Connection reset by peer) |
00:18:59 | * | laaron quit (Quit: ZNC 1.7.1 - https://znc.in) |
00:19:34 | * | laaron joined #nim |
00:22:40 | * | laaron quit (Remote host closed the connection) |
00:24:36 | * | seni quit (Quit: Leaving) |
00:24:46 | shashlick | @Shield have to be reimplemented |
00:25:07 | * | laaron joined #nim |
00:25:12 | shashlick | See my poor man's shared string and seq |
00:25:15 | shashlick | https://github.com/genotrance/shared |
00:28:56 | FromDiscord_ | <Shield> ouch, that means you have to ditch stdlib for most parts |
00:29:52 | * | a_chou joined #nim |
00:29:55 | * | a_chou quit (Remote host closed the connection) |
00:30:16 | * | a_chou joined #nim |
00:35:23 | rayman22201 | https://github.com/nim-lang/Nim/blob/devel/lib/core/strs.nim#L48 |
00:35:23 | rayman22201 | why is this "when not defined(nimV2)" ? shouldn't it be the other way around? |
00:38:11 | * | sealmove quit (Quit: WeeChat 2.5) |
00:41:57 | * | krux02_ quit (Remote host closed the connection) |
00:44:35 | shashlick | @Shield ya, but shared could be expanded to be backed with alloc instead of allocShared and have all functionality over time |
00:45:17 | shashlick | Right now it is very inefficient but it's only 300 times slower with copies gallore |
00:46:22 | shashlick | I don't really know why seq and string are built into the compiler itself but I suspect it is because it needs them so might as well use the same implementation |
00:46:45 | rayman22201 | you could hack your own fork of https://github.com/nim-lang/Nim/blob/devel/lib/core/allocators.nim |
00:47:13 | rayman22201 | that's probably a terrible idea though |
00:48:02 | rayman22201 | It might not be a bad idea to allow seqs and strings to allow a custom allocator to be passed to them. They support it, but it's not really exposed. |
00:48:15 | FromDiscord_ | <Shield> I was looking into the core files |
00:49:19 | FromDiscord_ | <Shield> totally, I expressed later that it would be really helpful to pass custom allocators to all objects in general, that way you wouldn't have to reimplement most things |
00:49:24 | FromDiscord_ | <Shield> earlier* |
00:56:08 | rayman22201 | For your own custom objects, you can already support custom allocators pretty easily already. It's only Seq and Strings that are problematic b/c they are so integrated into the compiler. |
00:56:47 | FromDiscord_ | <Shield> NimStrPayload and NimSeqPayload already have an allocator field |
00:57:24 | rayman22201 | exactly. that's what I meant when I said strings and seqs already support it, it's just not exposed. |
01:00:16 | FromDiscord_ | <Shield> wouldn't exposing them help the language to be more modular and easier to deal with? better than getting locked out of stdlib when you can just give it your own allocator and it just works |
01:00:59 | rayman22201 | I agree. you should tell Araq :-P |
01:04:02 | * | faiXX quit (Ping timeout: 258 seconds) |
01:04:23 | FromDiscord_ | <Shield> I did :v |
01:04:46 | rayman22201 | what did he say? lol |
01:05:44 | FromDiscord_ | <Shield> just use newruntime ... |
01:05:52 | * | faiXX joined #nim |
01:06:14 | rayman22201 | He isn't wrong per say... |
01:06:33 | FromDiscord_ | <Shield> wouldn't this also fixes dlls without even having to use nimrtl? |
01:07:22 | rayman22201 | newruntime will also fix dlls |
01:07:30 | rayman22201 | newruntime does not require nimrtl |
01:08:41 | FromDiscord_ | <Shield> I'm just sitting watching those high priority issues and bugs of newruntime and it's hard to commit to it, those bugs somehow manage to affect the stuff I may need |
01:09:02 | FromDiscord_ | <Shield> doesn't newruntime still rely on ref counting for some parts? |
01:09:26 | rayman22201 | Well, even Rust doesn't let you define custom allocators for stdlib containers. (only on a global basis). |
01:10:54 | rayman22201 | newruntime does rely on some ref counting, yes, but it's local to the ref. It's more like the way swift does it. It's not a global GC. (which is what nimrtl is) |
01:10:54 | shashlick | Well if you use custom allocators, aren't you still dealing with the gc |
01:11:07 | shashlick | I agree newruntime is the better answer |
01:12:18 | rayman22201 | if you use custom allocators you do what ever you want. You can bypass the gc, or implement your own gc if you want. A GC is a type of allocator in the abstract sense. |
01:14:13 | shashlick | Ok |
01:16:49 | FromDiscord_ | <Shield> exposing a custom allocator api will clean a lot of the code so you don't have to go chasing for conditional branches all over the place, it's not like newruntime will replace GCs in 1.0, wouldn't that lead splitting libraries for an already small community? |
01:18:41 | rayman22201 | I think it will be worse. You are taking the burden out of the compiler and putting the burden onto the user. The problem with using custom allocators on the object level, instead of globally, is that it infects all the api's. This is why languages like C++ and Zig take an allocator argument everywhere, and you have to always worry about which thing is using which allocator. It's performant but messy. |
01:20:53 | * | owl_000 quit (Ping timeout: 245 seconds) |
01:21:10 | rayman22201 | It will make Nim more like C++. This is a bad thing IMO. I want Nim to be more like Rust in this regard. |
01:21:25 | FromGitter | <iffy> Is there a way to call a proc that may/may not return a Future such that you always get a Future back? |
01:22:39 | rayman22201 | relevant blog post lol: https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/ |
01:22:53 | FromGitter | <iffy> Like Python Twisted's maybeDeferred or JavaScript's Promise.resolve(...) |
01:23:15 | rayman22201 | How can a function "may/may not" return a Future? Nim is statically typed. It must always return a single type. |
01:25:12 | rayman22201 | We have Promise.resolve(). It's https://nim-lang.github.io/Nim/asyncfutures.html#complete%2CFuture%5BT%5D%2CT |
01:25:13 | FromGitter | <iffy> oh, I guess I can't have Table[int, proc():(string|Future[string])] |
01:26:39 | FromGitter | <iffy> JS `Promise.resolve(5)` will make a new Promise with the value of 5 already ready in it. |
01:27:26 | FromGitter | <iffy> but alas, I can't have a table with procs that return one or the other, seems like |
01:27:31 | FromDiscord_ | <Shield> I see people starting to complain about Rust like they used to complain about C++ so I don't trust it much, I just want simplicity and control when I need to, but without having to ditch stdlib and any library that depends on it |
01:27:32 | FromGitter | <iffy> so nevermind |
01:27:33 | rayman22201 | @iffy, you really want `Table[int, proc():(Future[string])]`. Yeah. You have to do it in two steps in Nim. You make the Future, and then call `myFuture.complete(5)` |
01:28:14 | FromGitter | <iffy> I was hoping to accept procs of either "color" |
01:28:24 | FromGitter | <iffy> oh well |
01:28:48 | rayman22201 | right, you can't really. Async / Futures "infect" your api in this way. |
01:29:06 | rayman22201 | But this is true in Javascript as well |
01:29:22 | rayman22201 | it's just more obvious in Nim because of the static typing |
01:29:31 | FromGitter | <iffy> right |
01:29:44 | FromGitter | <iffy> Same in Twisted |
01:30:16 | rayman22201 | You can work around it easily by just creating a Future and immediately `completing` the Future. |
01:30:40 | FromGitter | <iffy> Yeah, that's what I'll end up doing. Though I'm now thinking about error handling... |
01:31:11 | FromGitter | <iffy> For instance, if I call an {.async.} proc, I can be sure I'll get a Future back even if there's an exception within the proc |
01:31:17 | FromDiscord_ | <Shield> @shashlick did you rewrite your plugin system for newruntime yet? |
01:31:40 | FromGitter | <iffy> But if the function merely returns a Future (and isn't {.async.}), then it's possible that the function could raise an exception before returning the Future |
01:32:57 | FromGitter | <iffy> At least, that's how I imagine it works |
01:33:01 | rayman22201 | @iffy you can make a function {.async.} even if it returns the result immediately |
01:33:37 | rayman22201 | then you get the exception handling from the {.async.} macro for free |
01:33:41 | FromGitter | <iffy> right; but I'm collecting a bunch of procs and the only requirement (compile-time enforced) is that it returns a Future[string] |
01:33:49 | FromGitter | <iffy> I can't enforce that the proc is {async} |
01:33:53 | FromGitter | <iffy> or wait... maybe I can? |
01:34:57 | FromGitter | <iffy> nope, `procs*: Table[string, (proc():Future[string] {.async.})]` doesn't seem valid |
01:40:40 | FromGitter | <iffy> Yeah, these two procs have different error handling, but they both return Futures: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5d672d18c8228962ace0d2ec] |
01:43:59 | rayman22201 | @shield I don't have a good answer. I will say,*most* people will use asyncdispatch or chronos, and not build Futures by hand. And if they are building Futures by hand, they should know what they are doing, including how to handle errors with Futures. |
01:44:05 | rayman22201 | @iffy I mean |
01:44:11 | rayman22201 | lol, sorry. freudian slip |
01:44:30 | rayman22201 | @shield cares about memory, not async :-P |
01:44:34 | FromGitter | <iffy> :) |
01:45:45 | FromGitter | <iffy> I'd love to limit the "should know what they are doing" to "aren't allowed to by the compiler." Because more often than not, *I'm* the one who should know what I'm doing but accidentally do it wrong. |
01:46:11 | FromGitter | <iffy> All the code I'm writing right now is only going to be used by me |
01:46:33 | rayman22201 | then you can easily verify that you never generate Futures by hand :-P |
01:46:43 | FromGitter | <iffy> hehehe |
01:46:48 | * | FromGitter * iffy deletes a bunch of code |
01:46:54 | rayman22201 | lol |
01:56:20 | rayman22201 | @shield I'm not defending Rust, but they obviously did some things right. I do think that you are the perfect audience for newruntime. I think you should dive in and try it. Nobody wants to be the guinea pig, but your feedback on newruntime would be invaluable. |
01:58:54 | FromDiscord_ | <me2beats> Any ideas guys, I'm trying to build Hello world to Android (with Windows) https://github.com/yglukhov/nimx/issues/368#issuecomment-525988523 |
02:00:59 | FromDiscord_ | <Shield> does it work with csfml bindings or at least sdl's? I may grab a nightly build and see how it goes |
02:02:36 | FromDiscord_ | <me2beats> How to check it? Sorry I'm really new to nim |
02:05:47 | * | a_chou quit (Remote host closed the connection) |
02:06:06 | * | a_chou joined #nim |
02:07:13 | FromDiscord_ | <Shield> sorry that was to rayman22201 |
02:07:38 | FromDiscord_ | <me2beats> oh ok |
02:08:35 | rayman22201 | oh, lol. I don't know. You are the guinea pig @Shield But we appreciate your efforts :-) |
02:10:47 | FromDiscord_ | <Shield> lol |
02:11:24 | rayman22201 | @me2beats. I don't understand your problem. Everything works when you copy the SDL2.dll to the same folder as the exe? |
02:11:58 | rayman22201 | Yuri, the author of that lib is occasionally in this irc channel, but he is probably sleeping now |
02:13:51 | FromDiscord_ | <Shield> he's compiling to android |
02:14:20 | FromDiscord_ | <Shield> I actually didn't manage to compile for android on windows, the sdk is a shitshow |
02:16:26 | FromDiscord_ | <me2beats> yes that's right, compiling to windows is ok (it seems), but when I try to compile it to Android, I have errors |
02:16:44 | rayman22201 | It's been years since I've done any android :-/ |
02:16:46 | * | laaron quit (Remote host closed the connection) |
02:17:02 | rayman22201 | what are the errors you get when compiling for Android? |
02:17:32 | FromDiscord_ | <me2beats> Error: cannot open 'main.nim' Hint: widestrs [Processing] Hint: io [Processing] Hint: main [Processing] Error: cannot open 'main.nim' Hint: widestrs [Processing] ... |
02:17:58 | rayman22201 | what nim version are you using? |
02:18:02 | FromDiscord_ | <me2beats> and finally every time nakefile.exe reports abnormal shutdown |
02:18:18 | FromDiscord_ | <me2beats> The current version |
02:18:38 | rayman22201 | you have to be more specific? nightly, 0.20.2, 0.19.6? |
02:18:58 | rayman22201 | at a command prompt do nim -v |
02:19:38 | * | actuallybatman quit (Ping timeout: 268 seconds) |
02:19:52 | rayman22201 | leave it to Yuri to support Nake all on his own... everybody else has moved on to Nimble. |
02:20:18 | * | laaron joined #nim |
02:20:54 | FromDiscord_ | <me2beats> 0.20.2 |
02:21:09 | * | darithorn quit (Read error: Connection reset by peer) |
02:24:04 | FromDiscord_ | <me2beats> `everybody else has moved on to Nimble.` can I moved on to nimble too?:) I mean I just want to make some hello world app work on Android |
02:24:27 | rayman22201 | sure, don't use nimx :-P |
02:24:49 | rayman22201 | try the nightly build |
02:25:06 | rayman22201 | there was some windows path issues that were fixed recently I believe |
02:25:27 | rayman22201 | How did you install Nim? |
02:26:08 | FromDiscord_ | <me2beats> From official site |
02:26:23 | rayman22201 | in fact, he says right in the readme: "Nimx is tested only against the latest devel version of Nim compiler. " |
02:27:32 | rayman22201 | ok. Try this version instead: https://github.com/nim-lang/nightlies/releases/tag/2019-08-28-devel-20dec10 |
02:28:14 | rayman22201 | just remove the old nim folder, and reinstall using that version. |
02:30:19 | FromDiscord_ | <me2beats> Ok I'll try to install devel, thanks |
02:31:23 | rayman22201 | cool :-) |
02:37:12 | * | endragor joined #nim |
02:39:46 | * | go|dfish quit (Ping timeout: 276 seconds) |
02:40:34 | * | go|dfish joined #nim |
02:43:45 | FromGitter | <iffy> @mratsim @rayman22201 k, filed the concept bug: https://github.com/nim-lang/Nim/issues/12082 |
02:46:46 | FromGitter | <iffy> me2beats: You can also give wiish a kick: https://github.com/iffy/wiish I haven't tested on Windows at all, but I have successfully run Android and iOS things in the simulators (and on a real iOS phone) |
02:51:47 | rayman22201 | @iffy, lol at your projects name. very awesome. In regards to your bug, what happens if you import file3.nim inside file2.nim instead of file1.nim? |
02:52:05 | FromGitter | <iffy> lemme try |
02:52:59 | FromDiscord_ | <me2beats> well using devel it starts to download some `gradle` |
02:53:24 | FromGitter | <iffy> it works if I import in file2 instead of file1 (I'll update the issue) |
02:53:28 | rayman22201 | @me2beats. That is a good sign. gradle is necessary to compile Android. |
02:53:30 | FromDiscord_ | <me2beats> so it seems I'm on the right way |
02:53:45 | rayman22201 | @iffy not that it will solve your real problem, b/c there is no way for you to change the order of system imports, for the case of Channels.nim :/ |
02:54:15 | rayman22201 | You should mention that in the issue |
02:54:46 | rayman22201 | but the example as you have it in the github issue is a good minimal repro. |
02:59:24 | FromDiscord_ | <me2beats> oh, `cannot open main.nim` again:( |
03:02:33 | FromGitter | <iffy> me2beats: is that for wiish or nimx? |
03:04:05 | * | a_chou quit (Quit: a_chou) |
03:04:27 | * | a_chou joined #nim |
03:08:26 | rayman22201 | I'm not sure if nake supports this. can you pass the `--verbosity:2` flag when you run? |
03:08:54 | FromDiscord_ | <me2beats> this is for nimx. can I try wiish? |
03:15:09 | * | a_chou quit (Ping timeout: 250 seconds) |
03:20:06 | FromDiscord_ | <me2beats> also I get this https://pastebin.com/VMUhBtyW |
03:21:42 | * | a_chou joined #nim |
03:23:32 | * | cgfuh quit (Quit: WeeChat 2.5) |
03:23:56 | FromDiscord_ | <me2beats> and this https://pastebin.com/C1vUJ1bC |
03:26:33 | rayman22201 | you need the NDK |
03:27:21 | rayman22201 | or specifically it looks like the NDK version you have is corrupted or missing something |
03:28:18 | rayman22201 | idk what nake is doing, but the old fashioned way would be to use android studio to download the appropriate libraries. |
03:34:24 | FromDiscord_ | <me2beats> hm maybe I specified the wrong ndk folder in NDK_HOME env vars, I set it to `...Android\Sdk\ndk` but I can see `platforms` folder in `...Sdk\ndk\20.0.5594570`. Will try to change it |
03:43:47 | * | theelous3 quit (Ping timeout: 245 seconds) |
03:44:27 | * | chemist69 quit (Ping timeout: 264 seconds) |
03:46:18 | * | chemist69 joined #nim |
03:47:04 | * | fjellfras joined #nim |
03:47:28 | shashlick | @shield I've tabled feud |
03:47:44 | shashlick | Spent too much time getting nothing out of it |
03:48:13 | shashlick | Not sure when newruntime will support tables, sets and other stuff that I use |
03:48:22 | shashlick | Plus libs I depend on |
03:49:37 | FromDiscord_ | <me2beats> now it seems ndk is found but still `cannot open main.nim`. I guess because of this: hewwo_worwd/build/android/com.mycompany.NimxApp/src/main/An |
03:49:37 | FromDiscord_ | <me2beats> droidManifest.xml; lineNumber: 19; columnNumber: 19; Element type "activity" mus |
03:49:37 | FromDiscord_ | <me2beats> t be followed by either attribute specifications, ">" or "/>". |
03:50:27 | shashlick | Folks please update your nimble with `koch --latest nimble` if not on devel |
03:51:58 | * | a_chou quit (Quit: a_chou) |
03:53:47 | * | sagax joined #nim |
03:55:24 | * | snooptek joined #nim |
03:56:50 | FromDiscord_ | <Shield> back to square 0 I guess... |
04:10:19 | FromDiscord_ | <me2beats> @iffy got that errors trying to install wiish |
04:10:23 | FromDiscord_ | <me2beats> https://pastebin.com/W5C1WeKb |
04:17:59 | * | laaron quit (Quit: ZNC 1.7.1 - https://znc.in) |
04:19:18 | * | laaron joined #nim |
04:19:30 | FromDiscord_ | <Shield> this looks ugly |
04:19:30 | FromDiscord_ | <Shield> https://github.com/nim-lang/Nim/issues/12037 |
04:37:58 | * | nsf joined #nim |
04:43:58 | * | LargeEpsilon joined #nim |
04:57:08 | * | faiXX quit (Ping timeout: 248 seconds) |
05:04:37 | * | fjellfras quit (Ping timeout: 245 seconds) |
05:05:31 | leorize | my speculation would be an incorrect move optimization |
05:15:12 | * | fjellfras joined #nim |
05:17:41 | * | fjellfras quit (Read error: Connection reset by peer) |
05:17:59 | * | fjellfras joined #nim |
05:18:03 | * | rockcavera quit (Remote host closed the connection) |
05:23:43 | * | owl joined #nim |
05:24:19 | owl | what is the difference between function(var1) and var1.function() |
05:32:29 | * | absolutejam joined #nim |
05:32:29 | * | LargeEpsilon quit (Read error: Connection reset by peer) |
05:37:57 | * | narimiran joined #nim |
05:38:34 | rayman22201 | no difference: https://nim-lang.github.io/Nim/manual.html#procedures-method-call-syntax |
05:44:14 | shashlick | Too late now but how many of you are in San Francisco |
05:44:20 | * | solitudesf joined #nim |
05:56:52 | * | LargeEpsilon joined #nim |
06:00:16 | rayman22201 | I'm in the same time zone as SF, does that count? :-P |
06:01:01 | * | leorize quit (Remote host closed the connection) |
06:01:05 | shashlick | ) |
06:01:36 | * | leorize joined #nim |
06:02:56 | * | alexander92 joined #nim |
06:05:08 | * | alexander92 quit (Client Quit) |
06:05:24 | * | alexander92 joined #nim |
06:20:09 | * | laaron quit (Remote host closed the connection) |
06:21:09 | * | hoijui joined #nim |
06:24:10 | alexander92 | i feel like |
06:24:22 | alexander92 | stuff.high .. stuff.low should somehow be a compile error |
06:24:44 | alexander92 | or <literal> .. <smaller literal> |
06:25:05 | * | laaron joined #nim |
06:25:15 | alexander92 | it only silently fails in very surprising ways if you didnt think there is countdown |
06:39:15 | * | absolutejam quit (Ping timeout: 268 seconds) |
06:49:04 | * | alexander92 quit (Ping timeout: 272 seconds) |
06:54:17 | * | ng0 joined #nim |
07:00:00 | * | gmpreussner quit (Quit: kthxbye) |
07:01:09 | * | laaron quit (Remote host closed the connection) |
07:02:15 | * | lkw quit (Quit: ZNC 1.7.3 - https://znc.in) |
07:03:23 | * | lkw joined #nim |
07:04:01 | * | laaron joined #nim |
07:04:43 | * | gmpreussner joined #nim |
07:17:40 | * | absolutejam joined #nim |
07:54:41 | * | laaron quit (Remote host closed the connection) |
07:55:43 | * | laaron joined #nim |
08:05:06 | * | mheinz joined #nim |
08:05:41 | Araq | "fails in surprising ways?" it iterates 0 times |
08:05:50 | Araq | just like in C, C++, C#, Java, ... |
08:15:19 | * | mheinz quit (Remote host closed the connection) |
08:18:48 | * | absolutejam quit (Ping timeout: 245 seconds) |
08:21:08 | * | PMunch joined #nim |
08:29:46 | * | solitudesf- joined #nim |
08:32:07 | * | solitudesf quit (Ping timeout: 245 seconds) |
08:42:16 | * | absolutejam joined #nim |
08:46:42 | * | absolutejam quit (Ping timeout: 245 seconds) |
08:48:25 | * | shomodj joined #nim |
08:56:11 | * | absolutejam joined #nim |
09:00:43 | * | absolutejam quit (Ping timeout: 246 seconds) |
09:07:11 | * | floppydh joined #nim |
09:12:55 | * | Vladar joined #nim |
09:22:01 | * | shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
09:30:24 | * | alexander92 joined #nim |
09:30:47 | alexander92 | Araq, yes, but when is the intention |
09:30:47 | * | absolutejam joined #nim |
09:31:27 | alexander92 | to do 0 .. -2 or a.high .. a.low: here we can assume the intention was to call countdown and to provide a helpful error message(now, for variable .. variable, that's not the case) |
09:31:39 | alexander92 | of course i can see how this might seem too much, but imho it makes sense |
09:32:33 | * | laaron quit (Remote host closed the connection) |
09:35:10 | * | laaron joined #nim |
09:56:52 | * | shomodj joined #nim |
09:59:06 | Araq | it's a race to the bottom |
09:59:46 | Araq | the more you make the machine help you out the less thoughts are going into your code and in the end you import js.isOdd with 50 dependencies |
10:07:55 | * | absolutejam quit (Ping timeout: 246 seconds) |
10:17:02 | * | absolutejam joined #nim |
10:18:37 | * | theelous3 joined #nim |
10:25:01 | alexander92 | i can't really agree: using `..` is not so much a matter of thinking, as just an idiom that one has to remember/find from somewhere (the fact that its always <=> upto) |
10:25:52 | alexander92 | of course, it's true that one shouldn't overdo this stuff |
10:27:57 | * | krux02 joined #nim |
10:33:13 | * | laaron quit (Remote host closed the connection) |
10:35:02 | * | Kaivo quit (Ping timeout: 245 seconds) |
10:35:58 | * | laaron joined #nim |
10:39:02 | * | fjellfras quit (Quit: Leaving) |
10:41:03 | Araq | well yeah it's an idiom and you *think* it does something it doesn't do |
10:41:27 | Araq | and it never did and comparable idioms in other languages don't do it either |
10:49:05 | * | clyybber joined #nim |
10:49:21 | alexander92 | 2 .. 5 is idiom |
10:49:37 | alexander92 | 2 .. -5 is a logical error |
10:49:55 | alexander92 | it never makes sense to use that, so no harm in reporting it |
10:50:15 | alexander92 | but i agree, no need to add it to nim, but i still see it as good error message design |
10:55:18 | Araq | 0 .. len - 3 # I use it *all* the time |
10:55:26 | alexander92 | but this is different |
10:55:30 | alexander92 | i explicitly |
10:55:41 | alexander92 | said "literal" or .high / .low |
10:55:56 | Araq | that's true and yeah we could warn about it |
10:56:02 | Araq | somehow |
10:56:20 | alexander92 | of course, a .. variable is very useful |
10:57:49 | alexander92 | oh God, i forgot to PR the await |
10:58:50 | FromGitter | <arnetheduck> should put a warning next to every use that quite unusually, it's an inclusive range :) |
11:07:33 | clyybber | Araq: Btw, do you still think that iterators having a seperate namespace is a design mistake? |
11:08:09 | Araq | yeah |
11:10:21 | * | endragor quit (Remote host closed the connection) |
11:25:13 | FromGitter | <mratsim> distinct types have some many semcheck issues :/ |
11:27:06 | FromGitter | <arnetheduck> ranges too :) `range[0'u32..5'u32]` typechecks both as an unsigned and signed integer for example |
11:28:01 | FromGitter | <arnetheduck> lots of tricky issues with ranges in fact |
11:28:16 | FromGitter | <mratsim> I tried to use both for a go playing bot with plenty of typechecked guarantees: https://github.com/mratsim/golem-prime/blob/master/src/datatypes.nim#L24 |
11:28:23 | FromGitter | <mratsim> I lost the fight against the compiler |
11:28:43 | FromGitter | <mratsim> oh I tried to use distinct static ranges actually |
11:29:18 | clyybber | But ranges are static anyways? |
11:29:50 | Araq | not every case of "in my mind this should compile" is actually a compiler bug, you know. |
11:32:17 | FromGitter | <mratsim> with static/distinct/ranges I'm confident it is :P |
11:33:02 | FromGitter | <mratsim> though static is a good place now. |
11:33:09 | FromGitter | <mratsim> in a good place* |
11:33:57 | FromGitter | <mratsim> I can even use static to workaround issues in openarrays: https://github.com/nim-lang/Nim/issues/6343 |
11:39:19 | clyybber | I think static is very cool, especially for manual optimization purposes |
11:39:45 | * | abm joined #nim |
11:40:33 | FromGitter | <arnetheduck> I think `static` is often kind of dumb - `inline` and `register` lost their original meaning in `c` for good reason |
11:41:49 | clyybber | arnetheduck: It sure is dumb when you think of an compiler as a perfect entity being capable of optimizing everything and being well versed in all kinds of optimization techniques |
11:42:04 | clyybber | But the reality is that it is not. |
11:43:24 | * | LargeEpsilon quit (Quit: Leaving) |
11:43:28 | clyybber | And many optimizations are better outsourced to the people that have better knowledge on the kind of things they are implementing |
11:43:42 | clyybber | Like mratsim :) |
11:44:54 | FromGitter | <arnetheduck> you can't outsource optimization generally because it depends on the context: if I call `f(4)` you can do constant propagation, if I call `f(x)` you generally can't - mratsim is not around to fix those cases for me |
11:45:50 | FromGitter | <arnetheduck> this is specially true of `static` function parameters - a bit less of the other overloaded meaning of static (generic type vs value differentiation) |
11:46:35 | clyybber | Thankfully the C compiler is around to do some of that for us. |
11:46:37 | FromGitter | <arnetheduck> it's 2019, full ctfe is kind of not a big deal any more |
11:47:37 | FromGitter | <iffy> me2beats: oh rats, that's an issue with the latest devel and nim-argparse: https://github.com/iffy/nim-argparse/issues/22 There would be a better chance of working on stable nim |
11:47:50 | clyybber | arnetheduck: Full ctfe is only practical for simple input -> output programs |
11:48:30 | FromGitter | <arnetheduck> well, it's practical everwhere where static is, by definition :) |
11:48:40 | clyybber | arnetheduck: Yeah |
11:48:52 | FromGitter | <arnetheduck> ... so that makes static noise... |
11:49:21 | clyybber | arnetheduck: It is noise, assuming a perfect optimizing compiler. |
11:49:38 | Araq | iffy: wanted to tell you but forgot about it :P |
11:50:01 | clyybber | But in reality new optimization techniques emerge and there is not a single compiler who implements them all. |
11:51:46 | FromGitter | <arnetheduck> no, but are these obsolete compilers worth the burden you place on developers to understand the nuance of the feature? |
11:52:49 | clyybber | arnetheduck: It's not a feature thats hard to understand |
11:53:47 | FromGitter | <arnetheduck> no feature is hard to understand in isolation when you know it alreadyt |
11:54:53 | clyybber | arnetheduck: Maybe static is a feature thats hard to comprehend for a theoretical being that only knows the concept of computation, but for a human that presses one button to compile and another to run, I dont think its that hard |
11:57:42 | clyybber | arnetheduck: My point is, compilers arent perfect and static helps people like mratsim to do HPC in nim, without having to wait on someone to implement it in the compiler. |
11:57:57 | Araq | for me 'static' is really hard and I question its soundness |
11:58:04 | Araq | :D |
11:59:11 | Araq | if 3's type is 'int literal(3)' why does it match 'static int' even better than that? |
11:59:42 | Araq | what kind of type relation is this? "oh, that's an exact match, but right over there there is a super-exact match" |
12:00:29 | FromGitter | <arnetheduck> lol perhaps *actually* knowing what it *actually* does is the tipping point here :) ignorance is bliss they say |
12:00:39 | * | hoijui quit (Ping timeout: 264 seconds) |
12:03:30 | FromGitter | <mratsim> static is mostly about type for me |
12:03:40 | FromGitter | <mratsim> being able to size an array for example |
12:04:03 | FromGitter | <mratsim> or static enum on x86, vs ARM vs ... |
12:04:19 | FromGitter | <mratsim> most of my optimizations involve runtime dispatch |
12:05:07 | FromGitter | <mratsim> the main optimization that static allows me to do is cutting down on code size and if/else if something is only valid for say x86 |
12:05:18 | Araq | there is no doubt 'static T' is really useful |
12:06:33 | * | Kaivo joined #nim |
12:07:49 | Araq | anyway we're in good company, turns out Haskell programmers never understood the Sieve of Eratosthenes |
12:07:54 | Araq | https://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf |
12:08:35 | * | rockcavera joined #nim |
12:09:46 | FromGitter | <mratsim> but that's old news |
12:10:48 | * | absolutejam quit (Ping timeout: 272 seconds) |
12:11:17 | FromGitter | <mratsim> I'm pretty sure I came across that 8~9 years ago when I was playing with Haskell and prime sieves on Project Euler |
12:11:32 | Araq | ah, I'm living in the past |
12:11:34 | Araq | ok |
12:12:47 | FromGitter | <mratsim> I don't understand my haskell code from that time :/ https://github.com/mratsim/haskell-numbertheory/blob/master/FactoringECM.hs |
12:16:31 | * | absolutejam joined #nim |
12:19:11 | clyybber | Araq: IMO int literal is the unsound part there |
12:19:30 | Araq | please elaborate |
12:20:31 | FromGitter | <iffy> In current devel, using `quote do:` I'm seeing Ident nodes with "backtick gensymNNNNN" appended to the original names. I think those used to just be `nnkSym` nodes. Did something change there? Am I close in my guess? |
12:21:05 | clyybber | Well, isn't int literal the one which matches both int and static[int] ? |
12:21:27 | Araq | iffy, yeah we changed how .gensym is implemented |
12:21:33 | narimiran | @iffy i think this is the commit which changed that: https://github.com/nim-lang/Nim/commit/b07694cd90ab7c6eb4660971ddb818b461d4eed8 |
12:21:46 | clyybber | In a perfectly sound system, int literal should match static[int] and static[int] should match int |
12:22:32 | * | absolutejam quit (Ping timeout: 245 seconds) |
12:22:51 | narimiran | (and it is the commit that disabled argparse, so yeah :)) |
12:23:09 | clyybber | But int literals dont work that way, because of ergonomics. And thats fine I guess, but not any less "sound" than static IMO |
12:23:31 | clyybber | s/"sound"/"unsound" |
12:24:11 | Zevv | iffy: is this problematic for your? |
12:25:23 | FromGitter | <iffy> Zevv: Only minorly. I just fixed argparse to work with the new devel, so not a problem. |
12:25:23 | alexander92 | *is afraid to upgrade* |
12:25:59 | Araq | clyybber: maybe 'int literal' also has problems but my point applies to all T |
12:26:28 | Araq | "abc" is of type string, not of type 'static string' |
12:26:37 | Araq | and yet 'static string' is a better match |
12:26:58 | Araq | now ok, we can change how literals are typed so that they get the 'static' |
12:27:24 | FromGitter | <arnetheduck> actually would be nice to detect static string literals because these are memory-managed differently |
12:28:25 | * | absolutejam joined #nim |
12:28:34 | clyybber | Araq: Yeah, as I said. The most sound way would be for "abc" to be a static string IMO |
12:28:38 | FromGitter | <arnetheduck> oops, I just argued for static ;) in types it's nice, it's the parameter use that I mostly dislike |
12:35:14 | Araq | no for parameters it's actually quite tame (you don't have to like it though) |
12:35:49 | Araq | but in types it leads to the usual sophistry, is seq[static string] a subtype of seq[string]? |
12:36:24 | * | MarderIII joined #nim |
12:36:24 | Araq | how is 'static seq[string]' different from 'static seq[static string]'? |
12:36:45 | Araq | is it different? who knows. certainly not the compiler |
12:36:55 | * | owl quit (Ping timeout: 268 seconds) |
12:38:22 | clyybber | Araq: IMO static should apply to the "whole" type, so only allow `static T` |
12:38:54 | clyybber | and not `whatever[static T]` |
12:41:36 | FromGitter | <mratsim> same question will happen with owned |
12:42:08 | clyybber | It's the same with sink, what is a `seq[sink T]` as a parameter? How is it different to a `sink seq[T]` |
12:42:14 | FromGitter | <mratsim> how is owned seq[string] different from owned seq[owned string] |
12:42:29 | FromGitter | <mratsim> but we can just build a constraint solver in the compiler for that :P |
12:42:33 | Araq | for sink and owned the issue is solved |
12:42:48 | Araq | even though you apparently doesn't know the answer |
12:42:55 | Araq | *don't |
12:43:16 | Araq | but clyybber's point is good |
12:43:40 | Araq | the 'static' qualifier moves to the front of the type |
12:43:45 | clyybber | mratsim: For owned its simple. |
12:44:02 | FromGitter | <mratsim> that was just an example ;) don't worry |
12:45:04 | * | MarderIII quit (Quit: Leaving) |
12:45:06 | FromGitter | <arnetheduck> what about `seq[sink static T]`? :) |
12:45:11 | clyybber | Araq: How does sink deal with it in parameters? |
12:45:50 | clyybber | arnetheduck: -> `static seq[sink T]` |
12:46:11 | clyybber | -> `static sink seq[T]` (?) |
12:47:22 | FromGitter | <mratsim> does it even make sense to sink a static? |
12:47:27 | Araq | no. |
12:47:45 | clyybber | It makes sense in a static context no? |
12:48:07 | clyybber | Nevermind that. |
12:48:14 | FromGitter | <mratsim> you would use a {.compileTime.} proc instead |
12:49:07 | Araq | there is no 'seq[sink T]' |
12:49:30 | clyybber | Araq: Thought so, just like there should be no 'seq[static T] |
12:49:32 | Araq | sink moves to the front |
12:49:44 | FromGitter | <mratsim> my future signatures: `proc foo(x: distinct sink seq[range[0 .. 0xFFF]]): lent range[0 .. 0xFFF] =` |
12:50:10 | FromGitter | <mratsim> (still better than Rust and C++) |
12:51:45 | Araq | yay... |
12:51:46 | Araq | :D |
12:55:53 | * | alexander92 quit (Ping timeout: 258 seconds) |
13:00:50 | * | PMunch quit (Remote host closed the connection) |
13:02:50 | clyybber | http://ix.io/1TLh this does not compile? |
13:03:17 | clyybber | Error: attempting to call routine: 'sink' |
13:07:26 | Araq | old Nim? |
13:07:55 | clyybber | Latest devel.. |
13:08:04 | clyybber | Can you reproduce? |
13:08:35 | Araq | no. |
13:08:49 | * | shomodj quit (Quit: Textual IRC Client: www.textualapp.com) |
13:12:51 | * | laaron- joined #nim |
13:13:20 | * | laaron quit (Remote host closed the connection) |
13:14:28 | clyybber | Cleared my nimcache, ran koch boot, still the same error. |
13:14:43 | FromDiscord_ | <Shield> it compiles on 0.20.99 |
13:14:45 | * | Kaivo quit (Quit: WeeChat 2.5) |
13:15:01 | * | Kaivo joined #nim |
13:15:28 | clyybber | I'm on 0.20.99, git hash: d0e5bd23.. |
13:16:01 | clyybber | Ooooooh |
13:16:36 | clyybber | It's because the file was named sink.nim |
13:18:08 | * | alexander92 joined #nim |
13:19:04 | FromDiscord_ | <Shield> the compiler doesn't like certain names? |
13:19:18 | * | alexander92 quit (Client Quit) |
13:19:32 | * | alexander92 joined #nim |
13:22:18 | Araq | clyybber: lol, common gotcha |
13:22:38 | Araq | we fixed plenty of bugs about this, but apparently it's never good enough |
13:24:36 | disruptek | i sometimes wish i could use a hyphen in a module name. |
13:25:20 | Araq | yeah, it's a common request |
13:25:29 | Araq | we will support it |
13:25:48 | disruptek | not a big deal; underscore works, right? |
13:26:18 | Araq | sure |
13:28:22 | shashlick | @Araq has tables been ported to newruntime? |
13:28:35 | disruptek | wrt that patch to stropping identifiers, i noticed that `quote do:` generated a []= access like `[]=(thing, "index", value)` and yet it didn't compile -- do you want me to add a patch to strop operators, too? |
13:29:14 | Araq | disruptek: well I don't understand your current PR |
13:29:35 | Araq | shashlick: it's covered by a test fwiw |
13:31:28 | Araq | clyybber: working on https://github.com/nim-lang/Nim/issues/12037 ? |
13:31:45 | disruptek | my pr allows you to render an identifier which clashes with a keyword, eg. proc foo(`type`: string) |
13:31:46 | shashlick | Ok then I might try newruntime on feud |
13:32:30 | clyybber | Araq: Ha, I just started looking into it :D |
13:32:58 | Araq | looks like the control flow graph ignores array indexing inside 'cast' or similar |
13:34:42 | * | owl joined #nim |
13:38:59 | * | abm quit (Quit: Leaving) |
13:55:51 | * | planetis[m] quit (Ping timeout: 248 seconds) |
13:56:47 | * | ljoonal quit (Ping timeout: 244 seconds) |
13:56:51 | * | planetis[m] joined #nim |
13:58:32 | * | ljoonal joined #nim |
13:59:54 | * | tyler569 quit (Ping timeout: 258 seconds) |
14:04:38 | * | absolutejam quit (Ping timeout: 245 seconds) |
14:06:43 | * | absolutejam joined #nim |
14:09:41 | FromGitter | <vitreo12> Is anyone using Emacs' nim-mode? Is flycheck / flymake working for you? |
14:10:40 | * | actuallybatman joined #nim |
14:11:06 | FromGitter | <vitreo12> If so, could anyone explain why I have these errors with flycheck: ((https://cdn1.imggmi.com/uploads/2019/8/29/c17176f225c0117e1059a2dc19aa9938-full.png)) |
14:15:05 | FromGitter | <vitreo12> The file is quite simple, as you can see. |
14:15:21 | FromGitter | <vitreo12> And it compiles, but yet flycheck lints all these errors for no reason |
14:17:17 | FromGitter | <vitreo12> (Forum post, for completeness: https://forum.nim-lang.org/t/5144) |
14:17:28 | * | Virxes joined #nim |
14:19:48 | * | laaron- quit (Remote host closed the connection) |
14:20:23 | * | tyler569 joined #nim |
14:21:07 | Virxes | Hi all. I have a question, more of a curiosity than a particular requirement right now... As parens are optional when calling a function (eg: `var inp = stdin.readline`), how would one store a reference to a function in a variable? eg: in Python, I could say `myiter = iter`. Is that possible in Nim? |
14:22:08 | disruptek | yes, parens are optional when calling a proc with arguments; otherwise, they are required. |
14:22:30 | * | laaron joined #nim |
14:23:04 | alexander92 | oh, that explains one problem i had |
14:23:09 | alexander92 | ty |
14:23:10 | * | theelous3 quit (Ping timeout: 272 seconds) |
14:23:40 | disruptek | sweet. |
14:24:05 | Virxes | Right, which is quite nice in some cases. But it means that if were to do something like this: `var rl = readline`, I will get a compiler error: `invalid type: 'None' for var`. It's not storing the function (or reference to it) in `rn`; it's trying to call it, from what I can gather. |
14:24:26 | Virxes | Just curious how functions can be passed around and/or stored in variables or constants. |
14:25:02 | disruptek | are you sure readline isn't a template? |
14:25:12 | Virxes | I believe it's a proc in the io module. |
14:25:39 | Virxes | I'm very new/ignorant still, excuse the baby steps :) |
14:26:02 | disruptek | i'm fairly new, too; let me look into that. |
14:26:10 | Virxes | thank you |
14:26:52 | Virxes | https://nim-lang.org/docs/io.html#readLine%2CFile |
14:26:59 | Virxes | I think that's the one |
14:27:15 | alexander92 | it's probably |
14:27:17 | alexander92 | overloaded |
14:27:19 | alexander92 | if you write |
14:27:21 | alexander92 | stdin.readline |
14:27:23 | alexander92 | it seems to work |
14:27:44 | alexander92 | hm nevermind, that's just calling it |
14:27:46 | Virxes | write, which is UFCS for `readline(stdin)` |
14:27:55 | Virxes | s/write/right/g |
14:28:28 | alexander92 | you're correct |
14:28:49 | Virxes | Nim seems very powerful, so I'm sure there's an elegant way to do this, but I haven't stumbled across it in the docs yet. |
14:29:26 | alexander92 | but still, the problem is overloading imo |
14:29:33 | alexander92 | because there are two readLine-s in io |
14:30:00 | Virxes | ah, I think I understand what you mean -- it doesn't know which one to grab. |
14:30:14 | Virxes | I'd have to define a `proc` type that matches the signature of the one I want to store. |
14:30:32 | disruptek | exactly. |
14:30:42 | disruptek | type RLType = proc(f: File; line: var TaintedString): bool |
14:30:47 | disruptek | var foo: RLType = readline |
14:30:59 | Virxes | ok, cool. I have a play with it, then. Thanks! |
14:31:22 | alexander92 | yes, the disruptek solution is pretty clean |
14:31:29 | alexander92 | another not so clean solution is to var rl = (proc(f: File): TaintedString)readline |
14:31:43 | alexander92 | this is an oneliner, but admittedly it might look less clear |
14:34:04 | Virxes | Works like a charm! |
14:35:58 | * | dddddd joined #nim |
14:39:48 | * | clyybber quit (Quit: WeeChat 2.5) |
15:18:56 | * | absolutejam quit (Ping timeout: 244 seconds) |
15:38:32 | * | theelous3 joined #nim |
16:10:03 | * | juturnas joined #nim |
16:10:49 | * | Virxes quit (Remote host closed the connection) |
16:13:22 | * | alexander92 quit (Ping timeout: 268 seconds) |
16:14:52 | * | Virxes joined #nim |
16:19:43 | juturnas | Struggling a bit with understanding the memory model with threading. I'm writing a threaded proxy that accepts new connections in the main thread, and needs to process each connection concurrently (I may change this to async later). For each connection, I need to send 1) the socket and 2) some context to the new thread (which is an object type). |
16:19:43 | juturnas | Is the correct way to do this via chans? Or via `createThread`s third param? Or does it need to involve globals or pointers? If I missed a resource on the site that explains all of this clearly, I apologize |
16:23:31 | * | vlad1777d__ quit (Ping timeout: 244 seconds) |
16:30:15 | * | Trustable joined #nim |
16:50:55 | * | abm joined #nim |
16:54:36 | * | laaron quit (Quit: ZNC 1.7.1 - https://znc.in) |
16:55:28 | * | laaron joined #nim |
17:07:38 | * | tane joined #nim |
17:09:09 | * | clyybber joined #nim |
17:09:18 | Araq | juturnas: iirc people had good success with simply 'spawn handleRequest(socket)' |
17:13:23 | * | actuallybatman quit (Ping timeout: 245 seconds) |
17:16:26 | * | nsf quit (Quit: WeeChat 2.5) |
17:24:11 | FromDiscord_ | <me2beats> @iffy, guys: can I use both stable and devel nims? |
17:24:18 | clyybber | Araq: Should there be use `addr(something)` or should it recurse to use `something` |
17:24:44 | clyybber | me2beats: Sure, are you on linux or windows? |
17:24:51 | FromDiscord_ | <me2beats> Win |
17:25:39 | clyybber | Oh, then I don't know really. I would have suggested symlinking, but I haven't done that on windows yet |
17:25:44 | Araq | clyybber: what do you mean? |
17:26:14 | clyybber | Araq: Is it intended for "use addr(sq[0])" to be in the cfg |
17:26:34 | Araq | well certainly, it's a usage |
17:26:36 | clyybber | or should it be resolved to "use sq[0]" in dfa.nim:gen |
17:26:54 | Araq | I don't think so |
17:27:03 | Araq | don't throw away information |
17:27:23 | clyybber | Ok, so the problem is not in gen |
17:27:26 | Araq | 'use addr(...)' is fine we already have some crazy node matching mechanism |
17:27:45 | Araq | yeah we are missing some 'skip(nkAddr)' logic somewhere |
17:27:53 | clyybber | Yeah |
17:28:32 | clyybber | I thought so too, so I added it to aliases and analysableFieldAccess, but that doesnt work |
17:28:49 | Araq | hmmm |
17:28:58 | Araq | but it seems to be the right idea |
17:29:19 | clyybber | Is nkAddr first child the node we should skip to? |
17:29:20 | Araq | me2beat: the differences are not great, use stable |
17:29:39 | Araq | yeah |
17:29:51 | Araq | also don't forget nkHiddenAddr that requires the same |
17:29:59 | clyybber | Yep, did that too |
17:35:12 | juturnas | Araq thanks, I'll try that out |
17:35:50 | Araq | juturnas: requires 'import threadpool' |
17:48:38 | * | Trustable quit (Remote host closed the connection) |
17:56:00 | * | owl quit (Ping timeout: 244 seconds) |
17:56:53 | FromDiscord_ | <me2beats> Guys what do I need to place in SDL_HOME folder? sdl source or just sdl2.dll? |
17:57:30 | FromDiscord_ | <me2beats> It seems nimX requires this |
17:58:05 | FromDiscord_ | <me2beats> ok, source, nm |
18:02:00 | * | floppydh quit (Quit: WeeChat 2.5) |
18:25:14 | * | alexander92 joined #nim |
18:26:28 | FromGitter | <mratsim> That's interesting: https://blog.regehr.org/archives/1678 it's a C-to-C transformer that transforms a long test-case into a minimal one |
18:27:23 | FromGitter | <awr1> ooo |
18:27:24 | FromGitter | <awr1> interesting |
18:30:18 | FromGitter | <mratsim> oh I have to try your cpu feature detection PR on my CPU |
18:31:42 | * | absolutejam joined #nim |
18:32:10 | * | narimiran_ joined #nim |
18:33:27 | alexander92 | i agree with shield |
18:33:48 | alexander92 | i think having custom allocators wouldn't be so verbose as in zig raynman22201 |
18:34:03 | alexander92 | as you can have them maybe set once for a given type? |
18:34:14 | alexander92 | or maybe passed somehow implicitly ? |
18:34:44 | * | narimiran quit (Ping timeout: 248 seconds) |
18:35:55 | FromGitter | <awr1> whenever I end up buying an RPI or a Rock64 i will do the ARM features |
18:36:22 | alexander92 | we actually have it |
18:36:24 | alexander92 | localAllocator |
18:36:29 | alexander92 | setLocalAllocator |
18:36:30 | FromGitter | <mratsim> > The amount of archaic bullshit in Poonix based OSes is just insane. lol |
18:36:33 | alexander92 | and getLocalAlocator |
18:37:08 | alexander92 | you can have a helper that calls stuff like that : withAlloc(dummyAlocator, call(arg)) |
18:37:20 | alexander92 | which just sets a new one and resets it for this call |
18:37:28 | alexander92 | and no arg pollution |
18:37:40 | FromGitter | <awr1> lol https://github.com/awr1/Nim/blame/b9188271384991f22c95cb149a9ab72c8c3ae422/lib/pure/concurrency/cpuinfo.nim#L30 |
18:37:44 | FromGitter | <mratsim> is that outdated? https://github.com/nim-lang/Nim/wiki/Destructors#allocators |
18:38:07 | alexander92 | mratsim not sure |
18:38:21 | FromGitter | <awr1> also if i wanted to be clever i would put a test case for the CI's exact hardware. buuuuuuuuuut that is very fragile and a silly idea |
18:38:22 | alexander92 | i just look at the source of core/allocators.nim |
18:38:35 | rayman22201 | yes, but I don't think that api is exposed to user code |
18:38:41 | rayman22201 | you can't implement it yourself |
18:38:51 | FromGitter | <mratsim> I think that the plan, to expose it |
18:39:01 | rayman22201 | that would be awesome |
18:39:04 | FromGitter | <mratsim> I asked for a way to have custom seq allocators for Arraymancer |
18:39:38 | rayman22201 | perfect use case for it |
18:39:43 | FromGitter | <mratsim> though I thin ptr + lenwould be easier for zero copy views over any kind of buffers (say Python buffers or image buffers) |
18:40:41 | FromGitter | <mratsim> a more perfect use cas would be for seamless interop with alloca, a memory pool or an object pool |
18:41:19 | FromGitter | <mratsim> `type SmallString = distinct string` but you use alloca as an allocator? :) |
18:41:34 | rayman22201 | I also think zero copy views would be very good, but that seems a bit orthogonal |
18:41:38 | FromGitter | <mratsim> though alloca is probably too tricky because you can't use a function |
18:41:58 | FromGitter | <mratsim> but a memory pool to avoid repeated alloc could help |
18:42:36 | Araq | talking about toOpenArray again? |
18:42:44 | Araq | hint: we have it, we're improving it |
18:42:47 | FromGitter | <mratsim> no allocator |
18:44:06 | rayman22201 | the setLocalAllocator thing in core/allocators.nim and exposing it. |
18:44:12 | rayman22201 | would be cool |
18:44:43 | rayman22201 | re: the c-reduce thing. iirc (the infamous) timothee cour brought that up a while ago. It's a neat idea. Would be cool to build an equivalent for Nim, but it's a big project. |
18:45:43 | disruptek | thanks for sharing that link on c-reduce. |
18:46:15 | Araq | there was some tool to produce Nim programs that trigger compiler bugs |
18:46:32 | Araq | but we already have so many real bugs that I considered it futile |
18:47:19 | FromGitter | <awr1> sounds like something that could be more attractive once nim stabilizes more |
18:47:34 | rayman22201 | Definitely. Agreed. bigger fish to fry atm |
18:48:06 | disruptek | i'd like to see why klee complains about nim output first. |
18:49:03 | rayman22201 | tangent: I wish this api got accepted into the linux kernel. windows UMS on linux would be sweet: https://www.youtube.com/watch?v=KXuZi9aeGTw |
18:50:40 | alexander92 | mratsim i am not yet sure how this all works |
18:51:16 | alexander92 | but it seems to me |
18:51:19 | alexander92 | those *are* exposed |
18:51:22 | alexander92 | in new-runtime |
18:51:41 | alexander92 | e.g. it seems seq also uses it |
18:51:46 | alexander92 | so if i provide my own allocator |
18:51:56 | alexander92 | it should just work ? |
18:52:37 | rayman22201 | orly? If that's the case, then I misunderstood that code. newruntime needs better docs lol! |
18:52:46 | alexander92 | rayman22201 all of those seem to use `*` |
18:52:56 | alexander92 | but i also have no idea, just guessing :P |
18:53:11 | rayman22201 | I will use the excuse that it was late at night when I looked at it :-P |
18:53:12 | FromGitter | <awr1> i know too many people that don't believe me when i say much of the current win32 api is better designed than unix |
18:53:35 | rayman22201 | @awr1 I used to not believe it, but the more I learn, the more I agree.... |
18:53:45 | Araq | it's some kind of religion |
18:54:04 | FromGitter | <mratsim> @awr1, here you go: https://gist.github.com/mratsim/564254157f565bbf8925dd32e001019c |
18:55:19 | FromGitter | <awr1> oh i actually have an idea of how a test case could be done but i dont feel like doing it lol |
18:55:28 | FromGitter | <awr1> probe proc/cpuinfo and compare |
18:56:07 | FromGitter | <mratsim> I think it's fine like it is now |
18:56:22 | FromGitter | <mratsim> you can raise an issue and leave it to someone else :P |
18:56:45 | FromGitter | <awr1> once CI is green you should be free to be able to merge |
18:57:12 | FromGitter | <mratsim> getting the CI to be green is hard work |
18:57:30 | FromGitter | <awr1> appveyor was being weird on one of the commits i did yesterday |
18:57:31 | FromGitter | <awr1> https://ci.appveyor.com/project/dom96/nim/builds/27032227/job/r6mixx56qa67c6w5 |
18:58:10 | FromGitter | <mratsim> can't we put Appveyor under a Nim-project @Araq so that everyone in the project can restart it and not just dom? |
19:00:10 | FromGitter | <mratsim> it's chronos which is failing on windows according to the logs |
19:01:39 | FromGitter | <awr1> also @Araq it *is* a religion, i vividly remember all those bizarre "linux tux penguin kills windows logo" wallpapers from the aughts, and all those very ambiguous blog posts by people that claimed to work at MS claiming "listen, the NT kernel is *just* bad, our OS is inferior" |
19:20:38 | FromDiscord_ | <Shield> @alexander92 how granular are they? the allocators I mean, I've yet to check the code for newruntime, but I still stand that exposing it cannot be that ugly, let's say you have 2 separate seq/string each one has it's own custom allocator, if you do a copy, the function will properly call the right allocator, and they'll alloc/realloc in the proper place, this is how that "hack" works for them in regions, but it involves switching back and f |
19:21:23 | FromDiscord_ | <Shield> at worst, the user wouldn't have to set anything and everything would use the default allocator |
19:26:51 | Araq | Shield: the seq remembers the allocator |
19:28:00 | clyybber | Araq: Whats the reasoning behind # use x.f; question: does it affect the full 'x' ? No. ? |
19:28:09 | clyybber | Does it mean that x.f doesnt count as a use? |
19:28:23 | clyybber | of x |
19:29:28 | Araq | this is tuned for the one question that we ask |
19:29:38 | Araq | "is this the last read?" |
19:29:56 | Araq | it's subtle and not symmetric |
19:30:30 | Araq | if we use 'x.f' we don't use all of 'x', 'x.f2' can still be read from |
19:30:46 | clyybber | Ah, fine. |
19:31:01 | clyybber | I think theres some weird logic in aliases |
19:31:12 | clyybber | Or maybe thats intended, dunno |
19:31:15 | Araq | certainly |
19:31:25 | clyybber | When theres a nkBracketExpr we break and return false? |
19:31:41 | clyybber | so sq[0] doesn't count as an alias to sq |
19:32:30 | clyybber | I should reword, aliases doesn't return true for params: sq1, sq1[0] |
19:32:34 | clyybber | Is that intended? |
19:32:53 | Araq | well there is some bug in there, that's why you're looking at it |
19:33:42 | clyybber | Yeah, but I'm asking if this sounds like its intended |
19:34:05 | clyybber | As in, should aliases check for field access of a seq, or should it not |
19:34:42 | FromDiscord_ | <Shield> I've seen that objects too hold a pointer to an allocator |
19:34:42 | Araq | I don't know but remember that we usually don't know if s[i] aliases s[j] |
19:35:07 | * | wildtrees joined #nim |
19:36:07 | Araq | we do know that s[i] aliases s though, and that's probably where the bug lies |
19:36:43 | clyybber | Araq: I wonder how that hasn't been catched yet |
19:36:56 | alexander92 | oh yeah i managed to use a custom allocator Shield |
19:37:15 | alexander92 | i just have to remember never to `include core/allocators` |
19:37:21 | alexander92 | always to import it |
19:37:25 | alexander92 | dunno what i thought |
19:38:32 | alexander92 | i can even make it segfault now, amazing |
19:41:39 | FromDiscord_ | <Shield> would like to see what you're done with it |
19:42:00 | FromDiscord_ | <Shield> I think only inheritable objects get that extra allocator pointer but not normal structs? |
19:42:35 | * | absolutejam1 joined #nim |
19:43:52 | clyybber | Araq: Interestingly the logic is actually there, I just don't know why theres this "and x.typ.skipTypes(abstractInst).kind == tyTuple" special casing in aliases handling of nkBracketExpr |
19:44:43 | * | absolutejam quit (Ping timeout: 246 seconds) |
19:45:44 | clyybber | Araq: Well removing that check fixes it |
19:46:10 | * | tane quit (Quit: Leaving) |
19:47:16 | clyybber | Araq: Since you wrote that piece of code, could it be possible that you got the branches mixed up? |
19:47:29 | clyybber | And whats the intention behind that check? |
19:50:06 | FromGitter | <awr1> @mratsim i noticed in your gist you have: |
19:50:11 | FromGitter | <awr1> hasMmxExt: false, has3DNow: false, has3DNowEnhanced: false |
19:50:15 | FromGitter | <awr1> which i find is interesting |
19:50:30 | FromGitter | <awr1> i guess they finally took an axe to 3dnow? |
19:51:04 | FromGitter | <mratsim> 3DNow was equivalent to MMX iirc |
19:51:25 | FromGitter | <mratsim> and mmxext was only for Pentium 3 and was thought a dead end when they release Pentium 4 and SSE2 |
19:51:34 | FromGitter | <mratsim> I don't really member, but I guess so |
19:51:38 | FromGitter | <awr1> it was an extension of mmx for floats |
19:51:48 | FromGitter | <awr1> but then SSE cleared that all up |
19:52:18 | FromGitter | <awr1> in that case my doc on hasMmxExt is wrong, and that AMD64 is just x87+SSE+SSE2 |
19:52:25 | FromGitter | <awr1> +base MMX |
19:52:25 | FromGitter | <mratsim> I still have the x87 FPU :P |
19:52:52 | Araq | clyybber: the intention was |
19:53:00 | Araq | a[i] # runtime i |
19:53:21 | Araq | vs a[6] # tuple indexing, completely different |
19:53:40 | Araq | but if it works so be it |
19:53:45 | clyybber | But both aliases a, right? |
19:54:09 | * | Vladar quit (Remote host closed the connection) |
19:54:10 | FromGitter | <mratsim> mmxext is probably emmx on wikichip? https://en.wikichip.org/wiki/intel/core_i9/i9-9980xe#Features |
19:54:23 | Araq | yeah |
19:54:31 | Araq | I got confused about |
19:54:39 | Araq | a[i] vs a |
19:54:44 | Araq | and a[i] vs a[j] |
19:55:44 | FromGitter | <awr1> i do remember AMD deciding to kill 3dnow (besides `PREFETCH` |
19:56:05 | FromGitter | <awr1> but i think maybe wikichip is wrong |
19:56:40 | FromGitter | <awr1> check proc cpuinfo |
19:57:54 | FromGitter | <awr1> i have MMX but no MMX ext on my skylake mobile :P |
20:00:22 | FromGitter | <awr1> if it doesn't support 3Dnow that is *mildly* interesting, you would think intel would have made an annoucement to devs somewhere (even if it is such an antiquated ISA extension) |
20:03:07 | alexander92 | how can i easily check |
20:03:15 | alexander92 | if something is assignable in a template |
20:03:33 | alexander92 | something like "when b is void: b else: var a = b" |
20:04:50 | alexander92 | and without "when compiles(a = b)" |
20:04:55 | FromGitter | <mratsim> when in doubt, when compiles() is your friend |
20:05:29 | FromGitter | <mratsim> you can use a concept? :P |
20:06:08 | FromGitter | <mratsim> type Assignable = concept x, var y ⏎ y = x |
20:06:46 | FromGitter | <mratsim> I do not guarantee the absence of impact on your compilation times |
20:07:30 | * | nsf joined #nim |
20:07:31 | clyybber | Araq: Should I use doAssert or assert in tests? |
20:07:40 | clyybber | Doesn't matter does it? |
20:08:41 | FromGitter | <mratsim> doAssert |
20:08:49 | narimiran_ | it doesn't matter |
20:09:02 | FromGitter | <mratsim> we might want to run tests in release mode though |
20:13:49 | FromGitter | <awr1> doAssert yeah |
20:14:14 | FromGitter | <awr1> idk if we run tests in release rn though |
20:14:18 | FromGitter | <awr1> any tests |
20:14:26 | narimiran_ | i know. we don't. assert is fine. |
20:15:28 | alexander92 | narimiran, yeah when compiles works |
20:15:52 | alexander92 | so Shield , i basically |
20:15:56 | alexander92 | just played |
20:15:58 | alexander92 | with that |
20:25:00 | clyybber | Araq: PR is up https://github.com/nim-lang/Nim/pull/12089 |
20:25:20 | clyybber | Good night everyone |
20:25:25 | * | clyybber quit (Quit: WeeChat 2.5) |
20:25:30 | FromGitter | <awr1> gn |
20:25:43 | alexander92 | e.g. http://ix.io/1TNc or |
20:26:43 | alexander92 | http://ix.io/1TNa |
20:27:07 | alexander92 | the last one creates a `withAlloc` macro which seems to work for me in a limited usecase |
20:28:11 | alexander92 | but my allocators themself are just dummy placeholders mostly |
20:30:06 | juturnas | Is there an idiomatic way to poll over multiple channels, or combine channels? |
20:33:51 | Araq | channels are seriously under-developed in Nim, most use async instead |
20:34:25 | * | narimiran_ quit (Ping timeout: 246 seconds) |
20:35:05 | juturnas | Hmm okay. Is it pretty straightforward to integrate C code with async? |
20:36:18 | FromGitter | <mratsim> C in general is straightforward to use |
20:36:29 | FromGitter | <mratsim> C code* |
20:37:29 | FromGitter | <mratsim> Here are some example of C wrapper: https://github.com/mratsim/weave/blob/master/e04_channel_based_work_stealing/primitives/c.nim |
20:38:08 | juturnas | Thanks for the link |
20:38:25 | FromDiscord_ | <Shield> alexander92 : withAlloc looks useful, it's basically regions but you can mix it with normal code without switching everything to one gc |
20:39:13 | FromGitter | <mratsim> Given how many game devs are in Nim, mixing freely regions with normal GC code would be super useful for them |
20:40:38 | FromGitter | <mratsim> and some more advanced wrapper were I don't reuse the C name (so i need importc instead of just the header) https://github.com/mratsim/weave/blob/master/e04_channel_based_work_stealing/primitives/threads.nim |
20:40:42 | disruptek | i thought that was the point of regions. |
20:42:21 | FromGitter | <mratsim> alternatively you can also directly pull symbols from a dynamic library without the header but that is less often used |
20:42:31 | FromGitter | <awr1> mixing GC and regions could be highly attractive for an engine |
20:42:54 | FromDiscord_ | <Shield> mratsim: definitely, sometimes you want to have control over specific part of the game but use GC for other things, GC is a quality of life feature and you shouldn't be forced to use one thing or the other |
20:43:22 | FromGitter | <mratsim> if you compile with gc:regions it's one region for everything at the moment |
20:43:34 | FromGitter | <awr1> gameplay code could probably stick to GC (similar to Unreal, which GCs Actors amongst other things) and rendering/infrastructural code can use regions |
20:43:40 | FromGitter | <awr1> or newruntime or w/e |
20:44:02 | FromGitter | <awr1> also the pause-on-demand stuff is also highly attractive for game engines |
20:44:14 | FromGitter | <mratsim> Java mark and sweep on demand? :P |
20:44:38 | FromGitter | <awr1> specifically this https://nim-lang.org/docs/gc.html |
20:44:52 | alexander92 | Schield : yes, thats my idea |
20:45:09 | alexander92 | but more like the zig/c++ passing allocators thing |
20:45:16 | alexander92 | just more implicit |
20:45:24 | alexander92 | i haven't used regions much |
20:45:25 | FromGitter | <mratsim> that would be super useful for machine learning as well |
20:45:46 | * | nsf quit (Quit: WeeChat 2.5) |
20:45:57 | Araq | yeah allocators and regions are related |
20:46:00 | FromGitter | <mratsim> I need to pass caching allocators on CPU and GPU as ML algo create and destroy a lot of huge tensor |
20:46:20 | * | absolutejam1 quit (Ping timeout: 272 seconds) |
20:46:45 | FromGitter | <mratsim> but I'm not too worried for that I can do it in my lib. |
20:47:18 | FromGitter | <mratsim> It could also help to set a memory pool for strings just before heavy string processing. |
20:47:26 | alexander92 | but i am still not fully into how exactly types preserve their allocators: e.g. if i pass a value to another function "using this other allocator B", should it get realloc-ed with B? does it keep using its original one? |
20:47:59 | FromGitter | <mratsim> can't we have a per type allocator otherwise? |
20:48:00 | disruptek | it uses the one for the type. |
20:48:11 | FromGitter | <mratsim> and we could maybe define it as a pragma |
20:48:19 | alexander92 | i think that's how it works |
20:48:27 | alexander92 | but i wonder if i can override it |
20:49:03 | FromGitter | <mratsim> type Foo{.allocator: MyRegionAlloc.}[T] = distinct seq[T] |
20:49:06 | FromDiscord_ | <Shield> per type allocator would only be good if you're allowed to change the allocator using aliasing or distinct |
20:49:39 | FromGitter | <mratsim> or if it applies to the subfields of the type |
20:49:42 | FromGitter | <mratsim> mmmh |
20:49:50 | FromGitter | <mratsim> distinct is a bit too broken :/ |
20:50:20 | alexander92 | mratsim but that's the thing: i expect that if i override setLocalAllocator(), your new type instances would start to respect it |
20:50:29 | alexander92 | and the old one-s would keep using MyRegion |
20:50:32 | alexander92 | similar to seq-s |
20:50:52 | FromGitter | <mratsim> maybe like this ⏎ type Foo = object ⏎ myField{.allocator: MyRegionAlloc.}: seq[int] |
20:51:05 | FromDiscord_ | <Shield> strings are generally the worst offender, since they're bycopy, any functions that makes new strings will keep allocating stuff under the hood, taking that burden away from the user is good, you don't have to carefully check every lib before using something that should be simple |
20:51:55 | FromGitter | <mratsim> basically setLocalAllocator boils down to: were we happy with how shallow() worked |
20:52:06 | alexander92 | but i still dont understand the need of regions, if one can have custom allocators: some kind of type safety? |
20:52:18 | FromGitter | <mratsim> and @Shield, per type allocator would also work with object if it's implemented like the shallow pragma |
20:52:47 | disruptek | because sometimes you want to share types without sharing their allocator. |
20:52:53 | disruptek | eg. strings ;-) |
20:52:58 | alexander92 | yep |
20:53:20 | FromGitter | <mratsim> The shallow pragma here, applies to the seq contained by my type: https://github.com/mratsim/Arraymancer/blob/master/src/tensor/data_structure.nim#L21 |
20:53:46 | FromGitter | <mratsim> maybe we need a RFC to collect use-case? |
20:54:25 | FromDiscord_ | <Shield> and wouldn't custom allocators make it easier to make shared memory without having to recreate new types |
20:54:35 | FromDiscord_ | <Shield> for multithreading |
21:07:07 | alexander92 | @mratsim sounds good |
21:08:13 | alexander92 | i wrote a simple rfc for my thoughts just to have it there |
21:10:27 | FromGitter | <awr1> oh god emacs is freezing when i isearch |
21:10:45 | alexander92 | but if you have a rfc for type allocators , i'd love to read it |
21:11:46 | FromGitter | <mratsim> btw @Araq, for channels, do you prefer the current API where a channel is an object or an API like Rust where "initChannel" creates a recvEndpoint and sendEndpoint? |
21:20:07 | * | absolutejam1 joined #nim |
21:25:39 | * | mattmurr joined #nim |
21:30:33 | * | actuallybatman joined #nim |
21:31:45 | * | sagax quit (Quit: Konversation terminated!) |
21:31:48 | * | alexander92 quit (Ping timeout: 248 seconds) |
21:35:01 | * | pigmej[m] joined #nim |
21:39:39 | * | gangstacat quit (Quit: Ĝis!) |
21:41:44 | FromDiscord_ | <Shield> how do you monitor memory usage with newruntime? |
21:48:12 | * | snooptek quit (Remote host closed the connection) |
21:58:42 | * | solitudesf- quit (Ping timeout: 268 seconds) |
22:19:40 | * | actuallybatman quit (Ping timeout: 268 seconds) |
22:26:27 | * | absolutejam1 quit (Ping timeout: 268 seconds) |
22:31:34 | FromGitter | <mratsim> -d:UseMalloc and Valgrind |
22:34:29 | FromDiscord_ | <Shield> anything on windows? :/ |
22:36:03 | * | abm quit (Quit: Leaving) |
22:36:05 | * | actuallybatman joined #nim |
22:42:07 | * | actuallybatman quit (Ping timeout: 245 seconds) |
22:43:24 | rayman22201 | I haven't tried it, but I remember someone trying https://drmemory.org/ |
22:43:58 | rayman22201 | I think it was @zacharycarter? |
22:44:01 | * | actuallybatman joined #nim |
22:46:30 | shashlick | how about https://software.intel.com/en-us/system-studio/system-debugger |
22:51:43 | * | actuallybatman quit (Ping timeout: 245 seconds) |
23:08:25 | FromDiscord_ | <Shield> great, drmemory works! now lemme check those thousands possible errors and memory leaks on a skeleton opengl application |
23:09:04 | rayman22201 | sweet :-D |
23:18:02 | * | ng0 quit (Quit: Alexa, when is the end of world?) |
23:38:45 | * | actuallybatman joined #nim |
23:52:38 | * | krux02_ joined #nim |
23:55:15 | * | krux02 quit (Ping timeout: 264 seconds) |