<< 19-01-2014 >>

00:01:48fowlAraq, perhaps it should depend on how you instantiate it
00:02:20vbttoh i think i get it. iterator() is just a resumable function.
00:02:33Araqvbtt: exactly
00:02:37vbttand you can pass in a different value each time.
00:02:43Araqyes lol
00:02:45vbttand the iterator can make decisions based on that.
00:02:51Araqyes
00:02:55vbttok cool.
00:02:58vbttso it's by design.
00:03:04vbttand it's useful.
00:03:05Araqyes
00:03:15Varriountvbtt: Just so you know, in that snippet, 'iterator' is a keyword, not an identifier
00:03:21vbttit's just the name iterator threw me off.
00:03:46Araqwell indeed that's now a bad name
00:03:58Araqhappens when languages evolve
00:04:07vbttand yeah i understand how you can save the arg values with a closure if you want.
00:04:24vbttit's ok. as long as the inline and closure iterators have similiar semantics.
00:04:34Araqindeed they have
00:04:45fowlAraq, i dont see why both ways wouldnt work though, the python usage is going to be common
00:05:02vbttit's only because i expected python semantics that i was confused. every language has different semantics for iterators.
00:05:28vbttfowl: yes, and it's easy to impelemnt the python usage if thats what you want.
00:05:57Araqfowl: that looks like it would require yet another special case for overloading resolution
00:06:13vbttok g2g
00:06:15vbttttyl.
00:06:29vbttnimrod looks better and better each time.
00:06:40*vbtt quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
00:06:46LordAndrewTo use an entire standard library, do I just do "import strutils"?
00:07:06VarriountLordAndrew: You mean, a module? Yes.
00:07:07AraqLordAndrew: yes
00:07:55VarriountLordAndrew: Some information on importing -> http://nimrod-lang.org/manual.html#import-statement
00:08:41LordAndrewAha, I knew I was missing some sort of documentation. Thanks Varriount. :)
00:09:50VarriountLordAndrew: Keep in mind that the manual, though a trove of information, is a bit outdated, and doesn't reflect fully all the features of nimrod
00:10:28VarriountLordAndrew: A more up-to-date version of the manual is on the github repo, in the documention directories.
00:15:33Araqor here: http://build.nimrod-lang.org/docs/index.html
00:16:06VarriountAraq: Yes, but iirc, not even that is *exactly* up-to-date
00:16:27Araqtrue :-/
00:17:08*xtagon joined #nimrod
00:24:15VarriountHey xtagon
00:24:59xtagonHey Varriount
00:31:07*io2 quit ()
00:31:56NimBotAraq/Nimrod devel a30b428 Billingsly Wetherfordshire [+0 ±1 -0]: Update endians.nim... 2 more lines
00:31:56NimBotAraq/Nimrod devel b2410ab Josh Girvin [+0 ±1 -0]: Koch now uses PATH/nimrod correctly
00:31:56NimBotAraq/Nimrod devel 19574a3 Andreas Rumpf [+0 ±1 -0]: Merge pull request #812 from girvo/koch-fix... 2 more lines
00:31:56NimBotAraq/Nimrod devel 250249c Andreas Rumpf [+0 ±1 -0]: Merge pull request #775 from fowlmouth/patch-3... 2 more lines
00:31:56NimBot4 more commits.
00:32:56Araqdom96: it really sucks to look for the clone command line to clone gtk2
00:33:02Araqcan't babel do that for me?
00:33:42dom96no.
00:35:24dom96You can get the url easily using babel though.
00:35:35Araqhow so?
00:35:41dom96babel search gtk
00:36:27VarriountHey Araq, are WideCStrings garbage collected?
00:36:36AraqVarriount: yep
00:37:48VarriountAraq: Ok, so say I make a call to a windows api procedure, defined using the importc pragma, of the form winCall(newWideCString("Hello"))
00:37:58Araqyes
00:38:29VarriountAraq: I didn't finish my question..?
00:38:44Araqyes
00:38:48VarriountWhen will the string be garbage collected?
00:38:56Araqlater
00:39:18VarriountAfter the actual api call has completed?
00:39:46Araqif the API call is blocking, yeah
00:39:52Araqusually it is
00:40:14Araqotherwise you have a problem
00:40:55VarriountOk, thanks for the info.
00:41:39Araqis there a "git unstash" ?
00:41:49dom96git stash apply
00:45:15Araqprojects\gtk2>git push origin master
00:45:16Araqfatal: remote error:
00:45:18Araq You can't push to git://github.com/nimrod-code/gtk2.git
00:45:19Araq Use https://github.com/nimrod-code/gtk2.git
00:45:25Araqgah, I never get this
00:45:48VarriountAraq: I feel your pain. However, it could be worse.
00:46:24VarriountYou could be teaching 10 non-computer-science-interested high school students how to use git.
00:47:55Araqnon-computer-science-interested high school students sounds like girls
00:48:06Araqso that might even be fun :P
00:48:22VarriountNope. A mixture
00:48:41xtagonI wish they tought me git in high school
00:49:23dom96I wish they taught me anything useful relating to computers in high school...
00:49:24VarriountI was leader of the programming team for a local robotics team last year. You would think kids into robotics would be receptive to something like git, but you would be wrong.
00:49:55dom96Robotics team!? Those kids don't know how lucky they are.
00:55:12*dmac joined #nimrod
01:00:11xtagonI took computer programming, game development, and robotics at our homeschool group in elementary school. If I had gone to a brick-and-morter public school instead, I would have missed out on all that fun stuff
01:00:31xtagonGive a kid a bunch of programmable legos, and he will go far
01:01:48xtagonThe most my high school had though was a basic C++ class, but thanks to the internet, you can learn anything on your own :)
01:03:05xtagonVarriount, what sort of robots did your team build? Sounds like fun.
01:04:56dom96Good night
01:05:06*dmac quit (Disconnected by services)
01:05:06*dmac_ joined #nimrod
01:05:10Araqsame here, good night
01:05:26*dmac joined #nimrod
01:05:26*dmac quit (Client Quit)
01:05:41*dmac_ quit (Client Quit)
01:05:51Varriountxtagon: Varied by year. We were part of a global robotics group, FRC. One year we built a robot meant to play a robot version of basketball, another year, ultimate frisbee
01:05:59*dmac joined #nimrod
01:07:31VarriountHuzzah! I now have a pragma cabable of generating helper procedures for all the junk in winlean.nim
01:11:11Araqcongrats and bye
01:38:31*ddl_smurf_ joined #nimrod
01:41:19*ddl_smurf quit (Ping timeout: 260 seconds)
01:41:20*ddl_smurf_ is now known as ddl_smurf
02:07:19LordAndrewHrm. The split string functions only seem to work with chars?
02:08:04VarriountLordAndrew: By chars, you mean, not unicode characters?
02:10:43VarriountOr do you mean, not whole strings?
02:10:50LordAndrewNot whole strings.
02:11:22LordAndrewI wanted to split one large string into multiple strings and store them in a sequence, by splitting them with "<br>".
02:12:23VarriountHuh, I guess there isn't.
02:13:28VarriountLordAndrew: Lemme check the most recent documentation.
02:15:22VarriountLordAndrew: Odd that there isn't an overload of split that accepts strings.
02:15:36VarriountLordAndrew: It would be nice if you could make a procedure which does do that. We could then put it into strutils
02:18:30LordAndrewI'll see if I can cobble one together. Still learning how to use Nimrod.
02:19:40VarriountLordAndrew: Well, I would look at the implementation of split in strutils
02:34:38VarriountLordAndrew: You still there?
02:34:44LordAndrewYes.
02:35:34VarriountIf you aren't super-paranoid about speed, you can use a combination of string slicing and strutils.find/strutils.rfind
02:36:37VarriountFind the first occurance of your word, split the string at that occurance, then repeat with what is left
02:36:55LordAndrewI'll give that a try. I was looking at how split is implemented and it looks kind of simple, but I'm not sure what the * in the proc name is.
02:37:00LordAndrewproc split*(etc)
02:37:09VarriountLordAndrew: That is a visibility marker
02:37:23*ddl_smurf quit (Quit: ddl_smurf)
02:37:25VarriountAny procedure name prefixed by * is public to outside modules
02:37:34LordAndrewAh.
02:37:48VarriountAny other questions?
02:38:14LordAndrewI think I've got it. I'm glad I didn't assume it was something like a pointer.
02:41:10VarriountLordAndrew: Also, something to keep in mind, most things in nimrod that deal with 'ranges' of things are inclusive.
02:44:07VarriountSo if you do "hello world"[3..9] you get character's 3-9
02:53:39LordAndrewHow do you insert something into a sequence? thisSeq += "something" throws an error.
02:54:11VarriountLordAndrew: Insert, or append?
02:55:37VarriountTo insert something, use the 'insert' procedure. To append something, use the '&' operator or 'add' procedure.
02:58:44*DAddYE joined #nimrod
03:01:16*Mordecai joined #nimrod
03:01:55LordAndrewHrm. I seem to be doing something wrong. SIGSEGV: Illegal storage access. (Attempt to read from nil?)
03:02:07*psquid quit (Ping timeout: 272 seconds)
03:02:36VarriountLordAndrew: Can you give me a gist of the code?
03:03:27VarriountBtw, the message you got is the nimrod equivalent of accessing a null value in c, a null pointer error in java, etc
03:05:23LordAndrewhttps://gist.github.com/Lordovos/4b934a4d1e272b0e6386
03:09:05VarriountLordAndrew: You didn't initialize 'lines'
03:09:25*DAddYE quit ()
03:09:33VarriountTo create a new sequence, either assign '@[]' to a previously declared sequence type
03:10:06VarriountAssign @[item] to a var for type inference
03:10:21Varriountor use the newSeq proc (it's a generic)
03:11:32VarriountPersonally, I would do 'var lines = newSeq[string]()
03:12:58*LordAndrew quit (Ping timeout: 272 seconds)
03:19:47*LordAndrew joined #nimrod
03:20:16VarriountLordAndrew: DId you get my reply about your error?
03:20:38LordAndrewI saw the part about not having initialized the array before my Internet connection died.
03:22:34VarriountTo create a new sequence, either assign '@[]' to a var whose type has already been declared, assign '@[item]' to a new var declaration for a sequence of type 'item'
03:23:01Varriountor, LordAndrew, use the newSeq generic proc
03:23:20VarriountPersonally, I would do 'var lines = newSeq[string]()'
03:24:44VarriountBut you could also do 'var lines: seq[string] = @[]'
03:25:17LordAndrewIs there any sort of difference between the two?
03:26:31VarriountNot in any way you or I would notice. Using the newSeq proc allows you to pre-allocate a number of (nil) values to the sequence, but that's about it.
03:28:02VarriountThere also might be some difference on the machine level, but again - not in any way we would notice.
03:42:45*jcrubino joined #nimrod
03:43:43VarriountLordAndrew: Made any progress?
03:58:57*brson quit (Quit: leaving)
04:00:10*xenagi joined #nimrod
04:01:37LordAndrewVarriount: Almost. There's a weird blank element at the start of the array though. https://gist.github.com/Lordovos/4b934a4d1e272b0e6386
04:03:09VarriountLordAndrew: Is this an attempt for a split proc, or something else?
04:03:53VarriountAlso, you don't have to stringify len(lines), echo will take care of that
04:05:00LordAndrewAh, whoops. Didn't realize that.
04:06:14LordAndrewAnd yes, it's an attempt at a split proc.
04:06:53VarriountLordAndrew: You don't have to put the type for every var, just where the compiler isn't smart enough to infer the type (usually for containers or generic types)
04:07:53VarriountSorry if I sound like I'm harping, I just can't tell if somethings part of your preferred style, or out of not knowing.
04:08:33LordAndrewI wasn't sure if it knew or not, haha. Some of the examples have the type specified, and others don't. :S
04:09:05VarriountAnother piece of advice: There is a repr() procedure which acts like the stringify procedures, except that it works for vastly more types (however, it can't be overloaded/overwritten)
04:09:26LordAndrew...wait, what the heck? I just noticed it's putting the strings into the array in reverse.
04:09:30VarriountIf you use repr on a string, you can see the pointer to the string, as well as any control characters
04:09:39VarriountLordAndrew: That is because you are using insert
04:09:43LordAndrewhttp://puu.sh/6q0AT.png
04:10:24VarriountTry '&' or 'append', they're less expensive, as they don't have to shift blocks of memory
04:10:54VarriountEr, not 'append', 'add'
04:11:41VarriountLordAndrew: The empty string is the remainder of what is left after you have found all the occurrences of the seperator.
04:11:57LordAndrewAha. The blank is at the end now with add. Okay, that makes more sense.
04:12:25*jcrubino quit (Ping timeout: 272 seconds)
04:12:31VarriountLordAndrew: I came across a similar problem in my quick implementation of split()
04:16:16*foxcub joined #nimrod
04:18:29LordAndrewhttp://puu.sh/6q12Q.png Strange.
04:18:43xtagonIn Nimrod is there a way to format strings inline, without the % operator? Like in some languages you can do "Hello, #{person.name}!" instead of "Hello, $#" % [person.name]
04:19:08xtagonCan it be done with macros/templates?
04:19:27Varriountxtagon: It can be done with macros/templates
04:19:46Varriountxtagon: It may be done already. I'll look.
04:19:51xtagonThanks :)
04:20:30VarriountLordAndrew: I can't remember if len takes into account the null char at the end or not :/
04:21:01xtagonI'm also wondering...is there any way to do namespacing, or are modules always on the top level? How does one separate third-party dependencies from project-specific imports?
04:21:31Varriountxtagon: You can do namespacing (look at how nimrod's libs are layed out)
04:22:08Varriountxtagon: I believe some things must be done using a project specific configuration file. Beyond that, I'm not sure.
04:22:26VarriountI have not had much experience with nimrod projects, outside of nimrod itself.
04:23:00VarriountI would look on github or bitbucket, or ask again in about 5-6 hours.
04:23:03xtagonOh I see, it looks like you're supposed to do import "foo/bar"
04:23:10xtagonThanks, sorry for all the dumb questions.
04:23:19VarriountI don't mind. I enjoy helping
04:24:05LordAndrewHmm. Are strings by default terminated with \0?
04:24:24VarriountLordAndrew: I believe string literals are.
04:25:14VarriountAgain, I don't know if len() takes that into account or not. Chop the end off of a string literal and display it - is it still visibly the same?
04:25:18foxcubVarriount: got a minute to look at some code and tell me if there is a bug in Nimrod, or if I'm missing something?
04:25:24LordAndrewvar a = "a"
04:25:29LordAndrewecho(len(a)) # 1
04:25:36Varriountfoxcub: Yep
04:25:41foxcubhttps://bitbucket.org/mrzv/serialization/src
04:25:47foxcubLook in examples/bintree.nim
04:26:06foxcubIt imports tables, if it doesn't the code gives an error that in archive.nim, hasKey is not found.
04:26:13foxcubBut archive.nim itself imports tables.
04:26:17foxcubWhat's going on?
04:26:17*jcrubino joined #nimrod
04:27:09Varriountxtagon: The string formatting you're looking for doesn't appear to be in the stdlib. I can say, however, that it should be quite possible with a macro
04:27:46VarriountHello jcrubino
04:27:58xtagonVarriount, I'll let that be an exercise for me then. I need to learn more about macros anyway
04:27:59jcrubinohi
04:28:21xtagonLordAndrew, see http://nimrod-lang.org/tut1.html#strings regarding strings and \0
04:28:33Varriountxtagon: Get ready to get your hands dirty. AST handling can be very finicky.
04:29:18VarriountThough, what you're doing sounds simpler than what I just did, which was generating 2 different procs, each slightly different, using a macro pragma
04:29:35*vbtt joined #nimrod
04:29:41xtagonDifferent in what mannor?
04:30:03xtagonmanner*
04:30:26Varriountxtagon: https://gist.github.com/Varriount/8500498
04:30:48VarriountIt'll only run on windows (or possibly wine) just so you know.
04:31:35VarriountMan, you guys are unlucky. All the others live in Europe mainly, and are asleep right now.
04:31:44VarriountAll you have is me. :/
04:32:32xtagonLooking at that macro, all I can think is "At least you didn't have to write it in C."
04:34:30Varriountxtagon: *shudder*
04:35:09Varriountxtagon: Actually, I like to think that it's fairly straightforward. The complicated parts are when I have to cover all the corner cases in the ast
04:35:36LordAndrewI wonder if I could get away with just removing the last element if it has a length of zero.
04:35:49VarriountLordAndrew: Want to see my implementation?
04:35:56LordAndrewVarriount: Sure.
04:36:21Varriountfoxcub: I think you found a bug in the library. It has to do with template binding and symbols.
04:36:33LordAndrewalso dangit i keep trying to throw in semi-colons and braces into my code
04:36:40foxcubVarriount: explain
04:36:54foxcubAlso how do I report Nimrod bugs?
04:36:59foxcubOn Github?
04:37:23foxcubI'd like to boil it down to a smaller example, but so far I haven't succeeded.
04:39:29Varriounthttps://gist.github.com/Varriount/8500547
04:39:36VarriountLordAndrew: ^
04:40:29Varriountfoxcub: Lemme track down the precise error.
04:40:38foxcubVarriount: thanks
04:41:48LordAndrewVarriount: That looks way different from what I came up with. :P
04:41:53Varriountxtagon: I like to think that my macro is rather straightforward. The odd parts are where I have to cover the corner cases, such as where a procedures "name" node can either be an identifier node (if it is private) or a postFix node (if it has a '*' after its name)
04:42:01VarriountLordAndrew: Not totally.
04:42:34VarriountLordAndrew: I just don't accumulate my result in a sequence, and use more variables.
04:43:36xtagonVarriount, I see. So macros work directly with the AST? How do templates differ?
04:45:33VarriountTemplates are more like formatting a string with input
04:45:59Varriountexcept, you are formatting source code.
04:46:31xtagonSo that's more like C macros?
04:48:00VarriountYes. Except that you get automatic hygienic variables and such
04:51:31Varriountfoxcub: I think you might have found a wierd error in nimrod's importing mechanism
04:52:20foxcubVarriount: I believe you. Perhaps, I ping Araq the next time he's online.
04:54:17Varriountfoxcub: The problem is that you and he seem to have timezones that don't overlap very well
04:54:37VarriountYou could always PM him now, or use memoserv
04:54:53foxcubI don't know how that works. I'm not so great with IRC.
04:55:01LordAndrewWhat does the yield keyword do in your snippet, Varriount?
04:55:20Varriountfoxcub: pm's are private messages, like a private channel between two users.
04:56:11Varriountfoxcub: Memoserv is an irc service (like nickserv and chanserv) which allows you to send and store memos. It's like a really advanced, irc-network-wide bot
04:56:33VarriountLordAndrew: 'yield' is a keyword used by iterators to yield a result.
04:56:56foxcubVarriount: I see. Ok, if I can't find him tomorrow, I'll send this PM.
04:59:17Varriountfoxcub: Does test.nim work?
04:59:26foxcubEverything works.
04:59:32foxcubBut not without import tables
04:59:52VarriountWell, I salute you nonetheless on some nice code.
05:00:04foxcubVarriount: thanks
05:00:23VarriountI see that you emulated python's with open() style. :P
05:01:09foxcubWhat do you mean?
05:01:22Varriountthe withOpen() tempalte
05:01:25Varriount*template
05:01:25foxcubwithFile?
05:01:32VarriountEr, yes, that
05:01:32foxcubThat's out of Nimrod's doc.
05:01:34foxcubNot my idea.
05:01:43VarriountOh. *shrug*
05:01:55foxcubBut it's a nice style, indeed.
05:07:28Varriountfoxcub: I explicitly changed the erroring line in archive.nim to "tables.hasKey(a.pointers[], ix)"
05:07:39Varriountand the error shifted to line 43
05:07:56foxcubOh, interesting.
05:07:58foxcubLet me try that.
05:08:46foxcubAh, brilliant.
05:08:50foxcubThat works. I get no errors.
05:08:56VarriountOh?
05:09:04foxcubAh, spoke too soon.
05:09:05foxcubNever mind.
05:09:31Varriountfoxcub: I think it also might have something to do with the large number of generic procedures that are being used. They might be confusing the compiler about what procedure to use
05:10:20foxcubVarriount: but it shouldn't
05:10:30foxcubThe problem in line 43 is the same.
05:10:38foxcubInstead of hasKey, it's with []=
05:10:44VarriountI know that, and you know that, but I'm not sure the compiler knows that.
05:10:50foxcub;-)
05:10:56foxcubWe'll see what Araq says.
05:11:56*vbtt quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
05:11:58VarriountIf I didn't know better, I'd say that whatever structure holds the list of overloads for particular procedures is losing certain ones.
05:12:15VarriountIt's very.. irritating.
05:12:59foxcubWell, it seems the consensus is that it's a bug, so I just need to report it properly. I wish I had a smaller example that produced it.
05:13:09*jcrubino quit (Ping timeout: 248 seconds)
05:13:56Varriountfoxcub: Well, how many generics and other procedures can be removed?
05:15:31VarriountAnd anyway, your 'test case' isn't all that big. It's about.. 180 lines altogether, and for a bug this obscure, I'm not surprised that it isn't more.
05:15:36LordAndrewHhhuh, so yield is like return where it sends info back to something, but it doesn't stop the procedure.
05:15:39foxcubHm, I don't know. They are kind of interdependent. I tried to create a simple example from scratch, but it wouldn't fail.
05:16:21Varriountfoxcub: The only advice I can give is to remove things until what you have starts working.
05:16:30foxcub;-)
05:16:35foxcubOk
05:16:44VarriountI like to call it "The Jenga Method"
05:17:24foxcubIn any case, thanks for your help. I'll bug Araq with this question.
05:25:53*jcrubino joined #nimrod
05:26:12VarriountAlright, I'm about to head to bed. LordAndrew, foxcub, xtagon, any questions?
05:26:31foxcubHave a good night.
05:26:36xtagonVarriount, nope. Good night :)
05:26:47LordAndrewI'm all good. Thanks for the help, Varriount.
05:39:25*xenagi quit (Quit: Leaving)
06:14:44*LordAndrew quit (Ping timeout: 272 seconds)
06:15:39*[1]Endy joined #nimrod
06:24:26*foxcub quit (Quit: foxcub)
06:29:50*foxcub joined #nimrod
06:36:09*xtagon quit (Quit: Leaving)
06:49:55*Demos joined #nimrod
07:03:13*foxcub quit (Quit: foxcub)
07:12:14*jcrubino quit (Ping timeout: 264 seconds)
07:22:43*delian1 joined #nimrod
07:24:00*jcrubino joined #nimrod
07:25:16*capisce_ joined #nimrod
07:25:54*aftershave quit (Ping timeout: 264 seconds)
07:26:03*capisce quit (Ping timeout: 264 seconds)
07:27:55*aftershave joined #nimrod
08:11:42*Demos quit (Ping timeout: 265 seconds)
08:29:56*Varriount quit (Read error: Connection reset by peer)
08:50:23*io2 joined #nimrod
09:06:29*delian1 quit (Quit: Terminated!)
09:06:44*delian1 joined #nimrod
09:07:05*delian1 is now known as delian66
09:38:15*dmac quit (Ping timeout: 260 seconds)
09:44:26*io2 quit ()
09:44:26*zahary quit (Read error: Connection reset by peer)
09:44:56*zahary joined #nimrod
09:45:17*io2 joined #nimrod
09:56:35*jcrubino quit (Ping timeout: 272 seconds)
10:01:40*[2]Endy joined #nimrod
10:05:14*[1]Endy quit (Ping timeout: 252 seconds)
10:15:57*io2 quit (Ping timeout: 272 seconds)
10:21:25AraqOrionPK: PR against devel?
10:31:51*zahary quit (Ping timeout: 260 seconds)
10:40:21*zahary joined #nimrod
10:51:26*faassen joined #nimrod
10:54:42*zahary1 joined #nimrod
10:54:42*zahary quit (Read error: Connection reset by peer)
10:56:12*odc joined #nimrod
11:01:10*faassen quit (Quit: Leaving.)
12:37:31*aftersha_ joined #nimrod
12:47:02*aftersha_ quit (Quit: Computer has gone to sleep.)
12:47:20*aftersha_ joined #nimrod
12:49:20*aftersha_ quit (Client Quit)
12:51:09*aftersha_ joined #nimrod
12:51:31*aftersha_ quit (Client Quit)
13:19:48*renesac joined #nimrod
13:22:56renesachi, I started toying with nimrod, and the manual says that narrowing type conversions should be explicit (ok), but don't shows how I make explicit conversions
13:26:19*darkf quit (Quit: Leaving)
13:27:15EXetoCrenesac: targetType(x), or x.targetType (syntactic sugar)
13:32:25EXetoCit shouldn't be necessary when the original value is a literal, but it needs to fit of course
13:35:23renesacthanks, I was trying to narrow the output of math.random()
13:41:00renesacit would be more efficient using casts, but I would have to narrow it down anyway as it seems to provide only 63bits of randomness
13:41:12renesac(I'm filling an array)
13:48:54renesacby the way, how I make a vector/dinamic array?
13:50:16EXetoChttp://build.nimrod-lang.org/docs/manual.html#array-and-sequence-types
13:54:36EXetoCcast away if you really need to
14:20:49*foxcub joined #nimrod
14:23:05renesacoh, I missed sequences, thought they were only sequential numbers of a type, and was looking in openarrays
14:23:36renesacthere should be an example using newseq[type](len)
14:24:15renesacwell, the documentation needs much more examples... especially in the modules
14:25:17renesacand I managed to get an internal error from the compiler w/o stack traceback
14:25:18renesac\o/
14:25:23renesacit was my fault though
14:28:47EXetoCI don't know about that. It should never happen
14:28:52EXetoCnot passing "-d:release" to koch might help
14:32:29EXetoCwith stack traces of course
14:37:13renesacright, minimum working example:
14:38:04renesaclet x = seq.high # save it as error.nim
14:38:16renesacnimrod c -r error.nim
14:38:47renesacshould I file a proper bug report?
14:39:34EXetoCit compiles on a recent build
14:40:04renesacoh, I'm on 0.9.2
14:56:44EXetoCit's recommended to use HEAD. a lot has happened since 0.9.2, and many libs aren't compatible with it
14:57:10EXetoCwas the executable bit removed from the build scripts?
15:03:59renesacthe documentation on nimrod-lang is syncronized with HEAD or 0.9.2?
15:04:14Araq0.9.2
15:04:27Araqnimbuild has quite up to date docs
15:05:45renesacoh, only for the standard library right?
15:05:57renesacthe language itself changed much since 0.9.2?
15:07:32Araqno, for everything: http://nimbuild.nimrod-lang.org/
15:08:29Araqthe language itself is changing a bit but we have a clear deprecation path
15:09:39Araqwhich most people here disagree with, they think it's better to break things asap
15:12:02renesacoh, the documentation link in http://build.nimrod-lang.org/ leads directly to http://build.nimrod-lang.org/docs/lib.html
15:12:11AraqI know
15:12:21renesacso I wasn't finding the language manual
15:12:24Araqwe'll fix that eventually
15:12:28renesacright, thanks
15:26:25Araqoh btw welcome renesac! :-)
15:26:49Araqwhere are my manners today
15:30:40*LordAndrew joined #nimrod
15:31:18OrionPKaraq thanks for reminding me, I should have a bit of time the morning
15:33:22renesacAraq: thanks, I'm just another programmer in the endless quest to find a better C
15:33:24renesac;)
15:34:45Araquse --os:standalone and you get that better C
15:35:05AraqI wanted to blog about how to write a python extension in nimrod, but I never find the time
15:35:27LordAndrewHi there.
15:37:28Araqhi LordAndrew
15:37:29renesacAraq: I'm not aiming that low, XD
15:38:32renesacand about python, you would have to show where nimrod is better than Cython
15:41:05LordAndrewI was curious: what are the files in nimcache that seem to be generated?
15:42:28EXetoCit's everything the C compiler deals with
15:42:53EXetoCthe output should give you that information
15:43:10EXetoCby default anyway. "gcc -o..." for example
15:43:48EXetoCwell, C by default, but there are several backends
15:44:26renesacbtw, is there a nimrod interactive interpreter?
15:46:28renesacit would be handy for experimenting and learning like I'm doing now...
15:47:27Araqwhy? Cython has exactly the shit of a type system that I would imagine
15:47:57LordAndrewAh. What does Nimrod's compiler use GCC for anyways?
15:47:58Araqplus an ugly syntax
15:48:16EXetoCLordAndrew: for compiling the generated C code
15:48:44EXetoCinvoke "nimrod" and see the command section
15:49:25renesacAraq: but it is derived from python, and is becoming standard for python modules that needs more performance
15:50:21renesaceven if technically inferior, it is probably the main alternative
15:51:07EXetoCLordAndrew: "nimrod --advanced" will show you the other available backends, and an asm backend is being worked on
15:51:35renesacwhich asm?
15:51:56Araqrenesac: we have "nimrod i" for an interactive shell but that's quite unusable for anything
15:54:08EXetoCrenesac: for quite a few architectures I think
15:54:51renesacbased on LLVM or something?
15:55:17NimBotAraq/Nimrod devel 21aa955 Araq [+0 ±54 -0]: 'nil' as a statement is deprecated, use an empty 'discard' instead
15:55:40EXetoCrenesac: made from scratch
15:55:44EXetoCAraq: right?
15:55:48Araqright
15:56:12Araqbut the C backend is not going anywhere
15:56:51renesachum
15:57:20LordAndrewDoes GCC just compile the code? Or does it link libgcc/glibc to the executables Nimrod generates as well?
15:58:49renesac"nimrod i" is cool, but I couldn't get a 'for' to work
16:00:49EXetoCit's pretty unusable atm like he said
16:01:14renesacyeah....
16:01:20AraqLordAndrew: it links with C's stdlib
16:01:55*io2 joined #nimrod
16:10:15*[2]Endy quit (Ping timeout: 272 seconds)
16:18:56*Varriount joined #nimrod
16:19:08EXetoCis child(PXmlNode) not recursive? I'm trying to scrape the internets, but maybe I should stick to python
16:19:20EXetoCor I could attempt to wrap lxml or something
16:19:45AraqPXmlNodes are recursive ...
16:20:47AraqVarriount: the trailing binary zero is not part of the lenght and an implementation detail. you don't have to care about it, it just works
16:20:57Araq*length
16:21:12VarriountEh... What?
16:21:20VarriountOh, about the strings. Yeah
16:24:18VarriountAraq: Speaking of strings, did you see my implementation of split(s, sep:string) ?
16:24:31Araqno
16:24:42Araqdidn't gradha already provide this one?
16:25:03VarriountIf he did, it hasn't been merged into any of the branches.
16:27:24VarriountAraq: There is no split(s, sep:string) implementation in the master or devel branches.
16:29:12VarriountAraq: There's a re.split, but that requires pcre
16:29:35VarriountAraq: Here's my implementation. -> https://gist.github.com/Varriount/8500547
16:32:20AraqVarriount: substr is slightly more efficient than [..]
16:32:33Araqdon't yield twice
16:33:05Araqfind has a "start" argument so no need to slice
16:33:15VarriountOk.
16:33:43VarriountI'm surprised that you don't want me to inline the entire find() proc :P
16:49:15Araqno, iterators need to be as small as possible as they already are inlined
16:49:22Araqbut btw
16:49:33Araqyou should use findAux or whatever I called it
16:49:43Araqso that the temporary data structure is reused
16:52:11OrionPKaraq https://github.com/Araq/Nimrod/pull/822
16:53:08AraqOrionPK: irc.nim looks suspicious
16:53:20Araqwhy got the 'ret != 0' removed?
16:53:40OrionPKthats not being checked anywhere else
16:53:56OrionPKI'll add it back
16:54:02Araqok
16:56:01OrionPKk, updated
16:57:44*jcrubino joined #nimrod
17:00:31*aftersha_ joined #nimrod
17:02:10NimBotAraq/Nimrod devel 9885240 Erik O'Leary [+0 ±5 -0]: Corrected prunesocketset and pruneprocessset... 3 more lines
17:02:10NimBotAraq/Nimrod devel b0a5bab onionhammer [+0 ±1 -0]: Added ret != 0 back
17:02:10NimBotAraq/Nimrod devel 568ea12 Andreas Rumpf [+0 ±5 -0]: Merge pull request #822 from onionhammer/devel... 2 more lines
17:04:19Araqplease close https://github.com/Araq/Nimrod/pull/655 then
17:05:23OrionPKk
17:10:00*Mordecai quit (Read error: Operation timed out)
17:10:33*Mordecai joined #nimrod
17:13:28*ddl_smurf joined #nimrod
17:15:06*foxcub quit (Quit: foxcub)
17:17:30EXetoCdoes findAll(PXmlNode) not recurse further when said tag is found?
17:20:29VarriountAraq: What exactly is this 'TSkipTable'used in auxFind?
17:24:29VarriountIt's not initialized with a length, yet it's an array type, and it's used.
17:38:19AraqEXetoC: dunno check the source
17:39:20AraqVarriount: use it as a black box or check out booyer-moore-algorithm
17:40:09VarriountAraq: I tried examining it, but nimrod -i's repr returns nothing
17:40:28VarriountIs that just a side effect of using the vm?
17:40:59Araqno idea
17:51:09*aftersha_ quit (Quit: Computer has gone to sleep.)
17:52:13*randallsquared quit (Quit: WeeChat 0.4.0)
17:55:03*tdc joined #nimrod
18:06:41tdchttp://pastebin.com/56DfEL4H
18:06:56tdcdoes anyone have a hint on how I can debug this?
18:08:30Araqdom96: can you help tdc?
18:08:55renesacEXetoC: I'm still getting an error compiling my code with the latest build from nimbuild
18:09:15renesacNimrod Compiler Version 0.9.3 (2014-01-13) [Linux: i386]
18:09:22renesacError: internal error: value expected, but got a type
18:09:23renesacNo stack traceback available
18:09:53tdcI tried adding a breakpoint to proc recv*() at line 1080. I can see it and enable it in the debugger but the breakpoint isn't hit
18:09:56EXetoCwell, I passed it a seq, not a type
18:10:26dom96Araq: Sounds like he needs your help more than mine.
18:10:38renesacoh, the line that gives that error is exaclty "let x = seq.high"
18:11:07renesacI know it is an error, but it shouldn't cause the compiler exiting w/o pointing the line
18:11:13dom96tdc: The Nimrod debugger may still have some issues I think. We usually debug by using 'echo'.
18:12:02Araqrenesac: the error message could be better, but it's rather hard to do that
18:12:08tdcokay - np I wasn't whether it was the debugger or if I'm missing something. I am very new to Nimrod
18:12:57dom96tdc: Which version of Nimrod are you using?
18:13:06Araqthe debugger works for me but doesn't trace the stdlib
18:13:07tdcgithub master
18:13:18dom96hrm, good.
18:13:25renesacright, it was sufficient for me because I just modified that and tried to compile
18:14:08dom96sockets.nim(1295) doesn't seem to have a call to OSError, odd.
18:15:23EXetoCrenesac: and seq actually is a sequence?
18:16:14tdcIt would be 1294 for you, because I added a {.breakpoint.}
18:17:33renesacno, I think it is really the type
18:17:50renesacin the error.nim file, that is the first and only line
18:18:04dom96tdc: I see. Well, it's a strange error.
18:18:32tdcrecv return < 0 but errno appears to be 0
18:18:42renesacthe problem is only the compiler exiting w/o giving the line where the error happened
18:18:57EXetoCrenesac: ok so you don't have a var with that name. it shouldn't work either way
18:19:07EXetoCyes there are still plenty of compiler bugs
18:19:34renesacyes, as I said on the first time, it was my fault
18:19:47dom96tdc: The only explanation I can see is that something is resetting errno. That used to be a bug which I thought was fixed, maybe it's back.
18:20:54tdcthe reason it doesn't work is because the site is using ssl. It works fine for a regular get
18:22:36dom96oh yes. Change the osError to socketError
18:23:24dom96It needs the socket so: socket.socketError()
18:25:04tdcwell - Not enough data on socket makes more sense at least.
18:26:58tdcalthough it shouldn't really fail because I don't get the error when using Python
18:27:19dom96I thought that that error can only happen with non-blocking sockets
18:28:51EXetoCAraq: no findAll doesn't, but I suppose it should. I could add a parameter or two to control that
18:29:39AraqEXetoC: find does i think
18:30:16dom96tdc: Yeah, that error doesn't make sense. If there is not enough data then it should wait for more.
18:31:53tdcit happens when it tries to receive the first byte. I thought it might use the "when ssl" section of the code but it's before that.
18:32:16Varriounttdc: What version of nimrod are you using?
18:32:23dom96tdc: Maybe it didn't handshake.
18:32:37VarriountThe 9.2 release, master branch, or devel branch?
18:32:42dom96Varriount: I already asked him: master
18:32:50VarriountOh. Sorry
18:34:07EXetoCAraq: do you mean findAll? because I only see find.
18:34:16EXetoCI think I had to turn the elif into an if
18:34:24dom96tdc: Check the precise error code you get. There are 4 possibilities: SSL_ERROR_WANT_CONNECT, SSL_ERROR_WANT_ACCEPT, SSL_ERROR_WANT_WRITE, SSL_ERROR_WANT_READ
18:35:20*foxcub joined #nimrod
18:37:12tdcNimrod Compiler Version 0.9.3 (2014-01-19) [Linux: amd64]
18:38:54tdcHow can I print the error code? Is it on the socketError?
18:39:51dom96line 346
18:39:54dom96just echo ret
18:40:33*[1]Endy joined #nimrod
18:41:03tdcReturn-code 2
18:42:15renesac'shl' don't work with uints??
18:46:04Araqimport unsigned
18:47:39*foxcub quit (Read error: Connection reset by peer)
18:48:11*foxcub joined #nimrod
18:48:27renesacoh, thanks
18:49:30*dmac joined #nimrod
18:50:13*io2 quit (Ping timeout: 272 seconds)
18:53:15tdcIs the SSL_read expected to occur in blocking or non-blocking mode?
18:53:57dom96there is no expectation
18:55:45tdcSorry if it's a dumb question but does Nimrod not have a default?
18:56:45dom96No. You set whether a socket is blocking or non-blocking with the setBlocking proc
18:56:55dom96Well, the default is blocking.
18:57:18tdcokay, seeing that I am not using setBlocking I will assume it is blocking then
18:58:04dom96If you're using httpclient then you wouldn't be using setBlocking manually anyway. Httpclient would do it, but httpclient is certainly doesn't.
18:58:06dom96s/is//
18:58:29tdcmaybe renegotiation is taking place. I tried a similar program in golang and that failed because renegotiation is not supported
18:58:54dom96Maybe, there is a function which needs to be called to finalise a handshake.
18:59:01dom96It it called in connect IIRC
18:59:07dom96Might be useful to look into that.
18:59:18tdcand the Openssl docs mention that SSL_read might return SSL_ERROR_WANT_READ if renegotiation takes place
18:59:41dom96and what should be done in that case?
19:00:15tdcSet SSL_MODE_AUTO_RETRY with SSL_CTX_set_mode
19:00:32dom96ahh, do it then.
19:00:34tdcI need to go away for a bit but might try this in an hour or so
19:00:43dom96Alright, if it works please create a PR.
19:00:51tdcWill do. thanks for your help
19:05:47*Varriount quit (Ping timeout: 272 seconds)
19:06:48*foxcub quit (Quit: foxcub)
19:15:53*Varriount joined #nimrod
19:16:19Araqwhat should news.txt contain?
19:16:35Araqsockets.select now returns * instead of * ?
19:17:44Araqdom96?
19:18:04dom96sockets.select now prunes sockets that are **not** ready from the list of sockets given to it.
19:22:43Araqexcellent, thanks
19:25:33NimBotAraq/Nimrod devel 96f7fd9 Araq [+0 ±5 -0]: compiler warns when you use GC'ed memory and '--gc:none'
19:25:33NimBotAraq/Nimrod devel 1c489f0 Araq [+0 ±5 -0]: Merge branch 'devel' of https://github.com/Araq/Nimrod into devel
19:27:33*aftersha_ joined #nimrod
19:27:52VarriountAraq: Has foxcub contacted you about the strange import bug he found?
19:28:13Araqsure and I replied
19:28:29Araqit's f(a, b) vs a.f(b) in a generic context
19:28:35Araqa known bug
19:30:11*io2 joined #nimrod
19:33:43*Mordecai is now known as psquid
19:34:49*dmac quit (Ping timeout: 272 seconds)
19:34:53*Mat3 joined #nimrod
19:35:47Mat3hi
19:36:10VarriountHey Mat3, how's your secret project?
19:36:47OrionPKthe same is true for osproc select
19:37:10AraqOrionPK: you didnt fix osproc select, did you?
19:39:25Mat3Varriount: fine, it's not secret - I'm working beside on the documentation
19:40:25VarriountMat3: It is to me, since I hardly know what you're working on.
19:40:29Varriount:P
19:44:13Araqsee you later guys
19:44:45Mat3a Nimrod subset with stand-alone environment for embedded boards (somethink similar to this: http://www.eluaproject.net/)
19:44:54Mat3^something
19:45:01VarriountOoh, interesting.
19:45:09Mat3hi Araq
19:45:26VarriountI wonder if nimrod would be a good replacement as a language for programming FRC robots.
19:45:47VarriountCurrently only C++, Labview, and Java are really used.
19:49:45Mat3you forget Forth and Erlang (only to mention a few other alternatives)
19:50:37Mat3anyhow why shouldn't Nimrod be suited for this kind of applications ?
19:50:54VarriountI don't know.
19:57:23*wat_ joined #nimrod
19:58:43VarriountAraq: How do I get the tester to output to something other than a database?
19:58:56VarriountOr take a database and output it to json?
20:02:34VarriountNevermind
20:12:36wat_hey guys, I've been checking out nimrod and having fun with it, but references confuse me a little bit
20:12:52wat_I get that new creates a garbage collected reference, but
20:13:41wat_if I make a reference to an integer and pass it to a function expecting an integer I get a type error, how do I dereference the variable to turn the reference into a value?
20:13:57Varriountwat_: Can I see your code?
20:14:21wat_ let me do something simple
20:15:40Varriountwat_: Use gist.github.com, if what your are doing is longer than a single line.
20:16:03*xtagon joined #nimrod
20:16:13Mat3hello xtagon
20:16:26xtagonHey Mat3
20:17:02VarriountHi xtagon, make any progress on that macro?
20:17:16Mat3see yozu later guys
20:17:19Mat3^you
20:17:20xtagonVarriount, haven't given it a go yet. I still need to read the manual on macros
20:17:44*Mat3 quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
20:17:55Varriountxtagon: Here's a procedure that might help you: http://nimrod-lang.org/system.html#705
20:17:57wat_https://gist.github.com/anonymous/6bb1f9b90cc957480b67
20:19:54xtagonVarriount, it says that proc returns something other than the documented return type. How is that possible in a type safe language?
20:20:39Varriountxtagon: TObject is a base object type
20:20:58xtagonOh, right.
20:20:59Varriountxtagon: Nimrod isn't so typesafe that you can't break out or go around
20:21:10wat_I noticed that there were finalizers for gc references, are there finalizers for raw ptrs like destructors / smart pointers in c++?
20:22:02wat_I have to run so I won't be able to reply, but nimrod is pretty interesting, keep up the good work!
20:22:03Varriountxtagon: Locals can also do that because it is a magic proc, and likely a compile time one as well
20:22:19*foxcub joined #nimrod
20:22:28Varriount'magic' meaning that it's built into the compiler
20:22:46xtagonAh
20:26:55Varriountwat_: When the compiler cannot infer whether you need to dereference a ref, you must use the dereference operator, '[]' next to the reference identifier.
20:27:25tdcdom96: fyi - adding SSL_MODE_AUTO_RETRY appears to fix the problem
20:27:46Varriountfoxcub: Araq told me that he explained your problem?
20:27:51tdcI have created an issue on github for it
20:27:53*aftersha_ quit (Quit: Computer has gone to sleep.)
20:27:59xtagonVarriount, so a macro take in an AST object, and returns a modified AST object, yes?
20:28:16Varriountxtagon: Yes
20:28:28foxcubVarriount: yeah, he already knew about this bug. He explained the solution you proposed, but also fixing the call to []=
20:28:40foxcubVarriount: we were basically on the right track, but got confused by something.
20:28:53foxcubAnyway, it was good to get him to look at it.
20:28:55Varriountfoxcub: I'm not surprised. I get confused all the time.
20:29:33foxcubWell, you were exactly on the right track. I don't even remember why we didn't get []= yesterday. I thought I tried exactly what I have there now.
20:31:20Varriountxtagon: For your macro, the macro would probably take in an ast, check that the only node in it is a string literal node, turn the string literal node into a string, and parse it
20:32:26xtagonVarriount, I'm reading the part about "Term rewriting macros" right now. Is that what I need?
20:33:46xtagonI'm a little confused on how the macros are ran. If I write a macro that checks that the only node in it is a string literal node, does the compiler try to run the macro on every expression until it finds one with just a string literal?
20:34:01Varriountxtagon: Yes, *if* you want your macro to work globally
20:34:15xtagonThat sounds expensive, is it?
20:34:21VarriountI have no idea.
20:34:35xtagonI'll find out :)
20:35:07xtagonSo in my check, if it is not only a string literal node, what's the proper way to bail out? Return the AST as is?
20:35:12Varriountxtagon: Another route to take is to create a macro with a short name (such as 'af' for auto-format) and use it as a string prefix
20:35:44Varriountxtagon: Probably. Or error, since then you know something went wrong with your targeting pattern.
20:35:48xtagonVarriount, I like that idea better, because then you only use it when you need it.
20:35:56Varriountxtagon: I do as well.
20:37:39renesacoh, if I declare "var result = x" I mess up with the magic
20:38:05*renesac took a long time to understand why it wasn't working
20:38:37renesaca note about this should be added to the tutorial or manual
20:39:04xtagonVarriount, I can't find in the manual the syntax for making a string prefix macro.
20:39:25xtagonI assume it needs a pragma or something
20:39:56renesac'proc test(): int = var result = 2' returns 0, but if I take the 'var' off it works
20:40:28Varriountxtagon: No pragma needed
20:41:14Varriountany procedure/macro/template which takes a string can be used as a prefix (I think)
20:41:40VarriountI know that procs can be used, I haven't tried it on macros or templates
21:03:06*[1]Endy quit (Ping timeout: 265 seconds)
21:05:07*jcrubino quit (Ping timeout: 272 seconds)
21:07:11xtagonVarriount, I am having a real hard time writing a basic macro that changes a string to another string literal
21:08:11xtagonVarriount, what's the best way to debug the value of and AST node? AFAIK there is no REPL since it is compiled, and I can't just print the repr because it's in a macro, not runtime
21:10:47*tdc quit (Quit: Leaving)
21:11:33*jcrubino joined #nimrod
21:12:35*foxcub quit (Quit: foxcub)
21:19:16dom96xtagon: Use treeRepr
21:19:25EXetoCbacon
21:19:29xtagondom96, thanks
21:20:25EXetoCdom96: are you two part of the dota elite yet?
21:20:40dom96EXetoC: We haven't played in a while.
21:26:24Araqxtagon: tut2 on master contains an excessive tutorial of how to approach creating macros
21:26:41Araqhi wat_ welcome
21:26:45xtagonAraq, great I'll check that out.
21:28:29AraqVarriount: thinking about it, you only need to modify 'replace' to get the 'split' you want
21:33:45Araqping zielmicha-cloud_
21:34:27zielmicha-cloud_Pong
21:34:40Araqoh yay
21:34:50Araqdid I miss a PR for osproc?
21:35:11zielmicha-cloud_Yes.
21:35:26Araqdamn
21:36:14zielmicha-cloud_(It probably won't merge now.)
21:38:27*foxcub joined #nimrod
21:38:49Araqwell since it's somewhat risky please do the PR against the devel branch
21:39:03*Varriount quit (Ping timeout: 272 seconds)
21:39:06Araq"master" is now supposed to be "stable"
21:39:35Araqwhere "stable" looks like a synonym for "dead" but oh well
21:42:16zielmicha-cloud_Ok
21:46:01foxcubAraq: what's the ETA for user-defined type classes?
21:46:26*Varriount joined #nimrod
21:46:37Araqthat's zahary1's business and we don't have a new ETA for 0.9.4 either
21:47:19foxcubOk, cool. I'll ping him. But are you saying user-defined type classes are due in 0.9.4?
21:48:49Araqno, I don't know
21:50:39VarriountAraq, dom96: The builder hub is down.
21:51:39dom96Fixed
21:55:26Araqhmm supporting f g(a, b) is rather simple to do
21:55:34AraqI wonder if it's a good idea
21:56:01Araqlet a = await f(a, b) # sweet, hu?
21:56:40zahary1but isn't this already suppoerted?
21:56:59AraqI don't think so let me check
21:57:19*foxcub quit (Quit: foxcub)
21:57:39zahary1I'm using stuff like "accept foo(x, y)" in the test suite
21:57:54dom96It's not.
21:58:05Araqdo you use let a = accept foo(x, y) ?
21:58:08dom96Not when you're assigning the result to something.
21:58:19AraqnkCommand is currently limited
21:58:29zahary1yeah, I see
21:59:03Araqproc foo(x: int): int = discard
21:59:05OrionPKhow come i cant pass this char* from C into my cstring :\
21:59:05Araqlet x = foo foo(1)
21:59:11OrionPKi keep getting a sigsegv
21:59:19Araq--> invalid indentation
22:00:19AraqOrionPK: my bet: the cause is entirely different
22:00:53OrionPKi've got char key[len]
22:01:00OrionPKfilling it
22:01:02OrionPKprintf("%s", key) works
22:01:18OrionPKthen I pass it to append_header(client, key)
22:01:24OrionPKappend_header is an exportc'd proc
22:01:34OrionPK2nd param is a cstring
22:01:44OrionPKwhen I try to echo it, I get a sigsegv
22:03:38Varriountzahary1: Did you design the caas code for the compiler?
22:03:50zahary1foxcub: I'll try to have a more stable version of the type classes in 0.9.4, but you should know that they are not completely unusable at the moment. if you want to start some kind of library based on them, now may be a good time - you should be able to navigate past the occasional limitations
22:04:31zahary1Varriount: I wouldn't use "designed it". I've spent around a month getting it to work to its current broken state
22:05:01Varriountzahary1: Any reason why 'resetMemory' isn't called after every command?
22:05:12zahary1there are a lot of places in the compiler that are not prepared for perpetual execution, but gradually things will get better
22:06:46xtagonAraq, I read the tut2 on master and tried to write a macro that should return the statement "Hello, $#!" % ["World"]
22:06:55xtagonAraq, but it doesn't work. Mind taking a look? https://gist.github.com/xtagon/7358e7f963526a0ef954
22:07:13xtagonAraq, I get (6, 26) Error: value returned by statement has to be discarded
22:07:23zahary1resetMemory is just an internal proc I used when I was chasing the old memory leaks of the GC. it tries to completely eradicate the effects of the previous compilation, in order for the GC to be required to free all the memory (it was failing to do so and the memory kept growing after each compilation)
22:08:43Varriountzahary1: Currently, in 'serve' mode, the compiler will partially repeat the output of the first command it was given, until the reset command is given.
22:09:12zahary1it's no surprise that resetMemory fixes the problems (it brings the compiler to a completely fresh state), but also it defeats the purpose of the caas
22:09:44Araqxtagon: are you on master or on devel?
22:09:46Varriountzahary1: Not if you want to avoid spawning a new process for each keystroke in an ide, when using the idetools commands
22:09:59xtagonAraq, master
22:10:09Araqtry devel then please
22:10:13zahary1you want to avoid compiling all the code, not just spawning a process
22:11:36xtagonAraq, I was mistaken, I'm on devel. git ref 1aa0b8c
22:11:55Araqxtagon: bug report please
22:12:14xtagonAraq, will do
22:12:22Araqbut try to add a "discard" somewhere
22:12:45VarriountI didn't know a macro could accept an argument type like a string. :/
22:13:28Araqyou should watch my talk then
22:13:48Araqhowever "s" is not a string within the body of the macro
22:13:59zahary1it is now, I've fixed that
22:14:08Araqit's still an AST ... what?
22:14:08zahary1as long as you use static[string]
22:14:23Araq-.-
22:14:28Araqthat was no bug ...
22:15:05zahary1we had this conversation once, most of the uses really need the string, not the AST tree
22:15:13*Varriount hands the Sacred Salmon of Slapping to Araq
22:15:24zahary1we discussed it back when I implemented the compile-time rope formatting in the compiler
22:15:31Araqyeah but I liked the consistency
22:17:01zahary1the problem is that the AST is only usable for built-in types
22:17:20zahary1when you get static[TFoo], the AST is very inconvenient to navigate
22:17:39Araqnot really
22:18:01Araqyou get (1, "ab") for Foo = object a: int; b: string
22:18:30dom96Isn't it simple to get the actual string from an AST node?
22:18:52zahary1so, now dynamic typing is as nice as static typing?
22:18:52Araqyeah it is simple
22:19:05*foxcub joined #nimrod
22:19:52zahary1and there is hardly point in having the AST if it's going to have the same structure each time (nkStrLit "foo"). it only makes sense to preserve it, if you get the AST of the call-site
22:19:56xtagonI'm not sure where I would add "discard"
22:20:33Araqxtagon: before every 'add' call
22:20:39xtagonOkay
22:21:04Araqzahary1: for static[string] you're right but otherwise it's not even guaranteed you get a string literal
22:21:17xtagonIt didn't make a difference
22:21:24zahary1yes, I'm discussing only static[string] here
22:21:45Araqoh ok, well static[string] has other problems
22:21:52zahary1there is value in getting the AST of the call-site, but that's something I want in other situations
22:22:10Araqbut automatic extraction of the value is indeed not one of those
22:22:37zahary1what are the other problems you have in mind?
22:23:49Araqproc foo(x: static[string])
22:24:01Araqproc foo(x: string) # overloaded
22:24:22Araqfoo myVariable # crashes instead of calling foo(x: string)
22:24:36zahary1why does it crash?
22:24:57Araqbecause myVariable can't be evaluated at compile time
22:25:31Araqmaybe I misread your code though
22:25:40zahary1yeah, but the old VM was able to handle it, so we just need to provide more graceful fallback for the new vm
22:26:38zahary1the old VM returns nil when you try to evalConstExpr on a variable, so the first overload is not matched
22:27:04Araqyeah but I wasn't aware that parts of the compiler use that feature :P
22:27:10zahary1:)
22:27:18Araqand I don't know whether it's a good idea
22:28:07zahary1well, there must be a way to tell whether something is evaluatable or not. you have added to your to-do that you want implicitStatic to be the default
22:28:24Araqcurrently we have 'static' and 'const' and f(X) where X is a vector of constants and f has no side-effects as contexts for compile time evaluation
22:29:10Araqnow we get 'foo X' where some "foo" can be overloaded to trigger a compile time evaluation
22:29:42zahary1evaluation of X, right?
22:30:00Araqright
22:30:14zahary1every param can be attempted for constant folding (that's what I thought you mean by implicitStatic by default)
22:30:43AraqimplicitStatic is just an extension of constant folding
22:30:52zahary1but anyway, there should be a way to tell if something is evaluatable or not. I don't see how you can call that a bad idea :)
22:31:01Araqand a rather natural extension
22:31:26Araqwhereas your way might be better handled with a callsite 'static' but I'm not sure
22:33:08zahary1meh, I don't see nothing wrong with it. I even have gone further with the semistatic type. have you noticed it?
22:33:24zahary1type semistatic[T] = static[T] | T
22:33:34Araqyeah ...
22:33:54Araqsaw it and decided to ignore it for now ;-)
22:38:04zahary1btw, I also plan to experiment with more proper definition of "specificity" for the overloading. I've left some notes in typeRel.
22:38:04zahary1static[int] is more specific than int, because every static[int] is also an int, but not every int is a static[int]
22:38:45Araqiirc sigmatch is performance sensitive
22:38:59zahary1similar logic works for generic types as well. seq[seq[T]] is more specific than seq[T]
22:38:59zahary1yes, I know. that's why I said "experiement"
22:39:12Araqyou can try to build an array of function pointers instead of the initial case statement
22:39:28Araqthat should speed up things
22:39:39AraqCPUs got stranger :P
22:40:21VarriountCould any of you spare some time to look at my winApi macro? I would like to make sure that I'm not missing any corner cases and such.
22:40:33Araqarray of function pointers is now faster than computed goto, I think
22:40:59zahary1hrm, that would surprise me
22:42:43Araqalso you could try to get rid of the nkHiddenStdConv crap in sigmatch
22:43:11Araqand the crazy copyTree's that shouldn't be necessary since we keep the original ast anyway
22:43:37zahary1what about the crazy idea with default arguments in non-last positions?
22:43:57AraqI'm fine with that, but don't build a state machine for that
22:44:22Araqdon't go crazy and introduce regex-like matching
22:44:28zahary1I wasn't planning. it will look at each proc individually
22:44:33Araq"hit or miss" should be enough
22:48:40Araqzahary1: one problem is that "evaluable at compile time" is not defined and things get hairy with -d:useFFI
22:49:24AraqIMHO you want full FFI power in a "static" section but in the other contexts a more conservative evaluation
22:51:29zahary1I think most of the users will be happy with the conservative approach when it comes to static params. over time, we will annotate many of the FFI procs like `sqrt` to have noSideEffect and the situation will improve further
22:52:31zahary1the way I see, static gives you one step in convenience over sting literals, because it enables things like concatenations, table lookups, etc
22:52:58*Icefoz joined #nimrod
22:53:22zahary1I don't expect people to call into FFI-heavy things when using APIs expecting static params
22:53:33*Icefoz left #nimrod (#nimrod)
22:54:01Araqoh btw seq[seq[T]] already matches better than seq[T]
22:54:33Araqsee complexDisambiguation :-)
22:55:58xtagonAraq, the macro thing works if I return expr instead of stmt (doh!) so I closed the bug
22:56:14Araqxtagon: ah, makes sense
22:56:28Araqbut the line number is wrong then, right?
22:57:44Araqzahary1: works without constructing a witness, C++ requires witness construction afaik
22:57:49*darkf joined #nimrod
22:58:07xtagonAraq, yeah, looks like the line number is wrong
22:58:34Araqso reopen the bug ;-)
22:58:38xtagonRight-o
22:58:57zahary1I've already committed some of the code. I'm defining subset relationships between the generic types and define "more specific" as "strict subset"
22:59:26Araqthat's what C++ does, right?
23:00:48Araqthe C# guys said they designed overloading resolution with their "components" goal in mind, aka "adding new code shouldn't break old code" but I never checked out how this can possibly work
23:01:53Araq... overloading resolution is fundamentally at odds with this design principle
23:05:38zahary1yes, it is at odds indeed. in generic code it's important to be able to change previously made selections
23:06:10zahary1the C++ rules are similar in spirit, but I didn't bother to look at the implementations in clang/gcc
23:06:57AraqI looked at D's implementation years ago and at FPC's
23:07:05*foxcub quit (Quit: foxcub)
23:07:11Araqdon't bother with these ;-)
23:07:20Araqbut clang might be interesting
23:14:08zahary1it's getting late, I'll be off to bed.
23:14:45Araqone more thing: are you fine with deprecating the "nil" statement?
23:14:55zahary1sure
23:15:48Araqok, good night
23:15:54zahary1:) good night
23:20:21xtagonIs there a way to generate AST nodes in a macro in a more declarative way? i.e. not using add everywhere
23:20:49Araqxtagon: sure thing, there are 3 ways, but 1 of them is broken
23:21:11Araq1. use macros.quote but it's broken
23:21:33Araq2. use parseExpr/parseStmt and embed the ast in strings
23:21:42Araq3. use helper templates and 'getAst'
23:21:49AraqI prefer (3)
23:22:15xtagonCool, I'll look into that
23:22:28xtagonWhere in the docs are the helper templates?
23:23:21AraqI think gradha wasn't aware of these when he wrote that part :P
23:23:53xtagonAh
23:26:16LordAndrewIs there any sort of agreed upon style convention for Nimrod?
23:27:13Araqindent 2 spaces, TypesLikeThis, mostOtherStuffLikeThis
23:27:48Araqconstants are special in that they can start with a lower or an upper case letter
23:28:18Araqold convention uses T for value types and P for pointer-like types but too many people complained
23:29:09EXetoC:<
23:29:40VarriountAraq: What do you think of window api overload procs that auto convert string parameters to widecstring or cstring parameters depending on useWinUnicode?
23:30:39VarriountAraq: Like this -> https://gist.github.com/Varriount/8512434
23:32:10AraqVarriount: I don't mind it, but I think you should leave winlean alone, it's just some internal module really
23:32:27Araqinstead you should split up windows.nim and clean up the cruft
23:32:32Araqnah, just kidding
23:32:44Araqtranslate the important headers with c2nim instead
23:32:51VarriountErm. I've never split up windows.nim
23:33:11Araqwe need better win API wrappers
23:33:33Araqwindows.nim is old and absurdly large
23:33:49AraqI'm quite sure nobody needs even 10% of what's in there
23:33:54VarriountAraq: My mean goal is to have automatic conversion, and since you're against a string to WideCString converter.. this is the next best thing I could come up with
23:33:58Varriount*main
23:34:09Varriount*automatic string conversion
23:34:13Araqoh god no
23:34:33VarriountAraq: What's so bad about it?
23:35:02Araqso to avoid a converter you have 2 procs instead of 1 *everywhere*? I'd rather have the converter then instead
23:35:09*foxcub joined #nimrod
23:35:34VarriountAraq: Actually, 3. And the procs aren't *there*, they're dynamically generated with a macro
23:35:49Araqah yeah
23:35:58LordAndrewautomagic!
23:36:04Araqwell you need this A vs W stuff in importc so a converter doesn't help anyway
23:36:37Araqwhy do we need 3 ?
23:37:36VarriountOne is the proc without an 'a' or 'w' suffix, and no type conversion
23:37:43*jcrubino quit (Ping timeout: 260 seconds)
23:37:55VarriountOne is the proc *with* an 'a' or 'w' suffix, and no type conversion
23:38:11Araqget rid of the suffixes, what's the point?
23:38:15VarriountOne is the proc *without* an 'a' or 'w' suffix, and type conversion
23:38:39Araq2 procs of the same name but one uses A version and the other W version
23:39:57VarriountUh.. Yes?
23:40:25dom96The 2 wrapper procs are exactly the same, except for the name?
23:40:26Araqno need for 3 procs?
23:40:51VarriountWell, they aren't wrappers, they are api imports
23:41:00VarriountBut yes.
23:42:42dom96yeah, you don't need 3 procs
23:43:05dom96And converter looks more sane.
23:43:08VarriountOne moment.
23:43:16LordAndrewIs there a procedure or such that will tell you what type something is? like istype(1) # int, etc
23:43:20dom96This way you will generate twice as much code.
23:43:47*jcrubino joined #nimrod
23:43:51Araqdom96: converter can't work though
23:44:07dom96LordAndrew: http://build.nimrod-lang.org/docs/manual.html#is-operator
23:44:20Araqas a converter can't inject the import: "FooA" vs import: "FooW" stuff, dom96
23:44:27dom96LordAndrew: Although you probably want type(1)
23:44:48VarriountAraq, dom96, look again at my gist
23:45:50dom96Araq: Why are all the importc's importing the W version then in Varriount's gist?
23:46:21Varriountdom96: Because I have to have an example prefix. They could also be the "A" versions
23:46:36*io2 quit ()
23:46:54dom96So there is a define which determines this right?
23:47:41dom96Can't you just declare a const importcSuffix = when defined(useWinASCII): "A" else: "W" ?
23:48:11dom96And then concatenate the literal and the const?
23:48:27Varriountdom96: No, because I can't use that on identifiers, just strings.
23:48:44VarriountAnd that is what my macro does, when calculating the new identifiers.
23:48:58Varriountdom96: I updated the gist again
23:48:59dom96Oh i see.
23:49:59renesac<Araq> I'm quite sure nobody needs even 10% of what's in there <-- the old openoffice problem: nobody uses even 10% of msoffice's features, but everybody uses a different 10%
23:50:09dom96Right. Well I still don't understand why you need 3 procs.
23:50:24VarriountIt gives those who want performance the ability to pass in WideCStrings (Araq) and those who want ease of use auto-conversion (me)
23:50:44Varriountdom96: Why? Which proc do you think could go or be replaced?
23:50:55Araqrenesac: that's only a problem when you have lots of users ;-)
23:51:02dom96Varriount: Either findFirstFile or findFirstFileW
23:51:12dom96Varriount: Either the first proc or the second
23:51:41renesacbe optimistic ^^"
23:52:09dom96Varriount: Ahh, missed your explanation. That makes sense.
23:52:23Varriountdom96: If I pick the former, then you still have to use 'when useWinUnicode: ... else:...' in code using the findFirstFileW or findFirstFileA proc
23:52:37VarriountWhich kinda defeats the purpose of the conversion
23:52:46VarriountEr, the conversion proc.
23:54:02VarriountIf I pick the latter, then people complain about having no distinction between the two unicode/ansi versions of the procs when needed, and we lose backwards compatibility
23:57:23Araqjust do it the way I suggested plus have a $? operator
23:57:45Araq$? either creates a wide string or a cstring depending on some -d:setting
23:57:53Araqproblem solved
23:58:28Araqplus you can always call some other string constructor instead
23:58:45Araqif you don't want the setting to infere
23:58:51Araq*interfere
23:59:33VarriountAraq: I assume you're talking about the third proc, the conversion procedure generated for unicode api?
23:59:40Varriount*for the