01:01:10 | fowl | is there any info on term rewriting macros? |
06:04:53 | * | rking joined #nimrod |
06:05:15 | Araq | hi rking |
06:05:29 | rking | Having a bit of trouble finding "nake". I have nimrod itself installed, and I'm looking at a nakefile.nim, but not having success with web searches. |
06:05:33 | rking | Araq: Howdy. =) |
06:05:42 | Araq | fowl: I'm writing the docs now |
06:06:27 | fowl | rking: its in a gist, 1 sec |
06:06:29 | rking | Aha, it's in dependencies/nake. (Compiling fowl's thing) |
06:06:43 | fowl | https://gist.github.com/3607822 |
06:06:51 | rking | Urr, there's an empty dir there. |
06:07:01 | fowl | rking: its a submodule, git submodule init |
06:08:17 | rking | fowl: Is it yours? |
06:08:27 | rking | nake, that is. |
06:08:45 | fowl | yea |
06:08:58 | rking | Nice use of nakefile.nim to install nake. =D |
06:11:41 | fowl | now i just need a nakefile to install the the nakefile :> |
06:11:44 | rking | Also I like the idiom of splitting $PATH then prompting. |
06:14:29 | rking | fowl: How do I make it know where to "import nake" from? |
06:15:19 | fowl | rking: thats the one thing i havent solved yet >_> i just pushed the nakefile's nimrod.cfg to the repo |
06:17:43 | rking | k thanks. |
06:18:58 | rking | fowl: My output of nake all: https://gist.github.com/4dce6a00123e34e27148 |
06:19:22 | rking | I gotta jet for now, but I want to check out your stuff at some point. |
06:19:33 | fowl | rking: whats your nimrod -v |
06:19:49 | rking | Just got it from github; Nimrod Compiler Version 0.8.15 (2012-09-08) [Linux: amd64] |
06:21:20 | Araq | fowl: do you *need* the TR macros, or do you want to play with them? :D |
06:21:20 | fowl | hm ok |
06:22:30 | fowl | the latter |
06:28:09 | Araq | well just read the tests/patterns/*.nim files |
06:30:27 | Araq | these all bad examples because they change semantics to prove the tr macros are triggered ;-) |
06:52:01 | Araq | have to go, see you later |
10:03:56 | * | q66 joined #nimrod |
11:56:09 | * | apriori_ joined #nimrod |
12:38:16 | apriori_ | hey guys |
12:38:22 | apriori_ | is there a static initializer for objects? |
12:50:30 | * | apriori_ quit (Ping timeout: 244 seconds) |
13:24:31 | * | bugmagnet joined #nimrod |
13:33:25 | * | bugmagnet quit (Quit: HydraIRC -> http://www.hydrairc.com <- In tests, 0x09 out of 0x0A l33t h4x0rz prefer it :)) |
14:46:20 | * | XAMPP quit (Quit: Leaving) |
15:27:59 | * | XAMPP joined #nimrod |
15:51:20 | reactormonk | Araq: "static initializer"? |
15:57:44 | fowl | reactormonk: i think its a device used to create mad scientist hair |
18:00:19 | * | apriori_ joined #nimrod |
18:07:57 | * | fowl quit (Ping timeout: 245 seconds) |
18:14:40 | Araq | oh hi apriori_ |
18:15:00 | Araq | you can use a compiletime proc to get a "static initializer" |
18:15:38 | Araq | well ... you can't use them in 'const' for now I think |
18:20:57 | apriori_ | ah, ok |
18:21:07 | apriori_ | but I more meant.. syntax wise.. |
18:21:24 | apriori_ | there is no way like: var bla: SomeType = SomeType(....)? |
18:22:17 | apriori_ | I ask.. because, well, correct me if I'm wrong, but couldnt those be autogenerated? |
18:23:15 | Araq | well we're still figuring out how to introduce constructors |
18:23:39 | Araq | my favourite solution for now is to only support initializers |
18:23:58 | Araq | so no parameters |
18:24:09 | Araq | type tobj = object |
18:24:18 | Araq | x: int = 12 # override default 0 value |
18:24:31 | Araq | var o: tobj # o.x == 12 here |
18:25:07 | apriori_ | ok |
18:25:18 | Araq | this way, setLen(x, 4) can do a proper job |
18:25:41 | apriori_ | I only see the problem that there will be lack of convention |
18:25:53 | apriori_ | like.. one doesn't quite now how usual constructor functions are called |
18:26:02 | apriori_ | create_X, construct_, make_X whatever |
18:26:04 | Araq | so what |
18:26:30 | Araq | this problem exists for all other procs too |
18:27:14 | apriori_ | yeah, sure |
18:27:19 | Araq | and for now the add/del/initT/newT convention works good enough |
18:29:07 | apriori_ | okay |
18:29:14 | Araq | http://nimrod-code.org/apis.html |
18:29:27 | Araq | most of the stdlib adheres to this btw |
18:30:40 | apriori_ | okay |
18:30:42 | apriori_ | thanks |
18:33:43 | * | fowl joined #nimrod |
18:35:15 | Araq | and yeah that document should mention the newT, initT convention |
18:36:42 | Araq | hi fowl |
18:36:49 | fowl | yo |
18:36:58 | Araq | have you played with tr macros yet? |
18:37:24 | fowl | yea so far im just using them to be lazy |
18:37:40 | Araq | how so? |
18:42:10 | fowl | i use it to implement newExplosion(), i dont have an explosion type, they are just one-shot animations |
18:42:48 | Araq | gist please, I'm curious |
18:43:53 | fowl | but the order of arguments i would send to newExplosion() is different than the function it calls |
18:43:57 | fowl | https://github.com/fowlmouth/keineSchweine/blob/master/keineschweine.nim#L168 |
18:44:42 | Araq | lol you could have used an ordinary template instead |
18:45:06 | fowl | also i call it from unrelated objects (anything that has a body field is ok) |
18:45:22 | Araq | if your pattern looks like 'newExplosion(a, b, c)' it's hardly a *pattern* :P |
18:45:22 | fowl | last i tried i couldnt have two templates with the same name |
18:45:36 | Araq | oh |
18:46:10 | Araq | well that's easily implemented |
18:46:14 | fowl | i dont need crazy syntax hax, just things like this to keep things DRY |
18:48:48 | Araq | it's an oversight because templates used to not participate in overloading resolution |
18:50:45 | fowl | it would work now? |
18:51:02 | Araq | not yet |
18:51:07 | Araq | added it to my todo |
18:51:25 | fowl | ah |
18:52:27 | * | apriori_ quit (Quit: Konversation terminated!) |
20:33:50 | * | shevy joined #nimrod |
20:40:19 | Araq | ping dom96 |
20:40:25 | dom96 | pong |
20:40:38 | Araq | I'm thinking about exception tracking in the compiler |
20:41:35 | Araq | and wonder what would the pragmas should look like: |
20:42:14 | Araq | {.noexceptions.} # compiler verifies no exceptions can occur at this point |
20:42:36 | Araq | like in: |
20:42:39 | Araq | try: ... |
20:42:49 | Araq | except: handleExceptions() |
20:42:56 | Araq | {.noexceptions.} |
20:44:26 | Araq | we also need: {.noexception: EOS.} # EOS has not been forgotten to be handled |
20:45:22 | Araq | what do you guys think? |
20:52:29 | fowl | i probably wouldnt use |
20:53:12 | fowl | i just let exceptions crash the program most the time |
20:53:29 | Araq | *shrug* IMHO I'm a genius and solved Java's checked exceptions problem :P |
20:53:42 | fowl | can you add a dialog box with a cute little bomb exploding animation? |
20:54:06 | Araq | you can do that, hack system/excpt.nim |
20:55:17 | fowl | http://files.artlung.com.s3.amazonaws.com/artlung.com/blog/wp-content/uploads/2007/10/mac-os-bomb-system-error.gif |
20:55:39 | fowl | "unimplemented trap" how informative :p |
20:55:52 | dom96 | I am so implementing that in Aporia. |
20:55:53 | dom96 | :P |
20:56:06 | fowl | my error dialog would just combine two or three technological-sounding words |
20:56:20 | fowl | the rest in korean |
20:56:50 | Araq | the error dialog should quote some aphorism |
20:57:10 | Araq | "learn to fish you idiot!" :D |
21:04:27 | Araq | ping reactormonk |
21:30:41 | zahary | Araq, the exception tracking sounds cool. add a whitelist option (please, insure that only these exceptions can exit from here) to make it complete |
21:31:20 | Araq | oh hi zahary |
21:32:10 | Araq | yeah, both whitelist and blacklist are needed I guess |
21:32:24 | zahary | sorry for not responding earlier, I was away for most of the weekend |
21:34:24 | Araq | np, I went with the RPN solution |
21:36:16 | zahary | RNP? |
21:36:35 | zahary | ah, reverse polish |
21:37:58 | zahary | well, callsite() is always available so I don't see much of a problem - all kinds of flattened views are potentially just a call away (given that helper procs exist) |
21:38:17 | zahary | var old_style = flatten(callsite()) |
21:39:22 | Araq | it's not as easy without an API to analyse types ;-) |
21:47:22 | Araq | you have to ensure that x & (3 & 7) & y doesn't match "too deeply" |
21:48:07 | Araq | and the TR stuff is now an extra pass so that top down matching can be done |
21:50:50 | Araq | I'm unsure what to do with exceptions like EInvalidIndex that are not 'raise'd explicitely |
21:51:32 | Araq | code uses some proc in strutils and the compiler notices it could raise EInvalidIndex but the proc is correct, so the indexes are always correct |
21:52:21 | Araq | and so EInvalidIndex screws up your {.noexception.} annotation |
21:52:50 | zahary | well, this is equivalent to the "user overridden effects" I talked about the other day |
21:53:26 | Araq | true |
21:53:56 | zahary | potentially, there may be a semi-automated solution making use of dependent typing information, but some manual overriding will probably always remain necesarry |
21:56:43 | fowl | er this is weird: https://gist.github.com/3687545 |
21:57:20 | Araq | on the other hand, exceptions like EInvalidIndex are surreal |
21:57:32 | Araq | as you can't catch them reliably |
21:57:43 | Araq | they will be gone in a release build |
21:57:48 | zahary | how much of a second pass is TR now? if I create a pattern for statements like if and for, can I affect the semantics of the inner block? |
21:58:34 | Araq | you can always affect semantics as the compiler can't check against that |
21:58:48 | Araq | however you cannot affect semchecking |
22:00:28 | zahary | what I mean is that if sem is ran over the body of the if statement before the rewrite is triggered I cannot replace the meaning of some ident inside it or set a dependent type value |
22:01:15 | zahary | … if you remember my if TOption[T]: body optimization |
22:01:41 | Araq | I remember and I think it's still possible |
22:03:00 | Araq | template t{ if x.check: x.get() }(...) = if x.check: x.fastGet() |
22:04:11 | Araq | however a harder problem is that we have no proper search operator |
22:04:23 | zahary | well, the body can be much more complicated with x.get() appearing somewhere within it |
22:04:43 | Araq | { if x.check: A; x.get() } |
22:04:53 | Araq | where A does not affect 'x' |
22:05:09 | Araq | this is the CSE problem ;-) |
22:06:19 | zahary | instead, it's not general, but rather the designer of the Option[T] type knows specifically that's it's ok for his particular type |
22:09:47 | Araq | fowl: that's not weird, that's how it should work |
22:10:22 | Araq | 'sleep' doesn't require the CPU ... |
22:20:24 | Araq | ah, zahary, I think I get what you mean now :D |
22:20:36 | fowl | o |
22:20:44 | fowl | Error: undeclared field: 'spriteSheeet' lol -_- |
22:24:33 | zahary | I'm thinking about a solution right now - maybe both the bottom-up-pre-sem and top-down-after-sem paths can be kept and they can be used depending on the pattern (it seems to me that the param types can determine that) |
22:28:53 | Araq | how so? the param types can't do that |
22:29:00 | zahary | if you remember, when we introduced immediate, I suggested that in the future we may add param type such as "raw stmt" that will allow you to have a "mixed" immediate/late templates and macros - e.g. template foo(a: string, b: TFoo, body: stmt{raw}) = … |
22:30:03 | zahary | sem won't be run on the body yet, just like in an immediate template - something similar can work for patterns too |
22:30:32 | Araq | maybe |
22:31:13 | Araq | but I think it's overly complicated |
22:31:29 | Araq | you want a proper optimizer instead to hook into |
22:33:44 | Araq | well you can do: macro analyse{x}(x: stmt): stmt |
22:34:03 | Araq | and implement the whole analysis there |
22:34:58 | zahary | some way must exist to hook your dependent type modifier functions to control flow statements - the pattern matching facility sounds like a good place to do it |
22:40:20 | * | Trix[a]r_za is now known as Trixar_za |
23:06:07 | * | q66 quit (Quit: Quit) |
23:14:25 | * | zahary quit (*.net *.split) |
23:14:25 | * | fowl quit (*.net *.split) |
23:14:25 | * | shevy quit (*.net *.split) |
23:14:26 | * | Roin quit (*.net *.split) |
23:14:26 | * | comex quit (*.net *.split) |
23:14:27 | * | Reisen quit (*.net *.split) |
23:14:27 | * | mal`` quit (*.net *.split) |
23:14:27 | * | ccssnet quit (*.net *.split) |
23:14:27 | * | CodeBlock quit (*.net *.split) |
23:14:28 | * | Boscop quit (*.net *.split) |
23:14:30 | * | XAMPP quit (*.net *.split) |
23:14:30 | * | rking quit (*.net *.split) |
23:14:30 | * | JStoker quit (*.net *.split) |
23:14:30 | * | dom96 quit (*.net *.split) |
23:14:30 | * | Araq quit (*.net *.split) |
23:14:30 | * | Trixar_za quit (*.net *.split) |
23:14:31 | * | Amrykid quit (*.net *.split) |
23:14:31 | * | silven quit (*.net *.split) |
23:14:32 | * | reactormonk quit (*.net *.split) |
23:15:33 | * | shevy joined #nimrod |
23:15:33 | * | fowl joined #nimrod |
23:15:33 | * | XAMPP joined #nimrod |
23:15:33 | * | rking joined #nimrod |
23:15:33 | * | Boscop joined #nimrod |
23:15:33 | * | zahary joined #nimrod |
23:15:33 | * | Amrykid joined #nimrod |
23:15:33 | * | Araq joined #nimrod |
23:15:33 | * | Reisen joined #nimrod |
23:15:33 | * | silven joined #nimrod |
23:15:33 | * | mal`` joined #nimrod |
23:15:33 | * | JStoker joined #nimrod |
23:15:33 | * | Roin joined #nimrod |
23:15:33 | * | dom96 joined #nimrod |
23:15:33 | * | reactormonk joined #nimrod |
23:15:33 | * | Trixar_za joined #nimrod |
23:15:33 | * | comex joined #nimrod |
23:15:33 | * | ccssnet joined #nimrod |
23:15:33 | * | CodeBlock joined #nimrod |
23:31:42 | * | Trixar_za is now known as Trix[a]r_za |
23:42:22 | * | zahary quit (Quit: Leaving.) |