00:37:15 | FromDiscord | <Graveflo> In reply to @sOkam! "<@200775012796334081> are you on": linux |
00:47:17 | FromDiscord | <JJ> In reply to @chmod222 "One thing Zig cannot": curious, do you have an example? |
00:48:06 | FromDiscord | <JJ> i would kind of guess that macros + `when` + `static` provide similar ergonomics but don't know what i'm comparing it to |
00:54:27 | FromDiscord | <demotomohiro> In reply to @apropos "i would kind of": You can generate procedures in a macro using genasts:↵https://nim-lang.org/docs/genasts.html |
00:55:46 | FromDiscord | <demotomohiro> Write proc definition under genAst template. |
00:57:28 | FromDiscord | <demotomohiro> Another way is generating AST that represents proc definition using procs in macro module. |
00:58:18 | FromDiscord | <demotomohiro> https://nim-lang.org/docs/macros.html#newProc%2CopenArray%5BNimNode%5D%2CNimNode%2CNimNode↵That provides best flexibility but bit hard. |
01:18:49 | FromDiscord | <Prestige> Is there a hook we can use to run code as an application is exiting? |
01:18:59 | FromDiscord | <Prestige> Like if someone ends the process or w/e |
01:20:09 | FromDiscord | <Graveflo> there is a `try` `finally` |
01:23:16 | FromDiscord | <spotlightkid> On \nix, for when the process is terminated externally, you can use signals\: https://github.com/SpotlightKid/jacket/blob/master/examples/signal.nim |
01:24:08 | FromDiscord | <spotlightkid> There's also https://nim-lang.org/docs/exitprocs.html |
01:24:39 | * | xet7 quit (Quit: Leaving) |
01:40:57 | FromDiscord | <that_dude> If you exist here I'd like to talk to ya about this project and what I can contribute https://media.discordapp.net/attachments/371759389889003532/1114368091154030673/image.png |
02:03:56 | * | xet7 joined #nim |
02:09:09 | FromDiscord | <demotomohiro> In reply to @Avahe "Is there a hook": Probably this is what you want: https://nim-lang.org/docs/exitprocs.html |
02:18:32 | FromDiscord | <Prestige> Aha, thank you |
02:26:08 | FromDiscord | <Ayy Lmao> Is it possible to make a template discardable? |
02:26:18 | FromDiscord | <Ayy Lmao> I can't seem to figure out a way. |
02:26:59 | FromDiscord | <Elegantbeef> adt cannot be discardable |
02:27:01 | FromDiscord | <Elegantbeef> ast\ |
02:28:09 | FromDiscord | <Ayy Lmao> Man that sucks |
02:28:11 | FromDiscord | <Elegantbeef> make an internal proc that is discardabke |
02:30:10 | FromDiscord | <Ayy Lmao> Hmmm that might work but I would have to capture by closure I think. I basically have a block expression and I want to return an injected variable. It's weird. |
02:30:51 | FromDiscord | <Elegantbeef> code? |
02:31:28 | FromDiscord | <Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=4xmB |
02:32:29 | FromDiscord | <Ayy Lmao> I want the self at the end to be discardable |
02:32:46 | FromDiscord | <Elegantbeef> of course |
02:32:52 | FromDiscord | <Elegantbeef> simply not possible |
02:33:58 | FromDiscord | <Elegantbeef> could use pointer procs instead |
02:34:33 | FromDiscord | <Ayy Lmao> It is if I return it by closure |
02:34:48 | FromDiscord | <Elegantbeef> right |
02:34:48 | FromDiscord | <Ayy Lmao> sent a code paste, see https://paste.rs/55SaX |
02:34:59 | FromDiscord | <Elegantbeef> but i mean there are more sane impls |
02:35:02 | FromDiscord | <Ayy Lmao> (edit) "https://play.nim-lang.org/#ix=4xmD" => "https://play.nim-lang.org/#ix=4xmC" |
02:35:17 | FromDiscord | <Elegantbeef> use a proc that takes procs instead for instance |
02:35:40 | FromDiscord | <Ayy Lmao> There's a lot of context missing from the code snippet, but what I am doing is not very sane |
02:36:37 | FromDiscord | <Elegantbeef> i'm your conscience working remotely |
02:38:42 | FromDiscord | <Ayy Lmao> I'm sure you would advise against a template that writes a macro. I'm sure you would not like what you see. |
02:41:26 | FromDiscord | <Elegantbeef> Not always |
03:01:51 | FromDiscord | <emanresu3> can't you make an external discardable proc wrapping the template? |
03:03:26 | FromDiscord | <JJ> i miss beef's pfp 🙁 |
03:04:19 | FromDiscord | <Rika> Same lol |
03:08:28 | * | rockcavera quit (Remote host closed the connection) |
03:32:34 | FromDiscord | <Elegantbeef> Did that fix it? |
03:32:42 | FromDiscord | <ElegantBeef> bastards |
03:52:20 | FromDiscord | <Rika> Lol |
03:52:27 | FromDiscord | <Rika> It’s probably the bridge |
03:53:00 | FromDiscord | <Elegantbeef> Yea I thought that maybe it was cause an issue with the image cache, so changed my pfp attempting to cause it to refresh, but it seems it no longer includes the pfp |
04:07:48 | FromDiscord | <Graveflo> Is there a way, even if it's hacky to inject an override into another module? Or just inject a proc even if it's not overloading/overriding? |
04:08:43 | FromDiscord | <Elegantbeef> mixin, there is not other way |
04:13:03 | FromDiscord | <Graveflo> I imagine being able to do what I said arbitrarily would create choas most of the time, but it would be nice to tell a proc that someone else wrote to kinda behave like a method in binding at least |
04:13:18 | FromDiscord | <Elegantbeef> Generics exist |
04:13:23 | FromDiscord | <Elegantbeef> Use them |
04:13:29 | FromDiscord | <Graveflo> I yam |
04:14:27 | FromDiscord | <Graveflo> maybe I'm missing something tho. Lets look at `echo` as it's defined in system. I can't make a generic `$` overload that echo is going to respect because it's down stream... at least I think I can't |
04:16:37 | FromDiscord | <Graveflo> ofc I could redefine echo but it's annoying to do that for everything that can bind in that way. The way that echo binds is way better then a manual overload I think |
04:17:02 | FromDiscord | <Elegantbeef> The proc should `mixin $` |
04:18:02 | FromDiscord | <Elegantbeef> I dont know the issue though |
04:18:06 | FromDiscord | <Elegantbeef> A generic should work fine here |
04:18:38 | FromDiscord | <Graveflo> my test beds are getting mega disorganized. I'm going to try it |
04:27:47 | FromDiscord | <Graveflo> oh ok. `mixin` works in this example. I'm going to have to read more to understand what exactly it's doing though. Thanks |
04:45:51 | * | def- quit (Quit: -) |
04:46:38 | * | def- joined #nim |
05:30:07 | * | ntat joined #nim |
05:31:57 | * | lucasta quit (Quit: Leaving) |
06:04:47 | FromDiscord | <Arathanis> i wish i fully grokked what mixin does |
06:05:27 | FromDiscord | <Elegantbeef> Considers the scope of both declaration and instantiation |
06:05:30 | FromDiscord | <Elegantbeef> So the callsite and the declaration |
06:06:46 | FromDiscord | <Arathanis> that kind of thing? |
06:06:48 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4xmZ |
06:06:52 | FromDiscord | <Arathanis> doStuff need not exist yet? |
06:06:57 | FromDiscord | <Elegantbeef> Yes |
06:10:17 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4xn3 |
06:10:20 | FromDiscord | <Arathanis> so we can make bad jokes with it? |
06:10:39 | FromDiscord | <Elegantbeef> If you want to |
06:10:52 | FromDiscord | <Arathanis> i do |
06:11:47 | FromDiscord | <Rika> congrats' |
06:11:52 | FromDiscord | <Elegantbeef> The fun part there is that `destroyUniverse` can be different across different modules |
06:12:09 | FromDiscord | <Arathanis> maybe some people like heat death |
06:12:11 | FromDiscord | <Arathanis> others big crunch |
06:12:19 | FromDiscord | <Arathanis> it should be their choice 😤 |
06:13:01 | FromDiscord | <Elegantbeef> Generally with mixin you want to dispatch based off the generic parameter but this does technically work 😄 |
06:13:09 | FromDiscord | <Graveflo> sounds difficult to implement. I'd just use the old /0.0 |
06:18:54 | * | aftalavera quit (Remote host closed the connection) |
07:44:40 | FromDiscord | <Graveflo> where should I go to propose a 1 liner change to the compiler for an error msg? |
07:52:24 | FromDiscord | <Rika> either an issue or just chat in #internals |
07:58:43 | FromDiscord | <Graveflo> ok thx |
08:19:05 | * | nyeaa492842301 quit (Ping timeout: 240 seconds) |
08:20:04 | * | nyeaa492842301 joined #nim |
08:46:12 | * | lumidify quit (Quit: leaving) |
08:59:00 | * | lumidify joined #nim |
09:16:18 | NimEventer | New post on r/nim by thindil: [Nim Blog] This Month with Nim: April and May 2023, see https://reddit.com/r/nim/comments/13z6ynn/nim_blog_this_month_with_nim_april_and_may_2023/ |
09:43:34 | FromDiscord | <stardustbiscuits> Is there any library that helps in downloading YouTube videos in mp3 format? |
09:43:54 | FromDiscord | <stardustbiscuits> like pytube for python? |
09:48:57 | FromDiscord | <chmod222> At that point I'd just go the road of least resistance and start a `youtube-dl` process from Nim, rather than trying to download it yourself |
10:35:20 | ntat | Hi! I try use Nim logo to my tutorial which create in pdf file. I found thie → https://github.com/nim-lang/assets#readme My question is, what I need to do, when I want to use Nim logo in my (non-commercial) document? Should I add attribution, write where the logo came from, or something else? |
11:19:35 | FromDiscord | <⚶ Zeno> sent a code paste, see https://play.nim-lang.org/#ix=4xnO |
11:20:37 | FromDiscord | <⚶ Zeno> (edit) "https://play.nim-lang.org/#ix=4xnO" => "https://play.nim-lang.org/#ix=4xnP" |
11:22:28 | FromDiscord | <chmod222> I was about to say, yeah it can be done exactly like that |
11:22:35 | FromDiscord | <chmod222> If you want to do this is up to you |
11:23:36 | FromDiscord | <⚶ Zeno> yeah well i realized i wrote correct code and got embarassed lmao |
11:23:53 | FromDiscord | <⚶ Zeno> (edit) "correct" => "working" |
11:24:13 | FromDiscord | <chmod222> You don't even have to writeh `.x=`, `5.x = 2` will work too |
11:25:20 | FromDiscord | <⚶ Zeno> i see, thanks |
12:04:43 | * | xet7 quit (Ping timeout: 250 seconds) |
12:25:48 | FromDiscord | <voidwalker> is there no iterator for items in a seq but in reverse ? |
12:31:34 | FromDiscord | <chmod222> Not that I know of, but it should be easy to build |
12:32:22 | FromDiscord | <chmod222> `for i in countdown(high(s)): yield s[i]` or some such |
13:46:28 | FromDiscord | <jaar23> In reply to @4zv4l "am I the only": you're not alone, i do face the same thing and couldn't fix it until now. ↵did you managed to fix yours? |
13:54:19 | FromDiscord | <4zv4l> In reply to @jaar23 "you're not alone, i": Well I did not 😂🥲 |
14:01:50 | FromDiscord | <jaar23> In reply to @4zv4l "Well I did not": aw... that's too bad |
14:04:30 | FromDiscord | <4zv4l> yeah I didn't code in Nim for some time since then↵mostly because of that issue I think 🥹 |
14:52:01 | * | FromDiscord quit (Remote host closed the connection) |
14:52:14 | * | FromDiscord joined #nim |
15:13:42 | FromDiscord | <sOkam!> In reply to @4zv4l "am I the only": it started happening recently. i heard the issue will be fixed for 2.0 and doesn't happen on other versions than .12 |
15:14:42 | FromDiscord | <sOkam!> it worked well in .10 and .11, and at some point it also worked in .12 but then something broke |
15:14:43 | FromDiscord | <4zv4l> I had this with other versions |
15:14:53 | FromDiscord | <4zv4l> but let's see |
15:22:22 | FromDiscord | <obi3112> can i use nim to make a telegram bot? |
15:22:31 | FromDiscord | <obi3112> and discord bot? |
15:23:23 | FromDiscord | <Rika> sure why not |
15:53:58 | * | koltrast quit (Quit: ZNC - http://znc.in) |
15:54:17 | * | koltrast joined #nim |
16:10:01 | FromDiscord | <guttural666> when I have a bunch of these, how can I check at runtime if the token has data in it, so I can store it away? https://media.discordapp.net/attachments/371759389889003532/1114586795351494727/image.png |
16:15:45 | FromDiscord | <Kai.> This lang looks very interesting so I wanna try it out |
16:16:02 | FromDiscord | <Kai.> I was told it's like python and c++ had a baby and is complied so it runs fast |
16:16:12 | FromDiscord | <Kai.> That made me grow puppy ears and get excited |
16:16:28 | FromDiscord | <Kai.> In reply to @obi3112 "and discord bot?": First project of mine, I'm gonna make a discord bot lib |
16:16:31 | FromDiscord | <Kai.> Cus why not |
16:16:35 | FromDiscord | <Kai.> I've done it in python |
16:18:10 | FromDiscord | <huantian> In reply to @Kai. "I was told it's": Yeah it does have a lot of the good stuff of both langs, as well as it’s own upsides ↵Do be noted that while it does share some syntax with python, it can have a very different coding feel |
16:24:51 | FromDiscord | <Kai.> In reply to @huantian "Yeah it does have": I understand |
16:25:12 | FromDiscord | <Kai.> I just want a compiled lang that's not gonna blow my brain out that's also low level that's also OOP |
16:25:44 | FromDiscord | <Kai.> Anyways can I make viruses with it |
16:25:47 | FromDiscord | <Kai.> Ooh it game hacks |
16:25:52 | FromDiscord | <Rika> nim is not OOP |
16:25:56 | FromDiscord | <Kai.> Wait I need dll files for it |
16:26:04 | FromDiscord | <Rika> well, it has OOP but it is rudimentary |
16:26:04 | FromDiscord | <Kai.> In reply to @Rika "nim is not OOP": I mean I don't need it |
16:26:11 | FromDiscord | <Kai.> In reply to @Rika "well, it has OOP": Good enough |
16:26:23 | FromDiscord | <Kai.> As long as there is some form of class based programming |
16:26:24 | FromDiscord | <Rika> also its generally frowned upon helping people blatanly making viruses or game hacks xd |
16:26:37 | FromDiscord | <Kai.> In reply to @Rika "also its generally frowned": It was a joke lmao |
16:26:40 | FromDiscord | <Rika> sure itwas |
16:26:41 | FromDiscord | <Rika> (edit) "itwas" => "it was" |
16:26:42 | FromDiscord | <Kai.> Could figure it out myself |
16:26:44 | FromDiscord | <Kai.> It was |
16:26:46 | FromDiscord | <Kai.> I make discord bots |
16:26:49 | FromDiscord | <Kai.> And Roblox games |
16:26:49 | FromDiscord | <Rika> of course |
16:27:06 | FromDiscord | <Kai.> The most virus I ever made was a rat in python |
16:27:09 | FromDiscord | <Kai.> Using discord ofc |
16:27:22 | FromDiscord | <Kai.> But I didn't distribute cus I'm not a newgen |
16:27:28 | FromDiscord | <Kai.> Just made it for educational purposes |
16:27:35 | FromDiscord | <Kai.> Oh I also make flask apps and web dev shit |
16:27:50 | FromDiscord | <guttural666> In reply to @Kai. "I was told it's": that sounds like a bastard son that I would send to the northern wall |
16:28:06 | FromDiscord | <Kai.> In reply to @guttural666 "that sounds like a": Lolol |
16:28:10 | FromDiscord | <Kai.> I'm tired |
16:28:15 | FromDiscord | <Kai.> I just worked for 11 hours |
16:28:27 | FromDiscord | <Kai.> I'm gonna eat then go sleep with my girlfriend |
16:28:35 | FromDiscord | <Kai.> In the non sexual way |
16:30:34 | FromDiscord | <guttural666> me personally, I prefer eating my girlfriend and then going to sleep alone 😛 |
16:30:51 | FromDiscord | <that_dude> In reply to @guttural666 "when I have a": I think I would compare the value to default(token data) |
16:31:14 | FromDiscord | <guttural666> In reply to @that_dude "I think I would": don't think I catch your drift |
16:31:21 | FromDiscord | <that_dude> Either or use a flag, or make sure that certain variant cases can only exist with data |
16:31:59 | FromDiscord | <guttural666> In reply to @that_dude "Either or use a": yeah, been spamming case statements everywhere |
16:32:04 | FromDiscord | <guttural666> not too bad, but I guess it works |
16:33:17 | FromDiscord | <that_dude> Default(type) exists in nim afaik https://media.discordapp.net/attachments/371759389889003532/1114592651119964170/Screenshot_20230603_113244_Chrome.png |
16:33:32 | FromDiscord | <that_dude> So you can see if it's changed from the default init value |
16:35:05 | FromDiscord | <that_dude> Only works if the default value is known as special case not a normal valuu |
16:37:16 | FromDiscord | <guttural666> hmmm, yeah was thinking about including the token data as a ref in the token |
16:38:22 | FromDiscord | <that_dude> Well if it's a ref, then using nil should make it easy to check init |
16:38:49 | FromDiscord | <guttural666> thanks! |
16:40:45 | FromDiscord | <that_dude> May be interesting to you https://media.discordapp.net/attachments/371759389889003532/1114594530147188877/Screenshot_20230603_114020_Chrome.jpg |
16:41:37 | FromDiscord | <guttural666> I just got done replacing the whole lexer.tokenseq[Token] business with a single string, that encodes every token as a distinct char and feel like a fucking genious 😄 have all the additional data that some tokens need in a hash map[token_idx, TokenData] |
16:42:07 | FromDiscord | <guttural666> now I can regex the shit out of that token string in the parser, which is super awesome |
16:43:38 | FromDiscord | <guttural666> In reply to @that_dude "May be interesting to": so many cool stuff in Nim |
16:52:38 | FromDiscord | <Nlits (Ping on reply)> Nim is great |
16:52:46 | FromDiscord | <Nlits (Ping on reply)> I am currently hosting 2 projects |
16:52:56 | FromDiscord | <Nlits (Ping on reply)> On a free plan |
16:53:09 | FromDiscord | <Nlits (Ping on reply)> that gives you 5$ worth of resources once |
16:53:30 | FromDiscord | <Nlits (Ping on reply)> but because I am using nim, those free 5$ will last me 8-9 years |
16:53:34 | FromDiscord | <Nlits (Ping on reply)> 😄 |
16:54:10 | FromDiscord | <Nlits (Ping on reply)> (edit) "On a free plan ... " added "(on a actually good hosting provider, unlike what I was using before)" |
16:54:38 | FromDiscord | <that_dude> Im also messing around with the primeagen thing and I feel kinda bad because I've practically replaced the current lexer with one thats closer to other nim Prs that follow the book better |
16:55:58 | FromDiscord | <guttural666> did you write the Nim version for the Primeagen? I read that |
16:56:49 | FromDiscord | <guttural666> watched the stream as well and got a lot of good ideas from that whole project |
16:57:03 | FromDiscord | <that_dude> Unfortunately the guy that got the firs nim pr in (and in turn became owner of the folder) doesn't have the booy yet |
16:57:40 | FromDiscord | <that_dude> Oh I didn't really watch it lol, I watched a diff YouTube vid and found it interesting |
16:57:55 | FromDiscord | <that_dude> (edit) "firs" => "first" | "booy" => "book" |
16:58:05 | FromDiscord | <guttural666> super interesting to see all the languages do it |
16:59:11 | FromDiscord | <guttural666> quick question, if I construct a Token in the lexer and then proceed to store the data of that token in the token_datastore below, will that actually just copy the reference/pointer into the store the way I declared my stuff? https://media.discordapp.net/attachments/371759389889003532/1114599170829975603/image.png |
17:01:11 | FromDiscord | <guttural666> want to just construct the data part once and then just store a pointer to it in the store |
17:02:37 | FromDiscord | <guttural666> so I try to identify and construct a token, if data is not nil, I want to pass that reference into the store |
17:05:35 | FromDiscord | <that_dude> Sorry refs are a weak point of mine |
17:06:33 | FromDiscord | <that_dude> But AFAIK it should just your making a copy of an object that holds a ref to another one so you only copy the ref |
17:08:31 | FromDiscord | <guttural666> yeah, basically just a pointer |
17:09:00 | FromDiscord | <guttural666> but I can destroy the temporary Token again, but my data will still be pointed to by the datastore |
17:53:06 | * | psydruid quit (Ping timeout: 265 seconds) |
18:31:47 | FromDiscord | <Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xoY |
18:33:38 | FromDiscord | <chmod222> `typedesc` doesn't overload match `ref object` |
18:34:03 | FromDiscord | <Graveflo> but then it should bind to the definition in `system.nim` as the first example does no? |
18:37:10 | FromDiscord | <chmod222> that's true, although the `system.is` is compiler magic |
18:40:57 | FromDiscord | <guttural666> the amount of {.magic.} sprinkled into Nim is amazing, feel like fucking Harry Potter |
18:41:23 | FromDiscord | <Graveflo> I feel like a muggle |
18:41:33 | FromDiscord | <Arathanis> trying to get some python `is` action? |
18:42:03 | FromDiscord | <guttural666> In reply to @Graveflo "I feel like a": xDDDDD |
18:42:08 | FromDiscord | <Rika> echo nim is_not python |
18:42:30 | FromDiscord | <Graveflo> yea that was the idea, but now that I think about it I'm not 100% keen on how python defines that behavior in nims context. Maybe I should just make something like a congruence operator for when I want auto deference and stuff |
18:42:47 | FromDiscord | <chmod222> You can probably build a macro that converts python AST into nim A ST |
18:43:00 | FromDiscord | <Graveflo> LOL that sounds like a good idea |
18:44:57 | FromDiscord | <Graveflo> I still think that comparing a pointers dumb value is a bit too ASM for me. The way `==` is defined makes it unsuitable for overloading also. Do people overload `==` when they want high level comparisons or is there a better standard way to do that? |
18:46:05 | FromDiscord | <guttural666> https://media.discordapp.net/attachments/371759389889003532/1114626073100042280/image.png |
18:49:02 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4xp2 |
18:49:02 | FromDiscord | <Graveflo> wait nim breaks it's own conventions because this is true: `echo @[1,2,3,4] == @[1,2,3,4]` |
18:49:39 | NimEventer | New post on r/nim by Sebwazhere: Nim not working in VS Code, see https://reddit.com/r/nim/comments/13zlqcn/nim_not_working_in_vs_code/ |
18:56:41 | FromDiscord | <chmod222> Well no |
18:56:52 | FromDiscord | <chmod222> The convention is structural equality |
18:57:26 | FromDiscord | <chmod222> Same with `string == string` |
18:57:55 | FromDiscord | <Graveflo> That would make the most sense but `==` compares a ref objects pointer value by defaults not the structure of the object being referenced. |
18:58:07 | FromDiscord | <Rika> In reply to @Graveflo "wait nim breaks it's": it does not because sequences are explicitly defined to follow value semantics |
18:58:15 | FromDiscord | <Rika> same with strings |
18:58:56 | FromDiscord | <Graveflo> It's not good if a basic operator means this or that depending on which way the wind is blowing |
18:59:06 | FromDiscord | <Arathanis> `ref` types follow value semantics too, the value of the reference 😎 |
18:59:16 | FromDiscord | <Graveflo> ok dude LOL |
18:59:21 | FromDiscord | <Rika> In reply to @Arathanis "`ref` types follow value": i would say this is the best correct honestly |
18:59:25 | FromDiscord | <Rika> (edit) "In reply to @Arathanis "`ref` types follow value": i would say this is the best ... correct" added "kind of" |
18:59:29 | FromDiscord | <chmod222> It's a valid argument though |
19:00:07 | FromDiscord | <Graveflo> It's not because `string` and `seq` are refs too |
19:00:23 | FromDiscord | <chmod222> Not semantically |
19:00:35 | FromDiscord | <Graveflo> but they are the perfect example of why that mentality isn't necessarily the best choice for `==` |
19:00:41 | FromDiscord | <Rika> you could consider them as an implementation detail |
19:00:49 | FromDiscord | <Rika> whereas reference types are explicitly called refs |
19:01:04 | FromDiscord | <Rika> seqs and strings are just implemented as such but are technically not required to be |
19:02:58 | FromDiscord | <Graveflo> I get that but it seems like in order to accept this you have to rely on high levels of abstraction to justify `seq` and `string` while also being allergic to that way of thinking for `ref object`. It's just inconsistent |
19:04:15 | FromDiscord | <Arathanis> i dont think its inconsistent |
19:04:51 | FromDiscord | <Arathanis> its no more inconsistent than `int` and `str` in python being references to objects (since everything in python is an object) but being semantically immutable |
19:05:57 | FromDiscord | <Graveflo> I don't see what immutability has to do with it |
19:06:24 | FromDiscord | <Arathanis> well you are saying "because string and seq are references" this is inconsistent behavior |
19:06:44 | FromDiscord | <Arathanis> but they are only refs under the hood, semantically in the language they are value types. |
19:07:40 | FromDiscord | <Arathanis> in Python everything is technically a dictionary but they don't expose all the same methods/features of a dict cause its an implementation detail |
19:08:42 | FromDiscord | <Arathanis> we are just trying to point out that the fact that strings and seqs are technically references isn't really an argument for inconsistency cause you are comparing the runtime semantics of `==` to the implementation details of the types |
19:08:57 | * | oldpcuser_ joined #nim |
19:09:18 | * | oldpcuser quit (Killed (NickServ (GHOST command used by oldpcuser_))) |
19:09:24 | * | oldpcuser_ is now known as oldpcuser |
19:13:36 | FromDiscord | <Graveflo> sent a long message, see http://ix.io/4xpd |
19:14:25 | FromDiscord | <Arathanis> i think when they say "structural equivalence" they mean "value equivalence" |
19:14:46 | FromDiscord | <Graveflo> oh I might be confusing that term then |
19:15:36 | FromDiscord | <Arathanis> `==` always compares "by value" |
19:15:59 | FromDiscord | <Arathanis> the value of a `ref T` is a memory address |
19:16:28 | FromDiscord | <Graveflo> but it's overloaded often to not do that |
19:16:51 | FromDiscord | <Arathanis> im not aware of any times where it behaves that way, not that i dont believe you. im just not aware of them |
19:22:03 | FromDiscord | <Graveflo> well that's why I brought up `seq` and `string`. I know that we can always just say it's an implementation detail, but it wouldn't have to be excused that way if `==` was thought of as a high level operator when used on objects... which it kinda is when used that way. I'm sure this implementation details was chosen because it's much more natural. |
19:22:58 | FromDiscord | <Arathanis> well its specifically because they dont behave that way in the language because they are semantically value types |
19:23:22 | FromDiscord | <Arathanis> you are right that under the hood, at the machine code level |
19:23:24 | FromDiscord | <Arathanis> they are pointers |
19:23:37 | FromDiscord | <Arathanis> but when you are using the language they behave like values, and that keeps `==` consisteent |
19:23:38 | FromDiscord | <Arathanis> https://media.discordapp.net/attachments/371759389889003532/1114635523164741794/image.png |
19:24:45 | FromDiscord | <Arathanis> https://media.discordapp.net/attachments/371759389889003532/1114635804296347759/image.png |
19:25:02 | FromDiscord | <Graveflo> oh so this is an argument around copy semantics? |
19:25:26 | * | oldpcuser quit (Remote host closed the connection) |
19:25:32 | FromDiscord | <Arathanis> well the copy semantics behave this way because they are treated as value types |
19:25:43 | FromDiscord | <Graveflo> okay well that helps actually thanks |
19:25:54 | FromDiscord | <Arathanis> in Nim, the goal is anything that is not explicitly "ref" or "ptr" functions as a value type semantically. |
19:25:54 | * | oldpcuser joined #nim |
19:26:11 | FromDiscord | <Arathanis> for sure dude |
19:26:16 | FromDiscord | <Arathanis> i love these kinds of conversations |
19:27:06 | FromDiscord | <Arathanis> (edit) "dude" => "my friend" |
19:30:26 | FromDiscord | <Graveflo> ok one more question. In my mind this would mean that making `==` a high level operator on an object inappropriate unless that model that value behavior. Does that make sense? |
19:30:39 | FromDiscord | <Graveflo> (edit) "that" => "they" |
19:31:12 | FromDiscord | <Graveflo> (edit) "ok one more question. In my mind this would mean that making `==` a high level operator on an object inappropriate unless ... that" added "they model" | removed "model they" |
19:35:11 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4xpk |
19:35:25 | FromDiscord | <Arathanis> (edit) "https://play.nim-lang.org/#ix=4xpk" => "https://play.nim-lang.org/#ix=4xpl" |
19:35:39 | FromDiscord | <Arathanis> (edit) "https://play.nim-lang.org/#ix=4xpl" => "https://play.nim-lang.org/#ix=4xpm" |
19:35:44 | FromDiscord | <Arathanis> (edit) "https://play.nim-lang.org/#ix=4xpm" => "https://play.nim-lang.org/#ix=4xpn" |
19:39:33 | FromDiscord | <Arathanis> and that doing anything else would be undesirble even though its technically allowed? |
19:39:51 | FromDiscord | <Graveflo> does it not do that already? Yea that but also if I wanted to make a "logically equivalent" operator I should never use `==` for this unless the value semantics of the object match `==` behavior. Basically I'm getting that if I want a "logically equivalent" operator convention I should just make my own |
19:40:12 | FromDiscord | <Arathanis> In reply to @Graveflo "does it not do": it does do it automatically, yes |
19:40:28 | FromDiscord | <Arathanis> what is "logically" equivalent in this case? |
19:40:59 | FromDiscord | <Graveflo> lets say that a person is considered logically the same if they have the same name but their age doesn't matter. It's a bad example but you get the idea |
19:40:59 | FromDiscord | <Arathanis> like if maybe you dont care about the value of age, you only think the name should be equivalent to be equal? |
19:41:10 | FromDiscord | <Arathanis> great minds think of the same examples 🙏 |
19:42:31 | FromDiscord | <Arathanis> that i do not know, someone like Beef or Rika more steeped in the language and its community could probably answer the feelings on that better than I could. My but reaction is `==` should always do structural/value equiality, and if you want to make your own impl that specifically ignores certain fields in the comparison that is fine as long as you document it. |
19:42:47 | FromDiscord | <Arathanis> documented especially if its a public part of the api |
19:43:02 | FromDiscord | <Arathanis> probably still documented for internal developers though 😉 |
19:44:37 | FromDiscord | <Graveflo> for me I'm going to make the operator by default just de-reference pointers and refs, but beyond that it makes more sense for the odd cases where fields are ignored to overload that custom operator instead of `==` that was the goal it hashing this out. Thanks for the help |
19:44:58 | FromDiscord | <Arathanis> np |
19:45:03 | FromDiscord | <Arathanis> good luck with your project |
19:58:30 | * | ntat quit (Quit: Leaving) |
20:28:35 | * | oldpcuser quit (Quit: Eu uso Vum - Vi Useless not iMproved Text Editor! =D) |
20:32:35 | * | oldpcuser joined #nim |
20:35:42 | FromDiscord | <chmod222> Weird question but is there a maximum length for type names? |
20:36:06 | FromDiscord | <chmod222> Oh wait, I just noticed the problem is something else |
20:36:11 | FromDiscord | <chmod222> Disregard that |
21:28:38 | FromDiscord | <guttural666> god I love when one indentation error breaks your whole program and sends you on a wild echo debugging session that takes two hours 🥰 |
21:31:34 | FromDiscord | <chmod222> Weirdly enough I never had this happen in two decades of programming |
21:31:35 | * | psydruid joined #nim |
21:32:15 | FromDiscord | <chmod222> That's why I could never take "omg significant whitespace so bad" pundits seriously |
21:32:31 | FromDiscord | <Elegantbeef> @Graveflo\: since you're defining your own rules you can do `~=` or `^==` or anything else |
21:32:41 | FromDiscord | <Arathanis> In reply to @chmod222 "That's why I could": its never bothered me either |
21:32:53 | FromDiscord | <Arathanis> ive never had it shoot me in the foot |
21:33:18 | FromDiscord | <Elegantbeef> `==` should always do pointer comparisons imo on pointer types |
21:33:59 | * | oldpcuser_ joined #nim |
21:34:31 | FromDiscord | <Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xpN |
21:35:02 | FromDiscord | <Arathanis> i think its for safety and to make it easier to reason about programs |
21:35:17 | FromDiscord | <Arathanis> you can't mutate them unless they are explicitly ref or proc parameters are "var" |
21:35:24 | FromDiscord | <Elegantbeef> They're value types |
21:35:26 | FromDiscord | <Arathanis> its to help you reason about the code |
21:35:32 | FromDiscord | <Elegantbeef> The reason they're implemented that way is that they're value types |
21:35:37 | * | oldpcuser quit (Ping timeout: 240 seconds) |
21:35:40 | FromDiscord | <Arathanis> that is always the impression i got from making everything a value type unless its specifically "ref" or "ptr" |
21:36:17 | FromDiscord | <guttural666> In reply to @chmod222 "Weirdly enough I never": refactoring rn and one return statement that I really needed ended up with an incorrect indentation |
21:36:22 | FromDiscord | <Elegantbeef> Just cause something has heap memory underneath it does not mean it's not a value type 😛 |
21:36:32 | FromDiscord | <Elegantbeef> Consider Nim's `Table` vs. `TableRef` |
21:37:10 | FromDiscord | <Graveflo> oh god does `TableRef` duplicate all over too? |
21:37:12 | FromDiscord | <guttural666> In reply to @Arathanis "ive never had it": it'll never happen if you have bracket delimited blocks of code |
21:37:28 | FromDiscord | <Elegantbeef> `TableRef` is a reference |
21:37:32 | FromDiscord | <Elegantbeef> `Table` is a value type |
21:37:42 | FromDiscord | <Elegantbeef> Exactly what you expect |
21:37:44 | FromDiscord | <Arathanis> In reply to @guttural666 "it'll never happen if": but then my code has to be a nonsense mess of uncessary characters |
21:37:46 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/zPmhm |
21:37:48 | FromDiscord | <Graveflo> oh right so `Table` is the hidden pointer value type |
21:37:50 | FromDiscord | <chmod222> I think I spent quite some time chasing down why some bracket was missing despite it all looking good |
21:37:50 | FromDiscord | <Arathanis> (edit) "uncessary" => "unnecessary" |
21:37:57 | FromDiscord | <Elegantbeef> "hidden pointer" |
21:38:01 | FromDiscord | <Elegantbeef> No it's a value type |
21:38:15 | FromDiscord | <Elegantbeef> It's a pointless distinction |
21:38:21 | FromDiscord | <Graveflo> ok heap allocated value type? |
21:38:31 | FromDiscord | <Elegantbeef> Nope |
21:38:31 | FromDiscord | <Elegantbeef> It's stack allocated |
21:38:39 | FromDiscord | <Elegantbeef> It just has data that is heap allocated |
21:38:49 | FromDiscord | <Graveflo> right right ok. Heap dependent value type? |
21:38:53 | FromDiscord | <Elegantbeef> 😄 |
21:38:59 | FromDiscord | <Elegantbeef> Right |
21:39:11 | FromDiscord | <Elegantbeef> It's dynamically sized value type I'd call it |
21:39:26 | FromDiscord | <chmod222> Heap allocated with extra steps |
21:39:39 | FromDiscord | <Elegantbeef> I mean you can dynamically size stack types |
21:39:49 | FromDiscord | <Elegantbeef> `alloca` incomming |
21:39:52 | FromDiscord | <Arathanis> its stack allocated |
21:39:53 | FromDiscord | <guttural666> In reply to @Arathanis "but then my code": no, you copy block a to b, to some normal refactoring stuff add some ifs and boom one line has the wrong indendation, very easy to do |
21:40:00 | FromDiscord | <Arathanis> sometimes you just need to "heap" on some more memory 😉 |
21:40:08 | FromDiscord | <chmod222> alloca sounds like a great indea up until the point it's no longer a great idea |
21:40:25 | FromDiscord | <Arathanis> In reply to @guttural666 "no, you copy block": maybe my experience has kept me from making this mistake. I am always hyper indentation aware |
21:40:36 | FromDiscord | <Arathanis> never had this issue even when copy-pasting |
21:41:25 | FromDiscord | <guttural666> In reply to @Arathanis "maybe my experience has": maybe when vimming like a gigachad this may happen, hitting the u and you don't realize |
21:41:52 | FromDiscord | <Arathanis> perhaps, im sure ill foot gun myself with it in the future |
21:42:12 | FromDiscord | <Arathanis> i prefer python and nim's style of white space significance freeing me from character noise |
21:42:16 | FromDiscord | <Arathanis> but i dont hate brackets |
21:42:26 | FromDiscord | <Arathanis> i like and use plently of languages that follow that style |
21:42:32 | FromDiscord | <Arathanis> (edit) "plently" => "plenty" |
21:42:39 | FromDiscord | <chmod222> They are a bitch to type on german language keyboards, but I got used to it after all those years |
21:42:49 | FromDiscord | <Elegantbeef> Indentation lines + indention rainbows = same as `{}` |
21:42:57 | FromDiscord | <Arathanis> In reply to @Elegantbeef "Indentation lines + indention": true |
21:43:02 | FromDiscord | <guttural666> I love no brackets as well since I'm a kraut and use a quertz keyboard, but brackets do have their advantages |
21:43:22 | FromDiscord | <Elegantbeef> Yea brackets have one advantage making a parser easier to write |
21:43:27 | FromDiscord | <Elegantbeef> That's pretty much it 😛 |
21:43:57 | FromDiscord | <chmod222> Proposal to switch Nim to a `begin` and `end` syntax based language |
21:44:05 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4xpQ |
21:44:23 | FromDiscord | <Arathanis> In reply to @Elegantbeef "Yea brackets have one": pmuch my opinion |
21:44:34 | FromDiscord | <guttural666> brackets feel like acrobatically fingering somebody on a German layout |
21:44:34 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/FIzkJ |
21:45:18 | FromDiscord | <Arathanis> brackets feel like using an extra character for no reason when any reasonable coding style guide might as well have significant whitespace so why I am cluttering my code with extra characters and my hands with superfluous keystrokes? |
21:45:33 | FromDiscord | <Elegantbeef> Honestly that style is nice |
21:45:34 | FromDiscord | <chmod222> sent a code paste, see https://play.nim-lang.org/#ix=4xpS |
21:45:38 | FromDiscord | <Elegantbeef> Clearly indent everything |
21:45:41 | FromDiscord | <chmod222> sent a code paste, see https://paste.rs/jYwb6 |
21:45:47 | FromDiscord | <Elegantbeef> Since `{}` are important |
21:45:48 | FromDiscord | <chmod222> sent a code paste, see https://paste.rs/gx45l |
21:46:46 | FromDiscord | <chmod222> It's too noisy for me, I can barely deal with putting every brace on a new line |
21:48:16 | FromDiscord | <Graveflo> I approach a situation like this by thinking "I i remove all unnecessary white space how easy is it to read" vs "If I remove all unnecessary } or ; or w/e how easy is it to read". Often you use the whitespace primarily even if the other characters are there |
21:49:34 | FromDiscord | <Elegantbeef> Anyone's code that would not compile inside a whitespace significant language needs to stop writing code |
21:50:16 | FromDiscord | <Graveflo> yep and luckily most programmers actually do give a damn about that formatting... but they still see the need to have the litter too |
21:51:27 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4xpV |
21:51:40 | FromDiscord | <Elegantbeef> If only that wasnt so hard to type out |
21:51:42 | FromDiscord | <Arathanis> In reply to @Elegantbeef "Anyone's code that would": saying what we are all thinking |
21:51:45 | FromDiscord | <Elegantbeef> Cause it makes the code so much more expressive |
21:51:51 | FromDiscord | <Arathanis> In reply to @Elegantbeef "If only that wasnt": it does |
21:51:56 | FromDiscord | <Arathanis> (edit) "does" => "did take me a long while" |
21:52:00 | FromDiscord | <Arathanis> In reply to @Elegantbeef "Cause it makes the": it absolutely does |
21:52:09 | FromDiscord | <Arathanis> no character noise to make my eyes slide off the logic |
21:56:42 | * | oldpcuser_ quit (Ping timeout: 265 seconds) |
21:58:00 | FromDiscord | <chmod222> That's what the dynamic tabstops in MS Word are perfect for |
21:58:05 | FromDiscord | <chmod222> So MS Word is the best IDE? |
21:58:13 | FromDiscord | <Elegantbeef> No it's made by MS |
21:58:40 | FromDiscord | <Arathanis> MS stands for Masterful Software |
21:59:52 | FromDiscord | <Recruit_main707> Im afraid not even the best MS IDE https://media.discordapp.net/attachments/371759389889003532/1114674843372224572/image.png |
22:01:04 | FromDiscord | <chmod222> Okay back to a Nim related question |
22:01:05 | FromDiscord | <chmod222> If I have a macro that receives the type `T`, can it determine which module `T` was declared in? |
22:01:07 | FromDiscord | <chmod222> In order to call a function defined in that module |
22:01:46 | FromDiscord | <chmod222> Or will I have to rely on ol' reliable `func myStatic(typedesc[T])`? |
22:05:36 | FromDiscord | <Elegantbeef> `T.owner` |
22:10:53 | FromDiscord | <Elegantbeef> I do think the generic procedure approach makes more sense though 😄 |
22:11:39 | FromDiscord | <chmod222> I use it quite a bit in my project but I'm never sure if it is a good idea or a hack to get around "proper" module design |
22:12:00 | FromDiscord | <chmod222> Then again, it never failed me |
22:27:13 | FromDiscord | <Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xq5 |
22:43:56 | FromDiscord | <Graveflo> oh ok "checkpoint" does this nvm. Idk how I read a page and miss stuff like that every time |
23:02:33 | * | Onionhammer quit (Ping timeout: 256 seconds) |
23:07:22 | * | Onionhammer joined #nim |
23:21:43 | * | pbsds quit (Quit: The Lounge - https://thelounge.chat) |
23:23:48 | * | pbsds joined #nim |
23:48:29 | * | oldpcuser joined #nim |
23:51:12 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4xqh |