00:31:10 | * | Jjp137 quit (Quit: Leaving) |
00:31:18 | * | Jjp137 joined #nim |
00:39:26 | * | jmiven joined #nim |
01:04:13 | * | bkay joined #nim |
01:04:56 | * | beshr quit (Ping timeout: 256 seconds) |
02:05:38 | * | arkurious quit (Quit: Leaving) |
04:06:01 | * | supakeen quit (Quit: WeeChat 3.2.1) |
04:06:30 | * | supakeen joined #nim |
04:38:13 | arfy | hi. Just wanted to say, a few days on, enjoying nim a lot. I've been able to rewrite a couple of small utilites I wrote in python quite easily. :) |
04:39:24 | FromDiscord | <impbox [ftsf]> awesome =) |
04:39:43 | FromDiscord | <Elegantbeef> Nice any issues you run into? |
04:39:52 | arfy | yeah. it's a nice language so far. |
04:40:37 | arfy | no, although i was very amused by the deduplicate function from sequtils. deduplicate? |
04:43:22 | arfy | also, under windows, is it possible to use nim with the latest VC++ tools? |
04:44:10 | FromDiscord | <Elegantbeef> I do not know, i'm not a windows user |
04:45:21 | arfy | fair. if I could, I'd do everything on my mac machine. |
04:46:12 | FromDiscord | <impbox [ftsf]> i use windows but i don't use vc++ |
04:46:18 | FromDiscord | <impbox [ftsf]> using mingw is easy |
04:46:55 | arfy | yeah. mingw works fine for me, I was just curious |
04:47:07 | FromDiscord | <Elegantbeef> The forum/github issues might be of help if you want to investigate |
04:47:26 | FromDiscord | <impbox [ftsf]> but i think vc++ is supported |
04:49:43 | FromDiscord | <demotomohiro> Nim supports vc++ but it seems not much tested with it. |
04:51:03 | FromDiscord | <impbox [ftsf]> does vc include a c compiler or only c++? |
04:51:52 | FromDiscord | <demotomohiro> Add --cc:vcc option if you try vc++ backend. |
04:53:00 | FromDiscord | <demotomohiro> cl.exe /? says "Microsoft(R) C/C++ Optimizing Compiler Version 19.00.24210 for x86" |
05:04:21 | FromDiscord | <Gumber aka Zachary Carter> I use `--cc:vcc` all the time when building on windows |
05:19:47 | * | Doraemon joined #nim |
05:22:01 | * | neocron quit (Ping timeout: 252 seconds) |
07:34:14 | FromDiscord | <Saurav Niroula> is there none in nim? |
07:34:43 | FromDiscord | <Elegantbeef> That's the exact amount |
07:34:43 | FromDiscord | <Elegantbeef> No there is no `none` |
07:35:01 | FromDiscord | <Elegantbeef> If you want an optional type look at `std/options` |
07:37:32 | FromDiscord | <linux user> how to compile 32 bit exe on 64 bit liux |
07:40:34 | FromDiscord | <Saurav Niroula> https://media.discordapp.net/attachments/371759389889003532/886516618916683796/20210912_132535.jpg |
07:40:50 | FromDiscord | <Saurav Niroula> i wrote this in python |
07:41:08 | FromDiscord | <Saurav Niroula> but i cant figure out to convert it in nim |
07:41:38 | FromDiscord | <Saurav Niroula> this is example from youtube |
07:41:57 | FromDiscord | <Elegantbeef> You dont need to handle that if statement |
07:42:23 | FromDiscord | <Elegantbeef> Nim is statically typed it'll always be a value |
07:42:44 | FromDiscord | <cabboose> What he said |
07:42:47 | * | max22- joined #nim |
07:43:06 | FromDiscord | <Saurav Niroula> i am trying to convert python algorithm to nim |
07:43:12 | FromDiscord | <cabboose> Also there are nim tutorials on the youtubes |
07:43:33 | FromDiscord | <Saurav Niroula> very less tutorial |
07:43:54 | FromDiscord | <Elegantbeef> So convert the algorithim the `verify` isnt needed it's just `if x in yourSeq.low .. yourSeq.high` |
07:44:35 | FromDiscord | <Saurav Niroula> ohh |
07:45:09 | FromDiscord | <enthus1ast> you could either return -1 if not found, or option[int] |
07:50:47 | FromDiscord | <enthus1ast> i think in your case (when list is a seq) -1 is more convenient |
07:50:49 | FromDiscord | <enthus1ast> https://play.nim-lang.org/#ix=3yDD |
07:50:49 | FromDiscord | <enthus1ast> but you could also go with option as i said, then you would return some[T] or none |
07:51:14 | FromDiscord | <Saurav Niroula> https://media.discordapp.net/attachments/371759389889003532/886519302449160222/20210912_133614.jpg |
07:52:17 | FromDiscord | <enthus1ast> https://play.nim-lang.org/#ix=3yDE |
07:52:31 | FromDiscord | <enthus1ast> ^ another one with option and pairs iterator |
07:53:08 | FromDiscord | <Saurav Niroula> what is the difference between func and proc |
07:53:25 | FromDiscord | <enthus1ast> func check for side effects, and errors if one is detected |
07:53:39 | FromDiscord | <enthus1ast> so no prints, no global var access etc |
07:55:28 | * | Doraemon quit (Ping timeout: 252 seconds) |
07:57:21 | FromDiscord | <Saurav Niroula> ok |
07:58:42 | FromDiscord | <linux user> terminal module doesnt work correctly when win xp |
07:58:47 | FromDiscord | <enthus1ast> my example also is generic, [T], this means you can do this\: |
07:58:52 | FromDiscord | <linux user> weird chareacters in cmd.exe tho |
07:59:01 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=3yDG |
08:00:18 | FromDiscord | <Saurav Niroula> what is bot in discord |
08:00:32 | FromDiscord | <enthus1ast> on newer windows you could try to load consolas, but for windows xp idk |
08:00:49 | FromDiscord | <enthus1ast> maybe this helps but just guessing\: http://www.hanselman.com/blog/using-consolas-as-the-windows-console-font |
08:01:26 | FromDiscord | <enthus1ast> the nim chats are bridged between discord \<-\@Saurav Niroula) |
08:02:15 | FromDiscord | <enthus1ast> to form a bigger comunity, and the bridges are implemented sometimes with bot accounts |
08:02:26 | FromDiscord | <Saurav Niroula> ohh |
08:06:03 | FromDiscord | <Saurav Niroula> https://media.discordapp.net/attachments/371759389889003532/886523030958915624/20210912_135103.jpg |
08:06:19 | FromDiscord | <enthus1ast> but everyone should of course switch to matrix, since its open source (in contrast to discord) and provides strong encryption (not on this channel, though), and does not have a central server infrastructure but is federated ;) |
08:06:19 | FromDiscord | <Saurav Niroula> why this code prints num not found |
08:08:27 | FromDiscord | <enthus1ast> int is not a natural |
08:08:44 | FromDiscord | <enthus1ast> better check for \> -1 |
08:09:13 | FromDiscord | <enthus1ast> another thing, better not name a variable result |
08:09:49 | FromDiscord | <enthus1ast> because result is automatically available in a a proc and is of the type of the return code |
08:17:41 | FromDiscord | <Saurav Niroula> In reply to @enthus1ast "another thing, better not": thanks |
08:17:58 | FromDiscord | <Saurav Niroula> thanks all |
08:19:16 | FromDiscord | <Saurav Niroula> #wnim |
09:37:31 | FromDiscord | <Varriount> In reply to @Saurav Niroula "ok": For screenshots, try Shift+Windows Key+S |
10:13:21 | FromDiscord | <Yardanico> hey @ElegantBeef you around? https://github.com/nim-lang/Nim/issues/18838 |
10:55:41 | * | max22- quit (Remote host closed the connection) |
10:58:25 | * | max22- joined #nim |
11:13:16 | FromDiscord | <tandy> sent a code paste, see https://paste.rs/GS8 |
11:15:40 | FromDiscord | <Rika> Probably not |
11:16:39 | NimEventer | New thread by Serge: The "reset password" routine does not seem to send me a message at my e-mail address, see https://forum.nim-lang.org/t/8416 |
11:16:48 | FromDiscord | <tandy> dam↵(@Rika) |
11:17:26 | FromDiscord | <Rika> It’s probably because every number increment might have a breaking change |
11:17:32 | FromDiscord | <tandy> it would be manageable if i could just download an old chromedriver bin, but u also have to have chromium at the same version installed |
11:19:02 | FromDiscord | <tandy> i guess i could just write this in python |
11:21:28 | arkanoid | I've never used nim for frontent javascript, but I'm reading how elm works as I don't like javascript and I like the proposed model/view/update pattern. Do you know if there's anything similar for nim? I mean if there are frameworks for javascript frontend for nim |
11:25:10 | FromDiscord | <Yardanico> https://github.com/karaxnim/karax is exactly that |
11:25:12 | nrds | <R2D299> itHub: 7"Karax. Single page applications for Nim." |
11:25:29 | FromDiscord | <Yardanico> but not sure if it's the model/view/update pattern you want |
11:25:29 | arkanoid | good, I was on right path then. Thanks! |
11:36:04 | * | Guest51 joined #nim |
11:36:28 | * | Guest51 quit (Client Quit) |
11:45:37 | * | arfy quit (Remote host closed the connection) |
11:49:52 | * | Guest50 joined #nim |
11:50:29 | * | Guest50 quit (Client Quit) |
11:51:27 | * | jjido joined #nim |
11:53:45 | * | max22- quit (Ping timeout: 260 seconds) |
12:06:02 | * | supakeen quit (Quit: WeeChat 3.2.1) |
12:06:30 | * | supakeen joined #nim |
12:13:36 | arkanoid | is ormin + karax the way to go for full stack web development with nim? |
12:22:13 | * | Gustavo6046 quit (Quit: ZNC 1.8.2 - https://znc.in) |
12:22:33 | * | Gustavo6046 joined #nim |
12:31:37 | FromDiscord | <Yardanico> there's no "the way to go", there are multiple ORMs available for Nim :) |
12:31:41 | FromDiscord | <Yardanico> no one forces you to a specific combination |
12:32:43 | FromDiscord | <Yardanico> I personally like ormin too, but there's for example https://github.com/moigagoo/norm |
12:32:46 | nrds | <R2D299> itHub: 7"A Nim ORM" |
12:33:09 | arkanoid | yeah but I'm not into evolution of nim tools for the web, karax, ormin, jester, norm, fidget, basolato, prologue. I'm getting lost |
12:34:32 | * | pro joined #nim |
12:34:34 | arkanoid | I'm aiming to a solution that is more than a poc, and has already been bent to production use. I know just karax and ormin due to nim forum |
12:41:57 | FromDiscord | <Rika> Most of what you said save for Basolato have been used in production I believe? |
12:43:00 | FromDiscord | <gogolxdong (liuxiaodong)> Nim should replace nodejs |
12:43:04 | FromDiscord | <gogolxdong (liuxiaodong)> most DeFi application is written in React + nodejs |
12:43:17 | arkanoid | is there a blog post comparing the different solutions and highlighting the pro/cons and features? I mean, karax seems for frontend only |
12:43:29 | arkanoid | but unsure |
12:47:17 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
12:48:27 | arkanoid | there must be a "go well together" path. I mean, frontent + backend + orm technologies generally moves as a group, but what is the currente prefence for nim? Maybe Karax + Jester + ormin? |
12:56:57 | FromDiscord | <auxym> I do believe the nim forum runs on karax+jester, not sure for ORM though. |
12:57:08 | FromDiscord | <Yardanico> In reply to @auxym "I do believe the": it doesn't use an ORM |
12:57:30 | arkanoid | yeah ORM is not always part of the game |
12:58:03 | FromDiscord | <Yardanico> you can check the source, e.g. https://github.com/nim-lang/nimforum/blob/master/src/forum.nim#L662 |
13:00:02 | arkanoid | in my opinion, the nim forum way is bad for web development, as it's SEO nightmare: white page without js |
13:02:49 | arkanoid | also reason why you're not finding any answer about nim programming with google on nim forum but just stackoverflow |
13:02:56 | FromDiscord | <Yardanico> no, not really |
13:03:01 | FromDiscord | <Yardanico> google indexes nim forum just fine |
13:03:09 | FromDiscord | <Yardanico> but yes, I agree with your about JS-only :) |
13:03:33 | FromDiscord | <Yardanico> in fact I've been running a read-only static html nimforum viewer for a while before the domain expired, maybe I should enable it again |
13:03:40 | arkanoid | any SEO tecnique would be obliterated by this false start |
13:04:04 | FromDiscord | <Yardanico> first response from nim forum https://media.discordapp.net/attachments/371759389889003532/886598030491541514/unknown.png |
13:04:34 | arkanoid | why my google is not returning that answer? |
13:05:07 | FromDiscord | <Yardanico> because it doesn't know that you use nim a lot :P |
13:06:14 | arkanoid | yeah, I kind of guy that uses google via tor browser without logging in |
13:06:19 | FromDiscord | <Yardanico> and yeah, nimforum was made to showcase how you can write apps with karax, but it was made before karax had server-side rendering |
13:06:35 | FromDiscord | <Yardanico> also IIRC even now there's no way to cleanly mix statically rendered and dynamic content in karax |
13:07:17 | arkanoid | only way is to help google digest your js https://developers.google.com/search/docs/advanced/javascript/javascript-seo-basics |
13:14:12 | * | arkurious joined #nim |
13:17:34 | * | xet7 quit (Quit: Leaving) |
13:18:45 | * | xet7 joined #nim |
13:30:01 | arkanoid | I've just created my first barebone karax app. Karun produced "<script type="text/javascript" src="/app.js"></script>" but I had to fix it manually to "<script type="text/javascript" src="app.js"></script>" to make it work |
13:33:56 | FromDiscord | <Gumber aka Zachary Carter> Sounds like you did something incorrectly then |
13:34:04 | FromDiscord | <Gumber aka Zachary Carter> I haven't used Karax in years but I never had to do that |
13:34:57 | FromDiscord | <Gumber aka Zachary Carter> also not everyone cares about SEO |
13:35:10 | arkanoid | sure for last line |
13:35:17 | FromDiscord | <Gumber aka Zachary Carter> like, I'm probably guessing most of Nim's community doesn't care about it |
13:35:26 | arkanoid | for first line, I don't know how. it's just barebone |
13:35:35 | FromDiscord | <Gumber aka Zachary Carter> gotcha |
13:36:10 | arkanoid | this is my karax app: https://play.nim-lang.org/#ix=3yFa |
13:36:16 | FromDiscord | <Gumber aka Zachary Carter> yeah - I don't really do web dev with Nim. I already have to do it for work, but... IMO it doesn't really matter what frontend technology or framework or library you use, they're all pretty terrible |
13:36:20 | arkanoid | I'm doing "karun src/webtest.nim" |
13:36:25 | FromDiscord | <Gumber aka Zachary Carter> Karax is at least somewhat lightweight in comparison to a lot of others |
13:37:04 | FromDiscord | <Gumber aka Zachary Carter> all karun does is generate HTML boilerplate coded |
13:37:06 | FromDiscord | <Gumber aka Zachary Carter> (edit) "coded" => "code apparently" |
13:37:14 | FromDiscord | <Gumber aka Zachary Carter> like, you don't even need it really - it's simply there for convenience |
13:37:28 | FromDiscord | <Gumber aka Zachary Carter> You just need to compile your Nim to JS and then have an HTML load the JS file via a script tag |
13:37:58 | FromDiscord | <Gumber aka Zachary Carter> it's just JS and HTML at the end of the day... |
13:38:35 | arkanoid | I'm not a web developer, I've successfully skipped the whole web era as I consider it horror. I've always lived on backend/desktop/console/microcontroller. Occasionally I still want to "know" how to bake basic web apps. I used to play with python + vue, but it's time to replace my last-favorite-thing with something I like, that's nim |
13:39:14 | FromDiscord | <impbox [ftsf]> moving from python+vue to jester+karax was pretty easy for me |
13:39:33 | FromDiscord | <impbox [ftsf]> though they don't seem as well used |
13:40:41 | arkanoid | impbox, I hope so. I don't require anything complicated, just a way to get shit done, and static typing is something I now want at same level of eating and sleeping |
13:46:13 | NimEventer | New Nimble package! tic80 - TIC-80 bindings, see https://github.com/thisago/tic80 |
13:46:16 | nrds | <R2D299> itHub: 7"Nim TIC-80 bindings" |
13:46:33 | FromDiscord | <impbox [ftsf]> ooh |
13:47:03 | arkanoid | wow? |
13:47:43 | FromDiscord | <impbox [ftsf]> didn't realise tic-80 could do native code |
13:47:57 | FromDiscord | <impbox [ftsf]> sounds rad |
13:49:23 | FromDiscord | <Yardanico> In reply to @impbox "didn't realise tic-80 could": it's not native :P |
13:49:48 | FromDiscord | <Yardanico> this binding uses the JS backend |
13:49:53 | FromDiscord | <impbox [ftsf]> oh i see |
13:51:08 | FromDiscord | <Yardanico> tic 80 supports 4 languages officially - " 64KB of Lua or Moonscript or JavaScript or Wren or Fennel" |
13:51:14 | FromDiscord | <Yardanico> moonscript and fennel also compile to Lua |
13:51:53 | arkanoid | side question: in vscode F6 runs "nim c ...", how to make it run nimble build/run instead? |
13:52:58 | FromDiscord | <Yardanico> I don't think you can change the command that's being run when pressing F6 |
13:53:12 | FromDiscord | <Yardanico> but you can add specific vscode tasks for Ctrl+F5 (run without debugging) which is a vscode keybind |
13:53:29 | FromDiscord | <fenrave> if you mean with coderunner, you can edit the json file for it to change the command that it runs |
13:53:38 | FromDiscord | <Yardanico> In reply to @fenrave "if you mean with": nah, he's talking about the nim extension |
13:54:01 | FromDiscord | <Yardanico> both Nim extensions (the pragmagic and saem) have F6 hotkey to run "nim c /path/to/currentFile.nim" |
13:54:42 | FromDiscord | <fenrave> did not know that |
13:55:59 | arkanoid | I'm using the saem one. It has a "build command" option that defaults to "c", but replecing it with "nimble build" results in it trying to run "nim nimble build ..." |
13:56:21 | FromDiscord | <Yardanico> ah maybe you can change, lemme check the config |
13:56:52 | FromDiscord | <Yardanico> eh, seems like you can't :) |
13:57:04 | FromDiscord | <Yardanico> https://github.com/saem/vscode-nim/blob/main/src/nimvscode.nim#L235 it's hardcoded here |
13:57:14 | FromDiscord | <Yardanico> (nim saem extension inherited most behaviour from the pragmagic extension) |
13:59:48 | FromDiscord | <Yardanico> you can make a PR adding a config variable for that since this extension is written in Nim (and compiled via JS backend) |
14:03:46 | arkanoid | yeah! I've opened an issue to talk about this |
14:03:48 | arkanoid | thanks |
14:06:02 | arkanoid | not the smoothest karax intro experience: this compiles to js but triggers assertionDefect in js https://play.nim-lang.org/#ix=3yFj |
14:06:17 | FromDiscord | <Yardanico> why are you including stdlib modules? |
14:06:20 | FromDiscord | <Yardanico> you should import them |
14:06:48 | arkanoid | I was following this tutorial: https://moigagoo.svbtle.com/exploring-karax |
14:07:04 | arkanoid | old, yes, but he is using sugar |
14:07:18 | FromDiscord | <Yardanico> but he is importing sugar :) |
14:07:31 | FromDiscord | <Yardanico> not sure about the issue itself though |
14:07:45 | FromDiscord | <Yardanico> we have a #webdev on discord, I think it's bridged to matrix as well |
14:07:49 | FromDiscord | <Yardanico> it's better to ask about karax there |
14:07:55 | arkanoid | is there a difference between "import sugar" and "import std/sugar"? |
14:08:13 | FromDiscord | <Yardanico> yes |
14:08:33 | FromDiscord | <Yardanico> if you have a file named "sugar.nim" in the same folder as the main file, then "import sugar" will import that local file instead of stdlib |
14:08:49 | arkanoid | sure, but I have just "webtest.nim" in my src |
14:08:53 | FromDiscord | <Yardanico> "std" is the stdlib module prefix, and all new modules since 0.20.0 (or near that) are created in std namespace specifically |
14:09:11 | FromDiscord | <Yardanico> so it's better to just always use std prefix when importing stdlib modules |
14:09:25 | FromDiscord | <Yardanico> You can of course import multiple modules as easily - `import std/[strutils, strscans, httpclient]` |
14:09:28 | arkanoid | yeahm that's why I'm using std/[] |
14:09:40 | arkanoid | this is the js error I'm getting: https://play.nim-lang.org/#ix=3yFk |
14:11:52 | * | jjido joined #nim |
14:12:32 | arkanoid | oh, wait, It's a problem about include vs import |
14:12:59 | arkanoid | so karax has to be included and not imported? |
14:13:52 | arkanoid | including karax + importing sugar works |
14:16:32 | * | max22- joined #nim |
14:57:41 | * | leth joined #nim |
14:58:18 | NimEventer | New Nimble package! alasgar - Game Engine, see https://github.com/abisxir/alasgar |
14:58:21 | nrds | <R2D299> itHub: 7"3D game engine for nim" |
15:01:11 | leth | In javascript it's possible and sometimes rather nifty to pass functions as arguments and calling them, when writing js specific nim code how would one represent this? Is there a way to call a JSObject, or should the argument be of some other type? |
15:07:33 | arkanoid | after grokking elementary karax, I'm trying to slit effectful code from pure, but I'm failing. Do you know why this code can trigger effects? https://play.nim-lang.org/#ix=3yFO |
15:53:05 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
15:55:24 | * | max22- quit (Remote host closed the connection) |
15:57:44 | FromDiscord | <hotdog> In reply to @leth "In javascript it's possible": You can have procs as arguments |
16:00:23 | * | stkrdknmibalz quit (Read error: Connection reset by peer) |
16:01:46 | FromDiscord | <Kiloneie> @Yardanico when you meant shared ownership, you meant multiple objects using a ref objects right? |
16:02:06 | FromDiscord | <Yardanico> I meant multiple objects having the same reference to an object |
16:03:17 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3yGd |
16:03:29 | FromDiscord | <Yardanico> in this case both `b` and `c` point to the same instance of `A` |
16:03:54 | FromDiscord | <Yardanico> hence "shared ownership" |
16:08:42 | * | jjido joined #nim |
16:22:44 | * | pro quit (Quit: WeeChat 3.2) |
16:36:43 | * | stkrdknmibalz joined #nim |
16:39:49 | arkanoid | do you have an url where I can get a good example on how to ffi javascript using jsffi? I'm trying to interface with leaflet js lib. I've aready got working code using jsffi and magic JsObject type, but I'm trying to learn how to map types to achieve static typing |
16:41:31 | FromDiscord | <leorize> jsffi is mainly for untyped ffi |
16:42:12 | arkanoid | ok, so I think what I want to do is avoiding it and map types |
16:42:49 | FromDiscord | <leorize> yea |
16:42:59 | * | max22- joined #nim |
16:43:13 | FromDiscord | <leorize> though you can probably do `distinct JsObject` as a start |
16:45:16 | arkanoid | I'm puzzled how should I import a namespace |
16:45:49 | arkanoid | this lib has a global "L" that contains all funcs https://leafletjs.com/examples/quick-start/ |
16:45:52 | FromDiscord | <leorize> importing a module you mean? |
16:46:00 | FromDiscord | <leorize> https://github.com/alaviss/setup-nim/blob/ng/src/private/actions/core.nim#L34 |
16:46:04 | FromDiscord | <leorize> ^ something like that? |
16:46:14 | arkanoid | I'm doing "var L {.importc, nodecl.}: JsObject" and it is working |
16:47:07 | FromDiscord | <leorize> yea, just use it as a global and map have your wrappers access it |
16:50:56 | leth | hotdog: What if the arguments are unknown and may vary? as in they come from external js. |
16:52:17 | FromDiscord | <hotdog> In reply to @leth "<@472459996068839424>: What if the": How will you call the function if you don’t know the arguments? |
16:52:29 | arkanoid | not sure I've got the correct pattern |
16:53:02 | leth | hotdog: That might very well happen in external code. |
16:55:22 | leth | hotdog: but say i want to call a function without arguments, that is passed in as a JSObject how do I do that? |
16:55:32 | arkanoid | confused by importc and importcpp with js |
16:56:55 | FromDiscord | <hotdog> In reply to @leth "<@472459996068839424>: That might very": If you just pass it out to external js code type probably won’t matter |
16:57:53 | FromDiscord | <hotdog> In reply to @leth "<@472459996068839424>: but say i": You can probably ‘cast[proc()](jsobj)()’ or similar |
16:58:07 | arkanoid | I seoh, there's also imporjs |
16:59:13 | FromDiscord | <hotdog> In reply to @arkanoid "I seoh, there's also": IIRC importjs and importcpp function the same |
17:04:58 | leth | hotdog: Can't find a way to cast it. |
17:15:15 | arkanoid | I'm really missing the point on how to map a JsObject to a nim type properly |
17:16:35 | arkanoid | I see that jsffi module has the "toJs", "to", newJsAssoc procs/macros that may be relevant to the solution of the problem, but I cannot find a proper example on how I'm supposed to use them |
17:18:41 | arkanoid | also what is this importjs syntax that contains hash char? Where is it documented? proc isUndefined*[T](x: T): bool {.noSideEffect, importjs: "(# === undefined)".} |
17:19:07 | FromDiscord | <Yardanico> importjs https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-importjs-pragma |
17:19:08 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-importcpp-pragma |
17:19:20 | FromDiscord | <Yardanico> importjs is a different name for importcpp which has some syntax for stuff |
17:20:36 | arkanoid | ah, ok, thanks. I've always working with C ffi and never with C++, gonna read it |
17:22:44 | arkanoid | wonder if the importcpp "::" namespace indicator works for importjs too, where I have a whole API under L. name (see https://leafletjs.com/examples/quick-start/) |
17:25:27 | FromDiscord | <hotdog> In reply to @leth "<@472459996068839424>: Can't find a": What did you try? |
17:28:12 | leth | hotdog: just solved it: with jsffi's to |
17:28:55 | FromDiscord | <hotdog> In reply to @leth "<@472459996068839424>: just solved it:": Good job |
17:29:25 | leth | to(jsobject-to-be-called, proc(args): JSObject) |
17:29:40 | leth | oh and call that. |
17:30:09 | leth | to(jsobject-to-be-called, proc(args): JSObject)(args) |
17:32:45 | leth | hotdog: thank you, and thanks for your time and help. |
18:02:00 | FromDiscord | <Kiloneie> sent a code paste, see https://play.nim-lang.org/#ix=3yGF |
18:14:46 | * | jmiven quit (Ping timeout: 260 seconds) |
18:15:56 | * | jmiven joined #nim |
18:27:34 | FromDiscord | <ynfle (ynfle)> Is it possible to suppress error checks for one variable that needs to be snake case/ |
18:28:01 | FromDiscord | <Rika> Needs for what reason? Json? |
18:29:02 | FromDiscord | <ynfle (ynfle)> Yup |
18:29:18 | FromDiscord | <ynfle (ynfle)> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/886679447036653629): Is it possible to suppress error checks for one variable that needs to be snake case? |
18:30:14 | FromDiscord | <Rika> I don't think you can suppress those |
18:35:40 | * | max22- quit (Ping timeout: 260 seconds) |
18:49:57 | * | leth quit (Quit: no reason) |
18:52:19 | * | max22- joined #nim |
19:32:33 | FromDiscord | <brainproxy> sent a code paste, see https://play.nim-lang.org/#ix=3yH3 |
19:45:52 | FromDiscord | <Yardanico> yes |
19:46:34 | FromDiscord | <Yardanico> you can use `walkDir` at compile-time |
19:46:36 | FromDiscord | <Yardanico> from os |
19:48:23 | FromDiscord | <Elegantbeef> I am now yardanico, now i get to try to figure out why the cgen is dumb |
19:48:43 | FromDiscord | <Yardanico> ecksdee |
19:48:50 | FromDiscord | <Yardanico> also I misread "I am now yardanico" |
19:49:00 | FromDiscord | <Yardanico> like "why does he think he's me now" |
19:49:20 | FromDiscord | <Elegantbeef> Well i mean that's how it's written commas stop accidental name reassignment 😛 |
19:50:50 | FromDiscord | <brainproxy> In reply to @Yardanico "you can use `walkDir`": I'm not sure how to use walkDir to build up a `const` |
19:51:04 | FromDiscord | <Elegantbeef> Sadly it's semantically fine i think, so that's fun |
19:51:09 | FromDiscord | <brainproxy> do I need to do it inside a macro? |
19:51:12 | FromDiscord | <Yardanico> no? |
19:51:16 | FromDiscord | <Yardanico> you can execute code at compile-time |
19:51:46 | FromDiscord | <Elegantbeef> Isnt walkdir an importC so you cannot use it you need to use the nimscript walkfiles or w/e |
19:52:02 | FromDiscord | <Yardanico> you can use walkDir |
19:52:56 | FromDiscord | <Yardanico> lemme show an example |
19:53:28 | FromDiscord | <brainproxy> I understand I can run code at compile time, and thanks for the tip re: walkDir, I'm just not sure how to arrange it so I end up with a `const myArray` |
19:56:08 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3yH8 |
19:56:12 | FromDiscord | <Yardanico> basically create a compile-time seq and create an array out of it |
19:57:00 | FromDiscord | <Yardanico> or you can just keep it as a const seq if you want, then you won't need this `block` at all |
19:57:23 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3yH9 |
19:57:34 | FromDiscord | <brainproxy> cool, thanks! |
19:59:00 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
19:59:51 | FromDiscord | <Yardanico> @ElegantBeef honestly I'm not sure how it works |
20:00:10 | FromDiscord | <Elegantbeef> In regards to? |
20:00:23 | FromDiscord | <Yardanico> walkDir |
20:00:40 | FromDiscord | <Elegantbeef> Ah |
20:01:32 | FromDiscord | <Elegantbeef> I think there is probably a vmops for that function somewhere |
20:02:16 | FromDiscord | <Yardanico> there's only this https://github.com/nim-lang/Nim/blob/devel/compiler/vmops.nim#L227 |
20:02:29 | FromDiscord | <Yardanico> but it's staticWalkDir and not walkDir |
20:04:27 | * | supakeen quit (Remote host closed the connection) |
20:04:50 | * | supakeen joined #nim |
20:05:17 | * | Amun-Ra quit (Ping timeout: 252 seconds) |
20:05:48 | * | Amun-Ra joined #nim |
20:30:13 | FromDiscord | <ynfle (ynfle)> Is there a way to attacha metadata to `test` from `unittest`? |
20:33:59 | FromDiscord | <ynfle (ynfle)> Like with a custom pragma or something like that |
20:45:21 | FromDiscord | <Hamid Bluri> hey |
20:45:30 | FromDiscord | <Hamid Bluri> how can i make a library |
20:45:32 | FromDiscord | <Hamid Bluri> and |
20:46:21 | FromDiscord | <Hamid Bluri> when a user install it vie nimble |
20:47:55 | FromDiscord | <Hamid Bluri> he can run it by typing the my library name |
20:48:10 | FromDiscord | <Hamid Bluri> something like `inim` package |
20:48:29 | FromDiscord | <Hamid Bluri> https://github.com/inim-repl/INim |
20:48:31 | nrds | <R2D299> itHub: 7"Interactive Nim Shell / REPL / Playground" |
20:48:45 | FromDiscord | <Hamid Bluri> (edit) removed "my" |
20:49:06 | FromDiscord | <Hamid Bluri> (edit) "he can run it by typing the library name ... " added "in terminal" |
20:50:55 | FromDiscord | <Elegantbeef> `bin = @[]` |
20:52:01 | FromDiscord | <Hamid Bluri> got it, thanks |
20:53:47 | * | Jjp137 quit (Read error: Connection reset by peer) |
20:54:37 | * | Jjp137 joined #nim |
20:57:18 | * | Gustavo6046_ joined #nim |
20:58:09 | * | Gustavo6046 quit (Ping timeout: 265 seconds) |
21:00:00 | * | Gustavo6046_ is now known as Gustavo6046 |
21:20:52 | arkanoid | do I really need to use ctypes for js ffi? |
21:21:01 | arkanoid | cfloat for example |
21:32:57 | * | Gustavo6046 quit (Ping timeout: 265 seconds) |
21:37:25 | * | Gustavo6046 joined #nim |
21:43:32 | arkanoid | do you know how to get a string representation of a JsObject? |
21:45:36 | FromDiscord | <konsumlamm> `$`? |
21:48:27 | arkanoid | no, getting js errors with that and repr |
21:49:18 | arkanoid | the only way I'm able to get something out of a JsObject is to create a ref object type with known field and use myJsObject.to(FooType).repr |
21:50:02 | arkanoid | for example echo (clickEvent.JsObject).latlng.to(LatLng).repr |
21:51:02 | arkanoid | the '$' function does not exist for JsObject |
21:52:50 | arkanoid | well, obviously also "echo (clickEvent.JsObject).latlng.to(LatLng)[]" works |
21:53:13 | arkanoid | but really it should be able to print someting with just "echo clickEvent" |
21:54:02 | arkanoid | if you search for '$' in this page, you get zero procs https://nim-lang.org/docs/jsffi.html |
21:58:47 | FromDiscord | <Elegantbeef> cant you make a `$` proc that iterates the `pairs` echoing out `a: $y`? |
21:58:58 | FromDiscord | <Elegantbeef> Only issue is if you have recursive types |
22:01:12 | arkanoid | yes but why not include it in jsffi, there must be a traphole somewhere |
22:02:44 | FromDiscord | <Elegantbeef> Well if you have recursive types you'll have an issue |
22:03:23 | FromDiscord | <Elegantbeef> If a -\> b -\> a you'll hit an endless loop of writing to the string |
22:03:32 | * | max22- quit (Quit: Leaving) |
22:03:51 | arkanoid | exactly: "Uncaught InternalError: too much recursion" |
22:08:24 | arkanoid | well, got the problem, thanks |
22:08:53 | FromDiscord | <Elegantbeef> I dont know if there is a way to get a unique id for a js object to stop that either |
22:11:23 | arkanoid | I've just written my first toy js ffi interface to a lib. It works nicely but I'd like a review from a more experienced user to fix bad practices early. Would you? https://play.nim-lang.org/#ix=3yHJ |
22:11:40 | arkanoid | s/interface// |
22:12:12 | arkanoid | it follows most of quick start guide: https://leafletjs.com/examples/quick-start/ |
22:22:11 | * | Gustavo6046 quit (Ping timeout: 265 seconds) |
22:22:11 | * | Gustavo6046_ joined #nim |
22:23:49 | * | Gustavo6046_ is now known as Gustavo6046 |
22:49:26 | * | NeoCron joined #nim |
22:57:47 | * | NeoCron quit (Remote host closed the connection) |
23:47:31 | * | arfy joined #nim |