<< 25-02-2017 >>

00:00:54*libman quit (Quit: Connection closed for inactivity)
00:02:34Nobabs27Total noob question: say I wanted to write a shell script (like BASH), but didn't want to depend on a specific shell. What would be the easiest/best way to do this in Nim?
00:03:04Nobabs27Essentially executing lots of external programs.
00:03:57Araqwrite a Nim program?
00:04:18Araqthat uses os.execShellCmd() or osproc.execProcess()
00:05:56Araqand spice it up with something like proc `!!`(cmd: string) = if execShellCmd(cmd) != 0: quit "failed " & cmd
00:06:16Araq!!"nim c tmp.nim"
00:06:23Araq!!"some other command here"
00:09:34*rauss joined #nim
00:09:40*Sentreen joined #nim
00:11:41krux02Araq: can I do double escaping in Nim?
00:11:56*yay left #nim (#nim)
00:12:13krux02I need to create a string literal, that itself has escaped string literas in it
00:12:43krux02or to make it short, I could like add calls to gnu ASM
00:13:38krux02and one of that asm calls is .ascii
00:14:05krux02and I need to embed sourcecode in a string literal
00:15:45*libman joined #nim
00:16:22krux02ok found it
00:16:24krux02no problem
00:27:39zachcarterthis union is effing me up
00:28:09zachcarterI have a union of a cint and a pointer
00:28:17*yglukhov quit (Remote host closed the connection)
00:28:35zachcarterif I cast the union into a pointer of another type
00:28:53*yglukhov joined #nim
00:29:27zachcarterit’s difficult to determine whether the cast actually resulted in producing an object of the intended type
00:29:32zachcarterwithout a segfault occurring
00:30:43zachcarterhttps://gist.github.com/zacharycarter/4d4485a11e7ce1ad8c8e591c782b05b9
00:31:22zachcarterhttps://gist.github.com/zacharycarter/4d4485a11e7ce1ad8c8e591c782b05b9#file-gistfile1-txt-L10 will segfault if the pointer wasn’t assigned to
00:31:31zachcartererr pointr
00:32:58*yglukhov quit (Ping timeout: 240 seconds)
00:35:40zachcarterany ideas?
00:39:30zachcarterI essentially end up with values in that field like - 0x1
00:39:31zachcarter0x102c1d1f8
00:39:48zachcarter0x1 is obviously an int occupying the memory of the union
00:43:13krux02zachcarter: I have really problems understanding what the union of pointer and an int is supposed to do
00:43:21krux02it does not have a tag about the active field
00:43:29zachcarteryeah that’s the problem
00:43:45zachcarterI might submit a PR to nuklear adding this
00:43:52zachcarterseems ridiculous not to have it
00:44:40zachcarterin fact I’m going to submit an issue now
00:48:09*arnetheduck joined #nim
00:48:39Araqjust map the "union" to a single pointer
00:48:57Araqsizeof(cint) <= sizeof(void*) anyway
00:49:05Araqgood night
00:49:07*bjz joined #nim
00:49:20demi-if that code is literally trying to make a pointer also an integer, there are much better/more correct ways of doing that
00:49:24zachcarterthanks Araq
00:49:34zachcartergn
00:50:33zachcarterdemi it’s not trying to
00:50:37zachcarterdemi- *
00:50:57zachcarterit’s just some code ripped out from one of my examples - the problem is in the C code it binds to
00:51:11demi-right, i mean the C code
00:51:37demi-if that is what the union is trying to accomplish here, that is wrong/bad in C
00:52:07zachcarterit is pretty much
00:52:18zachcarterI think I get why he did it that way but I agree it’s not the right way
00:52:39zachcarterI’ll probably end up trying to port this library to nim and do a better job with it than he did
00:53:05demi-if you are opening an issue you should point out that (u)intptr_t is a type and that is what should be used here
00:53:16zachcarterthank you
00:54:14demi-that will correctly be sized to the size of a pointer on the target platform and be usable as an integer for doing pointer arithmetic
00:55:22zachcarterthank you
01:01:03*gk_-1wm_- joined #nim
01:01:04*gk_-1wm_- left #nim (#nim)
01:03:57zachcarterI don’t really get what araq was saying by map the union to a pointer, I can cast it to a pointer but I dont’ think that’s what he meant, I’ll find out tomorrow for now I’ll just use my hacky code
01:08:27*bjz_ joined #nim
01:10:03*bjz quit (Ping timeout: 240 seconds)
01:36:47Nobabs27whats the equivalent of $1 $2 etc of BASH in Nim?
01:43:10krux02argent $1 $2 etc nut just the arguments for functions?
01:43:26krux02I would say, nim has real argument names
01:43:35krux02those are the equivalent
01:47:14PMunchHmm, I'm struggling with the ui library..
01:47:47PMunchNobabs27, if you want to write a script there are ways of getting those variables
01:48:37PMunchcommandLineParams() will give you a list of them
01:57:54krux02HA it works, my last 5 hours of hacking finally work
01:59:14krux02I have gdb pretty printer scripts for nim strings and seq types bundled in the binary, no extra gdb script file required
02:00:31*bjz_ quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
02:01:12zachcarternice!
02:02:10krux02I needed to emit a few asm instructions
02:04:05*bjz joined #nim
02:06:16zachcarterI just figured out I think the answer to the problem I’ve been fighting the past couple of hours
02:07:19zachcarterhttp://imgur.com/a/Nn3OH
02:07:38zachcartergot image buttons working finally and I think I’ve resolved all myt exture binding issues
02:08:58zachcarterstill need to get mipmaps working and some other stuff with bgfx
02:11:06krux02it really looks cool
02:11:40zachcarterthank you
02:12:26krux02zachcarter: https://sourceware.org/gdb/onlinedocs/gdb/dotdebug_005fgdb_005fscripts-section.html#dotdebug_005fgdb_005fscripts-section
02:12:44krux02do you see the example for "Script Text Entries"
02:12:51krux02that's all documentation I had
02:13:22zachcarterugh
02:13:40*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
02:14:12zachcarterI’m impressed you managed to get that working
02:14:35krux02but I got it broken down to this code in nim: http://ix.io/nLk
02:15:31zachcarterI almost understand it haha
02:15:35krux02than I can write without escaping, and apply escaping in the copilation
02:16:05zachcarterright
02:16:09krux02yes it's magic how it just becomes understandable as soon as all the \\\\ go agway
02:16:18zachcarteryeah
02:16:20zachcarterexactly
02:17:22krux02there is still one caveat
02:17:59krux02gdb disables this script by default, but it least it get's detected and gdb print a message, how to enable it
02:18:22zachcarterah okay
02:18:51krux02(gdb) print arg
02:18:51krux02$1 = seq = {"Hi", "this", "is", "a", "string", "sequence"}
02:19:19zachcarterniceeeeee
02:24:15*gk_-1wm joined #nim
02:24:15*gk_-1wm left #nim (#nim)
02:31:07*yglukhov joined #nim
02:34:08*chemist69 quit (Ping timeout: 255 seconds)
02:34:25*bjz joined #nim
02:35:13*yglukhov quit (Ping timeout: 240 seconds)
02:37:30krux02zachcarter: https://github.com/krux02/opengl-sandbox/blob/master/debug.nim
02:37:43krux02there you can get inspiration when you want the same feature
02:37:57zachcarter:D thank you
02:38:06krux02maybe at some point I want to contribute to the main Nim repository
02:39:00krux02in the end it was the go code that helped me to get this support
02:39:18krux02this is the script I based my script on: https://golang.org/src/runtime/runtime-gdb.py
02:40:36krux02I think for a good support Araq needs to be convinced to generate types that allow the infer the type from the name
02:41:14krux02TY_.* is not really a good regular expression for seq types
02:41:16FromGitter<Varriount> \0/
02:41:40krux02Varriount: you woke up?
02:41:56FromGitter<Varriount> I'm full of cold medicine
02:42:01zachcarteruh oh
02:42:08zachcarterrobo tripping Varriount
02:42:09zachcarter:D
02:42:26FromGitter<Varriount> Not quite. Just one with swollen sinuses
02:42:38zachcarterno fun
02:42:52krux02tomorrow I will definitively not work
02:42:59krux02it is now 3:42
02:43:03krux02here
02:43:23FromGitter<Varriount> It's around 9 here.
02:43:38FromGitter<Varriount> (In the afternoon)
02:44:09krux02ah, I am used to call that 21:00 :P
02:44:23zachcarter9 here too Varriount
02:44:31zachcarteractually 9:44 pm
02:45:55krux02I new feel accomplished for today, I now think it's time for a useless discussion about the weirdness of the am/pm time format
02:47:31krux02or maybe not
02:47:36krux02I think I should sleep
02:47:44zachcarterhaha
02:47:56*chemist69 joined #nim
02:47:57zachcarterprobably not a terrible idea if it’s 4 am
02:48:03krux02I with you all a good night
02:48:12zachcarterlikewise, goodnight krux02
02:48:22*krux02 quit (Quit: Leaving)
02:51:28*vlad1777d quit (Quit: Leaving)
03:00:42zachcarterVarriount, not sure if you saw my latest goings on with Nuklear and BGFX but - http://imgur.com/a/jf8el
03:01:00zachcarterI got images working with nuklear
03:07:06FromGitter<raydf> @zacharycarter nice work with the nuklear lib :)
03:16:20zachcarterthank you raydf
03:21:17Nobabs27another noob question: if + strings, how does that work? Does it have to cast or something? I keep getting Error: ':' expected
03:21:56zachcarter& I believe
03:21:58zachcarterfor string concatenation
03:22:15zachcarter.add for append
03:22:28zachcartererr that’s wrong
03:22:46zachcarterno I was right add does append two strings
03:23:09Nobabs27basically I want this: var whatever = "hi", if whatever == "hi" echo "it worked"
03:23:49zachcartervar whatever = “hi”
03:23:58zachcarterif whatever == “hi”: echo “it worked"
03:26:09zachcartervar whatever = "hi"; if whatever == "hi": echo "it worked" if you want it on one line
03:27:22Nobabs27kk got it thanks
03:28:35zachcarternp
03:36:48Nobabs27ok now how about commandLineParams(), says it's a "TaintedString", how do I use if to test specific args ?
03:38:14zachcartertry doing this
03:38:21zachcarterecho repr commandLineParams()
03:40:29zachcarterI honeslty always use docopt so I don’t have much familiarity with commandlineparams and what it produces
03:40:38zachcarterbut if you repr that object you should be able to figure it out
03:40:53zachcarterNobabs27 ^
03:41:01Nobabs27I get back a memory address (?) 0x7fa8505be050[]
03:41:16zachcarterdid you specify any command line args?
03:41:35Nobabs27if I do I get 0x7f586aeee050[0x7f586aeed080"asdasdasd"]
03:41:53zachcarterokay one sec
03:43:53zachcarterimport os
03:43:54zachcarterecho paramStr(1)
03:44:15Nobabs27kk
03:45:10Nobabs27same output
03:45:47Nobabs27wait
03:45:59Nobabs27nver mind got it
03:46:02Nobabs27never mind got it
03:46:05Nobabs27*
03:46:18Nobabs27thanks again xD
03:46:24zachcarterhaha np
03:47:02zachcartertime to make a filebrowser with this gui lib
03:47:22Nobabs27cool, linux support?
03:47:43zachcarterwell I’m working on a texture packer
03:47:47zachcarterfor my game engine
03:47:52zachcarterthat’s being written in Nim
03:48:12zachcarterI wrote bindings for a C gui library called Nuklear
03:48:15Nobabs27ah ok so it's an program/engine internal thing?
03:48:22zachcarterhttps://github.com/zacharycarter/nuklear-nim
03:48:29zachcarterthe GUI library is not, no
03:48:40zachcarteryou can use it with whatever rendering backend you’d like
03:48:48zachcarterI’m just using it in my game engine
03:49:44zachcarterif you wish to build GUI apps with nim there alternative libraries too, there’s a pure nim cross platform GUI library that one of the members here maintains called Nimx
03:49:45Nobabs27yeah I meant the file manager tho
03:49:56zachcarterhttps://github.com/yglukhov/nimx
03:50:20zachcarteroh yeah the file manager will just be internally used for the texture manager, and other tools that end up needing one
03:50:46Nobabs27cool stuff
03:51:05zachcarterthanks
03:53:38*dddddd quit (Remote host closed the connection)
04:13:26*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
04:14:29*PMunch quit (Quit: leaving)
04:17:38*brson joined #nim
04:20:54*libman quit (Quit: Connection closed for inactivity)
04:32:33*yglukhov joined #nim
04:35:11*chemist69 quit (Ping timeout: 255 seconds)
04:38:13*yglukhov quit (Ping timeout: 268 seconds)
04:39:55*chemist69 joined #nim
04:58:44zachcarterhrm I’m struggling to figure out how to do this :
05:01:08zachcarterhttps://gist.github.com/zacharycarter/58561708c73aae6b519b3e9defbcd2ab
05:04:23zachcarterwhoops forgot one thing
05:04:39zachcarterokay fixed
05:07:39zachcarterfixed again lol, man I must be sleepy, missing stupid things
05:08:03zachcarterI think now the example makes sense
05:08:28zachcarterapparently this is possible in C with a macro
05:09:18zachcarterhttps://github.com/vurtun/nuklear/blob/master/nuklear.h#L2909
05:10:39zachcartersince I can’t do forward declarations in Nim
05:10:40zachcarterof types
05:10:44zachcarterI’m not sure how to handle this….
05:11:22zachcartercan I forward declare templates?
05:11:28*butchster_ joined #nim
05:12:09*BlaXpirit_ joined #nim
05:12:42zachcarternm that wont’ help here...
05:12:49*dexterk__ joined #nim
05:13:34*athaudia joined #nim
05:14:39*rauce joined #nim
05:15:00*rauss_ joined #nim
05:16:42*BlaXpirit quit (Ping timeout: 260 seconds)
05:16:42*jonafato quit (Ping timeout: 260 seconds)
05:16:43*arnetheduck quit (Ping timeout: 260 seconds)
05:16:43*butchster quit (Ping timeout: 260 seconds)
05:16:43*byte512 quit (Ping timeout: 260 seconds)
05:16:44*def- quit (Ping timeout: 260 seconds)
05:16:44*rauss quit (Ping timeout: 260 seconds)
05:16:44*cjbest quit (Ping timeout: 260 seconds)
05:16:45*CcxWrk quit (Ping timeout: 260 seconds)
05:16:47*Sergio965 quit (Ping timeout: 240 seconds)
05:16:48*rosshadden quit (Ping timeout: 240 seconds)
05:16:49*ekarlso_ quit (Ping timeout: 240 seconds)
05:16:49*Jesin quit (Ping timeout: 240 seconds)
05:16:50*athie quit (Ping timeout: 240 seconds)
05:16:50*dexterk_ quit (Ping timeout: 240 seconds)
05:16:50*federico3 quit (Ping timeout: 240 seconds)
05:16:51*joebo quit (Ping timeout: 240 seconds)
05:16:51*cncl quit (Ping timeout: 240 seconds)
05:16:51*Amun_Ra quit (Ping timeout: 240 seconds)
05:16:52*BlaXpirit_ is now known as BlaXpirit
05:17:05*jonafato joined #nim
05:17:06*joebo joined #nim
05:17:12*def- joined #nim
05:17:12*federico3 joined #nim
05:17:19*Amun_Ra joined #nim
05:17:33*arnetheduck joined #nim
05:17:48*ekarlso_ joined #nim
05:18:04*CcxWrk joined #nim
05:18:16*cncl joined #nim
05:18:36*Jesin joined #nim
05:20:10*Sergio965 joined #nim
05:25:11*byte512 joined #nim
05:29:28Nobabs27how would I use if lots of times? Like in if whatever == "ok" || whatever == "okay"
05:29:38Nobabs27or even better test for the same var?
05:41:17*def- quit (Ping timeout: 260 seconds)
05:42:45*def- joined #nim
05:45:01*butchster_ is now known as butchster
05:54:06*Nobabs27 quit (Quit: Leaving)
05:55:13zachcarteruse a switch statement?
05:55:19zachcarteror a case statement rather
05:55:26zachcarterah cya...
06:09:05*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
06:13:44*bjz joined #nim
06:37:04*nsf joined #nim
07:10:31*rauss_ quit (Quit: WeeChat 1.7)
07:31:30*brson quit (Ping timeout: 268 seconds)
07:32:16*brson joined #nim
07:33:17*nsf quit (Quit: WeeChat 1.7)
07:34:20*nsf joined #nim
07:36:02*yglukhov joined #nim
07:40:13*yglukhov quit (Ping timeout: 240 seconds)
07:56:05*zachcarter quit (Quit: zachcarter)
08:04:06*chatter29 joined #nim
08:04:38*chatter29 quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
08:11:33dom96If anyone here happens to be at Voxxed Days CERN let me know :)
08:12:40*yglukhov joined #nim
08:13:25*yglukhov quit (Remote host closed the connection)
08:13:52*yglukhov joined #nim
08:16:08*Vladar joined #nim
08:16:15AraqI'm here too.
08:23:12dom96Not at CERN though. :)
08:26:49*djellemah_ is now known as djellemah
08:31:45*yglukhov quit (Remote host closed the connection)
08:32:24*yglukhov joined #nim
08:34:57AraqI am, I am standing next to that guy, don't you see me?
08:36:50*yglukhov quit (Ping timeout: 255 seconds)
08:53:26*Matthias247 joined #nim
08:54:43*brson quit (Ping timeout: 240 seconds)
08:55:36*brson joined #nim
08:58:01*couven92 joined #nim
09:00:47*abeaumont joined #nim
09:04:17*brson quit (Ping timeout: 255 seconds)
09:09:41*couven92 quit (Quit: Client Disconnecting)
09:11:13*couven92 joined #nim
09:22:45*nsf quit (Quit: WeeChat 1.7)
09:29:20dom96Martin Odersky is here :O
09:29:39*Jehan_ joined #nim
09:44:03*chemist69 quit (Ping timeout: 240 seconds)
09:51:08*chemist69 joined #nim
09:54:28FromGitter<evacchi> so, FYI I tried to spawn 1000 threads on Mac OS and it crashed the process at around ~500
10:13:05dom96evacchi: threads in Nim are heavy. They are not green threads.
10:14:54dom96are you using createThread or spawn?
10:16:55Araqdom96: I told him to try threads
10:17:44Araqalso you should try it on Linux, nobody runs servers on OSX
10:17:59dom96so should spawning 1000 threads work?
10:18:22dom96or maybe a better question is: should it be done?
10:21:57Jehan_I just tried it on OS X, ran out of threads only after the 2048th.
10:22:06Jehan_Error: unhandled exception: cannot create thread [ResourceExhaustedError]
10:23:00Jehan_Which happens when pthread_create() returns an error.
10:29:35Araqwell yeah, good thing that error handling works ;-)
10:30:28FromGitter<evacchi> dom96 createThread
10:30:36*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
10:31:03FromGitter<evacchi> https://gist.github.com/evacchi/43fdf87a885748f00aa8f8888e1718c7
10:31:39FromGitter<evacchi> yeah 2048 is actually the hard limit
10:31:46FromGitter<evacchi> I wonder why I can't even hit 1000
10:31:53*abeaumont quit (Ping timeout: 260 seconds)
10:32:12FromGitter<evacchi> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=58b15d2ae961e53c7f660430]
10:34:34FromGitter<evacchi> Araq: well yeah, but I do my dev work on MacOS :-)
10:34:46FromGitter<evacchi> I could spin up a docker instance of course
10:39:35*bjz joined #nim
10:42:56Jehan_The pasted code works for me.
10:43:17Jehan_Mind you, I'm still on Yosemite on this machine.
10:43:24Jehan_Not sure if that matters.
10:43:54*bjz quit (Client Quit)
10:44:20FromGitter<evacchi> this is sierra on 13" MBP 2016
10:44:41FromGitter<evacchi> it only has two physical cores
10:44:47FromGitter<evacchi> might be relevant
10:45:52*bjz joined #nim
10:45:56Jehan_Well, what error are you getting?
10:46:42Jehan_I'm getting an index error, because you're using 0..MAX instead of 0..MAX-1, but that's unrelated to thread creation.
10:48:10FromGitter<evacchi> SIGSEV
10:48:12FromGitter<evacchi> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=58b160ea00c00c3d4f86e4eb]
10:48:33Jehan_This works for me: https://gist.github.com/rbehrends/6f48609f00529b28e5a68e32cdd748fb
10:49:02Jehan_Hmm, SIGSEGV is odd.
10:49:09*couven92 quit (Ping timeout: 260 seconds)
10:49:37FromGitter<evacchi> huh!
10:49:40FromGitter<evacchi> that works for me too
10:49:41Jehan_I'm honestly not sure where a SIGSEGV could happen.
10:49:59Jehan_I'm wondering if the void thread arg type causes any weirdness?
10:50:01FromGitter<evacchi> maybe something about the infinite counter in the proc t()
10:50:23Jehan_That should cause an overflow at worst. Plus, it still works for me.
10:51:02FromGitter<evacchi> weird
10:53:09Jehan_Running with the devel branch as of a few days ago (2/21).
10:53:26FromGitter<evacchi> 1) 16
10:53:57FromGitter<evacchi> btw if I substitute the void thread with an int thread I get to ~960
10:55:19Jehan_Hmm, this is all extremely odd.
10:55:40FromGitter<evacchi> I'm really failing to see what's the real difference between your code and mine
10:55:43FromGitter<evacchi> :D
10:56:12Jehan_Mind you, it may be that it simply triggers a soft limit at the OS level before the hard limit.
10:56:20FromGitter<evacchi> if i remove the sleep in the thread creation it crashes much earlier
10:56:21FromGitter<evacchi> possibly
10:57:01Jehan_Oops, I'm just looking at your code and I think I see the problem.
10:57:10cheatfateI dont know why you need so many threads and i don't really care, but do you really think that this can be useful? i think 50% of cpu time will be wasted on context switches between your 2000 threads
10:57:28Jehan_You're doing var th = thread[i] and then use that as the argument to createThread().
10:57:47Jehan_Which means that all threads share the same data structure on the thread.
10:57:59Jehan_You have to pass threads[i] instead.
10:58:08FromGitter<evacchi> cheatfate: yeah I was just making a point from yesterday :P
10:58:41Jehan_I should have noticed that earlier, but somehow my eyes skipped over that part.
10:58:49FromGitter<evacchi> Jehan_ ooooh. subtle
10:59:06Jehan_Thread[T] is a data structure, not a reference.
10:59:19FromGitter<evacchi> thanks for noticing, as I said I'm still learning
11:00:12FromGitter<evacchi> so, yup, it fails and 2048, as expected
11:00:16Jehan_Among other things, it contains the thread's GC information.
11:00:43Jehan_So, all the threads' GCs are trying to share the same heap. Sort of.
11:01:37FromGitter<evacchi> BTW cheatfate: the point was to see what the hard limit on thread creation was on my dev platform (macOS); OTOH on Linux I've been told the limit is in the millions.
11:02:34FromGitter<evacchi> yesterday I was explaining that I've been playing around with a proof-of-concept for an actor library, and I was trying to figure out the best way to lay it on top of Nim's concurrency model
11:03:08Jehan_In practice, not really. You're limited by the fact that each thread requires stack and heap memory, and you'll run out of that long before you hit millions of threads.
11:03:35Jehan_It's rarely useful to have more than N*cores threads for some fairly small N.
11:04:13FromGitter<evacchi> one way would be to "pin" actors to a thread, avoiding rescheduling on another (which would require deep copying actor state); araq suggested that (on Linux) one actor per thread might be feasible
11:05:45FromGitter<evacchi> still, my fear would be that then the code would not be x-platform
11:06:50Jehan_You can do conditional compilation, doing the pinning only on architectures that support it.
11:07:06Jehan_That said, I'd be careful about even assuming that this is necessary/beneficial.
11:07:27Jehan_Especially if your program doesn't own the machine and has to coexist with other processes.
11:07:48FromGitter<evacchi> I thought so
11:09:21*dddddd joined #nim
11:10:03FromGitter<evacchi> well I might start playing with the idea of scheduling on N threads, and add some sort of penalty to actor "migration" (i.e.: actor a1 is currently scheduled on thread t1, but has been waiting for $threshold; so deep copy to free thread t2 and re-schedule there)
11:11:50*Matthias247 quit (Read error: Connection reset by peer)
11:13:28Araqkeep in mind that deepCopy is only sound when you have a rendezvous like mechanism, in other words the *source* of deepCopy must not be mutated in between. this usually means the thread must block until the copy is complete
11:14:06*Trustable joined #nim
11:38:44*vlad1777d joined #nim
11:43:25*couven92 joined #nim
11:47:53*yglukhov joined #nim
11:54:58*bjz quit (Ping timeout: 240 seconds)
11:56:19*bjz_ joined #nim
11:58:52*rokups joined #nim
12:02:36*Snircle joined #nim
12:08:14FromGitter<evacchi> araq: that's ok, actors are woken up only to handle messages in their mailbox, deep copy would happen when the actor's "asleep"
12:09:31FromGitter<evacchi> the mailbox would be implemented as a sharedtable (where the key is the actor id), messages would probably be copied in and out
12:28:19*abeaumont joined #nim
12:30:05cheatfateevacchi: if you care about performance first of all you need decent structure for mailbox, and sharedTable is not the best variant because it use single lock...
12:47:17*yglukhov quit (Remote host closed the connection)
12:57:01*Jehan_ quit (Ping timeout: 260 seconds)
12:58:11*Jehan_ joined #nim
12:59:35FromGitter<evacchi> that's true. I started off using that because I was trying to first come up with a rough prototype
13:00:53*Jehan_ quit (Client Quit)
13:02:26*bjz joined #nim
13:02:37*bjz_ quit (Ping timeout: 260 seconds)
13:03:33*nsf joined #nim
13:08:02FromGitter<evacchi> besides, I'm figuring out if it really is a problem. I'm thinking about something like this: when an actor is woken up for a message, it is given a fresh "outbox"; when it sends a message, the message goes in the "outbox", along with the id of the destination; when the actor goes back to sleep, the scheduler fills the inbox (mailbox) of each involved actor with the data found in the outbox. in this case only the scheduler would hold the
13:08:02FromGitter... lock, but each actor may run concurrently. does it make sense?
13:33:55*bjz_ joined #nim
13:34:55*yglukhov joined #nim
13:36:03*bjz quit (Ping timeout: 240 seconds)
13:37:14*zachcarter joined #nim
14:00:27*bjz_ quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
14:02:51*bjz joined #nim
14:18:38zachcarterdemi- are you around by any chance?
14:18:46demi-yup!
14:18:51zachcarterawesome!
14:19:01zachcarterso yesterday you pointed me to intptr_t
14:19:23zachcarterwhich I get is an int big enough to hold a pointer
14:19:34demi-mhmmm
14:19:36zachcarterand that’s what he should be using instead of that stupid union
14:19:56demi-yeah, if that is what the intent of the union was
14:20:06zachcarteryeah you were spot on with that
14:20:13zachcarterhe even said if he were doing things over again he’d using intptr_t
14:20:15demi-great!
14:20:32zachcarterbut my question is this - my original problem was at runtime I can’t tell whether the union holds a pointer or a int
14:20:42zachcarterlike a valid int that I should be using as a texture handle ID
14:20:57zachcarteror whether it holds a pointer to a texture handle object
14:21:09zachcarterdoes using intptr_t allow me to figure that out at runtime?
14:21:14demi-then I think what you should do is what Araq said, is instead of trying to determine if it is a pointer or an int in the union, that you should just map the C union to a nim pointer
14:21:43zachcarterahh okay
14:21:46demi-because, presumably you aren't going to do pointer arithmetic in nim
14:22:04demi-so you can always treat it as a pointer, instead of trying to figure out what it is
14:22:08zachcarterI didn’t get his suggestion last night but I think I get it now
14:22:29zachcarterokay thank you I’ll give it a shot
14:22:31demi-yeah so
14:22:40zachcarterinstead of recreating the union in the bindings
14:22:44zachcarterjust bind to a pointer for that object
14:22:46zachcarterright?
14:22:49demi-yeah, exactly
14:22:55zachcarterokay gotcha thank you I’ll do that
14:23:29demi-cool, good luck
14:23:50zachcarterthank you!
14:27:47*user__ joined #nim
14:30:13*Trustable quit (Ping timeout: 240 seconds)
14:35:30*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
14:39:55*krux02 joined #nim
15:17:28*Snircle quit (Ping timeout: 240 seconds)
15:19:18*Snircle joined #nim
15:20:03*chemist69 quit (Ping timeout: 240 seconds)
15:21:40*wan joined #nim
15:29:19*chemist69 joined #nim
15:31:44*yglukhov quit (Remote host closed the connection)
16:12:32*brson joined #nim
16:14:25*abeaumont quit (Ping timeout: 260 seconds)
16:17:43*FromGitter quit (Ping timeout: 240 seconds)
16:17:54*FromGitter joined #nim
16:20:48federico3any os-independent way to get the hostname?
16:24:15krux02well there is posix.hostname but my guess is that is just for posix systems
16:27:04*yglukhov joined #nim
16:33:30*Matthias247 joined #nim
16:33:31federico3krux02: there's a working (but not so pretty) getHostname but I was hoping for something that would work on windows as well
16:34:10krux02http://ix.io/nLK
16:34:28federico3socket.gethostname() in Python seems to work on windows...
16:35:11krux02yea when you want to have a python solituon you are in the wrong channel I guess :P
16:35:36federico3ahem, that's not what I meant
16:41:56dom96federico3: maybe you could fix getHostname to also work on Windows?
16:43:18federico3dom96: yep, I see there are gethostname and getfqdn syscalls for windows as well. I wonder if this should belong to system or nativesockets
16:43:33dom96The system module?
16:48:02dom96If so then definitely not :)
16:50:05federico3traditionally gethostname and getfqdn are related to sockets
16:53:47dom96yes, so nativesockets makes sense
17:06:01demi-so i'm thinking that the `securehash` module in the standard library should probably be taken out and replaced with sha256 or something?
17:07:51*enthus1a1t joined #nim
17:09:23*enthus1ast quit (Ping timeout: 264 seconds)
17:14:02dom96It should be renamed to 'sha1'
17:14:42demi-lol
17:16:00federico3any appveyor configuration that installs the zipfiles?
17:22:26cheatfatefederico3, what does it mean installs?
17:22:32cheatfatehow you can install zipfile?
17:24:05federico3sorry, I mean: install Nim by downloading and decompressing the zipfile
17:27:17cheatfatefederico3, you can watch appveyor.yml inside of nim repo, you can see there downloading of mingw distribution and unpacking, i think in same way you can do with nim zip distro
17:27:44federico3yup, I'm testing something based on that :)
17:31:29cheatfateabout `securehash.nim` i dont know what Araq uses for name mangling, but if this is not `securehash.nim` then i think it must be removed from stdlib, at all
17:32:04Araqis it in the stdlib though? I think it's in compiler/
17:32:21cheatfateAraq, its in lib
17:32:27Araqbah
17:32:27cheatfatelib/pure/securehash.nim
17:32:50Araqcryptography, will they ever get it right?
17:33:27cheatfateAraq, everything created by humans can be broken by humans...
17:33:30Araqmaybe it's fundamentally flawed to use a smallish number of bits
17:33:55*couven92 quit (Quit: Client Disconnecting)
17:34:49cheatfateAraq, you using smaller number of bits from `securehash.nim` for name mangling?
17:35:45Araqno, I use md5 for the name mangling
17:36:22cheatfatebut compiler imports securehash
17:36:26cheatfatefor some reason
17:39:24krux02Araq: is it possible to write a macro that is triggered at the end of the compilation, where I can iterate all types of my executable?
17:45:01cheatfate`super macro hooks` :) it would be nice addition to compiler
17:45:48cheatfatewith such macro hooks it will be possible to generate `macro expanded` nim sources
17:46:10*Arrrr joined #nim
17:46:10*Arrrr quit (Changing host)
17:46:10*Arrrr joined #nim
17:50:03dom96Araq: you moved it into stdlib in 2015 for some reason
17:50:54stisa``super macro hooks`` isn't that basically a plugin? for example, I think ``locals`` is implemented with a plugin
17:56:10cheatfatestisa, what is `locals`?
17:56:46stisahttps://nim-lang.org/docs/system.html#locals,
17:58:49cheatfateAraq, so compiler support plugins?
18:01:34dom96Araq: Looks like a new regression :( https://github.com/nim-lang/Nim/issues/5436
18:02:24dom96(or perhaps a new breaking change)
18:09:17*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
18:10:33*abeaumont joined #nim
18:12:01federico3cheatfate: appveyor works - https://github.com/nim-lang/Nim/wiki/BuildServices
18:14:05cheatfatefederico3, nice
18:21:05*Snircle joined #nim
18:34:25*vlad1777d quit (Ping timeout: 260 seconds)
18:52:37*brson quit (Quit: leaving)
19:05:26*libman joined #nim
19:05:52Araqdom96 well the compiler is now correct
19:06:02Araqand rejects this program
19:13:04dom96Araq: Could you explain the error? I don't see any nosideeffect pragmas https://github.com/docopt/docopt.nim/blob/master/src/docopt.nim#L299
19:13:17*enthus1ast joined #nim
19:14:01Araqwell but system.nim requires == to not have side effects and that calls docopt's == which can have a side effect because it's a fucking method
19:14:18Araqhowever, it still fails when I make it a proc
19:14:30*enthus1a1t quit (Ping timeout: 268 seconds)
19:15:36dom96:\
19:15:58dom96Sadly I can't use docopt anyway because it depends on nre
19:16:05dom96But I think lots of others are using it.
19:18:08krux02what's the problem with nre?
19:18:31*zachcarter quit (Quit: zachcarter)
19:18:54dom96dependency on pcre
19:19:33krux02and that is a problem because of license?
19:19:53dom96No, because I would need to mess about with statically linking it on all platforms.
19:20:02dom96Which I doubt will go smoothly
19:20:30dom96This is for choosenim which I want to Just Work (TM).
19:20:58dom96And not have to deal with bug reports like "could not import pcre.dll"
19:42:11*rokups quit (Quit: Connection closed for inactivity)
19:50:34*PMunch joined #nim
20:04:40*Jesin quit (Quit: Leaving)
20:07:44*Jesin joined #nim
20:13:41dom96Any Nim packages for sha256?
20:13:43*Arrrr quit (Read error: Connection reset by peer)
20:16:12stisadom96 I used nimSHA2 https://github.com/jangko/nimSHA2 , seems to work fine
20:16:39dom96awesome
20:17:17dom96This needs a 'sha256' tag in Nimble
20:19:39Araqping rokups
20:43:24user__Araq: I reduced my problem to this: https://github.com/nim-lang/Nim/issues/5439
20:44:33Araqyay
20:45:30Araqfor me it prints "correct method" though
20:53:14*user__ quit (Quit: Leaving)
20:53:44*Trustable joined #nim
20:55:21*byte512 quit (Ping timeout: 260 seconds)
20:55:59TrustableAraq, what do you recommend to find the reason for my problem?
20:56:11*RushPL quit (Ping timeout: 255 seconds)
20:57:46PMunchPrints correct method here as well user__
20:58:38AraqTrustable: well I recently did a method related compiler change
20:58:44Araqso try most recent nim devel
20:58:50*def-pri-pub joined #nim
20:59:15*RushPL joined #nim
21:00:51Araqbut an older version on Linux 64bit also produces the correct result
21:02:02Araqwhat does 'nim -v' say?
21:03:25PMunchhttp://ix.io/nM6
21:03:49PMunchA bit annoying that it first gets expanded to the variable and not the function..
21:04:25TrustableAraq, same problem with current devel.
21:05:32AraqTrustable: what does 'nim -v' say?
21:06:04TrustableNim Compiler Version 0.16.1 (2017-02-25) [Linux: amd64]
21:06:04TrustableCopyright (c) 2006-2017 by Andreas Rumpf
21:06:05Trustablegit hash: f250c30b9d5beb587d3b62b99dc938447209836d
21:06:05Trustableactive boot switches: -d:release
21:07:59*byte512 joined #nim
21:34:57*yglukhov quit (Remote host closed the connection)
21:35:22FromGitter<zetashift> Having such an idiot issue; Using libtcod-nim and it says it can't find the libtcod-mingw.dll , but I have it residing in the same folder as the resulting exe of the sample; Any windows experts know what I'm doing wrong?
21:41:16*brson joined #nim
21:45:50Vladarzetashift: wrong dll version, maybe?
21:45:58FromGitter<zetashift> 1) 5.1 right?
21:46:20Vladaryep
21:46:37FromGitter<zetashift> also thank you for making the bindings; when I was playing around on my linux machine it was such a breeze! Really enjoyed tinkering with it
21:46:52Vladaryou are welcome )
21:46:57FromGitter<zetashift> also yea correct version
21:47:30Vladardebug vs. release dll?
21:47:36dom96wrong architecture? (32 vs 64 bit)
21:47:57Vladaryeah, also this ^
21:48:11Vladargot fooled one time by that
21:48:35FromGitter<zetashift> oh yea it's 32
21:48:36FromGitter<zetashift> haha
21:50:16*yglukhov joined #nim
21:51:05*yglukhov quit (Remote host closed the connection)
21:51:19*yglukhov joined #nim
21:54:39FromGitter<zetashift> no x64 for 1.5.1 so gotta compile it myself then woop
21:55:28Vladaror just compile for 32bit
21:55:50FromGitter<zetashift> with nim c? how to do I switch arch
21:56:05FromGitter<zetashift> got it
21:56:14FromGitter<zetashift> --cpu:i386
22:01:12enthus1astcan i somehow write a async method / async proc with variable first parameter? (withouth leaving the garbage collected save heaven?)
22:03:21enthus1astforum says return `thing` in the method : /
22:04:28dom96what do you mean by "variable first parameter"?
22:04:53enthus1astproc(foo: var baa)
22:05:01enthus1astfound your forum entry
22:07:22enthus1astit is not possible right?
22:07:28dom96You can use FutureVar for that
22:08:41*zachcarter joined #nim
22:11:11enthus1astlike this proc(foo: FutureVar[baa]) ?
22:12:20dom96yeah
22:14:15*zachcarter quit (Read error: Connection reset by peer)
22:14:38*zachcarter joined #nim
22:15:00krux02is it possible to write a converter to openArray of my own type?
22:15:21Araqno, you cannot return openArray
22:15:39Araqyou even wrote this in your feature request
22:15:54krux02yea, but it was with an AFAIK
22:16:09krux02now the AFAIK can go way ;)
22:16:49krux02but it is good to know that you did read it
22:18:30krux02what do you think about that feature request?
22:21:57enthus1astdom96: idk if FutureVar helps. Cause first parameter is an object, not a future.
22:23:48dom96enthus1ast: I don't think it's a good idea to be editing pieces of an object in an async proc.
22:24:38dom96But there are cases where it's useful.
22:24:50dom96What do you need 'var' for?
22:25:21enthus1asti have an evaluate function which talks to an api
22:25:33enthus1astthe connection has a counter
22:26:02dom96Sounds like you should make your object a 'ref'
22:26:06enthus1asti need to be able to send an receive and inc the counter
22:28:15*Vladar quit (Quit: Leaving)
22:28:23enthus1ast:) looks good so far
22:29:53dom96Went with the 'ref' solution? :)
22:30:07enthus1asti always forget that : )
22:31:12enthus1astto many computing hours i thing
22:32:55FromGitter<zetashift> So using mingw-x64 gives me a bunch of errors; I tried the 32bit compiler(from mingw.org) too but finish.exe says that those are *incompatible*
22:33:15FromGitter<zetashift> Quite a pain the ass; I might just dual boot on this machine
22:35:30dom96zetashift: ignore finish.exe
22:35:32*shashlick quit (Ping timeout: 268 seconds)
22:35:39dom96Try compiling something
22:36:00*shashlick joined #nim
22:36:12*yglukhov quit (Remote host closed the connection)
22:36:53dom96The file "Nim-devel/examples/cross_calculator/android/src/com/github/nimrod/crosscalculator/crosscalculator.java" just triggered a bug in my untar package because it's such a long file path :)
22:38:09*onionhammer joined #nim
22:39:43enthus1asta few weeks ago i tried the pascal lazraus example and it was outdated
22:39:59enthus1astlazarus
22:40:17Araqkrux02: I dunno, too tired to have an opinion on it
22:40:38Araqenthus1ast he, should we remove it?
22:40:43Araqit bitrot
22:41:03FromGitter<zetashift> dom86: Ah thanks that worked!
22:41:10*brson quit (Ping timeout: 260 seconds)
22:41:11enthus1astbetter update it : )
22:41:48enthus1asti was in the s-bahn, with german no internet, and i'n not fluent in pascal
22:42:09dom96Araq: what's the best way to concatenate two strings which have many \0 at the end?
22:42:23dom96anything in the stdlib for that?
22:42:35Araquse & for that
22:42:50Araqit works, only 'echo' doesn't show anything after the \0
22:43:07dom96Araq: Doesn't. Ends up with: 'foo\0\0\0\blah\0\0\0'
22:43:40dom96or are you saying that this is fine
22:43:52dom96Not for my use case
22:44:30Araqwell that's how & should work
22:44:41Araqwhat do you want to do instead? oh I see
22:45:15*bjz joined #nim
22:45:25Araqyou need to mess around with len for cstring and copymem
22:45:35krux02dom96: you could use a combination of find and insert
22:45:45krux02I think
22:46:18dom96okay.
22:54:51demi-so based on the last code snippet in this section here: https://nim-lang.org/docs/manual.html#types-tuples-and-object-types how would I create an array that can contain Person and Student objects?
22:58:26dom96By using a wrapper (a variant object).
23:01:41dom96oh, it's using inheritance. I think you can also have an array of RootObj then. But doing that would make me nervous.
23:02:47demi-hmmm, so i cannot follow object inheritance patterns here?
23:06:20*Trustable quit (Remote host closed the connection)
23:10:24dom96You can, I just wouldn't recommend it.
23:11:15demi-hmmm, ok I think I have found an alternate solution that doesn't require inheritance
23:25:09*brson joined #nim
23:42:18Araqping krux02
23:44:36Araqoh well, good night
23:45:01zachcarterhttp://imgur.com/a/iFgPO
23:45:04zachcarterstarted a file browser
23:45:13krux02ho
23:45:23krux02Araq: pong
23:45:35AraqI closed an issue from you
23:46:34krux02yea, I can understand it
23:47:12*abeaumont quit (Ping timeout: 240 seconds)
23:47:40krux02I just would have guessed, that when nim has an escape string procedure, and compiles to c, where strings need to be escaped, it would use that method
23:49:14Araqoh I'm sure the compiler had exactly this bug
23:49:21Araqbut it has been fixed
23:49:30Araqthe C spec is insane.
23:50:02krux02yea, but then why has the compiler a different version of escape than the standard library?
23:50:34Araqit would be a breaking change for the stdlib
23:51:11krux02but what's a broken escape procedure good for?
23:51:41Araqand the stdlib version doesn't claim it's feasible for generating C
23:51:48krux02yea I know
23:52:07krux02it doesn't claim to be feasible for anything
23:52:19Araqyup, that's good.
23:52:35AraqI guess it was a bad idea to begin with
23:53:23Araqon the other hand "we don't offer this because it would be wrong for barbaric C" is also a weird justification
23:53:34krux02in my opinion, this function should be either the same as the one used internally from the compiler, so that it can be trusted to emit C code, or removed/depricated
23:53:49krux02otherwise it is just there to introduce bugs
23:54:36Araqyou would have introduced the very same bug without its existance
23:54:51Araqso you can't blame it for this bug.
23:55:08krux02maybe, but then I would have known that I had untested code
23:55:19krux02the standard library I kind of rely on a bit more
23:55:22Araqjust add a remark to its docs and move on
23:55:30krux02I don't expect it necessarily to introduce bugs
23:55:57AraqI use it in nimsuggest and don't introduce bugs with it
23:56:12Araqagain, the docs don't claim it supports barbaric C.
23:56:22Araqyou can add a remark anyway.
23:56:50Araqno need to deprecate it. what's the workaround then? write the same lines in your own module?
23:57:28krux02I copied it in my module where I fixed it
23:57:50krux02but I could imagine it, to have an optional argument, that tells how it should escape
23:57:51Araqyes, but you needed a different version of it. I don't.
23:58:12krux02for example shell or C
23:58:24federico3speaking of strings, what's the fastest way add many strings to a big buffer? use newStringOfCap and add?
23:58:45Araqfederico3: yeah, pretty much
23:58:54krux02federice3: yes
23:59:27federico3thanks, and to empty it? foo = "" or foo = newStringOfCap(...) again?
23:59:39krux02setLen
23:59:47krux02foo.setLen(0)
23:59:53Araq ## Escapes a string `s`.
23:59:53Araq ##
23:59:53Araq ## This does these operations (at the same time):
23:59:53Araq ## * replaces any ``\`` by ``\\``
23:59:54Araq ## * replaces any ``'`` by ``\'``
23:59:55Araq ## * replaces any ``"`` by ``\"``
23:59:56Araq ## * replaces any other character in the set ``{'\0'..'\31', '\128'..'\255'}``
23:59:57Araq ## by ``\xHH`` where ``HH`` is its hexadecimal value.
23:59:58Araq ## The procedure has been designed so that its output is usable for many
23:59:59Araq ## different common syntaxes.