00:03:27 | * | shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
00:21:48 | * | lritter joined #nim |
01:13:41 | FromDiscord | <krab4t> hello here, in c++ i can write `if not ` like: ` if !string.startWith("#")` |
01:14:03 | FromDiscord | <krab4t> nim has something like if !expr ? |
01:18:13 | rayman22201 | It's just the word "not" |
01:18:17 | rayman22201 | like Python |
01:18:49 | rayman22201 | quick example: https://play.nim-lang.org/#ix=1Yi9 |
01:20:01 | FromDiscord | <krab4t> perfect, thanks |
01:21:09 | * | skoude joined #nim |
01:25:17 | * | skoude quit (Ping timeout: 240 seconds) |
01:30:33 | FromDiscord | <Lunar> When compiling a Nim script, is it possible to hide the ``Hints``? |
01:30:56 | FromDiscord | <Lunar> I know the request sounds weird, but I need to compare errors quickly as I'm on a time limit |
01:31:11 | FromDiscord | <Lunar> Time limit between scripts execution, not in general |
01:39:14 | shashlick | See the verbosity flag |
01:51:49 | FromDiscord | <Lunar> Wouldn't the verbosity flag *show* more? I want to show *less* 😂 |
02:02:23 | rockcavera | I was looking at winlean and noticed that the type DWORD is set to int32, but according to microsoft documentation it's a uint32. Why this? |
02:04:41 | rockcavera | so does ULONG |
02:05:34 | * | traviss joined #nim |
02:11:17 | shashlick | Set it to 0 |
02:11:43 | FromDiscord | <krab4t> how you use enums in nim? https://play.nim-lang.org/#ix=1Yif like line 11 |
02:49:07 | * | rockcavera quit (Read error: Connection reset by peer) |
02:49:25 | * | rockcavera joined #nim |
02:49:25 | * | rockcavera quit (Changing host) |
02:49:25 | * | rockcavera joined #nim |
02:49:42 | * | seerix joined #nim |
02:49:48 | * | seerix_ joined #nim |
02:49:56 | * | seerix_ quit (Remote host closed the connection) |
02:51:20 | shashlick | just use $Show |
02:56:49 | * | lritter quit (Ping timeout: 265 seconds) |
02:57:09 | * | lritter joined #nim |
03:22:01 | * | theelous3 joined #nim |
03:33:19 | * | yumaikas is having some speed bumps using karax |
03:34:59 | FromDiscord | <krab4t> if line.startsWith($Visibility.Show): |
03:43:11 | * | chemist69 quit (Ping timeout: 276 seconds) |
03:44:47 | * | chemist69 joined #nim |
03:54:26 | * | rockcavera quit (Read error: Connection reset by peer) |
03:55:07 | * | rockcavera joined #nim |
03:55:07 | * | rockcavera quit (Changing host) |
03:55:07 | * | rockcavera joined #nim |
04:01:12 | * | Traviss__ joined #nim |
04:03:16 | FromGitter | <me7> Hi all, don't quite sure IRC is correct place or not, I just get quicker answer if ask here. Please let me know if here is not a right place |
04:04:05 | FromGitter | <me7> I'm working on https://github.com/nim-lang/Nim/issues/2408 which is 4 years bug that tag as #easy #feature |
04:04:51 | * | traviss quit (Ping timeout: 250 seconds) |
04:04:53 | leorize | irc is always the correct place to ask :) |
04:05:05 | FromGitter | <me7> But I'm not quite sure where to start (e.g. which file to modify to add this feature),could someone give me a clue? |
04:05:44 | FromGitter | <me7> Note: I'm new to nim-lang, bare with me if I ask kinda dump question ;) |
04:07:19 | leorize | https://github.com/nim-lang/Nim/blob/devel/lib/system/dyncalls.nim#L77 |
04:07:22 | leorize | here you go :P |
04:07:32 | leorize | it's literally mentioned in the issue you linked |
04:12:30 | * | laaron joined #nim |
04:13:07 | * | radsoc joined #nim |
04:15:59 | * | rockcavera quit (Remote host closed the connection) |
04:17:48 | FromDiscord | <Rika> does nim have something for partial functions or do i make my own macro lmao |
04:26:02 | * | dddddd quit (Ping timeout: 240 seconds) |
04:27:27 | leorize | @Rika: make a closure :P |
04:27:46 | leorize | the sugar module got some sugar for that |
04:29:10 | * | dddddd joined #nim |
04:31:31 | * | nsf joined #nim |
04:41:05 | FromGitter | <gogolxdong> How to echo a JsObject type variable? |
04:41:47 | FromGitter | <me7> @leorize thank you |
04:41:55 | leorize | @gogolxdong use console.log() on it |
04:42:00 | FromDiscord | <treeform> rockcavera, I also noticed winlean using signed and unsigned oddly. I think it due to the fact that C just auto converts types that are similar enough while Nim is more strict. |
04:51:02 | FromGitter | <gogolxdong> aha,forget about that. thanks |
04:52:41 | * | laaron quit (Quit: ZNC 1.7.4 - https://znc.in) |
04:54:09 | * | laaron joined #nim |
04:55:04 | * | radsoc quit (Quit: radsoc) |
04:55:06 | * | laaron quit (Client Quit) |
04:55:24 | * | laaron joined #nim |
04:56:11 | FromDiscord | <Rika> closures are so eeeeeeeeeeeeeee tho |
04:56:24 | FromDiscord | <Rika> okay whatever i will |
04:59:21 | * | laaron quit (Client Quit) |
04:59:40 | * | laaron joined #nim |
04:59:50 | * | laaron quit (Remote host closed the connection) |
05:00:56 | * | radsoc joined #nim |
05:28:09 | * | Traviss__ quit (Quit: Leaving) |
05:28:31 | * | traviss joined #nim |
05:30:23 | * | laaron joined #nim |
05:32:42 | * | actuallybatman left #nim (#nim) |
05:35:14 | * | laaron quit (Client Quit) |
05:35:15 | * | narimiran joined #nim |
05:36:44 | * | dddddd quit (Remote host closed the connection) |
05:45:18 | * | radsoc quit (Quit: radsoc) |
05:47:47 | * | ldlework_ joined #nim |
05:48:59 | * | federico3_ joined #nim |
05:49:51 | * | deepend_ joined #nim |
05:50:09 | * | jmiven_ joined #nim |
05:50:27 | * | nixfreak_ joined #nim |
05:51:23 | * | Ekho- joined #nim |
05:53:49 | leorize | @Rika what's wrong with closures? |
05:54:35 | * | ldlework quit (Quit: co'o ro do) |
05:54:35 | * | deepend quit (Remote host closed the connection) |
05:54:35 | * | Ekho quit (Remote host closed the connection) |
05:54:35 | * | federico3 quit (Remote host closed the connection) |
05:54:35 | * | jmiven quit (Ping timeout: 245 seconds) |
05:54:35 | * | nixfreak quit (Ping timeout: 245 seconds) |
05:54:35 | * | Amun_Ra quit (Ping timeout: 245 seconds) |
05:54:35 | * | tribly quit (Ping timeout: 245 seconds) |
05:55:13 | * | Amun_Ra_ joined #nim |
05:55:14 | * | tribly joined #nim |
05:55:15 | * | deepend_ is now known as deepend |
06:01:15 | FromGitter | <mratsim> The only way to do currying is via closures, even if you have a curry macro it will have to create closures (even in a functional language) |
06:04:07 | * | Amun_Ra_ is now known as Amun_Ra |
06:11:45 | * | radsoc joined #nim |
06:12:41 | * | mal`` quit (Ping timeout: 276 seconds) |
06:13:46 | * | mal`` joined #nim |
06:14:22 | * | radsoc quit (Client Quit) |
06:38:26 | * | deepend quit (Quit: o/) |
06:38:52 | * | deepend joined #nim |
06:39:11 | FromDiscord | <krab4t> well i have to admit nim is cool language https://play.nim-lang.org/#ix=1Yiz basically got all unique tokens in file in 5-10 code lines |
06:40:51 | FromDiscord | <krab4t> ` var map = newSeq[string]() ` this is basically std::list (c++)? |
06:51:59 | * | PMunch joined #nim |
06:53:09 | * | LargeEpsilon joined #nim |
06:55:54 | * | solitudesf joined #nim |
07:00:00 | * | gmpreussner quit (Quit: kthxbye) |
07:03:03 | * | skoude joined #nim |
07:04:51 | * | gmpreussner joined #nim |
07:09:11 | FromGitter | <alehander42> Zevv, so how fast can your parser parse |
07:09:12 | FromGitter | <alehander42> 2 mb json |
07:10:24 | FromGitter | <alehander42> 12 mb |
07:11:26 | * | thomasross quit (Ping timeout: 268 seconds) |
07:11:28 | * | krux02 joined #nim |
07:14:05 | * | thomasross joined #nim |
07:14:35 | PMunch | alehander42, he cited 0.4Gb/s earlier, so I guess ~30ms |
07:15:04 | PMunch | Bit depending on latency vs. throughput though of course |
07:15:12 | PMunch | Not sure how that figure scales |
07:21:00 | Zevv | alehander42: indeed, my current test does about 400Mb sec, but depends on the corpus of course |
07:26:40 | * | gangstacat quit (Quit: Ĝis!) |
07:27:53 | * | gangstacat joined #nim |
07:28:30 | * | couven92 joined #nim |
07:30:17 | * | minierolls quit (Ping timeout: 240 seconds) |
07:36:02 | * | solitudesf quit (Ping timeout: 240 seconds) |
07:36:20 | * | solitudesf joined #nim |
07:37:04 | FromGitter | <alehander42> hmmm |
07:37:06 | FromGitter | <alehander42> interesting |
07:37:31 | FromGitter | <alehander42> i found out i have a lot of unneeded stuff: all my objects have the same keys, so i can just use arrays for repr |
07:37:41 | FromGitter | <alehander42> but my previous run was like 12 seconds |
07:37:43 | FromGitter | <alehander42> very strange |
07:37:49 | FromGitter | <alehander42> (not with stdlib tho) |
07:37:52 | * | Trustable joined #nim |
07:40:53 | PMunch | Hmm, why are these consts and not an enum? https://nim-lang.org/docs/httpcore.html#10 |
07:42:04 | FromGitter | <alehander42> http://irclogs.nim-lang.org/19-09-2016.html#19:48:27 |
07:42:10 | FromGitter | <alehander42> its in the comments :O |
07:42:17 | Zevv | it seems the httpcode allows for everything from 0 to 599, but only a numer are actually defined |
07:45:31 | PMunch | Yeah I get that it accepts a whole range, there are custom codes after all. But why are the constants not an enum? |
07:45:46 | PMunch | With the number set to the correct value |
07:46:25 | PMunch | For example: 527 Railgun Error |
07:48:26 | * | solitudesf quit (Ping timeout: 240 seconds) |
07:54:20 | FromDiscord | <Kiloneie> Finally internet D:. i got unplugged for a day, stone age. |
07:56:07 | Zevv | dude, read a book :) |
07:57:16 | * | ng0 joined #nim |
08:00:27 | * | navinmistry joined #nim |
08:03:57 | * | alexander92 joined #nim |
08:04:55 | * | skoude quit (Ping timeout: 250 seconds) |
08:06:04 | leorize | PMunch: because you don't need a yet another http code type? |
08:06:24 | * | navinmistry quit (Remote host closed the connection) |
08:06:30 | alexander92 | hm, what are you going to do with comments |
08:07:26 | PMunch | leorize, but then you could enumerate the known codes.. |
08:07:31 | PMunch | Which is now impossible |
08:07:48 | PMunch | alexander92, not sure yet.. |
08:08:34 | PMunch | I was thinking that I could simply check if the first node immediately after a doc-comment was a return statement I would take that. But that doesn't work through templates |
08:09:05 | alexander92 | but why do you need to check that |
08:09:15 | alexander92 | it can be result or if with ret |
08:10:36 | FromDiscord | <Kiloneie> i don't have many books, and i prefer my topics, not some weird ass ancient reads we got in our house D: |
08:10:54 | PMunch | Kiloneie, get an e-reader :) |
08:11:15 | PMunch | alexander92, I mean to grab the doc-comment |
08:11:25 | PMunch | If it is on the same line as a statement it will be added to a hidden variable |
08:11:31 | PMunch | So it needs to be on a separate line |
08:12:12 | PMunch | But that means that I need some way of knowing what it is meant to document |
08:13:09 | PMunch | But I guess for this I could just force the return type, and then create some macro for returning errors. |
08:13:16 | * | asymptotically joined #nim |
08:13:35 | PMunch | Hmm, why is an exceptions name a cstring, but the message a string? |
08:15:19 | Araq | faster code |
08:15:58 | Araq | PMunch: IMHO your e(value, "comment here") is really nice |
08:17:29 | PMunch | I don't like it because it's not obvious that the string is a comment that will only go in the documentation and not something that will be present in the code.. |
08:18:03 | Araq | it's obvious to anybody who actually read your 'e' thing |
08:20:42 | alexander92 | its a bit like the _ in translation |
08:20:43 | alexander92 | libs |
08:20:52 | alexander92 | btw json decoding is *slow* |
08:20:54 | alexander92 | for my file |
08:21:02 | alexander92 | like, 0.2 seconds with ruby |
08:21:29 | alexander92 | and ~1-2 seconds with stdlib json, 4 if i add `to`, 0.9 seconds with json-serialization |
08:21:53 | alexander92 | i'll try packedjson now, and the zevv json |
08:21:56 | * | ng0 quit (Ping timeout: 260 seconds) |
08:22:16 | alexander92 | maybe my data structure is just not good for nim |
08:22:31 | alexander92 | as i have seq[Table[string, seq[seq[array[2, int]]]]] |
08:22:35 | alexander92 | maybe it leads to many allocations |
08:23:46 | leorize | that data structure is not good for probably anything :P |
08:24:24 | * | ng0 joined #nim |
08:25:01 | PMunch | Araq, yes, but all code is obvious to the person writing it |
08:25:44 | PMunch | I'm not concerned about people reading the documentation for explanations and using it, I'm concerned about the person looking at the code later and not understanding what's going on. |
08:26:09 | FromDiscord | <djazz> I want to write a program using GStreamer, but converting Gst, Glib etc to nim seems like a pain (tried c2nim and nimgen) |
08:26:29 | FromDiscord | <djazz> found Gintro, but it doesnt have Gst bindings |
08:26:58 | leorize | don't use gstreamer, please |
08:27:05 | leorize | use ffmpeg |
08:27:13 | leorize | gstreamer is a heap of security bugs |
08:28:08 | FromDiscord | <djazz> I wanna make something like Snowmix (headless video mixer) with Nim |
08:28:47 | FromDiscord | <djazz> I love ffmpeg on the command line, but I dread its api |
08:29:31 | alexander92 | ok never mind me i am guilty sorry |
08:29:38 | alexander92 | all the json-s are fast |
08:29:41 | alexander92 | i forgot -d:danger |
08:29:53 | * | navinmistry joined #nim |
08:30:02 | leorize | just annotate the slow code path with {.checks: off.} |
08:30:15 | leorize | after you are sure that it won't explode ofc |
08:30:43 | * | kungtotte quit (Quit: WeeChat 2.6) |
08:31:37 | * | kungtotte joined #nim |
08:31:41 | leorize | @djazz: well if gstreamer supports gintrospection, then you can modify gintro generator to generate for that also |
08:32:26 | alexander92 | good suggestion |
08:32:32 | alexander92 | but the problem is the lib i use from those 3 |
08:32:41 | alexander92 | errors with -d:release on my file |
08:32:50 | alexander92 | but works fine with default options |
08:32:52 | alexander92 | strange |
08:37:52 | * | narimiran quit (Remote host closed the connection) |
08:38:45 | * | narimiran joined #nim |
08:44:15 | * | navinmistry quit (Remote host closed the connection) |
08:47:03 | PMunch | Hmm, what would be the best way to get a static number from a type? Namely I have exceptions like Http404Exception which is inherits from HttpException. Now I want to get the error code from a `except HttpException as e` context. |
08:47:30 | * | LargeEpsilon_ joined #nim |
08:48:20 | * | navinmistry joined #nim |
08:50:10 | leorize | maybe you should not have exceptions like that... |
08:50:48 | leorize | add a field in HttpException that stores the response code |
08:51:00 | * | LargeEpsilon quit (Ping timeout: 246 seconds) |
08:51:41 | * | shomodj joined #nim |
08:51:50 | PMunch | Problem is I want to track which exceptions can be raised with the effects system |
08:52:07 | PMunch | So I need them to be separate exceptions |
08:52:46 | alexander92 | well |
08:52:53 | PMunch | And I don't want to add a code field to the HttpException and set that. Because then you could create a Http404Exception with a code set to 500 |
08:52:54 | alexander92 | you can still get a field |
08:53:19 | alexander92 | but can you have a custom message |
08:53:28 | alexander92 | otherwise just dont expose the tyupes |
08:53:33 | alexander92 | create singletons |
08:53:34 | PMunch | I want this to only be a compile-time thing |
08:53:40 | PMunch | What do you mean |
08:53:53 | leorize | PMunch: well, if you must, since they are inherited, the `of` operator should work |
08:53:54 | alexander92 | ah |
08:54:01 | alexander92 | well, of is runtime |
08:54:20 | alexander92 | but you cant possibly get the error code from except HttpException |
08:54:25 | leorize | he wants to catch it from the `except as` context |
08:54:25 | alexander92 | at compile time |
08:54:33 | alexander92 | not really |
08:54:41 | PMunch | Hmm, I guess the resolution of inheritance will always be runtime.. |
08:54:51 | PMunch | Yeah |
08:55:18 | alexander92 | well, think about it |
08:55:28 | alexander92 | you want to show which exceptons are handled |
08:56:21 | alexander92 | in this case imo the user has to use except Http404Exception |
08:56:26 | alexander92 | to handle that etc |
08:57:15 | PMunch | Well I want the routes to know which exceptions it can throw, but then have the router just catch all and transform them into the correct error. |
08:58:44 | * | theelous3 quit (Ping timeout: 268 seconds) |
09:00:32 | alexander92 | well, then the |
09:00:36 | alexander92 | functions that it calls |
09:00:46 | alexander92 | must raise only certain exceptions |
09:01:28 | alexander92 | i get it |
09:01:35 | leorize | is exception really the way to go? |
09:01:37 | alexander92 | so you want to access inferred effects |
09:01:41 | alexander92 | in your macro |
09:01:45 | alexander92 | i doubt this is possible |
09:01:53 | alexander92 | i think effect tracking is in the end of sem checking |
09:02:28 | alexander92 | interesting, i was looking at the zig making of doc generator |
09:02:39 | alexander92 | and they had also some kind of error inference thing |
09:02:46 | alexander92 | you might want to check it out for comparing |
09:03:02 | FromDiscord | <djazz> is it possible to get the output of a command during compile-time? |
09:03:10 | PMunch | Hmm wait, you can't get effects in a macro? |
09:03:21 | alexander92 | https://twitter.com/andy_kelley/status/1181683871894704133 |
09:03:27 | leorize | @djazz: staticExec |
09:03:37 | alexander92 | not saying its good or bad, just relevant |
09:03:48 | FromDiscord | <djazz> thx |
09:04:09 | alexander92 | well, think about it |
09:04:19 | alexander92 | you run the macro in the beginning of the program |
09:04:26 | alexander92 | then its expanded |
09:04:36 | PMunch | Shit.. you're right |
09:04:37 | alexander92 | and them semantic passes are run onto the expanded code |
09:04:55 | alexander92 | effects need to know the end result of your macro etc |
09:05:06 | alexander92 | there must be a way to do it tho |
09:05:17 | alexander92 | e.g. there was a pragma like effects |
09:05:29 | leorize | PMunch: what are you trying to do? |
09:06:20 | PMunch | leorize, https://peterme.net/scraps/web-frameworks-in-nim.html |
09:09:32 | PMunch | Essentially I want each route to be a procedure with an input and on output type, the router will have serialisers that take the input from either query parameters or a POST body and call the route, then the output will be serialised into whatever output format is wanted. The exceptions come in as since we return a type we can't return errors. |
09:10:14 | PMunch | So the documentation for that route procedure would then list the input of the procedure, the output, and any possible error code it could return. |
09:10:47 | PMunch | That information could then in turn be used to generate API documentation |
09:15:48 | PMunch | Hmm, can a template check if it is called in a proc that has a custom pragma? |
09:16:06 | leorize | if a macro can, a template can |
09:16:10 | leorize | but you'd need `when` |
09:16:34 | PMunch | Well a macro can use `hasCustomPragma`, but that takes a field |
09:17:16 | PMunch | I have a template `resp` that I want to only allowed when called in a proc that has the `route` pragma. |
09:17:25 | * | navinmistry quit (Remote host closed the connection) |
09:17:39 | * | navinmistry joined #nim |
09:18:11 | federico3_ | PMunch: https://github.com/nim-lang/needed-libraries/issues/107 look at hug |
09:18:45 | * | Vladar joined #nim |
09:19:24 | PMunch | federico3_, yeah I've already seen hug :) |
09:19:43 | PMunch | And yes, I know I can create a macro that inserts the template in the body, but is that the only way? |
09:19:58 | leorize | yea |
09:20:29 | leorize | make a `resp` template outside with the {.error.} pragma so that you can still have documentation |
09:22:01 | PMunch | Of course :) |
09:23:27 | * | shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
09:25:55 | alexander92 | hm |
09:26:12 | alexander92 | i think it would be very hard to do so |
09:26:26 | alexander92 | without making your own error tracking |
09:26:50 | alexander92 | the other option is to |
09:26:58 | alexander92 | make each resp generate a function |
09:27:17 | alexander92 | and make nim generate inferred errors for functions after compilation and post process |
09:28:02 | alexander92 | overally, adding inferred errors to documentation is a valid problem |
09:28:06 | alexander92 | for nim the language itself |
09:28:23 | * | dom96 quit (Ping timeout: 245 seconds) |
09:29:07 | PMunch | Hmm, how do you actually set the "op" parameter for quote? |
09:30:30 | leorize | use a template :P |
09:31:39 | PMunch | Huh? |
09:31:44 | * | dom96 joined #nim |
09:31:44 | * | dom96 quit (Changing host) |
09:31:44 | * | dom96 joined #nim |
09:32:35 | PMunch | Brb, lunch |
09:33:01 | leorize | make a myQuote template that calls quote with the body and your desired op |
09:33:29 | alexander92 | sort of |
09:33:35 | alexander92 | a custom Result[set error] |
09:33:37 | alexander92 | type |
09:33:50 | alexander92 | and somehow passing all the possible errors |
09:34:16 | alexander92 | and typechecking with a pragma |
09:35:45 | alexander92 | hm i got another idea |
09:36:08 | Zevv | I have something rather nasty I can not explain: I have a pretty deep call stack inside macros and I want to do proper error reporting on the original NimNodes. I find passing the NimNode all the way down cumbersome, so I've made a little global `gCurrentNode: NimNode`. When interating the top level node in my macro I assign the current NimNode to this global, and then there's my own `error()` wrapper that |
09:36:14 | Zevv | calls the original `error()` with the global stored node. |
09:36:32 | Zevv | But somehow, this messes up the original AST somehow - if I dump/repr the passed code I get seemingly random copies of stuff in my tree |
09:36:53 | FromDiscord | <Kiloneie> Huh ?, i literally also copied the example from Tables module and it did the same... |
09:36:53 | FromDiscord | <Kiloneie> https://cdn.discordapp.com/attachments/371759389889003532/632149597648846848/what.PNG |
09:37:03 | Zevv | so could this temporary storing/copying of a nimnode mess things up? Forgot to say gCurrentNode is {.compileTime.} |
09:37:52 | alexander92 | but if you dont dump/repr it |
09:37:54 | alexander92 | does it change |
09:38:11 | alexander92 | oiii Kilo |
09:38:17 | alexander92 | thats a very good bug good one |
09:38:24 | alexander92 | i guess what happens is that your file |
09:38:28 | alexander92 | is called Tables.nim |
09:38:33 | FromDiscord | <Kiloneie> ohhh... |
09:38:36 | FromDiscord | <Kiloneie> xD |
09:38:43 | alexander92 | and maybe module names are case insensitive? not sure? |
09:38:54 | alexander92 | and iirc nim has a problem when you import a in a |
09:39:04 | * | federico3_ is now known as federico3 |
09:39:13 | alexander92 | but we need an error |
09:39:22 | alexander92 | for that |
09:39:30 | FromDiscord | <Kiloneie> i've had file naming problems before... Nim hates spaces in file names |
09:40:07 | narimiran | spaces in file names? you like to live dangerously! |
09:40:11 | alexander92 | yeah |
09:40:13 | alexander92 | hm https://github.com/nim-lang/rfcs/issues/91 |
09:40:23 | alexander92 | is another rfc for this, but probably impossible |
09:40:30 | alexander92 | i wonder if one can design an effect system |
09:40:39 | alexander92 | which is usable in macro |
09:42:46 | * | Vladar quit (Remote host closed the connection) |
09:42:49 | alexander92 | PMunch solved it! |
09:42:58 | alexander92 | just dont infer. |
09:43:28 | * | NimBot joined #nim |
09:43:34 | alexander92 | so e.g. |
09:43:51 | alexander92 | resp: |
09:44:00 | alexander92 | error 404, 500, 403 |
09:44:02 | alexander92 | code |
09:44:15 | alexander92 | this way it would be visible in the code |
09:44:28 | alexander92 | compile checke |
09:44:55 | alexander92 | (without the case where actually nothing raises 403: not sure if those are checked |
09:45:01 | alexander92 | and easy to document |
09:45:20 | alexander92 | and if you forget to write, the compiler would tell you |
09:45:26 | alexander92 | what codes you need |
09:46:26 | Zevv | I'm having a hard time differentiating between alehander42 and alexander92 |
09:46:58 | narimiran | Zevv: well the difference is quite huge (50) |
09:47:35 | Zevv | actually, it's just 1 bit + 3 bits |
09:47:36 | narimiran | imagine if he also was alexander90 on discord |
09:49:17 | * | shomodj joined #nim |
09:50:30 | alexander92 | sorry |
09:50:37 | alexander92 | no many alexanders around anyway |
09:50:45 | Zevv | about my above answer: my workaround is to extract the lineinfo and store that, instead of the nimnode itself |
09:51:23 | alexander92 | i am sasho as well |
09:52:24 | alexander92 | https://keleshev.com/automatic-compiler-pass-fusion |
09:52:24 | leorize | alexander92, @Kiloneie: module names are case-insensitive on windows |
09:52:27 | alexander92 | cute idea |
09:52:34 | leorize | a walkaround is to `import std/tables` |
09:55:22 | FromDiscord | <Kiloneie> Okay, i put that into my notes. |
09:55:48 | FromDiscord | <Kiloneie> Does anyone have any good Block statement examples ? i seriously can't figure out a good one xD... |
09:56:27 | alexander92 | generally |
09:56:27 | narimiran | you mean `block foo: ...`? |
09:56:32 | alexander92 | ah |
09:56:35 | FromDiscord | <Kiloneie> yes |
09:56:36 | narimiran | you can use it to exit double loop |
09:56:40 | FromDiscord | <Kiloneie> i know |
09:56:53 | narimiran | you have `block outer: ....... break outer` |
09:56:53 | FromDiscord | <Kiloneie> but i can't figure out a good double loop example o,o |
09:58:36 | narimiran | here is where i used it: https://github.com/narimiran/AdventOfCode2018/blob/master/nim/day03.nim |
09:59:20 | narimiran | but i guess that won't make much sense if you don't see (part 2 of) that AoC task |
10:00:02 | FromDiscord | <Kiloneie> i gotta figure out, a good example for beginners, i used block statement only once so far xD |
10:00:18 | narimiran | heh, you have plenty of stuff there to use for some videos: templates, .inject., scanf, block, ... :) |
10:00:21 | FromDiscord | <Kiloneie> for Roman literals exercism exercise |
10:00:46 | FromDiscord | <Kiloneie> yeh i just did a to do list, because im kinda lost on what to do, so i picked tables for today |
10:00:54 | FromDiscord | <Kiloneie> they seem easy enough to explain |
10:01:14 | narimiran | "im kinda lost on what to do" lol, you don't plan in advance? |
10:01:15 | FromDiscord | <Kiloneie> especially since i did tuples, i can make a Godot like vector and use that as an example |
10:01:23 | FromDiscord | <Kiloneie> so far i really didn't... |
10:01:41 | FromDiscord | <Kiloneie> i just went with whatever i thought of and did, then looked back on what i did so far, and just did something xD |
10:02:01 | FromDiscord | <Kiloneie> it worked so far... |
10:02:22 | FromDiscord | <Kiloneie> didn't make anything too advanced, and made sure everything tied in nicely. |
10:02:25 | narimiran | and it will work forever, by induction :P |
10:03:09 | FromDiscord | <Kiloneie> i am 2 videos behind now, because i spent time experimenting when i should of just made a video xD... also yesterday was not my fault, i freaked out i had no internet D: |
10:03:53 | FromDiscord | <Kiloneie> woke up and no internet... O,O, you know your brain is gonna have a meltdown when you wake up and check your views, watch some youtube video when working out and then you can't... |
10:05:23 | FromDiscord | <Kiloneie> i might soon go into 5 videos per week mode. |
10:05:53 | FromDiscord | <Kiloneie> Real soon imma run out of easy stuff to teach, and will take way longer to make videos because i will have to spend time learning stuff myself xD |
10:06:34 | * | stefantalpalaru joined #nim |
10:07:07 | narimiran | and when i told you that you can record multiple videos in a day, but just don't publish them that frequently, so you have some backup for later, you just dismissed the idea.... |
10:07:26 | FromDiscord | <Kiloneie> no i didn't |
10:07:37 | FromDiscord | <Kiloneie> i have to do that for today, and i don't think i can manage |
10:07:49 | FromDiscord | <Kiloneie> was supposed to do that yesterday too |
10:07:59 | FromDiscord | <Kiloneie> imma be hung over like hell on sunday |
10:09:38 | FromDiscord | <Kiloneie> The idea was to get the beginner stuff out fast, and i am doing that, but i kind of fell behind (my fault, got a bit lazy) then slow down a bit because it will take more time. |
10:15:49 | * | navinmistry quit (Remote host closed the connection) |
10:19:51 | FromDiscord | <Kiloneie> Is there any particular reason why Tables are not part of the System module ? |
10:22:43 | FromDiscord | <Kiloneie> Big enough to have it's own module ? |
10:24:18 | PMunch | alehander42, but that sorta breaks the auto-generating API thing |
10:24:23 | PMunch | If you have to specify anyways :P |
10:24:58 | FromGitter | <alehander42> yeah :( |
10:25:18 | FromGitter | <alehander42> but otherwise in your code |
10:25:25 | FromGitter | <alehander42> you cant really see what errors might happen |
10:25:27 | FromGitter | <alehander42> only in your docs |
10:25:30 | FromGitter | <alehander42> which is also strange |
10:25:41 | PMunch | leorize, do you have an example of such a macro? |
10:25:48 | PMunch | err, template |
10:26:48 | FromGitter | <alehander42> PMunch you're right |
10:27:07 | FromGitter | <alehander42> but for this to be solved i think you need to solve the general "generate inferred exceptions in nim docs" |
10:27:24 | FromGitter | <alehander42> and this would probably require nimdoc patching |
10:27:28 | PMunch | Well that already happens |
10:27:36 | PMunch | The exceptions are put in the docs |
10:27:58 | FromGitter | <alehander42> hm, yeah, i see useEffectSystem |
10:28:11 | FromGitter | <alehander42> so in this case you can post process those docs |
10:28:15 | FromGitter | <alehander42> i cant really see other way |
10:28:16 | PMunch | And I could format the doc output with the output from `nim jsondoc` |
10:28:32 | FromGitter | <alehander42> oh thats great |
10:28:37 | PMunch | Mhm |
10:28:38 | FromGitter | <alehander42> well in this case |
10:29:03 | FromGitter | <alehander42> you can generate functions with autogenerated name like repr_api_mylib_21 etc |
10:29:19 | FromGitter | <alehander42> so one can be sure that they are the same as in the docs |
10:29:23 | FromGitter | <alehander42> but actually does nimdoc |
10:29:30 | FromGitter | <alehander42> generate docstring for generated functions? |
10:32:14 | * | skoude joined #nim |
10:33:02 | PMunch | Hmm, why do I get an "Invalid pragma" error when I use a custom pragma along with a macro? |
10:33:38 | PMunch | alehander42, yes, as long as they are exported |
10:34:47 | PMunch | It could also use some clever checks to only generate them when you do nim jsondoc -d:generateAPIinfo |
10:35:04 | PMunch | Which the tool could do |
10:36:54 | leorize | PMunch: https://play.nim-lang.org/#ix=1Yji |
10:39:17 | * | LargeEpsilon_ quit (Ping timeout: 252 seconds) |
10:39:18 | PMunch | The invalid pragma struggle: https://play.nim-lang.org/#ix=1Yjj |
10:39:37 | PMunch | leorize, that is exactly what I tried! |
10:39:41 | PMunch | But it didn't work :P |
10:39:50 | PMunch | I just went with the old getAst method instead |
10:40:03 | leorize | sounds like a bug to me :P |
10:41:08 | PMunch | Yeah, it smells like a bug |
10:41:27 | Zevv | shoult it look like this then? https://play.nim-lang.org/#ix=1Yjk |
10:45:53 | FromGitter | <alehander42> https://play.nim-lang.org/#ix=1Yjj |
10:46:09 | FromGitter | <alehander42> no https://play.nim-lang.org/#ix=1Yjm |
10:46:51 | FromGitter | <alehander42> it works |
10:47:00 | leorize | Zevv: instruction unclear, crashed compiler instead: https://play.nim-lang.org/#ix=1Yjn |
10:49:19 | Zevv | ha :) |
10:50:22 | PMunch | alehander42, but now it doesn't have a custom prama any longer.. |
10:50:25 | Zevv | I once tried afl fuzzy lop on nim, but I think we need a few more years for that |
10:52:50 | * | alexander92 quit (Ping timeout: 276 seconds) |
10:53:25 | * | lritter quit (Remote host closed the connection) |
10:54:14 | * | LargeEpsilon_ joined #nim |
10:55:05 | PMunch | Hmm, not even this works :S https://play.nim-lang.org/#ix=1Yjs |
10:56:36 | * | alexander92 joined #nim |
10:59:45 | PMunch | Hmm, this works https://play.nim-lang.org/#ix=1Yju |
11:00:08 | PMunch | Of course I want to share that pragma across multiple procedures, so I can't generate it every time |
11:01:12 | * | encryptize[m] quit (Quit: 30 day idle timeout.) |
11:03:36 | PMunch | Hmm, the thick plottens: https://play.nim-lang.org/#ix=1Yjw |
11:04:01 | * | gh0st[m] quit (Quit: 30 day idle timeout.) |
11:04:02 | PMunch | For some reason it's fine to redefine the test pragma, but only the last instance of it will actually be detected.. |
11:05:09 | alexander92 | i debug it |
11:06:07 | alexander92 | the problem is |
11:06:13 | alexander92 | hasCustomPragma detects it as sym |
11:06:15 | alexander92 | instead of ident |
11:06:20 | alexander92 | sem* |
11:07:42 | * | jaens[m] quit (Quit: 30 day idle timeout.) |
11:08:32 | alexander92 | i fixed it |
11:08:37 | alexander92 | but not sure if my fix is good |
11:11:08 | alexander92 | thank God, it seems to work |
11:11:54 | PMunch | How did you fix it? |
11:12:55 | alexander92 | https://github.com/nim-lang/Nim/pull/12414 |
11:13:08 | alexander92 | ops pushed additional file moment |
11:13:56 | alexander92 | yep now should be there |
11:14:06 | alexander92 | oh .. removing debug echo |
11:14:49 | alexander92 | yes |
11:16:18 | PMunch | Hmm, and what exactly does that do? |
11:16:32 | alexander92 | it fixes your bug |
11:16:43 | alexander92 | basically test came as nkSym |
11:16:48 | alexander92 | in the last case |
11:16:51 | PMunch | Haha :P |
11:16:51 | alexander92 | instead of nkIdent |
11:16:59 | PMunch | Hmm |
11:17:04 | alexander92 | probably when its defined or used |
11:17:09 | alexander92 | not sure why this happens |
11:17:18 | alexander92 | but your example works with it: needs review |
11:17:45 | PMunch | Maybe you should add my example to the PR, so it's obvious why this change is needed? |
11:17:49 | alexander92 | yes, i did |
11:17:58 | alexander92 | but yeah, as a test case? |
11:18:05 | alexander92 | i'd see if the current tests pass |
11:18:07 | alexander92 | first |
11:20:20 | PMunch | Have we gotten another pipeline it needs to run through now? |
11:24:17 | * | skoude quit (Ping timeout: 240 seconds) |
11:24:50 | PMunch | Can confirm that it works though when I pull the fix locally |
11:25:07 | alexander92 | oh lunch |
11:25:12 | alexander92 | hm, good |
11:25:26 | * | adeohluwa joined #nim |
11:25:30 | alexander92 | what do you mean by popepline |
11:25:35 | alexander92 | pipeline |
11:26:03 | PMunch | The azure-pipeline stuff that now pops up for your commit |
11:26:08 | narimiran | yep |
11:26:15 | * | sagax quit (Ping timeout: 265 seconds) |
11:26:21 | narimiran | it is faster than both existing CI services |
11:26:29 | narimiran | and it will replace them after some more testing |
11:26:32 | PMunch | But we still have all three :P |
11:26:33 | PMunch | Aha |
11:26:50 | PMunch | Damn it, with your fix my code now works. But nimlsp complains.. |
11:26:58 | PMunch | So in the editor it still looks like a bug |
11:31:36 | alexander92 | hmm |
11:31:39 | alexander92 | why does it complain |
11:31:47 | * | sagax joined #nim |
11:31:50 | * | fanta1 joined #nim |
11:32:02 | PMunch | Because it is built with 1.0.0 |
11:32:09 | PMunch | And so does its checking with that |
11:32:28 | alexander92 | well, you have to rebuild it :O |
11:32:36 | PMunch | I know |
11:34:17 | PMunch | That's unfortunately easier said than done with nimlsp at the moment :P |
11:35:34 | * | skoude joined #nim |
11:36:53 | alexander92 | i need to use it with a patched nim |
11:37:00 | alexander92 | so i'll have to find out how :P |
11:37:47 | PMunch | Well, it should be as simple as changing your Nim version to the correct thing |
11:38:07 | PMunch | Then building it, and then when your editor invokes it point it at the correct install |
11:46:02 | PMunch | CfP for FOSDEM is out: https://forum.nim-lang.org/t/5330#33420 |
11:47:25 | FromDiscord | <sealmove> Congrats!! |
11:48:57 | * | Jjp137 quit (Ping timeout: 250 seconds) |
11:50:47 | PMunch | Thanks :) Now hopefully we will get some talk submissions :) |
11:58:55 | * | solitudesf joined #nim |
12:06:17 | PMunch | Hmm, did the behaviour of hash of string change? |
12:06:42 | PMunch | !eval import hashes, strutils; echo hash("Hello world").toHex |
12:06:45 | NimBot | 00000000AD91570C |
12:11:05 | alexander92 | good |
12:13:37 | * | narimiran quit (Ping timeout: 265 seconds) |
12:23:17 | * | nsf quit (Quit: WeeChat 2.5) |
12:23:42 | * | rockcavera joined #nim |
12:24:03 | * | skoude quit (Ping timeout: 245 seconds) |
12:25:09 | PMunch | Good? |
12:29:01 | PMunch | Damn it, nimlsp is such a pain to debug |
12:30:40 | * | rockcavera quit (Read error: Connection reset by peer) |
12:30:56 | * | rockcavera joined #nim |
12:30:56 | * | rockcavera quit (Changing host) |
12:30:56 | * | rockcavera joined #nim |
12:35:21 | PMunch | If someone is looking for Hacktober work: github.com/PMunch/nimlsp/issues/31 |
12:40:14 | FromDiscord | <kodkuce> proc countDna*(input:string): CountTable= |
12:40:14 | FromDiscord | <kodkuce> result = input.toCountTable() |
12:40:14 | FromDiscord | <kodkuce> |
12:40:14 | FromDiscord | <kodkuce> Error: cannot instantiate 'CountTable[A]' inside of type definition: 'countDna'; Maybe generic arguments are missing? |
12:40:35 | FromDiscord | <kodkuce> how do i retourn a table am i doing soemthing wrong? |
12:43:36 | FromGitter | <Lecale> Do you answer beginner level questions here, or are you all superior beings? |
12:47:54 | PMunch | Beginner questions very welcome :) |
12:48:36 | PMunch | kodkuce, CountTable needs to define what type the key is |
12:49:28 | FromGitter | <Lecale> I wanted to try nim for some data science rubbish, tried nimdata, got stuck with compilation : Could not load zlib1.dll |
12:49:47 | PMunch | kodkuce, try to put CountTable[char] as the return type and I think it should work |
12:50:11 | PMunch | Lecale, ah you're missing zlib |
12:50:48 | * | navinmistry joined #nim |
12:51:19 | PMunch | Not really sure how to install that on Windows though.. |
12:52:02 | FromGitter | <Lecale> I can see that I have it in my file system. What is the way to see where the file is expected to be. |
12:52:57 | PMunch | Where in your file system is it? |
12:53:32 | FromDiscord | <kodkuce> ty Pmucnh |
12:53:38 | FromDiscord | <kodkuce> *PMunch |
12:54:09 | PMunch | No problem :) |
12:56:03 | FromGitter | <Lecale> It's one level up from where I am compiling the basic test program, in /bin |
12:56:52 | PMunch | Hmm, try to copy it to the same level? |
12:56:59 | * | navinmistry quit (Ping timeout: 250 seconds) |
12:57:02 | PMunch | I don't really know where Windows go to look for dll files.. |
12:57:13 | PMunch | Probably some global directory as well |
12:58:23 | FromGitter | <Lecale> Dropping it into the same level doesn't help :( I don't know where the compiler goes when it looks for dlls to load |
12:58:45 | PMunch | Probably some system directory |
12:59:33 | PMunch | https://lifehacker.com/install-a-dll-file-in-windows-269063 |
12:59:36 | PMunch | Maybe that works |
13:03:00 | FromGitter | <Lecale> 64bit no like 32bit type error |
13:03:31 | PMunch | Huh? |
13:08:12 | FromDiscord | <kodkuce> test "add minutes": |
13:08:12 | FromDiscord | <kodkuce> check add((10, 0), 3).toStr == "10:03" |
13:08:13 | FromDiscord | <kodkuce> |
13:08:13 | FromDiscord | <kodkuce> proc add( (hour:int, minuts:int), add_minuts:int):string= <<< GETTING ERROR HERE, duno why for me it sounds legit |
13:08:13 | FromDiscord | <kodkuce> result = "sdsd" |
13:08:13 | FromDiscord | <kodkuce> |
13:08:16 | FromDiscord | <kodkuce> expression '(hour: int, minuts: int)' is of type 'tuple[hour: Error Type, minuts: Error Type]' and has to be discarded |
13:08:25 | PMunch | Please don't paste code into discord |
13:08:32 | * | Vladar joined #nim |
13:08:32 | PMunch | It comes across as spam on IRC |
13:08:40 | PMunch | Use a pastesite like ix.io instead |
13:09:39 | PMunch | Or better yet share your code through play.nim-lang.org |
13:10:00 | FromGitter | <zetashift> and gitter doesn't format it nicely so it's really hard to parse |
13:10:17 | FromDiscord | <kodkuce> https://play.nim-lang.org/#ix=1YjS |
13:10:21 | lqdev[m] | same with IRC |
13:10:37 | FromDiscord | <kodkuce> hmm it says it expects closing ) but duno if am blind or what |
13:10:53 | * | dddddd joined #nim |
13:11:16 | FromDiscord | <Rika> you didnt add an argname for the tuple |
13:11:18 | FromDiscord | <kodkuce> from what i see i have a good brackets 2 ( and 2 ) |
13:11:24 | FromDiscord | <kodkuce> ohhhhhhhh |
13:11:26 | PMunch | https://play.nim-lang.org/#ix=1YjT |
13:11:34 | FromGitter | <zetashift> yeah ^ |
13:11:52 | FromDiscord | <kodkuce> sorry 🙂 |
13:12:03 | FromGitter | <zetashift> PMunch beat me to it, you don't define an argument as a tuple like that |
13:12:17 | PMunch | And by the way, toStr is usually `$` in Nim |
13:12:27 | FromDiscord | <Rika> also if you're not using this as a learning assignment and you're looking for something like that maybe try looking into times |
13:12:38 | FromDiscord | <Rika> times the module i mean |
13:13:32 | PMunch | kodkuce: https://play.nim-lang.org/#ix=1YjU |
13:13:45 | PMunch | That is a more Nim way of doing it |
13:13:53 | FromDiscord | <kodkuce> hmm its writed like that on exercism |
13:14:15 | PMunch | Like what? |
13:14:23 | FromDiscord | <Rika> the code, prolly |
13:14:37 | FromDiscord | <Rika> the "solution code" or someone else's code |
13:15:01 | FromDiscord | <kodkuce> https://pastebin.com/TmXXn4j2 |
13:15:28 | FromDiscord | <Rika> oh hey nice TIL the suite proc/template/macro |
13:15:32 | FromDiscord | <kodkuce> this is test part of it i cant change that, masters supply it like that |
13:15:45 | FromDiscord | <kodkuce> and i am not a master 🙂 |
13:16:31 | FromDiscord | <kodkuce> PS i dont look solutions until i complete it solo |
13:16:37 | FromDiscord | <Rika> well it doesnt matter, we're just telling you that `$` is equal to `.toStr` |
13:16:43 | FromDiscord | <kodkuce> i know 🙂 |
13:16:49 | FromDiscord | <Rika> and nim prefers `$` to `.toStr` |
13:16:50 | FromDiscord | <kodkuce> but ty anwyay |
13:18:54 | FromDiscord | <Rika> hmm maybe i should try exercism too, but i dont like the fact i have to use a client to upload the code |
13:20:11 | PMunch | Hmm, how does the nim compiler know where to find the config file? |
13:20:11 | FromDiscord | <kodkuce> duno i dont think its any spywere thingy, just simple termianl tool |
13:20:38 | PMunch | Like how does it know this: "Hint: used config file '/home/peter/.choosenim/toolchains/nim-1.0.0/config/nim.cfg' [Conf]" |
13:20:45 | FromDiscord | <Rika> no i dont mean i dont trust it, i mean i prefer how hackerrank does it |
13:24:17 | * | adeohluwa quit (Remote host closed the connection) |
13:31:33 | FromDiscord | <kodkuce> duno newer used hackerrank i dont study hats xD |
13:34:18 | leorize | PMunch: the logic is probably in compiler.nim |
13:34:22 | leorize | options.nim* |
13:35:19 | leorize | PMunch: https://github.com/nim-lang/Nim/blob/4becd5a2a8d67c7481af457d5007e1a313d454c8/compiler/nimconf.nim#L234 |
13:35:20 | FromDiscord | <Lunar> https://pastebin.com/8tWBZnwu |
13:35:22 | FromDiscord | <Lunar> Error: |
13:35:30 | FromDiscord | <Lunar> Error: invalid pragma: exitAllBotChat() {.noconv.} |
13:35:33 | FromDiscord | <Lunar> ``Error: invalid pragma: exitAllBotChat() {.noconv.}`` |
13:35:46 | FromDiscord | <Lunar> No matter where I put the pragma, it's always invalid |
13:35:54 | leorize | put it next to the proc itself |
13:35:58 | FromDiscord | <Lunar> I did |
13:36:01 | FromGitter | <zetashift> @Rika makes supporting multiple languages hella easier than what hackerrank does |
13:36:13 | FromGitter | <zetashift> also you can use your favorite editor! |
13:36:36 | FromDiscord | <Lunar> https://pastebin.com/DqnHJMKC |
13:36:40 | FromDiscord | <Lunar> That's the multiline error |
13:37:01 | leorize | https://play.nim-lang.org/#ix=1Yk1 |
13:37:03 | leorize | there you go |
13:37:11 | leorize | remove the paren from the proc |
13:37:17 | leorize | because with the paren it's a proc call |
13:37:29 | FromDiscord | <Lunar> That's... confusing |
13:37:31 | FromDiscord | <Lunar> Thank you |
13:37:55 | leorize | not really :P |
13:38:45 | FromDiscord | <Lunar> I mean, you're calling the proc like a variable. Does any other language do that? |
13:39:04 | leorize | that's the point |
13:39:08 | leorize | setControlCHook |
13:39:11 | leorize | take a proc |
13:39:19 | leorize | not what came from the proc |
13:39:27 | FromDiscord | <Lunar> Ohhh |
13:39:49 | FromDiscord | <Lunar> So you're making setControlCHook a proc, copying the contents of another proc |
13:40:01 | leorize | it's not copying the content |
13:40:11 | leorize | this is called a pointer to a proc |
13:40:53 | leorize | wait, I think there's a good explaination somewhere in the manual |
13:41:10 | leorize | https://nim-lang.org/docs/manual.html#types-procedural-type |
13:41:42 | FromDiscord | <Lunar> Thanks Leo |
13:42:01 | PMunch | leorize, hmmm. Any way I can do that? |
13:42:23 | leorize | PMunch: wdym? |
13:42:45 | PMunch | I want to find the default config file in my program |
13:43:35 | FromGitter | <Lecale> I used choosenim to reinstall and my error evaporated like magic in an oven |
13:44:17 | leorize | PMunch: you can just import compiler/nimconf then use this: https://github.com/nim-lang/Nim/blob/4becd5a2a8d67c7481af457d5007e1a313d454c8/compiler/nimconf.nim#L225 |
13:44:34 | leorize | there's also a getUserConfigPath in there |
13:47:23 | * | traviss quit (Ping timeout: 245 seconds) |
13:50:06 | PMunch | "just" |
13:50:15 | PMunch | Tell me when you have a playground example.. |
13:50:21 | PMunch | I've been trying to do this for a while now |
13:50:53 | leorize | do you have the compiler package in the playground? |
13:52:10 | PMunch | Doesn't look like it, I'll settle for a regular paste |
13:54:58 | shashlick | variation - https://play.nim-lang.org/#ix=1Yk9 |
13:57:12 | PMunch | shashlick, what black magic is that? |
13:57:14 | leorize | PMunch: http://ix.io/1Yka |
13:58:21 | shashlick | that's @timotheecour's hack to find the nim compiler directory of the active nim |
13:58:22 | PMunch | leorize, that gives the wrong file |
13:58:29 | PMunch | Hint: used config file '/home/peter/.choosenim/toolchains/nim-1.0.0/config/nim.cfg' [Conf] |
13:58:43 | leorize | what does it give you? |
13:58:49 | shashlick | was trying to import nimconf from there instead of having to install compiler as a lib which can go out of sync with the running compiler |
13:58:59 | PMunch | First echo: /etc/nim/nim.cfg |
13:59:05 | PMunch | Second echo: /home/peter/.config/nim/nim.cfg |
13:59:17 | PMunch | shashlick, that is exactly what I'm trying to do :P |
13:59:34 | PMunch | shashlick, but how does it work? |
13:59:52 | shashlick | it doesn't 😞 |
14:00:06 | leorize | PMunch: add one more parentDir() to conf.prefixDir |
14:00:18 | shashlick | he's using currentSourceFile in strformat so you get the location of strformat.nim |
14:00:27 | shashlick | from there he looks for the parent dir |
14:00:40 | PMunch | shashlick, what do you mean? It seems to work for me |
14:01:04 | PMunch | Oooh, clever |
14:01:04 | leorize | http://ix.io/1Ykc |
14:01:20 | shashlick | Ya you get the location but the import fails |
14:01:54 | PMunch | Still wrong leorize |
14:02:07 | PMunch | shashlick, oh that is a minor issue :P |
14:02:13 | FromGitter | <alehander42> why |
14:02:17 | FromGitter | <alehander42> do you need the compiler |
14:02:31 | leorize | PMunch: what's the output? |
14:02:45 | PMunch | http://ix.io/1Ykd |
14:03:03 | PMunch | And the config is still in /home/peter/.choosenim/toolchains/nim-1.0.0/config/nim.cfg |
14:03:11 | PMunch | alehander42, nimlsp |
14:03:14 | PMunch | It uses nimsuggest |
14:03:19 | PMunch | As a library |
14:03:25 | leorize | PMunch: I see the problem now... |
14:03:40 | leorize | choosenim created shims to the nim executable |
14:03:56 | leorize | findExe couldn't find the actual executable that was ran |
14:04:00 | PMunch | Yup |
14:05:09 | shashlick | use the strformat method then |
14:05:15 | shashlick | findExe doesn't work at compile time |
14:05:42 | shashlick | or use https://github.com/nimterop/nimterop/blob/master/nimterop/build.nim#L50 |
14:06:34 | * | adeohluwa joined #nim |
14:08:09 | shashlick | maybe you can pull off the import with a macro |
14:09:16 | leorize | PMunch: well I'd say the only way to make compiler-based stuff works is to put them next to the compiler itself |
14:10:25 | PMunch | That's what I'm doing now, and lets just say it's not great.. |
14:10:42 | shashlick | this works - http://ix.io/1Ykj |
14:10:58 | leorize | that will only work at compile time |
14:11:23 | leorize | nimlsp needs to be able to find Nim's stdlib |
14:12:05 | shashlick | does nimlsp compile in the compiler? |
14:12:09 | shashlick | or call it externally |
14:12:18 | leorize | it use it as a library |
14:12:54 | shashlick | so it is compiled in? |
14:12:58 | shashlick | like nimble used to |
14:13:00 | leorize | yea |
14:13:38 | shashlick | well this same method can be used to get the path to the stdlib at compile time and just use that const at runtime |
14:14:35 | leorize | it wouldn't work if say: someone compiled nimlsp on their machine and decided to share it |
14:14:46 | leorize | which probably wouldn't work even if we have this sorted out |
14:15:11 | shashlick | ya that's why i'm wondering |
14:16:38 | leorize | tbh if you make stuff that uses the compiler as a library, it's better be a part of the compiler |
14:16:53 | leorize | otherwise there wouldn't be anyway to make it work out of the box atm |
14:17:04 | alexander92 | i dont agree, quite a lot of stuff can use it as a library |
14:17:07 | shashlick | well, this method now does away with needing to use the compiler library installed from nimble |
14:17:12 | alexander92 | e.g. all kinds of stuff that parse nim code |
14:17:24 | shashlick | you can just use the compiler directly as it is already there |
14:17:43 | alexander92 | but if i want to distribute a library which just uses the parser |
14:17:53 | alexander92 | i just want to depend on it as nimble package |
14:18:06 | shashlick | that approach doesn't work |
14:18:11 | alexander92 | well it should |
14:18:25 | leorize | i don't think the compiler api support that atm |
14:18:27 | shashlick | since the nim.exe and its stdlib can be different from the compiler library installed |
14:18:38 | alexander92 | i used it iirc |
14:18:58 | shashlick | it works but causes issues for users who have the wrong compiler installed vs running |
14:19:26 | shashlick | with http://ix.io/1Ykj method, you can just import the compiler directly and not have any dependencies |
14:19:39 | shashlick | you can say nim >= xyz, that's enough to lock on a minimal version |
14:19:46 | leorize | ah, you can just write a custom pass to get the AST from the parser |
14:20:04 | leorize | as long as you don't add sem in it should work (in theory) |
14:20:21 | leorize | shashlick: if you just wanted to parse nim then you don't need the stdlib |
14:20:51 | shashlick | i'm importing the compiler code, not stdlib in that snippet |
14:21:42 | alexander92 | forgive me, you're right |
14:21:47 | alexander92 | it seems as a good way |
14:22:19 | shashlick | ideally nim provides a way to just `import compiler/xyz` and it should know where to pull from |
14:22:26 | shashlick | basically add compiler to search path |
14:22:42 | shashlick | then you don't need a second compiler instance installed |
14:23:05 | leorize | ideally nimble would acknowledge the existance of a system-wide nimble folder |
14:23:31 | leorize | then you can just package the compiler source as a nimble package as part of the compiler distribution |
14:23:45 | leorize | nimble would detects that and stop trying to install the compiler (again) |
14:24:09 | * | adeohluwa quit (Remote host closed the connection) |
14:24:56 | leorize | currently on Haiku I packaged the compiler source as a nimble package |
14:25:21 | shashlick | but you can still run into incompatibilities |
14:25:31 | leorize | then install it on a system-wide folder, and make the compiler acknowledge that |
14:25:31 | shashlick | nim 1.0.0 trying to build with 0.20.2 compiler lib |
14:25:48 | leorize | the compiler can find the nimble package just fine |
14:25:52 | shashlick | and if you use choosenim and go back and forth, the compiler lib might not work |
14:25:52 | leorize | but nimble doesn't support it at all |
14:26:31 | leorize | that's why a global nimble dir would be nice |
14:26:43 | shashlick | my point is that a compiler library is already present with any nim install so no need to install anything else |
14:27:05 | leorize | I know, it's even a valid nimble package |
14:27:49 | shashlick | anyway, not sure if you are saying the same thing but am in a rush so probably not understanding correctly |
14:27:51 | PMunch | Hmm, doesn't "before build" work in nimble? |
14:28:01 | shashlick | it does but it doesn't |
14:28:15 | PMunch | Haha, what's that supposed to mean? |
14:28:28 | shashlick | https://github.com/nim-lang/nimble/issues/549 |
14:28:35 | shashlick | old problems, part of the reason nimgen died |
14:30:21 | PMunch | Huh, I don't quite get what the issue there is? |
14:30:29 | PMunch | For me it just seems like before build doesn't run |
14:31:18 | * | Jjp137 joined #nim |
14:31:42 | PMunch | Like I add a simple before build: echo "Hello world" |
14:31:47 | PMunch | But Hello world never shows up |
14:33:32 | * | fanta1 quit (Quit: fanta1) |
14:38:11 | * | doesntgolf joined #nim |
14:41:39 | * | fanta1 joined #nim |
14:46:59 | * | PMunch quit (Remote host closed the connection) |
14:47:00 | * | abm joined #nim |
14:47:14 | * | nsf joined #nim |
14:47:36 | * | skoude joined #nim |
14:52:41 | * | skoude quit (Ping timeout: 276 seconds) |
14:58:55 | alexander92 | hm, has anybody written a spreadsheet engine |
14:58:57 | alexander92 | in nim |
15:00:18 | disruptek | that's an interesting idea. |
15:02:48 | * | ng0_ joined #nim |
15:02:48 | disruptek | when you're editing the spreadsheet, you're changing code by injecting macros. then you save it, it gets compiled, and now you have native execution against values. |
15:04:12 | * | ng0 quit (Ping timeout: 260 seconds) |
15:04:18 | disruptek | i think i'd rather just have a spreadsheet with lisp underneath, though. |
15:07:26 | disruptek | i guess you get this for free in org mode. |
15:07:42 | disruptek | https://orgmode.org/worg/org-tutorials/org-spreadsheet-lisp-formulas.html |
15:12:52 | * | sealmove joined #nim |
15:25:15 | * | narimiran joined #nim |
15:44:49 | * | minierolls joined #nim |
15:55:32 | leorize | Araq: is --newruntime still an on going effort? |
15:55:51 | leorize | or are we going for --gc:destructors + araqsgc instead? |
15:59:06 | * | alexander92 quit (Read error: Connection reset by peer) |
15:59:34 | FromDiscord | <Rika> how do i export a certain `<` from a module? |
15:59:53 | leorize | ```export module.`<` |
15:59:57 | leorize | ```export module.`<```` |
16:00:08 | FromDiscord | <Rika> the issue with that is there are multiple of `<` |
16:00:27 | leorize | nope, you can't cherry pick like that |
16:00:28 | FromDiscord | <Rika> how do i specify which type they accept is what i mean |
16:00:30 | FromDiscord | <Rika> ah |
16:00:37 | FromDiscord | <Rika> so it does all it finds? |
16:00:38 | leorize | well there's a way |
16:01:31 | leorize | make a `<` proc in the current module that accept the only signature that you want |
16:02:04 | leorize | like this: ```proc `<`*(a, b: int): bool = system.`<`(a, b)``` |
16:02:24 | leorize | this is probably the best way |
16:03:41 | Araq | leorize: still both, but araqsgc is 100% backwards compatible so it has the better chances |
16:04:43 | leorize | we are getting destructors-backed string/seqs either way, right? |
16:05:45 | Araq | yup |
16:06:08 | Araq | and araqsgc is opt-in |
16:06:10 | Araq | bbl |
16:17:27 | * | LargeEpsilon_ quit (Ping timeout: 264 seconds) |
16:35:41 | * | ng0_ is now known as ng0 |
16:36:03 | * | skoude joined #nim |
16:36:49 | * | shomodj quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
16:40:18 | * | skoude quit (Ping timeout: 245 seconds) |
16:41:59 | * | crem joined #nim |
16:57:15 | leorize | Araq: how hard is it in your opinion to make nimsuggest project-agnostic? |
17:06:34 | * | jmiven_ is now known as jmiven |
17:08:16 | sealmove | does anyone know how to combine junit files to produce 1 big junit file? |
17:10:40 | * | Hideki_ joined #nim |
17:50:43 | FromGitter | <SolitudeSF> x11 wrapper broke with todays devel. ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ who is in the wrong lib or compiler? [https://gitter.im/nim-lang/Nim?at=5da0c0f257c2517c6aef3aba] |
17:56:46 | jken | I am calling a c function (nim opengl function: glShaderSource) and one of the params it expects to be a cstringArray |
17:56:56 | jken | How do I convert a string to a cstringArray? |
17:57:32 | leorize | cstringArray is an array |
17:57:39 | leorize | :P |
17:57:51 | leorize | there's a newCStringArray proc iirc |
17:58:16 | leorize | https://nim-lang.org/docs/system.html#allocCStringArray%2CopenArray%5Bstring%5D |
17:58:18 | jken | oh, actually, [cstring(myString)] |
17:58:23 | jken | seems to work |
17:59:01 | jken | plus a cast |
17:59:16 | leorize | use the actual proc please :P |
18:04:17 | * | PMunch joined #nim |
18:05:18 | FromGitter | <awr1> @SolitudeSF is `TAtom` `distinct`? |
18:05:29 | solitudesf | nope |
18:05:50 | FromGitter | <awr1> well that would probably fix it |
18:05:54 | solitudesf | i fixed it by removing the overload |
18:05:59 | FromGitter | <awr1> or that. |
18:06:16 | FromGitter | <awr1> is it worth asking why that was even defined in the first place |
18:06:46 | solitudesf | ¯\_(ツ)_/¯ |
18:07:20 | solitudesf | why did it break tho, i thought procs defined on aliases should be preferred over base procs. |
18:14:19 | FromGitter | <awr1> it's not consistent, i've run into bugs with it before |
18:14:21 | FromGitter | <awr1> related https://github.com/nim-lang/RFCs/issues/139 |
18:14:57 | FromGitter | <awr1> i thought it may have gotten fixed but i'm not so sure. |
18:19:01 | FromGitter | <awr1> now i'm rereading this and agreeing with krux, it shouldn't have been an RFC |
18:19:20 | FromGitter | <awr1> or well |
18:19:21 | FromGitter | <awr1> idk |
18:20:34 | * | uvegbot quit (Quit: Konversation terminated!) |
18:21:24 | * | Kaivo quit (Quit: WeeChat 2.6) |
18:22:14 | * | uvegbot joined #nim |
18:24:21 | FromGitter | <awr1> am i the only person that uses `&=` |
18:24:33 | FromGitter | <awr1> `add()` is too verbose for me... |
18:24:50 | FromGitter | <awr1> for being a common operation, anyway |
18:28:20 | PMunch | Hmm, nim jsondoc isn't great is it.. |
18:28:46 | PMunch | I mean, why is the `code` block here just a string.. http://ix.io/1YlI |
18:29:21 | PMunch | Would be so much better if the raises, pragmas, tags, input types, output types, etc. were actual fields that could be accessed.. |
18:29:54 | FromGitter | <akavel> Hi! Is the Table's pairs iterator expected to return keys in sorted order? if not, is there some collection in Nim stdlib (or 3rdparty) that is known to be sorted by key? |
18:30:34 | * | LargeEpsilon_ joined #nim |
18:34:10 | * | Calinou quit (Quit: No Ping reply in 180 seconds.) |
18:34:39 | FromGitter | <akavel> Hmmm, right, there's critbits, I forgot about it; so probably that's what I need, when the keys happen to be strings... still, I'd be interested in a non-string-keys variant as well, to know for future...! |
18:35:55 | PMunch | akavel, well there is also OrderedTable in the tables module.. |
18:36:26 | FromGitter | <akavel> PMunch: but it returns keys *in insertion order*, not in sorted order, no? |
18:36:27 | FromGitter | <awr1> OrderedTable is insertion order sensitive |
18:36:31 | PMunch | Oh right |
18:36:33 | FromGitter | <awr1> it's not like |
18:36:37 | FromGitter | <awr1> `std::map` or w/e |
18:36:42 | PMunch | You wanted them in lexicographical order |
18:36:46 | FromGitter | <akavel> yep |
18:36:56 | FromGitter | <akavel> or whatever `<` I define |
18:37:21 | PMunch | I'd guess you'd have to grab all the keys or pairs and sort them yourself |
18:38:11 | * | Calinou joined #nim |
18:38:14 | FromGitter | <akavel> Yeah, I know there are ways to do it on your own (actually I wrote a container like that myself already once), but I'm curious if there's something known that I'm missing :) |
18:38:32 | FromGitter | <akavel> I find it hard to believe there's none :P |
18:39:17 | FromGitter | <awr1> Nim needs a `SortedTable` probably |
18:41:53 | FromGitter | <akavel> Hm, I see there's even an issue for this at #11475 |
18:44:44 | PMunch | Hmm, is there an easy way to convert arbitrary objects to Json in Nim? |
18:47:33 | FromGitter | <awr1> @PMunch https://nim-lang.org/docs/marshal.html |
18:48:13 | FromGitter | <awr1> also, not JSON but nimyaml is also pretty good in this respect |
18:49:40 | PMunch | Huh, apparently just % from the JSON module does this |
18:49:45 | PMunch | At least for some simple objects |
18:50:00 | * | Hideki_ quit (Remote host closed the connection) |
18:50:44 | * | Hideki_ joined #nim |
18:50:48 | * | Hideki_ quit (Remote host closed the connection) |
18:51:27 | * | Hideki_ joined #nim |
18:52:05 | * | Hideki_ quit (Remote host closed the connection) |
18:53:38 | * | Hideki_ joined #nim |
18:53:40 | * | Hideki_ quit (Remote host closed the connection) |
18:56:57 | * | Hideki_ joined #nim |
19:01:14 | * | Hideki_ quit (Ping timeout: 240 seconds) |
19:03:52 | PMunch | Hmm, would it be possible to get the docstring for a specific instance of a generic procedure by only its name and the type? |
19:08:40 | * | traviss joined #nim |
19:13:39 | PMunch | Hmm getImpl just seems to grab a random implementatino |
19:14:19 | PMunch | http://ix.io/1YlS/Nim |
19:14:35 | PMunch | Both calls to getImpl there gives me the procedure for serialise(x: MyReturn) |
19:21:34 | PMunch | Okay, found a way.. |
19:38:23 | * | Hideki joined #nim |
19:38:37 | * | sealmove quit (Quit: WeeChat 2.6) |
19:51:47 | * | seerix quit (Remote host closed the connection) |
19:57:16 | FromDiscord | <Kiloneie> Is there no "char" variant of hasKey, contains ? |
19:58:45 | * | fanta1 quit (Quit: fanta1) |
19:58:59 | * | abm quit (Quit: Leaving) |
19:59:50 | * | LargeEpsilon_ quit (Ping timeout: 246 seconds) |
20:00:52 | * | junland_ quit (Quit: %ZNC Disconnected%) |
20:01:05 | * | junland joined #nim |
20:04:23 | * | paxis quit (Quit: Client exiting) |
20:14:24 | * | alexander92 joined #nim |
20:14:52 | FromGitter | <alehander42> @awr1 noo |
20:15:05 | FromGitter | <alehander42> doesnt &= generate |
20:15:07 | FromGitter | <alehander42> a = a & b |
20:15:11 | FromGitter | <alehander42> this sounds bad |
20:15:17 | FromGitter | <alehander42> because i imagine it allocates new |
20:15:19 | FromGitter | <alehander42> string each time |
20:15:22 | FromDiscord | <Kiloneie> Ignore my last message, it seems that CountTables don't work with any of those procs. |
20:15:28 | FromGitter | <alehander42> which you dont want if you have add |
20:16:09 | FromGitter | <alehander42> hm "Appends in place to a string." |
20:16:15 | FromGitter | <alehander42> ok, so it seems normal sorry |
20:16:35 | lqdev[m] | @alehander42 the magic for them is the same `AppendStrStr` |
20:16:44 | FromGitter | <alehander42> `add` reminds to seq's add, so i prefer it |
20:16:47 | FromGitter | <alehander42> yeah i see |
20:16:48 | FromGitter | <alehander42> sorry |
20:17:36 | * | Hideki quit (Ping timeout: 240 seconds) |
20:21:35 | * | radsoc joined #nim |
20:42:21 | * | narimiran quit (Ping timeout: 268 seconds) |
20:49:16 | * | solitudesf quit (Ping timeout: 240 seconds) |
20:52:10 | * | PMunch quit (Remote host closed the connection) |
20:56:06 | * | shomodj joined #nim |
20:58:18 | * | shomodj quit (Client Quit) |
21:05:46 | * | alexander92 quit (Read error: Connection reset by peer) |
21:15:17 | * | Vladar quit (Remote host closed the connection) |
21:26:58 | * | LargeEpsilon_ joined #nim |
21:27:39 | * | Jesin quit (Read error: Connection reset by peer) |
21:31:54 | * | luis_ joined #nim |
21:32:34 | * | Jesin joined #nim |
21:43:33 | * | LargeEpsilon_ quit (Remote host closed the connection) |
21:52:02 | * | luis_ quit (Ping timeout: 240 seconds) |
22:05:31 | FromDiscord | <treeform> so I have `prettyPrint*(x: SomeInteger|SomeFloat)` and passing a `Timestamp* = distinct float64` |
22:05:42 | FromDiscord | <treeform> Is there a way to also pass it through? |
22:06:41 | FromDiscord | <treeform> getting `type mismatch: got <Timestamp> but expected one of: ... float64 ...` |
22:06:42 | * | radsoc quit (Quit: radsoc) |
22:22:07 | disruptek | you can .borrow. or stamp.float64 it. otherwise, this is by design. |
22:22:52 | * | jmiven left #nim ("bye") |
22:31:00 | * | asymptotically quit (Quit: Leaving) |
22:39:20 | * | nsf quit (Quit: WeeChat 2.5) |
22:39:24 | * | stefantalpalaru quit (Quit: stefantalpalaru) |
22:46:32 | FromDiscord | <Kiloneie> This video took forever to make... and it's freakishly long too D:... couldn't make it shorter for this topic. https://youtu.be/5sYkUYx5LvA |
22:54:08 | krux02 | Kiloneie |
22:54:18 | krux02 | very cool, thanks for making a series like this. |
22:55:40 | FromDiscord | <Kiloneie> 🙂 |
22:57:02 | FromGitter | <me7> Quick question, do Nim able to compile and run on raspberry pi? |
22:57:37 | shashlick | Yes it does but just use the arm build instead of building on rpi |
22:57:48 | shashlick | Else will take a while |
22:58:01 | * | onionhammer quit (Quit: WeeChat 2.4) |
23:00:38 | FromGitter | <me7> Thank you :) |
23:06:55 | FromGitter | <mratsim> Yes it does, I had a talk at the biggest blockchain dev conf on Tuesday about running Ethereum on a raspberry Pi |
23:10:27 | * | Trustable quit (Remote host closed the connection) |
23:26:28 | FromGitter | <kayabaNerve> I'm having some really buggy behavior involving generics. Anyone have a few? |
23:27:08 | FromGitter | <me7> Thank @mratsim you have some link that I can start with? |
23:28:13 | FromGitter | <me7> I want to decode SENT protocol using Nim and raspberry pi but stunning where to start with |
23:31:29 | * | Hideki joined #nim |
23:32:24 | * | krux02_ joined #nim |
23:35:27 | FromGitter | <kayabaNerve> Never mind. It's an issue with a pragma I'm working with. |
23:36:52 | * | krux02 quit (Ping timeout: 268 seconds) |
23:37:03 | * | Hideki quit (Ping timeout: 265 seconds) |
23:58:46 | * | ng0 quit (Quit: Alexa, when is the end of world?) |