00:03:36 | FromDiscord | <j-james> i ran into a procedure that seems to be modifying its `JsonNode` parameter without it being marked as `var` anywhere |
00:03:47 | FromDiscord | <j-james> how is it doing this? i thought parameters were immutable by default |
00:04:26 | FromDiscord | <Elegantbeef> Reference types |
00:04:51 | FromDiscord | <Elegantbeef> The parameter is immutable in that it cannot be changed where it points, but the data it points at is not immutable |
00:05:03 | FromDiscord | <Elegantbeef> `strictFuncs` is an experimental feature that forces this |
00:05:28 | FromDiscord | <Elegantbeef> So even to mutate a immutable reference's fields is not valid code |
00:05:57 | FromDiscord | <abdu> what C #include equivalent in nim |
00:05:57 | FromDiscord | <j-james> ah, i see |
00:06:04 | FromDiscord | <j-james> (gross) |
00:06:19 | FromDiscord | <Elegantbeef> You import modules in nim and use `include` for modules if you must |
00:06:31 | FromDiscord | <Elegantbeef> Abdu i damn well better not see a forum post or stack overflow with that same question |
00:06:48 | FromDiscord | <Elegantbeef> If i do i'm going to get a plane ticket |
00:07:29 | FromDiscord | <abdu> Simplest example ? |
00:08:13 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3ZWh |
00:08:53 | FromDiscord | <geekrelief> ehmry there's this for SuperCollider https://github.com/capocasa/scnim and https://vitreo12.github.io/omni/ |
00:09:36 | FromDiscord | <j-james> In reply to @Elegantbeef "`strictFuncs` is an experimental": interesting that's tied to view types |
00:09:44 | FromDiscord | <j-james> i wouldn't have expected that |
00:09:54 | FromDiscord | <Elegantbeef> It's not tied to |
00:10:04 | FromDiscord | <geekrelief> https://github.com/vitreo12/omnicollider I could have sworn there was a video from someone doing audio synthesis with Nim |
00:10:19 | FromDiscord | <Elegantbeef> Strict funcs makes view types better |
00:10:58 | FromDiscord | <abdu> sent a code paste, see https://play.nim-lang.org/#ix=3ZWi |
00:11:08 | FromDiscord | <Elegantbeef> Do i get a gold star?! |
00:11:30 | FromDiscord | <Yardanico> MAYBE ! |
00:11:42 | ehmry | geekrelief: I remembering seeing that video, it was nimcon or fosdem |
00:11:47 | FromDiscord | <Elegantbeef> YAY ! |
00:12:10 | ehmry | these looks like plugin generators, I was hoping to find a synth that I could drive from nim |
00:12:39 | ehmry | I've played with chuck, I could wrap that if I really wanted |
00:13:09 | FromDiscord | <geekrelief> must have been omni https://www.youtube.com/watch?v=ruT7sbs5O-Q |
00:15:20 | * | ltriant quit (Ping timeout: 248 seconds) |
00:44:50 | * | ltriant joined #nim |
00:49:28 | * | ltriant quit (Ping timeout: 248 seconds) |
01:21:14 | FromDiscord | <Yardanico> is there any reason why adding `lent2` would be bad to array iterators? regarding https://github.com/nim-lang/Nim/pull/14447 |
01:21:54 | FromDiscord | <Yardanico> right now as a funny consequence of copying stuff around with `items` `filterIt` is slower (!) than `filter` for arrays (even with ARC) which is kinda counter-intuitive (since `filter` has to do a proc call while filterIt is always easily inlined) |
01:27:35 | FromDiscord | <Elegantbeef> I cant think of a reason why it'd be bad, might be a technical issue with Nim |
01:28:55 | FromDiscord | <Yardanico> @beef but it's already done for seqs |
01:30:34 | * | ltriant joined #nim |
01:38:44 | * | ltriant quit (Ping timeout: 255 seconds) |
01:39:53 | * | ltriant joined #nim |
02:49:39 | * | arkurious quit (Quit: Leaving) |
03:31:11 | * | vicfred joined #nim |
03:42:03 | * | Guest71 joined #nim |
03:42:10 | Guest71 | yo |
03:42:21 | * | Guest71 quit (Client Quit) |
03:46:01 | FromDiscord | <huantian> yo mama |
03:48:58 | FromDiscord | <Elegantbeef> No u |
03:49:39 | FromDiscord | <Elegantbeef> Looking at the irc logs they joined then instantly left 😄 |
03:55:27 | FromDiscord | <Zectbumo> given the nim canon with overloading and uniform function call syntax, what is the history behind naming `flushFile` and why not `flush`? |
03:56:51 | FromDiscord | <Zectbumo> and follow up question, where is the new std/ library set for nim2? I want to be a part of feedback |
03:56:52 | FromDiscord | <Elegantbeef> People sometimes dont name procedures well 😄 |
03:57:13 | FromDiscord | <Elegantbeef> Nim2 is `devel` on github |
03:58:30 | FromDiscord | <Zectbumo> has the std/lib already been started in the overhaul there or not started yet? where are we in this journey? |
03:58:44 | FromDiscord | <Elegantbeef> Some parts have |
03:59:59 | FromDiscord | <Zectbumo> I considered devel closer to v1.6.7. is this not the case and it's closer to 2.0? if so, where is v1.6.7 being developed? |
04:00:13 | FromDiscord | <Elegantbeef> 1.6.x is backported from devel |
04:00:35 | FromDiscord | <Elegantbeef> 1.6.x will be here https://github.com/nim-lang/Nim/tree/version-1-6 |
04:02:55 | FromDiscord | <Zectbumo> got it, thx 👍 |
05:05:36 | * | vicfred quit (Quit: Leaving) |
05:51:06 | * | kenran joined #nim |
07:16:31 | FromDiscord | <treeform> In reply to @PMunch "I guess it would": Sorry I went to bed. Maybe create new temperature file, export it from main file? |
07:54:58 | * | kenran quit (Quit: WeeChat info:version) |
08:16:05 | * | mal`` quit (Quit: Leaving) |
08:35:46 | * | krux02 joined #nim |
08:36:59 | * | mal`` joined #nim |
08:37:34 | * | jjido joined #nim |
08:39:03 | FromDiscord | <Prestige> Is there a recommended way to do ipc that would work on all platforms? I found https://github.com/cheatfate/asynctools but looks unmaintained |
08:39:32 | FromDiscord | <Elegantbeef> Sockets and binary formatters exist |
08:40:38 | FromDiscord | <Prestige> I just don't know anything about Windows, basically |
08:40:56 | FromDiscord | <Elegantbeef> Yea me either |
08:41:14 | FromDiscord | <Elegantbeef> I'm simple and would just bank on sockets |
08:42:00 | FromDiscord | <Elegantbeef> Your favourite binary format designed for IPC and sockets seems fine to my small brain |
08:44:35 | FromDiscord | <Elegantbeef> For reference i'm talking about protobuf or similar 😄 |
08:45:28 | FromDiscord | <demotomohiro> ipc means inter process communication? |
08:45:35 | FromDiscord | <Elegantbeef> Yes |
08:46:21 | FromDiscord | <demotomohiro> You can use pipe or sockets for ipc on both windows and linux. |
08:46:30 | FromDiscord | <Prestige> Neat |
09:23:06 | FromDiscord | <jmgomez> In reply to @Elegantbeef "That's what i figured": hey in case you are interested we dramatically reduced the compilation times by using PCH. It was a pain to setup though. But in case anyone runs into a similar issue |
09:23:28 | FromDiscord | <Elegantbeef> PCH? |
09:23:41 | FromDiscord | <jmgomez> Precompiled Headers |
09:28:05 | * | h00k_ joined #nim |
09:31:21 | FromDiscord | <Xzayler> What are the main use cases for enums? I'm trying to understand where using enums would be easier than using just a standard variable.↵Like if I had a value `currentMonth`, which I only want to be a string of the name of the current months |
09:31:45 | FromDiscord | <Elegantbeef> Enums are really just a fixed set of named integers |
09:31:46 | FromDiscord | <Xzayler> what would be the advantage of using an enum to assign the current month, over just assigning the value |
09:32:12 | FromDiscord | <Elegantbeef> The benefit is that it's very data/cpu efficient to use enums |
09:32:19 | FromDiscord | <Rika> And if you assign an arbitrary string value like Marchuary or something? |
09:32:19 | FromDiscord | <Elegantbeef> And it's 10000% less error prone |
09:32:31 | FromDiscord | <jmgomez> besides the size the most important part for me is that it's a closed set |
09:33:54 | FromDiscord | <Xzayler> In reply to @Rika "And if you assign": Ah so that would give an error at compile time, right? |
09:34:24 | FromDiscord | <Elegantbeef> Compile time if you do it with literals and at runtime you'd get a parsing error |
09:35:35 | FromDiscord | <Xzayler> I don't really understand how enums are more resource efficient but I'll trust you guys on it :D.↵I do see now how it would be safer and more practical though. Thank you |
09:35:47 | FromDiscord | <Elegantbeef> They're integers |
09:36:49 | FromDiscord | <Rika> In reply to @Xzayler "I don't really understand": They don’t store the string value for every enum value, only once for conversions |
09:36:49 | FromDiscord | <Elegantbeef> Copying them or mutating them just changes an integer whereas with a string a copy/growth will be done |
09:36:56 | FromDiscord | <Rika> Internally represented as integers |
09:39:02 | FromDiscord | <Xzayler> Ah ok that makes sense |
09:54:52 | FromDiscord | <Phil> In reply to @Xzayler "I don't really understand": For example "Quest State" is a really good enum. A quest can either be started, finished or on hold.↵You can represent this with a string, but that string or an integer and say "1 means finished, 2 means started, 3 means on hold" or something like that, but that gives the possibility of there being a wrong value, like somebody could throw in a 4 or the string could have the value "potat |
09:55:25 | FromDiscord | <Phil> In that sense, enums forbid "wrong" values when you have a defined amount of values a variable can have |
09:55:59 | FromDiscord | <Phil> (edit) removed "string, but that" |
09:58:16 | FromDiscord | <Xzayler> Yeah, my thinking was that if a wrong value is provided, I messed up and it would have to be fixed anyways. |
09:58:32 | FromDiscord | <Phil> Yeh, but this way you notice it at compile time and not at runtime |
09:58:37 | FromDiscord | <Xzayler> But it's better to find out earlier |
09:58:39 | FromDiscord | <Xzayler> yeah exactly |
09:58:40 | FromDiscord | <Phil> and in the future other people might have to read your code |
09:59:02 | FromDiscord | <Phil> and with an enum you make it very explicit which values you expect to be possible, making it harder to overlook one |
09:59:04 | FromDiscord | <Xzayler> In reply to @Isofruit "*and* in the future": God have mercy on their souls.. |
09:59:22 | FromDiscord | <Xzayler> In reply to @Isofruit "*and* with an enum": yeah I started implementing them and they even help me |
09:59:25 | FromDiscord | <Phil> In reply to @Xzayler "God have mercy on": I've written a decent amount of bioinformatics code, I know that pain |
09:59:50 | FromDiscord | <Xzayler> I'm not making anything complicated, I'm just a newbie and messy |
10:00:22 | FromDiscord | <Phil> In terms of coding: Believe me, so are most bioinformaticians |
10:01:19 | FromDiscord | <Phil> I've had to read code of people that intentionally used variables like "a" "b" "c" "d" etc. everywhere simply because it was shorter, no need for long variable names that would tell you what "a" even is |
10:02:55 | FromDiscord | <Phil> I wonder, can you enforce that a case statement has to cover all possibilities of an enum? |
10:03:13 | FromDiscord | <Phil> (edit) "I wonder, can you enforce that a case statement has to cover all possibilities of an enum? ... " added "(Instead of just having else)" |
10:04:25 | FromDiscord | <Phil> Because I'd actually like it if I expand an enum that all my case statements start complaining that I need to cover another possibility |
10:04:35 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3ZXK |
10:05:38 | FromDiscord | <jmgomez> Notice how the last From has the To value also |
10:06:11 | FromDiscord | <Phil> So you have no value within "varToTo" ever? |
10:06:47 | FromDiscord | <jmgomez> It seems like it gets removed after the assignment |
10:07:28 | FromDiscord | <Phil> Cstrings are value types, right? I keep forgetting that one. |
10:07:48 | FromDiscord | <Phil> Wait, yes of course they are |
10:08:00 | FromDiscord | <Phil> Ugh I need lunch |
10:08:23 | FromDiscord | <jmgomez> so are they supposed to be copied? or is the first char only copied? |
10:09:43 | FromDiscord | <Rika> In reply to @Isofruit "Because I'd actually like": Just don’t have an else |
10:10:14 | FromDiscord | <Phil> Nice! |
10:10:16 | FromDiscord | <Rika> You can’t have an else anyway if you cover all possibilities I think |
10:11:08 | FromDiscord | <Phil> In reply to @Xzayler "I'm not making anything": So there you have it, another benefit is that when you use case statements on a variable that contains an enum, you can make sure you cover what needs to happen for all possible values. You'll get a compile-time error if you forget to cover what should happen for any of the possible enum values |
10:11:35 | FromDiscord | <Phil> In reply to @jmgomez "so are they supposed": I'll try to find some docs on cstrings just to make double sure, but in my head they should be copied |
10:11:42 | FromDiscord | <Phil> (edit) "In reply to @jmgomez "so are they supposed": I'll try to find some docs on cstrings just to make double sure, but in my head they should be copied ... " added "fully" |
10:12:10 | FromDiscord | <dom96> `cstring` is `ptr char` |
10:12:24 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
10:12:50 | FromDiscord | <Phil> Shit, so its a ref type |
10:13:25 | FromDiscord | <dom96> An unsafe ref type. You're better off not using it, or using it very carefully if you must do so for C FFI |
10:14:24 | FromDiscord | <dom96> And yeah, it looks like in that example you are returning a pointer to a string which gets deallocated once `dateTimeToCstring` exits |
10:14:54 | FromDiscord | <Phil> Doesn't the compiler notice there's a pointer to that string in existance and thus avoid deallocating? |
10:15:13 | FromDiscord | <dom96> nope |
10:15:26 | FromDiscord | <Phil> Hmmm would that issue be solved by dereferencing the cstring? |
10:15:49 | FromDiscord | <Phil> Wait, I have a playground project, might as well play around |
10:15:55 | FromDiscord | <dom96> You need to tell the GC explicitly not to dealloc it: https://nim-lang.org/docs/system.html#GC_ref%2Cstring |
10:16:32 | FromDiscord | <Phil> Ohhh wait that example doesn't compile locally, nevermind |
10:16:42 | FromDiscord | <jmgomez> In reply to @dom96 "You need to tell": ohh I see. Thanks. So then I have to manually deallocate the cstring? |
10:17:13 | FromDiscord | <jmgomez> maybe in a destructor on TokenFFI? |
10:17:17 | FromDiscord | <dom96> well, first, why are you returning a cstring at all? |
10:17:27 | FromDiscord | <dom96> why not a string? |
10:17:38 | FromDiscord | <jmgomez> because I have to use it outside of Nim |
10:17:45 | FromDiscord | <dom96> okay, good |
10:17:54 | FromDiscord | <Phil> Can you do the conversion just before you move that variable outside? |
10:18:21 | FromDiscord | <dom96> You can either `GC_ref` the string then return a pointer to it |
10:18:38 | FromDiscord | <dom96> or alloc some memory and copy the string in there, then return a pointer to that |
10:18:48 | FromDiscord | <jmgomez> In reply to @Isofruit "Can you do the": Im doing that already, this is just a repro of a bug. On the other side I fix it by copying the string |
10:19:00 | FromDiscord | <Phil> Ah, check |
10:19:01 | FromDiscord | <Phil> hm |
10:19:17 | FromDiscord | <jmgomez> In reply to @dom96 "or alloc some memory": Ok, that sound good |
10:29:06 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3ZXR |
10:29:24 | * | PMunch joined #nim |
10:30:25 | FromDiscord | <jmgomez> (edit) "https://play.nim-lang.org/#ix=3ZXR" => "https://play.nim-lang.org/#ix=3ZXS" |
10:31:14 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/t5I |
10:31:33 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=3ZXU" => "https://play.nim-lang.org/#ix=3ZXT" |
10:32:03 | FromDiscord | <Rika> Size of a c string is pointer size |
10:32:05 | FromDiscord | <jmgomez> I changed the last line, to deref the cstring |
10:32:10 | FromDiscord | <Rika> Did you mean size of character |
10:32:17 | FromDiscord | <jmgomez> 8, right? |
10:32:31 | FromDiscord | <Rika> 8 bytes? Size of returns byte count |
10:32:52 | FromDiscord | <Rika> I don’t know what you’re intending to do with the code |
10:33:22 | FromDiscord | <Rika> Alloc does not zero memory I believe |
10:33:56 | FromDiscord | <Rika> So in essence:↵You allocate 8 times the memory you need to store the data↵You don’t allocate zeroed memory |
10:34:49 | FromDiscord | <Phil> Reducing size by 216 bytes does seem to get rid of the strange characters |
10:35:25 | FromDiscord | <Rika> Then again actually, strings have an implicit last byte zero |
10:35:44 | FromDiscord | <Rika> But I think the code is shoddy in some way anyway |
10:36:22 | FromDiscord | <jmgomez> Well, first make it work then make it better, right? |
10:39:06 | FromDiscord | <Rika> Shoddy in the way that it doesn’t work |
10:39:20 | FromDiscord | <Rika> Sometimes to make something work you must make it better |
10:39:31 | FromDiscord | <jmgomez> ohh that I can tell, that's why Im asking 🙂 |
10:40:06 | FromDiscord | <Rika> Yeah so change the size of part to get the size of a character instead then use alloc0 I think is what it’s called |
10:41:26 | FromDiscord | <Rika> Also the cast inside the copy should not have the addr in it I think, since the c string is already a pointer |
10:41:30 | FromDiscord | <Rika> And you want the data |
10:41:41 | FromDiscord | <Rika> Wait what |
10:41:48 | FromDiscord | <Rika> I’m confused |
10:42:32 | FromDiscord | <Rika> The last cast should cast into a cstring only, no pointer |
10:42:44 | FromDiscord | <Rika> Yeah this is very confusing wrt. Intent |
10:43:33 | FromDiscord | <jmgomez> yeah, that worked!! |
10:45:15 | FromDiscord | <jmgomez> To delete the memory only thing needed is to unalloc? |
10:46:32 | FromDiscord | <jmgomez> (edit) "unalloc?" => "dealloc?" |
10:49:34 | FromDiscord | <Xzayler> sent a code paste, see https://play.nim-lang.org/#ix=3ZXY |
10:49:42 | FromDiscord | <Xzayler> (edit) "https://play.nim-lang.org/#ix=3ZXY" => "https://play.nim-lang.org/#ix=3ZXZ" |
10:49:57 | FromDiscord | <Rika> In reply to @jmgomez "To delete the memory": I don’t know the name of the proc by memory but probably |
10:50:18 | FromDiscord | <Rika> In reply to @Xzayler "just jumping back to": $mon |
10:50:37 | FromDiscord | <Rika> Dollar sign to string-fit thing |
10:50:44 | FromDiscord | <Rika> I mean string-ify |
10:51:38 | FromDiscord | <Xzayler> perfect! thank you |
10:53:37 | FromDiscord | <jmgomez> In reply to @Rika "I don’t know the": cool, thank you for your help! |
10:59:32 | NimEventer | New thread by Nimmy: Questions regarding async - How to display text while downloadFile(), see https://forum.nim-lang.org/t/9226 |
11:08:53 | * | TakinOver quit (Ping timeout: 255 seconds) |
11:09:44 | * | jjido joined #nim |
11:23:40 | * | TakinOver joined #nim |
11:24:57 | PMunch | @jmgomez, I'd go with something like this: https://play.nim-lang.org/#ix=3ZYf |
11:26:42 | PMunch | Hmm, well make that `size` a `str.len + 1`. I forgot that while refactoring |
11:29:34 | FromDiscord | <jmgomez> Nice! 👌🙏 |
11:39:40 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
11:52:33 | * | jjido joined #nim |
11:55:03 | * | jjido quit (Client Quit) |
13:07:09 | * | pro joined #nim |
14:02:11 | FromDiscord | <abdu> sent a long message, see https://paste.rs/KF8 |
14:04:27 | FromDiscord | <demotomohiro> Nim optimize code when `-d:release` option was used. |
14:06:35 | FromDiscord | <demotomohiro> Nim doesnt optimize your code when `-d:release` or `-d:danger` was not specified. But it compiles code faster. |
14:08:50 | PMunch | So compile without the option while debugging to get better error messages and faster compilation speed. But once you're done and want to build a faster version with less debug stuff in it use -d:release or -d:danger |
14:23:47 | * | pro quit (Quit: pro) |
14:26:10 | NimEventer | New thread by Mardiyah: Apologize on not Nim but is to knowing C directive, see https://forum.nim-lang.org/t/9227 |
14:33:38 | FromDiscord | <abdu> ok |
14:36:55 | FromDiscord | <Phil> In reply to @abdu "What differences `$ nim": Arbitrary sidenote, if you work on a larger project with multiple module files that you import, you might want to also use `-d:lto` (if you use gcc) or `--passL:-flto` (if you use clang). Makes it take significantly longer to compile, but the binary the comes out is slightly faster |
14:52:38 | * | jjido joined #nim |
15:15:00 | FromDiscord | <Not Saucx> Anyone know good IDE for Nim? |
15:15:18 | FromDiscord | <Not Saucx> I like IntelliJ products however I’m not sure if it has good nim support |
15:16:04 | FromDiscord | <jmgomez> It isnt because it doesnt use NimSuggest. It works "well" for debugging though |
15:16:21 | FromDiscord | <jmgomez> I recommend VSCode |
15:16:28 | FromDiscord | <Not Saucx> Oh alr |
15:16:56 | FromDiscord | <Not Saucx> Speaking of, is there a library to interact with Minecraft? Java/Bedrock edition? |
15:17:38 | FromDiscord | <Not Saucx> Usually I test out new languages with mc |
15:20:20 | FromDiscord | <Phil> Huh...err, not sure, quite a specific usecase |
15:21:09 | FromDiscord | <demotomohiro> You can search for nim libraries here: https://nimble.directory/ |
15:21:23 | FromDiscord | <Phil> Yeah, just did a check of what demo suggested, found https://nimble.directory/pkg/minecraftserverstatus |
15:21:25 | FromDiscord | <demotomohiro> https://github.com/xflywind/awesome-nim |
15:21:52 | FromDiscord | <Phil> And hypixel? Not sure what that is, is that an API minecraft uses? |
15:29:08 | FromDiscord | <uncle jim> i am finally back 🙂 |
15:42:06 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
15:57:47 | FromDiscord | <Luckayla> Hypixel is a very large and popular server |
15:57:56 | FromDiscord | <Luckayla> Basically pushes the limits of what you can do without mods |
16:04:20 | FromDiscord | <huantian> Well it pushes the limits in some ways |
16:04:43 | FromDiscord | <huantian> You could easily argue that say wynncraft pushes the limits in other ways |
16:21:09 | FromDiscord | <jmgomez> Is there an option to tell nim to dont use any optimization at all? |
16:23:50 | FromDiscord | <jmgomez> Just found about opt |
16:26:32 | FromDiscord | <demotomohiro> Just run nim without `-d:release` or `-d:danger |
16:29:34 | FromDiscord | <jmgomez> It still do opts |
16:29:38 | FromDiscord | <jmgomez> That's why I asked |
16:30:22 | FromDiscord | <blashyrk> I've created a preliminary pull request for NLVM support on Mac 🙂 If anyone has a Mac and some spare time and would like to try it out or help with some testing: https://github.com/arnetheduck/nlvm/pull/35 |
16:33:15 | FromDiscord | <jmgomez> In reply to @blashyrk "I've created a preliminary": I will, not Today but I will and will let you know |
16:33:51 | FromDiscord | <demotomohiro> What optimization nim does when `-d:release` or `-d:danger` is not set? |
16:34:08 | Amun-Ra | danger turns all range checks off |
16:34:29 | FromDiscord | <jmgomez> Dont know, but at least in clang (I think g++ too) there is a predefined definition, OPTIMIZATIONS that's enabled if you dont do opt:none |
16:34:45 | FromDiscord | <jmgomez> sorry, OPTIMIZATION |
16:35:01 | FromDiscord | <jmgomez> aghh it has as prefix and suffix double underscore |
16:39:03 | FromDiscord | <Rika> `OPTIMIZATION` |
16:39:10 | FromDiscord | <Rika> use backticks |
16:40:10 | FromDiscord | <demotomohiro> I tested nim with/without `--opt:none` but clang (on termux on android) is called with same option. |
16:41:00 | FromDiscord | <jmgomez> check with a pragma if it's present |
16:41:32 | FromDiscord | <jmgomez> Im telling you because for PCHs to work you need to compile with (almost the same options) and that was one of the errors I had (at least in cpp is like that) |
16:48:38 | FromDiscord | <demotomohiro> I checked clang options with `--listcmd`. Maybe how Nim call clang is different on OS. |
16:49:49 | Amun-Ra | you can transpile to C code in both examples and compare results |
16:49:59 | Amun-Ra | s/examples/cases/ |
16:50:16 | FromDiscord | <demotomohiro> Do you see any optimization flags passed to clang when you use nim without `--opt:none`? |
16:51:56 | FromDiscord | <jmgomez> sent a code paste, see https://paste.rs/j2O |
16:58:19 | FromDiscord | <demotomohiro> nim prints backend c/cpp compiler options with `--listcmd` option. |
17:05:06 | FromDiscord | <jmgomez> https://media.discordapp.net/attachments/371759389889003532/985590580925059082/message.txt |
17:07:34 | FromDiscord | <jmgomez> (I also pass a bunch of compiler opts myself) |
17:18:13 | FromDiscord | <demotomohiro> Thank you.↵There is -O3 in "No Opt (it doesnt end the compilation)". It is a flag to enable optimization and it should be used only when `-d:release` or `-d:danger` is used. |
17:19:51 | FromDiscord | <demotomohiro> You set that option manually or change --opt option in nim.cfg/config.nims? |
17:22:53 | FromDiscord | <demotomohiro> If you set `-d:release` or `--opt` or in nim's config file, nim without options can do optimization and `--opt:none` disable optimization. |
17:23:40 | FromDiscord | <jmgomez> I did use it in the past, but when running that test was commented as it is now. Do you think it was somehow cached and opt:none forces no --Ox |
17:23:40 | FromDiscord | <jmgomez> ? |
17:26:13 | FromDiscord | <demotomohiro> `-f` option force rebuilding of all modules and nim doesn't use cache. |
17:29:02 | FromDiscord | <demotomohiro> When you run nim, it show paths of config files nim reads.↵So you can check all config files you wrote before. |
17:31:39 | FromDiscord | <demotomohiro> As far as I know, nim caches only generated .c/.cpp files and object files. |
17:33:35 | * | h00k_ quit (Quit: Konversation terminated!) |
17:36:19 | * | pro joined #nim |
18:23:55 | FromDiscord | <ambient> -d:danger makes my program twice as fast, -d:lto makes my program 10x as fast, cumulative compared to just -d:release is 20x 😅 |
18:24:27 | FromDiscord | <Yardanico> :) |
18:24:29 | FromDiscord | <Yardanico> although that's rare |
18:24:40 | FromDiscord | <Yardanico> you can probably annotate some procs with inline to get it to be faster with -d:release even without lto |
18:24:43 | FromDiscord | <ambient> i wouldn't call complex inner loops that rare |
18:24:57 | FromDiscord | <ambient> I'll try that |
18:25:06 | FromDiscord | <ambient> although it's just a single function |
18:25:52 | FromDiscord | <ambient> @Yardanico i would say even a very simple function https://github.com/amb/nim_audiobook/blob/main/fft.nim#L27= |
18:30:29 | FromDiscord | <geekrelief> I'm using precompiled headers for vcc, I need to include a header file before nimbase.h in the stdlib.cpp files. Is there an option to emit code in those? |
18:31:04 | * | oprypin quit (Remote host closed the connection) |
18:32:14 | * | oprypin joined #nim |
19:02:02 | FromDiscord | <!Patitotective> is that the bug it warns of= https://media.discordapp.net/attachments/371759389889003532/985620006010237009/unknown.png |
19:02:02 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=4006 |
19:02:03 | FromDiscord | <!Patitotective> (edit) "of=" => "of?" |
19:03:25 | FromDiscord | <ynfle> Probably |
19:03:44 | FromDiscord | <ynfle> For this example you can `echo name, ": ", field` |
19:03:49 | FromDiscord | <ynfle> But I assume you know that |
19:03:56 | FromDiscord | <!Patitotective> sent a code paste, see https://paste.rs/ieU |
19:04:18 | FromDiscord | <!Patitotective> In reply to @ynfle "But I assume you": yea :[ |
19:04:19 | FromDiscord | <ynfle> It's mostly because it doesn't know the type because it will be urolled |
19:04:21 | FromDiscord | <ynfle> (edit) "urolled" => "unrolled" |
19:04:40 | FromDiscord | <!Patitotective> In reply to @ynfle "It's mostly because it": name is not always string? |
19:04:46 | FromDiscord | <!Patitotective> (edit) "In reply to @ynfle "It's mostly because it": name is not always ... string?" added "a" |
19:06:27 | FromDiscord | <ynfle> sent a code paste, see https://paste.rs/try |
19:08:05 | FromDiscord | <!Patitotective> In reply to @ynfle "I get a different": it might be because `name` exists in `std/macros` https://nim-lang.org/docs/macros.html#name%2CNimNode |
19:08:15 | FromDiscord | <!Patitotective> (edit) "In reply to @ynfle "I get a different": it might be because `name` ... exists" added "already" |
19:16:22 | FromDiscord | <Prestige> Is there a way to spawn another instance of the current process at runtime? |
19:17:24 | FromDiscord | <!Patitotective> is there a way to echo an object without the field names?↵instead of `(x: 0, y: 0, z: 0)` echo `(0, 0, 0)` |
19:18:05 | FromDiscord | <Prestige> Maybe just write you own `$` proc for the object, then `echo $foo` |
19:19:51 | FromDiscord | <Prestige> or is there a way to invoke a function as another process? (not as a thread) |
19:23:30 | Amun-Ra | fork? |
19:28:12 | FromDiscord | <!Patitotective> is there something like `when obj.isEnum`? |
19:28:21 | FromDiscord | <!Patitotective> maybe `when obj is enum`? |
19:29:01 | FromDiscord | <huantian> Does the latter not work? |
19:29:09 | FromDiscord | <!Patitotective> it does LOL |
19:33:36 | * | noeontheend joined #nim |
19:37:20 | FromDiscord | <eyecon> @mratsim once we had a discussion about the bigint solutions, of which you listed nim-stint (alloc-free, up to uint8192), arithmetic (alloc-free, fastest) and megalo (dynamic allocation). The first two being alloc-free also limits them to a specific size, right? So if I don't know the magnitude in advance, I cannot use them or would risk an overflow at runtime (even if the limit is sky-high). Anything wrong with my thoughts? |
19:41:04 | FromDiscord | <Hamid_Bluri> hey, seems like `nnkOpenSymChoice` doesn't have strval field |
19:42:27 | * | jjido joined #nim |
19:55:18 | FromDiscord | <Rika> a 1 kilobyte integer sounds pretty large to me |
19:55:29 | FromDiscord | <Rika> but yes |
19:55:53 | FromDiscord | <Rika> there is the risk; BUT it is also there for dynamic allocation |
19:56:06 | FromDiscord | <Rika> memory exhaustion is still a thing, depending on your use case |
19:58:12 | FromDiscord | <ynfle> In reply to @hamidb80 "hey, seems like `nnkOpenSymChoice`": You can use repr or `$` |
20:18:07 | * | wallabra quit (Ping timeout: 240 seconds) |
20:19:20 | * | wallabra joined #nim |
20:21:16 | FromDiscord | <Prestige> I'm attempting to use `process.atEnd` to see if there's any data to read, but it just hangs at this function call. Is there a better way to see if there's data available to read, that won't block? |
20:51:58 | PMunch | Get the file handle and use selectors? |
20:55:18 | FromDiscord | <Prestige> Like just use sockets? |
20:58:01 | FromDiscord | <Prestige> I'm currently spawning a child process, and just want to read lines output from the child process |
20:58:30 | FromDiscord | <Prestige> but I need to keep a loop going if there's no data output from the child process |
21:26:18 | * | PMunch quit (Quit: leaving) |
21:48:54 | * | pro quit (Quit: pro) |
22:02:41 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
22:10:20 | * | lumidify_ joined #nim |
22:14:40 | * | lumidify quit (*.net *.split) |
22:38:23 | FromDiscord | <ynfle> NO not sockets |
22:38:30 | FromDiscord | <ynfle> no |
22:44:14 | * | noeontheend quit (Ping timeout: 244 seconds) |
22:45:51 | * | noeontheend joined #nim |
22:45:53 | FromDiscord | <!Patitotective> how do i format a float to remove the numbers after the point?↵`&"{123.32:.0f} == "123."` i want `"123"` |
22:46:36 | FromDiscord | <Elegantbeef> If you just want the whole value do `$int(myFloat)` |
22:46:42 | FromDiscord | <Yardanico> In reply to @Patitotective "how do i format": the simplest is actually https://nim-lang.org/docs/strutils.html#trimZeros%2Cstring%2Cchar if you have the string already |
22:47:20 | FromDiscord | <!Patitotective> thanks :] |
22:57:27 | NimEventer | New thread by Cmc: Announce: at, a tool to run code later, see https://forum.nim-lang.org/t/9228 |
22:58:59 | * | noeontheend quit (Ping timeout: 255 seconds) |
23:02:55 | * | krux02 quit (Remote host closed the connection) |
23:05:17 | * | vicecea quit (Remote host closed the connection) |
23:05:48 | * | vicecea joined #nim |
23:09:55 | * | krux02 joined #nim |
23:11:13 | * | gsalazar quit (Ping timeout: 256 seconds) |
23:11:16 | FromDiscord | <dom96> In reply to @ynfle "NO not sockets": sockets are wonderful |
23:17:19 | FromDiscord | <exelotl> Hey, I found a forum post of mine which doesn't render because I wrote `-` when I should have written `--------------`. But I don't have permission to edit it because it's too old :( |
23:17:26 | FromDiscord | <exelotl> https://forum.nim-lang.org/t/5192#32574 |
23:24:35 | FromDiscord | <exelotl> And another one here which needs blank lines between "Result" and \`\`\` (two occurrences): https://forum.nim-lang.org/t/7827#49696 |
23:24:58 | FromDiscord | <Elegantbeef> I think you can ping moderators and they can edit it |
23:25:06 | FromDiscord | <Yardanico> nope, moderators can't edit, only admins |
23:25:13 | FromDiscord | <Elegantbeef> lol |
23:25:13 | FromDiscord | <Yardanico> = dom and araq |
23:27:45 | FromDiscord | <abdu> sent a long message, see https://paste.rs/YyZ |
23:28:09 | FromDiscord | <Elegantbeef> You import them using the `dynlib` pragma and call the procedures |
23:29:13 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/blob/version-1-6/lib/wrappers/pcre.nim |
23:29:26 | FromDiscord | <demotomohiro> It seems there is breaking change in rst module and some text that was valid become invalid now. So some old forum post cannot be rendered. How about to render raw text instead of error message if parsing old post failed? |
23:31:56 | FromDiscord | <exelotl> yeah, that would be good |
23:40:47 | FromDiscord | <dom96> yeah, this sucks. Fixed those for you |
23:43:50 | FromDiscord | <abdu> ok |
23:48:57 | * | djanatyn1 is now known as djanatyn |