00:04:26 | * | tiorock joined #nim |
00:04:26 | * | rockcavera is now known as Guest4925 |
00:04:26 | * | tiorock is now known as rockcavera |
00:07:28 | * | Guest4925 quit (Ping timeout: 252 seconds) |
00:10:13 | * | tiorock joined #nim |
00:10:13 | * | rockcavera quit (Killed (zirconium.libera.chat (Nickname regained by services))) |
00:10:13 | * | tiorock is now known as rockcavera |
00:37:52 | FromDiscord | <summarity> sent a code paste, see https://play.nim-lang.org/#pasty=aevhiABe |
00:39:59 | FromDiscord | <Elegantbeef> `setutils` |
00:40:03 | FromDiscord | <Elegantbeef> `s.toSet Digits == {}` |
01:32:04 | * | beholders_eye quit (Ping timeout: 245 seconds) |
02:04:50 | FromDiscord | <albassort> is it possible to generate a smaller js output? |
02:05:21 | FromDiscord | <albassort> currently my js output is about 200k |
02:05:26 | FromDiscord | <albassort> i would like for it to be smaller |
02:05:34 | FromDiscord | <albassort> i think i saw an alternative js implementation somewhere? |
02:07:55 | FromDiscord | <albassort> using google-closure-compiler i am able to get it to 108k |
02:08:51 | FromDiscord | <albassort> woah 52l |
02:08:55 | FromDiscord | <albassort> (edit) "52l" => "52k with --compilation_level=advanced" |
02:08:57 | FromDiscord | <albassort> eh thats good enough |
02:48:45 | FromDiscord | <Robyn [She/Her]> In reply to @albassort "is it possible to": try `-d:danger`? |
02:49:04 | FromDiscord | <Robyn [She/Her]> also maybe there's some intelligent JS minimisers |
02:49:28 | FromDiscord | <Robyn [She/Her]> alternatively you could compile the code to WASM and have JS glue to call functions |
02:59:33 | FromDiscord | <janakali> @albassort `-d:nimPreviewSlimSystem` |
03:00:10 | FromDiscord | <albassort> In reply to @battery.acid.bubblegum "try `-d:danger`?": I've been using nim since before you went to highschool, i know -d:danger exists |
03:00:31 | FromDiscord | <albassort> In reply to @janakali "<@217459674700578816> `-d:nimPreviewSlimSystem`": slim system? |
03:00:39 | FromDiscord | <Robyn [She/Her]> In reply to @albassort "I've been using nim": ...we're the same age |
03:00:44 | FromDiscord | <albassort> yes :) |
03:01:05 | FromDiscord | <Robyn [She/Her]> and it's not like you sent flags 🙃 |
03:01:10 | FromDiscord | <Robyn [She/Her]> ig trim it down by hand |
03:01:57 | FromDiscord | <Robyn [She/Her]> In reply to @albassort "yes :)": you've been using Nim before 2022? jesus |
03:02:09 | FromDiscord | <albassort> we are not tyhe same age |
03:02:11 | FromDiscord | <albassort> im 21 |
03:02:18 | FromDiscord | <albassort> (edit) "tyhe" => "the" |
03:02:20 | FromDiscord | <albassort> and yes |
03:02:28 | FromDiscord | <Robyn [She/Her]> In reply to @albassort "im 21": differs by a year, p minor |
03:02:42 | FromDiscord | <albassort> think the difference is uk and us middleschool then |
03:03:26 | FromDiscord | <albassort> -d:nimPreviewSlimSystem doesn't cover |
03:03:29 | FromDiscord | <albassort> (edit) "-d:nimPreviewSlimSystem doesn't cover ... " added "the functions i have" |
03:04:14 | FromDiscord | <Robyn [She/Her]> In reply to @albassort "think the difference is": 🤷♀️ |
03:04:29 | FromDiscord | <janakali> import them explicitly |
03:05:02 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#pasty=ayYGiMDa |
03:05:14 | FromDiscord | <janakali> sent a code paste, see https://play.nim-lang.org/#pasty=TSldowAH |
03:05:51 | FromDiscord | <albassort> isn't $float in system? |
03:06:01 | FromDiscord | <Elegantbeef> slim system desn't effect code gen size |
03:06:40 | FromDiscord | <janakali> in my experience it does (for js backend) |
03:07:45 | FromDiscord | <janakali> In reply to @albassort "isn't $float in system?": it's in std/dollars |
03:08:18 | FromDiscord | <janakali> (edit) "std/dollars" => "system/dollars" |
03:09:29 | FromDiscord | <lainlaylie> under slim system you need std/formatfloat, isn't it |
03:27:36 | * | rockcavera quit (Remote host closed the connection) |
03:53:05 | * | alexdaguy joined #nim |
03:59:19 | * | SchweinDeBurg quit (Quit: WeeChat 4.6.0-dev) |
04:13:19 | * | SchweinDeBurg joined #nim |
04:30:21 | FromDiscord | <blackmius> how good nim OOP is? i want some sort of interfaces to implement strategy pattern but statically dont think it is possible or at least with generics it will have parasitic effect (all parent structures will have to also pass type of strategy) |
04:30:46 | FromDiscord | <Elegantbeef> It's basic single parent inheritance |
04:31:29 | FromDiscord | <Elegantbeef> You can likely just use pointer procs for the strategy pattern |
04:36:36 | FromDiscord | <albassort> its good enough |
04:36:53 | FromDiscord | <demotomohiro> In reply to @janakali "<@288750616510201856> koch uses one": Thank you!↵https://github.com/termux/termux-packages/actions/runs/12938847873↵That fixed the error and Nim has been built successfully. |
04:36:57 | FromDiscord | <albassort> to allows you to do enough OOP that it works when OOP is good and useful |
04:37:07 | FromDiscord | <Elegantbeef> Cmon now OOP is never good 😄 |
04:37:24 | FromDiscord | <albassort> but as far as a lot of the abstract concepts of Java, they arne't there. You would need to do some C-like mangaling get them to work |
04:37:38 | FromDiscord | <albassort> (edit) "arne't" => "aren't" |
04:38:01 | FromDiscord | <albassort> You know beef, if you generalize OOP enough, JS has OOP |
04:38:04 | FromDiscord | <albassort> C has OOP |
04:38:05 | FromDiscord | <gigglyingallo> what nim coding language actually used for ? |
04:38:17 | FromDiscord | <albassort> its used for making programs :) |
04:38:27 | FromDiscord | <Elegantbeef> If you generalise anything you can lie about it all |
04:38:39 | FromDiscord | <gigglyingallo> interesting is it similar to python? ↵(@albassort) |
04:38:44 | FromDiscord | <Elegantbeef> No |
04:38:45 | FromDiscord | <albassort> no |
04:38:57 | FromDiscord | <gigglyingallo> ok |
04:39:19 | FromDiscord | <albassort> It looks vaguely similar in form, but in content its very different |
04:39:26 | FromDiscord | <blackmius> sent a long message, see https://pasty.ee/JUnqQysC |
04:39:40 | FromDiscord | <gigglyingallo> I am curious what stuff can I make with it? ↵(@albassort) |
04:39:52 | FromDiscord | <gigglyingallo> I know C++ python an html javascript |
04:39:58 | FromDiscord | <gigglyingallo> I know C++ python an html javascript css |
04:40:04 | FromDiscord | <Elegantbeef> Who cares what patterns you can do with OOP, the patterns aren't needed |
04:40:24 | FromDiscord | <Elegantbeef> Most of those patterns are to work around OOP and not work due to OOP |
04:40:28 | FromDiscord | <albassort> almost all of these OOP patterns are bad and shouldn't have been written or given names |
04:40:47 | FromDiscord | <Elegantbeef> `singleton` oh so you mean a global variable |
04:41:03 | FromDiscord | <albassort> You can implement all of these tho it would be a bit of work and nobody would use your library |
04:41:10 | FromDiscord | <Elegantbeef> You only need a singleton cause your system requires wrapping everything in an object and you're too lazy to pass a variable around |
04:41:24 | FromDiscord | <Elegantbeef> Or too lazy to do dependency injection |
04:41:38 | FromDiscord | <Elegantbeef> The fact singleton is here but not dependency injection is funny |
04:42:07 | FromDiscord | <albassort> fuck dependency injection idek what it means |
04:42:13 | FromDiscord | <Elegantbeef> Builder is not an OOP pattern |
04:42:27 | FromDiscord | <Elegantbeef> You write a constructor that takes in an object you want the object to interact with |
04:42:35 | FromDiscord | <blackmius> i havent seen a good dependency injection in nim yet |
04:42:51 | FromDiscord | <Elegantbeef> Cause you don't need it |
04:43:11 | FromDiscord | <Elegantbeef> You just make an object and pass it to another |
04:43:13 | FromDiscord | <Elegantbeef> We did DI |
04:43:19 | FromDiscord | <albassort> In reply to @Elegantbeef "You write a constructor": this is DI? |
04:43:25 | FromDiscord | <Elegantbeef> Yes |
04:43:34 | FromDiscord | <blackmius> how can i make mockups tests if i cant pass different type? |
04:43:44 | FromDiscord | <Elegantbeef> > In software engineering, dependency injection is a programming technique in which an object or function receives other objects or functions that it requires, as opposed to creating them internally. |
04:44:06 | FromDiscord | <albassort> thats just like, called programming |
04:44:08 | FromDiscord | <albassort> :| |
04:44:20 | FromDiscord | <Elegantbeef> Yes but it's OOP land so you need a fancy term else it gets axed |
04:44:28 | FromDiscord | <Elegantbeef> So write the code to test the public interface |
04:44:34 | FromDiscord | <Elegantbeef> I'm not one for supporting mock testing |
04:44:46 | FromDiscord | <Elegantbeef> When you are not testing a true API what are you truly testing? |
04:45:09 | FromDiscord | <blackmius> how my code reacts on responses |
04:45:16 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#pasty=HPWNRswU |
04:45:27 | FromDiscord | <Elegantbeef> Nah that's not DI |
04:45:31 | FromDiscord | <albassort> (edit) "https://play.nim-lang.org/#pasty=bVCHbcKk" => "https://play.nim-lang.org/#pasty=hkmEmdUx" |
04:45:44 | FromDiscord | <albassort> In reply to @blackmius "how my code reacts": idk what this means |
04:46:00 | FromDiscord | <Elegantbeef> Now we're doing DI |
04:46:00 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=JvNCvKzl |
04:46:07 | FromDiscord | <muddmaker> DI is used all over the place in C#/Java land |
04:46:11 | FromDiscord | <Elegantbeef> They want to ensure their code reacts as they expect on specific server responses |
04:46:31 | FromDiscord | <blackmius> In reply to @muddmaker "DI is used all": i am using it in python |
04:46:54 | * | xet7 joined #nim |
04:47:10 | FromDiscord | <Elegantbeef> It's used a lot, but it's only special cause people reach for singletons instead in OOPland |
04:47:49 | FromDiscord | <Elegantbeef> Tightly coupling the class to a singleton in a cyclical hell |
04:48:26 | FromDiscord | <albassort> In reply to @blackmius "i am using it": well then why are you here |
04:49:17 | FromDiscord | <albassort> Singletons are cool ig but why not jsut have a object in globally shared memory? |
04:49:30 | FromDiscord | <albassort> well, if you wanna store local date to it ig |
04:49:40 | FromDiscord | <Elegantbeef> Cause like in Unity people want to have a inspector 😛 |
04:49:41 | FromDiscord | <albassort> these cocepts come from bad roots tho |
04:49:53 | FromDiscord | <Elegantbeef> Singletons are more common in game engines due to that inspector |
04:50:08 | FromDiscord | <Elegantbeef> So you get dumb classes like "GameManager" |
04:50:16 | FromDiscord | <Elegantbeef> What's it do "It manages the game" |
04:50:19 | FromDiscord | <albassort> I just think the idea of programming a game engine or interacting with a game engine in C# is like the worst idea i can imagine |
04:50:35 | FromDiscord | <muddmaker> It's common in enterprise web frameworks |
04:50:36 | FromDiscord | <Elegantbeef> Programming a game engine is hunky dory |
04:50:43 | FromDiscord | <Elegantbeef> Now using C#.... 😄 |
04:50:45 | FromDiscord | <muddmaker> Like ASP.net Core |
04:50:57 | FromDiscord | <albassort> yeah Ik at my old job aspnet core and swagger |
04:51:02 | FromDiscord | <albassort> linq |
04:51:04 | FromDiscord | <albassort> its all nonsense tho |
04:51:24 | FromDiscord | <muddmaker> Everything Microsoft touches is overarchitected to death |
04:51:32 | FromDiscord | <albassort> overengineered solutions to overcomplicated problems |
04:51:59 | FromDiscord | <Elegantbeef> Atleast MS doesn't have the naming issues Oracle has |
04:52:12 | FromDiscord | <albassort> like the sheer human labor pored into LINQ, a project that doesn't need to exist |
04:52:23 | FromDiscord | <albassort> (edit) "pored" => "poured" |
04:52:55 | FromDiscord | <albassort> my ORM is like 100 lines of code, runs faster, and has less bugs |
04:53:08 | FromDiscord | <albassort> (edit) "bugs" => "bugs, and is easier to use" |
04:53:27 | FromDiscord | <muddmaker> Linq isn't the ORM, though, that's EntityFramework |
04:53:39 | FromDiscord | <albassort> they go hand in hand |
04:53:42 | FromDiscord | <albassort> but yes linq is fine ig |
04:53:44 | FromDiscord | <albassort> EF is the issue |
04:53:53 | FromDiscord | <albassort> (edit) "EF is the issue ... " added "i meant to say" |
04:53:54 | FromDiscord | <muddmaker> Fuck EF with a cactus |
04:54:19 | FromDiscord | <albassort> 10,000+ hours of cumulative human effort in its creation |
04:54:41 | FromDiscord | <muddmaker> Took until the past couple years to add UpdateWhere |
04:55:36 | FromDiscord | <Elegantbeef> I'm so happy i'm pretty much over here playing with wooden blocks going "What's a database" |
04:56:19 | FromDiscord | <albassort> In reply to @muddmaker "Took until the past": they dont have Match in their sqlite bindings |
04:56:30 | FromDiscord | <albassort> tbf nim's bind() doesn't work with it either |
04:56:55 | FromDiscord | <blackmius> In reply to @Elegantbeef "It's basic single parent": how vtable is implemented? every inherited ref object having vtable inself or how dispatch function knows which realisation to use? |
04:57:16 | FromDiscord | <Elegantbeef> Nim doesn't have vtables withotu a flag |
04:57:24 | FromDiscord | <Elegantbeef> It's a large switch statement without that flagh |
04:57:42 | FromDiscord | <Elegantbeef> With that flag you have to declare all your types in the same file iirc |
04:58:09 | FromDiscord | <Elegantbeef> Ah nvm that's not true |
04:58:10 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual_experimental.html#vtable-for-methods |
04:59:19 | FromDiscord | <albassort> should i even ask |
04:59:43 | FromDiscord | <Elegantbeef> If you want to |
05:00:17 | FromDiscord | <blackmius> In reply to @Elegantbeef "https://nim-lang.org/docs/manual_experimental.html#": is typeinfo accessable? |
05:00:18 | FromDiscord | <albassort> oh i undrstand |
05:00:50 | FromDiscord | <Elegantbeef> Sure but it's really limited |
05:01:02 | FromDiscord | <blackmius> can i monkeypatch it for specific object? |
05:01:39 | FromDiscord | <Elegantbeef> Probably |
05:01:42 | FromDiscord | <Elegantbeef> Would have to ask ringabout |
05:02:25 | FromDiscord | <albassort> ok look, heres the deal.↵Nim is not a OOP first class language. We CAN do it, kinda. But nobody programs, very few people would be able to help you or give you support if you need it.↵↵As they say, "When in Rome, do as the Romans do". Perhaps it would benefit you to learn a new style of programming? |
05:06:01 | FromDiscord | <blackmius> In reply to @albassort "ok look, heres the": write duplicate code or mangle with proc pointers this your alternative |
05:06:30 | FromDiscord | <albassort> Probably more foundational, where you wouldn't be writing methods and such |
05:06:41 | FromDiscord | <Elegantbeef> Why do you have to duplicate code? |
05:07:10 | FromDiscord | <albassort> my http dispatcher uses str-:> pointer tables but, thats really the only time i've ever needed this |
05:07:30 | FromDiscord | <albassort> and this is over a very long time |
05:08:04 | FromDiscord | <blackmius> In reply to @Elegantbeef "Why do you have": without runtime dispatch it is hard to write less code and pass multiple realisations |
05:08:45 | FromDiscord | <Elegantbeef> Can you provide a code example? |
05:11:29 | FromDiscord | <blackmius> std/streams status-im/asyncstreams boringssl↵↵mangle with creating runtime vtable |
05:11:51 | FromDiscord | <blackmius> i dont want to write code compiler have to |
05:12:18 | FromDiscord | <Elegantbeef> Ah right |
05:12:22 | FromDiscord | <Elegantbeef> https://github.com/beef331/traitor my counter point |
05:13:00 | FromDiscord | <Elegantbeef> Does suck that it relies on macros |
05:13:06 | FromDiscord | <Elegantbeef> Better than relying on inheritance tree for 'interfaces' |
05:13:50 | FromDiscord | <lainlaylie> isnt std/streams an example of why trying to do runtime dispatch is a bad idea? |
05:14:26 | FromDiscord | <Elegantbeef> It shows an alternative to using methods really |
05:15:08 | FromDiscord | <Elegantbeef> A vast majority of the time you'd want to have the static variations, but it pollutes the entire system with runtime dispatch |
05:15:12 | FromDiscord | <blackmius> so i am wishing something like go's interfaces |
05:15:49 | FromDiscord | <Elegantbeef> This is why I have `StaticTraitor` so I can force traits without having to corrupt the entire api with static dispatch 😄 |
05:15:56 | FromDiscord | <Elegantbeef> runtime dispatch\ |
05:15:56 | FromDiscord | <blackmius> maybe i need to change chat and asking go channel how can i create macros |
05:16:20 | FromDiscord | <albassort> beef why would you make this |
05:16:44 | FromDiscord | <Elegantbeef> There is also iface which is another interface API |
05:16:51 | FromDiscord | <lainlaylie> i thought we were talking about alternatives to oop, not trying to reimplement oop without methods |
05:16:52 | FromDiscord | <Elegantbeef> > A trait library made from bordem. |
05:16:55 | FromDiscord | <Elegantbeef> I like my constrained generics so why wouldn't I makei t |
05:18:05 | FromDiscord | <albassort> i respect it beef but this is dumnb |
05:18:07 | FromDiscord | <albassort> (edit) "dumnb" => "dumb" |
05:18:30 | FromDiscord | <albassort> bravo |
05:18:31 | FromDiscord | <Elegantbeef> It's really not |
05:18:31 | FromDiscord | <Elegantbeef> I actively use it where I need it |
05:18:58 | FromDiscord | <Elegantbeef> Why would I want to introduce inheritance trees |
05:20:02 | FromDiscord | <Elegantbeef> Be afraid, be very afraid |
05:20:04 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1332218339648475256/image.png?ex=67947483&is=67932303&hm=e4caf39e5ba08836075f234b049e7a0dab7c18264359dd248edce3be3e0abf17& |
05:20:23 | FromDiscord | <albassort> its kinda cool that .onClick() just didn't exist and now it does |
05:21:50 | FromDiscord | <albassort> hey beef what does "gameState" do :-) |
05:22:03 | FromDiscord | <Elegantbeef> On top of it you can do `StaticTrait[Clickable]` which just ensures it compiles |
05:22:06 | FromDiscord | <Elegantbeef> Or whatever the name is |
05:22:19 | FromDiscord | <Elegantbeef> It unironically just holds gamestate |
05:22:39 | FromDiscord | <albassort> it holds the game state |
05:22:55 | FromDiscord | <Elegantbeef> Pass it around to get data from the game state and do not have global variables |
05:25:28 | FromDiscord | <albassort> i need to make a macro that adds "export" to js functions |
05:25:32 | FromDiscord | <albassort> "exportjs" |
05:26:01 | FromDiscord | <Elegantbeef> Just `{.push exportjs.}` |
05:27:03 | FromDiscord | <muddmaker> In reply to @albassort "tbf nim's bind() doesn't": The best pattern I've seen for databases now is to have write raw sql for each query, and at build time to have that query run against the DB in a way that generates the necessary types for it |
05:27:26 | FromDiscord | <muddmaker> This is what go's sqlc and rusts sqlx do |
05:27:59 | FromDiscord | <muddmaker> (edit) "rusts" => "rust's" |
05:28:05 | FromDiscord | <albassort> i might write something to scaffold a postgres databse for nim |
05:28:18 | FromDiscord | <albassort> mine does this |
05:28:58 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#pasty=NSHDBGlT |
05:29:05 | FromDiscord | <albassort> where typdesc is a manually written type |
05:29:31 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#pasty=ZKZpQNkq |
05:29:40 | FromDiscord | <albassort> that has to be ordered according to the rows you want to get |
05:30:05 | FromDiscord | <albassort> (edit) "https://play.nim-lang.org/#pasty=RgFKfHgy" => "https://play.nim-lang.org/#pasty=vuCmaRGQ" |
05:30:07 | FromDiscord | <muddmaker> Yeah... the main thing that sqlc would do differently is auto generate that type |
05:30:34 | FromDiscord | <muddmaker> Which is useful in the event that the schema changes and you want to see what breaks at compile time |
05:31:22 | FromDiscord | <albassort> how do you get the data from it if its not generated pre-compile time |
05:31:29 | FromDiscord | <albassort> is it not static? |
05:33:14 | FromDiscord | <muddmaker> Here's their marketing: <https://sqlc.dev/> |
05:33:53 | FromDiscord | <muddmaker> It's just a command that is run to generate the necessary code |
05:34:03 | FromDiscord | <albassort> you would need to get the stuff before the lexer for nim |
05:34:13 | FromDiscord | <albassort> idk how you would implement this |
05:34:15 | FromDiscord | <albassort> macro amgic |
05:34:16 | FromDiscord | <albassort> (edit) "amgic" => "magic" |
05:35:42 | FromDiscord | <muddmaker> For sqlc, I think the queries are just written in a different file. Rust's sqlx will actually run it within rust's macro system, but it's still recommended to put the queries in another file for the sake of syntax highlighting and other tooling |
05:36:06 | FromDiscord | <albassort> they i bet this can be written in 500 lines of nim |
05:36:37 | FromDiscord | <muddmaker> So your project would just be structured to have a `queries/` directory, and it would make a `src/queries.nim` that you could include and call with |
05:41:36 | FromDiscord | <albassort> i cant find a way to get the types and names without at least a sample query... |
05:42:26 | FromDiscord | <Elegantbeef> I imagine in Nim you'd do like `type MyType = queryType(sqlHere)` |
05:43:00 | FromDiscord | <albassort> nah im just thinking about writing a scaffolder |
05:47:27 | FromDiscord | <albassort> i was feeling burned out so i will do this today instead of being productive |
05:47:53 | FromDiscord | <albassort> (edit) "burned" => "burnt" |
05:50:52 | FromDiscord | <albassort> also im programming a groupBy proc |
05:51:07 | FromDiscord | <albassort> be very afraid beef, i am sequtil-ing |
05:51:18 | FromDiscord | <albassort> although my code will probably be less of a dumpsterfire |
05:51:46 | * | coldfeet joined #nim |
05:53:47 | * | coldfeet quit (Client Quit) |
06:42:11 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#pasty=ecccToGZ |
06:45:59 | FromDiscord | <albassort> beef would it be possible to make a macro that, you stable to a type, that, at compile times runs this code, generates an object, and compares it to the reference type, and if it failes the compilation fails and it spits the typedef out |
06:47:12 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#pasty=JHDKtIuo |
06:50:15 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#pasty=crfhJMnZ |
07:13:42 | FromDiscord | <yummy_licorice> is there a way to transfer data between threads? |
07:13:51 | FromDiscord | <albassort> In reply to @yummy_licorice "is there a way": many |
07:13:57 | FromDiscord | <albassort> depends what you're trying to do which is best |
07:14:20 | FromDiscord | <albassort> Channels, shared ptrs, and atomics come to mind |
07:15:06 | FromDiscord | <albassort> channels communicate between threads, shared ptrs are globally alloced, and so are atomics but they're different lol |
07:15:29 | FromDiscord | <yummy_licorice> i see |
07:15:42 | FromDiscord | <yummy_licorice> thanks |
07:18:06 | FromDiscord | <luteva> In reply to @nnsee "so instead of `import": first of all: Thyx a lot! That worked fine!↵What is the preferred way/process to handle these lib-verison-issues? ↵- Create a PR for the exitisting project? (Which won't work for nim version 1.x) OR↵- Create a fork or a new project of the (old) project to work with the current nim version? |
07:19:41 | FromDiscord | <luteva> maybe there even is a doc of how to handle these version issues? |
07:19:57 | FromDiscord | <nnsee> worth making a PR but if this is Ormin then that hasn't been updated in years |
07:20:08 | FromDiscord | <nnsee> and you're probably better off just rolling your own fork |
07:20:53 | FromDiscord | <nnsee> I doubt many people are still using 1.6.x, and if they are, they can pin the dependency to a specific version or commit |
07:21:21 | FromDiscord | <yummy_licorice> sent a code paste, see https://play.nim-lang.org/#pasty=aJlWztlh |
07:21:55 | FromDiscord | <lainlaylie> In reply to @luteva "first of all: Thyx": why wouldn't this fix work for nim 1.x.x? |
07:22:15 | FromDiscord | <nnsee> oh yeah good point |
07:22:43 | FromDiscord | <nnsee> the db_connector module doesn't have a hard dependency on 2.x and can also be installed for 1.x |
07:27:59 | FromDiscord | <lainlaylie> i wonder if stuff like `when NimMajor < 2: requires "..."` works in nimble files |
07:28:09 | FromDiscord | <Elegantbeef> Yesn't |
07:29:26 | FromDiscord | <albassort> In reply to @yummy_licorice "i also had a": im unsure, but fair warning, async in nim can be buggy and i avoid it |
07:30:25 | FromDiscord | <yummy_licorice> In reply to @albassort "im unsure, but fair": would it be easier to have the ipc server and the window manager update loop on different threads |
07:30:34 | FromDiscord | <albassort> no |
07:30:47 | FromDiscord | <albassort> although thats how i programmed by http server lol |
07:31:10 | FromDiscord | <yummy_licorice> should i rewrite the update loop for the window loop to also poll for socket events? |
07:31:18 | FromDiscord | <yummy_licorice> that may be a bit easier |
07:31:39 | FromDiscord | <albassort> yeah, at the very least it will help with debugging whatever is going wrong with async |
07:31:44 | FromDiscord | <Elegantbeef> Here I am almost always using selectors over async as I find there less to faff with 😄 |
07:31:45 | FromDiscord | <albassort> also make sure your nim is up to date |
07:32:03 | FromDiscord | <albassort> beef is a thread hater |
07:32:11 | FromDiscord | <yummy_licorice> In reply to @albassort "also make sure your": im on 2.2.0 |
07:32:21 | FromDiscord | <Elegantbeef> I mean threads aren't needed for basic IO |
07:32:59 | FromDiscord | <albassort> my scaffolder works now i just need to... do something... |
07:35:42 | * | ntat joined #nim |
07:37:52 | FromDiscord | <albassort> i should have wrote this 2 months ago |
07:37:55 | FromDiscord | <nnsee> In reply to @Elegantbeef "I mean threads aren't": i always write my code to use all of my cores. unused cores are wasted cores. i also write my code to consume as many cycles as possible |
07:38:12 | FromDiscord | <Elegantbeef> What about ram? |
07:38:28 | FromDiscord | <nnsee> obviously all of the ram |
07:38:35 | FromDiscord | <albassort> wasted cycles is wasted frequency |
07:38:44 | FromDiscord | <Elegantbeef> I always do `discard alloc(int32.high)` just so the user knows I mean business |
07:39:02 | FromDiscord | <albassort> you know, some Taiwanese workers owrked really hard to make your cpu 4ghz, and you're gonna waste it by optimizing your code |
07:39:35 | FromDiscord | <albassort> (edit) "owrked" => "worked" |
07:40:42 | FromDiscord | <Elegantbeef> Wirth is rolling |
07:42:09 | FromDiscord | <mrgaturus> In reply to @albassort "you know, some Taiwanese": you need also understand the OS needs schedule hundred of processes just for 4/8 cores |
07:42:53 | FromDiscord | <nnsee> this is why we invented scheduling like 80 years ago |
07:43:42 | FromDiscord | <Elegantbeef> What's the airspeed of a fully laden 8 thread processor? |
07:46:14 | Amun-Ra | Elegantbeef: what do you mean, european or african one? |
07:49:38 | FromDiscord | <Elegantbeef> I have to imagine there is no difference |
07:49:58 | FromDiscord | <yummy_licorice> In reply to @yummy_licorice "that may be a": ok now i feel dumb ass hell 😭 there is no loop function, i wrote the loop myself then forgot i wrote the loop |
07:50:03 | FromDiscord | <yummy_licorice> (edit) "ass" => "as" |
08:07:13 | * | tokyovigilante quit (Read error: Connection reset by peer) |
08:07:28 | * | tokyovigilante joined #nim |
09:26:44 | * | beholders_eye joined #nim |
09:30:42 | FromDiscord | <spotlightkid> Is there a way to mark a proc, which I imported from somewhere else, as `discardable`? Without creating a wrapper proc?↵Templates apparently do not support the `discardable` pragma. |
09:41:47 | FromDiscord | <firasuke> What's a good fast hashing algorithm implemented in pure Nim (for file checksums, preferrably cryptographic)? |
09:57:10 | FromDiscord | <spotlightkid> @firasuke\: is it a problem of finding or of choosing? because there are tons of hashing libraries here\: https://nimpkgs.dayl.in/?query=hash#/search |
10:47:16 | * | oisota quit (Quit: Ping timeout (120 seconds)) |
10:47:35 | * | oisota joined #nim |
11:05:43 | FromDiscord | <firasuke> In reply to @spotlightkid "<@248208053952970752>\: is it a": I'd say it's the latter, I found BLAKE3 from `hashlib` but it turns out it's using the C implementation underneath |
11:06:57 | FromDiscord | <firasuke> In reply to @spotlightkid "<@248208053952970752>\: is it a": also wait, since when did we have a cool website for searching for available nim libraries? I recall nimble directory, but that's pretty much about it |
11:10:23 | FromDiscord | <nnsee> In reply to @firasuke "I'd say it's the": check out Constantine and its SHA256 impl https://github.com/mratsim/constantine?tab=readme-ov-file#general-cryptography |
11:11:10 | FromDiscord | <nnsee> iirc it takes advantage of hw acceleration where possible |
11:11:25 | FromDiscord | <nnsee> @mratsim can probably say more about this |
11:11:43 | FromDiscord | <firasuke> Cool, thanks |
11:13:17 | FromDiscord | <nnsee> the impl itself is here https://github.com/mratsim/constantine/tree/master/constantine/hashes |
11:18:08 | * | SchweinDeBurg quit (Ping timeout: 264 seconds) |
11:19:38 | * | SchweinDeBurg joined #nim |
11:47:44 | * | SchweinDeBurg quit (Ping timeout: 244 seconds) |
11:49:39 | FromDiscord | <albassort> having an issue where socket.send() is getting trapped in there |
11:49:55 | * | SchweinDeBurg joined #nim |
11:50:34 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#pasty=JTgWVdZg |
11:51:26 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#pasty=SSDEDgOz" => "https://play.nim-lang.org/#pasty=LZBmLwdU" |
11:54:13 | FromDiscord | <albassort> In reply to @albassort "having an issue where": its probably a bug in the src, im trying to fix it :)\ |
11:57:54 | FromDiscord | <albassort> net.nim:1764 is failing to raise |
11:58:05 | FromDiscord | <albassort> (edit) "net.nim:1764 is failing to raise ... " added "socketError" |
11:59:00 | FromDiscord | <albassort> seems they're missing a break |
12:00:51 | FromDiscord | <albassort> socketError(socket, lastError = lastError, flags = flags) |
12:01:00 | FromDiscord | <albassort> https://github.com/nim-lang/Nim/blob/8fe518ed47163e4fdcad1f17eab589283585ad3f/lib/pure/net.nim#L1763 |
12:01:12 | FromDiscord | <albassort> add a break after this line |
12:01:40 | FromDiscord | <albassort> can someone else double check this to make sure im not crazy |
12:03:57 | FromDiscord | <albassort> > ## If `flags` contains `SafeDisconn`, no exception will be raised↵> ## when the error was caused by a peer disconnection. |
12:04:31 | FromDiscord | <albassort> yeah so it seems nobody considered the case where, SockerError wont be raised and data can no longer b written? |
12:26:34 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#pasty=zqGECYHM |
13:23:18 | FromDiscord | <firasuke> sent a code paste, see https://play.nim-lang.org/#pasty=VzkZIdsZ |
13:26:50 | FromDiscord | <firasuke> Or do I have to duplicate the file handle of `fd1`? |
13:31:56 | FromDiscord | <nnsee> yep, you need to `dup2` it |
13:35:13 | FromDiscord | <nasuray> In reply to @firasuke "also wait, since when": Since I was bored one weekend and annoyed that looking at my own packages was broken because of faulty tag handling by nimble.directory |
13:35:46 | FromDiscord | <spotlightkid> @firasuke\: you can also just do `stdout.write("blah")`, of course. |
13:48:30 | FromDiscord | <firasuke> In reply to @nasuray "Since I was bored": thanks for your work |
13:49:17 | FromDiscord | <firasuke> In reply to @spotlightkid "<@248208053952970752>\: you can also": that is equivalent to `echo` without flushing, but what I want is a redirect |
13:50:13 | FromDiscord | <firasuke> sent a code paste, see https://play.nim-lang.org/#pasty=xBqvzGdq |
13:55:58 | FromDiscord | <firasuke> In reply to @firasuke "this version works as": Is this correct? or should I use `dup2` instead? |
13:56:49 | FromDiscord | <nnsee> i meant the dup2 syscall |
13:56:55 | FromDiscord | <nnsee> if you're doing it this way it should be fine |
14:00:10 | FromDiscord | <firasuke> In reply to @nnsee "if you're doing it": oh ok, you mean the version above correct? |
14:00:34 | FromDiscord | <nnsee> In reply to @firasuke "oh ok, you mean": if it works as intended then probably |
14:01:04 | FromDiscord | <firasuke> In reply to @nnsee "if it works as": Alright, I also found this: https://forum.nim-lang.org/t/6909 |
14:02:21 | FromDiscord | <nnsee> In reply to @firasuke "Alright, I also found": that link says you should probably be using dup2 |
15:07:54 | * | alexdaguy quit (Quit: w) |
15:17:04 | * | arkanoid joined #nim |
15:17:30 | arkanoid | hello! how can I remove -lrt from linking pass? |
15:23:46 | arkanoid | I am trying with switch("clang.options.linker", "") but it keeps adding -lm -lrt and so on |
15:24:40 | Amun-Ra | what os? |
15:25:29 | arkanoid | linux |
15:25:40 | Amun-Ra | when cross-compiling for windows I added -Wl,-Bstatic |
15:25:55 | arkanoid | I am trying to solve this problem, but forum post is 10 years old https://forum.nim-lang.org/t/1729 |
15:26:08 | arkanoid | I have to remove, not add |
15:26:23 | Amun-Ra | yes, that removes -ldl |
15:26:57 | Amun-Ra | my first method was dynliboverride |
15:27:06 | arkanoid | I have "switch("passl", "-target x86_64-macos -fno-sanitize=undefined")" but linkers errors out "error: unable to find dynamic system library 'rt' using strategy 'paths_first'. searched paths: none" because "-pthread -pthread -lm -lm -lrt -target x86_64-macos -fno-sanitize=undefined -ldl" |
15:27:44 | Amun-Ra | if you can build static binary add -static |
15:28:18 | arkanoid | already tried, same error. "-pthread -pthread -lm -lm -lrt -target x86_64-macos -fno-sanitize=undefined -static -ldl" |
15:29:42 | Amun-Ra | you can override gcc.options.linker in nim.cfg |
15:29:43 | arkanoid | you see I have duplicated entries possibly because nim is adding options that the linker is automatically using (I'm using zigcc to cross compile) |
15:30:22 | Amun-Ra | duplicated libs make no difference |
15:30:23 | arkanoid | I already set switch("clang.options.linker", "") and switch("gcc.options.linker", ""), it still adds flags |
15:31:21 | Amun-Ra | I suspect switch-ing clang.options.linker in config.nims does not work |
15:31:35 | Amun-Ra | try to change it in nim.cfg |
15:32:07 | Amun-Ra | gcc.options.linker = "" |
15:32:16 | Amun-Ra | or clang if that's the cc |
15:35:54 | * | coldfeet joined #nim |
15:51:08 | arkanoid | Amun-Ra: seems not working |
15:53:20 | Amun-Ra | :/ |
15:53:42 | arkanoid | I don't see where -lrt is added to linking args https://github.com/nim-lang/Nim/blob/devel/config/nim.cfg |
15:53:45 | Amun-Ra | what the output of --listcmd looks like? |
15:56:23 | arkanoid | https://termbin.com/l6iw |
15:56:50 | arkanoid | the last 2 are the ones I am playing with. The first 2 are unchanged from nim 2.2.0 tarball |
15:57:22 | arkanoid | I'm building with nimble build --verbose and it shows cfg files are being used |
15:58:01 | arkanoid | but I get same result using nim c src/foo.nim |
16:02:04 | Amun-Ra | I mean add --listcmd to the build args |
16:03:23 | * | coldfeet quit (Quit: Lost terminal) |
16:04:44 | FromDiscord | <luteva> In reply to @lainlaylie "why wouldn't this fix": Because in nim 1.x.x the libs are part of the stdlib |
16:07:21 | arkanoid | Amun-Ra: solved. Linking options are controlled by --os switch. I have to use switch("os", "MacOSX") |
16:07:49 | arkanoid | I was trying with "MacOS" and it was not working |
16:08:17 | FromDiscord | <luteva> Oh yeah you are right! Should work for nim 1.x.x , too! |
16:10:32 | Amun-Ra | ah |
17:46:06 | FromDiscord | <threefour> Anyone familiar with NimYAML? I'm trying to figure out how to load a YAML field into a differently-named object field. The field name is `type`, but I can't put that field on the object because it's a reserved keyword. |
17:48:10 | FromDiscord | <flyx> yeah, I've written it. easiest way is to put the name in backticks like so\: ``type``↵(@threefour) |
17:50:21 | FromDiscord | <threefour> Duh. I don't know why I didn't try that. Works great, thanks. Do you by chance know how to do the other approach, which would be mapping the original field onto a differently-named object field? In case I ever want to do that. |
17:53:33 | FromDiscord | <flyx> you'd need to write a custom constructor for the type containing the field (and possibly a representer if you want to write the data out again). that would be rather tedious since you'd need to recreate the logic that comes for free with the default generic object constructor (i.e. checking each field name, calling the appropriate child constructors, checking whether all required values are present and so on)↵(@threefour) |
17:54:53 | FromDiscord | <flyx> the third approach would be to create an issue „please implement an annotation to let the YAML have a key different from the field name in Nim“. I never implemented that yet because no-one asked ;)↵(@threefour) |
17:58:57 | * | ntat quit (Remote host closed the connection) |
17:59:16 | * | ntat joined #nim |
18:01:38 | arkanoid | is there a non gc-ed string in nim? I want a global variable string with pre-allocated max length to be shared between threads (using locks). At the moment I get "'mythread' is not GC-safe as it accesses 'config' which is a global using GC'ed memory" |
18:02:38 | FromDiscord | <threefour> Oh I just realized you meant _you_ built the thing. Yeah, it's something I use semi frequently when loading YAML in Go. Maybe I'll create an issue. I can't be the only one that does that. |
18:02:44 | FromDiscord | <threefour> Thanks for the quick response |
18:05:48 | FromDiscord | <demotomohiro> @arkanoid array[char, Len] with cstring is. |
18:08:12 | FromDiscord | <pointystick> arkanoid, is this useful for you? https://github.com/termermc/nim-stack-strings I've not used it myself, I just remember seeing it in mentioned a while ago |
18:10:00 | arkanoid | pointystick: thanks! |
18:10:34 | arkanoid | demotomohiro, interesting, I'll try with cstring too |
18:21:53 | arkanoid | pointystick it works! |
18:23:17 | Amun-Ra | hmm, I wrote something similar |
18:41:35 | FromDiscord | <Phil> Can nimcall capture variables from the procs environment? |
18:41:43 | FromDiscord | <Phil> (edit) "Can nimcall ... capture" added "procs" |
18:42:30 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#pasty=dKQJtaGT |
18:46:06 | FromDiscord | <threefour> @flyx probably a dumb question, but how do I access the object field now? Trying to do `<object>.\`type\`` gives me the actual object type, not the value for the field. |
18:46:14 | FromDiscord | <threefour> (edit) "`<object>.\`type\``" => "<object>.\`type\`" |
18:53:28 | FromDiscord | <demotomohiro> In reply to @isofruit "I'm slightly confused that": https://internet-of-tomohiro.pages.dev/nim/faq.en#coding-what-is-the-difference-between-variables-inside-procedures-and-outside-proceduresqmark↵Variables inside procedures and outside procedures are different. |
18:54:11 | FromDiscord | <flyx> not sure what happens here, I don't regularly write Nim these days. someone else might have an idea. this thread implies it should work https://forum.nim-lang.org/t/7191↵(@threefour) |
18:54:53 | FromDiscord | <demotomohiro> You need to use closure proc when you capture variables inside procedures.↵Any procs can access variables outside procedures. |
19:02:28 | FromDiscord | <Phil> In reply to @demotomohiro "You need to use": Check, that explains why I'm running into issues with norm >_> |
19:06:08 | FromDiscord | <solitudesf> In reply to @threefour "@flyx probably a dumb": is your `type` field exported? |
19:06:13 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#pasty=sKiACsEv |
19:06:43 | FromDiscord | <threefour> Yeah looks like my deserialization setup is wrong, not the backticks. |
19:08:56 | FromDiscord | <threefour> My object model |
19:18:52 | FromDiscord | <threefour> sent a code paste, see https://play.nim-lang.org/#pasty=LatgkudA |
19:19:16 | FromDiscord | <threefour> Where the unknown keys I obviously don't the name of ahead of time. |
19:20:31 | FromDiscord | <threefour> sent a code paste, see https://play.nim-lang.org/#pasty=YYcToXZS |
19:21:35 | FromDiscord | <threefour> Okay nevermind scratch absolutely all of what I said. I got it working. Sorry for spam. |
20:08:31 | * | xet7 quit (Remote host closed the connection) |
20:31:36 | * | xet7 joined #nim |
22:28:00 | * | beholders_eye quit (Ping timeout: 252 seconds) |
22:30:58 | * | beholders_eye joined #nim |
22:48:08 | * | FromDiscord quit (Remote host closed the connection) |
22:48:21 | * | FromDiscord joined #nim |
23:00:03 | * | ntat quit (Quit: Leaving) |