<< 28-01-2022 >>

00:00:16FromDiscord<Elegantbeef> Did i already say that, yes
00:01:05FromDiscord<Patitotective> Is there any text editor developed in _Nim_?
00:01:29FromDiscord<Elegantbeef> There was https://github.com/nim-lang/Aporia
00:02:18FromDiscord<Elegantbeef> The Vscode extension by saem was ported to Nim so that means it's sorta 😛
00:04:02FromDiscord<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:12FromDiscord<Patitotective> (edit) "try some GUI libraries" => "practice"
00:06:21*jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in)
00:06:47FromDiscord<Elegantbeef> This is completely valid code https://play.nim-lang.org/#ix=3NJg if anyone is curious
00:07:26FromDiscord<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:12FromDiscord<Patitotective> Isn't `include` better for those cases? Or do I don't understand `include` yet? lol
00:08:19FromDiscord<Patitotective> (edit) removed "do"
00:10:40FromDiscord<Elegantbeef> Not really "Better"
00:11:03FromDiscord<Elegantbeef> Import is superior imo due to the fact it's an actual module, exporting matters
00:12:27FromDiscord<willyboar> In reply to @Patitotective "Is there any text": This also: https://github.com/fox0430/moe
00:16:52FromDiscord<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:04FromDiscord<Elegantbeef> I've had similar issues with Nico, generally caused by the palette
00:18:23FromDiscord<chronomatopoeia> Sorry, what is the palette?
00:18:37FromDiscord<chronomatopoeia> I'm a beginner
00:20:47FromDiscord<chronomatopoeia> For colors?
00:21:19FromDiscord<Elegantbeef> Doubt it, but it was a thing that happened prior
00:21:30FromDiscord<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:45FromDiscord<chronomatopoeia> Ah, that makes sense
00:22:36FromDiscord<chronomatopoeia> We had to choose some colors, perhaps that was custom after all
00:22:57FromDiscord<chronomatopoeia> for the action words
00:23:41FromDiscord<chronomatopoeia> That's a helpful place to start looking, thank you very much
00:23:59FromDiscord<Elegantbeef> Also the nico author did respond in gamedev 😀
00:24:23FromDiscord<chronomatopoeia> Ooops, I missed that, thanks!
00:37:25FromDiscord<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:14FromDiscord<sigkill> Anyone have a nice vim syntax highlighter for nim
01:11:20FromDiscord<sigkill> Can't find anything on GitHub
01:17:52*rlp10 quit (Ping timeout: 268 seconds)
01:17:55FromDiscord<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:01FromDiscord<sigkill> In reply to @Elegantbeef "There is one for": Link me? I can't find anything
01:37:55FromDiscord<Elegantbeef> https://github.com/alaviss/nim.nvim
01:42:13*marshall joined #nim
01:44:28FromDiscord<sigkill> I already have the LSP setup :// just wanted syntax highlighting ;-;
01:44:38FromDiscord<sigkill> Thanks for the suggestion though
01:44:56FromDiscord<Elegantbeef> > Semantic highlighting with nimsuggest
01:47:06FromDiscord<sigkill> I'm worried about this overriding my LSP mappings or running another instance if nimsuggest
01:47:19FromDiscord<sigkill> But I'll look over the syntax file and use it as a starting point
01:48:48FromDiscord<Rika> It is semantic highlighting. It depends on nimsuggest
01:54:59FromDiscord<sigkill> so it will use the same instance of nimsuggest as nvim-cmp?
01:59:21FromDiscord<sigkill> (i'm assuming lsp stuff requires nimsuggest running continually in the bg)
02:01:35FromDiscord<Rika> no it will no
02:01:37FromDiscord<Rika> (edit) "no" => "not"
02:02:17FromDiscord<leorize> @sigkill\: https://github.com/alaviss/nim.nvim/issues/49 \<- check this out
02:02:52FromDiscord<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:11FromDiscord<leorize> it doesn't support everything (which I intend to improve on later), but it seems to work
02:03:30FromDiscord<sigkill> In reply to @Rika "no it will not": im not sure which you mean
02:04:12FromDiscord<leorize> and no, nim.nvim will not share the nimsuggest instance with nimlsp
02:04:14FromDiscord<Rika> leorize is the creator (alaviss) so listen to him first
02:11:28arkanoidis there a wiki/blog/manual about software design patterns available/suggested for nim?
02:11:41arkanoidI'm looking for possible solutions to decouple code
02:12:12FromDiscord<Rika> In reply to @arkanoid "is there a wiki/blog/manual": hmm thats tricky ngl
02:12:26arkanoidngl?
02:12:44FromDiscord<sigkill> In reply to @leorize "<@629315306560684032>\: https://github.com/alaviss/": this is interesting - will let you know how i find it
02:12:49FromDiscord<sigkill> In reply to @arkanoid "ngl?": not gonna lie
02:13:01arkanoidk
02:13:48FromDiscord<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:05FromDiscord<Rika> or types that are dependent on each other go in some file
02:15:06arkanoidyes, I'm already doing that. All types in a single type block is something I've already realized by myself
02:15:28arkanoidwhat I'm trying to decouple is the dependency between two modules
02:16:11FromDiscord<Rika> hm wdym? doesnt forward declaration help with that?
02:17:14arkanoidcan't use forward declaration in my context, because I need to use finalizers (aka. new(result, myDestroyProc))
02:17:51arkanoidand also there's this little rule: "Error: type bound operation `myDestroyProc` can be defined only in the same module with its type"
02:17:56FromDiscord<Rika> never knew there was that context
02:18:15FromDiscord<Rika> do destructors not work for you?
02:18:43arkanoidso type + newType + destroyType needs to stay in same module
02:20:17*neurocyte0917090 quit (Ping timeout: 240 seconds)
02:23:10arkanoidRika, need to keep lib backward compatible for existing users, and it has been designed for refc + finalizers before =destroy and orc/arc
02:25:05arkanoidso 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:07arkanoidproblem 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:50FromDiscord<Elegantbeef> I dont know if that's true
02:30:13*marshall quit (Remote host closed the connection)
02:30:27arkanoidElegantbeef, what doesn't sound true to you?
02:30:49FromDiscord<Elegantbeef> The single large module
02:30:58*marshall joined #nim
02:31:00FromDiscord<Rika> your program is all just init + delete?
02:31:11FromDiscord<Rika> isnt the logic much larger than init + delete...
02:32:39*marshall quit (Remote host closed the connection)
02:32:55arkanoidbut you can't decouple. For example, this constructor: https://play.nim-lang.org/#ix=3NJJ
02:33:15*marshall joined #nim
02:33:49FromDiscord<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:04FromDiscord<Elegantbeef> I showed examples of how to do recursive imports without erroring
02:35:17arkanoid1) 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:22FromDiscord<Elegantbeef> Again the entirety of your program isnt intializers and destructors
02:37:21FromDiscord<Elegantbeef> Do you have a minimal example I can chew on?
02:38:47arkanoidElegantbeef: not minimal, but this "include all" design is driven by this limitation: https://github.com/filcuc/nimqml/blob/master/src/nimqml.nim
02:39:18arkanoidhere the constructors block, that gets included near the types: https://github.com/filcuc/nimqml/blob/master/src/nimqml/private/constructors.nim
02:39:25FromDiscord<Elegantbeef> Well i guess i'll take the time to remove the code smell be back in 3 hours
02:40:10arkanoidno, 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:08arkanoidI'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:43arkanoidpoint is that you can't use forward declarations on finalizers
02:43:41arkanoidbecause that works with refc, but silently fails with arc/orc: https://github.com/nim-lang/Nim/issues/19402
02:43:43FromDiscord<Elegantbeef> Sure but are they actually needed is my query
02:44:47*marshall quit (Remote host closed the connection)
02:45:05FromDiscord<Elegantbeef> This is such a large module it's going to be hard to investigate how to clean it up quickly
02:45:08arkanoidyou mean finalizers? yes they are, as constructors calls C code, and finalizers also calls C code
02:45:14FromDiscord<Elegantbeef> No
02:45:47arkanoid?
02:45:47FromDiscord<Elegantbeef> Are forward declarations needed
02:46:04FromDiscord<Elegantbeef> This is such a large module it's hard to easily grok how to supplant it into imports
02:47:46arkanoidI'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:56arkanoidif 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:27FromDiscord<Elegantbeef> Sure i'm not trying a single file
02:49:39FromDiscord<Elegantbeef> I'm attempting to split each type into a module
02:50:35*jmdaemon joined #nim
02:53:12arkanoidI 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:34arkanoidbefore 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:01arkanoidbut yet single types files, and include everything instead of import
03:04:54FromDiscord<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:58FromDiscord<noow> sent a code paste, see https://play.nim-lang.org/#ix=3NJS
03:23:07FromDiscord<noow> will Nim call destroy if one of MyType leaves the scope
03:23:12FromDiscord<noow> or other conditions where it would be GC'd
03:23:29FromDiscord<Elegantbeef> Depends on the memory management you usue
03:23:31FromDiscord<noow> arc
03:23:42FromDiscord<Elegantbeef> Well it should call the destructor on exit scope
03:24:00FromDiscord<noow> arc should be deterministic, right?
03:24:20FromDiscord<noow> two runs of the same software will collect garbage at the same moments with no randomness right
03:25:14FromDiscord<noow> also, do I have to specify `var` in the destructor?
03:25:30FromDiscord<noow> since destroying an object sounds like it is mutating the object, so my intuition says yes
03:26:01FromDiscord<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:51FromDiscord<Elegantbeef> Ah accidently imported one module to early, all going fine!
03:33:58*arkurious quit (Quit: Leaving)
03:58:49FromDiscord<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:56FromDiscord<Elegantbeef> any file that doesnt end with `s` isnt implemented
03:59:48FromDiscord<Elegantbeef> All types refactored are defined in their own file and only use imports
04:01:58FromDiscord<Elegantbeef> Hmm on second thought seems there are some issues with things aside from `Qobject`
04:17:45arkanoidElegantbeef, 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:31FromDiscord<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:55arkanoidyes, 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:20arkanoidElegantbeef, would you explain me this trick? https://github.com/beef331/nimqml/blob/000cf189bb6317fa0ed8343675bc7d137fbb6c49/src/nimqml/private/qvariants.nim#L16
04:37:54FromDiscord<Elegantbeef> Delayed imports 'can' let you get around recursive trees
04:38:27FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3NJg enables this for instance
04:40:18FromDiscord<Elegantbeef> There is still a cyclical dependancy issue with `qmetaobjects` so may have to merge `qobjects` with `qmetaobjects`
04:42:53arkanoiddamn, you know them all, you reached the same conclusion I made in 3 hours in 45 mins
04:43:16arkanoidand also I didn't know about delayed imports
04:43:47FromDiscord<Elegantbeef> Yea they're how you can get around recursive import problems until nim 2.0 😀
04:44:00FromDiscord<Elegantbeef> Nim2.0 will have a proper solution iirc
04:46:25FromDiscord<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:42arkanoidand here is where I've been ranting today
04:47:16arkanoidyes, the delayed imports is the missing item to keep the wheel spinning
04:47:22arkanoidI was basically helpless
04:47:45FromDiscord<Elegantbeef> Ah so you can see how large projects can be written in Nim? 😛
04:47:51FromDiscord<Rika> It was difficult to understand the situation without the code and most of us were unwilling to look
04:47:52arkanoidyet I've still to grok it, as I'm trying to use it right now as you but it's not clicking
04:48:06FromDiscord<Elegantbeef> Also i did give the delayed example earlier
04:48:27FromDiscord<Elegantbeef> I assume you didnt see it then 😀
04:49:32FromDiscord<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:00FromDiscord<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:36FromDiscord<Rika> I believe this is basically how it works
04:50:37FromDiscord<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:43FromDiscord<Rika> https://media.discordapp.net/attachments/371759389889003532/936483404214595645/IMG_0375.png
04:51:00FromDiscord<Elegantbeef> You're terminating imports when you do `import importingModule`
04:51:25FromDiscord<Elegantbeef> So in the small example `test1` gets all exported code up to `import test1`
04:53:23arkanoidElegantbeef, yeah I see you put import objects at the bottom of qmetaobjects
04:53:48FromDiscord<Rika> If you like images I don’t know https://media.discordapp.net/attachments/371759389889003532/936484181855334420/IMG_0376.png
04:54:04FromDiscord<Elegantbeef> It still causes an issue though which is why i think they need to merge
04:54:09arkanoidbut did it compile to you? it seems that's the show stopper, right?
04:54:11FromDiscord<Rika> Oh I missed another part
04:54:24FromDiscord<Elegantbeef> `qobjects` compiles but `qmetaobjects` does not
04:55:06arkanoidRika, I really appreciate it. I've printed the BW version to don't forget tomorrow where I've lost the day before
04:55:06FromDiscord<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:28FromDiscord<Rika> sorry the second image is wrong, i will fix it in a moment
04:55:35FromDiscord<Elegantbeef> But like `qabstractitemmodels` works
04:55:48arkanoidRika, don't worry, I got it
04:56:04FromDiscord<Rika> oh wait no i think its correct
04:56:10FromDiscord<Rika> im dum
04:56:12FromDiscord<Rika> hehe
04:57:36arkanoidso, 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:05FromDiscord<Elegantbeef> It does not always work but can get you quite far
04:58:09FromDiscord<Rika> now that i think about it this is messy xd
04:58:12FromDiscord<Rika> nim 2 when
04:58:35arkanoidthanks for your patience
04:58:41FromDiscord<Tetralux> 😄
04:59:23*kayabaNerve joined #nim
05:00:34FromDiscord<Elegantbeef> Yea look at my present commit
05:00:35FromDiscord<Elegantbeef> It should work
05:01:17*noeontheend quit (Ping timeout: 240 seconds)
05:03:35arkanoidElegantbeef, is the late declaration of qmetaobject types inside the new qobject file intended , or was just quick copypaste?
05:04:09FromDiscord<Elegantbeef> It was intended but compiling `qmetaobject` directly caused issues
05:04:17FromDiscord<Elegantbeef> So i moved them into a single module now
05:04:37FromDiscord<Elegantbeef> https://github.com/beef331/nimqml/commit/51cbb41579bc99ce3a8c5cec6a0ddd3b0a40cb43 most recent commit
05:05:00FromDiscord<Elegantbeef> Being somewhat lazy since i'm not authoring anything
05:08:35arkanoidk
05:22:03arkanoidStill 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:35FromDiscord<Elegantbeef> Did you forget to put the export marker?
05:22:53FromDiscord<Elegantbeef> You can always clone my repo and continue where i left off
05:23:30arkanoidsure, 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:08FromDiscord<Elegantbeef> Hmm guess i have more import issues
05:27:20FromDiscord<Elegantbeef> So perhaps this is going to end with many files in a single file
05:29:21FromDiscord<Elegantbeef> Gotta try compiling every file now
05:30:45arkanoidthat'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:57arkanoidhell happens in me head when two modules requires each other
05:31:16arkanoidI understand your example, is this complex context that is returning errors nowhere helpful
05:31:18FromDiscord<Elegantbeef> Yea my solution for qvariants was to move stuff to the bottom
05:32:49FromDiscord<Elegantbeef> My workflow was to make all the modules i need for a specific file, hit an error then rearrange
05:38:08FromDiscord<Elegantbeef> oh hell ya all my wrapped files are capable of being compiled independantly
05:38:55FromDiscord<Elegantbeef> You really need to have a good grasp of the import system
05:39:13FromDiscord<Elegantbeef> Cause the same rule applies to nested imports
05:39:33FromDiscord<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:19FromDiscord<Elegantbeef> https://github.com/beef331/nimqml/commit/7647f7640bf6102dc307cf96946cac97f373d412#diff-c6c2128ca66fecdd36b62ceb7df04b22f743c4afec5a041456b6b28756d8aa99R169-R183 which is why i do this
05:41:03FromDiscord<Elegantbeef> I dont think this is needed since these files are never going to be main
05:42:30arkanoidyeah, 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:59FromDiscord<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:47FromDiscord<Elegantbeef> But hey after this adventure you'll be an import god
05:45:35arkanoidwell, I DESERVE THIS KNOWLEDGE
05:45:38arkanoidsorry
05:46:07arkanoidbut I've been over this way too long, and I want to reduce the problem
05:47:16FromDiscord<Elegantbeef> lol
05:47:36arkanoidso, 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:56FromDiscord<Elegantbeef> Yes
05:48:10FromDiscord<Elegantbeef> Actually i might be wrong
05:48:26FromDiscord<Elegantbeef> The small example shows that's wrong
05:48:33arkanoidok, so it's a system of levers, tubes and pressure and valves that requires an equilibrium
05:49:09arkanoidoh dear, the only rule I got out of this is already crumbling down
05:49:32FromDiscord<Elegantbeef> Ok so let's look at the small example
05:49:59arkanoidyou mean test.nim and test1.nim?
05:50:21FromDiscord<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:42FromDiscord<Elegantbeef> We now import all symbols exported inside `test1` so we pickup `doThing`
05:51:02FromDiscord<Elegantbeef> i mean "We're `test`"
05:51:51FromDiscord<Elegantbeef> So when you import a module you get all exported symbols between the start and first cycle
05:52:04FromDiscord<Elegantbeef> In our small example that cycle is easy to see since it's two files
05:52:31FromDiscord<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:49FromDiscord<Elegantbeef> Which is why import at the top doesnt work since it creates a cycle without any new symbols
05:52:55FromDiscord<Rika> your procs are never exiting
05:53:05FromDiscord<Elegantbeef> You have recursive procedures calls
05:53:12FromDiscord<Rika> outside -> tick -> tock(inside tick) -> tick(inside tock)
05:53:12FromDiscord<Elegantbeef> if you build with debug it should hit the stack limit
05:53:14FromDiscord<Rika> etc
05:53:26FromDiscord<Rika> you never finish the first tick printer call thats global
05:53:52FromDiscord<BhamidipatiNikhil> In reply to @Rika "etc": Oh yes, you are right! Thanks Rika
05:54:04FromDiscord<BhamidipatiNikhil> 🙂
05:54:06FromDiscord<Elegantbeef> Thought the bots were going to have to explain how while worked 😀
05:54:34arkanoidso 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:41FromDiscord<Elegantbeef> Yea
05:55:02FromDiscord<Elegantbeef> Might be best to play with a bunch of small modules and make them depend on eachother to grok that
05:55:41arkanoidI 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:19arkanoidactually, 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:41arkanoidI mean, I'm trying to visualize it
06:01:17arkanoidand 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:36FromDiscord<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:31arkanoidI see from your site you do/did Unity
06:04:12arkanoidbeen game dev for years, too. With unity mostly, but not only
06:04:41FromDiscord<Elegantbeef> I'm a pretend game dev 😛
06:04:46FromDiscord<Elegantbeef> Just like i'm a pretend programmer
06:05:24FromDiscord<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:27arkanoidwell, the most capable one I've ever met used to say exactly that, everyday, while writing AI code with linq
06:05:57FromDiscord<Elegantbeef> Using linq for AI is ungodly
06:05:59arkanoidactually I was trying to send you a beer or something
06:06:06FromDiscord<Elegantbeef> But yea i learned programming with Unity, then moved to Nim a few years ago
06:06:17FromDiscord<Elegantbeef> I dont have anything setup for donations or the like
06:06:47arkanoidthink about it! I've been helpful, and the beer I skipped today for ranting with nim is well deserved
06:06:54FromDiscord<Elegantbeef> I did recently start working on my game written in pure nim the otherday
06:07:04arkanoids/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:21arkanoidwhich engine, may I ask?
06:07:26FromDiscord<Elegantbeef> Yea i know evoalg also has wanted to send me a small gift
06:07:28FromDiscord<Elegantbeef> My own framework
06:07:45arkanoidcool! opengl/vulkan?
06:07:53FromDiscord<evoalg> indeed
06:07:57FromDiscord<Elegantbeef> opengl + sdl2 + assimp
06:08:11FromDiscord<Elegantbeef> It looks purdy thanks to my technical art skills
06:08:18arkanoidI did my little game engine too back in the days. But was objective-c
06:08:26FromDiscord<Elegantbeef> https://streamable.com/vlp8mi
06:08:47FromDiscord<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:00FromDiscord<Rika> why dont u just drink a beer with the man damnit
06:09:10FromDiscord<Elegantbeef> I dont drink
06:09:21FromDiscord<Rika> damn are you really a programmer if you dont drink
06:09:31FromDiscord<Rika> im joking fyi
06:09:32FromDiscord<Elegantbeef> Probably not
06:09:40FromDiscord<Rika> i feel like someones gonna fucking maul me if i didnt say that
06:09:44FromDiscord<Elegantbeef> No i dont do drugs either
06:09:54FromDiscord<evoalg> at least you're not a vegetarian
06:10:06FromDiscord<Elegantbeef> I'm the sterotypically the least fun person
06:10:25arkanoidsure, when I say beer, what I really mean is beer
06:10:31FromDiscord<Rika> the only thing you got going for ya is your self deprecation it seems
06:10:34arkanoidI mean, whatever you like
06:10:56FromDiscord<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:58arkanoidis it possible to dislike beer, yes, but it's de-facto something nice
06:11:07FromDiscord<Rika> what is \b?
06:11:41FromDiscord<BhamidipatiNikhil> Backspace https://media.discordapp.net/attachments/371759389889003532/936503779174526976/unknown.png
06:11:46FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3NKe
06:11:53arkanoidI really like the transparency effect and the shadows! is it fragshader I guess
06:12:11FromDiscord<BhamidipatiNikhil> sent a code paste, see https://paste.rs/OQp
06:12:17FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/HlR
06:12:25FromDiscord<Elegantbeef> Yea it's all frag shader magic
06:12:29FromDiscord<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:19arkanoidnah, this is nicer
06:13:49FromDiscord<Elegantbeef> Yea was going to say it fits the style more
06:13:53arkanoidsaid 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:14FromDiscord<Elegantbeef> Buh bye, have fun!
06:14:39arkanoidthanks again beef!
06:14:41FromDiscord<BhamidipatiNikhil> Good bot!! Thanks @ElegantBeef https://media.discordapp.net/attachments/371759389889003532/936504538532290600/unknown.png
06:15:00FromDiscord<Elegantbeef> No problem the both of you
06:16:55FromDiscord<Rika> beef i wish i had the amount of free time you had lmfao
06:17:15FromDiscord<Elegantbeef> Sure but i'm also perpetually useless
06:17:57FromDiscord<Elegantbeef> You're getting edumacated
06:22:06FromDiscord<Elegantbeef> Like i mean i have all this free time and havent done anything 😛
06:25:26FromDiscord<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:25FromDiscord<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:54FromDiscord<Elegantbeef> Inim is probably the best repl
06:56:55FromDiscord<Rika> inim is probably the most battletested so far
06:57:13FromDiscord<Rika> even if its just gone to a single sortie compared to other things in other languages 😛
06:58:20FromDiscord<BhamidipatiNikhil> Thanks @Rika ... I believe i am learning better practising interactively! https://media.discordapp.net/attachments/371759389889003532/936515517764763648/unknown.png
06:58:54FromDiscord<Rika> didnt beef tell you first lmao
06:59:13FromDiscord<Elegantbeef> I'm a bot beep boooop booooooooooooop
06:59:39FromDiscord<Rika> me too, my heart rate monitor makes these cool beeps too
06:59:55FromDiscord<BhamidipatiNikhil> Thanks @ElegantBeef 😌
06:59:59FromDiscord<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:18FromDiscord<Rika> this is a joke, i am fine
07:00:20FromDiscord<Elegantbeef> Yea you're supposed to have qrs waves but i only have the q
07:01:16FromDiscord<Elegantbeef> Yea i was joking aswell rika is fine
07:12:30*jjido joined #nim
07:16:56FromDiscord<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:19FromDiscord<Rika> i shall dissolve into the background then
07:19:43*rienske quit (Quit: WeeChat 3.4)
07:20:21FromDiscord<evoalg> You've certainly been helpful Rika ...
07:20:29FromDiscord<eyecon> In reply to @sigkill "Anyone have a nice": https://github.com/zah/nim.vim - a Nim plugin for vim
07:20:39FromDiscord<evoalg> beefy has more time
07:20:44FromDiscord<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:24FromDiscord<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:21FromDiscord<Elegantbeef> `uint`s are unchecked
09:49:05FromDiscord<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:49FromDiscord<Elegantbeef> uints underflow more than ints
09:49:57FromDiscord<Rika> Because uints are commonly used for modulo arithmetic
09:50:28FromDiscord<Elegantbeef> I'm tired and i should shush 😀
09:51:20FromDiscord<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:33FromDiscord<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:56FromDiscord<Elegantbeef> Except the manual explicitly states it
09:52:18FromDiscord<Elegantbeef> It's not even disabling it's just that uints are commonly used when you want wrapping
09:52:25FromDiscord<Elegantbeef> So there are no checks
09:52:49FromDiscord<Elegantbeef> you can always do `0..255` if you want it checked
09:53:08FromDiscord<Rika> In reply to @xx_ns "I still think disabling": You can argue that and it is a good point
09:53:17FromDiscord<Rika> But it can’t be changed for now
09:54:49FromDiscord<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:22FromDiscord<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:57FromDiscord<Rika> Well there is but not for the common dev
09:56:01FromDiscord<Michal Maršálek> Intuitively, only ints are approximations of integers. uintx behave as integers modulo 2^x instead.
09:56:10FromDiscord<Rika> What?
09:57:19FromDiscord<Rika> But yes my point is that some pretty large group of programmers commonly use uints for modulo arithmetic
09:57:29FromDiscord<Goel> sent a code paste, see https://play.nim-lang.org/#ix=3NKV
09:57:37FromDiscord<Rika> And I believe that Araq kept it because of that
09:57:49FromDiscord<Goel> (edit) "https://play.nim-lang.org/#ix=3NKV" => "https://play.nim-lang.org/#ix=3NKW"
09:58:02FromDiscord<Rika> In reply to @Goel "Also something i noticed": Normal for floating point representation
09:58:21FromDiscord<Rika> https://0.30000000000000004.com/
09:59:22FromDiscord<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:53FromDiscord<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:16FromDiscord<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:23FromDiscord<Rika> But yeah for now we can’t change it
10:00:26FromDiscord<Rika> Because breaking change
10:00:41FromDiscord<mratsim> In reply to @Goel "Why only for `int`'s": because uint are defined everywhere as wrapping around after max.
10:02:06FromDiscord<Rika> In reply to @mratsim "because uint are defined": Sure, but is it good design
10:02:27FromDiscord<mratsim> It's expected and familiar to people coming from system languages.
10:02:59FromDiscord<Rika> But we aren’t just catering to them
10:03:04FromDiscord<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:04FromDiscord<mratsim> if you want checks you can use int, which will prevent underflows. or range[0..255]
10:03:07FromDiscord<Rika> We’re trying to cater to everyone
10:03:12FromDiscord<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:26FromDiscord<mratsim> In reply to @Rika "We’re trying to cater": for everyone with have ints.
10:03:50FromDiscord<mratsim> basically use ints for safety, common use. Use uint if you need low-level.
10:04:06*jjido joined #nim
10:04:12FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3NL0
10:04:35FromDiscord<Rika> Then there’s an educational issue here
10:04:42FromDiscord<mratsim> as always, docs ...
10:04:49FromDiscord<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:24FromDiscord<mratsim> I did some for our auditors: https://nimbus.guide/auditors-book/02.2_stack_ref_ptr_types.html#numerical-types
10:05:28FromDiscord<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:55FromDiscord<mratsim> but C devs expect no checks at all?
10:06:01FromDiscord<xx_ns> yes?
10:06:05FromDiscord<xx_ns> that is known for C
10:06:06FromDiscord<Elegantbeef> https://nim-lang.org/docs/tut1.html#basic-types-integers
10:06:17FromDiscord<xx_ns> Nim specifically advertises having overrun checks
10:06:32FromDiscord<xx_ns> so when those magically disappear for some primitives, it is a hidden surprise
10:06:34FromDiscord<xx_ns> which is bad language desing
10:06:44FromDiscord<xx_ns> (edit) "desing" => "design"
10:06:44FromDiscord<mratsim> I think it's bad docs
10:06:53FromDiscord<Rika> Eh I mean you lose checks if you use ptr which is a primitive
10:06:56FromDiscord<Rika> It’s bad docs
10:07:08FromDiscord<Elegantbeef> It's not hidden it's documented in the official tutorial and in the manual
10:07:20FromDiscord<xx_ns> if it's not hidden, why is there a person in here asking about it?
10:07:25FromDiscord<xx_ns> this person represents your average developer
10:07:29FromDiscord<mratsim> bad discoverability then?
10:07:32FromDiscord<xx_ns> imagine if he didn't accidentally stumble upon this behaviour
10:07:40FromDiscord<xx_ns> he wouldn't've even known to expect it
10:07:52FromDiscord<mratsim> that's why you write tests.
10:08:06FromDiscord<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:07FromDiscord<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:38FromDiscord<Michal Maršálek> (edit) "use for." => "used for rather than just the bitpatterns."
10:08:42FromDiscord<Rika> In reply to @Michal58 "Nim is more abstract": Sure, the same is true for ints
10:08:48FromDiscord<Elegantbeef> I think the question is "how are they learning"
10:08:53FromDiscord<Elegantbeef> Goel what are you using to learn?
10:08:58FromDiscord<Goel> sent a long message, see http://ix.io/3NL4
10:09:58FromDiscord<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:59FromDiscord<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:11FromDiscord<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:38FromDiscord<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:52FromDiscord<Michal Maršálek> So I think the best solution is to explicitly state that in the docs/tutorial, which is iirc done.
10:11:02FromDiscord<Rika> Not sufficiently I will say
10:11:04FromDiscord<mratsim> length, iterators and everything else in the stdlib use `int`
10:11:11FromDiscord<mratsim> not uint
10:11:20FromDiscord<Rika> In reply to @mratsim "length, iterators and everything": A beginner would not understand or pick up on why
10:11:36FromDiscord<Michal Maršálek> In reply to @Rika "Why isn’t it reflected": Good point
10:11:41FromDiscord<mratsim> but then they wouldn't use uint, there is no incentive if they stay in the stdlib world to use uint
10:12:00FromDiscord<Elegantbeef> Well i'll go for the ol' classic and say "PRs welcome" 😀
10:12:10FromDiscord<mratsim> RFCs welcome: like this https://github.com/nim-lang/RFCs/issues/175
10:12:11FromDiscord<Rika> In reply to @mratsim "but then they wouldn't": Sorry my brain literally didn’t understand this please explain ;;
10:12:27FromDiscord<mratsim> In reply to @Rika "Sorry my brain literally": A beginner has no reason to use uint in Nim
10:12:50FromDiscord<mratsim> are there even proc that returns uint except say parseUint?
10:13:02FromDiscord<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:14FromDiscord<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:37FromDiscord<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:34FromDiscord<mratsim> In reply to @xx_ns "Most developers know of": and they know that they wrap around.
10:16:09FromDiscord<xx_ns> sure
10:16:14FromDiscord<xx_ns> which they think they're protected against
10:16:17FromDiscord<xx_ns> because _checks_
10:16:20FromDiscord<Elegantbeef> I think the docs can be more explicit, but you can only lead a cow to water
10:17:04FromDiscord<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:13FromDiscord<mratsim> people coming from say, Python or JS would use int
10:17:36FromDiscord<Goel> sent a code paste, see https://play.nim-lang.org/#ix=3NL9
10:17:51FromDiscord<Elegantbeef> `x div y`
10:17:58FromDiscord<mratsim> In reply to @Goel "Also, why this is": because / is for exact division while `div` is for euclidean division.
10:18:02FromDiscord<Rika> Use div because / is ALWAYS float division
10:18:16FromDiscord<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:18FromDiscord<Rika> I think it’s one of the better design choices
10:19:31FromDiscord<Michal Maršálek> (edit) "feature." => "feature (like / op for example)."
10:22:45*haakon_ is now known as haakon
10:27:32FromDiscord<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:21FromDiscord<xx_ns> uints are not a _feature_
10:28:22FromDiscord<xx_ns> sent a long message, see http://ix.io/3NLf
10:28:24FromDiscord<xx_ns> uints are a primitive
10:28:28FromDiscord<xx_ns> checks are a _feature_
10:28:41FromDiscord<Rika> Pointers are a primitive
10:28:43FromDiscord<xx_ns> that are for no good reason dropped for some primitives
10:29:20FromDiscord<Rika> What is a “primitive” in Nim anyway? It’s really fuzzy for Nim compared to other languages
10:30:26FromDiscord<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:29FromDiscord<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:58FromDiscord<mratsim> Nim by default use ints everywhere, and range types will work with proc that use int
10:31:18FromDiscord<mratsim> if they use uint, they need to cast everywhere, basically they are on their own.
10:31:28FromDiscord<mratsim> (edit) "cast" => "convert (checked)"
10:31:30FromDiscord<Elegantbeef> Well we could also make a `suints` package, but still need to get people there
10:31:36FromDiscord<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:47FromDiscord<Rika> In reply to @Elegantbeef "Well we could also": Signed unsigned integers
10:32:08FromDiscord<Elegantbeef> I think builtin is a better term than "primitive" in Nim but idk
10:32:21FromDiscord<Rika> Someone needs to expose the saturated arithmetic some time, might be useful for someone somewhere
10:32:48FromDiscord<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:49FromDiscord<Rika> In reply to @Rika "Signed unsigned integers": Super user integers 🧐
10:32:52FromDiscord<mratsim> Also in many system language applications (VM/lang, cryptography) you need the raw uint logic that maps to the hardware.
10:33:48FromDiscord<mratsim> you can't have the beginner devs dictate and make things difficult for programs that needs those pristine uint primitives.
10:34:06FromDiscord<mratsim> Nim achieves a balance right now with checked signed and unchecked unsigned
10:34:17FromDiscord<mratsim> yes we can improve docs and their discoverability
10:34:18FromDiscord<xx_ns> then you shouldn't be advertising uints to beginner devs?
10:34:23FromDiscord<mratsim> we don't?
10:34:39FromDiscord<Rika> We shouldn’t and I don’t know if we do but if we do we shouldn’t
10:34:41FromDiscord<xx_ns> it's literally one of the first things you're told in the nim guide?
10:35:04FromDiscord<mratsim> and it should be aid that they are not checked just beside.
10:35:04FromDiscord<Rika> That needs to be fixed then I guess
10:35:11FromDiscord<mratsim> (edit) "aid" => "said"
10:38:35FromDiscord<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:54FromDiscord<xx_ns> for example https://nim-by-example.github.io/primitives/
10:38:57FromDiscord<Elegantbeef> Or the third they forget to mention it
10:39:04FromDiscord<Rika> You mean aware and think everyone else is aware?
10:39:23FromDiscord<Rika> Beef rushing to revise his posts
10:39:50FromDiscord<Elegantbeef> I dont have any intros to Nim posts
10:39:51FromDiscord<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:07FromDiscord<Rika> Yes pretty much
10:40:10FromDiscord<Rika> If not a PR an issue
10:40:45FromDiscord<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:01FromDiscord<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:06FromDiscord<Rika> Most people don’t think of making a cookbook
10:41:20FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3NLh
10:41:29FromDiscord<Rika> What does the s mean !?!
10:41:36FromDiscord<Elegantbeef> safe
10:41:38FromDiscord<Rika> Sintered? SChecked??
10:41:54FromDiscord<mratsim> also in that example "unsigned" isn't even explained in terms of integer size or positive only.
10:42:34FromDiscord<xx_ns> it is?
10:42:38FromDiscord<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:50FromDiscord<xx_ns> oh
10:42:50FromDiscord<mratsim> > unsigned integers are similar with u prepended to the type
10:42:52FromDiscord<xx_ns> wait
10:43:00FromDiscord<mratsim> that doesn't explain what unsigned entails.
10:44:53FromDiscord<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:01FromDiscord<Goel> sent a long message, see https://paste.rs/kV8
10:59:13FromDiscord<Goel> (edit) "http://ix.io/3NLm" => "http://ix.io/3NLn"
10:59:29FromDiscord<Rika> int64
11:00:13FromDiscord<Goel> That's not what i'm talking, i mean `x: int` or `f: float`
11:00:52FromDiscord<Rika> I don’t get your issue
11:01:29FromDiscord<Rika> Trouble? You have checks now, what’s the difference from using a uint aside from that?
11:02:54FromDiscord<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:36FromDiscord<Rika> That’s not what he means, he means use ints over uints and that includes 8,16,32,64s
11:03:51FromDiscord<Goel> Oh ok then
11:04:27FromDiscord<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:52FromDiscord<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:27FromDiscord<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:54FromDiscord<mratsim> In reply to @Goel "But once again, why": do you know how to deal with underflows?
11:16:03FromDiscord<mratsim> if no, use int
11:16:13FromDiscord<mratsim> or range types if you want to restrict
11:16:18FromDiscord<mratsim> say range[0..255]
11:16:50FromDiscord<mratsim> if at one point you are tempted to use `if a < b -1` you shouldn't use uint.
11:16:56FromDiscord<mratsim> (edit) "-1`" => "- 1`"
11:18:26FromDiscord<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:10FromDiscord<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:12FromDiscord<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:53FromDiscord<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:18FromDiscord<mratsim> many bugs in C and C++ are due to comparing unsigned numbers
11:27:44FromDiscord<haolian9 (高浩亮)> it turns out that i used `let` to declare the variable; but the error message is hard to read though
11:28:15Amun-Raand many bugs in C and C++ are due to silent unsigned wrapping as the result of arithmetical operations
11:29:04FromDiscord<cybardev> In reply to @BhamidipatiNikhil "Interesting that parseInt() is": That's true for most (if not all) languages, no?
11:29:08Amun-Rawrapping as in wrapping around
11:30:18FromDiscord<BhamidipatiNikhil> In reply to @Vindaar "that's because `parseInt()` is": Yes, understood... Thx @Vindaar
11:30:25FromDiscord<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:46FromDiscord<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:06FromDiscord<evoalg> In reply to @BhamidipatiNikhil "Interesting that parseInt() is": mapIt works with parseInt() ... https://play.nim-lang.org/#ix=3NLu
11:36:15FromDiscord<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:55FromDiscord<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:49FromDiscord<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:12FromDiscord<mratsim> In reply to @Amun-Ra "and many bugs in": which is why Nim uses signed by default
11:50:22Amun-Rayupe
11:50:59FromDiscord<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:15FromDiscord<evoalg> ah yea ... I never know how to say things clearly
11:56:39FromDiscord<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:55PMunchHmm, 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:15PMunchWould make it soooo much easier to build other documentation tools
12:09:15PMunchI'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:32PMunchIt's almost there though
12:09:50NimEventerNew thread by Severak: How to find bottlenecks?, see https://forum.nim-lang.org/t/8850
12:24:57Nuc1eoNHey 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:14Nuc1eoNdo you guys know all the nim file extensions?
12:28:54*jmdaemon quit (Ping timeout: 250 seconds)
12:32:28FromDiscord<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:01FromDiscord<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:29FromDiscord<haxscramper> nim syntax is only in `.nim` files
12:46:03FromDiscord<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:42Nuc1eoNthank u
13:01:51Nuc1eoNIt is implemented
13:08:03*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
13:22:16*drewr joined #nim
13:37:47PMunch@haxscramper, Nim syntax is in .nim, .nims, and .nimble
13:38:13PMunchAlthough .nimble is a bit special
13:38:30FromDiscord<Patitotective> Does `nimble` support cli scripts or entry points? like _pip_?
13:38:38FromDiscord<Patitotective> (edit) "`nimble`" => "_nimble_"
13:38:53PMunchHmm, by using jsondoc and packages/docutils/highlite I'm able to get some kind of thing working
13:39:00PMunch@Patitotective, yup
13:39:04FromDiscord<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:26PMunchBut you say they are only in .nim files
13:39:33PMunchBut it is in .nims and .nimble as well
13:39:37FromDiscord<haxscramper> nim star
13:39:45FromDiscord<Patitotective> In reply to @PMunch "<@762008715162419261>, yup": Hmm, how? I couldn't find it on _nimble_'s repository hehe
13:39:45FromDiscord<haxscramper> the irc bridge broke my message
13:39:47FromDiscord<Patitotective> (edit) "hehe" => ":p"
13:39:55FromDiscord<haxscramper> you just don't the the full correct message
13:40:01FromDiscord<haxscramper> (edit) "the" => "see"
13:40:39PMunch@Patitotective, look for `tasks` in the Nimble documentation
13:40:58PMunch@haxscramper, aah, yes the bridge isn't super happy with *
13:41:10PMunchI think it always try to make them bold indicators or something like that
13:48:54PMunchI 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:33FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3NMa
14:38:30FromDiscord<Patitotective> (edit) "https://play.nim-lang.org/#ix=3NMa" => "https://play.nim-lang.org/#ix=3NMb"
14:42:43FromDiscord<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:05FromDiscord<mratsim> then parsing will assign them roles, like assigning a value.
14:44:00FromDiscord<Patitotective> Hmmmm Ok
14:44:02FromDiscord<Patitotective> thanks
14:44:04FromDiscord<Patitotective> 🙃
14:48:58*jjido joined #nim
15:01:12FromDiscord<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:53FromDiscord<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:40FromDiscord<haxscramper> Generally nodes can be kept as a case objects, you can set their type on construction
15:05:11FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3NMu
15:06:16FromDiscord<gerwy> yes im actually looking at rstast module for reference hah
15:07:26FromDiscord<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:54FromDiscord<haxscramper> `node = TNode(kind: nkInt, intVal: <some value>)`
15:08:03FromDiscord<haxscramper> Or `node.intVal = <some value>`
15:08:32FromDiscord<gerwy> yeah but if would assign string to `node.intVal` it would be an error
15:08:50FromDiscord<gerwy> so i would need to check everytime for type of token
15:08:56FromDiscord<gerwy> (edit) "everytime" => "every time"
15:09:14FromDiscord<haxscramper> well, I assume that assinging string to an integer is indeed an error
15:09:42FromDiscord<haxscramper> what is the use case? you create new node from the token and assign it somewhere
15:09:51FromDiscord<gerwy> im making AST out of Token list
15:09:52FromDiscord<haxscramper> or what
15:10:20FromDiscord<haxscramper> In reply to @Life Sucks "im making AST out": how exactly? Handwritten recursive descend with `case` on the token kinds?
15:10:48FromDiscord<haxscramper> `of tokenKindInt: resultNode = TNode(kind: nkInt, intVal: token.intVal`
15:11:19FromDiscord<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:59FromDiscord<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:01FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3NMy
15:12:06FromDiscord<haxscramper> create new node, assigning value from a token
15:12:09FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3NMz
15:12:31FromDiscord<haxscramper> sent a code paste, see https://paste.rs/fcO
15:12:46FromDiscord<haxscramper> or the way @Patitotective suggested, I just don't like in-place argument mutation for constructing datra
15:12:47FromDiscord<Patitotective> In reply to @Life Sucks "Oh nice Patito i": hehe yea, this seems to have no end
15:12:48FromDiscord<haxscramper> (edit) "datra" => "data"
15:13:06FromDiscord<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:48FromDiscord<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:42FromDiscord<haxscramper> all parsers except LR are recursive
15:15:49FromDiscord<haxscramper> well, all sane parsers that you start with
15:16:04FromDiscord<haxscramper> recursive descent in all variations is recursive becase the AST itself is recursive
15:16:47FromDiscord<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:39FromDiscord<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:42NimEventerNew thread by Planetis: Html2karax first release!, see https://forum.nim-lang.org/t/8851
15:19:02FromDiscord<Patitotective> In reply to @Patitotective "So, for example `"hello"`": Or can I say it is a string already?
15:19:10FromDiscord<Patitotective> (edit) "already?" => "and a raw string in the lexer?"
15:29:59FromDiscord<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:25FromDiscord<Forest> Anyone know how I'd pass an argument to the linker in the Nims file?
15:44:47FromDiscord<Forest> Also how would i check if something isn't defined?
15:45:27FromDiscord<Forest> Would `if not defined(DEF)` work?
15:46:43FromDiscord<Phil> I actually have never tinkered with the nims file, so apologies, can't really help there
15:46:55FromDiscord<Forest> Fair enough, thanks aha
15:49:23*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
15:49:27FromDiscord<auxym> `--passL:-yourarghere`
15:49:46FromDiscord<Forest> I need to do it via the nims file
15:50:09FromDiscord<auxym> https://github.com/auxym/nim-on-samd21/blob/e7e8c3b993fca3e2ca3ebe9ff430959c73075149/config.nims#L55
15:50:36FromDiscord<Forest> Yeah i just realized that Nim has a macro for it xD
15:50:39FromDiscord<Forest> Thanks!
15:58:49FromDiscord<eyecon> In reply to @auxym "Something like that. I": What beautiful typography
15:59:37FromDiscord<auxym> Yes! hand drawn illustrations too: https://journal.stuffwithstuff.com/2020/04/05/crafting-crafting-interpreters/
15:59:44FromDiscord<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:40FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3NMW
16:07:23termer_Is there any type definition I can use that represents any type of integer
16:07:44termer_if there isn't one, is there a way to define such a type?
16:08:31FromDiscord<enthus1ast> the next sqlite release will have JSON build in natively!
16:08:32FromDiscord<enthus1ast> https://www.sqlite.org/draft/releaselog/current.html
16:09:04FromDiscord<enthus1ast> image.png https://media.discordapp.net/attachments/371759389889003532/936654116841746432/image.png
16:09:48FromDiscord<Phil> sqlite is one of those insanely wonderful technologies
16:10:07FromDiscord<Phil> I just does so much so well for so little
16:15:10FromDiscord<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:15FromDiscord<ajusa> Is there a way to async create a folder or do fs operations other than writing?
16:35:48Zevvno
16:40:16FromDiscord<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:45FromDiscord<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:16FromDiscord<Shiba> (edit) "variables\modules" => "variables|modules"
16:41:50Zevvajusa: 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:05FromDiscord<ajusa> Gotcha, thanks for clarifying!
16:44:03FromDiscord<Phil> Man, if only donating to open source devs counted as charity donations
16:44:51FromDiscord<Shiba> In reply to @Isofruit "Man, if only donating": vim?
16:44:51*vicfred joined #nim
16:45:20FromDiscord<Phil> You mean if I donate to vim devs?
16:46:27*vicfred_ joined #nim
16:46:28FromDiscord<Shiba> yes https://media.discordapp.net/attachments/371759389889003532/936663527849095188/Capture.PNG
16:48:13FromDiscord<Shiba> In reply to @Isofruit "You mean if I": no , https://media.discordapp.net/attachments/371759389889003532/936663972722122822/Capture.PNG
16:48:49FromDiscord<Shiba> even their license called uganda.txt
16:48:54FromDiscord<Shiba> (edit) "even their license ... called" added "is"
16:48:57*vicfred quit (Ping timeout: 240 seconds)
16:50:43FromDiscord<Phil> As I do not, and have never intentionally, use vim, I do not donate specifically to charity towards children in Uganda.
16:51:11FromDiscord<Phil> Might've stumbled over that sooner if I did.
16:57:51FromDiscord<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:37FromDiscord<Waldecir Santos> Does nim have a trim function and what is the best way to search this kind of things ?
17:01:54FromDiscord<Rika> trim what exactly
17:02:23FromDiscord<Waldecir Santos> sorry spaces at the end of a string
17:02:27FromDiscord<leorize> \`strip()\`
17:02:29FromDiscord<Rika> https://nim-lang.org/docs/strutils.html#strip%2Cstring%2Cset%5Bchar%5D
17:02:30*xet7 joined #nim
17:02:30FromDiscord<leorize> in strutils
17:02:33FromDiscord<Rika> end only?
17:02:42FromDiscord<Waldecir Santos> Correct end only
17:02:56FromDiscord<Rika> `trailing = true` too in strip
17:03:06FromDiscord<planetis> Bookmark this\: https://nim-lang.github.io/Nim/theindex.html
17:03:14FromDiscord<Waldecir Santos> Man I was on that page and couldn't find it i need new glasses, thank you
17:17:31FromDiscord<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:30FromDiscord<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:13FromDiscord<IsaacPaul> I would lean toward using unsigned. Developer intent is more clear.
17:25:32FromDiscord<IsaacPaul> but int is easier 'to deal with'
17:41:43*vicfred_ quit (Quit: Leaving)
18:00:50FromDiscord<elo88> this is normal or nimsuggest has leak? https://media.discordapp.net/attachments/371759389889003532/936682245442387998/unknown.png
18:03:09FromDiscord<konsumlamm> both probably
18:10:29l1xhi folks, is there a TLS lib that I can use in a HTTP server in Nim?
18:12:52FromDiscord<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:49FromDiscord<konsumlamm> In reply to @mratsim "Hardware integers are mod": but wouldn't those bugs be caught if underflow was checked?
18:18:27FromDiscord<mratsim> In reply to @konsumlamm "but wouldn't those bugs": so use `range[0..255]`
18:19:22FromDiscord<konsumlamm> my point is that your arguments against uints are about hoe they're currently implemented, and not uints in general
18:19:26FromDiscord<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:46FromDiscord<mratsim> uint in Nim maps to the hardware.
18:20:03FromDiscord<mratsim> they are implemented like uints (and ints) are in the CPU.
18:20:04FromDiscord<konsumlamm> because unsigned ints in C++ are bad, not unsigned ints in general
18:20:48FromDiscord<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:14FromDiscord<mratsim> In Nim, there is Natural if you want to express positive only integers.
18:22:20FromDiscord<mratsim> or range type.
18:22:34FromDiscord<mratsim> Ada does it too. And they also have unsigned integers.
18:28:51FromDiscord<konsumlamm> In reply to @mratsim "why do you want": because they're the intuitive type for values that are never negative
18:29:26NimEventerNew 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:59FromDiscord<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:54FromDiscord<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:37FromDiscord<mratsim> people coming from high-level languages never had the unsigned vs signed distinction, they use int, = no problem.
18:43:19FromDiscord<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:29FromDiscord<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:06FromDiscord<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:24FromDiscord<demotomohiro> Then, we have to add another `uint` type or operators with range check.
19:07:35FromDiscord<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:37FromDiscord<Forest> Doesn't format use `fmt""`?
19:10:58FromDiscord<Forest> `&` is for concatenation last i checked
19:11:20FromDiscord<Waldecir Santos> You can check it here https://nim-lang.org/docs/strformat.html
19:11:21FromDiscord<demotomohiro> There is both `&` and `fmt` strformat
19:11:37FromDiscord<Forest> Huh never knew that
19:12:07FromDiscord<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:49FromDiscord<demotomohiro> strformat define `&` as unary operator. Binary `&` for concatenation.
19:13:01FromDiscord<Forest> Ah okay
19:14:31FromDiscord<Forest> `&"Text\n"` looks more aesthetically pleasing to me tbh
19:15:14FromDiscord<demotomohiro> strformat module added relatively recenty in Nim and I guess author thought using `f` is too
19:15:23FromDiscord<demotomohiro> Short?
19:16:26FromDiscord<Forest> Just the fact that stuff isn't automatically escaped and requiring me to use another way to use \n and stuff
19:19:01FromDiscord<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:45FromDiscord<demotomohiro> But &"foo\n" is not. You can use escape sequence.
19:22:03FromDiscord<Waldecir Santos> Yeah I still to nim, my question is more about why `&` guess we will never know 😦
19:22:09FromDiscord<Waldecir Santos> (edit) "Yeah I still ... to" added "new"
19:22:24*Gustavo6046 joined #nim
19:22:58FromDiscord<demotomohiro> !eval import strformat; echo &"foo\tbar"; echo fmt"foo\tbar"
19:23:01NimBotfoo bar↵foo\tbar
19:23:16FromDiscord<Phil> ~~I would throw money at getting python's f-strings just because I'm lazy~~
19:23:17FromDiscord<Rika> letters and touching string literal -> raw
19:23:22*Gustavo6046 quit (Remote host closed the connection)
19:23:31FromDiscord<Rika> & is already the equiv. of f strings
19:23:33FromDiscord<Phil> (edit) "f-strings" => "f-string-syntax"
19:23:50*Gustavo6046 joined #nim
19:25:14FromDiscord<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:17FromDiscord<Waldecir Santos> Maybe git history have a explanation about it, I'll check later
19:25:31FromDiscord<Waldecir Santos> In reply to @demotomohiro "You might check `git": exactly, thank you
19:32:05FromDiscord<Patitotective> https://github.com/nim-lang/Nim/blame/6b3bdd798d235a465d94ebedbc784d6b41057798/lib/pure/strformat.nim#L17
19:33:14FromDiscord<demotomohiro> I found a first pull request to add strformat: https://github.com/nim-lang/Nim/pull/6507
19:40:22FromDiscord<Waldecir Santos> Wow it used to be `%` and it changed to `&` here https://github.com/nim-lang/Nim/commit/9a60eae631e9f778d3920f3a66de0e726e687eef
19:41:35FromDiscord<Phil> I am an imbecile! How have I missed the existance of strformat for so long!
19:41:46FromDiscord<Waldecir Santos> No explanation given just a `fixes #7078`
19:43:09FromDiscord<Waldecir Santos> there we go:
19:43:18FromDiscord<Waldecir Santos> sent a code paste, see https://play.nim-lang.org/#ix=3NO1
19:43:27FromDiscord<Phil> Down with & for string concat! here comes the "{myvars}".fmt !
19:44:07FromDiscord<Waldecir Santos> If you guys want to check the discussion: https://github.com/nim-lang/Nim/issues/7078
19:44:58FromDiscord<Waldecir Santos> That was the explanation I was looking for, thank you guys.
19:45:01FromDiscord<Waldecir Santos> sent a code paste, see https://play.nim-lang.org/#ix=
19:48:24FromDiscord<Phil> I'm honestly never ever going to use "&", that is mentally set as string concat operator
19:48:55FromDiscord<Phil> The most readable way that has the least amount of gotcha on it really seems to be "your formatted string".fmt
19:49:29FromDiscord<Phil> (edit) ""&"," => ""&" for formatting,"
19:53:34FromDiscord<Waldecir Santos> why `"your formatted string".fmt` and not `fmt"your formatted string"` ?
19:56:08FromDiscord<Phil> sent a long message, see http://ix.io/3NO3
19:57:01FromDiscord<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:51FromDiscord<demotomohiro> !eval import strformat; echo fmt"foo\tbar"; echo fmt "foo\tbar"
19:57:53NimBotfoo\tbar↵foo bar
20:06:02*vicecea quit (Remote host closed the connection)
20:06:32*vicecea joined #nim
20:07:08FromDiscord<Phil> hmmmmm
20:07:22FromDiscord<Phil> True, I could make use of nim's "bracket-less" form of calling a proc
20:07:29FromDiscord<Phil> Which... sidequestion, where did nim get that from?
20:08:49FromDiscord<Phil> this entire `a.len()` equals `a.len` equals `len a` thing I mean
20:14:02Zevvit's called "method call syntax": https://nim-lang.org/docs/manual.html#procedures-method-call-syntax
20:14:33Zevvsometimes called UFCS
20:14:37Zevvuniform function call syntax
20:17:06ZevvD does it, rust does it. Even C++ would like to do it.
20:18:10FromDiscord<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:58FromDiscord<lakmatiol> sent a code paste, see https://play.nim-lang.org/#ix=3NOh
20:46:13FromDiscord<lakmatiol> https://media.discordapp.net/attachments/371759389889003532/936723863138607146/unknown.png
20:47:13FromDiscord<xx_ns> @lakmatiol wait, I know you...
20:47:15FromDiscord<xx_ns> pydis?
20:47:54FromDiscord<lakmatiol> ye, I spend a lot of time on pydis
20:49:40FromDiscord<Elegantbeef> newlining `ref object` is one issue
20:49:40FromDiscord<Elegantbeef> but there is another issue
20:50:02FromDiscord<Elegantbeef> That issue is a compiler bug causing a seg fault
20:53:11FromDiscord<Elegantbeef> Ah seems `SomeInteger` works so `enum` causes the segfault
20:53:20FromDiscord<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:22FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3NOm
20:53:39FromDiscord<noow> is there a `when danger:` or something
20:53:50FromDiscord<Elegantbeef> `when defined(danger)`
20:53:58FromDiscord<noow> ah ok thank
21:06:39*neceve quit (Read error: Connection reset by peer)
21:14:06FromDiscord<mratsim> In reply to @Waldecir Santos "Can some one explain": because nim string formatting predates Python
21:14:33FromDiscord<Elegantbeef> Also Nim isnt python 😛
21:18:35*jmdaemon joined #nim
21:19:18FromDiscord<xx_ns> it's fairly easy to get nim to do f-string style formatting as well
21:19:26FromDiscord<xx_ns> power of metaprogramming baby
21:24:10FromDiscord<Waldecir Santos> Yeah my question is more about why `&` that's all
21:24:19FromDiscord<Waldecir Santos> (edit) "is" => "was"
21:24:56FromDiscord<Elegantbeef> well there is `fmt` aswell
21:28:10FromDiscord<dom96> !eval import strformat; echo fmt"foo\tbar"; echo &"foo\tbar"
21:28:13NimBotfoo\tbar↵foo bar
21:28:19FromDiscord<dom96> that's why
21:28:56FromDiscord<Patitotective> `!eval` should support fenced code blocks
21:29:08FromDiscord<Elegantbeef> It's on IRC so it cannot support much
21:29:28FromDiscord<dom96> PRs welcome 😄
21:34:09FromDiscord<Patitotective> !eval↵echo "hello"↵echo "world"
21:35:16FromDiscord<Patitotective> There is no a bot-test channel?
21:42:25FromDiscord<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:44FromDiscord<Patitotective> I mean, an actual website
21:43:44FromDiscord<Patitotective> (edit) "a PR adding" => "an issue/PR to add"
21:50:56*mahlon quit (Ping timeout: 250 seconds)
22:02:21FromDiscord<Patitotective> https://github.com/nim-lang/irc/pull/24
22:02:23FromDiscord<Patitotective> 🙃
22:13:07FromDiscord<Rainbow Asteroids> does anyone know how to get the channel permissions of an author of a message in dimscord?
22:19:45FromDiscord<dom96> generated docs don't belong inside the repo
22:22:48*jjido joined #nim
22:24:37FromDiscord<treeform> In reply to @Patitotective "I'm trying to understand": here are docs https://nimdocs.com/nim-lang/irc/irc.html 🙂
22:26:43FromDiscord<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:20FromDiscord<treeform> probably just a bug in nimble directory
22:27:42FromDiscord<treeform> I only do docs for a few authors
22:54:04FromDiscord<Patitotective> In reply to @treeform "here are docs https://nimdocs.com/nim-lang/irc/irc.": I didn't know that existed :O
23:00:29FromDiscord<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:19FromDiscord<Rainbow Asteroids> Message.member.permissions leads to an empty set, no matter the author
23:04:14FromDiscord<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:27FromDiscord<eyecon> But it is just a speculation, ping the author maybe
23:06:01FromDiscord<eyecon> They are called `Intents` apparently
23:07:46FromDiscord<eyecon> https://media.discordapp.net/attachments/371759389889003532/936759484632694824/unknown.png
23:10:08*jmdaemon joined #nim
23:41:48*mahlon joined #nim
23:49:57FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3NP2
23:50:08FromDiscord<Patitotective> (edit) "https://play.nim-lang.org/#ix=3NP4" => "https://play.nim-lang.org/#ix=3NP3"
23:53:21anddamhowdy, is there a multi-platform nim desktop GUI framework, possibly using web rendering engine?
23:53:37anddamsomething akin to https://github.com/fschutt/azul that I stumbled upon and looks real nice
23:55:56FromDiscord<Elegantbeef> There are multiple of webview wrappers, not exactly what you're after i guess though
23:58:04anddamjeez I cannot tab-complete nick from discord…
23:58:19FromDiscord<Elegantbeef> Even worse is i'm not on discord 😛
23:59:55anddamElegantbeef: 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)