<< 16-05-2021 >>

00:04:41*clyybber quit (Quit: WeeChat 3.1)
00:44:08*azed quit (Quit: WeeChat 3.1)
00:44:33*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
00:44:55*njoseph joined #nim
00:50:37FromGitter<hasnep:matrix.org> Hi everyone, I want to get into Nim by using it with the Godot engine, does anyone know where the best place to ask for help with this would be? Thanks
00:52:46FromDiscord<ElegantBeef> Here is fine, i suggest https://github.com/geekrelief/gdnim
00:55:08*nphg joined #nim
00:57:11*nphg1 quit (Ping timeout: 240 seconds)
01:03:05FromDiscord<impbox [ftsf]> In reply to @ElegantBeef "Have you thought about": Haven't looked at it in ages, I'd like a generic node editor gui system for lots of projects.
01:03:53FromDiscord<ElegantBeef> A generic node editor would be rather nice 😄
01:06:54FromGitter<hasnep:matrix.org> @ElegantBeef Thanks! That seems really useful!
01:30:16*dbohdan quit (Read error: Connection reset by peer)
01:31:10*dbohdan joined #nim
02:00:46*asd25 joined #nim
02:03:42*asd25 quit (Client Quit)
02:09:06*thomasross joined #nim
02:15:37*oculux joined #nim
02:25:37*oculux quit (Ping timeout: 252 seconds)
02:27:45*oculux joined #nim
03:04:41FromDiscord<exelotl> Aw man I ran into a bug where `=copy` doesn't get called. Will take quite a lot of unpicking to create a minimal repro :(
03:05:51FromDiscord<ElegantBeef> inb4 it's just `sink`'d instead 😛
03:33:59*spiderstew_ joined #nim
03:34:59*spiderstew quit (Ping timeout: 245 seconds)
03:58:08*customer[m] joined #nim
04:31:23FromDiscord<Frosthunter> hello, does nim's closure iterators support something like python's send for generators?
04:32:59PrestigeNot familiar with python, what's send for generators?
04:33:10FromDiscord<ElegantBeef> Oh it's a wild prestige
04:33:11*oculux quit (Ping timeout: 240 seconds)
04:33:31*Prestige got away safely!
04:33:43FromDiscord<Frosthunter> https://stackoverflow.com/questions/19302530/python-generator-send-function-purpose
04:33:43PrestigeWhat's good beef
04:33:48FromDiscord<Frosthunter> here is an example
04:33:53FromDiscord<Frosthunter> (the first answer)
04:34:56FromDiscord<Frosthunter> it allows for bi-directional communication between the iterator and the caller
04:35:28Prestigeinteresting, never tried anything like that in Nim
04:36:49FromDiscord<Frosthunter> i managed to do something like this, but it doesn't feel right at all and is pretty limited https://play.nim-lang.org/#ix=3mWR
04:37:43PrestigeI can't think of a real case I'd use it in, not sure if it's possible (unless you just pass in new params)
04:38:10FromDiscord<ElegantBeef> Yea the passing into is the only way i can imagine, same view of cant think of a use case
04:41:02FromDiscord<ElegantBeef> Cause it's really just an uglier version of https://play.nim-lang.org/#ix=3mWT
04:50:49*thomasross quit (Ping timeout: 252 seconds)
04:57:26FromDiscord<Frosthunter> in the context of coroutines it's useless if you need to communicate between your coroutine and your event loop
04:57:47FromDiscord<Frosthunter> (edit) "useless" => "useful"
05:02:40saemBidirectional communication could be for progress or telemetry
05:08:28FromDiscord<Frosthunter> closure iterators is the closest I could find to do that, maybe i should be using something else for coroutines, but the others options i could find (coro, async/await) don't seem to give me what I what because they provide their own event loop
05:09:15FromDiscord<Frosthunter> since I've read that async/await is implemented over closure iterators i tried to use that instead
05:20:30FromDiscord<Ricky Spanish> anyone know if theres any nim libraries for map-reduce type tasks / string comparisons? i have a 50k line file with some lines that are duplicates or near duplicates i need reduced to only unique strings
05:23:36*dbohdan quit (Changing host)
05:23:36*dbohdan joined #nim
05:34:33*mbomba joined #nim
05:39:10*mbomba quit (Quit: WeeChat 3.1)
06:53:41*Vladar joined #nim
06:58:05*sagax quit (Remote host closed the connection)
07:03:22*letto quit (Ping timeout: 252 seconds)
07:47:26FromDiscord<zidsal> map reduce is prob overkill for a 50k line file I'd just load it all into memory unless you have really constrained hardware. Nim already has a builtin critbit data structure that should do most of the work for you. https://nim-lang.org/docs/critbits.html
08:00:14*tane joined #nim
08:03:28*NimBot joined #nim
08:10:19*rusua joined #nim
08:18:44*vegai1 joined #nim
08:24:54*Vladar quit (Quit: Leaving)
08:49:21*uvegbot joined #nim
08:54:23FromDiscord<madman> which proc is more idiomatic https://play.nim-lang.org/#ix=3mY1
08:54:52FromDiscord<madman> proc name
08:56:29FromDiscord<madman> i prefer `proc initT` than just `proc init` coz its less ambiguous especially when u have a lot of `proc init`s
08:57:27FromDiscord<zidsal> sent a code paste, see https://play.nim-lang.org/#ix=3mY4
08:57:43FromDiscord<madman> ok nice
08:57:57FromDiscord<zidsal> (edit) "https://play.nim-lang.org/#ix=3mY4" => "https://play.nim-lang.org/#ix=3mY5"
08:58:02FromDiscord<madman> even though you could do `moduleName.init`
08:58:35FromDiscord<madman> but i guess that's not desired
08:58:54FromDiscord<zidsal> what if your module had 2 methods named init() that returned different types
08:59:46FromDiscord<madman> yeah function overloading
09:00:20FromDiscord<madman> i have a few types and they all have init() procs
09:00:40FromDiscord<madman> i guess its better to postfix ^_^
09:01:21FromDiscord<madman> not cool xD https://media.discordapp.net/attachments/371759389889003532/843412791884775434/unknown.png
09:02:19FromDiscord<zidsal> ya I'd personally go with what the style guide says so its all consistent. You can actually run nim with the flag `--styleCheck:error` to check if your code is following the style guide or not
09:03:33FromDiscord<ElegantBeef> Something some people do which is why i'm just bringing it up is https://play.nim-lang.org/#ix=3mY9
09:04:03FromDiscord<ElegantBeef> But yea follow the `initT`
09:04:22FromDiscord<ElegantBeef> It's just the most sensible, also if you have that many constructors maybe checkout my constructor package
09:04:32FromDiscord<ElegantBeef> <https://github.com/beef331/constructor>
09:04:46FromDiscord<zidsal> the people who use init are heretics and must be destroyed!
09:04:47FromDiscord<ElegantBeef> Makes life less redundant, still slightly though
09:05:09FromDiscord<madman> In reply to @ElegantBeef "Something some people do": that's a cool example
09:05:17FromDiscord<madman> In reply to @zidsal "the people who": it's coming from a C library
09:05:28FromDiscord<zidsal> I stand by my statement!
09:05:30FromDiscord<Rika> In reply to @zidsal "the people who": same as those who use snake case?
09:05:42FromDiscord<ElegantBeef> atleast they arent using kebab amirite?
09:05:55FromDiscord<Rika> brb making a macro to make kebab case work in nim
09:05:58FromDiscord<zidsal> that depends rika are they at least trying to roleplay as someone from the harry potter universe
09:06:09FromDiscord<madman> i_like_snake_case
09:06:18FromDiscord<Rika> heretic
09:06:40FromDiscord<madman> @zidsal what should be used instead of init
09:07:00FromDiscord<ElegantBeef> I think they meant the `init` like i showed, but i could be wrong
09:07:09FromDiscord<zidsal> ya, I am in the initT camp
09:07:21FromDiscord<haxscramper> In reply to @zidsal "the people who": It works with generics
09:07:28FromDiscord<haxscramper> Works better with generics
09:07:30FromDiscord<ElegantBeef> Ahs so then constructor must fill you with a warm cuddly feeling 😄
09:07:37FromDiscord<Rika> i'm actually for init[T] more than initT lol
09:07:46FromDiscord<haxscramper> With `initT` it is impossible to initialize a type in generic
09:07:47FromDiscord<zidsal> I see I am out numbered
09:07:53FromDiscord<Rika> and also parse[T] over parseT and etc
09:07:54FromDiscord<madman> @ElegantBeef i like the init you showed but the problem is when u have many inits
09:08:03FromDiscord<haxscramper> Though I use `initT`, `newT` or `makeT` most of the time
09:08:04FromDiscord<zidsal> fair point, I've not had to use generics much
09:08:15FromDiscord<Rika> In reply to @haxscramper "Though I use `initT`,": well sooner or later we wont need to, right?
09:08:18FromDiscord<ElegantBeef> ~~I mean madman i shared a library that'll generate them for you in a DSL~~ 😄
09:08:21FromDiscord<madman> im with initT too
09:08:35FromDiscord<Rika> well thats likely because you havent tried using generics 😛
09:09:19FromDiscord<madman> In reply to @ElegantBeef "~~I mean madman i": yes dude im aware but im calling from a C library, i dont think it matters in this case but in general it's cool
09:09:23FromDiscord<haxscramper> In reply to @Rika "well sooner or later": I don't think so. In the end custom constructor procs are necessary not only for field initialization
09:09:24FromDiscord<zidsal> @Rika thats because some peoples day jobs involve maintaining java code with 6 levels of generics, maybe in there free time they don't want to have to use generics!
09:09:44FromDiscord<ElegantBeef> Ah then yea i dont think it'll work
09:09:45FromDiscord<Rika> In reply to @haxscramper "I don't think so.": i mean we wont need to use initT over init[T] because of better support
09:10:01FromDiscord<Rika> In reply to @zidsal "<@259277943275126785> thats because some": java generics are much less powerful than nim generics
09:10:08FromDiscord<zidsal> agreed
09:11:07FromDiscord<zidsal> anyway lightning round question time, where is the equality of a sequence defined? if ordering matters what's the best way to compare 2 sequences without caring about ordering
09:11:32FromDiscord<Rika> dont use a sequence if you dont need order
09:12:13FromDiscord<zidsal> what data type would you suggest?
09:12:19FromDiscord<Rika> use either a `set` or `HashSet` i think is what its called
09:12:28FromDiscord<zidsal> that's going to remove duplicates
09:12:52FromDiscord<Rika> you need duplicates as well? thats an odd use case
09:13:09FromDiscord<Rika> what are you doing more specifically?
09:13:45FromDiscord<zidsal> I'm writing an in memory TripleStore, and I'm currently building the query searching functionality. Althought I don't personally care about removing dupes someone else might do depending on their query
09:14:37FromDiscord<Rika> sort the array?
09:14:49FromDiscord<Rika> rather both sequences, sort them if lens are ==
09:14:50FromDiscord<zidsal> ya that may the best solution
09:15:09FromDiscord<Rika> i dont see any better solution that isnt overcomplicated
09:15:51FromDiscord<zidsal> just presume they are the same list by looking at the hash! whats the chance of a hash collision anyway
09:20:31FromDiscord<clyybber> In reply to @exelotl "Aw man I ran": can you try with --cursorinference:off?
09:30:12*xet7 quit (Remote host closed the connection)
09:34:43FromDiscord<PressF> sent a code paste, see https://play.nim-lang.org/#ix=3mYg
09:35:34FromDiscord<Rika> !eval for chr in "fortify": if chr == 'f': echo "yes"
09:35:35NimBotCompile failed: /usercode/in.nim(1, 25) Error: nestable statement requires indentation
09:35:42FromDiscord<Rika> aughtuehw
09:37:27FromDiscord<clyybber> In reply to @PressF "Hey people How do": replace "f" with 'f'
09:39:57FromDiscord<PressF> Thx
09:40:10*Vladar joined #nim
09:44:05FromDiscord<madman> much better ^_^ https://media.discordapp.net/attachments/371759389889003532/843423553261142066/unknown.png
09:49:51*xet7 joined #nim
10:08:04FromDiscord<Cypheriel> Is it weird to use... WebStorm for Nim? Neither IntelliJ IDEA Ultimate or PyCharm Professional would work for me in the context of Nim.. haha
10:14:06FromDiscord<Rika> if it works it works
10:14:32FromDiscord<madman> is this idiomatic enough? https://github.com/IbrahimHindawi/Knim/blob/main/Sources/tutorial02/prog.nim
10:20:43FromDiscord<madman> sent a code paste, see https://play.nim-lang.org/#ix=3mYD
10:20:56FromDiscord<madman> its more explicit
10:22:09FromDiscord<Rika> that is fine
10:25:34*PMunch joined #nim
10:30:33FromDiscord<PressF> sent a long message, see http://ix.io/3mYF
10:30:49FromDiscord<PressF> I'm using the `getKey()` proc
10:36:58*PMunch quit (Quit: leaving)
10:41:07FromDiscord<zidsal> BTW there is a small contradiction in the hashset docs. The comments for the `HashSet` type claim you need to call the `init` or `initHashSet` proc before calling other procs, however those procs say you don't need to do this anymore
10:44:52*tane quit (Quit: Leaving)
10:49:39*letto joined #nim
11:00:38FromGitter<nothratal> hello together
11:02:28FromDiscord<jtiai> Does nim has C and Python like `a |= b` notation or do I need to just write `a = a or b`?
11:11:32FromDiscord<Rika> i believe it does not have such notation
11:13:41FromDiscord<Recruit_main707> sent a code paste, see https://play.nim-lang.org/#ix=3mYV
11:14:48FromDiscord<jtiai> Not really need it but was wondering could I do "copy-paste" tons of bitwise op c-code without rewriting it totally.
11:18:01FromDiscord<jtiai> sent a code paste, see https://play.nim-lang.org/#ix=3mZ0
11:19:00FromDiscord<Recruit_main707> you could wrap it, that way you dont have to translate it, or try c2nim and see if it does it for you
11:19:51FromDiscord<jtiai> I rather translate it.
11:20:08FromDiscord<jtiai> Since planning to add debugger for it later on.
11:20:48FromDiscord<jtiai> I'm writing an Oric Atmos emulator with Nim. So much fun. Except this particular chip.
11:22:17*clyybber joined #nim
11:31:18*sagax joined #nim
11:39:45*arecaceae quit (Remote host closed the connection)
11:40:58*arecaceae joined #nim
11:41:48FromDiscord<zetashift> In reply to @nothratal "hello together": hiya
11:42:30*Gambit[m] joined #nim
11:43:01FromDiscord<zetashift> In reply to @PressF "So I'm using the": https://github.com/johnnovak/illwill/issues/2 maybe you're running into this?
11:56:08*gmaggior joined #nim
12:00:19*arecaceae quit (Remote host closed the connection)
12:00:41*arecaceae joined #nim
12:07:54FromDiscord<PressF> In reply to @zetashift "https://github.com/johnnovak/illwill/issues/2 maybe": yup. that helped Thx a lot
12:10:54FromDiscord<willyboar> @PressF are you building something cool 🤩
12:11:00FromDiscord<willyboar> (edit) "🤩" => "🤩?"
12:12:10FromDiscord<PressF> In reply to @willyboar "<@!391274926541373441> are you building": I think so 😄 . I've been truing to improve my typing speed so I'm making a terminal app like this:↵https://www.speedtyper.dev/
12:15:36FromDiscord<willyboar> sounds cool
12:15:44ForumUpdaterBotNew thread by AMoura: Install Choosenim with Chocolatay, see https://forum.nim-lang.org/t/7988
12:16:01FromDiscord<willyboar> is there any similar tui app?
12:16:25FromDiscord<PressF> In reply to @willyboar "is there any similar": not that I know of
12:20:48FromDiscord<ajusa> In reply to @zetashift "https://github.com/johnnovak/illwill/issues/2 maybe": Aw man I remember making that issue years ago
12:21:19FromDiscord<willyboar> https://github.com/karaname/typp
12:22:00FromDiscord<ajusa> It should be possible to make a typing app using illwill, no issues that I can think of
12:22:15FromDiscord<PressF> In reply to @willyboar "https://github.com/karaname/typp": Cool.
12:22:34FromDiscord<PressF> I will do it anyways hahahah↵I need to improve my nim
12:22:43FromDiscord<willyboar> I think would be better on nim
12:23:47FromDiscord<willyboar> It is only 8 days old
12:24:16FromDiscord<VinKer> Hi all,↵Nim uses back ticks for property declarations. But is there any way to alias the back ticks with my own signs ? I mean, would like to use angle brackets instead of back ticks. Is it possible ?
12:24:33FromDiscord<PressF> I'm thinking of getting real code from github (maybe using their api if it allows for that)
12:24:53FromDiscord<PressF> and allowing the user to add their own texts
12:30:18FromDiscord<Rika> In reply to @VinKer "Hi all, Nim uses": if im interpreting you right, no
12:32:29FromDiscord<willyboar> @PressF I was checking both illwill and ncurses for a project but I found I wouldn't make it 😢 😢
12:34:06FromDiscord<VinKer> @RikaOh, I see. So no aliasing, right ?
12:34:07FromDiscord<willyboar> Generally the projects I planning to do is far from my skills
12:34:37FromDiscord<Rika> yes i believe so, you cant use `<` instead of `
12:34:59FromDiscord<VinKer> @RikaOkay. Thanks for the info. 🙂
12:36:44FromDiscord<zetashift> In reply to @ajusa "Aw man I remember": Well it's a good thing you did, even I was stumped when I read the code of illwill 😛
12:50:02*rusua quit (Quit: Connection closed for inactivity)
13:10:31FromDiscord<exelotl> In reply to @Clyybber "can you try with": gave it a try, doesn't seem to make a difference
13:11:01FromDiscord<exelotl> cursor inference is an arc thing right? I'm using --gc:none
13:15:30FromDiscord<clyybber> oh yeah
13:17:52FromDiscord<clyybber> oh, but if you override `=copy` you still get the arc analysis I believe so cursorinference:off might make a difference
13:18:03FromDiscord<exelotl> ah I see
13:18:06FromDiscord<clyybber> and the move semantics too
13:18:44FromDiscord<clyybber> you can use --expandArc:procname to find out more
13:20:23FromGitter<bung87> https://play.nim-lang.org/#ix=3mZv can I relys on this casting behavior?
13:24:52FromDiscord<exelotl> sent a code paste, see https://play.nim-lang.org/#ix=3mZx
13:25:33FromDiscord<exelotl> (edit) "https://play.nim-lang.org/#ix=3mZx" => "https://play.nim-lang.org/#ix=3mZy"
13:26:42FromDiscord<exelotl> oh wait
13:27:53FromDiscord<exelotl> it echos part of the length component, not "a" and "b"
13:27:56FromDiscord<clyybber> In reply to @Clyybber "you can use --expandArc:procname": @exelotl oh, one thing, are you on the latest devel? I merged a DFA fix yesterday that fixes incorrect sinking in some cases
13:29:08FromDiscord<clyybber> In reply to @bung87 "https://play.nim-lang.org/#ix=3mZv can I relys": no, string is not castable to cstring that way
13:38:08FromDiscord<exelotl> sent a code paste, see https://play.nim-lang.org/#ix=3mZD
13:50:14FromDiscord<zetashift> @treeform is writing to SVG for pixie on the roadmap?
13:53:54FromDiscord<Vindaar> ^wondering the same thing
13:54:50FromDiscord<zetashift> what a coincedence @Vindaar , I just started working on `backendPixie` for `ginger` as an experiment 😛
13:54:58FromDiscord<zetashift> that's why I was asking
13:56:01FromDiscord<Vindaar> Haha, awesome! I just saw you forking. ↵I've been thinking about exactly that ever since pixie started to look somewhat mature
13:56:04FromGitter<bung87> @clyybber Thanks!
13:56:30FromDiscord<Vindaar> ggplotnim without cairo dependency sounds really nice..
13:56:48FromDiscord<clyybber> In reply to @exelotl "it still happens on": can you post the output of expandArc?
13:59:31FromDiscord<zetashift> In reply to @Vindaar "Haha, awesome! I just": Yeah I was hoping to get a PR in, the code in `backendDummy` looks so simple and but `backendCairo` looks a bit more intimidating
14:00:43FromDiscord<Vindaar> All in all it's mostly simple though. Some stuff is a bit ugly (gradient in cairo, parts of that are still hardcoded cough). ↵Feel free to ask stuff! Don't worry too much about the details in the cairo backend. Just build the dummy backend API and try to fill it with pixie functionality
14:02:54FromDiscord<zetashift> I was wondering what the `ctx: PContext` and `PSurface` is about?
14:03:31FromDiscord<zetashift> Cairo specific things of handling an image?
14:03:45FromDiscord<Vindaar> That's just cairo internals as to how it handles memory & surfaces one draws to
14:03:58FromDiscord<zetashift> well in Pixie it's all just images 😛
14:05:19FromDiscord<Vindaar> it's written in a sane programming language after all 😅
14:06:20FromDiscord<zetashift> alright I'll experiment a bit more, for what it's worth I found `gingers` code really easy to grok, except for the Cairo specific things
14:06:30FromDiscord<zetashift> (but that's because I know nothing about Cairo)
14:07:22FromDiscord<Vindaar> that's nice to hear! I'll be afk for an hour or so. Just ping me for specifics
14:07:32FromDiscord<zetashift> cool cool
14:16:03*xet7 quit (Remote host closed the connection)
14:16:52FromGitter<bung87> what does objective-c do compare a Id type and const int ?
14:17:11*xet7 joined #nim
14:17:31FromDiscord<tiyn> Hey,↵whats up? I'm currently working on a bigger project where i have a module that stores a relative path to a database in a variable.↵that module gets imported from its parent directory (lets call it parent module).↵If i run the module
14:18:50*gmaggior quit (Quit: Leaving)
14:19:09*gmaggior joined #nim
14:19:34FromGitter<bung87> then what ?
14:20:20FromDiscord<tiyn> sent a long message, see http://ix.io/3mZT
14:21:54FromGitter<bung87> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=60a12a825ca66330b047a2c4]
14:22:45FromDiscord<tiyn> thanks, ill try that 🙂
14:35:50*arecaceae quit (Remote host closed the connection)
14:36:13*arecaceae joined #nim
14:44:21FromDiscord<pietroppeter> Hi, it seems os.removeFile (and os.tryRemoveFile) are not available in nimscript (although os is generally available in nimscript). What would be the alternative?
14:49:47FromDiscord<haxscramper> https://nim-lang.org/docs/nimscript.html#rmFile%2Cstring
14:53:30FromDiscord<pietroppeter> ah thanks!, not sure how I could miss that...
15:06:23*superbia joined #nim
15:11:49FromDiscord<zetashift> @Vindaar is `Style.size` the same as the stroke of a line?
15:12:03FromDiscord<zetashift> nvm that would be lineWidth haha
15:13:02FromDiscord<Vindaar> `size` is used for things like point sizes etc
15:13:36*mindhunt1r0x joined #nim
15:15:11*mindhunter0x quit (Ping timeout: 240 seconds)
15:25:25FromDiscord<exelotl> @clyybber ahh found it
15:25:28FromDiscord<exelotl> https://play.nim-lang.org/#ix=3n0o
15:27:21FromDiscord<exelotl> it occurs following a forward declaration of an implicit generic proc
15:29:19FromDiscord<clyybber> ah, that's nasty
15:29:30FromDiscord<clyybber> probably a phase order issue @Araq
15:33:30FromDiscord<zetashift> @Vindaar, rectangle line etc are really easy to do by calling their respective Pixie function, but I'm not sure how to tackle rotation? `rotateAngle` returns a float and a Point to rotate around I think? Also the only Pixie sample of rotation I could find is: https://github.com/treeform/pixie/blob/75915ab05fb3dcc94aa46b15ab21800eda0cf9ae/tests/test_images_draw.nim#L30 I don't really know how I would tackle it here
15:41:55FromDiscord<treeform> In reply to @zetashift "<@150345911057252352>, rectangle line etc": Use rotate(angle) to create a rotation matrix, pass that to any draw command.
15:48:06FromDiscord<treeform> In reply to @zetashift "<@107140179025735680> is writing to": What do you mean? Svg is just a file format. We support many of it's features.
15:51:00FromDiscord<zetashift> In reply to @treeform "Use rotate(angle) to create": Do you maybe have an example on how one would rotate a line around a certain angle? I'm currently not using `draw` but mostly `strokeSegment` and `fillRect`
15:51:25FromDiscord<zetashift> In reply to @treeform "What do you mean?": For example `image.writeFile("foo.svg")`
15:51:46FromDiscord<zetashift> and then it would create a `foo.svg`
15:51:49FromDiscord<treeform> I think its just `image.strokeSegment(segment, rotate(angle))`
15:52:10FromDiscord<tiyn> sent a code paste, see https://play.nim-lang.org/#ix=3n0A
15:52:16FromDiscord<treeform> Sorry, I don't think we would ever write `.svg` files.
15:53:28FromDiscord<zetashift> In reply to @treeform "I think its just": Wouldn't that be a function mismatch? https://nimdocs.com/treeform/pixie/pixie.html#strokeSegment%2CImage%2CSegment%2CSomeColor%2Cfloat
15:54:58FromDiscord<apahl> Hi, what is best practice, should I use `int` or `uint` as type for a length variable? ↵I noticed that the length of a sequence is `int`.
15:54:59FromDiscord<treeform> Svg is a lot like HTML, maybe use HTML template to write those?
15:56:30FromDiscord<zetashift> In reply to @treeform "Svg is a lot": https://github.com/bluenote10/NimSvg I found this, so I don't think writing to svg will be hard
15:57:53FromDiscord<treeform> ^ that looks like the way you would want to build SVGs
15:58:40FromDiscord<zetashift> mhmhm
15:58:40FromDiscord<treeform> In reply to @apahl "Hi, what is best": probably `int`
15:59:19FromDiscord<zetashift> well svg writing is a problem for later 😛
15:59:41FromDiscord<treeform> In reply to @zetashift "Wouldn't that be a": You right for that you would need to use the lower level path API
16:00:00FromGitter<nothratal> I was going through the `curated packages` list and stumbled over the gui packages. There seems to be a lot of movement since I last checked a while ago. Is there a preferred package for `native` gui's?
16:00:13*rolha quit (Quit: Idle for 30+ days)
16:00:14FromDiscord<zetashift> ah yea I saw some stuff that does work for Paths, but was hoping it could also apply to higher level procs
16:00:28FromDiscord<apahl> In reply to @treeform "probably `int`": Thank you.
16:01:18FromDiscord<treeform> sent a code paste, see https://play.nim-lang.org/#ix=3n0E
16:02:12*superbia quit (Quit: WeeChat 3.1)
16:03:51FromDiscord<zetashift> sent a code paste, see https://play.nim-lang.org/#ix=3n0F
16:05:37FromDiscord<GeeLeonidas> In reply to @tiyn "sorry for the long": Have you imported `macros`? `newNimNode` is declared there iirc
16:05:46FromDiscord<treeform> I think I would make strokeSegment take a transform in the future
16:07:22FromDiscord<tiyn> In reply to @~leoi "Have you imported `macros`?": yeah that was a stupid mistake by me, already did.↵the problem with the database still persists after using the macro and mImport.↵nim still searches for the database in the directory the parent module is located in and not↵in the folder i imported the database module from
16:13:31FromDiscord<tiyn> In reply to @tiyn "Hey, I'm currently working": this is the problem if sb is still searching for it
16:14:32*thomasross joined #nim
16:15:35*Prestige quit (Ping timeout: 250 seconds)
16:18:58*NimBot joined #nim
16:19:04*narimiran joined #nim
16:19:10*Prestige joined #nim
16:19:25*ForumUpdaterBot joined #nim
16:21:07*stefantalpalaru quit (Ping timeout: 265 seconds)
16:21:16*stefantalpalaru joined #nim
16:21:28*jess quit ()
16:21:49*jess joined #nim
16:29:54FromDiscord<tiyn> is there maybe a way to set (and later get) a directory as rootDir of the project (or a projectDir).↵basically i want to avoid setting the absolute path to the project directory as a string.
16:32:03*narimiran quit (Quit: leaving)
16:59:14FromDiscord<haxscramper> You can use https://nim-lang.org/docs/system.html#currentSourcePath.t in your source code/nimble project,
16:59:31FromDiscord<haxscramper> And determine project root directory based on that
17:05:19*stefantalpalaru quit (Changing host)
17:05:19*stefantalpalaru joined #nim
17:05:50FromDiscord<dilawar> From C, I am calling a nim function `foo`. I will pass `const char` or `char` to `foo`. Should I use the argument with `cstring` or `string` type e.g. `foo(a : string)` vs `foo(a: cstring)`.? `string` has a lot of utility functions but I am worried about performance.
17:06:10FromDiscord<zetashift> sent a code paste, see https://play.nim-lang.org/#ix=3n18
17:06:34FromDiscord<zetashift> in the code that uses `rotate` I've seen single parameter calls to rotate too?
17:08:24FromDiscord<haxscramper> In reply to @dilawar "From C, I am": when interfacing with `const char` C functions you must use `cstring`
17:08:28FromDiscord<haxscramper> `string` is a nim type and it has different internal representation
17:08:28FromDiscord<haxscramper> you can get underlying cstring from string via `"tet".cstring`
17:08:33FromDiscord<dilawar> Thanks @haxscramper . Actually once I ran into `out of memory` issue when nim api was using `string` everywhere. Where can I read a bit more about the difference?
17:08:37FromDiscord<haxscramper> but I don't know if this is a zero-cost type conversion or it generates some additional code (aside from simple pointer indirection)
17:09:03FromDiscord<haxscramper> In reply to @dilawar "Thanks <@!608382355454951435> . Actually": In the manual - https://nim-lang.org/docs/manual.html#types-string-type
17:10:16FromDiscord<haxscramper> I don't think there is a more detailed documentation on string internals as it implemented via `magic` and considered implementation detail
17:10:50FromDiscord<dilawar> In reply to @haxscramper "In the manual -": `cstring` means campatible string!! I had guessed very differently: `cstring <=> <cstring>`.
17:10:55FromDiscord<treeform> In reply to @zetashift "<@107140179025735680> I'm using `rotate`": Is your vmath up to date?
17:11:33FromDiscord<haxscramper> In reply to @dilawar "`cstring` means campatible string!!": I still can't thing about it as `complatible`, only as `C-string`
17:11:44FromDiscord<haxscramper> But yeah, `cstring` is also JS's string type
17:12:00FromDiscord<zetashift> In reply to @treeform "Is your vmath up": I only did `nimble install pixie`
17:12:02FromDiscord<haxscramper> in other words - backend-specific string type
17:12:32FromDiscord<juan_carlos> Nim string is pure nim, is just a type with `cap:int`, `len:int`, `data:uncheckedArray[char]`.
17:16:33FromDiscord<zetashift> In reply to @treeform "Is your vmath up": nvm all good
17:19:10FromDiscord<zetashift> In reply to @treeform "Is your vmath up": I didn't know vmath's rotate returns a `GMat3` I'm currently using it like this: ` path.transform(rotate(angle PI / 180.0)) ` and getting a type mismatch error because transform expects Mat3
17:20:03FromDiscord<zetashift> how would I GMat3 to a Mat3?
17:21:40FromDiscord<treeform> Make angle a float32
17:21:56FromDiscord<treeform> I bet it's a float64 now
17:23:30FromDiscord<zetashift> In reply to @treeform "Make angle a float32": I had to make the `angle PI / 180.0` expression a float32 and now it works, thanks!!
17:23:35FromDiscord<treeform> Rotate returns the type it takes
17:32:01FromDiscord<dilawar> How do we convert a `cstring` to a `string` efficiently?
17:32:15FromDiscord<dilawar> `string(a: cstring)` doen't exists?
17:32:33FromDiscord<dilawar> or `newString(a: cstring) : string`?
17:32:57nphgWith the canonical toString: `$`
17:34:20FromDiscord<haxscramper> I don't think you can do this "efficiently" - at least `strlen` has to be used. And reusing the same string buffer i possible in theory, but again - it means hacking internal implementation somehow
17:35:54FromDiscord<dilawar> In reply to @nphg "With the canonical toString:": @haxscramper There are some useful notes in http://ssalewski.de/nimprogramming.html#_strings . I am now getting `SIGSEGV: Illegal storage access. (Attempt to read from nil?)`.
17:36:18FromDiscord<dilawar> Anyway, I'll experiment a bit more.
17:37:46FromDiscord<dilawar> Seems like making two languages work together is always a nightmare!!
17:39:22FromDiscord<haxscramper> you need to interface with C procedure that accepts `const char`, correct? Pass string from nim side to C and then convert results back to `string`?
17:41:09FromDiscord<dilawar> In reply to @haxscramper "you need to interface": I am going the other way round. Generating a static library and header file using nim. And linking the static lib in existing c codebase. I haven't considered the gc in nim issues yet.
17:45:16FromDiscord<haxscramper> So you basically provide `cstring -> cstring` (take `char`, return `char`), but internally want to work with `string` type?
17:48:35*superbia joined #nim
18:06:51FromDiscord<tiyn> In reply to @haxscramper "You can use https://nim-lang.org/docs/system.html#c": thats probably the best idea, thanks a lot
18:17:42FromDiscord<dithpri> Is there a way to use the sequtils map proc to map from string to string?
18:18:46giacoI've finally found some time to read the docs related to cps, thanks for that! "lorem ipsum more crap" LOL
18:20:40FromDiscord<zetashift> In reply to @dithpri "Is there a way": Do you have an example of what you want to achieve?
18:25:34FromDiscord<dithpri> https://play.nim-lang.org/#ix=3n1C
18:26:46FromDiscord<dithpri> I feel like either I missed smth in the docs or the string specialization should be part of sequtils
18:27:19FromDiscord<dithpri> If it's just missing I'll submit a pull request but want to make sure I'm not being dumb hehe
18:33:01FromDiscord<ElegantBeef> Well map does work from sequtils as you probably found it just returns a `seq[char]`
18:34:19FromDiscord<ElegantBeef> You can cast it to a string and you're fine, but yea no string specific one
18:35:02FromDiscord<dithpri> Wouldn't casting be less efficient than this specialization?
18:35:52FromDiscord<dithpri> I'd have to check, idk how smart the compiler is
18:36:05FromDiscord<ElegantBeef> casting is interpreting the bit pattern as another type, it's very cheap afaik
18:36:14FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=3n1H how you'd do the cast method
18:36:24FromDiscord<Recruit_main707> the compiler may convert your code into a cast, but casting is as efficient as it gets
18:36:30FromDiscord<Recruit_main707> its not changing the data
18:36:35FromDiscord<juan_carlos> I think cast is cheap but unsafe also.
18:37:15FromDiscord<Recruit_main707> yeah, its taking the data and telling everyone to chill, use it as if it was this other thing
18:37:54FromDiscord<Rika> Cast assumes that the underlying representation of a string is exact with a seq
18:38:01FromDiscord<Rika> Of course right now that is true
18:38:13FromDiscord<Rika> But there are no guarantees in the future
18:38:26FromDiscord<Recruit_main707> there is no reason it should change either tho
18:38:35FromDiscord<Rika> You don't know that
18:39:13FromDiscord<Recruit_main707> well, why would you save a string differently from a sequence of chars
18:39:23FromDiscord<ElegantBeef> Yea it 's considered unsafe, but in this case we know it's the same
18:39:37FromDiscord<ElegantBeef> The reason it might change is due to the underlying representation of either seq or string changing
18:40:34FromDiscord<Recruit_main707> actually, why isnt string just `type string = seq[char]`
18:41:00FromDiscord<ElegantBeef> At the moment i think it's `ptr -> (cap, len, ptr -> data)` and eventually it might get changed to having the cap/data be the first few values of the data.
18:41:06FromDiscord<ElegantBeef> I could be wrong about the current layout
18:41:28FromDiscord<Rika> I don't see the benefit in putting cap and len inside data
18:42:01FromDiscord<Recruit_main707> i think there is no ptr -> (), cap and len are on the stack iirc
18:42:02FromDiscord<Rika> I see the benefit now
18:42:02FromDiscord<ElegantBeef> Helps with immutable strings i think, but i'm a dumb dumb
18:43:03FromDiscord<Recruit_main707> `ptr -> (cap, len, ptr -> data)` this would be a pointer to a seq/string
18:43:29FromDiscord<ElegantBeef> Anyway yea it's currently fine but completely reliant on both types being the same underlying type
18:43:33FromDiscord<ElegantBeef> So it may change
18:44:17FromDiscord<ElegantBeef> Strings may have a different growth rate than seqs, but i dont think that's the case
18:44:31FromDiscord<Rika> Assuming that "since I don't know any reason for it to change, it may as well never change" is a bad ass2
18:44:48FromDiscord<Rika> Assumption
18:44:59FromDiscord<Rika> I pressed the number row instead of the predictions row
18:45:14FromDiscord<Recruit_main707> wut?
18:45:47FromDiscord<ElegantBeef> What really matters is on present nim it works so there is very little harm in using it, but the map function they wrote also works so choose whichever makes you take fewer showers
18:45:59FromDiscord<Rika> Disgusting
18:46:08FromDiscord<Rika> As expected from beef
18:46:16FromDiscord<dithpri> lol
18:46:30FromDiscord<ElegantBeef> Fuck yea, it's almost nearing my annual shower
18:46:38FromDiscord<Rika> Jesus
18:47:10FromDiscord<Recruit_main707> My point is, a seq of chars and a string do the same thing internally, so changing one to be different, would probably not be useful, both would change
18:47:24FromDiscord<ElegantBeef> I'm in oil country so i just swim in a tailing pond when i a feel dirty, then i feel filthy
18:47:44FromDiscord<Recruit_main707> im not asuming they probably will never be different tho, i said there is no obvious reason for it to happen
18:47:54FromDiscord<Rika> In reply to @Recruit_main707 "My point is, a": And our point is that they are completely different abstractions, which means they may change independently
18:48:09FromDiscord<ElegantBeef> Anyway guys, we've put enough warning signs, the dead end has come and gone
18:48:15FromDiscord<Rika> In reply to @Recruit_main707 "im not asuming they": Keyword obvious, I guess
18:48:58FromDiscord<dithpri> Even if string was just `distinct seq[char]` that's enough for a different function VS a cast imho
18:50:06FromDiscord<ElegantBeef> The only issue is presently people may rely on the `string -> seq[char]` and by adding that new `map` you make the change their code 😄
18:50:48FromDiscord<Rika> They said distinct
18:50:57FromDiscord<Rika> Oh
18:51:00FromDiscord<Rika> Misread
18:51:11FromDiscord<ElegantBeef> Hey i didnt misread this time?!
18:51:30FromDiscord<Rika> Nah you misinterpreted this time
18:51:34FromDiscord<Rika> I kid
18:51:46FromDiscord<ElegantBeef> Dont you start an arguement with me
18:52:10FromDiscord<dithpri> I thought of that, but then it's just a matter of defining the type of the result. ie. In the example it chooses the string -> string map because the return type is a string
18:52:31FromDiscord<dithpri> Even if you import sequtils
18:53:14FromDiscord<dithpri> The issue would arise if nim can't infer the return type, I'll have to run some tests
18:53:48FromDiscord<Rika> It can't
18:53:57FromDiscord<Rika> We don't have return type inference
18:54:00FromDiscord<Rika> (yet?)
18:54:15FromDiscord<Rika> No ideas if there are plans
18:54:24FromDiscord<Rika> Idea
18:54:37FromDiscord<dithpri> Oh, we don't?
18:54:46FromDiscord<dithpri> I thought we did, grr
18:55:16FromDiscord<Rika> There's probably some good reason we don't
18:56:12FromDiscord<ElegantBeef> but we do have generics so the following may work if i'm not being dumb presently. I find it hard to reason about what a `map` should look like `proc map[T; Y: seq[char] or string](a: string, b: proc(a: char): Y): Y`
18:56:29FromDiscord<Rika> What's the T for
18:56:39FromDiscord<ElegantBeef> me being dumb
18:56:43FromDiscord<Rika> Nice
18:57:18FromDiscord<Rika> B doesn't return a seq or string tho
18:57:24FromDiscord<Rika> Its a char to char
18:57:33FromDiscord<ElegantBeef> ah
18:58:18FromDiscord<ElegantBeef> So then it's fine since it'd not be an inferred generic and requires the explicit type
18:58:43FromDiscord<Recruit_main707> you can specify the generic type when calling the fucntion
19:09:07*tane joined #nim
19:10:49*Gustavo6046 quit (Ping timeout: 245 seconds)
19:13:35*Gustavo6046 joined #nim
20:33:10FromGitter<bung87> https://github.com/yglukhov/darwin/blob/master/darwin/objc/blocks.nim how can I evaluate Block ?
20:45:35FromDiscord<treeform> Can coffee scripts's ? operator be made in nim? So in coffeescript you can do `node?dirty=true`
20:45:39FromDiscord<treeform> which in nim would be:
20:46:04FromDiscord<treeform> sent a code paste, see https://play.nim-lang.org/#ix=3n2y
20:47:22FromDiscord<treeform> sent a code paste, see https://play.nim-lang.org/#ix=3n2z
20:48:36nphgtreeform: something like https://nim-lang.org/docs/wrapnils.html ?
20:49:32FromDiscord<treeform> oh yeah that is very similar! thanks
21:11:36*tane quit (Quit: Leaving)
21:15:53*superbia quit (Ping timeout: 260 seconds)
21:42:13*clyybber quit (Quit: WeeChat 3.1)
21:42:22*clyybber joined #nim
21:50:06*Vladar quit (Remote host closed the connection)
21:50:52*vsantana joined #nim
21:52:25*vsantana quit (Client Quit)
21:56:06*superbia joined #nim
22:08:58*superbia quit (Ping timeout: 268 seconds)
22:20:24*hyiltiz quit (Ping timeout: 245 seconds)
22:22:54*hyiltiz joined #nim
22:22:54*hyiltiz quit (Changing host)
22:22:54*hyiltiz joined #nim
22:30:58ForumUpdaterBotNew thread by Ajusa: Karax steps forward, see https://forum.nim-lang.org/t/7989
22:34:15*gmaggior quit (Quit: Leaving)
22:44:00*azed joined #nim
23:16:00*clyybber quit (Quit: WeeChat 3.1)
23:17:46FromDiscord<zetashift> @treeform does `pixie/fonts` also take care of `bold` and `italic` fonts versions? So can I `bold` text?
23:18:20FromDiscord<ElegantBeef> Cmon zeta use the discord styling bold and itallic so i can bold text 😛
23:19:06FromDiscord<zetashift> (edit) "`bold`" => "bold" | "`italic`" => "italic" | "`bold`" => "bold"
23:19:13FromDiscord<zetashift> Ah yesss much better
23:19:23FromDiscord<ElegantBeef> I sense snarcasm
23:20:04FromDiscord<zetashift> ah it wasn't sarcasm, more of a silly follow up haha
23:20:19FromDiscord<zetashift> Sarcasm and internet does not mix well so I try to avoid that
23:20:32FromDiscord<ElegantBeef> Poe was a dick and we dont need his law
23:22:22FromDiscord<zetashift> I did have to google Poe's law
23:22:33FromDiscord<ElegantBeef> It's ok i forgive you
23:23:19*azed quit (Quit: WeeChat 3.1)
23:23:43FromDiscord<zetashift> I can't think of a smart remark to say back 😦
23:23:54FromDiscord<ElegantBeef> Refer to my last comment
23:24:20FromDiscord<ElegantBeef> Now jokes aside i'm working on making an odd heterogeneous collection and macro errors are going to make me off someone
23:26:37FromDiscord<zetashift> Are you making typles?
23:26:45FromDiscord<zetashift> tuples
23:26:53FromDiscord<ElegantBeef> Lol, nope
23:27:15FromDiscord<ElegantBeef> https://media.discordapp.net/attachments/371759389889003532/843630704461217842/unknown.png
23:27:29FromDiscord<ElegantBeef> It's really just expanded into a tagged union
23:27:43FromDiscord<ElegantBeef> ~~Atleast i dont think this existed beforehand~~
23:35:58FromDiscord<zetashift> Python programmers would have a field day with that
23:38:49FromDiscord<ElegantBeef> Indeed, or people that are lazy
23:39:17FromDiscord<ElegantBeef> All of that currently functions, but the mutable iteration is saying no
23:39:23FromDiscord<treeform> In reply to @zetashift "<@!107140179025735680> does `pixie/fonts` also": Yes but you need to provide bold font. Pixie treats it as a different font.
23:40:25FromDiscord<treeform> Most fonts you download have a -Regular.ttf -Bold.ttf -Italic.ttf versions
23:41:03FromDiscord<treeform> You will have to use the Spans api to create N different spans they lay them out together see:
23:42:00FromDiscord<treeform> https://github.com/treeform/pixie/blob/master/tests/test_fonts.nim#L711
23:43:20FromDiscord<treeform> https://media.discordapp.net/attachments/371759389889003532/843634756855529492/spans4.png
23:43:34FromDiscord<zetashift> ah I did not see the code in tests damn
23:43:41FromDiscord<zetashift> I was working off `nimdocs/pixie` and the samples
23:44:10FromDiscord<treeform> We could do better job at docs for sure.
23:44:47FromDiscord<zetashift> It's alright, time is limited, I'm making notes of the things I'm stumbling upon and hoping I can share it a long for the next one
23:45:00FromDiscord<treeform> Yeah that would be good.