<< 29-01-2015 >>

00:01:44*Matthias247 quit (Read error: Connection reset by peer)
00:04:28*Trustable quit (Quit: Leaving)
00:22:00*novist quit (Ping timeout: 276 seconds)
00:24:52*BitPuffin joined #nim
00:34:51Synatraello
00:39:22*lws_ quit (Ping timeout: 265 seconds)
00:39:39*threewood quit (Ping timeout: 264 seconds)
00:41:23Araqonionhammer: here you go. dirty files still don't work though
00:46:02*gmpreussner__ joined #nim
00:46:07*JStoker quit (Quit: JStoker is gone :()
00:51:28SynatraOk()
00:52:10*JStoker joined #nim
01:02:03*novist joined #nim
01:03:09Mat4ciao
01:03:12*Mat4 left #nim (#nim)
01:13:29*sampwing quit (Ping timeout: 252 seconds)
01:13:49*gmpreussner__ quit (Quit: Konversation terminated!)
01:15:12*sampwing joined #nim
01:25:31*rational quit (Quit: Lost terminal)
01:31:07flaviuBtw, is that thing that ekarlso a bug? Other people have hit against it, but I'm not really sure what the problem is.
01:31:34flaviu*that ekarlso came across
01:32:33*sampwing quit (Ping timeout: 252 seconds)
01:38:01Araqdunno
01:38:39Araqif you use .compile then the compiler generates a crc32 checksum to detect if it needs recompilation
01:41:59flaviuBut it seems that if you already have a nimcache before introducing the compile pragma, the compiler doesn't look at the files.
01:43:13flaviutotally unrelated to this: I'd like to point out that crc32 is pretty terrible for this use, but I'm sure you already know that :)
01:45:59Araqyup I do
01:46:18AraqI copied it from FPC back in the days
01:47:11Araqnever heard of any problem whatsoever related to this, but I'm sure academics find it horrible
01:53:16*threewood joined #nim
01:55:47*fizzbooze joined #nim
02:01:40*gokr quit (Ping timeout: 244 seconds)
02:02:04Varriountdom96: Have you applied security patches to the VPS?
02:04:12Varriountdom96: I've updated the VPS, however a restart is *required* to fix some recent security vulnerabilities with glibc.
02:04:58VarriountSince I don't know what's in the initscripts and what's not, I'll leave you to do it.
02:09:54Araqonionhammer: dirtyfile now works too :-)
02:09:56Araqgood night
02:22:05*Puffin joined #nim
02:23:44*BitPuffin quit (Ping timeout: 246 seconds)
02:25:29*springbok joined #nim
02:25:58*gtrundle joined #nim
02:28:20gtrundleHi all
02:28:54reactormonkmorning/evening
02:29:23flaviureactormonk: it's always morning!
02:30:17*sampwing joined #nim
02:31:34gtrundleHa, my days of being a morning person are over. Quick dumb question about a foreign thread calling back into nim.
02:32:56gtrundleSpecifically, I see where I'm supposed to call setupForeignGc(), and I do that. But on windows, I end up crashing the first time the callback is hit because it looks like the Tls vars aren't set up.
02:33:27gtrundleThis happens in nimFrame(), so it's technically before I can do anything in that function anyway, unless there's a pragma I missed.
02:35:05gtrundleWorks on linux, but it's not having to do the emulated TLS vars. Anyone know if I'm missing something, or should I just open a defect?
02:38:16flaviuAraq is probably the person who could help you, but he's asleep.
02:38:24flaviuI think an issue would be best.
02:38:55*sampwing quit (Ping timeout: 252 seconds)
02:40:51SynatraHallo
02:41:17*gsingh93 quit (Quit: Connection closed for inactivity)
02:44:21gtrundleok, thanks flaviu.
02:45:53*ehaliewicz quit (Ping timeout: 252 seconds)
02:51:19*meanfish` quit (Remote host closed the connection)
02:52:05*vendethiel quit (Ping timeout: 246 seconds)
02:56:17*vendethiel joined #nim
02:57:10*darkf joined #nim
03:17:26onionhammerAraq awesome
03:19:26*vendethiel quit (Ping timeout: 276 seconds)
03:28:33*VinceAddons quit (Read error: Connection reset by peer)
03:30:30EXetoCinnit!
03:30:57*brson quit (Quit: leaving)
03:31:05*brson joined #nim
03:32:40*fizzbooze quit (Quit: WeeChat 1.1)
03:32:57*fizzbooze joined #nim
03:33:40*brson quit (Client Quit)
03:33:48*brson joined #nim
03:34:40*brson quit (Client Quit)
03:35:23*EXetoC quit (Ping timeout: 252 seconds)
03:39:17*vendethiel joined #nim
04:03:01*vendethiel quit (Ping timeout: 264 seconds)
04:07:33*Puffin quit (Ping timeout: 276 seconds)
04:15:04*ehaliewicz joined #nim
04:19:20*vendethiel joined #nim
04:21:39*gtrundle quit (Ping timeout: 264 seconds)
04:29:37*lws joined #nim
04:29:37*lws quit (Changing host)
04:29:37*lws joined #nim
04:38:01*sampwing joined #nim
04:42:12*vendethiel quit (Ping timeout: 272 seconds)
04:42:29*sampwing quit (Ping timeout: 252 seconds)
04:43:36*Boscop_ quit (Read error: Connection reset by peer)
04:43:55*Boscop_ joined #nim
04:44:29*vendethiel joined #nim
05:08:35*vendethiel quit (Ping timeout: 265 seconds)
05:19:06*vendethiel joined #nim
05:22:09*kashyap_ joined #nim
05:22:33kashyap_Hi ... I am trying to implement the outb function using inline assembly - not sure what the problem is - http://lpaste.net/119486
05:26:24*Demon_Fox quit (Quit: Leaving)
05:26:35*threewood quit (Ping timeout: 256 seconds)
05:29:52*brson joined #nim
05:35:56*girvo joined #nim
05:36:32girvoHey all. Quick Q: Does anyone use a build system for their Nim projects, like CMake for example (or even bare Makefiles)? What works best with Nim?
05:42:53*vendethiel quit (Ping timeout: 265 seconds)
05:57:32*fizzbooze quit (Quit: WeeChat 1.1)
06:06:13kashyap_girvo ... I've noticed something called nakefile
06:14:02*sampwing joined #nim
06:24:13Varriountgirvo: Well, there's nothing stoping you from using a build system, but the module system Nim provides (along with project files) negates a most of the need for any sort of build syste,
06:24:17Varriount*build system
06:24:50Varriountkashyap_, girvo: Nake is a build system meant for Nim . fowlmouth wrote it
06:27:55kashyap_Thanks Varriount
06:28:18kashyap_I have a question about implementing inline assembly functions where there is return value
06:28:33kashyap_Looks like it may be a bug in nim
06:29:11*sampwing quit (Ping timeout: 252 seconds)
06:31:23*girvo quit (Ping timeout: 252 seconds)
06:59:48*sdw quit (Ping timeout: 276 seconds)
07:03:33*Puffin joined #nim
07:08:04*Puffin quit (Ping timeout: 255 seconds)
07:08:50*gokr joined #nim
07:13:14*bjz joined #nim
07:15:19reactormonkkashyap_, oh yeah, lemme look up the number
07:15:42*bjz quit (Client Quit)
07:15:54reactormonkkashyap_, https://github.com/Araq/Nim/issues/1907 try the devel branch of the compiler
07:17:37reactormonkyeah, the devel branch includes the fix
07:26:41kashyap_cool...thanks reactormonk
07:28:21reactormonkkashyap_, you know how to build it?
07:28:45*nande quit (Remote host closed the connection)
07:28:54kashyap_Is it not the same as the master branch?
07:29:32kashyap_I've been building the master branch using the steps mentioned in the download page
07:29:55reactormonkyeah, it's the same. Just mix in a git checkout devel somewhere
07:30:11kashyap_got it
07:34:56dtscodeif we actually decide to setup a repo, i think i might provide both devel and master and wrap an executable around it with an added --devel option
07:35:16reactormonkdtscode, too much trouble
07:35:55dtscodeapparently everything i do is too much trouble
07:36:31reactormonkdtscode, no, seriously. you'd need two separate namespaces. I don't think the compiler is built to be namespaced.
07:37:15reactormonkYou'd have to rewrite the compiler for that. Or something that packages both binaries into a single one... which doesn't sound too easy either
07:37:25dtscodenot neccesarily
07:37:31dtscodeyoure over complicating it
07:37:37reactormonkhow come?
07:37:43dtscodeill explain more clearly
07:37:49dtscodecause i said it really weird
07:38:21dtscodeok, so it would have "nim" in say /bin or /usr/bin or something like that.
07:39:33dtscodenim would then pass all of the arguments to /etc/nim/master/bin/nim (or some path like that) with the added flag of where the libs are located
07:39:52reactormonknow that sounds better
07:40:04dtscodeif --devel is passed, it does the same thing,, except it calls /etc/nim/devel/bin/nim (minus the --devel flag)
07:41:06*reem joined #nim
07:41:22*MattAitchison quit (Ping timeout: 255 seconds)
07:41:29reactormonkso you basically wanna have a wrapper script
07:42:11dtscodeyes
07:42:16*JinShil joined #nim
07:42:30dtscodeeither that, or provide nim-devel, and put the libraries in a central location
07:42:47*MattAitchison joined #nim
07:58:10*st2p quit (Ping timeout: 246 seconds)
08:05:31*bjz joined #nim
08:06:34*MattAitchison quit (Ping timeout: 255 seconds)
08:08:50*MattAitchison joined #nim
08:19:14*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
08:23:40*MattAitchison quit (Ping timeout: 255 seconds)
08:27:51*MattAitchison joined #nim
08:33:27*Sphax joined #nim
08:45:43*MattAitchison quit (Ping timeout: 255 seconds)
08:46:53*MattAitchison joined #nim
08:51:34*MattAitchison quit (Ping timeout: 255 seconds)
08:56:32*ehaliewicz quit (Ping timeout: 245 seconds)
08:57:02*JinShil quit (Quit: Konversation terminated!)
09:00:34*genbattle joined #nim
09:02:01*dtscode quit (Quit: (dtscode.io))
09:02:32*vendethiel joined #nim
09:03:07*Sphax quit (Quit: ZZZZZzzzzz)
09:05:28*genbattle left #nim ("Leaving")
09:07:54*wtw quit (Quit: leaving)
09:14:41*wtw joined #nim
09:23:22*Sphax joined #nim
09:29:49*vendethiel quit (Ping timeout: 245 seconds)
09:33:19*brson quit (Quit: leaving)
09:42:46*Trustable joined #nim
09:49:46*reem quit (Remote host closed the connection)
10:00:52*dumdum joined #nim
10:15:16*BlaXpirit joined #nim
10:18:12*bjz joined #nim
10:21:44ekarlsoso nimble now reads a .nimble file and posts the info with a release
10:21:52ekarlsoalso it can install now from the registry
10:29:18*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
10:42:41reactormonkAraq, morning ;-)
10:44:34reactormonkI'd post a short "nope, not gonna happen for speed reasons" to https://github.com/Araq/Nim/issues/2029 but that wouldn't help, would it?
10:45:38*VinceAddons joined #nim
10:50:09*bjz joined #nim
11:07:56reactormonkdef-, mind adding a few tests to the mitems?
11:08:50def-reactormonk: never understood how Nim testing works, since many tests don't even compile for me
11:09:58reactormonkdef-, the readme is short an concise. one of the keys in the "discard" section is output: "..." run the tests via ./koch c <folder where your tests are>
11:10:04reactormonkdon't forget to start the test with a "t"
11:10:40*Sphax quit (Quit: ZZZZZzzzzz)
11:10:41reactormonke.g. https://github.com/reactormonk/nim/blob/5ecc461a944b54a516e6f81df4bd6db95a86e682/tests/exprs/thighCString.nim
11:12:08reactormonkin your case patch some into stdlib/ and some into system/ or just everything into collection/
11:13:25*vendethiel joined #nim
11:16:19reactormonkdef-, short enough of an elevator pinch?
11:16:46def-ok, will look at it later
11:27:34*JinShil joined #nim
11:34:03*keyle joined #nim
11:34:38*vendethiel quit (Ping timeout: 246 seconds)
11:43:25*keyle quit (Quit: <Morbo> Chitchat achieved!)
11:43:33*EXetoC joined #nim
11:45:37*chemist69 joined #nim
11:50:02*kuzy000_ joined #nim
11:59:06*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
12:01:29Araqhrm uh oh
12:01:48*Araq just got an idea for an incredible hack
12:03:03AraqBlaXpirit: what if we make '..<' a first class iterator/proc and warn about old usages that use '.. <' (note the space!)?
12:03:50Araqthis way, we can keep the negative indexing and have the exclusive upper bound
12:04:28*Araq wonders if this is brilliant or horrible
12:04:55kashyap_Hi... I am trying to translate the source code of xv6 (a teaching unix os) into nim - https://github.com/ckkashyap/nim-xv6 .... After introducing some "structures" I've started getting Error: system module needs 'asgnRefNoCycle' ...
12:05:31*bjz joined #nim
12:05:37kashyap_I'm compiling with --noLinking --os:standalone
12:06:23Araqkashyap_: what kind of "structures"?
12:06:42Araqnote that you cannot use 'string' as that relies on the GC
12:06:46kashyap_essentially translating structs from the c code into type
12:06:51EXetoCAraq: why not slices+items?
12:07:32kashyap_I've now pushed in the change that is giving this error
12:07:42kashyap_https://github.com/ckkashyap/nim-xv6
12:08:11Araqkashyap_: use 'cstring' instead of 'string' in Tspinlock
12:08:22Araqalso note that the T convention is deprecated
12:08:37*vendethiel joined #nim
12:08:39Araqso it should be Spinlock with a capital S instead
12:08:49kashyap_got it .. thanks Araq
12:08:57*Sphax joined #nim
12:09:01kashyap_so ... I would not be able to use string in the kernel?
12:09:18AraqI would port the GC to work in kernel space
12:09:36Araqthen you can use strings ;-)
12:10:03kashyap_:) .. yeah...btw the coding guidelines page needs to be updated
12:10:20Araqwhich one?
12:10:54kashyap_http://nim-lang.org/intern.html#coding-guidelines
12:11:08Araqwell these are for compiler development
12:11:17Araqthe compiler still uses T and P everywhere
12:11:42kashyap_oh okay
12:12:31kashyap_and btw ... nim - awesome !
12:12:37Araqhttps://github.com/Araq/Nim/wiki/Style-Guide-for-Nim-Code
12:12:49Araqthese are the official guidelines
12:12:54kashyap_thanks
12:13:03Araqand ugh ... we don't link them from the website ... of course ...
12:13:31Araqkashyap_: please check out "regionized pointers" for kernel development
12:13:52Araqhttp://nim-lang.org/manual.html#memory-regions
12:14:52kashyap_thanks - is there some place that lists kernel projects in Nim?
12:15:40Araqnah, there are not many kernel projects in Nim
12:16:42AraqI can give you instructions for porting the GC to kernel space, but I think you're not ready for that yet ;-)
12:17:04kashyap_far from it
12:17:21kashyap_I just want to see a working readable kernel code :)
12:23:00dumdumI introduce a new symbol in a template, but its not visible at call sites :( http://pastebin.com/VAMjH2x2
12:23:44dumdumerrors with: Error: undeclared identifier: 'it'
12:24:44EXetoChttps://github.com/dom96/nimkernel.git
12:28:16dumdumnm, needed {.inject.}
12:31:23Araqdumdum: or just .immediate, dirty for templates
12:31:32Araqthat's usually easier for newbies
12:32:30dumdumthanks
12:34:00dumdumyep, that works too
12:50:10*BlaXpirit quit (Read error: Connection reset by peer)
12:50:55*BlaXpirit joined #nim
12:51:03SynatraHi
12:52:49ekarlsoAraq: would it be hard to add db transaction support ?
12:53:30Araqekarlso: there is no query abstraction whatsoever so your question makes no sense
12:53:44ekarlsoah, that's correct :/
12:53:52ekarlsowould be soo nice to have
12:55:45Araqbtw there is an SQL parser in Nim
12:55:55Araqsomebody should make that work with the VM
12:56:15Araqand then you can get compiletime checking of your SQL statements
13:01:01BlaXpiritnow i'm here
13:01:57BlaXpiritAraq, I'm pretty sure I made that suggestion about ..< or something pretty close
13:02:23BlaXpiritthe problem would be duplication of slice-based operations for every instance
13:03:00BlaXpiritwhat do you think "..<" would return?
13:03:55BlaXpirityou might remember the workaround i suggested - https://gist.github.com/BlaXpirit/3de6485bc57bee074a21 - this is a "..<" that requires no other changes but is hacky
13:04:10BlaXpiritmaking a non-hacky one is problematic
13:04:34ekarlsoAraq: where is that ?
13:07:49BlaXpiritproblematic - as in, would require a separate slice type and addition of operations on it
13:13:47BlaXpiritnow i'm kinda away again
13:25:26*ibeex joined #nim
13:27:27ibeexi was looking at online documentation and I can't find anywhere doc for 'open("out.txt", fmWrite)'
13:27:40ibeexi am trying nim for first time on osx
13:27:57*gtrundle joined #nim
13:28:03def-ibeex: http://nim-lang.org/system.html#open,File,string,FileMode,int_2
13:28:30*Puffin joined #nim
13:28:46def-And you can find most documentation through here: http://nim-lang.org/documentation.html
13:29:23*dumdum quit (Ping timeout: 256 seconds)
13:29:55ibeexthx, I guess I was confused by proc in front off it
13:30:37ibeexone more thing in nim interactive
13:30:42ibeexthis crashes
13:30:44ibeex>>> var o = open("output.txt", fmWrite)
13:30:44ibeexlib/system/sysio.nim(217, 19) Error: cannot 'importc' variable at compile time
13:30:45ibeexlib/system/sysio.nim(220, 8) Error: VM is not allowed to 'cast'
13:30:45ibeexError: unhandled exception: lib/system/sysio.nim(220, 8) Error: VM is not allowed to 'cast' [ERecoverableError]
13:30:57ibeexosx brew nim
13:31:01def-nim interactive doesn't really work. I would recommend not using it
13:31:45ibeexto bad, I am dedicated ipython user so that was looking realy handy
13:32:08def-I'm working to get a new interactive mode, but i'm pretty busy. So no idea when it will be done
13:33:38EXetoCbefore 2016? :-)
13:33:44def-sure
13:34:07def-if i get it working at all
13:34:09*gtrundle quit (Ping timeout: 252 seconds)
13:39:15ekarlsoi'll push a fix later to make nimble support proxies..
13:40:05*Roin joined #nim
13:43:03kashyap_Hi...How can I do bitfields?
13:44:03xeizlifOne way is to manually implement some bit manipulation functions.
13:44:43kashyap_I was hoping to be able to give names to the bits in a structure
13:45:22xeizlifAlso there are valid reasons to use bitfields but are you certain that you need them? Unless you're writing for a C file format, are extremely cache-constrained and/or have a bunch of bits it's probably better to just use the bool type
13:45:37xeizlifbecause bitfields are slow
13:45:57Araqno, it's better to use a set[SomeEnum]
13:45:59xeizlifI see. I don't know of any way to do that but it's probably a good idea to just write a function to access them
13:46:24xeizliflike proc someBits and then do Type.someBits to pull them out of Type's .data member
13:46:30xeizlif(no need fo r[])
13:46:33xeizlif*for []
13:46:40xeizlifor do what Araq did which is more general
13:47:03kashyap_I'll check out set
13:47:15kashyap_thanks Araq and xeizlif
13:47:26xeizlifno problem :)
13:47:39Araqxeizlif: bitfields are not really slow. and one is always cache-constrained ;-)
13:48:24Araqcalculating square roots is faster than a cache miss
13:48:35xeizlifbut a bitfield has nothing to do with that
13:48:52xeizlifwell, in that cache misses are really slow, yes
13:49:05kashyap_sorry .. I just checked out set data type and not sure how I can make it map to a certain memory size
13:49:10xeizlifbut you'd have to actually see if you'd benefit before expending the effor
13:49:11xeizlift
13:50:33kashyap_i'd like to map a 64bit mem region ( a segment descriptor) .. can I do that with set?
13:51:08xeizlifFor that I'd really recommend writing accessor functions to do it, with proc
13:51:36xeizlifthen directly do the bit manipulation -- but this way the rest of the code is neat as if you were doing it with C's struct bitfields
13:51:53kashyap_got it
13:53:27Araqkashyap_: you cannot do that in C either as C specifies nothing about bitfield layout
13:53:58xeizlifThis is true. It's compiler-dependent and even then it can change between compiles
13:54:38xeizlifhowever it's what I did when I wrote an OS >_>. It worked for me but it's certainly bad practice for C
13:55:17kashyap_well https://github.com/ckkashyap/xv6/blob/master/mmu.h#L193 ... I thought if the structure size is "round" then the bitfields fall in place
13:55:41*Roin quit (Quit: WeeChat 1.1)
13:55:52*Roin joined #nim
13:56:32xeizlifBTW you can use overloading for read (no arguments) and write (1 (or more?) argument) to get it to look almost like C's bitfields would
13:56:34kashyap_there is no guarantee from the language ....somehow never thought about it
13:57:06xeizlifreading is var x = Type.field, writing is Type.field x
13:57:21xeizlif(with no = -- oh but you can use `=` to get that, too)
13:57:30xeizlifbut you might already know that :)
13:57:52kashyap_got it ... thanks
14:00:52*threewood joined #nim
14:10:06*Sphax quit (Quit: ZZZZZzzzzz)
14:18:33def-is there a reason we don't have `$` for arrays?
14:20:22*dumdum joined #nim
14:22:10Araqdef-: yeah, it gets priority for array[X, char] then
14:22:16Araqwhich sucks
14:22:49Araqbootstrapping even fails then iirc
14:23:09def-what about overloading for array[X, char]?
14:23:45Araqthat should work but it's meh
14:24:15*Sphax joined #nim
14:24:18Araqyou can also do 'when T is char' in the $ for arrays
14:24:32def-right
14:24:59def-I think it would be nice to echo arrays by default
14:25:10def-why is it meh?
14:25:55Araqbecause it needs to special case 'array of char'
14:27:16Araqalso ... it's not clear that 'array of char' should be special cased
14:27:40Araqbut if you don't what used to match 'cstring' now matches your array version better
14:29:48Araqit breaks code is sublte and suprising ways, let's not do it
14:29:56Araq*in subtle
14:31:22Araqbug report: 'echo' for my array ['a', 'b', '\0', 'd'] produces only "ab" WTF.
14:31:22Varriountdef-: echo(repr(arrayOfChars))
14:32:04Araqbut array [1, 2, 0, 4] works
14:32:18VarriountAraq: I found something that you would have liked with regards to processor instructions
14:33:08VarriountThe 80186/80188 Intel processor supported a 'BOUND' instruction, which checked an array index against boundaries.
14:33:24AraqI know ;-)
14:33:56Araqand then that instruction got slower than explicit checking
14:34:15VarriountReally? How odd.
14:34:59Araqand now it's coming back with AVX
14:35:44def-Varriount: are you sure the code in your tester is ok? In my experience cstring of a string does weird things
14:36:02def-This segfaults for me for example: https://gist.github.com/def-/15feb9775721a13a851e
14:36:26Araqit's not odd at all, native code was mostly produced by C/C++ compilers which never emitted the BOUND instruction so it didn't get optimized
14:37:07Varriountdef-: Tester? You mean my code snippet?
14:37:10def-yes
14:37:27Varriount*shrug* I didn't run it.
14:37:40def-wait, that wasn't yours, that was reactormonk's. sorry
14:37:46dumdumif I have enum members: a,b,c and object variants defined using case .. of, how do I model the case when option 'c' for example contributes no new data field to the object?
14:37:59def-dumdum: nil
14:38:12Araqdiscard works now too
14:38:16def-nice
14:38:17dumdumthanks!
14:38:17VarriountWell, it should be 'discard'
14:38:33dumdumError: identifier expected, but found 'keyword discard'
14:38:37dumdumnil works
14:38:40VarriountAraq: I'm doing evil things today, like taking the address of a parameter.
14:38:57Varriount(an immutable, non-var parameter)
14:39:05EXetoChow?
14:39:37VarriountEXetoC: template immutAddr(a: expr): expr = addr(cast[var type(a)](a))
14:39:57def-dumdum: works for me on current devel branch
14:40:19def-(since 2015-01-12)
14:40:43dumdumoo i am on pre built 0.10.2
14:41:12dumdumi will get on devel once aporia suggest/ide tools works :)
14:41:32AraqVarriount: does that compile? o.O
14:45:27VarriountAraq: Yeah.
14:45:58*Puffin is now known as BitPuffin
14:46:19Araqdoes it also work?
14:46:37Araqadd it to the test suite then, but hrm
14:46:40VarriountAraq: Well, I've only been using it in assertions
14:46:56AraqI'm not sure the compiler should allow it
14:47:01VarriountEg: assert(immutAddr(a) == immutAddr(b))
14:47:30VarriountAraq: But if you disallow it, I can't copy the contents of a parameter using copyMem
14:48:02AraqVarriount: if I disallow it, I'll provide 'unsafeAddr' too
14:48:29VarriountOh. Hm.
14:49:11VarriountAlthough, 'unsafeAddr' is something of a misnomer, since 'addr' is already unsafe.
14:49:16Varriount:P
14:49:20Araqyeah indeed
14:49:30Araqbut it's even more unsafe then :P
14:50:09*JinShil quit (Quit: Konversation terminated!)
14:50:49Varriount'reallyUnsafeAddr'! :D
14:55:53*dtscode joined #nim
15:02:17*darkf quit (Quit: Leaving)
15:05:53*Sphax quit (Quit: ZZZZZzzzzz)
15:08:51BlaXpiritAraq, are you still up for discussion of ..< ?
15:09:03BlaXpiriti scrolled through messages, but didn't see any more replies
15:10:35dom96Araq: Does $['a', 'b', 'c'] produce "abc"?
15:10:45dom96if so, it shouldn't IMO.
15:10:58AraqI think it does
15:11:10Araqand we have code relying on that
15:11:27AraqBlaXpirit: I'm thining about your suggestions
15:11:32Araq*thinking
15:11:44BlaXpiritwell i haven't really suggested anything new today?
15:11:45Varriountdom96: Array's don't have a '$' operator
15:11:54dom96ahh. I guess cstring is an array[x, char]
15:12:08BlaXpiritprobably
15:12:10dom96Perhaps cstring should be distinct?
15:12:40BlaXpirit.eval echo($['a', 'b', 'c'])
15:12:43MimbusBlaXpirit: eval.nim(3, 5) Error: type mismatch: got (Array constructor[0..2, char])
15:12:48BlaXpiritwhat are you talking about, dom96
15:13:18dom96Araq: In regards to `..<`. Sounds risky and many will be confused.
15:13:44BlaXpiriti still prefer just removing negative indices
15:17:06*Sphax joined #nim
15:42:13SynatraHello
15:43:11dumdumcan anyone point me to doc for 'magic' pragma please?
15:43:52BlaXpiritdumdum, it's for internal use
15:44:15BlaXpiriti think it means things implemented deep in the compiler
15:44:32BlaXpiritI haven't seen any documentation on it
15:44:41dumdumgot it, thanks
15:53:12*ibeex quit (Quit: Textual IRC Client: www.textualapp.com)
16:12:19*irrequietus joined #nim
16:31:06dumdum== for references compares refs or the value/objects pointed to?
16:32:04dumdumor we need to overload it like in java: equals method
16:32:15dumdumoverride
16:34:02BlaXpiriti'd like to know too
16:34:13BlaXpirithuge white spot in my knowledge of nim
16:34:18gokrdumdum: Thing is == checks if two "things" are equal. Now, in Nim ... my understanding is that it depends on the type.
16:34:20BlaXpiritprobably because it is never explained
16:34:36gokrSo if the type is a "ref type" - you are obviously comparing "the pointers".
16:34:53gokrBut if the type is not a ref type - you are comparing "the actual thing".
16:35:06gokrSorry if that is either fuzzy or plain wrong - but that is my understanding.
16:35:23gokrIn Java (and Smalltalk) every variable is a "ref".
16:35:49gokrBut in Nim, a variable can be either a ref, or the actual value itself (thus not allocated on the heap).
16:35:57gokrNow, feel free to correct me ;)
16:37:09BlaXpiritok
16:37:11BlaXpirit.eval type T = ref object; x: int;var a, b: T;echo a==b
16:37:16MimbusBlaXpirit: true
16:38:00BlaXpiritah
16:38:04BlaXpiritthey're both nil
16:38:52BlaXpirittype T = ref object; x: int;var a, b: T;new a;new b;echo a==b
16:39:01BlaXpirit.eval type T = ref object; x: int;var a, b: T;new a;new b;echo a==b
16:39:04MimbusBlaXpirit: false
16:40:33BlaXpiritdumdum, == for references compares refs by default, but can be overridden.
16:41:39BlaXpiritdumdum, == for non-references seems to compare value by default, but can be overridden
16:43:09dumdumo well :) thanks
16:45:33*matkuki joined #nim
16:48:35def-for value comparison of ref types you can dereference them of course: a[] == b[]
16:49:15BlaXpiritreally?
16:49:20def-yes
16:49:54BlaXpirittime for me to remember that ref is nothing more than a garbage collected pointer
16:50:16matkukiCan someone help with some initialization code: "https://bpaste.net/show/d9f2ab55d222" ? The code is SDL2.
16:50:18matkukiA hint appears durin compilation: "Warning: Cannot prove that 'event' is initialized. This will become a compile time error in the future. [ProveInit]"
16:50:48BlaXpiritmatkuki, well yeah, you are not initializing anything
16:50:59BlaXpiritfor seq a newSeq call is definitely mandatory
16:51:11BlaXpiritfor TEvent - refer to the library itself on how it should be initialized
16:51:44BlaXpiritas is, event_list is just a nil pointer
16:52:21def-event doesn't need to be initialized, it's fine like that
16:52:40BlaXpirityeah, just realized
16:52:52def-PollEvent will fill it
16:53:01matkukiBut will it become an error in the future as it is?
16:53:45def-matkuki: Getting the same warning with the examples the SDL2 wrapper ships with
16:53:51def-so it's probably fine
16:54:03matkukidef-: Ok, thanks.
16:54:40BlaXpiritthis may be considered a bug in compiler
16:56:59matkukiI'm a little cautious about these things, ever since the upgrade from 0.9.6 to 0.10.2 case-insensitivity change.
17:00:06*ehaliewicz joined #nim
17:04:53*grundle_ joined #nim
17:05:38*grundle_ quit (Client Quit)
17:07:37*gtrundle joined #nim
17:13:09dumdumargh, dereferenced == does not work for object variants
17:13:19dumdumError: parallel 'fields' iterator does not work for 'case' objects
17:13:34BlaXpirithuh
17:13:41BlaXpiritseems like the error might be somewhere else
17:15:00dumdumwell objects I am comparing are 'case objects' , nothing unusual otherwise
17:15:26dumdumhttps://github.com/Araq/Nim/blob/master/lib/system.nim#L1916 uses 'fields'
17:16:36BlaXpiritoh wow
17:16:50BlaXpiritso `==` on objects is actually a memberwise comparison, not jsut bytewise
17:16:59BlaXpiritwell it totally makes sense
17:18:43dumdumyep, so I might just implement my own in the end :)
17:23:25*dumdum quit (Ping timeout: 256 seconds)
17:26:27*Sphax quit (Quit: CYA!!)
17:27:07BlaXpiritsuch strange pleasure I get from those different implementations
17:27:28BlaXpiritand from realizing why a `seqToPtr` function is needed before finding it
17:33:39*ehaliewicz quit (Ping timeout: 264 seconds)
17:37:42*chemist69 quit (Quit: leaving)
17:38:00*gokr_ joined #nim
17:39:29*ehaliewicz joined #nim
17:40:14*Matthias247 joined #nim
17:51:54*ehaliewicz quit (Ping timeout: 245 seconds)
17:55:38*gokr_ quit (Ping timeout: 276 seconds)
18:06:24ekarlsoany of you wanna help with some stylish loving for packages? : |
18:08:10dtscodehuh?
18:09:10samlloving bro
18:09:19*dumdum joined #nim
18:10:47*reem joined #nim
18:11:43*threewood quit (Ping timeout: 252 seconds)
18:13:54ekarlsohaha, as in css ;P
18:15:27dtscodeah
18:15:31dtscodenot my forte
18:16:18samli'm good with css
18:16:25samlcascading style sheet
18:30:37*UberLambda joined #nim
18:34:30matkukiDoes anyone know how to convert a SDL2 TEvent object to a TKeyboardEvent object?
18:35:01Araqmatkuki: there have to be procs to do that, but ultimately it's a 'cast' away, I think
18:36:11matkukiAraq: "key_event = cast[TKeyboardEvent](event)" gives "Error: expression cannot be casted to TKeyboardEvent". Let me look for the proc you mentioned ...
18:36:35Araqmatkuki: well be more creative then ;-)
18:36:43matkuki:)
18:36:51Araqkey_event = cast[ptr TKeyboardEvent](event)[]
18:36:56Araqkey_event = cast[ptr TKeyboardEvent](addr event)[]
18:40:18gtrundleI thought there was a key() proc that would do that.
18:42:14gtrundleSo you could do event.key to get the keyboard event pointer.
18:48:14matkukiAraq: You were close: key_event = cast[ptr TKeyboardEvent](addr event)
18:48:37matkukiAlso, there's a template for conversion: EvConv
18:49:58matkukigtrundle: I thought there was a "key()" too, PySDL2 uses it and I'm porting my code from it.
18:50:21*ehaliewicz joined #nim
18:51:19def-matkuki: there is a key() and it works
18:51:45matkukidef-: Where? Can you point me to it?
18:51:58matkukisdl2.nim, line?
18:52:57def-411
18:53:09def-created with a template
18:53:21matkukiRight!
18:53:37matkukiI found it a few minutes ago, thanks.
19:04:43*sampwing joined #nim
19:13:07*UberLambda quit (Quit: Leaving the Matrix)
19:24:19*sampwing quit (Ping timeout: 252 seconds)
19:28:37*brson joined #nim
19:32:37*dumdum quit (Ping timeout: 256 seconds)
19:46:11*zahary1 joined #nim
19:46:15*zahary quit (Read error: Connection reset by peer)
19:56:36*profan quit (Ping timeout: 264 seconds)
19:59:28*nande joined #nim
19:59:29*nande quit (Read error: Connection reset by peer)
20:00:06*threewood joined #nim
20:10:40*profan joined #nim
20:14:41matkukiCan someone help me with this out of bounds error: "https://bpaste.net/show/dc9d0ca1bd51"
20:15:14matkukiIt's SDL2 again.
20:29:53gtrundleK_UP is a keycode, not a scan code.
20:31:15*dumdum joined #nim
20:34:10matkukiIt works for example with "K_H" for example, which is: "K_h: cint = 'h'.cint"
20:34:30matkukisorry, double example :)
20:34:47*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
20:34:55*Sphax joined #nim
20:37:29matkukidef-: Is there a problem with the template "SDL_SCANCODE_TO_KEYCODE" maybe?
20:37:54*dymk quit (Ping timeout: 272 seconds)
20:39:22*superfunc|lab joined #nim
20:39:22*reem quit (Remote host closed the connection)
20:39:22*nande joined #nim
20:39:55*reem joined #nim
20:40:14*dymk joined #nim
20:43:23*sampwing joined #nim
20:43:26def-matkuki: no idea, haven't used it
20:44:48*dymk quit (Ping timeout: 265 seconds)
20:45:40*dymk joined #nim
20:48:33*dumdum quit (Ping timeout: 256 seconds)
20:54:28*bjz joined #nim
20:55:54*Sphax quit (Quit: ZZZZZzzzzz)
20:57:30*Sphax joined #nim
20:57:39*Sphax quit (Client Quit)
21:00:55*CyberDrifter joined #nim
21:01:19CyberDrifterHello Room.
21:01:43*CyberDrifter left #nim (#nim)
21:03:14*irrequietus quit ()
21:04:08*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
21:04:22*dumdum joined #nim
21:05:09*sampwing quit (Ping timeout: 252 seconds)
21:08:12*brson quit (Quit: leaving)
21:08:20*brson joined #nim
21:08:38dumdumI have written decent amount of nim code for past 2 days, and truly feel happiest I have ever been programming :D
21:10:42*fizzbooz1 joined #nim
21:20:22Araqdumdum: now that is a nice compliment. Thank you. :-)
21:24:34matkukidumdum: I second that!
21:27:05dumdumyou are most welcome! thank you!!
21:28:54dtscodenow if only the compiler was bug free...
21:29:27*bjz joined #nim
21:32:40*matkuki quit (Read error: Connection reset by peer)
21:35:13*Demon_Fox joined #nim
21:36:01*matkuki joined #nim
21:36:20gtrundleHuh, I changed a ptr to a region pointer in existing code, and got a "genRecordField 2" internal error.
21:36:27matkukigtrundle: I'm sorry, you were right, scancodes should be used. What are the K_x constants used for?
21:37:45gtrundlematkuki: keycodes are what you usually use, scancode more "raw". Roughly, might want to check the sdl2 docs on that.
21:38:02matkukiThanks.
21:41:28matkukiIs there an empty statement in Nim, something like "pass" in Python? Something to fill a yet unimplemented case clause for example?
21:42:07BlaXpiritdiscard
21:42:14BlaXpiritmatkuki,
21:42:20matkukiAhh right, thanks.
21:42:35BlaXpiritthat's definitely in the manual and/or tutorial >_>
21:43:31matkukiI though it was only to discard function return.
21:44:18ldleworkthink again!
21:44:23EXetoCgtrundle: report it if it hasn't been reported already. just search for that name in the repo
21:44:55*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
21:47:50gtrundleEXetoC: thanks, I will once I can reduce this down a bit.
21:50:07EXetoCno need to try too hard though
22:01:39*matkuki is now known as matkuki_
22:01:55*matkuki_ is now known as matkuki
22:02:23*matkuki is now known as matkuki_
22:03:00Araqgtrundle: are you on devel? cause it might have been fixed already
22:04:50reactormonkmatkuki_, nim doesn't have the concept of "return value", it disconnects data flow and control flow
22:05:08gtrundleAraq: no, I can give that a try.
22:05:32reactormonkmatkuki_, there's result, which is the implicit value that's returned, but you'll never see something like "return X" at the end of a function
22:05:55Araqreactormonk: well "never" is a strong word
22:06:12Araqlot's of people coming from other langs use it, and it works as expected
22:07:07matkuki_reactormonk, Araq: I use it for now. It makes porting from Python easier on the eyes for me.
22:07:33reactormonkAraq, looks like there's a lot of that in the compiler, I stand correct.
22:07:46reactormonkmatkuki_, assign your result to "result" instead.
22:08:06matkuki_Will do for future programs.
22:08:52reactormonkmatkuki_, an example where to use it: https://github.com/Araq/Nim/blob/devel/lib/system/sysstr.nim#L23-L27
22:09:40reactormonkBecause you're aborting the flow of the function explicitly. If you use a return in nim, I read it as an explicit flow control statement. Might just be me.
22:12:33matkuki_Yes I agree, "result" is more structured, but I usually use return to avoid nesting, like the proc you showed.
22:16:33gtrundleAraq: can still get it with devel . I'll put details in a defect a bit later.
22:21:49*Arcanum_za is now known as Trixar_za
22:22:03*dumdum quit (Ping timeout: 256 seconds)
22:33:02*sampwing joined #nim
22:34:24reactormonkmatkuki_, yeah, in that case return is totally justified.
22:35:20BlaXpiritjust ending proc with an expression seems to be a black sheep
22:35:25BlaXpiritis it a recent addition?
22:35:56def-BlaXpirit: i think it doesn't always work and might be confusing
22:36:15def-for one-line procs it's really nice
22:37:19Araqit does work but the spec is kinda weird
22:37:44*milosn quit (Ping timeout: 245 seconds)
22:38:03BlaXpiritis it really discouraged?
22:38:07BlaXpiritwhy is it present then?
22:38:15Araqit's not discouraged
22:38:57BlaXpiriti do remember that returning tuples with it does not work
22:45:17*matkuki_ quit (Quit: ChatZilla 0.9.91.1 [Firefox 35.0.1/20150122214805])
22:45:39*milosn joined #nim
22:47:45EXetoCI have done it
22:47:46BlaXpiritit appears I am wrong
22:47:50BlaXpiriteven with typedef it works
22:48:19BlaXpiritstrange, because I definitely remember having to add return somewhere
23:00:23*reem quit (Remote host closed the connection)
23:00:58*ehaliewicz quit (Remote host closed the connection)
23:02:37*reem joined #nim
23:05:47*sampwing quit (Ping timeout: 252 seconds)
23:06:07*milosn quit (Ping timeout: 255 seconds)
23:06:14*milosn_ joined #nim
23:13:24*milosn_ is now known as milosn
23:15:27*kuzy000_ quit (Ping timeout: 276 seconds)
23:23:49*superfunc|lab quit (Ping timeout: 256 seconds)
23:24:39*reem quit (Remote host closed the connection)
23:34:49dtscodecan asyncnet sockets accept multiple connections
23:35:29*sillesta quit (Ping timeout: 252 seconds)
23:37:48*Matthias247 quit (Read error: Connection reset by peer)
23:37:58flaviuuse multiple sockets?
23:39:23dtscodewell yeah, but looking through the code, it looked like one socket could connect to two ports
23:39:28dtscodeoops
23:39:30*fizzbooz1 quit (Ping timeout: 276 seconds)
23:39:33dtscodetwo addresses rather
23:39:55EXetoCyeah, see the example in the documentation
23:40:18dtscodethats for a server
23:40:25dtscodeoh wait
23:40:27dtscodedoesnt matter
23:40:31dtscodethanks EXetoC
23:41:12EXetoCyou're right
23:41:29dtscodeyeah
23:42:23EXetoCbut a socket does represent a single connection
23:42:29dtscodeyeah
23:46:07EXetoCI should try this stuff already
23:46:12*ARCADIVS joined #nim
23:47:38*Trustable quit (Remote host closed the connection)