00:03:08 | * | fvs quit (Quit: Page closed) |
00:03:54 | * | Heartmen- joined #nim |
00:08:36 | * | Heartmen- quit (Remote host closed the connection) |
00:09:10 | * | Sentreen quit () |
00:13:12 | * | Guest41134 joined #nim |
00:13:48 | * | namnguyen quit (Ping timeout: 250 seconds) |
00:20:51 | * | Guest41134 quit (Quit: EliteBNC free bnc service - http://elitebnc.org - be a part of the Elite!) |
00:26:34 | * | namnguyen joined #nim |
00:37:12 | * | Demos_ quit (Ping timeout: 250 seconds) |
00:45:19 | * | edub4rt quit (Quit: Leaving) |
00:56:48 | * | Heartmen- joined #nim |
01:02:04 | * | Heartmen- quit (Ping timeout: 260 seconds) |
01:15:39 | * | heretobang quit (Read error: Connection reset by peer) |
01:24:18 | * | mahasamoot quit (Ping timeout: 244 seconds) |
01:25:11 | * | philo quit (Ping timeout: 240 seconds) |
01:31:49 | * | freezerburnV quit (Ping timeout: 260 seconds) |
01:39:07 | * | Fribby quit (Quit: ChatZilla 0.9.92 [Firefox 47.0/20160604131506]) |
01:51:34 | * | chemist69_ quit (Ping timeout: 250 seconds) |
02:06:06 | * | chemist69_ joined #nim |
02:07:27 | * | edub4rt joined #nim |
02:09:42 | * | Heartmender joined #nim |
02:09:45 | * | Heartmender is now known as Guest35843 |
02:14:13 | * | Guest35843 quit (Client Quit) |
02:34:00 | * | ddl_smurf quit (Quit: ddl_smurf) |
02:39:26 | * | ddl_smurf joined #nim |
02:43:30 | * | fvs joined #nim |
02:44:40 | * | fvs quit (Client Quit) |
02:45:26 | * | freevryheid joined #nim |
02:45:44 | * | freevryheid quit (Client Quit) |
02:46:24 | * | fvs joined #nim |
02:46:54 | fvs | hi, howto set step in for loop? Say 2 instead of 1 |
02:49:23 | ddl_smurf | for i in 0...(count / 2): echo i * 2 |
02:54:02 | fvs | ddl_smurf, thx - neat approach |
02:54:12 | * | Heartmen- joined #nim |
02:55:07 | ddl_smurf | (should be div, apologies) |
02:55:43 | * | zds joined #nim |
02:56:09 | fvs | yep, and .. |
02:56:44 | zds | Hi gang - I'm working on my first nim script. I've hit a runtime exception that I don't really understand. I'm sure it's quite simple. |
02:59:24 | * | Heartmen- quit (Quit: EliteBNC free bnc service - http://elitebnc.org - be a part of the Elite!) |
02:59:50 | zds | I'm trying to parse arguments from the command line and docopt seems like the simplest library. I'm trying to just glob all arguments passed to the command, but this: `for t in @(args["<exp>"]):` produces a stacktrace, "list_v is not accessible" |
03:03:55 | * | merowinger joined #nim |
03:06:10 | * | merowinger left #nim (#nim) |
03:07:07 | zds | Oh, I see. The `...` is necessary in docopts to create a seq. |
03:11:26 | * | Varriount joined #nim |
03:15:58 | Varriount | Araq: Link to trimmed mingw binaries - https://drive.google.com/open?id=0B077nrrf63xtTjZHdTRNVkVENUU |
03:18:42 | * | Demon_Fox joined #nim |
03:20:58 | * | Demos_ joined #nim |
03:24:18 | * | Heartmender joined #nim |
03:24:21 | * | heretobang joined #nim |
03:24:41 | * | Heartmender is now known as Guest99705 |
03:30:59 | * | Guest99705 quit (Quit: EliteBNC free bnc service - http://elitebnc.org - be a part of the Elite!) |
03:38:42 | * | Heartmen- joined #nim |
03:43:00 | * | Heartmen- quit (Quit: EliteBNC free bnc service - http://elitebnc.org - be a part of the Elite!) |
03:52:29 | * | chemist69_ quit (Ping timeout: 250 seconds) |
03:56:42 | * | chemist69_ joined #nim |
03:57:12 | * | Heartmen- joined #nim |
04:01:06 | * | fvs quit (Quit: Leaving) |
04:01:48 | * | Heartmen- quit (Quit: EliteBNC free bnc service - http://elitebnc.org - be a part of the Elite!) |
04:10:42 | * | Guest42987 joined #nim |
04:16:09 | * | Guest42987 quit (Quit: EliteBNC free bnc service - http://elitebnc.org - be a part of the Elite!) |
04:35:39 | * | edub4rt quit (Remote host closed the connection) |
04:45:21 | * | kulelu88 quit (Quit: Leaving) |
04:47:18 | * | Heartmen- joined #nim |
04:48:15 | * | WickedShell joined #nim |
04:54:42 | * | GangstaCat quit (Quit: Leaving) |
04:59:39 | * | nsf quit (Quit: WeeChat 1.4) |
05:10:09 | * | nsf joined #nim |
05:37:56 | zds | Is anyone around? I've crashed the compiler - i'm sure I did something wrong but I'm not sure what |
05:39:52 | * | shodan45 joined #nim |
05:40:55 | * | deavmi_mobile joined #nim |
05:41:00 | * | deavmi_mobile quit (Client Quit) |
05:41:01 | * | deavmi_mobile2 joined #nim |
05:41:18 | zds | i guess not |
05:49:30 | * | nsf quit (Quit: WeeChat 1.5) |
05:56:24 | shodan45 | is "typed" the same as "typedesc"? |
05:57:24 | shodan45 | (see 3rd line of the first block of nim code from https://hookrace.net/blog/writing-a-2d-platform-game-in-nim-with-sdl2/ ) |
05:59:30 | shodan45 | ahh, nm, I found it in the docs.... it's not in the tutorial, fwiw |
06:05:51 | * | deavmi_mobile2 quit (Ping timeout: 246 seconds) |
07:21:03 | * | Demos_ quit (Ping timeout: 250 seconds) |
07:26:40 | * | mcc quit (Quit: Connection closed for inactivity) |
07:43:18 | * | Demos_ joined #nim |
07:55:17 | * | heretobang quit (Ping timeout: 250 seconds) |
08:02:57 | * | chemist69_ quit (Ping timeout: 250 seconds) |
08:05:58 | cheatfate | Varriount, welcome back, i missed you |
08:07:16 | * | chemist69_ joined #nim |
08:07:18 | cheatfate | dom96, ping |
08:16:29 | * | desophos quit (Read error: Connection reset by peer) |
08:25:12 | * | yglukhov joined #nim |
08:49:49 | * | Demos_ quit (Ping timeout: 244 seconds) |
09:03:42 | * | deavmi joined #nim |
09:04:49 | * | deavmi_mobile joined #nim |
09:05:31 | * | deavmi quit (Excess Flood) |
09:06:28 | * | deavmi joined #nim |
09:09:52 | * | chrishel_ quit (Remote host closed the connection) |
09:14:54 | * | yglukhov quit (Remote host closed the connection) |
09:35:02 | * | ics quit (Quit: Connection closed for inactivity) |
09:52:10 | * | deavmi_mobile2 joined #nim |
09:52:18 | * | deavmi_mobile quit (Read error: Connection reset by peer) |
09:58:02 | * | deavmi_mobile2 quit (Quit: Cheers all. Be good and don't do drugs.) |
09:58:13 | * | deavmi_mobile joined #nim |
10:15:40 | * | deavmi left #nim (#nim) |
10:15:54 | * | deavmi_mobile quit (Quit: Cheers all. Be good and don't do drugs.) |
10:16:04 | * | deavmi_mobile joined #nim |
10:16:26 | * | deavmi_mobile quit (Client Quit) |
10:27:46 | * | nsf joined #nim |
10:34:57 | * | WickedShell quit (Read error: Connection reset by peer) |
10:45:42 | dom96 | cheatfate: what's up? |
10:46:08 | cheatfate | ah never mind already solved my question, |
10:49:59 | * | gokr joined #nim |
10:50:51 | * | elrood joined #nim |
10:58:51 | * | onionhammer quit (Read error: Connection reset by peer) |
11:09:10 | * | ephja joined #nim |
11:13:52 | * | ephja quit (Client Quit) |
11:18:37 | * | arnetheduck quit (Remote host closed the connection) |
11:25:15 | * | GangstaCat joined #nim |
11:25:46 | * | themagician quit (Ping timeout: 252 seconds) |
11:26:41 | * | themagician joined #nim |
11:32:45 | * | abruanese quit (Ping timeout: 260 seconds) |
11:33:11 | * | themagician quit (Ping timeout: 240 seconds) |
11:35:53 | * | themagician joined #nim |
11:36:09 | * | GangstaCat quit (Ping timeout: 260 seconds) |
11:36:47 | * | GangstaCat joined #nim |
11:47:16 | * | kingofoz quit (Ping timeout: 264 seconds) |
11:48:01 | * | kingofoz joined #nim |
11:50:08 | * | M-Flox is now known as Flox42 |
11:55:30 | * | gokr quit (Ping timeout: 246 seconds) |
12:10:31 | * | deavmi_mobile joined #nim |
12:10:49 | * | deavmi_mobile quit (Client Quit) |
12:14:32 | * | chemist69_ quit (Ping timeout: 258 seconds) |
12:16:54 | * | chemist69_ joined #nim |
12:18:20 | * | freezerburnV joined #nim |
12:24:05 | * | deavmi joined #nim |
12:24:31 | * | themagician quit (Ping timeout: 240 seconds) |
12:25:36 | * | themagician joined #nim |
12:32:50 | * | themagician quit (Ping timeout: 260 seconds) |
12:41:37 | * | edub4rt joined #nim |
12:44:00 | * | PMunch joined #nim |
12:45:20 | * | freezerburnV quit (Ping timeout: 272 seconds) |
13:00:14 | * | freezerburnV joined #nim |
13:10:34 | * | chrisheller joined #nim |
13:15:13 | * | chrisheller quit (Ping timeout: 252 seconds) |
13:15:33 | * | Sentreen joined #nim |
13:20:39 | * | mcc joined #nim |
13:27:12 | * | nsf quit (Quit: WeeChat 1.5) |
13:40:58 | edub4rt | I am having trouble trying to use a HashSet with a ref object, I get errors of type mismatch for proc hash(), how do I use HashSet with ref objects? |
13:42:38 | edub4rt | I have A = ref object and myset: HashSet[A], I do initialize it, then when trying to do myset.incl(a) I get error that no hash() proc is defined from A |
13:42:56 | * | yglukhov joined #nim |
13:43:33 | edub4rt | so I tried do the same way that I found in examples in the sources, "proc hash*(x: A): Hash {.borrow.}" |
13:43:56 | edub4rt | but gives me another error "no borrow symbol found" |
13:46:32 | * | yglukhov quit (Remote host closed the connection) |
13:46:46 | * | yglukhov joined #nim |
13:47:16 | * | Sentreen quit () |
13:50:08 | edub4rt | nvm doing "proc hash*(x: Peer): Hash = hash(cast[pointer](x))" worked |
14:12:13 | * | deavmi_mobile joined #nim |
14:18:48 | * | akaisora_ joined #nim |
14:19:59 | * | GangstaCat quit (Read error: Connection reset by peer) |
14:20:56 | * | chemist69_ quit (Ping timeout: 250 seconds) |
14:21:47 | * | jortiz7 joined #nim |
14:21:56 | * | jortiz7 quit (Client Quit) |
14:22:25 | * | akaisora_ quit (Read error: Connection reset by peer) |
14:24:14 | * | chemist69_ joined #nim |
14:38:46 | * | akaisora_ joined #nim |
14:44:45 | * | akaisora_ quit (Ping timeout: 276 seconds) |
14:45:33 | * | PMunch quit (Ping timeout: 240 seconds) |
14:45:42 | Araq_ | yeah .borrow is quite broken in the compiler |
14:45:56 | Araq_ | and since it doesn't do anything hard, I may even remove it from the language |
14:47:02 | * | euantor joined #nim |
14:48:47 | * | yglukhov quit (Read error: Connection reset by peer) |
14:49:16 | euantor | Any ideas why this doesn't work: `const stringTrimChars: set[char] = strutils.Whitespace + '=' + 'v'` |
14:49:23 | * | yglukhov joined #nim |
14:49:32 | euantor | Error: type mismatch: got (set[char], char) |
14:49:32 | euantor | but expected one of: |
14:49:32 | euantor | proc `+`(x, y: float32): float32 |
14:49:34 | euantor | proc `+`(x, y: int32): int32 |
14:49:36 | euantor | proc `+`(x, y: int16): int16 |
14:49:38 | euantor | proc `+`(x, y: float): float |
14:49:40 | euantor | proc `+`(x: int32): int32 |
14:49:42 | euantor | proc `+`(x: int8): int8 |
14:49:44 | euantor | proc `+`[T: SomeUnsignedInt](x, y: T): T |
14:49:46 | euantor | proc `+`(x, y: int64): int64 |
14:49:48 | euantor | proc `+`(x: float): float |
14:49:50 | euantor | proc `+`(x, y: int8): int8 |
14:49:52 | euantor | proc `+`(x, y: int): int |
14:49:54 | euantor | proc `+`[T](x, y: set[T]): set[T] |
14:49:56 | euantor | proc `+`(x: int64): int64 |
14:49:58 | euantor | proc `+`(x: int16): int16 |
14:50:00 | euantor | proc `+`(x: int): int |
14:50:02 | euantor | proc `+`(x: float32): float32 |
14:51:10 | deavmi_mobile | set[char] |
14:51:25 | deavmi_mobile | is that a set or array that can contain values if type char? |
14:51:43 | euantor | It's a built in set: http://nim-lang.org/docs/manual.html#types-set-type |
14:51:55 | euantor | The docs make it seem like the `+` operator should just work |
14:52:18 | euantor | Whitespace is defined here: https://github.com/nim-lang/Nim/blob/master/lib/pure/strutils.nim#L33 |
14:54:51 | sdw | what if you change your character literals into sets? |
14:55:27 | euantor | Yep, that works |
14:55:33 | sdw | strutils.Whitespace + { '=', 'v' } |
14:55:42 | euantor | Seems odd |
14:55:55 | euantor | That works perfectly, it's just not very clear |
14:56:15 | euantor | Looking at the error message, it is actually stated in the output too |
14:56:21 | sdw | the documentation says you can also use incl |
14:56:59 | euantor | Yeah, but not with a constant, as it takes a var parameter |
14:57:03 | sdw | eh, that looks like a statement rather than an expression though |
14:57:12 | sdw | yeah, nevermind |
14:57:51 | Araq_ | it's perfectly clear: proc `+`[T](x, y: set[T]): set[T] |
14:58:00 | Araq_ | both x and y have to be sets to begin with. |
14:59:03 | sdw | what he really wants is incl that acts like the + expression |
14:59:10 | sdw | I think that makes sense |
14:59:16 | Araq_ | there is no proc `+`[T](x: set[T], y: T): set[T] |
15:01:12 | * | PMunch joined #nim |
15:02:11 | euantor | Yeah, I just wasn't reaidn the error properly Araq_ |
15:02:23 | euantor | My fault for trying to watch the F1 and write code at the same time ;) |
15:02:29 | euantor | *reading |
15:03:28 | Araq_ | sdw: it makes sense but meh, that means 4 more + - procs in system.nim that are hardly ever used |
15:03:53 | Araq_ | for consistency then proc `+`[T](x: T, y: set[T]): set[T] |
15:03:59 | Araq_ | needs to be supported too |
15:04:07 | Araq_ | and the same for `-` |
15:04:12 | euantor | Maybe it's a case of adding some examples to the documentation? |
15:04:18 | sdw | yeah, either way |
15:04:28 | Araq_ | and why stop there? consistency demands * should also be supported ... |
15:04:54 | Araq_ | euantor: yeah, sure. PRs welcome :-) |
15:05:41 | sdw | are sets of sets supported? |
15:06:02 | Araq_ | no :-) |
15:06:28 | * | euantor quit (Remote host closed the connection) |
15:06:39 | sdw | then I think what you just suggested would be a win |
15:07:06 | Araq_ | bloating system.nim even moreso ain't a win |
15:07:12 | sdw | proc `+`[T](x: T, y: set[T]): set[T] |
15:07:13 | sdw | that one |
15:07:50 | sdw | does set require compiler magic? |
15:08:24 | Araq_ | proc `+`[T](x: T, y: set[T]): set[T] = {x}+y # no magic required |
15:08:54 | Araq_ | but meh, let's not be overly sloppy with our types. |
15:09:10 | Araq_ | when everything is a valid interpretation, no bugs can be detected. |
15:10:24 | sdw | I think it depends a lot of personal taste. Do you tend to prefer being explicit? |
15:11:07 | Araq_ | yes, for uncommon operations. and x+set is uncommon. |
15:11:37 | * | euantor joined #nim |
15:11:41 | euantor | Araq_ Okay, that's what I'll do |
15:11:49 | Araq_ | and "uncommon" is not a question of personal taste, though it can be a question of personal style. |
15:23:17 | * | PMunch quit (Ping timeout: 260 seconds) |
15:23:29 | zds | I'm trying to write a proc that will convert a float to a string - optionally rendering it as an int if it's divisible by 1. And I can't seem to get the types to line up. |
15:25:36 | zds | I have a converter like this - http://pastebin.com/PNQh1HNt but the stack overflows on the base case because it overrides $ entirely. But I can't figure out how to write a function that takes a float and sometimes returns a float, sometimes returns an int. |
15:25:57 | Araq_ | zds: parseutils.parseFloat and strutils.parseFloat exist, I hope you know that |
15:26:38 | Araq_ | don't name your converter `$` that's pure obfuscation of what happens |
15:26:41 | zds | I know about the latter... But I'm trying to move in the opposite direction. I will look at the former |
15:26:53 | zds | (this is only my second day using Nim so I apologize for the beginner questions) |
15:27:04 | Araq_ | converter floatToStr(n: float): string = ... |
15:27:17 | Araq_ | avoids the recursion too. |
15:27:41 | zds | Ah ok, I was calling it `$` so I could take advantage of the `$` call in proc join(T not string) |
15:28:04 | Araq_ | well then don't use a converter, but a proc `$` |
15:28:18 | Araq_ | and in your $, you call system.`$` to avoid the recursion |
15:29:36 | zds | ah, I didn't realize i could namespace like that |
15:30:27 | zds | Thanks Araq_ that clears it up! |
15:30:30 | Araq_ | but it's all pretty horrible :P and perhaps you should do proc `&`(s: string; f: float): string = s & myFloatToStr(f) instead |
15:31:01 | Araq_ | since string&float is not already predeclared |
15:31:30 | zds | Hm. I don't think I've seen `&` at all yet. I'll look it up |
15:36:00 | zds | So I'd basically reduce that instead of using join? |
15:38:53 | Araq_ | depends entirely on what you need to accomplish |
15:39:08 | * | Jesin joined #nim |
15:41:15 | * | yglukhov quit (Remote host closed the connection) |
15:43:28 | deavmi | zds: When you use `$` is that to override the operator's execution but relate to it as a proc? |
15:43:34 | deavmi | zds: the backticks |
15:44:23 | zds | I suppose so... I assumed since it was an operator I had to use the backticks. |
15:44:50 | euantor | Yeah, backticks are required for operators I thought |
15:45:08 | deavmi | euantor: Just asking, thnaks. :) |
15:45:10 | deavmi | zds: thanks |
15:46:15 | * | Dove_ joined #nim |
15:47:34 | * | Dove_ left #nim (#nim) |
15:47:50 | * | Dove_ joined #nim |
15:48:21 | * | Dove_ left #nim (#nim) |
15:50:45 | * | mostworst joined #nim |
15:56:20 | * | Araq_ is now known as Araq |
15:57:39 | zds | I guess I'm still confused about how to create values of potentially different types. I'm making a little desk calendar. I have an Operator enum, which works well, except some operators are binary, some are unary - so in my proc that evaluates an operator, I have to check whether the operator is in one set or the other, and maintain the sets. So I was |
15:57:39 | zds | thinking I'd make separate enums - UnaryOperator, BinaryOperator, et cetera. But then what would the signature be of my function that takes a string and figures out what kind of Operator it should be, and returns that particuar value? |
15:59:03 | zds | I thought I'd use an ADT for that, but I think that's definitely wrong. |
16:04:04 | * | philo joined #nim |
16:04:19 | * | mahasamoot joined #nim |
16:05:17 | * | nexdev9 joined #nim |
16:05:33 | * | nexdev9 left #nim (#nim) |
16:20:52 | * | mostworst quit (Ping timeout: 264 seconds) |
16:28:18 | sdw | what do you guys use for debugging in nim? |
16:31:27 | def- | sdw: echo, writeStacktrace, gdb |
16:35:12 | * | mostworst joined #nim |
16:40:20 | * | yglukhov joined #nim |
16:44:46 | * | yglukhov quit (Ping timeout: 252 seconds) |
16:49:08 | Varriount | cheatfate: Good to be back. Sorry for the absense, a lot of like-stuff occurred, and Nim kinda fell by the wayside. |
16:53:27 | deavmi | Varriount: ello o/ |
16:56:54 | * | ddl_smurf quit (Quit: ddl_smurf) |
16:57:23 | * | ddl_smurf joined #nim |
16:58:30 | Varriount | Hi deavmi |
16:59:54 | * | euantor quit (Remote host closed the connection) |
17:02:21 | dom96 | hey Varriount! How's things? |
17:02:44 | Varriount | dom96: Busy. |
17:06:36 | * | gokr joined #nim |
17:07:33 | * | euantor joined #nim |
17:07:35 | * | mostworst quit (Ping timeout: 260 seconds) |
17:07:36 | * | euantor quit (Remote host closed the connection) |
17:07:47 | sdw | type Vector[T, N : int] = array[0..N, T]; should it be possible to do this sort of thing? |
17:07:52 | * | euantor joined #nim |
17:10:29 | def- | array[N, T] is already what you want, but yes, should be possible |
17:10:50 | def- | make that a ; between T and N though, otherwise T is also int |
17:11:04 | Varriount | dom96: Spammer on the forum again. |
17:11:22 | def- | sdw: and use static[int] |
17:11:24 | dom96 | whoa |
17:11:45 | Varriount | This might require an IP ban. |
17:12:00 | Varriount | Or possibly a flamethrower. |
17:12:56 | * | deavmi_laptop joined #nim |
17:14:26 | dom96 | Looks like it's time to implement a "Remove all threads created by user <x>" feature. |
17:15:06 | Varriount | And possibly a rate-limiter on the number of threads a user can create in a given time period |
17:15:25 | dom96 | yeah... a bit more difficult to implement though :\ |
17:16:09 | * | MarkShultz joined #nim |
17:17:27 | * | euantor quit (Remote host closed the connection) |
17:18:34 | sdw | def-: thanks |
17:19:13 | sdw | should it be possible to use varargs as generic parameters? type Tensor[T; varargs[int]] = ...? |
17:20:53 | sdw | I suppose not. the docs seems to indicate varargs is more of a runtime thing |
17:21:18 | * | MarkShultz quit (Ping timeout: 250 seconds) |
17:23:13 | cheatfate | dom96, i think it will be easier to ban his ips using firewall |
17:23:33 | dom96 | cheatfate: ooh, good idea. |
17:26:08 | Varriount | dom96: There are still some spam threads left, just in case you missed them (since they continued well into the next forum page) |
17:29:15 | edub4rt | I want to do a small metaprogramming in nim, but don't know how yet |
17:29:43 | edub4rt | I have `proc dosomething() {.async.} = echo "hello"` in my code and generally call this function using `asyncCheck dosomething` |
17:29:53 | edub4rt | what I want is to compact both lines into this, `doasync: echo "hello"`, so doasync here would create a proc with every code that is inside the next block then call it with asyncCheck |
17:29:56 | * | abruanese joined #nim |
17:30:20 | edub4rt | can someone give me tips if is possible and how should I use do it? |
17:30:32 | edub4rt | what should I use to do it?* |
17:30:35 | def- | edub4rt: sounds like you need a macro doasync that takes a stmt paramater, parses it and creates a new AST |
17:31:26 | Varriount | edub4rt: Could you give a more extended example (possibly via gist or pastebin)? |
17:33:44 | edub4rt | Varriount: http://pastebin.com/47ki9JUt |
17:34:20 | edub4rt | def-: okay so I will look into that, is there some manual on how the AST works? |
17:42:02 | edub4rt | the idea is simple, it's just a shortcut for creating a proc and then call it with asyncCheck |
17:42:15 | Varriount | edub4rt: I think this should work. I can't remember what asyn modules needs to be imported. |
17:42:17 | Varriount | https://gist.github.com/Varriount/94eb49206bd6268e48d042b4c1f63108 |
17:43:55 | edub4rt | import asyncdispatch |
17:44:04 | edub4rt | gonna try |
17:44:18 | cheatfate | edub4rt, usage of asyncCheck is a little bit hacky, just if you don't call poll() you will not receive callback from `immediately completed` futures |
17:44:52 | edub4rt | cheatfate, I'm aware of that |
17:45:28 | cheatfate | ok then |
17:46:59 | edub4rt | Varriount: got errors, "Error: type mismatch: got (void); but expected one of: template doAsync(name: expr; body: untyped): untyped" |
17:47:06 | * | renesac joined #nim |
17:47:53 | edub4rt | but I'm going to continue working on what you gave me |
17:49:35 | * | renesac_ quit (Ping timeout: 260 seconds) |
17:55:13 | def- | edub4rt: http://nim-lang.org/docs/macros.html https://hookrace.net/blog/introduction-to-metaprogramming-in-nim/#macros |
17:56:21 | * | Trustable joined #nim |
17:56:49 | dom96 | edub4rt: def-: I think you might be able to do that with a template. |
17:57:05 | dom96 | Although the immediate nature of the 'async' macro may be problematic. |
17:57:08 | edub4rt | almost got it working like I want with template, but it's possible with macros too, although I think it would be much complex |
17:57:57 | * | euantor joined #nim |
18:00:21 | def- | dom96: oooh, i totally misunderstand what he was trying to do |
18:01:58 | def- | edub4rt: is this what you want? https://gist.github.com/def-/59dee63d884775ff3e032674c226f310 |
18:02:08 | cheatfate | guys is it possible to convert NimTypeKind nty constant to string? i mean `ntyInt8` to `int8` |
18:02:13 | * | nsf joined #nim |
18:02:17 | * | sdw left #nim (#nim) |
18:04:01 | Varriount | edub4rt: Updated and fixed. |
18:04:53 | edub4rt | exactly, both worked now =) |
18:05:49 | edub4rt | so cool that we have the flexibility to do that |
18:08:00 | Varriount | edub4rt: If you have any questions on how it works, feel free to ask. |
18:11:40 | Varriount | def-: Hm. Is the immediate pragma needed? |
18:12:11 | edub4rt | from what I read in the manual just now it's not needed |
18:12:27 | Varriount | "Explicit immediate templates are about to be deprecated in later versions of the compiler." |
18:12:46 | * | TheLemonMan joined #nim |
18:12:50 | edub4rt | I understood how it works, just wondering now if if the name parameter could be optinal, then the template would generate a random proc name |
18:12:55 | * | dom96 wonders what the alternative to immediate is |
18:13:02 | dom96 | is there any docs for this deprecation? |
18:14:56 | Varriount | dom96: Just a mention in the manual. |
18:15:00 | edub4rt | I mean not random, but choose a unique proc name for itself, maybe based on the context, maybe randomly, but I am afraid that would require the use of macros then |
18:17:24 | Varriount | edub4rt: Updated my gist, added a version of the template that doesn't need a name. |
18:20:15 | Varriount | The procedure will have a randomly generated name, however generated stack traces will point to the template, I think. |
18:20:21 | edub4rt | Varriount: the problem with using a fixed name is that calling doAsync two times gives and error of redefinition |
18:20:28 | * | euantor quit (Remote host closed the connection) |
18:21:01 | edub4rt | but I just thought, adding a "block:" before defining it should work |
18:21:20 | Varriount | edub4rt: That's why I added the version that doesn't take a name. |
18:21:24 | Varriount | That will always work. |
18:25:27 | Varriount | edub4rt: It's possible to make a unique but sensible name using a macro, and the macros module. |
18:26:25 | edub4rt | this will work already fine, thanks for the help Varriount |
18:26:29 | Varriount | Something along the lines of `ident(name & toStrLit(genSym()))` |
18:28:06 | * | ekarlso- quit (Changing host) |
18:28:06 | * | ekarlso- joined #nim |
18:28:16 | * | euantor joined #nim |
18:41:21 | * | ddl_smurf_ joined #nim |
18:41:53 | * | vendethiel- joined #nim |
18:42:25 | * | yglukhov joined #nim |
18:44:38 | * | devn joined #nim |
18:45:06 | Araq | no, just use genSym() |
18:45:32 | * | zama_ joined #nim |
18:47:49 | * | yglukhov quit (Ping timeout: 260 seconds) |
18:47:55 | * | jackkv joined #nim |
18:47:59 | * | OnO joined #nim |
18:48:03 | * | ^GaveUp^ joined #nim |
18:50:07 | * | ddl_smurf quit (*.net *.split) |
18:50:07 | * | vendethiel quit (*.net *.split) |
18:50:07 | * | taotetek quit (*.net *.split) |
18:50:07 | * | federico3 quit (*.net *.split) |
18:50:07 | * | lyro quit (*.net *.split) |
18:50:07 | * | CcxCZ quit (*.net *.split) |
18:50:07 | * | devn_ quit (*.net *.split) |
18:50:07 | * | zama quit (*.net *.split) |
18:50:07 | * | OnO_ quit (*.net *.split) |
18:50:07 | * | jackv quit (*.net *.split) |
18:50:08 | * | GaveUp quit (*.net *.split) |
18:50:08 | * | EastByte quit (*.net *.split) |
18:50:10 | * | ddl_smurf_ is now known as ddl_smurf |
18:50:46 | * | zama_ quit (Changing host) |
18:50:46 | * | zama_ joined #nim |
18:50:56 | * | zama_ is now known as zama |
18:50:59 | * | Pisuke joined #nim |
18:53:03 | * | MyMind quit (Ping timeout: 276 seconds) |
18:53:11 | * | renesac quit (Ping timeout: 240 seconds) |
18:54:44 | * | ^GaveUp^ quit (Quit: You're a bloody puppet!) |
18:55:04 | * | GaveUp joined #nim |
18:55:57 | cheatfate | Araq, is it possible to convert NimTypeKind nty constant to string? i mean `ntyInt8` to `int8` |
18:56:17 | * | EastByte joined #nim |
18:56:33 | Araq | use some repr proc? |
18:56:34 | * | lyro joined #nim |
18:56:50 | * | federico3 joined #nim |
18:57:10 | * | taotetek joined #nim |
18:57:31 | * | taotetek is now known as Guest73865 |
18:57:59 | cheatfate | so make it by yourself? :) |
18:58:00 | * | CcxCZ joined #nim |
18:58:35 | * | mostworst joined #nim |
19:11:20 | * | Sembei joined #nim |
19:12:03 | * | Varriount quit (Disconnected by services) |
19:12:03 | * | Varriount_ joined #nim |
19:12:43 | * | Pisuke quit (Ping timeout: 252 seconds) |
19:13:45 | * | polypus74 joined #nim |
19:17:33 | * | chrisheller joined #nim |
19:28:16 | * | deavmi quit (Ping timeout: 250 seconds) |
19:30:24 | * | akaisora_ joined #nim |
19:33:20 | * | polypus71 joined #nim |
19:33:32 | * | mostworst quit (Ping timeout: 260 seconds) |
19:34:51 | * | polypus74 left #nim ("ERC (IRC client for Emacs 24.5.1)") |
19:36:04 | * | Varriount joined #nim |
19:39:51 | * | Varriount_ quit (Ping timeout: 276 seconds) |
19:41:48 | polypus71 | ignore, testing client |
19:46:39 | * | euantor quit (Remote host closed the connection) |
19:47:10 | * | mostworst joined #nim |
19:47:11 | * | yglukhov joined #nim |
19:56:56 | * | lazypenguin quit (Quit: Leaving) |
20:03:36 | * | itnex joined #nim |
20:10:23 | * | chrisheller quit (Remote host closed the connection) |
20:11:33 | * | mostworst quit (Ping timeout: 240 seconds) |
20:11:42 | * | chrisheller joined #nim |
20:20:33 | * | Salewski joined #nim |
20:21:33 | * | Demon_Fox quit (Read error: Connection reset by peer) |
20:22:07 | * | desophos joined #nim |
20:26:44 | * | Salewski quit () |
20:28:21 | zds | Would anybody be willing to do some code review on my first project? I'm sure the code is completely unidiomatic and missing the point of how to do things, but I'd love some specific feedback. |
20:29:18 | dom96 | zds: sure, give us a link :) |
20:29:32 | zds | Thanks! https://github.com/subsetpark/ad |
20:29:52 | zds | I'll add a few more docstrings... |
20:32:02 | dom96 | https://github.com/subsetpark/ad/blob/master/ad.nim#L1 const would be better here |
20:32:14 | dom96 | Also I would put it below the imports and type defs |
20:33:39 | dom96 | These you should define as a set by just replacing [] with {}. |
20:33:40 | dom96 | https://github.com/subsetpark/ad/blob/master/ad.nim#L29 |
20:33:46 | Araq | also we changed 'split' so that's now useless but consistent |
20:34:07 | Araq | seriously. I think I will remove this again. it annoys me so much. |
20:34:15 | Araq | *revert |
20:34:59 | Araq | who cares if it is "consistent" when it doesn't do what people want it to do? |
20:35:16 | dom96 | Araq: hrm? |
20:35:25 | dom96 | where is this coming from? |
20:35:32 | Araq | let tokens = input.split() |
20:35:41 | Araq | from zds' code. |
20:36:06 | dom96 | what's wrong with that? |
20:36:21 | zds | Thanks dom96 - w/r/t to L29, you think that's a generally sane way of doing it? Given that it should be a set not a list (makes total sense, very Pythonic) - that it's reasonable to define the sets in that manner and use that as the technique to determine what type of operator to use? |
20:36:22 | dom96 | what do sets have to do with zds' usage of that? |
20:36:57 | Araq | 12 34 + # note the 2 spaces. old split returns "12" "34" "+" |
20:37:04 | dom96 | zds: yeah, I think sets are more efficient in this case. |
20:37:12 | zds | Ah - but sets seem to require ordinal types. |
20:37:18 | Araq | new split returns "12" "" "34" "+" |
20:37:18 | zds | (I had tried sets at first) |
20:37:41 | dom96 | Araq: yeah, and that makes perfect sense. |
20:37:51 | dom96 | it's easy to ignore "" |
20:37:59 | Araq | it's not. |
20:38:03 | dom96 | it's impossible to get this information back though |
20:38:12 | Araq | so fucking what. |
20:38:17 | dom96 | Araq: how is it not? |
20:38:19 | Araq | it's not useful information. |
20:38:31 | Araq | and you can always use a real parser |
20:38:32 | dom96 | in some cases it is |
20:38:46 | Araq | or use the split that uses chars/strings |
20:41:13 | zds | dom96: Given that sets only work for ordinal types, do you think it makes sense to hash the token strings in the sets, and then get the hash of the tokens that we're testing? |
20:41:56 | Araq | zds: excuse my swear words but I'm arguing your code is beautiful and we're changing the stdlib to be worse |
20:42:19 | zds | Understood. I'll take them as a ringing endorsement. |
20:42:59 | zds | For what it's worth, I agree with you, but only because I'm a Python programmer and don't know any better. |
20:43:00 | dom96 | zds: oh, hrm. I would just have a Token enum, then just write: binaryTokens = {plus, minus, ...} |
20:43:15 | dom96 | You can then even encode the string in the enum IIRC |
20:43:44 | zds | That makes sense. I just don't know (yet) how to get from a string to the enum that represents it |
20:43:57 | dom96 | or just write a `proc `$`(token: Token): string` |
20:44:09 | Araq | dom96: yeah but that's the charm of his/her solution really, that it uses multiple enums and gets somewhat more type safety |
20:44:33 | dom96 | zds: case str: of "+": plus; of "-": minus ... |
20:45:07 | Araq | zds: biggest issue with your code is that you use 'except IndexError:' which is only valid code in debug mode |
20:45:12 | dom96 | True. Don't listen to me, Araq is right :) |
20:45:25 | zds | Ah! I didn't know |
20:45:29 | zds | I should raise my own exception? |
20:45:50 | zds | I actually had tried defining a custom exception, but I didn't get the syntax right and didn't want to spend too much time on it |
20:46:02 | Araq | well your code shouldn't access the seq out of bounds |
20:46:45 | Araq | use an 'if' instead of a 'try' |
20:46:48 | zds | True. In fact it shouldn't; I'm raising an IndexError manually if I detect there aren't enough elements on the stack to push a binary operation. Which is almost certainly a misuse of IndexError and deserves its own exception |
20:47:13 | * | euantor joined #nim |
20:47:21 | Araq | no, proc peek relies on Nim's IndexError |
20:47:27 | zds | ah |
20:47:52 | Araq | which the spec also allows to trigger an abort() |
20:48:03 | zds | oh I see - so stack[stack.high] is falsey if it's empty? |
20:48:50 | zds | or I should just manually check for stack before doing any of it |
20:48:56 | Araq | the latter. |
20:49:06 | Araq | proc ingest begs for a 'var' parameter |
20:49:27 | Araq | proc ingest(stack: var Stack; t: string) = ... |
20:49:58 | Araq | ingestLine does use that, hmmm |
20:51:33 | * | euantor quit (Ping timeout: 240 seconds) |
20:51:46 | zds | Yeah, so here was my thinking - all the stack management procs had var operators. But that would get me into a state where, if you had a line with an invalid call somewhere in the middle of it, it would fail... And I would catch that, but not before mutating the stack with the beginning of the line. |
20:52:19 | zds | So I figured it made more sense to use immutable arguments and copy by value until I could actually be sure that the whole line executed correctly, and then mutate. |
20:54:30 | zds | In othr words, if you are trying to process "1 +", you don't want to end up with 1.0 on the stack. |
20:54:43 | Araq | ok, I think you can accomplish the same with an index and only at the end update the stack a la stack.setLen(idx) |
20:56:09 | Araq | but whatever, I don't think the efficiency really matters all that much |
20:56:32 | zds | Wouldn't you still end up having lost data in the opposite case, if you had something on the stack already, and you tried to input a line that began with an operation and then had some invalid input further on? |
20:56:37 | * | euantor joined #nim |
20:57:14 | zds | Not trying to argue - the semantics are just obviously new to me so I'm presuming a lot of ignorance of how things are handled |
20:57:49 | * | Matthias247 joined #nim |
20:58:08 | Araq | not sure if that can actually cause problems |
20:58:23 | Araq | the setLen() would throw away the wrong value |
20:58:39 | Araq | https://github.com/subsetpark/ad/blob/master/ad.nim#L129 is obviously redundant |
20:59:52 | zds | Yes, I had a lot of trouble with that proc. I'd love some elaboration because I hate how it came out but it's not obvious how I should be structuring it |
21:01:16 | * | ics joined #nim |
21:01:43 | zds | oh, or are you referring to the result = result line? |
21:02:48 | * | euantor quit () |
21:02:51 | Araq | yes |
21:03:00 | Araq | just remove that line and the 'else' |
21:03:02 | zds | Ah ok yes - that's more obvious :) |
21:17:52 | * | mostworst joined #nim |
21:22:34 | * | mahasamoot quit (Ping timeout: 250 seconds) |
21:24:03 | cheatfate | Araq, is it possible to make sequence of chars with something like @[], like with `int` @[1, 2, 3]? |
21:24:31 | * | philo quit (Ping timeout: 244 seconds) |
21:24:32 | zds | newSeq[char]()? |
21:25:46 | cheatfate | zds, of course :) but nim has construction @[1, 2, 3] which converts array of [1, 2, 3] to seq[int] |
21:26:35 | def- | cheatfate: @['a','b','c']? |
21:26:43 | cheatfate | yep thanks |
21:27:39 | * | chemist69_ quit (Ping timeout: 260 seconds) |
21:27:53 | * | Salewski joined #nim |
21:28:44 | * | Salewski quit (Client Quit) |
21:29:29 | zds | ah, i understand. thank you |
21:32:03 | * | chemist69_ joined #nim |
21:32:50 | Varriount | dom96: Spammer is back |
21:34:06 | Varriount | Araq: You have forum admin priviledges too, so I think you can delete the posts as well. |
21:36:23 | Araq | that "delete all" feature surely is handy :-) |
21:36:42 | zds | I guess my last question is... How do I deal with float overflows? It seems like the float type already maps to the largest float available, but even that overflows relatively quickly. Is there a different type available for very large numbers? |
21:38:13 | def- | zds: do you need big float numbers or big integer numbers? there are gmp wrappers and nim-bigints |
21:38:51 | * | Fin104 joined #nim |
21:38:57 | zds | Big floats... I'll look into gmp |
21:40:02 | polypus71 | is there currently a decent websocket server implementation for a low traffic site? |
21:40:07 | dom96 | Varriount: Araq: Did he manage to post much? |
21:40:32 | dom96 | polypus71: https://github.com/niv/websocket.nim |
21:40:47 | dom96 | Very barebones but works pretty well for my game so far. |
21:40:55 | * | Fin105 joined #nim |
21:41:22 | polypus71 | cool, hoe msny players on at a time? |
21:41:26 | polypus71 | *how* |
21:41:29 | Varriount | dom96: A page and a half of posts. |
21:41:31 | polypus71 | *many* |
21:41:48 | dom96 | polypus71: haven't tested it that far yet :) |
21:41:52 | * | akaisora_ quit (Ping timeout: 258 seconds) |
21:42:09 | polypus71 | dom: is the code public? |
21:42:13 | dom96 | Varriount: awww, maybe I need to make rate limiting even more strict. |
21:42:16 | dom96 | polypus71: afraid not |
21:42:17 | * | Fin107 joined #nim |
21:42:25 | polypus71 | k ty |
21:42:49 | Varriount | dom96: He posted roughly 2 per minute, for 20 minutes. |
21:43:21 | Varriount | I'll never understand what people get out of something like this. |
21:43:39 | dom96 | Varriount: oh well, better than no rate limiting at all. |
21:43:56 | Varriount | I can sorta understand the perverse pleasure of starting arguments on reddit and the like, but this doesn't even garner any real feedback. |
21:44:26 | * | akaisora joined #nim |
21:44:40 | * | LetisTalkDom joined #nim |
21:44:50 | gokr | Araq: Just compiled your ui stuff and got it working on Ubuntu (controlgallery, histogram) - nice! |
21:46:35 | * | Fin104 quit (Quit: Page closed) |
21:46:40 | * | Fin105 quit (Quit: Page closed) |
21:46:44 | Varriount | dom96: I'm thankful for the forum's email-thread-updates feature, as that's what's been notifying me of the spam topics. |
21:46:44 | * | Fin107 quit (Client Quit) |
21:46:59 | Varriount | (Nothing like getting an inbox full of junk posts) |
21:47:03 | * | Trustable quit (Remote host closed the connection) |
21:47:40 | polypus71 | the more i see the more i like this language |
21:48:37 | Varriount | It's certainly more readable than many other languages. |
21:49:34 | * | LetisTalkDom quit (Quit: Page closed) |
21:50:06 | * | TheLemonMan quit (Quit: "It's now safe to turn off your computer.") |
21:50:25 | polypus71 | performance, metaprogramming, static typing all in one is what gets me. syntax is a bonus |
21:50:43 | dom96 | polypus71: Glad you like it! :) |
21:50:52 | polypus71 | :) |
21:51:05 | dom96 | Varriount: hehe, I just have gmail put it in some folder that I never look at. |
21:55:56 | * | WickedShell joined #nim |
21:56:35 | Varriount | Syntax is a big thing for me. If I'm going to be writing a program, I don't want to have to keep re-deciphering what's going on (although this may just be indicative of my small amount of ability/experience as a programmer) |
21:59:44 | dom96 | bbl |
22:04:34 | * | mostworst quit (Ping timeout: 272 seconds) |
22:25:05 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
22:44:12 | * | yglukhov quit (Remote host closed the connection) |
22:51:41 | * | mahasamoot joined #nim |
22:54:06 | * | philo joined #nim |
22:57:59 | * | Matthias247 quit (Read error: Connection reset by peer) |
23:00:23 | edub4rt | I am having trouble with a simple task, I want to implement a proc for fletcher16 checksum in nim, but with two requirements, first that that the proc can't make an extra copy, second that I can pass slice of an array to the proc |
23:00:49 | edub4rt | I went to the wiki and copied the straightforward version of the C code: https://en.wikipedia.org/wiki/Fletcher%27s_checksum |
23:01:28 | edub4rt | used c2nim but doesnt compile |
23:03:03 | * | bjz joined #nim |
23:03:05 | edub4rt | and I'm trying to fix, but currently I am not able to iterate over the array in nim (its a pointer) |
23:03:37 | Demos | just cast the pointer to a ptr array[10000000, T] |
23:03:50 | Demos | or a ptr array[1,T] {.unchecked.} |
23:05:30 | cheatfate | edub4rt, check lib/collections/rtarrays.nim, don't use it, but this is good example |
23:05:31 | edub4rt | hmm.. I didn't know that hack |
23:10:05 | * | deavmi_mobile quit (Read error: Connection reset by peer) |
23:13:27 | Araq | proc slicesAreNotHardEitherWay(x: openArray[int]; first, length: int) |
23:15:09 | * | deavmi_mobile joined #nim |
23:15:23 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
23:18:35 | cheatfate | dom96, some monthes ago you not accepted my withTimeout variant, you just say why we need withTimeout if we have or sleepAsync() |
23:19:59 | cheatfate | this is discrimination !!! :D |
23:21:12 | * | mahasamoot quit (Ping timeout: 272 seconds) |
23:22:19 | * | gokr quit (Ping timeout: 244 seconds) |
23:22:33 | * | philo quit (Ping timeout: 246 seconds) |
23:28:39 | edub4rt | haha cheatfate, he hardly accepted mine too |
23:29:59 | cheatfate | be careful in usage of sleepAsync() you will get like -12% speed |
23:34:04 | edub4rt | =( what is wrong with it? |
23:36:35 | Sembei | I'm getting this error trying to install nimble on os x http://hastebin.com/ipujujiqeq.csh |
23:36:54 | cheatfate | i thought it was epochTime() but i have made benchmarks `epochTime() vs gettimeofday()` --- and got equal results, so i don't know |
23:37:54 | cheatfate | Sembei, our lovely MacOS maintainer is currently sleeping |
23:38:07 | Sembei | >_> |
23:38:41 | Sembei | cheatfate: actually that part is unix |
23:39:17 | * | elrood quit (Quit: Leaving) |
23:40:07 | cheatfate | Sembei, you can check here https://github.com/nim-lang/nimble/issues, or even create a new issue |
23:40:37 | edub4rt | cheatfate, I think it would be faster if used other method than epochTime(), with integers instead of floating point |
23:40:55 | * | yglukhov joined #nim |
23:41:00 | cheatfate | edub4rt, do you listening me? i have checked gettimeofday... |
23:42:17 | * | mahasamoot joined #nim |
23:42:19 | * | philo joined #nim |
23:43:34 | edub4rt | still think theoretically would, you didn't convert gettimeofday to floats then right? |
23:45:08 | * | yglukhov quit (Ping timeout: 250 seconds) |
23:45:26 | cheatfate | of course i thought it was a problem with floats... |
23:46:20 | cheatfate | i know libuv using soft timers like we are, but my experiments with hardware timers makes me sure hardware timers is faster then software timers |
23:47:15 | cheatfate | software timers slowdown async like 12-15% hardware timers only 5-7% |
23:47:43 | * | xet7 joined #nim |
23:47:56 | edub4rt | still would be better if it didn't use floats, floating point speed depends on the platform, in ARM devices would have a difference, there are many mobiles devices that floating point are emulated and not in hardware |
23:48:58 | edub4rt | yep using hardware timers would be much better |
23:49:31 | Sembei | cheatfate: https://github.com/nim-lang/nimble/issues/203 is this issue |
23:50:36 | cheatfate | Sembei, common, i'm not using nimble at all, and already sleeping inside, please leave a comment in issue or create new one, but i can't heal you |
23:50:47 | cheatfate | heal = help |
23:51:22 | Sembei | cheatfate: I mena the solution is there |
23:51:29 | Sembei | no need to open an issue |
23:51:31 | Sembei | is known |
23:52:52 | cheatfate | but you can describe your case there, because as i can see "not reproduced" label so dom96 needs help |
23:56:30 | Sembei | same error as last post 9 days ago |