<< 09-11-2021 >>

00:05:16*stkrdknmibalz joined #nim
01:05:31FromDiscord<gcao> sent a long message, see http://ix.io/3Esc
01:09:05FromDiscord<Elegantbeef> You can kinda think of dynamic libraries as self contained applications that you interact with their exposed APIs, so if something is supposed to throw an exception you need to propagate that it errored through the API
01:09:25FromDiscord<Elegantbeef> So for instance you might use an `Option` or a `bool` to indicate it failed and write an error to a buffer
01:34:41FromDiscord<IsaacPaul> Hmm Interesting..
01:46:45FromDiscord<gcao> Thanks @ElegantBeef↵Another question: if I define a type in the dynamic library, or create a sub-type like (type D = ref object of A), D won't be recognized by the main program, right?
01:47:08FromDiscord<Yardanico> @gcao the thing with shared libraries is that you're interfacing with them by the C FFI
01:47:18FromDiscord<Elegantbeef> Of course remember dynamic libraries are basically self contained and dont have to be written in Nim
01:47:21FromDiscord<Yardanico> which doesn't know anything like that, it only knows how to call functions and stuff
01:47:34FromDiscord<Elegantbeef> We use C as an FFI bridge, so you can imagine everything as a C bridge
01:48:15FromDiscord<Elegantbeef> So when you have a dynamic library the way you interact with it is limited to C basically, you can wrap it to be more idiomatic, or use things like Genny to make it easier to use
01:49:56FromDiscord<Elegantbeef> So if you have an error in a library you need to bubble it up through the C bridge, which means you either need to try except then return a ptr to the error which both code bases have access to, use enums or bools
01:50:26FromDiscord<Elegantbeef> This is why many C libraries/apis take pointers and return an int on error, it's universal
01:54:40FromDiscord<gcao> ok. seems what I'm trying to do is not going to be very successful. I'm writing a toy dynamic language in Nim, but don't want to build all functionality in the main interpreter, and want to allow the user to write libraries in Nim, compile to dynamic library. I was hoping smooth transitioning between the main interpreter and the libraries
01:55:46FromDiscord<Elegantbeef> With something like that i'd reason you'd want to have user definable op codes, which you then call and the .dll handles it
01:57:31FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Esk
01:57:40FromDiscord<Elegantbeef> Which your interpreter calls and uses `initModule` as the entry
01:58:31FromDiscord<Elegantbeef> Then you have all your types that the dynamic libraries need in a module so they can do `import languagetypes` and you can write the op code logic
01:58:54FromDiscord<Elegantbeef> And of course you can use overloading fo `addOpCode` for specific overloads you support
01:59:32FromDiscord<Elegantbeef> You might have a `proc(a, b: Reg): (State, someVal)` and the like
02:00:17FromDiscord<Elegantbeef> and i suppose `initModule` also needs to be able to provide the logic for what calls this op code
02:01:02FromDiscord<gcao> I'm not using op codes. I create AST of Expression nodes, and allow the Expr to be sub-typed. But the sub-type defined in dynlib won't be known to the main interpreter
02:01:24FromDiscord<Elegantbeef> Ah that subtype is going to be an issue
02:01:45FromDiscord<Elegantbeef> You need to be able to parse the code and have it know where to call them
02:03:36FromDiscord<Elegantbeef> Hmm with subtypes you need to use runtime information to figure out if they're the same type so i dont pity you 😀
02:06:46FromDiscord<gcao> Thanks a lot for the information. I'll go back to the whiteboard to see what I do next 🙂
02:07:32FromDiscord<Elegantbeef> No problem, am interest if you find a soluiton
02:33:51*krux02 quit (Remote host closed the connection)
02:49:53FromDiscord<evoalg> I see table.values is an iterator, so can't use math's sum do `sum(table.values)` because math's sum doesn't support iterators it seems, so I have to do `sum(toSeq(table.values))` instead.↵I then started readying https://forum.nim-lang.org/t/7299 and it quickly got way over my head. Should I just use the toSeq way?
02:51:59FromDiscord<Elegantbeef> If you care about memory/performance make a function called sum that takes an `iterable[int or float]` otherwise just use the toseq sum
02:52:27FromDiscord<evoalg> ok I will use toSeq - thank you!
02:56:12FromDiscord<Elegantbeef> Ah right i needs a template so it's less fun https://play.nim-lang.org/#ix=3Esu
02:59:26FromDiscord<evoalg> Thank you! ... have I told you how Elegant you are?
02:59:37FromDiscord<Yardanico> [haxscramper](https://matrix.to/#/@haxscramper:matrix.org)\: only heard about this now - have you seen https://www.sourcetrail.com/blog/discontinue_sourcetrail/ ?
02:59:38FromDiscord<Yardanico> quite sad news
03:01:23FromDiscord<Elegantbeef> Lies are rude↵(@evoalg)
03:03:08FromDiscord<evoalg> I guess I look at you though the lens of your elegant code.↵Hey so when you say you had to use a template so it's less fun, what fun thing were you hoping to use instead?
03:03:25FromDiscord<Elegantbeef> It'd be nice if it could be a proc to hide the details
03:05:18FromDiscord<evoalg> I don't know what that means, but then again I'm not up to templates yet.↵... and seriously, thank you for your nice examples once again
03:21:11FromDiscord<evoalg> In reply to @Elegantbeef "Ah right i needs": I see you initialize result and also put result as the last line of the template, I'm guessing that even though proc's don't need that, templates do?
03:22:53FromDiscord<Elegantbeef> Yea templates dont have results
03:23:38FromDiscord<Elegantbeef> And cause templates are hygenic there is no issue of `result` being aliased
03:32:17FromDiscord<evoalg> I tried changing it from template to proc, just to see the error, and it seems that proc's don't accept iterables
03:32:41FromDiscord<Elegantbeef> Yea tht's my point 😀
03:33:26FromDiscord<evoalg> gotcha ok I'm slowly getting there 😉
04:06:02*supakeen quit (Quit: WeeChat 3.3)
04:06:32*supakeen joined #nim
04:44:24*kayabaNerve quit (*.net *.split)
04:44:24*mahlon quit (*.net *.split)
04:44:24*dv^_^ quit (*.net *.split)
04:44:25*rb quit (*.net *.split)
04:45:13*dv^_^ joined #nim
04:45:13*kayabaNerve joined #nim
04:45:13*mahlon joined #nim
04:45:13*rb joined #nim
04:55:26FromDiscord<Seven> Hi
05:18:31FromDiscord<IsaacPaul> anyway to skip an argument/parameter in importcc ?
05:20:17FromDiscord<Elegantbeef> I believe you can usue `#1` and etc
05:22:45FromDiscord<Seven> Why has this discord the best memes?
05:23:05FromDiscord<Seven> 'Cause you are the best people
05:23:17FromDiscord<Seven> <3
05:41:21FromDiscord<IsaacPaul> In reply to @Elegantbeef "I believe you can": doesnt work :sad:
05:44:01FromDiscord<IsaacPaul> sent a code paste, see https://play.nim-lang.org/#ix=3Et2
05:55:03*arkurious quit (Quit: Leaving)
05:58:19*Jjp137 quit (Quit: Leaving)
05:58:27*Jjp137 joined #nim
06:09:18*Aherin left #nim (The Lounge - https://thelounge.chat)
08:01:38*tiorock joined #nim
08:01:38*tiorock quit (Changing host)
08:01:38*tiorock joined #nim
08:01:38*rockcavera is now known as Guest4410
08:01:38*Guest4410 quit (Killed (cadmium.libera.chat (Nickname regained by services)))
08:01:38*tiorock is now known as rockcavera
08:18:49*pro joined #nim
08:45:51FromDiscord<Zoom> Is there anyone using Geany occasionally? Please, test https://github.com/geany/geany/pull/2988 and comment there to get it merged. Thanks.
09:09:22*PMunch joined #nim
09:12:11*pro quit (Quit: WeeChat 3.3)
10:30:48PMunchHmm, I have a socket based reader that reads and verifies data (think reading a size field and reading that amount of data, I don't know how much data I need to read until I start reading). I also have an async socket that I read data from. What would be the best way to use this reader proc on the socket?
10:31:53PMunchCurrently I have a try/except thing which tries to read from a string stream, and when that throws an exception it reads 10 bytes into it from the socket.
10:31:59PMunchBut this feels a bit.. dirty
10:32:16NimEventerNew thread by Rforcen: MNIST perceptron, see https://forum.nim-lang.org/t/8606
10:35:02FromDiscord<ynfle (ynfle)> @evoalg, you can do `a.values.toSeq` in 1.6.0
10:39:07*elph joined #nim
11:06:27*neurocyte0132889 joined #nim
11:06:27*neurocyte0132889 quit (Changing host)
11:06:27*neurocyte0132889 joined #nim
11:11:37*krux02 joined #nim
11:43:00*stkrdknmibalz quit (Quit: WeeChat 3.0.1)
12:06:02*supakeen quit (Quit: WeeChat 3.3)
12:06:31*supakeen joined #nim
12:32:30*xet7 quit (Remote host closed the connection)
12:39:20FromDiscord<MrOkram> sent a long message, see http://ix.io/3Euh
12:39:56FromDiscord<MrOkram> My guess is that i'm somehow not utilizing this for loop correctly, if so, please correct me
12:40:20FromDiscord<geekrelief> `..` is inclusive. You want to use `..<`
12:40:22FromDiscord<Rika> 0..1 -> 0, 1
12:40:23FromDiscord<Rika> yes
12:40:34FromDiscord<Rika> (edit) "->" => "gives"
12:44:53FromDiscord<MrOkram> Ohh, thanks, completely missed that...
13:17:50FromDiscord<Tom> Hi, y'all. What's the best source these days for compiling to wasm with Nim? And what's the smallest size people can usually pull off with it?
13:23:56FromDiscord<geekrelief> In reply to @Tom "Hi, y'all. What's the": I haven't looked at this closely, but maybe try? https://github.com/treeform/nim_emscripten_tutorial
13:24:42FromDiscord<geekrelief> You might have better luck asking in #gamedev
13:31:36FromDiscord<IsaacPaul> Using llvm you can target the generated code to wasm
13:32:06FromDiscord<IsaacPaul> compile the generated code to the Wasm target
13:33:35FromDiscord<IsaacPaul> No idea if it will work though without some elbow grease 😜
13:34:15*rockcavera quit (Remote host closed the connection)
13:39:00FromDiscord<Tom> Thanks much for the tips, y'all.
13:44:10*nixfreak_nim[m] is now known as nixfreaknim[m]
13:50:41NimEventerNew thread by Plgupa: Getting error installing Nimble on Windows 10, see https://forum.nim-lang.org/t/8607
14:16:47*ox is now known as oz
14:30:27*arkurious joined #nim
15:00:51FromDiscord<IsaacPaul> sent a code paste, see https://paste.rs/b8V
15:05:54FromDiscord<IsaacPaul> meh it all seems a bit annoying.. I'll just prefix the procs with `ICameraController_` . Problem solved. No trickery.
15:06:35FromDiscord<Rika> i mean you can automate it with a macro
15:12:14FromDiscord<IsaacPaul> I think if nim wanted me to have this syntax `Type.staticMethod()` it would have first class support. The more I think about it. It's literally a 1 character difference. `Type_staticMethod()` And the former method could be deceitful to other nim developers as they may assume the typedesc is needed.
15:12:43FromDiscord<Rika> the point of nim is that as little as possible is first class afaik?
15:13:06FromDiscord<Rika> and what is a static method in nim anyway, we dont have classes, theyre all simple types
15:13:22FromDiscord<IsaacPaul> Yea, the goal is just to organize them
15:13:35FromDiscord<Rika> use the typedesc or generics i guess
15:13:43*PMunch quit (Quit: Leaving)
15:13:47FromDiscord<Rika> `init[T: ICa...](...)`
15:14:45FromDiscord<IsaacPaul> The prefix works too and is simpler 🙂
15:15:06FromDiscord<IsaacPaul> I'm just too used to other syntaxes lol
15:15:07FromDiscord<Rika> your choice
15:23:08NimEventerNew Nimble package! pls - A simple but powerful task runner that lets you define your own commands by editing a YAML configuration file., see https://h3rald.com/pls
15:24:42FromDiscord<Rika> pls
15:32:55FromDiscord<dom96> https://h3rald.com/nifty/
15:32:59FromDiscord<dom96> how many PMs does Nim have now lol
15:33:32FromDiscord<Rika> prolly 4?
15:35:57*xet7 joined #nim
15:36:46FromDiscord<xflywind> nimble, nifty, nimph, slim, atlas, nimby, Nawabs afaik
15:50:32FromDiscord<Rika> ah i havent heard of slim and nimby
15:50:41FromDiscord<Rika> forgot atlas existed, but that isnt for normal use isnt it
15:51:57FromDiscord<dom96> 7, nice
16:00:48FromDiscord<hmmm> hayoo nimlies
16:02:15FromDiscord<hmmm> wtf is wrong with my excel nimlies? if I save this number: 3.4284602583 as csv excel ignores the dot an showes is as 34 billions and counting
16:02:35FromDiscord<hmmm> get bill gates on the line we going to get the truth about this
16:06:41FromDiscord<hmmm> jesus apparently the solution is a multi step process involving a legacy wizard and switching decimal and thousands separator
16:07:02FromDiscord<hmmm> multi billion software development for the win
16:08:27FromDiscord<hmmm> apparently the lesson here is to use strformat 👀
16:10:44FromDiscord<hips> In reply to @hmmm "wtf is wrong with": excel has notation settings
16:11:26FromDiscord<hips> might be set to use `,`
16:12:37FromDiscord<hmmm> those are tied to os wide regional settings iirc
16:13:10FromDiscord<hips> nope
16:13:25FromDiscord<hmmm> hmm
16:45:25*Vladar joined #nim
16:45:29FromDiscord<hmmm> oh shi
16:45:42FromDiscord<hmmm> I forgot if the replace I use usually is from re or strutils
16:46:11FromDiscord<hmmm> why do we have two in the first place
16:46:25FromDiscord<Rika> re is regex strutils is naiive
16:46:35FromDiscord<hmmm> it was strutils
17:03:41*stkrdknmibalz joined #nim
17:04:33*rockcavera joined #nim
17:04:33*rockcavera quit (Changing host)
17:04:33*rockcavera joined #nim
17:16:25FromDiscord<hmmm> the ^1 thingy for the last element of stuff is genius
17:26:29*xet7 quit (Ping timeout: 264 seconds)
17:39:11*xet7 joined #nim
17:41:23*xet7 quit (Client Quit)
17:50:10*vicecea quit (Remote host closed the connection)
17:50:40*vicecea joined #nim
18:28:04*xet7 joined #nim
18:28:33*xet7 quit (Remote host closed the connection)
18:31:34*xet7 joined #nim
18:32:02*xet7 quit (Remote host closed the connection)
18:53:50FromDiscord<!Drake> Can you turn off the GC in Nim?
18:56:11FromDiscord<Recruit_main707> compile with `--gc:none`, but 90% of the stdlib needs the gc, `--gc:regions` allows allocating and deallocating objects that would normally be garbage collected, but out of the very few people that dont use the gc, even less use or even know about regions
18:56:31*asd joined #nim
18:57:45asdline = "123"; if line[0].isDigit() # is failing for me. seems like line[0] is not longer returning a char. how do i fix this?
19:00:24asdweird nim playground says otherwise
19:07:22*xet7 joined #nim
19:13:46*rockcavera quit (Remote host closed the connection)
19:14:48FromDiscord<exelotl> In reply to @!Drake "Can you turn off": what is it about the GC that you want to avoid?
19:17:11asdfixed it nvm
19:17:15*asd left #nim (#nim)
19:18:42FromDiscord<exelotl> if you still want to have dynamically allocated objects that get free'd when there are no more references to them, but you want it to be deterministic and apply as soon as the last reference is broken, then you should look at `--gc:arc`
19:23:41FromDiscord<konsumlamm> (note that `arc` doesn't collect cycles)
19:24:21FromDiscord<konsumlamm> there's also `--gc:orc` which is based on `arc`, but also collects cycles
19:24:35FromDiscord<konsumlamm> so it's essentially a full gc
19:53:13*flynn4 joined #nim
20:00:45*stkrdknmibalz quit (*.net *.split)
20:00:47*flynn quit (*.net *.split)
20:00:47*flynn4 is now known as flynn
20:01:24FromDiscord<hmmm> boys how do echo only the first n columns of a dataframe in datamancer, I'm getting swarmed
20:01:39FromDiscord<hmmm> hmm I think I missed an I somewhere
20:10:33FromDiscord<RattleyCooper> Was looking at the blog post for VSCode's new Notebook API and they mention an extension called "Rainbow Indent". Noticed that Rainbow Indent's extension page on the marketplace has a snippet of Nim code to show as an example 😄
20:10:34FromDiscord<RattleyCooper> https://marketplace.visualstudio.com/items?itemName=oderwat.indent-rainbow
20:19:06FromDiscord<razzlom> For 1 second i think it writed in nim, but it javascript. 🙁
20:28:43FromDiscord<IsaacPaul> I'm getting that..
20:30:57FromDiscord<IsaacPaul> The notebook api is pretty cool.. it may replace joplin for me.. though much I'd prefer a non-electron notebook app :S aw well
20:34:14*neurocyte0132889 quit (Quit: The Lounge - https://thelounge.chat)
20:39:51*neurocyte0132889 joined #nim
20:39:51*neurocyte0132889 quit (Changing host)
20:39:51*neurocyte0132889 joined #nim
20:44:10FromDiscord<tandy> anyone have a good name idea for my nimble package ?
20:44:13FromDiscord<tandy> its a `jsony` plugin for `union` support
20:44:56FromDiscord<tandy> i was gna do jsony-union but i rememberd names cant have `-`
20:46:50FromDiscord<hmmm> jsuniony of course 😆
20:47:19FromDiscord<IsaacPaul> Let github generate one for you. Last one I got was 'laughing-archer' lol
20:47:47FromDiscord<tandy> lol↵(@hmmm)
20:48:02FromDiscord<tandy> i want it to be at least a bit self descriptive tho↵(@IsaacPaul)
20:48:21FromDiscord<hmmm> the rebellious jsonyDASHunion will shouw the world people cannot fk with you
20:48:35FromDiscord<tandy> maybe just uniony
20:48:46FromDiscord<hmmm> ye uniony it's ok
20:48:50FromDiscord<hmmm> feels friendly
20:49:43FromDiscord<IsaacPaul> yea that or union4jsony
20:50:01FromDiscord<IsaacPaul> honestly not having -'s or some sort of visual break sucks
20:50:02FromDiscord<hmmm> better yet uniony4jsony
20:50:13FromDiscord<hmmm> with a pink unicorn icon
20:51:03FromDiscord<IsaacPaul> In reply to @hmmm "the rebellious jsonyDASHunion will": lmbo
21:53:54FromDiscord<RattleyCooper> In reply to @razzlom "For 1 second i": Well they have an image with an example in nim 😛
21:54:09FromDiscord<RattleyCooper> (edit) "In reply to @razzlom "For 1 second i": Well they have an image with an example ... in" added "of the indent colors"
22:02:48*rockcavera joined #nim
22:02:48*rockcavera quit (Changing host)
22:02:48*rockcavera joined #nim
22:12:27FromDiscord<evoalg> and it's called nimbench_ex2.nim
22:34:38*supBros joined #nim
22:35:16*supBros quit (Client Quit)
22:52:09*Vladar quit (Quit: Leaving)
23:41:29*dv^_^ quit (Ping timeout: 244 seconds)
23:46:13*dv^_^ joined #nim