00:14:47 | * | lumo_e quit (Ping timeout: 255 seconds) |
00:16:42 | FromDiscord | <sa-code> Hey all. Here's an implementation of python's fsspec in nim https://github.com/sa-/filesystem_concept/blob/main/src/filesystem_concept.nim |
00:17:00 | FromDiscord | <sa-code> If you have a look, feedback would be appreciated |
00:17:19 | FromDiscord | <T0lk1en> Hey guys how do you add nim syntax highlighting to Melvin |
00:17:31 | FromDiscord | <T0lk1en> Neovim |
00:19:28 | FromDiscord | <T0lk1en> I tried installing the package manager and installing the nim syntax package but that doesn’t seem t |
00:19:32 | FromDiscord | <T0lk1en> To work |
00:20:39 | FromDiscord | <jtv> In reply to @sa-code "If you have a": Feedback on what? There's 20 lines of stubbing and proxying existing local calls, and nothing else, so it's hard to give feedback. |
00:21:50 | FromDiscord | <sa-code> In reply to @jtv "Feedback on what? ": If there's no feedback then that's fine too |
00:24:04 | FromDiscord | <sa-code> if anyone is interested in creating an s3/gcp client for this feel free to do it in a new repo or add it here |
00:27:23 | FromDiscord | <Elegantbeef> Yea there's not much to say, it's a concept that doesnt even make much sense |
00:27:33 | FromDiscord | <Elegantbeef> `sizes` for instance will not work without `views` |
00:27:56 | FromDiscord | <Elegantbeef> `: openarray[int]` is not capable of being instantiated |
00:28:40 | FromDiscord | <T0lk1en> In reply to @T0lk1en "Hey guys how do": Any help appreciated |
00:28:59 | FromDiscord | <Elegantbeef> https://github.com/alaviss/nim.nvim works for me |
00:29:34 | FromDiscord | <T0lk1en> See that the thing. I can’t seem to install the plug manager |
00:29:46 | FromDiscord | <T0lk1en> Even when I run the script |
00:29:49 | FromDiscord | <Elegantbeef> https://github.com/junegunn/vim-plug#neovim |
00:30:00 | FromDiscord | <Elegantbeef> https://github.com/junegunn/vim-plug#usage |
00:37:45 | FromDiscord | <Elegantbeef> If that still doesnt work, what have you done, and what OS are you on |
00:38:16 | FromDiscord | <Nilts> How would I go about making a non recursive node visitor. The errors are making me think recursion is bad. |
00:38:50 | FromDiscord | <T0lk1en> In reply to @Elegantbeef "If that still doesnt": It worked after reboot. I’m on Linux ofc |
00:38:58 | FromDiscord | <T0lk1en> Linux |
00:39:06 | FromDiscord | <Elegantbeef> Linux |
00:39:08 | FromDiscord | <Elegantbeef> Linux |
00:40:01 | FromDiscord | <jtv> What's wrong w/ Linux? It needs the magic reboot to fix far less than every other OS 🙂 |
00:40:17 | FromDiscord | <jtv> I mean, beyond user experience, of course |
00:40:40 | FromDiscord | <huantian> Still needs it tho |
00:40:44 | FromDiscord | <huantian> Looks at you nvidia drivers |
00:43:09 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4m2X here's a simple BF traversal |
00:43:15 | FromDiscord | <Elegantbeef> breadth first i should write |
00:43:31 | FromDiscord | <Elegantbeef> Really should stop writing abrv. |
00:44:07 | FromDiscord | <Elegantbeef> There are many ways to traverse a graph |
00:46:38 | FromDiscord | <jtv> Breadth first generally requires much more state management and is mostly frowned upon for those reasons except for the few problems where it's clearly the right way to go for the problem you're trying to solve |
00:47:36 | FromDiscord | <jtv> If you're getting errors with your recursion, then you are doing something wrong unless your tree depth is enormous, in which case you're probably doing something wrong 🙂 |
00:48:50 | FromDiscord | <Elegantbeef> Stack go boom |
00:49:22 | FromDiscord | <Nilts> In reply to @jtv "If you're getting errors": i don |
00:49:32 | FromDiscord | <Nilts> (edit) "don" => "don't think anything is wrong" |
00:50:00 | FromDiscord | <Nilts> (edit) "wrong" => "wrong, except for the fact that there should be closer to 500 recursions, not 2000" |
00:50:34 | FromDiscord | <Elegantbeef> Are you just changing your algo cause of Nim's default stack call limit? |
00:50:44 | FromDiscord | <jtv> What's the data you're working with that's nested 500 nodes deep??? |
00:50:57 | FromDiscord | <Elegantbeef> In before it's a cyclical graph |
00:51:13 | FromDiscord | <jtv> If it's a cyclical graph you're probably not doing a good job detecting the cycles. |
00:51:31 | FromDiscord | <Nilts> In reply to @Elegantbeef "In before it's a": what is a cyclical graph |
00:51:46 | FromDiscord | <jtv> Cycle == circle |
00:51:52 | FromDiscord | <Elegantbeef> A graph that points to itself in a circular manner |
00:52:43 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4m2Y |
00:53:12 | FromDiscord | <Elegantbeef> Simmered down to that example |
00:53:20 | FromDiscord | <Nilts> In reply to @jtv "If it's a cyclical": probably not, it's not even a graph, and the visitor is being used for an interpreter, thats why it goes so dep |
00:53:25 | FromDiscord | <Nilts> (edit) "dep" => "deep" |
00:54:51 | FromDiscord | <jtv> "It's not a graph", what does that mean? It sounds like it is not a tree, and not a DAG, but when you're talking about navigating around links between objects, all that's left is a graph (the most general thing) |
00:55:30 | FromDiscord | <jtv> Would be good to get some more detail to be able to help |
00:55:36 | FromDiscord | <Nilts> In reply to @jtv ""It's not a graph",": i am so confused. |
00:55:52 | FromDiscord | <Nilts> In reply to @jtv "Would be good to": what kind of detail |
00:55:57 | FromDiscord | <Elegantbeef> We're even more confused |
00:56:06 | FromDiscord | <Elegantbeef> Use your words to explain exactly what you're doing and what's wrong |
00:56:17 | FromDiscord | <Elegantbeef> Hell even giving the type definition goes a long way |
00:57:53 | FromDiscord | <Nilts> In reply to @Elegantbeef "Use your words to": I'm trying to git rid of really deep recursions for jump stmts in my interpreter, and i don't know how i would go about doing it. |
01:02:59 | FromDiscord | <jtv> I've written many, many, many interpreters over the last 30+ years, and I'm hard pressed to come up with anything in any of those implementations that would merit the depth of recursion you're talking about, so I'd still say it's way too light on detail to be helpful. We'd need something more concrete. |
01:04:52 | FromDiscord | <Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4m31 |
01:05:31 | FromDiscord | <jtv> Only if you're implementing jump with a function call which nobody ever would |
01:06:12 | FromDiscord | <Elegantbeef> A jump target likely should be either an address in bytecode or your ast data |
01:06:48 | FromDiscord | <jtv> Function calls are there to save and restore context via a stack. If you don't need that, why pay the price?? You're just wasting CPU and memory |
01:07:38 | FromDiscord | <Elegantbeef> Do you compile to bytecode? |
01:07:51 | FromDiscord | <Elegantbeef> What's your current operating mechanism |
01:09:27 | FromDiscord | <jtv> I suspect from the description it's like a lot of early basic interpreters, just REPL loops, parsing line by line, and some state? |
01:09:41 | FromDiscord | <Elegantbeef> Yea that's what i figure aswell |
01:09:52 | FromDiscord | <Elegantbeef> Which to that i say "Implement a proper interpreter" |
01:10:26 | FromDiscord | <jtv> Yeah, there's a reason nobody's written an interpreter of any merit like that since the early 80's 🙂 |
01:11:13 | FromDiscord | <jtv> But even then, "jump" is just "load this memory address instead for the next instruction" |
01:12:00 | FromDiscord | <Nilts> In reply to @Elegantbeef "A jump target likely": how do i addr ast data and how would implement this. |
01:12:05 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4m32 |
01:12:22 | FromDiscord | <Elegantbeef> Well I'd not suggest the using AST data |
01:12:29 | FromDiscord | <Elegantbeef> I'd suggest compiling to byte code |
01:12:50 | FromDiscord | <Nilts> In reply to @Elegantbeef "I'd suggest compiling to": that is a compiler, not a interpreter |
01:12:57 | FromDiscord | <Elegantbeef> Nope |
01:13:04 | FromDiscord | <jtv> No most interpreters use byte code |
01:13:09 | FromDiscord | <Elegantbeef> Bytecode is used by all the popular interpreters |
01:13:30 | FromDiscord | <Elegantbeef> Compiling your code to byte code is the sensible thing. Your VM turns into a basic CPU practically |
01:13:45 | FromDiscord | <Elegantbeef> You have a group of built in operations that the users use to do things |
01:14:10 | FromDiscord | <Elegantbeef> A bytecode interpreter very much is "you own little CPU project" |
01:14:43 | FromDiscord | <Nilts> In reply to @Elegantbeef "Bytecode is used by": I'm trying to make a "basic" interpreter. Not something like your describing, I don't have nearly enough skill to do a full-blown one |
01:14:55 | FromDiscord | <Elegantbeef> Everyone has the skill too |
01:15:06 | FromDiscord | <Elegantbeef> https://craftinginterpreters.com/ |
01:15:28 | FromDiscord | <jtv> I mean, if you still parse each statement into a tree, you can just execute out of the tree without a VM, but that's really not that scalable a solution |
01:15:51 | FromDiscord | <Elegantbeef> It's slow and also a memory hog 😄 |
01:16:06 | FromDiscord | <Elegantbeef> Not being scared of byte code is much easier imo |
01:17:11 | FromDiscord | <jtv> No, it's not slow if it's interactive, and saves the cost of generating the byte code that isn't likely to get reused. But it's not good for general purpose stuff, no |
01:17:36 | FromDiscord | <Nilts> I guess asking this server help is out of my scope for this project. I have some sense of how this interpreter would work, i have no idea how bytecode works |
01:17:42 | FromDiscord | <Nilts> (edit) "I guess asking this server ... help" added "for" |
01:18:09 | FromDiscord | <jtv> Well, if you tell me more about how you're representing code and your execution model, I can probably help |
01:19:16 | FromDiscord | <Nilts> In reply to @jtv "Well, if you tell": sorry for my stupidity but what is an execution model and what do you mean by "how you're representing code" |
01:19:43 | FromDiscord | <jtv> Just tell me about how your interpreter actually works, what you're doing under the hood. |
01:20:11 | FromDiscord | <jtv> Am I typing in code and hitting enter? And then what do you do once I hit enter? |
01:20:13 | FromDiscord | <jtv> ETC |
01:20:36 | FromDiscord | <Nilts> In reply to @jtv "Just tell me about": I visit an ast node, and if needed enter a new scope and execute children and sometime return a value. |
01:20:41 | FromDiscord | <Nilts> In reply to @jtv "Am I typing in": no |
01:21:10 | FromDiscord | <jtv> So you are parsing an entire file into a tree, and then trying to execute directly out of the tree. |
01:21:15 | FromDiscord | <Nilts> (edit) "no" => "no, your typing out a file" |
01:21:19 | FromDiscord | <Nilts> yes |
01:22:28 | FromDiscord | <jtv> So do you have a node that represents the entry of a loop, then? |
01:22:46 | FromDiscord | <jtv> And when you get to it, you evaluate the condition, and then maybe go down the tree? |
01:22:48 | FromDiscord | <Nilts> In reply to @jtv "So do you have": like the flag or jump block? |
01:23:38 | FromDiscord | <jtv> Your AST for that loop, what does it look like? |
01:26:12 | FromDiscord | <jtv> By the way, looking closely at the code, it's an infinite loop, you jump to your target in both branches |
01:28:20 | FromDiscord | <jtv> But a jump should never require a function call in any interpreter. If you're evaluating out a tree, your 'current node' starts at the top of the loop. It's got a series of children you execute in order, and then when you have no more statements on that list, you go back to the loop node, bump your counter if it has those semantics built in, evaluate the condition, and either to it again or move on to the next statement "after" the loop. |
01:29:03 | FromDiscord | <jtv> You might be deep in a sub-tree, but if you design things right, you can just set the "current node" |
01:29:08 | FromDiscord | <Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4m36 |
01:29:34 | FromDiscord | <jtv> And if you don't design things right, if you have a jump up to a loop top, you can always use an exception to do that. |
01:30:09 | FromDiscord | <Nilts> In reply to @jtv "And if you don't": what do you mean? |
01:30:57 | FromDiscord | <jtv> so you probably have some handleStmtList() that calls FlagStm() that calls StmtList() that calls... down to where you get to the jump. |
01:31:39 | FromDiscord | <jtv> If you're executing out of a tree like this and you're doing it that way, you can, when you enter flagStmt(), do a try: block |
01:32:11 | FromDiscord | <jtv> Then the jump can throw an exception, which will unwind your call stack back to the FlagStmt node |
01:32:34 | FromDiscord | <jtv> At which point, the node can look at whatever arg you passed in an exception to see what to do |
01:33:28 | FromDiscord | <jtv> Generally if you do it that way, arbitrary jump labels aren't a great idea, best to use higher-level loop nodes and "break" and "continue" to labels, so they're easily modeled through exception handling |
01:34:26 | FromDiscord | <Nilts> In reply to @jtv "Generally if you do": I was going to say, what you were suggesting was more fit to break or contiune |
01:34:33 | FromDiscord | <Nilts> (edit) "contiune" => "continue" |
01:36:58 | FromDiscord | <jtv> Well, you can still do arbitrary labels, just unwind and let something else take care of it. With jmp you'd normally unwind to the function call, and then start walking from the target node. Or, you don't need to use recursion to change where you are in your tree state, you just use a loop and move your pointer into it. |
01:38:35 | FromDiscord | <jtv> But like Beef said, unless you really know what you're doing, it's actually EASIER and generally more efficient to just walk the tree once and generate byte code, even if each node type is it's own instruction in your VM. |
01:39:06 | FromDiscord | <jtv> You only do one tree walk that way, and the rest of it is just a stack and a pointer to the current instruction |
01:39:22 | FromDiscord | <jtv> You don't have to use some 3rd party VM that's overly complicated or optimized |
01:40:15 | FromDiscord | <Nilts> In reply to @jtv "But like Beef said,": Wait so most interpreted languages are like this?↵`Code -> Compile (to bytecode) -> run on VM` |
01:40:25 | FromDiscord | <jtv> Yes |
01:40:30 | FromDiscord | <Nilts> so isn't that just java |
01:40:45 | FromDiscord | <Elegantbeef> Is lua just java? |
01:41:17 | FromDiscord | <jtv> You could look at it another way... you're basically converting your tree into an array of instructions and data, and then using a stack to walk it in a much more managable way |
01:41:17 | FromDiscord | <Nilts> In reply to @not logged in "so isn't that just": ( I thought java was compiled) |
01:41:31 | FromDiscord | <Elegantbeef> Welcome to word semantics |
01:41:44 | FromDiscord | <Elegantbeef> 'compiled' is a loose term to "Moving down to lower level" |
01:41:50 | FromDiscord | <jtv> Java is COMPILED JVM byte code is "interpreted" |
01:42:10 | FromDiscord | <Nilts> In reply to @jtv "You could look at": then it's the same as a compiler, just one compiles machine code and one compiles to byte code |
01:42:21 | FromDiscord | <jtv> At some point, SOMETHING looks at an instruction, and some data, and does work based on it. |
01:42:28 | FromDiscord | <jtv> You're already compiling to a tree |
01:42:34 | FromDiscord | <jtv> And interpreting from the tree |
01:42:39 | FromDiscord | <jtv> 🤷 |
01:43:04 | FromDiscord | <jtv> We're just saying you should have a much better IR that's more suited to the interpreting piece |
01:43:26 | FromDiscord | <Elegantbeef> Intermediate representation |
01:44:13 | FromDiscord | <jtv> compilers take code and produce output that is meant to run on some abstract machine. It might be physical hardware, or it might just be the code you're using to walk your tree |
01:44:19 | FromDiscord | <jtv> But still, it's what you're doing. |
01:44:27 | FromDiscord | <Nilts> I just had a realization moment. All programming languages are this:↵`Zero or more Compiler -> Interpreter` |
01:44:37 | FromDiscord | <jtv> Yes correct. |
01:45:16 | FromDiscord | <Elegantbeef> Virtual machine afterall is synonymous for "pretend CPU" |
01:45:37 | FromDiscord | <jtv> Or, more precisely, there are multiple transformations that lead to code that can be executed on some virtual machine, but you can always then translate it to some other machine 🙂 |
01:45:45 | FromDiscord | <Nilts> So how would i go about the whole bytecode thing. |
01:45:48 | FromDiscord | <jtv> Just your virtual machine is an ad hoc tree walk |
01:46:17 | FromDiscord | <Elegantbeef> Wasm based CPU when |
01:46:30 | FromDiscord | <Nilts> whut |
01:48:49 | FromDiscord | <jtv> Hmm, hard to explain simply I'm looking around for code I might be able to hand you. But it's nothing tough |
01:49:13 | FromDiscord | <jtv> Maybe a simple example. Let's say you have a PLUS node. You're walking the tree to generate code, you get to the plus node |
01:49:17 | arkanoid | if I have a const array, can I still use myarr[0].unsafeAddr to make it available in linked C code? |
01:49:49 | FromDiscord | <jtv> Your generated code for plus could be: evaluate the LHS, pushing it onto the stack. evaluate the RHS, pushing it onto the stack. Pop two values and add them |
01:50:08 | FromDiscord | <jtv> And leave the result on the stack |
01:50:21 | FromDiscord | <Elegantbeef> Dont think so arkanoid |
01:50:39 | FromDiscord | <jtv> So if you have (2+2)<-ADD->(2+2) |
01:50:47 | FromDiscord | <Nilts> In reply to @jtv "Maybe a simple example.": I know exactly where i would put this. Also wtf is LHS RHS also what is "stack" |
01:50:47 | FromDiscord | <jtv> Where the middle one is the top of your tree |
01:50:55 | FromDiscord | <jtv> lhs == left hand side |
01:50:58 | arkanoid | Elegantbeef, ok. Thanks |
01:51:00 | FromDiscord | <jtv> rhs = right hand side |
01:51:32 | FromDiscord | <jtv> So you get to that first add-node, and you will generate the code for the left hand side, first. you get to that second node on the left, |
01:51:34 | FromDiscord | <jtv> It's another + |
01:51:43 | FromDiscord | <jtv> It goes down to the 2 which is an immediate |
01:51:50 | FromDiscord | <jtv> Your code for that is "push 2 onto the stack" |
01:52:00 | FromDiscord | <jtv> Then you go the right of that left hand plus |
01:52:06 | FromDiscord | <jtv> You push another 2 |
01:52:24 | FromDiscord | <jtv> (i.e., you output something to say to do those things |
01:52:56 | FromDiscord | <jtv> And then, once you've done that, you output something that says, "take two numbers from the top of the stack, add them, and put the result on the stack" |
01:53:02 | FromDiscord | <jtv> That's probably your "ADD" instruction |
01:53:17 | FromDiscord | <jtv> So like I said, one instruction per tree-node generally can work |
01:53:54 | FromDiscord | <jtv> You'd end up with data in an array that's: [PUSH 2, PUSH 2, ADD, PUSH 2, PUSH 2, ADD, ADD] |
01:54:14 | FromDiscord | <jtv> And then you'd execute from the top of the array 🙂 |
01:54:27 | FromDiscord | <Nilts> In reply to @jtv "So like I said,": but then how is this different the just interpreting the ast |
01:54:40 | FromDiscord | <jtv> The stuff in the array is now "byte code" 😉 |
01:54:49 | FromDiscord | <Nilts> In reply to @jtv "You'd end up with": so (2+2)+(2+2) |
01:54:52 | FromDiscord | <jtv> And you can now just jump around the array |
01:54:55 | FromDiscord | <jtv> You have no more tree |
01:55:02 | FromDiscord | <jtv> Just a stack for pushing and popping |
01:56:01 | FromDiscord | <Nilts> In reply to @jtv "And you can now": ohhhh, so advanced flattening. Is there any good reason then to have an ast tree? Or should the parsed data go directly to bytecode |
01:56:02 | FromDiscord | <jtv> Yes, was trying on my phone to show the tree you'd typically have for (2+2)+(2+2) yes |
01:56:21 | FromDiscord | <jtv> It's always best to do one phase at a time. |
01:56:39 | FromDiscord | <jtv> Get an AST. Even if you could go directly to byte code, it'll make things harder to debug |
01:56:56 | FromDiscord | <jtv> And if you ever want to optimize, a tree is easier to work with for most optimizations |
01:57:09 | FromDiscord | <jtv> Trees are bad for execution 🙂 |
01:57:28 | FromDiscord | <Nilts> 👍 thanks alot! I went from 0 understanding to some understanding! |
01:58:50 | FromDiscord | <jtv> No problem. I'm around plenty if you need more help. I've taught compilers and languages at the uni level more than a few times, so if we both have the time and patience, I know how to help people on these things reasonably well |
02:00:10 | FromDiscord | <Nilts> In reply to @jtv "No problem. I'm": I probably will, should i ping you if i need help on this topic? |
02:00:59 | FromDiscord | <jtv> Sure, but I'm generally either on discord or I'm not going to see it till I am 🙂 |
02:01:08 | FromDiscord | <jtv> But you're welcome to do so |
02:24:01 | FromDiscord | <T0lk1en> https://www.reddit.com/r/nim/comments/10juowv/cant_get_syntax_highlighting_neovim/?utm_source=share&utm_medium=ios_app&utm_name=iossmf |
02:24:06 | FromDiscord | <T0lk1en> Can someone help me out |
02:24:15 | FromDiscord | <T0lk1en> Been going at this for 48 hours |
02:24:49 | FromDiscord | <Elegantbeef> I was trying to help |
02:24:51 | FromDiscord | <Elegantbeef> You never gave any more information |
02:26:00 | FromDiscord | <T0lk1en> I’m not sure what to give |
02:26:11 | FromDiscord | <T0lk1en> Plug install works(sometimes) |
02:26:24 | FromDiscord | <T0lk1en> I gave the package I’m trying to plug |
02:26:44 | FromDiscord | <T0lk1en> I’m on artix Linux |
02:27:10 | FromDiscord | <Elegantbeef> What's your `init.vim` look like? |
02:27:18 | FromDiscord | <T0lk1en> Lemme get it rq |
02:29:19 | FromDiscord | <T0lk1en> Syntax on |
02:29:27 | FromDiscord | <T0lk1en> Set expand tab |
02:29:31 | FromDiscord | <T0lk1en> Set number |
02:29:48 | FromDiscord | <T0lk1en> Set shiftwidth=2 |
02:30:02 | FromDiscord | <Elegantbeef> So you didnt add the plugin |
02:30:09 | FromDiscord | <T0lk1en> Call plug#beginin() |
02:30:29 | FromDiscord | <T0lk1en> Plug ‘(plug name)’ |
02:30:38 | FromDiscord | <T0lk1en> Call plug#end() |
02:30:43 | FromDiscord | <Elegantbeef> ... |
02:30:51 | FromDiscord | <Elegantbeef> You do not make it easy to help you |
02:30:52 | FromDiscord | <T0lk1en> I called it |
02:30:55 | FromDiscord | <Elegantbeef> Paste your config on a file |
02:31:08 | FromDiscord | <T0lk1en> Aight |
02:32:12 | FromDiscord | <T0lk1en> My bad |
02:36:17 | FromDiscord | <T0lk1en> https://media.discordapp.net/attachments/371759389889003532/1067271594390589461/init.vim |
02:37:01 | FromDiscord | <Elegantbeef> Ok so you then did `:PlugInstall!`? |
02:37:25 | FromDiscord | <T0lk1en> yes |
02:37:53 | FromDiscord | <Elegantbeef> Did it error? |
02:37:58 | FromDiscord | <Elegantbeef> Was there any output?! |
02:38:25 | FromDiscord | <T0lk1en> no it doesnt error |
02:38:33 | FromDiscord | <Elegantbeef> So then you opened a `.nim` file |
02:38:39 | FromDiscord | <T0lk1en> but when i source init i get this error |
02:38:42 | FromDiscord | <Elegantbeef> And was there any issue or did it error |
02:38:53 | FromDiscord | <T0lk1en> yes i open a nim file and get no syntax highliting |
02:39:03 | FromDiscord | <T0lk1en> https://github.com/alaviss/nim.nvim |
02:39:06 | FromDiscord | <T0lk1en> im using this |
02:39:33 | FromDiscord | <T0lk1en> /bash: syntax: command not found↵bash: init.vim: line 7: syntax error near unexpected token `('↵bash: init.vim: line 7: `call plug#begin()' |
02:39:44 | FromDiscord | <T0lk1en> i get this error when trying to source |
02:40:37 | FromDiscord | <Elegantbeef> Why are you using bash on init.vim? |
02:40:51 | FromDiscord | <T0lk1en> im not |
02:40:55 | FromDiscord | <T0lk1en> im running |
02:41:03 | FromDiscord | <T0lk1en> /source init.vim |
02:41:11 | FromDiscord | <Elegantbeef> Why? |
02:41:18 | FromDiscord | <Elegantbeef> `nvim test.nim` |
02:41:33 | FromDiscord | <T0lk1en> lemme see |
02:41:55 | FromDiscord | <T0lk1en> wtf |
02:42:01 | FromDiscord | <T0lk1en> it works now i guess |
02:42:05 | FromDiscord | <T0lk1en> thanks? |
02:42:06 | FromDiscord | <T0lk1en> lol |
02:42:44 | FromDiscord | <Elegantbeef> ... |
02:43:12 | FromDiscord | <T0lk1en> i think it had somethinf to do with the file i was working onm |
02:51:47 | * | argonica joined #nim |
03:37:19 | * | rockcavera quit (Remote host closed the connection) |
03:37:37 | FromDiscord | <Iliketwertles> sent a code paste, see https://play.nim-lang.org/#ix=4m3o |
03:37:39 | FromDiscord | <Iliketwertles> code in a sec |
03:39:40 | FromDiscord | <Iliketwertles> sent a code paste, see https://paste.rs/Utx |
03:39:50 | FromDiscord | <Iliketwertles> (edit) "https://play.nim-lang.org/#ix=4m3p" => "https://play.nim-lang.org/#ix=4m3q" |
03:40:00 | FromDiscord | <Iliketwertles> https://media.discordapp.net/attachments/371759389889003532/1067287624424882297/passwordmababoer.nim |
03:41:22 | FromDiscord | <Iliketwertles> code is ugly ik |
03:43:28 | FromDiscord | <jtv> Well, the default mode for open is fmRead |
03:43:33 | * | sugarbeet joined #nim |
03:43:33 | FromDiscord | <jtv> And you're trying to write to it |
03:43:38 | FromDiscord | <Rika> Was going to say |
03:43:39 | * | sugarbeet left #nim (#nim) |
03:44:08 | FromDiscord | <jtv> you need to open as fmReadWrite; and then are you appending? Or overwriting? Because you need to deal w/ the old data too |
03:45:51 | FromDiscord | <Iliketwertles> In reply to @jtv "you need to open": appending on a new line |
03:46:51 | FromDiscord | <jtv> So definitely open(filename, fmReadWrite) |
03:52:45 | FromDiscord | <Iliketwertles> still getting the error |
03:55:17 | FromDiscord | <Iliketwertles> now its not even writing the first string to the file |
03:56:36 | FromDiscord | <Iliketwertles> https://media.discordapp.net/attachments/371759389889003532/1067291804707328030/screenshot_2023-01-23-225658.png |
03:56:42 | FromDiscord | <Iliketwertles> kinda lied but still |
04:00:32 | * | arkurious quit (Quit: Leaving) |
04:12:14 | * | pbsds quit (Quit: The Lounge - https://thelounge.chat) |
04:13:28 | FromDiscord | <Iliketwertles> i think it got it working |
04:13:56 | * | argonica quit (Quit: Leaving) |
04:14:14 | * | pbsds joined #nim |
04:22:34 | FromDiscord | <Iliketwertles> well |
04:23:48 | FromDiscord | <Iliketwertles> broken https://media.discordapp.net/attachments/371759389889003532/1067298649115209789/screenshot_2023-01-23-232406.png |
04:24:52 | FromDiscord | <Iliketwertles> https://media.discordapp.net/attachments/371759389889003532/1067298917424828456/passwordmababoer.nim |
04:33:27 | FromDiscord | <Girvo> Is there a nim-only key-value file store library floating around? Searched on nimble but only seemed to find C wrappers |
04:37:29 | FromDiscord | <T0lk1en> Yo I’m on Linux and when I try to compile a program that has an installed library it can’t seem to see it. I have the path set in bashrc. Any suggestions |
04:41:43 | FromDiscord | <T0lk1en> It says cannot open file: sysinfo |
04:41:57 | FromDiscord | <T0lk1en> Which is the package I’ve installed |
04:47:59 | FromDiscord | <m4ul3r> In reply to @Girvo "Is there a nim-only": https://nim-lang.org/docs/tables.html |
04:51:10 | FromDiscord | <Girvo> In reply to @m4ul3r "https://nim-lang.org/docs/tables.html": Sure, though it needs to be serialised in/out to a file too 🙂 figured I'd ask if there was something existing already |
04:51:42 | FromDiscord | <m4ul3r> In reply to @T0lk1en "Yo I’m on Linux": if you installed with nimble and made no config modifications, should be in `~/.nimble/pkgs` |
04:52:37 | FromDiscord | <T0lk1en> In reply to @m4ul3r "if you installed with": Yeah it’s there. It’s just that when I compile the program it doesn’t “see” it |
04:53:06 | FromDiscord | <m4ul3r> In reply to @Girvo "Sure, though it needs": Nim has a std/marshal, might work? |
04:53:59 | FromDiscord | <m4ul3r> Are you compiling as root? |
04:54:50 | FromDiscord | <T0lk1en> Yes |
04:56:16 | FromDiscord | <m4ul3r> Then you probably don't have the nimble package installed for root, it will search under `/root/.nimble/pkgs` |
04:56:25 | FromDiscord | <T0lk1en> Ah |
04:57:07 | FromDiscord | <T0lk1en> That was it thanks |
04:57:31 | FromDiscord | <T0lk1en> Clever clever |
04:58:48 | FromDiscord | <m4ul3r> yeah there's many different ways to go about setting that up, I would just compile as user and then chown it to root if it needs to be owned by root |
04:59:22 | FromDiscord | <T0lk1en> I just sudo nimble |
04:59:29 | FromDiscord | <T0lk1en> I guess that isn’t the best way but whatver |
05:00:25 | FromDiscord | <m4ul3r> it works, will just install packages at two different locations |
05:05:09 | FromDiscord | <T0lk1en> Yeah |
05:32:44 | FromDiscord | <Array in ∀ Matrix> @T0lk1en do u need to run the program as root? |
05:33:21 | FromDiscord | <T0lk1en> For some reason yes. It’s read only when opened without sudoedit |
05:33:41 | FromDiscord | <T0lk1en> I wouldn’t know why tho |
06:15:31 | * | argonica joined #nim |
07:03:25 | * | ltriant quit (Ping timeout: 252 seconds) |
07:18:56 | * | om3ga quit (Ping timeout: 260 seconds) |
07:19:06 | * | om3ga joined #nim |
07:22:23 | * | azimut quit (Ping timeout: 255 seconds) |
07:30:52 | * | argonica quit (Quit: Leaving) |
07:42:16 | * | byanka__ joined #nim |
07:42:25 | * | PMunch joined #nim |
07:45:39 | * | byanka_ quit (Ping timeout: 260 seconds) |
07:49:28 | * | FromDiscord quit (Ping timeout: 256 seconds) |
07:50:21 | * | FromDiscord joined #nim |
08:07:15 | * | argonica joined #nim |
08:46:08 | * | argonica quit (Quit: Leaving) |
10:20:12 | PMunch | Hmm, I have a macro which takes a symbol and generates a proc with that name. Now I want to log something in this generated proc with the name of the proc attached |
10:20:19 | PMunch | What would be the best way of doing that? |
10:20:40 | PMunch | Just putting the name in backticks in a string literal didn't work |
10:33:11 | FromDiscord | <demotomohiro> @PMunch How about to use `strVal` proc in macros module? https://nim-lang.org/docs/macros.html#strVal%2CNimNode |
10:33:32 | FromDiscord | <Rika> https://nim-lang.org/docs/system.html#astToStr%2CT |
10:33:42 | FromDiscord | <Rika> Or that sure |
10:43:47 | PMunch | astToStr is nice, means I don't need to have an extra macro to call strVal |
10:43:54 | PMunch | And I don't have to import macros |
10:50:34 | * | ltriant joined #nim |
11:51:33 | Amun-Ra | is there a difference between func foo(T: type Obj) and func foo(T: typedesc[Obj])? |
12:11:24 | PMunch | Amun-Ra: https://forum.nim-lang.org/t/7891 |
12:11:58 | PMunch | Basically `type Obj` is `typeof(Obj)` which returns `typedesc[Obj]` if I understood this correctly |
12:13:56 | FromDiscord | <Rika> its not recommended to use `type` in this context anymore |
12:14:01 | FromDiscord | <Rika> always use typedesc |
12:15:20 | Amun-Ra | oh |
12:55:39 | om3ga | Hi! how one would set name of thread using system/threads? |
13:05:08 | PMunch | om3ga, what do you mean? |
13:05:56 | FromDiscord | <Rika> threads have names? |
13:06:53 | PMunch | Apparently |
13:07:04 | PMunch | You can name them in both Windows and Linux it seems |
13:07:13 | PMunch | But I don't think Nim has this wrapped anywhere convenient |
13:07:44 | om3ga | PMunch: it's possible to set the name for specific thread |
13:08:58 | om3ga | using pthreads for example, if Im not mistaken function called pthread_setname function does that |
13:12:40 | PMunch | om3ga, doesn't appear to be wrapped in Nim unfortunately |
13:13:04 | PMunch | Which means you have to do it yourself if you want to use it |
13:13:47 | * | pbsds6 joined #nim |
13:13:59 | * | dv^_^8 joined #nim |
13:15:48 | * | Lord_Nightmare2 joined #nim |
13:17:16 | * | crem1 joined #nim |
13:19:12 | om3ga | PMunch: thanks, I will try to import it |
13:20:15 | * | mal``` joined #nim |
13:20:36 | * | pbsds quit (*.net *.split) |
13:20:37 | * | Lord_Nightmare quit (*.net *.split) |
13:20:37 | * | dv^_^ quit (*.net *.split) |
13:20:39 | * | crem quit (*.net *.split) |
13:20:40 | * | mal`` quit (*.net *.split) |
13:20:40 | * | pbsds6 is now known as pbsds |
13:20:40 | * | dv^_^8 is now known as dv^_^ |
13:20:40 | * | Lord_Nightmare2 is now known as Lord_Nightmare |
13:22:14 | PMunch | Damn it, my Vim just suddenly decides to stop supporting PgUp/PgDown.. |
13:29:51 | FromDiscord | <Phil> To be on the safe side, if I do a custom exception, I should inherit from `CatchableError` right? |
13:37:59 | Amun-Ra | depends, do you need such a broad type? |
13:38:36 | Amun-Ra | I usually inherit from ValueError (if I encounter value I didn't expect) |
13:41:19 | FromDiscord | <Phil> In reply to @Amun-Ra "depends, do you need": Not really, just trying to find a general "thing", I guess its better to inherit from the fitting "parentError" if yours is a specification of it. |
13:41:26 | FromDiscord | <Phil> (edit) "specification" => "specific sub-case" | "it." => "it" |
14:06:11 | Amun-Ra | I'd use CatchableError in this case |
14:54:57 | * | azimut joined #nim |
15:39:38 | * | arkurious joined #nim |
15:55:53 | FromDiscord | <deech> This might be of interest, it's a specific case of a team deciding not to adopt Nim due to issues around style insensitivity. Ironically this person was nervous not because of Nim's stance on sensitivity but because of the RFC to remove it. At this point it might be worth issuing an official set of immutable identifier equality rules that are no longer up for discussion, perhaps even with Nim 2.0. https://github.com/ziglang/zig/issues/14228 |
16:05:21 | FromDiscord | <Gumbercules> Leave it to dom to suggest changes that scare people away.... |
16:05:43 | FromDiscord | <Gumbercules> or entire companies rather |
16:07:40 | FromDiscord | <deech> It's not the fault of the person to brought it up but it should be closed with some official resolution. |
16:12:16 | FromDiscord | <Gumbercules> They could have helped provide that resolution though... |
16:12:56 | FromDiscord | <Gumbercules> but it's another loose thread and I imagine at this point since Andreas doesn't care, the answer is it will not be removed |
16:13:14 | FromDiscord | <Gumbercules> (edit) "but it's another loose thread and I imagine at this point since Andreas doesn't ... care," added "seem to" |
16:13:21 | FromDiscord | <Nerve> What in the heck is going on here? I am genuinely baffled. I use exported `const` tables all over the rest of this project and I have no clue why this error is only appearing here. https://media.discordapp.net/attachments/371759389889003532/1067477214792261652/table_type_error.png |
16:13:53 | FromDiscord | <Gumbercules> In reply to @Nerve "What in the heck": is `chan` a distinct int or something? |
16:13:59 | FromDiscord | <Gumbercules> (edit) "distinct int" => "`distinct int`" |
16:14:06 | FromDiscord | <Nerve> Nope, it's a string from a `seq[string]` |
16:16:00 | FromDiscord | <Gumbercules> did you `import tables` into that module? |
16:16:01 | FromDiscord | <Nerve> (edit) "Nope, it's a string from ... a" added "`channels` which is" |
16:16:18 | FromDiscord | <Nerve> Holy smokes you're right |
16:16:26 | FromDiscord | <Nerve> I keep forgetting `[]` is a proc |
16:16:37 | FromDiscord | <Nerve> NOT a universal syntax feature |
16:17:17 | FromDiscord | <Gumbercules> yeah, but this is nice since you can overload it |
16:17:29 | FromDiscord | <Nerve> Indeed |
16:17:45 | FromDiscord | <Gumbercules> glad we got it sorted 🙂 |
16:19:29 | FromDiscord | <Gumbercules> In reply to @deech "This might be of": might also be better to bring this up in #internals so it doesn't get drowned out in the noise |
16:19:30 | FromDiscord | <Nerve> Also how can you split statements/expressions/strings over multiple lines? I have a few long ones |
16:19:53 | FromDiscord | <Gumbercules> strings you can use `"""` |
16:20:51 | FromDiscord | <Gumbercules> https://github.com/Tail-Wag-Games/frag/blob/master/src/gfx.nim#L1048-L1049 |
16:20:58 | FromDiscord | <Nerve> What if it's supposed to be a single-line string but I need to define it across multiple lines? |
16:21:50 | FromDiscord | <Gumbercules> I imagine you need to do the `"\n" & "string continues here"` |
16:21:59 | FromDiscord | <Gumbercules> maybe parens would work, let me try in the playground |
16:24:05 | FromDiscord | <Gumbercules> sent a code paste, see https://paste.rs/ZIf |
16:25:14 | FromDiscord | <Nerve> oh, commas can be used to split lines? |
16:25:18 | FromDiscord | <Nerve> well |
16:25:24 | FromDiscord | <Nerve> that's just `echo` I imagine |
16:25:37 | FromDiscord | <Gumbercules> yeah echo takes a `vararg[string]` I think |
16:26:08 | FromDiscord | <Nerve> Well, guess I have a 183 column line for now |
16:26:51 | FromDiscord | <Gumbercules> 😄 |
16:26:58 | FromDiscord | <Gumbercules> there's probably a way I'm not aware of |
16:27:11 | FromDiscord | <Gumbercules> I don't do a ton of string manipulation with Nim though |
16:30:29 | FromDiscord | <Gumbercules> also @deech I know you brought it up in internals already, but this seems like such a silly reason to choose language X over language Y |
16:31:31 | FromDiscord | <Gumbercules> even if find and replace didn't exist, I'd be concerned with a lot of other aspects of the PL before style insensitivity became a sticking point |
16:31:44 | FromDiscord | <Gumbercules> maybe it's more an admonishment of Nim's development process |
16:31:49 | FromDiscord | <Gumbercules> (edit) "maybe it's more an admonishment of Nim's development process ... " added "/ transparency" |
16:31:50 | FromDiscord | <deech> In reply to @Gumbercules "also <@271498588981297157> I know": I don't think it is. In fact I'm personally not a fan of style insensitivity. I have a couple of posts in that thread but they are buried. |
16:31:51 | FromDiscord | <Phil> `Warning: See corresponding Defect; OverflowError is deprecated [Deprecated]`↵This warning means you should use OverflowDefect, correct? |
16:32:31 | FromDiscord | <Gumbercules> In reply to @deech "I don't think it": I will look for them |
16:32:35 | FromDiscord | <Phil> Though Defect is compile time and this nimforum code seems like a runtime error =/ |
16:33:39 | FromDiscord | <Phil> Wait, yeah OverflowDefect is the wrong move, ValueError is the intended upgrade path, nevermind |
16:33:58 | FromDiscord | <Gumbercules> In reply to @Isofruit "Wait, yeah OverflowDefect is": what a helpful warning then |
16:34:35 | FromDiscord | <Phil> Eh, the warning is just that OverflowError is deprecated, the code can't know that the try-except that the OverflowError was used in doesn't throw an OverflowError anymore but a ValueError |
16:35:20 | FromDiscord | <Gumbercules> yeah but the suggestion is worthless in this case |
16:35:29 | FromDiscord | <Gumbercules> it might as well just say `warning: OverflowError is deprecated` |
16:40:02 | FromDiscord | <Phil> Just to be on the safe side: The nimforum has a ton of "imported and not used" warnings. Are there any hidden mechanisms that would allow the module to show up as "not used" even though it actually is used?↵Karax/JS backend stuff mostly |
16:41:01 | FromDiscord | <Phil> Nevermind, yes there are, when blocks, damnit |
16:41:09 | FromDiscord | <Gumbercules> In reply to @Isofruit "Just to be on": compiling with certain static conditionals? |
16:41:14 | FromDiscord | <Gumbercules> yeah that |
16:41:28 | FromDiscord | <Gumbercules> but I mean that's fixable - just move the import under the `when` block |
16:41:32 | FromDiscord | <Gumbercules> or `static` block |
16:41:40 | FromDiscord | <Phil> Yeah but that means I can't just blindly throw away imports |
16:41:43 | FromDiscord | <Phil> Is the main thing |
16:41:50 | FromDiscord | <Gumbercules> truth |
16:41:58 | FromDiscord | <Gumbercules> you could blindly throw away the nimforum project |
16:42:23 | FromDiscord | <Gumbercules> that'd be my suggestion 🙂 |
16:48:02 | FromDiscord | <Phil> Meh, it's not the greatest thing ever written but realistically it's not going to get thrown away period. |
16:48:17 | FromDiscord | <Phil> So might as well do a bit of maintenance |
17:00:40 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4m6z |
17:29:10 | * | argonica joined #nim |
17:41:42 | * | argonica quit (Remote host closed the connection) |
17:42:48 | * | argonica joined #nim |
17:43:22 | * | argonica quit (Remote host closed the connection) |
17:44:23 | * | anddam quit (Quit: WeeChat 3.7.1) |
17:44:30 | * | argonica joined #nim |
17:45:28 | * | jmdaemon joined #nim |
18:01:39 | * | jmdaemon quit (Ping timeout: 260 seconds) |
18:04:00 | * | jmdaemon joined #nim |
18:07:59 | * | argonica quit (Quit: Leaving) |
18:14:16 | * | anddam joined #nim |
18:34:12 | FromDiscord | <auxym> yeah from my understanding the IO stuff (open, readfile, etc) won't be in system anymore starting with 2.0 you'll have to import std/syncio |
18:44:14 | * | genpaku quit (Read error: Connection reset by peer) |
18:48:43 | * | genpaku joined #nim |
18:51:12 | * | argonica joined #nim |
19:40:45 | * | jmdaemon quit (Ping timeout: 255 seconds) |
19:42:28 | * | jmdaemon joined #nim |
19:47:16 | * | argonica quit (Quit: Leaving) |
20:09:06 | * | jmdaemon quit (Ping timeout: 255 seconds) |
20:38:25 | * | argonica joined #nim |
21:35:28 | FromDiscord | <MartinSkou> Any way to get std/terminal to behave nonblocking? |
22:06:36 | FromDiscord | <Elegantbeef> You're best to look at Illwill or Nimwave for that |
22:11:31 | FromDiscord | <debris> Hi all! I'm trying to write a toy interpreter for a concatenative dynamically typed language that's similar to forth but I'm not really sure how to implement a dynamically typed environment hashmap/stack/array. Is there an endorsed way to do this in Nim? I'd assume it's not something usual since Nim is type safe... |
22:11:56 | FromDiscord | <Elegantbeef> You'd use something like `std/json`'s `JsonNode` |
22:12:09 | FromDiscord | <Elegantbeef> Where you use an object variant for the primitive part of your types, then compose them for the complex types |
22:12:55 | FromDiscord | <debris> Thank you, I'm going to try that, although json does feel a bit overkill to me. |
22:13:08 | FromDiscord | <Elegantbeef> I'm not saying use json |
22:13:16 | FromDiscord | <Elegantbeef> I'm saying make a data type like JsonNode |
22:13:40 | FromDiscord | <debris> Oh, sorry, I misunderstood. Okay then. |
22:40:00 | * | argonica quit (Quit: Leaving) |
22:43:32 | * | azimut quit (Ping timeout: 255 seconds) |
22:44:45 | * | azimut joined #nim |
22:44:58 | FromDiscord | <michaelb.eth> is there a way to tell nim to print stacktraces to stderr instead of stdout? |
23:07:39 | FromDiscord | <m4ul3r> Interesting I'm getting `nan` as a float with multiplying with something like `0 0 / 0.92042` |
23:11:52 | FromDiscord | <m4ul3r> nvm - i figured it out. My last floats were 0 without realizing |
23:13:20 | FromDiscord | <michaelb.eth> actually, nvm, I had a misunderstanding... the stacktrace is already getting printed to stderr but the program is exiting the terminal's alternate screen upon crash so I didn't it |
23:13:40 | FromDiscord | <michaelb.eth> a `2>` redirection takes care of that |