<<04-09-2012>>

04:16:38*Boscop quit (Disconnected by services)
04:16:40*Boscop joined #nimrod
05:16:54*Boscop quit (Disconnected by services)
05:16:56*Boscop joined #nimrod
06:14:49*q66 joined #nimrod
07:18:58*silven joined #nimrod
07:30:00fowlhttp://i.imgur.com/EtN3e.gif :D
07:32:04*Boscop quit (Disconnected by services)
07:32:06*Boscop joined #nimrod
07:39:47*Araq_ joined #nimrod
07:48:03*Araq_ quit (Quit: ChatZilla 0.9.88.2 [Firefox 14.0.1/20120713134347])
08:06:07*Boscop quit (Ping timeout: 240 seconds)
08:15:09*Boscop joined #nimrod
08:32:19*Boscop quit (Disconnected by services)
08:32:21*Boscop joined #nimrod
08:36:37*Boscop quit (Disconnected by services)
08:36:38*Boscop joined #nimrod
08:48:56*banisterfiend joined #nimrod
09:01:43*statarb3 joined #nimrod
09:03:05*statarb3 left #nimrod ("Leaving")
09:12:06*Araq_ joined #nimrod
09:12:24Araq_hi banisterfiend
09:12:34banisterfiendAraq_: hey
09:12:53Araq_most action happens here at night ;-)
09:14:38banisterfiendwhat's the action?
09:14:41banisterfiendnight where? :)
09:14:45banisterfiendisn't this an internatinoal channel? :D
09:14:59Araq_sure but most of us are europeans
09:15:23Araq_the action is sometimes language feature discussions
09:15:25banisterfiendoh ok
09:15:29banisterfiendim from amurca, the bronx
09:15:45Araq_sometimes ramblings
09:26:30Araq_I have to go, see you later
09:26:45*Araq_ quit (Quit: ChatZilla 0.9.88.2 [Firefox 14.0.1/20120713134347])
09:31:13*XAMPP_ quit (Read error: Connection reset by peer)
09:37:18*Boscop quit (Disconnected by services)
09:37:20*Boscop joined #nimrod
09:43:59*Boscop quit (Disconnected by services)
09:44:01*Boscop joined #nimrod
10:14:57*Araq_ joined #nimrod
10:16:48*Araq_ quit (Client Quit)
10:32:20*Boscop quit (Ping timeout: 248 seconds)
10:44:16*Boscop joined #nimrod
11:06:51*Boscop quit (Disconnected by services)
11:06:53*Boscop joined #nimrod
11:23:34*banisterfiend quit (Read error: Connection reset by peer)
11:50:42*XAMPP joined #nimrod
11:58:43*Araq_ joined #nimrod
11:59:23*Araq_ quit (Client Quit)
12:07:07*Boscop quit (Disconnected by services)
12:07:10*Boscop joined #nimrod
13:07:14*Boscop quit (Disconnected by services)
13:07:16*Boscop joined #nimrod
13:31:52*Araq_ joined #nimrod
13:32:14*Araq_ quit (Client Quit)
14:07:56*Boscop quit (Disconnected by services)
14:07:58*Boscop joined #nimrod
15:12:08reactormonkfowl: almost ;-)
16:07:26*Trix[a]r_za is now known as Trixar_za
16:33:17dom96Awesome. This will be perfect for Nimbuild: https://github.com/blog/1227-status-api
16:34:01dom96fowl: The poo ship is spinning :D
16:36:12Araqhi dom96
16:36:29dom96hello Araq
16:36:37Araqwe need NimBot to say hello to new guests
16:36:55Araqso we fake some activity :-)
16:38:47dom96That will be annoying though
16:38:59dom96I think you've already suggested this
16:41:51dom96Every time you rejoin "Hello Araq!"
16:42:46Trixar_zaMaybe make it remember people
16:44:07Trixar_zaSimple array of strings. I use it all the time to cheat.
16:46:01dom96hrm, well in fact.
16:46:05dom96!seen Araq
16:46:05NimBotAraq was last seen on Tue Sep 4 17:36:55 2012 in #nimrod saying: so we fake some activity :-)
16:46:13dom96NimBot already remembers :P
16:46:18dom96Trixar_za: Good idea.
16:50:29*shevy quit (Ping timeout: 248 seconds)
16:52:43Trixar_zaI'm the master of half-arsing stuff
16:56:06dom96lol
17:02:57*shevy joined #nimrod
17:18:23Araqdamn ... I figured out how Nimrod should work
17:18:33Araqbut we need to get 0.9.0 out
17:18:59Araqso what to do?
17:19:12Trixar_zaPull a Microsoft
17:20:04Araqwhat's that?
17:21:14*zahary joined #nimrod
17:21:43Trixar_zaRelease even if you're not ready for a release. Generally if the change needed for a true release is too complicated and require rewriting large amount, they just release what they have
17:21:51Trixar_zaThat's how we got Windows Vista
17:21:51Trixar_za:P
17:22:08Trixar_zalarge amounts of code*
17:22:15AraqI see, ok
17:22:28Araqzahary: turns out I'm stupid
17:22:40zaharyabout what?
17:22:47Araqand most of what TR macros can do can also be done with ordinary macros
17:23:11Araqa = b + c * d
17:23:26Araqmake + and * overloaded macros
17:23:53Araqand you can achieve quite the same as they can analyse the structure of their arguments
17:25:15zaharywell, ok, but it's supposed to make some things more convenient. and as I said before, the capability to merge multiple statements is the most useful part
17:25:29Araqreally? I don't know yet
17:26:03Araqthe examples I looked at really benefit from AST overloading
17:26:10Araqnot so much from term rewriting
17:26:28Araqtemplate re(pat: string{lit}, flags): TRegex =
17:26:43Araq var cached {.global.} = re(pat, flags)
17:26:45Araq cached
17:27:07Araqthe typ{pattern} stuff is really good
17:27:16Araqand needs to be done in sigmatch too
17:27:30zaharyyep
17:27:40Araqin fact, we're almost there, passing nOrig around
17:28:15zaharyexpr{string} is nicer for re specifically IMO
17:28:38Araqexpr{string} is the same as string{lit}, right?
17:29:10zaharydoes string{lit} try to evaluate more complex expressions?
17:29:24Araqnot yet, but it's planned
17:29:30zaharythat's what I meant
17:29:42Araqwell yeah they will become the same
17:29:54Araqand string{lit} is clearer IMO
17:30:41zaharyI don't really care - static{string} would be my vote
17:31:12zaharyTMyType{lit} is somewhat confusing
17:32:42zaharycould be string{static} too
17:37:48Araqand actually the AST constraint shouldn't be part of the type
17:38:10Araqit is right now, but that leads to all sort of problems
17:38:33AraqTObject{X} vs. TObject can only be done by cloning TObject
17:38:40Araqand keeping the ID the same
17:38:48Araqthat's a recipe for desaster
17:39:15Araqwe need to use (type, pattern) tuples
17:39:34Araqor maybe even (type, pattern, effect) for the planned effect system
17:40:42Araqoverloading resolution would work over (type, pattern) of course, not over the types only
17:41:27Araqand I wonder how many second class types like 'tyTypeDesc' can we get rid of with this approach
17:42:07Araqcurrently we use tyInt + typ.n to denote the special tyIntLit type for instance
17:43:43Araqthe "l-value" property is also a special pattern that could be abstracted over
17:44:37Araqcurrently we already perform a second semcheck pass over an nkCall to check against l-value violations
17:45:09Araqthis pass should do additional work like side effect analysis and alias analysis
17:46:56zaharycan you describe the planned effect system btw? we haven't talked about it I think
17:47:23Araqit's really simple, you introduce an effect like:
17:47:29Araq{.effect: io.}
17:47:42Araqand then mark some procs io
17:47:56Araqand procs that call io procs are marked io by the compiler too
17:48:12Araqand then you can do:
17:48:24zaharyare effects further parametric? like writing(foo)
17:49:08Araqproc no_IO {. ~ io.} # syntax debatable
17:49:49Araqthe effects list will also do exception tracking
17:50:02Araqparametric effects are not planned
17:50:33Araqif you have code like:
17:50:36Araqtry:
17:50:38Araq...
17:50:41Araqexcept EIO:
17:50:43Araq ...
17:50:45zaharywell, exception tracking requires them, no? throws(Error1, Error2)
17:51:09Araqthen of course the EIO exception will be removed of the list of possible effects
17:51:41Araqin fact, we can instead conflate effects and exceptions completely:
17:51:59Araqtype TMyEffect = object of EIO
17:52:31Araqbtw I found a way to make this analysis work with procvars
17:53:14zaharywithout full program analysis?
17:53:39Araqno ... ;-)
17:54:34Araqbut it's a minor point anyway IMO type T = proc {.nosideffect.} works nicely
17:55:07Araqbasically giving up inference when dynamic binding is involved
17:55:23Araqbut should work well enough in practice
18:04:38Araqso what do you have in mind for multi statements patterns?
18:05:14Araqeven basic copy propagation can't be done with it ...
18:06:07AraqI can only think of the 'write' optimization (which btw already works ;-) )
18:09:21*Trixar_za is now known as Trix[a]r_za
18:10:54zaharywell, indeed there are not so many examples besides the merging of statements like write - I probably can come up with something about merging network sends or graphics API calls, but they would be hardly realistic
18:11:27zaharyhow does it look like right now (merging writes) ?
18:12:42Araqsee tests/patterns/tstmtlist.nim
18:13:31Araqmore advanced it would look like:
18:14:32Araqtemplate optWrite{
18:14:34Araq write(f, x)
18:14:35Araq ((write|writeln){w})(f, y)
18:14:37Araq}(x, y: varargs[expr], w, f: expr) =
18:14:38Araq w(f, x, y)
18:15:33AraqI should test that :D
18:17:36zaharyand does it slow down compilation?
18:18:31Araqyes
18:18:37zaharyhow much?
18:18:55Araqbootstrapping is 2.5s vs 2.6s I think
18:19:07zaharyit's not that bad
18:19:08Araqbut that measures only the check against an *empty* pattern list
18:19:14zaharyaha
18:19:47AraqI can speed it up this test a bit
18:20:12zaharytest instead what will happen if you add the write pattern to the compiler
18:21:46Araqlater, brb
18:31:48*Reisen quit (Ping timeout: 276 seconds)
18:33:06*Reisen joined #nimrod
18:36:12AraqI've also gathered experience with tyProxy btw and it doesn't work the way I imagined
18:36:34AraqI needed that for better IDE support
18:36:53Araqwhere I mapped tyError to tyProxy
18:37:25Araqas an errornous type should match everything
18:37:51Araqso that 'suggest' works
18:40:13zaharyI think we are imaging tyProxy in a different way - xmlNode is a proxy type for me or luaObject
18:40:28zaharyprocs accepting these type doesn't match anything
18:41:27zaharyI thing I got what you want you mean by tyProxy at some point, but I can't quite recall now
18:41:42Araqto me it's the opposite of tyExpr
18:41:57Araqit tyExpr is a *param* everything matches against it
18:42:15Araqif tyProxy is an *argument* it matches every parameter
18:42:25zaharyah, I think I recall now
18:42:35Araqand a macro is attached to it
18:42:46Araqso that it's rewritten to:
18:43:06Araqf(proxy[m]) --> m(f, proxy)
18:44:12zaharythe rewrite part is what is certain
18:45:34zaharyyou mean that if I have a proc like foo(f: TFile) and I can pass some proxy object instead of TFile?
18:45:43Araqyes
18:46:12zaharyand somehow you create a false TFile type that have it's functions rewritten to the proxy's macro?
18:46:25zaharyis there some dynamic dispatching here
18:46:50Araqno
18:47:07zaharydo you compile foo twice then?
18:47:12Araqin sigmatch.nim every ty* comparison also checks against tyProxy
18:47:20Araqand tyProxy is a match
18:47:47zaharyI ask what C code is generated in the end?
18:47:50reactormonk\o/ proxy objects
18:48:31AraqC code is determined by the macro
18:49:32zaharylet's get back to foo(f: TFile) - obviously this function can be called with a real TFile, so it will be compiled with a concrete calls to the real TFile related procs
18:49:33Araqm(foo, args)
18:49:42zaharywhat happens when I call it with a proxy object instead
18:49:52Araqm(foo, args)
18:49:58Araq'foo' lost control
18:50:09reactormonkdo you get message call objects?
18:50:16Araq'm' says what to do
18:50:59zaharyah, I ask about the calls involving the proxy object inside foo
18:51:19Araqwell that's indeed one problem :D
18:51:20zaharybut the rewrite is never supposed to get to there..
18:51:42Araqanother is that we need to suppress ambiguity checking for tyProxy
18:52:17zaharywell, do you understand how my views about proxy objects are different?
18:52:18Araqand it suppresses generic instantiation too
18:52:52zaharyor should I give some examples
18:53:06Araqwell you seem to have Go-like interfaces in mind
18:53:15zaharynope
18:53:17Araqexcept that you
18:53:22Araqdon't start with them
18:53:36Araq;-)
18:53:51zaharylet's take luaObject for examples
18:54:14zaharythat's a regular value that can be stored in a variable, can be passed around in functions, etc
18:54:32Araqyeah and tyProxy turns it into an interface
18:54:53Araqand then you can pass something else fitting that interface
18:55:09zahary… except that when I try to call some unknown proc over it, the macro kicks in and rewrites it to placeLuaCall(luaObject, "ProcName", arguments)
18:55:51zaharythere is no part about "something else fitting the interface"
18:55:54Araqah! now I remember. :-)
18:55:56Araqyeah
18:56:06AraqI thought you want interface injection for concrete types
18:56:32Araqwhich is another cool idea breaking modularity and everything else ;-)
18:57:16zaharyyou mean something like implicit interfaces (dynamic dispatch with inferred vtable) and stuff along the lines of existential types
18:57:51Araqyeah but taken one step further:
18:58:09Araqthe code doesn't have to be changed to work with interfaces
18:58:32Araqinstead you inject everything later
18:59:26zaharywhat do you mean by inject here?
18:59:26Araqbut back to your idea: so you want x.f() to compile if 'f' is unknown
18:59:59zaharyif x is a proxy type
19:00:05Araqso x.f(args) transforms into x("f", args) ?
19:00:17Araqand x' has an overloaded operator() ?
19:00:34zaharyas I suggested before, terms rewriting is equivalent and gives you the ability to further filter when the rewrite will happen (but requires more cumber-some syntax)
19:00:52Araqterm rewriting is not equivalent
19:00:56zaharythe transformation is the old proxyMacro(x, f, args)
19:01:08Araqterm rewriting happens too late
19:01:27Araqif x.f(args) does not semcheck, it does not semcheck
19:01:37AraqTR doesn't help with that
19:01:37zaharyabout TR: it is if the pattern is { x.OP(args) } (OP: Ident ...)
19:01:56zaharydon't know whether you can say that right now
19:02:24Araqwell it's easy to support ;-)
19:02:40Araqand will slow down everything even more
19:02:51zahary:)
19:03:15Araqyou need to do the TR at the beginning of semExpr()
19:03:26Araqright now I do it only at the end of semExpr()
19:03:32zaharyI can live with specialized faster-to-compile tyProxy handling
19:04:13Araqwell there is already --patterns:off ;-)
19:04:28Araqand you can turn it on and off just like array index checks
19:04:31zaharybut proxy types are not merely optimization
19:04:38Araq{.push patterns:on.}
19:04:40zaharythey must execute always
19:04:43AraqI know
19:04:58Araqjust like some overflow checks
19:05:31Araqwe can turn them off for the stdlib for instance, right?
19:06:01*Zerathul joined #nimrod
19:07:22zaharythe patterns?
19:07:48zaharyI think each pattern should control its own application
19:07:49zaharywhen release:
19:07:49zahary complex optimization rule
19:09:43Araqbtw compile time is not affected with a simple optWrite rule in system.nim
19:10:08zaharyso it's not that bad after all
19:13:06Araqdunno 'write' is not a common call
19:13:35zaharythrow in the concat optimisation too :)
19:14:33zaharyit's looking nice btw - would be harder without patterns (although I remember the specialised merge pragma alternative too)
19:15:13Araqit also doesn't work the way you think it does ;-)
19:15:33Araqbecause in x & y & z
19:15:44Araq(x & y) is "optimized" already
19:15:58Araqand then (x & y) & z matches later
19:16:12Araqso you have to ensure it remains sane
19:16:52zaharyyou mean the pattern matches (x & y) initially?
19:17:14Araqit matches `&`*a already
19:17:28Araqand gets transformed
19:17:42zaharyit's not greedy?
19:17:43Araqand then (x & y) & z matches too
19:17:53Araqit is greedy
19:18:07*Zerathul quit (Quit: ChatZilla 0.9.88.2 [Firefox 14.0.1/20120713134347])
19:18:10Araqbut the bottom up recursion works that way
19:18:30Araqand I can't help it
19:18:39Araqyou wanted it in semExpr ... :P
19:18:59zaharybut what's the aftermath - do I end up with two calls to the optimised concat proc?
19:21:54Araqyes
19:21:59Araqif you're not careful ;-)
19:22:19zaharyI see that in the test case there is a single call
19:22:39zaharydoes the parenthesis have something to do with it?
19:23:21Araqno there is special logic with 'varargs'
19:23:28Araqand nkArgList
19:23:30Araqso that it works
19:24:36Araqwell I guess ordinary users of the * feature don't need to be careful anymore
19:24:52Araqbut it was a puzzle to get it to work
19:25:03zaharyI'm still not quite understanding the issue, but I can look at the code later
19:26:07zaharyit seems to me that what you said will always be true (any binary operator will match the initial two arguments and apply the rule early)
19:26:43Araqyes
19:28:57Araqouch!
19:29:09AraqI didn't export the template for the speed test ...
19:29:26zaharycan I skip the second varargs template?
19:29:26zaharytemplate optimizeConcat { `&&`* args } ( args: varargs[string] ) = ...
19:30:07Araqgood question ...
19:31:36Araqwell it's a bit slower but not much, 2.65s vs. 2.60s
19:31:40Araqfor this pattern:
19:31:42Araqtemplate optWrite*{len(x)}(x: expr): expr = len(x)
19:31:51Araqand 'len' is very common ;-)
19:34:16Araqand yeah there is special logic so that it doesn't recurse endlessly
19:43:57zaharyI'm getting 1.433 -> 1.5
19:44:11zaharyit's interesting that adding more patterns doesn't seem to slow it much further
19:45:19zaharyalso, most time is spent in the C compiler usually (which is not even measured here)
19:46:22zaharyso how do my views about tyProxy fit in your picture?
19:53:01Araqyou need to add the pattern stuff to the begin of semExpr
19:53:08Araqand then it may already work
19:54:41Araqmost patterns are nkCall(ident, ...)
19:54:52Araqand you have a mismatch already with 'ident'
19:55:08AraqI guess we could special case that for better performance
19:59:10Araqer, zahary, you need to do --hint[Pattern]:off for better results
19:59:24Araqconsole output is always significant
19:59:40Araqunless your patterns never match ;-)
20:03:41zaharyah, didn't know how to do that - it shaved off another 0.1s
20:13:15Araqwe also need an order for ASTs for canonicalization of commutative ops
20:13:58Araqtemplate commPlus{ a + b}(a: expr{lit}, b: expr) = b + a
20:14:17Araqis already quite nice but it'd better be done with some builtin
20:15:17Araqluajit uses some arbitrary order based on variable slots etc. if I understood the code correctly ...
20:32:17Araqo.p(args) --> m(o, "p", args)
20:33:08AraqnkCall(nkDotExpr(o, p), args)
20:33:28Araqbut you want 'o' to be semchecked
20:33:33Araqbefore kicking in ... hm
20:35:05zaharymy plan was always to determine the types of expressions lazily - if the rule matches nkCall, but requires some of the sub-expressions to be typed, then determine their type on the spot
20:35:56Araqthat's basically my "two phase type system" that plays nicer with macros
20:36:28fowlwhats the lambda keyword or
20:36:30fowlfor*
20:36:48Araqso 'unknownIdent' would get a type 'tyUnkown' and can be passed to a macro can use it
20:37:08Araqfowl: it's not used
20:37:32fowlo
20:42:50Araqbut if 'p' doesn't exist you can use that to do the transformation
20:43:46Araqno need for 'o' to be of tyProxy, right?
20:48:39Araqer .. never mind, I got it now
20:52:09*zahary quit (Quit: Leaving.)
21:22:36fowlAraq: what doyou think about a special symbol like thisModule to refer the current module
21:22:53reactormonkfowl: what would it be used for?
21:23:18fowlotherwise if you change the name of your file you have to change uses of your module name in the file. good example of this is the gtk examples that all refer to ex1.destroy
21:24:04fowlreactormonk: only valid during symbol resolution phase
21:24:12fowlif that is a phase
21:24:35Araqkind of
21:24:51Araqit's also intermixed with type checking
21:25:17Araqand a bunch of adhoc analysis which start to bite me ...
21:59:05Araqwell fowl, to answer your question some builtins like 'currentmodule', 'currentfile' are nice, yes
21:59:16Araqbut I'm overwhelmed with work :P
22:00:02Araqand I have to sleep now, good night
22:00:27*EfTwelve quit (Quit: ChatZilla 0.9.88.2 [Firefox 15.0/20120824154833])
22:04:09fowlbye
23:04:57*q66 quit (Quit: Quit)