<< 05-08-2021 >>

00:02:26FromDiscord<@bracketmaster-5a708063d73408ce4> how to declare a function type in nim
00:03:10FromDiscord<undersquire> func () i think
00:03:23FromDiscord<undersquire> u mean like in a var?
00:03:43FromDiscord<@bracketmaster-5a708063d73408ce4> typo
00:03:44FromDiscord<@bracketmaster-5a708063d73408ce4> how to -\> how do you
00:05:09FromDiscord<undersquire> u mean like that?
00:05:14FromDiscord<undersquire> sent a code paste, see https://play.nim-lang.org/#ix=3v1d
00:05:38*krux02 quit (Remote host closed the connection)
00:08:58FromDiscord<@bracketmaster-5a708063d73408ce4> something like this\: type myfunc proc(s \: string ) -\> bool
00:09:52FromDiscord<undersquire> oh
00:10:16FromDiscord<undersquire> its probably like anonymous functions
00:10:32FromDiscord<undersquire> im unsure tho
00:10:33FromDiscord<undersquire> sent a code paste, see https://paste.rs/5fT
00:13:09FromDiscord<undersquire> yes this works just tested it
00:14:43FromDiscord<undersquire> does anyone know how to specify nim compile options for a nimble project?
00:15:13FromDiscord<undersquire> do they just go into the .nimble file?
00:17:24FromDiscord<theangryepicbanana> ok so I think I've gotten generic interfaces working in nim, but it has a funny bug that I've been trying to fix for like 3 hours
00:18:09FromDiscord<theangryepicbanana> if a type that implements an interface isn't generic, it complains for absolutely no reason
00:18:17FromDiscord<theangryepicbanana> (edit) "an" => "a generic"
00:19:11FromDiscord<theangryepicbanana> I think it's expecting type params somewhere, but I have no clue where lol
00:19:16FromDiscord<Elegantbeef> i believe they have to go into `config.nims` or one of the other format versions↵(@undersquire)
00:19:20FromDiscord<dom96> In reply to @undersquire "do they just go": no, they go into a nim.cfg or config.nims file
00:19:50FromDiscord<undersquire> ah ok
00:20:01FromDiscord<undersquire> is there documentation on how to use config.nims?
00:20:07FromDiscord<undersquire> i cant find any on nimble repo
00:21:03FromDiscord<Elegantbeef> https://nim-lang.org/docs/nims.html
00:21:12FromDiscord<Elegantbeef> nimscript as a configuration file
00:21:38FromDiscord<undersquire> ah ok ty
00:39:25FromDiscord<@bracketmaster-5a708063d73408ce4> Thanks!↵(@undersquire)
00:40:39FromDiscord<undersquire> np
00:40:49FromDiscord<undersquire> also is there a way to have a sequence of a non-concrete type?
00:41:17FromDiscord<undersquire> like if I have a type using Generics, is the only way to have a sequence of it is it use object variants instead?
00:41:46FromDiscord<Rika> Yes pretty much
00:41:49FromDiscord<undersquire> rip
00:41:52FromDiscord<undersquire> sent a code paste, see https://play.nim-lang.org/#ix=3v1l
00:41:57FromDiscord<Elegantbeef> You need to box it somehow so yes
00:42:10FromDiscord<undersquire> would using a ref work instead?
00:42:13FromDiscord<undersquire> or a ptr
00:42:22FromDiscord<Rika> No
00:42:27FromDiscord<undersquire> it doesnt error with ptr
00:43:25FromDiscord<undersquire> yeah nvm ptr wont work
00:43:30FromDiscord<undersquire> ig ill just use object variants then
00:48:04FromDiscord<Elegantbeef> You could look at patty to make your variants easier https://github.com/andreaferretti/patty#constructing-variant-objects
00:48:07nrds<R2D299> itHub: 7"A pattern matching library for Nim"
01:07:24FromDiscord<undersquire> sent a code paste, see https://play.nim-lang.org/#ix=3v1s
01:08:32FromDiscord<Elegantbeef> you also could do `: t.type` instead of `auto` for more obvious return type
01:08:51FromDiscord<undersquire> oh really? thats even better lmfao
01:08:55FromDiscord<Elegantbeef> or do `proc fetch[T](vm: var VM, t: T): T`
01:09:06FromDiscord<undersquire> i was but then u cant do vm.fetch 😭
01:09:20FromDiscord<undersquire> vm.fetch[uint8]()
01:09:20FromDiscord<undersquire> oh
01:09:28FromDiscord<undersquire> wait u can still do vm.fetch(uint8)
01:09:35FromDiscord<undersquire> (edit) "wait u can still do vm.fetch(uint8) ... " added "using ur way"
01:10:20FromDiscord<undersquire> In reply to @Elegantbeef "or do `proc fetch*[T](vm:": do generics or just using t: type have any advantages or just preference
01:10:31FromDiscord<Rika> i mean `proc fetch(vm: var VM, t: typedesc): t`
01:10:52FromDiscord<undersquire> wow i need to re read the docs lol
01:10:55FromDiscord<Rika> avoid using `type` as a type
01:11:09FromDiscord<Elegantbeef> there are many ways to do this
01:13:43FromDiscord<Elegantbeef> Also `t: typedesc` is an implicit generic
01:14:05FromDiscord<Rika> yes indeed
01:15:04FromDiscord<Elegantbeef> Guess should point out conventionally you use capitals for generics
01:15:05FromDiscord<undersquire> so is it really just preference at this point
01:15:20FromDiscord<undersquire> In reply to @Elegantbeef "Guess should point out": yes but even for parameters that are typedesc ?
01:15:30FromDiscord<Elegantbeef> Yes
01:16:16FromDiscord<undersquire> oh ok
01:16:16FromDiscord<Elegantbeef> Atleast when using a single character
01:16:43FromDiscord<undersquire> what is the difference between `type` and `typedesc` ?
01:16:48FromDiscord<Rika> clarity
01:16:57FromDiscord<undersquire> do they do the same thing?
01:17:03FromDiscord<Elegantbeef> Nothing aside from one being more verbose
01:17:05FromDiscord<Rika> i do not know, they probably do
01:17:32FromDiscord<undersquire> there must be a difference
01:17:39FromDiscord<undersquire> otherwise whats the point of the longer one lol
01:18:14FromDiscord<Elegantbeef> `type` is older and was deprecated with the typedesc alias to be more clear
01:18:37FromDiscord<undersquire> ah i see
01:18:41FromDiscord<Elegantbeef> Cause `type` can be used for extracting type
01:18:44FromDiscord<Elegantbeef> !eval echo type 100
01:18:46NimBotint
01:18:47FromDiscord<undersquire> it seems type used to be typedesc and typeof combined
01:19:29FromDiscord<Elegantbeef> It's a bit ambiguous give then above example works
01:20:38FromDiscord<Elegantbeef> given the\ apparently swapped the 'n' around 😛
01:21:16FromDiscord<undersquire> lol
01:22:36FromDiscord<Elegantbeef> There are a few aliases like that in Nim
01:22:36FromDiscord<Elegantbeef> !eval echo on
01:22:39NimBottrue
01:22:46FromDiscord<undersquire> sent a code paste, see https://play.nim-lang.org/#ix=3v1v
01:22:53FromDiscord<undersquire> like should I not use commas?
01:23:09FromDiscord<undersquire> cause i see people sometimes not 😂
01:23:14FromDiscord<Elegantbeef> It's purely up to you there, i generally dont use commas, some people put them all on one line
01:23:21FromDiscord<undersquire> ah
01:23:32FromDiscord<undersquire> i wont bother with them then since i use multiple lines
01:23:49FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3v1w
01:23:52FromDiscord<undersquire> lol
01:23:56FromDiscord<undersquire> yeah commas make sense there
01:24:40FromDiscord<Elegantbeef> I wouldnt be too worried about following conventions truthfully, it's a rather forgiving language 😀
01:24:48FromDiscord<Rika> hey
01:24:48FromDiscord<Rika> wtf
01:24:53FromDiscord<undersquire> In reply to @Elegantbeef "I wouldnt be too": yeah lol
01:24:54FromDiscord<Rika> im no sadist
01:25:16FromDiscord<Elegantbeef> As long as your types/consts start with a capital letter, and procedures with a lower case you're golden
01:25:56FromDiscord<undersquire> and i start enums with a lowercase and follow it with capital
01:25:56FromDiscord<Elegantbeef> Lol rika i unintentionally insulted you, score
01:26:19FromDiscord<undersquire> sent a code paste, see https://play.nim-lang.org/#ix=3v1x
01:26:31FromDiscord<Elegantbeef> Or use `{.pure.}`
01:26:32FromDiscord<undersquire> is that conventional naming for enum values?
01:27:02FromDiscord<Elegantbeef> Enums are a bit of a sore spot, but overridable enums in devel makes it better
01:27:25FromDiscord<Rika> In reply to @Elegantbeef "Lol rika i unintentionally": nah im joking i use three lines for enums
01:27:34FromDiscord<undersquire> cause i see the official docs using the naming i sent above
01:28:15FromDiscord<theangryepicbanana> In reply to @Elegantbeef "Enums are a bit": yeah enums could use an overhaul imo
01:28:19FromDiscord<Elegantbeef> With the experimental overridable enums Where possible the type system removes ambiguity for you, so if you have two or more enum names but you do something like `let a: Colors = red` it's fine
01:28:28FromDiscord<undersquire> ok
01:28:38FromDiscord<Elegantbeef> But yea that convention si fine
01:28:45FromDiscord<undersquire> i kinda wish enum values were masks behind Colors.
01:28:58FromDiscord<undersquire> so that they arent just global names
01:29:05FromDiscord<Elegantbeef> Then use `Colors {.pure.}`
01:29:14FromDiscord<Elegantbeef> pure enums are hidden behind `Colors` when there is ambiguity
01:29:41FromDiscord<undersquire> ah ok
01:29:46FromDiscord<undersquire> Colors. ?
01:29:51FromDiscord<undersquire> (edit) "Colors. ? ... " added "(when using {.pure.}"
01:29:52FromDiscord<Elegantbeef> What do you think of this banana↵https://github.com/nim-lang/Nim/blob/a273ea70e8817e3509014a1b3dcd16a360ed400b/tests/enum/toverloadable_enums.nim
01:29:53FromDiscord<undersquire> (edit) "{.pure.}" => "{.pure.})"
01:30:07FromDiscord<Elegantbeef> Yea
01:30:12FromDiscord<undersquire> kk
01:30:31FromDiscord<Rika> you lied, this aint no banana
01:30:40FromDiscord<Elegantbeef> Sorry
01:30:50FromDiscord<Elegantbeef> Commas save lives or something like that
01:31:34FromDiscord<theangryepicbanana> In reply to @Rika "you lied, this aint": I am the banana
01:31:39FromDiscord<theangryepicbanana> obv
01:31:57FromDiscord<Elegantbeef> Rika knows, they just like toying with me
01:32:47FromDiscord<theangryepicbanana> unrelated, I've made the compiler segfault 5 different ways today
01:33:07FromDiscord<theangryepicbanana> very fun
01:33:10FromDiscord<Elegantbeef> Nice, that's more than me and i've toyed with the internals of it
01:33:20FromDiscord<Elegantbeef> Document how with minimal reproductions?
01:33:36FromDiscord<theangryepicbanana> well the issue is that I have no clue why it's happening
01:34:54FromDiscord<theangryepicbanana> possibly related question, do you have to an ident nodes in order to use it in multiple different places?
01:35:01FromDiscord<theangryepicbanana> to copy an
01:35:15FromDiscord<Elegantbeef> nah an ident node is unbound
01:35:23FromDiscord<theangryepicbanana> what about symbols
01:35:34FromDiscord<Elegantbeef> symbols are looked up and therefore limited to where they can be used
01:36:02FromDiscord<Elegantbeef> An identifier is like you just typed the word it holds, a symbol is typed and semantically checked so it maps to a specific thing
01:36:04FromDiscord<theangryepicbanana> would I theoretically be able to change a symbol node to an ident node and have it work just fine?
01:36:26FromDiscord<Elegantbeef> Yes desyming a node is commonly done when dealing with typed AST
01:36:54FromDiscord<Elegantbeef> Depending on what you're doing you only want to desym specific nodes so the lookups still function
01:36:56FromDiscord<theangryepicbanana> hmm ok. I think nim is trying to turn my type parameters into symbols and which is screwing everything else up
01:38:01FromDiscord<theangryepicbanana> thanks, I'll try that then
01:38:10FromDiscord<theangryepicbanana> is there like a builtin function for it?
01:38:12FromDiscord<Elegantbeef> Well it's going to turn them into symbols after the macro is ran so if you're emitting incorrect code that's on you \:P
01:38:35FromDiscord<theangryepicbanana> well after the macro is run sure
01:38:55FromDiscord<theangryepicbanana> but it's happening while I'm building up nodes inside a macro
01:39:07FromDiscord<Elegantbeef> There is not anything for it, it's a relative simple procedure though
01:39:16FromDiscord<theangryepicbanana> oof ok
01:39:22FromDiscord<Elegantbeef> https://github.com/beef331/nimscripter/blob/bigrewrite/src/nimscripter/expose.nim#L6
01:39:25FromDiscord<Elegantbeef> Steal it
01:39:27FromDiscord<Elegantbeef> I give you permiission
01:39:59FromDiscord<theangryepicbanana> pog thx
01:40:03FromDiscord<Elegantbeef> That fully desyms it though, so be cautious if you want any typed nodes to remain
01:40:24FromDiscord<theangryepicbanana> I ideally want everything to be untyped here
01:41:15FromDiscord<Elegantbeef> Then there you go
01:41:42FromDiscord<Elegantbeef> I suppose one could also emit another macro call after this one that takes untyped, but i've never done that so dont know how well that'd work
01:42:45FromDiscord<theangryepicbanana> well the good news is that it segfaults faster now
01:42:55FromDiscord<Elegantbeef> Noice
01:43:22FromDiscord<theangryepicbanana> oh yay it works now
01:43:46FromDiscord<theangryepicbanana> here's the code if you want to burn your eyes https://replit.com/@theangryepicbanana/nim-interface-test
01:44:56FromDiscord<theangryepicbanana> still crashes for non-generic types, but I suppose a dummy type works for now
01:45:16FromDiscord<Elegantbeef> Glad to see my concept work is still being used 😛
01:45:27FromDiscord<theangryepicbanana> yep
01:45:44FromDiscord<Elegantbeef> Jeez learn to write a proc once in a while
01:46:03FromDiscord<theangryepicbanana> well it's just a lot of bad code
01:46:14FromDiscord<theangryepicbanana> I've been struggling with this for like a week now
01:46:34FromDiscord<theangryepicbanana> ooh I wonder if methods work
01:46:42FromDiscord<Elegantbeef> Yea i'm just commenting on the 200 line macro
01:47:04FromDiscord<theangryepicbanana> yeah it could probably use some work
01:47:33FromDiscord<theangryepicbanana> also update: methods don't work and I'm not sure why
01:47:46FromDiscord<theangryepicbanana> well anyways this is progress at least
01:48:07FromDiscord<theangryepicbanana> it's mainly based on this super hacky thing I found on the forums https://forum.nim-lang.org/t/3642#22706
01:48:53FromDiscord<theangryepicbanana> it's like the interfaced lib or something, but you don't need to explicitly cast to the interface type
01:50:31FromDiscord<Elegantbeef> Pretty hard to audit what's going on in that macro so i can only sing "brave sir robin" 😀
01:51:20FromDiscord<theangryepicbanana> lol understandable
01:51:25FromDiscord<theangryepicbanana> I barely understand half of it
02:11:55FromDiscord<ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3v1H
02:12:18FromDiscord<Elegantbeef> standard `nim -v` and what os/arch?
02:13:30FromDiscord<Elegantbeef> Also isnt this completely useless?
02:13:50FromDiscord<ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3v1I
02:14:12FromDiscord<ajusa> Well this is just the type definition, it doesn't do anything yet
02:14:31FromDiscord<Elegantbeef> No i mean the entire bit procedure
02:15:20*arkurious quit (Quit: Leaving)
02:15:30FromDiscord<ajusa> What do you mean? It just raises it to a power of 2?
02:15:49FromDiscord<ajusa> This is translated from C2Nim where a bit macro was defined, that's why it's a bit odd
02:16:08FromDiscord<Elegantbeef> Well is that macro even needed
02:16:14FromDiscord<Elegantbeef> If you use a bitset it's fine
02:16:24FromDiscord<ajusa> and I just realized that if I move the file out of that directory (where config.nims isn't being used) then it compiles fine.
02:16:33FromDiscord<Elegantbeef> Compare https://play.nim-lang.org/#ix=3v1L to https://play.nim-lang.org/#ix=3v1K
02:16:33FromDiscord<ajusa> In reply to @Elegantbeef "If you use a": Not quite because some numbers are skipped
02:16:48FromDiscord<ajusa> oh
02:17:02FromDiscord<Elegantbeef> Holey enums sets are still sparse
02:17:38FromDiscord<Elegantbeef> An issue will appear when using these alone though
02:17:55FromDiscord<Elegantbeef> cause 2^7 != 7
02:18:51FromDiscord<Elegantbeef> But if only use it as a bitset/enum you'll be fine
02:19:59FromDiscord<ajusa> Got it, thanks! I think that this code only fails to compile when I have `switch "cpu", "arm"` in my config...
02:21:30*auxym quit (Ping timeout: 240 seconds)
02:21:39FromDiscord<ajusa> Yup, that's exactly what happens. I have no clue why `arm` would be treated differently here though...
02:22:51FromDiscord<ajusa> In reply to @Elegantbeef "But if only use": But the solution you gave seems to get around the weird value out of range, so I'll stick with that 😄
02:23:11FromDiscord<Elegantbeef> Well you did find a bug in the stdliib
02:25:44FromDiscord<ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3v1M
02:25:52FromDiscord<Elegantbeef> I wouldnt cast
02:27:17FromDiscord<ajusa> ah cast to `int` and then convert to `uint32`
02:27:23FromDiscord<Elegantbeef> No
02:27:31FromDiscord<Elegantbeef> I wouldnt cast
02:27:50FromDiscord<Elegantbeef> Leave it as a bitset, there is very little reason to cast it to a int imo
02:27:59FromDiscord<Elegantbeef> Unless you're interacting with C a lot
02:28:28FromDiscord<Elegantbeef> I assume you can query the buttons in a bitset from the C libs
02:28:36FromDiscord<Elegantbeef> Then that means you dont need to change anything
02:28:42FromDiscord<ajusa> I am interacting with it quite a bit, hm. Guess I'll use `let` instead of `const` then
02:29:01FromDiscord<Elegantbeef> Is there a reference to this api?
02:29:28FromDiscord<ajusa> https://libctru.devkitpro.org/hid_8h.html#aa2cababf764bf0b4297dc2e2fffe2a76
02:29:56FromDiscord<ajusa> well I'm using many parts of libctru for 3DS development but that's the one I'm working with for the input type definitions
02:31:10FromDiscord<Elegantbeef> Aw fuck yea you dont need to cast to an int
02:31:41FromDiscord<Elegantbeef> All of these procedures that say "bitmask of buttons" is just going to be a `set[Key]` in Nim
02:32:39FromDiscord<ajusa> Got it, can I just wrap it by saying it returns `set[Key]` then instead of u32?
02:33:03FromDiscord<Elegantbeef> Which means for instance if you want to check if they just released `A` you'd do `KeyA in hidKeysUp()`!
02:33:04FromDiscord<Elegantbeef> I believe so
02:33:53FromDiscord<Elegantbeef> Just be very cognisant that if you ever send a button to the C logic it has to be converted somehow
02:34:44FromDiscord<ajusa> so I'll need to cast then, but that would be at runtime rather than CT. Thanks for your help, I'm filing a Github issue now
02:34:49FromDiscord<Elegantbeef> Cause in nim land the ordinal is the bit position instead of the value
02:35:16FromDiscord<Elegantbeef> No you will not cast, you'll have to shift 1 by the number
02:36:53FromDiscord<Elegantbeef> As such `proc toNintendo(key: Key): uint32 = 1u32 shl key.ord`
02:39:13FromDiscord<Elegantbeef> Nope
02:39:15FromDiscord<ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3v1Q
02:39:16FromDiscord<Elegantbeef> I mean yea
02:39:17FromDiscord<Elegantbeef> But uglier
02:40:05FromDiscord<Elegantbeef> I probably spend more time then i should admit trying to ensure i can use these bitsets/arrays 😀
02:41:27FromDiscord<Elegantbeef> Since the ordinal value is held by nim you can always make an `array[Key.low.ord..Key.high.ord, T]` if you ever need and cheapily access from it
02:42:41FromDiscord<ajusa> https://github.com/nim-lang/Nim/issues/18646 opened an issue, hopefully that's enough for someone to reproduce
02:43:37FromDiscord<Elegantbeef> My guess is that it uses i32 instead of u32 for some reason and the arm setup is 32bit by default but i could be wrong
02:43:54FromDiscord<Elegantbeef> Easy to test just by doing `--cpu:i386`
02:44:28FromDiscord<ajusa> Yep with `--cpu:i386` it gives me the same error
02:45:45FromDiscord<undersquire> is there a keyword for like breaking out of a case of block?
02:46:11FromDiscord<Elegantbeef> Does `break` not work?
02:46:20FromDiscord<undersquire> no it says there is nothing to break out of
02:46:20FromDiscord<undersquire> sent a code paste, see https://play.nim-lang.org/#ix=3v1S
02:46:48FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3v1T
02:46:48FromDiscord<undersquire> oh
02:46:49FromDiscord<undersquire> ok
02:46:52FromDiscord<undersquire> i forgot about block: lol
02:46:53FromDiscord<Elegantbeef> Name block if need
02:46:53FromDiscord<undersquire> ty
02:47:06FromDiscord<Elegantbeef> `block yourName` if all the way down in other loops and stuff
02:47:12FromDiscord<undersquire> yeah
02:47:15FromDiscord<undersquire> it works ty
02:47:35FromDiscord<Elegantbeef> Depending on what you're doing might be able to do something better
02:48:21FromDiscord<undersquire> sent a code paste, see https://play.nim-lang.org/#ix=3v1U
02:48:22FromDiscord<undersquire> nop doesnt do anything
02:48:45FromDiscord<Elegantbeef> Arent you in a while loop or similar?
02:48:48FromDiscord<undersquire> I dont want to handle it in `else:` because thats where I handle an unknown opcode
02:48:52FromDiscord<undersquire> In reply to @Elegantbeef "Arent you in a": no just a proc
02:49:36FromDiscord<undersquire> i could use return
02:49:41FromDiscord<undersquire> i dont do anything after this case of
02:50:17FromDiscord<Elegantbeef> oh if there is nothing after just do `discard`
02:50:18FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3v1V
02:50:42FromDiscord<undersquire> discard on what
02:50:48FromDiscord<undersquire> u mean for ur bitset?
02:50:59FromDiscord<Elegantbeef> discard instead of break
02:51:09FromDiscord<Elegantbeef> you can use `discard` as an empty statement
02:51:28FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3v1W
02:51:30FromDiscord<undersquire> ah
02:51:55FromDiscord<undersquire> ill probaby just use that
02:52:06FromDiscord<undersquire> as im only ever going to have nop do nothing
02:52:11FromDiscord<Elegantbeef> As you should!
02:52:17FromDiscord<undersquire> so a bitset is a bit overkill xd
02:52:31FromDiscord<Elegantbeef> Yea ofc, i didnt know you didnt have logic after
02:52:32FromDiscord<undersquire> tho if i ever had more than 1 skip opcodes then i would use a bitset
02:52:47FromDiscord<Elegantbeef> dont even need it in this case
02:53:01FromDiscord<Elegantbeef> you can do `case of OpCode.nop, OpCode.sillyThing`
02:53:06FromDiscord<undersquire> yeah
02:53:09FromDiscord<undersquire> treu
02:53:12FromDiscord<undersquire> (edit) "treu" => "true"
03:17:28FromDiscord<ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3v22
03:38:01FromDiscord<ajusa> It is not required, removing just the `-lrt` from the gcc command compiles my code successfully. I glanced through the manual and didn't see any options for removing a cflag, only options for adding them.
03:44:01FromDiscord<ajusa> Got around it by setting my os to android based on https://github.com/nim-lang/Nim/blob/8ccde68f132be4dba330eb6ec50f4679e564efac/lib/posix/posix_other.nim#L22↵That's super hacky to get code compiling on the 3DS 😅
03:45:14FromDiscord<Elegantbeef> What are you using that's import posix?
03:47:26FromDiscord<Elegantbeef> Wait are you not doing `--os:any`?
03:48:04FromDiscord<ajusa> nope since I'm using pixie, which requires the `os` module
03:48:14FromDiscord<Elegantbeef> Ah
03:48:23FromDiscord<ajusa> So I get an error saying that the `os` module hasn't been ported to my operating system.
03:50:43FromDiscord<Elegantbeef> Do you know where it imports it?
03:53:13FromDiscord<ajusa> I assume to read and write files? but no I haven't checked actually
03:53:50FromDiscord<ajusa> ah it imports it on line 1 of pixie.nim lol
03:54:06FromDiscord<Elegantbeef> Yea there you go
03:55:01FromDiscord<Elegantbeef> Yea i'd throw os into a when statement and fix all erroring code
03:56:11FromDiscord<undersquire> do you have to put a next to all fields of an object if its in another module and being used in different module?
03:56:30*rockcavera quit (Remote host closed the connection)
03:57:28*stkrdknmibalz joined #nim
03:57:43FromDiscord<Elegantbeef> `` is the export marker it's used to make any top level statement accessible in another module
03:58:03FromDiscord<Elegantbeef> so for object fields you mark any you want to expose
03:58:29FromDiscord<undersquire> oh so u do have to mark each field
03:58:30FromDiscord<undersquire> ok
03:58:32FromDiscord<undersquire> sent a code paste, see https://play.nim-lang.org/#ix=3v26
03:58:58FromDiscord<undersquire> also for object variants, can u combine all of the variant fields into one?
03:59:09FromDiscord<Elegantbeef> no they presently cannot share names
03:59:14FromDiscord<undersquire> oh ok
03:59:20FromDiscord<undersquire> so i cant just name them all value: Type
03:59:22FromDiscord<undersquire> rip
04:01:55FromDiscord<Elegantbeef> So yea ajusa you can do `when hostOs = "any"` for those ops
04:03:10FromDiscord<Elegantbeef> Dont know if there is a defined for any
04:04:22FromDiscord<Elegantbeef> Seems it might be `Any`
04:04:23FromDiscord<ajusa> alright, I'll try that out if `os:android` fails me lol
04:04:34FromDiscord<Elegantbeef> Well i'd just do it to do it properly \:D
04:05:14FromDiscord<ajusa> I'm pretty happy though, I've got a red rectangle that changes color on my 3ds when I hit a button with Pixie. The only issue is that I can see the pixels being changed... something to fix later I guess
04:05:34FromDiscord<Elegantbeef> "Can see the pixels being changed"
04:06:02*supakeen quit (Quit: WeeChat 3.2)
04:06:10FromDiscord<Elegantbeef> It's that slow or it's a bug?
04:06:13FromDiscord<ajusa> oops I forgot to enable double buffering, this is pretty nice
04:06:26FromDiscord<ajusa> that's my fault, not pixie's
04:06:34*supakeen joined #nim
04:07:29FromDiscord<Elegantbeef> So i guess cpu rendered images isnt awful considering the size of the displays
04:08:40FromDiscord<ajusa> yeah actually, I'm pretty happy that I got this proof of concept running, NimConf 2022 talk maybe 🙂
04:09:01FromDiscord<ajusa> although exelotl already beat me with GBA dev
04:09:08FromDiscord<Elegantbeef> Only if you make 3 dsalaxy
04:13:17FromDiscord<ajusa> oh god it runs at 1 fps when trying to render a PNG
04:14:17FromDiscord<ajusa> and I'm already using `-d:danger --gc:arc`↵guess I'll need to benchmark
04:15:45FromDiscord<Elegantbeef> no `-d:lto`?
04:16:03FromDiscord<Elegantbeef> or maybe `--passC:-flto --passL:-flto`
04:17:18FromDiscord<ajusa> okay with that it is at 1.25 fps
04:17:42FromDiscord<Elegantbeef> Time to utiilize that gpu
04:18:24FromDiscord<ajusa> 😦 3ds gpu is hard
04:18:44FromDiscord<ajusa> but yes that does seem like the most sane option - pixie for drawing text, 3ds gpu for everything else
04:20:40FromDiscord<Elegantbeef> It's not much more complicated than opengl
04:21:54FromDiscord<ajusa> well I don't have experience with OpenGL either, this would be my first foray into lower level graphics APIs. I come from Love2D which is about as high level as you can get
04:23:38FromDiscord<Elegantbeef> Well you've now made me want to toy with this api with my 3D framework, so i now hate you
04:24:17FromDiscord<Rika> Lol
04:29:08FromDiscord<ajusa> I'll chuck some of my code up on Github now in case you want to have a look: https://github.com/ajusa/vnds-player/tree/master/src/hello
04:29:25FromDiscord<ajusa> super ugly stuff that I'm going to clean up soon
04:30:41FromDiscord<Elegantbeef> Seems like you'll have to get bindings for citro3d
04:33:14FromDiscord<undersquire> is it not possible to case on value types?
04:33:16FromDiscord<Elegantbeef> Supposedly it's opengl1.1 compliant but no clue if that's usable
04:34:12FromDiscord<Elegantbeef> ordinals and strings only without macros, if you want pattern matching checkout https://nim-lang.github.io/fusion/src/fusion/matching.html
04:40:16FromDiscord<undersquire> sent a code paste, see https://paste.rs/hsW
04:40:17FromDiscord<undersquire> XD
04:42:55FromDiscord<Elegantbeef> You have to do when in that case
04:43:16FromDiscord<undersquire> oh ok
04:43:23FromDiscord<Elegantbeef> `when T is int8: discard elif T is float: discard else: discard`
04:43:36FromDiscord<Elegantbeef> Though a case statement macro could be made for that of course
04:44:07FromDiscord<undersquire> ill just use when is etc
04:52:55*Frnt joined #nim
05:00:49FromDiscord<asie> In reply to @Elegantbeef "Supposedly it's opengl1.1 compliant": The official development kit is. That's not what you're gonna be using.
05:02:23FromDiscord<asie> I've done a fair bit of 3DS dev and Nim is on my agenda, heh
05:02:31FromDiscord<asie> (edit) "I've done a fair bit of 3DS ... dev" added "(homebrew)"
05:03:39FromDiscord<Elegantbeef> Yea i figured considering the fact citro3d was the best thing i could find
05:03:57FromDiscord<Elegantbeef> Ah nice means you can help ajusa 😜
05:04:11FromDiscord<Elegantbeef> @undersquire\: couldnt help myself https://play.nim-lang.org/#ix=3v2l there we go
05:06:04FromDiscord<asie> In reply to @ajusa "but yes that does": citro2d includes hardware accelerated text drawing
05:06:21FromDiscord<undersquire> In reply to @Elegantbeef "Ah nice means you": ty lol
05:06:43FromDiscord<Elegantbeef> Yea it seems very much like it makes more sense to use the homebrew libraries over pixie due to hardware limitations
05:06:46FromDiscord<asie> and yes, copying byte-by-byte to the framebuffer will be slow
05:06:49FromDiscord<asie> especially on Old 3DS speeds
05:06:53FromDiscord<asie> the Old 3DS is slow
05:08:05FromDiscord<Elegantbeef> There is a lot of code to bind but it's relatively tame from my glances at it, not too many C macros
05:08:46FromDiscord<asie> yeh
05:09:11FromDiscord<Elegantbeef> Nothing c2nim and a weekend or two could get done 😀
05:09:15FromDiscord<asie> libctru is mostly bindings and helper methods
05:09:27FromDiscord<asie> citro3d is not bindings, but it's also clean enough
05:09:30FromDiscord<asie> likewise citro2d
05:11:59FromDiscord<asie> I'd write more Nim but I'm struggling to find a good structure for the project I'm eyeing it for, heh
05:12:18FromDiscord<Elegantbeef> Shame
05:13:40FromDiscord<asie> Ehh, it's mostly that it's a port of a 1991 engine which deals exclusively in uint8s and int16s
05:13:53FromDiscord<asie> casting is fun!
05:14:06FromDiscord<Elegantbeef> What's the issue then?
05:15:54FromDiscord<asie> Mostly the casting; it's doing it explicitly throughout the codebase, or defining a bunch of custom converters and operator implementations to mimic the "broken, C/Pascal-style" casting the engine expects - but then performance tanks unless you LTO
05:17:10FromDiscord<Elegantbeef> well `cast` is free so that's odd
05:17:17FromDiscord<asie> Cast is free; a converter is not.
05:17:33FromDiscord<Elegantbeef> do you inline the converters?
05:17:43FromDiscord<asie> hmm.
05:17:53FromDiscord<asie> ... Good point.
05:17:59FromDiscord<asie> Didn't realize you can do that
05:18:05FromDiscord<asie> Sorry
05:18:20FromDiscord<Elegantbeef> Just `converter name(args): T `{.inline.}` =`
05:18:27FromDiscord<asie> Yeah
05:18:35FromDiscord<Elegantbeef> I figure it's just a fancy procedure
05:18:59FromDiscord<asie> Anyhow - the other issue is more based in architecturing code
05:19:10FromDiscord<asie> but that's just my indecisiveness... no PM to slap me and tell me this is due yesterday ^^;
05:19:25FromDiscord<asie> not really a Nim problem
05:21:22FromDiscord<asie> lack of experience with Nim doesn't help, of course
05:21:35FromDiscord<asie> I wrote an IRC bot in it once and another small tool, but nothing large
05:21:45FromDiscord<Elegantbeef> Well you can always ask here for help
05:22:29FromDiscord<Elegantbeef> Though doesnt seem to be many people here as of late so "people" seems to mostly mean Rika and I 😀
05:23:44FromDiscord<asie> That's a bit worrying
05:25:37FromDiscord<Elegantbeef> Yea how will cunningham's law kick in for me?!
05:48:20FromDiscord<Rika> I do not exist
06:00:15FromDiscord<generic linux user> noooo😭
06:00:28FromDiscord<generic linux user> dont say to me you are ai anime girl
06:36:07*neceve joined #nim
07:44:21FromDiscord<Rika> What will you do if I am
07:45:06FromDiscord<haxscramper> In reply to @arkanoid "<@608382355454951435>, I'm spending some": No specific references, I just did it based on w3c xsd standard documentation and schema I had (from doxygen). Basically fixed it until it worked as I wanted while testing it on the doxygen output
07:46:18arkanoidlots of if this than that, i see. Yeah xsd schema is a mess
07:56:16FromDiscord<ynfle (ynfle)> Does andreaferretti come on here?
09:14:42FromDiscord<generic linux user> In reply to @Rika "What will you do": 😳
09:20:03*max22- joined #nim
09:33:21FromDiscord<KnorrFG> hey, how can I define a type alias for an int that must be in range 1..10 ?
09:36:37FromDiscord<ynfle (ynfle)> `range[1..10`
09:36:48FromDiscord<ynfle (ynfle)> \`range[1..10]`
09:37:44FromDiscord<ynfle (ynfle)> Or just `1..10`
09:38:14FromDiscord<KnorrFG> Ah thanks. No `type Foo = 1..10` didnt work
09:38:27FromDiscord<KnorrFG> but `type Foo = range[1..10]` did
09:38:30FromDiscord<ynfle (ynfle)> Depends on the context
09:38:39FromDiscord<ynfle (ynfle)> `range[1..10]` should work
09:38:44FromDiscord<ynfle (ynfle)> Oh ok
09:38:55FromDiscord<ynfle (ynfle)> For proc params `1..10` works
10:09:21FromDiscord<konsumlamm> `1..10` is a slice, not a range type
10:09:54FromDiscord<ynfle (ynfle)> I know, but it will work for proc params instead of range
10:10:46FromDiscord<konsumlamm> i doubt it
10:10:51FromDiscord<konsumlamm> can you show what you mean?
10:11:02FromDiscord<ynfle (ynfle)> How can I see why a type isn't a concept? I remember some `{.explain.}` pragma or something like that
10:12:04FromDiscord<ynfle (ynfle)> @konsumlamm https://play.nim-lang.org/#ix=3v3o
10:16:43FromDiscord<konsumlamm> huh, didn't think that would compile
10:48:06FromDiscord<ynfle (ynfle)> I know right
10:48:54FromDiscord<ynfle (ynfle)> How can I use `{.explain.}` pragma for concepts
10:51:05FromDiscord<Rika> Isn’t it explained on the experimental manual
10:52:07FromDiscord<ynfle (ynfle)> Can it be used if it doesn't compile? How Can I use it for a proc that needs to be discarded?
10:53:58FromDiscord<JonasL> How do i take a reference to an existing ref object without the ptr type, so that the ref object is aware of the reference and doesnt free up before the reference counter is 0 (if u use arc)
10:55:26FromDiscord<ynfle (ynfle)> Why don't you just make it a ref object?
10:56:58FromDiscord<JonasL> The object itself is a reference object but i want to access the object with a 2nd pointer.
10:57:00FromDiscord<Rika> In reply to @JonasL "How do i take": What do you mean?
10:57:10FromDiscord<Rika> Why does it have to be a double indirection
10:57:33FromDiscord<Rika> Just pass the ref regularly
10:57:56FromDiscord<JonasL> Put what if i want to store the reference into a 2nd object
10:58:46FromDiscord<ynfle (ynfle)> So store it in an object
10:58:54FromDiscord<Rika> Okay I am confused, can you write code and explain the intended behaviour
10:59:35FromDiscord<JonasL> E.g. this in c++
10:59:50FromDiscord<JonasL> class Test { int &t;};
11:00:13FromDiscord<Rika> type Test = object ↵ t: ref int
11:01:13FromDiscord<ynfle (ynfle)> So what's the issue?
11:12:20FromDiscord<JonasL> How do i init t with the given variable var x: int = 0
11:13:42FromDiscord<Rika> Using user defined initialisation procedure
11:15:41FromDiscord<JonasL> Ok thanks
11:58:06*max22- quit (Ping timeout: 276 seconds)
12:06:01*supakeen quit (Quit: WeeChat 3.2)
12:06:34*supakeen joined #nim
12:12:09*rockcavera joined #nim
12:18:11*rockcavera quit (Read error: Connection reset by peer)
12:18:37*rockcavera joined #nim
12:18:37*rockcavera quit (Changing host)
12:18:37*rockcavera joined #nim
12:20:09FromDiscord<ajusa> In reply to @asie "citro2d includes hardware accelerated": Ah interesting, I'll have to dig more into that when I get a chance then. I really like Pixie and how simple it is though, especially as far as just loading an image and drawing it. There's no easy way to load a PNG and draw it using Citro3d as far as I can tell, you need to convert it to a t3x file which is what I'm trying to avoid
12:21:03FromDiscord<asie> In reply to @ajusa "Ah interesting, I'll have": you need to write your own loader; why would you load a PNG directly anyway? is it user-provided?
12:21:17FromDiscord<ajusa> Yes
12:21:19FromDiscord<asie> ah
12:21:25FromDiscord<asie> in that case libpng has a fairly simple API...
12:21:28FromDiscord<asie> you could wrap that
12:21:47FromDiscord<asie> the main bottleneck for the conversion is that the 3DS does not store textures linearly
12:22:00FromDiscord<ajusa> Well Pixie has a PNG loader that gives me an RGBA8 buffer, but I don't know how to draw that using citro
12:22:04FromDiscord<asie> it uses 8x8 tiles with Morton order
12:22:07FromDiscord<ajusa> (edit) "citro" => "citro3d"
12:22:17FromDiscord<asie> so you first need to do a hardware-accelerated display transfer (the fastest way to convert it; you could do it CPU-side but that's sloooooow)
12:22:32FromDiscord<ajusa> Apparently there's a method that will do that swizzling on hardware but I can't find it
12:22:53FromDiscord<asie> ah, yes
12:22:58FromDiscord<asie> documentation is scarce, be prepared
12:23:13FromDiscord<ajusa> I swear it got removed or something
12:23:18FromDiscord<asie> no it didn't
12:23:25FromDiscord<asie> <https://github.com/asiekierka/atari800/blob/ee116ce923ccaafd76e2c44d51c71fe969f07ea2/src/3ds/grapefruit.c#L15-L53> this isn't the cleanest code but it should give you an idea of how to do it
12:23:53FromDiscord<asie> the crucial parts if you already have an RGBA8 buffer are the TexInit and the DisplayTransfer
12:24:24FromDiscord<asie> linearAlloc/linearFree is also key - the GPU operates on physical RAM, not virtual RAM
12:24:55FromDiscord<ajusa> Ah, that's super helpful actually
12:25:21FromDiscord<asie> really though if you can pre-convert the assets... from what i've seen you're doing a VNDS loader?
12:25:23FromDiscord<asie> make a PC-side converter
12:25:39FromDiscord<ajusa> It's too slow 😦
12:25:46FromDiscord<asie> too slow?
12:25:49FromDiscord<ajusa> Some games have thousands and thousands of files
12:26:01FromDiscord<asie> still - a console will read most of them anyway
12:26:12FromDiscord<ajusa> Even on my laptop it takes 30-40 minutes to resize and convert all of the images to t3x
12:26:22FromDiscord<asie> threading
12:26:26FromDiscord<ajusa> I'd much rather do it at runtime
12:26:31FromDiscord<ajusa> That's with GNU parallel
12:26:34FromDiscord<asie> huh
12:26:36FromDiscord<asie> that's odd
12:26:41FromDiscord<asie> oh, one more thing
12:26:46FromDiscord<asie> filesystem accesses on 3DS are wholly uncached
12:26:57FromDiscord<asie> so you can either do userland caching via `setvbuf`
12:27:01FromDiscord<asie> or be very conservative with `fread` calls
12:27:10FromDiscord<asie> but of course this means any `fopen` or directory lookup will be slow
12:27:34FromDiscord<ajusa> Thankfully visual novels tend to be linear so caching doesn't affect me too much
12:28:14FromDiscord<asie> I wonder if the slowness with t3x conversion is due to `-z auto`
12:28:20FromDiscord<asie> it'd be trying all the compression algorithms to pick the best one then
12:28:21FromDiscord<ajusa> But seriously thank you so much, I've gotten more questions answered in 10 minutes than a weekend of searching and reading through code
12:28:39FromDiscord<asie> I wish I could point you to a community but the only one with good code quality I'm aware of is an invite-only cult
12:28:49FromDiscord<asie> you can try the devkitPro forums but they might not like the fact you're using Nim
12:29:00FromDiscord<ajusa> Yeah, plus the forums are kind of dead
12:29:08FromDiscord<asie> nah the leaders will answer your posts
12:29:22FromDiscord<ajusa> Hey do you know what an unaligned access error is?
12:29:28FromDiscord<asie> yes
12:29:33FromDiscord<asie> ARM requires aligned memory accesses, unlike x86
12:29:36FromDiscord<asie> so if you're reading a 32-bit int
12:29:53FromDiscord<asie> you can read it from address `0x00000000`, `0x00000004`, etc - multiples of 4, or the int's size
12:30:02FromDiscord<asie> you can't read it from `0x00000001` though - that's not a multiple of 4 - it's unaligned
12:30:06FromDiscord<asie> writing likewise
12:30:20FromDiscord<asie> not sure if it holds to every ARM ever made but it holds on the 3DS
12:30:24FromDiscord<ajusa> is there any way I can get around that or force it to read from an unaligned address?
12:30:26*neurocyte joined #nim
12:30:31FromDiscord<asie> you need to read individual bytes and shift them
12:30:35FromDiscord<asie> this is of course slower
12:30:38FromDiscord<ajusa> https://github.com/treeform/pixie/issues/189
12:31:01FromDiscord<ajusa> I opened this issue for Pixie along with the code change that made the problem go away, and the solution was to force it to read the individual bytes
12:31:03FromDiscord<asie> or just ensure all data you're processing is always aligned
12:31:07FromDiscord<asie> which is faster 🙂
12:31:09FromDiscord<asie> but again, requires planning ahead
12:31:19FromDiscord<ajusa> well it's a PNG file so that isn't possible I believe
12:31:26FromDiscord<asie> as i said
12:31:44FromDiscord<asie> the 3DS isn't the kind of platform where you just do whatever you want and expect it to be performant
12:31:52FromDiscord<asie> the Old 3DS has a 266MHz ARM CPU with no L2 cache
12:31:58FromDiscord<asie> it's multiple times slower than the RasPi 1 (!)
12:32:08FromDiscord<ajusa> yeah, that's becoming painfully apparent 😅
12:32:20FromDiscord<asie> the New 3DS is much faster, 3x faster clock speed and 2MB L2 cache
12:32:25FromDiscord<ajusa> that's the one I have
12:32:26FromDiscord<asie> but by default your homebrew will run at Old 3DS speeds
12:32:31FromDiscord<asie> this is for compatibility reasons
12:32:34FromDiscord<Rika> In reply to @asie "you can't read it": ngl i thought x86_64 also required this
12:32:39FromDiscord<asie> `osSetSpeedupEnable(1);` is what you need
12:32:50FromDiscord<asie> then it will unlock New 3DS speeds - even then, though, don't forget users stuck on Old 3DSes or 2DSes
12:32:53FromDiscord<asie> if you can
12:33:01FromDiscord<asie> and I mean VNDS ran on the original DS, I'm sure you can, just code well
12:33:35FromDiscord<Rika> In reply to @asie "and I mean VNDS": rude lmao
12:33:45FromDiscord<asie> I didn't mean to be rude 😦
12:33:46FromDiscord<ajusa> Yeah for sure, the main issue I was having was converting the PNG into something that can be drawn at runtime (like the original VNDS). Now that you've resolved that I'm sure that the rest will be pretty easy
12:33:57FromDiscord<asie> It was meant to be motivational
12:34:02FromDiscord<Rika> In reply to @asie "I didn't mean to": im jokin im jokin
12:34:13FromDiscord<ajusa> The rest of my code is pretty well optimized lol, it's just this stupid drawing stuff that's new to me
12:35:23FromDiscord<asie> software drawing is always slow but on gigahertz machines it's not noticeable
12:35:26FromDiscord<tandy> what community is that?↵(@asie)
12:35:39FromDiscord<asie> In reply to @tandy "what community is that?": devkitPro has an invite-only Discord server
12:35:49FromDiscord<asie> I've used to hang out there but got tired of the attitude
12:36:03FromDiscord<ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3v3U
12:36:13FromDiscord<ajusa> from https://gcc.gnu.org/onlinedocs/gcc-4.8.5/gcc/ARM-Options.html
12:37:09FromDiscord<asie> That's interesting
12:37:22FromDiscord<tandy> @ajusa\: are you making a 3ds game? sounds cool
12:37:23FromDiscord<asie> I'm not sure if the 3DS's CPU is capable of unaligned access
12:37:32FromDiscord<asie> At least one source claims it is
12:38:15FromDiscord<ajusa> yeah I have no clue if this flag does anything for the 3DS specifically, but enabling it didn't actually fix the issue so my guess is it works for other ARM CPUs
12:38:31FromDiscord<ajusa> In reply to @tandy "<@102899813149855744>\: are you making": Yeah, I'm working on a visual novel engine basically 😄
12:38:36FromDiscord<asie> but from what I know it is not
12:38:43FromDiscord<asie> The flag controls what the compiler emits for reading from packed data structures
12:38:48FromDiscord<asie> Not really what the CPU is capable of
12:39:28FromDiscord<asie> (edit) "but from what I know it is not" => "I'd need to do more research tho"
12:40:04FromDiscord<tandy> ohhh cool, did you see this one? https://gitlab.com/chromaengine↵(@ajusa)
12:40:11FromDiscord<tandy> also do you have a repo for it?
12:40:42FromDiscord<asie> Ah, according to gbatek the bit for unaligned memory access on 3DS is disabled, so it mimics ARMv5 behaviour here
12:42:04*Frnt is now known as Freneticks
12:42:25FromDiscord<ajusa> Yeah, I've got two:↵https://github.com/ajusa/vnds-player - the Nim rewrite↵https://github.com/ajusa/vnds-love - the original, written in Lua with Love2D/LovePotion
12:42:28nrds<R2D299> itHub: 7"A VNDS engine, rewritten from the ground up to be compatible with the 3DS"
12:43:16FromDiscord<asie> anyhow, the code I sent you is made for citro3d; for citro2d you'd need an additional wrapping layer
12:44:29FromDiscord<asie> <https://github.com/asiekierka/uxnds/blob/platform/3ds/src/emulator.c#L211-L212> something like this (again, apologies for the code quality)
12:44:41FromDiscord<ajusa> yup there are only a few functions in citro2d anyway, I don't think I'll have an issue with it
12:44:46FromDiscord<asie> as C2D images contain additional information - the texture coordinates
12:55:06*max22- joined #nim
12:58:05*arkurious joined #nim
13:09:48*max22- quit (Remote host closed the connection)
13:27:47*max22- joined #nim
13:28:49*max22- quit (Remote host closed the connection)
13:29:08*max22- joined #nim
13:31:04*tiorock joined #nim
13:31:05*tiorock quit (Changing host)
13:31:05*tiorock joined #nim
13:31:05*rockcavera is now known as Guest7017
13:31:05*Guest7017 quit (Killed (erbium.libera.chat (Nickname regained by services)))
13:31:05*tiorock is now known as rockcavera
13:40:12*krux02 joined #nim
13:48:36*tiorock joined #nim
13:48:37*tiorock quit (Changing host)
13:48:37*tiorock joined #nim
13:48:37*rockcavera quit (Killed (calcium.libera.chat (Nickname regained by services)))
13:48:37*tiorock is now known as rockcavera
13:57:11*max22- quit (Remote host closed the connection)
14:27:55FromDiscord<planetis> dumb question, if i have 120byte object, should i make it a ref? Or it doesnt matter unless i am copying it?
14:35:08FromDiscord<Clonkk> Aren't ref mostly for heap allocated stuff ?
14:47:48FromDiscord<planetis> a ref is allocated on the heap and has reference semantics
14:49:03FromDiscord<Rika> In reply to @planetis "dumb question, if i": wdym it doesnt matter? nim will not copy if the object is large enough so you dont need to force ref on your own types for optimisation
14:49:09FromDiscord<planetis> duh, water is wet 😄
14:51:07FromDiscord<planetis> i mean accidentally making a copy of it by assigning to a variable
14:51:35FromDiscord<planetis> anyway i made https://github.com/planetis-m/jsonecs please tell me opinions
14:51:37FromDiscord<Rika> {.byaddr.} i think is the pragma
14:51:38nrds<R2D299> itHub: 7"<No Description>"
14:51:43FromDiscord<Rika> for not copying? im not too sure
14:51:53FromDiscord<Rika> its been a few weeks since i really wrote any nim
14:54:44FromDiscord<planetis> thats a hack though
15:01:54FromDiscord<Clonkk> In reply to @planetis "thats a hack though": Another solution is to implement ``=sink``, ``=copy`` (or forbid them)
15:02:02FromDiscord<Clonkk> https://nim-lang.org/docs/destructors.html sums it up I think
15:03:36FromDiscord<planetis> thanks i restricted copy for now
15:08:19*max22- joined #nim
15:09:22arkanoidis it better to FFI via header+importc or dylib+importc? what's the difference?
15:11:50FromDiscord<haxscramper> Dynlib can be used if you work with dynamic library, header is for header libraries.
15:12:11FromDiscord<haxscramper> You can use dynlib, in which case you don't need a header
15:12:16*stkrdknmibalz quit (Quit: WeeChat 3.0.1)
15:12:45FromDiscord<haxscramper> But you still probably need a header for working with types from a library
15:13:01FromDiscord<haxscramper> structs/unions etc.
15:14:11FromDiscord<Clonkk> Sometimes you need both↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>)
15:18:32arkanoidI have compiled .a and .so starting from .c .h, so I have all possible options, but not sure which is the best way to go
15:19:17arkanoidI'd like to bind all the types and functions declared in .h, I'm running nim2c on it but it seems confused by macros
15:20:42arkanoidit parses the huge type section successfully (90% of the .h file) but it errors out on first function declaration, possibly because of macro stubs. Here's an example
15:20:45arkanoidSOAP_FMAC5 int SOAP_FMAC6 soap_recv_SOAP_ENV__Fault(struct soap *soap, struct SOAP_ENV__Fault *_param_1);
15:21:39arkanoidSOAP_FMAC5 and SOAP_FMAC6 are just 2 empty macros (define as: # define SOAP_FMAC5)
15:22:31arkanoidI've tried with "c2nim --assumedef:SOAP_FMAC5 --assumedef:SOAP_FMAC6 soapStub.h" but no cake, same errors
15:24:39arkanoidI think I'm dealing with this: https://github.com/nim-lang/c2nim/blob/master/doc/c2nim.rst#def-directive
15:24:52arkanoidbut unsure how to declare empty macro
15:26:08arkanoidby random guessing I did it!
15:26:11arkanoidHint: operation successful (10850 lines compiled; 64 milliseconds, 407 microseconds, and 688 nanoseconds sec total; 17.434MiB; ) [SuccessX]
16:02:00*stkrdknmibalz joined #nim
16:39:00FromDiscord<fae> Came across this and I was like whoah hot loading in a compiled language https://nim-lang.org/docs/hcr.html
16:39:07FromDiscord<fae> Pretty damn cool
16:40:23FromDiscord<fae> Unfortunately it doesn’t work very consistently on macOS and usually crashes when trying to call `performCodeReload` lol
16:41:19FromDiscord<konsumlamm> it's pretty unstable in general (not only macOS) afaik
16:42:51FromDiscord<fae> Yea what a shame because it’s a killer feature for a graphics app
16:45:53FromDiscord<Ayy Lmao> How do you go about proving an iterator as disjoint for a `parallel` block?
16:46:11FromDiscord<ITR> Got a spam bot message from `sheldon#9646`
16:47:15FromDiscord<ITR> <@&371760044473319454> https://media.discordapp.net/attachments/371759389889003532/872883460988084284/unknown.png
16:50:27FromDiscord<ShalokShalom> spammer
16:50:34FromDiscord<ShalokShalom> https://media.discordapp.net/attachments/371759389889003532/872884297793691689/Screenshot_20210805_184535.png
16:56:54FromDiscord<dav1d> same @obmorok1308 https://media.discordapp.net/attachments/371759389889003532/872885885866221588/unknown.png
17:16:08FromDiscord<Daniel> lorens1990#3509 is spammer, please kick and block this user from server https://discord.com/channels/@me/872890407049129994/872890415962009672 https://media.discordapp.net/attachments/371759389889003532/872890727238107166/unknown.png
17:17:45FromDiscord<Daniel> (edit) "lorens1990#3509" => "@lorens1990"
17:23:03*xet7 quit (Remote host closed the connection)
17:23:59*xet7 joined #nim
17:48:12*tiorock joined #nim
17:48:13*tiorock quit (Changing host)
17:48:13*tiorock joined #nim
17:48:13*rockcavera is now known as Guest1511
17:48:13*tiorock is now known as rockcavera
17:50:31FromDiscord<dom96> I honestly think banning these accounts is futile
17:50:38FromDiscord<dom96> but did it anyway
17:51:04*kayabaNerve quit (Ping timeout: 272 seconds)
17:51:10*Guest1511 quit (Ping timeout: 258 seconds)
18:07:09*rockcavera quit (Read error: Connection reset by peer)
18:07:38*tiorock joined #nim
18:20:08*tiorock quit (Read error: Connection reset by peer)
18:20:33*rockcavera joined #nim
18:20:34*rockcavera quit (Changing host)
18:20:34*rockcavera joined #nim
18:31:58*krux02 quit (Remote host closed the connection)
18:32:23*krux02 joined #nim
18:43:03FromDiscord<krisppurg> you can turn this off https://media.discordapp.net/attachments/371759389889003532/872912601959497828/unknown.png
18:56:59FromDiscord<theangryepicbanana> is there a way to obtain the `TNimType` type from `system/hti.nim`?
19:00:09FromDiscord<theangryepicbanana> definitely just need it for research purposes
19:00:49FromDiscord<theangryepicbanana> if not, is there a way to get a runtime representation of a type?
19:03:31FromDiscord<Elegantbeef> typeinfo might hellp
19:04:44FromDiscord<theangryepicbanana> In reply to @Elegantbeef "typeinfo might hellp": I tried typeinfo, but it's never exposed
19:06:59FromDiscord<theangryepicbanana> well actually it's exposed on js (I think), but that's a bit useless for me
19:07:42FromDiscord<@bracketmaster-5a708063d73408ce4> Is it possible to install a local nim package that I'm working on with nimble?
19:08:09FromDiscord<Elegantbeef> `nimble devel` will sym link the project
19:08:09FromDiscord<Elegantbeef> or is it nimble develop
19:08:10FromDiscord<@bracketmaster-5a708063d73408ce4> What I mean by this is that editing the local package should propagate to other local packages that depend on it
19:09:40FromDiscord<Elegantbeef> Yea in the nimble package you're working on do `nimble develop` it will get symlinked and will use that folder
19:13:45*Arrrrrrrr joined #nim
19:14:24*Arrrrrrrr quit (Client Quit)
19:42:44nrds<Prestige99> Elegantbeef how goes your wm ventures?
19:50:44FromDiscord<Elegantbeef> Fairly well so far https://streamable.com/wojd85
19:51:06FromDiscord<Elegantbeef> Presently trying to use CPS for my X event loop so it doesnt block
19:53:07*kayabaNerve joined #nim
19:59:51FromDiscord<Elegantbeef> I do know XCheckEvent exists but it doesnt play overly nice afaik
20:01:16nrds<Prestige99> hm I think I was doing something for non-blocking using FDs
20:02:22nrds<Prestige99> https://github.com/avahe-kellenberger/nimdow/blob/master/src/nimdow.nim#L76 ElegantBeef (there's also xcb for non-blocking instead of xlib if you want)
20:02:38*neceve quit (Ping timeout: 258 seconds)
20:06:51FromDiscord<Daniel> In reply to @dom96 "I honestly think banning": can you make some kind of vlidation or authorisation for this discord server?
20:08:15FromDiscord<Ayy Lmao> I'm having an issue with using `--cc:vcc` where I'm using `{.compile.}` on a cpp source file that includes a header that uses some win32 api stuff. An example of the errors I am getting is: `'HDROP': undeclared identifier`. I'm not sure what to do to fix it. The solutions I'm finding say to just include `windows.h` first, which I am already doing.
20:08:25FromDiscord<codic> that's cool, did you ever figure out how to advertise that you have emwh support?
20:09:20nrds<Prestige99> me? I don't think I have full support
20:35:11FromDiscord<Elegantbeef> Also prestige presently looking at your repo and cmon, why no nimble task for using xephyr 😛
20:36:31FromDiscord<codic> oh yeah i see nimdow has support for fullscreen... i implemented the emwh hint but i can't figure out how to advertise to clients that I have it, so some apps do work like chromium, but others check for the hint, so don't work, like firefox
20:36:36FromDiscord<codic> i'll give it another shot later
20:41:37nrds<Prestige99> @Elegantbeef I did it in bash, idk :P
21:02:26*kayabaNerve quit (Ping timeout: 258 seconds)
21:10:56*kayabaNerve joined #nim
21:19:25*ozzz quit (Quit: Bye)
21:31:23*max22- quit (Quit: Leaving)
21:44:19FromDiscord<dom96> In reply to @Daniel "can you make some": Like what? I’d rather Discord fixed this
21:51:36*auxym joined #nim
21:55:00*auxym quit (Read error: No route to host)
21:55:13*auxym joined #nim
21:55:18FromDiscord<exelotl> there's no solution for server admins, even if you put a captcha in place or set the server's validation level to highest, bots can still join the server, scrape the list of users and send DMs to people
21:55:18FromDiscord<Cryne> @parkourfornik 872165474648088576 <= Scammer↵https://i.imgur.com/QL81zU0.png
22:00:53FromDiscord<enthus1ast> when i do a staticRead, from which module is it relative? From the module where the staticRead resides or the one where i call the enclosing function?
22:01:21FromDiscord<enthus1ast> actually i tried both ways and it can not open my file o.0
22:01:33FromDiscord<Elegantbeef> Afaik it's relative to the file calling the staticRead
22:03:37FromDiscord<enthus1ast> mh i dont know, i tried both path and also an absolute path none are working, strange
22:04:24*auxym quit (Ping timeout: 272 seconds)
22:06:10FromDiscord<enthus1ast> well
22:06:41FromDiscord<enthus1ast> "the/path/to/file.txt" is not a path (including " ) 😀
23:21:55FromDiscord<Sabena Sema> so nim has var return types... that (or something like it) is actually strictly required for people to be able to implement their own containers right? Even Delphi's array properties aren't powerful enough
23:22:49FromDiscord<Elegantbeef> well it's needed if you want to be able to mutate it with `a[someKey].field = 300`
23:25:06FromDiscord<Sabena Sema> yes
23:25:08FromDiscord<Sabena Sema> that's what I thought
23:25:26FromDiscord<Sabena Sema> I'm not sure if Delphi or some other pascal extension has a way around that
23:25:28FromDiscord<Elegantbeef> well without auto dereference i guess
23:25:35FromDiscord<Sabena Sema> it looks like Oberon-7 doesn't either
23:25:44FromDiscord<Sabena Sema> well
23:26:10FromDiscord<Sabena Sema> even with autoderef a[somekey][otherkey] might be hard to resolve
23:26:52FromDiscord<Sabena Sema> and, var return type basically is autoderef for return types, since nim doesn't let you use it everywhere like some other languages do (C++)
23:34:29FromDiscord<Sabena Sema> This comes up _all the darn time_ at work (working with C and C++ developers)
23:34:45FromDiscord<Sabena Sema> people really love top level const (which all c++ references are)
23:35:07FromDiscord<Sabena Sema> it's also sort tangentially come up in the c++ `optional<T&>` discussion
23:36:33FromDiscord<Elegantbeef> Yea i dont know much of how C/C++ is actually used, so just figure it does the same thing just more unsafe 😛
23:38:22FromDiscord<Sabena Sema> sent a code paste, see https://play.nim-lang.org/#ix=3v6R
23:38:34FromDiscord<Sabena Sema> but `int&` is deceptively close to `ptr int not nil`
23:38:54FromDiscord<Sabena Sema> no: also c++ isn't really less safe than nim
23:39:35FromDiscord<Sabena Sema> nim has less attractive nuisances
23:39:59FromDiscord<Sabena Sema> but yeah, I really, really, like that nim just totally omits top level const
23:40:02FromDiscord<Sabena Sema> you just can't do it
23:41:48FromDiscord<Sabena Sema> the problem with not nil _ptrs_ in nim ofc is that they can dangle
23:43:11FromDiscord<Elegantbeef> Yea it's were having good view types would make life nice
23:57:06*auxym joined #nim