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