00:15:02 | * | wallabra quit (Ping timeout: 255 seconds) |
00:15:44 | * | wallabra joined #nim |
00:20:30 | * | jmdaemon quit (Ping timeout: 244 seconds) |
00:29:59 | FromDiscord | <Yardanico> gonna patch nimeventer a bit so it ignores pinned forum threads, because with the way it currently works it always sees the pinned thread on top, Ideally later I should just change it to store all posts/threads that were posted in a small sqlite db, so it doesn't care about pinned vs non-pinned, but it'll do for now (although it won't send events for pinned threads for now) |
00:32:21 | * | NimEventer quit (Remote host closed the connection) |
00:32:34 | * | NimEventer joined #nim |
00:38:07 | FromDiscord | <halc> So, I reinstalled windows (but kept my files and program data) and now all the VSCode good stuff for nim like go to definition or hovering over to get the signature of a proc won't work |
00:38:19 | FromDiscord | <halc> I tried reinstalling the nim extension but no cigar |
00:38:19 | FromDiscord | <Yardanico> you need to add the nim bin dir to PATH |
00:38:31 | FromDiscord | <halc> In reply to @Yardanico "you need to add": oh, let me see |
00:38:33 | FromDiscord | <Yardanico> how did you install nim in the past? choosenim or downloaded the archive? |
00:38:43 | FromDiscord | <halc> just checked |
00:38:50 | FromDiscord | <halc> it's already in the path |
00:39:01 | FromDiscord | <Yardanico> so what happens if you execute `nimsuggest` in cmd? |
00:39:07 | FromDiscord | <halc> In reply to @Yardanico "how did you install": choosenim, but I already made sure before to add it back to my PATH |
00:39:22 | FromDiscord | <halc> In reply to @Yardanico "so what happens if": nothing |
00:39:30 | FromDiscord | <Yardanico> well, I mean is there an error or what? |
00:39:37 | FromDiscord | <Yardanico> it should show up the help |
00:39:52 | FromDiscord | <halc> hold on |
00:40:44 | FromDiscord | <halc> ok, in powershell nothing happens, like actually nothing, no error, but in cmd I'm getting some missing dll stuff |
00:41:04 | FromDiscord | <Yardanico> what dll? |
00:41:08 | FromDiscord | <halc> libwinpthread-1.dll |
00:41:28 | FromDiscord | <Yardanico> aha, it's the mingw one |
00:41:35 | FromDiscord | <Yardanico> you need to add the C compiler to PATH as well |
00:42:06 | FromDiscord | <halc> In reply to @Yardanico "you need to add": I did, but I must've missing some dirs |
00:42:19 | FromDiscord | <halc> (edit) "missing" => "missed" |
00:42:55 | FromDiscord | <halc> wait |
00:44:00 | FromDiscord | <halc> oh nevermind |
00:44:07 | FromDiscord | <halc> no I didn't add that |
00:44:24 | FromDiscord | <halc> thank you very much sir |
00:44:55 | FromDiscord | <Yardanico> also, if you want to distribute your windows binaries to other people it might be a good idea to use https://jmeubank.github.io/tdm-gcc/ instead as it statically links winpthread (although for other DLLs you'll still need to ship them) |
00:45:10 | FromDiscord | <Yardanico> but winpthreads is only needed with, well, threads enabled |
00:48:24 | FromDiscord | <halc> interesting, I'll bookmark that |
00:49:13 | FromDiscord | <Yardanico> or alternatively you can install visual studio build tools (you don't need the full VS, just the build tools), and use msvc as your C compiler to not get "weird" dependencies like winpthreads |
00:49:46 | FromDiscord | <halc> huh, didn't know you could compile with msvc |
00:50:11 | FromDiscord | <Yardanico> Nim compiles to C so generally you can use most C compilers out there, and of course MSVC is supported since it's the "main" native C compiler for Windows |
00:58:59 | * | jmdaemon joined #nim |
01:14:38 | FromDiscord | <sOkam!> In reply to @Elegantbeef "it's pretty much the": "pretty much the same" is a bit too simple for what i was expecting as simple example code or noob-beginner explanation |
01:15:53 | FromDiscord | <Elegantbeef> It's identical to C or any other language though, you use the `alloc` or `create` routines instead of `malloc` then you use `dealloc` instead of free |
01:16:27 | FromDiscord | <sOkam!> i understand it must be similar, i was asking if you know of any simple example or someone who has tried for fun and wrote some small thing on how to do it↵I have found those "dumb" code articles are always the most useful articles to read for any new coding topic, in my experience so far 🤷♂️ |
01:16:42 | FromDiscord | <Elegantbeef> Instead of `&` you do `addr`, dereferencing is `[]`, pointer arithmetic is generally done using `ptr UncheckedArray[T]` instead of `ptr + int` |
01:17:23 | FromDiscord | <Elegantbeef> I'd say just look at C or similar examples and port it to Nim, but yea |
01:17:59 | FromDiscord | <sOkam!> how does the dereferencing look like in code? |
01:18:11 | FromDiscord | <sOkam!> before, after, separated, joined, etc |
01:18:20 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=49UT |
01:18:41 | FromDiscord | <Patitotective> !eval var a = 10; echo a.addr[] |
01:18:46 | NimBot | 10 |
01:18:51 | FromDiscord | <Elegantbeef> What do you mean before, after, separated, joined ? |
01:19:12 | FromDiscord | <sOkam!> k, so kinda like saying `the contents of the box at addr`. nim actually intuitive, never lets me down there ✍️ |
01:19:46 | FromDiscord | <Elegantbeef> pointer types are `ptr T` instead of `` and pointers to arrays as i mentioned are `ptr UncheckedArray[T]` instead of `T` |
01:20:00 | FromDiscord | <Elegantbeef> and void pointers are `pointer` instead of `void` |
01:20:05 | FromDiscord | <sOkam!> In reply to @Elegantbeef "What do you mean": as in where it goes in the syntax. but you already explained with the exampl |
01:20:17 | FromDiscord | <Elegantbeef> Ah ok |
01:20:31 | FromDiscord | <Elegantbeef> Nim's actually so much better to do low level stuff than C 😄 |
01:20:43 | FromDiscord | <sOkam!> i can imagine |
01:20:50 | FromDiscord | <Patitotective> In reply to @Elegantbeef "pointer types are `ptr": damn i hate C↵those `**` are hell |
01:21:01 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=49UU |
01:21:19 | FromDiscord | <sOkam!> In reply to @Patitotective "damn i hate C": yeah. learning that part of the language myself, and its being a "journey" for sure 😔 |
01:21:25 | FromDiscord | <Elegantbeef> I think create is objectively better than malloc 😄 |
01:23:15 | FromDiscord | <Elegantbeef> Anyway i'd suggest if you want to get comfortable with pointers in Nim make primitive types in it using unsafe methods |
01:23:28 | FromDiscord | <Elegantbeef> Strings, sequences, linked lists |
01:23:43 | FromDiscord | <sOkam!> wdym by unsafe methods? |
01:23:54 | FromDiscord | <Elegantbeef> Nim considers manual memory management unsafe |
01:26:01 | FromDiscord | <sOkam!> right, but how do i know when something is unsafe or when its not |
01:26:20 | FromDiscord | <sOkam!> is there like a list of unsafe things somewhere? |
01:26:24 | FromDiscord | <Elegantbeef> Anything that uses pointers or cast is generally unsafe |
01:26:43 | FromDiscord | <Elegantbeef> The list is literally `cast, ptr, pointer, addr, unsafeaddr` |
01:26:47 | FromDiscord | <Elegantbeef> I might be missing one |
01:27:01 | FromDiscord | <Yardanico> well, alloc/dealloc too I guess? |
01:27:01 | FromDiscord | <Patitotective> why is `end` a keyword? |
01:27:11 | FromDiscord | <Yardanico> In reply to @Patitotective "why is `end` a": because there once was an idea to have the begin/end syntax skin |
01:27:18 | FromDiscord | <Yardanico> like the braces skin but using begin/end instead |
01:27:25 | FromDiscord | <Yardanico> ah yeah, also it's used for SCF |
01:27:29 | FromDiscord | <Yardanico> always forget |
01:27:44 | FromDiscord | <Yardanico> https://nim-lang.org/docs/filters.html |
01:27:55 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=49UV |
01:28:06 | FromDiscord | <Yardanico> I'm not 100% sure if that `end` keyword is applied here, but maybe |
01:28:16 | FromDiscord | <Patitotective> 🤔 |
01:29:12 | FromDiscord | <sOkam!> how can i find all of the memory manament related procedures? |
01:29:51 | FromDiscord | <sOkam!> is there anything else, other than alloc/dealloc? |
01:29:54 | FromDiscord | <Yardanico> `alloc`, `dealloc`, `create`, `resize` |
01:30:00 | FromDiscord | <sOkam!> k |
01:30:07 | FromDiscord | <Yardanico> alloc/dealloc/createShared |
01:30:10 | FromDiscord | <Yardanico> (all 3 shared ones) |
01:30:22 | FromDiscord | <Yardanico> ah, also freeShared |
01:30:41 | FromDiscord | <Yardanico> generally you can just search for all system procs that have `ptr` in arguments or return types |
01:31:06 | FromDiscord | <sOkam!> kk |
01:32:10 | * | arkurious quit (Quit: Leaving) |
01:45:27 | FromDiscord | <sOkam!> In reply to @Elegantbeef "Anyway i'd suggest if": what would these be built from? what are the most basic non-gc types? |
01:47:31 | FromDiscord | <Yardanico> just from numbers and pointers? |
01:47:38 | FromDiscord | <Yardanico> you can then easily make your own container, your own string, etc |
01:47:39 | FromDiscord | <Rika> In reply to @Elegantbeef "pointer types are `ptr": It was already mentioned here |
01:49:46 | FromDiscord | <sOkam!> oh, so you alloc a number, move ptr to sizeof(number), alloc another, and so on? |
01:50:22 | FromDiscord | <Rika> No, when you make sequences you allocate the whole capacity at once |
01:50:49 | FromDiscord | <Rika> If you need to expand you allocate current+expansion capacity and you copy the old data to the new |
01:51:20 | FromDiscord | <Rika> Ideally you use the mentioned array type above to avoid pointer arithmetic |
01:54:08 | FromDiscord | <sOkam!> see? this is why i was asking for some simple example code that does the basic things |
01:54:49 | FromDiscord | <sOkam!> (edit) "see? this is why i was asking for some simple example code ... thatthings," added "or article" | "or articlethat does the basic ... things" added "things, to just get a basic grasp on the dumbest" |
01:55:00 | FromDiscord | <Patitotective> and they said that you could just translate c code that manages memory manually as you want |
01:55:13 | FromDiscord | <Rika> I can’t give code right now because I’m on mobile |
01:55:31 | FromDiscord | <Rika> In reply to @Patitotective "and they said that": But how to translate correctly is another thing |
01:55:52 | FromDiscord | <Rika> Maybe you can go read the Nim memory article |
01:56:17 | FromDiscord | <sOkam!> In reply to @Patitotective "and they said that": meaning, passing some C code through c2nim? would that give a good overview on how? 🤔 |
01:56:54 | FromDiscord | <Patitotective> what i mean is that you don't need a nim example exactly but you can read about the concept themselves (or their implementation on another language) to implement them in nim↵sure, nim code would the best but this low-level stuff shouldnt be so different from c or so |
01:59:34 | FromDiscord | <sOkam!> In reply to @Patitotective "what i mean is": problem is that this topic is above my skill level. so its not easy to extrapolate on how to do things, specially since nim is gc mainly so these procs are not specially easy to find... as in "go to X module, and they are all there in a separate box with some explanations" like it happens in other modules |
01:59:37 | FromDiscord | <Elegantbeef> No meaning rewrite C code in Nim↵(@sOkam!) |
02:00:17 | FromDiscord | <sOkam!> (edit) "X" => "std/manualmem" |
02:02:59 | FromDiscord | <sOkam!> are the `allocShared` procs equivalent to their `alloc` counterparts, other than for threading stuff? |
02:10:14 | * | nyeaa4 quit (Quit: Ping timeout (120 seconds)) |
02:10:34 | * | nyeaa4 joined #nim |
02:13:40 | FromDiscord | <sOkam!> How do you create a struct type with manual memory management? Are object types gc'ed? |
02:16:20 | FromDiscord | <Elegantbeef> `alloc(sizeof(MyType))` or `create(MyType)` |
02:16:23 | FromDiscord | <Elegantbeef> No `object` is not gc'd |
02:16:33 | FromDiscord | <Elegantbeef> Only seq, string, and `ref T` is Gc'd |
02:25:22 | FromDiscord | <Yardanico> https://www.youtube.com/watch?v=mNBhZ5VQ2y4 someone might want to make this for Nim |
02:25:38 | FromDiscord | <Yardanico> quite a good video, especially for ones who like videos over articles :) |
02:30:07 | FromDiscord | <Prestige> I've seen this in my recommended but assumed it was going to be some rust circle jerk |
02:30:31 | FromDiscord | <Tuatarian> rust/nim circlejerks are some of the worst I've seen |
02:30:41 | FromDiscord | <Tuatarian> the rust one has moderated itself to a good degree though which is nice |
02:30:45 | FromDiscord | <Yardanico> nah, it just seems to be a little video about rust optimizations options |
02:31:52 | FromDiscord | <Elegantbeef> Nim circle jerks? |
02:32:01 | FromDiscord | <Elegantbeef> Have i been missing out on circle jerks |
02:32:02 | FromDiscord | <Elegantbeef> Fuck |
02:32:10 | FromDiscord | <Prestige> I know many people think languages like V have some new fancy memory management options, and think nim just has a "normal gc" so it isn't as good etc |
02:32:14 | FromDiscord | <Tuatarian> it's mostly contained to the nim forum |
02:32:19 | FromDiscord | <Prestige> when they do similar things |
02:32:25 | FromDiscord | <Yardanico> In reply to @iWonderAboutTuatara "it's mostly contained to": can you give a few examples? i don't notice it that much |
02:32:53 | FromDiscord | <Tuatarian> any time anybody complains about anything in nim and isn't an already established person who's made some major software, they're usually not treated well |
02:33:10 | FromDiscord | <sOkam!> In reply to @Elegantbeef "Only seq, string, and": so, if i create any type that's not one of those three without alloc, it lives on the stack... and if I add alloc, it lives on the heap? just like C, right?↵might sound like a stupid question, but this type of simple stuff has bit me in the ass way to much to not ask for confirmation sry 😔 |
02:33:17 | FromDiscord | <Prestige> In reply to @iWonderAboutTuatara "any time anybody complains": I've missed out on that |
02:33:31 | FromDiscord | <Tuatarian> I think it used to be a bigger thing than it is nowadays |
02:34:00 | FromDiscord | <Tuatarian> if you google for things you tend to get more of these kinds of threads ime |
02:34:11 | FromDiscord | <Prestige> I complain about editor support and related issues frequently |
02:34:14 | FromDiscord | <Prestige> hmm |
02:34:58 | FromDiscord | <Tuatarian> crap editor support is really hard to argue against |
02:35:04 | FromDiscord | <Tuatarian> also it's gotten a lot better I think |
02:35:19 | FromDiscord | <Prestige> Yeah |
02:35:36 | FromDiscord | <Prestige> I think my biggest issue currently is nimsuggest being abandoned |
02:35:44 | FromDiscord | <Tuatarian> it = toxicity, but also the editor support yeah |
02:35:49 | FromDiscord | <Yardanico> In reply to @Avahe "I think my biggest": actually it is receiving updates now |
02:35:56 | FromDiscord | <Tuatarian> I can't get linting working in emacs, which is kind of awful |
02:36:01 | FromDiscord | <Yardanico> yyoncho was hired by status to improve nimsuggest/LSP |
02:36:03 | FromDiscord | <Generic> it's in the limbo of "it's going to be better when IC arrives" |
02:36:23 | FromDiscord | <Tuatarian> even using something like nimlangserver + lsp-mode doesn't work for some weird and hard to diagnose reason |
02:36:31 | FromDiscord | <Tuatarian> I think other emacs users basically have the same experience in this regard |
02:36:58 | FromDiscord | <Prestige> At this point I just compile my program in order to find any compilation issues |
02:37:16 | FromDiscord | <Prestige> my editor is commonly flooded with fake errors via linting |
02:37:23 | FromDiscord | <Prestige> but compiles fine |
02:37:37 | FromDiscord | <Generic> nim check has it's benefits |
02:38:17 | FromDiscord | <Tuatarian> yeah same, I just use nim c -r whatever and hope it works |
02:38:19 | FromDiscord | <Generic> ~~why can't it output errors and warnings in a machine readable format, parsing the ones made for humans is such a pain~~ |
02:38:51 | FromDiscord | <Tuatarian> nim check is fine, but it still requires a bunch of iterations before your code runs which is also annoying |
02:39:35 | FromDiscord | <Generic> if nim check doesn't flag any error it should compile |
02:39:40 | FromDiscord | <Prestige> I love a lot of things about this language but the editing experience is painful. A lot of people I know don't use Nim for that reason actually |
02:40:09 | FromDiscord | <Prestige> I tried to offer to pay to fix one of these nimsuggest bugs but got no response lol |
02:40:20 | FromDiscord | <Generic> only if your program doesn't compile nim check can sometimes have issues with cascading errors |
02:40:44 | FromDiscord | <Generic> but if you really don't like that you can use errorMax:1 and you get 100% the same output as the compiler gives |
02:40:50 | FromDiscord | <Generic> ~~except for cgen errors~~ |
02:41:23 | FromDiscord | <Prestige> In reply to @Yardanico "https://www.youtube.com/watch?v=mNBhZ5VQ2y4 someone": I should make a 1:1 remake of this video with nim, would be funny |
02:41:34 | FromDiscord | <Yardanico> https://www.reddit.com/r/nim/comments/vr0aql/nimlangserver_announcement/ is about yyoncho |
02:41:59 | FromDiscord | <Yardanico> nimlangserver still seems to be in development, but he already made some fixes to nimsuggest |
02:42:45 | FromDiscord | <Prestige> That's great |
02:44:55 | FromDiscord | <Prestige> Is IC still the main focus right now, in order to enable better editor support? Last I heard about this was like... 6-12 months ago, maybe |
02:45:13 | FromDiscord | <Yardanico> I don't think anything that's related to IC has been touched in the last months |
02:45:23 | FromDiscord | <Prestige> Oh, wow |
02:45:34 | FromDiscord | <Yardanico> Araq was busy with his book I guess, and flywind is doing the work to make the ORC default (testing packages and fixing some bugs), Araq is fixing some bugs too |
02:45:58 | FromDiscord | <Yardanico> but I didn't follow the nim repo very closely for the last half a year |
02:46:54 | FromDiscord | <Prestige> I've been thinking of putting out a few videos related to Nim, but I haven't decided on the topic. Maybe some basic SDL stuff, or like leetcode question solving |
02:47:08 | FromDiscord | <Prestige> Something people could start off with that's small or easy to grasp |
02:55:52 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=49V5 |
02:56:04 | FromDiscord | <Yardanico> In reply to @sOkam! "Why does this print": because that's what the values are? |
02:56:09 | FromDiscord | <Yardanico> what do you expect it to print? |
02:56:18 | FromDiscord | <Prestige> Everything in Nim defaults to 0 values |
02:56:20 | FromDiscord | <sOkam!> 1 to 9? |
02:56:25 | FromDiscord | <Yardanico> In reply to @sOkam! "1 to 9?": how so? |
02:56:37 | FromDiscord | <Yardanico> you did `create(int, 10)` which creates a memory block of the size of 10 ints |
02:56:39 | FromDiscord | <Yardanico> and zeroes it |
02:56:40 | FromDiscord | <sOkam!> 🤷♂️ i thought create did that, but i guess it doesnt |
02:56:49 | FromDiscord | <Yardanico> `create` is just memory allocation with a big of sugar |
02:56:58 | FromDiscord | <Yardanico> 10 means amount of the type to create |
02:56:59 | FromDiscord | <sOkam!> simple stuff gets me, so didn't notice i guess |
02:57:23 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/1017267375327952966/unknown.png |
02:58:39 | FromDiscord | <sOkam!> why is casting needed in that statement? can't the array be created directly? |
02:59:15 | FromDiscord | <Yardanico> In reply to @sOkam! "why is casting needed": casting is needed because `alloc0` gives you a `pointer` |
03:00:04 | FromDiscord | <sOkam!> and you cannot assign a pointer to a typed ptr? |
03:00:10 | FromDiscord | <Patitotective> hMmM i've been working on the KDL parser and to generate the nodes objects themselves i first need to validate that the tokens are valid (lexer's result) and store the temporary node somewhere, to use it or discard it depending if it's valid or not (i.e.: you started a node but then started another without finishing the first)↵and was wondering if the best way was to do it through fields in the parser (`tempNode: Node, tempVal: Va |
03:00:48 | FromDiscord | <Patitotective> (edit) "seq[node]`)" => "seq[Node]`)" |
03:00:49 | FromDiscord | <Yardanico> In reply to @sOkam! "and you cannot assign": no, because Nim is strongly typed |
03:01:07 | FromDiscord | <Yardanico> well, it's not really only because of that |
03:01:11 | FromDiscord | <Yardanico> but because `ptr T` gives more information |
03:01:21 | FromDiscord | <Yardanico> "Traced references are declared with the ref keyword, untraced references are declared with the ptr keyword. In general, a ptr T is implicitly convertible to the pointer type." |
03:01:24 | FromDiscord | <Yardanico> but not the other way |
03:02:56 | FromDiscord | <sOkam!> wdym the other way? ref to ptr, ref to pointer, or pointer to ptr? |
03:06:42 | * | derpydoo quit (Quit: derpydoo) |
03:07:40 | FromDiscord | <sOkam!> also, is there a way to specify the exact binary output path+file during compiling?↵i keep getting that i cannot pass parameters when adding `-o:folder/bin.ext` or `--out:folder/bin.ext` |
03:08:23 | FromDiscord | <Yardanico> tried quotes? |
03:08:39 | FromDiscord | <sOkam!> oh didn't, might be helpful 🤦♂️ |
03:10:19 | FromDiscord | <sOkam!> oh, actually doesn't work 🤔 |
03:11:12 | FromDiscord | <Patitotective> In reply to @sOkam! "also, is there a": you should use `--outdir:folder --out:bin.ext` probably |
03:11:16 | FromDiscord | <Elegantbeef> Isnt `out` just the file name and you set `outdir` for the dir |
03:11:22 | FromDiscord | <Elegantbeef> Yea what that nerd said |
03:11:38 | FromDiscord | <Patitotective> i though you had 90 wpm |
03:11:43 | FromDiscord | <Patitotective> (edit) "though" => "thought" |
03:11:48 | FromDiscord | <Elegantbeef> Yea when i'm not playing agame |
03:11:48 | FromDiscord | <Patitotective> (edit) "90 wpm" => "90wpm" |
03:11:59 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=49V7 |
03:12:09 | FromDiscord | <Patitotective> put the flags before the file |
03:12:24 | FromDiscord | <Patitotective> `nim c --gc:none memtest.nim` |
03:12:34 | FromDiscord | <sOkam!> ah that was it, ty |
03:12:37 | FromDiscord | <Patitotective> otherwise nim will pass those as arguments to `memtest.nim` |
03:12:57 | FromDiscord | <sOkam!> oh! that's what it meant. i thought it was trying to pass the parameters to the compiler |
03:15:07 | FromDiscord | <Patitotective> 🌃 |
03:37:41 | * | jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in) |
03:55:41 | NimEventer | New post on r/nim by Wysardry: How to get clean simple C output?, see https://reddit.com/r/nim/comments/x8prqq/how_to_get_clean_simple_c_output/ |
04:01:36 | FromDiscord | <Prestige> Maybe I should ask the forum what type of videos people would like to see related to Nim |
04:08:42 | FromDiscord | <sOkam!> is there a way to check for incorrect allocations with alloc, like in C?↵what does alloc return if it failed? |
04:09:01 | FromDiscord | <Rika> nil i assume |
04:13:33 | * | jmdaemon joined #nim |
04:14:42 | FromDiscord | <sOkam!> kk ty |
04:15:27 | FromDiscord | <Rika> if alloc fails then theres a big problem that you most likely cant recover from (in the program) anyway |
04:15:44 | FromDiscord | <sOkam!> im trying to implement a simple gc example i found online, that i already followed in C↵but it's using `sbrk()`, since its also implementing a basic alloc function↵is it possible to use such a function in Nim too? |
04:16:13 | FromDiscord | <Rika> probably but you will have to manually import it |
04:16:15 | FromDiscord | <Yardanico> Nim compiles to C so you can just importc it |
04:16:17 | FromDiscord | <Rika> (edit) "probably but you will have to manually import it ... " added "from c" |
04:22:49 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=49Vb |
04:23:02 | FromDiscord | <Yardanico> you should use the special C types of you're importcing a C function |
04:23:23 | FromDiscord | <sOkam!> k |
04:23:24 | FromDiscord | <sOkam!> (edit) "https://play.nim-lang.org/#ix=49Vb" => "https://play.nim-lang.org/#ix=49Vc" |
04:23:29 | FromDiscord | <Elegantbeef> `int` is fine for `intptr_t` though afaik |
04:24:09 | FromDiscord | <Yardanico> In reply to @sOkam! "does this look fine?": also your import is wrong |
04:24:14 | FromDiscord | <Yardanico> sbrk returns a `cint` as well |
04:24:16 | FromDiscord | <Yardanico> https://linux.die.net/man/2/sbrk |
04:24:55 | FromDiscord | <sOkam!> doesnt it return a void? |
04:25:14 | FromDiscord | <Yardanico> which is a pointer |
04:25:17 | FromDiscord | <Rika> cint is brk not sbrk |
04:25:19 | FromDiscord | <Yardanico> ah yeah |
04:25:27 | FromDiscord | <Yardanico> In reply to @sOkam! "doesnt it return a": and even void is a pointer and not "nothing" :) |
04:25:30 | FromDiscord | <Yardanico> in C |
04:25:52 | FromDiscord | <sOkam!> yeah, was changing it. i copypasted from printf example... so was missing the return type |
04:26:07 | FromDiscord | <sOkam!> do pragmas go before or after the return type? |
04:26:12 | FromDiscord | <Rika> after |
04:26:14 | FromDiscord | <sOkam!> k |
04:26:40 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=49Ve |
04:26:40 | FromDiscord | <Rika> should be right |
04:26:49 | FromDiscord | <sOkam!> k ty |
04:38:49 | FromDiscord | <markanthony22> Thank me letter https://t.me/+FE01vMtarjEwOWM0 |
04:39:21 | FromDiscord | <Rika> <@&371760044473319454> literally in the main channel huh |
04:39:31 | FromDiscord | <Elegantbeef> Looks like the spammers got me to spell for them |
04:40:54 | FromDiscord | <Rika> i cant believe you work for the spammers, beef |
04:41:23 | FromDiscord | <Elegantbeef> You know what they say if you cant 'beet them join them' |
04:41:32 | FromDiscord | <Rika> beaf |
04:42:30 | FromDiscord | <Elegantbeef> reeka |
04:45:45 | FromDiscord | <Lucybtc> sent a long message, see http://ix.io/49Vf |
04:46:46 | FromDiscord | <Tuatarian> wow thanks |
04:47:03 | FromDiscord | <Rika> holy fuck |
04:47:13 | FromDiscord | <halc> oh my god $4000 wow I can't believe it |
04:47:20 | FromDiscord | <Elegantbeef> 4 \ 5 = 10? |
04:47:46 | FromDiscord | <Rika> no, you only work for 2.5 days |
04:58:55 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=49Vh |
05:01:52 | * | tk quit (Ping timeout: 260 seconds) |
05:05:56 | FromDiscord | <Rika> no |
05:05:57 | FromDiscord | <Rika> it should work |
05:06:03 | FromDiscord | <Rika> try quoting the dir |
05:06:28 | FromDiscord | <sOkam!> it works for --nimchache:folder/subfolder |
05:06:40 | FromDiscord | <Rika> also delete the ./hello file first, you might be mistaking it |
05:06:42 | FromDiscord | <sOkam!> but outdir is being ignored |
05:06:49 | FromDiscord | <sOkam!> i removed everything yeah |
05:06:49 | FromDiscord | <sOkam!> a few times |
05:06:55 | FromDiscord | <Rika> then thats strange |
05:09:26 | FromDiscord | <sOkam!> quotes didn't help |
05:14:15 | FromDiscord | <Rika> im not sure what the issue is then |
05:14:21 | FromDiscord | <Rika> maybe swap the order of out and outdir |
05:26:11 | * | tk joined #nim |
05:33:48 | FromDiscord | <ravinder387> template/generic instantiation of `draw` from here↵C:\Users\ravin\Documents\Nim-Lang\Plotly\interactive\linechart\app.nim(15, 39) Warning: implicit conversion to 'cstring' from a non-const location: parseTraces(p.traces); this will become a compile time error in the future [CStringConv] |
05:33:53 | FromDiscord | <ravinder387> kindly explain me |
05:34:00 | FromDiscord | <ravinder387> `template/generic instantiation of `draw` from here↵C:\Users\ravin\Documents\Nim-Lang\Plotly\interactive\linechart\app.nim(15, 39) Warning: implicit conversion to 'cstring' from a non-const location: parseTraces(p.traces); this will become a compile time error in the future [CStringConv]` |
05:34:12 | FromDiscord | <Yardanico> In reply to @ravinder387 "template/generic instantiation of `draw`": it is exactly what the compiler tells you |
05:34:31 | FromDiscord | <Yardanico> implicit string -> cstring conversions in the future will become invalid, so you need to explicitly convert the string to a cstring |
05:36:48 | FromDiscord | <ravinder387> if i have string e.g x = "hello" how to cast into ctring |
05:36:59 | FromDiscord | <Yardanico> cstring(x) |
05:37:18 | FromDiscord | <Yardanico> and this is not a "cast", casts are done with `cast`, type conversions are safe and are done like `newtype(variable)` |
05:50:58 | FromDiscord | <sOkam!> In reply to @Rika "maybe swap the order": that actually worked 🧩 |
05:51:54 | FromDiscord | <Rika> wtf |
06:08:10 | FromDiscord | <ravinder387> `app.nim(15, 39)` in which line nim say error |
06:08:15 | FromDiscord | <ravinder387> 15 or 39 |
06:08:49 | FromDiscord | <ravinder387> sorry I never write unittest, debug, anything like that... I'm non-programmer |
06:09:01 | FromDiscord | <ravinder387> I'm python user |
06:11:06 | FromDiscord | <Rika> line 15 character 39 |
06:25:51 | FromDiscord | <aruZeta> so python users are non programmers? |
06:41:10 | * | PMunch joined #nim |
07:11:23 | FromDiscord | <Girvo> @aruZeta I would like to invoke the fifth amendment |
07:11:47 | FromDiscord | <Elegantbeef> What's the australian 5th amendment?! |
07:11:58 | FromDiscord | <Elegantbeef> I know the Canadian one is about two provinces joining confederacy |
07:15:23 | FromDiscord | <@chronomatopoeia:matrix.org> The right to refrain from posting a meme. |
07:16:03 | PMunch | It appears to be an amendment removing special notices of the Aboriginals in their constitution |
07:17:07 | FromDiscord | <@chronomatopoeia:matrix.org> privilege not to self-incriminate |
07:17:24 | PMunch | That's the american one |
07:18:18 | FromDiscord | <clararussel> sent a long message, see http://ix.io/49VB |
07:18:21 | PMunch | They removed this bit (in bold): The Parliament shall, subject to this Constitution, have power to make laws for the peace, order, and good government of the Commonwealth with respect to: The people of any race, other than the aboriginal race in any State, for whom it is deemed necessary to make special laws; |
07:18:37 | PMunch | And a section titled "Aborigines not to be counted in reckoning population" |
07:19:34 | FromDiscord | <@chronomatopoeia:matrix.org> my bad, I saw an Australian article on US law↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
07:20:03 | FromDiscord | <Elegantbeef> You guys are looking too deep into a joke |
07:20:16 | FromDiscord | <@chronomatopoeia:matrix.org> never |
07:20:53 | FromDiscord | <@chronomatopoeia:matrix.org> at least I learned something \:) |
07:23:00 | PMunch | @Elegantbeef, pfft, no such thing |
07:23:21 | PMunch | Everyone knows that jokes get funnier the more you explain them |
07:24:07 | FromDiscord | <Elegantbeef> As funny as a hired clown at a funeral |
07:41:15 | * | rockcavera quit (Remote host closed the connection) |
08:02:30 | * | m5zs7k quit (Ping timeout: 264 seconds) |
08:03:04 | FromDiscord | <ezquerra> Is there a way to get the list or variables that are in scope at a given point (and wether they are local or global) at compile time? I’d like to make a macro that prints all the variables and their values during runtime (to help when debugging, since gdb is… not that great for that) |
08:03:51 | FromDiscord | <Elegantbeef> `locals` exists |
08:04:37 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=49VL |
08:05:26 | * | m5zs7k joined #nim |
08:07:23 | PMunch | @ezquerra, there is also a Nim plugin to gdb which will pretty-print Nim variables |
08:07:40 | FromDiscord | <Elegantbeef> Though it fails on a few nim things |
08:07:44 | FromDiscord | <Elegantbeef> Like sets for instance |
08:07:53 | PMunch | Yeah it's not perfect.. |
08:09:43 | FromDiscord | <Elegantbeef> Also tagged unions dont work |
08:09:52 | FromDiscord | <Elegantbeef> I know saem looked at that and couldnt get it to work |
08:11:58 | FromDiscord | <Elegantbeef> I do wonder how hard it'd be to make that python script more usable |
08:50:33 | * | jmdaemon quit (Ping timeout: 252 seconds) |
10:04:23 | FromDiscord | <soda> Do nim compile time constants only exist at compilation? |
10:04:52 | PMunch | @soda, depends |
10:05:01 | PMunch | A normal `const` is available on runtime |
10:05:22 | FromDiscord | <soda> When is it not? |
10:06:13 | FromDiscord | <soda> Basically, i encountered this situation in another language where a compile-time constant 2D array was only available at compile-time. Every function call that would require it would instantiate the array again. How does it work in nim? |
10:06:42 | PMunch | In cases like this: https://play.nim-lang.org/#ix=49We |
10:07:09 | PMunch | Well a const is basically just inserting the value every time you use it |
10:07:29 | PMunch | It does a little check to see if it is very large and then uses a variable instead I believe |
10:07:57 | PMunch | But for e.g. the number 5 it would just compile down to writing out the number 5 in the source code |
10:08:01 | FromDiscord | <soda> sent a code paste, see https://play.nim-lang.org/#ix=49Wg |
10:08:01 | FromDiscord | <soda> Consider this 2d array of 2 enums |
10:08:20 | FromDiscord | <soda> Is this re-instantiated every time a proc indexes it? |
10:08:24 | FromDiscord | <soda> or is it a real constexpr? |
10:08:45 | FromDiscord | <dom96> `const` is always a constexpr |
10:08:50 | * | neceve quit (Quit: ZNC - https://znc.in) |
10:08:59 | FromDiscord | <dom96> if the compiler can't make it that way then it will give you an error |
10:09:03 | FromDiscord | <soda> Nice, as it should be |
10:09:08 | FromDiscord | <soda> unlike a certain other language |
10:09:15 | PMunch | As a const I believe it would be expanded to that array and then the index. |
10:09:23 | FromDiscord | <dom96> oh, which one? |
10:12:32 | FromDiscord | <planetis> math.factorial has a local compile time constant that is filled once the function is called. This way it doesn't pollute the library scope. It just looks like `const table = makeFactorialTable` |
10:12:53 | FromDiscord | <planetis> (edit) "math.factorial" => "math.fac" | "math.fachas a local compile time constant that is filled once the function is called. This way it doesn't pollute the library scope. It just looks like ... `constmakeFactorialTable()`" added "this" | "makeFactorialTable`" => "makeFactorialTable()`" |
10:13:15 | FromDiscord | <soda> So it's not a compile time constant? |
10:13:26 | FromDiscord | <soda> or is the function called at compile time? |
10:13:38 | FromDiscord | <planetis> the second one |
10:14:13 | * | neceve joined #nim |
10:14:57 | FromDiscord | <soda> So let's say a function only does a constexpr operation, is it automatically inlined? |
10:15:09 | FromDiscord | <soda> (like indexing as above) |
10:15:16 | FromDiscord | <planetis> It's also explained in the mastering nim book page 112! I wrote it but didn't get any credit... |
10:16:17 | FromDiscord | <dom96> In reply to @planetis "It's also explained in": wait, you wrote a part of the book and didn't get credit? |
10:17:02 | FromDiscord | <planetis> no the example that's explained in the book |
10:17:09 | FromDiscord | <planetis> (edit) "no the ... example" added "code" |
10:17:22 | FromDiscord | <dom96> oh, that's still a shame |
10:18:07 | FromDiscord | <planetis> That's ok. I loved the book. |
10:19:55 | FromDiscord | <planetis> In reply to @soda "So let's say a": For that to work you need to annotate the function with .compileTime. But const variables are inlined. |
10:20:31 | FromDiscord | <soda> Can you please provide a syntax example for doing that? |
10:20:48 | FromDiscord | <soda> proc foo() |
10:22:18 | FromDiscord | <soda> nvm i found it |
10:24:07 | FromDiscord | <planetis> it's like an example posted recently in the forum: https://forum.nim-lang.org/t/9433#61960 |
10:24:09 | FromDiscord | <soda> sent a code paste, see https://play.nim-lang.org/#ix=49Wn |
10:24:30 | FromDiscord | <soda> Are the first and the third equivalent? |
10:24:48 | FromDiscord | <soda> So there is one less function call cost at runtime? |
10:25:56 | FromDiscord | <planetis> That won't work at compile time, it would still be runtime right? You don't run the FSM at compile time |
10:26:09 | FromDiscord | <soda> FSM is a constexpr |
10:26:35 | FromDiscord | <soda> hmm |
10:26:43 | FromDiscord | <planetis> No just use a template if you want to avoid a function call |
10:26:48 | FromDiscord | <soda> well i guess it's true |
10:28:19 | FromDiscord | <soda> alright makes sense |
10:57:49 | FromDiscord | <mratsim> In reply to @soda "So let's say a": Tag it {.compileTime.} or use `static T` as a result is you want insurance |
10:57:59 | FromDiscord | <mratsim> (edit) "{.compileTime.}" => "`{.compileTime.}`" |
10:59:10 | FromDiscord | <mratsim> In reply to @soda "FSM is a constexpr": If your FSM states are known at compile-time and you want to avoid function calls, I can sell you dark magic for your soul. |
11:00:15 | FromDiscord | <mratsim> https://forum.nim-lang.org/t/8963#58594 |
11:06:47 | FromDiscord | <planetis> nice |
11:14:00 | FromDiscord | <planetis> I can't have a pointer to static[array[n, byte]] that's a bummer. |
11:15:03 | FromDiscord | <planetis> (edit) "" => "("Error: expression has no address")" |
11:18:15 | FromDiscord | <soda> In reply to @mratsim "If your FSM states": That's what i was wondering |
11:18:48 | FromDiscord | <soda> Considering that the entirety of FSM is compile time, does the compiler turn FMS[idx] to it's value at compile time? |
11:19:03 | FromDiscord | <soda> and, do procs that only do constexpr operations achieve the same effect automatically? |
11:19:15 | FromDiscord | <soda> In reply to @mratsim "If your FSM states": Good stuff |
11:20:11 | FromDiscord | <soda> (edit) "Considering that the entirety of FSM is ... compile" added "known at" |
11:21:59 | FromDiscord | <mratsim> sent a long message, see http://ix.io/49WA |
11:22:19 | FromDiscord | <mratsim> In reply to @soda "Considering that the entirety": Yes, the compiler does constant-folding on indexing |
11:23:00 | FromDiscord | <planetis> I just wanted the EmbeddedImage I was working on to hold a pointer that's verifiable can't be freed at runtime. |
11:23:30 | FromDiscord | <mratsim> In reply to @soda "and, do procs that": It depends. If they are tagged {.compileTime.} or static T for result yes, in Nim.↵If they are inlined, or called in the same module, the C compiler might do constant propagation.↵If none are true, you would need LTO. |
11:24:05 | FromDiscord | <soda> What if they are called .compileTime, but whether or not the proc gets executed depends on control flow? |
11:24:14 | FromDiscord | <soda> (edit) "called" => "tagged" |
11:31:38 | * | NimEventer quit (Remote host closed the connection) |
11:32:41 | * | NimEventer joined #nim |
11:32:41 | NimEventer | New thread by srozb: Libpe & peni - Portable Executable parsing lib & tool released, see https://forum.nim-lang.org/t/9446 |
11:55:21 | FromDiscord | <mratsim> In reply to @soda "What if they are": still constant folded |
11:55:44 | FromDiscord | <mratsim> compile with --nimcache:cache_folder and look at the generated C code |
12:21:09 | * | arkurious joined #nim |
12:31:58 | * | vicecea quit (Remote host closed the connection) |
12:32:27 | * | vicecea joined #nim |
12:47:24 | * | neceve quit (Changing host) |
12:47:24 | * | neceve joined #nim |
13:02:44 | NimEventer | New Nimble package! peni - PE tool based on libpe (with no S), see https://github.com/srozb/peni |
13:03:28 | FromDiscord | <Rika> With no S LMAO |
13:03:55 | FromDiscord | <aruZeta> HAHAHA |
13:11:13 | FromDiscord | <Tetralux> COWARD 🤣 |
13:13:46 | FromDiscord | <Prestige> Lol |
13:44:47 | NimEventer | New Nimble package! QRgen - A QR code generation library., see https://github.com/aruZeta/QRgen |
13:44:47 | NimEventer | New Nimble package! bitseqs - Utility for a bit manipulation, see https://github.com/adokitkat/bitfields |
13:45:02 | FromDiscord | <Rika> In reply to @NimEventer "New Nimble package! QRgen": Cool |
13:45:10 | FromDiscord | <aruZeta> In reply to @NimEventer "New Nimble package! QRgen": 🥳 |
13:47:22 | FromDiscord | <aruZeta> only took 1.7k lines |
14:07:33 | FromDiscord | <Dumb Dragon> every day I find out more and more cool things you can do https://media.discordapp.net/attachments/371759389889003532/1017436030300848198/unknown.png |
14:08:31 | FromDiscord | <Dumb Dragon> default arguments using another argument is pretty useful |
14:12:20 | FromDiscord | <Dumb Dragon> might be something in other languages too idk |
14:12:27 | * | PMunch quit (Quit: Leaving) |
14:12:59 | FromDiscord | <Dumb Dragon> I mainly just use nim and I didn't bother to see if this works in like, rust or c++ |
14:14:21 | FromDiscord | <Tetralux> In reply to @Dumb Dragon "every day I find": Hmm. I wonder what C it generates. 🤔 |
14:14:52 | FromDiscord | <Dumb Dragon> probably 3 separate functions depending on the parameters used |
14:16:47 | FromDiscord | <Dumb Dragon> sent a code paste, see https://play.nim-lang.org/#ix=49Xe |
14:17:14 | FromDiscord | <Dumb Dragon> Idk I don't really look at the C code that nim generates all that often |
14:19:59 | FromDiscord | <Dumb Dragon> doesn't work in c++ https://media.discordapp.net/attachments/371759389889003532/1017439159184535553/unknown.png |
14:21:12 | * | derpydoo joined #nim |
14:21:41 | FromDiscord | <Rika> In reply to @aruZeta "🥳": congrats |
14:22:17 | FromDiscord | <Rika> In reply to @Dumb Dragon "default arguments using another": it certainly is funky though |
14:22:38 | FromDiscord | <Dumb Dragon> yeah |
14:24:14 | FromDiscord | <Dumb Dragon> In reply to @Dumb Dragon "I mainly just use": also turns out rust doesn't even support default arguments, which is something I should've known considering the stackoverflow question I clicked on was grey |
14:24:23 | * | rockcavera joined #nim |
14:24:24 | * | rockcavera quit (Changing host) |
14:24:24 | * | rockcavera joined #nim |
14:24:27 | FromDiscord | <Dumb Dragon> (edit) "question" => "link" |
14:28:10 | FromDiscord | <aruZeta> it's also a thing in lisp |
14:28:15 | FromDiscord | <aruZeta> or at least in common lisp |
14:28:28 | FromDiscord | <Dumb Dragon> huh, neat |
14:28:37 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=49Xg |
14:30:14 | FromDiscord | <aruZeta> and also something great is lisp supports knowing if an optional parameter with a default value was specified or not |
14:31:01 | FromDiscord | <aruZeta> let's say `foo`'s default value is `0`, in most programming languages you don't know if the user was the one to enter `0` or not |
14:31:52 | FromDiscord | <Dumb Dragon> neat |
14:34:54 | FromDiscord | <Prestige> In reply to @Dumb Dragon "every day I find": Dang that's cool |
15:00:13 | * | kenran joined #nim |
15:15:46 | FromDiscord | <Tetralux> sent a code paste, see https://play.nim-lang.org/#ix=49XG |
15:16:05 | FromDiscord | <Tetralux> (edit) "https://play.nim-lang.org/#ix=49XG" => "https://paste.rs/y6V" |
15:16:09 | FromDiscord | <Dumb Dragon> oh yeah that's actually much simpler |
15:16:28 | FromDiscord | <Tetralux> Right, exactly. |
15:23:26 | * | krux02 joined #nim |
15:30:10 | FromDiscord | <@thatrandomperson5-6310e3b26da03> Does anyone know where that list of useful packages is? By category |
15:31:45 | FromDiscord | <Dumb Dragon> https://github.com/ringabout/awesome-nim |
15:31:47 | FromDiscord | <Dumb Dragon> this one? |
15:44:30 | FromDiscord | <@thatrandomperson5-6310e3b26da03> Sure |
15:49:15 | * | jmdaemon joined #nim |
15:49:34 | FromDiscord | <@thatrandomperson5-6310e3b26da03> How do i list all my packages in my nim project? Is there a special file type? |
15:52:35 | FromDiscord | <aruZeta> to add packages to your nimble project you should add them to your `.nimble` file |
15:55:01 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=49XV |
15:56:16 | FromDiscord | <@thatrandomperson5-6310e3b26da03> But it says im missing version |
15:57:52 | FromDiscord | <Rika> what are you writing |
15:58:12 | FromDiscord | <@thatrandomperson5-6310e3b26da03> requires "nimquery" |
15:58:51 | FromDiscord | <soda> What's the best way to pass an array to a procedure? |
15:59:02 | FromDiscord | <soda> and |
15:59:20 | FromDiscord | <soda> what's the equivalent of passing an array by non-const pointer to a procedure? |
15:59:32 | FromDiscord | <soda> (edit) "an" => "a dynamic" |
16:00:04 | FromDiscord | <aruZeta> In reply to @@thatrandomperson5-6310e3b26da03 "requires "nimquery"": you need to specify a minimum version |
16:00:19 | FromDiscord | <aruZeta> just write `"nimquery >= 0.0.1"` |
16:00:45 | FromDiscord | <Rika> In reply to @aruZeta "you need to specify": you actually dont iirc |
16:00:51 | FromDiscord | <@thatrandomperson5-6310e3b26da03> \:thumbsup\:↵(@Rika) |
16:01:11 | FromDiscord | <Rika> In reply to @soda "What's the best way": dynamic array -> seq? |
16:01:14 | FromDiscord | <Rika> just pass it as is |
16:01:24 | FromDiscord | <Rika> In reply to @soda "what's the equivalent of": var seq? |
16:01:50 | FromDiscord | <soda> in all instances i meant seq |
16:01:53 | FromDiscord | <Rika> proc ...(a: var seq[...]) ... |
16:02:01 | FromDiscord | <Rika> for a mutable sequence |
16:02:02 | FromDiscord | <soda> ooh okay |
16:02:24 | FromDiscord | <Rika> the best way to pass a sequence given no mutability requirement is just to pass it as is |
16:02:30 | FromDiscord | <Rika> so same as i said without the var |
16:02:38 | FromDiscord | <soda> What is the underlying mechanism here? |
16:02:44 | FromDiscord | <soda> Is the array being passed by ref? |
16:02:49 | FromDiscord | <soda> also what about slices? |
16:02:54 | FromDiscord | <soda> how can i pass a slice? |
16:03:29 | FromDiscord | <Rika> In reply to @soda "Is the array being": by copy in this case |
16:03:39 | FromDiscord | <Rika> copy of the length, capacity, and data pointer |
16:03:42 | FromDiscord | <Rika> so nothing large |
16:04:00 | FromDiscord | <Rika> well, i think the data pointer contents are also copied, but i dont know for sure |
16:04:06 | FromDiscord | <soda> that is already kinda like a slice |
16:04:27 | FromDiscord | <soda> but i still can't seem to assign to the seq inside the procedure 🤔 |
16:04:32 | FromDiscord | <Rika> example |
16:04:45 | FromDiscord | <soda> no sorry my bad |
16:04:54 | FromDiscord | <soda> i was using an iterator wrong |
16:04:57 | FromDiscord | <Rika> oh ok |
16:08:11 | NimEventer | New post on r/nim by pusewicz: vim-test now supports Nim, see https://reddit.com/r/nim/comments/x94egk/vimtest_now_supports_nim/ |
16:10:21 | * | kenran quit (Ping timeout: 260 seconds) |
16:16:03 | * | kenran joined #nim |
16:36:23 | * | kenran quit (Quit: WeeChat info:version) |
17:06:25 | * | LuxuryMode quit (Quit: Connection closed for inactivity) |
17:30:14 | * | rez joined #nim |
17:32:51 | * | kenran joined #nim |
17:34:31 | * | kenran quit (Client Quit) |
17:43:18 | * | monkeybusiness joined #nim |
17:45:31 | * | rez quit (Ping timeout: 252 seconds) |
17:45:47 | * | rez joined #nim |
17:46:30 | * | LuxuryMode joined #nim |
17:46:44 | * | rez quit (Remote host closed the connection) |
17:56:23 | * | rez joined #nim |
18:46:16 | NimEventer | New thread by luntik2012: How can I buy "Mastering Nim" without using amazon services?, see https://forum.nim-lang.org/t/9449 |
18:50:49 | * | rez quit (Quit: much snoozes...) |
18:57:24 | FromDiscord | <halc> isn't nimpretty supposed to limit line length to 80 characters? It seems to arbitrarily ignore some of my +80 character type declarations |
18:59:22 | * | neceve_ joined #nim |
19:00:02 | * | neceve_ quit (Client Quit) |
19:00:24 | FromDiscord | <Phil> You manage to have type declarations beyond 80 characters? |
19:00:32 | FromDiscord | <Phil> I am fascinated, how? |
19:03:24 | FromDiscord | <Rainbow Asteroids> generics |
19:03:42 | FromDiscord | <halc> object variant containing proc pointers |
19:04:06 | FromDiscord | <Rainbow Asteroids> have you tried using std/sugar? |
19:05:31 | FromDiscord | <aruZeta> In reply to @Isofruit "You manage to have": oh boy |
19:05:48 | FromDiscord | <aruZeta> some of my procs do, but types? |
19:06:54 | FromDiscord | <aruZeta> In reply to @Rainbow Asteroids "have you tried using": now that you mention sugar, I have never actually used it and maybe it could be useful to refactor some of my lib's code, what does sugar provide? |
19:07:00 | FromDiscord | <halc> In reply to @Rainbow Asteroids "have you tried using": I'm not trying to shorten signatures, they are pretty long already, not much I can do about it since they come from another library |
19:07:51 | FromDiscord | <Phil> In reply to @aruZeta "now that you mention": 95% of the time I use sugar for "=>" for my anonymous procs |
19:07:57 | FromDiscord | <Rainbow Asteroids> In reply to @aruZeta "now that you mention": rtfm↵https://nim-lang.org/docs/sugar.html |
19:08:04 | FromDiscord | <aruZeta> In reply to @Rainbow Asteroids "rtfm https://nim-lang.org/docs/sugar.html": ik |
19:08:16 | FromDiscord | <aruZeta> I just wanted a general view of your usage |
19:08:29 | FromDiscord | <Rainbow Asteroids> I just use `collect` |
19:10:17 | FromDiscord | <halc> sent a code paste, see https://play.nim-lang.org/#ix=49Yw |
19:10:28 | FromDiscord | <halc> (edit) "https://play.nim-lang.org/#ix=49Yw" => "https://play.nim-lang.org/#ix=49Yx" |
19:10:35 | FromDiscord | <Phil> Oooof yeah I feel for you on that |
19:11:12 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=49Yy |
19:11:23 | FromDiscord | <aruZeta> (edit) "https://play.nim-lang.org/#ix=49Yy" => "https://play.nim-lang.org/#ix=49Yz" |
19:11:45 | FromDiscord | <Phil> In reply to @aruZeta "i do so manually": This means format war |
19:11:52 | FromDiscord | <aruZeta> haven't used a prettyfier in a long time lol |
19:11:54 | FromDiscord | <halc> In reply to @aruZeta "i do so manually": yeah, that's what I'd normally do, I was just hoping nimpretty would do it for me since I gotta do this for A LOT of signatures |
19:12:11 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=49YA |
19:12:12 | FromDiscord | <aruZeta> In reply to @Isofruit "This means format war": i struggled for a while on how should I format them |
19:12:43 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=49YB |
19:12:50 | FromDiscord | <aruZeta> (edit) "https://play.nim-lang.org/#ix=49YB" => "https://play.nim-lang.org/#ix=49YC" |
19:12:53 | FromDiscord | <aruZeta> lemme see it in my code |
19:12:58 | FromDiscord | <Phil> It's what I settled on in python and since also started applying in java and co |
19:13:59 | FromDiscord | <aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=49YE |
19:14:02 | FromDiscord | <aruZeta> yh that looks way better |
19:14:10 | FromDiscord | <aruZeta> and even more with the doc comments |
19:15:32 | FromDiscord | <Phil> ~~I kinda wish I was in the mental headspace to look at compiler stuff right now but tuesday to thursday is always such a rough time for mental work in my spare time~~ |
19:16:00 | FromDiscord | <aruZeta> even imports look better now |
19:16:15 | FromDiscord | <aruZeta> how did I not think of this lol |
19:20:29 | FromDiscord | <Phil> It's one of those things nobody ever actually looks for. I didn't either, I got it shown to me and over time agreed that it was good |
19:35:56 | FromDiscord | <geekrelief> @Yardanico beef, with the Unreal Engine "Engine" module bindings included. it takes 20 seconds to compile. We might be able to break it apart into smaller nim modules, but at some point in a big enough game, enough of it will be reimported slowing down compilation again. It looks like we'll need IC for the nimforue bindings to be viable because Unreal already has Live Coding which takes less than 10 seconds to recompile C++. |
19:46:07 | FromDiscord | <geekrelief> The compile times are a showstopper for nimforue. |
19:46:40 | FromDiscord | <planetis> Just ask Araq, IC when? |
19:48:03 | FromDiscord | <dom96> isn't Epic building some new scripting language for UE? |
19:48:15 | FromDiscord | <geekrelief> In reply to @dom96 "isn't Epic building some": yeah Verse |
19:48:36 | FromDiscord | <geekrelief> Simon Peyton Jones was hired to work on it. |
19:49:00 | FromDiscord | <dom96> oh cool |
19:50:06 | FromDiscord | <geekrelief> https://haskell.foundation/podcast/11/ |
19:50:32 | FromDiscord | <geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=49YQ |
19:56:57 | FromDiscord | <planetis> looks nice |
19:57:03 | FromDiscord | <planetis> (edit) |
19:57:54 | FromDiscord | <geekrelief> In reply to @planetis "Verse looks nice": Were you able to find some example code of it? |
19:58:23 | FromDiscord | <geekrelief> oh I found this https://benui.ca/unreal/scripting-languages/#verse |
19:58:24 | FromDiscord | <planetis> https://nitter.kavin.rocks/pic/orig/media%2FEpeZMhDUwAAYBWJ.jpg |
19:58:25 | FromDiscord | <planetis> https://nitter.kavin.rocks/saji8k/status/1339709691564179464?ref_src=twsrc%5Etfw%7Ctwcamp%5Etweetembed%7Ctwterm%5E1339709691564179464%7Ctwgr%5E7c5250e66c83a60ea9780bccaac4d6229b637a63%7Ctwcon%5Es1_&ref_url=https%3A%2F%2Fwww.redditmedia.com%2Fmediaembed%2Fkf8z27%3Fresponsive%3Dtrueis_nightmode%3Dtrue |
20:06:17 | * | rez joined #nim |
20:47:04 | FromDiscord | <ag> Is there a guide on generating DLLs from Nim? For example how to export, what sort of types we can export, how to use it from C etc. |
20:47:30 | FromDiscord | <Elegantbeef> https://github.com/treeform/genny is probably the easiest way about this |
20:49:41 | FromDiscord | <ag> In reply to @Elegantbeef "https://github.com/treeform/genny is probably the": Oh wow, it supports `ref object`s too! I wasn't expecting that. Thanks! |
20:50:29 | FromDiscord | <EyeCon> There's also https://github.com/byt3bl33d3r/OffensiveNim#creating-windows-dlls-with-an-exported-dllmain |
21:19:00 | * | derpydoo quit (Quit: derpydoo) |
21:23:13 | * | rez quit (Quit: much snoozes...) |
21:28:49 | * | monkeybusiness quit (Ping timeout: 252 seconds) |
21:34:12 | * | monkeybusiness joined #nim |
21:34:38 | * | monkeybusiness quit (Changing host) |
21:34:38 | * | monkeybusiness joined #nim |
21:50:26 | FromDiscord | <Patitotective> again, why std/json does `JsonNode = ref JsonNodeObj`? why a ref type? |
21:52:32 | FromDiscord | <dom96> because JsonNode can contain multiple JsonNodes |
21:52:45 | FromDiscord | <Patitotective> 🧠 |
21:53:35 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=49Zd |
21:59:20 | FromDiscord | <ezquerra> In reply to @PMunch "<@974046326088163438>, there is also": Is this the one that is bundled with nim or something else? I tried using gdb with nim and the experience was not great... |
22:00:02 | FromDiscord | <Patitotective> why? gdb works nice for me |
22:00:49 | FromDiscord | <ezquerra> For starters the gdb that is shipped with nim on windows is not "python enabled" |
22:01:55 | FromDiscord | <ezquerra> I tried it on Linux and while I was able to step through when I tried to view the variables I only saw a few mangled variables or variables that were not in the nim code |
22:02:05 | FromDiscord | <ezquerra> Maybe I did not properly call gdb with the right library? |
22:02:22 | FromDiscord | <ezquerra> (edit) "library?" => "script?" |
22:03:15 | FromDiscord | <Patitotective> https://nim-lang.org/blog/2017/10/02/documenting-profiling-and-debugging-nim-code.html#using-gdb-lldb |
22:03:59 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=49Zf |
22:04:36 | FromDiscord | <Patitotective> slicing is the option then 💀 |
22:04:42 | FromDiscord | <ezquerra> Also, I had issues trying to use --debugger:native with --mm:orc |
22:06:13 | FromDiscord | <ezquerra> In reply to @Patitotective "https://nim-lang.org/blog/2017/10/02/documenting-pr": Those instructions do not work for me, at least on windows. I get a message saying that gdb does not support python |
22:06:20 | FromDiscord | <Elegantbeef> parseutils should just use slices instead of start↵(@!Patitotective) |
22:06:41 | FromDiscord | <ezquerra> And on Linux, I could not list the variables properly |
22:06:46 | FromDiscord | <Elegantbeef> it's like a poor implementation of an openarray imo |
22:07:17 | FromDiscord | <Elegantbeef> What do you mean?↵(@!Patitotective) |
22:09:45 | FromDiscord | <Patitotective> In reply to @Elegantbeef "What do you mean?": dom said that `JsonNode` is a reference because it can contain it self (i think), but `KdlNode` is being recursive without being a ref :/ |
22:09:55 | FromDiscord | <Elegantbeef> It's not recursive directly |
22:09:58 | FromDiscord | <Elegantbeef> It has pointer indirection |
22:10:09 | FromDiscord | <Elegantbeef> `seq[T]` is pointer indirection |
22:10:38 | FromDiscord | <ezquerra> sent a code paste, see https://play.nim-lang.org/#ix=49Zg |
22:10:41 | FromDiscord | <ezquerra> (edit) "https://play.nim-lang.org/#ix=49Zg" => "https://paste.rs/Tfg" |
22:10:58 | FromDiscord | <ezquerra> Also fails with arc but does work fine with refc |
22:11:21 | FromDiscord | <Elegantbeef> You can usue a macro to unpack it before it generates the code |
22:13:34 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=49Zi |
22:14:28 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=49Zj |
22:16:21 | FromDiscord | <Patitotective> alsoo why is `range` a keyword? |
22:16:30 | FromDiscord | <Elegantbeef> Cause subrange types |
22:16:44 | FromDiscord | <Patitotective> right |
22:27:27 | FromDiscord | <ezquerra> In reply to @Elegantbeef "Probably need to make": Thanks! |
22:28:30 | FromDiscord | <Elegantbeef> I will note you can change the internals of `bodgeLocals` to format the locals how ever you want |
22:56:59 | FromDiscord | <! Nilts> How would i make a blank seq? |
22:57:08 | FromDiscord | <Elegantbeef> `@[]` |
22:59:31 | FromDiscord | <! Nilts> ok |
23:00:34 | FromDiscord | <! Nilts> sent a code paste, see https://play.nim-lang.org/#ix=49Zq |
23:00:57 | FromDiscord | <Elegantbeef> What's' your unary `/` do? |
23:01:10 | NimEventer | New thread by jmgomez: Slow compilation time in a big project. What branch contains Incremental Compilation?, see https://forum.nim-lang.org/t/9450 |
23:01:46 | FromDiscord | <! Nilts> In reply to @Elegantbeef "What's' your unary `/`": it is a template |
23:01:56 | FromDiscord | <Elegantbeef> Cool but that doesnt say what it does |
23:02:04 | FromDiscord | <Elegantbeef> It's obviously a template since it's returning |
23:02:43 | FromDiscord | <! Nilts> sent a code paste, see https://play.nim-lang.org/#ix=49Zr |
23:02:46 | FromDiscord | <Elegantbeef> You're returning |
23:02:54 | FromDiscord | <! Nilts> and? |
23:02:56 | FromDiscord | <Elegantbeef> Remove return |
23:03:00 | FromDiscord | <Elegantbeef> Templates are not procedures |
23:03:10 | FromDiscord | <Elegantbeef> The code is pasted verbatim |
23:03:21 | FromDiscord | <Elegantbeef> return exists a procedure |
23:03:29 | FromDiscord | <Elegantbeef> You're at top level code there is nothing to return from |
23:03:31 | FromDiscord | <! Nilts> so the last value becomes the output? |
23:03:40 | FromDiscord | <Elegantbeef> Nim has expressions so yes |
23:03:46 | * | Onionhammer quit (Quit: Ping timeout (120 seconds)) |
23:04:02 | FromDiscord | <! Nilts> ok |
23:04:02 | * | Onionhammer joined #nim |
23:04:49 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=49Zs |
23:04:52 | FromDiscord | <Elegantbeef> Whoops |
23:05:04 | FromDiscord | <Elegantbeef> last line should be `PathFromString("\\" & path)` |
23:05:24 | FromDiscord | <Elegantbeef> and it needs an else branch that is just `PathFromString(path)` |
23:09:40 | * | Jjp137 quit (Ping timeout: 244 seconds) |
23:09:59 | * | Jjp137 joined #nim |
23:13:04 | * | jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in) |