00:00:24 | FromDiscord | <nikki> o yeah for sure |
00:00:38 | FromDiscord | <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:47 | FromDiscord | <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:58 | FromDiscord | <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:44 | FromDiscord | <ElegantBeef> Well with the variant you cannot get the other value, so you really just have an option |
01:47:02 | FromDiscord | <Anonymous Poet> right, so it works fine for a single call |
01:47:05 | FromDiscord | <Anonymous Poet> but not for chaining |
01:48:06 | FromDiscord | <ElegantBeef> Yea i'm a bit uncertain on what mapping an either is supposed to do |
01:48:26 | FromDiscord | <ElegantBeef> pass each value through a procedure and mutate left/right? |
01:49:00 | FromDiscord | <Anonymous Poet> the motivation for this is if i wanted to build something like rust's `Result` |
01:49:35 | FromDiscord | <ElegantBeef> Isnt Rust's `Result` just an `option[T]` and a `msg: string`? |
01:50:05 | FromDiscord | <Anonymous Poet> it's an `Either[T]<string, T>` (string is the error) |
01:50:20 | FromDiscord | <ElegantBeef> Ah ok now i see why the variant |
01:50:41 | FromDiscord | <ElegantBeef> I thought the point of the either was to actually have the abillity to change what the "value" was |
01:50:50 | FromDiscord | <Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix=2SvC |
01:51:07 | FromDiscord | <Anonymous Poet> ah, yeah, sorry, i shouldve explained the motivation first |
01:51:33 | FromDiscord | <Anonymous Poet> i guess, actually looking at this, i dont need either |
01:51:43 | FromDiscord | <Anonymous Poet> really, i just need an implementation of map for either like option |
01:53:17 | FromDiscord | <Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix=2SvE |
01:54:41 | FromDiscord | <ElegantBeef> Yea |
01:55:07 | FromDiscord | <ElegantBeef> The only difference between them is that the result has a string if it's none |
01:55:13 | FromDiscord | <Anonymous Poet> yeah, exactly |
01:55:56 | FromDiscord | <ElegantBeef> So we're good now? 😄 |
01:56:05 | FromDiscord | <Anonymous Poet> yes, haha, thanks for listening 😄 |
01:56:14 | FromDiscord | <Anonymous Poet> though i wonder if theres any reason to have a generic map for either like i had initially wanted |
01:56:37 | FromDiscord | <ElegantBeef> And now to rain on your parade https://github.com/arnetheduck/nim-result |
01:56:43 | FromDiscord | <Anonymous Poet> like if you needed a more complex error type rather than string, and for whatever reason needed to modify it? |
01:57:12 | FromDiscord | <ElegantBeef> Possibly? |
01:57:46 | FromDiscord | <Anonymous Poet> no rain whatsoever, ty for sharing |
01:58:30 | FromDiscord | <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:46 | FromDiscord | <Anonymous Poet> hmm, thats a good idea! |
01:59:13 | FromDiscord | <Anonymous Poet> im just thinking about how id implement a CRUD-like app in Nim, and what might be nice for that |
01:59:35 | FromDiscord | <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:13 | FromDiscord | <ElegantBeef> Ah no clue what CRUD is but do know what crud software is (hint it's mine) |
02:00:18 | FromDiscord | <Anonymous Poet> hehe |
02:00:25 | FromDiscord | <Anonymous Poet> CRUD = "Create Read Update Delete" |
02:00:44 | FromDiscord | <Anonymous Poet> basically what 99% of apps today are |
02:01:34 | * | blackpawn joined #nim |
02:02:27 | FromDiscord | <ElegantBeef> Ah so crud |
02:04:41 | FromDiscord | <Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix=2SvH |
02:05:15 | FromDiscord | <Anonymous Poet> and then end users can build off `ErrorObj` and implement error handlers as they wish |
02:06:08 | FromDiscord | <ElegantBeef> Well my library doesnt handle that nor is really "polished" 😄 |
02:06:16 | FromDiscord | <Anonymous Poet> one day! |
02:06:29 | FromDiscord | <ElegantBeef> Like atm i cause a compiler internal error |
02:06:51 | FromDiscord | <Anonymous Poet> cause a compiler error if the user does something bad? or just in general? :p |
02:07:05 | FromDiscord | <ElegantBeef> No it's an internal error due to my macro |
02:07:10 | FromDiscord | <Anonymous Poet> ah :/ |
02:07:29 | FromDiscord | <ElegantBeef> `Error: internal error: environment misses: g` |
02:07:42 | FromDiscord | <Anonymous Poet> 🤷♂️ |
02:07:51 | FromDiscord | <ElegantBeef> The best part is i'm uncertain how to minify it so my filed issue is the most useless thing 😄 |
02:08:25 | FromDiscord | <Anonymous Poet> sometimes i find it helpful to just restart from scratch, and incorporate learnings from the prototype |
02:08:33 | FromDiscord | <ElegantBeef> I mean it works |
02:08:40 | FromDiscord | <ElegantBeef> It's not a fuckup on my end |
02:09:08 | FromDiscord | <ElegantBeef> https://github.com/nim-lang/Nim/issues/17285 if you want to have a read 😛 |
02:09:41 | FromDiscord | <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:54 | FromDiscord | <ElegantBeef> Nope still sends em 😦 |
02:10:45 | * | lritter quit (Ping timeout: 264 seconds) |
02:10:46 | FromDiscord | <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:52 | FromDiscord | <ElegantBeef> Except they're identifiers and the repr is fine https://play.nim-lang.org/#ix=2SvI |
02:12:41 | FromDiscord | <ElegantBeef> Identifiers are not looked up, so i still dont follow their implication |
02:12:58 | FromDiscord | <Anonymous Poet> oh, hmm, idk then |
02:13:08 | FromDiscord | <Anonymous Poet> i havent dug into nim's ast yet |
02:13:45 | FromDiscord | <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:38 | FromDiscord | <Anonymous Poet> i wonder if having longer names might be helpful? |
02:15:18 | FromDiscord | <Anonymous Poet> also, pattern matching would probably make it much more readable .. sadly only in fusion |
02:15:35 | FromDiscord | <ElegantBeef> I'm using devel features already |
02:15:45 | FromDiscord | <ElegantBeef> `Error: internal error: environment misses: longerg` 😛 |
02:20:19 | FromDiscord | <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:54 | Prestige | If 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:49 | leorize | Option[T] should do I guess? |
03:42:10 | FromDiscord | <Rika> yes i can confirm that |
03:42:15 | Prestige | I thought that's only when it could be a missing property |
03:43:43 | Prestige | oh 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:09 | FromDiscord | <ShadowElf37> https://play.nim-lang.org/#ix=2Sw5 |
04:41:17 | FromDiscord | <ShadowElf37> 4th iterator doesnt compile 🤔 |
04:42:06 | FromDiscord | <ShadowElf37> discrepancy between index and backwardsindex |
04:45:40 | FromDiscord | <InventorMatt> https://play.nim-lang.org/#ix=2Sw6 |
04:46:03 | FromDiscord | <InventorMatt> I think you forgot to deference the array |
04:46:22 | FromDiscord | <ElegantBeef> Any reason using a var reference? |
04:46:27 | FromDiscord | <ElegantBeef> (edit) "Any reason ... using" added "not" |
04:46:36 | FromDiscord | <ShadowElf37> in `iterup_2` i dont have to dereference it for some reason |
04:46:39 | FromDiscord | <ShadowElf37> nor do i at the top |
04:46:41 | FromDiscord | <ShadowElf37> with the echos |
04:46:48 | FromDiscord | <ShadowElf37> its only in `iterdown_2` |
04:51:49 | FromDiscord | <ShadowElf37> In reply to @ElegantBeef "Any reason not using": i have ref arrays and i dont think they work with var |
04:51:53 | FromDiscord | <ShadowElf37> or i cant get them to play nice |
04:52:17 | FromDiscord | <ElegantBeef> Well you dont need var for refs |
04:52:23 | FromDiscord | <ShadowElf37> right |
04:52:54 | FromDiscord | <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:23 | FromDiscord | <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:46 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/system.html#setControlCHook%2Cproc%29 |
06:36:00 | FromDiscord | <ElegantBeef> And also `exitprocs` |
06:37:38 | FromDiscord | <Snippy Nippy> Can you show any examples too. I am new to nim 😅 |
06:37:53 | FromDiscord | <ElegantBeef> I can try my async is a little eh |
06:38:20 | FromDiscord | <Araq> today @Clyybber created history |
06:38:23 | FromDiscord | <Araq> https://github.com/nim-lang/Nim/pull/17342 |
06:38:25 | FromDiscord | <Snippy Nippy> ty |
06:38:35 | FromDiscord | <ElegantBeef> I had seen was cool to see 😄 |
06:49:38 | FromDiscord | <lepot311> is it possible to have a sequence of types? |
06:50:14 | FromDiscord | <Araq> yes but when you ask that, you are usually on the completely wrong track |
06:51:34 | FromDiscord | <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:07 | FromDiscord | <ElegantBeef> Do you food types have any other data on them? |
06:52:26 | FromDiscord | <lepot311> yes maybe each has a `nutrition` int or something |
06:52:30 | FromDiscord | <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:36 | FromDiscord | <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:58 | FromDiscord | <Araq> `type Food = enum Apple, Banana` |
06:54:15 | FromDiscord | <Araq> `proc initAnimal(eats: set[Food])` |
06:54:21 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2SwH |
06:54:25 | FromDiscord | <Araq> model values as values, not as types |
06:54:34 | FromDiscord | <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:46 | FromDiscord | <Snippy Nippy> (edit) removed "is" |
06:55:19 | FromDiscord | <lepot311> so object variants is what those are called, right? |
06:55:25 | FromDiscord | <ElegantBeef> Nah that's just a set |
06:55:37 | FromDiscord | <ElegantBeef> Object variants are when you add fields for specific kinds |
06:55:48 | FromDiscord | <lepot311> okay I'll check this out, thanks |
06:56:22 | FromDiscord | <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:14 | FromDiscord | <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:34 | FromDiscord | <Araq> `enum` and `set of enum` are features you simply never regret |
07:02:53 | FromDiscord | <ElegantBeef> Especially since the ergonomics of them are super nice, not having to `or` the values together just curly braces |
07:03:37 | FromDiscord | <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:57 | FromDiscord | <ElegantBeef> @Snippy Nippy Think something like this should work and is what he implied https://play.nim-lang.org/#ix=2SwN |
07:13:44 | FromDiscord | <Snippy Nippy> oh yea |
07:13:47 | FromDiscord | <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:52 | FromDiscord | <VinKer> Hi, is there any speed difference when compiling code with {.experimental: "codeReordering".} ? |
07:38:29 | FromDiscord | <Araq> the compiler is a little bit slower then |
07:38:37 | FromDiscord | <Araq> but the produced code is identical |
07:42:18 | * | letto quit (Quit: Konversation terminated!) |
07:43:01 | * | letto joined #nim |
07:43:25 | FromDiscord | <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:49 | PMunch | Hmm, 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:56 | PMunch | I mean this works: `for x in 0..10: case range[0..10](x):` |
08:25:15 | FromDiscord | <Araq> there are plans for that, yes. Under the "flow typing" umbrella |
08:25:31 | PMunch | Ah okay, cool |
08:26:03 | PMunch | It would be one of those things that Nim just did better to make you code a bit more safe |
08:26:03 | FromDiscord | <Araq> in my spare time I wrote a new SAT solver which should prove useful for that |
08:26:50 | FromDiscord | <Araq> I'm looking for proving every array bound at compile-time |
08:29:25 | FromDiscord | <mratsim> no Z3? |
08:29:42 | FromDiscord | <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:08 | PMunch | In 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:32 | FromDiscord | <ElegantBeef> Pmunch you can do it the other way `for x in range[0..5](0)..5:` |
09:01:51 | PMunch | Wait really? :P |
09:02:04 | FromDiscord | <ElegantBeef> Yea |
09:02:17 | FromDiscord | <ElegantBeef> Atleast this example works https://play.nim-lang.org/#ix=2Sxl |
09:04:42 | PMunch | Hmm, is there any adverse side effect to just doing that cast always? |
09:05:10 | FromDiscord | <ElegantBeef> Less ugly for loop |
09:05:32 | PMunch | I meant doing it implicitly |
09:05:37 | PMunch | In the compiler |
09:06:03 | FromDiscord | <ElegantBeef> I dont follow |
09:07:38 | FromDiscord | <Araq> @mratsim actually I wrote it for Nimble, but it's generally useful |
09:08:57 | PMunch | @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:09 | FromDiscord | <ElegantBeef> Ah that, i dont imagine such, but i'm often wrong 😛 |
09:13:12 | FromDiscord | <Solitude> sent a code paste, see https://play.nim-lang.org/#ix=2Sxs |
09:15:05 | FromDiscord | <Solitude> ah, it breaks default `..` |
09:15:22 | FromDiscord | <mratsim> A "blog post" on why bounded channels are important: https://github.com/nim-lang/Nim/pull/17305#issuecomment-797351832 |
09:15:42 | FromDiscord | <ElegantBeef> How does it break default `..`? |
09:15:59 | FromDiscord | <Solitude> no, nope, it isnt, just misleading error message |
09:15:59 | FromDiscord | <Rika> prolly arr[0..1] will give a wrong type |
09:16:11 | FromDiscord | <Rika> oh wait no iterator |
09:16:11 | FromDiscord | <Rika> gm |
09:16:14 | FromDiscord | <Rika> dunno then |
09:16:34 | FromDiscord | <ElegantBeef> Let's go for the sillier impl https://play.nim-lang.org/#ix=2Sxu |
09:17:20 | FromDiscord | <Solitude> but ..< should be range[a..b - 1] |
09:17:27 | FromDiscord | <ElegantBeef> ah true |
09:17:50 | FromDiscord | <Solitude> this is epic |
09:18:13 | * | cornfeedhobo quit (Quit: ZNC - https://znc.in) |
09:18:59 | FromDiscord | <ElegantBeef> Now we rip the defaults out of the stdlib and see it implode 😛 |
09:20:14 | * | cornfeedhobo joined #nim |
09:25:17 | FromDiscord | <Rika> speaking of defaults i really wish we could plug `default` so that `var x: ATy` would use `default(ATy)`... |
09:25:36 | FromDiscord | <Goel> sent a long message, see http://ix.io/2Sxw |
09:25:53 | FromDiscord | <Rika> `nimble install https://github.com/johnnovak/easyWave` |
09:25:59 | FromDiscord | <ElegantBeef> It's not in the package registry |
09:26:07 | FromDiscord | <Rika> likely forgot to put it there |
09:26:13 | FromDiscord | <ElegantBeef> If an author doesnt submit a nimble package you need to use a giturl |
09:26:31 | FromDiscord | <Goel> In his official repo page: "Installation↵The best way to install the library is by using nimble:↵↵nimble install easywave" |
09:27:00 | FromDiscord | <ElegantBeef> Yea it's not in the registry, i dont care what he says |
09:27:02 | FromDiscord | <Goel> But ok it works adding the direct github link |
09:27:12 | FromDiscord | <ElegantBeef> Plus an issue already exists for this exact problem |
09:29:43 | FromDiscord | <gogolxdong> Is there any library could exchange BTC and ETH? |
09:30:30 | FromDiscord | <mratsim> There are Binance bindings in Nim |
09:38:55 | * | superbia joined #nim |
09:41:04 | superbia | what cross platform framework to use for simple gui apps, I need some sliders, some buttons, display some images etc. |
09:41:53 | Clonkk[m] | https://github.com/treeform/fidget https://github.com/trustable-code/NiGui |
09:44:05 | PMunch | Or WxNim if you want native |
09:44:57 | superbia | will check everything up, thanks ! |
09:45:57 | FromGitter | <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:23 | PMunch | Wait, how did you get data into an object before Nim zeros it? |
09:48:13 | FromDiscord | <gogolxdong> https://github.com/facorazza/binance ? |
09:48:27 | FromGitter | <redblack3_gitlab> I'm assuming it's initialized with an initial ref count of `1`, then Nim zeros it |
09:48:37 | FromGitter | <redblack3_gitlab> `T1_` is |
09:51:55 | * | vicfred quit (Quit: Leaving) |
09:52:02 | PMunch | Yeah 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:16 | PMunch | Some kind of C++ initialiser? |
09:52:20 | FromGitter | <redblack3_gitlab> Yes |
09:52:37 | FromDiscord | <mratsim> @gogolxdong also https://github.com/inv2004/coinbase-pro-nim |
09:53:09 | FromDiscord | <mratsim> though it seems only the read-only API is implemented |
09:57:26 | FromGitter | <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:42 | FromDiscord | <Araq> @Clyybber your solution for https://github.com/nim-lang/RFCs/issues/19 might be particularly easy to implement... |
10:15:36 | PMunch | Hmm, iterators are expanded at compile-time right? So is there a way to write an iterator as a macro? |
10:15:54 | FromDiscord | <Araq> yes |
10:16:01 | FromDiscord | <Araq> via "for loop macros" |
10:16:18 | FromDiscord | <Araq> read more about this feature in the manual |
10:16:21 | PMunch | Haha, yeah I was just about to say "this is that new for loop macros feature isn't it" :P |
10:18:00 | FromDiscord | <ElegantBeef> What are you doing to the poor for now? |
10:19:56 | PMunch | Keyboard firmware stuff :P |
10:20:21 | PMunch | Crossing super low-level C stuff with high-level macro magic :D |
10:23:28 | PMunch | Hmm, 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:53 | FromGitter | <timotheecour> For loop macros can support MCS via https://github.com/nim-lang/RFCs/issues/345 |
10:29:30 | FromGitter | <timotheecour> (i think) |
10:30:42 | * | drsensor quit (Quit: Connection closed for inactivity) |
10:34:00 | ForumUpdaterBot | New Nimble package! nimgram - MTProto client written in Nim, see https://github.com/nimgram/nimgram |
10:36:03 | superbia | One more thing, I'd need a cross platform library to control my cursor and keyboard, if such existed ? |
10:41:23 | PMunch | Hmm, there is wauto for Windows and xdo for Linux. But no cross platform solution |
10:41:37 | PMunch | I guess you could write a small module that wraps those two in a common interface |
10:51:14 | superbia | seems 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:31 | ForumUpdaterBot | New 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:54 | FromGitter | <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:03 | FromDiscord | <Clyybber> @HJarausch No, that's not the issue. destroy on int is just a no-op |
12:42:35 | FromGitter | <haxscramper> `when x[i] isnot object` I think |
12:42:40 | FromDiscord | <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:44 | FromDiscord | <Clyybber> haxscramper: Not needed |
12:42:56 | FromDiscord | <Clyybber> simply replace x[i] in the =destroy implementation with x.data[i] |
12:43:57 | FromDiscord | <Clyybber> the example is fixed on devel now |
12:48:22 | FromDiscord | <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:07 | FromDiscord | <Yardanico> I don't know if it's actually worth it (I mean doing one lookup instead of two) |
12:50:57 | FromGitter | <HJarausch_gitlab> @Clybber Many thanks. Where the documentation for devel? |
12:51:39 | FromDiscord | <Yardanico> http://nim-lang.github.io/Nim/destructors.html |
12:52:10 | FromDiscord | <Clyybber> what yardanico sent :D, but it isn't updated yert |
12:52:12 | FromDiscord | <Clyybber> (edit) "yert" => "yet" |
12:52:29 | FromDiscord | <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:28 | FromGitter | <HJarausch_gitlab> Thanks, I've seen that it is fixed |
12:54:06 | FromDiscord | <carpal> zig |
12:54:07 | FromDiscord | <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:59 | FromDiscord | <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:13 | FromDiscord | <Yardanico> I mean you can do it once, but then you'll need try except :P |
12:55:21 | FromDiscord | <Yardanico> to catch KeyError |
12:55:49 | FromDiscord | <Clyybber> aah |
12:57:20 | FromDiscord | <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:02 | FromDiscord | <Clyybber> I think Option[T] is the best approach (rawGet would still have to lookup anyways) |
12:58:12 | FromDiscord | <Yardanico> well with rawGet you will only have to do lookups once |
12:58:26 | FromDiscord | <Yardanico> ah you're right |
12:58:35 | FromDiscord | <Yardanico> since rawGet returns an index which can only be used internally since data is not exposed |
12:59:37 | FromDiscord | <Clyybber> I think Option[T] really is the nicest option (heh) here, but the extra import/dependency is eh |
13:00:03 | FromDiscord | <Yardanico> we can always go the "a lot of modules way" and have some stdlib module named "tableutils" |
13:00:22 | FromDiscord | <Clyybber> yeah |
13:01:13 | FromDiscord | <Yardanico> hm, but even then we won't be able to access to the `data` variable from tables 🤔 |
13:01:26 | FromDiscord | <Yardanico> unless we `include` tables which is quite a bad solution I guess |
13:01:30 | FromDiscord | <Clyybber> no, but then theres no reason to anymore? |
13:01:37 | FromDiscord | <Clyybber> ah |
13:01:39 | FromDiscord | <Clyybber> I see |
13:01:48 | FromDiscord | <Yardanico> yeah, there's `tableimpl` but it only has templates |
13:01:50 | FromDiscord | <Clyybber> yeah, I think then it should just go into tables.nim |
13:02:09 | FromDiscord | <Clyybber> I mean IC is coming :D |
13:02:18 | FromDiscord | <Yardanico> hehe |
13:02:30 | FromDiscord | <Clyybber> In reply to @Araq "<@!107882072974065664> your solution for": yeah, I think so too |
13:02:31 | FromDiscord | <Yardanico> I guess I'll make an RFC for this addition |
13:02:35 | FromDiscord | <Clyybber> I might get around to it in a bit |
13:03:25 | FromDiscord | <Clyybber> (referring to araq, not your RFC :p) |
13:14:20 | FromDiscord | <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:16 | FromDiscord | <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:24 | FromDiscord | <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:11 | FromDiscord | <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:17 | FromDiscord | <Yardanico> (edit) "s" => "stll" |
13:25:20 | FromDiscord | <Yardanico> (edit) "stll" => "still" |
13:25:32 | * | D_ joined #nim |
13:26:53 | FromDiscord | <haxscramper> `if Some(@val) ?= table.getOpt("key")` |
13:27:10 | FromDiscord | <Yardanico> actually we can make a `tableutils` module for this instead |
13:27:23 | FromDiscord | <haxscramper> can we just stop creating one-proc modules? |
13:27:30 | FromDiscord | <Yardanico> yeah I don't like that either :P |
13:30:19 | FromDiscord | <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:53 | FromDiscord | <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:04 | FromDiscord | <Yardanico> yeah that can be added as an example in `runnableExamples` |
13:31:17 | FromDiscord | <Yardanico> and when someone wants to use getOpt they would probably want `options` in their own code explicitly anyway |
13:34:02 | PMunch | I 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:51 | FromGitter | <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:56 | FromDiscord | <Clyybber> @HJarausch It's missing an implementation for resize |
13:47:16 | * | Vladar quit (Quit: Leaving) |
13:55:22 | FromDiscord | <Gary M> sup clyybber |
13:56:46 | FromDiscord | <Clyybber> sup |
13:57:05 | FromDiscord | <Gary M> I'm using your vulkan bindings again |
13:57:20 | FromDiscord | <Gary M> but I wrapped everything in proper dll calls 😛 |
13:58:05 | FromDiscord | <Gary M> https://media.discordapp.net/attachments/371759389889003532/819932254993252362/unknown.png |
13:58:12 | FromDiscord | <Clyybber> ah I see |
13:58:29 | FromDiscord | <Gary M> it works perfectly on windows and linux |
13:58:44 | FromDiscord | <Clyybber> and just linking via the c compiler didn't? |
13:58:54 | FromDiscord | <Gary M> that's not the way to do it |
13:58:57 | FromDiscord | <Clyybber> or doing {.link: "somedll/so".} |
13:59:00 | FromDiscord | <Gary M> no |
13:59:10 | FromDiscord | <Gary M> on windows it kinda works but it has to be a hard path |
13:59:20 | FromDiscord | <Gary M> doing it this way searches system paths properly |
13:59:30 | FromDiscord | <Gary M> on linux it just hated {.link.} |
13:59:57 | FromDiscord | <Gary M> sent a code paste, see https://play.nim-lang.org/#ix=2Szp |
14:00:05 | FromDiscord | <Gary M> that's literally all it takes. |
14:00:33 | FromDiscord | <Gary M> you already had cdecl and importc on the proc signatures, just needed the dynlib |
14:01:27 | FromDiscord | <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:37 | FromDiscord | <Clyybber> I think I will wrap the dynlib: vkdll in a custom pragma |
14:01:43 | FromDiscord | <Clyybber> so that you can overwrite it |
14:02:05 | FromDiscord | <Gary M> while you're at it do you think you could make a proper nimble and add it to the registry? 😄 |
14:02:21 | FromDiscord | <Clyybber> yeah :D |
14:02:29 | FromDiscord | <Gary M> nimble install vs git submodule lol |
14:03:31 | FromDiscord | <Clyybber> I'm curious though, why did link not work for you on linux? |
14:05:05 | FromDiscord | <Gary M> Couldn't find the library. |
14:05:24 | FromDiscord | <Gary M> it's supposed to be in some x86_64 path inside lib |
14:05:29 | FromDiscord | <Gary M> but it just didn't want to link |
14:05:38 | FromDiscord | <Gary M> proper dynlib pragma and it worked |
14:05:48 | * | wasted_youth2 quit (Quit: Leaving) |
14:06:02 | FromDiscord | <Gary M> Doing it this way is pretty much guaranteed to work for everyone out of the box with no extra steps |
14:06:26 | FromDiscord | <Gary M> except I don't know the exact name for the mac dynlib |
14:06:34 | FromDiscord | <Gary M> but mac dev is 🤮 |
14:07:44 | FromDiscord | <Gary M> right now I'm trying to make a rough approximation of the vkbootstrap builders 😄 |
14:08:11 | FromDiscord | <Gary M> due to nim's UFCS I don't even need a fancy object |
14:08:25 | FromDiscord | <Gary M> just keep returning the type and modifying the field |
14:08:44 | FromDiscord | <Clyybber> nice |
14:08:50 | FromDiscord | <Clyybber> @HJarausch https://github.com/nim-lang/Nim/pull/17354 |
14:11:13 | FromDiscord | <Gary M> the thing I don't know how to use is the function pointers |
14:11:22 | FromDiscord | <Gary M> pfn_vkWhatever |
14:11:44 | FromDiscord | <Gary M> I haven't had to use them, but I see them used in some vk code in the wild |
14:11:54 | FromDiscord | <Clyybber> whats the problem? |
14:12:01 | FromDiscord | <Gary M> no problem |
14:12:07 | FromDiscord | <Clyybber> ah, just cast to them |
14:12:09 | FromDiscord | <Clyybber> and then call them |
14:13:12 | FromDiscord | <Gary M> sent a code paste, see https://play.nim-lang.org/#ix=2Szv |
14:13:35 | FromDiscord | <Gary M> like seeing if the functions are even available on the platform I guess? |
14:14:06 | FromDiscord | <Clyybber> it's calling it |
14:14:47 | FromDiscord | <Gary M> yeah well, why are they calling it with the pfn version |
14:14:56 | FromDiscord | <Clyybber> it's their variable |
14:15:01 | FromDiscord | <Clyybber> they must have it defined somewhere |
14:15:12 | * | Vladar joined #nim |
14:49:07 | PMunch | Damn it, I did the timezone calculation for the Nim online meetup today the wrong way.. |
14:54:09 | FromDiscord | <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:12 | FromDiscord | <Yardanico> @Vindaar they're supposed to follow a bi-weekly schedule iirc |
14:55:46 | FromDiscord | <Vindaar> Oh that'd be great! |
14:56:53 | PMunch | Oh cool |
14:57:00 | PMunch | Did we get a community manager or something? |
14:58:30 | federico3 | uh? |
14:58:58 | federico3 | what meetup? |
14:59:12 | PMunch | https://forum.nim-lang.org/t/7611 |
14:59:46 | federico3 | err in the middle of working time? |
15:00:29 | PMunch | Depends on your time zone I guess :P |
15:00:45 | PMunch | For me it's about an hour after work |
15:00:45 | FromDiscord | <Yardanico> @PMunch wasn't Miran our community manager? :P |
15:00:55 | FromDiscord | <Rika> TFW 1 AM |
15:01:01 | FromDiscord | <Yardanico> @Rika :) |
15:01:08 | FromDiscord | <Yardanico> you can't make it for everyone sadly |
15:01:09 | PMunch | Yeah the Nim community is pretty Euro-centric |
15:01:13 | FromGitter | <HJarausch_gitlab> @Clybber MANY THANKS. |
15:01:19 | federico3 | PMunch: given the location of most of the communty... |
15:01:22 | FromDiscord | <Rika> 2 Asian 4 I |
15:01:26 | FromDiscord | <Rika> (edit) "I" => "U" |
15:02:54 | FromDiscord | <Yardanico> real nimmers wouldn't be scared of a meeting at 1 AM |
15:02:58 | FromDiscord | <Yardanico> :nimRawr: |
15:03:08 | federico3 | other communities do events on saturdays for this reason |
15:10:34 | FromDiscord | <dom96> In reply to @federico3 "err in the middle": I asked for later today, but they refused :/ |
15:10:57 | FromDiscord | <dom96> I’ll try to join nonetheless |
15:11:06 | federico3 | :( |
15:11:16 | FromDiscord | <dom96> But 4pm is a poor time to do these meetings for those of us in the UK |
15:11:25 | FromDiscord | <dom96> 5pm is meh for EU too tbh |
15:11:36 | FromDiscord | <dom96> I’m often at work at 5pm too |
15:12:05 | federico3 | very few people have free fridays afternoons |
15:12:07 | FromDiscord | <mratsim> What, there is work for Nim developers? |
15:13:13 | * | SebastianM joined #nim |
15:14:50 | SebastianM | Hey guys, could anyone tell me please if i have var name = "Seba" What is the easiest to save that name as jsonfile? |
15:14:56 | SebastianM | Thank you |
15:16:29 | FromDiscord | <haxscramper> Maybe `import std/json; "yourfile".writeFile(%name)` |
15:16:48 | FromDiscord | <haxscramper> But I'm not exactly sure that I understood the question correctly |
15:17:07 | * | PMunch quit (Quit: leaving) |
15:17:37 | FromDiscord | <mario2> To make a lexer in nim all I need to do is assign keywords to various reserved words? That's it? |
15:19:04 | SebastianM | @haxscramper its about equivalent to pythons dump your code looks very easy i'll try it later.Thank you very much |
15:20:18 | FromDiscord | <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:32 | FromDiscord | <haxscramper> Not different from any other language for the most part |
15:21:05 | FromDiscord | <mario2> I was considering using nim to make the first version of a compiler for a programming language. |
15:21:36 | FromDiscord | <mario2> It would in the end spit out assembly code to be given to the assembler. |
15:22:16 | FromDiscord | <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:35 | FromDiscord | <haxscramper> At least for me, it was really easy to write compiler for my language |
15:22:56 | FromDiscord | <mario2> Is the nim source code for your compiler available online? |
15:23:13 | FromDiscord | <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:41 | FromDiscord | <haxscramper> And we also have #langdev specifically for discussing language development and related fields |
15:23:55 | FromDiscord | <haxscramper> In reply to @haxscramper "No, for now it": private project for no |
15:23:57 | FromDiscord | <haxscramper> (edit) "no" => "now" |
15:24:32 | FromDiscord | <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:16 | FromDiscord | <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:53 | SebastianM | @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:27 | liblq-dev | hax stop recommending my old parser 😛 |
15:28:36 | liblq-dev | https://github.com/liquidev/tsuki |
15:28:40 | liblq-dev | this one is wayyy better |
15:28:48 | FromDiscord | <mratsim> It has been archived in Github ice, for all eternity |
15:28:50 | FromDiscord | <haxscramper> ah, ok, will keep this in nimd |
15:29:05 | FromDiscord | <haxscramper> !eval import std/json; let name = "123"; echo %{"name" : name} |
15:29:07 | NimBot | Compile failed: /usercode/in.nim(1, 42) Error: invalid token: (\29) |
15:29:24 | FromDiscord | <Solitude> https://nim-lang.org/docs/json.html#creating-json |
15:29:34 | haxscramper | !eval import std/json; let name = "123"; echo %*{"name" : name} |
15:29:37 | NimBot | {"name":"123"} |
15:29:42 | haxscramper | Good |
15:29:42 | * | Gustavo6046_ joined #nim |
15:30:38 | * | Gustavo6046 quit (Ping timeout: 260 seconds) |
15:30:41 | FromDiscord | <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:44 | haxscramper | What 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:11 | haxscramper | Because this ^ would break when I have `decltype` arguments |
15:46:29 | Clonkk[m] | Maybe I misunderstood what you meant, but I think I'd just use ``untyped`` return value with a template |
15:47:10 | haxscramper | I need to wrap C++ code while preserving as much typing as possible in function signature |
15:47:35 | haxscramper | Ah, yes, the typo. `s/way to write/way to wrap/g` |
15:48:00 | haxscramper | I have `template<typename _Container> crend(const _Container& __cont) -> decltype(std::rend(__cont))` |
15:48:10 | haxscramper | And need to translate this to nim bindings |
15:50:19 | Clonkk[m] | Maybe ``emit`` can save you ? |
15:50:36 | Clonkk[m] | So you don't actually write Nim code :D |
15:51:24 | haxscramper | Well maybe as a last resort. But I'm mostly searching for a way to preserve type relations. |
15:51:45 | haxscramper | Because `emit` breaks type system |
15:52:33 | haxscramper | `-> 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:55 | FromDiscord | <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:37 | FromDiscord | <mario2> When making the lexer scanner, what is the output supposed to be? |
16:24:51 | haxscramper | sequence of tokens |
16:25:46 | haxscramper | Also 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:56 | haxscramper | `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:26 | haxscramper | Just template that errors out `when arg isnot typeof(arg + arg)`? |
16:29:22 | FromDiscord | <mratsim> templates returning auto? how is it deduced. |
16:32:45 | * | krux02 joined #nim |
16:33:14 | FromDiscord | <haxscramper> `-> decltype(expr)` is wrapped as `proc(): auto; var tmp: typeof(expr); result = tmp` |
16:33:34 | FromDiscord | <haxscramper> if there is a `decltype` argument, then I do |
16:35:00 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=2SAo |
16:40:04 | FromDiscord | <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:53 | haxscramper | Oh, yeah, SFINAE hell |
17:08:02 | saem | @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:14 | FromDiscord | <Gary M> What's everyone working on? |
17:37:35 | FromDiscord | <haxscramper> C++ wrapper generator |
17:42:50 | FromDiscord | <zetashift> Messing around with godot-nim and OurMachinery, also learning more about graphics programming |
17:43:12 | FromDiscord | <zetashift> Also Scala programming, I still love Nim the most! |
17:48:55 | FromDiscord | <treeform> In reply to @Gary M "What's everyone working on?": 2d physics engine |
17:49:26 | FromDiscord | <Gary M> Oh cool, like box2d/chipmunk? |
17:49:57 | FromDiscord | <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:19 | FromDiscord | <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:50 | FromDiscord | <treeform> And implement most shapes supported by my earlier library called bumpy: https://github.com/treeform/bumpy |
17:51:14 | FromDiscord | <Gary M> Nice |
17:51:50 | FromDiscord | <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:14 | FromDiscord | <treeform> Is probably a better option. |
17:52:25 | FromDiscord | <Gary M> Also FOSS in C |
17:52:30 | FromDiscord | <treeform> I want to reach understanding more so then ship a finally product. |
17:52:37 | FromDiscord | <treeform> (edit) "finally" => "final" |
17:53:28 | Mister_Magister | i'm back! How do you convert string into int64? |
17:53:30 | FromDiscord | <Gary M> <https://github.com/slembcke/Chipmunk2D> |
17:53:43 | FromDiscord | <Yardanico> $ |
17:53:49 | FromDiscord | <Yardanico> hello Mister_Magister btw |
17:53:56 | FromDiscord | <Yardanico> you might remember me as "Benzands" from telegram :P |
17:54:03 | Mister_Magister | doesn't $ do the opposite |
17:54:06 | FromDiscord | <Gary M> I think he means the other way, string > int |
17:54:10 | FromDiscord | <Yardanico> ah, sorry |
17:54:10 | Mister_Magister | yeah |
17:54:12 | FromDiscord | <Yardanico> parseInt from strutils then |
17:54:22 | FromDiscord | <Yardanico> parseBiggestInt |
17:54:26 | Mister_Magister | but doesn't that convert into int and not |
17:54:27 | Mister_Magister | got it |
17:54:59 | Mister_Magister | thanks! |
17:57:57 | FromDiscord | <dom96> That was a fun discussion 🙂 |
18:00:28 | * | xioren joined #nim |
18:00:35 | Mister_Magister | :P |
18:05:16 | giaco_ | 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:46 | FromDiscord | <dom96> `nimble c -d:ssl` should work |
18:05:58 | FromDiscord | <dom96> but you should put `-d:ssl` in a nim.cfg (or config.nims) file |
18:07:15 | Mister_Magister | I want to load file into variable and have it available globally but i think it isn't gcsafe and nim is complaining… |
18:07:32 | giaco_ | thanks |
18:07:55 | Mister_Magister | is not GC-safe as it accesses 'variable' which is a global using GC'ed memory |
18:08:01 | FromDiscord | <Yardanico> @Mister_Magister it should be just fine as long as you're not using threads |
18:08:09 | Mister_Magister | Yardanico: i am |
18:10:01 | Mister_Magister | how do i fix it with threads |
18:10:07 | FromDiscord | <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:17 | FromDiscord | <Yardanico> https://forum.nim-lang.org/ |
18:12:23 | FromDiscord | <Yardanico> here's an example :) |
18:12:29 | FromDiscord | <Yardanico> or https://stardust.dev |
18:12:39 | FromDiscord | <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:02 | Mister_Magister | i got it! i changed let to const |
18:13:05 | Mister_Magister | now its gcsafe |
18:13:11 | FromDiscord | <Yardanico> it'll read the file at compile time now though |
18:13:23 | FromDiscord | <Yardanico> if that's ok with you then fine :) |
18:14:45 | FromDiscord | <Yardanico> @queersorceress https://github.com/pragmagic/karax/ |
18:14:52 | * | pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
18:14:52 | FromDiscord | <Yardanico> https://github.com/nim-lang/nimforum/tree/master/src/frontend |
18:15:01 | FromDiscord | <Yardanico> stardust is not open source but it's nims' js backend |
18:15:56 | * | pbb joined #nim |
18:16:10 | FromDiscord | <Yardanico> well, parts of it are - e.g. https://github.com/dom96/gamelight |
18:18:24 | FromDiscord | <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:40 | FromDiscord | <Yardanico> have you seen https://nim-lang.org/docs/jsffi.html ? |
18:19:04 | FromDiscord | <Yardanico> https://github.com/andreaferretti/react.nim |
18:19:47 | FromDiscord | <Yardanico> and gamelight uses browser APIs so I'm not sure what you consider "external js" |
18:20:09 | FromDiscord | <Yardanico> there's no real difference between browser APIs or other JS libraries, you make bindings to them the same way |
18:21:31 | FromDiscord | <juan_carlos> Nim does dom stuff |
18:21:46 | FromDiscord | <juan_carlos> and dynamic pages |
18:22:00 | FromDiscord | <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:13 | FromDiscord | <Yardanico> well, that's the point of the JS backend |
18:22:24 | FromDiscord | <Yardanico> its main purpose is for website frontends, not to be used with nodejs |
18:23:30 | FromDiscord | <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:04 | FromDiscord | <Yardanico> I'm not a webdev so I can't reply to that, sorry |
18:24:09 | FromDiscord | <Yardanico> but nim just builds to a standalone JS file |
18:24:16 | FromDiscord | <Yardanico> you can then use that with whatever tool you want |
18:24:24 | * | rockcavera joined #nim |
18:25:53 | FromDiscord | <juan_carlos> nim js is for browser |
18:25:57 | FromDiscord | <Yardanico> that |
18:26:02 | FromDiscord | <Yardanico> 's what I said above :P |
18:26:06 | FromDiscord | <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:25 | FromDiscord | <Yardanico> did you check react.nim I linked? |
18:26:50 | FromDiscord | <Yardanico> did you check jsffi's example itself? it shows a simple example of using jquery |
18:27:13 | FromDiscord | <Yardanico> which is a non-node js library |
18:27:17 | * | tane joined #nim |
18:27:22 | FromDiscord | <Yardanico> there's a lot of js modules in the stdlib too |
18:27:30 | FromDiscord | <Yardanico> and they're all made for the browser, not node |
18:27:56 | FromDiscord | <Yardanico> https://nim-lang.org/docs/jsconsole.html |
18:27:56 | FromDiscord | <Yardanico> https://nim-lang.org/docs/jscore.html |
18:28:10 | FromDiscord | <Yardanico> etc |
18:29:25 | FromDiscord | <Yardanico> i'm just not getting your question I guess, sorry :P |
18:29:58 | FromDiscord | <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:09 | FromDiscord | <Yardanico> so almost all code you'll see that uses the nim js backend is made for the browser |
18:30:31 | FromDiscord | <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:05 | FromDiscord | <queersorceress> right, and i plan to use this in the browser, sorry if that wasn't clear. |
18:31:33 | FromDiscord | <juan_carlos> queer, maybe useful https://github.com/nim-lang/Nim/wiki/Nim-for-TypeScript-Programmers#JavaScript-Interoperability |
18:31:33 | FromDiscord | <queersorceress> i just don't want and example that depends on an additional runtime |
18:31:45 | FromDiscord | <Yardanico> ????? |
18:31:54 | FromDiscord | <Yardanico> all examples I linked are for the browser |
18:32:13 | FromDiscord | <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:31 | FromDiscord | <Yardanico> you can just check - https://github.com/nim-lang/Nim/blob/version-1-4/lib/js/jsconsole.nim |
18:32:49 | FromDiscord | <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:55 | FromDiscord | <dom96> the `dom` module is pretty easy to follow |
18:34:01 | FromDiscord | <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:08 | FromDiscord | <dom96> also gamelight's canvas module |
18:34:15 | FromDiscord | <dom96> if you want something shorter |
18:34:19 | FromDiscord | <dom96> it wraps HTML5 canvas |
18:35:14 | * | leorize joined #nim |
18:35:47 | FromDiscord | <queersorceress> oh, i totally missed that as i didn't see a .js file along side. |
18:42:44 | FromDiscord | <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:08 | FromDiscord | <dom96> I am hoping to eventually do a write up on Stardust, anybody any thoughts on what I should cover? |
18:44:16 | Prestige | dom: I'd be most interested in the networking aspect |
18:44:49 | Mister_Magister | Function i want to use has many default parameters and i want to only set one of them. Can i achieve it somehow? |
18:44:57 | FromDiscord | <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:13 | Prestige | Mister_Magister: foo(a = 1) |
18:45:19 | Mister_Magister | thanks |
18:46:23 | FromDiscord | <juan_carlos> Yes, karax does not serve anything by itself. |
18:47:19 | FromDiscord | <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:29 | FromDiscord | <Yardanico> you can use the server rendering of it |
18:56:31 | FromDiscord | <dom96> In reply to @Prestige "dom: I'd be most": makes sense, I'll try to focus on that |
18:56:38 | FromDiscord | <Yardanico> but maybe you want to use the C backend instead? why JS? |
19:00:41 | haxscramper | No C++20 on playground C++ compiler? |
19:02:31 | ForumUpdaterBot | New 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:35 | Prestige | @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:19 | FromDiscord | <Yardanico> https://github.com/beef331/nimscripter/blob/master/tests/test.nim |
19:23:27 | FromDiscord | <Yardanico> https://github.com/beef331/nimscripter/blob/master/tests/exportedprocs.nim |
19:23:50 | FromDiscord | <ElegantBeef> Yep `{.exportToScript.}` is the way to live |
19:24:12 | Prestige | Hm maybe I could fiddle with that for my use case |
19:24:47 | FromDiscord | <ElegantBeef> You basically have to use procs for all the interaction |
19:27:18 | FromDiscord | <ElegantBeef> You can export code verbatim to nimscript using the `exportCode` macro, which is nice for when you want shared type definitions |
19:28:09 | Prestige | Placing a typedef in that block still declares it for the nim program? |
19:28:17 | FromDiscord | <ElegantBeef> yea |
19:28:21 | Prestige | Neat |
19:28:25 | Prestige | great work on this btw |
19:28:30 | FromDiscord | <ElegantBeef> Thanks |
19:28:57 | FromDiscord | <ElegantBeef> The stdlib i ship on the repo is a very very minimal one, so not all things are supported |
19:29:10 | FromDiscord | <ElegantBeef> But you can always add more modules from the nim stdlib manually |
19:33:47 | FromDiscord | <Gary M> hi beef |
19:33:50 | FromDiscord | <ElegantBeef> Hello |
19:34:08 | FromDiscord | <Yardanico> hi meat |
19:34:09 | FromDiscord | <Gary M> is there a not implemented pragma or similar |
19:34:11 | FromDiscord | <Yardanico> im beef |
19:34:19 | FromDiscord | <Yardanico> @Gary M for Nim in general? |
19:34:27 | FromDiscord | <Yardanico> you can use `{.error.}` |
19:34:50 | FromDiscord | <ElegantBeef> Yep, or a discard stmt, and silently do fuckall |
19:34:50 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual.html#pragmas-error-pragma |
19:35:08 | FromDiscord | <Gary M> I'm using discard to prototype the functions 😄 |
19:35:12 | FromDiscord | <Gary M> error should work |
19:35:28 | FromDiscord | <Yardanico> when you try to call them it'll be an error though :) |
19:35:30 | FromDiscord | <Yardanico> that's the point |
19:35:34 | FromDiscord | <Gary M> I know |
19:35:46 | FromDiscord | <ElegantBeef> It'd take all of 3 seconds to make a macro for this |
19:35:46 | FromDiscord | <Gary M> There are a few procs I'm not going to fully implement right now probably |
19:35:58 | FromDiscord | <Gary M> what kind of macro? |
19:36:31 | FromDiscord | <Yardanico> don't worry he just spent too much time in the macroworld |
19:36:46 | FromDiscord | <Yardanico> so he has a few days of withdrawal |
19:36:49 | FromDiscord | <Gary M> lol |
19:39:49 | FromDiscord | <ElegantBeef> Psh |
19:39:59 | FromDiscord | <ElegantBeef> If you arent using macros you might as well be using scratch 😛 |
19:42:06 | FromDiscord | <Gary M> `{.pragma: notimpl, error: "Not Implemented".}` |
19:42:08 | FromDiscord | <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:09 | FromDiscord | <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:27 | FromDiscord | <Seedofarson> ReactJS hurts my internals |
20:43:37 | FromDiscord | <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:32 | FromDiscord | <ElegantBeef> Prestige any issues so far with nimscripter? |
22:26:40 | * | fredrikhr quit (Quit: Client Disconnecting) |
22:29:08 | FromDiscord | <Hi02Hi> In reply to @Gary M "What's everyone working on?": Im trying to make a bigint lib for fun. |
22:30:47 | FromDiscord | <Gary M> In reply to @Hi02Hi "Im trying to make": Pretty cool. What's that like 128 ints? |
22:31:00 | FromDiscord | <Hi02Hi> arbitrary size |
22:31:04 | FromDiscord | <Gary M> Oh |
22:31:14 | FromDiscord | <Gary M> I only know bigint from like postgres |
22:31:32 | FromDiscord | <Hi02Hi> kinda like pythons ints |
22:31:48 | FromDiscord | <Hi02Hi> except not fast at all |
22:32:59 | FromDiscord | <Hi02Hi> i felt nice that i found a way to init from all varieties of ints unlike bigints |
22:35:03 | Prestige | Haven't tried yet, will tonight |
22:36:09 | FromDiscord | <Hi02Hi> hopefully you find a nicer way than me, i used cast |
22:36:24 | FromDiscord | <ElegantBeef> Nim will soon super user defined literals |
22:36:32 | FromDiscord | <ElegantBeef> (edit) "super" => "support" |
22:36:51 | FromDiscord | <ElegantBeef> Isnt there a module with things like printf and others directly wrapped? |
22:36:55 | FromDiscord | <Hi02Hi> like i10 or sth? |
22:37:05 | FromDiscord | <ElegantBeef> more like `10'bignum` |
22:37:33 | FromDiscord | <ElegantBeef> https://github.com/nim-lang/Nim/pull/17020 |
22:37:46 | FromDiscord | <ElegantBeef> That PR will enable stuff like that |
22:39:20 | giaco_ | any experience in using vscode + "format on save" (nimpretty)? |
22:39:46 | giaco_ | I successfully format my code with right click -> format, but editor conf "format on save" seems ignored |
22:43:20 | giaco_ | wait, it works, but not on every nim source file. Seems that it doesnt like dsl |
22:43:45 | FromDiscord | <Hi02Hi> i meant i can init from int and int8 and uint32 and all the others |
22:44:36 | FromDiscord | <ElegantBeef> Oh you mean explictly convert? |
22:45:43 | FromDiscord | <Hi02Hi> yeah |
22:58:25 | * | j joined #nim |
23:03:13 | * | j is now known as jess |
23:10:41 | giaco_ | how can I get value from tuple using string variable as key? |
23:11:39 | FromDiscord | <ElegantBeef> The string is a constant? |
23:11:46 | giaco_ | no |
23:11:56 | FromDiscord | <ElegantBeef> Well then a case stmt |
23:13:44 | giaco_ | mmm, thanks |
23:14:05 | giaco_ | probably I need to tackle the problem from a different point of view |
23:19:53 | FromDiscord | <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:08 | giaco_ | I'm quite interested in following the nim + pi pico feed. Where's the center of gravity of this matter? |
23:21:57 | FromDiscord | <ElegantBeef> There is an embedded channel, but i mean i'm the only here i know of attempting this |
23:22:58 | giaco_ | do you mean ##embedded or something more nim specific? |
23:23:12 | FromDiscord | <ElegantBeef> #nim-embedded |
23:24:37 | giaco_ | thanks |