00:00:02 | FromDiscord | <Chronos [She/Her]> We definitely prefer using Visual Studio Code or IntelliJ for Java, I can say that much |
00:00:06 | FromDiscord | <Elegantbeef> Writing code on a phone is like sanding using a handful of sand |
00:00:38 | skulk | sometimes I run terminal emacs over ssh on my phone and push a quick fix to something when I'm on the go |
00:00:38 | FromDiscord | <Chronos [She/Her]> But pain from sitting for too long just makes it impossible to code for a while and currently have no PC with me |
00:01:20 | skulk | but only to prove to myself that I can do it |
00:01:33 | FromDiscord | <Elegantbeef> Hey you don't have to tell me you have problems you're in the Nim real time chat |
00:02:04 | skulk | lol |
00:11:09 | FromDiscord | <Chronos [She/Her]> Hm I'm wondering how would I handle the order of text insertion and deletion... Maybe instead of doing the index with the highest edits first, I could instead create a history of text insertions and deletions, and carry them out? |
00:12:29 | FromDiscord | <Chronos [She/Her]> Bit streams don't have a way to insert text I don't think so that would require me to create copies of text again- |
00:12:34 | FromDiscord | <Chronos [She/Her]> Of entire lines |
00:13:00 | FromDiscord | <Chronos [She/Her]> Maybe ropes will be the best way to do this but sigh |
00:13:05 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/u1i7B |
00:14:05 | FromDiscord | <Elegantbeef> You have to write the file from the lowest edit to the end whenever you save |
00:14:16 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4CGa |
00:14:35 | FromDiscord | <Chronos [She/Her]> In reply to @Elegantbeef "You have to write": Yep, so it'd follow everything in order |
00:14:42 | FromDiscord | <Elegantbeef> Right, but I mean how many people are modifying files of gigabytes in size? |
00:15:19 | FromDiscord | <Elegantbeef> 99% of files can be loaded in memory no problem realistically, not that you actually need to |
00:16:07 | FromDiscord | <Elegantbeef> Or store a diff in a file and apply it like kate does 😄 |
00:16:07 | FromDiscord | <Elegantbeef> You can async write to a buffer file then move it to where your actual file is when it's done |
00:21:39 | FromDiscord | <Chronos [She/Her]> That's definitely an idea... But yeah I'm overthinking waaay too much, for now I'll just do what you said |
00:21:55 | FromDiscord | <Chronos [She/Her]> Ropes will be beneficial here then I guess if I'm working on strings in memory |
00:22:15 | FromDiscord | <Elegantbeef> I should say I have never written a text editor or looked into how to write one, so don't blame me when it's an awful API |
00:22:53 | FromDiscord | <Chronos [She/Her]> Lol it'll be fineee |
00:25:28 | FromDiscord | <Chronos [She/Her]> Ah... Ropes don't have anything for `insert`, nothing for splitting directly either, so I'm probably gonna need to do something like `var a, b = (myRope[0..cursorPos], [cursorPos..^1])` |
00:25:45 | FromDiscord | <Chronos [She/Her]> ...if that's even supported sigh |
00:26:05 | FromDiscord | <Chronos [She/Her]> And it isn't! Fucking dandy! |
00:28:10 | FromDiscord | <Chronos [She/Her]> For reading the entire line at the start it's not too much of an issue, but when I'm applying edits further down, it defeats the point if I need to make a string for every single new change |
00:28:22 | FromDiscord | <Chronos [She/Her]> Which means I may just need to use strings |
00:28:25 | FromDiscord | <Chronos [She/Her]> Sigh. |
00:29:37 | FromDiscord | <that_dude.> Without much thought put into it, would there be something wrong with linked lists? |
00:29:51 | FromDiscord | <Chronos [She/Her]> Wdym? |
00:30:36 | FromDiscord | <that_dude.> sent a code paste, see https://paste.rs/36NFF |
00:30:40 | FromDiscord | <that_dude.> oops didn't mean to send whatever that is |
00:30:46 | FromDiscord | <Chronos [She/Her]> Lol |
00:31:00 | FromDiscord | <Chronos [She/Her]> What are you trying to do exactly? |
00:31:09 | FromDiscord | <Chronos [She/Her]> I'd imagine using Nim seqs would be better |
00:31:21 | FromDiscord | <that_dude.> Well I'd say it depends on what you want to optimize |
00:31:54 | FromDiscord | <Chronos [She/Her]> Wait are you responding to my cries of pain or? |
00:32:05 | FromDiscord | <that_dude.> imo linked lists let you add or remove lines in O(1) while a seq/table lets you modify in O(1), I'm not too sure what a tree calculates too |
00:32:30 | FromDiscord | <that_dude.> Yeah, just lightly looked at you mentioning data types to hold the text |
00:33:26 | FromDiscord | <that_dude.> In reply to @yu.vitaqua.fer.chronos "Wait are you responding": Yeah I was sorry that it seemed a bit out of the blue lol |
00:34:16 | FromDiscord | <Chronos [She/Her]> Nah that's fine lol, was immensely confused at first lol |
00:35:43 | FromDiscord | <Chronos [She/Her]> In reply to @that_dude. "imo linked lists let": The issue is more so modifying the existing text since I'm not storing the entire file in memory, just the lines that are being edited, the painful issue that I'm having is the fact that when editing larger files and doing many large edits, there's no way to reasonably split ropes to allow for insertion of text |
00:35:47 | FromDiscord | <Chronos [She/Her]> But oh well |
00:37:34 | FromDiscord | <that_dude.> Ah f. I'm still not too sure about how ropes works, but linked lists can make it easy to load/unload lines of text |
00:37:35 | FromDiscord | <Chronos [She/Her]> Reason why ropes would be beneficial is because I could be doing many large operations at once too |
00:37:36 | FromDiscord | <that_dude.> Gl |
00:37:45 | FromDiscord | <Chronos [She/Her]> Thanks lol, appreciate the help! |
00:38:01 | FromDiscord | <Elegantbeef> ropes are practically linked lists |
00:38:10 | FromDiscord | <Elegantbeef> They're a concatenation graph really |
00:38:19 | FromDiscord | <that_dude.> Ah I assumed ropes are a tree |
00:38:30 | FromDiscord | <Elegantbeef> That's the basic principle |
00:38:34 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/s2zxM |
00:39:14 | FromDiscord | <Chronos [She/Her]> Hm... Trying to think of an idea for how I'd split ropes |
00:39:41 | FromDiscord | <Elegantbeef> You cannot with the present api cause they're not split able until it's turned into a string |
00:40:05 | FromDiscord | <Chronos [She/Her]> Even when I traverse the rope myself? |
00:40:12 | FromDiscord | <Chronos [She/Her]> Though |
00:40:16 | FromDiscord | <Chronos [She/Her]> Actually yeah you're right |
00:40:17 | FromDiscord | <Chronos [She/Her]> Sigh |
00:40:21 | FromDiscord | <Elegantbeef> I mean you have to remake the entire rope tree |
00:40:34 | FromDiscord | <Elegantbeef> It's easier to just use `string` and likely better |
00:40:47 | FromDiscord | <Elegantbeef> helpful usage of `sink` and `openArray[char]` and you'll likely be fine |
00:40:54 | FromDiscord | <Elegantbeef> healthy\ |
00:40:56 | FromDiscord | <Chronos [She/Her]> In reply to @Elegantbeef "It's easier to just": Yeah, will just do that |
00:41:09 | FromDiscord | <Chronos [She/Her]> What does sink do, actually? Never really used it |
00:41:18 | FromDiscord | <Elegantbeef> Someone did make the `std/unciode` work with `openArray` |
00:41:22 | FromDiscord | <Elegantbeef> sink moves memory |
00:41:38 | FromDiscord | <Chronos [She/Her]> In reply to @Elegantbeef "*Someone* did make the": Oh? Oh shit yeah unicode... Pain, I need to support that too don't I |
00:41:47 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4CGf |
00:42:03 | FromDiscord | <Elegantbeef> Luckily std/unicode supports `openArray[char]` |
00:42:22 | FromDiscord | <Elegantbeef> 0 cost unicode slices and similar |
00:43:30 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4CGg |
00:43:50 | FromDiscord | <Chronos [She/Her]> In reply to @Elegantbeef "Luckily std/unicode supports `openArray[char]`": Epic :> Tho that may be an issue for me to handle when editing text |
00:43:51 | FromDiscord | <Elegantbeef> Well it doesnt copy \ assuming you do not make the compiler do an implicit copy to pass to the procedure |
00:44:29 | FromDiscord | <Chronos [She/Her]> Because obviously I have to iterate over characters to allow people to scroll through them which means I have to have code to handle that too |
00:44:32 | FromDiscord | <Chronos [She/Her]> Pain but oh well |
00:45:29 | FromDiscord | <Elegantbeef> On the plus side you can use `replace` for replacing and removing |
00:52:08 | FromDiscord | <Chronos [She/Her]> Replacing and removing? How? |
00:53:37 | FromDiscord | <Chronos [She/Her]> Also even for replacement I wouldn't be able to, since a user may only want to replace a few occurrences of a string |
00:53:53 | FromDiscord | <Chronos [She/Her]> So that'd just be deletion and insertion edits |
01:49:17 | FromDiscord | <Prestige> Are there issues using concepts with inheritance? I have a code example but can't get the playground to open |
01:49:25 | FromDiscord | <Prestige> sent a code paste, see https://play.nim-lang.org/#ix=4CGt |
01:49:50 | FromDiscord | <Prestige> I was thinking maybe I can't have a seq[Updatable] since it's not a real type |
01:57:24 | FromDiscord | <konsumlamm> you can have it, but all elements have the same type, it's like an implicit generic `[T: Updatable]` and then `seq[T]` i think |
02:04:24 | FromDiscord | <Prestige> ah, I see. Maybe I'll have to rework this idea then |
02:53:29 | FromDiscord | <.kanaxa> In reply to @isofruit "Anyway, in JS basically": I can’t remember what package it was but the first time I had a node module for some project, I didn’t realize how much space it ate, and I accidentally committed a 300+ mb node module folder to a repo |
02:53:43 | FromDiscord | <.kanaxa> It was infuriating to say the least |
02:54:18 | FromDiscord | <.kanaxa> And shocking, first time I discovered of the indecent dependency chains common in the JS world |
02:55:13 | FromDiscord | <.kanaxa> In comparison Nim scares me with just how small its binaries are, I keep thinking that I must be doing something wrong |
02:55:28 | FromDiscord | <Elegantbeef> You are! |
02:56:09 | FromDiscord | <.kanaxa> And then i realize I’m not even doing a release build yet and it could get even _smaller_ |
02:56:47 | FromDiscord | <.kanaxa> In reply to @Elegantbeef "You are!": Ahahahaha |
03:08:54 | FromDiscord | <.kanaxa> In reply to @Elegantbeef "Go use illwill or": Oh wow thanks for the recommend! Was looking for TUI libraries, didn’t know which ones were community-recommended, these look great |
03:15:20 | * | rockcavera quit (Remote host closed the connection) |
03:18:45 | FromDiscord | <.kanaxa> What are open source projects in Nim that have good code and practices to study/learn from? |
03:19:18 | FromDiscord | <.kanaxa> I’d appreciate having a few to look at and glean the habits of the Nim language and community |
03:20:21 | FromDiscord | <Elegantbeef> https://nimble.directory/ 😄 |
03:27:08 | FromDiscord | <.kanaxa> In reply to @yu.vitaqua.fer.chronos "Hey y'all, how hard": Not sure if you've seen this one, but it's a guide to building a text editor in C: https://viewsourcecode.org/snaptoken/kilo/↵↵May be helpful for your studies |
03:27:19 | FromDiscord | <.kanaxa> It's one of the things I'm planning to study as well, just to see how someone does it |
03:27:51 | FromDiscord | <Chronos [She/Her]> In reply to @.kanaxa "Not sure if you've": Hm, thanks! Will keep it in mind! |
03:30:06 | FromDiscord | <.kanaxa> In reply to @Elegantbeef "https://nimble.directory/ 😄": In your view what's a project with good source code to study? |
03:30:21 | FromDiscord | <Elegantbeef> No clue I havent really looked at other people's code |
04:20:33 | * | lucasta quit (Quit: Leaving) |
05:05:39 | FromDiscord | <Phil> Really depends on what you're looking for.↵The thing with nim's flexibility is that you'll find some vastly different code-styles |
05:06:55 | FromDiscord | <odexine> its pretty much up to you to decide what you think is good, no? |
05:07:05 | FromDiscord | <odexine> there's always status' guidelines if you want a base |
05:07:20 | FromDiscord | <Elegantbeef> You're empirically wrong if you do not code like me |
05:07:23 | FromDiscord | <Phil> I mean there's some stuff I think we all agree on which is that avoiding mutable state is good generally |
05:07:36 | FromDiscord | <Phil> (edit) "I mean there's some stuff I think we all agree on which is that avoiding mutable state ... is" added "and variables" |
05:07:41 | FromDiscord | <Phil> But that's such a broad statement |
05:07:49 | FromDiscord | <Phil> (edit) "But that's such a broad statement ... " added "that it borders on useless" |
05:08:58 | FromDiscord | <Phil> I would claim my codebases are pretty nicely setup, but that's solely my opinion, beef would violently disagree with that for example given the way I name things |
05:09:54 | FromDiscord | <odexine> how do you name things |
05:10:11 | FromDiscord | <Elegantbeef> poorly |
05:10:15 | FromDiscord | <odexine> if you put the type on the name you're immediately disqualified |
05:10:18 | FromDiscord | <Phil> `CharacterRepository` |
05:10:41 | FromDiscord | <Elegantbeef> Java level naming |
05:10:42 | FromDiscord | <Phil> Well no, that I don't do |
05:12:04 | FromDiscord | <odexine> i am not too sure on my opinion of that |
05:12:26 | FromDiscord | <Phil> 🤷 ↵I'm nowhere near as bad in my opinion, but I do have a dislike for abbreviations such as "str" etc in my code |
05:13:08 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4CGT |
05:13:11 | FromDiscord | <Phil> Which invariably leads to longer names compared to ↵`var constrStmt = nnkObjConstr.newTree(retT)` |
05:13:20 | FromDiscord | <Phil> If you care that little about the string you might as well name it x |
05:13:29 | FromDiscord | <emanresu3> maybe the nim standard library?↵(@.kanaxa) |
05:13:29 | FromDiscord | <Phil> If that string has meaning, it deserves a propper name |
05:13:34 | FromDiscord | <Elegantbeef> Lol |
05:13:44 | FromDiscord | <odexine> imean |
05:13:47 | FromDiscord | <odexine> (edit) "imean" => "i mean" |
05:14:13 | FromDiscord | <odexine> what meaning does a string have when you're implementing a `concat` proc that concatenates two strings |
05:14:27 | FromDiscord | <odexine> other than `a` and `b` what name would be more appropriate? |
05:14:34 | FromDiscord | <Elegantbeef> `left, right: string` 😛 |
05:15:10 | FromDiscord | <Phil> `first, second: string` |
05:15:36 | FromDiscord | <Phil> Ah yeah, and that's another thing, I'm not all that into the `parameters share an assignment`thing, so I'd also write `first: string, second: string` |
05:15:49 | FromDiscord | <Elegantbeef> Wow you're really writing bad code |
05:16:05 | FromDiscord | <Elegantbeef> If I change a type I now need to replace more instances of it! |
05:16:16 | FromDiscord | <odexine> well |
05:16:22 | FromDiscord | <Elegantbeef> Think about the git diff! |
05:16:23 | FromDiscord | <Phil> That literally has nothing to do with writing bad code beef. |
05:16:26 | FromDiscord | <odexine> sometimes the parameter types being the same have no relation with each other |
05:16:43 | FromDiscord | <odexine> if they do have a relation i would keep them shared |
05:16:46 | FromDiscord | <odexine> if they dont i would separate them |
05:17:05 | FromDiscord | <Phil> That's actually a good nuanced take on that, if the parameter types are coupled, group assignment is a good way to express that |
05:17:12 | FromDiscord | <Phil> Hmmm |
05:18:23 | FromDiscord | <Phil> I'll ponder this a bit whether I'll integrate that idea going forward, I like the expressiveness argument a lot |
05:18:28 | FromDiscord | <odexine> lol |
05:18:36 | FromDiscord | <odexine> i convinced phil wow |
05:18:38 | FromDiscord | <odexine> well |
05:18:39 | FromDiscord | <odexine> not yet |
05:22:32 | * | advesperacit joined #nim |
05:44:21 | FromDiscord | <Prestige> sent a code paste, see https://play.nim-lang.org/#ix=4CGX |
05:45:31 | FromDiscord | <Elegantbeef> Stop using the concept and just use `seq[Node]` |
05:46:07 | FromDiscord | <Prestige> Well I don't want just that, I want the user to be able to provide any object with an update function so it can be updated per frame |
05:47:25 | FromDiscord | <odexine> That wouldn’t work because sequences are still heterogeneous on the concrete type no? |
05:47:42 | FromDiscord | <odexine> Concepts are not concrete |
05:47:52 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4CH0 |
05:49:32 | * | kenran joined #nim |
05:50:48 | FromDiscord | <Prestige> hmm that's interesting |
05:52:53 | FromDiscord | <Prestige> But then everything must extend Box so that's kind of the same problem I guess |
05:53:11 | FromDiscord | <Elegantbeef> No it doesnt |
05:53:17 | FromDiscord | <Prestige> just another layer of inheritance and not really caring about the concept |
05:53:21 | FromDiscord | <Prestige> oh? |
05:55:07 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4CH2 |
05:58:20 | FromDiscord | <Prestige> 🤔 |
05:58:42 | FromDiscord | <Elegantbeef> You should also store a `updataProc: pointer` |
05:59:22 | FromDiscord | <Prestige> at this point I'm thinking of just have a seq of function pointers |
06:00:45 | FromDiscord | <Elegantbeef> Don't see how that solves the problem |
06:08:20 | FromDiscord | <Prestige> Trying to figure out how I need to type it. But basically if I had a seq of a tuple (object pointer, function pointer) I could iterate over it and call the function by passing the object pointer to it (I think) |
06:10:38 | FromDiscord | <Elegantbeef> What about dangling pointers? |
06:11:25 | FromDiscord | <Prestige> Just another problem created that has to be solved |
06:12:40 | FromDiscord | <Elegantbeef> The box api seems like best solution if you ask me |
06:13:56 | FromDiscord | <Prestige> I wish the playground was working |
06:15:16 | FromDiscord | <Prestige> the box solution seems like overkill creating a new object just to wrap the existing ref object just to invoke its update function, idk |
06:15:49 | FromDiscord | <Elegantbeef> You're the one that wants arbitrarily stored objects |
06:16:15 | FromDiscord | <Elegantbeef> If you're going to force ref you could use `RootRef` |
06:16:21 | FromDiscord | <Prestige> aren't ref objects just pointers under the hood? can't we store an array of pointers? |
06:16:53 | FromDiscord | <Phil> Out of curiosity, how do you plan on figuring out what type is associated with that pointer when using that array of pointers later? |
06:17:33 | FromDiscord | <Phil> Because if you plan on having a fixed order of types then you might as well just have a tuple that enshrines that order |
06:17:37 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/hBM16 |
06:17:54 | FromDiscord | <Phil> (edit) "Because if you plan on having a fixed order of types ... then" added "(which could be a way)" |
06:17:58 | FromDiscord | <Elegantbeef> Actually that doesnt work |
06:18:35 | FromDiscord | <Phil> Ah method call syntax means you don't necessarily need to know the type, hmm |
06:18:40 | FromDiscord | <Elegantbeef> There is a solution that'll work but I'm destracted |
06:18:56 | FromDiscord | <Elegantbeef> distracted even |
06:26:55 | * | PMunch joined #nim |
06:40:55 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4CH8 |
06:41:11 | * | ntat joined #nim |
06:41:13 | FromDiscord | <Elegantbeef> Shit I had a cast in there I'm a failure |
06:41:38 | FromDiscord | <Elegantbeef> !/s/cast[T]/T |
06:43:12 | FromDiscord | <Elegantbeef> Probably should also be `RootRef(u)` inside the concept instead of `u is ref` |
06:44:40 | FromDiscord | <Elegantbeef> If you want to add more procs and reduce the overhead you can use make a Vtable manually and dispatch it all |
06:45:19 | FromDiscord | <Prestige> This is crazy |
06:45:22 | FromDiscord | <Prestige> ty |
06:51:21 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/Kjw56 |
06:51:34 | FromDiscord | <Elegantbeef> We have completely remade dynamic dispatch using vtables for limited procedures! |
06:52:11 | FromDiscord | <Phil> So basically dynamic dispatch but for concepts is a thing now? Time to make a package you guys 😛 |
06:52:26 | FromDiscord | <Elegantbeef> Don't tell traitor or iface that |
06:52:49 | FromDiscord | <Phil> Oh wow, you're so damn far ahead of me you literally already implemented it? |
06:53:04 | FromDiscord | <Elegantbeef> Is this apart of the joke still? |
06:53:40 | FromDiscord | <Phil> It wasn't, that was actually me being "Oh wow, you've already done this?" |
06:53:48 | FromDiscord | <Elegantbeef> https://github.com/beef331/traitor |
06:53:56 | FromDiscord | <Elegantbeef> No clue how usable it truly is |
06:54:06 | FromDiscord | <Phil> Keep in mind I only skimmed through the code you posted as well as skimmed with the roughest of looks over traitor |
06:54:08 | FromDiscord | <Elegantbeef> It worked in small demos and I never made anything more on it |
06:54:26 | FromDiscord | <Phil> And I have the tendency to gloss over the bits I don't understand |
06:54:38 | FromDiscord | <Elegantbeef> Traitor forces implementation of a concept and allows you to box to underlying types |
06:55:01 | FromDiscord | <Phil> Type-interfaces basically |
06:55:04 | FromDiscord | <Elegantbeef> Though due to how I do it, it adds yet another pointer indirection to refs |
06:55:56 | FromDiscord | <Phil> Actually, while I'm quite fancying the idea of module interfaces, I maybe should play around with type-interfaces a bit more as that is more flexible |
06:56:32 | FromDiscord | <Phil> Insist on types having certain abilities in the contexts they're being called instead of modules being forced to provide certain procs |
06:56:59 | FromDiscord | <Elegantbeef> In Nim yes you should do type based |
06:57:02 | FromDiscord | <Phil> Let's add that to the bucket list |
06:57:30 | FromDiscord | <Elegantbeef> Even if you want to have pluggable modules just force a `proc init(_: typedesc[T]): T` |
06:57:44 | FromDiscord | <Elegantbeef> Cause generally you want state on things |
06:58:01 | FromDiscord | <Elegantbeef> I learned that from my GUI you need to have a generic state object |
06:59:06 | FromDiscord | <Elegantbeef> But I also went full bore "Make gooey as reusable as possible, I do not care if you want to use vectors that are actually 2 bits" |
06:59:19 | FromDiscord | <Elegantbeef> I say that but it assumes they're float32 |
07:27:38 | * | azimut quit (Ping timeout: 240 seconds) |
07:59:05 | FromDiscord | <dissolved.girl> I'm a bit out of the loop. Can someone explain to me, in short, what concepts are and what they're useful for? Thank you! |
07:59:43 | FromDiscord | <dissolved.girl> It seems like a way of specifying generic types that must conform to some specifications? |
08:04:10 | FromDiscord | <ratogbm> (I am programming Turing machine) how do I program this:↵` var tape: ref seq[int] = ref newSeq[int](settings.tape_size)` |
08:04:21 | FromDiscord | <ratogbm> Currently it gives an error |
08:04:21 | FromDiscord | <demotomohiro> https://nim-lang.org/docs/manual_experimental.html#concepts |
08:05:58 | FromDiscord | <ratogbm> In reply to @demotomohiro "https://nim-lang.org/docs/manual_experimental.html#": I have no clue what I am looking at... Or was it not for me? |
08:06:02 | PMunch | `var tape = new seq[int]; tape[].setLen(settings.tape_size)` I believe |
08:06:26 | PMunch | ratogbm, that was for the person before you who asked about concepts |
08:06:26 | FromDiscord | <.kanaxa> In reply to @emanresu3 "maybe the nim standard": I've been going through the entirety of it, it's really great, but was looking more for great third-party projects to also learn from, especially in relation to a complete application rather than just libraries |
08:06:47 | PMunch | ratogbm, my reply was for you. But why do you need a ref seq? |
08:07:03 | FromDiscord | <dissolved.girl> In reply to @demotomohiro "https://nim-lang.org/docs/manual_experimental.html#": Yes, I've read this, but I'm having a hard time wrapping my head around why I would use this or what it's useful for. |
08:07:12 | FromDiscord | <ratogbm> In reply to @PMunch "<@720535934025596929>, my reply was": Because I am punching it into functions which have to modify it. |
08:07:25 | FromDiscord | <ratogbm> (edit) "punching" => "sending" | "into" => "to" |
08:10:10 | FromDiscord | <demotomohiro> In reply to @ratogbm "I have no clue": It is reply to @dissolved.girl |
08:12:03 | FromDiscord | <demotomohiro> In reply to @dissolved.girl "Yes, I've read this,": Concept is some kind of typeclass:↵https://nim-lang.org/docs/manual.html#generics |
08:13:34 | FromDiscord | <demotomohiro> So when you define generics, you can define it so that it takes only types that has specific procs. |
08:14:53 | FromDiscord | <.kanaxa> In reply to @dissolved.girl "Yes, I've read this,": I got this from Nim in Action - to my understanding, they function a bit like protocols from Swift https://media.discordapp.net/attachments/371759389889003532/1138022439201275985/image.png |
08:15:03 | FromDiscord | <.kanaxa> Composition over inheritance |
08:18:06 | FromDiscord | <dissolved.girl> I see. Thank you! |
08:35:53 | FromDiscord | <Elegantbeef> Pmunch if you want an update to the nimscripter dynamic library https://github.com/beef331/nimscripter/blob/dll/tests/lib/helloworld.nim uses it, almost on part to the direct use code |
08:36:11 | FromDiscord | <Elegantbeef> on par\ |
09:02:27 | FromDiscord | <ratogbm> Can you multiply strings/char in nim like in python? `'a'5=="aaaaa"` |
09:02:49 | FromDiscord | <Elegantbeef> `strutils.repeat` |
09:04:22 | FromDiscord | <ezquerra> I'm trying to install nim on a Linux container using the choosenime script. My user is not root. If I do `curl https://nim-lang.org/choosenim/init.sh -sSf | sh` I get the following error:↵> choosenim-init: Downloading choosenim-0.8.4_linux_amd64↵> curl: (23) Failure writing output to destination |
09:04:53 | FromDiscord | <ezquerra> I can fix it by using `sudo sh` but then the .nimble directory is installed in the root user's home directory |
09:07:56 | FromDiscord | <Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4CHv |
09:09:17 | PMunch | ratogbm, well you could just take in the parameter as `proc myProc(x: var seq[int])`, that makes it mutable from inside the procedure |
09:09:51 | FromDiscord | <ratogbm> In reply to @PMunch "<@720535934025596929>, well you could": hold up... why has noone told me about this? |
09:10:55 | FromDiscord | <ratogbm> 😭 I wrote an entire project painfully dealing with refs.... |
09:10:58 | PMunch | Because you never asked (I assume) :P |
09:11:15 | FromDiscord | <ratogbm> In reply to @PMunch "Because you never asked": thanks I guess... |
09:11:42 | PMunch | Yeah that's why I asked, dealing with a `ref seq` isn't very common in Nim, because it's painful and rarely useful |
09:13:06 | FromDiscord | <5starrss> guys im learning nim but whats it usefull for |
09:13:20 | PMunch | And to answer your other question, you can't multiply strings/chars in Nim without implementing your own custom `*` procedure. But there is `repeat` in the `strutils` module which does the same thing |
09:13:43 | PMunch | So `"a".repeat(5) = "aaaaa"` |
09:13:59 | FromDiscord | <ratogbm> In reply to @5starrss "guys im learning nim": It can compile to JS so I guess it's usefull for that. |
09:14:04 | FromDiscord | <ratogbm> (edit) "compile" => "compiles" |
09:14:17 | FromDiscord | <5starrss> i dont even know js |
09:14:20 | FromDiscord | <ratogbm> (edit) "that." => "webdev." |
09:14:33 | FromDiscord | <ratogbm> For me it's just "faster" python |
09:14:40 | FromDiscord | <Elegantbeef> What's the issue?↵(@Andreas) |
09:15:24 | FromDiscord | <Andreas> In reply to @5starrss "i dont even know": it usefull for many things - take a look at the nimble-directory to get a idea. Do you know any other programming language ? |
09:15:27 | FromDiscord | <ratogbm> (edit) "python" => "python." |
09:16:49 | PMunch | 5starrss, you can pretty much do anything you'd like in Nim |
09:16:49 | FromDiscord | <5starrss> nope |
09:16:57 | FromDiscord | <Andreas> In reply to @Elegantbeef "What's the issue? (<@754284517316886598>)": it blows on my side ? Does not accept the `distinct uint64` inside the Atomic ? using threading/atomics. |
09:17:22 | FromDiscord | <5starrss> i dont know any other becuase i dont have time rn to learn python and also people told me nim is very very easy to learn |
09:17:27 | FromDiscord | <5starrss> thats why i wanna start with nim |
09:17:28 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/threading/issues/35 |
09:17:51 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/threading/issues/17 |
09:18:39 | FromDiscord | <Andreas> In reply to @Elegantbeef "https://github.com/nim-lang/threading/issues/17": ohh ic, thx, last time i looked `threading/atomics` was the future solution. |
09:19:00 | FromDiscord | <Elegantbeef> Regardless a PR is likely needed for `std/atomics` with the afforementioned concept |
09:22:05 | FromDiscord | <ratogbm> In reply to @5starrss "i dont know any": 1. I think python is easier, at least it has a bigger community and more tutorials.↵2. nim is easier but not the easiest. The difficulty between 1st and 5th language is bigger than between 6th - 10th. |
09:22:44 | FromDiscord | <ratogbm> (edit) "In reply to @5starrss "i dont know any": 1. I think python is easier, at least it has a bigger community and more tutorials.↵2. nim is easier but not the easiest. The difficulty between 1st and 5th ... language" added "easiest" |
09:22:54 | FromDiscord | <ratogbm> (edit) "-" => "and" |
09:25:47 | FromDiscord | <Andreas> In reply to @Elegantbeef "Regardless a PR is": the concept-solution in issue-17 does not compile with nim-2.0, so thats why you say, a PR is needed ? |
09:26:03 | PMunch | 5starrss, in that case you might like: https://www.udemy.com/course/nim-programming-for-beginners/ and https://narimiran.github.io/nim-basics/ |
09:26:17 | PMunch | There are also some nice video tutorials for beginners |
09:26:41 | FromDiscord | <Andreas> (edit) "In reply to @Elegantbeef "Regardless a PR is": the concept-solution in issue-17 does not compile with nim-2.0, so thats why you say, a PR is needed ? ... " added "Sry, update - found a typo, works.." |
09:32:58 | FromDiscord | <5starrss> this bot is so fucking smart |
09:35:34 | FromDiscord | <5starrss> but im not buying ac course 💀 |
09:35:38 | PMunch | 5starrss, which bot? |
09:36:09 | PMunch | Oh, I didn't realise that was a paid course. Since when have we had that? |
09:36:12 | FromDiscord | <5starrss> In reply to @PMunch "<@1137563570448638074>, which bot?": you your so smart |
09:38:27 | FromDiscord | <Phil> Just in case this is the daily reoccurrence of the "Is this a bot" topic:↵Our discord server is bridged to other chat-servers/applications as well such as IRC and matrix |
09:38:35 | FromDiscord | <demotomohiro> They are Not BOT, just posting from IRC. |
09:38:49 | FromDiscord | <Phil> Messages coming from users from those servers to discord are displayed as "Bot" |
09:38:54 | PMunch | 5starrss, this is the one I meant to link to: https://exercism.org/tracks/nim |
09:38:56 | FromDiscord | <5starrss> oh |
09:39:21 | FromDiscord | <5starrss> can you run nim code without compling it |
09:39:22 | PMunch | Ssssh, I was going to lean into it this time. Pretend to actually be a bot :P |
09:39:23 | FromDiscord | <Phil> This is me typing from matrix for example. |
09:39:30 | FromDiscord | <5starrss> i sound so doumb |
09:39:33 | PMunch | 5starrss, well kinda |
09:39:37 | FromDiscord | <5starrss> (edit) "doumb" => "dumb" |
09:39:44 | FromDiscord | <Phil> In reply to @PMunch "Ssssh, I was going": I'll leave the next one to you 😛 |
09:39:45 | PMunch | You can run NimScript without compiling |
09:39:53 | FromDiscord | <5starrss> how |
09:40:03 | FromDiscord | <5starrss> i only got told nim c -r |
09:40:04 | PMunch | And of course you can run Nim on the playground without compiling it yourself :P |
09:40:09 | PMunch | `nim r` |
09:40:14 | FromDiscord | <5starrss> oh |
09:40:21 | FromDiscord | <Phil> doesn't r compile and run? |
09:40:25 | PMunch | But why don't you want to compile? Nim is a compiled language.. |
09:40:32 | PMunch | Ah wait, `nim e`? |
09:41:18 | PMunch | Yes `nim e` to evaluate a NimScript file |
09:41:19 | FromDiscord | <5starrss> ahh |
09:41:37 | FromDiscord | <5starrss> this shit is confusing i dont think coding is for me |
09:41:41 | PMunch | `nim r` just compiles the code and puts the binary in the nimcache folder |
09:41:52 | PMunch | 5starrss, it only gets wores |
09:41:54 | PMunch | worse* |
09:41:58 | FromDiscord | <Phil> Okay so first things first:↵5stars, I'd recommend only dealing with normal nim |
09:42:01 | FromDiscord | <Phil> (edit) "Okay so first things first:↵5stars, I'd recommend only dealing with normal nim ... " added "for now" |
09:42:04 | PMunch | But programming is fun :) |
09:42:07 | FromDiscord | <Phil> You can dive into stuff like nimscript later |
09:42:22 | FromDiscord | <5starrss> In reply to @isofruit "Okay so first things": what do you mean normal nim |
09:42:55 | FromDiscord | <5starrss> and they told me nim was easy 🤦 |
09:43:17 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CHJ |
09:43:19 | PMunch | Well, Nim is easy compared to many other programming languages. But programming is still hard.. |
09:43:59 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4CHJ" => "https://play.nim-lang.org/#ix=4CHK" |
09:44:38 | FromDiscord | <5starrss> In reply to @isofruit "If you just want": yeah so thats what i have been doing |
09:44:42 | FromDiscord | <Phil> Nim is relatively easy in the sense that to get started it doesn't take that much, there's not a lot of "mandatory" stuff to know about.↵But nim (like most programming languages) has a ton of things you can opt into that are useful to know once you're more experienced |
09:44:45 | FromDiscord | <5starrss> i just dont know stuff like variables |
09:44:52 | FromDiscord | <5starrss> its so fucking confusing |
09:44:58 | PMunch | Elegantbeef, this NimScript as a dynamic library is really cool! |
09:45:24 | FromDiscord | <5starrss> also how old are yall |
09:45:25 | FromDiscord | <5starrss> im 14 |
09:45:58 | PMunch | Ages here vary quite considerably, but I started when I was about your age |
09:46:01 | FromDiscord | <Phil> In reply to @5starrss "i just dont know": Ahh check. So basically you know how in math you have stuff like↵`5 + x = 8`? |
09:46:13 | FromDiscord | <5starrss> oh yeah |
09:46:33 | FromDiscord | <5starrss> and you need to figure out what x = in that case it whould be 3 |
09:46:35 | FromDiscord | <5starrss> right ? |
09:46:43 | FromDiscord | <5starrss> please tell me im not wrong 🤓 |
09:46:51 | FromDiscord | <Phil> You're entirely correct! |
09:46:55 | FromDiscord | <5starrss> leshgoo |
09:46:59 | FromDiscord | <Phil> Now in math X is often something you need to figure out |
09:47:15 | FromDiscord | <Phil> If you look at it from a different perspective, x is kind of like a placeholder for the value 3, right? |
09:47:49 | FromDiscord | <5starrss> so if i did like ↵↵x = 3 ↵echo 3 |
09:47:51 | FromDiscord | <5starrss> fuck |
09:47:53 | FromDiscord | <5starrss> idk |
09:47:55 | FromDiscord | <Phil> Almost! |
09:48:19 | FromDiscord | <Phil> in nim to put a value into a variable you need to tell it "Hey, this is supposed to create a variable", you can do that with let and var |
09:48:25 | FromDiscord | <Phil> so `let x = 3` |
09:48:40 | FromDiscord | <5starrss> let x =3 ↵echo 3 |
09:48:41 | FromDiscord | <5starrss> ? |
09:48:58 | FromDiscord | <5starrss> or whould it be like echo"3" |
09:49:19 | FromDiscord | <Phil> `echo 3` and `echo "3"` will both work, but I'll get to that in a second |
09:49:31 | FromDiscord | <5starrss> oh alrighty |
09:49:45 | FromDiscord | <Phil> echo 3 by itself already is a valid statement, because you're basically telling nim "Hey, show me whatever is right of the echo word" |
09:49:59 | FromDiscord | <Phil> What you do with ↵`let x = 3` is you put the value 3 into the x |
09:50:21 | FromDiscord | <Phil> And if you later want to figure out "Oh shit, I forgot what is in x.... show it to me!"↵You can do ↵`echo x` |
09:50:36 | FromDiscord | <5starrss> oh yeah thats what i meant to say |
09:50:37 | FromDiscord | <5starrss> lmao |
09:50:44 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CHN |
09:50:52 | FromDiscord | <5starrss> what whould this even be usefull for tho |
09:51:38 | FromDiscord | <Phil> That's the starting point.↵Think of it like this.↵Say you have a school and you have a list of classes with how many students are in each class |
09:51:43 | * | ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
09:51:59 | FromDiscord | <Phil> And you want to just add them up together in an easy manner |
09:52:21 | * | ehmry joined #nim |
09:52:24 | FromDiscord | <Phil> So say you have 5 classes with 20, 25, 26, 32 and 16 pupils each |
09:52:57 | FromDiscord | <Phil> `let x = @[20, 25, 26, 32, 16]` This is a list of values. Now we want to add them all up |
09:53:46 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CHO |
09:54:02 | FromDiscord | <5starrss> head hurting |
09:54:07 | FromDiscord | <5starrss> i dont understand |
09:54:50 | FromDiscord | <Phil> Hmm in that case it might make sense to look into some beginner guides that don't assume programming knowledge |
09:55:56 | FromDiscord | <Phil> But those guides will more likely lead you towards python or java since those languages are more broadly available. |
09:56:08 | FromDiscord | <Phil> (edit) "available." => "accessible." |
09:56:13 | FromDiscord | <Phil> (edit) "accessible." => "used." |
09:56:23 | FromDiscord | <Phil> (edit) "java" => "javascript" |
09:56:52 | FromDiscord | <5starrss> why did you put the @ let x = @20, |
09:56:53 | FromDiscord | <5starrss> ? |
09:57:38 | FromDiscord | <Phil> Ah, apologies, that is nim syntax thingie and for now not relevant |
10:01:08 | FromDiscord | <Phil> sent a long message, see http://ix.io/4CHQ |
10:01:29 | FromDiscord | <Phil> (edit) "http://ix.io/4CHQ" => "http://ix.io/4CHR" |
10:01:55 | FromDiscord | <Phil> (edit) "http://ix.io/4CHU" => "http://ix.io/4CHT" |
10:03:57 | FromDiscord | <5starrss> so if i wanted just one value it whould just be `let x = 7`↵but if i wanted a list of arrays it whould be `let x = @[7, 25, 30] ? |
10:04:06 | FromDiscord | <5starrss> (edit) "30]" => "30]`" |
10:04:35 | FromDiscord | <Phil> Pretty much! |
10:04:53 | FromDiscord | <Phil> To be more exact in terms of wording I'd call the second thing you created a sequence, rather than an array |
10:05:37 | FromDiscord | <Phil> People in nim (and a lot, but not all other programming languages) tend to immediately think "I can't change the length of this" if you talk about arrays because in their languages those are fixed-size. |
10:06:36 | FromDiscord | <Phil> Okay, before we move on, another side-trip.↵Remember when I mentioned `var` earlier? |
10:06:49 | FromDiscord | <5starrss> what is var ? |
10:06:53 | FromDiscord | <5starrss> i remeber you saying it |
10:06:58 | FromDiscord | <5starrss> i just dont remember what it is |
10:07:02 | FromDiscord | <Phil> Aye, `let x = 5` was to create a variable that is fixed |
10:07:08 | FromDiscord | <Phil> you can't change x anymore at that point |
10:07:18 | FromDiscord | <5starrss> oh |
10:07:20 | FromDiscord | <5starrss> yeah varaible |
10:07:21 | FromDiscord | <5starrss> lmao |
10:07:26 | FromDiscord | <5starrss> im so fucking stupid |
10:07:33 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CHV |
10:07:44 | FromDiscord | <Phil> Because you already said with `let x = 5` that x is the value 5, it can't change. |
10:07:56 | FromDiscord | <Phil> But what if you want to have a variable that you can change?↵Then you use var |
10:08:21 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CHW |
10:09:15 | FromDiscord | <5starrss> but why whoudnt you just delete the var x =5 ↵and put x = 3 |
10:10:50 | FromDiscord | <Phil> In this particular case you're completely correct, it would do the same if you just removed the `var x = 5` and just did a `var x = 3`.↵However keep in mind to create a variable for the first time you always need to use either var or let (there's also const but that is not relevant for now) |
10:10:55 | FromDiscord | <Phil> (edit) "now)" => "much, much later)" |
10:11:25 | FromDiscord | <5starrss> what about like if statements and stuff |
10:12:28 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CHY |
10:12:44 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4CHY" => "https://play.nim-lang.org/#ix=4CHZ" |
10:12:48 | FromDiscord | <5starrss> so it whould be 30 |
10:12:53 | FromDiscord | <Phil> Correct! |
10:12:58 | FromDiscord | <5starrss> YAY |
10:13:11 | FromDiscord | <Phil> Now if you want to throw in an if-statement, lets first talk about booleans |
10:13:23 | FromDiscord | <5starrss> wtf is a boolean? |
10:13:24 | FromDiscord | <5starrss> lmao |
10:13:34 | FromDiscord | <Phil> In every programming language there's the concept that something is either "true" or "false" |
10:13:50 | FromDiscord | <5starrss> yeah |
10:14:13 | FromDiscord | <Phil> a boolean represents that something is either true or false. It is a kind of variable.↵Note for example that until now we've only put numbers into variables |
10:14:18 | FromDiscord | <Phil> Well you can also put booleans into variables |
10:14:29 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CI1 |
10:14:39 | FromDiscord | <5starrss> wait |
10:15:14 | FromDiscord | <5starrss> so then whould u do somthing like if isHungry = true then bla bla bla ? |
10:16:11 | FromDiscord | <Phil> You can do it that way, but to check if 2 things are the same, you use `==` because `=` is for putting a value into a variable |
10:16:19 | FromDiscord | <Phil> so it would be `isHungry == true` |
10:16:40 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CI2 |
10:16:51 | FromDiscord | <5starrss> oh okay yeah that makes sense |
10:17:00 | FromDiscord | <Phil> However, you know what the funny thing is? |
10:17:06 | FromDiscord | <Phil> isHungry == true is a comparison |
10:17:20 | FromDiscord | <Phil> and the result of a comparison like this is also either true or false |
10:17:39 | FromDiscord | <Phil> so isHungry == true has the result of true |
10:17:54 | FromDiscord | <Phil> because it is true that isHungry has the value `true` in it |
10:18:40 | FromDiscord | <5starrss> becuase you put let isHungry = true so if you do ↵↵if isHungry ==true ↵ it whould just be true |
10:18:48 | FromDiscord | <5starrss> thats confusing |
10:18:52 | FromDiscord | <5starrss> to many trues |
10:19:11 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CI5 |
10:19:44 | FromDiscord | <Phil> Does that make sense? |
10:19:48 | FromDiscord | <5starrss> yeah |
10:19:54 | FromDiscord | <5starrss> ig 😆 |
10:20:04 | FromDiscord | <5starrss> (edit) "😆" => "🤣" |
10:22:00 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CI6 |
10:25:30 | FromDiscord | <5starrss> if you write is hungry the value whould stay at 50 becuase he didnt eat lunch(becuase he wasnt hungry)↵but if you wrote var is hungry = true then it whould be 30 becuase he was hungry there for he ate lunch↵and the cost was 30 |
10:25:34 | FromDiscord | <5starrss> (edit) "30" => "20" |
10:25:56 | FromDiscord | <Phil> Exactly correct |
10:26:28 | FromDiscord | <5starrss> yay |
10:26:47 | FromDiscord | <Phil> There is a bunch of ways you can do comparisons, but they depend on what you have in your variables |
10:27:44 | FromDiscord | <Phil> `==` is a way to compare 2 things most of the time, assuming you have the same thing on both ends.↵So you can compare 2 booleans with it `isHungry == true` , but you can't compare a boolean and a number with it.↵ `isHungry == 5` will not work because one is a number, not a boolean |
10:27:50 | FromDiscord | <Phil> (edit) "`==` is a way to compare 2 things most of the time, assuming you have the same thing on both ends.↵So you can compare 2 booleans with it `isHungry == true` , but you can't compare a boolean and a number with it.↵ `isHungry == 5` will not work because one ... is" added "of those" |
10:29:03 | FromDiscord | <5starrss> ohhh alrighty |
10:29:28 | FromDiscord | <Phil> booleans and numbers are what's called "types" |
10:30:23 | FromDiscord | <Phil> There are a couple "core"-types that are basically the basis for everything else, to which boolean and multiple different kinds of numbers belong |
10:32:16 | FromDiscord | <Phil> For the most part there's boolean (true, false), full numbers aka integers (-2, -1, 0, 1, 2, 3 etc.), text aka Strings ("I am a string and could be assigned to a variable"), partial numbers or floats (0.5, 1.245, 0.341 etc.) |
10:32:31 | FromDiscord | <Phil> (edit) "variable")," => "variable") and" |
10:32:47 | FromDiscord | <5starrss> oh alright thanks man. |
10:32:55 | FromDiscord | <5starrss> your actually the best |
10:33:32 | * | marcus quit (Remote host closed the connection) |
10:33:42 | FromDiscord | <Phil> You can actually give yourself a hint at what "type" of value goes into a variable by using so called type annotations.↵`let x = 5` tells you that full numbers aka integers go into x.↵But you can also make that explicit by writing:↵`let x: int = 5` |
10:34:42 | * | marcus joined #nim |
10:35:25 | FromDiscord | <Phil> Sometimes you'll even have to specify them because otherwise nim can't figure out what should go into a variable.↵For example ↵`var x` won't compile because nim isn't sure "Will a string, an integer, a float or something else entirely go int here?" |
10:35:45 | FromDiscord | <Phil> (edit) "compile" => "work" |
10:36:40 | FromDiscord | <Phil> And nim (as well as a lot of other langauges that have the same concept) is super finnicky about this stuff by design.↵Because it prevents mistakes |
10:37:14 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CId |
10:37:32 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4CId" => "https://play.nim-lang.org/#ix=4CIe" |
10:38:45 | * | jmd_ quit (Ping timeout: 246 seconds) |
10:39:25 | FromDiscord | <5starrss> 5 Potato |
10:39:54 | FromDiscord | <Phil> In that case you fully agree with how javascript (the language that runs on websites) works 😄 |
10:40:24 | FromDiscord | <Phil> in nim it goes "Wait, that feels like I'd need to guess what you want me to do, I block this" |
10:40:30 | FromDiscord | <Phil> (edit) "this"" => "this, no program for you"" |
10:40:40 | FromDiscord | <5starrss> so that whoudnt work |
10:40:44 | FromDiscord | <5starrss> x + y |
10:40:48 | FromDiscord | <5starrss> that works in python tho ? |
10:41:31 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CIj |
10:41:42 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4CIj" => "https://play.nim-lang.org/#ix=4CIk" |
10:41:50 | FromDiscord | <5starrss> whats the, >>> |
10:42:09 | FromDiscord | <Phil> I have python open in a terminal, one sec |
10:42:24 | FromDiscord | <5starrss> https://media.discordapp.net/attachments/371759389889003532/1138059564412051476/image.png |
10:42:25 | FromDiscord | <5starrss> confusing |
10:42:25 | FromDiscord | <Phil> https://media.discordapp.net/attachments/371759389889003532/1138059567280967741/image.png |
10:42:36 | FromDiscord | <5starrss> oh |
10:42:49 | FromDiscord | <5starrss> what the fuck is that terminal |
10:42:56 | FromDiscord | <5starrss> what device do you use |
10:42:58 | FromDiscord | <Phil> You're on windows? |
10:43:02 | FromDiscord | <5starrss> yes |
10:43:06 | FromDiscord | <5starrss> mines diffrent |
10:43:07 | FromDiscord | <Phil> In that case you have something similar, it's called powershell |
10:43:10 | FromDiscord | <Phil> Or the older one, cmd |
10:43:17 | FromDiscord | <5starrss> i use cmd |
10:43:23 | FromDiscord | <5starrss> what do you use |
10:43:28 | FromDiscord | <Phil> Linux ^^ |
10:43:29 | Amun-Ra | 5starrss: that's gnome terminal |
10:43:48 | FromDiscord | <leetnewb> there is a tabbed powershell available in the windows app store - quite nice |
10:44:52 | Amun-Ra | btw, if you ever feel useless - there's powershell for linux ;) |
10:44:52 | FromDiscord | <5starrss> how whould i make a banner on nim |
10:45:03 | FromDiscord | <Phil> I use a terminal such as that because it's faster than opening an application |
10:45:06 | FromDiscord | <nomad> Is there any way to interact with sqllite databases with only pure libraries? |
10:45:10 | FromDiscord | <Phil> In reply to @Amun-Ra "btw, if you ever": Okay that is objectively funny |
10:45:12 | FromDiscord | <odexine> Technically power shell is the shell and the windows terminal is the terminal, they’re distinct |
10:45:31 | FromDiscord | <Phil> Yeah but I feel like that goes too much into the weeds here ^^ |
10:45:41 | FromDiscord | <5starrss> In reply to @isofruit "Yeah but I feel": how whould i make a banner on nim |
10:45:47 | FromDiscord | <odexine> It can become an important distinction in the future |
10:46:00 | FromDiscord | <leetnewb> In reply to @5starrss "how whould i make": what kind of banner? |
10:46:03 | FromDiscord | <Phil> I'd move that distinction to the future then |
10:46:16 | FromDiscord | <5starrss> In reply to @leetnewb "what kind of banner?": like a text baner |
10:46:20 | FromDiscord | <5starrss> (edit) "baner" => "banner" |
10:46:34 | FromDiscord | <nomad> In reply to @5starrss "like a text banner": echo "text"? |
10:46:35 | FromDiscord | <5starrss> using like ascci text generator |
10:46:46 | FromDiscord | <leetnewb> where do you want to display the banner? |
10:46:52 | FromDiscord | <leetnewb> web browser? or somewhere else? |
10:46:59 | FromDiscord | <5starrss> In reply to @nomad "echo "text"?": yeah but if i make a big line of text using more than one line it whoudnt work |
10:47:05 | FromDiscord | <nomad> echo """↵Ascii art↵""" |
10:47:05 | FromDiscord | <5starrss> In reply to @leetnewb "where do you want": on the terminal |
10:47:14 | FromDiscord | <5starrss> In reply to @nomad "echo """ Ascii art": thansk |
10:47:17 | FromDiscord | <5starrss> (edit) "thansk" => "thanks" |
10:47:20 | FromDiscord | <nomad> Np |
10:47:52 | FromDiscord | <Phil> In reply to @5starrss "yeah but if i": What nomad just wrote is called a multi-line string for reference |
10:48:02 | FromDiscord | <Phil> it's basically `"` 3 times in a row |
10:48:08 | FromDiscord | <nomad> In reply to @nomad "Is there any way": Anyone know if this is possible btw |
10:48:11 | FromDiscord | <Phil> (edit) "it's basically `"` 3 times in a row ... " added "at the start and end of the string" |
10:48:20 | FromDiscord | <odexine> In reply to @nomad "Anyone know if this": It’s possible just no one has tried |
10:48:36 | FromDiscord | <odexine> And it’s kinda maybe also not a good idea |
10:48:50 | FromDiscord | <nomad> Why is that |
10:49:09 | FromDiscord | <odexine> SQLite is server less right? That means all the code is in the library |
10:49:19 | FromDiscord | <odexine> You’d have to convert all that into Nim plus maintain it |
10:49:41 | FromDiscord | <nomad> Mmm |
10:49:45 | FromDiscord | <nomad> Thats a lot of work |
10:49:50 | FromDiscord | <Phil> 'tis indeed |
10:49:58 | FromDiscord | <odexine> Yeah basically you’d be implementing SQLite all over again |
10:50:35 | PMunch | Yeah with only pure libraries you'd basically have to implement SQLite in Nim |
10:51:04 | FromDiscord | <nomad> Thats gonna be a lot of work, work im probably not capable of doing |
10:51:14 | FromDiscord | <Phil> Would it still count as pure if there were some madlad out there that reimplemented sqlite in a functional language that you can have bindings to? |
10:51:24 | FromDiscord | <odexine> You’re capable, I’d say it’s just not a good idea to do it lol |
10:51:35 | FromDiscord | <odexine> In reply to @isofruit "Would it still count": Wrong pure |
10:51:43 | FromDiscord | <5starrss> In reply to @nomad "echo """ Ascii art": any way to change the colour |
10:51:47 | FromDiscord | <5starrss> (edit) "colour" => "colour?" |
10:52:11 | FromDiscord | <Phil> That one will need you to import a module of the nim library which provides a proc for that |
10:52:13 | FromDiscord | <Phil> one sec |
10:53:37 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CIo |
10:54:05 | FromDiscord | <5starrss> thanks man |
10:54:53 | FromDiscord | <Phil> To explain the above, styledWriteLine is what's called a proc or procedure.↵Procedure take variables and do something with them.↵They're useful so you don't have to write the same thing twice.↵You could for example write yourself a procedure to immediately write text red that makes use of this |
10:54:56 | FromDiscord | <5starrss> how whould i do the """ thing |
10:55:00 | FromDiscord | <5starrss> with the colour |
10:55:11 | FromDiscord | <5starrss> just fgred,""" |
10:55:12 | FromDiscord | <5starrss> ? |
10:55:42 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CIp |
10:55:58 | FromDiscord | <5starrss> so i whould have to do it line by line |
10:56:00 | FromDiscord | <5starrss> ? |
10:56:17 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CIq |
10:56:24 | FromDiscord | <Phil> You can do of course both, write line by line or all at once |
10:56:32 | Amun-Ra | if I understand you correctly, no - you can use stdout.write |
10:56:39 | FromDiscord | <5starrss> oh alright thanks you |
10:56:43 | FromDiscord | <5starrss> (edit) "thanks" => "thank" |
10:58:39 | FromDiscord | <5starrss> https://media.discordapp.net/attachments/371759389889003532/1138063650750476339/image.png |
10:58:42 | FromDiscord | <5starrss> ? |
10:58:48 | FromDiscord | <5starrss> somone happend |
10:59:38 | Amun-Ra | https://play.nim-lang.org/#ix=4CIs |
10:59:43 | Amun-Ra | stdio is now in separate module |
11:00:09 | FromDiscord | <5starrss> oh wait i forgot to import lmao |
11:00:37 | Amun-Ra | the error reported states that nim compiler could not find matching write proc |
11:01:41 | FromDiscord | <5starrss> In reply to @Amun-Ra "the error reported states": what do i do then |
11:01:54 | FromDiscord | <5starrss> https://media.discordapp.net/attachments/371759389889003532/1138064465905057852/image.png |
11:01:55 | FromDiscord | <5starrss> this is what i have |
11:02:08 | FromDiscord | <5starrss> im new dont make fun of me |
11:03:07 | FromDiscord | <Phil> Oh you still need the proc we wrote earlier when I tried to introduce procs |
11:04:14 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CIu |
11:05:20 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CIv |
11:05:33 | FromDiscord | <5starrss> oh |
11:05:35 | FromDiscord | <5starrss> okay |
11:05:39 | FromDiscord | <5starrss> i kinda get it now |
11:05:45 | FromDiscord | <5starrss> what the fuck is stdout |
11:05:59 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CIw |
11:06:22 | FromDiscord | <Phil> "stdout" stands for "Standard output".↵I think the short version of it is, that is one of the many things that gets shown in your terminal |
11:06:24 | PMunch | stdout is standard output, it's basically just the name for what appears in your terminal |
11:06:40 | PMunch | You also have stderr which is the error stream |
11:06:55 | FromDiscord | <5starrss> yall are too smart for me |
11:07:12 | PMunch | You could run a program and pipe these two streams to separate files or into other programs |
11:07:21 | FromDiscord | <Phil> Basically if somebody "writes" (using e.g. stdout.styledWriteLine) to stdout it shows up in the terminal. |
11:07:26 | PMunch | Not sure how common that is on Windows, but on Linux you do it all the time |
11:07:33 | FromDiscord | <Phil> Pmunch, that's a bit far, slow down ^^ |
11:07:43 | PMunch | Haha, sorry |
11:08:10 | FromDiscord | <Phil> We're talking starting out programming, so introducing procs etc first I think is already overdoing it if I remember how I started out |
11:08:19 | FromDiscord | <Phil> (edit) "We're talking starting out programming, so introducing procs etc first I think is already overdoing it if I remember how I started out ... " added "with programming" |
11:09:04 | FromDiscord | <Phil> In reply to @5starrss "yall are too smart": Nah, smart is thinking fast. We're just old and had the time to learn a lot of this stuff and use it again and again. |
11:09:44 | FromDiscord | <5starrss> so if i wrote `stdout.styledWriteLine(fgRed, myText)` its just telling it to make it red |
11:09:58 | FromDiscord | <5starrss> in that case i chould do like fgblue |
11:10:02 | FromDiscord | <Phil> It's telling it to write whatever string is in `myText` as red |
11:10:06 | FromDiscord | <Phil> (edit) "red" => "red, yeah" |
11:10:33 | FromDiscord | <Phil> Yep, because fgBlue is one of the other colors that is defined (if you recall the link I gave you earlier) |
11:10:40 | FromDiscord | <5starrss> whats this one |
11:10:43 | FromDiscord | <5starrss> https://media.discordapp.net/attachments/371759389889003532/1138066686994559048/image.png |
11:11:10 | FromDiscord | <Phil> So remember how you can make the text-color change?↵You can also change the background-color instead, I'd need to check which proc allows that |
11:11:44 | FromDiscord | <odexine> The same one |
11:11:46 | FromDiscord | <odexine> I think |
11:12:30 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CIz |
11:14:40 | FromDiscord | <5starrss> okay let me try and put this all together |
11:15:47 | FromDiscord | <5starrss> shit |
11:15:51 | FromDiscord | <5starrss> im so stupid |
11:16:01 | FromDiscord | <Phil> You can btw. also try to play around with some of the other examples |
11:16:15 | FromDiscord | <Phil> Hm? |
11:16:27 | FromDiscord | <5starrss> https://media.discordapp.net/attachments/371759389889003532/1138068130292322345/image.png |
11:16:30 | FromDiscord | <5starrss> whats wrong with this now |
11:16:34 | FromDiscord | <5starrss> omg |
11:16:39 | FromDiscord | <5starrss> didnt even show the whole thing |
11:16:44 | FromDiscord | <5starrss> dont mind the s at the end |
11:16:59 | FromDiscord | <5starrss> https://media.discordapp.net/attachments/371759389889003532/1138068261834084362/image.png |
11:17:01 | FromDiscord | <5starrss> whats wrong with this |
11:17:15 | FromDiscord | <5starrss> is it becuase i didnt proc |
11:17:25 | FromDiscord | <Phil> Ah, nah the issue is because of something called indentation |
11:17:36 | FromDiscord | <5starrss> lmao what. |
11:17:42 | FromDiscord | <5starrss> everything has such a long name |
11:17:43 | FromDiscord | <Phil> So a proc is basically a set of instructions |
11:17:56 | FromDiscord | <Phil> but to know what things are all part of the proc and what aren't you need to "indent" them |
11:17:58 | FromDiscord | <5starrss> but did i get infront of the instructiong |
11:18:27 | FromDiscord | <5starrss> so how whould i fix this code ? |
11:18:33 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CIA |
11:19:20 | FromDiscord | <Phil> To make sure that it is clear that both ↵`let a = 5` and `echo a` belong to `doAnEcho` they both have 2 spaces at the start, they are "indented" |
11:19:36 | FromDiscord | <Phil> (edit) "spaces" => "whitespaces" |
11:20:06 | FromDiscord | <jmgomez> sent a code paste, see https://paste.rs/p9EGs |
11:20:43 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CID |
11:21:16 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4CID" => "https://play.nim-lang.org/#ix=4CIE" |
11:21:35 | FromDiscord | <Phil> Never tried jmgomez, well not yet |
11:23:49 | FromDiscord | <5starrss> In reply to @isofruit "You can fix this": there the same ? |
11:24:13 | FromDiscord | <5starrss> i cannot even see the diffrence |
11:24:15 | FromDiscord | <Phil> Nah, one has 2 whitespaces before the `stdout`.↵That is important for nim to be able to tell it belongs to writeRed |
11:24:55 | FromDiscord | <Phil> The bottom one has the stdout pushed slightly to the right, no? https://media.discordapp.net/attachments/371759389889003532/1138070261111984128/image.png |
11:26:19 | FromDiscord | <odexine> In reply to @jmgomez "hmm is it me": Should be allowed; might just be an incorrect macro parameter count thing but I don’t know |
11:27:27 | FromDiscord | <Phil> Both of those will print an empty string to the terminal btw. |
11:27:57 | FromDiscord | <Phil> If you want to print whatever you put into writeRed, you'll need to change it to ↵`stdout.styledWriteLine(fgRed, bgWhite, myText)` |
11:33:45 | FromDiscord | <Andreas> recently on HN there was a paper on SLIMalloc ? Has anybody here tried this allocator ? According to the paper it comes with some interesting features i.e. detecting memory-leaks and uses-after-free ? |
11:36:19 | FromDiscord | <odexine> Ugh I looked at the paper abstract |
11:36:20 | FromDiscord | <odexine> I don’t like their tone xd |
11:36:48 | FromDiscord | <Andreas> In reply to @odexine "I don’t like their": 🙂 it makes great claims.. |
11:36:52 | FromDiscord | <jmgomez> In reply to @odexine "Should be allowed; might": doesnt seem like so, tried with a different number of params |
11:37:04 | FromDiscord | <Phil> To get my emoji-fu up there, is xd an expression in and of itself or is that just a miss-typed `xD`? |
11:37:11 | FromDiscord | <Phil> (edit) "miss-typed" => "mistyped" |
11:37:31 | FromDiscord | <odexine> In reply to @isofruit "To get my emoji-fu": It’s a lowercase XD, I use it like a cringing XD |
11:37:41 | FromDiscord | <Phil> Check |
11:38:01 | FromDiscord | <odexine> I don’t know how others use it but I’ve seen others use it |
11:38:24 | FromDiscord | <Phil> Same, to the point where I was like "This can't be just all those people missing the shift button accidentally" |
11:39:02 | FromDiscord | <odexine> Same difference to LOL and lol I guess |
11:42:09 | FromDiscord | <jmgomez> In reply to @jmgomez "doesnt seem like so,": well, having the same issue/error in a type field and I think those are allow so probably you are right @odexine |
11:42:18 | FromDiscord | <jmgomez> (edit) "allow" => "allowed" |
11:42:31 | FromDiscord | <odexine> In reply to @jmgomez "well, having the same": It’s definitely allowed in type fields |
11:42:56 | FromDiscord | <jmgomez> yes, but I cant recall the shape of the macro |
11:51:57 | FromDiscord | <5starrss> yoo anyone from australia in here ? |
11:56:47 | FromDiscord | <jmgomez> In reply to @odexine "It’s definitely allowed in": now Im not so sure about it |
12:04:47 | FromDiscord | <odexine> In reply to @5starrss "yoo anyone from australia": Why specifically Australia? |
12:18:13 | * | PMunch quit (Quit: Leaving) |
12:23:20 | * | PMunch joined #nim |
12:26:24 | FromDiscord | <5starrss> In reply to @odexine "Why specifically Australia?": just wondering becuaes im from australia |
12:26:33 | FromDiscord | <odexine> Okay |
12:26:57 | FromDiscord | <5starrss> do you fucking live in this channel or what that was the fastest respond ever |
12:31:18 | FromDiscord | <leetnewb> tagging/responding pushes a notification |
12:32:15 | FromDiscord | <odexine> In reply to @5starrss "do you fucking live": You pinged me so I got a notification |
12:32:44 | FromDiscord | <5starrss> In reply to @odexine "You pinged me so": oh |
12:45:24 | FromDiscord | <arnetheduck> @pmunch any ideas about https://github.com/status-im/nim-chronos/issues/436 ? I thought chronos used to work in the playground, no? |
12:48:43 | PMunch | Hmm, I would guess it runs out of time for the compilation and execution |
12:48:54 | PMunch | Or that it runs out of resources, but that seems less likely |
12:49:46 | PMunch | The VM the playground runs on is seriously underpowered. So I had to nerf how long your program can run and how many resources are available to each instance quite severely |
12:53:20 | PMunch | It's a 2.3Ghz single-core with 1GB of RAM and 25GB of storage |
12:54:30 | PMunch | arnetheduck ^ |
12:54:53 | FromDiscord | <leetnewb> Do you see usage patterns surging around events like a major release / does it make sense to temporarily boost specs? |
12:57:02 | PMunch | Hmm, good question. Preferably I'd want it to run on something more powerful so it doesn't crash all the time.. |
12:57:33 | PMunch | I guess I could analyze the Nginx access logs and see if we have traffic spikes.. |
12:57:51 | FromDiscord | <5starrss> how to center this ? |
12:57:53 | FromDiscord | <5starrss> https://media.discordapp.net/attachments/371759389889003532/1138093654288900106/image.png |
12:57:57 | PMunch | It doesn't have any other telemetry |
12:58:32 | FromDiscord | <5starrss> hello guys |
12:58:35 | FromDiscord | <5starrss> ? |
12:58:38 | FromDiscord | <5starrss> anyone |
12:58:52 | FromDiscord | <5starrss> In reply to @PMunch "It doesn't have any": how to center this |
12:58:54 | FromDiscord | <5starrss> https://media.discordapp.net/attachments/371759389889003532/1138093912922259466/image.png |
12:58:59 | PMunch | 5starrss, a combination of this: https://nim-lang.org/docs/strutils.html#indent%2Cstring%2CNatural%2Cstring, and this: https://nim-lang.org/docs/terminal.html#terminalWidth |
12:59:02 | PMunch | Be patient.. |
12:59:10 | FromDiscord | <5starrss> alrighty |
12:59:56 | FromDiscord | <5starrss> tell me when your ready to tell me how to center it |
13:02:20 | * | xet7 quit (Remote host closed the connection) |
13:05:07 | FromDiscord | <leetnewb> In reply to @PMunch "I guess I could": If nothing else, that would be pretty interesting to observe. |
13:13:40 | * | rockcavera joined #nim |
13:38:18 | FromDiscord | <arnetheduck> In reply to @PMunch "Hmm, I would guess": ah, timeout could be it indeed - compile times in general have been creeping up both for nim itself and the libraries .. though for 1.6, it reports chronos is not found at all as a package? |
13:47:59 | PMunch | Yeah, since the hard-disk space is limited it's only the latest versions which have any packages installed |
13:47:59 | PMunch | latest version* |
13:48:12 | FromDiscord | <nomad> How do i add items to a json object? |
13:48:26 | PMunch | 5starrss, I already told you :) You get the width of the thing you want to print, the width of the terminal, then you subtract one from the other, divide by two, and indent by that amount. |
13:48:48 | PMunch | nomad, `myJsonObj["somekey"] = %someval` |
13:49:14 | PMunch | Assuming `someval` isn't already a JsonNode, then you don't need the `%` |
14:03:09 | * | PMunch quit (Quit: Leaving) |
14:13:47 | FromDiscord | <nomad> Im trying to make my code walk through a directory, and if the code finds a file that begins with "LOG" it adds a item which key is the file name and the value is the file contents |
14:13:59 | FromDiscord | <nomad> But i cant make it work |
14:20:25 | * | junaid_ joined #nim |
14:31:27 | * | kenran quit (Remote host closed the connection) |
15:01:06 | FromDiscord | <djazz> PMunch: I fixed the PR following your suggestion 🙂 https://github.com/PMunch/futhark/pull/78 |
15:03:02 | * | xet7 joined #nim |
15:07:42 | FromDiscord | <.maverk> sent a code paste, see https://play.nim-lang.org/#ix=4CJZ |
15:09:44 | FromDiscord | <griffith1deadly> "welcome " & x ? |
15:11:01 | FromDiscord | <.maverk> doesn't work either |
15:13:12 | FromDiscord | <griffith1deadly> https://play.nim-lang.org/#ix=4CK1 |
15:17:12 | FromDiscord | <.maverk> hmmm now it is working |
15:17:17 | FromDiscord | <.maverk> thanks |
15:17:41 | FromDiscord | <griffith1deadly> maybe you forgot return |
15:19:00 | FromDiscord | <.maverk> no |
15:19:07 | FromDiscord | <.maverk> return is not required |
15:19:15 | FromDiscord | <.maverk> functions returns by default |
15:19:45 | FromDiscord | <.maverk> https://media.discordapp.net/attachments/371759389889003532/1138129359576764457/ggd.PNG |
15:24:59 | FromDiscord | <that_dude.> Every expression that returns something needs to be captured, could be via a variable or discard statement. If the last expression in a proc doesn't get captured by anything, it returns it/sets it to result |
15:29:01 | * | lucasta joined #nim |
15:29:12 | FromDiscord | <aph> hi just wondering if anyone translated theforger's win32 api tutorial to nim (or if there is other tutorials to learn them)↵because im lazy and i dont want to rewrite code from c to winim stuff |
15:29:30 | FromDiscord | <aph> (edit) "is" => "are" |
15:29:52 | FromDiscord | <.maverk> what is the difference between ``let`` and ``const`` they both define constant data but where is the benefit of const then ? |
15:30:09 | FromDiscord | <aph> In reply to @.maverk "what is the difference": const is in compile time and let is in runtime iirc |
15:30:21 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4CK7 |
15:30:35 | FromDiscord | <aph> (edit) "In reply to @.maverk "what is the difference": const is in compile time and let is in runtime iirc ... " added "(dont trust me not a pro)" |
15:31:14 | FromDiscord | <enthus1ast> let is computed on runtime, but the variable can only once be assigend;↵const is computed on compile time by the nim vm |
15:31:47 | FromDiscord | <aph> In reply to @enthus1ast "Any idea why this": dont rlly know sry (┬┬﹏┬┬) |
15:32:03 | FromDiscord | <enthus1ast> ah, wait a sec, this must be an converter |
15:32:11 | FromDiscord | <.maverk> In reply to @aphkyle "const is in compile": wrong |
15:32:50 | FromDiscord | <.maverk> they are both compile-time |
15:32:56 | FromDiscord | <enthus1ast> no |
15:33:06 | FromDiscord | <.maverk> if let meant for run time i should see executable file |
15:33:17 | FromDiscord | <.maverk> but no exe |
15:34:04 | FromDiscord | <.maverk> they both produce no exe https://media.discordapp.net/attachments/371759389889003532/1138132962181922876/77463.PNG |
15:34:56 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4CK8 |
15:35:14 | FromDiscord | <enthus1ast> yes, you can only assign a let once |
15:35:34 | FromDiscord | <enthus1ast> let is like var, but can only be assigned once |
15:37:17 | FromDiscord | <.maverk> aaaaah |
15:37:21 | FromDiscord | <.maverk> now i get it |
15:39:41 | FromDiscord | <enthus1ast> sent a code paste, see https://paste.rs/59wbG |
15:40:38 | FromDiscord | <enthus1ast> sent a code paste, see https://paste.rs/GSa2x |
15:40:44 | FromDiscord | <that_dude.> sent a code paste, see https://paste.rs/ZBWQc |
15:40:44 | FromDiscord | <.maverk> i know static |
15:40:58 | FromDiscord | <.maverk> static used to force the compiler to check everything at compile-time |
15:41:07 | FromDiscord | <.maverk> means before producing an executable file |
15:41:30 | FromDiscord | <nervecenter> More than that, most of the Nim language can run at compile-time. So a static block can contain almost any code you want |
15:41:54 | FromDiscord | <.maverk> In reply to @nervecenter "More than that, most": yes true but everything is checked before exe |
15:43:14 | FromDiscord | <nervecenter> Further, `const` values are compile-time, so you can read in a file at compile time using `const afile = read_file(...)` and the file's contents will be incorporated into the executable |
15:44:15 | FromDiscord | <.maverk> aww that is awesome i am still new to nim i started it 2 days ago |
15:44:36 | FromDiscord | <bostonboston> In reply to @.maverk "they are both compile-time": Let is runtime assignment↵`proc doThing(foo: float) = let bar = foo` is valid |
15:45:08 | FromDiscord | <bostonboston> Oops everyone else's answers just loaded, so you get another |
15:45:12 | FromDiscord | <.maverk> In reply to @bostonboston "Let is runtime assignment": that is amazing i will try it |
15:45:13 | FromDiscord | <.maverk> also |
15:45:17 | FromDiscord | <.maverk> user input |
15:45:19 | FromDiscord | <.maverk> works ? |
15:46:23 | FromDiscord | <bostonboston> You mean like `let input = readLine()`? |
15:46:29 | FromDiscord | <.maverk> yes |
15:46:31 | FromDiscord | <.maverk> from stdin |
15:46:39 | FromDiscord | <bostonboston> Yeah that should be valid |
15:46:46 | FromDiscord | <.maverk> awesome |
15:46:49 | FromDiscord | <.maverk> i will try it |
15:47:36 | FromDiscord | <bostonboston> https://nim-lang.org/docs/rdstdin.html |
15:48:23 | FromDiscord | <_alkamist_> How do you call NimMain using vcc? Defining `proc NimMain() {.importc.}` and then calling it works on gcc but on vcc it gives the error `error C2375: 'NimMain': redefinition; different linkage` |
16:00:25 | FromDiscord | <_alkamist_> It seems to be because nim isn't putting `N_LIB_EXPORT` on the function prototype. |
16:00:48 | FromDiscord | <_alkamist_> Doing `{.emit: "/TYPESECTION/N_LIB_EXPORT N_CDECL(void, NimMain)(void);".}` instead works but I'm wondering if there is a better way. |
16:04:55 | FromDiscord | <jos7388> hello friends!! |
16:05:13 | FromDiscord | <jos7388> i'm writing a parser in nim |
16:05:19 | FromDiscord | <jos7388> i want to express some tokens like this |
16:06:51 | FromDiscord | <jos7388> sent a code paste, see https://play.nim-lang.org/#ix=4CKi |
16:07:27 | FromDiscord | <jos7388> is there a way to |
16:08:33 | FromDiscord | <jos7388> for example |
16:09:02 | FromDiscord | <Phil> First of, `case kind: LiteralKind` |
16:09:05 | FromDiscord | <jos7388> sent a code paste, see https://paste.rs/PiuL6 |
16:09:11 | FromDiscord | <Phil> (edit) "LiteralKind`" => "LiteralKind`, the current line won't compile" |
16:09:18 | FromDiscord | <jos7388> sure im just going from memory!! |
16:09:33 | FromDiscord | <jos7388> but the important part is i want to access those fields without destructuring it first, if they're known statically |
16:09:41 | FromDiscord | <Phil> Oh, apologies! I thought the code was copypaste, my bad 😅 |
16:10:14 | FromDiscord | <jos7388> my bad was a typo |
16:10:22 | FromDiscord | <jos7388> but i make all this |
16:10:36 | FromDiscord | <jos7388> https://media.discordapp.net/attachments/371759389889003532/1138142156448616618/image.png |
16:10:38 | FromDiscord | <jos7388> and then i get an error like this |
16:10:48 | FromDiscord | <Phil> `let` is immutable |
16:10:51 | FromDiscord | <jos7388> o |
16:10:58 | FromDiscord | <Phil> If you want to change anything, use `varǹ |
16:11:00 | FromDiscord | <jos7388> wait that works.. huh |
16:11:00 | FromDiscord | <Phil> (edit) "`varǹ" => "`var`" |
16:11:35 | FromDiscord | <jos7388> oh wow so |
16:11:42 | FromDiscord | <jos7388> the compiler actually knows the `kind` statically |
16:11:44 | FromDiscord | <jos7388> that's awesome |
16:12:11 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CKm |
16:12:22 | FromDiscord | <enthus1ast> what do you mean by destructuring? |
16:12:32 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4CKm" => "https://play.nim-lang.org/#ix=4CKn" |
16:12:41 | FromDiscord | <jos7388> i meant matching, not destructuring i guess |
16:12:49 | FromDiscord | <jos7388> sent a code paste, see https://play.nim-lang.org/#ix=4CKo |
16:13:08 | FromDiscord | <Phil> Choose whatever you find more readable.↵I'd chose this for the sole reason that I try to avoid var wherever possible |
16:13:20 | FromDiscord | <Phil> (edit) "possible" => "possible, but there's many ways to skin a cat" |
16:13:21 | FromDiscord | <jos7388> is there any way to wrap that |
16:13:27 | FromDiscord | <jos7388> i need to do some extra work when i create a token |
16:13:33 | FromDiscord | <Phil> Define "wrap" |
16:13:42 | FromDiscord | <Phil> You could of course write yourself a constructor proc |
16:13:47 | FromDiscord | <jos7388> hmm ok |
16:13:49 | FromDiscord | <jos7388> yea a template might work |
16:13:53 | FromDiscord | <jos7388> i keep forgetting about those features |
16:14:05 | FromDiscord | <jos7388> thanks! i'm actually surprised it works even through function invocation |
16:14:38 | FromDiscord | <jos7388> sent a code paste, see https://paste.rs/M6g25 |
16:14:39 | FromDiscord | <jos7388> like this actually works |
16:14:45 | FromDiscord | <jos7388> it doesn't complain about not knowing the kind of token on the last line |
16:14:49 | FromDiscord | <jos7388> wild!!!! |
16:15:08 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CKq |
16:15:21 | FromDiscord | <jos7388> true i can do that too |
16:15:28 | FromDiscord | <jos7388> just stick the kind in the function name instead of arg |
16:15:48 | FromDiscord | <Phil> Depending on what you find readable, this of course causes the problems that you might start mixing up what is an actual type and what is just a constructor proc |
16:15:54 | FromDiscord | <Phil> Your naming scheme also makes perfect sense |
16:16:47 | FromDiscord | <Phil> so could of course be `newLiteralToken`↵(Though for nim standards it would be more like `initLiteralToken`, `new` is more associated with creating ref-types) |
16:16:55 | FromDiscord | <Phil> (edit) "ref-types)" => "ref-types, init for value types)" |
16:17:20 | FromDiscord | <jos7388> ah ok |
16:17:23 | FromDiscord | <jos7388> nice tip |
16:17:30 | FromDiscord | <jos7388> i'll change that too |
16:17:35 | FromDiscord | <jos7388> i did see there was like a typeclass for init |
16:17:44 | FromDiscord | <jos7388> or whatever u call it in nim, concept? |
16:18:02 | FromDiscord | <Phil> My brain is slightly fried from work, what do you mean by typeclass for init? |
16:18:37 | FromDiscord | <Phil> There is something interface-like which is called `concept`, it basically checks if an object of a given type has arbitrary ability X, whatever you define in that concept. |
16:19:33 | FromDiscord | <Phil> (edit) "an object" => "a variable" |
16:19:55 | FromDiscord | <jos7388> ye i think `init` is one of those, no? |
16:20:08 | FromDiscord | <jos7388> or at least its like a convention that you could put behind a concept |
16:20:19 | FromDiscord | <jos7388> `init(self: Token)` |
16:20:24 | FromDiscord | <jos7388> rather than `initToken()` |
16:20:28 | FromDiscord | <jos7388> or `init[Token]`? |
16:20:31 | FromDiscord | <jos7388> i think last |
16:21:35 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CKr |
16:22:24 | FromDiscord | <Phil> In reply to @jos7388 "or `init[Token]`?": It would be more `init(Token)` but that is not a hard convention at all |
16:22:49 | FromDiscord | <Phil> Official guides go for `newToken`/`initToken`, I prefer overloading `new` and `init` |
16:23:07 | FromDiscord | <Phil> Well more init, I don't think you can overload new (?) |
16:24:02 | FromDiscord | <Phil> nevermind, you can overload `new` |
16:26:30 | FromDiscord | <jos7388> dang `inferGenericTypes` is a feature now |
16:26:34 | FromDiscord | <jos7388> so cool.. i love nim!! |
16:26:54 | Amun-Ra | I moved from using initType() to init(T: typedesc[Type]) |
16:27:05 | FromDiscord | <Phil> sam |
16:27:10 | FromDiscord | <Phil> (edit) "sam" => "same" |
16:29:53 | FromDiscord | <jos7388> is there any way to apply a pragma to an entire package |
16:30:23 | FromDiscord | <jos7388> i want `{.experimental "codeReordering".}` to be enabled across my entire project |
16:30:36 | FromDiscord | <jos7388> it might be the LSP freaking out but if i put it in the main module it doesn't work |
16:31:23 | FromDiscord | <jos7388> nvm even without the LSP just compiling it doesn't work either |
16:35:00 | FromDiscord | <jos7388> aha there's a cli switch.. genius!! |
16:36:26 | FromDiscord | <jos7388> wow.. inferGenericTypes added 4 daysa go |
16:36:28 | FromDiscord | <jos7388> (edit) "daysa go" => "days ago" |
16:36:35 | FromDiscord | <jos7388> homebrew is out of date by 3 days i can't use it |
16:36:39 | FromDiscord | <jos7388> <:sad_kermit:763192714085793853> |
16:39:26 | FromDiscord | <jos7388> wow choosenim works on macos arm64 now |
16:39:34 | FromDiscord | <jos7388> infergenerictypes makes my code so much better no more `none[Token]` |
16:39:40 | FromDiscord | <jos7388> i LOVE the changes over the last few months!! nim rules!! |
16:39:44 | FromDiscord | <jos7388> :peppodance: |
16:41:15 | * | lucasta quit (Quit: Leaving) |
16:47:03 | FromDiscord | <nomad> how can i send a file as multipart data with httpclient? |
16:51:48 | FromDiscord | <Phil> https://nim-lang.org/docs/httpclient.html#post%2CHttpClient%2C%2Cstring%2CMultipartData↵post has a multipart parameter which accepts a ref object |
16:56:25 | FromDiscord | <crim4> sent a code paste, see https://play.nim-lang.org/#ix=4CKy |
16:57:24 | FromDiscord | <Phil> I don't understand, what is the problem?↵Are you looking for a printString equivalent?↵That's echo |
16:57:57 | FromDiscord | <crim4> im looking for a way to call functions attached to an object |
16:58:03 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CKz |
16:58:18 | FromDiscord | <Phil> Wait, are you looking for the syntax or dynamic dispatch? |
16:58:40 | FromDiscord | <crim4> im lookint for the semantic, noy the syntax neither the ds |
16:59:04 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CKA |
16:59:21 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4CKA" => "https://play.nim-lang.org/#ix=4CKB" |
16:59:37 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4CKB" => "https://play.nim-lang.org/#ix=4CKC" |
16:59:41 | FromDiscord | <crim4> mh yea, not this stuff in sorry for the bad explaination |
16:59:53 | FromDiscord | <Phil> If you're looking for dynamic dispatch then you're looking for methods |
17:00:01 | * | azimut joined #nim |
17:00:19 | * | rockcavera quit (Ping timeout: 260 seconds) |
17:00:24 | FromDiscord | <Phil> (edit) "methods" => "`method`s" |
17:01:47 | FromDiscord | <crim4> sent a code paste, see https://play.nim-lang.org/#ix=4CKE |
17:02:27 | FromDiscord | <crim4> you can call print from any place |
17:02:49 | FromDiscord | <Phil> Oh, as in a proc that is globally available even without importing it? |
17:03:03 | FromDiscord | <crim4> and still get it work whether any_t has a method called tostring |
17:03:05 | FromDiscord | <Phil> Okay, you're looking for a prelude |
17:03:28 | FromDiscord | <crim4> In reply to @crim4 "and still get it": and that doesn't require dyn disp |
17:03:38 | FromDiscord | <crim4> just because c++ has methods |
17:03:57 | FromDiscord | <crim4> In reply to @isofruit "Okay, you're looking for": ok thanks let me document about it |
17:04:00 | FromDiscord | <Phil> Oh, it's just "if this proc exists and takes in a parameter of this type, make it work" kind of things? |
17:04:49 | FromDiscord | <Phil> Actually you might not, I'm still confused |
17:05:13 | FromDiscord | <Phil> If you just want to basically have a sort of "global import" of lib.nim that is always available in any module, that is a prelude. |
17:05:19 | FromDiscord | <Phil> (edit) "module," => "module in your project," |
17:05:38 | FromDiscord | <Phil> God where were the docs on this... |
17:07:44 | * | rockcavera joined #nim |
17:07:44 | * | rockcavera quit (Changing host) |
17:07:44 | * | rockcavera joined #nim |
17:08:07 | FromDiscord | <crim4> In reply to @isofruit "Actually you might not,": mh yes the doc talks about a way to import basic std modules |
17:08:24 | FromDiscord | <crim4> definitely not what i need but thanks |
17:09:01 | FromDiscord | <crim4> In reply to @isofruit "If you just want": mhh im not sure its the same thing |
17:09:02 | FromDiscord | <Phil> Like the goal is to be able to call `print` from any module in your project even without importing `lib.nim`? |
17:09:53 | FromDiscord | <Phil> Or is it to be able to call `print` with any type after you imported `lib.nim`, because that sounds just like any normal generic does |
17:10:37 | FromDiscord | <that_dude.> Maybe your looking for mixin? |
17:10:50 | FromDiscord | <crim4> basically from lib.nim you can call a .f() function on an argument |
17:11:09 | FromDiscord | <crim4> but that .f is not declared in lib.nim |
17:11:36 | FromDiscord | <crim4> its just an attached method to the type of the argument |
17:12:02 | FromDiscord | <crim4> In reply to @isofruit "Like the goal is": no |
17:12:04 | FromDiscord | <crim4> sorry my bad |
17:12:23 | FromDiscord | <that_dude.> Usually it doesn't make sense to only have the type without any helpers |
17:12:30 | FromDiscord | <rio> testing (ignore) |
17:12:40 | FromDiscord | <that_dude.> Could you pass in the proc as an argument? |
17:13:06 | FromDiscord | <that_dude.> https://nim-lang.org/docs/manual.html#generics-mixin-statement Also what about this? is it close to what you want? |
17:13:19 | FromDiscord | <crim4> In reply to @that_dude. "Could you pass in": mh it would require runtime stuff |
17:13:38 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CKJ |
17:14:08 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4CKJ" => "https://play.nim-lang.org/#ix=4CKK" |
17:14:49 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4CKK" => "https://play.nim-lang.org/#ix=4CKL" |
17:15:33 | FromDiscord | <01r> tesing (igno...) |
17:15:47 | FromDiscord | <01r> (edit) "(igno...)" => "(ignore)" |
17:16:03 | FromDiscord | <crim4> In reply to @that_dude. "https://nim-lang.org/docs/manual.html#generics-mixi": ah yes perfect |
17:16:06 | FromDiscord | <huantian> sent a code paste, see https://paste.rs/Yq7bg |
17:16:14 | FromDiscord | <crim4> thank you so much |
17:16:24 | FromDiscord | <that_dude.> In reply to @crim4 "ah yes perfect": Just be careful, you're making the promise it exists and the compiler trusts you on it |
17:16:28 | FromDiscord | <Phil> So you wanted to capture a proc in the scope of the generic-definition rather than the place of its instantiation? |
17:16:36 | FromDiscord | <huantian> (edit) "https://play.nim-lang.org/#ix=4CKO" => "https://play.nim-lang.org/#ix=4CKN" |
17:16:40 | FromDiscord | <huantian> In reply to @that_dude. "Just be careful, you're": well it still won't compile if it doesn't exist |
17:16:49 | FromDiscord | <huantian> it'll just give a slightly more annoying and harder to read error message |
17:17:07 | FromDiscord | <that_dude.> In reply to @huantian "it'll just give a": Kinda where I was going with it lol |
17:17:18 | FromDiscord | <crim4> In reply to @that_dude. "Just be careful, you're": im away from pc for days, what happens if the mixin-ed symbols is not declared |
17:17:50 | FromDiscord | <Phil> Oh wait, other way round, you wanted to tell the compiler "this proc will exist, but only where the proc is called, not here where it's defined" |
17:18:03 | FromDiscord | <Phil> (edit) "Oh wait, other way round, you wanted to tell the compiler "this proc will exist, but only where the ... proccalled" added "generic" | "called," => "called from," |
17:18:50 | FromDiscord | <that_dude.> Actually the error message should be fine. It just works like a normal one saying something like `Error: undeclared identifier: 'other'` |
17:20:04 | NimEventer | New thread by morturo: Unsure about lifetime-tracking hooks, see https://forum.nim-lang.org/t/10383 |
17:20:12 | FromDiscord | <crim4> In reply to @isofruit "Oh wait, other way": kind of |
17:20:23 | FromDiscord | <crim4> thank you all |
17:21:58 | * | rockcavera quit (Read error: Connection reset by peer) |
17:22:39 | * | rockcavera joined #nim |
17:22:39 | * | rockcavera quit (Changing host) |
17:22:39 | * | rockcavera joined #nim |
17:24:33 | FromDiscord | <.maverk> is using ``return`` considered a good practice ? i know if i didn't assign the value to a variable i won't need to return it is gonna be returned automatically |
17:25:54 | FromDiscord | <Phil> I don't think there's consensus.↵I tend to prefer using return, but even that's not an ironclad rule.↵Often enough a proc is literally just building an instance of type A from an input and sometimes I just use result for those |
17:26:30 | FromDiscord | <Phil> The folks from status made a statement somewhere that they avoid result and only use return as it was a source of bugs for them.↵Not quite sure how, but maybe that was because of macro stuff |
17:26:41 | FromDiscord | <that_dude.> Depends on how you format code. Some people want the functions to look nice and use implicit return, others want to make sure that the function always reaches the bottom for consistency via result, and then some people simply want to end the function when some specific branch is reached. It's just preference tho ime \ |
17:26:43 | FromDiscord | <that_dude.> (edit) removed "\" |
17:27:06 | FromDiscord | <.maverk> i see |
17:27:18 | FromDiscord | <.maverk> i think i have to work more on it |
17:27:24 | FromDiscord | <.maverk> to get a good grasp of it |
17:28:29 | FromDiscord | <Phil> A hard rule I have is though that if I have guard-clauses for early returns, I 100% use only return in that proc |
17:29:16 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CKQ |
17:29:28 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4CKQ" => "https://play.nim-lang.org/#ix=4CKR" |
17:29:46 | FromDiscord | <that_dude.> Imo I use implicit when it's a simple calculation that doesn't have a lot of logic in it, result if I need to modify the output multiple times (think incrementing a sum) or return for early returns or standard business procs |
17:30:06 | FromDiscord | <Phil> I mean if it's simple I just inline it |
17:30:22 | FromDiscord | <Phil> `proc myProc(a,b: int): int = a + b |
17:30:24 | FromDiscord | <Phil> (edit) "b" => "b`" |
17:31:14 | * | pbsds quit (Ping timeout: 260 seconds) |
17:33:39 | FromDiscord | <Chronos [She/Her]> Hey could someone explain how seqs work? They work by putting stuff onto the stack and storing pointers to the elements in the heap, right? |
17:45:42 | FromDiscord | <Phil> sent a long message, see http://ix.io/4CKX |
17:46:06 | FromDiscord | <Phil> (edit) "http://ix.io/4CKX" => "http://ix.io/4CKY" |
17:51:24 | FromDiscord | <bostonboston> Seq have a capacity and a length as well, If I remember correctly the capacity is on the heap with the data, length is how many elements are in the seq and capacity denotes how much memory has been allocated. The data is also contiguous in memory |
17:52:50 | * | pbsds joined #nim |
17:59:01 | FromDiscord | <Chronos [She/Her]> In reply to @isofruit "Hmm my mental model": Ah |
17:59:16 | FromDiscord | <Chronos [She/Her]> Honestly debating on if I need something like ropes for efficiency |
18:12:57 | FromDiscord | <codic> sent a long message, see https://paste.rs/N5FKX |
18:14:43 | FromDiscord | <adokitkat> Does someone please now how to develop 2 nimble packages while one depends on the other? ↵Both are forks and when I use `nimble develop` on any of them it works but only for the package in which directory I am in. ↵I need to have `requires package2` in `package1` to point to other one I am modifying, not the system-wide original package (which I cannot delete because of the unwanted dependency). |
18:16:09 | FromDiscord | <Phil> I'd have first developed them as one package until you've got an mvp, then split them apart and develop inepdendently |
18:16:31 | FromDiscord | <Phil> Then your package A can depend on old versions of package B and vice versa as needed. |
18:16:59 | FromDiscord | <Phil> Should have a clearly defined interface between the two though |
18:23:05 | FromDiscord | <morgan> is there a way to print the type in a template? i'm trying to hack nimpng to correctly export a 16 bit grayscale image and it's creating an 8 bit seq |
18:24:05 | FromDiscord | <Phil> what's not working on `echo $someVar.type()`? |
18:25:54 | FromDiscord | <morgan> ah i'll try that |
18:26:05 | FromDiscord | <morgan> i just tried echo(T) |
18:27:04 | FromDiscord | <morgan> well echo($T) doesn't work |
18:27:41 | FromDiscord | <Phil> Okay, show me your template, are you passing a typedesc directly? |
18:28:10 | FromDiscord | <Phil> Basically, minimal example and so on |
18:28:15 | FromDiscord | <morgan> sent a code paste, see https://play.nim-lang.org/#ix=4CLa |
18:28:20 | FromDiscord | <Phil> That's nota template, that's a generic |
18:28:33 | FromDiscord | <morgan> oh right |
18:28:33 | FromDiscord | <Phil> or rather that shouldn't be a templet if you use it as a generi |
18:28:34 | FromDiscord | <Phil> (edit) "generi" => "generic" |
18:28:38 | FromDiscord | <morgan> well |
18:28:46 | FromDiscord | <morgan> im modifying existing code |
18:28:57 | FromDiscord | <morgan> to add in uint16 as an option |
18:29:19 | FromDiscord | <morgan> idk what T is other than not string |
18:29:26 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CLb |
18:30:11 | FromDiscord | <morgan> well nimpng had it as a template |
18:30:18 | FromDiscord | <morgan> so im not gonna change that |
18:30:35 | FromDiscord | <morgan> i just wanna make it actually work for writing 16 bit grayscale images |
18:30:58 | FromDiscord | <morgan> also echo($T) causes an error |
18:33:19 | FromDiscord | <Phil> ... okay, what in the |
18:33:37 | FromDiscord | <Phil> I'm looking at the original implementation and I'm getting a lot of wtf's per second out of me |
18:33:58 | FromDiscord | <Phil> elegantbeef, Rika, PMunch, any idea when you would ever want a generic template of all things? |
18:34:04 | FromDiscord | <morgan> > lineinfos.nim(291) raiseRecoverableError↵> Error: unhandled exception: cannot extract string from invalid AST node [ERecoverableError] |
18:34:33 | FromDiscord | <Phil> and by that I mean something with this signature:↵`template newStorage[T](size: int): auto =`↵https://github.com/jangko/nimPNG/blob/82cfffd91582baeffa2e2a6895c97fa2112f1c30/nimPNG.nim#L278 |
18:36:19 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CLf |
18:37:20 | FromDiscord | <Phil> The newStorage template only gets used roughly 12 or so times and its all in the same file.↵Just removing that type from the template trying to make it generic and pushing it into the proc parameters should do the trick. |
18:37:32 | FromDiscord | <Phil> (edit) "file.↵Just" => "file, replacing that seems doable↵Just" |
18:37:40 | FromDiscord | <Phil> (edit) "The newStorage template only gets used roughly 12 or so times and its all in the same file, replacing that seems doable↵Just removing that type from the template ... trying" added "which is" |
18:41:40 | FromDiscord | <Chronos [She/Her]> Trying to think... How would I split a rope? Surely it's possible without needing to flatten it out |
18:42:25 | FromDiscord | <Chronos [She/Her]> Would require traversal code but surely I could have an internal counter until I reach the index I want to split the rope at |
18:42:27 | FromDiscord | <Phil> Never even heard the concept of a rope in programming ^^' |
18:42:36 | FromDiscord | <Chronos [She/Her]> std/ropes aha |
18:43:08 | FromDiscord | <Phil> Ohh basically a string so long you get a rope |
18:43:19 | FromDiscord | <Phil> Yeah that's so low level it's beyond me |
18:46:49 | FromDiscord | <morgan> iirc, a rope is a string that's cut up into sections (seq?), i think it would involve checking each string if it has a point to split at, and if not, it goes in with the last one |
18:47:12 | FromDiscord | <Phil> Are ropes a common data type? |
18:47:24 | FromDiscord | <morgan> also i moved the error, i had to use seq[uint16] as T |
18:47:28 | FromDiscord | <morgan> no clue |
18:50:52 | FromDiscord | <morgan> ok i got it to export, it's very wrong lmao |
18:50:58 | FromDiscord | <morgan> i should test with 8 bit |
18:51:06 | FromDiscord | <morgan> to make sure my code is correct |
18:52:26 | FromDiscord | <morgan> https://media.discordapp.net/attachments/371759389889003532/1138182880619663380/invdist_kernel_512.png |
18:55:48 | FromDiscord | <morgan> 8 bit isn't working right either lol, so it might be my code |
18:56:04 | FromDiscord | <morgan> oh maybe i shouldm |
18:56:10 | FromDiscord | <morgan> (edit) "shouldm" => "shouldn't use casts" |
18:57:23 | * | junaid_ quit (Remote host closed the connection) |
19:02:53 | FromDiscord | <morgan> i think it's still my code https://media.discordapp.net/attachments/371759389889003532/1138185510188236950/invdist_kernel_512.png |
19:05:40 | FromDiscord | <Phil> Okay this is kind of getting into weird territory a bit |
19:06:25 | FromDiscord | <djazz> looks like dithering lol |
19:06:41 | FromDiscord | <Phil> I meant more the thing I was about to write ^^ |
19:07:28 | FromDiscord | <morgan> yeah i think something is wrong with how it's interpreting the data |
19:08:20 | FromDiscord | <morgan> https://media.discordapp.net/attachments/371759389889003532/1138186881662734428/invdist_kernel_512.png |
19:08:54 | FromDiscord | <morgan> maybe i should only turn it to an int at the end when im converting the tensor to a seq |
19:09:53 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CLq |
19:10:08 | FromDiscord | <Phil> Because `generateMapCall` only builds the NimNode, it doesn't evaluate it in any manner |
19:10:29 | FromDiscord | <Phil> mapper only kind of inserts the NimNodes with the expressions into a procBody, I'm not sure that gets evaluated there either |
19:11:01 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4CLq" => "https://play.nim-lang.org/#ix=4CLr" |
19:12:09 | FromDiscord | <Phil> I'm also uncertain if it is even possible to bind a generic proc since generic procs aren't real |
19:16:42 | FromDiscord | <morgan> yeah if i switch everything over to 8 bit it works |
19:16:43 | FromDiscord | <morgan> grr |
19:17:08 | FromDiscord | <morgan> i don't really need 16 bit for this but i do need it for other stuff |
19:18:21 | FromDiscord | <Phil> maybe there's weird stuff with int and uint? |
19:19:08 | FromDiscord | <Chronos [She/Her]> In reply to @isofruit "Ohh basically a string": Helpful for when dealing with very very long strings for editing code for example |
19:19:50 | FromDiscord | <Chronos [She/Her]> Also hi fellow transfem |
19:19:51 | FromDiscord | <morgan> it is nice to see something intended coming out of it tho https://media.discordapp.net/attachments/371759389889003532/1138189782602764389/invdist_kernel_512.png |
19:20:08 | FromDiscord | <Phil> Oh, that looks kinda nice! |
19:20:22 | FromDiscord | <Phil> Like a flashlight shining into the abyss |
19:20:33 | FromDiscord | <morgan> yea i'm going to use it for prebaked glow convolution |
19:21:12 | FromDiscord | <morgan> horizontal for the value it writes in a line, vertical for the input level on the second pass, since it's not normally separable |
19:21:17 | FromDiscord | <Phil> The fascinating thing is it looks brighter the longer I look at it |
19:21:27 | FromDiscord | <Phil> But at the first moment basically just black |
19:22:18 | FromDiscord | <morgan> and part of my plan is that i can scale the prebaked glow images to change the percieved intensity, but that requires a lot of dynamic range |
19:22:33 | FromDiscord | <morgan> hence 16 but |
19:22:38 | FromDiscord | <morgan> (edit) "but" => "bit" |
19:24:24 | FromDiscord | <morgan> i scaled the distance on that so it was even visible |
19:24:40 | FromDiscord | <morgan> 10 times wider than it would be |
19:25:13 | FromDiscord | <morgan> and it's just 1 divided by the distance, but i think it's a really good model of light falloff |
19:25:26 | FromDiscord | <morgan> compared to a gaussian blur for example |
19:40:25 | * | advesperacit quit () |
20:21:19 | * | ntat quit (Quit: leaving) |
20:55:16 | FromDiscord | <dersnof> what is Nim used best for |
20:59:14 | FromDiscord | <huantian> programming |
20:59:30 | FromDiscord | <roupi.rb> lol |
20:59:49 | FromDiscord | <dersnof> wow |
21:00:21 | FromDiscord | <roupi.rb> you should add a "hope i was useful" |
21:09:39 | FromDiscord | <saint._._.> sent a code paste, see https://play.nim-lang.org/#ix= |
21:09:50 | FromDiscord | <saint._._.> I'm getting this as an error in my nim lsp the moment I open any file |
21:10:10 | FromDiscord | <saint._._.> Any idea what is going on? |
21:57:11 | FromDiscord | <morgan> welp i think im gonna instead store 32 bits in a rgba png as 4 chunks of 8 bits |
21:57:36 | FromDiscord | <morgan> as long as my code on the other end handles that it should be fine |
21:58:15 | FromDiscord | <morgan> and one of them would be the 8 bit version of it assuming it's the same range and not prescaled for more range when added at runtime |
21:58:31 | FromDiscord | <morgan> oh yeah just do 24 bit rgb then |
22:05:43 | FromDiscord | <Phil> Do we have any way of annotating proc parameters in a way that other macros can pick up?↵Because I know I can annotate parameters with a pragma, I just can't see them afterwards in the AST |
22:06:20 | FromDiscord | <Phil> And using hasCustomPragma is a tad difficult on NimNode, at least for me that's not working successfully |
22:07:19 | FromDiscord | <ieltan> sent a long message, see http://ix.io/4COE |
22:16:15 | * | jmdaemon joined #nim |
22:17:54 | FromDiscord | <bostonboston> The other huge sell for Nim is that it compiles to C before machine code, meaning that anything that has a C compiler can run nim |
22:32:51 | FromDiscord | <ieltan> sent a long message, see http://ix.io/4COJ |
22:33:16 | FromDiscord | <ieltan> (edit) "http://ix.io/4COJ" => "http://ix.io/4COK" |
22:39:32 | FromDiscord | <that_dude.> In reply to @isofruit "Do we have any": Would effects be useful here? |
22:40:25 | FromDiscord | <that_dude.> Though I think they're proc only |
22:43:15 | * | xet7 quit (Remote host closed the connection) |
22:43:56 | FromDiscord | <morgan> In reply to @ieltan "There is also a": ooo |
22:55:18 | * | xet7 joined #nim |
23:35:19 | FromDiscord | <5starrss> how whould i center this guys? |
23:42:16 | FromDiscord | <5starrss> https://media.discordapp.net/attachments/371759389889003532/1138255819666886809/image.png |
23:44:33 | FromDiscord | <intellij_gamer> Probably a combo of [align](https://nim-lang.org/docs/strutils.html#align%2Cstring%2CNatural%2Cchar) and [terminalWidth](https://nim-lang.org/docs/terminal.html#terminalWidth) |
23:47:48 | FromDiscord | <5starrss> can you help me 😦 |
23:48:34 | FromDiscord | <5starrss> im gonna go whatch some youtube tutorials |
23:48:40 | FromDiscord | <5starrss> but im in class rn |
23:48:51 | FromDiscord | <5starrss> and there's really not that much tutorials |
23:51:42 | FromDiscord | <leetnewb> What part of those functions is tripping you up? |
23:54:25 | FromDiscord | <nomad> is pixie a pure library? |
23:55:20 | FromDiscord | <5starrss> In reply to @leetnewb "What part of those": everything im so new to nim |
23:55:32 | FromDiscord | <5starrss> im trying to find a good tutorail but i cant 🤣 |
23:57:49 | FromDiscord | <leetnewb> It might not answer this specific question, but you might consider reading some of this: https://ssalewski.de/nimprogramming.html |
23:57:55 | FromDiscord | <ajusa> In reply to @nomad "is pixie a pure": Yes? No non-Nim dependencies if that's what you are asking |
23:59:11 | FromDiscord | <nomad> In reply to @ajusa "Yes? No non-Nim dependencies": so no dlls needed? |