<< 04-08-2023 >>

00:04:45FromDiscord<Elegantbeef> Anonymous files?
00:05:50FromDiscord<spotlightkid> Probably you mean some kind of file upload service?
00:06:34FromDiscord<spotlightkid> If they don't have a published API, you have to resort to reverse engineering.
00:06:55FromDiscord<spotlightkid> If they do, use any Nim http client library.
00:07:53*pbsds quit (Quit: The Lounge - https://thelounge.chat)
00:08:31*pbsds joined #nim
00:11:47FromDiscord<demotomohiro> Anonymous files? Are there file systems that allow creating files without name?
00:14:07FromDiscord<Andreas> prbl. hidden-files ?
00:14:39FromDiscord<Elegantbeef> Who knows until they actually respond
00:14:52FromDiscord<Elegantbeef> We can be here all day throwing darts at the board
00:15:05FromDiscord<Andreas> lets do that..
00:19:17FromDiscord<jakraes> sent a code paste, see https://play.nim-lang.org/#ix=4CiN
00:19:59FromDiscord<Elegantbeef> Nim doesnt have the concept of virtual, so that's fine
00:20:17FromDiscord<nixfreak> hmm , does anyone have atlas in their nimble path ?
00:20:17FromDiscord<Elegantbeef> Ideally you wouldnt use dynamic dispatch but it's easier to pickup and reason than the alternative
00:20:40FromDiscord<nixfreak> all the tools come up accept for atlas
00:20:45FromDiscord<Elegantbeef> From my understanding choosenim doesnt move atlas to where it's supposed to be
00:20:55FromDiscord<nixfreak> (edit) "accept for" => "except"
00:21:06FromDiscord<nixfreak> ahh ok
00:21:21FromDiscord<nixfreak> so just create a symlink I guess
00:21:29FromDiscord<Elegantbeef> Yea
00:22:15FromDiscord<jakraes> In reply to @Elegantbeef "Ideally you wouldnt use": Are there any downsides on that? I'm going to use inheritance so I thought it made sense to use the method keyword instead of proc
00:22:47FromDiscord<Elegantbeef> Well dynamic dispatch has overhead, so that's pretty much it
00:23:29FromDiscord<jakraes> Hmmm, yeah that makes sense
00:24:15FromDiscord<jakraes> What I'm doing isn't going to be very resource heavy so it's not a worry for now
00:24:23FromDiscord<jakraes> But I'll keep that in min
00:24:26FromDiscord<jakraes> (edit) "min" => "mind"
00:29:46FromDiscord<pastor0102> sent a code paste, see https://play.nim-lang.org/#ix=4CiR
00:30:17FromDiscord<Elegantbeef> You want `proc` not method
00:30:21FromDiscord<Elegantbeef> `method` is for dynamic dispatch and inheritance
00:30:33FromDiscord<Elegantbeef> `proc` is statically dispatched and what you want 90% of the time
00:31:39FromDiscord<pastor0102> But this should be a method for the `Property`.
00:31:57FromDiscord<Elegantbeef> Nim doesnt have concept of procedures attached to types
00:32:52FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/kUAMP
00:33:43FromDiscord<nixfreak> nm the atlas dir ~/.choosenim/toolschains/nim2.0.0/tools/atlas is empty
00:34:07FromDiscord<pastor0102> so what is the difference between `proc` and `method`
00:34:16FromDiscord<Elegantbeef> Methods are dynamically dispatched
00:35:32FromDiscord<demotomohiro> Method is something like virtual member function in C++.
00:36:55FromDiscord<pastor0102> Can you give me some examples to let me know when and how to use `method`?
00:37:34FromDiscord<Andreas> `method` when you want Inheritance. Otherwise `proc`
00:38:03FromDiscord<demotomohiro> In reply to @pastor0102 "Can you give me": https://nim-lang.org/docs/manual.html#methods
00:38:18FromDiscord<pastor0102>
00:38:33FromDiscord<Andreas> (edit) "`method` when you want Inheritance. Otherwise `proc` ... " added "or `func`."
00:38:41FromDiscord<Elegantbeef> There you go
00:38:48FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/EDNek
00:39:04FromDiscord<huantian> woah
00:39:15FromDiscord<huantian> is that drug in the family friendly nim discord
00:40:30FromDiscord<Elegantbeef> Your name is almost an anagram for Marihuana
00:44:59FromDiscord<nixfreak> what does base pragma actually do
00:45:05FromDiscord<nixfreak> is it needed ?
00:47:25FromDiscord<Elegantbeef> It tells nim this is the first implementation of the method and to only consider children of this type for dispatch here
00:47:52FromDiscord<Elegantbeef> It also gives a signature for the rest to follow
00:48:09FromDiscord<Elegantbeef> So you can do `method myBase(...){.gcSafe, raises:[], ...}`
00:51:53*lumo_e quit (Quit: Quit)
01:00:34FromDiscord<pastor0102> sent a code paste, see https://play.nim-lang.org/#ix=4CiY
01:03:10FromDiscord<Elegantbeef> It converts it into `A` inside `[]`
01:05:10FromDiscord<Elegantbeef> This is the same sort of logic as `List<object>` in C# or Java if you know those
01:07:59FromDiscord<nixfreak> What scenario would you want to use dynamic dispatch rather then static? Methods in nim are runtime right?
01:08:14FromDiscord<Elegantbeef> Yes
01:09:02FromDiscord<nixfreak> So when would you actually have to use methods if you already know the type?
01:09:27FromDiscord<Elegantbeef> You wouldnt use it unless you want dynamic dispatch
01:10:55FromDiscord<nixfreak> So really no reason to use methods on nim?
01:11:08FromDiscord<nixfreak> (edit) "on" => "in"
01:11:45FromDiscord<Elegantbeef> If you need them
01:12:34FromDiscord<nixfreak> Yeah I’m trying to find a scenario where you would.
01:12:50FromDiscord<jakraes> Inheritance and abstraction I'd say
01:12:54FromDiscord<Elegantbeef> GUI
01:12:55FromDiscord<Elegantbeef> Games
01:12:55FromDiscord<jakraes> That's what I'm using it for at least
01:13:01FromDiscord<Elegantbeef> Places where you have some form of 'type erasure'
01:13:13FromDiscord<Elegantbeef> Eh you can use procs with inheritance if you do not need homogenous collections
01:13:34FromDiscord<Elegantbeef> The issue is mostly homogenous collections
01:13:44FromDiscord<jakraes> Yeah that's true
01:13:57FromDiscord<nixfreak> As in ref objects
01:14:04*lucasta joined #nim
01:14:05FromDiscord<jakraes> I personally enjoy storing almost everything I can in the same seq
01:14:23FromDiscord<jakraes> Instead of spreading it out across multiple seqs
01:14:35FromDiscord<Elegantbeef> Object variants!
01:15:38FromDiscord<jakraes> I might look into that
01:15:40FromDiscord<jakraes> Seems interesting
01:15:58FromDiscord<jakraes> Might find it useful for my current object
01:22:50FromDiscord<nixfreak> So are all object variants runtime objects?
01:28:00FromDiscord<michaelb.eth> In reply to @nixfreak "So are all object": no, e.g. you can have a `const` that's an instance of an object variant
01:30:11FromDiscord<nixfreak> https://nim-lang.org/docs/manual.html#restrictions-on-compileminustime-execution
01:30:41FromDiscord<michaelb.eth> sure, but that doesn't exclude object variants
01:31:09FromDiscord<nixfreak> yeah I know nothing about object varients I need to read up on them
01:31:37FromDiscord<michaelb.eth> object variants have a field (or more than one) that is used to express `case..of`
01:31:59FromDiscord<michaelb.eth> In reply to @nixfreak "yeah I know nothing": https://nim-lang.org/docs/manual.html#types-object-variants
01:39:50FromDiscord<nixfreak> So would you turn a ref object into an object?
01:40:02FromDiscord<nixfreak> (edit) "So ... would" added "why"
01:42:43FromDiscord<Chronos [She/Her]> In reply to @nixfreak "So why would you": Objects can be constants, refs can't, there's some minor overhead with ref objects but that doesn't really matter tbh, data associated with ref objects are always mutable, unlike objects which are only mutable if the actual object is stored in a variable
01:45:09FromDiscord<xtrayambak> I love abusing object variants.
01:45:24FromDiscord<Chronos [She/Her]> I mean you're using them for their intended purpose so, lol
01:45:26FromDiscord<demotomohiro> In reply to @nixfreak "So why would you": https://internet-of-tomohiro.netlify.app/nim/faq.en.html#type-when-to-use-ref-object-vs-plain-object-qmark
01:45:27FromDiscord<Elegantbeef> There isnt really any abusing them
01:46:06FromDiscord<michaelb.eth> if one believes in "shared mutable state is the root of all evil", `ref` and `var` should only be used when there's no other practical choice
01:51:25FromDiscord<Elegantbeef> Such a nice thing you can say that and not have to use `var` for pass by reference
01:56:33FromDiscord<michaelb.eth> hint on the subtle point you're making? 😄
01:59:08FromDiscord<Elegantbeef> Odin, Zig, C, require passing by reference manually so side from the `const` in C the pointer is mutable
01:59:09FromDiscord<Elegantbeef> Actually I'm wrong with Zig
01:59:11FromDiscord<Elegantbeef> It does the same thing as Nim where it decides how to pass
02:02:57FromDiscord<Elegantbeef> The point being made is that if it wasnt for that implicit pass by reference one would need to use `var` more often to reduce copies. That should clear that up
02:04:04NimEventerNew thread by elcritch: CBOR?, see https://forum.nim-lang.org/t/10372
02:16:32FromDiscord<.matrixagent> does this look like gtk https://media.discordapp.net/attachments/371759389889003532/1136845088950075402/image.png
02:17:08FromDiscord<.matrixagent> looks no different from gtk https://media.discordapp.net/attachments/371759389889003532/1136845242755186829/image.png
02:17:23FromDiscord<.matrixagent> wonder if java swing is actually calling native widgets or mocking them like qt
02:19:11FromDiscord<Elegantbeef> > Unlike AWT components, Swing components are not implemented by platform-specific code. Instead, they are written entirely in Java and therefore are platform-independent.
02:19:46FromDiscord<.matrixagent> so they just mock native
02:19:57FromDiscord<.matrixagent> amazing how they can make it look identical like native
02:19:58FromDiscord<Elegantbeef> Seems it might have a theming api and use your gtk theme
02:20:10FromDiscord<.matrixagent> let me try to change some ui colors
02:21:36FromDiscord<.matrixagent> yeah they do change with my ui change
02:22:06FromDiscord<.matrixagent> java swing is truly one of the best ui toolkits created
02:22:10FromDiscord<nixfreak> https://internet-of-tomohiro.netlify.app/nim/faq.en.html#procedures-how-to-define-constructorqmark
02:22:15FromDiscord<.matrixagent> qt is unparalleled ofc
02:23:12FromDiscord<nixfreak> So is Foo compiled time and Bar is runtime?
02:23:49FromDiscord<Elegantbeef> No
02:23:56FromDiscord<Elegantbeef> Foo is stack allocated Bar is heap allocated
02:24:38FromDiscord<nixfreak> Heap allocated because of ref pointer
02:32:18FromDiscord<michaelb.eth> In reply to @.matrixagent "so they just mock": isn't JavaFX the current hotness for UI with Java? you can even style it with CSS
02:32:37FromDiscord<nixfreak> JavaFX is old
02:33:08FromDiscord<michaelb.eth> the original implementation was apparently pretty yucky, but then it was almost completely redone, iirc
02:33:09FromDiscord<nixfreak> Can do the same thing with Qt
02:33:23FromDiscord<michaelb.eth> though maybe the initial impression doomed it
02:33:33FromDiscord<nixfreak> That could be
02:34:27FromDiscord<nixfreak> Is there a compiler option to show if code is executed at runtime or compile time?
02:35:16FromDiscord<nixfreak> -x?
02:35:39FromDiscord<michaelb.eth> sent a long message, see http://ix.io/4Cja
02:35:57FromDiscord<nixfreak> I like nuklear
02:36:45FromDiscord<Elegantbeef> If code is statically executable it's done statically
02:37:02FromDiscord<Elegantbeef> If it has a side effect or requires the host runtime it's done at runtime
02:37:16FromDiscord<michaelb.eth> (edit) "http://ix.io/4Cja" => "http://ix.io/4Cjb"
02:37:20FromDiscord<nixfreak> Just curious if you could actually see it.
02:37:25FromDiscord<Elegantbeef> Nope
02:38:03FromDiscord<demotomohiro> In reply to @nixfreak "Is there a compiler": I don't know such option. Nim generates assembly code with `--asm` so that you can see what is executed at runtime.
02:38:25FromDiscord<Elegantbeef> But not for the entire project
02:38:29FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4Cjc
02:38:50FromDiscord<Elegantbeef> It wouldnt be too hard to modify the compiler to see there's even a nice little `foldconstants` or similar
02:40:01FromDiscord<michaelb.eth> would be cool if Nim's compiler had a global option for dumping out what is transformed at compile-time and what those transform evaluated to at compile-time
02:40:33FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/blob/devel/compiler/semfold.nim#L575 putting an echo inside of here would suffice
02:40:52FromDiscord<Elegantbeef> it'd be so much noise
02:41:51FromDiscord<michaelb.eth> maybe filter-able by module?
02:41:59FromDiscord<michaelb.eth> to reduce the noise, I mean
02:45:37FromDiscord<elegantbeef> Bridge is really silly
02:45:44FromDiscord<elegantbeef> Anyway typical "PRs welcome" 😄
02:50:07FromDiscord<nixfreak> Are there language’s that methods are compiled? Or are all methods executed at runtime
02:50:15FromDiscord<nixfreak> (edit) "runtime" => "runtime?"
02:51:00FromDiscord<Elegantbeef> Someone is asking questions with information they don't understand 😄
02:51:19FromDiscord<michaelb.eth> if the decision-making based on the inputs happens re: data supplied at runtime, then how could the dispatch happen at other than runtime?
02:51:42FromDiscord<Elegantbeef> Methods in Nim are dynamically dispatched, which means the runtime type information is used to call the underling procedures. Methods really are just procedures with a fancy dispatch logic
02:52:34FromDiscord<demotomohiro> If some compiler's optimizer found function/procedure's output can be calculated at compile time, it might do so.
02:52:55FromDiscord<nixfreak> Ok that is where I am getting confused
02:53:39FromDiscord<nixfreak> Cause I polymorphism during compile time checks objects which invokes a method.
02:53:58FromDiscord<nixfreak> (edit) "I" => "with"
02:54:07FromDiscord<Elegantbeef> I really hate the term polymorphism as it's ambiguous what you mean
02:54:11FromDiscord<Elegantbeef> There are multiple forms of it
02:55:49FromDiscord<nixfreak> Ok so at compile time the code understands and checks for the object which invokes a method.
02:56:28FromDiscord<Elegantbeef> At compile time the onlything the compiler knows is "We're invoking a method, use the dispatch table to actually call it"
02:56:57FromDiscord<JJ> the term "method" is usually used to refer to runtime-dispatched functions
02:57:17FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/Uel1v
02:57:31FromDiscord<Elegantbeef> The only reason you need methods is for runtime polymorphism
02:57:44FromDiscord<nixfreak> Ok , sorry for the confusion, I’m not a professional programmer so I was just curious.
02:57:46FromDiscord<Elegantbeef> Where you can have `[A(), B(), C()]`
02:57:55FromDiscord<Elegantbeef> I'm not a professional programmer either, so that's unexcusable
02:57:59FromDiscord<Elegantbeef> 😛
02:58:45FromDiscord<nixfreak> Ok seasoned programmer then. I just write scripts and break things.
02:59:04FromDiscord<Elegantbeef> Where is my favourite point Dexter to say "It's actually inexcusable"
02:59:52FromDiscord<nixfreak> Ok,ok point taken
03:01:52FromDiscord<michaelb.eth> just remembered, was wanting to ask Beef: the work on CPS seems like there was a lot of promise behind it, so was there a melt down due to technical problems, or it was related to some personality conflicts, or a mix of both?
03:02:10FromDiscord<Elegantbeef> Mixture of both afaik
03:02:18FromDiscord<michaelb.eth> I see
03:02:18FromDiscord<Elegantbeef> It works well but there is no way of doing generic continuations
03:02:32FromDiscord<Elegantbeef> Or the last I heard there wasnt
03:02:57FromDiscord<michaelb.eth> generic in the sense of the payload... or...?
03:03:21FromDiscord<Elegantbeef> `proc doThing[T](): Continuation[T]` or w/e the syntax is
03:03:46*kedin joined #nim
03:03:47FromDiscord<Elegantbeef> Due to how Nim's generics are that doesnt work since the macro evaluates on declaration instead of instantiation
03:04:05FromDiscord<Elegantbeef> So they cannot generate the appropriate code
03:04:32FromDiscord<Elegantbeef> They do want to integrate it into cyo/nimskall/denim or whatever they want to call it
03:04:41FromDiscord<Elegantbeef> But as a language feature instead of a macro of course
03:05:45FromDiscord<Elegantbeef> Dis is now using janet though, so any of his Nim packages are likely to bitrot
03:06:03FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4Cje
03:07:02FromDiscord<Elegantbeef> CPS is still more than usable I think termer was using it to some success for their web shite
03:07:20FromDiscord<Elegantbeef> Was it termer, might've been someone else I don't know without proper PFPs names are lost on me
03:07:32termerwho
03:07:34FromDiscord<demotomohiro> It should be `var foo: BaseType = if runtimeFunc(): A() else B()`.
03:07:43FromDiscord<Elegantbeef> Exactly
03:07:45termerI livestreamed working with it
03:07:57FromDiscord<Elegantbeef> Right that was you
03:08:09termerI want to livestream trying to work with that stdio module made for CPS
03:08:22FromDiscord<Elegantbeef> Nim-sys?
03:08:25termeryeah
03:08:32termerI've been doing soul searching and wondering why I'm even using Nim but I did find myself upgrading one of my projects to 2.0.0 this morning
03:08:49FromDiscord<Elegantbeef> There's nothing like it is what I've come to
03:09:14kedini,m sorry to interrupt
03:09:14kedini install the nimx package to try it out..
03:09:15kedinnon of the example code compiled (that,s not the problem)
03:09:15kedini tried to uninstall it out using nimble but it returns [Error: Package not found]
03:09:25kedinit list it just fine tho
03:10:25termerI wanna redo KommandKit with CPS
03:11:05FromDiscord<Elegantbeef> Odd that it's not uninstalling
03:11:44FromDiscord<Elegantbeef> I dumbly am getting the urge to write a fantasy console, too much toying with nimscript
03:11:55termerthat'd be fun
03:12:45FromDiscord<Elegantbeef> Already have nico as the graphics/input, and I've done similar before with my snake example even runs in browser
03:13:25FromDiscord<Elegantbeef> Try a `nimble refresh` followed by a `nimble uninstall nimx` I guess kedin
03:14:13kedinstill no luck
03:14:31FromDiscord<Elegantbeef> Odd, Nimble is just broken it seems 😄
03:14:40kedinwhy tho?
03:14:50FromDiscord<Elegantbeef> No clue
03:15:00FromDiscord<Elegantbeef> I could uninstall a library overhere
03:15:19kedincan i remove it with it,s package and reinstall?
03:15:29kedin*packages
03:16:24FromDiscord<Elegantbeef> You should be able to manually delete it inside `.nimble/pkgs2`
03:17:21FromDiscord<.matrixagent> is there any O(1) search algo?
03:17:50kedinwait...
03:17:51kedini search the directory and it seems that nimx is not install...
03:18:11kedinhowever it,s dependences are
03:18:18FromDiscord<.matrixagent> for example if i have a huge list of sorted elements alphabetically from A to Z and i want to find Banana in the list is there a way to do this in an O(1) fashion?
03:18:32FromDiscord<Elegantbeef> insert adam savage saying "well there's your problem" here
03:18:48FromDiscord<Elegantbeef> You're describing a hashtable 😄
03:19:15FromDiscord<.matrixagent> i really have to learn more data structures lol
03:19:20kedinhow....... why didn,t it install?
03:19:26FromDiscord<Elegantbeef> `std/tables`
03:19:35FromDiscord<Elegantbeef> I don't know I'm not the nimble binary
03:19:39FromDiscord<.matrixagent> hashtable is O(1)?
03:19:44FromDiscord<.matrixagent> in search sorted array
03:19:45FromDiscord<Elegantbeef> yes
03:20:02FromDiscord<Elegantbeef> hashtable is O(1) regardless if sorted
03:20:25FromDiscord<odexine> In reply to @Elegantbeef "Where is my favourite": sorry i was busy
03:20:46FromDiscord<.matrixagent> In reply to @Elegantbeef "hashtable is O(1) regardless": thanks
03:21:25FromDiscord<odexine> btw O(1) doesnt always mean faster than O(log n)
03:22:02FromDiscord<.matrixagent> sure but its constant
03:22:15FromDiscord<.matrixagent> i'd argue a for loop would work if it was unsorted
03:22:20FromDiscord<Elegantbeef> Time complexity really means little
03:22:45FromDiscord<Elegantbeef> Binary search would be even better
03:22:53FromDiscord<odexine> In reply to @.matrixagent "sure but its constant": could be constantly slow, you know
03:23:14FromDiscord<odexine> O(1) just guarantees that the speed will be the same regardless of input size
03:23:14FromDiscord<.matrixagent> In reply to @odexine "could be constantly slow,": still constant
03:23:24FromDiscord<Elegantbeef> lol
03:23:36FromDiscord<.matrixagent> if its a huge list i'd take constant
03:23:36FromDiscord<Elegantbeef> "I use a table instead of an array cause both are constant time"
03:23:43FromDiscord<odexine> and that point where constant is better than logn could be in the millions, way outside the practical range
03:23:55FromDiscord<odexine> In reply to @.matrixagent "if its a huge": huge list could mean millions, as ive said
03:24:00FromDiscord<odexine> and you may never reach that point
03:24:10FromDiscord<monark.chan> How can I include a file in a macro
03:24:48FromDiscord<.matrixagent> In reply to @odexine "huge list could mean": i mean i had an idea of if its sorted i could just start at the index of the char i want
03:25:30FromDiscord<.matrixagent> wouldnt work probably
03:25:40FromDiscord<Elegantbeef> `nnkIncludeStmt.newTree(infix("std", "/", "strutils"))`↵(@monark.chan)
03:26:02FromDiscord<Elegantbeef> If it's sorted you just use binary search and call it a day
03:26:14FromDiscord<monark.chan> Ok ty
03:30:11FromDiscord<user2m> How would I go about calling a python function from my nim code? Nimpy and Nimporter seem to be for calling Nim code in python
03:31:44FromDiscord<.kanaxa> In reply to @user2m "How would I go": Nimpy does allow you to call Python from Nim
03:31:49FromDiscord<odexine> In reply to @.matrixagent "i mean i had": okay so how would you know the index of the first of the character you want
03:31:51FromDiscord<.kanaxa> The bridge works the other way around
03:32:24*kedin quit (Quit: Connection closed)
03:32:33FromDiscord<.matrixagent> In reply to @odexine "okay so how would": nested array
03:32:57FromDiscord<user2m> In reply to @.kanaxa "The bridge works the": Ahh yes u are correct! Just checked out the tests. At first I thought nimpy only allowed u to call built-ins
03:36:51FromDiscord<.matrixagent> In reply to @.matrixagent "nested array": or nested dictionary probably
03:37:37FromDiscord<demotomohiro> HashTable is actually not O(1) as cache memory affects performance.
03:38:20FromDiscord<Elegantbeef> It's O(1)
03:38:21FromDiscord<.matrixagent> the probability that a 100 mb array is in the cache is probably 0
03:38:37FromDiscord<.matrixagent> since no cache has that amount
03:38:41FromDiscord<Elegantbeef> Cache effecting speed does not change time complexity
03:38:55FromDiscord<leorize> it never have to cache the entire thing anyways
03:38:59FromDiscord<Elegantbeef> Time complexity describes the effect length has on the algorithim
03:39:20FromDiscord<Elegantbeef> The length of the table has 0 effect on the complexity of the look up
03:39:41FromDiscord<Elegantbeef> Affect should be somewhere here I think
03:40:18FromDiscord<demotomohiro> If table size was small, most of contents can be placed on 1st cache memory and less likey cache miss happen.
03:40:35FromDiscord<Elegantbeef> Sure but that is not what time complexity is in regards to
03:40:51FromDiscord<Elegantbeef> It's not about actual speed it's about the algorithms theoretical complexity
03:48:03FromDiscord<.matrixagent> sent a code paste, see https://play.nim-lang.org/#ix=4Cjn
03:48:23*lucasta quit (Quit: Leaving)
03:48:23FromDiscord<.matrixagent> i bet the number is just hardcoded in the assembly
03:48:34*ajunior quit (Ping timeout: 260 seconds)
03:49:17FromDiscord<Elegantbeef> 1 million isnt a large set of numbers
03:49:32FromDiscord<leorize> turns out if you have a computer with 4Ghz CPU, it can churn through instructions real fast
03:49:37FromDiscord<demotomohiro> https://godbolt.org/↵It might help you to find out.
03:49:57FromDiscord<Elegantbeef> Especially when it's just anding two integers together 😄
03:50:05FromDiscord<.matrixagent> In reply to @leorize "turns out if you": wow 1 million iterations in near instantly
03:50:14FromDiscord<.matrixagent> or nearly 1 million iterations
03:51:44FromDiscord<.matrixagent> In reply to @Elegantbeef "1 million isnt a": i have a better idea
03:51:49FromDiscord<Elegantbeef> and 1 million allocations
03:51:59FromDiscord<Elegantbeef> Ok not that many, but a lot of them
03:52:07FromDiscord<.matrixagent> In reply to @Elegantbeef "and 1 million allocations": how is it 1 million allocations
03:52:20FromDiscord<.matrixagent> just once for the seq no?
03:52:31FromDiscord<Elegantbeef> you call `.add`
03:52:41FromDiscord<leorize> probably not 1mil
03:52:45FromDiscord<leorize> it does have a growth factor of 1.5
03:52:47FromDiscord<Elegantbeef> Yea it's not 1 mil
03:52:52FromDiscord<Elegantbeef> it's not 1.5 😄
03:52:57*ajunior joined #nim
03:52:59FromDiscord<Elegantbeef> its `len 2 div 3`
03:53:09FromDiscord<.matrixagent> computers are fast
03:53:16FromDiscord<.matrixagent> i wonder how they got electron to work this slow
03:53:36FromDiscord<Elegantbeef> leroize yes that is practically 1.5 times, but it's integer math so it's not exact!
03:56:38FromDiscord<.matrixagent> sent a code paste, see https://play.nim-lang.org/#ix=4Cjs
03:56:39FromDiscord<.matrixagent> its done instantly
03:56:52FromDiscord<.matrixagent> would 1 billion elements make a dent?
04:00:13FromDiscord<.matrixagent> 20 gb of memory just to search from 1 to 1000000000 https://media.discordapp.net/attachments/371759389889003532/1136871185313976381/image.png
04:00:43FromDiscord<leorize> it's just the growth metric of the array
04:00:49FromDiscord<leorize> (and also the allocator used by nim sucks)
04:01:10FromDiscord<.matrixagent> In reply to @leorize "(and also the allocator": damn was just told that the nim allocator is constant
04:01:17FromDiscord<.matrixagent> (edit) "In reply to @leorize "(and also the allocator": damn was just told that the nim allocator is constant ... " added "time complexity"
04:01:45FromDiscord<Elegantbeef> Who said that?
04:01:46FromDiscord<leorize> it's the space-time tradeoff
04:02:02FromDiscord<leorize> and also the algorithm is just really, really old by now
04:02:13FromDiscord<.matrixagent> In reply to @Elegantbeef "Who said that?": you or phil probably
04:02:14FromDiscord<leorize> it didn't see a lot of innovation during it's lifetime
04:02:26FromDiscord<.matrixagent> In reply to @Elegantbeef "Nim's allocator is TLSF": this
04:02:41FromDiscord<leorize> and Nim is like the only project using TSLF-based allocators afaict
04:03:30FromDiscord<.matrixagent> its constant tho
04:03:33FromDiscord<Elegantbeef> I did say inspired
04:03:54FromDiscord<.matrixagent> so wtf is its time complexity
04:04:02FromDiscord<leorize> it's pretty much the exact algo I think
04:04:09FromDiscord<leorize> with a global lock for threading
04:04:28FromDiscord<.matrixagent> why doesnt nim just give every thread its own GC
04:04:30FromDiscord<Elegantbeef> It's modified leo
04:04:41FromDiscord<leorize> it used to
04:04:41FromDiscord<Elegantbeef> Global heap is nicer
04:04:49FromDiscord<leorize> people didn't like it
04:04:59FromDiscord<.matrixagent> so now i can just use threads with the typical worries?
04:05:25FromDiscord<.matrixagent> data races and deadlocks worries without worring about the gc messing anything up?
04:06:28FromDiscord<Elegantbeef> Well sharing data across threads is a chore in that world
04:06:28FromDiscord<Elegantbeef> The present Nim allocator has inspiration from mimalloc and tslf afaik
04:06:28FromDiscord<leorize> it's not like it's less of a chore today \:P
04:06:29FromDiscord<Elegantbeef> It is
04:06:29FromDiscord<Elegantbeef> You can pass data using isolate or directly if you disarm the destructor
04:06:34FromDiscord<leorize> isolate works now?
04:06:41FromDiscord<Elegantbeef> That's what I've been told
04:06:57FromDiscord<Elegantbeef> I do not use multi threading so it's all hearsay for me
04:07:26FromDiscord<.matrixagent> and also why does the allocator lock when i try to allocate something twice at the same time for example one on the main thread and one on the child thread
04:07:33FromDiscord<.matrixagent> or worker thread whatever you wanna call it
04:08:00FromDiscord<.matrixagent> In reply to @Elegantbeef "Well sharing data across": copy
04:08:07FromDiscord<.matrixagent> easy
04:08:10FromDiscord<leorize> turns out it wasn't that well designed \:P
04:08:18FromDiscord<.matrixagent> they say i can replace it
04:08:22FromDiscord<.matrixagent> any suggestions?
04:08:36FromDiscord<leorize> `-d:useMalloc` for a real allocator
04:08:41FromDiscord<leorize> more secure, too
04:08:55FromDiscord<Elegantbeef> mimalloc is probably better
04:08:56FromDiscord<.matrixagent> would it cause problems?
04:08:57FromDiscord<Elegantbeef> malloc is slow leo
04:09:23FromDiscord<leorize> the nice thing about malloc is that you get to replace the implementation
04:09:42FromDiscord<leorize> and every allocator library have a replacement you can link
04:09:43FromDiscord<.matrixagent> In reply to @Elegantbeef "malloc is slow leo": how is malloc slow
04:10:09FromDiscord<Elegantbeef> I think malloc is even slower than stock Nim's
04:10:13FromDiscord<.matrixagent> https://github.com/microsoft/mimalloc
04:10:15FromDiscord<leorize> but if malloc works for you then just use it
04:10:22FromDiscord<.matrixagent> wow unreal even uses it?
04:10:38FromDiscord<.matrixagent> how do i even use it
04:10:46FromDiscord<leorize> it's battle-tested, and usually is hardened against attacks
04:11:44FromDiscord<.matrixagent> In reply to @leorize "but if malloc works": also malloc isnt really slow
04:11:46FromDiscord<.matrixagent> at all
04:13:44FromDiscord<Elegantbeef> Depends on OS, but it can be quite slow
04:13:55FromDiscord<gamedroit> Yea I agree malloc is slow, you are forcing memory to be allocated to a size and this introduces the need to manage that memory directly.
04:13:56FromDiscord<.matrixagent> In reply to @Elegantbeef "Depends on OS, but": in any modern OS malloc is not slow
04:14:07FromDiscord<.matrixagent> this is C
04:14:14FromDiscord<.matrixagent> if its slow it wouldnt have been implemented
04:14:20FromDiscord<Elegantbeef> What?
04:14:27FromDiscord<leorize> you jest
04:14:27FromDiscord<.matrixagent> yes
04:14:46FromDiscord<.matrixagent> simply memory allocation isnt slow anymore
04:15:10FromDiscord<leorize> it's still very slow
04:15:22FromDiscord<Elegantbeef> Malloc is slower than other allocators
04:15:22FromDiscord<leorize> gamedevs don't flock to mimalloc for fun, y'know
04:15:39FromDiscord<leorize> malloc is a little too generic tbf
04:15:55FromDiscord<Elegantbeef> It's also very very eager to return memory afaik
04:15:55FromDiscord<.matrixagent> sent a code paste, see https://play.nim-lang.org/#ix=4Cjx
04:15:56FromDiscord<Elegantbeef> Which is one of the biggest bottlenecks
04:15:56FromDiscord<leorize> glibc's malloc is ok for most usages
04:16:03FromDiscord<.matrixagent> this allocates memory 1000 times in a row and it finishes instantly
04:16:09FromDiscord<Elegantbeef> Ok cool
04:16:22FromDiscord<guzba8> In reply to @.matrixagent "this allocates memory 1000": 🤣 "finishes instantly is not a benchmark
04:16:25FromDiscord<Elegantbeef> Now make a real program with a bunch of allocations then switch to mimalloc
04:16:28FromDiscord<guzba8> (edit) "instantly" => "instantly""
04:16:29FromDiscord<leorize> you do know that a page is 4MiB, right?↵(@.matrixagent)
04:16:32FromDiscord<gamedroit> 😂
04:16:45FromDiscord<.matrixagent> In reply to @Elegantbeef "Now make a real": sure where is it
04:16:49FromDiscord<.matrixagent> how can i get it
04:16:56FromDiscord<Elegantbeef> I give up
04:17:05FromDiscord<gamedroit> Have you ever tried to create an entire large project in C using just malloc?
04:17:18FromDiscord<.matrixagent> millions of projects that are performant use malloc
04:17:29FromDiscord<.matrixagent> from real time apps and everything
04:17:35FromDiscord<Elegantbeef> some people's children
04:17:44FromDiscord<leorize> if you want to benchmark, you really gotta learn how to do it
04:17:57FromDiscord<.matrixagent> you really cannot say malloc is slow when it literally runs the entire infrastructure you see
04:18:07FromDiscord<Elegantbeef> The hell is this argument
04:18:23FromDiscord<Elegantbeef> Good programs hardly allocate so malloc isnt as much of an issue
04:18:31FromDiscord<.matrixagent> In reply to @Elegantbeef "The hell is this": simply if malloc was slow it wouldnt have been in any stdlibs
04:18:41FromDiscord<Elegantbeef> The issue is when programs need to allocate, they need to fetch that memory, and that low time to memory is important
04:18:56FromDiscord<leorize> may I introduce you to Windows
04:19:03FromDiscord<Chronos [She/Her]> Poor code is in stdlibs for basically anything
04:19:05FromDiscord<leorize> where there's a custom malloc in most apps
04:19:08FromDiscord<Elegantbeef> Why would so many people use mimalloc if it wasnt so impactful
04:19:28FromDiscord<Elegantbeef> As leo said glibc malloc is actually very good
04:19:29FromDiscord<leorize> jemalloc is in Chrome, Firefox, Edge
04:19:32FromDiscord<.matrixagent> In reply to @Elegantbeef "Why would so many": optimized for their usage
04:19:33FromDiscord<gamedroit> In reply to @yu.vitaqua.fer.chronos "Poor code is in": There are a lot of things which were also only kept to maintain compatibility
04:19:36FromDiscord<leorize> MS Office doesn't use native malloc either
04:20:05FromDiscord<.matrixagent> the least you can say about malloc is its good enough
04:20:06FromDiscord<Elegantbeef> Yea windows malloc vs. linux malloc is night and day
04:20:17FromDiscord<Elegantbeef> It's an allocator it'd be hard to not be good enough
04:20:27FromDiscord<Elegantbeef> The point is it's slower than other allocators
04:20:34FromDiscord<.matrixagent> and also whos gonna tell them that the operating system gives you memory near instantly 😄
04:20:40FromDiscord<.matrixagent> modern ones at least
04:20:48FromDiscord<Elegantbeef> They don't
04:20:51FromDiscord<.matrixagent> they do
04:20:55FromDiscord<leorize> you can allocate more than your RAM in Linux
04:20:57FromDiscord<Elegantbeef> That's why allocators do not instantly give memory back and sit on it
04:21:00FromDiscord<gamedroit> Just because malloc runs "instantly" doesn't mean it isn't slow compared to the rest, benchmark it and you'll see
04:21:22FromDiscord<Elegantbeef> Requesting memory from the OS is one of the slowest operations you can do
04:21:25FromDiscord<leorize> also, your benchmark is wholly flawed
04:21:32FromDiscord<.matrixagent> In reply to @gamedroit "Just because malloc runs": alright, i hope my benchmark didnt just remove all my code since im not doing anything with it lol
04:21:34FromDiscord<leorize> you don't account how allocators actually allocate
04:21:37FromDiscord<.matrixagent> or anything meaningful
04:21:58FromDiscord<leorize> allocators don't actually allocate the exact amount you told it to
04:22:00FromDiscord<Elegantbeef> Benchmarking an allocator requires a program that realistically allocates like a program would
04:22:07FromDiscord<leorize> they usually allocate in memory pages
04:22:36FromDiscord<Elegantbeef> This does a multitude of things, it gets the pages built, it also sees the behaviour in a place where you have many different size blocks and freeing blocks where memory is returned to the OS
04:22:48FromDiscord<.matrixagent> In reply to @leorize "they usually allocate in": let me just turn off paging
04:22:59FromDiscord<Elegantbeef> They're a troll
04:23:00FromDiscord<leorize> it has nothing to do with paging
04:23:17FromDiscord<.matrixagent> In reply to @Elegantbeef "They're a troll": how am i even trolling my dude
04:23:29FromDiscord<.matrixagent> you cant call somone with a valid opinion a troll
04:23:31FromDiscord<leorize> I think you need to study how computer memory management is done
04:23:43FromDiscord<.matrixagent> i think you need to as well my brother
04:23:52FromDiscord<.matrixagent> OS'es cache memory if you didnt know
04:24:11FromDiscord<.matrixagent> if a program requests it it gets one from the cache memory unless your allocating more than what is cached
04:24:23FromDiscord<.matrixagent> cache as in the os cache not cpu cache
04:24:24FromDiscord<leorize> I think I'm done with this thread
04:24:33FromDiscord<.matrixagent> sure
04:24:39FromDiscord<Elegantbeef> Did I summon you into this leo, if so sorry
04:25:09FromDiscord<leorize> nah, I like discussions about hardware and OS
04:25:51FromDiscord<gamedroit> I give up, if you really want to understand why malloc is slow read this thread:↵↵https://www.linuxquestions.org/questions/programming-9/is-c-malloc-slow-703979/
04:26:36FromDiscord<.matrixagent> i literally just called malloc 1000000 times with a size of 1000 and it finished in 300 ms
04:27:06FromDiscord<.matrixagent> sent a code paste, see https://play.nim-lang.org/#ix=4CjA
04:27:14FromDiscord<.matrixagent> sent a code paste, see https://play.nim-lang.org/#ix=4CjB
04:27:22FromDiscord<leorize> I think you gotta learn about scales
04:27:26FromDiscord<Elegantbeef> Nice, what a realistic benchmark
04:27:28FromDiscord<gamedroit> Cool but this is not a benchmark
04:27:34FromDiscord<.matrixagent> how is it not
04:27:44FromDiscord<.matrixagent> i saw the memory rocket in front of my eyes
04:27:50FromDiscord<.matrixagent> it did call malloc im sure of it
04:28:20FromDiscord<Elegantbeef> It's not a benchmark cause all you did was allocate a bunch of data, there is no realworld approximation
04:28:26FromDiscord<.matrixagent> In reply to @Elegantbeef "It's not a benchmark": so>
04:28:28FromDiscord<.matrixagent> (edit) "so>" => "so?"
04:28:34FromDiscord<Chronos [She/Her]> Because you're not actually doing anything with the memory you're claiming
04:28:35FromDiscord<.matrixagent> we benchmarking malloc here right
04:28:37FromDiscord<Chronos [She/Her]> It's sitting there
04:28:42FromDiscord<Chronos [She/Her]> Doing nothing
04:28:45FromDiscord<.matrixagent> In reply to @yu.vitaqua.fer.chronos "It's sitting there": whats the problem with that
04:28:49FromDiscord<.matrixagent> i did get the memory at the end
04:28:54FromDiscord<Elegantbeef> You're allocating the exact same size over and over again
04:29:06FromDiscord<Chronos [She/Her]> In reply to @.matrixagent "i did get the": A real world scenario wouldn't just do nothing with the memory?
04:29:12FromDiscord<Elegantbeef> You are not allocating different sizes, and forcing the allocator to do any work like would in real life
04:29:19FromDiscord<Elegantbeef> You havent freed any memory
04:29:30FromDiscord<Elegantbeef> You've benchmarked the speed of sequential benchmarks of a fixed size
04:29:30FromDiscord<Elegantbeef> Congrats
04:29:38FromDiscord<Elegantbeef> The most useless allocation profile has been generated
04:29:38FromDiscord<.matrixagent> In reply to @Elegantbeef "You've benchmarked the speed": mhm
04:29:38FromDiscord<gamedroit> Can someone write a simple bench online and send it to him? I'm busy
04:30:29FromDiscord<.matrixagent> so basically what your saying is "i cant believe malloc isnt slow i must prove this guy wrong with no proof"
04:30:49FromDiscord<.matrixagent> unless minmalloc will do the same in 10ms
04:30:52FromDiscord<gamedroit> Btw using your own hardware for comparison is not the best option, the result on your computer and mine may be totally different.
04:30:59FromDiscord<.matrixagent> In reply to @gamedroit "Btw using your own": exactly
04:31:11FromDiscord<.matrixagent> therefore you should also run the same benchmarks when comparing
04:31:34FromDiscord<.matrixagent> im going to try minmalloc with the same benchmark
04:31:40FromDiscord<Chronos [She/Her]> https://github.com/daanx/mimalloc-bench
04:31:45FromDiscord<Chronos [She/Her]> Run benchmarks from here
04:32:00FromDiscord<.matrixagent> In reply to @yu.vitaqua.fer.chronos "Run benchmarks from here": Ok
04:32:02FromDiscord<Chronos [She/Her]> Specifically `sys` and then `mi`
04:32:51FromDiscord<.matrixagent> sent a code paste, see https://play.nim-lang.org/#ix=4CjE
04:32:52FromDiscord<.matrixagent> gotta fix the errors first
04:33:14FromDiscord<Elegantbeef> https://stackoverflow.com/a/2560863/15200657
04:33:15FromDiscord<Elegantbeef> Allocators like anything have performance characteristics, you've benchmarked in my opinion the least important one
04:33:27FromDiscord<Elegantbeef> You can even write your benchmarks then compare directly to mimalloc
04:33:32FromDiscord<Elegantbeef> Without recompiling
04:33:51FromDiscord<.matrixagent> sure i just wanna see if malloc is truly slow or not
04:34:02FromDiscord<leorize> sent a long message, see http://ix.io/4CjG
04:34:14FromDiscord<.matrixagent> my understanding of C it should be as performant as possible so i dont think they would put a slow memory allocator in the stdlbi
04:34:17FromDiscord<.matrixagent> (edit) "stdlbi" => "stdlib"
04:34:19FromDiscord<leorize> some are code, some are descriptions in a design paper
04:34:34FromDiscord<leorize> that's not how C works
04:34:41FromDiscord<leorize> it's never a goal to be performant
04:34:46FromDiscord<leorize> it's performant because of what it is
04:35:29FromDiscord<Elegantbeef> You can have a Nim program faster than C if the C author wrote less intelligent code than the Nim programmer
04:35:39FromDiscord<gamedroit> Since the early days of C, performance has never been the thing they cared about.
04:36:00FromDiscord<Elegantbeef> It's all about writing a slightly higher level asm
04:36:29FromDiscord<leorize> if you ask some die hard gamedevs, they would say they rather write it in ASM to squeeze all the juice out
04:36:49FromDiscord<leorize> luckily compilers aren't so bad anymore and computers are much faster now
04:36:55FromDiscord<leorize> so we can afford some creature comfort
04:37:02FromDiscord<Elegantbeef> I mean I know a dev that is still making sega genesis games using asm 😄
04:37:19FromDiscord<.matrixagent> i mean hand written asm beats C
04:37:27FromDiscord<.matrixagent> if you used the same code
04:37:30FromDiscord<leorize> not neccesarily
04:37:36FromDiscord<.matrixagent> In reply to @leorize "not neccesarily": it does
04:37:44FromDiscord<.matrixagent> assuming you can write performant assembly
04:37:48FromDiscord<Elegantbeef> It depends on the C compiler
04:37:50FromDiscord<gamedroit> In reply to @Elegantbeef "I mean I know": Damn, i'm sorry for him. ASM is a pain just as it must have been back in the day when they used punch cards, the early days of bits.
04:38:02FromDiscord<leorize> that's a big assumption
04:38:04FromDiscord<.matrixagent> and im trying to setup minmalloc
04:38:13FromDiscord<Elegantbeef> He likes making the games using asm
04:38:19FromDiscord<leorize> the knowledge base for "performant" assembly is insane
04:38:48FromDiscord<leorize> you have to understand microarchitectural scheduling and how it reacts so certain memory layout
04:38:58FromDiscord<gamedroit> C code can perform better than assembly if the programmer is good enough.
04:39:00FromDiscord<leorize> as well as how many cycles is performed for a given sequence
04:39:45FromDiscord<leorize> whether pipelined sequence are faster than this simple instructions
04:39:54FromDiscord<leorize> it's a mess
04:41:05FromDiscord<.matrixagent> and also how is one supposed to use minmalloc in ubuntu based distro 😄
04:41:15FromDiscord<leorize> have you installed it?
04:41:15FromDiscord<.matrixagent> i installed the libmimalloc2.0
04:41:19FromDiscord<.matrixagent> via apt
04:41:29FromDiscord<jakraes> Is the noreturn pragma implicit if I do not specify a return type?
04:41:30FromDiscord<leorize> https://github.com/microsoft/mimalloc#dynamic-override-on-linux-bsd
04:41:37FromDiscord<leorize> no
04:41:45FromDiscord<leorize> and it doesn't mean what you think it does
04:42:10FromDiscord<jakraes> If you're saying that then I think you're right xd
04:42:20FromDiscord<jakraes> I assume it just tells the compiler that the proc returns nothing?
04:42:32FromDiscord<leorize> it tells the compiler that the proc doesn't return
04:42:37FromDiscord<.matrixagent> In reply to @leorize "https://github.com/microsoft/mimalloc#dynamic-overr": oh so i can run the same code without recompiling?
04:42:39FromDiscord<.matrixagent> let me try
04:42:55FromDiscord<leorize> like, you get in and never get out
04:43:06FromDiscord<jakraes> Ooooh
04:43:14FromDiscord<leorize> typically used for `exit()` or `quit()`
04:43:26FromDiscord<jakraes> Yup that makes sense, I get what it means now
04:43:30FromDiscord<jakraes> Thank you
04:43:34FromDiscord<.matrixagent> `libmimalloc2.0 is already the newest version (2.0.5+ds-2).`↵`ERROR: ld.so: object '/usr/lib/libmimalloc.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.`↵😄
04:43:47FromDiscord<.matrixagent> i think i need the 2.0 prefix right
04:43:55FromDiscord<.matrixagent> nope
04:44:00FromDiscord<leorize> ls `/usr/lib64/libmimalloc`
04:44:06FromDiscord<leorize> see which file comes up
04:44:19FromDiscord<.matrixagent> sure
04:44:30FromDiscord<.matrixagent> cannot find file
04:45:05FromDiscord<.kanaxa> Shoutout to the Nim docs for being wonderfully concise with its `system` module https://media.discordapp.net/attachments/371759389889003532/1136882476745232405/image.png
04:45:31FromDiscord<leorize> the file is\: /usr/lib/x86\_64-linux-gnu/libmimalloc.so.2↵(@.matrixagent)
04:45:37FromDiscord<leorize> from\: https://packages.ubuntu.com/kinetic/amd64/libmimalloc2.0/filelist
04:45:46FromDiscord<.matrixagent> In reply to @leorize "the file is\: /usr/lib/x86\_64-linux-gnu/libmimallo": alright
04:46:02FromDiscord<.matrixagent> now it compiles
04:46:08FromDiscord<.matrixagent> the moment of truth everyone
04:46:29FromDiscord<.matrixagent> sent a code paste, see https://paste.rs/2Jzbu
04:46:36FromDiscord<.matrixagent> the same benchmark
04:46:43FromDiscord<.matrixagent> i shall try their offical one
04:47:20FromDiscord<leorize> I can write an allocator that's 100x faster if you use your benchmark lol
04:47:38FromDiscord<.matrixagent> what would a fair benchmark look like then
04:47:50FromDiscord<leorize> I linked a bunch earlier
04:47:59FromDiscord<.matrixagent> yep none of them would run
04:48:16FromDiscord<.matrixagent> its probably due to the stupid clang error i keep getting thats why i use gcc
04:48:24FromDiscord<leorize> then you have to figure out what have you done wrong \:P
04:48:48FromDiscord<.matrixagent> the error is pretty much either unfixable or very hard to fix
04:48:57FromDiscord<.matrixagent> been trying for days until i removed clang
04:49:03*ajunior quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
04:49:17FromDiscord<leorize> it's likely you did something wrong, sorry
04:49:30FromDiscord<.matrixagent> probably
04:49:31FromDiscord<leorize> clang compiles 99.9999% of code these days
05:06:03FromDiscord<jordan4ibanez> Hello
05:07:44FromDiscord<demotomohiro> Hello
05:07:59FromDiscord<jordan4ibanez> Ahem
05:08:03FromDiscord<jordan4ibanez> THIS IS AMAZING
05:08:34FromDiscord<jordan4ibanez> Lisp python static typing modula GC and etc all wrapped into one? amazing
05:09:52FromDiscord<.matrixagent> In reply to @jordan4ibanez "Lisp python static typing": agreed im using it in production and its been great
05:10:26FromDiscord<Phil> What kind of operations can you actually do on an import?↵Like if I do `import std/strformat` I can do dot expressions on it to access procs, can I pass `strformat` to a template to check if it defines a given set of procs?
05:10:44FromDiscord<Phil> (edit) "procs, can" => "procs.↵Can"
05:11:09FromDiscord<Phil> (edit) "What kind of operations can you actually do on an import?↵Like if I do `import std/strformat` I can do dot expressions on it to access procs.↵Can I pass `strformat` to" => "sent" | "template to check if it defines a given set of procs?" => "code paste, see https://play.nim-lang.org/#ix=4CjM"
05:11:34FromDiscord<Elegantbeef> You can pass it to a template and check using the when stuff I showed yesterday
05:11:36FromDiscord<Phil> Wait, that should definitely be doable since templates are copy-paste... can namespaces be passed to procs as well?
05:11:55FromDiscord<Elegantbeef> modules can only be used in ambiguity
05:12:01FromDiscord<gamedroit> https://github.com/nim-lang/ui↵↵So, why is this dead since 2021? Not even support for windows was introduced, sad. Is it the contributors' lack of time or was it really abandoned?
05:12:16FromDiscord<Phil> In reply to @Elegantbeef "You *can* pass it": I just woke up, I essentially erased my memory from yesterday, could you give me key words for discord search?
05:12:34FromDiscord<jordan4ibanez> As they say in rust "reached ideal stability, not dead or abandoned"
05:12:45FromDiscord<Elegantbeef> uring exists now if you're interested in libui stuffs
05:12:45FromDiscord<Elegantbeef> `{.error.}`
05:12:47FromDiscord<.matrixagent> In reply to @gamedroit "https://github.com/nim-lang/ui So, why": araq is pretty mad 😄 https://github.com/nim-lang/ui/issues/43
05:13:29FromDiscord<elegantbeef> https://discord.com/channels/371759389889003530/371759389889003532/1136364785169092618 save you a search phil
05:13:40FromDiscord<.matrixagent> @gamedroit https://github.com/neroist/uing this is an updated fork
05:15:30FromDiscord<gamedroit> Native UI so, hm... I think it's cool but incredibly weird at the same time, I would prefer a consistent interface in all systems. Sometimes a change can make the layout messy.
05:15:46FromDiscord<.matrixagent> In reply to @gamedroit "Native UI so, hm...": just use qt
05:20:35FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CjR
05:21:06FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4CjR" => "https://paste.rs/RuH2l"
05:21:18FromDiscord<Elegantbeef> That is a type conversion
05:21:41FromDiscord<Elegantbeef> We can do something cleaner in hindsight
05:21:54FromDiscord<Elegantbeef> https://wandbox.org/permlink/Gyh0lVhtHQkbXWJB hopefully that works
05:21:58FromDiscord<Elegantbeef> I know many people have issue with wandbox links
05:22:37FromDiscord<Phil> Ohhh never seen that with procs before. And since it should be the same proc type that type conversion should essentially do nothing and work and thus confirm that that identifier is of that type
05:23:28FromDiscord<Elegantbeef> Yea that's how you disambiguate an overload
05:24:04FromDiscord<Elegantbeef> The wandbox is better though
05:24:05FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4CjT
05:24:40FromDiscord<Elegantbeef> https://wandbox.org/permlink/og5r77y7QWZDYX6i as this shows it even works for global variables
05:27:55FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CjY
05:28:54FromDiscord<Elegantbeef> `value: SomeFloat`
05:29:08FromDiscord<Phil> Oh fffff it doesn't like generics I take it
05:29:19FromDiscord<Phil> since generics are a lie
05:30:25FromDiscord<Phil> generics not being real truly leads to the meanest limitations
05:31:34FromDiscord<Elegantbeef> Eh easier to just ensure a bunch of statement compiles like concepts do
05:38:10FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Ck3
05:39:15FromDiscord<Phil> It would also be a dream if you could just check if 2 modules fully implement the same procs but for that you'd need to be able to iterate over namespaces which I don't think is feasible
05:39:36FromDiscord<Phil> (edit) "implement" => "provide" | "procs" => "symbols"
05:45:13FromDiscord<Elegantbeef> Araq seems generally opposed to module based programming
05:45:19FromDiscord<Elegantbeef> So best cry about that one
05:54:36FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4Ck8
05:57:05NimEventerNew thread by JohnLuck: Any way to produce Arm64 binaries for MacOS from choosenim versions of nim?, see https://forum.nim-lang.org/t/10373
06:01:16FromDiscord<Phil> In reply to @Elegantbeef "Araq seems generally opposed": I think I can see why, it kinda leads down the path of OO which ultimately will get you very fucking annoyed how somebody built 3 tiny frameworks of highly coupled modules
06:01:25FromDiscord<Phil> (edit) "In reply to @Elegantbeef "Araq seems generally opposed": I think I can see why, it kinda leads down the path of OO which ultimately will get you very fucking annoyed how somebody built 3 tiny frameworks of highly coupled modules ... " added "into your project and now you need to understand those"
06:01:53FromDiscord<Elegantbeef> Eh module based programming results in more reusable code
06:02:02*rockcavera quit (Remote host closed the connection)
06:02:15FromDiscord<Elegantbeef> Want to use a graphics library but use your vectors instead `import gwapiks[TheirVec2: YourVec2]`
06:07:45FromDiscord<Phil> In reply to @Elegantbeef "Here you go phil": Shit, got to head to work, I'll bookmark that link and ask you later
06:12:38*azimut quit (Ping timeout: 240 seconds)
06:21:05*mal`` quit (Quit: Leaving)
06:37:39*ntat joined #nim
06:44:01*mal`` joined #nim
06:53:00FromDiscord<.kanaxa> sent a code paste, see https://play.nim-lang.org/#ix=4Ckp
06:53:11FromDiscord<.kanaxa> (edit) "https://play.nim-lang.org/#ix=4Ckp" => "https://play.nim-lang.org/#ix=4Ckq"
06:53:17FromDiscord<.kanaxa> (edit) "https://play.nim-lang.org/#ix=4Ckq" => "https://play.nim-lang.org/#ix=4Ckr"
06:54:14FromDiscord<Elegantbeef> `(x, y) = (y, res)`
06:54:21FromDiscord<Elegantbeef> Better yet just `swap(x, y)`
06:59:09FromDiscord<Elegantbeef> On second thought that's not just swap
07:00:59FromDiscord<Elegantbeef> @.elcritch\: how goes your fidgetty rewrite?
07:01:34FromDiscord<.kanaxa> In reply to @Elegantbeef "`(x, y) = (y,": Ah I see, missed the parentheses, thank you!
07:02:01FromDiscord<.kanaxa> In reply to @Elegantbeef "Better yet just `swap(x,": Oh man, a swap in-built function, that's sexy
07:08:37FromDiscord<Festive> Any way to execute a .net executable in memory?
07:10:17FromDiscord<.elcritch> In reply to @Elegantbeef "<@703717429230174229>\: how goes your": Itsa going! Just finished splitting up renderer and widget modules. I also got them running on separate threads. They share nodes types, but hoping to split those up next
07:11:29FromDiscord<Elegantbeef> Nice, I've been mostly rewriting the setup code for nimscript interop, calling Nimscript from C and Nim in a single API is interesting
07:13:59FromDiscord<Elegantbeef> In theory I should still have automatic memory management with the Nim interface, but it presently has low level operations(like using cstrings everywhere). Do not like the premise of sharing Nim GC'd types across the DLL barrier
07:16:00FromDiscord<Elegantbeef> Just need to make some macros to generate the VM procs and extract vmargs, and it's in a state one could probably use for the GUI stuff
07:20:34FromDiscord<.kanaxa> sent a code paste, see https://play.nim-lang.org/#ix=4Ckv
07:21:17FromDiscord<Elegantbeef> `var (x, y) = (0, 1)`
07:22:12FromDiscord<.kanaxa> Eh? So the type declaration is unnecessary
07:22:19FromDiscord<.kanaxa> (edit) "Eh? So the type declaration is unnecessary ... " added "with the unpacking?"
07:22:24FromDiscord<.kanaxa> Can it still be done?
07:22:34FromDiscord<Elegantbeef> It's always unnecessary 😄
07:22:39FromDiscord<.kanaxa> Oh wait! Oh yeah
07:22:44FromDiscord<.kanaxa> 0 and 1 are already known types
07:22:45FromDiscord<.kanaxa> Hahahaha
07:23:03FromDiscord<.kanaxa> This is the problem when you're learning new syntax, you forget the basics
07:33:11FromDiscord<.kanaxa> Is there a walrus operator equivalent in Nim?
07:33:31FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Ckx
07:33:33FromDiscord<Elegantbeef> `if (let x = y; x) < x == bleh`
07:35:07FromDiscord<.kanaxa> I'm not sure how to read that line after the `;` semicolon
07:35:14FromDiscord<.kanaxa> Let x =y, ... and what is x then doing?
07:35:26FromDiscord<Elegantbeef> you returning x
07:35:26FromDiscord<.kanaxa> (edit) "x =y," => "`x =y`,"
07:35:30FromDiscord<emanresu3> it's returning x
07:35:30FromDiscord<.kanaxa> Oh!
07:35:32FromDiscord<.kanaxa> I see
07:35:33FromDiscord<Elegantbeef> Nim is expression ful
07:35:40FromDiscord<Elegantbeef> expressionful even
07:35:57FromDiscord<.kanaxa> Implicit returns
07:35:58FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/k7skk
07:36:04FromDiscord<Elegantbeef> No expressionful
07:36:14FromDiscord<Phil> You learned about `result` yet?
07:36:24FromDiscord<.kanaxa> In reply to @isofruit "You learned about `result`": Yeah I think it's quite brilliant
07:36:25FromDiscord<emanresu3> sent a code paste, see https://paste.rs/7LWxQ
07:36:36FromDiscord<.kanaxa> In reply to @Elegantbeef "expressionful even": Never heard of the term 'expressionful' before, learned something today
07:36:59FromDiscord<emanresu3> but it's not exactly like python's walrus
07:37:11FromDiscord<.kanaxa> In reply to @Elegantbeef "`if (let x =": Apparently Araq's also addressed on the walrus operator before: https://forum.nim-lang.org/t/4637#28963
07:37:16FromDiscord<Phil> In reply to @.kanaxa "Yeah I think it's": Some may disagree, just a good idea to keep in mind that an implicitly instantiated `result` variable exists
07:37:19FromDiscord<.kanaxa> (edit) "In reply to @Elegantbeef "`if (let x =": Apparently Araq's also addressed on the walrus operator ... before:" added "Nim equivalent"
07:38:05FromDiscord<demotomohiro> In reply to @.kanaxa "I'm not sure how": https://nim-lang.org/docs/manual.html#statements-and-expressions-statement-list-expression
07:38:06FromDiscord<.kanaxa> Except for strictly procedural functions most of the time you want to compute something from a function anyways, I like the idea of a 'result' variable although I can see how some people might not like it
07:43:18FromDiscord<.kanaxa> Thanks so much guys, appreciate the help
07:47:06*xet7 quit (Remote host closed the connection)
07:49:15FromDiscord<emanresu3> keep in mind that this `x` is only on the `if` scope, not on the `else` unlike python
07:53:14*ntat quit (Quit: leaving)
07:56:08FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CkG
07:56:24FromDiscord<Elegantbeef> `type A = range[1..3] | range[6..8]`
07:56:31FromDiscord<Elegantbeef> It's a limitation of the `..` shorthand
07:57:25FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CkH
07:57:36FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4CkH" => "https://play.nim-lang.org/#ix=4CkI"
07:57:38FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4CkI" => "https://play.nim-lang.org/#ix=4CkJ"
07:57:47FromDiscord<Elegantbeef> Nope
07:58:00FromDiscord<Phil> Then I'm missing something here
07:58:19FromDiscord<Elegantbeef> Generic constraints are not meant for variables or returns
07:58:26FromDiscord<Elegantbeef> Araq's own words
07:58:54FromDiscord<jordan4ibanez> So nim 2.0 automatically can discard cases which do not cover all cases huh? That's pretty neat
07:59:58FromDiscord<Phil> Well at least it narrows down the type to int
08:00:04FromDiscord<Elegantbeef> "discard cases"
08:00:34FromDiscord<jordan4ibanez> Oh that's pretty neat, but it's only working for string switches hmm
08:02:25FromDiscord<Elegantbeef> Don't even know what you mean
08:02:59FromDiscord<jordan4ibanez> sent a code paste, see https://play.nim-lang.org/#ix=4CkL
08:03:19FromDiscord<jordan4ibanez> now let's be....frank here and observe the no discard on the first one :P
08:03:37FromDiscord<Elegantbeef> Sure, string cases are not exhaustive
08:03:48FromDiscord<Elegantbeef> Cause it's technologically impossible to be exhaustive
08:04:46FromDiscord<jordan4ibanez> Hmmm, perhaps since this is compiled to C intermediately this could be optional to need to discard, an automatic discard? I dunno just throwing out ideas
08:05:08FromDiscord<jordan4ibanez> "Automatic exhaustion by default"
08:05:17FromDiscord<Elegantbeef> Ordinal case statements are exhaustive for good reason
08:05:24FromDiscord<jordan4ibanez> Kind of like the final switch statement in D
08:05:48FromDiscord<Elegantbeef> You don't even need to discard
08:05:59FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4CkM
08:06:02FromDiscord<Elegantbeef> Literally any ast inside else works
08:06:44FromDiscord<jordan4ibanez> I'm not trying to fight about it, just seems like a little thing
08:07:44FromDiscord<Phil> I am, fite me!↵Use an enum instead!
08:07:53FromDiscord<jordan4ibanez> Hmm
08:10:17FromDiscord<Phil> There are usecases for switch over string if in general you want to be able to handle all strings ever but a clearly defined subset of those trigger something special on the side
08:10:52FromDiscord<Phil> But generally I'd say an enum transformation somewhere is necessary
08:11:06FromDiscord<jordan4ibanez> That's true
08:11:27FromDiscord<jordan4ibanez> Quite interesting so far, not used to indentation as scope, but getting there
08:18:08FromDiscord<jordan4ibanez> It's...very strangely readable, I like it
08:22:57FromDiscord<.kanaxa> sent a code paste, see https://play.nim-lang.org/#ix=4CkP
08:23:19FromDiscord<.kanaxa> (edit) "https://play.nim-lang.org/#ix=4CkP" => "https://play.nim-lang.org/#ix=4CkQ"
08:23:53FromDiscord<griffith1deadly> In reply to @.kanaxa "I'm attempting to benchmark": use monotime for benchmarking
08:27:00FromDiscord<Phil> In reply to @.kanaxa "I'm attempting to benchmark": For simple benchmarking, use benchy
08:27:02FromDiscord<griffith1deadly> sent a code paste, see https://play.nim-lang.org/#ix=4CkR
08:27:15FromDiscord<Phil> You can call python code from within nim via nimpy
08:27:56FromDiscord<Phil> Oh wait, I need to read better, bit difficult while mid meeting
08:35:19FromDiscord<Phil> Anyway, here's the benchy package:↵https://github.com/treeform/benchy
08:50:01FromDiscord<Festive> How do I ask for input in nim
08:55:33FromDiscord<Festive> How do I use ansi color does?
08:56:00Amun-Rastd/terminal
09:00:53FromDiscord<.kanaxa> sent a code paste, see https://play.nim-lang.org/#ix=4CkZ
09:01:02FromDiscord<.kanaxa> But why is a template used here over a function? Any serious benefits?
09:01:18FromDiscord<.kanaxa> (edit) "https://play.nim-lang.org/#ix=4CkZ" => "https://play.nim-lang.org/#ix=4Cl0"
09:01:33FromDiscord<enthus1ast> about atlas, when you use choosenim, it should be (copied?) to the nimble path or ?
09:01:33FromDiscord<.kanaxa> In reply to @isofruit "For simple benchmarking, use": Thanks for the recommendation! Will look to try it now
09:01:56FromDiscord<enthus1ast> this is how choosenim seems to operate or?
09:02:09FromDiscord<enthus1ast> at least it does so for the compiler
09:03:06FromDiscord<griffith1deadly> sent a code paste, see https://play.nim-lang.org/#ix=4Cl1
09:06:16FromDiscord<enthus1ast> i've created a symlink for now
09:11:06FromDiscord<ringabout> In reply to @enthus1ast "i've created a symlink": Yeah, choosenim needs a patch.
09:16:25FromDiscord<.kanaxa> sent a code paste, see https://play.nim-lang.org/#ix=4Cl6
09:17:29FromDiscord<.kanaxa> sent a code paste, see https://play.nim-lang.org/#ix=4Cl7
09:18:54FromDiscord<enthus1ast> mhh, it seems that atlas also has no concept of develop projects, it clones them and puts the cloned path in the nim.cfg, BUT one can add the packages manually on the nim path
09:34:40FromDiscord<Phil> In reply to @.kanaxa "Might ask a few": "untyped" basically means that you can put entire code-blocks into that template. Those require untyped.
09:35:17FromDiscord<Phil> You could of course also have accepted a closure that executes the given functions and then you execute that closure in the loop, but that might bring other limitations with it.
09:35:53*FromDiscord quit (Remote host closed the connection)
09:36:06*FromDiscord joined #nim
09:36:23FromDiscord<Phil> Notably the template approach is just way nicer to read
09:38:04NimEventerNew thread by nealie: Trouble Porting to FreeBSD, see https://forum.nim-lang.org/t/10374
09:57:02*ntat joined #nim
10:31:23FromDiscord<.kanaxa> In reply to @isofruit "You could of course": Ahh I see! Thank you
10:31:27FromDiscord<.kanaxa> A bit clearer now
10:32:17FromDiscord<Phil> In reply to @.kanaxa "Ahh I see! Thank": You might know something like context managers in python
10:32:25FromDiscord<Phil> Templates make writing your own types of context managers completely trivial
10:32:56FromDiscord<Phil> Just accept an untyped body parameter, add whatever code you want to execute before/after said body, then write "body", done
10:42:40FromDiscord<jordan4ibanez> Wow, I actually managed to do the tutorial, it's an actual miracle. BEHOLD, my garbage https://pastecode.io/s/rcqw3ggq
10:43:52FromDiscord<jordan4ibanez> I have no idea what to do with it, bleh
10:48:44FromDiscord<.kanaxa> In reply to @isofruit "Templates make writing your": My understanding of context managers was principally for handling scope, and making setup/teardown simpler
10:48:57FromDiscord<jordan4ibanez> I'm not even done yet though, I'll have to have a quick look out the mirror, dramatically, before I continue
10:48:57FromDiscord<.kanaxa> Didn't quite see it from that angle, I thought templates were copy-pasted by the compiler
10:50:14FromDiscord<Phil> In reply to @.kanaxa "Didn't quite see it": They are, that's why they're great for creating context managers and more
10:51:02FromDiscord<Phil> sent a long message, see http://ix.io/4Cli
10:52:07FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Clk
10:52:21FromDiscord<Phil> Connection is fetched from and automatically returned to the pool
10:52:34FromDiscord<.kanaxa> Hmmm.... interestinggg
10:52:49FromDiscord<.kanaxa> But wouldn't a function here do essentially the same thing?
10:52:50FromDiscord<Phil> Templates have far more usecases of course, but this is just one where they really shine
10:53:01FromDiscord<Phil> Only if you desperately want to deal with closures and I for one do not
10:53:07FromDiscord<.kanaxa> I can see how it's used
10:53:09FromDiscord<.kanaxa> Ah I see
10:53:12FromDiscord<.kanaxa> To avoid closures
10:53:15FromDiscord<.kanaxa> I see, I see
10:53:31FromDiscord<.kanaxa> Why do you like passing closures?
10:53:35FromDiscord<.kanaxa> (edit) "like" => "dislike"
10:53:53FromDiscord<.kanaxa> Am curious
10:54:01FromDiscord<.kanaxa> I don't think it adds too much complexity
10:54:15FromDiscord<Phil> Because a closure is not just a callback function, it is also the environment that the callback function captures.↵And that can make things messy in terms of dealing with anything when you do more compile time and meta-programm-y stuff
10:54:20FromDiscord<Phil> At least for the way I do it
10:54:30FromDiscord<.kanaxa> Mmm, I see - I haven't dealt with any serious metaprogramming yet
10:54:44FromDiscord<.kanaxa> (edit) "Mmm, I see - I haven't dealt with any serious metaprogramming ... yet" added "yet, so I'm not too wise on the drawbacks"
10:55:09FromDiscord<Phil> It's not that closures are horrible or anything, it's just that templates are in my opinion far easier on the eyes and the mental model of "copy paste this thing in here" is not hard to deal with
10:55:30FromDiscord<.kanaxa> I'm with you on that one, anything that easens my mental model is a winner
10:55:43FromDiscord<.kanaxa> I just need to do more exercises on the templates stuff first to get a hang of it
10:56:11FromDiscord<Phil> completely fair
10:56:25FromDiscord<Phil> Though for reference, generics are stripped down templates in a sense, because just like templates, they aren't real
10:56:36FromDiscord<Phil> They generate code where you call them, but they are not code themselves
10:57:16FromDiscord<Phil> If you call a generic with 3 different types, what you'll end up having is the same proc defined 3 times for those 3 types
10:59:25FromDiscord<Phil> ~~They are like cake in that regard: Filthy liars that make doing any kind of mocking with them nigh impossible~~
11:15:44FromDiscord<frobnicate> Do you guys have nim v2 in your docker image? I can't seem to get it to work
11:16:01*jmd_ quit (Ping timeout: 260 seconds)
11:17:48FromDiscord<Phil> Not yet, haven't done any deployments since nimv2 came out.↵Could ask @moigagoo
11:18:09FromDiscord<frobnicate> That makes more sense then. I thought I was being stupid again
11:26:44FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4Clu
11:34:41FromDiscord<frobnicate> Is there any way I can help with the tooling?
11:39:31FromDiscord<frobnicate> I use Nim mostly for the easier workflow than something like C++ so I wouldn't mind helping with the tools
11:45:21FromDiscord<.kanaxa> In reply to @isofruit "~~They are like cake": How DARE you accuse cakse
11:45:23FromDiscord<.kanaxa> (edit) "cakse" => "cakes"
11:45:28FromDiscord<.kanaxa> The cake is not a lie
11:45:45FromDiscord<Phil> In reply to @.kanaxa "The cake is *not*": You say that, yet I don't see you with a cake in hand
11:46:16FromDiscord<.kanaxa> This was a triumph. I'm making a note here: HUGE SUCCESS
11:46:40FromDiscord<.kanaxa> Gotta quickly stop before I go offtopic haha
11:50:24FromDiscord<enthus1ast> @frobnicate maybe have a look how the old nimble develop used to work and why nimble develop -g does not work the same
11:50:50FromDiscord<frobnicate> thanks
11:51:00FromDiscord<enthus1ast> if i have some time i'll also look at it
12:00:02FromDiscord<jordan4ibanez> So when is nim 3 coming?
12:00:07FromDiscord<jordan4ibanez> Nah I'm just kidding
12:14:05*lucasta joined #nim
12:23:58*disso-peach joined #nim
12:26:13FromDiscord<Phil> In reply to @jordan4ibanez "So when is nim": Next week right after my workplace realizes that STOMP is not a sensible messaging protocol to build a chat application around
12:36:55FromDiscord<jordan4ibanez> So next year?
12:39:01FromDiscord<Phil> God damn you're even more optimistic than your profile picture lead me to believe
13:11:53FromDiscord<terrygillis> how does `ref` types behave in the js backend? how does nim stack objects get translated to js?
13:14:03FromDiscord<Phil> In reply to @Elegantbeef "Here you go phil": Ah so basically you don't check if a symbol with a given type is present, you check if a symbol can be executed that would deliver the desired results. aka whether that compiles
13:14:18FromDiscord<bung8954> In reply to @terrygillis "how does `ref` types": refers to an array element
13:17:04FromDiscord<terrygillis> if stack object would be translated to array, then what would `ref object` be translated to?
13:23:49FromDiscord<Chronos [She/Her]> In reply to @terrygillis "if stack object would": Array and index of value in array
13:24:17*ntat quit (Quit: leaving)
13:32:41*ajunior joined #nim
13:47:09FromDiscord<Phil> Were the docs for the macro module always this good?↵https://nim-lang.org/docs/macros.html#callsslashexpressions-command-call
13:47:32FromDiscord<Phil> Like having examples of the AST for each kind of expression etc.?
13:50:33*azimut joined #nim
13:52:06FromDiscord<Phil> Turns out it was and I was just an imbecile
14:02:34FromDiscord<frobnicate> In reply to @isofruit "Turns out it was": That's me daily
14:03:30FromDiscord<Phil> You can't do a varargs with typedesc's right?
14:03:48FromDiscord<Phil> Like I want to have a proc that the User can give various different types as parameters
14:03:58FromDiscord<Phil> And I kinda don't want to care about the number of types
14:04:44FromDiscord<Phil> Like I'd want to handle ↵`proc x(FirstType, SecondType)`↵via the same proc as ↵`proc x(FirstType, SecondType, ThirdType, FourthType)`
14:21:15FromDiscord<frobnicate> You can't coerce them into a parent type and then back to the inherited one based on a type field? In case you want to have different types but the same definition
14:21:32FromDiscord<frobnicate> Or am I misunderstanding
14:21:46FromDiscord<Phil> Nah, pretty much, I'd want to have a list of types in either a proc, a template or a macro
14:21:55FromDiscord<Phil> And I keep forgetting that I can't have that
14:23:09FromDiscord<frobnicate> Types are compile time, right?
14:23:35FromDiscord<Phil> compile-time only
14:23:58FromDiscord<frobnicate> So you'd need an alias or key for each type
14:24:05FromDiscord<frobnicate> And look them up in a table
14:25:44FromDiscord<frobnicate> I'm not sure what the practical solution is there, but that seems like the most straightforward solution
14:26:57FromDiscord<Phil> It's basically I myself don't really care all that much about the types, I just need them to generate a proc definition that has variables with those types in order
14:27:17FromDiscord<Phil> The actual "obj.field.innerField" expressions etc. I generate via macros from strings
14:27:23FromDiscord<Phil> (edit) "strings" => "strings, no types needed"
14:27:41FromDiscord<frobnicate> You lost me. Sounds smart. Good luck
14:27:50FromDiscord<Phil> Ever used MapStruct?
14:28:02FromDiscord<frobnicate> Like a map in general? Yeah
14:28:20FromDiscord<Phil> Nah, not a map, something that generates you mapping functions to map an instance of type A to type B
14:28:27FromDiscord<Phil> So that you don't have to type all of the tedious crap out by hand
14:28:27FromDiscord<frobnicate> Oh
14:28:34FromDiscord<frobnicate> Yeah I've used that, unfortunately
14:28:52FromDiscord<frobnicate> They are a nightmare to maintain
14:29:00FromDiscord<Phil> Hmmm
14:29:34FromDiscord<Phil> But writing map procs to transform↵`User` to `UserDTO` to get rid of the fields you don't want to expose to the outside is so annoying =/
14:30:31FromDiscord<frobnicate> I mean mapping objects to each other in general is annoying. It's just most of my job is maintaining code and fixing bugs and mappers aren't always that reader friendly
14:34:08*disso-peach quit (Quit: Leaving)
14:40:51FromDiscord<ieltan> How tf do I await a template that returns a Future[T] ? I got it working before but now it somehow blows up
14:42:53FromDiscord<ieltan> ughhh it litteraly worked an hour ago how does it magically stop working now
14:46:13FromDiscord<ieltan> 😸 nvm i got it working again
14:54:33FromDiscord<ieltan> Await error msgs are the most unhelpful thing, it took me ages to realize I had forgot an `await` and I get the most confusing message "await expects Future[T], got void", coming from `asyncmacro` a module that I didn't even know existed and didn't even import
14:54:56FromDiscord<ieltan> Hope CPS or whatever will replace current async will make this better
15:05:01*smallfoot- joined #nim
15:05:09smallfoot-What is the difference between:
15:05:26smallfoot-type Foo* = float
15:05:27smallfoot-and
15:05:29smallfoot-type Foo = float
15:07:31FromDiscord<spotlightkid> The asterisk exports symbols to be available outside of the module they are in.
15:08:40smallfoot-oh okay, so its like "pub type Foo" instead of "private type Foo" in another language?
15:09:57FromDiscord<neroist.> uhm, sure
15:10:40FromDiscord<neroist.> marks it public, same with vars and procs
15:10:59FromDiscord<neroist.> (edit) "" => "``"
15:11:49FromDiscord<spotlightkid> https://nim-lang.org/docs/manual.html#modules
15:12:17smallfoot-oh, that is very confusing and non-intuitive
15:12:53FromDiscord<nervecenter> Not really. When you import another module, the things that are available are anything in that module with a
15:12:55FromDiscord<nervecenter> pretty simple
15:13:59smallfoot-* could as well be ? or ^ or _ or [, it really says nothing
15:14:05smallfoot-would make much more sense to have "pub" or "public"
15:14:46FromDiscord<spotlightkid> But its meaning is not "public". It's "this is exported".
15:15:18FromDiscord<spotlightkid> Sort of like the opposite of the leading underscore in Python.
15:17:43smallfoot-but public and exported are the same thing?
15:20:45*ntat joined #nim
15:20:52FromDiscord<nervecenter> public and private are holdovers of oop and can have other meanings, "export" is much more explicit
15:20:56FromDiscord<odexine> i mean you can say that for a lot of operators, the only thing justifying other operators being popularity
15:21:09FromDiscord<spotlightkid> No, public has additional meaning and implications in e.g. C++. Using this term would only lead to confusion.
15:21:19FromDiscord<odexine> that oh theres no reason for the indexing operator to be `a[i]` and not `a indexed by i`
15:21:39FromDiscord<spotlightkid> brevity?
15:21:53FromDiscord<nervecenter> is brief
15:22:00FromDiscord<nervecenter> (edit) "" => "``"
15:24:15smallfoot-yeah but popularity is valid, then user have their expectations
15:24:30smallfoot-sounds like "export" would make much more sense than asterisk *
15:24:55FromDiscord<spotlightkid> but wrong expectations, like in the case of "public" can be a problem too.
15:26:24FromDiscord<odexine> In reply to @smallfoot- "yeah but popularity is": how else would certain strange operators become popular if not for use in a language that then becomes popular
15:26:32FromDiscord<odexine> example: `::<>`
15:26:35FromDiscord<odexine> x d
15:26:51FromDiscord<spotlightkid> otoh, you could always, like, just read the documentation.
15:26:52FromDiscord<odexine> arguable that it is a derivative of `<>` from C
15:26:54FromDiscord<odexine> (edit) "C" => "C++"
15:28:16FromDiscord<nervecenter> In reply to @smallfoot- "sounds like "export" would": You'd have an aneurysm if you ever tried a Lisp
15:28:39FromDiscord<odexine> lol
15:29:20FromDiscord<ieltan> sent a code paste, see https://play.nim-lang.org/#ix=4CmO
15:29:23smallfoot-yeah, I would, Lisp, ugly
15:29:52FromDiscord<nervecenter> Welp.
15:30:27FromDiscord<ieltan> Syntax is the least important aspect of a programming language, or so they say
15:31:28FromDiscord<ieltan> I kinda stick with Nim because I like the syntax compared to Python and it can be as fast as C and it's strongly, statically typed
15:32:04FromDiscord<nervecenter> In reply to @ieltan "Syntax is the least": I like to say that syntax is important, because it can enable certain paradigms and modeling styles, but that bikeshedding syntax is a waste of time. For example disliking Lisp because "ugly" and "parens" is closing yourself off to such a powerful programming paradigm that there is a threshold of ability you will never ever cross, because of dumb aesthetic concerns.
15:32:30FromDiscord<ieltan> I really, really, really freaking hate the `thingy`
15:32:37FromDiscord<ieltan> In python
15:32:59FromDiscord<nervecenter> (edit) "example" => "example," | "ability" => "skill, ability, and understanding"
15:35:26FromDiscord<ieltan> In reply to @nervecenter "I like to say": That's true, I even just said that I like Nim better than Python because of the syntax, and a lot of language features will influence the syntax that people will use so it kinds of contradicts this famous proverb 😅
15:36:02FromDiscord<ieltan> At the end ymmv
15:45:53*rockcavera joined #nim
15:46:27FromDiscord<.kanaxa> In reply to @ieltan "I really, really, really": Really? I quite like the appearance of Python's 'magic' methods
15:46:36FromDiscord<.kanaxa> (edit) "methods" => "methods, haha"
15:53:34FromDiscord<_gumbercules> The asterisk for export is a holdover from Oberon
15:55:34FromDiscord<_gumbercules> And fwiw I much prefer having to type `` next to an object field than something like `pub` , `public`, `extern` or `export`.
16:01:10FromDiscord<bung8954> `var b: array['a', int]` does this make sense ?
16:05:42FromDiscord<_gumbercules> In reply to @bung8954 "`var b: array['a', int]`": Yes https://play.nim-lang.org/#ix=4Cn5
16:06:53FromDiscord<_gumbercules> I'm not sure how it's arriving at 256 for the length though - probably because it's casting it to an `int8` or something
16:07:00FromDiscord<bung8954> if you try `var b: array['a', int] = [1]` you get `Error: type mismatch: got <array[0..0, int]> but expected 'array[char, int]'`
16:07:13FromDiscord<_gumbercules> oh weird
16:07:24FromDiscord<_gumbercules> (edit) removed "- probably because it's casting it to an `int8` or something"
16:07:37FromDiscord<_gumbercules> oh well that makes a bit of sense
16:07:50FromDiscord<_gumbercules> because `var b: array['a', int] ` is going to be an array with a lenght of 256 apparently
16:07:56FromDiscord<_gumbercules> but the error message makes no sense
16:08:03FromDiscord<_gumbercules> sounds like a bug
16:08:03FromDiscord<bung8954> looks like it accept many invalid
16:08:50FromDiscord<bung8954> no it will not have 256 length, it should be char or 'a' ..'z' if use char as index
16:09:13FromDiscord<_gumbercules> sent a code paste, see https://play.nim-lang.org/#ix=4Cn6
16:09:15FromDiscord<_gumbercules> compiles fine
16:09:20FromDiscord<_gumbercules> I think I get what's going on
16:09:30FromDiscord<_gumbercules> char is 0-255
16:09:43FromDiscord<_gumbercules> that's why the length of `b` is `256`
16:10:23FromDiscord<_gumbercules> arrays can have an index of different types - it doesn't necessarily have to be an `int` - I'm not sure what all the supported types are but apparently `char` is supported
16:13:40FromDiscord<arathanis> anyone got some tips for compiling Nim to a static lib and linking it to C++ compiled under visual studio? linker complaining about undefined symbols, works fine w/ g++
16:17:01FromDiscord<spotlightkid> then you probably got the linker flags wrong in VC
16:18:11FromDiscord<arathanis> are there special linker flags needed? When using g++ and an example application there is no problem. Just need the flags for linking the library.
16:19:50FromDiscord<bung8954> In reply to @_gumbercules "arrays can have an": it could be easier for compile that reject these literals as index.
16:22:15FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Cna
16:23:27FromDiscord<Phil> It should be noted that the value `fieldName` I will get from iterating over a type at compiletime via `fieldPairs` iterator and `sourceDotExpression` is a static string provided by the user
16:26:50*smallfoot- quit (Quit: Leaving)
16:31:08*lucasta quit (Quit: Leaving)
16:36:27Amun-Rathe topic needs a slight update (Latest version)
16:48:12*mIRC-rockcavera joined #nim
16:48:37*mIRC-rockcavera left #nim (#nim)
16:52:28FromDiscord<srmordred> sent a code paste, see https://play.nim-lang.org/#ix=4Cnh
16:52:47FromDiscord<srmordred> (edit) "https://play.nim-lang.org/#ix=4Cnh" => "https://play.nim-lang.org/#ix=4Cni"
16:55:57FromDiscord<_gumbercules> In reply to @bung8954 "it could be easier": might be... I can't think of many places it'd be useful over just using numerical indices but 🤷 maybe there's a reason it works this way
16:56:07FromDiscord<_gumbercules> probably a good question for #internals
16:59:10*jmdaemon joined #nim
17:10:46FromDiscord<odexine> In reply to @srmordred "the `*` vs `pub`": honestly i can see how someone would be super confused seeing that
17:10:57FromDiscord<odexine> and also field order is important in nim
17:11:01FromDiscord<odexine> memory layout
17:19:40FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4Cnq
17:21:30FromDiscord<Phil> ?!, I thought int by default was 64 bit, how are those numbers coming about?↵Should that be↵8 + 1 + 8 + 1 = 18 in both cases?
17:21:40FromDiscord<Phil> (edit) "?!, I thought int ... by" added "and float were" | removed "was"
17:22:01FromDiscord<Phil> (edit) "?!, I thought int and float were by default 64 bit, how are those numbers coming about?↵Should that be↵8 ... +Byte" added "Byte" | "Byte+ 1 ... +Byte" added "Byte" | "+ 1Byte+ 8 ... +Byte" added "Byte" | "+ 1Byte+ 8Byte+ 1 ... =Byte" added "Byte" | "+ 1Byte+ 8Byte+ 1Byte= 18 ... in" added "Byte"
17:22:51FromDiscord<nervecenter> In reply to @odexine "and also field order": Wouldn't the Nim compiler optimize this anyways though?
17:22:57FromDiscord<odexine> ?
17:23:03FromDiscord<odexine> the nim compiler does not reorganise fields
17:23:11FromDiscord<Phil> Ohh wait it might be allocating in fixed increments or sth and thus there may be some dead bytes in there
17:23:22FromDiscord<nervecenter> That seems like an easy performance win left on the table
17:23:37FromDiscord<odexine> no, because memory order can be important
17:23:59FromDiscord<odexine> it would prolly be a win if you mark the object or the fields as reorganisable sure ig
17:24:12FromDiscord<nervecenter> In specific scenarios, at which point order and alignment should probably be explicitly specified
17:24:23FromDiscord<nervecenter> But automatic regorg of field seems like it'd be a good default
17:24:32FromDiscord<nervecenter> (edit) "field" => "fields"
17:26:00FromDiscord<Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4Cns
17:26:49FromDiscord<odexine> i dont recall what the details of padding are but iirc its related to time-performance
17:26:56FromDiscord<odexine> time-space tradeoff thing
17:27:37FromDiscord<odexine> accessing a misaligned 64-bit field is expensive compared to masking 8-bit fields
17:29:14FromDiscord<demotomohiro> https://en.wikipedia.org/wiki/Data_structure_alignment
17:31:58FromDiscord<demotomohiro> When you wrap C libraries, order of fields in object type must match to corresponding C structure type.
17:38:53FromDiscord<srmordred> sent a code paste, see https://play.nim-lang.org/#ix=4Cnx
17:40:18FromDiscord<odexine> that's not what i mean
17:40:34FromDiscord<odexine> i mean that it would be more ergonomic to have instead of public because of that
17:41:13FromDiscord<odexine> sent a code paste, see https://play.nim-lang.org/#ix=4Cnz
17:41:39FromDiscord<odexine> because they have to keep the memory layout the same for the start or break ABI
17:42:01FromDiscord<odexine> also why they have reserved fields sometimes
17:42:11*ajunior quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
17:43:08FromDiscord<odexine> i do wonder though, it isn't a bad idea
17:43:24FromDiscord<odexine> i'm just thinking maybe theres a better way \to implement this
17:43:27FromDiscord<odexine> (edit) "\to" => "to"
17:43:40FromDiscord<srmordred> sent a code paste, see https://play.nim-lang.org/#ix=4CnA
17:46:35FromDiscord<juan_carlos> `include` the file and everything is like public.
17:47:10FromDiscord<odexine> or use importutils
17:47:17FromDiscord<odexine> but thats janky
17:47:38FromDiscord<juan_carlos> Macro that generates `export foo, bar, baz`
17:48:01FromDiscord<srmordred> In reply to @juan_carlos "`include` the file and": oh, I completely forgot about this. ↵this may be enough ^^
17:56:01FromDiscord<odexine> there are caveats to that
18:00:49*attah quit (Quit: ZNC 1.7.5+deb4 - https://znc.in)
18:05:36*attah joined #nim
18:20:16FromDiscord<Phil> I'm looking at micros and it looks nice, but are there any docs beyond the readme of what is all in there?
18:20:26FromDiscord<Phil> Wait, this is a beef lib, what am I expecting
18:23:06FromDiscord<bostonboston> Can Nim import from a .lib
18:27:34*ntat quit (Quit: leaving)
18:30:03FromDiscord<demotomohiro> Importing C functions from .lib is almost same to importing from .c.
18:30:46*ajunior joined #nim
18:37:25FromDiscord<Phil> Okay when a macro auto-converts all the input parameter into Nimnode, how do I get the actual contents of them back?↵I pass one of my macros a `seq[MyType]` and I would like to flipping access the contents
18:37:53FromDiscord<Phil> Which is a smidgeon hard when the compiler just goes "Well that's a NimNode, you can't access your type's field on that"
18:43:02FromDiscord<demotomohiro> You can pass values to a macro like `macro foo(x: static[string])` but the argument must be const.
18:43:42FromDiscord<Phil> That's perfectly fine
18:53:26FromDiscord<Phil> Is there some kind of way where I can define a bunch of nim-code and have it all turned into a large nim-node?↵What I'd essentially like to do is have like roughly 40 lines of Nim code turned into a NimNode so that I can attach that to generated proc definitions
18:55:48FromDiscord<auxym> In reply to @isofruit "Is there some kind": parseExpr if your code is a string. But also check out genAst
18:56:18FromDiscord<auxym> https://nim-lang.org/docs/macros.html#parseExpr%2Cstring%2Cstring
18:56:37FromDiscord<auxym> https://nim-lang.org/docs/genasts.html
18:56:37FromDiscord<demotomohiro> In reply to @isofruit "Is there some kind": https://nim-lang.org/docs/manual.html#templates-passing-a-code-block-to-a-template↵I think this is what you want.
18:57:02FromDiscord<Phil> Yeah but I want to use that body in a macro, so I use a template in which I call a macro to generate a proc?
18:57:15FromDiscord<Phil> Or can I create NimNodes in a template as well?
18:57:25FromDiscord<demotomohiro> You can pass code block in the same to macro.
18:57:38FromDiscord<Phil> Oh it follows the same syntax? Sweet!
18:58:23FromDiscord<auxym> oh yeah, you can pass a code block as the last arg with the colon syntax with a macro, too
19:00:03FromDiscord<bostonboston> In reply to @demotomohiro "Importing C functions from": Could you give me an example
19:02:05FromDiscord<demotomohiro> In reply to @bostonboston "Could you give me": https://internet-of-tomohiro.netlify.app/nim/clibrary.en#c-library-tutorial-for-nimmer-use-c-static-library-from-nim
19:14:10*junaid__ joined #nim
19:45:44FromDiscord<bostonboston> Thank you, also fortunately I don't need to use this thanks a lot silabs
19:47:24*junaid__ quit (Remote host closed the connection)
20:03:00FromDiscord<Phil> Okay once you learn some of the macro ground rules, writing them becomes a lot more fun
20:08:28FromDiscord<monark.chan> How can I check if a variable hasn't been written to yet
20:10:42FromDiscord<Phil> You can't really.↵If it's a ref-type it is nil, but nobody can guarantee you if that was nil because it was just initialized or because some codee earlier set the thing to nil.↵Similarly value types get default values and maybe if you encounter a 0 it's from default initialization, maybe it's an actual legit value, nobody knows.
20:10:53FromDiscord<Phil> (edit) "codee" => "code"
20:11:04FromDiscord<monark.chan> Oh
20:12:16FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CnZ
20:13:06FromDiscord<Phil> If you want to express that something can be "nothing" or not, I can only say to try and use optionals
20:13:31FromDiscord<Phil> Other than that it's typically good design to only initialize complete datasets from the get go, and not first initialize and then assign valid values
20:13:44FromDiscord<Phil> (edit) "Other than that it's typically good design to only initialize complete datasets from the get go, and not first initialize and then assign valid values ... " added "(like you would with setters in java which is an antipattern in and of itself)"
20:26:52FromDiscord<.kanaxa> https://github.com/neroist/uing
20:27:10FromDiscord<.kanaxa> Oh man, I'm in love with uing right now, the examples all compiled with no issues on Linux and Windows
20:27:17FromDiscord<.kanaxa> Why is this not the default GUI library yet?
20:27:23FromDiscord<.kanaxa> (edit) "yet?" => "yet for Nim"
20:33:54*ajunior quit (Remote host closed the connection)
20:39:39*ajunior joined #nim
20:51:23FromDiscord<Phil> Never tried it, thus 🤷 ↵I would claim that also for becoming a default of sorts it'd need better docs ^^
20:51:44FromDiscord<Phil> If you want I can show you the ways of nimibook (which allows for writing docs with compiled examples) and you can contribute ^^
20:54:10FromDiscord<Phil> And for becoming any sort of default it will need to provide some basic aminities, including lifecycle hooks for widgets as well as enabling writing your own widgets that extend the basic provided ones
21:05:15FromDiscord<Elegantbeef> @Phil\: the flame about micros was unwarranted, most of my packages are documented
21:06:13FromDiscord<Phil> In reply to @Elegantbeef "<@180601887916163073>\: the flame about": Apologies, combatting your way through the various ways macros can blow up on you is currently proving strenuous
21:07:08FromDiscord<Phil> rereading it, at the time it was meant a bit more jokingly than it reads tbh
21:07:23FromDiscord<Elegantbeef> Eh I know it was jokingly
21:09:05FromDiscord<Phil> What is the magic incantation to get the stringified version of a type from a macro as a "static string" of sorts that can be passed to another macro that would eat a static string ?
21:09:31FromDiscord<Elegantbeef> `repr myType`
21:12:00FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Co6
21:12:01FromDiscord<michaelb.eth> hmm, trying out `uing` on macOS, but can't get the examples to build
21:12:09FromDiscord<Phil> Compiler blows up for me every time before that can happen
21:12:16FromDiscord<Elegantbeef> well yea `repr(t)` will never be static
21:12:34FromDiscord<michaelb.eth> the readme says↵> This library installs the C sources for libui-ng and statically compiles them into your application.↵↵but maybe I'm misunderstanding something
21:12:50FromDiscord<Phil> But I need this stuff to be static to pass it onto another macro without it getting auto converted into a NimNode I thought
21:13:12FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/E6Wz6
21:14:55FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4Co7
21:15:07FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Co8
21:15:42FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4Co8" => "https://play.nim-lang.org/#ix=4Co9"
21:17:42FromDiscord<Phil> Does that execute the call? So if bla returns a NimNode I can also return that?
21:20:07FromDiscord<Elegantbeef> I mean the macro is expanded in place
21:20:21FromDiscord<Elegantbeef> If you're calling a macro it's called within the macro scope and with the macro arguments
21:22:13FromDiscord<Phil> can newcall eat a "body" of nim-code the same way templates and macros do?
21:22:17FromDiscord<Elegantbeef> If you want things resolved you have to pass them along and to let Nim evaluate them outside of the macro scope
21:30:41FromDiscord<ieltan> In reply to @auxym "parseExpr if your": I don't know if you have the knowledge but why is `genasts` it's own module?
21:31:03FromDiscord<ieltan> Can't it just be included inside `macros`
21:31:59FromDiscord<ieltan> `std/with` too
21:32:26FromDiscord<ieltan> Why couldn't it just be in `std/sugar`?
21:32:40FromDiscord<Elegantbeef> Cause including everything inside a single module is not the wisest
21:33:07FromDiscord<ieltan> I'm not talking about `include` of course
21:33:20FromDiscord<Elegantbeef> Who said you were
21:33:21FromDiscord<ieltan> Just write it inside a module that already exist
21:33:42FromDiscord<ieltan> What could possibly go wrong
21:35:26FromDiscord<Elegantbeef> Ambiguities
21:35:51FromDiscord<Elegantbeef> Slows down compile times
21:37:49FromDiscord<Phil> Seems like newCall can not accept a body the same way templates and macros do, gnaa↵Ugh I give up for today
21:38:00FromDiscord<Elegantbeef> `newStmtList(myCode)`
21:38:05FromDiscord<ieltan> In reply to @Elegantbeef "Ambiguities": I see, thanks for answering 🙂
21:54:56FromDiscord<jakraes> Is there a way to import every single file in a folder?
21:55:11FromDiscord<Andreas> nope
21:55:22FromDiscord<jakraes> Daaaamn
21:56:09FromDiscord<jakraes> Well, that's unfortunate
21:56:50FromDiscord<Elegantbeef> You can write a macro, or more reasonably a script to generate a `import export` chain for all the modules
21:58:25FromDiscord<Elegantbeef> The script is slightly more reasonable in my view as it doesnt have to iterate a folder every single compilation
21:58:26FromDiscord<jakraes> Isn't export and the same thing?
21:58:32FromDiscord<_gumbercules> No
21:58:34FromDiscord<Andreas> we had this conversation a couple of days before - one can write a macro, thus extending the language. Thats requires advanced knowledge of nims `templates/macros`. Since nobody from the expert-users ever had the need to do so - maybe you explain why you need such ?
21:58:45FromDiscord<Elegantbeef> No cause you cannot `import std/strutils`
21:59:06FromDiscord<_gumbercules> Also in what programming language can you import every file / module in a folder?
21:59:14FromDiscord<Elegantbeef> I mean I've had the need 😄↵(@Andreas)
21:59:31FromDiscord<jakraes> Damn, I'm completely confused now, I'll need to look into it then
21:59:43FromDiscord<Elegantbeef> Doesnt java have wildcard imports
22:00:02FromDiscord<jakraes> In reply to @_gumbercules "Also in what programming": I'm unsure, but Nim could be an exception haha
22:00:04FromDiscord<_gumbercules> Yes but everything is stil structured into a package in Java which you have to declare at the top
22:00:24FromDiscord<_gumbercules> In reply to @jakraes "I'm unsure, but Nim": I just don't see the appeal - generally in Nim the idiomatic thing to do is have one module that exports all the other modules
22:00:37FromDiscord<_gumbercules> so you'd have like an `api.nim` which imports all of your other `.nim` files and then exports them
22:00:44FromDiscord<_gumbercules> that way everything just imports `api.nim`
22:00:44FromDiscord<jakraes> Oh, so it's like a header file?
22:01:03FromDiscord<_gumbercules> Can be - yeah in Nim there's no distincton between where a declaration is made and an implementation is provided
22:01:06FromDiscord<jakraes> Wait, wouldn't circular imports be an issue there?
22:01:08FromDiscord<_gumbercules> but you can certainly use modules like header files
22:01:22FromDiscord<_gumbercules> In reply to @jakraes "Wait, wouldn't circular imports": yes they can be - and that's why in larger NIm projects you'll generally find some sort of `types.nim` file
22:01:34FromDiscord<_gumbercules> it sucks but tmk the compiler still can't handle circular imports
22:01:40FromDiscord<_gumbercules> unless that was resolved in 2.0
22:01:51FromDiscord<Elegantbeef> Well it can handle circular imports but only with delayed imports
22:01:58FromDiscord<Elegantbeef> So tightly cyclical graphs fail
22:02:04FromDiscord<Elegantbeef> But loosely cyclical graphs succeed
22:02:31FromDiscord<jakraes> Yeah I remember I had a lot of issues when trying to mimic a header file in Nim last year or so, I'll to check that out though
22:02:34FromDiscord<jakraes> Maybe it'll work this time
22:02:46FromDiscord<Elegantbeef> No it will not
22:02:53FromDiscord<Elegantbeef> Cyclical imports still require thought
22:02:56FromDiscord<Elegantbeef> They do not magically work
22:03:00FromDiscord<jakraes> Ah damn
22:03:13FromDiscord<jakraes> Well I need to look into this whole situation then
22:03:25FromDiscord<jakraes> It'll save me a lot of work in the future
22:04:01FromDiscord<_gumbercules> btw the difference between `export` and `` is that `` is used to mark a symbol as available outside of the module
22:04:21FromDiscord<_gumbercules> so it's like omitting `static` from a declaration in C
22:04:35FromDiscord<jviega> I've recently dealt with a cyclical issue that "extern" would have easily fixed but would have required refactoring that obfuscated the code by declaring both sides to the other as if they were in C and just forcing the calling convention on both 🙂
22:04:36FromDiscord<Andreas> In reply to @Elegantbeef "Cyclical imports still require": and some additional work on the compiler - i tried "module-package-types ?" and found it brittle and failing on generics..
22:04:36FromDiscord<_gumbercules> `export` is generally used when you want to export a symbol from a module you've imported
22:05:01FromDiscord<_gumbercules> so module `a` imports `b` and wants to make `b` available to anything that imports `a`
22:05:14FromDiscord<Elegantbeef> Nah andreas that's a different issue
22:05:17FromDiscord<_gumbercules> you'd upse `export b` inside module `a`
22:05:23FromDiscord<jakraes> Ooooh
22:05:31FromDiscord<jakraes> Yeah that'll be super useful
22:05:39FromDiscord<jakraes> I was wondering if there was a way to do that, guess there is
22:05:43FromDiscord<jakraes> Thank you :D
22:05:58FromDiscord<Elegantbeef> https://wandbox.org/permlink/QWoxQtBAXoiHhLuw for an example of how delayed imports allow cyclical imports
22:06:09FromDiscord<jakraes> That answers my question
22:06:36FromDiscord<jakraes> I asked my initial question because imports weren't working like they do in C
22:06:46FromDiscord<jakraes> Guess I just needed the export
22:06:52FromDiscord<jakraes> Pretty damn cool
22:07:24FromDiscord<Elegantbeef> `include` is like C's include, `import` is a proper system and what you should use 99% of the time
22:07:31FromDiscord<Andreas> In reply to @Elegantbeef "https://wandbox.org/permlink/QWoxQtBAXoiHhLuw for a": nice trick..
22:07:44FromDiscord<jakraes> In reply to @Elegantbeef "`include` is like C's": Yeah I'll still be using import
22:08:20FromDiscord<Elegantbeef> It's not much of a trick really, it's just how Nim's imports work
22:08:29FromDiscord<Elegantbeef> Loosely cyclical graphs are fine, it's the tightly cyclical that are not
22:08:57FromDiscord<jakraes> In C I always had problems with passing down some undesired includes
22:09:07FromDiscord<jakraes> Import and export fixes my issue with C lul
22:09:17FromDiscord<jakraes> One of the issues, I mean
22:09:46FromDiscord<Elegantbeef> https://wandbox.org/permlink/VBtPjED9cAtqjWMR this slight modification to above shows a tight graph causing the issue
22:11:09FromDiscord<Elegantbeef> main -\> a -\> import b -\> declare type -\> import a -\> import b -\> declare type -\> import a -\> ....
22:11:33FromDiscord<Prestige> oh nice we're getting some youtube coverage on nim 2.0
22:12:37FromDiscord<Andreas> In reply to @avahe "oh nice we're getting": nice, you got a link ?
22:12:44FromDiscord<Prestige> https://www.youtube.com/watch?v=nFPm48nANCY
22:12:56FromDiscord<Prestige> just started watching
22:23:41FromDiscord<nicolterra> I am having an issue with installing the nim ls on neovim. my lucky guess is my bash rc is not set up correctly? https://media.discordapp.net/attachments/371759389889003532/1137148881898057879/Screenshot_from_2023-08-04_16-22-12.png
22:26:14FromDiscord<Elegantbeef> Hard to say without a full error message
22:29:08FromDiscord<Elegantbeef> Prestige if only they had anything of substance to add 😄
22:30:10FromDiscord<Prestige> The video? Yeah he doesn't know anything about Nim yet. He has a huge audience though, hopefully this will be some sort of gateway into him trying Nim and making videos about it
22:30:45FromDiscord<Elegantbeef> Eh given what he's said about Nim before, doubtful
22:31:00FromDiscord<Elegantbeef> But I could be wrong
22:31:32FromDiscord<Prestige> fingers crossed
22:31:39FromDiscord<Prestige> I think he'd enjoy the language if he tried it
22:32:45FromDiscord<Prestige> Well, I take that back, he'd probably drop it because of editor support
22:35:58FromDiscord<ricky> is ther a nix pkg for nim2 yet fellas
22:36:02FromDiscord<ricky> im hungry bad
22:36:24FromDiscord<Andreas> seems he is currently is in a love-affair with OCaml 🙂
22:36:49FromDiscord<nicolterra> In reply to @avahe "just started watching": ive been listening trying to fix my lsp issue lol
22:37:07FromDiscord<Andreas> (edit) removed "is"
22:37:59FromDiscord<ricky> In reply to @Andreas "seems he is currently": cursed lang
22:40:11FromDiscord<Prestige> He's been _really_ into rust for a while and trying out other languages on the side
22:43:16FromDiscord<Andreas> In reply to @avahe "He's been _really_ into": ik, but presenting nim without any noticable preparation is , well weak..
22:44:00FromDiscord<Prestige> Yeah that was pretty lame
22:44:11FromDiscord<nicolterra> last ping on this, sorry, but this is the full error https://media.discordapp.net/attachments/371759389889003532/1137154042229968926/Screenshot_from_2023-08-04_16-43-40.png
22:44:17FromDiscord<nicolterra> i am still somewhat new to nvim
22:45:02FromDiscord<Prestige> Looks like it can't find nimble
22:45:52FromDiscord<nicolterra> i just ran which nimble so it is installed, i think
22:46:36FromDiscord<nicolterra> huh, my bashrc crashed and has a backup
22:48:17FromDiscord<nicolterra> sorry if i need to be babied during config, i do however have nim 2.0 and nimble
22:48:30FromDiscord<nicolterra> on debian/pop os
22:49:17FromDiscord<nicolterra> my bashrc is where my environment path is set up right?
22:49:38FromDiscord<Elegantbeef> If that's the shell you're using and you didnt setup your path elsewhere
22:53:34FromDiscord<Elegantbeef> Do think I had similar issues with fish and astronvim
22:54:10FromDiscord<nicolterra> astrovim is my starting config---
23:21:55NimEventerNew thread by user2m: Nim Autome / Win32 API, see https://forum.nim-lang.org/t/10375
23:27:23FromDiscord<ieltan> In reply to @avahe "https://www.youtube.com/watch?v=nFPm48nANCY": Big brain fart at the 12:25 mark lol
23:29:02FromDiscord<ieltan> To be fair to him, the article probably shouldn't have put the C++ and the Nim code in the same block, it make it look like you can directly write C++ inside Nim (I mean, you can with emit but the article is not using it)
23:33:45FromDiscord<Prestige> Yeah agreed
23:40:44FromDiscord<bostonboston> video hurt me in some spots