<<11-12-2012>>

00:35:40*XAMPP quit (Quit: Leaving)
00:41:34*XAMPP joined #nimrod
00:41:35*XAMPP quit (Changing host)
00:41:35*XAMPP joined #nimrod
01:07:47*q66 quit (Quit: Quit)
04:14:26*Trix[a]r_za is now known as Trixar_za
04:46:34*Trixar_za is now known as Trix[a]r_za
09:15:45*XAMPP quit (Read error: Connection reset by peer)
09:36:22*FreeArtMan joined #nimrod
11:40:09*Araq_ joined #nimrod
11:44:08*Araq_ quit (Client Quit)
12:40:16*fowl quit (Quit: Leaving)
12:45:59*fowl joined #nimrod
12:58:03*q66 joined #nimrod
15:57:11*gradha joined #nimrod
15:57:45gradhaI was looking for date parsing code and didn't find anything in code
15:58:45gradhafor parsing dates in the iso format "2012-11-20T22:08:08.398990" I have just used split
15:59:00gradhashould such a proc be added to the times module?
16:22:55gradhauf, what a can of worms parsing dates is
16:23:58dom96Doing anything with time itself is annoying.
16:26:21dom96I bet POSIX/WINAPI has some functions for parsing time.
16:26:55gradhaposix has strptime but it requires you to know in advanced the format of the string being parsed
16:27:24gradhaunfortunately ISO 8601 allows some variation with regards to amount of present elements and timezones
16:38:26gradhathe TTimeInfo type uses enums for months, how can I easily transform 4 into the TMonth mApr enum?
16:39:48gradhabig case?
16:39:56dom96TMonth(4) perhaps
16:41:21gradhayes, works
16:41:48gradhayay, it even raises EOutOfRange
16:56:10*_ponce quit (Remote host closed the connection)
16:56:27*_ponce joined #nimrod
17:07:12gradhawhat's the idiom when you want to catch an ignore an exception? at the moment I'm returning, but what if I wanted to continue with the flow of the proc? Is there a nop-like keyword?
17:25:58reactormonkgradha, begin <dangerous code> rescue <error> end
17:26:00reactormonkthat's about it
17:26:40reactormonkbut beware of capturing too much, if you capture Exception, I'll strangle you with your favourite stuffed animal.
17:27:38gradhathat would be a panda
17:28:23reactormonkgradha, oh, duh
17:28:29reactormonkwrong channel -.-
17:28:38gradhastill sounded like fun
17:28:41reactormonkthis isn't the ruby one :-)
17:29:29reactormonkException even captures syntaxerrors when loading, that's why. Seen that once. Ugly implications.
17:44:12gradhadom96: I looked at https://github.com/JukkaL/mypy and maybe I'm reading wrong, but it seems like a prettier implementation of something like cython http://www.cython.org
17:45:46gradhabasically, adding static typing to improve performance
17:48:06dom96true.
17:48:12dom96They do look similar.
17:48:21*dom96 didn't really look into 'mypy' that much
17:58:59gradhahttpclient.TResponse.status is a string? cue audio of n-plicated status code parsing pain
18:04:07dom96what's wrong with that?
18:04:55dom96I suppose an enum would be nicer, but does this really cause any severe issues?
18:05:34gradhafor every request you need to parse the string and convert the status code into an integer
18:06:26dom96how would you get around that?
18:07:01dom96The only difference here is, either you parse the string in your own code or httpclient does.
18:07:44gradhaso that's what I was saying: every time I'm going to use httpclient I'm going to be duplicating string parsing code to make integer code comparisons
18:08:27gradhaat the moment I have http://pastebin.com/p32pBFJZ
18:09:28gradhais there any way to do such comparisons faster at the string level?
18:11:38dom96response.status[0] in {'3', '4', '5'}
18:13:38AraqZor: that D's slices create interior pointers is just the top of the iceberg of D's problems with GC
18:13:49ZorAraq: of course
18:14:52gradhadom96: is that better/worse than a case on the first string character?
18:15:08Araqso when should we tell them the other problems? ;-)
18:15:35ZorAraq: I don't think they're going to listen anyway
18:15:54Araqtrue
18:16:02dom96gradha: no idea, Araq?
18:16:52AraqI can hardly see 'parseInt' being any concern when retrieving data over a socket ...
18:17:33AraqparseInt is pretty slow yes, but not in comparison to IO
18:19:48Araqhowever I'd prefer an enum too :P
18:20:41Araqotherwise you simply don't implement the protocol completely in the library and make the client code perform part of the error checking that the library is supposed to do
18:22:42gradhadoes the request proc guarantee that all return paths return a status string with at least a character?
18:23:02Araqwho knows ...
18:23:22Araqbut it's always safe to acces s[0] (if 's' is not nil) ...
18:25:37gradhahmmm... how does nimrod fare in adding debug post assertions? would it be possible to wrap httpclient.parseResponse with a try/finally block which just asserts on some values and in release versions this would go completely away?
18:26:24Araqif you manage to use the C++ codegen visual C will optimize the try-block away for you
18:26:42Araqotherwise you need to do something like:
18:26:48gradhaHmmm... maybe a more direct approach would be to write a macro which wraps the whole proc and goes away when(release)
18:27:11Araqyeah, I was going to suggest just that
18:27:20Araqa simple template does the trick
18:28:09Araqwhenever you need control flow abstraction a macro/template is a solution
18:28:37Araqthe other solution is to use a closure, but that's more expensive
18:29:53gradhahow are closures used in nimrod?
18:30:12gradhaah, nested procs
18:39:12Araqgradha: please go ahead and fix the httpclient ;-)
18:39:24gradhawhat's there to fix?
18:39:27AraqI prefer the enum too
18:40:04dom96Might as well fix that buffering bug while you're at it :P
18:40:13Araqyeah
18:40:42Araqand another thing that's desperately needed: tests for idetools so that I know when I break something
19:07:52Araqdom96: this patch mitigates the path problem for Babel ;-)
19:09:07Araqas now the path is picked consistently, so nimgame/utils is preferred over jester/utils if nimgame is already imported
19:10:09dom96hrm, ok. We're going to have to discuss details later.
19:10:12dom96bbl
19:31:11dom96back
19:31:39dom96Araq: So what does your patch fix exactly?
19:31:51Araqwhat I wrote above
19:32:04Araqthere are 2 utils.nim, you can't import both packages then
19:32:23Araqbut at least the very existance of the other package doesn't break anything
19:32:35dom96ok.
19:32:52dom96Can I import from the module's directory yet?
19:32:52Araqin fact, I think --babelPath is a misfeature
19:33:09Araqand that it shouldn't be used
19:33:17Araqand be deactivated
19:33:43Araqand you should do --path:$babel/nimgame in your project's configuration file
19:34:44dom96But then the babel file already contains that info...
19:36:02Araqonly if the project has a .babel file
19:36:36Araqwhich is not that likely; I for instance don't want to add my *applications* to babel
19:37:06dom96ok, but then the .babel file serves as a list of dependencies for you app
19:37:09dom96brb
19:39:41dom96back
19:41:51Araqyou're right that .cfg and .babel files do overlap in functionality
19:41:51*Vladar joined #nimrod
19:42:15Araqbut .cfg was there first :P
19:42:40dom96pfff
19:43:12dom96Just make the compiler read the babel file, problem solved.
19:46:12Araqnah
19:46:28Araqwhat's the problem anyway?
19:46:46dom96currently?
19:47:04dom96That I cannot import module from within a module's directory?
19:47:47Araqbut you can do that, or I'm misunderstanding you
19:48:35dom96nimgame/lib/engine.nim, lib/ directory has a module named common.
19:48:43dom96Can I 'import common' from engine.nim?
19:48:59dom96That was the original problem.
19:49:04dom96and still is?
19:49:33AraqI think you can do that, yes
19:52:09dom96so you fixed that?
19:59:04Araqthat's always been possible
19:59:23Araqhowever you can do 'import common' everywhere else too ... :P
19:59:34dom96well, why did it not work for Vladar?
19:59:53Araqbecause he had it in lib/ ?
20:02:10dom96huh?
20:02:29dom96Didn't I just describe the same scenario as Vladar's and you said that I can do that?
20:02:57AraqI don't get it; nimgame works with the current compiler support for Babel
20:03:02Araqso does jester
20:03:11VladarI confirm
20:03:29Araqit's hacky, but it works good enough until we have > ~50 packages
20:03:40Vladarit works since 8f4ea37 I think
20:03:51dom96sure. But I would prefer "import nimgame/common" instead of "import common"
20:04:42Araqwell Vladar has to update nimgame then
20:04:53Araqbut that would work too
20:05:29dom96All he needs to do is change the directory structure.
20:05:31dom96Nothing else.
20:09:25Araqbut then I don't really like imposing a directory structure and it works already
20:11:39dom96sure, it works already. But it's simply incorrect.
20:13:33dom96People will get annoyed that they cannot use nimgame and have a 'common' module of their own
20:15:53dom96But it looks like you are simply set with how it works.
20:20:14AraqI already said, that will be fixed within time
20:26:19dom96so, what if I want to enforce this syntax? Can I do that?
20:28:15Araqnimgame/engine.nim
20:28:22Araqnimgame/nimgame/common.nim
20:28:36Araqwould enforce the syntax
20:28:54dom96will I not still be able to 'import common'?
20:29:15Araqfor now yes; later this will work
20:29:26Araqoh sorry
20:29:28Araqmisread
20:30:01Araqargh
20:30:06Araqwhat do you mean?
20:30:50dom96Something tells me we are misinterpreting each other :P
20:30:58dom96And not just in this case.
20:31:04dom96earlier too.
20:31:21Araqperhaps
20:31:21dom96Let me be explicit.
20:31:37dom96~/babel/libs/nimgame/nimgame/common.nim
20:31:45dom96import common # Does this work?
20:31:55dom96import nimgame/common # Does this work?
20:32:18dom96(These imports are in some unrelated module, the module is not related to the nimgame package)
20:34:59Araqimport common # no
20:35:07Araqimport nimgame/common # yes
20:35:48Araqfor the nimgame/common.nim file that is
20:36:06dom96ok. Now lets look at how nimgame will be installed in reality.
20:36:20dom96~/babel/libs/nimgame/lib/common.nim
20:36:30dom96Why does: import common work then?
20:36:48Araqbecause ~/babel/libs/nimgame/lib/ has been added to the path
20:37:01Araqbecause nimgame itself has no .nim files :P
20:37:35Araqif it had, things would be different; then ~/babel/libs/nimgame would be in the path
20:37:40dom96well then in the scenario I described earlier, the outcome would be the same as the current scenario for nimgame
20:39:41AraqI can't follow
20:39:46Araqwhich scenario?
20:39:50Araqand why does it matter?
20:40:05dom96because what you answered contradicts your newer answer.
20:40:18Araqlol what?
20:40:19dom96The scenario begins after I say "Let me be explicit"
20:40:43Araqugh, just try it please
20:41:21Araqthe real problem is that you can't have 2 common.nim files within the same project and that's a bit of work to fix, so I don't want to do it *now* given that we have 2 packages in total for now
20:42:03dom96Well to get the explicit "import nimgame/module" behaviour I will have to place a dummy.nim
20:42:29dom96or otherwise ~/babel/libs/nimgame/nimgame/ will be added to the path
20:44:21Araqyeah but that's exactly the behaviour I like
20:45:45dom96Well what I think will happen is:
20:46:01dom96We will get another package which uses the same module name as nimgame.
20:46:33dom96import common # I got nimgame, but now how do I get the other package?
20:46:44dom96And then there will simply be no way to fix this
20:46:56dom96The only thing you will be able to do is to tell the authors of the package to change it
20:47:02fowlimport nimgame/common
20:47:06dom96Am I missing something?
20:47:13Araqyes
20:47:39Araqyour rule "prefer the module within the same directory" for the 'import' statement fixes that then
20:48:14dom96what?
20:48:27dom96I'm not sure you understand what I mean.
20:48:32dom96We have two separate packages.
20:48:55dom96And another separate file which tries to import a module with the same name from the two packages.
20:50:44*fowl is now known as areola_borealis
20:51:39Araqwell you do: import engine, common # picks the right 'common'
20:51:58Araqif you do: import common # good luck :P
20:52:12dom96The point is: I want the two commons
20:52:18dom96I want to import common from both packages
20:52:24dom96And I obviously can't
20:52:36AraqAraq the real problem is that you can't have 2 common.nim files within the same project and that's a bit of work to fix, so I don't want to do it *now* given that we have 2 packages in total for now
20:52:56dom96you simply don't get it.
20:53:10Araqand you can of course do: import nimgame/lib/common then
20:53:23Araqso yes, I don't get it
20:53:33dom96<Araq> and you can of course do: import nimgame/lib/common then
20:53:40dom96Well that changes the situation.
20:53:51dom96But that is ugly.
20:54:18dom96Like i've already said, my point is that the layout of the package stays.
20:54:29dom96So if the only way to import 'common' is to do "import common"
20:55:17dom96Then the only way to fix this later will be to change the layout of the package.
20:55:29Araqyes the layout of the package stays; that's a feature
20:55:53Araqotherwise we will come up with one layout to rule them all
20:56:05Araqand I certainly don't want to design that now
20:56:26Araqand it's doubtful such a thing exists anyway
20:56:52dom96Well, currently you are basically saying "ok, Nimgame gets to be the only package to export a module by the name of 'common'. No other packages will be able to do it EVER. Only way to let them do it will be to change the layout of nimgame"
20:57:18Araqthat's not true
20:57:34Araqyou can do: import nimgame/lib/common; import jester/common
20:57:42Araqyou dislike the /lib/ in between
20:57:51Araqbut quite frankly, that's your problem
21:01:31dom96ok, that's fine.
21:04:51VladarAraq, I thought about that and here is an alternative option to consider: what if with path like this: $home/.babel/libs/foo-package/foo-lib/foo.nim and if no .nim files in foo-package we might do "import fool-lib/foo" ?
21:06:13Vladarthen I'll rename nimgame/lib to nimgame/nimgame and "import nimgame/common" will work. Can compiler do that and preserve in-package ability to do just "import common"?
21:09:53Araqnot without some notion of a 'package' within the compiler
21:10:04Araqcurrently the compiler has no such notion
21:10:32Araqdom96's idea to use the current path for the 'import' statement is not bad
21:13:25dom96IMO, that's the only way to go :P
21:13:32Araqthe real problem is that you are all spoiled and can't stand any prefixes; otherwise you could name it nimgame_common.nim and call it a day
21:14:12dom96hey, if I weren't spoiled i'd be using C right now, or asm or some low level crap.
21:14:17Araqbut I know I know, you all love to use utils, common and types as module names
21:15:05dom96Do you prefix all your module names with your project's name?
21:16:14Araqno, that results in filenames longer than 8 chars ... :P
21:17:25dom96yeah! How do you expect us to keep DOS support?
21:19:46VladarIt's ok, FreeDOS supports FAT32 =)
21:20:04AraqFPC uses module names like 'cg64f32.pas' :P
21:20:52Araqlearn that lesson from it :P
21:22:06Araqor aoptcpu and aoptcpub
21:25:38AraqVladar: do you feel like porting nimrod to freedos?
21:26:51VladarIs there gcc on FreeDOS? =)
21:27:02AraqI bet there is
21:27:11Araqhow else would they build the kernel?
21:27:17Araqor it is all written in asm?
21:28:06dom96I'm guessing the FreeDOS people are pretty hardcore, so I wouldn't be surprised.
21:28:11Vladarhm, it seems not: http://freedos.narod.ru/fd-doc/howto/faq.html#faq3_4
21:29:12gradhamaybe http://www.delorie.com/djgpp/16bit/ would work
21:31:46VladarAlso, I doubt there is sdl port for dos
21:32:47Araqmaybe but the compiler doesn't require SDL to run ... yet ;-)
21:49:18*XAMPP joined #nimrod
21:56:21Vladarbye
21:56:24dom96gradha: This is incorrect: https://github.com/gradha/Nimrod/commit/93f84492efdaf5a9f48d5b9502242373db1ae25d
21:56:36*Vladar quit (Quit: Leaving)
21:57:05dom96There is in fact a parseJson*(buffer: string): PJsonNode and a parseFile*(filename: string): PJsonNode
21:58:46gradhaI still haven't gotten used to the fact that the most useful proc seems to be at the end of each module
21:59:48gradhaI'll remove the text and update the example to use parseJson
22:06:16gradhahttps://github.com/gradha/Nimrod/commit/8d2f7287e9be7510219fb80b3c309d4bede9961d
22:06:42Araqgradha: use """ string literals please
22:07:27gradhaoh, I did try to use enclosing ' but that doesn't work
22:09:09gradhait seems ' or " are the same to the parser
22:09:10gradhahttps://github.com/gradha/Nimrod/commit/1d4abeda7f92620f98094055ad8dea545e5bae1a
22:10:12Araqno, ' and " are not the same
22:10:41gradhasmall_json = '{"test": 1.3, "key2": true}'
22:10:49gradhaError: missing final '
22:12:38Araq 'c' # character literal
22:12:42Araq"c" # string literal
22:14:55gradhahint: it would be less confusing if the error read: "missing final ' for character literal"
22:16:29Araqok, done
22:41:30*areola_borealis is now known as fowl
22:44:05*calmar joined #nimrod
22:44:35Araqwelcome calmar
22:52:53*fowl quit (Ping timeout: 252 seconds)
23:05:13*fowl joined #nimrod
23:12:27gradhawow, just discovered neither wget nor curl support http deflate under macosx
23:13:19gradhawho uses the commandline on mac anyway
23:17:15Araqwho uses a mac anyway :P
23:34:49*gradha quit (Quit: gradha)
23:48:55*q66 quit (Quit: Quit)