00:00:16 | * | NimBot joined #nim |
00:00:21 | * | systemdsucks joined #nim |
00:00:23 | * | disso_peach joined #nim |
00:01:05 | FromDiscord | <Elegantbeef> Lent only doesnt copy if consumed directly |
00:01:08 | * | tiorock joined #nim |
00:01:18 | * | djanatyn joined #nim |
00:01:34 | * | tiorock quit (Changing host) |
00:01:34 | * | tiorock joined #nim |
00:01:34 | * | rockcavera is now known as Guest3976 |
00:01:34 | * | Guest3976 quit (Killed (silver.libera.chat (Nickname regained by services))) |
00:01:34 | * | tiorock is now known as rockcavera |
00:02:15 | * | void09 joined #nim |
00:02:31 | * | ehmry joined #nim |
00:02:41 | * | dom96 joined #nim |
00:02:44 | FromDiscord | <Elegantbeef> If it cannot be consumed 😄 |
00:02:48 | * | jkl joined #nim |
00:02:50 | * | tinystoat joined #nim |
00:03:27 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4isU |
00:03:50 | FromDiscord | <Elegantbeef> Do to the constraint `lent` doesnt need to be passed by `ptr/ref/var` |
00:05:20 | FromDiscord | <arkanoid> sent a long message, see http://ix.io/4isW |
00:05:23 | * | madprog joined #nim |
00:06:14 | FromDiscord | <arkanoid> It feels like I am missing something really important here |
00:07:38 | FromDiscord | <Yepoleb> Is is at 100% cpu constantly or only when you type? |
00:10:26 | FromDiscord | <arkanoid> @Yepoleb\: only when I'm working on the project. If I leave it thinking for a while, it sets down. |
00:10:54 | FromDiscord | <arkanoid> But it takes so much effort it seems like doing cryptos lol |
00:11:52 | FromDiscord | <Elegantbeef> How many instances of nimsuggest do you have open when it happens |
00:14:20 | FromDiscord | <arkanoid> The amount if nimsuggest process instances seems to depend on the amount of "projects" I setup in the extension settings, which is 3 in my general context\: main lib, tests, python interface. This is needed to get hints and errors on all 3 |
00:14:46 | FromDiscord | <Elegantbeef> Ok so sounds like you have it setup properly |
00:14:52 | FromDiscord | <Elegantbeef> Nimsuggest is just quite buggy sadly |
00:14:59 | FromDiscord | <arkanoid> I'm thinking about not running it on tests and python interface, but just main lib |
00:16:56 | FromDiscord | <arkanoid> Everytime this topic pops up in the forum, there's always blame on the user settings and on the extension by the main devs |
00:18:02 | FromDiscord | <arkanoid> I've read that JetzBrains developed their own official nim extension. I wonder if this is based on nimsuggests or not |
00:18:18 | FromDiscord | <Elegantbeef> it's not |
00:18:24 | FromDiscord | <Elegantbeef> it's also dumber |
00:19:07 | FromDiscord | <arkanoid> Ok. Makes sense. Easier problem to solve = less issues |
00:20:33 | FromDiscord | <arkanoid> I wonder if dropping a man in the middle like nimlsp would improve the situation |
00:24:20 | FromDiscord | <arkanoid> I know it is still based on nimsuggest, but here I'm not sure yet where the problem lives\:↵- is it me non configuring extension properly per project↵- is tue extension calling nimsuggest not in the vest way↵- is nimsuggest not dealing with the problem in the best way |
00:34:30 | FromDiscord | <Elegantbeef> Nimlangserver does just that |
00:35:00 | FromDiscord | <Elegantbeef> Araq is banking on IC to make tooling better |
00:35:32 | FromDiscord | <Elegantbeef> In otherwords if IC never comes nimsuggest will only get incrementally better 😄 |
00:53:31 | NimEventer | New Nimble package! waterpark - Thread-safe database connection pools, see https://github.com/guzba/waterpark |
00:54:32 | FromDiscord | <Yepoleb> @guzba congrats on releasing a new package! |
01:11:55 | FromDiscord | <b1rdf00d> great name |
01:40:08 | NimEventer | New thread by snej: StrictNotNil and bogus “cannot prove” errors, see https://forum.nim-lang.org/t/9718 |
01:53:42 | FromDiscord | <ShalokShalom> Does the Jetbrains plugin also use nimsuggest? |
01:57:23 | * | brettgilio joined #nim |
02:13:16 | arkanoid | ShalokShalom, I asked same question a couple of hours ago, Elegantbeef says no, and it's dumber than nimsuggests. Just scroll up some lines |
02:13:42 | FromDiscord | <ShalokShalom> Ah, I see |
02:13:48 | FromDiscord | <ShalokShalom> Sorry for you |
02:13:57 | FromDiscord | <ShalokShalom> It just got a recent update |
02:46:36 | arkanoid | ShalokShalom, what do you mean? |
02:58:15 | arkanoid | is this sufficient to test if {.packed.} pragma is doing it's job? cast[B](cast[A](objB)) |
03:00:54 | FromDiscord | <Elegantbeef> `static: assert sizeof(A) == sizeof(B)` 😄 |
03:02:10 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4itx |
03:02:42 | FromDiscord | <Elegantbeef> `static: assert sizeof(A) == packedSize(A)` should work for non complex objects |
03:05:58 | arkanoid | thanks! |
03:06:32 | arkanoid | seems that all my cast are passing this tests no matter if I use {.packed.} pragma or not |
03:06:50 | FromDiscord | <Elegantbeef> Likely your struct is packed already |
03:07:32 | arkanoid | I've been trying to understand when this happens. It says that it should happens when you have large fields on top, small on bottom, but this is not my case |
03:07:39 | arkanoid | also, I've found this https://github.com/nim-lang/Nim/commit/91a3cb67ec53f28c919316bf611bea07e8677d02 |
03:08:13 | arkanoid | not sure what it really means, but seems that the meaning of packed has been changed lately |
03:08:34 | arkanoid | well, not really lately |
03:27:24 | arkanoid | actually, nimpy fails to {.exportpy.} a function that has a {.packed.} object as input argument |
04:02:08 | FromDiscord | <j-james> In reply to @arkanoid "Even if I have": arkanoid: this is a known problem with the vscode extension for some reason, other extensions like nimlime and native lsp don't have it |
04:02:40 | FromDiscord | <j-james> anecdotally i fixed it by switching to sublime + nimlsp, and then from nimlsp to nimlangserver |
04:03:10 | FromDiscord | <j-james> now all that happens are nimlangserver crashes, which are easy to restart and don't peg the cpu |
04:03:42 | arkanoid | j-james, please tell me more. These kind of stories are worth long posts on the forum, I feel a lot of users are sharing this problem |
04:04:00 | arkanoid | wait, but what is nimlangserver? |
04:04:06 | arkanoid | I know nimlsp |
04:04:43 | FromDiscord | <j-james> nimlsp is pmunch's project, nimlangserver is under the nim-lang organization and iirc has a paid developer working on it |
04:04:49 | arkanoid | https://github.com/nim-lang/langserver#related-projects |
04:04:54 | arkanoid | oh dear, I missed this |
04:04:57 | arkanoid | thanks!! |
04:05:14 | FromDiscord | <j-james> previous versions of nimlangserver were not great and i believe that's why pmunch wrote his thing, but it's now gotten better |
04:05:40 | FromDiscord | <j-james> they both kinda just wrap nimsuggest into a language server - i'm not quite sure of the details of how they work |
04:06:35 | arkanoid | I though pmunch nimlsp was the only man in the middle in the field |
04:08:21 | FromDiscord | <j-james> yeah nimlangserver definitely should be better advertised |
04:08:36 | FromDiscord | <j-james> version 3 of it is relatively new though |
04:08:58 | FromDiscord | <j-james> also re: vscode extension: here's the bug i filed a while ago https://github.com/saem/vscode-nim/issues/93 |
04:09:58 | FromDiscord | <j-james> i didn't quite understand saem's explanation of why it can't kill stuck processes when seemingly native lsp support of nimlsp/nimlangserver works fine |
04:11:15 | FromDiscord | <Elegantbeef> To be fair until recently you couldnt use nimlangserver with stable |
04:11:28 | arkanoid | j-james I also feel like I am using vscode extension as required (proper nim.project section to run only the required process) but yet I face nimsuggest process eating 100% cpu |
04:12:06 | FromDiscord | <j-james> i felt the same way |
04:12:23 | FromDiscord | <j-james> using the vscode extension "properly" still causes it |
04:13:18 | FromDiscord | <Bung> it doesn't identify "stuck processes" |
04:13:46 | FromDiscord | <Gumbercules> is it even cpu usage? I thought it leaked memory |
04:13:59 | FromDiscord | <Gumbercules> or does it do both? |
04:14:06 | arkanoid | I also have been trying to teach nim to a friend of mine, including how to set settings.json for nim, but the first feedback I had from him after he started learning is .. problems with editor and its services, and cpu spinning |
04:14:09 | FromDiscord | <Bung> the route is run cmd then fails -\> kill the nimsuggest instance |
04:14:11 | FromDiscord | <Elegantbeef> It can do both |
04:14:15 | FromDiscord | <Gumbercules> gotcha |
04:14:26 | FromDiscord | <Elegantbeef> The biggest issue many face with Nim is tooling |
04:14:27 | FromDiscord | <j-james> which is weird? because i think saem's code is probably good, he's very aware of nim's internals |
04:14:31 | FromDiscord | <Elegantbeef> Then the compiler being buggy |
04:14:35 | FromDiscord | <j-james> so maybe it's a vscode limitation |
04:14:39 | FromDiscord | <Gumbercules> I mean this shits been an issue since I joined |
04:14:44 | FromDiscord | <Gumbercules> soooo 7 years running now |
04:15:02 | FromDiscord | <Elegantbeef> Yea presently it looks like the desire is that IC solves it |
04:15:11 | FromDiscord | <Elegantbeef> But that very much is likely optimistic |
04:15:18 | FromDiscord | <Bung> his explanation is about hard to do "per project per nimsuggest instance" |
04:15:18 | FromDiscord | <Gumbercules> Nim's tooling and docs always == Nim's biggest detractors |
04:15:29 | FromDiscord | <Gumbercules> it's all Nimble and this stupid project shit |
04:15:39 | FromDiscord | <Gumbercules> why do we need to have "projects" |
04:15:49 | FromDiscord | <Gumbercules> because Nimble forces it on us |
04:16:11 | FromDiscord | <sOkam!> otherwise you would have makefiles. i would rather have nimble, to be honest |
04:16:12 | FromDiscord | <Gumbercules> Nimbles whole structure your directories this way and build your solution around this concept of a project |
04:16:15 | FromDiscord | <Gumbercules> no |
04:16:23 | FromDiscord | <Gumbercules> you can have a dependency manager that just manages dependencies |
04:16:25 | FromDiscord | <Elegantbeef> Well the reason we need to have projects is cause we need to know the entry file for tooling |
04:16:31 | FromDiscord | <Gumbercules> a dependency manager should not be tightly coupled with a build system |
04:16:51 | FromDiscord | <Elegantbeef> When it comes to nimsuggest the project is literally just entry(ies) |
04:16:53 | FromDiscord | <Gumbercules> In reply to @Elegantbeef "Well the reason we": yeah we'd need to specify this somewhere |
04:16:54 | FromDiscord | <sOkam!> that would just be one extra step in the same process |
04:16:59 | FromDiscord | <Bung> yes, so the history is "nim package" used before "nimble" before nim package RFC |
04:17:15 | FromDiscord | <Gumbercules> In reply to @sOkam! "that would just be": single component single responsibility |
04:17:30 | FromDiscord | <Gumbercules> I don't need my dependency manager building my code |
04:17:50 | FromDiscord | <Gumbercules> they are two separate tasks and a dependency manager should manage dependencies well |
04:17:58 | FromDiscord | <Gumbercules> not concern itself with how my software is built |
04:18:06 | FromDiscord | <Gumbercules> I mean.... when did we get lockfiles finally for Nimble? |
04:18:13 | FromDiscord | <Gumbercules> two years ago? |
04:18:32 | FromDiscord | <Elegantbeef> We havent yet 😄 |
04:18:41 | FromDiscord | <Elegantbeef> Nim2.0 will ship with nimble 0.14 |
04:18:47 | FromDiscord | <Elegantbeef> Which will have lockfiles |
04:19:00 | FromDiscord | <Gumbercules> yeah so right now nimble does nothing really well |
04:19:05 | FromDiscord | <Gumbercules> besides annoy people |
04:19:37 | FromDiscord | <Gumbercules> for me - git submodules + a config.nims with tasks in it works better than Nimble ever did |
04:19:41 | FromDiscord | <j-james> meh i like nimble |
04:19:46 | FromDiscord | <Gumbercules> you haven't 'used it enough |
04:19:50 | FromDiscord | <Gumbercules> (edit) "'used" => "used" |
04:19:52 | FromDiscord | <j-james> git submodules on the other hand holy shit |
04:19:54 | FromDiscord | <j-james> bane of my life |
04:21:13 | FromDiscord | <Gumbercules> dependency managers should be relatively unopiniated |
04:21:33 | FromDiscord | <Gumbercules> they definitely shouldn't force some directory structure upon you in order for your project to work |
04:22:09 | FromDiscord | <Gumbercules> and they should enable reproducible builds |
04:23:29 | FromDiscord | <Gumbercules> nimble develop, now that's some holy shit territory |
04:24:11 | FromDiscord | <Gumbercules> I liked with Zig did with their build system |
04:24:14 | FromDiscord | <Elegantbeef> I personally quite enjoy nimble develop |
04:24:31 | FromDiscord | <Gumbercules> it's fine if you have been down that road before and know what you're doing - but it's so easy to fuck up |
04:25:00 | FromDiscord | <Bung> no, it should force some directory structure, I dont see any benefit randomly use project directory structure |
04:25:05 | FromDiscord | <Gumbercules> especially with multiple Nim versions installed on the same machine |
04:25:31 | FromDiscord | <j-james> In reply to @arkanoid "j-james, please tell me": anyway yeah i agree |
04:25:48 | FromDiscord | <j-james> i think some comprehensive best practices or tooling guide would be helpful |
04:26:00 | FromDiscord | <j-james> awesome-nim is perhaps the closest to that, which is weird |
04:26:03 | FromDiscord | <Gumbercules> status has a decent one |
04:26:19 | FromDiscord | <Elegantbeef> Eh status' guide is heavily opinionated |
04:26:22 | FromDiscord | <Gumbercules> at least regarding best practices |
04:26:22 | FromDiscord | <Gumbercules> sure |
04:26:36 | FromDiscord | <Gumbercules> but they're also writing commercial software with Nim |
04:26:45 | FromDiscord | <Gumbercules> and have multiple people working on the same codebase at once |
04:27:13 | FromDiscord | <Gumbercules> https://status-im.github.io/nim-style-guide/tooling.deps.html |
04:27:23 | FromDiscord | <Gumbercules> whoops |
04:27:43 | FromDiscord | <Gumbercules> meant to link to the root but |
04:32:31 | FromDiscord | <Gumbercules> https://ssalewski.de/nimprogramming.html#_nimble_package_manager might also be useful |
04:32:33 | arkanoid | I strongly agree with a pinned "tooling status" post on the forum, or a page on the website. It's not about making promises or complain about something, just share what are the best practices to make current tooling usable without asking the user to discover all the details and the workarounds on its own |
04:33:22 | FromDiscord | <Gumbercules> everyone has different preferences though around editors / IDEs / build systems etc |
04:34:22 | FromDiscord | <Gumbercules> wouldn't making it work be a better use of time? |
04:34:55 | arkanoid | Gumercules, no, it's much cheaper to tell a story, than to invent a new one |
04:35:06 | FromDiscord | <Elegantbeef> I think the main point is that it's much easier to write a guide to make it 'work' than it is for developers to make it work |
04:35:24 | FromDiscord | <Gumbercules> I guess if we're just talking VSCode and Nimsuggest sure |
04:36:33 | arkanoid | considering that nimslp, nimlangserver, vscode extension and possibly all the others rely on nimsuggest, they all may be sharing same issues |
04:36:53 | FromDiscord | <Elegantbeef> Well yea nimsuggest needs to be fixed |
04:37:11 | FromDiscord | <Elegantbeef> But it's more and more looking like IC is the more likely path out of tooling hell |
04:37:15 | FromDiscord | <Gumbercules> yeah and I guess that's my point - documenting the workaround for all of these sounds very time consuming |
04:37:30 | FromDiscord | <Elegantbeef> Anyone can document it, only a compiler dev can fix it |
04:37:40 | FromDiscord | <Gumbercules> yeah I have no idea what the underlying issue is |
04:37:43 | FromDiscord | <Gumbercules> or issues are |
04:38:52 | FromDiscord | <Bung> take over projects use variant project directory structure, stop make compatible with one project and other. |
04:38:53 | arkanoid | I hope you share at least that the order of complexity is: IC >>> nimsuggest >> lsp/extension > guide |
04:40:29 | FromDiscord | <Gumbercules> I mean IC has been on the radar for years now |
04:40:45 | FromDiscord | <Gumbercules> I don't know when it will be a real thing |
04:40:55 | FromDiscord | <Gumbercules> I've also been out of the loop for several months |
04:40:56 | FromDiscord | <Elegantbeef> I havent looked much into nimsuggest issues but there are a few issues, one is that it's a neutered compiler so it does some cheats in the goal of speed. Which can result in bad behaviour. Another is that it recompiles code without a consistent cache so false errors are createed |
04:41:12 | FromDiscord | <Gumbercules> it's also using threads and channels |
04:41:20 | FromDiscord | <Elegantbeef> It's the next thing araq wants to focus on after 2.0, whether that's the case has yet to be seen |
04:41:37 | FromDiscord | <Gumbercules> yeah these things tend to change quite a bit |
04:41:51 | FromDiscord | <Gumbercules> since the roadmap is in his head |
04:42:28 | FromDiscord | <Elegantbeef> To be fair 'Refactorings of the compilation pipeline in anticipation of IC.' is a hard goal for 2.0 |
04:42:35 | FromDiscord | <Gumbercules> gotcha |
04:43:18 | FromDiscord | <Gumbercules> I don't know if folks have done profiling / run sanitizers against it |
04:43:27 | FromDiscord | <Gumbercules> I assume so, but I have no clue |
04:56:25 | arkanoid | yes, I still believe that writing a long forum post about this is way way cheaper than looking into nim compiler / nimsuggest / ide extensions |
04:56:50 | arkanoid | better than a forum post would be a wiki page, or kinda like it |
04:57:22 | arkanoid | but having the website on github would cover same requirements? just guessing |
04:57:44 | FromDiscord | <Elegantbeef> Sad part about wiki is inane modification spam |
04:58:38 | FromDiscord | <Bung> I think it can go nim wiki IDE part |
05:00:53 | * | arkurious quit (Quit: Leaving) |
05:01:23 | FromDiscord | <ringabout> https://github.com/nim-lang/Nim/wiki/Organizations-using-Nim/_compare/9b20795%5E...9b20795 How could we know whether it is an add or not |
05:02:04 | FromDiscord | <ringabout> (edit) "add" => "ad" |
05:04:03 | arkanoid | ringabout, should we care at this time? I don't think so. The more, the better. It's not like Nim is responsible for the tools or revenue created with it |
05:06:08 | FromDiscord | <ringabout> In reply to @arkanoid "<@658563905425244160>, should we care": It seems that according to https://forum.nim-lang.org/t/9647 they (the author of the commit) does want to rewrite their code into Nim. |
05:06:14 | FromDiscord | <ringabout> (edit) "into" => "in" |
05:09:39 | arkanoid | ringabout, and? |
05:09:47 | arkanoid | sorry but I fear I am not following you |
05:09:58 | arkanoid | how is the second part linked to the first one? |
05:13:51 | FromDiscord | <ringabout> In reply to @arkanoid "how is the second": Are you on the irc? I have deleted the first message before your first reply. I think they are likely to be true according to their post in the forum. |
05:26:06 | * | wallabra_ joined #nim |
05:27:27 | * | wallabra quit (Ping timeout: 268 seconds) |
05:27:28 | * | wallabra_ is now known as wallabra |
06:13:40 | * | tiorock joined #nim |
06:13:40 | * | tiorock quit (Changing host) |
06:13:40 | * | tiorock joined #nim |
06:13:40 | * | rockcavera is now known as Guest5354 |
06:13:40 | * | tiorock is now known as rockcavera |
06:16:45 | * | Guest5354 quit (Ping timeout: 260 seconds) |
06:33:19 | * | kenran joined #nim |
06:33:23 | * | kenran quit (Remote host closed the connection) |
06:53:35 | * | Simon[m]12345 left #nim (#nim) |
07:29:46 | FromDiscord | <Gumbercules> ugh - first time using a `ref` type in a long time |
07:30:16 | FromDiscord | <Gumbercules> was using `std/json`'s `parseJson` and I kept getting some weird traceback - just realized it has to do with the whole default value thing |
07:31:57 | FromDiscord | <Gumbercules> I guess I don't need to worry about this for now since I can't supply a default value for `JsonNode`? |
07:38:29 | * | PMunch joined #nim |
07:40:06 | * | genpaku quit (Remote host closed the connection) |
07:40:50 | * | genpaku joined #nim |
07:45:46 | * | rockcavera quit (Remote host closed the connection) |
07:49:12 | FromDiscord | <Elegantbeef> Yea you cannot provide default values outside of a module's definition |
07:49:40 | FromDiscord | <Elegantbeef> `std/jsonutils` is better for general parsing |
07:49:43 | FromDiscord | <Elegantbeef> Since it supports hooks |
08:13:03 | FromDiscord | <Gumbercules> appreciate the protip |
08:22:05 | FromDiscord | <Gumbercules> @ElegantBeef if I need custom unmarshalling do I need to delve into userland? A few of the fields in the object I'd be using to represent the unmarshalled JSON need to have their values looked up based on the content of the corresponding JSON field |
08:25:22 | FromDiscord | <Elegantbeef> I think jsonutils works in that case |
08:25:48 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/blob/version-1-6/lib/std/jsonutils.nim#L459 |
08:28:04 | FromDiscord | <Elegantbeef> @Gumbercules what's the data you got? |
08:29:26 | FromDiscord | <Gumbercules> sent a code paste, see https://play.nim-lang.org/#ix=4iuI |
08:30:01 | FromDiscord | <Gumbercules> so for instance, I need to convert language to an enum member |
08:30:10 | FromDiscord | <Gumbercules> actually in my case a distinct uint32 |
08:30:31 | FromDiscord | <Gumbercules> I have a proc that I need to call that does this |
08:30:54 | FromDiscord | <Elegantbeef> Yea this is all fine you just need to manually handle it |
08:31:02 | FromDiscord | <Gumbercules> ah I see |
08:31:08 | FromDiscord | <Gumbercules> I need to define `jsonTo` I guess |
08:31:28 | FromDiscord | <Elegantbeef> `fromJsonHook` and `toJsonHook` |
08:31:35 | FromDiscord | <Gumbercules> oh okay |
08:31:38 | FromDiscord | <Elegantbeef> You can define it for your special types if you need |
08:31:44 | FromDiscord | <Gumbercules> gotcha - I see now, thanks |
09:10:33 | FromDiscord | <everyon> sent a code paste, see https://play.nim-lang.org/#ix=4iuR |
09:10:50 | FromDiscord | <luteva> Hi! Is there a key value store, like lmDB, rocksdb etc. that can operate directly on objects/complex types? The ones i was looking at, are all working on strings only, so i always have to marchal/unmarshal everything. |
09:24:06 | FromDiscord | <planetis> In reply to @everyon "hmm, I was just": an echo that has to grab a lock for the stdout, write to a buffer which is then flushed? also strformat quite possible allocates temporary strings which are appended, so pbl also a re-allocate. |
09:24:18 | FromDiscord | <planetis> (edit) removed "possible" |
09:24:53 | FromDiscord | <planetis> echo is debug only it shouldn't be used in loops |
09:25:18 | FromDiscord | <everyon> well, it outputs every 2 or so seconds, it's fine |
09:26:07 | FromDiscord | <everyon> (edit) "fine" => "fine↵and it's not included in measured time" |
09:26:09 | FromDiscord | <planetis> ...and I noticed that it's after the cpuTime, so maybe the C compiler reordering the statements |
09:26:37 | FromDiscord | <planetis> the C compilers do that all the time. |
09:26:55 | FromDiscord | <everyon> In reply to @planetis "an echo that has": but it's faster by 10% with echo, not slower |
09:27:05 | FromDiscord | <planetis> faster? |
09:27:06 | FromDiscord | <everyon> that's why I'm confused |
09:27:35 | FromDiscord | <planetis> Indeed makes no sense, I will try it. |
09:27:51 | FromDiscord | <planetis> if only I had the file... |
09:27:59 | FromDiscord | <everyon> yeah, I can send the code |
09:28:02 | FromDiscord | <planetis> nvm |
09:33:21 | FromDiscord | <everyon> yeah, I will, one sec, just playing around with some stuff |
09:37:59 | FromDiscord | <j-james> In reply to @everyon "hmm, I was just": what is the features library / file? |
09:39:06 | FromDiscord | <everyon> In reply to @apropos "what is the features": it defines the extractFeatures function, that calculates a bunch of metrics on a piece of text, I'll send the code↵it's a little bit messy rn, will clean it up later |
09:39:23 | FromDiscord | <everyon> In reply to @planetis "~~nvm.~~ Sry I typed": https://media.discordapp.net/attachments/371759389889003532/1052157778640244747/features.nim https://media.discordapp.net/attachments/371759389889003532/1052157778992574484/benchmark.nim |
09:41:34 | FromDiscord | <planetis> still missing the 5k.jsonl file |
09:42:47 | FromDiscord | <everyon> In reply to @planetis "still missing the 5k.jsonl": oh yeah, right |
09:43:35 | FromDiscord | <j-james> i'd toss it into something like https://godbolt.org/ to take a look at |
09:43:47 | FromDiscord | <j-james> preferably with a minimum reproducible example |
09:43:50 | FromDiscord | <everyon> In reply to @everyon "oh yeah, right": here it is https://media.discordapp.net/attachments/371759389889003532/1052158897999331359/5k.zip |
09:44:00 | FromDiscord | <planetis> thanks |
09:45:21 | FromDiscord | <everyon> by the way, I'm running that benchmark in WSL with Ubuntu 22.04↵compiling with↵`nim c -d:danger benchmark.nim` |
09:45:39 | FromDiscord | <planetis> nim -v? |
09:46:38 | FromDiscord | <everyon> In reply to @planetis "nim -v?": Nim Compiler Version 1.6.10 [Linux: amd64]↵Compiled at 2022-11-21 |
09:47:01 | FromDiscord | <planetis> I am on devel, so I have --mm:orc --threads:on by default |
09:47:21 | FromDiscord | <everyon> In reply to @everyon "Nim Compiler Version 1.6.10": and gcc 11.3.0 |
09:51:41 | * | pro joined #nim |
09:52:36 | FromDiscord | <everyon> I tried orc, and removing strformat made little to no difference |
09:52:43 | FromDiscord | <planetis> Took a chunk of it to make it faster |
09:53:04 | FromDiscord | <ShalokShalom> In reply to @arkanoid "<@208199869301522432>, what do you": The Jetbrains Plugin just got an update a week ago, maybe that solves some of the issues 🙂 |
09:53:06 | FromDiscord | <everyon> In reply to @everyon "I tried orc, and": the performance was roughly the same with or without the echo |
09:53:32 | FromDiscord | <everyon> so I guess that's not compiler magic, but GC magic |
09:53:56 | FromDiscord | <everyon> I suspected that, but I've only tried refc and arc |
09:54:06 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "But it's more and": IC? |
09:55:03 | FromDiscord | <Elegantbeef> Incremental compilation |
09:56:36 | FromDiscord | <everyon> In reply to @everyon "I suspected that, but": with arc it's actually faster to have no echo every iteration, as you would expect |
09:58:27 | FromDiscord | <planetis> so its just the garbage collection triggering in the wrong place |
10:02:04 | FromDiscord | <everyon> I guess so 🤷 |
10:03:01 | FromDiscord | <planetis> I can't tell a difference with 100 lines files, since the benchmark should run many times to produce reliable data |
10:03:36 | FromDiscord | <planetis> but maybe putting GC_fullCollect() next to the commented echo could help |
10:03:50 | FromDiscord | <planetis> (edit) "files," => "file," |
10:05:11 | FromDiscord | <everyon> yeah, that does look like it, putting it there makes about the same difference as uncommenting that echo |
10:05:25 | FromDiscord | <planetis> but orc is indeed faster 3.7s vs 2.9 |
10:05:38 | FromDiscord | <everyon> In reply to @everyon "yeah, that does look": so GC just does it's thing in the middle of the loop |
10:05:47 | FromDiscord | <everyon> (edit) "In reply to @everyon "yeah, that does look": so GC just does it's thing in the middle of the loop ... " added "and makes it slow down" |
10:06:12 | FromDiscord | <Elegantbeef> It is scope based MM |
10:06:31 | FromDiscord | <planetis> just compiled with AddressSanitizer and nothing bad popped up either |
10:06:35 | FromDiscord | <Elegantbeef> you can do `--expandArc:myProc` to see `arc` vs `orc` |
10:07:36 | FromDiscord | <planetis> doesn;t work with --mm:refc |
10:08:03 | FromDiscord | <Elegantbeef> Well with refc you can disable the GC then reenable it after |
10:08:23 | FromDiscord | <Elegantbeef> `GcDisable` and `GcEnable` respectively |
10:09:04 | FromDiscord | <planetis> Thats even better, but wonder how much the memory would grow |
10:10:11 | * | vicecea quit (Ping timeout: 246 seconds) |
10:10:24 | FromDiscord | <Elegantbeef> I mean if we're hunting the slowdown |
10:12:20 | FromDiscord | <planetis> good point, I am comparing refc with orc guess I've hidden agenda and shouldn't be involved 🙂 |
10:14:31 | FromDiscord | <planetis> --exceptions:goto --mm:refc give me better times, can you try? |
10:14:46 | FromDiscord | <planetis> 3.2s vs 3.7 |
10:15:32 | FromDiscord | <planetis> anyway gtg |
10:16:21 | FromDiscord | <ShalokShalom> @ElegantBeef#0000 thanks |
10:17:28 | FromDiscord | <jmgomez> In reply to @Elegantbeef "Incremental compilation": when I looked at it and got it partially working by cherry picking the modules, it seemed slower than actual nim compilation in a lot of cases.. |
10:18:12 | FromDiscord | <jmgomez> it was generating files 700mb+ |
10:18:36 | FromDiscord | <jmgomez> just loading them into memory took more time than the whole compilation |
10:23:26 | FromDiscord | <Elegantbeef> Make it work, then make it work fast |
10:26:13 | FromDiscord | <jmgomez> yeah, you are right. It was a task out of what I can handle though and I had alternative for NimForUE which is not mutually exclusive from IC |
10:26:16 | FromDiscord | <everyon> In reply to @planetis "--exceptions:goto --mm:refc give me": and a little bit worse for me↵interesting↵well, thanks for info, now I know a little bit more about GCs |
10:27:05 | FromDiscord | <jmgomez> I just wanted to tweak it in a way where I could pick the modules that got IC but again, once I did it, it was just slower than initially |
10:39:20 | FromDiscord | <ShalokShalom> In reply to @Elegantbeef "Make it work, then": You mean, its already stable |
10:39:25 | FromDiscord | <ShalokShalom> And just not efficient |
10:40:22 | FromDiscord | <jmgomez> In reply to @ShalokShalom "You mean, its already": no, there is a ordering issue that it's hard to fix |
10:40:30 | FromDiscord | <jmgomez> (edit) "a" => "an" |
10:40:36 | FromDiscord | <ShalokShalom> Ah, I see |
10:40:49 | FromDiscord | <jmgomez> what I did was to cherry pick the modules to get around it |
10:41:00 | FromDiscord | <ShalokShalom> Cause Elegant meant, IC seems to solve the issue of Nimsuggest crashing |
10:41:22 | FromDiscord | <ShalokShalom> I questioned, how this can be understood by now. |
10:41:44 | FromDiscord | <jmgomez> not sure why it crashes but probably beef is right, he usually is 😛 |
10:41:59 | FromDiscord | <ShalokShalom> Yes |
10:48:24 | * | Guest93 joined #nim |
10:48:44 | Guest93 | problem: |
10:48:46 | Guest93 | type |
10:48:47 | Guest93 | Prototype0Obj[s: static int] = ref Prototype0[s] |
10:48:47 | Guest93 | Prototype0[s: static int] = object |
10:48:48 | Guest93 | v: array[s, float64] |
10:48:50 | Guest93 | compiler says: |
10:49:14 | Guest93 | 0.nim(38, 49) Error: type expected |
10:50:07 | Guest93 | how to do that? I want a type for a reference on Prototype0 because I dont like copy |
11:01:22 | Guest93 | ah got it by splitting it into two type declarations |
11:05:15 | FromDiscord | <CHANDAN KUMAR> Refresh it even if error occurs use VPN |
11:18:41 | FromDiscord | <Rika> what |
11:19:58 | FromDiscord | <everyon> In reply to @Rika "what": probably some message didn't get bridged here |
11:22:04 | * | Guest93 quit (Quit: Client closed) |
11:59:28 | NimEventer | New thread by RodSteward: Status of exceptions with goto,setjmp with C++, see https://forum.nim-lang.org/t/9720 |
12:09:03 | FromDiscord | <luteva> can anyone explain why to use a converter? The doc only says that:↵"A converter is similar to a proc."↵So what are the differnces? What is the reason to introduce the keyword if you could do the same using a proc? |
12:11:50 | FromDiscord | <amadan> sent a code paste, see https://play.nim-lang.org/#ix=4ivk |
12:12:02 | FromDiscord | <amadan> (edit) "https://play.nim-lang.org/#ix=4ivk" => "https://play.nim-lang.org/#ix=4ivl" |
12:13:44 | FromDiscord | <luteva> ahhhh ok. so no proc call is needed, the conversion is done implicitly/automatically? |
12:14:44 | FromDiscord | <amadan> yup↵There are some limitations iirc, think it won't implicitly call a converter >= 1 |
12:14:48 | FromDiscord | <amadan> (edit) ">=" => ">" |
12:15:14 | FromDiscord | <luteva> ok thx! |
12:37:39 | * | ltriant quit (Ping timeout: 260 seconds) |
12:40:24 | * | jmdaemon quit (Ping timeout: 256 seconds) |
12:43:30 | * | pro quit (Ping timeout: 265 seconds) |
12:45:55 | FromDiscord | <ShalokShalom> Just got this shared on the Telegram channel and found it worth sharing |
12:45:56 | FromDiscord | <ShalokShalom> https://ssalewski.de/nimprogramming.html |
12:46:02 | FromDiscord | <ShalokShalom> Looks really promising. 🙂 |
12:49:40 | FromDiscord | <leetnewb> Have read that through a few times, but missed the changelog section. |
12:50:28 | * | pro joined #nim |
13:11:30 | FromDiscord | <luteva> how can i change the id/primary key in norm? it defaults to integer, but i want to use a form of UUID (or whatever unique string would be useful) |
13:19:46 | * | ltriant joined #nim |
13:25:02 | * | ltriant quit (Ping timeout: 272 seconds) |
13:30:52 | * | cp- quit (Ping timeout: 265 seconds) |
13:33:30 | FromDiscord | <luteva> is there a way to define a default value in a type declaration (instead of in the parameter definition of the new/init procedure)? |
13:34:30 | FromDiscord | <luteva> sent a code paste, see https://play.nim-lang.org/#ix=4ivH |
13:42:27 | FromDiscord | <amadan> In devel that code works |
13:43:39 | FromDiscord | <amadan> If you want something like that but for stable you can use beefs constructor package https://github.com/beef331/constructor#defaults |
14:03:15 | * | pro quit (Quit: pro) |
14:06:48 | * | Phytolizer joined #nim |
14:09:35 | * | moonlit joined #nim |
14:10:44 | * | moonlit quit (Client Quit) |
14:11:03 | * | moonlit joined #nim |
14:23:28 | * | rockcavera joined #nim |
14:28:10 | FromDiscord | <auxym> In reply to @luteva "is there a way": I believe nim v2.0 will have that, and should be released in the next few weeks (or you can use devel right now) |
14:28:27 | FromDiscord | <voidwalker> just a few weeks ? : o They're just doing it for the headlines then |
14:29:57 | FromDiscord | <ajusa> Oh are we not getting a 1.8 release? |
14:30:22 | FromDiscord | <ajusa> I thought IC was going to be one of the goals for 2.0, been a while since I read the document though |
14:30:25 | FromDiscord | <luteva> sent a long message, see http://ix.io/4ivO |
14:31:10 | FromDiscord | <luteva> (edit) "long message," => "code paste," | "http://ix.io/4ivO" => "https://play.nim-lang.org/#ix=4ivP" |
14:33:58 | * | Phytolizer quit (Remote host closed the connection) |
14:34:24 | * | Phytolizer joined #nim |
14:40:52 | * | moonlit quit (Remote host closed the connection) |
14:41:12 | * | moonlit joined #nim |
14:43:51 | FromDiscord | <auxym> In reply to @voidwalker "just a few weeks": I have no idea really, but during nimconf Araq mentioned that they planned "in 2022", but at this point I'm guessing that the release might slip a bit, hence my wild guess of "a few weeks" |
14:44:53 | FromDiscord | <auxym> IC is not a goal for 2.0 atm, from my understanding (unfortunately). it's still goal for "some later release" |
15:13:00 | * | PMunch quit (Quit: Leaving) |
15:21:54 | FromDiscord | <@thatrandomperson5-6310e3b26da03> How would i get the result of a macro in nim? Also, i tired echoing a nim node and it broke, how would i do this better? |
15:27:41 | FromDiscord | <vindaar> a macro produces code and not a value. can you say more about what you're trying to do? |
15:30:50 | * | Phytolizer quit (Remote host closed the connection) |
15:31:11 | * | Phytolizer joined #nim |
15:35:05 | * | ltriant joined #nim |
15:38:19 | FromDiscord | <@thatrandomperson5-6310e3b26da03> Ik, i want to get the code that it produces |
15:42:16 | FromDiscord | <Rika> as in print it? you can print the result with `treerepr` in macros module iirc |
15:43:23 | FromDiscord | <vindaar> or `repr` if you want to see the representation as "written code" and not the AST. but I'm not sure it's what they want |
15:43:47 | * | oprypin_ quit (Quit: Bye) |
15:44:06 | * | oprypin joined #nim |
15:44:22 | * | ltriant quit (Ping timeout: 272 seconds) |
15:50:51 | * | otisolsen70 joined #nim |
15:51:23 | otisolsen70 | I am trying to write a program that shows an icon in systray. I understand that I can use the "gfx" module for this. However, this module does not seem to be available on my system. How do I get it? |
15:52:03 | otisolsen70 | I have tried using nim as installed in debian 11. This is nim v0.19 which is quite old. I then tried using Nim installed on MacOS using brew. This is Nim v 1.6 which is quite new. But both could not find "gfx" |
15:53:26 | FromDiscord | <Rika> what gfx module? |
15:57:07 | otisolsen70 | There isnt a gfx module in standard lib? |
16:00:22 | FromDiscord | <Rika> i am unaware of any. |
16:02:28 | otisolsen70 | Haha. OK. I am trying to learn GUI programming with Nim. I then asked ChatGPT to show me an example of how to have my program put an icon in the systray. It produced a fine example in which it utilized modules gui and gfx. Which I now realize do not exsist. |
16:09:38 | FromDiscord | <ambient> ChatGPT is very good at generating very convincing nonsense |
16:12:05 | FromDiscord | <treeform> In reply to @otisolsen70 "Haha. OK. I am": windy has systray functionality |
16:12:24 | FromDiscord | <treeform> https://github.com/treeform/windy/blob/master/examples/tray.nim |
16:12:50 | FromDiscord | <treeform> but I think it's mostly windows only, very limited on mac and none on linux. |
16:16:56 | otisolsen70 | OK. Thanks for the tip. Will look into that. |
16:17:14 | otisolsen70 | Is there some package manager for external modules for nim? Like pip for python? |
16:19:10 | otisolsen70 | ChatGPT is indeed good at generating convincing nonsense |
16:19:16 | * | pro joined #nim |
16:20:58 | * | Phytolizer quit (Ping timeout: 260 seconds) |
16:21:28 | FromDiscord | <Rika> nim has nimble for package management (but there are other package managers) |
16:21:41 | FromDiscord | <Rika> the most commonly used one is nimble, though |
16:23:05 | arkanoid | been testing nimlangserver + vscode-extension and the general feedback is much better than without nimlangserver. I'm talking about this: https://github.com/nim-lang/langserver#configuration-options |
16:23:57 | * | pro quit (Client Quit) |
16:27:57 | otisolsen70 | What is a good IDE for nim? |
16:31:48 | FromDiscord | <voidwalker> nothing better than vscodium for me. or neovim if you're one of those people |
16:33:38 | FromDiscord | <arkanoid> I suggest vscode/codium win saem extensionBut you have to configure it properly how it runs nimsuggest under the hood, or you would face excessive cpu usage.↵I suggest you to read about nimsuggest first↵(<@709044657232936960_otisolsen70=5b=49=52=43=5d>) |
16:34:58 | FromDiscord | <arkanoid> I know how to work with threads as-is, but I'd like an higher interface similar to what I get with pythons "joblib". Do you have any suggestion? |
16:35:21 | * | Phytolizer joined #nim |
16:50:40 | * | Phytolizer quit (Remote host closed the connection) |
16:51:00 | * | Phytolizer joined #nim |
16:52:05 | FromDiscord | <ShalokShalom> In reply to @ambient "ChatGPT is very good": Haha, thats actually quite accurate ^^ |
16:52:33 | FromDiscord | <ShalokShalom> In reply to @otisolsen70 "What is a good": The truth is, there is none. |
16:57:08 | FromDiscord | <ambient> vscode nimsaem is probably the best I've discovered so far |
16:57:54 | FromDiscord | <ShalokShalom> Yep |
16:58:06 | FromDiscord | <ShalokShalom> Its what most use, I think is fair to say |
16:58:29 | FromDiscord | <ShalokShalom> And when you compare that to other languages... 😦 |
16:59:10 | FromDiscord | <ambient> Rustanalyzer is really nice, but then again I don't have to deal with Hello World taking 5 gigabytes of disk space to build |
16:59:22 | FromDiscord | <ambient> (when using Nim) |
16:59:43 | FromDiscord | <ambient> I mean Rust builds are huge |
17:00:37 | FromDiscord | <ambient> I'm also guessing Typescript and C# support is really good in vscode |
17:00:54 | FromDiscord | <Phil> What I don't get is what about rust code makes them so large |
17:01:02 | FromDiscord | <Phil> But that's for offtopic |
17:02:26 | FromDiscord | <ambient> I haven't really found any showstoppers in my Nim workflow with nimsaem, then again I very rarely do any breakpoints of debugging |
17:02:45 | FromDiscord | <ambient> (edit) "of" => "or/" |
17:03:01 | FromDiscord | <ambient> (edit) "or/" => "or" |
17:03:25 | FromDiscord | <ambient> i didn't know s/foo/bar worked in discord 🧐 |
17:03:39 | FromDiscord | <ambient> (edit) "discord" => "Discord" |
17:08:45 | FromDiscord | <a weird programmer> In reply to @ambient "I'm also guessing Typescript": C# support is ass in vscode |
17:11:26 | FromDiscord | <ShalokShalom> In reply to @ambient "I haven't really found": Oh, its good as long as it works. |
17:11:45 | FromDiscord | <ShalokShalom> And nimsaem itself is not the problem |
17:12:13 | FromDiscord | <ambient> @ShalokShalom what kind of cases has it broken for you? |
17:12:16 | FromDiscord | <ShalokShalom> In reply to @ambient "i didn't know s/foo/bar": Did you know Ctrl + K |
17:12:25 | FromDiscord | <ShalokShalom> In reply to @ambient "<@208199869301522432> what kind of": It break occasionally |
17:12:45 | FromDiscord | <ShalokShalom> Nimsuggest, the underlying system |
17:12:59 | FromDiscord | <ShalokShalom> And almost all other alternatives use that too |
17:13:18 | FromDiscord | <ShalokShalom> (edit) "break" => "breaks" |
17:13:47 | FromDiscord | <ShalokShalom> Nim is luckily a language, that is cool with rather bare bones tooling |
17:13:56 | FromDiscord | <ShalokShalom> We dont need much 😄 |
17:29:46 | * | pro joined #nim |
17:36:36 | * | pro quit (Quit: pro) |
17:37:48 | FromDiscord | <Phil> Question in terms of language:↵What is understood under "tagged enums"?↵The concept we name Object variants? |
17:42:07 | FromDiscord | <Phil> It is, isn't it? Tagged enum, Tagged union, discriminated union all describe the same thing, no? |
17:42:20 | FromDiscord | <Phil> (edit) "It is, isn't it? Tagged enum, Tagged union, discriminated ... union" added "union, disjoint" |
17:48:53 | FromDiscord | <ShalokShalom> Yes |
17:49:02 | FromDiscord | <ShalokShalom> I guess the implementation might be different |
17:49:14 | FromDiscord | <ShalokShalom> But in actual usage, it seems virtually the same |
17:49:53 | FromDiscord | <ShalokShalom> https://en.wikipedia.org/wiki/Tagged_union |
17:50:33 | * | greaser|q joined #nim |
17:50:42 | * | krydos5 joined #nim |
17:51:54 | * | Amun-Ra_ joined #nim |
17:54:06 | * | syl_ joined #nim |
17:54:25 | * | xaltsc_ joined #nim |
17:54:47 | * | oprypin_ joined #nim |
17:55:28 | * | GreaseMonkey quit (Ping timeout: 252 seconds) |
17:55:28 | * | krydos quit (Ping timeout: 252 seconds) |
17:55:29 | * | Amun-Ra quit (Ping timeout: 252 seconds) |
17:55:30 | * | xaltsc quit (Ping timeout: 252 seconds) |
17:55:30 | * | oprypin quit (Ping timeout: 252 seconds) |
17:55:30 | * | euantorano quit (Ping timeout: 252 seconds) |
17:55:30 | * | syl quit (Ping timeout: 252 seconds) |
17:55:31 | * | krydos5 is now known as krydos |
17:55:33 | * | euantorano_ joined #nim |
17:59:54 | FromDiscord | <ShalokShalom> @Phil I guess you mean, because of this post? ↵https://forum.nim-lang.org/t/9659 |
18:01:13 | FromDiscord | <Phil> Pretty much |
18:02:06 | FromDiscord | <ShalokShalom> I like the abstraction, that patty gives 🙂 |
18:02:09 | FromDiscord | <Phil> I mean, they're right, defining object variants is pretty annoyingly painful.↵I notice that instinctually because the second I have to define one I banish it into its own module together with whatever helper proc I need for it, just so I never have to accidentally look at that syntax |
18:03:26 | FromDiscord | <ShalokShalom> https://github.com/andreaferretti/patty#constructing-variant-objects |
18:10:47 | * | PMunch joined #nim |
18:11:52 | * | syl_ is now known as syl |
19:10:32 | FromDiscord | <ShalokShalom> Zig switched from C++ to WASM for its own compilation ↵↵https://ziglang.org/news/goodbye-cpp/ |
19:27:43 | FromDiscord | <Phil> ... The more I read about compilers the more I get the feeling I need to be actually good at math for those debates |
19:28:49 | FromDiscord | <Phil> Not that I was ever terrible but I never really had classes on the actual fundamentals like the basic definition of what a set is, a bijection etc. |
19:28:56 | FromDiscord | <Phil> (edit) "Not that I was ever ... terrible" added "that" |
19:29:25 | FromDiscord | <Phil> (This stems from reading the newest posts on the nim style insensitivity, since it is nim related I'm like 40% sure it is not offtopic) |
19:33:19 | FromDiscord | <vindaar> I'm not sure Pietro's message there is super indicative of what's needed for compiler theory (but I say that as someone who's not a computer scientist and don't have lots of compiler knowledge either). In any case, learning maths gives you more tools and ways to think about problems. Learning about combinatorics, linear algebra, group theory, category theory etc. can be extremely useful for certain applications. |
19:34:50 | FromDiscord | <vindaar> in any case, many concepts in maths aren't particularly complicated. but language is often a real issue (similar to your earlier question up there about tagged unions, enums, variants etc), even just if you venture outside your area of expertise you might find people using different words for the same concept etc |
19:35:48 | * | Phytolizer quit (Remote host closed the connection) |
19:36:09 | * | Phytolizer joined #nim |
19:40:52 | * | adium quit (Ping timeout: 256 seconds) |
19:40:57 | * | ltriant joined #nim |
19:43:17 | * | adium joined #nim |
19:46:23 | * | ltriant quit (Ping timeout: 264 seconds) |
19:49:14 | * | pro joined #nim |
19:50:22 | * | arkurious joined #nim |
19:56:16 | FromDiscord | <ShalokShalom> @Phil I guess the serious math relation on the low level is responsibile for the common myth, that you need to be a math head to be a programmer |
19:56:56 | * | pro left #nim (#nim) |
19:56:56 | FromDiscord | <ShalokShalom> In reply to @vindaar "I'm not sure Pietro's": And yes. Compilers are ultimately pure function.↵↵One input maps to one output. |
19:57:05 | FromDiscord | <ShalokShalom> (edit) "function.↵↵One" => "functions.↵↵One" |
19:58:05 | FromDiscord | <ShalokShalom> So its just too obvious why functional concepts work splendid for compiler design |
19:59:33 | FromDiscord | <ShalokShalom> I imagine it's most pattern matching, though 🤔 |
19:59:40 | FromDiscord | <ShalokShalom> (edit) "most" => "mostly" |
20:04:20 | FromDiscord | <juan_carlos> If Zig using LLVM, then still using C++... |
20:05:55 | * | greaser|q quit (Changing host) |
20:05:55 | * | greaser|q joined #nim |
20:06:29 | * | greaser|q is now known as GreaseMonkey |
20:09:32 | FromDiscord | <ShalokShalom> True 😅 |
20:09:41 | FromDiscord | <ShalokShalom> But its still a difference |
20:09:59 | FromDiscord | <ShalokShalom> I mean eliminating such a significant chunk of code is quite something |
20:11:04 | FromDiscord | <Gumbercules> I thought Zig was self hosted |
20:11:27 | FromDiscord | <Gumbercules> I didn't read the blog post though... So I probably shouldn't comment |
20:11:36 | FromDiscord | <@thatrandomperson5-6310e3b26da03> What is the proper way to create typedef in a macro? |
20:13:23 | FromDiscord | <Michal Maršálek> Is it possible to use a proc that operates on `NimNode` at runtime? That is, can I override the implicit .compileTime pragma? |
20:13:57 | FromDiscord | <ShalokShalom> In reply to @Gumbercules "I thought Zig was": I thought that as well |
20:14:08 | PMunch | Uhm, NimNode is a compile-time representation of Nim code. What would it be doing during runtime? |
20:15:11 | FromDiscord | <Michal Maršálek> Represent a Nim code. 😄 |
20:15:32 | PMunch | But you wouldn't be able to use that Nim code for anything.. |
20:15:38 | PMunch | Since you're done compiling.. |
20:15:56 | FromDiscord | <Michal Maršálek> I wouldn't be able to run it but why should I not be able to inspect the AST? |
20:16:06 | PMunch | Fair.. |
20:16:19 | PMunch | Well you could import the compilers definition of a Nim node |
20:16:30 | PMunch | But why do you want to inspect a NimNode during runtime? |
20:17:21 | FromDiscord | <Michal Maršálek> I just wanted to use the `parseStmt` on todays aoc input instead of writing my own parser |
20:17:58 | FromDiscord | <Michal Maršálek> which works nicely, but I have to do it all at compile time |
20:20:04 | FromDiscord | <vindaar> in the end it shouldn't really matter that you do it all at compile time though (I may be missing something of course). The other alternative is importing the compiler API, which you can then use at runtime, but uhh, I'm pretty sure that's too much 😅 |
20:20:56 | FromDiscord | <Michal Maršálek> oh, I didn't realise there's two versions of Nim node |
20:25:40 | PMunch | What you typically do is convert the AST into statements which will be valid on runtime |
20:29:55 | PMunch | Hmm, is there a way to implement this in a better way: https://play.nim-lang.org/#ix=4ixp |
20:30:02 | PMunch | Specifically the two methods |
20:30:28 | PMunch | Could I somehow write a proc/method which took just Base and return the same result? |
20:32:18 | FromDiscord | <Michal Maršálek> In reply to @PMunch "What you typically do": Are you talking about the usual way one uses the AST? Or are you giving me hints on how I can achieve what I wanted to? |
20:32:28 | PMunch | The latter |
20:33:25 | FromDiscord | <Michal Maršálek> hmm |
20:33:35 | FromDiscord | <Michal Maršálek> I'm afraid I don't understand what you mean |
20:36:07 | * | pro joined #nim |
20:36:16 | * | pro left #nim (#nim) |
20:36:51 | PMunch | @Michal_Maršálek, hmm |
20:38:01 | PMunch | Basically you can take your AST, extract all the interesting bits, and then create a call to a procedure with those bits as arguments |
20:38:38 | FromDiscord | <Michal Maršálek> In reply to @PMunch "Basically you can take": Yes, but that's what I'm doing |
20:39:21 | FromDiscord | <Michal Maršálek> But Nim automatically puts the pragma there |
20:39:50 | * | kenran joined #nim |
20:40:53 | PMunch | Well that's because you're passing NimNodes, and not the interesting bits |
20:41:03 | * | kenran quit (Remote host closed the connection) |
20:41:29 | FromDiscord | <Michal Maršálek> That's the issue |
20:41:50 | FromDiscord | <Michal Maršálek> How do I get at those interesting bits at runtime |
20:42:15 | PMunch | You don't, you get them at compile-time, and pass them over to the runtime |
20:44:45 | FromDiscord | <Michal Maršálek> I understand what you mean now. 🙂 Yeah, I knew how to do that from the beggining, my question was about being able to do it at runtime. |
20:46:14 | * | jmdaemon joined #nim |
20:46:20 | FromDiscord | <Michal Maršálek> Is there a `string -> PNode` function? |
20:46:44 | PMunch | Not if you don't import the compiler |
20:47:10 | FromDiscord | <Michal Maršálek> I mean in compiler/ast |
20:48:24 | FromDiscord | <Yepoleb> i want to wrap `ifreq`, which is a kernel struct with a giant union https://manpages.debian.org/bullseye/manpages/netdevice.7.en.html↵would the best way to approach this be to make a separate type for all possible unions? |
20:48:32 | FromDiscord | <Yepoleb> (or just the ones i need) |
20:48:55 | PMunch | You could also make a Nim union of it |
20:49:07 | PMunch | Or just use Futhark *shrugs* |
20:49:43 | PMunch | (Futhark would create a Nim union out of it) |
20:52:13 | * | Phytolizer quit (Ping timeout: 260 seconds) |
20:53:41 | FromDiscord | <Yepoleb> i thought nim only had variants, thanks for the advice |
20:54:30 | PMunch | Well the {.union.} pragma is pretty much only to interact with C unions |
20:55:05 | FromDiscord | <Yepoleb> and futhark is too much to learn if i just need a single struct |
20:56:22 | PMunch | It's not that hard to learn, and well worth it if you ever plan to wrap C code ever again |
21:07:23 | * | PMunch quit (Quit: leaving) |
21:11:27 | FromDiscord | <.tochka> In reply to @juan_carlos "If Zig using LLVM,": they're in process now of providing different generators |
21:19:53 | otisolsen70 | FromDiscord, ok. |
21:22:00 | * | otisolsen70 quit (Quit: Leaving) |
21:24:31 | FromDiscord | <Yepoleb> is there a fancy way to convert a string to `array[16, char]` other than a per character for loop? |
21:36:29 | FromDiscord | <guzba> if you want a fancy way, you could turn that into array[17, char] ensure [16] is 0, then do $arr[0].cstring but i think youll get 👀 |
21:36:44 | FromDiscord | <guzba> haha |
21:38:02 | FromDiscord | <guzba> (edit) "$arr[0].cstring" => "$cast[cstring](arr[0].addr)" |
21:47:30 | FromDiscord | <Yepoleb> i think that does the conversion the other way |
21:47:43 | FromDiscord | <Yepoleb> i want to write to the array |
21:51:27 | arkanoid | nimsuggest --v3 is eating 8GB ram, damn, this tool should be renamed nimGoogleSuggestChrome |
21:51:54 | * | ltriant joined #nim |
22:02:59 | FromDiscord | <Elegantbeef> @Gumbercules @ShalokShalom it's self hosted but it still targets the llvm |
22:05:19 | FromDiscord | <Gumbercules> In reply to @Elegantbeef "<@204328759715692544> <@208199869301522432> it's se": Gotcha |
22:06:32 | FromDiscord | <Elegantbeef> Eventually andrew does want to add more backends that are not llvm based |
22:06:40 | FromDiscord | <Elegantbeef> So C target and so forth |
22:07:01 | FromDiscord | <Yepoleb> PMunch\: this quickly escalated, i'm trying futhark now 😄 |
22:14:40 | FromDiscord | <Recruit_main707> cant help but think about the programming language whenever i see futhark :P |
22:20:55 | arkanoid | futhark == killer feature for nim |
22:23:51 | FromDiscord | <Elegantbeef> I know it's against pmunch's intent, but it'd be a lot cooler if it generated a human readable output |
22:25:48 | * | py_ joined #nim |
22:28:24 | NimEventer | New thread by exelotl: Fine control over the ordering of linker args?, see https://forum.nim-lang.org/t/9722 |
22:33:16 | FromDiscord | <Yepoleb> damn, this is magic |
22:34:20 | FromDiscord | <Yepoleb> but it can't deal with the macro insanity inside kernel headers |
22:40:02 | moonlit | hi there, I have a rendering problem, and I'm making a directedPoint tuple: a point (x,y,z) and a direction (x,y,z) as tuples. Can I initialize the tuple with all its members at once? I've tried var cam: directedPoint = ( d: direction = ( x: 1, y: .... ), p: point = ( ... ) ) but it gives me a compilation error, is that not allowed? |
22:42:08 | Amun-Ra_ | should work without direction = and point = |
22:43:28 | moonlit | Nice!!! Thanks man! :D |
22:43:41 | Amun-Ra_ | :> |
22:46:29 | FromDiscord | <Michal Maršálek> Often when I write `mySeq.map(someFunc)` I get an error and I have to write `mySeq.map(x => someFunc x)` or `mySeq.mapIt(someFunc it)` instead. How hard would it be to make that conversion automatic? |
22:46:36 | * | py_ quit (Ping timeout: 252 seconds) |
22:48:26 | FromDiscord | <Yepoleb> what's the benefit of specifying importc with types? |
22:56:51 | * | py_ joined #nim |
22:58:57 | * | py_ quit (Client Quit) |
23:13:44 | FromDiscord | <Elegantbeef> Depends on the error↵(@Michal Maršálek) |
23:14:01 | FromDiscord | <Elegantbeef> Allows you to provide Nim friendly names |
23:14:08 | FromDiscord | <Elegantbeef> And also the header they come from |
23:21:38 | FromDiscord | <Yepoleb> I am already defining the object and it works without importc, but not with, because now the names don't match |
23:22:57 | FromDiscord | <Elegantbeef> Code? |
23:23:48 | FromDiscord | <Yepoleb> i am not trying to fix it, i saw it works perfectly fine without importc, i am just wondering what the purpose of importc with objects is |
23:25:06 | FromDiscord | <Elegantbeef> It tells the compiler not to mangle the name for one |
23:25:15 | FromDiscord | <Yepoleb> the sdl2 module for example also doesn't use importc, but the posix module does and that's where i got the idea |
23:25:17 | FromDiscord | <Elegantbeef> But you can also do `importc: "myCName"` |
23:25:47 | * | Jjp137 quit (Quit: Leaving) |
23:26:32 | FromDiscord | <Yepoleb> so it seems to do the same as {.nodecl.} for structs |
23:26:57 | FromDiscord | <Elegantbeef> Without a new name yes it would |
23:28:05 | FromDiscord | <Yepoleb> i understand, thanks 😊 |
23:35:43 | FromDiscord | <<She>Horizon</Her>> In reply to @Yepoleb "i am not trying": I thought it was exportc and cdecl? |
23:36:09 | FromDiscord | <<She>Horizon</Her>> And importc specifically for importing code from the host/target language |
23:58:22 | FromDiscord | <a weird programmer> is there a way to enforce types? |
23:58:28 | FromDiscord | <a weird programmer> for example |
23:59:03 | FromDiscord | <a weird programmer> sent a code paste, see https://play.nim-lang.org/#ix=4ixX |
23:59:14 | FromDiscord | <Elegantbeef> No there is no way to force type annotations |