<< 13-07-2015 >>

00:02:49*zaquest joined #nim
00:04:34*flaviu quit (Ping timeout: 244 seconds)
00:07:06*zaquest quit (Ping timeout: 246 seconds)
00:09:00*xet7 joined #nim
00:09:11*flaviu joined #nim
00:10:03*zaquest joined #nim
00:14:57*zaquest quit (Ping timeout: 264 seconds)
00:19:22*zaquest joined #nim
00:23:57*zaquest quit (Ping timeout: 264 seconds)
00:24:03*brson joined #nim
00:25:07*X67r quit (Quit: leaving)
00:26:43*zaquest joined #nim
00:31:05*zaquest quit (Ping timeout: 252 seconds)
00:33:30*flaviu quit (Ping timeout: 250 seconds)
00:34:26*yglukhov___ joined #nim
00:36:17*flaviu joined #nim
00:36:19*zaquest joined #nim
00:39:03*yglukhov___ quit (Ping timeout: 256 seconds)
00:40:45*flaviu quit (Ping timeout: 256 seconds)
00:40:46*zaquest quit (Ping timeout: 265 seconds)
00:44:59*zaquest joined #nim
00:52:20*flaviu joined #nim
00:53:01*unclechu quit (Quit: Leaving.)
01:08:50*vasher_ quit (Quit: Connection closed for inactivity)
01:16:44*apense joined #nim
01:22:42*EXetoC quit (Ping timeout: 246 seconds)
01:24:23*jaco60 quit (Ping timeout: 256 seconds)
01:25:13*brson quit (Ping timeout: 246 seconds)
01:26:12*vendethiel quit (Ping timeout: 264 seconds)
01:26:58*brson joined #nim
01:27:26*kfm2 left #nim (#nim)
01:44:18*brson quit (Quit: leaving)
01:46:22*gyeates quit (Ping timeout: 248 seconds)
02:40:36*darkf joined #nim
02:42:19*Jesin quit (Quit: Leaving)
02:44:35*Jesin joined #nim
02:48:41*vendethiel joined #nim
03:06:25*vasher_ joined #nim
03:16:52*stubbZ joined #nim
03:17:05stubbZis there console input in nim?
03:20:31Varriount_stubbz: There's a rdstdin module
03:44:14*pipeep quit (Ping timeout: 248 seconds)
04:02:15*rgv151 joined #nim
04:02:17*xcombelle joined #nim
04:03:37*vendethiel quit (Ping timeout: 256 seconds)
04:18:54*wan quit (Ping timeout: 248 seconds)
04:32:21*wan joined #nim
04:45:47*apense quit (Ping timeout: 240 seconds)
05:01:25*polde quit (Ping timeout: 258 seconds)
05:18:50*vasher_ quit (Quit: Connection closed for inactivity)
05:22:53*vendethiel joined #nim
05:28:41*polde joined #nim
05:29:35*stubbZ quit (Quit: Page closed)
05:45:15*vendethiel quit (Ping timeout: 255 seconds)
06:21:19*BitPuffin|osx quit (Ping timeout: 256 seconds)
06:24:44*strcmp1 joined #nim
06:27:09*vendethiel joined #nim
06:36:39*Miko_____ joined #nim
06:49:36*vendethiel quit (Ping timeout: 255 seconds)
06:51:15*vendethiel joined #nim
07:08:31*yglukhov___ joined #nim
07:14:01*vendethiel quit (Ping timeout: 256 seconds)
07:16:22*vendethiel joined #nim
07:17:17*jszymanski joined #nim
07:29:20*xificurC joined #nim
07:38:19*xcombelle quit (Remote host closed the connection)
07:39:13*vendethiel quit (Ping timeout: 256 seconds)
07:40:22*vendethiel joined #nim
07:42:08*renesac quit (Ping timeout: 252 seconds)
07:46:57*strcmp1 quit (Quit: Leaving)
07:48:24*someplace quit (Ping timeout: 246 seconds)
07:55:13*renesac joined #nim
07:56:34*Demon_Fox_ joined #nim
07:56:51*Trustable joined #nim
07:57:22*[CBR]Unspoken1 joined #nim
07:58:45*Demon_Fox quit (Ping timeout: 264 seconds)
08:02:27*vendethiel quit (Ping timeout: 252 seconds)
08:05:47*coffeepot joined #nim
08:06:10*wuehlmaus joined #nim
08:06:40*wan quit (Ping timeout: 246 seconds)
08:24:28*vendethiel joined #nim
08:36:22*jaco60 joined #nim
08:46:59*huonw quit (K-Lined)
08:55:09*xet7_ joined #nim
08:58:55*xet7 quit (Ping timeout: 252 seconds)
09:05:48*xet7_ quit (Quit: AndroIRC - Android IRC Client ( http://www.androirc.com ))
09:06:11*xet7 joined #nim
09:08:33*someplace joined #nim
09:10:55*yglukhov____ joined #nim
09:13:51*yglukhov___ quit (Ping timeout: 256 seconds)
09:34:17*yglukhov____ quit (Quit: Be back later ...)
09:37:36*vendethiel quit (Read error: Connection reset by peer)
09:42:23*yglukhov____ joined #nim
09:46:09*Ven joined #nim
09:46:45*zaquest quit (Quit: Leaving)
09:47:13*zaquest joined #nim
09:55:53*dgellow left #nim (#nim)
10:13:51Varriount_fowl: Remind me again what the advantage of using option[T] is against returning nil?
10:13:59*Varriount_ is now known as Varriount
10:14:44VarriountAraq: I don't suppose I would be able to convince you to simplify the rules for parsing string literals, could I?
10:15:11Araqno, but go on and tell me how they can be simplified
10:15:34*vendethiel joined #nim
10:16:11VarriountAraq: Having triple quoted strings not eat additional quotes, removing the wierd eat-newline-and-following-whitespace rule.
10:16:16fowlVarriount, a pointer can be nil, the state of 0, a struct type doesnt have a 0 state unless you decide that it does. maybe (string,string,string) is nil if one of its members is nil
10:17:33VarriountAraq: Both of those mechanisms can be done (at compile time!) with procedures and the generalized string literal notation.
10:18:03fowlyou can program in such a way that nil is an ok value, for ex in a perfect world nil.string & nil.string returns nil.string and every operation with strings checks for nil
10:20:44fowlin reality thats expensive to add to every operation, but it would also be expensive to allocate strings that contain no data
10:21:57AraqVarriount: general"foo
10:22:02Araqnewline here
10:22:05Araqthe end"
10:22:42Araqdoesn't parse, it was decided that single quotes are too error prone to be allow for spanning multiple lines
10:23:25VarriountAraq: Sorry, I should have been more specific. I meant triple-quoted string literals.
10:32:35*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
10:34:47*wb joined #nim
10:41:18*Miko_____ quit (Ping timeout: 248 seconds)
10:43:36*Kingsquee joined #nim
10:44:16*yglukhov_____ joined #nim
10:47:57*yglukhov____ quit (Ping timeout: 264 seconds)
10:48:25VarriountAraq: ?
10:48:55Araqso ... what's your point again? sorry
10:49:16Araqthat the rule "ignore the first newline" could have been done without? ok I guess
10:50:03Araqbut this rule is irrelevant for syntax highlighters anyway
10:56:22VarriountAraq: The manual states that a string literal `""""Hello"""" == "Hello"`, Not `"\"Hello\"". Such behavior is unexpected and rarely wanted.
10:57:33VarriountIn addition, the manual also states "when the opening """ is followed by a newline [...], the newline (and the preceding whitespace) is not included in the string"
10:57:52VarriountThis is also really unexpected behavior.
10:58:01AraqI think the manual is wrong or you misread it
10:58:22Araq""""hello"""" is the same as "\"hello\""
10:58:47Varriount"The ending of the string literal is defined by the pattern """[^"], so this:"
10:59:05Varriount""""long string within quotes""""
10:59:05VarriountProduces:
10:59:05Varriount"long string within quotes"
10:59:20*Jehan_ joined #nim
10:59:34Araqwell yes, the quotes are part of the string literal
10:59:51VarriountAh. That could be made... more clear.
11:00:08Araqthat behaviour is not my invention btw, it came from user feedback
11:00:35Araqbut I think it's expected behaviour
11:00:55federico3yep
11:01:28Araqwhat 4 quotes in a row? simple, use """"""""""
11:02:01VarriountAraq: And the newline-whitespace eating behavior?
11:02:31VarriountThere's no nice way to circumvent that.
11:03:50Araqthat's true but it's rarely required
11:04:03federico3what is it?
11:04:10Araqconst foobar = " \n" & """
11:04:14Araq workaround"""
11:05:13AraqVarriount: you cannot have """ in the middle of a triple quoted string either.
11:06:05federico3The first whitespaces-newline is always removed? That's nice actually!
11:06:10VarriountAraq: Yes, but at least that makes sense.
11:06:20Varriountfederico3: Hush you.
11:06:39federico3why not?
11:06:40Araqtriple quoted strings are for convenience and they are convenient.
11:07:02Araqso ... I think we got them exactly right.
11:07:10Araqhowever
11:07:24federico3+1
11:07:33AraqI like to see indentation based strings one day
11:07:38federico3+2
11:07:39Varriount?
11:07:41Araqconst foo = ```
11:07:52Araq string ends. Guess when it does.
11:07:55Araq not here.
11:08:02Araqvar buthere = 0
11:08:16federico3without closing it? :(
11:08:33Jehan_This is not going to be fun for syntax highlighters. :)
11:08:35federico3are the two whitespaces on the left of "string ends" stripped?
11:09:00VarriountAraq: I wouldn't actually be too opossed to that.
11:09:11Varriount*opposed
11:09:19Araqfederico3: I dunno. I guess they are.
11:09:51Araqindentation based strings doesn't exist
11:09:56Jehan_I like Scala's approach better: http://downgra.de/2010/09/14/multi-line_strings_with_scala/
11:09:57Araq*don't
11:10:14Jehan_Except, of course, they also don't allow triple quotes inside strings.
11:10:43VarriountAraq: You know the rest of the programming community would come for you with pitchforks if you did that. :P
11:10:44Jehan_But explicitly marking the left margin makes sense.
11:11:22federico3Jehan_: why marking it on *every* line?
11:12:00Jehan_federico3: So that you can tell on every line where the left margin is.
11:12:35federico3Jehan_: obviously. But why would you want to do that?
11:12:37federico3https://docs.python.org/2/library/textwrap.html#textwrap.dedent
11:12:42Jehan_Not always easy when stuff is indented by > 10 spaces and the string itself has some indentation, too.
11:13:07federico3I would detect the indentation on the first line after """ and go with that one :)
11:13:13Jehan_Also, I think the Python approach may not work if the first line is indented.
11:13:32Araqfederico3: the point is to have no closing marker so everything can be written in the string literal without escaping stuff
11:18:18Varriountreactormonk: You might be happy to know that I'm writing an entirely new nim-by-example article on strings, using information from the manual and standard library.
11:18:30*yglukhov_____ quit (Remote host closed the connection)
11:19:02*yglukhov_____ joined #nim
11:21:02AraqJehan_: "it looks like nodecl also suppresses code generation" well what else should it do? o.O
11:21:30Jehan_Araq: I thought it only suppressed the prototype.
11:21:43Araqhow would that help?
11:22:09Araqyou have the prototype that disagrees with the header and skip that and then end up with the body that disagrees?
11:22:15Jehan_Probably not, now that I think about it. The implementation would still ... yeah.
11:22:37Jehan_I blame lack of sleep over the weekend. :)
11:25:02*thotypous joined #nim
11:30:25VarriountAraq: With the current string implementation, how are a strings references updated when it's add()'ed to?
11:31:37*bjz joined #nim
11:36:44Jehan_Varriount: add() takes a var parameter.
11:39:26*EXetoC joined #nim
11:50:42fowlWill the async macros use the new continuations
11:51:18VarriountJehan_: Ah, so in the end you get a pointer to the point in memory the reference to the string is.
11:51:29Araqfowl: when we figured out how, yess
11:51:34Jehan_Varriount: yes.
11:52:29*xet7 quit (Read error: Connection reset by peer)
11:52:45*xet7 joined #nim
11:55:01VarriountAraq: Nim is getting continuations?
11:56:01*Kingsquee quit (Quit: Konversation terminated!)
11:59:55fowlVarriount r-ku is working on them
12:03:08*Miko_____ joined #nim
12:04:08*raza joined #nim
12:33:24*Jehan_ quit (Quit: Leaving)
12:35:12*MatrixBridge quit (Ping timeout: 264 seconds)
12:36:32*MatrixBridge joined #nim
12:36:48*huonw joined #nim
12:50:58*arnetheduck joined #nim
12:55:34*xificurC quit (Write error: Broken pipe)
12:56:07*xificurC joined #nim
13:00:00*raza quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
13:01:20*raza joined #nim
13:10:53*BitPuffin|osx joined #nim
13:15:00*BitPuffin|osx quit (Remote host closed the connection)
13:15:13*BitPuffin|osx joined #nim
13:19:19*bjz quit (Excess Flood)
13:19:58*bjz joined #nim
13:28:19*jszymanski quit (Quit: computer sleeps...)
14:03:01*xcombelle joined #nim
14:04:38*gyeates joined #nim
14:10:15*saml joined #nim
14:20:02*baabelfish joined #nim
14:37:14*key_ quit (Quit: Konversation terminated!)
14:57:36federico3that thread about captchas - would anyone support accepting OAuth/OpenID?
14:58:07*jszymanski joined #nim
15:00:18*dewdrop joined #nim
15:05:17fowlYes
15:05:48federico3I'd rather have a mailing list, or at least mirror the forum on a mailing list
15:06:58fowlTheres rss feed i think
15:09:10*gmpreussner|work joined #nim
15:19:45*BitPuffin|osx quit (Ping timeout: 264 seconds)
15:23:20def-federico3: well, there is a mailing list, but it's not widely used
15:29:12federico3def-: maybe it could be merged with the forum?
15:31:31def-federico3: i guess that would be good, but someone would have to implement that and make sure the mail server runns well
15:32:16*key_ joined #nim
15:33:10federico3def-: there's a PR https://github.com/nim-lang/nimforum/issues/57
15:36:50*beatmox quit (*.net *.split)
15:36:50*rinukkusu quit (*.net *.split)
15:36:50*lyro quit (*.net *.split)
15:36:50*tymat quit (*.net *.split)
15:36:50*Amun_Ra quit (*.net *.split)
15:36:51*eventualbuddha quit (*.net *.split)
15:36:51*taotetek quit (*.net *.split)
15:36:51*so quit (*.net *.split)
15:36:56*reactormonk quit (*.net *.split)
15:36:58*pigmej quit (*.net *.split)
15:36:58*beatmox joined #nim
15:37:07*lyro joined #nim
15:37:10*taotetek joined #nim
15:37:13*rinukkusu joined #nim
15:37:13*reactormonk joined #nim
15:37:31*taotetek is now known as Guest62515
15:37:44*Amun_Ra joined #nim
15:38:39*tymat joined #nim
15:39:04*pigmej joined #nim
15:39:36*arnetheduck quit (Ping timeout: 250 seconds)
15:47:24*eventualbuddha joined #nim
15:49:07*raza quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
15:51:58*Miko___ joined #nim
15:52:14*Miko_____ quit (Ping timeout: 248 seconds)
16:02:16*raza joined #nim
16:12:23r-kufederico3: i have surprising news - not everyone uses that crap.
16:13:47*coffeepot quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
16:19:46*yglukhov_____ quit (Ping timeout: 264 seconds)
16:30:23*so joined #nim
16:32:33*raza quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
16:42:07reactormonkVarriount, strings? I don't use strings ;>
16:42:13reactormonkVarriount, gimme link when you're done
16:42:40*raza joined #nim
16:48:55*FedeOmoto joined #nim
17:04:39federico3r-ku: huh?
17:06:01r-kuopenid
17:12:56*raza quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
17:14:55federico3not that surprising, I don't like it either
17:18:35*MatrixBridge quit (Remote host closed the connection)
17:18:46*MatrixBridge joined #nim
17:20:16*MatrixBridge quit (Remote host closed the connection)
17:20:28*MatrixBridge joined #nim
17:20:43*raza joined #nim
17:29:50*key_ quit (Read error: Connection reset by peer)
17:42:54*yglukhov_____ joined #nim
17:43:33*kokozedman joined #nim
17:44:53kokozedmanhey guys, I'm compiling in C++ mode (using a C++ library), and it generates codes like: ((NI) (AF_INET)).UDT::socket(((NI) (SOCK_STREAM)), ((NI) 0)) ... that is, it tries to access member where as I need just a plain UDT::socket() call and the AF_INET as normal argument
17:44:58kokozedmanhow do I do that?
17:45:25*brson joined #nim
17:46:17*Matthias247 joined #nim
17:46:51Araqkokozedman: watched my OSCON talk about how to wrap C++? oh wait ... that's upcoming :-)
17:47:10kokozedmanAraq, nope, where at?
17:47:22Araqwrap it like so: importcpp: "UDT::socket(@)"
17:47:48AraqPortland
17:48:03*yglukhov_____ quit (Quit: Be back later ...)
17:48:11*filcuc joined #nim
17:50:04kokozedmanAraq, ohh... ok, thanks man
17:50:08*Arrrr joined #nim
17:50:23kokozedmanwould love that talk if you can share the link
17:50:40Araqbtw c2nim can wrap that and produces the right importcpp pattern ;-)
17:51:29kokozedmanAraq, it gets stuck in the middle, before even producing a wrapper... so I gave up and wrote things manually instead
17:51:57Araqbah, it never gets stuck for me
17:52:01Araqdid you report this?
17:53:55kokozedmanAraq, nope, I'm guessing that might be simply a not-yet implement, not yet a priority... it gets stuck in things like: class UDT_API CUDTException (removing those UDT_API lines solves the problem, but it's kinda psy killer)
17:54:04*BitPuffin|osx joined #nim
17:54:25Araqwhat does "get stuck" mean?
17:54:51Araq#def UDT_API
17:55:03Araqseriously ... why does nobody use #def ? :-(
17:55:45*yglukhov_____ joined #nim
17:56:07kokozedmanAraq, because we don't know we needed to #def to hack our way around
17:56:20kokozedmanthis is the first time I heard about this
17:57:34Araqoh ffs I hate it that i can wrap full wxWidgets with c2nim in my spare time and everybody else doesn't
17:58:11kokozedmanit's the know how that makes all the difference
17:58:21kokozedmanthe manual is massively great
17:58:34Araqc2nim has a manual
17:58:40kokozedmanbut for tasks such as these, it's quite a massive undertaking to figure-out you needed a #def
18:00:20*filcuc quit (Quit: Konversation terminated!)
18:01:51kokozedmanAraq, in my humble opinion, I think people don't have the ability to actually remember things, for me, that's quite relevant... I read a manual, but then I easily forget and don't even know when a particular piece of the doc would be relevant ; and in that case, I'm pretty much like an ignorant person even though I have read the manual and whatever else I think might have been relevant
18:02:05*apense joined #nim
18:02:27kokozedmanI think, that's in part because of the length of the documentations, it's pretty hard to digest
18:03:11Araqdo you talk about c2nim's documentation?
18:03:12kokozedmanI'm not trying to blame anyone here, it's just a fact; I sincerely think that the manual is quite great
18:03:21kokozedmandocumentations in general
18:03:35kokozedmanseems quite a lot of them
18:03:45*darkf quit (Quit: Leaving)
18:04:46kokozedmanAraq, I have this: "typedef unsigned __int32 uint32_t;" and c2nim complains: udt.h(76, 40) Error: ';' expected
18:05:03kokozedmannot sure what #def is required here
18:05:31kokozedmanthat's the official udt header
18:11:41kokozedmanso, I removed those lines, set the #def ... and amazingly, all was well!
18:11:45kokozedmanthanks Araq
18:13:10Araqalso use --nep1 for c2nim
18:13:17AraqI guess that should be the default
18:16:25kokozedmanAraq, Ok... another thing, why is double underscores (__) causing Error: invalid token?
18:17:31Araqyou need to tell c2nim how to mangle __
18:17:46Araqin Nim underscores are separators only
18:18:00*fowl quit (Quit: zz)
18:18:13kokozedmanAraq, I'm aware of that, but usually when I mangle these, they hit other things and cause a mess
18:18:52kokozedmanlike __MSG__ and then, there is like _MSG_ ... and it's a confusing result after
18:19:27kokozedmanI know it's a strange naming from the original library, but realistically, I've been hit by this situation 2/4
18:20:12Araqwell one thing that Nim strives for is to make *talking* about code easier. So you can say to your collegue "oh you need to use the foobar here"
18:20:30Araqrather than "use underscore underscore foobar underscore underscore here"
18:20:54Araq"and not underscore foobar which is something completely different because the world ran out of identifiers"
18:21:23*BitPuffin|osx quit (Ping timeout: 252 seconds)
18:24:05kokozedmanheheh... I see
18:27:18*gyeates quit (Ping timeout: 250 seconds)
18:28:37*filcuc joined #nim
18:29:24*fowl joined #nim
18:29:24*fowl quit (Excess Flood)
18:33:27*fowl joined #nim
18:33:42*fowl quit (Changing host)
18:33:42*fowl joined #nim
18:33:42*fowl quit (Changing host)
18:33:42*fowl joined #nim
18:36:49reactormonkAraq, apparently no one cares about wxwidgets ;-)
18:37:09*cyraxjoe quit (Ping timeout: 265 seconds)
18:39:13*cyraxjoe joined #nim
18:39:32*cyraxjoe quit (Client Quit)
18:39:53Araqreactormonk: wxwidgets' headers are quite messy though so they make a good realworld example
18:40:38*gyeates joined #nim
18:41:10*filcuc quit (Remote host closed the connection)
18:47:23reactormonkAraq, neat. Could you check in the pure c2nim too? So we have a list you had to change to get it to work.
18:48:44*key_ joined #nim
18:48:51Araqwell you can just diff the headers
18:49:30Araqbut unfortunately I got how wxWidgets does it too late
18:49:41Araqso the diffs are much larger than they have to be ...
18:49:58reactormonk:-(
18:50:22Araqone thing that c2nim really sucks at is that #if is not yet supported within 'class'
18:52:56*filcuc joined #nim
18:53:46*cyraxjoe joined #nim
18:56:12*ekarlso quit (Ping timeout: 264 seconds)
18:59:43*ekarlso joined #nim
19:01:24*unclechu joined #nim
19:05:35*X67r joined #nim
19:08:07*filcuc quit (Quit: Konversation terminated!)
19:08:48*filcuc joined #nim
19:10:31*Cryptotoad joined #nim
19:10:56CryptotoadAre there any usage examples of the sqlite3 class?
19:12:42*def- quit (Ping timeout: 256 seconds)
19:12:43*filcuc quit (Client Quit)
19:12:46AraqCryptotoad: nimforum uses sqlite3
19:13:32*filcuc joined #nim
19:13:33CryptotoadOh, so it would be similar enough to use say, python tutorials on sqlite3?
19:16:48Araqwell nimforum is still small enough to see how sqlite3 can be used
19:17:26Araqit uses db_sqlite btw which is much more convenient to use
19:22:45*wb quit (Ping timeout: 256 seconds)
19:25:17*def- joined #nim
19:27:32*wirbi joined #nim
19:29:04wirbiHello! How to declarate binary operators for js? If I use proc `>>`(x, y: int32): int32 {.importc.} then in code I have wrong tmpx_16072 = >>(tmpx_16072, 8);
19:29:39*wb joined #nim
19:30:13Arrrrshr
19:30:51Arrrrhttp://nim-lang.org/docs/system.html#shr,int,int
19:32:19*filcuc quit (Quit: Konversation terminated!)
19:32:53wirbiHm... It's realy work, but before you say I receive error.
19:33:39ArrrrBecause i enabled a magical switch that makes it working on every nim compiler in the world
19:35:15*filcuc joined #nim
19:37:50Araqwirbi: as a workaround you can also use the 'asm' statement
19:38:10Araqproc `>>`(x, y: int32): int32 =
19:38:28Araq asm """ `result` = `x` >> `y` """
19:38:55wirbiArrrr: )
19:39:41wirbiAraq: Thank you! It's power tool.
19:42:56*tinAndi joined #nim
19:43:16*aziz joined #nim
19:43:29*filcuc quit (Quit: Konversation terminated!)
19:45:35*filcuc joined #nim
19:46:04*def- quit (Quit: -)
19:46:56*def- joined #nim
19:49:40*pregressive joined #nim
19:50:21*wirbi quit (Ping timeout: 246 seconds)
20:00:39*Arrrr quit (Quit: WeeChat 1.2)
20:02:49kokozedmanHow do I access the elements of a C pointer? like a "v: ptr UdtSocket", and in C, one could do something like "v[2]" for the third element... how is this done in Nim?
20:04:36Araqv: ptr array[Arbitrary, UdtSocket]
20:04:39Araqv[2]
20:04:42kokozedmanor better yet, how to create an array that doesn't do any copy and instead directly maps a memory location, like the ptr UdtSocket above?
20:05:06kokozedmanoh, ok... another new less
20:05:07kokozedmanthanks Araq
20:05:10Araqyou need to define const Arbitrary = 10_000
20:05:11kokozedmanlesson*
20:05:20*filcuc quit (Quit: Konversation terminated!)
20:05:33kokozedmanAraq, really? is there going to be a overhead with that?
20:05:44Araqnope
20:07:12*miglo joined #nim
20:09:13migloHi! I've installed via nimble the nre module and got additionally the module options_t, but the compiler complains about 'import options' that is located within 'nre.nim'. Do I have to install any additional package maybe?
20:09:41*tinAndi quit (Quit: ChatZilla 0.9.91.1 [Firefox 39.0/20150630154324])
20:10:15miglodoes the 'options' correspond to 'options_t' maybe?
20:12:38*matkuki joined #nim
20:13:09*matkuki quit (Client Quit)
20:14:49Araqmiglo: I don't know but nre is part of the stdlib now in devel, so maybe switch to the github devel version
20:19:38*yglukhov_____ quit (Quit: Be back later ...)
20:21:08*yglukhov_____ joined #nim
20:25:18*gyeates quit (Ping timeout: 248 seconds)
20:25:27*yglukhov_____ quit (Ping timeout: 246 seconds)
20:25:52miglothe tutorial mentions that sequences are resizable during runtime. it mentions also how an certain element can be accessed but there is no explanation how a sequence can be modifed during runtime, how more elements can be added :-/
20:26:47Araqyeah, somebody should update tut1. (Varriount? def-?)
20:26:47fowlmiglo have you seen the nim by example website
20:27:30Araqmiglo: use 'add' to append, newSeq[string](length) to create a seq[string] of the given length
20:28:20migloyeah, its the add proc that I have seen already somewhere
20:29:00*xet7_ joined #nim
20:29:00*xet7 quit (Read error: Connection reset by peer)
20:29:02migloI forgot about the examples that I've also ready a little bit
20:31:50*raza quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
20:32:56*bogen-work joined #nim
20:33:38bogen-workhi. How do run a program at compile time? (To swallow it's output and return a string)
20:34:25Araqbogen-work: staticExec
20:34:39*raza joined #nim
20:35:17bogen-workthanks
20:35:57kokozedmananother lesson for me, thanks for that staticExec thing Araq
20:36:39*raza quit (Client Quit)
20:36:45*kokozedman quit (Quit: Leaving)
20:40:11Araqbogen-work: with a bit of luck you can run marshal.to and marshal.`$$` at compile-time too for easy serialization of staticExec'ed data
20:40:59bogen-workAraq: thanks
20:41:27Araqcheck out my "lexim" project where I use this to offload DFA minimization for lexer generation
20:42:55Araqit works at compile-time in pure Nim VM based code, but compile-times are > 20 seconds. After offloading to an external Nim process, it's < 1s
20:56:19*txt_ joined #nim
20:58:09*txt_ left #nim (#nim)
21:00:12*clone1018_ quit ()
21:00:34*clone1018 joined #nim
21:03:10*xcombelle quit (Quit: Leaving)
21:03:50*Demos joined #nim
21:05:17*jszymanski quit (Quit: computer sleeps...)
21:07:54Demosohmygosh binary search drama
21:07:57Demosdrrrraaaama
21:08:09*aziz quit (Remote host closed the connection)
21:08:11DemosI should check if that overflow is in the C++ library version too
21:08:26XeDemos: wat
21:09:28Demossomeone bitched about binarySearch
21:09:39Demosits designed so that you can insert elements using it I think
21:10:40Araqyeah it overflows when you have more element than fit in RAM anyway or something like that
21:10:51*gyeates joined #nim
21:12:51*Demos quit (Read error: Connection reset by peer)
21:12:57*Demos_ joined #nim
21:14:27*Demos_ quit (Remote host closed the connection)
21:15:05*Demos joined #nim
21:15:13Demosthat does not sound like an overflow to me
21:15:28Demoslike you can't even prevent that
21:20:37Araqwell Nim's int is already word-sized to mitigate such problems
21:20:48Araqand in debug builds we detect overflows too, so *shrug*
21:21:51Araqi often wonder if people who really care about these things also throw away their cell phones when they get a busy signal.
21:24:00migloif I create a new sequence in the following way "var x: seq[]", then can I say the x is a reference to a integer sequence that is initialized with nil?
21:24:26Araqyes
21:24:45migloups, should be: seq[int]
21:29:46*unclechu quit (Quit: Leaving.)
21:31:26*Miko___ quit (Ping timeout: 248 seconds)
21:33:14*heinrich5991 quit (Ping timeout: 256 seconds)
21:33:35renesacbut that fix to the possible overflow has no negative side to it
21:33:50renesacpun not intended
21:35:01renesacit is not inconceivable one work with a 1GB char array on a 32bit program
21:36:47*heinrich5991 joined #nim
21:37:37Araqrenesac: it's surely is and I'd rather add an "exceeds 1 GB" check into 'newSeq' and 'add' and 'setLen' than having binarySearch work with it but then not much else
21:38:12renesacwhat?
21:38:15renesacnot much else?
21:39:19renesacthe fix is painless, why would you add superflous checks in multiple places instead?
21:40:07Araqthe checks are not superfluous, if your program needs to work with 1 GB sized arrays on a 32bit machine it's broken already.
21:40:48Araqfragmentation could happen, for instance
21:40:49renesacand nim binary search still only works with openarray, but in the future when concepts are more developed it could work in a dynamically generated random access thingy
21:41:09renesacmuch bigger than the physical memory
21:41:18AraqIMO this should fail with OOM reliably
21:41:37*dgellow joined #nim
21:42:25Araqrenesac: yeah but the concept version then should use int64 or bignums
21:42:33renesaccould happen, but there are ways around
21:42:50renesacI don't agree putting a limit on the language level for this
21:43:27Araqthe limit already exists, it's just about making it more deterministic
21:43:28renesacit could happen with 700mb arrays too
21:43:35renesacwhere you call the line?
21:44:21Araqcould it? how so?
21:44:22renesachell, it could happen with 2mb arrays
21:45:17renesacif you have things allocated every 1mb of memory
21:45:21renesacthat can't be moved
21:45:49Araqyeah but 1 GB more likely than not will fail, and 2 MB more likely than not will succeed.
21:46:04renesacyes
21:46:22renesacthe programmer should catch the exception in case of failure, ideally
21:46:41renesacbut if it can be done, do it
21:47:00Araqthere is not even an exception, the program dies. There is a hook you can set though.
21:47:09AraqFor OOM I mean.
21:47:40Demosyou probably don't want to catch the exception around every alloc
21:47:42renesacin c I simply check the output of malloc
21:48:00Araqyeah and on Linux, it doesn't return NULL.
21:48:24Araqnot that it matters anyway. you could also run out of stack space. how do you check for that in C?
21:50:11renesacAraq: are you sure it don't returns null when it don't have contiguous space
21:50:21renesacI konw it can allocate more memory than physical memory
21:50:27Demosby the way nim's bsearch happens to be almost identical to c++'s bsearch (libc++)
21:50:28renesacbut not more memory than address space
21:50:50AraqLinux overcommits memory and when you *access* the memory you get a segfault
21:50:58renesacAraq: exactly
21:51:05Demosit might return null when your out of virtual address space
21:51:07renesacit can still fail because of fragmentation
21:51:32renesacespecially in 32bit
21:51:57renesacor less
21:52:07Demosyou may be right, it'll assign virtual pages when you call malloc. But it wont commit them
21:52:28Demosand the overcommit only applies to new pages afaik
21:52:36EXetoCwell if all or nothing is the only way
21:52:40Demosnot to malloc giving you memory on an old page
21:53:58Araqso what do you do with a malloc that sometimes returns NULL and sometimes your program will crash instead?
21:54:42Araqand even if it always returns NULL how do you handle "out of stack space"?
21:55:54*wb quit (Ping timeout: 256 seconds)
21:56:06renesacunless you do recursion, you are unlikelly to hit the stack limit
21:56:14renesacor alloca, or something funky
21:56:25renesacif you do recursion, you can limit the recursion depth
21:56:57Araqfixed size arrays on the stack are very common in C since it's the only automatic form of memory management that you can get
21:57:56Araq*of automatic memory management
21:58:12renesacwell, tests should ideally trigger excessive use of the stack in that way
21:58:44*FedeOmoto quit (Quit: Leaving)
21:58:50renesacif they go to the end of a non-recursive algorithm
21:59:19Araqbut didn't you argue for the rare case where you suddenly have a 1 GB char array at runtime? :P
21:59:32renesacit might not be rare
21:59:44Araq(which escaped your testing?)
21:59:48renesacthe program may be designed to work with chunks of 1GB
22:00:16Araqsure, you can have almost 4 of these after all
22:00:33Araqsounds like a common and reasonable "design"
22:00:49renesacit can work with only one such chunk at a time to process a bigger file
22:00:55renesacfor example
22:01:20EXetoCon 32-bit systems with <4GB? is that not rare? and what about opt-out?
22:01:39EXetoCwell, any system with a relatively low amount of RAM
22:01:43renesacEXetoC: I don't know why to introduce that complexity in the first place
22:02:26renesacand C is normally used when you are close to the limits of the machine, and want that extra memory efficiency/performance
22:02:41renesacI hope to use nim in those cases too
22:03:04DemosJust try allocateing a 1GB array. even on a 64bit machine there is a great chance you won't get 1G from one call you malloc
22:03:26AraqDemos: did you try it?
22:03:43DemosI have yeah, I depends on the system
22:03:52DemosI remember windows bailing out pretty quick
22:04:46Araqcommonly overlooked is also that with a shared memory for the graphics card a good chunk of the address space is taken from you
22:08:19Araqrenesac: but let me put it this way: bug detected because <can fail under these rare circumstances> --> low priority
22:08:41Araqbug detected under these rare circumstances that *actually* happened --> high priority
22:09:49Araqand no "I constructed test cases so it *actually* happened" doesn't count.
22:10:12renesacok, what I don't agree is putting arbitrary limits on newSeq, etc
22:10:39renesacI know you like those "arbitrary but deterministic" limits though
22:12:09Araqmaybe it's because I wrote web crawlers for quite some time. The least thing you want is that the "crawler works with 1 GB HTML files but it kills your throughput"
22:13:21Araqinstead you want "reject this piece of garbage, we have 1 million pages left to crawl"
22:16:36*xet7_ quit (Read error: Connection reset by peer)
22:16:51dgellowIs there an option to specify to the compiler a build directory ? Something like `nim c -outputDir:./build/ test.nim` that generates a 'test' binary into ./build dir
22:17:02Araqdgellow: --nimcache:foo
22:17:44Araqand --out:testbinary but --out picks the wrong directory iirc
22:19:59*pregressive quit (Remote host closed the connection)
22:19:59*EXetoC quit (Read error: Connection reset by peer)
22:20:23*Trustable quit (Remote host closed the connection)
22:21:18dgellow--nimcache only changes the output dir of C files. Not the one for the generated binary.
22:21:39Araqyes, for that we have --out
22:22:13dgellowyeah, I already knew about --out, but I don't want to specify the name of the binary.
22:25:02*miglo left #nim ("http://quassel-irc.org - Chat comfortably. Anywhere.")
22:31:27*EXetoC joined #nim
22:36:18*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
22:50:50*fowl quit (Quit: zz)
22:55:10*gyeates quit (Ping timeout: 248 seconds)
23:01:49*X67r quit (Quit: leaving)
23:06:10*fowl joined #nim
23:06:10*fowl quit (Changing host)
23:06:10*fowl joined #nim
23:06:10*fowl quit (Changing host)
23:06:10*fowl joined #nim
23:06:13*fowl quit (Excess Flood)
23:06:19*Matthias247 quit (Read error: Connection reset by peer)
23:07:41*gyeates joined #nim
23:12:08*fowl joined #nim
23:20:09*saml_ joined #nim
23:22:12*vasher_ joined #nim