<< 04-02-2023 >>

00:05:31*ltriant joined #nim
00:10:08*ltriant quit (Ping timeout: 248 seconds)
00:10:16*derpydoo joined #nim
00:21:21*derpydoo quit (Remote host closed the connection)
00:21:35FromDiscord<Saint> Whats a way to do integration tests in nim?
00:22:16FromDiscord<Saint> Say I have a program that saves a record into a sqlite db and adds to a search index, and I want to test the integration of all of this. Is there a way to do this setup?
00:22:42FromDiscord<Saint> I feel like I have to handroll this myself
00:33:48FromDiscord<Phil> In reply to @Saint "Whats a way to": Welcome to my rabbit hole, I've been here for around a month now
00:33:57FromDiscord<Saint> In reply to @Isofruit "Welcome to my rabbit": Oh wow hah
00:34:02FromDiscord<Saint> Any leads?
00:34:29FromDiscord<Phil> You want to set up your tests to run in a github pipeline or only locally?
00:34:58FromDiscord<Phil> Either way, for sqlite I'd recommend setting up a nimble command that generates a test-db for you.↵It's what nimforum does
00:35:08FromDiscord<Phil> And then use that for testing
00:36:29FromDiscord<Saint> That makes sense, for my search engine I figured running a new docker instance
00:36:40FromDiscord<Saint> What exactly is nimble and why would I use this for testing
00:36:48FromDiscord<Saint> I just know it's sort of a package manager amongst other things
00:36:52FromDiscord<Phil> If you need to integration test a web-application, then compiling a binary, running it and poking it with std/httpclient will need to be part of the test-setup
00:37:25FromDiscord<Saint> In reply to @Isofruit "If you need to": That makes sense
00:37:34FromDiscord<Phil> In reply to @Saint "What exactly is nimble": Nimble is the nim package manager and also provides general tooling for creating build-tasks
00:37:57FromDiscord<Phil> You know how when you start a nim project (`nimble init`) you have a <projectname>.nimble file?
00:38:58FromDiscord<Phil> You can write nimble tasks in it that e.g. compile your program.↵Then other nimble tasks that effectively replace bash-scripts and do further setup-stuff, in your case they would create a sqlite3 file at a specified path and run SQL statements over it to create the necessary tables
00:40:12FromDiscord<Saint> And I can run it in a nim program itself?
00:40:20FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4n2o
00:40:31FromDiscord<Phil> that I can then execute with `nimble rebuildFTS5Table`
00:40:43FromDiscord<Saint> gotcha
00:41:12FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4n2p
00:42:23FromDiscord<Phil> And further nimble tasks that generate a docker image from the generated binary, tasks that allow me to alias localhost as "aldrune.com" (my webpages domain), a nimble task to generate a docker-image of my reverse proxy and another task to deploy both of them locally
00:42:24FromDiscord<Saint> Is there some setup framework for like a test init and then teardown
00:42:45FromDiscord<Phil> You mean for std/unittest?
00:42:57FromDiscord<Saint> I guess this is more for integration tests
00:43:23FromDiscord<Phil> You can still use std/unittest for it, though you can also directly go and try to fiddle with testament
00:43:26FromDiscord<Saint> Like I would create my test sqlite db and start an image for my search indexer then run my tests and then teardown
00:43:29FromDiscord<Phil> Personally std/unittest has been enough so far
00:43:38FromDiscord<Saint> Right, yeah testament doesnt seem like it has any docs as such
00:43:41FromDiscord<Saint> Confusing for me
00:44:03FromDiscord<Saint> For std/unittest is there a setup and teardown type section when running
00:45:23FromDiscord<Phil> You'd need to roll that yourself. Isn't really that much of an effort though. There's a nim 1.6.10 image based on ubuntu, you just need to install sqlite libs on it with apt, copy your project into it and run your nimble command to execute the tests, which will generally be nimble tests↵(That executes any file under the test directory with a `t`-prefix
00:45:25FromDiscord<Phil> (edit) "`t`-prefix" => "`t`-prefix)"
00:46:40*ltriant joined #nim
00:47:55FromDiscord<Saint> Oh interesting
00:48:10FromDiscord<Saint> I wasn't even thinking of that, I was just thinking of assuming the machine you're running tests on has docker installed
00:48:15FromDiscord<Saint> Rather than creating a whole docker image for testing
00:48:20FromDiscord<Saint> What do you think would be the way to go about it?
00:48:23FromDiscord<Saint> Your idea is interesting
00:48:41FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4n2q
00:49:16FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4n2q" => "https://play.nim-lang.org/#ix=4n2s"
00:50:18FromDiscord<Phil> In reply to @Saint "I wasn't even thinking": I've gotten into the habit of just always running tests in a docker-container solely so I can move that stuff into a github pipeline
00:51:42*ltriant quit (Ping timeout: 268 seconds)
00:52:41FromDiscord<Phil> sent a long message, see http://ix.io/4n2u
00:53:01FromDiscord<Phil> https://nim-lang.org/docs/unittest.html#examples↵Has a little example for that
00:54:40FromDiscord<Phil> If you want to integration test using a client, I recommend using std/httpclient.↵Note: Use the sync client, for your own sanity.↵↵If you want to test the GUI itself you can also use webdriver. Nimforum uses that fairly extensively and it also works with nim 2.0
00:58:59FromDiscord<Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4n2y
00:59:15FromDiscord<Nilts> (edit) "https://play.nim-lang.org/#ix=4n2y" => "https://play.nim-lang.org/#ix=4n2z"
01:00:51FromDiscord<Phil> is data something "simple" that you could provide?
01:01:21FromDiscord<Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4n2B
01:02:01FromDiscord<Phil> data is a string, this is just a float, do you throw `"4.0"` for the value data into that getMultiFileInfo proc?
01:03:32FromDiscord<Nilts> In reply to @Isofruit "data is a string,": what is a float?
01:03:33FromDiscord<Phil> You could also do an assert `assert c != nil, "c must not be nil"`
01:03:48FromDiscord<Nilts> also, data is not nil
01:03:52FromDiscord<Phil> In reply to @not logged in "what is a float?": Float are non-integer numbers, like `3.2`
01:04:20FromDiscord<Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4n2D
01:05:54FromDiscord<Phil> That doesn't suffice as your code snippet above does not define the data type "MultiFileInfo"
01:05:55FromDiscord<Nilts> (edit) "https://play.nim-lang.org/#ix=4n2D" => "https://play.nim-lang.org/#ix=4n2E"
01:06:08*dropkick left #nim (Leaving)
01:06:31FromDiscord<Nilts> In reply to @Isofruit "That doesn't suffice as": https://play.nim-lang.org/#ix=4n2F
01:06:59FromDiscord<Phil> Oh that attempted proc definition above is something you literally take as a string, ohhhhhh
01:07:10FromDiscord<Phil> Is that string required to be valid nim code, as the above is not
01:07:37FromDiscord<Phil> (edit) "code, as" => "code? As"
01:07:39FromDiscord<Nilts> In reply to @Isofruit "Is that string required": no, it code of a different language
01:08:15FromDiscord<Phil> Are you compiling on windows?
01:08:21FromDiscord<Nilts> In reply to @Isofruit "Are you compiling on": no
01:08:43FromDiscord<Phil> Nix or Mac?
01:09:12FromDiscord<Nilts> In reply to @Isofruit "Nix or Mac?": nix env on ubuntu i think
01:09:48FromDiscord<Phil> Mostly asking because I just ran that code and it compiled and executed:↵`(line: 1, cola: 1, colb: 16, snippet: "proc addAndDivid")`
01:10:09FromDiscord<Phil> As result of the echo in line 29
01:10:09FromDiscord<Nilts> I just relized that the segfault is somewhere else, and i read the trace wrong 🤦‍♂️
01:10:46FromDiscord<Phil> I haven't yet had a segfault that wasn't some nil-pointer-access in some mysterious place, chances are I just haven't had enough experience yet to find those other ones
01:11:22FromDiscord<Phil> Made me become a really big fan of assert x != nil when necessary
01:12:58FromDiscord<Nilts> In reply to @Isofruit "Made me become a": hmm, how can you `==` with nil on any obj?
01:13:34FromDiscord<Saint> In reply to @Isofruit "Yes there is. If": Thanks a lot for the info!
01:14:55FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4n2G
01:15:11FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4n2G" => "https://play.nim-lang.org/#ix=4n2H"
01:15:22FromDiscord<Phil> I may not be understanding the question correctly
01:15:53FromDiscord<jtv> Just use Option types everywhere, very verbose but will avoid the pain of a guaranteed runtime crash
01:16:59FromDiscord<Phil> In reply to @jtv "Just use Option types": Oh I 100% agree. The reason I'm stuck with nil sometimes is C-code when you need to get pointers to procs from openssl and those can be il
01:17:02FromDiscord<Phil> (edit) "il" => "nil"
01:17:36FromDiscord<jtv> Yeah stupid OpenSSL!
01:17:55FromDiscord<Phil> I'm preeeetty sure I'd have the same issue with any C lib that I nabbed procs from 😛
01:18:08FromDiscord<Phil> (edit) "I nabbed" => "I'd nab"
01:19:07FromDiscord<Phil> In reply to @Saint "Thanks a lot for": Happy to help.↵I went down that journey when testing my own packages and particularly in search for not just integration-test solutions, but also unit-test ones
01:19:13FromDiscord<Phil> Turns out unit-test solutions are pretty hard to come by
01:25:49FromDiscord<Saint> Right
01:47:25FromDiscord<Saint> So @Phil does this make sense, I make this docker compose setup for testing which will run my tests with a fresh sqlite db and my search indexer? How do I report which tests fail
01:47:32FromDiscord<Yepoleb> @Phil how can you work with openssl and not be sad
01:56:46FromDiscord<Nilts> In karax do you use html entities or just the Unicode chars
02:16:55*azimut joined #nim
03:09:41*arkurious quit (Quit: Leaving)
04:14:54*ltriant joined #nim
05:22:00*ensyde joined #nim
05:35:04*ensyde quit (Quit: WeeChat 3.8)
05:55:47*tiorock joined #nim
05:55:47*tiorock quit (Changing host)
05:55:47*tiorock joined #nim
05:55:47*rockcavera is now known as Guest8932
05:55:47*tiorock is now known as rockcavera
05:58:55*Guest8932 quit (Ping timeout: 248 seconds)
06:41:58*ltriant quit (Ping timeout: 268 seconds)
07:12:26FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4n3X
07:17:52FromDiscord<Elegantbeef> What is `Space` and `ColObj`'s definition?
07:20:12FromDiscord<sOkam!> https://media.discordapp.net/attachments/371759389889003532/1071329311375773727/types.nim
07:20:42FromDiscord<Elegantbeef> What's `Bounds` typedef?
07:21:47FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4n3Z
07:22:06FromDiscord<sOkam!> gvec3 is from vmath
07:22:51FromDiscord<Elegantbeef> None of your types use `Bounds` incorrectly?
07:23:06FromDiscord<Elegantbeef> Cause the issue is likely the bounds isnt right
07:24:15FromDiscord<sOkam!> oh shoot, there is one place where bounds is not [T]
07:25:07FromDiscord<Elegantbeef> Are you on devel or stable?
07:25:50FromDiscord<sOkam!> 1.6.10
07:26:24FromDiscord<Elegantbeef> Ah devel might make the error less tedious do not recall what deech changed
07:35:08FromDiscord<sOkam!> seems like spatialobj was using Bounds without specifying a type, and that was confusing the compiler. just added the type there and it moved on
08:19:00FromDiscord<Phil> In reply to @Yepoleb "<@180601887916163073> how can you": Very limited usages and more questionmarks above my head than actual lightbulbs that would let me understand how awful it is
08:21:30*derpydoo joined #nim
08:42:47*azimut_ joined #nim
08:42:50*azimut quit (Remote host closed the connection)
09:01:29FromDiscord<Phil> Personally I find their docs far more egregious than anything else so far.↵Like, guys, a list of procs that return EVP_MD would've been nice
09:09:36FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4n4o
09:16:50FromDiscord<Coachonko> I come from C and JS, I struggle with Nim's syntax. Help
09:17:55FromDiscord<Phil> I have said the word "Help" now. You have been helped 😛
09:18:24FromDiscord<Elegantbeef> Did someone say "help?
09:20:24FromDiscord<sOkam!> In reply to @Coachonko "I come from C": do you also struggle with python? or unrelated?
09:21:54FromDiscord<Phil> In reply to @Coachonko "I come from C": Generics are a lie. There are no generics, its all just instructions for the compiler to copy paste your code, in the end everything always has a specific type
09:22:53FromDiscord<Elegantbeef> Phil explaining generics like 90% of languages do not do monomorphic generics is funny
09:23:19FromDiscord<Phil> I don't know a ton of other languages, only like Python, JS/TS, Java, Groovy and Nim
09:23:26FromDiscord<Phil> So I can't really compare
09:23:45FromDiscord<Elegantbeef> Doesnt java do monomorphism?
09:23:56FromDiscord<Phil> No idea
09:24:06FromDiscord<Phil> I could see them not doing it just because
09:24:23FromDiscord<Elegantbeef> Anyway a vast majority of languages do monomorphism, Swft and Go are the two most notable exceptions
09:24:30FromDiscord<Elegantbeef> Swift does do it in some cases but does allow not in other
09:25:49FromDiscord<Coachonko> In reply to @sOkam! "do you also struggle": I actually only used python twice before and I barely did anything with it, just changed some values
09:26:06FromDiscord<Phil> I think I'm just fundamentally missing experience in the programming area where DSLs like the one searched for in appdev are useful
09:26:14FromDiscord<Coachonko> So if Python is similar I guess I would struggle with it too
09:26:22FromDiscord<Phil> (Aimed at beef, I'm rather writing here in order to not disrupt the chatflow there)
09:26:26FromDiscord<Elegantbeef> What are you struggling with
09:26:27FromDiscord<sOkam!> its very similar, just no strict types
09:26:46FromDiscord<Elegantbeef> Yea phil i dont know about what they're after
09:26:55FromDiscord<Coachonko> In reply to @Elegantbeef "What are you struggling": Where are my curle braces? 😭
09:27:01FromDiscord<Elegantbeef> They gave an arbitrary DSL instead of explaining what they're after
09:27:15FromDiscord<Elegantbeef> As i tell everyone enable rainbow indents(if your editor supports it) and indention lines
09:27:17FromDiscord<Phil> In reply to @sOkam! "its very similar, just": Given that dynamic typing is a pretty big deal and enables stuff like mixins I'd say that leads to some fundamental differences
09:27:20FromDiscord<Elegantbeef> You now have curly brackets
09:27:34FromDiscord<Phil> In reply to @Coachonko "Where are my curle": I ate them
09:27:46FromDiscord<Elegantbeef> Rainbow indents and indentions are indistinguishable to curly brackets imo
09:27:47FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4n4w
09:27:55FromDiscord<Elegantbeef> and indentions lines\
09:28:09FromDiscord<sOkam!> (edit) "https://play.nim-lang.org/#ix=4n4w" => "https://play.nim-lang.org/#ix=4n4x"
09:28:17FromDiscord<Elegantbeef> Your curly braces have been moved to more important things like a table constructor, or a set
09:28:42FromDiscord<Elegantbeef> I still wish Kate had rainbow indents, too bad plugins presently require C++
09:28:48FromDiscord<Elegantbeef> Fuck writing C++ for that
09:28:55FromDiscord<Phil> As a visual example https://media.discordapp.net/attachments/371759389889003532/1071361704006524979/image.png
09:29:12FromDiscord<sOkam!> In reply to @Isofruit "Given that dynamic typing": obvious. but for starting out in the lang, they feel almost the same, just with the difference that you cannot shoot youself by accident with nim as much
09:29:15FromDiscord<Coachonko> Damn I need those
09:29:18FromDiscord<Elegantbeef> Not contrasty enough phil
09:29:30FromDiscord<Phil> Beef, I am older than you, how are your eyes that bad?
09:29:36FromDiscord<Elegantbeef> You also can render white space
09:29:40FromDiscord<Elegantbeef> You're older than me?
09:29:55FromDiscord<Phil> IIRC you were somewhere in the lower 20's
09:30:04FromDiscord<Elegantbeef> To be fair phil my matrix client is on a portrait monitor that's not an ips so it's awful
09:30:23FromDiscord<Elegantbeef> I'm also mildly red green colour blind
09:30:24FromDiscord<Elegantbeef> So fuck you you ableist!
09:30:27FromDiscord<Coachonko> You know you're cool when you have a monitor in portrait mode
09:30:47FromDiscord<Phil> In reply to @Elegantbeef "So fuck you you": Damnit, exposed again!
09:31:30FromDiscord<Phil> In reply to @Coachonko "You know you're cool": Anyway, depending on the IDE you use I'm sure there's plugins
09:32:01FromDiscord<Phil> For VSCode and IntelliJ I could even help find them, VSCode has indent-rainbow, no idea about intellij, I'd need to start looking
09:32:02FromDiscord<Coachonko> sent a code paste, see https://play.nim-lang.org/#ix=4n4A
09:32:35FromDiscord<sOkam!> In reply to @Coachonko "Who the hell writes": 50-60% of C I've found is the first. i hate it, but its like almost the biggest trend
09:32:44FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4n4C
09:33:17FromDiscord<Coachonko> sent a code paste, see https://play.nim-lang.org/#ix=4n4D
09:33:27FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4n4E
09:33:28FromDiscord<Phil> See, this is why indent with meaning is better
09:33:34FromDiscord<Phil> People can't be monster
09:33:36FromDiscord<Phil> (edit) "monster" => "monsters"
09:33:43FromDiscord<Phil> The compiler forces them all into compliance
09:33:51FromDiscord<Coachonko> Is there something like Prettier for Nim?
09:33:58FromDiscord<Phil> Sadly no
09:34:14FromDiscord<Phil> There's nimpretty, but for the most part it messes with your spacing and newlines, it doesn't "properly" format things
09:34:22FromDiscord<Coachonko> Can we have a contest for who writes the shittiest looking Nim code?
09:34:52FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4n4F
09:34:55FromDiscord<Elegantbeef> Anyway thanks for the annual shit posting on "Why nim have curlies" hope we have encouraged using editor features to work around it
09:35:00FromDiscord<sOkam!> sadly that's more true than joke 😔
09:35:36FromDiscord<Elegantbeef> You're doing it wrong
09:35:36FromDiscord<Coachonko> In reply to @Elegantbeef "Anyway thanks for the": It's fine, I am ok with being made fun of for not understanding significant indentation
09:35:53FromDiscord<Phil> As in, how to use it?
09:35:58FromDiscord<Phil> Or rather why it exists in the first place?
09:36:06FromDiscord<Elegantbeef> The tick on the curly point to where the code is
09:36:10FromDiscord<Elegantbeef> It's very intuitive
09:36:10FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4n4G
09:36:19FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4n4H
09:36:19FromDiscord<Coachonko> lmao
09:36:23FromDiscord<Coachonko> That's a good point
09:36:31FromDiscord<sOkam!> In reply to @Coachonko "Can we have a": oh god, you went to the wrong place to ask for that. Nim crowd is super conscious about good looking code↵we are spoiled by the lang, really, so bad looking screams at us like pain
09:37:11FromDiscord<Phil> I would like to point out that "good looking code" is very person dependent.↵I find my code beautiful.↵Beef has run away screaming looking at it multiple times
09:37:21FromDiscord<sOkam!> true that
09:37:27FromDiscord<Elegantbeef> Nim Pretty exists but it generally isnt great
09:37:28FromDiscord<Elegantbeef> Phil you say significant white space makes me not a monster but i can write horrid code even with it
09:37:32FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4n4I
09:37:49FromDiscord<Phil> Why beef, why would you use brackets there
09:37:51FromDiscord<Phil> Why would you do this
09:38:01FromDiscord<Coachonko> sent a code paste, see https://paste.rs/BuU
09:38:05FromDiscord<Coachonko> I still have nightmares
09:38:08FromDiscord<Phil> (edit) "brackets" => "braces"
09:38:50FromDiscord<sOkam!> oh shoot, that's even worse
09:38:58FromDiscord<Rika> In reply to @sOkam! "oh god, you went": ~~you have no right to say that you leading space before colon monster~~
09:39:00FromDiscord<Elegantbeef> Well you lot do odd things like write the type on the variable everywhere
09:39:03FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4n4J
09:39:42FromDiscord<Elegantbeef> Someone also aliases all types to like `u8` 😛
09:39:55FromDiscord<Elegantbeef> `type s = string` `type se[T] = seq[T]`?
09:39:56FromDiscord<sOkam!> #notme 🙈
09:40:25FromDiscord<Coachonko> Oh yeah something that confuses me about nim is that you can list proc parameters outside (). I still get very confused
09:40:28FromDiscord<sOkam!> zig type names are life, so tiny and so clear
09:40:33FromDiscord<Rika> In reply to @Elegantbeef "`type s = string`": No it has to be se[t] = set[t]
09:40:40FromDiscord<Elegantbeef> Who cares you never need to annotate types
09:41:28FromDiscord<Phil> In reply to @Coachonko "Oh yeah something that": That's actually neat.↵It crept into my coding style, I basically never write `echo` with braces anymore
09:41:29FromDiscord<Elegantbeef> Like the amount of times i type numeric types is like -10
09:42:02FromDiscord<Phil> I dislike it when people "disguise" proc calls with it, like `x.doStuff` where doStuff is a proc and looks like it's an attribute of x
09:42:09FromDiscord<Phil> But I haven't seen that done a lot luckily
09:42:09FromDiscord<sOkam!> i find it easier to find a silly error in syntax when the type is right in your face, instead of having to infer it from some variables that don't show their type and you have to remember it instead. 🐠 memory issues 🤷‍♂️
09:42:25FromDiscord<Rika> In reply to @Isofruit "I dislike it when": Sounds like I should hide
09:42:53FromDiscord<Rika> In reply to @sOkam! "i find it easier": Syntax error because of a wrong type?
09:43:00FromDiscord<Rika> How?
09:43:01FromDiscord<sOkam!> In reply to @Isofruit "I dislike it when": oh you would dislike my projects a lot then
09:43:11FromDiscord<Phil> You monster! At least have the decency to make your proc call to single-param-procs obvious with () at the end!
09:43:14FromDiscord<Elegantbeef> I can sorta understand using `u8` and friends if you didnt know `10u8` was valid, but still cmon 😄
09:43:15FromDiscord<Elegantbeef> Something that indicates work is being done
09:43:15FromDiscord<Elegantbeef> Phil that's just bad naming
09:43:17FromDiscord<Elegantbeef> Properties are fine if they're low cost
09:43:21FromDiscord<Elegantbeef> If they're highcost they should be named `getX` or similar
09:43:21FromDiscord<Elegantbeef> C# also has a similar issue from chucklefucks doing complex things like httprequests inside a property
09:43:31FromDiscord<sOkam!> In reply to @Rika "Syntax error because of": don't ask. i make stupid syntax errors all the time, even related to things i know how they work 🤷‍♂️
09:43:50FromDiscord<Elegantbeef> Bleh phil i omit `()` a shit ton
09:43:52FromDiscord<Coachonko> In reply to @Isofruit "I dislike it when": Nim gives too much freedom in the way things are written. Compiler should delete source if people do that
09:43:59FromDiscord<ElegantBeef> Matrix is really deaded today
09:44:13FromDiscord<ElegantBeef> Nah Nim gives the perfect amount of freedom
09:44:39FromDiscord<sOkam!> In reply to @Coachonko "Nim gives too much": man you would fit the Zig crowd just perfectly
09:44:51FromDiscord<ElegantBeef> If you dont act like a fuckwit and name something like `.myField` when it does 8000 things Nim's feature set on procedure calls is fine
09:45:04FromDiscord<sOkam!> the styler is so nazi about everything. there are not even any configuration options at all, by design ⚰️
09:45:08FromDiscord<ElegantBeef> Expensive properties are not properties
09:45:16FromDiscord<ElegantBeef> Yea like unused variables is a CTE
09:45:21FromDiscord<ElegantBeef> Cause fuck debugging
09:45:21FromDiscord<sOkam!> (edit) "the ... styler" added "default"
09:45:45FromDiscord<sOkam!> (edit) "the ... defaultformatter" added "zig" | "styler" => "formatter"
09:46:12FromDiscord<Coachonko> In JS people are just forced to use Prettier, I don't see the point of allowing styling freedom when those tools are forced on people anhyway
09:46:24FromDiscord<ElegantBeef> Well there is no styling tool for nim so checkmate
09:46:28FromDiscord<ElegantBeef> You're the styling tool
09:46:28FromDiscord<sOkam!> actually, coachonko, thinking about it, you might like zig quite a lot 🤔
09:46:30FromDiscord<Coachonko> Nim should just learn and force everybody to use the same hive mind too
09:46:37FromDiscord<ElegantBeef> It really hsouldnt
09:46:39FromDiscord<ElegantBeef> shouldnt
09:46:57FromDiscord<ElegantBeef> A wonderful part of Nim is it's macros and flexbillity of the syntax combined
09:47:02FromDiscord<Phil> In reply to @ElegantBeef "Nah Nim gives the": Nim is basically almost 100% freedom.↵Thanks to macros you can write your own language in the language as long as its statically typed and uses meaningful indentation
09:47:15FromDiscord<Coachonko> In reply to @sOkam! "actually, coachonko, thinking about": I like zig but too low level and can't do anything with it tbh
09:47:21FromDiscord<ElegantBeef> In reply to @Isofruit "Nim is basically almost": You do not need to make it statically typed
09:47:23FromDiscord<Coachonko> They don't have a working web framework yet
09:47:48FromDiscord<sOkam!> In reply to @Coachonko "I like zig but": they sure target the expert crowd, thats for sure
09:48:00FromDiscord<sOkam!> (edit) "thats for sure" => "definitely"
09:48:01FromDiscord<ElegantBeef> sent a code paste, see https://paste.rs/W5K
09:48:06FromDiscord<ElegantBeef> There's nothing preventing you
09:48:24FromDiscord<Phil> Wait what
09:48:24FromDiscord<ElegantBeef> Macros only require you to have code that is parsable what you do with it is between you and your god
09:48:29FromDiscord<Rika> Beef with his discord avatar sure is weird to look at
09:48:38FromDiscord<ElegantBeef> Yea my white dog is weird
09:48:48FromDiscord<ElegantBeef> He has a tennis ball addiction
09:48:51FromDiscord<Phil> Ohhh you'd have to generate a variable swap somewhere, check
09:48:52FromDiscord<ElegantBeef> If he loses it he cries
09:49:08FromDiscord<Rika> I mean don’t all dogs have a tennis ball addiction
09:49:11FromDiscord<Coachonko> Quick question, I never tried: can you name procs with the first character being an underscore? Like the classic convention on private methods?
09:49:33FromDiscord<sOkam!> nope. you put them in a separate file without , so you actually cant access them
09:49:46FromDiscord<sOkam!> its not fake private, its real private
09:49:50FromDiscord<Coachonko> Awesome, I like this. We need more limitations
09:50:05FromDiscord<ElegantBeef> In reply to @Rika "I mean don’t all": Nah my otherone is mostly indifferent
09:50:26FromDiscord<ElegantBeef> Underscores cannot start a identifier in Nim since it's style insensitive and removes them all
09:50:32FromDiscord<ElegantBeef> Even more freedom
09:50:43FromDiscord<ElegantBeef> Coachonko is going to explode with fear of the freedom
09:51:26FromDiscord<ElegantBeef> Rika for context he literally shakes waiting for me to play with him whilst I'm making breakfast
09:51:38FromDiscord<Coachonko> Wot
09:51:44FromDiscord<ElegantBeef> He knows play time is soon, but he just has to wait, he's impatient as fuck
09:51:56FromDiscord<ElegantBeef> That compiles
09:51:57FromDiscord<ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=4n4Q
09:52:04FromDiscord<sOkam!> In reply to @Coachonko "Awesome, I like this.": everything is private by default in nim↵just get the habit of not adding to things, write your file, and then selectively mark whatever you need exported↵even then, after, you can also do `from myfile import nil` and then everything will need to be qualified with `myfile.thatPublicThing` or else it won't be accessible
09:52:04FromDiscord<Coachonko> What in the world
09:52:09FromDiscord<ElegantBeef> Cause Nim is rightly style insensitive
09:52:16FromDiscord<ElegantBeef> It removes so many possible issues
09:52:31FromDiscord<Phil> In reply to @Coachonko "What in the world": This is the world where I can use camel-case, but you can use it as snake_case so my style-choices don't ruin your snake_case
09:52:38FromDiscord<Coachonko> Wait a secon what does `` even mean in Nim 🤣 I am lost sorry
09:52:46FromDiscord<ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=4n4R
09:52:47FromDiscord<ElegantBeef> `` is the export marker
09:52:54FromDiscord<Coachonko> Oh
09:52:54FromDiscord<ElegantBeef> It's the same as "public" in other languages
09:53:05FromDiscord<sOkam!> In reply to @Coachonko "Wait a secon what": `var thing: int` exported int
09:53:11FromDiscord<Coachonko> Man I almost assumed it was a pointer marker
09:53:14FromDiscord<ElegantBeef> Nope
09:53:21FromDiscord<ElegantBeef> Nim does `ptr T` for pointers
09:53:30FromDiscord<ElegantBeef> and `[]` for dereferencing
09:53:30FromDiscord<sOkam!> nope, pointer is just `ptr Type` or `ref Type` or `pointer`
09:53:33FromDiscord<Coachonko> `ptr` sounds like a fart
09:53:38FromDiscord<sOkam!> stick to ref, btw
09:53:39FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4n4S
09:53:51FromDiscord<ElegantBeef> sokam bold of you to assume coach is going to stick around
09:54:01FromDiscord<sOkam!> tru
09:54:08FromDiscord<ElegantBeef> Most people that learn of Nim's freedom and react this way are in a neighbouring village doing woodworking by lunch
09:54:09FromDiscord<Coachonko> Hey how little trust you have in me
09:54:20FromDiscord<Coachonko> I thought this was a good community
09:54:23FromDiscord<ElegantBeef> Oh it is
09:54:23FromDiscord<Coachonko> Now I am disappointed
09:54:25FromDiscord<Coachonko> I am leaving
09:54:29FromDiscord<ElegantBeef> Lol
09:54:33FromDiscord<Phil> It is, but beef is just looking for beef
09:54:37FromDiscord<ElegantBeef> Am i?
09:54:38FromDiscord<Phil> That's why he's called beef
09:54:50FromDiscord<sOkam!> every person ive seen react to nim was like "what? no bracers and indent has meaning? shit lang"... without even reading about it 😄
09:54:58FromDiscord<ElegantBeef> I just assume most people that react this way are uninterested by the language due to the oddities and will not use it
09:55:03FromDiscord<sOkam!> when the rest absolute pure genius
09:55:15FromDiscord<Phil> In reply to @sOkam! "every person ive seen": I'mma just adopt Shalok's mantra on that, which he stole from pythonista's: You must not have tried it yet
09:55:17FromDiscord<ElegantBeef> I'm always happy to be surprised
09:55:21FromDiscord<Coachonko> I think I would like to understand it and use it
09:55:30FromDiscord<Coachonko> I am looking for a language to use in the backend
09:55:45FromDiscord<Phil> Neat, what do you need for your tech-stack?
09:55:52FromDiscord<Coachonko> Being good
09:55:59FromDiscord<Coachonko> 😎
09:56:06FromDiscord<sOkam!> good is not a tech term 😎
09:56:08FromDiscord<Phil> Eh, you can develop that while you play around with webdev in nim
09:56:11FromDiscord<sOkam!> :kappa:
09:56:12FromDiscord<ElegantBeef> I dont know how the language changes your skills 😄
09:56:37FromDiscord<sOkam!> joke aside, the js backend is great
09:56:39FromDiscord<Phil> It teaches you about compiletime, compilers, value/ref types, pointers, dynamic loading of libs
09:56:48FromDiscord<Phil> I'd say all of that impacted my skills 😛
09:56:51FromDiscord<ElegantBeef> In reply to @sOkam! "joke aside, the js": Why would someone use Nim's JS for backend
09:57:10FromDiscord<Phil> In reply to @sOkam! "joke aside, the js": If you use nim js for a webserver I will hurt you
09:57:17FromDiscord<sOkam!> 😄
09:57:20FromDiscord<ElegantBeef> That's like buying a sport car for the engine to put in your old beatup pinto
09:57:39FromDiscord<sOkam!> kk i know nothing about webdev frontend or backend words meaningss. chill ⚰️ 😄
09:57:42FromDiscord<Phil> That'd be actively choosing a slower way to run your webserver code because in a more complicated fashion
09:57:45FromDiscord<sOkam!> haha
09:57:55FromDiscord<ElegantBeef> Backend is the server
09:57:56FromDiscord<Phil> (edit) removed "because"
09:58:02FromDiscord<ElegantBeef> frontend is the browser shit
09:58:08FromDiscord<Phil> Frontend is where the JS goes
09:58:16FromDiscord<ElegantBeef> Nodejs would argue otherwise ;P
09:58:18FromDiscord<Phil> Some madlads are running JS via node in the backend
09:58:27FromDiscord<sOkam!> what i meant to say is that with nim you never really need js, you just compile to js as if it was ts, but with the extra of code usable for anything, not just frontend
09:58:43FromDiscord<Phil> but that's still slower than compiled languages generally, assuming both frameworks are running async through and through
09:59:25FromDiscord<Phil> Eh, I still like my JS tooling for frontend, but I will admit I miss "proper" static-typing,
09:59:37FromDiscord<sOkam!> whats your definition of good, @Coachonko ?
09:59:38FromDiscord<ElegantBeef> JIT can be fast but JIT generally is not going to be as fast as native in most problems
10:01:56FromDiscord<ElegantBeef> Oh and Phil whenever you want to fight with macros micros is now a nimble package 😄
10:02:17FromDiscord<ElegantBeef> I may or may not have finally decided "It's in almost all my packages, might aswell ship it"
10:03:14FromDiscord<Phil> In reply to @ElegantBeef "I may or may": "I force all my users to indirectly use it, might as well allow them to directly use it" 😛
10:03:25FromDiscord<ElegantBeef> Hey nimble is decentralised
10:03:33FromDiscord<ElegantBeef> I dont have any users aside from this phil guy
10:03:40FromDiscord<Phil> Strange dude
10:03:48FromDiscord<Phil> Heard him harping about constructor and how it's the bee's knees
10:04:09FromDiscord<Phil> Still love how that thing just casually saved me several hundred lines of code
10:04:10FromDiscord<ElegantBeef> Jokes on him bees dont have knees
10:04:53FromDiscord<ElegantBeef> Kinda hard to have knees if you dont have a internal skeletong
10:04:57FromDiscord<ElegantBeef> (edit) "skeletong" => "skeleton"
10:04:58FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4n50
10:05:15FromDiscord<sOkam!> i thought borrow could take care of this case 🤔
10:05:28FromDiscord<ElegantBeef> If it couldnt borrow it'd error
10:05:49FromDiscord<ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=4n51
10:06:05FromDiscord<Phil> This is in the same module, that should just bind the `-` on its own
10:06:06FromDiscord<sOkam!> mixin instead of borrow?
10:06:12FromDiscord<ElegantBeef> Reread my message
10:06:21FromDiscord<Phil> Nah, just do a mixin in the xt proc
10:06:25FromDiscord<ElegantBeef> Phil the error is in vmath
10:06:30FromDiscord<sOkam!> ah the issue is that vmath doesnt.... i missed that part my bad
10:06:32FromDiscord<ElegantBeef> So we know it's a generic procedure
10:06:47FromDiscord<ElegantBeef> In reply to @sOkam! "ah the issue is": Hey i'm not mad, just was saying my message contained the information 😄
10:07:00FromDiscord<Coachonko> Sorry I left for a bit. I tried js in backend and it's a mess I don't want to deal with
10:07:17FromDiscord<ElegantBeef> Atleast i think this is a VMath issue
10:08:11FromDiscord<sOkam!> what should i do to check. if i modify the vmath file, it should fix it in theory?
10:08:21FromDiscord<ElegantBeef> https://github.com/treeform/vmath/blob/f4c668874e48e9153d52c4d098f8202e5abec8a9/src/vmath.nim#L651-L679↵↵Inside of these insert a `mixin op`
10:08:39FromDiscord<Phil> I don't think it is, VMath gets pointed at here because it tries to apply the `-` procs from there, which it shouldn't because VMAth isn't the one defining `-` for FxBase and I don't think even for int32 (?)
10:08:49FromDiscord<ElegantBeef> Full error sokam
10:08:50FromDiscord<Phil> I'd need to check who implements - for int32
10:08:52FromDiscord<ElegantBeef> Just so i can slap Phil
10:09:07FromDiscord<ElegantBeef> The line information phil points to Vmath
10:09:14FromDiscord<ElegantBeef> Which means the culprit is code inside vmath
10:09:18FromDiscord<Phil> that is the violence inherent in the beef!
10:09:19FromDiscord<ElegantBeef> Not that it's trying to access code in vmath
10:09:31FromDiscord<ElegantBeef> If you notice the overloads shown are `AllocStats`
10:09:41FromDiscord<ElegantBeef> Vmath does not use `AllocStats`
10:10:02FromDiscord<sOkam!> you sure its there? its only using `a - b` in my code
10:10:03FromDiscord<Phil> I have never stared into VMath, I wouldn't know what it does or does not implement
10:10:17FromDiscord<ElegantBeef> It's Vector Math
10:10:22FromDiscord<ElegantBeef> Yes sokam
10:10:32FromDiscord<ElegantBeef> You're calling `-` which is generated using this template
10:10:36FromDiscord<sOkam!> full error is long, but sec
10:10:38FromDiscord<ElegantBeef> Which means these procs are named `op`
10:10:46FromDiscord<ElegantBeef> I mean you can just put `mixin op` in there and see
10:11:18FromDiscord<sOkam!> https://media.discordapp.net/attachments/371759389889003532/1071372369932861461/err.txt
10:11:33FromDiscord<sOkam!> yeah will do. i was just asking
10:11:34FromDiscord<ElegantBeef> From what you provided the issue is you're calling Vmaths `-` which needs to call your `-` but it's not explicitly being told "Look in this scope"
10:12:09FromDiscord<Phil> hmmm
10:12:10FromDiscord<ElegantBeef> Oh sorry https://github.com/treeform/vmath/blob/f4c668874e48e9153d52c4d098f8202e5abec8a9/src/vmath.nim#L579-L640
10:12:32FromDiscord<sOkam!> yeah, that second link is why I asked if you were sure
10:12:41FromDiscord<Phil> Still don't get how it doesn't find the borrowed `-` automagically
10:12:43FromDiscord<ElegantBeef> I mean should be `mixin` both
10:12:46FromDiscord<sOkam!> i was thinking it would be around there, but you know more so 🤷‍♂️
10:12:54FromDiscord<sOkam!> yeah true
10:13:00FromDiscord<ElegantBeef> In reply to @Isofruit "Still don't get how": It may have binded instead of mixin'd
10:13:07FromDiscord<ElegantBeef> So it only looks for it's known symbols
10:13:20FromDiscord<ElegantBeef> you also could do `mixin op` or `bind op` inside the template instead of each proc likely
10:13:32FromDiscord<ElegantBeef> Templates are a bit odd in that regard
10:13:49FromDiscord<Coachonko> In reply to @Isofruit "Eh, I still like": js in backend is a mess for more reasons than just static typing. For frontend it is also a mess but not as much, and besides it is very mature there
10:14:18FromDiscord<Phil> I mean, in the frontend it's 500 tiny messes because hopefully you're splitting into components properly
10:14:38FromDiscord<Coachonko> Hopefully the bundler doesn't put backend packages in the bundle
10:15:07FromDiscord<ElegantBeef> impatiently awaiting the "yep mixin worked" so i can flame phil more
10:15:23FromDiscord<Coachonko> You can't just await in global scope smh
10:15:36FromDiscord<sOkam!> what if `bind` works instead
10:15:43FromDiscord<sOkam!> 🙂
10:15:44FromDiscord<ElegantBeef> I count it as a win
10:15:45FromDiscord<Phil> You can't in nim either, you have to `waitFor` instead 😛
10:15:58FromDiscord<ElegantBeef> Sorry i dont use async cause my code doesnt have IO
10:16:02FromDiscord<Phil> Beef is just motivated by pure spite at thi spoint xD
10:16:08FromDiscord<ElegantBeef> Lol
10:16:09FromDiscord<Coachonko> In reply to @Isofruit "You can't in nim": in js you actually can, top level await is a thing now, not only in ts
10:16:21FromDiscord<Coachonko> But I didn't know about waitFor, thanks for info
10:16:42FromDiscord<Phil> In reply to @Coachonko "But I didn't know": Note that waitFor blocks the entire Thread, await does not
10:16:48FromDiscord<Coachonko> Oh
10:16:52FromDiscord<Coachonko> Ayy lmao
10:16:53FromDiscord<ElegantBeef> I dont even think that's right
10:17:02FromDiscord<ElegantBeef> Leorize corrected me when i said that last time
10:17:12FromDiscord<Phil> > Blocks the current thread until the specified future completes. Source Edit
10:17:27FromDiscord<Phil> If I'm wrong then the docs are lying
10:17:35FromDiscord<ElegantBeef> In reply to @Isofruit "Beef is just motivated": I mean it's not like i have much else to do!
10:17:36FromDiscord<Coachonko> Perhaps
10:18:03FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4n54
10:18:08FromDiscord<ElegantBeef> Nope
10:18:10FromDiscord<ElegantBeef> I assume no change
10:18:21FromDiscord<ElegantBeef> Are you sure you're using this version of vmath
10:18:44FromDiscord<Coachonko> I was looking at the documentation to find a list of all the operators in nim, like arithmetic operators, operators for strings and other types, and logical operators. But I couldn't find it
10:18:54FromDiscord<ElegantBeef> I swear you're going to make me clone, fork, fix and PR this at 0330 😄
10:18:55FromDiscord<Coachonko> The docs are also crashing the browser on my shitty laptop btw
10:18:56FromDiscord<sOkam!> there is no other version of vmath installed, i checked. unless it can read it from other folders than `~/.nimble/pkgs/vmath...`
10:19:21FromDiscord<Phil> Huh, now that I haven't seen happen before
10:19:52FromDiscord<sOkam!> @Coachonko https://nim-lang.org/docs/manual.html#lexical-analysis-operators
10:20:19FromDiscord<Coachonko> My laptop runs a i3-5005u which is very very underpowered. If the docs page stays open for long enough the cpu gets 100% utilization and freezes every other process
10:20:28FromDiscord<Coachonko> I don't know why and can't really find out
10:20:48FromDiscord<Coachonko> Are the docs running on karax?
10:20:56FromDiscord<Phil> I honestly don't know
10:21:18FromDiscord<Phil> Wait, actually I don't think so, when you compile your own docs you get straight up HTML files
10:21:24FromDiscord<Phil> I think it's just static HTML
10:22:17FromDiscord<Coachonko> The link has some js
10:22:28FromDiscord<Coachonko> I think at least, there was a theme switch
10:23:42FromDiscord<Coachonko> sent a code paste, see https://play.nim-lang.org/#ix=4n56
10:25:42FromDiscord<Phil> shr and shl are bit magic
10:25:46FromDiscord<Phil> Honestly never touched them
10:26:03FromDiscord<Phil> isnot is basically is not, sometimes that combo is buggy
10:26:20FromDiscord<Phil> mod is modulo
10:26:34FromDiscord<sOkam!> sent a long message, see http://ix.io/4n57
10:27:30FromDiscord<sOkam!> (edit) "http://ix.io/4n57" => "http://ix.io/4n58"
10:27:49FromDiscord<sOkam!> (edit) "http://ix.io/4n58" => "http://ix.io/4n59"
10:28:47FromDiscord<Phil> Well, `is not` isn't "buggy" per se, it's that `is not` / `not is` / `not in` just has resolves differently than what you want sometimes
10:29:16FromDiscord<Coachonko> In reply to @Isofruit "Well, `is not` isn't": what does that mean though
10:29:21FromDiscord<sOkam!> `not in` has never worked for me ever to this day. probably misuse on my part 🙈
10:29:22FromDiscord<Phil> (edit) removed "has"
10:29:49FromDiscord<ElegantBeef> Yea i'm not going to be able to fix vmath right now, there is a subtle generic bug that one needs to work around
10:30:14FromDiscord<sOkam!> why so? whats the issue?
10:30:35FromDiscord<ElegantBeef> the issue is that it's not calling your `-`
10:30:39FromDiscord<ElegantBeef> Or did you forget? 😄
10:30:50FromDiscord<sOkam!> ah i see
10:30:56FromDiscord<sOkam!> so by borrowing i break it?
10:30:58FromDiscord<ElegantBeef> No
10:30:59FromDiscord<Phil> In reply to @Coachonko "what does that mean": `5 not in @[1,2,3]` does not work because you need `5 in @[1,2,3]` so it can turn that do `@[1,2,3].contains(5)`
10:31:01FromDiscord<ElegantBeef> Using a distinct did
10:31:13FromDiscord<ElegantBeef> A min repro is just using a distinct
10:31:35FromDiscord<Phil> `not 5 in @[1,2,3]` does not work because it'll try to do `not 5` first before evaluating the "in" expression.↵`not 5` evaluates to `-6` though
10:31:41FromDiscord<sOkam!> whats the workaround?
10:31:49FromDiscord<Coachonko> What is this syntax
10:31:54FromDiscord<Coachonko> Cringe
10:32:00FromDiscord<ElegantBeef> There isnt a work around really you need to define your own `-` operator
10:32:08FromDiscord<ElegantBeef> for `Gvec3[MyType]`
10:32:14FromDiscord<sOkam!> oh shoot
10:32:22FromDiscord<Phil> You can do `not(5 in @[1,2,3])`, that works properly again because the braces enforce the order of evaluation
10:32:38FromDiscord<ElegantBeef> it's 0330 like i said so not like i'm the most intelligent presently
10:32:46FromDiscord<Coachonko> `not in` = `!in`?
10:32:54FromDiscord<hotdog> 5 notin @[1,2,3]
10:32:58FromDiscord<hotdog> Should work
10:33:02FromDiscord<ElegantBeef> `notin` == `! a.contains(b)`
10:33:23FromDiscord<Phil> In reply to @hotdog "5 notin @[1,2,3]": Yeah, I was more explaining why `notin` is a thing, because your "proper" alternative is what I wrote above
10:33:40FromDiscord<Phil> Coachonko wanted to know why `notin` and `isnot` exist
10:33:49FromDiscord<hotdog> Ah yeah just read up the chain a bit
10:34:02FromDiscord<hotdog> I hadn’t followed the conversation
10:34:13FromDiscord<hotdog> (edit) "Ah yeah ... just" added "I"
10:34:19FromDiscord<Phil> Order of evaluation is just tricky here, and to fix that there are these 2 combo-operators
10:34:33FromDiscord<sOkam!> `5 not in @[1,2,3]` should be a thing, just saing
10:34:40FromDiscord<Coachonko> In reply to @Isofruit "`not 5 in @[1,2,3]`": Hold the f- Why does `not 5` evaluate to `-6`
10:34:42FromDiscord<sOkam!> (edit) "saing" => "saying"
10:34:47FromDiscord<ElegantBeef> cause it's also a binary op
10:35:05FromDiscord<sOkam!> In reply to @Coachonko "Hold the f- Why": becaouse you are bitwise notting the 5
10:35:49FromDiscord<Coachonko> https://tenor.com/view/hmm-sure-catbruh-gif-21408636
10:36:02FromDiscord<Coachonko> I see, no previews
10:36:06FromDiscord<Coachonko> Sadge
10:36:17FromDiscord<sOkam!> In reply to @Coachonko "https://tenor.com/view/hmm-sure-catbruh-gif-2140863": 😄 yeah, bitwise math do be like that
10:36:41FromDiscord<Coachonko> It makes sense but I don't know why I didn't expect it
10:36:43FromDiscord<sOkam!> once you get bitwise operators, they are powerful af. but they sure are confusing
10:36:50FromDiscord<sOkam!> ah kk
10:37:10FromDiscord<ElegantBeef> Anyway sokam make an issue and if treeform hasnt fixed it by when i wake up i'll take a shot again
10:37:10FromDiscord<Coachonko> Maybe because operators are written in english here
10:37:12FromDiscord<sOkam!> yeah the word makes it not obvious in nim's case, i also was confused by that
10:37:13FromDiscord<ElegantBeef> for now i'm sleeping
10:37:35FromDiscord<sOkam!> since in other langs the word always tends to mean logic `!`
10:38:03FromDiscord<Coachonko> Yes that's very likely that
10:38:17FromDiscord<Coachonko> I just thought `not 5` = `!5`
10:38:24FromDiscord<Coachonko> Or something
10:38:25*ltriant joined #nim
10:38:49FromDiscord<Coachonko> Anyway I think the operators are not explained as good as I expected from docs
10:39:29FromDiscord<hotdog> In reply to @Coachonko "My laptop runs a": Which page? The docs don’t have a lot of js so this is surprising
10:39:50FromDiscord<Coachonko> The docs are all in one page
10:39:54FromDiscord<Coachonko> I believe
10:40:10FromDiscord<Coachonko> I am afraid to look 👀
10:40:58FromDiscord<hotdog> Are you talking about _theindex_?
10:41:05FromDiscord<Phil> When searching you download an entire index, that's 2 MB so that could also take up time
10:41:09FromDiscord<sOkam!> @Coachonko https://nimbyexample.com/ is great↵also if you follow this you will get the lang it in like a weekend max https://nim-lang.org/docs/tut1.html
10:41:29FromDiscord<Phil> Though compressed that's only 200kb so eh
10:41:59FromDiscord<hotdog> In reply to @Isofruit "When searching you download": That could be slow but shouldn’t spin up cpu
10:42:20FromDiscord<sOkam!> this tut was also really good, i think i started with this one https://narimiran.github.io/nim-basics/
10:42:23FromDiscord<Coachonko> All I know is that ever since I stopped looking at the docs I experienced no more freezes
10:42:37FromDiscord<Coachonko> My browser doesn't use any addon either expect for ublock
10:42:43*ltriant quit (Ping timeout: 256 seconds)
10:57:44FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4n5f
11:03:35FromDiscord<sOkam!> nvm, doesn't work
11:11:44FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4n5j
11:45:55*PMunch joined #nim
11:53:54FromDiscord<Piqueiras> I tried to combine abstract vectors and modular arithmetics but my brain is rotting rn lmao
11:55:01FromDiscord<Piqueiras> I somehow managed to get a mod 5 number behave like so but get text represented as mod 3
11:58:14FromDiscord<Piqueiras> It binds to whichever I initialize first
11:59:27*uics joined #nim
12:00:54FromDiscord<Piqueiras> Is there a way to turn seq into array?
12:04:29Zevvnot without copying the data.
12:05:28Zevvbut why do you think you want that
12:07:01FromDiscord<Piqueiras> I have a vector implemented as array but the best solution ive seen is using mapIt which returns a seq I think
12:08:55ZevvmapIt is generic and acts on seqs indeed; if you want something similar for your own array type, the implementation would be pretty trivial.
12:09:26Zevvarrays and seqs are quite different beasts; array are fixed size and live on the stack, a seq basically is a ref on the stack to a variable sized block on the heap
12:09:41Zevvwhich can grow and shrink and all
12:10:16Zevvi don't know what you re doing, but if you are doing a lot of vector calculations, you probably want to avoid allocation new seqs all of the time
12:12:04FromDiscord<Piqueiras> Its not for a project or anything, im just trying to do some weird algebra
12:12:33PMunchZevv, you're not at FOSDEM?
12:13:02FromDiscord<Piqueiras> But im stumbling upon lots and lots of "cannot instantiate" and "has no type"
12:13:02Zevvi'm in brussels
12:13:36Zevvdisruptek is on the other side of the square
12:14:34PMunchKeeping a safe distance?
12:14:48Zevvsafety first
12:17:07FromDiscord<Piqueiras> i swear how can i have a sew of modulo 5 integers which behave perfectly as modulo 3
12:25:00FromDiscord<Rika> I don’t understand
12:31:16FromDiscord<Piqueiras> so modulo 3 integers would be [0],[1],[2] and for example 4=1 mod 3↵meanwhile mod 5 are [0] to [4]
12:31:30FromDiscord<Rika> Yes but what do you mean by “sew”
12:31:40FromDiscord<Piqueiras> oh a seq
12:31:42FromDiscord<Piqueiras> lmao
12:31:42FromDiscord<Rika> And “that behave perfectly as”?
12:32:21FromDiscord<Piqueiras> https://media.discordapp.net/attachments/371759389889003532/1071407865992073266/image.png https://media.discordapp.net/attachments/371759389889003532/1071407866218549338/image.png
12:32:37FromDiscord<Piqueiras> it calculated the second seq as mod 3 but its a mod 5 one lol
12:32:39FromDiscord<Rika> Isn’t a seq of modulo 5 integers that behave like modulo 3 integers just a seq of modulo 3 integers
12:33:01FromDiscord<Rika> In reply to @Piqueiras "it calculated the second": What is the proc definition
12:33:41FromDiscord<Piqueiras> ive been trying some stuff https://media.discordapp.net/attachments/371759389889003532/1071408200412319825/image.png
12:34:16FromDiscord<Piqueiras> this is just modulo which worked fine, but vectors of modulos work strange https://media.discordapp.net/attachments/371759389889003532/1071408348211204167/image.png
12:34:36*jmdaemon quit (Ping timeout: 255 seconds)
12:55:35FromDiscord<fabricio> sent a code paste, see https://play.nim-lang.org/#ix=4n5K
12:56:38FromDiscord<fabricio> am I doing something wrong, because to me it looks correct
13:03:53FromDiscord<fabricio> or maybe the error message is too generic for me to understand
13:31:21*uics quit (Remote host closed the connection)
14:16:36*rockcavera quit (Remote host closed the connection)
14:18:38FromDiscord<Piqueiras> I think Im giving up on these static modular arrays 🫠
14:19:18FromDiscord<Piqueiras> Should I post the thing on the forums to see if anyone has a clue?
14:20:36FromDiscord<Phil> Generally when discord can't help, forum is a decent shot
14:22:55*rockcavera joined #nim
14:24:11FromDiscord<Piqueiras> Maybe the problem is I want to have so many things in my program at the same time
14:24:35FromDiscord<Piqueiras> And that I barely got into generics and templates
14:27:23FromDiscord<leorize> you're trying to create value of types that are only defined at runtime
14:27:28FromDiscord<leorize> so it won't work
14:31:04FromDiscord<Piqueiras> I might try with some ref objects or sth
14:31:22FromDiscord<leorize> try moving `Block` definition below `TopLevel`↵(@fabricio)
14:31:30FromDiscord<leorize> you can also try `result = Ast()` to skip `new` entirely
14:31:45FromDiscord<leorize> just output `seq`
14:33:32FromDiscord<leorize> if you want to output an array from this, try `proc mapModulo[I](v: array[I, int], N: static int): Vector[I, N]`
14:39:01*ltriant joined #nim
14:39:30FromDiscord<auxym> so I want to `{.compile}` a C file, which needs some `#define`s. What are my options in nim? 1) `{.passc: "-D..."}`, 2) write a .h file from nim at compile-time and include that; 3) ???
14:42:17FromDiscord<leorize> `passC` sounds better to me
14:43:11*ltriant quit (Ping timeout: 252 seconds)
14:43:36FromDiscord<auxym> oh and I could pass `-D`s directly to the `{.compile.}` pragma. that sounds like a decent solution
14:49:34*derpydoo quit (Ping timeout: 260 seconds)
14:53:55*uics joined #nim
14:57:56FromDiscord<Piqueiras> In reply to @leorize "if you want to": Guess I might
14:58:11FromDiscord<Piqueiras> But again I think I dived too fast into this lol
14:58:28FromDiscord<Piqueiras> Gotta be happy with float vectors and modulo ints working separately
14:58:50PMunch@auxym, you've also got {.emit.}
14:59:31FromDiscord<auxym> yeah. not sure how well emit would work at the module level
15:00:35FromDiscord<auxym> on another note, is it possible to introspect into a module a compile-time? eg. getting a typed node in a macro and iterate all top-level nnksyms in the module, or something like that?
15:01:33PMunchNot really
15:01:38FromDiscord<auxym> ah 😦
15:01:42PMunchMacros can't do anything about the stuff around it
15:01:48PMunchIt's an unfortunate limitation
15:01:58FromDiscord<auxym> well I'd be passing it the module nnksym as an argument
15:02:05FromDiscord<auxym> to the macro
15:02:41FromDiscord<auxym> like `mymacro(strutils)` or something like that
15:05:05PMunchMaybe you could return a `mymacroImpl: include strutils` or something, but not entirely sure
15:07:23PMunchHmm, that does actually seem possible
15:09:57FromDiscord<auxym> at this point I'd just like to return a string literal from the macro, that would contain/depend on the symbols that exist in the module passed as an argument. So I'm getting a `nnkSym` node with symkind = `nskModule`, but then that node has 0 children, so not sure where to go from there
15:11:25FromDiscord<auxym> hm maybe getImpl is what I need?
15:12:30*derpydoo joined #nim
15:12:40FromDiscord<auxym> `nilLit` :/
15:13:35PMunchThrew together this little sample for you: https://play.nim-lang.org/#ix=4n6I
15:14:23PMunchThat imports a module while echoing out all the top-level constants in said module
15:16:40FromDiscord<auxym> oohh awesome, thanks!
15:20:21PMunchKeep in mind that this is dark wizardry
15:20:47PMunchIf Araq asks don't tell him I showed you how to do this :P
15:22:31FromDiscord<auxym> I'll keep it on the down low 😄
15:24:39termerPMunch you naughty bastard! how could you!
15:26:32PMunchOh shit, we've been made!
15:26:34PMunchScram
15:34:56*arkurious joined #nim
15:43:07PMunchTo be honest I didn't even know that was possible
15:43:17PMunchOpens some interesting possibilities though
15:55:32*uics quit (Remote host closed the connection)
16:00:47FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4n70
16:01:19FromDiscord<Phil> Possibly the bindings just have some mac-specific thing in them that doesn't occur on linux or sth, no idea
16:01:31FromDiscord<sOkam!> is there a way to know if a file is running on nimscript or compiled?
16:01:32PMunchTIL svgbob
16:02:01PMunch@Phil, well you need to pass it arguments..
16:02:15PMunchsOkam, yes
16:02:19FromDiscord<Phil> But the example said it would work like that!
16:02:27PMunchWell the example lied
16:02:52FromDiscord<Phil> gasp
16:03:04PMunchI'm guessing they just added in another feature and forgot to update the docs
16:03:15PMunchJust pass an empty sequence and you should be good
16:03:30PMunchOr pass the command line params
16:05:25FromDiscord<sOkam!> how do you check if a file is running on nimscript or compiled? is it a define?
16:05:32FromDiscord<Phil> the ptr ptr char is killing me there
16:06:01FromDiscord<Phil> I so rarely actually nab pointers myself I keep forgetting how to get them
16:06:43FromDiscord<sOkam!> In reply to @Isofruit "the ptr ptr char": pointers to strings in c are the worst 😔
16:06:46FromDiscord<Rika> use the second one
16:06:51FromDiscord<Rika> `template newQApplication(args: seq[string]): ptr QApplication`
16:07:13FromDiscord<Phil> Huh, yeah that one works
16:07:44FromDiscord<Phil> In reply to @sOkam! "pointers to strings in": C - "types" are the worst, as is the notion that nothing in C is allowed to figure out how long a thing is, you must tell C because C can't know somehow
16:07:58FromDiscord<sOkam!> yea, also that
16:08:07FromDiscord<Phil> And the fact that you apparently never return stuff, you pass in an output parameter that gets written to
16:08:10FromDiscord<Phil> Like, what is this
16:08:56FromDiscord<sOkam!> i was translating some file reading code a few weeks ago, and the types went down from 100 to literally like 50 just because of all the counters everywhere for c ⚰️
16:09:48FromDiscord<sOkam!> In reply to @Isofruit "And the fact that": pass by copy really sucks for big chunks of data, i imagine thats why
16:10:02FromDiscord<Rika> In reply to @Isofruit "And the fact that": its because C does not have exceptions or an inbuilt data type for returning multiple data types i guess?
16:12:11PMunchsOkam, I believe it's when defined(nimscript) or nimvm or something like that
16:13:22FromDiscord<sOkam!> the manual says nimvm is for the compiler
16:13:31FromDiscord<sOkam!> but i cant find anything about nimscript in there
16:16:32FromDiscord<sOkam!> the nimvm one is here, also the ismainmodule its there as a const https://media.discordapp.net/attachments/371759389889003532/1071464284112048309/image.png
16:17:24PMunchsOkam, nimscript is all run in the NimVM
16:19:26FromDiscord<sOkam!> `when nimvm: something` worked
16:19:36FromDiscord<sOkam!> i was trying when defined, but nope. actually just when
16:25:35*derpydoo quit (Ping timeout: 260 seconds)
16:46:38*PMunch quit (Quit: leaving)
17:00:07FromDiscord<sOkam!> is there any proc to do something equivalent to bash's `touch somefile`?↵i found `existsOrCreateDir` but i cannot find anything like that for files
17:01:10FromDiscord<sOkam!> in fact, that function uses `rawCreateDir` in the background, but there seems to be no `rawCreateFile`?↵so was wondering if im just searching for the wrong name
17:01:43FromDiscord<Rika> write a file
17:01:49FromDiscord<Rika> with no contents
17:01:53FromDiscord<Rika> so just use write or writefilke
17:01:54FromDiscord<Rika> (edit) "writefilke" => "writefile"
17:02:12FromDiscord<leorize> you don't even have to write a file, just open it with read & write
17:02:24FromDiscord<Rika> i guess so yeah
17:02:46FromDiscord<leorize> i don't remember if Nim truncates a file, so be careful about that
17:08:47FromDiscord<sOkam!> what if a file does exist, but you write to it?
17:09:02FromDiscord<sOkam!> the key of touch is that it doesn't change contents if it exists
17:13:07FromDiscord<sOkam!> i guess 🤔 https://media.discordapp.net/attachments/371759389889003532/1071478516706717737/image.png
17:18:39FromDiscord<fabricio> In reply to @leorize "try moving `Block` definition": it works when I put its definition above the first type that uses `Block` and remove the `: Stmt|TopLevel` constraint
17:20:34FromDiscord<fabricio> sent a code paste, see https://paste.rs/ZTu
17:26:55FromDiscord<pyolyokh> In reply to @sOkam! "is there any proc": man utime. That's the underlying syscall
17:27:34FromDiscord<pyolyokh> thanks to "If times is a null pointer, the access and modification times of the file shall be set to the current time." you can implement `touch` in two lines.
17:29:53FromDiscord<pyolyokh> ah, except: utime doesn't create the file if it doesn't exist
17:30:32FromDiscord<leorize> yea generics can be very weird↵(@fabricio)
17:30:38FromDiscord<pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4n7z
17:31:07FromDiscord<leorize> you can use `futimesns`
17:31:49FromDiscord<leorize> so open the file then `futimesns` it
18:39:21FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4n7Z
18:49:05*uics joined #nim
19:07:42FromDiscord<tfp> is there any way to add a destroy hook to a ref object
19:08:16FromDiscord<tfp> sent a code paste, see https://play.nim-lang.org/#ix=4n8e
19:08:23FromDiscord<tfp> changing X to a normal object works
19:11:48FromDiscord<leorize> you need to change `X -> XObj` and `X = ref XObj`
19:12:02FromDiscord<leorize> directly defining on top of a ref object is not supported
19:16:53FromDiscord<tfp> that worked, thanks!
19:22:50FromDiscord<Ntsékees> What's the best way to create a mutable string of length L?
19:23:51FromDiscord<Ntsékees> filled with whitespaces, let's say
19:30:31FromDiscord<leorize> https://nim-lang.org/docs/strutils.html#repeat%2Cchar%2CNatural
19:31:15FromDiscord<leorize> all strings in nim are mutable as long as they're in a mutable location (ie. a `var`)
19:34:21*Batzy quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
19:34:47*Batzy joined #nim
19:36:55*Batzy quit (Client Quit)
19:38:11*Batzy joined #nim
19:45:18FromDiscord<jtv> If I'm returning a cstring to a C func, I assume I need to GC_ref() it before I convert it to a C string; but then how do I unref it?? Cast it back to a Nim string? As I assume the conversion would end up creating a new string object.
19:51:43FromDiscord<michaelb.eth> is there a way to exclude a value from a range in the definition of a type?↵↵for example, `range[low(int32)..high(int32)]`, but I want to exclude `0`
19:54:20FromDiscord<Array in ∀ Matrix> sent a code paste, see https://play.nim-lang.org/#ix=4n8k
19:54:40FromDiscord<auxym> no
19:54:41FromDiscord<Array in ∀ Matrix> low of it32 would be zero?
19:57:20*uics quit (Remote host closed the connection)
19:57:28FromDiscord<michaelb.eth> sent a code paste, see https://play.nim-lang.org/#ix=4n8l
19:58:23FromDiscord<Array in ∀ Matrix> oh wait int32 is signed nvm
20:04:14*azimut_ quit (Ping timeout: 255 seconds)
20:13:49*uics joined #nim
20:13:57FromDiscord<leorize> you shouldn't return a cstring straight to a C func fwiw↵(@jtv)
20:14:51FromDiscord<leorize> in C the paradigm is either\: they provide a buffer & length and you fill it in, or you create one with `malloc` then transfer ownership to them
20:15:30FromDiscord<leorize> for your case, the only way that you can make it work is if you return the string object itself
20:15:39FromDiscord<leorize> you need the object owning the buffer to destroy it
20:15:57FromDiscord<leorize> so if you `GC_ref()` then lose the owning object, it's leaked
20:16:37FromDiscord<leorize> you can't, ranges are contiguous↵(@michaelb.eth)
20:18:03FromDiscord<jtv> Yeah, that doesn't work for the system, since it's opportunistically going to load a DLL that's in NIM, and it's not going to pass me a buffer, since I won't know the size. But that's fine, I'll give them my own interface to free crap and will just hold a list of references myself.
20:18:18*jmdaemon joined #nim
20:18:23FromDiscord<jtv> Figured that was the case, but appreciate you answering
20:19:12*peterhil quit (Ping timeout: 248 seconds)
20:19:24FromDiscord<leorize> there's always the trick where you just store the buffer in a global variable and pass the cstring back \:p
20:19:46FromDiscord<leorize> that assumes a very defined API usage pattern, ofc
20:20:06FromDiscord<Elegantbeef> Like i said you need to implement `proc yourOp(a, b: GVec[YourType]): GVec3[YourType]`↵(@sOkam!)
20:22:26FromDiscord<Array in ∀ Matrix> is there any reason why #nim-webdev\:matrix.org and #nim-embedded\:matrix.org not part of the [nim space](#nim:envs.net)?
20:22:56FromDiscord<Array in ∀ Matrix> are they just not offical rooms?
20:23:04FromDiscord<Elegantbeef> Other than the fact they are?
20:23:13FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1071526361287635064/image.png
20:23:27FromDiscord<leorize> they're in the Community subspace, mirroring the discord
20:24:01FromDiscord<Array in ∀ Matrix> weird, they dont show inside the space for me
20:24:22FromDiscord<leorize> sent a code paste, see https://play.nim-lang.org/#ix=4n8t
20:24:31FromDiscord<Array in ∀ Matrix> could be a problem with dendrite
20:24:34FromDiscord<Elegantbeef> Writing to `id`
20:24:56FromDiscord<Elegantbeef> Or raising exception
20:25:02FromDiscord<Elegantbeef> Unless we mean the old strictfuncs
20:25:18FromDiscord<leorize> correct
20:25:38FromDiscord<leorize> I don't even know what to say, this is so dumb
20:25:41FromDiscord<Elegantbeef> Based off new strictFunc rules it's mutating any data pointed at by a pointer is a side effect
20:25:42*peterhil joined #nim
20:26:04FromDiscord<Elegantbeef> It's a simpler rule, albeit not compatible with what others view functions as
20:26:54*peterhil quit (Max SendQ exceeded)
20:27:34FromDiscord<leorize> so now I can't construct an exception with the fields populated in a func
20:27:45*peterhil joined #nim
20:28:27FromDiscord<Elegantbeef> Well without ugly pragmas filling your code
20:28:44*peterhil quit (Max SendQ exceeded)
20:28:44FromDiscord<sOkam!> In reply to @Elegantbeef "Like i said you": i implemented the explicit `-` for the base type. i thought you meant that
20:28:54FromDiscord<leorize> simpler rules, but unusable
20:28:55FromDiscord<Elegantbeef> Nope not what i meant
20:34:36FromDiscord<Elegantbeef> To be fair leo a heap allocation is a side effect 😛
20:34:56FromDiscord<leorize> funcs are also unusable w/o them \:p
20:35:13FromDiscord<Elegantbeef> But yes this make strict funcs either laden with noSideEffect or pretty minute code
20:35:21*peterhil joined #nim
20:35:22FromDiscord<leorize> I tracked down the PR of the func change, doesn't seem to me that this use case was even considered
20:35:50FromDiscord<Elegantbeef> That's not how one does language design
20:37:07FromDiscord<ShalokShalom> @leorize#0000 you haven't changed that in Nimsmull yet, did you?
20:38:31FromDiscord<leorize> I forgot, you need real world code™️ when it comes to language design
20:39:18FromDiscord<leorize> yea, we don't touch experimental features other than getting rid of them
20:39:24FromDiscord<Elegantbeef> Hey clyybber did work on concepts didnt he? 😄
20:39:42FromDiscord<leorize> tbf I wasn't paying attention to nimskull dev \:p
20:39:51FromDiscord<Elegantbeef> I dont either
20:40:02FromDiscord<ShalokShalom> In reply to @Array in ∀ Matrix "could be a problem": Your account is hosted on a dendrite homeserver, you mean?
20:44:02FromDiscord<Array in ∀ Matrix> yes i run a dendrite instance↵(@ShalokShalom)
20:50:17FromDiscord<leorize> dendrite hasn't fully implemented all features so I'm not too surprised
20:50:17FromDiscord<leorize> how is dendrite btw? does your room syncs faster or anything?
20:50:18FromDiscord<Array in ∀ Matrix> most features are implemented so its not too far off now
20:50:19FromDiscord<leorize> nice, room sync time is my pet peeve about matrix
20:50:20FromDiscord<Array in ∀ Matrix> i used synapse for a bit and dendrite is significantly faster
20:52:01FromDiscord<Array in ∀ Matrix> yea dendrite starts up faster, syncs messages/rooms faster uses less ram
20:52:02FromDiscord<Array in ∀ Matrix> dendrite has 100% server-server parity with synapse and 93% with client-server
20:52:54FromDiscord<ShalokShalom> In reply to @leorize "nice, room sync time": the issue is, that the vast majority of people are sitting at ONE SERVER
20:53:11FromDiscord<ShalokShalom> As a decentralized communication platform, that is very bad
20:53:36FromDiscord<ShalokShalom> And that instance uses Synapse
20:54:13FromDiscord<leorize> frankly it doesn't matter user experience wise
20:54:27FromDiscord<leorize> the rooms are duplicated on any servers that participate in them
20:54:42FromDiscord<leorize> I'm on a different server (though I guess this one gets crowded these days too) and it's still slow
20:55:05FromDiscord<leorize> messages between users are slow to sync between phone and laptop, which I find very annoying
20:55:20FromDiscord<Elegantbeef> Just dont use your phone
20:55:21FromDiscord<Elegantbeef> Problem solved
20:55:58FromDiscord<leorize> lol
20:57:16FromDiscord<Elegantbeef> @sOkam!\: did you declare your `-` inside of a block statement or similar?
20:57:42FromDiscord<Elegantbeef> but if you remove the block it doesnt
20:57:50FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/T4N
20:58:07FromDiscord<Elegantbeef> Hmmm does Nim only choose top level symbols for generics
20:59:26FromDiscord<Phil> Beef? You used owlkettle before right?
20:59:51FromDiscord<Elegantbeef> Yes
20:59:59FromDiscord<Elegantbeef> Oh yes it seems like Nim only chooses top level symbols for generics
21:00:12FromDiscord<Phil> How easy is it to split parts of interfaces into smaller "components" into their own files?
21:00:20FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4n8G
21:00:28FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4n8H
21:00:36FromDiscord<Elegantbeef> It's not too bad
21:00:59FromDiscord<Phil> Can you make them with a strictly defined input (data you hand to the component)/output (event that fire from the component) API?
21:01:18FromDiscord<Phil> (edit) "component)/output" => "component to render)/output"
21:01:32FromDiscord<Elegantbeef> You can use closures and pointer procs
21:01:33FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4n8I
21:01:41FromDiscord<Array in ∀ Matrix> doesnt help all servers on https://joinmatrix.org/servers/ use synapse (except mine lol)
21:01:53FromDiscord<Array in ∀ Matrix> is there an offtopic we can move to?
21:02:10FromDiscord<Elegantbeef> Sokam can you make a min repro?
21:02:24FromDiscord<Elegantbeef> #offtopic
21:03:06FromDiscord<Elegantbeef> Phil to be fair i havent used owlkettle much
21:16:07om3gaHello! Found weird thing< if you flip benchmarks of the string and seq assignments, the first one will be slower: https://play.nim-lang.org/#ix=4n8M
21:16:16om3gawhy that might happen?
21:20:57om3gawith use of monotime : https://play.nim-lang.org/#ix=4n8Q
21:21:42FromDiscord<leorize> idk the string is still faster even after swap
21:22:52om3gahmm not for me
21:22:58om3gaeven in playground
21:24:54FromDiscord<leorize> I've only run it on the playground
21:25:40om3gaand another question, why if I use newStringOfCap(9000), it will have max size 256?
21:25:51FromDiscord<leorize> yes
21:25:56om3gastrings are limited in length?
21:25:58Zevvthe first one is slower because you are not measuring CPU time
21:26:00FromDiscord<leorize> oh you mean why
21:26:23FromDiscord<leorize> it's because of `Cap`, it's the capacity of the underlying buffer, not the length
21:26:31om3gaZevv: monotime kinda precise i think
21:26:34Zevvyour typical CPU is doing frequency scaling and your tests run very fast; the scaling gonverner on your CPU takes some time to switch to high speed
21:26:38FromDiscord<leorize> so it meant that you can add `n` times before the buffer has to be resized
21:26:49om3gaZevv: aah, ok, thanks
21:27:09Zevvmeasure using the cpu process timer instead
21:27:26Zevvtimes.cpuTime()
21:27:47om3galeorize: and it's possible to have cap of string more than 256?
21:28:08FromDiscord<leorize> yes, you're limited to `high(int)`, basically
21:28:13om3galeorize I tried ti add
21:28:29om3gastr.add i.char
21:28:42om3gait throws err out of bounds
21:29:01FromDiscord<leorize> char is 8 bits
21:29:07om3gawhere i is 255 :)
21:29:08FromDiscord<leorize> 255 is the maximum char value
21:29:12om3gaoh maaan
21:29:16om3gahahahaha
21:29:16om3gasorry
21:29:24om3gasuch stupid mistake
21:34:10om3galeorize : https://play.nim-lang.org/#ix=4n8T
21:34:23om3gamaybe I should go to sleep
21:34:42om3gaor I don't get where err is
21:34:59FromDiscord<leorize> it has that capacity but it's empty \:)
21:35:37om3gastr.add 'a'
21:35:57om3gathat should work, right?
21:36:04FromDiscord<leorize> yep
21:37:04om3gaI fixed it
21:37:12FromDiscord<leorize> though you should put your numbers in a const or something for ease of modification
21:37:13om3gaso it's just preallocates mem
21:37:22om3gaaha
21:37:40om3gathanks, now it works
21:37:57FromDiscord<leorize> there's a variant of those procs that set length instead, if you're interested in that
21:38:07om3gathe same behavior with seq
21:38:29FromDiscord<leorize> if you use the one that set length, you can `x[i] = something`
21:38:47FromDiscord<leorize> it's expected that seq and string have similar performance profile
21:38:47om3galeorize yeah, I need to find gast array like type of object
21:39:18om3ga*fast
21:39:42FromDiscord<leorize> seq/string is literally the same structure but different representation
21:40:09om3gabut I need it to be dynamic, so maybe own implementation of dynamic arr will be the solution
21:40:16om3gaalloc / realloc
21:41:40Zevvthat's what seqs are
21:41:41FromDiscord<leorize> seq and strings are dynamic arrays
21:41:53FromDiscord<leorize> I think you really need sleep \:P
21:42:18om3gathey are
21:42:26Zevvthey are.
21:42:58Zevvno more, no les. a seq and a string are fat pointers (ptr + len), the data itself is on the heap
21:43:14om3gabut I don't really need all the additional stuff strings store
21:43:16Zevvan initial empty seq wil allocate room for a handful of elements, if you grow it beyond that it'll reallocate
21:43:23Zevvlike what additiona lstuff
21:43:28om3gastr.len
21:43:44om3galegth are stored with strings right?
21:43:50Zevvbut it is dynamic you say
21:43:55Zevvso you use the length
21:44:24om3gaI will use it once inside proc as private var. for operations
21:44:25FromDiscord<leorize> there's always `cstring` if that's your jam, though not recommended
21:44:36Zevvom3ga: https://zevv.nl/nim-memory/
21:44:59om3gayes, I don't want to use null terminated strs
21:45:05FromDiscord<leorize> trust me, you want the length stored somewhere if its dynamic
21:45:21om3gaotherwise I would code function in C
21:45:39Zevvwhat problem are you actually trying to solve here
21:46:10om3gano, I just had question regarding time measurements and bench
21:46:47om3gadon't pay attention to other nuances, I should go take a rest anyway
21:46:53Zevvuse cpuTime()
21:47:30om3gathanks Zevv!
21:47:38om3gathat will help definitely
21:49:26FromDiscord<leorize> or just run it a million time to average it out \:p
21:49:43om3gano, not todat
21:49:44FromDiscord<leorize> there are some benchmarking libraries for microbench iirc
21:49:48om3gatoday *
21:49:52FromDiscord<leorize> criterion or something
21:50:14FromDiscord<sOkam!> sent a code paste, see https://paste.rs/Uz1
21:51:02om3gaI coded parser of the network packets with decapsulating real traffic from different protocols, and I'm not happy with the performance
21:51:32om3ga5 minutes 20 sec. kinda slow for 4gb file
21:52:05om3gaso I;m now in optimization process, so I thought strings would be faster than seqs
21:52:34FromDiscord<leorize> have you profiled the code?
21:53:09om3gayes, but it has around ten procs, I not read the output carefully
21:53:24om3gaI know where code sucks
21:54:17om3gamem optimization also would be good, but 4gb of residual ram, is ok I think, similar to file size
21:54:28FromDiscord<leorize> the golden rule is\: are you doing syscalls in the middle of sensitive work?
21:54:49FromDiscord<leorize> perf sensitive\
21:54:54om3gaI tried to replace strams to memfiles
21:55:09om3gammap should minimise syscalls during file read
21:55:29om3gabut in fact it was slow than regular stream
21:55:58FromDiscord<leorize> mmap requires a lot of planning, it's not a catchall solution
21:56:09FromDiscord<leorize> if you have the memory, just read the whole file and process from there
21:56:11om3gaI used it before in C
21:56:46FromDiscord<leorize> reading everything then process is infinitely faster than trying to do both at the same time
21:56:49om3ganewMemMapFileStream
21:57:20om3gaas manual says, it is the direct replacement for stream, but as mmaped file
21:57:35FromDiscord<leorize> unless you have io\_uring, then maybe you can do both \:p
21:57:41om3gaso reading from such stream should be faster, at least I expect that
21:58:29om3galeorize I agree, reading and after processing should be faster
21:58:45om3gasince it will be loaded in ram, which is fast
21:59:59om3gabut,, the problem is with streams, reading takes time and other processing is fast enough to give same sum of processing time in series
22:01:54om3gabut as I mentioned newMemMapFileStream should be faster. so idk why I have opposite results
22:02:04Zevvin practices mmap is often not slower; the overhead of getting stuff from a physical drive is much higher than the syscall
22:02:36Zevvalso reading syscalls typically perform readahead on both the disk an the linux vm, so by the time the next read() comes in, the data is already there
22:02:47Zevvmmap does not read stuff in ram, that's a misconception
22:02:58Zevvit maps ram to the file, but it will only go get it from disk when you read the memory
22:03:01om3gait maps to ram
22:03:05om3gayes
22:03:24om3gaand using dma or something avoids many syscalls
22:03:26FromDiscord<Iliketwertles> sent a code paste, see https://play.nim-lang.org/#ix=4n96
22:03:37FromDiscord<Iliketwertles> (edit) "https://play.nim-lang.org/#ix=4n96" => "https://play.nim-lang.org/#ix=4n97"
22:03:40Zevvsyscall overhead is overrated
22:03:44om3gabut why stream is faster then in nim? :)
22:03:46FromDiscord<Iliketwertles> (edit) "https://play.nim-lang.org/#ix=4n99" => "https://play.nim-lang.org/#ix=4n98"
22:03:47FromDiscord<Iliketwertles> (edit) "https://play.nim-lang.org/#ix=4n98" => "https://play.nim-lang.org/#ix=4n97"
22:03:53FromDiscord<leorize> I don't think you can rely on DMA for this
22:04:26om3galeorize, yeah I agree. so I removed that
22:05:40om3gasorry, I cant think more today// thanks guys for suggestions
22:12:07FromDiscord<corey> Is "Nim in Action" by Dominik Picheta still okay for learning in 2023?
22:12:47FromDiscord<leorize> it's a bit outdated, but the fundamental stuff is still the same for the most part
22:12:57FromDiscord<corey> Should I spring for Mastering Nim?
22:13:06FromDiscord<leorize> there's an errata for it on o'really forum I think
22:14:18FromDiscord<rakgew> I have both and liked nim in action better for learning nim, as it was building small projects.
22:15:17FromDiscord<rakgew> mastering nim felt more like a thorough explanation of the language spec.
22:16:08FromDiscord<rakgew> @corey \: but depending on what you are after, ymmv..
22:18:00FromDiscord<corey> I think I'll go for Mastering Nim... Thanks a lot
22:19:11FromDiscord<Iliketwertles> the amount of times ive been saved by simply adding $ to something in nim is crazy
22:19:31FromDiscord<Iliketwertles> (edit) "the amount of times ive been saved by simply adding $ to something in nim ... is" added "recently"
22:29:33FromDiscord<Iliketwertles> if anyone wants, can someone sanity check the bootAnimSet() function?↵the syntax is correct but i want human verification before running it as it modifies slightly important stuff https://media.discordapp.net/attachments/371759389889003532/1071558155953258587/main.nim
22:31:32FromDiscord<leorize> `isRoot == false` -\> `not isRoot` \:p
22:32:09FromDiscord<Iliketwertles> true
22:32:38FromDiscord<Iliketwertles> always forget that
22:33:45FromDiscord<leorize> ok your walkDir usage is wrong
22:35:24FromDiscord<Iliketwertles> what should it be? i need all the files full path to then either remove them or copy them
22:35:49FromDiscord<leorize> walkDir yields `tuple[kind: PathComponent, path: string]`
22:36:28FromDiscord<Iliketwertles> doesnt `$file` then using it fix that?
22:36:35FromDiscord<leorize> so all of that `file` -\> should be `kind, file` for the unpacking, then check `kind` to make sure that it's the right type before doing your processing
22:36:36FromDiscord<leorize> don't apply `$` randomly, it can mask issues like this
22:36:51FromDiscord<leorize> with your code right now, assuming that there's a file called `boot0.png`, `$file` is gonna be `(pcFile, "boot0.png")`, which is not what you want
22:37:44FromDiscord<leorize> write something with that loop and print `file` out, you'll understand what I meant
22:38:32FromDiscord<leorize> sent a code paste, see https://play.nim-lang.org/#ix=4n9m
22:38:57FromDiscord<leorize> ^ this is a good way to see what a loop is yielding if you're not familiar with function signatures in nim yet
22:39:14FromDiscord<leorize> you can even add `$` for good measure, though `echo` adds it automatically for you
22:47:17FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4n9p
22:47:23FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4n9q
22:47:28FromDiscord<4zv4l> is it because of wine or my code is really wrong ?
22:49:23FromDiscord<Iliketwertles> In reply to @leorize "you can even add": ok i see now
22:49:33FromDiscord<leorize> does MessageBox return int32 or uint32?↵(@4zv4l)
22:50:40FromDiscord<Iliketwertles> sent a code paste, see https://play.nim-lang.org/#ix=4n9u
22:50:42FromDiscord<4zv4l> In reply to @leorize "does MessageBox return int32": return a int
22:50:49FromDiscord<leorize> yea but don't quote `file`↵(@Iliketwertles)
22:50:51FromDiscord<4zv4l> not unsigned int 32
22:51:02FromDiscord<Iliketwertles> In reply to @leorize "yea but don't quote": gotcha thanks
22:51:32FromDiscord<leorize> you should use `cint` in that case↵(@4zv4l)
22:53:07FromDiscord<leorize> where is this minhook?
22:53:30FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4n9v
22:58:44FromDiscord<leorize> that range defect is very weird
22:58:49FromDiscord<leorize> maybe try attaching a debugger
23:00:11FromDiscord<4zv4l> well since it's with wine I don't really know how to do :/↵I should give a try on an actual windows machine
23:01:25FromDiscord<leorize> winedbg does work if you want to try that
23:03:27FromDiscord<4zv4l> I’ll check that tomorrow, midnight here xD
23:03:35FromDiscord<4zv4l> Thanks for the help already
23:25:56*uics quit (Remote host closed the connection)
23:30:47FromDiscord<Phil> ElegantBeef I just may be straight up too dumb to find it.↵I'm going through the examples to figure out how you'd predefine a component and then use it in the view method
23:31:51FromDiscord<Phil> Really minimal example, e.g. let's say I want a submit button.↵I want to define that thing once and not rewrite it 50 times, how do I do that? Template? That feels like I'm putting myself at risk for bugs
23:32:06FromDiscord<Phil> (edit) "ElegantBeef I just may be straight up too dumb to find it.↵I'm going through the examples ... to" added "of owlkettle"
23:34:03FromDiscord<Elegantbeef> You make a new viewable then use `Submit(...):`
23:34:16FromDiscord<Elegantbeef> I'll make an example in a few
23:35:48*uics joined #nim
23:55:02*uics left #nim (#nim)