<< 22-07-2023 >>

00:21:46FromDiscord<Elegantbeef> One could technically implement `is` for `a, b: bool` but it's just wrong
00:41:58*azimut quit (Ping timeout: 240 seconds)
01:00:02*zaher quit (Ping timeout: 244 seconds)
01:15:05FromDiscord<bostonboston> amazing idea
02:34:48*rockcavera quit (Remote host closed the connection)
04:09:52FromDiscord<wannabelokesh> I really don't know anything about binding libraries. Is it like using C code inside Nim, V, D or any other language? what is interoperability in this regards?↵(@xtrayambak)
04:18:37FromDiscord<Elegantbeef> It's technically not using C code inside Nim, C is just the language used to describe ABIs(sadly)
04:18:40FromDiscord<Elegantbeef> But yes you can think of it that way
04:26:11FromDiscord<bung8954> how to wrap constant NSString
04:27:27FromDiscord<takemichihanagaki3129> sent a long message, see http://ix.io/4Baq
04:28:30FromDiscord<takemichihanagaki3129> (edit) "http://ix.io/4Baq" => "http://ix.io/4Bar"
04:33:26FromDiscord<takemichihanagaki3129> Example: https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-header-pragma
04:34:32FromDiscord<Elegantbeef> The reason this process exists is that not all languages have the same semantics as the implementation language, so a bridge has to exist. This bridge is documented using C as it's a language with very few abstractions and popular. Technically though it could be written in any language
04:34:40FromDiscord<Elegantbeef> It's all about code reuse in the end
04:35:15FromDiscord<Elegantbeef> I will die on the hill that C was a mistake to use for ABI
04:38:08FromDiscord<takemichihanagaki3129> sent a long message, see https://paste.rs/7SFut
04:38:49FromDiscord<takemichihanagaki3129> (edit) "http://ix.io/4Baw" => "http://ix.io/4Bav"
04:39:41FromDiscord<takemichihanagaki3129> (edit) "http://ix.io/4Bav" => "https://paste.rs/A0fcy"
04:40:09FromDiscord<takemichihanagaki3129> (edit) "http://ix.io/4Bay" => "http://ix.io/4Baz"
04:46:03FromDiscord<Elegantbeef> > That's why we can write GUI applications in scripting languages, for example.↵Shit, I liked libraries, but you've swayed me I now despise them.
05:41:20*junaid_ joined #nim
06:05:39*ntat joined #nim
06:22:07FromDiscord<uninnocent> sent a code paste, see https://play.nim-lang.org/#ix=4BaN
06:22:28FromDiscord<uninnocent> sent a code paste, see https://play.nim-lang.org/#ix=4BaO
06:22:39FromDiscord<uninnocent> (edit)
06:22:45FromDiscord<uninnocent> (edit)
06:23:06FromDiscord<terrygillis> Can the resizing factor of seq be overwritten?
06:23:38FromDiscord<Elegantbeef> No it's statically written
06:24:25FromDiscord<uninnocent> In reply to @terrygillis "Can the resizing factor": no
06:25:24FromDiscord<terrygillis> Just toying around a bit nothing important, but it seems the only way to write your own DIY resizing array is to write unsafe nim code, right?
06:25:24FromDiscord<Elegantbeef> Or use `seq` with `setLen`
06:25:30FromDiscord<Elegantbeef> Unless you mean from scratch, then yes
06:32:40FromDiscord<terrygillis> I wonder what is it about resizing arrays that both Rust (low-level) and Nim (high-level) have to resort to unsafe code to implement while it’s pretty easy in Java.
06:33:07FromDiscord<Elegantbeef> Well Nim hardcodes it
06:33:14FromDiscord<Elegantbeef> You can just do `setLen`
06:36:19FromDiscord<Elegantbeef> The thing is though if you could set a custom growth rate on a sequence that's another integer that has to stored and copied, it's not much but it's something to be concerned of
06:36:20FromDiscord<terrygillis> I read somewhere that it has something tricky that vec in rust have to unsafe code to do it
06:36:34FromDiscord<terrygillis> interesting things
06:36:52FromDiscord<terrygillis> i just take it as given in higher languages like java or python
06:37:16FromDiscord<Elegantbeef> Technically you could fork this to access a procedure that returns a resizes it https://github.com/nim-lang/Nim/blob/devel/lib/system/cellseqs_v2.nim#L19-L25
06:37:42FromDiscord<Elegantbeef> But now you have a pointer proc call for all your sequence growths
06:38:33FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4BaS
06:45:17FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4BaU
06:56:26FromDiscord<wannabelokesh> sent a long message, see http://ix.io/4BaW
06:57:48FromDiscord<Elegantbeef> > bare minimum mathematics I should be good at for programming (especially systems programming)↵I only have pre-calculus and I do fine 😛
06:59:48FromDiscord<odexine> you dont really need that much math to do systems programming
07:00:01FromDiscord<odexine> it depends on what exactly youre doing ig
07:12:01FromDiscord<demotomohiro> If you want to learn how computer works deeply, books about assembly language or how to make OS would be a good start.
07:18:58FromDiscord<demotomohiro> In reply to @wannabelokesh "Elegantbeef\: One of the": I just put that link because that code contains the windows API and microsoft's web site is a official document about windows API.
07:30:20*wgetch left #nim (WeeChat 3.6)
08:06:34*zaher joined #nim
08:57:12*jmdaemon quit (Ping timeout: 240 seconds)
09:16:33FromDiscord<terrygillis> By the way, does “latest” on the Nim playground indicate the devel branch compiler or just 1.6?
09:18:21FromDiscord<bung8954> latest stable
09:35:01*azimut joined #nim
09:44:32NimEventerNew question by epilif3sotnas: Problem inherit procs from another Type in Nim, see https://stackoverflow.com/questions/76743196/problem-inherit-procs-from-another-type-in-nim
10:02:02*azimut quit (Remote host closed the connection)
10:02:29*azimut joined #nim
12:54:14*zaher quit (Ping timeout: 260 seconds)
13:17:45FromDiscord<terrygillis> what is the difference between type conversion `int(8.5)` vs type casting `cast[int](8.5)`?
13:21:48FromDiscord<odexine> human conceptual value conversion vs raw bit value conversion
13:22:55FromDiscord<graveflo> I mean... We are talking about a high level vs low level conversion here
13:23:11FromDiscord<graveflo> the binary for 8.5 as an IEEE float is different from converting it to an integer
13:23:27FromDiscord<terrygillis> in the code I'm playing with using `cast[int]` causes weird errors while `int()` works
13:23:31FromDiscord<odexine> yes
13:23:44FromDiscord<odexine> because youre trying to interpret the bits of a float into an int
13:23:50FromDiscord<odexine> with cast
13:24:00FromDiscord<odexine> that usually never makes sense to do
13:24:03FromDiscord<graveflo> you almost never want to cast it. If you are reading code that is doing that they almost certainly goofed
13:25:35FromDiscord<terrygillis> interesting. before this I always thought type cast and conversion are synonymous
13:28:20NimEventerNew thread by TKD: Concepts in Nim v2, see https://forum.nim-lang.org/t/10347
13:34:05FromDiscord<graveflo> casting tells the compiler to treat a memory address as if it were a different type and conversion implies some kind of logic that is going to actually make sure the data is represented as the type. These are very loose definitions but that is better then thinking they are the same
14:48:11FromDiscord<wick3dr0se> Does Nim have a built-in lexer generator?
15:03:07FromDiscord<that_dude.> In reply to @wick3dr0se "Does Nim have a": Something like this? https://nim-lang.org/docs/compiler/lexer.html
15:10:07FromDiscord<ieltan> That's not it, use this or that :↵https://github.com/choltreppe/parlexgen↵https://github.com/Araq/lexim
15:14:41FromDiscord<ieltan> In reply to @Elegantbeef "I will die on": Curious what you would use instead of C (not a jab, just genuine curiosity)
15:15:19FromDiscord<wick3dr0se> chatgpt refers to it as NimLex
15:15:41FromDiscord<wick3dr0se> I beleive it's just talking about the lexer module dude linked
15:16:07FromDiscord<ieltan> In reply to @wick3dr0se "chatgpt refers to it": ? That module doesn't exist tmk
15:16:16FromDiscord<ieltan> ChatGPT is on crack for the 9268th time
15:16:21FromDiscord<wick3dr0se> No lie
15:16:43FromDiscord<wick3dr0se> I was asking it things about lexical analyzers and it says btw Nim has a built-in lexer generator called NimLex
15:16:52FromDiscord<ieltan> Use what I linked please
15:17:50FromDiscord<wick3dr0se> Ok, I'll check them out, thank you!
15:18:23FromDiscord<ieltan> Np 🙂
15:20:04FromDiscord<terrygillis> sent a code paste, see https://paste.rs/3LDBd
15:20:52FromDiscord<terrygillis> changing dest, source to x,y respectively doesn't work
15:21:36FromDiscord<ieltan> You don't need the genetic syntax for this, you can drop the `[T]` and use your type directly.
15:21:44FromDiscord<ieltan> (edit) "genetic" => "generic"
15:22:19FromDiscord<ieltan> (since your `DemoType` itself is not generic)
15:24:55FromDiscord<ieltan> sent a code paste, see https://play.nim-lang.org/#ix=4Bd2
15:25:49FromDiscord<ieltan> Ah, darn bridge
15:26:29FromDiscord<ieltan> (edit) "https://play.nim-lang.org/#ix=4Bd2" => "https://paste.rs/daRYe"
15:26:40FromDiscord<terrygillis> sent a code paste, see https://paste.rs/egeCv
15:31:24FromDiscord<ieltan> Well, maybe reading the compiler error would help, it says the type signature of `copy=` must be `[T: object]`, what about giving this a try?
15:34:34FromDiscord<terrygillis> `proc `=copy`[T: object](dest: var MaxPQ[T], source: MaxPQ[T]) ` still doesn't compiled and the only error message the compiler gives is still `Error: signature for '=copy' must be proc[T: object](x: var T; y: T)`.
15:37:35*junaid_ quit (Remote host closed the connection)
15:39:26FromDiscord<terrygillis> idk or is `=copy` unsupported in my version of the compiler (1.6.8)?
15:39:26FromDiscord<terrygillis> also not working on Nim playground "latest"
16:10:06FromDiscord<ieltan> Sorry I have no clue 😦
16:11:30FromDiscord<griffith1deadly> In reply to @terrygillis "`proc `=copy`*[T: object](dest: var": maybe because your object is ref?
16:13:29FromDiscord<griffith1deadly> sent a code paste, see https://paste.rs/FELTI
16:15:02*zaher joined #nim
16:17:02FromDiscord<terrygillis> is it possible to write copy constructor (assignment `=`) for ref object at all?
16:21:09FromDiscord<demotomohiro> https://nim-lang.org/docs/destructors.html#lifetimeminustracking-hooks↵> There are 3 different hooks for each (generic or concrete) object type T (T can also be a distinct type) that are called implicitly by the compiler.
16:22:06FromDiscord<terrygillis> sent a code paste, see https://paste.rs/9pUHB
16:23:38FromDiscord<terrygillis> sent a code paste, see https://paste.rs/G3N00
16:24:33FromDiscord<demotomohiro> ref types are references type. `x = y` supposed to set var x so that it refer to what y refer to.
16:25:24FromDiscord<terrygillis> it's not possible to override that behaviour, right?
16:25:53FromDiscord<terrygillis> override to copy `y` over to `x` instead of copying pointers
16:26:21FromDiscord<terrygillis> \the content of
16:27:46FromDiscord<terrygillis> sent a code paste, see https://play.nim-lang.org/#ix=4Bdt
16:27:51FromDiscord<demotomohiro> If you want copy the content, you need to write `x[] = y[]`.↵And you can override such copy.
16:30:33FromDiscord<demotomohiro> `proc `=copy`[T](dest: var typeof(MaxPQ[T]()[]); source: typeof(MaxPQ[T]()[]))`
16:33:13FromDiscord<terrygillis> sent a code paste, see https://paste.rs/uIugH
16:33:22NimEventerNew Nimble package! debby - Database ORM layer, see https://github.com/treeform/debby
16:33:32FromDiscord<terrygillis> sent a code paste, see https://paste.rs/Q2sJa
16:34:27FromDiscord<terrygillis> and it resulted in SIGSEGV
16:35:01FromDiscord<anon123.> why is that?
16:36:16FromDiscord<terrygillis> why is that?
16:37:03FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4Bdv
16:38:01FromDiscord<terrygillis> thanks that's neat
16:38:49FromDiscord<terrygillis> and the matrix bridge seems really slow, like 30 seconds at least, sometimes even not transferring edits over
16:39:27FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4Bdw
16:52:42FromDiscord<terrygillis> From reading this https://forum.nim-lang.org/t/5539#34582 it seems there was supposed to be `send` which does the deepCopy for the ref types, but it's not implemented yet.
17:39:49FromDiscord<ambient3332> you're still trying to do the var thing?
17:41:39FromDiscord<ambient3332> @terrygillis I wrote an example how you can do it with macro because I was interested https://gist.github.com/amb/97b0366d733786bf5168dea9ff02e5a0
18:11:19*jmdaemon joined #nim
18:18:01*zaher quit (Ping timeout: 244 seconds)
19:11:16FromDiscord<detalion> Hello everyone, I'm new in nim programming and I was wondering if there was a standard or third-party imap lib (supporting oauth2) in nim?
19:17:27ehmrydetalion: imap is complicated and sucks
19:17:39*Guest54 joined #nim
19:17:48ehmryI­ wrote a library long ago and haven't bothered to maintain it https://git.sr.ht/~ehmry/nim_imap
19:20:09FromDiscord<detalion> In reply to @ehmry "<@297708726981230592>: imap is complicated": maybe but I need to use imap with oauth2 to retrive mail messages from gmail / hotmail / yahoo
19:21:24FromDiscord<detalion> In reply to @ehmry "I­ wrote a library": Thanks, yes I see 2 imap libs in nim
19:22:19*Guest54 quit (Client Quit)
19:37:27FromDiscord<detalion> In reply to @ehmry "I­ wrote a library": but your lib support TLS?
19:50:48FromDiscord<spotlightkid> @detalion\: Be aware that imap support for gmail mail boxes must be specifically enabled.
19:51:56FromDiscord<detalion> In reply to @spotlightkid "<@297708726981230592>\: Be aware that": what you mean by "must be specifically enabled"?
19:52:16FromDiscord<detalion> (edit) "In reply to @spotlightkid "<@297708726981230592>\: Be aware that": what you mean by "must be specifically enabled"? ... " added "from Google interface? yes"
19:52:50FromDiscord<detalion> (edit) removed "what you mean by "must be specifically enabled"?" | "yes" => "yes, I know by default is disabled"
19:54:13*zaher joined #nim
19:54:39ehmrydetalion: i wouldn't bother trying to get messages from google
19:55:09ehmryuse their webmail and don't be a weirdo
19:55:51FromDiscord<detalion> In reply to @ehmry "<@297708726981230592>: i wouldn't bother": Well I need to make app to connect to gmail, what's a problem?
19:56:20ehmrydetalion:­ google will make the apps for you, you don't get to make the apps for them
19:59:41FromDiscord<detalion> In reply to @ehmry "<@297708726981230592>:­ google will make": I don't think we understand, so I'll explain my need again, Google make a juste webmail client, I don't need a webmail client. I need to connect to gmail or other mail supplier in imap to make some operation via my app
20:00:56ehmrydetalion: what I mean is I really don't think google supports imap at all
20:01:55FromDiscord<detalion> In reply to @ehmry "<@297708726981230592>: what I mean": Yes, it's supporting of course, but it's disable by default, you need to activate via web interface
20:02:09ehmryhave you actually enabled it though?
20:02:38ehmrybecause they could just be lying
20:03:34FromDiscord<detalion> In reply to @ehmry "have you actually enabled": ok I make an app in freepascal lazarus, using Indy component with IMAP4, freepascal is slow for some operations, I would like to see if I can optimize speed using nim
20:06:37FromDiscord<detalion> In reply to @ehmry "have you actually enabled": https://www.lifewire.com/thmb/16ZNmEETbSeGvTcRYtVGojKnc48=/750x0/filters:no_upscale():max_bytes(150000):strip_icc():format(webp)/001-gmail-access-thunderbird-1173150-80fdab9339ec4fb9a6c58965db3b8b7b.jpg
20:12:26ehmryI tried to backup a gmail account recently and the option was there but you can't actually enable it now
20:24:58FromDiscord<System64 ~ Flandre Scarlet> In reply to @NimEventer "New Nimble package! debby": @treeform Thanks for that! Might be useful for my school work!
20:25:43FromDiscord<treeform> In reply to @sys64 "<@107140179025735680> Thanks for that!": Thanks! Let me know how it goes.
20:46:14*rockcavera joined #nim
20:46:35*ntat quit (Quit: leaving)
21:08:01*zaher_ joined #nim
21:11:14*zaher quit (Ping timeout: 260 seconds)
22:15:35FromDiscord<sirolaf> In reply to @sirolaf "Is there some special": Turns out this really is trivial to support, finally actually looked at it
22:17:31FromDiscord<Elegantbeef> Well araq isnt really for return type inference 😄
22:17:49FromDiscord<sirolaf> Really hope he changed his mind since last time someone asked
22:17:55FromDiscord<sirolaf> Main thing I was missing with generics
22:18:28FromDiscord<Elegantbeef> Eh that's not that bad
22:18:34FromDiscord<griffith1deadly> In reply to @treeform "Thanks! Let me know": are you planning to add something like JoinColumn, ManyToOne, OneToMany as it is done in HibernateORM for Java?
22:18:41FromDiscord<Elegantbeef> Given that it's not much more effort to just do `var x = Option[string]()` 😛
22:19:01FromDiscord<sirolaf> Yeah for that simple type it's fine, but quickly gets annoying
22:20:58FromDiscord<sirolaf> I once made this Result[T] type and to work around this limitation I had to pass the result variable into a template, much cleaner to just assign with inference
22:22:24FromDiscord<Elegantbeef> How do you properly infer this though?
22:22:32FromDiscord<Elegantbeef> I'm curious at your solution
22:23:29FromDiscord<sirolaf> <https://github.com/nim-lang/Nim/pull/22317> well the compiler already has expectedTypes in a lot of sem stages, just passed it a bit further down the line and bind them to their counterparts
22:24:24FromDiscord<Elegantbeef> What happens if you do `let x: Option[auto, auto] = none()`?
22:24:38FromDiscord<sirolaf> Probably dies, generics don't get along well with auto
22:25:28FromDiscord<sirolaf> sent a code paste, see https://play.nim-lang.org/#ix=4BeG
22:25:30FromDiscord<sirolaf> That seems fine to me
22:25:57FromDiscord<Elegantbeef> Yea just making sure it didnt bypass a check
22:26:29FromDiscord<sirolaf> Actually this error, was using std/options before `Error: expression 'none()' has no type (or is ambiguous)`
22:26:50FromDiscord<sirolaf> Not optimal but also no bypass
22:27:22FromDiscord<Elegantbeef> The thing I want for generics is object constructor generic inference 😄
22:27:36FromDiscord<Elegantbeef> Too lazy to implement it myself apparently
22:27:55FromDiscord<sirolaf> No idea what that means 😼
22:28:21FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/ul4NL
22:28:43FromDiscord<sirolaf> That would be cool, but could see that being problematic with void
22:28:49FromDiscord<sirolaf> Does not mentioning it imply void or not
22:29:19FromDiscord<Elegantbeef> What?
22:29:32FromDiscord<sirolaf> MyObject[void] would get rid of the field
22:29:42FromDiscord<sirolaf> Completely disappears
22:29:51FromDiscord<Elegantbeef> Oh right people use void fields cause they're silly 😛
22:30:02FromDiscord<sirolaf> Yeah it sucks
22:40:20FromDiscord<treeform> In reply to @griffith1deadly "are you planning to": Not really, I think that overcomplicates things. I’ll add things as I need them.
22:52:00FromDiscord<monark.chan> How can I compile a Nim library to a .so
22:52:15FromDiscord<monark.chan> I want to be able to use the jsony library as a .so
22:53:28FromDiscord<Andreas> try `--app:lib`
22:53:56FromDiscord<Andreas> (edit) "try `--app:lib` ... " added "or `--app:staticlib`"
22:54:01FromDiscord<monark.chan> Ohk
22:54:11FromDiscord<monark.chan> And would that .so work in c?
22:54:24FromDiscord<Andreas> In reply to @monark.chan "Ohk": `nim --fullhelp | more`
22:54:42FromDiscord<monark.chan> In reply to @Andreas "`nim --fullhelp | more`": Didn't know about that flag
22:54:59FromDiscord<Andreas> In reply to @monark.chan "Didn't know about that": there are many...
22:55:29FromDiscord<Andreas> In reply to @monark.chan "And would that .so": should word...
22:55:36FromDiscord<Andreas> (edit) "word..." => "work..."
22:55:42FromDiscord<monark.chan> In reply to @Andreas "should work...": Ok thx!
22:58:51FromDiscord<jmgomez> In reply to @sirolaf "<https://github.com/nim-lang/Nim/pull/22317> well t": good work!
23:00:11*lucasta joined #nim
23:01:01FromDiscord<Andreas> In reply to @monark.chan "Ok thx!": this https://github.com/nim-lang/Nim/wiki/Nim-for-C-programmers is for C-dudes in case of probs try to ping Mr. Beef
23:08:25FromDiscord<sirolaf> In reply to @jmgomez "good work!": Thanks, just hoping it’s not too much inference for araq 😛
23:32:09NimEventerNew thread by morturo: Converter not working unless I explicitly use it, see https://forum.nim-lang.org/t/10348
23:53:29*zaher_ quit (Quit: Leaving)