<< 04-01-2015 >>

00:00:07flavius/data/date
00:00:28*z1y joined #nim
00:01:45dom96BlaXpirit_: yes
00:01:48dom96where else?
00:01:58BlaXpirit_well it's not literally nimrod language
00:02:00BlaXpirit_nim
00:02:01goobleswhats wrong with that link
00:02:02BlaXpirit_D:
00:02:07BlaXpirit_dom96, anyway, i've reported
00:02:17dom96thx
00:03:52flaviugoobles: It contains the nim source code and documentation is is public to google, so it screws with the google results
00:04:29gooblesoh so google thinks alex made nimrod
00:04:36gooblesi gotcha
00:05:40flaviuAnyone have any idea how to fix "Error: only a 'ref object' can be raised"?
00:05:45flaviuI'm using newException
00:05:57*irrequietus quit ()
00:06:41BlaXpirit_give code
00:07:17flaviu`raise newException(SyntaxError, $ctx.idx & ": Syntax error, malformed string")`, ` SyntaxError* = ref object of Exception`
00:08:53flaviuhmm, weird
00:09:05flaviuif I change `ref object` to `object`, it works
00:09:10BlaXpirit_lol
00:09:39BlaXpirit_flaviu, https://github.com/Araq/Nim/blob/master/lib/system.nim#L2144
00:09:53flaviuyep
00:09:54BlaXpirit_so hmm... it's like ref ref
00:09:56BlaXpirit_D:
00:10:24flaviuIMO that template is mis-implemented, but whatever.
00:12:58Demos_don't you want to throw value types?
00:13:12Demos_or is that c++ paranoia speaking
00:16:02BlaXpirit_value types only is good
00:16:16BlaXpirit_but the error message is just wrong
00:16:29*saltylicorice quit (Ping timeout: 244 seconds)
00:18:34*BlaXpirit_ quit (Quit: Quit Konversation)
00:21:29*Etheco joined #nim
00:24:31*yglukhov__ quit (Quit: Be back later ...)
00:30:16dom96flaviu: I'd suggest raising it like so: raise SyntaxError(msg: ...)
00:30:27dom96That's how it should be done for every exception IMO
00:31:00flaviuI hadn't even considered that, thanks!
00:31:11flaviuAnd I certainly agree.
00:31:59flaviuWith my proposal, https://github.com/Araq/Nim/issues/1693, it could be even more concise: `raise SyntaxError(...)`
00:32:15*saltylicorice joined #nim
00:36:42*gokr_ quit (Quit: IRC for Sailfish 0.8)
00:39:14dom96I guess I should write this up on Github as an issue.
00:39:23dom96but I need sleep
00:39:40flaviuHow about a `proc replace*(s: string, sub: Regex, by: proc(matches: array[MaxSubpatterns, string]): string): string`?
00:40:53dom96that would be nice
00:51:20*z1y quit (Ping timeout: 265 seconds)
01:03:46reactormonkAnyone messed with ragel + nim?
01:04:08*Trustable quit (Quit: Leaving)
01:04:46*Cukta joined #nim
01:10:27*stapler quit (Remote host closed the connection)
01:11:04*saltylicorice quit (Ping timeout: 245 seconds)
01:18:17*Matthias247 quit (Read error: Connection reset by peer)
01:18:29*adam_s joined #nim
01:30:33flaviudom96: Done: https://github.com/Araq/Nim/pull/1855
01:31:46def-reactormonk: i was thinking about it, or making something like ragel in nim, but won't have time for it probably
01:32:58reactormonkdef-, I found mail parsing code with ragel https://github.com/mikel/mail/blob/master/lib/mail/parsers/ragel/common.rl so I might as well use that one
01:33:31def-reactormonk: how do you want to get that into nim?
01:35:00flaviuInteresting bug: https://github.com/Araq/Nim/issues/1856
01:35:41no_nameweird question. I have an "opaque" object type (this one https://github.com/Araq/Nim/blob/master/lib/wrappers/zip/zlib.nim#L22 ) and I want to check if the data structure pointer to it is null or not, how do I do that?
01:36:43*Varriount|Laptop quit (Ping timeout: 246 seconds)
01:37:59*Cukta quit (Quit: Page closed)
01:39:54flaviuno_name: `TInternalState` can never be null. It's not a pointer.
01:40:20flaviumaybe I misunderstood the question.
01:40:41yenicNim looks seriously great. A few of you have done some good advocacy for it out there I've noticed. I recognize some names.
01:41:03yenicStatically typed with generics and type classes, rich macro system, Pythonic syntax, multi-methods
01:41:06yenicunabashedly imperative.
01:41:25*MyMind joined #nim
01:41:30no_nameI have a TZStream record and I want to see if the state field is null or not
01:42:14yenicWhat Python3 Should Have Been.™
01:42:16flaviudoesn't `myZStream.state == nil` work?
01:42:26no_namethat's what I was wondering - that works?
01:42:34*Sembei quit (Ping timeout: 265 seconds)
01:42:46flaviusure it does. `state` is suffixed with a `*`, so it's exported.
01:42:46Demos_it probably will, value types are initialized to binary zero
01:43:02no_namethanks
01:45:57*Var|Mobile quit (Ping timeout: 265 seconds)
02:00:18reactormonkdef-, the ragel code there doesn't have any ruby-specific code, so I could compile it to C and then expose the structs created to nimrod
02:00:56reactormonkyenic, static python? Not anytimes oon.
02:02:37def-reactormonk: yeah, that's the easiest way. I'd prefer if ragel could output Nim directly
02:03:06reactormonkdef-, I think I'd settle if it could interweave the compiled C code from nim into ragel
02:05:18*bluemanshoe quit (Ping timeout: 250 seconds)
02:06:22*darkf joined #nim
02:11:17flaviuIt looks like nim doesn't provide a timedate parser
02:11:39def-indeed, write one please
02:12:07flaviudom96 won't like it, it'll be using PCRE
02:12:11reactormonkA good datetime library would be a good project
02:12:29flaviuyep, but I already have a project backlog
02:12:44*brson quit (Ping timeout: 244 seconds)
02:12:50flaviuNim has a y10000 bug :(
02:13:09*yglukhov__ joined #nim
02:13:24flaviuy10k is catchier!
02:14:16MyMindwhat is a y10000 bug?
02:14:53flaviuhttp://en.wikipedia.org/wiki/Year_2000_problem
02:14:55*saltylicorice joined #nim
02:15:01flaviubut in the year 10000
02:15:42MyMindhahaha
02:15:55reactormonkwe have plans for nim.
02:16:34MyMinda timedate parser is a must ;)
02:17:02flaviuTime travelers will also have problems, they won't be able to use their programs more than 10000 years BCE
02:17:32flaviuI'm going to write a RFC 3339 parser
02:17:49*yglukhov__ quit (Ping timeout: 255 seconds)
02:18:42MyMindI tried before using printf "proc printf(formatstr: cstring) {.importc: "printf", varargs.}" w/o success
02:18:50reactormonkdef-, did you ever tinker with ragel?
02:19:03flaviuMyMind: Not a surprise, printf is made for printing. ;)
02:19:10def-reactormonk: nope!
02:19:12MyMindand?
02:19:16flaviudid you mean sscanf?
02:19:44MyMindI wanted to use it instead of strfmt
02:20:28flaviuAh, I thought you were saying that you tried to parse dates with printf
02:21:04MyMindand another question is to avoid a new line with echo?
02:21:44flaviuMyMind: `stdout.write(...)`
02:25:24MyMindI miss more tutorials about nim
02:25:49def-MyMind: write one!
02:26:02MyMindlol I'm the student
02:26:08MyMindI just started using it
02:26:11flaviuMyMind: http://nim-by-example.github.io/
02:26:28flaviuhttp://nim-lang.org/theindex.html
02:26:29MyMindI tried that and the official one
02:26:49flaviuWhat did you find lacking?
02:26:50MyMindbesides that is hard to find anything else
02:27:10MyMindmore examples
02:27:31*saltylicorice quit (Ping timeout: 244 seconds)
02:27:58def-I have a big collection of examples, but they're not in tutorial form
02:28:54MyMinddef-: are on github?
02:29:00flaviuRosetta Code
02:29:24MyMindgood point
02:29:26def-https://github.com/def-/nim-unsorted
02:29:33def-Yeah, I wrote many of the Rosetta Code ones
02:30:48MyMindwow
02:30:52MyMindthat's huge
02:30:54MyMind:D
02:30:56MyMindty
02:30:58def-And I have a really exciting new example
02:31:19def-(have to make a pull request to Nim to make it work still)
02:31:32def-https://github.com/def-/nim-unsorted/blob/master/rcrename.nim
02:31:48def-interacting with the terrible mediawiki API
02:32:18MyMind:O
02:40:15*bluemanshoe joined #nim
02:40:15*bluemanshoe quit (Changing host)
02:40:15*bluemanshoe joined #nim
02:57:28*Var|Mobile joined #nim
03:08:08*z1y joined #nim
03:13:32*Demos_ quit (Quit: Leaving)
03:13:40*goobles quit (Ping timeout: 246 seconds)
03:16:22*Varriount|Laptop joined #nim
03:16:41Varriount|LaptopMeep?
03:17:16MyMindthere are plans to support c++ like c in the future?
03:17:32EXetoCthere is a C++ generator
03:17:49flaviuMyMind: I'm not a representative of the project, but I believe so. http://buildbot.nim-lang.org/waterfall
03:18:00MyMindis possible to import c++ libraries ?
03:18:03flaviunote that the compiler is regularly tested with C++
03:20:26*z1y quit (Quit: Leaving.)
03:21:24MyMindbackend means bidirectional interaction?
03:23:07flaviuIt means the compiler emits C++, so I'd assume so. I've never used it.
03:24:53adam_sif by import, you mean link against, I'm not sure how that would work. C++ has no standard abi
03:25:01adam_sbut I'm no expert and may be wrong
03:25:42MyMindinterfacing I mean
03:26:04MyMinduse c++ functions inside Nim
03:27:11adam_sWell, if the body of the function is defined elsewhere (not in a header), that implies linking, which has the problem I mentioned before
03:27:19*Varriount|Laptop quit (Ping timeout: 246 seconds)
03:27:56adam_sIf the function is defined entirely in a header (perhapse it is a template), then nim would have to be able to instantiate a c++ template
03:28:09adam_swhich would require a good bit of a c++ compiler I think
03:29:02flaviuadam_s: The C++ backend emits C++ code that gets compiled by the C++ compiler.
03:29:18adam_sI understand, he's asking about calling C++ from nim
03:29:48adam_sbeing able to emit c++ code does not imply nim can call c++
03:30:49flaviuAh, I see.
03:30:52willwillsonnim has importcpp and importc
03:31:52MyMindyup importing c++ code into nim
03:32:03reactormonkhum, no idea how to approach that ragel stuff
03:33:36MyMindI would like to see something like openframeworks for nim
03:34:20MyMindit's an amazing language for creative programming
03:34:21*VinceAddons quit (Read error: Connection reset by peer)
03:35:20*z1y joined #nim
03:45:32*Var|Mobile quit (Ping timeout: 244 seconds)
03:46:47adam12Can anybody tell me why sort() won't work on this CountTable? Error is "daily_191.nim(22, 40) Error: expression 'sort(wordFrequencies)' has no type (or is ambiguous)" @ https://gist.github.com/adam12/dca5c161382cb600c83d#file-daily_191-nim-L22
03:46:57*z1y quit (Ping timeout: 240 seconds)
03:51:22flaviu`Error: type mismatch: got (typedesc[R]) but expected 'typedesc[R]'`
03:51:24flaviuwat?
03:52:16flaviuadam12: try sort[string]
03:52:40flaviualso, `for word, count in ...` is perfectly valid.
03:53:39adam12sort[string] gave same error
03:54:44flaviuadam12: Bug report please.
03:57:36adam12Thanks for the destructuring assignment tip - worked well. Will file bug report for sort().
04:02:02*yglukhov__ joined #nim
04:06:07*willwillson quit (Ping timeout: 245 seconds)
04:06:08*brson joined #nim
04:06:36*yglukhov__ quit (Ping timeout: 265 seconds)
04:09:25yenicreactormonk: I was talking about Nim
04:31:42onionhammerMyMind https://github.com/onionhammer/clibpp
05:13:19*bluemanshoe quit (Ping timeout: 255 seconds)
05:22:51*BitPuffin quit (Ping timeout: 256 seconds)
05:25:01*bluemanshoe joined #nim
05:25:01*bluemanshoe quit (Changing host)
05:25:01*bluemanshoe joined #nim
05:40:57*bluemanshoe quit (Ping timeout: 244 seconds)
05:42:10*bluemanshoe joined #nim
05:42:10*bluemanshoe quit (Changing host)
05:42:10*bluemanshoe joined #nim
05:43:26*Varriount|Laptop joined #nim
05:48:06*bluemanshoe quit (Ping timeout: 265 seconds)
05:50:51*yglukhov__ joined #nim
05:55:13*yglukhov__ quit (Ping timeout: 244 seconds)
06:11:15*dyu joined #nim
06:12:13*z1y joined #nim
06:16:12*gmpreussner quit (Ping timeout: 250 seconds)
06:16:18*gmpreussner joined #nim
06:19:20*AFKMorpork is now known as AMorpork
06:19:47*brson quit (Quit: leaving)
06:25:49*Varriount|Laptop quit (Ping timeout: 246 seconds)
06:51:57*z1y quit (Quit: Leaving.)
06:55:57*z1y joined #nim
07:18:08dv-so int is always pointer sized?
07:18:49dts|pokeball?
07:18:58dts|pokeballdo you mean always has the same size as a pointer?
07:19:19dv-yes
07:21:34*z1y quit (Ping timeout: 255 seconds)
07:24:56*jefus_ joined #nim
07:29:07*jefus quit (Ping timeout: 265 seconds)
07:29:34*gour joined #nim
07:36:12Triplefoxi want to declare an array that is a "source copy" of another array that i mutate later. is there a simple idiom for doing this or should i just iterate through
07:36:39dts|pokeballsorry dv- im not aware if it is or not
07:36:51dts|pokeballMimbus,
07:36:52dts|pokeballoops
07:38:14dts|pokeball.give Triplefox var foo: array[int] = [1, 2, 3, 4];echo($foo);var bar: array[int];echo($bar);bar = foo;echo($bar)
07:38:17MimbusTriplefox: eval.nim(3, 14) Error: array expects two type parameters
07:38:20dts|pokeballoops
07:39:17dts|pokeballhow do you use array again?
07:39:34Triplefoxarray[0..3]
07:39:37Triplefox, int
07:39:43*yglukhov__ joined #nim
07:40:20dts|pokeballoh thats right
07:40:38dts|pokeball.give Triplefox var foo: array[1 .. 4, int] = [1, 2, 3, 4];echo($foo);var bar: array[1 .. 4, int];echo($bar);bar = foo;echo($bar)
07:40:41MimbusTriplefox: eval.nim(4, 5) Error: type mismatch: got (array[1..4, int])
07:40:44dts|pokeballgod damn
07:40:49Triplefoxgolly
07:40:54dts|pokeballnever mind Triplefox ignore me
07:41:03Triplefoxwell i think i see the idea anyway
07:41:03dts|pokeballim not used to these arrays
07:44:10*yglukhov__ quit (Ping timeout: 250 seconds)
07:44:38Triplefox.eval let src: array[0..3, int] = [1,2,3,4]; var det = src; echo(det)
07:44:41MimbusTriplefox: eval.nim(5, 5) Error: type mismatch: got (array[0..3, int])
07:45:01Triplefoxit's strange that it's doing that because i just compiled something really similar
07:45:33Triplefox.eval let src = [1,2,3,4]; var det = src; echo(det)
07:45:36MimbusTriplefox: eval.nim(5, 5) Error: type mismatch: got (Array constructor[0..3, int])
07:45:58Triplefoxyeah ok w/e
07:46:59dts|pokeballi wonder if there is a rosetta code article on this?
07:48:17dts|pokeballhttp://rosettacode.org/wiki/Arrays#Nim
07:48:21dts|pokeballit looks like you can
07:48:57Triplefoxit works in the actual case i want to use it for and not in the test case
07:49:36Triplefoxthis is no good, i'm going to figure this out
07:50:26Triplefoxokay, i think i see
07:50:35Triplefox.eval let a = [1]; echo(a)
07:50:38MimbusTriplefox: eval.nim(4, 5) Error: type mismatch: got (Array constructor[0..0, int])
07:50:45Triplefox.eval let a = [1];
07:50:49MimbusTriplefox: <no output>
07:50:53Triplefoxcompiles!
07:50:55dts|pokeballoh hold on
07:51:11dts|pokeball.eval let a = [1];echo(a)
07:51:14Mimbusdts|pokeball: eval.nim(4, 5) Error: type mismatch: got (Array constructor[0..0, int])
07:51:16dts|pokeball.eval let a = [1];echo($a)
07:51:19*Mimbus quit (Excess Flood)
07:51:23dts|pokeballoops
07:51:25*Mimbus joined #nim
07:51:32Triplefoxgolly
07:53:19dts|pokeball.eval let a = [1];echo($a)
07:53:21Mimbusdts|pokeball: eval.nim(4, 5) Error: type mismatch: got (Array constructor[0..0, int])
07:53:27dts|pokeballfml
07:53:29Triplefoxit works if i print one index at a time
07:53:36dts|pokeballas it should
07:53:42Triplefox.eval let a = [1]; echo(a[0])
07:53:43dts|pokeballmaybe flaviu hasnt updated his compiler?
07:53:45MimbusTriplefox: 1
07:53:59Triplefoxi am getting this locally too
07:53:59dts|pokeball$a should print the whole array though
07:54:16dts|pokeball.eval let a = [1];echo( $ a )
07:54:19Mimbusdts|pokeball: eval.nim(4, 6) Error: type mismatch: got (Array constructor[0..0, int])
07:54:25dts|pokeball.eval let a = [1];echo( ($a) )
07:54:28Mimbusdts|pokeball: eval.nim(4, 7) Error: type mismatch: got (Array constructor[0..0, int])
07:54:39dts|pokeballi give up
07:56:56Triplefox.eval let a = [1]; echo(@a)
07:56:59MimbusTriplefox: @[1]
07:57:09Triplefoxthat works, although it's kind of terrible
07:57:32dts|pokeballTIL @
07:58:45Triplefoxi'm still a little unclear about the sequence/array relationship, i don't know what the costs are of going between them
07:59:59dts|pokeballim not sure... i just know that seq acts more like an array in c++ and array acts more like a map in c++
08:00:08dts|pokeballa map with a predefined range of values, that is
08:01:05Triplefoxmy understanding of array is that it's a "dumb" hardware array, it's totally static like in C, but you can get around the bounds checker and work with manual memory arrays by declaring e.g. [0..0, int]
08:04:00Triplefoxwhen i go to seq, then it's a growable list thing, it has nicer convenience features; presumably i'm deep copying the array when i do @a
08:18:55Triplefoxalso realized i could use 0..high(ary) instead of 0..len(ary)-1
08:19:03dts|pokeballhehe
08:19:03*BitPuffin joined #nim
08:19:15dts|pokeballthe first version of BillsPC used that
08:19:22dts|pokeballthen i remembered .high
08:20:04Triplefoxi'm used to haxe numeric iterators where (n in 0...2) means [0, 1]
08:20:26Triplefoxso you can pass in length and get the right indexing
08:23:12*BitPuffin quit (Ping timeout: 245 seconds)
08:24:46*z1y joined #nim
08:49:50Triplefoxwoo, got multitextured quad example running https://vine.co/v/Odr2eAdwT5m
08:51:33*kapil__ quit (Quit: Connection closed for inactivity)
08:53:31*yglukhov__ joined #nim
08:57:44*yglukhov__ quit (Ping timeout: 245 seconds)
09:06:22*z1y quit (Ping timeout: 240 seconds)
09:11:09*BlaXpirit joined #nim
09:17:14*Var|Mobile joined #nim
09:17:31*tane joined #nim
09:17:38tanegood morning
09:18:03*adam_s quit (Quit: Leaving)
09:18:11*dts|pokeball quit (Ping timeout: 264 seconds)
09:18:22*Var|Mobile quit (Read error: Connection reset by peer)
09:18:35*Var|Mobile joined #nim
09:20:51*Var|Mobile quit (Read error: Connection reset by peer)
09:21:31*gour quit (Remote host closed the connection)
09:25:55*gour joined #nim
09:51:52*yglukhov__ joined #nim
09:52:15*Var|Mobile joined #nim
09:56:04*yglukhov__ quit (Ping timeout: 245 seconds)
10:08:35*Var|Mobile quit (Read error: Connection reset by peer)
10:13:52*tane quit (Quit: Verlassend)
10:36:35*VinceAddons joined #nim
10:43:53*gokr_ joined #nim
10:45:25*alexruf joined #nim
11:08:47*alexruf quit (Quit: My Mac has gone to sleep. ZZZzzz…)
11:18:45*noam_ joined #nim
11:21:37*noam quit (Ping timeout: 240 seconds)
11:23:49*Etheco- joined #nim
11:23:59*gokr_ quit (Ping timeout: 245 seconds)
11:24:41*Trustable joined #nim
11:25:28*Etheco quit (Ping timeout: 255 seconds)
11:25:32*gokr_ joined #nim
11:31:54*gokr_ quit (Ping timeout: 245 seconds)
11:32:39*gokr_ joined #nim
11:42:22flaviu:Q
11:42:30flaviuoops, wrong window
11:48:08*alexruf joined #nim
11:48:37*Matthias247 joined #nim
11:50:38*alexruf quit (Client Quit)
11:51:23*dyu quit (Remote host closed the connection)
12:00:05*yglukhov__ joined #nim
12:09:41*gour_ joined #nim
12:12:44*gour quit (Ping timeout: 245 seconds)
12:13:14*gour_ is now known as gour
12:23:04*tgkokk joined #nim
12:34:32*goobles joined #nim
12:35:41*BitPuffin joined #nim
12:40:42*BitPuffin quit (Ping timeout: 245 seconds)
12:44:53*yglukhov__ quit (Ping timeout: 240 seconds)
12:45:27*yglukhov__ joined #nim
12:48:54*arc619 joined #nim
12:49:38arc619Hi guys, hope everyone is well :)
12:50:07goobleshello mr nimrod
12:50:23arc619just had a quick question about memory management with Nim
12:51:08gooblesit uses a gc ;0
12:51:43arc619okay so let me know if I have done this all wrong by not using refs (which I probably have). I have an object defined thus: MemoryCell* = object
12:52:01arc619this has an int and float within it
12:53:14arc619I'm using mitems that I cobbled together that's basically items but returns a var so I can iterate through a list and alter the items within...
12:54:06arc619The list is a seq of Link* = object, which has within it source*: MemoryCell and dest*: MemoryCell
12:54:10arc619my question is
12:54:35arc619What happens if I go: for link in links.mitems: swap(link.source, link.dest)
12:54:57arc619I am trying to flip the direction of the source and dest within the link obj
12:55:32arc619but i'm not sure if this is the wrong way to do it - the objects aren't declared as ref so I guess they're set up as values?
12:55:40arc619what would the swap do in this case?
12:56:23arc619I hope that makes sense - not so easy to copy a code fragment to irc :)
12:56:42*willwillson joined #nim
12:56:47dom96hello arc619, welcome! :)
12:56:52gooblesdom knows
12:56:59gooblesi haven't a clue
12:57:08arc619thankyou dom96 :)
12:57:09gooblesnimrod does magic with its values
12:58:21dom96arc619: The values would stay on the stack as opposed to the heap (with ref).
12:58:21*z1y joined #nim
12:58:21arc619for reference mitems is just normal items but defined with a var like: iterator mitems*[T](a: var seq[T]): var T {.inline.} =
12:58:28dom96or at least that's my guess :)
12:59:37gooblesits in a container right?
12:59:45arc619yes :)
12:59:47gooblesthis seq thing
12:59:50dom96although if it's in a seq then it might already be on the heap
13:00:06dom96To be honest I'm not certain.
13:00:13arc619so I'm basically calling swap on two objects within a seq of objects NOT defined as a ref.
13:00:29gooblesi saw an article covering ref * etc but now I can't find it
13:01:02dom96I think when you add it to the seq it gets copied.
13:01:13flaviuarc619: Can you post it on gist or pastebin? It might be easier to understand that way.
13:01:48arc619sure, just a tic
13:07:26*noam_ quit (Quit: Leaving)
13:07:27arc619first time using pastebin :D Hopefully this is visible http://pastebin.com/cjzskTq3
13:08:04flaviuhttps://gist.github.com/ is much nicer, but that worked fine.
13:08:35arc619ah ok flaviu thanks, noted :)
13:11:35flaviuSo `swap` is a compiler intrinsic ("magic"). It's implemented here: <https://github.com/Araq/Nim/blob/devel/compiler/ccgexprs.nim#L1359>
13:12:15gooblesi knew it involved magic
13:13:03gooblesdoes the * mean pointer?
13:13:07flaviuSo from what I can tell, that code is equivalent to manually writing out the temporary swap variable.
13:13:33flaviugoobles: No, it means it's exported. <http://nim-lang.org/manual.html#export-marker>
13:13:38arc619the * makes the functions visible from other units
13:14:18gooblessource*: MemoryCell (is this a function? why is this thing exported?)
13:14:37goobleslike a public variable?
13:14:52arc619source is a public field of MemoryCell type
13:15:05arc619if there were no * it'd be a private field IIUC
13:15:09gooblesic
13:15:17gooblesso it must be by value
13:15:23gooblesso ur swapping values
13:15:57arc619so I guess it'd be better to do with refs? Ideally I just wanna flip the pointer but I don't want to increase the instance count ofc
13:16:54flaviuarc619: I don't understand what you mean with the instance count stuff, so that probably means that you don't have to worry about it.
13:17:00*dyu joined #nim
13:17:06arc619haha fair play :)
13:18:08arc619From what I thought, nim references use a system like ARC or interfaces in Delphi, so each time you 'create' a reference to a particular object it's inc'ing an instance count?
13:19:10flaviu`MemoryCell` isn't a reference either, it's a value. typedef struct { size_t id; CellData data; } MemoryCell;
13:19:24goobleshe went for the c
13:19:34arc619lol
13:19:50arc619sometimes it helps to see it as c to understand under the hood
13:19:51gooblesit has deferred ref counting with a fallback tracer i think
13:20:51arc619so swap with a value type is gonna be shallow copying I guess? Does nim copy the whole chunk of memory for the typedef with the swap in this code?
13:21:18arc619what would happen if I had objects within memory cell?
13:21:33gooblesit copies the whole memory cell i'm sure
13:21:35arc619I forgot to mention that CellData is just a float atm
13:22:03flaviuarc619: https://gist.github.com/flaviut/4993451c283a96984d70
13:22:05arc619(actually it's a distinct float)
13:22:11gooblesbut that is a tiny object so just copy it all u want
13:22:46arc619cor flaviu, well cool we can see the compiler internals :)
13:23:15flaviuyep. You have to use --embedSrc if you want to get the helpful nim lines
13:23:34arc619tho i dont really understand that code XD
13:23:51*rpag joined #nim
13:24:02gooblesur code as nim c
13:24:09gooblesisn't it purty
13:24:12*rpag quit (Remote host closed the connection)
13:24:47gooblesflaviu knows this lang really good
13:25:27arc619honestly nim is just really awesome in general
13:25:49BlaXpirithow to efficiently convert iteration over Runes into a string?
13:26:10BlaXpiritlike, I could make a seq of Runes and then convert
13:26:17flaviuarc619: refresh the page, I've modified it to get rid of the `line()`s
13:26:26arc619ah ok :)
13:28:13arc619so this would copy the mem? (*link_88222).Source = (*link_88222).Dest;
13:28:27arc619my C is very rusty
13:28:31gooblesyes it would
13:28:45gooblesjust copying a int and a float
13:28:48flaviuYes, the C compiler can probably figure out how to make it fast too.
13:28:49gooblesno biggie
13:28:51arc619:)
13:29:24arc619that's really cool, thankyou :)
13:29:57arc619so it looks like what I wrote is gonna do what I want. Perhaps not most efficiently, but at least without leaking or doing something dumb :)
13:30:08flaviuarc619: Refresh the page for the code when using refs
13:30:54flaviuunsureAsgnRef can be found here: <https://github.com/Araq/Nim/blob/devel/lib/system/gc.nim#L260>
13:31:08*noam joined #nim
13:32:09gooblesthat code gen could be better, needs move semantics
13:32:20gooblesrar ar
13:33:31gooblesflav do u use nim for work?
13:34:05arc619flaviu you are incredibly helpful! There's nothing quite like seeing under the hood to know what's going on :)
13:34:27ekarlso-how does one make exceptions in nim ?
13:35:02gooblesdo something illegal
13:35:23arc619So with refs in C it becomes link_88222 = (&(*links)->data[i_88241]); But how would I know if it's on stack or not for unsureAsgnRef? Or is that just a question of how I define the Links seq as a ref or not?
13:36:10gooblesits probably not on the stack given that its in a seq
13:36:31goobleslooks like u do this: raise newException(OSError, "the request to the OS failed")
13:36:50flaviuarc619: Yes, local variables are on the stack, refs are on the heap.
13:37:07flaviua seq is always on the heap
13:37:25arc619goobles yes of course, silly me was confusing stack and heap!
13:37:45*jefus__ joined #nim
13:38:40flaviuekarlso-: Make your own exceptions? `MyException = object of Exception` and use `newException`, or do `MyException = ref object of Exception` and use `MyException(msg: ...)`
13:40:48*jefus_ quit (Ping timeout: 250 seconds)
13:40:55*willwillson quit (Ping timeout: 255 seconds)
13:44:12*Demon_Fox quit (Quit: Leaving)
13:45:58gooblesnim seems interesting, i don't really understand its generic programming stuff much though
13:46:29gooblesif it is powerful or not
13:47:44*z1y quit (Ping timeout: 250 seconds)
13:49:24ekarlso-flaviu: can u add a property to a Exception ?
13:52:18flaviuSure. I think you should even be able to raise your own `ref object`s, but it looks like that doesn't work at the moment.
13:52:35gooblesdoes nim have function overloading?
13:53:08flaviugoobles: yep, look at the TOC here: <http://nim-lang.org/system.html>
13:53:16gooblessince it is ref counted it might actually be useable for games hu
13:53:31ekarlso-meh, jester is so sad atm with doing 502 for all errors :'(
13:53:35ekarlso-dom96: fix fix!
14:04:46*tgkokk quit (Ping timeout: 255 seconds)
14:06:07dom96ekarlso-: Why don't you try to fix it? :P
14:07:44ekarlso-dom96: ... got enough to do with packages :P
14:07:56ekarlso-dom96: q though
14:08:03ekarlso-HttpCode is what ?
14:08:05ekarlso-a int ?
14:08:25*BitPuffin joined #nim
14:08:34dom96an enum
14:09:47flaviudom96: An int would be better. Unknown status codes are still valid status codes.
14:10:03ekarlso-dom96: where are they defined ?
14:10:21ekarlso-Ah, I see
14:10:55ekarlso-hmm, how does one defined the headers which are an openarray ?
14:12:12dom96flaviu: There is nothing stopping you sending whatever you want to the socket.
14:12:59*gokr2 joined #nim
14:13:10flaviuOnly convenience stops me. :)
14:13:17*gokr_ quit (Ping timeout: 240 seconds)
14:13:32ekarlso-how u make a new openarray ? :p
14:14:21flaviuekarlso-: http://nim-lang.org/manual.html#open-arrays
14:17:39dom96I'd rather be type safe than to allow anything and make mistakes :P
14:18:07ekarlso-so what, let headers = openarray[tuple[key, value: string]() ?
14:19:00gokr2no, you dont create openarrays
14:19:21gokr2its just usrd as param type
14:19:30gokr2use a seq
14:19:36flaviudom96: But returning an code not in your enum is *not* a mistake. Type safety doesn't apply when the spec says "The Status-Code element is a 3-digit integer result code"
14:19:59flaviutype safety might mean using `range[100..999]` though, that'd be a valid argument.
14:20:43flaviu"HTTP status codes are extensible. HTTP applications are not required to understand the meaning of all registered status codes, though such understanding is obviously desirable. However, applications MUST understand the class of any status code, as indicated by the first digit, and treat any unrecognized response as being equivalent to the x00 status code of that class, with the exception that an unrecognized response MUST NOT be cached"
14:21:00ekarlso-var headers = @[(key: "content-type", value: "application/json")]
14:21:03ekarlso-hmmm
14:21:03gokr2afaik openarray just means" seq or array"
14:21:31gokr2so procs can accept both
14:22:59dom96flaviu: For now I am getting the common cases working. Jester hasn't even had a single release yet.
14:23:03ekarlso-hmmm, dom96 /home/karlsone/.nimble/pkgs/jester-0.1.0/jester.nim(342, 33) Error: undeclared identifier: 'v' booooo
14:25:11ekarlso-dom96: is the version of jester foobard ?
14:25:45dom96?
14:27:12ekarlso-https://github.com/dom96/jester/blob/master/jester.nim#L296 < trying to use this
14:27:42dom96and how are you trying to use it?
14:27:56ekarlso-resp(Http500, @[(key: "content-type", value: "application/json")], @{"error": "500"})
14:28:17*seantallen joined #nim
14:29:17dom96That's not the right syntax.
14:29:23ekarlso-really ?
14:29:26dom96remove the @
14:29:31dom96{"key": ...}
14:30:14dom96http://nim-lang.org/manual.html#table-constructor
14:30:39ekarlso-resp(Http500, @[("content-type", "application/json")], "foo") < like that then ;)
14:30:45ekarlso-ahhh
14:30:48ekarlso-doh
14:32:20*seantallen quit (Client Quit)
14:32:31ekarlso-what does an ordinal type expected ?
14:32:34*seantallen joined #nim
14:33:22*seantallen quit (Remote host closed the connection)
14:33:36*seantallen joined #nim
14:33:57*jefus__ quit (Ping timeout: 244 seconds)
14:34:18jh32hi
14:36:04ekarlso-meh dom96 care for a bit help here ? :/
14:36:29ekarlso-https://bpaste.net/show/cb41055bb573
14:36:58dom96you're once again doing it wrong
14:37:08dom96let headers = {"key": "content-type", "value": "application/json"}
14:38:22dv-web programmers :}
14:38:29ekarlso-yeah ? I've tried let headers = @[{"content-type": "application/json"}] as well
14:43:39dom96remove the @[]
14:44:07ekarlso-yeah, and then it still fails on the error I said before (:
14:44:14ekarlso-/home/karlsone/.nimble/pkgs/jester-0.1.0/jester.nim(342, 33) Error: undeclared identifier: 'v'
14:44:23ekarlso-'v' is never declared there
14:44:46dom96It needs to be inside a route.
14:44:54dom96You can't just put 'resp' anywhere.
14:45:10ekarlso-yeah, I've done that
14:45:25ekarlso-https://bpaste.net/show/81e1ff8c7b7d dom96
14:47:57dom96hrm, can you change line 301 of jester to: response.data = (TCActionSend, code, headers.newStringTable, content)
14:47:58dom96?
14:49:05ekarlso-that fixed it :)
14:49:15ekarlso-it seems u have the error in trunk too btw
14:49:15dom96cool
14:50:15dom96Fixed.
14:53:03ekarlso-hmmm
14:53:14ekarlso-dom96: could u provide a halt that takes headers ? :D
14:53:54ekarlso-dang, there is already !
14:53:56dom96there is one
14:54:42ekarlso-packages.nim(230, 12) Error: type mismatch: got (bool) but expected 'FutureBase'
14:54:45ekarlso-hmmm
14:57:17dom96hm, on halt?
14:57:26ekarlso-yea
14:57:30ekarlso-0.1.0
14:58:49*gmpreussner_ joined #nim
14:58:57*gmpreussner quit (Ping timeout: 244 seconds)
14:59:33*jefus__ joined #nim
15:01:15*jefus__ quit (Read error: Connection reset by peer)
15:01:22ekarlso-any idea on what that is about dom96 ?
15:01:26dom96ekarlso-: Works ehre though https://github.com/dom96/jester/blob/master/tests/alltest.nim#L8
15:01:29dom96*here
15:01:51ekarlso-dom96: https://bpaste.net/show/f3b724eda7a4 < shouldn't that work ?
15:03:10dom96does it work outside the except?
15:03:33ekarlso-yeah :/
15:03:42dom96Then that's the bug unfortunately.
15:03:59*saltylicorice joined #nim
15:04:11ekarlso-dom96: bug in nim or jester?
15:04:19dom96I think this may actually be an async macro bug.
15:05:12ekarlso-dom96: where u want me to report it ?
15:05:51dom96Report it in jester for now
15:06:11dom96You can get around it by setting a variable inside the except btw
15:06:21ekarlso-dom96: setting which variable ?
15:06:29dom96just create a new variable and set it
15:06:34dom96var errorHappened = false
15:06:42dom96try: ... except: errorHappened = true
15:06:46dom96if errorHappened: halt ...
15:08:52*jefus joined #nim
15:10:19ekarlso-that's so evil odm
15:10:21ekarlso-dom96: .
15:10:34dom96Why?
15:11:02ekarlso-dom96: that you can't halt inside a except
15:11:40*saltylicorice quit (Ping timeout: 265 seconds)
15:11:52dom96it's not the end of the world
15:12:52dom96ekarlso-: You don't have to report it
15:12:57dom96I reproduced it with asyncdispatch
15:13:01ekarlso-kk
15:13:01*yglukhov__ quit (Quit: Be back later ...)
15:19:46ekarlso-how can u access the current exception to get a value from it ?
15:25:05*i6o6ep joined #nim
15:25:15*i6o6ep quit (Client Quit)
15:26:00*i6o6ep joined #nim
15:27:07i6o6epHi guys! Have already using Nim? Have any comparsion to java?
15:28:54*gokr_ joined #nim
15:29:35flaviuNim is used for the forum, the compiler, and the package manager.
15:30:39*gokr2 quit (Ping timeout: 245 seconds)
15:30:58flaviuThe hasn't been a comparison to java made, but Nim encourages a procedural style
15:31:44flaviuYou won't be using virtual methods or inheritance nearly as often
15:32:21ekarlso-flaviu: how can u set a property on a exception before doing newException ?
15:32:27ekarlso-like a HttpCode
15:32:31i6o6epSeems like it more KISS than java
15:33:25flaviuYes, definitely.
15:34:10flaviuAlthough Nim the language does have areas of unexpected complexity sometimes.
15:40:01seantallenflaviu: such as?
15:41:51flaviumacros and `generic x`s
15:42:37flaviuI've also had trouble understanding how pragmas on types behave.
15:43:19*gmpreussner__ joined #nim
15:43:23*gmpreussner_ quit (Ping timeout: 244 seconds)
15:44:23*ma3a joined #nim
15:44:25*darkf quit (Quit: Leaving)
15:45:34*i6o6ep quit (Ping timeout: 255 seconds)
15:58:34*seantallen quit (Quit: Textual IRC Client: www.textualapp.com)
16:00:35flaviuekarlso-: Oops, forgot about your question.
16:01:04flaviuYou assign the result from newException to a variable
16:01:10flaviuand mess with the fields taht way
16:22:23*MrOrdinaire joined #nim
16:26:20*arc619 quit (Quit: Page closed)
16:27:42MrOrdinairehi, I'd like to contribute to the nim language project. is there any good first bug to dive into for beginners?
16:28:11no_namewhat's the best way to debug nim programs? specifically is there a way to step through C functions that it calls?
16:28:30no_nameI'm getting a vague error from a library and trying to figure out what is causing it
16:29:46no_nameI tried using mingw's gdb on a compiled nim exe on windows and it didn't recognize it as an executable
16:33:37flaviuno_name: You can use a debugger like gdb with nim
16:33:51flaviuMake sure that your library is compiled with `-g` or whatever is equvilent
16:34:09*i6o6ep joined #nim
16:34:11flaviuAnd compile your nim program with --linedir:on --debuginfo
16:34:37*ma3a quit (Ping timeout: 255 seconds)
16:34:48flaviuIf you get a segfault, use --passC:-fsanitize=address --passL:-fsanitize=address
16:35:14dom96MrOrdinaire: Take a look at the ones labelled "Easy"
16:36:34MrOrdinairedom96: thanks
16:36:54*wan joined #nim
16:38:15MrOrdinairedom96: is there any protocol to announce ownership of the bug?
16:38:25*jefus_ joined #nim
16:38:55dom96MrOrdinaire: Not really. If you want to announce it just comment, but most of the time that's not necessary.
16:39:07MrOrdinairedom96: thanks
16:39:10dom96Unless the bug is taking you a long time to fix but you're determined :)
16:40:18*bluemanshoe joined #nim
16:40:18*bluemanshoe quit (Changing host)
16:40:18*bluemanshoe joined #nim
16:41:09*jefus quit (Ping timeout: 256 seconds)
16:41:31MrOrdinaireokay
16:43:58MrOrdinaireis there any reason why csources is not a submodule inside the Nim project?
16:44:32*def- quit (Ping timeout: 250 seconds)
16:46:03dom96Araq dislikes submodules
16:46:19MrOrdinairedoes he say why?
16:46:42MrOrdinaireI don't know of a good reason why :P
16:48:02novistdom96 you are smart man here.. think what im talking about here is doable? http://forum.nim-lang.org/t/717
16:48:57MrOrdinairenovist: cool stuff!
16:49:35*def- joined #nim
16:50:06dom96novist: Thanks but I'm not sure I'm the right man to suggest the best way to do this.
16:50:30noviststill would be nice to hear some encouraging ideas ^_^
16:51:30*MrOrdinaire quit (Remote host closed the connection)
16:51:45*MrOrdinaire joined #nim
16:52:15*MrOrdinaire quit (Remote host closed the connection)
17:00:33dom96novist: I am hurt :( You said on the forum that Aporia is a wasted effort :(
17:02:16novistyeah truth hurts.. :(
17:02:19*novist taps dom96 on the back
17:03:06dom96In any case I disagree, I use Aporia and so does Araq.
17:03:47*Var|Mobile joined #nim
17:03:58novistbecause there is nothing better ^_^
17:04:20*MrOrdinaire joined #nim
17:05:04*i6o6ep quit (Quit: AndroIRC - Android IRC Client ( http://www.androirc.com ))
17:09:40*gmpreussner__ quit (Ping timeout: 244 seconds)
17:10:21MrOrdinaireis there any way to install head Aporia with nimble?
17:10:56MrOrdinairethe doc for nimble doesn't make it easy at all...
17:10:58dom96nimble install aporia@#head
17:13:30MrOrdinairedom96: thanks
17:14:23*gmpreussner__ joined #nim
17:25:57*MrOrdinaire quit ()
17:30:26*willwillson joined #nim
17:38:22vegaihm,
17:38:23vegai[vegai@zombiekani ~]$ ./.nimble/bin/aporia
17:38:23vegaicould not load: libgtksourceview-2.0.so(|.0)
17:38:47vegaioh, I actually don't have that lib yet, doh
17:38:58vegaithere we go
18:22:11*gour_ joined #nim
18:25:53*gour quit (Ping timeout: 240 seconds)
18:28:58*gour_ is now known as gour
18:39:28reactormonkHow can I interweave C code dependencies? It would depend on nim code, and other nim could would depend on the first one and the C code
18:58:18*tgkokk joined #nim
19:08:17*delian66 joined #nim
19:09:20*def- quit (Ping timeout: 244 seconds)
19:12:50*dyu quit (Quit: Leaving)
19:15:08*def- joined #nim
19:16:34*Var|Mobile quit (Ping timeout: 244 seconds)
19:17:20*gmpreussner__ quit (Ping timeout: 245 seconds)
19:17:26*Epic|gmpreussner joined #nim
19:21:14*zahary1 quit (Read error: Connection reset by peer)
19:21:45*zahary1 joined #nim
19:27:54*tgkokk` joined #nim
19:29:37*repax joined #nim
19:30:07*tgkokk quit (Ping timeout: 255 seconds)
19:32:36*alexruf joined #nim
19:32:55ekarlso-dom96: u around ?
19:39:30*tgkokk` quit (Ping timeout: 244 seconds)
19:43:39*hakand joined #nim
19:43:43*irrequietus joined #nim
19:44:35*tgkokk joined #nim
19:49:23ekarlso-https://bpaste.net/show/f1baf5b1542c #23 and #134 is there a better pattern for that ?
19:57:28*tgkokk` joined #nim
19:58:54*Etheco- quit (Read error: Connection reset by peer)
19:59:18*Etheco- joined #nim
19:59:41ldleworkDigital Ocean disabled my blog because the Nim article caused too much traffic for their infrastructure
19:59:52*tgkokk quit (Ping timeout: 245 seconds)
20:00:11ldleworkJust noticed I have an email from them from yesterday
20:01:16*BlaXpirit_ joined #nim
20:01:26Matthias247rofl
20:01:35reactormonkldlework, nice work
20:01:50reactormonkldlework, did you link it in reddit?
20:02:14*tgkokk` quit (Ping timeout: 244 seconds)
20:02:37*tgkokk joined #nim
20:04:31*yglukhov__ joined #nim
20:04:34*BlaXpirit quit (Ping timeout: 265 seconds)
20:05:05*tgkokk` joined #nim
20:05:49*goobles quit (Quit: Page closed)
20:07:59*tgkokk quit (Ping timeout: 256 seconds)
20:09:53*tgkokk` quit (Ping timeout: 240 seconds)
20:10:43*tgkokk joined #nim
20:12:52ekarlso-anyone ? ^
20:14:06ekarlso-if anyone could be so kind :P
20:15:55*hakand quit (Quit: Be back later ...)
20:16:17wanldlwork: do you have stats or logfiles/goaccess? What's the amount of visits that makes them take it down?
20:16:58wan-visits +hits*
20:17:19BlaXpirit_what is the convention on copy-constructors?
20:17:34BlaXpirit_how should they be named, etc
20:17:48ekarlso-just trying to come up with a error handling pattern for it
20:18:08BlaXpirit_ekarlso-, i looked, don't know what to change
20:19:02Araqhey guys I'm back. what did I miss?
20:19:48ldleworkI guess it is outgoing traffic
20:19:54ldleworkso I guess my server got pwned
20:20:10BlaXpirit_:s
20:20:27jpoirierif I have package XYZ that was installed using nimble but I want import the package from somewhere else can I use -p, eg -p:../XYZ
20:20:44BlaXpirit_jpoirier, uhh probably? why not try?
20:21:44jpoirierBlaXpirit_: i did but there's no indication from the compiler that it was used even when using --listFullPaths
20:22:01BlaXpirit_jpoirier, add a debug echo??
20:22:12jpoirierroger
20:26:13ekarlso-BlaXpirit_: except packages.nim(25, 5) Error: undeclared identifier: 'Http404='
20:26:25BlaXpirit_wat
20:27:33*yglukhov__ quit (Quit: Be back later ...)
20:27:44BlaXpirit_I really don't know enough to help "/
20:27:48BlaXpirit_:/
20:34:44ldleworkyeah my server is definitely owned
20:36:08ldleworknot sure how I'm going to get the data out
20:39:14ekarlso-oh well :p
20:39:17ekarlso-guess i'll wait :P
20:40:25*yglukhov__ joined #nim
20:44:51*alelos joined #nim
20:47:47BlaXpirit_http://nim-lang.org/manual.html#identifier-construction this is not nearly descriptive enough
20:48:05BlaXpirit_it's just such an arbitrary thing
20:48:14BlaXpirit_I can't construct any of the identifiers that I've tried
20:48:27BlaXpirit_let's say I want `"new" cls`
20:48:40BlaXpirit_says identifier expected, but found '`(system.new|system.new|system.new|...) Seq`'
20:49:46*tgkokk quit (Ping timeout: 244 seconds)
20:49:56BlaXpirit_but if i do let name = "new" and then use `name cls`, it somehow no longer sees it as a variable
20:49:59BlaXpirit_this is so stupid
20:51:06ldleworkBlaXpirit_: I honestly have no idea what you're talking about
20:51:15BlaXpirit_identifier-construction
20:51:21ldleworkwell I got that much
20:51:39BlaXpirit_I have {.immediate.} template with argument cls: expr
20:51:50BlaXpirit_I want to construct "new"cls
20:52:09BlaXpirit_Thing -> newThing
20:54:06*tgkokk joined #nim
20:55:22ekarlso-ldlework: do U have an idea ?
20:55:32ldleworkekarlso-: about what?
20:55:43ldleworkBlaXpirit_: ah I think I tried that too and it didn't work
20:55:45ekarlso-https://bpaste.net/show/f1baf5b1542c #23 and #134 is there a better pattern for that ?
20:55:49ekarlso-packages.nim(25, 5) Error: undeclared identifier: 'Http404='
20:56:28ldleworkbetter pattern for what?
20:56:36ldleworkekarlso-: please ask me an actual question
20:56:59ekarlso-to do error handling
20:57:31ldleworkekarlso-: does it work?
20:57:46ekarlso-noo...
20:57:57ekarlso-I get the error I pasted when compiling and I dunno why
20:58:30no_nameIf I'm just dealing with binary data I read from a file that may have nulls in it, should I be storing that in a string or array[,char] ? or something else? and can I pass that array to a c function that is expecting a char *?
20:58:59*Epic|gmpreussner quit (Ping timeout: 256 seconds)
20:59:41ekarlso-there doesn't to be a clear way to do it atm with jester -,,-
21:00:11*Epic|gmpreussner joined #nim
21:01:02ldleworkekarlso-: the code is complaining that you don't have an assignment operator defined for the Http404 type
21:01:25ldleworkI think
21:02:00ekarlso-ldlework: how u fix that then ?
21:02:30ldleworkekarlso-: where does Http404 come from?
21:02:50ekarlso-http://nim-lang.org/asynchttpserver.html
21:02:57ekarlso-HttpCode
21:04:06ldleworkekarlso-: but you haven't imported asynchttpserver
21:04:25ekarlso-ldlework: jester does export HttpCode
21:04:33ekarlso-which comes from iut
21:04:42ldleworkBut this thing is complaining specifically about Http404
21:05:35ekarlso-well
21:05:45ekarlso-if I import that, it goes: lib/core/macros.nim(273, 20) Error: ambiguous identifier: 'Request' -- use a qualifier
21:07:05ldleworkso do so
21:07:28ldleworkoh
21:07:29ldleworkno idea
21:07:39no_nameI'm confused, if strings are null terminated, then how am I able to read binary files into them and write them back out when they have nulls?
21:08:00no_nameand make web requests that return strings that have binary data in them?
21:08:03BlaXpirit_no_name, they are null terminated just for the sake of it
21:08:14BlaXpirit_length is stored
21:08:27BlaXpirit_but 0 is there just in case u want to use it to interface with C
21:08:27no_nameok... if I cast them to cstring, to they get clipped?
21:08:35BlaXpirit_probably
21:08:49BlaXpirit_well it depends on how C wants to handle them, pretty sure
21:08:56no_nameok.. how do I send a buffer of chars to a c function when it contains nulls in it?
21:09:05no_namethat's probably the source of my problem
21:09:17BlaXpirit_no_name, you should ask the C function why it's so stupid
21:09:24ldleworkboth strings and cstrings are null-terminated
21:09:28no_namedo I use cast[ptr array[1..X,char]](mystring)
21:09:30BlaXpirit_if you can't do it in C itself, why are you asking here
21:09:37no_nameno_name: the C function is zlib
21:09:37ldleworkcstrings are *obviously* null terminated, think about it - they're cstrings
21:09:43no_nameno that makes sense
21:09:55*tgkokk quit (Ping timeout: 244 seconds)
21:10:00no_namethe question is how do I convert a string with nulls in it into a char *
21:10:10BlaXpirit_you don't
21:10:18BlaXpirit_there is an implicit conversion even
21:10:25BlaXpirit_what is the problem?
21:10:36no_nameit's truncating the binary string at the first null
21:10:45no_nameat least I think it is
21:10:53BlaXpirit_how can you be sure?
21:11:04BlaXpirit_it is not that unlikely, i suppose
21:11:08ldleworkno_name: I don't think you can have strings in c which actually container nulls as opposed to being ternimanted with them
21:11:22BlaXpirit_ldlework, sure u can if u pass length separately
21:11:23no_nameyou can have char arrays, which can have nulls
21:11:30no_nameyeah, ala memcpy
21:11:47no_namethis is to feed a buffer of gzipped data to be decompressed
21:11:55no_namethe gzipped data has nulls
21:12:02gokr_my ffi article has some stuff about cstring etc
21:12:53no_nameI made a web request it got me a string with binary data in it as a result, now I want to pass that to a buffer in a field (along with a size) to a c function that decompresses it
21:12:57no_namegokr: URL?
21:13:26gokr_goran
21:13:29gokr_oops
21:13:57gokr_goran.krampe.se/category/nim
21:14:03*superfunc joined #nim
21:14:19gokr_check the one about ffi
21:14:31BlaXpirit_I'm pretty sure this code is supposed to work: https://bpaste.net/show/abce1e07a624 but 2 compiler bugs prevent it from working
21:16:08*boydgreenfield joined #nim
21:16:52*adam_s joined #nim
21:17:38AraqBlaXpirit_: so report it properly.
21:17:43BlaXpirit_Araq, sorry for bothering you, but please do try to compile this and maybe we can uncover some bugs... The problems are: line 15 "wrong number of arguments", and if I work around it, then I get line 6 "identifier expected, but found '`(system.new|system.new|system.new|...) CircleShape`'"
21:17:55BlaXpirit_Araq, but I can't be sure if it's actually bugs!
21:18:08BlaXpirit_maybe I just don't get it
21:18:32Araqeven if that would be true, it's valuable feedback either way
21:18:43BlaXpirit_"we value your feedback"
21:18:44Araqand I'll close it and explain to you why it's not supported
21:19:11ekarlso-Araq: u got a clue on my thing ?
21:19:13Araqbut it surely looks there is at least 1 bug here
21:22:27ekarlso-ok, i'l
21:22:31ekarlso-i'll give up
21:22:37*gour quit (Remote host closed the connection)
21:23:24*JohnnyLee joined #nim
21:23:34*Epic|gmpreussner quit (Ping timeout: 245 seconds)
21:23:42*Epic|gmpreussner joined #nim
21:24:37Araqekarlso-: sorry I don't know.
21:24:42BlaXpirit_Araq, I reported "Template can't accept normal argument + varargs", but is there maybe actually some way to construct "new"cls (Thing -> newThing) that I don't know?
21:25:17ekarlso-ok then, i'll skip any errorhandling for now then in the packages program..
21:25:25AraqBlaXpirit_: sure, just use a macro instead
21:25:31BlaXpirit_. .
21:25:39BlaXpirit_I'm not ready
21:25:54BlaXpirit_it's not worth it, anyway
21:27:26*tgkokk joined #nim
21:28:48Araqekarlso-: dom96 will help you when he shows up
21:29:00ekarlso-:P
21:29:12ekarlso-hopefully
21:32:27ekarlso-Araq: so for some reason doing e.code = code makes it go foobar
21:32:40ekarlso-changing the "code" var to statusCode or so makes it work
21:33:09BlaXpirit_Araq, identifier construction is barely documented at all
21:33:15BlaXpirit_but i found a wokaround
21:33:19superfunchey everyone
21:33:22BlaXpirit_insert a random whitespace
21:33:25ldleworkhi superfunc
21:33:53superfuncnothing beats a lazy sunday writing some nim
21:34:08BlaXpirit_https://github.com/Araq/Nim/issues/1863
21:34:15BlaXpirit_`ne w cls` seriously
21:35:21ldleworkBlaXpirit_: maybe it is that all whitespace is removed from identifier creation?
21:35:32ldleworkBlaXpirit_: and that's how you construct names, using variables?
21:35:35ldleworkby using spaces?
21:35:39ldleworktry `new cls`
21:35:44BlaXpirit_ldlework, I don't understand what you're saying
21:35:51BlaXpirit_of course i've tried `new cls`
21:35:51ldleworkread it again?
21:35:55ldleworkBlaXpirit_: ok
21:36:34AraqBlaXpirit_: that one is trivial to fix though
21:36:55BlaXpirit_Araq, but you know what would've been better? allowing the quotes syntax that I imagined
21:37:03BlaXpirit_(but these quotes are obviously ignored somehow)
21:37:39BlaXpirit_because fixing this partially still probably won't allow constructing some particular identifiers
21:37:41AraqBlaXpirit_: please add that as a comment to your bug report
21:38:17Araqwe might indeed change identifier construction syntax
21:38:22BlaXpirit_for sure......
21:38:26BlaXpirit_would be good
21:38:49AraqI think it's too 'clever' right now
21:38:51jpoirierI have a plugin (dll/so) written in Nim that must export (.exportc) several defined callback functions. There's a PluginStartup that's called once but the rest of the callbacks are called in a graphics loop (e.g. continuously at 60 times a second). I'm uncertain where I'd call setupForeignThreadGc?
21:40:08ekarlso-hmmm, Araq getCurrentException to get a custom exception that has a field but when trying to access the field u get unknown identifier ?
21:40:29Araqekarlso-: you need to convert that to your exception type
21:40:34BlaXpirit_thanks for your attention
21:41:00ekarlso-Araq: really, how ?
21:41:18Araqjpoirier: is PluginStartup and then the rest of the callbacks called from the same thread?
21:41:57JohnnyLeeHi everyone. I'm new to Nim. I
21:42:13ekarlso-Araq: how you convert an exception ?
21:42:20JohnnyLee've spent a few days reading the documentation, but I'm having a hard time getting a few things to work.
21:42:26Araqjpoirier: if so, you should do it in PluginStartup, otherwise you might want to do it in every callback, but then it's dangerous
21:42:36JohnnyLeeIs there an simple way to see the expanded code from a template or macro?
21:42:37Araqekarlso-: MyExceptionType(e).someField
21:43:25BlaXpirit_JohnnyLee, hehe I sure could use that. seconded.
21:43:26jpoirierAraq: I can't answer that at the moment. But based on your response I think I know the answer once I clarify how the callbacks happen. :)
21:43:53AraqJohnnyLee: yeah and I'm quite sure Tut2 tells you how.
21:44:01ekarlso-Araq: ... packages.nim(245, 40) Error: conversion from ref Exception to HttpException is invalid
21:44:05JohnnyLeeOK. I'll have a look.
21:44:07ekarlso-can't say that this is easy :P
21:44:22Araqekarlso-: so your HttpException is not a 'ref'?
21:44:39ekarlso-it is..
21:44:54Araqekarlso-: inherited from Exception?
21:45:21ekarlso-Araq: sorry, object of Exception
21:45:51ekarlso-yeye, i'll wait for dom96 instead..
21:46:02ekarlso-can't seem to get anywhere useful for error handling
21:46:46aleloswhen wrapping C libraries, is it better to use the lib function name and just {importc} or convert it to nim name convention and use the optional string arg in {importc}?
21:47:59ekarlso-Araq: no clue on what i'm doing wrong ?
21:48:14superfuncAraq: is there any restriction on the type of expression that can appear in an anonymous proc?
21:48:38*Mat4 joined #nim
21:48:44Mat4hi all
21:48:57Araqalelos: the latter
21:49:29alelosAraq: cheers
21:49:46MyMindthere is any roadmap for Nim?
21:50:03Araqekarlso-: speaking from some experience here: I bet you don't use any 'ref' for your HttpException
21:51:53ekarlso-https://bpaste.net/show/9d143be63e69 Araq #245
21:53:32Araqekarlso-: try this: let e = (ref HttpException)(exc)
21:54:05ekarlso-that worked!
21:54:22*tgkokk quit (Excess Flood)
21:55:11AraqMyMind: https://github.com/Araq/Nim/wiki/Roadmap
21:55:41*tgkokk joined #nim
21:55:52MyMindand date aprox for 1.0?
21:56:16superfuncdom96: any idea how to get an if/else expression working in an anonymous proc?
21:56:36*tgkokk quit (Client Quit)
21:57:26BlaXpirit_superfunc, why bother him personally?
21:57:41superfunche worked on the futures module
21:57:56superfuncwhich defines the (t:T) => expr syntax
21:58:24BlaXpirit_"to get an if/else expression working in an anonymous proc" seems trivial to me and unrelated to futures module
21:58:55superfuncit should be, but it isn't parsing, which is why I asked
21:59:20jpoirierThe global pragma can currently only be used when the type is inferred when initialized explicitly? E.g., this works: var a {.global.} = 0 but this doesn't var a: int {.global.} which gives Error: invalid indentation
22:00:05superfuncBlaXpirit_: It _is_ related to the futures module, because I'm using the syntactic construct defined in it for anonymous procs
22:00:08AraqMyMind: I planned within 3 months but with this many users all finding bugs ... well :-)
22:00:12BlaXpirit_jpoirier, have you tried shuffling that around?
22:00:20*repax_ joined #nim
22:00:21BlaXpirit_maybe {.global.} is in the wrong spot
22:00:36MyMindheheheh Araq I'm just turning fan of Nim
22:00:49superfuncBlaXpirit_: see http://nim-lang.org/future.html
22:00:53superfuncfirst macro defines
22:01:04BlaXpirit_lol
22:01:06jpoirierBlaCpirit_: yup, but let me try it again...
22:01:06ekarlso-Araq: :P
22:01:09BlaXpirit_just why
22:01:16ekarlso-Araq: I think nim is way cool btw ^
22:01:19ekarlso-reminds me of py
22:01:31MyMindI come from python
22:01:33MyMind:D
22:01:46MyMindand its amazing
22:01:55ekarlso-MyMind: what u use py for ?
22:02:10MyMindummm scripting
22:02:26MyMindfor vfx compositing
22:02:28*repax quit (Ping timeout: 256 seconds)
22:02:33ekarlso-MyMind: ah, I use it for OpenStack services
22:02:37BlaXpirit_superfunc, it's just that there is a normal syntax for anonymous procs and this is just syntax sugar which I didn't know you were specifically referring to
22:02:38ekarlso-$dayjob$
22:02:48MyMindmost 3d and 2d programs comes with python bundled
22:03:12MyMindbtw talking about it Nim can interface python libs?
22:03:38jpoirierBlaXpirit_: okay, hadn't tried this var a {.global.}: int which worked
22:07:06superfuncBlaXpirit_: its all good. I had it working with the old syntax, its just that it would clean up my current task a lot
22:09:20ekarlso-Araq: uh, how can I insert NULL with nim ?
22:09:46*repax_ quit (Quit: repax_)
22:13:11BlaXpirit_ekarlso-, you're trying to waste time of an important person with a poorly-stated question
22:13:58*Trustable quit (Quit: Leaving)
22:16:36superfuncTake it easy with the question policing. At least be more polite if you feel the need to do that.
22:17:12def-Finally fixed the issue I had for days with async networking and 100% CPU: https://github.com/Araq/Nim/pull/1865
22:19:04alelosekarlso-: i believe nil works
22:21:05EXetoC*he's busy, and others can usually help with things
22:21:08EXetoCbetter c(:)|<
22:21:48superfuncyeah, I just want new people to always feel welcome here
22:22:42ekarlso-so, if a column can be NULL in sql, trying to insert "nil" fails
22:23:07ldleworkI think it is fair to discourage direct solicitation unless that person is some how uniquely contextualized to the question
22:23:29superfunctotally, but there is a good way to say that and a bad way
22:24:51superfuncsaying: "I'm not sure what you're asking, could you clarify?" is more helpful. Then, if it is obvious(by being in the tutorial, manual or stdlib docs, we can teach them where to look.
22:25:04alelosekarlso-: this sounds library dependant. For C libraries that except pointers nil works for example.
22:25:52Araqdef-: cool. I fixed the GC bug.
22:26:04ekarlso-what's a tool again for browsing sqlite here that someone mentioned ?
22:26:14ldleworksuperfunc: I agree. Be warned though, its a slightly sharp community and as long is no one is being personally offensive I think that sharpness is here to stay :)
22:26:39superfuncI've been around nim for over a year, trust me, I know lol
22:26:44ldleworkhaha okay ^_^
22:27:21alelosekarlso-: nim library you mean or just a tool? If the later, SQLite manager firefox extension is quite good
22:30:37ekarlso-meh, trying to figure out how to specify a NULL when inserting..
22:31:10ekarlso-let query = db_sqlite.sql("INSERT INTO packages (name, description, license, web, maintainer) VALUES (?, ?, ?, ?, ?)")
22:31:14ekarlso-let id = db_sqlite.insertId(conn, query, pkg.name, nil, pkg.license, pkg.web, pkg.maintainer) < will blow up
22:31:59Araqekarlso-: I told you we need to update the db_* modules
22:32:16ekarlso-Araq: ah, sorry forgot -,,-
22:33:32ekarlso-Araq: anyway to get it to NULL ?
22:35:14Araqekarlso-: 'nil' should do that, what's the error msg?
22:36:22ekarlso-Error: internal error: wrong instantiated type!
22:36:59Araqnice.
22:37:07Araqtry string(nil) then
22:37:12Araq(and report it!)
22:37:56ekarlso-Error: internal error: wrong instantiated type!
22:38:01ekarlso-ehm, wrong place
22:38:44*chroem joined #nim
22:40:55chroemSo, coming from Java, how would I go about making globally scoped variables that my procedures can access without having to take them as arguments?
22:41:20ekarlso-Araq: then it goes invalid storage access :(
22:41:22MyMindanyone using NimLime ?
22:43:04MyMindaccording to this autocomplete should get completions from compiler but don't seems to work for me https://github.com/Varriount/NimLime
22:43:52AraqMyMind: idetools is completely broken and I'm working on it.
22:44:02MyMindoh
22:44:12*renesac joined #nim
22:44:13Araqit used to work, I think I broke it with 0.9.6
22:44:24MyMindidetools are generic for all IDE's ?
22:44:28Araqyes
22:44:44MyMindoh ty
22:44:48aleloschroem: use the {.global.} pragma
22:44:56MyMindI hope it gets fixed then
22:45:11ekarlso-i'm asserting that that too is broken
22:45:20*hakand joined #nim
22:45:26Araqwell we have 2 threads on the forum talking about nothing else
22:46:53chroemalelos:Thanks. I'll go over all the pragmas, then.
22:47:36aleloschroem: http://nim-lang.org/manual.html#global-pragma in this example it is used the other way around but works like you want as well
22:47:50*alexruf quit (Quit: Textual IRC Client: www.textualapp.com)
22:47:56Araqchroem: not sure why .global has been suggested. you declare a top level var and access it from the proc
22:48:07Araqvar global = 45
22:48:15Araqproc p() = echo global
22:48:24*renesac quit (Ping timeout: 244 seconds)
22:48:30*renesac_ joined #nim
22:48:44*yglukhov__ quit (Quit: Be back later ...)
22:50:10alelosAraq: is it wrong though? I think it makes it clear for other developers about the intentions, I like that
22:50:53Araqalelos: it wasn't introduced for redundancy
22:52:37*renesac_ quit (Ping timeout: 240 seconds)
22:52:53*renesac_ joined #nim
22:55:38Mat4probably redundancy lead to flexibility (like freedom of choice) with the drawback of increased language complexity
22:57:52ekarlso-https://github.com/Araq/Nim/issues/1866 < there's a bug for you, hope it's ok
22:58:19*renesac__ joined #nim
22:58:30*renesac_ quit (Ping timeout: 250 seconds)
23:01:42EXetoCAraq: well, if the purpose is to access it from that proc only then why not
23:01:47*superfunc[mobile joined #nim
23:02:52*renesac__ quit (Ping timeout: 244 seconds)
23:03:00*renesac_ joined #nim
23:03:16AraqEXetoC: that's a variable with global lifetime then and local scope. not necessarily a "global" variable but the term is ambiguous
23:03:25renesac_for some reason I'm suddenly unable to use irc
23:03:45renesac_it connects, but I can't see nor write anything
23:04:20renesac_anyway: MyMind: https://github.com/micklat/NimBorg
23:05:14MyMindoh renesac_ starring it
23:05:16MyMind:D
23:06:54renesac_chroem: do you want to make a global variable, or simple the equivalent of a variable seen by all procs from a class?
23:08:17*cyraxjoe quit (Ping timeout: 240 seconds)
23:09:11renesac_that is part of the state of some object?
23:10:03*MightyJoe joined #nim
23:11:01ekarlso-so what, getcontent doesn't work over ssl..
23:11:33jpoirier {.global.} just creates a static proc variable, you use it in a proc. It's the same as a C static variable inside a function, where the variable keeps its value between proc/function invocations. Correct?
23:12:21Araqjpoirier: almost. global also means it's initialized before ordinary globals
23:13:51jpoirierAraq: nice. that's good to know, thanks
23:16:21jpoirierAraq: doh! the language doc says what you stated but missed i missed the init part...so much to learn...
23:18:22*chroem quit (Ping timeout: 246 seconds)
23:24:38*Demon_Fox joined #nim
23:27:25*adam_s quit (Quit: Leaving)
23:31:16*adam_s joined #nim
23:36:08*bluemanshoe quit (Quit: leaving)
23:36:33MyMindAraq: idetools are like this? https://github.com/Hackerpilot/DCD
23:37:35adam_sSo I'm working on a flychecker for nim (available here: https://github.com/ALSchwalm/flycheck-nim/), and I was wondering if anyone can think of any multilne error messages
23:38:02adam_sso far I can only think of those generated by erroneous calls to overloaded functions
23:38:51adam_sbut I'm pretty new to the language, so I'm sure there are some involving template instantiation or something
23:39:36Araqadam_s: lot's of. most famous is likely 'illformed AST' which then pretty prints whatever AST it wants
23:40:15adam_shmm, are all of the mult-line rrors terminated by a blank line?
23:40:20adam_s*errors
23:40:39*alelos quit (Quit: WeeChat 1.0.1)
23:41:57Araqadam_s: we'll make the errors JSON for the tooling
23:42:10Araqthe tester has the same problem
23:42:22MyMindI just asked on #textmate for a bundle and someone started to port the sublime one :)
23:42:36*Mat4 left #nim (#nim)
23:45:13adam_sAraq: alright, so error output is going to get an overhaul in the future?
23:45:44Araqadam_s: in the near future, yes. :-)
23:46:01adam_scool, thanks
23:47:02renesac_what happened to those cool documentation interfaces that filwit (?) was doing?
23:47:12renesac_the main site was renovated, but the documentation only got a new css
23:50:34Araqrenesac_: filwit is still with us, but has no time to work on it
23:51:15renesac_too bad, it looked cool from the previews he gave