00:19:27 | NimEventer | New thread by Pixeye: PODS: Easy to read and type text format for serialization and config files. , see https://forum.nim-lang.org/t/10340 |
00:22:06 | FromDiscord | <ravinder387> proc add2n(x,y: int): int = return x + y |
00:22:30 | FromDiscord | <ravinder387> var y = add2n 2, 3 # gives error |
00:26:04 | FromDiscord | <Elegantbeef> Command syntax is limited to a single value if it's inside another expression |
00:26:26 | FromDiscord | <michaelb.eth> sent a code paste, see https://play.nim-lang.org/#ix=4ALW |
00:27:59 | FromDiscord | <Elegantbeef> I swear they're just trolling |
00:28:12 | FromDiscord | <Elegantbeef> They've asked about command syntax many times |
00:28:47 | FromDiscord | <ravinder387> In reply to @Elegantbeef "Command syntax is limited": then why he write f a,b same as f(a,b) https://media.discordapp.net/attachments/371759389889003532/1130294997397291108/Screenshot_2023-07-17_055603.png |
00:28:49 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1130295006175973406/image.png |
00:28:59 | FromDiscord | <Elegantbeef> We already went through this |
00:29:04 | FromDiscord | <Elegantbeef> Multiple times |
00:29:14 | FromDiscord | <Elegantbeef> Command syntax inside an expression is limited to 1 parameter |
00:30:26 | FromDiscord | <ravinder387> In reply to @Elegantbeef "image.png": I agree I asked 3rd time this |
00:31:42 | FromDiscord | <Elegantbeef> Right and every time the answer is the same |
00:32:05 | FromDiscord | <Elegantbeef> Command syntax inside an expression can only have 1 parameter unless it's UFCS'd then it can have two |
00:32:22 | FromDiscord | <ravinder387> UFCS mean |
00:33:36 | FromDiscord | <Elegantbeef> method call syntax |
00:33:48 | FromDiscord | <Elegantbeef> `echo 1.doThing 2, 3` is `echo(doThing(1, 2), 3)` |
00:33:57 | FromDiscord | <Elegantbeef> but `echo doThing 2, 3` is `echo (doThing(2), 3)` |
00:34:04 | FromDiscord | <Elegantbeef> Whoops bad parenthesis |
00:36:14 | FromDiscord | <ravinder387> so echo is a function which have only one input .. echo "hello", "world" convert into echo "helloworld" |
00:36:29 | FromDiscord | <ravinder387> under the hood |
00:36:52 | FromDiscord | <Elegantbeef> Nope that's not what anyone said |
00:42:49 | FromDiscord | <ravinder387> Command syntax inside an expression can only have 1 parameter? |
00:43:11 | FromDiscord | <ravinder387> what is reason behind this? what's benefit we get from this ? |
00:43:37 | FromDiscord | <Elegantbeef> It's an established rule to resolve ambiguity |
00:43:38 | FromDiscord | <ravinder387> any idea? |
00:43:43 | FromDiscord | <Elegantbeef> `echo doThing 2, 3` |
00:43:48 | FromDiscord | <Elegantbeef> What is the 'proper' way of handling that |
00:44:00 | FromDiscord | <Elegantbeef> Either doThing consumes all or it consumes 1 |
00:44:09 | FromDiscord | <Elegantbeef> There is no correct. Welcome to language design |
00:54:32 | FromDiscord | <ravinder387> what does it mean by comma? in nim lang how he intepret |
00:55:19 | FromDiscord | <ravinder387> multi-args OR comma means end of instruction |
00:55:56 | FromDiscord | <ravinder387> best practice to use () for parameter |
00:56:17 | * | MightyJoe quit (Ping timeout: 246 seconds) |
00:57:56 | * | cyraxjoe joined #nim |
00:58:39 | FromDiscord | <graveflo> so then use `()` for clarity. Coma is not an eos |
00:58:46 | FromDiscord | <bostonboston> `doThing(a,b)` and `doThing a,b` are equal |
01:00:42 | FromDiscord | <bostonboston> (and `a.doThing(b)` for completeness) |
01:06:07 | FromDiscord | <ravinder387> Got it. whenever nim see comma(,) it means multiargs |
01:06:29 | FromDiscord | <ravinder387> sent a code paste, see https://play.nim-lang.org/#ix= |
01:07:12 | FromDiscord | <ravinder387> when nim see this he thought echo has 2 parameter so echo(dothing 2, 3) |
01:07:22 | FromDiscord | <graveflo> yea usually. You should think of comma as a delimiter if that helps... that is its usual function anyways. in the above `echo` is taking two args not `doThing` |
01:14:42 | FromDiscord | <ravinder387> and var y = add2n 2, 3 |
01:15:06 | FromDiscord | <ravinder387> means = has 2 parameter add2n 2 , 3 |
01:15:21 | FromDiscord | <ravinder387> i got it |
01:15:50 | FromDiscord | <ravinder387> = has 2 param y and add2n 2 |
01:25:13 | nisstyre | Nim can do arbitrary AST macros right? So is it possible to have custom infix operators in Nim with a macro, or would it be too janky? Purely theoretical question, not planning on doing this in real code |
01:25:34 | NimEventer | New Nimble package! caster - casting macro for procedure parameters, see https://github.com/hamidb80/caster/ |
01:25:34 | NimEventer | New Nimble package! voicepeaky - Voicepeak Server, see https://github.com/solaoi/voicepeaky |
01:25:37 | FromDiscord | <Elegantbeef> You don't need macros for that |
01:25:44 | nisstyre | oh, how do I do it without? |
01:25:48 | FromDiscord | <Elegantbeef> `a $! b` is valid nim |
01:25:52 | FromDiscord | <Elegantbeef> You just define an operator |
01:25:54 | nisstyre | ah ok nice |
01:25:59 | nisstyre | I somehow didn't even realize that |
01:26:19 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/rkKZx |
01:26:25 | nisstyre | what about associativity/precedence ? |
01:26:36 | FromDiscord | <Elegantbeef> Based off first symbol |
01:26:42 | nisstyre | ok cool |
01:26:49 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#syntax-associativity |
01:27:11 | nisstyre | So it would assume it's the lowest precedence given standard math operators in the same expression? |
01:27:38 | FromDiscord | <Elegantbeef> `` has the same precedence as `$!` |
01:27:50 | nisstyre | oh first character right I get it now |
01:27:59 | nisstyre | that's an interesting choice |
01:28:37 | nisstyre | so $? and ^? are the same precedence wise |
01:28:37 | FromDiscord | <Elegantbeef> It's pretty smart as it allows you to define the precedence of all operators |
01:28:41 | nisstyre | yeah |
01:28:51 | nisstyre | in Haskell you have some other syntax to tell it |
01:29:22 | nisstyre | https://www.haskell.org/onlinereport/decls.html#fixity |
01:29:27 | nisstyre | I guess this would have been more verbose |
01:29:38 | FromDiscord | <Elegantbeef> Yea they are, but `^?` is right associative |
01:29:49 | nisstyre | got it |
01:30:08 | FromDiscord | <Elegantbeef> It's more verbose and more unpredictable |
01:30:25 | nisstyre | yes and requires the backticks for most things |
01:30:35 | NimEventer | New Nimble package! sokol - sokol is a minimal cross-platform standalone graphics library, see https://github.com/floooh/sokol-nim |
01:30:42 | FromDiscord | <Elegantbeef> If you look at an expression in Nim, given the precedence table you can reason how it's evaluated, if you look at haskell you also need the operator definition |
01:30:50 | nisstyre | yep |
01:30:54 | nisstyre | so it can't even be known until parsed |
01:30:58 | FromDiscord | <Elegantbeef> Not that I generally say "use user defined operators" |
01:31:00 | nisstyre | I made a parser like this before |
01:31:11 | nisstyre | and it had to adapt the parser dynamically basically |
01:31:15 | nisstyre | depending on what it had seen |
01:31:45 | nisstyre | it let you mix infix and prefix operators |
01:31:51 | nisstyre | kinda a bad idea in hindsight |
01:35:36 | NimEventer | New Nimble package! musicSort - A tool to sort your mp3 music files based on id3 metadata, see https://github.com/CarkWilkinson/musicSort |
01:35:43 | FromDiscord | <ravinder387> i want to see any production grade software written in nim? |
01:36:26 | nisstyre | I am trying to accomplish just that |
01:36:33 | nisstyre | Jester seems pretty battle tested |
01:36:39 | nisstyre | planning on using that |
01:37:00 | FromDiscord | <Elegantbeef> https://github.com/orgs/status-im/repositories?q=&type=all&language=nim&sort= |
01:37:32 | nisstyre | oh yeah I forgot about the Nimbus people |
01:37:42 | nisstyre | also Nitter is pretty widely used no? |
01:37:52 | nisstyre | not anymore tho :( |
01:38:09 | FromDiscord | <Elegantbeef> Nitter is back alive |
01:38:20 | nisstyre | awesome |
01:38:26 | nisstyre | I guess they found a way to still make it work |
02:22:21 | * | cnx quit (Remote host closed the connection) |
02:23:14 | * | cnx joined #nim |
03:19:14 | FromDiscord | <shad.ow> how can i check if an `arraymancer` tensor contains a value? |
03:29:28 | FromDiscord | <Elegantbeef> Seems there is no `find` or `contains` so write your own using the iterators |
03:47:30 | FromDiscord | <shad.ow> In reply to @Elegantbeef "Seems there is no": i see |
03:47:35 | FromDiscord | <shad.ow> for some reason `.values` and `.items` don't work |
03:47:39 | FromDiscord | <shad.ow> even though the tutorial mentions the, |
03:47:41 | FromDiscord | <shad.ow> (edit) "the," => "them" |
03:47:49 | FromDiscord | <Elegantbeef> They're insidie the `accessors` module |
03:48:04 | FromDiscord | <shad.ow> ah |
03:48:40 | FromDiscord | <shad.ow> how do i import that? |
03:49:18 | FromDiscord | <shad.ow> nvm got it |
03:49:18 | FromDiscord | <Elegantbeef> https://mratsim.github.io/Arraymancer/accessors.html |
03:49:18 | FromDiscord | <Elegantbeef> `arraymancer/tensor/accessors` i asssume |
03:50:47 | FromDiscord | <shad.ow> yeah i found that too |
03:50:51 | FromDiscord | <shad.ow> turns out |
03:50:56 | FromDiscord | <shad.ow> i had typed `tensors` instead of `tensor` lol |
03:51:01 | FromDiscord | <shad.ow> `import arraymancer.tensor.accessors` works |
03:51:10 | FromDiscord | <shad.ow> ah that's deprecated |
03:51:16 | FromDiscord | <shad.ow> In reply to @Elegantbeef "`arraymancer/tensor/accessors` i asssume": yep ty |
03:55:01 | FromDiscord | <shad.ow> is there a clean way to do big boolean expressions? |
03:55:09 | FromDiscord | <shad.ow> like if i have `... or ... or ...` |
03:55:11 | FromDiscord | <shad.ow> where each part is quite large |
03:55:16 | FromDiscord | <shad.ow> i can't seem to find a nice way to write it |
03:56:20 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4AMn |
03:56:44 | FromDiscord | <shad.ow> ah so that's how you have to break up the lines |
03:56:45 | FromDiscord | <shad.ow> thank you |
03:56:57 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/XSyhV |
03:57:19 | FromDiscord | <shad.ow> ah smart |
04:07:47 | FromDiscord | <punchcake> In reply to @pmunch "As long as you": Bet |
04:09:06 | * | lucasta quit (Remote host closed the connection) |
04:54:48 | NimEventer | New thread by xanim: Wrapping Tkinter GUI in Nim?, see https://forum.nim-lang.org/t/10341 |
05:04:01 | FromDiscord | <punchcake> How do i use c2nim to convert an entire C project to nim? |
05:05:30 | FromDiscord | <Elegantbeef> Araq would say to use Nim as the entry and call the underlying C from Nim's main |
05:06:02 | FromDiscord | <Elegantbeef> Slowly translating/replacing where you need |
05:06:14 | FromDiscord | <punchcake> I mean its quite a huge project |
05:06:23 | FromDiscord | <punchcake> Im trying to port lvgl to nim |
05:07:37 | FromDiscord | <Elegantbeef> Right you wouldnt use c2nim to port it |
05:07:44 | FromDiscord | <Elegantbeef> You'd use c2nim to import the exposed API |
05:07:56 | FromDiscord | <Elegantbeef> then just include the project as a submodule |
05:09:45 | FromDiscord | <punchcake> Hm so i guess i just wrap the lvgl.h |
05:09:58 | FromDiscord | <punchcake> Lvgl is the framework to rule them all |
05:10:11 | FromDiscord | <punchcake> It can run anywhere you can have a screen and a framebuffer |
05:11:23 | FromDiscord | <Elegantbeef> Right, there is no point in machine translating C to Nim, as they have different semantics and idioms so you'd just get C-like Nim, which defeats the purpose of having it in Nim đ |
05:11:59 | FromDiscord | <punchcake> XD |
05:31:10 | FromDiscord | <punchcake> nvm lvgl is buggy af on windows |
05:45:17 | FromDiscord | <pmunch> I would highly recommend using Futhark instead of c2nim thought |
05:45:26 | FromDiscord | <pmunch> (edit) "thought" => "though" |
05:46:22 | FromDiscord | <ravinder387> which programming language is best C interop? |
05:46:42 | FromDiscord | <ravinder387> which programming language has best C interop? |
05:46:50 | FromDiscord | <Elegantbeef> C |
05:47:19 | FromDiscord | <Elegantbeef> Zig can include C directly then compile it along side the zig program |
05:47:31 | FromDiscord | <Elegantbeef> Pmunch wrote futhark to do the same |
05:49:48 | FromDiscord | <ravinder387> if i compile any app in window. can i run on .exe file on other windows labtop. how much comptiable nim lang is? |
05:50:19 | FromDiscord | <Elegantbeef> Of course if you ship any dependencies or statically link them |
05:55:04 | FromDiscord | <ravinder387> @elegantbeef r u chatgpt bot or human |
05:55:20 | FromDiscord | <Elegantbeef> Well given you pinged a discord user you do the math |
05:58:50 | FromDiscord | <ravinder387> @elegantbeef what you do for living? |
05:58:57 | FromDiscord | <ravinder387> r u software engineer |
06:03:07 | FromDiscord | <Elegantbeef> I pass the butter |
06:15:42 | * | ntat joined #nim |
06:20:06 | * | azimut joined #nim |
06:23:31 | FromDiscord | <punchcake> In reply to @pmunch "I would highly recommend": completely unbiased opinion |
06:28:48 | FromDiscord | <pmunch> Of course đ |
06:29:05 | FromDiscord | <punchcake> xd |
06:29:25 | FromDiscord | <punchcake> @pmunch bro do you know how i can bind nim -> js? |
06:29:33 | FromDiscord | <punchcake> i want to make nim work with electron |
06:29:57 | FromDiscord | <punchcake> one way is to just host a rest api server and send http request to it from electron |
06:30:57 | * | PMunch joined #nim |
06:31:39 | FromDiscord | <pmunch> That is kinda what I did in my example isn't it? |
06:31:54 | FromDiscord | <pmunch> But you probably still want some JS stuff just for doing Electron specific stuff |
06:32:23 | FromDiscord | <pmunch> Wrapping JS is basically the same process as wrapping C, but slightly less complicated, and without any nice helper tools that I'm aware of |
06:32:51 | FromDiscord | <punchcake> In reply to @pmunch "But you probably still": doesnt electron use ipc with node? |
06:33:06 | FromDiscord | <punchcake> so effectively i can just swap out node with nim |
06:33:53 | FromDiscord | <pmunch> No idea, as I said the other day I'm not a huge Electron fan so I haven't really looked into it. I just followed the quick start guide and did it in Nim to see if it would be feasible. |
06:34:06 | FromDiscord | <punchcake> hm i see |
06:34:10 | FromDiscord | <ajusa> does `nimble install` build with `-d:release` by default? Or do I need to set that in config.nims or elsewhere? |
06:34:12 | FromDiscord | <pmunch> But yeah, if it has an IPC layer then I guess it should be possible |
06:34:22 | FromDiscord | <Elegantbeef> install makes a release |
06:34:25 | FromDiscord | <punchcake> In reply to @pmunch "But yeah, if it": or just host a rest api XD |
06:35:00 | FromDiscord | <punchcake> https://github.com/mikke89/RmlUi |
06:35:15 | FromDiscord | <punchcake> i'd argue if i find a way to port this to nim it would truly be the gui that rules them all |
06:36:38 | FromDiscord | <punchcake> ngl if someone finds a way to bind rmlui to nim im paying them 30 usd next month |
06:36:57 | FromDiscord | <pmunch> Well there you have two options. Manually wrap the C++ headers, or teach Futhark how to wrap C++ |
06:37:01 | FromDiscord | <Elegantbeef> A whole $30 for multiple hours of work đ |
06:37:10 | FromDiscord | <punchcake> In reply to @Elegantbeef "A whole $30 for": better than 0 |
06:37:27 | PMunch | We really should teach Futhark to wrap C++... |
06:37:30 | FromDiscord | <Elegantbeef> I'd rather be a chimney sweep in the 1800s, atleast I'd get some charcoal |
06:37:57 | FromDiscord | <punchcake> In reply to @PMunch "We really should teach": yeah he needs a mentor tbh |
06:38:46 | FromDiscord | <Elegantbeef> Doesnt rmlui have a C api? |
06:39:11 | PMunch | Well in that case you're already done :P |
06:39:18 | FromDiscord | <punchcake> In reply to @Elegantbeef "Doesnt rmlui have a": probably not |
06:39:30 | FromDiscord | <Elegantbeef> https://github.com/mikke89/RmlUi/tree/master/Include/RmlUi |
06:39:32 | FromDiscord | <Elegantbeef> I mean |
06:39:48 | FromDiscord | <Elegantbeef> Ah those are C++ header files |
06:39:55 | FromDiscord | <punchcake> yup |
06:40:02 | FromDiscord | <punchcake> nobody seems to use .hpp |
06:40:05 | FromDiscord | <Elegantbeef> Do i ever wish people used hpp for C++ headerfiles |
06:40:06 | PMunch | Yeah, for some reason without the .hpp extension.. |
06:40:19 | FromDiscord | <punchcake> although you can name C and cpp header files whatever you want |
06:40:30 | FromDiscord | <punchcake> you can name it `header.porn` and it would work |
06:40:30 | FromDiscord | <Elegantbeef> Sure but conventions are nice |
06:41:24 | FromDiscord | <Elegantbeef> Nah gotta localise the header files so it's `header.hi-ach` |
06:41:30 | FromDiscord | <Elegantbeef> For the brits |
06:41:48 | FromDiscord | <Elegantbeef> That's not how you phonetically write how brits say 'H' but alas |
06:42:16 | FromDiscord | <punchcake> anyways my offer still stands |
06:44:16 | FromDiscord | <Elegantbeef> Easier to just expose a C-api for the C++ code you need, it's a shit ton of code to wrap |
06:46:31 | * | azimut quit (Remote host closed the connection) |
06:47:00 | * | azimut joined #nim |
06:48:06 | PMunch | Or just teach Futhark to wrap C++ |
06:48:10 | PMunch | It can't be that hard |
06:48:28 | FromDiscord | <Elegantbeef> Famous last words |
06:48:36 | PMunch | Most of the ground work is already there, we're just missing some C++ built-in types and namespaces stuff |
06:48:43 | FromDiscord | <punchcake> bro |
06:48:57 | FromDiscord | <punchcake> i literally dont know jack shit in C++ build systems |
06:49:03 | FromDiscord | <punchcake> nor am i gonna learn that mess |
06:49:08 | FromDiscord | <punchcake> i just use xmake + vcpkg |
06:51:01 | FromDiscord | <Elegantbeef> You don't need to know anything about build systems to teach futhark C++ |
06:53:15 | FromDiscord | <punchcake> sent a code paste, see https://play.nim-lang.org/#ix=4AMC |
06:53:15 | FromDiscord | <punchcake> i taught futhark |
06:58:11 | PMunch | It might be easy, but unfortunately it's not quite that easy |
07:02:47 | FromDiscord | <4zv4l> is there a library in Nim close to Thor in Ruby ? |
07:03:43 | Amun-Ra | https://github.com/c-blake/cligen ? |
07:03:51 | madprops | https://www.red-lang.org/p/about.html |
07:04:04 | Amun-Ra | 4zv4l: look at cligen |
07:10:43 | FromDiscord | <jmgomez> In reply to @Elegantbeef "Easier to just expose": more easy: expose a C++ api with the code that you need. Even easier: directly bind the code that you need |
07:11:54 | * | stallman_big_fan joined #nim |
07:13:17 | * | stallman_big_fan left #nim (#nim) |
07:14:21 | * | stallman_big_fan joined #nim |
07:15:11 | * | stallman_big_fan quit (Client Quit) |
07:17:03 | FromDiscord | <bung8954> anyone same as me that on m1 mac `nimlsp` get 100% cpu usage? |
07:17:44 | FromDiscord | <punchcake> In reply to @jmgomez "more easy: expose a": more easier: user C++ |
07:17:48 | FromDiscord | <punchcake> which is what im doing rn |
07:18:54 | PMunch | bung8954, which Nim version did you build your nimlsp with? |
07:20:41 | FromDiscord | <bung8954> In reply to @PMunch "<@714152700920594493>, which Nim version": Nim Compiler Version 1.6.12 [MacOSX: arm64] |
07:22:01 | FromDiscord | <demotomohiro> If C++ API has template functions/classes, you cannot wrap it with C API.â”You might wrap std::vector and expose stdVectorInt, stdVectorFloat, etc, but you cannot expose stdVector[T]. |
07:30:44 | PMunch | bung8954, that's a known bug on 1.6.12: https://github.com/PMunch/nimlsp/issues/154#issuecomment-1609312307 |
07:31:06 | PMunch | It was fixed in 1.6.14 (technically in a commit five commits after the release, but we had to wait for a new release) |
07:39:58 | FromDiscord | <punchcake> ngl C++ with qml is actually a very pleasant experience |
07:41:41 | FromDiscord | <punchcake> call me mcdonalds cause im loving it https://media.discordapp.net/attachments/371759389889003532/1130403941537022053/image.png |
07:58:10 | FromDiscord | <requiresupport> In reply to @madprops "https://www.red-lang.org/p/about.html": interesting |
08:04:21 | FromDiscord | <ieltan> In reply to @punchcake "call me mcdonalds cause": missed opportunity to say mclovin |
08:10:44 | * | om3ga quit (Ping timeout: 252 seconds) |
08:26:10 | NimEventer | New Nimble package! broly - High Performance Stub Server, see https://github.com/solaoi/broly |
08:26:10 | NimEventer | New Nimble package! nimf - Search for files in a directory hierarchy., see https://github.com/Gruruya/nimf |
08:47:50 | FromDiscord | <punchcake> In reply to @NimEventer "New Nimble package! broly": what even is a stub server |
09:03:02 | FromDiscord | <intellij_gamer> Think to act in place of a real server?â”Looking at the repo it looks like you define how the server should respond to certain requestsâ”So handy for like running tests when you don't control the server that you connect ti |
09:03:07 | FromDiscord | <intellij_gamer> (edit) "ti" => "to" |
09:19:10 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4AN2 |
09:23:06 | FromDiscord | <demotomohiro> What that do in Ruby? |
09:23:25 | FromDiscord | <4zv4l> execute a shell command and return the output of it in a variable |
09:23:59 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4AN3 |
09:24:27 | FromDiscord | <4zv4l> I found `execProcess` but I need to add the right options I think |
09:24:31 | FromDiscord | <demotomohiro> osproc module has procs that runs shell command at runtime. |
09:27:36 | FromDiscord | <punchcake> In reply to @4zv4l "execute a shell command": you can make a macro like that |
09:27:46 | FromDiscord | <punchcake> in nim macros can manipulate the AST |
09:27:56 | FromDiscord | <punchcake> so you can do anything you want with no limits |
09:31:34 | FromDiscord | <demotomohiro> You dont even need to write a macro to run a shell command and get a output.â”osproc module can do. |
09:33:05 | FromDiscord | <4zv4l> well I can't get it to work |
09:33:08 | FromDiscord | <demotomohiro> If you want to run commands at compile time:â”https://nim-lang.org/docs/system.html#staticExec%2Cstring%2Cstring%2Cstring |
09:33:10 | FromDiscord | <4zv4l> I wanna execute an interactive commande |
09:34:07 | FromDiscord | <michaelb.eth> In reply to @4zv4l "I wanna execute an": maybe port the venerable expect library to Nim? |
09:34:44 | FromDiscord | <4zv4l> all I need is `execShellCmd` but that returns the output |
09:35:29 | FromDiscord | <vindaar> Fun DSL to execute shell commands I can provide https://github.com/vindaar/shell đ but having an interactive command like calling `fzf` isn't supported at the moment (well, we just don't see the `fzf`, it "works" thuogh) |
09:36:39 | FromDiscord | <demotomohiro> https://nim-lang.org/docs/osproc.html#ProcessOptionâ”poParentStreams allows to use stdin and out in your process to child process.â”But you cannot read stdout and store it to a variable. |
09:37:17 | FromDiscord | <vindaar> sent a code paste, see https://play.nim-lang.org/#ix=4AN5 |
09:37:28 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4AN6 |
09:37:53 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4AN7 |
09:38:09 | FromDiscord | <vindaar> Pfff, you don't know your filesystem by heart? |
09:38:13 | FromDiscord | <4zv4l> looool |
09:43:20 | FromDiscord | <demotomohiro> If fzf write texts to stdout or stderr? And fzf write the path of picked file in stdout or stderr? |
09:43:33 | FromDiscord | <spotlightkid> Maybe just call "zenity"? |
09:44:28 | FromDiscord | <spotlightkid> fzf pobably needs acess to a (pseudo) terminal or at least readline support? |
09:45:17 | FromDiscord | <demotomohiro> Anyway, osproc cannot do connect stdout of parent to child's stdout while use pipe to childs stderr. |
09:49:45 | FromDiscord | <punchcake> In reply to @vindaar "Pfff, you don't know": lmao this guy didnt even write his own kernel yet |
09:50:00 | FromDiscord | <punchcake> are you even a programmer if you didnt write your kernal in asm?? |
09:55:20 | FromDiscord | <4zv4l> đ„ș |
09:55:22 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4ANc |
09:59:36 | FromDiscord | <demotomohiro> In reply to @4zv4l "so nothing like this": I dont know what you actually needs. That command needs to use parent process's stdin but stdout need to be pipe? |
09:59:52 | FromDiscord | <4zv4l> need to be returned yeahâ”I don't know how ruby handle that |
10:00:11 | FromDiscord | <4zv4l> In reply to @4zv4l "all I need is": really like this |
10:00:19 | FromDiscord | <4zv4l> the command works with `execShellCmd` |
10:00:24 | FromDiscord | <4zv4l> but I don't get the return value I want |
10:01:23 | FromDiscord | <4zv4l> its exactly like `$()` in bash |
10:01:26 | FromDiscord | <4zv4l> I would need the same |
10:02:54 | FromDiscord | <demotomohiro> `execCmdEx` doesn't work? |
10:03:02 | FromDiscord | <4zv4l> it doesn't |
10:03:09 | FromDiscord | <4zv4l> I don't see the interface of the program |
10:03:13 | FromDiscord | <4zv4l> it executes in background |
10:03:35 | FromDiscord | <4zv4l> actually |
10:03:42 | FromDiscord | <4zv4l> I see the interface but when I type something |
10:03:45 | FromDiscord | <4zv4l> it crashes |
10:03:59 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4ANe |
10:06:15 | FromDiscord | <demotomohiro> I guess your child process need to use stdin in parent process but stdout need to be piped but osproc module seems doesn't support it. |
10:06:21 | FromDiscord | <4zv4l> I guess to do a workaround I could `> tmp` and read from it to get the output from the command |
10:06:32 | FromDiscord | <4zv4l> but that's not the best xD |
10:11:20 | FromDiscord | <4zv4l> the redirection doesn't work |
10:11:21 | FromDiscord | <4zv4l> xD |
10:13:19 | FromDiscord | <4zv4l> okay it works |
10:14:10 | * | om3ga joined #nim |
10:14:48 | FromDiscord | <4zv4l> is there an execve equivalent that would replace the current process by the new one ? |
10:16:15 | FromDiscord | <demotomohiro> Maybe this is what you needs:https://github.com/cheatfate/asynctools/blob/master/asynctools/asyncproc.nim#L139â”You can specify how each of stdin/out/err are handled. |
10:18:22 | FromDiscord | <spotlightkid> Like I said, fzf needs a terminal (tty). |
10:19:05 | FromDiscord | <4zv4l> In reply to @4zv4l "is there an execve": anything for this one ? |
10:20:17 | FromDiscord | <spotlightkid> See the os stdlib module |
10:23:57 | FromDiscord | <spotlightkid> No, sorry, it's also in `osproc`\: `startProcess` |
10:24:35 | * | unwoker joined #nim |
10:26:34 | FromDiscord | <spotlightkid> A direct binding for the `exec`libc functions is defined in the `posix` module. |
10:26:55 | * | unwoker quit (Quit: Client closed) |
10:38:13 | FromDiscord | <michaelb.eth> In reply to @demotomohiro "Maybe this is what": note that the author of asynctools is also one of the maintainers of nim-chronos, and if I'm remebering correctly, it's generally recommended to the os proc facilities offered by chronos instead of asynctools |
10:38:24 | FromDiscord | <michaelb.eth> (edit) "In reply to @demotomohiro "Maybe this is what": note that the author of asynctools is also one of the maintainers of nim-chronos, and if I'm remebering correctly, it's generally recommended to ... the" added "use" |
10:48:36 | FromDiscord | <4zv4l> how can I do a http get request at compile time in Nim ? |
10:49:02 | FromDiscord | <ambient3332> Do it in a build script? |
10:49:09 | FromDiscord | <4zv4l> because I getâ”`/home/azz/.choosenim/toolchains/nim-1.6.14/lib/pure/httpclient.nim(335, 12) Error: cannot evaluate at compile time: defaultSslContext` |
10:49:14 | FromDiscord | <4zv4l> In reply to @ambient3332 "Do it in a": in a program |
10:49:17 | FromDiscord | <4zv4l> to get a file at comptime |
10:49:35 | FromDiscord | <ambient3332> comptime is the build time, which makes sense to have it in a build script |
10:49:55 | FromDiscord | <4zv4l> basically I wanna download a file at compile time and put it in a variable |
10:51:46 | FromDiscord | <4zv4l> In reply to @ambient3332 "comptime is the build": how can I put the value in a variable afterward ? |
10:52:11 | FromDiscord | <ambient3332> either read it statically into the executable or just read file normally |
10:52:28 | FromDiscord | <4zv4l> do you mind showing me a quick example ? |
10:53:19 | FromDiscord | <ambient3332> https://nim-lang.org/docs/system.html#staticRead%2Cstring |
11:02:14 | FromDiscord | <demotomohiro> In reply to @michaelb.eth "note that the author": https://status-im.github.io/nim-chronos/docs/chronos/asyncproc.htmlâ”But I cannot find `startProcess` or other procs that I can specify how each of stdin/out/err of child process are handled separetly.â”Maybe it is not yet implement? |
11:18:04 | FromDiscord | <bung8954> is there short way get this `template nilId(): ID = cast[ID](nil)`? |
11:28:04 | FromDiscord | <michaelb.eth> In reply to @demotomohiro "https://status-im.github.io/nim-chronos/docs/chrono": the tests have some demos of working with stdin/out/err and pipingâ”https://github.com/status-im/nim-chronos/blob/master/tests/testproc.nim |
11:35:51 | FromDiscord | <4zv4l> In reply to @ambient3332 "https://nim-lang.org/docs/system.html#staticRead%2C": I used readFile because somehow readFileStatic didnât work (didnât find the file ?) and seems to achieve what I want so perfect |
11:39:21 | PMunch | bung8954, `default(ID)` should work |
11:40:08 | PMunch | Everything is nulled out by default in Nim, so `default` of a ref or pointer type will be a nil pointer |
11:43:39 | FromDiscord | <intellij_gamer> `ID(nil)` should also work iirc |
12:00:01 | FromDiscord | <bung8954> thanks, I choose `nil.ID` |
13:40:19 | * | lucasta joined #nim |
14:08:27 | * | PMunch quit (Quit: Leaving) |
14:18:59 | FromDiscord | <demotomohiro> In reply to @michaelb.eth "the tests have some": https://github.com/status-im/nim-chronos/blob/master/chronos/asyncproc.nim#L774 |
14:19:45 | FromDiscord | <demotomohiro> I found `startProcess` is defined in asyncproc module but it is not documented in https://status-im.github.io/nim-chronos/docs/chronos/asyncproc.html |
14:30:14 | FromDiscord | <michaelb.eth> pffft, documentation, who needs it đ |
14:50:42 | * | xet7 quit (Ping timeout: 272 seconds) |
15:41:48 | NimEventer | New Nimble package! sun_moon - Astro functions for calcuation of sun and moon position, rise and set time as well as civil, nautical and astronomical dawn and dusk as a function of latitude and longitude., see https://github.com/dschaadt/sun_moon |
15:53:31 | * | oddish_ quit (Remote host closed the connection) |
15:53:40 | * | oddish joined #nim |
16:32:09 | * | lucasta quit (Quit: Leaving) |
18:34:16 | * | disso-peach joined #nim |
18:46:11 | FromDiscord | <System64 ~ Flandre Scarlet> Why do I have this error? https://media.discordapp.net/attachments/371759389889003532/1130571163630841866/image.png |
18:49:22 | FromDiscord | <nnsee> because Positive is an int, not a float64 |
18:49:57 | FromDiscord | <nnsee> https://nim-lang.org/docs/system.html#Positive |
18:50:36 | FromDiscord | <System64 ~ Flandre Scarlet> Oh alrightâ”So I'll have to go with a while loop then |
18:50:43 | FromDiscord | <nnsee> seems so |
19:09:09 | FromDiscord | <ambient3332> sent a code paste, see https://play.nim-lang.org/#ix=4APL |
19:09:17 | FromDiscord | <ambient3332> Does || degrade to .. ? |
19:37:11 | FromDiscord | <ambient3332> It does seem to exactly do that, at least it doesn't complain |
20:11:11 | * | ntat quit (Quit: leaving) |
20:19:06 | FromDiscord | <graveflo> this is weird but how does one do something like this: |
20:19:20 | FromDiscord | <graveflo> sent a code paste, see https://paste.rs/mu70Q |
20:20:29 | FromDiscord | <graveflo> It's hard to make the generic object work with static values and allow for the generic to instantiate the correct object. The above does not work because once `initSimPl` is instantiated once it doesn't happen again |
20:56:55 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4AQa |
20:57:00 | FromDiscord | <Elegantbeef> Static parameters in result are often quite odd |
21:08:17 | * | disso-peach quit (Quit: Leaving) |
21:24:24 | FromDiscord | <thesherwood> What is currently the preferred way to define a c array in nim? |
21:26:57 | FromDiscord | <thesherwood> I see nimline and cinterop have support for this. I'd prefer to not bring in another dependency if I there's a simple way to do this without one. |
21:26:58 | FromDiscord | <Elegantbeef> \`var a = [1, 2, 3, 4] |
21:27:53 | FromDiscord | <thesherwood> A nim array is just a c array? |
21:28:20 | FromDiscord | <Elegantbeef> They're static sized arrays yes |
21:29:16 | FromDiscord | <thesherwood> I didn't realize they'd be byte-for-byte the same. Cheers |
21:29:48 | FromDiscord | <Elegantbeef> Well arrays are one of the things that really on has one sane way of doing |
21:29:58 | FromDiscord | <Elegantbeef> Sequences on the otherhand have a multitude of ways of doing |
21:31:02 | FromDiscord | <thesherwood> That's convenient. Thanks ElegantBeef |
22:10:11 | FromDiscord | <user2m> sent a code paste, see https://play.nim-lang.org/#ix=4AQh |
22:10:31 | FromDiscord | <user2m> (edit) "https://play.nim-lang.org/#ix=4AQh" => "https://play.nim-lang.org/#ix=4AQi" |
22:10:40 | FromDiscord | <Elegantbeef> Cause you have not handled `"hello"` |
22:12:00 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4AQj |
22:19:50 | FromDiscord | <user2m> sent a code paste, see https://play.nim-lang.org/#ix=4AQk |
22:38:38 | * | azimut quit (Ping timeout: 240 seconds) |
22:42:28 | FromDiscord | <PingusMcDuck> Anyone have ant idea if Ive got Orx bindings for Nim, which is a C game engine, is it possible to avoid pointers and references, and just do GC? |
22:43:18 | FromDiscord | <Elegantbeef> If you wrap the C code then make a high level api, yes |
22:59:55 | FromDiscord | <PingusMcDuck> I think that might be what the binding are, thank you |
23:26:52 | * | rez joined #nim |
23:29:39 | * | rez quit (Client Quit) |
23:57:04 | * | xet7 joined #nim |