00:00:07 | flaviu | s/data/date |
00:00:28 | * | z1y joined #nim |
00:01:45 | dom96 | BlaXpirit_: yes |
00:01:48 | dom96 | where else? |
00:01:58 | BlaXpirit_ | well it's not literally nimrod language |
00:02:00 | BlaXpirit_ | nim |
00:02:01 | goobles | whats wrong with that link |
00:02:02 | BlaXpirit_ | D: |
00:02:07 | BlaXpirit_ | dom96, anyway, i've reported |
00:02:17 | dom96 | thx |
00:03:52 | flaviu | goobles: It contains the nim source code and documentation is is public to google, so it screws with the google results |
00:04:29 | goobles | oh so google thinks alex made nimrod |
00:04:36 | goobles | i gotcha |
00:05:40 | flaviu | Anyone have any idea how to fix "Error: only a 'ref object' can be raised"? |
00:05:45 | flaviu | I'm using newException |
00:05:57 | * | irrequietus quit () |
00:06:41 | BlaXpirit_ | give code |
00:07:17 | flaviu | `raise newException(SyntaxError, $ctx.idx & ": Syntax error, malformed string")`, ` SyntaxError* = ref object of Exception` |
00:08:53 | flaviu | hmm, weird |
00:09:05 | flaviu | if I change `ref object` to `object`, it works |
00:09:10 | BlaXpirit_ | lol |
00:09:39 | BlaXpirit_ | flaviu, https://github.com/Araq/Nim/blob/master/lib/system.nim#L2144 |
00:09:53 | flaviu | yep |
00:09:54 | BlaXpirit_ | so hmm... it's like ref ref |
00:09:56 | BlaXpirit_ | D: |
00:10:24 | flaviu | IMO that template is mis-implemented, but whatever. |
00:12:58 | Demos_ | don't you want to throw value types? |
00:13:12 | Demos_ | or is that c++ paranoia speaking |
00:16:02 | BlaXpirit_ | value types only is good |
00:16:16 | BlaXpirit_ | 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:16 | dom96 | flaviu: I'd suggest raising it like so: raise SyntaxError(msg: ...) |
00:30:27 | dom96 | That's how it should be done for every exception IMO |
00:31:00 | flaviu | I hadn't even considered that, thanks! |
00:31:11 | flaviu | And I certainly agree. |
00:31:59 | flaviu | With 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:14 | dom96 | I guess I should write this up on Github as an issue. |
00:39:23 | dom96 | but I need sleep |
00:39:40 | flaviu | How about a `proc replace*(s: string, sub: Regex, by: proc(matches: array[MaxSubpatterns, string]): string): string`? |
00:40:53 | dom96 | that would be nice |
00:51:20 | * | z1y quit (Ping timeout: 265 seconds) |
01:03:46 | reactormonk | Anyone 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:33 | flaviu | dom96: Done: https://github.com/Araq/Nim/pull/1855 |
01:31:46 | def- | reactormonk: i was thinking about it, or making something like ragel in nim, but won't have time for it probably |
01:32:58 | reactormonk | def-, 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:31 | def- | reactormonk: how do you want to get that into nim? |
01:35:00 | flaviu | Interesting bug: https://github.com/Araq/Nim/issues/1856 |
01:35:41 | no_name | weird 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:54 | flaviu | no_name: `TInternalState` can never be null. It's not a pointer. |
01:40:20 | flaviu | maybe I misunderstood the question. |
01:40:41 | yenic | Nim 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:03 | yenic | Statically typed with generics and type classes, rich macro system, Pythonic syntax, multi-methods |
01:41:06 | yenic | unabashedly imperative. |
01:41:25 | * | MyMind joined #nim |
01:41:30 | no_name | I have a TZStream record and I want to see if the state field is null or not |
01:42:14 | yenic | What Python3 Should Have Been.™ |
01:42:16 | flaviu | doesn't `myZStream.state == nil` work? |
01:42:26 | no_name | that's what I was wondering - that works? |
01:42:34 | * | Sembei quit (Ping timeout: 265 seconds) |
01:42:46 | flaviu | sure it does. `state` is suffixed with a `*`, so it's exported. |
01:42:46 | Demos_ | it probably will, value types are initialized to binary zero |
01:43:02 | no_name | thanks |
01:45:57 | * | Var|Mobile quit (Ping timeout: 265 seconds) |
02:00:18 | reactormonk | def-, 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:56 | reactormonk | yenic, static python? Not anytimes oon. |
02:02:37 | def- | reactormonk: yeah, that's the easiest way. I'd prefer if ragel could output Nim directly |
02:03:06 | reactormonk | def-, 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:17 | flaviu | It looks like nim doesn't provide a timedate parser |
02:11:39 | def- | indeed, write one please |
02:12:07 | flaviu | dom96 won't like it, it'll be using PCRE |
02:12:11 | reactormonk | A good datetime library would be a good project |
02:12:29 | flaviu | yep, but I already have a project backlog |
02:12:44 | * | brson quit (Ping timeout: 244 seconds) |
02:12:50 | flaviu | Nim has a y10000 bug :( |
02:13:09 | * | yglukhov__ joined #nim |
02:13:24 | flaviu | y10k is catchier! |
02:14:16 | MyMind | what is a y10000 bug? |
02:14:53 | flaviu | http://en.wikipedia.org/wiki/Year_2000_problem |
02:14:55 | * | saltylicorice joined #nim |
02:15:01 | flaviu | but in the year 10000 |
02:15:42 | MyMind | hahaha |
02:15:55 | reactormonk | we have plans for nim. |
02:16:34 | MyMind | a timedate parser is a must ;) |
02:17:02 | flaviu | Time travelers will also have problems, they won't be able to use their programs more than 10000 years BCE |
02:17:32 | flaviu | I'm going to write a RFC 3339 parser |
02:17:49 | * | yglukhov__ quit (Ping timeout: 255 seconds) |
02:18:42 | MyMind | I tried before using printf "proc printf(formatstr: cstring) {.importc: "printf", varargs.}" w/o success |
02:18:50 | reactormonk | def-, did you ever tinker with ragel? |
02:19:03 | flaviu | MyMind: Not a surprise, printf is made for printing. ;) |
02:19:10 | def- | reactormonk: nope! |
02:19:12 | MyMind | and? |
02:19:16 | flaviu | did you mean sscanf? |
02:19:44 | MyMind | I wanted to use it instead of strfmt |
02:20:28 | flaviu | Ah, I thought you were saying that you tried to parse dates with printf |
02:21:04 | MyMind | and another question is to avoid a new line with echo? |
02:21:44 | flaviu | MyMind: `stdout.write(...)` |
02:25:24 | MyMind | I miss more tutorials about nim |
02:25:49 | def- | MyMind: write one! |
02:26:02 | MyMind | lol I'm the student |
02:26:08 | MyMind | I just started using it |
02:26:11 | flaviu | MyMind: http://nim-by-example.github.io/ |
02:26:28 | flaviu | http://nim-lang.org/theindex.html |
02:26:29 | MyMind | I tried that and the official one |
02:26:49 | flaviu | What did you find lacking? |
02:26:50 | MyMind | besides that is hard to find anything else |
02:27:10 | MyMind | more examples |
02:27:31 | * | saltylicorice quit (Ping timeout: 244 seconds) |
02:27:58 | def- | I have a big collection of examples, but they're not in tutorial form |
02:28:54 | MyMind | def-: are on github? |
02:29:00 | flaviu | Rosetta Code |
02:29:24 | MyMind | good point |
02:29:26 | def- | https://github.com/def-/nim-unsorted |
02:29:33 | def- | Yeah, I wrote many of the Rosetta Code ones |
02:30:48 | MyMind | wow |
02:30:52 | MyMind | that's huge |
02:30:54 | MyMind | :D |
02:30:56 | MyMind | ty |
02:30:58 | def- | And I have a really exciting new example |
02:31:19 | def- | (have to make a pull request to Nim to make it work still) |
02:31:32 | def- | https://github.com/def-/nim-unsorted/blob/master/rcrename.nim |
02:31:48 | def- | interacting with the terrible mediawiki API |
02:32:18 | MyMind | :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:41 | Varriount|Laptop | Meep? |
03:17:16 | MyMind | there are plans to support c++ like c in the future? |
03:17:32 | EXetoC | there is a C++ generator |
03:17:49 | flaviu | MyMind: I'm not a representative of the project, but I believe so. http://buildbot.nim-lang.org/waterfall |
03:18:00 | MyMind | is possible to import c++ libraries ? |
03:18:03 | flaviu | note that the compiler is regularly tested with C++ |
03:20:26 | * | z1y quit (Quit: Leaving.) |
03:21:24 | MyMind | backend means bidirectional interaction? |
03:23:07 | flaviu | It means the compiler emits C++, so I'd assume so. I've never used it. |
03:24:53 | adam_s | if by import, you mean link against, I'm not sure how that would work. C++ has no standard abi |
03:25:01 | adam_s | but I'm no expert and may be wrong |
03:25:42 | MyMind | interfacing I mean |
03:26:04 | MyMind | use c++ functions inside Nim |
03:27:11 | adam_s | Well, 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:56 | adam_s | If 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:09 | adam_s | which would require a good bit of a c++ compiler I think |
03:29:02 | flaviu | adam_s: The C++ backend emits C++ code that gets compiled by the C++ compiler. |
03:29:18 | adam_s | I understand, he's asking about calling C++ from nim |
03:29:48 | adam_s | being able to emit c++ code does not imply nim can call c++ |
03:30:49 | flaviu | Ah, I see. |
03:30:52 | willwillson | nim has importcpp and importc |
03:31:52 | MyMind | yup importing c++ code into nim |
03:32:03 | reactormonk | hum, no idea how to approach that ragel stuff |
03:33:36 | MyMind | I would like to see something like openframeworks for nim |
03:34:20 | MyMind | it'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:47 | adam12 | Can 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:22 | flaviu | `Error: type mismatch: got (typedesc[R]) but expected 'typedesc[R]'` |
03:51:24 | flaviu | wat? |
03:52:16 | flaviu | adam12: try sort[string] |
03:52:40 | flaviu | also, `for word, count in ...` is perfectly valid. |
03:53:39 | adam12 | sort[string] gave same error |
03:54:44 | flaviu | adam12: Bug report please. |
03:57:36 | adam12 | Thanks 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:25 | yenic | reactormonk: I was talking about Nim |
04:31:42 | onionhammer | MyMind 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:08 | dv- | so int is always pointer sized? |
07:18:49 | dts|pokeball | ? |
07:18:58 | dts|pokeball | do you mean always has the same size as a pointer? |
07:19:19 | dv- | 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:12 | Triplefox | i 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:39 | dts|pokeball | sorry dv- im not aware if it is or not |
07:36:51 | dts|pokeball | Mimbus, |
07:36:52 | dts|pokeball | oops |
07:38:14 | dts|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:17 | Mimbus | Triplefox: eval.nim(3, 14) Error: array expects two type parameters |
07:38:20 | dts|pokeball | oops |
07:39:17 | dts|pokeball | how do you use array again? |
07:39:34 | Triplefox | array[0..3] |
07:39:37 | Triplefox | , int |
07:39:43 | * | yglukhov__ joined #nim |
07:40:20 | dts|pokeball | oh thats right |
07:40:38 | dts|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:41 | Mimbus | Triplefox: eval.nim(4, 5) Error: type mismatch: got (array[1..4, int]) |
07:40:44 | dts|pokeball | god damn |
07:40:49 | Triplefox | golly |
07:40:54 | dts|pokeball | never mind Triplefox ignore me |
07:41:03 | Triplefox | well i think i see the idea anyway |
07:41:03 | dts|pokeball | im not used to these arrays |
07:44:10 | * | yglukhov__ quit (Ping timeout: 250 seconds) |
07:44:38 | Triplefox | .eval let src: array[0..3, int] = [1,2,3,4]; var det = src; echo(det) |
07:44:41 | Mimbus | Triplefox: eval.nim(5, 5) Error: type mismatch: got (array[0..3, int]) |
07:45:01 | Triplefox | it's strange that it's doing that because i just compiled something really similar |
07:45:33 | Triplefox | .eval let src = [1,2,3,4]; var det = src; echo(det) |
07:45:36 | Mimbus | Triplefox: eval.nim(5, 5) Error: type mismatch: got (Array constructor[0..3, int]) |
07:45:58 | Triplefox | yeah ok w/e |
07:46:59 | dts|pokeball | i wonder if there is a rosetta code article on this? |
07:48:17 | dts|pokeball | http://rosettacode.org/wiki/Arrays#Nim |
07:48:21 | dts|pokeball | it looks like you can |
07:48:57 | Triplefox | it works in the actual case i want to use it for and not in the test case |
07:49:36 | Triplefox | this is no good, i'm going to figure this out |
07:50:26 | Triplefox | okay, i think i see |
07:50:35 | Triplefox | .eval let a = [1]; echo(a) |
07:50:38 | Mimbus | Triplefox: eval.nim(4, 5) Error: type mismatch: got (Array constructor[0..0, int]) |
07:50:45 | Triplefox | .eval let a = [1]; |
07:50:49 | Mimbus | Triplefox: <no output> |
07:50:53 | Triplefox | compiles! |
07:50:55 | dts|pokeball | oh hold on |
07:51:11 | dts|pokeball | .eval let a = [1];echo(a) |
07:51:14 | Mimbus | dts|pokeball: eval.nim(4, 5) Error: type mismatch: got (Array constructor[0..0, int]) |
07:51:16 | dts|pokeball | .eval let a = [1];echo($a) |
07:51:19 | * | Mimbus quit (Excess Flood) |
07:51:23 | dts|pokeball | oops |
07:51:25 | * | Mimbus joined #nim |
07:51:32 | Triplefox | golly |
07:53:19 | dts|pokeball | .eval let a = [1];echo($a) |
07:53:21 | Mimbus | dts|pokeball: eval.nim(4, 5) Error: type mismatch: got (Array constructor[0..0, int]) |
07:53:27 | dts|pokeball | fml |
07:53:29 | Triplefox | it works if i print one index at a time |
07:53:36 | dts|pokeball | as it should |
07:53:42 | Triplefox | .eval let a = [1]; echo(a[0]) |
07:53:43 | dts|pokeball | maybe flaviu hasnt updated his compiler? |
07:53:45 | Mimbus | Triplefox: 1 |
07:53:59 | Triplefox | i am getting this locally too |
07:53:59 | dts|pokeball | $a should print the whole array though |
07:54:16 | dts|pokeball | .eval let a = [1];echo( $ a ) |
07:54:19 | Mimbus | dts|pokeball: eval.nim(4, 6) Error: type mismatch: got (Array constructor[0..0, int]) |
07:54:25 | dts|pokeball | .eval let a = [1];echo( ($a) ) |
07:54:28 | Mimbus | dts|pokeball: eval.nim(4, 7) Error: type mismatch: got (Array constructor[0..0, int]) |
07:54:39 | dts|pokeball | i give up |
07:56:56 | Triplefox | .eval let a = [1]; echo(@a) |
07:56:59 | Mimbus | Triplefox: @[1] |
07:57:09 | Triplefox | that works, although it's kind of terrible |
07:57:32 | dts|pokeball | TIL @ |
07:58:45 | Triplefox | i'm still a little unclear about the sequence/array relationship, i don't know what the costs are of going between them |
07:59:59 | dts|pokeball | im 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:08 | dts|pokeball | a map with a predefined range of values, that is |
08:01:05 | Triplefox | my 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:00 | Triplefox | when 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:55 | Triplefox | also realized i could use 0..high(ary) instead of 0..len(ary)-1 |
08:19:03 | dts|pokeball | hehe |
08:19:03 | * | BitPuffin joined #nim |
08:19:15 | dts|pokeball | the first version of BillsPC used that |
08:19:22 | dts|pokeball | then i remembered .high |
08:20:04 | Triplefox | i'm used to haxe numeric iterators where (n in 0...2) means [0, 1] |
08:20:26 | Triplefox | so 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:50 | Triplefox | woo, 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:38 | tane | good 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:22 | flaviu | :Q |
11:42:30 | flaviu | oops, 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:38 | arc619 | Hi guys, hope everyone is well :) |
12:50:07 | goobles | hello mr nimrod |
12:50:23 | arc619 | just had a quick question about memory management with Nim |
12:51:08 | goobles | it uses a gc ;0 |
12:51:43 | arc619 | okay 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:01 | arc619 | this has an int and float within it |
12:53:14 | arc619 | I'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:06 | arc619 | The list is a seq of Link* = object, which has within it source*: MemoryCell and dest*: MemoryCell |
12:54:10 | arc619 | my question is |
12:54:35 | arc619 | What happens if I go: for link in links.mitems: swap(link.source, link.dest) |
12:54:57 | arc619 | I am trying to flip the direction of the source and dest within the link obj |
12:55:32 | arc619 | but 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:40 | arc619 | what would the swap do in this case? |
12:56:23 | arc619 | I hope that makes sense - not so easy to copy a code fragment to irc :) |
12:56:42 | * | willwillson joined #nim |
12:56:47 | dom96 | hello arc619, welcome! :) |
12:56:52 | goobles | dom knows |
12:56:59 | goobles | i haven't a clue |
12:57:08 | arc619 | thankyou dom96 :) |
12:57:09 | goobles | nimrod does magic with its values |
12:58:21 | dom96 | arc619: The values would stay on the stack as opposed to the heap (with ref). |
12:58:21 | * | z1y joined #nim |
12:58:21 | arc619 | for reference mitems is just normal items but defined with a var like: iterator mitems*[T](a: var seq[T]): var T {.inline.} = |
12:58:28 | dom96 | or at least that's my guess :) |
12:59:37 | goobles | its in a container right? |
12:59:45 | arc619 | yes :) |
12:59:47 | goobles | this seq thing |
12:59:50 | dom96 | although if it's in a seq then it might already be on the heap |
13:00:06 | dom96 | To be honest I'm not certain. |
13:00:13 | arc619 | so I'm basically calling swap on two objects within a seq of objects NOT defined as a ref. |
13:00:29 | goobles | i saw an article covering ref * etc but now I can't find it |
13:01:02 | dom96 | I think when you add it to the seq it gets copied. |
13:01:13 | flaviu | arc619: Can you post it on gist or pastebin? It might be easier to understand that way. |
13:01:48 | arc619 | sure, just a tic |
13:07:26 | * | noam_ quit (Quit: Leaving) |
13:07:27 | arc619 | first time using pastebin :D Hopefully this is visible http://pastebin.com/cjzskTq3 |
13:08:04 | flaviu | https://gist.github.com/ is much nicer, but that worked fine. |
13:08:35 | arc619 | ah ok flaviu thanks, noted :) |
13:11:35 | flaviu | So `swap` is a compiler intrinsic ("magic"). It's implemented here: <https://github.com/Araq/Nim/blob/devel/compiler/ccgexprs.nim#L1359> |
13:12:15 | goobles | i knew it involved magic |
13:13:03 | goobles | does the * mean pointer? |
13:13:07 | flaviu | So from what I can tell, that code is equivalent to manually writing out the temporary swap variable. |
13:13:33 | flaviu | goobles: No, it means it's exported. <http://nim-lang.org/manual.html#export-marker> |
13:13:38 | arc619 | the * makes the functions visible from other units |
13:14:18 | goobles | source*: MemoryCell (is this a function? why is this thing exported?) |
13:14:37 | goobles | like a public variable? |
13:14:52 | arc619 | source is a public field of MemoryCell type |
13:15:05 | arc619 | if there were no * it'd be a private field IIUC |
13:15:09 | goobles | ic |
13:15:17 | goobles | so it must be by value |
13:15:23 | goobles | so ur swapping values |
13:15:57 | arc619 | so 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:54 | flaviu | arc619: 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:06 | arc619 | haha fair play :) |
13:18:08 | arc619 | From 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:10 | flaviu | `MemoryCell` isn't a reference either, it's a value. typedef struct { size_t id; CellData data; } MemoryCell; |
13:19:24 | goobles | he went for the c |
13:19:34 | arc619 | lol |
13:19:50 | arc619 | sometimes it helps to see it as c to understand under the hood |
13:19:51 | goobles | it has deferred ref counting with a fallback tracer i think |
13:20:51 | arc619 | so 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:18 | arc619 | what would happen if I had objects within memory cell? |
13:21:33 | goobles | it copies the whole memory cell i'm sure |
13:21:35 | arc619 | I forgot to mention that CellData is just a float atm |
13:22:03 | flaviu | arc619: https://gist.github.com/flaviut/4993451c283a96984d70 |
13:22:05 | arc619 | (actually it's a distinct float) |
13:22:11 | goobles | but that is a tiny object so just copy it all u want |
13:22:46 | arc619 | cor flaviu, well cool we can see the compiler internals :) |
13:23:15 | flaviu | yep. You have to use --embedSrc if you want to get the helpful nim lines |
13:23:34 | arc619 | tho i dont really understand that code XD |
13:23:51 | * | rpag joined #nim |
13:24:02 | goobles | ur code as nim c |
13:24:09 | goobles | isn't it purty |
13:24:12 | * | rpag quit (Remote host closed the connection) |
13:24:47 | goobles | flaviu knows this lang really good |
13:25:27 | arc619 | honestly nim is just really awesome in general |
13:25:49 | BlaXpirit | how to efficiently convert iteration over Runes into a string? |
13:26:10 | BlaXpirit | like, I could make a seq of Runes and then convert |
13:26:17 | flaviu | arc619: refresh the page, I've modified it to get rid of the `line()`s |
13:26:26 | arc619 | ah ok :) |
13:28:13 | arc619 | so this would copy the mem? (*link_88222).Source = (*link_88222).Dest; |
13:28:27 | arc619 | my C is very rusty |
13:28:31 | goobles | yes it would |
13:28:45 | goobles | just copying a int and a float |
13:28:48 | flaviu | Yes, the C compiler can probably figure out how to make it fast too. |
13:28:49 | goobles | no biggie |
13:28:51 | arc619 | :) |
13:29:24 | arc619 | that's really cool, thankyou :) |
13:29:57 | arc619 | so 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:08 | flaviu | arc619: Refresh the page for the code when using refs |
13:30:54 | flaviu | unsureAsgnRef can be found here: <https://github.com/Araq/Nim/blob/devel/lib/system/gc.nim#L260> |
13:31:08 | * | noam joined #nim |
13:32:09 | goobles | that code gen could be better, needs move semantics |
13:32:20 | goobles | rar ar |
13:33:31 | goobles | flav do u use nim for work? |
13:34:05 | arc619 | flaviu you are incredibly helpful! There's nothing quite like seeing under the hood to know what's going on :) |
13:34:27 | ekarlso- | how does one make exceptions in nim ? |
13:35:02 | goobles | do something illegal |
13:35:23 | arc619 | So 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:10 | goobles | its probably not on the stack given that its in a seq |
13:36:31 | goobles | looks like u do this: raise newException(OSError, "the request to the OS failed") |
13:36:50 | flaviu | arc619: Yes, local variables are on the stack, refs are on the heap. |
13:37:07 | flaviu | a seq is always on the heap |
13:37:25 | arc619 | goobles yes of course, silly me was confusing stack and heap! |
13:37:45 | * | jefus__ joined #nim |
13:38:40 | flaviu | ekarlso-: 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:58 | goobles | nim seems interesting, i don't really understand its generic programming stuff much though |
13:46:29 | goobles | if it is powerful or not |
13:47:44 | * | z1y quit (Ping timeout: 250 seconds) |
13:49:24 | ekarlso- | flaviu: can u add a property to a Exception ? |
13:52:18 | flaviu | Sure. 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:35 | goobles | does nim have function overloading? |
13:53:08 | flaviu | goobles: yep, look at the TOC here: <http://nim-lang.org/system.html> |
13:53:16 | goobles | since it is ref counted it might actually be useable for games hu |
13:53:31 | ekarlso- | meh, jester is so sad atm with doing 502 for all errors :'( |
13:53:35 | ekarlso- | dom96: fix fix! |
14:04:46 | * | tgkokk quit (Ping timeout: 255 seconds) |
14:06:07 | dom96 | ekarlso-: Why don't you try to fix it? :P |
14:07:44 | ekarlso- | dom96: ... got enough to do with packages :P |
14:07:56 | ekarlso- | dom96: q though |
14:08:03 | ekarlso- | HttpCode is what ? |
14:08:05 | ekarlso- | a int ? |
14:08:25 | * | BitPuffin joined #nim |
14:08:34 | dom96 | an enum |
14:09:47 | flaviu | dom96: An int would be better. Unknown status codes are still valid status codes. |
14:10:03 | ekarlso- | dom96: where are they defined ? |
14:10:21 | ekarlso- | Ah, I see |
14:10:55 | ekarlso- | hmm, how does one defined the headers which are an openarray ? |
14:12:12 | dom96 | flaviu: There is nothing stopping you sending whatever you want to the socket. |
14:12:59 | * | gokr2 joined #nim |
14:13:10 | flaviu | Only convenience stops me. :) |
14:13:17 | * | gokr_ quit (Ping timeout: 240 seconds) |
14:13:32 | ekarlso- | how u make a new openarray ? :p |
14:14:21 | flaviu | ekarlso-: http://nim-lang.org/manual.html#open-arrays |
14:17:39 | dom96 | I'd rather be type safe than to allow anything and make mistakes :P |
14:18:07 | ekarlso- | so what, let headers = openarray[tuple[key, value: string]() ? |
14:19:00 | gokr2 | no, you dont create openarrays |
14:19:21 | gokr2 | its just usrd as param type |
14:19:30 | gokr2 | use a seq |
14:19:36 | flaviu | dom96: 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:59 | flaviu | type safety might mean using `range[100..999]` though, that'd be a valid argument. |
14:20:43 | flaviu | "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:00 | ekarlso- | var headers = @[(key: "content-type", value: "application/json")] |
14:21:03 | ekarlso- | hmmm |
14:21:03 | gokr2 | afaik openarray just means" seq or array" |
14:21:31 | gokr2 | so procs can accept both |
14:22:59 | dom96 | flaviu: For now I am getting the common cases working. Jester hasn't even had a single release yet. |
14:23:03 | ekarlso- | hmmm, dom96 /home/karlsone/.nimble/pkgs/jester-0.1.0/jester.nim(342, 33) Error: undeclared identifier: 'v' booooo |
14:25:11 | ekarlso- | dom96: is the version of jester foobard ? |
14:25:45 | dom96 | ? |
14:27:12 | ekarlso- | https://github.com/dom96/jester/blob/master/jester.nim#L296 < trying to use this |
14:27:42 | dom96 | and how are you trying to use it? |
14:27:56 | ekarlso- | resp(Http500, @[(key: "content-type", value: "application/json")], @{"error": "500"}) |
14:28:17 | * | seantallen joined #nim |
14:29:17 | dom96 | That's not the right syntax. |
14:29:23 | ekarlso- | really ? |
14:29:26 | dom96 | remove the @ |
14:29:31 | dom96 | {"key": ...} |
14:30:14 | dom96 | http://nim-lang.org/manual.html#table-constructor |
14:30:39 | ekarlso- | resp(Http500, @[("content-type", "application/json")], "foo") < like that then ;) |
14:30:45 | ekarlso- | ahhh |
14:30:48 | ekarlso- | doh |
14:32:20 | * | seantallen quit (Client Quit) |
14:32:31 | ekarlso- | 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:18 | jh32 | hi |
14:36:04 | ekarlso- | meh dom96 care for a bit help here ? :/ |
14:36:29 | ekarlso- | https://bpaste.net/show/cb41055bb573 |
14:36:58 | dom96 | you're once again doing it wrong |
14:37:08 | dom96 | let headers = {"key": "content-type", "value": "application/json"} |
14:38:22 | dv- | web programmers :} |
14:38:29 | ekarlso- | yeah ? I've tried let headers = @[{"content-type": "application/json"}] as well |
14:43:39 | dom96 | remove the @[] |
14:44:07 | ekarlso- | yeah, and then it still fails on the error I said before (: |
14:44:14 | ekarlso- | /home/karlsone/.nimble/pkgs/jester-0.1.0/jester.nim(342, 33) Error: undeclared identifier: 'v' |
14:44:23 | ekarlso- | 'v' is never declared there |
14:44:46 | dom96 | It needs to be inside a route. |
14:44:54 | dom96 | You can't just put 'resp' anywhere. |
14:45:10 | ekarlso- | yeah, I've done that |
14:45:25 | ekarlso- | https://bpaste.net/show/81e1ff8c7b7d dom96 |
14:47:57 | dom96 | hrm, can you change line 301 of jester to: response.data = (TCActionSend, code, headers.newStringTable, content) |
14:47:58 | dom96 | ? |
14:49:05 | ekarlso- | that fixed it :) |
14:49:15 | ekarlso- | it seems u have the error in trunk too btw |
14:49:15 | dom96 | cool |
14:50:15 | dom96 | Fixed. |
14:53:03 | ekarlso- | hmmm |
14:53:14 | ekarlso- | dom96: could u provide a halt that takes headers ? :D |
14:53:54 | ekarlso- | dang, there is already ! |
14:53:56 | dom96 | there is one |
14:54:42 | ekarlso- | packages.nim(230, 12) Error: type mismatch: got (bool) but expected 'FutureBase' |
14:54:45 | ekarlso- | hmmm |
14:57:17 | dom96 | hm, on halt? |
14:57:26 | ekarlso- | yea |
14:57:30 | ekarlso- | 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:22 | ekarlso- | any idea on what that is about dom96 ? |
15:01:26 | dom96 | ekarlso-: Works ehre though https://github.com/dom96/jester/blob/master/tests/alltest.nim#L8 |
15:01:29 | dom96 | *here |
15:01:51 | ekarlso- | dom96: https://bpaste.net/show/f3b724eda7a4 < shouldn't that work ? |
15:03:10 | dom96 | does it work outside the except? |
15:03:33 | ekarlso- | yeah :/ |
15:03:42 | dom96 | Then that's the bug unfortunately. |
15:03:59 | * | saltylicorice joined #nim |
15:04:11 | ekarlso- | dom96: bug in nim or jester? |
15:04:19 | dom96 | I think this may actually be an async macro bug. |
15:05:12 | ekarlso- | dom96: where u want me to report it ? |
15:05:51 | dom96 | Report it in jester for now |
15:06:11 | dom96 | You can get around it by setting a variable inside the except btw |
15:06:21 | ekarlso- | dom96: setting which variable ? |
15:06:29 | dom96 | just create a new variable and set it |
15:06:34 | dom96 | var errorHappened = false |
15:06:42 | dom96 | try: ... except: errorHappened = true |
15:06:46 | dom96 | if errorHappened: halt ... |
15:08:52 | * | jefus joined #nim |
15:10:19 | ekarlso- | that's so evil odm |
15:10:21 | ekarlso- | dom96: . |
15:10:34 | dom96 | Why? |
15:11:02 | ekarlso- | dom96: that you can't halt inside a except |
15:11:40 | * | saltylicorice quit (Ping timeout: 265 seconds) |
15:11:52 | dom96 | it's not the end of the world |
15:12:52 | dom96 | ekarlso-: You don't have to report it |
15:12:57 | dom96 | I reproduced it with asyncdispatch |
15:13:01 | ekarlso- | kk |
15:13:01 | * | yglukhov__ quit (Quit: Be back later ...) |
15:19:46 | ekarlso- | 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:07 | i6o6ep | Hi guys! Have already using Nim? Have any comparsion to java? |
15:28:54 | * | gokr_ joined #nim |
15:29:35 | flaviu | Nim is used for the forum, the compiler, and the package manager. |
15:30:39 | * | gokr2 quit (Ping timeout: 245 seconds) |
15:30:58 | flaviu | The hasn't been a comparison to java made, but Nim encourages a procedural style |
15:31:44 | flaviu | You won't be using virtual methods or inheritance nearly as often |
15:32:21 | ekarlso- | flaviu: how can u set a property on a exception before doing newException ? |
15:32:27 | ekarlso- | like a HttpCode |
15:32:31 | i6o6ep | Seems like it more KISS than java |
15:33:25 | flaviu | Yes, definitely. |
15:34:10 | flaviu | Although Nim the language does have areas of unexpected complexity sometimes. |
15:40:01 | seantallen | flaviu: such as? |
15:41:51 | flaviu | macros and `generic x`s |
15:42:37 | flaviu | I'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:35 | flaviu | ekarlso-: Oops, forgot about your question. |
16:01:04 | flaviu | You assign the result from newException to a variable |
16:01:10 | flaviu | and mess with the fields taht way |
16:22:23 | * | MrOrdinaire joined #nim |
16:26:20 | * | arc619 quit (Quit: Page closed) |
16:27:42 | MrOrdinaire | hi, I'd like to contribute to the nim language project. is there any good first bug to dive into for beginners? |
16:28:11 | no_name | what's the best way to debug nim programs? specifically is there a way to step through C functions that it calls? |
16:28:30 | no_name | I'm getting a vague error from a library and trying to figure out what is causing it |
16:29:46 | no_name | I tried using mingw's gdb on a compiled nim exe on windows and it didn't recognize it as an executable |
16:33:37 | flaviu | no_name: You can use a debugger like gdb with nim |
16:33:51 | flaviu | Make sure that your library is compiled with `-g` or whatever is equvilent |
16:34:09 | * | i6o6ep joined #nim |
16:34:11 | flaviu | And compile your nim program with --linedir:on --debuginfo |
16:34:37 | * | ma3a quit (Ping timeout: 255 seconds) |
16:34:48 | flaviu | If you get a segfault, use --passC:-fsanitize=address --passL:-fsanitize=address |
16:35:14 | dom96 | MrOrdinaire: Take a look at the ones labelled "Easy" |
16:36:34 | MrOrdinaire | dom96: thanks |
16:36:54 | * | wan joined #nim |
16:38:15 | MrOrdinaire | dom96: is there any protocol to announce ownership of the bug? |
16:38:25 | * | jefus_ joined #nim |
16:38:55 | dom96 | MrOrdinaire: Not really. If you want to announce it just comment, but most of the time that's not necessary. |
16:39:07 | MrOrdinaire | dom96: thanks |
16:39:10 | dom96 | Unless 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:31 | MrOrdinaire | okay |
16:43:58 | MrOrdinaire | is there any reason why csources is not a submodule inside the Nim project? |
16:44:32 | * | def- quit (Ping timeout: 250 seconds) |
16:46:03 | dom96 | Araq dislikes submodules |
16:46:19 | MrOrdinaire | does he say why? |
16:46:42 | MrOrdinaire | I don't know of a good reason why :P |
16:48:02 | novist | dom96 you are smart man here.. think what im talking about here is doable? http://forum.nim-lang.org/t/717 |
16:48:57 | MrOrdinaire | novist: cool stuff! |
16:49:35 | * | def- joined #nim |
16:50:06 | dom96 | novist: Thanks but I'm not sure I'm the right man to suggest the best way to do this. |
16:50:30 | novist | still 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:33 | dom96 | novist: I am hurt :( You said on the forum that Aporia is a wasted effort :( |
17:02:16 | novist | yeah truth hurts.. :( |
17:02:19 | * | novist taps dom96 on the back |
17:03:06 | dom96 | In any case I disagree, I use Aporia and so does Araq. |
17:03:47 | * | Var|Mobile joined #nim |
17:03:58 | novist | because 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:21 | MrOrdinaire | is there any way to install head Aporia with nimble? |
17:10:56 | MrOrdinaire | the doc for nimble doesn't make it easy at all... |
17:10:58 | dom96 | nimble install aporia@#head |
17:13:30 | MrOrdinaire | dom96: thanks |
17:14:23 | * | gmpreussner__ joined #nim |
17:25:57 | * | MrOrdinaire quit () |
17:30:26 | * | willwillson joined #nim |
17:38:22 | vegai | hm, |
17:38:23 | vegai | [vegai@zombiekani ~]$ ./.nimble/bin/aporia |
17:38:23 | vegai | could not load: libgtksourceview-2.0.so(|.0) |
17:38:47 | vegai | oh, I actually don't have that lib yet, doh |
17:38:58 | vegai | there 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:28 | reactormonk | How 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:55 | ekarlso- | 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:23 | ekarlso- | 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:41 | ldlework | Digital 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:11 | ldlework | Just noticed I have an email from them from yesterday |
20:01:16 | * | BlaXpirit_ joined #nim |
20:01:26 | Matthias247 | rofl |
20:01:35 | reactormonk | ldlework, nice work |
20:01:50 | reactormonk | ldlework, 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:52 | ekarlso- | anyone ? ^ |
20:14:06 | ekarlso- | if anyone could be so kind :P |
20:15:55 | * | hakand quit (Quit: Be back later ...) |
20:16:17 | wan | ldlwork: do you have stats or logfiles/goaccess? What's the amount of visits that makes them take it down? |
20:16:58 | wan | -visits +hits* |
20:17:19 | BlaXpirit_ | what is the convention on copy-constructors? |
20:17:34 | BlaXpirit_ | how should they be named, etc |
20:17:48 | ekarlso- | just trying to come up with a error handling pattern for it |
20:18:08 | BlaXpirit_ | ekarlso-, i looked, don't know what to change |
20:19:02 | Araq | hey guys I'm back. what did I miss? |
20:19:48 | ldlework | I guess it is outgoing traffic |
20:19:54 | ldlework | so I guess my server got pwned |
20:20:10 | BlaXpirit_ | :s |
20:20:27 | jpoirier | if 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:44 | BlaXpirit_ | jpoirier, uhh probably? why not try? |
20:21:44 | jpoirier | BlaXpirit_: i did but there's no indication from the compiler that it was used even when using --listFullPaths |
20:22:01 | BlaXpirit_ | jpoirier, add a debug echo?? |
20:22:12 | jpoirier | roger |
20:26:13 | ekarlso- | BlaXpirit_: except packages.nim(25, 5) Error: undeclared identifier: 'Http404=' |
20:26:25 | BlaXpirit_ | wat |
20:27:33 | * | yglukhov__ quit (Quit: Be back later ...) |
20:27:44 | BlaXpirit_ | I really don't know enough to help "/ |
20:27:48 | BlaXpirit_ | :/ |
20:34:44 | ldlework | yeah my server is definitely owned |
20:36:08 | ldlework | not sure how I'm going to get the data out |
20:39:14 | ekarlso- | oh well :p |
20:39:17 | ekarlso- | guess i'll wait :P |
20:40:25 | * | yglukhov__ joined #nim |
20:44:51 | * | alelos joined #nim |
20:47:47 | BlaXpirit_ | http://nim-lang.org/manual.html#identifier-construction this is not nearly descriptive enough |
20:48:05 | BlaXpirit_ | it's just such an arbitrary thing |
20:48:14 | BlaXpirit_ | I can't construct any of the identifiers that I've tried |
20:48:27 | BlaXpirit_ | let's say I want `"new" cls` |
20:48:40 | BlaXpirit_ | says identifier expected, but found '`(system.new|system.new|system.new|...) Seq`' |
20:49:46 | * | tgkokk quit (Ping timeout: 244 seconds) |
20:49:56 | BlaXpirit_ | but if i do let name = "new" and then use `name cls`, it somehow no longer sees it as a variable |
20:49:59 | BlaXpirit_ | this is so stupid |
20:51:06 | ldlework | BlaXpirit_: I honestly have no idea what you're talking about |
20:51:15 | BlaXpirit_ | identifier-construction |
20:51:21 | ldlework | well I got that much |
20:51:39 | BlaXpirit_ | I have {.immediate.} template with argument cls: expr |
20:51:50 | BlaXpirit_ | I want to construct "new"cls |
20:52:09 | BlaXpirit_ | Thing -> newThing |
20:54:06 | * | tgkokk joined #nim |
20:55:22 | ekarlso- | ldlework: do U have an idea ? |
20:55:32 | ldlework | ekarlso-: about what? |
20:55:43 | ldlework | BlaXpirit_: ah I think I tried that too and it didn't work |
20:55:45 | ekarlso- | https://bpaste.net/show/f1baf5b1542c #23 and #134 is there a better pattern for that ? |
20:55:49 | ekarlso- | packages.nim(25, 5) Error: undeclared identifier: 'Http404=' |
20:56:28 | ldlework | better pattern for what? |
20:56:36 | ldlework | ekarlso-: please ask me an actual question |
20:56:59 | ekarlso- | to do error handling |
20:57:31 | ldlework | ekarlso-: does it work? |
20:57:46 | ekarlso- | noo... |
20:57:57 | ekarlso- | I get the error I pasted when compiling and I dunno why |
20:58:30 | no_name | If 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:41 | ekarlso- | there doesn't to be a clear way to do it atm with jester -,,- |
21:00:11 | * | Epic|gmpreussner joined #nim |
21:01:02 | ldlework | ekarlso-: the code is complaining that you don't have an assignment operator defined for the Http404 type |
21:01:25 | ldlework | I think |
21:02:00 | ekarlso- | ldlework: how u fix that then ? |
21:02:30 | ldlework | ekarlso-: where does Http404 come from? |
21:02:50 | ekarlso- | http://nim-lang.org/asynchttpserver.html |
21:02:57 | ekarlso- | HttpCode |
21:04:06 | ldlework | ekarlso-: but you haven't imported asynchttpserver |
21:04:25 | ekarlso- | ldlework: jester does export HttpCode |
21:04:33 | ekarlso- | which comes from iut |
21:04:42 | ldlework | But this thing is complaining specifically about Http404 |
21:05:35 | ekarlso- | well |
21:05:45 | ekarlso- | if I import that, it goes: lib/core/macros.nim(273, 20) Error: ambiguous identifier: 'Request' -- use a qualifier |
21:07:05 | ldlework | so do so |
21:07:28 | ldlework | oh |
21:07:29 | ldlework | no idea |
21:07:39 | no_name | I'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:00 | no_name | and make web requests that return strings that have binary data in them? |
21:08:03 | BlaXpirit_ | no_name, they are null terminated just for the sake of it |
21:08:14 | BlaXpirit_ | length is stored |
21:08:27 | BlaXpirit_ | but 0 is there just in case u want to use it to interface with C |
21:08:27 | no_name | ok... if I cast them to cstring, to they get clipped? |
21:08:35 | BlaXpirit_ | probably |
21:08:49 | BlaXpirit_ | well it depends on how C wants to handle them, pretty sure |
21:08:56 | no_name | ok.. how do I send a buffer of chars to a c function when it contains nulls in it? |
21:09:05 | no_name | that's probably the source of my problem |
21:09:17 | BlaXpirit_ | no_name, you should ask the C function why it's so stupid |
21:09:24 | ldlework | both strings and cstrings are null-terminated |
21:09:28 | no_name | do I use cast[ptr array[1..X,char]](mystring) |
21:09:30 | BlaXpirit_ | if you can't do it in C itself, why are you asking here |
21:09:37 | no_name | no_name: the C function is zlib |
21:09:37 | ldlework | cstrings are *obviously* null terminated, think about it - they're cstrings |
21:09:43 | no_name | no that makes sense |
21:09:55 | * | tgkokk quit (Ping timeout: 244 seconds) |
21:10:00 | no_name | the question is how do I convert a string with nulls in it into a char * |
21:10:10 | BlaXpirit_ | you don't |
21:10:18 | BlaXpirit_ | there is an implicit conversion even |
21:10:25 | BlaXpirit_ | what is the problem? |
21:10:36 | no_name | it's truncating the binary string at the first null |
21:10:45 | no_name | at least I think it is |
21:10:53 | BlaXpirit_ | how can you be sure? |
21:11:04 | BlaXpirit_ | it is not that unlikely, i suppose |
21:11:08 | ldlework | no_name: I don't think you can have strings in c which actually container nulls as opposed to being ternimanted with them |
21:11:22 | BlaXpirit_ | ldlework, sure u can if u pass length separately |
21:11:23 | no_name | you can have char arrays, which can have nulls |
21:11:30 | no_name | yeah, ala memcpy |
21:11:47 | no_name | this is to feed a buffer of gzipped data to be decompressed |
21:11:55 | no_name | the gzipped data has nulls |
21:12:02 | gokr_ | my ffi article has some stuff about cstring etc |
21:12:53 | no_name | I 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:57 | no_name | gokr: URL? |
21:13:26 | gokr_ | goran |
21:13:29 | gokr_ | oops |
21:13:57 | gokr_ | goran.krampe.se/category/nim |
21:14:03 | * | superfunc joined #nim |
21:14:19 | gokr_ | check the one about ffi |
21:14:31 | BlaXpirit_ | 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:38 | Araq | BlaXpirit_: so report it properly. |
21:17:43 | BlaXpirit_ | 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:55 | BlaXpirit_ | Araq, but I can't be sure if it's actually bugs! |
21:18:08 | BlaXpirit_ | maybe I just don't get it |
21:18:32 | Araq | even if that would be true, it's valuable feedback either way |
21:18:43 | BlaXpirit_ | "we value your feedback" |
21:18:44 | Araq | and I'll close it and explain to you why it's not supported |
21:19:11 | ekarlso- | Araq: u got a clue on my thing ? |
21:19:13 | Araq | but it surely looks there is at least 1 bug here |
21:22:27 | ekarlso- | ok, i'l |
21:22:31 | ekarlso- | 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:37 | Araq | ekarlso-: sorry I don't know. |
21:24:42 | BlaXpirit_ | 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:17 | ekarlso- | ok then, i'll skip any errorhandling for now then in the packages program.. |
21:25:25 | Araq | BlaXpirit_: sure, just use a macro instead |
21:25:31 | BlaXpirit_ | . . |
21:25:39 | BlaXpirit_ | I'm not ready |
21:25:54 | BlaXpirit_ | it's not worth it, anyway |
21:27:26 | * | tgkokk joined #nim |
21:28:48 | Araq | ekarlso-: dom96 will help you when he shows up |
21:29:00 | ekarlso- | :P |
21:29:12 | ekarlso- | hopefully |
21:32:27 | ekarlso- | Araq: so for some reason doing e.code = code makes it go foobar |
21:32:40 | ekarlso- | changing the "code" var to statusCode or so makes it work |
21:33:09 | BlaXpirit_ | Araq, identifier construction is barely documented at all |
21:33:15 | BlaXpirit_ | but i found a wokaround |
21:33:19 | superfunc | hey everyone |
21:33:22 | BlaXpirit_ | insert a random whitespace |
21:33:25 | ldlework | hi superfunc |
21:33:53 | superfunc | nothing beats a lazy sunday writing some nim |
21:34:08 | BlaXpirit_ | https://github.com/Araq/Nim/issues/1863 |
21:34:15 | BlaXpirit_ | `ne w cls` seriously |
21:35:21 | ldlework | BlaXpirit_: maybe it is that all whitespace is removed from identifier creation? |
21:35:32 | ldlework | BlaXpirit_: and that's how you construct names, using variables? |
21:35:35 | ldlework | by using spaces? |
21:35:39 | ldlework | try `new cls` |
21:35:44 | BlaXpirit_ | ldlework, I don't understand what you're saying |
21:35:51 | BlaXpirit_ | of course i've tried `new cls` |
21:35:51 | ldlework | read it again? |
21:35:55 | ldlework | BlaXpirit_: ok |
21:36:34 | Araq | BlaXpirit_: that one is trivial to fix though |
21:36:55 | BlaXpirit_ | Araq, but you know what would've been better? allowing the quotes syntax that I imagined |
21:37:03 | BlaXpirit_ | (but these quotes are obviously ignored somehow) |
21:37:39 | BlaXpirit_ | because fixing this partially still probably won't allow constructing some particular identifiers |
21:37:41 | Araq | BlaXpirit_: please add that as a comment to your bug report |
21:38:17 | Araq | we might indeed change identifier construction syntax |
21:38:22 | BlaXpirit_ | for sure...... |
21:38:26 | BlaXpirit_ | would be good |
21:38:49 | Araq | I think it's too 'clever' right now |
21:38:51 | jpoirier | I 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:08 | ekarlso- | 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:29 | Araq | ekarlso-: you need to convert that to your exception type |
21:40:34 | BlaXpirit_ | thanks for your attention |
21:41:00 | ekarlso- | Araq: really, how ? |
21:41:18 | Araq | jpoirier: is PluginStartup and then the rest of the callbacks called from the same thread? |
21:41:57 | JohnnyLee | Hi everyone. I'm new to Nim. I |
21:42:13 | ekarlso- | Araq: how you convert an exception ? |
21:42:20 | JohnnyLee | 've spent a few days reading the documentation, but I'm having a hard time getting a few things to work. |
21:42:26 | Araq | jpoirier: 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:36 | JohnnyLee | Is there an simple way to see the expanded code from a template or macro? |
21:42:37 | Araq | ekarlso-: MyExceptionType(e).someField |
21:43:25 | BlaXpirit_ | JohnnyLee, hehe I sure could use that. seconded. |
21:43:26 | jpoirier | Araq: 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:53 | Araq | JohnnyLee: yeah and I'm quite sure Tut2 tells you how. |
21:44:01 | ekarlso- | Araq: ... packages.nim(245, 40) Error: conversion from ref Exception to HttpException is invalid |
21:44:05 | JohnnyLee | OK. I'll have a look. |
21:44:07 | ekarlso- | can't say that this is easy :P |
21:44:22 | Araq | ekarlso-: so your HttpException is not a 'ref'? |
21:44:39 | ekarlso- | it is.. |
21:44:54 | Araq | ekarlso-: inherited from Exception? |
21:45:21 | ekarlso- | Araq: sorry, object of Exception |
21:45:51 | ekarlso- | yeye, i'll wait for dom96 instead.. |
21:46:02 | ekarlso- | can't seem to get anywhere useful for error handling |
21:46:46 | alelos | when 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:59 | ekarlso- | Araq: no clue on what i'm doing wrong ? |
21:48:14 | superfunc | Araq: is there any restriction on the type of expression that can appear in an anonymous proc? |
21:48:38 | * | Mat4 joined #nim |
21:48:44 | Mat4 | hi all |
21:48:57 | Araq | alelos: the latter |
21:49:29 | alelos | Araq: cheers |
21:49:46 | MyMind | there is any roadmap for Nim? |
21:50:03 | Araq | ekarlso-: speaking from some experience here: I bet you don't use any 'ref' for your HttpException |
21:51:53 | ekarlso- | https://bpaste.net/show/9d143be63e69 Araq #245 |
21:53:32 | Araq | ekarlso-: try this: let e = (ref HttpException)(exc) |
21:54:05 | ekarlso- | that worked! |
21:54:22 | * | tgkokk quit (Excess Flood) |
21:55:11 | Araq | MyMind: https://github.com/Araq/Nim/wiki/Roadmap |
21:55:41 | * | tgkokk joined #nim |
21:55:52 | MyMind | and date aprox for 1.0? |
21:56:16 | superfunc | dom96: any idea how to get an if/else expression working in an anonymous proc? |
21:56:36 | * | tgkokk quit (Client Quit) |
21:57:26 | BlaXpirit_ | superfunc, why bother him personally? |
21:57:41 | superfunc | he worked on the futures module |
21:57:56 | superfunc | which defines the (t:T) => expr syntax |
21:58:24 | BlaXpirit_ | "to get an if/else expression working in an anonymous proc" seems trivial to me and unrelated to futures module |
21:58:55 | superfunc | it should be, but it isn't parsing, which is why I asked |
21:59:20 | jpoirier | The 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:05 | superfunc | BlaXpirit_: It _is_ related to the futures module, because I'm using the syntactic construct defined in it for anonymous procs |
22:00:08 | Araq | MyMind: I planned within 3 months but with this many users all finding bugs ... well :-) |
22:00:12 | BlaXpirit_ | jpoirier, have you tried shuffling that around? |
22:00:20 | * | repax_ joined #nim |
22:00:21 | BlaXpirit_ | maybe {.global.} is in the wrong spot |
22:00:36 | MyMind | heheheh Araq I'm just turning fan of Nim |
22:00:49 | superfunc | BlaXpirit_: see http://nim-lang.org/future.html |
22:00:53 | superfunc | first macro defines |
22:01:04 | BlaXpirit_ | lol |
22:01:06 | jpoirier | BlaCpirit_: yup, but let me try it again... |
22:01:06 | ekarlso- | Araq: :P |
22:01:09 | BlaXpirit_ | just why |
22:01:16 | ekarlso- | Araq: I think nim is way cool btw ^ |
22:01:19 | ekarlso- | reminds me of py |
22:01:31 | MyMind | I come from python |
22:01:33 | MyMind | :D |
22:01:46 | MyMind | and its amazing |
22:01:55 | ekarlso- | MyMind: what u use py for ? |
22:02:10 | MyMind | ummm scripting |
22:02:26 | MyMind | for vfx compositing |
22:02:28 | * | repax quit (Ping timeout: 256 seconds) |
22:02:33 | ekarlso- | MyMind: ah, I use it for OpenStack services |
22:02:37 | BlaXpirit_ | 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:38 | ekarlso- | $dayjob$ |
22:02:48 | MyMind | most 3d and 2d programs comes with python bundled |
22:03:12 | MyMind | btw talking about it Nim can interface python libs? |
22:03:38 | jpoirier | BlaXpirit_: okay, hadn't tried this var a {.global.}: int which worked |
22:07:06 | superfunc | BlaXpirit_: 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:20 | ekarlso- | Araq: uh, how can I insert NULL with nim ? |
22:09:46 | * | repax_ quit (Quit: repax_) |
22:13:11 | BlaXpirit_ | 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:36 | superfunc | Take it easy with the question policing. At least be more polite if you feel the need to do that. |
22:17:12 | def- | Finally fixed the issue I had for days with async networking and 100% CPU: https://github.com/Araq/Nim/pull/1865 |
22:19:04 | alelos | ekarlso-: i believe nil works |
22:21:05 | EXetoC | *he's busy, and others can usually help with things |
22:21:08 | EXetoC | better c(:)|< |
22:21:48 | superfunc | yeah, I just want new people to always feel welcome here |
22:22:42 | ekarlso- | so, if a column can be NULL in sql, trying to insert "nil" fails |
22:23:07 | ldlework | I think it is fair to discourage direct solicitation unless that person is some how uniquely contextualized to the question |
22:23:29 | superfunc | totally, but there is a good way to say that and a bad way |
22:24:51 | superfunc | saying: "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:04 | alelos | ekarlso-: this sounds library dependant. For C libraries that except pointers nil works for example. |
22:25:52 | Araq | def-: cool. I fixed the GC bug. |
22:26:04 | ekarlso- | what's a tool again for browsing sqlite here that someone mentioned ? |
22:26:14 | ldlework | superfunc: 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:39 | superfunc | I've been around nim for over a year, trust me, I know lol |
22:26:44 | ldlework | haha okay ^_^ |
22:27:21 | alelos | ekarlso-: nim library you mean or just a tool? If the later, SQLite manager firefox extension is quite good |
22:30:37 | ekarlso- | meh, trying to figure out how to specify a NULL when inserting.. |
22:31:10 | ekarlso- | let query = db_sqlite.sql("INSERT INTO packages (name, description, license, web, maintainer) VALUES (?, ?, ?, ?, ?)") |
22:31:14 | ekarlso- | let id = db_sqlite.insertId(conn, query, pkg.name, nil, pkg.license, pkg.web, pkg.maintainer) < will blow up |
22:31:59 | Araq | ekarlso-: I told you we need to update the db_* modules |
22:32:16 | ekarlso- | Araq: ah, sorry forgot -,,- |
22:33:32 | ekarlso- | Araq: anyway to get it to NULL ? |
22:35:14 | Araq | ekarlso-: 'nil' should do that, what's the error msg? |
22:36:22 | ekarlso- | Error: internal error: wrong instantiated type! |
22:36:59 | Araq | nice. |
22:37:07 | Araq | try string(nil) then |
22:37:12 | Araq | (and report it!) |
22:37:56 | ekarlso- | Error: internal error: wrong instantiated type! |
22:38:01 | ekarlso- | ehm, wrong place |
22:38:44 | * | chroem joined #nim |
22:40:55 | chroem | So, 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:20 | ekarlso- | Araq: then it goes invalid storage access :( |
22:41:22 | MyMind | anyone using NimLime ? |
22:43:04 | MyMind | according to this autocomplete should get completions from compiler but don't seems to work for me https://github.com/Varriount/NimLime |
22:43:52 | Araq | MyMind: idetools is completely broken and I'm working on it. |
22:44:02 | MyMind | oh |
22:44:12 | * | renesac joined #nim |
22:44:13 | Araq | it used to work, I think I broke it with 0.9.6 |
22:44:24 | MyMind | idetools are generic for all IDE's ? |
22:44:28 | Araq | yes |
22:44:44 | MyMind | oh ty |
22:44:48 | alelos | chroem: use the {.global.} pragma |
22:44:56 | MyMind | I hope it gets fixed then |
22:45:11 | ekarlso- | i'm asserting that that too is broken |
22:45:20 | * | hakand joined #nim |
22:45:26 | Araq | well we have 2 threads on the forum talking about nothing else |
22:46:53 | chroem | alelos:Thanks. I'll go over all the pragmas, then. |
22:47:36 | alelos | chroem: 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:56 | Araq | chroem: not sure why .global has been suggested. you declare a top level var and access it from the proc |
22:48:07 | Araq | var global = 45 |
22:48:15 | Araq | proc 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:10 | alelos | Araq: is it wrong though? I think it makes it clear for other developers about the intentions, I like that |
22:50:53 | Araq | alelos: it wasn't introduced for redundancy |
22:52:37 | * | renesac_ quit (Ping timeout: 240 seconds) |
22:52:53 | * | renesac_ joined #nim |
22:55:38 | Mat4 | probably redundancy lead to flexibility (like freedom of choice) with the drawback of increased language complexity |
22:57:52 | ekarlso- | 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:42 | EXetoC | Araq: 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:16 | Araq | EXetoC: that's a variable with global lifetime then and local scope. not necessarily a "global" variable but the term is ambiguous |
23:03:25 | renesac_ | for some reason I'm suddenly unable to use irc |
23:03:45 | renesac_ | it connects, but I can't see nor write anything |
23:04:20 | renesac_ | anyway: MyMind: https://github.com/micklat/NimBorg |
23:05:14 | MyMind | oh renesac_ starring it |
23:05:16 | MyMind | :D |
23:06:54 | renesac_ | 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:11 | renesac_ | that is part of the state of some object? |
23:10:03 | * | MightyJoe joined #nim |
23:11:01 | ekarlso- | so what, getcontent doesn't work over ssl.. |
23:11:33 | jpoirier | {.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:21 | Araq | jpoirier: almost. global also means it's initialized before ordinary globals |
23:13:51 | jpoirier | Araq: nice. that's good to know, thanks |
23:16:21 | jpoirier | Araq: 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:33 | MyMind | Araq: idetools are like this? https://github.com/Hackerpilot/DCD |
23:37:35 | adam_s | So 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:02 | adam_s | so far I can only think of those generated by erroneous calls to overloaded functions |
23:38:51 | adam_s | but I'm pretty new to the language, so I'm sure there are some involving template instantiation or something |
23:39:36 | Araq | adam_s: lot's of. most famous is likely 'illformed AST' which then pretty prints whatever AST it wants |
23:40:15 | adam_s | hmm, are all of the mult-line rrors terminated by a blank line? |
23:40:20 | adam_s | *errors |
23:40:39 | * | alelos quit (Quit: WeeChat 1.0.1) |
23:41:57 | Araq | adam_s: we'll make the errors JSON for the tooling |
23:42:10 | Araq | the tester has the same problem |
23:42:22 | MyMind | I just asked on #textmate for a bundle and someone started to port the sublime one :) |
23:42:36 | * | Mat4 left #nim (#nim) |
23:45:13 | adam_s | Araq: alright, so error output is going to get an overhaul in the future? |
23:45:44 | Araq | adam_s: in the near future, yes. :-) |
23:46:01 | adam_s | cool, thanks |
23:47:02 | renesac_ | what happened to those cool documentation interfaces that filwit (?) was doing? |
23:47:12 | renesac_ | the main site was renovated, but the documentation only got a new css |
23:50:34 | Araq | renesac_: filwit is still with us, but has no time to work on it |
23:51:15 | renesac_ | too bad, it looked cool from the previews he gave |