00:02:05 | FromDiscord | <Sabena Sema> it does, sortya |
00:02:07 | FromDiscord | <Sabena Sema> (edit) "sortya" => "sorta" |
00:02:13 | FromDiscord | <auxym> yeah same. what is hkt vs generics? |
00:02:20 | FromDiscord | <Sabena Sema> but those are like nim's `static[T]` (except they work more frequently than nim's) |
00:02:30 | FromDiscord | <Elegantbeef> And they're also more limited 😛 |
00:02:57 | FromDiscord | <Elegantbeef> Nim's work for complex types aswell as primitives |
00:07:08 | FromDiscord | <Elegantbeef> I really need to stop talking about compiler related stuff, i'm bound to start my own language with blackjack and hookers |
00:08:17 | FromDiscord | <Rika> Also call it beef just to fuck with the other beef language |
00:08:31 | FromDiscord | <Sabena Sema> sent a code paste, see https://play.nim-lang.org/#ix=4dCF |
00:09:04 | FromDiscord | <Sabena Sema> In reply to @Elegantbeef "Nim's *work* for complex": _when they work_ |
00:09:25 | FromDiscord | <Elegantbeef> Eh i generally havent had much issue with them |
00:09:34 | FromDiscord | <Sabena Sema> maybe I need to try them again |
00:09:48 | FromDiscord | <Elegantbeef> The worst issue is generally just procedure headers |
00:09:54 | FromDiscord | <Elegantbeef> So you need to get somewhat hacky to resolve |
00:10:10 | FromDiscord | <Sabena Sema> I think my problems have been mostly in trying to define matrix types, where they need to interact with subranges |
00:10:28 | arkanoid | damn, I don't remember what's the idiomatic way to pass an array to C via ffi. I have a "let myarray = [1.cint, 2, 3]" to be passed to a importc proc, but I don't remember if I should declare the signature as proc foo(myarray: ptr intc) or proc foo(myarray: UncheckedArray[intc]), if I use myarray.unsafeAddr compiler complains "but expression 'unsafeAddr myarray' is of type: ptr array[0..2, cint]" |
00:10:50 | FromDiscord | <Elegantbeef> I'd say most of Nim's issues come from it's type system being held together with bubble gum |
00:11:09 | FromDiscord | <Elegantbeef> `ptr uncheckedArray[cint]` |
00:11:25 | FromDiscord | <Rika> Saying it is held by bubble gum is an overstatement |
00:11:33 | FromDiscord | <Rika> Feels more like held together by air |
00:11:45 | FromDiscord | <Elegantbeef> It very much is in an awful state |
00:12:13 | arkanoid | Elegantbeef, do I have to use "cast" to convert array[0..2, cint] to UncheckedArray[intc] ? myarray.unsafeAddr doesn't work |
00:12:16 | FromDiscord | <Elegantbeef> And repairing it likely will cause a lot of code to either start or stop working 😄 |
00:12:23 | FromDiscord | <Sabena Sema> sent a code paste, see https://play.nim-lang.org/#ix=4dCG |
00:12:33 | FromDiscord | <Sabena Sema> the type itself compiles but even now it's pretty easy to get into trouble with it |
00:12:36 | FromDiscord | <Bung> @ElegantBeef I just found the Thread field turns to ptr Thread[tillegaltyperecursion.TIRC] |
00:12:46 | FromDiscord | <Sabena Sema> I just wanna write Eigen 😄 |
00:12:50 | FromDiscord | <Elegantbeef> Eh the issue here is array construction isnt smart |
00:13:19 | FromDiscord | <Elegantbeef> `array` is sem'd in the generic before instantiation and it cannot find `N` or `M` so it errors |
00:13:24 | FromDiscord | <Sabena Sema> yeah, a lot of the effort around rust's const generics was to get them to work with arrays properly |
00:13:57 | FromDiscord | <Elegantbeef> Personally i'd just like a better type system, something that doesnt have so many funny bugs |
00:14:22 | FromDiscord | <Elegantbeef> Well in the case of the above the 'proper' solution is to delay semming of arrays until instantiation |
00:14:23 | FromDiscord | <Elegantbeef> That way `M` and `N` can be inserted |
00:14:24 | FromDiscord | <Sabena Sema> yeah, the type system is quite ad-hoc. it feels like programming with older c++ compilers |
00:14:34 | FromDiscord | <Elegantbeef> But delaying errors is awful |
00:14:37 | FromDiscord | <Sabena Sema> again, that type actually sorta works |
00:15:43 | arkanoid | so I have to cast[UncheckedArray[cint]](myarray.unsafeAddr) for each argument? |
00:17:14 | FromDiscord | <Elegantbeef> Or just take a `cint` and do `myArray[0].addr` |
00:17:30 | FromDiscord | <Elegantbeef> I personally prefer taking `ptr UncheckedArray[T]` as it's more clear but you do you |
00:18:10 | FromDiscord | <Sabena Sema> huh, things actually seem to work OK for matrix now |
00:18:11 | arkanoid | isn't the address of myarr and myarr[0] equal? |
00:18:33 | FromDiscord | <Elegantbeef> Yes but one is `ptr array[range, T]` and the other is `ptr T`↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>) |
00:18:52 | FromDiscord | <Elegantbeef> so if the proc takes `ptr cint` you can just do `myArr[0].addr` |
00:19:29 | FromDiscord | <Elegantbeef> I actually made it so modulo types sorta even work↵(@Sabena Sema) |
00:20:10 | FromDiscord | <Sabena Sema> In reply to @Elegantbeef "I actually made it": damn you may have fixed my most annoying set of type bugs! |
00:20:24 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4dCJ |
00:20:24 | FromDiscord | <Sabena Sema> I guess I should try and modernize my linear algebra library again |
00:20:58 | FromDiscord | <Elegantbeef> I mean if you do run into issues i wouldnt mind looking at them, i'm not an amazing compiler dev, but i do have a soft spot for distinct and static |
00:21:36 | FromDiscord | <Sabena Sema> are those new style concepts |
00:21:43 | FromDiscord | <Elegantbeef> No that's old style |
00:21:58 | FromDiscord | <Elegantbeef> New style is `proc +(a, b: Self): Self` |
00:22:26 | FromDiscord | <Elegantbeef> A lot of my toy projects use either `static` or `distinct` be it sentinels or remoterefs here https://github.com/beef331/nimtrest/ |
00:22:45 | FromDiscord | <Sabena Sema> oh, it's just been so long since I've used them and I assumed there were parentheses around the parameters |
00:23:48 | FromDiscord | <Elegantbeef> I'm very much the 'type system's worst enemy |
00:24:32 | FromDiscord | <Elegantbeef> Concepts, static, distincts, just pure abuse on the poorly implemented type system |
00:25:30 | FromDiscord | <Elegantbeef> I dont know if you know how PType works internally but some things actually are indistinguishable |
00:26:08 | FromDiscord | <Elegantbeef> Like `type S[T] = seq[T]` vs `type S[T] = distinct int` are both `tyGenericAlias` iirc |
00:26:39 | FromDiscord | <Elegantbeef> It's something like that, that is a menace especially for borrowing |
00:27:48 | arkanoid | Elegantbeef, do you believe its something fixable, or is nim doomed to drag this forever? |
00:31:02 | FromDiscord | <Sabena Sema> it would take a lot of work on formalization, like both rust and c++ had to spend a bunch of time actually formalizing things, and nim's type system is about as ad-hoc as C++'s in terms of how it's grown (I think) |
00:31:38 | FromDiscord | <Elegantbeef> With enough time and effort it's likely fixable, i'm very much not a competent compiler dev, so take what i say with a grain of salt↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>) |
00:36:38 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/issues?q=is%3Aissue+is%3Aopen+generic almost a 5th of issues appear when you search 'generic' on the github issues |
00:37:31 | FromDiscord | <Elegantbeef> I forgot about this issue. It's quite funny https://github.com/nim-lang/Nim/issues/20268 |
01:00:30 | arkanoid | I'm trying to ffi with a static library, running "nm -C mylib.a" I can see "T FBL_Algo(double, double, int, int*, double*)" which is the function I want to call, but proc FBL_Algo(...){.importcpp: "FB_Algo(@)".} results in "error: FBL_Algo was not declared in this scope" |
01:01:14 | arkanoid | I'm passing --passL: mylib.a to nim compiler |
01:14:01 | FromDiscord | <Elegantbeef> why are you using `imporcpp`? |
01:14:39 | FromDiscord | <Elegantbeef> I think it should be `--passL:"-lmyLib"` |
01:25:36 | arkanoid | because the source files from which I have compiled the .o and archived the .a are .cpp, and I've compiled with g++ |
01:26:33 | arkanoid | but I'm not really into C/C++, so I don't know if the exported functions are C like or CPP like |
01:36:13 | * | arkurious quit (Quit: Leaving) |
01:38:17 | arkanoid | no it's not. whatever combination I try, I keep getting ld cannot find |
01:38:50 | arkanoid | file is named "libbehave.a" in same path of .nim wrapper and it's from where I am running "$ nim c" |
01:39:33 | arkanoid | I've tried: -lbehave.a, -llibbehave.a, -l:behave.a, -l:libbehave.a, -l<absolute path> |
01:47:23 | FromDiscord | <Sabena Sema> In reply to @arkanoid "because the source files": importcpp is what you want, probably |
01:47:31 | FromDiscord | <Sabena Sema> (edit) "In reply to @arkanoid "because the source files": importcpp is ... what" added "not" |
01:47:55 | arkanoid | solved the link thing with --passL="-L. -l:libbehave.a" |
01:48:09 | arkanoid | but I'm now getting lots of undefined references from other stuff |
01:48:38 | arkanoid | mbehavewrap.nim.cpp:(.text+0x596): undefined reference to `atmdotdotatsdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot8atslibatssystemdotnim_DatInit000()' |
01:50:33 | arkanoid | seems nim stuff to me, not external lib |
01:54:17 | arkanoid | if I go back to nim 1.4.2 I'm getting "@mbehavewrap.nim.cpp:(.text+0x50a): undefined reference to `systemDatInit000()'" instead |
01:55:41 | arkanoid | seems I'm dealing with https://github.com/nim-lang/Nim/issues/12002 |
01:57:11 | arkanoid | behavewrap: hidden symbol `_Z13systemInit000v' isn't defined |
01:57:28 | arkanoid | seems my static linking is messing up nim runtime (?) |
02:16:23 | arkanoid | solved, I have to use nim cpp |
02:20:19 | arkanoid | general question: why is "header" section of importcpp required? |
02:29:48 | FromDiscord | <Elegantbeef> Is it required? |
02:44:09 | FromDiscord | <Patitotective> do you guys know how am i supposed to write a markdown horizontal rule for docgen?↵with `## ---`, it complains `Error: new section expected (overline '---' is too short)` |
02:44:21 | FromDiscord | <Patitotective> is there some rst alternative? |
02:45:56 | * | derpydoo quit (Quit: derpydoo) |
02:53:17 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=4dD4 |
03:13:47 | FromDiscord | <Patitotective> i was thinking about making kdl's parser be more efficient by using `openarray[char]`↵but i also saw std rst parser use `cstring` instead↵should i prefer one over the other? (actually to store the parser input buffer i would use `seq[char]`) |
03:14:20 | FromDiscord | <Elegantbeef> Prefer `openarray[char]` it's cleaner, you can always drop down to `cstring` if you need/want |
03:14:54 | FromDiscord | <Patitotective> :] |
03:42:01 | FromDiscord | <Patitotective> beef, have you made strutils recyclable? |
03:48:38 | FromDiscord | <Elegantbeef> No been working on implementing `toOpenArray` on the VM |
03:50:30 | FromDiscord | <Elegantbeef> If you want to help me and make a PR to recyclable so I can later PR it into the stdlib, that'd be grand, basically have to forward all calls to a procedure that takes `openArray[char]` like i have done for the parseutils PR i have open |
04:00:11 | FromDiscord | <Patitotective> In reply to @Elegantbeef "If you want to": you're copying the std modules from v1.6.8 or devel? |
04:00:21 | FromDiscord | <Patitotective> are they even different |
04:03:10 | FromDiscord | <Elegantbeef> devel since i'll be PRing them there |
04:03:36 | FromDiscord | <Elegantbeef> There shouldnt be any major differences, but it's just good practise to grab from there |
04:05:21 | FromDiscord | <Elegantbeef> The way i did unicode was bad I realise now. You want to have `openarray[char]` as a possible overload so someone can do `converter toString(s: MyType): string = string(s)` for distincts |
04:06:55 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4dDk |
04:07:25 | FromDiscord | <Patitotective> oh okay :] |
04:07:27 | FromDiscord | <Elegantbeef> I'll be axing recyclable after so yea the `rtl` and `extern` procedures names are fine |
04:08:17 | FromDiscord | <Elegantbeef> Actually it might be best to just get this setup in a PR to Nim itself |
04:08:27 | FromDiscord | <Elegantbeef> Since there is code in `strimpl` that needs to be changed |
04:08:47 | FromDiscord | <Elegantbeef> It then can be merged after my VM change is merged |
04:09:28 | FromDiscord | <Elegantbeef> Yes this does mean your new changes will be waiting on 2.0 |
04:09:41 | FromDiscord | <Patitotective> also where should i keep the documentation comments? both or just the string overload? |
04:09:54 | FromDiscord | <Elegantbeef> In parse utils i kept them on both |
04:10:08 | FromDiscord | <Patitotective> In reply to @Elegantbeef "*Yes this does mean": like everyone changes 😁 |
04:10:44 | FromDiscord | <Elegantbeef> I suppose you could modify strimpl and strutils and copy it to your project and import that if the version is not 2 |
04:11:06 | FromDiscord | <Elegantbeef> But the stdlib depending on the language version is a pain |
04:11:30 | FromDiscord | <Patitotective> i actually just needed splitlines (yes, for the inefficient nice errors) |
04:11:47 | FromDiscord | <Elegantbeef> Then yea it's likely the least awful to copy that implementation |
04:12:15 | FromDiscord | <Elegantbeef> This is the type of things i hope to eliminate with my changes to the string using files |
04:12:33 | FromDiscord | <Patitotective> In reply to @Elegantbeef "In parse utils i": you sure you pushed it? i cloned recyclable and i dont see any overloads in parseutils↵just the openarray version |
04:12:51 | FromDiscord | <Elegantbeef> I didnt do any work on it on that repo |
04:13:15 | FromDiscord | <Elegantbeef> That repo is pretty much dead now, i was going to keep the files there but i realised some modules require compiler support(parseutils specifically) |
04:13:37 | FromDiscord | <Elegantbeef> Like I had to add functionality to the NimVm to be able to make parseutils use `openarray[char]` |
04:14:04 | FromDiscord | <Elegantbeef> I guess strutils and other modules wont need compiler support so it could be fine there |
04:14:31 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/blob/743ff2898feb99cfceef5bf3ca5723b307923426/lib/pure/parseutils.nim but yea i'm sure i have overloads 😄 |
04:14:33 | * | fanta1 joined #nim |
04:21:40 | FromDiscord | <Patitotective> damn strutils is huge↵i guess ill continue tomorrow |
04:21:42 | FromDiscord | <Patitotective> 🌃 |
04:22:29 | FromDiscord | <Elegantbeef> Buh bye |
04:22:47 | FromDiscord | <Elegantbeef> Converting is relatively simple, but it's a bit of a pain. Having to reason what should be allowed where |
05:33:46 | * | hochata quit (Ping timeout: 272 seconds) |
06:11:55 | * | rockcavera quit (Remote host closed the connection) |
06:16:20 | * | PMunch joined #nim |
06:22:05 | * | kenran` joined #nim |
06:37:48 | FromDiscord | <Bung> how to give a var type argument default value ? |
06:38:22 | FromDiscord | <Elegantbeef> `default(typeof(myVar))`? |
06:38:49 | FromDiscord | <Bung> let me try |
07:59:25 | PMunch | Damn it, my protobuf library only supports protobuf3, but now I want to read protobuf2 files from openstreetmap |
07:59:59 | PMunch | I looked at nim-protobuf-serialization, it supports protobuf2, but only if you write your own definition |
08:00:26 | PMunch | Figured I'd have a look at their implementation of protobuf3 parsing to expand it. Turns out they're just using my parsing :P |
08:16:07 | FromDiscord | <Horizon [She/Her]> Oop |
08:17:07 | FromDiscord | <Elegantbeef> Nah we do procedural here |
08:26:36 | FromDiscord | <chul_jing> sent a long message, see http://ix.io/4cn1 |
08:34:18 | PMunch | I wonder if that crypto spam stuff has any return on investment |
08:34:28 | PMunch | I can't imagine anyone actually clicking on those |
08:34:48 | PMunch | I mean Matrix isn't exactly where your grandma hangs out |
08:38:04 | FromDiscord | <baalajimaestro> 😂😂 |
08:40:54 | FromDiscord | <Elegantbeef> Yea it's confusing |
08:41:00 | FromDiscord | <Elegantbeef> Especially in a programming matrix |
08:41:04 | FromDiscord | <Elegantbeef> It's like the worst target |
08:41:20 | FromDiscord | <Elegantbeef> You have a subset of a subset |
08:48:24 | PMunch | Maybe we should write and distribute our own spamming tool |
08:48:34 | PMunch | Which won't allow you to spam #nim channels :P |
08:48:47 | PMunch | Just fight the spammers with market share |
08:49:37 | FromDiscord | <Elegantbeef> I still dont think it's a bot, but alas |
08:49:56 | FromDiscord | <ChocolettePalette> Speaking of spamming tools. Is it possible that HttpClient has some kind of timeout between requests? Like, not allowing you to send another one if the delay was too long |
08:50:26 | FromDiscord | <Elegantbeef> There is a `timeout` parameter for `newHttpClient` |
08:50:37 | FromDiscord | <Elegantbeef> But that's for waiting X amount of time before giving up afaik |
08:51:22 | FromDiscord | <Elegantbeef> So i guess the answer is 'yes', but you use exceptions to handle that |
08:55:02 | FromDiscord | <ChocolettePalette> Ahhh, okay, thank you then |
09:00:11 | FromDiscord | <Elegantbeef> I just realised the dumbest part about this matrix spam is that they use the matrix homeserver |
09:01:11 | PMunch | Why does that make it particularily dumb? |
09:02:44 | FromDiscord | <Elegantbeef> Cause that means they have to use a captcha and manually register these accounts |
09:03:00 | FromDiscord | <Elegantbeef> If they hosted their own homeserver they could automate that all |
09:03:28 | FromDiscord | <Elegantbeef> Oh shit i'm giving the bad guys ideas |
09:08:37 | FromDiscord | <ChocolettePalette> This server would simply get avoided in no time |
09:08:48 | FromDiscord | <Elegantbeef> Sure but domains are cheap 😛 |
09:09:19 | FromDiscord | <Elegantbeef> If this was a successful scam, one would imagine it'd be worthwhile |
09:14:49 | Amun-Ra | hmm, there was a way of including C code directly into Nim source but I cannot find it… |
09:17:29 | Amun-Ra | but I might be wrong |
09:18:43 | FromDiscord | <Elegantbeef> `{.emit:"""void function(){}""".}` |
09:18:57 | FromDiscord | <Elegantbeef> Or do you mean pmunch's futhark? |
09:19:06 | * | fanta1 quit (Quit: fanta1) |
09:19:33 | * | fanta1 joined #nim |
09:21:13 | Amun-Ra | right, emit, thanks |
09:31:22 | * | jmdaemon quit (Ping timeout: 260 seconds) |
09:36:41 | * | fanta1 quit (Quit: fanta1) |
09:44:11 | * | wallabra quit (Ping timeout: 260 seconds) |
09:44:38 | * | wallabra joined #nim |
10:04:27 | * | xet7 joined #nim |
10:17:46 | arkanoid | For a 100% nim project, is there any difference in using nim cpp instead of nim c? |
10:19:45 | PMunch | There used to be a small speed benefit for certain scenarios |
10:19:56 | PMunch | But nowadays I don't think they're that different |
10:22:11 | FromDiscord | <Takemichi Hanagaki> In reply to @arkanoid "For a 100% nim": Supports to external libs too.↵So, if you want to use Qt, for instance, that is written in Cpp, you must to use Cpp to it. |
10:22:54 | PMunch | I think that's why they specified 100% Nim |
10:31:27 | arkanoid | Exactly. I mean 100% nim without importX anything |
10:31:36 | arkanoid | Thanks PMunch |
10:33:04 | arkanoid | So if I use nim c I can use importc only, but if I use nim cpp I can use both importc and importcpp? |
10:33:52 | arkanoid | I mean, I know that sqlite official wrapper works for both, so I bet it works like this |
10:34:24 | FromDiscord | <Horizon [She/Her]> In reply to @arkanoid "So if I use": Yeah, since `C++` compilers can compile most `C` code |
10:34:51 | FromDiscord | <Horizon [She/Her]> @Arkanoid |
10:35:08 | FromDiscord | <Horizon [She/Her]> Crap didn't mean to ping the user sorry |
10:35:25 | FromDiscord | <Horizon [She/Her]> Was trying to ping the IRC user (hoping the bot translates pings) |
10:37:36 | arkanoid | Np |
10:49:13 | PMunch | Why is swapping endianess so cumbersome in Nim |
10:51:41 | FromDiscord | <exelotl> @Horizon [She/Her] on IRC you don't need @, you just say their name to ping them |
10:57:00 | * | PMunch quit (Quit: Leaving) |
10:57:12 | * | PMunch joined #nim |
11:00:04 | FromDiscord | <Horizon [She/Her]> Ah alright |
11:05:36 | FromDiscord | <ChocolettePalette> It is kinda strange doe\: for some reason my HttpClient throws an httpError if I wait 65 seconds before making another request, but if I make requests more often, it works perfectly... Even setting timeout to 90 seconds didn't work |
11:06:46 | FromDiscord | <ChocolettePalette> It might be server closing the connection though... |
11:11:32 | FromDiscord | <auxym> In reply to @PMunch "Why is swapping endianess": https://nim-lang.org/docs/endians.html ? But you might also be interested in https://justine.lol/endian.html |
11:12:43 | FromDiscord | <auxym> Why are people so concerned with endianness lately though? Last I checked there's almost nothing running big-endian, except IBM mainframes and maybe some MIPS router chips |
11:14:20 | FromDiscord | <auxym> (but I also made sure to make https://github.com/auxym/nim-tinyusb endian portable, for some reason) |
11:18:39 | PMunch | @auxym, well I'm reading a file format, and the size is for some reason written in the oposite order than what readInt from streams uses |
11:18:56 | PMunch | Whether that's Nims streams modules fault, or the formats fault I don't really care |
11:19:01 | PMunch | But I had to switch the endianess |
11:19:27 | PMunch | And swapEndian from the endians module requires pointers, I just want to slap a `.swapEndian` at the end of my read statement |
11:21:05 | FromDiscord | <auxym> oh, yeah. makes sense. I wasn't aware of the endians module until someone (beef) pointed it out recently, so I just implemented something like the read/write macros in the blog post I linked, except in Nim. Should be pretty straightforward with a stream, too, reading or writing one byte at a time. |
11:25:49 | FromDiscord | <ChocolettePalette> Nvm this, found an issue on github |
11:33:50 | PMunch | Ugh, why wasn't my byte streams merged.. |
11:34:03 | PMunch | It feels so dirty to cast a seq[uint8] to a string stream.. |
11:49:03 | * | disso_peach quit (Remote host closed the connection) |
11:55:16 | * | fanta1 joined #nim |
12:01:21 | NimEventer | New thread by ingo: Pegs?, see https://forum.nim-lang.org/t/9536 |
12:11:15 | PMunch | Hmm, is there a way to expand the `.` macros? |
12:16:36 | PMunch | Hmm, is there a way for a template to avoid side-effects apart from `let cacheX = x` at the start? |
12:35:00 | * | arkurious joined #nim |
12:47:49 | Amun-Ra | can I make a template that acts like this cxx macro? https://pastebin.com/ydebumc1 |
12:48:23 | PMunch | Nope |
12:48:44 | PMunch | If I understand what that does correctly |
12:49:21 | Amun-Ra | it inserts two array values with one call |
12:49:39 | PMunch | Ah yes, that's not possible in the way you're doing that |
12:49:56 | Amun-Ra | { 0, FOO(3) } becomes {0, 1, 3} |
12:50:04 | Amun-Ra | I guess macro would be overkill, thanks |
12:50:14 | Amun-Ra | (overkill in my example) |
12:51:35 | PMunch | It still wouldn't be possible with a macro |
12:52:03 | PMunch | [0, foo(3)] can't add a comma |
12:52:23 | Amun-Ra | oh |
13:00:38 | FromDiscord | <Goel> So after using `s.del(2)` and deleting the string at index 2 of a SeqString, i noticed the original order of Seq elements is not mantained. So for now i have to call `sort(s)` everytime i modify it. Is there any other more optimized proc in the Std that does this automatically or with better performance? |
13:04:19 | FromDiscord | <planetis> delete |
13:15:37 | FromDiscord | <sOkam!> What's the simplest UI that one could possibly make with Nim?↵I know there are no really good answers for gui frameworks, but...↵what's something that can work, even if suboptimal or too simple? |
13:18:03 | FromDiscord | <ChocolettePalette> gtk2 is pretty simple and straightforward if you know gtk2 |
13:18:28 | FromDiscord | <ChocolettePalette> (But it's a binding) |
13:18:54 | FromDiscord | <sOkam!> I would have to learn whatever framework, also idm if its a binding. Just something that I can create in not too much time |
13:19:24 | PMunch | imlib2 is dumb, but pretty simple |
13:19:33 | PMunch | I've already made the bindings |
13:19:41 | PMunch | It's what I used for notifishower |
13:20:12 | * | derpydoo joined #nim |
13:20:36 | PMunch | Depending on how simple you want it you might get away with calling out to Zenity as well |
13:22:03 | PMunch | sOkam, ^ |
13:23:41 | FromDiscord | <sOkam!> In reply to @PMunch "Depending on how simple": needs to be cross-platform though 😔 |
13:24:00 | PMunch | Zenity is cross platform |
13:25:11 | PMunch | Maybe NiGui would be enough https://github.com/simonkrauter/NiGui |
13:26:11 | PMunch | Or Nimx: https://github.com/yglukhov/nimx |
13:27:38 | PMunch | You could also try the GenUI macro for WxWidgets: https://github.com/PMunch/wxnim#the-genui-macro |
13:28:01 | Amun-Ra | gtk3, gtk2 is eol |
13:30:46 | FromDiscord | <auxym> btw, on the topic of gui, is there a reason we don't have bindings to tk? It's pure C so in theory should be pretty easy, and tk is a pretty straightforward way to make simple and lightweight guis |
13:35:34 | FromDiscord | <sOkam!> In reply to @PMunch "You could also try": tysm. will look into those |
13:35:54 | FromDiscord | <sOkam!> just for completion, are there bindings for gtk3? |
13:36:14 | FromDiscord | <auxym> gintro I think? |
13:36:34 | FromDiscord | <demotomohiro> https://github.com/StefanSalewski/gintro |
13:36:51 | FromDiscord | <sOkam!> kk tyty ✍️ |
13:36:55 | FromDiscord | <demotomohiro> !repo gintro |
13:38:32 | PMunch | @auxym, maybe try it with Futhark? |
13:41:58 | FromDiscord | <auxym> yeah, probably will, some day (haha). Was just wondering if it had been tried and there was some sort of blocker |
13:51:05 | FromDiscord | <axyz> sent a code paste, see https://play.nim-lang.org/#ix=4dFr |
13:58:56 | FromDiscord | <huantian> I think there may be a way to do it but I’ve not found it personally |
13:59:48 | FromDiscord | <huantian> I do wish nimsuggest could be aware of which one you’re using too |
14:01:36 | FromDiscord | <axyz> yeah, I'd say suggestions would be a really good nice to have, but mostly I think this should fail to compile, otherwise would be really easy to possibly create bugs that would go unnoticed until runtime. Or maybe there are more idiomatic approaches to type safety that I am missing completely here |
14:02:32 | FromDiscord | <huantian> I think there’s a compile flag that makes you make sure it’s the right kind |
14:02:49 | FromDiscord | <huantian> But I do agree it would be better if it was always statically ensured |
14:03:21 | * | PMunch quit (Quit: Leaving) |
14:13:38 | FromDiscord | <Andycol> When using `.writefile` how can i use a variable within |
14:13:39 | FromDiscord | <Andycol> example |
14:13:58 | FromDiscord | <Andycol> sent a code paste, see https://play.nim-lang.org/#ix=4dFA |
14:15:28 | FromDiscord | <demotomohiro> https://nim-lang.org/docs/strformat.html |
14:16:12 | FromDiscord | <demotomohiro> !eval import strformat; let line = 12345; echo fmt"abcd {line} efgh" |
14:16:19 | NimBot | Compile failed: abcd 12345 efgh |
14:21:19 | FromDiscord | <Andycol> confused |
14:23:52 | FromDiscord | <auxym> nimbot was hacked 😛 |
14:23:58 | FromDiscord | <ShalokShalom> In reply to @sOkam! "What's the simplest UI": KDialog https://develop.kde.org/deploy/kdialog/ |
14:24:22 | FromDiscord | <Andycol> sent a code paste, see https://play.nim-lang.org/#ix=4dFB |
14:24:46 | FromDiscord | <ShalokShalom> In reply to @sOkam! "just for completion, are": Avoid GTK, if you want to keep your sanity. Particularly for cross platform stuff |
14:25:16 | FromDiscord | <sOkam!> In reply to @ShalokShalom "Avoid GTK, if you": why so? what's bad about it? |
14:25:40 | FromDiscord | <sOkam!> so far, as a user, i always tend to gravitate towards gtk. But might be missing something from the dev side of it |
14:26:24 | FromDiscord | <ShalokShalom> https://youtu.be/ON0A1dsQOV0 |
14:28:20 | FromDiscord | <ShalokShalom> Its not made for cross platform, its own devs dont know how things work, and the chief head of Linux at Intel has problems coding with it. |
14:29:10 | FromDiscord | <sOkam!> ic. will watch for sure ✍️ |
14:29:43 | FromDiscord | <ShalokShalom> sent a long message, see http://ix.io/4dFD |
14:36:17 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4dFF |
14:36:41 | FromDiscord | <Andycol> can you show me an example @demotomohiro |
14:37:22 | FromDiscord | <demotomohiro> In reply to @Andycol "can you show me": There are sample codes in https://nim-lang.org/docs/strformat.html |
14:37:28 | FromDiscord | <Andycol> thanks! |
14:42:13 | FromDiscord | <Andycol> sent a code paste, see https://play.nim-lang.org/#ix=4dFH |
14:42:41 | qwr | gtk isn't too bad if you want to create bindings from another language, especially for dynamically typed languages |
14:43:08 | qwr | but non-unix platforms are basically second-tier and the "native" C api is torture to use manually |
14:44:31 | * | qwr is actually amazed how many GTK applications have been written in C, but maybe the authors simply love C and didn't have much choice there |
14:47:55 | NimEventer | New thread by axyz: Compile time safety for case object fields, see https://forum.nim-lang.org/t/9537 |
14:48:49 | qwr | as user on linux, many of the packaged qt applications tend to integrate with KDE, taking huge amount of dependencies, which is annoying if you don't use KDE - and therefore GTK applications are often more standalone |
14:54:16 | * | rez joined #nim |
15:16:25 | FromDiscord | <Andycol> In reply to @demotomohiro "You can put variable": seems to just ignore and write the variable as is with fmt etc |
15:17:27 | FromDiscord | <ShalokShalom> In reply to @qwr "is actually amazed how": There is also a lot of fanboyism, since gtk is basically the first open source GUI toolkit |
15:18:22 | FromDiscord | <demotomohiro> In reply to @Andycol "seems to just ignore": Did you import strformat? |
15:18:24 | FromDiscord | <ShalokShalom> In reply to @qwr "as user on linux,": That's not much longer true anymore. Qt5 and KDE Frameworks 5 did a lot on that front. ↵↵Also, why wouldn't you use Qt/KDE on the desktop 😛 |
15:18:36 | FromDiscord | <Andycol> In reply to @demotomohiro "Did you import strformat?": Yea i did |
15:18:49 | FromDiscord | <Andycol> In reply to @demotomohiro "Did you import strformat?": Do you mind if i pm you? |
15:19:23 | FromDiscord | <demotomohiro> In reply to @Andycol "Do you mind if": Ok but why dont you ask question here? |
15:19:39 | FromDiscord | <Andycol> I can if you prefer here, i dont mind |
15:20:52 | FromDiscord | <Andycol> sent a code paste, see https://play.nim-lang.org/#ix=4dG1 |
15:21:21 | * | fallback quit (Ping timeout: 260 seconds) |
15:22:16 | FromDiscord | <demotomohiro> Did you add that code inside `"""` string literal? you need to add fmt to `"""`. |
15:23:24 | FromDiscord | <demotomohiro> `fmt` and `&` in strformat module are macro and template and you cannot call them directly inside string literal. |
15:23:45 | FromDiscord | <Andycol> sent a code paste, see https://play.nim-lang.org/#ix=4dG2 |
15:25:02 | FromDiscord | <demotomohiro> You need to write `"/etc/clickhouse-server/config.d/custom.xml".writefile(fmt"""<yandex>...`. |
15:26:49 | FromDiscord | <Andycol> sent a code paste, see https://play.nim-lang.org/#ix=4dG5 |
15:28:20 | FromDiscord | <demotomohiro> yes |
15:28:49 | FromDiscord | <Andycol> that does the trick!!! |
15:28:54 | FromDiscord | <Andycol> thank you |
15:28:55 | FromDiscord | <demotomohiro> You don't need `\n` after `{clusterid}`. |
15:29:01 | FromDiscord | <Andycol> yea i see that |
15:29:14 | FromDiscord | <Andycol> id buy you a beer if i could, thank you! |
15:29:28 | FromDiscord | <demotomohiro> np |
15:34:24 | * | kenran` quit (Remote host closed the connection) |
15:40:07 | * | fallback joined #nim |
15:41:25 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4dGa |
15:41:33 | FromDiscord | <sOkam!> (edit) |
15:42:00 | FromDiscord | <sOkam!> (edit) "https://play.nim-lang.org/#ix=4dGa" => "https://play.nim-lang.org/#ix=4dGb" |
15:43:18 | FromDiscord | <sOkam!> I'm guessing `re` module will be the obvious, but is there something else to help with parsing? |
15:48:40 | FromDiscord | <qb> https://nim-lang.org/docs/strscans.html |
15:50:54 | FromDiscord | <sOkam!> In reply to @qb "https://nim-lang.org/docs/strscans.html": actually invaluable. lol. tysm! |
16:08:32 | * | rez quit (Quit: much snoozes...) |
16:19:21 | * | Goodbye_Vincent quit (Quit: Ping timeout (120 seconds)) |
16:20:42 | * | al1ranger joined #nim |
16:21:30 | * | al1ranger quit (Client Quit) |
16:24:27 | * | rez joined #nim |
16:26:41 | * | rockcavera joined #nim |
16:26:42 | * | rockcavera quit (Changing host) |
16:26:42 | * | rockcavera joined #nim |
16:28:56 | * | Goodbye_Vincent joined #nim |
16:32:58 | FromDiscord | <Tanguy> sent a code paste, see https://play.nim-lang.org/#ix=4dGz |
16:38:15 | FromDiscord | <Tanguy> Looks like I had a weird `bin/nim` version, deleted it and using `./koch boot` from the `version-1-6` branch fixed it |
16:51:56 | FromDiscord | <Bung> it happens when I switch to 1.4 |
17:10:39 | NimEventer | New post on r/nim by angel__--__: Getting Nim running with an LSP in Vim?, see https://reddit.com/r/nim/comments/y93x4x/getting_nim_running_with_an_lsp_in_vim/ |
17:18:29 | NimEventer | New thread by EnteryName: Template untyped and typed as parameters and return type, see https://forum.nim-lang.org/t/9538 |
17:21:34 | * | rez quit (Quit: much snoozes...) |
17:36:35 | * | rez joined #nim |
17:41:26 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4dGY |
17:43:51 | FromDiscord | <sOkam!> Position 6 seems to be the first `$f` right after `skip spaces ( skip spaces` 🤔↵But the error makes no sense, since vmath.Vec3 does store its components as float32 |
17:45:35 | FromDiscord | <sOkam!> Can `parseFloat` only return `float`, instead of `float32`? |
17:46:26 | * | xet7 quit (Quit: Leaving) |
17:48:53 | FromDiscord | <auxym> convert it after? `str.parseFloat.float32` |
17:49:03 | FromDiscord | <sOkam!> In reply to @auxym "convert it after? `str.parseFloat.float32`": I don' |
17:49:12 | FromDiscord | <sOkam!> I don't own the parsefloat call, its part of the macro |
17:49:27 | FromDiscord | <sOkam!> (edit) "don'" => "don't own the parsefloat call, its part of the macro" |
17:54:32 | * | disso_peach joined #nim |
17:56:16 | FromDiscord | <leorize> time to make the macro float32-aware ig? \:p |
17:56:17 | FromDiscord | <leorize> similar problem with int\<size\> I assume |
17:56:56 | FromDiscord | <sOkam!> I have not confirmed that to be the issue. I was just asking if that's somestuff that could possibly happen |
17:58:07 | FromDiscord | <sOkam!> In reply to @leorize "time to make the": I don't own the macro. It is part of the implied functionality from `strscans.scanf()` |
17:58:46 | FromDiscord | <sOkam!> (edit) "`strscans.scanf()`" => "`std.strscans.scanf()`" |
17:58:51 | FromDiscord | <leorize> I meant putting it in a PR or so \:p |
17:59:05 | FromDiscord | <sOkam!> I don't even know if the problem is that |
17:59:08 | FromDiscord | <leorize> you can fork the macro too, it's only in that one file |
18:01:34 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4dH8 |
18:10:38 | FromDiscord | <leorize> if you want a workaround, scanf supports custom parser |
18:13:22 | FromDiscord | <Kiloneie> Any good that work well with Nim spell checker extensions for VS Code ?↵googling suspicious words i have trouble with takes too much time |
18:14:36 | * | rez quit (Quit: l8r) |
18:25:25 | * | kenran joined #nim |
18:35:31 | FromDiscord | <sOkam!> Is there a way to define a seq that has between 4-6 items in it, and fails if its not in that range? |
18:46:19 | * | m33mt33n joined #nim |
18:47:56 | m33mt33n | can someone help? |
18:48:02 | m33mt33n | type SumType* = int or float or string |
18:48:08 | m33mt33n | var Env: Table[string, SumType] # compile time error |
18:54:01 | * | m33mt33n quit (Remote host closed the connection) |
18:59:33 | FromDiscord | <planetis> you can't do that, it's not a concrete type |
18:59:56 | FromDiscord | <planetis> you could use std/json or rethink your code |
19:16:40 | * | fanta1 quit (Quit: fanta1) |
19:18:41 | * | kenran quit (Remote host closed the connection) |
19:19:00 | FromDiscord | <kevin> Are there any SocketIO client implementations in Nim out there? |
19:19:13 | FromDiscord | <kevin> quick google search doesn't show anything 🤷 |
19:25:20 | FromDiscord | <leorize> shameless plug\: https\://github.com/alaviss/union↵(<@709044657232936960_m33mt33n=5b=49=52=43=5d>) |
19:27:56 | FromDiscord | <sOkam!> How do you declare an `std.tables.Table` type inside a custom object type?↵Or is there a better way to store key:value pairs inside a custom type instead? |
19:32:07 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4dHz |
19:32:31 | FromDiscord | <sOkam!> (edit) "https://play.nim-lang.org/#ix=4dHz" => "https://play.nim-lang.org/#ix=4dHA" |
19:50:03 | FromDiscord | <leorize> you need the generic parameters |
19:50:45 | FromDiscord | <Bubblie> how do I use split in nim |
19:50:48 | FromDiscord | <Bubblie> for strings |
19:50:49 | FromDiscord | <leorize> either Entity needs `[K, V]` or add a specified one to Table |
19:51:26 | FromDiscord | <leorize> !eval import strutils; echo "a,b,c".split(',') |
19:51:34 | NimBot | Compile failed: @["a", "b", "c"] |
19:51:59 | FromDiscord | <leorize> lolwut |
19:52:01 | FromDiscord | <Bubblie> yeah |
19:52:08 | FromDiscord | <Bubblie> i have no idea why thats not working |
19:52:09 | FromDiscord | <Bubblie> 😭 |
19:52:21 | FromDiscord | <leorize> it's working, just playground being weird |
19:52:29 | FromDiscord | <Bubblie> weird |
19:52:55 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=4dHB |
19:53:21 | FromDiscord | <leorize> oh it put out a `seq[string]`, not string |
19:53:30 | FromDiscord | <Bubblie> OH |
19:53:31 | FromDiscord | <Bubblie> got it |
20:01:31 | FromDiscord | <sOkam!> yeah, ty leorize. Solved it by randomnly trying to add the types with `Table[string, string]`, and it happened to work 🤷♂️ |
20:02:08 | FromDiscord | <Bubblie> can I add multiple return values to a procedure? |
20:03:47 | FromDiscord | <sOkam!> you can return a tuple, afaik |
20:05:03 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4dHG |
20:07:33 | FromDiscord | <Bubblie> thats really cool |
20:07:39 | FromDiscord | <Bubblie> how do I make a proper nim object btw? |
20:07:58 | FromDiscord | <Bubblie> and like assign it to a var |
20:08:16 | FromDiscord | <Bubblie> so var timeObj = TimeObject(num, timeType) |
20:11:04 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=4dHH |
20:11:10 | FromDiscord | <Bubblie> TimeType is an enum |
20:11:48 | FromDiscord | <sOkam!> that looks alright. is it throwing any errors? |
20:12:30 | FromDiscord | <Bubblie> says it has no type and is ambiguous |
20:14:44 | FromDiscord | <sOkam!> what exactly? can you share the code that errors? |
20:15:36 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix= |
20:16:55 | FromDiscord | <leorize> when initializing an object, you have to specify the fields manually |
20:17:24 | FromDiscord | <leorize> so `TimeObject(num: n, timeType: typ)` |
20:19:01 | FromDiscord | <Bubblie> It says undeclared identifier |
20:33:07 | FromDiscord | <Bubblie> OH WAIT |
20:33:09 | FromDiscord | <Bubblie> I UNDERSTAND |
20:33:13 | FromDiscord | <Bubblie> sorry 😭 |
21:02:49 | * | jmdaemon joined #nim |
21:05:14 | FromDiscord | <Bubblie> how can I take a DateTime variable and use sleep() so it executes only after it meets a specific amount of time |
21:25:20 | arkanoid | I have an object made of a lot of floats that represents let's say feets. I want to create twin object with same attributes but they represent meters. I need just to multiply each attribute. What's the nim idiomatic way to achieve this? |
21:25:33 | arkanoid | *feet |
21:27:06 | FromDiscord | <Bubblie> In reply to @Bubblie "how can I take": ah yeah I was wondering fi I could take an integer and then convert it to different times |
21:27:40 | FromDiscord | <Elegantbeef> Use generics?↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>) |
21:33:00 | FromDiscord | <Kiloneie> Is there a way to convert an object to another object(child to child) without a cast ? |
21:33:34 | FromDiscord | <Elegantbeef> `MyTypeB(myValue)` assuming it's a proper tree |
21:34:37 | * | derpydoo quit (Quit: derpydoo) |
21:35:18 | FromDiscord | <Kiloneie> i did this |
21:35:19 | FromDiscord | <Kiloneie> sent a code paste, see https://play.nim-lang.org/#ix=4dI1 |
21:35:37 | FromDiscord | <Elegantbeef> Of course not, that's an unsafe conversion |
21:35:56 | FromDiscord | <Kiloneie> wdym ? |
21:36:08 | FromDiscord | <Elegantbeef> You can only convert up/down branches not across branches |
21:36:39 | FromDiscord | <Kiloneie> wait so, child to parent, parent to child, but not child to child ? |
21:37:07 | FromDiscord | <Elegantbeef> Yes |
21:38:14 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4dI3 |
21:39:20 | FromDiscord | <Kiloneie> was just trying to see if conversion was possible without cast |
21:41:48 | FromDiscord | <Elegantbeef> Type conversions are only allowed up/down the tree if the type information is the same |
21:42:08 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4dI5 |
21:42:25 | FromDiscord | <Elegantbeef> Converting from spider to outlaw is going to give you an incorrect string |
21:43:23 | FromDiscord | <Kiloneie> i get that |
21:44:08 | FromDiscord | <Kiloneie> though i must be doing something else wrong, i can't do the parent to child and reverse conversion.↵Can you give an example ? |
21:45:48 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4dI7 |
21:45:52 | FromDiscord | <Elegantbeef> You can only convert to a type if the type information is correct |
21:46:02 | arkanoid | Found an answer https://nim-lang.org/docs/iterators.html#fieldPairs.i%2CT |
21:46:07 | FromDiscord | <Elegantbeef> So you can only go up a branch and back down if you're converting to a type that is valid |
21:51:35 | FromDiscord | <Mike> Hey anybody know of a way to do `readLine(stdin)` asynchronously? |
21:52:02 | FromDiscord | <Mike> I know there's an `openFileAsync`, but I can't figure out a way to hook that up to stdin, if that even makes sense |
22:02:06 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4dI9 |
22:05:09 | FromDiscord | <Mike> damn, that looks like what I wanted but yeah it blocks \:/ |
22:06:18 | FromDiscord | <Kiloneie> Man that took way longer to understand than it should of, starving for 2-3 hours... |
22:07:03 | FromDiscord | <Kiloneie> Really wanted to finish what i am doing tonight, but it doesn't look like it will, time estimated 30-60 minutes, 3 hours later, still not done xD... |
22:07:44 | FromDiscord | <Mike> @Kiloneie\: if you actually are trying to model a game like in your example, I highly recommend looking into entity component systems |
22:07:56 | FromDiscord | <Mike> More or less what elegantbeef was suggesting |
22:08:08 | FromDiscord | <Elegantbeef> ECS is vastly different to what i suggested |
22:08:20 | FromDiscord | <Kiloneie> object variants is where i am at atm |
22:08:36 | FromDiscord | <Kiloneie> i did read some on components but i forgot just about everything |
22:08:46 | FromDiscord | <Mike> Well, it's bigger. But the composition aspect is the same |
22:09:04 | FromDiscord | <Elegantbeef> Yea composition is just better |
22:09:26 | FromDiscord | <Kiloneie> do you have a good link for that ? someone had a good one once... |
22:09:57 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4dIa |
22:10:22 | FromDiscord | <Mike> It's been a long time since I've worked on something like that, so I can't recommend anything beyond what I'd fine with google, same as you↵(@Kiloneie) |
22:13:51 | FromDiscord | <Elegantbeef> https://github.com/rlipsc/polymorph if you want ECS in Nim |
22:14:22 | FromDiscord | <Mike> Hey that's cool |
22:14:22 | FromDiscord | <Mike> Didn't know that existed |
22:14:41 | FromDiscord | <Patitotective> In reply to @sOkam! "Is there a simple": this would work for a single block https://nim-lang.org/docs/parseutils.html#captureBetween%2Cstring%2Cchar%2Cchar%2Cint↵dont think theres a way to split into multiple blocks |
22:14:49 | FromDiscord | <Elegantbeef> I personally dont really use ECS cause i find it complicates my games |
22:15:54 | FromDiscord | <sOkam!> In reply to @Patitotective "this would work for": nice one. problem is each block can contain subblocks 😔 |
22:16:08 | FromDiscord | <Elegantbeef> You then need to implement a basic parser |
22:16:43 | FromDiscord | <sOkam!> kk. i can do that, i just thought that there might already be something similar in the libs, since there is so much cool and handy stuff |
22:17:30 | FromDiscord | <Bubblie> so is there any nim libraries that allow me to specify a duration of time and will execute code after it meets that duration of time |
22:17:38 | FromDiscord | <Bubblie> or is there any examples of this in general |
22:17:52 | FromDiscord | <Elegantbeef> Something like a cronjob is probably more sensible |
22:18:05 | FromDiscord | <huantian> or a systend timer |
22:18:14 | FromDiscord | <huantian> 😛 |
22:18:19 | FromDiscord | <Elegantbeef> lol |
22:18:30 | FromDiscord | <Bubblie> https://github.com/soasme/nim-schedules I found this |
22:18:39 | FromDiscord | <Elegantbeef> See i'm such a bad linux user i dont really care about what i have running there |
22:18:58 | FromDiscord | <Bubblie> im really just trying to add remind functionality to my dimscord bot |
22:19:01 | FromDiscord | <Elegantbeef> That type of stuff is generally better to let your OS handle |
22:19:57 | FromDiscord | <huantian> In reply to @Bubblie "im really just trying": hm maybe you can do something with the async event loop |
22:20:17 | FromDiscord | <huantian> but I mean you can use a while loop and `asyncSleep` |
22:20:36 | FromDiscord | <huantian> (edit) "`asyncSleep`" => "`sleepAsync`" |
22:20:50 | FromDiscord | <Mike> This is probably not what you had in mind, but you could use [remind](https://www.linux.com/news/manage-your-time-remind/) |
22:21:03 | FromDiscord | <Mike> Like you'd write stuff to a file and then periodically run remind to see what needs doing |
22:21:33 | FromDiscord | <Elegantbeef> Oh shit i'm surprised md'd links transfer to discord through the bridge |
22:22:17 | FromDiscord | <Elegantbeef> this means discord supports markdown links... TIL 😄 |
22:22:26 | FromDiscord | <Mike> Yeah Element and Discord usually play nice with markdown, surprisingly |
22:22:33 | FromDiscord | <huantian> yep they support it in embeds too, since like the beginning |
22:22:38 | FromDiscord | <huantian> they just dont' let users use it |
22:23:07 | FromDiscord | <Bubblie> is it possible to just make it not repeat |
22:23:58 | FromDiscord | <huantian> what's wrong with just `sleep`ing ? |
22:24:08 | FromDiscord | <Patitotective> for object fields, there is no advantage from using `openArray[char]` over `string` , right? it would still need to get copied |
22:25:15 | FromDiscord | <Bubblie> In reply to @huantian "what's wrong with just": if there are too many reminders and I use sleep everytime wouldn't that be an issue |
22:25:50 | FromDiscord | <Bubblie> also nim's sleep function takes it in milliseconds right |
22:26:08 | FromDiscord | <Bubblie> how would I take any integer and auto convert to milliseconds, should I just do math myself or does nim have a small function for that |
22:26:20 | FromDiscord | <huantian> what is your integer |
22:26:31 | FromDiscord | <huantian> you just multiply it by 1000 if it's in seconds |
22:26:36 | FromDiscord | <huantian> to make it miliseconds lmao |
22:26:39 | FromDiscord | <Bubblie> well yeah |
22:26:43 | FromDiscord | <Bubblie> but what if I took 1 day |
22:26:47 | FromDiscord | <Bubblie> as an inout |
22:26:55 | FromDiscord | <Bubblie> should I just convert 1 day to milliseconds too through a calculation |
22:27:12 | FromDiscord | <Patitotective> yea... |
22:27:18 | FromDiscord | <Bubblie> alright |
22:27:39 | FromDiscord | <Bubblie> would sleep cause issues though if there are many reminders |
22:27:43 | FromDiscord | <huantian> you can also just use the miliseconds property of `TimeInterval`if you've parsed your time |
22:28:14 | FromDiscord | <huantian> or `Duration` |
22:28:17 | FromDiscord | <Patitotective> you could use `times.Duration` and just call `inMilliseconds` https://nim-lang.org/docs/times.html#inMilliseconds%2CDuration |
22:28:25 | FromDiscord | <AmjadHD> In reply to @Mike "damn, that looks like": Are you on windows ? |
22:28:37 | FromDiscord | <Mike> nah I'm on linux↵(@AmjadHD) |
22:29:28 | FromDiscord | <huantian> In reply to @Bubblie "would sleep cause issues": it shouldn't |
22:30:06 | FromDiscord | <huantian> I haven't tested it or anything tho |
22:35:17 | FromDiscord | <ShalokShalom> In reply to @Kiloneie "Really wanted to finish": Sounds like normal programming 😅 |
22:36:24 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "Yea composition is just": You mean 'composition' is a valid alternative to ECS? |
22:36:36 | FromDiscord | <ShalokShalom> It seems, that ECS is much more complex |
22:36:45 | FromDiscord | <ShalokShalom> So you dont think it's worth it |
22:39:29 | FromDiscord | <sOkam!> Errr... is there not a way to readLine from a string buffer, instead of from a file? 🤔 |
22:40:47 | FromDiscord | <Elegantbeef> ECS is composition based |
22:40:54 | FromDiscord | <Elegantbeef> You can do composition many different ways |
22:41:08 | FromDiscord | <Elegantbeef> My games usually have simple mechanics so i hard code logic and composition doesnt help |
22:41:27 | FromDiscord | <Elegantbeef> Like my present game is a 2D puzzle game with very basic mechanics i do not really benefit much from composition |
22:41:43 | * | wallabra_ joined #nim |
22:42:24 | FromDiscord | <Mike> Yeah ECS takes a lot of effort to implement, but it manages the complexity of a game really well. So it's just a matter of how complex your game is going to be to determine if that tradeoff is worth it |
22:42:35 | FromDiscord | <Elegantbeef> Yep it makes it much easier to add logic/features |
22:42:47 | FromDiscord | <Elegantbeef> But given my game scope is really small it doesnt benefit me much |
22:43:05 | FromDiscord | <Patitotective> actually beef, wouldnt streams make my kdl parser much more usable? though the data is stored a string https://nim-lang.org/docs/streams.html#StringStreamObj |
22:43:09 | FromDiscord | <Elegantbeef> It also reduces complexity of many things cause you just add systems + components and it works |
22:43:32 | FromDiscord | <Elegantbeef> that's why you dont use `StringStream` pat you use `Stream` |
22:43:37 | * | wallabra quit (Ping timeout: 246 seconds) |
22:43:38 | * | wallabra_ is now known as wallabra |
22:43:45 | FromDiscord | <Elegantbeef> That way you can stream the data as you need it from a file and are not limited by system memory |
22:43:56 | FromDiscord | <ShalokShalom> In reply to @Mike "Yeah ECS takes a": You know Godot? |
22:44:08 | FromDiscord | <ShalokShalom> It has an ECS system called Godex |
22:44:11 | FromDiscord | <Elegantbeef> Anyway dog walk time |
22:44:26 | FromDiscord | <Elegantbeef> Godot uses EC by default to achieve composition |
22:44:32 | FromDiscord | <ShalokShalom> Greet them from me 😄 |
22:44:33 | FromDiscord | <Patitotective> In reply to @Elegantbeef "that's why you dont": 🧠 |
22:44:38 | FromDiscord | <huantian> Beefs owner is finally being responsible and walking him |
22:44:48 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "Godot uses EC by": Ahm, no? |
22:45:18 | FromDiscord | <ShalokShalom> Their devs are actually quite outspoken on how such data driven approaches are against their vision |
22:45:24 | FromDiscord | <ShalokShalom> There is even a blog post |
22:45:35 | FromDiscord | <Elegantbeef> EC not ECS |
22:45:39 | FromDiscord | <Elegantbeef> Please read before commenting |
22:45:40 | FromDiscord | <Elegantbeef> Thank you |
22:46:16 | FromDiscord | <Kiloneie> In reply to @ShalokShalom "It has an ECS": You mean the Node system ? |
22:47:02 | FromDiscord | <ShalokShalom> https://godotengine.org/article/why-isnt-godot-ecs-based-game-engine |
22:47:09 | FromDiscord | <ShalokShalom> In reply to @Kiloneie "You mean the Node": No |
22:47:50 | FromDiscord | <ShalokShalom> Third party |
22:47:53 | FromDiscord | <ShalokShalom> https://godotengine.org/article/why-isnt-godot-ecs-based-game-engine |
22:48:28 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "EC not ECS": Fair. What is EC? 😄 |
22:49:10 | FromDiscord | <ShalokShalom> In reply to @huantian "Beefs owner is finally": Yeah, thought this as well 😅 |
22:50:53 | FromDiscord | <Patitotective> huh, i have to find a way to keep parser's nice errors without having to copy the stream (since `Lexer`'s stream is copied to `Parser`) |
22:57:52 | FromDiscord | <sOkam!> how do you access the last element of a seq?↵cant find anything mentioning it 😔 |
22:58:17 | FromDiscord | <sOkam!> can I just do `[-1]`? |
22:59:52 | FromDiscord | <Mike> I think it's `[^1]` |
23:04:20 | FromDiscord | <Patitotective> In reply to @sOkam! "how do you access": its called backwardsindex |
23:04:22 | FromDiscord | <Patitotective> (edit) "backwardsindex" => "backwards index" |
23:09:11 | FromDiscord | <ShalokShalom> What's the best parser ljbrary in Nim? |
23:18:27 | FromDiscord | <Patitotective> In reply to @ShalokShalom "What's the best parser": > _best_↵i recommend npeg, though i prefer writing my own parser |
23:19:58 | FromDiscord | <Elegantbeef> Npeg if you want something easy, parseutils if you want something more granular |
23:20:31 | FromDiscord | <Elegantbeef> EC is how Godot/Unreal do it you can extend an entity(Node in godot, actor in Unreal) and then add sub entities to that entity↵(@ShalokShalom) |
23:20:47 | FromDiscord | <Elegantbeef> It's also somewhat what Unity does, but Unity doesnt allow you to extend all base entities(GOs are sealed) |
23:20:58 | FromDiscord | <Elegantbeef> You use OOP to achieve composition instead of DOD |
23:21:09 | FromDiscord | <Elegantbeef> It's easier to write and reason, but slower due to pointer indirection |
23:22:36 | FromDiscord | <Patitotective> In reply to @Patitotective "huh, i have to": ill have to prioritize allocations over nice-looking-and-attractive-errors |
23:23:50 | FromDiscord | <Patitotective> (edit) "In reply to @Patitotective "huh, i have to": ill have to prioritize allocations over nice-looking-and-attractive-errors ... " added "💀 💀" |
23:23:59 | FromDiscord | <Elegantbeef> Eh you can take ownership of the stream |
23:24:08 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "EC is how Godot/Unreal": Ah. But ain't they gonna do that object orientied? |
23:24:19 | FromDiscord | <ShalokShalom> (edit) "orientied?" => "oriented?" |
23:24:26 | FromDiscord | <Elegantbeef> `sink Stream` |
23:24:26 | FromDiscord | <Elegantbeef> What? |
23:24:41 | FromDiscord | <ShalokShalom> Godot and Unreal |
23:24:49 | FromDiscord | <ShalokShalom> Abstract nodes and actors |
23:24:52 | FromDiscord | <Patitotective> In reply to @Elegantbeef "Eh you can take": take who? how do i do that |
23:25:07 | FromDiscord | <ShalokShalom> Is this composition based? |
23:25:10 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4dIl |
23:25:24 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4dIm |
23:25:27 | FromDiscord | <Elegantbeef> `proc parseKdl(stream: sink Stream): KDL` |
23:25:47 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "You use OOP to": DOD? |
23:25:59 | FromDiscord | <Elegantbeef> `sink` is Nim's move semantic for "give up ownership of resources" |
23:25:59 | FromDiscord | <Elegantbeef> Data oriented design |
23:26:01 | FromDiscord | <Elegantbeef> ECS is data oriented |
23:26:07 | FromDiscord | <ShalokShalom> Ah |
23:26:11 | FromDiscord | <Elegantbeef> It doesn use pointers much and does not use a complex inheritance tree |
23:26:14 | FromDiscord | <ShalokShalom> And EC? |
23:26:18 | FromDiscord | <ShalokShalom> In Godot |
23:26:26 | FromDiscord | <ShalokShalom> Is it OO? |
23:26:34 | FromDiscord | <ShalokShalom> Since that's, how I remind it. |
23:26:35 | FromDiscord | <Patitotective> In reply to @sOkam! "?? how is this": why do you do `id :type` instead of `id: type`↵who are you trying to make cry |
23:26:50 | FromDiscord | <Elegantbeef> Entity Component. In Godot you have a root Object Node and inherit/modify it as you go |
23:26:54 | FromDiscord | <Elegantbeef> So you get an inheritance tree |
23:26:56 | FromDiscord | <sOkam!> In reply to @Patitotective "why do you do": nobody, because i code for myself 🤷♂️ |
23:26:57 | FromDiscord | <ShalokShalom> Yes |
23:27:07 | FromDiscord | <ShalokShalom> This is how I had it in my mind. |
23:27:07 | FromDiscord | <Elegantbeef> But they still use composition and avoid direct reference using signals |
23:27:15 | FromDiscord | <ShalokShalom> Hnn |
23:27:19 | FromDiscord | <ShalokShalom> So both |
23:27:38 | FromDiscord | <ShalokShalom> Signals are involved in Nodes as well? |
23:27:38 | FromDiscord | <Elegantbeef> Unity for instance has you directly referencing components which creates funky logic |
23:27:41 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4dIn |
23:27:51 | FromDiscord | <ShalokShalom> Unity is ... |
23:27:56 | FromDiscord | <ShalokShalom> Not interesting. |
23:28:06 | FromDiscord | <Patitotective> In reply to @Elegantbeef "`sink` is Nim's move": ooooh nice :] |
23:28:08 | FromDiscord | <Elegantbeef> Well Signals are how godot communicates between nodes, it uses them to create disconnects between Nodes so you can just drop in replacements |
23:28:18 | FromDiscord | <Elegantbeef> So it's a much more composable API |
23:28:19 | FromDiscord | <ShalokShalom> There is a talk soon about Nim in Unreal |
23:28:33 | FromDiscord | <Elegantbeef> It means you're indexing outside the sequence↵(@sOkam!) |
23:28:40 | FromDiscord | <ShalokShalom> Considering UnrealCLR is broken at the moment, very interesting |
23:28:49 | FromDiscord | <ShalokShalom> No F# on 5 yet |
23:28:52 | FromDiscord | <sOkam!> In reply to @Elegantbeef "It means you're indexing": how is index 0 out of the sequence? |
23:29:00 | FromDiscord | <Elegantbeef> Sequences are default empty |
23:29:07 | FromDiscord | <Elegantbeef> So 0 is out of the sequence |
23:29:08 | FromDiscord | <sOkam!> oh |
23:29:19 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "Well Signals are how": Your a great help, always |
23:29:34 | FromDiscord | <ShalokShalom> Your dogs get probably a lot of professional walking as well |
23:29:37 | FromDiscord | <ShalokShalom> 😅 |
23:32:34 | FromDiscord | <sOkam!> How do you store something at position 0 of an already initialized empty sequence? |
23:32:53 | FromDiscord | <Elegantbeef> `mySeq.add myValue` |
23:37:26 | FromDiscord | <ShalokShalom> @Elegantbeef#0000 Do you work for Nim? |
23:37:31 | FromDiscord | <ShalokShalom> I mean, do you get paid |
23:37:33 | FromDiscord | <Elegantbeef> I dont work for anything |
23:37:42 | FromDiscord | <ShalokShalom> Good idea |
23:37:51 | FromDiscord | <ShalokShalom> You should get paid anyway |
23:37:55 | FromDiscord | <ShalokShalom> Just saying. |
23:38:18 | FromDiscord | <Elegantbeef> Well petition someone to do such |
23:44:21 | FromDiscord | <Patitotective> beef is a full-time dog walker |
23:46:21 | FromDiscord | <SirOlaf> Beef I saw you in my pr, this is the file I'm mainly testing with for now if you're curious. Everything in there that isn't commented kinda works https://media.discordapp.net/attachments/371759389889003532/1032801983188439040/a.nim |
23:47:43 | FromDiscord | <SirOlaf> The whole void var construct is probably the most useless thing |
23:51:10 | FromDiscord | <Elegantbeef> Full time hobbyist dog walker↵(@Patitotective) |