<< 12-04-2014 >>

00:05:40dom96hi Automatic
00:06:09VarriountAraq: 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:17Araqhi Automatic welcome
00:07:36AraqVarriount: things like these tend to cause more trouble than they solve
00:07:47Araqlet's stick to the default
00:08:54VarriountAraq: But http://blogs.msdn.com/b/oldnewthing/archive/2014/04/11/10516280.aspx
00:11:45Automatichello
00:16:52Automaticpossible for nim to automatically write header function declarations from function defs?
00:19:08VarriountAutomatic: You mean for interfacing with C code?
00:21:38AraqAutomatic: yeah --header command line option does the job iirc
00:21:57Araqyou need to .exportc the stuff you want to see in the header file
00:22:26Automaticexcellent
00:23:17AraqVarriount: let's discuss this tomorrow.
00:23:20Araqgood night
00:23:56VarriountGood night
00:25:42dom96Ooh, shiny: http://dc.ubm-us.com/i/245989
00:29:43Automaticwhat type holds the biggest integer?
00:30:11flaviuAutomatic: int64
00:30:42dom96You can also use the BiggestInt alias.
00:30:49flaviuint 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:55flaviuAutomatic: Make sure you're looking at http://build.nimrod-lang.org/docs/documentation.html
00:32:55flaviuThe main website is a year out of date
00:35:08flaviudom96: 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:36dom96ok, let me rewrite that a bit
00:36:38EXetoCyes as old as the last release
00:40:19Automaticwith proc name*(arb: int) = is there a technique to also allow proc name^(a:cint) = or even proc name(a:cint) =>
00:40:34NimBotAraq/Nimrod devel e333b8b Dominik Picheta [+0 ±1 -0]: Rewrote sentence about Babel in lib.txt.
00:40:43flaviuhttp://gradha.github.io/genieos/
00:41:41*DAddYE quit (Remote host closed the connection)
00:42:53dom96flaviu: gradha is in a league of his own hah
00:43:24*DAddYE_ joined #nimrod
00:44:00dom96Automatic: You mean with macros?
00:44:13Automaticyep
00:44:38dom96Yeah, but you won't be able to use the 'proc' keyword
00:46:10flaviuAutomatic: you can use 훒roc though
00:46:24flaviuor even better, ᴘroc
00:47:17Automaticto do ᴘroc name^(a:cint) = or even ᴘroc name(a:cint) => how to do that?
00:47:53flaviuAsk dom96, I'm just pointing out that nimrod supports unicode charecters
00:49:56dom96Actually, perhaps it would be possible to get proc name^(a:cint) working
00:50:15dom96nah.
00:51:11Automaticwhat about def name(a:cint) = becoming proc name*(arb: int) = ??
00:53:23dom96let me try it
00:59:03dom96Unfortunately I don't think so.
00:59:08flaviuYou can come close
00:59:40flaviusyntax like def name, (a: int, b: string): ??? should be possible
01:02:58Skrylari think i'm going to port over a soundex proc
01:03:57dom96The AST I get for this is odd: https://gist.github.com/dom96/fe7c8abbe5a0d6a537fe
01:04:17dom96it has the 'a' arg but not the 'b'
01:04:22dom96Anyway
01:04:28dom96Good night
01:04:41Skrylargood night dom96
01:06:23Automaticnight 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:34flaviuAutomatic: I'm not sure about your syntax, but I think you can write C in nimrod
01:15:49*brson joined #nimrod
01:15:57flaviuhttps://gist.github.com/10513308 compiles, so its a start
01:22:46Automaticflaviu, 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:04flaviuYes, but this is fun
01:25:19Automaticproc name(a:cint) => this is my fav for module out but not easy to do
01:25:46EXetoCwhat's this for?
01:25:58*Demos joined #nimrod
01:26:12Automaticproc name*(a:cint) module available to others I think
01:27:12flaviuIs there any way to take a subsequence?
01:28:13Demosugh 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:15fowlonce 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:02Demosplease do not try and change the syntax. People do that in C and it ends badly
01:30:35flaviuDemos: void abc(int a, string b){ echo "test", echo "test1", } compiles in nimrod
01:30:38Automaticwhen I see * I always think it's a multiplication first, then pointer, then module availability third.
01:30:54Demoswell that will change quick
01:31:11Demoseveryone else thinks module export, because that is what it does
01:36:04Demosnimrod's syntax is way more sane that most any other language
01:36:19EXetoCit's pointless, but fun to see what you can do with macros
01:36:49Automaticmacro wasn't powerful enough for the syntax change above though?
01:37:19DemosAutomatic: I think you could do it (maybe with a pragma) but do not expect to be able to modify nimrod's syntax
01:37:37VarriountAutomatic: You *can* make the syntax change above, using macros, however it wouldn't be easy.
01:37:46flaviuAutomatic: You can also use a custom parser
01:37:54VarriountA better, more flexible option would probably be writing your own pars-
01:38:15Demosand it would be evil and eventually someone will look at your code after a long night and find out where you live....
01:39:01Skrylargood job skrylar, convert text to uppercase then check for lowercase
01:39:16flaviuAutomatic: http://nimrod-lang.org/filters.html#replace-filter
01:41:18Demosbut note that you are screwed if someone decides to define a `^` proc
01:41:33Demosit will even be a really odd bug if you also have a `*` proc
01:43:04flaviuAutomatic: If you're feeling adventurous, dig into the compiler. The file is compiler/lexer.nim
01:46:53Automaticfalviu: that will work :D
01:46:57*q66 quit (Quit: Leaving)
01:48:27*EXetoC quit (Quit: WeeChat 0.4.3)
01:49:11Skrylarsweet, 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:30BitPuffinhow come not have a way to get the number of threads/cores on a system?
01:57:42BitPuffinwell
01:57:54BitPuffinguess there is the default answer of because nobody's added it yet
01:59:20Skrylarmost OS' aren't BeOS, and there is no convenient "GetNumberOfCPUs" call :(
02:00:04Skrylarbut yeah, probably just nobody has made a cross platform module for it
02:00:11SkrylarI guess I could add it to skylights
02:11:14BitPuffinyeah it's just to wrap it really
02:11:24BitPuffinwindotshas some kind of getinfo thing that includes cores
02:12:00BitPuffinSkrylar: I'd aim for getting it in to the threads module
02:13:26*Gr33n3gg joined #nimrod
02:14:34flaviuI got the C macro functioning
02:14:59flaviuhttps://gist.github.com/flaviut/10515205 Executes and runs perfectly
02:16:16*Gr33n3gg left #nimrod (#nimrod)
02:21:33Automaticflaviu: I got an error: macro.nim(4, 17) Error: type mismatch: got (PNimrodNode, int literal(0))
02:22:15flaviuHave you changed it at all? Its really fragile atm
02:24:17Automaticflaviu: no changes raw file from site
02:25:06flaviuAutomatic: Are you using nimrod from git or is it from the site?
02:25:27AutomaticI think it's git
02:25:31flaviuI just downloaded it, it works perfectly
02:26:10Automaticprobably need to update mine
02:26:28flaviuAutomatic: Can you do `nimrod --version`? The date should be recent.
02:27:08Automatic Version 0.9.3 (2014-04-10)
02:28:13flaviuI'm not sure whats going on. Try downloading https://gist.githubusercontent.com/flaviut/10515205/raw/03c48cc16a51f3d0739d608ebebef6fb6ad83bb5/test.nim
02:29:45Automaticthat one worked
02:29:59flaviuSeems that something got lost in the copy-paste then
02:31:56Automaticyep, but void abc(int a, string b, string c) won't work
02:33:10Demoswhy the hell are we writing c in nimrod?
02:33:14flaviuWorks for me
02:34:03flaviuDemos: For fun. I'm implementing char* next!
02:34:13Demosgrrrr
02:39:08Automaticflaviu: sorry it does work
02:41:29Automaticflaviu: is this possible or only the c version? def name(a:cint) = or proc name^(a:cint) becoming proc name*(a: cint) =
02:42:18flaviuAutomatic: Give me a few seconds to see
02:44:46flaviuAutomatic: `def name(a: int) =>` is possible
02:45:21flaviuNo, it isn't
02:45:33flaviubut `def name(a: int): ` is possible
02:47:20flaviuActually, the best I can do is `def name(a int, b int):`
02:47:58flaviuI can't use the colon type annotation because they get swallowed somewhere
02:48:06flaviuBut this is a really bad idea
02:49:54Automaticflaviu: I didn't think you could get as far as you did
02:52:41flaviuThanks, it was fun
02:53:01flaviuI'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:18Skrylarhumm
03:29:40SkrylarI 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:53SkrylarNot 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:27Automaticany 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:46Continualwhere are the instructions to compile the csources from the .nim sources?
06:27:22Skrylarhm?
06:27:40Skrylari 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:28Araqomg the "C in Nimrod" gist is the most surprising code that I've ever seen
11:22:22*q66 joined #nimrod
11:23:34dom96hi
11:27:06dom96Araq: https://gist.github.com/dom96/fe7c8abbe5a0d6a537fe how come the 'b' arg is lost in the AST?
11:28:58Araqgood question
11:29:05dom96ooh nice. I wonder who this is: http://www.eoleary.me/
11:40:37Araqbbl
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:38foodooa union type in C corresponds to a ̀type
13:27:48foodoo` definition that is an enum?
13:31:16*EXetoC joined #nimrod
13:32:52Araqfoodoo: 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:15foodooI 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:46Araqare you sure you're using the latest c2nim version from github? c2nim now supports unions
13:40:29Araqbtw we have a cario wrapper in the stdlib or in babel
13:40:46EXetoCcairo?
13:41:13foodooEXetoC: The font rendering library used by Gtk
13:41:41EXetoCI know
13:41:51foodooAraq: oh, right. It's in the standard library
13:47:09Araqand soon in Babel instead :-)
13:47:42foodooIt's springtime, so you clean up the stdlib :-)
13:53:31foodooAraq: 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:59foodooIt says: tmp/snip.h(2, 12) Error: identifier expected, but found '{'
13:56:44Araqugh. oh well you can always pull out these structs into an outer scope
13:56:53Araqreport it please
13:57:19foodoookay
14:02:29*io2 joined #nimrod
14:18:14*Jesin joined #nimrod
14:19:04Araqdom96: 02377f08"5ET / HTTP/1.1" what should it be?
14:19:14Araq"GET", right?
14:19:15dom96yes
14:19:18Araqand always?
14:19:23Araqnever an empty string?
14:20:37dom96It could be empty if the socket has been disconnected.
14:20:39*Zuchto_ quit (Quit: --)
14:20:54dom96There 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:28Araqwhich line generates this output?
14:27:37dom96Come on, just search for 'echo'
14:27:42dom96Line 137.
14:29:26Araqhu?
14:29:35Araqthis means the reqMethod is not 'GET'
14:31:57dom96yeah
14:32:04dom96it's supposed to be 'get'
14:32:21dom96(after normalisation)
14:32:53dom96When reqMethod is "" what does the echo after that show?
14:33:03dom96because if it's also "" then something strange is going on
14:33:10dom96since I check for "" in line 99
14:36:52Araqdoes 'repr' still produce a newline?
14:38:29Araqwell gah
14:38:44Araqnow 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:03dom96hello 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:24nequitanshi 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:37flaviunequitans: proc readBytes(f: TFile; a: var openArray[int8]; start, len: int): int
15:11:36nequitanshi flaviu, thanks, i assume i cast a seq[int64] to a seq[int8] and multiply the byte length accordingly?
15:14:07Araqer ... you can try that ...
15:14:19AraqI would use readBuffer instead though
15:14:33nequitansso I was using readBuffer
15:14:40nequitansand newSeq
15:14:44Araqyup
15:14:54Araqyou need to use addr(s[0]) though
15:14:58Araqand NOT addr(s)
15:15:01nequitansaah
15:15:10Araqas a seq has a header that you need to skip
15:15:30nequitansi was thinking it did b/c the seq contains length info as well?
15:15:45Araqlength + capacity, yeah
15:16:34flaviuAraq: 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:50flaviu't confilict, but I can't figure out where the compiler looks for that
15:17:27Araqit simply checks whether a dir has a .babel file and if so uses that as the module's package name
15:18:14Araqquite like python's __init__.py iirc
15:19:37nequitansic -- 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:09Araqno, why would it?
15:20:56Araqflaviu: options.getPackageName does most of the work
15:21:21flaviuYes, I found that, but I can't get the submodule names from the AST
15:21:57nequitansI guess I'm trying to understand what addr(s) points to vs. addr(s[0])
15:22:02Araqan AST has no owner, only types and symbols do
15:22:41Araqnequitans: addr(s) --> &struct{ long size, cap; T[] data };
15:23:00Araqnequitans: addr(s[0]) --> struct{ long size, cap; &T[] data };
15:23:18Araqif you can follow my pseudo C ...
15:23:48nequitansohh
15:23:49nequitansi see
15:24:05nequitansso the [] on the seq simply say jump into T
15:24:40Araqflaviu: n.sym.owner.owner might be the package if n.sym.owner is a module ...
15:24:41nequitansso i could day addr(s[4]) and that's OK
15:24:49Araqyeah
15:24:56nequitansthx!
15:28:15flaviuAraq: Thanks, that seems to be correct. Turns out my issue is somewhere else though
15:59:33reactormonkdoes the tester deal with if isMain tests?
16:01:47EXetoCyes
16:01:53reactormonkok
16:02:21EXetoCwell, 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:41flaviureactormonk: 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:55Araqdom96: some results: the string is already corrupted when it leaves 'recvLine'
17:15:20Araqsend gets a nil socket
17:15:37Araqbut it's not nil in the request that processClient sets
17:16:01EXetoCworking on the last release feature?
17:17:41dom96Araq: ok, and what does that tell you?
17:18:25AraqEXetoC: indeed
17:18:43Araqdom96: I'm suprised it's already corrupted in recvLine
17:19:07Araqalso your recv that returns 1 char long strings is horrible for performance
17:19:36dom96Araq: I am aware. Stop worrying about performance please.
17:20:07Araqno, I'm glad there are so many easy things left to do to improve performance :P
17:20:23Araqwe'll beat Go easily :P
17:23:07flaviuAraq: I realized that C is far superior to nimrod, but I didn't feel like figuring out how to compile it.
17:23:14flaviuSo 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:28fowlpkt_tools is vulnerable to heartbleed, should i leave it this way for 2 years?
17:23:34flaviu:P
17:24:01Araqflaviu: I already praised your work
17:24:29fowlflaviu, now do while,if, etc
17:24:38Araqnow I finally have an answer to the question "what is the most surpring nimrod code that you have never anticipated?"
17:25:09flaviuI ran into issues with macro generating templates, so I can't easily define new function return types
17:25:34Araqreported the issue?
17:26:18flaviuOk, I'll do that
17:41:21Araqer lol
17:41:56Araqdom96: you have a heartbeat like bug in asyncdispatch.recv
17:42:24dom96Oh really?
17:42:27AraqcopyMem(addr data[0], addr dataBuf.buf[0], realSize)
17:42:35dom96NimBot told me to do it.
17:42:55*dom96 shreds super top secret letters from the NSA
17:43:04dom96I mean... this was a pureee accident.
17:43:33Araqbbl
17:44:09fowlcopymem is fine, the problem is not checking the data size before you do it
17:45:50dom96Araq: As you can see by my comments I had trouble with Win APIs silly bytesReceived value.
17:46:44dom96Assuming that I can read all the data that I requested if WSARecv returns immediately sounds reasonable to me though.
17:47:33dom96bbl
17:47:51flaviudom96: that blog you found is by OrionPK
17:49:04flaviuhttp://build.nimrod-lang.org/irclogs/09-04-2014.html
17:53:26*Varriount joined #nimrod
17:56:43fowldom96, 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:58dom96back
18:11:00dom96fowl: i see
18:12:21*delian66 joined #nimrod
18:12:24dom96Araq: You should grep for cast/copymem/alloc in my code next time a bug like this happens
18:12:27dom96hello delian66
18:12:35fowldom96, 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:04delian66dom96: hello
18:13:11fowldom96, 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:56reactormonkhttps://github.com/haiwen/ccnet/blob/master/net/server/user-mgr.c#LC576
18:56:59reactormonkflaviu, good idea
18:58:13reactormonkAraq, someone wants to curry a varargs with static parameters
18:58:58reactormonkah, zah grabbed it.
19:01:30OrionPKdom96 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:09dom96OrionPK: Awesome. Your blog is looking good, are you using ipsum genera?
19:03:06OrionPKno
19:03:15OrionPKusing jester, nginx and the rst module
19:04:00dom96Ahh. Whatever works for you.
19:04:13OrionPKI'll post up some snippets of my code probably
19:04:41OrionPKi havent looked much at ipsum genera, I know of its existence
19:04:54OrionPKbut my blog isnt completely static
19:05:01OrionPKit has some ajax and stuff
19:05:19OrionPKdoes ipsum genera index things?
19:06:01dom96what do you mean by index?
19:15:10OrionPKlike.. an index of your blog posts
19:15:14OrionPKlisting the title & dates
19:17:37runvnc it has it on the home page
19:18:07dom96yeah
19:18:22runvncalso if you want a separate article list for the side, my fork has that
19:18:35runvncmade the code a little repetitive in one place though
19:18:35OrionPKdoes it support ajax stuff?
19:18:40runvnchttps://github.com/ithkuil/ipsumgenera
19:18:52runvncyou can put whatever you want in the layout files orion
19:18:59runvncanyway see you guys later
19:19:01*runvnc quit (Quit: WeeChat 0.4.1)
19:19:06OrionPKmy code is nicer though IMO :P
19:19:13OrionPKmainly because of my template module
19:21:41OrionPKhttps://dl.dropboxusercontent.com/u/417554/template2.png
19:24:12dom96Why are your attributes quote-less?!
19:24:55OrionPKbecause browsers can deal w/o em, if they're spaceless etc
19:24:57dom96I will be changing the way the layout files work in ipsum genera soon-ish
19:32:27*Matthias247 joined #nimrod
20:49:53Araq # Request to read completed immediately.
20:49:54Araq # From my tests bytesReceived isn't reliable.
20:50:22Araqdom96: maybe bytesReceived is 0 because it immediately completed? in other words there is still something in the buffer?
20:50:41dom96indeed
20:50:49dom96That is my theory too
20:51:06Araqthe question is: do we even need the 'if'?
20:51:31*askatasuna joined #nimrod
20:55:29dom96I think so?
20:56:16Araqif lineParts.len != 3:
20:56:17Araq request.respond(Http400, "Invalid request. Got: " & line)
20:56:23Araqwant to 'return' after that?
20:56:42Araqcause otherwise the code fails with EInvalidIndex
20:57:56dom96yeah
20:58:26Araqclient.close() before the return?
20:58:36dom96That shouldn't happen though unless the client sends an incorrect request.
20:59:01Araqthat happens all the time
20:59:03dom96yeah
20:59:14Araqwelcome to the world of the internet
20:59:57dom96I know. But the benchmark shouldn't do that.
21:00:01flaviuI ran the compiler through valgrind, there are no memory leaks
21:00:30Araqflaviu: no. valgrind simply doesn't know about our allocator and GC
21:00:46Araq cET / HTTP/1.1
21:00:57Araqdom96: this header is received
21:01:07dom96Yeah. And that's like a corruption.
21:01:08Araqwhere the 'c' comes from
21:01:11dom96*likely
21:01:14flaviuOh, that makes sense. There are 140036 'Use of uninitialised value of size'
21:01:43Araqthat's the conservative stack marking, flaviu
21:02:05Araqyou can teach valgrind that this part is valid, somehow
21:02:39AraqI made a feature request for valgrind once but never got any answer
21:03:13Araqit's not like conservative stack scanning is special in any way. valgrind should support that out of the box by now...
21:04:03Araqdom96: I don't know if it is a corruption but the 'c' comes from line 370
21:04:12AraqcopyMem(addr data[0], addr dataBuf.buf[0], bytesCount)
21:04:56Araqit seems to be always the first byte that is received via the callback
21:05:16Araqthe other bytes are then returned immediately and correctly
21:08:36fowlAraq, is there a constraint like {global}
21:08:42fowllimit to a global variable
21:09:12AraqI don't think so. but you can implement it if you want to
21:10:55Araqedit compiler/parampatterns.nim
21:11:13Araqadd a new ppGlobal opcode, etc.
21:11:22dom96Araq: so only the first byte is received via the callback, the rest are immediate?
21:11:33Araqdom96: exactly
21:13:41dom96That 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:56dom96Araq: oh!
21:15:20dom96Araq: The callback captures the dataBuf
21:15:28dom96it should do that byref right?
21:15:37Araqyeah
21:15:44dom96Perhaps it gets corrupted there?
21:15:44Araqit's fine, I noticed
21:18:28Araqargh
21:18:40Araq:-)
21:18:44Araqfound it
21:18:53Araqlet's release!
21:19:18AraqdataBuf.buf = newString(size)
21:19:50Araq--> but 'buf' is a cstring and so the GC happily collects the string before the callback writes into it
21:19:57Araqwhen it doesn't go via the callback
21:20:09Araqit's still on the stack and so the GC keeps it
21:20:21*[1]Endy quit (Ping timeout: 250 seconds)
21:20:51Araqyou need to use 'alloc0' here and dealloc
21:22:02Araqand btw
21:22:27Araqoptimized code likely wouldn't even have created such a mess :P
21:22:58Araqlots of unnecessary string ops and copying and memory allocations going on here
21:23:05*cark joined #nimrod
21:23:21Araqyou need to use buffered sockets asap
21:24:04*Varriount quit (Read error: Connection reset by peer)
21:25:02dom96yeah, I know.
21:25:03flaviuI compiled a hello world under valgrind, 21% of the time seems to be spent in maintaining the stack.
21:25:41dom96Araq: Can you tell me your other fixes or do you just want to commit them?
21:25:59AraqI'll commit them soon
21:26:10Araqstill figuring out when to call 'dealloc' :P
21:26:31dom96ok, then make sure it works :P
21:27:08Araqflaviu: you mean the compiler spends 21% of its runtime in the stack scanning? not unreasonable
21:37:02Araqdom96: the ol: POverlapped is only deallocated when WSARecv returns -1
21:37:25Araqdoesn't that leak for other cases?
21:37:58dom96Read the comment on line 406
21:38:20*Varriount joined #nimrod
21:38:31AraqI did
21:38:37Araqit doesn't answer my question
21:38:52Araqoh well perhaps it does
21:39:26dom96ol is deallocated in poll
21:40:34VarriountHm. Is someone's code in bad need of a clean-up?
21:41:04fowlmatchnodekinds has a mini stack machine in it
21:41:27Araqfowl: so?
21:43:34fowlthats creative
21:49:01Araqdom96: argh
21:49:12Araqno idea when 'cb' will be invoked
21:49:38dom96so?
21:49:43Araqwhat does WSARecv return when it's been postponed to the callback?
21:50:25dom96The cb will always be called
21:50:28dom96unless an error occurs
21:50:40dom96(an error other than ERROR_IO_PENDING)
21:52:49Araqeven for "Request to read completed immediately."
21:52:52Araq?
21:56:02Araqdom96: ???
21:57:18dom96You know that comment I told you to read previously?
21:57:24dom96Doesn't that answer your question?
21:57:28Araqno
21:58:35Araqwell I get no losses now
21:58:44Araq1000 requests succeed
21:59:13AraqI'll push and you better watch that I didn't produce a leak
22:00:06dom96ok great
22:01:50*brson joined #nimrod
22:07:38*DAddYE joined #nimrod
22:12:51*askatasuna quit (Ping timeout: 258 seconds)
22:16:08flaviuIs 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:41Araqflaviu: usually the reason is that the compiler existed before the stdlib
22:20:06flaviuOk, that makes sense
22:24:48Skrylar:/
22:24:54SkrylarI hate enum mechanics
22:24:55*Jesin joined #nimrod
22:25:32SkrylarMostly 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:34AraqSkrylar: you can also translate it into a number of constants instead
22:30:05Araqand use type Foo = distinct int; const valueA = 23.Foo
22:30:16Araqif you're after the type safety
22:32:36*brson quit (Ping timeout: 245 seconds)
22:38:20SkrylarAraq: then i can't use {.pure.} to keep rarely-used constants out of the global namespace :/
22:39:02Skrylari'll just shove it in a spreadsheet and calculate it out again, grumbly as it is
22:39:35Araq*shrug*
22:39:46flaviuidents.nim also implements its own strutils :/
22:41:06*Demos joined #nimrod
22:42:56DemosI hate generateing index lists
22:43:31Araqer .. dom96 I pushed but NimBot remains silent
22:44:11dom96That'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:57Demosugh, kinda satisfying to go from really screwed up triangle meatball to a real shape though
22:57:06flaviuAre there any further plans for compiler/renderer.nim?
22:57:20EXetoCmmh, meatballs
23:01:37dom96Araq: I could really use a nicer way of chaining ["foo"]["bar"] for JSON without it crashing when a key cannot be found
23:04:47Araqdom96: easily done
23:04:57dom96Araq: how should I do it?
23:06:51Araqproc `[]`(x: PJSon, keys: varargs[string]): PJSon = ...
23:07:01Araqif that works with []
23:07:40dom96What if there are JArray's in between?
23:09:16dom96I would still also need to check for nil at the end
23:10:08Araqproc `@`(x: PJson, path: string): PJson = ...
23:10:22Araqx@"foo/bar/3/baz"
23:14:12dom96hrm, I have an idea.
23:23:04Araqgood night
23:23:16dom96Would be nice to have a path which does not need to be parsed.
23:24:22Araqparse it at compile time
23:24:45dom96I'm thinking something like this? x.str("test"/0/"foo", "defaultValue")
23:25:01dom96where str is a macro?
23:28:53dom96All other statically typed programming languages seem to only provide JSON reading through a data type which matches the JSON data.
23:35:35Araqdo it however you please
23:35:37Araqgood night
23:36:04dom96bye
23:37:42EXetoCJArray's inbetween? you can't get it to work with subscript?
23:39:29dom96I could do: x.str(["test"][0]["foo"], "defaultValue")
23:39:40dom96but `/` is nicer
23:40:31EXetoCstr as in type-assumption?
23:40:53dom96yes
23:43:20*darkf joined #nimrod
23:46:07EXetoCthat's pretty good I guess
23:49:56flaviudom96: Have you considered `.?` and `.`
23:51:15dom96Yeah. Support for custom `.` is still a bit iffy.
23:51:33flaviuIf its a macro, you should be fine
23:51:44dom96Perhaps x.?"test".?0 .. would work
23:51:47dom96But I find that ugly too
23:52:04dom96and . for indexes is ugly too
23:55:54EXetoCx["a"][0]["b"].default(3)? x["a", 0, "b"].default(3)?
23:56:06EXetoCis the latter possible with the auto-converting varargs variant?
23:56:24dom96the former would crash
23:56:28flaviuHow about `[]?` then?
23:56:30dom96the latter may be possible
23:57:18dom96I don't think you can define an operator like that and have it work as ["asd"]?
23:57:22flaviuIt'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:39flaviuNo, you can't. You'd need a macro
23:57:50EXetoCcan't you avoid any crashes?
23:57:52EXetoCsurely you can