00:03:39 | * | PMunch quit (Quit: leaving) |
00:30:22 | * | pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
00:51:03 | * | sixtyten joined #nim |
00:52:06 | * | Tanger joined #nim |
00:54:29 | FromDiscord | <Recruit_main707> if i had an object, passed as a variable to a function (`var T`), could i pass its field to a function that expects `var fieldType`? |
00:56:36 | FromDiscord | <Recruit_main707> sent a code paste, see https://play.nim-lang.org/#ix=2KMp |
00:58:01 | FromDiscord | <Recruit_main707> (ignore the ":" ) |
00:58:25 | FromDiscord | <Recruit_main707> and the : "var" omg i need to sleep |
01:05:31 | FromDiscord | <Recruit_main707> now, a decent example: https://play.nim-lang.org/#ix=2KMv |
01:10:46 | FromDiscord | <ElegantBeef> You're creating a new sequences using the slice operator |
01:10:47 | FromDiscord | <ElegantBeef> It's not a view |
01:11:10 | FromDiscord | <ElegantBeef> So it's immutable |
01:11:50 | FromDiscord | <Recruit_main707> ok |
01:11:55 | FromDiscord | <Recruit_main707> thank you |
01:14:31 | saem | Hmm, it seems the semantic analysis doesn't quite treat an included module quite correctly for nimsuggest -- likely impacts other semantics bits too? Presently markUsed isn't tracking this info properly. |
01:20:43 | FromDiscord | <Anonymous Poet> hey all, ive been trying to put together a simple nim http function with openfaas, but i think ive gotten stuck. i was hoping someone here might have some fresh ideas and could suggest an approach |
01:21:23 | FromDiscord | <Anonymous Poet> ive built a branch and bound sudoku solver already, and put it behind an asynchttp server, which seems to be working well |
01:21:55 | FromDiscord | <Anonymous Poet> after a lot of fighting with openfaas, ive gotten it to the point where get requests and post requests without a body correctly get handled |
01:22:37 | FromDiscord | <Anonymous Poet> but for the life of me i cant figure out why passing post data is causing issues. I get a "content length is unspecified" error, and Im not sure why |
01:23:11 | FromDiscord | <ElegantBeef> Code is more vocal than any written word 😄 |
01:23:33 | FromDiscord | <Anonymous Poet> haha fair, what would you like to see? |
01:23:43 | FromDiscord | <Anonymous Poet> i can post a gitlab link ? |
01:24:56 | FromDiscord | <ElegantBeef> Yea |
01:25:07 | FromDiscord | <Anonymous Poet> https://gitlab.com/vabresto/nim-sudoku-faas |
01:26:10 | FromDiscord | <Anonymous Poet> you should also be able to access the container that im trying to run if that helps, and im happy to provide logs or w.e else |
01:28:26 | FromDiscord | <ElegantBeef> Do have to ask C#? 😄 |
01:28:47 | FromDiscord | <ElegantBeef> I see those pascal named functions, and can only remember when i did the same 😄 |
01:29:06 | FromDiscord | <Anonymous Poet> mix of python and C++ :p |
01:29:30 | FromDiscord | <Anonymous Poet> i think nim recommends CamelCase and python snake_case |
01:29:53 | FromDiscord | <ElegantBeef> Procedure names are supposed to be camelCased yes, but anywho code |
01:30:15 | * | abm quit (Quit: Leaving) |
01:30:21 | FromDiscord | <Anonymous Poet> im still very new to nim so please let me know if theres things i should be doing better |
01:30:37 | FromDiscord | <Anonymous Poet> the sudoku.nim file handles the actual solving, and main.nim is the http bit in front of it |
01:30:39 | FromDiscord | <ElegantBeef> well i'd say `toEdtitableHtml` is fine |
01:30:50 | FromDiscord | <ElegantBeef> Since the first param is `GameBoard` |
01:30:56 | FromDiscord | <Daniel> https://media.discordapp.net/attachments/371759389889003532/795464246318202900/zams2tkkkzq11.png |
01:32:17 | FromDiscord | <Anonymous Poet> does nim allow kebab case? usually languages dont allow that because it looks like identifier minus identifier |
01:32:32 | FromDiscord | <ElegantBeef> the reason you drop the name is so you can do `board.toEditableHtml` like it's a member function |
01:32:34 | FromDiscord | <Daniel> camel or snake should work evently |
01:32:44 | FromDiscord | <Daniel> (edit) "evently" => "evenly" |
01:32:47 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/strutils.html#IdentChars |
01:33:15 | FromDiscord | <ElegantBeef> In nim casing doesnt matter since `toEditableHtml` is the same as `to_Editable_HTML` |
01:33:23 | FromDiscord | <Anonymous Poet> yeah, ik |
01:33:37 | FromDiscord | <ElegantBeef> so line 72 in main is the issue? |
01:34:02 | FromDiscord | <Anonymous Poet> no, the get case looks ok |
01:34:02 | * | pbb joined #nim |
01:34:23 | FromDiscord | <Anonymous Poet> http://159.89.118.201:8080/function/nim-sudoku-faas |
01:34:55 | FromDiscord | <Anonymous Poet> as you can see, GET works ok, and POST with no data (if you manually edit the request) work fine |
01:35:05 | FromDiscord | <Anonymous Poet> but POST with any data causes an error |
01:35:20 | FromDiscord | <ElegantBeef> sent a code paste, see https://play.nim-lang.org/#ix=2KMB |
01:35:41 | FromDiscord | <ElegantBeef> I mean you respond with the data to begin with |
01:39:19 | FromDiscord | <Anonymous Poet> theres also the http://159.89.118.201:8080/function/pls endpoint which is python, if that helps |
01:39:30 | FromDiscord | <Anonymous Poet> and for that one the post does seem to work even with data |
01:39:31 | FromDiscord | <ElegantBeef> Seems you just need to provide a `{"Content-Length": size}` in your header |
01:39:51 | FromDiscord | <Anonymous Poet> but its not running my code |
01:40:27 | FromDiscord | <Anonymous Poet> the logs look like this |
01:40:34 | FromDiscord | <ElegantBeef> Weird it does have contentlength |
01:41:09 | FromDiscord | <Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix=2KMC |
01:42:09 | FromDiscord | <Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix= |
01:42:35 | FromDiscord | <Anonymous Poet> the first thing i do is print out the request contents (for debugging), and in get it works, but for post it just never gets there |
01:45:07 | FromDiscord | <Anonymous Poet> if you try the `pls` endpoint and include post data, it works fine.. |
01:45:45 | FromDiscord | <ElegantBeef> I dont know much about webdev, so i'm just looking at the code trying to figure out any issues, but i dont see anything |
01:46:59 | FromDiscord | <ElegantBeef> Hopefully someone that knows something can swing by eventually 😄 |
01:47:09 | FromDiscord | <Anonymous Poet> yeah no worries |
01:47:14 | FromDiscord | <Anonymous Poet> thanks for giving it a try |
01:47:31 | FromDiscord | <Anonymous Poet> ive spent probably >10 hours on this haha |
02:06:36 | * | fputs joined #nim |
02:11:04 | FromDiscord | <sealmove> Hi everyone, happy new year! After almost 2 weeks of doing absolutely nothing, I laid out the _any-binary <-> json_ idea: https://github.com/sealmove/n4n6 |
02:12:24 | saem | poet: is the issue that the body field is private (not exported, but shows in the type) and you need to await the property in order to access it? |
02:13:04 | FromDiscord | <Anonymous Poet> no, i dont think so |
02:13:31 | FromDiscord | <Anonymous Poet> i suspect its a config issue in the way the http server is talking to the openfaas watchdog |
02:14:31 | FromDiscord | <Anonymous Poet> like, the request lifetime looks something like↵↵user request -> faas demon -> of-watchdog (open faas) -> nim http server -> my code -> [reply] -> of-watchdog -> user |
02:14:44 | FromDiscord | <Anonymous Poet> (edit) "demon" => "daemon" |
02:15:08 | FromDiscord | <Anonymous Poet> i think that there of-watchdog -> nim http server is the issue |
02:15:25 | FromDiscord | <Anonymous Poet> because i can use the same binary and it works for a flask server, for example |
02:15:52 | FromDiscord | <Anonymous Poet> and i also know that the connection is generally set up correctly because GET and POST with no data both make it through the whole pipeline correctly |
02:16:48 | FromDiscord | <Anonymous Poet> additionally, i know that the issue is presented as "Content Length required", and none of my code gets executed, which makes me think its more on faas's side, but theres nothing obviously wrong there, so maybe its a nim interop thing ... somehow |
02:18:24 | FromDiscord | <Anonymous Poet> and im sure that an accurate Content-Length header does get passed (tried with firefox and chrome and manually verified). I've seen some comments about form encoding vs chunk encoding, so my current best theory is that the nim http server doesnt support chunk encoding, and requires the Content Length header, which for some inexplicable reason, openfaas is stripping from the request |
02:23:46 | saem | Wait the header being sent is ContentLength and not Content-Length? |
02:25:40 | saem | Code is right here and looking at the logs you send the header does _not_ match. as it's missing a hyphen. https://github.com/nim-lang/Nim/blob/devel/lib/pure/asynchttpserver.nim#L250 |
02:27:44 | FromDiscord | <Anonymous Poet> ! |
02:28:01 | FromDiscord | <Anonymous Poet> first observation is that the error im getting looks exactly like that error message, so it seems to be getting to nim at least |
02:30:48 | saem | Question is is your faas config mangling the header for some reason? It's being sent incorrectly? |
02:30:51 | FromDiscord | <Anonymous Poet> https://github.com/openfaas/of-watchdog/blob/9f89d2beb70a5719f859ee37206b3daa379c6c2f/executor/http_runner.go#L170 |
02:31:11 | FromDiscord | <Anonymous Poet> this is the line from the faas watchdog thats printing that line |
02:35:38 | FromDiscord | <exelotl> Mann source code filters are so good |
02:36:28 | FromDiscord | <exelotl> I've been using fmt and string concatenation to generate C files and such containing data for my game |
02:37:27 | FromDiscord | <exelotl> Just started using source code filters for it instead and it's wayy better |
02:37:36 | saem | Ah, just a spelling mistake there then? |
02:38:41 | FromDiscord | <Anonymous Poet> im not sure ... this definitely seems to be the issue |
02:38:55 | FromDiscord | <Anonymous Poet> i havent explicitly set any header values or any similar config |
02:39:28 | FromDiscord | <Anonymous Poet> i wonder if go might be producing something like `content-length` where nim is expecting `Content-Length` or something similar? |
02:40:15 | FromDiscord | <Anonymous Poet> if i wanted to add some print/debug statements in the nim stdlib and compile against that, how can i do that? |
02:45:06 | saem | You can include a patch file via on complier invocation or possibly copy that module into your source on an equivalent path so that resolves first instead |
02:45:37 | saem | I've done the latter for nimble packages |
02:46:17 | FromDiscord | <ElegantBeef> I do the dumb thing and just modify the source module 😄 |
02:47:04 | FromDiscord | <Anonymous Poet> i went for copying the module into my source |
02:47:13 | FromDiscord | <Anonymous Poet> hopefully theres no mixed dependencies |
02:48:46 | FromDiscord | <Anonymous Poet> out of curiosity though, how do i specify a patch file? that sounds really useful |
02:52:23 | saem | I think that's fine via nimscript |
02:52:49 | saem | Might be doable by nimcfg, but didn't see it. I know it from the latest compiler docs. |
02:53:27 | saem | On phone so extra typos. s/fine/done |
02:53:29 | FromDiscord | <Anonymous Poet> https://nim-lang.org/docs/nimscript.html#patchFile%2Cstring%2Cstring%2Cstring ? |
02:54:37 | saem | Yeah, pretty sure nimble can do that too, because they're the same... sadly |
02:55:03 | FromDiscord | <Anonymous Poet> oh, interesting. TIL. thanks |
02:55:10 | saem | NP |
02:55:52 | FromDiscord | <Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix= |
02:56:04 | FromDiscord | <Anonymous Poet> this is the full set of headers that nim is getting at that point |
02:56:29 | FromDiscord | <Anonymous Poet> i dont see a content length at all, so is it safe to say that the go proxy is removing it, or is there anywhere else that could be happening in nim land? |
02:56:52 | saem | You need to hit the share button, there is no unique parameter |
02:57:00 | FromDiscord | <Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix=2KMR |
02:57:25 | FromDiscord | <Anonymous Poet> what do i need to hit share on? |
02:57:37 | saem | The playground |
02:58:00 | saem | Compare the two links you sent, see the lack of unique key? |
02:58:37 | FromDiscord | <Rika> saem, the bridge is doing that |
02:58:50 | FromDiscord | <Anonymous Poet> hopefully this helps https://media.discordapp.net/attachments/371759389889003532/795486367348949012/Screen_Shot_2021-01-03_at_9.58.41_PM.png |
02:59:16 | FromDiscord | <Anonymous Poet> im on discord, im just using its quoted text; i havent made any playground links |
03:00:20 | saem | Oh, I'm in IRC, so the bridge does some extra helping. :D |
03:02:50 | FromDiscord | <Anonymous Poet> if anyone knows go, could you tell me if this loop here will write the content length forward? https://github.com/openfaas/of-watchdog/blob/9f89d2beb70a5719f859ee37206b3daa379c6c2f/executor/http_runner.go#L100 |
03:03:57 | saem | Looks like it will |
03:04:23 | saem | Does it show up in the python version? |
03:05:20 | FromDiscord | <Anonymous Poet> sadly, it seems like it does |
03:05:22 | FromDiscord | <Anonymous Poet> http://159.89.118.201:8080/function/pls |
03:06:52 | FromDiscord | <Anonymous Poet> based on this though i wonder if the python version is somehow fetching it from somewhere else? |
03:06:53 | FromDiscord | <Anonymous Poet> https://github.com/openfaas/faas/issues/1127 |
03:06:57 | disbot | ➥ Watchdog: content-length environment variable not consistent naming ; snippet at 12https://play.nim-lang.org/#ix=2KMV |
03:07:24 | FromDiscord | <Anonymous Poet> i cant imagine why you'd need to set an env var with the content length, but someone must be using it |
03:07:25 | saem | I mean, I don't see the content length |
03:07:43 | FromDiscord | <Anonymous Poet> sent a code paste, see https://play.nim-lang.org/#ix= |
03:08:00 | FromDiscord | <Anonymous Poet> its a link to a githb issue, i think the bot tried to be smart but didnt end up helping |
03:09:00 | saem | Ok, well there you go |
03:09:23 | FromDiscord | <ElegantBeef> If you're ever uncertain what the bridge has done to your message just check here https://irclogs.nim-lang.org/ |
03:10:14 | saem | Or use IRC. :P |
03:10:25 | FromDiscord | <Anonymous Poet> right but its also setting other vars that DO seem to get passed through |
03:10:47 | FromDiscord | <ElegantBeef> I mean i'd rather support using matrix as a person that likes multimedia text chats 😄 |
03:11:06 | FromDiscord | <ElegantBeef> I do know you can get irc clients that embed shush |
03:11:47 | FromDiscord | <j-james> Oh by the way Beef, the only reason I posted c2nim on HN was because I had been playing around with it and found it cool |
03:12:07 | FromDiscord | <ElegantBeef> Ah |
03:12:22 | FromDiscord | <j-james> wasn't expecting it to take off but that seems to come with posting later in the night |
03:18:28 | FromGitter | <deech> I just learned that Nim's FFI supports multiple headers per object and that's just amazing: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ff2890493af5216fc7e15ce] |
03:18:49 | saem | Anyone about that knows about the sem parts of the compiler, I'm having some issue understanding the include tracking. I want to figure out if it's possible to have markUsed use the PContext to know if it's an included module and if so consider that markUsed as part of the includer |
03:21:24 | FromDiscord | <exelotl> Hey, if I do `open(filepath, fmWrite).write("hello")` under arc, will it free the file immediately after writing to it? |
03:23:12 | FromDiscord | <ElegantBeef> I dont believe the destroy procs are invoked for files and the like yet |
03:23:37 | FromDiscord | <ElegantBeef> Rather i dont think the destructors are implemented for them |
03:23:50 | FromGitter | <deech> ElegantBeef, is it just that the stdlib hasn't caught up yet? |
03:24:34 | FromDiscord | <ElegantBeef> I suppose i dont know |
03:26:03 | * | rockcavera joined #nim |
03:31:16 | FromDiscord | <exelotl> Also lol I got tired of recursive module dependencies biting me in the ass, so I just said fuck it and moved the offending proc to a new module and {.exportc.}'d it so that I can use it earlier without the Nim compiler actually knowing about it yet 😅 |
03:32:14 | FromDiscord | <exelotl> I'm really looking forward to the IC advancements if they're gonna help to make this stuff less painful |
03:47:08 | saem | I'm not sure how IC helps there, I think more eyes/attention on the code might reduce bugs along the way perhaps? |
03:48:38 | * | muffindrake quit (Ping timeout: 264 seconds) |
03:50:17 | saem | I'm looking at include code right now and I can see some data inconsistencies, though I don't know if they're actual issues. |
03:50:36 | * | muffindrake joined #nim |
04:01:49 | * | blueberrypie joined #nim |
04:02:19 | FromDiscord | <exelotl> Ah, I might be mistaken, I just remember hearing that relaxing the recursive module restrictions might be easier once IC is in place, or something like thst |
04:03:09 | FromDiscord | <exelotl> I don't know much about what goes on in the compiler tbh |
04:03:24 | FromDiscord | <ElegantBeef> I think after IC it was one of the things that might be looked into |
04:04:00 | FromDiscord | <exelotl> Ah maybe that's what I heard x) |
04:05:03 | saem | I can see that being a thing, but that's likely has a lot to do with revisiting the code than necessarily IC, the include tracking works enough to get a compile, but it's the tracking might need to be more strict to allow for nimsuggest (lots of semantic analysis) to fulfil queries. |
04:05:38 | saem | I mean IC does bring in a bunch of precise tracking of this information so that could definitely be an enabler. |
04:08:23 | saem | ^^ I'm seeing bits of that code now as I'm walking through these layers. |
04:10:24 | saem | This all started because I tried to fix nimsuggest's inability to outline a bunch of included files in the compiler and it was making it hard for me to look at name mangling and ndi which I wanted to leverage for better debugging. |
04:13:10 | disruptek | after ic comes circular imports. |
04:14:19 | disruptek | or, as we refer to it internally, ci. |
04:14:49 | saem | That's a French influence? |
04:15:19 | FromDiscord | <exelotl> i c what u did there |
04:15:29 | disruptek | si. |
04:31:40 | * | spiderstew_ joined #nim |
04:33:49 | * | spiderstew quit (Ping timeout: 264 seconds) |
04:41:16 | * | Jesin quit (Read error: Connection reset by peer) |
04:41:57 | * | Jesin joined #nim |
04:42:03 | disruptek | !repo testes |
04:42:05 | disbot | https://github.com/disruptek/testes -- 9testes: 11a small unittest framework with decent support 🔴🟡🟢 15 24⭐ 1🍴 7& 29 more... |
04:55:30 | disruptek | do we need to talk about my testes? |
04:56:16 | saem | absolutely not |
04:56:46 | disruptek | one of my balls is pretty red. are you sure? |
04:58:57 | saem | Definitely, I'm very much not a doctor. |
05:42:18 | FromDiscord | <dk> I like Ormin but it seems to be buggy and there's no activity on the issue tracker. Is there a better alternative? |
05:42:57 | disruptek | to not reporting bugs? yes: fixing them yourself and submitting PRs. |
05:43:07 | FromDiscord | <dk> I would especially like one that doesn't do OOP and just typechecks the queies |
05:43:20 | leorize[m] | that's what ormin does? |
05:43:24 | FromDiscord | <dk> fine, but it's all macros... |
05:43:34 | disruptek | macros are code, too. |
05:44:01 | leorize[m] | ormin is pretty simple once you look at the implementation |
05:44:01 | * | Gustavo6046 quit (Ping timeout: 264 seconds) |
05:44:22 | leorize[m] | it works fine enough for the most part, if you use the sqlite backend |
05:45:32 | disruptek | yeah, don't replace your orm -- replace your database. is that the advice? |
05:46:20 | leorize[m] | lol |
05:47:19 | leorize[m] | disruptek: anyhow, here's how to do 32 bit linux ci if you ever need that: https://github.com/alaviss/nim-sys/blob/7ce02435afd186a286f6d5d3e5a1e8be95c875c2/.github/workflows/ci.yml#L38-L51 |
05:51:24 | disruptek | leorize[m]: would be nice to have a new devel nightly. |
05:52:17 | leorize[m] | oh it's still busted? will check in a bit |
05:52:27 | disruptek | i can't figure this macos behavior out. i dunno if it's random errors in skiplists or what. |
05:53:46 | disruptek | my feedback for nim-sys is... as little surface as possible. |
05:54:13 | disruptek | as data-driven as possible. if you need to use distincts to achieve control, so be it. |
05:54:57 | disruptek | i know it's vague, but i can't load your docs yet. |
05:56:08 | disruptek | i don't think the API should need to be queried with `declared` before using it. why can't we noop setBlocking instead? you can issue a warning on unsupported platforms, right? |
06:01:50 | disruptek | leorize[m]: ci for nightlies seems to be failing with a syntax error in the release script. |
06:11:45 | leorize[m] | disruptek: because 99% of the time you won't use it, and when you do you want it to work |
06:13:03 | disruptek | what am i supposed to do with the else clause of my when declared statement? |
06:13:09 | disruptek | and why can't you do that for me? |
06:28:35 | leorize[m] | it's a low-level proc |
06:28:46 | leorize[m] | not all posix apis allow atomic setting of flags |
06:28:54 | leorize[m] | the proc is a helper for those cases |
06:29:27 | leorize[m] | on other os you don't use them because their api support setting blocking mode on construction (and only on construction) |
06:35:58 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
06:40:15 | * | Jesin quit (Read error: Connection reset by peer) |
06:40:54 | disruptek | you didn't answer my question. |
06:45:43 | * | narimiran joined #nim |
06:47:38 | Zevv | you never question my anwers |
06:51:04 | leorize[m] | disruptek: you use a different api with atomic flag setting in the else clause :P |
06:51:15 | leorize[m] | probably I should re-brand it as `posixSetBlocking` |
06:52:08 | disruptek | call it whatever you want; it still smells like dogshit to me. |
06:54:02 | leorize[m] | it's an internal helper that I expose since it might be useful |
06:54:11 | leorize[m] | I can just get rid of it from the public interface too |
06:54:15 | leorize[m] | not all os work the same way |
07:01:56 | Avatarfighter[m] | can an object have a field and a proc of the same name? |
07:06:42 | * | actuallybatman joined #nim |
07:06:59 | FromDiscord | <ElegantBeef> Yes |
07:07:33 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/httpclient.html#body%2CAsyncResponse |
07:07:34 | FromDiscord | <ElegantBeef> For example |
07:08:41 | * | radgeRayden quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
07:29:19 | * | PrvDragon joined #nim |
07:57:38 | * | PMunch joined #nim |
08:18:42 | Araq | I'm back, happy new year! |
08:23:20 | PMunch | Happy new year! |
08:23:33 | PMunch | Hope you enjoyed your well deserved time off |
08:25:17 | * | ex_nihilo joined #nim |
08:29:47 | * | Gustavo6046 joined #nim |
08:39:25 | * | Vladar joined #nim |
08:46:05 | FromDiscord | <Firefell> Happy new year everybody ! |
08:52:43 | * | crem quit (Quit: WeeChat 3.0) |
08:54:02 | * | crem joined #nim |
08:57:27 | Oddmonger | 2021.promise(happy) |
08:57:55 | Oddmonger | dunno if there are promises in Nim, though |
09:04:25 | * | Tanger quit (Remote host closed the connection) |
09:15:48 | * | letto_ quit (Ping timeout: 272 seconds) |
09:19:23 | Zevv | Not as much as vlang |
09:20:45 | * | hnOsmium0001 quit (Quit: Connection closed for inactivity) |
09:21:51 | Oddmonger | ha héhé |
09:22:21 | Oddmonger | sure vlang makes a lot of promises (and it can run Doom) |
09:23:31 | Araq | PMunch, thanks, I worked on IC, not much time off |
09:24:03 | PMunch | Oooh, how is that coming along? |
09:27:15 | ForumUpdaterBot | New thread by HJarausch: Exceptions which can hold / pass an object?, see https://forum.nim-lang.org/t/7330 |
09:28:52 | Araq | PMunch, I'm still in the "coding" phase, not even testing started |
09:28:58 | Araq | which is also why it's so much fun ;-) |
09:29:15 | PMunch | Ah, that's the best part :) |
09:29:20 | Araq | but I expect it to be ready for a nimsuggest-v2 alpha this week |
09:29:38 | Araq | it's easier when you don't have to care about backend integration |
09:33:25 | * | letto joined #nim |
09:34:56 | * | xet7 joined #nim |
09:38:04 | FromGitter | <HJarausch_gitlab> How to increment a counter at compile time. I need to pass a counter to code which is generated by a macro. This code should be incremented each time the macro is invoked. |
09:40:35 | * | abm joined #nim |
09:41:19 | PMunch | Make a compile-time global variable and increment it? |
09:41:41 | Araq | use the macrocache API, if you can |
09:44:04 | PMunch | macrocache API? |
09:44:42 | Oddmonger | i would be interested by a sample of this |
09:56:39 | Araq | const mycount = CacheCounter"mycount" |
09:56:54 | Araq | let x = value(mycount) # 0 |
09:57:00 | Araq | inc mycount |
09:57:07 | Araq | let y = value(mycount) # 1 |
09:58:02 | Araq | but maybe we can weaken the .compileTime var restrictions later. The problem is IC. |
10:04:01 | FromGitter | <gogolxdong> https://github.com/shiyanhui/libcsp |
10:06:57 | FromGitter | <gogolxdong> What's the difference between this and Nim Channel? |
10:08:15 | Araq | hard to say. libcsp looks very interesting but uses a GCC plugin, so it seems to be GCC specific |
10:08:57 | Araq | also, I have a much better channel implementation in the pipeline, based on mratsim's works |
10:10:12 | FromDiscord | <ElegantBeef> Remember when it's done you have to market it with `Some percentage faster than Golang` |
10:12:03 | Araq | *shrug* the example code isn't convincing either, so you only have to replace return values with address-of pointer passing style |
10:12:19 | Araq | manual human compiler at work |
10:12:59 | Araq | but then that's C. everything is "simple" (never read the C spec though), bug-prone and not portable (only runs on Unix) |
10:13:36 | Oddmonger | interesting, is CacheCounter a sort of template for avoiding the big guns of AST macros ? |
10:14:31 | Araq | Oddmonger, it is support code for AST macros |
10:15:01 | Araq | designed so that works with upcoming IC, based on a theory of computation of a name that I forgot |
10:15:32 | Oddmonger | ouch… ok i will just note the snippet you gave above |
10:16:01 | FromDiscord | <ElegantBeef> I still need to look at it to see if it can fix my forcing any nimscripter registered nimscript procs to be registered in modules before creation of an intepreter |
10:16:18 | FromDiscord | <ElegantBeef> Basically i need a "late bind" const for the vm table |
10:18:14 | FromGitter | <HJarausch_gitlab> Sorry, I need some more help. ⏎ Given ⏎ ⏎ ```code paste, see link``` ⏎ ... [https://gitter.im/nim-lang/Nim?at=5ff2eb66ac9d8e7463ec91de] |
10:25:49 | FromDiscord | <dk> I think you need to capture the compile-time var into a const, like this https://play.nim-lang.org/#ix=2KOb |
10:25:52 | FromDiscord | <dk> it sucks |
10:30:41 | FromDiscord | <Firefell> Everything can run Doom. If you want to make your techno known you make a demo of Doom 🙂 |
10:30:49 | FromDiscord | <fwsgonzo> i wonder if there is a bug in Zippy |
10:31:01 | FromDiscord | <fwsgonzo> on RISC-V most signed operations cause sign-extension of the register |
10:31:57 | FromDiscord | <fwsgonzo> there is an assumption in there that value SHR (32 - hash) is not containing bits in the upper half, but it will pull down sign-bits with it |
10:32:39 | FromDiscord | <fwsgonzo> > Hash: 0xFFFF6079↵so if you shr 16, it will look like the above |
10:35:30 | Araq | don't make get started on RISC-V |
10:35:35 | Araq | *make me |
10:36:38 | FromDiscord | <fwsgonzo> im having trouble following the code because of templates, but I dont know whos at fault here |
10:37:23 | FromDiscord | <fwsgonzo> if it outputs the srai instruction for the operation above, then you can be sure its wrong |
10:37:36 | FromDiscord | <fwsgonzo> should be srli |
10:38:14 | Araq | but then maybe srli is a Vendor specific instruction, who knows if bit shifts are RISCy enough |
10:38:21 | FromDiscord | <fwsgonzo> sent a code paste, see https://paste.rs/r8G |
10:38:51 | FromDiscord | <fwsgonzo> no SRAI, SRLI are RV32I and RV64I, so base instructions |
10:49:05 | Araq | to answer your question, yes |
10:49:20 | Araq | it might be why things go wrong |
10:55:07 | Araq | https://workchronicles.com/annual-planning/ |
11:20:34 | FromDiscord | <fwsgonzo> zippy is implemented mostly using signed operations, so it's a bit hard to find out what the solution to all the shift problems are |
11:28:40 | * | JustASlacker joined #nim |
11:29:35 | PMunch | Hmm, is libssl-1_1.dll removed from the dlls shipped with Nim? |
11:30:36 | PMunch | And is there a way to get the collection of DLLs for a specific Nim version? |
11:35:32 | * | Tanger joined #nim |
11:46:15 | * | Tlangir joined #nim |
11:48:58 | * | Tanger quit (Ping timeout: 256 seconds) |
11:58:14 | * | JustASlacker quit (Ping timeout: 264 seconds) |
11:58:54 | * | Tlangir quit (Remote host closed the connection) |
12:07:29 | * | JustASlacker joined #nim |
12:19:16 | FromDiscord | <Clyybber> sent a code paste, see https://play.nim-lang.org/#ix=2KOI |
12:19:42 | FromDiscord | <Clyybber> This is the example from https://github.com/nim-lang/Nim/pull/11992 written with todays nim |
12:19:44 | disbot | ➥ every symbol becomes 1st class; defines 0-cost lambda and aliases; inline iterators/templates/etc can be passed to any routine ; snippet at 12https://play.nim-lang.org/#ix=250A |
12:20:54 | FromDiscord | <Clyybber> it shows the same performance improvement; but it turns out that performance difference is only so big because this example and timothees example don't use system.cmp, but instead cheat (this example by doing `a - b` and timothee by just doing `a < b`) |
12:21:05 | * | PMunch quit (Ping timeout: 265 seconds) |
12:25:43 | FromDiscord | <Clyybber> (Somehow the bridge converts to some unicode dot, so heres a better link https://play.nim-lang.org/#ix=2KOL ) |
12:30:56 | FromDiscord | <Clyybber> the ~1.5 to 2x performance improvement (on my machine) only shows up once compiling with release or danger |
12:32:09 | FromDiscord | <Clyybber> if you change it to use the same "cheat" as timothees example, mainly using `a < b` instead of `a - b` you will also get the "3X to 4X speedup" from the PR |
12:32:47 | FromDiscord | <Clyybber> (when using danger, because one difference between timothees approach which uses a template and this approach using an inline proc is stacktraces) |
12:32:55 | * | PMunch joined #nim |
12:48:02 | * | JustASlacker quit (Ping timeout: 264 seconds) |
12:58:30 | * | abm quit (Quit: Leaving) |
13:01:52 | * | ehmry quit (Read error: Connection reset by peer) |
13:06:40 | * | JustASlacker joined #nim |
13:14:39 | * | ehmry joined #nim |
13:26:03 | * | PMunch quit (Ping timeout: 260 seconds) |
13:38:54 | * | PMunch joined #nim |
13:45:14 | * | lritter joined #nim |
13:49:22 | * | JustASlacker quit (Ping timeout: 260 seconds) |
13:51:46 | ForumUpdaterBot | New thread by Alexeypetrushin: Why include doesn't work?, see https://forum.nim-lang.org/t/7331 |
13:52:20 | FromGitter | <gogolxdong> It seems that there is some wrong in gc.rst line 24, ``` ⏎ /mnt/c/Nim/doc/gc.rst(24, 12) Error: invalid directive: 'note' ⏎ lineinfos.nim(246) raiseRecoverableError ⏎ Error: unhandled exception: invalid directive: 'note' [ERecoverableError] ⏎ ... [https://gitter.im/nim-lang/Nim?at=5ff31d93de60814315601b2b] |
14:05:41 | * | xet7 quit (Quit: Leaving) |
14:08:10 | * | xet7 joined #nim |
14:13:50 | * | NimBot joined #nim |
14:15:06 | * | adnan338 joined #nim |
14:16:43 | * | sknebel_ is now known as sknebel |
14:18:10 | Araq | https://github.com/nim-lang/RFCs/issues/310 |
14:18:15 | disbot | ➥ Fusion and stdlib evolution ; snippet at 12https://play.nim-lang.org/#ix=2KPk |
14:21:49 | ForumUpdaterBot | New thread by Araq: Stdlib and fusion evolution, see https://forum.nim-lang.org/t/7332 |
14:27:25 | * | tiorock joined #nim |
14:27:25 | * | tiorock quit (Changing host) |
14:27:25 | * | tiorock joined #nim |
14:27:25 | * | rockcavera is now known as Guest92052 |
14:27:26 | * | Guest92052 quit (Killed (tepper.freenode.net (Nickname regained by services))) |
14:27:26 | * | tiorock is now known as rockcavera |
14:29:00 | * | tiorock joined #nim |
14:29:00 | * | tiorock quit (Changing host) |
14:29:00 | * | tiorock joined #nim |
14:29:00 | * | rockcavera quit (Killed (orwell.freenode.net (Nickname regained by services))) |
14:29:00 | * | tiorock is now known as rockcavera |
14:29:09 | FromDiscord | <lqdev> @mratsim is it possible to multithread parsing in some fairly efficient way? |
14:29:20 | FromDiscord | <lqdev> what i have is essentially just parsing lines |
14:29:27 | FromDiscord | <lqdev> every line has the same syntax |
14:29:48 | FromDiscord | <lqdev> but running a new task for every line seems a bit wasteful |
14:30:26 | Araq | it was covered in dom's book iirc |
14:30:34 | Araq | you need some slicing buffer for that |
14:31:16 | FromDiscord | <lqdev> so essentially i'd assign a few lines to a single task, and run them in parallel? |
14:31:31 | FromDiscord | <lqdev> idk what you mean by slicing buffer |
14:32:43 | Araq | essentially yes, but "lines" is not the ideal work unit |
14:33:20 | Araq | instead use 16KB blocks or similar. if you need precise line endings, ensure to split the blocks on line endings (little forward/backward search) |
14:33:35 | FromDiscord | <lqdev> ah so just what i was thinking about |
14:33:54 | FromDiscord | <lqdev> thanks for the tip |
14:34:13 | FromDiscord | <fwsgonzo> is there a way to make nim functions weak? |
14:34:20 | FromDiscord | <fwsgonzo> and provide a default do-nothing implementation |
14:35:10 | Araq | yes, but you need a .codegenDecl for that, I'm afraid |
14:35:14 | FromDiscord | <fwsgonzo> and how do you call a mangled nim function with the same name as a C function? |
14:35:42 | Araq | never use the "same" name, linkers hate that |
14:36:00 | Araq | instead pick a name via .exportc: "my_awesome_name" |
14:36:24 | FromDiscord | <fwsgonzo> well I only have to do this because `disinct int` arguments dont boil down to registers |
14:36:28 | FromDiscord | <fwsgonzo> (edit) "`disinct" => "`distinct" |
14:36:52 | FromDiscord | <fwsgonzo> so I have to create entry C functions that call the nim functions with |
14:36:59 | FromDiscord | <fwsgonzo> (edit) removed "with" |
14:38:29 | Araq | they do boil down to "registers", a 'distinct' has no overhead |
14:38:45 | FromDiscord | <fwsgonzo> hmm |
14:39:09 | Araq | the C code generator strips away the 'distinct', nothing more, nothing less |
14:43:38 | * | ex_nihilo_ joined #nim |
14:45:29 | FromDiscord | <KallDrexx> Hi all, Nim newbie here. FYI I signed up on the nim forum and I"m stuck at "EmailUnconfirmed". I never got an email (address looks right) and no way to re-trigger one that I can see |
14:45:42 | * | njoseph quit (Ping timeout: 260 seconds) |
14:46:17 | * | ex_nihilo quit (Ping timeout: 260 seconds) |
14:46:17 | * | gangstacat quit (Ping timeout: 260 seconds) |
14:46:34 | * | njoseph joined #nim |
14:47:26 | * | gangstacat joined #nim |
14:52:25 | narimiran | @KallDrexx what's your forum username? |
14:52:45 | FromDiscord | <KallDrexx> KallDrexx |
14:53:04 | narimiran | here you go, now you're a user |
14:53:12 | FromDiscord | <KallDrexx> Thanks 🙂 |
14:53:53 | FromDiscord | <KallDrexx> Probably a dumb question, is there a reason the compiler doesn't warn when you write a proc that has a non-void return type and no implicit and explicit result values being set/returned? |
14:54:50 | narimiran | yes :) |
14:55:54 | * | waleee-cl joined #nim |
14:56:25 | narimiran | should the compiler warn you if you had your proc written something like `if condition: return 7` (without else branch) |
14:58:28 | FromDiscord | <KallDrexx> I'm curious why not. My gut says "yes it should" but that's mostly because I'm used to compilers that would consider that a compilation error (I don't have a strong reason outside a personal tendancy towards explicitness) |
14:58:47 | mipri | you mean someone unexpectedly using the result variable? there are other ways to do that. and getting a warning when you're intentionally using result in the else case would be pretty annoying. |
14:59:17 | FromDiscord | <KallDrexx> No, I mean something like `proc test(): int= echo "hi"` |
14:59:37 | mipri | you mean someone unexpectedly using the result variable? there are other ways to do that. and getting a warning when you're intentionally using result in the else case would be pretty annoying. |
14:59:49 | FromDiscord | <KallDrexx> i.e. that will always return zero, and in more complex scenarios I'd imagine it's accidental rather than on purpose |
15:00:39 | mipri | I've had more complex scenarios, yep, like some complex logic in a case over a discriminated union and unexpectedly missing one of the control paths |
15:02:00 | * | vsantana joined #nim |
15:02:59 | mipri | this is just something to learn, though. |
15:03:22 | FromDiscord | <KallDrexx> Yeah it's not a show-stopper for me, it was just an idle curiosity I noticed when I was playing around yesterday |
15:04:14 | PMunch | Probably it's mostly because it's a hard error to catch |
15:04:57 | PMunch | Nim creates a special result variable you can assign things to and it is implicitly returned at the end of the proc |
15:05:27 | PMunch | So it that way Nim always will return something, whether you change the result variable in a branch or not is up to you |
15:06:09 | FromDiscord | <haxscramper> Analyzing CFG to determine if `result` is assessed in all branches, or `return` is reached on all paths? |
15:06:43 | FromDiscord | <haxscramper> (edit) "assessed" => "accessed" |
15:06:47 | PMunch | I mean it's not impossible |
15:06:53 | FromDiscord | <Rika> i think its more of seeing if result/return is ever used |
15:07:00 | mipri | but it makes a warning out of deliberate uses of the feature |
15:07:04 | FromDiscord | <Rika> if not, warn |
15:07:07 | FromDiscord | <haxscramper> No, I mean it is possible and IIUC not that difficult |
15:07:25 | PMunch | But e.g. is `if something: result = 100` an error because result isn't assigned to in all branches? |
15:07:38 | mipri | and it makes a warning out of deliberate uses of the feature on behalf of people who don't know the language. |
15:07:38 | FromDiscord | <Rika> i dont think thats what they mena |
15:07:39 | FromDiscord | <Rika> mean |
15:08:03 | FromDiscord | <haxscramper> PMunch: if this is the only statement you have in loop than sure |
15:08:12 | FromDiscord | <Rika> i think they mean more of no branches using return/result instead of not all |
15:08:14 | mipri | if someone stylistically avoids result maybe they can have a {.push: errorOnResult.} or some linting that warns them and only them about it |
15:08:18 | FromDiscord | <haxscramper> I mean we already have `ProvInit` on result or something similar |
15:08:35 | FromDiscord | <haxscramper> mipri: and we are talking about warnings, not errors |
15:08:48 | mipri | and it makes a warning out of deliberate uses of the feature on behalf of people who don't know the language. |
15:08:49 | PMunch | But I agree, it would be nice to have a warning if result and return was never used in a proc |
15:08:54 | PMunch | That probably is an error |
15:09:16 | FromDiscord | <haxscramper> Of course making this a hard error is useless, but I suppose if people have return type |
15:09:17 | FromDiscord | <KallDrexx> Well it would also have to make sure the last statement doesn't return the same type of the proc type |
15:09:34 | FromDiscord | <haxscramper> They want to return something more often than avoid returning? |
15:09:54 | FromDiscord | <haxscramper> This is a common use case |
15:10:20 | FromDiscord | <haxscramper> E.g. `func nice(a: int): int = a + 999` |
15:10:36 | FromDiscord | <KallDrexx> Well I mean that's a 3rd criteria that PMunch would have to consider as well |
15:11:09 | PMunch | Oh yeah, of course |
15:11:29 | FromDiscord | <KallDrexx> mipri: I'm genuinely curious, what is a deliberate use of that feature |
15:11:46 | FromDiscord | <haxscramper> IIRC it is implicitly rewritten into `result = a + 999` |
15:12:29 | FromDiscord | <haxscramper> https://play.nim-lang.org/#ix=2KQ1 |
15:12:50 | FromDiscord | <KallDrexx> @haxscramper huh neat |
15:14:56 | FromDiscord | <KallDrexx> I guess another question I have is how feasible is it to write a library in Nim that can be used in other languages via FFI. I noticed that other languages can use FFI to call nim code, but they must always call `NimMain()` (for garbage collection reasons as far as I can tell), and they have to call that before any of the library code. How bothersome does this get (in practice) when I want someone to be able to easily consume my libra |
15:17:05 | * | PMunch quit (Quit: leaving) |
15:21:53 | FromDiscord | <exelotl> If you use arc does it become no longer necessary? |
15:26:21 | FromDiscord | <KallDrexx> I had wondered that too, I think the nim in action and the backend docs were written before Arc/orc. |
15:30:13 | * | lritter quit (Ping timeout: 246 seconds) |
15:43:25 | * | lritter joined #nim |
15:46:36 | FromDiscord | <fwsgonzo> is it possible to declare a function and not have to implement it? |
15:47:47 | * | filcuc joined #nim |
15:48:20 | FromDiscord | <Rika> depends on what you mean by declare |
15:49:08 | * | JustASlacker joined #nim |
15:49:42 | FromDiscord | <fwsgonzo> sent a code paste, see https://play.nim-lang.org/#ix=2KQk |
15:49:53 | FromDiscord | <fwsgonzo> i dont want to have to implement it - theres a giant list of optional entry functions |
15:51:12 | * | adnan338 quit (Quit: adnan338) |
16:00:32 | * | nyaa8 quit (Quit: byeee~) |
16:02:02 | Araq | NimMain isn't required for ARC/ORC anymore, that's true. |
16:02:10 | * | nyaa8 joined #nim |
16:02:17 | Araq | however NimMain can also run other init-related code |
16:02:44 | Araq | don't use globals and you're pretty safe and don't need NimMain |
16:03:05 | * | hnOsmium0001 joined #nim |
16:09:16 | FromDiscord | <bark> does anyone know of a good alternative to the runner VSCode extension (one that works on VsCodium?) |
16:11:50 | FromDiscord | <lqdev> can't you just load the vsix into vscodium? |
16:13:27 | * | gangstacat quit (Ping timeout: 260 seconds) |
16:13:55 | * | gangstacat joined #nim |
16:19:34 | FromDiscord | <bark> I just did |
16:26:33 | * | JustASlacker quit (Ping timeout: 258 seconds) |
17:05:12 | FromDiscord | <haxscramper> Araq: on the topic of std/os2 etc - I sort-of have it already implemented in a way that I mentioned in RFC comment |
17:05:13 | FromDiscord | <haxscramper> https://github.com/haxscramper/hmisc/blob/master/src/hmisc/other/oswrap.nim |
17:06:22 | FromDiscord | <haxscramper> It does use some boilerplate and involves a lot of copying from stdlib, but in general excends idea of `compiler/pathutils` |
17:07:07 | FromDiscord | <haxscramper> Does it look like something you had in mind when you mentioned "more type safety in the form of ..."? |
17:07:11 | * | kungtotte quit (Quit: ZNC - https://znc.in) |
17:13:49 | disruptek | hearts and minds, people; hearts and minds! |
17:13:52 | * | filcuc quit (Ping timeout: 260 seconds) |
17:15:09 | * | filcuc joined #nim |
17:17:43 | FromDiscord | <haxscramper> ``type `int*******` = ptr ptr ptr ptr ptr ptr ptr int`` |
17:21:34 | FromDiscord | <bark> `type \`int\` = ptr int` |
17:21:48 | FromDiscord | <bark> uh how do i put backticks in code blocks again |
17:22:03 | FromDiscord | <haxscramper> double backticks |
17:22:19 | FromDiscord | <haxscramper> Double backticks to surround code block |
17:22:20 | FromDiscord | <bark> (edit) "\`int\`" => "``int``" |
17:22:39 | FromDiscord | <bark> (edit) "`type ``int``" => "``type `int`" | "int`" => "int``" |
17:22:50 | FromDiscord | <bark> thanks |
17:23:24 | FromDiscord | <bark> ``type `int` = ptr `int` `` |
17:23:54 | * | tane joined #nim |
17:24:02 | FromDiscord | <bark> what if a macro could recursively define the first 50 for different levels of ptr |
17:29:49 | FromDiscord | <Filipe Duarte> Nim is growing!!! https://tjpalmer.github.io/languish/ |
17:35:45 | * | ex_nihilo_ quit (Quit: Leaving) |
17:40:31 | * | abm joined #nim |
17:42:54 | FromDiscord | <ache of head> tex is above us… |
17:43:13 | FromDiscord | <Rika> not surprising |
17:47:47 | FromDiscord | <haxscramper> https://github.com/collections/programming-languages |
17:48:00 | FromDiscord | <haxscramper> This one looks better |
17:48:23 | FromDiscord | <haxscramper> At least in terms of above/below |
17:48:35 | FromDiscord | <Filipe Duarte> https://media.discordapp.net/attachments/371759389889003532/795710276309221416/image.png |
17:50:07 | FromDiscord | <fwsgonzo> is it possible to overload [] for a distinct int? |
17:50:17 | Zevv | yes |
17:50:21 | FromDiscord | <Filipe Duarte> Stars https://media.discordapp.net/attachments/371759389889003532/795710721861353501/image.png |
17:51:18 | FromDiscord | <Filipe Duarte> Upper trend |
17:52:04 | FromDiscord | <Filipe Duarte> (edit) "Upper" => "Upperward" |
17:59:11 | FromDiscord | <Filipe Duarte> In this one too https://media.discordapp.net/attachments/371759389889003532/795712943459139664/image.png |
17:59:27 | FromDiscord | <Filipe Duarte> https://madnight.github.io/githut/#/stars/2020/4 |
18:01:32 | * | tiorock joined #nim |
18:01:32 | * | tiorock quit (Changing host) |
18:01:32 | * | tiorock joined #nim |
18:01:32 | * | rockcavera quit (Killed (barjavel.freenode.net (Nickname regained by services))) |
18:01:32 | * | tiorock is now known as rockcavera |
18:09:13 | * | lritter quit (Ping timeout: 264 seconds) |
18:31:16 | * | abm quit (Quit: Leaving) |
18:36:53 | * | tiorock joined #nim |
18:37:32 | * | rockcavera quit (Ping timeout: 256 seconds) |
18:37:37 | * | lritter joined #nim |
18:42:11 | Oddmonger | why readFile returns a «TaintedString» ? |
18:42:19 | Oddmonger | and not a string |
18:43:25 | leorize[m] | legacy reasons |
18:43:33 | Oddmonger | maybe because we can load whatever we want with readFile ? |
18:43:33 | leorize[m] | nowadays taintedstring is the same thing as string |
18:43:58 | leorize[m] | the idea was that strings from the outside are dangerous |
18:44:36 | leorize[m] | eventually it evolves into "every string is dangerous" :P |
18:44:42 | Oddmonger | ah ok, didn't knew (i've made some searches and read that «TaintedString» had to be explicitely converted to string, to avoid problems with functions which require strings) |
18:45:12 | Oddmonger | but for me a string containing an arbitrary set of bytes is perfectly valid, that's another story :) |
19:08:03 | * | lritter quit (Ping timeout: 265 seconds) |
19:20:03 | FromGitter | <alehander92> ohh |
19:20:10 | FromGitter | <alehander92> effect system |
19:20:11 | FromGitter | <alehander92> rfc |
19:37:52 | * | krux02 joined #nim |
19:53:43 | * | leorize quit (Ping timeout: 240 seconds) |
19:59:42 | FromGitter | <iffy> Anyone have experience sending/receiving over the network (HTTP or sockets) on iOS with Nim? My attempts hang on `dial`. The server I'm connecting to sees the connection, but not data is sent. |
20:00:37 | * | leorize joined #nim |
20:03:56 | * | leorize quit (Remote host closed the connection) |
20:04:44 | * | leorize joined #nim |
20:08:34 | * | rockcavera joined #nim |
20:09:20 | * | tiorock quit (Ping timeout: 256 seconds) |
20:13:26 | FromGitter | <iffy> nm. I think it's "I'm in the thread without `runForever` going." |
20:21:42 | FromDiscord | <bark> what does it mean if calling alloc0 gives a "SIGSEGV: Illegal storage access. (Attempt to read from nil?)" |
20:22:28 | * | adnan338 joined #nim |
20:22:40 | * | adnan338 quit (Client Quit) |
20:22:51 | * | adnan338 joined #nim |
20:26:27 | FromDiscord | <bark> I have a maximum of 4679 bytes of memory allocated (I've tapped all alloc's to increment a global var), so I don't think I'm running out of memory |
20:29:58 | leorize | what platform are you on? |
20:30:20 | FromDiscord | <bark> linux |
20:30:23 | FromDiscord | <bark> x86-64 |
20:35:15 | leorize | hmm, that shouldn't happen |
20:35:29 | leorize | do you have a reproducible sample? |
20:35:56 | FromDiscord | <bark> the exact alloc call changes if I change details such as gc |
20:36:28 | * | abm joined #nim |
20:36:29 | FromDiscord | <bark> I'll try to reproduce it |
20:37:06 | * | abm quit (Client Quit) |
20:38:46 | FromDiscord | <martinium> What is the simplest way to add cli parameters to a nim cli app |
20:38:58 | leorize | !repo cligen |
20:38:58 | disbot | https://github.com/c-blake/cligen -- 9cligen: 11Nim library to infer/generate command-line-interfaces / option / argument parsing; Docs At 15 243⭐ 17🍴 7& 1 more... |
20:39:01 | leorize | !repo argparse |
20:39:01 | FromDiscord | <lqdev> import std/parseopt |
20:39:01 | disbot | https://github.com/iffy/nim-argparse -- 9nim-argparse: 11Argument parsing for Nim 15 50⭐ 4🍴 7& 1 more... |
20:39:12 | FromDiscord | <lqdev> or that |
20:41:16 | * | filcuc quit (Ping timeout: 240 seconds) |
20:42:20 | FromDiscord | <martinium> Thx |
20:42:52 | FromDiscord | <bark> leorize, I can skip nim's alloc implementation with -d:useMalloc -gc:none right? |
20:43:30 | leorize | bark: that only works if you use arc I think |
20:44:37 | FromDiscord | <bark> well with gc:arc d:useMalloc I get a sigabrt on a dealloc |
20:45:03 | leorize | sounds like your machine is busted |
20:45:45 | leorize | nim never uses abort() in the stdlib so that comes from your libc |
20:46:48 | leorize | probably your heap got corrupted |
20:47:09 | FromDiscord | <bark> uh a pc restart? |
20:47:11 | leorize | or you got a buffer overflow in your program |
20:47:43 | FromDiscord | <bark> the latter is not improbable |
20:48:13 | * | adnan338 quit (Quit: adnan338) |
20:48:19 | FromDiscord | <bark> but why would I get an exception at an alloc call |
20:48:39 | leorize | alloc0 zeros out the memory |
20:49:02 | leorize | so if the heap is corrupted the reference returned might be outside of the program's domain |
20:49:21 | leorize | in that case your os just say no and shut your program down |
20:59:37 | FromDiscord | <bark> i must have goofed some allocation up, it returns a different nil access error on my phone |
20:59:56 | FromDiscord | <fwsgonzo> for the love of god how do you construct an object |
21:00:11 | FromDiscord | <fwsgonzo> there's like 8 ways in C++ and I have yet to find one in Nim |
21:00:34 | mipri | NameOfTheObject() |
21:00:37 | FromDiscord | <fwsgonzo> sent a code paste, see https://play.nim-lang.org/#ix=2KSg |
21:01:20 | mipri | let field = Field(that) |
21:01:31 | FromDiscord | <fwsgonzo> (edit) "https://play.nim-lang.org/#ix=2KSg" => "https://paste.rs/ru7" |
21:01:51 | mipri | what you're doing there is trying to say that `field` has a type named Field(hp = ...), without initializing it |
21:03:11 | leorize | fwsgonzo: it's a bit weird but change `=` -> `:` |
21:03:22 | * | narimiran quit (Ping timeout: 260 seconds) |
21:03:53 | * | PrvDragon quit (Quit: Konversation terminated!) |
21:04:21 | mipri | yeah: let Field = Field(hp: int(r), idx: 1) |
21:05:06 | FromDiscord | <fwsgonzo> somehow that worked 😛 |
21:05:26 | mipri | not 'somehow', that's the syntax. |
21:05:31 | FromDiscord | <fwsgonzo> sent a code paste, see https://play.nim-lang.org/#ix=2KSl |
21:05:38 | FromDiscord | <fwsgonzo> (edit) "https://play.nim-lang.org/#ix=2KSl" => "https://play.nim-lang.org/#ix=2KSm" |
21:05:59 | mipri | return Field(hp: int(r), idx: 1).value |
21:06:24 | FromDiscord | <fwsgonzo> ok thats nicer! |
21:14:12 | FromDiscord | <fwsgonzo> can you declare a global inside a function? ala static |
21:18:41 | leorize | yes, use the `{.global.}` pragma |
21:25:57 | * | disruptek throbs. |
21:27:52 | Prestige | disruptek: I think you might want to get a doctor to check that out |
21:28:30 | disruptek | she's coming later. |
21:28:33 | disruptek | so to speak. |
21:29:19 | Prestige | oh. |
21:29:21 | FromDiscord | <Randall> Are there any macros to help with parsing / setting expectations of the AST in a macro definition? Maybe something like quote but instead of generating an AST it validates that the passed in AST matches? |
21:30:04 | FromDiscord | <Randall> sent a code paste, see https://paste.rs/Zl0 |
21:30:30 | leorize | sounds like macros.expectKind |
21:32:28 | FromDiscord | <Randall> Similar, but not for a single node, but a larger (sub)tree |
21:44:26 | disruptek | !repo ast_pattern_matching |
21:44:27 | disbot | https://github.com/krux02/ast-pattern-matching -- 9ast-pattern-matching: 11A library to do pattern matching on the AST in the Nim programming language. 15 70⭐ 5🍴 7& 1 more... |
21:48:21 | FromDiscord | <Randall> Nice |
21:55:32 | FromDiscord | <lqdev> !repo PMunch/macroutils |
21:55:33 | disbot | https://github.com/PMunch/macroutils -- 9macroutils: 11A package that makes creating macros easier 15 18⭐ 0🍴 |
21:56:28 | disruptek | !repo gara |
21:56:29 | disbot | https://github.com/alehander92/gara -- 9gara: 11 15 87⭐ 6🍴 |
22:00:22 | * | radgeRayden joined #nim |
22:03:15 | * | filcuc joined #nim |
22:13:26 | * | abm joined #nim |
22:20:56 | * | leorize quit (Remote host closed the connection) |
22:21:32 | * | leorize joined #nim |
22:27:04 | FromDiscord | <exelotl> so I'm using stdtmpl and I need to output code that contains a C preprocessor directive, but I'm using # as the meta character |
22:27:21 | FromDiscord | <exelotl> I was able to make it work with //#include |
22:27:37 | FromDiscord | <exelotl> but wondering if there's a nicer way xD |
22:28:03 | FromDiscord | <exelotl> I tried ;#include but it doesn't like that |
22:30:13 | FromDiscord | <exelotl> I guess I could do like↵${"""#include "foo.h" """} |
22:36:46 | * | Vladar quit (Quit: Leaving) |
22:47:50 | reversem3 | How do you find the type of something in nim ? |
22:48:25 | reversem3 | like a string or int or float |
22:49:15 | leorize | `typeof(symbol)` |
22:49:33 | reversem3 | thanks |
22:59:10 | FromGitter | <awr1> hello |
23:04:20 | * | tane quit (Quit: Leaving) |
23:07:19 | FromDiscord | <no name fits> sent a code paste, see https://play.nim-lang.org/#ix=2KTg |
23:09:58 | FromDiscord | <no name fits> Or do I do ``addr``? |
23:10:01 | FromDiscord | <ElegantBeef> `.addr` or `.unsafeaddr` if you want to make it a immutable |
23:13:16 | FromDiscord | <no name fits> sent a code paste, see https://play.nim-lang.org/#ix=2KTj |
23:16:25 | FromDiscord | <ElegantBeef> yep |
23:17:39 | FromDiscord | <no name fits> Cool thanks |
23:18:49 | FromDiscord | <bark> are fist class functions GC'd? |
23:19:09 | FromDiscord | <bark> (edit) "fist" => "first" | "firstclass functions GC'd? ... " added "(meaning, can I put them behind ptr objects?)" |
23:20:18 | FromDiscord | <bark> (edit) "ptr objects?)" => "~~ptr objects?~~ /i meant pointer arithmetic)" |
23:38:02 | * | xet7 quit (Remote host closed the connection) |
23:58:30 | FromDiscord | <jken> What is the proper syntax for this proc signature? `proc get[T](entity: Entity, componentType: typedesc): T =`↵↵ie. a proc that takes a `typedesc` as a parameter and returns an item of that type |