<< 19-07-2021 >>

00:06:37FromDiscord<ElegantBeef> Unchecked
00:49:33fn<ForumUpdaterBot99> New thread by Tsojtsoj: Question about "thread-local heap" garbage collectors and threads., see https://forum.nim-lang.org/t/8243
01:01:17fn<ForumUpdaterBot99> New question by bobeff: Why Git gives the error &quot;Resource temporarily unavailable (code: 11)&quot; when simultaneously executing multiple instances?, see https://stackoverflow.com/questions/68433981/why-git-gives-the-error-resource-temporarily-unavailable-code-11-when-simul
01:15:30fn<Prestige99> Playground is still down?
01:15:45FromDiscord<ElegantBeef> Seems not
01:17:23fn<Prestige99> Trying to make a callback match MouseButtonFun* = proc (window: Window, button: cint, action: cint, modifiers: cint) {.cdecl.} but it complains that my proc isn't of type MouseButtonFun
01:17:36fn<Prestige99> figure I need some set of pragmas but not sure which
01:17:44FromDiscord<ElegantBeef> `{.cdecl.}`
01:17:49fn<Prestige99> providing {.cdecl.} works but I don't suppose that's correct
01:17:56fn<Prestige99> huh okay
01:18:04FromDiscord<ElegantBeef> It's a calling convention
01:18:07FromDiscord<ElegantBeef> It's required
01:18:16fn<Prestige99> interesting, alright
01:18:22FromDiscord<ElegantBeef> If you are on devel the error message would've said as such
01:19:12fn<Prestige99> I wish there was more info on cdecl, doesn't really make sense to me, putting it on the callback
01:19:53FromDiscord<ElegantBeef> > The cdecl convention means that a procedure shall use the same convention as the C compiler. Under Windows the generated C procedure is declared with the cdecl keyword.
01:19:59FromDiscord<ElegantBeef> Not enough?
01:20:26fn<Prestige99> nah
01:22:24fn<Prestige99> I'm not familiar with c so I don't know what that really means, "the same convention". Same function signature?
01:23:32FromDiscord<ElegantBeef> There are different annotations possible with procedures in C and those change the signature
01:23:45FromDiscord<theangryepicbanana> cdecl is a calling convention
01:24:00FromDiscord<theangryepicbanana> aka a way that functions are called in assembly
01:25:05FromDiscord<ElegantBeef> As such they're not compatible if not annotated the same, though an object variant could be pretty nice 😄
01:25:53fn<Prestige99> ah I see, thanks
01:26:33*blackbeard420_ quit (Quit: ZNC 1.8.2 - https://znc.in)
01:26:50*blackbeard420 joined #nim
01:41:29FromDiscord<@bracketmaster-5a708063d73408ce4> is there a concept of popping characters from a string?
01:41:46FromDiscord<ElegantBeef> you mean removing the last one?
01:41:53FromDiscord<@bracketmaster-5a708063d73408ce4> yeah
01:41:58FromDiscord<ElegantBeef> `pop` should do that
01:42:04FromDiscord<ElegantBeef> i know it exists for seqs
01:48:55*krux02 quit (Remote host closed the connection)
01:55:50FromDiscord<ElegantBeef> Ah it does not exist for strings
01:56:07FromDiscord<@bracketmaster-5a708063d73408ce4> yeah - just seqs - which is fine
01:57:00FromDiscord<ElegantBeef> It's only two lines if you do need it for strings
01:57:02FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=3tog
01:57:04FromDiscord<ElegantBeef> Quite simple
02:07:23FromDiscord<@bracketmaster-5a708063d73408ce4> thx
02:07:36FromDiscord<@bracketmaster-5a708063d73408ce4> eval! 'a'.string
02:07:43FromDiscord<@bracketmaster-5a708063d73408ce4> !eval 'a'.string
02:07:44NimBotCompile failed: /usercode/in.nim(1, 4) Error: type mismatch: got <char> but expected 'string'
02:07:59FromDiscord<@bracketmaster-5a708063d73408ce4> yeah - char to string not happy
02:10:40FromDiscord<@bracketmaster-5a708063d73408ce4> can you convert a single char to a string?
02:10:52fn<Prestige99> maybe with $?
02:11:02fn<Prestige99> !eval echo $'a'
02:11:06NimBota
02:11:07fn<R2D299> a
02:11:13fn<Prestige99> nice
02:12:56FromDiscord<@bracketmaster-5a708063d73408ce4> !eval echo ($'a'.type)
02:12:58NimBotchar
02:13:08FromDiscord<@bracketmaster-5a708063d73408ce4> see?
02:13:21fn<Prestige99> !eval echo ($'a').type
02:13:23NimBotstring
02:13:24fn<R2D299> string
02:15:15FromDiscord<@bracketmaster-5a708063d73408ce4> !eval echo $("hello"[0]).type; echo $("hello"[0..1]).type
02:15:18NimBotchar↵string
02:15:55FromDiscord<@bracketmaster-5a708063d73408ce4> For what I'm doing, I need to be able to get "hello"[0] to be string
02:16:01FromDiscord<ElegantBeef> it will be
02:16:20FromDiscord<ElegantBeef> well with `($"hello"[0])`
02:16:58FromDiscord<ElegantBeef> `$` very low on the table for precedence so `.type` was running before it
02:17:16FromDiscord<@bracketmaster-5a708063d73408ce4> o
02:17:33FromDiscord<ElegantBeef> !eval echo ($"hello"[0]).type
02:17:35NimBotstring
02:20:34FromDiscord<ElegantBeef> Actually not precedence just binding
02:21:14FromDiscord<ElegantBeef> unary `$` binds to the entire statement following whereas unary `@` only binds to the next statement
02:21:24FromDiscord<ElegantBeef> (edit) "statement" => "symbol"
02:21:25FromDiscord<ElegantBeef> https://nim-lang.org/docs/manual.html#syntax-precedence can read it here
02:40:01FromDiscord<deech> Is anyone actually using the Obj-C interop? I don't see many tests for it.
02:49:56fn<Prestige99> probably not
02:50:07FromDiscord<ElegantBeef> Yea i dont think many are
02:50:47FromDiscord<theangryepicbanana> In reply to @deech "Is anyone actually using": might want to see if there's any ios/mac nim libs on github
02:50:54FromDiscord<ElegantBeef> A vast majority just dont need objc interop 😄
02:51:24FromDiscord<theangryepicbanana> although tbh I can't see objc interop being very difficult to begin with
02:52:03FromDiscord<theangryepicbanana> like as long as you acknowledge objc's ref counting and message passing, it should theoretically work with pretty easily
02:52:20FromDiscord<theangryepicbanana> (edit) "like as long as you acknowledge objc's ref counting and message passing, it should theoretically ... work" added " e pretty easy to" | removed "pretty easily"
02:52:26FromDiscord<theangryepicbanana> (edit) " e" => "be"
02:52:26*TakinOver quit (Read error: Connection reset by peer)
03:00:51*vicfred quit (Quit: Leaving)
03:02:35*vicfred joined #nim
03:19:49FromDiscord<codic> is it possible to do something like typescript's Partial, which sets all fields not already nullable to nullable? https://www.typescriptlang.org/docs/handbook/utility-types.html↵↵(i would want it to set it to Option[T] in Nim)
03:21:39FromDiscord<ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=3toy
03:22:09FromDiscord<ElegantBeef> Or do you want to convert a type to an optional version after the declaration?
03:22:34FromDiscord<ElegantBeef> Eitherway the answer is yes you can with macros
03:25:50FromDiscord<theangryepicbanana> aren't fields already nullable by default
03:31:03FromDiscord<ElegantBeef> no `a: int` isnt nilable
03:34:42FromDiscord<Rika> Fields are zero by default, which is distinct from nullable
03:46:49FromDiscord<ElegantBeef> @codic well the lazy man's tuple exists here https://play.nim-lang.org/#ix=3toD
03:55:04*arkurious quit (Quit: Leaving)
04:06:02*supakeen quit (Quit: WeeChat 3.2)
04:06:37*supakeen joined #nim
04:12:28nixfreak_nim[m]Using Karax and trying to figure out how to build css on the fly using vstyles, I have two modules one for header and one for body , just for testing I want to import those two modules then use another proc to call those two modules and render the css
04:12:35nixfreak_nim[m]is that possible
04:53:01FromDiscord<codic> oh wait you can name tuple members?
04:53:11FromDiscord<Rika> Yes
04:53:11FromDiscord<codic> this might work
04:53:17FromDiscord<ElegantBeef> It's somewhat silly but it works
04:54:38FromDiscord<codic> hmm interesting
04:56:23FromDiscord<codic> sent a code paste, see https://play.nim-lang.org/#ix=3toM
04:56:51FromDiscord<ElegantBeef> You couldnt do that
04:57:14FromDiscord<ElegantBeef> It'd have to be `type PartialT = optional(T)`
04:57:28FromDiscord<theangryepicbanana> that would require row typing I think, which nim doesn't have
04:57:43FromDiscord<ElegantBeef> Well the typedef isnt typed
04:57:50FromDiscord<Rika> Beef have you checked what the pragma captures because I don’t know lol
04:57:51FromDiscord<ElegantBeef> Which is the issue since T isnt a symbol in that case
04:57:59FromDiscord<ElegantBeef> It gives a typedef
04:58:07FromDiscord<ElegantBeef> You can modify it but you need to return a typedef
04:58:19FromDiscord<ElegantBeef> It's not semantically typed though which means no symbols
04:58:26FromDiscord<codic> hmm how do I implement an optional method though
04:58:29FromDiscord<codic> this might be a futile exercise
04:58:41FromDiscord<Rika> Same way beef did I don’t get it
04:58:49FromDiscord<Rika> In reply to @theangryepicbanana "that would require row": What is row typing
04:58:53FromDiscord<codic> i'm trying to make a simple discord library and there are lots of partial structures, so I don't want to make everything optional
04:59:29FromDiscord<codic> In reply to @Rika "Same way beef did": but it returns a tuple not an object
04:59:44FromDiscord<Rika> Yes just make it return an object instead then
04:59:50FromDiscord<ElegantBeef> The object version is somewhat simpler
05:03:22FromDiscord<codic> if I change tuple -> object i get `object a, b: toOptional(int)c: toOptional(string)d: toOptional(Option[int])`
05:03:29FromDiscord<codic> so i need to figure out how to add newlines
05:03:34FromDiscord<ElegantBeef> Nah
05:03:43FromDiscord<ElegantBeef> You're trying to rely on old work too much
05:05:06nixfreak_nim[m]how do create a type with import procs?
05:05:07nixfreak_nim[m] * how do you create a type with import procs?
05:05:33FromDiscord<ElegantBeef> what do you mean "with import procs"?
05:05:53FromDiscord<codic> > You're trying to rely on old work too much↵🤔
05:06:13FromDiscord<Rika> What is an import proc
05:07:38FromDiscord<codic> how else can i do it, without adding newlines after each field?
05:07:39FromDiscord<ElegantBeef> You were trying to rely on the tuple logic which you dont need here https://play.nim-lang.org/#ix=3toP
05:10:22FromDiscord<codic> ok... i only understand 50% of that
05:10:27FromDiscord<codic> nim macros are too cool for me
05:10:40FromDiscord<ElegantBeef> Well we can get the typedef from the typdesc
05:10:49FromDiscord<ElegantBeef> So we do that, then modify it to suite our needs
05:10:58nixfreak_nim[m]https://play.nim-lang.org/#ix=3toQ
05:11:04FromDiscord<codic> what is a nnkBracketExpr?
05:11:10FromDiscord<ElegantBeef> `Option[T]`
05:11:15FromDiscord<codic> ahh [ and ]
05:11:19FromDiscord<codic> ok now i see
05:11:20FromDiscord<codic> yeah it makes sense
05:11:43FromDiscord<codic> i was about to ask about the backwards indexing but I just figured that out
05:12:19FromDiscord<codic> could it be done in a way that it could be a rvalue instead of having to specify the name like `T.asOptional TOpt` instead `type TOpt = T.asOptional`?
05:13:49nixfreak_nim[m]Does that make sense ? I want to render both of those at the same time
05:14:02FromDiscord<ElegantBeef> So make another function that uses buildhtml and calls them?
05:14:36FromDiscord<ElegantBeef> Doesnt look like you can codic
05:15:41nixfreak_nim[m]but it can't be a VNode right because the two modules are already VNodes
05:16:00FromDiscord<ElegantBeef> I dont know what you mean
05:16:13FromDiscord<ElegantBeef> Arent VNodes just what karax uses to represent dom objects?
05:16:31nixfreak_nim[m]yeah
05:16:55FromDiscord<ElegantBeef> I dont get what you mean "two modules are already VNodes"
05:18:54nixfreak_nim[m]ok I have two files one to render a header and one to render a body using css
05:19:23FromDiscord<ElegantBeef> I dont see how it matters, i havent used karax much
05:20:39nixfreak_nim[m]I want to be able to create a module per class and then render it altogether. I'm importing the two modules , I need to create a proc that includes both of those modules and then setRenderer (the imported modules)
05:21:14nixfreak_nim[m]I'm just seeing if this can work or not
05:21:21FromDiscord<ElegantBeef> So then import these modules and call them, i just dont know the issue here
05:21:52nixfreak_nim[m]having issues calling them
05:22:30FromDiscord<Rika> What issues
05:24:33nixfreak_nim[m]do I call setRenderer for both modules ?
05:24:51FromDiscord<Rika> I’ll take a look again, I’m on mobile so 💩
05:25:51FromDiscord<ElegantBeef> You'd setrenderer for the main file then import these and call them from main
05:26:16FromDiscord<ElegantBeef> iirc `setRenderer` is the injection site for your drawing logic
05:27:33nixfreak_nim[m]I tried setRenderer header,body
05:27:52FromDiscord<ElegantBeef> Well you need a main procedure to call the others
05:28:47FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=3toU
05:28:49FromDiscord<ElegantBeef> something like that
05:34:21nixfreak_nim[m]yeah I was trying way to hard I see it now , thank you
05:35:28FromDiscord<ElegantBeef> No problem
05:42:45nixfreak_nim[m]still not working but it gives me something to look at thanks
05:54:14nixfreak_nim[m]sweet I got it now , thanks
06:10:10fn<ForumUpdaterBot99> New thread by Stu002: Template or macro for heterogeneous tuple expressions?, see https://forum.nim-lang.org/t/8244
06:18:10*max22- joined #nim
06:18:27*max22- quit (Remote host closed the connection)
06:18:50*max22- joined #nim
06:23:44FromDiscord<haxscramper> In reply to @haxscramper "Will test this tomorrow": @Bung `ref` representation in VM is not different from regular object layout, not changes are necessary
06:23:56FromDiscord<haxscramper> (edit) "are necessary" => "needed"
06:40:41FromDiscord<Bung> @haxscramper you mean they are in same gc process?
06:41:37FromDiscord<haxscramper> I mean `representation in VM is not different from regular object`
06:41:50FromDiscord<haxscramper> ref https://media.discordapp.net/attachments/371759389889003532/866570509788643338/unknown.png
06:42:01FromDiscord<haxscramper> non-ref is the same
06:43:51FromDiscord<Bung> looks like new a type then assign variables to its fields
06:44:21FromDiscord<haxscramper> yes
06:44:59FromDiscord<haxscramper> It assigns values to all fields, regardless of their availability in the object
06:45:11FromDiscord<haxscramper> So `field1` and `field2` are mutually exclusive, but both are present
06:46:03FromDiscord<Bung> when the variable pass to vm , the vm get all fields representation including fields also are ref type ?
06:46:23*flynn quit (Quit: Ping timeout (120 seconds))
06:47:29*flynn joined #nim
06:50:17FromDiscord<haxscramper> sent a code paste, see https://paste.rs/A54
06:50:23FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3tp8
06:53:35FromDiscord<Bung> hmm, maybe no question ,just describe what I understand, the converting is only for proc accept variant type of args, they are in same gc process , this differs from dll way
06:54:48FromDiscord<haxscramper> I have absolutely no idea how this is related to gc/dll and whatever
06:55:04FromDiscord<haxscramper> But there is no difference from regular `ref` type
06:55:18FromDiscord<haxscramper> In the VM it is a `PNode`, outside of vm it is still a `PNode`
06:55:36FromDiscord<haxscramper> If you want to put nimscript in different dll and use it
06:56:00FromDiscord<haxscramper> Is that what you want?
06:56:16FromDiscord<Bung> dll has its own gc process , so pass around ref types may face nil access
06:56:37FromDiscord<Bung> no, I just want to understanding how this works
06:57:32FromDiscord<Bung> nimscriper fit my needs , I just compare the dll way for understanding.
07:41:47*vicfred quit (Quit: Leaving)
07:54:21*beshr joined #nim
08:32:32fn<ForumUpdaterBot99> New thread by Jasonfi: Compiling with OpenSSL on Windows 10?, see https://forum.nim-lang.org/t/8245
08:38:32*max22- quit (Remote host closed the connection)
08:38:50*max22- joined #nim
09:48:29*krux02 joined #nim
10:13:12FromDiscord<offbeat-stuff (offbeat-stuff)> Hi, How to convert `SomeNumber` to `float64`
10:16:24FromDiscord<offbeat-stuff (offbeat-stuff)> Okay just the code to use [T\: SomeNumber] and now it works
10:29:46arkanoidis this a bug? https://play.nim-lang.org/#ix=3tpO
10:30:03arkanoidif I push the two pragmas separately it works
10:31:10FromDiscord<Rika> feel like ive seen this documented
10:31:14FromDiscord<Rika> as bug i mean
10:35:13arkanoidRika, yes https://github.com/nim-lang/Nim/issues/12867
10:36:34arkanoidis there a workaround to avoid copypasting a lot?
10:42:53FromDiscord<haxscramper> write a macro that generates push
10:43:54FromDiscord<haxscramper> I suppose you can put all the experimental and pushes in a single macro
10:49:15arkanoidhaxscramper, thanks, seems to work with templates too: https://play.nim-lang.org/#ix=3tpO
10:49:32arkanoidis it possible to use experimental: "strictFuncs" in same way?
10:49:59FromDiscord<haxscramper> nim templates/macros can generated any nim code
10:50:21FromDiscord<haxscramper> Also you sent the same link
10:50:47arkanoidoh, I'm sorry. Here's the correct one https://play.nim-lang.org/#ix=3tpS
10:53:30FromDiscord<haxscramper> I was talking about https://play.nim-lang.org/#ix=3tpT
10:53:50FromDiscord<haxscramper> ● without need to do additional indentation for everything
10:54:45arkanoidyeah, that might be better, but not sure. What about strictFuncs? can that be popped too?
10:55:21FromDiscord<haxscramper> no, I think once experimental is enabled in stays in effect for the whole module
10:55:57arkanoidk
10:56:18arkanoidbtw thanks, problem solved for now
11:30:07*asd quit (Ping timeout: 268 seconds)
11:31:46*asd joined #nim
11:51:28*happycorsair[m] quit (Quit: Bridge terminating on SIGTERM)
11:51:28*nixfreak_nim[m] quit (Quit: Bridge terminating on SIGTERM)
11:51:28*Helios quit (Quit: Bridge terminating on SIGTERM)
11:54:52*nixfreak_nim[m] joined #nim
12:06:02*supakeen quit (Quit: WeeChat 3.2)
12:06:41*supakeen joined #nim
12:07:37*Helios joined #nim
12:07:37*happycorsair[m] joined #nim
12:23:37arkanoidthe nimfp and its dependencies are outdated and really needs some more love
12:35:57*max22- quit (Ping timeout: 245 seconds)
12:58:07*Vladar joined #nim
13:02:11*kayabaNerve_ joined #nim
13:04:57*kayabaNerve quit (Ping timeout: 255 seconds)
13:41:14fn<ForumUpdaterBot99> New thread by Geohuz: How to implement the 'Type parameters(aka generics)' as the following code, see https://forum.nim-lang.org/t/8246
13:41:41arkanoidwould you explain the differences to me please? https://play.nim-lang.org/#ix=3tqr
13:49:45FromDiscord<haxscramper> I think it is defined as 'it is the same thing', but I had a lot of unexplainable type mismatches with all of the syntaxes
13:49:56FromDiscord<haxscramper> And I recommend to write `typedesc[Type]`
13:50:28FromDiscord<haxscramper> And `proc generic[T](arg: typedesc[T])` instead of `proc generic(arg: type)`
13:51:20FromDiscord<haxscramper> Simply `typedesc` argument means "any type", `typedesc[ConcreteType]` means that you can only pass `procedurename(ConcreteType)`
13:51:56FromDiscord<haxscramper> `And I recommend to write "typedesc[Type]"` especially ! in context of generic procedures
13:56:37*arkurious joined #nim
14:11:23arkanoidwhat comes first, typedesc, generics, or "type" keyword not used in type declaration ?
14:11:47arkanoidand what's the differences between typedesc and generics? seems very similar to me
14:15:34arkanoidoh, and there's also the generic [T: int] thing
14:16:05FromDiscord<haxscramper> `> what comes first, typedesc, generics, or "type" keyword not used in type declaration ?` - I'm not sure I understand the question
14:16:16FromDiscord<Rika> typedesc asks for the type itself↵generic T is a value of the type T
14:16:25FromDiscord<haxscramper> generic is a concept, it is not even tied to a language really
14:16:39FromDiscord<haxscramper> Like genric procedure or generic type
14:16:43FromDiscord<Rika> so `a(typedesc)` is called via `int.a()` or `float.a()` or `value.type.a()`
14:16:45arkanoidwait I think I've found the relevant RFC 3. https://github.com/nim-lang/RFCs/issues/40
14:16:56FromDiscord<Rika> `a[T](T)` is called via `value.a()`
14:18:10arkanoidI'm just puzzled if I should prefer generics or typedesc things
14:18:10FromDiscord<haxscramper> Abuot "guidelines for when to use typedesc vs generics" - I think you should use typedesc only if you need some fancy syntax like `boxed as ConcreteTYpe`
14:18:24FromDiscord<haxscramper> you should use generics
14:18:51FromDiscord<haxscramper> Unless you have an valid reason to use typedesc, and I think it is not really often
14:19:43FromDiscord<haxscramper> well, the question itself is not really meaningful
14:19:51FromDiscord<Rika> ~~like init(typedesc)~~
14:19:56FromDiscord<generic linux user> so thats what generics is
14:19:58FromDiscord<generic linux user> :|
14:20:00FromDiscord<haxscramper> those are two different concepts
14:20:22FromDiscord<Rika> typedesc and generics arent really one to one features
14:20:32FromDiscord<Rika> theyre almost completely differnet
14:20:35FromDiscord<haxscramper> typedesc is like "type-as-an-argument" while generic is not even something you can have "as is"
14:20:39FromDiscord<haxscramper> ^
14:20:57FromDiscord<Rika> yeah what he said
14:26:25arkanoidso, to sum up, the "type" syntax for argument types is just sugar for typedesc? Here's my experiments https://play.nim-lang.org/#ix=3tqx
14:30:42arkanoidI don't really feel like they are completely different. They are both way to pass generic types to proc and ask the compiler to produce overloaded version of it. Both can be inferred in many cases
14:31:28arkanoidbut here what puzzles me is "T: typedesc" VS "T: type" thing
14:31:59FromDiscord<haxscramper> IIRC `type` is deprecated, and they certainly have some difference
14:32:31FromDiscord<haxscramper> At least judging from my experience
14:32:54FromDiscord<haxscramper> You don't do `T: typedesc`, you do `proc procedure[T](arg: typedesc[T])`↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>)
14:33:31FromDiscord<haxscramper> Typedesc in this context is just a magical type that you use to resolve overloads
14:33:49arkanoidI might not be doing that, but it compiles and runs correctly
14:34:02FromDiscord<haxscramper> You can think of it as if each type had special variable of type `typedesc`, that you can pass to procedures
14:34:06FromDiscord<haxscramper> Something like that
14:34:21FromDiscord<haxscramper> yes, sure, it works most of the time
14:34:55FromDiscord<haxscramper> but when you get into "seemingly random generic type mismatches that you spend five hours on" territory things were different for me
14:35:13FromDiscord<haxscramper> So you are of course free to use whatever you want, I just want to warn you based on my experience
14:35:14arkanoidsure :D
14:35:55arkanoidI'm just trying to extrapolate good idiomatic nim code when dealing with types
14:37:47arkanoidso, when I want to do generics, I'm a good nim person when I do "proc foo[T](arg: typedesc[T])" or "proc foo[T](arg: T)"
14:37:55FromDiscord<haxscramper> idk if there is such thing as "idiomatic" nim code, but I assume it would be something quite different from what you are working on now
14:38:11FromDiscord<generic linux user> do we need the T tho?
14:38:49FromDiscord<generic linux user> this will do right?
14:38:56FromDiscord<generic linux user> sent a code paste, see https://play.nim-lang.org/#ix=3tqA
14:39:59arkanoidonly if you replace a+b with x+y :D
14:40:14FromDiscord<haxscramper> Idiomatic nim code for working with types probably uses `initT` or `newT`
14:40:17FromDiscord<generic linux user> oops
14:40:30FromDiscord<Rika> idiomatic ~~for now~~
14:40:39FromDiscord<generic linux user> (edit) "https://play.nim-lang.org/#ix=3tqA" => "https://play.nim-lang.org/#ix=3tqC"
14:40:40FromDiscord<haxscramper> But there is no consistency really, since we don't have usable deafult init
14:40:59FromDiscord<haxscramper> So I would rather use `init(T)`, `new(T)` or `default(T)`
14:41:01FromDiscord<Rika> some of us use `init(a: typedesc[mytype]): mytype` but not a lot of us
14:41:05arkanoidI've read that "init[MyType](self: type MyType)" is also used
14:41:13FromDiscord<Rika> please use typedesc
14:41:26arkanoidyes, I was just triggering the masses :D
14:41:38arkanoidI've just learned to prefer typedesc and avoid "type" thing
14:41:52FromDiscord<generic linux user> so thats not ok?
14:42:43FromDiscord<carmysilna> If I want to have an `Evaluator` Haskell typeclass or Java interface with the required method `evaluate(self: var Evaluator, term: Term) {.raises: [].}`, what's the normal way to do that in Nim?
14:43:04FromDiscord<Rika> runtime or compiletime
14:43:08FromDiscord<Rika> (i mean for enforcement)
14:43:35*mst quit (Ping timeout: 265 seconds)
14:44:05arkanoidgeneric linux user: https://play.nim-lang.org/#ix=3tqG
14:44:30FromDiscord<carmysilna> ideally compiletime but runtime would work as well, I anticipate there just being a few different instances I'd like to easily switch between
14:45:08FromDiscord<Rika> compiletime maybe look at concepts
14:45:17FromDiscord<Rika> runtime nim doesnt really have anything built in for such
14:45:47arkanoidyeah, I'd also go for https://nim-lang.org/docs/manual_experimental.html#concepts
14:46:05arkanoidbut there's also this https://github.com/nigredo-tori/classy
14:46:08fn<R2D299> itHub: 7"Typeclasses for Nim"
15:05:58*krux02 quit (Remote host closed the connection)
15:06:39*krux02 joined #nim
15:08:43*stkrdknmibalz quit (Ping timeout: 246 seconds)
15:09:08*mst joined #nim
15:15:09arkanoidis it possible to store an interator into a variable?
15:15:18FromDiscord<Rika> if it is a closure yes
15:15:55arkanoidand if not? https://play.nim-lang.org/#ix=3tr8
15:17:57FromDiscord<Rika> make it a closure
15:18:21FromDiscord<Rika> you can make any iterator (that you dont have access to the impl. of) into a closure this way:
15:18:32FromDiscord<Rika> wait
15:18:39FromDiscord<Rika> what's the issue here
15:18:41FromDiscord<Rika> i'm confused
15:23:27arkanoidwell I have 2 iterator, second one is a closure so I can put it into a var, first one is not
15:25:41arkanoidI've also tried adding {.closure.} to it, but yet not possible
15:25:59arkanoidwell I'll just wrap them all
15:30:56arkanoidwhoa I've just found a nim compiler bug
15:33:11FromDiscord<Rika> those arent hard to find
15:33:48arkanoidor possible of the VM
15:48:17arkanoidposted new issue. Probably is just a missing check, but it may lead to unwanted behavior at compile time https://github.com/nim-lang/Nim/issues/18528
15:55:30FromDiscord<Ayy Lmao> What's a good way to check periodically for some state change without messing with the thread? I'm still trying to wrap my head around proper async programming and I suck at it.
15:57:01*Vladar quit (Remote host closed the connection)
15:57:07fn<Prestige99> What are you trying to do exactly?
15:57:29FromDiscord<Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=3trk
15:57:43FromDiscord<Ayy Lmao> `GetProjectStateChangeCount` can tell me when the project changes, and I want to redraw a window whenever it does
15:59:24*Vladar joined #nim
15:59:37*max22- joined #nim
16:03:13arkanoidshouldn't noSideEffect pragma raise error if "var" arguments are passed? I mean, I do understand that having escape hatch is good, but noSideEffect should mean noSideEffect
16:04:26FromDiscord<carmysilna> According to my understanding, noSideEffect means no side effects, and changes to `var` parameters is not a side effect but an effect, because it is explicit in the signature
16:05:34FromDiscord<Rika> "just dont use var arguments"
16:06:12arkanoidyeah but this makes possible to use that escape hatch down the stack
16:06:19FromDiscord<haxscramper> if you said yourself it is `var` then whatever you do with it is not "side" effect
16:06:32FromDiscord<Rika> its not an escape hatch
16:06:36arkanoidI might be doing good, but the called code may be just faking noSideEffect, just like debugEcho
16:06:51FromDiscord<haxscramper> wait until you see `cast(noSideEffect)`
16:07:15FromDiscord<Rika> then there is nothing you can do
16:07:15arkanoidexactly
16:07:16FromDiscord<Rika> yeah
16:07:23FromDiscord<haxscramper> all over the place
16:07:39FromDiscord<haxscramper> well, if you really want
16:07:52arkanoiddebugEcho and cast(noSideEffect) should not exist
16:08:00FromDiscord<haxscramper> Like REALLY want to ban even cast you can use TRM
16:08:01FromDiscord<haxscramper> that just raises compile-time error
16:08:02arkanoidor they must be an internal compiler thing
16:08:15arkanoidTRM?
16:08:17FromDiscord<Rika> well sorry that your opinions do not align with ours
16:08:19FromDiscord<haxscramper> most peoples's response would be like "idk, I just wwant to write code"↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>)
16:08:21FromDiscord<Rika> term rewriting macro
16:08:41FromDiscord<Rika> aka something that's pretty damn buggy
16:08:51FromDiscord<Rika> one of the buggiest things in the nim compiler imo
16:09:05FromDiscord<haxscramper> https://forum.nim-lang.org/t/7837
16:09:09FromDiscord<haxscramper> see for my example in the end
16:09:24FromDiscord<Rika> In reply to @arkanoid "debugEcho and cast(noSideEffect) should": and rust `unsafe` shouldnt exist too?
16:09:36FromDiscord<haxscramper> It still does not work if you have a warning, but if it is an error it doesn't matter
16:09:40FromDiscord<haxscramper> `static: quit 1`
16:10:15krux02arkanoid, debugEcho and cast(noSideEffect) are made to leave the ideal world for a moment and deal with reality
16:10:16FromDiscord<haxscramper> Also noSideEffect can be used to explain things to compiler sometimes
16:10:37FromDiscord<haxscramper> Like in case of interop, where only you have the knowledge about the API
16:10:48arkanoidI don't know rust, but is it possible to guard yourself from calling unsafe code from higher level library?
16:10:53FromDiscord<Rika> no
16:11:11FromDiscord<haxscramper> parts of the stdlib is built on top of `unsafe` IIRC
16:11:13FromDiscord<Rika> there are things in rust that can only be implemented via unsafe afaik? at least someone told me about it (ehem)
16:11:37FromDiscord<haxscramper> calls to system APIs at least
16:12:00FromDiscord<carmysilna> In reply to @arkanoid "I don't know rust,": there is, via things like `cargo geiger` and `#![forbid(unsafe)]`
16:12:20krux02arkanoid, if you go deep enough everything is eventually made using unsafe assembly instructions
16:12:24FromDiscord<carmysilna> the concept of rust is safe abstractions over unsafe code though
16:12:27arkanoidkrux02: and what prevents nim package libs to gets polluted over time by fake pure functions?
16:12:37krux02arkanoid, nothing
16:13:02FromDiscord<Rika> In reply to @carmysilna "there is, via things": so does forbid just ignore std code?
16:13:20krux02arkanoid, what exactly do yea mean by "fake pure"?
16:13:22FromDiscord<Rika> or is std code actually devoid of unsafe?
16:13:29FromDiscord<Rika> In reply to @krux02 "arkanoid, what exactly do": casted nosideeffects
16:13:32arkanoidkrux02: like debugEcho
16:13:50krux02I mean it can be both: lie to the compiler, and deal with something that the compiler really can't figuer out on its own
16:13:57FromDiscord<Rika> it's a massive pain to debug functional code btw
16:13:59FromDiscord<carmysilna> In reply to @Rika "so does forbid just": forbid is for forbidding unsafe in your crate only, cargo geiger checks dependencies and ignores std
16:14:08krux02especially when wrapping C libraries
16:14:10FromDiscord<Rika> In reply to @carmysilna "forbid is for forbidding": okay gotcha
16:14:20FromDiscord<Rika> was just a question i wasnt building any argument
16:14:48krux02Rika: regaridng debug functional code, most of the time functional code (if the language allows it) just works and doesn't need to be debugged ;)
16:14:51FromDiscord<dom96> In reply to @haxscramper "parts of the stdlib": of course, you need to call into C libraries at some point, cannot do that without being `unsafe`
16:15:06FromDiscord<Rika> In reply to @krux02 "<@259277943275126785>: regaridng debug functional": haha i fucking wish 😄
16:16:16FromDiscord<Ayy Lmao> Is there a good example of doing an event loop with async code?
16:16:24FromDiscord<haxscramper> `rg -g ".nim" -F "{.cast(noSideEffect).}" | wc -l --> 103`
16:16:35FromDiscord<haxscramper> code processed\: \~8.8Gb
16:16:42FromDiscord<carmysilna> Seems like if you want "safety all the way down", arkanoid, you might want to look at cakeml or compucert
16:16:43FromDiscord<haxscramper> it seems we are safe
16:17:00FromDiscord<haxscramper> `rg -g ".nim" -F "{.noSideEffect.}:" | wc -l --> 157`
16:17:13FromDiscord<dom96> the nice thing about Rust's `unsafe` is that it makes analysing how much unsafe feature a library uses trivial
16:17:19arkanoidso, I can write purely functional nim programs until I start calling external nim code from my "funcs"
16:17:40FromDiscord<dom96> There was a time I suggested the same for Nim but can't win all the arguments 🙂
16:17:59FromDiscord<Rika> doesnt the cast() syntax work that way?
16:18:12krux02arkanoid, yes
16:18:28FromDiscord<haxscramper> it is pretty easy to find all """""unsafe"""""" parts of the code
16:18:28krux02C doesn't have a concept of "pure"
16:18:37FromDiscord<haxscramper> `cast/addr/unsafeAddr`
16:18:43krux02so you have to tell Nim somehow if something is pure or not.
16:18:47arkanoidkrux02: I said external nim code, not C
16:18:56krux02And that can of course be a source of problems/bugs.
16:19:02FromDiscord<haxscramper> Though really unsafe part of the language is called `macro`, but it only blows you mind sometime,
16:19:03FromDiscord<dom96> haxscramper: not really, your `ptr` can be passed all around the place
16:19:06krux02arkanoid, ok
16:19:09krux02sorry
16:19:25krux02for me external code is everything that isn't Nim ;)
16:19:31FromDiscord<dom96> so the analysis becomes much more complex than just "find unsafe blocks"
16:19:31FromDiscord<haxscramper> well, ok, if we treat any `ptr` as unsafe then yes↵(@dom96)
16:19:41FromDiscord<dom96> well... it is unsafe
16:20:03arkanoidyeah, I mean external pure-nim module. Something I install from nimble and it 100% nim
16:20:03FromDiscord<haxscramper> but still, we can treat it as some kind of taint mdoe
16:20:05FromDiscord<carmysilna> I mean, Rust doesn't even have a concept of purity or effect tracking, so its probably worse than Nim in this regard
16:20:06FromDiscord<haxscramper> tain mode
16:20:26FromDiscord<Rika> In reply to @carmysilna "I mean, Rust doesn't": thats honestly surprising
16:20:38FromDiscord<dom96> an "Unsafe" effect would be nice in Nim
16:20:40FromDiscord<Rika> of all languages i thought theyd have the most robust effect tracking
16:20:55FromDiscord<haxscramper> I think we can audit nim modules based on the IC cache left after their test run
16:20:57FromDiscord<haxscramper> for example
16:20:59FromDiscord<Rika> cuz i mean isnt functional pushed so hard in rust?
16:21:07FromDiscord<dom96> but ultimately you'd need a `unsafe` block to allow the "unsafe" code... so we're back to Rust 🙂
16:21:45FromDiscord<carmysilna> functional features, but not functional purity. Rust feels like systems-level Ocaml, and Nim feels like systems-level Koka, maybe.
16:22:01FromDiscord<Rika> maybe there should be a mode where `cast()` is ignored
16:22:05FromDiscord<Rika> thought
16:22:07FromDiscord<Rika> though
16:22:14FromDiscord<Rika> that would be an issue for the standard library
16:22:20FromDiscord<Rika> i'm thinking a bit too fast today
16:22:23FromDiscord<haxscramper> it is a linter problem really
16:22:43FromDiscord<dom96> haxscramper: yes, with Nim's AST you can do anything. But doesn't change the fact that it's a complex analysis
16:22:57FromDiscord<dom96> Pretty sure you'd need to track where `ptr` gets passed around
16:22:58FromDiscord<haxscramper> yes, things like that are not trivial
16:23:00arkanoidNim effect tracking is one of the most promising feature to me. Calling nim code by other author's that can cheat noSideEffect while still being in pure nim is a big lie to the programmer
16:23:03FromDiscord<Rika> what constitutes "good fake effects" and "bad fake effects" anyway?
16:23:28FromDiscord<dom96> You can probably get a pretty good estimate of how unsafe a module is by just counting `ptr`/`addr`/`cast` etc though
16:23:31FromDiscord<Rika> because sometimes it really is needed to cast(), just like sometimes it really is needed to go unsafe in rust
16:23:37FromDiscord<carmysilna> I'm not concerned about the var in func issue, as a Haskell/Rust person, because its essentially using an `IORef`. It doesn't affect anything outside of what you give it, and mutation is explicit
16:24:03FromDiscord<Rika> In reply to @carmysilna "I'm not concerned about": yeah thats the argument i imagine the other core devs of nim would say
16:24:29FromDiscord<Rika> the cast() issue is interesting to think about though
16:24:37FromDiscord<haxscramper> also you can overload based on side effects in the ast, if you want
16:24:37arkanoidyeah the "var" thing is not too bad. The cast is
16:24:49FromDiscord<haxscramper> I think that part is not as buggy as TRM
16:25:02FromDiscord<carmysilna> I like noSideEffects as a way to enforce "no IO" even if it isn't Haskell level of purity. Every language has escape hatches, except for maybe Coq or Agda but that's not Nim's niche
16:25:10FromDiscord<dom96> `cast` is "unsafe"
16:25:23FromDiscord<Rika> Coq is basically mathematical proving anyway though isnt it
16:25:33FromDiscord<dom96> not sure why you'd consider `cast` bad
16:25:33FromDiscord<Rika> you're basically always rigorous when you use Coq
16:25:35FromDiscord<dom96> it's a necessity
16:25:36FromDiscord<carmysilna> yeah, its an automated theorem prover in a language
16:25:56FromDiscord<carmysilna> Agda is a bit more of a programming language that is usable than coq, I like it better
16:25:57FromDiscord<Rika> as ive said above, there are legitimate uses for cast
16:26:30FromDiscord<haxscramper> like binary serialization
16:27:19arkanoidI'm talking about casting a function that has side effects into a "noSideEffect" one, not casting types to types
16:27:23FromDiscord<Rika> the main issue is basically deliberating "good" from "bad", legitimate from abuse, which is pretty much impossible to automate
16:27:31FromDiscord<Rika> yes
16:27:32FromDiscord<Rika> we know
16:28:57FromDiscord<dom96> there are other escape hatches too, you can always just call a side effect proc via `{.emit: """myProc();""".}`
16:29:36FromDiscord<dom96> I'd say Nim's philosophy here is to be pragmatic here, so you'll find lots of things like this
16:29:42FromDiscord<dom96> (edit) "pragmatic here," => "pragmatic,"
16:30:10arkanoidOh dear. Is there a list of escape hatches? They really should be on the Wanted list then function up the stack goes "func"
16:31:47FromDiscord<haxscramper> IIRC only `cast`
16:31:49arkanoidbeing able to separate pure logic from IO at the edge is top rule for "being pragmatic" when dealing with larger programs
16:32:24FromDiscord<haxscramper> Old syntax was `{.nosideEffect.}` and it is still supported
16:32:35FromDiscord<haxscramper> you can also count `{.emit:.}` in if you want
16:32:42FromDiscord<Rika> wdym hax? dom just said some code could have some emit that calls a C func that has side effects
16:32:48FromDiscord<Rika> yeah
16:33:06FromDiscord<Rika> we should probably have a list of "unsafe" stuff no?
16:33:23FromDiscord<Rika> though that might include basically a fourth of the lang i assume
16:33:34FromDiscord<haxscramper> I personally not a big fan of this really
16:33:52arkanoidhaxscramper, why not?
16:34:00FromDiscord<haxscramper> if I do `cast` I know what I'm doing
16:34:15FromDiscord<dom96> In reply to @Rika "we should probably have": yep, we should
16:34:15FromDiscord<Rika> basically people dont want other people telling then what to do
16:34:17FromDiscord<Rika> (edit) "then" => "them"
16:34:35FromDiscord<Rika> its pretty much the unspoken rule nim has been following
16:35:09FromDiscord<haxscramper> And about IO/logic separation - `debugEcho` is for debugging
16:35:09FromDiscord<haxscramper> And a lot of things are the same way
16:35:24FromDiscord<haxscramper> Not logic/IO but rather just convenience
16:35:58FromDiscord<haxscramper> and it called `debug` anyway, so it is pretty clear even from reading the code
16:36:22arkanoidhaxscramper, you can do cast, but if you do that in a func that then you export and other programmer use in a func, they should get a error/warning static that that is not really a func due to imported code
16:36:23federico3debugging, benchmarking, generating application metrics
16:36:24FromDiscord<haxscramper> That one too↵(@Rika)
16:36:31FromDiscord<Rika> in the end nim does not lean hard towards a kind of side, the core devs prefer the best compromise for real world scenarios
16:37:05FromDiscord<Rika> In reply to @arkanoid "<@608382355454951435>, you can do": error no, maybe a warning
16:37:09FromDiscord<haxscramper> arkanoid\: as I said earlier, it is a linter problem
16:37:58FromDiscord<haxscramper> I can write an example linter that does find this if you want
16:38:02arkanoidRika, whatever, but something that can make the programmer aware of a side effect happening inside of his noSideEffect code
16:38:15FromDiscord<carmysilna> sent a code paste, see https://play.nim-lang.org/#ix=3try
16:38:36FromDiscord<carmysilna> (And it succeeds where it should fail with that input)
16:39:27arkanoidhaxscramper, it is not a linter issue, as compiler is capable of tagging noSideEffect and raises automatically by itself
16:39:52FromDiscord<haxscramper> `noSideEffect` says to compiler "there is no side effects"
16:40:08FromDiscord<haxscramper> how it is supposed to know the inner meaning of your code if someone just said otherwise
16:40:29FromDiscord<haxscramper> Like we literally just told it to not look here, so it doesnt
16:40:50FromDiscord<Rika> as ive said, maybe there should be a flag where cast(nse) or any cast() pragma would be ignored
16:40:59FromDiscord<Rika> that way the user could choose if they wanted it or not
16:41:54arkanoidI bet the compiler knows if escape hatches are used down the stack when tracking noSideEffects issues
16:43:01arkanoidI expect debugEcho to output a warning at compile time too, if called from a func (so basically the proper use of it)
16:43:14FromDiscord<Rika> it could know if it ignored such escape hatches
16:43:30FromDiscord<Rika> i mean this idea sounds good enough for me now
16:43:35FromDiscord<Rika> a warning sounds fine to me
16:44:39FromDiscord<haxscramper> https://github.com/nim-lang/Nim/blob/73ce40aaf71196faa08072216bd826a94b5d40b1/compiler/sempass2.nim#L893
16:44:54FromDiscord<haxscramper> `if bc.enforceNoSideEffects: tracked.inEnforcedNoSideEffects = true`
16:45:09FromDiscord<haxscramper> https://github.com/nim-lang/Nim/blob/73ce40aaf71196faa08072216bd826a94b5d40b1/compiler/sempass2.nim#L1129-L1147
16:46:09FromDiscord<haxscramper> that's where `cast(noSideEffect)` is implemented probably
16:49:47arkanoidnice spot
16:54:27FromDiscord<dom96> The amount of times I forget to `close` my fds in Nim is crazy
16:54:44FromDiscord<zidsal> sent a code paste, see https://play.nim-lang.org/#ix=3trA
16:54:53arkanoidfds?
16:55:03FromDiscord<dom96> file descriptors
16:55:14arkanoidoh! is defer still a thing?
16:55:31arkanoidI heard araq doest like them anymore
16:55:40arkanoidfor good reason, I'd say
16:55:44FromDiscord<carmysilna> linear types would be helpful in this scenario, I don't know if those are in the works for nim at all
16:57:02FromDiscord<dom96> I think we've got destructors now
16:57:14FromDiscord<carmysilna> sent a code paste, see https://play.nim-lang.org/#ix=3trB
16:57:15FromDiscord<dom96> problem is... how can we add destructors when most code calls `close`? 🙂
16:57:32FromDiscord<dom96> also I wonder if destructors work at all for async code
16:58:59FromDiscord<zidsal> @carmysilna thats a good question... the testament documentation doesn't mention about `cat .` I can't remember where I got that from, just saw it in my .nimble file
16:59:08*aeverr quit (Ping timeout: 255 seconds)
17:01:04*aeverr joined #nim
17:03:58FromDiscord<zidsal> @carmysilna from what I remember testament only looks for files in `By default Testament looks for test files on "./tests/.nim"` so if you put youre tests in a sub folder it won't find them
17:04:24FromDiscord<carmysilna> it isn't in a subfolder, just `./tests/taddition.nim`
17:04:55FromDiscord<zidsal> hmmm I'll defer to someone who can explain why testament cat . works 😛
17:05:07FromDiscord<zidsal> (edit) "hmmm I'll defer to someone who can explain why testament cat . works 😛 ... " added "I clearly stole this from someone else's nimble file"
17:13:00*rockcavera joined #nim
17:13:00*rockcavera quit (Changing host)
17:13:00*rockcavera joined #nim
17:27:58FromDiscord<konsumlamm> is Nim's effect system used for anything besides exceptions and side effects?
17:30:18arkanoidkonsumlamm, what do you mean?
17:30:40FromDiscord<haxscramper> you can in theory add some metadata to procs with it
17:30:56arkanoidyou mean with tags?
17:30:57FromDiscord<haxscramper> but that is `std::enable_if` level of madness
17:31:05FromDiscord<haxscramper> yes
17:31:33arkanoidI like the fact that I can list the effects at any point in code
17:31:39FromDiscord<haxscramper> kind of curious if you can use `static` in effect annotation
17:31:49FromDiscord<konsumlamm> you can if you annotate them
17:32:16FromDiscord<konsumlamm> but how will you know what code doesn RNG by default? that's also an effect arguably
17:32:24arkanoidwait, what is effect annotation? Are you talking about custom effect?
17:32:48FromDiscord<konsumlamm> Nim supposedly has an effect system
17:33:17FromDiscord<konsumlamm> at least that's what you were talking about for the last few hours
17:33:20FromDiscord<konsumlamm> that's what i'm talking about
17:33:39arkanoidyes, I know, but your question was not clear to me
17:33:47FromDiscord<haxscramper> https://wandbox.org/permlink/k0vnmzoNYqhPNpSn
17:33:49FromDiscord<haxscramper> no, I can't
17:33:57arkanoidafaik, nim effect system means: noSideEffect, raises and tags
17:34:13FromDiscord<haxscramper> Or rather I can't easilyu access generic parameters for an effect
17:34:57FromDiscord<haxscramper> Otherwise I could put static set of flags to it and Do something like `WriteIOEffect[{WriteFile}]`
17:35:20arkanoidok, you were talking about custom effects
17:36:32FromDiscord<haxscramper> It seems like interpreted the question incorrectly
17:36:52FromDiscord<konsumlamm> i was asking about custom effects and potential other builtin effects
17:36:59FromDiscord<konsumlamm> if they're used anywhere
17:37:20FromDiscord<konsumlamm> because as is, it doesn't look like a Koka-like effect system
17:37:29FromDiscord<konsumlamm> but tbf i haven't really looked at either in detail
17:37:56FromDiscord<konsumlamm> a `static` effect sounds very interesting tbh
17:38:01FromDiscord<haxscramper> No, no package defines derivative from root effect
17:38:51FromDiscord<haxscramper> Or to be more precise - I have to additional effects for my os wrapper
17:38:52FromDiscord<haxscramper> `ShellExecEffect`
17:39:26FromDiscord<konsumlamm> btw, what's the problem with `std::enable_if`? D uses something similar throughout its stdlib and it seems to work fine for them
17:39:42FromDiscord<haxscramper> there is no problem with `std::enable_if` itself
17:39:56FromDiscord<haxscramper> I have problems with how it is implemented
17:41:42fn<ForumUpdaterBot99> New thread by GamzWithJamz: Youtube "Software Drag Racing" to count primes in Nim, see https://forum.nim-lang.org/t/8247
17:41:53arkanoidI'm not sure I'm following you
17:42:18FromDiscord<haxscramper> To be honest, I have problems with how most of the C++ stdlib is implemented
17:42:38FromDiscord<haxscramper> Just insane pile of garbage on top of garbage that doesn't even provide any useful API
17:44:04arkanoidC++ is nowadays like DNA, 90% are just vestigial traits unused but yet there
17:49:25arkanoidis it required to extend RootEffect? The nim manual just defines an object and use that in tags
17:51:52FromDiscord<haxscramper> It is not required, but I assume it is generally advised to
17:52:05FromDiscord<haxscramper> Just like `CatchableError`
17:53:26FromDiscord<haxscramper> By the way, on topic of `debugEcho` specifically - I think it is very good thing there are simple escape hatches for things like that, because otherwise you would have to convert `func` to `proc` just print some values
17:53:42FromDiscord<haxscramper> And in my case, I would just leave things to be `proc`
17:54:21FromDiscord<haxscramper> Since it is too annoying to deal with this. But if I just need an escape hatch for quick debugging, that I don't intend to leave
17:55:33arkanoidI'm ok with the escape hatch, but that should not be included in shared code, and if it's there should at least raise a big yellow warning to the next programmer
17:55:42FromDiscord<haxscramper> And I have the ability to quickly do what I need and then clean up without too much pain it makes is simpler for me to work cleanly
17:57:00arkanoidproblem is not debugEcho while developing your code. Problem is "import thatGithubModule" and then "func myFoo() = thatGithubFunc()"
17:57:37FromDiscord<haxscramper> I will see what I can do with that in haxdoc
17:57:40arkanoidif you state that's a func, it should be noSideEffect all way down the stack, and raise a warning otherwise
17:59:02FromDiscord<konsumlamm> it even says in the name that it's only supposed to be used for debugging...
17:59:16FromDiscord<konsumlamm> Haksell also has `trace` to print in pure functions and noone complains
17:59:24FromDiscord<konsumlamm> (edit) "Haksell" => "Haskell"
17:59:31FromDiscord<haxscramper> I bet there are people who complain
17:59:49FromDiscord<konsumlamm> not a meaningful amount at least
17:59:53FromDiscord<haxscramper> And we don't have a lot of complaints about that either
18:00:00FromDiscord<haxscramper> What people do complain about is horrible 'has side effect' message
18:03:29arkanoidyou're watching the finger and not the moon. Problem is not debugEcho per-se, but the tool made to make it work. It is quite obvious that a std tool uses that escape hatch right, but you don't get a warning when running code from the community that uses it possible badly
18:05:42arkanoidyou might say: just read code you imports, but then you can extend that to all effects. Just track all exceptions and tags manually
18:06:06FromDiscord<haxscramper> yes, it is a problem, but I would assume people who don't care about side effects just use `proc`
18:06:40FromDiscord<haxscramper> So yes, if someone deliberately creates incorrect package that uses `func` and casts it is a problem
18:07:11FromDiscord<haxscramper> But as long as I can nuke your pc with a macro I don't think we can consider it a problem
18:07:42FromDiscord<haxscramper> note that is not "there are worse things" argument
18:08:18arkanoidwell, would you be able to nuke my pc with a macro if I would call it from a func?
18:08:34FromDiscord<haxscramper> I can nuke your PC at compile-time
18:08:50FromDiscord<haxscramper> Well, even at the moment you install package
18:09:06FromDiscord<carmysilna> I think I agree with Rika here, this is a tool for a linter. Your `cargo geiger` (which is written outside of Rust core, its a plugin) equivalent can scan all your dependencies and display where they cast or use debugEcho
18:09:11FromDiscord<haxscramper> A lot of package managers can do that
18:09:51FromDiscord<haxscramper> At some point community creates a linter with additional diagnostics not covered by compiler
18:10:04FromDiscord<haxscramper> For almost any language
18:10:17FromDiscord<Justaus3r (Justaus3r)> Hello↵I am an intermediate python programmer,just got on nim yesterday and i am really interested in learning it.i have started learning it.i a have a question can we convert int into string in nim .i tried it with string(thenumber) but it didn't work
18:10:36arkanoidwell, sure, at compile time you can mess around build env. But that's not nim fault or responsibility just like you can nuke with a Makefile
18:10:37FromDiscord<haxscramper> And that linter includes much broader notion of what is bad od what is convert
18:10:44FromDiscord<haxscramper> `$12`
18:11:06FromDiscord<haxscramper> In general for "anything to string" you do `$<your expression>`
18:11:24FromDiscord<haxscramper> `$` is a universal to-string conversion operator for all types
18:12:42FromDiscord<Justaus3r (Justaus3r)> Thanks its very helpful since nim is relattively new programming languages and there arent many sources for learning it but i really like it for its efficeincy and speed and wanna learn it do you have any sources?
18:12:57arkanoidapart from exceptional cases, it is not generally the case of a dev tool that nukes dev build system. It is more a problem of correctness of build output and trust
18:14:07arkanoidnot so new, I'd say. Nim is quite adult. Well, I'd say it is more an Axolotl
18:14:14*pro joined #nim
18:15:01FromDiscord<konsumlamm> adult maybe, but not so much mature, imo at least
18:15:08FromDiscord<haxscramper> https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers
18:15:08FromDiscord<haxscramper> https://nim-lang.org/documentation.html
18:16:01FromDiscord<Justaus3r (Justaus3r)> thnx
18:17:11FromDiscord<haxscramper> god, this "nim for programmers" is three times longer than I remember it
18:17:11FromDiscord<haxscramper> `> 489 revisions`
18:18:04arkanoidPattern Matching builtin ?
18:18:15FromDiscord<konsumlamm> no?
18:18:39arkanoidby macro implementation, maybe?
18:18:46FromDiscord<konsumlamm> yes
18:19:04FromDiscord<konsumlamm> https://nim-lang.org/blog/2021/03/10/fusion-and-pattern-matching.html
18:20:49arkanoidah, ok, that implementation. I'm still puzzled if general nim descriptions should cover just std, std+fusion or all available modules
18:22:13arkanoidjust found out there's a linter project https://github.com/nim-dev/nimlint
18:22:16fn<R2D299> itHub: 7"nimlint makes developing softer."
18:22:54FromDiscord<Justaus3r (Justaus3r)> > `$` is a universal to-string conversion operator for all types↵sorry for the bother! but are there any other universal type converter's or only for strings.
18:23:48FromDiscord<haxscramper> Universal - no, but `std/json` defines `%` to convert some thing to json
18:24:49FromDiscord<Justaus3r (Justaus3r)> ah great!,again thnx
18:33:02*pro quit (Quit: WeeChat 3.2)
18:35:55FromDiscord<bernardo> can someone point me to some documentation to help me understand `do`?
18:36:20*pro joined #nim
18:37:40FromDiscord<bernardo> ah nvm, found it https://nim-lang.org/docs/manual_experimental.html#do-notation
18:44:41FromDiscord<gerwy> https://media.discordapp.net/attachments/371759389889003532/866752418545270794/Screenshot_from_2021-07-19_20-40-47.png
18:44:50FromDiscord<gerwy> im trying to install nim's lsp into sublime
18:45:12FromDiscord<gerwy> and it shows up every time i open sublime
18:45:44FromDiscord<gerwy> i think i did everything right, pls halp :C
18:53:56fn<ForumUpdaterBot99> New thread by Haxscramper: How to default non-trivial argument with `staitc[]` type, see https://forum.nim-lang.org/t/8248
18:54:12FromDiscord<gerwy> okay i fixed it nevermind, but still, only `go to definition` works :< so idk if its alright or not
19:08:48*krux02_ joined #nim
19:11:04*krux02 quit (Ping timeout: 256 seconds)
19:13:32fn<Prestige99> the lsp server can be finnicky
19:28:54nixfreak_nim[m]Is there a way to visualized this on the stack https://play.nim-lang.org/#ix=3ts6
19:29:37nixfreak_nim[m]I'm curious why i + 1 has to be used instead of just (i)
19:29:46nixfreak_nim[m]cause they are both 15 chars
19:31:44*pro quit (Quit: WeeChat 3.2)
19:32:11FromDiscord<gerwy> i got lsp to work on sublime now its pretty good and working
19:32:52FromDiscord<gerwy> but now i can't fucking build it... there is something wrong with build system because it doesn't know where the nim is even if i have it in $PATH or added to NimLime
19:36:15FromDiscord<System64 ~ Flandre Scarlet> How can I convert that to Nim please? https://media.discordapp.net/attachments/371759389889003532/866765392822403101/unknown.png
19:40:38fn<Prestige99> could just use strings for songName author and comments?
19:40:56FromDiscord<System64 ~ Flandre Scarlet> there is a char limit
19:41:10FromDiscord<gerwy> use ropes for comments maybe
19:41:19nixfreak_nim[m]<nixfreak_nim[m] "I'm curious why i + 1 has to be "> do you have to create a new string ? couldn't you just point to the existing one in memory then take those chars in reverse ?
19:42:03FromDiscord<System64 ~ Flandre Scarlet> and can I do cstring[]?
19:43:05nixfreak_nim[m]I'm not complaining I'm just really curious , so cstring characters ?
19:43:06FromDiscord<haxscramper> `array[4, array[12, char]]`
19:43:29FromDiscord<haxscramper> If you have array with static sizes it is pretty safe to wrap them as arrays
19:43:35*krux02_ quit (Read error: Connection reset by peer)
19:43:57*krux02 joined #nim
19:45:07FromDiscord<System64 ~ Flandre Scarlet> again it's for C interop
19:45:38FromDiscord<haxscramper> Yes, I know you do it for C interop
19:46:25nixfreak_nim[m]so you could actually reverse a string without creating a new string placeholder
19:49:41nixfreak_nim[m]like this I understand https://www.w3schools.in/c-program/reverse-a-string-in-c/
19:49:43FromDiscord<System64 ~ Flandre Scarlet> There is an underscore on the c code but Nim doesn't like it https://media.discordapp.net/attachments/371759389889003532/866768784013393940/unknown.png
19:50:24*nixfreak_nim[m] < https://libera.ems.host/_matrix/media/r0/download/libera.chat/4a5bee88be0753de0b20545fe904bb868ad4cd5b/message.txt >
19:51:53FromDiscord<haxscramper> `nimSafeName: {.importc:_XXXXX_ImCfIeLd".}`↵(@System64 ~ Flandre Scarlet)
19:52:22nixfreak_nim[m]I get everything but translated
19:52:58nixfreak_nim[m]just trying to understand this better
19:53:35FromDiscord<System64 ~ Flandre Scarlet> In reply to @haxscramper "`nimSafeName: {.importc:_________XXXXX_ImCfIeLd".}`": I put that above my var?
19:55:20FromDiscord<gerwy> In reply to @Life Sucks "but now i can't": okay so it wasn't able to find nim but i just made a link to where the nim is and well it works loool its so bad but it works so its the only thing that matters
19:58:19*max22- quit (Remote host closed the connection)
20:00:46*max22- joined #nim
20:03:36FromDiscord<System64 ~ Flandre Scarlet> ah no I understood
20:04:03*xet7 quit (Remote host closed the connection)
20:04:57*xet7 joined #nim
20:06:06fn<ForumUpdaterBot99> New thread by Moigagoo: Migrated Norm docs to nimibook and loving it!, see https://forum.nim-lang.org/t/8249
20:06:34FromDiscord<jfmonty2> Is it possible to alias a subset of an enum? E.g. if I have `type Country = US, CA, UK, FR, IT` and I want `type NACountry = US, CA`, but I want everything that accepts a `Country` to also accept an `NACountry`?
20:06:42FromDiscord<jfmonty2> Kind of a contrived example
20:27:26FromDiscord<konsumlamm> it is, with a range type: `type NACountry = range[US..CA]`
20:46:09FromDiscord<hamidb80> hey
20:46:34FromDiscord<hamidb80> how can i use custom http method?
20:46:35FromDiscord<hamidb80> > Unhandled exception: Invalid HTTP method name: COPY [ValueError]
20:47:23FromDiscord<hamidb80> there are some situations that the APIs violate the standards
20:49:48FromDiscord<carmysilna> sent a code paste, see https://paste.rs/Rcd
20:51:05FromDiscord<hamidb80> https://media.discordapp.net/attachments/371759389889003532/866784228938743868/unknown.png
20:51:18FromDiscord<hamidb80> https://docs.couchdb.org/en/latest/api/document/common.html#copy--db-docid
20:51:31FromDiscord<hamidb80> i wanna make a "COPY" request
20:51:48FromDiscord<hamidb80> In reply to @hamidb80 "> Unhandled exception: Invalid": but the compiler complains
20:53:11FromDiscord<hamidb80> sent a code paste, see https://play.nim-lang.org/#ix=3tsj
20:54:05FromDiscord<carmysilna> https://nimble.directory/search?query=http
21:04:40*Vladar quit (Quit: Leaving)
21:22:30FromDiscord<treeform> In reply to @hamidb80 "i shoudl use external": my lib supports any verb: https://github.com/treeform/puppy
21:22:32fn<R2D299> itHub: 7"Puppy fetches HTML pages for Nim."
21:25:50*Mister_Magister joined #nim
21:26:00Mister_MagisterCan you write scripts in nim?
21:26:24FromDiscord<carmysilna> https://nim-lang.org/docs/nims.html
21:27:52Mister_Magisterthat was quick, thanks!
21:28:14fn<ForumUpdaterBot99> New thread by Rbohl64: Guidance on Isolating Memory Leak, see https://forum.nim-lang.org/t/8251
21:28:23FromDiscord<treeform> also scripts might means many things
21:28:54FromDiscord<treeform> for some it means scripting languages which are interpreted which is what nims is.
21:29:12FromDiscord<treeform> for other it means can I write small little utilities that run on command line, for that you can use regular nim.
21:29:54Mister_Magisterbasically #!/bin/nim textfile or something like that xd
21:34:45FromDiscord<ElegantBeef> You can also use https://github.com/PMunch/nimcr
21:34:47fn<R2D299> itHub: 7"<No Description>"
21:49:18FromDiscord<RattleyCooper> Anybody working on anything related to WebRTC?
21:50:02FromDiscord<RattleyCooper> (edit) "WebRTC?" => "WebRTC in Nim?"
21:53:31*krux02 quit (Quit: Leaving)
22:04:38*oprypin quit (Read error: Connection reset by peer)
22:04:45*oprypin_ joined #nim
22:08:25fn<ForumUpdaterBot99> New post on r/nim by grimonce: Well I just started using nim, see https://reddit.com/r/nim/comments/onoh0j/well_i_just_started_using_nim/
23:03:10FromDiscord<konsumlamm> i'm sick of `expression '' has no type (or is ambiguous)`
23:03:16FromDiscord<konsumlamm> it's such a useless error message
23:03:30FromDiscord<carmysilna> yes
23:04:34FromDiscord<dan> guys its time for me to bother you about build integration again
23:04:42FromDiscord<ElegantBeef> Time for distinct nim nodes to ensure the AST is never incorrect
23:05:03FromDiscord<dan> is it possible to specify an executable for the c compiler on the command line?
23:05:14FromDiscord<dan> i mean directly
23:05:15FromDiscord<ElegantBeef> `--cc:gcc`
23:05:30FromDiscord<ElegantBeef> You can probably change the nim config file
23:05:35FromDiscord<dan> but that really isnt a path or something along that line
23:05:49FromDiscord<dan> oh man ... the config file
23:06:47FromDiscord<dan> i do get the impression that nim's design is pretty hostile when it comes to integrating with anything else that isnt nim
23:06:57FromDiscord<carmysilna> nim.cfg will be loaded as a bunch of command line arguments, right?
23:07:11FromDiscord<carmysilna> In reply to @dan "i do get the": doesn't seem that way to me, c interop seems very painless
23:07:21FromDiscord<dan> only if nim is the boss though
23:07:26FromDiscord<dan> not if it needs to fit in
23:10:21FromDiscord<carmysilna> I think nimpy for example lets you import nim stuff as python. Could you give an example of a language that is easy to build off of? (Now that I ask, I see that C is. Any others?)
23:11:20FromDiscord<dan> something that dlang does do very well is make it easy for the programmer to produce object files that fit in with the rest of the build nicely
23:12:02*max22- quit (Remote host closed the connection)
23:12:18FromDiscord<dan> especially with the whole betterC thing now. and that is worth a lot. dont get me wrong, in the end im sitting here and struggling to bring nim into a larger build for days and i like it more.
23:13:04FromDiscord<dan> but it really is a pain to make it comply to the restrictions i have on the build ... cant even really guarantee it uses the same gcc out of the different ones i have installed on the command line
23:13:25FromDiscord<dan> specify it one the command line
23:13:38FromDiscord<dan> its worse with msvc
23:13:54FromDiscord<dan> but then again ... everything kinda is with michaelsoft
23:15:09FromDiscord<dan> i do really want to use nim for some project at work. it pains me that its so hard to get it to bend to the will of the build system overlords
23:17:51FromDiscord<dan> maybe it would alleviate some barriers of adoption if people had an easier time rewriting just smaller parts of a project in nim and not the whole thing
23:18:36FromDiscord<dan> just my 2 cents though and i am fairly biased towards HPC
23:53:28*tiorock joined #nim
23:53:28*tiorock quit (Changing host)
23:53:28*tiorock joined #nim
23:53:28*rockcavera is now known as Guest124
23:53:28*Guest124 quit (Killed (cadmium.libera.chat (Nickname regained by services)))
23:53:28*tiorock is now known as rockcavera