00:34:07 | FromDiscord_ | <Mind> Hey, i was wondering what IDE most people use with Nim? |
00:38:28 | * | Voltist joined #nim |
00:39:06 | rayman22201 | VSCode, followed by Vim |
00:40:42 | FromGitter | <zetashift> yea VSCode sometimes spacemacs |
00:40:56 | Voltist | Hi all. How would I go about piping two processes together in by their input and output streams in Nim? |
00:41:12 | FromDiscord_ | <Mind> from what i've tried with VSCode, it doesnt seem to complete members of modules. at least with version 0.20 |
00:41:41 | rayman22201 | @Voltist https://nim-lang.org/docs/osproc.html |
00:42:57 | Voltist | @rayman22201 The osproc documentation shows me how to find the input and output streams of a process, but not how to link them |
00:43:46 | Voltist | It will be somewhere in the streams library but I don't know what to look for |
00:43:53 | rayman22201 | @Mind you need something like nim-lsp for that to work: https://github.com/PMunch/nimlsp |
00:43:55 | rayman22201 | it's not built in |
00:44:11 | rayman22201 | @voltist, what do you mean by "link them"? |
00:44:43 | rayman22201 | You want to pipe the stdout of one into the stdin of the other? |
00:44:56 | Voltist | Yeah |
00:47:29 | rayman22201 | you just iterate over one stream and send the result to the other. There is no built in proc for this. |
00:47:46 | rayman22201 | maybe a nimble package for it? idk |
00:48:45 | Voltist | Ok |
00:49:08 | * | lf-araujo joined #nim |
00:49:47 | rayman22201 | no nimble nimble package that I can find. Yeah. should be pretty simple to write though |
00:49:58 | shashlick | maybe use https://nim-lang.org/docs/selectors.html |
00:52:05 | rayman22201 | why? That doesn't look like it does anything for piping? |
00:57:59 | * | lf-araujo quit (Ping timeout: 252 seconds) |
01:06:05 | shashlick | well, at least to move data from one handle to the other |
01:25:53 | rayman22201 | I think they wanted a proc that did the data marshalling automatically. I.e 'pipe(inputStream, output Stream)' but that doesn't exist so might as well just use the stdlib unless you really need the performance of something low level like epoll. |
01:28:52 | * | Tanger quit (Remote host closed the connection) |
01:30:39 | * | Virxes quit (Remote host closed the connection) |
01:35:22 | * | Mister_Magister quit (Ping timeout: 246 seconds) |
01:36:30 | Voltist | So how could I do this with selectors? |
01:36:52 | * | Mister_Magister joined #nim |
01:44:47 | * | dwdv quit (Quit: quit) |
01:45:27 | rayman22201 | You probably shouldn't. You get the low level file handles for the input and output streams with this: https://nim-lang.org/docs/osproc.html#inputHandle,Process, and then you register the stdin FD and a callback with https://nim-lang.org/docs/selectors.html#registerHandle%2CSelector%5BT%5D%2C%2Cset%5BEvent%5D%2CT |
01:45:27 | rayman22201 | then in the callback, write the data to the stdout handle. |
01:45:58 | rayman22201 | selectors are just a low level way to do async io. They have nothing to do with streams or processes. |
01:46:42 | rayman22201 | if you are going to go that route, you might as well just use nim async/await, which does the selector epoll nonsense for you. |
01:52:57 | rayman22201 | oh yeah, don't forget that you then have to run an event loop by calling selector.select() in a loop :-P https://nim-lang.org/docs/selectors.html#select%2CSelector%5BT%5D%2Cint |
01:54:06 | rayman22201 | which async does for you |
01:55:27 | * | lf-araujo joined #nim |
02:03:37 | * | lf-araujo quit (Ping timeout: 252 seconds) |
02:05:39 | shashlick | if you have a higher level api, certainly use that |
02:07:00 | rayman22201 | Fun fact. What I described is pretty much how would go about it in C. Nim has no problem acting like a "prettier version of C" if that's what you really want to do π |
02:08:00 | * | Tanger joined #nim |
02:13:30 | * | Voltist quit (Remote host closed the connection) |
02:13:58 | * | lf-araujo joined #nim |
02:16:51 | rayman22201 | @shashlick sorry! I couldn't resist poking a bit of fun at you. You do some very cool stuff with low level APIs. |
02:29:24 | * | lf-araujo quit (Remote host closed the connection) |
02:32:19 | * | chun joined #nim |
02:36:25 | * | chun_ joined #nim |
02:39:26 | * | chun quit (Remote host closed the connection) |
02:44:42 | * | laaron quit (Quit: ZNC 1.7.1 - https://znc.in) |
02:44:56 | shashlick | no worries π I had to do this select loop for my python proxy a while back - https://github.com/genotrance/px/blob/master/px.py#L900 |
02:45:25 | * | laaron joined #nim |
03:07:07 | rayman22201 | neat! but also, I'm sorry! A select loop is not something I ever want to write by hand if I can help it lol. |
03:09:33 | shashlick | it wasn't fun for sure - especially since there's error handling which makes it into a mess |
03:13:40 | * | fjellfras joined #nim |
03:24:06 | rayman22201 | I can imagine! Error handling with callbacks like that quickly gets really messy. |
03:28:29 | * | lritter quit (Ping timeout: 244 seconds) |
03:29:04 | * | lritter joined #nim |
03:39:07 | * | alexander92 quit (Ping timeout: 268 seconds) |
03:40:48 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
03:46:16 | * | lritter quit (Ping timeout: 246 seconds) |
04:18:55 | * | lf-araujo joined #nim |
04:22:15 | * | chun__ joined #nim |
04:23:13 | * | chun__ quit (Client Quit) |
04:25:16 | * | chun_ quit (Remote host closed the connection) |
04:30:17 | * | lf-araujo quit (Ping timeout: 252 seconds) |
04:33:33 | * | nsf joined #nim |
04:33:35 | * | gmpreussner quit (Ping timeout: 244 seconds) |
04:49:45 | FromGitter | <zacharycarter> well the nuklear bindings *should* be working - but they're not for the opengl glfw3 example. I'm on windows now though and I really don't feel like troubleshooting this crap, since I'll be using bgfx. I just finished putting together a bgfx backend for nuklear, and I'm going to test it this evening. if it works I'll consider the binding update finished and let others worry about testing / adding more backends |
04:51:16 | * | fjellfras quit (Ping timeout: 268 seconds) |
04:52:28 | * | leorize quit (Ping timeout: 260 seconds) |
04:55:10 | * | lf-araujo joined #nim |
04:55:52 | * | dddddd quit (Remote host closed the connection) |
04:56:10 | * | fjellfras joined #nim |
04:58:34 | * | fjellfras quit (Remote host closed the connection) |
04:58:47 | * | fjellfras joined #nim |
04:59:15 | * | stefanos82 joined #nim |
05:01:11 | * | leorize joined #nim |
05:07:35 | * | laaron quit (Quit: ZNC 1.7.1 - https://znc.in) |
05:10:02 | * | laaron joined #nim |
05:16:13 | * | laaron quit (Quit: ZNC 1.7.1 - https://znc.in) |
05:16:34 | * | laaron joined #nim |
05:20:58 | * | alexander92 joined #nim |
05:35:40 | * | lf-araujo quit (Ping timeout: 276 seconds) |
05:37:55 | * | narimiran joined #nim |
05:43:16 | * | NimBot joined #nim |
05:49:29 | * | alexander92 quit (Ping timeout: 258 seconds) |
05:50:51 | * | gmpreussner joined #nim |
05:56:59 | * | fjellfras_ joined #nim |
05:57:04 | * | fjellfras quit (Ping timeout: 272 seconds) |
05:57:24 | * | fjellfras_ quit (Max SendQ exceeded) |
05:57:48 | * | fjellfras_ joined #nim |
06:04:15 | * | lf-araujo joined #nim |
06:09:40 | * | lf-araujo quit (Ping timeout: 264 seconds) |
06:16:19 | * | traviss joined #nim |
06:16:25 | * | Travis__ joined #nim |
06:16:30 | * | lf-araujo joined #nim |
06:16:56 | * | Travis__ quit (Client Quit) |
06:19:56 | * | purebadger joined #nim |
06:24:33 | * | purebadger quit (Ping timeout: 248 seconds) |
06:28:22 | * | lf-araujo quit (Ping timeout: 252 seconds) |
06:39:14 | * | PMunch joined #nim |
06:42:54 | * | solitudesf joined #nim |
06:58:12 | * | traviss quit (Quit: Leaving) |
07:00:00 | * | gmpreussner quit (Quit: kthxbye) |
07:00:45 | * | krux02 joined #nim |
07:04:34 | * | gmpreussner joined #nim |
07:05:42 | * | lf-araujo joined #nim |
07:13:52 | * | lf-araujo quit (Ping timeout: 264 seconds) |
07:14:57 | * | purebadger joined #nim |
07:25:12 | * | lf-araujo joined #nim |
07:30:04 | * | lf-araujo quit (Ping timeout: 276 seconds) |
07:32:57 | * | Senketsu quit (Quit: WeeChat 2.5) |
07:39:10 | * | lf-araujo joined #nim |
07:48:04 | * | lf-araujo quit (Ping timeout: 264 seconds) |
07:54:34 | * | solitudesf quit (Ping timeout: 244 seconds) |
07:59:02 | * | abm joined #nim |
08:16:48 | PMunch | Hmm, I'm back to trying to create the safeoptions part of my optionsutils |
08:17:37 | PMunch | Which essentially imports the Options type, but only the safe access pattern macros from the optionsutils module and not the getters from the options module |
08:20:59 | PMunch | Still having the issue where my macro can't use unsafeGet because it expands in the scope where that isn't available |
08:23:01 | FromGitter | <mratsim> bindSym? |
08:23:54 | PMunch | I don't know why, but it's not working |
08:25:03 | PMunch | Is it because my return type is untyped? |
08:28:14 | PMunch | Has discardable been removed? |
08:28:20 | * | floppydh joined #nim |
08:33:16 | PMunch | Hmm, apparently not.. |
08:33:34 | PMunch | But I get: Error: invalid pragma: discardable |
08:35:17 | * | dwdv joined #nim |
08:39:46 | * | lf-araujo joined #nim |
08:42:38 | PMunch | Aha |
08:42:54 | PMunch | So apparently bindSym doesn't work when it's a nnkDotExpr |
08:44:09 | * | lf-araujo quit (Remote host closed the connection) |
08:44:11 | PMunch | I was trying to do ":tmp120398.unsafeGet.doSomething()", which didn't work, saying "undeclared field: 'unsafeGet'". Changing it to "unsafeGet(:tmp120398).doSomething()" worked fine |
08:52:57 | * | couven92 joined #nim |
08:54:32 | PMunch | How do I do the same thing in a template though? |
08:55:21 | * | stefanos82 quit (Quit: Quitting for now...) |
08:56:00 | * | Senketsu joined #nim |
09:03:08 | * | fjellfras_ quit (Remote host closed the connection) |
09:03:27 | * | fjellfras_ joined #nim |
09:03:42 | * | fjellfras_ quit (Max SendQ exceeded) |
09:04:09 | * | fjellfras_ joined #nim |
09:05:20 | FromGitter | <zah> recently, I had to write the following in a macro: β β ```let bindSym = bindSym "bindSym"``` β β Then the Nim crown appeared over my head, I had levelled up :P [https://gitter.im/nim-lang/Nim?at=5d2458d0f5dd145742525f2b] |
09:14:37 | * | alexander92 joined #nim |
09:14:44 | alexander92 | #nim-offtopic |
09:14:55 | alexander92 | ops my irc skills |
09:19:16 | FromGitter | <zah> Is there a reason why no overflow checks are performed for `uint` values? β β ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5d245c14d0e06b66757280fa] |
09:21:05 | FromGitter | <mratsim> because they are the same as uint in C |
09:24:14 | PMunch | zah, haha :P |
09:30:17 | PMunch | Is there a way to do something similar to what bindSym does in a macro in a template? |
09:33:12 | PMunch | Huh, apparently converting that to a call as well seems to work |
09:33:27 | PMunch | So the unified call syntax breaks down in this case.. |
09:35:36 | * | zyklon joined #nim |
09:35:42 | * | uvegbot quit (Ping timeout: 252 seconds) |
09:37:29 | FromGitter | <mratsim> in template always use the call syntax |
09:38:58 | FromDiscord_ | <Stuffe> Does anyone know to make a proc with side effects act like it doesn't have side effects? debugEcho style |
09:39:10 | FromDiscord_ | <Stuffe> Im overloading assert() because it's too hard to read with all the irrelevant output, and I want to add console colors |
09:41:48 | alexander92 | i am not sure if this should be possible |
09:41:58 | FromGitter | <mratsim> {.noSideEffect.}: |
09:42:12 | alexander92 | after all, this means we need a {.noSideEffectExceptThisIgnoredOne.} |
09:42:23 | FromGitter | <mratsim> you can then use a block of code with sideeffect and the compiler will not enforce on that part |
09:43:05 | alexander92 | but if its possible, please define a different assert function |
09:43:16 | alexander92 | (are those asserts in foreign code?) |
09:43:31 | FromDiscord_ | <Stuffe> {.noSideEffect.} is to enforce that the function doesnt have side effects I think |
09:43:44 | FromGitter | <mratsim> It's possible, see: https://github.com/numforge/laser/blob/83d043c7d80d62c5ed8f2391ca9c15c8a5433932/laser/lux/ast/ast_compiler.nim#L199 |
09:43:46 | FromDiscord_ | <Stuffe> the only "side effect" is to change the color of the text in the console |
09:43:48 | alexander92 | notice the : use it like |
09:44:00 | alexander92 | ye ^ |
09:44:12 | FromDiscord_ | <Stuffe> And I make sure to change it back, so for all intents and purposes it doesn't have side effects |
09:44:15 | alexander92 | Stuffe i agree, your usecase is good, but i am a bit worried |
09:44:19 | FromGitter | <mratsim> I was accessing a compile-time global "let", but let globals are considered sideeffect |
09:44:21 | alexander92 | in principle |
09:44:32 | FromDiscord_ | <Stuffe> interestingly, quit() is not seen as having side effects (seems like a bug) |
09:44:57 | alexander92 | because i cant know if the user really used it as a workaround for a lang limitation or did he introduce additional actuall effects |
09:45:06 | FromGitter | <mratsim> ```func foo() = β {.noSideEffect.}: β echo "mySideEffect``` [https://gitter.im/nim-lang/Nim?at=5d246222acab0914d8d731fa] |
09:46:15 | FromDiscord_ | <Stuffe> mratsim, oh that worked |
09:46:46 | alexander92 | eh thats a good example: i'd even go as far as forbidding this without {.noEffectNotChecked.} or something like that |
09:46:52 | FromDiscord_ | <Stuffe> i did: func foo() {.noSideEffect.} = |
09:47:01 | FromDiscord_ | <Stuffe> which didnt |
09:47:04 | FromGitter | <mratsim> func implies noSideEffect ;) |
09:47:09 | alexander92 | so that the language enforces that people reading the signature can take a note |
09:47:57 | FromGitter | <mratsim> your version applies to the function signature. then the proc body is checked and enforced no sideeffect |
09:48:18 | FromGitter | <mratsim> my code block just means "trust me, this part has no sideeffect" |
09:48:24 | alexander92 | exactly |
09:48:31 | FromDiscord_ | <Stuffe> alexander, I really hope nim keeps letting us "play in the deep end". The whole reason I like nim so much is because it gives good programmers the freedom to make mistakes instead of always prioritizing the lowest common denominator |
09:48:33 | alexander92 | {.trust.} |
09:48:40 | FromDiscord_ | <Stuffe> let them have excel |
09:48:48 | alexander92 | Stuffe, i absolutely want this to be possible |
09:49:11 | alexander92 | all i am saying is that the language should require annotating the fact in the signature |
09:49:21 | alexander92 | this way one gets the best of both worlds |
09:49:51 | FromDiscord_ | <Stuffe> Yes, agreed |
09:49:54 | alexander92 | one can define a noSideEffect function for whatever he needs, but the user of the API can still know to be a bit more cautious with some of those |
09:50:29 | FromGitter | <mratsim> {.tag: "noSideEffectButNotExactly".} ? |
09:50:55 | alexander92 | :P {.trust.} sounds catchy |
09:51:17 | FromGitter | <mratsim> I wonder if someone used the tag/effect system for more than toy examples already |
09:51:33 | alexander92 | {.noSideEffectManual.} |
09:51:50 | alexander92 | i remember the yaml parser lib used it |
09:52:15 | alexander92 | i use it for annotating that i invoke a certain python interop |
09:52:34 | alexander92 | but honestly not using that info a lot yet |
09:52:49 | alexander92 | but the noSideEffect effects should be useful |
09:54:55 | FromGitter | <mratsim> I'm very annoyed with higher order functions forcing me to tag {.nimcall, gcsafe, locks: 0.} and what not ... |
09:58:50 | * | lf-araujo joined #nim |
10:05:56 | * | fjellfras_ quit (Ping timeout: 258 seconds) |
10:07:36 | * | lf-araujo quit (Ping timeout: 252 seconds) |
10:11:04 | Araq | did I miss something? Nim has "general purpose" effects, they are called .tags |
10:24:41 | * | fjellfras joined #nim |
10:24:42 | * | fjellfras quit (Read error: Connection reset by peer) |
10:25:03 | * | fjellfras joined #nim |
10:28:20 | FromDiscord_ | <Stuffe> Araq: I don't know if you missed much, but shouldn't "quit()" be considered as having side effects? Seems like a bug, rigth? |
10:33:11 | * | purebadger quit (Ping timeout: 244 seconds) |
10:40:10 | * | purebadger joined #nim |
10:59:48 | ehmry | isn't quit noreturn? |
11:00:14 | * | Vladar joined #nim |
11:01:02 | * | fjellfras quit (Quit: Leaving) |
11:02:41 | FromDiscord_ | <Stuffe> I guess yes but "echo" has is marked as having side effects |
11:02:53 | PMunch | Is there a way to export everything except a defined set from a module? |
11:13:45 | FromGitter | <mratsim> have an additional module that import foo except bar; export foo |
11:14:58 | leorize | PMunch: `export <modulename> expect <symbols>` |
11:15:53 | PMunch | Thanks :) |
11:16:14 | PMunch | Maybe that should be mentioned here: https://nim-lang.org/docs/manual.html#modules-export-statement ? |
11:16:18 | narimiran | leorize: i expect that to not work :P |
11:16:35 | leorize | yea, it's except :p |
11:16:47 | leorize | was a tad bit sleepy :p |
11:19:26 | Araq | well there is a definition of what "has side effect" means and quit() doesn't have any |
11:19:44 | Araq | (quit doesn't access a global variable) |
11:20:01 | * | lf-araujo joined #nim |
11:20:41 | Araq | however, procs can "choose" to be effectful and 'echo' did that and 'quit' didn't. The idea was that clearly echo accesses 'stdout' implicitly |
11:20:50 | Araq | so it should count as a side effect. |
11:23:04 | * | Snircle joined #nim |
11:27:14 | Araq | non-local control flow isn't an effect in Nim, exceptions are tracked separately |
11:28:16 | * | lf-araujo quit (Ping timeout: 264 seconds) |
11:30:25 | alexander92 | but then i cant be sure calling a random func wouldnt self-terminate my program down 3 calls deep the line |
11:31:35 | alexander92 | wait, so the compiler calculates a lot of effects itself: is there a way currently to show the "calculated" effects in an editor for a file? |
11:31:43 | Araq | 1. you never are (signals? Fatal errors?) |
11:32:00 | Araq | 2. you can introduce a 'terminates' tag on your own. |
11:32:18 | alexander92 | eh obviously there is a diffence between external reason and my own code deliberately quitting |
11:32:30 | alexander92 | but yeah, not a big deal, just wondering |
11:32:56 | alexander92 | yeah, i can call it `halts` :P |
11:33:05 | * | lf-araujo joined #nim |
11:33:06 | alexander92 | and let the compiler solve the problem |
11:33:09 | Araq | there is an .effects pragma to make the compiler output the computed effects |
11:33:48 | alexander92 | so if a push it on the top of the file, it can be used |
11:34:25 | alexander92 | is there a way to push globally a pragma? (e.g. somehow by a compiler on/off switch) |
11:35:11 | alexander92 | this way i can make my compiler save somewhere the info and visualize it somehow in my ide/editor |
11:35:43 | Araq | https://gist.github.com/Araq/d19bdecbe691be38789ea73329dfb92a |
11:36:00 | Araq | as you can see, it currently doesn't list the .sideEffect |
11:39:14 | * | theelous3 joined #nim |
11:42:07 | * | lf-araujo quit (Ping timeout: 250 seconds) |
11:42:42 | narimiran | PMunch: https://play.nim-lang.org/ ? |
11:43:06 | narimiran | !eval echo "hello" |
11:43:07 | NimBot | Compile failed: <no output> |
11:46:50 | PMunch | !eval echo "hello" |
11:47:33 | PMunch | Hmm |
11:47:50 | NimBot | Compile failed: <no output> |
11:48:39 | narimiran | PMunch: playground is back online, but it seems like it cannot compile anything |
11:49:54 | PMunch | !eval echo "Hello" |
11:49:58 | NimBot | Hello |
11:55:15 | PMunch | Not really sure what happened, but it seems to be back now |
11:55:57 | * | Cadey quit (*.net *.split) |
11:55:57 | * | vqrs_ quit (*.net *.split) |
11:55:57 | * | golechwi1 quit (*.net *.split) |
11:55:57 | * | qwertfisch quit (*.net *.split) |
11:55:57 | * | LyndsySimon quit (*.net *.split) |
11:55:57 | * | r4vi quit (*.net *.split) |
11:55:58 | * | l1x quit (*.net *.split) |
11:55:58 | * | euantor quit (*.net *.split) |
11:55:58 | * | odc quit (*.net *.split) |
11:55:58 | * | MD87 quit (*.net *.split) |
11:56:28 | narimiran | :+1: |
11:57:35 | alexander92 | Araq: hm, so there is no way to get that info currently |
11:59:17 | Araq | maybe ask narimiran which effects would make nimpretty bugfixing simpler |
12:00:26 | * | lf-araujo joined #nim |
12:00:58 | alexander92 | thats not hard to add to `listEffects` |
12:01:28 | * | Cadey joined #nim |
12:01:29 | * | vqrs_ joined #nim |
12:01:29 | * | golechwi1 joined #nim |
12:01:29 | * | qwertfisch joined #nim |
12:01:29 | * | LyndsySimon joined #nim |
12:01:29 | * | r4vi joined #nim |
12:01:29 | * | l1x joined #nim |
12:01:29 | * | euantor joined #nim |
12:01:29 | * | odc joined #nim |
12:01:29 | * | MD87 joined #nim |
12:03:22 | Araq | and which effect would help us find the nimsuggest leaks? |
12:03:39 | Araq | a UsesTooMuchMem tag? |
12:04:16 | alexander92 | i am trying to think of ways to visualize what effects are inferred at all |
12:04:32 | alexander92 | exactly to be able to see with my own code if there is something that helps |
12:04:48 | Araq | and then what? after you have visualized it the effect still don't help you to program |
12:05:06 | FromDiscord_ | <Skaruts> how do I get the type of a variable? |
12:05:09 | alexander92 | my purpose is to find if they are useful at all |
12:05:17 | Araq | they are not. |
12:05:54 | leorize | Skaruts: typeof() |
12:06:11 | alexander92 | well, one possible theory i had is that its annoying to annotate them everywhere, but if we just could see what is inferred, they might make more sense |
12:06:19 | Araq | esp if you come from a FP mindset where CPU usage and memory handling by definition is never a "big deal" |
12:07:00 | alexander92 | "X doesnt solve those 2 of 50 possible classes of problems" doesnt mean X is bad |
12:07:09 | alexander92 | the same as with error handling |
12:07:14 | * | stefanos82 joined #nim |
12:07:26 | Araq | "X doesn't solve *my* problems at all" does mean it's useless |
12:07:32 | Araq | to me. |
12:07:35 | FromDiscord_ | <Skaruts> Error: undeclared identifier: 'typeof' |
12:07:38 | FromDiscord_ | <Skaruts> ?!? |
12:07:48 | Araq | use a recent Nim that has typeof |
12:07:55 | FromDiscord_ | <Skaruts> ah |
12:08:04 | alexander92 | maybe |
12:08:19 | FromDiscord_ | <Skaruts> well I'm 0.19.4, is it too outdated already? |
12:08:20 | alexander92 | but i still think something similar to an effect/custom type-like stuff system |
12:08:22 | alexander92 | can be useful |
12:08:28 | narimiran | Skaruts: yeah |
12:08:36 | FromDiscord_ | <Skaruts> :S |
12:08:40 | FromDiscord_ | <Skaruts> thanks |
12:08:45 | narimiran | is there something preventing you from upgrading? |
12:08:49 | Araq | alexander92, it can be useful when you finally start to measure what needs to be measured. |
12:09:02 | Araq | which is: resource consumption. |
12:09:03 | FromDiscord_ | <Skaruts> I don't think so, just laziness |
12:09:10 | narimiran | if so: take a look at `typetraits` module, it has what you want |
12:09:13 | Araq | control flow complexity. |
12:09:14 | alexander92 | even for stuff like memory/cpu: in a hypothetical lang, you can encode upper limits to memory/cycles etc and somehow prove some limitations |
12:09:22 | * | lf-araujo quit (Ping timeout: 252 seconds) |
12:09:29 | alexander92 | but not sure how scalable to bigger programs that would be |
12:09:38 | * | dddddd joined #nim |
12:10:01 | narimiran | Skaruts ok if it is just laziness, then you should definitely upgrade, 0.20 brings lots of goodies |
12:12:40 | Araq | alexander92, yeah but then if you're like "well a loop is just some tail recursion", you won't get far |
12:13:09 | Araq | for i in N: for j in M: stuff() # N*M* costOf(stuff) |
12:13:23 | Araq | with recursion ... well good luck. |
12:13:57 | alexander92 | wow, i remember now a built a very simple version of algo-complexity type system |
12:14:01 | alexander92 | last autumn |
12:14:07 | alexander92 | yeah, it basically worked like that |
12:14:16 | alexander92 | but never even got to the crazy recursion stuff |
12:15:01 | alexander92 | https://github.com/pseudo-lang/pseudolang#for-now |
12:15:47 | * | nsf quit (Quit: WeeChat 2.4) |
12:15:59 | alexander92 | but complexity is even harder as its basically <=> a lot of symbolic math, numerical cost of resources might be somehow reasonabl |
12:16:01 | * | go|dfish quit (Ping timeout: 248 seconds) |
12:17:41 | FromDiscord_ | <Skaruts> @narimiran will do, hopefully the libs I'm using won't complain |
12:18:11 | FromDiscord_ | <Skaruts> (only using nim-csfml and libtcod_nim) |
12:18:43 | FromDiscord_ | <Skaruts> is there a changelog for 0.20? |
12:18:48 | * | go|dfish joined #nim |
12:19:37 | Araq | damn. over 1000 commits went into 0.20, but we forgot the changelog |
12:19:39 | Araq | :P |
12:21:03 | alexander92 | but recursion can use some heuristics to guess max depth or even one can run the cost system in different scenarios with different parameters to show cost graph for different cases |
12:21:15 | FromDiscord_ | <Skaruts> https://nim-lang.org/blog/2019/06/06/version-0200-released.html |
12:21:21 | FromGitter | <kaushalmodi> Skaruts: https://github.com/nim-lang/Nim/blob/devel/changelogs/changelog_0_20_0.md |
12:21:29 | FromDiscord_ | <Skaruts> Araq you made me have to fight my laziness! |
12:21:30 | FromGitter | <kaushalmodi> yeah :) |
12:21:32 | FromDiscord_ | <Skaruts> I will not forget that! |
12:21:45 | alexander92 | after all if smart testing/fuzzing works for dangling refs, why not apply it to this kind of flow-based estimations |
12:22:14 | FromDiscord_ | <Skaruts> <https://nim-lang.org/blog/2019/06/06/version-0200-released.html> |
12:25:20 | Araq | er... because smart testing/fuzzing is actually admitting that the static mechanism came to its limits? |
12:25:31 | alexander92 | well yes? |
12:25:57 | Araq | so now you moved the goal from "static cost analysis" to "dynamic cost analysis"? |
12:26:04 | Araq | fine with me, but then say so. |
12:26:34 | alexander92 | well , is then the newruntime ref/pointer safety not static? |
12:27:18 | Araq | it's not and the heavy opposition happened because of that |
12:28:08 | FromDiscord_ | <Zim> oi |
12:28:12 | FromDiscord_ | <Zim> quick question |
12:28:21 | FromDiscord_ | <Zim> can i use else if rather than elif? |
12:28:31 | FromDiscord_ | <Zim> or does the syntax ignore that |
12:28:47 | Araq | you can use |
12:28:49 | Araq | else: |
12:28:55 | alexander92 | yeah, but my point is that pointer safety is usually even more central to stuff, so if its a good fit to add dynamic element to it, it might make sense for a cost system as well |
12:28:58 | Araq | if # watch the indentation |
12:29:36 | Araq | alexander92, but then you inject some 'inc pc' statements into the proc body via a macro and you are done. |
12:29:50 | narimiran | Zim what's the problem with `elif`? |
12:32:24 | alexander92 | actually yeah |
12:32:32 | alexander92 | thats a good method as well |
12:32:40 | alexander92 | you can run different input sizes of your programs |
12:33:40 | alexander92 | and record costs for them: for 1 2 3 .. 100 on some scales and based on that statistic to infer a parametric cost |
12:34:07 | alexander92 | e.g. big O , size as function(x memory) etc |
12:34:24 | alexander92 | but probably sounds good, doesnt work |
12:34:26 | FromDiscord_ | <Skaruts> @Zim no `else if` doesn't work |
12:34:48 | * | clyybber joined #nim |
12:54:42 | Araq | clyybber, ! |
13:03:40 | * | laaron quit (Remote host closed the connection) |
13:05:21 | * | laaron joined #nim |
13:13:51 | Araq | clyybber, ? |
13:14:11 | clyybber | Araq: Hi |
13:16:59 | Araq | what's the status? |
13:18:23 | clyybber | Araq: I can't say for sure, travis is refusing to start |
13:18:46 | clyybber | And locally the tests are kinda wonky |
13:19:43 | clyybber | Nevermind, I think it's because `koch test` is not using nim_temp |
13:23:54 | * | solitudesf joined #nim |
13:26:13 | Araq | # callback will be called only once, let GC collect them now |
13:26:13 | Araq | callbacks.next = nil |
13:26:13 | Araq | callbacks.function = nil |
13:26:56 | Araq | ^ not my code, but it shows the problem: reachability != liveness |
13:34:42 | * | lf-araujo joined #nim |
13:41:44 | * | vlad1777d__ quit (Ping timeout: 258 seconds) |
13:43:36 | * | lf-araujo quit (Ping timeout: 252 seconds) |
13:47:52 | * | PMunch quit (Remote host closed the connection) |
13:52:05 | * | solitudesf quit (Ping timeout: 258 seconds) |
14:04:55 | Araq | hmmm what's Firejail? |
14:05:24 | * | laaron quit (Quit: ZNC 1.7.1 - https://znc.in) |
14:05:39 | * | laaron joined #nim |
14:05:47 | Araq | "Firejail wrapper for Nim, Isolate your Production App before its too late!" |
14:05:52 | Araq | ah ok |
14:06:53 | * | lf-araujo joined #nim |
14:07:34 | Araq | asyncmacro.nim(36, 36) Error: '=' is not available for type <owned FutureBase>; requires a copy because it's not the last read of 'next433457'; another read is done here: asyncmacro.nim(41, 12) |
14:08:19 | Araq | that's true... |
14:09:41 | clyybber | I'm getting a lot of those too, in the failing tests that is |
14:09:55 | Araq | my tests are green :P |
14:10:09 | clyybber | mine aren't haha |
14:10:31 | clyybber | I mean the tests of my PR are red |
14:11:57 | clyybber | and still some segfaults ugh |
14:12:04 | * | lf-araujo quit (Ping timeout: 264 seconds) |
14:22:18 | * | vlad1777d joined #nim |
14:28:33 | * | lf-araujo joined #nim |
14:36:29 | * | lf-araujo quit (Remote host closed the connection) |
14:37:02 | * | purebadger quit (Ping timeout: 272 seconds) |
14:41:41 | * | purebadger joined #nim |
14:44:16 | * | arecaceae quit (Remote host closed the connection) |
14:44:36 | * | arecaceae joined #nim |
14:46:57 | * | purebadger quit (Ping timeout: 248 seconds) |
14:48:59 | clyybber | Now this error doesn't make any sense to me at all: https://0bin.net/paste/CMpph0vXy+bspi-y#fXZBKUpvCbrAbwnZbvRZWqhLYUcsEnFGUd74PiZ79ft |
14:50:22 | clyybber | clearly b is NOT an rvalue |
15:07:32 | * | couven92 quit (Quit: Client disconnecting) |
15:10:44 | * | lritter joined #nim |
15:13:08 | * | floppydh quit (Quit: WeeChat 2.5) |
15:18:18 | clyybber | Ugh, its due to the type conversion |
15:18:27 | clyybber | Araq: Any idea on what to do? |
15:19:21 | clyybber | This is a reduced Cpp sample to illustrate the issue more clearly: https://godbolt.org/z/QiMl0R |
15:27:07 | * | Amun_Ra quit (Quit: brb) |
15:30:13 | * | Amun_Ra joined #nim |
15:36:29 | * | nsf joined #nim |
15:42:49 | FromDiscord_ | <Skaruts> is there a technical name for a variable that only ever stores 1 or -1? |
15:53:40 | FromDiscord_ | <Sporgity> Hi, |
15:53:40 | FromDiscord_ | <Sporgity> you know when you install Nim, what destination should I extract all files? |
16:06:31 | * | theelous3 quit (Ping timeout: 268 seconds) |
16:07:05 | FromGitter | <ratiotile> @Skaruts: sounds like a boolean |
16:12:20 | * | seni joined #nim |
16:18:42 | FromGitter | <Varriount> Sporgity: What OS are you using? |
16:19:18 | FromDiscord_ | <Sporgity> Windows |
16:24:37 | * | alexander92 quit (Ping timeout: 245 seconds) |
16:29:54 | * | disruptek wipes away a tear. |
16:40:40 | * | solitudesf joined #nim |
16:52:10 | FromGitter | <Varriount> Sporgity: It shouldn't really matter then |
16:55:30 | FromDiscord_ | <Skaruts> @ratiotile a boolean would 0 and 1 |
16:55:55 | FromDiscord_ | <Skaruts> 0 or 1 |
16:56:00 | narimiran | this is `bool * 2 - 1` :P |
16:57:05 | FromDiscord_ | <Skaruts> in the context of my use case the variable marks a direction, up or down (incrementally speaking) |
16:57:17 | FromDiscord_ | <Skaruts> that's why it 1 or -1 |
16:58:39 | FromDiscord_ | <Skaruts> the value 1 or -1 doesn't represent the increment (it's determined locally, in my case it's actually val*2 or val/2, if 1 or -1 respectively) |
16:59:58 | disruptek | Skaruts: what you want is an enum. |
17:00:26 | FromDiscord_ | <Skaruts> I named it `dir` as in `direction`, but was wondering if there's a name for this |
17:01:15 | disruptek | there was, but directions were removed from Nim in version 0.12. |
17:02:05 | FromDiscord_ | <Skaruts> so I call `change_cell_size(-1)` to reduce the cells on screen, or change_cell_size(1) to make them bigger |
17:02:50 | narimiran | as disruptek said: you want `enum`, with `shrink` and `enlarge` |
17:05:59 | FromDiscord_ | <Skaruts> never heard of that |
17:07:58 | * | Trustable joined #nim |
17:33:34 | FromDiscord_ | <Skaruts> oh I see what you mean |
17:34:06 | FromDiscord_ | <Skaruts> but it would still lead me to the question of what to call the variable that will hold it |
17:34:17 | clyybber | direction I guess |
17:34:42 | FromDiscord_ | <Skaruts> yea I called it `dir` in the meanwhile |
17:34:48 | solitudesf | d |
17:34:57 | FromDiscord_ | <Skaruts> this isn't a big deal at all, I was just wondering about it |
17:35:57 | Araq | wait what? |
17:36:13 | Araq | "directions were removed from Nim in version 0.12"? |
17:36:29 | Araq | must be before I used Nim |
17:36:37 | clyybber | haha |
17:36:41 | FromDiscord_ | <Skaruts> lol |
17:37:13 | clyybber | Araq: Did you see the above issue? |
17:37:25 | Araq | yeah but I'm lost too |
17:37:32 | * | sagax quit (Ping timeout: 272 seconds) |
17:37:43 | FromDiscord_ | <Skaruts> what are these "directions" people are talking about tho? |
17:38:11 | Araq | clyybber, you can stream and then I can tell you your mistake. maybe |
17:39:43 | Araq | btw I'll stream tonight |
17:41:09 | Araq | clyybber, also ... can we get some benchmarks? I wonder if =move is optimized as well as =sink is |
17:41:44 | Araq | the C code is terrible either way but the optimizer shouldn't sweat |
17:51:09 | FromGitter | <ratiotile> @Araq: I have new task benchmark results, using -d:release --x:off, compared to c++=1: if/else = 1, closures = 1.2, await = 6. The iterator closures are a bit trickier to use, but optimize to be much faster than asyncdispatch. |
17:52:11 | Araq | note that we can cheat and map Nim's closure iterators to C++'s solution |
17:52:16 | Araq | PRs are welcome |
17:52:18 | Zevv | I do like the idea on the forum to add an operator for creating tables. proc `%`[T,G,H](a : array[T,(G,H)]) : Table[G,H] or the like. I guess this has been brought up and burned down a few times? |
17:52:33 | * | sagax joined #nim |
17:52:41 | Araq | Zevv, no but the % is already used for Json construction |
17:53:05 | Zevv | yeah, that's why I said 'or the like'. Although it doesn't seem to clash at this time, but its confusing as hell of course. |
17:55:22 | Araq | I think table construction in Nim doesn't come up as often as it does in Python and doesn't need a shortcut tbh |
17:55:47 | Araq | if you know it at compile-time, use an enum for the index and use an array |
17:56:11 | Araq | recently array constructors with explicit indexes made it into the manual... *cough* |
17:56:38 | Zevv | oh? let me find that |
17:58:07 | Zevv | well isn't that nice |
17:58:37 | Araq | it's super old stuff |
17:58:50 | Araq | recently we figured it was never documented :P |
17:59:05 | Zevv | translates one on one to C `[valA] = "A"` ? |
17:59:23 | Araq | nah, why would it |
17:59:33 | Zevv | no idea :) |
17:59:41 | Zevv | Anyway, this helps, never knew it was possible |
17:59:49 | Araq | we don't need C syntax sugar in a codegen |
18:00:04 | Zevv | no, but if you have a sparse array it cuts down on the generated code size |
18:00:27 | Araq | I doubt it |
18:02:34 | Araq | btw I'm looking for VS code plugin that lists the recently used commands as "buttons" or something |
18:02:56 | * | nsf quit (Quit: WeeChat 2.4) |
18:03:05 | Araq | so that I can quickly issue the same command without this stupid UP-UP-DOWN-ENTER-SWEAR dance |
18:03:14 | Zevv | ah I see, you can't even make sparse arrays. "Invalid order in array constructor" |
18:06:15 | Zevv | !eval let t = [ 10: "A", 11: "B", 12: "C" ]; echo t[10] |
18:06:17 | NimBot | Compile failed: /usercode/in.nim(1, 45) Error: index 10 not in 0 .. 2 |
18:06:21 | Zevv | is that a bug? |
18:06:31 | FromGitter | <ratiotile> sparse arrays would have to be hash tables or trees, won't they? |
18:07:05 | rayman22201 | mapping closure iterators to C++ closure iterators sounds awesome in theory! :-D |
18:07:25 | Zevv | depends on your interpretation of sparse I guess. You can make a traditional, sparsely popuplated array, but then most people will not call it sparse |
18:08:22 | clyybber | Araq: Yeah sure, benchmarks I don't have ready yet, but if you want to take a look yourself, you can do `git fetch origin pull/11248/head:sink2move; git checkout sink2move` to try |
18:08:51 | Araq | clyybber, you will hate me for this but ... |
18:09:04 | * | absolutejam1 joined #nim |
18:09:14 | Araq | how about we write the code so that we can switch between both easily? |
18:10:52 | clyybber | I think that will get very very messy |
18:11:27 | Araq | I agree |
18:13:39 | Araq | anyone? |
18:13:46 | Araq | does such a VS extension exist? |
18:16:05 | clyybber | Araq: In twidgets_unown, line 59, the 'b' in 'w.add b' gets interpreted as a call? Thats not normal right? |
18:16:16 | Araq | it's not a call |
18:16:22 | Araq | it's a renderer.nim bug |
18:16:30 | Araq | it's some implicit type conversion node |
18:16:39 | Araq | bbl |
18:16:46 | clyybber | Ah, alright. Thanks |
18:18:30 | * | purebadger joined #nim |
18:31:38 | * | tiorock joined #nim |
18:31:38 | * | tiorock quit (Changing host) |
18:31:38 | * | tiorock joined #nim |
18:31:38 | * | rockcavera is now known as Guest68167 |
18:31:38 | * | tiorock is now known as rockcavera |
18:32:47 | clyybber | Araq: Well, then I know what the issue is. The implicitly-type-conversed gets moved into a temporary, which is then passed to w.add; the problem is that =move takes a var parameter, while the result of the type conversion is an rvlaue (which is why Cpp complains) |
18:35:10 | * | Guest68167 quit (Ping timeout: 272 seconds) |
18:46:12 | * | natrys joined #nim |
18:48:54 | * | lf-araujo joined #nim |
18:52:48 | * | purebadger quit (Ping timeout: 244 seconds) |
18:53:46 | * | lf-araujo quit (Ping timeout: 252 seconds) |
18:55:31 | * | lf-araujo joined #nim |
18:58:47 | * | lf-araujo quit (Remote host closed the connection) |
19:14:41 | * | theelous3 joined #nim |
19:30:53 | * | purebadger joined #nim |
19:36:15 | * | nsf joined #nim |
19:49:28 | * | copygirl quit (*.net *.split) |
19:49:28 | * | SunDwarf quit (*.net *.split) |
19:49:39 | * | Eyess joined #nim |
19:57:28 | FromGitter | <zacharycarter> (https://files.gitter.im/nim-lang/Nim/eO7m/image.png) |
19:57:30 | FromGitter | <zacharycarter> yayyy nuklear is rendering something w/ bgfx |
20:08:03 | * | nsf quit (Quit: WeeChat 2.4) |
20:08:36 | FromGitter | <alehander42> , |
20:12:57 | FromGitter | <zacharycarter> I think I produced a very similar image a couple of years ago |
20:13:01 | FromGitter | <zacharycarter> I just don't remember how I fixed it haha |
20:17:08 | * | alexander92 joined #nim |
20:23:17 | * | lf-araujo joined #nim |
20:24:06 | * | purebadger quit (Ping timeout: 272 seconds) |
20:28:06 | * | Jesin quit (Quit: Leaving) |
20:31:14 | * | Trustable quit (Remote host closed the connection) |
20:31:37 | * | purebadger joined #nim |
20:35:11 | rayman22201 | you have sooo many panes and tabs in your vscode editor @zacharycarter. I would go crazy lol. |
20:35:22 | * | lf-araujo quit (Read error: Connection reset by peer) |
20:35:38 | FromGitter | <zacharycarter> :P |
20:35:40 | * | Jesin joined #nim |
20:36:14 | * | kungtotte quit (Quit: WeeChat 2.5) |
20:37:07 | * | kungtotte joined #nim |
20:41:40 | * | lf-araujo joined #nim |
20:49:47 | * | lf-araujo quit (Remote host closed the connection) |
20:50:42 | * | lf-araujo joined #nim |
20:50:52 | * | narimiran quit (Ping timeout: 245 seconds) |
20:52:43 | Araq | I'm streaming https://www.twitch.tv/araq4k |
20:53:11 | * | Vladar quit (Remote host closed the connection) |
20:54:52 | alexander92 | oh i can stream later |
20:55:22 | alexander92 | brings some discipline |
20:58:55 | stefanos82 | Araq: did you typed foO() on purpose? |
20:59:37 | stefanos82 | yep, you just answered my question lol |
21:09:49 | FromGitter | <Kvothe87> L |
21:11:10 | dom96 | That's a late time to be streaming :o |
21:15:00 | * | jjido joined #nim |
21:17:07 | * | purebadger quit (Ping timeout: 245 seconds) |
21:18:46 | * | jjido quit (Client Quit) |
21:19:34 | * | gangstacat quit (Quit: Δis!) |
21:20:17 | rayman22201 | is it just me or is Araq's volume very low? I can barely hear him |
21:23:04 | FromGitter | <Kvothe87> ... |
21:31:05 | rayman22201 | nvm.... I have a short in my headphones :/ |
21:37:20 | FromGitter | <dawkot> Why is Nim not checking ranges when accessing stuff on the JS backend? |
21:46:29 | * | laaron- joined #nim |
21:50:16 | * | laaron quit (Ping timeout: 260 seconds) |
22:28:52 | Araq | rayman22201, oh sorry |
22:29:05 | Araq | the mic is always too far away on my desk, I think |
22:29:25 | rayman22201 | no worries. It wasn't you. My headphones broke :( |
22:29:50 | rayman22201 | I put you through my speaker, and you were very loud. |
22:30:07 | Araq | ah damn |
22:30:14 | Araq | now I remember what I wanted to implement |
22:30:36 | rayman22201 | quick. write a note so you don't forget again! |
22:30:46 | rayman22201 | and then go to sleep |
22:30:58 | Araq | caching of 'nim c -r foo.nim' results. |
22:31:06 | Araq | only recompile that if something changed |
22:31:18 | Araq | so that I can always use 'nim c -r' without paying the price for it :p |
22:32:10 | rayman22201 | hrmmm. good idea but you might want a "force-recompile" flag to override the cache then |
22:32:32 | disruptek | that already exists. |
22:32:53 | Araq | yeah, exactly. |
22:33:00 | rayman22201 | ah. cool. nvm then |
22:33:09 | Araq | -f or --forceBuild |
22:33:13 | Araq | just fyi |
22:33:26 | disruptek | you're right that this is a good use for it, though. |
22:33:39 | * | gangstacat joined #nim |
22:35:38 | rayman22201 | for when I can't allow my compile time turing complete cellular automata to be cached! :-P |
22:38:19 | * | natrys quit (Quit: natrys) |
22:40:03 | * | solitudesf quit (Ping timeout: 245 seconds) |
22:50:10 | * | lf-araujo quit (Quit: lf-araujo) |
22:50:26 | * | lf-araujo joined #nim |
22:51:49 | * | abm quit (Quit: Leaving) |
22:52:47 | * | clyybber quit (Quit: WeeChat 2.5) |
23:08:15 | * | stefanos82 quit (Quit: Quitting for now...) |
23:29:05 | * | lf-araujo_ joined #nim |
23:29:52 | * | lf-araujo quit (Ping timeout: 252 seconds) |
23:29:55 | * | lf-araujo_ is now known as lf-araujo |
23:30:56 | * | absolutejam1 quit (Ping timeout: 272 seconds) |
23:54:34 | * | lf-araujo quit (Ping timeout: 268 seconds) |
23:57:26 | * | krux02_ joined #nim |