00:39:23 | * | cspar quit (Ping timeout: 252 seconds) |
00:41:44 | nchambers | libman: to be fair, nim macros are based on lisp |
00:52:22 | ldlework | based on lisp, or happen to be similar? |
00:54:02 | nchambers | I thought I remembered Araq telling me they were based on lisp's, but I could be mistaken |
00:54:09 | nchambers | I know he really really likes lisps though |
01:05:13 | libman | You could have told me they're based on the Bhagavad Gita and I'd believe it. Parts of Nim too far away from Python are all Sanskrit to me. ;) |
01:08:34 | * | cspar joined #nim |
01:10:10 | libman | The vast majority of books in AZ's "Lisp Programming" category are either about genuinely Lispy languages (Common Lisp, Scheme, Clojure(Script), Racket, etc) or general programming topics (including The Holy SICP). |
01:15:14 | libman | Or Emacs of course. There I found a couple of Functional Python / Perl books in that AZ "Lisp Programming" category's Top 100, but that seems more fitting that "Nim In Action". We should invade the Python category instead. |
01:17:44 | libman | The "#1 New Release in Lisp Programming" right below the title could mislead some people - https://archive.is/1QI5p#selection-4926.0-4937.16 |
01:20:17 | libman | If you scroll down, it also mentions the book being in "Ruby" and "Object-Oriented Software Design" categories. I'm not complaining, just wondering if that's an accident. |
01:26:12 | ldlework | A post I made about my experience in VR this weekend, https://www.reddit.com/r/oculus/comments/67605m/i_had_a_very_social_vr_weekend/ |
01:30:45 | * | deech` quit (Ping timeout: 240 seconds) |
01:36:50 | * | chemist69 quit (Ping timeout: 255 seconds) |
01:40:05 | * | cspar quit (Ping timeout: 240 seconds) |
01:49:18 | * | vlad1777d quit (Quit: Leaving) |
01:51:07 | * | chemist69 joined #nim |
02:02:35 | * | cspar joined #nim |
02:07:54 | zachcarter | I got pretty far with karax before needing ajax, and then I hit a wall |
02:37:21 | * | krux02 quit (Remote host closed the connection) |
03:06:27 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
03:24:18 | * | yglukhov joined #nim |
03:28:53 | * | yglukhov quit (Ping timeout: 255 seconds) |
03:37:28 | * | krux02_ quit (Remote host closed the connection) |
03:51:32 | * | zachcarter quit (Quit: zachcarter) |
04:09:32 | * | cspar quit (Ping timeout: 240 seconds) |
04:22:07 | FromGitter | <Varriount> zachcarter: What's the wall? |
04:40:28 | * | BennyElg quit (Remote host closed the connection) |
04:40:31 | shashlick | Nim crashes if I use a channel without opening it, honest mistake but it just crashes without a stack trace |
04:59:08 | * | adeohluwa joined #nim |
05:11:22 | * | BennyElg joined #nim |
05:30:04 | BennyElg | guys httpclient and ssl |
05:30:06 | BennyElg | is it possible? |
05:30:07 | * | rauss quit (Quit: WeeChat 1.7) |
05:40:15 | * | xet7 joined #nim |
05:44:58 | BennyElg | I need to download files from google drive |
06:03:53 | def- | BennyElg: yeah, compile with -d:ssl |
06:04:13 | BennyElg | Yea I did it it worked but Still struggle download files from google drive. |
06:04:37 | BennyElg | probably an Auth failures I'll try to figure it out. |
06:09:36 | * | BennyElg quit (Remote host closed the connection) |
06:10:11 | * | BennyElg joined #nim |
06:10:15 | * | BennyElg quit (Read error: Connection reset by peer) |
06:37:30 | * | BennyElg joined #nim |
06:46:43 | * | nsf joined #nim |
06:58:12 | * | Vladar joined #nim |
07:09:17 | BennyElg | how do I connect google account from NIM |
07:15:05 | * | cspar joined #nim |
07:24:16 | * | rokups joined #nim |
07:29:55 | FromGitter | <Varriount> BennyElg: What do you mean? |
07:30:22 | BennyElg | I have a shared google drive folder , I need to download the files inside |
07:32:08 | * | gokr joined #nim |
07:34:21 | * | yglukhov joined #nim |
07:37:44 | * | delian66 joined #nim |
07:39:03 | * | adeohluwa quit (Quit: Connection closed for inactivity) |
07:42:45 | * | adeohluwa joined #nim |
07:50:57 | FromGitter | <Varriount> Are you able to make the files public? |
07:51:20 | * | bjz joined #nim |
08:03:06 | BennyElg | I cant do it public. |
08:05:54 | BennyElg | But I suppose to login into my account which is authorized to download anything. |
08:21:07 | * | libman quit (Quit: Connection closed for inactivity) |
08:23:14 | * | Arrrr joined #nim |
09:05:31 | FromGitter | <TiberiumPY> Oh, it's not that easy |
09:05:56 | FromGitter | <TiberiumPY> There's no support for storing cookies in httpclient |
09:11:32 | BennyElg | Ya I notice that |
09:11:37 | BennyElg | very annoying |
09:12:18 | chemist69 | Just plugged Nim here: https://www.linuxvoice.com/voice-of-the-masses-whats-your-favourite-programming-language/ |
09:12:27 | * | vlad1777d joined #nim |
09:12:43 | * | BennyElg quit (Remote host closed the connection) |
09:13:09 | * | BennyElg joined #nim |
09:17:32 | * | BennyElg quit (Ping timeout: 240 seconds) |
09:26:02 | * | BennyElg joined #nim |
09:48:48 | * | couven92 joined #nim |
10:00:17 | * | sz0 joined #nim |
10:10:24 | * | couven92 quit (Quit: Client disconnecting) |
10:31:16 | * | zachcarter joined #nim |
10:34:28 | zachcarter | xmlhttprequest callbacks are a pain |
10:34:49 | * | Tiberium joined #nim |
10:51:40 | zachcarter | can’t figure out a good way to have nim functions invoked as callbacks to xmlhttprequests |
10:53:56 | BennyElg | :/ |
10:54:41 | zachcarter | I’ve copied the code Araq has in ajax.nim in karak but it doesn’t seem to work correctly |
10:56:15 | BennyElg | I need some examples of ajax.nim to seek for information. |
10:57:00 | zachcarter | sure |
10:57:14 | zachcarter | https://github.com/pragmagic/karax/blob/master/src/ajax.nim |
10:58:35 | Araq | zachcarter: well it's pretty much untested I'm afraid |
10:58:42 | Araq | what's wrong with it? |
10:58:51 | zachcarter | Araq: callbacks never get invoked |
10:58:55 | zachcarter | can’t be found |
10:59:12 | zachcarter | Araq: i had a busy weekend, I built a playground for nim and I started on a front end for it with karax |
10:59:34 | Araq | wow cool |
10:59:37 | zachcarter | dom helped me with the playground |
11:02:16 | zachcarter | curl -X POST http://162.243.192.65:80/compile -H 'content-type: application/json' -d '{"code": "echo \"hello world!\""}' |
11:02:45 | * | Snircle joined #nim |
11:06:25 | zachcarter | also @Araq another issue with karax : I have trouble importing the modules when I use karax in another project via nimble |
11:14:39 | Tiberium | hmm, I'm porting python gTTS module to Nim, and I wanted to ask - https://github.com/Boudewijn26/gTTS-token/blob/master/gtts_token/gtts_token.py#L61 do I really need to use regexps or it would be fine if I would use a couple of splits? |
11:15:53 | zachcarter | http://imgur.com/a/QZwbd |
11:16:00 | zachcarter | my results so far with karax and spectre css / ace editor |
11:16:35 | zachcarter | Tiberium: I’d resort to regexs as a last measure, personal advice |
11:16:45 | zachcarter | it adds an extra dependency if you want to use the perl like regexes |
11:16:45 | Tiberium | zachcarter, ok |
11:16:54 | Tiberium | I can easily do it with splits |
11:16:56 | * | krux02 joined #nim |
11:17:02 | * | krux02 quit (Disconnected by services) |
11:17:02 | * | krux02- joined #nim |
11:17:05 | * | krux02- is now known as krux02 |
11:17:20 | zachcarter | the regexes are super powerful, but I tried to use them with frag and then all of a sudden I needed extra dlls and windows and such |
11:17:20 | Tiberium | so I would do "a = line.split(r"var a\x3d")[1].split(";")[0]" and "b = line.split(r"var b\x3d")[1].split(";")[0]" |
11:17:21 | * | krux02_ joined #nim |
11:17:45 | zachcarter | so I just used splits like you’re advocating for |
11:17:57 | zachcarter | since my situation was similar in that it could be handled easily with splits |
11:18:11 | zachcarter | and then I just ended up using parseconfig and re-wrote the thing that generates the file |
11:18:27 | Tiberium | I don't want to use regexps myself, because I don't know them and they needs to be ported for nim's re module |
11:18:36 | Tiberium | (from python regexps) |
11:18:44 | zachcarter | btw don’t use re |
11:18:45 | zachcarter | use nre |
11:19:03 | * | adeohluwa quit (Quit: Connection closed for inactivity) |
11:19:20 | zachcarter | porting the regexs should be relatively trivial, but if you don’t know regex heh that’s going to make things complicated :P I think you have the right approach here |
11:20:31 | * | arnetheduck joined #nim |
11:23:33 | BennyElg | var nxr = ajax.newXMLHttpRequest() |
11:23:33 | BennyElg | var x = ajax.open(nxr, "GET", "address") |
11:23:35 | BennyElg | what is wrong : |
11:26:33 | zachcarter | BennyElg nothing there |
11:27:13 | zachcarter | https://github.com/pragmagic/karax/blob/master/src/ajax.nim#L25 |
11:27:14 | zachcarter | it’s that |
11:28:48 | zachcarter | sorry BennyElg if I interrupted what you. I mistook what you were typing for Nim not JS :P |
11:28:54 | zachcarter | interrupted you* |
11:29:39 | BennyElg | I'm trying to fetch the source code from some site and parse it ( In python I would you Machanize / requests and BeautifulSoup) |
11:31:41 | Tiberium | BennyElg, why are you using ajax? is it JS? or Nim? |
11:32:01 | Tiberium | you want to write code for JS backend? |
11:32:07 | BennyElg | since i get an error when I try with the http client I get not supported js |
11:32:46 | BennyElg | The site is not delivered properly its says I should enable the js |
11:32:46 | Tiberium | BennyElg, it would be the same |
11:32:54 | BennyElg | :\ |
11:32:56 | Tiberium | BennyElg, because website depends on JS |
11:33:08 | Tiberium | it means that you need to actually interpret this JS |
11:33:16 | Tiberium | maybe there's selenium for nimlang, I don't know |
11:34:05 | zachcarter | Tiberium: I’m using ajax in my karax project for the nim playground I built |
11:34:16 | Tiberium | zachcarter, because you're doing JS backend? |
11:34:21 | Tiberium | *for |
11:34:43 | zachcarter | no I wrote a nim backend |
11:35:10 | zachcarter | https://github.com/zacharycarter/nim-playground |
11:35:36 | Tiberium | zachcarter, I mean karax is using JS backend probably |
11:35:42 | zachcarter | oh yes exactly |
11:37:15 | zachcarter | I think I’m going to use https://github.com/tachyons-css/tachyons instead of spectre-css |
11:40:52 | * | krux02 quit (Remote host closed the connection) |
11:40:59 | * | krux02_ quit (Quit: Leaving) |
11:42:07 | FromGitter | <couven92> Araq: what about my `vccexe` PR (https://github.com/nim-lang/Nim/pull/5575)? You said it was hard to review, and I have followed your suggestions to simplify... But was there anything more you wanted me to do with it? |
11:49:03 | FromGitter | <dom96> zachcarter: tachyons looks a bit fragmented |
11:49:19 | zachcarter | hrm :/ |
11:49:26 | FromGitter | <dom96> What's wrong with spectre? |
11:49:54 | zachcarter | I just kind of liked the compositional and post css aspects of tachyons |
11:49:58 | FromGitter | <dom96> also, you should add support for JSONP to your backend |
11:50:08 | zachcarter | okay I’ll figure out how to do that and do that today |
11:50:24 | zachcarter | I’m kind of stalled on the front end until the ajax stuff gets figured out |
11:50:31 | zachcarter | unless I want to write a bunch of JS which I don’t :P |
11:50:32 | FromGitter | <dom96> or you can just create your own AJAX requests |
11:50:36 | FromGitter | <dom96> it shouldn't be too hard |
11:50:51 | zachcarter | I am but the callbacks are the issue |
11:51:10 | zachcarter | I’m using emit to create them |
11:51:16 | FromGitter | <dom96> Just look at how it's done in JS and copy it |
11:51:28 | zachcarter | thats’ basically what I’ve done but the problem is scoping |
11:51:45 | zachcarter | dom96: here - https://github.com/pragmagic/karax/blob/master/src/ajax.nim#L25 |
11:52:09 | zachcarter | contwrapper won’t be found |
11:53:11 | FromGitter | <dom96> Well I'm at work now so can't help much |
11:53:24 | zachcarter | np |
11:53:57 | FromGitter | <dom96> But i would wrap the JS procs instead using so much emit. |
11:54:09 | zachcarter | okay I’ll try that |
11:54:27 | zachcarter | thx for the pro tip |
11:56:18 | FromGitter | <stisa> Zachcarter, I wrote an ajax wrapper some time ago, maybe you can try using that? |
11:56:29 | zachcarter | just found it stisa :P I’m on it :D |
11:56:38 | zachcarter | hoping I wont’ run into namespace collision but about to find out |
11:57:38 | * | couven92 joined #nim |
11:58:03 | zachcarter | yeah ns collisions hrm |
11:58:58 | zachcarter | I just deleted ajax.nim from karax for now :P |
12:02:11 | ftsf | o/ |
12:02:22 | ftsf | howdy zachcarter, dom96 |
12:02:38 | zachcarter | o/ ftsf |
12:04:43 | ftsf | you're playing with nim -> js ? |
12:05:34 | zachcarter | yup! playing with karax |
12:47:52 | * | krux02 joined #nim |
12:54:53 | zachcarter | http://imgur.com/a/9mwCL |
12:54:54 | zachcarter | work time |
12:56:09 | Tiberium | zachcarter, a small suggestion: flush compiler log on every new compilation :) |
12:56:22 | Tiberium | ( i mean on web page) |
12:56:55 | Tiberium | I mean to clear compiler log |
12:57:52 | zachcarter | Tiberium: will do :) thank you |
12:58:08 | * | bjz quit (Ping timeout: 255 seconds) |
12:58:24 | * | bjz_ joined #nim |
13:02:19 | * | zachcarter quit (Quit: zachcarter) |
13:02:26 | * | antranigv quit (Ping timeout: 252 seconds) |
13:02:55 | * | antranigv joined #nim |
13:04:15 | * | PMunch joined #nim |
13:09:49 | * | antranigv quit (Ping timeout: 260 seconds) |
13:15:18 | PMunch | Hmm, trying out karax and I have some issues |
13:15:23 | PMunch | I ran nimble install in karax root |
13:15:30 | PMunch | Which seems to have worked fine |
13:15:51 | PMunch | But when I try to run "nim js karax" it complains that it can't find vdom.. |
13:15:53 | * | krux02 quit (Remote host closed the connection) |
13:15:58 | couven92 | Araq, PMunch just informed me that people are having trouble with the windows release, because `vccexe` is not included in the release, and as I desribe in https://www.reddit.com/r/nim/comments/66jz7n/the_quest_for_vccexe/dgoiuto/ it is kinda annoying to build `vccexe` without the MinGW backend... |
13:17:10 | couven92 | I'll modify the Windows instructions with more information on the only Windows/VCC-only scenario |
13:20:43 | Tiberium | wow, github organization is so easy to setup |
13:20:56 | Tiberium | you only need a keyboard and mouse :D |
13:21:00 | Tiberium | no console required |
13:24:07 | * | antranigv joined #nim |
13:24:24 | PMunch | What're you setting up an organization for? |
13:30:58 | * | PMunch quit (Quit: leaving) |
13:32:10 | * | PMunch joined #nim |
13:38:08 | * | vlad1777d quit (Ping timeout: 258 seconds) |
13:41:53 | FromGitter | <zacharycarter> B: |
13:43:02 | * | nsf quit (Quit: WeeChat 1.7) |
13:45:14 | * | antranigv quit (Ping timeout: 268 seconds) |
13:46:11 | * | zachcarter joined #nim |
13:46:18 | FromGitter | <zacharycarter> Oops |
13:50:13 | FromGitter | <edlich_twitter> Can someone tell me how to assign multiple values in an array slice? like myarr[2..4] = 42 if this is declared: myarr: array[0..20,int] ?! (I got type mismatch) |
13:55:40 | Araq | myarr[2..4] = [42, 42, 42] you're better off with a macro for this |
13:57:07 | flyx | there's also myarr[2..4] = repeat(42, 3) |
13:57:23 | FromGitter | <edlich_twitter> oh repeat is cool thanks!! |
13:57:32 | flyx | it's in sequtils |
13:57:52 | flyx | it's not the most efficient method though |
13:58:14 | FromGitter | <edlich_twitter> ok I check performance later ;-) |
13:59:12 | * | vlad1777d joined #nim |
14:09:30 | PMunch | Hmm, repeat could be implemented as a macro |
14:10:11 | flyx | only if the number of components is known at compile time |
14:10:15 | PMunch | I wrote a simple macro to generate a set of points that make up a circle with certain parameters to save doing it on runtime |
14:10:20 | PMunch | flyx, that's true |
14:10:44 | PMunch | Is there a way to define a macro with a procedure fallback? |
14:11:12 | flyx | I guess you can overload it, the macro with a int{lit} parameter, the proc with a normal int parameter |
14:13:35 | flyx | but I tried that once and got a compiler error |
14:20:30 | flyx | PMunch: this works: https://gist.github.com/flyx/0c98d205c96c84279ce2ae4f20a8225f |
14:23:51 | * | Arrrr quit (Ping timeout: 260 seconds) |
14:26:36 | PMunch | Hmm, that's only for literals though.. |
14:26:44 | PMunch | Would it be possible to overload with static? |
14:27:34 | PMunch | ie. have the macro be macro repeat(value: untyped, num: static[int]): untyped |
14:27:54 | PMunch | And the proc be: proc repeat(value: untyped, num: int): seq[T] |
14:29:03 | FromGitter | <Varriount> PMunch: might work |
14:29:20 | flyx | no, it always calls the proc |
14:29:23 | flyx | but I don't know why |
14:29:33 | PMunch | Hmm, that's strange |
14:29:37 | flyx | it works if the proc does not exist, but only for the first call (obviously) |
14:30:11 | flyx | Araq can probably shed some light on this, perhaps it's a bug |
14:30:50 | * | BennyElg quit (Remote host closed the connection) |
14:31:15 | flyx | I wonder why static is a special type and not just a constraint, like {static} |
14:31:17 | * | BennyElg joined #nim |
14:32:19 | Araq | yeah, it should have been a constraint |
14:32:54 | Araq | but it also affects macro usage, in a macro a param: static[int] is an int, not a NimNode with kind == nnkIntLit ... |
14:33:32 | Araq | I'm not sure why untyped matches worse than 'T', it shouldn't |
14:34:11 | Araq | that said, it's all a bit misguided code, use TR template/macro to optimize it away properly |
14:34:56 | Araq | overloading is to enable compiletime polymorphism, not optimizations |
14:35:41 | * | BennyElg quit (Ping timeout: 260 seconds) |
14:39:08 | PMunch | So a template that either calls the macro or the proc? |
14:39:35 | flyx | Araq: this still calls the proc both times: https://gist.github.com/flyx/0c98d205c96c84279ce2ae4f20a8225f |
14:40:30 | PMunch | What's that syntax flyx? |
14:40:44 | flyx | term rewriting syntax, as Araq suggested |
14:41:17 | PMunch | Oh |
14:41:34 | flyx | it works with int{lit} as expected |
14:43:47 | Araq | yeah, static T is still a piece of junk tbh |
14:44:18 | Araq | and its spec repeats lots of C++'s mistakes |
14:44:34 | PMunch | Hmm, in the examples above. Is Nim able to see that a=3 on compile-time? |
14:44:54 | PMunch | Araq, so it should be rewritten? |
14:45:02 | PMunch | Like a constraint? |
14:45:52 | Araq | PMunch: var a = 3 is not a constant |
14:46:49 | PMunch | Yeah I know, but I was wondering if Nim was able to see if it didn't actually change |
14:46:55 | PMunch | But I guess that would be weird |
14:47:08 | Araq | it's not hard to detect this in an optimizer, but we don't |
14:47:27 | Araq | also, this is not what I meant |
14:49:46 | * | McSoFake joined #nim |
14:51:40 | flyx | if static[T] would be merged into constraints, would the problems go away? |
14:55:08 | zachcarter | Araq: suggestion for karax |
14:55:27 | zachcarter | maybe remove the ajax source file and instead allow users to use : https://github.com/stisa/ajax |
14:55:57 | Araq | flyx: I added another comment what should be possible |
14:56:01 | Araq | but isn't ... |
14:58:21 | Araq | zachcarter: but karax needs its own version so that it calls 'redraw' for you |
14:58:38 | Araq | let's just fix my ajax.nim instead. |
14:58:42 | zachcarter | okay |
14:59:08 | Araq | I could rename the module to kajax though to avoid name clashes |
14:59:30 | zachcarter | probably wouldn’t hurt |
14:59:40 | Araq | we have path disambiguation for that but ok |
14:59:40 | zachcarter | I can add the required wrappers when I get home tonight |
14:59:59 | zachcarter | if you don’t get around to it first |
15:00:29 | * | couven92 quit (Quit: Client disconnecting) |
15:01:09 | Araq | seems easy to fix, ajax.setRequestHeader is wrong |
15:01:33 | Araq | oh no hmmm |
15:01:58 | PMunch | Oh Araq, about Karax |
15:02:21 | PMunch | My Nim 0.16.1 complains that it can't find vdom after I ran nimble install |
15:02:53 | zachcarter | PMunch: it looks like a fix just got commited for taht |
15:02:55 | zachcarter | that* |
15:02:57 | zachcarter | I’d try reinstalling karax |
15:03:04 | Araq | yup |
15:03:06 | PMunch | Oh okay |
15:03:11 | PMunch | I'll try that soon |
15:03:16 | PMunch | But now I've got to go |
15:03:16 | * | PMunch quit (Quit: leaving) |
15:04:01 | Araq | can we also divert more from the DOM? cause it makes no sense ... <input type="button"> wtf, that should be <button> |
15:05:11 | flyx | Araq: well, my question was rather since there are problems with static[T], would it make sense to implement it via constraints because that seems to do better with type checking. I imagine that this could lead to fewer code in the compiler. |
15:06:04 | Araq | flyx: yes, that would be really nice and there is no reason it wouldn't work |
15:08:32 | * | couven92 joined #nim |
15:09:32 | Araq | zachcarter: got some snippet for me to test ajax.nim? |
15:09:59 | Araq | couven92: yeah, I know, release 0.17 will fix that and there are only ~3 bugs left before it should be ready |
15:10:44 | couven92 | ok... I have written up a VCCEXE only installation instructions now |
15:11:08 | flyx | Araq: can you give me a pointer where static[T] is implemented? I'm interested in trying to implement it as pattern. I found the pattern matching in the compiler, the static[T] is harder to find |
15:11:22 | couven92 | I have forked the website already, was planning on submitting a PR later today :) |
15:12:13 | Araq | flyx: it's tyStatic in the compiler, most of the lifting is done in sigmatch.nim and perhaps semtypes.nim |
15:12:31 | flyx | okay, I'll check it out |
15:13:23 | Araq | flyx: great, I can give you more specific instructions |
15:13:59 | zachcarter | Araq: I can write one |
15:14:03 | zachcarter | one sec |
15:14:22 | * | Arrrr joined #nim |
15:14:26 | flyx | Araq: one question is whether it is possible to keep the macro semantics (i.e. direct value instead of NimNode) |
15:14:49 | Araq | flyx: yeah, pretty sure that works out too |
15:15:47 | flyx | but I want to have matching working before I try that |
15:17:22 | Araq | yeah that's simple, just make the matching ignore nkHiddenAddr and nkHiddenStdConv |
15:17:34 | Araq | there should be logic for that already |
15:17:56 | flyx | since I'm still at work, I will probably come later with questions |
15:22:48 | * | nsf joined #nim |
15:23:30 | zachcarter | Araq: https://gist.github.com/zacharycarter/3b5fb4df4b4bf795422eacdc079f358b |
15:24:44 | * | BennyElg joined #nim |
15:41:27 | * | krux02 joined #nim |
15:42:15 | * | Nopply quit (Read error: Connection reset by peer) |
15:43:28 | * | bjz_ quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
15:44:04 | Araq | zachcarter: fixed. |
15:44:10 | zachcarter | sweet! |
15:44:34 | Araq | things work better without .emit ;-) |
15:44:40 | * | adeohluwa joined #nim |
15:44:40 | zachcarter | haha yeah |
15:45:39 | zachcarter | do you care if I add ajaxPost ? |
15:48:39 | Araq | I think PUT should have been POST |
15:49:07 | couven92 | https://github.com/nim-lang/website/pull/28 PR with `vccexe` build instructions... (Until we ship with `vccexe`)... |
15:49:13 | * | antranigv joined #nim |
15:49:56 | Araq | zachcarter: fixed |
15:50:02 | zachcarter | thank you Araq |
15:50:38 | Araq | ideally I would like to have send/recv and move away from this strange thing called HTTP |
15:50:57 | zachcarter | would be sweet |
15:51:18 | zachcarter | I’m going to put up the front end to the service I wrote tonight, and get it working with JSONP |
15:51:45 | zachcarter | and whenever interest arises to expose it somewhere we can just set up DNS entries |
15:51:55 | Araq | but abstractions don't work well with these web standards, IMHO |
15:54:07 | * | BennyElg quit (Ping timeout: 240 seconds) |
16:12:34 | * | BennyElg joined #nim |
16:41:00 | demi- | Araq: i have a stdlib question; would you consider accepting a PR on ospaths that would provide a method for normalizing a given path? I ran into a bug regarding this in nimble and when i was fixing it found that it implemented its own methods for normalizing a path (was surprised this wasn't part of a stdlib module) |
16:48:57 | * | devted joined #nim |
16:55:06 | * | brson joined #nim |
17:17:13 | * | yglukhov quit (Remote host closed the connection) |
17:27:13 | Tiberium | wow, I had two nimble requirements (strfmt and colorize), and easily changed them to stdlib |
17:27:35 | Tiberium | I didn't really thought that "terminal" colors is so easy to use |
17:48:11 | zachcarter | Araq: I get the following error with the latest karax when using events - |
17:48:34 | zachcarter | Error: ambiguous identifier: 'Event' --use dom.Event or dom.Event |
17:48:40 | shashlick | nim crashes if -d:release but works fine with -d:quick, no -d |
17:48:56 | zachcarter | shashlick check for asserts |
17:49:03 | * | adeohluwa quit (Quit: Connection closed for inactivity) |
17:49:03 | zachcarter | -d:release removes them |
17:51:38 | krux02 | Tiberium: hmm I am thinking to remove standard echo with strfmt, because I really like that package |
17:52:07 | Tiberium | krux02, I like it too, but I used strfmt's interp literally in 3 strings only |
17:52:21 | Tiberium | I mean only in three strings |
17:53:44 | krux02 | ok then the dependency is really not necessary |
17:54:06 | krux02 | I hope though that the best string library (strfmt at the moment) get's into standard nim before 1.0 |
17:54:20 | krux02 | the current string printing system really allocates a lot of stuff |
17:54:41 | krux02 | doesn't matter that much for things that are actually printed, but it can be done better |
17:55:02 | krux02 | but anyway it's not a priority and I have to go |
17:55:13 | * | krux02 quit (Remote host closed the connection) |
17:55:21 | * | yglukhov joined #nim |
17:55:35 | * | couven92 quit (Quit: Disconnecting) |
17:59:55 | * | yglukhov quit (Ping timeout: 268 seconds) |
18:05:03 | * | Trustable joined #nim |
18:06:32 | * | adeohluwa joined #nim |
18:12:24 | shashlick | for some reason, -d:release doesn't let me open any audio devices using BASS.dll, whereas -d:quick or debug works just fine |
18:13:48 | Tiberium | shashlick, maybe -d:release optimizes away some variables? |
18:16:14 | shashlick | Tiberium: how would I find out? |
18:16:50 | * | Matthias247 joined #nim |
18:17:02 | Tiberium | shashlick, ¯\_(ツ)_/¯ I don't really know the real reason, I'm not an experienced dev in Nim :) |
18:18:04 | * | PMunch joined #nim |
18:21:37 | shashlick | same issue with having to use stdcall - have to use every proc within BASS with stdcall, else it crashes somewhere or the other |
18:21:57 | dom96 | shashlick: I hope you know that you can {.push stdcall.} |
18:22:06 | dom96 | instead of annotating every proc with {.stdcall.} |
18:22:29 | dom96 | Remember that all assert calls are optimised away in -d:release |
18:22:33 | shashlick | where would I put that? just globally in the file |
18:22:50 | dom96 | yeah |
18:26:14 | shashlick | neat, starting to love these pragmas |
18:29:29 | Tiberium | dom96, really? you can do that? lol |
18:29:38 | dom96 | yep |
18:32:23 | PMunch | Hmm, with the newest version of Karax I don't get the missing vdom error. But now I have another issue |
18:32:30 | PMunch | components.nim(58, 17) Error: index out of bound |
18:33:32 | Tiberium | what? https://nim-lang.org/0.11.0/redis.html redis library was in stdlib? |
18:45:04 | PMunch | Hmm, x is of len 1 |
18:45:18 | PMunch | Which is weird since it's supposed to be a rather long enum by the looks of it |
18:49:00 | * | TheLemonMan joined #nim |
18:52:20 | dom96 | Tiberium: yep |
18:52:27 | dom96 | before Nimble's time :) |
18:58:40 | Tiberium | how can I fix a problem in nimongo library: it tries to do max() with two uint32's |
18:58:50 | Tiberium | https://github.com/SSPkrolik/nimongo/blob/master/nimongo/pbkdf2.nim#L140 |
19:02:37 | * | rauss joined #nim |
19:18:59 | Tiberium | anyone knows how to enable auto-completion in https://github.com/pragmagic/vscode-nim/ ? |
19:21:13 | * | Sembei joined #nim |
19:21:44 | * | vivus joined #nim |
19:23:20 | * | Pisuke quit (Ping timeout: 260 seconds) |
19:24:10 | * | cspar_ joined #nim |
19:24:41 | * | Ven joined #nim |
19:25:05 | * | Ven is now known as Guest50256 |
19:25:56 | * | cspar quit (Ping timeout: 240 seconds) |
19:26:58 | * | Arrrr quit (Quit: Leaving.) |
19:27:43 | * | bjz joined #nim |
19:29:04 | Tiberium | oh wait |
19:29:07 | Tiberium | what the heck? |
19:29:21 | * | vendethiel joined #nim |
19:29:24 | Tiberium | my "nimsuggest" is showing that it is a compiler, not an actual nimsuggest |
19:37:50 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
19:42:44 | PMunch | Ah, never mind. Just updated my Nim to the latest devel version (from an older 0.16.1 devel version) and now it compiles. |
19:45:03 | * | Tiberium quit (Read error: Connection reset by peer) |
19:45:21 | * | Sentreen quit (Ping timeout: 258 seconds) |
19:45:29 | * | Tiberium joined #nim |
19:45:42 | Tiberium | oh FINALLY |
19:45:48 | Tiberium | I GOT IT f*ckin working |
19:46:06 | Tiberium | it seems that I had another system nim installed |
19:47:32 | * | Guest50256 quit (Ping timeout: 240 seconds) |
19:50:31 | PMunch | Haha, yeah that complicates things :P |
19:51:01 | PMunch | One of the first things I do when stuff fails with strange errors is a "nim -v" |
19:51:11 | zachcarter | PMunch: you got karax working? |
19:52:37 | Tiberium | PMunch, you know, I programmed in Nim without basic auto-completion. So at least I've learned more :D |
19:52:44 | Tiberium | because I had to memorize every name |
19:52:53 | PMunch | zachcarter, yeah got it working fine :) |
19:52:57 | PMunch | Really cool project |
19:53:10 | PMunch | Tiberium, that's how I roll |
19:53:17 | zachcarter | PMunch: Are events working for you? |
19:53:25 | PMunch | Events? |
19:53:26 | zachcarter | I’m getting errors when I try to set up an event handler |
19:53:38 | zachcarter | here please try compiling this |
19:53:44 | PMunch | Everything seems to be working in both the mediaplayer and the todolist |
19:53:51 | PMunch | But that's what I've tried :P |
19:54:01 | zachcarter | https://gist.github.com/zacharycarter/eeadf3d21267dcd56f4abc1bda9212a9 |
19:54:09 | zachcarter | ah I’m using it from another project |
19:54:13 | zachcarter | err in another project |
19:54:16 | zachcarter | and that code is failing to compile |
19:55:24 | PMunch | test.nim(22, 15) Error: Error: ambiguous identifier: 'Event' --use dom.Event or dom.Event |
19:55:25 | PMunch | Hmm |
19:55:32 | zachcarter | yeah that’s the error I get too |
19:56:14 | PMunch | Really strange error :P |
19:56:20 | zachcarter | agreed |
19:56:27 | zachcarter | going to need help from Araq on this one prob |
19:56:43 | PMunch | Error: type mismatch: got (VNode, EventKind, proc (ev: Event, n: VNode){.noSideEffect, locks: <unknown>.} | proc (my: var JsonParser){.gcsafe, locks: <unknown>.}) |
19:56:43 | PMunch | but expected one of: |
19:56:43 | PMunch | proc addEventHandler(n: VNode; k: EventKind; action: EventHandler) |
19:56:52 | PMunch | Got that one when I actually changed to dom.Event |
19:57:00 | zachcarter | yeah |
19:57:01 | FromGitter | <stisa> zachcarter: karax exports dom.Event from its own dom.nim , you are reimporting dom from stdlib, so it gets two different dom.Event Use ``import dom except Event`` |
19:57:24 | * | krux02 joined #nim |
19:57:30 | PMunch | That compiles |
19:57:31 | zachcarter | yay stisa! thank you! |
19:57:35 | * | Sentreen joined #nim |
20:04:46 | PMunch | This localstorage is also really cool |
20:04:54 | PMunch | Never really used localstorage for anything :P |
20:05:44 | * | Ven_ joined #nim |
20:08:29 | PMunch | Hmm, would it be nicer for karax to create the barebones .html file on compiletime? |
20:08:55 | PMunch | Then you would only use the HTML DSL and Nim :) |
20:09:02 | PMunch | Well, plus CSS |
20:10:39 | * | gokr quit (Ping timeout: 268 seconds) |
20:10:51 | PMunch | Hmm, and shouldn't the -d:release flag also minify the JS output? |
20:11:26 | FromGitter | <stisa> PMunch : That would be nice, I don't think the current js backend does minification though. |
20:11:38 | Tiberium | wow, I found a bug in async macro |
20:11:42 | PMunch | Doesn't look like it |
20:11:54 | PMunch | But it did really make it smaller |
20:12:18 | * | rokups quit (Quit: Connection closed for inactivity) |
20:12:19 | FromGitter | <stisa> Probably stripped some debug things |
20:14:44 | * | throwaway3859 joined #nim |
20:14:57 | throwaway3859 | How do i convert an open array of floats to an array of float32s? |
20:15:10 | PMunch | 59K --(-d:release)--> 39K --(minified)--> 21K |
20:15:24 | Tiberium | strange magic https://github.com/nim-lang/Nim/issues/5754 |
20:16:48 | PMunch | Hmm |
20:17:17 | Tiberium | (this is not bad for me, since it's just matter of brackets) |
20:17:30 | Tiberium | but as a good user, I reported it |
20:18:08 | dom96 | Tiberium: thanks :) |
20:18:30 | dom96 | Although I think I will slowly deprecate the 'try' transformation |
20:19:05 | Tiberium | dom96, what do you mean? we will not able to use await's in try/except ? |
20:19:13 | dom96 | indeed |
20:19:34 | dom96 | or maybe only in very simple cases |
20:19:40 | Tiberium | oh, is there another ways? because this would result in creating temporary variables |
20:20:13 | Tiberium | or yield will work? |
20:23:22 | dom96 | You will need to do something like this: var fut = doSomething(); if fut.failed: echo("Handle error here") |
20:23:32 | dom96 | oh, and `yield fut` after the var defintion |
20:23:58 | Tiberium | ah, I'm already using this, I mean if I would need to use try: on some usual object (not future), and do some await call in except |
20:24:03 | Tiberium | like send error message to user |
20:24:36 | Tiberium | or I can make ALL proc's as {.async.} ? |
20:24:40 | Tiberium | if my app is async |
20:26:38 | * | Vladar quit (Quit: Leaving) |
20:26:53 | dom96 | you shouldn't do that |
20:34:25 | shashlick | I just built Nim from sources on Windows - how do I keep this up to date? just git pull on \Nim and then rebuild koch followed by koch boot? |
20:34:45 | Tiberium | shashlick, you don't need to rebuild koch |
20:34:50 | Tiberium | only nim itself |
20:35:52 | shashlick | does the installer you download from the website contain the git repo info so i can just download that and keep it up to date with git/koch? |
20:36:25 | Tiberium | shashlick, installer for windows is deprecated |
20:36:40 | shashlick | sorry, I meant the ZIP |
20:37:38 | Tiberium | shashlick, I think it doesn't, but you can always check yourself if there's ".git" folder |
20:38:23 | throwaway3859 | Are sequencens always allocated continously, and what does seq.addr point to? |
20:41:45 | shashlick | Tiberium: thanks |
20:45:35 | krux02 | how does nim link libX11.so? |
20:46:27 | shashlick | the dlls.zip doesn't include zlib? |
20:46:31 | * | Ven_ quit (Ping timeout: 260 seconds) |
20:49:13 | * | Ven joined #nim |
20:49:36 | * | Ven is now known as Guest31321 |
20:53:25 | * | Tiberium quit (Remote host closed the connection) |
20:54:12 | PMunch | Warning: a [b] will be parsed as command syntax; spacing is deprecated |
20:54:18 | PMunch | What does this warning mean? |
20:54:30 | PMunch | I'm getting it all the time and it's a bit annoying.. |
20:54:31 | throwaway3859 | you are passing [b] to a |
20:54:46 | throwaway3859 | as far as i understand |
20:55:00 | PMunch | discard staticExec (" |
20:55:06 | PMunch | Had an extra space in that |
20:55:14 | PMunch | staticExec(" works fine |
20:55:36 | throwaway3859 | I really love stuff like withFile <3 |
20:55:37 | PMunch | So it's a space after the function name but before the argument list that seems to cause it |
20:55:50 | PMunch | withFile? |
20:56:17 | throwaway3859 | a template |
20:56:34 | PMunch | Ah right |
20:58:09 | throwaway3859 | Why does it return the `typed` meta-type? |
20:59:13 | * | Guest31321 quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
21:00:27 | * | Trustable quit (Remote host closed the connection) |
21:00:41 | * | TheLemonMan quit (Quit: "It's now safe to turn off your computer.") |
21:03:01 | * | zachcarter quit (Ping timeout: 260 seconds) |
21:08:37 | * | krux02 quit (Ping timeout: 260 seconds) |
21:09:23 | PMunch | Hmm Araq, would it be possible for the "Error: attempt to access a nil address" to name the variable that is nil? |
21:18:21 | PMunch | Uhm, I just got this: lib/system.nim(2562, 7) Error: cannot generate VM code for asm " var len = "x |
21:18:31 | PMunch | That doesn't look good.. |
21:22:59 | federico3 | dom96: any tip on how to write procs that can be used both in async and sync code, if it's possible? |
21:23:51 | FromGitter | <dom96> Yes, using the multisync macro. See how httpclient is implemented |
21:24:16 | * | krux02 joined #nim |
21:28:42 | federico3 | dom96: thanks! |
21:29:02 | * | adeohluwa quit (Quit: Connection closed for inactivity) |
21:29:14 | * | rauss quit (Quit: WeeChat 1.7.1) |
21:33:17 | PMunch | Hmm, can I use karax' buildHTML to make a HTML string? |
21:33:38 | throwaway3859 | Is it a good idea to name functions after build-ins? I would like to say vertexBuffer.bind() |
21:36:23 | shashlick | update script for Nim - git pull origin master; |
21:36:23 | shashlick | nim c koch |
21:36:23 | shashlick | ; koch boot -d:release |
21:36:23 | shashlick | ; koch nimble; |
21:36:24 | shashlick | koch tools |
21:36:51 | shashlick | anything i'm missing? |
21:37:03 | shashlick | didn't expect that to come on separate lines, sorry |
21:37:26 | FromGitter | <TiberiumPY> koch tools -d:release |
21:37:29 | FromGitter | <TiberiumPY> Maybe |
21:37:36 | FromGitter | <TiberiumPY> And add nimsuggest too |
21:37:56 | * | McSoFake quit (Quit: leaving) |
21:39:21 | PMunch | throwaway3859, well it depends |
21:39:41 | PMunch | I tend to name them after built-ins if they perform the same function for a new type |
21:39:54 | throwaway3859 | i guess i go with bindBuffer() then |
21:40:10 | throwaway3859 | but i really like that one can do `type` stuff |
21:40:31 | PMunch | Yeah, that's a neat feature |
21:41:19 | throwaway3859 | the neat part is that its zero cost at runtime |
21:44:04 | * | nsf quit (Quit: WeeChat 1.7) |
21:47:34 | * | nchambers left #nim ("Leaving") |
21:50:59 | PMunch | http://ix.io/rHQ |
21:51:05 | PMunch | Little experiment |
21:51:23 | PMunch | To remove the html file from the todoapp |
21:51:29 | * | throwaway3859 quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client) |
21:51:46 | PMunch | (Changes at the bottom) |
21:59:14 | FromGitter | <stisa> Pmunch: doesn't writefile work in a static block? |
21:59:26 | PMunch | Not with the js target apparently |
21:59:51 | PMunch | https://github.com/nim-lang/Nim/issues/3124 |
21:59:54 | PMunch | According to that |
22:00:05 | PMunch | Didn't actually try it :P |
22:00:40 | shashlick | TiberiumPY: looks like koch tools does nimsuggest as well |
22:02:16 | * | Sentreen quit (Ping timeout: 268 seconds) |
22:03:30 | FromGitter | <stisa> pmunch uh strange, but I don't know enough about how `static` works to guess why |
22:03:53 | PMunch | Yeah, me neither. But that workaround works fine for this example |
22:04:01 | PMunch | At least on Linux.. |
22:06:32 | * | devted quit (Quit: Sleeping.) |
22:08:59 | PMunch | Is it possible to get the name of the output file during compile-time? |
22:15:05 | * | Matthias247 quit (Read error: Connection reset by peer) |
22:15:26 | * | Sentreen joined #nim |
22:16:57 | * | zachcarter joined #nim |
22:34:23 | FromGitter | <Varriount> PMunch: Not that I know of. |
22:34:55 | FromGitter | <ajusa100_twitter> does anyone here know nimx? |
22:39:19 | * | libman joined #nim |
22:42:02 | * | vivus quit (Quit: Leaving) |
22:43:41 | * | krux02 quit (Remote host closed the connection) |
22:43:52 | * | krux02 joined #nim |
22:44:25 | * | krux02 left #nim (#nim) |
22:44:30 | FromGitter | <Varriount> @ajusa100_twitter What's your question? |
22:44:53 | FromGitter | <ajusa100_twitter> I am trying to get input from a list of buttons, that are stored in a sequence |
22:45:12 | FromGitter | <ajusa100_twitter> however, there is no way for me to deduce from which button I am getting an input from |
22:45:39 | FromGitter | <ajusa100_twitter> I only started using it today, so I haven't read through all of the code, but I have looked through the tests |
22:46:49 | FromGitter | <Varriount> @ajusa100_twitter Why are you storing them in a sequence? |
22:47:01 | FromGitter | <Varriount> I mean, rather than each in a seperate variable. |
22:47:11 | FromGitter | <ajusa100_twitter> I have a dynamic list of buttons |
22:47:19 | FromGitter | <ajusa100_twitter> they are generated based on a webscraper |
22:49:09 | FromGitter | <Varriount> @ajusa100_twitter I haven't used NimX, how are button events generated? Do you attach a callback to the button, or are events sent down some sort of pipeline? |
22:49:20 | FromGitter | <ajusa100_twitter> you attach a callback |
22:49:42 | FromGitter | <ajusa100_twitter> ~~~ ⏎ movies[i].button.onAction do(): ⏎ ~~~ |
22:50:00 | FromGitter | <Varriount> @ajusa100_twitter Are you able to tell me if the callback has the 'closure' calling convention? |
22:50:26 | FromGitter | <ajusa100_twitter> um, I don't know what that means. I hope that my code answers your question? |
22:51:01 | FromGitter | <Varriount> @ajusa100_twitter Closures are special functions that can capture variables from outer scope. |
22:52:19 | FromGitter | <Varriount> @ajusa100_twitter https://nim-lang.org/docs/manual.html#procedures-closures |
22:52:26 | FromGitter | <ajusa100_twitter> Ah okay |
22:53:08 | FromGitter | <Varriount> If what you are passing in is a closure (or a procedure being implicitly converted to a closure) then you'll probably want to use the closureScope macro (https://nim-lang.org/docs/system.html#closureScope) |
22:53:38 | FromGitter | <Varriount> If you can pass in a closure, you can create a new closure for each button (capture the name or something) |
22:54:07 | FromGitter | <ajusa100_twitter> When I tried putting in a var in the do, it gave me an error |
22:54:47 | FromGitter | <ajusa100_twitter> I see how a closure would help me |
22:55:13 | FromGitter | <Varriount> `do` is just a shortcut to pass in a procedure as a parameter. |
22:55:23 | FromGitter | <Varriount> I believe Ruby has something similar |
22:59:50 | FromGitter | <Varriount> @ajusa100_twitter Any luck? |
23:03:05 | FromGitter | <Varriount> @ajusa100_twitter According to https://nim-lang.org/docs/manual.html#types-procedural-type , the closure calling convention is the standard convention for unmarked procedural types. |
23:03:44 | FromGitter | <Varriount> Since https://github.com/yglukhov/nimx/blob/4eee9b0e5d237726041ec3b03ae3cf3fb7bf19c4/nimx/control.nim#L20 has no calling convention pragma, you are indeed submitting a closure. |
23:04:14 | FromGitter | <Varriount> So you can capture a variable that distinguishes the procedure. |
23:06:26 | zachcarter | anyone have any tips on enabling jsonp for jester? |
23:09:55 | zachcarter | https://github.com/PeterCxy/typeblog_misc/blob/6e963c4a3b84f1308400e2b90ce89f02807bfdcf/misc.nim |
23:09:56 | zachcarter | just found that lol |
23:09:58 | * | Nobabs27 joined #nim |
23:13:50 | FromGitter | <ajusa100_twitter> @Varriount , sorry, I was eating dinner. I will read through these links and inform you if anything works. Thanks for the help! |
23:18:48 | FromGitter | <ajusa100_twitter> I dont really understand the syntax yet... |
23:24:10 | * | PMunch quit (Quit: leaving) |
23:26:29 | FromGitter | <Varriount> @ajusa100_twitter What are you confused on? |
23:26:40 | * | Sentreen quit (Quit: WeeChat 1.4) |
23:26:45 | FromGitter | <ajusa100_twitter> I understand the purpose of a closure |
23:26:52 | FromGitter | <ajusa100_twitter> But how do I actually use it in my code? |
23:27:10 | FromGitter | <ajusa100_twitter> Sorry if these are stupid questions, but I am pretty new to nim |
23:27:44 | * | Sentreen joined #nim |
23:29:06 | FromGitter | <Varriount> @ajusa100_twitter What other languages have you used? |
23:29:19 | FromGitter | <ajusa100_twitter> Some c, arduino, mostly js |
23:29:31 | FromGitter | <ajusa100_twitter> I am 16, so I don't have a ton of experience |
23:30:02 | FromGitter | <Varriount> So, are you familiar with scopes (global vs local, etc)? |
23:30:04 | FromGitter | <ajusa100_twitter> I wrote a web scraper in Nim, and now I am trying to give it a gui |
23:30:05 | FromGitter | <ajusa100_twitter> yes |
23:30:11 | zachcarter | dom96: you around? |
23:30:58 | FromGitter | <Varriount> @ajusa100_twitter Normally a function has access to two scopes - it's local scope, and the global scope. |
23:31:15 | FromGitter | <ajusa100_twitter> okay |
23:31:48 | FromGitter | <Varriount> A closure has access to three - global, the local scope of it's parent procedure, and it's own local scope |
23:32:02 | FromGitter | <ajusa100_twitter> I understand so far |
23:33:09 | FromGitter | <Varriount> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=58fe8b3812d2409935955269] |
23:34:30 | FromGitter | <ajusa100_twitter> so inner is a closure |
23:34:31 | FromGitter | <Varriount> You can use this to pass data into a closure, even if it doesn't accept parameters. |
23:35:47 | FromGitter | <ajusa100_twitter> Let me restate part of my question ⏎ ~~~ ⏎ movies[i].button.onAction do(): ⏎ ⏎ ``` echo "clicked"``` ... [https://gitter.im/nim-lang/Nim?at=58fe8bd612d2409935955478] |
23:36:13 | FromGitter | <ajusa100_twitter> I want to be able to access movies[i].title for example within the do(): |
23:36:55 | FromGitter | <ajusa100_twitter> movies is in the global scope |
23:37:06 | * | Nobabs25 joined #nim |
23:38:24 | FromGitter | <Varriount> Try something like this: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=58fe8c738bb56c2d11dc54ff] |
23:38:35 | FromGitter | <Varriount> That assumes that 'button' has a 'name' member. |
23:39:04 | FromGitter | <ajusa100_twitter> it has a title, but I can work with that |
23:39:26 | FromGitter | <Varriount> The 'do()' mechanism creates a procedure from the indented block. |
23:39:46 | * | Nobabs27 quit (Ping timeout: 260 seconds) |
23:40:39 | FromGitter | <ajusa100_twitter> What this will echo is the last movie |
23:40:58 | FromGitter | <ajusa100_twitter> every time, because that is the last button to be set |
23:41:50 | FromGitter | <Varriount> No, because a new closure is created for each loop. I think |
23:42:04 | FromGitter | <ajusa100_twitter> once the first element has been created, the do() proc is rebound to the new element |
23:42:12 | * | Nobabs227 joined #nim |
23:42:13 | FromGitter | <ajusa100_twitter> It does echo the last one each time |
23:42:27 | FromGitter | <ajusa100_twitter> ~~~ |
23:42:28 | FromGitter | <Varriount> Hm. I must have used closureScope incorrectly |
23:42:33 | FromGitter | <ajusa100_twitter> ~~~ ⏎ for i,m in movies: ⏎ ⏎ ```code paste, see link``` ⏎ ... [https://gitter.im/nim-lang/Nim?at=58fe8d6d8bb56c2d11dc579c] |
23:42:36 | FromGitter | <ajusa100_twitter> that is my code |
23:44:23 | * | Nobabs25 quit (Ping timeout: 240 seconds) |
23:44:35 | * | Nobabs227 quit (Client Quit) |
23:45:43 | * | Sentreen quit (Quit: WeeChat 1.4) |
23:47:29 | FromGitter | <Varriount> Ah, that's because you're using `movies[i]` |
23:47:50 | * | bjz joined #nim |
23:48:05 | FromGitter | <Varriount> You need to create a variable in the closureScope |
23:48:16 | FromGitter | <Varriount> Look at https://nim-lang.org/docs/system.html#closureScope |
23:48:53 | FromGitter | <ajusa100_twitter> hey it works now! |
23:49:07 | FromGitter | <ajusa100_twitter> :D Thank you so much for the help! |
23:50:38 | FromGitter | <Varriount> Why are you doing that, by the way? Can't you just do `for m in movies`? |
23:50:57 | FromGitter | <ajusa100_twitter> yeah, I could do it that way |
23:51:12 | FromGitter | <ajusa100_twitter> I was doing that because I didn't know how closurescopes worked |
23:51:36 | FromGitter | <ajusa100_twitter> so I thought that I would have to use an iterator passed in to the proc to locate the movies |
23:51:56 | FromGitter | <Varriount> @ajusa100_twitter If you want a real mindflip, look at the source for closureScope: https://github.com/nim-lang/Nim/blob/master/lib/system.nim#L3710 |
23:52:20 | FromGitter | <Varriount> :D |
23:52:22 | FromGitter | <ajusa100_twitter> I feel really stupid now |
23:52:35 | FromGitter | <ajusa100_twitter> Looking at it, I can see it is the same as a closure in JS... |
23:52:38 | FromGitter | <Varriount> Nah, scopes for closures are tricky. |
23:52:53 | FromGitter | <ajusa100_twitter> Sure it is confusing, but I have ran across it before |
23:53:02 | FromGitter | <ajusa100_twitter> thanks! |
23:53:51 | FromGitter | <Varriount> Don't count on it. You'll do better if you learn things yourself. |
23:54:11 | FromGitter | <Varriount> I'm nearly done with all my classes, and while they are ok... |
23:54:35 | FromGitter | <Varriount> I've learned far more by exploring real-world applications on my own. |
23:54:51 | FromGitter | <ajusa100_twitter> Yeah, but I have like no time right now. I am in the US, and getting into a competitive college sucks the life out of you. I have stupid AP exams I really should be studying for, but these hobby projects are a lot more fun |
23:55:07 | FromGitter | <Varriount> AP Comp Sci? |
23:55:12 | FromGitter | <ajusa100_twitter> That too |
23:55:36 | FromGitter | <ajusa100_twitter> That is my easiest one by far, read through the book once and I only missed two on the multiple choice |
23:55:50 | FromGitter | <ajusa100_twitter> I am taking AP US History, which is death |
23:56:03 | FromGitter | <Varriount> Oh gosh, I've heard stories about that one. |
23:56:12 | FromGitter | <ajusa100_twitter> yeah. its bad lol |
23:56:23 | FromGitter | <Varriount> I never took APUSH myself. |
23:56:36 | FromGitter | <ajusa100_twitter> I am doing that and AP Calc BC, AP Stats, and AP Biology all in the same year |
23:56:40 | FromGitter | <ajusa100_twitter> I really regret taking APUSH |
23:57:23 | FromGitter | <Varriount> Hm. Well, take heart in the fact that you've probably cut out at least 3 classes. |
23:57:34 | FromGitter | <Varriount> from your college courses |
23:57:58 | FromGitter | <Varriount> I don't know if AP Bio and AP Stat will count for anything though. :/ |
23:58:14 | FromGitter | <Varriount> Rising senior |