00:51:58 | FromDiscord | <.throwstar> Does nim have imaginary number support? |
00:55:39 | FromDiscord | <.throwstar> Specifically, c has the constant `I` in `complex.h` and Im looking for something like that |
00:56:56 | FromDiscord | <bostonboston> Std/complex |
00:57:21 | FromDiscord | <.throwstar> I skimmed this and I didnt see anything like `I` |
00:58:49 | FromDiscord | <bostonboston> What do you need to accomplish |
01:00:24 | FromDiscord | <.throwstar> Heres the c version of the equation im trying to copy `out[f] += in[i] cexp(2Ipi t)` |
01:01:17 | FromDiscord | <.throwstar> Im trying to learn fourier transforms and the storage of the output is a complex number because you can derive both sin and cosin from them |
01:03:34 | FromDiscord | <.throwstar> I can share my code if that would help |
01:03:40 | FromDiscord | <.throwstar> (edit) "I can share my code ... if" added "so far" |
01:08:10 | FromDiscord | <bostonboston> `complex(0, 1)` would be I, but the equation you want in Nim I believe is `exp(complex(0, 2pit))` |
01:10:26 | FromDiscord | <bostonboston> And std/complex defines `` for mixed real and complex operands, so you're covered there |
01:16:15 | FromDiscord | <.throwstar> In reply to @bostonboston "`complex(0, 1)` would be": I think this worked, thank you |
02:17:28 | FromDiscord | <kreed1415> I'm new to Nim. What exactly is config.nims vs nimble? |
02:18:15 | FromDiscord | <kreed1415> it's not clear when the code in config.nims runs if you do nimble mytask |
02:19:52 | FromDiscord | <bostonboston> Anytime you compile config files are processed following these rules https://nim-lang.org/docs/nimc.html#compiler-usage-configuration-files↵↵Including if you compile through a task |
02:22:43 | FromDiscord | <kreed1415> maybe it helps to show exactly what im stumbling on. I'm wanting to play around with the Sokol library which has a section on how to run their examples with Emscripten but it doesn't really explain the basics of how to pass the flag |
02:22:56 | FromDiscord | <kreed1415> https://github.com/floooh/sokol-nim/tree/master?tab=readme-ov-file#emscriptern---web |
02:24:12 | FromDiscord | <kreed1415> I have the toolchain installed and in my path so I believe I should just need to add the -d:emscripten somewhere |
02:25:14 | FromDiscord | <bostonboston> https://nim-lang.github.io/nimble/create-packages.html#nimble-tasks |
02:25:37 | FromDiscord | <bostonboston> You want to put -d:emscripten before the task name |
02:25:57 | FromDiscord | <kreed1415> let met give that a shot |
02:26:02 | FromDiscord | <kreed1415> (edit) "met" => "me" |
02:29:02 | FromDiscord | <kreed1415> interesting, so that compiles but the flag doesn't seem to do anything. The flag is seems to be a part of the config.nims file I was instructed to add but im not sure if I need to do anything to the nimble for it to actually use config.nims |
02:29:11 | FromDiscord | <kreed1415> (edit) removed "is" |
02:52:43 | FromDiscord | <kreed1415> ah ok I managed to get it working just not with a nimble. |
02:55:32 | * | valms19901 quit (Ping timeout: 252 seconds) |
03:11:04 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#pasty=sHePVlgS |
03:13:25 | FromDiscord | <Elegantbeef> `mapIt` does not take an iterable |
03:13:55 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=QbSSgknq |
03:14:26 | FromDiscord | <Phil> That's inefficient as hell though (2 copies of the seq, no?), that you didn't perish writing this is amazing! |
03:14:31 | FromDiscord | <bostonboston> In reply to @kreed1415 "interesting, so that compiles": The config.nims just needs to be in one of those directories described in the docs, but in this case probably in the same dir as the nimble file. In the repo you send me at the bottom it says to use nimble build -d: emscripten, did you try that one? |
03:14:41 | FromDiscord | <Elegantbeef> The super explodey itermacros has a mapIt |
03:15:03 | FromDiscord | <Elegantbeef> `tbl.pairs.mapIt((it[0], it[1])).collect()` works with those |
03:15:06 | FromDiscord | <albassort> alright |
03:15:11 | FromDiscord | <Elegantbeef> Sorry `slicerator/itermacros` |
03:15:35 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#pasty=zmKPFzcT |
03:15:39 | FromDiscord | <kreed1415> In reply to @bostonboston "The config.nims just needs": yeah it wasn't working. I made my own repo with a single file and am slowly writing a .nimble to try and understand. it's a learning process |
03:15:41 | FromDiscord | <albassort> yes this needs to exist |
03:16:04 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#pasty=OTGYWHss |
03:16:12 | FromDiscord | <albassort> what do? its defined by its capacity to have this function |
03:16:18 | FromDiscord | <albassort> so it should know |
03:16:34 | FromDiscord | <albassort> err |
03:16:35 | * | rockcavera quit (Remote host closed the connection) |
03:16:37 | FromDiscord | <albassort> maybe i should use func |
03:16:45 | FromDiscord | <Phil> In reply to @Elegantbeef "*The super explodey itermacros": I already need to invest more time into maintenance than I like, I ain't adding more explody stuff on top of it. |
03:16:47 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=gkSTElBZ |
03:17:04 | FromDiscord | <Phil> But thanks for the hint, I'll take the easy route out and just do a for-loop |
03:17:10 | FromDiscord | <Elegantbeef> Hey my chains macro in that package is pretty safe 😛↵(@Phil) |
03:17:26 | FromDiscord | <albassort> i dont know what a mixin is 😭 |
03:17:30 | FromDiscord | <albassort> in nim |
03:17:41 | FromDiscord | <Phil> It's about where a generic looks for symbol |
03:18:11 | FromDiscord | <Elegantbeef> > Generics have a feature called mixin which allow the compiler to look at the scope of instantion aswell as declaration for a symbol. This allows something some refer to as a "Generic Interface", where user code allows overriding behaviour without runtime costs. |
03:18:13 | FromDiscord | <Phil> And at least either I don't understand it well or the way it functions is very... mixed, likely both |
03:18:16 | FromDiscord | <Elegantbeef> From my writeup |
03:18:19 | FromDiscord | <kreed1415> Is it common to use a .nimble as the build tool for an app even if it isn't meant to be a package? |
03:18:31 | FromDiscord | <albassort> and how does this work here beef? |
03:18:36 | FromDiscord | <Elegantbeef> I just use `config.nims` cause nimble is slow for rapid protoyping |
03:18:57 | FromDiscord | <Elegantbeef> Assuming `JsonStorable` is a generic constraint it allows your `%` to be chosen at that procedure's instantiation |
03:19:31 | FromDiscord | <albassort> no % refers to the func and procs in std/Json |
03:19:41 | FromDiscord | <Elegantbeef> Write cause it bound to it |
03:19:44 | FromDiscord | <Elegantbeef> Right\ |
03:19:55 | FromDiscord | <Elegantbeef> `mixin` will force it to resolve to the most specific overload at instantiation |
03:20:04 | FromDiscord | <albassort> and where do i put this? |
03:20:05 | FromDiscord | <Elegantbeef> That's the entire point |
03:20:08 | FromDiscord | <Phil> In reply to @kreed1415 "Is it common to": I personally use it because I started and am really not feeling the effort to migrate.↵It does what I need. Generally though as a build-tool... I dunno. config.nims can be neat as well and is potentially faster. Could also look into Atlas |
03:20:15 | FromDiscord | <Elegantbeef> Inside your procedure that calls `%` |
03:20:21 | FromDiscord | <Phil> (edit) "In reply to @kreed1415 "Is it common to": I personally use it because I started ... and" added "with it" |
03:20:41 | FromDiscord | <Elegantbeef> I also hate complex build systems so much prefer just setting a flag and having it go |
03:20:51 | FromDiscord | <kreed1415> In reply to @isofruit "I personally use it": i just like the idea of being able to setup tasks which seems to be a nimble thing, but I suppose I could just pass flags to config |
03:21:02 | FromDiscord | <Elegantbeef> Tasks work in config.nims aswell |
03:21:10 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#pasty=AMYAovix |
03:21:11 | FromDiscord | <Elegantbeef> you just do `nim taskname` |
03:21:21 | FromDiscord | <Elegantbeef> Yes |
03:21:21 | FromDiscord | <Phil> In reply to @kreed1415 "i just like the": I mean, I use it that way. I have nimble tasks for literally everything, from compiling to building and deploying a docker-container |
03:21:23 | FromDiscord | <kreed1415> syntax hilighting got mad at it |
03:21:28 | FromDiscord | <albassort> nah didn't work |
03:21:29 | FromDiscord | <Elegantbeef> What I like doing is defining my tasks in a config.nims then `include`ing it |
03:21:35 | FromDiscord | <Elegantbeef> What's the error now? |
03:21:48 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#pasty=xXlhhcfU |
03:21:55 | FromDiscord | <albassort> (edit) "https://play.nim-lang.org/#pasty=FVEXGyQd" => "https://play.nim-lang.org/#pasty=dkKiObIi" |
03:22:00 | FromDiscord | <Elegantbeef> Do you have a `%` that works on your type? |
03:22:04 | FromDiscord | <bostonboston> In reply to @kreed1415 "Is it common to": I use it for a few projects that aren't libraries and just ignore the nimble develop and nimble build cmds |
03:22:07 | FromDiscord | <Elegantbeef> I aint so no overload there |
03:22:19 | FromDiscord | <albassort> this is a compiler error, its not being used yet |
03:22:31 | FromDiscord | <albassort> so its just not compiling for any type |
03:22:32 | FromDiscord | <Elegantbeef> What's your proc? |
03:22:44 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#pasty=BeBFLlFq |
03:22:55 | FromDiscord | <Elegantbeef> No |
03:22:55 | FromDiscord | <Elegantbeef> What's your `%` proc |
03:23:04 | FromDiscord | <albassort> none specific, its not used |
03:23:21 | FromDiscord | <Elegantbeef> Huh |
03:23:24 | FromDiscord | <albassort> the function isn't being called anywhere |
03:23:33 | FromDiscord | <albassort> (edit) "function" => "proc" |
03:23:40 | FromDiscord | <Elegantbeef> That's my point what is your `%` you're trying to invoke |
03:23:41 | FromDiscord | <kreed1415> huh yeah this works but vscode syntax hilithing haes it |
03:23:42 | FromDiscord | <bostonboston> In reply to @kreed1415 "syntax hilighting got mad": Seems to be a known issue https://github.com/nim-lang/vscode-nim/issues/74 |
03:23:43 | FromDiscord | <kreed1415> (edit) "haes" => "hates" |
03:24:15 | FromDiscord | <Elegantbeef> https://github.com/beef331/libnimib/blob/master/config.nims↵https://github.com/beef331/libnimib/blob/master/nimib.nimble#L16My preferred way of making tasks if I was not clear |
03:24:18 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#pasty=yWpuBZDm |
03:24:44 | FromDiscord | <Elegantbeef> Is it accessible in the module invoking your `initParams`? |
03:24:50 | FromDiscord | <albassort> yes |
03:24:59 | FromDiscord | <Elegantbeef> Before the call? |
03:25:03 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#pasty=BsdmslJy |
03:25:06 | FromDiscord | <albassort> it has all of these |
03:25:13 | FromDiscord | <albassort> it doesn't have any for JsonStorable |
03:25:26 | FromDiscord | <albassort> but JsonStorable is defined by its % |
03:25:26 | FromDiscord | <Elegantbeef> Right so the issue is likely just concepts |
03:25:35 | FromDiscord | <Elegantbeef> `[T: JsonStorable](args: varargs[T])` |
03:25:41 | FromDiscord | <Elegantbeef> Skip the concept |
03:25:55 | FromDiscord | <Elegantbeef> This is most likely not what you want anyway |
03:26:10 | FromDiscord | <Elegantbeef> I assume you want to be able to do `initParams(10, "hmm", 30)` |
03:26:25 | FromDiscord | <albassort> yes :3 |
03:26:40 | FromDiscord | <Elegantbeef> So yea you want a macro |
03:26:52 | FromDiscord | <albassort> but i never learned macros in 4 years |
03:26:54 | FromDiscord | <albassort> i dont wanna do it now |
03:26:55 | FromDiscord | <Elegantbeef> `varargs[T]` does not work for invariant types |
03:27:02 | FromDiscord | <Elegantbeef> Well then use a tuple |
03:27:26 | FromDiscord | <Elegantbeef> `proc initParams(args: tuple)` |
03:27:32 | FromDiscord | <Elegantbeef> Tuples are Nim's varadic generics |
03:27:47 | FromDiscord | <Elegantbeef> Can do `args: tuple | object` |
03:28:54 | FromDiscord | <albassort> how can i get the length of a tuple? |
03:29:40 | FromDiscord | <Elegantbeef> `typetraits.tupleLen` |
03:34:05 | FromDiscord | <albassort> err |
03:34:10 | FromDiscord | <albassort> how can iterate over a tuple? |
03:34:26 | FromDiscord | <Elegantbeef> `fields` |
03:34:28 | FromDiscord | <albassort> yes |
03:34:29 | FromDiscord | <albassort> thank you |
03:34:30 | FromDiscord | <albassort> i forgor |
03:37:16 | FromDiscord | <albassort> alright |
03:37:42 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#pasty=UOCyZyRL |
03:37:49 | FromDiscord | <albassort> boom, static typing be damned |
03:37:52 | FromDiscord | <albassort> ...almost |
03:38:19 | FromDiscord | <Elegantbeef> You best make a better error message |
03:39:04 | FromDiscord | <albassort> also this sugar needs to exist because the BTC rpc takes args positionally and needs them to be the right type |
03:39:15 | FromDiscord | <albassort> which is... insane and stupid |
03:39:29 | FromDiscord | <Elegantbeef> Something using json and using positional can die |
04:40:29 | * | SchweinDeBurg quit (Quit: WeeChat 4.6.0-dev) |
04:40:53 | FromDiscord | <dawidek.2137> is there an alternative to repr for arc/org? |
04:54:14 | FromDiscord | <bosinski2023> In reply to @dawidek.2137 "is there an alternative": yes, make a `proc `$`( pt :ptr T) :string =` |
04:54:55 | FromDiscord | <bosinski2023> (edit) "`$`(" => "`$`[T](" |
05:14:49 | FromDiscord | <demotomohiro> In reply to @dawidek.2137 "is there an alternative": Or you can just dereference it if you know it is not nil. Like `echo myref[]` |
06:04:30 | * | coldfeet joined #nim |
06:14:53 | * | SchweinDeBurg joined #nim |
06:52:56 | * | alexdaguy joined #nim |
08:12:51 | * | coldfeet quit (Quit: Lost terminal) |
10:06:54 | FromDiscord | <System64 ~ Flandre Scarlet> Hi!↵I want to implement scripting in my program. Should I use Lua or Python for user scripts? What are the pros and cons of each? |
10:07:46 | Amun-Ra | lua is usually a first choice, dunno about nim-lua wrappers |
10:08:26 | FromDiscord | <Elegantbeef> It's more tedious but I continue to say wasm is best for scripting 😄 |
10:08:35 | Amun-Ra | :P |
10:08:50 | Amun-Ra | that's unorthodox choice :> |
10:09:04 | FromDiscord | <System64 ~ Flandre Scarlet> Wasm is complex for users |
10:09:19 | FromDiscord | <Elegantbeef> Just ship a lua to wasm compiler 😄 |
10:10:01 | FromDiscord | <System64 ~ Flandre Scarlet> Or LUAJIT? |
10:10:28 | FromDiscord | <Elegantbeef> Use lua over python |
10:10:43 | FromDiscord | <Elegantbeef> Wren, dascript, and angelscript are other alternatives |
10:11:01 | FromDiscord | <System64 ~ Flandre Scarlet> Are they supported by Nim? |
10:12:37 | FromDiscord | <Elegantbeef> They're embeddable |
10:13:14 | FromDiscord | <System64 ~ Flandre Scarlet> I meant↵Is there some Nim modules for that? I know there is one for Lua |
10:13:34 | FromDiscord | <Elegantbeef> no clue |
10:20:38 | FromDiscord | <odexine> Wren one exists |
10:20:47 | FromDiscord | <odexine> Probably dead because it’s from liquid from what I recall |
11:09:21 | * | valms19901 joined #nim |
12:03:42 | FromDiscord | <dawidek.2137> there are rumors you can use nimscript in your own program |
12:03:54 | FromDiscord | <dawidek.2137> as in, evaluate it at runtime |
12:04:37 | FromDiscord | <odexine> Rumours?? |
12:07:52 | FromDiscord | <System64 ~ Flandre Scarlet> But I think that Nimscript isn't the fastest |
12:08:29 | Amun-Ra | are you writing game engine? |
12:21:05 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Amun-Ra "are you writing game": No, but it will involve DSP stuff |
12:21:18 | Amun-Ra | via scripting? |
12:21:41 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Amun-Ra "via scripting?": There is a module where you can write code |
12:34:56 | FromDiscord | <griffith1deadly> when dont support reentrant calls |
12:35:48 | FromDiscord | <griffith1deadly> In reply to @sys64 "But I think that": as i see some time ago, someone says that nims slower that python (maybe specific to use case) |
12:36:00 | FromDiscord | <griffith1deadly> (edit) "when" => "wren" |
12:37:32 | FromDiscord | <griffith1deadly> i some time ago found that language good, but i dont have enough time to make my personal project with binding for it↵ https://github.com/marcobambini/gravity |
12:48:02 | FromDiscord | <odexine> In reply to @griffith1deadly "as i see some": It generally is, the interpreter was kinda just for macros and compile time evaluation at first |
12:48:14 | FromDiscord | <odexine> Not as much optimisation put into it as python |
12:51:58 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @griffith1deadly "i some time ago": Sounds interesting! |
12:52:31 | FromDiscord | <System64 ~ Flandre Scarlet> About Python with Nim?↵Does the user must install Python? Or is it directly embedded into my program? |
12:58:25 | Amun-Ra | you have to have libpython installed |
12:58:34 | FromDiscord | <griffith1deadly> In reply to @sys64 "About Python with Nim?": as i know it is limited to system python installation |
12:58:52 | Amun-Ra | and all the stdlib files a script may use |
13:08:47 | * | coldfeet joined #nim |
13:13:52 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Amun-Ra "and all the stdlib": So I may have a bunch of stuff? |
13:14:21 | * | coldfeet quit (Quit: Lost terminal) |
13:15:33 | * | alexdaguy quit (Quit: WeeChat 4.4.4) |
13:16:17 | Amun-Ra | you have to have libpythonX.XX-stdlib or -minimal installed; when on windows - whole python; although local libpython.dll and stdlib directory may also work |
13:17:23 | FromDiscord | <System64 ~ Flandre Scarlet> And can the Python script even call Nim code? |
13:17:45 | Amun-Ra | if you embed python to the nim app you expose the api to a script |
13:17:53 | Amun-Ra | s/if/when/ |
13:18:02 | FromDiscord | <Robyn [She/Her]> you could use pocketlang as the scripting engine |
13:18:08 | Amun-Ra | or lua |
13:18:42 | FromDiscord | <Robyn [She/Her]> https://github.com/khchen/nimpk |
13:18:56 | FromDiscord | <Robyn [She/Her]> In reply to @Amun-Ra "or lua": Lua was already said tbf :p |
13:19:03 | Amun-Ra | I know :) |
13:19:11 | Amun-Ra | that's my subliminal message ;) |
13:21:10 | FromDiscord | <Robyn [She/Her]> lol |
13:25:31 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @chronos.vitaqua "https://github.com/khchen/nimpk": Oh that looks convincing |
13:25:39 | FromDiscord | <System64 ~ Flandre Scarlet> Same for Lua |
13:25:57 | FromDiscord | <Robyn [She/Her]> indeed~ |
13:26:03 | FromDiscord | <Robyn [She/Her]> tho smh, WASM is superior |
13:26:18 | FromDiscord | <System64 ~ Flandre Scarlet> Can Lua also have deep integration with Nim? |
13:26:52 | FromDiscord | <Robyn [She/Her]> In reply to @sys64 "Can Lua also have": It exposes an API and it's made to be embedded so I'd assume so, you just gotta find some modern Nim bindings |
13:28:43 | FromDiscord | <System64 ~ Flandre Scarlet> Oh, PocketLang arrays start at 0! |
13:29:29 | FromDiscord | <Robyn [She/Her]> indeed |
13:29:50 | Amun-Ra | and I guess pocketlang has ints too |
13:29:56 | Amun-Ra | lua has only number |
13:36:57 | FromDiscord | <System64 ~ Flandre Scarlet> And probably faster than Python too |
13:47:58 | * | ntat joined #nim |
14:00:55 | FromDiscord | <odexine> In reply to @Amun-Ra "lua has only number": before 5.3 |
14:00:59 | FromDiscord | <odexine> Or was it 5.2 |
14:01:18 | Amun-Ra | I lost contact with lua ~5.1/5.2-ish |
14:06:22 | FromDiscord | <odexine> Most people never go past 5.1. Lua kinda went bonkers then TBF |
14:06:56 | FromDiscord | <rakgew> well 5.1 was the jit version iirc |
14:10:52 | FromDiscord | <System64 ~ Flandre Scarlet> Lua Nim modules are so old |
15:12:10 | FromDiscord | <Robyn [She/Her]> In reply to @sys64 "Lua Nim modules are": nimpk it is then? :( |
15:12:15 | FromDiscord | <Robyn [She/Her]> (edit) ":(" => ":)" |
15:23:56 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @chronos.vitaqua "nimpk it is then?": 5 months since the last commit, so that's ok |
15:32:33 | * | krux02 joined #nim |
15:38:32 | FromDiscord | <Robyn [She/Her]> In reply to @sys64 "5 months since the": If It Works, It's Good Enough™️ |
15:42:45 | * | nils` quit (Ping timeout: 248 seconds) |
16:40:39 | FromDiscord | <marioboi3112> In reply to @sys64 "I guess it's Python": yeah, some python std modules ported into Nim modules |
17:11:08 | * | nils` joined #nim |
17:14:13 | FromDiscord | <kreed1415> Are there a good list of impressive applications that use Nim? I'm interested in making the case to try using it for some work stuff. |
17:14:39 | FromDiscord | <.bobbbob> https://github.com/ringabout/awesome-nim |
17:19:56 | FromDiscord | <kreed1415> I meant like released applications. Maybe companies that use Nim |
17:22:31 | FromDiscord | <angelsdust> Many companies have NDAs |
17:22:47 | FromDiscord | <demotomohiro> In reply to @kreed1415 "I meant like released": https://github.com/nim-lang/Nim/wiki/Organizations-using-Nim↵https://internet-of-tomohiro.pages.dev/nim/faq.en#community-is-there-game-created-with-nimqmark |
17:23:55 | FromDiscord | <bostonboston> In reply to @kreed1415 "Are there a good": I think the largest public use of Nim, is Status |
17:25:47 | FromDiscord | <kreed1415> In reply to @demotomohiro "https://github.com/nim-lang/Nim/wiki/Organizations-": nice thanks |
17:31:50 | * | nils` quit (Ping timeout: 265 seconds) |
18:06:01 | * | nils` joined #nim |
18:52:15 | FromDiscord | <Robyn [She/Her]> In reply to @marioboi3112 "yeah, some python std": I don't think they're ported, it actually calls the Python function |
18:52:47 | FromDiscord | <Robyn [She/Her]> Yeah it calls the OG Python function |
18:53:02 | FromDiscord | <Robyn [She/Her]> It's using `nimpy` and wrapping it so it's typesafe and idiomatic |
18:59:51 | FromDiscord | <kreed1415> can anyone point me to a resource on generating wrappers for c/c++ libs? |
19:00:13 | FromDiscord | <kreed1415> I see wrappers all over the place that say they were generated but I don't see a resource on how one actually makes these |
19:02:48 | FromDiscord | <marioboi3112> In reply to @chronos.vitaqua "Yeah it calls the": oh reallyy?? i thought they were ported, i was lookin for the UPBGE lib there but cant seem to find it |
19:03:56 | FromDiscord | <Robyn [She/Her]> In reply to @marioboi3112 "oh reallyy?? i thought": UPBGE? |
19:04:29 | FromDiscord | <bostonboston> In reply to @kreed1415 "can anyone point me": c2nim, futhark |
19:04:30 | FromDiscord | <promator> Its so easy, even I did it.↵On cell now, but can share later↵(@kreed1415) |
19:04:36 | FromDiscord | <Robyn [She/Her]> In reply to @kreed1415 "can anyone point me": Well for C, there's Futhark, and before Futhark people used `c2nim` but iirc it's p broken now |
19:04:48 | FromDiscord | <Robyn [She/Her]> https://github.com/PMunch/futhark @kreed1415 |
19:04:57 | FromDiscord | <kreed1415> yeah I tried c2nim and it had a massive memory leak |
19:07:25 | Amun-Ra | memory leak? it's more than probably user fault |
19:08:26 | FromDiscord | <demotomohiro> Wrapping C/C++ library with Nim doesn't means resources C/C++ library allocates are automatically freed.↵You need to manually free C/C++ resources yourself or wrap them using destructor. |
19:08:47 | FromDiscord | <marioboi3112> In reply to @chronos.vitaqua "UPBGE?": yes indeed |
19:09:03 | * | nils` quit (Ping timeout: 276 seconds) |
19:09:44 | FromDiscord | <Robyn [She/Her]> never heard of it |
19:10:12 | FromDiscord | <kreed1415> In reply to @Amun-Ra "memory leak? it's more": I literally mean I ran the c2nim command and suddenly 24gigs of my ram were gone |
19:10:19 | FromDiscord | <kreed1415> I wasn't using the generated lib |
19:10:23 | FromDiscord | <Robyn [She/Her]> Oh |
19:10:28 | FromDiscord | <Robyn [She/Her]> Jesus |
19:10:29 | FromDiscord | <kreed1415> it's also a known issue |
19:10:34 | FromDiscord | <kreed1415> it was reported by others months ago |
19:11:03 | FromDiscord | <marioboi3112> In reply to @chronos.vitaqua "never heard of it": really? its basically a game engine based on Blender |
19:11:47 | FromDiscord | <marioboi3112> uses python for scripting, but i noticed that UPBGE was on cpython's repo and was wondering if there were any docs |
19:13:08 | FromDiscord | <Robyn [She/Her]> Aah okay, yeah no clue, sorry |
19:13:19 | FromDiscord | <marioboi3112> yeah no probs! |
19:13:25 | FromDiscord | <Robyn [She/Her]> In reply to @kreed1415 "it was reported by": Could try compiling c2nim with the refc memory manager and seeing if it helps? |
19:14:48 | * | beholders_eye joined #nim |
19:29:58 | * | nils` joined #nim |
19:33:10 | * | beholders_eye quit (Ping timeout: 265 seconds) |
19:35:39 | FromDiscord | <kreed1415> aaaaand now getting futhark to run on windows is being a pain |
19:40:04 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @kreed1415 "Are there a good": https://system64mc.github.io/kurumi |
19:42:58 | FromDiscord | <System64 ~ Flandre Scarlet> I've written this in Nim |
19:43:58 | * | beholders_eye joined #nim |
19:50:41 | FromDiscord | <marioboi3112> In reply to @kreed1415 "aaaaand now getting futhark": why not try wsl then |
19:51:08 | FromDiscord | <marioboi3112> In reply to @sys64 "https://system64mc.github.io/kurumi": is this like a showcase of your custom GUI lib |
19:54:26 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @marioboi3112 "is this like a": No I use Dear ImGui |
20:13:27 | FromDiscord | <promator> With javascript as target?↵(@System64 ~ Flandre Scarlet) |
20:19:58 | FromDiscord | <Elegantbeef> Likely wasm |
20:20:17 | FromDiscord | <Elegantbeef> Yea there's an index.wasm |
20:20:26 | FromDiscord | <promator> Oh nice |
20:24:16 | FromDiscord | <marioboi3112> In reply to @sys64 "No I use Dear": ohhh i see |
20:24:42 | FromDiscord | <marioboi3112> also is it intentional for the piano to not make any sounds |
20:26:11 | FromDiscord | <Elegantbeef> Seems one has to enable audio preview |
20:27:48 | FromDiscord | <promator> Dont you have to output js first to get wasm? Havent checked on nim wasm support for some time |
20:28:35 | FromDiscord | <Elegantbeef> No |
20:28:44 | FromDiscord | <Elegantbeef> You can compile wasm then load it with any JS |
20:28:56 | FromDiscord | <Elegantbeef> Or even use it in a non browser wasm VM |
20:29:01 | FromDiscord | <promator> Thats nice, need to check up on that |
20:30:44 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Elegantbeef "Or even use it": But would it work for a GUI app? |
20:32:14 | FromDiscord | <Elegantbeef> If you expose the same functions that you use in the browser to the wasm VM |
20:32:41 | FromDiscord | <Elegantbeef> sdl2/glfw aren't magic in the browser, they expose functions you can use in the wasm VM |
20:33:19 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Elegantbeef "sdl2/glfw aren't magic in": Oh so I need to write a fronted? |
20:34:15 | FromDiscord | <Elegantbeef> When you load the wasm VM you need to expose all the host functions that your library exposes |
20:35:11 | FromDiscord | <Elegantbeef> Which is practically what your browser does when you link sdl2 or glfw |
20:35:33 | FromDiscord | <Elegantbeef> Not that there is any point in doing it with a wasm vm outside of browser, just compile to native |
20:36:01 | FromDiscord | <System64 ~ Flandre Scarlet> It would be worth if it was truly compile once run everywhere |
20:36:19 | FromDiscord | <Elegantbeef> Except your host binary would have to be compiled for every target you wanted to support |
20:36:28 | FromDiscord | <Elegantbeef> Just like your browser is |
20:43:49 | FromDiscord | <Elegantbeef> Compile once run everywhere is quite tedious aswell unless you target a well installed VM with support for your libraries (Java/Browser Standard WASM) 😄 |
20:51:29 | Amun-Ra | I build that way (except ofc libc) |
20:51:57 | Amun-Ra | well, that depends on the definition of "everywhere" |
20:52:15 | FromDiscord | <Elegantbeef> You build a binary to target all OSes? |
20:52:23 | FromDiscord | <Elegantbeef> Have fun with cosmopolitan libc |
20:53:06 | Amun-Ra | all Linux OS-es with any version of external libraries I depend on, except libc |
20:53:56 | FromDiscord | <Elegantbeef> That hardly counts |
20:54:12 | FromDiscord | <promator> Why Not musl |
20:54:27 | FromDiscord | <Elegantbeef> cause dynamic libraries are nice 😛 |
20:54:41 | FromDiscord | <promator> Meh |
20:54:56 | FromDiscord | <promator> Tell that golang |
20:54:57 | FromDiscord | <Elegantbeef> I will |
20:55:18 | FromDiscord | <Elegantbeef> Who wants to compile a static library for musl for all their deps |
20:55:18 | Amun-Ra | https://dpaste.com/743KNEG7E |
20:56:25 | FromDiscord | <Elegantbeef> Yea that's nice but then you have to use something like my rdldd to find what it links 😄 |
20:56:28 | * | beholders_eye quit (Ping timeout: 252 seconds) |
20:57:06 | FromDiscord | <Elegantbeef> My program that uses sdl2\_nim and opengl has the same list of linked libraries btw |
20:57:16 | Amun-Ra | I made dynlib wrapper and I had to wrap all supported libs and I just look up from higher priority one to the least priority one :> |
20:59:22 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=dJbYTIlJ |
21:02:06 | Amun-Ra | that was my first library I've written in Nim (and don't look at those macros, they work tho) ;) https://github.com/amnr/dlutils |
21:05:28 | * | beholders_eye joined #nim |
21:10:28 | FromDiscord | <Elegantbeef> I wonder if an `importc` variant that takes a book would've been accepted for the `{.unchecked.}` equivalent |
21:11:14 | Amun-Ra | hmm |
21:11:47 | FromDiscord | <Elegantbeef> Given Nim's `dynlib` mechanism there really is not much point in forcing you to do all of this work is all my point is |
21:11:59 | FromDiscord | <Elegantbeef> Like it already does most of this |
21:12:55 | Amun-Ra | it's just less typing, and having optional bindings is good for portability |
21:13:21 | FromDiscord | <Elegantbeef> Right but the optional nature could be done in Nim's dynlib stuff |
21:13:51 | FromDiscord | <Elegantbeef> with an `importc` that takes an optional bool, same with a `dynlib` probably |
21:14:01 | Amun-Ra | true |
21:26:29 | FromDiscord | <kreed1415> can anyone explain how to use futhark to generator a wrapper for a dynamic lib? |
21:26:46 | FromDiscord | <Elegantbeef> Point it at the header then link the dll |
21:26:47 | FromDiscord | <kreed1415> the docs show how to generate when compiling from source |
21:27:40 | FromDiscord | <kreed1415> In reply to @Elegantbeef "Point it at the": so in the souerce you just importc the headers and where do you do the linking? |
21:27:56 | FromDiscord | <Elegantbeef> `--passL` |
21:28:00 | FromDiscord | <kreed1415> (edit) "souerce" => "source" |
21:28:11 | FromDiscord | <kreed1415> just when I run the script? |
21:28:41 | FromDiscord | <Elegantbeef> Either `{.passL: ...}` in your code or `--passL:` in your config |
21:28:49 | FromDiscord | <kreed1415> oh I can do that |
21:38:43 | FromDiscord | <kreed1415> So do I need to always provide the full source to Futhark or just the headers I want to wrap? |
21:39:25 | FromDiscord | <kreed1415> sent a code paste, see https://play.nim-lang.org/#pasty=McpXaojl |
21:39:53 | FromDiscord | <kreed1415> sent a code paste, see https://play.nim-lang.org/#pasty=GpGuYKRD |
21:40:15 | FromDiscord | <kreed1415> which is a dependency of the file but not one of the headers you would normally need to use |
21:41:13 | * | ntat quit (Read error: Connection reset by peer) |
21:42:34 | FromDiscord | <Elegantbeef> You just supply it the headers |
21:44:09 | * | valms19901 quit (Ping timeout: 265 seconds) |
21:44:38 | FromDiscord | <kreed1415> In reply to @Elegantbeef "You just supply it": hmm then I wonder why it is trying to find that header |
21:44:58 | FromDiscord | <Elegantbeef> Probably cause you did not provide the correct path |
21:45:06 | FromDiscord | <kreed1415> well that file isn't in the path |
21:45:08 | * | ntat joined #nim |
21:45:11 | FromDiscord | <Elegantbeef> It uses flags just like a C compiler |
21:45:22 | FromDiscord | <kreed1415> that header isn't one that is shipped with SDL |
21:45:36 | FromDiscord | <kreed1415> I could add the full source |
21:46:06 | FromDiscord | <Elegantbeef> Is `SDL.h` the ABI header or the compilation header? |
21:46:25 | FromDiscord | <kreed1415> ABI header I think. ill double check |
21:46:28 | FromDiscord | <kaistarkk> Is Dominik Picheta still around? |
21:46:36 | FromDiscord | <Elegantbeef> Nope |
21:46:37 | FromDiscord | <kaistarkk> His book is really good |
21:46:39 | FromDiscord | <kaistarkk> Ah bummer |
21:47:58 | * | rockcavera joined #nim |
21:48:31 | FromDiscord | <kreed1415> In reply to @Elegantbeef "Is `SDL.h` the ABI": it's the ABI header |
21:49:09 | FromDiscord | <kreed1415> wait somehow im missing that despite downloading it |
21:50:40 | FromDiscord | <kreed1415> ok it's there but still not finding itm progress but hmm |
21:51:57 | FromDiscord | <kreed1415> (edit) "itm" => "it's" |
21:52:07 | FromDiscord | <kreed1415> (edit) "it's progress but hmm" => "it" |
22:01:04 | FromDiscord | <kreed1415> sent a code paste, see https://play.nim-lang.org/#pasty=YpRVvFvR |
22:01:36 | FromDiscord | <kreed1415> sent a code paste, see https://play.nim-lang.org/#pasty=UWXGJZEk |
22:01:49 | FromDiscord | <Elegantbeef> `--maxLoopIterationsVM: 1000000000` |
22:01:51 | FromDiscord | <Elegantbeef> Push it to the limit |
22:01:59 | FromDiscord | <kreed1415> ok |
22:05:02 | FromDiscord | <kreed1415> so i ended up with an exe lol |
22:05:11 | FromDiscord | <kreed1415> BUT it did in fact run |
22:07:15 | FromDiscord | <riptide7847> Where is the best place to ask noob questions? |
22:08:13 | FromDiscord | <kreed1415> In reply to @riptide7847 "Where is the best": that's a great question because im doing that in main and maybe this isn't the right place |
22:08:29 | FromDiscord | <Elegantbeef> That seems like a noob question and it was asked here |
22:08:29 | FromDiscord | <Elegantbeef> So .... hmmm carry the 1 |
22:09:37 | FromDiscord | <riptide7847> I'll go ahead and ask because I must be doing something ridiculously dumb |
22:10:36 | FromDiscord | <riptide7847> If I import a library and then access a symbol in my script, it works. If I use the "as" keyword and precede the symbol with the name I give the import, the parser seems unable to find it |
22:11:22 | FromDiscord | <riptide7847> Literally import sdl2 works, but if I use import sdl2 as sdl, then precede my symbol with sdl. It doesn't |
22:13:28 | * | ntat quit (Quit: Leaving) |
22:31:10 | FromDiscord | <kreed1415> @ElegantBeef I got it generated! Thanks. Im sure ill have more questions but thanks for the support |
22:32:16 | FromDiscord | <Elegantbeef> @riptide7847 got a reproduction? |
22:38:10 | FromDiscord | <riptide7847> Can't seem to reproduce so it must have something to do with what I'm importing |
22:38:24 | FromDiscord | <riptide7847> I'll work on it and not spam main with junk lol |
22:46:01 | * | beholders_eye quit (Ping timeout: 265 seconds) |