00:00:54 | * | libman quit (Quit: Connection closed for inactivity) |
00:02:34 | Nobabs27 | Total 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:04 | Nobabs27 | Essentially executing lots of external programs. |
00:03:57 | Araq | write a Nim program? |
00:04:18 | Araq | that uses os.execShellCmd() or osproc.execProcess() |
00:05:56 | Araq | and spice it up with something like proc `!!`(cmd: string) = if execShellCmd(cmd) != 0: quit "failed " & cmd |
00:06:16 | Araq | !!"nim c tmp.nim" |
00:06:23 | Araq | !!"some other command here" |
00:09:34 | * | rauss joined #nim |
00:09:40 | * | Sentreen joined #nim |
00:11:41 | krux02 | Araq: can I do double escaping in Nim? |
00:11:56 | * | yay left #nim (#nim) |
00:12:13 | krux02 | I need to create a string literal, that itself has escaped string literas in it |
00:12:43 | krux02 | or to make it short, I could like add calls to gnu ASM |
00:13:38 | krux02 | and one of that asm calls is .ascii |
00:14:05 | krux02 | and I need to embed sourcecode in a string literal |
00:15:45 | * | libman joined #nim |
00:16:22 | krux02 | ok found it |
00:16:24 | krux02 | no problem |
00:27:39 | zachcarter | this union is effing me up |
00:28:09 | zachcarter | I have a union of a cint and a pointer |
00:28:17 | * | yglukhov quit (Remote host closed the connection) |
00:28:35 | zachcarter | if I cast the union into a pointer of another type |
00:28:53 | * | yglukhov joined #nim |
00:29:27 | zachcarter | it’s difficult to determine whether the cast actually resulted in producing an object of the intended type |
00:29:32 | zachcarter | without a segfault occurring |
00:30:43 | zachcarter | https://gist.github.com/zacharycarter/4d4485a11e7ce1ad8c8e591c782b05b9 |
00:31:22 | zachcarter | https://gist.github.com/zacharycarter/4d4485a11e7ce1ad8c8e591c782b05b9#file-gistfile1-txt-L10 will segfault if the pointer wasn’t assigned to |
00:31:31 | zachcarter | err pointr |
00:32:58 | * | yglukhov quit (Ping timeout: 240 seconds) |
00:35:40 | zachcarter | any ideas? |
00:39:30 | zachcarter | I essentially end up with values in that field like - 0x1 |
00:39:31 | zachcarter | 0x102c1d1f8 |
00:39:48 | zachcarter | 0x1 is obviously an int occupying the memory of the union |
00:43:13 | krux02 | zachcarter: I have really problems understanding what the union of pointer and an int is supposed to do |
00:43:21 | krux02 | it does not have a tag about the active field |
00:43:29 | zachcarter | yeah that’s the problem |
00:43:45 | zachcarter | I might submit a PR to nuklear adding this |
00:43:52 | zachcarter | seems ridiculous not to have it |
00:44:40 | zachcarter | in fact I’m going to submit an issue now |
00:48:09 | * | arnetheduck joined #nim |
00:48:39 | Araq | just map the "union" to a single pointer |
00:48:57 | Araq | sizeof(cint) <= sizeof(void*) anyway |
00:49:05 | Araq | good night |
00:49:07 | * | bjz joined #nim |
00:49:20 | demi- | 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:24 | zachcarter | thanks Araq |
00:49:34 | zachcarter | gn |
00:50:33 | zachcarter | demi it’s not trying to |
00:50:37 | zachcarter | demi- * |
00:50:57 | zachcarter | it’s just some code ripped out from one of my examples - the problem is in the C code it binds to |
00:51:11 | demi- | right, i mean the C code |
00:51:37 | demi- | if that is what the union is trying to accomplish here, that is wrong/bad in C |
00:52:07 | zachcarter | it is pretty much |
00:52:18 | zachcarter | I think I get why he did it that way but I agree it’s not the right way |
00:52:39 | zachcarter | I’ll probably end up trying to port this library to nim and do a better job with it than he did |
00:53:05 | demi- | 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:16 | zachcarter | thank you |
00:54:14 | demi- | 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:22 | zachcarter | thank you |
01:01:03 | * | gk_-1wm_- joined #nim |
01:01:04 | * | gk_-1wm_- left #nim (#nim) |
01:03:57 | zachcarter | I 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:47 | Nobabs27 | whats the equivalent of $1 $2 etc of BASH in Nim? |
01:43:10 | krux02 | argent $1 $2 etc nut just the arguments for functions? |
01:43:26 | krux02 | I would say, nim has real argument names |
01:43:35 | krux02 | those are the equivalent |
01:47:14 | PMunch | Hmm, I'm struggling with the ui library.. |
01:47:47 | PMunch | Nobabs27, if you want to write a script there are ways of getting those variables |
01:48:37 | PMunch | commandLineParams() will give you a list of them |
01:57:54 | krux02 | HA it works, my last 5 hours of hacking finally work |
01:59:14 | krux02 | I 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:12 | zachcarter | nice! |
02:02:10 | krux02 | I needed to emit a few asm instructions |
02:04:05 | * | bjz joined #nim |
02:06:16 | zachcarter | I just figured out I think the answer to the problem I’ve been fighting the past couple of hours |
02:07:19 | zachcarter | http://imgur.com/a/Nn3OH |
02:07:38 | zachcarter | got image buttons working finally and I think I’ve resolved all myt exture binding issues |
02:08:58 | zachcarter | still need to get mipmaps working and some other stuff with bgfx |
02:11:06 | krux02 | it really looks cool |
02:11:40 | zachcarter | thank you |
02:12:26 | krux02 | zachcarter: https://sourceware.org/gdb/onlinedocs/gdb/dotdebug_005fgdb_005fscripts-section.html#dotdebug_005fgdb_005fscripts-section |
02:12:44 | krux02 | do you see the example for "Script Text Entries" |
02:12:51 | krux02 | that's all documentation I had |
02:13:22 | zachcarter | ugh |
02:13:40 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
02:14:12 | zachcarter | I’m impressed you managed to get that working |
02:14:35 | krux02 | but I got it broken down to this code in nim: http://ix.io/nLk |
02:15:31 | zachcarter | I almost understand it haha |
02:15:35 | krux02 | than I can write without escaping, and apply escaping in the copilation |
02:16:05 | zachcarter | right |
02:16:09 | krux02 | yes it's magic how it just becomes understandable as soon as all the \\\\ go agway |
02:16:18 | zachcarter | yeah |
02:16:20 | zachcarter | exactly |
02:17:22 | krux02 | there is still one caveat |
02:17:59 | krux02 | gdb disables this script by default, but it least it get's detected and gdb print a message, how to enable it |
02:18:22 | zachcarter | ah okay |
02:18:51 | krux02 | (gdb) print arg |
02:18:51 | krux02 | $1 = seq = {"Hi", "this", "is", "a", "string", "sequence"} |
02:19:19 | zachcarter | niceeeeee |
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:30 | krux02 | zachcarter: https://github.com/krux02/opengl-sandbox/blob/master/debug.nim |
02:37:43 | krux02 | there you can get inspiration when you want the same feature |
02:37:57 | zachcarter | :D thank you |
02:38:06 | krux02 | maybe at some point I want to contribute to the main Nim repository |
02:39:00 | krux02 | in the end it was the go code that helped me to get this support |
02:39:18 | krux02 | this is the script I based my script on: https://golang.org/src/runtime/runtime-gdb.py |
02:40:36 | krux02 | I think for a good support Araq needs to be convinced to generate types that allow the infer the type from the name |
02:41:14 | krux02 | TY_.* is not really a good regular expression for seq types |
02:41:16 | FromGitter | <Varriount> \0/ |
02:41:40 | krux02 | Varriount: you woke up? |
02:41:56 | FromGitter | <Varriount> I'm full of cold medicine |
02:42:01 | zachcarter | uh oh |
02:42:08 | zachcarter | robo tripping Varriount |
02:42:09 | zachcarter | :D |
02:42:26 | FromGitter | <Varriount> Not quite. Just one with swollen sinuses |
02:42:38 | zachcarter | no fun |
02:42:52 | krux02 | tomorrow I will definitively not work |
02:42:59 | krux02 | it is now 3:42 |
02:43:03 | krux02 | here |
02:43:23 | FromGitter | <Varriount> It's around 9 here. |
02:43:38 | FromGitter | <Varriount> (In the afternoon) |
02:44:09 | krux02 | ah, I am used to call that 21:00 :P |
02:44:23 | zachcarter | 9 here too Varriount |
02:44:31 | zachcarter | actually 9:44 pm |
02:45:55 | krux02 | I 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:31 | krux02 | or maybe not |
02:47:36 | krux02 | I think I should sleep |
02:47:44 | zachcarter | haha |
02:47:56 | * | chemist69 joined #nim |
02:47:57 | zachcarter | probably not a terrible idea if it’s 4 am |
02:48:03 | krux02 | I with you all a good night |
02:48:12 | zachcarter | likewise, goodnight krux02 |
02:48:22 | * | krux02 quit (Quit: Leaving) |
02:51:28 | * | vlad1777d quit (Quit: Leaving) |
03:00:42 | zachcarter | Varriount, not sure if you saw my latest goings on with Nuklear and BGFX but - http://imgur.com/a/jf8el |
03:01:00 | zachcarter | I got images working with nuklear |
03:07:06 | FromGitter | <raydf> @zacharycarter nice work with the nuklear lib :) |
03:16:20 | zachcarter | thank you raydf |
03:21:17 | Nobabs27 | another noob question: if + strings, how does that work? Does it have to cast or something? I keep getting Error: ':' expected |
03:21:56 | zachcarter | & I believe |
03:21:58 | zachcarter | for string concatenation |
03:22:15 | zachcarter | .add for append |
03:22:28 | zachcarter | err that’s wrong |
03:22:46 | zachcarter | no I was right add does append two strings |
03:23:09 | Nobabs27 | basically I want this: var whatever = "hi", if whatever == "hi" echo "it worked" |
03:23:49 | zachcarter | var whatever = “hi” |
03:23:58 | zachcarter | if whatever == “hi”: echo “it worked" |
03:26:09 | zachcarter | var whatever = "hi"; if whatever == "hi": echo "it worked" if you want it on one line |
03:27:22 | Nobabs27 | kk got it thanks |
03:28:35 | zachcarter | np |
03:36:48 | Nobabs27 | ok now how about commandLineParams(), says it's a "TaintedString", how do I use if to test specific args ? |
03:38:14 | zachcarter | try doing this |
03:38:21 | zachcarter | echo repr commandLineParams() |
03:40:29 | zachcarter | I honeslty always use docopt so I don’t have much familiarity with commandlineparams and what it produces |
03:40:38 | zachcarter | but if you repr that object you should be able to figure it out |
03:40:53 | zachcarter | Nobabs27 ^ |
03:41:01 | Nobabs27 | I get back a memory address (?) 0x7fa8505be050[] |
03:41:16 | zachcarter | did you specify any command line args? |
03:41:35 | Nobabs27 | if I do I get 0x7f586aeee050[0x7f586aeed080"asdasdasd"] |
03:41:53 | zachcarter | okay one sec |
03:43:53 | zachcarter | import os |
03:43:54 | zachcarter | echo paramStr(1) |
03:44:15 | Nobabs27 | kk |
03:45:10 | Nobabs27 | same output |
03:45:47 | Nobabs27 | wait |
03:45:59 | Nobabs27 | nver mind got it |
03:46:02 | Nobabs27 | never mind got it |
03:46:05 | Nobabs27 | * |
03:46:18 | Nobabs27 | thanks again xD |
03:46:24 | zachcarter | haha np |
03:47:02 | zachcarter | time to make a filebrowser with this gui lib |
03:47:22 | Nobabs27 | cool, linux support? |
03:47:43 | zachcarter | well I’m working on a texture packer |
03:47:47 | zachcarter | for my game engine |
03:47:52 | zachcarter | that’s being written in Nim |
03:48:12 | zachcarter | I wrote bindings for a C gui library called Nuklear |
03:48:15 | Nobabs27 | ah ok so it's an program/engine internal thing? |
03:48:22 | zachcarter | https://github.com/zacharycarter/nuklear-nim |
03:48:29 | zachcarter | the GUI library is not, no |
03:48:40 | zachcarter | you can use it with whatever rendering backend you’d like |
03:48:48 | zachcarter | I’m just using it in my game engine |
03:49:44 | zachcarter | if 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:45 | Nobabs27 | yeah I meant the file manager tho |
03:49:56 | zachcarter | https://github.com/yglukhov/nimx |
03:50:20 | zachcarter | oh yeah the file manager will just be internally used for the texture manager, and other tools that end up needing one |
03:50:46 | Nobabs27 | cool stuff |
03:51:05 | zachcarter | thanks |
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:44 | zachcarter | hrm I’m struggling to figure out how to do this : |
05:01:08 | zachcarter | https://gist.github.com/zacharycarter/58561708c73aae6b519b3e9defbcd2ab |
05:04:23 | zachcarter | whoops forgot one thing |
05:04:39 | zachcarter | okay fixed |
05:07:39 | zachcarter | fixed again lol, man I must be sleepy, missing stupid things |
05:08:03 | zachcarter | I think now the example makes sense |
05:08:28 | zachcarter | apparently this is possible in C with a macro |
05:09:18 | zachcarter | https://github.com/vurtun/nuklear/blob/master/nuklear.h#L2909 |
05:10:39 | zachcarter | since I can’t do forward declarations in Nim |
05:10:40 | zachcarter | of types |
05:10:44 | zachcarter | I’m not sure how to handle this…. |
05:11:22 | zachcarter | can I forward declare templates? |
05:11:28 | * | butchster_ joined #nim |
05:12:09 | * | BlaXpirit_ joined #nim |
05:12:42 | zachcarter | nm 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:28 | Nobabs27 | how would I use if lots of times? Like in if whatever == "ok" || whatever == "okay" |
05:29:38 | Nobabs27 | or 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:13 | zachcarter | use a switch statement? |
05:55:19 | zachcarter | or a case statement rather |
05:55:26 | zachcarter | ah 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:33 | dom96 | If 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:15 | Araq | I'm here too. |
08:23:12 | dom96 | Not 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:57 | Araq | I 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:20 | dom96 | Martin 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:28 | FromGitter | <evacchi> so, FYI I tried to spawn 1000 threads on Mac OS and it crashed the process at around ~500 |
10:13:05 | dom96 | evacchi: threads in Nim are heavy. They are not green threads. |
10:14:54 | dom96 | are you using createThread or spawn? |
10:16:55 | Araq | dom96: I told him to try threads |
10:17:44 | Araq | also you should try it on Linux, nobody runs servers on OSX |
10:17:59 | dom96 | so should spawning 1000 threads work? |
10:18:22 | dom96 | or maybe a better question is: should it be done? |
10:21:57 | Jehan_ | I just tried it on OS X, ran out of threads only after the 2048th. |
10:22:06 | Jehan_ | Error: unhandled exception: cannot create thread [ResourceExhaustedError] |
10:23:00 | Jehan_ | Which happens when pthread_create() returns an error. |
10:29:35 | Araq | well yeah, good thing that error handling works ;-) |
10:30:28 | FromGitter | <evacchi> dom96 createThread |
10:30:36 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
10:31:03 | FromGitter | <evacchi> https://gist.github.com/evacchi/43fdf87a885748f00aa8f8888e1718c7 |
10:31:39 | FromGitter | <evacchi> yeah 2048 is actually the hard limit |
10:31:46 | FromGitter | <evacchi> I wonder why I can't even hit 1000 |
10:31:53 | * | abeaumont quit (Ping timeout: 260 seconds) |
10:32:12 | FromGitter | <evacchi> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=58b15d2ae961e53c7f660430] |
10:34:34 | FromGitter | <evacchi> Araq: well yeah, but I do my dev work on MacOS :-) |
10:34:46 | FromGitter | <evacchi> I could spin up a docker instance of course |
10:39:35 | * | bjz joined #nim |
10:42:56 | Jehan_ | The pasted code works for me. |
10:43:17 | Jehan_ | Mind you, I'm still on Yosemite on this machine. |
10:43:24 | Jehan_ | Not sure if that matters. |
10:43:54 | * | bjz quit (Client Quit) |
10:44:20 | FromGitter | <evacchi> this is sierra on 13" MBP 2016 |
10:44:41 | FromGitter | <evacchi> it only has two physical cores |
10:44:47 | FromGitter | <evacchi> might be relevant |
10:45:52 | * | bjz joined #nim |
10:45:56 | Jehan_ | Well, what error are you getting? |
10:46:42 | Jehan_ | 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:10 | FromGitter | <evacchi> SIGSEV |
10:48:12 | FromGitter | <evacchi> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=58b160ea00c00c3d4f86e4eb] |
10:48:33 | Jehan_ | This works for me: https://gist.github.com/rbehrends/6f48609f00529b28e5a68e32cdd748fb |
10:49:02 | Jehan_ | Hmm, SIGSEGV is odd. |
10:49:09 | * | couven92 quit (Ping timeout: 260 seconds) |
10:49:37 | FromGitter | <evacchi> huh! |
10:49:40 | FromGitter | <evacchi> that works for me too |
10:49:41 | Jehan_ | I'm honestly not sure where a SIGSEGV could happen. |
10:49:59 | Jehan_ | I'm wondering if the void thread arg type causes any weirdness? |
10:50:01 | FromGitter | <evacchi> maybe something about the infinite counter in the proc t() |
10:50:23 | Jehan_ | That should cause an overflow at worst. Plus, it still works for me. |
10:51:02 | FromGitter | <evacchi> weird |
10:53:09 | Jehan_ | Running with the devel branch as of a few days ago (2/21). |
10:53:26 | FromGitter | <evacchi> 1) 16 |
10:53:57 | FromGitter | <evacchi> btw if I substitute the void thread with an int thread I get to ~960 |
10:55:19 | Jehan_ | Hmm, this is all extremely odd. |
10:55:40 | FromGitter | <evacchi> I'm really failing to see what's the real difference between your code and mine |
10:55:43 | FromGitter | <evacchi> :D |
10:56:12 | Jehan_ | Mind you, it may be that it simply triggers a soft limit at the OS level before the hard limit. |
10:56:20 | FromGitter | <evacchi> if i remove the sleep in the thread creation it crashes much earlier |
10:56:21 | FromGitter | <evacchi> possibly |
10:57:01 | Jehan_ | Oops, I'm just looking at your code and I think I see the problem. |
10:57:10 | cheatfate | I 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:28 | Jehan_ | You're doing var th = thread[i] and then use that as the argument to createThread(). |
10:57:47 | Jehan_ | Which means that all threads share the same data structure on the thread. |
10:57:59 | Jehan_ | You have to pass threads[i] instead. |
10:58:08 | FromGitter | <evacchi> cheatfate: yeah I was just making a point from yesterday :P |
10:58:41 | Jehan_ | I should have noticed that earlier, but somehow my eyes skipped over that part. |
10:58:49 | FromGitter | <evacchi> Jehan_ ooooh. subtle |
10:59:06 | Jehan_ | Thread[T] is a data structure, not a reference. |
10:59:19 | FromGitter | <evacchi> thanks for noticing, as I said I'm still learning |
11:00:12 | FromGitter | <evacchi> so, yup, it fails and 2048, as expected |
11:00:16 | Jehan_ | Among other things, it contains the thread's GC information. |
11:00:43 | Jehan_ | So, all the threads' GCs are trying to share the same heap. Sort of. |
11:01:37 | FromGitter | <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:34 | FromGitter | <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:08 | Jehan_ | 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:35 | Jehan_ | It's rarely useful to have more than N*cores threads for some fairly small N. |
11:04:13 | FromGitter | <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:45 | FromGitter | <evacchi> still, my fear would be that then the code would not be x-platform |
11:06:50 | Jehan_ | You can do conditional compilation, doing the pinning only on architectures that support it. |
11:07:06 | Jehan_ | That said, I'd be careful about even assuming that this is necessary/beneficial. |
11:07:27 | Jehan_ | Especially if your program doesn't own the machine and has to coexist with other processes. |
11:07:48 | FromGitter | <evacchi> I thought so |
11:09:21 | * | dddddd joined #nim |
11:10:03 | FromGitter | <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:28 | Araq | keep 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:14 | FromGitter | <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:31 | FromGitter | <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:05 | cheatfate | evacchi: 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:35 | FromGitter | <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:02 | FromGitter | <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:02 | FromGitter | ... 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:38 | zachcarter | demi- are you around by any chance? |
14:18:46 | demi- | yup! |
14:18:51 | zachcarter | awesome! |
14:19:01 | zachcarter | so yesterday you pointed me to intptr_t |
14:19:23 | zachcarter | which I get is an int big enough to hold a pointer |
14:19:34 | demi- | mhmmm |
14:19:36 | zachcarter | and that’s what he should be using instead of that stupid union |
14:19:56 | demi- | yeah, if that is what the intent of the union was |
14:20:06 | zachcarter | yeah you were spot on with that |
14:20:13 | zachcarter | he even said if he were doing things over again he’d using intptr_t |
14:20:15 | demi- | great! |
14:20:32 | zachcarter | but 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:42 | zachcarter | like a valid int that I should be using as a texture handle ID |
14:20:57 | zachcarter | or whether it holds a pointer to a texture handle object |
14:21:09 | zachcarter | does using intptr_t allow me to figure that out at runtime? |
14:21:14 | demi- | 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:43 | zachcarter | ahh okay |
14:21:46 | demi- | because, presumably you aren't going to do pointer arithmetic in nim |
14:22:04 | demi- | so you can always treat it as a pointer, instead of trying to figure out what it is |
14:22:08 | zachcarter | I didn’t get his suggestion last night but I think I get it now |
14:22:29 | zachcarter | okay thank you I’ll give it a shot |
14:22:31 | demi- | yeah so |
14:22:40 | zachcarter | instead of recreating the union in the bindings |
14:22:44 | zachcarter | just bind to a pointer for that object |
14:22:46 | zachcarter | right? |
14:22:49 | demi- | yeah, exactly |
14:22:55 | zachcarter | okay gotcha thank you I’ll do that |
14:23:29 | demi- | cool, good luck |
14:23:50 | zachcarter | thank 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:48 | federico3 | any os-independent way to get the hostname? |
16:24:15 | krux02 | well 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:31 | federico3 | krux02: there's a working (but not so pretty) getHostname but I was hoping for something that would work on windows as well |
16:34:10 | krux02 | http://ix.io/nLK |
16:34:28 | federico3 | socket.gethostname() in Python seems to work on windows... |
16:35:11 | krux02 | yea when you want to have a python solituon you are in the wrong channel I guess :P |
16:35:36 | federico3 | ahem, that's not what I meant |
16:41:56 | dom96 | federico3: maybe you could fix getHostname to also work on Windows? |
16:43:18 | federico3 | dom96: 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:33 | dom96 | The system module? |
16:48:02 | dom96 | If so then definitely not :) |
16:50:05 | federico3 | traditionally gethostname and getfqdn are related to sockets |
16:53:47 | dom96 | yes, so nativesockets makes sense |
17:06:01 | demi- | 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:02 | dom96 | It should be renamed to 'sha1' |
17:14:42 | demi- | lol |
17:16:00 | federico3 | any appveyor configuration that installs the zipfiles? |
17:22:26 | cheatfate | federico3, what does it mean installs? |
17:22:32 | cheatfate | how you can install zipfile? |
17:24:05 | federico3 | sorry, I mean: install Nim by downloading and decompressing the zipfile |
17:27:17 | cheatfate | federico3, 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:44 | federico3 | yup, I'm testing something based on that :) |
17:31:29 | cheatfate | about `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:04 | Araq | is it in the stdlib though? I think it's in compiler/ |
17:32:21 | cheatfate | Araq, its in lib |
17:32:27 | Araq | bah |
17:32:27 | cheatfate | lib/pure/securehash.nim |
17:32:50 | Araq | cryptography, will they ever get it right? |
17:33:27 | cheatfate | Araq, everything created by humans can be broken by humans... |
17:33:30 | Araq | maybe it's fundamentally flawed to use a smallish number of bits |
17:33:55 | * | couven92 quit (Quit: Client Disconnecting) |
17:34:49 | cheatfate | Araq, you using smaller number of bits from `securehash.nim` for name mangling? |
17:35:45 | Araq | no, I use md5 for the name mangling |
17:36:22 | cheatfate | but compiler imports securehash |
17:36:26 | cheatfate | for some reason |
17:39:24 | krux02 | Araq: 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:01 | cheatfate | `super macro hooks` :) it would be nice addition to compiler |
17:45:48 | cheatfate | with 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:03 | dom96 | Araq: you moved it into stdlib in 2015 for some reason |
17:50:54 | stisa | ``super macro hooks`` isn't that basically a plugin? for example, I think ``locals`` is implemented with a plugin |
17:56:10 | cheatfate | stisa, what is `locals`? |
17:56:46 | stisa | https://nim-lang.org/docs/system.html#locals, |
17:58:49 | cheatfate | Araq, so compiler support plugins? |
18:01:34 | dom96 | Araq: Looks like a new regression :( https://github.com/nim-lang/Nim/issues/5436 |
18:02:24 | dom96 | (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:01 | federico3 | cheatfate: appveyor works - https://github.com/nim-lang/Nim/wiki/BuildServices |
18:14:05 | cheatfate | federico3, 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:52 | Araq | dom96 well the compiler is now correct |
19:06:02 | Araq | and rejects this program |
19:13:04 | dom96 | Araq: 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:01 | Araq | well 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:18 | Araq | however, it still fails when I make it a proc |
19:14:30 | * | enthus1a1t quit (Ping timeout: 268 seconds) |
19:15:36 | dom96 | :\ |
19:15:58 | dom96 | Sadly I can't use docopt anyway because it depends on nre |
19:16:05 | dom96 | But I think lots of others are using it. |
19:18:08 | krux02 | what's the problem with nre? |
19:18:31 | * | zachcarter quit (Quit: zachcarter) |
19:18:54 | dom96 | dependency on pcre |
19:19:33 | krux02 | and that is a problem because of license? |
19:19:53 | dom96 | No, because I would need to mess about with statically linking it on all platforms. |
19:20:02 | dom96 | Which I doubt will go smoothly |
19:20:30 | dom96 | This is for choosenim which I want to Just Work (TM). |
19:20:58 | dom96 | And 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:41 | dom96 | Any Nim packages for sha256? |
20:13:43 | * | Arrrr quit (Read error: Connection reset by peer) |
20:16:12 | stisa | dom96 I used nimSHA2 https://github.com/jangko/nimSHA2 , seems to work fine |
20:16:39 | dom96 | awesome |
20:17:17 | dom96 | This needs a 'sha256' tag in Nimble |
20:19:39 | Araq | ping rokups |
20:43:24 | user__ | Araq: I reduced my problem to this: https://github.com/nim-lang/Nim/issues/5439 |
20:44:33 | Araq | yay |
20:45:30 | Araq | for 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:59 | Trustable | Araq, what do you recommend to find the reason for my problem? |
20:56:11 | * | RushPL quit (Ping timeout: 255 seconds) |
20:57:46 | PMunch | Prints correct method here as well user__ |
20:58:38 | Araq | Trustable: well I recently did a method related compiler change |
20:58:44 | Araq | so try most recent nim devel |
20:58:50 | * | def-pri-pub joined #nim |
20:59:15 | * | RushPL joined #nim |
21:00:51 | Araq | but an older version on Linux 64bit also produces the correct result |
21:02:02 | Araq | what does 'nim -v' say? |
21:03:25 | PMunch | http://ix.io/nM6 |
21:03:49 | PMunch | A bit annoying that it first gets expanded to the variable and not the function.. |
21:04:25 | Trustable | Araq, same problem with current devel. |
21:05:32 | Araq | Trustable: what does 'nim -v' say? |
21:06:04 | Trustable | Nim Compiler Version 0.16.1 (2017-02-25) [Linux: amd64] |
21:06:04 | Trustable | Copyright (c) 2006-2017 by Andreas Rumpf |
21:06:05 | Trustable | git hash: f250c30b9d5beb587d3b62b99dc938447209836d |
21:06:05 | Trustable | active boot switches: -d:release |
21:07:59 | * | byte512 joined #nim |
21:34:57 | * | yglukhov quit (Remote host closed the connection) |
21:35:22 | FromGitter | <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:50 | Vladar | zetashift: wrong dll version, maybe? |
21:45:58 | FromGitter | <zetashift> 1) 5.1 right? |
21:46:20 | Vladar | yep |
21:46:37 | FromGitter | <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:52 | Vladar | you are welcome ) |
21:46:57 | FromGitter | <zetashift> also yea correct version |
21:47:30 | Vladar | debug vs. release dll? |
21:47:36 | dom96 | wrong architecture? (32 vs 64 bit) |
21:47:57 | Vladar | yeah, also this ^ |
21:48:11 | Vladar | got fooled one time by that |
21:48:35 | FromGitter | <zetashift> oh yea it's 32 |
21:48:36 | FromGitter | <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:39 | FromGitter | <zetashift> no x64 for 1.5.1 so gotta compile it myself then woop |
21:55:28 | Vladar | or just compile for 32bit |
21:55:50 | FromGitter | <zetashift> with nim c? how to do I switch arch |
21:56:05 | FromGitter | <zetashift> got it |
21:56:14 | FromGitter | <zetashift> --cpu:i386 |
22:01:12 | enthus1ast | can i somehow write a async method / async proc with variable first parameter? (withouth leaving the garbage collected save heaven?) |
22:03:21 | enthus1ast | forum says return `thing` in the method : / |
22:04:28 | dom96 | what do you mean by "variable first parameter"? |
22:04:53 | enthus1ast | proc(foo: var baa) |
22:05:01 | enthus1ast | found your forum entry |
22:07:22 | enthus1ast | it is not possible right? |
22:07:28 | dom96 | You can use FutureVar for that |
22:08:41 | * | zachcarter joined #nim |
22:11:11 | enthus1ast | like this proc(foo: FutureVar[baa]) ? |
22:12:20 | dom96 | yeah |
22:14:15 | * | zachcarter quit (Read error: Connection reset by peer) |
22:14:38 | * | zachcarter joined #nim |
22:15:00 | krux02 | is it possible to write a converter to openArray of my own type? |
22:15:21 | Araq | no, you cannot return openArray |
22:15:39 | Araq | you even wrote this in your feature request |
22:15:54 | krux02 | yea, but it was with an AFAIK |
22:16:09 | krux02 | now the AFAIK can go way ;) |
22:16:49 | krux02 | but it is good to know that you did read it |
22:18:30 | krux02 | what do you think about that feature request? |
22:21:57 | enthus1ast | dom96: idk if FutureVar helps. Cause first parameter is an object, not a future. |
22:23:48 | dom96 | enthus1ast: I don't think it's a good idea to be editing pieces of an object in an async proc. |
22:24:38 | dom96 | But there are cases where it's useful. |
22:24:50 | dom96 | What do you need 'var' for? |
22:25:21 | enthus1ast | i have an evaluate function which talks to an api |
22:25:33 | enthus1ast | the connection has a counter |
22:26:02 | dom96 | Sounds like you should make your object a 'ref' |
22:26:06 | enthus1ast | i need to be able to send an receive and inc the counter |
22:28:15 | * | Vladar quit (Quit: Leaving) |
22:28:23 | enthus1ast | :) looks good so far |
22:29:53 | dom96 | Went with the 'ref' solution? :) |
22:30:07 | enthus1ast | i always forget that : ) |
22:31:12 | enthus1ast | to many computing hours i thing |
22:32:55 | FromGitter | <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:15 | FromGitter | <zetashift> Quite a pain the ass; I might just dual boot on this machine |
22:35:30 | dom96 | zetashift: ignore finish.exe |
22:35:32 | * | shashlick quit (Ping timeout: 268 seconds) |
22:35:39 | dom96 | Try compiling something |
22:36:00 | * | shashlick joined #nim |
22:36:12 | * | yglukhov quit (Remote host closed the connection) |
22:36:53 | dom96 | The 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:43 | enthus1ast | a few weeks ago i tried the pascal lazraus example and it was outdated |
22:39:59 | enthus1ast | lazarus |
22:40:17 | Araq | krux02: I dunno, too tired to have an opinion on it |
22:40:38 | Araq | enthus1ast he, should we remove it? |
22:40:43 | Araq | it bitrot |
22:41:03 | FromGitter | <zetashift> dom86: Ah thanks that worked! |
22:41:10 | * | brson quit (Ping timeout: 260 seconds) |
22:41:11 | enthus1ast | better update it : ) |
22:41:48 | enthus1ast | i was in the s-bahn, with german no internet, and i'n not fluent in pascal |
22:42:09 | dom96 | Araq: what's the best way to concatenate two strings which have many \0 at the end? |
22:42:23 | dom96 | anything in the stdlib for that? |
22:42:35 | Araq | use & for that |
22:42:50 | Araq | it works, only 'echo' doesn't show anything after the \0 |
22:43:07 | dom96 | Araq: Doesn't. Ends up with: 'foo\0\0\0\blah\0\0\0' |
22:43:40 | dom96 | or are you saying that this is fine |
22:43:52 | dom96 | Not for my use case |
22:44:30 | Araq | well that's how & should work |
22:44:41 | Araq | what do you want to do instead? oh I see |
22:45:15 | * | bjz joined #nim |
22:45:25 | Araq | you need to mess around with len for cstring and copymem |
22:45:35 | krux02 | dom96: you could use a combination of find and insert |
22:45:45 | krux02 | I think |
22:46:18 | dom96 | okay. |
22:54:51 | demi- | 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:26 | dom96 | By using a wrapper (a variant object). |
23:01:41 | dom96 | oh, it's using inheritance. I think you can also have an array of RootObj then. But doing that would make me nervous. |
23:02:47 | demi- | hmmm, so i cannot follow object inheritance patterns here? |
23:06:20 | * | Trustable quit (Remote host closed the connection) |
23:10:24 | dom96 | You can, I just wouldn't recommend it. |
23:11:15 | demi- | hmmm, ok I think I have found an alternate solution that doesn't require inheritance |
23:25:09 | * | brson joined #nim |
23:42:18 | Araq | ping krux02 |
23:44:36 | Araq | oh well, good night |
23:45:01 | zachcarter | http://imgur.com/a/iFgPO |
23:45:04 | zachcarter | started a file browser |
23:45:13 | krux02 | ho |
23:45:23 | krux02 | Araq: pong |
23:45:35 | Araq | I closed an issue from you |
23:46:34 | krux02 | yea, I can understand it |
23:47:12 | * | abeaumont quit (Ping timeout: 240 seconds) |
23:47:40 | krux02 | I 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:14 | Araq | oh I'm sure the compiler had exactly this bug |
23:49:21 | Araq | but it has been fixed |
23:49:30 | Araq | the C spec is insane. |
23:50:02 | krux02 | yea, but then why has the compiler a different version of escape than the standard library? |
23:50:34 | Araq | it would be a breaking change for the stdlib |
23:51:11 | krux02 | but what's a broken escape procedure good for? |
23:51:41 | Araq | and the stdlib version doesn't claim it's feasible for generating C |
23:51:48 | krux02 | yea I know |
23:52:07 | krux02 | it doesn't claim to be feasible for anything |
23:52:19 | Araq | yup, that's good. |
23:52:35 | Araq | I guess it was a bad idea to begin with |
23:53:23 | Araq | on the other hand "we don't offer this because it would be wrong for barbaric C" is also a weird justification |
23:53:34 | krux02 | in 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:49 | krux02 | otherwise it is just there to introduce bugs |
23:54:36 | Araq | you would have introduced the very same bug without its existance |
23:54:51 | Araq | so you can't blame it for this bug. |
23:55:08 | krux02 | maybe, but then I would have known that I had untested code |
23:55:19 | krux02 | the standard library I kind of rely on a bit more |
23:55:22 | Araq | just add a remark to its docs and move on |
23:55:30 | krux02 | I don't expect it necessarily to introduce bugs |
23:55:57 | Araq | I use it in nimsuggest and don't introduce bugs with it |
23:56:12 | Araq | again, the docs don't claim it supports barbaric C. |
23:56:22 | Araq | you can add a remark anyway. |
23:56:50 | Araq | no need to deprecate it. what's the workaround then? write the same lines in your own module? |
23:57:28 | krux02 | I copied it in my module where I fixed it |
23:57:50 | krux02 | but I could imagine it, to have an optional argument, that tells how it should escape |
23:57:51 | Araq | yes, but you needed a different version of it. I don't. |
23:58:12 | krux02 | for example shell or C |
23:58:24 | federico3 | speaking of strings, what's the fastest way add many strings to a big buffer? use newStringOfCap and add? |
23:58:45 | Araq | federico3: yeah, pretty much |
23:58:54 | krux02 | federice3: yes |
23:59:27 | federico3 | thanks, and to empty it? foo = "" or foo = newStringOfCap(...) again? |
23:59:39 | krux02 | setLen |
23:59:47 | krux02 | foo.setLen(0) |
23:59:53 | Araq | ## Escapes a string `s`. |
23:59:53 | Araq | ## |
23:59:53 | Araq | ## This does these operations (at the same time): |
23:59:53 | Araq | ## * replaces any ``\`` by ``\\`` |
23:59:54 | Araq | ## * replaces any ``'`` by ``\'`` |
23:59:55 | Araq | ## * replaces any ``"`` by ``\"`` |
23:59:56 | Araq | ## * replaces any other character in the set ``{'\0'..'\31', '\128'..'\255'}`` |
23:59:57 | Araq | ## by ``\xHH`` where ``HH`` is its hexadecimal value. |
23:59:58 | Araq | ## The procedure has been designed so that its output is usable for many |
23:59:59 | Araq | ## different common syntaxes. |