00:06:04 | * | gokr quit (Ping timeout: 272 seconds) |
00:12:25 | * | akaisora_ quit (Read error: Connection reset by peer) |
00:13:19 | * | akaisora joined #nim |
00:13:42 | * | yglukhov joined #nim |
00:17:39 | * | girvo joined #nim |
00:18:16 | * | yglukhov quit (Ping timeout: 244 seconds) |
00:19:04 | * | zielmicha quit (Ping timeout: 264 seconds) |
00:22:12 | * | zielmicha joined #nim |
00:22:58 | * | btbytes joined #nim |
00:25:00 | * | Amun_Ra quit (Quit: WeeChat 1.0.1) |
00:26:41 | * | kulelu88 joined #nim |
00:26:41 | * | kulelu88 quit (Changing host) |
00:26:41 | * | kulelu88 joined #nim |
00:32:36 | * | Jesin quit (Quit: Leaving) |
00:41:35 | * | shodan45 quit (Quit: Konversation terminated!) |
00:41:38 | * | btbytes quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
00:46:05 | * | yglukhov joined #nim |
00:49:29 | * | benwbooth quit (Ping timeout: 250 seconds) |
00:52:27 | * | yglukhov quit (Ping timeout: 260 seconds) |
00:55:39 | * | benwbooth joined #nim |
00:59:03 | * | akaisora quit (Ping timeout: 240 seconds) |
00:59:31 | * | akaisora joined #nim |
01:09:50 | * | Amun_Ra joined #nim |
01:13:43 | * | btbytes joined #nim |
01:24:08 | * | yglukhov joined #nim |
01:28:48 | * | yglukhov quit (Ping timeout: 276 seconds) |
01:36:57 | * | btbytes quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
01:48:26 | * | yglukhov joined #nim |
01:48:54 | * | btbytes joined #nim |
01:50:42 | * | btbytes quit (Client Quit) |
01:51:03 | * | GangstaCat quit (Quit: Leaving) |
01:52:45 | * | yglukhov quit (Ping timeout: 250 seconds) |
02:02:16 | * | chemist69 quit (Ping timeout: 264 seconds) |
02:12:32 | * | yglukhov joined #nim |
02:15:07 | * | chemist69 joined #nim |
02:15:57 | * | brson quit (Quit: leaving) |
02:16:48 | * | yglukhov quit (Ping timeout: 246 seconds) |
02:33:21 | * | kulelu88 quit (Quit: Leaving) |
02:36:44 | * | yglukhov joined #nim |
02:41:20 | * | yglukhov quit (Ping timeout: 258 seconds) |
03:00:58 | * | yglukhov joined #nim |
03:04:40 | * | akaisora quit (Ping timeout: 272 seconds) |
03:05:52 | * | yglukhov quit (Ping timeout: 264 seconds) |
03:25:06 | * | yglukhov joined #nim |
03:29:50 | * | yglukhov quit (Ping timeout: 260 seconds) |
04:01:25 | * | yglukhov joined #nim |
04:03:19 | * | der-landgraf quit (Quit: WeeChat 1.5) |
04:04:23 | * | der-landgraf joined #nim |
04:05:36 | * | yglukhov quit (Ping timeout: 244 seconds) |
04:25:39 | * | yglukhov joined #nim |
04:30:02 | * | yglukhov quit (Ping timeout: 260 seconds) |
04:49:54 | * | yglukhov joined #nim |
04:54:00 | * | yglukhov quit (Ping timeout: 244 seconds) |
05:10:39 | * | irrequietus joined #nim |
05:15:54 | * | gokr joined #nim |
05:26:12 | * | yglukhov joined #nim |
05:28:41 | * | s4 joined #nim |
05:30:42 | * | yglukhov quit (Ping timeout: 260 seconds) |
05:40:53 | * | desophos quit (Read error: Connection reset by peer) |
05:41:17 | * | endragor joined #nim |
05:48:48 | * | gokr quit (Ping timeout: 276 seconds) |
06:02:12 | * | yglukhov joined #nim |
06:06:41 | * | yglukhov quit (Ping timeout: 250 seconds) |
06:17:20 | * | endragor_ joined #nim |
06:20:36 | * | endragor quit (Ping timeout: 258 seconds) |
06:26:41 | * | yglukhov joined #nim |
06:27:00 | * | endragor_ quit (Remote host closed the connection) |
06:27:39 | * | endragor joined #nim |
06:31:42 | * | yglukhov quit (Ping timeout: 276 seconds) |
06:35:16 | * | chemist69 quit (Ping timeout: 264 seconds) |
06:40:42 | * | chemist69 joined #nim |
06:43:09 | * | filcuc joined #nim |
06:47:54 | * | yglukhov joined #nim |
06:48:45 | * | yglukhov quit (Remote host closed the connection) |
06:51:06 | * | heretobang joined #nim |
06:52:38 | * | gokr joined #nim |
06:57:46 | * | girvo_ joined #nim |
06:58:01 | * | yglukhov joined #nim |
06:59:01 | * | Trustable joined #nim |
07:28:59 | * | bjz joined #nim |
07:29:42 | * | arnetheduck joined #nim |
07:29:49 | * | arnetheduck quit (Client Quit) |
07:33:06 | * | arnetheduck_ joined #nim |
07:33:52 | * | arnetheduck_ quit (Remote host closed the connection) |
07:35:40 | * | girvo quit (Ping timeout: 252 seconds) |
07:35:57 | * | girvo_ quit (Ping timeout: 250 seconds) |
07:41:33 | * | fastrom joined #nim |
07:42:36 | * | PMunch joined #nim |
07:45:46 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
08:00:06 | * | bjz joined #nim |
08:00:20 | * | gokr quit (Read error: Connection reset by peer) |
08:00:28 | * | gokr joined #nim |
08:02:04 | * | heretobang left #nim ("soundcloud.com/wacastle") |
08:29:26 | * | der-landgraf quit (Quit: WeeChat 1.5) |
08:29:41 | * | der-landgraf joined #nim |
08:32:47 | * | der-landgraf quit (Client Quit) |
08:33:09 | * | der-landgraf joined #nim |
08:49:01 | * | nsf quit (Quit: WeeChat 1.4) |
08:49:16 | * | endragor quit (Remote host closed the connection) |
08:58:10 | * | themagician joined #nim |
09:01:33 | * | endragor joined #nim |
09:09:16 | * | sarlalian quit (Ping timeout: 258 seconds) |
09:09:33 | * | sarlalian joined #nim |
09:20:47 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
09:47:19 | * | bjz joined #nim |
09:51:08 | * | bjz_ joined #nim |
09:52:03 | * | bjz quit (Ping timeout: 240 seconds) |
10:16:27 | * | xet7 joined #nim |
10:31:57 | * | girvo joined #nim |
10:31:58 | * | 1JTAAB0CK joined #nim |
10:36:37 | * | girvo quit (Ping timeout: 252 seconds) |
10:36:39 | * | 1JTAAB0CK quit (Ping timeout: 250 seconds) |
10:42:00 | cheatfate_ | dom96, now when i'm trying to implement postgres async module i think your idea with readCB: seq[Callback], and writeCB: seq[Callback] is not so bad |
10:44:17 | cheatfate_ | but i'm thinking to have not `seq's` there, but `arrays` |
10:44:34 | cheatfate_ | just to omit memory alloc/dealloc code there |
10:44:39 | * | vktec joined #nim |
10:46:38 | * | wuehlmaus is now known as foosball |
10:54:14 | * | irrequietus quit () |
11:19:06 | * | chemist69 quit (Ping timeout: 250 seconds) |
11:25:20 | * | chemist69 joined #nim |
11:30:31 | * | Demon_Fox quit (Quit: Leaving) |
11:32:46 | * | girvo joined #nim |
11:32:46 | * | girvo_ joined #nim |
11:33:50 | * | Sembei joined #nim |
11:37:40 | * | girvo_ quit (Ping timeout: 264 seconds) |
11:37:40 | * | girvo quit (Ping timeout: 264 seconds) |
11:44:16 | * | endragor quit (Remote host closed the connection) |
11:48:43 | vktec | What is the most idiomatic way to read a file in Nim? Should I use AsyncFile or is there another, easier solution? |
11:51:55 | * | resuna joined #nim |
11:52:32 | dom96 | vktec: system.readFile |
11:52:50 | dom96 | use AsyncFile only if you need to read the file asynchronously |
11:52:53 | vktec | Ah, thanks dom96 |
11:53:00 | * | resuna left #nim (#nim) |
11:53:05 | vktec | I searched the docs, but didn't find that |
11:54:26 | vktec | I should've looked on rosettacode :D |
12:23:10 | * | gokr quit (Read error: Connection reset by peer) |
12:23:11 | * | gokr1 joined #nim |
12:29:13 | * | elrood joined #nim |
12:33:40 | * | girvo joined #nim |
12:33:41 | * | girvo_ joined #nim |
12:38:10 | * | girvo quit (Ping timeout: 260 seconds) |
12:38:45 | * | girvo_ quit (Ping timeout: 260 seconds) |
12:46:15 | * | yglukhov quit (Read error: Connection reset by peer) |
12:46:57 | * | endragor joined #nim |
12:48:22 | * | der-landgraf quit (Quit: WeeChat 1.5) |
12:49:00 | cheatfate_ | looks like `tests/async/tasynceverror.nim` broken |
12:49:37 | cheatfate_ | it has `outputsub: "Error: unhandled exception: "` inside |
12:50:01 | cheatfate_ | so this test just hiding exceptions |
12:50:07 | cheatfate_ | because on linux it got EPIPE |
12:50:17 | cheatfate_ | but in BSD EBADF for other reason |
12:51:15 | * | arnetheduck joined #nim |
12:51:15 | cheatfate_ | it called raises EBADF not because you writing to already closed socket, but because it has double delete from kqueue |
12:51:46 | * | endragor quit (Ping timeout: 272 seconds) |
12:53:01 | * | xet7 quit (Ping timeout: 240 seconds) |
12:54:29 | Araq | it's not broken, it's underspecified |
12:54:45 | Araq | because OSErrors can differ |
12:56:33 | * | der-landgraf joined #nim |
12:56:33 | * | der-landgraf quit (Changing host) |
12:56:34 | * | der-landgraf joined #nim |
12:57:10 | * | der-landgraf quit (Client Quit) |
12:57:39 | * | der-landgraf joined #nim |
12:57:39 | * | der-landgraf quit (Changing host) |
12:57:40 | * | der-landgraf joined #nim |
13:05:03 | * | yglukhov joined #nim |
13:05:57 | * | xet7 joined #nim |
13:11:00 | cheatfate_ | Araq, its broken, just because OSes has different approach on handling send(to just closed socket), i have already tested FreeBSD, Solaris and Linux |
13:11:25 | cheatfate_ | only on Linux send() returns ECONNRESET (104) |
13:11:44 | cheatfate_ | Solaris and FreeBSD made successful write to socket |
13:11:53 | cheatfate_ | i'm loading macos to test it |
13:13:36 | cheatfate_ | as expected macosx also made successful send(to just closed) socket |
13:14:48 | cheatfate_ | this test generates EBADF for other reason |
13:15:17 | cheatfate_ | as i said before because asyncdispatch -> selectors -> make 2 calls to delete socket form kqueue |
13:15:42 | cheatfate_ | so it generates EBADF and causes this test to pass successfully |
13:17:00 | * | akaisora joined #nim |
13:22:22 | * | s4 quit (Quit: Konversation terminated!) |
13:23:26 | * | akaisora quit (Ping timeout: 244 seconds) |
13:23:43 | * | akaisora_ joined #nim |
13:31:13 | yglukhov | can i pass a pointer to a proc expecting openarray? |
13:32:25 | Araq | not sure if casting from pointer to openarray is supported. |
13:32:28 | Araq | but it should. |
13:33:23 | * | PMunch quit (Ping timeout: 258 seconds) |
13:34:38 | * | girvo joined #nim |
13:34:39 | * | girvo_ joined #nim |
13:39:03 | * | girvo_ quit (Ping timeout: 240 seconds) |
13:39:03 | * | girvo quit (Ping timeout: 240 seconds) |
13:41:30 | * | gokr joined #nim |
13:42:20 | * | gokr1 quit (Ping timeout: 260 seconds) |
13:43:15 | vktec | What is the best way to append a value to a sequence? Should I do sequence += @[newvalue]? |
13:44:12 | niv | vktec: what about system.append? theres both mutable and immutable variants for it |
13:44:39 | niv | if memory serves .. actually |
13:45:24 | vktec | niv: Hmmm... I can't seem to find any docs on that.. |
13:45:31 | vktec | Could you give me a link? |
13:45:45 | vktec | I can't find it on here: http://nim-lang.org/docs/system.html |
13:46:09 | niv | it's called add, not append, sorry |
13:46:19 | niv | proc add[T](x: var seq[T]; y: openArray[T]) {.noSideEffect.} |
13:46:24 | * | PMunch joined #nim |
13:46:27 | vktec | niv: Ahh, thanks |
13:46:41 | niv | should be better to use for mutable stack stuff because it doesnt make a copy |
13:47:01 | vktec | Yeah |
13:47:04 | vktec | Thanks niv |
13:47:08 | niv | yw :) |
13:47:46 | * | endragor joined #nim |
13:49:36 | niv | question of my own to the channel - what's the preferred way to check if we're running posix? when defined(linux) or defined(macosx)? |
13:49:41 | niv | that doesnt seem sane to me |
13:50:00 | niv | i want to find out if a importc header .. call resolves/works |
13:51:29 | Araq | when defined(posix) |
13:51:51 | niv | ty |
13:52:08 | Araq | to know if the importc works, you have to call it, unless it's a dynlib call then it will tell you at program startup |
13:52:22 | * | endragor quit (Ping timeout: 244 seconds) |
13:52:51 | niv | i'll just leave it off then and put it in the docs |
13:54:38 | vktec | I thought templates could access variables from the calling scope, but I'm getting an error that seems to suggest otherwise. Any way I can change that or should I do something differently? |
13:58:12 | vktec | Also, I'm a little confused about the difference between templates and macros, could someone clarify? |
13:58:57 | Araq | use a .dirty template |
13:59:49 | Araq | there is no real difference, templates originally were Lisp's quoting operator and evolved into the simple substitution macros they are today |
14:00:01 | vktec | Araq: Thanks, that worked perfectly |
14:00:08 | vktec | Araq: Okay |
14:00:14 | Araq | so in other words, use a template unless you cannot |
14:00:19 | vktec | So how come both exist? |
14:00:27 | vktec | And why would I use a macro over a template? |
14:01:17 | * | saml quit (Remote host closed the connection) |
14:01:43 | Araq | I believe in the Principle of Least Power. |
14:02:26 | Araq | macros have to exist because lots of things are otherwise not expressable in Nim |
14:02:48 | Araq | but due to their power they are hard to use |
14:02:52 | vktec | Okay |
14:03:01 | vktec | So what can they do that templates can't? |
14:03:25 | vktec | The docs say they "enable advanced compile-time code transformations" but what kind of transformations? |
14:03:40 | Araq | look strscans.scanf |
14:04:33 | * | saml joined #nim |
14:05:45 | Araq | whenever you need to process some string at compile-time, or need to inspect the involved types |
14:06:01 | Araq | or need to build 2 ASTs at the same time |
14:06:26 | Araq | (like building an object type and at the same time code that uses the object's fields) |
14:06:31 | Araq | you have to use macros. |
14:06:52 | vktec | Okay |
14:07:08 | * | vktec will probably never use them :] |
14:08:24 | Araq | even if not, you benefit from the libraries that make good use of them |
14:08:28 | vktec | Yeah |
14:09:06 | vktec | So basically, templates are blocks of code that are substituted by the compiler, macros build code which is then substituted by the compiler. Or am I wrong? |
14:09:42 | vktec | (ie. a template call is replaced by the template, a macro call is replaced by the code generated by the macro) |
14:12:40 | PMunch | vktec, https://hookrace.net/blog/introduction-to-metaprogramming-in-nim/ |
14:12:44 | vktec | Hmmm... can I get a variable definition inside a template to be visible in the calling scope? |
14:12:46 | PMunch | Pretty much right |
14:13:06 | vktec | PMunch: Cheers, I'll take a look at that |
14:13:23 | arnetheduck | Araq, let me know when you have a moment to explain that GC |
14:13:28 | PMunch | Templates are as you say just substitutions so I think that should work, but it could make your code look messy. |
14:13:56 | PMunch | vktec, I read it just the other day and it describes all this stuff really nicely |
14:14:22 | vktec | PMunch: Yeah, it looks good. |
14:14:35 | vktec | PMunch: It doesn't seem to have worked :-/ |
14:14:48 | * | endragor joined #nim |
14:16:01 | vktec | Oh, maybe it has |
14:16:26 | Araq | arnetheduck: what do you need to know? |
14:16:44 | arnetheduck | er. everything from the start? ;) |
14:16:46 | vktec | Wait, no, it hasn't |
14:17:12 | arnetheduck | it looks like the c compiler makes a big deal out of things being on heap or stack |
14:17:24 | arnetheduck | ideally, I'd like to not care about that right now |
14:17:59 | arnetheduck | you mentioned traversal procs at some point, then I found a comment in the code saying that they're basically performance optimizations |
14:18:31 | Araq | yeah |
14:19:32 | arnetheduck | so I guess what I'm after is the absolute minimum needed by the compiler to make gc work - don't care at all about it being fast |
14:19:35 | arnetheduck | but there |
14:19:39 | vktec | Aha! It wasn't working because I was defining inside an if statement. |
14:20:17 | vktec | I replaced it with when and everything works as expected :) |
14:21:22 | arnetheduck | I tried just doing nothing beyond not defining nogc, but that causes crashes :/ |
14:21:54 | vktec | 0.o What does "could not resolve" mean in an error? |
14:22:20 | Araq | it means there is [] accessor available for your datatypes |
14:22:24 | Araq | *is no |
14:22:36 | vktec | There.... is. |
14:22:41 | vktec | But then.... |
14:22:43 | vktec | 0_o |
14:22:46 | * | vktec debugs |
14:22:59 | Araq | use a 'var T' in the proc if you need to modify stuff |
14:23:06 | Araq | as parameter. |
14:23:26 | vktec | Araq: It's a template |
14:23:47 | Araq | it gets expanded |
14:23:55 | Araq | look at where it is expanded. |
14:24:09 | Araq | arnetheduck: marker procs are actually required now for the GC to work |
14:24:32 | Araq | it depends on the marker proc though, 'nimRegisterGlobal' iirc is really important |
14:24:45 | vktec | Araq: What, in the generated sourcecode? |
14:25:09 | * | gokr quit (Ping timeout: 246 seconds) |
14:25:22 | arnetheduck | do I need to care at all about the *RC1 stuff? |
14:25:48 | Araq | proc foo(x: Table[string, string]) = x["foo"] = "bar" # cannot resolve |
14:26:07 | Araq | proc foo(x: var Table[string, string]) = x["foo"] = "bar" # yummy |
14:26:29 | Araq | arnetheduck: the RC1 stuff is indeed only for optimizations |
14:26:34 | vktec | Araq: Okay, but what about when I'm using a {.dirty.} template? |
14:26:58 | Araq | template parameters are not subject to mutability checking |
14:27:25 | vktec | Araq: It's not a parameter, it's a variable in the calling scope |
14:27:35 | arnetheduck | nimGCunrefNoCycle too? |
14:28:13 | Araq | the *NoCycle variant is an optimization, but nimGCunref needs to be called |
14:28:40 | Araq | vktec: so gist your code |
14:28:46 | vktec | Okay |
14:30:06 | arnetheduck | is it enough to call nimgcref/nimgcunref when the ast tells me to, through magics, or are there other places? |
14:30:12 | * | Sembei quit (Ping timeout: 250 seconds) |
14:30:56 | arnetheduck | I can mostly find calls to with related to OnHeap.. but would it be enough to always do the OnUnknown variations? |
14:32:14 | vktec | https://gist.github.com/vktec/a0e2b21accf28ff30cc707e1c9a9dc95 |
14:32:27 | vktec | ^ The relevant code |
14:33:36 | Araq | no, you left out the essential parts |
14:33:49 | Araq | however you need to use declared instead of defined |
14:34:04 | Araq | arnetheduck: the OnUnkown variants should be good enough |
14:34:06 | vktec | Araq: What other parts should I add in? |
14:34:11 | vktec | Araq: Okay, I'll change that |
14:34:55 | Araq | and maybe moustachu.Context has no [] accessor |
14:35:13 | vktec | https://github.com/fenekku/moustachu |
14:35:23 | * | girvo joined #nim |
14:35:26 | * | girvo_ joined #nim |
14:36:49 | arnetheduck | so basically.. implement markers, do whatever c compiler does with OnUnknown.. |
14:38:22 | arnetheduck | btw, in the generated code, stack bottom is set several times, even though it should be sort of enough to set it once.. and it's set to a pointer to NimMain/PreNimMain, why is that? |
14:39:33 | * | girvo quit (Ping timeout: 240 seconds) |
14:40:30 | * | girvo_ quit (Ping timeout: 276 seconds) |
14:43:21 | Araq | I think it's because of DLL support |
14:43:31 | Araq | we need to generate it differently for DLls |
14:43:38 | Araq | and then it ended up being always emitted |
14:47:14 | * | endragor quit (Remote host closed the connection) |
14:48:09 | vktec | Aha! I fixed the issue by generating a JObject and then creating the context from that |
14:48:38 | vktec | That's what it's doing internally anyway, so it shouldn't affect performance much |
14:51:18 | arnetheduck | ok, cool, thanks.. should be enough to get started.. |
14:52:18 | arnetheduck | endb, if it's dead, is there a plan to remove it from system? |
14:55:06 | Araq | no, it still has the best watchpoints |
15:08:14 | * | Jesin joined #nim |
15:13:07 | * | pregressive joined #nim |
15:13:32 | * | chemist69 quit (Ping timeout: 250 seconds) |
15:19:57 | * | chemist69 joined #nim |
15:23:54 | * | Parashurama joined #nim |
15:24:51 | * | BitPuffin joined #nim |
15:25:19 | Parashurama | Hi, I can't seem to use the --listFullPaths cmdline arg for a project. It has no effect on displayed error messages filenames. (using latest devel) |
15:25:50 | vktec | I have a string and I want to create a template with that name from within another template. Is this possible? Is there a better way to do what I want? (example: https://gist.github.com/vktec/a162ad8850c70a4aa1b38ef809c55252) |
15:26:01 | Parashurama | Araq: Hey, see message above. |
15:26:59 | Parashurama | I think you can use the `name` notation for the template name nested inside your first template. |
15:28:15 | vktec | Parashurama: I think that does something else (see first example here http://nim-lang.org/docs/tut2.html#templates) |
15:29:32 | Parashurama | Try it I remember using some time ago exactly for that purpose |
15:30:21 | Parashurama | It evaluate the expression and use it as an ident (or something like that) |
15:30:39 | vktec | Okay, I'll give it a go |
15:33:08 | vktec | That doesn't seem to be working |
15:33:14 | vktec | Error: identifier expected, but found '"myTemplate"' |
15:35:08 | Parashurama | Okay, let me find the old code. |
15:35:19 | vktec | Thanks Parashurama |
15:36:08 | vktec | What I'm looking for is kinda similar to Python's decorators, but for templates rather than procs |
15:36:27 | * | miere joined #nim |
15:37:41 | PMunch | I think you'll have to use macros for that vktec |
15:37:47 | PMunch | Remember templates are only for compiletime |
15:38:02 | PMunch | So you can't create new ones on runtime |
15:38:53 | * | namnguyen quit (Quit: Leaving) |
15:39:11 | vktec | PMunch: I'm not, I'm creating templates from other templates at compile time |
15:41:29 | PMunch | Statically? |
15:42:38 | vktec | Well, I'm using a template to define another template, so it's all done at compile-time |
15:42:42 | vktec | It's for a DSL |
15:42:56 | miere | Is link broken or it's just me? http://i.imgur.com/23ydDqk.png |
15:43:11 | PMunch | miere, works for me |
15:43:11 | miere | In channel about message |
15:43:20 | PMunch | Oh |
15:43:24 | PMunch | The channel message :P |
15:43:25 | vktec | miere: Just you |
15:43:28 | miere | :/ |
15:43:30 | PMunch | I thought you meant the image |
15:43:32 | miere | Lol |
15:43:33 | miere | No |
15:43:59 | vktec | miere: Here's the actual link https://github.com/Araq/Nim/wiki/IRC-guidelines |
15:44:09 | miere | Thanks |
15:44:23 | vktec | Np |
15:44:36 | * | namnguyen joined #nim |
15:45:47 | Parashurama | Found the code: https://gist.github.com/Parashurama/ccb71422b641c2426e6b2eeea60450ae |
15:45:49 | Parashurama | I didn't quite remember correctly. It is part of a much large proc and called inside a macro. |
15:47:06 | Parashurama | It may not be the code I remembered it was the closest I could find at the moment. |
15:47:25 | vktec | Okay, thanks Parashurama |
15:47:41 | vktec | I'll take a look at that and see what I can figure out |
15:47:57 | * | endragor joined #nim |
15:49:28 | vktec | Parashurama: Do you have an example usage for that? |
15:50:29 | * | BlaXpirit quit (Quit: Bye) |
15:50:53 | * | BlaXpirit joined #nim |
15:52:32 | * | endragor quit (Ping timeout: 250 seconds) |
15:54:16 | * | benwbooth quit (Ping timeout: 250 seconds) |
15:56:36 | * | PMunch quit (Quit: leaving) |
15:57:43 | * | benwbooth joined #nim |
15:59:42 | Parashurama | The code it self is quite complicated if you don't know nim macros. I update the gist with some code that compile and show how to use it. |
15:59:43 | Parashurama | But the code is quite old, and I build the AST manually now when I need macros. |
15:59:49 | * | benwboot_ joined #nim |
16:00:25 | * | nsf joined #nim |
16:01:08 | Araq | vktec: just pass the identifier as identifier around, the parameter's type needs to be 'untyped' for this to work |
16:01:08 | vktec | Okay |
16:01:25 | Araq | Parashurama: no idea, report it, I shall have a look. |
16:01:43 | vktec | Araq: Can you provide an example? |
16:02:48 | * | benwbooth quit (Ping timeout: 246 seconds) |
16:07:28 | * | arnetheduck quit (Ping timeout: 272 seconds) |
16:07:46 | Araq | template constructProc(name: untyped) = |
16:07:58 | Araq | proc name(a, b: int) = discard |
16:08:08 | vktec | Cool, I'll try that |
16:08:09 | Araq | constructProc(awesomeName) |
16:08:48 | * | Matthias247 joined #nim |
16:09:59 | vktec | Araq: Awesome! That worked perfectly! |
16:10:03 | vktec | Thank you so much! |
16:14:32 | Parashurama | Araq: Maybe i just misunderstood the --listFullPaths flag. In my example, it works on compile time errors but not on runtime errors (exceptions). |
16:15:57 | Araq | oh, ok |
16:16:10 | Araq | it's only for compiler error messages indeed |
16:17:21 | Parashurama | Araq: It would be very useful for compile time errors. Especially for IDE integration as a goto error line. |
16:17:36 | Parashurama | *for runtime errors, obviously |
16:20:48 | * | filcuc quit (Read error: Connection reset by peer) |
16:22:40 | * | arnetheduck joined #nim |
16:23:44 | vktec | Sorry guys, yet another template-related question :) What am I doing wrong here: https://gist.github.com/vktec/781838f11115d18ad98829030b0a8adf |
16:25:02 | * | arnetheduck quit (Remote host closed the connection) |
16:25:21 | vktec | Oops, I forgot {.dirty.} |
16:27:40 | vktec | Okay, I added {.dirty.} and removed var from the template and it works, but what about this: https://gist.github.com/vktec/781838f11115d18ad98829030b0a8adf |
16:29:18 | Parashurama | You are defining a new proc, not calling it and anyway you are modifying a new var x not the global one. |
16:29:59 | Parashurama | My mistake, you are calling it, but as before |
16:30:30 | vktec | Yeah, that's the point, but it's not working. I want to define a new local variable called x with value 10, but it reads the global one (which I put in to prevent errors). |
16:32:08 | Parashurama | I'm not sure I understand what you are trying to do. |
16:32:19 | miere | Maybe this will work: https://gist.github.com/miere43/0aa807dd360126a8b293e0a01e6b76f8 |
16:33:15 | vktec | miere: That's not what I'm trying to do. I'm trying to create a _new_ local variable. |
16:33:22 | * | vktec removes the global variable |
16:35:30 | vktec | Perhaps this is a little clearer: https://gist.github.com/vktec/781838f11115d18ad98829030b0a8adf |
16:36:15 | * | girvo joined #nim |
16:36:17 | * | girvo_ joined #nim |
16:36:50 | Parashurama | we have a {.global.} pragma but it means C static variable. |
16:37:31 | vktec | I don't want a global variable, I want a local variable. |
16:39:45 | Parashurama | I'm pretty sure it can be done with some combination of mixin, gensym and things like that (see manual) but I can't help you tonight any further. |
16:39:51 | Parashurama | see yah. |
16:40:50 | * | girvo_ quit (Ping timeout: 260 seconds) |
16:40:50 | * | girvo quit (Ping timeout: 260 seconds) |
16:40:50 | * | akaisora_ quit (Ping timeout: 260 seconds) |
16:41:03 | vktec | Okay, thanks for the help Parashurama |
16:41:32 | * | akaisora_ joined #nim |
16:44:23 | * | Matthias247 quit (Read error: Connection reset by peer) |
16:53:19 | * | Parashurama quit (Quit: ChatZilla 0.9.92 [Firefox 46.0.1/20160511224154]) |
17:02:33 | * | gokr joined #nim |
17:16:25 | * | akaisora_ is now known as akaisora |
17:21:36 | * | brson joined #nim |
17:24:09 | * | Trustable quit (Remote host closed the connection) |
17:46:23 | * | gokr quit (Ping timeout: 258 seconds) |
17:55:31 | * | fastrom quit (Quit: Leaving.) |
17:57:05 | * | chrisheller joined #nim |
17:59:29 | chrisheller | vktec: mark your template as {.dirty,immediate.} |
18:01:14 | Araq | vktec: no, mark the body as 'untyped' |
18:03:13 | vktec | chrisheller: Thanks that worked |
18:03:19 | vktec | Araq: That worked too, with {.dirty.} |
18:03:58 | vktec | Now the question is.... which is better? ;) |
18:04:19 | chrisheller | vktec: Prefer Araq's advice over mine. He knows a bit more about Nim :) |
18:04:49 | vktec | Okay |
18:05:02 | vktec | I'll go with body: untyped and {.dirty.} |
18:05:04 | vktec | :) |
18:05:08 | vktec | Thanks so much guys! |
18:06:39 | vktec | Araq: Why does that work? Is stmt in it's own scope or something? |
18:07:24 | Araq | stmt is an alias for 'typed'. for 'typed' the argument needs to be typed. |
18:07:38 | Araq | to be typed, the compiler needs to check its semantics |
18:07:52 | Araq | it tries that and fails because of the unknown identifier in the body |
18:08:07 | Araq | for 'untyped' the compiler is lazy and doesn't type check it. |
18:08:14 | vktec | Ahh |
18:08:17 | vktec | That makes sense |
18:08:27 | * | foosball quit (Quit: Lost terminal) |
18:08:35 | vktec | Should I use `typed` instead of `stmt` then? |
18:08:40 | vktec | To be clearer? |
18:08:44 | Araq | yes. |
18:08:48 | vktec | Okay |
18:08:56 | Araq | expr/stmt will be deprecated soon. |
18:09:05 | Araq | and so will .immediate templates. |
18:09:08 | * | vktec does :%s/stmt/typed/g |
18:10:22 | vktec | Is expr an alias for untyped? |
18:13:52 | Araq | yes |
18:14:20 | vktec | Okay |
18:14:29 | vktec | I'll bear that in mind, thanks again Araq |
18:15:51 | * | vqrs_ quit (Ping timeout: 244 seconds) |
18:16:12 | * | vqrs joined #nim |
18:23:36 | * | foosball joined #nim |
18:26:50 | * | shodan45 joined #nim |
18:53:38 | * | akaisora_ joined #nim |
18:53:52 | * | akaisora quit (Ping timeout: 264 seconds) |
19:20:49 | vktec | Is it possible to do something like `export module.proc as newProcName` or do I have to do it manually? |
19:21:16 | vktec | ie. define a proc that calls the other proc |
19:25:53 | * | samdoran joined #nim |
19:26:49 | Araq | manually |
19:26:56 | vktec | Okay |
19:27:41 | vktec | Shame that, it seems like quite an obvious thing to implement, given you have import as |
19:28:33 | Araq | it's just a macro away |
19:28:45 | Araq | every unimplemented feature is just a macro away. |
19:28:52 | vktec | True |
19:29:08 | Araq | they claim Nim is big, but it's actually rather slim. ymmv. |
19:29:33 | namnguyen | there should preferably be one way to do it. |
19:29:47 | namnguyen | instead of there are at least two ways to do it. |
19:30:12 | Araq | that doesn't mean anything to me. |
19:30:24 | Araq | Python has dict() and {} |
19:31:17 | * | BitPuffin quit (Ping timeout: 260 seconds) |
19:31:23 | vktec | Yeah, I quite like flexibility |
19:31:39 | vktec | It means you can write code that doesn't just work well, it also looks good |
19:32:15 | namnguyen | dict() and { } are two different things though. |
19:32:45 | vktec | namnguyen: They can both be used to initialize a dict |
19:32:55 | vktec | dict1 = {} |
19:32:59 | vktec | dict2 = dict() |
19:33:04 | vktec | dict1 == dict2 |
19:34:02 | namnguyen | {1} is valid, while dict(1) is not. |
19:34:48 | vktec | namnguyen: I never said they weren't different |
19:35:01 | vktec | I just said they could both be used to create an empty dict |
19:35:35 | namnguyen | yes, there is one preferable way to create an empty dict, though. |
19:35:55 | vktec | Yes |
19:42:18 | * | Demon_Fox joined #nim |
20:01:43 | * | gokr joined #nim |
20:02:03 | vktec | Does Nim have associative arrays? |
20:02:24 | namnguyen | they're called "tables". |
20:03:12 | vktec | Thanks namnguyen |
20:03:22 | namnguyen | yw |
20:04:56 | * | pregressive quit (Remote host closed the connection) |
20:07:01 | * | Matthias247 joined #nim |
20:08:08 | chrisheller | Anyone done anything like Python's cmd module in Nim? https://pymotw.com/2/cmd/ |
20:08:45 | chrisheller | There are lots of command line parsers, but I didn't see anything yet that does a shell around that |
20:20:56 | Araq | there is the rdstdin stdlib module |
20:21:14 | Araq | which gives you the readline feature and nothing else ;-) |
20:27:02 | * | miere quit (Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/) |
20:28:08 | * | chemist69 quit (Ping timeout: 250 seconds) |
20:28:57 | chrisheller | Thanks. Will take a look and see what can be done with that |
20:29:36 | namnguyen | is the IUP binding only applicable to shared lib IUP? |
20:35:49 | Araq | namnguyen: ususally you can use --dynlibOverride:iup and then link statically against iup |
20:38:03 | * | girvo joined #nim |
20:38:03 | * | girvo_ joined #nim |
20:38:51 | * | akaisora__ joined #nim |
20:39:18 | * | akaisora_ quit (Ping timeout: 276 seconds) |
20:43:04 | * | girvo_ quit (Ping timeout: 264 seconds) |
20:43:04 | * | girvo quit (Ping timeout: 264 seconds) |
20:47:12 | * | chemist69 joined #nim |
21:00:56 | * | pregressive joined #nim |
21:07:38 | * | vendethiel joined #nim |
21:11:39 | * | samdoran quit (Quit: Page closed) |
21:11:56 | * | xet7 quit (Quit: Leaving) |
21:19:08 | * | pregressive quit (Remote host closed the connection) |
21:34:25 | * | shodan45 quit (Quit: Konversation terminated!) |
21:48:36 | * | benwboot_ quit (Ping timeout: 246 seconds) |
21:50:09 | * | kulelu88 joined #nim |
21:51:37 | * | benwbooth joined #nim |
21:52:18 | * | benwbooth quit (Max SendQ exceeded) |
21:52:56 | * | benwbooth joined #nim |
21:53:48 | * | saml quit (Quit: Leaving) |
21:57:47 | * | desophos joined #nim |
22:08:28 | * | benwbooth quit (Ping timeout: 272 seconds) |
22:10:49 | * | irrequietus joined #nim |
22:16:14 | * | benwbooth joined #nim |
22:24:01 | * | bjz_ quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
22:25:26 | * | Trustable joined #nim |
22:27:46 | * | elrood quit (Quit: Leaving) |
22:29:25 | * | jjido joined #nim |
22:38:52 | * | girvo joined #nim |
22:38:53 | * | girvo_ joined #nim |
22:39:32 | * | gokr quit (Ping timeout: 244 seconds) |
22:43:43 | * | girvo_ quit (Ping timeout: 252 seconds) |
22:43:43 | * | girvo quit (Ping timeout: 252 seconds) |
22:45:09 | * | bjz joined #nim |
22:52:28 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
22:52:37 | * | Trustable quit (Remote host closed the connection) |
23:00:18 | * | bjz joined #nim |
23:18:09 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
23:26:29 | * | PMunch joined #nim |
23:26:41 | * | Demos joined #nim |
23:27:38 | * | jjido quit (Read error: Connection reset by peer) |
23:40:52 | * | irrequietus quit () |
23:43:24 | * | Demos quit (Remote host closed the connection) |
23:45:23 | * | Matthias247 quit (Read error: Connection reset by peer) |
23:47:16 | * | yglukhov quit (Remote host closed the connection) |
23:59:06 | * | yglukhov joined #nim |