<< 12-03-2021 >>

00:00:24FromDiscord<nikki> o yeah for sure
00:00:38FromDiscord<nikki> i keep all my shaders gles compat so that it can run in webgl (even webgl 1.0 yay safari) and mobile etc.
00:00:47FromDiscord<nikki> run into a tonnnn of "no implicit conversion lol" errors
00:44:57*couven92 quit (Ping timeout: 264 seconds)
00:47:57*grobe0ba quit (Quit: ZNC 1.7.5 - https://znc.in)
00:48:08*grobe0ba joined #nim
00:59:01*fputs joined #nim
01:01:48*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
01:02:13*njoseph joined #nim
01:16:18*snippy-nippy joined #nim
01:18:02*snippy-nippy quit (Client Quit)
01:45:58FromDiscord<Anonymous Poet> In reply to @ElegantBeef "<@!747239904181747854> doesnt this work?": sorry, had to hop off earlier than expected yesterday. The crux of the issue is that im wondering if its possible to write a generic map/flatMap for either the way it exists for option
01:46:44FromDiscord<ElegantBeef> Well with the variant you cannot get the other value, so you really just have an option
01:47:02FromDiscord<Anonymous Poet> right, so it works fine for a single call
01:47:05FromDiscord<Anonymous Poet> but not for chaining
01:48:06FromDiscord<ElegantBeef> Yea i'm a bit uncertain on what mapping an either is supposed to do
01:48:26FromDiscord<ElegantBeef> pass each value through a procedure and mutate left/right?
01:49:00FromDiscord<Anonymous Poet> the motivation for this is if i wanted to build something like rust's `Result`
01:49:35FromDiscord<ElegantBeef> Isnt Rust's `Result` just an `option[T]` and a `msg: string`?
01:50:05FromDiscord<Anonymous Poet> it's an `Either[T]<string, T>` (string is the error)
01:50:20FromDiscord<ElegantBeef> Ah ok now i see why the variant
01:50:41FromDiscord<ElegantBeef> I thought the point of the either was to actually have the abillity to change what the "value" was
01:50:50FromDiscord<Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix=2SvC
01:51:07FromDiscord<Anonymous Poet> ah, yeah, sorry, i shouldve explained the motivation first
01:51:33FromDiscord<Anonymous Poet> i guess, actually looking at this, i dont need either
01:51:43FromDiscord<Anonymous Poet> really, i just need an implementation of map for either like option
01:53:17FromDiscord<Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix=2SvE
01:54:41FromDiscord<ElegantBeef> Yea
01:55:07FromDiscord<ElegantBeef> The only difference between them is that the result has a string if it's none
01:55:13FromDiscord<Anonymous Poet> yeah, exactly
01:55:56FromDiscord<ElegantBeef> So we're good now? 😄
01:56:05FromDiscord<Anonymous Poet> yes, haha, thanks for listening 😄
01:56:14FromDiscord<Anonymous Poet> though i wonder if theres any reason to have a generic map for either like i had initially wanted
01:56:37FromDiscord<ElegantBeef> And now to rain on your parade https://github.com/arnetheduck/nim-result
01:56:43FromDiscord<Anonymous Poet> like if you needed a more complex error type rather than string, and for whatever reason needed to modify it?
01:57:12FromDiscord<ElegantBeef> Possibly?
01:57:46FromDiscord<Anonymous Poet> no rain whatsoever, ty for sharing
01:58:30FromDiscord<ElegantBeef> You could make it require being inherited from an error, then you could provide the same level of error information as the normal paths of errors using the catachable error method 😛
01:58:46FromDiscord<Anonymous Poet> hmm, thats a good idea!
01:59:13FromDiscord<Anonymous Poet> im just thinking about how id implement a CRUD-like app in Nim, and what might be nice for that
01:59:35FromDiscord<ElegantBeef> I dont know if it's a good idea, i just know they exist, and might provide more information than just a string for figuring out what to do next
02:00:13FromDiscord<ElegantBeef> Ah no clue what CRUD is but do know what crud software is (hint it's mine)
02:00:18FromDiscord<Anonymous Poet> hehe
02:00:25FromDiscord<Anonymous Poet> CRUD = "Create Read Update Delete"
02:00:44FromDiscord<Anonymous Poet> basically what 99% of apps today are
02:01:34*blackpawn joined #nim
02:02:27FromDiscord<ElegantBeef> Ah so crud
02:04:41FromDiscord<Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix=2SvH
02:05:15FromDiscord<Anonymous Poet> and then end users can build off `ErrorObj` and implement error handlers as they wish
02:06:08FromDiscord<ElegantBeef> Well my library doesnt handle that nor is really "polished" 😄
02:06:16FromDiscord<Anonymous Poet> one day!
02:06:29FromDiscord<ElegantBeef> Like atm i cause a compiler internal error
02:06:51FromDiscord<Anonymous Poet> cause a compiler error if the user does something bad? or just in general? :p
02:07:05FromDiscord<ElegantBeef> No it's an internal error due to my macro
02:07:10FromDiscord<Anonymous Poet> ah :/
02:07:29FromDiscord<ElegantBeef> `Error: internal error: environment misses: g`
02:07:42FromDiscord<Anonymous Poet> 🤷‍♂️
02:07:51FromDiscord<ElegantBeef> The best part is i'm uncertain how to minify it so my filed issue is the most useless thing 😄
02:08:25FromDiscord<Anonymous Poet> sometimes i find it helpful to just restart from scratch, and incorporate learnings from the prototype
02:08:33FromDiscord<ElegantBeef> I mean it works
02:08:40FromDiscord<ElegantBeef> It's not a fuckup on my end
02:09:08FromDiscord<ElegantBeef> https://github.com/nim-lang/Nim/issues/17285 if you want to have a read 😛
02:09:41FromDiscord<ElegantBeef> Hmm i wonder has yardanico removed the sending of the triangle brackets on urls <https://github.com/nim-lang/Nim/issues/17285>
02:09:54FromDiscord<ElegantBeef> Nope still sends em 😦
02:10:45*lritter quit (Ping timeout: 264 seconds)
02:10:46FromDiscord<Anonymous Poet> i think the comment that you got on that pr is trying to say that the identifier in the second function is actually declared/defined/in the scope of the first function
02:11:12*lritter joined #nim
02:11:52FromDiscord<ElegantBeef> Except they're identifiers and the repr is fine https://play.nim-lang.org/#ix=2SvI
02:12:41FromDiscord<ElegantBeef> Identifiers are not looked up, so i still dont follow their implication
02:12:58FromDiscord<Anonymous Poet> oh, hmm, idk then
02:13:08FromDiscord<Anonymous Poet> i havent dug into nim's ast yet
02:13:45FromDiscord<ElegantBeef> Yea i'm 100% uncertain what's causing the internal error, and i know no one wants to go through 100 lines of macro to find the culprit 😛
02:14:38FromDiscord<Anonymous Poet> i wonder if having longer names might be helpful?
02:15:18FromDiscord<Anonymous Poet> also, pattern matching would probably make it much more readable .. sadly only in fusion
02:15:35FromDiscord<ElegantBeef> I'm using devel features already
02:15:45FromDiscord<ElegantBeef> `Error: internal error: environment misses: longerg` 😛
02:20:19FromDiscord<Anonymous Poet> i really dont know then :/
02:28:24*abm quit (Read error: Connection reset by peer)
02:45:07*rockcavera quit (Remote host closed the connection)
03:13:50*D_ quit (Ping timeout: 264 seconds)
03:16:44*D_ joined #nim
03:40:54PrestigeIf parsing a json node that could be a string or null, how should I define it as a type to convert it with `to`? I wonder if it would resolve to an empty string
03:41:49leorizeOption[T] should do I guess?
03:42:10FromDiscord<Rika> yes i can confirm that
03:42:15PrestigeI thought that's only when it could be a missing property
03:43:43Prestigeoh yep it's just an empty string. Awesome
03:59:31*D_ quit (Remote host closed the connection)
04:16:16*spiderstew_ joined #nim
04:18:33*spiderstew quit (Ping timeout: 264 seconds)
04:21:57*D_ joined #nim
04:39:38*D_ quit (Ping timeout: 264 seconds)
04:41:09FromDiscord<ShadowElf37> https://play.nim-lang.org/#ix=2Sw5
04:41:17FromDiscord<ShadowElf37> 4th iterator doesnt compile 🤔
04:42:06FromDiscord<ShadowElf37> discrepancy between index and backwardsindex
04:45:40FromDiscord<InventorMatt> https://play.nim-lang.org/#ix=2Sw6
04:46:03FromDiscord<InventorMatt> I think you forgot to deference the array
04:46:22FromDiscord<ElegantBeef> Any reason using a var reference?
04:46:27FromDiscord<ElegantBeef> (edit) "Any reason ... using" added "not"
04:46:36FromDiscord<ShadowElf37> in `iterup_2` i dont have to dereference it for some reason
04:46:39FromDiscord<ShadowElf37> nor do i at the top
04:46:41FromDiscord<ShadowElf37> with the echos
04:46:48FromDiscord<ShadowElf37> its only in `iterdown_2`
04:51:49FromDiscord<ShadowElf37> In reply to @ElegantBeef "Any reason not using": i have ref arrays and i dont think they work with var
04:51:53FromDiscord<ShadowElf37> or i cant get them to play nice
04:52:17FromDiscord<ElegantBeef> Well you dont need var for refs
04:52:23FromDiscord<ShadowElf37> right
04:52:54FromDiscord<ElegantBeef> I was just uncertain why you were using a ref, so was mentioning that procs that take a `var array` is a mutable reference
04:54:46*a_chou joined #nim
04:54:58*a_chou quit (Remote host closed the connection)
06:15:43*narimiran_ joined #nim
06:34:23FromDiscord<Snippy Nippy> How can I handle keyboard interrupts and safely stop instead of just crashing ? I am using dimscord to make a bot so I think there might be something related to async also
06:35:46FromDiscord<ElegantBeef> https://nim-lang.org/docs/system.html#setControlCHook%2Cproc%29
06:36:00FromDiscord<ElegantBeef> And also `exitprocs`
06:37:38FromDiscord<Snippy Nippy> Can you show any examples too. I am new to nim 😅
06:37:53FromDiscord<ElegantBeef> I can try my async is a little eh
06:38:20FromDiscord<Araq> today @Clyybber created history
06:38:23FromDiscord<Araq> https://github.com/nim-lang/Nim/pull/17342
06:38:25FromDiscord<Snippy Nippy> ty
06:38:35FromDiscord<ElegantBeef> I had seen was cool to see 😄
06:49:38FromDiscord<lepot311> is it possible to have a sequence of types?
06:50:14FromDiscord<Araq> yes but when you ask that, you are usually on the completely wrong track
06:51:34FromDiscord<lepot311> fair enough. Let's say I have an Animal type and a Food type, and Apple and Banana are of Food, and I want to initialize an Animal with a sequence of foods it can eat [Apple, Banana]
06:52:07*waleee-cl quit (Quit: Connection closed for inactivity)
06:52:07FromDiscord<ElegantBeef> Do you food types have any other data on them?
06:52:26FromDiscord<lepot311> yes maybe each has a `nutrition` int or something
06:52:30FromDiscord<ElegantBeef> @Snippy Nippy yea my async is too meh, no clue how to not stop the async logic from destructing to allow exiting gracefully
06:53:36FromDiscord<lepot311> I'm from python where I'd usually pass around classes and I'm trying to wrap my head around how I'd accomplish something like my example in nim
06:53:58FromDiscord<Araq> `type Food = enum Apple, Banana`
06:54:15FromDiscord<Araq> `proc initAnimal(eats: set[Food])`
06:54:21FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2SwH
06:54:25FromDiscord<Araq> model values as values, not as types
06:54:34FromDiscord<Snippy Nippy> Although Araq tried to help me . I am still stuck as my knowledge is about nim is too low https://media.discordapp.net/attachments/371759389889003532/819825681272668160/unknown.png
06:54:46FromDiscord<Snippy Nippy> (edit) removed "is"
06:55:19FromDiscord<lepot311> so object variants is what those are called, right?
06:55:25FromDiscord<ElegantBeef> Nah that's just a set
06:55:37FromDiscord<ElegantBeef> Object variants are when you add fields for specific kinds
06:55:48FromDiscord<lepot311> okay I'll check this out, thanks
06:56:22FromDiscord<ElegantBeef> The only reason i made the Food object is it gives a place to store all the shared fields, it just aswell could be assorted `array[food, int]` for each stat the food can have
06:57:03*johannes joined #nim
06:57:14FromDiscord<ElegantBeef> That is assuming they're globally shared stats
06:57:19*johannes is now known as kenran
06:57:49*kenran quit (Remote host closed the connection)
06:58:13*johannes joined #nim
07:01:34FromDiscord<Araq> `enum` and `set of enum` are features you simply never regret
07:02:53FromDiscord<ElegantBeef> Especially since the ergonomics of them are super nice, not having to `or` the values together just curly braces
07:03:37FromDiscord<Araq> they are your ticket into the world of assurances. You enumerate the possibilities and when you miss a `case`, the compiler tells you
07:10:57FromDiscord<ElegantBeef> @Snippy Nippy Think something like this should work and is what he implied https://play.nim-lang.org/#ix=2SwN
07:13:44FromDiscord<Snippy Nippy> oh yea
07:13:47FromDiscord<Snippy Nippy> it works
07:26:29*greaser|q quit (Changing host)
07:26:29*greaser|q joined #nim
07:26:32*greaser|q is now known as GreaseMonkey
07:31:06*johannes quit (Ping timeout: 246 seconds)
07:34:52FromDiscord<VinKer> Hi, is there any speed difference when compiling code with {.experimental: "codeReordering".} ?
07:38:29FromDiscord<Araq> the compiler is a little bit slower then
07:38:37FromDiscord<Araq> but the produced code is identical
07:42:18*letto quit (Quit: Konversation terminated!)
07:43:01*letto joined #nim
07:43:25FromDiscord<VinKer> @Araq Thank you.
07:53:02*PMunch joined #nim
07:53:13*couven92 joined #nim
08:10:59*drsensor joined #nim
08:13:27*lritter quit (Ping timeout: 246 seconds)
08:20:03*couven92 is now known as fredrikhr
08:22:49PMunchHmm, there aren't any plans to support `for x in 0..10: case x:` where the case statement will only complain if you don't match 0..10?
08:24:56PMunchI mean this works: `for x in 0..10: case range[0..10](x):`
08:25:15FromDiscord<Araq> there are plans for that, yes. Under the "flow typing" umbrella
08:25:31PMunchAh okay, cool
08:26:03PMunchIt would be one of those things that Nim just did better to make you code a bit more safe
08:26:03FromDiscord<Araq> in my spare time I wrote a new SAT solver which should prove useful for that
08:26:50FromDiscord<Araq> I'm looking for proving every array bound at compile-time
08:29:25FromDiscord<mratsim> no Z3?
08:29:42FromDiscord<mratsim> would be nice also to fix nimble dependency resolution.
08:33:18*nim joined #nim
08:33:49*nim quit (Client Quit)
08:45:29*Tlangir quit (Remote host closed the connection)
08:58:08PMunchIn my specific case though it's just a matter of casting the for loop variable to a range when the range is statically known
09:01:32FromDiscord<ElegantBeef> Pmunch you can do it the other way `for x in range[0..5](0)..5:`
09:01:51PMunchWait really? :P
09:02:04FromDiscord<ElegantBeef> Yea
09:02:17FromDiscord<ElegantBeef> Atleast this example works https://play.nim-lang.org/#ix=2Sxl
09:04:42PMunchHmm, is there any adverse side effect to just doing that cast always?
09:05:10FromDiscord<ElegantBeef> Less ugly for loop
09:05:32PMunchI meant doing it implicitly
09:05:37PMunchIn the compiler
09:06:03FromDiscord<ElegantBeef> I dont follow
09:07:38FromDiscord<Araq> @mratsim actually I wrote it for Nimble, but it's generally useful
09:08:57PMunch@ElegantBeef, if the compiler sees that it is iterating over a static range of numbers then it could cast the iterator variable to a range type of the same range
09:11:09FromDiscord<ElegantBeef> Ah that, i dont imagine such, but i'm often wrong 😛
09:13:12FromDiscord<Solitude> sent a code paste, see https://play.nim-lang.org/#ix=2Sxs
09:15:05FromDiscord<Solitude> ah, it breaks default `..`
09:15:22FromDiscord<mratsim> A "blog post" on why bounded channels are important: https://github.com/nim-lang/Nim/pull/17305#issuecomment-797351832
09:15:42FromDiscord<ElegantBeef> How does it break default `..`?
09:15:59FromDiscord<Solitude> no, nope, it isnt, just misleading error message
09:15:59FromDiscord<Rika> prolly arr[0..1] will give a wrong type
09:16:11FromDiscord<Rika> oh wait no iterator
09:16:11FromDiscord<Rika> gm
09:16:14FromDiscord<Rika> dunno then
09:16:34FromDiscord<ElegantBeef> Let's go for the sillier impl https://play.nim-lang.org/#ix=2Sxu
09:17:20FromDiscord<Solitude> but ..< should be range[a..b - 1]
09:17:27FromDiscord<ElegantBeef> ah true
09:17:50FromDiscord<Solitude> this is epic
09:18:13*cornfeedhobo quit (Quit: ZNC - https://znc.in)
09:18:59FromDiscord<ElegantBeef> Now we rip the defaults out of the stdlib and see it implode 😛
09:20:14*cornfeedhobo joined #nim
09:25:17FromDiscord<Rika> speaking of defaults i really wish we could plug `default` so that `var x: ATy` would use `default(ATy)`...
09:25:36FromDiscord<Goel> sent a long message, see http://ix.io/2Sxw
09:25:53FromDiscord<Rika> `nimble install https://github.com/johnnovak/easyWave`
09:25:59FromDiscord<ElegantBeef> It's not in the package registry
09:26:07FromDiscord<Rika> likely forgot to put it there
09:26:13FromDiscord<ElegantBeef> If an author doesnt submit a nimble package you need to use a giturl
09:26:31FromDiscord<Goel> In his official repo page: "Installation↵The best way to install the library is by using nimble:↵↵nimble install easywave"
09:27:00FromDiscord<ElegantBeef> Yea it's not in the registry, i dont care what he says
09:27:02FromDiscord<Goel> But ok it works adding the direct github link
09:27:12FromDiscord<ElegantBeef> Plus an issue already exists for this exact problem
09:29:43FromDiscord<gogolxdong> Is there any library could exchange BTC and ETH?
09:30:30FromDiscord<mratsim> There are Binance bindings in Nim
09:38:55*superbia joined #nim
09:41:04superbiawhat cross platform framework to use for simple gui apps, I need some sliders, some buttons, display some images etc.
09:41:53Clonkk[m]https://github.com/treeform/fidget https://github.com/trustable-code/NiGui
09:44:05PMunchOr WxNim if you want native
09:44:57superbiawill check everything up, thanks !
09:45:57FromGitter<redblack3_gitlab> Hey guys. Is it possible to make an entire type `noinit`? I just figured out that for some reason, `nimZeroMem` breaks a reference counting C++ type that I've `importcpp`d and is a field of a Nim type. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=604b38555d0bfb4e58a3f404]
09:47:23PMunchWait, how did you get data into an object before Nim zeros it?
09:48:13FromDiscord<gogolxdong> https://github.com/facorazza/binance ?
09:48:27FromGitter<redblack3_gitlab> I'm assuming it's initialized with an initial ref count of `1`, then Nim zeros it
09:48:37FromGitter<redblack3_gitlab> `T1_` is
09:51:55*vicfred quit (Quit: Leaving)
09:52:02PMunchYeah but Nim only zeros memory when it is first created (or if you call reset on it). So how does your type end up with data in it?
09:52:16PMunchSome kind of C++ initialiser?
09:52:20FromGitter<redblack3_gitlab> Yes
09:52:37FromDiscord<mratsim> @gogolxdong also https://github.com/inv2004/coinbase-pro-nim
09:53:09FromDiscord<mratsim> though it seems only the read-only API is implemented
09:57:26FromGitter<redblack3_gitlab> So I imagine `RefCntAutoPtr` is something like this (this is the way I've implemented ref counting before): ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ So `RefCntAutoPtr<T> thing;` will have a ref count of 1 at declaration. If Nim zeros that I get memory leaks [https://gitter.im/nim-lang/Nim?at=604b3b06e8267a46f20c3f3e]
10:00:52*ubert joined #nim
10:05:10*ubert quit (Remote host closed the connection)
10:08:42FromDiscord<Araq> @Clyybber your solution for https://github.com/nim-lang/RFCs/issues/19 might be particularly easy to implement...
10:15:36PMunchHmm, iterators are expanded at compile-time right? So is there a way to write an iterator as a macro?
10:15:54FromDiscord<Araq> yes
10:16:01FromDiscord<Araq> via "for loop macros"
10:16:18FromDiscord<Araq> read more about this feature in the manual
10:16:21PMunchHaha, yeah I was just about to say "this is that new for loop macros feature isn't it" :P
10:18:00FromDiscord<ElegantBeef> What are you doing to the poor for now?
10:19:56PMunchKeyboard firmware stuff :P
10:20:21PMunchCrossing super low-level C stuff with high-level macro magic :D
10:23:28PMunchHmm, for loop macros don't work with UCS? This works: http://ix.io/2SxP, this doesn't: http://ix.io/2SxR
10:25:19*Tanger joined #nim
10:28:53FromGitter<timotheecour> For loop macros can support MCS via https://github.com/nim-lang/RFCs/issues/345
10:29:30FromGitter<timotheecour> (i think)
10:30:42*drsensor quit (Quit: Connection closed for inactivity)
10:34:00ForumUpdaterBotNew Nimble package! nimgram - MTProto client written in Nim, see https://github.com/nimgram/nimgram
10:36:03superbiaOne more thing, I'd need a cross platform library to control my cursor and keyboard, if such existed ?
10:41:23PMunchHmm, there is wauto for Windows and xdo for Linux. But no cross platform solution
10:41:37PMunchI guess you could write a small module that wraps those two in a common interface
10:51:14superbiaseems simple enough :)
10:51:18*superbia quit (Quit: WeeChat 3.1)
10:59:57*Mister_Magister_ joined #nim
11:00:32*Mister_Magister quit (Read error: Connection reset by peer)
11:01:01*Mister_Magister_ is now known as Mister_Magister
11:17:53*skelett1 is now known as skelett
11:44:49*Vladar joined #nim
11:46:31ForumUpdaterBotNew post on r/nim by JellyFish_AZ: Templates vs Procs, see https://reddit.com/r/nim/comments/m3fvzz/templates_vs_procs/
12:04:57*haxscramper joined #nim
12:29:54FromGitter<HJarausch_gitlab> In the *Destructors and Move Semantic* doc, there is an example on a custom array ``myseq``. For that there is a destructor as follows: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ The problem is: if the elements ``x[i]`` have *non-object* type - like ``int``, this doesn't compile. So, I have to *disable* this ... [https://gitter.im/nim-lang/Nim?at=604b5ec2d71b6554cd3becdc]
12:33:18*rockcavera joined #nim
12:42:03FromDiscord<Clyybber> @HJarausch No, that's not the issue. destroy on int is just a no-op
12:42:35FromGitter<haxscramper> `when x[i] isnot object` I think
12:42:40FromDiscord<Clyybber> @HJarausch The issue is that it's expecting x[i] to be immutable, but our operator is not defined in such a way that it is
12:42:44FromDiscord<Clyybber> haxscramper: Not needed
12:42:56FromDiscord<Clyybber> simply replace x[i] in the =destroy implementation with x.data[i]
12:43:57FromDiscord<Clyybber> the example is fixed on devel now
12:48:22FromDiscord<Yardanico> I wonder if it might make sense to have something like `tables.getOrDefault` but returning a tuple (bool, value) or just using Option[T] instead. Another way is making `rawGet` public. Just thinking about minor possible optimization to not need two lookups in rare cases when you have a table which might have any values (of the table value type), so you can't use some default value and need to check if the key exists first
12:49:07FromDiscord<Yardanico> I don't know if it's actually worth it (I mean doing one lookup instead of two)
12:50:57FromGitter<HJarausch_gitlab> @Clybber Many thanks. Where the documentation for devel?
12:51:39FromDiscord<Yardanico> http://nim-lang.github.io/Nim/destructors.html
12:52:10FromDiscord<Clyybber> what yardanico sent :D, but it isn't updated yert
12:52:12FromDiscord<Clyybber> (edit) "yert" => "yet"
12:52:29FromDiscord<Clyybber> you can look at https://github.com/nim-lang/Nim/blob/devel/doc/destructors.rst too, thats the most up-to-date
12:53:28FromGitter<HJarausch_gitlab> Thanks, I've seen that it is fixed
12:54:06FromDiscord<carpal> zig
12:54:07FromDiscord<Clyybber> In reply to @Yardanico "I wonder if it": Not sure if that's your usecase, but what I think would be a nice addition is a getOrPut which is a template, so as to lazily evaluate the val arg
12:54:35*vsantana joined #nim
12:54:59FromDiscord<Yardanico> well I don't exactly require it, but consider a Table[string, float] that can be populated by any float values. you can' do getOrDefault with some default value because it might be in the table, so you have to do lookup twice with the current table API
12:55:13FromDiscord<Yardanico> I mean you can do it once, but then you'll need try except :P
12:55:21FromDiscord<Yardanico> to catch KeyError
12:55:49FromDiscord<Clyybber> aah
12:57:20FromDiscord<Yardanico> And I thought of 3 possible solutions: exporting `rawGet`, having some proc which returns a (bool, possible value), or Option[T] (although that'll require one more import for tables, so not really that good)
12:58:02FromDiscord<Clyybber> I think Option[T] is the best approach (rawGet would still have to lookup anyways)
12:58:12FromDiscord<Yardanico> well with rawGet you will only have to do lookups once
12:58:26FromDiscord<Yardanico> ah you're right
12:58:35FromDiscord<Yardanico> since rawGet returns an index which can only be used internally since data is not exposed
12:59:37FromDiscord<Clyybber> I think Option[T] really is the nicest option (heh) here, but the extra import/dependency is eh
13:00:03FromDiscord<Yardanico> we can always go the "a lot of modules way" and have some stdlib module named "tableutils"
13:00:22FromDiscord<Clyybber> yeah
13:01:13FromDiscord<Yardanico> hm, but even then we won't be able to access to the `data` variable from tables 🤔
13:01:26FromDiscord<Yardanico> unless we `include` tables which is quite a bad solution I guess
13:01:30FromDiscord<Clyybber> no, but then theres no reason to anymore?
13:01:37FromDiscord<Clyybber> ah
13:01:39FromDiscord<Clyybber> I see
13:01:48FromDiscord<Yardanico> yeah, there's `tableimpl` but it only has templates
13:01:50FromDiscord<Clyybber> yeah, I think then it should just go into tables.nim
13:02:09FromDiscord<Clyybber> I mean IC is coming :D
13:02:18FromDiscord<Yardanico> hehe
13:02:30FromDiscord<Clyybber> In reply to @Araq "<@!107882072974065664> your solution for": yeah, I think so too
13:02:31FromDiscord<Yardanico> I guess I'll make an RFC for this addition
13:02:35FromDiscord<Clyybber> I might get around to it in a bit
13:03:25FromDiscord<Clyybber> (referring to araq, not your RFC :p)
13:14:20FromDiscord<haxscramper> Compared to the proposal by Araq it would make object definitions harder to analyze, but I guess this is an acceptable tradeoff
13:15:16FromDiscord<haxscramper> Because now I would have to join sets for all `case kind` elements, and keep track of current list of `kind` fields
13:16:24FromDiscord<haxscramper> But regardless what will be implemented I think it is a great news, because it might now come up particularly often, but when it does, it is a major pain to deal with properly
13:23:12*zedeus quit (Ping timeout: 246 seconds)
13:25:11FromDiscord<Yardanico> In reply to @Yardanico "I guess I'll make": https://github.com/nim-lang/RFCs/issues/351 , not sure if it's really worth it since we can catch KeyError, but s
13:25:17FromDiscord<Yardanico> (edit) "s" => "stll"
13:25:20FromDiscord<Yardanico> (edit) "stll" => "still"
13:25:32*D_ joined #nim
13:26:53FromDiscord<haxscramper> `if Some(@val) ?= table.getOpt("key")`
13:27:10FromDiscord<Yardanico> actually we can make a `tableutils` module for this instead
13:27:23FromDiscord<haxscramper> can we just stop creating one-proc modules?
13:27:30FromDiscord<Yardanico> yeah I don't like that either :P
13:30:19FromDiscord<haxscramper> I would probably also suggest `export option`, from tables - https://status-im.github.io/nim-style-guide/03_language.html?highlight=export#import-export, but not sure if this would be accepted
13:30:53FromDiscord<haxscramper> But I hate when some type is used in API, but then I need to figure out what I need to `import` for actually using the result
13:31:04FromDiscord<Yardanico> yeah that can be added as an example in `runnableExamples`
13:31:17FromDiscord<Yardanico> and when someone wants to use getOpt they would probably want `options` in their own code explicitly anyway
13:34:02PMunchI agree that types returned from an API should have an `export` on the module they come from
13:40:00*D_ quit (Ping timeout: 246 seconds)
13:40:51FromGitter<HJarausch_gitlab> The example from *Nim Destructors and Move Semantics* still doesn't work. ⏎ I have just added ⏎ ⏎ ```code paste, see link``` ⏎ ... [https://gitter.im/nim-lang/Nim?at=604b6f63e8267a46f20ccee6]
13:46:56FromDiscord<Clyybber> @HJarausch It's missing an implementation for resize
13:47:16*Vladar quit (Quit: Leaving)
13:55:22FromDiscord<Gary M> sup clyybber
13:56:46FromDiscord<Clyybber> sup
13:57:05FromDiscord<Gary M> I'm using your vulkan bindings again
13:57:20FromDiscord<Gary M> but I wrapped everything in proper dll calls 😛
13:58:05FromDiscord<Gary M> https://media.discordapp.net/attachments/371759389889003532/819932254993252362/unknown.png
13:58:12FromDiscord<Clyybber> ah I see
13:58:29FromDiscord<Gary M> it works perfectly on windows and linux
13:58:44FromDiscord<Clyybber> and just linking via the c compiler didn't?
13:58:54FromDiscord<Gary M> that's not the way to do it
13:58:57FromDiscord<Clyybber> or doing {.link: "somedll/so".}
13:59:00FromDiscord<Gary M> no
13:59:10FromDiscord<Gary M> on windows it kinda works but it has to be a hard path
13:59:20FromDiscord<Gary M> doing it this way searches system paths properly
13:59:30FromDiscord<Gary M> on linux it just hated {.link.}
13:59:57FromDiscord<Gary M> sent a code paste, see https://play.nim-lang.org/#ix=2Szp
14:00:05FromDiscord<Gary M> that's literally all it takes.
14:00:33FromDiscord<Gary M> you already had cdecl and importc on the proc signatures, just needed the dynlib
14:01:27FromDiscord<Clyybber> I mean, I don't want to use dynlib myself, but I see that it's handy and in general the wrapper should be made flexible enough
14:01:37FromDiscord<Clyybber> I think I will wrap the dynlib: vkdll in a custom pragma
14:01:43FromDiscord<Clyybber> so that you can overwrite it
14:02:05FromDiscord<Gary M> while you're at it do you think you could make a proper nimble and add it to the registry? 😄
14:02:21FromDiscord<Clyybber> yeah :D
14:02:29FromDiscord<Gary M> nimble install vs git submodule lol
14:03:31FromDiscord<Clyybber> I'm curious though, why did link not work for you on linux?
14:05:05FromDiscord<Gary M> Couldn't find the library.
14:05:24FromDiscord<Gary M> it's supposed to be in some x86_64 path inside lib
14:05:29FromDiscord<Gary M> but it just didn't want to link
14:05:38FromDiscord<Gary M> proper dynlib pragma and it worked
14:05:48*wasted_youth2 quit (Quit: Leaving)
14:06:02FromDiscord<Gary M> Doing it this way is pretty much guaranteed to work for everyone out of the box with no extra steps
14:06:26FromDiscord<Gary M> except I don't know the exact name for the mac dynlib
14:06:34FromDiscord<Gary M> but mac dev is 🤮
14:07:44FromDiscord<Gary M> right now I'm trying to make a rough approximation of the vkbootstrap builders 😄
14:08:11FromDiscord<Gary M> due to nim's UFCS I don't even need a fancy object
14:08:25FromDiscord<Gary M> just keep returning the type and modifying the field
14:08:44FromDiscord<Clyybber> nice
14:08:50FromDiscord<Clyybber> @HJarausch https://github.com/nim-lang/Nim/pull/17354
14:11:13FromDiscord<Gary M> the thing I don't know how to use is the function pointers
14:11:22FromDiscord<Gary M> pfn_vkWhatever
14:11:44FromDiscord<Gary M> I haven't had to use them, but I see them used in some vk code in the wild
14:11:54FromDiscord<Clyybber> whats the problem?
14:12:01FromDiscord<Gary M> no problem
14:12:07FromDiscord<Clyybber> ah, just cast to them
14:12:09FromDiscord<Clyybber> and then call them
14:13:12FromDiscord<Gary M> sent a code paste, see https://play.nim-lang.org/#ix=2Szv
14:13:35FromDiscord<Gary M> like seeing if the functions are even available on the platform I guess?
14:14:06FromDiscord<Clyybber> it's calling it
14:14:47FromDiscord<Gary M> yeah well, why are they calling it with the pfn version
14:14:56FromDiscord<Clyybber> it's their variable
14:15:01FromDiscord<Clyybber> they must have it defined somewhere
14:15:12*Vladar joined #nim
14:49:07PMunchDamn it, I did the timezone calculation for the Nim online meetup today the wrong way..
14:54:09FromDiscord<Vindaar> Is it planned to have such online meetups more often in the future? I think it sounds great, but I'll probably miss it today ☹️
14:55:12FromDiscord<Yardanico> @Vindaar they're supposed to follow a bi-weekly schedule iirc
14:55:46FromDiscord<Vindaar> Oh that'd be great!
14:56:53PMunchOh cool
14:57:00PMunchDid we get a community manager or something?
14:58:30federico3uh?
14:58:58federico3what meetup?
14:59:12PMunchhttps://forum.nim-lang.org/t/7611
14:59:46federico3err in the middle of working time?
15:00:29PMunchDepends on your time zone I guess :P
15:00:45PMunchFor me it's about an hour after work
15:00:45FromDiscord<Yardanico> @PMunch wasn't Miran our community manager? :P
15:00:55FromDiscord<Rika> TFW 1 AM
15:01:01FromDiscord<Yardanico> @Rika :)
15:01:08FromDiscord<Yardanico> you can't make it for everyone sadly
15:01:09PMunchYeah the Nim community is pretty Euro-centric
15:01:13FromGitter<HJarausch_gitlab> @Clybber MANY THANKS.
15:01:19federico3PMunch: given the location of most of the communty...
15:01:22FromDiscord<Rika> 2 Asian 4 I
15:01:26FromDiscord<Rika> (edit) "I" => "U"
15:02:54FromDiscord<Yardanico> real nimmers wouldn't be scared of a meeting at 1 AM
15:02:58FromDiscord<Yardanico> :nimRawr:
15:03:08federico3other communities do events on saturdays for this reason
15:10:34FromDiscord<dom96> In reply to @federico3 "err in the middle": I asked for later today, but they refused :/
15:10:57FromDiscord<dom96> I’ll try to join nonetheless
15:11:06federico3:(
15:11:16FromDiscord<dom96> But 4pm is a poor time to do these meetings for those of us in the UK
15:11:25FromDiscord<dom96> 5pm is meh for EU too tbh
15:11:36FromDiscord<dom96> I’m often at work at 5pm too
15:12:05federico3very few people have free fridays afternoons
15:12:07FromDiscord<mratsim> What, there is work for Nim developers?
15:13:13*SebastianM joined #nim
15:14:50SebastianMHey guys, could anyone tell me please if i have var name = "Seba" What is the easiest to save that name as jsonfile?
15:14:56SebastianMThank you
15:16:29FromDiscord<haxscramper> Maybe `import std/json; "yourfile".writeFile(%name)`
15:16:48FromDiscord<haxscramper> But I'm not exactly sure that I understood the question correctly
15:17:07*PMunch quit (Quit: leaving)
15:17:37FromDiscord<mario2> To make a lexer in nim all I need to do is assign keywords to various reserved words? That's it?
15:19:04SebastianM@haxscramper its about equivalent to pythons dump your code looks very easy i'll try it later.Thank you very much
15:20:18FromDiscord<haxscramper> In reply to @mario2 "To make a lexer": You want to write lexer for some programming language in nim? They yes, you start with `type TokenTypes = enum ttForKeyword, ttBoolConst, ttColon`, then write code that converts `"if true:"` to sequence of tokens and so on
15:20:32FromDiscord<haxscramper> Not different from any other language for the most part
15:21:05FromDiscord<mario2> I was considering using nim to make the first version of a compiler for a programming language.
15:21:36FromDiscord<mario2> It would in the end spit out assembly code to be given to the assembler.
15:22:16FromDiscord<haxscramper> Yeah, you certainly can do that quite easily. Nim is very good at parsing as well as other parts of compilation pipeline
15:22:35FromDiscord<haxscramper> At least for me, it was really easy to write compiler for my language
15:22:56FromDiscord<mario2> Is the nim source code for your compiler available online?
15:23:13FromDiscord<haxscramper> No, for now it is a private project, but you can see lots of links here https://gist.github.com/haxscramper/3562fa8fee4726d7a30a013a37977df6
15:23:41FromDiscord<haxscramper> And we also have #langdev specifically for discussing language development and related fields
15:23:55FromDiscord<haxscramper> In reply to @haxscramper "No, for now it": private project for no
15:23:57FromDiscord<haxscramper> (edit) "no" => "now"
15:24:32FromDiscord<mario2> I'm right now hand generating the lexer/parser to get a better understanding of how one works rather than rely on flex/bison like tools.
15:27:16FromDiscord<haxscramper> I think most of the parsers are handwritten anyway, and use recursive descent with embedded pratt. If you want to look at example I would recommend https://github.com/liquidev/hayago/blob/master/src/hayago/private/parser.nim
15:27:53SebastianM@haxscramper I've tried your advice but theres only "Seba" in the file. What do do to get {"name": "Seba"} in the file? Thank you
15:28:14*SebastianM quit (Quit: leaving)
15:28:27liblq-devhax stop recommending my old parser 😛
15:28:36liblq-devhttps://github.com/liquidev/tsuki
15:28:40liblq-devthis one is wayyy better
15:28:48FromDiscord<mratsim> It has been archived in Github ice, for all eternity
15:28:50FromDiscord<haxscramper> ah, ok, will keep this in nimd
15:29:05FromDiscord<haxscramper> !eval import std/json; let name = "123"; echo %{"name" : name}
15:29:07NimBotCompile failed: /usercode/in.nim(1, 42) Error: invalid token: (\29)
15:29:24FromDiscord<Solitude> https://nim-lang.org/docs/json.html#creating-json
15:29:34haxscramper!eval import std/json; let name = "123"; echo %*{"name" : name}
15:29:37NimBot{"name":"123"}
15:29:42haxscramperGood
15:29:42*Gustavo6046_ joined #nim
15:30:38*Gustavo6046 quit (Ping timeout: 260 seconds)
15:30:41FromDiscord<haxscramper> Just `"file".writeFile(<what solitude linked>)`
15:31:29*Gustavo6046_ quit (Remote host closed the connection)
15:32:01*Gustavo6046 joined #nim
15:32:33*Torro joined #nim
15:39:38*Gustavo6046 quit (Ping timeout: 264 seconds)
15:39:44haxscramperWhat is the best way to write C++ function that uses `decltype` for return type or any of the arguments? Just using `typeof(<expr>)` as return type does not work. I've come up with this https://play.nim-lang.org/#ix=2SzZ, but hope there is a better approach
15:40:11haxscramperBecause this ^ would break when I have `decltype` arguments
15:46:29Clonkk[m]Maybe I misunderstood what you meant, but I think I'd just use ``untyped`` return value with a template
15:47:10haxscramperI need to wrap C++ code while preserving as much typing as possible in function signature
15:47:35haxscramperAh, yes, the typo. `s/way to write/way to wrap/g`
15:48:00haxscramperI have `template<typename _Container> crend(const _Container& __cont) -> decltype(std::rend(__cont))`
15:48:10haxscramperAnd need to translate this to nim bindings
15:50:19Clonkk[m]Maybe ``emit`` can save you ?
15:50:36Clonkk[m]So you don't actually write Nim code :D
15:51:24haxscramperWell maybe as a last resort. But I'm mostly searching for a way to preserve type relations.
15:51:45haxscramperBecause `emit` breaks type system
15:52:33haxscramper`-> decltype(<expr>)` can be modeled using `auto` **and** `emit`
15:52:57*Torro quit (Quit: bye)
15:53:19*junland quit (Quit: %ZNC Disconnected%)
15:58:14*junland joined #nim
16:01:55FromDiscord<Yardanico> the meeting has already started (kind of), don't forget to join - https://meet.jit.si/NimDevMeet
16:08:46*superbia joined #nim
16:13:14*Gustavo6046 joined #nim
16:17:08*D_ joined #nim
16:21:16*vicfred joined #nim
16:24:37FromDiscord<mario2> When making the lexer scanner, what is the output supposed to be?
16:24:51haxscrampersequence of tokens
16:25:46haxscramperAlso if you are getting into this I would advise to use `#langdev`, becaure more specific questions have a tendency of being washed away by new questions
16:26:56haxscramper`template <typename T> auto test(T arg, decltype(arg + arg) arg2) void { }` < and to extended my previous question: what is the least cursed alternative for wrapping this in nim?
16:27:26haxscramperJust template that errors out `when arg isnot typeof(arg + arg)`?
16:29:22FromDiscord<mratsim> templates returning auto? how is it deduced.
16:32:45*krux02 joined #nim
16:33:14FromDiscord<haxscramper> `-> decltype(expr)` is wrapped as `proc(): auto; var tmp: typeof(expr); result = tmp`
16:33:34FromDiscord<haxscramper> if there is a `decltype` argument, then I do
16:35:00FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=2SAo
16:40:04FromDiscord<haxscramper> God I hope it is the last part of this "beat C++ type system into nim" ride
16:57:20*tiorock joined #nim
16:57:20*rockcavera quit (Killed (tepper.freenode.net (Nickname regained by services)))
16:57:21*tiorock is now known as rockcavera
16:57:21*rockcavera quit (Changing host)
16:57:21*rockcavera joined #nim
16:59:31*tiorock joined #nim
17:02:30*rockcavera quit (Ping timeout: 256 seconds)
17:05:32*tiorock quit (Remote host closed the connection)
17:06:53haxscramperOh, yeah, SFINAE hell
17:08:02saem@Araq I'd be more than happy to read the zen/values and help derive what I think would help myself and others. I'm shy about starting it fresh as I think it's important the content needs to start with you. No pressure, just standing offer.
17:27:26*Vladar quit (Remote host closed the connection)
17:35:14FromDiscord<Gary M> What's everyone working on?
17:37:35FromDiscord<haxscramper> C++ wrapper generator
17:42:50FromDiscord<zetashift> Messing around with godot-nim and OurMachinery, also learning more about graphics programming
17:43:12FromDiscord<zetashift> Also Scala programming, I still love Nim the most!
17:48:55FromDiscord<treeform> In reply to @Gary M "What's everyone working on?": 2d physics engine
17:49:26FromDiscord<Gary M> Oh cool, like box2d/chipmunk?
17:49:57FromDiscord<treeform> exactly, the box2d dude published code for box2d-lite (which was early simpler version of box2d) I am going through the code.
17:50:19FromDiscord<treeform> I ported it all to nim, but there are still things I don't understand. I am trying to reach full understanding.
17:50:50FromDiscord<treeform> And implement most shapes supported by my earlier library called bumpy: https://github.com/treeform/bumpy
17:51:14FromDiscord<Gary M> Nice
17:51:50FromDiscord<Gary M> I was just considering like trying to wrap chipmunk2d whenever I get to that point, if that doesn't turn out the be a nightmare
17:52:14FromDiscord<treeform> Is probably a better option.
17:52:25FromDiscord<Gary M> Also FOSS in C
17:52:30FromDiscord<treeform> I want to reach understanding more so then ship a finally product.
17:52:37FromDiscord<treeform> (edit) "finally" => "final"
17:53:28Mister_Magisteri'm back! How do you convert string into int64?
17:53:30FromDiscord<Gary M> <https://github.com/slembcke/Chipmunk2D>
17:53:43FromDiscord<Yardanico> $
17:53:49FromDiscord<Yardanico> hello Mister_Magister btw
17:53:56FromDiscord<Yardanico> you might remember me as "Benzands" from telegram :P
17:54:03Mister_Magisterdoesn't $ do the opposite
17:54:06FromDiscord<Gary M> I think he means the other way, string > int
17:54:10FromDiscord<Yardanico> ah, sorry
17:54:10Mister_Magisteryeah
17:54:12FromDiscord<Yardanico> parseInt from strutils then
17:54:22FromDiscord<Yardanico> parseBiggestInt
17:54:26Mister_Magisterbut doesn't that convert into int and not
17:54:27Mister_Magistergot it
17:54:59Mister_Magisterthanks!
17:57:57FromDiscord<dom96> That was a fun discussion 🙂
18:00:28*xioren joined #nim
18:00:35Mister_Magister:P
18:05:16giaco_I'm trying to work with nimble build instead of "nim c -r", what's the proper way to add a build option such like "-d:ssl"? Do I have to create a task just for that?
18:05:46FromDiscord<dom96> `nimble c -d:ssl` should work
18:05:58FromDiscord<dom96> but you should put `-d:ssl` in a nim.cfg (or config.nims) file
18:07:15Mister_MagisterI want to load file into variable and have it available globally but i think it isn't gcsafe and nim is complaining…
18:07:32giaco_thanks
18:07:55Mister_Magisteris not GC-safe as it accesses 'variable' which is a global using GC'ed memory
18:08:01FromDiscord<Yardanico> @Mister_Magister it should be just fine as long as you're not using threads
18:08:09Mister_MagisterYardanico: i am
18:10:01Mister_Magisterhow do i fix it with threads
18:10:07FromDiscord<queersorceress> are there any good examples of nim projects that use the js backend (that also uses js package dependencies)? i'm trying to search github and not being all that successful in my search queries.
18:12:11*wasted_youth2 joined #nim
18:12:17FromDiscord<Yardanico> https://forum.nim-lang.org/
18:12:23FromDiscord<Yardanico> here's an example :)
18:12:29FromDiscord<Yardanico> or https://stardust.dev
18:12:39FromDiscord<Hi02Hi> there was a simple Conways Game of Life made for the js backend here (not by me)↵https://doccaico.github.io/playthings/nim/conway-js/
18:13:02Mister_Magisteri got it! i changed let to const
18:13:05Mister_Magisternow its gcsafe
18:13:11FromDiscord<Yardanico> it'll read the file at compile time now though
18:13:23FromDiscord<Yardanico> if that's ok with you then fine :)
18:14:45FromDiscord<Yardanico> @queersorceress https://github.com/pragmagic/karax/
18:14:52*pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
18:14:52FromDiscord<Yardanico> https://github.com/nim-lang/nimforum/tree/master/src/frontend
18:15:01FromDiscord<Yardanico> stardust is not open source but it's nims' js backend
18:15:56*pbb joined #nim
18:16:10FromDiscord<Yardanico> well, parts of it are - e.g. https://github.com/dom96/gamelight
18:18:24FromDiscord<queersorceress> i don't see these using external js dependencies, which is what i'm curious about. i want to do some dom stuff and dynamic page generation but trying to work out how feasible that is to do.
18:18:40FromDiscord<Yardanico> have you seen https://nim-lang.org/docs/jsffi.html ?
18:19:04FromDiscord<Yardanico> https://github.com/andreaferretti/react.nim
18:19:47FromDiscord<Yardanico> and gamelight uses browser APIs so I'm not sure what you consider "external js"
18:20:09FromDiscord<Yardanico> there's no real difference between browser APIs or other JS libraries, you make bindings to them the same way
18:21:31FromDiscord<juan_carlos> Nim does dom stuff
18:21:46FromDiscord<juan_carlos> and dynamic pages
18:22:00FromDiscord<queersorceress> like, nim calling into some js library that's managed by yarn or npm. i guess i am saying "js" but mean "node" here but want to build to create a js file i import into an html page, not to a stand-alone nodejs app, is what i mean.
18:22:13FromDiscord<Yardanico> well, that's the point of the JS backend
18:22:24FromDiscord<Yardanico> its main purpose is for website frontends, not to be used with nodejs
18:23:30FromDiscord<queersorceress> cuz i know i can build it to be a node app, but just want js code to be run in a browser, does that make sense?
18:24:04FromDiscord<Yardanico> I'm not a webdev so I can't reply to that, sorry
18:24:09FromDiscord<Yardanico> but nim just builds to a standalone JS file
18:24:16FromDiscord<Yardanico> you can then use that with whatever tool you want
18:24:24*rockcavera joined #nim
18:25:53FromDiscord<juan_carlos> nim js is for browser
18:25:57FromDiscord<Yardanico> that
18:26:02FromDiscord<Yardanico> 's what I said above :P
18:26:06FromDiscord<queersorceress> yeah, so i think it might be: i am looking for an example project that uses a non-node js library via jsffi, and i am having trouble locating this type of example.
18:26:25FromDiscord<Yardanico> did you check react.nim I linked?
18:26:50FromDiscord<Yardanico> did you check jsffi's example itself? it shows a simple example of using jquery
18:27:13FromDiscord<Yardanico> which is a non-node js library
18:27:17*tane joined #nim
18:27:22FromDiscord<Yardanico> there's a lot of js modules in the stdlib too
18:27:30FromDiscord<Yardanico> and they're all made for the browser, not node
18:27:56FromDiscord<Yardanico> https://nim-lang.org/docs/jsconsole.html
18:27:56FromDiscord<Yardanico> https://nim-lang.org/docs/jscore.html
18:28:10FromDiscord<Yardanico> etc
18:29:25FromDiscord<Yardanico> i'm just not getting your question I guess, sorry :P
18:29:58FromDiscord<Yardanico> I'm just saying that Nim's JS backend is _made_ for the browser frontend, nodejs is a secondary target for it
18:30:09FromDiscord<Yardanico> so almost all code you'll see that uses the nim js backend is made for the browser
18:30:31FromDiscord<queersorceress> i did, but it is not quite it, as it is just a binding, i was looking for it showing how i go about importing and interacting with that code. i'll look but generally i avoid stdlib examples as it tends to use magic that i cannot or doesn't sufficiently explain what it is doing.
18:31:05FromDiscord<queersorceress> right, and i plan to use this in the browser, sorry if that wasn't clear.
18:31:33FromDiscord<juan_carlos> queer, maybe useful https://github.com/nim-lang/Nim/wiki/Nim-for-TypeScript-Programmers#JavaScript-Interoperability
18:31:33FromDiscord<queersorceress> i just don't want and example that depends on an additional runtime
18:31:45FromDiscord<Yardanico> ?????
18:31:54FromDiscord<Yardanico> all examples I linked are for the browser
18:32:13FromDiscord<Yardanico> and js stdlib modules doesn't use magic at all, they use the same things you would use yourself to make JS lib bindings
18:32:13*waleee-cl joined #nim
18:32:31FromDiscord<Yardanico> you can just check - https://github.com/nim-lang/Nim/blob/version-1-4/lib/js/jsconsole.nim
18:32:49FromDiscord<Yardanico> also yeah, for js backend `importcpp` and `importjs` mean the same but it's better to use `importjs` nowadays
18:33:43*leorize quit (Ping timeout: 268 seconds)
18:33:55FromDiscord<dom96> the `dom` module is pretty easy to follow
18:34:01FromDiscord<queersorceress> then i'll take a look at that, my apologies for the confusion. was just trying to explain why i didn't consider doing that first.
18:34:08FromDiscord<dom96> also gamelight's canvas module
18:34:15FromDiscord<dom96> if you want something shorter
18:34:19FromDiscord<dom96> it wraps HTML5 canvas
18:35:14*leorize joined #nim
18:35:47FromDiscord<queersorceress> oh, i totally missed that as i didn't see a .js file along side.
18:42:44FromDiscord<dom96> There is some random stuff in there too, but all in all it's fairly small and simple https://github.com/dom96/gamelight/blob/master/gamelight/canvasjs.nim
18:43:08FromDiscord<dom96> I am hoping to eventually do a write up on Stardust, anybody any thoughts on what I should cover?
18:44:16Prestigedom: I'd be most interested in the networking aspect
18:44:49Mister_MagisterFunction i want to use has many default parameters and i want to only set one of them. Can i achieve it somehow?
18:44:57FromDiscord<queersorceress> speaking of karax, can i use that library to construct a dom then use another web framework to serve up the resulting representation?
18:45:13PrestigeMister_Magister: foo(a = 1)
18:45:19Mister_Magisterthanks
18:46:23FromDiscord<juan_carlos> Yes, karax does not serve anything by itself.
18:47:19FromDiscord<queersorceress> so i could use it as a html templating engine of sorts to and send the result to jester to serve to the client
18:54:42*rockcavera quit (Ping timeout: 256 seconds)
18:56:29FromDiscord<Yardanico> you can use the server rendering of it
18:56:31FromDiscord<dom96> In reply to @Prestige "dom: I'd be most": makes sense, I'll try to focus on that
18:56:38FromDiscord<Yardanico> but maybe you want to use the C backend instead? why JS?
19:00:41haxscramperNo C++20 on playground C++ compiler?
19:02:31ForumUpdaterBotNew thread by Alexeypetrushin: Non-async inside async, how it's executed?, see https://forum.nim-lang.org/t/7616
19:05:39*D_ quit (Remote host closed the connection)
19:22:35Prestige@ElegantBeef with nimscripter, is there a way to have the script invoke code in the running Nim program? Or would you just do something like return a repsonse for the program to interpret, and act accordingly
19:23:19FromDiscord<Yardanico> https://github.com/beef331/nimscripter/blob/master/tests/test.nim
19:23:27FromDiscord<Yardanico> https://github.com/beef331/nimscripter/blob/master/tests/exportedprocs.nim
19:23:50FromDiscord<ElegantBeef> Yep `{.exportToScript.}` is the way to live
19:24:12PrestigeHm maybe I could fiddle with that for my use case
19:24:47FromDiscord<ElegantBeef> You basically have to use procs for all the interaction
19:27:18FromDiscord<ElegantBeef> You can export code verbatim to nimscript using the `exportCode` macro, which is nice for when you want shared type definitions
19:28:09PrestigePlacing a typedef in that block still declares it for the nim program?
19:28:17FromDiscord<ElegantBeef> yea
19:28:21PrestigeNeat
19:28:25Prestigegreat work on this btw
19:28:30FromDiscord<ElegantBeef> Thanks
19:28:57FromDiscord<ElegantBeef> The stdlib i ship on the repo is a very very minimal one, so not all things are supported
19:29:10FromDiscord<ElegantBeef> But you can always add more modules from the nim stdlib manually
19:33:47FromDiscord<Gary M> hi beef
19:33:50FromDiscord<ElegantBeef> Hello
19:34:08FromDiscord<Yardanico> hi meat
19:34:09FromDiscord<Gary M> is there a not implemented pragma or similar
19:34:11FromDiscord<Yardanico> im beef
19:34:19FromDiscord<Yardanico> @Gary M for Nim in general?
19:34:27FromDiscord<Yardanico> you can use `{.error.}`
19:34:50FromDiscord<ElegantBeef> Yep, or a discard stmt, and silently do fuckall
19:34:50FromDiscord<Yardanico> https://nim-lang.org/docs/manual.html#pragmas-error-pragma
19:35:08FromDiscord<Gary M> I'm using discard to prototype the functions 😄
19:35:12FromDiscord<Gary M> error should work
19:35:28FromDiscord<Yardanico> when you try to call them it'll be an error though :)
19:35:30FromDiscord<Yardanico> that's the point
19:35:34FromDiscord<Gary M> I know
19:35:46FromDiscord<ElegantBeef> It'd take all of 3 seconds to make a macro for this
19:35:46FromDiscord<Gary M> There are a few procs I'm not going to fully implement right now probably
19:35:58FromDiscord<Gary M> what kind of macro?
19:36:31FromDiscord<Yardanico> don't worry he just spent too much time in the macroworld
19:36:46FromDiscord<Yardanico> so he has a few days of withdrawal
19:36:49FromDiscord<Gary M> lol
19:39:49FromDiscord<ElegantBeef> Psh
19:39:59FromDiscord<ElegantBeef> If you arent using macros you might as well be using scratch 😛
19:42:06FromDiscord<Gary M> `{.pragma: notimpl, error: "Not Implemented".}`
19:42:08FromDiscord<Gary M> no macro needed
19:47:14*NimBot joined #nim
19:51:43*abm joined #nim
20:03:24*haxscramper quit (Remote host closed the connection)
20:05:38*zedeus joined #nim
20:10:09FromDiscord<exelotl> In reply to @queersorceress "speaking of karax, can": Yeah, here's an example from the Prologue docs: https://planety.github.io/prologue/views/
20:35:17*superbia quit (Quit: WeeChat 3.1)
20:42:27FromDiscord<Seedofarson> ReactJS hurts my internals
20:43:37FromDiscord<Gary M> I like React.
20:51:12*jess quit (Remote host closed the connection)
20:51:40*j joined #nim
20:53:27*D_ joined #nim
20:54:07*narimiran_ quit (Quit: leaving)
20:55:16*j quit (Quit: K-Lined)
20:57:37*D_ quit (Remote host closed the connection)
20:57:52*D_ joined #nim
21:05:44*teasea quit (Quit: teasea)
21:07:42*teasea joined #nim
21:38:29*vsantana quit (Quit: vsantana)
22:12:02*clemens3 quit (Ping timeout: 260 seconds)
22:14:50*clemens3 joined #nim
22:23:32FromDiscord<ElegantBeef> Prestige any issues so far with nimscripter?
22:26:40*fredrikhr quit (Quit: Client Disconnecting)
22:29:08FromDiscord<Hi02Hi> In reply to @Gary M "What's everyone working on?": Im trying to make a bigint lib for fun.
22:30:47FromDiscord<Gary M> In reply to @Hi02Hi "Im trying to make": Pretty cool. What's that like 128 ints?
22:31:00FromDiscord<Hi02Hi> arbitrary size
22:31:04FromDiscord<Gary M> Oh
22:31:14FromDiscord<Gary M> I only know bigint from like postgres
22:31:32FromDiscord<Hi02Hi> kinda like pythons ints
22:31:48FromDiscord<Hi02Hi> except not fast at all
22:32:59FromDiscord<Hi02Hi> i felt nice that i found a way to init from all varieties of ints unlike bigints
22:35:03PrestigeHaven't tried yet, will tonight
22:36:09FromDiscord<Hi02Hi> hopefully you find a nicer way than me, i used cast
22:36:24FromDiscord<ElegantBeef> Nim will soon super user defined literals
22:36:32FromDiscord<ElegantBeef> (edit) "super" => "support"
22:36:51FromDiscord<ElegantBeef> Isnt there a module with things like printf and others directly wrapped?
22:36:55FromDiscord<Hi02Hi> like i10 or sth?
22:37:05FromDiscord<ElegantBeef> more like `10'bignum`
22:37:33FromDiscord<ElegantBeef> https://github.com/nim-lang/Nim/pull/17020
22:37:46FromDiscord<ElegantBeef> That PR will enable stuff like that
22:39:20giaco_any experience in using vscode + "format on save" (nimpretty)?
22:39:46giaco_I successfully format my code with right click -> format, but editor conf "format on save" seems ignored
22:43:20giaco_wait, it works, but not on every nim source file. Seems that it doesnt like dsl
22:43:45FromDiscord<Hi02Hi> i meant i can init from int and int8 and uint32 and all the others
22:44:36FromDiscord<ElegantBeef> Oh you mean explictly convert?
22:45:43FromDiscord<Hi02Hi> yeah
22:58:25*j joined #nim
23:03:13*j is now known as jess
23:10:41giaco_how can I get value from tuple using string variable as key?
23:11:39FromDiscord<ElegantBeef> The string is a constant?
23:11:46giaco_no
23:11:56FromDiscord<ElegantBeef> Well then a case stmt
23:13:44giaco_mmm, thanks
23:14:05giaco_probably I need to tackle the problem from a different point of view
23:19:53FromDiscord<ElegantBeef> Finally getting around to attempting to write nim for the rpi pico and getting this nice error on linking `undefined reference to systemDatInit000`, my compiler options are `c -c --nimcache:csource --out:hello_usb --gc:arc --cpu:arm -d:useMalloc`
23:21:08giaco_I'm quite interested in following the nim + pi pico feed. Where's the center of gravity of this matter?
23:21:57FromDiscord<ElegantBeef> There is an embedded channel, but i mean i'm the only here i know of attempting this
23:22:58giaco_do you mean ##embedded or something more nim specific?
23:23:12FromDiscord<ElegantBeef> #nim-embedded
23:24:37giaco_thanks