01:05:10 | * | XAMPP joined #nimrod |
02:25:55 | * | q66 quit (Quit: Quit) |
02:41:30 | Amrykid | Wasn't there an effort for nimrod to support 'compiler as a service' a while ago? |
07:57:02 | Araq | Amrykid: very basic support for compiler as a service exists, but it's not yet used from aporia |
08:05:21 | Araq | and until that is implemented I won't work on the feature as testing it via telnet is a pita ;-) |
08:13:27 | reactormonk | Araq, just write some tests |
08:13:52 | Araq | indeed I should ... looks like quite some work though :P |
08:15:45 | Araq | and I'm figuring out how to use my effect system to prevent deadlocks |
08:15:45 | Araq | looks like a simple problem ;-) |
11:38:49 | dom96 | good morning |
11:39:48 | * | Vladar joined #nimrod |
11:40:10 | Vladar | Hi |
11:40:20 | dom96 | hello Vladar |
11:47:24 | Vladar | So, is there any way to pass some comments from code to html-file generated by 'doc' or 'doc2'? |
11:49:36 | dom96 | Yeah: ## starts a doc comment |
11:50:19 | Vladar | oh, probably missed that. Thanks! |
11:50:31 | dom96 | Place it underneath a proc declaration |
11:50:48 | dom96 | You can also document types like that. |
11:51:07 | Vladar | Will try it right now. |
11:51:10 | * | q66 joined #nimrod |
11:51:23 | dom96 | for example take a look at the stdlib: https://github.com/Araq/Nimrod/blob/master/lib/pure/ftpclient.nim#L78 |
12:02:14 | Araq | TEffect* = object of TObject ## base effect class; each effect should |
12:02:14 | Araq | ## inherit from `TEffect` unless you know what |
12:02:14 | Araq | ## you doing. |
12:02:14 | Araq | FTime* = object of TEffect ## Time effect. |
12:02:14 | Araq | FIO* = object of TEffect ## IO effect. |
12:02:43 | Araq | FRead* = object of FIO ## Effect describing a read IO operation. |
12:02:44 | Araq | FWrite* = object of FIO ## Effect describing a write IO operation. |
12:03:32 | dom96 | Time effect? |
12:03:34 | Araq | FExec* = object of FIO ## Effect describing an executing IO operation. |
12:03:34 | Araq | that's what I've got so far ... any better names? |
12:03:45 | dom96 | what is that? |
12:03:50 | Araq | dependent on some timing issue |
12:04:01 | Araq | for now I can only image "uses os.sleep" |
12:04:14 | Araq | *imagine |
12:04:16 | dom96 | hrm, so wouldn't all of the times module be that? :P |
12:04:39 | Araq | '-' for TTime wouldn't :P |
12:05:01 | dom96 | Does that mean that the output changes based on the current time, or does it mean that the output could be returned at an arbitrary time? |
12:05:12 | dom96 | I guess both? |
12:05:36 | Araq | it means that a proc p uses os.sleep ;-) |
12:06:05 | Araq | or perhaps that it makes some time guarantees like "does not block for more than 3ms" |
12:06:32 | dom96 | ok, so it does not apply to the times module |
12:06:41 | dom96 | I guess the times module is FIO |
12:06:55 | Araq | no, the times module is FTime for the most part |
12:07:04 | dom96 | how is it? |
12:07:13 | dom96 | it doesn't use os.sleep |
12:07:18 | Araq | effects propagate so it's important that the built-ins are properly annotated |
12:07:47 | Araq | sure it doesn't use os.sleep, but it *does* deal with time |
12:08:41 | dom96 | Yeah, but your definition of what FTime means does not suggest that it applies to the times module. |
12:08:41 | Araq | '-' for TTime is not FTime as it's a pure function |
12:08:59 | Araq | most other functions in times.nim are not pure |
12:10:31 | dom96 | Why do we need a separate Time effect anyway? |
12:10:53 | dom96 | sleep seems like an IO thing |
12:11:02 | dom96 | and so does retrieving the current time |
12:12:31 | Araq | I want to avoid haskell's IO issues |
12:12:49 | dom96 | what issues are those? |
12:12:56 | Araq | for instance, it's perfectly fine to do 'getenv' in a transaction and to retry it |
12:13:10 | Araq | yet haskell's type system would prevent it |
12:13:24 | dom96 | what if the environment changes? |
12:13:57 | dom96 | FTime suggests that the proc is timed, but the output will always be the same. |
12:13:57 | Araq | good point, but it could have changed before the first call to 'getenv' too |
12:14:05 | dom96 | And in that case it does not apply to the times module :P |
12:14:19 | Araq | hm, a very good point |
12:15:08 | Araq | FTime is a very subtle effect |
12:15:21 | Araq | for instance it doesn't prevent evaluation at compile-time |
12:15:32 | Araq | and yet a call to os.sleep MUST not be optimized away |
12:16:11 | Araq | even if its argument is known at compile-time |
12:16:53 | dom96 | why would you use os.sleep at compile-time? |
12:17:37 | Araq | the point is this should work: |
12:17:43 | Araq | proc p(): int = |
12:17:49 | Araq | os.sleep(15) |
12:17:54 | Araq | result = 12 |
12:17:57 | Araq | const x = p() |
12:18:22 | Araq | though maybe that really shouldn't happen in practice |
12:18:34 | Araq | and it's bad code to begin with ... I dunno |
12:20:05 | dom96 | Sorry, I still don't get why... |
12:20:24 | dom96 | also I don't get what you mean about 'getenv' |
12:20:56 | Araq | well everything that's happening in a transaction needs to be able to be rolled back |
12:20:58 | dom96 | 'getenv' should have the FIO effect. |
12:21:25 | Araq | this means FWriteIO is not allowed in a transaction |
12:21:39 | Araq | but IMO FReadIO is fine in a transaction |
12:21:52 | Araq | getenv should be FReadIO |
12:22:24 | dom96 | ahh. |
12:22:29 | dom96 | That makes sense, yes. |
12:22:36 | dom96 | Haskell doesn't separate those. |
12:23:06 | dom96 | But I'm not sure it would be of benefit to it, if it did separate it. |
12:28:43 | Araq | well one of ghc's authors thinks so :P |
12:29:55 | Araq | but as usual I lost the link ;-) |
12:31:24 | Araq | it's however common sense: IO is simply a too wide field |
12:31:56 | Araq | for instance for my code the difference between "logging IO" and "writes to database" is big |
12:33:52 | Araq | in fact, for logging I might fake that it performs no IO ;-) |
13:42:17 | zahary | Araq, if you are still uncertain about the naming scheme, an alternative way is to organize it arround the verbs: TReads, TWrites |
13:49:23 | Araq | zahary: but that's confusing as 'reads' and 'writes' are further effect pragmas |
13:49:57 | Araq | but I have to go, see you later |
15:13:25 | * | ozkriff joined #nimrod |
15:14:07 | * | ozkriff_ joined #nimrod |
15:14:55 | * | ozkriff quit (Remote host closed the connection) |
15:15:23 | * | ozkriff_ quit (Client Quit) |
15:17:53 | * | ozkriff joined #nimrod |
15:18:09 | ozkriff | hi |
15:22:36 | Araq | welcome ozkriff |
15:24:46 | Araq | er zahary, what do we need quasiquote for? what's the difference to getast? |
15:25:06 | zahary | haven't we discussed this like gazillion times? |
15:25:20 | Araq | no? |
15:25:57 | zahary | are you sure? do you see the docs? |
15:26:30 | Araq | yes I do, but getast + a template seems to solve the very same problem? |
15:27:10 | zahary | yes, and this integrates it better into the language - we really have talked about AST quoting many times before |
15:28:25 | Araq | why did you start with getast then? :P |
15:29:05 | zahary | getAst is still useful if you want the template to be usable by itself |
15:29:18 | Araq | btw we also talked about using \ for getting back the operator |
15:29:51 | zahary | and about [. .] as quoting operator |
15:29:51 | Araq | and the lexing rules now reflect that |
15:29:59 | zahary | these details are easy to change |
15:30:05 | Araq | aha |
15:30:11 | zahary | in fact, the current grammar doesn't work very well with the feature |
15:30:12 | Araq | so it's no "final" patch |
15:30:17 | zahary | var @a = 10 # not possible |
15:30:29 | Araq | yeah I know |
15:30:30 | zahary | var x = `foo(10)` # not possible |
15:35:52 | * | ozkriff quit (Ping timeout: 245 seconds) |
15:39:06 | * | ozkriff joined #nimrod |
15:40:42 | ozkriff | I can't understand from docs how to use dynamic arrays |
15:40:49 | ozkriff | How can i set array length in runtime? |
15:40:55 | ozkriff | Only adding elements one by one to sequence? |
15:41:14 | ozkriff | sorry for my english( |
15:42:26 | Araq | ozkriff: there is also 'setLen' and 'newSeq' |
15:43:19 | Araq | zahary: that's one reason why I don't like 'quote'; I don't find it particularly useful with the current syntax |
15:43:55 | Araq | the next logical step would be to come up with a decent macro API; currently we only have the minimum that's necessary |
15:43:57 | zahary | well, I was going to talk to you about changing the grammar a little bit |
15:44:20 | Araq | problem is: I don't like how it reads in Lisp either ;-) |
15:44:45 | zahary | and getAst is better? just open my unittest module |
15:44:49 | Araq | the declarative approach only goes so far ... and then you want to construct it imperatively |
15:45:39 | zahary | no, no - I almost never want to construct it imperatively - I may want to glue some quoted bits together or to edit some subnode after quoting |
15:46:05 | zahary | which are both possible with getAst and quote |
15:46:13 | Araq | I'm thinking of loops |
15:47:12 | zahary | IMO the unittest module is a very good example for what's needed and what's useful |
15:47:24 | Araq | I'm looking at it (again) |
15:48:14 | Araq | macro check uses 2 accumulators |
15:48:28 | Araq | 'argsAsgns' and 'argsPrintOuts' |
15:48:46 | zahary | but notice how I build everything out of smaller quoted pieces of code like asgn and print |
15:49:04 | zahary | if I had to build this with newNimNode: |
15:49:05 | zahary | when compiles(string($value)): |
15:49:05 | zahary | checkpoint(name & " was " & $value) |
15:49:07 | Araq | yeah but I'm arguing that's an API problem |
15:52:22 | Araq | I can't follow, what do you mean? |
15:52:43 | Araq | oh |
15:52:53 | zahary | I'm missing your point too - getAst/quote is exactly about mixing imperative code with "declarative" bits |
15:53:55 | Araq | argsPrintOuts.add getAst(print(argStr, arg)) |
15:54:16 | ozkriff | Araq: thanks! And one little question more: what is nimrod-way for: sscanf(buffer, "v %f %f %f", &v->x, &v->y, &v->z) |
15:54:16 | Araq | ok, how exactly does the new built-in improve that? |
15:55:34 | Araq | ozkriff: that's much harder ;-) |
15:55:50 | zahary | it's like asking how closures improve on global function with a userData cookie param |
15:56:22 | zahary | it makes the code smaller, removes some boilerplate, puts related things closer in the code, etc |
15:56:32 | Araq | it's not; my point is: I can easily parse it |
15:56:49 | Araq | the way it is now especially because there are no quoting rules to consider |
15:57:08 | Araq | I get that you want the 'print' definition inline |
15:57:41 | Araq | and indeed I would prefer that too, but I dislike quoting |
15:58:13 | zahary | well, what's the alternative? |
15:58:23 | Araq | an anon template? |
15:58:36 | Araq | not sure yet ;-) |
16:00:31 | zahary | it's possible to make even more like closures - identifiers from the outer scope are automatically intercepted |
16:00:37 | Araq | the nice thing about templates is that you have named params which avoid the quoting |
16:01:03 | zahary | but then, you often need to interpolate a bit more compilated expression `foo(bar, baz)` |
16:02:13 | Araq | 'quote' requires special semchecking which means it's actually more of a keyword |
16:02:31 | Araq | and indeed it builds an anon template and calls getast on it |
16:02:42 | zahary | not really - once we fix the lazy semantizing in overloading it will work fine |
16:02:58 | Araq | hrm that may be true |
16:04:33 | Araq | actually 'template' was supposed to be a quasiquote, at least within macros; but then I never got around it and template proved to be very useful for '!=' |
16:05:06 | Araq | and it would be confusing if 'template' changed its semantics slightly in a macro body |
16:09:06 | Araq | ozkriff: you need to create some helper proc that calls strutils.parseFloat or parseutils.parseFloat |
16:09:44 | Araq | or if you're very lazy, you can easily wrap C's sscanf |
16:15:52 | * | ozkriff quit (Ping timeout: 245 seconds) |
16:24:49 | Araq | result = (template (Exp, lineInfoLit, expLit): stmt = |
16:24:50 | Araq | if not Exp: |
16:24:52 | Araq | checkpoint(lineInfoLit & ": Check failed: " & expLit) |
16:24:54 | Araq | fail())(checked, checked.lineinfo, checked.toStrLit) |
16:25:21 | Araq | hrm and you suggest closure-like capturing |
16:25:28 | * | Araq likes it |
16:26:46 | zahary | it's relatively easy to do, but I see 2 potential problems with it |
16:27:41 | zahary | 1) as I said, you still need a way to interpolate more complex expressions (you either need quoting operator of some kind or you need to assign them to a named variable in the outer scope) |
16:28:30 | zahary | 2) it will lead to silent errors - typos will be turned into nkIdents, mistyped variabled will be tyrned into nkIdents, etc |
16:28:36 | Araq | true but is (1) really common? |
16:29:29 | Araq | and how would 'quote' prevent that? |
16:30:01 | zahary | out of the 5 getAst calls in unittest, 4 use non-triavial exprsesions |
16:30:11 | zahary | that was about 1) |
16:30:34 | zahary | about 2), if you have quoting operator, the expression inside it must be a valid PNimrodNode - otherwise you get an error |
16:31:12 | Araq | I can't follow, every getAst call that I'm looking at does some easy substitutions |
16:32:02 | zahary | it's possible to interpolate things like ex.lineinfo too, but the rules become a bit more complicated |
16:33:51 | Araq | you can always pass ex.lineinfo to the anon template just like it's now |
16:33:51 | zahary | to clarify: how do you know I didn't mean `ex`.lineinfo? |
16:34:32 | zahary | ah, you are talking about your anon template alternative |
16:34:43 | zahary | well, it's more verbose for starters |
16:34:55 | Araq | is it? |
16:36:37 | zahary | well, I wrote a param list, had to think about names for the params, used some funny javascript-like parentheses |
16:36:46 | zahary | do you dislike quoting that much? |
16:37:19 | Araq | dunno have to see more real world examples ;-) |
16:37:56 | Araq | but I surely dislike an ever growing list of magics which need special semchecking |
16:38:15 | zahary | I did it only for performance reasons btw |
16:38:23 | zahary | it is possible to be defined as a normal macro |
16:38:38 | Araq | true |
16:38:41 | Araq | good point |
16:38:42 | zahary | and yet why did you implement static as a keyword :P |
16:38:56 | Araq | it felt right :P |
16:39:33 | Araq | I also want a 'static case' |
16:39:44 | Araq | and maybe 'when' should become 'static if' |
16:39:54 | zahary | if static(foo) |
16:40:03 | zahary | that's how it was supposed to be in my hypolang |
16:40:41 | zahary | if foo is const already, you can omit the static part |
16:57:49 | Araq | compile-time still seems an unnatural default :P |
16:59:15 | Araq | brb |
17:36:05 | * | ekselkiu joined #nimrod |
17:52:13 | Araq | back |
18:02:25 | * | XAMPP quit (Ping timeout: 246 seconds) |
18:04:25 | * | Guest67212 joined #nimrod |
18:19:56 | Amrykid | Araq, is there any documentation for the caas support? |
18:21:39 | Araq | 'nimrod serve' starts it |
18:21:58 | Araq | and then you're supposed to give the socket a command line to tell nimrod what to do |
18:22:16 | * | Guest67212 is now known as XAMPP |
18:22:23 | * | XAMPP quit (Changing host) |
18:22:23 | * | XAMPP joined #nimrod |
18:22:24 | Araq | and no, there is no documentation |
18:22:35 | Amrykid | then I telnet into it, im assuming? |
18:22:52 | Araq | for testing, yes |
18:23:22 | Amrykid | ok, thank you |
18:25:01 | Araq | fyi: http://spin.atomicobject.com/2012/11/11/unifying-programming-and-math-the-dependent-type-revolution/#more-90305 |
18:44:12 | Vladar | Nimgame v0.3 is released: http://forum.nimrod-code.org/t/107 |
18:47:08 | Araq | Vladar: cool, does it run on linux? |
18:48:07 | Vladar | Araq: Of course, I making it on Linux. |
19:20:06 | q66 | Vladar, got screenshots? |
19:31:12 | dom96 | hrm, seems the latest compiler cannot compile nimgame. I get linker errors. "Multiple definition of ..." errors, |
19:31:55 | dom96 | Vladar: Looking at the documentation it is looking quite nice and powerful. Nice job! |
19:32:08 | Vladar | q66: not much to look at: http://ge.tt/19mZfPR/v/0 you can see screen scaling and buttons. |
19:33:54 | Vladar | dom96: try 0.9.0 version. I'm also get those "Multiple definition" errors on latest builds. Don't know what changed in compiler lately to cause it. |
19:34:53 | * | Trix[a]r_za is now known as Trixar_za |
19:38:46 | dom96 | Vladar: Awesome, it works with 0.9.0 :) |
19:39:15 | dom96 | Buttons are a bit weird heh. Shouldn't pressing 'Exit' once quit? |
19:39:41 | Vladar | It should. |
19:41:02 | dom96 | btw does it not support mp3s? |
19:41:52 | dom96 | it kind of seems like the buttons are toggle-buttons. |
19:42:38 | Vladar | dom96: it depends on smpeg library. I tried windows version under wine and it played _some_ of mp3's with this smpeg.dll. |
19:42:52 | dom96 | I see |
19:43:02 | Vladar | dom96: two of buttons are toggle ones. |
19:43:18 | Vladar | 'shuffle' and 'next'. |
19:43:58 | q66 | Vladar, interesting, how about OS X support :) |
19:45:01 | dom96 | Vladar: When I start it and immediately press the 'play' button it seems to get stuck in the toggled position. |
19:45:02 | Trixar_za | Oh sweet |
19:45:07 | Vladar | q66: Depends on Nimrod and SDL =) |
19:45:18 | q66 | SDL works just fine :P |
19:45:38 | q66 | Nimrod should too |
19:45:48 | q66 | so I guess there is no platform specific code in the thing? |
19:46:18 | Vladar | dom96: maybe it just freezes? It's win version, right? |
19:46:29 | dom96 | Vladar: no, linux. |
19:46:41 | dom96 | Vladar: That's quite possible. |
19:47:06 | dom96 | However when I hover over the button it changes. |
19:47:08 | Vladar | q66: no, it is just frontend to SDL with some game specific classes. |
19:47:47 | Vladar | dom96: any console output errors? Also, might be some libs missing. |
19:47:59 | dom96 | Vladar: No, nothing in the console. |
19:48:05 | dom96 | Vladar: What libs are required? |
19:48:57 | dom96 | Vladar: It seems I can reproduce it every time if I give focus to another application, then click on the play button. |
19:49:15 | dom96 | Then clicking anywhere in the app makes the play button untoggle. |
19:49:30 | Vladar | oh, I will test it. |
19:50:14 | dom96 | I like the songs, where did you get them? :) |
19:50:15 | Vladar | Thanks. Probably, something in button logic. |
19:50:25 | dom96 | no problem. |
19:51:48 | dom96 | btw the CPU usage of it seems to be pretty high, any ideas why? |
19:53:30 | Vladar | dom96: what songs? Isn't 'music' folder empty? |
19:54:07 | dom96 | Vladar: nope, heh. Maybe you included them by mistake. I downloaded the source + demo. |
19:54:40 | Vladar | dom96: screen updates? Press 'F' and see how much FPS you get. |
19:55:00 | dom96 | ~200 |
19:55:30 | Vladar | dom96: so here is your cpu usage, I guess. |
19:56:28 | Araq | Vladar: I'll look into the linker errors, should be easy to fix |
19:56:48 | Vladar | dom96: yeah, this is songs I tested it on. From "keygens music pack". |
19:56:53 | Araq | once I got the dreaded tags feature to work :-/ |
19:57:06 | dom96 | Vladar: haha. Nice. |
19:57:18 | Vladar | Araq: Thanks =) |
19:58:29 | dom96 | Vladar: I'm guessing a sleep() in your infinite loop in ``start`` would lower the CPU usage. |
19:58:58 | dom96 | But lower the FPS too :\ |
19:59:39 | Vladar | I think, I'll add maxFPS option later. |
20:01:20 | Vladar | And come on, all games eating a lot of CPU =) |
20:01:41 | dom96 | I guess, heh. Well great job :) |
20:01:58 | Araq | sleep is a good idea in a while true loop |
20:25:36 | Vladar | Bye. |
20:25:51 | * | Vladar quit (Quit: Leaving) |
20:34:38 | * | Trixar_za is now known as Trix[a]r_za |
21:46:18 | * | Trix[a]r_za is now known as Trixar_za |
22:23:19 | * | Boscop quit (Disconnected by services) |
22:23:21 | * | Boscop joined #nimrod |
22:39:14 | * | ekselkiu quit (Ping timeout: 260 seconds) |
22:45:50 | fowl | eh vladar comes back tell him to use TFPSmanager and framerateDelay() in sdl_gfx |
22:47:18 | Araq | tell him on the forum ;-) |
23:41:09 | fowl | i get a bunch of errors from gcc trying to compile his demo: https://gist.github.com/b03cbbfe67c20e0004cc |
23:54:57 | Araq | fowl: seems to be a recently introduces compiler bug |
23:55:06 | Araq | haven't looked at it |
23:55:19 | Araq | *introduced |