<< 29-08-2019 >>

00:00:01FromDiscord_<Shield> can you use pointers with seqs and strings or they have to be reimplemented for the manual memory management?
00:05:05FromGitter<zetashift> what a nice read Cadey
00:05:28*faiXX quit (Ping timeout: 245 seconds)
00:07:32*faiXX joined #nim
00:09:49Cadeyzetashift: i'm currently writing up a longer "Jester: The Missing Manual" post too
00:10:27FromGitter<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:46shashlick@Shield have to be reimplemented
00:25:07*laaron joined #nim
00:25:12shashlickSee my poor man's shared string and seq
00:25:15shashlickhttps://github.com/genotrance/shared
00:28:56FromDiscord_<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:23rayman22201https://github.com/nim-lang/Nim/blob/devel/lib/core/strs.nim#L48
00:35:23rayman22201why 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:35shashlick@Shield ya, but shared could be expanded to be backed with alloc instead of allocShared and have all functionality over time
00:45:17shashlickRight now it is very inefficient but it's only 300 times slower with copies gallore
00:46:22shashlickI 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:45rayman22201you could hack your own fork of https://github.com/nim-lang/Nim/blob/devel/lib/core/allocators.nim
00:47:13rayman22201that's probably a terrible idea though
00:48:02rayman22201It 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:15FromDiscord_<Shield> I was looking into the core files
00:49:19FromDiscord_<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:24FromDiscord_<Shield> earlier*
00:56:08rayman22201For 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:47FromDiscord_<Shield> NimStrPayload and NimSeqPayload already have an allocator field
00:57:24rayman22201exactly. that's what I meant when I said strings and seqs already support it, it's just not exposed.
01:00:16FromDiscord_<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:59rayman22201I agree. you should tell Araq :-P
01:04:02*faiXX quit (Ping timeout: 258 seconds)
01:04:23FromDiscord_<Shield> I did :v
01:04:46rayman22201what did he say? lol
01:05:44FromDiscord_<Shield> just use newruntime ...
01:05:52*faiXX joined #nim
01:06:14rayman22201He isn't wrong per say...
01:06:33FromDiscord_<Shield> wouldn't this also fixes dlls without even having to use nimrtl?
01:07:22rayman22201newruntime will also fix dlls
01:07:30rayman22201newruntime does not require nimrtl
01:08:41FromDiscord_<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:02FromDiscord_<Shield> doesn't newruntime still rely on ref counting for some parts?
01:09:26rayman22201Well, even Rust doesn't let you define custom allocators for stdlib containers. (only on a global basis).
01:10:54rayman22201newruntime 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:54shashlickWell if you use custom allocators, aren't you still dealing with the gc
01:11:07shashlickI agree newruntime is the better answer
01:12:18rayman22201if 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:13shashlickOk
01:16:49FromDiscord_<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:41rayman22201I 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:10rayman22201It 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:25FromGitter<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:39rayman22201relevant blog post lol: https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/
01:22:53FromGitter<iffy> Like Python Twisted's maybeDeferred or JavaScript's Promise.resolve(...)
01:23:15rayman22201How can a function "may/may not" return a Future? Nim is statically typed. It must always return a single type.
01:25:12rayman22201We have Promise.resolve(). It's https://nim-lang.github.io/Nim/asyncfutures.html#complete%2CFuture%5BT%5D%2CT
01:25:13FromGitter<iffy> oh, I guess I can't have Table[int, proc():(string|Future[string])]
01:26:39FromGitter<iffy> JS `Promise.resolve(5)` will make a new Promise with the value of 5 already ready in it.
01:27:26FromGitter<iffy> but alas, I can't have a table with procs that return one or the other, seems like
01:27:31FromDiscord_<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:32FromGitter<iffy> so nevermind
01:27:33rayman22201@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:14FromGitter<iffy> I was hoping to accept procs of either "color"
01:28:24FromGitter<iffy> oh well
01:28:48rayman22201right, you can't really. Async / Futures "infect" your api in this way.
01:29:06rayman22201But this is true in Javascript as well
01:29:22rayman22201it's just more obvious in Nim because of the static typing
01:29:31FromGitter<iffy> right
01:29:44FromGitter<iffy> Same in Twisted
01:30:16rayman22201You can work around it easily by just creating a Future and immediately `completing` the Future.
01:30:40FromGitter<iffy> Yeah, that's what I'll end up doing. Though I'm now thinking about error handling...
01:31:11FromGitter<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:17FromDiscord_<Shield> @shashlick did you rewrite your plugin system for newruntime yet?
01:31:40FromGitter<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:57FromGitter<iffy> At least, that's how I imagine it works
01:33:01rayman22201@iffy you can make a function {.async.} even if it returns the result immediately
01:33:37rayman22201then you get the exception handling from the {.async.} macro for free
01:33:41FromGitter<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:49FromGitter<iffy> I can't enforce that the proc is {async}
01:33:53FromGitter<iffy> or wait... maybe I can?
01:34:57FromGitter<iffy> nope, `procs*: Table[string, (proc():Future[string] {.async.})]` doesn't seem valid
01:40:40FromGitter<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:59rayman22201@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:05rayman22201@iffy I mean
01:44:11rayman22201lol, sorry. freudian slip
01:44:30rayman22201@shield cares about memory, not async :-P
01:44:34FromGitter<iffy> :)
01:45:45FromGitter<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:11FromGitter<iffy> All the code I'm writing right now is only going to be used by me
01:46:33rayman22201then you can easily verify that you never generate Futures by hand :-P
01:46:43FromGitter<iffy> hehehe
01:46:48*FromGitter * iffy deletes a bunch of code
01:46:54rayman22201lol
01:56:20rayman22201@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:54FromDiscord_<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:59FromDiscord_<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:36FromDiscord_<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:13FromDiscord_<Shield> sorry that was to rayman22201
02:07:38FromDiscord_<me2beats> oh ok
02:08:35rayman22201oh, lol. I don't know. You are the guinea pig @Shield But we appreciate your efforts :-)
02:10:47FromDiscord_<Shield> lol
02:11:24rayman22201@me2beats. I don't understand your problem. Everything works when you copy the SDL2.dll to the same folder as the exe?
02:11:58rayman22201Yuri, the author of that lib is occasionally in this irc channel, but he is probably sleeping now
02:13:51FromDiscord_<Shield> he's compiling to android
02:14:20FromDiscord_<Shield> I actually didn't manage to compile for android on windows, the sdk is a shitshow
02:16:26FromDiscord_<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:44rayman22201It's been years since I've done any android :-/
02:16:46*laaron quit (Remote host closed the connection)
02:17:02rayman22201what are the errors you get when compiling for Android?
02:17:32FromDiscord_<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:58rayman22201what nim version are you using?
02:18:02FromDiscord_<me2beats> and finally every time nakefile.exe reports abnormal shutdown
02:18:18FromDiscord_<me2beats> The current version
02:18:38rayman22201you have to be more specific? nightly, 0.20.2, 0.19.6?
02:18:58rayman22201at a command prompt do nim -v
02:19:38*actuallybatman quit (Ping timeout: 268 seconds)
02:19:52rayman22201leave 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:54FromDiscord_<me2beats> 0.20.2
02:21:09*darithorn quit (Read error: Connection reset by peer)
02:24:04FromDiscord_<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:27rayman22201sure, don't use nimx :-P
02:24:49rayman22201try the nightly build
02:25:06rayman22201there was some windows path issues that were fixed recently I believe
02:25:27rayman22201How did you install Nim?
02:26:08FromDiscord_<me2beats> From official site
02:26:23rayman22201in fact, he says right in the readme: "Nimx is tested only against the latest devel version of Nim compiler. "
02:27:32rayman22201ok. Try this version instead: https://github.com/nim-lang/nightlies/releases/tag/2019-08-28-devel-20dec10
02:28:14rayman22201just remove the old nim folder, and reinstall using that version.
02:30:19FromDiscord_<me2beats> Ok I'll try to install devel, thanks
02:31:23rayman22201cool :-)
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:45FromGitter<iffy> @mratsim @rayman22201 k, filed the concept bug: https://github.com/nim-lang/Nim/issues/12082
02:46:46FromGitter<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:47rayman22201@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:05FromGitter<iffy> lemme try
02:52:59FromDiscord_<me2beats> well using devel it starts to download some `gradle`
02:53:24FromGitter<iffy> it works if I import in file2 instead of file1 (I'll update the issue)
02:53:28rayman22201@me2beats. That is a good sign. gradle is necessary to compile Android.
02:53:30FromDiscord_<me2beats> so it seems I'm on the right way
02:53:45rayman22201@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:15rayman22201You should mention that in the issue
02:54:46rayman22201but the example as you have it in the github issue is a good minimal repro.
02:59:24FromDiscord_<me2beats> oh, `cannot open main.nim` again:(
03:02:33FromGitter<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:26rayman22201I'm not sure if nake supports this. can you pass the `--verbosity:2` flag when you run?
03:08:54FromDiscord_<me2beats> this is for nimx. can I try wiish?
03:15:09*a_chou quit (Ping timeout: 250 seconds)
03:20:06FromDiscord_<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:56FromDiscord_<me2beats> and this https://pastebin.com/C1vUJ1bC
03:26:33rayman22201you need the NDK
03:27:21rayman22201or specifically it looks like the NDK version you have is corrupted or missing something
03:28:18rayman22201idk what nake is doing, but the old fashioned way would be to use android studio to download the appropriate libraries.
03:34:24FromDiscord_<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:28shashlick@shield I've tabled feud
03:47:44shashlickSpent too much time getting nothing out of it
03:48:13shashlickNot sure when newruntime will support tables, sets and other stuff that I use
03:48:22shashlickPlus libs I depend on
03:49:37FromDiscord_<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:37FromDiscord_<me2beats> droidManifest.xml; lineNumber: 19; columnNumber: 19; Element type "activity" mus
03:49:37FromDiscord_<me2beats> t be followed by either attribute specifications, ">" or "/>".
03:50:27shashlickFolks 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:50FromDiscord_<Shield> back to square 0 I guess...
04:10:19FromDiscord_<me2beats> @iffy got that errors trying to install wiish
04:10:23FromDiscord_<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:30FromDiscord_<Shield> this looks ugly
04:19:30FromDiscord_<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:31leorizemy 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:19owlwhat 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:34rayman22201no difference: https://nim-lang.github.io/Nim/manual.html#procedures-method-call-syntax
05:44:14shashlickToo 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:16rayman22201I'm in the same time zone as SF, does that count? :-P
06:01:01*leorize quit (Remote host closed the connection)
06:01:05shashlick)
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:10alexander92i feel like
06:24:22alexander92stuff.high .. stuff.low should somehow be a compile error
06:24:44alexander92or <literal> .. <smaller literal>
06:25:05*laaron joined #nim
06:25:15alexander92it 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:41Araq"fails in surprising ways?" it iterates 0 times
08:05:50Araqjust 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:47alexander92Araq, yes, but when is the intention
09:30:47*absolutejam joined #nim
09:31:27alexander92to 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:39alexander92of 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:06Araqit's a race to the bottom
09:59:46Araqthe 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:01alexander92i 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:52alexander92of 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:03Araqwell yeah it's an idiom and you *think* it does something it doesn't do
10:41:27Araqand it never did and comparable idioms in other languages don't do it either
10:49:05*clyybber joined #nim
10:49:21alexander922 .. 5 is idiom
10:49:37alexander922 .. -5 is a logical error
10:49:55alexander92it never makes sense to use that, so no harm in reporting it
10:50:15alexander92but i agree, no need to add it to nim, but i still see it as good error message design
10:55:18Araq0 .. len - 3 # I use it *all* the time
10:55:26alexander92but this is different
10:55:30alexander92i explicitly
10:55:41alexander92said "literal" or .high / .low
10:55:56Araqthat's true and yeah we could warn about it
10:56:02Araqsomehow
10:56:20alexander92of course, a .. variable is very useful
10:57:49alexander92oh God, i forgot to PR the await
10:58:50FromGitter<arnetheduck> should put a warning next to every use that quite unusually, it's an inclusive range :)
11:07:33clyybberAraq: Btw, do you still think that iterators having a seperate namespace is a design mistake?
11:08:09Araqyeah
11:10:21*endragor quit (Remote host closed the connection)
11:25:13FromGitter<mratsim> distinct types have some many semcheck issues :/
11:27:06FromGitter<arnetheduck> ranges too :) `range[0'u32..5'u32]` typechecks both as an unsigned and signed integer for example
11:28:01FromGitter<arnetheduck> lots of tricky issues with ranges in fact
11:28:16FromGitter<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:23FromGitter<mratsim> I lost the fight against the compiler
11:28:43FromGitter<mratsim> oh I tried to use distinct static ranges actually
11:29:18clyybberBut ranges are static anyways?
11:29:50Araqnot every case of "in my mind this should compile" is actually a compiler bug, you know.
11:32:17FromGitter<mratsim> with static/distinct/ranges I'm confident it is :P
11:33:02FromGitter<mratsim> though static is a good place now.
11:33:09FromGitter<mratsim> in a good place*
11:33:57FromGitter<mratsim> I can even use static to workaround issues in openarrays: https://github.com/nim-lang/Nim/issues/6343
11:39:19clyybberI think static is very cool, especially for manual optimization purposes
11:39:45*abm joined #nim
11:40:33FromGitter<arnetheduck> I think `static` is often kind of dumb - `inline` and `register` lost their original meaning in `c` for good reason
11:41:49clyybberarnetheduck: 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:04clyybberBut the reality is that it is not.
11:43:24*LargeEpsilon quit (Quit: Leaving)
11:43:28clyybberAnd many optimizations are better outsourced to the people that have better knowledge on the kind of things they are implementing
11:43:42clyybberLike mratsim :)
11:44:54FromGitter<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:50FromGitter<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:35clyybberThankfully the C compiler is around to do some of that for us.
11:46:37FromGitter<arnetheduck> it's 2019, full ctfe is kind of not a big deal any more
11:47:37FromGitter<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:50clyybberarnetheduck: Full ctfe is only practical for simple input -> output programs
11:48:30FromGitter<arnetheduck> well, it's practical everwhere where static is, by definition :)
11:48:40clyybberarnetheduck: Yeah
11:48:52FromGitter<arnetheduck> ... so that makes static noise...
11:49:21clyybberarnetheduck: It is noise, assuming a perfect optimizing compiler.
11:49:38Araqiffy: wanted to tell you but forgot about it :P
11:50:01clyybberBut in reality new optimization techniques emerge and there is not a single compiler who implements them all.
11:51:46FromGitter<arnetheduck> no, but are these obsolete compilers worth the burden you place on developers to understand the nuance of the feature?
11:52:49clyybberarnetheduck: It's not a feature thats hard to understand
11:53:47FromGitter<arnetheduck> no feature is hard to understand in isolation when you know it alreadyt
11:54:53clyybberarnetheduck: 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:42clyybberarnetheduck: 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:57Araqfor me 'static' is really hard and I question its soundness
11:58:04Araq:D
11:59:11Araqif 3's type is 'int literal(3)' why does it match 'static int' even better than that?
11:59:42Araqwhat kind of type relation is this? "oh, that's an exact match, but right over there there is a super-exact match"
12:00:29FromGitter<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:30FromGitter<mratsim> static is mostly about type for me
12:03:40FromGitter<mratsim> being able to size an array for example
12:04:03FromGitter<mratsim> or static enum on x86, vs ARM vs ...
12:04:19FromGitter<mratsim> most of my optimizations involve runtime dispatch
12:05:07FromGitter<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:18Araqthere is no doubt 'static T' is really useful
12:06:33*Kaivo joined #nim
12:07:49Araqanyway we're in good company, turns out Haskell programmers never understood the Sieve of Eratosthenes
12:07:54Araqhttps://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf
12:08:35*rockcavera joined #nim
12:09:46FromGitter<mratsim> but that's old news
12:10:48*absolutejam quit (Ping timeout: 272 seconds)
12:11:17FromGitter<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:32Araqah, I'm living in the past
12:11:34Araqok
12:12:47FromGitter<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:11clyybberAraq: IMO int literal is the unsound part there
12:19:30Araqplease elaborate
12:20:31FromGitter<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:05clyybberWell, isn't int literal the one which matches both int and static[int] ?
12:21:27Araqiffy, yeah we changed how .gensym is implemented
12:21:33narimiran@iffy i think this is the commit which changed that: https://github.com/nim-lang/Nim/commit/b07694cd90ab7c6eb4660971ddb818b461d4eed8
12:21:46clyybberIn 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:51narimiran(and it is the commit that disabled argparse, so yeah :))
12:23:09clyybberBut int literals dont work that way, because of ergonomics. And thats fine I guess, but not any less "sound" than static IMO
12:23:31clyybbers/"sound"/"unsound"
12:24:11Zevviffy: is this problematic for your?
12:25:23FromGitter<iffy> Zevv: Only minorly. I just fixed argparse to work with the new devel, so not a problem.
12:25:23alexander92*is afraid to upgrade*
12:25:59Araqclyybber: maybe 'int literal' also has problems but my point applies to all T
12:26:28Araq"abc" is of type string, not of type 'static string'
12:26:37Araqand yet 'static string' is a better match
12:26:58Araqnow ok, we can change how literals are typed so that they get the 'static'
12:27:24FromGitter<arnetheduck> actually would be nice to detect static string literals because these are memory-managed differently
12:28:25*absolutejam joined #nim
12:28:34clyybberAraq: Yeah, as I said. The most sound way would be for "abc" to be a static string IMO
12:28:38FromGitter<arnetheduck> oops, I just argued for static ;) in types it's nice, it's the parameter use that I mostly dislike
12:35:14Araqno for parameters it's actually quite tame (you don't have to like it though)
12:35:49Araqbut 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:24Araqhow is 'static seq[string]' different from 'static seq[static string]'?
12:36:45Araqis it different? who knows. certainly not the compiler
12:36:55*owl quit (Ping timeout: 268 seconds)
12:38:22clyybberAraq: IMO static should apply to the "whole" type, so only allow `static T`
12:38:54clyybberand not `whatever[static T]`
12:41:36FromGitter<mratsim> same question will happen with owned
12:42:08clyybberIt'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:14FromGitter<mratsim> how is owned seq[string] different from owned seq[owned string]
12:42:29FromGitter<mratsim> but we can just build a constraint solver in the compiler for that :P
12:42:33Araqfor sink and owned the issue is solved
12:42:48Araqeven though you apparently doesn't know the answer
12:42:55Araq*don't
12:43:16Araqbut clyybber's point is good
12:43:40Araqthe 'static' qualifier moves to the front of the type
12:43:45clyybbermratsim: For owned its simple.
12:44:02FromGitter<mratsim> that was just an example ;) don't worry
12:45:04*MarderIII quit (Quit: Leaving)
12:45:06FromGitter<arnetheduck> what about `seq[sink static T]`? :)
12:45:11clyybberAraq: How does sink deal with it in parameters?
12:45:50clyybberarnetheduck: -> `static seq[sink T]`
12:46:11clyybber-> `static sink seq[T]` (?)
12:47:22FromGitter<mratsim> does it even make sense to sink a static?
12:47:27Araqno.
12:47:45clyybberIt makes sense in a static context no?
12:48:07clyybberNevermind that.
12:48:14FromGitter<mratsim> you would use a {.compileTime.} proc instead
12:49:07Araqthere is no 'seq[sink T]'
12:49:30clyybberAraq: Thought so, just like there should be no 'seq[static T]
12:49:32Araqsink moves to the front
12:49:44FromGitter<mratsim> my future signatures: `proc foo(x: distinct sink seq[range[0 .. 0xFFF]]): lent range[0 .. 0xFFF] =`
12:50:10FromGitter<mratsim> (still better than Rust and C++)
12:51:45Araqyay...
12:51:46Araq:D
12:55:53*alexander92 quit (Ping timeout: 258 seconds)
13:00:50*PMunch quit (Remote host closed the connection)
13:02:50clyybberhttp://ix.io/1TLh this does not compile?
13:03:17clyybberError: attempting to call routine: 'sink'
13:07:26Araqold Nim?
13:07:55clyybberLatest devel..
13:08:04clyybberCan you reproduce?
13:08:35Araqno.
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:28clyybberCleared my nimcache, ran koch boot, still the same error.
13:14:43FromDiscord_<Shield> it compiles on 0.20.99
13:14:45*Kaivo quit (Quit: WeeChat 2.5)
13:15:01*Kaivo joined #nim
13:15:28clyybberI'm on 0.20.99, git hash: d0e5bd23..
13:16:01clyybberOoooooh
13:16:36clyybberIt's because the file was named sink.nim
13:18:08*alexander92 joined #nim
13:19:04FromDiscord_<Shield> the compiler doesn't like certain names?
13:19:18*alexander92 quit (Client Quit)
13:19:32*alexander92 joined #nim
13:22:18Araqclyybber: lol, common gotcha
13:22:38Araqwe fixed plenty of bugs about this, but apparently it's never good enough
13:24:36disrupteki sometimes wish i could use a hyphen in a module name.
13:25:20Araqyeah, it's a common request
13:25:29Araqwe will support it
13:25:48disrupteknot a big deal; underscore works, right?
13:26:18Araqsure
13:28:22shashlick@Araq has tables been ported to newruntime?
13:28:35disruptekwrt 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:14Araqdisruptek: well I don't understand your current PR
13:29:35Araqshashlick: it's covered by a test fwiw
13:31:28Araqclyybber: working on https://github.com/nim-lang/Nim/issues/12037 ?
13:31:45disruptekmy pr allows you to render an identifier which clashes with a keyword, eg. proc foo(`type`: string)
13:31:46shashlickOk then I might try newruntime on feud
13:32:30clyybberAraq: Ha, I just started looking into it :D
13:32:58Araqlooks 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:41FromGitter<vitreo12> Is anyone using Emacs' nim-mode? Is flycheck / flymake working for you?
14:10:40*actuallybatman joined #nim
14:11:06FromGitter<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:05FromGitter<vitreo12> The file is quite simple, as you can see.
14:15:21FromGitter<vitreo12> And it compiles, but yet flycheck lints all these errors for no reason
14:17:17FromGitter<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:07VirxesHi 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:08disruptekyes, parens are optional when calling a proc with arguments; otherwise, they are required.
14:22:30*laaron joined #nim
14:23:04alexander92oh, that explains one problem i had
14:23:09alexander92ty
14:23:10*theelous3 quit (Ping timeout: 272 seconds)
14:23:40disrupteksweet.
14:24:05VirxesRight, 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:26VirxesJust curious how functions can be passed around and/or stored in variables or constants.
14:25:02disruptekare you sure readline isn't a template?
14:25:12VirxesI believe it's a proc in the io module.
14:25:39VirxesI'm very new/ignorant still, excuse the baby steps :)
14:26:02disrupteki'm fairly new, too; let me look into that.
14:26:10Virxesthank you
14:26:52Virxeshttps://nim-lang.org/docs/io.html#readLine%2CFile
14:26:59VirxesI think that's the one
14:27:15alexander92it's probably
14:27:17alexander92overloaded
14:27:19alexander92if you write
14:27:21alexander92stdin.readline
14:27:23alexander92it seems to work
14:27:44alexander92hm nevermind, that's just calling it
14:27:46Virxeswrite, which is UFCS for `readline(stdin)`
14:27:55Virxess/write/right/g
14:28:28alexander92you're correct
14:28:49VirxesNim 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:26alexander92but still, the problem is overloading imo
14:29:33alexander92because there are two readLine-s in io
14:30:00Virxesah, I think I understand what you mean -- it doesn't know which one to grab.
14:30:14VirxesI'd have to define a `proc` type that matches the signature of the one I want to store.
14:30:32disruptekexactly.
14:30:42disruptektype RLType = proc(f: File; line: var TaintedString): bool
14:30:47disruptekvar foo: RLType = readline
14:30:59Virxesok, cool. I have a play with it, then. Thanks!
14:31:22alexander92yes, the disruptek solution is pretty clean
14:31:29alexander92another not so clean solution is to var rl = (proc(f: File): TaintedString)readline
14:31:43alexander92this is an oneliner, but admittedly it might look less clear
14:34:04VirxesWorks 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:43juturnasStruggling 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:43juturnas 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:18Araqjuturnas: 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:11FromDiscord_<me2beats> @iffy, guys: can I use both stable and devel nims?
17:24:18clyybberAraq: Should there be use `addr(something)` or should it recurse to use `something`
17:24:44clyybberme2beats: Sure, are you on linux or windows?
17:24:51FromDiscord_<me2beats> Win
17:25:39clyybberOh, then I don't know really. I would have suggested symlinking, but I haven't done that on windows yet
17:25:44Araqclyybber: what do you mean?
17:26:14clyybberAraq: Is it intended for "use addr(sq[0])" to be in the cfg
17:26:34Araqwell certainly, it's a usage
17:26:36clyybberor should it be resolved to "use sq[0]" in dfa.nim:gen
17:26:54AraqI don't think so
17:27:03Araqdon't throw away information
17:27:23clyybberOk, so the problem is not in gen
17:27:26Araq'use addr(...)' is fine we already have some crazy node matching mechanism
17:27:45Araqyeah we are missing some 'skip(nkAddr)' logic somewhere
17:27:53clyybberYeah
17:28:32clyybberI thought so too, so I added it to aliases and analysableFieldAccess, but that doesnt work
17:28:49Araqhmmm
17:28:58Araqbut it seems to be the right idea
17:29:19clyybberIs nkAddr first child the node we should skip to?
17:29:20Araqme2beat: the differences are not great, use stable
17:29:39Araqyeah
17:29:51Araqalso don't forget nkHiddenAddr that requires the same
17:29:59clyybberYep, did that too
17:35:12juturnasAraq thanks, I'll try that out
17:35:50Araqjuturnas: requires 'import threadpool'
17:48:38*Trustable quit (Remote host closed the connection)
17:56:00*owl quit (Ping timeout: 244 seconds)
17:56:53FromDiscord_<me2beats> Guys what do I need to place in SDL_HOME folder? sdl source or just sdl2.dll?
17:57:30FromDiscord_<me2beats> It seems nimX requires this
17:58:05FromDiscord_<me2beats> ok, source, nm
18:02:00*floppydh quit (Quit: WeeChat 2.5)
18:25:14*alexander92 joined #nim
18:26:28FromGitter<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:23FromGitter<awr1> ooo
18:27:24FromGitter<awr1> interesting
18:30:18FromGitter<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:27alexander92i agree with shield
18:33:48alexander92i think having custom allocators wouldn't be so verbose as in zig raynman22201
18:34:03alexander92as you can have them maybe set once for a given type?
18:34:14alexander92or maybe passed somehow implicitly ?
18:34:44*narimiran quit (Ping timeout: 248 seconds)
18:35:55FromGitter<awr1> whenever I end up buying an RPI or a Rock64 i will do the ARM features
18:36:22alexander92we actually have it
18:36:24alexander92localAllocator
18:36:29alexander92setLocalAllocator
18:36:30FromGitter<mratsim> > The amount of archaic bullshit in Poonix based OSes is just insane. lol
18:36:33alexander92and getLocalAlocator
18:37:08alexander92you can have a helper that calls stuff like that : withAlloc(dummyAlocator, call(arg))
18:37:20alexander92which just sets a new one and resets it for this call
18:37:28alexander92and no arg pollution
18:37:40FromGitter<awr1> lol https://github.com/awr1/Nim/blame/b9188271384991f22c95cb149a9ab72c8c3ae422/lib/pure/concurrency/cpuinfo.nim#L30
18:37:44FromGitter<mratsim> is that outdated? https://github.com/nim-lang/Nim/wiki/Destructors#allocators
18:38:07alexander92mratsim not sure
18:38:21FromGitter<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:22alexander92i just look at the source of core/allocators.nim
18:38:35rayman22201yes, but I don't think that api is exposed to user code
18:38:41rayman22201you can't implement it yourself
18:38:51FromGitter<mratsim> I think that the plan, to expose it
18:39:01rayman22201that would be awesome
18:39:04FromGitter<mratsim> I asked for a way to have custom seq allocators for Arraymancer
18:39:38rayman22201perfect use case for it
18:39:43FromGitter<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:41FromGitter<mratsim> a more perfect use cas would be for seamless interop with alloca, a memory pool or an object pool
18:41:19FromGitter<mratsim> `type SmallString = distinct string` but you use alloca as an allocator? :)
18:41:34rayman22201I also think zero copy views would be very good, but that seems a bit orthogonal
18:41:38FromGitter<mratsim> though alloca is probably too tricky because you can't use a function
18:41:58FromGitter<mratsim> but a memory pool to avoid repeated alloc could help
18:42:36Araqtalking about toOpenArray again?
18:42:44Araqhint: we have it, we're improving it
18:42:47FromGitter<mratsim> no allocator
18:44:06rayman22201the setLocalAllocator thing in core/allocators.nim and exposing it.
18:44:12rayman22201would be cool
18:44:43rayman22201re: 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:43disruptekthanks for sharing that link on c-reduce.
18:46:15Araqthere was some tool to produce Nim programs that trigger compiler bugs
18:46:32Araqbut we already have so many real bugs that I considered it futile
18:47:19FromGitter<awr1> sounds like something that could be more attractive once nim stabilizes more
18:47:34rayman22201Definitely. Agreed. bigger fish to fry atm
18:48:06disrupteki'd like to see why klee complains about nim output first.
18:49:03rayman22201tangent: 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:40alexander92mratsim i am not yet sure how this all works
18:51:16alexander92but it seems to me
18:51:19alexander92those *are* exposed
18:51:22alexander92in new-runtime
18:51:41alexander92e.g. it seems seq also uses it
18:51:46alexander92so if i provide my own allocator
18:51:56alexander92it should just work ?
18:52:37rayman22201orly? If that's the case, then I misunderstood that code. newruntime needs better docs lol!
18:52:46alexander92rayman22201 all of those seem to use `*`
18:52:56alexander92but i also have no idea, just guessing :P
18:53:11rayman22201I will use the excuse that it was late at night when I looked at it :-P
18:53:12FromGitter<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:35rayman22201@awr1 I used to not believe it, but the more I learn, the more I agree....
18:53:45Araqit's some kind of religion
18:54:04FromGitter<mratsim> @awr1, here you go: https://gist.github.com/mratsim/564254157f565bbf8925dd32e001019c
18:55:19FromGitter<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:28FromGitter<awr1> probe proc/cpuinfo and compare
18:56:07FromGitter<mratsim> I think it's fine like it is now
18:56:22FromGitter<mratsim> you can raise an issue and leave it to someone else :P
18:56:45FromGitter<awr1> once CI is green you should be free to be able to merge
18:57:12FromGitter<mratsim> getting the CI to be green is hard work
18:57:30FromGitter<awr1> appveyor was being weird on one of the commits i did yesterday
18:57:31FromGitter<awr1> https://ci.appveyor.com/project/dom96/nim/builds/27032227/job/r6mixx56qa67c6w5
18:58:10FromGitter<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:10FromGitter<mratsim> it's chronos which is failing on windows according to the logs
19:01:39FromGitter<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:38FromDiscord_<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:23FromDiscord_<Shield> at worst, the user wouldn't have to set anything and everything would use the default allocator
19:26:51AraqShield: the seq remembers the allocator
19:28:00clyybberAraq: Whats the reasoning behind # use x.f; question: does it affect the full 'x' ? No. ?
19:28:09clyybberDoes it mean that x.f doesnt count as a use?
19:28:23clyybberof x
19:29:28Araqthis is tuned for the one question that we ask
19:29:38Araq"is this the last read?"
19:29:56Araqit's subtle and not symmetric
19:30:30Araqif we use 'x.f' we don't use all of 'x', 'x.f2' can still be read from
19:30:46clyybberAh, fine.
19:31:01clyybberI think theres some weird logic in aliases
19:31:12clyybberOr maybe thats intended, dunno
19:31:15Araqcertainly
19:31:25clyybberWhen theres a nkBracketExpr we break and return false?
19:31:41clyybberso sq[0] doesn't count as an alias to sq
19:32:30clyybberI should reword, aliases doesn't return true for params: sq1, sq1[0]
19:32:34clyybberIs that intended?
19:32:53Araqwell there is some bug in there, that's why you're looking at it
19:33:42clyybberYeah, but I'm asking if this sounds like its intended
19:34:05clyybberAs in, should aliases check for field access of a seq, or should it not
19:34:42FromDiscord_<Shield> I've seen that objects too hold a pointer to an allocator
19:34:42AraqI 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:07Araqwe do know that s[i] aliases s though, and that's probably where the bug lies
19:36:43clyybberAraq: I wonder how that hasn't been catched yet
19:36:56alexander92oh yeah i managed to use a custom allocator Shield
19:37:15alexander92i just have to remember never to `include core/allocators`
19:37:21alexander92always to import it
19:37:25alexander92dunno what i thought
19:38:32alexander92i can even make it segfault now, amazing
19:41:39FromDiscord_<Shield> would like to see what you're done with it
19:42:00FromDiscord_<Shield> I think only inheritable objects get that extra allocator pointer but not normal structs?
19:42:35*absolutejam1 joined #nim
19:43:52clyybberAraq: 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:44clyybberAraq: Well removing that check fixes it
19:46:10*tane quit (Quit: Leaving)
19:47:16clyybberAraq: Since you wrote that piece of code, could it be possible that you got the branches mixed up?
19:47:29clyybberAnd whats the intention behind that check?
19:50:06FromGitter<awr1> @mratsim i noticed in your gist you have:
19:50:11FromGitter<awr1> hasMmxExt: false, has3DNow: false, has3DNowEnhanced: false
19:50:15FromGitter<awr1> which i find is interesting
19:50:30FromGitter<awr1> i guess they finally took an axe to 3dnow?
19:51:04FromGitter<mratsim> 3DNow was equivalent to MMX iirc
19:51:25FromGitter<mratsim> and mmxext was only for Pentium 3 and was thought a dead end when they release Pentium 4 and SSE2
19:51:34FromGitter<mratsim> I don't really member, but I guess so
19:51:38FromGitter<awr1> it was an extension of mmx for floats
19:51:48FromGitter<awr1> but then SSE cleared that all up
19:52:18FromGitter<awr1> in that case my doc on hasMmxExt is wrong, and that AMD64 is just x87+SSE+SSE2
19:52:25FromGitter<awr1> +base MMX
19:52:25FromGitter<mratsim> I still have the x87 FPU :P
19:52:52Araqclyybber: the intention was
19:53:00Araqa[i] # runtime i
19:53:21Araqvs a[6] # tuple indexing, completely different
19:53:40Araqbut if it works so be it
19:53:45clyybberBut both aliases a, right?
19:54:09*Vladar quit (Remote host closed the connection)
19:54:10FromGitter<mratsim> mmxext is probably emmx on wikichip? https://en.wikichip.org/wiki/intel/core_i9/i9-9980xe#Features
19:54:23Araqyeah
19:54:31AraqI got confused about
19:54:39Araqa[i] vs a
19:54:44Araqand a[i] vs a[j]
19:55:44FromGitter<awr1> i do remember AMD deciding to kill 3dnow (besides `PREFETCH`
19:56:05FromGitter<awr1> but i think maybe wikichip is wrong
19:56:40FromGitter<awr1> check proc cpuinfo
19:57:54FromGitter<awr1> i have MMX but no MMX ext on my skylake mobile :P
20:00:22FromGitter<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:07alexander92how can i easily check
20:03:15alexander92if something is assignable in a template
20:03:33alexander92something like "when b is void: b else: var a = b"
20:04:50alexander92and without "when compiles(a = b)"
20:04:55FromGitter<mratsim> when in doubt, when compiles() is your friend
20:05:29FromGitter<mratsim> you can use a concept? :P
20:06:08FromGitter<mratsim> type Assignable = concept x, var y ⏎ y = x
20:06:46FromGitter<mratsim> I do not guarantee the absence of impact on your compilation times
20:07:30*nsf joined #nim
20:07:31clyybberAraq: Should I use doAssert or assert in tests?
20:07:40clyybberDoesn't matter does it?
20:08:41FromGitter<mratsim> doAssert
20:08:49narimiran_it doesn't matter
20:09:02FromGitter<mratsim> we might want to run tests in release mode though
20:13:49FromGitter<awr1> doAssert yeah
20:14:14FromGitter<awr1> idk if we run tests in release rn though
20:14:18FromGitter<awr1> any tests
20:14:26narimiran_i know. we don't. assert is fine.
20:15:28alexander92narimiran, yeah when compiles works
20:15:52alexander92so Shield , i basically
20:15:56alexander92just played
20:15:58alexander92with that
20:25:00clyybberAraq: PR is up https://github.com/nim-lang/Nim/pull/12089
20:25:20clyybberGood night everyone
20:25:25*clyybber quit (Quit: WeeChat 2.5)
20:25:30FromGitter<awr1> gn
20:25:43alexander92e.g. http://ix.io/1TNc or
20:26:43alexander92http://ix.io/1TNa
20:27:07alexander92the last one creates a `withAlloc` macro which seems to work for me in a limited usecase
20:28:11alexander92but my allocators themself are just dummy placeholders mostly
20:30:06juturnasIs there an idiomatic way to poll over multiple channels, or combine channels?
20:33:51Araqchannels are seriously under-developed in Nim, most use async instead
20:34:25*narimiran_ quit (Ping timeout: 246 seconds)
20:35:05juturnasHmm okay. Is it pretty straightforward to integrate C code with async?
20:36:18FromGitter<mratsim> C in general is straightforward to use
20:36:29FromGitter<mratsim> C code*
20:37:29FromGitter<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:08juturnasThanks for the link
20:38:25FromDiscord_<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:13FromGitter<mratsim> Given how many game devs are in Nim, mixing freely regions with normal GC code would be super useful for them
20:40:38FromGitter<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:42disrupteki thought that was the point of regions.
20:42:21FromGitter<mratsim> alternatively you can also directly pull symbols from a dynamic library without the header but that is less often used
20:42:31FromGitter<awr1> mixing GC and regions could be highly attractive for an engine
20:42:54FromDiscord_<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:22FromGitter<mratsim> if you compile with gc:regions it's one region for everything at the moment
20:43:34FromGitter<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:40FromGitter<awr1> or newruntime or w/e
20:44:02FromGitter<awr1> also the pause-on-demand stuff is also highly attractive for game engines
20:44:14FromGitter<mratsim> Java mark and sweep on demand? :P
20:44:38FromGitter<awr1> specifically this https://nim-lang.org/docs/gc.html
20:44:52alexander92Schield : yes, thats my idea
20:45:09alexander92but more like the zig/c++ passing allocators thing
20:45:16alexander92just more implicit
20:45:24alexander92i haven't used regions much
20:45:25FromGitter<mratsim> that would be super useful for machine learning as well
20:45:46*nsf quit (Quit: WeeChat 2.5)
20:45:57Araqyeah allocators and regions are related
20:46:00FromGitter<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:45FromGitter<mratsim> but I'm not too worried for that I can do it in my lib.
20:47:18FromGitter<mratsim> It could also help to set a memory pool for strings just before heavy string processing.
20:47:26alexander92but 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:59FromGitter<mratsim> can't we have a per type allocator otherwise?
20:48:00disruptekit uses the one for the type.
20:48:11FromGitter<mratsim> and we could maybe define it as a pragma
20:48:19alexander92i think that's how it works
20:48:27alexander92but i wonder if i can override it
20:49:03FromGitter<mratsim> type Foo{.allocator: MyRegionAlloc.}[T] = distinct seq[T]
20:49:06FromDiscord_<Shield> per type allocator would only be good if you're allowed to change the allocator using aliasing or distinct
20:49:39FromGitter<mratsim> or if it applies to the subfields of the type
20:49:42FromGitter<mratsim> mmmh
20:49:50FromGitter<mratsim> distinct is a bit too broken :/
20:50:20alexander92mratsim but that's the thing: i expect that if i override setLocalAllocator(), your new type instances would start to respect it
20:50:29alexander92and the old one-s would keep using MyRegion
20:50:32alexander92similar to seq-s
20:50:52FromGitter<mratsim> maybe like this ⏎ type Foo = object ⏎ myField{.allocator: MyRegionAlloc.}: seq[int]
20:51:05FromDiscord_<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:55FromGitter<mratsim> basically setLocalAllocator boils down to: were we happy with how shallow() worked
20:52:06alexander92but i still dont understand the need of regions, if one can have custom allocators: some kind of type safety?
20:52:18FromGitter<mratsim> and @Shield, per type allocator would also work with object if it's implemented like the shallow pragma
20:52:47disruptekbecause sometimes you want to share types without sharing their allocator.
20:52:53disruptekeg. strings ;-)
20:52:58alexander92yep
20:53:20FromGitter<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:46FromGitter<mratsim> maybe we need a RFC to collect use-case?
20:54:25FromDiscord_<Shield> and wouldn't custom allocators make it easier to make shared memory without having to recreate new types
20:54:35FromDiscord_<Shield> for multithreading
21:07:07alexander92@mratsim sounds good
21:08:13alexander92i wrote a simple rfc for my thoughts just to have it there
21:10:27FromGitter<awr1> oh god emacs is freezing when i isearch
21:10:45alexander92but if you have a rfc for type allocators , i'd love to read it
21:11:46FromGitter<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:44FromDiscord_<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:34FromGitter<mratsim> -d:UseMalloc and Valgrind
22:34:29FromDiscord_<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:24rayman22201I haven't tried it, but I remember someone trying https://drmemory.org/
22:43:58rayman22201I think it was @zacharycarter?
22:44:01*actuallybatman joined #nim
22:46:30shashlickhow about https://software.intel.com/en-us/system-studio/system-debugger
22:51:43*actuallybatman quit (Ping timeout: 245 seconds)
23:08:25FromDiscord_<Shield> great, drmemory works! now lemme check those thousands possible errors and memory leaks on a skeleton opengl application
23:09:04rayman22201sweet :-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)