<< 23-04-2022 >>

00:23:37*vicfred quit (Quit: Leaving)
01:14:00*neurocyte8614492 quit (Ping timeout: 276 seconds)
01:39:25NimEventerNew Nimble package! ruby - Bindings for libruby and high-level Ruby embedding framework, see https://github.com/ryukoposting/ruby-nim
01:46:16*arkurious quit (Quit: Leaving)
01:58:39madpropshttps://stackoverflow.com/questions/71976217/does-any-change-in-an-array-gets-to-change-the-entire-array
01:59:43FromDiscord<huantian> is this a JavaScript question?
01:59:58madpropshe asks about other languages
02:00:11FromDiscord<Rika> did i miss a question
02:00:40madpropswondering how that works in javascript and in nim
02:01:10FromDiscord<Rika> you? or the asker? the asker only mentions js
02:01:28madprops"Does it change radically from one language to another?"
02:37:22*Zectbumo joined #nim
03:40:37FromDiscord<Yardanico> heh, checked today and prologue is crashing with arc/orc
03:40:42FromDiscord<Yardanico> apparently for some reason they have `cursor` for a proc field
03:40:47FromDiscord<Yardanico> at least it's not an arc bug :P
03:42:31*duuude joined #nim
03:53:08FromDiscord<Elegantbeef> "for a proc field"
03:53:27FromDiscord<Elegantbeef> The hell is the point of that
03:53:48FromDiscord<Yardanico> đŸ€·
03:54:13FromDiscord<Elegantbeef> aliasing is the same cost as cursor inference for that 😄
03:54:22FromDiscord<Yardanico> maybe someone working on prologue was trying it with ARC and saw the warning that the compiler gives when it finds a cycle with that proc field
03:54:30FromDiscord<Yardanico> and added the cursor pragma as the compiler suggests
03:54:56FromDiscord<Elegantbeef> Odd
03:55:24FromDiscord<Elegantbeef> We're talking about the field being a pointer proc right?
03:55:29FromDiscord<Yardanico> yes
03:55:37FromDiscord<Yardanico> https://github.com/planety/prologue/pull/162
03:55:50FromDiscord<Yardanico> not just a proc pointer, but a closure pointer specifically
03:56:32FromDiscord<Elegantbeef> I guess there's a chance there, but odd
04:04:53FromDiscord<huantian> thinking about <https://github.com/nim-lang/Nim/issues/5021>, trying some stuff https://media.discordapp.net/attachments/371759389889003532/967274836441333760/unknown.png
04:05:05FromDiscord<huantian> honestly wonder if it should be renamed to "handling futures" or something
04:05:14FromDiscord<Yardanico> @ElegantBeef this is the exact warning the compiler gives with ARC btw:
04:05:15FromDiscord<Yardanico> "/home/dian/.nimble/pkgs/prologue-#head/prologue/core/beast/server.nim(25, 22) Warning: ':env.app1.startupClosure = (doStartup, :env)' creates an uncollectable ref cycle; annotate 'app1' with .cursor"
04:05:20FromDiscord<Yardanico> i guess some people might get confused by it
04:05:48FromDiscord<huantian> (edit) "stuff" => "stuff↔~~not my first issue but it's been open for too long heh~~"
04:05:53FromDiscord<Yardanico> In reply to @huantian "honestly wonder if it": noticed a typo there :P
04:05:56FromDiscord<Yardanico> "proceudres"
04:06:03FromDiscord<huantian> ah thanks
04:06:12FromDiscord<Rika> French word for procedures
04:06:18FromDiscord<Rika> I don’t actually know
04:06:28FromDiscord<Yardanico> good joke, but it's not actually
04:06:28FromDiscord<huantian> I need to turn on autocorrect for comments or something
04:08:43FromDiscord<Yardanico> yeah someone should check for typos in docs once in a while
04:08:48FromDiscord<huantian> wondering if I should add things like↔"Usually `waitFor is used as an entry point to asynchronous code from synchronous code" or if that's obvious or belongs in a different place
04:09:05FromDiscord<huantian> But I do wanna have some kind of waitFor vs await vs asyncCheck somewhere in the docs
04:09:11FromDiscord<Yardanico> i mean it's never bad to add this into the docs
04:09:24FromDiscord<Yardanico> some people want docs to cover everything from the simplest things, so it wouldn't hurt :)
04:09:43FromDiscord<huantian> personally when I just started I had no idea when to use which
04:09:48FromDiscord<Yardanico> but sometimes you use runForever instead of waitFor as well
04:10:07FromDiscord<Yardanico> especially if the whatever async library you're using doesn't give you a future you can waitFor for (pun not intended )
04:10:53FromDiscord<Elegantbeef> I mean there needs to be some docs on how to use async from non async
04:12:14FromDiscord<Elegantbeef> Like i refactored my game project's ipc to use async now that i learned you can just do `poll(0)` at the end of a frame
04:12:52FromDiscord<Yardanico> are you using async for IO?
04:13:03FromDiscord<Elegantbeef> Yea IPC
04:13:10FromDiscord<Yardanico> oh
04:14:11FromDiscord<Elegantbeef> My troll rika logic here
04:14:13FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/967277188330180638/image.png
04:14:42FromDiscord<huantian> Beef: says `addCallback`↔Rika: dies
04:14:50FromDiscord<Elegantbeef> Pretty much
04:15:27FromDiscord<Rika> I mean whatever
04:19:56FromDiscord<huantian> slightly tweaked https://media.discordapp.net/attachments/371759389889003532/967278626263420948/unknown.png
04:20:11FromDiscord<huantian> In reply to @Rika "I mean whatever": dang we've killed rika's hatred of callbacks
04:20:59FromDiscord<Yardanico> In reply to @huantian "slightly tweaked": hm, not sure, but maybe some might get confused by "blocking" in await entry?
04:21:02FromDiscord<Rika> No I just don’t care enough
04:21:21FromDiscord<Yardanico> because "blocking" in waitFor is not the same as "blocking" in await
04:21:29FromDiscord<huantian> hmmm ok
04:21:35FromDiscord<Yardanico> waitFor blocks the entire thread, while `await` lets other futures run
04:21:48FromDiscord<Yardanico> while it's waiting for its own future to return
04:24:19FromDiscord<huantian> what if I this lmao https://media.discordapp.net/attachments/371759389889003532/967279728295805018/unknown.png
04:25:16FromDiscord<Yardanico> fine, just fix typos :)
04:25:26FromDiscord<Yardanico> it'll be reviewed when you make a PR anyway
04:25:35FromDiscord<huantian> yeah I guess
04:58:58*slowButPresent quit (Quit: leaving)
05:12:41FromDiscord<TryAngle> my lexer is a bit not good imo.↔are there good libraries to lex and build to build syntax trees
05:12:47FromDiscord<TryAngle> (edit) "trees" => "trees?"
05:12:57FromDiscord<TryAngle> (edit) removed "to build"
05:26:48FromDiscord<TryAngle> https://github.com/openpeep/toktok↔this looks actually pretty cool đŸ€” 😳
05:28:31*droidrage quit (Ping timeout: 256 seconds)
05:28:52*rockcavera quit (Remote host closed the connection)
05:29:38FromDiscord<Rika> Isn’t there lexbase
05:29:44FromDiscord<Rika> In the standard libraryy#
05:31:18FromDiscord<TryAngle> In reply to @Rika "Isn’t there lexbase": well there is but the docs are almost nonexistant
05:34:47FromDiscord<Yardanico> don't use built-in sets with big types like int16!111 https://github.com/SamWoolerton/fast-flood-solver/pull/1
05:35:03FromDiscord<Yardanico> my classic "check a random nim repo if you can improve it"
05:35:13FromDiscord<Yardanico> 400x perf increase from set[int16] to set[range[0..49]]
05:36:46FromDiscord<Elegantbeef> I love the `table[enum, T]`
05:37:00FromDiscord<Elegantbeef> Always a fun one to fix cause it's much faster to use an array 😄
05:37:03FromDiscord<Yardanico> xd
05:37:15FromDiscord<Yardanico> i've actually tried HashSet first for this repo, and it also gives a really big perf boost
05:37:36FromDiscord<Yardanico> it's like 70ms, but pure sets with a small range are ~4x faster - ~15ms
05:37:37FromDiscord<TryAngle> In reply to @Elegantbeef "Always a fun one": true, I need to rethink this myself lol
05:37:59FromDiscord<TryAngle> is there any other language besides nim that allows enum indexed arrays?
05:39:48FromDiscord<Yardanico> that poor int16 set https://media.discordapp.net/attachments/371759389889003532/967298725053628466/unknown.png
05:39:50FromDiscord<Yardanico> in compiled C
05:39:57FromDiscord<Yardanico> (this is just 1/3 of its definition)
05:41:53FromDiscord<Elegantbeef> Who new 2^16 bits was a lot
05:41:58FromDiscord<Yardanico> xd
05:42:27FromDiscord<Yardanico> we should really document this somewhere, it seems like new nim people make this mistake sometimes
05:59:20FromDiscord<SirElephant> are there any notable softwares that are made in nim?
05:59:33FromDiscord<TryAngle> what is a good / standard way to write tests for a submodule?↔just putting `when isMainModule:` at the end?
05:59:35FromDiscord<SirElephant> (edit) "softwares" => "software"
05:59:42FromDiscord<TryAngle> (edit) "end?" => "end and the tests there?"
05:59:53FromDiscord<TryAngle> (edit) "what is a good / standard way to write tests for a submodule?↔just putting `when isMainModule:` at the end and the tests there? ... " added "or is there a better way?"
06:01:26FromDiscord<Rika> In reply to @Yardanico "we should really document": Time to add a new warning?
06:01:44FromDiscord<Yardanico> In reply to @SirElephant "are there any notable": nitter
06:02:02FromDiscord<Yardanico> In reply to @Rika "Time to add a": yeah, maybe a warning or at least a hint when you have a set that's over X bytes big
06:02:07FromDiscord<Yardanico> with X maybe being 64 or 128 bytes
06:02:21FromDiscord<Yardanico> because set[int16] takes 8192 bytes, and copying 8kb on stack isn't fun
06:02:36FromDiscord<Rika> 64 bytes
 crazy
06:04:35FromDiscord<TryAngle> how can I return a ref to range of a string?↔string1 = "Hello World"↔string2 = string1[6..10] <- ref to string1
06:04:47FromDiscord<TryAngle> (edit) "string1" => "string1↔string2 == "World""
06:05:48FromDiscord<Yardanico> IIRC you can't safely, strings in Nim have value semantics
06:05:59FromDiscord<Yardanico> you can have a `ref string` or modify with the slice directly
06:06:07FromDiscord<Yardanico> or maybe it'll work with experimental views, but not by default
06:06:26FromDiscord<SirElephant> In reply to @Yardanico "nitter": do you mean https://nitter.nl/
06:06:33FromDiscord<Yardanico> that's just one of instances of it
06:06:45FromDiscord<Yardanico> nitter has tens of public instances, https://github.com/zedeus/nitter is the main repo
06:06:50FromDiscord<Yardanico> and nitter.net is the main instance
06:06:59FromDiscord<Elegantbeef> You can do `toOpenArray` but that cannot be held in a variable can can only be passed to parameters
06:07:00FromDiscord<SirElephant> oh
06:07:12FromDiscord<SirElephant> so is this made using wasm>
06:07:14FromDiscord<Yardanico> no?
06:07:16FromDiscord<SirElephant> (edit) "wasm>" => "wasm?"
06:07:23FromDiscord<Yardanico> the backend is in Nim
06:07:32FromDiscord<Yardanico> nitter has no JS except for some optional one so you can scroll infinitely
06:07:45FromDiscord<Yardanico> Zed recently said in the Telegram chat: "tens of millions of daily requests spread across over 50 public instances" about Nitter
06:07:53FromDiscord<Yardanico> so it's most probably the most used (per user count) nim project
06:08:08FromDiscord<TryAngle> In reply to @Yardanico "you can have a": I have a ref string
06:08:19FromDiscord<SirElephant> any other popular stuff made in nim?
06:08:26FromDiscord<TryAngle> so in ur opinion I should just return a range to use with this string?
06:08:53FromDiscord<Yardanico> In reply to @SirElephant "any other popular stuff": https://status.im/ isn't that popular (I think), but they do extensively use Nim
06:09:27FromDiscord<SirElephant> can we use wasm with nim?
06:09:27FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3VZT
06:09:30FromDiscord<Yardanico> yes
06:09:40FromDiscord<Yardanico> there are some games made in Nim, https://store.steampowered.com/app/1444480/Turing_Complete/ is probably the most popular one (it's not pure Nim though, it uses Godot with Nim)
06:10:21FromDiscord<TryAngle> In reply to @Elegantbeef "If you have a": how do I index with that?↔myStr[selection] ?
06:10:48FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3VZU
06:10:55FromDiscord<Yardanico> ah right, you also need to dereference it
06:11:15FromDiscord<Elegantbeef> And you just make everything a nice API
06:11:18FromDiscord<TryAngle> ss.myStr[][ss.selection] then?
06:11:55FromDiscord<Yardanico> hm, it won't work the way you want anyway
06:12:15FromDiscord<Yardanico> i assume you will then want to store a reference to a part of your string in a different variable
06:12:23FromDiscord<Yardanico> can you explain what you need this for?
06:14:37FromDiscord<TryAngle> I'm rewriting my lexer to be more flexible↔I would like to use have a cursor that only operators over a local area in that text
06:14:43FromDiscord<TryAngle> (edit) "use" => ""
06:18:42FromDiscord<huantian> hey that's sick https://media.discordapp.net/attachments/371759389889003532/967308512466194442/unknown.png
06:18:46FromDiscord<TryAngle> In reply to @Elegantbeef "If you have a": but I think this will do đŸ€”
06:18:47FromDiscord<TryAngle> thanks
06:19:53FromDiscord<huantian> (edit) "sick" => "sick, thank you github for cool features"
06:23:43FromDiscord<Elegantbeef> You also can just use `toOpenArray` and pass it to a function or have an index and slice you own
06:23:46FromDiscord<Elegantbeef> Or use unsafe methods
06:26:30FromDiscord<TryAngle> using slice is better than what I wanted before tbh
06:27:21FromDiscord<TryAngle> @ElegantBeef one more question though... how do I make a string ref 💀 ?
06:27:36FromDiscord<Elegantbeef> `new string`
06:27:47FromDiscord<TryAngle> and how I give it a value?
06:28:11FromDiscord<Elegantbeef> `let myRefString = new string; myRefString[] = "Hello World"`
06:28:21FromDiscord<TryAngle> oh
06:28:30FromDiscord<TryAngle> I forgot the []
06:28:33FromDiscord<TryAngle> thanks beef
07:00:11*jmdaemon quit (Ping timeout: 246 seconds)
07:05:41FromDiscord<TryAngle> sent a code paste, see https://paste.rs/1Om
07:08:04FromDiscord<Rika> Rune at is for byte indexes
07:08:42FromDiscord<Elegantbeef> What you're doing is silly
07:08:46FromDiscord<Yardanico> :D
07:08:54FromDiscord<Rika> Yes that too lol
07:08:56FromDiscord<Elegantbeef> `runeLen` is iterative do not use it like this
07:09:08FromDiscord<Rika> In reply to @Elegantbeef "`runeLen` is iterative do": Huh?
07:09:17FromDiscord<Rika> Ah
07:09:19FromDiscord<Rika> Okay
07:09:28FromDiscord<TryAngle> In reply to @Elegantbeef "What you're doing is": well I'm a bit perplexed from utf8 vs just chars
07:09:36FromDiscord<TryAngle> (edit) "In reply to @Elegantbeef "What you're doing is": well I'm a bit perplexed from utf8 vs just chars ... " added "thingy"
07:10:02FromDiscord<Elegantbeef> Well what are you trying to solve?
07:10:48FromDiscord<TryAngle> In reply to @Elegantbeef "Well what are you": well I need the StringSlices to fully support utf8
07:10:56FromDiscord<Elegantbeef> That's not the question
07:11:09FromDiscord<TryAngle> I'm rewriting my parser / lexer
07:11:18FromDiscord<TryAngle> because it's đŸ€ą
07:11:30FromDiscord<TryAngle> (edit) "because it's đŸ€ą ... " added "rn"
07:12:12FromDiscord<Elegantbeef> And these slices are supposed to solve what?
07:12:44FromDiscord<TryAngle> In reply to @Elegantbeef "And these slices are": partially
07:12:45FromDiscord<Rika> You’re not doing the iterating part right at all
07:12:57FromDiscord<Rika> In reply to @TryAngle "partially": Solve what partially?
07:13:02FromDiscord<Rika> The heck does that mean
07:13:30FromDiscord<TryAngle> not copy the entire string all the time
07:13:53FromDiscord<TryAngle> it doens't matter in most cases but I'd like to overegineer a bit here
07:14:01FromDiscord<TryAngle> (edit) "it doens't matter in ... most" added "99.999999%"
07:14:04FromDiscord<TryAngle> (edit) "most" => ""
07:14:57FromDiscord<Rika> You’re making a string copy with rune at anyway?
07:15:10FromDiscord<Rika> Are you even sure it’s the strings making you slow
07:15:50FromDiscord<Elegantbeef> Why are you needing to slice the string?
07:16:33FromDiscord<Yardanico> In reply to @TryAngle "not copy the entire": for this you usually just have an object that stores the string and currect position in the string
07:16:46FromDiscord<Yardanico> then you can use e.g. procs from parseutils by specifying start index
07:19:01FromDiscord<TryAngle> In reply to @Yardanico "for this you usually": I had that before and it wokrs well I just messed up and my code got too messy to edit it well↔but now I want try and do a bit more of a functional approach to this and do something like a combinator (I think?)
07:19:14FromDiscord<Yardanico> then why not just use a combinator lib? :P
07:19:24FromDiscord<Rika> If you want to make things faster wouldn’t it be better to use streams? Not as in the module necessarily but the concept
07:19:55FromDiscord<Yardanico> In reply to @TryAngle "I had that before": also yeah, functional approach would probably be slower
07:21:40FromDiscord<Elegantbeef> Is this where i say "Just use a closure iterator" 😄
07:21:46FromDiscord<TryAngle> In reply to @Rika "If you want to": step by step >.>↔Also I don't think streams can help me that much speedwise
07:22:15FromDiscord<Rika> 
why not
07:22:29FromDiscord<Rika> Wasn’t your issue copying strings
07:22:44FromDiscord<Rika> Why would you have an issue with that in the first place other than “because they’re large”
07:22:49FromDiscord<Rika> Which streams would fix no?
07:23:03FromDiscord<Elegantbeef> And closure iterators are basically streams so yay!
07:23:25FromDiscord<Rika> In reply to @Elegantbeef "And closure iterators are": Resettable when
07:23:33FromDiscord<Yardanico> In reply to @Rika "Resettable when": already
07:23:37FromDiscord<Elegantbeef> They are if you dont use them nested
07:23:39FromDiscord<Rika> Wait when
07:23:49FromDiscord<Rika> Did I forget lmao
07:23:52FromDiscord<TryAngle> In reply to @Elegantbeef "And closure iterators are": what is a closure iterator?
07:24:01FromDiscord<Rika> In reply to @TryAngle "what is a closure": An iterator with state
07:24:03FromDiscord<Elegantbeef> I have a proc inside slicerator that resets them
07:26:14FromDiscord<TryAngle> In reply to @Yardanico "for this you usually": ah yes now I remember why I had issues with it.↔For example when parsing identifiers, strings, numbers etc. I always did a "subcounter"↔with that I can just lex a substring just as I would lex the whole text
07:26:26FromDiscord<TryAngle> (edit) ""subcounter"↔with" => ""subcounter" and that got messy fast↔with"
07:52:09FromDiscord<aph> hii are there tools to detect the minimum version i need for my library? i dont know what to put in in the `requires "nim >= ???"`
07:52:16FromDiscord<aph> thanks
07:53:01FromDiscord<Yardanico> In reply to @aph "hii are there tools": just put latest your version of nim if you're not sure
07:53:10FromDiscord<Yardanico> but generally if you're using e.g. 1.6.4 you can just put 1.6.0
07:53:27FromDiscord<Yardanico> @aph this requires nim field is only for when installing packages
07:53:37FromDiscord<Yardanico> so if some user has an old nim and the package requires a newer nim, the package won't install
07:53:54FromDiscord<Yardanico> it doesn't affect packages in any other way
07:54:03FromDiscord<aph> ohh thanks!
07:56:26FromDiscord<Yardanico> @ElegantBeef btw, as I've asked before, do you think it'd make sense to make a warning/hint if someone makes a set that's larger than for example 64 bytes?
07:56:50FromDiscord<Elegantbeef> Hint it's not anything "wrong"
07:56:56FromDiscord<Yardanico> yeah you're right
07:58:11FromDiscord<Elegantbeef> Would like to see tables/hashsets emit a hint aswell if the value is a `enum and Ordinal`
08:00:50FromDiscord<Yardanico> In reply to @Elegantbeef "Would like to see": why for hashsets?
08:01:04FromDiscord<Elegantbeef> Cause a bitset is more efficient
08:01:11FromDiscord<Yardanico> yeah, that's true
08:01:36FromDiscord<Yardanico> so: 1) when set too big 2) when using a table with enum as keys 3) when using a hashset for enum type
08:01:42FromDiscord<Yardanico> time to make something like "nim-perf-hinter"
08:02:05FromDiscord<Elegantbeef> I always go back to the powerpc emulator when it was like 20 times slower due to `table[enum, val]`
08:02:14FromDiscord<Yardanico> xdd
08:02:23FromDiscord<Elegantbeef> changed`{}.toTable` to `[]` and it go 20 times faster
08:02:51FromDiscord<Yardanico> is it on github?
08:05:22FromDiscord<Elegantbeef> https://github.com/BracketMaster/nimulatorPPC/commit/a87da9cd2d11ea0eada42f94e77bfc81632e619e
08:10:09FromDiscord<Yardanico> would a case statement be faster than an array over enum values?
08:10:58FromDiscord<Elegantbeef> Eh iirc most of their program was in logic after that change
08:11:04FromDiscord<Elegantbeef> Before that change 90% of their program was hashing
08:11:13FromDiscord<Yardanico> also isn't this inefficient? https://github.com/BracketMaster/nimulatorPPC/blob/main/src/cpu/decoder.nim#L19
08:11:26FromDiscord<Yardanico> shouldn't they instead have ISAInfo as keys
08:11:52FromDiscord<Yardanico> they iterate over all possible instructions in the array to find one instruction, no?
08:11:55FromDiscord<Elegantbeef> No clue i dont know what any of the code does
08:11:59FromDiscord<Yardanico> heh
08:12:13FromDiscord<Elegantbeef> I all did was profile it cause they said "Damn it's slow"
08:12:30FromDiscord<Yardanico> lemme try changing the logic a bit then
08:12:35FromDiscord<Elegantbeef> Then i looked at the profiler and went "heh, we can fix this"
08:13:19FromDiscord<Elegantbeef> I'm a simple man bigger number better
08:15:10FromDiscord<Yardanico> do you have the compiled firmware.bin for loopback asm? i just don't want to compile ppc64 gcc
08:15:28FromDiscord<Elegantbeef> Look at that commit date, i dont have anything related to that anymore 😄
08:16:48FromDiscord<Yardanico> oh ok
08:17:09FromDiscord<Yardanico> looks like community/ppc64le-elf-binutils in arch repos works
08:17:23FromDiscord<Yardanico> "SIMULATED FOR 26603074 INSTRUCTIONS AT ROUGHLY 2914915 INSTRUCTIONS PER SECOND"
08:17:48FromDiscord<Yardanico> this is the default with danger
08:18:04FromDiscord<Yardanico> clang makes it slower :P
08:19:11FromDiscord<Yardanico> @ElegantBeef i'm afraid but it looks like your prepareMutation fix for streams didn't work :P
08:19:20FromDiscord<Elegantbeef> Yep
08:19:28FromDiscord<Yardanico> no I mean after https://github.com/nim-lang/Nim/pull/19717/
08:19:33FromDiscord<Elegantbeef> Doesnt really matter cause stringstreams dont work at compile time apparently
08:19:50FromDiscord<Yardanico> it does with refc
08:19:51FromDiscord<Elegantbeef> I give up cause why the fuck arent these tests running on multiple gcs
08:20:17FromDiscord<Yardanico> nimulatorppc parses json at compile-time which uses stringstreams https://media.discordapp.net/attachments/371759389889003532/967339113319645224/unknown.png
08:20:25FromDiscord<Yardanico> I've parsed json at compile time in some of projects too and it works
08:21:25FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3W0v
08:21:28FromDiscord<Elegantbeef> That doesnt run
08:21:35FromDiscord<Yardanico> it does with refc
08:21:44FromDiscord<Elegantbeef> It does fucking not
08:21:50FromDiscord<Yardanico> it does here đŸ€·
08:22:04FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/967339561665568778/unknown.png
08:22:25FromDiscord<Elegantbeef> `nim -v`?
08:22:33FromDiscord<Yardanico> bb839029d5065bcd8367661802bf04e1e7eebb58
08:22:34FromDiscord<Yardanico> latest devel
08:22:42FromDiscord<Yardanico> lemme try on latest stable on playground
08:23:00FromDiscord<Yardanico> yeah it fails there
08:23:33FromDiscord<Yardanico> guess it got fixed in devel after 1.6.4
08:24:09FromDiscord<Elegantbeef> `Error: unhandled exception: field 'sym' is not accessible for type 'TNode' using 'kind = nkNilLit' [FieldDefect]`
08:24:49FromDiscord<Elegantbeef> I'm using the same version as you
08:24:51FromDiscord<Elegantbeef> You cannot write to the ss at compile time
08:25:26FromDiscord<Yardanico> I don't know what this is about, but it works on devel for real
08:25:29FromDiscord<Yardanico> i've even checked on godbolt
08:25:34FromDiscord<Elegantbeef> The code i gave you?
08:25:37FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/967340456679714866/unknown.png
08:25:39FromDiscord<Yardanico> yes
08:25:46FromDiscord<Yardanico> ah your code
08:25:50FromDiscord<Yardanico> i was testing the different one lol
08:25:55FromDiscord<Elegantbeef> Exactly
08:25:55FromDiscord<Yardanico> yeah yeah your code fails, sure
08:26:12FromDiscord<Yardanico> anyway, the point is that some of stringstreams works for compiletime stuff
08:26:12FromDiscord<Elegantbeef> Like it's a pointless fix
08:26:15FromDiscord<Yardanico> enough to get json working
08:26:18FromDiscord<Yardanico> it's not a pointless fix
08:26:28FromDiscord<Yardanico> parsing json at compile time is not "pointless" in my view
08:27:27FromDiscord<Elegantbeef> Well a stringstream that can only read is quite fucking silly
08:27:42FromDiscord<Yardanico> yes, but again, a lot of other stuff depends on it
08:30:29FromDiscord<Elegantbeef> Well anyway yea thanks for suggesting olaf PR it 😄
08:30:38FromDiscord<Yardanico> i'll pr it myself then
08:31:22FromDiscord<Elegantbeef> Dont forget to enable testing with refc and arc
08:31:34FromDiscord<Elegantbeef> I'm more annoyed at that than anything really
08:31:48FromDiscord<Yardanico> In reply to @Elegantbeef "Dont forget to enable": for what?
08:31:57FromDiscord<Elegantbeef> The stream test
08:34:36FromDiscord<Elegantbeef> I mostly expected all tests that arent testing codegen/language semantics to run a matrix of refc/orc
08:36:26*Zectbumo quit (Remote host closed the connection)
08:45:36FromDiscord<Knedlik> Hey guys, why would sleep(5000) not let the code past? The docs show it’s in milsecs, which corresponds to what happends when I do sleep(5)
08:45:56FromDiscord<Elegantbeef> It'll sleep for 5 seconds
08:46:01FromDiscord<Elegantbeef> What's the entire code?
08:46:18FromDiscord<Knedlik> You mean all files or the main file?
08:46:28FromDiscord<Elegantbeef> Where the sleep is
08:47:09FromDiscord<Knedlik> sent a code paste, see https://paste.rs/9mZ
08:47:14FromDiscord<Knedlik> Ignore the commentation
08:47:29FromDiscord<Knedlik> With the comment it does go past
08:47:38FromDiscord<Yardanico> well it should work even with 5000
08:47:40FromDiscord<Yardanico> just after 5 seconds
08:47:50FromDiscord<Knedlik> It doesn’t even after 10
08:48:51FromDiscord<Knedlik> The log doesn’t show Passed sleep
08:49:23FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/gSh
08:49:34FromDiscord<Yardanico> @Knedlik it might have something to do with you using sdl2, etc
08:50:18FromDiscord<Yardanico> but I don't think using `sleep` for showing a splash screen is a good idea anyway, instead you should save the state of your game and show splash screen as long as state == Splash for example
08:50:30FromDiscord<Yardanico> because what if your splash screen will be animated in the future
08:50:37FromDiscord<Yardanico> not just a static image
08:50:58FromDiscord<Knedlik> I don’t know what you mean by save the state and show as long as state == splash
08:51:25FromDiscord<Yardanico> have an enum of your game states, switch between them in the main game loop, if the state is splash, you show the splash screen, if it's menu you show the main menu, etc
08:51:28FromDiscord<Yardanico> just a rough idea
08:51:59FromDiscord<Knedlik> Pretty sure Nimgame doesn’t have a main game loop
08:52:11FromDiscord<Knedlik> It has update() for scenes and entities
08:52:39FromDiscord<Elegantbeef> Dont look now that's a main game loop
08:53:10FromDiscord<Knedlik> I mean, somewhat
08:53:25FromDiscord<Knedlik> You still handle switching between scenes outside a game loop
08:53:42FromDiscord<Knedlik> Or atleast unless it’s triggered by let’s say a button press
08:54:48FromDiscord<Yardanico> btw @ElegantBeef streams don't support writing over existing data, so this doesn't work either (even with refc) https://github.com/nim-lang/Nim/blob/devel/tests/stdlib/tstreams.nim#L77 but it wasn't caught since there was no ss.peakStr(5) == "hello" test
08:55:03FromDiscord<Yardanico> well, at least not the string stream
08:55:31FromDiscord<Rika> Did you misspell that intentionally?
08:55:34FromDiscord<Elegantbeef> String streams support writing over data
08:55:52FromDiscord<Yardanico> hm why doesn't it work then
08:56:00FromDiscord<Yardanico> In reply to @Rika "Did you misspell that": no, just a mistake
08:56:27FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3W0F
08:56:30FromDiscord<Yardanico> ah yeah i'm stupid nvm
08:56:35FromDiscord<Yardanico> needed to do setPosition again, yeah
08:56:42FromDiscord<Yardanico> anyway, I'll add it to the test since iut wasn't tested
08:56:46FromDiscord<Yardanico> (edit) "iut" => "it"
08:56:49FromDiscord<Elegantbeef> Ok
08:57:19FromDiscord<Elegantbeef> That oddly caused me to be irrationally angry 😄
08:57:38FromDiscord<Yardanico> dog?
08:57:53FromDiscord<Elegantbeef> No the "string streams cant write over data"
08:57:59FromDiscord<Yardanico> heh
08:58:13FromDiscord<Yardanico> yeah i rarely use streams in general
08:59:09FromDiscord<Rika> Beef angry huh
08:59:26FromDiscord<Knedlik> Does irrationally angry mean less or more angry than 3.14 angry?
08:59:33FromDiscord<Solitude> In reply to @Rika "Beef angry huh": im infecting people with irrational anger over the internet
08:59:48FromDiscord<Elegantbeef> it's 6.28 angry since it's the superior constant
09:00:01FromDiscord<Elegantbeef> Nah tired + still slightly sick is my excuse
09:00:11FromDiscord<Knedlik> But that’s really angry
09:04:49FromDiscord<Yardanico> anyway, time to actually test if I can speedup nimulatorPPC
09:04:55FromDiscord<Yardanico> i got side-lined by streams
09:05:06FromDiscord<Elegantbeef> Lol
09:05:23FromDiscord<Elegantbeef> Go speed up benchmarks instead since people think they matter
09:05:42FromDiscord<Yardanico> yeah i saw that thread
09:05:46FromDiscord<Yardanico> classic
09:05:51FromDiscord<Knedlik> I love when I forget a word in a parent function call and cause a recursion down to hell
09:06:02FromDiscord<Rika> What word
09:06:16FromDiscord<Rika> In reply to @Elegantbeef "Go speed up benchmarks": Now this made me angry
09:06:42FromDiscord<Knedlik> update() instead of updateScene() in my own function update()
09:07:54FromDiscord<Elegantbeef> Why isnt it `update` that takes scene as a paramter
09:07:57FromDiscord<Elegantbeef> Literally unusable
09:08:14FromDiscord<Elegantbeef> Yea it's silly↔(@Rika)
09:08:50FromDiscord<Knedlik> They both take scene as a param
09:09:02FromDiscord<Knedlik> But Nim prefers my own function
09:10:45*Gustavo6046 quit (Quit: Goodbye! Leave messages at my XMPP @ [email protected] or my Discord Gustavo6046#9009 or possibly my Mastodon [email protected] – I don't check my email often since it's full of crap, but in any case, [email protected])
09:19:30*neurocyte8614492 joined #nim
09:36:06FromDiscord<Knedlik> Ummmm guys I’m having a problem - I need to import splashScene in some way into main, but also main into splashScene, and without causing a circular import
09:36:20FromDiscord<Knedlik> (edit) "circular" => "recursive"
09:38:23FromDiscord<Knedlik> I think I got it
09:42:07FromDiscord<Knedlik> Also can I somehow overwrite echo to behave as my own function (log)?
09:42:49FromDiscord<Rika> No not really, use a different function name
09:43:02FromDiscord<Knedlik> What?
09:43:08FromDiscord<Knedlik> I meant for default errors
09:45:05FromDiscord<Rika> What?
09:45:09FromDiscord<Rika> What do you mean now
09:45:31FromDiscord<Knedlik> Like can I make default errors use log() I created instead of echo?
09:45:33FromDiscord<Rika> Catch the error, log it with your logger, re raise it
09:45:51FromDiscord<Knedlik> How do I catch the error?
09:45:57FromDiscord<Rika> Try except?
09:47:46FromDiscord<Knedlik> Hmm, how do I get the exception tho?
09:48:05FromDiscord<Knedlik> getCurrenException()?
09:48:26FromDiscord<Knedlik> Or getCurrentExceptionMsg()?
09:48:40FromDiscord<Yardanico> the first gets you the exception object itself, the latter - the exception message
09:48:49FromDiscord<Knedlik> Oh okay, thanks
09:53:58FromDiscord<Knedlik> Also why am I getting Can’t load font: Library not initialized?
09:55:33FromDiscord<TryAngle> In reply to @Knedlik "Also why am I": we talked about this yesterady
09:55:38FromDiscord<TryAngle> the order you execute is wrong
09:56:00FromDiscord<TryAngle> first init scene, then load
09:56:24FromDiscord<Knedlik> But that’s what I’m doing
09:57:30FromDiscord<Knedlik> sent a code paste, see https://paste.rs/DPK
09:58:43FromDiscord<Knedlik> I can also try doing a return instead
10:01:22FromDiscord<Knedlik> Nope, still the same
10:01:50FromDiscord<TryAngle> no idea then sorry 😩
10:02:47FromDiscord<Knedlik> Hmm, can we do multi-line comments in nim?
10:03:23FromDiscord<Rika> Yes
10:03:32FromDiscord<Rika> #[ 
 ]#
10:03:39FromDiscord<Knedlik> Oh yeah
10:05:14*flynn joined #nim
10:05:47*flynn quit (Read error: Connection reset by peer)
10:07:45*xet7 quit (Remote host closed the connection)
10:10:02*xet7 joined #nim
10:10:28FromDiscord<Knedlik> This is funny
10:10:48FromDiscord<Knedlik> I replaced my init in Main with echo fileExists() and it outputs as the last thing
10:14:46FromDiscord<TryAngle> is there something that abstracts over Rune and Char?
10:15:26FromDiscord<Knedlik> Is that a response to me or a general question?
10:15:33FromDiscord<TryAngle> general qusetion lol
10:15:49FromDiscord<TryAngle> also @Knedlik there is a #gamedev channel
10:16:39FromDiscord<TryAngle> but most of us there use nimgl rn 😂
10:17:22FromDiscord<Knedlik> I mean, nimgame is better than making own engine, or atleast easier I would assume
10:17:47FromDiscord<Knedlik> How much work is it to make own engine with nimgl (2D)?
10:18:48FromDiscord<Yardanico> one thing to note - nimgame isn't an engine, it's just a library abstracting some of the more usual game dev stuff
10:18:56FromDiscord<Rika> In reply to @TryAngle "is there something that": Abstracts how
10:18:57FromDiscord<Yardanico> "engine" is really different from a "framework"
10:19:19FromDiscord<Yardanico> i mean nimgame says it's an engine, but imo it's more of a framework
10:19:24FromDiscord<Knedlik> I mean, engine can also be without an editor <:ondra_shrug:815540303841853450>
10:20:12FromDiscord<Knedlik> I guess I could try using straight up NimGL, but how much more work would that be?
10:21:41FromDiscord<TryAngle> In reply to @Rika "Abstracts how": idk single character that can be typed like "x" or 'x' or maybe idk Rune("x") or Rune('x')
10:23:21FromDiscord<TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3W0S
10:24:13FromDiscord<TryAngle> ah nvm I'm stoopid
10:24:23FromDiscord<TryAngle> (edit) "stoopid" => "stoopid↔I tried to match a string with a char"
10:24:40FromDiscord<TryAngle> (edit) "https://play.nim-lang.org/#ix=3W0S" => "https://play.nim-lang.org/#ix=3W0T"
11:10:17*vicecea quit (Remote host closed the connection)
11:10:48*vicecea joined #nim
11:21:06*neurocyte8614492 quit (Ping timeout: 276 seconds)
11:23:05FromDiscord<TryAngle> When dereferencing a ref, does it copy the ref object ?
11:23:58FromDiscord<Rika> If you store it in a variable
11:25:29FromDiscord<TryAngle> In reply to @Rika "If you store it": Oh I worded a bit open...↔I mean if it copys the entire value
11:25:48FromDiscord<TryAngle> Or just the ref
11:26:04FromDiscord<Rika> If you store the dereferenced object it copies the object
11:26:16FromDiscord<TryAngle> Ok thanks
11:26:56FromDiscord<Rika> In reply to @Rika "If you store the": You’re undoing a reference so it becomes a regular object with value semantics no?
11:28:10FromDiscord<TryAngle> Well idk. Hypothetically this could be a pointer internally or smth like that and just looks like a new variable from the code
11:31:25FromDiscord<Rika> ?
12:23:18*v9fk quit (Remote host closed the connection)
12:24:25*v9fk joined #nim
12:29:52*v9fk quit (Remote host closed the connection)
13:27:21*v9fk joined #nim
13:32:07FromDiscord<TryAngle> how can I make a rune from a string or char?
13:34:50FromDiscord<Yardanico> https://nim-lang.org/docs/unicode.html#runeAt%2Cstring%2CNatural
13:35:01FromDiscord<Yardanico> for chars you first convert them to $
13:41:22*slowButPresent joined #nim
13:43:24FromDiscord<2F42BBA1> Trying to use this library for clipboard https://github.com/Guevara-chan/Cliptomania↔↔What I want is that when software detects via regex that there's a word containg `foo`, then it would replace with `bar`↔How it would look like in Nim code? Perhaps there are better ways of doing that...
13:44:11FromDiscord<2F42BBA1> It's also a bit of hard to use this lib since there aren't much of examples here
13:45:43FromDiscord<Yardanico> well this lib doesn't seem to have a way of "waiting" for clipboard modification, so your best bet is checking clipboards contents e.g. once in 100ms (or once 1s), then you replace the value you want in the string and set it in the clipboard
13:46:33FromDiscord<2F42BBA1> I will try to use winim.
13:46:42FromDiscord<Yardanico> ??
13:47:06FromDiscord<Solitude> In reply to @Yardanico "for chars you first": or just char.Rune?
13:47:18FromDiscord<2F42BBA1> I noticed that, uh... functions that are in library I linked above are also available in winim as well.
13:47:31FromDiscord<Yardanico> In reply to @2F42BBA1 "I noticed that, uh...": yes, but winim is quite big and that lib is multiplatform
13:48:37FromDiscord<Yardanico> sent a code paste, see https://paste.rs/etz
13:48:42FromDiscord<Yardanico> is this not what you wanted?
13:49:09FromDiscord<2F42BBA1> In reply to @Yardanico "from a minute of": looks fine
13:49:10FromDiscord<2F42BBA1> thanks
13:49:31FromDiscord<2F42BBA1> yet it looks so damn simple
13:49:53FromDiscord<Yardanico> the examples/basic actually has all of those functions
13:49:55FromDiscord<Yardanico> shown
13:50:09FromDiscord<Yardanico> ah, sorry, it'll be a bit different
13:50:36FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3W1j
13:50:40FromDiscord<Yardanico> don't forget to also import strutils
13:51:00FromDiscord<Yardanico> In reply to @Solitude "or just char.Rune?": yeah that'd also work
13:51:24*v9fk quit (Remote host closed the connection)
13:52:45FromDiscord<2F42BBA1> sent a code paste, see https://paste.rs/v2v
13:52:48FromDiscord<Yardanico> why?
13:52:59FromDiscord<Yardanico> regex would just be slower, but if you really want to, there would be no different
13:53:01FromDiscord<Yardanico> (edit) "different" => "difference"
13:53:13FromDiscord<Yardanico> just check with a regex condition instead of my "foo" in str
13:53:53FromDiscord<Solitude> In reply to @2F42BBA1 "hm... it would be": aw hell naw
13:54:21FromDiscord<2F42BBA1> ok 😩
13:54:40FromDiscord<Yardanico> why do you specifically want regex? I just don't understand
13:54:42FromDiscord<2F42BBA1> since yardanico explained why not use that
13:54:55FromDiscord<Yardanico> if you just want to check if a string is inside another string, `in` is enough
13:57:55FromDiscord<Knedlik> Hey guys, is there a tutorial somwhere on how to get started with nimgl?
13:58:06FromDiscord<Solitude> nah
13:58:12FromDiscord<Yardanico> it's better if you ask #gamedev
13:58:19FromDiscord<Yardanico> there are people working with nimgl
14:04:55*v9fk joined #nim
14:32:17FromDiscord<Entikan> hello
14:32:34FromDiscord<Entikan> I'm having a lot of fun with nim
14:32:58FromDiscord<Rika> that is good
14:33:02FromDiscord<Knedlik> Hello having a lot of fun with nim, I’m Knedlik and I enjoy nim
14:33:14FromDiscord<Rika> ok dad
14:33:18FromDiscord<Entikan> nim is great I love nim
14:33:18FromDiscord<Solitude> @mods
14:33:38FromDiscord<Entikan> nim nim nimnim nim nimnimnim
14:33:41FromDiscord<Yardanico> In reply to @Entikan "nim is great I": why
14:33:51FromDiscord<Solitude> name one good thing about nim
14:34:24FromDiscord<Entikan> it's as intuitive to write as python but as fast as C and has stricter typing, what more do you want
14:35:04FromDiscord<Solitude> lisp-like macros?
14:35:12FromDiscord<Knedlik> ~~a functional and easy to use game lib~~
14:35:23FromDiscord<Entikan> the sdl2 bindings seem pretty good
14:35:30FromDiscord<Entikan> so far at least
14:35:52FromDiscord<Knedlik> Well, are you using them by themselves, or with Nimgame?
14:35:59*PMunch joined #nim
14:37:41FromDiscord<Entikan> by itself
14:38:33FromDiscord<Entikan> I don't really appreciate concepts like Entity or Scene
14:38:37FromDiscord<Entikan> unless I write them myself
14:39:09FromDiscord<Entikan> just give me gltf, a scenegraph and input control and get out of my way
14:40:13FromDiscord<Knedlik> I never actually tried SDL
14:40:44FromDiscord<Knedlik> Is it actually good, or is it another long names that are hard to read, don’t make much sense to a beginner and you need 10 of them to do once thing?
14:40:51FromDiscord<TryAngle> In reply to @Solitude "name one good thing": I can name one bad thing about nim↔the way chars are not utf8 encoded and runes are annoying to work with
14:41:01FromDiscord<TryAngle> (edit) "nim↔the" => "nim (first thing I don't like tbh)↔the"
14:41:21FromDiscord<2F42BBA1> sent a code paste, see https://play.nim-lang.org/#ix=3W1v
14:41:41FromDiscord<2F42BBA1> `Error: type mismatch: got <string, array[0..1, Regex]>`
14:41:53FromDiscord<Entikan> I'm using SDL2 for now to learn nim, because I'm familiar with it. But I'm also flirting a bit with Knim https://github.com/IbrahimHindawi/Knim
14:42:40FromDiscord<Knedlik> And is it easy to learn?
14:43:01FromDiscord<Entikan> SDL2 or nim?
14:43:08FromDiscord<Entikan> knim isn't, there's very little docs
14:43:10FromDiscord<Knedlik> Sdl
14:43:20FromDiscord<Entikan> yeah SDL is very easy to use
14:43:24FromDiscord<Yardanico> In reply to @2F42BBA1 "`Error: type mismatch: got": that's not how you check for regex
14:44:10FromDiscord<Yardanico> if you're using https://nim-lang.org/docs/re.html, can you just check examples in there?
14:44:22FromDiscord<Yardanico> and maybe search a bit https://media.discordapp.net/attachments/371759389889003532/967435768081555466/unknown.png
14:45:19FromDiscord<2F42BBA1> In reply to @Yardanico "that's not how you": I am trying to use this https://github.com/nitely/nim-regex
14:45:31FromDiscord<Yardanico> then have you seen https://nitely.github.io/nim-regex/regex.html ?
14:45:35FromDiscord<Yardanico> there's a link for that in readme
14:45:47FromDiscord<2F42BBA1> I am blind :/
14:45:52FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/967436147330519080/unknown.png
14:46:13FromDiscord<enthus1ast> if you use regex to solve a problem, you have two problems \:)
14:46:43FromDiscord<Yardanico> true
14:46:53FromDiscord<Yardanico> in a lot of cases just string parsing is enough, or at least strscans
14:47:42NimEventerNew post on r/nim by ryu-ryu-ryu: Embedded Ruby Interpreter in Nim, see https://reddit.com/r/nim/comments/ua70h3/embedded_ruby_interpreter_in_nim/
14:47:45FromDiscord<2F42BBA1> sent a code paste, see https://play.nim-lang.org/#ix=3W1w
14:48:30FromDiscord<Yardanico> not a regex
14:48:34FromDiscord<Yardanico> sent a code paste, see https://paste.rs/EAk
14:48:41FromDiscord<Yardanico> remove the [] that you have, they're not needed
14:49:53FromDiscord<Rika> solitude is speeeeeed when it comes to ryu huh'
14:50:09FromDiscord<2F42BBA1> sent a code paste, see https://play.nim-lang.org/#ix=3W1y
14:50:14FromDiscord<2F42BBA1> sent a code paste, see https://play.nim-lang.org/#ix=3W1z
14:50:17FromDiscord<Rika> ?
14:50:28FromDiscord<Yardanico> sent a code paste, see https://paste.rs/v5C
14:50:31FromDiscord<Yardanico> please
14:50:36FromDiscord<Yardanico> `if reg.contains(str):`
14:50:58FromDiscord<Yardanico> learn a bit of nim please :(
14:51:01FromDiscord<2F42BBA1> i am bad at nim
14:51:01FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=3W1A
14:51:06FromDiscord<Solitude> sent a code paste, see https://play.nim-lang.org/#ix=3W1B
14:52:13FromDiscord<Entikan> be nice
14:52:23duuudehas anyone made android apps using nim?
14:52:36PMunchduuude, yup
14:52:40PMunchBut not a whole lot of people
14:53:03duuudewhat toolkits are the best
14:53:07nrds<Prestige99> I should look into that, I'd like to make android apps but I'm tired of java
14:53:36PMunch@Solitude, that feeling when you can't afford to use copilot, so you must randomly mush code snippets together yourself
14:53:45FromDiscord<2F42BBA1> In reply to @Solitude "have you seen the": just walked through the eyes
14:53:51FromDiscord<Rika> eyes>
14:53:53FromDiscord<Rika> (edit) "eyes>" => "eyes?"
14:53:56FromDiscord<Rika> is this a saying
14:54:00FromDiscord<Rika> rather an idiom
14:54:27PMunchduuude, well that's the thing. Not a lot of people doing it == not a lot of solid ways of doing it
14:54:40FromDiscord<2F42BBA1> In reply to @Rika "eyes?": i scrolled through tutorials, and didn't look much deep into them
14:54:51FromDiscord<Rika> please read through it
14:54:51PMunchI've exported games written in Nim to run on an Android phone, but that was just using SDL
14:55:10PMunchI know some people have looked at generating more native stuff though
14:55:41PMunchDon't get me wrong, SDL is going to run native, it's not like it's emulated or anything. But it's not very integrated into the Android ecosystem
14:56:18PMunch@Rika, not an idiom I've heard at least. I guess it's a literal translation of an idiom similar to the english "I just skimmed through it"
14:56:18nrds<Prestige99> Actually just getting SDL running would be great as well
14:56:31PMunchOh that was pretty easy last time I tried
14:57:24duuudeEFL could use SDL and was used in Tizen so it could be probably somewhat mobile-optimized
15:00:19duuudeand it has a good C api
15:01:33FromDiscord<Rika> given an image loaded on pixie, how do i run a shader (let's say i have it in a glsl file) on it then save it back?
15:04:56PMunch@Rika, you probably just feed the shader the Image.data buffer
15:06:45FromDiscord<Rika> yes, via what 🙂
15:07:02FromDiscord<TryAngle> after years of rewriting ... my lexer finally tokenizes again đŸ„ș
15:07:07FromDiscord<TryAngle> and it's beautiful
15:09:00PMunchOooh, what's it lexing?
15:11:19FromDiscord<TryAngle> In reply to @PMunch "Oooh, what's it lexing?": a toy lang I'm working on↔got some discussion earlier with rika yardanico and beef about the way I could lex
15:11:28FromDiscord<TryAngle> (edit) "on↔got" => "on for learning purpose↔got"
15:12:52PMunchToy languages are fun :)
15:17:09FromDiscord<TryAngle> sent a code paste, see https://paste.rs/KgW
15:20:07FromDiscord<Yardanico> ` c.inner.slice.a..cursor.inner.slice.a - 1`
15:20:16FromDiscord<Yardanico> 🙄
15:20:20FromDiscord<Yardanico> idk it just looks weird
15:21:03FromDiscord<TryAngle> I mean I could make that look better but for 1 line I don't make an extra function now xd
15:21:20FromDiscord<TryAngle> but it looks really sus I agre
15:21:22FromDiscord<TryAngle> (edit) "agre" => "agree"
15:22:57FromDiscord<2F42BBA1> I am wonder for how long it takes to learn Nim lang?
15:23:20FromDiscord<Solitude> 1 week and you're good to go
15:23:35FromDiscord<2F42BBA1> 1 week, wow.
15:23:55FromDiscord<2F42BBA1> Rust taken me to learn for a month or so?
15:24:39FromDiscord<TryAngle> I mean it really depends↔the whole std, probably long (or never?)↔↔getting the basics done, some hours to some days depending on background
15:25:03FromDiscord<TryAngle> In reply to @2F42BBA1 "Rust taken me to": đŸ„ș I feel that
15:25:45FromDiscord<TryAngle> learned rust just to RIIN later
15:29:34FromDiscord<2F42BBA1> In reply to @TryAngle "learned rust just to": RIIN?
15:30:10FromDiscord<TryAngle> In reply to @2F42BBA1 "RIIN?": It's a parody of RIIR
15:31:25FromDiscord<spoon> thanks google
15:32:24FromDiscord<TryAngle> In reply to @TryAngle "It's a parody of": rewrite it in rust
15:34:15NimEventerNew Nimble package! nimmikudance - MMD I/O!, see https://github.com/aphkyle/NimMikuDance
15:34:44FromDiscord<2F42BBA1> In reply to @TryAngle "It's a parody of": Heh
15:34:58FromDiscord<2F42BBA1> I did once a rewrite a utility
15:35:08FromDiscord<2F42BBA1> It used to calculate hashes CRC32 ones
15:35:27FromDiscord<2F42BBA1> My goal was by learning Rust make my own utility with modern OSes support etc.
15:35:35FromDiscord<TryAngle> No joke this is the first time I read about nim https://news.ycombinator.com/item?id=9050114
15:35:40FromDiscord<2F42BBA1> I did it, plus added many more hash functions
15:37:05FromDiscord<TryAngle> (edit) "https://news.ycombinator.com/item?id=9050114" => "https://news.ycombinator.com/item?id=9050114↔I think I found this post on rustjerk subreddit but unsure 💀"
15:37:52*Guest32 joined #nim
15:40:16FromDiscord<Knedlik> Hey guys, how do I parse a string into int64 and not a regular int?
15:41:27FromDiscord<dom96> ParseBiggestInt
15:41:47FromDiscord<Knedlik> Why not just name it parseInt64 wtf
15:42:04FromDiscord<Knedlik> Or just name it a long and use parseLong
15:42:06FromDiscord<Rika> because int64 will not be the biggest int in the future
15:42:11FromDiscord<Rika> long is not a good name
15:42:56FromDiscord<TryAngle> Speaking about that, is there a plan already when 128bit types will come?
15:43:13FromDiscord<Solitude> no
15:43:16FromDiscord<Knedlik> I guess parseBiggestInt is an option, but is it worth it using those extra 64b when the time comes?
15:43:34FromDiscord<Rika> what do you mean in that case
15:43:35FromDiscord<Knedlik> In reply to @TryAngle "Speaking about that, is": Wouldn’t you need a 128b processor for that?
15:43:43FromDiscord<Rika> not necessarily
15:43:46FromDiscord<TryAngle> Is the issue that c doesn't support them?
15:44:04FromDiscord<TryAngle> In reply to @Knedlik "Wouldn’t you need a": No, 128bit processesors would just be a lot faster
15:44:08FromDiscord<Yardanico> what? noi
15:44:09FromDiscord<Yardanico> (edit) "noi" => "no"
15:44:12FromDiscord<Rika> you can have arbitrarily sized integers, its just a matter of how well you want them to perform
15:44:13FromDiscord<Yardanico> more bits was never about faster lol
15:44:16FromDiscord<Yardanico> wtf
15:44:22FromDiscord<xflywind> In reply to @TryAngle "Speaking about that, is": see https://github.com/nim-lang/RFCs/issues/399
15:44:29FromDiscord<Yardanico> 32bit -> 64bit change was mainly needed because of memory requirements
15:44:34FromDiscord<Knedlik> In reply to @Rika "what do you mean": Like when 128b integers become a thing in nim
15:44:43FromDiscord<Yardanico> with 32bit you can't effectively address over 4GB of memory without different hacks
15:44:56FromDiscord<Rika> In reply to @Knedlik "Like when 128b integers": i mean what do you mean by "worth it"
15:45:13FromDiscord<xflywind> It would not come at 2.0 I think.
15:45:33FromDiscord<Knedlik> Like is it significantly worse performance-wise?
15:45:48FromDiscord<Rika> if they become a thing, they most likely will not
15:45:56FromDiscord<TryAngle> Depends on the registers your cpu has I think
15:45:57FromDiscord<Knedlik> Okay, good
15:46:04FromDiscord<Rika> and even if they were, they would be not at parsing but at arithmetic, i'd assume\
15:46:05FromDiscord<Rika> (edit) "assume\" => "assume"
15:46:10FromDiscord<Rika> and not even all of arithmetic
15:46:13FromDiscord<TryAngle> In reply to @TryAngle "Depends on the registers": And how well the OS works with it
15:46:15FromDiscord<Yardanico> C compilers already have 128-bit int types, but almost no CPUs have native support for 128 bits
15:46:20FromDiscord<Rika> probably only for stuff like powers and whatnot
15:46:36FromDiscord<Rika> AND thats not accommodating for whether cpus will get native support
15:46:41FromDiscord<Rika> oh i didnt see what yardy said
15:46:41FromDiscord<Rika> xd
15:46:48FromDiscord<Yardanico> anyway just go read https://en.wikipedia.org/wiki/128-bit_computing
15:46:57FromDiscord<Yardanico> or lets go to #offtopic :)
15:47:23FromDiscord<Rika> cpus wont need to be 128bit to support 128bit arith natively id say
15:47:46FromDiscord<Rika> wont? i mean dont
15:49:20FromDiscord<TryAngle> In reply to @Rika "wont? i mean dont": I think they only need the registers.. The 64x is just the address space just like yardanico said I thought
15:49:33FromDiscord<Rika> not even i think
15:49:44FromDiscord<Rika> you could just use 2 64b registers fused
15:49:48FromDiscord<TryAngle> I mean u said natively
15:49:53FromDiscord<Rika> yes
15:49:54FromDiscord<Rika> i did
15:50:08FromDiscord<Yardanico> modern CPUs have 128 bit registers, and even bigger ones, but they don't have 128 bit native arithmetics
15:50:37FromDiscord<Yardanico> have you heard of AVX-512
15:50:39FromDiscord<Yardanico> 512 means 512bit
15:50:52FromDiscord<TryAngle> In reply to @Yardanico "have you heard of": But that's SIMD no?
15:50:55FromDiscord<Yardanico> so?
15:50:55FromDiscord<Rika> im just imagining how fucked up quad floats would be to process
15:51:34FromDiscord<TryAngle> In reply to @Yardanico "so?": Idk 💀
15:51:35FromDiscord<Knedlik> Really fucked up
15:52:40FromDiscord<Rika> 256b floats 💀
15:52:53FromDiscord<Rika> LETS GO 512b FLOATS
15:53:30FromDiscord<TryAngle> I thought that would just be a 64x8 operation with AVX-512.↔But it's been a year and only short I looked into smth like that so I have really no clue tbh.
15:54:23FromDiscord<2F42BBA1> yo uh... what's nimsuggest? is this sorta like clippy here in rust? to point out the issues in code and what's to improve on
15:55:29FromDiscord<Yardanico> no, it's general code autocomplete and error checker
15:58:53FromDiscord<Alea> Clippy for nim would be the dream <:ritchie_prayge:889231238009876520>
16:02:13duuudethe MS Office paperclip?
16:06:57FromDiscord<Knedlik> Hey guys, can I somehow automatically call the same-named function from multiple files at once? Let’s say multiple things have a proc update() and I want to call all those update() procs?
16:07:45FromDiscord<Yardanico> you store them all in a sequence?
16:07:49FromDiscord<Yardanico> the objects or proc themselves
16:09:06*vicfred joined #nim
16:09:29*vicfred quit (Remote host closed the connection)
16:10:10FromDiscord<Knedlik> :hidethepain:
16:10:42FromDiscord<spoon> like making the proc public and importing it?
16:10:47FromDiscord<Yardanico> In reply to @Knedlik "<:hidethepain:790306236985245706>": ??
16:10:56FromDiscord<Yardanico> In reply to @Knedlik "<:hidethepain:790306236985245706>": > java community
16:11:11FromDiscord<spoon> - respect
16:11:17FromDiscord<Rika> In reply to @Knedlik "Hey guys, can I": i have no idea what you meant by this
16:11:17FromDiscord<Solitude> sussy
16:11:28FromDiscord<Knedlik> They have good memes
16:11:57FromDiscord<spoon> yeah if you want to use a function in a different file, you put an `` at the end and `import` that file
16:12:15FromDiscord<Knedlik> Yeah, so I guess I’ll put all of those in a proc
16:12:55FromDiscord<TryAngle> Omg imagine we had a nim spring framework
16:13:09FromDiscord<Rika> In reply to @Knedlik "Yeah, so I guess": ?
16:13:24FromDiscord<Rika> did i actually have a stroke that last time
16:13:30FromDiscord<Rika> am i the only one not understanding
16:13:54FromDiscord<Knedlik> Basically call many procs of the same name by one statement
16:14:15FromDiscord<spoon> what
16:14:15FromDiscord<Rika> can you pseudocode example?
16:15:51*arkurious joined #nim
16:15:57*def- quit (Quit: -)
16:16:31FromDiscord<Knedlik> sent a code paste, see https://play.nim-lang.org/#ix=3W27
16:16:35*def- joined #nim
16:16:36FromDiscord<Knedlik> (edit)
16:16:57FromDiscord<Knedlik> I don’t think it’s possible, but it could be
16:17:00FromDiscord<TryAngle> U can import as
16:17:25FromDiscord<Rika> `proc update() = file1.update(); file2.update()` ?
16:17:37FromDiscord<Rika> In reply to @TryAngle "U can import as": you dont need to actually
16:17:39FromDiscord<Knedlik> Yeah, but that’s creating another proc
16:17:42FromDiscord<Rika> you can but you dont need to
16:17:45FromDiscord<Yardanico> In reply to @Knedlik "Yeah, but that’s creating": ????
16:17:46FromDiscord<Rika> In reply to @Knedlik "Yeah, but that’s creating": no other way around it
16:17:51FromDiscord<TryAngle> In reply to @Rika "you dont need to": 😳
16:17:53FromDiscord<Knedlik> That’s what I thought
16:18:00FromDiscord<Rika> calling `update()` bare will give an ambiguous error
16:18:11FromDiscord<Knedlik> Ik
16:18:14FromDiscord<Rika> okay
16:18:21FromDiscord<Knedlik> Gone that rabbit hole before :heh:
16:18:44FromDiscord<Knedlik> (edit) "Gone ... that" added "down"
16:18:54FromDiscord<spoon> you can do `proc update() = file1.update();file2.update()` and then use `update()` in the loop lol
16:18:54FromDiscord<demotomohiro> Create a template or macro that transform `Call(update, foo, bar)` to `foo.update(); bar.update()`.
16:20:05FromDiscord<Knedlik> Meh, it’s gonna be done only once and I’m lazy
16:20:40*duuude quit (Ping timeout: 248 seconds)
16:24:39*ehmry quit (Ping timeout: 276 seconds)
16:24:48*emery joined #nim
16:27:34*neurocyte8614492 joined #nim
16:33:40*kenran joined #nim
16:33:50*kenran quit (Client Quit)
16:47:06*rockcavera joined #nim
16:47:06*rockcavera quit (Changing host)
16:47:06*rockcavera joined #nim
16:52:58*duuude joined #nim
16:54:05PMunchHmm, bit annoying that an enum used in a case statement can still get ambiguous errors..
17:04:19FromDiscord<Solitude> and with experminetal: enumOverloading?
17:06:07FromDiscord<enthus1ast> it seems like somehow calling dll functions like to crash
17:07:11FromDiscord<enthus1ast> image.png https://media.discordapp.net/attachments/371759389889003532/967471710767054848/image.png
17:08:43FromDiscord<enthus1ast> could it be an issue that my proc types are {.stdcall.}, but my dll procs actually are normal nimcall?
17:08:59FromDiscord<enthus1ast> it works 30-40 times, then it crashes
17:09:01FromDiscord<Solitude> In reply to @enthus1ast "image.png": tried with arc?
17:09:06FromDiscord<enthus1ast> orc
17:09:11FromDiscord<enthus1ast> crashes with both
17:09:18FromDiscord<enthus1ast> orc and old gc
17:10:20NimEventerNew post on r/nim by icey: Up to date AWS SDK?, see https://reddit.com/r/nim/comments/uaa0ym/up_to_date_aws_sdk/
17:10:40FromDiscord<enthus1ast> its interesting, i have the same issue in another project that also uses dlls
17:12:44FromDiscord<enthus1ast> i'm starting to belive that this is a nim bug
17:14:46FromDiscord<enthus1ast> I'm passing a ref object to the procs in the dll
17:14:56FromDiscord<enthus1ast> but this should be supported or?
17:15:28*duuude quit (Ping timeout: 250 seconds)
17:30:33FromDiscord<enthus1ast> ok when i give a "ptr ref Object" then it at least do not crash
17:30:44FromDiscord<enthus1ast> but i do not use the ref Object much yet
17:31:15FromDiscord<Rika> Pointer to a reference, pretty cursed I’d say
17:32:23FromDiscord<enthus1ast> sure, but any better idea?
17:34:28FromDiscord<Rika> If it worked before then it’s a bug no?
17:35:19FromDiscord<enthus1ast> it did not work, i just finished a simple module system, and as soon i implemented stuff in the module, it started to crash
17:35:38FromDiscord<Rika> Your calling conventions must match
17:35:41FromDiscord<Rika> Do they not?
17:35:47FromDiscord<enthus1ast> now they do
17:36:03FromDiscord<Rika> How do we even start to debug this
17:36:17FromDiscord<Rika> oh it might be related to A/ORC perhaps?
17:36:47FromDiscord<enthus1ast> i think i must first try to reproduce it in a small repo
17:58:00*duuude joined #nim
18:42:08*rockcavera quit (Remote host closed the connection)
18:53:19*duuude quit (Ping timeout: 240 seconds)
18:57:33FromDiscord<-|-> I successfully compiled "Hello World" in Nim for 16-bit MS-DOS, using the OpenWatcom compiler. I can do a write-up, but the process is really quite terrible.
19:01:28PMunch-|-, really? That sounds amazing!
19:02:59FromDiscord<-|-> It was a painful process that required a modified nimbase.h. The resulting binary is rather large at about 72K, but overall this project was an interesting way to spend a few hours.
19:10:31PMunchIs 72K with -d:danger and stripping?
19:13:18FromDiscord<dom96> definitely do a write up, sounds cool!
19:13:31FromDiscord<dom96> if you could upstream the nimbase.h mods that would be cool too
19:14:31PMunchMan building Nim on an old Raspberry Pi takes forever :P
19:23:07FromDiscord<-|-> In reply to @PMunch "Is 72K with -d:danger": Oh, I haven't tried -d:danger. Stripping is done, but I didn't compile with `owcc -Os`.
19:24:01PMunchNim will by default include a bunch of debug information and checks. With -d:release or -d:danger it gets stripped out. This impacts binary size a lot!
19:26:48PMunchNim with -d:release --opt:size and then strip -s on a `echo "Hello world"` program on my machine goes from 110k to 35k
19:30:12FromDiscord<-|-> I'ma make sure to test that.
19:30:25FromDiscord<-|-> and make my patches to nimbase.h a little less hacky first
19:33:44FromDiscord<-|-> Also, OpenWatcom seems to hate multiple dots in file names (even on non DOS/Windows) platforms. I'm not quite sure why.
19:34:03PMunchWhat kind of changes did you have to make?
19:34:13PMunchLike my.file.nim?
19:36:55FromDiscord<-|-> For the file names issue, I had to snag the `.nim.c` files and rename them to `_nim.c`. I also had to remove any `@` from the file names, as that caused a snag.
19:37:05FromDiscord<-|-> After that, the linking stage was able to finish successfully
19:37:21FromDiscord<Yardanico> does memory allocation work? :P
19:37:34FromDiscord<-|-> I haven't tested
19:38:06FromDiscord<-|-> Presumably it does. I enabled `-d:useMalloc` and the arc reference counter.
19:38:13FromDiscord<Yardanico> sent a code paste, see https://paste.rs/o1j
19:38:38FromDiscord<-|-> I did hit a little snag with the pointer size, since DOS has 16-bit pointers (except for those cursed far ones), and that's smaller than NI.
19:38:49FromDiscord<-|-> I targeted the i386 CPU since there's no i086...
19:38:57FromDiscord<Yardanico> heh
19:39:55FromDiscord<-|-> This is all a terrible ideaâ„ąïž, but on the other hand, we could build programs for the 8086.
19:40:09FromDiscord<-|-> The resulting binaries run fine in an 8086 (only 8086 instructions) emulator
19:40:34PMunchI mean that alone is worth an article
19:40:50PMunchNim truly is a language you can get to run anywhere! :P
20:02:03*Zectbumo joined #nim
20:37:42*jmdaemon joined #nim
20:44:52FromDiscord<-|-> I hope nobody objects to me adding an i086 CPU target
20:45:29FromDiscord<Knedlik> Lol
20:46:15FromDiscord<Knedlik> Don’t look at my discord tag
20:47:49FromDiscord<Knedlik> Also, how do I continuously dump the debug stream into a file?
20:48:10PMunchWhat do you mean "the debug stream"?
20:48:21FromDiscord<-|-> stderr?
20:48:21PMunch./myprogram > my.log
20:48:52FromDiscord<Knedlik> What? By the debug stream I mean the windows debug stream SDL uses for logs
20:50:13FromDiscord<Elegantbeef> Redirect your stderr to a file should work afaik
20:50:51FromDiscord<-|-> `(program and arguments here) 2>debug.log`
20:50:57FromDiscord<Elegantbeef> I think you can do `stderr = aFileHandleToYourErrorFile`
20:51:10FromDiscord<Elegantbeef> Does that piping even work with winblows?
20:53:22FromDiscord<Knedlik> aFileHandle?
20:53:38FromDiscord<Elegantbeef> Yes
20:53:45FromDiscord<Knedlik> I see it
 hmmm
20:55:22FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3W3q
20:55:27FromDiscord<Elegantbeef> For instance on redirecting the stdout
20:55:33FromDiscord<Elegantbeef> The same works for stderr afaik
21:03:38FromDiscord<Knedlik> Hmmm, the open command doesn’t create the file
21:04:34FromDiscord<Elegantbeef> I tested it before hand it certainly does
21:04:57FromDiscord<Knedlik> Where did it put the file?
21:05:09nrds<Prestige99> Elegantbeef how can I avoid this variable name conflict issue in https://play.nim-lang.org/#ix=3W3t ?
21:05:17FromDiscord<Elegantbeef> In the CWD
21:05:32FromDiscord<Knedlik> CWD?
21:05:37nrds<Prestige99> ah, `this`
21:05:41FromDiscord<Elegantbeef> change the template parameter
21:05:53nrds<Prestige99> grave markers fixed it
21:05:57FromDiscord<Elegantbeef> current working directory
21:06:26FromDiscord<Elegantbeef> Also perhaps stop pretending it's C# 😛
21:09:59FromDiscord<Knedlik> So on stdout = logFile I got lvalue required as left operand
21:10:34FromDiscord<Elegantbeef> I really like the code you've supplied it makes it very clear what the issue is
21:12:51FromDiscord<Knedlik> sent a code paste, see https://play.nim-lang.org/#ix=3W3u
21:13:30FromDiscord<Elegantbeef> Perhaps you cannot redirect stderr
21:14:02FromDiscord<Knedlik> Got the same with stdout
21:14:28FromDiscord<Elegantbeef> Ah windows
21:14:29FromDiscord<Elegantbeef> Fun
21:14:45FromDiscord<Elegantbeef> Yea i get the same issue with mingw
21:15:44FromDiscord<Knedlik> Perhaps I can just instruct people to launch from command line (or create a script for that) when I need to solve a bug
21:22:01*Gustavo6046 joined #nim
21:26:59FromDiscord<-|-> I'm going to have to submit a patch to OpenWatcom to fix `@` in file names, but adding 8086/MS-DOS and owcc support to Nim is going well.
21:29:45*neurocyte8614492 quit (Ping timeout: 272 seconds)
21:29:50FromDiscord<-|-> `-d:danger` gets a hello world down to 12k, which I say is good enough
21:31:50FromDiscord<Knedlik> I’m for some reason continuously failing to route streams to a file

21:32:14FromDiscord<Elegantbeef> Blame windows
21:32:18FromDiscord<Knedlik> Is it even possible through a batch script?
21:32:31FromDiscord<-|-> This is just usual SDL_Log, right?
21:33:06FromDiscord<Knedlik> SDL-made logCritical
21:33:25FromDiscord<Knedlik> Atleast the messages I make
21:36:40FromDiscord<Knedlik> Like the file gets created, but it doesn’t get routed there for some reason
22:17:53FromDiscord<jmgomez> is there a helper to remove the null terminator in a cstring?
22:18:29FromDiscord<Elegantbeef> I'm just looking at that question going "what"
22:19:03FromDiscord<Elegantbeef> A cstring doesnt store length so "removing the null terminator" would be..... what making the cstring infinite size?
22:19:46PMunch@Elegantbeef, well it wouldn't be infinite, just arbitrary. There's bound to be a null in memory somewhere
22:20:10FromDiscord<Elegantbeef> Nah cause that means you didnt remove the null terminator
22:20:19FromDiscord<Elegantbeef> You iterate from the stack removing all `\0` until you're done!
22:20:26FromDiscord<jmgomez> thing is it's getting in the way, unreal has a FName system where strings (their implementation of string) is store in a table and indexed. So if I build a string from a nim c_string they identify it as another string with the same "value"
22:20:59FromDiscord<jmgomez> so when calling function via their reflection system it cant find it due to it being in the midle
22:21:04FromDiscord<jmgomez> (edit) "midle" => "middle"
22:21:45FromDiscord<Elegantbeef> Is there any way to get it from cstring?
22:21:51FromDiscord<Elegantbeef> Cause what you're asking doesnt make sense
22:23:27FromDiscord<jmgomez> Im asking if you can access to it from nim's cstring so I can remove it and convert it to a FString before going to the FName
22:24:11FromDiscord<Elegantbeef> I mean just do `$myCstring` and you now have a pascal string copy
22:24:25FromDiscord<Elegantbeef> I dont see how removing it changes anything
22:24:49FromDiscord<Elegantbeef> If you have a cstring and need an FString you need to just convert it
22:25:12FromDiscord<Elegantbeef> That conversion is on you afaict and not something UE supplies
22:26:40FromDiscord<Elegantbeef> What's the layout of fstring?
22:28:47FromDiscord<jmgomez> I have bind the constructor where it's supposedly takes a FString(cstring) will see if can get it by binding something else, it was just frustrating that was finding the bug somewhere else and found that the actual function was a null pointer due to that \0
22:29:40FromDiscord<Elegantbeef> I mean that `\0` is required for anything that operates on a cstring, so removing it is just going to ruin your day
22:30:01FromDiscord<Elegantbeef> It's odd that they dont take pascal strings anywhere
22:30:01FromDiscord<jmgomez> It wouldnt in this particular case but I understand what you are saying
22:30:14FromDiscord<Elegantbeef> How wouldnt it ruin your day?
22:30:43FromDiscord<Elegantbeef> Dropping the `\0` means the function that takes just a cstring has 0 clue where it terminates
22:30:44FromDiscord<jmgomez> because it would match to their FString value
22:31:00FromDiscord<Elegantbeef> It already does
22:31:34FromDiscord<jmgomez> apparently not because it cant find the name in the table but when doing it in cpp directly it does
22:31:43FromDiscord<Elegantbeef> Can i see the code?
22:31:59FromDiscord<Elegantbeef> You're using a cstring in the C++?
22:32:17FromDiscord<jmgomez> sure but there are a lot of things going on, whatever Cpp uses a literal
22:33:00FromDiscord<Elegantbeef> So if C++ uses a string literal and you use a cstring literal in nim there is no difference
22:33:03FromDiscord<Elegantbeef> The issue is elsewhere
22:34:37FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3W3D
22:34:56FromDiscord<Elegantbeef> `makeFString` takes a `cstring` correct?
22:35:01FromDiscord<jmgomez> yes
22:35:17FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3W3E
22:35:28PMunchHmm, I'm working on a system to automatically generate routes from a route specification and converter procedures. Essentially I take a procedure like `proc getPost(user: User, post: Post): string` it will look for a procedure which takes a Request and returns a User, and one which takes a Request or a Request and a User and returns a Post.
22:35:35PMunchI have that part working well now
22:35:55PMunchBut now I want to create a nice system to define these
22:36:12FromDiscord<Elegantbeef> Where in your C++ side do you make the FString?
22:36:44FromDiscord<jmgomez> it is just like FString("string here")
22:37:05PMunchI'm thinking of just grabbing the Jester DSL, `router myName: get "/user/$id/posts/$post": getPost` can anything think of a better one?
22:37:06FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3W3F
22:37:08FromDiscord<Elegantbeef> Ok so then it's identical
22:37:48FromDiscord<jmgomez> you think? So maybe it's me. Tomorrow I will pick the problem again
22:38:09PMunchI guess I could have a pragma so the proc would be `proc getPost(user: User, post: Post): string {.routeGet: "/user/$id/posts/$post".}`
22:38:17FromDiscord<Elegantbeef> Short of `(get, "/user/$id/posts/$post", getPos)` not really pmunch 😄
22:38:39PMunchHmm, you want them as tuples?
22:38:52FromDiscord<Elegantbeef> Thought you were already doing the annotation
22:39:13PMunchHuh?
22:39:45FromDiscord<Elegantbeef> Thought you already were doing the pragma annotation
22:39:58PMunchOh, I do it for the converters
22:41:03PMunchCurrently my testing code looks like this: http://ix.io/3W3G
22:42:02PMunchAnd I've just been calling my test macro as `autoroute("/user/$id/post/$pid", getTest)` :P
22:42:04FromDiscord<Elegantbeef> What's the point of the annotation here?
22:42:13PMunchrouteConverter?
22:42:21FromDiscord<Elegantbeef> Yea
22:42:55PMunchIt registers the procedure as one which can be used to convert things from requests to the requested type
22:43:15PMunchYou can't get all procedures in Nim unfortunately :(
22:43:44FromDiscord<Elegantbeef> Cant you just use procedure dispatch?
22:43:45FromDiscord<Elegantbeef> Or am i missing something
22:43:55PMunchProcedure dispatch?
22:44:13PMunchThe problem is I don't know the name of those procedures
22:44:15FromDiscord<Elegantbeef> Yea cant you just import this file and have it reason what you need
22:44:40FromDiscord<Elegantbeef> Who cares
22:44:56PMunchHow would I generate a call to a procedure I don't know the name of?
22:45:39FromDiscord<Elegantbeef> You use a more generic `get(T: typedesc[User], req: Request): T`
22:45:53FromDiscord<Elegantbeef> Then you dont need the names you just need the exported procedure in scope
22:46:08PMunchI thought about that
22:46:19FromDiscord<Elegantbeef> replace `get` with a more reasonable named procedure for your solution
22:46:34PMunchI thoughts about that
22:46:46FromDiscord<Elegantbeef> You thoughtseded about that
22:47:13PMunchIt's late and I'm drinking gin and tonic, give me a break :P
22:47:44FromDiscord<Elegantbeef> But yea i think using Nim's dispatch is a more reasonable solution
22:47:53PMunchBut yeah, I thought about that, but I had some trouble with it
22:48:16FromDiscord<Elegantbeef> Like what?
22:48:46FromDiscord<Elegantbeef> I'm guessing calling the specific get?
22:50:34PMunchI don't remember..
22:50:39PMunchHmm, let me try it again
22:51:17FromDiscord<Elegantbeef> See kids drugs are bad no matter if they come from a bottle or a rolle
22:51:41PMunchOne benefit of the "register the procs you want" approach is I could technically have a procedure that isn't actually written for this purpose and insert that into the logic
22:52:22FromDiscord<Elegantbeef> I mean you have to annotate it anyway
22:52:27FromDiscord<Elegantbeef> So that's like as much work as making an alias to it
22:52:31PMunchBesides, I will have to generate all different combinations of previous arguments in `when compiles` statements to pick the correct one
22:52:46FromDiscord<Elegantbeef> No you dont
22:53:17PMunchWell it doesn't have to be done through a pragma, I was planning on having a `registerConverter` procedure as well
22:53:22FromDiscord<Elegantbeef> Type all the parameters and convert the name to the write procedure and invoke it
22:53:27PMunchWhich just took a bunch of names and registered all of them
22:54:04PMunchNot quite sure what you mean
22:54:10FromDiscord<Elegantbeef> Atleast i think this can be statically reasoned
22:54:20FromDiscord<Elegantbeef> Give an example of the types/procedures if you dont mind
22:54:54FromDiscord<Elegantbeef> Like i see your previous example but i dont get how it's dispatched
22:55:50PMunchAh, the dispatch is basically "pick the procedure which returns the type I want and takes as many arguments of types I have already parsed as possible"
22:56:48FromDiscord<Elegantbeef> Ok so then you can just use the nim proc conversion dispatch where you do `(proc(r: RetType, argA: ArgAType, argB: ArgBType): RetType)(get)(argA, argB)` no?
22:57:22PMunchOh sure
22:57:32PMunchBut for that I need to know the arguments
22:58:20PMunchLet's say I can get a post through `/post/$postId`
22:58:30PMunchThat would return the latest version of the post
23:01:12PMunchAnd then I could have another route to e.g. `put /post/$postId`, for that you need an authenticated user. So I have a converter which takes a Request and returns an AuthenticatedUser (probably by checking for a session cookie), and then a procedure which takes a Request and an AuthenticatedUser and returns a Post which can be modified (or something like that)
23:01:48PMunchHmm, it's kinda hard to explain..
23:01:58PMunchMaybe I don't need that feature
23:02:14PMunchOkay, scratch that
23:02:22FromDiscord<Elegantbeef> The way i see it you could do `AuthenticatedUser(put /post/$postId)`
23:02:59FromDiscord<Elegantbeef> The macro then expands it calling a converter to `AuthenticatedUser` then calling `AuthenticatedUser.get(postId)`
23:03:04FromDiscord<Elegantbeef> Or whatever it should do
23:03:14PMunchYou have a route which needs a User, a Post, and an Edit for example
23:03:31PMunchUser needs the Request to get the session
23:03:59FromDiscord<Elegantbeef> The url looks like what?
23:04:00PMunchPost needs the Request and the User to get the post ID and check that it is editable by the user
23:04:44PMunchNow Edit takes a Post and a Request and checks that the payload in the request is valid for the post you want to edit
23:06:05FromDiscord<Elegantbeef> And the url is the same?
23:06:22PMunchSo you have `get(_: typedesc[User], r: Request): User`, `get(_: typedesc[Post], u: User, r: Request)`, and `get(_: typedesc[Edit], p: Post, r: Request)`
23:06:54PMunchThe route is `put "/post/$id"` with a JSON payload body
23:07:35PMunchAnd the procedure call is `proc editPost(p: Post, e: Edit)`
23:07:59PMunchAnd does some database stuff to update the post with whatever fields are present in the Edit
23:08:05FromDiscord<Elegantbeef> Ok i see the issue
23:08:28FromDiscord<Elegantbeef> The URL alone cannot hold the logic and there is no nice way to explictly state what's required
23:08:35PMunchExactly
23:08:38FromDiscord<Elegantbeef> Though i'd argue that's why it should be explicit
23:08:51PMunchHow would you make it explicit?
23:09:35FromDiscord<Elegantbeef> I dont think you can really do it easily
23:10:06FromDiscord<Elegantbeef> Like you cannot really say "This requires X, Y, Z and call get(X), get(X, Y), get(Y, Z)\`
23:10:28PMunchExactly, that would void the entire concept :P
23:10:55FromDiscord<Elegantbeef> Well I mean your concept was static typed, dyanmic dispatch isnt statically typed 😛
23:11:10PMunchWell it is still static dispatch
23:11:22FromDiscord<Elegantbeef> Is it really
23:11:28PMunchOne route will always call the same procedures
23:11:57FromDiscord<Elegantbeef> How do you even plan on annotating the requirements of a route
23:12:01FromDiscord<Elegantbeef> Or is it all inferred?
23:12:20PMunchRequirements?
23:13:39PMunchThe types required for a route is read from the signature of the procedure you link to the route
23:15:28PMunchThe stuff required to parse the types isn't defined anywhere, that is all up to the converter procs
23:20:31FromDiscord<Elegantbeef> Ah ok so it's the same thing as the `get` just dispatch is done slightly differently
23:22:48PMunchWell the dispatch is done based on which types are in the signature
23:23:13FromDiscord<Elegantbeef> I mean it's the same thing as my suggestion just with manual annotations and not using `when` blocks
23:23:24PMunchSure
23:23:40PMunchBut those when blocks would be annoying to generate
23:24:18FromDiscord<Elegantbeef> Worse than the typechecking macro logic?
23:24:33PMunchBecause every getter can take either just a request, or any combination of arguments in the route procedure
23:24:46PMunchThe above example of editPost for example
23:24:59FromDiscord<Elegantbeef> Dont you have to do the exact same thing but for parameter comparisons?
23:25:07PMunchNot quite
23:25:34PMunchI have a set of `availableTypes` which are the types I've already seen, and the stuff they can convert to
23:25:46PMunchIt starts out with only Request
23:26:13PMunchAnd anything that only takes a request as an argument
23:26:41PMunchSo in the above example the initial set of availableTypes would be Request and User (because User only takes a Request as an argument)
23:27:07FromDiscord<Elegantbeef> I mean it's still "make all the permutations of parameters" 😄
23:27:22PMunchThen when in encounters Post it finds the (Request, User) -> Post procedure and now the set is `Request, User, Post`
23:27:55PMunchSure, but I don't have to generate a bunch of `when compiles` for every combination of arguments
23:28:00FromDiscord<ajusa> I haven't followed the whole conversation here, but aren't converters limited to doing one conversion at once? Like you can't sequence multiple at a time
23:28:12PMunch@ajusa, yes, normal Nim converts are
23:28:20FromDiscord<Elegantbeef> We're not talking about converters converters
23:28:21PMunchBut this is a custom system
23:28:32PMunchI really need to find a better name for them..
23:28:59FromDiscord<Elegantbeef> You dont even need the `compiles` assuming a `get` is in scope you can just do `(proc(...))(get) != nil` 😛
23:29:42PMunchOoh, that's true
23:29:52PMunchBut I still need to build all the different arguments
23:30:15PMunchWith the current system it's just `if myType in availableTypes`
23:30:37FromDiscord<Elegantbeef> Again you still have to do the permutations though
23:30:58PMunchNot really
23:31:18FromDiscord<Elegantbeef> `proc getThing(a: User, p: Post)` and `getThing(p: Post, u: User)` is both valid
23:31:30PMunchAh, no
23:31:42PMunchYou must specify the arguments in order
23:31:55PMunchWait, was that a route or a converter?
23:32:02FromDiscord<Elegantbeef> Converter
23:32:09PMunchOh, yeah that works
23:32:56PMunchavailableTypes is a table of types to converter procs, and when I look one up I will know all the available procedures it has (because I have them all pre-registered)
23:33:44FromDiscord<Elegantbeef> Yea i got that, point is you still need to do the same application of logic just slightly differently. But anyway just disregard me
23:34:57PMunchOh yeah, the logic is similar
23:44:22*Guest32 quit (Quit: Client closed)
23:46:01PMunchWith `(proc(...))(get) != nil`, is this still static dispatch?
23:56:50PMunchHmm, there is nothing really related to routes here..
23:56:57PMunchI could make it even more generic
23:58:00PMunchSo you attach a pragma to your "routables" and then it generates a procedure to call it with only the base type.