<< 27-01-2022 >>

00:03:15FromDiscord<pruno> Well, gonna fix that, for the help guys :)
00:08:01*Guest6683 joined #nim
00:08:24Guest6683Hello
00:08:45FromDiscord<Elegantbeef> Hello
00:11:01Guest6683I am getting a somewhat rare error or at least nothing hits on google.  I am trying to use the pegs module.  I am a total beginner with Nim, and have no experience with PEGs, but I am trying to parse lines like `1997 <-> 1645, 1746` and am trying to compile a program with a peg `const line_expr = peg"""{\d+} \s* '<' '-' '>' \s* { \d+ ( ',' \s*
00:11:01Guest6683\d+ )*}"""` and I am getting an error `pegs.nim(1863, 28) Error: {} must have the set type`
00:11:38Guest6683I have absolutely no clue what I am doing wrong there, if anyone can help
00:11:44FromDiscord<Elegantbeef> Are you trying to learn PEG or do you just want to parse that line?
00:12:23Guest6683I am trying to learn how to use the peg module. I would otherwise just split(", ") and such
00:12:35FromDiscord<Elegantbeef> Psh you disappoint me
00:12:55FromDiscord<Elegantbeef> `line.scanf("$i <-> $i, $i", a, b, c)` 😛
00:13:30FromDiscord<Elegantbeef> I dont know much of PEG syntax, I do know the NPeg package is fancier
00:13:35Guest6683lol, that would work too, but in general the right hand side will have a comma seperated list, so maybe a more involved scanf
00:13:47FromDiscord<Elegantbeef> Ah
00:14:04Guest6683I am just confused as to what is wrong with my peg
00:15:03Guest6683The full program would be `import pegs
00:15:03Guest6683const line_expr = peg"""{\d+} \s* '<' '-' '>' \s* { \d+ ( ',' \s* \d+ )*}"""
00:15:04Guest6683proc partOne(x:string):int=
00:15:04Guest6683    for line in x.splitLines():
00:15:05Guest6683        var matches = newSeq[string](0)
00:15:05Guest6683        let t = match(line,line_expr,matches)
00:15:06Guest6683        echo matches
00:15:06Guest6683    return 0
00:15:07Guest6683doAssert(partOne("""0 <-> 2
00:15:07Guest66831 <-> 1
00:15:08Guest66832 <-> 0, 3, 4
00:15:08Guest66833 <-> 2, 4
00:15:09Guest66834 <-> 2, 3, 6
00:15:09Guest66835 <-> 6
00:15:10Guest66836 <-> 4, 5""")==6)` which of course will fail the assert, but I will fix that later
00:15:18FromDiscord<Elegantbeef> https://play.nim-lang.org/
00:15:42Guest6683https://play.nim-lang.org/#ix=3NDh
00:15:42FromDiscord<Elegantbeef> IRC doesnt support code blocks as you probably know so that's horrendeous 😛
00:15:52Guest6683I just found out, thank you
00:17:14FromDiscord<Elegantbeef> The error is due to https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/pegs.nim#L1863 so i dont know why
00:17:27Guest6683I am doing the advent of code to learn nim and am trying to use different parts of the language, and thought this would be a good time to try the pegs module
00:17:34Guest6683https://adventofcode.com/2017/day/12
00:17:58Guest6683I saw that and thought the error made no sense
00:17:58FromDiscord<Elegantbeef> I'd love to help but yea i know nothing of PEG
00:18:06Guest6683Thanks for looking at least
00:18:28FromDiscord<Elegantbeef> Quite possible the library has a bug and no one has hit it?
00:18:58FromDiscord<Elegantbeef> That error goes away with `let` instead of const
00:19:07FromDiscord<Elegantbeef> So perhaps `pegs` doesnt work at CT?
00:20:29Guest6683Ah, thanks! I just assumed it would be fine with const
00:20:34Guest6683thank you very much
00:21:19FromDiscord<Elegantbeef> I just took a guess, dont know if it's supposed to work at CT
00:24:03*Guest6683 quit (Quit: Client closed)
00:55:35NimEventerNew Nimble package! lrparser - A SLR parser written in Nim with compile-time and run-time grammar generation., see https://github.com/vanyle/lrparser/
00:59:17*cyraxjoe quit (Ping timeout: 240 seconds)
01:00:11*cyraxjoe joined #nim
01:07:39FromDiscord<sharpcdf> is there a way to make only one c file when running `nim cc main.nim`?
01:21:03FromDiscord<leorize> nope
01:29:58*vicecea quit (Remote host closed the connection)
01:30:19*xet7 quit (Quit: Leaving)
01:30:28*vicecea joined #nim
01:32:18*xet7 joined #nim
01:33:22*jmdaemon quit (Ping timeout: 268 seconds)
01:36:17FromDiscord<sharpcdf> rip
01:37:39*jmdaemon joined #nim
01:49:30FromDiscord<Tetralux> Is it considered correct that `0..-1` tries to do `(0)..-(1)` rather than `(0)..(-1)` ?
01:51:34FromDiscord<Elegantbeef> yes
01:51:49FromDiscord<Elegantbeef> Nim allows user defined operators so `..-` could be declared
01:52:52FromDiscord<Elegantbeef> `0 .. -1` solves it
01:53:35FromDiscord<Tetralux> In reply to @Elegantbeef "`0 .. -1` solves": This is true, but that seems a bit odd that you need a space there _for that case only_.↵If you always needed that space for that syntax to work, then sure.↵Dunno - Not sure how I feel about that 😄
01:53:59FromDiscord<Tetralux> Just something surprising that I came across.
01:56:19FromDiscord<leorize> it happens more than one would expect tbf
01:57:03FromDiscord<leorize> nim tries to group as many continuous characters as possible into an operator
01:59:04FromDiscord<Elegantbeef> It's any case with contiguous operators
01:59:20FromDiscord<leorize> an example that sometimes bites me\: `%` is the toJson operator and `$` can be used to stringify a json node, so you'd expect to write `$%obj` and get json as a string. But that would become the `$%` operator which doesn't exist and will raise an error. Instead you'd have to use `$ %obj`
01:59:20FromDiscord<Elegantbeef> `echo 1 -3`
01:59:44FromDiscord<Tetralux> In reply to @leorize "an example that sometimes": Oh wow. That's... kinda icky 🤣
02:00:18FromDiscord<Elegantbeef> I mean `%` was a mistake imo 😛
02:00:26FromDiscord<Elegantbeef> But since Nim has macros there are valid operators that might not be considered valid in other scopes
02:00:45FromDiscord<Elegantbeef> Take https://github.com/CosmicToast/pipe for instance
02:00:52FromDiscord<Tetralux> Yeah - That particular example may be better with an explicit call to `toJson` or whatever-it's-called, rather than relying on operators like `%` (wut), but yeah - that is still a good example of the problem you can run into.
02:01:31FromDiscord<Elegantbeef> There's not really a good solution though
02:02:01FromDiscord<Elegantbeef> If you dont have a `..-` operator are you supposed to start randomly chunking the operator to find one that compiles 😀
02:02:27FromDiscord<leorize> I mean that is certainly possible
02:02:32FromDiscord<Tetralux> To be fair, who said anyone wanted a `..-` operator? 😄
02:02:37FromDiscord<Rika> Is it a good idea though
02:02:53FromDiscord<leorize> we actually have `..^` as an operator because people so often write it like that
02:02:56FromDiscord<Rika> You cannot assume no one would want any arbitrary operator
02:03:35FromDiscord<leorize> the actual stuff is `a .. ^b`, but people writes it as `a..^b` so often that it grew into an operator on its own
02:04:09*vicfred quit (Quit: Leaving)
02:04:23FromDiscord<Elegantbeef> To me having user defined operators when you have macros is a no brainer
02:04:27FromDiscord<Tetralux> In reply to @Rika "You cannot assume no": While that is indeed true, I can very much have an opinion on whether an operator makes sense in any given situation, obviously.↵Like - I could use `%%=` (assuming that's a valid operator to overload) to mean `multiply by two and add one`, but I wouldn't, because I want to be able to understand my code. 😄
02:04:31FromDiscord<Elegantbeef> It allows you to extend the language in an expressive matter
02:04:52FromDiscord<Elegantbeef> I mean i agree your operator should make sense
02:04:54FromDiscord<Tetralux> In reply to @leorize "the actual stuff is": Huh. Yeah, that's definitely the same problem as I had 😄
02:04:57FromDiscord<Elegantbeef> Which is why i dislike the json operators
02:05:22*jmdaemon quit (Ping timeout: 250 seconds)
02:05:25FromDiscord<Elegantbeef> There isnt an empirical rule of "operators that makes sense" 😀
02:05:53FromDiscord<leorize> obviously we just need "smart" operator grouping \:P
02:05:57FromDiscord<Elegantbeef> Lol
02:06:02FromDiscord<Tetralux> In reply to @Elegantbeef "There isnt an empirical": You could maybe make one 😏 😛
02:06:10FromDiscord<Elegantbeef> Just need people to understand operators grouped together are considered one
02:06:24FromDiscord<Elegantbeef> You cant make one since user operators can be for specific domains and make sense only there
02:06:26FromDiscord<Tetralux> Like...↵`..` => range↵`^` => xor (for example)↵`..^` => nonsensical, so cannot be overloaded
02:06:31FromDiscord<Elegantbeef> For instance unicode operators
02:06:36FromDiscord<Elegantbeef> But it's not nonsensical
02:06:48FromDiscord<Elegantbeef> Nim doesnt use `^` for xor
02:07:13FromDiscord<Elegantbeef> Nim uses `^` for `BackwardsIndex` and in urnary raising to power
02:07:14FromDiscord<Elegantbeef> in binary\
02:07:18FromDiscord<Tetralux> Alright - but let's assume that it was XOR for a moment...↵To that, I could just ask, "In what situation does it make sense to have a 'ranged-xor'?"
02:07:34FromDiscord<Elegantbeef> But that disregards any case where it might make sense
02:07:40FromDiscord<Tetralux> Name one.
02:07:46FromDiscord<Elegantbeef> And in the case of Nim it makes sense as an iterator
02:07:57FromDiscord<Rika> That's the issue, what people seem as sensible differs a lot across people
02:08:04FromDiscord<Rika> Deem, not seem
02:08:06FromDiscord<leorize> https://github.com/zevv/npeg
02:08:21FromDiscord<leorize> ^ look at that for the biggest collection of operators in a special habitat
02:08:25FromDiscord<Elegantbeef> Nim has macros which means operators can be used for a ton of power
02:08:37FromDiscord<Elegantbeef> And they can make sense
02:08:48FromDiscord<Elegantbeef> Take `-->`
02:08:54FromDiscord<Elegantbeef> negative less than?
02:09:09FromDiscord<Elegantbeef> Greater than \
02:09:20FromDiscord<Elegantbeef> https://github.com/zero-functional/zero-functional
02:09:24FromDiscord<Elegantbeef> It uses it for chaining
02:09:39FromDiscord<Elegantbeef> It's the same with `|>` or greater doesnt make any sense
02:09:46FromDiscord<Elegantbeef> But pipe uses it
02:10:01FromDiscord<Tetralux> In reply to @leorize "https://github.com/zevv/npeg": Oh man... I feel like I'd have to learn a whole new language just to read that 😄
02:10:12FromDiscord<Elegantbeef> You kinda do
02:10:27FromDiscord<Elegantbeef> But you need to learn a new language for any pattern matching logic
02:11:12FromDiscord<Tetralux> In reply to @Elegantbeef "It's the same with": One could make an argument that one is more easily recognised, in fairness, since that's actually well-known operator already.
02:11:35FromDiscord<Elegantbeef> Sure but the point is the language doesnt define what is acceptable and things can grow naturally
02:11:49FromDiscord<Elegantbeef> Nim is a relatively small language that is implemented mostly in libraries
02:12:35FromDiscord<Tetralux> I think there's some merit to that -- though, I could see that leading to ungrokkable code pretty easily, which is a touch concerning. 🤔
02:12:49FromDiscord<Elegantbeef> Sure, shun bad use of operators
02:12:55FromDiscord<Elegantbeef> Join me and my quest to shunning them
02:13:07FromDiscord<Tetralux> I won't hesitate in doing so 😄
02:13:18FromDiscord<Elegantbeef> Hell 1.6.0 introduced unicode operators for those science nerds
02:13:35FromDiscord<Rika> Well choose, strange operators or Java level verbosity
02:13:37FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3NDF
02:13:48FromDiscord<Elegantbeef> And it's a lovely sensible solution
02:14:01FromDiscord<Tetralux> In reply to @Elegantbeef "So the following is": That's more grounded though, since those symbols really do have an actual meaning, which I'm guessing is what they're used for there.
02:14:24FromDiscord<Elegantbeef> Indeed, but in other places that have locked off operators that's n ot allowed
02:14:32FromDiscord<Tetralux> I wonder how viable it would be to have it fall back to parsing it as `(0)..(-1)` if no `..-` was defined for the type combination 🤔
02:14:34FromDiscord<Rika> I'd say it's just as bad since now I need to figure out how to type them
02:14:36FromDiscord<Elegantbeef> Bad operators are bad regardless
02:14:48FromDiscord<Elegantbeef> well what if you have a `.-` operator?
02:15:03FromDiscord<Tetralux> `..-` you mean?
02:15:05FromDiscord<Elegantbeef> I dont think a fallback makes sense
02:15:07FromDiscord<Rika> No
02:15:12FromDiscord<Elegantbeef> No just `.-`
02:15:19FromDiscord<Elegantbeef> Take the ZF example
02:15:36FromDiscord<Tetralux> `0 . .- 1` -> is this valid syntax?
02:15:43FromDiscord<Elegantbeef> `->` exists in sugar `-->` is what ZF uses
02:16:01FromDiscord<Tetralux> (edit) "syntax?" => "syntax?↵Because if not, I'm not sure how that would affect this case."
02:16:16FromDiscord<Elegantbeef> No, but i think trying to reason what operators are valid in a case is fruitless
02:16:39FromDiscord<Elegantbeef> It requires a bunch of recursive checking and enables hidden behaviour
02:17:14FromDiscord<Tetralux> One could argue that doing a bunch of logic to "smartly" figure out what operator was meant, when there's only one that compiles, is in line with Nim's wish to be maximally 'useful', in that sense.
02:17:33FromDiscord<Tetralux> Not that I'm necessarily seriously suggesting it.
02:17:58FromDiscord<Elegantbeef> I think it's a relatively complex thing to manage and to do it properly
02:18:00FromDiscord<Elegantbeef> The compiler doesnt compile in the case it's confuse instead of attempting to be right
02:18:55FromDiscord<Tetralux> Sure - but one could argue that negative numbers aren't exactly a hidden technology from the moon, exactly. 😛
02:19:01FromDiscord<Tetralux> (edit) "Sure - but one could argue that negative numbers aren't exactly a hidden technology ... from" added "that comes"
02:19:08FromDiscord<Elegantbeef> Sure but that's a hard coded solution
02:19:16FromDiscord<Elegantbeef> You dont do hard code logic in a compiler
02:19:31FromDiscord<Elegantbeef> Atleast not generally
02:19:52FromDiscord<Elegantbeef> unary `-` is not any more special than unary anything
02:19:56FromDiscord<Tetralux> I mean, yeah - you actually _have to_ hardcode some logic into the compiler - but I get what you're meaning.
02:20:35FromDiscord<Elegantbeef> Yea you ideally do things as general as possible and everything falls into rules, stuff does need to be hardcoded but it's best to cast a wide net
02:21:14FromDiscord<Tetralux> Let us test that logic: "Why is the JSON operator still `%` ?"
02:21:18FromDiscord<Elegantbeef> `10 --+ 11` falls into the "what's right" to me
02:21:50FromDiscord<Elegantbeef> Not many appreciate that as an operator and i think it wont be coming with the json rewrite
02:21:58FromDiscord<Tetralux> (edit) "?"" => "?"↵"Why--in spite of seemingly not being a good operator for that--has it not been changed?""
02:23:52FromDiscord<Tetralux> Ah - so it's just an obscure thing that's not been addressed because nobody cares enough about it?
02:23:56FromDiscord<Rika> backwards compatibility and not breaking old code
02:24:17FromDiscord<Elegantbeef> Nim 2.0 is coming which means we can break libraries
02:24:27FromDiscord<Elegantbeef> Either performance or ugly code is getting addressed
02:24:55FromDiscord<Rika> or both xd
02:25:02FromDiscord<Tetralux> In reply to @Rika "backwards compatibility and not": Right - Though, one could make a case that's a point against having arbitrary operators, since bad ones will stick around. 🤔
02:25:18FromDiscord<Rika> it is indeed
02:25:32FromDiscord<Rika> i just mean it cannot be changed because
02:25:49FromDiscord<Rika> once its in stable theres no going back pretty much
02:26:19FromDiscord<Tetralux> It's an interesting problem. 🤔
02:26:58FromDiscord<Elegantbeef> You want to support arbitrary operators cause they enable expressive code, but dont want them to be used cause someone was having a laugh 😛
02:27:15FromDiscord<Tetralux> 😄
02:27:20FromDiscord<Tetralux> I'm all for people having a laugh!
02:27:34FromDiscord<Elegantbeef> I'm not for it when it makes my code ugly 😛
02:28:00FromDiscord<Elegantbeef> `%` should've been `toJson` and if you wanted a unary operator you could alias it or the package could've provided it
02:28:05FromDiscord<Tetralux> Maybe people should be able to vote on Nimble packages, and downvote those with bad operators. 😄 ↵Then 'bad' packages become advised against by the package system when you try to install it. 😏😛
02:28:23FromDiscord<Rika> that is complicated
02:28:24FromDiscord<Tetralux> In reply to @Elegantbeef "`%` should've been `toJson`": That's probably what I would have done, if that had been my decision.
02:28:33FromDiscord<Elegantbeef> Eh we already have that if the repo includes "beef331" it's probably a bad package
02:28:55FromDiscord<Tetralux> Beef331? 🧐
02:29:03FromDiscord<Elegantbeef> That's my github
02:29:07FromDiscord<Elegantbeef> I'm saying i'm a shit programmer
02:29:11FromDiscord<Tetralux> Ah!
02:29:12FromDiscord<Rika> xd
02:29:12FromDiscord<Tetralux> Gotcha!
02:29:18FromDiscord<Rika> imagine needing to explain a joke
02:29:25FromDiscord<Tetralux> HEY
02:29:37FromDiscord<Tetralux> I CANNOT BE IN ON LITERALLY EVERY JOKE
02:29:39FromDiscord<Tetralux> I'M SORRY
02:29:41FromDiscord<Tetralux> 😛
02:30:09FromDiscord<Elegantbeef> Also to make it even more complicated for "sensible operators" `/../` exists 😛
02:30:28FromDiscord<Tetralux> Also - sidenote - this is a fairly good first impression of this community.
02:30:32FromDiscord<Tetralux> So kudos
02:30:36FromDiscord<Tetralux> 👍😄
02:30:37FromDiscord<Elegantbeef> Fuck we were too nice
02:30:42FromDiscord<Elegantbeef> Now they'll never leave
02:30:44FromDiscord<Rika> fuck you beef
02:30:48FromDiscord<Tetralux> 😈
02:30:51FromDiscord<Elegantbeef> Do it yourself coward
02:30:54FromDiscord<Rika> beef is dumb
02:31:05FromDiscord<Rika> i cant believe youre still here beef smh
02:31:12FromDiscord<Elegantbeef> Same
02:31:25FromDiscord<Rika> In reply to @Elegantbeef "Do it yourself coward": 😳
02:31:43FromDiscord<Elegantbeef> I'm surprised my rambling didnt result in tetra being annoyed by this community
02:31:48FromDiscord<Rika> xd
02:31:54FromDiscord<Rika> your assumptions are strange
02:32:11FromDiscord<Elegantbeef> Speaking of the subreddit doesnt link to any of the realtime chats
02:32:23FromDiscord<Elegantbeef> Who wants to yell at one of the subreddit mods
02:36:45FromDiscord<Tetralux> In reply to @Elegantbeef "I'm surprised my rambling": More people need to have the "Don't take yourself too seriously + sense of humour" attitude. 😄👍
02:37:11FromDiscord<Elegantbeef> Well i just accepted i'm a joke
02:37:23FromDiscord<Tetralux> Don't kid yourself - we all are 😈
02:37:24FromDiscord<Tetralux> 😄
02:41:21*noeontheend joined #nim
02:41:50*krux02 quit (Remote host closed the connection)
02:43:44FromDiscord<Elegantbeef> But hey atleast i'm actually working on my game so... take that!
02:47:29FromDiscord<impbox [ftsf]> omg
02:47:56FromDiscord<Elegantbeef> Damn it i broke git again
02:48:03FromDiscord<impbox [ftsf]> the whole thing?
02:48:10FromDiscord<Rika> git gud
02:48:11FromDiscord<Elegantbeef> Well for my project
02:48:23FromDiscord<impbox [ftsf]> you ruined the whole decentralised network
02:48:35FromDiscord<Elegantbeef> every time i commit it's outputting the output of a command i ran
02:48:36FromDiscord<impbox [ftsf]> guess no more work for me today
02:48:40FromDiscord<Elegantbeef> This happenedbefore
02:48:49FromDiscord<impbox [ftsf]> feature!
02:49:46FromDiscord<Rika> poggers no more programming
02:50:57NimEventerNew thread by Tsojtsoj: Macro question: "undeclared identifier", but identifier is declared?, see https://forum.nim-lang.org/t/8847
02:51:02FromDiscord<Elegantbeef> Good thing i borked it after all my refactoring/implementing
03:13:39*arkurious quit (Quit: Leaving)
03:21:42*jmdaemon joined #nim
03:29:27FromDiscord<Tetralux> Does defining a `iterator items(x: MyType)` just allow `for e in x` to work?
03:29:40FromDiscord<Tetralux> (edit) "Does defining" => "Just to confirm:" | "just allow" => "allows" | "work?" => "work, right?"
03:29:47FromDiscord<Tetralux> (edit) "Just to confirm: ... a" added "declaring"
03:30:22FromDiscord<Elegantbeef> Yes but using implicit `items` will result in bugs with generics
03:31:06FromDiscord<Tetralux> As in `iterator items[T]` + `for e in x` ?
03:31:11FromDiscord<Elegantbeef> Nah
03:31:32FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3NDX
03:31:56FromDiscord<Tetralux> Is the workaround to just do `for x in a.items:` there then?
03:32:03FromDiscord<Elegantbeef> `.items` isnt properly used in this case, I'm going to try to fix it but need to put fresh eyes on it
03:32:06FromDiscord<Elegantbeef> Yes
03:32:16FromDiscord<Tetralux> Gotcha. Cheers for the heads up.
03:32:18FromDiscord<Tetralux> 👍
03:32:24FromDiscord<Elegantbeef> it doesn know it's supposed to mixin `items` and explicitly mixing it in doesnt work
03:32:38FromDiscord<Tetralux> I haven't got to mixins yet 😄
03:33:11FromDiscord<Elegantbeef> They're just a part of generics saying "for this symbol add the scope of instantiation"
03:33:50FromDiscord<Tetralux> Hmmm. I'll have to look more into that to see how they work.
03:34:00FromDiscord<Tetralux> Oh - also - `for i, e in x` is enabled by `iterator enumerate(x: MyType): tuple[IntType, ElType]` ?
03:34:12*rienske quit (Ping timeout: 250 seconds)
03:34:16FromDiscord<Elegantbeef> `pairs`
03:34:19FromDiscord<Tetralux> Ah!
03:34:21FromDiscord<Tetralux> Gotcha.
03:34:23FromDiscord<Elegantbeef> there is `std/enumerate`
03:34:34FromDiscord<Elegantbeef> which lets you do `for x, y in enumerate myType.items`
03:34:47FromDiscord<Elegantbeef> Allows you to enumerate any iterator
03:35:28FromDiscord<Elegantbeef> And if you want more iterator examples or utillities https://github.com/beef331/slicerator/blob/master/src/slicerator.nim is full of them 😛
03:39:15FromDiscord<Tetralux> sent a code paste, see https://play.nim-lang.org/#ix=3NDZ
03:39:25FromDiscord<Elegantbeef> `for x in a[10]` works
03:39:26FromDiscord<Tetralux> (edit) "https://play.nim-lang.org/#ix=3NDZ" => "https://play.nim-lang.org/#ix=3NE0"
03:39:27FromDiscord<Tetralux> (edit) "https://play.nim-lang.org/#ix=3NE0" => "https://paste.rs/A4J"
03:39:44FromDiscord<Elegantbeef> well in the example it's `for x in a[1..3]`
03:39:47FromDiscord<Elegantbeef> Nim slices presently copy
03:40:23FromDiscord<Tetralux> `for x in arr_val[1..3]` iterates over a copy of a range of the array?
03:40:34FromDiscord<Elegantbeef> In default Nim yes
03:40:54FromDiscord<Tetralux> sent a code paste, see https://play.nim-lang.org/#ix=3NE1
03:40:56FromDiscord<Tetralux> (edit) "https://play.nim-lang.org/#ix=3NE1" => "https://paste.rs/0fb"
03:41:03FromDiscord<Elegantbeef> Yes it does a non copy iteration of the slice
03:41:10FromDiscord<Tetralux> (edit) "https://paste.rs/UIl" => "https://play.nim-lang.org/#ix=3NE2"
03:41:34FromDiscord<Tetralux> And that's only resolved to in the target of a for loop, correcT?
03:41:35FromDiscord<Tetralux> (edit) "correcT?" => "correct?"
03:41:38FromDiscord<Tetralux> (edit) "resolved to" => "resolved-to"
03:41:43FromDiscord<Tetralux> Since it's an iterator?
03:41:51FromDiscord<Elegantbeef> Yep
03:41:56FromDiscord<Tetralux> Right. Huh. Interesting.
03:42:02FromDiscord<Elegantbeef> It's only invoked in the case the compiler wants the iterators
03:42:07FromDiscord<Tetralux> That's gonna take some grokking 😄
03:42:15FromDiscord<Elegantbeef> which is `for x in y` or when you have a template that has `t: iterable`
03:42:57FromDiscord<Tetralux> Going back to `for i, e in x`, how does one make `e` a `var ElType` ?
03:43:04FromDiscord<Tetralux> So that `e = ...` works in the loop?
03:43:46*rie joined #nim
03:43:54FromDiscord<Tetralux> Do you just define an iterator that returns `: var T` instead?
03:44:06FromDiscord<Elegantbeef> enumerate might work, but nim doesnt have an abillity to safely capture `var T` so `(int, var T)` doesnt work
03:44:19FromDiscord<Elegantbeef> `mitems` is defined for collections, and yes that does work
03:44:29FromDiscord<Tetralux> In reply to @Elegantbeef "`mitems` is defined for": That I saw, yeah.
03:44:35FromDiscord<Tetralux> Hmm. That's unfortunate.
03:44:54FromDiscord<Tetralux> Though, you could do it for `for e in x` presumably?
03:45:01FromDiscord<Elegantbeef> Yea
03:45:08FromDiscord<Tetralux> Gotcha. Cheers. 👍
03:45:30FromDiscord<Elegantbeef> https://github.com/beef331/slicerator/blob/master/src/slicerator.nim#L76-L82 is an example at how you might emulate this
03:46:12FromDiscord<Tetralux> Here's another: How about slices with no end-bounds?↵So a way to write `thing[0..]` or `thing[0..end]` instead of `thing[0..thing.len-1]` - etc?
03:46:21FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3NE3
03:46:24FromDiscord<Elegantbeef> `thing[0..^1]`
03:46:40FromDiscord<Tetralux> In reply to @Elegantbeef "`thing[0..^1]`": What's the type of `0..^1` ?
03:46:41FromDiscord<Elegantbeef> And we go full circle
03:46:51FromDiscord<Elegantbeef> `HSlice[int, BackwardsIndex]`
03:47:27FromDiscord<Tetralux> What type should one use to define `[]` on a custom type which you want to be able to slice with either a forward, or backwards, slice?
03:47:45FromDiscord<Tetralux> Or is it a case of defining two overloads: `Slice[T]` and `HSlice[T, BackwardsIndex]` ?
03:47:56FromDiscord<Elegantbeef> https://github.com/beef331/slicerator/blob/master/src/slicerator.nim#L5-L13
03:48:18FromDiscord<Tetralux> Ah, so two overloads it is then 😄
03:49:16FromDiscord<Elegantbeef> You can also defined `a[10, 20]` by doing `(a: T, b: Y, c: Z)`
03:49:45FromDiscord<Tetralux> Gotcha 👍
03:50:42FromDiscord<Elegantbeef> The same rules apply to the `{}` operator
03:52:02FromDiscord<evoalg> I read somewhere that `x .. y` is preferred style over `x..y` ... so I've been using `x ... y` ever since?
03:52:29FromDiscord<Elegantbeef> I mean i do `x..y` but if there are expressions i do `x + 1 .. y - 1`
03:53:20FromDiscord<Elegantbeef> `x..y` reads nicer to me and `x + 1 .. y - 1` is easier to see the logic
03:54:25FromDiscord<evoalg> I used to think `x+1` was easier too but I changed to `x + 1` ... eg if I'm doing `y = x + 1`
03:55:18FromDiscord<evoalg> :w
03:55:25FromDiscord<evoalg> gosh
03:55:54FromDiscord<evoalg> I was just updating my "where beefy is wrong" notes ... it's very short
03:57:17FromDiscord<Elegantbeef> Lol
03:57:55FromDiscord<evoalg> it only has that and how you think that -20 degree celsius isn't that cold
03:58:10FromDiscord<Elegantbeef> Well it's not
03:58:48FromDiscord<congusbongus> doesn't it depend on what you're wearing
04:00:20FromDiscord<Tetralux> If you have your own string type (`str`), and want to be able to do `str"some text"`, but manually manage the memory of the resulting `str`, do you need to copy the `string`'s data, or is there a way to avoid ever creating the `string` at all there?
04:00:43FromDiscord<Tetralux> (edit) "manually manage" => "have `str` be non-owning on" | "memory of the resulting `str`," => "bytes,"
04:00:58FromDiscord<Elegantbeef> The string lit is a constant in the case there
04:01:06FromDiscord<Tetralux> (edit) "If you have your own string type (`str`), and want to be able to do `str"some text"`, but have `str` be non-owning on the bytes, ... do" added "and be manually-managed memory,"
04:01:27FromDiscord<Rika> strings are never manually managed as well no?
04:01:38FromDiscord<Elegantbeef> Well their string is
04:01:39FromDiscord<Tetralux> In reply to @Elegantbeef "The string lit is": Does that mean that the string's data points into RODATA, and so there's no need to copy the bytes?
04:01:57FromDiscord<leorize> pretty much
04:02:02FromDiscord<Tetralux> Cool 👍
04:02:22FromDiscord<Tetralux> Relatedly, does `str("some text")` work the same way in this case?
04:02:38FromDiscord<Elegantbeef> Same thing just one is a raw lit
04:02:42FromDiscord<Elegantbeef> The first is a raw lit
04:03:52FromDiscord<Elegantbeef> `echo"hello\nworld"` vs `echo "hello\nworld"`
04:03:59FromDiscord<Tetralux> Hmm.
04:04:02FromDiscord<Rika> i assume str is the type and not a conversion proc
04:04:32FromDiscord<Elegantbeef> I assumed it was a conversion procedure
04:07:51FromDiscord<Tetralux> `str` is the type, but I assume I couldn't do `str("some text")` anyway in that case.
04:07:54FromDiscord<Tetralux> (edit) "assume" => "imagine"
04:08:20FromDiscord<Tetralux> (edit) "`str` is ... thetype" added "actually" | "type," => "type in realitry,"
04:08:23FromDiscord<Tetralux> (edit) "realitry," => "reality,"
04:10:04FromDiscord<Tetralux> I _wouldn't_ want to define a `converter` procedure for this, since Nim will let me use a runtime-known string, or a constant string, but the GC won't know if I'm still using the string data, correct?
04:10:43FromDiscord<Elegantbeef> `convert toMyStr(aStr: static string): MyStr` could work, i dont recall though
04:10:48FromDiscord<Elegantbeef> converter\
04:11:02FromDiscord<Tetralux> Ahhh. Interesting, yeah.
04:11:03FromDiscord<Elegantbeef> Nim does allow you to have procedures that only work on compile constants
04:11:13FromDiscord<Tetralux> `static[string]`, eh?
04:11:34FromDiscord<Rika> not a converter, a conversion proc
04:11:57FromDiscord<Rika> toJson is a conversion proc
04:12:04FromDiscord<Rika> if it existed
04:13:16FromDiscord<Tetralux> In reply to @Elegantbeef "`convert toMyStr(aStr: static string):": This makes progress, but it doesn't want to work here, it seems - since `str` takes the address of the data. 🤔
04:13:20FromDiscord<Elegantbeef> I'd argue having `MyStr` and a `myStr` proc
04:13:20FromDiscord<Tetralux> (edit) "the" => "its"
04:14:08FromDiscord<Elegantbeef> Yea i dont know
04:14:14FromDiscord<Tetralux> Hmm.
04:14:37FromDiscord<Elegantbeef> My view is just use `string` you arent really going to need a different type of string in 99% of use cases
04:15:24FromDiscord<Tetralux> I'm exploring just how well supported manual memory management is in Nim by seeing how far I get without it 😛
04:16:10FromDiscord<Tetralux> I made custom allocators, dynamic arrays, slices (like Go's) work already - and a stringview too - but string literals was a detail I hadn't totally worked out yet.
04:16:12FromDiscord<Elegantbeef> Well you can make macros or procedures that do what you need
04:16:42FromDiscord<Elegantbeef> a macro that takes a `static string` iterates over it and allocates your string isnt too hard
04:17:40FromDiscord<Tetralux> In reply to @Elegantbeef "a macro that takes": Ideally though, I'd avoid allocation and just use the pointer into RODATA. 🤔
04:17:48FromDiscord<Tetralux> I'm just not sure how to get at that 😄
04:18:29FromDiscord<Elegantbeef> You'd need the constant to be compiled so i dont see how you'd do it
04:19:05FromDiscord<Elegantbeef> Aside from using the codegendecl pragma
04:19:12FromDiscord<Tetralux> Compiled
04:19:13FromDiscord<Tetralux> (edit) "Compiled" => "Compiled?"
04:20:04FromDiscord<Elegantbeef> Well to use the RODATA it needs to be compiled into the program, but you want to only reuse the pointer if it's in the RODATA
04:20:38FromDiscord<Elegantbeef> so `proc toMyStr(s: static string): MyStr` doesnt work since it's not given to C
04:20:47FromDiscord<Elegantbeef> Or atleast it might not be
04:21:59FromDiscord<Tetralux> sent a code paste, see https://play.nim-lang.org/#ix=3NE8
04:22:10FromDiscord<Elegantbeef> Templates exist
04:22:26FromDiscord<Tetralux> Whatcha thinking? 😄
04:23:17FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3NE9
04:23:22FromDiscord<Elegantbeef> dont need the backticks
04:23:49FromDiscord<Tetralux> sent a code paste, see https://play.nim-lang.org/#ix=3NEa
04:24:06FromDiscord<Elegantbeef> Yes
04:24:22FromDiscord<Elegantbeef> Just making the point to use a template before a macro 😛
04:24:57FromDiscord<Tetralux> Presumably because a template basically just does the `quote do:` thing anyway - whereas macros are more about building up an expr from AST procs?
04:25:16FromDiscord<Elegantbeef> Yes and templates dont use the VM so are slightly faster
04:25:24FromDiscord<Tetralux> Ah, interesting. Cheers.
04:25:48FromDiscord<Elegantbeef> Faster to compile\
04:26:19FromDiscord<Tetralux> sent a code paste, see https://play.nim-lang.org/#ix=3NEb
04:26:26FromDiscord<Elegantbeef> yes
04:26:33FromDiscord<Elegantbeef> cause templates replace any instance of their fields
04:26:38FromDiscord<Tetralux> (edit) "https://play.nim-lang.org/#ix=3NEb" => "https://play.nim-lang.org/#ix=3NEc"
04:26:41FromDiscord<Elegantbeef> you dont need to backtick the symbols in templates
04:27:05FromDiscord<Elegantbeef> That behaviour catches a lot of people
04:27:20FromDiscord<Elegantbeef> If any identifier matches the name of a parameter it's getting replaced
04:27:27FromDiscord<Tetralux> Ah! So in a template, any mention of `s` just becomes the value `s` has as-passed to it --- whereas, in a macro, you have to use backticks to escape the params to get the same behavior?
04:27:42FromDiscord<Elegantbeef> Well inside `quote do`
04:28:06FromDiscord<Elegantbeef> macros are not quote do, quote do is a special tool that allows quasi quoting like in macros
04:28:11FromDiscord<Elegantbeef> like in templates\
04:28:59FromDiscord<Elegantbeef> `genasts` is a module with an alternative quasi quote that doesnt rely on backtick replaces
04:29:00FromDiscord<Tetralux> Right, right - yeah.
04:29:32FromDiscord<Tetralux> So the backticks are part of the implementation of `quote`, rather than of `macro`s, then.
04:29:40FromDiscord<Elegantbeef> Yep
04:29:43FromDiscord<Tetralux> Gotcha.
04:29:59FromDiscord<Elegantbeef> Macros are really just interpreted user defined compiler passes
04:30:18FromDiscord<Tetralux> Interesting 😄
04:31:05FromDiscord<Elegantbeef> Generally you use genast/quote as a tool to make specific AST inside a larger macro
04:31:19FromDiscord<Tetralux> Right.
04:31:21FromDiscord<Elegantbeef> What language do you come from btw?
04:31:43FromDiscord<Tetralux> Everything, basically 😄 ↵Everything from VB.NET to Odin 🤣
04:31:56FromDiscord<Tetralux> (edit) "↵Everything" => "↵Everything"
04:31:57FromDiscord<Elegantbeef> Lol
04:32:05FromDiscord<Elegantbeef> Hey the odin has to make you feel at home somewhat
04:32:09FromDiscord<Elegantbeef> Both Nim and Odin are pascally
04:32:41FromDiscord<Rika> pascallian
04:32:45FromDiscord<Elegantbeef> Though i know odin is much more magic free
04:32:50FromDiscord<Elegantbeef> Wirthian
04:32:52FromDiscord<Tetralux> That it is 😄
04:33:03FromDiscord<Elegantbeef> Wirth using
04:34:43FromDiscord<Tetralux> I take there's no way to make `str"some text"` work?↵Closest I can get is `toStr"some text"` where `toStr` is the name of the proc?↵Unless I define a `converter`, but then it's implicitly converted _everywhere_, right?
04:35:39FromDiscord<Elegantbeef> No you'd have ambiguity
04:35:49FromDiscord<Elegantbeef> You could do `Str` as the type then use `str`
04:36:00FromDiscord<Rika> LIKE NIM TELLS YOU TO xdddd
04:36:04FromDiscord<Rika> well, nep
04:36:06FromDiscord<Tetralux> 😄
04:36:13FromDiscord<Elegantbeef> And if you want to reduce allocations you'll want a macro
04:36:38FromDiscord<Elegantbeef> Since right now you're allocating a Nim string to make your string
04:36:45FromDiscord<Tetralux> Oh yeah. Good point 🤔
04:38:14FromDiscord<Tetralux> But can you get the address into RODATA from a string literal 🤔
04:38:49FromDiscord<Elegantbeef> Probably
04:38:58FromDiscord<Tetralux> Alas, I'm not sure how 😄
04:39:15FromDiscord<Elegantbeef> You'd need `str(input: string)` to do that but i dont know if it'd be wise
04:39:57*noeontheend quit (Ping timeout: 240 seconds)
04:43:25FromDiscord<Tetralux> Hmm.
04:43:33FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3NEe
04:43:38FromDiscord<Elegantbeef> There's how you'd use a macro here
04:44:42*k0mpjut0r joined #nim
04:44:43FromDiscord<Elegantbeef> You could make a `proc asgn(a: var MyStr, data: openArray[char])` which does the same as this
04:44:58FromDiscord<Elegantbeef> Allocate and copy mem over
04:45:26FromDiscord<Tetralux> That seems like there's no way to avoid the allocation 🤔
04:48:35FromDiscord<Elegantbeef> I havent looked at the C code for a `str(myStr: openArray[char]`
04:49:14*k0mpjut0r quit (Ping timeout: 260 seconds)
04:51:01*k0mpjut0r joined #nim
04:52:07FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3NEg
04:52:07FromDiscord<Elegantbeef> Hmmm
04:55:37FromDiscord<Tetralux> Interesting.
04:56:07FromDiscord<Elegantbeef> Stringlits are stack allocated and copied to a string heap when
04:56:15FromDiscord<Elegantbeef> So i think you can do it using a bit of stack 😀
04:57:59FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3NEi
04:58:10FromDiscord<Tetralux> Hmm.
04:58:46FromDiscord<Elegantbeef> Basically if it's a lit you can safely point to the data, otherwise you'd need to alloc
05:01:24FromDiscord<Tetralux> sent a code paste, see https://play.nim-lang.org/#ix=3NEk
05:01:41FromDiscord<Tetralux> (My Str type doesn't allow you to mutate the elements currently.)
05:03:08FromDiscord<Elegantbeef> If you wanted to you could make `MyStrConst` as a distinct `MyStr` with a small subsection of `MyStr` functionality
05:03:58FromDiscord<Tetralux> I could, but mutate the elems of a Str isn't really something I need to do.
05:04:11FromDiscord<Elegantbeef> Ah
05:05:18FromDiscord<Tetralux> (edit) "mutate" => "mutating"
05:34:07FromDiscord<demotomohiro> sent a long message, see http://ix.io/3NEp
05:34:41FromDiscord<Elegantbeef> I do not know i assumed it was stack 😀
05:39:41FromDiscord<demotomohiro> Stack is allocated when a function is called and dellocated when returning. Memory locations global variables are placed is different from stack in C. It always exists while a program is running
05:41:50*k0mpjut0r quit (Quit: Quit)
05:42:34*k0mpjut0r joined #nim
05:46:30*k0mpjut0r quit (Client Quit)
05:46:44*k0mpjut0r joined #nim
06:17:40NimEventerNew thread by Niminem: Generating javascript from nim code evaluation at runtime, see https://forum.nim-lang.org/t/8848
06:30:53*rockcavera quit (Remote host closed the connection)
06:35:48FromDiscord<Tetralux> sent a code paste, see https://play.nim-lang.org/#ix=3NEA
06:47:02FromDiscord<Elegantbeef> I'd look at the C gen to be certain but probably not
06:48:47FromDiscord<demotomohiro> let s = "Hello" copies "Hello" but let p = s[0].unsafeAddr doesn't copy.
06:49:16ZevvTetralux: well it *is* a whole new language
06:49:28Zevvbut a language that is much closed to your problem domain then the Nim programming language is
06:49:51Zevvthan
06:51:30*Nuc1eoN joined #nim
06:54:37FromDiscord<Tetralux> In reply to @demotomohiro "let s = "Hello"": Huh. It appears so, since it seems to crash upon mutation. 🤔
06:54:46FromDiscord<Tetralux> (edit) "so," => "that it might in fact be in RODATA,"
06:59:06FromDiscord<Tetralux> Yeah - Just checked the C code - no copy anywhere.
06:59:11FromDiscord<Tetralux> That's useful to know!
06:59:25FromDiscord<Elegantbeef> Well there you go
06:59:42FromDiscord<Tetralux> There I do, indeed 😄
07:01:03FromDiscord<Tetralux> Oh wait - nope I'm an idiot 🤣
07:11:34*xiamx quit (Quit: Client limit exceeded: 20000)
07:24:04*k0mpjut0r quit (Quit: Quit)
07:24:18*k0mpjut0r joined #nim
07:28:02*k0mpjut0r quit (Client Quit)
07:28:16*k0mpjut0r joined #nim
07:35:22*k0mpjut0r quit (Read error: Connection reset by peer)
07:35:37*k0mpjut0r joined #nim
07:40:05*k0mpjut0r quit (Ping timeout: 252 seconds)
07:41:06*k0mpjut0r joined #nim
07:49:18*jjido joined #nim
07:49:52Amun-Racan allocCStringArray (alloc0) return nil or is the error handled by nim itself?
07:50:06*xiamx joined #nim
07:52:57FromDiscord<Elegantbeef> The error being what?
07:54:37FromDiscord<Elegantbeef> I didnt even know C's malloc could return null
07:55:16FromDiscord<konsumlamm> it returns null if no memory could be allocated
07:55:48FromDiscord<Elegantbeef> Yea i got that
07:56:54FromDiscord<Elegantbeef> Just didnt expect it cause in modern times not being able to allocate your data seems absurd
07:58:36FromDiscord<Rika> ? malloc isnt a modern thing though
07:58:58FromDiscord<Elegantbeef> I know
07:59:07FromDiscord<demotomohiro> C's malloc returns null when it failed to allocate heap. But alloc0 in Nim doesn't throw exception when it failed?
07:59:19FromDiscord<Elegantbeef> It's just I didnt think about actually not being able to allocate
07:59:47FromDiscord<Tetralux> If your PC has 4GB of RAM, you'd better believe it. 😄
07:59:53FromDiscord<Tetralux> ... or if you have enough tabs open.
07:59:55FromDiscord<Tetralux> Like I do.
08:00:09FromDiscord<Tetralux> Memory allocation failure is really not an unexpected condition.
08:00:17FromDiscord<Rika> i have a lot of tabs open too, on 32gb 😛
08:00:26FromDiscord<Elegantbeef> I almost always sit a 4gb used
08:00:31FromDiscord<Elegantbeef> So i have like 12gb just sitting there
08:00:32FromDiscord<Tetralux> In reply to @Rika "i have a lot": Likewise 😛
08:00:53FromDiscord<Rika> ~~over 4000 from what i recall~~
08:01:07FromDiscord<Elegantbeef> I have one tab open
08:01:08FromDiscord<Elegantbeef> Take that
08:01:15FromDiscord<Rika> damn thats a lot
08:01:17FromDiscord<Rika> is it matrix?
08:02:10FromDiscord<Elegantbeef> Nah i just mean in my browser
08:02:16FromDiscord<Elegantbeef> I use an application
08:02:25FromDiscord<Rika> i mean you could have been using matrix on the browsere
08:03:02FromDiscord<Elegantbeef> Yea i dont do webapps i close my browser when i'm not using it
08:03:07FromDiscord<Rika> i think i currently have under 30 on my alt browser (i really need to fix the situ on my main, but i dont have time rn)
08:06:48FromDiscord<Elegantbeef> "alt browser" jesus
08:13:35FromDiscord<Rika> well i only installed it because it got out of hand on the other one
08:13:44FromDiscord<Rika> for now im on here
08:13:53FromDiscord<Rika> i'll fix it once i have time AKA february
08:15:31Amun-RaElegantbeef: I have ~20GB taken by the firefox only
08:17:08FromDiscord<Rika> LOL
08:17:36FromDiscord<Rika> yeah same here but more like 26 in my case i think
08:18:24emeryI have one tab open, but just to keep firefox from closing
08:18:27FromDiscord<Tetralux> Hmmm. That's odd. I just wrote a quick test program where I allocate more than I have, then iterate through it, writing to every last byte.↵It never dies, and exits normally, despite accessing more RAM than I have... 🤔
08:18:56FromDiscord<Elegantbeef> Did you go into swap?
08:19:05FromDiscord<Tetralux> I'm on Windows. 😄
08:19:42FromDiscord<Tetralux> It must be paging some of it out - I'm just curious how.↵I'm guessing that Nim's allocation setup is doing that.
08:19:54FromDiscord<Tetralux> Because I can tell you right now that malloc _doesn't_ do that 😄
08:20:17FromDiscord<Tetralux> Or at least it didn't last I experimented with this stuff.
08:21:28*rie is now known as rienske
08:28:14FromDiscord<Elegantbeef> Does "3 messages deleted" mean that you tested and it did work in C?
08:30:28FromDiscord<Tetralux> It means that I wrote the equivalent Odin program, and it made it further than I thought it would. 😄
08:30:30FromDiscord<Tetralux> However
08:30:34FromDiscord<Tetralux> It ultimately didn't make it.
08:30:42FromDiscord<Tetralux> Which makes me wonder what sorcery is going on here.
08:32:28FromDiscord<Tetralux> Oh wait, no.
08:32:33FromDiscord<Tetralux> I was just fucking up the code 🤣
08:32:35FromDiscord<Tetralux> Both make it.
08:32:45FromDiscord<Tetralux> Huh. That's very interesting.
08:33:00FromDiscord<Tetralux> I guess it must be doing the equivalent of swapping on Windows, eh.
08:33:17FromDiscord<Elegantbeef> Probably
08:33:22FromDiscord<Elegantbeef> Go to something like 1 bazillion GB
08:33:23FromDiscord<Elegantbeef> 😛
08:33:48FromDiscord<Tetralux> I would like to still have a functioning computer afterwards 😆
08:36:18FromDiscord<Elegantbeef> I mean the allocation will fail
08:37:16*PMunch joined #nim
08:37:38FromDiscord<Elegantbeef> Yea i just tried allocatin `int 1e30` and it instantly said "out of memory"
08:37:43FromDiscord<Elegantbeef> It's a hard crash
08:37:53FromDiscord<Tetralux> Nope
08:37:58FromDiscord<Tetralux> Nim just works anyway
08:38:10FromDiscord<Elegantbeef> I just tried it
08:38:24FromDiscord<Tetralux> I tried 80GB 😄
08:38:39FromDiscord<Elegantbeef> `discard create(byte, int 1e30)`
08:38:39FromDiscord<Tetralux> How are you allocating?
08:38:46FromDiscord<Tetralux> Ah
08:39:08FromDiscord<Tetralux> I did `system.alloc(80 1024 1024 1024)`
08:39:51FromDiscord<Tetralux> Ah-ha! It does immediately exit when I ask for 120GB 🤣
08:40:34FromDiscord<demotomohiro> Maybe Nim or backend compiler removed iteration code as it doesn't affect output of your program.
08:44:51*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
08:45:48FromDiscord<Tetralux> It was doing it in debug mode too.
08:45:54FromDiscord<Tetralux> Interesting thought though 😄
08:47:08FromDiscord<Rika> Integer can hold 1e30?
08:47:13FromDiscord<eyecon> Doesn't Windows just lie to you and say "suure, I just did"
08:47:17FromDiscord<Elegantbeef> No
08:47:21FromDiscord<eyecon> I thought I read something like that
08:47:32FromDiscord<Elegantbeef> My no was to rika
08:47:36FromDiscord<eyecon> Ah
08:47:38FromDiscord<Tetralux> That's Linux you're thinking of @eyecon 😜
08:47:40FromDiscord<Rika> Then why are you doing it
08:47:51FromDiscord<eyecon> In reply to @Tetralux "That's Linux you're thinking": Yeah
08:47:56FromDiscord<Elegantbeef> `echo int 1e30`outputs a big number of `5076964154930102272`
08:48:09FromDiscord<Elegantbeef> I could do `int.high` of course
08:48:09FromDiscord<eyecon> I mean, it does kinda make sense in a modern system with swap
08:48:15FromDiscord<Rika> Was going to say
08:48:47FromDiscord<Tetralux> While that's true - overcommitting memory can easily make your system all but unusable if you start paging.
08:48:57FromDiscord<Tetralux> You really don't want that to happen.
08:49:16FromDiscord<Forest> sent a code paste, see https://play.nim-lang.org/#ix=3NEV
08:49:16FromDiscord<Elegantbeef> Sure but you also dont want your program to crash!
08:49:36FromDiscord<eyecon> All hail the OOM killer mechanism
08:49:49FromDiscord<Rika> OOM has reaped my Firefox before hahaha
08:49:56*k0mpjut0r quit (Ping timeout: 252 seconds)
08:49:58FromDiscord<eyecon> In reply to @Rika "OOM has reaped my": Ooof
08:50:12*k0mpjut0r joined #nim
08:50:22FromDiscord<Forest> The config https://www.toptal.com/developers/hastebin/agobapeyoq.nim↵↵The main.nim https://www.toptal.com/developers/hastebin/acoxinoyun.nim
08:50:48FromDiscord<Forest> (edit) "config" => "config.nims"
08:50:51FromDiscord<Rika> No problem, I have redundant backup systems in case my absurd number of tabs are lost
08:52:30FromDiscord<Rika> I’m not joking though
08:54:53*jjido joined #nim
08:58:59FromDiscord<Forest> :p
09:03:05*k0mpjut0r quit (Ping timeout: 250 seconds)
09:03:27FromDiscord<demotomohiro> @Forest That error message looks like you don't have `shell_minimal.html` in current directory.
09:04:22*k0mpjut0r joined #nim
09:05:05FromDiscord<Phil> In reply to @Rika "No problem, I have": It's so damn tempting to have hundreds of tabs, I've gotten into the habit of "cleaning" them up on the regular in order to keep the number to a manageable 20-50
09:06:04*szahid| joined #nim
09:06:42FromDiscord<Rika> I already do that, I just haven’t had the time for my old tab count
09:07:52PMunchI set my Firefox to start afresh whenever I open it
09:07:55FromDiscord<Phil> You have a... backlog of tabs to clean up? 😄 I'll admit that sounds funny
09:08:07FromDiscord<Phil> In reply to @PMunch "I set my Firefox": The absolute madman!
09:08:12PMunchI have a few tabs which are "pinned", my email, some work stuff, etc.
09:08:28PMunchAnd then I can bookmark or temporarily pin anything I might want to read later
09:08:41PMunchIt has really saved my from the tab mess I was dealing with before
09:08:52PMunchI think I had almost 200 tabs at one point
09:09:12FromDiscord<Rika> Bookmarks don’t work for me
09:09:43*szahid quit (Quit: WeeChat 3.4)
09:11:21jmdaemonI should really make a habit of cleaning out my tabs more frequently so they don't pile up
09:11:40FromDiscord<Elegantbeef> Ah this is how we awaken the nim community talk about browser tahbs
09:11:47FromDiscord<Elegantbeef> Nice typo, but still makes sense
09:12:05FromDiscord<Elegantbeef> Also pmunch fix the subreddit description, add the real time chats!
09:12:08jmdaemonnim browser when
09:13:22PMunchjmdaemon, I was actually trying to make one at one point
09:13:31PMunchBy using the Chromium embedded framework
09:13:40PMunch@Elegantbeef, fix it?
09:14:05jmdaemonhow far were you able to get PMunch ?
09:14:23PMunchI got CEF working and opened a window :P
09:14:27FromDiscord<BhamidipatiNikhil> You guys won't believe what i tried today....↵today i tried implementing to find the number with the largest Collatz sequence in all numbers less than 10 million....↵This was the code i tried
09:14:46FromDiscord<BhamidipatiNikhil> sent a long message, see http://ix.io/3NF0
09:14:47PMunchBut by that time I had spent so much time just trying to get CEF to work I was tired of the whole project..
09:14:52FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/936187493081022464/image.png
09:14:56FromDiscord<Rika> Lol
09:15:00FromDiscord<Elegantbeef> It's not properly linked
09:15:06FromDiscord<Elegantbeef> New reddit
09:15:37FromDiscord<BhamidipatiNikhil> sent a code paste, see https://play.nim-lang.org/#ix=3NF1
09:15:41jmdaemonah what was so difficult about making it work? What problems were you having PMunch ?
09:16:15FromDiscord<Rika> Someone’s gonna get mad at you for using epoch time instead of mono time for benchmarking
09:16:53FromDiscord<BhamidipatiNikhil> and i was able to get the answer in 5.5 secs
09:16:56FromDiscord<BhamidipatiNikhil> Image
09:17:10FromDiscord<Rika> Now is it correct
09:17:11FromDiscord<BhamidipatiNikhil> https://media.discordapp.net/attachments/371759389889003532/936188075778904074/unknown.png
09:17:12PMunch@Elegantbeef, it's not my problem your client doesn't properly do styling: https://uploads.peterme.net/redditsidebar.png
09:17:50FromDiscord<BhamidipatiNikhil> The same program took 9 secs in c++
09:17:52FromDiscord<BhamidipatiNikhil> https://media.discordapp.net/attachments/371759389889003532/936188247502110800/unknown.png
09:17:57PMunchjmdaemon, the wrapper was just outdated, and not lot of people are using CEF so it's not exactly easy to find help for random issue
09:19:09FromDiscord<Elegantbeef> Pmunch you're on old reddit!
09:19:10FromDiscord<BhamidipatiNikhil> I was so shell shocked.... freaking c++ took 9 secs and nim took 5.5 secs.... it was basically the same logic, but nim outshined c++ left and right....
09:19:35FromDiscord<Phil> In the "About Community" section it does not display as well from the official reddit page (new reddit design)
09:19:45FromDiscord<Phil> (edit) "In the "About Community" section it does not display ... as" added "correctly"
09:19:48PMunch@Elegantbeef, of course I am, what kind of maniac uses new reddit?
09:20:21FromDiscord<Elegantbeef> BuT NiM is GceD
09:20:27FromDiscord<Elegantbeef> Uhh
09:20:28FromDiscord<Phil> https://media.discordapp.net/attachments/371759389889003532/936188897841516564/Screenshot_from_2022-01-27_10-20-01.png
09:20:38FromDiscord<BhamidipatiNikhil> In reply to @Rika "Someone’s gonna get mad": should i use mono time ??
09:20:46FromDiscord<Phil> Not that I actually use new reddit, just not logged in on this laptop
09:21:01FromDiscord<Elegantbeef> You should use monotime
09:21:06FromDiscord<Phil> In reply to @BhamidipatiNikhil "should i use mono": Do you care about the actual point in time or the difference between two points in time?
09:21:22FromDiscord<BhamidipatiNikhil> the difference between 2 points in time...
09:21:26FromDiscord<Phil> monotime it is
09:21:44FromDiscord<Elegantbeef> Also what are the compiler flags?
09:22:12FromDiscord<BhamidipatiNikhil> nim c -d:release -r CollatzInNim.nim
09:22:20FromDiscord<Forest> In reply to @demotomohiro "<@909883978717204561> That error message": Oh i forgot about that rip
09:22:29FromDiscord<Elegantbeef> cmon do `-d:danger --gc:arc` 😀
09:22:39*k0mpjut0r quit (Read error: Connection reset by peer)
09:23:01FromDiscord<Elegantbeef> oh i forgot `--passL:"-flto" `
09:23:12FromDiscord<Elegantbeef> does that need the `--passC:"-flto"` aswell?
09:23:38*szahid| is now known as szahid
09:24:00FromDiscord<Elegantbeef> Not that the GC matters much here
09:24:09FromDiscord<Elegantbeef> Arc might even make it slower
09:24:37PMunchSo does new reddit not support styling in those messages?
09:25:22FromDiscord<Elegantbeef> I think it does but I do not know
09:26:05FromDiscord<Elegantbeef> I think it doesnt
09:26:10FromDiscord<Elegantbeef> Fucking silly then
09:26:44FromDiscord<Elegantbeef> It does support things like
09:26:51FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/936190510916337694/image.png
09:27:12FromDiscord<Elegantbeef> I dont see why it'd not allow linking from descriptions
09:27:13PMunchBest performance I got was with -d:danger, but without -flto and arc
09:27:58PMunchAh well, maybe slightly better actually with -flto and arc
09:28:09PMunchI didn't run it a lot of times to test, but now I did three runs and it was faster
09:29:21FromDiscord<Elegantbeef> Hey we're code golf those flags generally
09:29:27PMunch@Elegantbeef, better?
09:29:30FromDiscord<Elegantbeef> Though in this program arc might do more harm than good since there arent any allocations
09:29:46PMunchIf there aren't any allocations it shouldn't do anything
09:30:01PMunchAlthough this prints a lot of stuff, so it has to allocate strings and deallocate them again
09:30:27PMunchBy the way @BhamidipatiNikhil printing is super slow, if you want speed you should remove those echos
09:30:49FromDiscord<Elegantbeef> Well by "any" i mean few
09:31:11FromDiscord<BhamidipatiNikhil> In reply to @PMunch "By the way <@764483963422375946>": Then how should i print?
09:32:11PMunchJust don't print :P
09:32:20FromDiscord<Rika> Print after the benchmark
09:32:28PMunchIt's not `echo` in Nim which is slow, it's just printing in general which is slow
09:33:31FromDiscord<BhamidipatiNikhil> In reply to @Elegantbeef "cmon do `-d:danger --gc:arc`": After trying what the bot wanted me to do... i optimised my code by 1 more second... https://media.discordapp.net/attachments/371759389889003532/936192187346071582/unknown.png
09:33:55FromDiscord<Elegantbeef> Make a large memfile and write then instead, then close it 😛 (I'm kidding dont print in benchmarks other than results)
09:33:55FromDiscord<Elegantbeef> I'm not a bot
09:34:03FromDiscord<Elegantbeef> I'm a human with... ok i dont have feelings but i'm not a bot!
09:34:09FromDiscord<BhamidipatiNikhil> 😑
09:34:39FromDiscord<Elegantbeef> And yea pmunch it's better
09:34:41FromDiscord<Rika> Shut up bot
09:34:47FromDiscord<demotomohiro> @BhamidipatiNikhil Said it took 5.5 seconds, so I think slowness of echo is small enough in this case
09:34:48FromDiscord<Elegantbeef> Ok
09:34:55FromDiscord<Elegantbeef> No more compiler bug fixes from me now
09:35:00FromDiscord<Elegantbeef> Thank rika
09:35:40FromDiscord<BhamidipatiNikhil> What the hell? Are these above bots written in nim??
09:35:51PMunchWe're not bots -_-
09:36:11PMunchWe're users on different platforms, all the live chats are bridged together
09:36:12FromDiscord<Rika> In all seriousness they’re just using different chat systems
09:36:17PMunchSo in Discord it shows us as bots
09:36:17FromDiscord<Elegantbeef> No we're humans using chat bridges to talk to people in discord
09:36:17FromDiscord<Elegantbeef> I swear people dont believe us when we say that
09:36:41FromDiscord<Phil> I wonder how many times a week you guys have to deal with this debate
09:36:49FromDiscord<Rika> Once a day I believe
09:36:52FromDiscord<Elegantbeef> Discord users dont show as a bot to us though comically enough 😀
09:36:52FromDiscord<Phil> The answer is definitely also too many times
09:37:01PMunchI guess we should take it as a compliment that people think the Nim community casually writes bots that pass the Touring test (apart from having "bot" right next to their name)
09:37:22FromDiscord<Elegantbeef> Nim's sitting on super intelligence
09:37:24PMunchWait, it's Turing test..
09:37:24FromDiscord<Phil> I do it every tuesday after sport
09:37:26FromDiscord<Phil> Easy peasy
09:37:44FromDiscord<Phil> Well those bots I write every Saturday morning after breakfast
09:37:57FromDiscord<Rika> I failed the Turing test
09:37:59FromDiscord<Elegantbeef> Yea after Alana touring
09:38:03PMunchEach member of the Nim community has written a bot that answers like the user itself would, that way we can always be online!
09:38:27FromDiscord<Elegantbeef> I didnt study for it myself
09:38:32*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
09:38:42FromDiscord<Elegantbeef> I havent said enough swears recently for that to be true
09:39:20FromDiscord<BhamidipatiNikhil> I am not finding any information about these bots even on googling https://media.discordapp.net/attachments/371759389889003532/936193652085125150/unknown.png
09:39:58FromDiscord<Elegantbeef> Is this a joke?
09:40:25FromDiscord<Clonkk> We're just some of @mratsim experiment in data science that became self aware↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
09:41:54FromDiscord<Rika> In reply to @Elegantbeef "Is this a joke?": I can’t tell anymore tbh
09:42:20FromDiscord<Clonkk> Error\: module humour not found↵(@Rika)
09:42:51FromDiscord<Rika> In reply to @Clonkk "Error\: module humour not": Did you miss the part where everyone else stopped joking about it
09:43:03FromDiscord<Elegantbeef> I swear people are just joking, between the frontend gdb programmer and this one i just dont believe people think we're bots
09:43:41FromDiscord<Clonkk> Maybe we are bots who have been programmed to believe otherwise
09:43:59FromDiscord<Clonkk> After all, the evidence is plain \: there is a "bot" right next to our name. Would discord lie to you ?
09:45:07FromDiscord<Rika> They have plenty of times hahaha
09:46:07PMunchI'm actually surprised by how many of you are on IRC. After I set up the plug-in to extract the names from FromDiscord and replace them I can't tell the difference anymore and just assumed you where all Discord people
09:46:37PMunch@Elegantbeef, and I'm pretty sure he's just messing with you at this point
09:46:51PMunch@Clonkk, frond-end GDB programmer?
09:47:19FromDiscord<Elegantbeef> The person that made gdb frontend
09:47:29FromDiscord<Elegantbeef> They were certain i was a bot or joking for minutes
09:47:41FromDiscord<Elegantbeef> I'm on matrix like you should be!
09:48:47FromDiscord<eyecon> The quality of these bots are truly exceptional, they sound even self-aware and making meta-jokes
09:49:13FromDiscord<Elegantbeef> Maybe you're the bot and we're humans!
09:49:36PMunchAah, right :P
09:49:43FromDiscord<eyecon> Never thought of that possibility, can't be sure that it isn't the case
09:49:49PMunchBut I like IRC :(
09:50:00FromDiscord<eyecon> If there's no one to call out a bot, is it still a bot
09:50:16FromDiscord<Elegantbeef> If the bot falls in the forest does it make a "beep boop"?
09:51:24FromDiscord<Rika> Is life raycasted
09:51:27FromDiscord<eyecon> Let's try it with a sacrificial bot and a recorder
09:51:48FromDiscord<Elegantbeef> Where's all the fun Nim code?
09:51:52FromDiscord<NicoIas> sent a code paste, see https://play.nim-lang.org/#ix=3NF3
09:51:57FromDiscord<Elegantbeef> Damn
09:51:58FromDiscord<Elegantbeef> I ask and it comes in
09:52:16FromDiscord<Elegantbeef> `+textPadding` is a unary operator
09:52:16FromDiscord<Rika> Spacing is important in Nim
09:52:16FromDiscord<eyecon> The fun Nim code, at your service
09:52:29FromDiscord<Elegantbeef> operators touching identifiers are taken as unary
09:52:41FromDiscord<Rika> In reply to @Elegantbeef "operators touching identifiers are": Touching one identifier
09:52:44FromDiscord<Elegantbeef> Second operator question in one day
09:52:52FromDiscord<Elegantbeef> Ah yes sorry
09:53:19FromDiscord<Elegantbeef> `a+b` == `a + b` `a +b` == `a +(b)`
09:53:35FromDiscord<Rika> ?
09:53:47FromDiscord<Rika> Or `a(+b)`
09:53:53FromDiscord<eyecon> In reply to @NicoIas "what is going on": In short: `textEnd.x += hours.width +textPadding` is `textEnd.x += hours.width(+textpadding)`
09:53:58FromDiscord<Rika> Yes
09:54:39FromDiscord<eyecon> If it is a function at least
09:54:47FromDiscord<NicoIas> oh I get it! Took me a solid 2 minutes to understand what you guys meant ahah
09:54:55FromDiscord<NicoIas> I see, that's a bit unexpected
09:55:03FromDiscord<Rika> Well it will be like that regardless since it’s a syntax thing and not a semantic thing
09:55:15FromDiscord<Elegantbeef> unary is an operator that has a single parameter, binary is an operator with two ...
09:56:01PMunch@NicoIas, if you want to be properly confused turn on whitespace math ordering :P
09:56:06FromDiscord<Elegantbeef> Nim binds unary operators regardless of context in the case, if `+textPadding` was invalid you would have got a "unknown `+` operator"
09:56:11PMunchOr has that feature been removed?
09:56:25FromDiscord<Elegantbeef> I've never heard of it
09:56:31FromDiscord<eyecon> In reply to @PMunch "<@179174721764458496>, if you want": Do we beginners want to know what that is
09:56:53FromDiscord<Rika> In reply to @PMunch "Or has that feature": I don’t think it was ever added?
09:56:58FromDiscord<Elegantbeef> I think it's either removed or not documented anymore
09:57:10PMunch@eyecon, definitely not :P
09:57:22PMunchI'm pretty sure it was an experimental feature at some point
09:57:54FromDiscord<Tetralux> I'm gonna take a wild guess: `3+2 8` == `(3+2) 8`
09:58:12FromDiscord<Elegantbeef> Yes
09:58:13FromDiscord<eyecon> I see, shutting off my senses now
09:58:20FromDiscord<eyecon> Too late 😦
09:58:21FromDiscord<Tetralux> 🤣
09:58:31FromDiscord<eyecon> Nooo
09:58:38FromDiscord<Elegantbeef> unary biinding is only if there isnt a space proceding the operator
09:59:05FromDiscord<Elegantbeef> Otherwise it's a binary operator
09:59:32FromDiscord<demotomohiro> !eval echo 3+2 8
09:59:33NimBotCompile failed: /usercode/in.nim(1, 10) Error: invalid token: (\29)
09:59:48FromDiscord<eyecon> Wut
10:00:13FromDiscord<eyecon> !eval echo (3+2 8)
10:00:15NimBotCompile failed: /usercode/in.nim(1, 11) Error: invalid token: (\29)
10:00:17PMunchDuscard for some reason converts * to a dot, which breaks all code pastes and NimBot interaction :P
10:00:26FromDiscord<demotomohiro> !eval echo 3+2 \ 8
10:00:26PMunch!eval echo 3+2 * 8
10:00:28NimBotCompile failed: /usercode/in.nim(1, 11) Error: invalid token: (\29)
10:00:29NimBot19
10:00:30FromDiscord<Rika> It’s likely the bridge actually
10:00:46PMunchSee, mine works fine from IRC
10:00:49FromDiscord<Elegantbeef> It's 100% the bridge `` as pmunch said isnt ever right
10:00:55FromDiscord<eyecon> In reply to @PMunch "Duscard for some reason": Ah, surprises do not cease here
10:01:07PMunchWait, it's the bridge which does that?
10:01:10PMunchWhy?!
10:01:29FromDiscord<Elegantbeef> Well it's not discord doing it
10:01:31FromDiscord<Rika> Lol don’t ask me
10:01:42FromDiscord<Rika> Yardanico made it so ask them
10:01:42PMunchOh wait, maybe it's trying to do *bold* or something
10:01:46FromDiscord<Elegantbeef> The client properly shows `` 😛
10:02:01FromDiscord<eyecon> !eval echo 3+2 \ 8
10:02:03NimBotCompile failed: /usercode/in.nim(1, 11) Error: invalid token: (\29)
10:02:15FromDiscord<demotomohiro> `\` doesn't fix the problem?
10:02:16PMunch!eval echo 3+2 8
10:02:17NimBotCompile failed: /usercode/in.nim(1, 10) Error: invalid token: (\2)
10:02:22FromDiscord<eyecon> It doesn't make a difference if a backspace is in front of it
10:02:27FromDiscord<Elegantbeef> https://github.com/Yardanico/ircord/issues/19
10:02:30FromDiscord<eyecon> I just tried
10:02:57PMunchIt was apparently called "strong spaces"
10:03:23FromDiscord<Rika> Make it weak then
10:03:32FromDiscord<Elegantbeef> I think i seen some conversations about it but never really seen it in action
10:04:18FromDiscord<eyecon> In reply to @PMunch "It was apparently called": Why... the..
10:04:38FromDiscord<eyecon> What converts it in the first place
10:04:40FromDiscord<Elegantbeef> Where are the newer Nim queries?!
10:04:43FromDiscord<Elegantbeef> It worked last time
10:04:48FromDiscord<Elegantbeef> Should work again!
10:05:44PMunchRun this snippet: https://play.nim-lang.org/#ix=3NF7
10:05:51PMunchAnd then change the version to 0.19.6
10:06:13FromDiscord<Elegantbeef> Ah yes i remember now
10:06:21PMunch@Elegantbeef, what are you talking about?
10:06:33FromDiscord<Elegantbeef> tighly bound binary operators overrides precedence
10:06:57FromDiscord<Elegantbeef> The last time i said "what about Nim code" someone asked a question 😛
10:07:19PMunchOh, haha :P
10:12:30PMunchYou can work on this if you want @Elegantbeef: https://github.com/nim-lang/Nim/issues/19449
10:13:28FromDiscord<Elegantbeef> But but i've been working on my game again
10:30:28PMunchOooh, gotten any further?
10:30:42PMunchThis is still Linerino right?
10:31:42*jjido joined #nim
10:39:03*NimBot joined #nim
10:39:05FromDiscord<Elegantbeef> Nim doesnt have left to right inference do `[0u32 ,2, 4, 6]`
10:39:07FromDiscord<Goel> But why if is in the same line of the declaration?
10:40:03FromDiscord<Elegantbeef> Do you want the technical reason or are you ok with me just repeating what i said? 😀
10:40:49FromDiscord<Rika> I’m at least interested in the technical reason
10:40:50FromDiscord<Rika> Unless I already know
10:41:16FromDiscord<Elegantbeef> Nim's array semantic check does not take in an assumed type, and as such sem's it as an `array[4, int]` which does not convert implicitly to `array[4, uint32]`
10:41:42FromDiscord<konsumlamm> ~~the technical reason is that Nim doesn't have left to right inference~~
10:42:15FromDiscord<Elegantbeef> Matrix bridge made it seem like I waited until rika asked 😀
10:43:02FromDiscord<Rika> Good enough though
10:43:15FromDiscord<Rika> Could have just not said that and none of us here woulda known
10:45:35FromDiscord<konsumlamm> i'm really losing motivation to work with Nim rn, this is the 3rd bug in 5 days
10:45:40FromDiscord<konsumlamm> maybe it's all the same bug
10:46:10FromDiscord<konsumlamm> but something is going on with variables being incorrectly moved or something
10:46:27FromDiscord<konsumlamm> does moving/destructor stuff also happen for refc?
10:47:40arkanoidkonsumlamm, what's the problem? do you have a minimal example?
10:48:22FromDiscord<konsumlamm> this is part of it: https://github.com/nim-lang/Nim/issues/19457
10:48:27arkanoidI'm also finding some bugs when dealing with OOP + destructors + ARC, but so far seems that there are workarounds for every situation
10:48:53FromDiscord<konsumlamm> there are workarounds
10:49:05FromDiscord<Elegantbeef> move semantics shouldnt be used for refc
10:49:28FromDiscord<konsumlamm> but... i don't want to use workarounds when it's for compiler bugs
10:50:22FromDiscord<konsumlamm> i wouldn't trust a language where i constantly need to work around compiler bugs
10:50:40arkanoidsure, I mean, for example here I have to use code reordering otherwise my destructors are not called: https://github.com/nim-lang/Nim/issues/19402#issuecomment-1022921122
10:51:09FromDiscord<konsumlamm> i don't even use destructors (just the default ones)
10:51:17arkanoidkonsumlamm, you have to weight these with issue you'd have with other system programming languages
10:51:40FromDiscord<konsumlamm> in Rust i encountered exactly zero bugs so far ¯\_(ツ)_/¯
10:53:20FromDiscord<konsumlamm> anyway, i have some code that works fine as is, but if i insert `echo`s, it fails... (using refc too)
10:53:57arkanoidyes, but you have to write your code how rust likes, and you have to bend the patterns you know to fit the patterns enforced by rust. It is ok given the fact that those patterns are *safer*, but yet is turning human into machine
10:54:01FromDiscord<xflywind> Rust is already a mature and successful language with massive supports and developers. Nim should be compared to Crystal or Vlang which also has many compiler bugs.
10:54:38FromDiscord<konsumlamm> i'd never touch V ever
10:55:44arkanoidI feel nim is still the sweet spot
10:56:06arkanoidbut yes, there are severe compiler bugs
10:56:07FromDiscord<konsumlamm> Crystal and D are fair comparisons, i just mentioned Rust because arkanoid was talking about other system languages and that's the only system language i really know
10:56:28FromDiscord<konsumlamm> i mean, there's a reason i'm not using crystal or D instead, but it's still pretty annoying
10:56:41FromDiscord<konsumlamm> idk how common compiler bugs are for those
10:56:50arkanoidme neither
10:58:18arkanoidbut with rust you cannot implement new language features using language itself, and that makes things easier for compiler devs
10:58:55FromDiscord<konsumlamm> ~~you can if you're fine with wrapping everything in a macro~~
10:59:05arkanoidalso you don't have to rely on multiple backends that spits out code in different languages, but just LLVM IR
10:59:24FromDiscord<konsumlamm> i mean attribute macros can be used to make new language features sort of
10:59:33arkanoidare you saying that rust macros are 1:1 with nim macros? I don't feel that
10:59:50FromDiscord<konsumlamm> no, i'm saying that you can use them to implement new "language features"
11:03:31FromDiscord<konsumlamm> In reply to @konsumlamm "anyway, i have some": it also only happens when run in the VM
11:04:24*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
11:07:20FromDiscord<konsumlamm> but not when i extract the call that fails...
11:10:03PMunchDo we know who created the original Nim badger?
11:10:08PMunchI think I've asked this before..
11:10:36arkanoidthe point that keeps me from using nim (that I do anyway) is that there are advanced features that you want to use, but then the same features are the source of wrong behaviours and so general guidelines want you sto stick with easier code
11:11:01arkanoidso you end up doing things in defensive mode
11:16:23PMunchThe problem is that the advanced features aren't used as often, so you might just do something that has never been tried before, and which no-one anticipated during the design of that feature
11:17:01PMunchMost workarounds seems to be just doing it the way the feature was designed to work
11:17:50PMunchWhich is still bad though
11:18:24arkanoidyes
11:18:53PMunchTo be fair, after having used Nim for quite a while I tend to run into fewer and fewer bugs
11:19:17PMunchProbably because I program more the way Nim was intended to be programmed, but still
11:19:58arkanoidif foo.nim is a nim file that doesn't compile, but it is `include`d in bar.nim that compiles correctly, is foo.nim still considered a "module" according to docs? or just bar.nim is?
11:21:58PMunchGood question
11:22:12PMunchDepends on what you mean by "according to docs"
11:22:31FromDiscord<hmmm> meh the comparisons with rust are always unfair they have 10x-100x times the eyeballs and possibly 100x - 1000x funding, wtf are we talking about 🧐
11:23:38PMunchI mean it's still fair to critique Nim for having unstable features
11:24:13PMunchARC is still a bit experimental, which is why it isn't the default
11:25:36PMunchI ran --expandArc on @konsumlamm's example
11:25:37PMunchhttp://ix.io/3NFk
11:25:39FromDiscord<hmmm> meh, if you use incredibly niche comfy lang, you should calibrate your expectations accordingly. It's obvious nim can't have the battle testing and mileage to iron the rough edges
11:26:02PMunchIt looks like b is turned into a cursor, then it is assigned to c and c is promptly destroyed
11:26:28*adigitoleo quit (Quit: adigitoleo)
11:27:04PMunchIf you scope 'c' to be outside the loop it works fine
11:27:22PMunchLike so: http://ix.io/3NFl
11:27:26arkanoidhmmm, yes, but no. There's line between experimental and not experimental, and nim does have this line, but silent bugs on simple tests are also before this line
11:27:34PMunchBut this is of course a bug
11:28:07arkanoidbtw: I still consider nim the best language ever
11:28:39FromDiscord<Rika> Y’all let’s all become rich and fund Nim to explosion
11:31:33PMunchDidn't Nim recently get a huge chunk of donations?
11:34:15arkanoidPMunch: are you referring to the 100K in bitcoin?
11:36:19PMunchYup
11:37:02PMunchI guess those depreciated massively recently..
11:37:15PMunchHopefully they took my advice and invested some
11:37:26FromDiscord<Rika> Well if it wasn’t converted
11:37:38FromDiscord<Rika> Though USD has been dropping too I assume
11:40:36FromDiscord<Rika> I assume?? I mean I think
11:42:25FromDiscord<Tanguy> Seems to be sitting here https://www.blockchain.com/btc/address/1BXfuKM2uvoD6mbx4g5xM3eQhLzkCK77tJ
11:43:34FromDiscord<Tanguy> Seems to be sitting here https://www.blockchain.com/btc/address/bc1qzgw3vsppsa9gu53qyecyu063jfajmjpye3r2h4
11:45:10FromDiscord<Rika> F
11:46:42FromDiscord<Forest> In reply to @Forest "Oh i forgot about": Added the shell_minimal.html file, but got this error: https://www.toptal.com/developers/hastebin/wunokirihe.nim
11:47:12FromDiscord<Forest> I don't know how to fix the android-glob error but i don't have any other device with emscripten
11:47:37szahidDo you know some good CMS for documentation?
11:49:15*k0mpjut0r joined #nim
11:56:58PMunchszahid, I use CouchCMS for my website, it's pretty neat
11:57:08PMunchBut I'm going to try out HTMX for some stuff soon
12:00:32*k0mpjut0r quit (Quit: ZNC 1.7.2+deb3 - https://znc.in)
12:00:49*k0mpjut0r joined #nim
12:42:31FromDiscord<Forest> Anyone? :p
12:57:28Amun-Ranope
12:58:49FromDiscord<Forest> Rip
13:01:15PMunch@Forest, well you need that library in a path where wasm-ld can find it
13:05:13FromDiscord<Forest> Does it not use my normal library path?
13:05:27FromDiscord<Forest> How would i allow emscripten to see it?
13:07:59PMunchI've got no idea what wasm-ld uses
13:08:12PMunchI assume it uses the normal library path
13:08:32FromDiscord<Forest> Hm then there should be no issue :/
13:38:36*rockcavera joined #nim
13:38:36*rockcavera quit (Changing host)
13:38:36*rockcavera joined #nim
13:52:06l1xis there a https library / option for import asynchttpserver, asyncdispatch
14:18:05FromDiscord<mratsim> In reply to @Rika "F": Araq had the key on a discarded disk and is now looking for it in a dump.
14:18:14FromDiscord<Rika> oh god
14:18:28FromDiscord<Rika> i feel like ive heard this before but forgot
14:19:28FromDiscord<mratsim> posting in #offtopic
14:44:58*arkurious joined #nim
14:54:37FromDiscord<Tanguy> sent a code paste, see https://play.nim-lang.org/#ix=3NG7
14:57:49FromDiscord<Clonkk> I think `collect` does something like this ?↵(@Tanguy)
14:58:32FromDiscord<Clonkk> https://nim-lang.org/docs/sugar.html#collect.m%2Cuntyped
15:00:51*PMunch quit (Quit: leaving)
15:17:22*cornfeedhobo quit (Remote host closed the connection)
15:29:20arkanoidwhich options do I have to solve the circular dependency problem in nim? I know: A) bundle everything in single module B) forward declarations, else?
15:29:48*cornfeedhobo joined #nim
15:30:17FromDiscord<dom96> put all your types in a types.nim file
15:31:23FromDiscord<mratsim> In reply to @arkanoid "which options do I": mixin
15:32:05FromDiscord<mratsim> sometimes you can put your imports after the proc needed for the dependency in the other module are defined.
15:33:15arkanoidmratsim, mixin as in C++ mixin?
15:33:56FromDiscord<mratsim> Nim mixin
15:34:18FromDiscord<mratsim> only works in generics or templates though
15:34:42FromDiscord<mratsim> basically it tells the compiler "don't try to look for this symbol now, the caller will have it in its scope"
15:40:18FromDiscord<Phil> Is there a way to get nim to shut up about circular dependencies every time I import db_sqlite >_> ?
15:40:27FromDiscord<Phil> (edit) ">_>" => ">\_>"
15:40:42arkanoidmmmm ok
15:52:59Zevvarkanoid: the ciruclar dependency problem has been my main issue with nim for a long time - every time I try to make a decent sized project in Nim, I run into this. It's hard to keep modules decoupled end you do end up with one single file with dozens of type definitions.
15:53:19ZevvI've heard rumours that there is work done on this, but I'm not aware of any other solutions yet
15:53:45ZevvPeople usally say my code is bad if I need circular types
15:53:56Zevvso it must be me.
15:55:00arkanoidyeah, it's bad design usually, but here I'm trying to refactor a nim library that is done in the "one huge module with dozen of forward declarations"
15:56:13ZevvI'd even argue against the bad design - it's pretty common to have things pointing at each other. I have a thing containing things, and I want the individual things to be able to point to the thing they're in. It's a pretty common pattern. C offers simple opaque types for that, but in Nim this is a pita
15:56:52Zevvfor the forward declarations, you might get away with enabling code reordering, experimental feature. Usually works just fine for me
15:57:00Zevvbut not with types, only with functions
15:57:38Amun-Rayou can have forward-alike type declarations in the same type block
15:57:47arkanoidyes but code reordering seems to not work between nim modules "include"'ing each other "not import"
15:57:51Zevvyes, that's the restriction. The same type block
15:58:16arkanoidI already have all types in single `type` bock, problem are procs
16:00:16Zevvanyway, this is an old problem that keeps coming up every so often. iirc there's an rfc somewhere about it, you might want to poke that
16:00:50Zevvhttps://github.com/nim-lang/RFCs/issues/6 2016
16:00:57Amun-Ra#6
16:04:17arkanoidyeah, been there in the last months, yet there's no solutions
16:04:25FromDiscord<hmmm> I thought the general solution people used was matrioska boxes? A is the boss and imports whatever it wants, B is miniboss, imports whatever except from A, C is working class, no A and B but can import D and D is peon and cannot import from anyone 🤔
16:04:44Zevvsoftware architecture is not always a nice tree
16:04:49FromDiscord<hmmm> hmm
16:04:51Zevvsometimes it's a graph. bidirectional
16:06:28FromDiscord<hmmm> the last time I had the problem I tried to make a module just for the imports but it didn't work so I had to change a bunch of code to fit the matrioska model
16:07:36Zevvthe last time I had the problem I decided to drop nim for a while
16:07:41FromDiscord<hmmm> haha
16:08:10arkanoidThe extreme case I'm dealing with sees a single main .nim file doing "include" of a dozen others, and one is "types.nim". Code is full or forwarding declarations. I'm trying to make things better, but apparently this is the only solution
16:08:24Zevvyes
16:09:02arkanoidand this sucks
16:09:08FromDiscord<hmmm> yea honestly it's probably the worst thing happened to me in my smol nim experience. Since nim usually gets nicely out of the way it was strange I had to change a bunch of code to fit nim
16:11:32arkanoidsigh, this means that I'm doomed to fail in my effor to make things better
16:12:36FromDiscord<enthus1ast> i had good experience with splitting everything even more
16:12:49FromDiscord<enthus1ast> so for every module i also created a types file
16:13:01FromDiscord<enthus1ast> foo.nim ; typesFoo.nim
16:13:22FromDiscord<enthus1ast> that whay you can use typesFoo.nim where you just need the typdefs from this module
16:13:37arkanoidenthus1ast: you do import or include?
16:13:46FromDiscord<enthus1ast> and i made it so that importing foo.nim also exports typesFoo.nim for convenience
16:13:47FromDiscord<enthus1ast> import
16:14:22arkanoidI don't see how this can fix the circular depedency problem
16:15:01FromDiscord<enthus1ast> what are you circular dependencies=
16:15:02FromDiscord<enthus1ast> ?
16:16:24arkanoidmodule foo has "proc fooProc = barProc()" and module bar has "proc barProc = fooProc()"
16:16:49arkanoidif you import bar in foo, and foo in bar, you end up with something that won't compile
16:17:35FromDiscord<enthus1ast> if these modules are so intertwinded, maybe they are no different modules but belong to one?
16:18:35FromDiscord<enthus1ast> or maybe you could have them import a non intertwined "implementation" module
16:22:05arkanoidalso, the "one file with all types" solution is not possible if you're using finalizers: "Error: type bound operation `delete` can be defined only in the same module with its type"
16:23:42arkanoidit's a chain reaction that drives to not use import at all
16:26:25Zevvyour code is bad and you should feel bad
16:29:02arkanoidI do
16:40:41FromDiscord<mratsim> finalizers?
16:40:53FromDiscord<mratsim> with ref objects?
16:41:11FromDiscord<mratsim> one file with many types isn't too bad.
16:42:01FromDiscord<mratsim> @Zevv agree on the cyclic import part. Sometimes you refactor and it rears its ugly head and then what you thought was a nice evening now becomes just painful copy-pasta night
16:47:33Zevvright. it kind of ruined the fun of programming Nim for me on the last largish project I did, so for the thing after I moved back to C++
17:03:50FromDiscord<Phil> Say I want to express in a proc that if you pass it a given variable as parameter, that memory is now owned by the proc, you don't get to have access to it anymore. How do I annotate this?↵Connection shall now be owned by recycleConnection if it is being used↵`proc recycleConnection(connection: DbConn) {.gcsafe.} =`
17:04:12FromDiscord<Phil> DbConn is a pointer of the Sqlite3 type
17:04:48FromDiscord<Phil> (edit) "anymore." => "anymore outside of the proc." | "anymore outside of the proc.How do I annotate ... this?↵Connection" added "this? Can I even do"
17:14:27FromDiscord<Phil> I found "https://nim-lang.org/docs/destructors.html"↵Which says to use `sink` to ↵`proc recycleConnection(connection: sink DbConn) {.gcsafe.} =`↵I mostly want to be on the safe side that I'm understanding this correctly
17:23:05arkanoidwhat's the meaning of "type Bar" in "proc test(foo: type Bar)"? I know "proc test[T]" and "proc test(foo: typedesc)"
17:24:44FromDiscord<michaelb> In reply to @arkanoid "what's the meaning of": might more often be expressed like `proc test(T: type Bar)`, and you can invoke it with `Bar.test`
17:26:27FromDiscord<michaelb> a use case is defining init proc for a type, involving logic and default param values that you don't get by calling `Bar()` directly
17:26:47FromDiscord<michaelb> `proc init(T: type Bar, ...): T`
17:26:54FromDiscord<Rika> same as typedesc[Bar] i believ
17:26:55FromDiscord<Rika> (edit) "believ" => "believe"
17:27:03FromDiscord<Rika> in this case
17:27:34FromDiscord<Rika> type in proc signature -> typedesc↵type in proc body -> typeof
17:28:24FromDiscord<michaelb> (edit) "...): T`" => "a = 123, b = "stuff"): T = Bar(a: a, b: b)`"
17:29:41arkanoidok, thanks. I do know the init based on typedesc[MyType] so I'm ok with it. the problem with "type Bar" in my context is that I'm getting a circular dependency warning in the code I'm trying to refactor, here: https://play.nim-lang.org/#ix=3NH9
17:30:20arkanoidI don't see where the circular dependency is, basically
17:30:35FromDiscord<michaelb> if I'm wrapping a C lib with a function with a parameter of type `wchar_t`, what's the best thing to do? Nim's system lib doesn't have an alias for `wchar_t` and it's not cleary to me if I std/widestrs provides a way to deal with it
17:30:52FromDiscord<michaelb> (edit) "cleary" => "clear"
17:31:00FromDiscord<michaelb> (edit) removed "I"
17:44:40FromDiscord<Shiba> why does nim generates those .o files https://media.discordapp.net/attachments/371759389889003532/936315788237897728/Capture.PNG
17:45:04FromDiscord<Rika> ? because C generates them
17:45:39FromDiscord<Shiba> the c compiler ?
17:46:13FromDiscord<Rika> yeah
17:48:52FromDiscord<Shiba> why?
17:48:56FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3NHk
17:49:41FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=3NHk" => "https://play.nim-lang.org/#ix=3NHl"
17:52:15FromDiscord<Shiba> In reply to @Rika "yeah": is there a configuration to stop generating those object files
17:52:22FromDiscord<Rika> uh no
17:52:27FromDiscord<Rika> well maybe
17:52:29FromDiscord<Rika> but why?
17:53:25FromDiscord<tandy> is a `var object` allowed?
17:56:14FromDiscord<konsumlamm> did you try it?
17:56:41FromDiscord<tandy> im geting this error↵`Error: invalid type: 'MatrixClient' for var`
17:57:54FromDiscord<mratsim> In reply to @Isofruit "Hmmm my test fails": I think sink is a type-bound operation, you need to create your own type that wraps int in that case if you want destructors to work.
17:58:29FromDiscord<Phil> In reply to @mratsim "I think sink is": Wouldn't my second example with `myType` qualify for that?
18:02:02FromDiscord<tandy> hmm nvm
18:12:08*noeontheend joined #nim
18:22:18*wsantos joined #nim
18:25:31*wsantos quit (Client Quit)
18:26:11FromDiscord<Goel> Does the compiler doesn't warn anymore in case of unused variables?
18:30:44FromDiscord<Phil> It still warns you, believe me, it very much still does
18:31:46FromDiscord<Goel> Uhm no doesn't (in case of a global var i mean)
18:32:04*kayabaNerve quit (Ping timeout: 250 seconds)
18:33:48FromDiscord<Phil> Ah, for a global variable, hmm
18:34:08FromDiscord<Goel> sent a code paste, see https://play.nim-lang.org/#ix=3NHA
18:34:25FromDiscord<Phil> complain = error for you?
18:34:36FromDiscord<Goel> (edit) "https://play.nim-lang.org/#ix=3NHA" => "https://play.nim-lang.org/#ix=3NHB"
18:35:04FromDiscord<Goel> Yeah i suppose in past that was a Warning, not a soft Hint, but i may be wrong
18:36:13FromDiscord<Phil> I'd count the hint as complaining, different terminology then↵`/home/isofruit/dev/tinypool/src/tinypool/pool.nim(176, 7) Hint: 'a' is declared but not used [XDeclaredButNotUsed]`
18:36:31FromDiscord<Phil> (edit) "I'd count the hint as complaining, different terminology ... then↵`/home/isofruit/dev/tinypool/src/tinypool/pool.nim(176," added "usage"
18:40:00arkanoidhow can I get more info on this error? it points to internal code. " Error: cannot bind another '=destroy' to: QObject:ObjectType; previous declaration was constructed here implicitly: /home/jack/.choosenim/toolchains/nim-1.6.0/lib/system/arc.nim(210, 7)"
18:41:01*jjido joined #nim
18:52:51*neceve joined #nim
18:57:23*noeontheend quit (Ping timeout: 268 seconds)
18:58:18FromDiscord<Yardanico> some code is defining a destructor for that type after it was initialized in code
18:58:28FromDiscord<Yardanico> so that custom destructor conflicts with the default Nim one
18:59:13FromDiscord<Yardanico> you should place the destructor declaration for that type right after it is declared before it's used
19:04:59*krux02 joined #nim
19:10:52NimEventerNew Nimble package! tinypool - A minimalistic connection pooling package, see https://github.com/PhilippMDoerner/TinyPool
19:18:20FromDiscord<Phil> Pool, I can finally... install my own package!
19:18:26FromDiscord<Phil> (edit) "Pool," => "Cool,"
19:22:47*vicfred joined #nim
19:28:18*jmdaemon quit (Ping timeout: 256 seconds)
19:29:16FromDiscord<Forest> Anyone know of a wasmtime binding for Nim?
19:31:14NimEventerNew post on r/nim by DrSalewski: First draft of the async/await chapter is now finally available, see https://reddit.com/r/nim/comments/se6h0x/first_draft_of_the_asyncawait_chapter_is_now/
19:32:20FromDiscord<Forest> Also why does Nim not use the C types? Why does it provide it's own layer over it?
19:32:45FromDiscord<Forest> (`cint` vs `int`, `cstring` vs `string`)
19:39:07FromDiscord<mratsim> In reply to @Forest "Also why does Nim": cint are int32, we use the machine pointer size.
19:39:18FromDiscord<mratsim> cstring are slow because they don't have the length.
19:54:09*neurocyte0917090 joined #nim
20:00:16*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
20:08:17*PMunch joined #nim
20:11:48FromDiscord<no name fits> So I was trying to make a program that could calculate the probability of getting m unique faces with n amount of dice that has k number of faces. Someone told me the formula for it would be something like↵`1/k^n k!/(k-m)! S(n,m)` where S is the Stirling partition of the second degree, and I'm completely lost on how to approach this
20:12:53*jmdaemon joined #nim
20:13:08FromDiscord<Forest> In reply to @mratsim "cint are int32, we": Ah okay
20:15:56NimEventerNew thread by Leccine: Is there a HTTPS enabled HTTP server in Nim?, see https://forum.nim-lang.org/t/8849
20:18:10*jmdaemon quit (Ping timeout: 256 seconds)
20:27:44FromDiscord<xx_ns> huh
20:28:15FromDiscord<xx_ns> the nim forum told me "You can change anyone's rank! With great power comes great responsibility" or something like that
20:28:18FromDiscord<xx_ns> even though i just registered
20:28:40FromDiscord<xx_ns> could set my rank to be Troll, Admin, whatever
20:28:46FromDiscord<xx_ns> disappeared when i refreshed the page
20:28:51FromDiscord<xx_ns> should probably get that looked at
20:36:07arkanoidis it possible to partially compile a module that calls forward declarations, and link the real procs later on?
20:42:29arkanoidI mean, compile a file with declarations but no implementations
20:52:55FromDiscord<Elegantbeef> I do not think so
20:55:01arkanoidI'm stuck in an uroboro of nim code where I can't find a better solution that putting everything in a single huge nim module
21:00:13FromDiscord<Elegantbeef> You can do recursive imports if you structure them properly, it just takes know how
21:01:34FromDiscord<Elegantbeef> I forget how to explain how to structure them
21:10:48FromDiscord<Forest> https://haste.powercord.dev/exeguqahax.sql anyone able to help? I have no idea how to actually fix this
21:12:53FromDiscord<Yardanico> That's a bug of the termux-patched nim
21:13:05arkanoidEleganbeef, my recipe for disaster is: A "type bound operation `delete` must be defined in the same module with its type", so "proc newFoo(): Foo = new(result, delete); result.setup()" has to be put in same module as "type Foo", but if "proc setup(foo: Foo)" does any logic that requires other modules, it creates spaghetti code
21:13:08FromDiscord<Yardanico> They added that landroid-glob to the Nim config file so it always applies
21:13:13FromDiscord<Yardanico> Even when cross compiling
21:13:57FromDiscord<Yardanico> https://github.com/termux/termux-packages/blob/master/packages/nim/build.sh#L38
21:14:04FromDiscord<Yardanico> The seds they're doing are too broad
21:17:25arkanoidI picked nim to escape from python's difficulties when project size reaches a point, but I'm now facing the reality that also nim is no ready for large projects
21:18:01*jjido joined #nim
21:33:57FromDiscord<Phil> Beeeeeeef
21:37:23FromDiscord<Phil> If you've got any clue about this one I'll be very happy to hear it: https://discord.com/channels/371759389889003530/371759389889003532/936316844040650842
21:39:16FromDiscord<Forest> In reply to @Yardanico "That's a bug of": Rip
21:39:44FromDiscord<Forest> Aight guess i'ma just try editing the config
21:40:37FromDiscord<Forest> Where will Nim's global config be in?
21:42:10FromDiscord<Forest> Or will i have to recompile Nim from scratch?
21:42:17PMuncharkanoid, you can use Nim for large projects. But you might have to leave some patterns you're used to in other languages behind
21:42:54FromDiscord<Phil> I was not familiar with calling a setup proc after initialization
21:42:58FromDiscord<Phil> What logic do you put in that?
21:47:17FromDiscord<kevin> sent a code paste, see https://play.nim-lang.org/#ix=3NIq
21:47:54FromDiscord<kevin> my lib loads fine mac/linux but Windows gives: `could not load: .\threadtest.dll`
21:48:50FromDiscord<kevin> sent a code paste, see https://play.nim-lang.org/#ix=3NIr
21:50:30PMunchHmm, have you tried having a forward slash?
21:50:34PMunchJust curious
21:50:42FromDiscord<kevin> yeah, same result
21:50:48FromDiscord<Elegantbeef> remove the relative path
21:51:23FromDiscord<kevin> i also tried full path. are you saying just `threadtest.dll` instead of `.\threadtest.dll` ?
21:51:54FromDiscord<Elegantbeef> Yes
21:52:54FromDiscord<kevin> `could not load: threadtest.dll`
21:53:16PMunchIs it a loadable DLL?
21:53:27PMunchI don't know how to debug this kind of stuff on Windows..
21:54:00FromDiscord<kevin> well I think it should be loadable...
21:54:11FromDiscord<kevin> It is loadable on mac and linux
21:54:18FromDiscord<Elegantbeef> @Phil\: what do you expect to happen?
21:54:53FromDiscord<kevin> sent a code paste, see https://play.nim-lang.org/#ix=3NIs
21:54:59*Gustavo6046 joined #nim
21:55:02FromDiscord<kevin> (edit) "https://play.nim-lang.org/#ix=3NIs" => "https://play.nim-lang.org/#ix=3NIt"
21:55:17FromDiscord<Phil> What I'm trying to find is a way that makes the code above explode when one tries to use the variable `i` whose "posession" I want to move into the proc
21:55:27FromDiscord<Elegantbeef> Nim's sink semantics copy if it cannot move
21:56:34FromDiscord<Phil> And it can't move because I access the variable outside of the proc so it says "well, I want this program to be valid, so can't move, have to copy" ?
21:56:40FromDiscord<Elegantbeef> You make the copy an error and it'll do that
21:57:18FromDiscord<Elegantbeef> https://github.com/nim-lang/RFCs/issues/432 there are some solutions here
21:58:06FromDiscord<Phil> Check, I'll likely check those out tomorrow after getting some sleep.↵The fundamental reason why I want this is for my tinypool package again.↵After you recycle a connection back into the pool I don't want you to be able to use that connection anymore until you borrow the next one
21:58:07FromDiscord<Elegantbeef> Yes
21:58:14FromDiscord<Elegantbeef> Nim's move semantics copy when a move cannot be made
21:58:35FromDiscord<Elegantbeef> It's an intelligent and also annoying thing
21:58:48FromDiscord<Phil> (edit) "anymore until you" => "anymore.↵You shall have to"
21:59:36FromDiscord<Elegantbeef> The annoying part is you cannot disable it per scope presently
21:59:36FromDiscord<Elegantbeef> You can emit hints or make it an error globally but not locally
21:59:36FromDiscord<Phil> I guess it allows you to have things be simple 90% of the time and the remaining 10% are a bit harder because of it
22:00:27FromDiscord<Elegantbeef> Imo there should be a mechanism to disable implicit copies
22:00:40FromDiscord<Elegantbeef> You can also explicitly move if you want
22:02:01FromDiscord<Phil> Would that do what I'm describing? Make the code above explode as desired?
22:02:10*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
22:05:40FromDiscord<Elegantbeef> Yea there should be a `{.forceSink.}:` or similar that does not allow usage after moving
22:07:38FromDiscord<Tetralux> sent a code paste, see https://play.nim-lang.org/#ix=3NIz
22:07:48FromDiscord<Tetralux> (edit) "https://play.nim-lang.org/#ix=3NIz" => "https://play.nim-lang.org/#ix=3NIA"
22:08:02FromDiscord<Tetralux> (edit) "https://play.nim-lang.org/#ix=3NIA" => "https://play.nim-lang.org/#ix=3NIB"
22:08:06FromDiscord<Phil> In reply to @Elegantbeef "Yea there should be": Ohhhh a pragma. I was experimenting forever with `move` and whether that would have ot be called in the proc body, or the proc signature or whatever
22:08:23FromDiscord<Phil> Likely not called forceSink since that doesn't compile on the playground, but I'll look for a pragma
22:08:41FromDiscord<Phil> Example: https://play.nim-lang.org/#ix=3NIC
22:10:46FromDiscord<Phil> There's nodestroy, there's nosink, but no forceSink.↵It describes that you can make the `=copy` hook error out, which is useful sorta, but that's not the issue I'm trying to solve, hmmm
22:11:12FromDiscord<Elegantbeef> There isnt a way yet
22:11:24FromDiscord<Elegantbeef> you can do `iSinkKSth(move t)`
22:12:04FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3NIE
22:12:16FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3NIF
22:12:28FromDiscord<Elegantbeef> Nah tetralux there is a way to error copy
22:13:14FromDiscord<Tetralux> Hmm.
22:13:17FromDiscord<Phil> Waaaaait a sec, when you move the memory it leaves behind a "default" string (aka just "") ? huh
22:13:32FromDiscord<Elegantbeef> Yes it 0's the moved data
22:13:42FromDiscord<Elegantbeef> Matrix bridge slow so i look crazy
22:14:18FromDiscord<Phil> Hmmmmmm
22:15:02FromDiscord<Elegantbeef> What you could do iso is make a template that calls a procedure which forces a `move`
22:15:37FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3NIG
22:15:39FromDiscord<kevin> In reply to @kevin "Got a question about": Figured out that it fails to load the DLL if the Nim DLL is compiled with `--threads:on`
22:15:53FromDiscord<kevin> booo
22:16:02FromDiscord<Phil> In reply to @Elegantbeef "What you could do": OHHHH and then the templates could be public, while the procs are private!
22:16:18FromDiscord<Phil> No wait, the procs also need to be public so that the template can compile
22:16:27FromDiscord<ElegantBeef> No they dont
22:16:38FromDiscord<ElegantBeef> templates hold onto symbols
22:16:40FromDiscord<Phil> It's enough if they're in the template's context?
22:16:42FromDiscord<Phil> Nice!
22:18:06FromDiscord<Phil> I already have a "proc calls inner proc" setup where public `borrowConnection()` calls private `borrowConnection(POOL)` so that I can hide the global POOL variable, this fits perfectly into that, I just swap the outer `proc borrowConnection()` into a `template borrowConnection()`
22:20:34*neceve quit (Ping timeout: 256 seconds)
22:20:37*jjido joined #nim
22:25:11*jjido quit (Client Quit)
22:29:37*noeontheend joined #nim
22:37:57*noeontheend quit (Ping timeout: 240 seconds)
22:45:13FromDiscord<tandy> any big brained async users around?
22:46:21FromDiscord<Elegantbeef> Uh oh you fell for the "Is anyone around that does X" instead of just asking the issue
22:46:26FromDiscord<Elegantbeef> 0/10 tandy reporting to you satan
22:46:43FromDiscord<tandy> smh
22:47:27FromDiscord<tandy> sent a code paste, see https://play.nim-lang.org/#ix=3NIN
22:47:37FromDiscord<tandy> i can't understand why this doesnt work
22:48:03FromDiscord<tandy> sent a code paste, see https://paste.rs/OBX
22:48:24FromDiscord<tandy> sent a code paste, see https://play.nim-lang.org/#ix=3NIP
22:49:07FromDiscord<Elegantbeef> Shouldnt that be `waitFor` since it's inside the main loop?
22:49:38FromDiscord<tandy> hmm ok that works
22:50:14FromDiscord<tandy> but I don't get how to program around not having `waitFor` in js
22:50:39*jjido joined #nim
22:52:30FromDiscord<noow> is there a super simple way to create a string out of an array of bytes of known length but no zero terminator?
22:54:09FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3NIU
22:54:14FromDiscord<noow> thank you
22:54:22FromDiscord<Elegantbeef> Or is it just `newString(arr.len)`
22:54:24FromDiscord<Elegantbeef> I always forget
22:55:13FromDiscord<Elegantbeef> Alternatively you can just iterate over the collection and assign the values
22:55:24FromDiscord<noow> I prefer copyMem
22:58:52FromDiscord<noow> sent a code paste, see https://play.nim-lang.org/#ix=3NIV
23:09:49*jmdaemon joined #nim
23:18:01PMunchUgh, I have to go to bed. Ten points to whoever manages to make the prettiest looking documentation template with pico.css by the time I get back :P
23:18:59PMunchI'm basically writing documentation for a project I'm working on, mostly guides with code samples, but it needs like a sidebar menu and somewhere to put my Nim-generated documentation.
23:19:14PMunchBonus points for using few extra CSS rules
23:19:20PMunchGood night
23:19:21*PMunch quit (Quit: leaving)
23:19:52FromDiscord<Elegantbeef> Cmon why not nimibook?
23:21:19*jmdaemon quit (Ping timeout: 268 seconds)
23:24:15FromDiscord<pmunch> Seems complicated.. But I guess it does fit what I need to do
23:31:14FromDiscord<mratsim> In reply to @Elegantbeef "Yea there should be": isn't there a warning? maybe we can turn it into an error
23:32:57FromDiscord<Elegantbeef> I go into why it doesnt work inside that RFC
23:33:13FromDiscord<Elegantbeef> destructors do not respect pragma scope so you cannot turn it into an error locally
23:34:47FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/ihA
23:34:50FromDiscord<Elegantbeef> That does not work as one expects
23:35:24FromDiscord<Elegantbeef> The hint is toggled off in the first pass and then destructors dont re-enable the hint/error
23:35:59FromDiscord<Elegantbeef> Araq says it's the push/pop but even with explicit pragma's it doesnt owrk
23:39:40FromDiscord<evoalg> In reply to @Elegantbeef "0/10 tandy reporting to": You're calling tandy satan and you're reporting to them now?
23:40:13FromDiscord<Elegantbeef> No i'm calling myself dumb and incapable of writing words in order i intend them to be
23:40:35FromDiscord<Elegantbeef> God dammit i've broke my git instance again
23:41:13FromDiscord<evoalg> tandy, I'm also reporting to you, satan
23:41:20FromDiscord<tandy> fair
23:41:26FromDiscord<tandy> async programming is devilish
23:41:47FromDiscord<evoalg> tandy did you see the new chapter in the book re async?
23:41:57FromDiscord<tandy> yes
23:42:06FromDiscord<tandy> useful
23:42:21FromDiscord<evoalg> http://ssalewski.de/nimprogramming.html#_code_execution_with_asyncawait ... ok
23:42:29FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/936405837444939836/image.png
23:42:30FromDiscord<Elegantbeef> Cursed git
23:43:40FromDiscord<tandy> ok this is based i just read it properly↵(@evoalg)
23:43:55FromDiscord<tandy> this just means i need to finish this PR
23:43:58FromDiscord<tandy> https://github.com/juancarlospaco/nodejs/pull/4
23:44:07FromDiscord<tandy> so i never have to touch async again
23:44:26FromDiscord<tandy> because js will have a proper ish httpclient
23:44:51*jmdaemon joined #nim
23:45:32FromDiscord<evoalg> I haven't read it, and I've never tried async
23:45:34*rlp10 quit (Ping timeout: 256 seconds)
23:46:54FromDiscord<tandy> the main reason im forced to use async is because im working with js backend and the api bindings im writing only support jsfetch which is async
23:47:04*Lord_Nightmare quit (Quit: ZNC - http://znc.in)
23:47:13FromDiscord<tandy> so with this i can refactor the bindings and use sync xmlhttprequest \>\:)
23:50:37FromDiscord<evoalg> In reply to @arkanoid "I picked nim to": which language will you try next?
23:51:13*Lord_Nightmare joined #nim
23:53:07*rlp10 joined #nim
23:58:33FromDiscord<Elegantbeef> Arkanoid i'd happily take a look at your code to see if it can be broken up nicely
23:59:55FromDiscord<Elegantbeef> Nim does support recursive imports if you declare them properly