00:00:16 | FromDiscord | <Elegantbeef> Did i already say that, yes |
00:01:05 | FromDiscord | <Patitotective> Is there any text editor developed in _Nim_? |
00:01:29 | FromDiscord | <Elegantbeef> There was https://github.com/nim-lang/Aporia |
00:02:18 | FromDiscord | <Elegantbeef> The Vscode extension by saem was ported to Nim so that means it's sorta 😛 |
00:04:02 | FromDiscord | <Patitotective> I just wanted to get an idea ~~fork~~ for a text editor, I'm thinking on making one to try some GUI libraries |
00:04:12 | FromDiscord | <Patitotective> (edit) "try some GUI libraries" => "practice" |
00:06:21 | * | jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in) |
00:06:47 | FromDiscord | <Elegantbeef> This is completely valid code https://play.nim-lang.org/#ix=3NJg if anyone is curious |
00:07:26 | FromDiscord | <Elegantbeef> Since the import of `test1` is delayed it doesnt cause a recursive import which allows splitting modules |
00:08:10 | * | jmdaemon joined #nim |
00:08:12 | FromDiscord | <Patitotective> Isn't `include` better for those cases? Or do I don't understand `include` yet? lol |
00:08:19 | FromDiscord | <Patitotective> (edit) removed "do" |
00:10:40 | FromDiscord | <Elegantbeef> Not really "Better" |
00:11:03 | FromDiscord | <Elegantbeef> Import is superior imo due to the fact it's an actual module, exporting matters |
00:12:27 | FromDiscord | <willyboar> In reply to @Patitotective "Is there any text": This also: https://github.com/fox0430/moe |
00:16:52 | FromDiscord | <chronomatopoeia> Hi, I've been working on text adventures with a programmer who made an engine in Nim. When I worked on the first version, I had Windows 10. After I downloaded Windows 11, the game screen comes up black. Where should I look to fix this problem? I tried the game again on a friend's computer who has Windows 10, and it worked fine.↵https://github.com/chronomatopoeia/rue-d-auseil↵It is a prototype from a jam, not a final product. |
00:18:04 | FromDiscord | <Elegantbeef> I've had similar issues with Nico, generally caused by the palette |
00:18:23 | FromDiscord | <chronomatopoeia> Sorry, what is the palette? |
00:18:37 | FromDiscord | <chronomatopoeia> I'm a beginner |
00:20:47 | FromDiscord | <chronomatopoeia> For colors? |
00:21:19 | FromDiscord | <Elegantbeef> Doubt it, but it was a thing that happened prior |
00:21:30 | FromDiscord | <Elegantbeef> The game would work fine but some palettes would cause it to be 100% black, though looking at the repo there are no custom palettes |
00:21:45 | FromDiscord | <chronomatopoeia> Ah, that makes sense |
00:22:36 | FromDiscord | <chronomatopoeia> We had to choose some colors, perhaps that was custom after all |
00:22:57 | FromDiscord | <chronomatopoeia> for the action words |
00:23:41 | FromDiscord | <chronomatopoeia> That's a helpful place to start looking, thank you very much |
00:23:59 | FromDiscord | <Elegantbeef> Also the nico author did respond in gamedev 😀 |
00:24:23 | FromDiscord | <chronomatopoeia> Ooops, I missed that, thanks! |
00:37:25 | FromDiscord | <Patitotective> In reply to @willyboar "This also: https://github.com/fox0430/moe": 👍 |
00:44:56 | * | vicfred quit (Quit: Leaving) |
00:59:42 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
01:11:14 | FromDiscord | <sigkill> Anyone have a nice vim syntax highlighter for nim |
01:11:20 | FromDiscord | <sigkill> Can't find anything on GitHub |
01:17:52 | * | rlp10 quit (Ping timeout: 268 seconds) |
01:17:55 | FromDiscord | <Elegantbeef> There is one for nvim |
01:19:16 | * | rlp10 joined #nim |
01:19:42 | * | krux02 quit (Remote host closed the connection) |
01:20:12 | * | rienske quit (Ping timeout: 256 seconds) |
01:24:36 | * | rlp10 quit (Ping timeout: 250 seconds) |
01:26:25 | * | rlp10 joined #nim |
01:26:26 | * | jmdaemon quit (Ping timeout: 256 seconds) |
01:29:54 | * | rienske joined #nim |
01:36:01 | FromDiscord | <sigkill> In reply to @Elegantbeef "There is one for": Link me? I can't find anything |
01:37:55 | FromDiscord | <Elegantbeef> https://github.com/alaviss/nim.nvim |
01:42:13 | * | marshall joined #nim |
01:44:28 | FromDiscord | <sigkill> I already have the LSP setup :// just wanted syntax highlighting ;-; |
01:44:38 | FromDiscord | <sigkill> Thanks for the suggestion though |
01:44:56 | FromDiscord | <Elegantbeef> > Semantic highlighting with nimsuggest |
01:47:06 | FromDiscord | <sigkill> I'm worried about this overriding my LSP mappings or running another instance if nimsuggest |
01:47:19 | FromDiscord | <sigkill> But I'll look over the syntax file and use it as a starting point |
01:48:48 | FromDiscord | <Rika> It is semantic highlighting. It depends on nimsuggest |
01:54:59 | FromDiscord | <sigkill> so it will use the same instance of nimsuggest as nvim-cmp? |
01:59:21 | FromDiscord | <sigkill> (i'm assuming lsp stuff requires nimsuggest running continually in the bg) |
02:01:35 | FromDiscord | <Rika> no it will no |
02:01:37 | FromDiscord | <Rika> (edit) "no" => "not" |
02:02:17 | FromDiscord | <leorize> @sigkill\: https://github.com/alaviss/nim.nvim/issues/49 \<- check this out |
02:02:52 | FromDiscord | <leorize> I haven't tested it myself but this user created a null-ls configuration to bridge nim.nvim's integration into nvim's lsp functionality |
02:03:11 | FromDiscord | <leorize> it doesn't support everything (which I intend to improve on later), but it seems to work |
02:03:30 | FromDiscord | <sigkill> In reply to @Rika "no it will not": im not sure which you mean |
02:04:12 | FromDiscord | <leorize> and no, nim.nvim will not share the nimsuggest instance with nimlsp |
02:04:14 | FromDiscord | <Rika> leorize is the creator (alaviss) so listen to him first |
02:11:28 | arkanoid | is there a wiki/blog/manual about software design patterns available/suggested for nim? |
02:11:41 | arkanoid | I'm looking for possible solutions to decouple code |
02:12:12 | FromDiscord | <Rika> In reply to @arkanoid "is there a wiki/blog/manual": hmm thats tricky ngl |
02:12:26 | arkanoid | ngl? |
02:12:44 | FromDiscord | <sigkill> In reply to @leorize "<@629315306560684032>\: https://github.com/alaviss/": this is interesting - will let you know how i find it |
02:12:49 | FromDiscord | <sigkill> In reply to @arkanoid "ngl?": not gonna lie |
02:13:01 | arkanoid | k |
02:13:48 | FromDiscord | <Rika> okay usually all types go in some single file and logic can go in any num of files |
02:13:58 | * | noeontheend joined #nim |
02:14:05 | FromDiscord | <Rika> or types that are dependent on each other go in some file |
02:15:06 | arkanoid | yes, I'm already doing that. All types in a single type block is something I've already realized by myself |
02:15:28 | arkanoid | what I'm trying to decouple is the dependency between two modules |
02:16:11 | FromDiscord | <Rika> hm wdym? doesnt forward declaration help with that? |
02:17:14 | arkanoid | can't use forward declaration in my context, because I need to use finalizers (aka. new(result, myDestroyProc)) |
02:17:51 | arkanoid | and also there's this little rule: "Error: type bound operation `myDestroyProc` can be defined only in the same module with its type" |
02:17:56 | FromDiscord | <Rika> never knew there was that context |
02:18:15 | FromDiscord | <Rika> do destructors not work for you? |
02:18:43 | arkanoid | so type + newType + destroyType needs to stay in same module |
02:20:17 | * | neurocyte0917090 quit (Ping timeout: 240 seconds) |
02:23:10 | arkanoid | Rika, need to keep lib backward compatible for existing users, and it has been designed for refc + finalizers before =destroy and orc/arc |
02:25:05 | arkanoid | so I'm trying to make it arc/orc compatible, but using finalizers instead of =destroy, and what finalizers do is basically declaring =destroy implicitly, there's no much difference |
02:29:07 | arkanoid | problem is how to decouple code when using finalizers. if "proc finalize(foo: Foo)" + "proc newFoo(): Foo = new(result, finalize)" have to stay in same module as "type Foo", it means that every inizialization code and delete for all types are in same module, so you program ends in a single large module |
02:29:50 | FromDiscord | <Elegantbeef> I dont know if that's true |
02:30:13 | * | marshall quit (Remote host closed the connection) |
02:30:27 | arkanoid | Elegantbeef, what doesn't sound true to you? |
02:30:49 | FromDiscord | <Elegantbeef> The single large module |
02:30:58 | * | marshall joined #nim |
02:31:00 | FromDiscord | <Rika> your program is all just init + delete? |
02:31:11 | FromDiscord | <Rika> isnt the logic much larger than init + delete... |
02:32:39 | * | marshall quit (Remote host closed the connection) |
02:32:55 | arkanoid | but you can't decouple. For example, this constructor: https://play.nim-lang.org/#ix=3NJJ |
02:33:15 | * | marshall joined #nim |
02:33:49 | FromDiscord | <Elegantbeef> You constructor and type has to be declared in the same file since you're using finalizers yes, but that doesnt mean all your code needs to share a single file |
02:34:04 | FromDiscord | <Elegantbeef> I showed examples of how to do recursive imports without erroring |
02:35:17 | arkanoid | 1) you have to write this constructor as near as possible to type definition, as you want nim to generate =destroy asap, and that happens on "new(result, delete)", 2) then you have to declare "proc delete" in same module of type definition, 3) as a result, and logic inside constructor or destructor is closely couple with all types |
02:35:19 | * | marshall quit (Remote host closed the connection) |
02:36:14 | * | marshall joined #nim |
02:36:22 | FromDiscord | <Elegantbeef> Again the entirety of your program isnt intializers and destructors |
02:37:21 | FromDiscord | <Elegantbeef> Do you have a minimal example I can chew on? |
02:38:47 | arkanoid | Elegantbeef: not minimal, but this "include all" design is driven by this limitation: https://github.com/filcuc/nimqml/blob/master/src/nimqml.nim |
02:39:18 | arkanoid | here the constructors block, that gets included near the types: https://github.com/filcuc/nimqml/blob/master/src/nimqml/private/constructors.nim |
02:39:25 | FromDiscord | <Elegantbeef> Well i guess i'll take the time to remove the code smell be back in 3 hours |
02:40:10 | arkanoid | no, I've already spent hours on this, it's not required, I can expose the critial points and you may have an idea |
02:41:02 | * | marshall quit (Remote host closed the connection) |
02:41:08 | arkanoid | I've already tried to remove the code smell by replacing all include with import, and drawing a module interdependency tree using graphviz and trying to decouple the cross dependencies |
02:41:39 | * | marshall joined #nim |
02:42:43 | arkanoid | point is that you can't use forward declarations on finalizers |
02:43:41 | arkanoid | because that works with refc, but silently fails with arc/orc: https://github.com/nim-lang/Nim/issues/19402 |
02:43:43 | FromDiscord | <Elegantbeef> Sure but are they actually needed is my query |
02:44:47 | * | marshall quit (Remote host closed the connection) |
02:45:05 | FromDiscord | <Elegantbeef> This is such a large module it's going to be hard to investigate how to clean it up quickly |
02:45:08 | arkanoid | you mean finalizers? yes they are, as constructors calls C code, and finalizers also calls C code |
02:45:14 | FromDiscord | <Elegantbeef> No |
02:45:47 | arkanoid | ? |
02:45:47 | FromDiscord | <Elegantbeef> Are forward declarations needed |
02:46:04 | FromDiscord | <Elegantbeef> This is such a large module it's hard to easily grok how to supplant it into imports |
02:47:46 | arkanoid | I've already tried. If you try to keep all your constructors away from the type file, you end up fighting with the compiler that declares "=destroy" before your "new(result, myfinalizer)" |
02:48:56 | arkanoid | if you try to push constructors and finalizers in same module as types, you end up fighting with constructor code (result.setup()) that drags in cross dependencies and basically the types.nim imports your whole program |
02:49:27 | FromDiscord | <Elegantbeef> Sure i'm not trying a single file |
02:49:39 | FromDiscord | <Elegantbeef> I'm attempting to split each type into a module |
02:50:35 | * | jmdaemon joined #nim |
02:53:12 | arkanoid | I think you'll face cross dependencies between some of them, and yes that's the last path I've been trying, but not yet finished |
03:01:34 | arkanoid | before last commit, the original code used constructors and destructors in relative files (using include instead of import makes them still modules?!) https://github.com/filcuc/nimqml/commit/aaab5dbae4ae5c22d7aab67635f24c54a7f369f6#diff-25a6634263c1b1f6fc4697a04e2b9904ea4b042a89af59dc93ec1f5d44848a26 |
03:02:01 | arkanoid | but yet single types files, and include everything instead of import |
03:04:54 | FromDiscord | <ITR> Is there any recent comparison of Nim and V? The one on V's page looks like it's compared against an older version of Nim, so it'd be interesting to see how it does in its current state: https://vlang.io/compare https://vlang.io/compilation_speed |
03:20:35 | * | l1x quit (Quit: Connection closed for inactivity) |
03:22:58 | FromDiscord | <noow> sent a code paste, see https://play.nim-lang.org/#ix=3NJS |
03:23:07 | FromDiscord | <noow> will Nim call destroy if one of MyType leaves the scope |
03:23:12 | FromDiscord | <noow> or other conditions where it would be GC'd |
03:23:29 | FromDiscord | <Elegantbeef> Depends on the memory management you usue |
03:23:31 | FromDiscord | <noow> arc |
03:23:42 | FromDiscord | <Elegantbeef> Well it should call the destructor on exit scope |
03:24:00 | FromDiscord | <noow> arc should be deterministic, right? |
03:24:20 | FromDiscord | <noow> two runs of the same software will collect garbage at the same moments with no randomness right |
03:25:14 | FromDiscord | <noow> also, do I have to specify `var` in the destructor? |
03:25:30 | FromDiscord | <noow> since destroying an object sounds like it is mutating the object, so my intuition says yes |
03:26:01 | FromDiscord | <noow> sorry if my questions are noob-y, but I just can't find good documents on how to mix ptr with GC'd code |
03:31:51 | FromDiscord | <Elegantbeef> Ah accidently imported one module to early, all going fine! |
03:33:58 | * | arkurious quit (Quit: Leaving) |
03:58:49 | FromDiscord | <Elegantbeef> arkanoid https://github.com/beef331/nimqml/commit/000cf189bb6317fa0ed8343675bc7d137fbb6c49 i started on the refactor but i'm too bored to continue there's only a few more files |
03:58:56 | FromDiscord | <Elegantbeef> any file that doesnt end with `s` isnt implemented |
03:59:48 | FromDiscord | <Elegantbeef> All types refactored are defined in their own file and only use imports |
04:01:58 | FromDiscord | <Elegantbeef> Hmm on second thought seems there are some issues with things aside from `Qobject` |
04:17:45 | arkanoid | Elegantbeef, you're on my same path (but way faster than me). I'll use your work and compare with mine. I'm tracking the imports while I refactor, you should have found something like https://play.nim-lang.org/#ix=3NK0 |
04:18:31 | FromDiscord | <Elegantbeef> Yea i was trying to show how to do it but forgot after the first few files so just went through many of them 😀 |
04:21:55 | arkanoid | yes, I know the feeling, I had to iterate a couple if times to identify the root of the tree and start from there |
04:37:20 | arkanoid | Elegantbeef, would you explain me this trick? https://github.com/beef331/nimqml/blob/000cf189bb6317fa0ed8343675bc7d137fbb6c49/src/nimqml/private/qvariants.nim#L16 |
04:37:54 | FromDiscord | <Elegantbeef> Delayed imports 'can' let you get around recursive trees |
04:38:27 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3NJg enables this for instance |
04:40:18 | FromDiscord | <Elegantbeef> There is still a cyclical dependancy issue with `qmetaobjects` so may have to merge `qobjects` with `qmetaobjects` |
04:42:53 | arkanoid | damn, you know them all, you reached the same conclusion I made in 3 hours in 45 mins |
04:43:16 | arkanoid | and also I didn't know about delayed imports |
04:43:47 | FromDiscord | <Elegantbeef> Yea they're how you can get around recursive import problems until nim 2.0 😀 |
04:44:00 | FromDiscord | <Elegantbeef> Nim2.0 will have a proper solution iirc |
04:46:25 | FromDiscord | <Elegantbeef> Some stuff will have to be grouped but I think you can see how you can separate the code into smaller more maintainable files |
04:46:42 | arkanoid | and here is where I've been ranting today |
04:47:16 | arkanoid | yes, the delayed imports is the missing item to keep the wheel spinning |
04:47:22 | arkanoid | I was basically helpless |
04:47:45 | FromDiscord | <Elegantbeef> Ah so you can see how large projects can be written in Nim? 😛 |
04:47:51 | FromDiscord | <Rika> It was difficult to understand the situation without the code and most of us were unwilling to look |
04:47:52 | arkanoid | yet I've still to grok it, as I'm trying to use it right now as you but it's not clicking |
04:48:06 | FromDiscord | <Elegantbeef> Also i did give the delayed example earlier |
04:48:27 | FromDiscord | <Elegantbeef> I assume you didnt see it then 😀 |
04:49:32 | FromDiscord | <Elegantbeef> You basically want to import module 1 from module 2 at a point in module 2 where it's needed and import module 2 into module 1 just before it's needed |
04:50:00 | FromDiscord | <Elegantbeef> This reduces the chance of a recursive import as the import can get the information needed before it goes "Well we're now going to be recursive" |
04:50:36 | FromDiscord | <Rika> I believe this is basically how it works |
04:50:37 | FromDiscord | <Elegantbeef> If you think about it, a module can import another module until it's at the end or it hits an import of itself |
04:50:43 | FromDiscord | <Rika> https://media.discordapp.net/attachments/371759389889003532/936483404214595645/IMG_0375.png |
04:51:00 | FromDiscord | <Elegantbeef> You're terminating imports when you do `import importingModule` |
04:51:25 | FromDiscord | <Elegantbeef> So in the small example `test1` gets all exported code up to `import test1` |
04:53:23 | arkanoid | Elegantbeef, yeah I see you put import objects at the bottom of qmetaobjects |
04:53:48 | FromDiscord | <Rika> If you like images I don’t know https://media.discordapp.net/attachments/371759389889003532/936484181855334420/IMG_0376.png |
04:54:04 | FromDiscord | <Elegantbeef> It still causes an issue though which is why i think they need to merge |
04:54:09 | arkanoid | but did it compile to you? it seems that's the show stopper, right? |
04:54:11 | FromDiscord | <Rika> Oh I missed another part |
04:54:24 | FromDiscord | <Elegantbeef> `qobjects` compiles but `qmetaobjects` does not |
04:55:06 | arkanoid | Rika, I really appreciate it. I've printed the BW version to don't forget tomorrow where I've lost the day before |
04:55:06 | FromDiscord | <Elegantbeef> the latter has an issue with the imports so doesnt compile, which is why i think those two at least need merged |
04:55:28 | FromDiscord | <Rika> sorry the second image is wrong, i will fix it in a moment |
04:55:35 | FromDiscord | <Elegantbeef> But like `qabstractitemmodels` works |
04:55:48 | arkanoid | Rika, don't worry, I got it |
04:56:04 | FromDiscord | <Rika> oh wait no i think its correct |
04:56:10 | FromDiscord | <Rika> im dum |
04:56:12 | FromDiscord | <Rika> hehe |
04:57:36 | arkanoid | so, as general rule to workaround *put your import just before the dependent code, and the dependent code as late as possible in the module*, yet not always works |
04:58:05 | FromDiscord | <Elegantbeef> It does not always work but can get you quite far |
04:58:09 | FromDiscord | <Rika> now that i think about it this is messy xd |
04:58:12 | FromDiscord | <Rika> nim 2 when |
04:58:35 | arkanoid | thanks for your patience |
04:58:41 | FromDiscord | <Tetralux> 😄 |
04:59:23 | * | kayabaNerve joined #nim |
05:00:34 | FromDiscord | <Elegantbeef> Yea look at my present commit |
05:00:35 | FromDiscord | <Elegantbeef> It should work |
05:01:17 | * | noeontheend quit (Ping timeout: 240 seconds) |
05:03:35 | arkanoid | Elegantbeef, is the late declaration of qmetaobject types inside the new qobject file intended , or was just quick copypaste? |
05:04:09 | FromDiscord | <Elegantbeef> It was intended but compiling `qmetaobject` directly caused issues |
05:04:17 | FromDiscord | <Elegantbeef> So i moved them into a single module now |
05:04:37 | FromDiscord | <Elegantbeef> https://github.com/beef331/nimqml/commit/51cbb41579bc99ce3a8c5cec6a0ddd3b0a40cb43 most recent commit |
05:05:00 | FromDiscord | <Elegantbeef> Being somewhat lazy since i'm not authoring anything |
05:08:35 | arkanoid | k |
05:22:03 | arkanoid | Still not clicking. I'm getting "Error: undeclared identifier: 'QObject'" in my file, that is kinda 1:1 yours here: https://github.com/beef331/nimqml/blob/51cbb41579bc99ce3a8c5cec6a0ddd3b0a40cb43/src/nimqml/private/qvariants.nim#L17 |
05:22:35 | FromDiscord | <Elegantbeef> Did you forget to put the export marker? |
05:22:53 | FromDiscord | <Elegantbeef> You can always clone my repo and continue where i left off |
05:23:30 | arkanoid | sure, but I want to learn, and I'm already using your files to understand. The header of qobject.nim is very similar, and the export mark is there |
05:24:09 | * | jmdaemon quit (Read error: Connection reset by peer) |
05:24:20 | * | jmd_ joined #nim |
05:27:08 | FromDiscord | <Elegantbeef> Hmm guess i have more import issues |
05:27:20 | FromDiscord | <Elegantbeef> So perhaps this is going to end with many files in a single file |
05:29:21 | FromDiscord | <Elegantbeef> Gotta try compiling every file now |
05:30:45 | arkanoid | that's my approach, I start from a leaf of the dependency tree and try compiling, once it succeeds, I go to next module until root |
05:30:57 | arkanoid | hell happens in me head when two modules requires each other |
05:31:16 | arkanoid | I understand your example, is this complex context that is returning errors nowhere helpful |
05:31:18 | FromDiscord | <Elegantbeef> Yea my solution for qvariants was to move stuff to the bottom |
05:32:49 | FromDiscord | <Elegantbeef> My workflow was to make all the modules i need for a specific file, hit an error then rearrange |
05:38:08 | FromDiscord | <Elegantbeef> oh hell ya all my wrapped files are capable of being compiled independantly |
05:38:55 | FromDiscord | <Elegantbeef> You really need to have a good grasp of the import system |
05:39:13 | FromDiscord | <Elegantbeef> Cause the same rule applies to nested imports |
05:39:33 | FromDiscord | <Elegantbeef> If you import a file which imports a file which imports your file it stops importing in other files when it hits a cycle |
05:40:19 | FromDiscord | <Elegantbeef> https://github.com/beef331/nimqml/commit/7647f7640bf6102dc307cf96946cac97f373d412#diff-c6c2128ca66fecdd36b62ceb7df04b22f743c4afec5a041456b6b28756d8aa99R169-R183 which is why i do this |
05:41:03 | FromDiscord | <Elegantbeef> I dont think this is needed since these files are never going to be main |
05:42:30 | arkanoid | yeah, I feel I lack the required knowledge about the details of the import system in this context and I'm fighting against it. I got successfull compilation of one module, and it breaks another one, and I'm going back and forth until I got both successfully, but then here it comes a third one. I need better rules to reduce the amount of loops required to get convergence |
05:43:59 | FromDiscord | <Elegantbeef> Given that these dont need to work as main modules i'm fairly certain you just need to make sure you can import them independantly or as a group |
05:44:47 | FromDiscord | <Elegantbeef> But hey after this adventure you'll be an import god |
05:45:35 | arkanoid | well, I DESERVE THIS KNOWLEDGE |
05:45:38 | arkanoid | sorry |
05:46:07 | arkanoid | but I've been over this way too long, and I want to reduce the problem |
05:47:16 | FromDiscord | <Elegantbeef> lol |
05:47:36 | arkanoid | so, you said that if X imports Y and Y imports X, then when compiler compiles X, it parses Y until "import X" is met, and vice-versa when compiler compiles Y, it parses X until "import Y" is met. Correct? |
05:47:56 | FromDiscord | <Elegantbeef> Yes |
05:48:10 | FromDiscord | <Elegantbeef> Actually i might be wrong |
05:48:26 | FromDiscord | <Elegantbeef> The small example shows that's wrong |
05:48:33 | arkanoid | ok, so it's a system of levers, tubes and pressure and valves that requires an equilibrium |
05:49:09 | arkanoid | oh dear, the only rule I got out of this is already crumbling down |
05:49:32 | FromDiscord | <Elegantbeef> Ok so let's look at the small example |
05:49:59 | arkanoid | you mean test.nim and test1.nim? |
05:50:21 | FromDiscord | <Elegantbeef> We're `test1` we're going through we pickup `MyType` we then import `test` it imports all the symbols we have up to this point so it get's `MyType` |
05:50:42 | FromDiscord | <Elegantbeef> We now import all symbols exported inside `test1` so we pickup `doThing` |
05:51:02 | FromDiscord | <Elegantbeef> i mean "We're `test`" |
05:51:51 | FromDiscord | <Elegantbeef> So when you import a module you get all exported symbols between the start and first cycle |
05:52:04 | FromDiscord | <Elegantbeef> In our small example that cycle is easy to see since it's two files |
05:52:31 | FromDiscord | <BhamidipatiNikhil> Can anyone please say why this program of mine is running infinite times? https://media.discordapp.net/attachments/371759389889003532/936498954969956392/unknown.png |
05:52:49 | FromDiscord | <Elegantbeef> Which is why import at the top doesnt work since it creates a cycle without any new symbols |
05:52:55 | FromDiscord | <Rika> your procs are never exiting |
05:53:05 | FromDiscord | <Elegantbeef> You have recursive procedures calls |
05:53:12 | FromDiscord | <Rika> outside -> tick -> tock(inside tick) -> tick(inside tock) |
05:53:12 | FromDiscord | <Elegantbeef> if you build with debug it should hit the stack limit |
05:53:14 | FromDiscord | <Rika> etc |
05:53:26 | FromDiscord | <Rika> you never finish the first tick printer call thats global |
05:53:52 | FromDiscord | <BhamidipatiNikhil> In reply to @Rika "etc": Oh yes, you are right! Thanks Rika |
05:54:04 | FromDiscord | <BhamidipatiNikhil> 🙂 |
05:54:06 | FromDiscord | <Elegantbeef> Thought the bots were going to have to explain how while worked 😀 |
05:54:34 | arkanoid | so the general rule is still valid? I need to get to sleep with at least 1 hope for a bright future, made of imports and modules that compiles one by one |
05:54:41 | FromDiscord | <Elegantbeef> Yea |
05:55:02 | FromDiscord | <Elegantbeef> Might be best to play with a bunch of small modules and make them depend on eachother to grok that |
05:55:41 | arkanoid | I think so, need to create a 4 module puzzle, at least |
05:57:33 | * | tiorock joined #nim |
05:57:33 | * | tiorock quit (Changing host) |
05:57:33 | * | tiorock joined #nim |
05:57:33 | * | rockcavera quit (Killed (lithium.libera.chat (Nickname regained by services))) |
05:57:33 | * | tiorock is now known as rockcavera |
05:58:19 | arkanoid | actually, I think the compiler knows exactly which symbols come from each module, basically I need to put a color on each symbol depending on the module it belongs to, and assure that no same colors appears above a certain line |
05:58:41 | arkanoid | I mean, I'm trying to visualize it |
06:01:17 | arkanoid | and when nim 2.0 will be a thing, I will be the one that says to newcomers "when I was your age, we had to do late imports. Now you all lazy kids please help me fix this for loop" |
06:01:36 | FromDiscord | <Elegantbeef> lol |
06:01:38 | * | haakon_ joined #nim |
06:02:14 | * | jmdaemon joined #nim |
06:02:37 | * | rp1 joined #nim |
06:03:04 | * | laintree joined #nim |
06:03:31 | arkanoid | I see from your site you do/did Unity |
06:04:12 | arkanoid | been game dev for years, too. With unity mostly, but not only |
06:04:41 | FromDiscord | <Elegantbeef> I'm a pretend game dev 😛 |
06:04:46 | FromDiscord | <Elegantbeef> Just like i'm a pretend programmer |
06:05:24 | FromDiscord | <Elegantbeef> Ark is like "I have a link to this person's git, let's figure out where they live so i can nuke them back to the stone age" |
06:05:27 | arkanoid | well, the most capable one I've ever met used to say exactly that, everyday, while writing AI code with linq |
06:05:57 | FromDiscord | <Elegantbeef> Using linq for AI is ungodly |
06:05:59 | arkanoid | actually I was trying to send you a beer or something |
06:06:06 | FromDiscord | <Elegantbeef> But yea i learned programming with Unity, then moved to Nim a few years ago |
06:06:17 | FromDiscord | <Elegantbeef> I dont have anything setup for donations or the like |
06:06:47 | arkanoid | think about it! I've been helpful, and the beer I skipped today for ranting with nim is well deserved |
06:06:54 | FromDiscord | <Elegantbeef> I did recently start working on my game written in pure nim the otherday |
06:07:04 | arkanoid | s/I'/You've/ |
06:07:08 | * | jmd_ quit (*.net *.split) |
06:07:08 | * | rlp10 quit (*.net *.split) |
06:07:09 | * | [R] quit (*.net *.split) |
06:07:09 | * | Goodbye_Vincent quit (*.net *.split) |
06:07:09 | * | sagax quit (*.net *.split) |
06:07:10 | * | joast quit (*.net *.split) |
06:07:10 | * | haakon quit (*.net *.split) |
06:07:10 | * | lain quit (*.net *.split) |
06:07:10 | * | dv^_^ quit (*.net *.split) |
06:07:10 | * | def- quit (*.net *.split) |
06:07:10 | * | drewr quit (*.net *.split) |
06:07:10 | * | tinystoat quit (*.net *.split) |
06:07:10 | * | flynn quit (*.net *.split) |
06:07:21 | arkanoid | which engine, may I ask? |
06:07:26 | FromDiscord | <Elegantbeef> Yea i know evoalg also has wanted to send me a small gift |
06:07:28 | FromDiscord | <Elegantbeef> My own framework |
06:07:45 | arkanoid | cool! opengl/vulkan? |
06:07:53 | FromDiscord | <evoalg> indeed |
06:07:57 | FromDiscord | <Elegantbeef> opengl + sdl2 + assimp |
06:08:11 | FromDiscord | <Elegantbeef> It looks purdy thanks to my technical art skills |
06:08:18 | arkanoid | I did my little game engine too back in the days. But was objective-c |
06:08:26 | FromDiscord | <Elegantbeef> https://streamable.com/vlp8mi |
06:08:47 | FromDiscord | <Elegantbeef> Present state, will be moving to Nico for a level editor since I cannot be arsed to making a UI system with my framework atm |
06:09:00 | FromDiscord | <Rika> why dont u just drink a beer with the man damnit |
06:09:10 | FromDiscord | <Elegantbeef> I dont drink |
06:09:21 | FromDiscord | <Rika> damn are you really a programmer if you dont drink |
06:09:31 | FromDiscord | <Rika> im joking fyi |
06:09:32 | FromDiscord | <Elegantbeef> Probably not |
06:09:40 | FromDiscord | <Rika> i feel like someones gonna fucking maul me if i didnt say that |
06:09:44 | FromDiscord | <Elegantbeef> No i dont do drugs either |
06:09:54 | FromDiscord | <evoalg> at least you're not a vegetarian |
06:10:06 | FromDiscord | <Elegantbeef> I'm the sterotypically the least fun person |
06:10:25 | arkanoid | sure, when I say beer, what I really mean is beer |
06:10:31 | FromDiscord | <Rika> the only thing you got going for ya is your self deprecation it seems |
06:10:34 | arkanoid | I mean, whatever you like |
06:10:56 | FromDiscord | <BhamidipatiNikhil> I want to print the ticks and tocks on the same line.... so i used '\b' char... but i did not get such result in the console... https://media.discordapp.net/attachments/371759389889003532/936503593131995196/unknown.png |
06:10:58 | arkanoid | is it possible to dislike beer, yes, but it's de-facto something nice |
06:11:07 | FromDiscord | <Rika> what is \b? |
06:11:41 | FromDiscord | <BhamidipatiNikhil> Backspace https://media.discordapp.net/attachments/371759389889003532/936503779174526976/unknown.png |
06:11:46 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3NKe |
06:11:53 | arkanoid | I really like the transparency effect and the shadows! is it fragshader I guess |
06:12:11 | FromDiscord | <BhamidipatiNikhil> sent a code paste, see https://paste.rs/OQp |
06:12:17 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/HlR |
06:12:25 | FromDiscord | <Elegantbeef> Yea it's all frag shader magic |
06:12:29 | FromDiscord | <Elegantbeef> Couldnt be arsed to support proper transparency |
06:12:51 | * | [RMS] joined #nim |
06:12:51 | * | dv^_^ joined #nim |
06:12:51 | * | def- joined #nim |
06:12:51 | * | tinystoat joined #nim |
06:12:51 | * | flynn joined #nim |
06:13:19 | arkanoid | nah, this is nicer |
06:13:49 | FromDiscord | <Elegantbeef> Yea was going to say it fits the style more |
06:13:53 | arkanoid | said that, I have to sleep at least a couple of hours. Can't smart work tomorrow |
06:13:58 | * | [RMS] is now known as Guest9702 |
06:14:14 | FromDiscord | <Elegantbeef> Buh bye, have fun! |
06:14:39 | arkanoid | thanks again beef! |
06:14:41 | FromDiscord | <BhamidipatiNikhil> Good bot!! Thanks @ElegantBeef https://media.discordapp.net/attachments/371759389889003532/936504538532290600/unknown.png |
06:15:00 | FromDiscord | <Elegantbeef> No problem the both of you |
06:16:55 | FromDiscord | <Rika> beef i wish i had the amount of free time you had lmfao |
06:17:15 | FromDiscord | <Elegantbeef> Sure but i'm also perpetually useless |
06:17:57 | FromDiscord | <Elegantbeef> You're getting edumacated |
06:22:06 | FromDiscord | <Elegantbeef> Like i mean i have all this free time and havent done anything 😛 |
06:25:26 | FromDiscord | <Rika> more than me already |
06:28:10 | * | rockcavera quit (Remote host closed the connection) |
06:31:49 | * | rienske quit (Quit: WeeChat 3.4) |
06:44:47 | * | rienske joined #nim |
06:54:25 | FromDiscord | <BhamidipatiNikhil> I have a doubt, i want to learn nim manual interactively... so should i chose inim or jupyternim or nimNotebook for best experience? |
06:54:54 | FromDiscord | <Elegantbeef> Inim is probably the best repl |
06:56:55 | FromDiscord | <Rika> inim is probably the most battletested so far |
06:57:13 | FromDiscord | <Rika> even if its just gone to a single sortie compared to other things in other languages 😛 |
06:58:20 | FromDiscord | <BhamidipatiNikhil> Thanks @Rika ... I believe i am learning better practising interactively! https://media.discordapp.net/attachments/371759389889003532/936515517764763648/unknown.png |
06:58:54 | FromDiscord | <Rika> didnt beef tell you first lmao |
06:59:13 | FromDiscord | <Elegantbeef> I'm a bot beep boooop booooooooooooop |
06:59:39 | FromDiscord | <Rika> me too, my heart rate monitor makes these cool beeps too |
06:59:55 | FromDiscord | <BhamidipatiNikhil> Thanks @ElegantBeef 😌 |
06:59:59 | FromDiscord | <Rika> though sometimes it does this weird single long beep and its kinda scary but it goes back to regular beeping after a while |
07:00:18 | FromDiscord | <Rika> this is a joke, i am fine |
07:00:20 | FromDiscord | <Elegantbeef> Yea you're supposed to have qrs waves but i only have the q |
07:01:16 | FromDiscord | <Elegantbeef> Yea i was joking aswell rika is fine |
07:12:30 | * | jjido joined #nim |
07:16:56 | FromDiscord | <evoalg> I probably wouldn't have stuck with Nim if it weren't for you beefy ... too much of a learning curve for me otherwise |
07:19:19 | FromDiscord | <Rika> i shall dissolve into the background then |
07:19:43 | * | rienske quit (Quit: WeeChat 3.4) |
07:20:21 | FromDiscord | <evoalg> You've certainly been helpful Rika ... |
07:20:29 | FromDiscord | <eyecon> In reply to @sigkill "Anyone have a nice": https://github.com/zah/nim.vim - a Nim plugin for vim |
07:20:39 | FromDiscord | <evoalg> beefy has more time |
07:20:44 | FromDiscord | <Rika> ;; its true |
07:26:36 | * | rienske joined #nim |
07:26:48 | * | laintree is now known as lain |
07:40:43 | * | PMunch joined #nim |
08:04:43 | * | cyraxjoe quit (Quit: I'm out!) |
08:07:51 | * | cyraxjoe joined #nim |
08:24:31 | * | l1x joined #nim |
08:30:17 | * | Gustavo6046 quit (Quit: Leaving) |
09:47:24 | FromDiscord | <Goel> sent a code paste, see https://play.nim-lang.org/#ix=3NKS |
09:47:29 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
09:48:21 | FromDiscord | <Elegantbeef> `uint`s are unchecked |
09:49:05 | FromDiscord | <Goel> I see it, but why? Should i manually check everytime i use a 'u8 then by myself or there is another way? |
09:49:49 | FromDiscord | <Elegantbeef> uints underflow more than ints |
09:49:57 | FromDiscord | <Rika> Because uints are commonly used for modulo arithmetic |
09:50:28 | FromDiscord | <Elegantbeef> I'm tired and i should shush 😀 |
09:51:20 | FromDiscord | <Goel> The only reason i had to define a uint8 instead of a int are the case when im sure they are exactly 255 max, for example in an rgb. So i usually define them as uint8 instead of int so i know it will tell me if does some overflow. But if it doesn't check for them then... |
09:51:33 | FromDiscord | <xx_ns> I still think disabling the error check should be explicit and not implicit, because there's no way for the developer to intuitively know that underflow checks aren't applied for uints |
09:51:56 | FromDiscord | <Elegantbeef> Except the manual explicitly states it |
09:52:18 | FromDiscord | <Elegantbeef> It's not even disabling it's just that uints are commonly used when you want wrapping |
09:52:25 | FromDiscord | <Elegantbeef> So there are no checks |
09:52:49 | FromDiscord | <Elegantbeef> you can always do `0..255` if you want it checked |
09:53:08 | FromDiscord | <Rika> In reply to @xx_ns "I still think disabling": You can argue that and it is a good point |
09:53:17 | FromDiscord | <Rika> But it can’t be changed for now |
09:54:49 | FromDiscord | <xx_ns> In reply to @Elegantbeef "Except the manual explicitly": intuitively... You're not going to be↵1) reading the manual for uints if you are familiar with them already ↵2) know to specifically look for the paragraph that states that under/overrun checks are disabled for them when those checks are specifically a selling point for nim |
09:55:22 | FromDiscord | <xx_ns> there's no inherent logic which would make a developer think "I wonder if checks are disabled for uints" and go look it up |
09:55:57 | FromDiscord | <Rika> Well there is but not for the common dev |
09:56:01 | FromDiscord | <Michal Maršálek> Intuitively, only ints are approximations of integers. uintx behave as integers modulo 2^x instead. |
09:56:10 | FromDiscord | <Rika> What? |
09:57:19 | FromDiscord | <Rika> But yes my point is that some pretty large group of programmers commonly use uints for modulo arithmetic |
09:57:29 | FromDiscord | <Goel> sent a code paste, see https://play.nim-lang.org/#ix=3NKV |
09:57:37 | FromDiscord | <Rika> And I believe that Araq kept it because of that |
09:57:49 | FromDiscord | <Goel> (edit) "https://play.nim-lang.org/#ix=3NKV" => "https://play.nim-lang.org/#ix=3NKW" |
09:58:02 | FromDiscord | <Rika> In reply to @Goel "Also something i noticed": Normal for floating point representation |
09:58:21 | FromDiscord | <Rika> https://0.30000000000000004.com/ |
09:59:22 | FromDiscord | <xx_ns> In reply to @Michal58 "Intuitively, only ints are": by that logic, why bother with checks at all? Intuitively, overrunning the signed integer will flip the signed bit |
09:59:53 | FromDiscord | <Michal Maršálek> In reply to @xx_ns "there's no inherent logic": There is. The logic is if my value should behave like an integer I use type int, which is expected to approximate integers. If I wanna use uint then I need to check how it works in my language of choice. |
10:00:16 | FromDiscord | <Rika> In my opinion, checks should have been there and there should be a type (or just use the push pop switch for the code section) to disable the checks |
10:00:23 | FromDiscord | <Rika> But yeah for now we can’t change it |
10:00:26 | FromDiscord | <Rika> Because breaking change |
10:00:41 | FromDiscord | <mratsim> In reply to @Goel "Why only for `int`'s": because uint are defined everywhere as wrapping around after max. |
10:02:06 | FromDiscord | <Rika> In reply to @mratsim "because uint are defined": Sure, but is it good design |
10:02:27 | FromDiscord | <mratsim> It's expected and familiar to people coming from system languages. |
10:02:59 | FromDiscord | <Rika> But we aren’t just catering to them |
10:03:04 | FromDiscord | <Michal Maršálek> In reply to @xx_ns "by that logic, why": No. If the value is supposed to represent integers than you need to signal an overflow as an error. |
10:03:04 | FromDiscord | <mratsim> if you want checks you can use int, which will prevent underflows. or range[0..255] |
10:03:07 | FromDiscord | <Rika> We’re trying to cater to everyone |
10:03:12 | FromDiscord | <xx_ns> In reply to @Michal58 "There is. The logic": I don't understand why you're defending hidden surprises in a language where the developer is explicitly told otherwise. I'm not advocating for or against checks, I'm advocating for consistency |
10:03:26 | FromDiscord | <mratsim> In reply to @Rika "We’re trying to cater": for everyone with have ints. |
10:03:50 | FromDiscord | <mratsim> basically use ints for safety, common use. Use uint if you need low-level. |
10:04:06 | * | jjido joined #nim |
10:04:12 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3NL0 |
10:04:35 | FromDiscord | <Rika> Then there’s an educational issue here |
10:04:42 | FromDiscord | <mratsim> as always, docs ... |
10:04:49 | FromDiscord | <xx_ns> yes, you can, that's literally not my point. You _can_ do whatever you want if you _know_ to do it |
10:05:24 | FromDiscord | <mratsim> I did some for our auditors: https://nimbus.guide/auditors-book/02.2_stack_ref_ptr_types.html#numerical-types |
10:05:28 | FromDiscord | <xx_ns> expecting a developer to read the entire documentation from start to finish in order to properly use your language means your language will never be used because you've made design decisions which don't make sense to the average developer |
10:05:55 | FromDiscord | <mratsim> but C devs expect no checks at all? |
10:06:01 | FromDiscord | <xx_ns> yes? |
10:06:05 | FromDiscord | <xx_ns> that is known for C |
10:06:06 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/tut1.html#basic-types-integers |
10:06:17 | FromDiscord | <xx_ns> Nim specifically advertises having overrun checks |
10:06:32 | FromDiscord | <xx_ns> so when those magically disappear for some primitives, it is a hidden surprise |
10:06:34 | FromDiscord | <xx_ns> which is bad language desing |
10:06:44 | FromDiscord | <xx_ns> (edit) "desing" => "design" |
10:06:44 | FromDiscord | <mratsim> I think it's bad docs |
10:06:53 | FromDiscord | <Rika> Eh I mean you lose checks if you use ptr which is a primitive |
10:06:56 | FromDiscord | <Rika> It’s bad docs |
10:07:08 | FromDiscord | <Elegantbeef> It's not hidden it's documented in the official tutorial and in the manual |
10:07:20 | FromDiscord | <xx_ns> if it's not hidden, why is there a person in here asking about it? |
10:07:25 | FromDiscord | <xx_ns> this person represents your average developer |
10:07:29 | FromDiscord | <mratsim> bad discoverability then? |
10:07:32 | FromDiscord | <xx_ns> imagine if he didn't accidentally stumble upon this behaviour |
10:07:40 | FromDiscord | <xx_ns> he wouldn't've even known to expect it |
10:07:52 | FromDiscord | <mratsim> that's why you write tests. |
10:08:06 | FromDiscord | <Rika> Actually maybe not bad docs, it’s bad naming and design, it’s not intuitive to most that “unsigned means no checks”, since “why” is only “because a group of people say so” 🙂 |
10:08:07 | FromDiscord | <Michal Maršálek> Nim is more abstract language. I think you need to think about what the types really represent and what they are use for. For uint it's not really and overflow that is happening, but rather a wrap around. |
10:08:38 | FromDiscord | <Michal Maršálek> (edit) "use for." => "used for rather than just the bitpatterns." |
10:08:42 | FromDiscord | <Rika> In reply to @Michal58 "Nim is more abstract": Sure, the same is true for ints |
10:08:48 | FromDiscord | <Elegantbeef> I think the question is "how are they learning" |
10:08:53 | FromDiscord | <Elegantbeef> Goel what are you using to learn? |
10:08:58 | FromDiscord | <Goel> sent a long message, see http://ix.io/3NL4 |
10:09:58 | FromDiscord | <xx_ns> again, i'm not saying that checks are a good or a bad thing per se, that _is_ up for the people who design the language. If you have no checks, so be it, but at least have no checks consistently |
10:09:59 | FromDiscord | <mratsim> In reply to @Goel "<@!570268431522201601> In Zig,": People don't use uint in Nim except at a low-level. At a low-level we can assume that people know how to deal with it. |
10:10:11 | FromDiscord | <Michal Maršálek> In reply to @Goel "<@!570268431522201601> In Zig,": Yes, what is expected for one developer and one language might be unexpected for a different developer or a language. |
10:10:38 | FromDiscord | <Rika> In reply to @mratsim "People don't use uint": Why isn’t it reflected then? Pointers are “heavily advertised as low level only”, why aren’t uints? |
10:10:52 | FromDiscord | <Michal Maršálek> So I think the best solution is to explicitly state that in the docs/tutorial, which is iirc done. |
10:11:02 | FromDiscord | <Rika> Not sufficiently I will say |
10:11:04 | FromDiscord | <mratsim> length, iterators and everything else in the stdlib use `int` |
10:11:11 | FromDiscord | <mratsim> not uint |
10:11:20 | FromDiscord | <Rika> In reply to @mratsim "length, iterators and everything": A beginner would not understand or pick up on why |
10:11:36 | FromDiscord | <Michal Maršálek> In reply to @Rika "Why isn’t it reflected": Good point |
10:11:41 | FromDiscord | <mratsim> but then they wouldn't use uint, there is no incentive if they stay in the stdlib world to use uint |
10:12:00 | FromDiscord | <Elegantbeef> Well i'll go for the ol' classic and say "PRs welcome" 😀 |
10:12:10 | FromDiscord | <mratsim> RFCs welcome: like this https://github.com/nim-lang/RFCs/issues/175 |
10:12:11 | FromDiscord | <Rika> In reply to @mratsim "but then they wouldn't": Sorry my brain literally didn’t understand this please explain ;; |
10:12:27 | FromDiscord | <mratsim> In reply to @Rika "Sorry my brain literally": A beginner has no reason to use uint in Nim |
10:12:50 | FromDiscord | <mratsim> are there even proc that returns uint except say parseUint? |
10:13:02 | FromDiscord | <Rika> Well yeah they don’t, so it should be expressed harder that they shouldn’t. I guess it really is PRs welcome at this point |
10:13:14 | FromDiscord | <mratsim> even the "toBin(...)" proc to give the binary repr are accepting int and not uint for some reason. |
10:13:56 | * | krux02 joined #nim |
10:14:37 | FromDiscord | <xx_ns> Most developers know of the characteristics of unsigned integers, namely: they can never represent negative values, and they have a "larger" capacity than a regular int. If a developer knows that this fits their use case perfectly, and the language readily makes those types available, why _wouldn't_ they use it? |
10:15:34 | FromDiscord | <mratsim> In reply to @xx_ns "Most developers know of": and they know that they wrap around. |
10:16:09 | FromDiscord | <xx_ns> sure |
10:16:14 | FromDiscord | <xx_ns> which they think they're protected against |
10:16:17 | FromDiscord | <xx_ns> because _checks_ |
10:16:20 | FromDiscord | <Elegantbeef> I think the docs can be more explicit, but you can only lead a cow to water |
10:17:04 | FromDiscord | <mratsim> In reply to @xx_ns "which they think they're": Majority of dev that know unsigned exist are from a low-level language, so C or C++, even if they come from Zig, they would know the danger. |
10:17:13 | FromDiscord | <mratsim> people coming from say, Python or JS would use int |
10:17:36 | FromDiscord | <Goel> sent a code paste, see https://play.nim-lang.org/#ix=3NL9 |
10:17:51 | FromDiscord | <Elegantbeef> `x div y` |
10:17:58 | FromDiscord | <mratsim> In reply to @Goel "Also, why this is": because / is for exact division while `div` is for euclidean division. |
10:18:02 | FromDiscord | <Rika> Use div because / is ALWAYS float division |
10:18:16 | FromDiscord | <Michal Maršálek> In reply to @xx_ns "which they think they're": Why are you ignoring the fact that the wrap around is intended? There's nothing to protect you from. It might be surprising for a developer that doesn't know this, sure bu that can be said about any feature. |
10:18:18 | FromDiscord | <Rika> I think it’s one of the better design choices |
10:19:31 | FromDiscord | <Michal Maršálek> (edit) "feature." => "feature (like / op for example)." |
10:22:45 | * | haakon_ is now known as haakon |
10:27:32 | FromDiscord | <Michal Maršálek> I just don't like the mindset of "I'll use a feature I don't really know how it works and then complain it doesn't work as I thought it does." |
10:28:21 | FromDiscord | <xx_ns> uints are not a _feature_ |
10:28:22 | FromDiscord | <xx_ns> sent a long message, see http://ix.io/3NLf |
10:28:24 | FromDiscord | <xx_ns> uints are a primitive |
10:28:28 | FromDiscord | <xx_ns> checks are a _feature_ |
10:28:41 | FromDiscord | <Rika> Pointers are a primitive |
10:28:43 | FromDiscord | <xx_ns> that are for no good reason dropped for some primitives |
10:29:20 | FromDiscord | <Rika> What is a “primitive” in Nim anyway? It’s really fuzzy for Nim compared to other languages |
10:30:26 | FromDiscord | <Michal Maršálek> In reply to @xx_ns "I am not ignoring": You don't need to understand compiler internals to be able to read a doc/tutorial. Again the docs can always be improved but what does it have to do with the compiler itself? |
10:30:29 | FromDiscord | <mratsim> In reply to @xx_ns "uints are a primitive": Again, people can use `range[0..255]` to better express their intent and it will be checked. |
10:30:58 | FromDiscord | <mratsim> Nim by default use ints everywhere, and range types will work with proc that use int |
10:31:18 | FromDiscord | <mratsim> if they use uint, they need to cast everywhere, basically they are on their own. |
10:31:28 | FromDiscord | <mratsim> (edit) "cast" => "convert (checked)" |
10:31:30 | FromDiscord | <Elegantbeef> Well we could also make a `suints` package, but still need to get people there |
10:31:36 | FromDiscord | <Rika> In reply to @Rika "What is a “primitive”": If anyone wants to answer my tangent please do so ;; it’s an interesting qn |
10:31:47 | FromDiscord | <Rika> In reply to @Elegantbeef "Well we could also": Signed unsigned integers |
10:32:08 | FromDiscord | <Elegantbeef> I think builtin is a better term than "primitive" in Nim but idk |
10:32:21 | FromDiscord | <Rika> Someone needs to expose the saturated arithmetic some time, might be useful for someone somewhere |
10:32:48 | FromDiscord | <xx_ns> i was using "primitive" in this example as just a type you expect in almost every such language, not the right word for it |
10:32:49 | FromDiscord | <Rika> In reply to @Rika "Signed unsigned integers": Super user integers 🧐 |
10:32:52 | FromDiscord | <mratsim> Also in many system language applications (VM/lang, cryptography) you need the raw uint logic that maps to the hardware. |
10:33:48 | FromDiscord | <mratsim> you can't have the beginner devs dictate and make things difficult for programs that needs those pristine uint primitives. |
10:34:06 | FromDiscord | <mratsim> Nim achieves a balance right now with checked signed and unchecked unsigned |
10:34:17 | FromDiscord | <mratsim> yes we can improve docs and their discoverability |
10:34:18 | FromDiscord | <xx_ns> then you shouldn't be advertising uints to beginner devs? |
10:34:23 | FromDiscord | <mratsim> we don't? |
10:34:39 | FromDiscord | <Rika> We shouldn’t and I don’t know if we do but if we do we shouldn’t |
10:34:41 | FromDiscord | <xx_ns> it's literally one of the first things you're told in the nim guide? |
10:35:04 | FromDiscord | <mratsim> and it should be aid that they are not checked just beside. |
10:35:04 | FromDiscord | <Rika> That needs to be fixed then I guess |
10:35:11 | FromDiscord | <mratsim> (edit) "aid" => "said" |
10:38:35 | FromDiscord | <xx_ns> even people who write guides don't mention this behaviour, either because they aren't actively aware of it or because they never knew it in the first place |
10:38:54 | FromDiscord | <xx_ns> for example https://nim-by-example.github.io/primitives/ |
10:38:57 | FromDiscord | <Elegantbeef> Or the third they forget to mention it |
10:39:04 | FromDiscord | <Rika> You mean aware and think everyone else is aware? |
10:39:23 | FromDiscord | <Rika> Beef rushing to revise his posts |
10:39:50 | FromDiscord | <Elegantbeef> I dont have any intros to Nim posts |
10:39:51 | FromDiscord | <mratsim> In reply to @xx_ns "even people who write": I think it's just an omission, and a PR can be made. |
10:40:07 | FromDiscord | <Rika> Yes pretty much |
10:40:10 | FromDiscord | <Rika> If not a PR an issue |
10:40:45 | FromDiscord | <mratsim> And that would be something that goes in a cookbook. "I want to make a type that can represent 256 values, what are my solutions?". |
10:41:01 | FromDiscord | <Elegantbeef> And if one is relatively unhappy with the way Nim's builtin uints work they can always make one that is the same size but safe |
10:41:06 | FromDiscord | <Rika> Most people don’t think of making a cookbook |
10:41:20 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3NLh |
10:41:29 | FromDiscord | <Rika> What does the s mean !?! |
10:41:36 | FromDiscord | <Elegantbeef> safe |
10:41:38 | FromDiscord | <Rika> Sintered? SChecked?? |
10:41:54 | FromDiscord | <mratsim> also in that example "unsigned" isn't even explained in terms of integer size or positive only. |
10:42:34 | FromDiscord | <xx_ns> it is? |
10:42:38 | FromDiscord | <xx_ns> > To indicate the size of an integer literal, append u or i and the size you’d like to the end. |
10:42:50 | FromDiscord | <xx_ns> oh |
10:42:50 | FromDiscord | <mratsim> > unsigned integers are similar with u prepended to the type |
10:42:52 | FromDiscord | <xx_ns> wait |
10:43:00 | FromDiscord | <mratsim> that doesn't explain what unsigned entails. |
10:44:53 | FromDiscord | <Elegantbeef> Anyway i'm going to sleep and leaving with the my favourite message "be the change you want to in the world, make that PR" |
10:59:01 | FromDiscord | <Goel> sent a long message, see https://paste.rs/kV8 |
10:59:13 | FromDiscord | <Goel> (edit) "http://ix.io/3NLm" => "http://ix.io/3NLn" |
10:59:29 | FromDiscord | <Rika> int64 |
11:00:13 | FromDiscord | <Goel> That's not what i'm talking, i mean `x: int` or `f: float` |
11:00:52 | FromDiscord | <Rika> I don’t get your issue |
11:01:29 | FromDiscord | <Rika> Trouble? You have checks now, what’s the difference from using a uint aside from that? |
11:02:54 | FromDiscord | <Goel> If i only use (as suggested by mratsim if i didn't get it wrong) and declare variables or fields as `int` and `float`, that will be based on my architecture. And my program will behave following it. But it will behave differently for another architecture, so just defining them as simply `int` or `float`, instead of example `int32`, `int64`, `uint32` will cause problems |
11:03:36 | FromDiscord | <Rika> That’s not what he means, he means use ints over uints and that includes 8,16,32,64s |
11:03:51 | FromDiscord | <Goel> Oh ok then |
11:04:27 | FromDiscord | <Rika> If you want a definitive answer though, let’s wait for him if he would reply. But I’m pretty sure what I said is what he means |
11:05:52 | FromDiscord | <Goel> But once again, why Nim should "gently" force me to stick to `int`'s instead of `uint`'s when i know for example i have an array of elements that will always be positive, so why should i declare it as `int32` instead if `uint32`? That would make more sense to me |
11:15:27 | FromDiscord | <haolian9 (高浩亮)> i saw `mitems` in latest [manual](https://nim-lang.org/docs/tut1.html#control-flow-statements-for-statement), but i also found it [nim-lang/Nim#3700](https://github.com/nim-lang/Nim/issues/3700) at least since 2016?> items and mitems, which provides immutable and mutable elements respectively |
11:15:54 | FromDiscord | <mratsim> In reply to @Goel "But once again, why": do you know how to deal with underflows? |
11:16:03 | FromDiscord | <mratsim> if no, use int |
11:16:13 | FromDiscord | <mratsim> or range types if you want to restrict |
11:16:18 | FromDiscord | <mratsim> say range[0..255] |
11:16:50 | FromDiscord | <mratsim> if at one point you are tempted to use `if a < b -1` you shouldn't use uint. |
11:16:56 | FromDiscord | <mratsim> (edit) "-1`" => "- 1`" |
11:18:26 | FromDiscord | <BhamidipatiNikhil> Interesting that parseInt() is not accepted under the map method... We should use just parseInt without the parentheses instead https://media.discordapp.net/attachments/371759389889003532/936580977550049330/unknown.png |
11:19:10 | FromDiscord | <Vindaar> In reply to @BhamidipatiNikhil "Interesting that parseInt() is": that's because `parseInt()` is a function call, but `map` expects a function itself |
11:20:12 | FromDiscord | <Vindaar> (yes, by turning `map` into a macro one could remove the call in case the user does this, but I think uhh, that's a bad idea 😅) |
11:21:53 | FromDiscord | <mratsim> In reply to @Goel "But once again, why": there is a reason why in Nim, lengths return an int and not an uint. uints are hard to use safely because they don't allow negative values. |
11:22:18 | FromDiscord | <mratsim> many bugs in C and C++ are due to comparing unsigned numbers |
11:27:44 | FromDiscord | <haolian9 (高浩亮)> it turns out that i used `let` to declare the variable; but the error message is hard to read though |
11:28:15 | Amun-Ra | and many bugs in C and C++ are due to silent unsigned wrapping as the result of arithmetical operations |
11:29:04 | FromDiscord | <cybardev> In reply to @BhamidipatiNikhil "Interesting that parseInt() is": That's true for most (if not all) languages, no? |
11:29:08 | Amun-Ra | wrapping as in wrapping around |
11:30:18 | FromDiscord | <BhamidipatiNikhil> In reply to @Vindaar "that's because `parseInt()` is": Yes, understood... Thx @Vindaar |
11:30:25 | FromDiscord | <cybardev> (edit) "In reply to @BhamidipatiNikhil "Interesting that parseInt() is": That's true for most (if not all) languages, no? ... " added "At least in Python it is." |
11:30:46 | FromDiscord | <cybardev> (edit) "In reply to @BhamidipatiNikhil "Interesting that parseInt() is": That's true for most (if not all) languages, no? At least in Python it is. ... " added "Probably in JS too." |
11:31:06 | FromDiscord | <evoalg> In reply to @BhamidipatiNikhil "Interesting that parseInt() is": mapIt works with parseInt() ... https://play.nim-lang.org/#ix=3NLu |
11:36:15 | FromDiscord | <BhamidipatiNikhil> In reply to @evoalg "mapIt works with parseInt()": The 'it' must mean iterator... If so, The mapit() is much more powerful and better than the map() method... |
11:38:55 | FromDiscord | <Vindaar> In reply to @evoalg "mapIt works with parseInt()": yes, certainly. But that's because `mapIt` is a template that accepts a body that itself evaluates to some value. With it you must use a call. so `x.mapIt(parseInt)` wouldn't work |
11:39:49 | FromDiscord | <Vindaar> In reply to @BhamidipatiNikhil "The 'it' must mean": `it` stands for the fact that `mapIt` is essentially a for loop that iterates over the input collection. The element at each iteration is given by the variable `it`, which is injected into the calling scope (i.e. the "argument" of `mapIt`). Hence the `it` |
11:42:28 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
11:49:12 | FromDiscord | <mratsim> In reply to @Amun-Ra "and many bugs in": which is why Nim uses signed by default |
11:50:22 | Amun-Ra | yupe |
11:50:59 | FromDiscord | <Michal Maršálek> In reply to @evoalg "mapIt works with parseInt()": For a second i was rather confused until I opened the link and noticed you meant `parseInt(it)` and not `parseInt()` :D |
11:52:15 | FromDiscord | <evoalg> ah yea ... I never know how to say things clearly |
11:56:39 | FromDiscord | <Phil> In reply to @mratsim "And that would be": I'm currently just catching up on what I missed, isn't that what "nim-by-example" is for? |
12:03:55 | PMunch | Hmm, we really should turn Nim documentation generation into JSON only and then run a separate program to turn JSON into HTML and LaTeX.. |
12:04:15 | PMunch | Would make it soooo much easier to build other documentation tools |
12:09:15 | PMunch | I'm looking at bringing documentation into a project documentation thing but extracting information from the HTML is painful, and the JSON format isn't quite up to the task of generating the same output |
12:09:32 | PMunch | It's almost there though |
12:09:50 | NimEventer | New thread by Severak: How to find bottlenecks?, see https://forum.nim-lang.org/t/8850 |
12:24:57 | Nuc1eoN | Hey guys I am checking a pull request to add nim icon to this vscode icon theme https://github.com/Mozart409/mozart409-icons/issues/4 |
12:25:14 | Nuc1eoN | do you guys know all the nim file extensions? |
12:28:54 | * | jmdaemon quit (Ping timeout: 250 seconds) |
12:32:28 | FromDiscord | <Phil> I wouldn't say I know all, the most common ones are `.nim` for nim code, `.nimble` for meta data about a package that also denotes its dependencies and `.nims`... which I forgot what that was for |
12:35:01 | FromDiscord | <haxscramper> `.nim`, `.nimble`. `.nims` for files, `.cfg` (or more specifically `nim.cfg`, `.nim.cfg` for configurations), `nimdoc.cfg`, also there is a deprecated `.babel` |
12:35:29 | FromDiscord | <haxscramper> nim syntax is only in `.nim` files |
12:46:03 | FromDiscord | <mratsim> In reply to @Isofruit "I'm currently just catching": No, how-to/cookbooks have a different goal and audience from tutorial (see https://documentation.divio.com/) |
12:53:51 | * | jjido joined #nim |
13:01:42 | Nuc1eoN | thank u |
13:01:51 | Nuc1eoN | It is implemented |
13:08:03 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
13:22:16 | * | drewr joined #nim |
13:37:47 | PMunch | @haxscramper, Nim syntax is in .nim, .nims, and .nimble |
13:38:13 | PMunch | Although .nimble is a bit special |
13:38:30 | FromDiscord | <Patitotective> Does `nimble` support cli scripts or entry points? like _pip_? |
13:38:38 | FromDiscord | <Patitotective> (edit) "`nimble`" => "_nimble_" |
13:38:53 | PMunch | Hmm, by using jsondoc and packages/docutils/highlite I'm able to get some kind of thing working |
13:39:00 | PMunch | @Patitotective, yup |
13:39:04 | FromDiscord | <haxscramper> In reply to @PMunch "<@608382355454951435>, Nim syntax is": that's exactly what I clarified in the second message. "nim syntax is only in .nim files" |
13:39:26 | PMunch | But you say they are only in .nim files |
13:39:33 | PMunch | But it is in .nims and .nimble as well |
13:39:37 | FromDiscord | <haxscramper> nim star |
13:39:45 | FromDiscord | <Patitotective> In reply to @PMunch "<@762008715162419261>, yup": Hmm, how? I couldn't find it on _nimble_'s repository hehe |
13:39:45 | FromDiscord | <haxscramper> the irc bridge broke my message |
13:39:47 | FromDiscord | <Patitotective> (edit) "hehe" => ":p" |
13:39:55 | FromDiscord | <haxscramper> you just don't the the full correct message |
13:40:01 | FromDiscord | <haxscramper> (edit) "the" => "see" |
13:40:39 | PMunch | @Patitotective, look for `tasks` in the Nimble documentation |
13:40:58 | PMunch | @haxscramper, aah, yes the bridge isn't super happy with * |
13:41:10 | PMunch | I think it always try to make them bold indicators or something like that |
13:48:54 | PMunch | I have to resolve links to documentation myself though, which is a bit of a pain |
13:51:25 | * | rockcavera joined #nim |
13:51:25 | * | rockcavera quit (Changing host) |
13:51:25 | * | rockcavera joined #nim |
13:55:11 | * | arkurious joined #nim |
14:13:56 | * | Guest9702 is now known as [R] |
14:37:33 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3NMa |
14:38:30 | FromDiscord | <Patitotective> (edit) "https://play.nim-lang.org/#ix=3NMa" => "https://play.nim-lang.org/#ix=3NMb" |
14:42:43 | FromDiscord | <mratsim> In reply to @Patitotective "I'm writing a lexer": Lexing is just transforming random characters into a tree of identifiers and symbols. Like if you see aabbb = 1234 the letters go together as would the numbers. And if you see `aa1234bb = 2` there shouldn't be any split between aa and 1234 they are part of the same whole. |
14:43:05 | FromDiscord | <mratsim> then parsing will assign them roles, like assigning a value. |
14:44:00 | FromDiscord | <Patitotective> Hmmmm Ok |
14:44:02 | FromDiscord | <Patitotective> thanks |
14:44:04 | FromDiscord | <Patitotective> 🙃 |
14:48:58 | * | jjido joined #nim |
15:01:12 | FromDiscord | <gerwy> Oh nice Patito i see you still working |
15:01:24 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
15:02:53 | FromDiscord | <gerwy> soo well heh, im at the stage of making AST↵how Node should look? I know it should have type, like the token type and probably a value and children↵there is nothing like union in nim at least not in the std i see, i tried to use `case` in object declaration but i can't change the type of the same property unfortunately↵so should i have value of AST node just be a string? |
15:04:40 | FromDiscord | <haxscramper> Generally nodes can be kept as a case objects, you can set their type on construction |
15:05:11 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3NMu |
15:06:16 | FromDiscord | <gerwy> yes im actually looking at rstast module for reference hah |
15:07:26 | FromDiscord | <gerwy> In reply to @haxscramper "Generally nodes can be": yeah i was thinking about `case`, but how would i assign value this way?↵can i do same thing as tuple so get the property by index? like TNode[0] |
15:07:54 | FromDiscord | <haxscramper> `node = TNode(kind: nkInt, intVal: <some value>)` |
15:08:03 | FromDiscord | <haxscramper> Or `node.intVal = <some value>` |
15:08:32 | FromDiscord | <gerwy> yeah but if would assign string to `node.intVal` it would be an error |
15:08:50 | FromDiscord | <gerwy> so i would need to check everytime for type of token |
15:08:56 | FromDiscord | <gerwy> (edit) "everytime" => "every time" |
15:09:14 | FromDiscord | <haxscramper> well, I assume that assinging string to an integer is indeed an error |
15:09:42 | FromDiscord | <haxscramper> what is the use case? you create new node from the token and assign it somewhere |
15:09:51 | FromDiscord | <gerwy> im making AST out of Token list |
15:09:52 | FromDiscord | <haxscramper> or what |
15:10:20 | FromDiscord | <haxscramper> In reply to @Life Sucks "im making AST out": how exactly? Handwritten recursive descend with `case` on the token kinds? |
15:10:48 | FromDiscord | <haxscramper> `of tokenKindInt: resultNode = TNode(kind: nkInt, intVal: token.intVal` |
15:11:19 | FromDiscord | <Patitotective> In reply to @Life Sucks "so i would need": you may want to create a procedure that depending on each kind, assigns the value to a different field |
15:11:59 | FromDiscord | <gerwy> so i would have seq of Nodes which would have type, i guess value and another seq of Nodes as for its children of course |
15:12:01 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3NMy |
15:12:06 | FromDiscord | <haxscramper> create new node, assigning value from a token |
15:12:09 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3NMz |
15:12:31 | FromDiscord | <haxscramper> sent a code paste, see https://paste.rs/fcO |
15:12:46 | FromDiscord | <haxscramper> or the way @Patitotective suggested, I just don't like in-place argument mutation for constructing datra |
15:12:47 | FromDiscord | <Patitotective> In reply to @Life Sucks "Oh nice Patito i": hehe yea, this seems to have no end |
15:12:48 | FromDiscord | <haxscramper> (edit) "datra" => "data" |
15:13:06 | FromDiscord | <gerwy> In reply to @haxscramper "or the way <@!762008715162419261>": i might have procedure with template parameter to that will have case statement and create node according to the type yeah hmm |
15:13:48 | FromDiscord | <gerwy> im kinda going with the tutorial to make interpreter for pascal in python and guy fortunately uses recursion to parse all tokens to AST↵but ugh this OOP in python is fucked |
15:15:42 | FromDiscord | <haxscramper> all parsers except LR are recursive |
15:15:49 | FromDiscord | <haxscramper> well, all sane parsers that you start with |
15:16:04 | FromDiscord | <haxscramper> recursive descent in all variations is recursive becase the AST itself is recursive |
15:16:47 | FromDiscord | <haxscramper> There are exceptions to the rule, like more specific parsing algorithms for expressions, but general code structure will be mutually recursive, following language's grammar |
15:18:39 | FromDiscord | <Patitotective> In reply to @mratsim "Lexing is just transforming": So, for example `"hello"` would be something like `DOUBLEQUOTE ALPHA ALPHA ALPHA ALPHA ALPHA DOUBLEQUOTE` and `r"hello"` `ALPHA DOUBLQUOTE ALPHA ALPHA ALPHA ALPHA ALPHA DOUBLEQUOTE`? And then in the parser it would be a string and a raw string? |
15:18:42 | NimEventer | New thread by Planetis: Html2karax first release!, see https://forum.nim-lang.org/t/8851 |
15:19:02 | FromDiscord | <Patitotective> In reply to @Patitotective "So, for example `"hello"`": Or can I say it is a string already? |
15:19:10 | FromDiscord | <Patitotective> (edit) "already?" => "and a raw string in the lexer?" |
15:29:59 | FromDiscord | <auxym> In reply to @Patitotective "So, for example `"hello"`": Something like that. I do recommend reading the first couple chapters of this: https://craftinginterpreters.com/contents.html |
15:38:11 | * | jjido joined #nim |
15:44:25 | FromDiscord | <Forest> Anyone know how I'd pass an argument to the linker in the Nims file? |
15:44:47 | FromDiscord | <Forest> Also how would i check if something isn't defined? |
15:45:27 | FromDiscord | <Forest> Would `if not defined(DEF)` work? |
15:46:43 | FromDiscord | <Phil> I actually have never tinkered with the nims file, so apologies, can't really help there |
15:46:55 | FromDiscord | <Forest> Fair enough, thanks aha |
15:49:23 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
15:49:27 | FromDiscord | <auxym> `--passL:-yourarghere` |
15:49:46 | FromDiscord | <Forest> I need to do it via the nims file |
15:50:09 | FromDiscord | <auxym> https://github.com/auxym/nim-on-samd21/blob/e7e8c3b993fca3e2ca3ebe9ff430959c73075149/config.nims#L55 |
15:50:36 | FromDiscord | <Forest> Yeah i just realized that Nim has a macro for it xD |
15:50:39 | FromDiscord | <Forest> Thanks! |
15:58:49 | FromDiscord | <eyecon> In reply to @auxym "Something like that. I": What beautiful typography |
15:59:37 | FromDiscord | <auxym> Yes! hand drawn illustrations too: https://journal.stuffwithstuff.com/2020/04/05/crafting-crafting-interpreters/ |
15:59:44 | FromDiscord | <konsumlamm> sent a long message, see http://ix.io/3NMQ |
16:00:09 | * | xiamx[m] quit (Quit: You have been kicked for being idle) |
16:03:40 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=3NMW |
16:07:23 | termer_ | Is there any type definition I can use that represents any type of integer |
16:07:44 | termer_ | if there isn't one, is there a way to define such a type? |
16:08:31 | FromDiscord | <enthus1ast> the next sqlite release will have JSON build in natively! |
16:08:32 | FromDiscord | <enthus1ast> https://www.sqlite.org/draft/releaselog/current.html |
16:09:04 | FromDiscord | <enthus1ast> image.png https://media.discordapp.net/attachments/371759389889003532/936654116841746432/image.png |
16:09:48 | FromDiscord | <Phil> sqlite is one of those insanely wonderful technologies |
16:10:07 | FromDiscord | <Phil> I just does so much so well for so little |
16:15:10 | FromDiscord | <Bung> sent a code paste, see https://play.nim-lang.org/#ix=3NN2 |
16:23:43 | * | PMunch quit (Quit: leaving) |
16:34:29 | * | joast joined #nim |
16:35:15 | FromDiscord | <ajusa> Is there a way to async create a folder or do fs operations other than writing? |
16:35:48 | Zevv | no |
16:40:16 | FromDiscord | <ajusa> In reply to @Zevv "no": Is my best option to use asyncthreadpool and then spawn a thread? I'm trying to avoid blocking the web server in this case |
16:40:45 | FromDiscord | <Shiba> so how can i make the nim compiler ignore those unused variables\modules |
16:41:02 | * | xet7 quit (Ping timeout: 260 seconds) |
16:41:16 | FromDiscord | <Shiba> (edit) "variables\modules" => "variables|modules" |
16:41:50 | Zevv | ajusa: yes; your OS is not exposing any async system calls for these file operations, so you will likely need soemthing like threads to work around this |
16:42:05 | FromDiscord | <ajusa> Gotcha, thanks for clarifying! |
16:44:03 | FromDiscord | <Phil> Man, if only donating to open source devs counted as charity donations |
16:44:51 | FromDiscord | <Shiba> In reply to @Isofruit "Man, if only donating": vim? |
16:44:51 | * | vicfred joined #nim |
16:45:20 | FromDiscord | <Phil> You mean if I donate to vim devs? |
16:46:27 | * | vicfred_ joined #nim |
16:46:28 | FromDiscord | <Shiba> yes https://media.discordapp.net/attachments/371759389889003532/936663527849095188/Capture.PNG |
16:48:13 | FromDiscord | <Shiba> In reply to @Isofruit "You mean if I": no , https://media.discordapp.net/attachments/371759389889003532/936663972722122822/Capture.PNG |
16:48:49 | FromDiscord | <Shiba> even their license called uganda.txt |
16:48:54 | FromDiscord | <Shiba> (edit) "even their license ... called" added "is" |
16:48:57 | * | vicfred quit (Ping timeout: 240 seconds) |
16:50:43 | FromDiscord | <Phil> As I do not, and have never intentionally, use vim, I do not donate specifically to charity towards children in Uganda. |
16:51:11 | FromDiscord | <Phil> Might've stumbled over that sooner if I did. |
16:57:51 | FromDiscord | <mratsim> In reply to @konsumlamm "those are reasons against": they represent closely what the hardware does and are necessary when you need to interact with hardware or simulate hardware. For all other use-cases, you have signed integers. |
17:01:37 | FromDiscord | <Waldecir Santos> Does nim have a trim function and what is the best way to search this kind of things ? |
17:01:54 | FromDiscord | <Rika> trim what exactly |
17:02:23 | FromDiscord | <Waldecir Santos> sorry spaces at the end of a string |
17:02:27 | FromDiscord | <leorize> \`strip()\` |
17:02:29 | FromDiscord | <Rika> https://nim-lang.org/docs/strutils.html#strip%2Cstring%2Cset%5Bchar%5D |
17:02:30 | * | xet7 joined #nim |
17:02:30 | FromDiscord | <leorize> in strutils |
17:02:33 | FromDiscord | <Rika> end only? |
17:02:42 | FromDiscord | <Waldecir Santos> Correct end only |
17:02:56 | FromDiscord | <Rika> `trailing = true` too in strip |
17:03:06 | FromDiscord | <planetis> Bookmark this\: https://nim-lang.github.io/Nim/theindex.html |
17:03:14 | FromDiscord | <Waldecir Santos> Man I was on that page and couldn't find it i need new glasses, thank you |
17:17:31 | FromDiscord | <Forest> To fix the issue i was having with Emscripten i downloaded an unmodified build of Nim and then edited the config.nims to include the android-glob by default, and then made a specific flag to disable it and now emscripten works fine :D |
17:18:30 | FromDiscord | <konsumlamm> In reply to @mratsim "they represent closely what": how do they represent what the hardware does closer than `int`s? sure, there should be a way to have raw integers without checks, but why should `uint`s specifically be that type? there are enough cases where you have integers that are never negative, and having that checked would eliminate all the C bugs with indexing you like to use as an argument against them |
17:25:13 | FromDiscord | <IsaacPaul> I would lean toward using unsigned. Developer intent is more clear. |
17:25:32 | FromDiscord | <IsaacPaul> but int is easier 'to deal with' |
17:41:43 | * | vicfred_ quit (Quit: Leaving) |
18:00:50 | FromDiscord | <elo88> this is normal or nimsuggest has leak? https://media.discordapp.net/attachments/371759389889003532/936682245442387998/unknown.png |
18:03:09 | FromDiscord | <konsumlamm> both probably |
18:10:29 | l1x | hi folks, is there a TLS lib that I can use in a HTTP server in Nim? |
18:12:52 | FromDiscord | <mratsim> In reply to @konsumlamm "how do they represent": Hardware integers are mod 2⁸ or 2¹⁶ or 2³² or 2⁶⁴.↵↵Using unsigned will NOT eliminate bugs, it will introduce bugs. It will introduce underflows everywhere. We used unsigned int at Status to implement a spec that used unsigned integer along with teams using Java, Typescript, Rust and Go. Everyone including the spec had underflows. |
18:15:46 | * | neceve joined #nim |
18:16:49 | FromDiscord | <konsumlamm> In reply to @mratsim "Hardware integers are mod": but wouldn't those bugs be caught if underflow was checked? |
18:18:27 | FromDiscord | <mratsim> In reply to @konsumlamm "but wouldn't those bugs": so use `range[0..255]` |
18:19:22 | FromDiscord | <konsumlamm> my point is that your arguments against uints are about hoe they're currently implemented, and not uints in general |
18:19:26 | FromDiscord | <mratsim> All C++ most prominent devs agree that you shouldn't use unsigned unless you want the low-level machine like behavior: https://stackoverflow.com/questions/10168079/why-is-size-t-unsigned |
18:19:46 | FromDiscord | <mratsim> uint in Nim maps to the hardware. |
18:20:03 | FromDiscord | <mratsim> they are implemented like uints (and ints) are in the CPU. |
18:20:04 | FromDiscord | <konsumlamm> because unsigned ints in C++ are bad, not unsigned ints in general |
18:20:48 | FromDiscord | <mratsim> why do you want to use unsigned int instead of signed int or range type? |
18:20:56 | * | rockcavera quit (Remote host closed the connection) |
18:22:14 | FromDiscord | <mratsim> In Nim, there is Natural if you want to express positive only integers. |
18:22:20 | FromDiscord | <mratsim> or range type. |
18:22:34 | FromDiscord | <mratsim> Ada does it too. And they also have unsigned integers. |
18:28:51 | FromDiscord | <konsumlamm> In reply to @mratsim "why do you want": because they're the intuitive type for values that are never negative |
18:29:26 | NimEventer | New post on r/nim by TonTinTon: Panther - a shellcode programming language written in Nim. Stopped working on it like a year ago, thought I'd share anyway., see https://reddit.com/r/nim/comments/sex8b8/panther_a_shellcode_programming_language_written/ |
18:30:59 | FromDiscord | <konsumlamm> if uints aren't supposed to be used as unsigned integers, but rather as unchecked raw integers, then honestly uint is a bad name (unless you wanna tell me that the u stands for unchecked) |
18:41:54 | FromDiscord | <haxscramper> they are bad representation for values that never have negative value, because this property is not enforced at compile nor runtime, instead they just silently produce a wrong behavior (wrapping around), whereas `Natural` or `range[0..255]` should work correctly |
18:42:37 | FromDiscord | <mratsim> people coming from high-level languages never had the unsigned vs signed distinction, they use int, = no problem. |
18:43:19 | FromDiscord | <mratsim> people coming from low-level languages either need check or unchecked and know the potential danger and use the appropriate one. |
18:55:41 | * | syl quit (Ping timeout: 256 seconds) |
18:55:41 | * | arkanoid quit (Ping timeout: 256 seconds) |
18:55:41 | * | Ekho quit (Ping timeout: 256 seconds) |
18:56:05 | * | arkanoid joined #nim |
18:56:15 | * | dtomato quit (Ping timeout: 256 seconds) |
18:56:15 | * | koltrast quit (Ping timeout: 256 seconds) |
18:56:34 | * | dtomato joined #nim |
18:57:06 | * | syl joined #nim |
18:58:29 | FromDiscord | <demotomohiro> `uint` type is used to storing bit pattern in some algorithm (PRNG, hash, cryptograph, etc).↵If `uint` had under/overflow checks, we cannot use it for these algorithm. |
18:59:02 | * | koltrast joined #nim |
18:59:36 | * | jjido joined #nim |
19:02:06 | FromDiscord | <demotomohiro> `uint` with range check may make sense for storig 24bit RGB value or 16 bit index buffer of 3D mesh. |
19:03:33 | * | jjido quit (Client Quit) |
19:04:08 | * | Ekho joined #nim |
19:04:24 | FromDiscord | <demotomohiro> Then, we have to add another `uint` type or operators with range check. |
19:07:35 | FromDiscord | <Waldecir Santos> Can some one explain why string format uses &"" why not just f"" like python, nim even have r"", can someone tell me the reason for that ? |
19:10:37 | FromDiscord | <Forest> Doesn't format use `fmt""`? |
19:10:58 | FromDiscord | <Forest> `&` is for concatenation last i checked |
19:11:20 | FromDiscord | <Waldecir Santos> You can check it here https://nim-lang.org/docs/strformat.html |
19:11:21 | FromDiscord | <demotomohiro> There is both `&` and `fmt` strformat |
19:11:37 | FromDiscord | <Forest> Huh never knew that |
19:12:07 | FromDiscord | <Waldecir Santos> This is not a criticism on complaint, I just want to understand why use `&` it feels confuse for me and over complex |
19:12:49 | FromDiscord | <demotomohiro> strformat define `&` as unary operator. Binary `&` for concatenation. |
19:13:01 | FromDiscord | <Forest> Ah okay |
19:14:31 | FromDiscord | <Forest> `&"Text\n"` looks more aesthetically pleasing to me tbh |
19:15:14 | FromDiscord | <demotomohiro> strformat module added relatively recenty in Nim and I guess author thought using `f` is too |
19:15:23 | FromDiscord | <demotomohiro> Short? |
19:16:26 | FromDiscord | <Forest> Just the fact that stuff isn't automatically escaped and requiring me to use another way to use \n and stuff |
19:19:01 | FromDiscord | <demotomohiro> fmt"foo\n" is generalized raw string literal and you cannot use escape sequence. https://nim-lang.org/docs/manual.html#lexical-analysis-generalized-raw-string-literals |
19:20:45 | FromDiscord | <demotomohiro> But &"foo\n" is not. You can use escape sequence. |
19:22:03 | FromDiscord | <Waldecir Santos> Yeah I still to nim, my question is more about why `&` guess we will never know 😦 |
19:22:09 | FromDiscord | <Waldecir Santos> (edit) "Yeah I still ... to" added "new" |
19:22:24 | * | Gustavo6046 joined #nim |
19:22:58 | FromDiscord | <demotomohiro> !eval import strformat; echo &"foo\tbar"; echo fmt"foo\tbar" |
19:23:01 | NimBot | foo bar↵foo\tbar |
19:23:16 | FromDiscord | <Phil> ~~I would throw money at getting python's f-strings just because I'm lazy~~ |
19:23:17 | FromDiscord | <Rika> letters and touching string literal -> raw |
19:23:22 | * | Gustavo6046 quit (Remote host closed the connection) |
19:23:31 | FromDiscord | <Rika> & is already the equiv. of f strings |
19:23:33 | FromDiscord | <Phil> (edit) "f-strings" => "f-string-syntax" |
19:23:50 | * | Gustavo6046 joined #nim |
19:25:14 | FromDiscord | <demotomohiro> You might check `git log Nim/lib/pure/strformat.nim` to find the person who created the module and find out the person and ask a question. |
19:25:17 | FromDiscord | <Waldecir Santos> Maybe git history have a explanation about it, I'll check later |
19:25:31 | FromDiscord | <Waldecir Santos> In reply to @demotomohiro "You might check `git": exactly, thank you |
19:32:05 | FromDiscord | <Patitotective> https://github.com/nim-lang/Nim/blame/6b3bdd798d235a465d94ebedbc784d6b41057798/lib/pure/strformat.nim#L17 |
19:33:14 | FromDiscord | <demotomohiro> I found a first pull request to add strformat: https://github.com/nim-lang/Nim/pull/6507 |
19:40:22 | FromDiscord | <Waldecir Santos> Wow it used to be `%` and it changed to `&` here https://github.com/nim-lang/Nim/commit/9a60eae631e9f778d3920f3a66de0e726e687eef |
19:41:35 | FromDiscord | <Phil> I am an imbecile! How have I missed the existance of strformat for so long! |
19:41:46 | FromDiscord | <Waldecir Santos> No explanation given just a `fixes #7078` |
19:43:09 | FromDiscord | <Waldecir Santos> there we go: |
19:43:18 | FromDiscord | <Waldecir Santos> sent a code paste, see https://play.nim-lang.org/#ix=3NO1 |
19:43:27 | FromDiscord | <Phil> Down with & for string concat! here comes the "{myvars}".fmt ! |
19:44:07 | FromDiscord | <Waldecir Santos> If you guys want to check the discussion: https://github.com/nim-lang/Nim/issues/7078 |
19:44:58 | FromDiscord | <Waldecir Santos> That was the explanation I was looking for, thank you guys. |
19:45:01 | FromDiscord | <Waldecir Santos> sent a code paste, see https://play.nim-lang.org/#ix= |
19:48:24 | FromDiscord | <Phil> I'm honestly never ever going to use "&", that is mentally set as string concat operator |
19:48:55 | FromDiscord | <Phil> The most readable way that has the least amount of gotcha on it really seems to be "your formatted string".fmt |
19:49:29 | FromDiscord | <Phil> (edit) ""&"," => ""&" for formatting," |
19:53:34 | FromDiscord | <Waldecir Santos> why `"your formatted string".fmt` and not `fmt"your formatted string"` ? |
19:56:08 | FromDiscord | <Phil> sent a long message, see http://ix.io/3NO3 |
19:57:01 | FromDiscord | <Phil> I could also do `fmt("your format string")` but I really dislike having to have brackets around long expressions, it's a bother |
19:57:51 | FromDiscord | <demotomohiro> !eval import strformat; echo fmt"foo\tbar"; echo fmt "foo\tbar" |
19:57:53 | NimBot | foo\tbar↵foo bar |
20:06:02 | * | vicecea quit (Remote host closed the connection) |
20:06:32 | * | vicecea joined #nim |
20:07:08 | FromDiscord | <Phil> hmmmmm |
20:07:22 | FromDiscord | <Phil> True, I could make use of nim's "bracket-less" form of calling a proc |
20:07:29 | FromDiscord | <Phil> Which... sidequestion, where did nim get that from? |
20:08:49 | FromDiscord | <Phil> this entire `a.len()` equals `a.len` equals `len a` thing I mean |
20:14:02 | Zevv | it's called "method call syntax": https://nim-lang.org/docs/manual.html#procedures-method-call-syntax |
20:14:33 | Zevv | sometimes called UFCS |
20:14:37 | Zevv | uniform function call syntax |
20:17:06 | Zevv | D does it, rust does it. Even C++ would like to do it. |
20:18:10 | FromDiscord | <Patitotective> In reply to @Isofruit "For some reason, according": https://nim-lang.org/docs/manual.html#lexical-analysis-generalized-raw-string-literals↵It is a generalized raw string literal |
20:27:34 | * | Gustavo6046 quit (Quit: Leaving) |
20:39:43 | * | neurocyte0917090 joined #nim |
20:45:58 | FromDiscord | <lakmatiol> sent a code paste, see https://play.nim-lang.org/#ix=3NOh |
20:46:13 | FromDiscord | <lakmatiol> https://media.discordapp.net/attachments/371759389889003532/936723863138607146/unknown.png |
20:47:13 | FromDiscord | <xx_ns> @lakmatiol wait, I know you... |
20:47:15 | FromDiscord | <xx_ns> pydis? |
20:47:54 | FromDiscord | <lakmatiol> ye, I spend a lot of time on pydis |
20:49:40 | FromDiscord | <Elegantbeef> newlining `ref object` is one issue |
20:49:40 | FromDiscord | <Elegantbeef> but there is another issue |
20:50:02 | FromDiscord | <Elegantbeef> That issue is a compiler bug causing a seg fault |
20:53:11 | FromDiscord | <Elegantbeef> Ah seems `SomeInteger` works so `enum` causes the segfault |
20:53:20 | FromDiscord | <noow> can I know whether -d:debug or -d:release/danger was used for compiling a piece of nim code from within the code? |
20:53:22 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3NOm |
20:53:39 | FromDiscord | <noow> is there a `when danger:` or something |
20:53:50 | FromDiscord | <Elegantbeef> `when defined(danger)` |
20:53:58 | FromDiscord | <noow> ah ok thank |
21:06:39 | * | neceve quit (Read error: Connection reset by peer) |
21:14:06 | FromDiscord | <mratsim> In reply to @Waldecir Santos "Can some one explain": because nim string formatting predates Python |
21:14:33 | FromDiscord | <Elegantbeef> Also Nim isnt python 😛 |
21:18:35 | * | jmdaemon joined #nim |
21:19:18 | FromDiscord | <xx_ns> it's fairly easy to get nim to do f-string style formatting as well |
21:19:26 | FromDiscord | <xx_ns> power of metaprogramming baby |
21:24:10 | FromDiscord | <Waldecir Santos> Yeah my question is more about why `&` that's all |
21:24:19 | FromDiscord | <Waldecir Santos> (edit) "is" => "was" |
21:24:56 | FromDiscord | <Elegantbeef> well there is `fmt` aswell |
21:28:10 | FromDiscord | <dom96> !eval import strformat; echo fmt"foo\tbar"; echo &"foo\tbar" |
21:28:13 | NimBot | foo\tbar↵foo bar |
21:28:19 | FromDiscord | <dom96> that's why |
21:28:56 | FromDiscord | <Patitotective> `!eval` should support fenced code blocks |
21:29:08 | FromDiscord | <Elegantbeef> It's on IRC so it cannot support much |
21:29:28 | FromDiscord | <dom96> PRs welcome 😄 |
21:34:09 | FromDiscord | <Patitotective> !eval↵echo "hello"↵echo "world" |
21:35:16 | FromDiscord | <Patitotective> There is no a bot-test channel? |
21:42:25 | FromDiscord | <Patitotective> I'm trying to understand _nimbot_'s code so I'm looking at https://github.com/nim-lang/irc but it seems to have no docs, is there a reason for that? I mean, I see there are documentation comments. Should I open a PR adding the docs? |
21:42:44 | FromDiscord | <Patitotective> I mean, an actual website |
21:43:44 | FromDiscord | <Patitotective> (edit) "a PR adding" => "an issue/PR to add" |
21:50:56 | * | mahlon quit (Ping timeout: 250 seconds) |
22:02:21 | FromDiscord | <Patitotective> https://github.com/nim-lang/irc/pull/24 |
22:02:23 | FromDiscord | <Patitotective> 🙃 |
22:13:07 | FromDiscord | <Rainbow Asteroids> does anyone know how to get the channel permissions of an author of a message in dimscord? |
22:19:45 | FromDiscord | <dom96> generated docs don't belong inside the repo |
22:22:48 | * | jjido joined #nim |
22:24:37 | FromDiscord | <treeform> In reply to @Patitotective "I'm trying to understand": here are docs https://nimdocs.com/nim-lang/irc/irc.html 🙂 |
22:26:43 | FromDiscord | <dom96> In reply to @treeform "here are docs https://nimdocs.com/nim-lang/irc/irc.": Nice! I keep trying to use nimble.directory for docs but it rarely seems to work :/ https://nimble.directory/docs/irc//irc.html |
22:27:20 | FromDiscord | <treeform> probably just a bug in nimble directory |
22:27:42 | FromDiscord | <treeform> I only do docs for a few authors |
22:54:04 | FromDiscord | <Patitotective> In reply to @treeform "here are docs https://nimdocs.com/nim-lang/irc/irc.": I didn't know that existed :O |
23:00:29 | FromDiscord | <eyecon> In reply to @Rainbow Asteroids "does anyone know how": Looks like it could be msg.member.permissions but I didn't test it |
23:00:37 | * | jmdaemon quit (Ping timeout: 240 seconds) |
23:01:19 | FromDiscord | <Rainbow Asteroids> Message.member.permissions leads to an empty set, no matter the author |
23:04:14 | FromDiscord | <eyecon> You might need to get permission for some actions, I think you specify them when inviting the bot with OAuth, and when setting up the bot you have to specify to use that permission |
23:04:27 | FromDiscord | <eyecon> But it is just a speculation, ping the author maybe |
23:06:01 | FromDiscord | <eyecon> They are called `Intents` apparently |
23:07:46 | FromDiscord | <eyecon> https://media.discordapp.net/attachments/371759389889003532/936759484632694824/unknown.png |
23:10:08 | * | jmdaemon joined #nim |
23:41:48 | * | mahlon joined #nim |
23:49:57 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3NP2 |
23:50:08 | FromDiscord | <Patitotective> (edit) "https://play.nim-lang.org/#ix=3NP4" => "https://play.nim-lang.org/#ix=3NP3" |
23:53:21 | anddam | howdy, is there a multi-platform nim desktop GUI framework, possibly using web rendering engine? |
23:53:37 | anddam | something akin to https://github.com/fschutt/azul that I stumbled upon and looks real nice |
23:55:56 | FromDiscord | <Elegantbeef> There are multiple of webview wrappers, not exactly what you're after i guess though |
23:58:04 | anddam | jeez I cannot tab-complete nick from discord… |
23:58:19 | FromDiscord | <Elegantbeef> Even worse is i'm not on discord 😛 |
23:59:55 | anddam | Elegantbeef: mostly I need (e.g. "would like") to write multi-platform win/mac/lin GUI app, possibly with a compact framework for the GUI and that is portable (or rather not platform-specific, hence the CSS / quasi-HTML request) |