<< 16-12-2015 >>

00:09:12*Jehan_ quit (Quit: Leaving)
00:11:04*Jesin joined #nim
00:23:12*nicktick joined #nim
00:26:07*brson quit (Quit: leaving)
00:29:01*Matthias247 quit (Read error: Connection reset by peer)
00:41:55*zepolen joined #nim
00:41:57*kniteli joined #nim
00:46:06*zepolen quit (Ping timeout: 240 seconds)
00:48:58*nicktick1 joined #nim
00:51:01*nicktick2 joined #nim
00:51:53*nicktick quit (Ping timeout: 255 seconds)
00:53:15*nicktick1 quit (Ping timeout: 240 seconds)
00:56:59*desophos quit (Remote host closed the connection)
01:01:22*nicktick joined #nim
01:04:50*nicktick2 quit (Ping timeout: 272 seconds)
01:05:05*nicktick1 joined #nim
01:06:55*nicktick quit (Ping timeout: 240 seconds)
01:12:55*nicktick1 quit (Quit: Leaving.)
01:13:39*nicktick joined #nim
01:28:07*nicktick quit (Quit: Leaving.)
01:28:20*nicktick joined #nim
01:29:46*nicktick quit (Client Quit)
01:30:30*nicktick joined #nim
01:33:19onionhammeraraq, do u have any other examples of using lexim
01:33:33Araqno -.-
01:34:06onionhammerI'm interested, but not interested enough to dig through the source code to figure out what it can do :)
01:34:37onionhammeryou should write a doc with scenarios and how you'd use lexim to solve your problem
01:38:29Araqwell there is a toy example showing you how to use it
01:41:02onionhammerex1?
01:41:26onionhammerwhat is it actually doing though?
01:41:46onionhammerit looks like lexing, not lexer generating
01:42:04onionhammeris it generating code that lexes at compile time?
01:43:29Araqyes
01:43:43Araqlexim gives you a 'match' macro
01:44:05Araqthat does lots of magic and generates a lexer that is on par with handwritten lexers
01:44:19Araqif it works, that is ;-)
01:44:39Araqas I said, I never found the time to test it properly or do anything with it really
01:45:50onionhammerhahh cool
01:46:20onionhammerneeds a companion parser generator!
01:48:22onionhammeryou could always rewrite nims own lexer with iy
02:02:13*xiongxin joined #nim
02:02:33*xiongxin quit (Client Quit)
02:07:25*pleiosaur joined #nim
02:11:45*Demon_Fox quit (Ping timeout: 260 seconds)
02:15:08*[CBR]Unspoken quit (Ping timeout: 272 seconds)
02:23:35*Demon_Fox joined #nim
02:29:56*[CBR]Unspoken joined #nim
02:42:32*zepolen joined #nim
02:47:20*zepolen quit (Ping timeout: 260 seconds)
02:56:50*vendethiel joined #nim
02:58:19*Demon_Fox quit (Ping timeout: 265 seconds)
02:59:29*kulelu88 left #nim ("Leaving")
03:01:55*gokr quit (Ping timeout: 240 seconds)
03:02:54*gokr joined #nim
03:08:51*desophos joined #nim
03:13:35*desophos quit (Ping timeout: 260 seconds)
03:19:32*vendethiel quit (Ping timeout: 272 seconds)
03:47:23*desophos joined #nim
03:48:09*desophos_ joined #nim
03:48:58*desophos quit (Disconnected by services)
03:49:01*desophos_ is now known as desophos
03:50:02*jakesyl quit (Ping timeout: 265 seconds)
04:08:22*Jesin quit (Quit: Leaving)
04:12:45*nicktick quit (Ping timeout: 265 seconds)
04:16:25*nicktick joined #nim
04:22:14*BitPuffin|osx quit (Ping timeout: 246 seconds)
04:25:30*Demon_Fox joined #nim
04:28:23*zepolen joined #nim
04:32:44*zepolen quit (Ping timeout: 246 seconds)
04:45:16*Jesin joined #nim
04:50:40*nicktick1 joined #nim
04:52:45*nicktick quit (Ping timeout: 260 seconds)
05:13:23*pregressive quit (Remote host closed the connection)
05:13:39*pregressive joined #nim
05:14:08*pregressive quit (Remote host closed the connection)
05:14:42*pregressive joined #nim
05:18:55*pregressive quit (Ping timeout: 240 seconds)
05:23:15*solidsnack quit (Quit: My Mac has gone to sleep. ZZZzzz…)
05:48:16*tymat quit (Quit: PRISM - We know everything!)
05:53:34*zepolen joined #nim
06:01:08*jaco60 quit (Quit: Leaving)
06:03:52*darkf joined #nim
06:04:22*nicktick1 quit (Read error: Connection reset by peer)
06:06:29*nicktick joined #nim
06:17:22*solidsnack joined #nim
06:22:55*gokr quit (Quit: Leaving.)
06:25:56*solidsnack quit (Quit: My Mac has gone to sleep. ZZZzzz…)
06:35:31*solidsnack joined #nim
07:07:30*Matthias247 joined #nim
07:10:14*Matthias247 quit (Read error: Connection reset by peer)
07:15:09*pregressive joined #nim
07:20:17*pregressive quit (Ping timeout: 265 seconds)
07:25:20*HakanD_____ joined #nim
07:54:53*kerze joined #nim
07:55:06*kerze is now known as smodo
08:14:24*filcuc joined #nim
08:18:16*gokr joined #nim
08:25:37*yglukhov joined #nim
08:29:28*solidsnack quit (Quit: My Mac has gone to sleep. ZZZzzz…)
08:36:17*desophos_ joined #nim
08:38:31*DecoPerson quit (Ping timeout: 250 seconds)
08:38:52*DecoPerson joined #nim
08:40:15*desophos_ quit (Ping timeout: 240 seconds)
08:57:53*zepolen quit (Read error: Connection reset by peer)
08:58:08*zepolen joined #nim
09:01:23*zepolen_ joined #nim
09:01:43*zepolen quit (Read error: Connection reset by peer)
09:02:55*zepolen_ quit (Read error: Connection reset by peer)
09:03:17*zepolen joined #nim
09:04:51*zepolen quit (Read error: Connection reset by peer)
09:05:36*zepolen joined #nim
09:15:54*pregressive joined #nim
09:17:25*nicktick quit (Quit: Leaving.)
09:20:09*coffeepot joined #nim
09:20:30*pregressive quit (Ping timeout: 260 seconds)
09:23:52*Trustable joined #nim
09:24:53*coffeepot quit (Client Quit)
09:25:05*coffeepot joined #nim
09:53:29*Demon_Fox quit (Quit: Leaving)
09:56:50*kniteli quit (Ping timeout: 272 seconds)
10:01:17*cyraxjoe quit (Ping timeout: 250 seconds)
10:02:54*cyraxjoe joined #nim
10:04:12*coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
10:05:06*filcuc quit (Read error: Connection reset by peer)
10:05:33*filcuc joined #nim
10:16:39*HakanD_____ quit (Quit: Be back later ...)
10:36:33*coffeepot joined #nim
10:42:56*HakanD_____ joined #nim
10:47:48*HakanD_____ quit (Client Quit)
11:23:26*coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
11:23:46*gokr quit (Ping timeout: 240 seconds)
11:26:01*coffeepot joined #nim
11:29:56*gokr joined #nim
11:59:07*HakanD_____ joined #nim
12:02:19*HakanD______ joined #nim
12:03:44*HakanD_____ quit (Ping timeout: 255 seconds)
12:09:57*HakanD______ quit (Quit: Be back later ...)
12:11:48*krux02 joined #nim
12:12:00krux02hello people
12:12:10dom96hello krux02
12:13:23krux02I am trying to learn the macro system, and as a simple example, I would like to be able to write the symbolic derivitave of a polynom expression
12:14:18krux02derive(3*x+7,x) ~~~~> 3
12:14:31*HakanD_______ joined #nim
12:15:19krux02dom96: is it possible to write a macro for that?
12:15:42flyxwell it's not trivial, but definitely doable
12:16:10flyxI would rather write a normal runtime function to do it
12:16:27flyxand then just have "const result = derive(3*x+7,x)"
12:16:35flyxwhich would execute at compile time
12:16:55flyxhowever, you'd have to parse the function by hand then, from a string
12:17:02krux02then how would a runtime function look like?
12:17:19krux02oh string parsing
12:18:03flyxI actually implemented that once during my days in university, it's good for learing about parsing
12:18:10krux02no, for me it is more about learning the macros system that actually solving that problem
12:18:36krux02I know how to write a parser
12:18:49krux02I've done it is scala with it's parser combinators
12:18:52krux02was pretty cool
12:19:15flyxif you use a macro, the nim compiler will parse function, but you have to think about whether you want to support derive(`*`(3,x)+7,x)
12:19:22krux02my config file ready was 5 lines of code, and it produce directly the correct data structure I needed
12:19:41flyxthe nim parsing tree is far more complex that an AST of a polynom would be
12:20:09flyxso I'd suggest to first transform the nim tree to a polynom AST, and then execute the derivation algorithm on that
12:20:29krux02ok sounds like a good idea
12:21:15krux02how can I get the tree of a statement?
12:21:42flyxyou automatically get the root node as parameter in the macro
12:21:50flyxwhich contains all children
12:21:53*HakanD_______ quit (Ping timeout: 265 seconds)
12:22:06krux02is there a documentation about the ast?
12:22:20krux02how I can access the children etc?
12:23:34flyxeasiest way is to use dumpTree to view the tree you receive in the macro
12:23:45flyxdocumentation is here: http://nim-lang.org/docs/macros.html
12:25:24flyxyou can use the iterators items() or children()
12:25:39flyxor access a specific child with [n]
12:26:42flyxI suggest you start with: "macro derive(f: expr, v: expr): expr = dumpTree(f)"
12:28:53krux02what is the difference from items and children?
12:32:36krux02doesn't comple
12:32:56krux02Error: implementation of 'derive' expected
12:36:59*nicktick joined #nim
13:07:43*ozra joined #nim
13:08:27*jaco60 joined #nim
13:28:15flyxyou probably have to insert a new line after =. I have no nim compiler where I am, so I can just handwave
13:30:25*coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
13:31:41*coffeepot joined #nim
13:33:46*desophos quit (Read error: Connection reset by peer)
13:52:17*pregressive joined #nim
14:04:29*pregressive quit (Remote host closed the connection)
14:05:14*pregressive joined #nim
14:10:14*ekarlso quit (Ping timeout: 246 seconds)
14:15:09*pregressive quit (Remote host closed the connection)
14:15:44*pregressive joined #nim
14:15:52*BitPuffin joined #nim
14:17:13dom96krux02: You need to use echo(treeRepr(f)) instead of dumpTree.
14:18:16krux02dom96: thanks, I also found out how to use dumpTree
14:18:44krux02dom96: is there also a way to echo the source representation of a tree?
14:19:10dom96You mean of the whole source code?
14:19:49krux02if I have a parsed tree, and did some transformations, I would like to know how it would look like if it would be source again
14:20:18*pregressive quit (Ping timeout: 272 seconds)
14:20:29krux02just because I am more used to understand the source representation of the ast than the actual parsed ast
14:25:03flyxkrux02: echo repr(node)
14:30:28krux02:flyx: thank you
14:32:56*boopisaway is now known as boop
14:36:46*gokr1 joined #nim
14:36:48*gokr quit (Quit: Leaving.)
14:45:28yglukhovAnyone knows if i can get a unique id of a type?
14:56:45*nicktick quit (Quit: Leaving.)
14:58:30*pregressive joined #nim
14:59:01*ephja joined #nim
15:10:24Araq"the nim parsing tree is far more complex that an AST of a polynom would be"
15:10:31AraqI beg to differ :P
15:11:25Araqthe only difference is that you have nkIdent("+") (or symbols) rather than nkPlus
15:11:52Araqyglukhov: it's not exposed but the compiler has such an ID
15:15:28yglukhovAraq: ok, i've just written a macro, that computes a unique id based on getImpl(t) and lineinfo =)
15:15:55yglukhovso, Nim is pretty powerful as it is ;)
15:16:02Araqthat is actually what I plan to do in the compiler too
15:16:18Araqwith the canonicalizer
15:16:38Araqso everything gets a stable hash in the generated C code
15:17:19yglukhovnice
15:17:42yglukhovany progress with not nil btw? ;)
15:17:56yglukhovor raii or cyclic imports? :D
15:18:30Araqthere is progress with lambda lifting ...
15:18:50Araq'not nil' won't happen for v 1.0
15:19:03Araqraii is a bugfix away *cough*
15:19:18Araqand cyclic imports ... well, unlikely for v 1.0 either
15:20:18yglukhovraii is a bugfix away - really? that would be so awesome! just to make sure, are we talking about deprecating "non-destructible context" notion?
15:24:11*zepolen quit (Remote host closed the connection)
15:24:31Araqer ... no.
15:25:37yglukhovah thats a bummer
15:31:52Araqwhy?
15:32:08Araqwhat's wrong with the destructible context? I still like the idea
15:32:48krux02is it possible to get an nnkNode from an expression
15:33:35krux02something like: var node = toNode: var eaui = "1234"
15:33:46krux02and then in node I have an nnkNode
15:33:56yglukhovdestructible context makes destructors explicit. adding destructor to a library type would be a breaking change.
15:34:28yglukhovkrux02, if you're in a macro, you can use quote?
15:34:54yglukhovvar node = quote: var eaui = "1234"
15:34:58yglukhovor smth like that
15:37:02*smodo quit (Ping timeout: 246 seconds)
15:37:52yglukhovAraq, also, raii could make sequences to be library types =)
15:38:18Araqkrux02: macros.parseExpr ?
15:38:37*coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
15:38:45krux02ok quote seems ok
15:39:05yglukhovbut actually destructors are not needed for sequenses...
15:39:16yglukhovjust copying.
15:39:20krux02what is the difference from quote to getAst?
15:40:14krux02parseExpr takes a string as argument, that's not what I want to use
15:41:33*filcuc quit (Read error: Connection reset by peer)
15:42:58*coffeepot joined #nim
15:44:55Araqyglukhov: yeah but I don't think that's too important
15:45:44yglukhovok, what about refcounting?
15:46:08yglukhovusing an external refcountable resource
15:46:28Araqthat works with Nim's destructors, why wouldn't it.
15:46:56yglukhovnondestructible context? =)
15:47:14yglukhovin case you missed it: yglukhov: destructible context makes destructors explicit. adding destructor to a library type would be a breaking change.
15:47:48yglukhovthus adding a refcountable resource to a library object implies that.
15:47:59Araqyeah, but when I look at the typical examples, esp for "resources" I don't think this is a big problem
15:48:36Araqit becomes inconvenient when you use it for expression based stuff like bignums
15:50:26coffeepotwhat's the difference between destructors and RAII?
15:50:29*gokr1 quit (Quit: Leaving.)
15:50:57Araqfoo(open(), open()) # invalid, but also a bit unclear
15:51:41yglukhovcoffeepot: raii implies destructors? =)
15:51:44Araqdoes 'foo' take ownership of the two resources?
15:52:17Araqif so, we don't need to close them and the destructors are actually harmful
15:52:40Araqif not, we need the destructor calls.
15:53:15Araqthat's why I dislike the C++ solution so much, it blindly calls the destructor and then you need to patch it in the assignment/move operators
15:54:19coffeepotyglukhov, ah ok so destructors are just one half of RAII :) Araq: Do you have a solution in mind for the greedy ownership with RAII?
15:56:45yglukhovAraq, ok but how do i define a shareable resource? or a cached instance, which removes itself from the cache when no "references" remain?
15:58:07coffeepot^ that's what I'd like too, I would like to automatically free sql handles when they aren't being used, but can't rely on finalizers as they are not guaranteed to be called on program shutdown.
15:58:52Araqcoffeepot: that's a different issue. and misguided anyway.
15:59:22coffeepotwhat's a better solution?
15:59:44coffeepotcurrently closing handles on quitproc
15:59:50AraqI use addQuitProc too.
16:00:30coffeepotalright fair enough. I understand why the GC doesn't want to call finalizers on shutdown anyway
16:00:51krux02does nim have some form of mattern matich, to match for example an ast Node?
16:01:20reactormonkkrux02, https://github.com/andreaferretti/patty
16:02:26Araqpattern matching for ASTs is 1 line of code, but I forgot which line :P
16:02:37Araqneed to dig it out.
16:04:23krux02reactormonk: the "Things that do not work" section was pretty big
16:06:20krux02reactormonk: since I am used to scala pattern matching (pretty awesome), I guess pattern matching here is a not yet
16:06:34reactormonkkrux02, you can implement it ;-)
16:07:27krux02yea I can, maybe I will, but only if the language turns out to be awesome enough for me to use it for a longer time
16:07:46krux02but at the moment, almost nothing disappointing
16:10:26krux02but my question remains, who would noobs, who have absolutely no experience software engeneering would write a program, if macros would be one of their first taught skills?
16:17:04*kniteli joined #nim
16:19:10*ekarlso joined #nim
16:21:25Araqkrux02: the question remains unclear to me.
16:21:32Araqcan you paraphrase?
16:23:02krux02I would like to have a branch on the layout of the ast
16:24:04Araqa branch? nnkIfStmt ?
16:24:05krux02Araq: I could do it with lot's of ifs, like if node.kind == nnkCall and node[1] == !"abc" and ...
16:24:20Araqah, yeah, let's see
16:25:10*yglukhov quit (Ping timeout: 260 seconds)
16:28:13Araqtemplate `=~` (a, b): untyped =
16:28:38Araq template x(): untyped {.gensym.} = b
16:28:51Araq a == getAst(x())
16:29:23Araqif x =~ abc() # if x matches call to abc()
16:29:35Araqor something like that :P
16:30:05krux02where can I look up =~ ?
16:30:16AraqI just gave you its definition
16:33:19krux02is it in the standart library, or do I need to copy paste it in my code?
16:33:31Araqcopy pasta.
16:33:39krux02ok
16:33:56Araqit uses macros' notion of equality
16:34:19Araqwhich is usually overly restrictive since it doesn't support placeholders
16:34:29Araqwe need some better equality.
16:34:56Araqbut equality is tricky and that is why there is no builtin pattern matching in the language...
16:35:03Araqsee you later.
16:36:17krux02ok looks fancy
16:36:40reactormonkkrux02, you have ADTs via kind objects
16:36:52krux02ADT?
16:37:01reactormonkYou mentioned Scala, right?
16:37:10krux02yes
16:37:12reactormonkbasically sealed trait + case classes <=> kind objects
16:38:00krux02so then would a switch case statement on the nnkNode look like
16:38:12reactormonkSorry, they're called variants. http://nim-lang.org/docs/manual.html#types-object-variants
16:41:53*coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
17:02:32*kniteli quit (Ping timeout: 255 seconds)
17:14:16*krux02 quit (Quit: Page closed)
17:18:33*yglukhov joined #nim
17:22:46*yglukhov quit (Ping timeout: 240 seconds)
17:25:18*yglukhov joined #nim
17:44:05*yglukhov quit (Remote host closed the connection)
17:49:25*kniteli joined #nim
17:50:12*yglukhov joined #nim
17:52:04*gour joined #nim
17:56:54*yglukhov quit (Remote host closed the connection)
18:05:18*gour quit (Quit: WeeChat 1.3)
18:16:19*gour joined #nim
18:22:44*gour_ joined #nim
18:24:54*gour quit (Ping timeout: 256 seconds)
18:34:02*gour_ is now known as gour
18:36:33*yglukhov joined #nim
19:05:01*vendethiel joined #nim
19:12:51*solidsnack joined #nim
19:17:17*Matthias247 joined #nim
19:20:38*solidsnack quit (Quit: Textual IRC Client: www.textualapp.com)
19:31:59*solidsnack joined #nim
19:32:14*ozra_ joined #nim
19:35:55*ozra quit (Ping timeout: 265 seconds)
19:47:46*solidsnack quit (Quit: My Mac has gone to sleep. ZZZzzz…)
19:52:29*solidsnack joined #nim
19:55:58*sepisoad joined #nim
20:01:59*solidsnack quit (Ping timeout: 246 seconds)
20:04:04*BitPuffin quit (Ping timeout: 256 seconds)
20:10:53*solidsnack joined #nim
20:12:52*solidsnack quit (Read error: Connection reset by peer)
20:12:56*darkf quit (Quit: Leaving)
20:17:46*desophos joined #nim
20:19:40*solidsnack joined #nim
20:20:49*solidsnack quit (Client Quit)
20:22:49*Matthias247 quit (Read error: Connection reset by peer)
20:23:03Xehttps://github.com/Xe/code/tree/master/experiments/go-nim <-- calling Golang code from Nim
20:24:22*Matthias247 joined #nim
20:27:49*solidsnack joined #nim
20:29:12*allan0 joined #nim
20:31:26*allan0_ quit (Ping timeout: 272 seconds)
20:33:33*solidsna_ joined #nim
20:35:27*sepisoad quit (Quit: Leaving)
20:36:22*solidsnack quit (Ping timeout: 256 seconds)
20:56:58*jakesyl joined #nim
20:57:59*yglukhov quit (Remote host closed the connection)
21:00:11*JStoker quit (Remote host closed the connection)
21:01:38*gour quit (Quit: WeeChat 1.3)
21:13:46*JStoker joined #nim
21:14:27*Demon_Fox joined #nim
21:19:18*vqrs quit (Max SendQ exceeded)
21:19:35*tmm1 joined #nim
21:19:40*vqrs joined #nim
21:24:01*ingsoc joined #nim
21:26:49*yglukhov joined #nim
21:31:13*Matthias247 quit (Quit: Matthias247)
21:38:56*gokr joined #nim
21:39:07*Matthias247 joined #nim
21:39:43*solidsna_ quit (Quit: My Mac has gone to sleep. ZZZzzz…)
21:39:50*tmm1 quit (Ping timeout: 272 seconds)
21:48:54*ingsoc quit (Ping timeout: 256 seconds)
21:55:09*yglukhov quit (Remote host closed the connection)
21:59:51*solidsnack joined #nim
22:00:58*solidsnack quit (Client Quit)
22:05:17*solidsnack joined #nim
22:05:33*yglukhov joined #nim
22:10:08*irrequietus joined #nim
22:20:52*BitPuffin|osx joined #nim
22:27:02*boop is now known as boopisaway
22:29:42*jakesyl quit (Ping timeout: 256 seconds)
22:30:39*Matthias247 quit (Read error: Connection reset by peer)
22:39:20*johnsoft quit (Ping timeout: 256 seconds)
22:45:48*zepolen joined #nim
22:51:45*zepolen_ joined #nim
22:53:18*zepolen quit (Ping timeout: 272 seconds)
23:01:44*irrequietus quit (Read error: Connection reset by peer)
23:03:24*irrequietus joined #nim
23:14:31*Jesin quit (Quit: Leaving)
23:25:27*jakesyl joined #nim
23:30:18*yglukhov quit (Remote host closed the connection)
23:37:00*yglukhov joined #nim
23:38:53*yglukhov quit (Remote host closed the connection)
23:39:46*irrequietus quit ()
23:52:34*Trustable quit (Quit: Leaving)
23:53:32*ephja quit (Ping timeout: 265 seconds)