00:02:28 | FromDiscord | <Prestige> I hear that a lot in general (not just with nim) |
00:02:51 | FromDiscord | <Elegantbeef> Yea i mean it's due to the android build process for native code, it's not easy |
00:03:48 | FromDiscord | <demotomohiro> Install termux on android, install Nim & Neovim on termux and create command line program is an easiest way to create an app runs on android :p |
00:04:47 | FromDiscord | <Prestige> Lol |
00:06:39 | FromDiscord | <Elegantbeef> The future of google play is running `nimble install myprogram` |
00:10:46 | * | noeontheend quit (Ping timeout: 268 seconds) |
00:28:12 | * | noeontheend joined #nim |
00:33:43 | FromDiscord | <demotomohiro> I have wrote this program on Termux on Android:↵https://github.com/demotomohiro/DUBF↵It tests you to see whether you can distinguish similar looking characters. |
00:34:27 | FromDiscord | <Elegantbeef> Is there a list of homoglyphs? I've never personally looked 😄 |
00:36:16 | FromDiscord | <Elegantbeef> Well if there are any lists they're all inside JS projects apparently |
00:39:51 | FromDiscord | <!Patitotective> the best way to convert a string to a seq is `str.toSeq()`, right? |
00:40:35 | FromDiscord | <Elegantbeef> string to a sequence of what? |
00:40:59 | FromDiscord | <!Patitotective> chrs |
00:41:00 | FromDiscord | <!Patitotective> (edit) "chrs" => "chars" |
00:41:17 | FromDiscord | <Elegantbeef> `toOpenArray` if you dont want to copy |
00:42:08 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=41a0 |
00:42:44 | FromDiscord | <demotomohiro> @ElegantBeef I just picked characters that I think looks similar: https://github.com/demotomohiro/DUBF/blob/65f3c469f9acbd767201672f5fc1de73d30a7f4f/src/dubf.nim#L4 |
00:43:29 | FromDiscord | <Elegantbeef> There is `allIt` but that's for a single collection |
00:44:31 | FromDiscord | <Elegantbeef> Though you could do something like `(0..first.high).allIt(predicate(first[it], second[it]))` |
00:44:49 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "Though you could do": 🤔 |
00:45:49 | FromDiscord | <demotomohiro> Overload `==` for type `A` and `B` and compare 2 seqs like `seq1 == seq2`? |
00:46:52 | FromDiscord | <Elegantbeef> What patito sequtils has magic procedures |
00:46:55 | FromDiscord | <!Patitotective> In reply to @demotomohiro "Overload `==` for type": yea well but the other solution is more generic |
00:47:06 | FromDiscord | <Elegantbeef> "more generic" |
00:47:12 | FromDiscord | <!Patitotective> hehe |
00:47:18 | FromDiscord | <Elegantbeef> It's inaccurately named |
00:47:40 | FromDiscord | <Elegantbeef> It's doing more than checking if A equals B it's checking that it passes a predicate |
00:47:56 | FromDiscord | <!Patitotective> then `fullfillPredicate`? lol |
00:48:05 | FromDiscord | <Elegantbeef> The real question is why does it exist? |
00:48:25 | FromDiscord | <Elegantbeef> You're just making a proc to iteratively call a procedure, why not just call the procedure you want |
00:48:48 | FromDiscord | <Elegantbeef> Like why does predicate work on the element level when you could just write a proc that works on the element level |
00:49:02 | FromDiscord | <!Patitotective> i translated it from c++ 🤷♂️ ↵but i guess youve got reason |
00:49:47 | FromDiscord | <Elegantbeef> I mean i dont even have context |
00:49:57 | FromDiscord | <Elegantbeef> So i'm just saying what i can see |
00:53:03 | FromDiscord | <!Patitotective> ImGuiColorTextEdit saves lines as sequences of glyphs (with the color for each glyph and more) so when it needs to compare an actual string to a segment of a line it used that `equals` procedure↵but now i think it will be much easier to make a proc that converts a line to a string and then compare it |
00:53:21 | FromDiscord | <!Patitotective> (edit) "procedure↵but" => "procedure (to get the string of a glyph)↵but" |
00:53:31 | FromDiscord | <Elegantbeef> That doesnt sound very unicode compliant |
00:55:12 | FromDiscord | <Elegantbeef> Infact what you provided was certainly not unicode compliant 😄 |
00:55:15 | FromDiscord | <!Patitotective> well each glyph holds a rune but i havent tested it yet so :p |
00:56:37 | FromDiscord | <!Patitotective> for it to be unicode compliant it will have to check that each rune in both strings are the same right? not strings but runes |
00:56:48 | FromDiscord | <Elegantbeef> Yes |
00:57:06 | FromDiscord | <Elegantbeef> I mean you have to ensure both characters are identical |
00:57:29 | FromDiscord | <Elegantbeef> The issue is that with the above code you broke up the string into characters so depending on what you're checking you're going to get incorrect result |
00:57:46 | FromDiscord | <Elegantbeef> Say you where checking for only printable characters |
00:58:02 | FromDiscord | <!Patitotective> so, should i use this https://nim-lang.org/docs/unicode.html#runes.i%2Cstring |
00:58:16 | FromDiscord | <Alea> is there some macro way to convert a string to a variable name? |
00:58:46 | FromDiscord | <Elegantbeef> yea alea you just do `ident(myString)` |
00:58:53 | FromDiscord | <Alea> very cool, thanks |
00:58:57 | FromDiscord | <Elegantbeef> Patito if you're breaking up a string and want to run a predicate on it yes you do |
00:59:35 | FromDiscord | <Elegantbeef> You want the predicate to take the entire glyph not just 1 part out of 4 possible parts |
01:02:23 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=41a4 |
01:02:52 | FromDiscord | <Elegantbeef> I mean if you're just comparing you can just do `str1 == str2` |
01:03:14 | FromDiscord | <Elegantbeef> utf8 doesnt change basic logic |
01:03:34 | FromDiscord | <Elegantbeef> For two strings to be identical they have to have the same data and same length |
01:03:45 | FromDiscord | <Alea> In reply to @Elegantbeef "yea alea you just": so that returns a NimNode; how do I actually use that as say an object field name? |
01:04:02 | FromDiscord | <Elegantbeef> You place it where you need it |
01:04:08 | FromDiscord | <Elegantbeef> It's AST you need to emit AST |
01:06:47 | FromDiscord | <Elegantbeef> Also this is terrible to do ` if str1.runeAt(i) != str2.runeAt(i):` |
01:06:47 | FromDiscord | <Elegantbeef> For unicode getting a rune at a index requires iterating the entire string |
01:08:00 | FromDiscord | <Elegantbeef> Sadly there isnt a good closure iterator |
01:08:11 | FromDiscord | <Professor Actual Factual> sent a code paste, see https://play.nim-lang.org/#ix=41a5 |
01:09:11 | FromDiscord | <Professor Actual Factual> (edit) "https://play.nim-lang.org/#ix=41a5" => "https://play.nim-lang.org/#ix=41a7" |
01:09:38 | FromDiscord | <Elegantbeef> Full code would be nice |
01:09:41 | FromDiscord | <Elegantbeef> Also do `x: MyObj` |
01:10:17 | FromDiscord | <Elegantbeef> also make that a `proc genMainCaseStmt(x: NimNode)` |
01:10:20 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=41a8 |
01:10:55 | FromDiscord | <Elegantbeef> You can but if you have two lines you can just compare the glyphs |
01:12:14 | FromDiscord | <demotomohiro> In reply to @Professor Actual Factual "Hello macro wizards, how": If you want to separate some code in macro, use proc that takes/return `NimNode`. |
01:12:35 | FromDiscord | <Professor Actual Factual> In reply to @Elegantbeef "also make that a": Thank you that worked 🙂 |
01:12:40 | FromDiscord | <Elegantbeef> Macros expand at callsite |
01:12:41 | FromDiscord | <Professor Actual Factual> In reply to @demotomohiro "If you want to": Thanks 🙂 |
01:12:49 | FromDiscord | <Elegantbeef> So yes you cannot have a macro return a nimnode |
01:13:55 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "You can but if": but glyphs hold more than the runes so ill need to map each lines to get the runes |
01:18:21 | FromDiscord | <!Patitotective> also how do i compare two runes lenghts? do i have to convert them two strings first |
01:21:17 | FromDiscord | <Elegantbeef> `runeLen` exists |
01:21:38 | FromDiscord | <Elegantbeef> But you should be able to just do `runeA == runeB` |
01:21:38 | FromDiscord | <!Patitotective> yea but it takes a string, not a rune :7↵https://nim-lang.org/docs/unicode.html#runeLen%2Cstring |
01:21:40 | FromDiscord | <!Patitotective> (edit) ":7↵https://nim-lang.org/docs/unicode.html#runeLen%2Cstring" => ":/↵https://nim-lang.org/docs/unicode.html#runeLen%2Cstring" |
01:21:53 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "But you should be": i only want to compare the lenght |
01:21:55 | FromDiscord | <!Patitotective> (edit) "lenght" => "length" |
01:23:24 | FromDiscord | <Elegantbeef> Bitwise ops is the answer |
01:24:16 | FromDiscord | <!Patitotective> https://nim-lang.org/docs/unicode.html#size%2CRune 🤔 |
01:24:31 | FromDiscord | <Elegantbeef> Yep |
01:24:46 | * | noeontheend quit (Ping timeout: 268 seconds) |
01:55:51 | FromDiscord | <Prestige> I'm contemplating home automation, but don't want to deal with these pre-made solutions like alexa etc that talk to a company's infrastructure. Anyone here doing something like this? If not, I might just start from the ground up |
01:56:07 | FromDiscord | <Elegantbeef> Think pmunch might be |
02:04:21 | * | jkl1337 is now known as jkl |
02:24:13 | FromDiscord | <Prestige> hm yeah he has some ikea smart home things it looks like |
02:28:54 | FromDiscord | <fezhead> i've heard high praise for https://www.home-assistant.io/ |
02:45:59 | FromDiscord | <!Patitotective> i have a `handleKeyboardInputs` bool and a `handleKeyboardInputs` proc (that gets ran when `handleKeyboardInputs` is true)↵which one should i rename? 🤔 |
02:46:32 | FromDiscord | <Elegantbeef> `hasKeyboardInputs` and `handleKeyboardInputs` |
02:48:44 | FromDiscord | <!Patitotective> 🧠 |
03:23:41 | * | LuxuryMode quit (Quit: Connection closed for inactivity) |
03:52:21 | * | xet7 joined #nim |
03:57:08 | * | arkurious quit (Quit: Leaving) |
04:09:41 | FromDiscord | <b1rdf00d> sent a code paste, see https://play.nim-lang.org/#ix=41al |
04:10:26 | FromDiscord | <Rika> Run the binary directly |
04:11:07 | FromDiscord | <b1rdf00d> sent a code paste, see https://play.nim-lang.org/#ix=41am |
04:16:42 | FromDiscord | <Rika> Ah I didn’t read the thing properly |
04:17:23 | FromDiscord | <b1rdf00d> if I change the exit code, then the result is multiplied by 256, e.g. exit(2) -> 512 |
04:22:52 | * | toluene quit (Read error: Connection reset by peer) |
04:24:35 | * | toluene0 joined #nim |
04:29:22 | NimEventer | New Nimble package! seq2d - A 2D Sequence Implementation, see https://github.com/avahe-kellenberger/seq2d |
04:44:01 | * | rockcavera quit (Remote host closed the connection) |
04:44:19 | FromDiscord | <Elegantbeef> @Prestige\: you know your `items` should yield just `value` and you should have another for x, y coord? |
04:44:33 | FromDiscord | <Elegantbeef> You also dont have a mutable version of those |
04:48:23 | FromDiscord | <demotomohiro> It should have `proc `[]`[T](this: var Seq2D[T], x, y: int): var T {.inline.} =`. |
04:48:24 | FromDiscord | <Elegantbeef> Guess the items part is subjective |
04:50:20 | FromDiscord | <demotomohiro> `x`, `y` parameter of `[]` and `[]=` should be `Natural` so that it never be negative value. |
04:52:16 | FromDiscord | <demotomohiro> In reply to @Elegantbeef "<@778498877464117248>\: you know your": https://nim-lang.org/docs/manual.html#iterators-and-the-for-statement-implicit-itemsslashpairs-invocations |
04:52:52 | FromDiscord | <xflywind> I would like to build a github bot collecting compiler metrics for each commit => https://github.com/nim-lang/Nim/pull/19941#issuecomment-1169531271 |
04:57:48 | FromDiscord | <Elegantbeef> Also prestige https://nim-lang.org/docs/osproc.html#execProcesses%2CopenArray%5Bstring%5D%2Cproc%28int%29%2Cproc%28int%2CProcess%29 exists you dont need to remake it yourself |
05:00:18 | FromDiscord | <Prestige> In reply to @Elegantbeef "<@778498877464117248>\: you know your": Eh it doesn't make a whole lot of sense here imo |
05:01:06 | FromDiscord | <Prestige> In reply to @Elegantbeef "You also dont have": I wasn't sure how to do that with something like int because it would throw an error, saying it doesn't have an address |
05:01:19 | FromDiscord | <Elegantbeef> What? |
05:01:41 | FromDiscord | <Elegantbeef> Iterators can yield `(int, int, var T)` |
05:02:34 | FromDiscord | <Prestige> Yeah I had an error with that |
05:02:41 | FromDiscord | <Prestige> I'll recreate it tomorrow |
05:02:53 | FromDiscord | <Elegantbeef> Take your go go juice before writing it |
05:04:26 | FromDiscord | <Prestige> Eh? |
05:05:19 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=41at |
05:05:19 | FromDiscord | <Elegantbeef> It works |
05:05:58 | FromDiscord | <Elegantbeef> It even works with that god awful tuple syntax |
05:06:24 | FromDiscord | <Elegantbeef> Did you perchance do `var (int, int, T)`? |
05:06:50 | FromDiscord | <Elegantbeef> Or did you not have a `[]` which returned `var T` |
05:08:12 | FromDiscord | <Elegantbeef> Also i'd raise a `RangeDefect` for the `[]` accessors |
05:09:01 | FromDiscord | <Elegantbeef> Feel free to tell me to sod off whenever |
05:09:13 | FromDiscord | <Prestige> I did what you did but used a named tuple |
05:09:24 | FromDiscord | <Elegantbeef> It even works with a named tuple |
05:09:53 | FromDiscord | <Prestige> Didn't for me earlier so I removed it |
05:10:12 | FromDiscord | <Prestige> I'm on my phone I'll try again tomorrow |
05:11:03 | FromDiscord | <Elegantbeef> Well this concludes my unasked for code review 😄 |
05:13:20 | FromDiscord | <Prestige> I don't think it'd make a difference but I think I was using += or `inc` |
05:14:10 | FromDiscord | <Elegantbeef> A suggestion that is completely up to you is to use a template instead of copy pasting the code for those raise checks |
05:14:32 | FromDiscord | <Elegantbeef> I dont like to repeat myself so i template stuff like that |
05:15:14 | FromDiscord | <Prestige> Good idea |
05:22:02 | * | gsalazar_ joined #nim |
05:24:45 | * | gsalazar quit (Ping timeout: 256 seconds) |
07:13:57 | * | gsalazar_ quit (Quit: Leaving) |
07:14:14 | * | gsalazar joined #nim |
07:47:07 | NimEventer | New thread by Dee0xeed: State machines example : echo-server, see https://forum.nim-lang.org/t/9271 |
07:53:08 | NimEventer | New thread by Xflywind: Which metrics we should collect for each commit if building a GitHub Action bot?, see https://forum.nim-lang.org/t/9272 |
08:16:54 | FromDiscord | <soundmodel> In reply to @exelotl "Java is so painful": It's not just the language, it's also that the VM makes these stupid locks like "no option for not using GC" and therefore "no precise control over sub 20ms latencies". |
08:17:52 | FromDiscord | <soundmodel> so if I wish to develop algorithms that are in fact about low-latency, then the mere Java VM seems to invalidate all of this. And there's no option to use anything else. |
08:30:42 | FromDiscord | <soundmodel> Nim could make a good language for mobile, but I wonder if we'd ever see such. |
08:30:56 | FromDiscord | <soundmodel> (edit) "such." => "this." |
08:34:50 | FromDiscord | <Phil> I never developed for Android. What's stopping it from running binaries compiled for arm ? |
08:36:13 | FromDiscord | <Phil> The ability to install/run the binary with any reasonable amount of effort? |
08:36:34 | FromDiscord | <Elegantbeef> The way the OS is layed out it cannot native code like a desktop |
08:36:36 | FromDiscord | <Elegantbeef> I mean it can inside termux |
08:36:54 | FromDiscord | <Phil> So JVM or go die? |
08:37:09 | FromDiscord | <Elegantbeef> Well it's not JVM but pretty much you need to use it to talk to the core OS for apps |
08:37:42 | FromDiscord | <Elegantbeef> So in the case of like a SDL2 backed program with opengl you need to use a basic java class to setup the context and call your native code |
08:38:01 | FromDiscord | <Elegantbeef> It's not impossible to make this easy, it's just a pain in the arse to setup ime |
08:38:11 | FromDiscord | <soundmodel> Yes termux can run C programs etc., but that means that you ought to not have a GUI and definitely not a nativeone. |
08:38:16 | FromDiscord | <soundmodel> (edit) "nativeone." => "native one." |
08:38:51 | FromDiscord | <Prestige> I'm contemplating getting a pinephone and just writing apps for whatever I need personally, tbh. I'm tired of android stuff |
08:39:18 | FromDiscord | <soundmodel> So in essence a non-JVM language cannot touch and Android platform. |
08:39:25 | FromDiscord | <Elegantbeef> Like in my experience it's fiddling with android studio, then writing android make files, then finally getting it to work |
08:39:41 | FromDiscord | <soundmodel> which is a bit odd, because then new language developments cannot be implemented on such platforms |
08:40:04 | FromDiscord | <soundmodel> so one writes with Nim for desktop, but not on mobile |
08:40:05 | FromDiscord | <Elegantbeef> Well you can use a system library, but yea you need to interop back and forth |
08:40:45 | FromDiscord | <soundmodel> (edit) "and" => "an" |
08:41:04 | FromDiscord | <Elegantbeef> nimx and nico for instance supports android to some capacity |
08:41:31 | FromDiscord | <Elegantbeef> No native gui which is a little bit of a shame given Nim's macro capabillities |
08:41:39 | FromDiscord | <soundmodel> Yes, but they cannot get past the VM's limitations, so they will not solve the fundamental problems. |
08:41:48 | FromDiscord | <soundmodel> they just allow using another language |
08:42:09 | FromDiscord | <Elegantbeef> "VM limitations"? |
08:42:28 | FromDiscord | <soundmodel> well mainly GC |
08:42:38 | FromDiscord | <Elegantbeef> They do get past the VM limitations |
08:42:48 | FromDiscord | <Elegantbeef> They're system libraries they're not on the VM |
08:42:58 | FromDiscord | <Elegantbeef> They're sandboxed but you get full control of memory allocations |
08:43:07 | FromDiscord | <soundmodel> so they're bindings on Android NDK? |
08:43:16 | FromDiscord | <soundmodel> (edit) "on" => "to" |
08:43:22 | FromDiscord | <Elegantbeef> How else do you run Nim on android? |
08:43:34 | FromDiscord | <soundmodel> but I thought Android NDK was a subset of the SDK |
08:43:46 | FromDiscord | <Elegantbeef> NDK is the native part of it |
08:44:04 | FromDiscord | <soundmodel> since the official page says that it's "The Android NDK is a toolset that lets you implement parts of your app in native code" |
08:44:04 | FromDiscord | <Elegantbeef> It's how you use libraries written in other languages, it runs natively afaik |
08:44:23 | FromDiscord | <soundmodel> (edit) removed "it's" |
08:44:26 | FromDiscord | <Elegantbeef> You can implement the entirety other than the entry in native code |
08:44:47 | FromDiscord | <soundmodel> hmm I'll have to look at nimx etc. then |
08:45:02 | FromDiscord | <Elegantbeef> It doesnt use native gui on android but it is cross platform |
08:45:39 | FromDiscord | <Elegantbeef> Checkout sdl2's android example if you want to see what's required |
08:46:08 | FromDiscord | <Elegantbeef> You do have a lot of code written in java running in conjunction, but you can work entirely in Nim, Nico for instance allows you to make games written in Nim only |
08:46:19 | FromDiscord | <soundmodel> but this is what I meant, if it doesn't use native GUI, then it's not "native" |
08:46:28 | FromDiscord | <Elegantbeef> I mean the code is native |
08:46:39 | FromDiscord | <Elegantbeef> That's what i'm talking about, it doesnt use native gui, but the code is native |
08:46:49 | FromDiscord | <Elegantbeef> If you want native gui you need to use interop to achieve that |
08:47:54 | FromDiscord | <soundmodel> but I'd probably also have a sluggier GUI than sluggier background tasks |
08:48:09 | FromDiscord | <soundmodel> so if it can run C at native speeds, then that's a better deal than the VM |
08:48:31 | FromDiscord | <soundmodel> (edit) "but I'd probably also have a sluggier GUI ... than" added "rather" |
08:49:16 | NimEventer | New thread by FabienPRI: Compilation error from nim 1.4 to 1.6.6, see https://forum.nim-lang.org/t/9273 |
08:49:59 | FromDiscord | <Elegantbeef> Yea it'll be running native code so it can run as fast as possible and leak as much memory as your little heart desires |
08:50:18 | FromDiscord | <soundmodel> Ehh: "Hardware accelerated. Nimx uses OpenGL for the graphics. When no animation is running nimx will redraw the windows only when needed to be power efficient. It can also be switched to high FPS mode so it could be used as a porting layer for games." |
08:50:30 | FromDiscord | <soundmodel> why doesn't this mean that it's doing a native GUI? |
08:50:39 | FromDiscord | <soundmodel> you mean that it just doesn't look like the native? |
08:50:45 | FromDiscord | <soundmodel> (edit) "look" => "look" |
08:50:50 | FromDiscord | <Elegantbeef> I mean it's not using the native gui tool kit yes |
08:51:13 | FromDiscord | <Elegantbeef> when people say "native gui" i think that it uses the default GUI toolkit |
08:51:15 | FromDiscord | <soundmodel> hmm this sounds very promising then |
08:51:22 | FromDiscord | <Elegantbeef> It's natively rendered of course |
08:51:42 | FromDiscord | <Elegantbeef> There is also fidget you can look at |
08:52:07 | FromDiscord | <soundmodel> not necessarily, it could also mean whether the GUI is a webview or something? |
08:52:14 | FromDiscord | <Elegantbeef> Both are in development so may not have the greatest experience, but ymmv. I have not used either much |
08:52:19 | FromDiscord | <Elegantbeef> I mean it could mean alot |
08:52:32 | FromDiscord | <Elegantbeef> There is no concrete definition of "native gui" |
08:53:47 | FromDiscord | <soundmodel> well I'm using it for "non-emulated" |
08:54:18 | FromDiscord | <Elegantbeef> Semantics aside have fun |
08:54:45 | FromDiscord | <Elegantbeef> I wonder if Phil has followed along in this conversation |
08:54:54 | FromDiscord | <Elegantbeef> He's probably just staring at all his models shouting "eureka" |
08:56:11 | FromDiscord | <soundmodel> I was about to start learning Java just because of Android, but now it seems that I don't have to |
08:56:30 | FromDiscord | <Andreas> sent a code paste, see https://play.nim-lang.org/#ix=41ba |
08:56:48 | FromDiscord | <Elegantbeef> That is indeed some code |
08:58:01 | FromDiscord | <Andreas> In reply to @Elegantbeef "That is indeed some": some optimization question : why `_raiseOverflow` and not `raiseOverflow` ? |
08:58:22 | FromDiscord | <soundmodel> is "inline asm" an official feature? I didn't see it in the book. |
08:58:34 | FromDiscord | <Elegantbeef> It's in the manual |
08:58:43 | FromDiscord | <Andreas> https://nim-lang.org/docs/manual.html#statements-and-expressions-assembler-statement |
08:58:47 | FromDiscord | <Elegantbeef> No clue andreas i dont know next to nothing about asm |
08:59:03 | FromDiscord | <soundmodel> pretty useful |
08:59:14 | FromDiscord | <Elegantbeef> perhaps even "know next to nothing" |
08:59:18 | FromDiscord | <Andreas> In reply to @Elegantbeef "No clue andreas i": ty, its prbly some name-mangling thing |
08:59:21 | FromDiscord | <soundmodel> because I believe this is what made C/C++ useful also |
09:00:24 | FromDiscord | <Elegantbeef> It could be due to where `raiseOverflow` is defined |
09:00:55 | FromDiscord | <Andreas> In reply to @soundmodel "because I believe this": after spending 3 hrs with that, i guess in-lining in C and using this from Nim might be easier.. |
09:01:34 | FromDiscord | <Elegantbeef> Is this really better than the generated Nim code? |
09:02:42 | FromDiscord | <soundmodel> some very performance critical parts might require lower abstraction than C |
09:02:55 | FromDiscord | <Andreas> In reply to @Elegantbeef "Is this really better": its about this https://github.com/degski/soft_dwcas↵and the CMPXCHG16 from the C-side is a total mess. |
09:03:23 | FromDiscord | <Elegantbeef> Yea that's not going to be read atleast right now |
09:03:35 | FromDiscord | <Elegantbeef> Dont know if reading asm is something someone should do at 3am 😛 |
09:06:55 | FromDiscord | <Andreas> In reply to @Elegantbeef "Dont know if reading": no, don't hurt yourself... |
09:13:43 | FromDiscord | <soundmodel> I'm honestly thinking about moving all my effort to Nim at this point, but I've been confused about people who say that we'd expect to have Java and C++ around for another 10 years or so |
09:14:08 | FromDiscord | <soundmodel> sometimes I wonder if it's just propaganda |
09:14:39 | FromDiscord | <Elegantbeef> Use Nim if you have reason to use it or want to, otherwise dont use it |
09:14:55 | FromDiscord | <soundmodel> Nim just seems to do so much better what people are using C++ and Java for |
09:15:02 | FromDiscord | <Andreas> In reply to @soundmodel "I'm honestly thinking about": nope, it the 'installed-base' and zillions of people who are using and working on this.. make 10 rather 25 |
09:15:16 | FromDiscord | <Andreas> (edit) "25" => "25yrs" |
09:15:32 | FromDiscord | <soundmodel> yes this is the issue, but it offers so much that neither Java nor C++ does |
09:15:42 | FromDiscord | <soundmodel> so it's simply not pragmatic to even ask for such things with older languages |
09:16:04 | FromDiscord | <soundmodel> so I've narrowed my options down to: 1) remaining old-school vs 2) trying to modernize the world |
09:17:19 | FromDiscord | <soundmodel> it solves the issues of people fighting with trying to make Java "low-latency (a new GC strategy)" and "a better language (Kotlin)" or people trying to make C++ a nicer language |
09:17:38 | FromDiscord | <soundmodel> (edit) "it solves the issues of people fighting with trying to make Java "low-latency (a new GC strategy)" and "a better language (Kotlin)" or people trying to make C++ a nicer language ... " added "(with C's performance)" |
09:18:45 | FromDiscord | <soundmodel> but there's a lot of rewriting to be done |
09:20:34 | FromDiscord | <soundmodel> QGIS 3? That's already 20 years of C++ development. |
09:21:06 | FromDiscord | <soundmodel> So I've been wondering whether this is in fact a reason why Nim would not ever become a tool for what it would be good at |
09:21:12 | FromDiscord | <soundmodel> just because there's too much work to be redone |
09:22:46 | FromDiscord | <xflywind> Lacking money and contributors is one of the main reasons. |
09:23:00 | FromDiscord | <xflywind> (edit) "one" => "two" |
09:23:09 | FromDiscord | <soundmodel> but who would genuinely want to rewrite e.g. 20 years of work? |
09:24:04 | FromDiscord | <Rika> someone, once the work to rewrite 20 years of work is less than the work to maintain it |
09:24:05 | FromDiscord | <soundmodel> rather than continue drinking the tar that C++ or Java is |
09:24:40 | * | rockcavera joined #nim |
09:24:41 | * | rockcavera quit (Changing host) |
09:24:41 | * | rockcavera joined #nim |
09:24:53 | FromDiscord | <soundmodel> but this could also mean more effort towards C projects |
09:25:27 | FromDiscord | <soundmodel> e.g. I was seeking code some while ago and I noticed that I'd prefer to use "stable C" code, which in fact means using less popular projects |
09:25:36 | FromDiscord | <soundmodel> when the mainstream is C++ |
09:25:44 | FromDiscord | <soundmodel> (edit) "is" => "projects are in" |
09:30:11 | FromDiscord | <Andreas> In reply to @soundmodel "So I've been wondering": well, if Nim could be established as a learning and prototyping-lang in academia - and i believe PseudoCode->Nim is a attractive option, AFAIK that could change things. |
09:31:13 | FromDiscord | <soundmodel> well one thing is that most people don't even know it exists |
09:31:31 | FromDiscord | <soundmodel> so they're still looking at Kotlin or C++20 or whatever as the solution |
09:31:44 | FromDiscord | <soundmodel> to existing problems |
09:33:01 | FromDiscord | <Andreas> In reply to @soundmodel "so they're still looking": C++, since one human-lifetime seems too short to learn and understand the standard, i'd stay away from this. |
09:33:28 | FromDiscord | <soundmodel> I've always viewed it a bad idea to choose a tool that's inherently more demanding |
09:37:14 | FromDiscord | <Andreas> In reply to @soundmodel "I've always viewed it": and in this regard 'Mastering Nim' [https://www.amazon.de/Mastering-Nim-complete-programming-language/dp/B0B4R7B9YX/ref=sr_1_4?mk_de_DE=ÅMÅŽÕÑ&crid=1AOPDPOODY3YI&keywords=Nim&qid=1656495361&sprefix=nim%2Caps%2C81&sr=8-4] is very important, too. |
09:40:19 | FromDiscord | <soundmodel> Like it says: "Learning a programming language is a huge time investment." |
09:40:30 | FromDiscord | <soundmodel> and I think spending that time on Java or C++ is bad |
09:40:39 | FromDiscord | <soundmodel> (edit) "and I think spending that time on Java or C++ is ... badidea" added "a" | "abad ... " added "idea" |
09:41:07 | FromDiscord | <soundmodel> (edit) "idea" => "idea, because we already know about the inherent design flaws" |
09:44:27 | FromDiscord | <soundmodel> it's like betting on a boat that has sailed just fine up to this point and ignoring the fact that it's almost certainly going to sink eventually |
09:44:36 | FromDiscord | <Andreas> In reply to @soundmodel "and I think spending": time investment [https://www.iso.org/standard/79358.html] 1896-pages vs. 296 (Nim)↵and 198 CHF vs. 62€ |
09:46:14 | FromDiscord | <soundmodel> and also consider the development times |
09:46:36 | FromDiscord | <soundmodel> if nim code will eventually be easier to use, then the time saved there compared to C++ will be huge |
09:47:43 | FromDiscord | <soundmodel> I just don't yet the best way to deal with existing C/C++ codebases |
09:47:51 | FromDiscord | <soundmodel> rewrite all in Nim vs interop |
09:48:21 | FromDiscord | <soundmodel> In Java land I figured out that it's often much easier to rewrite the whole thing in Java than to use JNI |
09:48:54 | FromDiscord | <soundmodel> and one is also left with cleaner code |
10:01:39 | * | CAPSLOCKSTOAT is now known as tinystoat |
10:08:25 | FromDiscord | <Generic> In reply to @Andreas "well, if Nim could": honestly yes |
10:09:03 | FromDiscord | <soundmodel> well it should appeal e.g. because it teaches best parts of C++, Java and Python |
10:09:17 | FromDiscord | <soundmodel> without needing to talk about transpilers or something |
10:09:29 | FromDiscord | <soundmodel> (edit) "needing" => "the need" |
10:09:30 | FromDiscord | <Generic> I currently have algorithms and datastructures in Uni and those ADT we use just scream Nim (or Pascal if you will so) |
10:09:59 | FromDiscord | <soundmodel> at this point I think we were taught C++, Java, C# and Python not because they're good languages |
10:10:07 | FromDiscord | <soundmodel> but because they thought that they will have all the jobs |
10:10:15 | FromDiscord | <soundmodel> which though is a bad point to make in academics |
10:10:31 | FromDiscord | <soundmodel> if one wishes to grow up a newly thinking generation |
10:10:52 | FromDiscord | <Generic> let's go and formally define the possible values of everything and then throw everything out of the window when implementing it in Python |
10:11:00 | FromDiscord | <soundmodel> now I still find 20-somethings writing Java, even when Java to me represents what people in their fifties write |
10:11:18 | FromDiscord | <soundmodel> and 20-somethings should not think what people in their fifties think |
10:12:28 | FromDiscord | <Generic> the OOP coolaid flows deep |
10:13:01 | FromDiscord | <Generic> and is generally considered the "proper" and "maintainable" solution |
10:13:35 | FromDiscord | <soundmodel> I don't understand this discussion about maintainability even, because of e.g. Java's security pitfalls |
10:13:49 | FromDiscord | <soundmodel> maintainable, because of support, not because of good design |
10:14:07 | FromDiscord | <Generic> I know |
10:14:43 | FromDiscord | <Generic> apparently it's more maintable if you split everything up into dozens of classes and interfaces |
10:14:47 | FromDiscord | <soundmodel> and then I was taught that good code should be an independent entity |
10:15:04 | FromDiscord | <soundmodel> if it's hard to update, then it's flawed |
10:15:17 | FromDiscord | <soundmodel> (edit) "flawed" => "wrongly built" |
10:15:40 | FromDiscord | <Prestige> oop is overused but has its use cases |
10:16:00 | FromDiscord | <Generic> In reply to @soundmodel "if it's hard to": I don't think that's necessarily wrong, just that creating dozens of classes and interfaces prematurely just doesn't help with this task |
10:16:03 | FromDiscord | <soundmodel> I never understood why they made OO-only |
10:16:14 | FromDiscord | <soundmodel> when to me it's evident that paradigms lend themselves as DSLs |
10:16:25 | FromDiscord | <soundmodel> not necessarily "-only" paradigms |
10:16:50 | FromDiscord | <soundmodel> e.g. write your management parts in C and then just a OO-C DSL to write a GUI |
10:17:01 | FromDiscord | <soundmodel> (edit) "just" => "use" |
10:19:14 | FromDiscord | <soundmodel> https://stackoverflow.com/questions/10504271/easily-parsing-a-dsl-with-pure-c |
10:19:17 | FromDiscord | <Generic> one thing which Nim really taught me as a princible, is to always use the least powerful tool for a task |
10:19:25 | FromDiscord | <soundmodel> but it also mentions Lua there, which I've considered a serious Nim competitor |
10:19:34 | FromDiscord | <Generic> and in most cases a class is already an overkill |
10:19:42 | FromDiscord | <Generic> while in some it's an adequate tool |
10:19:56 | FromDiscord | <Generic> (edit) "powerful" => "powerful, but adequate" |
10:20:47 | FromDiscord | <soundmodel> I've also been looking at moving to Lua instead, because it's more available |
10:23:20 | FromDiscord | <Andreas> In reply to @soundmodel "I've also been looking": stay with us and try https://github.com/jangko/nimLUA |
10:26:39 | FromDiscord | <Generic> I like lua as a scripting language, because it actually is just that |
10:27:01 | FromDiscord | <soundmodel> I think Lua is what C++ should've been |
10:27:26 | FromDiscord | <soundmodel> you want to write C and script repetitive parts, not write C and write repetitive parts in C++ |
10:28:31 | FromDiscord | <Generic> C++ has enough things going for it over C than just the OOP constructs |
10:29:04 | FromDiscord | <soundmodel> I'm not sure if OOP is even useful for other than as a "macro" thing |
10:29:11 | FromDiscord | <soundmodel> most computations are imperative |
10:30:16 | FromDiscord | <soundmodel> so in a sense there should not even be a "pure OO" computing paradigm |
10:30:28 | FromDiscord | <soundmodel> but rather it's just an abstraction over imperative |
10:31:19 | FromDiscord | <Generic> sometimes OO abstractions are very useful |
10:31:35 | * | wallabra quit (Ping timeout: 255 seconds) |
10:31:56 | FromDiscord | <soundmodel> abstractions, but not that you tie the whole language to be OO (like Java does) |
10:32:13 | FromDiscord | <Generic> yes, but C++ doesn't do that |
10:32:20 | FromDiscord | <Generic> some people use it like Java, but you don't have |
10:32:25 | FromDiscord | <Generic> (edit) "some people use it like Java, but you don't have ... " added "to" |
10:32:35 | FromDiscord | <soundmodel> no but it does not maybe sit at the abstraction level that a scripting language over C does |
10:32:47 | FromDiscord | <soundmodel> because it means that one's still writing parts in C |
10:32:51 | FromDiscord | <soundmodel> that one would wish to script |
10:33:11 | FromDiscord | <soundmodel> and then you have people doing C -> C++ -> Lua |
10:34:36 | FromDiscord | <soundmodel> but Lua and Nim seem similar in some cases |
10:34:45 | FromDiscord | <soundmodel> e.g. because they both interact on top of C and C++ |
10:35:36 | FromDiscord | <Generic> I don't think that's a good comparison |
10:36:24 | FromDiscord | <Generic> lots of things are build on top of C |
10:36:33 | FromDiscord | <soundmodel> well yes, e.g. because the other isn't statically typed |
10:37:53 | FromDiscord | <soundmodel> thought there seems to be Typed Lua |
10:38:11 | FromDiscord | <soundmodel> well also that they're crucially meant to be "C-extension" languages |
10:38:32 | FromDiscord | <soundmodel> and they abstract more than C++ |
10:38:52 | FromDiscord | <Generic> the problem is that dynamic typing makes languages significantly simpler |
10:39:16 | FromDiscord | <Generic> without it you need atleast good generics |
10:39:38 | FromDiscord | <soundmodel> (edit) "thought" => "though" |
10:40:27 | FromDiscord | <Generic> in the end I think that static typing is worth the extra complexity (that's why I'm using Nim afterall), but for scripting language a simpler language is a benefit |
10:40:32 | FromDiscord | <soundmodel> but I'm not sure what the core arguments for Nim over Lua are |
10:40:48 | FromDiscord | <soundmodel> as currently I perceive that Lua has a better support for libraries for example |
10:40:53 | FromDiscord | <Generic> static typing, speed, ... |
10:41:52 | FromDiscord | <soundmodel> but there's Typed Lua, and Lua is still faster than Python |
10:42:25 | FromDiscord | <Generic> it's still slow, if you're only stringing together C libraries that doesn't make a difference |
10:42:38 | FromDiscord | <Generic> but once you implement anything yourself it's a deep dive |
10:42:50 | FromDiscord | <Generic> with Nim that's not at all the case |
10:43:29 | FromDiscord | <soundmodel> https://scilua.org/ |
10:43:33 | FromDiscord | <soundmodel> slow? |
10:44:41 | FromDiscord | <soundmodel> based on that it seems that it's on average about as fast as C |
10:46:10 | FromDiscord | <Generic> read what I wrote, if you use an external C library to do the matrix multiplication for you, everything is as fast as C |
10:47:21 | FromDiscord | <soundmodel> but isn't this the point of using C in the first place? |
10:47:35 | FromDiscord | <soundmodel> and then using a scripting language to make writing repetitive parts nicer or to allow nicer abstractions for readability |
10:47:48 | FromDiscord | <Generic> with Nim you can do everything in one language |
10:48:10 | FromDiscord | <soundmodel> well yes |
11:16:14 | * | pro joined #nim |
12:01:31 | * | pro quit (Quit: pro) |
12:11:03 | * | ltriant quit (Ping timeout: 256 seconds) |
12:13:57 | * | ltriant joined #nim |
12:20:21 | FromDiscord | <Phil> I mean, if you're only stringing c libs together you can make the case of why not use python? I'm sure you can compile python to a binary as well if that's the thing you want |
12:31:05 | * | GreaseMonkey quit (Quit: No Ping reply in 180 seconds.) |
12:32:12 | * | vicecea quit (Remote host closed the connection) |
12:32:21 | * | greaser|q joined #nim |
12:33:13 | * | vicecea joined #nim |
12:52:40 | FromDiscord | <aph> sent a code paste, see https://play.nim-lang.org/#ix=41c9 |
12:56:11 | FromDiscord | <soundmodel> In reply to @Isofruit "I mean, if you're": Because ultimately there's a plethora of apps for which a 30x speed penalty is non-ideal |
12:56:44 | FromDiscord | <soundmodel> but I like the option of using Python libraries from Nim, because that means that one can run "that specific stochastics algo" or something |
12:58:31 | FromDiscord | <soundmodel> tbh I don't understand people that are still pushing Python to mobile and whatever. Maybe their motive is to just lower dev time, while compromising software quality. |
13:00:33 | FromDiscord | <soundmodel> I think some guy somewhere was trying to do a music application with C for audio and Python for GUI, but while reasonable in theory, the Python parts are still very slow |
13:02:30 | * | jmdaemon quit (Ping timeout: 264 seconds) |
13:04:41 | FromDiscord | <deech> How do hooks work with inherited objects? eg. if I make `=copy` an error in a parent does the child also inherit it, does `=destroy` cascade up the inheritance chain? |
13:08:23 | FromDiscord | <soundmodel> but after reading more about Nim, it has started to seem to me that a lot of other langs are quite obsolete tbh |
13:08:28 | FromDiscord | <soundmodel> because they offer nothing better |
13:08:48 | FromDiscord | <soundmodel> well, except for support and libraries, but that's not even part of the language |
13:08:57 | FromDiscord | <soundmodel> (edit) "that's" => "those are" |
13:09:19 | FromDiscord | <soundmodel> R for example seems very comical these days |
13:33:39 | FromDiscord | <Phil> In reply to @soundmodel "Because ultimately there's a": If python just does the calls to the libs that performance penalty barely matters |
13:34:16 | FromDiscord | <Phil> If python does actual work it matters, but it would also matter in lua then if I understood you right |
13:36:03 | FromDiscord | <soundmodel> based on what benchmarks |
13:36:13 | FromDiscord | <Phil> Never wrote lua so no idea of its typical performance, but what I understood so far it's that performance of both isn't great, though lua is still better than python. But in the scenario of having c do the work, the performance of the caller language doesn't matter |
13:36:18 | FromDiscord | <soundmodel> there's also added overhead from going from C to Python, just like in any FFI |
13:37:01 | FromDiscord | <enthus1ast> lua (at least luajit) has the reputation to be very fast |
13:37:25 | * | arkurious joined #nim |
13:37:36 | FromDiscord | <enthus1ast> thats (one?) the reason it is used in quite a lot of game engines |
13:37:43 | FromDiscord | <Phil> I recall a GitHub repo with highly synthetic benchmarks that put python via number crunching in numpy up there with the best of them |
13:38:18 | FromDiscord | <enthus1ast> also python's pypy seems to be also quite fast |
13:38:23 | FromDiscord | <soundmodel> but python program cannot be as fast as a C program |
13:38:34 | FromDiscord | <soundmodel> (edit) "python" => "a Python" |
13:38:40 | FromDiscord | <soundmodel> due to the added layers |
13:39:11 | FromDiscord | <soundmodel> my starting point is not btw to "drop into C", but to consider C first and then how to make it less verbose |
13:40:02 | FromDiscord | <Phil> True, but it's close enough while needing a fraction of the effort, which was your usecase for adding lua into the if I understood you right |
13:41:35 | FromDiscord | <Phil> Close enough being within 20-30% or so |
13:41:57 | FromDiscord | <soundmodel> https://dzhelil.info/_images/convergence_id.png |
13:42:26 | FromDiscord | <soundmodel> I guess this works out, because possibly there's absolutely nothing in in Python except for maybe reading a few symbols |
13:42:38 | FromDiscord | <soundmodel> (edit) "in" => "being done" |
13:44:38 | FromDiscord | <Phil> Pretty much, which is why I was making the case that if it's only about having a different interface to code written in c then python tells a more compelling story, assuming your task means no actual work is being done in python |
13:45:30 | * | LuxuryMode joined #nim |
13:45:36 | FromDiscord | <Phil> And why I was supporting generics point that the calling language doesn't matter in such scenarios |
13:45:52 | FromDiscord | <soundmodel> but I've interpreted that Nim and Python have different goals |
13:46:00 | FromDiscord | <soundmodel> which means that Python is not the answer |
13:47:33 | FromDiscord | <soundmodel> C++ is another answer, but it fails in usability perspectives |
13:47:47 | FromDiscord | <soundmodel> but it fulfills "extension of C" |
13:48:06 | FromDiscord | <Phil> I'll come back to this once off work, this is going beyond the time I can dedicate to this during work |
13:48:13 | NimEventer | New thread by Dee0xeed: Stack/heap addresses, confusion, see https://forum.nim-lang.org/t/9274 |
13:48:25 | FromDiscord | <soundmodel> I've been going around this topic for some months |
13:48:46 | FromDiscord | <soundmodel> I have a bunch of projects that I'd like to work on, but I cannot select between Nim, Java, C++, C. |
13:48:58 | FromDiscord | <soundmodel> (edit) "C." => "C and Python." |
13:49:02 | FromDiscord | <soundmodel> (edit) "C" => "C, Lua" |
13:50:23 | FromDiscord | <deadmeme77> Which language and ecosystem do you want to learn the most? |
13:50:28 | FromDiscord | <deadmeme77> Choose that |
13:51:13 | FromDiscord | <enthus1ast> i would choose nim, then build stuff thats missing and release these libs = win \:) |
13:52:39 | FromDiscord | <Zoom> If you have to ask the questions either you're too free and can choose whatever you like the most, or you're not so free in your choices but don't understand it fully. In the latter case, stick with Python.↵(@soundmodel) |
13:57:00 | FromDiscord | <soundmodel> Purely from a functional perspective I'd go with Python, since it has all the needed libraries, but since Nim is about the same but faster, then it should be trivially a better language ultimately |
13:57:35 | FromDiscord | <enthus1ast> at least, its much easier to produce working code with nim than in python |
13:57:57 | FromDiscord | <enthus1ast> python crashes later on runtime, while nim code does not even compile |
13:58:35 | FromDiscord | <soundmodel> at one point my problem was that there wasn't libraries |
13:58:49 | FromDiscord | <soundmodel> now the main problem is that I don't want to use sinking ship language technologies |
13:59:45 | FromDiscord | <soundmodel> (edit) "now the main problem is that I don't want to use sinking ship language ... technologieswhere" added "technologies, i.e." | "technologies, i.e.technologies ... " added "where your code is going to become obsolete" |
14:06:01 | * | sagax quit (Read error: Connection reset by peer) |
14:06:21 | FromDiscord | <soundmodel> I read that some devs use Java etc. not for long-termism, but more as a "develop, ship and discard" -sense |
14:06:28 | FromDiscord | <soundmodel> (edit) "-sense" => "kind of thing" |
14:07:31 | FromDiscord | <soundmodel> (edit) "long-termism," => "longtermism," |
14:14:37 | FromDiscord | <soundmodel> "Longtermism is an altruistic stance that we should be giving priority to improving the lives of people in the future over ourselves." |
14:15:00 | FromDiscord | <soundmodel> so if we choose to use Nim now, then the future could be nicer |
14:20:27 | * | sagax joined #nim |
14:53:16 | FromDiscord | <PyryTheBurger> when i make a type with variables, how can i assign them multiple times? |
15:02:30 | FromDiscord | <PyryTheBurger> like how can i change variables of an object multiple times |
15:03:05 | FromDiscord | <enthus1ast> what do you mean? |
15:04:30 | FromDiscord | <enthus1ast> myObj.myVar = myNewValue |
15:04:41 | FromDiscord | <PyryTheBurger> sent a long message, see http://ix.io/41cQ |
15:04:50 | FromDiscord | <PyryTheBurger> sent a long message, see http://ix.io/41cR |
15:04:54 | FromDiscord | <PyryTheBurger> but it says v.color cannot be assigned to |
15:05:01 | FromDiscord | <!Patitotective> use `mpairs` |
15:05:17 | FromDiscord | <PyryTheBurger> ohh |
15:05:19 | FromDiscord | <PyryTheBurger> perfect |
15:05:22 | FromDiscord | <PyryTheBurger> thankyou |
15:06:33 | FromDiscord | <PyryTheBurger> i love how with nim there is such a helpful community |
15:43:50 | FromDiscord | <luteva> can i get the (current) size of a stream? I want to jump to the end of the stream. I could use setPosition() but how can i know the position where the streams ends (at the moment)? Do I need to readLine until the end? Or is there a cleverer way? |
15:44:29 | FromDiscord | <luteva> something like stream.getLength() |
15:44:45 | FromDiscord | <luteva> or stream.getSize() |
15:44:55 | FromDiscord | <luteva> but that doesn't exist. |
15:48:06 | FromDiscord | <enthus1ast> a stream could maybe never end |
15:48:18 | FromDiscord | <enthus1ast> is this a fileStream? |
15:48:56 | FromDiscord | <🐒🧠br4n_d0n> In reply to @deech "How do hooks work": I think deech's question got lost in the argument about Java, Python, etc.↵So, I'm posting it again for his sake |
15:50:39 | FromDiscord | <enthus1ast> @luteva if it is a filestream you could use the file size |
15:51:21 | FromDiscord | <luteva> In reply to @enthus1ast "a stream could maybe": this is why i am asking for the _current length_ |
15:51:39 | FromDiscord | <luteva> 🙂 |
15:53:42 | FromDiscord | <d4rckh> durCheckin is a `Duration`, why is `durCheckin.seconds` trying to call `seconds(durCheckin)` instead of giving me the `seconds` property of the duration? |
15:53:46 | FromDiscord | <luteva> ok so it seems that i have to implement that proc. can i get the source of the stream? so that i can write a generic proc for both: stringstream and filestream? |
15:56:15 | FromDiscord | <enthus1ast> @d4rckh\: seconds is not exported |
15:56:31 | FromDiscord | <!Patitotective> In reply to @d4rckh "durCheckin is a `Duration`,": it needs to convert the seconds AND nanoseconds to whole seconds↵use https://nim-lang.org/docs/times.html#inSeconds%2CDuration |
15:56:43 | FromDiscord | <d4rckh> ah, actually i just wanted a human readable representation of the duration |
15:56:56 | FromDiscord | <d4rckh> i can just use the `$` proc instead |
16:13:36 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=41d5 |
16:17:59 | FromDiscord | <Gabben> sent a code paste, see https://play.nim-lang.org/#ix=41d6 |
16:19:02 | FromDiscord | <golova> What's some actual difference between `cuint` and `uint` in C backend? Doing some low-level assembler stuff and calculation seems wrong, so |
16:22:19 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=41d9 |
16:25:32 | FromDiscord | <golova> In reply to @Patitotective "how can i make": you can make simple wrapper func with a `var T` return type |
16:27:22 | FromDiscord | <golova> In reply to @golova "you can make simple": https://play.nim-lang.org/#ix=2lK1 |
16:27:46 | FromDiscord | <!Patitotective> In reply to @golova "https://play.nim-lang.org/#ix=2lK1": i think you sent the wrong link |
16:28:09 | FromDiscord | <golova> sorry |
16:28:15 | FromDiscord | <golova> (edit) "https://play.nim-lang.org/#ix=2lK1" => "https://play.nim-lang.org/#ix=41db" |
16:28:17 | FromDiscord | <golova> fixed |
16:30:07 | FromDiscord | <!Patitotective> In reply to @golova "https://play.nim-lang.org/#ix=41db": that works if i don't assign `wrapper(verySeq, 0)` to a variable https://play.nim-lang.org/#ix=41dd |
16:31:23 | FromDiscord | <!Patitotective> In reply to @enthus1ast "a pointer works, but": i also think its quite unsafe :/ |
16:31:44 | FromDiscord | <enthus1ast> imho its better to just directly access the seq |
16:33:18 | FromDiscord | <!Patitotective> yea but with nested seqs it gets quite verbose↵but i guess 🤷♂️ |
16:36:11 | FromDiscord | <golova> what's wrong with `ptr` approach? |
16:38:07 | FromDiscord | <!Patitotective> untraced references are unsafe https://nim-lang.org/docs/manual.html#types-reference-and-pointer-types |
16:53:58 | FromDiscord | <golova> In reply to @Patitotective "untraced references are unsafe": I know, but they unsafe only if misused |
16:54:25 | FromDiscord | <golova> if you create some well-written template using `ptr`'s nothing bad will happen |
16:58:33 | FromDiscord | <!Patitotective> i fear myself, ill just directly access the seq |
17:15:39 | * | pro joined #nim |
17:24:57 | * | LuxuryMode quit (Quit: Connection closed for inactivity) |
17:31:23 | FromDiscord | <exelotl> In reply to @Gabben "How to write a": You can't afaik, macro pragmas are only for vars, procs and types. |
17:32:14 | FromDiscord | <exelotl> but if you're just wanting to make a pragma that adds other pragmas, the `{.pragma.}` pragma might suffice |
17:32:26 | FromDiscord | <exelotl> https://nim-lang.org/docs/manual.html#userminusdefined-pragmas-pragma-pragma |
17:34:50 | FromDiscord | <exelotl> In reply to @golova "What's some actual difference": `cuint` is typically 32 bits even on 64-bit machines. `uint` has the machine's native integer size (64 bits on 64-bit machines) |
17:42:28 | * | pro quit (Quit: pro) |
18:32:26 | FromDiscord | <PyryTheBurger> how do i remove the last charecter form a string? |
18:34:24 | FromDiscord | <eyecon> `s.setlen(s.len-1)`? |
18:35:00 | FromDiscord | <eyecon> Assuming non-unicode-aware |
18:35:59 | FromDiscord | <PyryTheBurger> is it possible to have unicode recognize backspace |
18:38:04 | FromDiscord | <!Patitotective> In reply to @PyryTheBurger "is it possible to": not sure what you mean but you may want to use https://nim-lang.org/docs/unicode.html↵and maybe measure the lenght of the last rune and remove it (?) |
18:45:09 | * | noeontheend joined #nim |
19:01:55 | * | Guest89 joined #nim |
19:04:00 | * | Guest89 quit (Client Quit) |
19:20:58 | * | noeontheend quit (Ping timeout: 240 seconds) |
19:21:18 | FromDiscord | <🐒🧠br4n_d0n> sent a code paste, see https://play.nim-lang.org/#ix=41ec |
19:21:25 | * | krux02 joined #nim |
19:23:47 | FromDiscord | <Kermithos> In reply to @br4n_d0n "How do I represent": what error did you get? |
19:24:51 | FromDiscord | <🐒🧠br4n_d0n> ``Error: missing closing ' for character literal`` |
19:29:21 | FromDiscord | <!Patitotective> unicode do not fit in a characther, you need to use a string |
19:29:22 | * | LuxuryMode joined #nim |
19:30:05 | FromDiscord | <🐒🧠br4n_d0n> That's was my guess, but I wasn't sure how nim handled ``' '`` |
19:30:35 | FromDiscord | <!Patitotective> if you really a single one you can do `"🐡".runeAt(0)`↵then youll have a `Rune` |
19:31:08 | FromDiscord | <🐒🧠br4n_d0n> Wouldn't that require an import for Rune? |
19:31:19 | FromDiscord | <!Patitotective> `import std/unicode` |
19:32:16 | FromDiscord | <🐒🧠br4n_d0n> Yeah, I was trying to do it without imports, so I'll just use ``" "`` unless this ends up taking more space than a ``Rune`` would |
19:32:53 | * | averell quit (Quit: .) |
19:45:24 | FromDiscord | <Kermithos> is https://play.nim-lang.org down? |
19:46:10 | FromDiscord | <luteva> How can i post some formated code, here? I mean how to make it being formatted? |
19:47:03 | FromDiscord | <Prestige> Use 3 grave markers followed by nim |
19:47:09 | FromDiscord | <🐒🧠br4n_d0n> sent a code paste, see https://play.nim-lang.org/#ix=41ee |
19:47:27 | FromDiscord | <luteva> thx! |
19:48:45 | FromDiscord | <🐒🧠br4n_d0n> In reply to @Kermithos "is https://play.nim-lang.org down?": I think I broke it |
19:50:11 | FromDiscord | <Kermithos> I thought I did xd |
19:50:27 | FromDiscord | <luteva> sent a code paste, see https://play.nim-lang.org/#ix=41ei |
19:50:42 | FromDiscord | <luteva> (edit) |
19:51:19 | FromDiscord | <Rika> you shouldnt close the file if you close the stream |
19:51:35 | FromDiscord | <luteva> ok. Thanks! |
19:52:15 | FromDiscord | <luteva> why? and could i also close the file (and not the stream)? or will this lead to a leak? |
19:53:10 | FromDiscord | <Rika> the stream closes the file |
19:53:16 | FromDiscord | <Rika> i dont know on the second question |
19:53:33 | FromDiscord | <luteva> ok thank you very much! |
20:06:31 | * | greaser|q quit (Changing host) |
20:06:31 | * | greaser|q joined #nim |
20:06:53 | * | greaser|q is now known as GreaseMonkey |
20:18:10 | FromDiscord | <luteva> is there an easy example of a stream continously read a file (e.g. a log file) and just printing out what came in?↵I am not sure about the async await part which is needed i guess. So an easy example would be great! |
20:19:48 | FromDiscord | <luteva> or do i just need a never-ending loop? |
20:20:21 | FromDiscord | <luteva> (and some sleep to not burn the CPU) |
20:21:36 | FromDiscord | <Elegantbeef> It's an IO operation so async should be golden but doesnt seeem that there are async file streams 😄 |
20:21:50 | FromDiscord | <huantian> Wait really? |
20:21:57 | FromDiscord | <huantian> Ohhh yeah I remember seeing that issue somewhere |
20:24:19 | FromDiscord | <Elegantbeef> Yea the way the stream module is written i think makes it so you cannot use async with it |
20:24:27 | FromDiscord | <Elegantbeef> Since it calls procs internally |
20:24:55 | FromDiscord | <huantian> Wait I think there is an asyncRead somewhere right |
20:24:59 | FromDiscord | <Elegantbeef> Wonder if could use tags + concepts |
20:25:19 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/asyncstreams.html#read%2CFutureStream%5BT%5D you mean? |
20:25:20 | FromDiscord | <huantian> I know the async downloadFile uses something async file |
20:25:58 | FromDiscord | <Elegantbeef> There is a `readToStream` |
20:27:22 | FromDiscord | <Elegantbeef> Actually we could just use static generics for streams |
20:28:09 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=41ev |
20:28:10 | FromDiscord | <Elegantbeef> Then we can reuse most code |
20:31:39 | FromDiscord | <Elegantbeef> Guess that might be a thing for Nimv2 if someone is so inclined |
21:41:41 | FromDiscord | <slymilano> @Araq new book!? Woah congrats! |
21:41:48 | FromDiscord | <slymilano> https://nim-lang.org/blog/2022/06/29/mastering-nim.html |
21:48:26 | * | wallabra joined #nim |
21:49:19 | FromDiscord | <ripluke> Is there a way that I can "listen" to the output of a command |
21:49:37 | FromDiscord | <ripluke> Like a command which outputs a line Everytime something changes |
21:50:10 | FromDiscord | <Elegantbeef> You want a file watcher? |
21:50:37 | FromDiscord | <ripluke> Not exactly |
21:51:00 | FromDiscord | <ripluke> Like it's hard to describe |
21:51:10 | FromDiscord | <Elegantbeef> Well use your words |
21:51:31 | FromDiscord | <ripluke> But I have this shell command that outputs a line of text Everytime something changes |
21:51:58 | FromDiscord | <Elegantbeef> "something"? |
21:52:03 | FromDiscord | <ripluke> So I want to do something every time that command outputs a new line |
21:52:30 | FromDiscord | <Elegantbeef> I mean you just `readLine` then after you do your logic |
21:52:54 | FromDiscord | <ripluke> In reply to @Elegantbeef "I mean you just": Yea but how can I read line from a shell command |
21:53:26 | FromDiscord | <ripluke> So basically I'm script a bar for my wm |
21:53:47 | FromDiscord | <ripluke> And I have this shell command that outputs a line of text every time my focused window changes |
21:55:02 | FromDiscord | <Elegantbeef> you run the shell in your program |
21:55:06 | FromDiscord | <Elegantbeef> rather the command |
21:55:15 | FromDiscord | <Elegantbeef> `startProcess` |
21:55:37 | FromDiscord | <ripluke> Oh and then I read line from it? |
21:55:44 | FromDiscord | <Elegantbeef> Yes |
21:55:48 | FromDiscord | <ripluke> Ok |
21:55:59 | FromDiscord | <Elegantbeef> Readline is blocking so you probably want async or a thread to do it |
22:00:36 | FromDiscord | <ripluke> Ok |
22:08:34 | FromDiscord | <Bubblie> how do forward declare a proc that returns a boolean etc. |
22:09:22 | FromDiscord | <demotomohiro> You can forward declare like `proc foo(x: int): bool`. |
22:09:48 | FromDiscord | <Bubblie> thanks! |
22:21:49 | * | noeontheend joined #nim |
22:35:26 | FromDiscord | <luteva> how do i get updates written into a file in a nim programm that has opened the file and reads the data using a filestream?↵I mean i do not get the updates. I open the file that is opend in the nim programm in an editor, add some lines save it. but the newly added lines aren't reflected in the nim programm.↵Do I have to close and reopen the file whenever i expect some updates? |
22:35:58 | FromDiscord | <Elegantbeef> Filestreams store position you need to reset the position when the file is modified |
22:36:10 | FromDiscord | <Elegantbeef> Look at https://nim-lang.org/docs/os.html#getLastModificationTime%2Cstring |
22:43:54 | FromDiscord | <luteva> do you have any examle? i don't understand. reset the position to what value? i mean, when i add some line at the end of the file and save the file, i would expect the newly added line to get read by the readline proc. |
22:49:06 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=41fa |
22:49:28 | FromDiscord | <Elegantbeef> If you're writing to a file it should just work |
22:50:21 | FromDiscord | <luteva> sent a code paste, see https://play.nim-lang.org/#ix=41fc |
22:50:38 | FromDiscord | <luteva> (edit) |
22:56:21 | FromDiscord | <Elegantbeef> Do not get why it's doing that |
22:59:07 | FromDiscord | <luteva> 🤔 |
23:07:10 | * | noeontheend quit (Ping timeout: 268 seconds) |
23:13:08 | * | noeontheend joined #nim |
23:14:02 | FromDiscord | <voidwalker> @ElegantBeef (on discord) do you take unsolicited pms ? Cause I sent you one : ) |
23:15:17 | FromDiscord | <Elegantbeef> I had seen it but I dont have a response |
23:15:30 | FromDiscord | <Elegantbeef> I tend to only talk in public so people can correct me |
23:16:34 | FromDiscord | <Prestige> Elegantbeef: I made changes to https://github.com/avahe-kellenberger/seq2d if you had more feedback. I'm still not sure what name I'd use in places of `items` and `mitems` but I'm open to suggestions |
23:16:35 | FromDiscord | <voidwalker> Well, I'd ask here but it's kind of a longer conversation, and not specifically nim related, just a more general program design, to be written in nim |
23:16:53 | FromDiscord | <!Patitotective> beef, the runes check thing already existed↵https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/unicode.nim#L619 |
23:17:11 | FromDiscord | <Elegantbeef> `indexValues` or `posValues` and `mPosValues` or similar |
23:17:59 | FromDiscord | <Elegantbeef> I dont get what you need that for patito but ok |
23:18:42 | FromDiscord | <Elegantbeef> Not like it's really active here anyway↵(@voidwalker) |
23:19:00 | FromDiscord | <Elegantbeef> I'm not going to tell you how to write your entire program, who knows i might not even give suggestions depending on what it is |
23:20:07 | * | noeontheend quit (Ping timeout: 268 seconds) |
23:21:31 | FromDiscord | <voidwalker> obviously I don't need it written for me, or detailed specifications for each part. It's a sort of an universal content (video, applications, documents etc) manager, launcher and downloader. |
23:24:03 | FromDiscord | <voidwalker> I began writing it in pascal/lazarus, cause of the very easy cross platform gui templating. But lack of recent libraries for various stuff, dead end community, and potentially very few contributors.. I decided it's not the right path to go |
23:25:03 | FromDiscord | <Elegantbeef> Well start writing and if people want to contribute they will |
23:25:16 | FromDiscord | <Elegantbeef> Hell for things like that contributors are probably not even in the community the language is in |
23:25:23 | * | krux02 quit (Remote host closed the connection) |
23:25:44 | FromDiscord | <Elegantbeef> If people like tooling but find bugs or want to add features they'll learn the language |
23:25:52 | FromDiscord | <voidwalker> Can I at least tell you what it's about ? in pm |
23:26:14 | FromDiscord | <Elegantbeef> It seems like you're capable of doing such so yes you can |
23:30:37 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "Then have fun": no wrapping, just fun https://media.discordapp.net/attachments/371759389889003532/991848195313373274/unknown.png |
23:35:59 | FromDiscord | <Elegantbeef> How bad is your code though patito? |
23:36:44 | FromDiscord | <luteva> what does 'owned' mean? I am still wondering about the FileStream code which doesn't get updates.... So the newFileStream creates an "owned FileStream". If owned means "this is the owner and the only one that is allowed to write to the file", then this might be the reason why the stream doesn't get any updates.... right? |
23:37:09 | FromDiscord | <Elegantbeef> I think owned might be a no op now but used to have meaning |
23:37:14 | FromDiscord | <Elegantbeef> I see it a lot but i dont know what it means exactly |
23:45:38 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "How bad is your": amazing unicode support |
23:46:03 | FromDiscord | <Elegantbeef> Damn i heard the matrix dodge with that one |
23:48:29 | FromDiscord | <!Patitotective> also c++ code is barely commented so there are some parts ive no idea what they do |
23:48:57 | FromDiscord | <xflywind> owned had meanings in newruntime. But newruntime is deprecated no op. |
23:49:21 | FromDiscord | <xflywind> It can probably be removed. |
23:50:37 | FromDiscord | <xflywind> (edit) "deprecated no op." => "deprecated." |
23:50:51 | FromDiscord | <Prestige> Making a wrapper for c++ code is a pain still isn't it? |
23:51:17 | FromDiscord | <Elegantbeef> It was 200 loc prestige |
23:51:41 | FromDiscord | <Elegantbeef> The public api that is |
23:51:50 | FromDiscord | <Prestige> Oh I'm asking about something unrelated to the conversation |
23:52:06 | FromDiscord | <Prestige> Looking into https://develop.kde.org/frameworks/kirigami/ |
23:52:11 | FromDiscord | <Elegantbeef> It's not that much of a pain if it's small, if it's a large library c2nim can kinda be used but not seemlessly |
23:53:16 | FromDiscord | <Elegantbeef> Ideallly you get a C api but given it's qt yea good luck with that |
23:53:31 | FromDiscord | <Prestige> ah here it is https://invent.kde.org/frameworks/kirigami |
23:54:41 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "It's not that much": if i tried to use c2nim for the whole file it would index of out ranfe↵if i tried with just a function it will only wrap the function header :/ |
23:54:49 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "It was 200 loc": 300 |
23:54:58 | FromDiscord | <Elegantbeef> You have to setup the file for c2nim to work well |
23:55:04 | FromDiscord | <Elegantbeef> You cannot just feed it like futhark |
23:55:11 | FromDiscord | <!Patitotective> 🤨 |
23:55:35 | FromDiscord | <xflywind> In reply to @luteva "what does 'owned'": just ignore owned. It should have been removed or ignored by nim doc. |
23:55:48 | FromDiscord | <Elegantbeef> c2nim is not the same as futhark it works purely on the text and knowledge it has it doesnt rely on a C/C++ compiler to reason what code is |
23:56:36 | FromDiscord | <Elegantbeef> But yea prestige you should be in theory capable of wrapping that with C2Nim + a bunch of time but there is no futhark for C++ code |
23:59:30 | FromDiscord | <Prestige> c++ makes me sad |