00:05:35 | * | vendethiel joined #nim |
00:08:43 | * | zama quit (Quit: leaving) |
00:09:35 | * | zama joined #nim |
00:11:02 | * | loz1 quit (Ping timeout: 256 seconds) |
00:28:11 | * | vendethiel quit (Ping timeout: 256 seconds) |
00:36:45 | * | lakurei quit (Quit: lakurei) |
00:40:28 | * | darkf joined #nim |
00:46:22 | * | brson joined #nim |
01:22:12 | * | Ven joined #nim |
01:32:13 | * | BitPuffin|osx quit (Ping timeout: 250 seconds) |
01:35:44 | * | Ven quit (Read error: Connection reset by peer) |
01:42:23 | * | Jesin quit (Quit: Leaving) |
01:46:01 | * | wb quit (Ping timeout: 264 seconds) |
01:56:32 | * | saml_ joined #nim |
01:57:03 | * | bjz joined #nim |
02:02:28 | * | Ven joined #nim |
02:06:12 | * | vendethiel joined #nim |
02:07:20 | * | Jesin joined #nim |
02:09:21 | * | Jesin quit (Read error: Connection reset by peer) |
02:10:28 | * | Ven quit (Read error: Connection reset by peer) |
02:11:23 | * | Jesin joined #nim |
02:11:28 | * | anthony joined #nim |
02:11:52 | * | anthony is now known as Guest84116 |
02:12:59 | * | Jesin quit (Remote host closed the connection) |
02:27:18 | * | vendethiel quit (Ping timeout: 246 seconds) |
02:40:57 | * | TEttinger quit (Ping timeout: 246 seconds) |
02:42:15 | * | brson quit (Quit: leaving) |
02:42:57 | def- | This works better than expected: https://github.com/def-/nimfmt/blob/master/nimfmt.nim |
02:46:18 | * | TEttinger joined #nim |
02:59:45 | * | johnsoft quit (Ping timeout: 240 seconds) |
02:59:59 | * | gcr joined #nim |
03:00:14 | * | johnsoft joined #nim |
03:00:48 | * | gcr left #nim (#nim) |
03:08:25 | * | vendethiel joined #nim |
03:31:37 | * | banister quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
04:14:08 | * | vendethiel quit (Ping timeout: 256 seconds) |
04:18:15 | * | Demon_Fox quit (Ping timeout: 256 seconds) |
04:18:46 | * | Demon_Fox joined #nim |
04:19:09 | * | JinShil joined #nim |
04:27:04 | * | ddl_smurf quit (Quit: ddl_smurf) |
04:55:11 | * | JinShil quit (Quit: Konversation terminated!) |
04:59:44 | * | saml_ quit (Quit: Leaving) |
05:25:36 | * | Guest84116 quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
05:37:50 | * | solidsnack joined #nim |
05:41:40 | * | solidsna_ joined #nim |
05:42:15 | * | solidsnack quit (Ping timeout: 250 seconds) |
05:54:25 | * | solidsna_ quit (Ping timeout: 264 seconds) |
06:19:34 | * | zzach joined #nim |
06:24:05 | * | solidsnack joined #nim |
06:40:44 | * | perturbation joined #nim |
06:47:32 | perturbation | anyone use the openssl_evp nimble package? Crashes at runtime with 'could not import: ASN1_SEQUENCE_ANY_it', but I have /usr/lib/libcrypto.dylib and /usr/lib/libssl.dylib |
06:47:57 | perturbation | maybe it's because I screwed things up with Homebrew... Mac OS X is not my favorite OS |
06:54:37 | perturbation | I'm going to try and reproduce on Linux... if I can't reproduce (with openssl libs installed), I'll know it's a problem with my Mac OS X setup |
06:55:02 | perturbation | if I can, I'll know it's a problem with openssl_evp (or how I'm using it) |
06:55:08 | * | perturbation quit () |
06:56:12 | * | yglukhov_ joined #nim |
07:04:09 | * | transfuturist quit (Ping timeout: 246 seconds) |
07:04:12 | * | Jesin joined #nim |
07:08:00 | * | perturbation joined #nim |
07:08:10 | * | johnsoft quit (Read error: Connection reset by peer) |
07:08:19 | * | Jesin quit (Read error: Connection reset by peer) |
07:08:25 | * | Jessin joined #nim |
07:08:34 | * | Jessin is now known as Jesin |
07:08:59 | * | johnsoft joined #nim |
07:09:26 | perturbation | definitely a problem with library path in OS X (or my setup) - openssl_evp works in Linux |
07:09:32 | * | perturbation quit (Client Quit) |
07:18:46 | * | filcuc joined #nim |
07:26:48 | * | solidsnack quit (Ping timeout: 256 seconds) |
07:29:06 | * | Jessin joined #nim |
07:29:47 | * | Jesin quit (Ping timeout: 256 seconds) |
07:30:22 | * | Jessin is now known as Jesin |
07:56:13 | * | filcuc quit (Ping timeout: 255 seconds) |
08:00:15 | * | filcuc joined #nim |
08:00:21 | * | Kingsquee quit (Quit: Konversation terminated!) |
08:02:08 | * | gmpreussner|work quit (Read error: Connection reset by peer) |
08:05:08 | * | X-Scale quit (Ping timeout: 272 seconds) |
08:10:26 | * | JinShil joined #nim |
08:19:21 | * | OnO joined #nim |
08:20:44 | * | anthony joined #nim |
08:21:06 | * | anthony is now known as Guest13258 |
08:21:20 | * | Ven joined #nim |
08:22:41 | * | Ven quit (Read error: Connection reset by peer) |
08:26:30 | * | BlaXpirit joined #nim |
08:38:06 | * | filcuc quit (Quit: Konversation terminated!) |
08:38:36 | r-ku | i could use additional set of eyes. my patch is misbehaving somehow. i listed everything including url to my patch in following gist: https://gist.github.com/r-ku/26ca187e0ad61d09a64b |
08:39:05 | r-ku | i have no idea how my changes could interfere with --import switch, any kind of help would be really appreciated |
08:42:02 | * | Demon_Fox quit (Quit: Leaving) |
08:43:41 | * | nimnoob123 quit (Quit: Page closed) |
08:44:17 | * | johnsoft quit (Ping timeout: 244 seconds) |
08:44:36 | * | Jesin quit (Quit: Leaving) |
08:44:36 | * | johnsoft joined #nim |
09:09:54 | * | grncdr joined #nim |
09:10:00 | * | Guest13258 quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
09:33:13 | * | Matthias247 joined #nim |
09:34:58 | * | Ven joined #nim |
09:36:29 | * | Ven quit (Read error: Connection reset by peer) |
09:47:29 | * | wb joined #nim |
09:53:30 | * | grncdr quit (Quit: Leaving.) |
09:59:53 | * | grncdr joined #nim |
10:17:36 | * | bjz quit (Ping timeout: 240 seconds) |
10:18:20 | * | bjz joined #nim |
10:37:39 | * | bluenote joined #nim |
10:41:11 | * | banister joined #nim |
10:57:41 | * | Trustable joined #nim |
11:07:43 | * | ddl_smurf joined #nim |
11:21:14 | * | grncdr quit (Quit: Leaving.) |
11:21:40 | * | grncdr joined #nim |
11:28:53 | * | grncdr quit (Quit: Leaving.) |
11:45:36 | * | milosn quit (Quit: leaving) |
11:51:00 | * | banister quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
12:27:32 | def- | Someone asked about zipfiles yesterday, should work again: https://github.com/Araq/Nim/pull/2648 |
12:28:48 | * | vendethiel joined #nim |
12:31:32 | * | jsseb left #nim (#nim) |
12:42:08 | * | yglukhov_ quit (Quit: Be back later ...) |
12:43:31 | * | yglukhov_ joined #nim |
12:45:08 | * | banister joined #nim |
12:47:47 | * | yglukhov_ quit (Ping timeout: 250 seconds) |
12:58:49 | * | BitPuffin|osx joined #nim |
13:00:38 | * | OnO quit (Quit: My iMac has gone to sleep. ZZZzzz…) |
13:21:31 | * | ingsoc joined #nim |
13:31:51 | * | xcombelle joined #nim |
13:55:41 | * | vendethiel quit (Ping timeout: 256 seconds) |
13:56:13 | * | TEttinger quit (Ping timeout: 264 seconds) |
13:57:13 | * | wb_ joined #nim |
13:57:34 | * | wb quit (Ping timeout: 255 seconds) |
13:57:38 | * | vendethiel joined #nim |
14:00:24 | * | transfuturist joined #nim |
14:04:09 | * | Matthias247 quit (Read error: Connection reset by peer) |
14:17:02 | * | filcuc joined #nim |
14:20:21 | * | yglukhov_ joined #nim |
14:20:25 | * | milosn joined #nim |
14:24:14 | * | ir2ivps10 joined #nim |
14:26:36 | * | darkf quit (Quit: Leaving) |
14:30:14 | * | wb_ quit (Read error: Connection reset by peer) |
14:58:18 | * | JinShil quit (Quit: Konversation terminated!) |
15:23:04 | * | bluenote quit (Ping timeout: 246 seconds) |
15:30:28 | onionhammer | def- you should pull that into a nimble package |
15:30:33 | onionhammer | and remove it from std lib ;) |
15:31:17 | def- | onionhammer: and niminst needs that nimble package for installation then? |
15:31:58 | onionhammer | hm hadnt considered that |
15:32:36 | onionhammer | i figured it was just another oddball in the std lib :) |
15:33:00 | def- | I'd like to do major changes in the stdlib by using more concepts. Could get rid of a lot of duplicate code |
15:33:13 | onionhammer | i dont think many use niminst though |
15:33:30 | onionhammer | yeah the std lib could use a makeover |
15:33:34 | def- | Not many, but I think the compiler tools should not depend on nimble packages |
15:33:48 | onionhammer | I agree |
15:34:00 | def- | I'm just waiting for concepts to work well enough |
15:34:03 | onionhammer | but I also dont think that should be a compiler tool ;) |
15:34:09 | def- | I hope that can happen before 1.0 |
15:35:07 | onionhammer | the nim repo needs to be stripped down to what the compiler relies on, and what the compile relies on shouldnt include zip (for example;)) |
15:35:18 | onionhammer | but nimble needs to be improved a lot too.. |
15:35:55 | dom96 | niminst should be a nimble package |
15:36:03 | Araq | niminst should be a separate tool |
15:36:12 | onionhammer | for sure |
15:36:31 | Araq | it's totally wrong that "koch install" uses niminst IMO |
15:37:27 | Araq | r-ku: does --import work for you in other cases? cause it surely is yet another feature hacked into the compiler before we had code reviews or test coverage |
15:37:50 | r-ku | well --import/--include work without my changes just fine |
15:38:03 | Araq | what are your changes? |
15:38:24 | r-ku | https://github.com/r-ku/Nim/commit/401e39bdc5ebcf41c80194e765461c05e9be8d4c |
15:39:44 | Araq | you remove 'mRepr' from semfold? |
15:40:11 | Araq | oh never mind, syntax highlighting is fucked up |
15:42:51 | Araq | well sysstr cannot import unsigned, system.nim cannot import anything. |
15:43:17 | Araq | I got away with it when I tested it, but it's not supported officially |
15:44:25 | r-ku | one more reason to put unsigned operations in system module |
15:44:49 | r-ku | after removing I64 variants we should be able to define signed and unsigned operators with single line actually |
15:45:21 | Araq | via a template? |
15:45:46 | * | ingsoc quit (Quit: Leaving.) |
15:45:52 | r-ku | operators i saw use same magic for signed and unsigned |
15:45:59 | r-ku | for all versions of ints, from 8 to 64 |
15:46:02 | * | ingsoc joined #nim |
15:46:08 | r-ku | with redundant I64 magic, which would be gone |
15:46:18 | r-ku | so all would use same magic |
15:46:23 | r-ku | oh damn, indeed template! |
15:46:27 | Araq | aye |
15:47:08 | r-ku | so.. i get an OK to move unsigned stuff to system after I64 magics are removed? |
15:47:28 | def- | r-ku: I have a PR for that with nice deprecation warnings |
15:47:49 | r-ku | oh thats awesome |
15:48:01 | r-ku | ill just do I64 stuff then |
15:48:04 | def- | and thanks for improving unsigned numbers, I used them a lot recently and ran into some problems |
15:48:28 | r-ku | after it and your PR are merged this string stuff can actually work |
15:48:45 | r-ku | yeah man me too. makes one's head spin how bad they are now ^_^ |
15:48:54 | onionhammer | :) |
15:48:59 | onionhammer | araq doesnt like them |
15:49:02 | onionhammer | so they work bad |
15:49:37 | r-ku | i guess then we need enough people to like them to compensate for that ;) |
15:49:56 | Araq | no. |
15:50:06 | Araq | I hate them, so they were added late |
15:50:26 | Araq | but I didn't deliberate make them work badly |
15:52:04 | Araq | and the compiler itself uses them in its VM subsystem |
15:53:40 | * | skyfex__ joined #nim |
15:56:10 | * | skyfex_ quit (Ping timeout: 265 seconds) |
15:58:25 | * | OnO joined #nim |
15:58:29 | onionhammer | im just giving you a hard time |
15:59:21 | onionhammer | hijack! http://forum.nim-lang.org/t/1179/1#7290 |
16:00:17 | * | banister is now known as banisterfiend |
16:01:09 | Araq | onionhammer: well but it's not "yet another good example", it's "yet another newbie" |
16:01:50 | Araq | ;-) |
16:01:52 | onionhammer | araq how hard would it be though |
16:02:17 | Araq | not very. 10 lines of code? |
16:02:26 | onionhammer | so why not? |
16:02:31 | Araq | but somebody must decide about a syntax |
16:02:39 | onionhammer | maybe a {.local.} pragma on the type for now idk |
16:03:00 | Araq | well but then, isn't that the wrong default? |
16:03:08 | onionhammer | yea |
16:03:14 | onionhammer | but its backwards compatible |
16:03:20 | Araq | hmm |
16:03:43 | onionhammer | otherwise type MyType = local object |
16:03:45 | onionhammer | would be cool |
16:04:17 | onionhammer | not necessarily "local", but some way to avoid typeing {. .} :) |
16:04:22 | Araq | thanks to function application without () this might be possible without making 'local' a keyword |
16:04:58 | Araq | but {. .} is more consistent |
16:05:12 | Araq | .inheritable, .final, .nonconstructible |
16:05:25 | onionhammer | well, you know how I feel about {..} |
16:05:34 | onionhammer | that it's a lot of typing :) |
16:05:40 | Araq | so backward compat and consistency decide that thing for us |
16:05:48 | Araq | I think |
16:05:49 | onionhammer | maybe I'll make a sublime snippet for it.. hmm |
16:06:02 | Araq | well you can type {. } instead |
16:06:25 | onionhammer | it's mainly a tool for library authors to avoid users mis-using their stuff.. |
16:06:38 | onionhammer | so whatever works. |
16:06:39 | flaviu | Well, just because something is a keyword doesn't mean it can't be used elsewhere. |
16:08:54 | * | OnO quit (Quit: Textual IRC Client: www.textualapp.com) |
16:09:03 | flaviu | Hmm, how about Voldemort types? |
16:09:20 | Araq | flaviu: doesn't work |
16:09:29 | * | OnO joined #nim |
16:09:31 | Araq | proc (f: Foo) |
16:09:34 | Araq | needs to be possible |
16:09:48 | Araq | it's just Foo() construction we want to forbid |
16:10:23 | Araq | plus you can get the type back via type(...) anyway |
16:10:26 | flaviu | Well, Foo() could be a concept. |
16:10:33 | flaviu | err, Foo. |
16:11:20 | * | ChrisMAN quit (Remote host closed the connection) |
16:11:40 | onionhammer | type Foo^ = object :P |
16:13:01 | Araq | onionhammer: come up with a pragma name please |
16:13:11 | flaviu | I think I've found a bug: https://gist.github.com/ca97970a41a224870145 |
16:13:16 | Araq | nonconstructible is too long and wrong |
16:13:19 | onionhammer | initlocal or local |
16:13:21 | onionhammer | hmm |
16:13:24 | flaviu | "type mismatch: got (int) but expected 'Foo'" |
16:14:06 | flaviu | That's on line 6 |
16:15:29 | Araq | def-, dom96 ready for 0.11.2 tonight? |
16:15:49 | dom96 | what, already? |
16:16:22 | * | grncdr joined #nim |
16:16:57 | Araq | dom96: 0.11.0 was an exceptionally bad release |
16:17:18 | dom96 | how so? |
16:17:43 | Araq | the last minute'ish patch that changes how types are computed broke everything |
16:18:02 | Araq | I was overconfident with our test suite |
16:18:12 | Araq | turned out it still sucks :P |
16:19:32 | dom96 | lol ok |
16:21:12 | OnO | hi, can I have a small suggestion for making csources a submodule, I had a problem compiling stuff from scratch on 0.11 until I realized that my "csources" were outdated |
16:21:32 | OnO | or at least build.sh should check if csources are recent enough somehow |
16:22:24 | Araq | don't make suggestions, make PRs :-) |
16:22:42 | OnO | sure |
16:23:02 | Araq | so ... not even install.sh works for 0.11 |
16:23:29 | Araq | at least we don't write on the site to use that |
16:23:32 | * | lakurei joined #nim |
16:24:18 | lakurei | Hi. To learn a bit more about Nim, I wrote this small program: |
16:24:20 | lakurei | http://pastebin.com/raw.php?i=KT3Wmq9q |
16:24:35 | lakurei | It does work but half of the time it crashes with the following error: |
16:24:43 | lakurei | SIGSEGV: Illegal storage access. (Attempt to read from nil?) |
16:24:56 | lakurei | Any pointer on what I did wrong? |
16:26:07 | dom96 | what's the stack trace? |
16:26:08 | * | grncdr1 joined #nim |
16:26:42 | * | grncdr quit (Ping timeout: 244 seconds) |
16:26:47 | lakurei | One second, I'll pastebin it too. |
16:27:44 | lakurei | http://pastebin.com/raw.php?i=RGTkAbSS |
16:28:46 | lakurei | Another one, this time it failed earlier: |
16:28:47 | lakurei | http://pastebin.com/raw.php?i=PND0grPF |
16:30:01 | dom96 | huh, shouldn't `client` be out of scope in the 'finally' body? |
16:31:31 | lakurei | It also crashes with the same stack trace when outside. |
16:34:26 | grncdr1 | I have a question about the change to parameter names in macros/templates |
16:34:30 | * | grncdr1 is now known as grncdr |
16:35:32 | grncdr | according the release announcement, I should use immediate, dirty, to get non-gensym paramaters, but then the news also says that immediate templates & macros will be deprecated because typed/untyped will cover it |
16:35:53 | grncdr | I'm just wondering if there's a better way to selectively break hygiene? |
16:37:11 | Araq | grncdr: dirty is not the same as immediate |
16:37:16 | Araq | dirty will stay |
16:37:20 | grncdr | ok |
16:37:40 | grncdr | I was using `quote do:` to initialize an AST node for a proc, then replacing the proc body. Is it possible to use the dirty pragma with that? |
16:37:43 | Araq | and there are better ways, dirty is just for convenience |
16:37:55 | grncdr | ah, then better ways are what I'm interested in |
16:38:35 | dom96 | lakurei: Hrm. I think there is a bug in async's handling of try except blocks :\ |
16:38:45 | * | yglukhov_ quit (Quit: Be back later ...) |
16:39:48 | lakurei | Ouch. By the way, the same thing happens with your gist in: https://gist.github.com/dom96/2d63e2a31a30feae54ea |
16:40:15 | * | yglukhov_ joined #nim |
16:40:52 | lakurei | I also remember getting a warning from the compiler that cb in asyncdispatch isn't GC-safe, (may be related?) but I can't reproduce it now. |
16:44:14 | * | nimnoob123 joined #nim |
16:44:22 | dom96 | lakurei: yeah, the transformation is wrong. Can you report this on github please? |
16:44:27 | * | yglukhov_ quit (Ping timeout: 246 seconds) |
16:44:41 | grncdr | Araq: any small example of how to access proc parameters in a template/macro? |
16:45:05 | lakurei | dom96: sure, I'll do, thanks. |
16:45:22 | grncdr | (with the proc itself being created in a macro) |
16:45:53 | grncdr | I guess I could create the syms myself, then quote them in the `proc(…)` part |
16:46:01 | * | grncdr tries that |
16:46:12 | def- | Araq: yes, ready |
16:46:42 | * | X-Scale joined #nim |
16:48:51 | Araq | grncdr: read about .gensym and .inject please |
16:51:17 | r-ku | hey so uh... that constructor deal pretty much stalled? |
16:53:19 | nimnoob123 | wait is it really coming? r-ku, I thought Araq was against it, if it is though I doubt it'll make 1.0 |
16:53:50 | r-ku | someone said he would make PR or something like that, idk |
16:54:39 | r-ku | but raising exceptions illustrates need for it.. raise newException(IOError, "...")... |
16:55:09 | dom96 | raise IOError(msg: "...") |
16:55:22 | dom96 | Will work when IOError is a ref. |
16:55:43 | Araq | bbl |
16:55:48 | r-ku | thats another problem yeah.. what if i want my type to be both ref counted and local on stack? |
16:56:00 | r-ku | two different types, complexity, dead kittens |
16:56:25 | dom96 | Then you have a TypeRef and a TypeObj |
16:56:49 | * | bogen left #nim (#nim) |
16:57:22 | flaviu | Or you just have a Type and a ref Type. |
16:57:51 | r-ku | raise (ref IOError)(...) <-- awkward |
16:58:02 | * | yglukhov_ joined #nim |
16:58:15 | dom96 | r-ku: What do you propose |
16:58:16 | dom96 | ? |
16:58:18 | r-ku | worse yet - cant initialize object right there. its more of a problem for other objects, not exceptions |
16:58:23 | flaviu | That's a flaw in the stdlib. |
16:58:33 | flaviu | IoError should be a ref object |
16:58:41 | flaviu | it is useless as a non-ref object. |
16:58:44 | r-ku | dom96: i talked a lot in that constructor thread. (me novist, changed nick) |
16:58:58 | OnO | Araq: here you go: https://github.com/Araq/Nim/pull/2649 |
16:59:01 | r-ku | flaviu: in that case yes. but its not true for every other case |
16:59:13 | dom96 | link? |
16:59:19 | flaviu | r-ku: How about https://gist.github.com/flaviut/1ae1d7deac4c57d0a84c ? |
16:59:33 | flaviu | then it's `box Foo(...)` |
16:59:39 | r-ku | http://forum.nim-lang.org/t/703 |
17:00:21 | dom96 | Could you summarise? I don't have time to read 10 pages of posts. |
17:00:54 | r-ku | for my own needs i made some macro stuff with folowing syntax: var a = local TypeName(p1, p2, p3); var a = gcnew TypeName(p1, p2, p3); they call proc init automatically with var TypeName as first param and rest of args passed to that proc |
17:01:18 | r-ku | ofc its a hack and bit awkward too, if it could be simplified it would be much better |
17:01:45 | r-ku | for example i think var a = TypeName(p1, p2); for local stack object makes a lot of sense |
17:01:56 | r-ku | and var a = ref TypeName(p1, p2); for gc'ed version |
17:02:20 | OnO | Araq: can we add .gitignore to csources repo or it will be wiped on next bootstrap niminst? |
17:02:42 | OnO | coz .o or .obj files makes repo dirty |
17:03:02 | r-ku | var a = (ref TypeName)(f1: p1, f2: p2); works now right? not much difference from how it works now if so. |
17:03:57 | dom96 | perhaps we could just remove the need for the parenthesis in that case |
17:04:14 | dom96 | but yeah, ok. PRs welcome :) |
17:05:25 | r-ku | dom96: but its not just parenthesis problem. there is automatic init() proc calling too |
17:23:44 | xcombelle | hi I have a question is it possible to limit the size of one thread heap ? |
17:31:10 | * | pidg quit (Ping timeout: 246 seconds) |
17:31:56 | * | Xaseron joined #nim |
17:40:13 | Araq | dom96: the inconsistent parenthesis is what I dislike most about 'new'-like constructors in the first place! |
17:45:03 | Araq | xcombelle: no. |
17:49:58 | * | OnO_ joined #nim |
17:51:07 | * | OnO quit (Quit: Textual IRC Client: www.textualapp.com) |
17:51:13 | * | OnO_ quit (Client Quit) |
17:52:27 | * | OnO joined #nim |
17:54:39 | xcombelle | thanks for the answer Araq |
17:56:17 | * | OnO quit (Client Quit) |
17:56:58 | * | OnO joined #nim |
18:02:57 | * | vendethiel quit (Ping timeout: 240 seconds) |
18:04:19 | * | vendethiel joined #nim |
18:23:32 | * | filcuc_ joined #nim |
18:23:54 | * | filcuc quit (Ping timeout: 272 seconds) |
18:24:36 | * | elbow_json joined #nim |
18:32:34 | * | ingsoc quit (Quit: Leaving.) |
18:35:36 | OnO | guys, simple Q, how to check if we are in debug build or release build |
18:35:39 | OnO | when XXXX: ? |
18:36:19 | Araq | when defined(release) ? |
18:42:38 | OnO | okay cool, thnx |
18:43:21 | OnO | dom96: is master the right branch to send PR for jester? |
18:43:22 | * | banisterfiend quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
18:44:41 | dom96 | OnO: yes |
18:46:08 | * | OnO quit (Quit: My iMac has gone to sleep. ZZZzzz…) |
18:46:30 | * | Trustable_2 joined #nim |
18:47:20 | * | OnO joined #nim |
18:48:33 | * | Trustable quit (Ping timeout: 240 seconds) |
18:53:30 | * | elbow_json quit (Remote host closed the connection) |
19:00:19 | * | vendethiel- joined #nim |
19:01:18 | * | vendethiel quit (Ping timeout: 246 seconds) |
19:03:41 | * | OnO is now known as ono |
19:04:00 | Xaseron | is there no abs() function in the std? |
19:05:22 | * | ono is now known as OnO |
19:05:28 | * | OnO quit (Quit: Textual IRC Client: www.textualapp.com) |
19:06:09 | * | OnO joined #nim |
19:06:37 | Araq | Xaseron: system.abs? |
19:07:01 | Xaseron | ah ok |
19:07:10 | Xaseron | i looked in the math library |
19:10:46 | * | Jesin joined #nim |
19:13:23 | OnO | dom96: do you reckon what's the reason jester simple routes: get "/": resp "Hello World!" is 21k req/s, while same done directly in AsyncHTTPServer is 47k req/s? |
19:13:35 | OnO | dom96: what makes such a slowdown? |
19:14:03 | dom96 | excessive allocations of the Request object |
19:14:12 | dom96 | I will be improving it |
19:15:17 | OnO | dom96: btw. how do I change jester default 5000 port when using routes: and runForever(), no explicit Jester instance? |
19:15:38 | dom96 | https://github.com/dom96/jester/blob/master/tests/alltest.nim#L4 |
19:15:43 | def- | let settings = newSettings(port=Port(8080), staticDir=".") |
19:16:08 | OnO | oh thanks |
19:17:13 | * | anthony joined #nim |
19:17:37 | * | anthony is now known as Guest5420 |
19:18:45 | * | filcuc_ quit (Quit: Konversation terminated!) |
19:22:34 | * | Kingsquee joined #nim |
19:22:41 | fowl | def-: you have GCC 5? |
19:22:44 | * | Guest5420 quit (Ping timeout: 245 seconds) |
19:24:17 | fowl | Nm I'm tripping |
19:24:23 | def- | fowl: nope, but my clang version has those builtins already |
19:24:41 | def- | I guess I should build GCC 5.1 for testing though |
19:25:11 | fowl | Well I asked because on arch I have 4.9 I think. 5 must be very bleeding edgr |
19:28:22 | * | elbow_json joined #nim |
19:32:32 | OnO | dom96: okie, updated my little benchmark at https://github.com/nanoant/WebFrameworkBenchmark I hope Jester will be soon closer to native AsyncHTTPServer performance |
19:32:45 | OnO | I'd expect just few % drop from route processing |
19:33:10 | def- | But if you think about it, 20k req/s is still enough for nearly everything |
19:33:43 | Araq | fwiw when I looked at jester's code I added to my todo to rewrite utils.nim or something |
19:33:55 | fowl | What kind of traffic does your site get when its "slashdotted" |
19:34:01 | OnO | def-: yes & no, if using AsyncHTTPServer gives you more than 2x then Jester overhead is simply way too much |
19:34:10 | onionhammer | def- it's about overhead |
19:34:30 | onionhammer | realistically 'hello world' should be pretty quick, it'll slow down quick w/ app logic, the framework shouldnt be causing that though |
19:34:36 | def- | fowl: When my blog was #1 on Hacker News and r/programming it got 1-2 requests per second. Slashdot was about the same |
19:34:51 | OnO | IMHO overhead should be minimal, 2-3% is justifiable for route processing |
19:35:20 | Araq | route processing should use lexim :-) |
19:36:46 | OnO | Araq: okie, I guess I overlooked that one |
19:37:03 | OnO | https://github.com/Araq/lexim ? |
19:38:21 | Araq | yep |
19:38:21 | OnO | I am thinking about using Nim to make GitHub/GitLab clone with minimals deps |
19:38:58 | OnO | this isn't rocket science, and I think GitLab sucks too much with billions deps I can't stand it |
19:39:24 | OnO | but I miss also ORM for db_postgress/mysql/sqlite |
19:39:35 | onionhammer | Araq cool.... how do you use it? :) |
19:40:27 | OnO | just trying to learn how to do macros which turn sthing like: User.where(User.name == "joe" and User.pwsha == "1234") to SQL |
19:40:36 | ddl_smurf | has anyone done some kind of DHT with nim ? (distributed hash table - basically bittorrent) |
19:40:54 | OnO | I guess I need where to be a macro that will turn stmt into SQL |
19:41:08 | OnO | any good place for example for such a macro? |
19:41:14 | fowl | I thought an orm could store and retrivr objects from the db |
19:42:01 | Araq | onionhammer: match s, i: |
19:42:17 | Araq | of r"[a-z]+": echo "identifier" |
19:42:26 | Araq | of r".": echo "something else" |
19:42:30 | OnO | fowl: this piece is rather straightforward, I think Nim could excel in higher level retrieval statements turned at compile time into SQL |
19:42:53 | OnO | which will obviously greatly improve performance |
19:43:12 | ddl_smurf | OnO: you'll never handle all stmt, so just define your own subset that makes SQL sense and force users to whatever syntax it understands |
19:44:17 | * | Matthias247 joined #nim |
19:44:48 | ddl_smurf | (the alternative approach is to use "representational" objects like col"thiscolumn" == sqlliteralint"4" and have thos objects self-generate, basically your own SQL DOM) |
19:45:16 | OnO | pretty ugly :> |
19:45:21 | ekarlso | oh god, +100 to a object mapper thing in nim... |
19:45:25 | ddl_smurf | (in this case you'd override == on col to generate says a EqualitySQLContraintExpression or something) |
19:46:03 | OnO | I'd opt for User.where(@id == 4) where @something is a operator that created some SQLORMId |
19:46:19 | dom96 | OnO: A GitLab clone in Nim would be really cool to see. |
19:46:24 | OnO | and then we can define other operators eg. `==`(ORMId, int) |
19:46:26 | ddl_smurf | really isn't so ugly, i'd wager you could rather quickly like 99% of useful sql expressions) |
19:47:15 | ddl_smurf | sure, you'll need a special object of identifiers in any case, they need escaping and aren't strings |
19:48:09 | fowl | Nah you just use prepared stmts and you're fine |
19:48:32 | OnO | hmmm.... thinking loud, I could create dot accessor template that that 1st argument is Model type |
19:48:51 | OnO | so User.name -> ORMId, where user.name is actual value |
19:49:18 | OnO | then (User.name == 1) -> ORMStmt |
19:49:33 | ddl_smurf | (obviously, depending on your dialect, you want `user`.`name` or the like) |
19:49:50 | Araq | ekarlso: how would that help you? you cannot even use the cgi.nim module that we already have! |
19:50:07 | fowl | Ono write out some example statements first |
19:51:07 | Araq | ekarlso: or do you? ;-) |
19:51:14 | OnO | eg. for user in User.where(User.name == "joe" and User.pwsha == "1234"): echo user.email |
19:52:36 | Araq | OnO: that's cool but without compile-time model checking not good enough IME |
19:52:58 | ekarlso | Araq: sorry how's that related ? |
19:53:21 | ddl_smurf | User.id in (User.select(id).where(like(name, "Paul%") and User.current_job.name == "Annoyer" and User.managers.include(User.where(country == "gb"))) ))))) <- or another number of rparen |
19:53:38 | Araq | ekarlso: we want your "run Nim code here" website to work with more than 1 user at a time |
19:54:00 | ekarlso | Araq: i dont have time atm to remake it to use cgi... |
19:54:21 | ddl_smurf | (not sure i agree with the model checking - you don't always have your whole model in the current language you're using, and rarely need to) |
19:54:23 | Araq | ekarlso: fair enough but then make somebody else in #nim do it |
19:54:31 | ekarlso | Araq: really ? |
19:54:42 | Araq | ddl_smurf: it should ask the DB for the model |
19:54:43 | ekarlso | the code is up for forking if someone has wanted to do it .. |
19:54:57 | ddl_smurf | at compile time it should be talking sql ?????? |
19:55:06 | Araq | ekarlso: yes but you need to announce it in the mailing list, forum and here |
19:55:14 | Araq | ddl_smurf: yup |
19:55:17 | * | xcombelle quit (Quit: Leaving) |
19:55:59 | ddl_smurf | i disagree, hell i don't see the checking as helping at all, and waiting for the db to dump it's schema at each compile is nearly totally useless |
19:56:24 | ddl_smurf | more often than not your DB target schema is variable, and its actually mostly OK |
19:59:10 | ddl_smurf | (OnO if you do work on it, please consider naming conventions (nim field name to field name, fk name etc), relations, dates and collations, and most importantly transactions - from the start, too many ORM are shit hobby projects that ruin enterprises) |
19:59:56 | Araq | ddl_smurf: without the checking you might as well pass strings to the db |
19:59:59 | gokr | Personally I would instead start making something similar to ROE in the Smalltalk world. |
20:00:13 | onionhammer | Araq so will this replace the re module in the std lib? |
20:00:16 | ddl_smurf | actually had invested quite a bit of dev into sequelize, it said it did transactions but it didn't, when i went on IRC to ask the author, he basically replied he didn't see the point, this forced me to rewrite a lot) |
20:00:19 | gokr | Which models relations as first class constructs. |
20:00:20 | Araq | onionhammer: it can't |
20:00:43 | OnO | yeah, sure this is why I am thinking loud, so maybe: |
20:00:43 | OnO | User.where(User.name == "joe" and User.pwsha == "1234") |
20:00:43 | OnO | or maybe: |
20:00:43 | OnO | User.where(@name == "joe" and @pwsha == "1234") |
20:00:45 | OnO | or even: |
20:00:45 | OnO | User.where(.name == "joe" and .pwsha == "1234") |
20:01:01 | ddl_smurf | thats a reducio ad absurdum, there is plenty of value in using the correct code identifiers and auto-escaping and type checking to a degree |
20:01:04 | Araq | ddl_smurf: plus you can cache the DB model querying |
20:01:19 | Araq | ddl_smurf: how do you get the type checking though? |
20:01:29 | OnO | last one would be cool, but no idea how to make a custom prefix operator that will take any identifier and turn it into something else |
20:01:33 | ddl_smurf | the way i see it is you define the fields you're going to use |
20:01:59 | ddl_smurf | (last one doesnt nest well) |
20:02:42 | Araq | plus strings have the advantage that you can try and tweak the query and then paste it into your program |
20:02:45 | fowl | Ono more interesting i think is generating the db layout from object types. We can do that with macros looking the types fields and stuff |
20:03:08 | OnO | fowl: yess... that would be also awesome |
20:03:17 | ddl_smurf | fowl: yeah but it needn't be exhaustive |
20:03:18 | Araq | fowl: that works but I like to have the model in the DB |
20:03:40 | Araq | not generate it from Nim's type system |
20:03:56 | Araq | but I guess given enough annotations that can work as well |
20:03:56 | ddl_smurf | araq: i'm not against strings - in fact if doesn't have a fallback to sql chunk system i'm not touching with a stick |
20:04:09 | OnO | Araq: I'd opt for annotations |
20:04:22 | onionhammer | araq where did we land on that pragma? |
20:04:35 | OnO | if you don't like default type from given field name you add some annotation like {. sqlType: XXX .} |
20:04:48 | Araq | yeah |
20:05:11 | OnO | some thing for defining indexes |
20:05:26 | OnO | only think that would need to be worked out are migrations |
20:05:34 | OnO | but this is far future ;) |
20:05:49 | gokr | Something like ROE should fit Nim fairly well - since its a lazy library that generates SQL only when you start iterating over something. |
20:05:52 | ddl_smurf | in a perfect world, that syntax need not be SQL-specific, ie.: i wouldn't mind a .where and a .join etc on my normal nim objects |
20:06:05 | ddl_smurf | or using the query generator in other contexts, say xpath etc |
20:06:18 | gokr | But obviously noone listens ;) |
20:06:31 | ddl_smurf | actually i'm describing linq and nhibernate, maybe i'm just biased |
20:06:46 | Araq | gokr: sorry, you need to at least give us lazy folks a link |
20:07:08 | gokr | Mmmm, let me see... |
20:07:42 | Araq | ddl_smurf: LINQ2SQL is great but it generates strongly typed stuff from the DB model. ;-) |
20:07:56 | Araq | which is what I'm proposing |
20:08:16 | ddl_smurf | yeah but your model needn't be complete, you can just define whichever couple of tables and fields you want to use, which is what i'm proposing |
20:08:44 | * | HakanD joined #nim |
20:08:48 | ddl_smurf | wait, you're saying it pulls the schema from the DB ? in the case of nhibernate that's wrong |
20:09:00 | OnO | gokr: Why would you need lazy SQL generation if you can have compile time SQL generation ? |
20:09:24 | gokr | OnO: What I mean is that the laziness fits perfectly with "compile time" |
20:09:27 | ddl_smurf | OnO: sometimes your parameters are variable in themselves too |
20:09:42 | ekarlso | +1 ddl_smurf ... |
20:09:48 | gokr | Its a bit hard to find stuff around ROE, but you can see a summary if you search for "ROE" here: http://blog.redtexture.net/2010/10/30/avi-bryants-presentations/ |
20:09:50 | ekarlso | api filter for example :p |
20:10:03 | OnO | ddl_smurf: sure, but then at compile time you get sql"... where id = ?" % [ id ] |
20:10:24 | OnO | so I don't see the point |
20:10:27 | ddl_smurf | sometimes its not id, sometimes i want to add an "AND this" or "SORT" clause |
20:10:40 | gokr | So ROE was made by Avi Bryant (who has done lots of really slick stuff) and the idea was to model Relations in Smalltalk - instead of "objects in an RDB". Turning it around. Kinda like LINQ. |
20:11:05 | ddl_smurf | in more advanced cases you want more control at runtime within the query, things like full text search or bson |
20:11:20 | OnO | ddl_smurf: the elements in where clause are either constants or variables.. this is known at compile time |
20:11:22 | ddl_smurf | so being able to manipulate the query dom would be very interesting |
20:12:00 | OnO | so the idea is always generate query at compile time |
20:12:02 | gokr | So you have a library that models relational algebra. You can combined them etc, and only when you start accessing a "table" by iterating - only then will it actually produce SQL. Thus, it would fit perfectly with compile time. |
20:12:03 | fowl | gokr: but smalltalk is just a giant database so a better accomplishment there is doing something outside of the database :p |
20:12:29 | gokr | fowl: Not sure what that comment has to do with ROE. |
20:12:40 | OnO | btw. I need some help why this code does not work: |
20:12:40 | OnO | type |
20:12:41 | OnO | Model = object |
20:12:41 | OnO | ORMId = object |
20:12:43 | OnO | name : string |
20:12:43 | OnO | User = Model |
20:12:45 | OnO | template `.`(t : typedesc[Model], f : string): string = |
20:12:45 | OnO | result = f |
20:12:47 | OnO | echo Model.test |
20:12:53 | OnO | I get: orm.nim:10:11: Error: undeclared identifier: 'result' |
20:13:21 | fowl | Just make the last line f |
20:13:38 | gokr | fowl: ROE basically is an internal DSL for SQL - that makes relations look like Collections. |
20:13:58 | fowl | gokr: dunno what ROE is either you're the only one talking about it? |
20:14:10 | OnO | fowl: wow, thanks, think I still don't understand templates :) |
20:14:13 | fowl | Ok |
20:14:45 | fowl | OnO: the template is simple substitution mechanism, the code inside gets replaced as an expression |
20:14:54 | gokr | fowl: Could be because I am the only Smalltalker here, right? Its still a very nice approach to the eternal "SQL in code" problem. |
20:16:08 | ddl_smurf | (the SQL in code problem is eternal for a good reason) |
20:16:16 | gokr | fowl: See from slide 10 here: http://www.slideshare.net/esug/squeak-at-net-style |
20:16:27 | ddl_smurf | to exclusively use an ORM is idiotic, ORM's are complimentary tools to SQL |
20:16:34 | Araq | gokr: I cannot see how Linq2sql differs from ROE in this aspect |
20:17:11 | gokr | I may be wrong, but LINQ basically "just" makes SQL fit better with the language, it doesn't really "model" relations, does it? |
20:17:34 | fowl | gokr: looks easy |
20:17:47 | gokr | fowl: You checked the slides? |
20:18:23 | gokr | I am not sure, but I think latest Rails is doing something kinda similar. |
20:19:17 | Araq | OnO: a template does not have 'result' as a template has no stack frame etc. it's not a function. |
20:19:56 | Araq | we could give it a gensym'ed result for consistency but I think that's a bit too much muddling of stuff |
20:20:02 | gokr | Either way, I am not that much into RDBs, but from everything I have seen over the years in the various shapes of ORMs etc, ROE seemed like a very clean "Let's go to the mountain"-instead solution. |
20:22:21 | fowl | gokr: looks doable |
20:22:39 | gokr | fowl: I kinda felt it should fit nicely with Nim. |
20:22:50 | gokr | AFAIK GNU Smalltalk has ROE included. |
20:23:41 | fowl | I don't really have a need for it though |
20:23:45 | OnO | so far, my little experiment: |
20:23:47 | OnO | type |
20:23:47 | OnO | Model = object |
20:23:49 | OnO | ORMStmt = object |
20:23:49 | OnO | query : string |
20:23:51 | OnO | User = Model |
20:23:51 | OnO | template `.`(t : typedesc[Model], f : string): ORMStmt = |
20:23:53 | OnO | ORMStmt(query : f) |
20:23:53 | OnO | template `and`(a : ORMStmt, b : ORMStmt): ORMStmt = |
20:23:55 | OnO | ORMStmt(query : "(" & a.query & " AND " & b.query & ")") |
20:23:55 | OnO | template `or`(a : ORMStmt, b : ORMStmt): ORMStmt = |
20:23:57 | OnO | ORMStmt(query : "(" & a.query & " OR " & b.query & ")") |
20:23:57 | OnO | proc `$`(s : ORMStmt): string = |
20:23:58 | * | vikaton quit () |
20:23:59 | OnO | s.query |
20:23:59 | OnO | echo User.id and User.name or User.pw |
20:24:11 | gokr | fowl: It wouldn't solve the "objects in RDB" problem - but for many it would be enough to get a nice Nim abstraction layer over RDBs, and could form a base for ORMs on top. |
20:24:20 | gokr | OnO: Please use some paste thingymabob |
20:24:45 | OnO | yeah, sorry about that |
20:25:24 | gokr | Just amazed you haven't been disconnected automatically yet - I always do when I paste ;) |
20:26:12 | gokr | fowl: What I really want though is a clean nice binding to HyperDex. |
20:26:58 | fowl | gokr: would you pay for it |
20:27:05 | gokr | Possibly |
20:27:51 | gokr | Although... we do have Araq on our team ;) |
20:28:09 | gokr | He probably does it in 10 min |
20:28:20 | fowl | Sure |
20:28:50 | fowl | I actually have done a wrapper in 10 mins before ;) |
20:29:19 | gokr | The actual wrapper itself is trivial. But then you would want a higher Nim level above. |
20:29:44 | gokr | The lib is all async, so you need a bit of book keeping to keep track of req/responses etc |
20:30:39 | fowl | C interface means it shouldn't be too painful |
20:30:59 | Araq | fowl: gokr wrapped it and blogged about it months ago |
20:31:03 | fowl | Does it have events that you hook to |
20:31:16 | fowl | Oh lol |
20:31:18 | Araq | don't tell him what c2nim can do ;-) |
20:31:23 | Araq | he knows. |
20:31:33 | fowl | C2nim isn't as good as a human |
20:31:44 | Araq | not yet :P |
20:31:56 | gokr | fowl: http://goran.krampe.se/2014/10/16/nim-wrapping-c/ |
20:32:34 | gokr | But I only did a spike of it so to speak. |
20:33:23 | fowl | Can key value stores replace a database |
20:33:24 | gokr | But its a way cool db. Fast as a bat out of hell, and very fault tolerant. |
20:33:51 | gokr | fowl: Is that a serious question or? |
20:34:17 | fowl | I've never used one. Haven't needed a database in a long time |
20:34:35 | gokr | Ah, well, there are so many different kinds of dbs these days, its all about what you need. |
20:34:58 | gokr | The NoSQL dbs cover a wide spectrum of different aspects. |
20:35:11 | Araq | yeah and Postgre is all you need *cough* |
20:35:29 | gokr | For a lot of projects a solid RDB is more than enough. |
20:35:48 | gokr | But for say Amazon scale web stores - nah. |
20:35:59 | gokr | Or Spotify play lists. |
20:36:03 | gokr | Etc etc. |
20:36:06 | * | jh32 joined #nim |
20:36:28 | ekarlso | riak & cassandra are REALLY nice |
20:36:39 | gokr | Yes, those two are quite nice. |
20:36:57 | gokr | Spotify use Cassandra btw. |
20:37:00 | ekarlso | we're deploying it for a PoC atm and the numbers we're doing atm is pretty cool |
20:37:07 | * | yglukhov_ quit (Quit: Be back later ...) |
20:37:13 | ekarlso | gokr: tons of companies use both technologies... |
20:37:19 | ekarlso | riak & cas |
20:37:22 | gokr | Yes, of course. |
20:37:31 | ekarlso | not so many on mongo though on big scale |
20:37:41 | gokr | Nah, Mongo got quite a few burnt. |
20:38:10 | gokr | HyperDex fits an interesting niche though. |
20:38:21 | ekarlso | another kewl one is influxdb |
20:38:26 | ekarlso | for timeseries |
20:38:36 | gokr | It has similar fault tolerant characterstics as Riak - but is actually consistent. |
20:38:46 | gokr | And very fast even on a small number of nodes. |
20:38:47 | * | vendethiel- is now known as vendethiel |
20:39:07 | Araq | I liked mongo until I had to use it for complex queries |
20:39:14 | jh32 | not sure if this is the right place, but the example in the Reference and pointer types section in http://nim-lang.org/tut1.html seems to have a typo (le, ri: PNode |
20:39:15 | ekarlso | gokr: hmmm, checked out cockroachdb ? |
20:39:17 | gokr | We use Influx a bit actually, but moved onto ... |
20:39:30 | ekarlso | gokr: moved onto what ? :p |
20:39:45 | gokr | My memory... arrgh... |
20:39:56 | jh32 | .. should probabely read le, ri: Node , no? |
20:40:17 | Araq | jh32: yup good catch. consider it reported |
20:40:29 | jh32 | thanks |
20:40:36 | ekarlso | gokr: ? :p |
20:41:24 | gokr | Ah, hostedgraphite |
20:41:29 | gokr | They actually use Riak |
20:41:48 | ekarlso | :o |
20:42:03 | gokr | Its very nice IMHO. |
20:42:06 | ekarlso | we're doing influxdb for our monitoring as a service ^ |
20:42:07 | * | HakanD quit (Quit: Be back later ...) |
20:42:19 | gokr | Ah |
20:42:42 | gokr | Well, we used influxdb.com for a short while, but then went with hostedgraphite instead. |
20:42:47 | ekarlso | i wonder if it will be able to compete with Vertica though... |
20:42:59 | ekarlso | i heard vertica handles in some cases some insane nr's |
20:43:15 | ekarlso | like 2 trillion entries + without sweating |
20:44:07 | * | dalarmmst joined #nim |
20:44:18 | * | yglukhov_ joined #nim |
20:45:54 | gokr | ekarlso: One slightly oddball of NoSQL dbs is Tarantool which I stumbled over when looking at Lua |
20:47:23 | dalarmmst | Does anyone know where I can find info on pointer arithmetic? If I have a var of type pointer to some memory (for example with MemFile.mem in memfiles.MemFile in module memfiles) I'd like to retrieve data from that pointer, by stepping through one byte at a time. |
20:48:17 | Xaseron | i have wrote a basic avl tree in nim this evening. it's a pretty sleek and clutter free language. |
20:48:35 | BlaXpirit | dalarmmst, https://github.com/fowlmouth/nimlibs/blob/master/fowltek/pointer_arithm.nim |
20:49:20 | Araq | dalarmmst: template `+!`(x): expr = cast[type(x)](cast[int](x) + sizeof(x[])) |
20:51:07 | BlaXpirit | a couple examples of dealing with pointer returned from C https://github.com/BlaXpirit/nim-csfml/search?q=cast |
20:56:08 | * | vikaton joined #nim |
20:57:54 | dalarmmst | Thanks guys |
20:58:39 | Araq | dalarmmst: of course, the proper way is to map it to a pointer of an array ;-) |
20:58:55 | Araq | and then use array indexing |
20:59:03 | * | egrep quit (Quit: Error -38: Black hole has swalled this client.) |
20:59:36 | dalarmmst | Araq: I'm very new to nim, do you have an example somewhere of this? |
20:59:38 | * | egrep joined #nim |
21:01:38 | OnO | can we concat sequences at compile time? |
21:02:46 | BlaXpirit | OnO, wouldn't expect such a question from you. can't you just check? |
21:03:01 | OnO | I checked, and seems not |
21:03:55 | dalarmmst | Araq: Also, will that work if you use an mmap'ed file? |
21:03:56 | OnO | let me say I got type ORMStmt = query : string, args : seq[string] |
21:04:14 | BlaXpirit | OnO, can concat |
21:04:17 | OnO | if I try to concat args in my template for operators such as `==` |
21:04:34 | BlaXpirit | doing something wrong |
21:04:45 | Araq | dalarmmst: let x = cast[ptr array [1000_000, ptr int](result_of_mmap); use x[i] |
21:05:03 | Araq | and yes, the upper limit of 1 million is arbitrary |
21:05:11 | * | Araq likes arbitrary limits. |
21:05:27 | BlaXpirit | that's scary |
21:05:53 | Araq | that's the nature of computation. |
21:06:06 | fowl | That would be for int** |
21:06:18 | Araq | 2^31 - 1 is just as arbitrary |
21:06:37 | dalarmmst | Araq: let x = cast[ptr array [m.size, ptr int](m.mem); Wouldn't this be nicer? |
21:06:46 | OnO | BlaXpirit: https://gist.github.com/nanoant/ce1428eee5d009fdf3eb |
21:07:03 | Araq | dalarmmst: but m.size is a runtime value and arrays don't support that |
21:07:16 | OnO | ^-- aparrently I don't get string concatenation opt at compile time |
21:07:45 | OnO | but if I remove anything related to concatenating: args seq, just concatenating query strings works OK |
21:08:06 | Araq | OnO: I'm working on this right now ... |
21:08:17 | dalarmmst | Araq: So I'm just casting it to something that looks like an array of 1000_000 elements, I'm not allocating anything there right? |
21:08:24 | Araq | right |
21:08:36 | dalarmmst | The arbitrary size still looks a bit ugly to me :p |
21:10:01 | Araq | well actually you get some runtime checking out of this |
21:10:22 | Araq | as indexes greater than that will produce an out of bounds exception |
21:10:22 | ddl_smurf | as well it should - i think araq is trolling - even though he'll go on with "oh but that limit or MAXINT, what's the difference?" |
21:10:50 | Araq | ddl_smurf: how is that trolling? |
21:10:56 | renesac | Araq: can't the {.unchecked.} pragma be used here? |
21:11:10 | renesac | to not have that arbitrary limit? |
21:11:11 | Araq | renesac: it can but then you get no checking whatsoever |
21:11:16 | ddl_smurf | you're truly advocating abritrary limits ? |
21:11:33 | Araq | you think there are other limits? |
21:11:54 | renesac | I don't see much gain from that limited checking |
21:12:01 | ddl_smurf | well if you don't think there are others, what are you talking about =D |
21:12:04 | renesac | plus failing when it could otherwise work |
21:12:24 | renesac | if you are using a arbitrary limit, then at least don't use a magic number |
21:12:27 | Araq | ddl_smurf: making other programmers aware is not a bad thing |
21:12:41 | renesac | so the rest of the code can properly use it too |
21:12:47 | ddl_smurf | ok i'll bite: the other limits are not arbitrary |
21:12:53 | ddl_smurf | they have explanations |
21:13:41 | Araq | no the other limits are far more error prone, try computations when close to MAX_INT you get overflows etc |
21:13:59 | * | OnO quit (Quit: My iMac has gone to sleep. ZZZzzz…) |
21:14:19 | Araq | an arbitrary limit of 1 million means you don't get into this trouble and its related security risks |
21:14:27 | ddl_smurf | goes both ways: there are plenty of scenarios that run into your arbitrary limit that wouldn't have in MAX_INT, precisely MAX_INT-10^6 scenarios |
21:14:55 | ddl_smurf | but then it's not arbitrary if you opt-in for some reason |
21:15:10 | Araq | yeah ok, whatever |
21:15:42 | Araq | but MAX_INT is stupid limit most of the time |
21:15:45 | ddl_smurf | just saying if you're putting a limit, i'm hoping for a reason, plenty are good |
21:15:48 | Araq | a particularly stupid limit |
21:16:00 | ddl_smurf | oh definitely, stay well << max_int/2 |
21:17:08 | Araq | plus end users think in powers of ten, not in powers of two. |
21:17:36 | renesac | depends on the problem |
21:17:37 | renesac | :P |
21:17:38 | Araq | so a limit of 100 characters per message only sounds stupid to programmers |
21:17:41 | ddl_smurf | if i was a server receiving a packet size i'd have to allocate, i'd put a well named constant MAX_PACKET_SIZE or something that has a reason to be there for security, but also thus documents it |
21:18:23 | ddl_smurf | yeah but only programmers wonder whether the limit is necessary too |
21:18:40 | ddl_smurf | can cater to every goat outside and its numerical preconceptions |
21:20:16 | ddl_smurf | anyway i apologise for the interruption, its jsut, too often ive hit a stupid limit by some coder for no reason (or more accurately for lazyness), i want less arbirtrary limits out there, not more =/ |
21:20:42 | ddl_smurf | url's have a max safe length for example |
21:20:52 | ddl_smurf | path names too |
21:20:58 | ddl_smurf | (in old windows) |
21:21:27 | Araq | I never experienced this, most of the time it's programmers believing in their process should be able to use all RAM causing all sorts of problems for the server |
21:21:50 | ddl_smurf | of course they should |
21:22:09 | ddl_smurf | it's up to the OS to limit that shit, not each individual programmer picking some fixed constant for all |
21:22:16 | * | vendethiel quit (Ping timeout: 240 seconds) |
21:22:16 | vikaton | oh my jesus |
21:22:21 | reactormonk | Araq, where should I start digging for https://github.com/Araq/Nim/issues/2634 ? |
21:23:00 | Araq | ddl_smurf: aye right that smart OS that picks a process at random and kills it |
21:23:41 | ddl_smurf | yeah you set the limit with rlimit/ulimit, and you program with if (!malloc()) bite_smaller(); |
21:24:51 | ddl_smurf | (this is assuming you have no other way to control ram usage, which often you can by simply throttling stdin or the like) |
21:26:17 | Araq | reactormonk: dunno, sounds bad |
21:26:44 | Araq | reactormonk: but msgs.nim uses the very same mechanism and it works |
21:27:53 | ddl_smurf | i've never understood why people want free ram - free ram is a sign of poorly using your resources |
21:28:06 | renesac | ddl_smurf: cache |
21:28:19 | * | vendethiel joined #nim |
21:28:27 | ddl_smurf | renesac: as in geo ? |
21:28:44 | renesac | no, as file system cache, and other things the kernel can do with the free ram |
21:28:55 | ddl_smurf | if the kernel is using its not free |
21:29:08 | renesac | ok, then I don't remember seeing free ram |
21:29:13 | Araq | ddl_smurf: you don't get provable bounded memory usage out of this approach :P |
21:30:05 | ddl_smurf | most OSs these days do very well on that account, i'm just saying optimising for ram is not a simple min() |
21:31:03 | ddl_smurf | Araq: agreed - this practice is invalid in the pursuit of phd's or in aeronotics/medical |
21:32:19 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
21:33:28 | ddl_smurf | (actually no - this approach is not incompatible, you can still fit in the smallest workable space, and in any case, anything that needs reliability should have "replayability-ish-ov-ness", i mean the OS killing your process is definitely a feature and should be considered part of your flow) |
21:34:09 | Araq | there might not even be an OS |
21:34:10 | * | yglukhov_ quit (Quit: Be back later ...) |
21:34:38 | ddl_smurf | in that case you've just moved the problem into malloc's impl. |
21:40:12 | renesac | if you get a provable bounded memory of 10TB for a desktop application that don't helps |
21:40:42 | renesac | arbitrary limits in arbitrary places using magic numbers don't really solve this problem |
21:41:13 | renesac | if you need a provable memory bound, then you know what it is and have to be able to engineer your whole application around it |
21:41:18 | ddl_smurf | they do make the proving *much* easier |
21:42:06 | ddl_smurf | they also make the code much simpler - which i think is why there are so many of em |
21:42:08 | renesac | ddl_smurf: yeah, but what you want isn't to prove a 10TB bound, but to make your program provably fit in a X bytes bound |
21:42:28 | * | elbow_json quit (Ping timeout: 256 seconds) |
21:42:41 | ddl_smurf | but with the fixed limit you can just pick x - overhead |
21:42:58 | renesac | yeah, but you shouldn't use magic numbers in the middle of the code at least |
21:43:16 | renesac | you probably want something you can tweak |
21:43:26 | ddl_smurf | at the least a define |
21:43:31 | renesac | except for fixed things, like some lenght that needs to be expressed in a uint8 |
21:43:33 | ddl_smurf | but there are use cases |
21:43:47 | ddl_smurf | even then you can document those things |
21:44:34 | ddl_smurf | #define MAX_PACKET_SIZE (min(EXPECTED_MEMORY, sizeof(uint8), 10000)) |
21:44:57 | renesac | yeah, that is sane |
21:45:00 | Araq | oh so now it's about "magic numbers". well *shrug* |
21:45:52 | ddl_smurf | well i think the naming of it also kind of removes the arbitrary of it, like the example of, you can inject a lot of explanation into the limit |
21:46:17 | Araq | that's just DRY for integer literals |
21:46:30 | Araq | nothing to debate here |
21:47:00 | ddl_smurf | there's the dry + the explaining |
21:48:03 | renesac | and you probably want 1 << sizeof(uint8) * 8 <-- I want a nice name for that |
21:48:09 | renesac | in the code above |
21:48:20 | * | elbow_json joined #nim |
21:48:55 | ddl_smurf | i don't think the code above makes any sense, it's really metaphore-c |
21:49:13 | renesac | I know, but it is a common error, and a common thing to want |
21:49:18 | * | vendethiel quit (Ping timeout: 246 seconds) |
21:49:32 | ddl_smurf | what's the priority between << and * ? or alternatively what's the value of your expr ? |
21:49:43 | Araq | 'bitsizeof' ? |
21:49:53 | renesac | ops, yeah, the priority is wront |
21:49:54 | * | Trustable_2 quit (Remote host closed the connection) |
21:49:56 | renesac | *wrong |
21:49:59 | ddl_smurf | no its weirder |
21:50:10 | renesac | bitsizeof would return 8 |
21:50:20 | renesac | the thing above would return 256 |
21:50:24 | ddl_smurf | i don't think that makes sense |
21:50:39 | ddl_smurf | you want max_uint8 ? |
21:50:41 | renesac | if I wrote it correctly |
21:50:53 | renesac | hum, yeah |
21:50:56 | renesac | right |
21:51:33 | ddl_smurf | in nimrod theres a succ and prec no, if theres a last that would be it |
21:51:47 | renesac | ok, that can be done with T.high() + 1 |
21:51:56 | ddl_smurf | i think you want (1<<(sizeof(T) + 1)) -1 |
21:52:04 | ddl_smurf | for 255 |
21:52:15 | renesac | sizeof gives the size in bytes |
21:52:24 | ddl_smurf | or right gotcha |
21:52:45 | Araq | template bitsizeof(x) = sizeof(x)*8 |
21:54:24 | ddl_smurf | so many off-by-ones - time for me to stop coding |
21:55:07 | renesac | there are two hard things in computer science: cache invalidation, naming things, and off-by-one errors. |
21:55:24 | ddl_smurf | stealing it =) |
21:55:48 | renesac | this specific quote don't quite have attribution AFAIK |
21:56:20 | ddl_smurf | i usually disclaim when not mine, but i'll be damned if in the age of google i'll waste space with author names |
21:56:24 | renesac | the original one was from Phil Karlton, but didn't include off-by-one errors |
21:56:55 | ddl_smurf | (optimising my wetware ram is very different) |
21:58:50 | * | grncdr quit (Quit: Leaving.) |
21:59:08 | ddl_smurf | http://en.wikipedia.org/wiki/Octet_(computing) "The term is often used when the term byte might be ambiguous, as historically there was no standard definition for the size of the byte." |
21:59:20 | ddl_smurf | i dont want to code in a world where thats a variable =( |
21:59:56 | renesac | that is the reason for C original integer types don't specifying width |
22:00:07 | ddl_smurf | yeah ok but |
22:00:08 | ddl_smurf | nope |
22:00:14 | renesac | I know |
22:00:49 | renesac | luckly we aren't in that world anymore |
22:01:00 | Araq | really? isn't that what you're arguing for though? no arbitrary sizes, make the code generic to deal with anything? ;-) |
22:01:02 | ddl_smurf | i just found out about it |
22:01:13 | ddl_smurf | its like finding out "milli-" may be a variable |
22:01:22 | ddl_smurf | like million/billion fiasco |
22:01:54 | renesac | kilo can mean 1024 or 1000 depending on the context |
22:01:55 | renesac | :P |
22:02:13 | ddl_smurf | Araq: it absolutely is - my trouble is with the mountains of code in my past that rely on that and my expectations for the byte to change again - its human |
22:02:30 | renesac | (nobody says kibibyte or whatever) |
22:03:05 | ddl_smurf | yeah, the guy who made the k=1024 thing up was really helpful to the world - thanks dude, come see me please i have a gift |
22:04:31 | Araq | that's a typical programmer though. 1000?! what's this? a magic number?! that's not even a power of two ... |
22:04:44 | Araq | .. let's fix it ... |
22:04:50 | ddl_smurf | no its not |
22:04:54 | ddl_smurf | its lazy |
22:05:17 | ddl_smurf | its fuck this dividing by any number generalisation, i'll bit shift and that's what ill print |
22:05:34 | ddl_smurf | you know it is |
22:07:03 | ddl_smurf | or someone drawing his square of flip-flops thinking itd be cool if width and height were the same size for his drawing to be symmetric, and it was annoying to do the .024 everywhere so "I dub thee 1024, 1k" |
22:07:20 | vikaton | I was benchmarking some frameworks of various langs |
22:07:25 | vikaton | and h00ly c0w |
22:08:49 | ddl_smurf | that's Hindu right ? |
22:16:10 | def- | vikaton: so, what's so special? |
22:35:00 | vikaton | wel for starters |
22:35:13 | * | elbow_json quit (Remote host closed the connection) |
22:35:19 | vikaton | I was benchmarking hello world with Rust and Crystal |
22:35:27 | vikaton | and results were surprising |
22:35:47 | nimnoob123 | ah that reminds me, need to dual boot linux on my win8 laptop |
22:36:01 | nimnoob123 | wanted to test crystal |
22:36:24 | vikaton | here it is vs Rust https://gist.github.com/Vikaton/3102c16ee14ef3d76244 |
22:36:37 | nimnoob123 | vikaton: how are you liking crystal? |
22:36:39 | fowl | as long as you beat rust i'm happy :p |
22:36:57 | vikaton | nimnoob123: I like it alot! |
22:37:11 | nimnoob123 | yeah it looks pretty good |
22:37:23 | vikaton | results were very impressive |
22:38:00 | nimnoob123 | I wanted to like rust, i hate the syntax :/ |
22:38:34 | dom96 | vikaton: what about Nim? :) |
22:38:37 | ddl_smurf | impressive, does rust do anything "more" ? |
22:38:57 | vikaton | dom96: not there yet :P |
22:39:07 | vikaton | ddl_smurf: what do u mean? |
22:39:39 | ddl_smurf | i am familiar with neither, is it like parsing a potential body, spliting headers, unescaping stuff ? |
22:40:07 | vikaton | I just created a new project with cargo, got Iron as a dependency, then put the iron hello world example and ran it with optimizations |
22:40:17 | dom96 | vikaton: do please keep in mind that Jester hasn't been optimised at all yet. |
22:40:23 | dom96 | (once you do get around to it) |
22:40:40 | vikaton | o |
22:40:44 | vikaton | will do |
22:50:45 | Matthias247 | I would say these results are nearly neglible. Especially if you take into account that Crystal seems to use nonblocking IO and lightweight processes and Rust doesnt |
22:51:48 | * | solidsnack joined #nim |
22:53:38 | cmk_zzz | Is there any built in way to extend a sequenece in nim? something like this: @[1, 2, 3] + @[4, 5, 6] or perhaps @[1,2,3].extend(@[4,5,6]) |
22:56:18 | FDGFGFGDFD | http://nim-lang.org/sequtils.html#concat,varargs[seq[T]] |
22:56:38 | * | gyeates joined #nim |
22:56:42 | FDGFGFGDFD | misread sorry lol |
22:57:29 | gyeates | how do you add a custom index accessing procedure on a type (e.g. customType[3]) |
22:58:18 | cmk_zzz | FDGFGFGDFD: anyway, sequtils is something I can work with:) |
23:01:11 | Araq | gyeates: overload `[]` |
23:01:13 | FDGFGFGDFD | proc `[]`(x :customType, i: int) |
23:01:15 | FDGFGFGDFD | probably |
23:02:01 | * | rektide_ is now known as rektide |
23:02:32 | * | Matthias247 quit (Read error: Connection reset by peer) |
23:04:37 | * | solidsnack quit (Ping timeout: 264 seconds) |
23:05:15 | * | BlaXpirit quit (Quit: Quit Konversation) |
23:08:53 | Araq | yup |
23:12:03 | * | vendethiel joined #nim |
23:13:38 | * | gsingh93 joined #nim |
23:23:02 | * | solidsnack joined #nim |
23:25:58 | * | wan quit (Quit: WeeChat 1.1.1) |
23:28:31 | * | banister joined #nim |
23:30:04 | gyeates | thanks - also is there a way to create an array of `n` size & type `T` and fill it with `nil` at init |
23:30:30 | Araq | it's filled for you with 'nil' already |
23:30:50 | Araq | var s = newSeq[string](60) # 60 nil strings |
23:34:52 | * | vendethiel quit (Ping timeout: 272 seconds) |
23:35:23 | reactormonk | Araq, not exactly what I wanted to hear :-/ No idea what I'm doing differently. Would you mess around until it works or try to fix the compiler? Sounds like a nasty bug that might bite someone sometime |
23:38:48 | Araq | reactormonk: move the callback var to msgs.nim for a start. and of course you're right, we need to fix it. |
23:47:30 | * | solidsnack quit (Ping timeout: 252 seconds) |
23:47:32 | * | nimnoob123 quit (Quit: Page closed) |
23:57:58 | * | transfuturist quit (Quit: leaving) |