<< 30-03-2024 >>

00:04:22FromDiscord<Robyn [She/Her]> Oh wait VM
00:07:39*SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev)
00:08:03*SchweinDeBurg joined #nim
00:29:03rockcaveratermer if you want to pass a string to an array, in the VM, you will have to make a byte-by-byte copy through a loop.
00:46:24FromDiscord<Robyn [She/Her]> In reply to @rockcavera "termer if you want": `toOpenArray` exists tbf
00:49:36FromDiscord<michaelb.eth> In reply to @chronos.vitaqua "I'm not looking forward": nim-sqlite3-abi is not that bad once you get the hang of it
00:50:26FromDiscord<michaelb.eth> and it's nice that you get built from source sqlite automatically and statically linked into the executable
00:51:26FromDiscord<Robyn [She/Her]> Fair, still not looking forward to it tho lol
00:54:47FromDiscord<michaelb.eth> In reply to @chronos.vitaqua "Fair, still not looking": maybe look into nim-datastore to see how a high-level Nim api can be wrapped around nim-sqlite3-abi:↵https://github.com/codex-storage/nim-datastore
00:56:52FromDiscord<Robyn [She/Her]> Thanks!
00:59:35*Batzy quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
01:28:32FromDiscord<Elegantbeef> Ok I feel dumb now.... I was sending a json body where it was supposed to be a query parameter
01:28:56FromDiscord<Elegantbeef> Such a silly thing
02:14:37*lucasta joined #nim
02:23:25FromDiscord<spivee> Hey all, I have a C project that I am looking at adding a high level language to. I really like the Rust paradigm of local mutable state, and shared immutable state, (unless you opt out with Cell/etc. but I tend not to) and was wondering if there is a `make_mut` equivalent for the `ref` types in Nim, or immutable annotations for function arguments?
02:24:04FromDiscord<Elegantbeef> You can use `func` with `{.strictFunc.}` to disable all writing to `ref` types in 2.0
02:24:34FromDiscord<Elegantbeef> Is that still enabled with --experimental\:strictFunc ... I don't recall
02:25:01FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual_experimental.html#strict-funcs
02:26:48FromDiscord<Elegantbeef> Though there is no way to allow mutation without a pragma like so https://play.nim-lang.org/#pasty=paFVONFDoeuJ
02:29:46*rockcavera quit (Remote host closed the connection)
02:31:19*jkl quit (Quit: Gone.)
02:33:01*jkl joined #nim
02:36:56*rockcavera joined #nim
02:38:13FromDiscord<spivee> In reply to @Elegantbeef "You can use `func`": Hmm okay, that could work! Makes functions a little less powerful and procs a little more powerful than I want, but knowing a function is pure is a win.
02:38:31FromDiscord<spivee> Also how do sequences work? You can modify them? Are they reference counted?
02:38:40FromDiscord<Elegantbeef> They're value types
02:38:50FromDiscord<Elegantbeef> They copy on assignment and destroy at the end of their lifetime
02:41:32FromDiscord<spivee> Cool okay. So to modify a sequence in a function, you pass it into the function, then the function returns a modified version?
02:41:59FromDiscord<Elegantbeef> Unless you pass it as `var seq[T]`
02:42:22FromDiscord<spivee> Oh awesome.
02:43:10FromDiscord<spivee> `var` arguments manipulating sequences are probably all I need, don't really need `ref`.
02:43:20FromDiscord<Elegantbeef> Correct
02:43:24FromDiscord<Elegantbeef> You hardly ever truly need `ref`
02:44:46FromDiscord<Elegantbeef> `ref`s are for things you'd use `Rc<T>` in Rust
02:45:12FromDiscord<Elegantbeef> Either they're large data types you want to move around ownership instead of copying a lot of data, graphs, many to one views ....
03:02:38*xet7 quit (Remote host closed the connection)
03:09:18FromDiscord<spivee> Yes right, very good. But `var` arguments don't copy around, so I can pass them down a call stack without any performance penalty?
03:33:13*xet7 joined #nim
03:33:29FromDiscord<Elegantbeef> You do not need to use `var` to avoid copying
03:33:35FromDiscord<Elegantbeef> Nim does the right thing and optimises argument passing
03:41:26*lucasta quit (Remote host closed the connection)
03:45:32FromDiscord<spivee> Cool cool, I just mean in the cases where I need `var` for other reasons. But sounds like the answer is also yes!
03:47:43FromDiscord<Elegantbeef> `var T` is really `T` in C lands so yea no copying
04:10:32*xet7 quit (Remote host closed the connection)
04:32:37FromDiscord<jaar23> sent a long message, see https://pasty.ee/WPykitYOHbeV
04:33:25FromDiscord<Elegantbeef> make sure to update nimlangserver as it gets fixes for crashes as time goes on
04:35:54FromDiscord<jaar23> Yes, nimlang server got updated yesterday.
04:36:59FromDiscord<jaar23> But I think is caused having two nim file at the src root folder level, is that not allowed?
04:38:54FromDiscord<Elegantbeef> The project finder is pretty bad for nimsuggest
04:38:55FromDiscord<Elegantbeef> I don't know if the plugin still allows setting entry files
04:41:10FromDiscord<jaar23> Any idea how to set that? I can try
04:41:43FromDiscord<Elegantbeef> Oh wait helix, don't think you can set those outside vscode
04:42:39FromDiscord<Elegantbeef> https://github.com/nim-lang/langserver?tab=readme-ov-file#configuration-options but that does not help
04:47:55FromDiscord<jaar23> Ah right..vs code still the best to go with Nim now
04:48:22FromDiscord<jaar23> Else I change my code structure
04:48:40FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "I don't know if": On VSC yeah
05:01:12*pmp-p joined #nim
05:43:21*pmp-p quit (Ping timeout: 255 seconds)
05:44:03*xet7 joined #nim
05:49:58*pmp-p joined #nim
07:34:38*ntat joined #nim
08:43:39*junaid_ joined #nim
09:34:15*junaid_ quit (Remote host closed the connection)
09:59:33FromDiscord<norax.2> https://media.discordapp.net/attachments/371759389889003532/1223572312289185833/image.png?ex=661a5784&is=6607e284&hm=3809702cd42779882bad9ac8ab63a430a285e9d64ef135a2cad135c613d99859&
09:59:39FromDiscord<norax.2> after sometime of messing i got it to work
09:59:59FromDiscord<norax.2> now the 'console' offers 2 commands explain and run
10:00:01FromDiscord<norax.2> run just runs
10:00:05FromDiscord<norax.2> explain explains
10:00:11FromDiscord<norax.2> (lol)
10:00:49FromDiscord<norax.2> but i need to add the bar and the thing that checks/catch the output of the script
10:01:01FromDiscord<norax.2> (edit) "but i need to add the bar and the thing that checks/catch the output of the script ... " added "to actually see if the user maked it work"
10:06:12FromDiscord<jaar23> sent a long message, see https://pasty.ee/qnvMqxGFRbHV
10:08:32FromDiscord<jaar23> then, my next question would be. what is the correct way to import and export own module when importing my own module and exporting it. i'm building a lib
10:37:34FromDiscord<norax.2> https://media.discordapp.net/attachments/371759389889003532/1223581877475213343/image.png?ex=661a606c&is=6607eb6c&hm=328a693705cdc347f60281f6c346573a7b1d2141253eae97a25d982565e765e0&
10:37:38FromDiscord<norax.2> god what did i just do
10:37:58FromDiscord<norax.2> i mean...is good to see the code compiling but this is insane
10:38:06FromDiscord<norax.2> (edit) "i mean...is good to see the code ... compiling" added "its"
10:49:02FromDiscord<norax.2> https://media.discordapp.net/attachments/371759389889003532/1223584769825046599/image.png?ex=661a631e&is=6607ee1e&hm=38f90b7bffb6e7a3c6c7a62c17c2a0ae578a298b9001c8f014c1e45204acef6b&
10:49:04FromDiscord<norax.2> FINALYYY GG
10:49:29FromDiscord<norax.2> (yes = that the other script runs)
10:49:34FromDiscord<norax.2> (edit) "runs)" => "runs fine)"
10:49:39FromDiscord<norax.2> in this way i have a binary file
10:49:45FromDiscord<norax.2> that i can do tests on
11:53:55FromDiscord<aintea> sent a code paste, see https://play.nim-lang.org/#pasty=HeJNjUpizUxR
11:56:46FromDiscord<norax.2> In reply to @aintea "The compiler tells me": try to talk to him?
11:57:20FromDiscord<aintea> he blocked me everywhere
11:57:58FromDiscord<norax.2> In reply to @aintea "he blocked me everywhere": uhh
11:59:07FromDiscord<norax.2> you should never be angry whit compilers
11:59:12FromDiscord<norax.2> they are very emotional
12:05:15FromDiscord<tapeda> Will you lose any optimization by making it a proc? Maybe with a custom effect, if you want to enforce something about it
12:29:50FromDiscord<aintea> sent a code paste, see https://play.nim-lang.org/#pasty=hIzfbBbssaeH
12:55:54*lucasta joined #nim
12:58:27FromDiscord<demotomohiro> In reply to @aintea "The compiler tells me": How about to add noSideEffect pragma like this code?↵https://nim-lang.org/docs/sugar.html#-%3E.m%2Cuntyped%2Cuntyped
13:12:33FromDiscord<ebahi> hello, im writing a library for an api and was wondering how to handle error messages/exceptions? im currently using bools as a placeholder but is there a better way without just printing the error manually
13:13:59*ntat quit (Quit: Leaving)
13:31:09FromDiscord<norax.2> https://media.discordapp.net/attachments/371759389889003532/1223625565727363163/image.png?ex=661a891c&is=6608141c&hm=2b9886c727240f6213941971c3a0b213f95931423f44503eaab5fc02a735cd00&
13:31:11FromDiscord<norax.2> whe are at 100 lines
13:31:15FromDiscord<norax.2> i dint even start bruh
13:31:32FromDiscord<norax.2> this is gonna take alot
13:33:13FromDiscord<odexine> 100 lines is a good amount of lines for a single file
13:33:21FromDiscord<norax.2> https://github.com/Noraxx1/Nimling
13:33:23FromDiscord<norax.2> anyway
13:33:24FromDiscord<norax.2> i opened a git
13:33:48FromDiscord<norax.2> im still working on it
13:33:50FromDiscord<norax.2> but like ALOT
13:34:04FromDiscord<norax.2> since the exercise.nim should just contain all the exercises and definitions
13:34:16FromDiscord<norax.2> and also i need to add support for stuff like multiple problems
13:34:27FromDiscord<norax.2> but rn is in a kinda stable phase
14:10:31FromDiscord<norax.2> fun fact : i dont even know nim propely
14:23:17*junaid_ joined #nim
14:29:47FromDiscord<michaelb.eth> In reply to @norax.2 "fun fact : i": Nim is deep. Depending on how much time learning/coding with it daily/weekly, in addition to learning general systems programming concepts and C related stuff, you can probably hope to know it properly in about…↵↵3 years
14:30:59FromDiscord<norax.2> i dont use nim from like 2 months
14:31:06FromDiscord<norax.2> and used it for less than uhhh
14:31:08FromDiscord<norax.2> 4 days
14:31:36FromDiscord<norax.2> but yeah it works out
14:51:39FromDiscord<tapeda> In reply to @norax.2 "fun fact : i": Good way to learn is to try and teach it, like a pedagogical form of rubberducking :)
14:54:48FromDiscord<glomdom.> In reply to @norax.2 "": wWAHT SI THAT ICON THEME ITS SO HOT
14:54:54FromDiscord<glomdom.> plsplspslpls tell memeemem
14:55:01FromDiscord<norax.2> Lol
14:55:05FromDiscord<norax.2> i actually forgot
14:55:09FromDiscord<norax.2> eait a second
14:55:44FromDiscord<norax.2> cat-puccin frappe
14:55:49FromDiscord<norax.2> @glomdom.
14:56:07FromDiscord<glomdom.> :hot: tenk u so mach
15:05:25FromDiscord<sOkam! 🫐> In reply to @michaelb.eth "Nim is deep. Depending": sounds like you thought this statement might be motivating. but I have worked as a coach professionally for many years, and experience has proved me wrong in this type of statement being useful at all. it usually causes the opposite effect, because the "its so much work" idea seed gets planted into the person's brain, and what grows out of it is nothing useful 🤷‍♂️
15:08:32NimEventerNew thread by Nlits: How to determine the dependencies of a given nim file., see https://forum.nim-lang.org/t/11326
15:13:19FromDiscord<odexine> id say i took my time learning nim and i learned it well enough for my uses by 1 year or so
15:18:00*lucasta quit (Quit: Leaving)
15:34:51*fallback quit (Ping timeout: 268 seconds)
15:46:53*fallback joined #nim
15:52:20FromDiscord<norax.2> woah
15:52:20FromDiscord<norax.2> https://media.discordapp.net/attachments/371759389889003532/1223661094048890920/image.png?ex=661aaa33&is=66083533&hm=5e5090b3ae403186ac0e193d3dc222ef6b7ef679eb430a4d98b7c2a8dcc3314f&
15:52:34FromDiscord<norax.2> i dint think that making stuff in terminal on nim was so easy
16:31:48FromDiscord<sOkam! 🫐> In reply to @norax.2 "i dint think that": Nim in general is very easy/intuitive. it is one of its key features
16:32:54FromDiscord<sOkam! 🫐> its really hard to make unreadable code due to how the syntax works. you have to try really hard, while in other langs whats hard is making it easy/intuitive. which is a big deal for coding comfortably and fast
16:33:13FromDiscord<sOkam! 🫐> (edit) "hard, while" => "hard to make it bad↵while"
16:56:48*mal`` quit (Quit: Leaving)
17:15:43*mal`` joined #nim
17:39:07*KhazAkar quit (Ping timeout: 256 seconds)
17:51:42FromDiscord<firasuke> Are there default return values for functions? Upon testing, a function that returns a `bool` returns `false` when run without an explicit return statement.
17:53:57FromDiscord<Robyn [She/Her]> In reply to @firasuke "Are there default return": Yeah there are
18:03:47FromDiscord<firasuke> Cool
18:16:44FromDiscord<bosinski2023> In reply to @firasuke "Cool": your return value is in `result` which nim creates for your func/proc. Its writable for sure..
18:17:21FromDiscord<firasuke> In reply to @bosinski2023 "your return value is": yeah and `result` is implicitly returned if not specified, and in the case of a function that returns a `bool`, it is `false` by default
18:17:25FromDiscord<firasuke> correct?
18:17:57FromDiscord<bosinski2023> In reply to @firasuke "correct?": correct, result is always innitialized..
18:21:40FromDiscord<solitudesf> In reply to @firasuke "yeah and `result` is": its always 0'ed out result. in case of seq's and strings it is initialized. for ref types its not.
18:47:08FromDiscord<Phil> Basically it has to be initialized, it's just a variable same as `var x: bool` will always contain the value false or `var x: ref bool` always contain nil without assignment.↵↵It's just value types
18:47:57FromDiscord<Phil> (edit) "Basically it has to be initialized, it's just a variable same as `var x: bool` will always contain the value false or `var x: ref bool` always contain nil without assignment.↵↵It's just value types ... " added "being default initialized (or ref types getting nil since nothing is allocated)"
18:48:08FromDiscord<Phil> (edit) "allocated)" => "allocated by just writing a variable)"
18:56:35FromDiscord<morgan> In reply to @morganalyssa "ok so my code": https://discord.com/channels/371759389889003530/371759389889003532/1222707122664505466 so i think im having issues with the std lib lock, but im not familiar with it. im not creating threads with anything nim provides, but its a library with threads being spawned by another process, idk if that would affect it. im considering making my own mutex to see if that's the issue but maybe it would be e
18:57:51FromDiscord<norax.2> opinion on this bar look? https://media.discordapp.net/attachments/371759389889003532/1223707782063067306/image.png?ex=661ad5ae&is=660860ae&hm=b075d6a4e6ea7242f624870f3670ef6a91442ced08e19d6532a1f1934a9b9555&
18:58:11FromDiscord<Elegantbeef> Morgan you do not copy the lock anywhere do you?
19:01:04FromDiscord<morgan> i dont think so
19:01:22FromDiscord<morgan> commenting that out doesnt seem to make it work any differently
19:01:42FromDiscord<morgan> i can open up lldb and see if its actually going thru that code
19:02:23FromDiscord<morgan> i figured out previously that the data looked correct and that it should go into the case of correctly, but i could have it always set the value for one of the three sliders
19:02:36FromDiscord<morgan> and take that case of out of the question
19:02:38FromDiscord<firasuke> In reply to @solitudesf "its always 0'ed out": Oh ok
19:02:42FromDiscord<firasuke> In reply to @isofruit "Basically it has to": Ok thanks
19:06:15FromDiscord<.bobbbob> tbh the zero initialized variables always gives me the heebie jeebies even if it is better than what c does, I like the strictDefs flag
19:06:16FromDiscord<solitudesf> In reply to @isofruit "Basically it has to": `default initialized` is misleading, since we have default field values now and they dont apply here.
19:06:33FromDiscord<morgan> ok i think its something else, idk why that wasnt looking like it was working with lldb earlier
19:06:59FromDiscord<morgan> bcos it doesn't do anything with it always modifying one of them
19:07:05FromDiscord<Elegantbeef> Strict defs is a tinge annoying but it just moves it from `var a: T` to `var a = T()`
19:07:48FromDiscord<.bobbbob> In reply to @Elegantbeef "Strict defs is a": I dont use var in the first place 😉
19:07:52FromDiscord<Phil> In reply to @solitudesf "`default initialized` is misleading,": eh fair, I'll take the L
19:08:17FromDiscord<Elegantbeef> Sorry that your code is so slow↵(@.bobbbob)
19:12:28FromDiscord<Elegantbeef> Dear read `let` is not slower, but it means you're not reusing memory and remaking the world
19:12:32FromDiscord<Elegantbeef> dear reader\
19:21:39FromDiscord<firasuke> This language is just something else, it should be illegal to write in Nim...
19:34:29FromDiscord<ElegantBeef> Why is it that bad?!
19:34:34FromDiscord<ElegantBeef> Bridge why doth though forsake me
19:36:14FromDiscord<solitudesf> In reply to @elegantbeef "Bridge why doth though": so you dont act so smug, while hiding behind relay
19:36:53FromDiscord<ElegantBeef> I'm hiding like Osama in Pakistan
19:37:54FromDiscord<solitudesf> bout to crash an aircraft into your fence
19:38:04FromDiscord<ElegantBeef> My fence?
20:44:58FromDiscord<norax.2> https://media.discordapp.net/attachments/371759389889003532/1223734739446530068/image.png?ex=661aeec9&is=660879c9&hm=97695b3cf5c6d59e4ffe8124a2957edb5e85b82923b6b7a005bc6efbcd8d2210&
20:45:07FromDiscord<norax.2> its almost done!
20:45:53FromDiscord<norax.2> i should just add a thing to print the expected output
20:46:10FromDiscord<Elegantbeef> Also spellcheck
20:46:27FromDiscord<norax.2> theres chatgpt for that
20:46:31FromDiscord<norax.2> XD
20:46:41FromDiscord<norax.2> and mostly
20:46:45anddamcan someone explain what is the effect on tmpli of this parseExpr, compared to tmpl? https://github.com/onionhammer/nim-templates/blob/master/templates.nim#L327
20:46:45FromDiscord<norax.2> colors
20:47:13FromDiscord<norax.2> they are gone for some reason but i bet is an easy fix
20:47:21FromDiscord<norax.2> prb just need to run the command in another way
20:48:01anddamnorax.2: was that for me?
20:48:22FromDiscord<norax.2> oh no
20:48:36anddamah good, I'll stop trying to make sense of it
20:49:07FromDiscord<norax.2> do i seem that smart to resolve these kind of issues?
20:51:04anddamwell, from this side of the internet anyone around here seems smarter than me
20:51:33FromDiscord<norax.2> lol
20:51:38FromDiscord<norax.2> anyway
20:51:42FromDiscord<norax.2> returning to my project
20:52:02FromDiscord<norax.2> im also trying to sort of 'temporanely' import so it doesnt compile the explain.nim file
20:52:18FromDiscord<norax.2> but instead calls the explai function in the helper.nim file
20:52:27FromDiscord<norax.2> and then 'discards' the import+
20:52:44FromDiscord<norax.2> (edit) "import+" => "import << less storage,and more memory"
20:54:10FromDiscord<norax.2> (edit) "and then 'discards' the import << less storage,and more ... memory" added "frees up"
20:54:21FromDiscord<Robyn [She/Her]> In reply to @anddam "can someone explain what": I... Honestly can't figure it out? It doesn't seem obvious
20:54:25FromDiscord<norax.2> (edit) "and then 'discards' the import << less storage,and more frees up memory ... " added "not considering the insane speed up"
20:55:20FromDiscord<Robyn [She/Her]> Could be a remnant of older Nim code where strings used to be nullable? Not that I was around back then
20:55:28anddamI see it's getting a list result = newStmtList() then it's, replacing it with null string?
20:59:00anddamhttps://www.eoleary.me/blog/create-a-webapp#nim-templates suggests tmpl is splitting the html elements and adding when using tmpl macro
20:59:28anddamso tmpli seems to have just the initial additional add, but the if it was just a spacer I'd expect it to be result.add ""
21:00:11anddamit's the parseExec I do not get, it's not possibly there to initialize the list back since it's just been created anyway
21:01:29FromDiscord<Elegantbeef> It clears out result before the code runs
21:02:42FromDiscord<solitudesf> its just a relic of old nilable strings
21:45:49*junaid_ quit (Remote host closed the connection)
22:47:42FromDiscord<Robyn [She/Her]> I love Nim as a language
22:47:50FromDiscord<Robyn [She/Her]> Can't imagine using another lang like this
22:58:30anddamI am trying to get the hang of it
22:58:50anddamshould have probably read something about the language before trying, TBH
23:00:01FromDiscord<Robyn [She/Her]> Probably lol, but it's fine, I jumped into Nim expecting something like Python, just compiled
23:00:06FromDiscord<Robyn [She/Her]> But this is so, so much better
23:01:14anddamI am allured but am still not very fluid, it is not helping that the jester example I find are years old, nim-templates itself has last commit 5 years ago
23:01:52anddamOTOH fixing a thread safety error at compile time on my own felt great
23:02:45anddambecause the old code was apparently accessing globals from different thread and this does not fly with current compiler (again issue with very old examples)
23:08:18FromDiscord<Robyn [She/Her]> That's fair, but hey, you're doing great!
23:09:29anddamwow this is a supporting channel
23:11:42Amun-Rayes, we're the finest bunch
23:11:51Amun-Ra;)
23:15:55anddamhttps://nimble.directory/pkg/db mentions db_sqlite module, but how do I install the latter?
23:16:19anddamI installed `db` but I am getting \crud_web.nim(8, 8) Error: cannot open file: db_sqlite
23:18:16FromDiscord<Robyn [She/Her]> In reply to @anddam "wow this is a": I try to be positive heh
23:18:45FromDiscord<Robyn [She/Her]> In reply to @anddam "I installed `db` but": It's been moved to the `db_connector` nimble package since Nim 2.0 ^^