00:04:45 | * | def- quit (Quit: -) |
00:06:02 | * | def- joined #nim |
00:06:42 | FromDiscord | <Elegantbeef> This is quite odd, my bindings of wasmedge suddenly dont work for anything but my tests |
00:25:53 | FromDiscord | <Elegantbeef> Ok so i downloaded a different .so and now everything is broken good |
00:28:43 | FromDiscord | <Elegantbeef> @Rika\: do you remember the name of that one wasm runtime you asked me about? |
00:33:55 | * | agentwa joined #nim |
00:52:42 | * | krux02 quit (Remote host closed the connection) |
01:08:35 | FromDiscord | <Rika> Do I? |
01:09:02 | FromDiscord | <Elegantbeef> Disregard that i think i found it but ugh it doesnt seem to be usable as a system library |
01:09:08 | FromDiscord | <Elegantbeef> Wasmedge really is driving me up the wall |
01:13:22 | FromDiscord | <Nalmyth> sent a code paste, see https://play.nim-lang.org/#ix=48y8 |
01:13:40 | FromDiscord | <Nalmyth> (edit) "https://play.nim-lang.org/#ix=48y8" => "https://play.nim-lang.org/#ix=48y9" |
01:14:25 | FromDiscord | <Elegantbeef> `QueueItem(query: query` |
01:15:30 | FromDiscord | <Nalmyth> Hmm, then it's giving me `Error: cannot evaluate at compile time: query` |
01:15:32 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=48ya |
01:15:47 | FromDiscord | <!Patitotective> then do not make it a const (?) |
01:15:47 | FromDiscord | <Elegantbeef> you're using `const` |
01:15:57 | FromDiscord | <Nalmyth> Oh đ€Šââïž |
01:16:03 | FromDiscord | <Nalmyth> Thank you đ |
01:16:23 | FromDiscord | <!Patitotective> you may want to create your own `initQueueItem` procedure so you don't need to name the fields |
01:16:44 | FromDiscord | <Nalmyth> I was trying to create a `with-queue` using body |
01:17:07 | FromDiscord | <Nalmyth> But the body didn't fold up nicely to go in the `on_complete` |
01:17:18 | FromDiscord | <Nalmyth> (edit) "`with-queue`" => "`template with-queue`" |
01:19:25 | FromDiscord | <Elegantbeef> What were you after? |
01:19:31 | FromDiscord | <Nalmyth> Thank you working now đ |
01:20:27 | FromDiscord | <Nalmyth> sent a code paste, see https://play.nim-lang.org/#ix=48yb |
01:20:28 | FromDiscord | <Nalmyth> I was looking at something like that |
01:20:48 | FromDiscord | <Elegantbeef> change the parameter names so they dont match anything inside |
01:21:06 | FromDiscord | <Elegantbeef> `query: query` will replace what ever you passed in as that parameter and have that in there |
01:21:25 | FromDiscord | <Nalmyth> Aha I see, I will try that |
01:25:29 | FromDiscord | <Nalmyth> sent a code paste, see https://play.nim-lang.org/#ix=48yc |
01:25:37 | FromDiscord | <Nalmyth> Hmm đ€ now my QUEUE is in global scope outside of the template I guess |
01:25:51 | FromDiscord | <Nalmyth> I guess I can pass the queue around |
01:26:56 | FromDiscord | <Nalmyth> Perhaps anyone knows of a prebuilt queue for nim?â”â”Basically [fn, fn, fn] processing and later callbacks |
01:26:59 | FromDiscord | <Nalmyth> (edit) "nim?â”â”Basically" => "nim?â”Basically" |
01:27:09 | FromDiscord | <Nalmyth> (edit) "Perhaps anyone knows of a prebuilt queue for nim?â”Basically [fn, fn, fn] ... processing" added "serial" |
01:27:26 | FromDiscord | <Elegantbeef> Do not know what you mean |
01:28:27 | FromDiscord | <!Patitotective> perhaps https://nimble.directory/search?query=queue |
01:29:37 | FromDiscord | <Elegantbeef> I really wish i could read at this point, would be more sane to write a wasm runtime myself than fight with this runtime |
01:31:26 | FromDiscord | <Nalmyth> sent a code paste, see https://play.nim-lang.org/#ix=48ye |
01:31:45 | FromDiscord | <Nalmyth> (edit) "https://play.nim-lang.org/#ix=48ye" => "https://play.nim-lang.org/#ix=48yf" |
01:32:19 | FromDiscord | <Nalmyth> (edit) "https://play.nim-lang.org/#ix=48yf" => "https://play.nim-lang.org/#ix=48yg" |
01:32:38 | FromDiscord | <Nalmyth> (edit) "https://play.nim-lang.org/#ix=48yg" => "https://paste.rs/oYX" |
01:32:44 | FromDiscord | <Elegantbeef> So just a sequence? |
01:32:47 | FromDiscord | <Elegantbeef> Or is this FIFO? |
01:32:51 | FromDiscord | <Nalmyth> (edit) "https://play.nim-lang.org/#ix=48yi" => "https://play.nim-lang.org/#ix=48yh" |
01:32:53 | FromDiscord | <Nalmyth> FIFO yea |
01:33:04 | FromDiscord | <Nalmyth> Like a task scheduler without any bells or whistles |
01:33:37 | FromDiscord | <Elegantbeef> Perhaps `std/deques`? |
01:33:47 | FromDiscord | <Elegantbeef> I dont know, i dont often use queues i normally have stacks |
01:34:25 | FromDiscord | <Nalmyth> In reply to @Elegantbeef "Perhaps `std/deques`?": Yea I've got it running under the hood of the one I'm building now |
01:34:48 | FromDiscord | <Nalmyth> I see most of the async libraries add a lot of complexity at the moment |
01:34:57 | FromDiscord | <Nalmyth> Since we have real threads might as well use them |
01:35:13 | FromDiscord | <Elegantbeef> Your data type is two closure procedures probably |
01:35:15 | FromDiscord | <Rika> Threads will add more complexity than async |
01:35:57 | FromDiscord | <Nalmyth> Yea my idea was to push them onto a worker thread in a `with_queue` call |
01:36:05 | FromDiscord | <Nalmyth> And the body of the template is the worker function |
01:36:36 | FromDiscord | <Nalmyth> So you can abstract all the threads away and just keep that in the template area |
01:36:53 | FromDiscord | <Elegantbeef> Well then i'd just use a channel, but the issue now becomes sharing resources across threads |
01:37:08 | FromDiscord | <Elegantbeef> Like you cannot reliably pass closures across threads |
01:37:10 | FromDiscord | <Nalmyth> Yea nanomsg is good for this it's true |
01:37:34 | FromDiscord | <Elegantbeef> Who said anything about nanomsg |
01:37:52 | FromDiscord | <Nalmyth> Could just iproc:// to a bus |
01:37:58 | FromDiscord | <Nalmyth> Would be not so nim style though đ
|
01:38:01 | FromDiscord | <Rika> ? |
01:38:08 | FromDiscord | <Elegantbeef> Could just use the builtin channels since that's what you're doing |
01:38:10 | FromDiscord | <Nalmyth> (edit) "iproc://" => "`iproc://`" |
01:38:11 | FromDiscord | <Rika> That doesnât change anything, I think |
01:38:17 | FromDiscord | <Elegantbeef> Channels are FIFO queues for cross thread communication |
01:38:18 | FromDiscord | <Nalmyth> In reply to @Elegantbeef "Could just use the": Oh we have? |
01:38:20 | FromDiscord | <Nalmyth> Cool |
01:38:36 | FromDiscord | <Elegantbeef> I'm fairly certain they're FIFO |
01:38:52 | FromDiscord | <Nalmyth> Could be nice to have TCP ability later đ€ |
01:38:54 | FromDiscord | <Rika> Theyâre unidirectional |
01:39:00 | FromDiscord | <Rika> Just in case you donât know |
01:39:02 | FromDiscord | <Nalmyth> Ah |
01:39:19 | FromDiscord | <Rika> You need two channels to communicate between two threads |
01:39:37 | FromDiscord | <Nalmyth> So forward one and backward one |
01:40:11 | FromDiscord | <Nalmyth> Could be nice to just move everything to a forward pipeline |
01:41:26 | FromDiscord | <Nalmyth> I guess both of these actions don't really solve the `with_queue` so well though |
01:41:31 | FromDiscord | <Nalmyth> (edit) "actions" => "choices" |
01:59:22 | FromDiscord | <!&luke> sshâd into my laptop so I can almost natively use nim on my phone https://media.discordapp.net/attachments/371759389889003532/1012179349220372602/IMG_2076.png |
01:59:43 | FromDiscord | <!&luke> Also thatâs inim |
02:02:30 | FromDiscord | <!&luke> Building a project https://media.discordapp.net/attachments/371759389889003532/1012180138915528795/IMG_2076.png |
02:02:45 | FromDiscord | <!&luke> Building a project https://media.discordapp.net/attachments/371759389889003532/1012180198592086036/IMG_2077.png |
02:04:48 | * | arkurious quit (Quit: Leaving) |
02:08:05 | FromDiscord | <Rika> Is it native if youâre remotely logged into the laptop |
02:25:41 | FromDiscord | <!&luke> In reply to @Rika "Is it native if": No itâs over ssh |
02:25:53 | FromDiscord | <!&luke> I can get a native version too |
02:28:58 | FromDiscord | <!&luke> In reply to @ripluke "I can get a": Hmm⊠https://media.discordapp.net/attachments/371759389889003532/1012186796693659679/IMG_2081.png |
02:29:17 | FromDiscord | <!&luke> I guess I can only use it over ssh |
02:38:48 | * | agentwa quit (Quit: Client closed) |
02:40:14 | * | derpydoo quit (Quit: derpydoo) |
02:50:17 | FromDiscord | <Rika> In reply to @ripluke "No itâs over ssh": Thatâs what I mean |
02:50:33 | FromDiscord | <Rika> SSH almost always mean remote is it not? |
02:50:40 | FromDiscord | <Rika> Unless your phone is your laptop |
03:28:49 | FromDiscord | <!&luke> It is remote |
03:29:08 | FromDiscord | <!&luke> Ssh is basically me connecting to my pc over an encrypted connection |
03:31:25 | FromDiscord | <Rika> Oh I misread |
03:31:38 | FromDiscord | <Rika> So yeah what does âalmost nativelyâ mean here xd |
04:08:26 | FromDiscord | <b1rdf00d> there's ish terminal for ios which runs alpine linux. Not native but it is on your phone |
04:09:21 | FromDiscord | <b1rdf00d> It'd be pretty cool to make a custom auto complete keyboard to provide code auto complete prompts |
04:14:28 | FromDiscord | <creikey> how do I make a reference to an object without it being a reference counted object |
04:14:39 | FromDiscord | <Elegantbeef> you use `ptr` |
04:14:45 | FromDiscord | <creikey> aw man but those unsafe |
04:14:45 | FromDiscord | <Elegantbeef> And cry at all the things that unsafe code gives you |
04:15:04 | FromDiscord | <Elegantbeef> Welcome to not having view types done |
04:15:13 | FromDiscord | <creikey> is this nim 2.0? |
04:15:24 | FromDiscord | <Elegantbeef> 2.X but yes soon tm |
04:15:50 | FromDiscord | <creikey> man how does nim get really good it's got so much annoying stuff right now and seems to move slow |
04:15:59 | FromDiscord | <creikey> is it like some company invests in it? |
04:17:31 | FromDiscord | <creikey> I guess it has less annoying stuff than a lot of other languages some of them mainstrema |
04:17:34 | FromDiscord | <creikey> (edit) "mainstrema" => "mainstream" |
04:24:15 | FromDiscord | <Rika> Nim doesnât have enough devs nor supporters Iâd say |
04:24:33 | FromDiscord | <creikey> I so badly wish nim had like a really good debugger |
04:26:36 | FromDiscord | <Rika> Wish harder to the point you implement it |
04:27:04 | FromDiscord | <creikey> In reply to @Rika "Wish harder to the": I would if I had time. I really really wish I had that clock thing from harry potter so I could like pause the world and program as much as I wanted to |
04:27:18 | FromDiscord | <creikey> I think it would take me a long time to make something like that good too |
04:27:25 | FromDiscord | <creikey> (edit) "too" => "too, I'm still kind of inexperienced" |
04:27:43 | FromDiscord | <creikey> I also don't make good engineering decisions a lot still |
04:27:45 | FromDiscord | <Rika> Even if you were generally experienced it is difficult to create a debugger |
04:28:06 | FromDiscord | <creikey> In reply to @Rika "Even if you were": it is definitely a smaller task than the whole nim compiler though |
04:28:11 | FromDiscord | <creikey> like nimsuggest is a starting point right |
04:28:13 | FromDiscord | <Rika> Of course |
04:28:26 | FromDiscord | <Rika> But it is not much smaller compared to whatever else |
04:28:30 | FromDiscord | <creikey> to be honest I'm not even sure how I would even begin to do something like that, I don't know how debuggers are implemented |
04:28:42 | FromDiscord | <Rika> Nim suggest is a behemoth if you havenât heard |
04:28:45 | FromDiscord | <creikey> oh god |
04:28:58 | FromDiscord | <Rika> Why do you think no one works on it |
04:29:01 | FromDiscord | <creikey> it's only 1000 files |
04:29:02 | FromDiscord | <creikey> (edit) "files" => "lines" |
04:29:03 | FromDiscord | <creikey> lol |
04:29:27 | FromDiscord | <creikey> (edit) "lol ... " added "imagine if it was 1000 files" |
04:29:47 | FromDiscord | <Elegantbeef> Nim suggest uses the compiler |
04:29:59 | FromDiscord | <creikey> so it's a mess by virtue of depending on the compiler? |
04:29:59 | FromDiscord | <Elegantbeef> So even if it doesnt look like it's big it's the compiler |
04:30:19 | FromDiscord | <Elegantbeef> Sure |
04:30:53 | FromDiscord | <Rika> The compiler library API has to improve alongside the suggestion engine |
04:31:15 | FromDiscord | <Elegantbeef> Eh the suggestion engine is embedded inside the compiler |
04:31:23 | FromDiscord | <Elegantbeef> `when defined(nimSuggest): suggest X` |
04:31:34 | FromDiscord | <creikey> In reply to @Elegantbeef "`when defined(nimSuggest): suggest X`": no way |
04:31:43 | FromDiscord | <Elegantbeef> No way |
04:31:58 | FromDiscord | <Elegantbeef> To quote everyone's favourite tech nomad, you're blowing my mind |
04:31:58 | FromDiscord | <Rika> In reply to @Elegantbeef "Eh the suggestion engine": Well I meant that it would be best to decouple them more |
04:32:06 | FromDiscord | <Rika> Then again Iâm not sure how that would even be done |
04:32:12 | FromDiscord | <creikey> In reply to @Elegantbeef "To quote everyone's favourite": what is this a referenc eto? |
04:32:15 | FromDiscord | <creikey> (edit) "referenc eto?" => "reference to?" |
04:32:21 | FromDiscord | <creikey> In reply to @Elegantbeef "`when defined(nimSuggest): suggest X`": I don't see this anywhere in the source |
04:32:55 | FromDiscord | <Elegantbeef> I was referencing disruptek an banned nim programmer |
04:33:06 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/search?q=defined%28nimsuggest%29 |
04:33:21 | FromDiscord | <creikey> In reply to @Elegantbeef "https://github.com/nim-lang/Nim/search?q=defined%28": I'm bad at asearchign |
04:33:51 | FromDiscord | <Rika> In reply to @Elegantbeef "I was referencing disruptek": A |
04:34:07 | FromDiscord | <Elegantbeef> yea i was going to write something else but didnt delete enough |
04:34:08 | FromDiscord | <Elegantbeef> Shoot me |
04:34:12 | FromDiscord | <Rika> Okay |
04:34:17 | FromDiscord | <Rika> Where would you prefer? |
04:34:36 | FromDiscord | <Elegantbeef> Anywhere above the eyes |
04:41:21 | FromDiscord | <Prestige> Is there a way to have an index as part of any iterator? Specifically I'm looking to use it with the `lines` iterator which returns lines of a file |
04:41:30 | FromDiscord | <Prestige> I assume I just have to track a var externally though |
04:41:36 | FromDiscord | <Elegantbeef> `import std/enumerate` |
04:45:32 | FromDiscord | <Prestige> Ty |
05:16:56 | FromDiscord | <Bung> https://github.com/bung87/webview2/blob/1bc58773343ca9931937fa208883a78913e99c4e/src/webview2/loader.nim#L143 why the envCompletedHandler addr changed it passed from two procs |
06:03:09 | * | cyraxjoe quit (Ping timeout: 268 seconds) |
06:08:44 | FromDiscord | <ShalokShalom> This talk references "highly customizable error messages thanks to meta-programming" |
06:08:48 | FromDiscord | <ShalokShalom> How this? |
06:09:28 | FromDiscord | <Elegantbeef> What talk? |
06:09:34 | FromDiscord | <ShalokShalom> Wait |
06:10:04 | FromDiscord | <ShalokShalom> Its early in the morning here |
06:10:08 | FromDiscord | <ShalokShalom> Ah, its about the types |
06:10:17 | FromDiscord | <ShalokShalom> https://youtu.be/d2VRuZo2pdA |
06:11:00 | FromDiscord | <Elegantbeef> I mean you can implement your own compiler passes so one could argue metaprogramming does give cusutomizable error messages |
06:11:11 | FromDiscord | <Elegantbeef> But it'd be a bad argument |
06:17:47 | FromDiscord | <Bung> In reply to @Bung "https://github.com/bung87/webview2/blob/1bc58773343": @ElegantBeef Could you take a took at this ? it's maybe my silly mistake |
06:17:55 | FromDiscord | <Elegantbeef> At what? |
06:18:12 | * | cyraxjoe joined #nim |
06:18:40 | FromDiscord | <Bung> a ptr t pass into here and its addr changed |
06:19:01 | FromDiscord | <Elegantbeef> If you posted something it didnt get to matrix |
06:20:11 | FromDiscord | <Bung> browser.nim:126 -> CreateCoreWebView2EnvironmentWithOptions -> CreateWebViewEnvironmentWithClientDll |
06:20:54 | FromDiscord | <Bung> https://github.com/bung87/webview2/blob/1bc58773343ca9931937fa208883a78913e99c4e/src/webview2/loader.nim#L143 |
06:22:41 | FromDiscord | <Elegantbeef> So what's happening? |
06:23:11 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "I mean you can": That's cool |
06:23:31 | FromDiscord | <ShalokShalom> Why do you think its a bad argument to do it with meta programming? |
06:23:54 | FromDiscord | <Elegantbeef> It's a bad argument in Nim cause you'd need to put your code into a macro block to get that, or use term rewriting macros |
06:25:27 | FromDiscord | <Bung> environmentCompletedHandler addr1:1920884539504 -> envCompletedHandler:ptr 000001bf3da40070 |
06:25:54 | FromDiscord | <Elegantbeef> I'm going to need you to use your words |
06:26:06 | FromDiscord | <Bung> it complely changed to another thing |
06:26:29 | FromDiscord | <ShalokShalom> And what has static resource management to do with that? |
06:26:34 | FromDiscord | <ShalokShalom> đ |
06:27:03 | FromDiscord | <ShalokShalom> Any videos of Nim you find especially good? |
06:27:17 | FromDiscord | <Bung> the environmentCompletedHandler I created addr is 1920884539504 when pass into there I echo the param it change to anther thing |
06:27:30 | * | PMunch joined #nim |
06:28:40 | FromDiscord | <Bung> sent a code paste, see https://play.nim-lang.org/#ix=48yV |
06:29:29 | FromDiscord | <Elegantbeef> It only makes sense that it changes where it points if you pass in a `var ptr T` |
06:29:39 | FromDiscord | <Elegantbeef> pointers should be passed by copy |
06:31:04 | FromDiscord | <Bung> but I never re assign it |
06:31:17 | FromDiscord | <Elegantbeef> Ok then it expects a `ptr ptr` and you're giving it just a `ptr` |
06:31:33 | FromDiscord | <Elegantbeef> If you arent changing it, it means the call you're calling is |
06:33:35 | FromDiscord | <Bung> I copyed same type definition from c/c++ code |
06:35:27 | FromDiscord | <Bung> browser.nim:126 -> CreateCoreWebView2EnvironmentWithOptions -> CreateWebViewEnvironmentWithClientDll , look here it changed only inside CreateWebViewEnvironmentWithClientDll |
06:35:42 | FromDiscord | <Elegantbeef> Well i cannot say anything |
06:35:44 | FromDiscord | <Elegantbeef> So have fun |
06:36:00 | FromDiscord | <Bung> I also echo inside CreateCoreWebView2EnvironmentWithOptions it's same address |
06:37:09 | FromDiscord | <Bung> okay. Thanks~ |
06:38:03 | * | Guest59 joined #nim |
06:40:05 | * | skandal left #nim (#nim) |
06:40:05 | Guest59 | Hi to all! |
06:40:06 | Guest59 | Please, can you help me understand why this simple program is not working? |
06:40:06 | Guest59 | type |
06:40:07 | Guest59 | Â StrawStack[T] = ref object |
06:40:07 | Guest59 | Â Â data: ptr seq[T] |
06:40:08 | Guest59 | proc newStack[T](size: int): ref StrawStack[T] = |
06:40:09 | Guest59 | Â new result |
06:40:09 | Guest59 | Â var s = newSeq[T](size) |
06:40:09 | Guest59 | Â result.data = s.addr # this gives SIGSEGV |
06:40:10 | Guest59 | when isMainModule: |
06:40:10 | Guest59 | Â var s = newStack[int](3) |
06:40:27 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/ |
06:41:11 | Guest59 | https://play.nim-lang.org/#ix=48yZ |
06:41:13 | FromDiscord | <Elegantbeef> You're unsafely using a ref though |
06:41:50 | FromDiscord | <Elegantbeef> `s` is on the stack so `result.data = s.addr` is unsafe |
06:41:51 | Guest59 | Before this I tried using normal ref (not pointers) but couldn't get through |
06:41:59 | FromDiscord | <Elegantbeef> Why are you not doing `ref seq[T]`? |
06:42:43 | Guest59 | and how I can assign var s = newSeq[T](size) to result.data? |
06:43:06 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=48z0 |
06:43:09 | FromDiscord | <Elegantbeef> There were a few issues |
06:43:21 | FromDiscord | <Elegantbeef> `ref StrawStack[T]` means you have a `ref ref object` |
06:43:27 | FromDiscord | <Elegantbeef> So you'd need to `new` both of those |
06:43:55 | FromDiscord | <Elegantbeef> `ptr seq[T]` is only safe if you know what you're doing with Refc, with orc/arc you cannot do that safely |
06:45:44 | Guest59 | Ahh! that's the point, right: `ref StrawStack[T]` is ref ref |
06:46:17 | FromDiscord | <Elegantbeef> For some reason people really stumble on the `ref object` đ |
06:47:28 | FromDiscord | <Elegantbeef> This dumpster fire of a forum post did the same https://forum.nim-lang.org/t/9397 |
06:47:36 | FromDiscord | <Elegantbeef> Inb4 this "guest59" is said person |
06:48:47 | Guest59 | I cannot understand what seems a double initialization of `result.data`: first you initialize it in `data: new(ref seq[T])` and than you assign a new sequence |
06:49:16 | FromDiscord | <Elegantbeef> You need to allocate the `ref` then the seq |
06:50:00 | FromDiscord | <Elegantbeef> `ref` in Nim is a heap allocated managed pointer |
06:50:11 | FromDiscord | <Elegantbeef> So you have to explicitly allocate it with either a `new` or `Type()` |
06:52:33 | Guest59 | mmm, thinking about it... |
06:53:01 | Guest59 | (not about the latest you wrote, I know about managed pointers in the heap) |
06:53:14 | FromDiscord | <Elegantbeef> I dont know anything about how a 'strawstack' works so i do not know if there is any more nim way of doing it |
06:54:06 | FromDiscord | <Elegantbeef> There isnt much reason to have a `ref` object with a `ref seq` as far as i know |
06:55:15 | FromDiscord | <Elegantbeef> I guess with refc that'd copy less than just a `seq` but with orc/arc move semantics would move that heap memory |
06:55:38 | Guest59 | The point for me is not about the StrawStack (it is just a stack that uses an internal allocated array that increases/decreases at need). |
06:55:38 | Guest59 | Is more about how ref/pointers work in nim |
06:58:37 | Guest59 | From your point of view Elegantbeef, Could be implemented like this? https://play.nim-lang.org/#ix=48z2 |
06:58:54 | Guest59 | No more `ref` only object |
06:59:34 | Guest59 | so when I create `new result` the whole StrawStack and sequence[T] are created |
07:00:19 | Guest59 | Anyway... thanks for the help, it is very appreciated |
07:00:37 | * | rockcavera quit (Remote host closed the connection) |
07:00:48 | FromDiscord | <Elegantbeef> There is still a ref |
07:01:46 | FromDiscord | <Elegantbeef> `new` heap allocates value types |
07:01:59 | FromDiscord | <Elegantbeef> so `assert typeof(new int) is (ref int)` |
07:02:45 | Guest59 | I see |
07:03:25 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=48z5 |
07:03:31 | FromDiscord | <Elegantbeef> Is how you'd do it without any references |
07:04:55 | FromDiscord | <pongsu> proc newDatabase(filename = "test.db"): Database =â” new resultâ” result.db = open(filename, "", "", "") |
07:04:57 | Guest59 | I see... another little question: in nim to have let's say a `constructor` I should use a proc like I did, right? |
07:05:16 | FromDiscord | <Rika> Pretty much yes |
07:05:27 | FromDiscord | <pongsu> who can explain the "new result" mean? |
07:05:52 | Guest59 | `new result` allocates on the heap an objects from a reference, right? |
07:05:58 | FromDiscord | <Rika> It creates a new reference and sets result to that |
07:08:44 | FromDiscord | <pongsu> set result to the heap object --- Is this behavior automatic? |
07:10:23 | FromDiscord | <Rika> Itâs done by ânewâ yes |
07:10:33 | * | vicecea quit (Remote host closed the connection) |
07:11:16 | FromDiscord | <Pastor> Is there some document about "new"? |
07:11:53 | * | vicecea joined #nim |
07:12:40 | FromDiscord | <Rika> In the documentation for the module âsystemâ perhaps |
07:12:55 | FromDiscord | <Rika> Iâm being roundabout because I canât currently quickly pull the link up |
07:16:17 | FromDiscord | <Pastor> thank you, I have found the definition codes of "new" |
07:21:04 | FromDiscord | <Pastor> I want to know if the result variable is always initialized in stack? not heap? |
07:23:44 | FromDiscord | <Pastor> If the return type is object or mutable, we should "new result"? |
07:24:25 | FromDiscord | <Elegantbeef> If the return is a `ref` you need to heap allocate it |
07:25:46 | FromDiscord | <Pastor> I see, thanks |
07:28:41 | * | agentwa joined #nim |
07:29:52 | * | agentwa quit (Client Quit) |
07:42:07 | FromDiscord | <impbox [ftsf]> hmm, can't do method operators it seems? |
07:58:26 | * | Guest59 quit (Quit: Client closed) |
07:58:30 | * | Vladar joined #nim |
08:02:24 | FromDiscord | <Elegantbeef> @impbox [ftsf]\: yes you can |
08:02:32 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=48zm |
08:04:10 | FromDiscord | <impbox [ftsf]> hmm, weird... =\ |
08:04:44 | FromDiscord | <impbox [ftsf]> i just removed all my method operators since it didn't seem to work and i'm in a rush |
08:04:56 | FromDiscord | <impbox [ftsf]> damn coding last minute for a live performance |
08:05:22 | FromDiscord | <Rika> GL |
08:05:23 | FromDiscord | <Elegantbeef> Even if it didnt you could've used a named procedure and a template which invoked it đ |
08:06:14 | FromDiscord | <impbox [ftsf]> yea, i just renamed to not be an operator |
08:06:59 | FromDiscord | <impbox [ftsf]> added a whole bunch of nice new features to my visuals software, but trying to rush in loading/saving before the gig |
08:07:13 | FromDiscord | <impbox [ftsf]> serialization/deserialization is still a pain >_< |
08:07:23 | FromDiscord | <Elegantbeef> frosty đ |
08:08:02 | FromDiscord | <impbox [ftsf]> ooh, handles subclasses? |
08:08:41 | FromDiscord | <Elegantbeef> Probably not |
08:08:48 | FromDiscord | <Elegantbeef> I mean it'd "work" but not as you'd want |
08:09:44 | FromDiscord | <Elegantbeef> I guess yes it'd work |
08:09:47 | * | cyraxjoe quit (Ping timeout: 252 seconds) |
08:10:04 | FromDiscord | <Elegantbeef> You'd implement a `serialise` method that does the serialising |
08:10:15 | FromDiscord | <Elegantbeef> But you'd have to override every object's serialise method |
08:10:19 | FromDiscord | <Elegantbeef> Cause well OOP sucks đ |
08:10:51 | FromDiscord | <impbox [ftsf]> yeah D: |
08:11:17 | FromDiscord | <impbox [ftsf]> that's pretty much what i'm doing now |
08:12:09 | FromDiscord | <Elegantbeef> Yep oop was a mistake |
08:12:22 | FromDiscord | <impbox [ftsf]> one day i'll learn |
08:13:13 | FromDiscord | <voidwalker> so this is the OOP was a mistake gang |
08:13:21 | FromDiscord | <Elegantbeef> Correct |
08:13:28 | FromDiscord | <Elegantbeef> There's a reason that Nim is procedural |
08:13:32 | FromDiscord | <voidwalker> I wonder what programming language discords praise OOP |
08:13:38 | FromDiscord | <Elegantbeef> C++, Java, C# |
08:13:40 | FromDiscord | <impbox [ftsf]> i'm not an oop fan, but i tend to make things that are oopy |
08:14:07 | FromDiscord | <voidwalker> oopsy |
08:14:22 | FromDiscord | <Elegantbeef> I try to avoid OOP as much as possible as it just makes everything terrible |
08:15:25 | * | cyraxjoe joined #nim |
08:16:04 | FromDiscord | <voidwalker> blah I so hate this "I can't go wrong learning Java to get a job". Everyone does it ;\ |
08:16:17 | FromDiscord | <voidwalker> Even at universities here it's the main language |
08:16:18 | FromDiscord | <Elegantbeef> I guess the one reason it's such a pain in nim is we cannot easily go "Hey look up this type, instantiate it let me serialise to it then return it as the base" |
08:16:49 | FromDiscord | <Elegantbeef> The entire list of subtypes isnt queryable, which is a shame |
08:17:43 | FromDiscord | <Bung> @ElegantBeef found its about how repr works, it relys on type definition, if a the obj |
08:17:48 | FromDiscord | <impbox [ftsf]> i feel like other than the serialization/deserialization type stuff, oop in nim does what i want |
08:18:28 | FromDiscord | <Bung> (edit) "@ElegantBeef found its about how repr works, it relys on type definition, if a the obj ... " added "field I define as ptr A, I actually store a ptr B , it will not print the actually structure" |
08:19:18 | FromDiscord | <Elegantbeef> Yea it's the only way to have a truely heterogeneous collections |
08:19:36 | FromDiscord | <Elegantbeef> Which means user defined types can be used and extended |
09:25:17 | * | Vladar quit (Remote host closed the connection) |
09:29:20 | * | Vladar joined #nim |
09:46:26 | FromDiscord | <Olfactory Hallucinations> In reply to @iWonderAboutTuatara "it's annoying since I": replying to an old comment here, but the Replit Nim environment (https://replit.com/languages/nim) has access to a temporary file system, which makes it easy to test stuff using files and shells. |
09:47:30 | * | Vladar quit (Ping timeout: 264 seconds) |
09:57:22 | * | wallabra_ joined #nim |
09:58:46 | * | wallabra quit (Ping timeout: 260 seconds) |
09:59:05 | * | wallabra_ is now known as wallabra |
10:16:40 | FromDiscord | <EyeCon> In reply to @Olfactory Hallucinations "replying to an old": Yes, but:â”> Nim Compiler Version 1.2.0 (2020-04-03) |
10:19:14 | FromDiscord | <Olfactory Hallucinations> That's a drawback for sure. I've mostly used it to test simple things, but I haven't run into any issues yet |
10:21:57 | FromDiscord | <EyeCon> It wasn't meant as an objection, it's better than nothing for sure, but it would be very nice if they'd update it |
10:22:44 | FromDiscord | <EyeCon> It just has the potential of sending you into a rabbit hole of a problem which has already been solved in a later version |
10:26:26 | FromDiscord | <Olfactory Hallucinations> Yeah, that's true. |
10:45:25 | PMunch | You technically have a file-system on the playground as well |
10:45:44 | PMunch | But in order to put files there you need to use compile-time file writing |
10:46:24 | FromDiscord | <Rika> Wand box also kinda has a file system |
10:52:38 | * | Vladar joined #nim |
11:06:09 | PMunch | Hmm, I have a local `$` function that access some global state. But `join` and friends really doesn't like this.. |
11:07:36 | PMunch | I guess I could go through and make a reference for the elements that points to the parent.. |
11:07:48 | PMunch | That would mean you could have multiple parents as well.. |
11:10:27 | FromDiscord | <planetis> lol I am looking at a similar thing right now, trying to compile debugEcho in a nosideeffect proc but $ reports that it has side effects. |
11:11:10 | FromDiscord | <techdev> sent a long message, see http://ix.io/48uN |
11:12:38 | FromDiscord | <aruZeta> In reply to @techdev "If you have a": <@&371760044473319454> |
11:14:45 | FromDiscord | <Rika> In reply to @aruZeta "<@&371760044473319454>": That was quick |
11:14:57 | PMunch | Hmm, these usernames and profiles seems more and more like real users |
11:15:13 | PMunch | This one even had a profile picture |
11:15:26 | PMunch | @Rika, fastest ban-hammer in the west |
11:17:40 | FromDiscord | <aruZeta> lmao |
11:22:54 | * | Vladar quit (Ping timeout: 264 seconds) |
11:33:10 | FromDiscord | <b1rdf00d> is there a wait time before posting set up on this discord? might help filter some of the spam |
11:34:10 | FromDiscord | <aruZeta> problem is some of the bots join from the irc |
11:34:44 | PMunch | @aruZeta, it's been a loooong time since we had an IRC spammer |
11:34:52 | PMunch | All of these come from Matrix |
11:35:07 | FromDiscord | <aruZeta> well that's what i meant, sr |
11:35:08 | FromDiscord | <aruZeta> (edit) "sr" => "sry" |
11:35:21 | PMunch | But no, I don't think there is a wait time |
11:35:35 | PMunch | We're looking at options for dealing with this in a better way |
11:35:58 | FromDiscord | <aruZeta> for discord there is https://media.discordapp.net/attachments/371759389889003532/1012324453553819658/unknown.png |
11:36:15 | FromDiscord | <aruZeta> (edit) "for discord there is ... https://media.discordapp.net/attachments/371759389889003532/1012324453553819658/unknown.png" added "these "requirements" to join a server" |
11:36:38 | FromDiscord | <Rika> This discord server has no spam problem |
11:36:38 | FromDiscord | <aruZeta> (edit) "join" => "send messages in" |
11:36:40 | FromDiscord | <Rika> Itâs from matrix |
11:36:46 | FromDiscord | <aruZeta> yh ik |
11:36:51 | FromDiscord | <Rika> Matrix does not have a similar system |
11:37:06 | FromDiscord | <aruZeta> that's what i was going to ask if there was smth of the like |
11:37:57 | FromDiscord | <enthus1ast> imho the only real solution is to moderate |
11:38:07 | FromDiscord | <enthus1ast> like so that new user cannot do anything in the channel |
11:38:21 | FromDiscord | <enthus1ast> and must ping a mod to enable them |
11:38:26 | FromDiscord | <enthus1ast> but yeah |
11:38:29 | FromDiscord | <Rika> In reply to @enthus1ast "imho the only real": Why not severe |
11:38:36 | FromDiscord | <Rika> this is a bad joke |
11:38:45 | FromDiscord | <aruZeta> bruh |
11:39:20 | FromDiscord | <enthus1ast> i don't get it @Rika |
11:39:39 | FromDiscord | <Rika> Moderate as in not the verb |
11:39:49 | FromDiscord | <Rika> âMild moderate severeâ |
11:40:00 | FromDiscord | <enthus1ast> ah \:) |
11:40:41 | FromDiscord | <enthus1ast> i think discord has the issue not YET, afaik there where some spammers spamming on discord already |
11:40:59 | FromDiscord | <Rika> The kind of spam is different in discord |
11:41:03 | FromDiscord | <Rika> Usually itâs DM spam |
11:41:14 | FromDiscord | <Rika> Which is why I have it off by default |
11:44:19 | FromDiscord | <Phil> Hah! Avoided that for the most part |
11:46:20 | FromDiscord | <SouperZ> hey guys does anyone know how to do opengl stuff in a imgui window? im using https://github.com/nimgl/nimgl/blob/master/examples/timgui.nim |
11:49:10 | FromDiscord | <impbox [ftsf]> i'm doing it right now |
11:49:24 | FromDiscord | <impbox [ftsf]> but i'm about to run out |
11:49:26 | FromDiscord | <impbox [ftsf]> sorry |
11:49:30 | FromDiscord | <impbox [ftsf]> but it's totally doable! |
11:49:36 | FromDiscord | <impbox [ftsf]> you can do it! |
11:51:30 | * | xet7 joined #nim |
11:55:50 | * | Vladar joined #nim |
12:38:11 | FromDiscord | <Bung> I finally use x64dbg find where the problem nearby |
12:45:42 | * | arkurious joined #nim |
12:55:22 | * | derpydoo joined #nim |
13:17:34 | FromDiscord | <ravinder387> why i'm getting error https://media.discordapp.net/attachments/371759389889003532/1012350023893254265/Screenshot_from_2022-08-25_18-46-56.png |
13:18:17 | FromDiscord | <Prestige> use parens |
13:18:56 | FromDiscord | <ravinder387> i know.. but in docs it is written that u can call function f a,b |
13:18:59 | FromDiscord | <Prestige> the compiler sees `echo(add0(2), 3)` |
13:19:02 | FromDiscord | <ravinder387> why it not working |
13:21:07 | FromDiscord | <aruZeta> the compiler thinks the comma is for echo |
13:21:10 | FromDiscord | <Bung> (add0 2) echo's param 1th, 3 echo's param 2th |
13:21:11 | FromDiscord | <aruZeta> not for add8 |
13:21:12 | FromDiscord | <aruZeta> (edit) "add8" => "add0" |
13:21:26 | FromDiscord | <ravinder387> docs https://media.discordapp.net/attachments/371759389889003532/1012350996757872721/Screenshot_from_2022-08-25_18-50-55.png |
13:21:45 | FromDiscord | <aruZeta> that's exactly how it works |
13:21:56 | FromDiscord | <aruZeta> echo mySum 0, 1 |
13:22:15 | FromDiscord | <aruZeta> the comma separates arg0 and arg1 of ECHO |
13:22:37 | FromDiscord | <aruZeta> so it would look like echo(mySum 0, 1) |
13:22:41 | FromDiscord | <aruZeta> (edit) "echo(mySum" => "`echo(mySum" | "1)" => "1)`" |
13:22:52 | FromDiscord | <aruZeta> (edit) "echo" => "`echo" | "1" => "1`" |
13:23:19 | FromDiscord | <aruZeta> what you want to do is `echo mySum(0, 1)` |
13:25:13 | * | jmdaemon quit (Ping timeout: 268 seconds) |
13:26:20 | FromDiscord | <ravinder387> here <function> <arg0> <arg1> echo mySum 0 |
13:26:29 | FromDiscord | <ravinder387> for echo mySum is argument |
13:26:31 | FromDiscord | <ravinder387> u mean |
13:27:02 | FromDiscord | <aruZeta> in your example we dont have `f arg0 arg1` |
13:27:12 | FromDiscord | <aruZeta> we have `f1 f2 arg0 arg1` |
13:27:32 | FromDiscord | <aruZeta> (edit) "arg0" => "arg0," |
13:27:37 | FromDiscord | <aruZeta> (edit) "arg0" => "arg0," |
13:27:58 | FromDiscord | <ravinder387> wht about this https://media.discordapp.net/attachments/371759389889003532/1012352638291030026/Screenshot_from_2022-08-25_18-57-21.png |
13:30:01 | FromDiscord | <ravinder387> try |
13:30:03 | FromDiscord | <ravinder387> sent a long message, see http://ix.io/48AM |
13:30:36 | FromDiscord | <aruZeta> idk about the compiler's internals, but my wild guess is that `=` is also a function |
13:31:00 | FromDiscord | <aruZeta> use `add0(2, 3)` and it should work |
13:31:19 | FromDiscord | <ravinder387> yes i know |
13:33:54 | FromDiscord | <ravinder387> var x = 1 here var is keyword x is symbol = function 1 value |
13:33:58 | FromDiscord | <ravinder387> how it works |
13:35:56 | FromDiscord | <Rika> https://nim-lang.org/docs/manual.html#procedures-command-invocation-syntax |
13:36:40 | FromDiscord | <Rika> If your proc returns, you cannot use command call syntax with more than one argument I guess |
13:44:36 | FromDiscord | <ravinder387> can i see ast for any expression |
13:44:46 | FromDiscord | <ravinder387> how it parsed string |
13:44:58 | FromDiscord | <ravinder387> i mean everything |
13:47:01 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48AR |
13:47:16 | FromDiscord | <aruZeta> put your code there and it will show you the generated AST |
13:48:36 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48AS |
13:49:11 | FromDiscord | <aruZeta> by clickying here, the button on the left of `Run!` https://media.discordapp.net/attachments/371759389889003532/1012357978709557298/unknown.png |
13:49:19 | PMunch | I'm starting to think I've spent too long on notificatcher :P |
13:49:33 | PMunch | Just added some more features to handle closing notifications and getting pids |
13:50:05 | PMunch | So now you can tie it together with your favourite terminal GUI application even better than before! |
13:50:09 | FromDiscord | <ravinder387> i want to see in vscode also |
13:50:33 | FromDiscord | <aruZeta> In reply to @ravinder387 "i want to see": just compile the code and it will be showed on the compile log |
13:50:47 | FromDiscord | <aruZeta> no need to run the compiled executable |
13:51:02 | FromDiscord | <aruZeta> In reply to @PMunch "I'm starting to think": what's notificatcher |
13:51:19 | PMunch | https://github.com/PMunch/notificatcher |
13:51:29 | PMunch | Basically a program to get notifications from DBus |
13:51:51 | PMunch | So if you don't have a notification program you can use that and build your own workflow for notifications |
13:51:54 | FromDiscord | <aruZeta> lol I searched `notificatcher` in ddg and it showed me a repo of yours named `notifishower` |
13:52:10 | PMunch | Haha, yeah those two are kind of related |
13:53:03 | PMunch | It's useful if you want to show notifications on a bar in a WM for example |
13:53:24 | FromDiscord | <aruZeta> nice |
13:53:41 | FromDiscord | <aruZeta> since I'm on sway I have mako to handle the notifs |
13:54:18 | PMunch | But notificatcher can also run programs and such with the notifications |
13:54:37 | PMunch | So for example you can do this: notificatcher --run 'zenity --{hints:urgency:info:warning:error} --title "Notification from: {appName}" --text "{summary}"' --file "/tmp/notifications/{id}" --closeRun 'kill $(cat /tmp/notification/{id})' "{pid}" |
13:54:55 | FromDiscord | <aruZeta> hmmm |
13:55:09 | PMunch | That will start zenity for every notification, then if they are discarded by the program that created them kill the zenity window |
13:55:22 | FromDiscord | <aruZeta> interesting |
13:55:50 | FromDiscord | <aruZeta> but since I don't make much use of notifications I can't find it (atm) any use for me |
13:55:58 | PMunch | Notifishower is basically just a program to create small GUIs through a terminal tool |
13:56:18 | PMunch | Yeah it's mostly for extreme tinkerers |
13:56:19 | FromDiscord | <aruZeta> I mean, the only notif I get is the dumb wezterm telling me there are new updates |
13:56:29 | PMunch | But I've gotta go |
13:56:30 | * | PMunch quit (Quit: Leaving) |
13:56:39 | FromDiscord | <Nalmyth> sent a code paste, see https://play.nim-lang.org/#ix=48AT |
13:56:43 | FromDiscord | <aruZeta> and I thought I configured it to not show me those notifs ... |
13:57:01 | FromDiscord | <aruZeta> In reply to @Nalmyth "I couldn't find the": do you mean generics |
13:57:07 | FromDiscord | <Nalmyth> Ah maybe that's the search term |
13:57:25 | FromDiscord | <aruZeta> if you mean the T stuff, then yh that's generics |
13:57:41 | FromDiscord | <aruZeta> take a look here |
13:57:41 | FromDiscord | <Nalmyth> Yea seems to be it, thank you! |
13:57:43 | FromDiscord | <aruZeta> https://nim-lang.org/docs/manual.html#generics |
13:58:18 | FromDiscord | <Nalmyth> Is there some way to specify exactly which function I want to call?â”I have a problem with one small function which I'd like to return two different types from |
13:58:44 | FromDiscord | <aruZeta> hmm |
13:58:45 | FromDiscord | <Nalmyth> like `someFunc[typeA](5)` |
13:59:09 | FromDiscord | <Nalmyth> Ah maybe this https://media.discordapp.net/attachments/371759389889003532/1012360485477294170/Screenshot_2022-08-25_at_17.59.04.png |
14:00:50 | FromDiscord | <aruZeta> i think not https://media.discordapp.net/attachments/371759389889003532/1012360908032462938/unknown.png |
14:01:07 | FromDiscord | <aruZeta> unless you are doing `foo.bar[T](arg)` |
14:01:07 | FromDiscord | <Nalmyth> Hmm |
14:01:18 | FromDiscord | <aruZeta> which you should write as `foo.bar[:T](arg) |
14:01:19 | FromDiscord | <aruZeta> (edit) "`foo.bar[:T](arg)" => "`foo.bar[:T](arg)`" |
14:01:33 | FromDiscord | <Nalmyth> I will write a small example to make sure I understood it |
14:01:41 | FromDiscord | <aruZeta> do you maybe mean smth like this:? https://media.discordapp.net/attachments/371759389889003532/1012361123904897084/unknown.png |
14:01:58 | FromDiscord | <aruZeta> it will result in a ambiguous call error |
14:02:15 | FromDiscord | <Nalmyth> Yea I was thinking: "How can that work??" đ
|
14:02:55 | FromDiscord | <Rika> It wonât |
14:03:06 | FromDiscord | <aruZeta> short answer |
14:03:09 | FromDiscord | <aruZeta> (edit) "short answer ... " added "^^" |
14:03:56 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48AZ |
14:04:03 | FromDiscord | <Nalmyth> sent a code paste, see https://play.nim-lang.org/#ix=48B0 |
14:04:23 | FromDiscord | <Nalmyth> (edit) "https://play.nim-lang.org/#ix=48B0" => "https://play.nim-lang.org/#ix=48B1" |
14:04:38 | FromDiscord | <Nalmyth> In reply to @aruZeta "but you can do": Yea looks perfect, I will try! |
14:05:00 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=48B2 |
14:05:03 | FromDiscord | <aruZeta> yep |
14:05:14 | FromDiscord | <Nalmyth> So specify options directly there |
14:05:14 | FromDiscord | <aruZeta> you should have `T: SomeType` |
14:05:18 | FromDiscord | <aruZeta> inside the generic |
14:05:21 | FromDiscord | <Nalmyth> Ah I see |
14:05:34 | FromDiscord | <aruZeta> `proc someFunc[T: SomeType]` |
14:05:47 | FromDiscord | <aruZeta> (edit) "SomeType]`" => "SomeType](param bla bla): T =`" |
14:13:13 | FromDiscord | <Nalmyth> Hmm it works but it looks a bit messy now đ â”I guess I will try to do it somehow with polymorphism instead |
14:13:17 | FromDiscord | <Nalmyth> (edit) "Hmm it ... works" added "sortof" |
14:13:46 | FromDiscord | <Nalmyth> More useful in this case as I really want to access some specific types from a module based on which type was specified which adds a lot of bloat to the function |
14:16:39 | FromDiscord | <Nalmyth> Finally added an extra unused typed parameter, and it's much easier to reason about |
14:16:43 | FromDiscord | <Nalmyth> Thank you guys đ |
14:16:59 | * | agentwa joined #nim |
14:17:22 | FromDiscord | <Nalmyth> (edit) "Finally added an extra unused typed ... parameter," added "`(_: TypeA, ...)`" |
14:19:00 | FromDiscord | <aruZeta> np, what best works for ya |
14:23:22 | FromDiscord | <sealmove> I read the manual about the `{.header.}` and I still don't get it. When would one use it? |
14:27:05 | FromDiscord | <aruZeta> from what I've read, it does not declare anything but just add's an `#include` to the generated c |
14:27:40 | FromDiscord | <aruZeta> (edit) "an" => "a" |
14:28:30 | FromDiscord | <aruZeta> so your generated c code will require the header specified to exist in order to be compiled |
14:30:05 | FromDiscord | <Bung> sent a code paste, see https://paste.rs/epz |
14:30:30 | FromDiscord | <Bung> (edit) "https://play.nim-lang.org/#ix=48Bh" => "https://play.nim-lang.org/#ix=48Bg" |
14:34:48 | FromDiscord | <sealmove> In reply to @aruZeta "so your generated c": hmm, so the code you are writing won't be using anything from that header file, correct? otherwise I suppose `{.importc.}` suffices. |
14:35:23 | FromDiscord | <sealmove> it's confusing because `{.header.}` is applied to what? types? |
14:35:46 | FromDiscord | <aruZeta> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-header-pragma |
14:35:54 | FromDiscord | <aruZeta> > The header pragma is very similar to the nodecl pragma: It can be applied to almost any symbol and specifies that it should not be declared and instead, the generated code should contain an #include |
14:36:46 | FromDiscord | <sealmove> not declared where? not declared in the file the pragma appears? |
14:36:59 | FromDiscord | <aruZeta> look at nodecl |
14:37:04 | FromDiscord | <aruZeta> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-nodecl-pragma |
14:37:13 | FromDiscord | <aruZeta> > It tells Nim that it should not generate a declaration for the symbol in the C code |
14:37:34 | FromDiscord | <aruZeta> that's what "not declared" means |
14:38:33 | FromDiscord | <aruZeta> declaration in the C code generated, not in nim |
14:38:39 | FromDiscord | <aruZeta> (edit) |
14:39:29 | FromDiscord | <aruZeta> `{.header.}` will just put an `#include` in the generated C code, which I guess would import the specified file |
14:41:00 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=48Bq |
14:42:48 | FromDiscord | <Alea> In reply to @aruZeta "i think not": wait what issue is this solving? |
14:44:45 | FromDiscord | <aruZeta> In reply to @Alea "wait what issue is": if you call `foo.bar[T](param)`, it will be parsed as `(foo.bar(param))[T]` |
14:45:21 | FromDiscord | <aruZeta> while `foo.bar[:T](param)` will be parsed as (bar[T](foo, param)` |
14:45:24 | FromDiscord | <aruZeta> (edit) "(bar[T](foo," => "`(bar[T](foo," |
14:46:47 | FromDiscord | <aruZeta> In reply to @àžŁŃàžÉàčàčŚ©Ń "so basically if you": you will most likely need to specify header |
14:46:57 | FromDiscord | <aruZeta> where is it importing that symbol from? |
14:47:07 | FromDiscord | <aruZeta> that's what header describes |
14:47:33 | FromDiscord | <aruZeta> The header pragma specifies the header file that contains the imported procedure. The importc pragma asks the Nim compiler to import the printf procedure from C |
14:47:41 | FromDiscord | <aruZeta> (edit) "procedure." => "symbol." |
14:47:48 | FromDiscord | <aruZeta> (edit) "printf procedure" => "symbol" |
14:48:22 | FromDiscord | <sealmove> ok I understand, thanks. btw do you have some examples with variety? importing structs, functions etc |
14:48:42 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48Bv |
14:49:10 | FromDiscord | <aruZeta> In reply to @àžŁŃàžÉàčàčŚ©Ń "ok I understand, thanks.": hmm |
14:51:47 | FromDiscord | <Rika> In reply to @àžŁŃàžÉàčàčŚ©Ń "so basically if you": If you need this itâs in the io module, CFile |
14:51:47 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48Bw |
14:52:06 | FromDiscord | <aruZeta> (correct anyone who knows, since I don't lol) |
14:52:23 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=48Bx |
14:53:13 | FromDiscord | <aruZeta> my bad |
14:53:31 | FromDiscord | <aruZeta> (edit) "https://play.nim-lang.org/#ix=48Bw" => "https://play.nim-lang.org/#ix=48By" |
14:53:36 | FromDiscord | <aruZeta> wth was in my head to write that |
14:53:56 | FromDiscord | <Bung> does this means the variable store "C:\Users\crc32\AppData\Roaming\webview" size too small ? https://media.discordapp.net/attachments/371759389889003532/1012374269243699351/2022-08-25_225214.png |
14:55:14 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=48BB |
14:55:24 | FromDiscord | <aruZeta> np |
15:01:20 | * | LuxuryMode joined #nim |
15:09:59 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=48BT |
15:10:11 | FromDiscord | <aruZeta> no |
15:10:25 | FromDiscord | <aruZeta> unless you the importc pragma |
15:10:41 | FromDiscord | <sealmove> yes I am talking about importc |
15:11:12 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48BV |
15:11:15 | FromDiscord | <aruZeta> it would look like |
15:11:21 | FromDiscord | <sealmove> great |
15:12:02 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48BW |
15:12:34 | * | rockcavera joined #nim |
15:12:34 | * | rockcavera quit (Changing host) |
15:12:34 | * | rockcavera joined #nim |
15:12:36 | * | ehmry quit (Ping timeout: 260 seconds) |
15:13:07 | FromDiscord | <aruZeta> you need to specify their actual name in the c code using importc |
15:19:00 | FromDiscord | <nx0> recently started learning macros, is this expected? - https://play.nim-lang.org/#ix=48BY |
15:21:17 | * | agentwa left #nim (#nim) |
15:22:15 | FromDiscord | <sealmove> In reply to @aruZeta "you need to specify": oh |
15:24:36 | FromDiscord | <sealmove> In reply to @nx0 "recently started learning macros,": hmm macro overloading :DDDD |
15:24:56 | FromDiscord | <sealmove> I guess we don't have that |
15:29:09 | FromDiscord | <nx0> macro overloading works in other cases though - https://play.nim-lang.org/#ix=48C0â”just a minor change to the previous code |
15:29:30 | FromDiscord | <aruZeta> In reply to @nx0 "recently started learning macros,": that's because your macro is creating the proc a second time, i think? |
15:29:57 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48C1 |
15:32:08 | FromDiscord | <nx0> so? as mentioned in the code, it works when first macro is commented out. and i checked that it is not executing both macros either by printing some random stuff in the macros. and it also works if i add a dummy int node. the issue is with overloading afaict, but i have \~0 knowledge of macros, so... |
15:32:59 | FromDiscord | <sealmove> some times the macros are not printed because of caching |
15:33:11 | FromDiscord | <aruZeta> it does not work if I commen the first macro https://media.discordapp.net/attachments/371759389889003532/1012384152424812706/unknown.png |
15:34:03 | FromDiscord | <aruZeta> well i guess i need to comment the first proc b too |
15:34:04 | FromDiscord | <aruZeta> my bad |
15:35:55 | FromDiscord | <aruZeta> anyway, i have never used a macro as a pragma, so idk |
15:36:03 | FromDiscord | <aruZeta> (edit) "used" => "created" |
15:36:13 | FromDiscord | <aruZeta> (edit) "anyway, i have never created a macro ... as" added "and used it" |
15:47:24 | FromDiscord | <SouperZ> In reply to @SouperZ "hey guys does anyone": anyone? |
15:52:17 | * | ehmry joined #nim |
15:55:02 | FromDiscord | <hotdog> In reply to @SouperZ "anyone?": Opengl is already there, you can just render on top of or below the imgui stuff |
15:55:49 | FromDiscord | <SouperZ> In reply to @hotdog "Opengl is already there,": yes but what about inside a imgui window |
15:55:58 | FromDiscord | <SouperZ> i cant find much resources |
15:59:18 | FromDiscord | <hotdog> In reply to @SouperZ "yes but what about": What do you mean? It's not an imgui window, it's opengl. The window itself created by glfw |
15:59:46 | FromDiscord | <SouperZ> In reply to @hotdog "What do you mean?": i mean a imgui window like this https://media.discordapp.net/attachments/371759389889003532/1012390841425330306/unknown.png |
15:59:58 | FromDiscord | <SouperZ> not a system window |
16:08:33 | FromDiscord | <hotdog> In reply to @SouperZ "i mean a imgui": Ah. Looks like there's a couple of ways https://github.com/ocornut/imgui/issues/984 |
16:19:32 | FromDiscord | <choltreppe> how can you get the highest and lowest value of a Slice? |
16:22:32 | FromDiscord | <aruZeta> In reply to @choltreppe "how can you get": https://play.nim-lang.org/#ix=48Cc |
16:24:08 | FromDiscord | <aruZeta> this works because of how a HSlice is defined https://nim-lang.org/docs/system.html#HSlice |
16:24:27 | FromDiscord | <aruZeta> (edit) "HSlice" => "`HSlice`" |
16:25:11 | FromDiscord | <aruZeta> (note that `Slice[T]` is just an alias for `HSlice[T, T]`) |
16:25:23 | FromDiscord | <choltreppe> ok thanks |
16:25:32 | FromDiscord | <aruZeta> np! |
16:45:52 | FromDiscord | <!&luke> In reply to @b1rdf00d "there's ish terminal for": Tried it, can't install Nim tho as it's i386 |
16:58:29 | FromDiscord | <EyeCon> In reply to @Olfactory Hallucinations "That's a drawback for": Tio apparently has Nim too, but I don't know which version: https://tio.run/#nim |
16:58:47 | FromDiscord | <EyeCon> How do I find out the compiler version? Is there a symbol automatically defined for me? |
16:59:16 | FromDiscord | <aruZeta> in actual nim code? |
16:59:28 | FromDiscord | <aruZeta> or via command line |
16:59:56 | FromDiscord | <EyeCon> In Nim code, I can't influence command line that much |
17:00:04 | FromDiscord | <EyeCon> I have an oracle which runs programs |
17:00:12 | FromDiscord | <EyeCon> and I want to find out the Nim version |
17:00:26 | FromDiscord | <aruZeta> i will try search if it exits, since idk |
17:01:00 | FromDiscord | <EyeCon> Thanks, I'm searching too |
17:01:02 | FromDiscord | <aruZeta> https://nim-lang.org/docs/system.html#NimVersion |
17:01:24 | FromDiscord | <aruZeta> there ya go |
17:01:41 | FromDiscord | <aruZeta> it's a const |
17:02:05 | FromDiscord | <EyeCon> Ah, thanks |
17:02:11 | FromDiscord | <EyeCon> My search-fu is weak |
17:02:51 | FromDiscord | <EyeCon> In reply to @EyeCon "Tio apparently has Nim": `echo NimVersion`â”> 1.0.0 |
17:03:06 | FromDiscord | <EyeCon> đ |
17:03:16 | FromDiscord | <EyeCon> Why don't people update their installations |
17:03:19 | FromDiscord | <aruZeta> In reply to @EyeCon "My search-fu is weak": it was the 4th result lol https://media.discordapp.net/attachments/371759389889003532/1012406834990157835/unknown.png |
17:03:51 | FromDiscord | <EyeCon> In reply to @aruZeta "it was the 4th": I, trying to be clever, first checked the compiler documentation page, and then proceeded to the Index |
17:04:13 | FromDiscord | <EyeCon> Before I was finished you wrote it |
17:05:42 | FromDiscord | <aruZeta> lmao |
17:19:30 | FromDiscord | <Shiba> does anyone recommend "mastering nim" book |
17:19:33 | FromDiscord | <Shiba> (edit) "book" => "book?" |
17:22:35 | FromDiscord | <aruZeta> only nim book I've read is "Nim in action", and I do recommend it for newbies in the language |
17:23:19 | FromDiscord | <Shiba> i did learn the basics and a little bit of advanced stuff |
17:23:32 | FromDiscord | <Shiba> In reply to @Shiba "does anyone recommend "mastering": but is its worth buying |
17:23:45 | FromDiscord | <Shiba> (edit) "In reply to @Shiba "does anyone recommend "mastering": but is its worth buying ... " added ", like is it gonna make me a nim master" |
17:24:49 | FromDiscord | <Shiba> (edit) "In reply to @Shiba "does anyone recommend "mastering": but is its worth buying , like is it gonna make me a nim master ... " added "for real" |
17:25:33 | FromDiscord | <aruZeta> hey dom I see you :3 |
17:26:13 | FromDiscord | <aruZeta> In reply to @Shiba "but is its worth": master's are made through experience |
17:26:21 | FromDiscord | <flywind> Read the Nim manual thoroughly, you can master Nim quickly đ |
17:26:49 | FromDiscord | <Generic> this but unironically |
17:27:28 | FromDiscord | <aruZeta> once you know the basics of the language, try doing some projects |
17:27:47 | FromDiscord | <aruZeta> you will need to search the manual a lot, and so you will learn more stuff |
17:28:03 | FromDiscord | <Shiba> like small apps , examples? |
17:28:16 | FromDiscord | <aruZeta> and as flywind said, read the https://nim-lang.org/docs/manual.html |
17:28:31 | FromDiscord | <Shiba> i read that like 5 times |
17:28:39 | FromDiscord | <aruZeta> oh |
17:28:55 | FromDiscord | <aruZeta> then, what have you used nim for |
17:29:55 | FromDiscord | <flywind> In reply to @Shiba "like small apps ,": https://xmonader.github.io/nimdays/ there are lots of small apps written in Nim |
17:30:04 | FromDiscord | <aruZeta> try making a DSL to learn macros/templates, some low level algorithm to learn low level nim, create a lib, a tui or a tui game, there are lots of stuff |
17:30:10 | FromDiscord | <Shiba> In reply to @aruZeta "then, what have you": ive had experience with making games, so iam trying to make one in nim |
17:30:27 | FromDiscord | <Shiba> oh nice idea |
17:30:58 | FromDiscord | <aruZeta> which of all |
17:31:24 | FromDiscord | <aruZeta> there are also parsers, json/xml/ini/yaml |
17:31:27 | FromDiscord | <Shiba> all of them |
17:31:40 | FromDiscord | <aruZeta> nice :) |
17:32:12 | FromDiscord | <Shiba> (edit) "all of them ... " added ", iam gonna do a little research about those stuff , and see if can make atleast one" |
17:38:50 | FromDiscord | <Forest> What are good alternatives to json for storing large amounts of data in a format that many languages can read? |
17:39:04 | * | jmdaemon joined #nim |
17:39:23 | FromDiscord | <Forest> Large amounts of data could mean around 780 megabytes in a json file format |
17:39:37 | FromDiscord | <Generic> can it be binary? |
17:39:40 | FromDiscord | <Forest> And could also be way bigger |
17:39:55 | FromDiscord | <Forest> In reply to @Generic "can it be binary?": That's good with me but I'm storing large amounts of string data |
17:40:10 | FromDiscord | <Generic> well binary formats are even then at an advantage |
17:40:12 | FromDiscord | <mratsim> In reply to @Forest "What are good alternatives": CBOR? msgpack? |
17:40:24 | FromDiscord | <Generic> because they can store the length of the string in advance |
17:40:37 | FromDiscord | <Generic> so there's no scanning |
17:40:43 | FromDiscord | <Forest> Cbor? |
17:40:46 | FromDiscord | <Forest> In reply to @Generic "well binary formats are": Oh neat |
17:40:47 | FromDiscord | <EyeCon> CBOR |
17:40:54 | FromDiscord | <Forest> Yeah what's that? |
17:40:56 | FromDiscord | <Generic> I second message message pack |
17:41:04 | FromDiscord | <mratsim> In reply to @Forest "Yeah what's that?": https://en.wikipedia.org/wiki/CBOR |
17:41:40 | FromDiscord | <mratsim> sent a long message, see http://ix.io/48Cn |
17:42:16 | FromDiscord | <Forest> Hm what's the difference between them both then? To me seems like msgpack and CBOR do essentially the same thing |
17:42:21 | FromDiscord | <Prestige> msgpack looks nice |
17:42:28 | FromDiscord | <Forest> In reply to @Avahe "msgpack looks nice": Agreed |
17:43:47 | FromDiscord | <mratsim> In reply to @Forest "Hm what's the difference": CBOR is standardized by the IETF and is used in open protocols |
17:43:55 | FromDiscord | <mratsim> CBOR was inspired by msgpack afterall |
17:44:01 | FromDiscord | <Forest> Oh neat |
17:44:23 | FromDiscord | <mratsim> https://media.discordapp.net/attachments/371759389889003532/1012417169314824273/unknown.png |
17:45:47 | FromDiscord | <mratsim> oh interesting, CBOR can also handle bigints |
17:46:09 | FromDiscord | <mratsim> and bigfloats and fractions đź |
17:46:52 | FromDiscord | <Forest> Cbor has tags? Like XML? |
17:46:57 | FromDiscord | <Prestige> https://git.sr.ht/~ehmry/nim_cbor |
17:47:45 | FromDiscord | <Forest> Yup already have that up |
17:48:13 | FromDiscord | <Forest> Is this... The whole implementation in a single file? That looks unbelievably simple |
17:49:20 | ehmry | it could be simplier if the API was cleaned up |
17:49:27 | FromDiscord | <aruZeta> In reply to @Avahe "https://git.sr.ht/~ehmry/nim_cbor": there is a flake.nix there, fellow nixer |
17:49:42 | FromDiscord | <Prestige> Oh hi ehmry |
17:49:57 | FromDiscord | <aruZeta> what a chad |
17:50:04 | FromDiscord | <Forest> In reply to @ehmry "it could be simplier": Wdym? |
17:51:12 | FromDiscord | <Forest> Ah initial commit was smaller but still, unbelievably small |
17:52:37 | FromDiscord | <aruZeta> someday I need to port my nix dots to a flake, that day I will die |
17:53:19 | FromDiscord | <Forest> Difference between them? |
17:53:57 | FromDiscord | <aruZeta> surely will need to rewrite all my dots |
17:54:17 | FromDiscord | <Prestige> I need to do that as well... |
17:54:21 | FromDiscord | <aruZeta> and tbh idk how a flake is supposed to work |
17:54:25 | FromDiscord | <aruZeta> need to research |
17:55:11 | ehmry | you don't really need flakes in with your nimble stuff unless you are using something like C libraries |
17:55:33 | FromDiscord | <aruZeta> oh lord, just seeing how much commits I have in my dotfiles makes it more painful https://media.discordapp.net/attachments/371759389889003532/1012419976319225876/unknown.png |
17:56:02 | FromDiscord | <aruZeta> In reply to @ehmry "you don't really need": i actually just use a shell.nix, I mean for my dotfiles |
17:56:09 | ehmry | there is already a flake that contains most of nimble https://github.com/nix-community/flake-nimble |
17:56:31 | FromDiscord | <aruZeta> oh thanks, will save it for the day I research about flakes |
17:57:40 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48Cr |
17:57:49 | FromDiscord | <aruZeta> (edit) "https://play.nim-lang.org/#ix=48Cr" => "https://play.nim-lang.org/#ix=48Cs" |
17:58:02 | FromDiscord | <aruZeta> (edit) "https://play.nim-lang.org/#ix=48Cs" => "https://play.nim-lang.org/#ix=48Ct" |
18:01:07 | * | LuxuryMode quit (Quit: Connection closed for inactivity) |
18:19:47 | FromDiscord | <Forest> Question: How expensive is it to use nim_cbor? (Memory-wise) |
18:26:22 | FromDiscord | <sealmove> how to use toast (nimpterop)? `toast myfile.h` outputs nothing) |
18:32:36 | FromDiscord | <sealmove> Ah it needs `-n` |
18:42:04 | * | pro joined #nim |
19:02:53 | FromDiscord | <reversem3> I know I can just use if logic or case statements to turn morse code into ascii , but using a table how would you turn morse into ascii ? I have a const called MORSE with all the chars like 'A'\: ".-" and so on and put that into a table using toTable. |
19:05:38 | * | NimBot joined #nim |
19:13:29 | FromDiscord | <reversem3> would the table have to be ordered ? |
19:22:39 | FromDiscord | <sealmove> why would it? |
19:23:18 | FromDiscord | <sealmove> you would just index your table with the code you want to convert |
19:24:03 | FromDiscord | <reversem3> have an example ? still working on tables |
19:24:38 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=48CR |
19:25:14 | FromDiscord | <sealmove> tables in nim are like hashmaps (e.g. in java) or dictionaries (e.g. in python) |
19:25:24 | FromDiscord | <sealmove> are you familiar with the concept? |
19:25:41 | FromDiscord | <reversem3> yes key , value |
19:26:03 | FromDiscord | <sealmove> so you can easily just from a key to a value |
19:26:20 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=48CS |
19:27:03 | FromDiscord | <sealmove> oh you said your pairs look like this `'A': ".-"` |
19:27:45 | FromDiscord | <sealmove> then you need to revert them, for example `".-": 'A'` |
19:28:37 | * | Vladar quit (Quit: Leaving) |
19:32:51 | FromDiscord | <sealmove> sent a code paste, see https://play.nim-lang.org/#ix=48CV |
19:33:01 | FromDiscord | <sealmove> (edit) "https://play.nim-lang.org/#ix=48CV" => "https://play.nim-lang.org/#ix=48CW" |
19:33:18 | FromDiscord | <sealmove> (edit) "https://play.nim-lang.org/#ix=48CW" => "https://play.nim-lang.org/#ix=48CX" |
19:48:42 | FromDiscord | <planetis> If I need to use splitFile in nimble file what to do? import os crashes with invalid section '.' |
19:48:50 | FromDiscord | <planetis> (edit) "invalid" => ""invalid" | "'.'" => "'.'"" |
19:51:32 | FromDiscord | <reversem3> Ok cool , so that reverses itâ”(@sealmove) |
19:53:25 | FromDiscord | <planetis> nvm |
19:54:56 | FromDiscord | <planetis> sent a code paste, see https://play.nim-lang.org/#ix=48D5 |
19:56:28 | FromDiscord | <reversem3> I had a problem with that with nico awhile ago, it has something to do with your code , if was for me anyway |
19:58:31 | FromDiscord | <planetis> I just used strings slices bc I can't even |
20:27:02 | FromDiscord | <reversem3> How do you split a seq ? so your only getting the key or the value |
20:28:10 | FromDiscord | <Forest> Any examples for constructing a data structure for nim_cbor? Read cbor.txt but not much info lmao |
20:28:21 | FromDiscord | <aruZeta> lol |
20:28:59 | FromDiscord | <Forest> Hm may just use msgpack for now |
20:28:59 | * | sagax joined #nim |
20:29:08 | FromDiscord | <Forest> msgpack4nim looks nice |
20:45:27 | * | om3ga quit (Ping timeout: 268 seconds) |
20:45:54 | FromDiscord | <Phil> In reply to @reversem3 "How do you split": Sorry... split a seq? Maybe I'm just a bit too tired, but could you give a rundown example what you want? |
20:46:26 | FromDiscord | <Phil> Because if you want to iterate over a seq while getting also the index you can use `for index, value in enumerate(myseq)' |
20:46:29 | FromDiscord | <Phil> (edit) "enumerate(myseq)'" => "enumerate(myseq)`" |
20:47:08 | FromDiscord | <reversem3> Yeah I want to separate the key and value |
20:47:47 | FromDiscord | <reversem3> They add the key or value to a string input |
20:48:32 | FromDiscord | <Phil> You're at tables right now, right? Not at a seq? Since the "key" in a seq is just a number and normally that's not the wording one uses to describe interacting with a seq so I'm somewhat confused.â”â”Maybe just provide an example of what you want in and what you want out? |
20:51:22 | FromDiscord | <reversem3> https://play.nim-lang.org/#ix=48Di -- basically trying to figure out how to translate morecode to ascii using nim tables |
20:53:37 | FromDiscord | <reversem3> In python I can just switch [value] = key then split it up and then join |
20:53:40 | FromDiscord | <reversem3> In python I can just switch [value] = key then split it up append and then join |
20:57:32 | FromDiscord | <Phil> So like, make a seq of all table keys, make a second seq of all table values, join the individual seqs all together into 1 large key-string and a second large value-string? |
21:00:36 | FromDiscord | <reversem3> So I can do something like https://compucademy.net/morse-code-with-python/ |
21:00:59 | FromDiscord | <reversem3> Trying to do the same with nim |
21:01:19 | FromDiscord | <Elegantbeef> So what's the issue? |
21:04:51 | FromDiscord | <reversem3> Ok I'll try thatâ”(@Phil) |
21:18:48 | FromDiscord | <Phil> In reply to @reversem3 "Ok I'll try that": That wasn't a suggestion, that was me trying to comprehend and guessing what you want to achieve đ |
21:20:10 | FromDiscord | <Phil> So like you want to turn a dictionary like `{"bla": "-", "blubb": "-.-"}` into `"blablub"` and `"--.-"` ?â”Or what's the goal? |
21:20:38 | FromDiscord | <Phil> (edit) "`"blablub"`" => "`"blablubb"`" |
21:21:01 | FromDiscord | <reversem3> Yeah I want to take input string and get back morse |
21:21:18 | FromDiscord | <Phil> OHHHH so the inverse! |
21:22:10 | FromDiscord | <Phil> You'd want to split `blablubb` up into `["bla", "blubb"]` to get the morse `["-", "-.-"]` ? |
21:22:23 | FromDiscord | <aruZeta> is https://play.nim-lang.org/ down? |
21:22:28 | FromDiscord | <Elegantbeef> Yes |
21:22:53 | FromDiscord | <aruZeta> let's compile on local then lol |
21:23:49 | FromDiscord | <Elegantbeef> I mean the best you can do is something like https://hastebin.com/ahegusunuv.lua |
21:24:11 | FromDiscord | <Elegantbeef> Without spaces in the morse i dont think it's possible to get morse -\> ascii |
21:24:22 | ehmry | Forest: depends what you do, using `CborNode` is probably expensive, but `writeCbor` and `fromCbor` should be cheap |
21:24:38 | FromDiscord | <Elegantbeef> And if the morse has spaces then i'd suggest using parseutils and `parseUntil` |
21:25:12 | FromDiscord | <Forest> In reply to @ehmry "<@909883978717204561>: depends what you": Thanks! |
21:27:02 | FromDiscord | <reversem3> Interesting , ok thanks |
21:28:30 | FromDiscord | <Phil> In reply to @reversem3 "Interesting , ok thanks": Yeah you need some kind of separator. Otherwise, how do you know that `-.-` is EA or part of (, ) or maybe RT |
21:29:38 | * | derpydoo quit (Ping timeout: 244 seconds) |
21:39:53 | FromDiscord | <reversem3> right make sense |
21:46:07 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=48Dw |
21:49:56 | FromDiscord | <Generic> it depends a bit |
21:50:50 | FromDiscord | <aruZeta> what's a {.closure.}, is it like a ptr to a function? |
21:51:26 | FromDiscord | <Rika> Itâs a function that also captures some state in the current scope |
21:52:21 | FromDiscord | <Rika> So a function that accesses (not just global) stuff from outside itâs body without it being in its parameters |
21:53:17 | FromDiscord | <Generic> one shortcut you can take is if you parse UTF-8 and you don't need to distinguish between non ASCII characters, is to just not decode the UTF-8 |
21:53:40 | FromDiscord | <ââȘ©ïčâȘšâ > Remember me? |
21:53:59 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48DA |
21:54:04 | FromDiscord | <ââȘ©ïčâȘšâ > It's been two days and I think I finally write a Brainfuck compiler in Nim. |
21:54:30 | FromDiscord | <ââȘ©ïčâȘšâ > https://media.discordapp.net/attachments/371759389889003532/1012480110978404392/unknown.png |
21:54:32 | FromDiscord | <!Patitotective> In reply to @Generic "one shortcut you can": what i want to do is to check if codepoints are between 0x20>..0x10FFFF |
21:54:58 | FromDiscord | <Generic> yes, with UTF-8 just check whether a byte is 128 or above |
21:55:24 | FromDiscord | <ââȘ©ïčâȘšâ > In reply to @ââȘ©ïčâȘšâ "": Well, it's not a compiler, rather an interpreter. And yes, that's the whole code. |
21:55:27 | FromDiscord | <Generic> then it will be (part) of a codepoint of 128 or above |
21:55:40 | FromDiscord | <aruZeta> In reply to @ââȘ©ïčâȘšâ "": nice screenshot |
21:56:01 | FromDiscord | <Generic> ah though for what you want to archieve you need to decode UTF-8 |
21:56:11 | FromDiscord | <ââȘ©ïčâȘšâ > In reply to @aruZeta "nice screenshot": VS Code Coldcode extension. |
21:56:16 | FromDiscord | <!Patitotective> In reply to @Generic "yes, with UTF-8 just": so i can use my same parser and check if `input[idx].int in 0x21..0x10FFFF`ÂĄ |
21:56:18 | FromDiscord | <!Patitotective> (edit) "0x21..0x10FFFF`ÂĄ" => "0x21..0x10FFFF`?" |
21:56:20 | FromDiscord | <ââȘ©ïčâȘšâ > (edit) "Coldcode" => "ColdCode" |
21:56:22 | FromDiscord | <Generic> no |
21:56:36 | FromDiscord | <Generic> ignore what I wrote earlier, you need to decode it into runes |
21:57:08 | FromDiscord | <!Patitotective> and to do that, do i use the `runes` iterator or `runeAt` procedure? |
21:57:26 | FromDiscord | <Generic> it depends on the other code |
21:57:33 | FromDiscord | <Generic> which will call your parse procedure |
21:57:59 | FromDiscord | <Generic> what exactly do you want to do when with the runes you found |
21:58:40 | FromDiscord | <!Patitotective> check if they're above 0x20 and below or same as 0x10FFFF (?) |
21:58:53 | FromDiscord | <Generic> but do you want to replace them afterwards or what? |
21:59:34 | FromDiscord | <!Patitotective> nope, if they're not in that range then return 0 because its not valid |
22:00:27 | FromDiscord | <Generic> if that's all you want to do and you don't care whether the UTF-8 is actually valid, there's actually a pretty evil trick you can do |
22:01:01 | FromDiscord | <!Patitotective> đ |
22:01:35 | FromDiscord | <Generic> oh wait |
22:01:54 | FromDiscord | <Generic> 0x10FFFF is the maximum code point in UTF-8 |
22:02:02 | FromDiscord | <Generic> is your input data even UTF-8? |
22:03:24 | FromDiscord | <!Patitotective> i'm just trying to follow this specificationâ”my input is any valid nim string i guess https://media.discordapp.net/attachments/371759389889003532/1012482349553963018/unknown.png |
22:03:50 | FromDiscord | <Generic> every possible byte sequence is a valid Nim string |
22:04:37 | FromDiscord | <Generic> the second criterion can only be violated by UTF-32 encoded strings |
22:05:38 | FromDiscord | <Rika> Thatâs not what they mean |
22:06:00 | FromDiscord | <Rika> They have a string that can be anything, they want to parse by ignoring invalid bytes |
22:06:47 | FromDiscord | <!Patitotective> rather than ignoring, erroring |
22:07:56 | FromDiscord | <Rika> Then whatâs wrong with that runes iterator? |
22:09:10 | FromDiscord | <!Patitotective> it's not like there's something wrong but that i cannot do `inc idx` anymore |
22:09:15 | FromDiscord | <Generic> In reply to @aruZeta "I'm asking cuz I'm": you need to convert the proc references from nim call to a closure call i.e. `(proc (x, y: int): bool)(mask0), proc (x, y: int): bool)(mask1), ...` |
22:09:35 | FromDiscord | <aruZeta> hmm |
22:09:41 | FromDiscord | <aruZeta> anyway I did it in a better way |
22:10:33 | FromDiscord | <Rika> In reply to @Patitotective "it's not like there's": Yeah, so what? Iâm not sure what you need that for |
22:12:00 | FromDiscord | <!Patitotective> ok, thanks, let me try |
22:14:50 | FromDiscord | <!Patitotective> since i have this invalid characters set `nonIdenChars + {' '}`, and now i have runesâ”what would be the best way to compare them? converting the set to runes? converting the rune and the set to integers? |
22:16:44 | FromDiscord | <@bracketmaster-5a708063d73408ce4> has somebody written a tool like `make` in nim? |
22:16:52 | FromDiscord | <Elegantbeef> nake exists |
22:17:58 | * | pro quit (Quit: pro) |
22:18:50 | FromDiscord | <@bracketmaster-5a708063d73408ce4> looking at nake |
22:19:01 | FromDiscord | <@bracketmaster-5a708063d73408ce4> does it handle files as outputs? |
22:19:07 | FromDiscord | <@bracketmaster-5a708063d73408ce4> And files as dependencies? |
22:19:14 | FromDiscord | <Elegantbeef> No clue what either of those mean |
22:22:50 | * | ehmry quit (Ping timeout: 244 seconds) |
22:25:09 | * | notchris_ joined #nim |
22:25:26 | * | tk quit (Ping timeout: 244 seconds) |
22:25:48 | * | estiquelapice_ joined #nim |
22:31:42 | * | madprops_ joined #nim |
22:33:04 | * | sagax quit (*.net *.split) |
22:33:04 | * | oddish quit (*.net *.split) |
22:33:04 | * | alice quit (*.net *.split) |
22:33:04 | * | estiquelapice quit (*.net *.split) |
22:33:04 | * | madprops quit (*.net *.split) |
22:33:04 | * | notchris quit (*.net *.split) |
22:33:10 | * | notchris_ is now known as notchris |
22:35:15 | * | madprops_ is now known as madprops |
22:35:15 | * | madprops quit (Changing host) |
22:35:15 | * | madprops joined #nim |
22:53:11 | FromDiscord | <!Patitotective> actually i dont seem to need runes at allâ”nim strings cannot be higher than 0x10ffff and 0x20 is easy to check since its just ascii :p |
22:53:45 | FromDiscord | <Elegantbeef> The hell are you doing? |
22:54:46 | FromDiscord | <!Patitotective> trying to make a nim KDL (a cuddly document language) implementation https://media.discordapp.net/attachments/371759389889003532/1012495279427174520/unknown.png |
22:55:45 | FromDiscord | <Elegantbeef> And is https://nim-lang.org/docs/strutils.html#validIdentifier%2Cstring too complicated? |
22:57:28 | FromDiscord | <Elegantbeef> I dont really get what you're doing so i'll shush |
22:58:56 | * | tk joined #nim |
22:59:48 | FromDiscord | <!Patitotective> i'm making a parse procedure that takes an input string and returns the number of characters until an invalid character (according to KDL's spec) is foundâ”and about `validIdentifier`, not sure it fulfills KDL requirements :p |
23:00:09 | FromDiscord | <Elegantbeef> Yea it clearly doesnt |
23:00:23 | FromDiscord | <!Patitotective> btw how was the nim cli real time interpreter called? |
23:00:28 | FromDiscord | <Elegantbeef> So then yea you'd use the unicode rune operator and check if the above is true |
23:00:33 | FromDiscord | <Elegantbeef> nim secret |
23:01:11 | FromDiscord | <!Patitotective> lmao https://media.discordapp.net/attachments/371759389889003532/1012496892065763379/unknown.png |
23:01:11 | FromDiscord | <Elegantbeef> Jesus christ the unicode module doesnt support openarrays |
23:01:15 | FromDiscord | <Elegantbeef> Literally unusable |
23:01:26 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "Jesus christ the unicode": yeah, i had to slice đ |
23:01:39 | FromDiscord | <Elegantbeef> Copy paste the module and make it take openarray[char] |
23:01:56 | FromDiscord | <Rika> Then patch file |
23:01:57 | FromDiscord | <Rika> Haha |
23:02:10 | FromDiscord | <Elegantbeef> Exactly |
23:02:20 | FromDiscord | <Elegantbeef> I dont get why it doesnt take `openarray[char]` it's so weird |
23:02:21 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "nim secret": h-how do i install it?.... |
23:02:30 | FromDiscord | <Elegantbeef> Do you have the nimcompiler? |
23:02:32 | FromDiscord | <Elegantbeef> It's installed |
23:02:37 | FromDiscord | <!Patitotective> then how do i run it |
23:02:40 | FromDiscord | <Elegantbeef> Or do you mean inim |
23:02:47 | FromDiscord | <Elegantbeef> cmon |
23:02:52 | FromDiscord | <!Patitotective> oh yea it was inim đ |
23:02:54 | FromDiscord | <Elegantbeef> The nim VM repl is `nim secret` |
23:05:37 | FromDiscord | <!Patitotective> was the patch file and copy/pasting unicode module a joke or should i actually do it? if so where is documentation about patch files :p |
23:05:57 | FromDiscord | <Elegantbeef> I mean you dont need to patchfile cause it doesnt really matter if other modules use the std/unicode |
23:06:04 | FromDiscord | <Elegantbeef> But the copy pasting is ideal if you want performance |
23:07:00 | FromDiscord | <!Patitotective> i wont do it for now and when i finish it i'll do it and compare performance :] |
23:07:12 | * | rockcavera quit (Read error: Connection reset by peer) |
23:07:41 | * | rockcavera joined #nim |
23:07:41 | * | rockcavera quit (Changing host) |
23:07:41 | * | rockcavera joined #nim |
23:11:52 | * | alice joined #nim |
23:13:15 | * | ehmry joined #nim |
23:15:23 | FromDiscord | <auxym> In reply to @Patitotective "trying to make a": neat! I was thinking of doing that, but I won't complain if you save me the work! |
23:15:52 | FromDiscord | <!Patitotective> In reply to @auxym "neat! I was thinking": :p |
23:17:54 | FromDiscord | <!Patitotective> not being able to have a raw string start with double quotes is really annoying |
23:30:41 | FromDiscord | <Rika> You canât? |
23:31:27 | FromDiscord | <Rika> !eval echo r""""idk"""" |
23:31:32 | NimBot | "idk" |
23:31:46 | FromDiscord | <Rika> @!Patitotective |
23:32:26 | FromDiscord | <Elegantbeef> Also this is nim even if you couldnt you could do `proc doubleQuote(s: static string): string = ...` |
23:33:21 | FromDiscord | <!Patitotective> !eval echo """"idx"""" |
23:33:26 | NimBot | "idx" |
23:33:47 | FromDiscord | <!Patitotective> seems like multi-line strings allow double quotes :p |
23:34:22 | FromDiscord | <Rika> đ€ |
23:35:30 | FromDiscord | <!Patitotective> because they're raw already |
23:35:33 | FromDiscord | <!Patitotective> https://nim-lang.org/docs/manual.html#lexical-analysis-triple-quoted-string-literals |
23:36:05 | FromDiscord | <!Patitotective> In reply to @Patitotective "because they're raw already": i mean, do not interpret escaped sequences and allow double quotes (without having to write two) |
23:37:18 | FromDiscord | <Rika> ? |
23:37:27 | FromDiscord | <Rika> yeah okay so? |
23:37:37 | FromDiscord | <Rika> im confused, what do you want exactly? |
23:37:37 | FromDiscord | <!Patitotective> sooo what |
23:38:06 | FromDiscord | <!Patitotective> ummm nothing particularly |
23:38:19 | FromDiscord | <!Patitotective> i mean, i dont have that problem anymore |
23:38:20 | FromDiscord | <!Patitotective> :p |
23:42:19 | FromDiscord | <!Patitotective> i have two procedures, one that validates a KDL number and another actually converts the input string into a floatâ”how should i name them? `validate` and `parse` or `validate` and `evaluate`? |
23:44:49 | FromDiscord | <Rika> parse |
23:44:57 | FromDiscord | <Rika> evaluate involves running some code |
23:46:58 | FromDiscord | <!Patitotective> :] |
23:49:30 | FromDiscord | <!Patitotective> can i use a case statement with open array instead of slicing the string? |
23:51:40 | FromDiscord | <ââȘ©ïčâȘšâ > Ok, I think I bugfixed the code again. |
23:52:49 | FromDiscord | <ââȘ©ïčâȘšâ > Now I have to find the way I can set some modifiers so the user can choose if the interpreter can wrap, the length of the array, the max value of each cell, etc. https://media.discordapp.net/attachments/371759389889003532/1012509886925508618/unknown.png |