00:00:23 | disruptek | you can convert X to Box-holding-X-or-Y-or-Z and then you have a HashSet[Box]. |
00:00:39 | Prestige | ah. |
00:00:59 | disruptek | if you want to unbox automagically, you can do that, too. |
00:03:13 | * | astronavt quit (Ping timeout: 260 seconds) |
00:08:02 | * | krux02 quit (Quit: Leaving) |
00:10:23 | ForumUpdaterBot | New thread by Fxn: SIGILL: Illegal operation with an var parameter, see https://forum.nim-lang.org/t/7039 |
00:22:28 | * | mbomba joined #nim |
00:37:47 | * | astronavt joined #nim |
00:41:13 | FromDiscord | <tinygiant> Iterating over a sequence, I need to delete some entries after evaluation. Deleting in place throws an error. I can think of a couple different ways to mark them for deletion after the loop completes, but wondering if there's a best practice way to do this in nim. |
00:49:34 | mipri | no, the best option obviously depends on the data. if you don't want to think about I'd just add what should be saved to a new seq. |
00:51:20 | FromDiscord | <tinygiant> That's was going to be my goto. It's just a set of keys (strings). Thanks! |
00:52:33 | FromDiscord | <ElegantBeef> Curious about the data you have/logic to remove |
00:54:05 | * | nekits07 quit (Ping timeout: 240 seconds) |
00:55:31 | FromDiscord | <ElegantBeef> @tinygiant cause depending on your data there is the `sequtils` which can filter out unwanted values in more elegant matter |
00:56:51 | Prestige | I have a hashset with a single item. When I iterate over the set and compare if item == myItem, it is true. After, I check if mySet.contains(myItem), it is false. What's up with this? My item is a ref object, if that matters here |
00:58:14 | FromDiscord | <tinygiant> Essentially need to compare a sequence in one file with the same sequence in another file. If both have the sequence existing, combine them, if one is missing, neither should have them, so have to delete that sequence member. But if it's from the one I'm iterating over, it throws an error. @ElegantBeef |
01:00:18 | Prestige | It seems like the object is cloned or something, instead of using the same ref? |
01:00:29 | FromDiscord | <ElegantBeef> What's your hash func? |
01:00:49 | Prestige | hmm it's using the pointer |
01:01:00 | Prestige | er, unsafeAddr |
01:01:19 | FromDiscord | <tinygiant> @ElegantBeef That sounded odd after I read it. I'll try again. I have two files, both with the same set of keys, but different values. Some of the values are themselves sequences. Some files have these sub-sequences, some don't. If they both have the key with a sub-sequence, I need to combine the sub-sequences into one and put it into the first file. If the second file is missing the sub-sequence, but the first one has it, need to |
01:01:28 | FromDiscord | <ElegantBeef> The address of the ref, dont you want `t[].unsafeaddr`? |
01:01:32 | FromDiscord | <ElegantBeef> where T is your object |
01:02:29 | Prestige | aha, that was it. Thanks |
01:02:40 | Prestige | I didn't realise I was getting the wrong addr |
01:04:13 | FromDiscord | <ElegantBeef> Hey i'm surprised i caught it myself https://play.nim-lang.org/#ix=2Dbd |
01:04:39 | FromDiscord | <ElegantBeef> Was just making sure i was right with that link |
01:05:02 | Prestige | Yeah I hadn't thought about it, great catch. Was driving me crazy |
01:05:49 | * | abm quit (Quit: Leaving) |
01:06:25 | FromDiscord | <ElegantBeef> @tinygiant ah yea that specialized logic is something you'll need to write |
01:06:47 | FromDiscord | <ElegantBeef> If it was just keeping values based off conditions, sequtils has you covered π |
01:07:41 | FromDiscord | <tinygiant> @ElegantBeef Copy thanks. It's already done, just wanted to get a feel for the "nim-right" way to mark the keys for deletion. sequtils has the delete procedure, but I don't think I'll know the indices. Thanks for your time. |
01:08:30 | FromDiscord | <ElegantBeef> No problem |
01:12:47 | * | Q-Master quit (Read error: Connection reset by peer) |
01:13:01 | * | Q-Master joined #nim |
01:22:22 | * | Tanger joined #nim |
01:24:10 | * | TomDotTom quit (Remote host closed the connection) |
01:25:09 | * | TomDotTom joined #nim |
01:28:40 | FromDiscord | <AmjadHD> sent a code paste, see https://play.nim-lang.org/#ix=2Dbh |
01:29:12 | FromDiscord | <ElegantBeef> Cause block is scoped |
01:29:38 | FromDiscord | <ElegantBeef> The () behaviour is weird |
01:30:00 | FromDiscord | <AmjadHD> Yeah it doesn't feel right |
01:30:25 | FromDiscord | <ElegantBeef> what you wrote doesnt compile |
01:30:36 | FromDiscord | <ElegantBeef> the `let name =` |
01:30:50 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2Dbi |
01:32:30 | FromDiscord | <AmjadHD> (edit) sent a code paste, see https://play.nim-lang.org/#ix=2Dbj |
01:33:26 | FromDiscord | <AmjadHD> I wrote it on the phone |
01:36:35 | ForumUpdaterBot | New thread by Skylabin: Psutil package creation for ARM on Raspberry Pi OS, see https://forum.nim-lang.org/t/7040 |
01:38:28 | Prestige | I'm trying to use a glob in a nimble task to run tests multiple directories down - it works in my shell, but not from a nimble task. Is there a better way to do this, or have it behave as if it were ran from my shell? I'm using: |
01:38:30 | Prestige | for i in tests/**/*.nim; do nim c -r --multimethods:on "$i"; done |
01:38:55 | Prestige | It seems to only get the files in the first level of tests |
01:47:36 | disruptek | well, yeah, glob isn't a think despite attempts to pr otherwise. |
01:47:42 | disruptek | s/think/thing/ |
01:48:16 | disruptek | just write a 3-line walkdir. |
01:48:23 | * | bunbunbunbunny joined #nim |
01:48:42 | FromDiscord | <ElegantBeef> @AmjadHD well if you can get a runnable example i'd like to see it π |
01:55:05 | FromDiscord | <ElegantBeef> Assuming you mean something like this https://play.nim-lang.org/#ix=2Dbo |
01:55:29 | FromDiscord | <ElegantBeef> `()` can be used for grouping logic visually but as the AST shows it doesnt do anything aside from taht |
02:03:40 | * | nekits07 joined #nim |
02:13:38 | FromDiscord | <nikki> hmm seems like there's no way to mark parameters as `{.cursor.}` right π€ |
02:14:09 | FromDiscord | <nikki> i guess i could take a `ptr` and do `.addr` |
02:22:29 | * | apahl_ joined #nim |
02:25:30 | * | apahl quit (Ping timeout: 260 seconds) |
02:34:40 | * | dom96 quit (Ping timeout: 256 seconds) |
02:35:14 | * | go|dfish quit (Ping timeout: 256 seconds) |
02:38:45 | * | dom96 joined #nim |
02:38:45 | * | dom96 quit (Changing host) |
02:38:45 | * | dom96 joined #nim |
02:40:26 | * | go|dfish joined #nim |
02:46:04 | FromDiscord | <treeform> @disruptek and @Clyybber , So I wrote this: https://github.com/treeform/uriiy thoughts? |
02:57:49 | Prestige | looks useful |
03:10:14 | * | muffindrake quit (Ping timeout: 264 seconds) |
03:11:19 | FromDiscord | <Rebel> Hypothetically speaking is it possible to write a linux rootkit in Nim? If possible hypothetically speaking of course how hard would it be to write on a scale from 1-10? |
03:11:19 | bung | Can I simply get table's data bytes size ? |
03:12:16 | * | muffindrake joined #nim |
03:22:57 | Prestige | @Rebel depends on what your rootkit is doing, and your experience with writing them :P |
03:23:41 | FromDiscord | <Rebel> Translating from C to nim while following a pretty decent guide? |
03:24:39 | Prestige | Still depends on what the rootkit does. Should just give it a shot |
03:26:23 | FromDiscord | <ElegantBeef> Why does it matter prestige? |
03:27:41 | Prestige | Doing things like altering specific memory addresses might be annoying, or learning how to disable the GC and manually manage the memory |
03:28:03 | Prestige | If you already have C experience it might be easier to just write it in C |
03:28:37 | FromDiscord | <Rebel> ftrace hooking, backdooring root (by hooking kill), backdooring PRNGs by interfering with char devices, hiding kernel modules from userspace, and hiding directories. |
03:29:37 | FromDiscord | <Rebel> I know I can write in C lol just curious if it was possible to write in Nim for fun? |
03:30:06 | Prestige | Should be possible afaik |
03:32:34 | FromDiscord | <Rebel> Guess you gotta just give it the old scientific method. |
03:33:55 | FromDiscord | <ElegantBeef> It's possible |
03:34:02 | FromDiscord | <ElegantBeef> You can always use Nim like C with fancy features |
03:34:49 | * | mbomba quit (Quit: WeeChat 2.9) |
03:35:17 | FromDiscord | <nikki> yeah u can basically call out to any C function or even just emit particular C code from nim |
03:35:37 | FromDiscord | <nikki> and i think the 0-10 difficulty would be mostly composed of the difficulty of the topic itself vs. the C / Nim difference in this case |
03:58:21 | * | vicfred quit (Quit: Leaving) |
04:06:02 | * | supakeen quit (Quit: WeeChat 2.9) |
04:06:33 | * | supakeen joined #nim |
04:28:14 | FromDiscord | <iWonderAboutTuatara> is there a way for me to get the sha 256 of a file? |
04:29:05 | FromDiscord | <iWonderAboutTuatara> I don't mind remaking the wheel, if it isn't as horrible as jpeg encoding |
04:30:24 | FromDiscord | <ElegantBeef> Nim's got a md5 module which gets the checksum |
04:31:39 | FromDiscord | <ElegantBeef> You could use the nimcrypto package possibly but idk, i know it has sha256 |
04:32:07 | FromDiscord | <iWonderAboutTuatara> I'll look into both of those |
04:32:22 | FromDiscord | <iWonderAboutTuatara> actually that's a very good point, I don't need the hash necessarily I just need the checksum |
04:32:25 | FromDiscord | <iWonderAboutTuatara> md5 is enough |
04:32:27 | FromDiscord | <iWonderAboutTuatara> thanks! |
04:32:31 | * | mbomba joined #nim |
04:33:06 | FromDiscord | <ElegantBeef> No problem |
04:58:59 | * | astronavt quit (Ping timeout: 265 seconds) |
05:02:36 | * | Tlangir joined #nim |
05:02:37 | * | bunbunbunbunny quit (Ping timeout: 264 seconds) |
05:04:27 | FromDiscord | <tinygiant> WIth a `for xxx in yyy`, is it possible to make `xxx` mutable without introducing a new variable or is it always immutable? |
05:05:06 | * | Tanger quit (Ping timeout: 260 seconds) |
05:07:30 | FromDiscord | <Recruit_main707> There is a way, lemme search for the iterator |
05:09:42 | * | Jesin quit (Ping timeout: 256 seconds) |
05:10:06 | FromDiscord | <ElegantBeef> `for x in y.mitems` is the norm for the stdlib |
05:10:18 | FromDiscord | <Recruit_main707> Yes |
05:10:19 | FromDiscord | <ElegantBeef> most iterators in the stdlib have a `m` version which is mutable |
05:10:21 | FromDiscord | <tinygiant> Meh, I didn't make my question robust enough. In my case, I can't control the `yyy` (i.e. I can't iterate `yyy.mitems`) as it's the result of an assignment from a library I can't modify. I assume this means I can't have a mutable `xxx` without an additional assignment. |
05:10:47 | FromDiscord | <ElegantBeef> Well if the iterator doesnt exist you can make it possibly |
05:10:52 | FromDiscord | <ElegantBeef> What's the object? |
05:13:05 | * | bunbunbunbunny joined #nim |
05:13:15 | FromDiscord | <tinygiant> Recursing through a large set of `key:value` data. I thought about creating a custom iterator, but I'm not sure exactly what makes up the `yyy` (it's buried deep in the bowels of a proprietary library), so not sure I can create an iterator for it. |
05:14:18 | FromDiscord | <Recruit_main707> So, you can do for xxx in yyy:, but not for xxx in yyy.mitems: ? |
05:15:12 | FromDiscord | <ElegantBeef> the `mitems` isnt magical it requires to be implemented `for x in y` internally calls `items` so sadly seems there isnt a great way of handling it, what library is this if i may ask? |
05:16:21 | FromDiscord | <tinygiant> In house custom stuff, unfortunately. Would be nice if it was more accessible, but alas ... |
05:17:27 | FromDiscord | <ElegantBeef> Ah damn |
05:17:40 | * | bunbunbunbunny quit (Ping timeout: 246 seconds) |
05:17:55 | FromDiscord | <tinygiant> Heh, I say that constantly on this project. |
05:18:09 | FromDiscord | <tinygiant> Well, maybe with a different word. |
05:21:28 | FromDiscord | <tinygiant> Well, here's another one:β΅β΅If I have a `Type2` that is a ref object of `Type1`, is it possible to pass a mutable `Type2` into a procedure requiring a `var Type1`? I keep getting an error saying that it's expecting `Type1`, but got `Type2`. However, when I change the procedure to require a `Type1` instead of a `var Type1`, I can pass `Type2` all day long. |
05:22:36 | FromDiscord | <Recruit_main707> Pretty sure neither of those should work |
05:22:55 | FromDiscord | <ElegantBeef> Well var doesnt really matter for references |
05:23:29 | FromDiscord | <ElegantBeef> I guess the `var Type1` requires explict conversion whereas the `Type1` is implictly convertable |
05:23:41 | FromDiscord | <ElegantBeef> Probably for methods |
05:23:48 | FromDiscord | <ElegantBeef> And i guess procs |
05:25:30 | FromDiscord | <ElegantBeef> Point and proof i guess https://play.nim-lang.org/#ix=2DbW |
05:26:05 | FromDiscord | <Recruit_main707> His Type1 is not a ref object afaik |
05:26:15 | FromDiscord | <ElegantBeef> > If I have a Type2 that is a ref object of Type1 |
05:26:36 | FromDiscord | <ElegantBeef> Inheritance really should be done with ref types in Nim as without it things get off |
05:27:39 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2DbX |
05:27:45 | FromDiscord | <tinygiant> @ElegantBeef Thanks for that example, I'll see if that'll get my proc to work the way I want it to. |
05:28:54 | FromDiscord | <ElegantBeef> I dont know if what i posted is a bug or just not supposed to work |
05:30:06 | FromDiscord | <ElegantBeef> @tinygiant like i said though for ref objects var isnt needed |
05:32:55 | FromDiscord | <tinygiant> Well ---> `Error: unhandled exception: wanted to read 4 but only got 0 [IOError]` I don't even know what that means. β΅β΅So, if `Type1 = ref object of RootObj` and `Type2 = ref object of Type1`, can I send a `Type2` into a procedure for modification, or would it have to be assigned as a return from the procedure? It's not accepting the implicit modification method (the `var Type1` method) when I send a `Type2` into it. |
05:33:32 | FromDiscord | <ElegantBeef> you can pass it into a procedure that doesnt have `var` |
05:33:49 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2Dc0 |
05:33:55 | FromDiscord | <ElegantBeef> Implictly converted here |
05:34:07 | FromDiscord | <ElegantBeef> the `var` is the issue i guess |
05:35:05 | FromDiscord | <tinygiant> Yep, I want to modify the Type2, but need to receive a Type1 because the proc recurses itself on a Type1 field. Meh, I think I'll have to rework the design a bit. Thanks for your time. I failed, but I learned something. |
05:35:49 | FromDiscord | <ElegantBeef> Wait what's the issue? |
05:36:07 | FromDiscord | <ElegantBeef> You can look at methods or i can quickly show you something |
05:36:18 | FromDiscord | <tinygiant> What's that? |
05:36:31 | FromDiscord | <ElegantBeef> Methods or what i can show you? |
05:36:40 | FromDiscord | <tinygiant> Latter. |
05:37:44 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2Dc2 |
05:37:50 | FromDiscord | <ElegantBeef> You can cast internally to the types |
05:37:55 | FromDiscord | <ElegantBeef> But i'd really just suggest methods |
05:39:21 | * | njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
05:39:28 | * | njoseph joined #nim |
05:40:38 | FromDiscord | <tinygiant> Which methods do you speak of? |
05:40:57 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/manual.html#methods |
05:41:12 | FromDiscord | <ElegantBeef> They're overridable dynamically dispatched procs basically |
05:42:14 | FromDiscord | <tinygiant> Got it. Thanks for the pointers and examples. Still learning and your help has been invaluable. I'll read through the methods and see if I can adapt the library and my code to get it to work out. |
05:42:32 | FromDiscord | <ElegantBeef> Lol no problem, you overstate my worth π |
05:44:04 | FromDiscord | <tinygiant> It's beddy bye time, have a good night! |
05:44:19 | FromDiscord | <ElegantBeef> Buh bye |
05:52:08 | * | a_chou joined #nim |
05:52:44 | * | bunbunbunbunny joined #nim |
05:56:52 | * | bunbunbunbunny quit (Client Quit) |
06:00:44 | FromDiscord | <tinygiant> @ElegantBeef Side note, your explicit conversion worked (i.e. `type2.type1.proc`. Turns out I was getting an error when I ran it because the files had become corrupted (unknown how, probably the continuous reading/writing while testing) just when I ran the first test to try it out. Rebuilt the files and all is good. I'm able to pass a mutable Type2 throughout the several recursive procedures and end up with the result I need to write |
06:01:10 | FromDiscord | <ElegantBeef> No problem, but your bed seems to be a development environment π |
06:01:30 | FromDiscord | <tinygiant> Maybe. Don't judge me. |
06:07:01 | * | habamax joined #nim |
06:16:12 | * | solitudesf joined #nim |
06:19:18 | * | mwbrown quit (Ping timeout: 260 seconds) |
06:20:04 | * | bunbunbunbunny joined #nim |
06:20:56 | * | narimiran joined #nim |
06:24:30 | * | bunbunbunbunny left #nim (#nim) |
06:25:50 | * | mwbrown joined #nim |
06:30:38 | * | mwbrown quit (Ping timeout: 264 seconds) |
06:31:31 | * | mwbrown joined #nim |
06:42:33 | * | a_chou quit (Quit: a_chou) |
06:54:34 | * | Tanger joined #nim |
07:00:25 | * | Tanger quit (Remote host closed the connection) |
07:01:39 | * | Tlangir quit (Read error: Connection reset by peer) |
07:02:43 | * | Tanger joined #nim |
07:08:12 | * | Jesin joined #nim |
07:16:17 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
07:21:00 | * | sagax joined #nim |
07:38:52 | * | PMunch joined #nim |
07:48:02 | * | xace quit (Ping timeout: 256 seconds) |
07:50:26 | * | mbomba quit (Quit: WeeChat 2.9) |
08:13:27 | * | lum_but_somethin is now known as lum |
08:15:52 | * | tane joined #nim |
08:49:48 | PMunch | Hmm, anyone up for a c2nim challenge? |
08:50:36 | FromDiscord | <ElegantBeef> Nope |
08:50:59 | PMunch | Haha, okay then |
08:51:10 | FromDiscord | <ElegantBeef> What're you wanting to wrap? |
08:51:17 | FromDiscord | <lqdev> what's the challenge PMunch |
08:51:22 | * | Tanger quit (Remote host closed the connection) |
08:51:39 | PMunch | https://bitbucket.org/chromiumembedded/cef/src/master/include/ |
08:51:51 | FromDiscord | <ElegantBeef> Ah... that π |
08:52:59 | FromDiscord | <lqdev> it's c++, good luck wrapping tht |
08:53:01 | FromDiscord | <lqdev> (edit) "tht" => "that" |
08:53:34 | PMunch | I mean, it's been done before: https://github.com/jangko/nimCEF/tree/devel/cef |
08:54:14 | PMunch | It still annoys me that you can't call GCC to read a source file and output a machine readable specification of what is in the file |
08:54:32 | PMunch | It obviously need to understand how to call each procedure in the file.. |
09:13:28 | ForumUpdaterBot | New thread by Gekkonier: I just noticed some for me confusing on the frontpage https://nim-lang.org/, see https://forum.nim-lang.org/t/7041 |
09:16:26 | PMunch | lqdev, oh wait, I just found out that there is a C API as well: https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/ |
09:16:32 | PMunch | Should be vastly easier to wrap |
09:19:23 | bung | guys! please give some more stars to this https://github.com/bung87/amysql for encourage me. Thanks! |
09:23:43 | * | opal quit (Ping timeout: 240 seconds) |
09:24:34 | FromDiscord | <nikki> PMunch: i worked on a thing that used cef before. also embedded love2d + lua into it too lol. anyways cef-- would not recommend. but also it's the main way to do the thing it does, if you happen to need that thing |
09:26:31 | FromDiscord | <nikki> the c api was kinda workable. ended up just doing the c++ stuff tho |
09:26:44 | FromDiscord | <nikki> there's an example proj called "cef_simple_app" or something |
09:27:36 | * | opal joined #nim |
09:28:11 | FromDiscord | <nikki> if you want to embed video etc u ene up needing to link with gstreamer and whatnot |
09:31:02 | PMunch | Hmm, well that's a shame |
09:31:47 | PMunch | Basically the goal was to create my own browser. But I don't actually care about any of the rendering websites stuff, I just want that handled for me so that I can focus on tab management and interface. |
10:14:47 | FromDiscord | <Kiloneie> https://media.discordapp.net/attachments/371759389889003532/774215193533743124/Screenshot_20201106_111435_com.discord.jpg |
10:14:59 | FromDiscord | <Kiloneie> What is causing offtopic not to be on my phone? |
10:16:04 | FromDiscord | <Kiloneie> It started yesterday night... Force stopping didnt fix it |
10:16:42 | FromDiscord | <lqdev> you've folded the primary category |
10:16:50 | FromDiscord | <Kiloneie> Oh... |
10:17:04 | PMunch | Haha :P |
10:17:13 | FromDiscord | <Kiloneie> Channels kept dissapearing lol |
10:17:18 | FromDiscord | <Kiloneie> xD |
10:18:24 | * | krux02 joined #nim |
10:31:03 | * | hnOsmium0001 quit (Quit: Connection closed for inactivity) |
10:48:05 | * | narimiran quit (Ping timeout: 258 seconds) |
10:52:24 | * | narimiran joined #nim |
11:13:18 | FromDiscord | <tomck> sent a code paste, see https://play.nim-lang.org/#ix=2DcQ |
11:13:47 | FromDiscord | <tomck> as in, a mechanic where i just implement one of these, then the use can use a macro if they want to use the other usage |
11:13:57 | FromDiscord | <tomck> (edit) "use" => "user" |
11:15:57 | FromDiscord | <lqdev> `dup` and `with` |
11:17:31 | * | NimBot joined #nim |
11:18:47 | FromDiscord | <tomck> can you give an example? i don't quite understand |
11:20:37 | FromDiscord | <lqdev> the idiomatic nim way would be to use the second option `myFoo.bar()`, `myFoo.baz()` and use either the `sugar.dup` or `with.with` macro |
11:21:07 | FromDiscord | <lqdev> sent a code paste, see https://play.nim-lang.org/#ix=2DcR |
11:21:20 | * | abm joined #nim |
11:21:47 | FromDiscord | <lqdev> sent a code paste, see https://play.nim-lang.org/#ix=2DcS |
11:34:28 | FromDiscord | <haxscramper> Is this code supposed to segfault - https://play.nim-lang.org/#ix=2DcV - I believe it qualifies as "The assignment of a non-view-type to a view-type", so in my understanding it should work? Note that I specifically want `lent seq[T]`, not `openarray[T]`. |
12:00:53 | FromDiscord | <tomck> ahhh thanks @lqdev , i think i tried it with `with` before where i actually wanted `dup`, so i got a `var` error, ty! |
12:02:20 | FromDiscord | <tomck> @haxscramper i'd expect that to segfault in c++, assuming `lent` is just a pointer here - this should maybe be a compile error as far as i understand nim's `lent` semantics? |
12:03:00 | FromDiscord | <tomck> but you're borrowing a `seq` which isn't actually owned anywhere, it'll just be freed immediately, no? |
12:06:02 | * | supakeen quit (Quit: WeeChat 2.9) |
12:06:36 | * | supakeen joined #nim |
12:37:24 | * | TomDotTom quit (Quit: Leaving) |
12:37:40 | * | TomDotTom joined #nim |
12:43:35 | FromDiscord | <tomck> When a pass a non-var value into a function, are all of its fields 'moved' into the function too? To be clear, i don't have a `ref object`, only an `object`, but i want the object to be 'moved' instead of 'copied' when i pass it to the function, but i can't specify an `object` parameter as `sink` |
12:54:36 | * | lritter joined #nim |
13:04:50 | * | xace joined #nim |
13:06:34 | FromDiscord | <lqdev> you need to use `move` at the callsite |
13:19:08 | PMunch | New stream tonight, notifishower polish, and image handling in notificatcher. Will aim for 18UTC like last time (could start earlier though if people want to). |
13:20:32 | FromDiscord | <lqdev> ~~wait, you're adding Polish language support to notifishower?~~ |
13:21:02 | PMunch | Haha :P |
13:21:16 | PMunch | Well you supply your own strings, so it should already support Polish |
13:49:52 | jonjitsu[m] | can quote do: be nested? I'm getting an `undeclared identifier` for an identifier created in the first quote do |
13:50:16 | PMunch | No that won't work too well |
13:53:25 | * | mmohammadi9812 quit (Ping timeout: 240 seconds) |
13:54:02 | jonjitsu[m] | I'm basically following dom's book: https://livebook.manning.com/book/nim-in-action/chapter-9/306 |
13:54:20 | jonjitsu[m] | Should I ask for a refund? :) |
13:56:41 | PMunch | Those aren't nested.. |
13:59:50 | jonjitsu[m] | The previous section had a quote do, I now see this section wasn't suppose to be indented under that one |
14:02:25 | * | mmohammadi9812 joined #nim |
14:04:35 | * | rockcavera quit (Remote host closed the connection) |
14:09:49 | * | rockcavera joined #nim |
14:18:21 | * | clyybber joined #nim |
14:18:41 | PMunch | I have tried to nest quote do before, and it takes a parameter to change the escaping character, but I could never get it to work properly.. |
14:19:10 | * | clyybber quit (Client Quit) |
14:32:47 | FromDiscord | <dom96> Does the book show nested quote do? |
14:33:20 | PMunch | Nope |
14:33:43 | PMunch | He just misunderstood how two snippets were meant to go together |
14:35:06 | PMunch | By the way, the manning live preview links are totally messed up :P |
14:40:16 | ForumUpdaterBot | New thread by Mrhdias: FastCGI vs HTTP server?, see https://forum.nim-lang.org/t/7043 |
14:40:21 | FromDiscord | <tinygiant> Pmunch, new here, what's the purpose of the streams are where are they accessed? |
14:40:41 | PMunch | Huh? |
14:40:56 | PMunch | Oh, my streams :P |
14:41:03 | PMunch | I thought you were talking about the streams module :P |
14:41:27 | FromDiscord | <tinygiant> Yep, bad wording on my part. |
14:41:37 | PMunch | Purpose is just to show off some Nim development and have fun |
14:41:49 | PMunch | They are accesses at twitch.tv/pmunche |
14:43:55 | FromDiscord | <tinygiant> Awesome thanks. I'll try to check it out. |
14:46:04 | * | mmohammadi9812 quit (Ping timeout: 246 seconds) |
14:47:57 | PMunch | Hmm, this linear algebra logic for layouting is tricky to get right.. |
14:49:09 | * | EastByte quit (Ping timeout: 244 seconds) |
14:49:14 | PMunch | I feel like I make one thing work it breaks another |
14:49:20 | PMunch | if* |
14:50:48 | * | EastByte joined #nim |
14:50:57 | * | mmohammadi9812 joined #nim |
14:52:24 | PMunch | And just as I think I have something that works, something new comes along and breaks everything.. |
14:55:05 | * | mmohammadi9812 quit (Ping timeout: 240 seconds) |
14:56:12 | PMunch | I think I'm getting closer though |
14:56:58 | PMunch | One step at a time |
15:02:18 | * | mmohammadi9812 joined #nim |
15:06:55 | Zevv | I know its a common solution, but somehow I feel it's overkill |
15:07:07 | Zevv | layouting is not that hard. its just stacking bounding boxes |
15:07:20 | PMunch | Well, the problem is to figure out which box goes where |
15:07:44 | Zevv | recursively work your way from the inside out |
15:08:33 | PMunch | Hmm, a simpler approach might actually work for my pattern |
15:09:02 | PMunch | I was looking at normal VFL when I implemented it. And it supports all sorts of constraints making elements the same size and such |
15:09:20 | PMunch | Which my simplified version doesn't support |
15:09:36 | PMunch | Nothing that stops it from supporting it though, just that I haven't baked it into the syntax |
15:09:51 | FromDiscord | <dom96> @PMunch how so? |
15:09:56 | Zevv | the most complicated is having more then one box in a container that request a fill |
15:10:36 | PMunch | @dom96 assuming you asked about the manning thing? Click on his link, it takes me to some random place in chapter nine |
15:10:54 | PMunch | But if you scroll down until the link is the same as his you will see that he tried to link to a specific portion |
15:11:05 | FromDiscord | <dom96> oh |
15:11:23 | FromDiscord | <dom96> "totally messed up" is a big exaggeration then lol |
15:11:25 | PMunch | Zevv, well yeah, I guess the complexity sorta adds up fast |
15:11:37 | PMunch | And it might just be easier at some point to do it through linear algebra |
15:12:01 | Zevv | but Ive made a handfull of guis and toolkits from scratch that never were mor complex then this |
15:12:26 | PMunch | Well, it's impossible to link to specific portions, I'd say that is pretty messed up for a link pattern |
15:12:40 | Zevv | from the inside out you ask each box its minimal size and prefered alighment |
15:13:17 | Zevv | the solution that can do it all is probably np hard anyway :) |
15:15:03 | PMunch | Yeah.. |
15:16:29 | PMunch | I feel it's kinda the same as neural networks |
15:16:46 | PMunch | An "easy" solution to a complex problem, but hard to reason about what's actually going on |
15:16:54 | PMunch | And hard to tweak to do what you want |
15:17:43 | Zevv | but there's tons of trivial solutions that are "good enough" in practice |
15:18:13 | Zevv | even the npeg graphs kind of work like that. a tree of boxes in boxes |
15:18:16 | PMunch | For a certain value of "good enough" |
15:18:33 | Zevv | just abstract it so that you can easily change it later |
15:18:52 | Zevv | just make something that you pass a thing and it tells you "it goes here" |
15:19:07 | Zevv | but I bet you have that |
15:19:09 | PMunch | Well as you say, it's easy until you get to stuff like "this thing should be as big as that thing" or multiple things wanting to take up more space |
15:19:29 | Zevv | sure, but in practice, is that a problem? |
15:19:48 | PMunch | Well if you want to make a proper VFL, then yes |
15:20:00 | Zevv | "proper". There you have it, again :) |
15:20:07 | Zevv | Is it worth the effort _at this time_ |
15:20:11 | PMunch | I mean my simple pattern has "variable spaces" |
15:20:24 | PMunch | That are meant to take up the remaining space in the container |
15:20:34 | PMunch | Distributing it evenly between all such spaces in a container |
15:23:38 | * | waleee-cl joined #nim |
15:23:43 | FromDiscord | <dom96> just reimplement flex-box π |
15:25:15 | Zevv | yeah, then you got 80% of your browser done |
15:25:32 | PMunch | Haha, I don't want to actually create the browser |
15:25:34 | PMunch | Just the UI |
15:25:49 | Zevv | yeah, sure, that's how it starts |
15:26:22 | Zevv | anyway, the time of "other" browser engines is behind us. At this state creating a new render enginge from scratch is virtually impossible |
15:27:47 | PMunch | Yeah |
15:27:57 | PMunch | For better or worse |
15:28:46 | PMunch | I don't miss having to design websites for 5 different engines though.. |
15:29:43 | Zevv | Let's rename it the googleweb right way, to prevent any confusion |
15:30:09 | PMunch | Heh |
15:30:31 | PMunch | One thing I realised about my browsing habits |
15:30:39 | PMunch | While thinking about making my own browser |
15:31:00 | PMunch | The Nim documentation for example |
15:31:27 | PMunch | I find it easier to google "nim <module name>" than to navigate to the documents page and find it |
15:32:20 | PMunch | Which isn't great.. |
15:32:22 | TomDotTom | @zevv: Would you consider flutter a 'new rendering engine' ? |
15:32:24 | Zevv | It probably is. But still I'm not doing it. I'm practically google free, my firefox+tridactyl allows for fast shortcuts. |
15:33:56 | Zevv | TomDotTom: I don't think so. I mean "browser engine". webkit. gecko. |
15:34:01 | PMunch | That same thing would work with DDG as well though |
15:34:29 | Zevv | sure. But I have a 'n <...>' shortcut that searches the nim docs |
15:34:35 | Zevv | etc |
15:34:41 | PMunch | Fair enough |
15:34:45 | PMunch | But that requires setup |
15:34:54 | PMunch | I'm a big fan of the search don't sort paradigm |
15:35:26 | * | Kaivo quit (Ping timeout: 264 seconds) |
15:35:32 | Zevv | oh sure. I had 250K emails in one big box for ages. |
15:35:40 | Zevv | just make sure your stuff is searchable _fast_ |
15:37:57 | * | Kaivo joined #nim |
16:00:02 | * | vicfred joined #nim |
16:07:10 | federico3 | https://surveys.jetbrains.com/s3/c18-python-developers-survey-2020 for those interested |
16:07:25 | * | Kaivo quit (Ping timeout: 264 seconds) |
16:08:05 | FromDiscord | <dom96> Is there a "What's your favourite language?" field in there? (or similar) |
16:08:12 | FromDiscord | <dom96> if so I'll do it just to write "Nim" π |
16:08:15 | federico3 | close enogh |
16:08:24 | federico3 | yes, go ahead |
16:09:43 | * | Kaivo joined #nim |
16:10:02 | Zevv | well that was short |
16:11:35 | FromGitter | <sealmove> hey confirm something for me. `if ... else` is an expression but `if ... elif ... else` is not? |
16:13:10 | Zevv | it is |
16:13:19 | Zevv | https://play.nim-lang.org/#ix=2Dej |
16:15:36 | FromDiscord | <nikki> re: implementing flexbox |
16:15:41 | leorize[m]1 | o/ everyone |
16:15:47 | leorize[m]1 | anything cool recently? |
16:15:48 | FromDiscord | <nikki> yoga is a pretty reusable lib that impls it |
16:15:54 | FromDiscord | <nikki> no dependencies iirc |
16:18:02 | FromGitter | <sealmove> Zevv: hmm but you have to set a default value. `else: discard` won't work |
16:18:15 | FromGitter | <sealmove> so that's the problem |
16:18:38 | Zevv | sure. All branches need to evaluate to the same type |
16:18:43 | leorize[m]1 | it's not an expression if there's a branch that can't have a value, isn't it |
16:18:58 | leorize[m]1 | you can throw an exception if you don't want to set a value |
16:19:13 | FromGitter | <sealmove> understood, makes sense |
16:19:21 | Zevv | the exception part doesnt |
16:19:47 | Zevv | first you had one problem. now you have two! |
16:20:52 | FromGitter | <sealmove> so then this means that `if ... elif` (without the `else` part) can't be an expression |
16:22:19 | Prestige | it can: https://play.nim-lang.org/#ix=2Dem |
16:22:50 | Prestige | well actually, I see what you mean now. Yeah |
16:22:56 | FromGitter | <sealmove> echo is a statement not expression |
16:23:02 | Prestige | You can't like assign to it |
16:23:08 | FromGitter | <sealmove> yup |
16:24:09 | Zevv | indeed, you need an else: https://play.nim-lang.org/#ix=2Deo |
16:25:06 | FromGitter | <sealmove> I have another question... is there any way to create an object and activate its object variant lateR? |
16:25:41 | Zevv | you can reset it |
16:26:16 | Zevv | https://nim-lang.github.io/Nim/system.html#reset%2CT |
16:26:18 | FromGitter | <sealmove> hmm, but if you have passed it as a reference somewhere and then reset it, will there be a problem? |
16:26:23 | Zevv | no wiat that's not the one |
16:26:33 | Zevv | yes, it's tricky and discouraged afaik |
16:26:50 | Zevv | ah look" Starting with version 0.20 system.reset cannot be used anymore to support object branch changes as this never was completely memory safe." |
16:26:59 | FromGitter | <sealmove> I really need to create the object and pass it as reference before the variant is determined. there is no other way :| |
16:27:00 | Zevv | so "No" is the answer |
16:27:09 | Zevv | there is always another way |
16:27:31 | Zevv | you can pass a lambda to retreive the object later |
16:31:41 | * | astronavt joined #nim |
16:33:13 | * | hnOsmium0001 joined #nim |
16:44:31 | FromGitter | <sealmove> here is the full situation: https://play.nim-lang.org/#ix=2Des |
16:45:29 | FromGitter | <sealmove> wait, need to optimize the example |
16:48:02 | FromGitter | <sealmove> here: https://play.nim-lang.org/#ix=2Det |
16:48:49 | * | habamax quit (Ping timeout: 264 seconds) |
16:49:11 | FromGitter | <sealmove> the discriminator depends on an object which when you read, you need to pass a reference of the current object |
16:49:50 | FromGitter | <sealmove> but if you make the object first, then you can't change the discriminator :S |
16:50:11 | FromGitter | <sealmove> i have no idea how the lambda idea you mentioned would work |
16:53:23 | FromGitter | <sealmove> sorry for the spam: trying to minify the example: https://play.nim-lang.org/#ix=2Dex |
17:03:56 | * | bouzu_ joined #nim |
17:09:33 | * | bouzu_ quit (Quit: Leaving) |
17:20:59 | FromDiscord | <Plas> sent a code paste, see https://play.nim-lang.org/#ix=2DeF |
17:23:09 | * | habamax joined #nim |
17:27:36 | FromDiscord | <Rika> do list? as in seqs? `var aVar: seq[int]` |
17:27:44 | FromDiscord | <Rika> python list == nim seq |
17:28:42 | FromDiscord | <Rika> for your second question, you box the types you want into a single type |
17:28:52 | FromDiscord | <Rika> (its kinda difficult to explain) |
17:37:50 | FromDiscord | <Plas> @Rika you mean like type aliases? |
17:38:13 | FromDiscord | <Rika> no, i mean case objects |
17:38:22 | FromDiscord | <Plas> ? sorry im newer to nim |
17:42:55 | FromDiscord | <Daniel> @federico3 @federico3 i sompleted the survey, wrote in the text box nim programing language π |
17:44:41 | ForumUpdaterBot | New thread by Kobi: New project: cs2nim, see https://forum.nim-lang.org/t/7044 |
17:47:15 | PMunch | Stream is live |
17:49:25 | PMunch | https://twitch.tv/pmunche <- Will start streaming at 18 UTC |
17:53:08 | * | tane quit (Quit: Leaving) |
17:54:32 | PMunch | Hmm, I should get some elevator music to play while my "Please stand by image" shows |
17:56:22 | Zevv | Your lack of music is the main reason I do not attend |
17:56:28 | Zevv | I have been so spoiled by disruptek |
17:56:43 | PMunch | He plays music? |
17:56:48 | Zevv | Good music |
17:57:25 | Zevv | With disrupteks streams I always got this chilling-hanging-at-the-couch-at-a-friends-house vibe |
17:57:48 | Zevv | you're just there, no one expects anything of you, but you're welcome to just curse and have a beer |
17:58:13 | PMunch | Haha, I should ask him for some tips then |
17:58:16 | Zevv | but don't even bother, you'll never reach that level |
17:58:22 | PMunch | On my streams I'm the only one drinking beer and cursing.. |
17:58:28 | Zevv | haha :) |
17:59:18 | * | natrys joined #nim |
18:05:00 | * | xet7 quit (Quit: Leaving) |
18:08:11 | Zevv | disruptek: look at this beauty: https://github.com/zevv/mathpipe/blob/master/mp.nim |
18:09:19 | FromDiscord | <Vindaar> welp, would rather watch your stream PMunch, but guess I should work (: |
18:09:32 | Zevv | textbook example. expression -> AST parser with variables, functions and proper precedence. The AST evaluator is 6 lines only. Stateful primitive functions for things like lowpass filtering, averaging, running standard deviation. |
18:45:59 | * | vicfred quit (Quit: Leaving) |
18:46:22 | * | vicfred joined #nim |
19:12:42 | FromDiscord | <tinygiant> sent a code paste, see https://play.nim-lang.org/#ix=2Dfq |
19:18:22 | FromDiscord | <tinygiant> (edit) sent a code paste, see https://play.nim-lang.org/#ix=2Dfv |
19:20:31 | FromDiscord | <Rika> ??? jsonnode is a ref type so you dont need to make them var |
19:23:16 | FromDiscord | <nikki> @Clyybber re: the thing yday of preserving 'default `=destroy`' while implementing own `=destroy` -- i found that having a reusable `destroyFields` template that just iterates through `fieldPairs` and `=destroy`s the values seems to work π€ |
19:23:22 | FromDiscord | <nikki> not sure if that misses anything |
19:25:36 | FromDiscord | <tinygiant> @Rika Thanks! It all seems to be accepting of what I'm trying to do. The whole reference thing has gotten me several times. Time to crack some more books. |
19:34:23 | * | natrys quit (Quit: natrys) |
19:36:53 | FromGitter | <sealmove> I ended up with this design: https://play.nim-lang.org/#ix=2DfC wrapping the variant field into a subtype |
19:37:17 | FromGitter | <sealmove> The API gets less convenient, but I think it's the only way |
19:40:25 | Zevv | how would one do `lines("/dev/stdin")` on windows? |
19:40:59 | Zevv | oh that was stupid |
19:41:16 | * | TomDotTom quit (Quit: Leaving) |
19:44:30 | * | TomDotTom joined #nim |
19:54:04 | FromDiscord | <Rika> lol |
19:54:37 | FromDiscord | <Rika> @tinygiant btw the "???" was me wondering how you got "instancenode[k] is immutable" |
19:54:49 | FromDiscord | <Rika> i didnt know you could get those with ref types |
19:55:30 | FromDiscord | <tinygiant> I have no idea either. Didn't make sense to me, but that's all the information the compiler provided. |
19:57:00 | ForumUpdaterBot | New thread by Mantielero: C++ FFI - basic example, see https://forum.nim-lang.org/t/7045 |
20:17:34 | * | astronavt quit (Remote host closed the connection) |
20:19:10 | * | astronavt joined #nim |
20:28:38 | * | astronavt quit (Quit: Leaving) |
20:31:01 | * | astronavt joined #nim |
20:41:18 | * | habamax quit (Ping timeout: 256 seconds) |
20:50:20 | * | letto quit (Quit: Konversation terminated!) |
20:52:20 | * | letto joined #nim |
20:57:48 | * | narimiran quit (Ping timeout: 256 seconds) |
20:59:42 | PMunch | Damn it, forgot to record tonight's stream.. |
21:02:50 | Zevv | hm is that not automatic on twitch, bummer |
21:04:51 | Yardanico | it is automatic |
21:04:54 | Yardanico | if you didn't disable it |
21:04:57 | Yardanico | they save them for 30 days |
21:05:49 | * | TomDotTom quit (Ping timeout: 246 seconds) |
21:09:43 | PMunch | Oh really? |
21:10:44 | FromDiscord | <Daniel> I would advise you to consider streaming on youtube, its easy and has better coverage. |
21:10:55 | PMunch | Better coverage? |
21:11:06 | FromDiscord | <Daniel> Well, twitch is famous among gamers |
21:11:16 | FromDiscord | <Daniel> Youtube covers everything. |
21:11:18 | PMunch | Damn it, it was disabled.. |
21:11:23 | PMunch | That's true |
21:11:31 | PMunch | Not sure why I'm streaming on Twitch really |
21:11:41 | PMunch | Just what everyone else was using when I started out |
21:12:31 | Zevv | what's better |
21:12:34 | FromDiscord | <juan_carlos> http://restream.io forwards it to everywhere, youtube, twitch, vk, etc. |
21:12:37 | FromDiscord | <Daniel> thats the thing, twitch main argument back in the days was streaming, but since YouTube has it, not anymore |
21:12:45 | * | Kaivo quit (Ping timeout: 240 seconds) |
21:12:55 | FromDiscord | <Daniel> ^^or even that |
21:12:57 | PMunch | restream requires another account though.. |
21:13:13 | FromDiscord | <juan_carlos> No. |
21:13:17 | PMunch | YouTube: It takes 24 hours to activate your account for live streaming. Once activated, you can go live instantly. |
21:13:25 | PMunch | It doesn't |
21:13:28 | PMunch | ?* |
21:15:30 | * | Kaivo joined #nim |
21:15:30 | * | rockcavera quit (Remote host closed the connection) |
21:19:01 | FromDiscord | <Daniel> is it not this? https://www.youtube.com/live_dashboard |
21:19:25 | FromDiscord | <Daniel> i tried it few months ago, i know it was working fluently |
21:19:38 | FromDiscord | <Daniel> not sure if now is any different |
21:20:39 | PMunch | Yeah, but apparently I had to activate my account for streaming first.. |
21:21:00 | PMunch | How does chats work between YouTube and Twitch though when using restream? |
21:22:40 | FromDiscord | <juan_carlos> Youtube chat has delay, you can see both platform stuff in your restream page. |
21:22:58 | FromDiscord | <juan_carlos> Like a lot of delay I mean. |
21:23:33 | PMunch | Hmm |
21:24:03 | PMunch | I kinda want to get the chat as text so I can display it on screen though |
21:24:27 | PMunch | Like I do now with Twitch over IRc |
21:24:35 | FromDiscord | <juan_carlos> is free, no watermark |
21:24:50 | FromDiscord | <juan_carlos> Youtube chat is not IRC compatible |
21:25:12 | FromDiscord | <Daniel> Altho, youtube is the most popular platform, so thats a plus |
21:25:32 | PMunch | It doesn't have to be IRC |
21:25:40 | PMunch | That was just an easy way to get the chat as a text file |
21:25:46 | FromDiscord | <juan_carlos> I tried to register on VK, but I dont understand Russian to do it, but has the option to add it too. |
21:27:40 | PMunch | Oh well, I'm off for tonight |
21:27:45 | * | PMunch quit (Quit: leaving) |
21:31:17 | * | abm quit (Remote host closed the connection) |
21:31:40 | * | abm joined #nim |
21:32:47 | FromDiscord | <Rika> Youtube chat can have min around 2 second delay if you opt for ultra low latency |
21:33:06 | FromDiscord | <Rika> Otherwise it is around 1 minute round trip latency or something |
21:38:25 | * | D_ quit (Ping timeout: 240 seconds) |
21:39:48 | * | D_ joined #nim |
21:43:06 | * | abm quit (Quit: Leaving) |
21:44:14 | lain | quick question about ARC in Nim, if I use --gc:arc (not orc!), will it detect and warn/error on potential cycles in my code during compile-time? |
21:49:05 | Zevv | nope |
21:49:07 | Zevv | it will leak |
21:49:15 | lain | ahh ok |
21:49:21 | lain | thanks |
22:28:26 | * | astronavt quit (Ping timeout: 258 seconds) |
22:52:12 | * | solitudesf quit (Ping timeout: 256 seconds) |
22:53:08 | * | astronavt joined #nim |
22:58:59 | * | krux02 quit (Quit: Leaving) |
23:14:09 | FromDiscord | <Recruit_main707> `Error: unhandled exception: cannot open: output/TileState.nim [IOError]`β΅when trying to do (at compile time): β΅`writeFile("output/TileState.nim", [data])` |
23:25:28 | ForumUpdaterBot | New thread by JazzPlayer: Nims book question, see https://forum.nim-lang.org/t/7046 |
23:40:07 | * | abm joined #nim |
23:51:27 | FromDiscord | <FreezerburnVinny> sent a long message, see http://ix.io/2Dgs |
23:56:57 | * | lritter quit (Quit: Leaving) |
23:57:28 | FromDiscord | <juan_carlos> codegenDecl |