00:05:40 | dom96 | hi Automatic |
00:06:09 | Varriount | Araq: How would you feel about telling the MinGW compiler on windows to link to a versioned copy of msvcrt.dll, instead of the unversioned system copy? |
00:07:17 | Araq | hi Automatic welcome |
00:07:36 | Araq | Varriount: things like these tend to cause more trouble than they solve |
00:07:47 | Araq | let's stick to the default |
00:08:54 | Varriount | Araq: But http://blogs.msdn.com/b/oldnewthing/archive/2014/04/11/10516280.aspx |
00:11:45 | Automatic | hello |
00:16:52 | Automatic | possible for nim to automatically write header function declarations from function defs? |
00:19:08 | Varriount | Automatic: You mean for interfacing with C code? |
00:21:38 | Araq | Automatic: yeah --header command line option does the job iirc |
00:21:57 | Araq | you need to .exportc the stuff you want to see in the header file |
00:22:26 | Automatic | excellent |
00:23:17 | Araq | Varriount: let's discuss this tomorrow. |
00:23:20 | Araq | good night |
00:23:56 | Varriount | Good night |
00:25:42 | dom96 | Ooh, shiny: http://dc.ubm-us.com/i/245989 |
00:29:43 | Automatic | what type holds the biggest integer? |
00:30:11 | flaviu | Automatic: int64 |
00:30:42 | dom96 | You can also use the BiggestInt alias. |
00:30:49 | flaviu | int is the size of a pointer, so on 64 bit systems it is 64 bits, and on 32 bit systems it is 32 bits |
00:32:55 | flaviu | Automatic: Make sure you're looking at http://build.nimrod-lang.org/docs/documentation.html |
00:32:55 | flaviu | The main website is a year out of date |
00:35:08 | flaviu | dom96: lib.html says "If you can't find here some functionality you are looking for you could try using the 3rd party package manager Babel and its list of packages." |
00:36:36 | dom96 | ok, let me rewrite that a bit |
00:36:38 | EXetoC | yes as old as the last release |
00:40:19 | Automatic | with proc name*(arb: int) = is there a technique to also allow proc name^(a:cint) = or even proc name(a:cint) => |
00:40:34 | NimBot | Araq/Nimrod devel e333b8b Dominik Picheta [+0 ±1 -0]: Rewrote sentence about Babel in lib.txt. |
00:40:43 | flaviu | http://gradha.github.io/genieos/ |
00:41:41 | * | DAddYE quit (Remote host closed the connection) |
00:42:53 | dom96 | flaviu: gradha is in a league of his own hah |
00:43:24 | * | DAddYE_ joined #nimrod |
00:44:00 | dom96 | Automatic: You mean with macros? |
00:44:13 | Automatic | yep |
00:44:38 | dom96 | Yeah, but you won't be able to use the 'proc' keyword |
00:46:10 | flaviu | Automatic: you can use 훒roc though |
00:46:24 | flaviu | or even better, ᴘroc |
00:47:17 | Automatic | to do ᴘroc name^(a:cint) = or even ᴘroc name(a:cint) => how to do that? |
00:47:53 | flaviu | Ask dom96, I'm just pointing out that nimrod supports unicode charecters |
00:49:56 | dom96 | Actually, perhaps it would be possible to get proc name^(a:cint) working |
00:50:15 | dom96 | nah. |
00:51:11 | Automatic | what about def name(a:cint) = becoming proc name*(arb: int) = ?? |
00:53:23 | dom96 | let me try it |
00:59:03 | dom96 | Unfortunately I don't think so. |
00:59:08 | flaviu | You can come close |
00:59:40 | flaviu | syntax like def name, (a: int, b: string): ??? should be possible |
01:02:58 | Skrylar | i think i'm going to port over a soundex proc |
01:03:57 | dom96 | The AST I get for this is odd: https://gist.github.com/dom96/fe7c8abbe5a0d6a537fe |
01:04:17 | dom96 | it has the 'a' arg but not the 'b' |
01:04:22 | dom96 | Anyway |
01:04:28 | dom96 | Good night |
01:04:41 | Skrylar | good night dom96 |
01:06:23 | Automatic | night thank you for your attempt |
01:10:57 | * | DAddYE_ quit (Remote host closed the connection) |
01:15:33 | * | brson quit (Ping timeout: 252 seconds) |
01:15:34 | flaviu | Automatic: I'm not sure about your syntax, but I think you can write C in nimrod |
01:15:49 | * | brson joined #nimrod |
01:15:57 | flaviu | https://gist.github.com/10513308 compiles, so its a start |
01:22:46 | Automatic | flaviu, appreciate it but I think it would be easier just to replace ^ to * with custom script or just just include instead of import so no need to worry about * at all :D |
01:23:04 | flaviu | Yes, but this is fun |
01:25:19 | Automatic | proc name(a:cint) => this is my fav for module out but not easy to do |
01:25:46 | EXetoC | what's this for? |
01:25:58 | * | Demos joined #nimrod |
01:26:12 | Automatic | proc name*(a:cint) module available to others I think |
01:27:12 | flaviu | Is there any way to take a subsequence? |
01:28:13 | Demos | ugh I was thinking today about how when I look at other people's code I tend to judge it by just "does it look like a tornado came through here". But my own code I obsess over. wierd |
01:28:15 | fowl | once you conquer your care for syntax you can conquer any programming languages, the downside is you find different things to complain about with them |
01:30:02 | Demos | please do not try and change the syntax. People do that in C and it ends badly |
01:30:35 | flaviu | Demos: void abc(int a, string b){ echo "test", echo "test1", } compiles in nimrod |
01:30:38 | Automatic | when I see * I always think it's a multiplication first, then pointer, then module availability third. |
01:30:54 | Demos | well that will change quick |
01:31:11 | Demos | everyone else thinks module export, because that is what it does |
01:36:04 | Demos | nimrod's syntax is way more sane that most any other language |
01:36:19 | EXetoC | it's pointless, but fun to see what you can do with macros |
01:36:49 | Automatic | macro wasn't powerful enough for the syntax change above though? |
01:37:19 | Demos | Automatic: I think you could do it (maybe with a pragma) but do not expect to be able to modify nimrod's syntax |
01:37:37 | Varriount | Automatic: You *can* make the syntax change above, using macros, however it wouldn't be easy. |
01:37:46 | flaviu | Automatic: You can also use a custom parser |
01:37:54 | Varriount | A better, more flexible option would probably be writing your own pars- |
01:38:15 | Demos | and it would be evil and eventually someone will look at your code after a long night and find out where you live.... |
01:39:01 | Skrylar | good job skrylar, convert text to uppercase then check for lowercase |
01:39:16 | flaviu | Automatic: http://nimrod-lang.org/filters.html#replace-filter |
01:41:18 | Demos | but note that you are screwed if someone decides to define a `^` proc |
01:41:33 | Demos | it will even be a really odd bug if you also have a `*` proc |
01:43:04 | flaviu | Automatic: If you're feeling adventurous, dig into the compiler. The file is compiler/lexer.nim |
01:46:53 | Automatic | falviu: that will work :D |
01:46:57 | * | q66 quit (Quit: Leaving) |
01:48:27 | * | EXetoC quit (Quit: WeeChat 0.4.3) |
01:49:11 | Skrylar | sweet, soundex routine is done |
01:53:00 | * | psquid joined #nimrod |
01:54:04 | * | psquid_ quit (Ping timeout: 252 seconds) |
01:54:55 | * | BitPuffin joined #nimrod |
01:56:30 | BitPuffin | how come not have a way to get the number of threads/cores on a system? |
01:57:42 | BitPuffin | well |
01:57:54 | BitPuffin | guess there is the default answer of because nobody's added it yet |
01:59:20 | Skrylar | most OS' aren't BeOS, and there is no convenient "GetNumberOfCPUs" call :( |
02:00:04 | Skrylar | but yeah, probably just nobody has made a cross platform module for it |
02:00:11 | Skrylar | I guess I could add it to skylights |
02:11:14 | BitPuffin | yeah it's just to wrap it really |
02:11:24 | BitPuffin | windotshas some kind of getinfo thing that includes cores |
02:12:00 | BitPuffin | Skrylar: I'd aim for getting it in to the threads module |
02:13:26 | * | Gr33n3gg joined #nimrod |
02:14:34 | flaviu | I got the C macro functioning |
02:14:59 | flaviu | https://gist.github.com/flaviut/10515205 Executes and runs perfectly |
02:16:16 | * | Gr33n3gg left #nimrod (#nimrod) |
02:21:33 | Automatic | flaviu: I got an error: macro.nim(4, 17) Error: type mismatch: got (PNimrodNode, int literal(0)) |
02:22:15 | flaviu | Have you changed it at all? Its really fragile atm |
02:24:17 | Automatic | flaviu: no changes raw file from site |
02:25:06 | flaviu | Automatic: Are you using nimrod from git or is it from the site? |
02:25:27 | Automatic | I think it's git |
02:25:31 | flaviu | I just downloaded it, it works perfectly |
02:26:10 | Automatic | probably need to update mine |
02:26:28 | flaviu | Automatic: Can you do `nimrod --version`? The date should be recent. |
02:27:08 | Automatic | Version 0.9.3 (2014-04-10) |
02:28:13 | flaviu | I'm not sure whats going on. Try downloading https://gist.githubusercontent.com/flaviut/10515205/raw/03c48cc16a51f3d0739d608ebebef6fb6ad83bb5/test.nim |
02:29:45 | Automatic | that one worked |
02:29:59 | flaviu | Seems that something got lost in the copy-paste then |
02:31:56 | Automatic | yep, but void abc(int a, string b, string c) won't work |
02:33:10 | Demos | why the hell are we writing c in nimrod? |
02:33:14 | flaviu | Works for me |
02:34:03 | flaviu | Demos: For fun. I'm implementing char* next! |
02:34:13 | Demos | grrrr |
02:39:08 | Automatic | flaviu: sorry it does work |
02:41:29 | Automatic | flaviu: is this possible or only the c version? def name(a:cint) = or proc name^(a:cint) becoming proc name*(a: cint) = |
02:42:18 | flaviu | Automatic: Give me a few seconds to see |
02:44:46 | flaviu | Automatic: `def name(a: int) =>` is possible |
02:45:21 | flaviu | No, it isn't |
02:45:33 | flaviu | but `def name(a: int): ` is possible |
02:47:20 | flaviu | Actually, the best I can do is `def name(a int, b int):` |
02:47:58 | flaviu | I can't use the colon type annotation because they get swallowed somewhere |
02:48:06 | flaviu | But this is a really bad idea |
02:49:54 | Automatic | flaviu: I didn't think you could get as far as you did |
02:52:41 | flaviu | Thanks, it was fun |
02:53:01 | flaviu | I'm going to enter my C to https://codegolf.stackexchange.com/questions/24623/write-program-in-your-favorite-language-in-another-language |
03:21:25 | * | flaviu quit (Remote host closed the connection) |
03:29:18 | Skrylar | humm |
03:29:40 | Skrylar | I realize there is no point in trying to compete with PDFs, but I was just wondering how well a modernized version of DjVu would do |
03:29:53 | Skrylar | Not sure what to use for the monochrome compressor though, since JB is still patented |
03:30:19 | * | Jesin quit (Quit: Leaving) |
03:52:41 | * | brson quit (Ping timeout: 258 seconds) |
04:05:27 | Automatic | any good examples of a nimrod header conversion from a complex c++ lib which uses more involved c++ vars? |
04:27:51 | * | Automatic quit (Remote host closed the connection) |
04:38:03 | * | eximiuswastaken quit (Ping timeout: 250 seconds) |
04:39:04 | * | eximiuswastaken joined #nimrod |
05:07:18 | * | BitPuffin quit (Ping timeout: 240 seconds) |
05:13:56 | * | DAddYE joined #nimrod |
05:25:48 | * | DAddYE quit (Ping timeout: 276 seconds) |
05:29:14 | * | DAddYE joined #nimrod |
05:49:51 | * | foodoo joined #nimrod |
06:12:00 | * | Continual joined #nimrod |
06:16:46 | Continual | where are the instructions to compile the csources from the .nim sources? |
06:27:22 | Skrylar | hm? |
06:27:40 | Skrylar | i thought those were on the github.. there's supposed to be a makefile in there |
06:30:44 | * | [1]Endy joined #nimrod |
06:41:53 | * | Continual quit (Ping timeout: 252 seconds) |
06:42:02 | * | DAddYE quit (Remote host closed the connection) |
06:42:38 | * | DAddYE joined #nimrod |
06:43:45 | * | [2]Endy joined #nimrod |
06:46:20 | * | [1]Endy quit (Ping timeout: 258 seconds) |
06:46:54 | * | DAddYE quit (Ping timeout: 240 seconds) |
06:52:20 | * | DAddYE joined #nimrod |
06:57:27 | * | [1]Endy joined #nimrod |
07:01:17 | * | [2]Endy quit (Ping timeout: 258 seconds) |
07:14:41 | * | [1]Endy quit (Ping timeout: 245 seconds) |
07:18:44 | * | Demos quit (Read error: Connection reset by peer) |
07:36:09 | * | foodoo quit (Ping timeout: 250 seconds) |
07:37:46 | * | foodoo joined #nimrod |
08:11:15 | * | io2 joined #nimrod |
09:21:16 | * | io2 quit (Quit: ...take irc away, what are you? genius, billionaire, playboy, philanthropist) |
09:34:53 | * | foodoo quit (Ping timeout: 250 seconds) |
09:36:53 | * | foodoo joined #nimrod |
09:40:45 | * | DAddYE quit (Remote host closed the connection) |
09:52:39 | * | vendethiel quit (Read error: Connection reset by peer) |
09:59:44 | * | rta quit (Ping timeout: 246 seconds) |
10:13:31 | * | foodoo quit (Remote host closed the connection) |
10:20:01 | * | [1]Endy joined #nimrod |
10:22:12 | * | gXen joined #nimrod |
10:47:05 | * | vendethiel joined #nimrod |
10:47:27 | * | [1]Endy quit (Ping timeout: 258 seconds) |
11:05:21 | * | darkf_ joined #nimrod |
11:08:32 | * | darkf quit (Ping timeout: 258 seconds) |
11:15:28 | * | darkf_ is now known as darkf |
11:15:28 | Araq | omg the "C in Nimrod" gist is the most surprising code that I've ever seen |
11:22:22 | * | q66 joined #nimrod |
11:23:34 | dom96 | hi |
11:27:06 | dom96 | Araq: https://gist.github.com/dom96/fe7c8abbe5a0d6a537fe how come the 'b' arg is lost in the AST? |
11:28:58 | Araq | good question |
11:29:05 | dom96 | ooh nice. I wonder who this is: http://www.eoleary.me/ |
11:40:37 | Araq | bbl |
11:42:32 | * | q66 quit (Ping timeout: 252 seconds) |
11:44:35 | * | q66 joined #nimrod |
11:44:35 | * | q66 quit (Changing host) |
11:44:35 | * | q66 joined #nimrod |
11:49:25 | * | gXen quit () |
11:52:33 | * | zahary joined #nimrod |
11:53:36 | * | foodoo joined #nimrod |
12:11:29 | * | oxful_ joined #nimrod |
12:11:58 | * | oxful quit (Read error: Operation timed out) |
12:19:50 | * | psquid_ joined #nimrod |
12:22:08 | * | psquid quit (Ping timeout: 252 seconds) |
12:29:05 | * | Matthias247 joined #nimrod |
13:21:45 | * | darkf quit (Quit: Leaving) |
13:24:50 | * | vendethiel quit (Remote host closed the connection) |
13:26:47 | * | vendethiel joined #nimrod |
13:27:38 | foodoo | a union type in C corresponds to a ̀type |
13:27:48 | foodoo | ` definition that is an enum? |
13:31:16 | * | EXetoC joined #nimrod |
13:32:52 | Araq | foodoo: no. a union is a union, an 'enum' is often nowadays a type safe union, but in nimrod it's a traditional abstraction over an integer |
13:33:02 | * | xenagi joined #nimrod |
13:39:15 | foodoo | I want to create a Nimrod module from a C header. This C header has an union of two structs (and c2nim doesn't handle that). How can I approach this? Paste: http://pastebin.com/2xJ3BRkf |
13:39:46 | Araq | are you sure you're using the latest c2nim version from github? c2nim now supports unions |
13:40:29 | Araq | btw we have a cario wrapper in the stdlib or in babel |
13:40:46 | EXetoC | cairo? |
13:41:13 | foodoo | EXetoC: The font rendering library used by Gtk |
13:41:41 | EXetoC | I know |
13:41:51 | foodoo | Araq: oh, right. It's in the standard library |
13:47:09 | Araq | and soon in Babel instead :-) |
13:47:42 | foodoo | It's springtime, so you clean up the stdlib :-) |
13:53:31 | foodoo | Araq: I just compiled c2nim from the newest git sources. I still get the same syntax error with the following snippet: http://pastebin.com/2xJ3BRkf |
13:53:59 | foodoo | It says: tmp/snip.h(2, 12) Error: identifier expected, but found '{' |
13:56:44 | Araq | ugh. oh well you can always pull out these structs into an outer scope |
13:56:53 | Araq | report it please |
13:57:19 | foodoo | okay |
14:02:29 | * | io2 joined #nimrod |
14:18:14 | * | Jesin joined #nimrod |
14:19:04 | Araq | dom96: 02377f08"5ET / HTTP/1.1" what should it be? |
14:19:14 | Araq | "GET", right? |
14:19:15 | dom96 | yes |
14:19:18 | Araq | and always? |
14:19:23 | Araq | never an empty string? |
14:20:37 | dom96 | It could be empty if the socket has been disconnected. |
14:20:39 | * | Zuchto_ quit (Quit: --) |
14:20:54 | dom96 | There should be a check to see if it's empty. |
14:22:35 | * | q66 quit (Ping timeout: 252 seconds) |
14:24:25 | * | q66 joined #nimrod |
14:25:28 | Araq | which line generates this output? |
14:27:37 | dom96 | Come on, just search for 'echo' |
14:27:42 | dom96 | Line 137. |
14:29:26 | Araq | hu? |
14:29:35 | Araq | this means the reqMethod is not 'GET' |
14:31:57 | dom96 | yeah |
14:32:04 | dom96 | it's supposed to be 'get' |
14:32:21 | dom96 | (after normalisation) |
14:32:53 | dom96 | When reqMethod is "" what does the echo after that show? |
14:33:03 | dom96 | because if it's also "" then something strange is going on |
14:33:10 | dom96 | since I check for "" in line 99 |
14:36:52 | Araq | does 'repr' still produce a newline? |
14:38:29 | Araq | well gah |
14:38:44 | Araq | now it only fails in asyncnet.send with a nil socket |
14:43:39 | * | Varriount quit (Read error: Connection reset by peer) |
14:46:55 | * | [1]Endy joined #nimrod |
14:48:14 | * | Zuchto joined #nimrod |
14:52:03 | dom96 | hello Zuchto |
14:55:03 | * | Matthias247 quit (Read error: Connection reset by peer) |
14:59:04 | * | flaviu joined #nimrod |
15:05:49 | * | BitPuffin joined #nimrod |
15:07:04 | * | nequitans joined #nimrod |
15:08:24 | nequitans | hi all, i was wondering if there is an idiomatic way to read a file of, say int64s in binary to a GCed seq[int64] in Nimrod (assuming i know the size of the sequence) |
15:09:37 | flaviu | nequitans: proc readBytes(f: TFile; a: var openArray[int8]; start, len: int): int |
15:11:36 | nequitans | hi flaviu, thanks, i assume i cast a seq[int64] to a seq[int8] and multiply the byte length accordingly? |
15:14:07 | Araq | er ... you can try that ... |
15:14:19 | Araq | I would use readBuffer instead though |
15:14:33 | nequitans | so I was using readBuffer |
15:14:40 | nequitans | and newSeq |
15:14:44 | Araq | yup |
15:14:54 | Araq | you need to use addr(s[0]) though |
15:14:58 | Araq | and NOT addr(s) |
15:15:01 | nequitans | aah |
15:15:10 | Araq | as a seq has a header that you need to skip |
15:15:30 | nequitans | i was thinking it did b/c the seq contains length info as well? |
15:15:45 | Araq | length + capacity, yeah |
15:16:34 | flaviu | Araq: I don't understand how the compiler deals with submodules. Apparently a submodule.babel file makes a submodule so that the files don |
15:16:50 | flaviu | 't confilict, but I can't figure out where the compiler looks for that |
15:17:27 | Araq | it simply checks whether a dir has a .babel file and if so uses that as the module's package name |
15:18:14 | Araq | quite like python's __init__.py iirc |
15:19:37 | nequitans | ic -- so s[0] returns the first data element in the data array. Is s[1...] handled specially then? |
15:20:06 | * | foodoo quit (Remote host closed the connection) |
15:20:09 | Araq | no, why would it? |
15:20:56 | Araq | flaviu: options.getPackageName does most of the work |
15:21:21 | flaviu | Yes, I found that, but I can't get the submodule names from the AST |
15:21:57 | nequitans | I guess I'm trying to understand what addr(s) points to vs. addr(s[0]) |
15:22:02 | Araq | an AST has no owner, only types and symbols do |
15:22:41 | Araq | nequitans: addr(s) --> &struct{ long size, cap; T[] data }; |
15:23:00 | Araq | nequitans: addr(s[0]) --> struct{ long size, cap; &T[] data }; |
15:23:18 | Araq | if you can follow my pseudo C ... |
15:23:48 | nequitans | ohh |
15:23:49 | nequitans | i see |
15:24:05 | nequitans | so the [] on the seq simply say jump into T |
15:24:40 | Araq | flaviu: n.sym.owner.owner might be the package if n.sym.owner is a module ... |
15:24:41 | nequitans | so i could day addr(s[4]) and that's OK |
15:24:49 | Araq | yeah |
15:24:56 | nequitans | thx! |
15:28:15 | flaviu | Araq: Thanks, that seems to be correct. Turns out my issue is somewhere else though |
15:59:33 | reactormonk | does the tester deal with if isMain tests? |
16:01:47 | EXetoC | yes |
16:01:53 | reactormonk | ok |
16:02:21 | EXetoC | well, I'm pretty sure I've seen the lib modules been executed |
16:14:05 | * | [1]Endy quit (Ping timeout: 240 seconds) |
16:31:48 | * | nequitans quit (Ping timeout: 240 seconds) |
16:36:23 | * | xenagi quit (Quit: Leaving) |
17:03:41 | flaviu | reactormonk: Yeah, sorry. Unfortunately I'm finding some corner cases, should I temporary close it until I get them worked out? |
17:04:16 | * | [1]Endy joined #nimrod |
17:14:55 | Araq | dom96: some results: the string is already corrupted when it leaves 'recvLine' |
17:15:20 | Araq | send gets a nil socket |
17:15:37 | Araq | but it's not nil in the request that processClient sets |
17:16:01 | EXetoC | working on the last release feature? |
17:17:41 | dom96 | Araq: ok, and what does that tell you? |
17:18:25 | Araq | EXetoC: indeed |
17:18:43 | Araq | dom96: I'm suprised it's already corrupted in recvLine |
17:19:07 | Araq | also your recv that returns 1 char long strings is horrible for performance |
17:19:36 | dom96 | Araq: I am aware. Stop worrying about performance please. |
17:20:07 | Araq | no, I'm glad there are so many easy things left to do to improve performance :P |
17:20:23 | Araq | we'll beat Go easily :P |
17:23:07 | flaviu | Araq: I realized that C is far superior to nimrod, but I didn't feel like figuring out how to compile it. |
17:23:14 | flaviu | So I wrote a macro to allow me to write a modified subset of C in nimrod: https://gist.github.com/flaviut/10515205/c6a84964da32847f4bd8ab9d4f52fbe1f6241e57 |
17:23:28 | fowl | pkt_tools is vulnerable to heartbleed, should i leave it this way for 2 years? |
17:23:34 | flaviu | :P |
17:24:01 | Araq | flaviu: I already praised your work |
17:24:29 | fowl | flaviu, now do while,if, etc |
17:24:38 | Araq | now I finally have an answer to the question "what is the most surpring nimrod code that you have never anticipated?" |
17:25:09 | flaviu | I ran into issues with macro generating templates, so I can't easily define new function return types |
17:25:34 | Araq | reported the issue? |
17:26:18 | flaviu | Ok, I'll do that |
17:41:21 | Araq | er lol |
17:41:56 | Araq | dom96: you have a heartbeat like bug in asyncdispatch.recv |
17:42:24 | dom96 | Oh really? |
17:42:27 | Araq | copyMem(addr data[0], addr dataBuf.buf[0], realSize) |
17:42:35 | dom96 | NimBot told me to do it. |
17:42:55 | * | dom96 shreds super top secret letters from the NSA |
17:43:04 | dom96 | I mean... this was a pureee accident. |
17:43:33 | Araq | bbl |
17:44:09 | fowl | copymem is fine, the problem is not checking the data size before you do it |
17:45:50 | dom96 | Araq: As you can see by my comments I had trouble with Win APIs silly bytesReceived value. |
17:46:44 | dom96 | Assuming that I can read all the data that I requested if WSARecv returns immediately sounds reasonable to me though. |
17:47:33 | dom96 | bbl |
17:47:51 | flaviu | dom96: that blog you found is by OrionPK |
17:49:04 | flaviu | http://build.nimrod-lang.org/irclogs/09-04-2014.html |
17:53:26 | * | Varriount joined #nimrod |
17:56:43 | fowl | dom96, this wouldnt be the same as heartbleed, the diff is in the ssl bug they trust packets that come from a user |
17:56:43 | * | flaviu quit (Read error: Connection reset by peer) |
17:57:00 | * | Varriount_ joined #nimrod |
17:57:21 | * | Varriount quit (Disconnected by services) |
17:57:26 | * | Varriount_ is now known as Varriount |
17:57:50 | * | Varriount_ joined #nimrod |
17:58:04 | * | Varriount quit (Client Quit) |
17:58:06 | * | flaviu joined #nimrod |
17:58:23 | * | Varriount_ is now known as Varriount |
18:10:58 | dom96 | back |
18:11:00 | dom96 | fowl: i see |
18:12:21 | * | delian66 joined #nimrod |
18:12:24 | dom96 | Araq: You should grep for cast/copymem/alloc in my code next time a bug like this happens |
18:12:27 | dom96 | hello delian66 |
18:12:35 | fowl | dom96, here i dont check that the packet has `len` bytes in it before doing copymem https://github.com/fowlmouth/nimrod-enet/blob/master/pkt_tools.nim#L50 |
18:13:04 | delian66 | dom96: hello |
18:13:11 | fowl | dom96, tbh i skipped that part before because i hadnt decided on a name for the exception |
18:35:57 | * | Jesin quit (Quit: Leaving) |
18:55:56 | reactormonk | https://github.com/haiwen/ccnet/blob/master/net/server/user-mgr.c#LC576 |
18:56:59 | reactormonk | flaviu, good idea |
18:58:13 | reactormonk | Araq, someone wants to curry a varargs with static parameters |
18:58:58 | reactormonk | ah, zah grabbed it. |
19:01:30 | OrionPK | dom96 yep that is me, more to come. I actually have a lot to write about, just not a lot of time to write it :| |
19:02:09 | dom96 | OrionPK: Awesome. Your blog is looking good, are you using ipsum genera? |
19:03:06 | OrionPK | no |
19:03:15 | OrionPK | using jester, nginx and the rst module |
19:04:00 | dom96 | Ahh. Whatever works for you. |
19:04:13 | OrionPK | I'll post up some snippets of my code probably |
19:04:41 | OrionPK | i havent looked much at ipsum genera, I know of its existence |
19:04:54 | OrionPK | but my blog isnt completely static |
19:05:01 | OrionPK | it has some ajax and stuff |
19:05:19 | OrionPK | does ipsum genera index things? |
19:06:01 | dom96 | what do you mean by index? |
19:15:10 | OrionPK | like.. an index of your blog posts |
19:15:14 | OrionPK | listing the title & dates |
19:17:37 | runvnc | it has it on the home page |
19:18:07 | dom96 | yeah |
19:18:22 | runvnc | also if you want a separate article list for the side, my fork has that |
19:18:35 | runvnc | made the code a little repetitive in one place though |
19:18:35 | OrionPK | does it support ajax stuff? |
19:18:40 | runvnc | https://github.com/ithkuil/ipsumgenera |
19:18:52 | runvnc | you can put whatever you want in the layout files orion |
19:18:59 | runvnc | anyway see you guys later |
19:19:01 | * | runvnc quit (Quit: WeeChat 0.4.1) |
19:19:06 | OrionPK | my code is nicer though IMO :P |
19:19:13 | OrionPK | mainly because of my template module |
19:21:41 | OrionPK | https://dl.dropboxusercontent.com/u/417554/template2.png |
19:24:12 | dom96 | Why are your attributes quote-less?! |
19:24:55 | OrionPK | because browsers can deal w/o em, if they're spaceless etc |
19:24:57 | dom96 | I will be changing the way the layout files work in ipsum genera soon-ish |
19:32:27 | * | Matthias247 joined #nimrod |
20:49:53 | Araq | # Request to read completed immediately. |
20:49:54 | Araq | # From my tests bytesReceived isn't reliable. |
20:50:22 | Araq | dom96: maybe bytesReceived is 0 because it immediately completed? in other words there is still something in the buffer? |
20:50:41 | dom96 | indeed |
20:50:49 | dom96 | That is my theory too |
20:51:06 | Araq | the question is: do we even need the 'if'? |
20:51:31 | * | askatasuna joined #nimrod |
20:55:29 | dom96 | I think so? |
20:56:16 | Araq | if lineParts.len != 3: |
20:56:17 | Araq | request.respond(Http400, "Invalid request. Got: " & line) |
20:56:23 | Araq | want to 'return' after that? |
20:56:42 | Araq | cause otherwise the code fails with EInvalidIndex |
20:57:56 | dom96 | yeah |
20:58:26 | Araq | client.close() before the return? |
20:58:36 | dom96 | That shouldn't happen though unless the client sends an incorrect request. |
20:59:01 | Araq | that happens all the time |
20:59:03 | dom96 | yeah |
20:59:14 | Araq | welcome to the world of the internet |
20:59:57 | dom96 | I know. But the benchmark shouldn't do that. |
21:00:01 | flaviu | I ran the compiler through valgrind, there are no memory leaks |
21:00:30 | Araq | flaviu: no. valgrind simply doesn't know about our allocator and GC |
21:00:46 | Araq | cET / HTTP/1.1 |
21:00:57 | Araq | dom96: this header is received |
21:01:07 | dom96 | Yeah. And that's like a corruption. |
21:01:08 | Araq | where the 'c' comes from |
21:01:11 | dom96 | *likely |
21:01:14 | flaviu | Oh, that makes sense. There are 140036 'Use of uninitialised value of size' |
21:01:43 | Araq | that's the conservative stack marking, flaviu |
21:02:05 | Araq | you can teach valgrind that this part is valid, somehow |
21:02:39 | Araq | I made a feature request for valgrind once but never got any answer |
21:03:13 | Araq | it's not like conservative stack scanning is special in any way. valgrind should support that out of the box by now... |
21:04:03 | Araq | dom96: I don't know if it is a corruption but the 'c' comes from line 370 |
21:04:12 | Araq | copyMem(addr data[0], addr dataBuf.buf[0], bytesCount) |
21:04:56 | Araq | it seems to be always the first byte that is received via the callback |
21:05:16 | Araq | the other bytes are then returned immediately and correctly |
21:08:36 | fowl | Araq, is there a constraint like {global} |
21:08:42 | fowl | limit to a global variable |
21:09:12 | Araq | I don't think so. but you can implement it if you want to |
21:10:55 | Araq | edit compiler/parampatterns.nim |
21:11:13 | Araq | add a new ppGlobal opcode, etc. |
21:11:22 | dom96 | Araq: so only the first byte is received via the callback, the rest are immediate? |
21:11:33 | Araq | dom96: exactly |
21:13:41 | dom96 | That is also the first byte that is ever received from the socket |
21:14:30 | * | cark quit (Read error: Connection reset by peer) |
21:14:56 | dom96 | Araq: oh! |
21:15:20 | dom96 | Araq: The callback captures the dataBuf |
21:15:28 | dom96 | it should do that byref right? |
21:15:37 | Araq | yeah |
21:15:44 | dom96 | Perhaps it gets corrupted there? |
21:15:44 | Araq | it's fine, I noticed |
21:18:28 | Araq | argh |
21:18:40 | Araq | :-) |
21:18:44 | Araq | found it |
21:18:53 | Araq | let's release! |
21:19:18 | Araq | dataBuf.buf = newString(size) |
21:19:50 | Araq | --> but 'buf' is a cstring and so the GC happily collects the string before the callback writes into it |
21:19:57 | Araq | when it doesn't go via the callback |
21:20:09 | Araq | it's still on the stack and so the GC keeps it |
21:20:21 | * | [1]Endy quit (Ping timeout: 250 seconds) |
21:20:51 | Araq | you need to use 'alloc0' here and dealloc |
21:22:02 | Araq | and btw |
21:22:27 | Araq | optimized code likely wouldn't even have created such a mess :P |
21:22:58 | Araq | lots of unnecessary string ops and copying and memory allocations going on here |
21:23:05 | * | cark joined #nimrod |
21:23:21 | Araq | you need to use buffered sockets asap |
21:24:04 | * | Varriount quit (Read error: Connection reset by peer) |
21:25:02 | dom96 | yeah, I know. |
21:25:03 | flaviu | I compiled a hello world under valgrind, 21% of the time seems to be spent in maintaining the stack. |
21:25:41 | dom96 | Araq: Can you tell me your other fixes or do you just want to commit them? |
21:25:59 | Araq | I'll commit them soon |
21:26:10 | Araq | still figuring out when to call 'dealloc' :P |
21:26:31 | dom96 | ok, then make sure it works :P |
21:27:08 | Araq | flaviu: you mean the compiler spends 21% of its runtime in the stack scanning? not unreasonable |
21:37:02 | Araq | dom96: the ol: POverlapped is only deallocated when WSARecv returns -1 |
21:37:25 | Araq | doesn't that leak for other cases? |
21:37:58 | dom96 | Read the comment on line 406 |
21:38:20 | * | Varriount joined #nimrod |
21:38:31 | Araq | I did |
21:38:37 | Araq | it doesn't answer my question |
21:38:52 | Araq | oh well perhaps it does |
21:39:26 | dom96 | ol is deallocated in poll |
21:40:34 | Varriount | Hm. Is someone's code in bad need of a clean-up? |
21:41:04 | fowl | matchnodekinds has a mini stack machine in it |
21:41:27 | Araq | fowl: so? |
21:43:34 | fowl | thats creative |
21:49:01 | Araq | dom96: argh |
21:49:12 | Araq | no idea when 'cb' will be invoked |
21:49:38 | dom96 | so? |
21:49:43 | Araq | what does WSARecv return when it's been postponed to the callback? |
21:50:25 | dom96 | The cb will always be called |
21:50:28 | dom96 | unless an error occurs |
21:50:40 | dom96 | (an error other than ERROR_IO_PENDING) |
21:52:49 | Araq | even for "Request to read completed immediately." |
21:52:52 | Araq | ? |
21:56:02 | Araq | dom96: ??? |
21:57:18 | dom96 | You know that comment I told you to read previously? |
21:57:24 | dom96 | Doesn't that answer your question? |
21:57:28 | Araq | no |
21:58:35 | Araq | well I get no losses now |
21:58:44 | Araq | 1000 requests succeed |
21:59:13 | Araq | I'll push and you better watch that I didn't produce a leak |
22:00:06 | dom96 | ok great |
22:01:50 | * | brson joined #nimrod |
22:07:38 | * | DAddYE joined #nimrod |
22:12:51 | * | askatasuna quit (Ping timeout: 258 seconds) |
22:16:08 | flaviu | Is there a reason idents.nim is implements its own hash table? I think things would still work if it used the tables module |
22:18:41 | Araq | flaviu: usually the reason is that the compiler existed before the stdlib |
22:20:06 | flaviu | Ok, that makes sense |
22:24:48 | Skrylar | :/ |
22:24:54 | Skrylar | I hate enum mechanics |
22:24:55 | * | Jesin joined #nimrod |
22:25:32 | Skrylar | Mostly when porting an enum from C, which uses weird numerals like characters or macros that make bitfields, and then the compiler whines that the order is wrong (even when i calculate the fields out ahead of time and they are not out of order) :| |
22:25:40 | * | io2 quit (Quit: ...take irc away, what are you? genius, billionaire, playboy, philanthropist) |
22:29:34 | Araq | Skrylar: you can also translate it into a number of constants instead |
22:30:05 | Araq | and use type Foo = distinct int; const valueA = 23.Foo |
22:30:16 | Araq | if you're after the type safety |
22:32:36 | * | brson quit (Ping timeout: 245 seconds) |
22:38:20 | Skrylar | Araq: then i can't use {.pure.} to keep rarely-used constants out of the global namespace :/ |
22:39:02 | Skrylar | i'll just shove it in a spreadsheet and calculate it out again, grumbly as it is |
22:39:35 | Araq | *shrug* |
22:39:46 | flaviu | idents.nim also implements its own strutils :/ |
22:41:06 | * | Demos joined #nimrod |
22:42:56 | Demos | I hate generateing index lists |
22:43:31 | Araq | er .. dom96 I pushed but NimBot remains silent |
22:44:11 | dom96 | That's because NimBuild crashed |
22:44:46 | * | Matthias247 quit (Read error: Connection reset by peer) |
22:47:51 | * | oxful__ joined #nimrod |
22:50:31 | * | oxful_ quit (Ping timeout: 245 seconds) |
22:53:57 | Demos | ugh, kinda satisfying to go from really screwed up triangle meatball to a real shape though |
22:57:06 | flaviu | Are there any further plans for compiler/renderer.nim? |
22:57:20 | EXetoC | mmh, meatballs |
23:01:37 | dom96 | Araq: I could really use a nicer way of chaining ["foo"]["bar"] for JSON without it crashing when a key cannot be found |
23:04:47 | Araq | dom96: easily done |
23:04:57 | dom96 | Araq: how should I do it? |
23:06:51 | Araq | proc `[]`(x: PJSon, keys: varargs[string]): PJSon = ... |
23:07:01 | Araq | if that works with [] |
23:07:40 | dom96 | What if there are JArray's in between? |
23:09:16 | dom96 | I would still also need to check for nil at the end |
23:10:08 | Araq | proc `@`(x: PJson, path: string): PJson = ... |
23:10:22 | Araq | x@"foo/bar/3/baz" |
23:14:12 | dom96 | hrm, I have an idea. |
23:23:04 | Araq | good night |
23:23:16 | dom96 | Would be nice to have a path which does not need to be parsed. |
23:24:22 | Araq | parse it at compile time |
23:24:45 | dom96 | I'm thinking something like this? x.str("test"/0/"foo", "defaultValue") |
23:25:01 | dom96 | where str is a macro? |
23:28:53 | dom96 | All other statically typed programming languages seem to only provide JSON reading through a data type which matches the JSON data. |
23:35:35 | Araq | do it however you please |
23:35:37 | Araq | good night |
23:36:04 | dom96 | bye |
23:37:42 | EXetoC | JArray's inbetween? you can't get it to work with subscript? |
23:39:29 | dom96 | I could do: x.str(["test"][0]["foo"], "defaultValue") |
23:39:40 | dom96 | but `/` is nicer |
23:40:31 | EXetoC | str as in type-assumption? |
23:40:53 | dom96 | yes |
23:43:20 | * | darkf joined #nimrod |
23:46:07 | EXetoC | that's pretty good I guess |
23:49:56 | flaviu | dom96: Have you considered `.?` and `.` |
23:51:15 | dom96 | Yeah. Support for custom `.` is still a bit iffy. |
23:51:33 | flaviu | If its a macro, you should be fine |
23:51:44 | dom96 | Perhaps x.?"test".?0 .. would work |
23:51:47 | dom96 | But I find that ugly too |
23:52:04 | dom96 | and . for indexes is ugly too |
23:55:54 | EXetoC | x["a"][0]["b"].default(3)? x["a", 0, "b"].default(3)? |
23:56:06 | EXetoC | is the latter possible with the auto-converting varargs variant? |
23:56:24 | dom96 | the former would crash |
23:56:28 | flaviu | How about `[]?` then? |
23:56:30 | dom96 | the latter may be possible |
23:57:18 | dom96 | I don't think you can define an operator like that and have it work as ["asd"]? |
23:57:22 | flaviu | It'd require a macro, but it'd work. I think that a question mark should be in there somewere to make it clear that this ignores missing properties |
23:57:39 | flaviu | No, you can't. You'd need a macro |
23:57:50 | EXetoC | can't you avoid any crashes? |
23:57:52 | EXetoC | surely you can |