<< 19-06-2016 >>

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:54fvshi, howto set step in for loop? Say 2 instead of 1
02:49:23ddl_smurffor i in 0...(count / 2): echo i * 2
02:54:02fvsddl_smurf, thx - neat approach
02:54:12*Heartmen- joined #nim
02:55:07ddl_smurf(should be div, apologies)
02:55:43*zds joined #nim
02:56:09fvsyep, and ..
02:56:44zdsHi 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:50zdsI'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:07zdsOh, I see. The `...` is necessary in docopts to create a seq.
03:11:26*Varriount joined #nim
03:15:58VarriountAraq: 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:56zdsIs 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:18zdsi guess not
05:49:30*nsf quit (Quit: WeeChat 1.5)
05:56:24shodan45is "typed" the same as "typedesc"?
05:57:24shodan45(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:30shodan45ahh, 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:58cheatfateVarriount, welcome back, i missed you
08:07:16*chemist69_ joined #nim
08:07:18cheatfatedom96, 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:42dom96cheatfate: what's up?
10:46:08cheatfateah 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:58edub4rtI 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:38edub4rtI 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:33edub4rtso I tried do the same way that I found in examples in the sources, "proc hash*(x: A): Hash {.borrow.}"
13:43:56edub4rtbut 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:08edub4rtnvm 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:42Araq_yeah .borrow is quite broken in the compiler
14:45:56Araq_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:16euantorAny ideas why this doesn't work: `const stringTrimChars: set[char] = strutils.Whitespace + '=' + 'v'`
14:49:23*yglukhov joined #nim
14:49:32euantorError: type mismatch: got (set[char], char)
14:49:32euantorbut expected one of:
14:49:32euantorproc `+`(x, y: float32): float32
14:49:34euantorproc `+`(x, y: int32): int32
14:49:36euantorproc `+`(x, y: int16): int16
14:49:38euantorproc `+`(x, y: float): float
14:49:40euantorproc `+`(x: int32): int32
14:49:42euantorproc `+`(x: int8): int8
14:49:44euantorproc `+`[T: SomeUnsignedInt](x, y: T): T
14:49:46euantorproc `+`(x, y: int64): int64
14:49:48euantorproc `+`(x: float): float
14:49:50euantorproc `+`(x, y: int8): int8
14:49:52euantorproc `+`(x, y: int): int
14:49:54euantorproc `+`[T](x, y: set[T]): set[T]
14:49:56euantorproc `+`(x: int64): int64
14:49:58euantorproc `+`(x: int16): int16
14:50:00euantorproc `+`(x: int): int
14:50:02euantorproc `+`(x: float32): float32
14:51:10deavmi_mobileset[char]
14:51:25deavmi_mobileis that a set or array that can contain values if type char?
14:51:43euantorIt's a built in set: http://nim-lang.org/docs/manual.html#types-set-type
14:51:55euantorThe docs make it seem like the `+` operator should just work
14:52:18euantorWhitespace is defined here: https://github.com/nim-lang/Nim/blob/master/lib/pure/strutils.nim#L33
14:54:51sdwwhat if you change your character literals into sets?
14:55:27euantorYep, that works
14:55:33sdwstrutils.Whitespace + { '=', 'v' }
14:55:42euantorSeems odd
14:55:55euantorThat works perfectly, it's just not very clear
14:56:15euantorLooking at the error message, it is actually stated in the output too
14:56:21sdwthe documentation says you can also use incl
14:56:59euantorYeah, but not with a constant, as it takes a var parameter
14:57:03sdweh, that looks like a statement rather than an expression though
14:57:12sdwyeah, nevermind
14:57:51Araq_it's perfectly clear: proc `+`[T](x, y: set[T]): set[T]
14:58:00Araq_both x and y have to be sets to begin with.
14:59:03sdwwhat he really wants is incl that acts like the + expression
14:59:10sdwI think that makes sense
14:59:16Araq_there is no proc `+`[T](x: set[T], y: T): set[T]
15:01:12*PMunch joined #nim
15:02:11euantorYeah, I just wasn't reaidn the error properly Araq_
15:02:23euantorMy fault for trying to watch the F1 and write code at the same time ;)
15:02:29euantor*reading
15:03:28Araq_sdw: it makes sense but meh, that means 4 more + - procs in system.nim that are hardly ever used
15:03:53Araq_for consistency then proc `+`[T](x: T, y: set[T]): set[T]
15:03:59Araq_needs to be supported too
15:04:07Araq_and the same for `-`
15:04:12euantorMaybe it's a case of adding some examples to the documentation?
15:04:18sdwyeah, either way
15:04:28Araq_and why stop there? consistency demands * should also be supported ...
15:04:54Araq_euantor: yeah, sure. PRs welcome :-)
15:05:41sdware sets of sets supported?
15:06:02Araq_no :-)
15:06:28*euantor quit (Remote host closed the connection)
15:06:39sdwthen I think what you just suggested would be a win
15:07:06Araq_bloating system.nim even moreso ain't a win
15:07:12sdwproc `+`[T](x: T, y: set[T]): set[T]
15:07:13sdwthat one
15:07:50sdwdoes set require compiler magic?
15:08:24Araq_proc `+`[T](x: T, y: set[T]): set[T] = {x}+y # no magic required
15:08:54Araq_but meh, let's not be overly sloppy with our types.
15:09:10Araq_when everything is a valid interpretation, no bugs can be detected.
15:10:24sdwI think it depends a lot of personal taste. Do you tend to prefer being explicit?
15:11:07Araq_yes, for uncommon operations. and x+set is uncommon.
15:11:37*euantor joined #nim
15:11:41euantorAraq_ Okay, that's what I'll do
15:11:49Araq_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:29zdsI'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:36zdsI 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:57Araq_zds: parseutils.parseFloat and strutils.parseFloat exist, I hope you know that
15:26:38Araq_don't name your converter `$` that's pure obfuscation of what happens
15:26:41zdsI know about the latter... But I'm trying to move in the opposite direction. I will look at the former
15:26:53zds(this is only my second day using Nim so I apologize for the beginner questions)
15:27:04Araq_converter floatToStr(n: float): string = ...
15:27:17Araq_avoids the recursion too.
15:27:41zdsAh ok, I was calling it `$` so I could take advantage of the `$` call in proc join(T not string)
15:28:04Araq_well then don't use a converter, but a proc `$`
15:28:18Araq_and in your $, you call system.`$` to avoid the recursion
15:29:36zdsah, I didn't realize i could namespace like that
15:30:27zdsThanks Araq_ that clears it up!
15:30:30Araq_but it's all pretty horrible :P and perhaps you should do proc `&`(s: string; f: float): string = s & myFloatToStr(f) instead
15:31:01Araq_since string&float is not already predeclared
15:31:30zdsHm. I don't think I've seen `&` at all yet. I'll look it up
15:36:00zdsSo I'd basically reduce that instead of using join?
15:38:53Araq_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:28deavmizds: When you use `$` is that to override the operator's execution but relate to it as a proc?
15:43:34deavmizds: the backticks
15:44:23zdsI suppose so... I assumed since it was an operator I had to use the backticks.
15:44:50euantorYeah, backticks are required for operators I thought
15:45:08deavmieuantor: Just asking, thnaks. :)
15:45:10deavmizds: 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:39zdsI 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:39zdsthinking 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:03zdsI 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:18sdwwhat do you guys use for debugging in nim?
16:31:27def-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:08Varriountcheatfate: Good to be back. Sorry for the absense, a lot of like-stuff occurred, and Nim kinda fell by the wayside.
16:53:27deavmiVarriount: ello o/
16:56:54*ddl_smurf quit (Quit: ddl_smurf)
16:57:23*ddl_smurf joined #nim
16:58:30VarriountHi deavmi
16:59:54*euantor quit (Remote host closed the connection)
17:02:21dom96hey Varriount! How's things?
17:02:44Varriountdom96: 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:47sdwtype 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:29def-array[N, T] is already what you want, but yes, should be possible
17:10:50def-make that a ; between T and N though, otherwise T is also int
17:11:04Varriountdom96: Spammer on the forum again.
17:11:22def-sdw: and use static[int]
17:11:24dom96whoa
17:11:45VarriountThis might require an IP ban.
17:12:00VarriountOr possibly a flamethrower.
17:12:56*deavmi_laptop joined #nim
17:14:26dom96Looks like it's time to implement a "Remove all threads created by user <x>" feature.
17:15:06VarriountAnd possibly a rate-limiter on the number of threads a user can create in a given time period
17:15:25dom96yeah... 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:34sdwdef-: thanks
17:19:13sdwshould it be possible to use varargs as generic parameters? type Tensor[T; varargs[int]] = ...?
17:20:53sdwI 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:13cheatfatedom96, i think it will be easier to ban his ips using firewall
17:23:33dom96cheatfate: ooh, good idea.
17:26:08Varriountdom96: There are still some spam threads left, just in case you missed them (since they continued well into the next forum page)
17:29:15edub4rtI want to do a small metaprogramming in nim, but don't know how yet
17:29:43edub4rtI have `proc dosomething() {.async.} = echo "hello"` in my code and generally call this function using `asyncCheck dosomething`
17:29:53edub4rtwhat 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:20edub4rtcan someone give me tips if is possible and how should I use do it?
17:30:32edub4rtwhat should I use to do it?*
17:30:35def-edub4rt: sounds like you need a macro doasync that takes a stmt paramater, parses it and creates a new AST
17:31:26Varriountedub4rt: Could you give a more extended example (possibly via gist or pastebin)?
17:33:44edub4rtVarriount: http://pastebin.com/47ki9JUt
17:34:20edub4rtdef-: okay so I will look into that, is there some manual on how the AST works?
17:42:02edub4rtthe idea is simple, it's just a shortcut for creating a proc and then call it with asyncCheck
17:42:15Varriountedub4rt: I think this should work. I can't remember what asyn modules needs to be imported.
17:42:17Varriounthttps://gist.github.com/Varriount/94eb49206bd6268e48d042b4c1f63108
17:43:55edub4rtimport asyncdispatch
17:44:04edub4rtgonna try
17:44:18cheatfateedub4rt, 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:52edub4rtcheatfate, I'm aware of that
17:45:28cheatfateok then
17:46:59edub4rtVarriount: 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:53edub4rtbut I'm going to continue working on what you gave me
17:49:35*renesac_ quit (Ping timeout: 260 seconds)
17:55:13def-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:49dom96edub4rt: def-: I think you might be able to do that with a template.
17:57:05dom96Although the immediate nature of the 'async' macro may be problematic.
17:57:08edub4rtalmost 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:21def-dom96: oooh, i totally misunderstand what he was trying to do
18:01:58def-edub4rt: is this what you want? https://gist.github.com/def-/59dee63d884775ff3e032674c226f310
18:02:08cheatfateguys 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:01Varriountedub4rt: Updated and fixed.
18:04:53edub4rtexactly, both worked now =)
18:05:49edub4rtso cool that we have the flexibility to do that
18:08:00Varriountedub4rt: If you have any questions on how it works, feel free to ask.
18:11:40Varriountdef-: Hm. Is the immediate pragma needed?
18:12:11edub4rtfrom what I read in the manual just now it's not needed
18:12:27Varriount"Explicit immediate templates are about to be deprecated in later versions of the compiler."
18:12:46*TheLemonMan joined #nim
18:12:50edub4rtI 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:02dom96is there any docs for this deprecation?
18:14:56Varriountdom96: Just a mention in the manual.
18:15:00edub4rtI 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:24Varriountedub4rt: Updated my gist, added a version of the template that doesn't need a name.
18:20:15VarriountThe procedure will have a randomly generated name, however generated stack traces will point to the template, I think.
18:20:21edub4rtVarriount: 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:01edub4rtbut I just thought, adding a "block:" before defining it should work
18:21:20Varriountedub4rt: That's why I added the version that doesn't take a name.
18:21:24VarriountThat will always work.
18:25:27Varriountedub4rt: It's possible to make a unique but sensible name using a macro, and the macros module.
18:26:25edub4rtthis will work already fine, thanks for the help Varriount
18:26:29VarriountSomething 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:06Araqno, 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:57cheatfateAraq, is it possible to convert NimTypeKind nty constant to string? i mean `ntyInt8` to `int8`
18:56:17*EastByte joined #nim
18:56:33Araquse 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:59cheatfateso 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:48polypus71ignore, 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:21zdsWould 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:18dom96zds: sure, give us a link :)
20:29:32zdsThanks! https://github.com/subsetpark/ad
20:29:52zdsI'll add a few more docstrings...
20:32:02dom96https://github.com/subsetpark/ad/blob/master/ad.nim#L1 const would be better here
20:32:14dom96Also I would put it below the imports and type defs
20:33:39dom96These you should define as a set by just replacing [] with {}.
20:33:40dom96https://github.com/subsetpark/ad/blob/master/ad.nim#L29
20:33:46Araqalso we changed 'split' so that's now useless but consistent
20:34:07Araqseriously. I think I will remove this again. it annoys me so much.
20:34:15Araq*revert
20:34:59Araqwho cares if it is "consistent" when it doesn't do what people want it to do?
20:35:16dom96Araq: hrm?
20:35:25dom96where is this coming from?
20:35:32Araqlet tokens = input.split()
20:35:41Araqfrom zds' code.
20:36:06dom96what's wrong with that?
20:36:21zdsThanks 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:22dom96what do sets have to do with zds' usage of that?
20:36:57Araq12 34 + # note the 2 spaces. old split returns "12" "34" "+"
20:37:04dom96zds: yeah, I think sets are more efficient in this case.
20:37:12zdsAh - but sets seem to require ordinal types.
20:37:18Araqnew split returns "12" "" "34" "+"
20:37:18zds(I had tried sets at first)
20:37:41dom96Araq: yeah, and that makes perfect sense.
20:37:51dom96it's easy to ignore ""
20:37:59Araqit's not.
20:38:03dom96it's impossible to get this information back though
20:38:12Araqso fucking what.
20:38:17dom96Araq: how is it not?
20:38:19Araqit's not useful information.
20:38:31Araqand you can always use a real parser
20:38:32dom96in some cases it is
20:38:46Araqor use the split that uses chars/strings
20:41:13zdsdom96: 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:56Araqzds: excuse my swear words but I'm arguing your code is beautiful and we're changing the stdlib to be worse
20:42:19zdsUnderstood. I'll take them as a ringing endorsement.
20:42:59zdsFor what it's worth, I agree with you, but only because I'm a Python programmer and don't know any better.
20:43:00dom96zds: oh, hrm. I would just have a Token enum, then just write: binaryTokens = {plus, minus, ...}
20:43:15dom96You can then even encode the string in the enum IIRC
20:43:44zdsThat makes sense. I just don't know (yet) how to get from a string to the enum that represents it
20:43:57dom96or just write a `proc `$`(token: Token): string`
20:44:09Araqdom96: yeah but that's the charm of his/her solution really, that it uses multiple enums and gets somewhat more type safety
20:44:33dom96zds: case str: of "+": plus; of "-": minus ...
20:45:07Araqzds: biggest issue with your code is that you use 'except IndexError:' which is only valid code in debug mode
20:45:12dom96True. Don't listen to me, Araq is right :)
20:45:25zdsAh! I didn't know
20:45:29zdsI should raise my own exception?
20:45:50zdsI 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:02Araqwell your code shouldn't access the seq out of bounds
20:46:45Araquse an 'if' instead of a 'try'
20:46:48zdsTrue. 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:21Araqno, proc peek relies on Nim's IndexError
20:47:27zdsah
20:47:52Araqwhich the spec also allows to trigger an abort()
20:48:03zdsoh I see - so stack[stack.high] is falsey if it's empty?
20:48:50zdsor I should just manually check for stack before doing any of it
20:48:56Araqthe latter.
20:49:06Araqproc ingest begs for a 'var' parameter
20:49:27Araqproc ingest(stack: var Stack; t: string) = ...
20:49:58AraqingestLine does use that, hmmm
20:51:33*euantor quit (Ping timeout: 240 seconds)
20:51:46zdsYeah, 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:19zdsSo 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:30zdsIn othr words, if you are trying to process "1 +", you don't want to end up with 1.0 on the stack.
20:54:43Araqok, 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:09Araqbut whatever, I don't think the efficiency really matters all that much
20:56:32zdsWouldn'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:14zdsNot 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:08Araqnot sure if that can actually cause problems
20:58:23Araqthe setLen() would throw away the wrong value
20:58:39Araqhttps://github.com/subsetpark/ad/blob/master/ad.nim#L129 is obviously redundant
20:59:52zdsYes, 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:43zdsoh, or are you referring to the result = result line?
21:02:48*euantor quit ()
21:02:51Araqyes
21:03:00Araqjust remove that line and the 'else'
21:03:02zdsAh ok yes - that's more obvious :)
21:17:52*mostworst joined #nim
21:22:34*mahasamoot quit (Ping timeout: 250 seconds)
21:24:03cheatfateAraq, 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:32zdsnewSeq[char]()?
21:25:46cheatfatezds, of course :) but nim has construction @[1, 2, 3] which converts array of [1, 2, 3] to seq[int]
21:26:35def-cheatfate: @['a','b','c']?
21:26:43cheatfateyep 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:29zdsah, i understand. thank you
21:32:03*chemist69_ joined #nim
21:32:50Varriountdom96: Spammer is back
21:34:06VarriountAraq: You have forum admin priviledges too, so I think you can delete the posts as well.
21:36:23Araqthat "delete all" feature surely is handy :-)
21:36:42zdsI 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:13def-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:57zdsBig floats... I'll look into gmp
21:40:02polypus71is there currently a decent websocket server implementation for a low traffic site?
21:40:07dom96Varriount: Araq: Did he manage to post much?
21:40:32dom96polypus71: https://github.com/niv/websocket.nim
21:40:47dom96Very barebones but works pretty well for my game so far.
21:40:55*Fin105 joined #nim
21:41:22polypus71cool, hoe msny players on at a time?
21:41:26polypus71*how*
21:41:29Varriountdom96: A page and a half of posts.
21:41:31polypus71*many*
21:41:48dom96polypus71: haven't tested it that far yet :)
21:41:52*akaisora_ quit (Ping timeout: 258 seconds)
21:42:09polypus71dom: is the code public?
21:42:13dom96Varriount: awww, maybe I need to make rate limiting even more strict.
21:42:16dom96polypus71: afraid not
21:42:17*Fin107 joined #nim
21:42:25polypus71k ty
21:42:49Varriountdom96: He posted roughly 2 per minute, for 20 minutes.
21:43:21VarriountI'll never understand what people get out of something like this.
21:43:39dom96Varriount: oh well, better than no rate limiting at all.
21:43:56VarriountI 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:50gokrAraq: 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:44Varriountdom96: 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:59Varriount(Nothing like getting an inbox full of junk posts)
21:47:03*Trustable quit (Remote host closed the connection)
21:47:40polypus71the more i see the more i like this language
21:48:37VarriountIt'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:25polypus71performance, metaprogramming, static typing all in one is what gets me. syntax is a bonus
21:50:43dom96polypus71: Glad you like it! :)
21:50:52polypus71:)
21:51:05dom96Varriount: hehe, I just have gmail put it in some folder that I never look at.
21:55:56*WickedShell joined #nim
21:56:35VarriountSyntax 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:44dom96bbl
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:23edub4rtI 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:49edub4rtI went to the wiki and copied the straightforward version of the C code: https://en.wikipedia.org/wiki/Fletcher%27s_checksum
23:01:28edub4rtused c2nim but doesnt compile
23:03:03*bjz joined #nim
23:03:05edub4rtand I'm trying to fix, but currently I am not able to iterate over the array in nim (its a pointer)
23:03:37Demosjust cast the pointer to a ptr array[10000000, T]
23:03:50Demosor a ptr array[1,T] {.unchecked.}
23:05:30cheatfateedub4rt, check lib/collections/rtarrays.nim, don't use it, but this is good example
23:05:31edub4rthmm.. I didn't know that hack
23:10:05*deavmi_mobile quit (Read error: Connection reset by peer)
23:13:27Araqproc 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:35cheatfatedom96, some monthes ago you not accepted my withTimeout variant, you just say why we need withTimeout if we have or sleepAsync()
23:19:59cheatfatethis 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:39edub4rthaha cheatfate, he hardly accepted mine too
23:29:59cheatfatebe careful in usage of sleepAsync() you will get like -12% speed
23:34:04edub4rt=( what is wrong with it?
23:36:35SembeiI'm getting this error trying to install nimble on os x http://hastebin.com/ipujujiqeq.csh
23:36:54cheatfatei thought it was epochTime() but i have made benchmarks `epochTime() vs gettimeofday()` --- and got equal results, so i don't know
23:37:54cheatfateSembei, our lovely MacOS maintainer is currently sleeping
23:38:07Sembei>_>
23:38:41Sembeicheatfate: actually that part is unix
23:39:17*elrood quit (Quit: Leaving)
23:40:07cheatfateSembei, you can check here https://github.com/nim-lang/nimble/issues, or even create a new issue
23:40:37edub4rtcheatfate, 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:00cheatfateedub4rt, do you listening me? i have checked gettimeofday...
23:42:17*mahasamoot joined #nim
23:42:19*philo joined #nim
23:43:34edub4rtstill think theoretically would, you didn't convert gettimeofday to floats then right?
23:45:08*yglukhov quit (Ping timeout: 250 seconds)
23:45:26cheatfateof course i thought it was a problem with floats...
23:46:20cheatfatei 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:15cheatfatesoftware timers slowdown async like 12-15% hardware timers only 5-7%
23:47:43*xet7 joined #nim
23:47:56edub4rtstill 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:58edub4rtyep using hardware timers would be much better
23:49:31Sembeicheatfate: https://github.com/nim-lang/nimble/issues/203 is this issue
23:50:36cheatfateSembei, 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:47cheatfateheal = help
23:51:22Sembeicheatfate: I mena the solution is there
23:51:29Sembeino need to open an issue
23:51:31Sembeiis known
23:52:52cheatfatebut you can describe your case there, because as i can see "not reproduced" label so dom96 needs help
23:56:30Sembeisame error as last post 9 days ago