<< 24-02-2015 >>

00:07:01*kuzy000_ quit (Ping timeout: 264 seconds)
00:10:55*elbow_jason quit (Remote host closed the connection)
00:13:48BlaXpiritI have an idea
00:14:05BlaXpiritit may be planned to allow overloads on var, yes
00:14:16BlaXpiritbut there are other cases where overloads are problematic
00:14:21BlaXpiritdue to ambiguity
00:14:50BlaXpiritmake a pragma that says: in case of ambiguity, use this particular overload instead of giving an error
00:14:58*vendethiel quit (Ping timeout: 255 seconds)
00:16:00fowlAraq, how do you invoke getType?
00:16:02shalabhwhat's overloads on var?
00:16:33Araqfowl: like you did?
00:16:39BlaXpiritshalabh, proc f(x: T) proc f(x: var T)
00:16:57fowlAraq, i'm lost then
00:17:40shalabhBlaXpirit:thx
00:19:07*vendethiel joined #nim
00:26:06BlaXpiritDecided to scan through IRC logs and collect some of the answers to interesting questions I had. http://blaxpirit.com/blog/tag/nim.html More to come later.
00:26:49Araqfowl: for your example replace 'expr' with 'stmt'
00:26:56Araqand it prints:
00:26:59AraqSym "x"
00:27:02AraqntyInt
00:27:09Araqwhich is x's type
00:28:37*sillesta quit (Ping timeout: 250 seconds)
00:35:16fowlAraq, oh
00:35:37fowlthis is awesome
00:37:30fowlAraq, calling gettype for proc():void segfaults
00:39:19*saml_ joined #nim
00:43:32Araqfowl: thanks, let me fix it
00:44:07fowlis that going to return nnkProcTy
00:45:26Araqnah, lol
00:46:02AraqnnkBracket("proc", <return type>, <param 1 type>)
00:46:18Araqbut yeah I guess it should be nnkProcTy ?
00:48:32fowli think so
00:49:10fowlhow about object type fields :)
00:50:03Araqbut nah
00:50:11AraqnnkBracketExpr is better
00:50:22Araqonly 'enum' and 'object' are special
00:50:32Araqthe rest is structually typed anyway
00:50:48Araquniform access is more important
00:51:24*reem quit (Remote host closed the connection)
00:51:32AraqnnkRefTy is not used either
00:51:40*Trustable quit (Remote host closed the connection)
00:51:45Araqit's nnkBracket("ref", int)
00:53:36fowlok
00:55:25*reem joined #nim
00:59:03Araqfowl: fixed
01:02:02*vendethiel quit (Ping timeout: 256 seconds)
01:03:33*vendethiel joined #nim
01:04:30*BlaXpirit quit (Quit: Quit Konversation)
01:09:05*filwit joined #nim
01:11:28filwitdom96: do you have time to dup+pull my PR to Aporia and discuss it with me?
01:11:51dom96filwit: Not right now. Need to sleep, sorry.
01:12:04filwitdom96: no problem... one thing before you go:
01:12:06dom96I'll comment on it at Github when I get time.
01:12:36filwitI left your colors mostly alone, but some minor things changed.. i can revert them (for your colors), but wanted to know if you liked them in there.
01:12:59filwitokay, looking forward to your response
01:15:08dom96i'll review it later
01:15:09dom96'night
01:15:49*infinity0_ joined #nim
01:15:49*infinity0_ quit (Changing host)
01:15:49*infinity0_ joined #nim
01:15:49*infinity0 is now known as Guest33423
01:15:49*Guest33423 quit (Killed (sendak.freenode.net (Nickname regained by services)))
01:15:49*infinity0_ is now known as infinity0
01:31:15*Demos joined #nim
01:32:02*filwit quit (Quit: Leaving)
01:32:30*fizzbooze quit (Ping timeout: 265 seconds)
01:32:31*darkf joined #nim
01:35:03*kjo2 left #nim (#nim)
01:51:40*janprill joined #nim
01:56:11*janprill quit (Ping timeout: 265 seconds)
01:56:41*shevy joined #nim
02:08:05*chemist69_ joined #nim
02:11:13*chemist69 quit (Ping timeout: 264 seconds)
02:15:30*flaviu quit (Read error: Connection reset by peer)
02:15:44*flaviu joined #nim
02:33:05*shalabh_ joined #nim
02:43:38*fizzbooze joined #nim
02:44:17shalabh_is there a description of the mulimethod dispatch implementation used by nim?
02:45:05*pregressive quit (Remote host closed the connection)
02:45:30*pregressive joined #nim
02:54:37*elbow_jason joined #nim
03:01:14*yibter quit (Quit: Textual IRC Client: www.textualapp.com)
03:21:41*pregressive quit (Remote host closed the connection)
03:25:28*koz joined #nim
03:28:29elbow_jasonTaintedString? What is it?
03:35:12*saml_ quit (Quit: Leaving)
03:35:24reactormonkelbow_jason, strings from inputs, e.g. stdin
03:36:00onionhammeras opposed to strings you execute against a database
03:36:10def-http://nim-lang.org/manual.html#taint-mode
03:36:12onionhammerforces the programmer to deal with input
03:36:52elbow_jasondef-, onionhammer, thanks
03:37:31elbow_jasonhaha, I'm actually reading the manual and I just havent made it that far yet :P
03:55:57*nande quit (Remote host closed the connection)
03:57:47*dts_ joined #nim
04:02:57*reem quit (Remote host closed the connection)
04:06:30*Menche joined #nim
04:07:59*dts_ quit (Ping timeout: 244 seconds)
04:11:33Menchehow does koch boot differ from koch csources?
04:19:59*reem joined #nim
04:29:50*dts|pokeball joined #nim
04:31:25*reem quit (Remote host closed the connection)
04:32:20reactormonkMenche, it gives you the same result in the end.
04:32:27reactormonkIt's jus that you can ship the csources around.
04:33:27Mencheone compiles the generated C code and the other doesn't?
04:35:32reactormonkexactly
04:36:59Menchecan it be told what CFLAGS to give the C compiler, or should I just generate C code and compile it in a separate command?
04:44:52*dts|pokeball quit (Ping timeout: 240 seconds)
04:47:45*reem joined #nim
05:31:06*shalabh_ quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
05:35:46*Demos quit (Read error: Connection reset by peer)
05:56:42*reem quit (Remote host closed the connection)
06:02:12*mrfunyon joined #nim
06:06:45mrfunyonIs there any time a variable is global?
06:10:01*Menche quit (Ping timeout: 255 seconds)
06:10:29*reem joined #nim
06:15:30*reem quit (Remote host closed the connection)
06:15:40*mrfunyon quit (Remote host closed the connection)
06:20:55*johnsoft joined #nim
06:21:05*bjz joined #nim
06:22:22*pregressive joined #nim
06:22:38*reem joined #nim
06:23:29*reem quit (Remote host closed the connection)
06:25:45*reem joined #nim
06:26:29*pregressive quit (Ping timeout: 245 seconds)
06:28:14*bjz quit (Ping timeout: 246 seconds)
06:29:18*fizzbooze quit (Ping timeout: 252 seconds)
06:37:58*Menche joined #nim
06:39:02*reem quit (Remote host closed the connection)
06:49:11*johnsoft quit (Ping timeout: 246 seconds)
06:49:49*reem joined #nim
06:49:58*johnsoft joined #nim
06:50:34*bjz joined #nim
06:51:54*elbow_jason quit (Ping timeout: 245 seconds)
07:07:50*elbow_jason joined #nim
07:14:18*shalabh_ joined #nim
07:17:24*shalabh_ quit (Client Quit)
07:19:30*Demon_Fox quit (Quit: Leaving)
07:22:11*sillesta joined #nim
07:24:09*elbow_jason quit (Ping timeout: 252 seconds)
07:24:14*Outlander quit (Ping timeout: 246 seconds)
07:47:28*Iniglo joined #nim
07:51:02*Iniglo quit (Remote host closed the connection)
08:05:16*dumdum joined #nim
08:05:36*reem quit (Remote host closed the connection)
08:10:15*reem joined #nim
08:12:41*tmku joined #nim
08:12:47tmkuhey
08:27:15*chemist69_ quit (Quit: WeeChat 1.1.1)
08:27:25*chemist69 joined #nim
08:29:59TEttingertmku: are you tomku on other networks?
08:33:21tmkuoh hey! small world.
08:33:31tmkutomku is actually taken by someone else on freenode
08:37:10*Menche quit (Ping timeout: 244 seconds)
08:43:01*janprill joined #nim
08:43:09TEttingerheh
08:43:38TEttingerNim looks nice, not sure if I'll use it yet or just stay learning for 2 years like I did for clojure
08:52:34*janprill_ joined #nim
08:55:36tmkuyeah, I'm trying to wrap my head around it since yesterday
08:55:53tmkubut the name change made it more difficult to google around for stuff, that's for sure!
08:56:14*janprill quit (Ping timeout: 246 seconds)
09:00:08aidanhHello, quick question; is there a way to preallocate storage space for a string?
09:08:42TriplefoxsetLen can do it, I think there might be a way to do it at construction time also
09:09:34Triplefoxah, newString(len)
09:12:30*kapil___ quit (Quit: Connection closed for inactivity)
09:13:01*BlaXpirit joined #nim
09:14:16aidanhTriplefox: Ah great, thank you
09:23:10*janprill_ quit (Remote host closed the connection)
09:23:38*janprill joined #nim
09:33:53*dumdum quit (Ping timeout: 256 seconds)
09:48:53*reem quit (Remote host closed the connection)
09:57:07*wb_ quit (Ping timeout: 256 seconds)
09:59:15*janprill_ joined #nim
10:03:23*janprill quit (Ping timeout: 265 seconds)
10:13:57novistdoes nim have something like python's if __name__ == '__main__'?
10:17:07*dumdum joined #nim
10:30:41*matkuki joined #nim
10:33:02dv-when isMainModule: ...
10:33:30*MajorWork quit (Changing host)
10:33:30*MajorWork joined #nim
10:34:45*kuzy000_ joined #nim
10:45:43novistindeed, thank you dv-
10:46:16novistanother question.. seq[uint8] is correct way to store binary data of unknown length?
10:48:28matkukiHi. I'm playing around with strutils module's "find" and the returned index is different from "find" functions in other languages: https://bpaste.net/show/bd997c0eea07
10:48:29matkukiWas this intentional?
10:52:34*Outlander joined #nim
10:52:58*janprill_ quit (Remote host closed the connection)
10:53:24*janprill joined #nim
10:53:43novistmatkuki: are you sure its index which is different? maybe range produced by .. is inclusive (if thats the right wording)?
10:56:24matkukinovist: let me see...
10:57:49BlaXpiritnovist, string is another option
10:57:57BlaXpiritseq[uint8] is good
10:58:14BlaXpiritit slightly depends on the nature of the data
10:58:25novistwell it can be either string or binary data
10:58:58BlaXpiritmatkuki, yes, Nim uses weird inclusive indices... you'll have to live with it
10:59:21matkukinovist: You're right, the index is the same, range is inclusive. My mistake.
10:59:33BlaXpiritit's not find that gives different results, it's the inclusive slice
10:59:39novistinclusive.. what a bummer
10:59:51novistwell i guess we can make ... operator to be non-inclusive
10:59:51BlaXpiritalso, don't slice strings with .. , use substr
10:59:56matkukiBlaXpirit: Thanks. Another thing to watch out for.
11:00:03novistbut then it would be weird cause its counter-intuitive
11:00:13BlaXpiritnovist, you can't just make a non-inclusive operator
11:00:20novistwhy not?
11:00:21BlaXpirityou'd need a different type of slice
11:00:33BlaXpiritand add support for it to every function that uses slices
11:01:15novistheh.. nim being able to do all kinds of acrobatics thought it would be easy
11:01:46novistalso.. what is BiggestInt? just alias for largest int type available?
11:01:52BlaXpirityes
11:02:44BlaXpiritmatkuki, you can fix the original code by adding - 1
11:02:58BlaXpiritexcept then it will be broken in corner cases
11:03:40BlaXpiritbecause https://github.com/Araq/Nim/issues/1979 substr avoids this problem
11:04:06matkukiBlaXpirit: Exactly what I was doing, but when slicing a string into multiple parts, I can't keep up with the -1/+1's! Will use substr as you suggested.
11:04:08novisti wonder why ranges are inclusive... use zero-indexed arrays is primarily to avoid lots of -1. there it should also apply
11:04:22BlaXpiritmatkuki, you still need - 1 with substr
11:04:32BlaXpiritthe difference is it doesn't allow negative indices
11:04:51matkukiOh
11:05:00BlaXpiritnovist, sure, many people will agree that this is a plain bad decision
11:05:17BlaXpiritthis has been brought up many times, sometimes leading to heated arguments
11:05:43novistis there any will to change it? cause if it doesnt happen before 1.0 later it will be hard
11:06:09BlaXpiritthere are no real arguments for it
11:06:21BlaXpiritthe only one is how to make slices for ordinal types
11:06:30BlaXpirit'a'..'z' and whatnot
11:07:01BlaXpiritinclusive ranges make sense in laguages that this part of Nim was inspired by
11:07:26novistones that are indexed from 1?
11:07:38novistalthough.. maybe it doesnt matter
11:07:39BlaXpiritmainly
11:07:55matkukiSo there is no escaping the -1/+1 stuff? Oh well, so be it.
11:08:00thilpperl6's ".." operator is inclusive too, but you can say 0..^2 to produce [0, 1]
11:08:06BlaXpiritthat's good
11:08:12novistAraq did not respond to your github issue too. i wonder whats his position
11:08:34BlaXpirituhh I think he agreed to do something about it but then kinda left it alone
11:08:48novistthilp: thing is most of the time people do not want inclusiveness
11:09:20novisti think 'a'..>'z' might be better. though in this case it looks bit ugly
11:09:30novistbut most of the time people would get what they expect
11:09:41BlaXpirityou mean 'a'..<'z' for non-inclusive
11:09:47novistand 'a'..'z' kind of thing isnt used that often
11:10:06novistnah i actually meant if .. was non-inclusive then ..> would be inclusive
11:10:15thilpthat's true, but in perl6 you use it a lot for character ranges in regexes too
11:10:28thilpso that's quite natural
11:10:37matkukiWere inclusive ranges taken from another language?
11:10:38BlaXpirita big problem is the standard library already is filled with functions that imply inclusive ranges even if they don't use ..
11:10:40novistnot really if you work with data
11:10:46novistand system programming works mostly with data and not text
11:11:05BlaXpiritmatkuki, well sure, arrays and slices and related stuff feel completely like Pascal's
11:11:32BlaXpiritand the notion of ordinal types
11:11:40*shalabh quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
11:12:02BlaXpiritexcept pascal never used 0-indexing and never used negative indices to count from the end of a sequence
11:12:41*shalabh joined #nim
11:12:42matkukiOk, so it's a bastardized mix of Pascal and Python.
11:12:50BlaXpiritpretty much
11:13:13novistwell.. for what its worth its still pretty amazing even if some rough edges exist
11:13:25BlaXpiritthe worst possible mix, in my personal opinion. causes that bug I keep nagging about, too. but people gotta know, not to fall for it
11:13:39novistas long as Araq is willing to do some hard decisions and fix biggest issues even if they break compatibility
11:13:48matkukiBlaXpirit: What bug?
11:13:56BlaXpiriti linked above
11:14:13matkukiAh, Ok
11:14:14BlaXpiritit's not a bug per se, but it's something that people will write consistently causing bugs in their code
11:14:46novistregarding stdlib.. suppose there was inclusive ..> cant we just do inteligent replace in stdlib .. -> ..> ?
11:14:55BlaXpiritumm
11:15:02novistafter all it would keep behavior and not need lots of manual work
11:15:06BlaXpiritthis is not a good idea for many reasons
11:15:17BlaXpirit.. is not even an intuitive syntax for non-inclusive
11:15:29novistthats true..
11:15:31BlaXpiritand why break everything that uses ..
11:15:56novisti still type : for that stuff anyway so.. yeah heh
11:15:58novistpy background
11:17:00thilpor (dreaming here) maybe there should be a "type offset = distinct int"
11:17:08thilpand overloaded ".."
11:17:22thilpcould become quite a maintenance nightmare though
11:17:25novistwould be very counter-intuitive
11:17:45novistsame operator cant do two things in two places or people will get confused a lot
11:19:06thilpyeah, i don't think it would blend well in Nim
11:21:16thilpwould need to much context-sensitive stuff to make the "for i in 0..len(mylist)" work
11:23:08novistme personally i dont mind making range() proc for that, but array slicing is a real bummer
11:23:51thilp(still dreaming) we could use the "math" notation for ranges actually
11:24:07thilpyou know, inclusive [x..y], exclusive [x..y[
11:24:15thilpwould break all IDEs for sure
11:24:23flaviuOr [x..y)
11:24:26thilpyeah
11:24:47TEttingeror just make another operator for noninclusive
11:25:07TEttinger,.. noninclusive left, .., noninclusive right or something
11:25:21novistnever seen [x..y[, just [x..y). it seems logical but not intuitive
11:25:24TEttingernot sure how many glyphs are available for operators <.<
11:25:44TEttingeroh yes, x >.> y
11:25:48novistwell atm there is .. < for non inclusive
11:25:58novistproblem is people dont expect that
11:26:00flaviu.eval import macros; dumpTree:; 1..,2
11:26:03Mimbusflaviu: eval.nim(5, 5) Error: expression expected, but found ','
11:28:01*Outlander quit (Ping timeout: 264 seconds)
11:31:51novistspeaking of weird things string concatenation operator threw me off too
11:32:26novistbut its nothing that cant be solved with some code
11:35:33*Trustable joined #nim
11:51:25*pafmaf joined #nim
11:55:58*infinity0 quit (Ping timeout: 256 seconds)
11:58:56*infinity0 joined #nim
12:03:20*matkuki quit (Quit: ChatZilla 0.9.91.1 [Firefox 35.0.1/20150122214805])
12:09:30novistoverloading of = is not allowed?
12:11:27BlaXpiritis not allowed
12:11:38BlaXpiritfor now
12:12:05novistoh thats good at least. for all thats possible its weirdest impossible thing hehe
12:22:06*emilsp joined #nim
12:24:38novistwhats correct way for object to reference itself? w/ ref i guess?
12:31:04*pafmaf quit (Quit: This computer has gone to sleep)
12:33:45BlaXpiritwhy
12:35:05novistim making bencoding lib. so value can be either int, string, list or table. lists and tables contain similar values like that
12:35:15novistand i put all of it into one Bval object
12:35:28novistso it needs reference to itself in lists and tables
12:36:45*saml_ joined #nim
12:39:06BlaXpiritlook at json, really
12:39:29novistgood point, thanks ;)
12:39:32BlaXpiritit basically should just be ref object
12:49:27*reem joined #nim
12:52:00*kapil___ joined #nim
12:54:20*reem quit (Ping timeout: 256 seconds)
13:27:10*BitPuffin joined #nim
13:32:40*BitPuffin quit (Ping timeout: 265 seconds)
13:34:56*Matthias247 joined #nim
13:37:17*5EXAAK15T joined #nim
13:39:24*BitPuffin joined #nim
13:44:03*emilsp quit (Remote host closed the connection)
13:52:41*Matthias247 quit (Read error: Connection reset by peer)
14:00:22*mpthrapp joined #nim
14:00:34*akiradeveloper joined #nim
14:01:23*gokr joined #nim
14:03:59*saml_ quit (Ping timeout: 245 seconds)
14:07:33*johnsoft quit (Read error: Connection reset by peer)
14:08:30*johnsoft joined #nim
14:25:11*NimBot joined #nim
14:27:06ekarlsocan't nim be installed in a global manner?
14:32:36*koz quit (Ping timeout: 265 seconds)
14:35:05def-ekarlso: ./koch install?
14:35:22ekarlsodef-: hmmms
14:35:36ekarlsothat places the bin where ?
14:36:21*awesomo4000 joined #nim
14:36:31def-you have to specify a directory I think
14:36:47def-like /usr/bin, /usr/local/bin or /opt
14:37:03ekarlsoI tried doing like sh build.sh
14:37:10ekarlsothen linking nim bin to /usr/bin
14:37:14ekarlsodidn't work too well :D
14:38:55ekarlsoError: cannot open 'lib/system.nim'
14:38:56ekarlsodoh
14:41:53awesomo4000i did a basic test with “time <cmd>” to test speed of “/usr/bin/find /“ vs for file in walkDirRec “/“ and the nim code took 60 seconds while find took 10.34 seconds. Any idea how to speed up walkDirRec
14:48:43def-awesomo4000: let me test
14:48:44*darkf quit (Quit: Leaving)
14:49:30*BlaXpirit_ joined #nim
14:50:08def-awesomo4000: for me it's 0.7s with find, 0.9 with walkDirRec
14:50:26awesomo4000ok. what os
14:50:35def-awesomo4000: maybe it's some cache, did you try running walkDirRec after find?
14:50:37awesomo4000(i’m on mac / mavericks )
14:50:40def-also, -d:release enabled?
14:50:41def-linux here
14:52:25*BlaXpirit quit (Ping timeout: 265 seconds)
14:55:26def-Strange, with / find is much faster indeed
14:56:22ekarlsodoes the compiler look for it's .nim files like .. relative to itself ?
15:03:16def-awesomo4000: in my case only NFS filesystems scan slowly, really strange
15:03:52*akiradeveloper quit ()
15:11:36def-awesomo4000: i think the main difference is that walkDirRec calls lstat() on each file it finds while "find" doesn't
15:13:22awesomo4000here’s the log of this by the way http://pastebin.com/vhC7MDHc
15:16:43def-I used strace to figure out what syscalls are made
15:16:54def-I can optimize it for Linux to be faster, but no idea how to do it on Mac
15:20:55def-but the general idea would probably be to get rid of the lstat calls and instead use a system-specific readdir() version that includes filetype already
15:22:30*kapil___ quit (Quit: Connection closed for inactivity)
15:23:20ekarlsowhat does install do vs just build ?
15:25:41*n0x0ff joined #nim
15:26:45def-ekarlso: i think it creates a .deb file and installs it
15:27:03awesomo4000great. thanks. ls -laR has simliar timing as walkDirRec by the way, as does find -exec stat
15:27:26ekarlsosucks then def- if one is on fedora :P
15:27:57awesomo4000readdir will not show exactly the same info as a full stat call, but it would provide quite a bit of info faster than an exec per file
15:29:25awesomo4000(stat per file rather)
15:30:30def-awesomo4000: i have a version without stat now, works fine here and is just as fast as find
15:30:49def-awesomo4000: any idea how to find out where readdir() returns enough information?
15:31:04def-we only need the info whether it's a directory or symbolic link
15:33:27awesomo4000so readdir gets you a dirent struct
15:33:59def-and on linux and mac at least that contains d_type
15:34:02awesomo4000that gives you inode, type, namelen, name
15:34:11def-but that's not in the posix standard
15:34:36awesomo4000yeah d_type can be unknown, fifo, chr, dir, blk, reg, lnk, sock, wht
15:35:07*awesomo4000 regurgitates manpage
15:35:30awesomo4000that’s darwin’s version of it
15:35:36def-same on linux
15:36:34def-give me a moment to make a PR
15:36:42awesomo4000yeah. looks like the same but wht ?
15:38:45awesomo4000looks like a bit of history lurking there. “BSD whiteout”
15:39:15awesomo4000something from the Coda filesystem . learn something new every day.
15:39:37def-awesomo4000: You can try this?: https://github.com/Araq/Nim/pull/2208
15:39:45awesomo4000http://sourceware-org.1504.n7.nabble.com/BZ-6895-Describe-DT-LNK-td5495.html
15:41:11def-for me it's even a bit faster than find now :P
15:42:28awesomo4000being a complete newb at nim . ( treat me like i’m 5 ). i need to checkout the main source at https://github.com/Araq/Nim , then update from your pull ?
15:42:42def-ah, you're using 0.10.2?
15:43:51def-i would just download the 2 changed files into your copy of devel, no need to recompile anything
15:44:03def-except your test program of course
15:45:24awesomo4000i’m on 0.10.3
15:45:42awesomo40002015-02-19 MacOSX: amd64
15:45:59def-just download the 2 changed files then, should be easiest
15:46:18*pregressive joined #nim
15:46:25def-you could probably use git to get my PR somehow, but I don't know
15:48:18AraqBlaXpirit_: it would be nice if you could repeat the arguments properly
15:48:34BlaXpirit_for what
15:48:44Araqthere is no known way to iterate over low(enum) to high(enum) with *exclusive* ranges
15:49:06Araqyou keep pretending that this argument doesn't exist
15:49:07dom96hello
15:49:10BlaXpirit_who says exclusive ranges need to be .... exclusive
15:49:19*MajorWork quit (Quit: Leaving)
15:49:50BlaXpirit_Araq, no, I didn't ignore, i actually mentioned [:06:29] <BlaXpirit> 'a'..'z' and whatnot well it's kinda different, i agree
15:50:03*MajorWork joined #nim
15:50:53AraqBlaXpirit [11:06:09] there are no real arguments for it
15:51:25*MajorWork quit (Changing host)
15:51:25*MajorWork joined #nim
15:52:06*enquora joined #nim
15:53:18*brson joined #nim
15:57:40Araqand the issue can easily be resolved by removing negative indexing ... which doesn't make much sense anyway and doesn't work in a[i] for performance reasons
15:59:22AraqI'm thinking about introducing something like a[^4] instead to mean "4th last item"
15:59:57Araqbtw note that finally the counting starts with 1 for a[-1] as -0 is the same as 0
16:00:08Araqs/finally/suddenly
16:00:35Araqso it's not like Python's way is completely orthogonal either
16:02:46BlaXpirit_Araq, yes, explicit syntax is what I suggested. You might remember this https://gist.github.com/BlaXpirit/f063fe6706201504580d
16:08:15*huodon joined #nim
16:08:27huodonHello
16:12:18def-hi huodon
16:13:13huodonI need help :)
16:15:00def-huodon: with what?
16:15:32huodonFrom C generate nim code, how to read ptr ptr T
16:16:04huodonT in c is a buffer pointer
16:16:29def-you can dereference twice with x[][]
16:18:48huodonx is ptr to array, in C
16:20:15huodonx[][] only take head object
16:20:37def-then [0] would be the first element in that array
16:20:38Araqso declare a ptr to an array, if you have a ptr to an array
16:21:32AraqI'm beginning to think that C's type system causes brain damage
16:24:59Araqhrm ... bootstrapping in C++ now works again but takes minutes ...
16:27:36*wb_ joined #nim
16:36:38dumdumIs there any Priority queue implementation which supports change in element's priorities?
16:40:04def-dumdum: don't think so, but should be fun to write
16:43:32*5EXAAK15T quit (Quit: This computer has gone to sleep)
17:02:45*banister joined #nim
17:02:50*banister quit (Max SendQ exceeded)
17:05:25ekarlso.eval let letters = @["f"]; @["foo", "bar"].filter(proc (s: string): bool = string(s[0]) in letters)
17:05:28Mimbusekarlso: eval.nim(4, 54) Error: conversion from char to string is invalid
17:05:36ekarlsowhat was the fix for that again ? :D
17:06:23BlaXpirit_$s[0]
17:06:24BlaXpirit_not string
17:14:34shalabhhello
17:14:56shalabhis there a way to tell nim to pack object fields more aggressively. i.e. reduce sizeof()
17:16:30shalabhor to byte-align a certain field (array[6, char])
17:24:03BlaXpirit_shalabh, last time people asked about this, I heard the answer is no
17:24:21BlaXpirit_currently the only way to do this is define the struct in C and import it from header
17:26:02shalabhI see
17:28:17gmpreussner|workyeah, definitely something we need
17:28:32gmpreussner|worksome of the libraries i'm writing wrappers for require certain packing
17:28:44huodonI find raw pointer offset function in Rust used deal with T** , http://doc.rust-lang.org/0.11.0/std/ptr/trait.RawPtr.html#tymethod.offset;
17:29:09gmpreussner|worki'd like to see something like {.pack: 4.}
17:29:27BlaXpirit_it will be added some day
17:30:56reactormonkgmpreussner|work, what's packing?
17:31:17shalabhI have an object variant. When I put in either one of the two kinds, the size is 8, but if I put in both the size is 12.
17:31:29shalabhnot sure why alignment of one case should affect the other case.
17:32:04BlaXpirit_shalabh, give code
17:32:20shalabhhttps://gist.github.com/anonymous/03afa1931aeb2a4e9e6a
17:32:30reactormonkhuodon, if it's an array, make it an array in nim.
17:32:55shalabhalso, if I change int32 to array[4, char], size reduces to 8.
17:36:00*elbow joined #nim
17:36:10BlaXpirit_shalabh, C does this
17:36:23BlaXpirit_I detected nothing wrong with code generated by Nim.
17:37:28*sepisoad joined #nim
17:38:35shalabhBlaXpirit_:ok thanks
17:38:55sepisoadi need to read about nake files, would someone give me some links
17:38:56shalabhBlaXpirit_: do you know how I can fit the kind and the 32 bit int in 8 bytes, then?
17:39:09shalabhcos together they only take 5 bytes
17:39:19BlaXpirit_sepisoad, why do you think you need
17:39:19*Matthias247 joined #nim
17:39:35shalabhalso, are you saying the issue is with the C union?
17:39:55BlaXpirit_shalabh, nim just generates a union of two structs
17:40:02BlaXpirit_everything exactly as here
17:40:42shalabhright
17:41:02shalabhbut do you know why sizeof is 12? int32 should just be 32-bit aligned
17:42:48BlaXpirit_no idea
17:43:12*kniteli quit (Quit: Leaving)
17:45:49dom96sepisoad: There isn't really that much docs about nake files.
17:46:05gmpreussner|workreactormonk: packing determines how struct (object) members are aligned in memory
17:46:39gmpreussner|workfor example, a packing of 4 bytes would add padding to members smaller than 4 bytes so that the next field starts at a 4 byte boundary
17:47:17*MajorWork quit (Quit: Leaving)
17:47:31gmpreussner|worksome C libraries assume certain alignments/packings. it can also be important for cache performance.
17:49:28*xet7 quit (Quit: Leaving)
17:50:12*mpthrapp quit (Remote host closed the connection)
17:50:44*mpthrapp joined #nim
17:57:02shalabhI can use array[4, int8] and then cast it to int32, but seems ugly
17:57:55reactormonkshalabh, so it should be possible via macro?
17:58:04shalabhmaybe, but isn't it a hack?
17:58:14shalabhI'd rather do it right.
17:58:32reactormonkshalabh, how would you do it right in C?
17:58:43shalabhreactormonk:don't know :)
17:58:44shalabhlet me try
17:59:21shalabhwhat's confusing is that the union of two structs, each of which is 4 bytes, becomes bigger than 4 bytes
18:01:27shalabhbtw, castsing one struct to another should be free, right?
18:01:31shalabhi.e. no runtime cost?
18:04:40*EXetoC joined #nim
18:05:16dumdumWriting a priority queue has bubbled up in my list of priorities :D
18:06:22BlaXpirit_:D
18:08:38*kniteli joined #nim
18:09:51reactormonkshalabh, I'd say the array idea isn't too bad imo
18:12:35shalabhreactormonk:ok
18:13:01reactormonkshalabh, I'd say think up a good syntax, put it into dumpTree and see if it's valid
18:13:33*UberLambda joined #nim
18:15:50shalabhhuh? syntax?
18:15:55shalabhyou mean for a macro?
18:18:57shalabhI was just going to use cast()
18:20:58reactormonkshalabh, yeah, macro. You said you wanted to do it right ;-)
18:21:45shalabhwell yeah I guess it's an option
18:22:04*huodon quit (Ping timeout: 246 seconds)
18:22:09shalabhbtw, can I have macros that are invoked at the top level? e.g. where I would write 'proc'
18:22:17reactormonksure
18:22:23shalabhcool
18:22:27reactormonkyou can also have them as pragmas
18:22:36shalabhright that's the other thing I was thinking of.
18:22:45reactormonkso type object =\n something: int {.align: 4.}
18:22:54shalabhso where would I say 'give me all procs with this pragma' so that I can do something with them
18:23:07reactormonknope, they're local.
18:23:23shalabhlocal to the module?
18:23:25shalabhthat's fine too
18:23:40reactormonknope, local to the invocation
18:23:58shalabhbasically if I want to define a bunch of procs, then use a macro to combine them into one mega-proc (giant case statement).
18:24:16reactormonknot sure if that's possible
18:24:34shalabhok
18:25:05reactormonkIIRC you don't know when it's the last proc, so if you can build something that works without any finishing up code, might work.
18:25:37reactormonkBut since you want memory alignment I'd go with the syntax above with type ... = object\n something: int {.align: 4.} or similar
18:26:32reactormonkor ... = object {.align.} something: int {.align: 4.} and then remove the second align statement and mess with the object... if that's possible.
18:26:58shalabhso I attach a pragma to the field?
18:27:06reactormonkyeah, basically.
18:27:08shalabhwhere do I access it and how?
18:27:33reactormonkfirst, think up a syntax how you would want it to look like. Then import macros and dumpTree: <your syntax> and see if it compiles.
18:27:51shalabhok i need to think about this
18:30:39shalabhtemplates might be sufficient for what I want
18:31:31reactormonkthe complicated part to me is how you can access the fields, it looks like you want a projection, which is kinda hard in nim
18:35:50shalabhcast?
18:36:05shalabhcouldn't I just cast the 4-byte array to in32?
18:36:17shalabhC should optimize that away
18:36:49reactormonkyes, but then you can't use the object without casting in your code.
18:37:04reactormonkI would say abstracting the aligning would be perfect
18:37:25shalabhnot sure how that would work - C doesn't align the way I want.
18:37:35reactormonkhuh?
18:37:56shalabhsee https://gist.github.com/anonymous/03afa1931aeb2a4e9e6a
18:38:12shalabh'kind' is 1 byte
18:38:27shalabhso that with the 32-bit int should only take 1 + pad(3) + 4 = 8 bytes
18:38:31shalabhbut it ends up at 12 bytes
18:38:33shalabhnot sure why
18:38:41Araqshalabh: there is a .packed pragma to get what C's #pragma packed offers
18:38:42shalabhif I remove the A case, then it's 8 bytes
18:39:46shalabhAraq: that's nice
18:40:02shalabhI don't need to eliminate padding though. I dont mind 4-byte alignment for my 32 bit ints.
18:40:28shalabhbut I dont get why one case of the variant affects alignment for the other cases
18:42:56AraqI don't get it either but the generated C code is correct
18:43:06Araqthe C compiler does weird things here
18:43:59shalabhhttps://gist.github.com/anonymous/adfddb363e57282b9ae2
18:44:00shalabhok
18:44:23shalabhso the solution is just to use array[4, char] and then cast it to int32
18:44:30shalabhsince casting will be free, I hope
18:44:43shalabhand I can possibly hide it behind some nice template or macro API
18:45:33shalabhI dont want {.packed.} because it would misalign stuff
18:45:43shalabhanyways, at least Nim is doing fine here.
18:47:41Araqer but your array[6, char] means the compiler decided to align it on a 4 byte boundary
18:48:04Araqso ... it takes up 8 bytes and you need another 4 bytes for the 'kind' field
18:48:12Araqand so it requires 12 bytes
18:48:21shalabhlook at the new gist
18:48:21shalabhhttps://gist.github.com/anonymous/adfddb363e57282b9ae2
18:48:50shalabhexplain why each Obj1 and Obj2 take 8 bytes but Obj3 takes 12
18:48:59shalabhObj3 takes one case from Obj1 and one case from Obj2
18:49:08shalabhso technically they can all fit in 8 bytes, aligned.
18:49:41Araqyeah you're right
18:49:46Araqit makes no sense :P
18:50:03AraqI wonder what Visual C++ does
18:51:12Araqsame behaviour with Visual c++
18:51:33Araqoh well
18:51:58shalabhright, didn't expect different.
18:52:02Araqthat explains why I never got compile-time 'sizeof' to work properly though
18:52:27shalabhso I think instead of a variant, I'll use an object with (kind: Kind, val: array[7, char]) and then typecast the array as necessary
19:00:13shalabhinterestingly if I combine int32 with array[4, char] instead of array[7, char] it fits in 8 bytes again
19:00:30shalabhso it's trying to align the first field of each case in the union or something
19:01:11*jodelith joined #nim
19:05:15ekarlsoAraq: does nim look for any paths or smth in env variables ?
19:07:34*jodelith quit (Ping timeout: 246 seconds)
19:08:02Araqekarlso: Nim doesn't care about environment vars
19:11:43*janprill_ joined #nim
19:14:41*janprill quit (Ping timeout: 246 seconds)
19:16:41*janprill_ quit (Ping timeout: 264 seconds)
19:17:01*sepisoad quit (Quit: Leaving)
19:18:14ekarlsoAraq: how does the nim binary compute where the lib/system.nim etc is then relative to itself ?
19:18:55reactormonkekarlso, that's in nimcfg IIRC
19:19:00*bpr joined #nim
19:22:46bprThere is a discussion about Nim on the Rust subreddit I chanced on in which inquiries were made about the status of a native backend. I recall that such a thing was mentioned before. What's going on with that?
19:23:00*kernasi joined #nim
19:23:01kernasihi
19:23:06reactormonkbpr, native backend? Nim compiles to C
19:23:07reactormonkkernasi, o/
19:23:24kernasihey reactormonk
19:23:35ekarlsoEastByte: I got a funny thing where nim installed globally kinda works but not in a chroot
19:23:46ekarlsoError: cannot open 'lib/system.nim'
19:24:36reactormonkekarlso, huh. check the nimcfg, I assume the path in there is absolute
19:25:39bpr<reactormonk> Yes, I know that. But a native backend has been discussed. An LLVM one was discussed and mentioned in the docs at some point, but I think it has been abandoned.
19:26:05reactormonkbpr, what's more native than machine code?
19:26:41ekarlsowhich part of the path reactormonk ?
19:26:51bpr<reactormonk> What we have here is a failure to communicate. :-(
19:27:33bpr<reactormonk> Please read the relevant thread here http://www.reddit.com/r/rust/comments/2wy4q3/jason_livesays_answer_to_of_the_emerging_systems/
19:27:58*kernasi is totally fine with nim generating c code, hopes it will never change :)
19:29:32bprkernasi Once again, a native code IN ADDITION TO. I assume you hope that generating JS never works either ;-)
19:29:52kernasiI don't care about nim -> js :)
19:29:59kernasithat would be fun, too, I guess :)
19:30:48*brson quit (Quit: leaving)
19:32:03kernasiI learned pascal "several" years ago so I'm just happy nim exists :)
19:33:53*UberLambda quit (Ping timeout: 240 seconds)
19:34:54kernasithat must sound extremely stupid
19:35:14kernasiwell, go on with your discussion :)
19:35:19*brson joined #nim
19:37:58*fizzbooze joined #nim
19:44:15reactormonkbpr, I see. Admittedly I've never worked with threads in nim. And on the GC side, there's a GSoC project around. I'm not qualified an opinion here ;-)
19:44:46reactormonkbpr, on the other side, I'm currently using nim macros to generate ragel code. So the gen to C has its advantages ;-)
19:45:02reactormonk... which is ugly as fuck, but I can't be bothered to write C for ragel.
19:45:24bpr<reactormonk> I did some poking on the forum and found that Araq had mentioned something about this on 6-22-14
19:45:34reactormonkbpr, link plz
19:45:47bprI think compiling to C has many advantages. But it has disadvantages too.
19:45:48*gokr1 joined #nim
19:46:00reactormonkbpr, sure, like incorrect C code ^^
19:47:56bpr<reactormonk> http://forum.nim-lang.org/t/480
19:48:06reactormonkAraq, I hope this wins the contest for the ugliest nim code ever ;-)
19:49:20reactormonkbpr, ok, I can't give you a good statement on that.
19:49:56kernasibtw. is there a plan to move to c++? (I hope not)
19:51:04bpr<reactormonk> In the reddit/r/rust thread, pcwalton mentions some other problems with C compilation, in additon to ones that Araq mentions. I still think Nim -> C has many advantages, but I wonder about another backend.
19:51:05*reem joined #nim
19:51:25reactormonkbpr, like C semantics fucking with GC?
19:52:36bpr<kernasi> I hope not, but that could have advantages too. 'I hope not' because that would divide the effort of people working on the compiler for IMO not as much gain as a native backend.
19:52:50kernasik
19:53:46reactormonkbpr, I'd take a look at it because I have a bit more clue about JS than about LLVM.
19:54:53*BitPuffin quit (Ping timeout: 240 seconds)
19:57:52bpr<reactormonk> Yes, C makes some things very difficult. There are a lot of posts on funny C from John Regehr, like this http://blog.regehr.org/archives/1180 but working with C/Nim is straightforward, an undeniable advantage.
19:58:31bprI still think C is crapulent, but the rest of the world doesn't care :-)
19:59:12EXetoCgenerating it is very different though
20:01:10*janprill joined #nim
20:03:45*xet7 joined #nim
20:04:02*koz joined #nim
20:04:27reactormonkfor event, suffix in @[(enter, "_e"), (exit, "_s")] <- any way to get this to work? event is currently the index.
20:08:34EXetoCthis will look for 'pairs'. perhaps you can provide a specialization that is better matched
20:09:11reactormonkAraq, https://gist.github.com/reactormonk/2f41b0e12e8d4c7f1aa8 create issue?
20:15:26*koz is now known as koz_
20:15:55*dumdum quit (Ping timeout: 256 seconds)
20:17:37*pafmaf joined #nim
20:20:25*pafmaf quit (Client Quit)
20:22:06*gokr quit (Quit: IRC for Sailfish 0.9)
20:23:18fowlreactormonk, invoke items
20:23:36fowlexplicitly
20:23:41reactormonkfowl, hm=
20:24:15reactormonkfowl, hm=
20:24:17reactormonkoops
20:24:52*gokr1 quit (Ping timeout: 245 seconds)
20:24:55fowlthe compiler uses pairs() automatically when you use a,b like that
20:25:05fowlso invoke items explicitly
20:25:38reactormonkdid
20:25:45reactormonkdoesn't help, same error
20:26:20def-reactormonk: did you try (event, suffix)?
20:26:44reactormonkdef-, invalid syntax
20:26:54Varriountmeep
20:27:06*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
20:27:38fowlreactormonk, it works for me
20:27:52reactormonkfowl, where do I put it?
20:27:54fowl.eval
20:27:54fowlfor a,b in items(@[(1,2), (3,4)]): echo a,"::",b
20:27:57Mimbusfowl: <no output>
20:28:22fowlthanks for making look like a fool Mimbus
20:28:58fowlthat does work though
20:29:00reactormonkah, yup, works with items.
20:29:26fowlreactormonk, thats how you explicitly invoke something, rather than letting the compiler insert it for you
20:29:48*EXetoC quit (Quit: WeeChat 1.1.1)
20:32:08*janprill_ joined #nim
20:35:02*janprill quit (Ping timeout: 256 seconds)
20:37:31ekarlsodtscode: around ?
20:40:48*Menche joined #nim
20:50:12*koz_ left #nim ("Leaving")
21:05:38*dumdum joined #nim
21:07:09*bpr quit (Quit: Page closed)
21:10:34*irrequietus joined #nim
21:13:22*reem quit (Remote host closed the connection)
21:13:24*BitPuffin joined #nim
21:16:11*pafmaf joined #nim
21:17:47*reem joined #nim
21:18:12*BitPuffin quit (Ping timeout: 245 seconds)
21:24:25*kuzy000_ quit (Ping timeout: 244 seconds)
21:24:33*pafmaf quit (Quit: This computer has gone to sleep)
21:31:48*polde quit (Quit: q)
21:34:21*polde joined #nim
21:41:57*koz_desktop left #nim ("Leaving")
21:42:30*nande joined #nim
21:47:44*enquora quit (Quit: enquora)
21:52:26*janprill_ quit (Remote host closed the connection)
21:53:09fowlAraq, you here?
21:54:44fowlvoid and empty return type is not handled correctly for getType
21:55:20*Menche quit (Ping timeout: 265 seconds)
22:01:05*brson quit (Ping timeout: 250 seconds)
22:03:12*NimBot joined #nim
22:19:17ekarlsodom96: did you get to look at my nimble stuff ?
22:19:41*fizzbooze quit (Ping timeout: 264 seconds)
22:24:58*mpthrapp quit (Remote host closed the connection)
22:33:03*dumdum quit (Ping timeout: 256 seconds)
22:38:24*reem quit (Remote host closed the connection)
22:41:49*key_ joined #nim
22:43:16*pregressive quit (Remote host closed the connection)
22:44:53key_hi there. any advice on 2D game dev using nim? i see there is a graphics lib directly in stdlib, which relies on SDL out of the box. i've looked around and haven't turned up much yet, would i basically be building everything else i need from scratch?
22:45:47def-key_: sdl2 and csfml might be nice too. csfml has some nice example games in the repo: https://github.com/blaxpirit/nim-csfml
22:45:59key_excellent
22:46:33def-key_: but i don't think there is an up-to-date high-level 2d gaming library for Nim right now
22:46:46def-(that's not a wrapper)
22:46:56key_do you think think there is/would be demand for such a thing?
22:47:04def-very much so
22:47:32key_the only higher level library i have worked extensively with is kivy in python
22:47:33def-Nim would be excellent for writing 2D games, I even made a GSoC idea for this: https://github.com/Araq/Nim/wiki/GSoC-2015-Ideas#high-level-game-library
22:47:49key_which does like templates for ui, and provides a bunch of compilation stuff for cross platform
22:48:02key_yeah nim seems like a great choice for game development
22:48:10key_oh cool
22:48:55*reem joined #nim
22:50:57BlaXpirit_def-, really?
22:51:23def-BlaXpirit_: really what?
22:53:36BlaXpirit_idea seems weird
22:55:27key_for a higher level library?
22:56:18BlaXpirit_it's not worth writing in nim if there are already good libraries
22:57:42key_the wrapper of C/C++ libs are sufficient then you mean?
23:00:33BlaXpirit_at least they will be if proper destructors are implemented
23:00:59key_i would say that gaming is a goal which draws in a lot of... newer programmers. having a higher level library that can abstract away some of the pain of a thinly wrapped c library and tie together stuff such as audio, graphics, networking, etc has proven to be popular in other languages
23:01:17BlaXpirit_https://github.com/blaxpirit/nim-csfml
23:01:34BlaXpirit_it's almost literally what you just said
23:02:09key_yeah, def- linked this it looks great! i see it is your project so thanks... im definitely going to take a look at this
23:02:27BlaXpirit_and if we are talking about a 3D engine like in that idea
23:02:43BlaXpirit_well that's not something a few students can design out of nothing
23:02:49key_im not personally interested in 3D but there is demand for it yeah
23:03:01*fizzbooze joined #nim
23:03:07*Outlander joined #nim
23:04:04*n0x0ff quit (Ping timeout: 256 seconds)
23:08:24*girvo joined #nim
23:08:30*girvo left #nim (#nim)
23:08:33*girvo joined #nim
23:24:17*sillesta quit (Ping timeout: 244 seconds)
23:33:33*irrequietus quit ()
23:34:26*brson joined #nim
23:38:39*Menche joined #nim
23:53:43*filwit joined #nim
23:54:41filwitdom96: hey, can't stay long.. just wanted to drop by and say don't try that Aporia PR yet.. I found a couple of bugs in it, and I'd rather not leave you with a bad first impression due to a couple of regex errors
23:56:18*BlaXpirit_ quit (Quit: Quit Konversation)
23:56:26*elbow quit (Read error: Connection reset by peer)
23:56:52filwitdom96: but I am pretty busy this week, so it might take me a couple of days to work all of them out. Just wanted to let you know what's going on and that I can fix all of them, but won't actually have them fixed for a bit due to time.
23:59:32*Matthias247 quit (Read error: Connection reset by peer)