00:02:10 | FromDiscord | <guttural666> when building things yes, rather fail fast and hard |
00:02:22 | * | SamuelMarks joined #nim |
00:02:23 | SamuelMarks | hi |
00:02:32 | FromDiscord | <guttural666> tighter feedback loop, makes youl learn more faster |
00:04:18 | FromDiscord | <Elegantbeef> The real stupid solution would be to use `ref int` đ |
00:05:15 | FromDiscord | <bostonboston> sent a code paste, see https://paste.rs/CgTmD |
00:24:45 | FromDiscord | <Elegantbeef> I suppose someone should say 'hi' to that person that said 'hi; |
00:25:55 | FromDiscord | <guttural666> In reply to @SamuelMarks "hi": buongiorno! |
00:26:36 | FromDiscord | <guttural666> @ElegantBeef this should work somehow? https://media.discordapp.net/attachments/371759389889003532/1181753521750675476/image.png?ex=658234bb&is=656fbfbb&hm=2f95f2d672f7f02b752d67e8365ec650ad0413ad728005eeed05b26d26a57135& |
00:26:59 | FromDiscord | <Elegantbeef> Using async across threads is a nono |
00:27:01 | FromDiscord | <guttural666> maybe return the Futures as ptrs and keep them alive in the scheduler? |
00:27:30 | FromDiscord | <Elegantbeef> The creating thread should finish the future as each thread has it's own dispatcher |
00:27:31 | FromDiscord | <guttural666> well it would be contained to the scheduler, and if fullfilled passed to the caller |
00:27:53 | FromDiscord | <Elegantbeef> Does not matter where it's contained the async loop is thread local |
00:28:01 | FromDiscord | <Elegantbeef> So you should use channels likely to send results of async around |
00:28:19 | FromDiscord | <guttural666> thread to thread communication? |
00:28:48 | FromDiscord | <Elegantbeef> Yes |
00:29:21 | FromDiscord | <guttural666> mhhmmmm, okay, gonna write that down, channels I think are a thing in nim as well |
00:29:30 | FromDiscord | <Elegantbeef> Your main thread tells your consumers what they're working on then send a response to a channel which is a queue |
00:33:37 | * | SamuelMarks quit (Ping timeout: 268 seconds) |
00:33:53 | FromDiscord | <Elegantbeef> Depending what you're doing malebolgia/taskpools are better |
00:48:08 | FromDiscord | <graveflo> is there a convenience `proc` that converts a `NimNode`s data to string properly? Like it's kind and all of it's children and their kinds etc? |
00:48:16 | FromDiscord | <Elegantbeef> `repr`? |
00:48:20 | FromDiscord | <Elegantbeef> `treeRepr`? |
00:49:50 | FromDiscord | <graveflo> I think `repr` gives you what the syntax would look like if it were typed out, which is nice. I'll try `treeRepr`. Those procs seem to give you AST style output not necessarily data structure type of layout. Like if a `NimNode` has 3 sons it's hard to tell that and their kinds from those `procs` |
00:52:24 | FromDiscord | <graveflo> like if you had an `nnkCall` `NimNode`, say `node` and you do this: `node[0]` that might be something, but its hard to get an idea of what the 0th element of a `nnkCall` node is without seeing the data structure as a string as opposed to it's resulting AST |
00:52:59 | FromDiscord | <Elegantbeef> You don't have the entire Nim AST memorised?! |
00:53:06 | FromDiscord | <graveflo> no T.T |
00:53:29 | FromDiscord | <graveflo> I'll do it soon! I just need more time!! |
00:53:30 | FromDiscord | <Elegantbeef> https://github.com/beef331/nimscripter/blob/master/examples/macrorepl/macrorepl.nim this project does someone help with that though it's just more of a test of nimscripter |
00:54:08 | FromDiscord | <Elegantbeef> https://streamable.com/6m5ww1 |
01:21:21 | FromDiscord | <saint.___.> In reply to @Elegantbeef "https://streamable.com/6m5ww1": What editor are yo using ? |
01:23:52 | FromDiscord | <Elegantbeef> I was using vscode there |
01:35:35 | * | SamuelMarks joined #nim |
02:38:03 | * | lucasta quit (Quit: Leaving) |
03:45:42 | * | SamuelMarks quit (Ping timeout: 260 seconds) |
04:25:19 | NimEventer | New thread by ggb-sw1: How to create local packages, see https://forum.nim-lang.org/t/10734 |
04:26:19 | NimEventer | New thread by sls1005: 2nd level parameter typing, see https://forum.nim-lang.org/t/10735 |
04:32:14 | * | SamuelMarks joined #nim |
04:39:02 | * | SamuelMarks quit (Ping timeout: 255 seconds) |
05:40:39 | FromDiscord | <alireza0x0> anyone knows if nim strtabs with string keys are collison safe or not? |
05:40:59 | FromDiscord | <alireza0x0> i didn't find anyinformation about this..., |
05:45:51 | * | rockcavera quit (Remote host closed the connection) |
05:55:38 | FromDiscord | <alireza0x0> hmm i think its not as its not supposed to be ... |
05:57:24 | FromDiscord | <alireza0x0> by the way, today is 6 December , are the mastering nim book challenge winners choosen? I didnt receive any email đą |
06:02:37 | FromDiscord | <huantian> In reply to @alireza0x0 "anyone knows if nim": nim uses MurmurHash, so might be worthing looking at that |
06:04:28 | FromDiscord | <alireza0x0> In reply to @huantian "nim uses MurmurHash, so": interesting ! i wonder why this is not written in hashes docs... |
06:05:13 | FromDiscord | <alireza0x0> (edit) "written in" => "written/mentionedin" |
06:05:15 | FromDiscord | <huantian> yeah not sure |
06:05:17 | FromDiscord | <alireza0x0> (edit) "written/mentionedin" => "written/mentioned in" |
06:05:43 | FromDiscord | <huantian> one proc in the code that's used is `murmurHash` so i just assumed tho |
06:06:07 | FromDiscord | <alireza0x0> yea, google says its a very famous alg for hash tables |
07:15:06 | * | kenran joined #nim |
07:17:27 | * | advesperacit joined #nim |
07:17:35 | NimEventer | New thread by kobi: Hardware-software interaction in Nim, see https://forum.nim-lang.org/t/10736 |
07:51:43 | * | azimut quit (Ping timeout: 240 seconds) |
07:57:55 | * | PMunch joined #nim |
08:45:52 | * | arkanoid quit (Quit: WeeChat 3.5) |
08:47:12 | * | advesperacit quit () |
08:50:19 | * | advesperacit joined #nim |
09:01:54 | * | attah_ joined #nim |
09:02:44 | * | attah quit (Ping timeout: 255 seconds) |
09:02:44 | * | attah_ is now known as attah |
10:41:21 | * | jmdaemon quit (Ping timeout: 268 seconds) |
12:38:43 | * | dtomato quit (Ping timeout: 255 seconds) |
12:39:07 | * | dtomato joined #nim |
13:09:20 | FromDiscord | <9ih> nim is a great aoc language |
13:09:34 | FromDiscord | <9ih> (edit) "nim is a great ... aoc" added "language for" | removed "language" |
13:10:22 | FromDiscord | <nnsee> indeed |
13:10:30 | FromDiscord | <nnsee> check out the #aoc channel for more aoc-related chatter |
13:10:59 | * | azimut joined #nim |
13:11:18 | FromDiscord | <Phil> Conceptual channel question:â”If I send a message through a channel, how does it actually go from Thread A to thread B? |
13:11:55 | FromDiscord | <Phil> Does it go "Thread A sends messages to OS which forwards it to thread B" ? |
13:16:33 | FromDiscord | <nnsee> In reply to @isofruit "Conceptual channel question: If": i would assume that channels are an abstraction over a queue in memory (count of messages in the channel + data) and a lock/semaphore that handles safely accessing the queue |
13:16:43 | FromDiscord | <nnsee> not really sure what you mean by "messages to OS" |
13:18:09 | FromDiscord | <nnsee> actually, the channels implementation doesn't seem to be very complicated or long at all https://github.com/nim-lang/Nim/blob/version-2-0/lib/system/channels_builtin.nim |
13:18:32 | * | edr joined #nim |
13:36:09 | FromDiscord | <odexine> All references are pointers in that sense |
13:36:25 | FromDiscord | <kcvinker5420> In reply to @odexine "All references are pointers": Ah, okay. Thanks @odexine |
13:37:34 | FromDiscord | <kcvinker5420> sent a code paste, see https://paste.rs/YMLmn |
13:39:59 | FromDiscord | <kcvinker5420> (edit) "https://paste.rs/Sa4AQ" => "https://paste.rs/0XU7D" |
13:53:50 | FromDiscord | <Phil> In reply to @nnsee "not really sure what": Mostly whether the OS is somehow involved in message passing, thinking it through tough I don't think it is, since it is the semaphore that triggers the Callback on the other thread and all of this is basically just possible due to shared memory between the threads |
13:57:07 | FromDiscord | <nnsee> indeed |
13:57:24 | FromDiscord | <nnsee> well, the OS is involved by orchestrating memory management between threads :p |
13:57:35 | FromDiscord | <nnsee> but that's probably not what you had in mind |
14:38:12 | * | rockcavera joined #nim |
14:42:50 | * | SamuelMarks joined #nim |
14:47:44 | FromDiscord | <nnsee> hey, Nim is on the funny orange site |
14:47:45 | FromDiscord | <nnsee> https://news.ycombinator.com/item?id=38543491 |
14:48:27 | PMunch | nnsee, just titled "Nim" :P |
14:48:37 | FromDiscord | <nnsee> yeah i noticed that |
14:49:25 | FromDiscord | <ringabout> That's a funny title, but btw clicking on a shared URLdirectly doesn't increase the ranking of the article on the hackernews |
14:49:39 | FromDiscord | <nnsee> https://media.discordapp.net/attachments/371759389889003532/1181970713003962448/image.png?ex=6582ff01&is=65708a01&hm=c080c8d8a9946eee253ecae75576deb459599376a17538e8ce3955ea2bea1102& |
14:49:40 | FromDiscord | <nnsee> wow |
14:49:50 | FromDiscord | <nnsee> i think this is more indicative of the person's own mind |
14:50:04 | FromDiscord | <nnsee> because i've seen that cover like 5 times now and that image hasn't ever crossed my mind |
14:51:07 | FromDiscord | <Zoom> Yay, riding the HNFP! |
14:51:25 | FromDiscord | <Phil> In reply to @nnsee "i think this is": Was a case of "Now that you mentioned it I can't unsee it" for me |
14:52:50 | FromDiscord | <ringabout> Well, that picture was generated by AI in order to create a crown, it didn't occur to me when I saw it |
14:53:00 | FromDiscord | <Phil> FUCKING LOL |
14:53:08 | FromDiscord | <Phil> AI with a dirty mind |
14:55:44 | PMunch | Can you blame it? We trained it on stuff created by humans after all :P |
14:56:30 | * | kenran quit (Remote host closed the connection) |
15:06:57 | * | PMunch quit (Quit: Leaving) |
15:18:57 | FromDiscord | <Phil> Next concurrency question:â”To be on the safe-side that I understand Malebolgia correctly - It is a solution for e.g. running "map" on a list concurrently, correct?â”As in, you have a queue of independent tasks and you have a thread-pool that works through that queue one by one |
15:22:40 | FromDiscord | <fowl.mouth> In reply to @nnsee "because i've seen that": My wife saw it right away |
15:23:08 | FromDiscord | <fowl.mouth> Thought it was intentional đ |
15:48:09 | FromDiscord | <agent90702> Great language. |
15:49:42 | FromDiscord | <Clonkk> I think it shows, once again, that Nim needs an org that handles communication & marketing.â”(@nnsee) |
15:55:13 | FromDiscord | <so what i am a> helo every1 i am new 2 nim and i want to interface discordjs |
15:55:49 | FromDiscord | <so what i am a> import { Client, GatewayIntentBits } from 'discord.js';â”const client = new Client({ intents\: [GatewayIntentBits.Guilds] }); |
15:56:00 | FromDiscord | <so what i am a> how do i do the client |
16:00:59 | FromDiscord | <so what i am a> sent a long message, see https://paste.rs/yc4gZ |
16:16:45 | FromDiscord | <nnsee> In reply to @PMunch "<@961485620075720734>, just titled "Nim"": title is changed now |
16:28:32 | * | derpydoo joined #nim |
16:35:19 | FromDiscord | <spotlightkid> Yeah, that's what I wrote in the freeform comment entry of the Nim survey as well. |
16:36:05 | FromDiscord | <so what i am a> guyes hellp |
16:37:45 | FromDiscord | <Phil> There's not that many people that are more knowledgeable on the JS backend on the nim side that I'm aware ofâ”As per the usual obligatory @hotdog6666 ping for this |
16:38:10 | FromDiscord | <Phil> (edit) "more" => "all that" |
17:01:36 | * | SamuelMarks quit (Ping timeout: 245 seconds) |
17:31:32 | FromDiscord | <Phil> I wonder if I can use sysrand at compiletime |
17:33:16 | FromDiscord | <systemonia> Maybe you can use the static block in some way, or you can pass base64-encoded random data via string definitions (although that is kinda clunky) |
17:33:29 | FromDiscord | <Phil> The answer is no |
17:33:43 | FromDiscord | <Phil> Nah, generally stuff that calls "out of nim" is not compiletime |
17:33:49 | FromDiscord | <Phil> sysrand belongs to that |
17:33:55 | FromDiscord | <systemonia> oh |
17:34:51 | FromDiscord | <Phil> I just had hopes that I might be able to generate a random string at compiletime for an application id if the user forgets to set one đ
|
17:35:19 | FromDiscord | <systemonia> Hm... You could supply it as a build argument. |
17:35:29 | FromDiscord | <systemonia> But again, that is quite clunky. |
17:35:35 | FromDiscord | <systemonia> (edit) "clunky." => "clunky and annoying" |
17:35:47 | FromDiscord | <Phil> It also doesn't work because if you supply it as a build argument that means the user of your lib is supplying it, meaning they need to know about it |
17:35:58 | FromDiscord | <Phil> While the point is to generate something so they don't have to |
17:36:21 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/KJ5Q2 |
17:36:49 | FromDiscord | <systemonia> Now I am curious if you can use nimble tasks to do that. |
17:36:52 | FromDiscord | <gyatsoyt> Is anyone working on chess library? |
17:37:14 | FromDiscord | <systemonia> (edit) "do that." => "automate it." |
17:38:50 | FromDiscord | <Phil> Not that I'm aware of |
17:43:17 | FromDiscord | <systemonia> I tried taking advantage of nimble's before tasks but then quickly realized that nimscript lacks an FFI so std/sysrand is not available.â”In other words, it really is impossible. If it is absolutely important that the user sets a random seed then you can throw a fatal error on compile-time. But that might be annoying. |
17:44:42 | FromDiscord | <Phil> Turns out I really just did not understand how gtk notifications work |
17:44:50 | FromDiscord | <Phil> Which is to say they require you to have a desktop.ini file |
17:44:54 | FromDiscord | <Phil> Which I didn't |
17:45:20 | FromDiscord | <Phil> Wait, no... damn my head, right I still want to be able to avoid multiple identical notification thingies |
17:45:32 | FromDiscord | <so what i am a> [@hotdog6666](https://matrix.to/#/%40_discord_472459996068839424%3At2bot.io) can you help me please |
18:11:47 | FromDiscord | <systemonia> In reply to @so what i am a "{.emit\:""" import { Client,": Quick question, what features of discord.js do you plan to use? |
18:12:40 | FromDiscord | <systemonia> (edit) "In reply to @so what i am a "{.emit\:""" import { Client,": Quick question, what features of discord.js do you plan to use? ... " added "Do you only plan on using Client and GatewayIntentBits?" |
18:25:38 | FromDiscord | <can.l> Or is it just "undefined behaviour"? |
18:26:25 | FromDiscord | <can.l> sent a code paste, see https://paste.rs/nVIht |
18:26:26 | FromDiscord | <Phil> A stack overflow from unlimited recursion |
18:26:37 | FromDiscord | <systemonia> Its quite confusing |
18:26:45 | FromDiscord | <systemonia> Im gonna guess the same. |
18:27:05 | FromDiscord | <can.l> The question is basically, should a proc be able to deallocate its own closure? |
18:27:10 | FromDiscord | <can.l> In reply to @isofruit "A stack overflow from": Why that? |
18:28:38 | FromDiscord | <can.l> The current output is quite inconsistent: compiling it normally it outputs `99` with `-d:useMalloc` it outputs `10` |
18:29:18 | FromDiscord | <Phil> Create callback never finishes calling itself, there's no end condition that I can see |
18:29:50 | FromDiscord | <systemonia> It doesnt call it I think |
18:29:52 | FromDiscord | <can.l> It does not call itself though, it just replaces itself. |
18:30:25 | FromDiscord | <Phil> Missed the result on my phone |
18:30:28 | FromDiscord | <Phil> Hmm |
18:30:39 | FromDiscord | <can.l> With `--m:none` it outputs `10` again, with `--m:arc` it outputs `99` |
18:31:11 | FromDiscord | <can.l> (edit) "`--m:none`" => "`--mm:none`" | "`--m:arc`" => "`--mm:arc`" |
18:31:19 | FromDiscord | <can.l> `--mm:boehm` outputs `10` |
18:32:43 | FromDiscord | <can.l> This is my attempt at reducing https://github.com/can-lehmann/owlkettle/issues/145#issuecomment-1826929998 btw |
18:39:37 | FromDiscord | <Phil> Honestly I'm mostly chalking this one up as doing a thing you shouldn't |
18:40:03 | FromDiscord | <Phil> You don't manipulate data that belongs to the main thread in a side-task |
18:41:12 | FromDiscord | <Phil> That and the chess example were the reason I found myself trying to figure out an implementation for a server-client setup with owlkettle |
18:44:41 | FromDiscord | <can.l> The issue comment I linked to should definitely be ok though. |
18:44:50 | FromDiscord | <can.l> (edit) "be ok" => "work" |
18:46:10 | NimEventer | New thread by can-lehmann: What is the expected behaviour for a proc replacing its own closure?, see https://forum.nim-lang.org/t/10737 |
18:47:31 | * | SamuelMarks joined #nim |
18:59:39 | FromDiscord | <so what i am a> i want to use it to make a bot so client stuff onlyâ”(@pengwyns) |
18:59:57 | * | PMunch joined #nim |
19:00:50 | FromDiscord | <systemonia> Have you looked into using a pure Nim library for Discord? Since using Discord.js in nim requires wrapping it which might be a pain. |
19:01:59 | FromDiscord | <so what i am a> yea but i also want to understand how to do wrapping stuff |
19:02:03 | FromDiscord | <so what i am a> so i can wrap things that do not already have bindings |
19:03:53 | FromDiscord | <systemonia> I don't know much about wrapping Js libraries myself but I found these useful links: https://nim-lang.org/docs/jsffi.html https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-importjs-pragma |
19:03:57 | PMunch | Maaaay I interest you in Futhark? |
19:04:10 | PMunch | Oh, you where talking about JS stuff, never mind |
19:05:15 | FromDiscord | <so what i am a> i looked at those before and figured out how to wrap basic functions but idk how to wrap stuff that return objects or wrap constructers |
19:10:01 | PMunch | AoC stream is live! https://www.youtube.com/watch?v=kb-DrWCb_VE https://twitch.tv/pmunche |
19:12:24 | FromDiscord | <so what i am a> if i try adding "new" keyword i also get a type mismatch |
19:13:46 | FromDiscord | <so what i am a> sent a long message, see https://paste.rs/3kX3a |
19:25:53 | FromDiscord | <Phil> I'd like to question making a field private when you provide a proc that exposes it anyway |
19:26:03 | FromDiscord | <kcvinker5420> sent a code paste, see https://paste.rs/7UQNu |
19:26:11 | * | SamuelMarks quit (Quit: leaving) |
19:26:13 | FromDiscord | <Phil> For the rest let me see |
19:28:23 | FromDiscord | <kcvinker5420> Okay, I got the point. |
19:28:40 | NimEventer | New thread by ML: Forum dark theme, see https://forum.nim-lang.org/t/10738 |
19:29:07 | FromDiscord | <kcvinker5420> @Phil I just want to read only table |
19:29:09 | FromDiscord | <Phil> Wait... what version of nim are you using?â”How is `this._items` not murdering your compilation way before it even gets to that point? |
19:29:11 | FromDiscord | <kcvinker5420> (edit) "https://paste.rs/nzsZn" => "https://paste.rs/ypNVq" |
19:29:33 | FromDiscord | <Phil> Because `_` as the first character of a symbol should blow up in your face |
19:29:38 | FromDiscord | <kcvinker5420> (edit) "@Phil I just want to ... read" added "implement" |
19:29:59 | FromDiscord | <kcvinker5420> In reply to @isofruit "Because `_` as the": That's for showing here |
19:30:07 | FromDiscord | <kcvinker5420> I am using mItems |
19:30:25 | FromDiscord | <Phil> In reply to @kcvinker5420 "<@180601887916163073> I just want": In that case wouldn't that be simply providing a distinct table type, but only providing your own access procs without any mutation procs |
19:30:41 | NimEventer | New thread by vonH: An Ode to my Goddess Nim., see https://forum.nim-lang.org/t/10739 |
19:30:56 | FromDiscord | <Phil> Let me write up an example |
19:33:10 | FromDiscord | <Phil> I'm not that fast writing this code, give me a moment đ |
19:33:26 | FromDiscord | <kcvinker5420> Oky |
19:33:34 | FromDiscord | <kcvinker5420> (edit) "Oky" => "Okay" |
19:33:58 | FromDiscord | <odexine> i just got here i didnt backread |
19:34:17 | FromDiscord | <odexine> you dont, `tables` defines that proc generically |
19:34:40 | FromDiscord | <odexine> how would `this[key]` work otherwise haha |
19:34:43 | FromDiscord | <Phil> They want a read only table overall |
19:35:01 | FromDiscord | <kcvinker5420> sent a code paste, see https://paste.rs/bzz1w |
19:35:35 | FromDiscord | <kcvinker5420> In reply to @odexine "you dont, `tables` defines": If i didn't implemented the `[]` overload, I will get the type mismatch error |
19:35:59 | FromDiscord | <odexine> sent a code paste, see https://paste.rs/D1VM3 |
19:36:14 | FromDiscord | <kcvinker5420> sent a code paste, see https://paste.rs/tUk0x |
19:37:14 | FromDiscord | <Phil> Which I feel like should be more than enough of a warning sign for a programmer to not do that and instead work with your abstraction |
19:37:33 | FromDiscord | <odexine> sent a code paste, see https://paste.rs/A7ptd |
19:38:01 | FromDiscord | <kcvinker5420> sent a code paste, see https://paste.rs/oPlsT |
19:38:48 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/AYFot |
19:39:00 | FromDiscord | <kcvinker5420> In reply to @isofruit "Which I feel like": Solved with @odexine 's answer. |
19:39:21 | FromDiscord | <kcvinker5420> sent a code paste, see https://paste.rs/ZMqfq |
19:52:53 | NimEventer | New thread by nim-horse: How to wrap JS object returned from a JS function, see https://forum.nim-lang.org/t/10740 |
20:04:14 | FromDiscord | <9ih> what is actually the audience for nim |
20:04:21 | FromDiscord | <9ih> like I like it and I want to use it |
20:04:32 | FromDiscord | <9ih> but I'm just like your standard js soydev |
20:04:37 | FromDiscord | <9ih> is the audience for nim just javascript soydevs |
20:07:28 | * | jmdaemon joined #nim |
20:10:10 | FromDiscord | <systemonia> I am not a javascript dev (never was) but I enjoy programming it. Nim is used for quite a lot of things: embedded systems, web apps, data processing and I remember someone writing a kernel in it too! |
20:10:40 | FromDiscord | <systemonia> Nim is just a great language to use whenever. It has no specific niche I think |
20:10:55 | FromDiscord | <systemonia> (edit) "I am not a javascript dev (never was) but I enjoy programming ... it." added "in" |
20:31:02 | FromDiscord | <Phil> In reply to @9ih "but I'm just like": Note that there's no particular nieche.â”I'd say activity is more focused on embedded, appdev, gamdev and for webdev mostly the backend parts.â”There is of course the JS frontend and some folks are rather prolific in it, but that's not a terribly large amount of folks.â”Basically it makes more sense to ask that question in who uses which backend and I'm not aware of a ton of people doing more elabor |
20:32:04 | FromDiscord | <Phil> That's not to say that won't change, hotdog stated he wanted to do some work on karax docs and I'm looking forward to them quite a bit, particularly since I'd be tempted to try a rewrite of the snorlogue frontend if he does. |
20:32:52 | FromDiscord | <Phil> Which might spiral into other things like how owlkettle somehow spiraled into me writing a lib about spawning a thread as a server for easy multithreading |
20:33:05 | FromDiscord | <Phil> (edit) "Which might spiral into other things like how ... owlkettle" added "contributing to" |
20:33:23 | FromDiscord | <Phil> (edit) "server" => "server-like-backend" | "server-like-backendfor easy multithreading ... " added "with owlkettle (or generally any "frontend")" |
20:33:32 | FromDiscord | <Phil> (edit) "Which might spiral into other things like how contributing to owlkettle somehow spiraled into me writing a lib about spawning a thread as a server-like-backend for easy multithreading with owlkettle (or generally any ... "frontend")" added "native" |
20:34:22 | FromDiscord | <9ih> I'm wondering rn if it might be a fun sorta scripting language |
20:34:27 | FromDiscord | <9ih> in the same way that Unreal uses C++ |
20:34:34 | FromDiscord | <9ih> (edit) "in the same way that Unreal uses C++ ... " added "for scripting" |
20:34:36 | FromDiscord | <9ih> (edit) "scripting" => ""scripting"" |
20:34:43 | FromDiscord | <Elegantbeef> You could use it the same way |
20:34:53 | FromDiscord | <voidwalker> I use it instead of bash for random scripting in a more sane way |
20:34:55 | FromDiscord | <Phil> enu uses nim for scripting which is based on godot 3 |
20:34:55 | FromDiscord | <Elegantbeef> It's a language that can technically be used "anywhere" |
20:34:57 | FromDiscord | <9ih> how easy is it to embed? like insert into a C program |
20:35:03 | FromDiscord | <Elegantbeef> Enu uses nimscript\ |
20:35:03 | FromDiscord | <9ih> (edit) "how easy is it to embed? like insert into a C program ... " added "and execute" |
20:35:05 | FromDiscord | <9ih> wait |
20:35:12 | FromDiscord | <9ih> nvm I forgot it was compiled |
20:35:20 | FromDiscord | <Elegantbeef> Nim is not a scripting language, nimscript is |
20:35:21 | FromDiscord | <9ih> (edit) "how" => "~~how" | "execute" => "execute~~" |
20:35:34 | FromDiscord | <Phil> Ah, fair, I just saw the code and assumed it was actual nim |
20:36:12 | FromDiscord | <Phil> In reply to @9ih "nvm I forgot it": I mean, that and nim's most used backend is the C backend |
20:36:16 | FromDiscord | <Elegantbeef> You could use Nim just like Unreal uses C++ |
20:36:41 | FromDiscord | <Elegantbeef> Compile into a system library and reload that using your own version of hot code reload(nim's HCR is broken) |
20:36:44 | FromDiscord | <9ih> I haven't actually looked into how Unreal uses C++. does it compile to like a library file? like dll or something |
20:36:55 | FromDiscord | <9ih> and can nim be compiled into a dll? |
20:37:05 | FromDiscord | <Elegantbeef> It's a system language |
20:38:20 | FromDiscord | <Phil> In reply to @9ih "I haven't actually looked": Why wouldn't it? It compiles to C, integrates easily with it and its toolchain. |
20:38:46 | FromDiscord | <Elegantbeef> Phil responding to the wrong part of the message đ |
20:39:53 | FromDiscord | <9ih> hm okay interesting |
20:40:07 | FromDiscord | <9ih> even though I'm struggling to see the specific like |
20:40:12 | FromDiscord | <9ih> or not specific but even general kinda usecase for nim |
20:40:17 | FromDiscord | <9ih> I think it's honestly just a really nice language |
20:40:20 | FromDiscord | <Elegantbeef> Thanks to jmgomez's work you can even use NimForUE and use Nim inside UE |
20:40:37 | FromDiscord | <9ih> I love all of the design features and it just seems to be well rounded |
20:40:44 | FromDiscord | <9ih> so maybe I can find my own use for it |
20:40:44 | FromDiscord | <Elegantbeef> Nim exists for the same reason Rust, Zig, Odin, C, C++, exist |
20:40:57 | FromDiscord | <9ih> I don't see how Nim can really compete with Rust Zig or C/C++ |
20:41:03 | FromDiscord | <Elegantbeef> It does |
20:41:07 | FromDiscord | <Elegantbeef> Performance wise |
20:41:28 | FromDiscord | <9ih> I mean you're necessarily dropping performance by compiling to C in the first place |
20:41:32 | FromDiscord | <Elegantbeef> It gives tonnes of control so it's not down to the language it's down to the logic implement |
20:41:36 | FromDiscord | <Elegantbeef> No you're not |
20:41:41 | FromDiscord | <Phil> In reply to @9ih "I mean you're necessarily": What? |
20:41:47 | FromDiscord | <Phil> Okay, please elaborate how you come to that conclusion |
20:41:55 | FromDiscord | <Elegantbeef> C is not inherently faster than any language |
20:42:00 | FromDiscord | <Elegantbeef> You can write shit code in any language |
20:42:01 | FromDiscord | <9ih> how can it be faster than C if it's compiling C? |
20:42:04 | FromDiscord | <Elegantbeef> What it comes down to is the programmer |
20:42:10 | FromDiscord | <9ih> that's like Nim >= C |
20:42:13 | FromDiscord | <9ih> necessarily |
20:42:19 | FromDiscord | <Phil> In reply to @9ih "how can it be": That's not how this works |
20:42:24 | FromDiscord | <Elegantbeef> Cause the code you can write in Nim can be optimised for humans and not machine but output code that is faster than idiomatic C |
20:42:45 | FromDiscord | <Elegantbeef> We have proper macros for instance, so any low level optimisation can be done in a highlevel way and be readable |
20:42:46 | FromDiscord | <systemonia> Also C compiler generally have good optimizations to ensure that code runs performant. |
20:43:07 | FromDiscord | <9ih> ya but it's never going to generate perfectly optimised code |
20:43:12 | FromDiscord | <Elegantbeef> So Nim allows more productivity and an easier window into optimisations |
20:43:28 | FromDiscord | <Phil> Fundamentally it's all about the amount of operations needed to do a thing.â”Your code is faster the more optimal your pattern is.â”Nim is going to generate you faster code because getting to more optimal patterns is just easier than it is in C. |
20:43:31 | FromDiscord | <Elegantbeef> https://nim-lang.org/blog/2021/07/28/Nim-Efficient-Expressive-Elegant-Benchmarking.html refer to this |
20:43:38 | FromDiscord | <Elegantbeef> Language is never the bottleneck it's thecleverness of the proigrammer |
20:44:29 | FromDiscord | <Phil> (edit) "Fundamentally it's all about the amount of operations needed to do a thing.â”Your code is faster the more optimal your pattern ... is.â”Nim" added "of operations" |
20:44:48 | FromDiscord | <Elegantbeef> "the cleverness of the programmer is"\ |
20:45:10 | FromDiscord | <Phil> In reply to @Elegantbeef "Language is never the": Java. |
20:45:15 | FromDiscord | <systemonia> One way Nim is slower is in fx. compilation times but that's obvious. It would of course take some time to generate C code from Nim code.â”For all the wonderful perks we get with Nim, I am okay with slightly higher compilation times. |
20:45:54 | FromDiscord | <Elegantbeef> Hey I do not see a Nim compiler written in C sitting around đ |
20:45:56 | FromDiscord | <Phil> In reply to @pengwyns "One way Nim is": Fun fact if you want to play around with that and have 20GB or so harddrive space free, arne's nlvm repo now comes with a repl |
20:46:17 | FromDiscord | <michaelb.eth> In reply to @9ih "how can it be": simple: depends on how the C code is written. The C code generated by Nimâs C backend is designed to compile to fast and efficient executable. A human can write similar C code but may or may not be as fast/efficient depending on the developer and how well s/he understands the compiler toolchain, etc. |
20:46:18 | FromDiscord | <9ih> I mean I'm just basing off the output it generates for JS |
20:46:27 | FromDiscord | <9ih> as far as I can tell, the code it generates for JS is going to be unbearably slow |
20:46:28 | FromDiscord | <Elegantbeef> Or you could just use https://github.com/arnetheduck/nlvm/releases Phil |
20:46:28 | FromDiscord | <Phil> And if I understood the repo correctly it goes directly to binary through llvm's IR rather than C |
20:46:28 | FromDiscord | <systemonia> Oh really? Thats amazing! I never tried nlvm tho but now thats one more reason to give it a shot. |
20:46:37 | FromDiscord | <9ih> (edit) "as far as I can tell, the code it generates for JS is going to be unbearably slow ... " added "compared to just writing JS" |
20:46:51 | FromDiscord | <Elegantbeef> JS does not have many of the features of Nim |
20:46:56 | FromDiscord | <Phil> In reply to @Elegantbeef "Or you could just": That makes a lot more sense |
20:46:57 | FromDiscord | <Elegantbeef> So you have to bootstrap features of Nim inside JS |
20:46:58 | FromDiscord | <systemonia> I generally dislike LLVM but I think my dislike is irrational rather than rational |
20:47:07 | FromDiscord | <Elegantbeef> It's also targeting ES3 |
20:47:15 | FromDiscord | <Elegantbeef> Plus you likely are not doing `-d:danger` |
20:47:15 | FromDiscord | <Phil> Now I wonder how the heck an AppImage of that works |
20:47:25 | FromDiscord | <Elegantbeef> It's 43mb |
20:47:28 | FromDiscord | <Phil> -d:danger does anything for JS? |
20:47:31 | FromDiscord | <Elegantbeef> It includes llvm |
20:47:42 | FromDiscord | <Elegantbeef> It removes a lot of checks and aggressively DCEs |
20:47:47 | FromDiscord | <Phil> But in JS? |
20:47:52 | FromDiscord | <Elegantbeef> Yes |
20:47:57 | FromDiscord | <Elegantbeef> It reduces size substantially |
20:48:02 | FromDiscord | <Elegantbeef> Removes any Nim stack info |
20:48:15 | FromDiscord | <Elegantbeef> It's mostly about code size there |
20:48:28 | FromDiscord | <Elegantbeef> It also removes some checks though iirc |
20:48:44 | FromDiscord | <Phil> In reply to @Elegantbeef "It includes llvm": No I don't think you get what I mean:â”I never opened an AppImage that wasn't a gui, I'm not yet sure if I can just double click that binary |
20:49:00 | FromDiscord | <Elegantbeef> You `chmod +x` and use it like you use nim |
20:49:04 | FromDiscord | <systemonia> Try running it thru the comamnd line |
20:49:17 | FromDiscord | <systemonia> (edit) "comamnd" => "command" |
20:49:35 | FromDiscord | <Phil> Ohhh it functions as a CLI tool |
20:49:40 | FromDiscord | <systemonia> Exactly |
20:49:42 | FromDiscord | <9ih> In reply to @Elegantbeef "Plus you likely are": sorry but there's no way https://media.discordapp.net/attachments/371759389889003532/1182061324218417172/image.png?ex=65835365&is=6570de65&hm=185867a8c598f2aa3ebb5475b33544f201bf35aa69477b662877670a3813611e& |
20:49:54 | FromDiscord | <9ih> 75 line nim code |
20:51:47 | FromDiscord | <ElegantBeef> Bridge died |
20:51:50 | FromDiscord | <ElegantBeef> https://media.discordapp.net/attachments/371759389889003532/1182061860921561188/image.png?ex=658353e5&is=6570dee5&hm=cc5c81c3b56e16f1ef5259e30e6ba07a669e3178c5a05fbcf940153f0452c142& |
20:52:30 | FromDiscord | <ElegantBeef> But anyway using JS output as a benchmark has got to be a joke |
20:53:01 | FromDiscord | <ElegantBeef> JS as a backend language means you need to reimplement many things that Nim has |
20:53:17 | FromDiscord | <systemonia> I don't think its that much slower than vanilla Js. But, who knows. |
20:53:23 | FromDiscord | <systemonia> (edit) "I don't think its that much slower than ... vanilla" added "pure" |
20:53:54 | FromDiscord | <systemonia> Browsers regularly execute thousands upon thousands of lines of js. |
20:53:58 | FromDiscord | <Phil> I don't think he was implying to use nim-js for backend |
20:54:04 | FromDiscord | <Phil> That would seem like a strange idea |
20:54:15 | FromDiscord | <ElegantBeef> Like you have to replicate value types, Nim exception handling, Nim runtime type information |
20:54:19 | FromDiscord | <ElegantBeef> I mean a Nim backend language phil |
20:54:28 | FromDiscord | <ElegantBeef> Nim's JS generator is Nim's JS backend |
20:54:43 | FromDiscord | <systemonia> Like C or C++. Not actually using Js as a backend :P |
20:54:45 | FromDiscord | <Phil> Oh wow, webdev brain "Backend" => Server lang |
20:55:01 | * | disso-peach quit (Quit: Leaving) |
20:55:03 | FromDiscord | <Elegantbeef> What's your point? |
20:55:05 | FromDiscord | <Elegantbeef> "There's a lot of code" |
20:55:06 | FromDiscord | <ElegantBeef> Ah there we go |
20:55:07 | FromDiscord | <Elegantbeef> Did you compile with `-d:danger`, then run it through a minifier or the closure(clojure) compiler? |
20:55:09 | FromDiscord | <Elegantbeef> Did you also actually benchmark it? |
20:55:10 | FromDiscord | <Elegantbeef> Ping |
20:55:12 | FromDiscord | <systemonia> oh no |
20:55:13 | FromDiscord | <ElegantBeef> Fucking slowpoke |
20:55:23 | FromDiscord | <Phil> That beef guy sounds like he has great ideas |
20:55:25 | FromDiscord | <systemonia> (edit) "oh no ... " added "(nvm)" |
20:55:28 | FromDiscord | <Phil> You should learn from him beef |
20:55:31 | FromDiscord | <ElegantBeef> Indeed |
20:56:58 | FromDiscord | <Phil> Beef, can I do kind of like a mixin but for a generic type of a generic proc? |
20:57:07 | FromDiscord | <ElegantBeef> What does that even mean |
20:57:37 | FromDiscord | <Phil> Like I know the name of the types, I know they will exist, I just have to generate it first because I generate all the fields belonging to them |
20:58:38 | FromDiscord | <Phil> They just strictly speaking don't exist yet |
20:58:49 | FromDiscord | <Phil> but they will in the user's code! |
20:58:51 | FromDiscord | <ElegantBeef> Use a concept |
20:59:05 | FromDiscord | <ElegantBeef> Or inheritance |
20:59:07 | FromDiscord | <ElegantBeef> Whichever you prefer |
20:59:37 | FromDiscord | <Phil> I am legit uncertain how a concept for that would look like |
21:00:10 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/XF0wH |
21:01:26 | FromDiscord | <Phil> Wait, that doesn't reduce my problem, that just narrowed down my generic.â”I still have 3 generic parameters that I'd like to shrink down to 1 |
21:01:48 | FromDiscord | <Phil> Since I know the name of 2 of the 3 |
21:01:56 | FromDiscord | <ElegantBeef> I'm so lost at what the actual issue is |
21:02:04 | FromDiscord | <ElegantBeef> Why do you have a generic procedure if you do not want it to be generic |
21:02:42 | FromDiscord | <ElegantBeef> If the user will implement `ServerMessage` and `ClientMessage` forward declare them and force the user to either use a macro or include it |
21:02:50 | FromDiscord | <ElegantBeef> sent a code paste, see https://paste.rs/rRS6y |
21:03:04 | FromDiscord | <Phil> In reply to @elegantbeef "Why do you have": Essentially, ServerMessage and ClientMessage are object variants I generate based on types/procs the user annotates with my pragmas. |
21:03:22 | FromDiscord | <ElegantBeef> So why not just make `createListenerEvent` a template? |
21:03:25 | FromDiscord | <Phil> I hide some of the interaction with those variants from the user |
21:03:31 | FromDiscord | <ElegantBeef> That way it's created when invoked |
21:03:37 | FromDiscord | <ElegantBeef> Instead of inside of your program |
21:04:01 | FromDiscord | <Phil> Good point, haven't tried it out yet, will do.â”Templates are one of the things I tend to just not think of |
21:04:32 | FromDiscord | <Phil> I have triggers in my mind that make me think of generics and macros when appropriate, for template I only have stuff where I want to write a context-manager |
21:04:46 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/Kfq5d |
21:04:49 | FromDiscord | <ElegantBeef> One thing I've realised is templates can be used as generics that always resolve scope at callsite |
21:04:54 | FromDiscord | <systemonia> For how long will `-d:nimOldCaseObjects` continue to work? I really hope it won't get removed soon, since I just finished writing my config parser library. |
21:05:15 | FromDiscord | <ElegantBeef> No clue, it's very nice to be able to change branches |
21:05:34 | FromDiscord | <Phil> In reply to @elegantbeef "One thing I've realised": I get what you mean, but I think I'll just have to internalize that more |
21:05:37 | FromDiscord | <ElegantBeef> Though I think the new way is to use `{.cast(uncheckedAssign).}:...` |
21:05:52 | FromDiscord | <Phil> ~~Like an internalized string, being ever present until destruction~~ |
21:06:13 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/manual.html#types-cast-uncheckedassign @pengwyns |
21:09:01 | FromDiscord | <Phil> Worked like a flipping charm |
21:09:52 | FromDiscord | <imagio> Is there a way to sort/filter on https://nimble.directory/ ? I just discovered nim and am exploring libraries. Unfortunately most of the results on nimble.directory are unmaintained for 4+ years. I'd like to see some of the more popular/active projects in nim. |
21:10:17 | FromDiscord | <imagio> (edit) "see" => "check out" |
21:10:56 | FromDiscord | <imagio> (edit) "Is there a way to sort/filter on https://nimble.directory/ ? I just discovered nim and am exploring libraries. Unfortunately most of the results on nimble.directory ... are" added "I've clicked on" |
21:11:17 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/IZ72r |
21:11:54 | FromDiscord | <Phil> not that I'm aware of sadly, trending packages is the best you've got there.â”If you want to dive into karax though it should be pretty doable to add a sorting functionality ^^' |
21:13:47 | FromDiscord | <Phil> Slap a dropdown onto the "browse all packages" - Assuming there's not some github API limitation that is the root of the issue |
21:14:12 | FromDiscord | <Phil> (edit) "Slap a dropdown onto the "browse all packages" ... -" added "with a changed event-listener that triggers a sorting proc" |
21:14:23 | FromDiscord | <imagio> Of course as someone who works in TS daily I'm used to the terrible state of the JS ecosystem where something that hasn't been updated for 3 months is probably broken. I'm guessing older nim code probably works just fine. |
21:16:35 | FromDiscord | <hotdog6666> In reply to @isofruit "There's not *that* many": The bat signal was raised đ«Ą |
21:16:50 | FromDiscord | <Phil> In reply to @hotdog6666 "The bat signal was": There actually is now a nim thread calling for your aid! |
21:17:14 | FromDiscord | <Phil> Question, is there actually a repo for the nimble.directory |
21:17:19 | FromDiscord | <Phil> (edit) "Question, is there actually a repo for the nimble.directory" => "https://forum.nim-lang.org/t/10740" |
21:18:58 | FromDiscord | <hotdog6666> In reply to @so what i am a "guyes hellp": Are you still having trouble? Post in #webdev in might be easier to separate from the messages in main |
21:19:13 | FromDiscord | <hotdog6666> In reply to @isofruit "There actually is now": Ah |
21:19:28 | FromDiscord | <Phil> It's the same guy ^^ |
21:19:34 | FromDiscord | <hotdog6666> In reply to @isofruit "not that I'm aware": There is even a basic Karax example along these lines |
21:19:58 | FromDiscord | <Phil> Fun fact, I have no idea where the rpeo for that site is |
21:20:25 | FromDiscord | <Phil> (edit) "rpeo" => "repo" |
21:20:52 | FromDiscord | <hotdog6666> In reply to @imagio "Is there a way": @Phil @imagio https://github.com/karaxnim/karax/blob/master/examples/ajax/ajax.nim this might be a good starting point |
21:21:02 | FromDiscord | <piqueiras> If I have a seq of arrays with 2 elements is there a cool way to find the minimum of the elements in position 0 or just do normal way |
21:21:23 | FromDiscord | <hotdog6666> In reply to @isofruit "It's the same guy": Oh Iâm on mobile, hard to follow whatâs happening |
21:21:51 | FromDiscord | <piqueiras> Or turn a seq of arrays[N] into an array[N] of seqs |
21:22:11 | FromDiscord | <Phil> In reply to @piqueiras "If I have a": I assume you already looked in sequtils and math? |
21:23:12 | FromDiscord | <Phil> Or just looked for min in the holy searchbar (I swear I'll make a stylized gif about clouds and angels singing framing that thing one day) |
21:23:22 | FromDiscord | <Phil> (only to have it inevitably used against me) |
21:23:46 | FromDiscord | <piqueiras> In reply to @isofruit "I assume you already": i mean there must be some weird lifting seqs thing |
21:24:10 | FromDiscord | <Phil> In reply to @piqueiras "i mean there must": There is, but have you checked or are you banking on me typing into the searchbar đ ? |
21:24:57 | FromDiscord | <piqueiras> is |
21:25:00 | FromDiscord | <piqueiras> is zip for that? |
21:25:19 | FromDiscord | <Phil> I mean, without having found any docs for it, try @[1,5,3].max |
21:25:34 | FromDiscord | <piqueiras> i mean |
21:25:37 | FromDiscord | <piqueiras> i know about that |
21:25:51 | FromDiscord | <piqueiras> but i have a seq of arrays |
21:26:21 | FromDiscord | <Phil> Ahh check, in that case the functional way would be map and then max |
21:26:25 | FromDiscord | <nnsee> use `fold` |
21:26:25 | FromDiscord | <Phil> Which is wasteful to hell |
21:26:37 | FromDiscord | <Phil> Yeah fold likely is better |
21:27:35 | FromDiscord | <piqueiras> hmm |
21:27:42 | FromDiscord | <piqueiras> In reply to @piqueiras "Or turn a seq": and this? |
21:28:57 | FromDiscord | <Phil> I may be developing a cold because I can't even conceptualize the question and I know I should be able to |
21:29:03 | FromDiscord | <nnsee> In reply to @piqueiras "Or turn a seq": array sizes must be known at compile time |
21:29:14 | FromDiscord | <nnsee> seqs can be of any size |
21:29:23 | FromDiscord | <nnsee> so that won't even conceptually work |
21:30:57 | FromDiscord | <ElegantBeef> It does work if they want to only grab the first X |
21:32:31 | FromDiscord | <nnsee> i'm probably not fully understanding what they mean |
21:33:20 | FromDiscord | <piqueiras> In reply to @nnsee "array sizes must be": yeah ive had some problems with that |
21:33:32 | FromDiscord | <piqueiras> so take seq of seqs |
21:33:41 | FromDiscord | <piqueiras> and turn it the other way |
21:34:28 | FromDiscord | <ElegantBeef> Really though that can jusut be `s: seq[T]` |
21:34:50 | FromDiscord | <piqueiras> so yea just make one oneself |
21:35:11 | FromDiscord | <ElegantBeef> Yea, it's not a common thing to convert a seq to an array |
21:35:15 | FromDiscord | <ElegantBeef> It's pretty pointless |
21:35:25 | FromDiscord | <piqueiras> understandable |
21:35:53 | FromDiscord | <ElegantBeef> sent a code paste, see https://paste.rs/LePIw |
21:43:59 | NimEventer | New thread by Boston: Dealing with arrays (of bytes) across library boundaries, specifically C# , see https://forum.nim-lang.org/t/10741 |
21:44:59 | FromDiscord | <imagio> In reply to @isofruit "Slap a dropdown onto": Could be a good learning exercise. Unfortunately it seems that the package_directory repo doesn't compile under nim 2.0. I forked it and it fails on `nimble install` but that's a good learning exercise too đ |
21:57:57 | FromDiscord | <Phil> ... erk, yeah, a lot of that is mostly telling the compiler to shut up from what I can see about global access |
21:58:23 | FromDiscord | <Phil> Copious amounts of `{.cast(gcsafe).}` |
21:58:32 | FromDiscord | <Phil> (edit) "`{.cast(gcsafe).}`" => "`{.cast(gcsafe).}:`" |
21:58:44 | FromDiscord | <imagio> yeah it's complaining about util.log being not gcsafe because it's a top level/global definition |
21:58:54 | FromDiscord | <Phil> In reply to @imagio "yeah it's complaining about": That one is fairly easy tbh |
21:59:00 | FromDiscord | <imagio> I haven't read enough of the manual yet to understand why or what to do about that lol |
21:59:32 | FromDiscord | <systemonia> `{.cast(gcsafe).}:` brings me so many memories of trying so hard to create global variables. (Even though `threadvar` was way easier) |
21:59:43 | FromDiscord | <Phil> In reply to @imagio "I haven't read enough": Essentially accessing globals is never safe because another thread could be manipulating those, etc., you can never be sure what state they're in |
21:59:55 | FromDiscord | <Phil> But in this case "you know better", so you use brute force, which is cast-gcsafe |
22:00:09 | FromDiscord | <Phil> It looks ugly and intentionally so, to discourage global usage |
22:00:17 | FromDiscord | <Phil> (edit) "global" => "globals" |
22:00:20 | FromDiscord | <imagio> First I tried threadvar, but `Error: a thread var cannot be initialized explicitly; this would only run for the main thread` |
22:00:39 | FromDiscord | <imagio> Then I discovered `cast(gcsafe)` but I haven't learned enough yet to figure out if that's safe or not |
22:00:51 | FromDiscord | <Elegantbeef> Then pass it to the thread as a `ptr T` from the main thread |
22:00:55 | FromDiscord | <Elegantbeef> Globals are bad |
22:01:05 | FromDiscord | <systemonia> Oh I just made a proc to initialize the `threadvar`, I thought that was a normal thing to do. |
22:01:16 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/CyJrd |
22:01:21 | FromDiscord | <Phil> But that is assuming you run in a multithreaded environment that needs locking datastructures |
22:01:36 | FromDiscord | <Phil> In a single threaded scenario it's still bad, but you're not running into multithreading issues |
22:01:39 | FromDiscord | <Elegantbeef> Right if you don't need locking and there is no gc'd memory you just pass a `ptr T` |
22:01:42 | FromDiscord | <Phil> (edit) "In a single threaded scenario it's still bad, but you're not running into multithreading issues ... " added "that a lock would oslve" |
22:02:30 | FromDiscord | <Phil> (edit) "oslve" => "solve" |
22:02:51 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/9NEj0 |
22:03:04 | FromDiscord | <imagio> I'm a total newbie to nim here, and I haven't done enough reading yet. This is not my code, I just forked https://github.com/FedericoCeratto/nim-package-directory to investigate adding a sort/filter as a learning exercise and it didn't compile for me due to this gcsafe global. |
22:03:06 | FromDiscord | <systemonia> Not sure why `let`s aren't considered gcsafe, even though they are immutable. |
22:03:08 | FromDiscord | <michaelb.eth> In reply to @isofruit "But in this case": if youâre using `refc` then you can end up with SIGSEGV even if âyou know betterâ because of opaque things happening with the gc |
22:06:26 | FromDiscord | <hotdog6666> In reply to @imagio "I'm a total newbie": It probably needs an older version of Nim |
22:06:36 | FromDiscord | <imagio> looks like this project has a bunch of globals that trigger the same problem |
22:08:07 | FromDiscord | <imagio> i'll try nim 1.6.16 |
22:09:32 | FromDiscord | <systemonia> good luck |
22:16:46 | FromDiscord | <imagio> In reply to @pengwyns "good luck": Yep it works on 1.6.16. Is it common for older code to have problems compiling on 2.0? |
22:23:30 | FromDiscord | <Phil> Can you... not have a default value for template params? |
22:24:48 | FromDiscord | <odexine> do you see what you wrote xd |
22:25:31 | FromDiscord | <odexine> why? see parameter name |
22:26:26 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/uFPr3 |
22:27:13 | FromDiscord | <odexine> sent a code paste, see https://paste.rs/XoHqZ |
22:28:19 | FromDiscord | <Elegantbeef> They're not constants you can do `myLet.addr[] = ....`â”(@pengwyns) |
22:34:44 | FromDiscord | <Phil> In reply to @odexine "that expands to ": I think I just never considered it to be able to do code substition on a field name, no idea why |
22:36:20 | FromDiscord | <Phil> I think I can cut out a couple servers in that first block |
22:36:25 | FromDiscord | <Phil> (edit) "I think I can cut out a couple servers ... in" added "words" |
22:37:06 | FromDiscord | <michaelb.eth> In reply to @imagio "Yep it works on": whatâs the codebase? |
22:37:26 | FromDiscord | <Phil> https://github.com/FedericoCeratto/nim-package-directoryâ”Jester with karax essentially |
22:37:47 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/Z0R5g |
22:46:13 | * | PMunch quit (Quit: leaving) |
22:52:24 | * | jmdaemon quit (Ping timeout: 268 seconds) |
22:52:29 | * | advesperacit quit () |
22:55:17 | * | jmdaemon joined #nim |
23:00:09 | * | jmdaemon quit (Ping timeout: 252 seconds) |
23:05:41 | * | derpydoo quit (Ping timeout: 240 seconds) |
23:39:35 | * | Evolver joined #nim |
23:40:45 | Evolver | I'm not the only one to think it or say it: What's up with the offensive book cover suggesting a female lying down: https://m.media-amazon.com/images/W/MEDIAX_792452-T1/images/I/71C29j2CfJL._SL1500_.jpg The cover is totally trollish and irrelevant to Nim itself. |
23:41:43 | Evolver | I don't need an answer. It's just something to think about. |
23:41:54 | Evolver | BBL |
23:41:57 | * | Evolver left #nim (#nim) |
23:41:57 | FromDiscord | <hotdog6666> In reply to @imagio "Yep it works on": Upgrading is not too bad in Nim, but for older projects they may have just not been upgraded yet. 2.0 was a bigger jump (being a major version) than other releases. I think the nimble package directory is not as actively developed at the moment |
23:42:00 | * | fallback quit (Ping timeout: 256 seconds) |
23:42:11 | FromDiscord | <michaelb.eth> In reply to @Evolver "I'm not the only": how about taking the question/discussion to #offtopic |
23:42:40 | FromDiscord | <hotdog6666> In reply to @Evolver "I'm not the only": I donât think it was intentional |
23:43:54 | FromDiscord | <hotdog6666> In reply to @hotdog6666 "Upgrading is not too": Fwiw I have projects that I upgraded to 2.0 and it was smooth and pretty quick |