<< 04-01-2022 >>

00:12:21FromDiscord<evoalg> In reply to @hmmm "I have the photo": Does your lover know about this?
00:15:37*noeontheend quit (Ping timeout: 240 seconds)
00:17:00FromDiscord<hmmm> In reply to @evoalg "Does your lover know": of course! I'll show you her in #offtopic
00:21:32FromDiscord<evoalg> In reply to @IsaacPaul "use a consistent naming": I use that `return` for early exit in proc's all the time (if I'm understanding what you're saying correctly) as I don't like lots of nesting, but I've been told by some of the guru's that it's not recommended, and that I should use the built in result, and also only have one exit point so that the compiler can optimize it more easily ... or something like that ... but I still like to be
00:23:51FromDiscord<IsaacPaul> I always prioritize readability over optimization
00:24:40FromDiscord<IsaacPaul> Also that information could easily be outdated or become outdated
00:25:21FromDiscord<congusbongus> I have not heard of single exit point being more optimal before; sounds like out-of-date info from when compilers/processors were much less smart
00:26:30FromDiscord<congusbongus> it is less readable however if you have random exits scattered throughout the function, but you can avoid that by placing early exits at the start, or having sensible helper functions
00:29:16FromDiscord<Elegantbeef> Shun evo shun evo!↵(@evoalg)
00:30:10FromDiscord<evoalg> I know, I'm naughty and I have no guilt 😉
00:31:59FromDiscord<Elegantbeef> Uhhh do i start calling you an aussie until you change your ways?
00:32:22FromDiscord<evoalg> I repent, I repent
00:33:33FromDiscord<hmmm> Beefy~sama, I found one of your creations in the forum with a handy arrow to expand a seq in a proc call
00:34:13FromDiscord<evoalg> it's as bad as me asking you where abouts in the US you are, as you all sound the same to me 😉 ... except when you say "out"
00:34:27FromDiscord<Elegantbeef> Or when i say sorry
00:34:32FromDiscord<evoalg> LOL
00:34:44FromDiscord<hmmm> it worked in a test example but it died in the place where I wanted to use it 😦
00:34:49FromDiscord<Elegantbeef> Those dumb yanks tend to say sau-ri instead of sore-y
00:34:57FromDiscord<hmmm> such is life 🤔
00:35:17FromDiscord<Elegantbeef> Eh it was probably an example not a proper use case
00:35:41FromDiscord<hmmm> yea it I used like a blackbox, no idea on how it worked
00:39:10FromDiscord<Elegantbeef> Macros arent overly complicated so i beliieve in you
00:39:14FromDiscord<Elegantbeef> What're you trying to do anyway?
00:41:01*lumo_e quit (Read error: Connection reset by peer)
00:41:11*lumo_e joined #nim
00:45:25FromDiscord<hmmm> hmmm feeding a variable number of question marks to a prepared sql statement proc was my latest understanding of what I was doing lol
00:46:25FromDiscord<hmmm> I think I was doing it because normal exec inserts were too slow but I'm now not so sure
00:47:19FromDiscord<Elegantbeef> If only one could profile code!
00:47:33FromDiscord<hmmm> haha but that would be cheating 😃
00:48:02FromDiscord<Elegantbeef> Yea it'd show you where the slowdown was
00:48:41FromDiscord<hmmm> ok next time 4 sure, I'm going to sleep now, happy coding beefy
00:54:03*dtomato quit (Ping timeout: 256 seconds)
00:55:07FromDiscord<evoalg> I want to know how much mem some vars are taking, but when I do, eg, `sizeof("f")` it saying it's 16, and when I do `sizeof("foo")` it still says 16, so I guess sizeof isn't what I'm after?
00:57:42FromDiscord<Elegantbeef> I mean it is it's telling you the `sizeof(string)` which is `16`
00:58:06FromDiscord<evoalg> but wouldn't longer strings take more?
00:58:34FromDiscord<evoalg> oh I think I see what you mean
00:58:47FromDiscord<Elegantbeef> The type `string` is 16 bytes large
00:59:02FromDiscord<evoalg> then for "foo" do I times by 3?
00:59:03FromDiscord<Elegantbeef> If you want to see the size the string takes overall you use \`len
01:00:07FromDiscord<evoalg> `sizeof(string) "foo".len` ?
01:00:30FromDiscord<Elegantbeef> No
01:00:53FromDiscord<Elegantbeef> `"foo".len` tells you the amount of data, so it'd be `"foo".len + sizeof(string)` for the total memory usage
01:01:07FromDiscord<Elegantbeef> and it'd actually be different since `len` isnt the capacity
01:01:07FromDiscord<evoalg> ohhhhhh!
01:02:07FromDiscord<Elegantbeef> You cannot get how much a variable occupies unless the type exposes it/you know how it works
01:04:19FromDiscord<evoalg> ok ... so if I write a small program using bitty and another one that uses bool's, I could do some calculations to see how much I'm saving ... but how would I see how much mem each executable is using? Is it easy?
01:04:45FromDiscord<evoalg> I don't need this, just being curious
01:05:14FromDiscord<Elegantbeef> `/usr/bin/time -v youProgram` iirc does show memory usage
01:15:11*Gustavo6046 quit (Read error: Connection reset by peer)
01:18:10FromDiscord<creikey> sent a code paste, see https://play.nim-lang.org/#ix=3KVf
01:18:15FromDiscord<creikey> (edit) "https://play.nim-lang.org/#ix=3KVf" => "https://paste.rs/Dy7"
01:19:48*Gustavo6046 joined #nim
01:19:55FromDiscord<exelotl> It should be allowed
01:20:35FromDiscord<exelotl> Oh, maybe because staticRead has to occur in a static context?
01:21:16FromDiscord<creikey> In reply to @exelotl "Oh, maybe because staticRead": this is the error yeah
01:22:30FromDiscord<exelotl> sent a code paste, see https://play.nim-lang.org/#ix=3KVh
01:23:27FromDiscord<Elegantbeef> Does `echotest( (const s = staticRead(); s))` work?
01:23:49FromDiscord<exelotl> It should do
01:23:53*krux02 quit (Remote host closed the connection)
01:23:53FromDiscord<creikey> In reply to @exelotl "So you'd have to": is there like a static string I can specify as the parameter for overloading
01:23:57*lumo_e quit (Quit: Quit)
01:24:13FromDiscord<Elegantbeef> yes
01:24:15FromDiscord<creikey> lol yeah what
01:24:19FromDiscord<Elegantbeef> `text: static string`
01:24:25FromDiscord<creikey> sent a code paste, see https://play.nim-lang.org/#ix=3KVi
01:24:25FromDiscord<Elegantbeef> It's legitmately what you asked 😀
01:24:49FromDiscord<Elegantbeef> no real point making a template imo, but you do you
01:25:24FromDiscord<exelotl> If you wanted to allow both static and non-static, maybe `proc echoText(text: string|static[string])` would work?
01:25:38FromDiscord<Elegantbeef> It would
01:26:10FromDiscord<creikey> In reply to @Elegantbeef "no real point making": I have no idea what's going on here
01:26:12FromDiscord<Elegantbeef> Worth noting that `static T` turns it into a generic procedure
01:26:23FromDiscord<creikey> In reply to @exelotl "If you wanted to": you can or types like that?? so cool
01:26:40FromDiscord<Elegantbeef> Dont join the `|` club
01:26:44FromDiscord<Elegantbeef> 😛
01:26:51FromDiscord<creikey> does static[string] like upgrade to string
01:27:21FromDiscord<Elegantbeef> `static T` is an implicit generic and all uses of that parameter are replaced with the constant
01:27:24FromDiscord<creikey> so like if just static[string] is taken as a parameter can it also take string
01:27:50FromDiscord<Elegantbeef> No `static string` is forced at compile time to be from static
01:27:59FromDiscord<exelotl> Static means the value is known at compile time
01:28:16FromDiscord<creikey> I see
01:28:26FromDiscord<creikey> and strings are like dynamically resizable and mutable in nim right
01:28:38FromDiscord<Elegantbeef> Yes
01:28:43FromDiscord<creikey> so that's why
01:29:02FromDiscord<Elegantbeef> `static string` are constants at runtime
01:30:26FromDiscord<exelotl> In reply to @creikey "and strings are like": Yes but only if its a `var` variable or `var` parameter
01:35:28FromDiscord<creikey> In reply to @exelotl "Yes but only if": so if it's not a var string parameter can't it be assumed that static strings be safely passed to a function?
01:35:37FromDiscord<creikey> what can a `string` parameter do that a `static[string]` parameter can't
01:36:18FromDiscord<Elegantbeef> I mean static string can be passed to string
01:36:20FromDiscord<Elegantbeef> That's not the issue
01:37:28FromDiscord<Elegantbeef> The issue is that `staticRead` needs a compile time environment to run and it doesnt have that when you call it inside a call
01:38:09FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3KVn
01:40:02FromDiscord<exelotl> I find the error surprising tbh. Like why can't it just be equivalent to your `(const c = staticRead(...); c)`
01:41:21FromDiscord<evoalg> don't confuse me ... yesterday I was told that `let` is evaluated at runtime not compiletime
01:41:33FromDiscord<Elegantbeef> It is
01:41:59FromDiscord<Elegantbeef> Well i mean exelotl the proc is annotated `{.compiletime.}` so implicit usage of it is bad im
01:42:35FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3KVo
01:42:39FromDiscord<Elegantbeef> Since it's not forced to run at CT
01:44:17FromDiscord<Elegantbeef> The benefit of using a proc over a template here is if you read the file multiple times only a single constant is in the program
01:46:29FromDiscord<creikey> Is there a way to construct explicitly typed array literals, like `array[int64]([1, 2, 3, 4])` or something
01:47:05FromDiscord<Elegantbeef> `[1i64, 2, 3, 4]`
01:49:39FromDiscord<creikey> In reply to @Elegantbeef "`[1i64, 2, 3, 4]`": thanks that's cool that that works
01:56:07FromDiscord<evoalg> In reply to @Elegantbeef "Dont join the `|`": why isn't this such a good idea?
01:56:22FromDiscord<Elegantbeef> It's fine it's up to what you prefer
01:56:24FromDiscord<Elegantbeef> I prefer `x or y`
01:56:48FromDiscord<evoalg> oh yea ... that's nicer imo
02:03:41*Lord_Nightmare quit (Ping timeout: 245 seconds)
02:24:25FromDiscord<Gorylek😚> Hello
02:24:28FromDiscord<Gorylek😚> Im new
02:26:57FromDiscord<Elegantbeef> Hello
02:33:58*neurocyte0 joined #nim
02:35:57*neurocyte quit (Ping timeout: 240 seconds)
02:35:57*neurocyte0 is now known as neurocyte
02:37:24FromDiscord<huantian> hello o/
02:47:44FromDiscord<Rika> hello new
03:13:38*arkurious quit (Quit: Leaving)
03:21:42FromDiscord<sOkam!> In reply to @Elegantbeef "I prefer `x or": or prefer `x | y`
03:22:04FromDiscord<sOkam!> hope you get the silly joke, otherwise its gonna look confusing 🙈
03:41:31FromDiscord<huantian> is there something similar to python's asyncio gather for running a bunch of async functions concurrently?↵Ideally with a max currenency
03:45:40FromDiscord<Rika> In reply to @huantian "is there something similar": “all”? In asyncdispatch I think
03:47:17FromDiscord<huantian> I see all in asyncfutures
03:47:31FromDiscord<huantian> but not sure if that's concurrent?
03:48:32FromDiscord<huantian> I think it is?
03:49:04FromDiscord<huantian> wait futures "start" happening as soon as they're made not when they're awaited so ig it is
03:53:00FromDiscord<Rika> as soon as theyre made until the first yield
04:10:25*noeontheend joined #nim
04:29:59*rockcavera quit (Remote host closed the connection)
04:47:40FromDiscord<creikey> is nim js gonna be abandoned for its C backend -> webassembly?
04:59:51FromDiscord<Rika> Probably not?
05:45:12FromDiscord<Hamid_Bluri> sent a code paste, see https://play.nim-lang.org/#ix=3KWp
05:45:29FromDiscord<Hamid_Bluri> sent a code paste, see https://play.nim-lang.org/#ix=
05:47:08FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3KWr
05:47:47FromDiscord<Hamid_Bluri> thanks beef
05:47:54FromDiscord<Hamid_Bluri> you're my hero : D
05:48:05FromDiscord<Elegantbeef> Worth noting though that'll work on all arrays 😀
05:48:14FromDiscord<Elegantbeef> since arrays implicitly get a range as their first generic parameter
05:48:17FromDiscord<Hamid_Bluri> good
05:48:35FromDiscord<Elegantbeef> You dont really need a constraint
05:48:40FromDiscord<Hamid_Bluri> why
05:48:50FromDiscord<Elegantbeef> `[idx, T]` would work just fine
05:48:55FromDiscord<Elegantbeef> Cause array already is constrained
05:49:07FromDiscord<Hamid_Bluri> you're right
06:05:43*perro_ quit (Ping timeout: 256 seconds)
06:29:48*perro_ joined #nim
06:47:57*noeontheend quit (Ping timeout: 240 seconds)
07:04:37NimEventerNew thread by Oyster: 2 questions on json mudule, see https://forum.nim-lang.org/t/8768
07:05:35PMunchHmm, it would be nice to have a block pragma. It would be able to attach to tings that already create a scope, like if, when, for, etc. and name the block so it could be broken out of
07:07:48FromDiscord<Elegantbeef> I feel like there isnt an ergonomic way of doing that
07:09:10PMunchI was thinking something like this: https://play.nim-lang.org/#ix=3KWN
07:09:38FromDiscord<Elegantbeef> I rest my case 😛
07:11:02FromDiscord<Elegantbeef> I'd say since they already create scope perhaps `break if` that goes up to the first `if` it encounters
07:11:43PMunchWell sure, but I'm basically trying to early-return from something that isn't a proc
07:12:03PMunchAnd I don't want to indent my code an extra level to have a block there
07:12:41FromDiscord<Elegantbeef> Hmmm can i see code?
07:13:35FromDiscord<Elegantbeef> Clearly it should be `if(scopeLabel) condition`
07:14:24PMunchI was able to do something similar with a template `blockIf`
07:14:47PMunchWhich looks like this: http://ix.io/3KWP
07:15:30PMunchAnd the code then looks like this: http://ix.io/3KWQ
07:16:20PMunchI agree that `if(scopeLabel) condition` would look better though
07:16:40PMunchBut I don't think that could be done with a macro..
07:17:31FromDiscord<Elegantbeef> No it cannot
07:18:04PMunchAnd my template solution will only work for the things I would write a block-variant of
07:18:12PMunchAnd it can't work for e.g. else
07:19:24PMunchUnfortunately I can't simply add a `block X:` on the same line because it complains about requiring indentation
07:19:27FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3KWS
07:19:39FromDiscord<Elegantbeef> I mean you could if you abused stmtlists
07:19:52PMunchCould you though?
07:20:10PMunchHow would you be able to grab the following scope?
07:20:44FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3KWU
07:20:45FromDiscord<Elegantbeef> That works
07:23:11PMunchHmm, that's true..
07:24:02FromDiscord<geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3KWV
07:24:14PMunchMaybe what we need is a "treat this as indented one level further" operator
07:24:16FromDiscord<geekrelief> I think the issue is the double for block and body for if
07:24:32FromDiscord<geekrelief> you need the parens to separate them
07:24:33PMunche.g. https://play.nim-lang.org/#ix=3KWW
07:25:19FromDiscord<Elegantbeef> Well geek yours doesnt work for `if elif`
07:27:41FromDiscord<geekrelief> In reply to @Elegantbeef "Well geek yours doesnt": What do you mean?
07:27:42FromDiscord<geekrelief> https://play.nim-lang.org/#ix=3KWX
07:28:13FromDiscord<Elegantbeef> I meant if you wanted a named branch for each `if`/`elif`
07:30:29FromDiscord<geekrelief> do you have an example?
07:30:41NimEventerNew thread by GordonBGood: Anyone written an Android app using Nim-generated Native code lately?, see https://forum.nim-lang.org/t/8769
07:30:58FromDiscord<yallxe> how can i pass `size` as a mutable var into buffer.read()? https://media.discordapp.net/attachments/371759389889003532/927826424881090610/unknown.png
07:31:27FromDiscord<yallxe> the issue is that buffer.read() accepts `var T` only
07:31:49FromDiscord<yallxe> but mine isn't var and how do i just create a copy of size and make it var?
07:34:34PMunchvar varSize = size; buffer.read(varSize)
07:49:19PMunchHmm, anyone know how to cross compile to rasperry pi?
07:49:47FromDiscord<Elegantbeef> If it's a pico yes 😛
07:51:09PMunchIt can't be easier to cross-compile for a Pico :P
07:51:19PMunchI know I've done this before, I just don't remember how
07:52:32*jjido joined #nim
07:58:16FromDiscord<impbox [ftsf]> PMunch, I think i had most luck just doing it on device
07:58:32FromDiscord<impbox [ftsf]> what are you cross compiling from?
07:59:41PMunchA normal Linux machine
08:00:01PMunchArch based if it matters
08:00:25FromDiscord<impbox [ftsf]> encountering issues?
08:01:30PMunchHaven't tried anything yet
08:16:09*dtomato joined #nim
08:17:41*Gustavo6046 quit (Quit: Leaving)
08:21:57*vicecea quit (Remote host closed the connection)
08:22:27*vicecea joined #nim
08:42:00*dtomato quit (Read error: Connection reset by peer)
08:42:14*dtomato joined #nim
08:46:45FromDiscord<Isofruit> I kinda wish nim had interfaces right now
08:47:03PMunchWhat problem are you trying to solve?
08:47:36FromDiscord<Isofruit> This is more a design question than anything.↵I'm currently having a small discussion with the beautiful person that maintains norm (which I'm really liking so far)
08:47:40PMunchHmm, for some reason pakku isn't able to find an AUR library..
08:48:11FromDiscord<Isofruit> They have an object "Model" and something like "ReadOnlyModel" is about to be added (And chances are in the future something like "View" will also be added)
08:48:49FromDiscord<Isofruit> (edit) ""View"" => ""ViewModels""
08:48:52FromDiscord<Isofruit> Models are supposed to have full CRUD functionality on the database, ReadOnlyModel should, well, only Read.↵ViewModels should also have full CRUD functionality
08:49:52FromDiscord<Isofruit> You could inherit `Model = ref type of ReadOnlyModel`, but the naming doesn't suit that since ReadOnlyModel, by its name, would make more intuitive sense that it inherits from Model
08:50:40FromDiscord<Isofruit> When all you'd really want is for the select/update/delete/insert methods to check at compile time "Does this object have the ability to select/update/delete/insert"
08:50:59FromDiscord<Elegantbeef> So concepts
08:53:38*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
08:54:30PMunchIs it just me, or are descriptions on YouTube videos in the browser broken?
08:54:44PMunchThey seem to only have a small part of them shown, with no expand button..
09:04:03FromDiscord<Clonkk> Can a macro argument be used in a const expression ?
09:04:37FromDiscord<Elegantbeef> I dont think so, but i think it should
09:04:55FromDiscord<Clonkk> That'd be useful
09:05:41FromDiscord<Elegantbeef> Indeed
09:06:38PMunchWhat do you mean @Clonkk?
09:07:17FromDiscord<Elegantbeef> Doing something like `macro doThing(a: static int) = var a: array[a, int]` i think
09:12:12FromDiscord<Clonkk> For example↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
09:12:44FromDiscord<Clonkk> `macro loadRessources(dirname: static string) = const res = staticExec("ls " & " dirname)`
09:12:55FromDiscord<Clonkk> To embed ressources in a binary at compile time
09:13:17FromDiscord<Clonkk> For a single file it's easy enough, but recursing through a directory at compile times proves annoying
09:16:17FromDiscord<Clonkk> Ultimately I want to call `staticRead` on the result
09:16:53FromDiscord<Elegantbeef> You can make a proc that does as such
09:17:44FromDiscord<Clonkk> A proc that iterate through directory at compile-time from a static string ?
09:18:02FromDiscord<Clonkk> The ressources are needed during run time
09:18:59FromDiscord<Elegantbeef> Ah nvm you have to do it with the macro output
09:24:45PMunchI do something similar in my autotemplates thingy: https://github.com/PMunch/autotemplate/blob/master/src/autotemplates.nim#L10
09:25:45PMunchThere you can see the `const rawIdent = content` thing which is the raw content of the file
09:25:52FromDiscord<Solitude> In reply to @PMunch "Hmm, for some reason": pakku is abandoned and broken, is it not?
09:26:05PMunchHas been working fine up until now
09:53:32FromDiscord<SirOlaf> Has the net module broken on latest devel?
09:53:59FromDiscord<Elegantbeef> More information is needed
09:55:05FromDiscord<SirOlaf> sent a code paste, see https://paste.rs/82d
09:59:30FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3KXy
09:59:40FromDiscord<Elegantbeef> Oh latest devel
09:59:49FromDiscord<Elegantbeef> I'm blind
10:00:23FromDiscord<Elegantbeef> Yep you're right
10:00:40FromDiscord<SirOlaf> That's not great to say the least
10:03:46FromDiscord<Elegantbeef> Indeed
10:03:52FromDiscord<Elegantbeef> Atleast it hasnt been changed much so shouldnt be hard to find what caused it
10:04:00FromDiscord<Rika> It’s devel, I wouldn’t rely on it
10:04:16FromDiscord<Elegantbeef> Yea devel isnt supposed to be stable 😛
10:05:24FromDiscord<SirOlaf> Of course not, I just like switching things around for more excitement sometimes
10:05:50FromDiscord<Rika> Well congrats on getting that excitement
10:23:33FromDiscord<Isofruit> Are gifs allowed to be posted in this channel?
10:24:52PMunchAs long as they're on topic, sure
10:25:08FromDiscord<Isofruit> In reply to @SirOlaf "Of course not, I": https://tenor.com/view/austin-powers-dangerously-gif-20939086
10:25:35FromDiscord<Isofruit> ... The fact this isn't resolving into the gif properly makes me sad, but the URL name at least tells what it is
10:25:40FromDiscord<Solitude> dont click, its a virus
10:26:42FromDiscord<Isofruit> I'm not sure if this is a joke or if tenor is known for spreading virusses and I'm not aware
10:27:40FromDiscord<Isofruit> Changed the URL to the proper URL to the gif... which also doesn't resolve+
10:27:48FromDiscord<Isofruit> (edit) "resolve+" => "resolve. Oh well"
10:28:03PMunchIronically the gif works on IRC :P
10:28:22FromDiscord<Isofruit> IRC > Discord ! I knew it!
10:28:36PMunchHuh?
10:29:41FromDiscord<SirOlaf> https://github.com/nim-lang/Nim/commit/4b5cecd902cc4126ff9d6cda9edb78a13a421239 This commit killed me
10:29:45FromDiscord<Isofruit> Ah, I was just trying to be funny, stating IRC is superior to discord solely because of the gif thing.
10:29:56FromDiscord<SirOlaf> In reply to @SirOlaf "https://github.com/nim-lang/Nim/commit/4b5cecd902cc": Compiled the compiler with the commit right before and then this one
10:30:46PMunchAh, you actually used > as greater than and not an arrow :P
10:43:17FromDiscord<hmmm> apparently if you wrap your sqlite calls in transactions you go from 85 insertions per second to 23000 ips
10:43:30FromDiscord<hmmm> software is mysterious 🤔
10:44:55FromDiscord<Isofruit> Makes sense to me
10:51:20FromDiscord<SirOlaf> sent a code paste, see https://paste.rs/mfQ
10:51:25FromDiscord<SirOlaf> Was there a change with how . casts are handled or something
10:51:51FromDiscord<SirOlaf> Or is this related to the fact that it is untyped
10:54:09FromDiscord<Yardanico> In reply to @SirOlaf "So, on my devel": It's better if you open an issue anyway, as it might be a real problem with that PR
10:54:26FromDiscord<Elegantbeef> Probably untyped issue `SockLen(sizeof(sockaddress))` is proper
10:54:54FromDiscord<Elegantbeef> Needs `bind SockLen` before i think
10:55:21FromDiscord<SirOlaf> You're right, `SockLen(sizeof(sockaddress))` works too
10:56:42FromDiscord<SirOlaf> In reply to @Yardanico "It's better if you": Would the issue just be incorrect cast syntax in net.nim?
11:11:14*tinytoas1 joined #nim
11:12:21FromDiscord<SirOlaf> Opened one. At least this finally gave me an excuse to play with the compiler for a bit
11:12:56*tinytoast quit (Read error: Connection reset by peer)
11:45:20*tinytoas1 is now known as tinystoat
12:37:06FromDiscord<Smarc> In reply to @IsaacPaul "use a consistent naming": I appreciate your insights, but I dont really understand the `if paramCount() > 0:` part .. What exactly is incorrect or bad practice there?
12:38:48*badsektor joined #nim
12:38:48*badsektor quit (Client Quit)
12:42:42FromDiscord<Rika> Having it there
12:43:57FromDiscord<Smarc> Could you elaborate?
12:44:20FromDiscord<Rika> I just read your code, I don’t know what he means either
12:44:54FromDiscord<Rika> Maybe put the when check around the if statement instead of inside the else
12:49:08FromDiscord<Smarc> hm, guess that makes sense. Thank you
12:58:11FromDiscord<yallxe> how do I define that field can be `nil` in object? https://media.discordapp.net/attachments/371759389889003532/927908771882233896/unknown.png
12:58:37FromDiscord<Solitude> do you really need to? `ref whatever`
12:59:16FromDiscord<yallxe> In reply to @Solitude "do you really need": well yes i do
13:01:53FromDiscord<hmmm> hey if I have a proc that returns a string and I use a branch to return "false" and check for it in another proc am I committing a grave sin against the gods? Should I use options? 🤔
13:03:21FromDiscord<hmmm> options are ugly but checking for false in a string seems ugly too so I am in an ugly / ugly situation
13:04:18FromDiscord<Yardanico> In reply to @yallxe "well yes i do": if you to check if that type exists or not you can use Option
13:07:03FromDiscord<planetis> Hmmm either return a tuple string, bool or an empty string if you can
13:07:53FromDiscord<planetis> Or return a bool and use a var string parameter
13:09:16FromDiscord<enthus1ast> there was a "better options" or "safer options" in nimble but i cannot find it.
13:10:41FromDiscord<enthus1ast> ah no, it was PMunch'/nim-optionsutils
13:11:00FromDiscord<enthus1ast> https://github.com/PMunch/nim-optionsutils
13:12:25FromDiscord<hmmm> documentation for optionsutils seems broken
13:12:46PMunchBroken how?
13:12:59FromDiscord<hmmm> I click the link and there is an empty page
13:13:15PMunchAnd @hmmm, any checking against the values of strings for anything but parsing is a sin in my book :P
13:13:34FromDiscord<Rosen> also dead page for me I think
13:13:53FromDiscord<hmmm> In reply to @PMunch "And <@887269570765791243>, any checking": haha deep down I thought it was something a good principled boi wouldn't do
13:14:09FromDiscord<hmmm> so we must find a way that is less painful than options
13:14:57FromDiscord<enthus1ast> another option is to have a proc like this\:
13:15:07FromDiscord<hmmm> the tuple idea of planetis is kinda nice, can I do something like return (result : string, check : bool) packed into a tuple?
13:15:29FromDiscord<enthus1ast> `proc doStuff(myStr: var string): bool =`
13:15:40FromDiscord<enthus1ast> then if doStuff is true, use the myStr
13:15:47*rockcavera joined #nim
13:15:47*rockcavera quit (Changing host)
13:15:47*rockcavera joined #nim
13:15:55FromDiscord<enthus1ast> much c like
13:16:06FromDiscord<hmmm> nu myStr gets calculated inside the proc
13:16:14PMunchHmm, seems to be a problem with the nimble directory..
13:16:22PMunchYou can always generate the docs yourself
13:16:30PMunchOr just read them as doc-comments on GitHub
13:16:34FromDiscord<planetis> Just (string, bool) otherwise you're reinventing options
13:17:10PMunchIsn't (string, bool) already reinventing options?
13:17:59FromDiscord<hmmm> so the checker proc takes the tuple, checks for the bool and if it's good uses the string? Seems kinda nice, why am I feeling most of the people don't do it this way?
13:19:59PMunchBecause most people uses options, which provides the exact same thing
13:20:04FromDiscord<enthus1ast> imho the reason is to keep track which proc actually changes the input string
13:21:12FromDiscord<enthus1ast> this sometimes gets very hairy in a c program
13:23:17FromDiscord<hmmm> hmm ok it's decided I will use options, I'd like to check if optionsutils shaves off some hassle, how do I check the docs pmunchie?
13:23:53*jjido joined #nim
13:24:25PMunchYou know that every time you add an e to the end of my nickname I don't get pinged right? If you type it out like it is it's easier for me to notice your message :)
13:24:43PMunchYou can either just read the doc comment here: https://github.com/PMunch/nim-optionsutils/blob/master/src/optionsutils.nim
13:25:01PMunchOr you can run `nim doc` on that file and open the html output
13:25:09FromDiscord<hmmm> but I don't want to disturb your big brain 😃 , anyway yea I'm inside the nim file now ty!
13:35:18FromDiscord<hmmm> 👀
13:35:48FromDiscord<hmmm> with optionutlis i can do something like found?.doStuff() and it will do stuff only if it's some?
13:36:05PMunchYup, that's the idea
13:36:13FromDiscord<hmmm> 👀
13:36:28FromDiscord<hmmm> this might be the confiest thing ever
13:36:35FromDiscord<hmmm> brb installing
13:39:05FromDiscord<hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3KZk
13:39:16FromDiscord<Yardanico> these warnings have been around since forever
13:39:29FromDiscord<Yardanico> and not everyone agrees with the directory structure nimble wants your project to have
13:40:30PMunchI mean this library literally exposes two modules, both which are fine to import separately
13:40:38PMunchSo any other structure wouldn't make sense
13:49:49PMunch@Solitude, do you know of an AUR wrapper that is actually up to date and working?
13:54:35PMunchHmm, apparently I was using pakku-git from AUR, which is a maintained fork
13:55:02PMunchBut for some reason it's not able to find this package https://aur.archlinux.org/packages/arm-linux-gnueabihf-gcc-stage2
13:56:29*badsektor joined #nim
14:05:20*badsektor quit (Quit: Leaving)
14:18:13FromDiscord<Michal Maršálek> Is it possible to have different definitions for a type based on a generics parameter? I can achieve something similar with a template that returns `typedesc` but is it possible to achieve with the standard type system and the standard `[]`?
14:20:22FromDiscord<konsumlamm> you can use `when` in your type definition
14:20:36FromDiscord<Michal Maršálek> How? I tried it
14:21:03FromDiscord<Michal Maršálek> (edit) "it" => "`type MyType[T:static int] = (when T == 1: int else: array[T,int])`"
14:21:50FromDiscord<konsumlamm> ah, so you just want a type alias rather than a new type?
14:21:58FromDiscord<Michal Maršálek> (edit) "How? I tried `type MyType[T:static int] = (when T == 1: int else: array[T,int])`" => "sent a code paste, see https://play.nim-lang.org/#ix=3KZO"
14:22:21FromDiscord<Michal Maršálek> (edit) "https://play.nim-lang.org/#ix=3KZO" => "https://play.nim-lang.org/#ix=3KZP"
14:23:39FromDiscord<konsumlamm> not sure what the error for your code means or wether it's intended
14:23:56FromDiscord<Michal Maršálek> I don't know what the real difference is but semantically it should be a new type... but `distinct` would suffice but it doesn't owkr either
14:24:09FromDiscord<Michal Maršálek> (edit) removed "but"
14:24:46FromDiscord<Michal Maršálek> (edit) "owkr" => "work"
14:25:13FromDiscord<haxscramper> you can't put `when` in the type alias definition, you can only do it using `object`
14:25:45FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3KZQ
14:26:25FromDiscord<Michal Maršálek> Is object with a single field more expensive than a type alias?
14:27:16FromDiscord<haxscramper> define "expensive". Purely from performance reasons it should not affect anything
14:27:29FromDiscord<Michal Maršálek> memory?
14:27:52FromDiscord<Michal Maršálek> I mean does it lead to the same (similar) binary?
14:28:17FromDiscord<haxscramper> if you get too fancy with `when` sections field padding might work out differently, but ultimately this should not be a problem with a single field
14:28:25FromDiscord<haxscramper> the question is whether you really need this
14:28:54FromDiscord<Michal Maršálek> In reply to @haxscramper "the question is whether": Yeah it this is always the question
14:28:55FromDiscord<haxscramper> `array[1, int]` takes the same amount of space as `int`
14:29:15FromDiscord<haxscramper> or similar amount of space
14:29:15FromDiscord<Michal Maršálek> In reply to @haxscramper "`array[1, int]` takes the": that was just a simple example this is not what I want to use it for
14:30:09FromDiscord<el__maco> an int doesn't have to allocate memory at all however. Its a good question if the compiler can reason about array[1,int] in a similar way
14:30:34FromDiscord<haxscramper> `array` is on-stack, by-value type
14:31:12FromDiscord<haxscramper> `seq` might've been done differently, with things live short vector optimization, but in case of array there are no hidden semantics
14:31:13FromDiscord<Michal Maršálek> Thank you everyone, I will use òbject`. 🙂
14:31:35FromDiscord<el__maco> a local variable can be on stack or it can exist in machine registers
14:37:02*arkurious joined #nim
14:48:52*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
15:38:17*drewr joined #nim
15:44:44*Lord_Nightmare joined #nim
15:50:06FromDiscord<Smarc> What would be the best practice approach to delete a single line from a txt file?
15:53:39FromDiscord<Rika> where is the line located
15:54:07FromDiscord<Smarc> It is a txt file with several lines
15:54:36FromDiscord<Rika> if its in the start or middle it's bound to be slow i believe
15:54:42FromDiscord<Rika> at the end is idea'
15:54:43FromDiscord<Rika> (edit) "idea'" => "ideal"
15:55:16FromDiscord<Smarc> In most cases it would be in the middle I guess. But I think speed does not play that big a role, since the file won't be that huge
15:56:49*rockcavera quit (Read error: Connection reset by peer)
15:57:39*rockcavera joined #nim
15:57:39*rockcavera quit (Changing host)
15:57:39*rockcavera joined #nim
15:57:54FromDiscord<Rika> the "basic algo" is prolly this↵find the \n before the line you want to delete↵find \n after that↵replace the whole range with one \n
15:59:27FromDiscord<Smarc> Is there a built-in proc to replace in a file?
15:59:53FromDiscord<Rika> not that i know of
16:00:02FromDiscord<Smarc> Alright, thank you
16:01:33FromDiscord<el__maco> can't you just open the file, read lines except the one you wanted to delete, and then write back
16:02:25*Lord_Nightmare quit (Ping timeout: 256 seconds)
16:03:18*Vladar joined #nim
16:03:43FromDiscord<Yardanico> that's not really efficient
16:03:47FromDiscord<Yardanico> imagine a file with 150 million lines
16:04:40FromDiscord<el__maco> in which way its not efficient I wonder
16:04:52FromDiscord<el__maco> either you read the entire file to memory, or you don't
16:05:03FromDiscord<Yardanico> you don't have to read the entire file to delete a line
16:05:07FromDiscord<el__maco> if you don't, you probably write the lines as you read them to another file
16:05:09FromDiscord<demotomohiro> Open the file for reading, open temporary file for writing, read each lines and only write a line you want to temporary file. If write to temp file success, delete source file and rename temp file to souece file.
16:05:13FromDiscord<Yardanico> i mean read as in read the lines into memory
16:05:37FromDiscord<Yardanico> i think there was an example of this
16:06:46FromDiscord<Yardanico> oh guess there's no other way, i'm wrong then
16:08:43FromDiscord<el__maco> what isn't efficient is reading the whole file in memory as a continuous block and then removing something at the middle. That's why I suggested reading one line at a time. Of course you can write to another file as you go or alternatively replace the original file after you read all lines to memory
16:09:36FromDiscord<Rika> dont you have to shift everything else after "deleting"
16:10:09FromDiscord<Rika> oh
16:10:12FromDiscord<Rika> i misunderstood
16:10:20FromDiscord<Rika> yeah i dont think im reading correctly today
16:15:26*bkay quit (Ping timeout: 260 seconds)
16:17:17*beshr joined #nim
16:24:31FromDiscord<IsaacPaul> In reply to @Smarc "Is there a built-in": https://nim-lang.org/docs/memfiles.html has a `lines` iterator. You're going to want to stream a copy to another file, skip the line you don't want, then delete / rename when you're done.
16:26:55FromDiscord<IsaacPaul> There's a more efficient way that doesn't create a string for each line unless you need to analyze the lines to determine which to remove.
16:27:47FromDiscord<IsaacPaul> Or does it create a string 🤔 if it already exists in memory... not sure how nim string works
16:33:51*neurocyte quit (Read error: Connection reset by peer)
16:35:06*neurocyte0 joined #nim
16:35:55FromDiscord<Smarc> Thank all of you guy for your help, I'll try to accomplish what I wanted to and report back if I get stuck again :)
16:46:28*jjido joined #nim
16:50:57*drewr quit (Ping timeout: 240 seconds)
17:01:48*drewr joined #nim
17:04:28*dtomato quit (Quit: The Lounge - https://thelounge.chat)
17:05:04*Vladar quit (Quit: Leaving)
17:05:05*dtomato joined #nim
17:07:53*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
17:15:57*drewr quit (Ping timeout: 240 seconds)
17:26:34FromDiscord<Shiba> Is it possible to make a nim to computer language Compiler?, i mean if someone is gonna try that
17:27:48FromDiscord<Shiba> (edit) "Compiler?," => "Compiler? Just for fun,"
17:30:21PMunchWhat do you mean?
17:30:24FromDiscord<auxym> In reply to @Shiba "Is it possible to": Sure, I mean, in an "everything is possible" way
17:30:59FromDiscord<auxym> In reply to @PMunch "What do you mean?": I assume they mean writing a new backend for nim that emits native machine code instead of C?
17:32:04FromDiscord<konsumlamm> if you mean assembly by "computer language", it already is that, it just compiles to C inbetween
17:32:49FromDiscord<konsumlamm> there's not really any advantage of emitting machine code directly and it isn't a goal (though ofc you're free to write your own Nim backend)
17:34:54FromDiscord<Shiba> Iam already learning nim so iam still too far away from doing expirements such as this one
17:37:39NimEventerNew Nimble package! nimtesseract - A wrapper to Tesseract OCR library for Nim, see https://github.com/DavideGalilei/nimtesseract
17:37:55*neurocyte0 quit (Quit: The Lounge - https://thelounge.chat)
17:38:18FromDiscord<auxym> In reply to @Shiba "Iam already learning nim": That sort of project would be less about "Nim" and more about assembly and compiler theory.
17:39:14FromDiscord<Shiba> "Nim compiler Implemanted in Nim"
17:39:29FromDiscord<Clonkk> A classic exercise is to implement a brainfuck interpretrer↵(@Shiba)
17:39:34FromDiscord<auxym> the current nim compiler is already implemented in nim
17:39:54*neurocyte0 joined #nim
17:40:02FromDiscord<Clonkk> The language is simple enough that it doesn't become a huge project, but it stills shows you the different problematic of it
17:40:03FromDiscord<Shiba> In reply to @Clonkk "A classic exercise is": Oh yeah i made one in lua, now in Nim
17:47:40FromDiscord<0000> In reply to @NimEventer "New Nimble package! nimtesseract": cool
18:29:35FromDiscord<hmmm> In reply to @kaletaa "cool": yea I got it working on linux and it was spotless on my first example
18:30:00FromDiscord<hmmm> windows hates this stuff apparently so it didn't work
18:30:37FromDiscord<hmmm> I guess it doesn't work on pdfs tho
18:33:04*drewr joined #nim
18:42:03*drewr is now known as drewr-test
18:44:07*drewr-test is now known as drewr
18:45:02*fvs joined #nim
18:58:56*drewr quit (Quit: ERC (IRC client for Emacs 27.2))
19:10:41FromDiscord<ajusa> man I really wish Nim supported duplicated field names across object variants, I think folks have been asking for 7 years now? It always trips me up
19:31:20*vicfred joined #nim
19:32:17*drewr joined #nim
19:39:54*jjido joined #nim
19:52:29*rb quit (Ping timeout: 256 seconds)
19:52:32*rwb joined #nim
19:52:57*def- quit (Quit: -)
19:53:16*def- joined #nim
19:53:54FromDiscord<Smarc> sent a code paste, see https://play.nim-lang.org/#ix=3L1P
19:54:03FromDiscord<Smarc> Why is this deleting all lines in the given file?!
19:54:09*rwb is now known as rb
19:55:11FromDiscord<Smarc> It is supposed to just skip the entered filename and write every other line that is already in the file in the file again
20:04:25*rb quit (Remote host closed the connection)
20:05:53*rwb joined #nim
20:14:52FromDiscord<haxscramper> I"m not exactly sure if you can read and write to a file at the same time
20:15:28FromDiscord<Smarc> I figured that, so I adjusted it like that
20:15:38FromDiscord<Smarc> sent a code paste, see https://play.nim-lang.org/#ix=3L1T
20:16:32*Lord_Nightmare joined #nim
20:18:16FromDiscord<Smarc> with `f = open(StorageFile, fmRead)`
20:18:40FromDiscord<Smarc> At least it is not erasing the file anymore, but still not writing the lines I want to the temp file
20:37:02*Onionhammer quit (Quit: The Lounge - https://thelounge.chat)
20:37:10Amun-RaI'd go with openFileStream
20:37:49*Onionhammer joined #nim
20:43:39*rwb is now known as rb
20:51:19*noeontheend joined #nim
20:56:49nixfreaknim[m]is is possible to step though a nim program while compiling ?
21:00:17nixfreaknim[m]s/is/it/
21:04:14FromDiscord<kaddkaka> Right, I was meaning to ask, is it very annoying for people in bridged chats when I edit my messages in discord?
21:05:23FromDiscord<hmmm> they hate you silently 😃
21:05:26FromDiscord<leorize> yea, it doesn't translate well to irc
21:05:46FromDiscord<leorize> one or two edits right after posting should be fine
21:06:57FromDiscord<kaddkaka> I will try to minimize it, I'm VERY good at typos 😵‍💫
21:08:25FromDiscord<hmmm> tbh I was in the irc camp but I had to swallow the sour pill: discord makes easier to follow conversations. So since they are on the wrong side of history they shouldnt't mind the edits imo 😏
21:09:18FromDiscord<haxscramper> you can see how your edits look on the IRC side in https://irclogs.nim-lang.org/
21:22:55FromDiscord<auxym> In reply to @nixfreaknim "is is possible to": do you mean debugging? why "when compiling"? https://nim-lang.org/blog/2017/10/02/documenting-profiling-and-debugging-nim-code.html
21:26:07FromDiscord<kaddkaka> In reply to @auxym "do you mean debugging?": Since so much can happen at compile time in Nim, I would suspect it makes sense to not just debug exec_runtime but also compile_time
21:43:25FromDiscord<krisppurg> sent a long message, see http://ix.io/3L2d
21:49:20FromDiscord<Solitude> In reply to @krisppurg "Hi, I have a": why not make it a single `changes` table that stores tuple or something?
21:50:24FromDiscord<krisppurg> it's much easier with `before` and `after`.
21:52:30FromDiscord<krisppurg> sent a code paste, see https://play.nim-lang.org/#ix=3L2f
21:52:33*PMunch quit (Quit: leaving)
21:53:54FromDiscord<Solitude> sent a code paste, see https://paste.rs/msf
21:55:02FromDiscord<krisppurg> well kind of, but it's a bit more shorter with my way
21:55:25FromDiscord<Solitude> yeah, but its more memory efficient my way
21:55:52FromDiscord<krisppurg> Benchmark?
21:56:06FromDiscord<Solitude> ...
21:56:20FromDiscord<Solitude> and its much easier to get a parseHook going that way
21:58:36FromDiscord<krisppurg> either ways
22:02:09*krux02 joined #nim
22:21:35NimEventerNew thread by Nycto: Look up proc signature from an ident, see https://forum.nim-lang.org/t/8772
22:26:52*Lord_Nightmare quit (Read error: Connection reset by peer)
22:27:09*Lord_Nightmare joined #nim
22:28:25FromDiscord<gandalfs_socks> Error: ambiguous call; both system.and(x: bool, y: bool) [proc declared in C:\Users\...\Downloads\nim-1.6.2_x64\nim-1.6.2\lib\system\basic_types.nim(48, 6)] and system.and(x: int32, y: int32) [proc declared in C:\Users\...\Downloads\nim-1.6.2_x64\nim-1.6.2\lib\system\arithmetics.nim(299, 6)] match for: (WINBOOL, bool)
22:28:39FromDiscord<gandalfs_socks> how can i specify which function to use
22:29:44FromDiscord<Elegantbeef> convert one to bool or int
22:54:51*noeontheend quit (Remote host closed the connection)
22:56:33*noeontheend joined #nim
23:30:30*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
23:30:37FromDiscord<Schelz> Any idea how would be done an web application with buttons, etc. That will be able to communicate with the program ( use the webpage as a control panel )
23:31:52FromDiscord<Elegantbeef> Wouldnt it just be http requests to your server from your webpage
23:31:59FromDiscord<Elegantbeef> Alternatively use a webview library
23:33:46FromDiscord<Schelz> Example of libraries ?
23:34:14FromDiscord<Elegantbeef> https://nimble.directory/search?query=webview
23:34:42FromDiscord<Schelz> In reply to @Elegantbeef "Wouldnt it just be": Thats the idea the webpage has to change the program, as a gui.
23:36:00FromDiscord<Elegantbeef> If it has to be in the browser the webview doesnt work, but the benefit of them would be using web techs to make UI then you can just use whatever IPC you want to communicate between the two programs
23:37:02FromDiscord<Elegantbeef> Or you could even build the UI with the server, dont know what the program is so dont know the requirements
23:42:43FromDiscord<Schelz> I went with webgui cause its the closest that works with the needs
23:42:55FromDiscord<Schelz> Thx for help
23:52:27*krux02 quit (Remote host closed the connection)