00:31:24 | FromDiscord | <sOkam!> How do you work with raw byte data buffers (for file generation/modification, etc) in Nim? |
00:32:04 | FromDiscord | <sOkam!> If the question is too basic/simple, just pointing me to some proc names or std page would be fine |
00:38:30 | FromDiscord | <demotomohiro> Something like `seq[int8]`?↵https://nim-lang.org/docs/io.html#writeBytes%2CFile%2CopenArray%5B%5D%2CNatural%2CNatural |
00:39:37 | FromDiscord | <huantian> I think people usually use uint8 or byte but yeah |
00:41:13 | FromDiscord | <jos> in what scenario do you use typedesc[int] over int? |
00:41:16 | FromDiscord | <jos> so like |
00:41:33 | FromDiscord | <jos> in an argument position, it means use the type instead of the value, i guess |
00:41:42 | FromDiscord | <jos> but in other positions, like echo int or echo typedesc[int] it seems equivalent |
00:41:47 | FromDiscord | <jos> and i'm trying to understand what the difference is |
00:41:54 | FromDiscord | <Yardanico> In reply to @jos "but in other positions,": but that's not really the supposed usage of typedesc :) |
00:42:00 | FromDiscord | <Yardanico> as you said, it's for passing types as values in arguments |
00:42:30 | FromDiscord | <Yardanico> regarding `typedesc[int]` specifically the only "usecase" i can think of is making "static" "methods" (like they would be called in other languages) |
00:42:41 | FromDiscord | <jos> so when a bare type (int) appears in an expression, it's equivalent to typedesc[int] |
00:42:50 | FromDiscord | <jos> but when it appears in.. a place the compiler expects a type |
00:42:58 | FromDiscord | <huantian> iirc `echo int` implicitly calls `echo type(int)`, where `type(int)` returns `typedesc[int]` |
00:43:01 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4bWU |
00:43:06 | FromDiscord | <Yardanico> In reply to @huantian "iirc `echo int` implicitly": yep |
00:43:26 | FromDiscord | <huantian> (edit) "type(int)`," => "typeof(int)`," | "`type(int)`" => "`typeof(int)`" |
00:45:00 | FromDiscord | <huantian> can't find where this is mentioned in the manual tho |
00:45:16 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual.html#special-types-typedesc-t |
00:45:20 | FromDiscord | <Yardanico> "For instance, the type of the symbol int is typedesc[int]" |
00:47:28 | FromDiscord | <huantian> does it mention when it implicitly calls `typeof` tho? |
00:48:27 | FromDiscord | <Yardanico> I don't think there's a such a thing, it's just that it's treated as a `typedesc` |
00:48:31 | FromDiscord | <huantian> ah ok |
00:48:38 | FromDiscord | <Yardanico> there's $ for typedesc defined |
00:48:49 | FromDiscord | <jos> wait, so typedesc without a type argument is valid? |
00:48:55 | FromDiscord | <Yardanico> In reply to @jos "wait, so typedesc without": ? |
00:48:57 | FromDiscord | <jos> > Just like with regular generic types, when the generic param is omitted, typedesc denotes the type class of all types. As a syntactic convenience, one can also use typedesc as a modifier. |
00:49:05 | FromDiscord | <Yardanico> yes, the same as a generic |
00:49:13 | FromDiscord | <Yardanico> although using a generic would be cleaner |
00:49:19 | FromDiscord | <jos> so it uses dynamic dispatch if you don't specify the generic? |
00:49:25 | FromDiscord | <jos> and i guess your public API can't leak that type |
00:49:32 | FromDiscord | <jos> for all generic types? |
00:49:33 | FromDiscord | <Yardanico> In reply to @jos "so it uses dynamic": there's no dynamic dispatch, it's all static dispatch |
00:49:37 | FromDiscord | <Yardanico> `typedesc` doesn't exist in runtime |
00:49:42 | FromDiscord | <Yardanico> it's just another way of writing generics |
00:49:46 | FromDiscord | <Elegantbeef> No nim only uses `method` for dynamic dispatch↵(@jos) |
00:49:48 | FromDiscord | <huantian> it is nicer to use typedesc when you expect your proc to be used with UFC syntax |
00:49:53 | FromDiscord | <Elegantbeef> It only uses dynamic dispatch on inheritance |
00:49:58 | FromDiscord | <jos> i mean it says "like all structs", when the generic param is omitted |
00:50:02 | FromDiscord | <Elegantbeef> `a: typedesc` turns the procedure into an implicit generic |
00:50:06 | FromDiscord | <jos> (edit) "structs"," => "generic types"," |
00:50:08 | FromDiscord | <Yardanico> In reply to @jos "i mean it says": yes, but that's the same as `proc x[T](a: T)` |
00:50:09 | FromDiscord | <jos> ah ok |
00:50:13 | FromDiscord | <Yardanico> just a different way of writing the same thing |
00:50:29 | FromDiscord | <jos> so you can't make a list of generic types without specifying the generic type, for example, like you can in dart or java |
00:50:36 | FromDiscord | <huantian> (edit) "syntax" => "syntax↵though it still achieves the same as a generic [T](_ :typedesc[T]) which might be cleaner" |
00:50:40 | FromDiscord | <jos> and i guess that checks out if method is the only way to do dynamic dispatch |
00:50:44 | FromDiscord | <Yardanico> In reply to @jos "so you can't make": not sure I understand, can you show an example? |
00:51:03 | FromDiscord | <jos> like in Dart you can make a List<T> and cast it to List and still call .length on it |
00:51:16 | FromDiscord | <jos> and then store a List<List> where each list internally stores a different type T |
00:51:21 | FromDiscord | <jos> instead of List<List<T>> |
00:52:10 | FromDiscord | <huantian> you can do something like that if you wrap the `seq` with a ref object↵but generally that's not "idiomatic nim" |
00:53:09 | FromDiscord | <jos> https://media.discordapp.net/attachments/371759389889003532/1025571037431210024/unknown.png |
00:53:21 | FromDiscord | <jos> like in dart it allows you to perform automatic type erasure of the generic type |
00:53:26 | FromDiscord | <jos> which i think is a pretty cool feature |
00:53:53 | FromDiscord | <jos> but in a more static language like nim you would have to make sure those types aren't part of the call signature for any public methods i guess |
00:54:08 | FromDiscord | <Yardanico> In reply to @jos "": nah, you can't do that in Nim the same way |
00:54:23 | FromDiscord | <Yardanico> you can do it with object variants of course, but not as simple as this |
00:56:51 | FromDiscord | <jos> makes sense |
00:56:58 | FromDiscord | <jos> yeah i think c# and java do it too |
00:57:15 | FromDiscord | <jos> i think c# might not actually |
00:57:19 | FromDiscord | <jos> but dart and java definitely |
00:57:38 | FromDiscord | <jos> it's probably quite a bit slower |
00:58:51 | FromDiscord | <jos> is there an Any type in nim? or RootObj i guess? |
00:59:02 | FromDiscord | <jos> i tried using any and it said to use "auto", but then i get weird errors like this |
00:59:34 | FromDiscord | <jos> https://media.discordapp.net/attachments/371759389889003532/1025572644436852766/unknown.png |
00:59:39 | FromDiscord | <jos> i have no clue what this means but i guess somehow the auto has to be statically known? |
00:59:42 | FromDiscord | <huantian> `auto` is once again just a generic |
00:59:59 | FromDiscord | <huantian> so `proc[T](thing: T)` is the same as `proc(thing: auto)` |
01:00:41 | FromDiscord | <jos> so is there any way to return any type dynamically? and then cast it to the type that's known statically, somewhere else |
01:00:53 | FromDiscord | <jos> RootObj is the only thing i can think of but then only oopy stuff will work |
01:02:11 | FromDiscord | <huantian> The only way to have that is oop-y stuff, which is why java can do it |
01:02:22 | FromDiscord | <huantian> And also why java has boxed variants of their primitive |
01:03:02 | FromDiscord | <jos> well i don't see any reason you need an inheritance chain to box up some memory and cast it somewhere else |
01:03:09 | FromDiscord | <jos> rust can do it with the Any type, after all |
01:03:19 | FromDiscord | <jos> c can do it with a void pointer |
01:03:26 | FromDiscord | <jos> i'm sure you can do it in nim, just not sure how |
01:05:58 | * | rockcavera joined #nim |
01:06:22 | FromDiscord | <Elegantbeef> `RootRef` or `pointer` |
01:06:56 | FromDiscord | <jos> im reading the pointer docs, trying to figure out how to make cast between managed/unmanaged pointers |
01:06:59 | FromDiscord | <jos> :cartsweat: |
01:07:25 | FromDiscord | <Yardanico> managed pointers are called `ref` (references), and you can't exactly cast between them safely |
01:07:30 | FromDiscord | <Yardanico> as managed pointers are managed by the GC |
01:07:41 | FromDiscord | <Yardanico> but you can cast if you're sure it'll be safe :) |
01:07:47 | FromDiscord | <Elegantbeef> You can go from `ref` to `ptr` but it's only safe if you know |
01:07:58 | FromDiscord | <jos> i'm trying to make a dependency graph |
01:08:18 | FromDiscord | <jos> it should be okay |
01:08:42 | FromDiscord | <jos> i can guarantee there will only be one ref to the value and then i just wanna take it out of the managed world for a bit so i can pass it through a layer of type erasure |
01:09:03 | FromDiscord | <Yardanico> but again, if it's a ref, why not use RootRef ? |
01:09:36 | FromDiscord | <jos> does that mean any `ref T` will work? |
01:09:42 | FromDiscord | <jos> even if it doesn't get oopy |
01:09:50 | FromDiscord | <jos> yeah that makes sense, since ref is basically a boxed value, right? |
01:11:01 | FromDiscord | <sOkam!> Is there an existing library for image writing/reading/modification? |
01:11:17 | FromDiscord | <Elegantbeef> pixie |
01:12:22 | FromDiscord | <sOkam!> oh, there is no tga support. will have to code that i guess. but didn't think about pixie, ty |
01:12:57 | FromDiscord | <jos> i dont rly understand how to create a `ref int` |
01:13:07 | FromDiscord | <jos> for example |
01:14:09 | FromDiscord | <Rika> `let a = new int` |
01:14:31 | FromDiscord | <Rika> `a[] = # put integer content` |
01:15:01 | FromDiscord | <jos> a[] = 123, for example? |
01:15:08 | FromDiscord | <Rika> Yes |
01:15:08 | FromDiscord | <jos> definitely don't understand why that works |
01:15:16 | FromDiscord | <Yardanico> In reply to @jos "definitely don't understand why": `[]` is dereferencing operator |
01:15:32 | FromDiscord | <jos> :cartsweat: |
01:15:37 | FromDiscord | <jos> i guess that makes sense |
01:15:40 | FromDiscord | <Rika> And new just makes a reference of the T you pass it |
01:16:15 | FromDiscord | <sOkam!> In reply to @Elegantbeef "pixie": can it create and write byte buffers? do you know? |
01:16:24 | FromDiscord | <jos> ok yeah this works, i just got it working on the playground, thanks! |
01:16:32 | FromDiscord | <sOkam!> (edit) "create and write" => "create/read/write" |
01:16:41 | FromDiscord | <Rika> Oh yeah the playground is back up |
01:16:42 | FromDiscord | <Rika> Lmao |
02:03:21 | * | arkurious quit (Quit: Leaving) |
02:33:42 | * | Guest65 joined #nim |
02:33:46 | * | Guest65 left #nim (#nim) |
03:04:50 | FromDiscord | <Jool> How do I tune Nim's garbage collector? |
03:06:42 | FromDiscord | <Rika> In what ways would you like to tune it? |
03:18:43 | FromDiscord | <demotomohiro> !eval echo NimVersion |
03:18:49 | NimBot | 1.6.8 |
03:24:40 | FromDiscord | <Iliketwertles> how is this invalid indentation? https://media.discordapp.net/attachments/371759389889003532/1025609163893641286/screenshot_2022-09-30-232426.png |
03:24:57 | FromDiscord | <Iliketwertles> on `elif paramCount() == 0:` |
03:25:55 | FromDiscord | <Iliketwertles> do i have to add a else to the case of paramStr(1)? |
03:26:14 | FromDiscord | <Elegantbeef> missing `)` |
03:26:36 | FromDiscord | <Iliketwertles> oh |
03:26:54 | FromDiscord | <Iliketwertles> blind as a bat |
03:27:39 | FromDiscord | <apothecary> does anyone know how I can install nim on my m1 mac so that is produces arm executables instead of x86? |
03:30:49 | FromDiscord | <demotomohiro> I guess you need a gcc or clang that can produce arm executable for mac. |
03:31:25 | FromDiscord | <apothecary> I have clang |
03:31:48 | FromDiscord | <apothecary> I've tried using choosenim |
03:32:06 | FromDiscord | <demotomohiro> How about to search nim forum? I think I saw similar question before |
03:32:10 | FromDiscord | <Elegantbeef> I think choosenim fetches and sets up a x86 compiler |
03:32:32 | FromDiscord | <apothecary> yeah - it looks that way, although it built the compiler from source |
03:32:48 | FromDiscord | <Jool> Turning off and on.↵(@Rika) |
03:32:52 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4bXo |
03:33:16 | FromDiscord | <Elegantbeef> `myProcThatTakesOpenArray(myCollection.toOpenArray(0, myCollection.high - 3)` |
03:33:20 | FromDiscord | <Elegantbeef> it's a 0 cost slice |
03:33:57 | FromDiscord | <sOkam!> whats high-3? |
03:34:09 | FromDiscord | <Elegantbeef> removing the last 3 entries |
03:34:33 | FromDiscord | <sOkam!> why would i remove anything? i need all data from a seq[uint8] buffer |
03:34:34 | FromDiscord | <Elegantbeef> It's a slice you cannot hold onto in a variable, `openArray` can only be a parameter |
03:34:48 | FromDiscord | <sOkam!> but the `open()` proc requires openarray |
03:34:53 | FromDiscord | <Elegantbeef> It was an example to how to use it |
03:35:01 | FromDiscord | <Elegantbeef> `seq` is implicitly converted to openarray |
03:35:26 | FromDiscord | <demotomohiro> @Jool I think this is what you want to read: https://nim-lang.org/docs/mm.html |
03:35:38 | FromDiscord | <apothecary> In reply to @demotomohiro "How about to search": looks like there are some things I can try on the foru |
03:36:03 | FromDiscord | <Jool> Thks↵(@demotomohiro) |
03:36:11 | FromDiscord | <sOkam!> In reply to @Elegantbeef "`seq` is implicitly converted": how do you calculate last then? |
03:36:29 | FromDiscord | <Elegantbeef> You dont need to |
03:37:08 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4bXp |
03:37:50 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4bXq |
03:38:13 | FromDiscord | <sOkam!> The proc asks me to give the last parameter. Or am I missing something in how its used? |
03:38:55 | FromDiscord | <sOkam!> `sizeof(f)` maybe? 🤔 |
03:39:00 | FromDiscord | <Elegantbeef> no |
03:39:13 | FromDiscord | <Elegantbeef> It'd be `buf = newSeq[uint8](128)` and `0, 128` |
03:39:35 | FromDiscord | <Elegantbeef> actually 127 sorry |
03:39:40 | FromDiscord | <sOkam!> why 127? |
03:39:45 | FromDiscord | <Elegantbeef> cause len - 1 |
03:40:10 | FromDiscord | <sOkam!> i don't follow. isn't last meant to be the last byte of the file? |
03:40:27 | FromDiscord | <Elegantbeef> you're saying "write to 0 to 127" |
03:40:28 | FromDiscord | <Elegantbeef> No |
03:40:37 | FromDiscord | <Elegantbeef> The amount of bytes to write to |
03:41:01 | FromDiscord | <Elegantbeef> What library are you trying to use? |
03:41:16 | FromDiscord | <sOkam!> pixie, that has no support for tga |
03:41:25 | FromDiscord | <sOkam!> so im trying to get the tga data into nim types |
03:41:39 | FromDiscord | <Elegantbeef> ok |
03:42:05 | FromDiscord | <sOkam!> currently, just trying to get the raw byte data into nim at all, with no success |
03:42:15 | FromDiscord | <Elegantbeef> Yea i dont follow |
03:42:19 | FromDiscord | <Elegantbeef> Use the procedure and carry on |
03:42:37 | FromDiscord | <sOkam!> i cannot carry on if i don't understand what im doing |
03:42:50 | FromDiscord | <Elegantbeef> You need to allocate a buffer then say "This is the place in the buffer i want you to write" |
03:43:20 | FromDiscord | <Elegantbeef> Well i dont know what function you're trying to usse |
03:43:20 | FromDiscord | <Elegantbeef> So.... |
03:43:34 | FromDiscord | <sOkam!> `readBytes()` |
03:43:51 | FromDiscord | <Elegantbeef> `reads len bytes into the buffer a starting at a[start]. Returns the actual number of bytes that have been read which may be less than len (if not as many bytes are remaining), but not greater. ` |
03:43:52 | FromDiscord | <sOkam!> or anything else that gives me the raw byte data, i don't mind |
03:43:54 | FromDiscord | <Elegantbeef> That doesnt take `last` |
03:44:35 | FromDiscord | <Elegantbeef> If you want the raw byte data you can just `readFile` |
03:45:15 | FromDiscord | <sOkam!> true, i mixed the procs↵its `start, len` |
03:46:06 | * | alice quit (Remote host closed the connection) |
03:46:16 | FromDiscord | <sOkam!> oh much easier, it gives a string also. which can be used in binny directly |
03:46:34 | FromDiscord | <sOkam!> i was trying to convert to string, but i didn't see this |
03:46:53 | * | alice joined #nim |
03:51:46 | FromDiscord | <proton> How to convert object to JsonNode? |
03:52:44 | FromDiscord | <Elegantbeef> `% MyObject()` |
03:54:19 | FromDiscord | <apothecary> In reply to @demotomohiro "How about to search": https://forum.nim-lang.org/t/8181#52631 this ended up working. Sad that the homebrew and choosenim versions don't. They are basically DOA currently. |
04:13:07 | FromDiscord | <proton> sent a code paste, see https://play.nim-lang.org/#ix=4bXw |
04:13:21 | FromDiscord | <proton> Have to implement this Bool type |
04:14:14 | FromDiscord | <Rika> what is `Bool`? |
04:14:58 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4bXx |
04:15:38 | FromDiscord | <sOkam!> (edit) "https://play.nim-lang.org/#ix=4bXx" => "https://play.nim-lang.org/#ix=4bXy" |
04:15:55 | FromDiscord | <Elegantbeef> binary operators allow new lining |
04:16:01 | FromDiscord | <Elegantbeef> But the real thing is why do you use sizeof on each field |
04:16:07 | FromDiscord | <Elegantbeef> and why `sum` is a `var` |
04:16:27 | FromDiscord | <sOkam!> because i don't know how to get the size of each field separately through a loop |
04:16:41 | FromDiscord | <Elegantbeef> `sizeof(T)` |
04:16:48 | FromDiscord | <sOkam!> I want to contrast the size that the type should have (18) with the one that is being given (20, so probably aligned) |
04:16:58 | FromDiscord | <sOkam!> sizeof(T) is 20, which is wrong |
04:17:03 | FromDiscord | <sOkam!> it should be 18 |
04:17:08 | FromDiscord | <Elegantbeef> Put `{.packed.}` on the type |
04:17:17 | FromDiscord | <sOkam!> k ty |
04:58:59 | * | rockcavera quit (Remote host closed the connection) |
06:21:01 | * | derpydoo joined #nim |
06:23:58 | * | disso_peach quit (Quit: Leaving) |
07:24:24 | * | derpydoo quit (Ping timeout: 264 seconds) |
07:25:39 | * | ehmry quit (Remote host closed the connection) |
07:26:50 | * | ehmry joined #nim |
07:34:16 | * | derpydoo joined #nim |
07:35:34 | FromDiscord | <proton> How to restore a table from string? |
07:36:20 | FromDiscord | <Elishaboy Emmanuel4> sent a long message, see http://ix.io/4bY6 |
07:39:43 | FromDiscord | <proton> sent a code paste, see https://play.nim-lang.org/#ix=4bY8 |
07:40:55 | FromDiscord | <proton> It seems that to doesn't work for this object |
07:42:12 | FromDiscord | <Elishaboy Emmanuel4> sent a long message, see http://ix.io/4bY6 |
07:42:36 | FromDiscord | <Elishaboy Emmanuel4> sent a long message, see http://ix.io/4bY6 |
07:51:51 | * | ehmry quit (Quit: No Ping reply in 180 seconds.) |
07:52:59 | * | ehmry joined #nim |
08:08:18 | FromDiscord | <ChocolettePalette> The bottom line of "f\uck you" emojis is kinda sus doe |
08:08:37 | FromDiscord | <jan Apisu> In reply to @Elishaboy Emmanuel4 "Is your bitcoin wallet": totally legit |
08:08:56 | FromDiscord | <jan Apisu> btw matrix is cringe |
08:17:29 | * | dtomato quit (Read error: Connection reset by peer) |
08:17:35 | * | dtomato9 joined #nim |
08:18:37 | FromDiscord | <Rika> In reply to @ChocolettePalette "The bottom line of": LMAO I didn’t notice that |
08:18:41 | FromDiscord | <ChocolettePalette> Is this the reason why a stereotypical discord moderator is a pale fat guy wearing fedora? "Going outside is cringe people can freely shout spam and I can't even unhear this!" |
08:27:44 | FromDiscord | <Phil> In reply to @Elishaboy Emmanuel4 "Is your bitcoin wallet": <@&371760044473319454> I am hostile!↵Towards scummy ads |
08:30:43 | * | jmdaemon quit (Ping timeout: 244 seconds) |
08:35:28 | * | jmdaemon joined #nim |
08:54:12 | * | dnh joined #nim |
09:11:30 | * | dtomato joined #nim |
09:12:21 | * | dtomato9 quit (Ping timeout: 250 seconds) |
09:12:30 | * | Th30n joined #nim |
09:13:06 | FromDiscord | <ieltan> Maybe we should try to get a bot to deal with the scamspams |
09:13:22 | Th30n | Hey all. I've recently started learning nim. :wave: |
09:13:42 | * | PMunch joined #nim |
09:14:16 | Th30n | I'm stuck on trying to make a generic `first` function that takes anything that can be looped over. How can I achieve that? |
09:14:49 | Th30n | Something like `proc first(iter: <some-type>): Option<element-type> = for i in iter: return i.some` |
09:17:00 | PMunch | So you just want to return the first thing if it exists? Wrapped in an option? |
09:17:34 | Th30n | PMunch: yep, exactly |
09:17:51 | Th30n | Is there maybe already something like that in the stdlib? |
09:17:56 | FromDiscord | <Rika> Probably needs concepts or "iterable" for that |
09:18:05 | FromDiscord | <Rika> Not sure about the status of iterable |
09:21:40 | PMunch | It can definitely be done with concepts: https://play.nim-lang.org/#ix=4bYA |
09:22:33 | PMunch | Th30n ^ |
09:23:44 | Th30n | But concepts are experimental still, right? |
09:29:27 | PMunch | I guess, yeah |
09:29:35 | PMunch | I mean you could also do this with a template |
09:31:32 | Th30n | Yeah, but template cannot be passed as an argument like a function can... |
09:31:46 | Th30n | Oh well, I'm stuck with overloading for now then, until concepts arrive. |
09:32:16 | PMunch | Hmm, or maybe not actually |
09:32:47 | PMunch | Do you actually need it for all iterables though? |
09:32:54 | PMunch | Or would openArray suffice? |
09:33:36 | PMunch | By the way, concepts are enabled by default in the compiler. So in a way they are already here, just maybe a bit unstable (I'm using the "old" syntax I think, but it's the only one I can find documentation for) |
09:34:29 | Th30n | Currenly, I only need it for openArray and HashSet, so it's fine with overloads. |
09:34:38 | Th30n | But was hoping for something even more generic... |
09:34:39 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4bYC |
09:34:50 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4bYC" => "https://play.nim-lang.org/#ix=4bYD" |
09:35:35 | FromDiscord | <enthus1ast> @Phil\: y is float |
09:35:49 | FromDiscord | <Phil> That's just an example, I overall want to check if y is a number |
09:35:54 | FromDiscord | <Phil> Which means covering a lot more than just float |
09:36:15 | PMunch | Th30n, you could do it like this actually: https://play.nim-lang.org/#ix=4bYF |
09:36:17 | FromDiscord | <Phil> "If y is number then render number-input-field in HTML" is the logic |
09:36:36 | FromDiscord | <enthus1ast> maybe\:↵↵y is SomeNumber |
09:38:00 | Th30n | PMunch: And it's not experimental? Awesome, thanks! |
09:38:26 | PMunch | @Phil, you can create a typeclass: https://play.nim-lang.org/#ix=4bYG |
09:38:36 | PMunch | Which is what the built in SomeNumber is |
09:38:56 | PMunch | Th30n, I don't think auto is experimental |
09:39:10 | * | dnh quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
09:39:17 | FromDiscord | <Rika> In reply to @Th30n "<@696333749570371585>: And it's not": If it doesn’t have an iteration function it would not compile though |
09:39:43 | FromDiscord | <Rika> Is that desired? |
09:39:47 | PMunch | Well yes, of course |
09:39:49 | Th30n | Excellent, exactly what I wanted. So turn out C++ approach is the way :sweat_smile: |
09:39:54 | Th30n | turns* |
09:40:10 | FromDiscord | <Rika> In reply to @PMunch "Well yes, of course": Yes, but I don’t know if it is what they wanted |
09:40:40 | PMunch | Basically you'll get a compilation error saying something like T doesn't have a procedure `items` or something like that |
09:46:00 | * | dnh joined #nim |
09:51:20 | * | Th30n quit (Quit: WeeChat 3.6) |
09:55:10 | * | Th30n joined #nim |
09:56:19 | * | PMunch quit (Ping timeout: 248 seconds) |
09:56:53 | FromDiscord | <Phil> Webdev channel has become literally unuseable atm |
10:16:42 | FromDiscord | <hugogranstrom> In reply to @Isofruit "Webdev channel has become": wow they are spamming hard now 😮 |
10:19:09 | FromDiscord | <hugogranstrom> Ugh, getting a `invalid integer: 2` from `parseInt` in the js backend. But only in one file using the same function, all other files runs fine 🙃 I've checked the `repr(s)` and `s.len` and `'\0' in s` but all of them says that the string is just `"2"` with a len of 1 and no hidden chars |
10:27:45 | * | jmdaemon quit (Ping timeout: 250 seconds) |
10:44:50 | FromDiscord | <enthus1ast> it looks like the spam harder when the're mentioned↵(@hugogranstrom) |
10:45:35 | FromDiscord | <pmunch> Banned the user |
10:45:48 | FromDiscord | <pmunch> Curiously it seems to mostly be our smaller channels |
10:45:56 | FromDiscord | <hugogranstrom> In reply to @enthus1ast "it looks like the": So the classic trick of ignoring them works on spam bots as well? xD |
10:46:53 | FromDiscord | <hugogranstrom> In reply to @pmunch "Curiously it seems to": yeah, but not all of them. Appdev and security seldom seems to have that much spam |
10:47:47 | FromDiscord | <enthus1ast> imho security is not briged to matrix right? |
10:48:21 | FromDiscord | <enthus1ast> (would be nice though) |
10:54:04 | FromDiscord | <jan Apisu> `code` |
11:08:31 | FromDiscord | <hugogranstrom> In reply to @enthus1ast "imho security is not": huh, perhaps not. Can't see any matrix `bot` banners at least. Appdev is bridged though |
11:16:19 | FromDiscord | <Bung> sent a code paste, see https://play.nim-lang.org/#ix=4bZd |
11:52:57 | FromDiscord | <enthus1ast> who actually are the bridge admins ? |
11:59:10 | * | arkurious joined #nim |
12:03:25 | * | Th30n quit (Quit: bye) |
12:08:32 | FromDiscord | <Tekk> is there a limit to how big an array can be? |
12:17:22 | * | dnh quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
12:18:57 | * | dnh joined #nim |
12:23:42 | FromDiscord | <Horizon [She/Her]> 128 lines so far for the Jasmin instruction builder (and it's still not done yet) |
12:24:07 | FromDiscord | <Rika> In reply to @Tekk "is there a limit": as big as your stack can handle pretty much |
12:24:26 | FromDiscord | <Horizon [She/Her]> Some of these will need to be duplicated too, so variable names can be used instead of variable numbers |
12:25:11 | FromDiscord | <Horizon [She/Her]> And i'll still need to work on making classes wrapped in a decent way for IDE support, fun- |
12:25:20 | FromDiscord | <Horizon [She/Her]> I'll likely just use a single file like Beef said |
12:25:42 | FromDiscord | <Horizon [She/Her]> Wonder if can make 'namespaces' that aren't enforced in Nim |
12:25:50 | FromDiscord | <Horizon [She/Her]> Like how enums do it |
12:31:15 | FromDiscord | <Tekk> In reply to @Rika "as big as your": weird, my program just fails on specific array sizes |
12:32:31 | FromDiscord | <Rika> In reply to @Tekk "weird, my program just": example |
12:38:15 | FromDiscord | <Tekk> In reply to @Rika "example": i have a big array of vec3s for every pixel, 800\600 pixels, and i try multiplying each one so i can get a ray direction for the raycaster but it just fails, no specific error on why. just failed execution |
12:38:36 | FromDiscord | <Tekk> a 500500 array works fine |
12:38:44 | FromDiscord | <Rika> sequence or actual array |
12:38:50 | FromDiscord | <Tekk> actual array |
12:38:54 | FromDiscord | <Rika> okay just making sure |
12:39:16 | FromDiscord | <Rika> what's the definition for vec3 |
12:40:21 | FromDiscord | <Tekk> im using sol package :p |
12:41:22 | FromDiscord | <Tekk> looking at source its a SIMD vector type |
12:41:46 | FromDiscord | <Tekk> and for nim its imported from c as object |
12:42:36 | FromDiscord | <Rika> which types are you using exactly since vec3 is a concept |
12:42:45 | FromDiscord | <Tekk> float64x3 |
12:43:59 | FromDiscord | <Rika> thats 11 megs almost of stack wow |
12:44:16 | FromDiscord | <Rika> i dont think thats anywhere near the limit but its a lot |
12:44:55 | FromDiscord | <Tekk> 😆 probably doing something wrong |
12:45:25 | FromDiscord | <Rika> oh |
12:45:31 | FromDiscord | <Rika> linux stack limit is 8mb default |
12:45:42 | FromDiscord | <Rika> you might actually be going past the limit lol |
12:45:55 | FromDiscord | <Rika> 64/83800600 is 11.5 mebi i think |
12:46:01 | FromDiscord | <Rika> (edit) "64/83800600" => "`64/83800600`" |
12:46:18 | FromDiscord | <Rika> `64/83500500` is 6 mega |
12:46:31 | FromDiscord | <Rika> (edit) "mebi" => "mega" |
12:46:37 | FromDiscord | <Rika> so yeah that might explain things |
12:46:50 | FromDiscord | <Rika> any reasons you're using float64 for this lol |
12:47:13 | FromDiscord | <Tekk> nim manual says to use float in genera so im just using the default 🤷♂️ |
12:47:19 | FromDiscord | <Tekk> (edit) "genera" => "general" |
12:48:04 | FromDiscord | <Rika> well, it depends on your usecase really |
12:48:08 | FromDiscord | <Rika> In reply to @Tekk "nim manual says to": where? |
12:48:15 | FromDiscord | <Rika> what are you using the numbers for? |
12:48:23 | FromDiscord | <Tekk> https://nim-lang.org/docs/manual.html#types-preminusdefined-floatingminuspoint-types |
12:48:37 | FromDiscord | <Tekk> In reply to @Rika "what are you using": dda raycasting |
12:48:53 | FromDiscord | <Rika> In reply to @Tekk "https://nim-lang.org/docs/manual.html#types-preminu": in general for float types |
12:49:52 | FromDiscord | <Tekk> hmmm... |
12:50:34 | FromDiscord | <Rika> In reply to @Tekk "dda raycasting": ill read about it to see if you can reduce the type size |
12:50:41 | FromDiscord | <Rika> (you prolly can?) |
12:51:22 | * | dnh quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
12:52:05 | FromDiscord | <Rika> you can prolly use float32 instead since i assume you dont need extreme accuracy (is this for a game?) |
12:52:09 | FromDiscord | <Tekk> of course i can, probably a lot too |
12:52:12 | FromDiscord | <Rika> games tend to use float32 |
12:52:53 | FromDiscord | <Tekk> In reply to @Rika "you can prolly use": just seeing if i can make a fast voxel renderer on cpu |
12:56:28 | FromDiscord | <ChocolettePalette> On a cpu you can't |
12:57:28 | FromDiscord | <Tekk> https://www.youtube.com/watch?v=qn7QWuU2duo |
12:57:35 | FromDiscord | <Tekk> this guy got 15 fps |
12:59:17 | FromDiscord | <ChocolettePalette> 15... |
13:00:30 | * | dnh joined #nim |
13:02:27 | FromDiscord | <Tekk> theres a ton of room for improvement! |
14:14:00 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=4bZZ |
14:17:09 | FromDiscord | <dain> oh wait nvm i just screwed up on a line after it |
14:19:18 | FromDiscord | <dain> anyway this is the real thing i was stuck on, how do I make a template that converts an inline iterator into a closure iterator |
14:19:57 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=4c01 |
14:20:30 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=4c03 |
14:22:41 | FromDiscord | <Horizon [She/Her]> `long` is `int8`? |
14:22:42 | FromDiscord | <Horizon [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4c06 |
14:25:15 | * | kenran joined #nim |
14:28:44 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4c09 |
14:30:07 | FromDiscord | <Horizon [She/Her]> Oh okay i was confused, thanks! |
14:30:29 | FromDiscord | <jmgomez> Np, we have some UE/Cpp equivalences here https://github.com/jmgomez/NimForUE/blob/0aa2119d25ebea10927faa9816f9ab49d1dcbf31/src/nimforue/typegen/fproperty.nim#L112 |
14:31:31 | FromDiscord | <Horizon [She/Her]> UE being UnrealEngine? |
14:31:42 | FromDiscord | <jmgomez> yup |
14:31:49 | FromDiscord | <Horizon [She/Her]> Ah neat |
14:33:15 | FromDiscord | <Horizon [She/Her]> I'm wondering now how well Nim would translate to the JVM again |
14:34:50 | FromDiscord | <jmgomez> it should fine, isnt it? I mean, it translates well to c/cpp and to js. Java is kind of in the middle. Actually the UE way of doing things is quite similar to Java/DotNet all the UObjects stuff (also garbage collected) |
14:35:56 | FromDiscord | <Horizon [She/Her]> True |
14:37:07 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=4c0d |
14:38:42 | FromDiscord | <demotomohiro> Internal error means there is a bug in Nim compiler. |
14:40:59 | FromDiscord | <demotomohiro> sent a code paste, see https://paste.rs/28z |
14:42:09 | FromDiscord | <dain> how do I do that |
14:42:37 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=4c0g |
14:43:01 | FromDiscord | <dain> that gives a compiler error |
14:43:29 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=4c0h |
14:48:23 | FromDiscord | <dain> is this even possible |
14:49:10 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4c0j |
14:50:14 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=4c0k |
14:50:29 | FromDiscord | <dain> like i know it's useless to do that but surely it should still work |
14:51:52 | * | kenran` joined #nim |
14:52:50 | FromDiscord | <dain> the reason I ask is because I was trying to implement a version of `filter_it` that works on iterators |
14:53:23 | * | derpydoo quit (Ping timeout: 248 seconds) |
14:53:28 | FromDiscord | <dain> and I couldn't get it to work. in the course of trying to isolate the problem I removed successive pieces of the template until it was basically identical to `to_closure` and I got the same error |
14:57:09 | FromDiscord | <dain> sent a code paste, see https://paste.rs/YsT |
14:57:16 | * | kenran` quit (Remote host closed the connection) |
14:57:16 | FromDiscord | <4zv4l> what did I do wrong ? |
14:57:17 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4c0n |
14:57:19 | FromDiscord | <4zv4l> it segfault everytime |
15:04:10 | FromDiscord | <demotomohiro> change `client.recv(addr buff, buff.len)` to `client.recv(addr buff[0], buff.len)` might fix. |
15:04:45 | FromDiscord | <demotomohiro> There are `recv` procs without pointer: https://nim-lang.org/docs/net.html#recv,Socket,string,int,int |
15:06:34 | FromDiscord | <demotomohiro> `addr buff` just returns the address of buff but not the address of content of `buff`. |
15:18:00 | FromDiscord | <4zv4l> oooh ok thanks ! |
15:18:40 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4c0R |
15:18:44 | FromDiscord | <4zv4l> I can import that function without a problem in C |
15:18:52 | FromDiscord | <4zv4l> but nim doesn't succeed to compile it |
15:19:10 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4c0S |
15:21:55 | FromDiscord | <4zv4l> `--passL:-lpcap` did the trick |
15:30:35 | FromDiscord | <4zv4l> how do I import a type from a C lib ? |
15:30:44 | FromDiscord | <4zv4l> but it doesn't seem to work |
15:30:46 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4c0V |
15:30:54 | * | dnh quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
15:33:10 | FromDiscord | <4zv4l> In reply to @4zv4l "also I'm trying to": and the code doesn't work, idk why it segfault always |
15:33:28 | FromDiscord | <4zv4l> sent a code paste, see https://paste.rs/sT1 |
15:33:55 | FromDiscord | <4zv4l> (edit) "https://play.nim-lang.org/#ix=4c10" => "https://play.nim-lang.org/#ix=4c0Z" |
15:34:22 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4c11 |
15:35:27 | FromDiscord | <4zv4l> thanks ! |
15:35:48 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4c12 |
15:35:54 | FromDiscord | <4zv4l> I tried using `addr` and `ptr` instead of `var` but same result |
15:36:13 | FromDiscord | <4zv4l> (edit) "https://play.nim-lang.org/#ix=4c12" => "https://play.nim-lang.org/#ix=4c14" |
15:38:13 | FromDiscord | <dain> how do I determine whether something is being piped into the program? I tried using `stdin.isatty` but it doesn't work. |
15:38:31 | FromDiscord | <4zv4l> In reply to @dain "how do I determine": wouldn't that be in stdin ? |
15:38:41 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=4c15 |
15:38:44 | FromDiscord | <dain> this prints "something piped in" no matter what |
15:39:00 | FromDiscord | <4zv4l> if you pipe something to a program that will send the data to the `stdin` buffer of the program |
15:39:01 | FromDiscord | <dain> either with `echo "foo" | ./ttytest` or just `./ttytest` |
15:39:18 | FromDiscord | <dain> In reply to @4zv4l "if you pipe something": yeah I know. |
15:39:25 | FromDiscord | <dain> im trying to determine whether that has occurred or not |
15:40:38 | FromDiscord | <4zv4l> sent a long message, see http://ix.io/4c16 |
15:40:42 | * | dnh joined #nim |
15:40:51 | FromDiscord | <4zv4l> but so that's not pipe in the right direction |
15:41:00 | FromDiscord | <dain> it shouldn't matter |
15:43:28 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=4c1a |
15:44:32 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4c1b |
15:46:02 | * | kenran quit (Remote host closed the connection) |
15:46:33 | FromDiscord | <dain> is it just a bug |
15:51:41 | FromDiscord | <4zv4l> is there a Nim function to pass from int32 to a string IP addr ? |
15:52:10 | FromDiscord | <4zv4l> like `inet_ntoa` but in Nim |
15:53:54 | FromDiscord | <demotomohiro> In reply to @4zv4l "is there a Nim": Probably it is in somewhere `net` or `nativesockets` module. |
15:56:47 | FromDiscord | <4zv4l> I looked in nativesockets but didn't really find anything |
15:56:54 | FromDiscord | <4zv4l> except if I can cast the i32 into an address |
15:58:06 | FromDiscord | <dain> In reply to @dain "is it just a": oh wait it looks like it's a problem with how I was running it |
15:58:58 | FromDiscord | <dain> for some reason it breaks when I compiled and ran it from vim |
15:59:04 | FromDiscord | <dain> but works when i do it from a normal terminal |
15:59:08 | FromDiscord | <dain> ¯\_(ツ)_/¯ |
16:00:42 | FromDiscord | <dain> oh i guess because `! nim c % && echo "foo" | ./scriptname` wouldn't actually make a tty .. |
16:00:59 | FromDiscord | <4zv4l> yeah idk how vim runs command like this |
16:09:14 | FromDiscord | <4zv4l> how can I convert a i32 to an array of 4 u8 ? |
16:10:48 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4c1n |
16:11:38 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4c1q |
16:11:42 | FromDiscord | <4zv4l> or if there is a function in `net` that does it why not but |
16:11:45 | FromDiscord | <4zv4l> since I didn't find one |
16:11:54 | FromDiscord | <4zv4l> ip_raw is an i32 |
16:11:59 | FromDiscord | <4zv4l> (edit) "an" => "a" |
16:12:17 | FromDiscord | <4zv4l> I'll try this `cast[array[4, byte]](ii)` |
16:12:46 | FromDiscord | <4zv4l> that works great ! |
16:12:52 | FromDiscord | <4zv4l> is `cast` safe in nim ? |
16:13:00 | FromDiscord | <Rainbow Asteroids> no |
16:14:01 | FromDiscord | <4zv4l> alright, I know what I'm doing anyway, just to know |
16:14:14 | FromDiscord | <enthus1ast> but you can also use inet\_ntoa directly |
16:14:21 | FromDiscord | <4zv4l> from the c lib ? |
16:15:06 | FromDiscord | <enthus1ast> yeah |
16:15:18 | FromDiscord | <4zv4l> yeah I could |
16:15:40 | FromDiscord | <4zv4l> but glad I had to search, I thought that was magic at first how the ip could be put in a i32 xD |
16:15:46 | FromDiscord | <4zv4l> now I know it's simply 4 u8 |
16:16:03 | FromDiscord | <enthus1ast> yes |
16:17:01 | FromDiscord | <4zv4l> how can I print a int as hex btw ? |
16:17:22 | FromDiscord | <4zv4l> I got more less strformat but I directly put the var name in the {} so idk how to precise the type of it |
16:17:46 | FromDiscord | <enthus1ast> ah |
16:17:55 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4c1u |
16:18:06 | FromDiscord | <enthus1ast> i know it was there |
16:19:42 | FromDiscord | <4zv4l> oh yeah thanks, didn't think about that |
16:52:27 | FromDiscord | <auxym> In reply to @4zv4l "how can I print": with strformat something like `fmt"{a:#x}"` if a is your int |
16:56:58 | FromDiscord | <4zv4l> It worked without the # but yeah thank you ☺️ also it skipped zero, I don’t know if that’s because of how the ip is set in the memory and the 0 are at the beginning so it simply discard them idk |
17:03:11 | FromDiscord | <auxym> the # will add the 0x prefix |
17:04:39 | FromDiscord | <auxym> if you want leading zeros you'll have to decide on a field length. Like `#06x` will give you 0x prefix and pad the int with leading zeros if its less than 4 chars |
17:24:45 | * | gsalazar joined #nim |
17:31:09 | * | gsalazar quit (Ping timeout: 244 seconds) |
18:15:42 | FromDiscord | <Horizon [She/Her]> In reply to @auxym "with strformat something like": Oh strformat is like python in that regard |
18:15:49 | FromDiscord | <Horizon [She/Her]> Tho, iirc it is inspired by python so |
18:20:00 | * | dnh quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
18:20:25 | * | dnh joined #nim |
18:41:37 | FromDiscord | <Mrcool> Do I have to run build_all_sh each time I make a change in the codebase or is there something that takes less time? |
18:43:03 | FromDiscord | <Mrcool> (edit) "Do I have to run build_all_sh each time I make a change in the ... codebase" added "nim" |
18:48:45 | FromDiscord | <Horizon [She/Her]> `koch temp` iirc |
18:49:06 | FromDiscord | <Horizon [She/Her]> Builds a version of the compiler meant for testing and debugging purposes @Mrcool |
18:49:08 | * | dnh quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
18:52:49 | FromDiscord | <Horizon [She/Her]> In Nim, how do i check if a value is a string? When i'm doing `int | string | float` |
18:53:25 | FromDiscord | <huantian> `when some_var is string` |
18:54:05 | * | dnh joined #nim |
18:54:26 | FromDiscord | <Horizon [She/Her]> I thought `when` is compile time? |
18:54:32 | FromDiscord | <huantian> yes |
18:54:38 | FromDiscord | <huantian> also idk why I used camel case lmao |
18:54:46 | FromDiscord | <Horizon [She/Her]> Does is just expand the proc into multiple variations? |
18:54:57 | FromDiscord | <Horizon [She/Her]> In reply to @huantian "also idk why I": Python programmer? :p |
18:55:10 | FromDiscord | <Mrcool> python doesn't use camel |
18:55:22 | FromDiscord | <huantian> In reply to @Event Horizon "Python programmer? :p": mostly yeah |
18:55:37 | FromDiscord | <huantian> python uses camel for basically everything except classes/types |
18:55:46 | FromDiscord | <enthus1ast> this is determined at compile time↵(@Horizon [She/Her]) |
18:56:40 | FromDiscord | <huantian> In reply to @Event Horizon "Does is just expand": basically, you don't get dynamic dispatch with `|` it's all compile time |
18:57:14 | FromDiscord | <Mrcool> In reply to @huantian "python uses camel for": Are you sure, I thought its snake case, for example taking a random knwon project <https://github.com/ytdl-org/youtube-dl/blob/master/youtube_dl/YoutubeDL.py#L356> I see its all snake case |
18:57:20 | FromDiscord | <Mrcool> (edit) "knwon" => "known" |
18:57:38 | FromDiscord | <huantian> oh wait yeah sorry I meant to say "idk why I used snake case" |
18:57:56 | FromDiscord | <Horizon [She/Her]> In reply to @enthus1ast "this is determined at": Ah good to know |
18:59:29 | FromDiscord | <Mrcool> In reply to @Event Horizon "`koch temp` iirc": The changes I'm doing are in nimsuggest, does koch handle this? |
18:59:49 | FromDiscord | <Horizon [She/Her]> In reply to @Mrcool "The changes I'm doing": Ah, no idea really, maybe you're better off asking in #internals? |
19:00:23 | FromDiscord | <Horizon [She/Her]> 673 lines of code for just mapping out the instructions in Jasmin |
19:00:38 | FromDiscord | <Horizon [She/Her]> I'm so glad the majority didn't need to be mapped out manually |
19:01:02 | FromDiscord | <Horizon [She/Her]> I still need to redo this later too, to make it neater and more idiomatic... |
19:03:12 | FromDiscord | <Mrcool> its `koch tools` and for my specific case I can just use ↵`bin/nim c -o:bin/nimsuggest -d:danger --skipUserCfg --skipParentCfg --hints:off nimsuggest/nimsuggest.nim` |
19:04:02 | FromDiscord | <Horizon [She/Her]> Ah neat |
19:05:01 | FromDiscord | <Mrcool> now the next question is how do I compile with debug symbols |
19:05:42 | FromDiscord | <Horizon [She/Her]> don't use `-d:danger` :p |
19:06:02 | FromDiscord | <Horizon [She/Her]> `-d:danger` is more... Intense? Than `-d:release` iirc |
19:07:55 | FromDiscord | <Mrcool> I just copied what koch tools was using |
19:09:12 | FromDiscord | <Horizon [She/Her]> Yeah, don't use `-d:danger` to get debug symbols |
19:12:20 | FromDiscord | <auxym> danger is like release but also turns off runtime checks like overflow and length checking |
19:26:13 | FromDiscord | <Mrcool> I removed danger but there are still no debug symbols |
19:27:37 | * | kenran joined #nim |
19:31:11 | * | kenran` joined #nim |
19:31:50 | FromDiscord | <Mrcool> `-g ` works |
19:40:30 | * | kenran` quit (Remote host closed the connection) |
19:41:35 | FromDiscord | <auxym> `--debugger:native`? https://nim-lang.org/blog/2017/10/02/documenting-profiling-and-debugging-nim-code.html#using-gdb-lldb |
19:44:44 | FromDiscord | <Mrcool> All the symbols are mangled, so each time I'm interested in a function I have to ad {.epxortc.} to it |
19:51:33 | FromDiscord | <auxym> IIRC there's a gdb init script distributed with nim somewhere that auto-demangles everything |
19:56:52 | FromDiscord | <auxym> tools/nim-gdb.py I think |
20:13:59 | * | rockcavera joined #nim |
20:19:07 | FromDiscord | <Dino> sent a code paste, see https://play.nim-lang.org/#ix=4c2w |
20:20:04 | FromDiscord | <Dino> oh does get have to be used on an asynch client... |
20:20:55 | FromDiscord | <Dino> (edit) "asynch" => "async" |
20:43:32 | * | dnh quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
20:47:12 | * | disso_peach joined #nim |
21:01:14 | FromDiscord | <Horizon [She/Her]> Does `BiggestInt` have a way to get the integer type used? |
21:01:26 | FromDiscord | <Horizon [She/Her]> So `BiggestInt.typ` returns `int`? |
21:11:11 | FromDiscord | <Takemichi Hanagaki> sent a code paste, see https://play.nim-lang.org/#ix=4c2J |
21:11:26 | FromDiscord | <Takemichi Hanagaki> (edit) "https://play.nim-lang.org/#ix=4c2J" => "https://play.nim-lang.org/#ix=4c2K" |
21:11:32 | FromDiscord | <jan Apisu> python doesnt have namespaces |
21:11:53 | FromDiscord | <jan Apisu> math is a object just like anything else |
21:12:08 | FromDiscord | <Takemichi Hanagaki> In reply to @jan Apisu "math is a object": Hummmm, got it! |
21:16:43 | FromDiscord | <Elegantbeef> Nim doesnt use namespaces as it's annoying with UFCS |
21:17:04 | FromDiscord | <Elegantbeef> It's also annoying cause it's pointless |
21:17:09 | FromDiscord | <Elegantbeef> You already import a module why do you always need to say "I'm using it from X module" |
21:24:08 | * | kenran quit (Remote host closed the connection) |
21:26:09 | * | qwr quit (Ping timeout: 268 seconds) |
21:27:30 | * | qwr joined #nim |
21:41:02 | FromDiscord | <Rainbow Asteroids> In reply to @Elegantbeef "Nim doesnt use namespaces": if beef made nim, would nim still have UFCS |
21:41:22 | FromDiscord | <Rainbow Asteroids> or would nim have namespaces like in python |
21:41:37 | FromDiscord | <Elegantbeef> Namespaces are pointless if you ask me |
21:41:38 | FromDiscord | <Elegantbeef> It'd have ufcs |
21:43:08 | FromDiscord | <Rainbow Asteroids> sent a code paste, see https://play.nim-lang.org/#ix=4c2T |
21:43:18 | FromDiscord | <Elegantbeef> Sure |
21:43:30 | FromDiscord | <Elegantbeef> How does name spaces resolve that |
21:43:38 | FromDiscord | <Rainbow Asteroids> it does |
21:44:06 | FromDiscord | <Elegantbeef> By manually wrapping the code in namespaces and then using that name to dispatch that procedure? |
21:44:16 | FromDiscord | <Elegantbeef> You can do the same with Nim |
21:45:31 | FromDiscord | <Elegantbeef> We now did this and i hate it 😄 |
21:45:32 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4c2U |
21:46:02 | FromDiscord | <pmunch> Or if you keep them in separate modules \`from module import nil\` |
21:46:09 | FromDiscord | <pmunch> Or whatever that syntax is |
21:46:16 | FromDiscord | <Elegantbeef> In that case you just use the module name to disambiguate |
21:46:28 | FromDiscord | <Patitotective> or use different names for different procedures like a normal person |
21:46:42 | FromDiscord | <Elegantbeef> No namespaces required |
21:46:44 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4c2V |
21:46:50 | FromDiscord | <Elegantbeef> You use modules symbols to disambiguate when required |
21:47:27 | FromDiscord | <pmunch> Fair enough |
21:48:08 | FromDiscord | <Elegantbeef> The only times you really need the 'namespace' import method is when you have two modules with identical procedures for whatever reason |
21:48:17 | FromDiscord | <Elegantbeef> Atleast that's how i use it |
21:48:29 | FromDiscord | <Elegantbeef> YMMV 😛 |
21:59:54 | FromDiscord | <Takemichi Hanagaki> Thank you, @ElegantBeef!↵This explains to me so much! 🙂 |
22:00:13 | FromDiscord | <Takemichi Hanagaki> But, what exactly is UFCS? |
22:00:20 | FromDiscord | <Elegantbeef> Method call syntax |
22:00:38 | FromDiscord | <Takemichi Hanagaki> In reply to @Elegantbeef "Method call syntax": Oooohh, got it!↵Thank you! |
22:00:46 | FromDiscord | <Elegantbeef> In Nim all procedures are freestanding but you can do `10.procedure()` or `procedure(10)` |
22:00:55 | FromDiscord | <Elegantbeef> Now that i think about it the reason that Python uses namespaces as much as it does is lack of static typing |
22:00:55 | FromDiscord | <Patitotective> https://nim-lang.org/docs/manual.html#procedures-method-call-syntax |
22:01:03 | FromDiscord | <Elegantbeef> If it had static typing i'd imagine it'd be similar to Nim |
22:01:55 | FromDiscord | <Takemichi Hanagaki> In reply to @Elegantbeef "If it had static": Hummm, interesting!↵Again, thank you to explain! 😄 |
22:02:25 | FromDiscord | <Takemichi Hanagaki> In reply to @Patitotective "https://nim-lang.org/docs/manual.html#procedures-me": I'll read it now! Thank you! 💯 |
22:26:43 | FromDiscord | <Horizon [She/Her]> In reply to @Elegantbeef "Nim doesnt use namespaces": UFCS? |
22:26:54 | FromDiscord | <Patitotective> universal function call syntax iirc |
22:27:25 | FromDiscord | <Horizon [She/Her]> Ah |
22:29:35 | FromDiscord | <huantian> uniform |
22:29:41 | FromDiscord | <Patitotective> right |
22:35:36 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4c36 |
22:36:01 | FromDiscord | <Patitotective> search in the docs for a proc named `/` |
22:38:35 | FromDiscord | <Phil> There is no such proc in this one instance I call there.↵I call the same proc literally 5 lines further above as part of another (generic) proc and that works |
22:39:37 | FromDiscord | <Elegantbeef> What is line 18? |
22:41:46 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4c37 |
22:42:11 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4c38 |
22:42:18 | FromDiscord | <Phil> renderNimjaPage has worked in 7 different circumstances in the same file already, it's just this instance |
22:42:23 | FromDiscord | <Elegantbeef> Sorry `bind` |
22:46:01 | FromDiscord | <Elegantbeef> Whenever you have an error like this is good to assume the `/` isnt getting properly bound either not being left open or being mixin'd |
22:46:12 | FromDiscord | <Elegantbeef> or being binded\ |
22:53:12 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4c39 |
23:04:22 | * | jmdaemon joined #nim |
23:28:37 | * | qwr quit (Ping timeout: 252 seconds) |
23:30:45 | * | qwr joined #nim |