01:05:52 | * | XAMPP quit (Read error: Connection reset by peer) |
08:27:07 | * | zahary joined #nimrod |
13:47:36 | * | q66 joined #nimrod |
14:51:35 | * | XAMPP joined #nimrod |
14:57:42 | * | XAMPP quit (Read error: Connection reset by peer) |
15:00:10 | reactormonk | Araq: playing alpha centauri :-) |
15:16:42 | * | zahary quit (Quit: Leaving.) |
15:26:55 | * | Guest69842 joined #nimrod |
15:32:21 | * | Guest69842 quit (Quit: Leaving) |
15:32:43 | * | XAMPP_ joined #nimrod |
15:45:25 | * | XAMPP_ quit (Quit: Leaving) |
15:54:19 | Araq | ping reactormonk |
15:55:54 | reactormonk | yep? |
15:56:05 | Araq | good taste btw |
15:56:13 | Araq | alpha centauri is great |
15:56:21 | reactormonk | now to get it running on my netbook |
15:56:26 | Araq | I thought you could work on floating point checks |
15:56:34 | reactormonk | standard difficultiy is booring |
15:56:40 | reactormonk | that is? |
15:57:12 | Araq | well we already have NaN and INF checks |
15:57:25 | Araq | but only for basic builtins like + and * |
15:57:33 | Araq | we need these for math.sin etc. |
15:57:37 | reactormonk | would you know where to read up on image matching? We have to read a paper on SIFT, but I have no clue of image matching at all... |
15:57:56 | Araq | me neither, sorry |
15:58:35 | reactormonk | proc `*` *(x, y: float): float {.magic: "MulF64", noSideEffect.} |
15:58:38 | reactormonk | huh? |
15:59:33 | reactormonk | where is that stuff? So I can see how NaN/INF is done |
16:00:01 | reactormonk | and I suppose they need to be able to be disabled |
16:02:10 | Araq | reactormonk: it's in the codegen |
16:03:18 | Araq | ccgexprs.binaryFloatArith |
16:05:02 | reactormonk | which file? |
16:05:13 | Araq | ccgexprs.nim |
16:05:33 | reactormonk | in compiler/ - $PWD was in lib/ :-/ |
16:05:44 | Araq | yeah |
16:06:04 | Araq | we need some other way to deal with this |
16:06:27 | Araq | we need a 'guard' proc that performs the requested checks |
16:06:47 | reactormonk | huh? |
16:06:51 | reactormonk | http://sprunge.us/fDRI <- found this |
16:07:20 | Araq | yeah that's what I'm talking about |
16:09:50 | Araq | well for a start somebody needs to check which compilers support C99's fpclassify() |
16:11:39 | Araq | in fact, tr macros can be used to inject the code with the guard |
16:14:44 | Araq | but hm, apparently visual c++ now has fpclassify :-) |
16:15:28 | reactormonk | what's that "guard" you wish implemented? |
16:16:27 | Araq | something that merges nanCheck() and infCheck() |
16:16:39 | Araq | both to be found in lib/system/arithm.nim btw |
16:17:37 | reactormonk | proc infCheck(x: float64) {.compilerProc, inline.} = |
16:17:40 | reactormonk | if x != 0.0 and x*0.5 == x: raiseFloatOverflow(x) |
16:17:49 | reactormonk | ... compile-time check for something better? |
16:18:12 | Araq | can't be checked at compile-time |
16:18:50 | reactormonk | isNaN n stuff? |
16:19:14 | Araq | INF / INF == NaN iirc |
16:19:35 | Araq | we need something like: |
16:20:16 | Araq | type FPGuardFlag = enum checkInf, checkNan, checkSubnormal |
16:20:36 | Araq | proc floatGuard(x: float64, checks: set[FPGuardFlag]) {.compilerproc, inline.} = |
16:21:02 | Araq | if checkInf in checks: noInf(x) |
16:21:11 | Araq | if checkNan in checks: noNan(x) |
16:21:25 | Araq | if checkSubnormal in checks: noSubnormal(x) |
16:22:02 | Araq | and noInf, noNaN, noSubnormal raise the proper exceptions should 'x' fail the test |
16:23:09 | * | shevy quit (Ping timeout: 252 seconds) |
16:23:15 | Araq | well the real implementation should be more efficient and only call fpclassify() once |
16:24:07 | reactormonk | FPGuardFlag looks global to me |
16:24:26 | reactormonk | well, semi-global as in lisp? :-) |
16:25:26 | Araq | what's semi-global in lisp? |
16:29:37 | Araq | but then again the whole feature can now be implemented as a library ;-) |
16:30:12 | Araq | template floatCheck*{x}(x: float{call}): expr = |
16:30:18 | Araq | let y = x |
16:30:40 | Araq | floatGuard(y) |
16:30:42 | Araq | y |
16:31:56 | reactormonk | Araq: (let (*semi-global* "foo") ... further code with *semi-global* set to something else ... ) |
16:32:20 | reactormonk | why call it floatGuard and not floatCheck? |
16:32:42 | Araq | *shrug*, call it floatCheck then |
16:33:06 | Araq | well the template should be called floatGuard |
16:33:40 | Araq | semi-global sounds like overriding something in system.nim |
16:33:57 | Araq | btw nimrod now has a hygienic macro system :P |
16:35:32 | reactormonk | \o/ |
16:35:41 | * | shevy joined #nimrod |
16:36:31 | reactormonk | where should the code go? |
16:36:44 | reactormonk | arithm.nim ? |
16:36:50 | Araq | yeah |
16:38:22 | Araq | fowl: overloading of templates works for me |
16:38:38 | Araq | without any bugfixes |
16:40:37 | reactormonk | Araq: need a fallback for fbclassify? |
16:41:19 | Araq | don't think so |
16:41:24 | Araq | even visual c++ has it now |
16:46:44 | fowl | Araq: ah, works for me too ._. |
16:51:20 | * | XAMPP joined #nimrod |
16:51:20 | * | XAMPP quit (Changing host) |
16:51:20 | * | XAMPP joined #nimrod |
17:10:29 | * | XAMPP quit (Quit: Leaving) |
17:10:50 | * | XAMPP joined #nimrod |
17:10:50 | * | XAMPP quit (Changing host) |
17:10:50 | * | XAMPP joined #nimrod |
17:11:17 | * | apriori_ joined #nimrod |
17:11:22 | apriori_ | hi guys |
17:11:34 | apriori_ | is there a reason why low, high and len dont work on tuples? |
17:11:54 | apriori_ | I mean, sure its always low = 0 and high = len-1.. but I cant call those functions with a tuple |
17:13:44 | reactormonk | go ask Araq |
17:14:09 | apriori_ | Araq: ? :) |
17:14:33 | Araq | never occured to me they would be useful for tuples |
17:14:41 | apriori_ | why not? |
17:14:46 | Araq | as tup[idx] only works if idx is a constant value |
17:14:56 | apriori_ | oh |
17:15:12 | Araq | you can use system.fields to iterate over the fields, but it creates a 'fake' loop |
17:15:25 | apriori_ | ok |
17:16:31 | apriori_ | thank you |
17:26:15 | Araq | apriori_: use array[0..2, float] instead of tuple[x,y,z: float] to get a[i] |
17:26:27 | Araq | with a variable 'i' |
17:27:44 | apriori_ | Araq: yeah, I figured.. |
17:27:59 | apriori_ | but I would really prefer both: index based access and .fieldname based |
17:29:13 | Araq | you can define accessors for the the array, but hm yeah |
17:29:29 | Araq | you use freebsd, right? |
17:29:35 | apriori_ | currently on arch linux |
17:29:38 | apriori_ | freebsd is on my laptop |
17:29:39 | Araq | can you help this guy: http://forum.nimrod-code.org/t/69 |
17:29:40 | Araq | ? |
17:29:51 | apriori_ | yeah |
17:31:00 | apriori_ | huh |
17:31:11 | apriori_ | well.. I could run nimrod on both, freebsd and pcbsd |
17:31:24 | apriori_ | juding by his uname -a that's pcbsd (which is like > 95% freebsd) |
17:35:29 | Araq | apriori_: check out the new TR macros |
17:35:44 | Araq | they allow operator overloading on steriods |
17:35:45 | apriori_ | got no idea what that is ;) |
17:35:59 | apriori_ | where can I find the docs? |
17:36:08 | Araq | it's especially designed for matrix operations |
17:36:09 | apriori_ | are these only in github right now? |
17:36:22 | Araq | yeah, well |
17:36:30 | Araq | in ten minutes nimbuild will have built the docs |
17:36:38 | Araq | and I'll post a link :D |
17:36:42 | apriori_ | good ;) |
17:36:43 | apriori_ | thank you |
17:37:08 | apriori_ | are tr macros unique to nimrod or is that some established name for something? |
17:37:44 | Araq | term rewriting is established |
17:37:50 | Araq | but nimrod's implementation is unique |
17:38:25 | Araq | afaik no other language has ever supported term rewriting with side effect and alias analysis |
17:38:40 | apriori_ | okay |
17:39:05 | apriori_ | now I'm quite curious ;) |
17:45:22 | Araq | ugh, nimbuild failed :-/ |
17:46:17 | apriori_ | oops ;) |
17:48:19 | dom96 | Araq: Docs get generated after testing :P |
17:48:42 | Araq | well gc.html does not exist either |
17:52:02 | dom96 | trmacros does now |
17:52:44 | Araq | http://build.nimrod-code.org/docs/trmacros.html, there you go, apriori_ |
17:52:57 | apriori_ | Araq: on it ;) |
17:55:57 | reactormonk | Araq: got alpha centauri working on my laptop... but the fonts suck balls. |
17:56:46 | Araq | does that mean you have plenty of time for nimrod now? |
17:57:08 | reactormonk | nah, shower & lecture now |
17:58:01 | apriori_ | Araq: pretty much what I once wanted.. |
17:58:13 | apriori_ | this should make writing code converters much easier |
18:02:29 | Araq | not only code converters |
18:03:06 | Araq | bignums and matrixes can be implemented as efficient as if they would have been built-in |
18:06:55 | apriori_ | user defined constrains would be insane |
18:07:11 | apriori_ | those would allow such operations to be implemented in a more "high level" way |
18:07:16 | Araq | what do you have in mind? |
18:07:31 | apriori_ | currently you check e.g. whether something is an alias, macro etc.. |
18:07:59 | apriori_ | what about a user defined check, whether e.g. the type of A is something specific or satisfies a boolean proc? |
18:09:06 | apriori_ | currently one would have to use the "low level" constraints and check the others in the template |
18:10:17 | Araq | true |
18:13:37 | Araq | well you want param{predicate} and that's it? |
18:14:00 | Araq | but then we still have no type API ... |
18:14:15 | Araq | so I guess that would be the first step |
18:15:04 | apriori_ | well, one first would definetly need general constraints for all templates (I see no reason to limit them to tr macros only) |
18:15:04 | reactormonk | what is the compilerproc pragma btw? |
18:15:13 | apriori_ | pretty much.. like D did.. maybe better |
18:16:14 | Araq | apriori_: the constraints are indeed planned for everything |
18:16:25 | Araq | and will become part of the overloading resolution |
18:16:33 | apriori_ | yeah, good |
18:16:39 | apriori_ | tough task already, I think ;) |
18:16:51 | Araq | not really :P |
18:16:56 | apriori_ | for you :P |
18:17:30 | Araq | but what do you mean "pretty much like D did"? |
18:17:49 | Araq | afaik D has nothing like that |
18:18:03 | apriori_ | well, it does have it in a quite simple way |
18:18:26 | Araq | C++like expression templates I'd guess |
18:18:32 | apriori_ | following the declaration one can write an if block prior to the function body opening { which is the constraint to be checked |
18:18:47 | Araq | but the constraints operate on types |
18:18:55 | Araq | in Nimrod they operate on ASTs |
18:18:59 | apriori_ | yeah |
18:19:14 | apriori_ | ASTs is of course much more powerful ;) |
18:19:44 | apriori_ | actually.. it already takes quite some time to get used to all this stuff ... |
18:19:59 | apriori_ | I'm not really thinking in "AST validation patterns" all the time ;) |
18:38:04 | apriori_ | Araq: another question about tuples |
18:38:12 | apriori_ | currently I more often run into the following issue: |
18:38:45 | apriori_ | say we got 2 tuple types A and B, both with the same count of elements but different field names.. those can't be used interchangable.. although that's sometimes desired |
18:38:56 | apriori_ | I that intentional? |
18:39:06 | apriori_ | *is |
18:39:13 | Araq | yeah |
18:39:25 | apriori_ | okay |
18:39:50 | Araq | though it would be easier if the compiler could always ignore the field names for tuples |
18:39:57 | Araq | so what use case do you have in mind? |
18:40:09 | apriori_ | say I got one vector tuple and one size tuple |
18:40:16 | apriori_ | (x, y, z) vs (width, height, depth) |
18:40:43 | apriori_ | and I'd prefer (out of lazyness) to define vector operations only once.. |
18:40:56 | apriori_ | sure.. I could do that for both types.... using copy pasta :P |
18:41:08 | Araq | macros avoid copy pasta |
18:41:12 | Araq | but I see your point |
18:41:17 | Araq | will think about it |
18:41:24 | apriori_ | thank you |
18:41:30 | Araq | RTTI does not include proper field names anymore already |
18:43:36 | Araq | maybe we need yet another pragma ;-) |
18:43:48 | Araq | {.dirty.} for tuples |
18:43:52 | apriori_ | hehe |
18:44:19 | apriori_ | yeah. I see it might not be a good idea to promote "ignoring fieldnames" to default behaviour |
18:49:40 | apriori_ | am I right that for loops don't allow element unpacking? |
18:49:53 | apriori_ | like: for (i, j) in somePairIterator: |
18:50:10 | Araq | they do, but you need to use 'items' explicitely |
18:50:58 | apriori_ | hm, is that really the same? |
18:51:47 | Araq | well you mustn't use () in this context |
18:51:54 | Araq | and yeah I know it's not consistent |
18:52:12 | apriori_ | you mean: for i, j in somePairIterator: ? |
18:52:33 | Araq | yeah |
18:52:35 | apriori_ | ok |
19:02:38 | reactormonk | what is the compilerproc pragma? |
19:07:47 | Araq | apriori_: nimrod needs matrix and vector etc. in its stdlib; would you like to implement these? |
19:08:16 | Araq | I'm not good enough at these, so I won't do it |
19:08:34 | Araq | reactormonk: 'compilerproc' is a "codegen proc" |
19:08:47 | Araq | it's a proc that is called by the code generator |
19:09:08 | Araq | the compiler keeps these in an extra symbol table |
19:09:23 | reactormonk | aaand so what? |
19:09:53 | apriori_ | Araq: well, I could.. but give me some time. got university stuff etc. to do, too |
19:09:54 | Araq | in the C generator you can invoke it in a pattern like "#compProc" |
19:10:04 | reactormonk | ah |
19:11:11 | Araq | apriori_: no problem, but if somebody comes around and is faster than you ... ;-) |
19:11:26 | Araq | he'll get the fame ;-) |
19:12:04 | apriori_ | hehe, yeah |
19:12:39 | apriori_ | one question about type declarations, btw.. because if I'd do that, I'd prefer that to be as general as possible: |
19:12:47 | apriori_ | something like that doesn't seem to be possible: |
19:13:19 | apriori_ | TVectorN*[T, s:int] = array[0..s-1, T] |
19:13:21 | apriori_ | as type |
19:15:50 | Araq | true type parameters cannot be values |
19:16:06 | Araq | something like that should work though (modulo compiler bugs) |
19:16:28 | Araq | type TVectorN*[T, IDX] = array[IDX, T] |
19:17:23 | Araq | then you can also pass 1..3 as IDX |
19:28:30 | apriori_ | ohm, what am I doing wrong here?: http://pastebin.com/9tCBe6mE |
19:30:07 | reactormonk | apriori_: apparently you only have TSlice[int] and no int matching |
19:30:12 | reactormonk | aka second-last |
19:32:30 | apriori_ | I'd more say, that i in my for loop is replaced by the entire tuple |
19:33:08 | apriori_ | or, well.. |
19:33:13 | apriori_ | hm.. |
19:33:27 | apriori_ | actually 3 args is just right |
19:33:37 | apriori_ | but it expects the enum as index |
19:33:41 | apriori_ | otherwise no operator can match |
19:34:36 | apriori_ | yup, that was the issue |
19:44:03 | apriori_ | got go now bye |
19:44:12 | * | apriori_ quit (Quit: Konversation terminated!) |
21:43:21 | * | Trix[a]r_za is now known as Trixar_za |
23:37:05 | fowl | i just found tools/nimrepl.nim o_O |
23:38:58 | Trixar_za | You know why I like you guys? Because you actually know the Language from the roots up. Unlike certain *coff* Python! *coff* people in a certain IRC channel. |
23:41:49 | Trixar_za | Use Twistd my ass |
23:47:18 | reactormonk | Trixar_za: I don't think Araq still knows all the small stuff ;-( |
23:47:33 | reactormonk | I hope you know the part where the compiler is translated from pascal via pas2nim |
23:47:38 | Trixar_za | You'd be surprised |
23:49:21 | Trixar_za | Well, from what I read, Nimrod started it's life in Pascal, so that conversion is probably the most complete of the bunch. |
23:50:02 | Trixar_za | Although, a few years have gone by since Nimrod became totally bootstrapped, so that may have changed |
23:54:28 | reactormonk | yep, that's the pas2nim part |
23:57:56 | * | q66 quit (Quit: Quit) |