00:02:04 | * | aaaa quit (Ping timeout: 246 seconds) |
00:05:34 | * | MrBlaise quit (Remote host closed the connection) |
00:06:45 | def- | https://www.quora.com/Which-organisations-are-using-the-Nim-programming-language |
00:09:29 | Varriount|Remote | def-: :/ |
00:10:04 | Varriount|Remote | def-: That's the wrong sort of question. |
00:10:39 | * | kumul joined #nim |
00:11:25 | * | kumul left #nim (#nim) |
00:11:38 | def- | I didn't ask it, I just found it! |
00:18:36 | Varriount|Remote | def-: Unfortunately, getting Nim used in an organization is something of a chicken-and-egg problem. |
00:22:45 | * | gmt joined #nim |
00:25:04 | Varriount|Remote | Hello gmt |
00:26:25 | * | NimBot joined #nim |
00:33:31 | * | tinAndi quit (Quit: ChatZilla 0.9.91.1 [Firefox 34.0/20141125180439]) |
00:33:37 | dom96 | I like the answer to this https://www.quora.com/Is-the-Nimrod-language-a-joke-or-for-something |
00:36:22 | gmpreussner_ | i had mixed feelings about 'nimrod'. i think 'nim' is awesome. |
00:37:35 | gmpreussner_ | one syllable, and unlike any other language :) |
00:39:25 | * | gmt quit (Quit: Page closed) |
00:39:34 | Triplefox | working on a nim version of this gl example...i have it to where it compiles and runs and the render loop shows a black screen https://github.com/jckarter/hello-gl/blob/master/hello-gl.c |
00:39:44 | Triplefox | hopefully this won't be horrible to figure out |
00:40:17 | * | jefus__ is now known as jefus |
00:40:25 | dom96 | gmpreussner_: Yeah, I think it was a good call to rename it. |
00:44:38 | * | no_name quit (Quit: leaving) |
00:48:44 | MyMind | exist any lunar phase algorithm for nim? |
00:52:29 | flaviu | MyMind: Write it and make a Nimble package! |
00:52:36 | flaviu | http://www.ben-daglish.net/moon.shtml looks like a useful resource |
00:52:42 | MyMind | hahahaha |
00:53:08 | MyMind | man I tried to figure out how to calculate the chinese new year |
00:53:31 | MyMind | http://www.math.nus.edu.sg/aslaksen/calendar/cal.pdf |
00:55:47 | EXetoC | :o |
00:56:47 | Forty-3 | how do I explicitly call the proc I'm overriding? |
00:57:22 | Forty-3 | for example, I want to implement a $ proc for an enum which returns the 3rd letter of the normal $ |
00:58:05 | EXetoC | a more specialized proc should take priority |
00:58:12 | EXetoC | oh |
00:58:19 | EXetoC | system.`$`(...)? |
00:58:21 | Forty-3 | which is my problem, since I need the less specialized one |
00:59:04 | * | jefus_ joined #nim |
00:59:35 | Forty-3 | EXetoC: thanks, that works |
00:59:49 | * | jefus quit (Ping timeout: 245 seconds) |
01:00:03 | EXetoC | great |
01:01:49 | Varriount|Remote | Triplefox: The only hard thing about opengl and nimrod is getting the types rights. Other than that, things should be ok. |
01:01:56 | Varriount|Remote | *nim |
01:03:01 | EXetoC | I always manage to screw up buffers |
01:03:05 | Triplefox | Varriount|Remote: yeah, earlier I had an simple immediate mode demo going, it's just there's a lot more to screw up once I switch to the programmable pipeline stuff |
01:03:38 | Varriount|Remote | Triplefox: Yeah. |
01:03:59 | Triplefox | 1,000,001 colored cubes https://vine.co/v/OwFDpVb1itp |
01:04:36 | EXetoC | remember that int for example is not a fixed size. use OpenGL types (some of which don't really need to be used) |
01:04:45 | EXetoC | 1.GLfoo for example |
01:05:04 | EXetoC | Triplefox: realtime? :p |
01:05:32 | Triplefox | yeah, 60hz...they're in a display list |
01:05:39 | EXetoC | that's probably possible these days |
01:05:42 | EXetoC | yeah, batching |
01:06:32 | Triplefox | I'm pretty sure at least one or two of these api bindings are mixing up a GLuint with a GLint and making me cast things, but I'm not gonna try sorting it out right now |
01:07:12 | Triplefox | after all maybe that's what's getting me the black screen :p |
01:07:44 | EXetoC | not the bindings for nim I hope |
01:08:55 | Triplefox | i'm still reorganizing things in the code, I'll be able to make some conclusions later |
01:09:56 | EXetoC | maybe glut or something, but the opengl module was automatically generated |
01:11:25 | Triplefox | okay...i'm working with sdl and sdl_image and i did have to add some windows dll boilerplate to the sdl_image binding |
01:12:22 | Triplefox | the gl stuff hasn't really given me trouble yet other than the GLtypes pollution |
01:13:19 | EXetoC | those might be examples of unnecessary aliases |
01:13:39 | Varriount|Remote | Forty-3: Use a module qualifier for the proc |
01:14:07 | EXetoC | Varriount|Remote: too late! c(:)|< |
01:14:24 | Varriount|Remote | :< |
01:19:26 | MyMind | does nim support variable-- ? |
01:20:32 | Varriount|Remote | .eval var x = 7;x--;echo(x) |
01:20:36 | Mimbus | Varriount|Remote: eval.nim(5, 4) Error: invalid indentation |
01:20:55 | * | yglukhov__ joined #nim |
01:21:27 | Varriount|Remote | .eval var x = 7;echo(x) |
01:21:31 | Mimbus | Varriount|Remote: 7 |
01:21:41 | Varriount|Remote | .eval var x = 7;x--;echo(x) |
01:21:44 | Mimbus | Varriount|Remote: eval.nim(5, 4) Error: invalid indentation |
01:21:51 | def- | .eval var x = 7;dec x;echo x |
01:21:53 | EXetoC | it's confusing |
01:21:54 | Mimbus | def-: 6 |
01:22:14 | Varriount|Remote | MyMind: So, no, however there's 'inc' and 'dec' |
01:22:21 | EXetoC | .eval var x = 1;dec x; dec x, 3; x -= 3 |
01:22:23 | Mimbus | EXetoC: eval.nim(5, 4) Error: invalid indentation |
01:22:32 | EXetoC | right |
01:22:44 | EXetoC | .eval var x = 1;dec x;dec x, 3;x -= 3;echo(x) |
01:22:45 | MyMind | ok |
01:22:47 | Mimbus | EXetoC: -6 |
01:22:51 | Varriount|Remote | MyMind: It has to do with operators and precedence, if I recall correctly. |
01:25:28 | * | yglukhov__ quit (Ping timeout: 265 seconds) |
01:33:49 | Araq | can we stop this Mimbus spamming? you don't get the indentation right, live with it. |
01:34:14 | fowlmouth | MyMind, there is no postfix operators |
01:35:58 | Varriount|Remote | flaviu: Next suggestion for Mimbus: have it try to auto-correct the common indentation errors. |
01:36:15 | EXetoC | let's have a separate channel or allow code to be evaluated via private messages |
01:36:30 | Varriount|Remote | Perhaps, round down the number of spaces preceding a colon to an even number (or zero) |
01:37:38 | EXetoC | at least one succeeding space perhaps. seems more natural |
01:38:21 | flaviu | #nim-offtopic |
01:39:30 | * | sjiitr quit (Quit: Page closed) |
01:40:05 | flaviu | ugg, fine. I'll make indentation easier |
01:44:18 | MyMind | is possible to use anonymous functions on var assignment like xtra > 0.0 ? math.floor(xtra) : math.ceil(xtra - 1.0) ? |
01:44:18 | * | Mimbus quit (Read error: Connection reset by peer) |
01:44:25 | * | Mimbus joined #nim |
01:45:01 | EXetoC | alternative chars for ' ' for more visually distinct indents? |
01:45:03 | Varriount|Remote | MyMind: Huh? |
01:45:20 | EXetoC | anonymous? |
01:45:37 | EXetoC | let x = if true: 1 else: 0 |
01:45:41 | Varriount|Remote | MyMind: What do you mean by anonymous functions? |
01:45:44 | MyMind | yes |
01:45:58 | MyMind | lambdas? |
01:46:22 | MyMind | a conditional on var assignment in c are inline |
01:46:24 | MyMind | i think |
01:46:53 | Araq | MyMind: EXetoC just showed you the syntax |
01:49:21 | * | Mimbus quit (Remote host closed the connection) |
01:49:27 | * | Mimbus joined #nim |
01:49:34 | EXetoC | think of it like this: "let x = (if true: 1 else: 0)". the block is used as an expression in this case, so it returns a value (unlike a statement). it's syntactic sugar that does not introduce another proc (function). the same goes for C |
01:50:57 | flaviu | Ok guys, one space indentation is no longer enough, two spaces are needed |
01:51:12 | flaviu | .eval while false:; discard 1 |
01:51:15 | Mimbus | flaviu: eval.nim(4, 7) Error: invalid indentation |
01:51:17 | flaviu | .eval while false:; discard 1 |
01:51:20 | Mimbus | flaviu: <no output> |
01:51:22 | flaviu | see? |
01:51:50 | EXetoC | yeah |
01:52:27 | * | Etheco joined #nim |
01:53:55 | Triplefox | how do comments work with that...or do they |
01:54:25 | flaviu | it's just a dumb s/;/\n/ |
01:54:42 | Triplefox | ah, i guess that works |
01:54:44 | flaviu | .eval echo "this doesn't work; see?" |
01:54:47 | Mimbus | flaviu: eval.nim(3, 5) Error: closing " expected |
01:55:31 | flaviu | Although I could tokenize it if I really cared |
01:56:15 | Triplefox | i like having wide declaration lines where i declare several short symbolic names with a descriptive comment inlined adjacent it, but nim syntax forces me to write it tall |
01:56:33 | Triplefox | i guess i can adjust |
01:56:33 | flaviu | Triplefox: Can you post it in a gist? I'm curious. |
01:56:52 | Forty-3 | I get "fish.nim(11, 14) Error: illegal capture 'result'" when compiling http://ur1.ca/jap71 |
01:57:26 | Triplefox | an example from what i'm doing now https://gist.github.com/triplefox/fed309e16382dcfe5257 |
01:57:38 | flaviu | Forty-3: That's incredibly fishy. |
01:57:46 | Forty-3 | >.> |
01:57:48 | Triplefox | i'm testing out this hyper restricted naming style |
01:58:20 | Araq | Forty-3: the compiler for now doesn't allow capturing of 'result' use temporary variable as a workaround |
01:58:37 | Forty-3 | huh? |
01:58:57 | EXetoC | there's a capture there? |
01:59:03 | Forty-3 | so I should do "h.sort((x, y: deck.Card) => var tmp = cmp(ord(x.value), ord(y.value)))" ? |
01:59:58 | EXetoC | ok it's not explicit. preferably include the error message inline |
02:00:49 | Forty-3 | that... compiles but doesn't work |
02:01:05 | Forty-3 | I get back some unsorted hands |
02:01:14 | EXetoC | Forty-3: what he said, so introduce a temporary var, and then assign result to the value of it, or return the newly introduced var |
02:01:27 | EXetoC | ok |
02:01:28 | Araq | Forty-3: report it, it's weird either way |
02:01:39 | * | Demon_Fox joined #nim |
02:02:06 | Forty-3 | the sort proc does nothing, it seems http://ur1.ca/jap9f |
02:02:41 | Forty-3 | that's with "echo($player) player.sort() echo($player)" |
02:03:17 | Varriount|Remote | Forty-3: What happens when you use an actul procedure, rather than a macro? |
02:03:52 | EXetoC | omit the return type rather than specifying void |
02:04:10 | MyMind | to perform a modulo operation is mod(x,y) right? |
02:04:22 | Araq | x mod y |
02:04:35 | Araq | it's a binary operator (keyword) |
02:04:49 | Araq | or `mod`(x, y) if you want to |
02:05:00 | Forty-3 | Varriount: it works with http://ur1.ca/japac |
02:05:37 | Forty-3 | http://ur1.ca/japal is deck.nim, if you want to compile it |
02:07:24 | MyMind | Araq: ty that was driving me crazy |
02:07:44 | MyMind | somehow only accepted x mod y way |
02:09:40 | Varriount|Remote | Forty-3: What is the expected output? |
02:09:42 | EXetoC | or `mod`(x, y), if you really want to. the same goes for other operators |
02:10:10 | Forty-3 | Varriount: the two outputs should be different, as one is sorte and the other isn't |
02:10:38 | Forty-3 | if you comment line 15 and uncomment line 14, you will get the same output |
02:10:50 | Forty-3 | also: the ord()s don't do anything |
02:16:02 | * | jefus_ is now known as jefus |
02:17:18 | * | gmpreussner_ is now known as gmpreussner |
02:17:39 | * | Mimbus quit (Excess Flood) |
02:17:47 | * | Mimbus joined #nim |
02:18:25 | * | fabiok joined #nim |
02:18:42 | * | Mimbus quit (Excess Flood) |
02:18:49 | * | Mimbus joined #nim |
02:19:27 | * | Mimbus quit (Excess Flood) |
02:19:34 | * | Mimbus joined #nim |
02:20:46 | Forty-3 | Varriount: having problems compiling this bare-bones case http://ur1.ca/japgg |
02:20:56 | Forty-3 | test.nim(14, 3) Error: type mismatch: got (Container, proc (Container, Container): int{.gcsafe.} | proc (T, T): int | proc (string, string): int{.noSideEffect, gcsafe.}) |
02:20:57 | Forty-3 | but expected one of: |
02:20:57 | Forty-3 | test.sort(c: var Container) |
02:20:57 | Forty-3 | algorithm.sort(a: var openarray[T], cmp: proc (T, T): int{.closure.}, order: TSortOrder) |
02:22:57 | Varriount|Remote | Forty-3: It's a problem with the lambda macro, I think |
02:25:09 | * | Forty-3 goes back to wishing there were lambdas |
02:26:05 | EXetoC | Forty-3: see the future module |
02:26:18 | Varriount|Remote | EXetoC: That's what he was using. |
02:26:20 | Forty-3 | EXetoC: the past 15 minutes has been me breaking that |
02:26:37 | Varriount|Remote | Forty-3: You killed it! T_T |
02:26:55 | Forty-3 | mission success! |
02:27:13 | Varriount|Remote | Forty-3: Anyway, the current problem is that you are calling the base sort() procedure with incorrect parameters. |
02:27:15 | EXetoC | well, there basically are, but ok maybe there are some issues |
02:28:39 | Forty-3 | well, that's what the compiler says... |
02:33:31 | gmpreussner | Varriount|Remote: do you know if generic procs can be parameterized based on the params of the return type (i.e. the value being assigned to)? |
02:34:21 | gmpreussner | something like: proc Foo[T1, T2](foo: Foo[T1]): Bar[T2] = ... |
02:34:53 | Varriount|Remote | Forty-3: https://gist.github.com/Varriount/c9eaf4038e62b04171ac |
02:35:13 | Varriount|Remote | gmpreussner: What? |
02:35:14 | gmpreussner | i guess it would be undecidable for assignments of the form: var f = Foo(..) |
02:35:30 | gmpreussner | sorry, that should be foo() |
02:36:10 | Varriount|Remote | gmpreussner: I don't understand... |
02:37:15 | gmpreussner | i was wondering whether generic procs of this form are possible in cases where the assigned to type of the return value is known: proc foo[T1, T2](foo: Foo[T1]): Bar[T2] = ... |
02:37:26 | gmpreussner | but i guess even if it was it would be bad style |
02:37:59 | * | cyraxjoe joined #nim |
02:38:18 | gmpreussner | the proc is parameterized based on a param of the return type. see what i mean? |
02:38:22 | Varriount|Remote | gmpreussner: Uh, what do you think we do for procs returning generic sequences? |
02:38:23 | * | MightyJoe quit (Ping timeout: 272 seconds) |
02:38:59 | * | kapil__ joined #nim |
02:39:53 | gmpreussner | Varriount|Remote: i have not seen the code for those procs. |
02:40:39 | fowlmouth | gmpreussner, you mean like `var x: Bar[int] = foo(someFoo)` ? |
02:40:52 | gmpreussner | yeah |
02:41:32 | Varriount|Remote | gmpreussner: https://gist.github.com/Varriount/a31567ce91da8a9206c4 |
02:41:58 | gmpreussner | i guess the only limitation with that is that the type of 'x' could obviously not be determined automatically, i.e. the following would not work with these procs: var x = foo(...), but it could be called like this to resolve the params: var x = foo[T1, T2](...) |
02:42:11 | fowlmouth | see if let i: seq[float] = foo(15,3) there |
02:42:14 | Forty-3 | Varriount: ah |
02:42:20 | Varriount|Remote | gmpreussner: If the second generic type is only in the return type, you have to pass the generic types explicitly |
02:42:40 | gmpreussner | right, that's what i meant |
02:42:45 | gmpreussner | thanks Varriount|Remote |
02:43:02 | fowlmouth | gmpreussner, you should test it anyways, see if `let i: seq[float] = foo(15,3)` works there |
02:43:18 | gmpreussner | ok |
02:47:16 | Forty-3 | hm, so my test case is successful http://ur1.ca/japrs |
02:47:28 | Forty-3 | so this isn't as simple as it looks |
02:48:10 | fowlmouth | Forty-3, use arr.sort(cmp[Container]) |
02:48:23 | Forty-3 | fowlmouth: huh? |
02:48:35 | * | Mimbus quit (Remote host closed the connection) |
02:48:35 | * | flaviu quit (Remote host closed the connection) |
02:48:37 | fowlmouth | for line 20 |
02:50:03 | Forty-3 | fowlmouth: try compiling http://ur1.ca/japac and http://ur1.ca/japal |
02:50:46 | Forty-3 | then uncomment line 14 and comment line 15 and run the first one again |
02:50:59 | fowlmouth | why dont you paste on gist so there is syntax highlighting and im too busy to run it |
02:51:19 | Forty-3 | fowlmouth: because gist doesn't have a command line tool which is built into my distro |
02:51:36 | Forty-3 | anyway, it doesn't do what you think it would |
02:51:52 | Forty-3 | the pasted version works fine, with the hand coming out sorted |
02:52:04 | Forty-3 | but the macro version does absolutely nothing |
02:52:20 | fowlmouth | there are no macros here |
02:52:24 | Forty-3 | => |
02:56:12 | MyMind | on proc parameters are inmutable ? |
02:56:43 | fowlmouth | Forty-3, https://gist.github.com/fowlmouth/d8d8310ad37a1e76271f |
02:56:46 | fowlmouth | MyMind, yes |
02:56:47 | EXetoC | s/n/m |
02:57:06 | EXetoC | MyMind: parameters that aren't annotated with 'var' are |
02:57:24 | Forty-3 | fowlmouth: your point? |
02:57:34 | fowlmouth | nvm |
02:58:14 | fowlmouth | thats how you use algorithm.sort with your custom type |
02:58:31 | * | fowlmouth left #nim ("Leaving") |
02:59:44 | MyMind | EXetoC: why is not possible then |
02:59:46 | MyMind | proc mysum(a,b:var int): int = |
02:59:48 | MyMind | return a+b |
03:00:45 | MyMind | mysum(1,2) |
03:01:17 | EXetoC | yes well those are not var's. you need to introduce variables in that case |
03:01:24 | EXetoC | but you'd want to omit var in this case |
03:02:04 | * | darkf joined #nim |
03:02:06 | MyMind | well a +=1 before return |
03:02:42 | MyMind | I need to create new variables inside my function ? |
03:03:21 | EXetoC | yes but literals can't be treated as var's, so you need to do something like var x = 1; var y = 2; mysum(1, 2) |
03:03:49 | EXetoC | and then you should get another error message |
03:04:08 | MyMind | that's kinda weird |
03:04:44 | EXetoC | I requested syntactic sugar for it IIRC, but it's probably of low priority |
03:05:11 | EXetoC | but I don't know if our BDFL approves |
03:05:28 | * | Varriount|Remote quit (Ping timeout: 246 seconds) |
03:05:43 | MyMind | iirc you can do it in C right? |
03:06:15 | willwillson_ | Forty-3: could you use h.sort(proc(x, y: deck.Card): int = (cmp(ord(x.value), ord(y.value)))) instead of the sugared version? |
03:06:17 | EXetoC | not that I recall |
03:06:34 | Forty-3 | willwillson_: the point is that the sugared version does not work, although it should |
03:07:15 | willwillson_ | ok |
03:09:49 | * | yglukhov__ joined #nim |
03:14:31 | * | yglukhov__ quit (Ping timeout: 255 seconds) |
03:14:36 | MyMind | EXetoC: this http://pastebin.com/6MneQnZk |
03:15:23 | * | Trustable quit (Quit: Leaving) |
03:15:24 | EXetoC | yes, but that's not the equivalent of specifying 'var' |
03:15:39 | MyMind | exist an equivalent? |
03:15:52 | EXetoC | T* |
03:18:02 | * | yenic joined #nim |
03:18:17 | EXetoC | and then you need to introduce something that you can take the address of, unless you pass in 0 (NULL); the latter of which doesn't apply to Nim because 'var' is more restricted. there's also ptr and ref though |
03:19:00 | MyMind | pff so complicated |
03:20:04 | yenic | Hello Nimmers. It appears to me that Nim may be the right language, at the right place, at the right time. It's mature enough at this point, many Python2 users may choose Nim over porting to Python3. |
03:20:09 | yenic | question on Nim, is it possible that a shim layer could be added to Nim to run Python2 libraries? Say with Nuitka's method or Pyinstaller (including the whole runtime if 2.x code is used)? I think this would give Nim serious mindshare |
03:21:31 | willwillson_ | yenic: embed python: https://github.com/nim-lang/python ? |
03:22:11 | yenic | willwillson_: nice, and directly from Andreas. So he already had this idea. |
03:22:27 | yenic | willwillson_: be good to put this officially into the Nim compilation process before 1.0 |
03:23:31 | yenic | and advertise Nim as being Python2 compatible. I imagine many businesses in that case, will choose Nim as they look for ways off of Python2's EOL. |
03:24:34 | willwillson_ | how do the do it in julia? They have good python integration right? |
03:25:33 | yenic | willwillson_: I'm not sure, I don't know much about Julia. But I think this is the killer-feature that would lead everyone to moving to Nim. |
03:25:56 | yenic | if it could be compiled to C/C++ like Nuitka does, and increase speed as a result.. even better |
03:26:21 | Triplefox | sounds like a big agenda |
03:26:32 | EXetoC | MyMind: yes but I'd say the complexity is justified. you should get the hang of it after a little trial-and-error |
03:28:14 | Demos_ | it is not a lot of fun to call into a dynamically typed language from a static one, not impossible but not fun |
03:28:29 | EXetoC | yenic: directly from andreas? several people contribute to that organization, and this time it was fowlmouth |
03:28:47 | yenic | EXetoC: it had his name in the source as the author |
03:28:50 | Triplefox | i guess having python at hand would help with onboarding, but integrating it well... |
03:29:29 | * | yglukhov__ joined #nim |
03:30:19 | EXetoC | yenic: right, sorry. need some sleep |
03:33:53 | * | yglukhov__ quit (Ping timeout: 240 seconds) |
03:34:19 | * | willwillson_ quit (Ping timeout: 255 seconds) |
03:39:19 | * | dain joined #nim |
03:40:37 | * | dain left #nim (#nim) |
03:50:14 | * | AMorpork is now known as CSGOMorpork |
03:51:57 | * | BitPuffin quit (Ping timeout: 245 seconds) |
03:52:19 | * | Hakaslak joined #nim |
03:53:12 | * | VinceAddons quit (Read error: Connection reset by peer) |
03:59:04 | * | MrOrdinaire joined #nim |
03:59:20 | * | FreezerburnV joined #nim |
04:01:48 | * | Hakaslak quit (Quit: TODO: Generate 'Computer Sleep Quit Message') |
04:02:18 | * | Hakaslak joined #nim |
04:02:43 | yenic | the other points that came to mind about Nim other than supporting CPython2.7 code, is if the standard library will ever work with the GC disabled? I think longterm that may be possible? |
04:03:07 | yenic | and 3rd thought was while there is no IDE for Nim, would an extension for SublimeText or VIM fill that gap well enough? |
04:03:35 | Triplefox | oh, no wonder i'm having trouble...i need to get GLEW in this project |
04:04:04 | * | Hakaslak quit (Client Quit) |
04:04:21 | EXetoC | Triplefox: why is that? |
04:04:38 | EXetoC | yenic: I think it's on the horizon |
04:05:08 | yenic | I'm becoming excited about Nim, I wish I were a better programmer and I'd try to put some of these ideas into place |
04:05:29 | Triplefox | to access GL2+ things |
04:05:35 | * | Hakaslak joined #nim |
04:06:38 | EXetoC | the opengl module is compatible with all versions |
04:06:42 | yenic | Curious to see if Andreas thinks Python2 code could be supported in Nim's compiled binaries.. this language would soar if companies knew about Nim and chose Nim over porting to Python3. I know I would. |
04:07:18 | EXetoC | it's just that it might get hairy if one wants to do selective loading. the compiler currently checks which GL functions are referenced |
04:08:09 | yenic | so just interfacing with CPython2.7 libraries would get hairy? I'm not suggesting support Python2.7 code within Nim itself, just its extensive 3rd party library system somehow. |
04:08:43 | EXetoC | no, that was intended for Triplefox |
04:09:53 | * | MrOrdinaire quit () |
04:10:02 | * | dyu joined #nim |
04:10:51 | Triplefox | well, every sample i find depends on having GLEW do the work...a strong suggestion that i should follow along |
04:12:03 | EXetoC | 1. create the context 2. call opengl.loadExtensions(). that's it |
04:14:46 | * | CSGOMorpork is now known as AMorpork |
04:15:06 | dyu | nim seems to be on a streak on hn |
04:15:54 | Triplefox | okay, maybe it's not the extensions. but then i'm back to the beginning with making this sample draw things |
04:18:40 | Triplefox | oh, i see how i got confused about that. this person's tutorial is talking about adding glew to clear up a bunch of compiler warnings |
04:21:35 | * | FreezerburnV quit (Quit: FreezerburnV) |
04:23:01 | Triplefox | i'll just start over with this other sample which looks marginally simpler than the one i was trying before |
04:39:02 | * | Varriount joined #nim |
04:39:21 | * | Varriount is now known as Varriount|Remote |
04:41:52 | * | noobatNim joined #nim |
04:46:51 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
04:53:58 | * | Varriount|Remote quit (Ping timeout: 246 seconds) |
04:56:44 | * | abcv joined #nim |
05:03:25 | * | abcv quit (Quit: Page closed) |
05:03:39 | * | brson quit (Ping timeout: 244 seconds) |
05:04:07 | * | noobatNim quit (Quit: Page closed) |
05:13:22 | fabiok | \quit |
05:13:24 | * | fabiok quit (Quit: leaving) |
05:14:24 | Triplefox | with this sample it crashes at glCreateShader() \o/ <o> |
05:16:25 | Triplefox | ah, that one didn't include an extension loader, of course |
05:16:30 | Triplefox | it draws a thing! \o/ |
05:18:19 | gmpreussner | draw all the things! |
05:18:39 | gmpreussner | \o_ |
05:21:21 | * | V01D joined #nim |
05:22:00 | * | no_name joined #nim |
05:22:27 | no_name | I think I found a pretty big bug in httpclient - where do I report it? |
05:22:42 | V01D | https://github.com/Araq/Nim/issues?page=9&q=is%3Aissue+is%3Aopen |
05:22:55 | V01D | create an issue on github |
05:23:10 | V01D | this is the main repo - https://github.com/Araq/Nim |
05:25:31 | * | vbtt joined #nim |
05:26:07 | no_name | thanks |
05:26:26 | V01D | welcome ,.,.,., BTW .,., does anyone know why the repo contains tinyC compiler. what is it used for. |
05:27:40 | * | vbtt quit (Client Quit) |
05:27:52 | * | vbtt joined #nim |
05:27:57 | gmpreussner | V01D: to bootstrap the nim compiler |
05:28:21 | EXetoC | it's considered unsuitable for that task now |
05:28:27 | gmpreussner | and nim also generates C code, so i guess it uses that to compile as well |
05:28:51 | gmpreussner | EXetoC: oh really? is it using gcc now? |
05:28:57 | V01D | the readme in the repo states that `To build from source you will need: gcc 3.x or later recommended. Other alternatives which may work are: clang, Visual C++, Intel's C++ compiler` so what's the need for TCC |
05:29:20 | Triplefox | somewhere in the compiler docs it mentions a use for tcc although i forget what |
05:30:02 | Triplefox | there is plenty of leftover cruft in nim already, that might be one |
05:30:04 | EXetoC | gmpreussner: yep |
05:31:10 | * | goobles joined #nim |
05:31:14 | Triplefox | under advanced commands: "run run the project (with Tiny C backend; buggy!)" |
05:32:53 | V01D | ok.,., |
05:33:05 | * | brson joined #nim |
05:38:25 | * | V01D quit (Ping timeout: 246 seconds) |
05:48:30 | * | adam_s joined #nim |
06:04:12 | * | brson quit (Quit: leaving) |
06:04:19 | goobles | whats this parallel: thing? |
06:07:51 | vbtt | goobles:it autmatically runs your code in parallel across multiple threads |
06:08:35 | * | ARCADIVS joined #nim |
06:08:57 | vbtt | so you write code that looks serial, but nim will figure out how to run it in parallel over multiple threads. that's my understanding anyway. |
06:10:00 | vbtt | hopefully someone with more knowledge an also answer |
06:26:24 | no_name | hrms.. where do I put zlib1.dll for import zlib to work properly? I put one in system32, but no love |
06:27:48 | * | vbtt quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client) |
06:31:32 | * | kapil__ quit (Quit: Connection closed for inactivity) |
06:31:49 | * | vbtt joined #nim |
06:38:38 | Triplefox | twice now i've tried to end a block by writing "end" .-. |
06:39:18 | Triplefox | i think it's probably the lua i've written, it's been too long to be the pascal |
06:45:11 | * | vbtt quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client) |
06:45:28 | * | tgkokk joined #nim |
06:48:04 | * | BitPuffin joined #nim |
06:48:08 | goobles | is nim better than lua |
06:48:57 | goobles | where typeclasses? |
06:52:17 | * | BitPuffin quit (Ping timeout: 240 seconds) |
06:58:34 | * | chrisheller joined #nim |
06:58:46 | * | goobles quit (Quit: Page closed) |
07:05:36 | * | SplinterOfChaos joined #nim |
07:05:44 | Triplefox | and now i used "def" - i'm writing all the languages tonight |
07:11:06 | * | vbtt joined #nim |
07:18:15 | * | vbtt quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client) |
07:19:05 | * | chrisheller playing with python integration |
07:20:05 | chrisheller | PR created for python.nim to work with 0.10.2 https://github.com/nim-lang/python/pull/1 |
07:22:14 | chrisheller | That lets the pythonex.nim code work properly, but having some more examples beyond PyRun_SimpleString would be good. |
07:24:00 | chrisheller | I may work on some more examples/tests later since I have some interest in using some existing Python code with Nim. |
07:24:40 | dv- | i'd be interested in using python's matplotlib from nim |
07:25:36 | * | kapil__ joined #nim |
07:27:40 | chrisheller | Be sure to look at https://github.com/micklat/python/commit/b66f48e7ce096fbdac74e03df8961676dcbe8198 for using Python's FFI . |
07:29:15 | chrisheller | I haven't used matplotlib, but I believe that it is a wrapper over a C library, so you'll want global_symbols=true |
07:31:52 | dv- | hmm. maybe i can just call c then |
07:41:07 | * | chrisheller quit (Remote host closed the connection) |
07:46:15 | * | decaf joined #nim |
07:47:10 | * | decaf quit (Client Quit) |
07:50:35 | * | gokr joined #nim |
07:52:10 | * | tgkokk quit (Ping timeout: 255 seconds) |
08:19:15 | * | vbtt joined #nim |
08:21:25 | * | vbtt quit (Client Quit) |
08:24:26 | * | adam_s quit (Quit: Leaving) |
08:24:37 | * | chrisheller joined #nim |
08:32:36 | * | yglukhov__ joined #nim |
08:35:55 | * | BlaXpirit joined #nim |
08:37:02 | * | yglukhov__ quit (Ping timeout: 244 seconds) |
08:41:42 | * | gokr quit (Quit: Leaving.) |
08:42:52 | * | gour joined #nim |
08:47:10 | * | alexruf joined #nim |
08:48:52 | alexruf | Hi |
08:49:17 | dts|pokeball | someone said my name? |
08:51:47 | alexruf | just a noob question: does the nim compiler directly created bytecode or does it translate nim to C and compile the C code with a normal C compiler (like gcc, clang, ...)? I didn't understand. |
08:52:10 | BlaXpirit | alexruf, it creates C code |
08:52:18 | BlaXpirit | you can maybe even see it in nimcache folder |
08:52:35 | dts|pokeball | ^ |
08:52:46 | alexruf | so this means than nim is very much like pypy for example? |
08:53:01 | alexruf | that |
08:53:10 | dts|pokeball | iirc, nim -> AST -> (obj)c/++/js |
08:53:23 | BlaXpirit | alexruf, whaaaat, pypy is nothing like that |
08:53:41 | alexruf | what does AST mean? |
08:53:49 | dts|pokeball | abstract syntax tree |
08:53:55 | alexruf | ah ok |
08:54:21 | dts|pokeball | ast's are super cool shit, which explains why ms doesnt use it |
08:54:48 | BlaXpirit | . . . |
08:55:05 | alexruf | pypy also has backends to generate python, C, java whatever |
08:55:17 | BlaXpirit | i... really don't think so |
08:55:23 | dts|pokeball | to which? |
08:55:46 | alexruf | i really think pypy works the same way |
08:56:04 | BlaXpirit | definitely not |
08:56:06 | alexruf | https://en.wikipedia.org/wiki/PyPy |
08:56:23 | alexruf | Current PyPy versions are translated from RPython to C code and compiled. |
08:56:23 | dts|pokeball | uh nim is not jit |
08:56:26 | dts|pokeball | afaik |
08:57:13 | BlaXpirit | PyPy itself is translated to C, whatever |
08:57:29 | * | coffee` joined #nim |
08:57:36 | * | Hakaslak quit (Quit: TODO: Generate 'Computer Sleep Quit Message') |
08:57:55 | BlaXpirit | PyPy definitely does not translate Python to C |
08:58:04 | dts|pokeball | > PyPy focuses on speed, efficiency and compatibility with the original CPython interpreter |
08:58:14 | dts|pokeball | nim just focuses on being cool |
08:58:15 | dv- | how do i tell nim to load a function from an object file? |
08:59:24 | dts|pokeball | dv-, there might be something in os/osproc |
08:59:50 | dv- | i mean for ffi. i have a library that generates an .o |
09:00:00 | dts|pokeball | ah |
09:00:08 | dts|pokeball | uhh... hold on. ive got a link |
09:00:27 | alexruf | BlaXpirit: I think pypy definitly does: http://rpython.readthedocs.org/en/latest/translation.html |
09:00:42 | alexruf | BlaXpirit: thats the whole point with pypyp |
09:00:45 | BlaXpirit | will you stop please |
09:00:45 | dts|pokeball | http://rosettacode.org/wiki/Call_a_foreign-language_function#Nimrod |
09:01:02 | dts|pokeball | dv-, ^ |
09:01:23 | BlaXpirit | alexruf, you gave me a link to RPython, and somehow think this is about PyPy |
09:01:59 | * | EastByte_ joined #nim |
09:02:03 | * | EastByte quit (Read error: Connection reset by peer) |
09:03:21 | alexruf | BlaXpirit: you should read how pypy works first :) if you write in RPython, pypy is able to translate your syntax into other syntax like C for example. The Python interpreter from pypy is also written in RPython itself |
09:03:43 | * | dts|pokeball googles rpython |
09:03:53 | BlaXpirit | alexruf, you should read how pypy works first :) if you write in RPython, RPython is able to translate your syntax into other syntax like C for example. The Python interpreter from pypy is also written in RPython itself |
09:04:19 | BlaXpirit | but does not translate Python to C |
09:04:28 | alexruf | pypy isn't an python interpreter, it's an compiler toolchain |
09:04:35 | BlaXpirit | no |
09:04:36 | BlaXpirit | pls stop |
09:04:52 | dts|pokeball | uh BlaXpirit you are wrong |
09:05:10 | alexruf | sure he's wrong. Nim is very much like pypy |
09:05:28 | BlaXpirit | facepalm |
09:05:31 | dts|pokeball | idk about that, but about translating Python to c |
09:05:35 | dts|pokeball | it literally says: |
09:05:40 | dts|pokeball | > Current PyPy versions are translated from RPython to C code and compiled |
09:05:48 | dts|pokeball | <BlaXpirit> but does not translate Python to C |
09:05:55 | alexruf | ^^thats the point with pypy |
09:05:58 | BlaXpirit | [:57:13] <BlaXpirit> PyPy itself is translated to C, whatever |
09:06:12 | alexruf | Ok it translates RPython to C... |
09:06:23 | dts|pokeball | RPython is python though apparently |
09:06:27 | BlaXpirit | no |
09:06:34 | dts|pokeball | restricted python |
09:06:36 | BlaXpirit | Python is RPython though |
09:06:47 | BlaXpirit | [:03:52] <BlaXpirit> if you write in RPython, RPython is able to translate your syntax into other syntax like C for example. The Python interpreter from pypy is also written in RPython itself |
09:06:58 | alexruf | Restricted Python is a small subset of Python |
09:07:00 | dts|pokeball | ^ |
09:07:10 | alexruf | it's not Python |
09:07:15 | dts|pokeball | which makes <BlaXpirit> Python is RPython though have zereo sense |
09:07:30 | dts|pokeball | if its a subset of python it is python |
09:07:30 | jpoirier | pypy is written in rpython. pypy implements python 2.7.8 and jits user's python code when appropriate. |
09:07:30 | BlaXpirit | well yeah |
09:08:00 | Triplefox | pypy is complicated to talk about because it's a bunch of different technologies |
09:08:18 | BlaXpirit | but it is easy to assert that PyPy does not translate Python to C |
09:08:27 | Triplefox | nim is "just" a compiler, i guess |
09:08:54 | jpoirier | pypy doesn't transpile python code to c src |
09:09:02 | BlaXpirit | yay, another sane guy |
09:09:11 | dts|pokeball | an apparently buggy compiler, but a compiler nonetheless Triplefox |
09:09:27 | jpoirier | the rpython toolchain does transpile to c |
09:10:28 | alexruf | ok, but my point was that nim doesn't have it's own bytecode compiler... it works sort of like pypy which translates it's code to another language (like C in case of Nim). Correct? |
09:10:39 | BlaXpirit | no |
09:10:51 | BlaXpirit | PyPy actually does directly work with bytecode |
09:11:27 | BlaXpirit | PyPy never translates Python to another language, unless you call bytecode or machine code a language |
09:11:46 | alexruf | ok i understand |
09:12:43 | dts|pokeball | well it *is* a language |
09:12:56 | dts|pokeball | just an awkward one |
09:12:59 | jpoirier | agreed: pypy -> bytecode and/or machine, which are not source code |
09:13:16 | jpoirier | s/machine/machine code |
09:13:18 | BlaXpirit | Cython, on the other hand... |
09:13:25 | BlaXpirit | And Niutka, which seems weird |
09:13:41 | dts|pokeball | cython is some weird shit man |
09:13:53 | jpoirier | Niutka is kinda cool and works well |
09:14:31 | BlaXpirit | pretty sure Cython does everything Niutka does, and better, and also much more |
09:15:14 | Triplefox | people seemed hyped about niutka as another way to package builds for distribution...i haven't looked at it |
09:15:51 | Demon_Fox | Triplefox, Jeez, I see you in a lot of channels |
09:15:53 | jpoirier | cython is nice as well |
09:15:59 | Triplefox | Demon_Fox: ikr |
09:16:49 | Demon_Fox | Then again, nim has taken off recently |
09:17:01 | Demon_Fox | I got rolled up in the snow ball |
09:17:09 | Demon_Fox | How about you? |
09:17:23 | * | yglukhov__ joined #nim |
09:17:26 | Triplefox | i've followed it for a while and finally found the time to sit down and work on a project with it |
09:18:22 | Demon_Fox | Soon, I'm starting a C project |
09:18:48 | Triplefox | i see nim as complementary to haxe...where haxe lets me write code for potentially anywhere, nim allows deeper optimization |
09:18:48 | Demon_Fox | A really small wrapper for some posix functions |
09:20:32 | jpoirier | the short time i've played with nim i've enjoyed it but it needs some polish, imho. but that'll happen in time |
09:20:53 | BlaXpirit | all i'm missing now is documentation search |
09:21:02 | BlaXpirit | google could as well not exist |
09:21:10 | BlaXpirit | not a single search leads to success |
09:21:12 | * | gokr_ joined #nim |
09:21:20 | Demon_Fox | Triplefox, Well, not sure about that |
09:21:27 | * | alexruf quit (Quit: Textual IRC Client: www.textualapp.com) |
09:21:57 | BlaXpirit | and that rename... put a nail in the coffin of searchability |
09:22:09 | jpoirier | yeah, a nimdoc would be nice |
09:22:20 | jpoirier | similar to godoc |
09:25:27 | BlaXpirit | we need to seriously think... is there any way to search docs at all |
09:25:30 | Demon_Fox | Night Triplefox |
09:25:39 | Triplefox | night Demon_Fox |
09:26:16 | dts|pokeball | BlaXpirit, ctrl + f, grep |
09:26:25 | BlaXpirit | dts|pokeball, on ONE page |
09:26:33 | BlaXpirit | but if i look at some code and see some function, |
09:26:38 | BlaXpirit | i have no frickin clue where it comes from |
09:26:49 | Triplefox | right now what i do is bring up three tabs and ctrl+f in the most relevant one |
09:27:10 | Triplefox | it's about the same as what i did with python way back when |
09:27:23 | BlaXpirit | this is not so bad https://google.com/search?q=nim+newseq+site:nim-lang.org |
09:27:49 | BlaXpirit | yeah, it's actually pretty good |
09:29:26 | * | Demon_Fox quit (Quit: Leaving) |
09:31:16 | dts|pokeball | fml i forgot to write a build script |
09:32:41 | BlaXpirit | dts|pokeball, you mean you kept just repeating a long command in terminal? |
09:33:09 | BlaXpirit | otherwise i don't get it |
09:34:45 | dts|pokeball | no. i just need to write nim c nimbus.nim |
09:35:14 | dts|pokeball | but there are other things involved in nimbus that i dont need to mess with after i primarily install them |
09:35:23 | Triplefox | writing the tiny build script is worth it |
09:35:43 | dts|pokeball | yep. right now nimbus is extremely static |
09:37:16 | * | loz joined #nim |
09:37:35 | Triplefox | i was watching the Handmade Hero streams and in one of the early videos he's setting up the project environment...and his build script is a little windows .bat file that just rebuilds everything directly |
09:37:45 | Triplefox | and he says, "i will ship the game with this" |
09:38:43 | dts|pokeball | mine is shipping with a bash script :} |
09:42:33 | dv- | he also doesn't use version control :( |
09:43:21 | dv- | still fun to watch though |
09:43:31 | vegai | hmm... is & the string concat operator? |
09:43:37 | dts|pokeball | yes |
09:53:45 | Demos_ | who is doing homemade hero? |
09:55:16 | dv- | https://www.youtube.com/user/handmadeheroarchive |
10:01:35 | * | gokr_ quit (Remote host closed the connection) |
10:01:51 | * | gokr_ joined #nim |
10:02:03 | * | VinceAddons joined #nim |
10:04:56 | BlaXpirit | .eval (-1)`mod`5 |
10:05:06 | BlaXpirit | heloooo |
10:05:18 | BlaXpirit | Mimbus, where are you? :( |
10:05:36 | dv- | nim isn't haskell |
10:05:39 | dv- | you don't need `` |
10:05:46 | BlaXpirit | i'm pretty sure you do |
10:05:52 | BlaXpirit | ah no nvm |
10:06:02 | BlaXpirit | i just thought mod is an ordinary function and blah |
10:06:33 | BlaXpirit | well whatever. how do i eval now? make a new file and COMPILE it? barbaric |
10:06:38 | dv- | nim i |
10:06:42 | dv- | gives you a repl |
10:07:06 | BlaXpirit | ok |
10:07:07 | BlaXpirit | thaks |
10:07:09 | BlaXpirit | n |
10:07:10 | dv- | i suggest rebuilding nim with readline though |
10:07:20 | BlaXpirit | pretty sure it is with readline |
10:07:44 | BlaXpirit | *arch master race |
10:07:54 | dv- | oh |
10:08:03 | dv- | heh, i thought arch used defaults everywhere |
10:08:10 | BlaXpirit | (-1) mod 5 == -1, not good |
10:08:27 | BlaXpirit | dv-, it's probably because i use non-official package for nim |
10:08:47 | BlaXpirit | is there any operation where (-1) ? 5 == 4 |
10:08:51 | dv- | i think so |
10:09:28 | dv- | http://nim-lang.org/system.html#%%,IntMax32,IntMax32 |
10:09:59 | BlaXpirit | no, that's not it |
10:10:08 | BlaXpirit | the stuff that ends with % is unsigned hacky stuff |
10:10:19 | BlaXpirit | in any case, (-1) % 5 == 0 |
10:10:40 | * | gokr joined #nim |
10:11:30 | * | ARCADIVS quit (Quit: ARCADIVS) |
10:12:57 | * | gokr_ quit (Ping timeout: 240 seconds) |
10:13:51 | BlaXpirit | .eval import math;echo (-1.0 mod 5.0) |
10:13:59 | BlaXpirit | <Mimbus> BlaXpirit: 4.0 |
10:15:06 | BlaXpirit | so int mod and float mod works differently. okay |
10:17:15 | * | gour_ joined #nim |
10:17:26 | * | irrequietus joined #nim |
10:21:06 | * | gour quit (Ping timeout: 250 seconds) |
10:25:13 | * | gour_ is now known as gour |
10:33:45 | * | Demos_ quit (Ping timeout: 264 seconds) |
10:38:46 | * | jefus_ joined #nim |
10:40:51 | * | chrisheller quit (Ping timeout: 252 seconds) |
10:41:21 | BlaXpirit | I want to remove items from seq while iterating through it |
10:41:41 | dv- | so a filter? |
10:41:44 | BlaXpirit | yes |
10:42:00 | dv- | http://nim-lang.org/sequtils.html#filter,seq[T],proc%28T%29 |
10:42:14 | BlaXpirit | oh ok. thanks |
10:42:30 | BlaXpirit | again... there is no tutorial on this kind of stuff |
10:42:43 | * | jefus quit (Ping timeout: 255 seconds) |
10:42:50 | dv- | yeah |
10:43:01 | dv- | you could write one... |
10:43:53 | BlaXpirit | how can i write a tutorial if i don't know anything |
10:44:11 | BlaXpirit | I know FFI more than the rest of the language xD |
10:45:09 | dv- | dunno, you learn it same as any other language, by browsing the docs |
10:45:18 | BlaXpirit | no |
10:45:39 | BlaXpirit | when i learned python, there was actually a tutorial that shows: you can do this kind of stuff, and that kind of stuff |
10:45:57 | BlaXpirit | and there is actually readable documentation! not randomly shuffled functions |
10:46:21 | dv- | well if go to http://nim-lang.org/lib.html |
10:46:26 | dv- | it says |
10:46:28 | dv- | sequtils This module implements operations for the built-in seq type which were inspired by functional programming languages. |
10:46:44 | * | gokr quit (Read error: Connection reset by peer) |
10:46:57 | * | gokr joined #nim |
10:50:43 | * | chrisheller joined #nim |
10:51:54 | dv- | hm... how do i pass an array to C? |
10:55:27 | dv- | oh |
10:55:47 | dv- | addr(arr[0]) i guess |
10:59:02 | BlaXpirit | yes |
11:03:25 | BlaXpirit | how to find out if 2 references point to the same object? |
11:03:38 | BlaXpirit | (again, I wish I didn't have to bother people with this) |
11:04:03 | dv- | == ? |
11:04:20 | BlaXpirit | wouldn't it delegate to the actual objects... eh i don't know |
11:05:40 | BlaXpirit | then how do i compare actual objects? |
11:06:55 | dv- | hm not sure. i think [] is the dereference operator? |
11:08:08 | BlaXpirit | yeah....... |
11:20:02 | * | Nimbus quit (Ping timeout: 250 seconds) |
11:20:14 | * | dts|pokeball quit (Ping timeout: 245 seconds) |
11:28:45 | chrisheller | I just added a more detailed example of using Python from within Nim. https://github.com/chrisheller/python/blob/master/examples/pythonex_ctypes.nim |
11:30:17 | chrisheller | That has examples of setting/getting variables in Python from the Nim code, as well using the ctypes module to exercise Python's FFI |
11:31:51 | chrisheller | It still needs more work (better error checking), and I would like to add an example of calling Nim procs from Python, but sleep is beckoning, so that will have to wait |
11:32:00 | dv- | cool |
11:35:05 | chrisheller | I need to figure out how ctypes would access a Nim function if Nim is compiled as an executable though. The ctypes documentation just focuses on calling functions in dynamic libraries. |
11:37:27 | * | flaviu joined #nim |
11:37:30 | chrisheller | So .exportc. progma should work properly if the Nim side is compiled as a dynamic library, but I don't know if I can trick ctypes into getting a reference to the executable that it is loaded from and use that |
11:39:21 | chrisheller | By the way, the Python C API that python.nim uses is fairly well documented in case anyone wants more info on how all that works. https://docs.python.org/2/c-api/index.html |
11:42:15 | BlaXpirit | whaaaaaat. have I just managed the compiler to go into an infinite loop? |
11:43:48 | * | Matthias247 joined #nim |
11:50:53 | * | gsingh93 quit (Quit: Connection closed for inactivity) |
11:51:01 | BlaXpirit | I don't understand how to pass variables like by reference in C++ |
11:51:23 | BlaXpirit | var is not it, no var has a risk of passing by copy....... |
11:52:43 | * | ErikBjare__ joined #nim |
11:52:56 | ErikBjare__ | Hi guys, anyone mind helping me out with the wiki article? |
11:53:03 | * | tgkokk joined #nim |
11:53:04 | dv- | var is by reference i'm pretty sure |
11:53:12 | ErikBjare__ | https://en.wikipedia.org/wiki/User:Erik.Bjareholt/Nim_(programming_language) |
11:53:15 | BlaXpirit | well it is by reference |
11:53:27 | BlaXpirit | but it also enforces it to be an lvalue |
11:53:35 | BlaXpirit | and with C++ references that's not the case |
11:54:11 | dv- | ErikBjare__: it's been done and it's been deleted |
11:54:20 | * | ErikBjare__ is now known as ErikBjare_ |
11:56:06 | ErikBjare_ | dv-: There hasn't been one since June, I thought given the recent publicity now might be a good time. |
11:56:14 | ErikBjare_ | At least to make a decent draft |
11:56:38 | BlaXpirit | people talked about it yesterday |
11:56:41 | ErikBjare_ | This is vastly superior though: https://en.wikipedia.org/wiki/Draft:Nimrod_(programming_language) |
11:56:47 | BlaXpirit | recent publicity self-referencial |
11:57:09 | ErikBjare_ | BlaXpirit: Yeah I know |
11:58:57 | * | loz quit (Ping timeout: 240 seconds) |
12:03:57 | * | lodyb joined #nim |
12:03:57 | * | BitPuffin joined #nim |
12:08:47 | * | gour_ joined #nim |
12:10:04 | MyMind | it's possible to shadow a variable? |
12:10:41 | dv- | yes |
12:11:07 | * | tgkokk quit (Ping timeout: 245 seconds) |
12:11:54 | * | gour quit (Ping timeout: 245 seconds) |
12:12:58 | BlaXpirit | oh man, i've done so much shadowing today |
12:13:10 | * | loz joined #nim |
12:13:14 | BlaXpirit | function vs variable shadowing too |
12:13:15 | BlaXpirit | :| |
12:13:41 | * | chrishel_ joined #nim |
12:14:24 | lodyb | my gf refuses to try nim as it has 'let' haha |
12:14:53 | chrishel_ | Looks like getting the address of the proc from within Nim might work for getting ctypes to call back into Nim. |
12:15:05 | * | chrisheller quit (Ping timeout: 252 seconds) |
12:15:37 | BlaXpirit | lodyb, what exactly is the problem? |
12:16:00 | lodyb | its my girlfriend, some ruby ptsd or something |
12:16:20 | BlaXpirit | chrishel_, don't forget about specifying calling convention and extern |
12:16:29 | BlaXpirit | i don't know what i'm talking about though |
12:17:53 | chrishel_ | Yes, it would need cdecl calling convention. I don't think that extern is needed though; exportc can take a parameter which specifies the exported name |
12:18:49 | * | tgkokk joined #nim |
12:21:30 | * | gokr1 joined #nim |
12:23:09 | * | chrishel_ quit (Ping timeout: 252 seconds) |
12:23:17 | * | gokr_ joined #nim |
12:23:55 | * | gokr2 joined #nim |
12:24:12 | * | gokr2 quit (Client Quit) |
12:24:39 | * | gokr quit (Ping timeout: 256 seconds) |
12:25:39 | * | gokr1 quit (Ping timeout: 245 seconds) |
12:27:15 | * | chrisheller joined #nim |
12:31:35 | * | chrisheller quit (Ping timeout: 252 seconds) |
12:31:48 | * | chrisheller joined #nim |
12:35:01 | * | chrishel_ joined #nim |
12:35:01 | * | chrisheller quit (Read error: Connection reset by peer) |
12:36:00 | chrishel_ | Hmmm. Looks like I'm not getting the proc exported when compiling as an executable. It does export properly when I compile as a dynamic library. Maybe Nim does not support exported symbols in executables? |
12:36:15 | chrishel_ | Will have to play around with that more tomorrow |
12:40:20 | * | flaviu quit (Read error: Connection reset by peer) |
12:40:33 | * | flaviu joined #nim |
12:47:46 | Araq | chrishel_: dynlib + exportc does the trick for DLLs |
12:48:59 | EXetoC | lodyb: she is free to discuss that aspect on the forum or on github :-p |
12:49:01 | chrishel_ | Araq: Yes, that works perfectly. I was just trying to figure out if I can export the proc when I compile an executable. |
12:49:25 | BlaXpirit | that sounds crazy to me :o |
12:49:41 | BlaXpirit | someone, please check this out: https://bpaste.net/show/af5222c01c29 |
12:49:55 | BlaXpirit | seemingly the same code involving seq behaves differently |
12:50:11 | chrishel_ | This is just for the Python/Nim example code, so if it's not possible, that is fine. I can add a note to the code that it only works when the Nim side is a dynamic library |
12:51:46 | def- | Araq: the code for items and mitems is mostly the same. should I make a template for the common code or just write it twice? |
12:52:31 | Araq | def-: usually the stdlib uses a template then |
12:52:50 | Araq | we can also consider to have a single 'items' that calls 'mitems' |
12:53:19 | def- | can you still pass non-vars to items? |
12:53:30 | Araq | ah yeah, you cannot |
12:53:35 | Araq | good point |
12:54:02 | Araq | chrishel_: did you checkout "nimborg"? |
12:54:28 | Araq | it's a high level bridge between Python and Nim, but afaict not maintained anymore |
12:54:48 | Araq | but hey, we can always revive it |
12:56:33 | chrishel_ | Araq: I was playing around with your earlier version of python.nim. I will take a look at the nimborg stuff though. I see that micklat did that after he was also working on python.nim. |
12:57:08 | Araq | def-: wanna fix the GC bug? I can give you some hints. the bug itself escapes me though |
12:57:25 | BlaXpirit | This is an extremely minimal example now. Araq, please check it out: https://bpaste.net/show/340aa8eae1ae |
12:57:40 | Araq | first the code was "obviously" wrong and then it was "obviously" correct and now I'm confused :p |
12:58:17 | chrishel_ | I had updated the earlier version of python.nim to work with 0.10.2 and then added some more example code (which is what got me on this kick of being able to call Nim procs from within Python). |
12:59:11 | def- | Araq: busy with another bug that escapes me, maybe later |
12:59:24 | Araq | meh ok |
12:59:45 | dv- | can i include an object file somehow in the compilation? |
13:00:08 | Araq | dv-: {.link: "foo.o".} |
13:00:40 | BlaXpirit | :( |
13:00:58 | def- | Araq: I'm not sure why, but something is working wrong with epoll sometimes |
13:01:03 | dv- | Araq: oh cool |
13:01:31 | gokr_ | sidenote: We have a python plugin in Terf today so we will need a python bridge later. similar to what we have now |
13:02:31 | Araq | BlaXpirit: report it, it's a codegen bug |
13:02:46 | BlaXpirit | Araq, I don't know how to describe this |
13:02:54 | BlaXpirit | i can put the code in, sure |
13:03:19 | BlaXpirit | this is a really sad one :( |
13:03:37 | Araq | "s.high refers to the current seq instead of the old one" |
13:03:44 | BlaXpirit | thank you |
13:04:17 | * | tgkokk quit (Ping timeout: 240 seconds) |
13:06:08 | chrishel_ | Looks like nimborg needs to be updated for 0.10.2 as well. I will do that tomorrow and send micklat a PR. |
13:06:46 | Araq | chrishel_: ask him if he wants you to take over the project perhaps |
13:07:50 | chrishel_ | Yeah, I can probably help with the Python stuff. I don't know Lua (although I suppose it can't be that hard) |
13:08:52 | * | chrishel_ left #nim (#nim) |
13:09:08 | * | jefus_ is now known as jefus |
13:11:25 | * | fiatjaf joined #nim |
13:12:51 | Araq | hi fiatjaf welcome |
13:15:34 | fiatjaf | hi , Araq |
13:16:02 | * | BitPuffin quit (Ping timeout: 244 seconds) |
13:20:36 | fiatjaf | I'm looking onto the Nim powers to use C libraries somehow |
13:20:50 | * | chrisheller joined #nim |
13:26:14 | fiatjaf | I can't make myself really graps C (I've written some C code, and it has worked, but it was bugged, bery bugged, the C way doesn't enter in my brain), and I need to use a C library for reading fingerprints, so maybe I could write Nimrod code instead and just call that library or something like that. am I right? Nimrod seems much easier to understand and write. |
13:26:33 | fiatjaf | oops, Nim, not Nimrod. |
13:27:05 | BlaXpirit | fiatjaf, it is extremely easy to use C libraries |
13:27:22 | BlaXpirit | read some general documentation, then ask focused questions |
13:27:35 | fiatjaf | right, I'll do that. |
13:27:35 | def- | http://nim-lang.org/manual.html#foreign-function-interface |
13:27:57 | fiatjaf | (I was going to, but since I was welcomed to the channel I thought I could just ask a general question :P) |
13:28:01 | def- | fiatjaf: but what you want should work well |
13:29:07 | EXetoC | you still have to do some low level things when interfacing with C libs, if that's what you were getting at |
13:35:22 | * | irrequietus quit (Ping timeout: 240 seconds) |
13:38:59 | * | gokr_ quit (Ping timeout: 245 seconds) |
13:39:21 | * | FreezerburnV joined #nim |
13:44:14 | * | gokr_ joined #nim |
13:45:39 | * | BitPuffin joined #nim |
13:50:47 | * | BitPuffin quit (Ping timeout: 256 seconds) |
13:51:24 | ekarlso- | so mysql does't work with libmariadbclient-dev ? |
13:51:48 | ekarlso- | could not load: libmysqlclient.so.15 |
13:52:39 | * | gour_ is now known as gour |
13:52:49 | * | Etheco quit (Read error: Connection reset by peer) |
13:54:30 | * | darkf_ joined #nim |
13:56:20 | * | darkf quit (Ping timeout: 244 seconds) |
13:56:38 | * | MrBlaise joined #nim |
13:58:13 | * | gour quit (Remote host closed the connection) |
13:58:54 | def- | ekarlso-: if it's compatible with mysql you could try allowing libmariadbclient in lib/wrappers/mysql.nim |
13:59:10 | ekarlso- | packages.nim(26, 11) Error: type mismatch: got (typedesc[seq[Package]]) but expected 'seq[Package]' < hmm |
13:59:30 | ekarlso- | how do you declare a seq with a type of object Package ? |
13:59:45 | * | gour joined #nim |
14:00:15 | def- | var mySeq = newSeq[Package]() ? |
14:00:30 | ekarlso- | ahhh |
14:00:53 | def- | ah, you probably wrote "var mySeq = seq[Package]" |
14:01:04 | def- | you could also do "var mySeq: seq[Package] = @[]" |
14:03:57 | ekarlso- | var c = db_mysql.open("localhost:3306", "nim_pkg", "nim_pkg", "nim_pkg") < doesn't that look correct ? |
14:05:02 | * | tane joined #nim |
14:07:48 | * | basaah joined #nim |
14:08:07 | basaah | hi |
14:08:55 | * | darkf_ is now known as darkf |
14:09:57 | def- | ah, libmysqlclient.so.16 it is by now |
14:10:49 | def- | or 18 |
14:10:52 | def- | hi basaah |
14:10:55 | basaah | I was just toying with nim. Is it true that to 'convert int to string' I have to implement it myself? just want to check before I code something unnecessary |
14:11:19 | def- | basaah: $x converts x to a string |
14:11:57 | basaah | oh nice that works |
14:12:11 | tane | hello |
14:12:18 | basaah | I did string(789) |
14:12:23 | tane | is there any REPL for nim, where i can type small expressions and the like? |
14:12:38 | flaviu | tane: `nim i` |
14:12:41 | def- | tane: there is "nim i" but it's not really usable imo |
14:12:42 | tane | thanks |
14:12:43 | flaviu | but it's fairly buggy |
14:12:54 | BlaXpirit | can't import math in it. nuff said. |
14:13:09 | tane | ok |
14:13:11 | * | Mimbus joined #nim |
14:14:59 | def- | ekarlso-: for me it works like this, with correct user, pass and database of course |
14:16:12 | dom96 | ErikBjare_: why not base the wiki article on the old draft? |
14:16:27 | dom96 | BlaXpirit: use this for searching docs http://nim-lang.org/theindex.html |
14:16:42 | BlaXpirit | not bad :o |
14:17:15 | BlaXpirit | So, my Nim SFML bindings are ready. https://github.com/blaxpirit/nim-csfml (yes, I made another one) |
14:17:41 | def- | BlaXpirit: what's wrong with the other one? |
14:17:48 | BlaXpirit | NIH |
14:18:20 | BlaXpirit | seriously though, i don't like that it has T and P everywhere... and the fact that it seems to be hand-made makes it error-prone and tedious to update |
14:18:55 | BlaXpirit | and converting types of variables seemed tedious |
14:19:04 | BlaXpirit | there were a few places where that was needed |
14:20:46 | def- | looks like nice work, BlaXpirit |
14:20:51 | BlaXpirit | thanks |
14:21:15 | BlaXpirit | oh yeah, and I changed getter/setter functions to assignment |
14:23:06 | ekarlso- | http://pastebin.com/ZYLeS2xq < hmmm |
14:23:09 | EXetoC | ideally you'd update. many libs were written when the prefixes were encouraged |
14:23:10 | ekarlso- | what's wrong with that ? |
14:24:53 | def- | EXetoC: hm yeah, it's not ideal to have 2 wrappers for the same lib now |
14:25:18 | BlaXpirit | well I'm sure we'll figure something out with fowl |
14:26:31 | BlaXpirit | especially since he doesn't seem to have time.... |
14:28:43 | BlaXpirit | documentation is the main thing that is lacking |
14:30:26 | BlaXpirit | fowl's bindings do have nim generated documentation, but it wasn't very helpful to me when i tried to use it |
14:30:54 | ekarlso- | anyone ? :p |
14:31:24 | BlaXpirit | well, ekarlso-, you tell us what is wrong |
14:31:25 | BlaXpirit | any eror message? |
14:31:27 | def- | ekarlso-: no idea what that even should do |
14:32:04 | * | joebo joined #nim |
14:32:07 | def- | ah |
14:33:16 | def- | something like this: https://github.com/def-/nim-unsorted/blob/master/parametrizedsql.nim |
14:33:48 | BlaXpirit | oh, and old sfml bindings can only pass ascii strings to sfml |
14:34:13 | def- | ekarlso-: but this didn't quite work, now there's dbj_*: https://github.com/Araq/Nim/issues/1359 |
14:35:04 | dom96 | ekarlso-: Are the '?' not supposed to be inside the parenthesis? |
14:35:32 | BlaXpirit | it's supposed to be VALUES(?, ?, ?, ?, ?) |
14:35:40 | BlaXpirit | how didnt i notice |
14:35:48 | ekarlso- | +1 dom96 |
14:36:07 | * | gokr_ quit (Ping timeout: 256 seconds) |
14:39:08 | ekarlso- | can't u change the value of a field on a already instantiated object ? |
14:40:25 | EXetoC | you can, if the instance is mutable |
14:40:42 | BlaXpirit | var vs let |
14:40:53 | EXetoC | and there's no per-field mutability |
14:41:15 | ekarlso- | ah, so when it's passed into a proc it's immut |
14:41:57 | ekarlso- | is there a way to copy a object ? |
14:42:06 | EXetoC | if 'var' is not present, yes |
14:42:29 | EXetoC | (to the first question) |
14:42:51 | EXetoC | ekarlso-: if it's not a pointer type, then it will copy on assignment |
14:43:24 | ErikBjare_ | dom96: Didn't know it existed, made a few changes to it. |
14:43:37 | EXetoC | and pointer types can be dereferenced like so: foo[]. so "var x = foo[]" would make a copy of the object pointed to by 'foo' |
14:43:59 | dom96 | ErikBjare_: sure, are you going to submit it as a new article? |
14:45:09 | EXetoC | good to see a nice increase in popularity, and participation to some degree. later |
14:45:17 | EXetoC | dom96: wanna add the example site to the topic? |
14:45:17 | ekarlso- | EXetoC: so when you are passing a obje down to a proc how u make it immut within a proc ? |
14:45:57 | EXetoC | ekarlso-: by not making it a var, in which case it's sort of like an implicit 'let' |
14:46:32 | ekarlso- | EXetoC: not following -,,- |
14:46:59 | dom96 | EXetoC: Nobody reads the topic anyway :P |
14:47:14 | EXetoC | oh well |
14:47:15 | dom96 | EXetoC: Why the example site specifically? |
14:48:04 | EXetoC | ekarlso-: "proc p(x: T)" rather than "proc p(x: var T)" |
14:48:08 | * | bitstopper joined #nim |
14:48:14 | * | basaah quit (Quit: Page closed) |
14:48:32 | * | FreezerburnV quit (Quit: FreezerburnV) |
14:48:36 | BlaXpirit | .eval var s = @[5];let x = s[s.high];s.add x;s.add s[s.high];echo s |
14:48:39 | Mimbus | BlaXpirit: @[5, 5, 0] |
14:49:00 | ekarlso- | EXetoC: I already have proc p(x: T): .. |
14:49:03 | * | Dispatch joined #nim |
14:49:08 | EXetoC | ekarlso-: then you're all set |
14:49:32 | ekarlso- | packages.nim(24, 7) Error: 'pkg.id' cannot be assigned to |
14:49:35 | ekarlso- | EXetoC: hence ^ |
14:50:05 | ekarlso- | needs to be var p I guess |
14:50:15 | EXetoC | I thought you said you wanted it to be immutable rather than mutable |
14:50:17 | EXetoC | I think so |
14:50:21 | ekarlso- | ;) |
14:50:33 | ekarlso- | i'm not making alot of sense always :( |
14:50:40 | EXetoC | dom96: I don't know, but maybe you want to extend it, and then you can just say "see the topic" |
14:51:23 | dom96 | EXetoC: There is too much stuff in the topic already |
14:51:53 | joebo | I am interfacing with a C function that returns a struct and that struct contains an offset to another memory location, which would be an an array of numbers... how can I access that array? |
14:51:54 | EXetoC | yes I think it should be delegated to a bot instead |
14:53:19 | BlaXpirit | "Build farm: Down until further notice" is not useful :| |
14:53:39 | joebo | I have the type definition as type JTA ... offset: int... size: int... |
14:53:44 | BlaXpirit | and what the heck is that git.io link |
14:53:48 | ekarlso- | why is the build farm down ? :p |
14:54:22 | joebo | so it would be something like (aptr+aptr.offset)[0...aptr.size] |
14:54:48 | * | Varriount|Busy joined #nim |
14:55:15 | * | phao joined #nim |
14:55:21 | * | phao left #nim ("Leaving") |
14:55:34 | * | ethycol_ joined #nim |
14:55:41 | Varriount|Busy | Hello ethycol |
14:57:27 | * | bitstopper quit (Quit: Page closed) |
14:57:49 | * | ethycol quit (Ping timeout: 244 seconds) |
14:59:11 | * | Ven joined #nim |
15:00:34 | * | ethycol_ quit (Ping timeout: 255 seconds) |
15:02:28 | ekarlso- | grrr |
15:02:37 | ekarlso- | when a program crashes is there no way to see why? |
15:03:36 | Varriount|Busy | ekarlso-: Depends on the OS, and the language the program was written in, and how the program is run/compiled. |
15:03:41 | BlaXpirit | we talked yesterday |
15:03:49 | Varriount|Busy | Is the program in question a Nim program? |
15:04:02 | BlaXpirit | the only time a program crashed that was not because of my error with C FFI, |
15:04:08 | BlaXpirit | was uninitialized pointer |
15:04:21 | BlaXpirit | ref type, you must call new on it |
15:04:23 | BlaXpirit | and i didn't |
15:04:29 | ekarlso- | ahhh, Varriount|Busy nim program. |
15:04:39 | ekarlso- | ubuntu |
15:05:45 | BlaXpirit | http://irclogs.nim-lang.org/01-01-2015.html 19:17:36 |
15:05:47 | Varriount|Busy | ekarlso-: Compiling in debug mode doesn't give you a stack trace? |
15:06:27 | BlaXpirit | also 18:12:18 |
15:06:31 | ekarlso- | BlaXpirit: ? |
15:06:41 | BlaXpirit | ekarlso-, we talked about debugging yesterday |
15:07:19 | ekarlso- | nim -d:useSysAssert -d:useGcAssert c src/packages.nim |
15:07:21 | ekarlso- | I tried that :) |
15:07:40 | BlaXpirit | --embedSrc --linedir:on --debugInfo was slightly helpful for me |
15:07:59 | BlaXpirit | but in the end, i was unable to debug my program, and found the error on my own |
15:08:09 | ekarlso- | whaaa |
15:08:15 | Varriount|Busy | BlaXpirit: You know that you can use GDB, right? |
15:08:17 | no_name | lets say I wanted to import zlib, how do I indicate that I want to statically link zlib1.dll into the binary? |
15:08:19 | * | Y0Gi_ joined #nim |
15:08:21 | dom96 | ekarlso-: what's the problem? |
15:08:28 | dom96 | you should get a stack trace |
15:08:30 | BlaXpirit | Varriount|Busy, that's exactly the flags that made GDB slightly useful |
15:08:37 | ekarlso- | so the program crashes due to a NULL value in a mariadb row |
15:08:38 | BlaXpirit | only very slightly |
15:08:48 | BlaXpirit | ekarlso-, D: |
15:08:54 | Varriount|Busy | no_name: I believe you need to pass a compiler option. Let me see if I can find it... |
15:09:04 | ekarlso- | but why, doesn't nim handle that ? :/ |
15:09:15 | Y0Gi_ | hi there. is there an easy way to turn a slice (1..4) into an actual sequence? or another approach to generate a sequence of successive numbers? |
15:09:15 | ekarlso- | i'm just doing SELECT * FROM packages; :/ |
15:09:49 | BlaXpirit | Y0Gi_, hmmmm |
15:10:12 | Araq | no_name: --dynlibOverride and then have fun with --passL |
15:10:18 | BlaXpirit | .eval import sequtils;toseq(1..4) |
15:10:21 | Mimbus | BlaXpirit: lib/pure/collections/sequtils.nim(311, 2) Error: value of type 'seq[int]' has to be discarded |
15:10:23 | Y0Gi_ | a list comprehension might work, but seems ... wrong |
15:10:26 | BlaXpirit | .eval import sequtils;echo toseq(1..4) |
15:10:29 | Mimbus | BlaXpirit: @[1, 2, 3, 4] |
15:10:32 | BlaXpirit | yay |
15:10:42 | BlaXpirit | Y0Gi_, ^ |
15:11:34 | ekarlso- | a bit sad if a program blows up due to that |
15:12:28 | Araq | ekarlso-: not sure if the mysql wrapper was updated to handle NULL "properly" |
15:13:11 | ekarlso- | Araq: uh, so how to fix that then ? :/ |
15:13:28 | * | ARM9 joined #nim |
15:13:46 | Y0Gi_ | BlaXpirit: thanks, I must have been doing something wrong there. |
15:13:57 | no_name | hrms.. that's not working so well... so I'm on a windows machine with msys/mingw installed, and trying to use zlib, when I run my program it complains it can't find zlib1.dll. my system actually has like 8 zlib1.dll's already. I've taken several (including the one shipped with Aporia) and put them in the current dir, with no effect |
15:14:05 | BlaXpirit | Y0Gi_, toSeq is not trivial to find |
15:14:19 | ARM9 | Hi, does nim have any support for inline assembly? |
15:14:40 | Y0Gi_ | BlaXpirit: then again, sequtils seems to only contain toSeq (a template), not toseq (as far as http://nim-lang.org/sequtils.html tells me) |
15:14:52 | Araq | ARM9: yes check out the asm keyword |
15:14:56 | BlaXpirit | Y0Gi_, case insensitive language |
15:15:08 | BlaXpirit | only 1st letter is case sensitive |
15:15:22 | Y0Gi_ | BlaXpirit: urgs |
15:15:45 | ekarlso- | Araq: u want a bug boss ? |
15:15:46 | * | MrBlaise quit (Remote host closed the connection) |
15:16:23 | Y0Gi_ | the type of 1..4 is Slice[int], is that right? |
15:16:40 | Araq | ekarlso-: afaict db_mysql has been updated |
15:16:58 | ekarlso- | https://github.com/Araq/Nim/issues/1837 < Araq |
15:17:49 | Araq | ekarlso-: collectionToString doesn't deal with 'nil' strings. nothing does. |
15:18:03 | Araq | the wrapper returns a nil string though for NULL. |
15:18:23 | * | loz quit (Ping timeout: 240 seconds) |
15:18:27 | Araq | this is just the old nil string gotcha, has nothing to do with the mysql wrapper |
15:18:44 | ekarlso- | Araq: eh, so what am I doing wrong then? |
15:19:05 | Araq | and according to your bug report you do get a stack trace |
15:19:41 | Araq | ekarlso-: write your own outputRow proc |
15:19:47 | ekarlso- | did you ask if i got one ? |
15:19:51 | ekarlso- | sorry if that |
15:20:04 | ekarlso- | really ? |
15:20:09 | Araq | or wait until $ works for 'nil' |
15:20:16 | ekarlso- | sigh |
15:20:45 | BlaXpirit | .eval echo nil |
15:20:48 | Mimbus | BlaXpirit: eval.nim(3, 5) Info: instantiation from here |
15:20:59 | Varriount|Busy | no_name: Um, you do know that dll's can't be statically linked to? |
15:21:03 | BlaXpirit | mmmmmkay |
15:21:10 | Varriount|Busy | no_name: You need a lib file for that. |
15:21:11 | BlaXpirit | almost anything can be echod, why not nil? |
15:21:19 | Araq | .eval echo string(nil) |
15:21:23 | Mimbus | Araq: Error: execution of an external program failed; rerun with --parallelBuild:1 to see the error message |
15:21:31 | Araq | yay |
15:21:33 | BlaXpirit | .eval echo($nil) |
15:21:36 | Mimbus | BlaXpirit: eval.nim(3, 5) Info: instantiation from here |
15:21:52 | flaviu | BlaXpirit: It only prints the first line |
15:21:53 | ekarlso- | a bit funky that there's no support for a standard db thing.. |
15:22:20 | Araq | ekarlso-: the db libs changed the rest of the language wasn't |
15:22:28 | Araq | prepared for this change |
15:22:36 | Araq | I was against this change btw |
15:22:49 | ekarlso- | against it how ? |
15:22:50 | Y0Gi_ | BlaXpirit: may you can give me a hint why toSeq doesn't work in that context? http://hastebin.com/asovajuxus.pl |
15:22:57 | Y0Gi_ | s/may/maybe/ |
15:22:58 | Araq | so *shrug*, it will get better and there is a limit to what I can do |
15:23:09 | * | gmpreussner quit (Ping timeout: 245 seconds) |
15:23:14 | BlaXpirit | ekarlso-, i like http://bpaste.net/ btw |
15:23:15 | * | gmpreussner_ joined #nim |
15:23:22 | BlaXpirit | that link u sent is just unreadable |
15:23:35 | ekarlso- | BlaXpirit: ok.. |
15:23:47 | Dispatch | Hi everyone |
15:23:51 | BlaXpirit | wait |
15:23:52 | BlaXpirit | sorry |
15:23:52 | BlaXpirit | i mean Y0Gi_ |
15:24:04 | ekarlso- | I dont wanna start doing stuff that should be done there for me already :/ |
15:24:37 | Varriount|Busy | Araq: What change were you against? |
15:24:39 | Y0Gi_ | BlaXpirit: this should provide enough contrast if that's your point: http://hastebin.com/raw/asovajuxus |
15:24:43 | BlaXpirit | Y0Gi_, ok, this is strange |
15:24:46 | Araq | ekarlso-: maybe your production app doesn't just 'echo' rows though |
15:25:21 | Y0Gi_ | BlaXpirit: I'm on nim 0.10.2 here btw |
15:25:21 | Araq | Varriount|Busy: that we map NULL to 'nil' strings. I wanted the db* libs to use JSON instead |
15:25:46 | Varriount|Busy | Araq: *shrug* |
15:25:59 | ekarlso- | Araq: true enough ! |
15:26:00 | BlaXpirit | so Y0Gi_, there is some magic happening |
15:26:08 | * | gokr joined #nim |
15:26:10 | BlaXpirit | toSeq accepts openarray (among other things) |
15:26:25 | BlaXpirit | and if used as toSeq(1..5), it can treat any iterable as openarray |
15:26:27 | BlaXpirit | i'm pretty sure |
15:26:28 | Araq | Y0Gi_: toSeq calls items, there is no items for Slice |
15:26:40 | Araq | since nobody does: |
15:26:40 | BlaXpirit | but there is not toSeq defined for Slice[int] |
15:26:44 | Dispatch | I have a ptr int16 and would like to write int16 values to that pointer, I can do ptrvar[] = 12345, but how do I increase the pointer to the next value? |
15:26:45 | Araq | var r = 1..3 |
15:26:49 | Araq | for x in r: |
15:26:57 | Araq | but everybody does: for x in 1..3 |
15:27:01 | Y0Gi_ | .eval echo NimVersion |
15:27:04 | Mimbus | Y0Gi_: 0.10.1 |
15:27:26 | BlaXpirit | Araq, ... |
15:27:46 | BlaXpirit | .eval import sequtils;echo toSeq(1..5) |
15:27:49 | Mimbus | BlaXpirit: @[1, 2, 3, 4, 5] |
15:27:51 | BlaXpirit | .eval import sequtils;let r = 1..5;echo toSeq(r) |
15:27:54 | Mimbus | BlaXpirit: eval.nim(5, 11) Error: type mismatch: got (Slice[int]) |
15:27:56 | BlaXpirit | the confusion is natural |
15:28:11 | Y0Gi_ | Araq: I see. but I'd like to avoid creating a sequence in a for loop. |
15:28:37 | Araq | Y0Gi_: for i in 0..8 doesn't create a seq |
15:28:59 | Araq | there are 2 '..'. One contructs a Slice for the [] access |
15:29:06 | Araq | the other is an iterator |
15:29:12 | BlaXpirit | Araq, the guy wants to convert a Slice to seq |
15:29:12 | BlaXpirit | what are you talking about? |
15:29:12 | Y0Gi_ | Araq: exactly that's my point. but I could create an array, fill it via numeric index etc. |
15:29:52 | Araq | Y0Gi_: toSeq(r.a .. r.b) should work |
15:30:08 | Araq | (adding to the confusion, I know I know) |
15:30:21 | Y0Gi_ | Araq: indeed, it does. |
15:30:24 | BlaXpirit | Araq, why the inconsistency? |
15:30:24 | BlaXpirit | it makes me sad |
15:30:43 | Araq | BlaXpirit: there is no inconsistency, just a missing 'items' for Slice[T] |
15:30:52 | BlaXpirit | ooooohh |
15:30:55 | Y0Gi_ | so, as probably the first person to try that, may I request an overload of `items` for a slice? :) |
15:31:05 | Araq | make a PR |
15:31:09 | BlaXpirit | it sure would be useful as heck |
15:31:12 | Y0Gi_ | will do |
15:31:21 | BlaXpirit | why does for of a slice work then??????? |
15:31:33 | Y0Gi_ | second one today. productive new year so far ;) |
15:31:40 | gokr | BlaXpirit: because its not a slice |
15:31:51 | BlaXpirit | [:30:08] <BlaXpirit> Araq, why the inconsistency? |
15:32:00 | gokr | Araq just said there are two '..' |
15:32:23 | gokr | But I agree - it is a bit confusing. |
15:33:21 | gokr | I added for fun, a map that operates on Slice[T] - and that works fine. But... Araq felt we really should create an Interval type instead. |
15:33:24 | gokr | IIRC |
15:34:18 | * | loz joined #nim |
15:34:45 | * | BitPuffin joined #nim |
15:37:04 | ekarlso- | https://bpaste.net/show/a5e820382fc9 < what exactly actually failed there :/ |
15:38:24 | Varriount|Busy | Hello loz |
15:38:27 | dom96 | soemthing is nil |
15:38:31 | dom96 | *something |
15:38:39 | ekarlso- | yeah, I see it now |
15:38:58 | ekarlso- | would be nice if it said more then sigserv.. |
15:39:52 | dom96 | it used to... Araq messed it up :P |
15:40:00 | * | BitPuffin quit (Ping timeout: 265 seconds) |
15:40:03 | ekarlso- | pfffffffft |
15:40:06 | ekarlso- | bad Araq :p |
15:40:22 | flaviu | Use gdb, it gives a stack trace |
15:40:27 | ekarlso- | ok |
15:41:08 | flaviu | but make sure to compile with --linedir:on --debugInfo |
15:41:47 | ekarlso- | does Nim like to use camelcase or ? |
15:43:09 | ARM9 | I wonder, would it be possible to change the asm block quotation with macros or something |
15:43:33 | gokr | ekarlso-: Are you on Linux? |
15:43:53 | gokr | I tried a few debugger frontends earlier and IMHO KDevelop was smoothest. |
15:44:10 | ekarlso- | gokr: ya |
15:44:39 | flaviu | you don't really need a frontend. l33t h@x0rs don't use them ;) |
15:44:43 | gokr | Debugging with stepping in/out etc + breakpoints and so on worked great in KDevelop, as long as you compile with those flags flaviu mentioned. |
15:44:48 | flaviu | but really, just do `run`, and then `bt` |
15:44:57 | gokr | flaviu: Its still quite nice. |
15:45:33 | gokr | And personally I laugh at people who claims IDEs and debuggers are "for wimps". |
15:45:38 | Varriount|Busy | ekarlso-: S-s-s-style guide! |
15:45:44 | Varriount|Busy | ekarlso-: https://github.com/Araq/Nim/wiki/NEP-1-:-Style-Guide-for-Nimrod-Code |
15:46:10 | gokr | I worked at a die hard Vim/Perl company a year back - introduced Komodo and remote debugging for them - they gasped in awe. For god's sake... and I am not even a Perler. |
15:46:34 | ekarlso- | I love ipdb.. |
15:46:54 | Varriount|Busy | gokr: Well, a good debugger and IDE are nice things. I just dislike when you have to *rely* on them to be productive in a language. *cough*java*cough* |
15:47:10 | flaviu | gokr: You can do remote debugging with text-mode gdb |
15:47:24 | gokr | Of course you can. That was not my point. |
15:47:54 | gokr | My point was those guys never thought debugging was "needed" so they riddled code with prints instead and spent hours on end to track down crap. |
15:48:04 | ARM9 | that's just silly |
15:48:13 | gokr | Yep, |
15:48:36 | gokr | So all that "real cool dudes don't need debuggers" etc - ha. |
15:48:48 | * | BlaXpirit_ joined #nim |
15:49:35 | gokr | The other day there were some Nimmers here trying to figure out what was happening in some web code... some macro or what was it? I didn't say anything at the time but it sure felt that a true "hey, did you try a debugger?"-moment. |
15:49:48 | gokr | "like a true" |
15:49:58 | Y0Gi_ | Araq, BlaXpirit_: while I seem to have managed to implement `items` for a slice, I ran into a problem with the `toSeq` implementation at https://github.com/Araq/Nim/blob/master/lib/pure/collections/sequtils.nim#L310 |
15:50:19 | * | chrisheller quit (Ping timeout: 252 seconds) |
15:50:19 | Varriount|Busy | Y0Gi_: What exactly is the problem? |
15:50:21 | Y0Gi_ | Error: type mismatch: got (seq[Slice[int]], int) |
15:51:05 | flaviu | gokr: You can honestly turn vim into a pretty decent IDE with ctags. I'm surprised you were able to convert a bunch of vimmers to Komodo |
15:51:07 | Y0Gi_ | so the template tries to create a seq of type seq[Slice[int]] and then tries to pass it to `add`. and I'm pretty sure having that sequence in the first place is not right. |
15:51:51 | Y0Gi_ | or, `type(iter)` should result in `T` when given `Slice[T]`. |
15:52:00 | gokr | flaviu: I didn't convert them. I just showed them in a few hours that its easy to set up remote Perl debugging. |
15:52:09 | Varriount|Busy | Y0Gi_: Ouch. |
15:52:27 | Varriount|Busy | Y0Gi_: I wonder why that's a template, and not a procedure... |
15:53:08 | Y0Gi_ | Varriount|Busy: well, I'm just a new guy in Nim land. |
15:54:11 | Y0Gi_ | I'm somewhat reluctant to add a special case there. feels a bit like the slice type itself needs adjustment. |
15:55:24 | Varriount|Busy | Y0Gi_: Yeah, I understand your hesitation. Araq, what's your verdict? |
15:56:13 | * | chrisheller joined #nim |
15:56:36 | Y0Gi_ | oh damn, slice can be high-to-low as well, I guess? |
15:57:03 | Varriount|Busy | Y0Gi_: I think? |
15:57:37 | Varriount|Busy | Y0Gi_: In the end, it's just a generic type with two fields |
15:59:17 | Araq | high-to-low is not supported via '..' |
15:59:29 | Araq | nor are strides |
15:59:37 | def- | oh, the behaviour of object inheritance recently changed? |
15:59:44 | Varriount|Busy | Araq: Why isn't high-to-low supported? |
15:59:53 | def- | I need "ref object" now to get methods working? |
16:00:32 | Varriount|Busy | def-: You shouldn't, unless the object is being implicitly downcasted, and the data cut off. |
16:00:34 | Araq | def-: no, but I fixed bugs which result in a change of behaviour |
16:00:58 | Araq | and yeah, we should forbid data cutting off from happening at runtime |
16:01:01 | * | willwillson joined #nim |
16:01:06 | def- | Varriount|Busy: yeah, implicit downcast is exactly what I'm doing |
16:01:14 | Y0Gi_ | hm. I think a saw a github issue with [1.. -1] as an example. |
16:01:36 | Varriount|Busy | def-: Well, if data is being cut off, then the method should dispatch to the new data type |
16:01:40 | loz | Varriount|Busy: hi? |
16:02:03 | def- | Varriount|Busy: I guess this is fine then: https://gist.github.com/def-/c0be89b6b88ebb1159ba |
16:02:11 | Araq | Y0Gi_: I think type(items(a..b)) should yield 'int', not Slice[int] |
16:02:25 | Araq | are you sure you wrote the items correctly? |
16:02:35 | * | saml_ joined #nim |
16:02:56 | flaviu | .eval echo type(items(a..b)) |
16:02:59 | Mimbus | flaviu: eval.nim(3, 16) Error: undeclared identifier: 'a' |
16:03:05 | flaviu | .eval echo type(items(1..2)) |
16:03:08 | Mimbus | flaviu: eval.nim(3, 15) Error: type mismatch: got (Slice[int]) |
16:03:45 | BlaXpirit_ | Nim seems like such a good language, but the standard library....... |
16:04:51 | Varriount|Busy | def-: Yeah. And that makes sense too. I'm actually surprised that the previous behavior didn't cause a memory corruption |
16:05:26 | def- | Varriount|Busy: yeah, makes sense. maybe it did and that just went unnoticed |
16:05:29 | Y0Gi_ | Araq: no, I'm not sure. my implementation is this: https://bpaste.net/show/dc17b749dc58 |
16:06:06 | ErikBjare_ | dom96: Not yet |
16:06:17 | Y0Gi_ | what I have discovered so far: as long as I don't overload `items` for Slice, the openarray variant seems to be called. |
16:07:19 | Y0Gi_ | but isn't `items` what is called for a `for ... in` loop? the toSeq template uses that, too, so I'd guess it should've worked out of the box. |
16:07:52 | flaviu | BlaXpirit_: I agree, you should try writing another stdlib. It worked for D! |
16:08:10 | BlaXpirit_ | Y0Gi_, actually I bet toSeq uses openarray |
16:08:23 | BlaXpirit_ | naaah |
16:08:24 | Varriount|Busy | BlaXpirit_: Feel free to give the stdlib an overhaul |
16:08:44 | BlaXpirit_ | Varriount|Busy, nobody's gonna accept that |
16:09:01 | * | chrisheller quit (Ping timeout: 252 seconds) |
16:09:16 | Y0Gi_ | is there a proc or expression that tells the type of a variable? |
16:09:29 | Varriount|Busy | Y0Gi_: type(variable) |
16:09:31 | def- | Y0Gi_: type(x) |
16:09:39 | Y0Gi_ | well, I thought so. |
16:10:02 | Y0Gi_ | .eval type(1..4) |
16:10:05 | Mimbus | Y0Gi_: eval.nim(3, 8) Error: ')' expected |
16:10:27 | flaviu | I might have an old copy of the compiler |
16:10:42 | def- | .eval import typetraits;echo name(type(1)) |
16:10:46 | Mimbus | def-: int |
16:10:59 | dv- | http://pastebin.com/bJymk9Ye why does the plot window open after the sleep? |
16:11:09 | Y0Gi_ | .eval let r = 1..4; echo type(r) |
16:11:12 | Mimbus | Y0Gi_: eval.nim(4, 5) Error: type mismatch: got (typedesc[Slice[int]]) |
16:11:20 | Y0Gi_ | gna |
16:11:24 | def- | dv-: p.inputStream.fflush |
16:11:32 | * | kapil__ quit (Quit: Connection closed for inactivity) |
16:11:39 | def- | dv-: oops, flushFile* |
16:12:18 | dv- | but it's a Stream |
16:12:41 | dv- | oh there's a flush for streams |
16:12:50 | Araq | Y0Gi_: report it please, looks correct to me |
16:12:51 | * | darkf quit (Quit: Leaving) |
16:12:53 | dv- | it doesn't work though |
16:12:54 | def- | p.inputStream.flush |
16:13:20 | Y0Gi_ | Araq: which part exactly should I report? |
16:13:30 | * | MrBlaise joined #nim |
16:13:40 | Araq | "items for Slice makes toSeq fail" |
16:13:52 | Y0Gi_ | ok |
16:14:24 | def- | dv-: works with writeln |
16:14:35 | * | MrOrdinaire joined #nim |
16:14:54 | dv- | def-: oh doh! |
16:14:56 | dv- | thanks |
16:15:56 | Y0Gi_ | what is `..` called anyway? isn't that a "range"? |
16:16:30 | dv- | it's a Slice |
16:16:34 | Y0Gi_ | oh wait, it's a slice |
16:16:39 | Y0Gi_ | yeah thanks |
16:17:01 | * | petantik quit (Changing host) |
16:17:01 | * | petantik joined #nim |
16:19:02 | skyfex | Araq: I looked a bit at unsigned related issues like https://github.com/Araq/Nim/issues/936 |
16:19:21 | skyfex | Araq: But I need to know what you're thinking about how to solve them |
16:19:40 | skyfex | So I got some questions (coming up.. :) |
16:20:55 | Araq | well? |
16:22:06 | skyfex | 1: Do you want implicit conversions from uint to int when it's safe? |
16:22:06 | skyfex | a: Do you want it built into the compiler or |
16:22:07 | skyfex | b: Added to the unsigned module as "converter's? |
16:22:40 | Araq | uh oh... I dunno. |
16:22:55 | Araq | I want people to stop using unsigned... ;-) |
16:22:59 | gokr | Y0Gi_: So... I added your items - and ran "toSeq(1..4)" and that worked for me. |
16:23:25 | Araq | gokr: toSeq(1..4) always worked though |
16:23:40 | Araq | var r = 1..4; toSeq(r) # is the test case |
16:23:46 | ekarlso- | meh, how can I cast to a diff type ? |
16:23:57 | skyfex | K, I can go the easy route then, and implement whatever I can in lib/core/unsigned.nim |
16:24:02 | ekarlso- | as in string to int64 |
16:24:27 | ekarlso- | since obviously it doesn't fixup the value of a "id" which is int in mysql when doing a SELECT |
16:24:31 | * | fungos_ joined #nim |
16:24:41 | gokr | Araq: Ok. toSeq(items(r)) works though. |
16:24:50 | gokr | But yes, toSeq(r) failed. |
16:25:18 | skyfex | Araq: I get the point of avoiding unsigned, but it's nice to have a working unsigned module when interfacing with C sometimes.. libusb uses lots of unsigned types :/ |
16:25:31 | Araq | skyfex: ok, integer literal parsing need to be fixed though |
16:25:42 | Araq | you cannot avoid that via unsigned |
16:25:48 | Araq | *the unsigned module |
16:25:49 | skyfex | True |
16:26:12 | ekarlso- | anyone ? |
16:26:20 | Araq | skyfex: I wrap these as signed integers usually |
16:26:30 | Y0Gi_ | here's the issue I created: https://github.com/Araq/Nim/issues/1839 |
16:26:31 | ekarlso- | .eval int64("1") |
16:26:34 | Mimbus | ekarlso-: eval.nim(3, 5) Error: conversion from string to int64 is invalid |
16:26:39 | def- | ekarlso-: 1 moment |
16:26:40 | Araq | ekarlso-: parseInt |
16:26:41 | ekarlso- | meh, how does that work |
16:26:46 | skyfex | Araq: Should literals for uint64 work for numbers that can't fit in int64? |
16:26:59 | def- | .eval import strutils; parseBiggestInt("1") |
16:27:02 | Mimbus | def-: eval.nim(4, 15) Error: value of type 'BiggestInt' has to be discarded |
16:27:26 | BlaXpirit_ | .eval import strutils; echo parseBiggestInt("1") |
16:27:28 | Araq | skyfex: no these should always require an u64 suffix |
16:27:30 | Mimbus | BlaXpirit_: 1 |
16:27:41 | Araq | skyfex: otherwise int128 will cause lots of trouble |
16:28:07 | BlaXpirit_ | .eval echo 18446744073709551615u64 |
16:28:10 | Mimbus | BlaXpirit_: eval.nim(3, 5) Error: number 18446744073709551615 out of valid range |
16:28:26 | Araq | BlaXpirit_: that is the bug we're talking about |
16:28:29 | BlaXpirit_ | ok |
16:28:43 | * | lodyb quit (Quit: Lost terminal) |
16:29:23 | * | kh4z joined #nim |
16:29:32 | skyfex | Araq: Right, but now numbers in the range 2 shl 63 .. 2 shl 64 doesn't work even with the 'u64 suffix.. I suppose that's a bug? |
16:29:57 | skyfex | Right, you just answered that :P |
16:32:04 | * | kh4z quit (Client Quit) |
16:36:39 | * | kh4z joined #nim |
16:37:06 | * | Robert___ joined #nim |
16:37:33 | skyfex | Araq: Hm, why are big numbers int64 and not still 'int literal'? |
16:38:23 | * | Robert___ quit (Client Quit) |
16:41:42 | BlaXpirit_ | Mimbus, you should just write out a value if it "has to be discarded" |
16:41:55 | skyfex | Oh, and how do I run the compiler tests again? |
16:43:40 | tane | Is there any way to have anonymous tuples, not requiring member naming? |
16:43:58 | * | Dispatch quit (Quit: Page closed) |
16:44:05 | dv- | well you can say (1, 2, 3) |
16:44:38 | tane | say i want to return a tuple if int * string, i use proc .... : tuple[int,string] = |
16:47:55 | * | MrOrdinaire quit (Remote host closed the connection) |
16:48:23 | * | BitPuffin joined #nim |
16:49:26 | BlaXpirit_ | name tham "a" and "b" |
16:49:28 | dv- | you can deconstruct tuples in a let |
16:49:35 | dv- | let (num, str) = func() |
16:50:03 | tane | alright, thanks |
16:50:28 | * | Puffin joined #nim |
16:52:06 | * | gokr quit (Quit: Leaving.) |
16:52:43 | * | BlaXpirit_ quit (Quit: Quit Konversation) |
16:52:58 | * | tgkokk joined #nim |
16:55:18 | * | Puffin quit (Ping timeout: 244 seconds) |
16:56:31 | * | MrOrdinaire joined #nim |
16:57:43 | * | gokr_ joined #nim |
16:58:42 | * | Sphax joined #nim |
17:01:41 | * | yglukhov__ quit (Ping timeout: 265 seconds) |
17:05:34 | * | chrisheller joined #nim |
17:09:53 | * | chrisheller quit (Ping timeout: 252 seconds) |
17:10:08 | * | kh4z quit (Remote host closed the connection) |
17:10:39 | * | gokr_ quit (Ping timeout: 245 seconds) |
17:28:48 | * | gmpreussner__ joined #nim |
17:28:53 | * | gmpreussner_ quit (Ping timeout: 244 seconds) |
17:31:21 | * | kniteli joined #nim |
17:31:32 | * | atticusalien joined #nim |
17:35:34 | * | MrBlaise quit (Remote host closed the connection) |
17:35:36 | * | gokr_ joined #nim |
17:38:37 | * | atticusalien quit (Ping timeout: 240 seconds) |
17:38:52 | * | atticusalien joined #nim |
17:41:34 | * | MrBlaise joined #nim |
17:45:31 | jh32 | I'm playing with wrapping some fltk. It works basically: http://flpsed.org/tmp/fltk.nim |
17:47:08 | jh32 | I'm facing two issues: I need a C++ lib to add constructors without parameters, and I can't replicate the class hierarchy of fltk in nim, so I need the cast (line 35) |
17:47:36 | jh32 | is there better ways to deal with that? |
17:48:13 | * | atticusalien quit (Ping timeout: 256 seconds) |
17:52:54 | * | MrOrdinaire quit (Remote host closed the connection) |
17:53:10 | * | MrOrdinaire joined #nim |
17:53:39 | * | MrOrdinaire quit (Remote host closed the connection) |
17:54:26 | Varriount|Busy | jh32: Could you explain the 'lib to add constructors without parameters' bit? |
17:56:23 | jh32 | it's http://flpsed.org/tmp/fltkwrap.hh |
17:57:05 | jh32 | many classes in fltk don't have default constructors (without parameters) and I didn't manage to use them directly from nim |
17:57:53 | Varriount|Busy | jh32: I think the cast is fine. |
17:59:06 | * | dts|pokeball joined #nim |
18:01:58 | * | gokr joined #nim |
18:02:24 | * | Trustable joined #nim |
18:03:21 | jh32 | ok, thanks. I would have hoped that I could define e.g. TNim_Toggle_Button as object of TFl_Widget, but that didn't work |
18:04:34 | Varriount|Busy | jh32: Unfortunately, C++ is hard to interface with. |
18:05:13 | * | loz quit (Ping timeout: 256 seconds) |
18:05:13 | * | gokr_ quit (Ping timeout: 250 seconds) |
18:08:49 | jh32 | anyway, I think I have everything working to get started |
18:13:57 | * | gmpreussner__ quit (Ping timeout: 240 seconds) |
18:14:15 | * | gmpreussner__ joined #nim |
18:17:46 | * | gokr quit (Ping timeout: 250 seconds) |
18:19:54 | * | shevy joined #nim |
18:20:00 | shevy | happy new year to nim! \o~ |
18:21:49 | * | loz joined #nim |
18:26:18 | * | Sphax quit (Quit: ZZZZZzzzzz) |
18:27:16 | * | yglukhov__ joined #nim |
18:28:19 | joebo | I have a seq[seq[int]] that I need to pass to a C function as a ptr int. What would be the right way to do that? Should I convert it to a flat array somehow? |
18:29:11 | dts|pokeball | hold on. ive got a rosetta code link for this |
18:29:43 | joebo | I see one for flattening a list |
18:30:10 | joebo | but that results in a sequence |
18:30:13 | BlaXpirit | joebo, flattening is definitely recommended |
18:30:13 | BlaXpirit | otherwise you don't have any guarantees |
18:30:17 | dts|pokeball | http://rosettacode.org/wiki/Use_another_language_to_call_a_function#Nimrod |
18:31:03 | dts|pokeball | BlaXpirit, whats flattening a list? |
18:31:04 | BlaXpirit | this seems irrelevant |
18:31:23 | BlaXpirit | well seq[seq -> seq |
18:31:28 | dts|pokeball | ah |
18:31:35 | joebo | ok, so if I had a flat sequence, how would I convert that to an array? |
18:31:49 | BlaXpirit | addr that[0] |
18:31:50 | def- | joebo: addr mySeq[0] |
18:32:22 | joebo | oh, perfect. I didn't want to assume a sequence stored the data contiguously |
18:32:37 | joebo | thanks, I'll give it a shot |
18:35:15 | Varriount|Busy | BlaXpirit, def-, joebo: No, don't do that unless the sequence is guaranteed to stay alive and not be modified |
18:36:30 | def- | Varriount|Busy: I assumed that the sequence is passed, the C code calculates something and then returns some result |
18:36:36 | BlaXpirit | yeah.. |
18:36:59 | * | gokr joined #nim |
18:37:16 | * | dyu quit (Quit: Leaving) |
18:37:49 | Varriount|Busy | .eval var g = @[1,2,3,4,5];var x = cast[array[len(g), int](unsafeNew(sizeof(int))) |
18:37:52 | Mimbus | Varriount|Busy: eval.nim(5, 0) Error: ']' expected |
18:38:03 | Varriount|Busy | .eval var g = @[1,2,3,4,5];var x = cast[array[len(g), int]](unsafeNew(sizeof(int))) |
18:38:06 | Mimbus | Varriount|Busy: eval.nim(4, 23) Error: cannot evaluate at compile time: g |
18:38:30 | Varriount|Busy | Oh, I need to use an unchecked array |
18:40:46 | Varriount|Busy | joebo: For future reference, be very carefull passing the address of a sequence's first element to a C function expecting an array pointer. A Nim sequence is a dynamic array, so if it's modified while the C code has hold of it, bad things could happen. |
18:41:36 | joebo | Varriount|Busy: thanks, that makes sense |
18:42:08 | ldlework | Has anyone here spoken to yenic about Python interop? |
18:42:22 | joebo | I'm getting a SIGSEV illegal storage access so I don't think it's working quite right |
18:42:52 | ldlework | Also, are types values in Nim? |
18:43:01 | Varriount|Busy | ldlework: Depends on the type |
18:43:31 | ldlework | Varriount|Busy: I'm thinking about like an entity component system where you have a map that maps from type to an array of values or something |
18:43:35 | ldlework | Like in Python you could easily use the class as a key in a dictionary |
18:43:56 | Varriount|Busy | ldlework: I don't follow |
18:43:58 | def- | ldlework: types are values of type typedesc |
18:44:02 | * | dts|pokeball quit (Read error: Connection reset by peer) |
18:44:24 | ldlework | def-: are they distinct? Could use use types as a mapping key? |
18:44:38 | * | ErikBjare_ quit (Ping timeout: 244 seconds) |
18:44:42 | def- | not sure |
18:44:53 | ldlework | def-: thanks a lot for your artcle on Nim btw |
18:44:55 | def- | try it out with a hash set? |
18:44:57 | ldlework | Very well written, very useful |
18:45:03 | Varriount|Busy | ldlework: Not yet... values of typedesc only exist at compile time. |
18:45:03 | def- | thanks |
18:45:15 | Varriount|Busy | ldlework: You can use the typeinfo module though... |
18:45:22 | * | dts|pokeball joined #nim |
18:45:26 | ldlework | Varriount|Busy: doh |
18:45:29 | ldlework | So you'd have to have like a superflous enum for each type you want to use |
18:45:49 | ldlework | Basically the same situation in Rust and Golang |
18:46:04 | ldlework | (in Go you can use empty interface{} but now you're not type safe) |
18:46:36 | Varriount|Busy | ldlework: It might be better to use an enum, and manually map each type |
18:46:56 | ldlework | Varriount|Busy: yeah its just.. now you have two tokens for what is essentially one thing |
18:47:02 | ldlework | But its fine-ish |
18:47:11 | Varriount|Busy | ldlework: *shrug* |
18:47:23 | ldlework | I have to really try to eventually look up the C# implementation |
18:47:24 | ldlework | See how it is done there |
18:48:27 | Varriount|Busy | ldlework: What about typetraits.name? |
18:49:12 | Varriount|Busy | ldlework: The only problem you have then is to make sure that there aren't two modules with types that share the same name |
18:49:13 | * | Mimbus quit (Read error: Connection reset by peer) |
18:49:13 | * | flaviu quit (Read error: Connection reset by peer) |
18:49:31 | ldlework | Its not a huge deal to use an enum |
18:49:51 | * | chrisheller joined #nim |
18:49:58 | ldlework | But I will say that Nim will have some slight advantage over other languages if you can use type names themselves as values somehow |
18:49:58 | ldlework | at runtime |
18:50:00 | ldlework | but its probably not useful for many things |
18:50:32 | ldlework | like even if each type was assigned some integer value globally |
18:50:49 | ldlework | like the type names in a value context are evaluated as enum's that the compiler establishes over all the types in the program |
18:52:35 | * | flaviu joined #nim |
18:53:01 | * | superfunc joined #nim |
18:54:33 | superfunc | dom96: I cold-called the guy from wired, we'll see what happens |
18:56:14 | * | loz quit (Ping timeout: 265 seconds) |
18:57:05 | def- | superfunc: cool |
19:07:25 | * | rpag joined #nim |
19:07:37 | * | quasinoxen quit (Ping timeout: 255 seconds) |
19:12:04 | superfunc | Whoever did the rework on the manual's css, great work. Haven't been able to be online much lately and missed quite a bit |
19:14:00 | Varriount|Busy | Hm... what would the attributes of 'relative' and 'absolute' be described as, with regards to file system paths? |
19:16:02 | * | brson joined #nim |
19:16:20 | ldlework | Varriount|Busy: I don't really understand the question |
19:16:26 | * | quasinoxen joined #nim |
19:17:13 | Varriount|Busy | ldlework: I'm trying to think of a name for an enum that contains 'relative' and 'absolute' |
19:17:14 | flaviu | superfunc: it was boydgreenfield |
19:18:08 | ldlework | Varriount|Busy: orientation is the best that's coming to mind |
19:18:11 | ldlework | Varriount|Busy: relativity? |
19:18:45 | no_name | I'm having a hell of a time figuring out how to compile a binary on windows 64-bit that uses zlib. I've tried a bunch of things. Help! |
19:18:47 | ldlework | Varriount|Busy: Basing? |
19:19:02 | * | ldlework throws no_name a lifesafer |
19:19:23 | ldlework | Oh no its a sentimental lifesafer without substance! |
19:19:31 | * | ldlework watches no_name drown. |
19:19:31 | ldlework | :( |
19:20:01 | jsudlow | :'( |
19:21:35 | Varriount|Busy | no_name: First off, are you using a lib file, and not a dll? |
19:21:48 | no_name | Varriount|Busy: I've tried both |
19:21:59 | no_name | can't get any zlib1.dll I can either get or compile to be recognized |
19:22:10 | no_name | haven't been able to make a lib file that it's happy with yet |
19:22:32 | Varriount|Busy | no_name: Well, you can't statically link a dll. |
19:22:36 | no_name | I know |
19:22:46 | no_name | the default is for it to dynamically import it |
19:22:47 | dts|pokeball | heh |
19:23:02 | Varriount|Busy | no_name: What C compiler are you using? And what options have you passed to the compiler? |
19:23:03 | no_name | get "could not load: zlib1.dll" at program run |
19:23:27 | no_name | the mingw that's distributed with nim |
19:23:35 | dts|pokeball | does it know where zlib1.dll is? |
19:24:35 | no_name | I've tried putting it in the same dir and in system32 |
19:24:39 | Varriount|Busy | dts|pokeball: He doesn't want to load the dll, he wants a static lib included in the binary |
19:24:57 | no_name | I'd prefer a static lib, but I'm almost at the point where I'll take it where I can get it |
19:25:43 | Varriount|Busy | no_name: Have you checked that the dll's that are in your path/the executable directory match the architecture the executable is compiled for? |
19:26:23 | Varriount|Busy | no_name: A 64-bit program won't load or link 32-bit dlls, or vice-versa |
19:26:25 | no_name | not sure how to do that - I didn't see anything obvious in the properties for them |
19:26:28 | no_name | yeah, I know |
19:26:40 | * | chrisheller quit (Remote host closed the connection) |
19:27:01 | Varriount|Busy | no_name: http://blog.ringerc.id.au/2012/12/how-to-tell-if-dll-is-32-bit-x86-or-64.html |
19:27:23 | BlaXpirit | is there any way to introduce namespaces? |
19:27:46 | * | dain joined #nim |
19:27:54 | Varriount|Busy | BlaXpirit: You mean, besides module namespaces? No. |
19:28:14 | BlaXpirit | I've just realized that I can make an object...... |
19:28:33 | * | dts|pokeball quit (Ping timeout: 244 seconds) |
19:28:35 | BlaXpirit | with fields...... |
19:28:57 | ldlework | BlaXpirit: ...that's pretty typical for objects.. |
19:28:59 | ldlework | :P |
19:29:36 | * | ehaliewicz joined #nim |
19:29:37 | * | dts|pokeball joined #nim |
19:29:53 | BlaXpirit | I can't just turn this https://github.com/LaurentGomila/CSFML/blob/master/include/SFML/Window/Window.h#L43 into this https://github.com/BlaXpirit/nim-csfml/blob/master/src/csfml_window_gen.nim#L162 |
19:30:44 | ldlework | why not |
19:30:53 | BlaXpirit | horrible name pollution |
19:31:19 | * | ldlework clears his throat and puts on his best Golang cult member voice |
19:31:30 | def- | BlaXpirit: from outside you can access them as csfml.Titlebar and so on |
19:31:36 | ldlework | Ahem, if name pollution isn't your bag, then Nim might not be the best language for you |
19:31:40 | BlaXpirit | but nobody's gonna do that |
19:31:53 | BlaXpirit | no, but these are very generic names |
19:32:12 | ldlework | BlaXpirit: why do you think it has sf prefexes in the C? |
19:32:13 | Varriount|Busy | BlaXpirit: Don't forget 'import Foo as FooBar' |
19:32:27 | BlaXpirit | Varriount|Busy, I know, but still, nobody's gonna do that |
19:32:38 | Varriount|Busy | BlaXpirit: If you're writing a wrapper, don't forget about c2nim. |
19:32:39 | BlaXpirit | because procs don't get imported |
19:32:54 | BlaXpirit | and you can't just call them |
19:32:56 | ekarlso- | .eval foo |
19:32:56 | BlaXpirit | can you |
19:33:06 | ldlework | BlaXpirit: you can import multiple things |
19:33:07 | BlaXpirit | a.b(c,d) becomes sf.b(a, c, d) |
19:33:38 | EXetoC | so encourage it, and bring it up in code reviews |
19:34:03 | BlaXpirit | if i can have window.draw sprite i'm not gonna go for sf.draw(window, sprite) |
19:34:17 | BlaXpirit | and this is still not so bad as other things |
19:34:20 | ldlework | BlaXpirit: "Nim: Fix it with tooling. Fix it with culture." |
19:34:31 | BlaXpirit | setters |
19:34:52 | BlaXpirit | sprite.rotation = 45 becomes...... sf.`rotation=`(sprite, 45) |
19:34:54 | BlaXpirit | really |
19:34:54 | Varriount|Busy | BlaXpirit: Remember that name pollution doesn't matter so much - the compiler's type resolution mechanism helps. |
19:34:56 | BlaXpirit | it's not viable |
19:35:14 | ldlework | Varriount|Busy: it hurts humans |
19:35:27 | Varriount|Busy | ldlework: Howso? |
19:35:37 | ldlework | I'm not going to warrant that with a response. |
19:35:42 | EXetoC | I don't want to be forced to qualify the symbols, but I will do it myself if in doubt |
19:36:46 | Araq | skyfex: because the compiler knows 'int' is of platform specific size |
19:36:54 | EXetoC | but the author of a certain module can of course force me to do it by importing a certain way |
19:36:55 | Araq | so only int32 literals are 'int literal' |
19:37:30 | skyfex | Hmm, I see, thanks :) |
19:37:30 | EXetoC | BlaXpirit: but those kinds of collisions should be very rare |
19:37:51 | Varriount|Busy | Araq: Could you explain your reasoning for implicit importation of entire module namespace? |
19:38:35 | Araq | Varriount|Busy: I used Delphi which uses that with no problem. I used Ada which doesn't use that and was annoyed. Something like that. |
19:38:35 | EXetoC | or do you think that field assignment procs will commonly be defined outside of the module that defines said object? |
19:38:49 | BlaXpirit | import nil is basically never viable |
19:39:04 | no_name | Varriount|Busy: ok.. so I checked all 9 zlib1.dll's on my system (2 of which came in the C:\Nim\ installation directory, and the only one that was 64-bit was in my wireshark directory. I copied that one over and it crashed |
19:39:04 | Araq | IMHO this whole discussion resolves about the term "pollution" |
19:39:19 | Araq | somebody called it "pollution" and now it's "obviously bad" |
19:39:31 | Varriount|Busy | no_name: Any stack trace? |
19:39:38 | BlaXpirit | Araq, it would all be great, but seriously, I'm taking away the name "Default" |
19:39:47 | no_name | SIGSEGV: Illegal storage access. (Try to compile with -d:useSysAssert -d:useGcAssert for details.) |
19:39:48 | BlaXpirit | so I'm desperate for namespaces |
19:40:07 | Araq | BlaXpirit: a module provides a namespace, dude |
19:40:16 | skyfex | Araq: Have you thought about adding some support for abitrary-precision arithmetic in Nim? |
19:40:22 | no_name | Varriount|Busy: yeah, gc.nim:growObj -> alloc.nim:rawAlloc |
19:40:29 | BlaXpirit | Araq, but I'm not gonna make a module for every enum |
19:40:44 | Varriount|Busy | no_name: Ouch, that looks like a memory corruption error. |
19:40:48 | Araq | BlaXpirit: so use a .pure enum |
19:40:49 | EXetoC | BlaXpirit: he did acknowledge it, but some people think that collisions will be very common for large projects |
19:40:54 | no_name | Varriount|Busy: more specifically: test.nim:gunzip->gc.nim:growObj -> alloc.nim:rawAlloc |
19:40:56 | BlaXpirit | Araq, I can't because it's a bitmask |
19:40:57 | Varriount|Busy | BlaXpirit: If you're worried about enums, use the pure pragma |
19:41:07 | Araq | ? |
19:41:09 | BlaXpirit | it can't be an enum, it can only be constants |
19:41:09 | no_name | Varriount|Busy: yes it does. |
19:41:14 | EXetoC | I don't think it'll be *that* common, if the interfaces are properly designed, but if it then so be it |
19:41:20 | BlaXpirit | because it needs support for `or` (bitmask) |
19:41:22 | ldlework | Araq: "you don't need generics. they are not required. You can get by without them" |
19:41:26 | no_name | do you use any of the windows impure libraries? |
19:41:37 | ldlework | Araq: "one language has generics and they're useful and so now they're "obviously good"" |
19:41:41 | no_name | I've tried compiling zlib from source with mingw, it's kind of painful |
19:41:46 | EXetoC | then you resolve the collision by qualifying |
19:41:48 | ldlework | etc |
19:41:49 | Varriount|Busy | no_name: Yes, quite often. |
19:41:57 | EXetoC | void* ftw |
19:42:03 | Varriount|Busy | no_name: I'm about to get off work, I can help you when I get home. |
19:42:08 | no_name | yeah sure |
19:42:12 | * | dain quit (Quit: dain) |
19:42:14 | Araq | ldlework: I don't think you can apply my argument in this way |
19:42:31 | Araq | I'm talking about a term, you about a feature. |
19:42:45 | EXetoC | Varriount|Busy: and you can qualify enums even without it, but then chances are you'll use a prefix |
19:42:45 | ldlework | Araq: namespaces are the feature that are coupled to name pollution |
19:42:57 | Araq | we have namespaces |
19:43:04 | EXetoC | which is basically a convention, and that's another way of avoiding collision |
19:43:10 | ldlework | That by default import everything in the namespace into the module that's importing them |
19:43:13 | Araq | I know you all like to pretend that we don't, but we do. |
19:43:19 | ldlework | namespaces trying to avoid being namespaces |
19:43:35 | EXetoC | ecOhNo (error code: oh no) |
19:43:39 | Araq | so use 'from foo import nil'. nobody stops you |
19:43:46 | Araq | it's in the language. |
19:43:48 | ldlework | Araq: then I'm importing iterally everything manually |
19:43:55 | BlaXpirit | Araq, no, import nil is useless |
19:43:56 | ldlework | Araq: how about "import foo" imports the name 'foo' |
19:44:07 | ldlework | not foo.bar, and foo.* |
19:44:15 | ldlework | now we have Namespaces |
19:44:16 | EXetoC | so did you make a feature request? |
19:44:18 | * | Puffin joined #nim |
19:44:22 | BlaXpirit | [:34:51] <BlaXpirit> sprite.rotation = 45 becomes...... sf.`rotation=`(sprite, 45) |
19:44:27 | EXetoC | after the last discussion |
19:44:40 | * | Varriount|Busy quit (Quit: Page closed) |
19:45:13 | ldlework | EXetoC: I'll just write a feature for my IDE to solve this problem. |
19:45:17 | ldlework | OKAY I swear I'm done trolling |
19:45:27 | * | ldlework huggles everyone. |
19:45:28 | EXetoC | BlaXpirit: so that's a yes: you do think it'll be common. well I don't |
19:45:36 | EXetoC | I would support such a feature |
19:45:36 | BlaXpirit | what |
19:45:44 | EXetoC | BlaXpirit: nevermind |
19:45:45 | BlaXpirit | I don't understand what you're talking about |
19:45:54 | EXetoC | so you too want foo.* |
19:45:55 | Araq | "boohoo I want to import things explicitly. But boohoo then I have to import things explicitly." |
19:46:02 | EXetoC | there's a lot to keep track of, but I'm done now |
19:46:17 | BlaXpirit | Araq, it's just not viable as it is right now |
19:46:31 | BlaXpirit | because there is too much dependency on the procs being there with dot notation |
19:46:37 | ldlework | Araq: I don't want to import things explicitly. I want to access them from a namespace explicitly. |
19:46:52 | ldlework | Araq: "import foo" allowing me to do "foo.bar" but requirng the prefix, is what a namespace is |
19:46:56 | Araq | ldlework: 'from foo import nil' |
19:46:59 | BlaXpirit | if dot notation was something a bit more advanced, then sure |
19:47:01 | Araq | foo.bar() # works |
19:47:04 | ldlework | now I have to import everything I want to |
19:47:11 | BlaXpirit | Araq, are you sure it works? |
19:47:15 | ldlework | where'as "import foo" gives me foo.bar() |
19:47:18 | ldlework | and foo.baz() |
19:47:26 | Araq | I don't think you know how 'from foo import nil' works |
19:47:26 | ldlework | but I *can't* access "baz" without going through "foo" |
19:47:32 | ldlework | Uh yes I do |
19:47:33 | BlaXpirit | Araq, maybe. |
19:48:05 | ldlework | Its amazing that in disucssion about a simple feature, where you can sort of enumerate the different potential ways of the feature working |
19:48:16 | ldlework | and the result is like maybe 9 possible different ways the import mechanism works |
19:48:25 | ldlework | we can't just objectively talk about how they each would work differently |
19:48:34 | ldlework | and not wave our hands and say X is EQUIVALENT to Y |
19:48:41 | ldlework | when they're obviously, non-emotionally not equivalent |
19:48:45 | EXetoC | the important will end up not being as documenting, but it still serves a purpose imo. please start a discussion that's more official |
19:48:50 | BlaXpirit | Araq, so does import nil actually do what I dreamed it does and i'm full of s**t? |
19:48:54 | EXetoC | *import |
19:48:55 | * | Puffin quit (Ping timeout: 256 seconds) |
19:49:07 | Araq | BlaXpirit: I don't know. try it. |
19:49:29 | BlaXpirit | no, it doesn't |
19:49:33 | ldlework | EXetoC: its a waste of breath at this point |
19:49:38 | BlaXpirit | Error: undeclared identifier: 'vertical_sync_enabled=' |
19:49:42 | BlaXpirit | window.vertical_sync_enabled = true |
19:49:55 | * | BitPuffin quit (Ping timeout: 255 seconds) |
19:49:58 | Araq | ldlework: write some document about how you want the feature to work. |
19:49:58 | * | superfunc quit (Ping timeout: 246 seconds) |
19:50:03 | EXetoC | irc discussions can only be so productive |
19:50:12 | ldlework | okay okay |
19:50:21 | Araq | ldlework: post it on the forum. everybody agrees with you, I give up and implement it. |
19:50:28 | Araq | This is how it works. |
19:50:39 | ldlework | hehe |
19:50:56 | Araq | but I die a little inside :P |
19:51:02 | BlaXpirit | Araq, so my point remains that import nil is useless |
19:51:14 | ldlework | Araq: haha |
19:51:21 | Araq | and think my language of dreams is now gone and I'm reinventing C# |
19:51:25 | BlaXpirit | because it doesn't carry the procs necessary to do dot calls |
19:51:43 | ldlework | Araq: oh come on |
19:51:56 | ldlework | Now you're just trying to make me feel bad :( |
19:52:12 | Araq | lol, no, no, it's fine |
19:52:31 | Araq | everybody complains about it, so let's add yet another import feature |
19:52:51 | EXetoC | actually I don't care either way. collisions should be rare unless the module authors implement things like "proc doStuff[T](x: T)" |
19:52:52 | ldlework | Well, to be fair, I think in the way I've mentioned, that the current system is a subset |
19:53:02 | ldlework | So its not like you lose anything |
19:53:03 | Araq | it's not like we already have more features delegated to that than anybody else |
19:53:09 | ldlework | all "import foo" becomes "from foo import *" |
19:53:13 | ldlework | its not that big of a change |
19:53:15 | EXetoC | frequently that is |
19:53:19 | ldlework | And we allow people who want actual namespaces to have them |
19:53:25 | * | tani joined #nim |
19:53:43 | ldlework | I don't think "I don't imagine it being a problem" should be our baseline |
19:53:59 | ldlework | This *is* the same argument to Golangs "Well I get by just fine without X" |
19:54:01 | ldlework | Well great. |
19:54:19 | Araq | it's more like "it's not a problem for me, never was, never will be and if you care too much you have too much time" |
19:54:29 | * | tane is now known as Guest45758 |
19:54:29 | * | Guest45758 quit (Killed (asimov.freenode.net (Nickname regained by services))) |
19:54:29 | * | tani is now known as tane |
19:54:31 | Araq | but ok, I'll stop now. |
19:54:36 | ldlework | Araq: now apply that to generics |
19:54:50 | EXetoC | I think it's mostly a problem for operators, so one could support it for that only, but that incurs additional complexity |
19:55:05 | ldlework | EXetoC: generics in golang? or imports in nim? |
19:55:48 | ekarlso- | so how does parseInt work ? |
19:56:32 | * | gour quit (Remote host closed the connection) |
19:56:33 | EXetoC | ldlework: nim |
19:58:20 | EXetoC | an alternative could be to add support for actual member functions. the question is once again whether it's something that has been officially requested :p |
19:58:29 | Araq | if a peg operation has the Peg type as its 2nd parameter, does your "obvious" type based import mechanism account for that? |
19:59:18 | Araq | and how exactly is escapeForPeg(s: string): string "polluting" your namespace when you import pegs? |
19:59:39 | Araq | and what IS the obvious type that os.nim deals with? |
20:00:09 | * | milosn quit (Remote host closed the connection) |
20:00:23 | EXetoC | would you not approve of this: "from x import foo.*, doPegStuff"? |
20:00:57 | Araq | just some questions to consider in your proposal. |
20:01:09 | Araq | not meant as a rant. |
20:01:34 | flaviu | I'm not against the specific idea, but I don't like the idea of making things more complex than they already are. |
20:02:08 | EXetoC | ok |
20:02:38 | flaviu | If a module contains procs not for a specific type, that seems like an issue with the organization of the library, not an issue that the language needs to solve. |
20:02:40 | * | milosn joined #nim |
20:02:46 | * | BlaXpirit_ joined #nim |
20:03:59 | ldlework | Araq: obviously not all names are equally collidable |
20:04:16 | BlaXpirit_ | guys, this is all great but you seem to be forgetting that this will remain a problem: |
20:04:19 | ldlework | And collision isn't the only benefit of namespaces |
20:04:20 | BlaXpirit_ | [:34:51] <BlaXpirit> sprite.rotation = 45 becomes...... sf.`rotation=`(sprite, 45) |
20:04:52 | * | BlaXpirit quit (Ping timeout: 250 seconds) |
20:04:52 | ldlework | BlaXpirit_: that's not really a problem |
20:04:55 | BlaXpirit_ | why/ |
20:05:02 | ldlework | BlaXpirit_: because there is no such thing as sprite.rotation |
20:05:08 | ldlework | there is only sf.rotation= |
20:05:08 | * | jpoirier quit (Quit: Leaving) |
20:05:17 | ldlework | well |
20:05:22 | ldlework | attribute was a bad example |
20:05:42 | ldlework | but what I mean is, "yeah, you need to import the method that you're calling" |
20:05:49 | ldlework | no matter what syntax sugar you use to call it |
20:05:53 | BlaXpirit_ | import them all one by one? |
20:06:06 | BlaXpirit_ | (if that even works) |
20:06:09 | EXetoC | that issue is indeed very similar |
20:07:20 | skyfex | How do I run the compiler tests? |
20:07:33 | ldlework | BlaXpirit_: its true, I see what you mean |
20:07:56 | BlaXpirit_ | so can we all agree now that from x import nil is useless in the current state? |
20:07:57 | ldlework | BlaXpirit_: if you have a nimport like "import foo" which imports a namespace foo, you can't implicitly get foo.rotation= by doing a sugar assignment with "sprite.rotation" |
20:08:00 | ldlework | I get the problem now |
20:08:04 | EXetoC | skyfex: see the output of ./koch |
20:08:51 | skyfex | EXetoC: thanks :) |
20:12:19 | * | Sphax_ joined #nim |
20:12:21 | ekarlso- | .eval parseInt("16") |
20:12:47 | EXetoC | the bot is not here atm |
20:13:09 | BlaXpirit_ | :< |
20:13:13 | flaviu | 1 sec |
20:13:23 | ekarlso- | ... |
20:13:43 | * | Mimbus joined #nim |
20:13:44 | * | Mimbus quit (Remote host closed the connection) |
20:13:53 | * | Mimbus joined #nim |
20:13:56 | ekarlso- | .eval parseInt("16") |
20:14:01 | ekarlso- | still dead huh |
20:14:07 | * | Sphax_ quit (Client Quit) |
20:14:09 | * | Mimbus quit (Read error: Connection reset by peer) |
20:14:17 | flaviu | it should be in soon |
20:14:40 | Araq | BlaXpirit_: tbh I still think you're all complaining that the language is more consistent in its handling of these things than you are. |
20:14:46 | dts|pokeball | im giving up on Moe flaviu |
20:15:00 | BlaXpirit_ | Araq, no, I'm complaining that from x import nil is useless |
20:15:06 | BlaXpirit_ | [:34:51] <BlaXpirit> sprite.rotation = 45 becomes...... sf.`rotation=`(sprite, 45) |
20:15:15 | Araq | yes, just what you asked for. |
20:15:21 | dts|pokeball | BlaXpirit_, how is it useless? |
20:15:35 | ldlework | dts|pokeball: by useless he means "doesn't cover this case" |
20:15:35 | Araq | you want explicit, the language teaches you what explicit truely means. |
20:15:41 | ekarlso- | how does parseInt work then ? |
20:15:44 | * | Mimbus joined #nim |
20:15:51 | BlaXpirit_ | no, I asked to access stuff directly, but if I use dot notation, lookup relevant procs |
20:16:01 | flaviu | ekarlso-: there it is |
20:16:24 | def- | .give ekarlso- import strutils; var x = parseInt("16"); echo x |
20:16:24 | ekarlso- | .eval parseInt("16") |
20:16:27 | Mimbus | ekarlso-: 16 |
20:16:30 | Mimbus | ekarlso-: eval.nim(3, 8) Error: value of type 'int' has to be discarded |
20:16:49 | dts|pokeball | ldlework, ah |
20:17:00 | ldlework | ekarlso-: https://github.com/Araq/Nim/blob/devel/lib/pure/strutils.nim#L416 |
20:17:07 | BlaXpirit_ | [:41:41] <BlaXpirit_> Mimbus, you should just write out a value if it "has to be discarded" |
20:17:16 | ARM9 | is there some way to tell nim what compiler to use without messing with system configs? |
20:17:21 | flaviu | BlaXpirit_: It's not that easy. |
20:17:21 | BlaXpirit_ | wait, it does now? cooool |
20:17:26 | ARM9 | like with a makefile |
20:17:36 | def- | ARM9: nim --cc:clang c file |
20:17:37 | BlaXpirit_ | no, that was 2 overlapping requests to it |
20:17:51 | ARM9 | def- so I can do --cc:arm-none-eabi-gcc for example |
20:17:57 | BlaXpirit_ | flaviu, what about... wrapping the stuff in a function |
20:18:00 | ARM9 | I'll check it out, cheers |
20:18:00 | ldlework | flaviu: interpret the error, if it has "has to be discarded", rerun the last compilation slightly modified |
20:18:12 | BlaXpirit_ | yeah.. or that |
20:18:33 | Araq | flaviu: disable Mimbus or make it work in a way that's not embarrassing to all of us |
20:18:43 | def- | ARM9: nim --gcc.exe:arm-none-eabi-gcc |
20:18:55 | ldlework | lol |
20:18:57 | def- | ARM9: or in $NIM/config/nim.cfg |
20:18:57 | EXetoC | ldlework: or.. write a macro \o/ |
20:19:07 | ARM9 | the latter is what I didn't want |
20:19:09 | ARM9 | but thanks |
20:19:09 | ldlework | oh yeah! |
20:19:12 | Araq | ARM9: just use a project specific nim.cfg file |
20:19:31 | ARM9 | nah |
20:19:35 | ARM9 | I'd prefer using a proper build system |
20:19:44 | dts|pokeball | its not a build system... |
20:19:48 | ldlework | wat |
20:19:54 | Araq | and by that you mean "make"? you're a funny guy. |
20:20:03 | dts|pokeball | make is terrible |
20:20:10 | ARM9 | there there lads, no need to be so passive aggressive |
20:20:12 | dts|pokeball | i thought i liked it, then i read the make manual |
20:20:19 | ARM9 | too bad |
20:20:43 | ldlework | make is nice when you need some simple thing |
20:20:48 | dts|pokeball | says the guy that doesnt know the difference between a build system and a config file ;) |
20:20:52 | flaviu | It would be nice if nim respected $CC |
20:20:59 | ARM9 | there you go being passive aggressive again dts |
20:21:08 | def- | ARM9: you'll also need --gcc.linkerexe:arm-none-eabi-gcc |
20:21:17 | dts|pokeball | yeah ldlework i agree, but I still like cmake |
20:21:33 | dts|pokeball | i dont think that word means what you think it means ARM9 |
20:21:33 | ldlework | dts|pokeball: I don't know the various different ones |
20:21:35 | flaviu | dts|pokeball: Get to work on the bot! |
20:21:42 | dts|pokeball | D: OK OK |
20:21:50 | dts|pokeball | someone find me a fucking sandbox! |
20:21:50 | ARM9 | it means exactly what I think it means |
20:21:50 | EXetoC | I would at least try using only a cfg at first, but there's also "nake", which is a little minimalistic, but it does provide some additional functionality |
20:21:56 | Araq | guys, ARM9 is right. let's calm down please. |
20:22:15 | * | Mimbus quit (Remote host closed the connection) |
20:22:31 | EXetoC | Araq: if indeed it does compile. either search for it using nimble, or clone this repo: https://github.com/fowlmouth/nake.git |
20:23:01 | Araq | EXetoC: you don't mean me. |
20:23:28 | EXetoC | ARM9* |
20:24:14 | ekarlso- | packages.nim(49, 24) Error: type mismatch: got (string) |
20:24:17 | ekarlso- | parseutils.parseInt(s: string, number: var int, start: int): int |
20:24:19 | ekarlso- | hmmms |
20:24:28 | ekarlso- | aint I giving it a string dammit ? |
20:24:48 | ldlework | ekarlso-: parseutils != strutils |
20:24:59 | ekarlso- | ohhhh |
20:25:40 | dts|pokeball | although strutils does import parseutils doesnt it? |
20:25:57 | EXetoC | it would also have to export it |
20:26:13 | dts|pokeball | oh right |
20:26:15 | EXetoC | dts|pokeball: it does actually |
20:26:18 | EXetoC | hm |
20:27:59 | Araq | EXetoC: it doesn't |
20:28:18 | ldlework | Araq: he means it imports it, not that it exports it |
20:30:17 | EXetoC | nimble must be importing it |
20:30:24 | EXetoC | nimbus |
20:30:26 | EXetoC | bah |
20:31:57 | dts|pokeball | i believe nimbus imports strutils yes |
20:32:01 | dts|pokeball | to find ;'s |
20:32:16 | * | goobles joined #nim |
20:33:27 | EXetoC | he didn't even eval it this time :p |
20:33:38 | dts|pokeball | eval what? |
20:34:39 | * | MrBlaise left #nim (#nim) |
20:36:38 | no_name | Varriount_: I figured out the cause of the crash - my code was causing zlib to barf because I asked for too much memory |
20:36:52 | flaviu | Who was having trouble with segfaults? |
20:37:11 | flaviu | You have to use -fsanitize=... for linking too, that's the reason it failed |
20:38:53 | * | shevy left #nim ("I'll be back ... maybe") |
20:38:56 | * | Grauwolf joined #nim |
20:44:22 | * | BlaXpirit_ quit (Quit: Quit Konversation) |
20:44:39 | * | BlaXpirit joined #nim |
20:50:32 | * | superfunc joined #nim |
20:51:32 | * | phira joined #nim |
21:06:53 | * | grumio2 joined #nim |
21:07:36 | ekarlso- | yay |
21:07:40 | ekarlso- | working package index ! |
21:10:56 | * | Mat4 joined #nim |
21:11:02 | Mat4 | hello |
21:11:16 | dv- | hi |
21:12:01 | Mat4 | hi dv- |
21:12:21 | dts|pokeball | hi |
21:13:31 | * | Demos joined #nim |
21:16:17 | * | yglukhov__ quit (Ping timeout: 240 seconds) |
21:16:54 | * | yglukhov__ joined #nim |
21:18:57 | Mat4 | happy new year to all (ok, it's a bit late) |
21:19:36 | superfunc | you too dude |
21:19:43 | BlaXpirit | year is still quite new... |
21:21:20 | ldlework | superfunc: are we getting a wired article? |
21:21:42 | superfunc | waiting to see them email me back |
21:21:52 | superfunc | I'll ping the irc if/when it happens |
21:22:42 | dv- | I noticed that the online docs don't have the export * in them but mine do. how I do that? |
21:23:27 | EXetoC | dv-: you mean, none of the listed symbols are annotated with *? |
21:23:44 | dv- | yes |
21:24:07 | EXetoC | only exported symbols will appear, so it's omitted |
21:24:36 | dv- | well if it's on the docs then it's exported |
21:24:44 | ldlework | dv-: that's what EXetoC is saying |
21:25:16 | dv- | i have stars in my docs |
21:25:42 | ldlework | dv-: using the latest versions of everything? |
21:26:29 | dv- | dunno. how do i update? i did git pull; ./koch clean; ./koch ./koch boot -d:release -d:useGnuReadline |
21:26:31 | dv- | is that enough? |
21:26:32 | EXetoC | dv-: did you use doc2 rather than doc? |
21:27:03 | BlaXpirit | guys, what ever happened to that new amazing searchable documentation someone has been working on? |
21:27:24 | ldlework | its calle ctrl-f |
21:27:24 | dv- | EXetoC: oh i see |
21:27:26 | ldlework | :) |
21:27:27 | EXetoC | I never did run 'clean' |
21:28:03 | dv- | now it's not wrapping the proc lines any more though |
21:28:21 | dv- | instead i get an ugly horizontal scrollbar |
21:28:50 | * | coffee` quit (Read error: Connection reset by peer) |
21:29:19 | Araq | BlaXpirit: the guy who worked on it is very busy, and instead we only got a CSS update and content improvements, no search, no "type based" view |
21:29:24 | BlaXpirit | ok |
21:29:42 | * | gokr1 joined #nim |
21:29:56 | Araq | but hey, at least we improved it. though dv- seems to disagree. :-) |
21:30:24 | EXetoC | every community has its scrollbar haters |
21:30:52 | dv- | i'm viewing it on a 1280x1024 screen :p |
21:31:01 | BlaXpirit | EXetoC, nim doc2 doesn't work D: |
21:31:17 | BlaXpirit | please try to use it on your machine with nim-git |
21:31:46 | * | nimnoob123 joined #nim |
21:33:20 | BlaXpirit | maybe i'm just doing something very wrong |
21:33:32 | * | superfunc_ joined #nim |
21:33:41 | BlaXpirit | nim doc works |
21:33:43 | nimnoob123 | dumb question is nim still called nimrod or is it just nim or nimlang? I ask because projects on github are listed on Nimrod and I just realized when trying to find existing projects to see real usage of the language |
21:33:59 | def- | nimnoob123: just Nim |
21:34:21 | ekarlso- | is there a datetime type in nim ? |
21:34:22 | EXetoC | BlaXpirit: I'll look into it. it looks for ../doc/.... |
21:34:40 | def- | ekarlso-: http://nim-lang.org/times.html |
21:35:37 | * | chrisheller joined #nim |
21:35:46 | ekarlso- | hmm, which one to match the DATETIME in mysql ? |
21:35:47 | nimnoob123 | def-: thanks |
21:36:07 | * | superfunc_ is now known as superfunc[mobile |
21:36:41 | nimnoob123 | def-: i remember you now, from /r/programming posted the update there about the new version |
21:36:42 | * | chrisheller quit (Remote host closed the connection) |
21:38:02 | gokr1 | More than 100 people here, a first or? |
21:38:39 | Araq | if yesterday doesn't count, yes |
21:38:46 | BlaXpirit | this is a stat that should be tracked :o |
21:38:46 | def- | ekarlso-: you'll have to format the time to a string I guess, but not sure what you're doing |
21:39:07 | Araq | BlaXpirit: we do. |
21:39:10 | BlaXpirit | cool |
21:39:13 | BlaXpirit | it seems increasingly likely to me that I'll have to roll with something other than nim doc |
21:39:22 | nimnoob123 | having fun learning the lang |
21:39:25 | EXetoC | see the subtle link in the topic |
21:39:34 | * | chrisheller joined #nim |
21:39:41 | * | Trustable quit (Remote host closed the connection) |
21:39:43 | BlaXpirit | ahhhhhhhhh I was just wondering today xD |
21:40:07 | BlaXpirit | :53:44 BlaXpirit and what the heck is that git.io link |
21:40:56 | nimnoob123 | irc's more active than the subreddit on reddit, guess i'll post simple questions here for now or the forums |
21:41:11 | * | Demos_ joined #nim |
21:41:50 | Araq | well that's likely my fault. I'm on irc and on the forum and nowhere else. |
21:42:35 | Araq | but it's distracting enough already |
21:42:48 | dom96 | superfunc: awesome |
21:42:48 | nimnoob123 | ;p |
21:44:13 | * | Demos quit (Ping timeout: 255 seconds) |
21:46:34 | nimnoob123 | last noob question for now are the optional parenthesis used as (soft) blocks only available for procedures (and I'm assuming methods) ex.: http://pastie.org/9810065 ? I only came across the topic of it's usage once on the by-example tutorials |
21:47:14 | nimnoob123 | which was maybe a sentence talking about them, couldn't find any information anywhere else |
21:47:41 | flaviu | nimnoob123: Those aren't really blocking |
21:47:43 | flaviu | it's more a hack |
21:47:58 | ekarlso- | https://bpaste.net/show/e061a319454f < that format ok ? |
21:48:02 | flaviu | parentheses allow you to create an expression that spans multiple lines. |
21:48:23 | nimnoob123 | right |
21:48:48 | flaviu | Hmm, I shouldn't have mentioned that in nim-by-example. |
21:49:54 | * | grumio2 quit (Quit: Lost terminal) |
21:50:31 | EXetoC | ekarlso-: yes |
21:50:42 | nimnoob123 | flaviu: will there ever be some form of optional blocking in a similar manner? just so used to using brackets and what not when writing c++/c# |
21:50:47 | EXetoC | I'd personally cram more things into individual lines, that's all |
21:50:55 | ekarlso- | EXetoC: like ? |
21:51:44 | jsudlow | what is the proper way in nim to stop execution of a program with a normal exit code? |
21:52:41 | flaviu | nimnoob123: In the early days, block syntax was on the todo list, but it got dropped. I don't think it's likely it'll be added any time soon. |
21:53:09 | * | ARM9 left #nim ("swi 0x00") |
21:53:12 | nimnoob123 | flaviu: alright, thanks for the help. |
21:53:40 | def- | jsudlow: just let it run to the end of the file? or quit() |
21:53:56 | * | Demos_ quit (Ping timeout: 244 seconds) |
21:54:16 | jsudlow | def: I'm contributing a little bit of code in making a nim game and I need to quit the program when the user hits the quit button |
21:54:22 | * | jpoirier joined #nim |
21:54:41 | def- | jsudlow: ok, quit() is fine then |
21:54:46 | jsudlow | def: cool thx |
21:54:47 | * | Demos_ joined #nim |
21:55:14 | * | Varriount|Mobile joined #nim |
21:55:22 | * | Puffin joined #nim |
21:56:04 | EXetoC | ekarlso-: "'foo': [..." and "}, { <newline> ..." |
21:56:16 | * | fabiok joined #nim |
21:56:33 | ekarlso- | EXetoC: sorry ? |
21:56:49 | ekarlso- | EXetoC: I meant the format of the json a'la the keys needed etc to get smth like nimble working |
21:57:09 | ehaliewicz | i'm gonna pretend nim is still called nimrod |
21:57:16 | ehaliewicz | as long as #nimrod redirects :) |
21:57:27 | EXetoC | ok I was just engaging in some bikeshedding again |
21:57:51 | Araq | ehaliewicz: the URL should be valid for another year |
21:58:23 | ekarlso- | Araq: what u think? |
21:58:41 | Araq | ekarlso-: what's the question again? |
21:58:50 | ekarlso- | https://bpaste.net/show/e061a319454f < that format ok for smth like nimble ? |
21:59:10 | * | fabiok quit (Client Quit) |
21:59:25 | Araq | should be. nimble uses a real parser |
21:59:29 | ehaliewicz | Araq: great :) |
21:59:40 | ekarlso- | Araq: real parser ? |
21:59:59 | * | viralata joined #nim |
22:00:07 | Araq | a parser that parses JSON and ignores whitespace |
22:00:21 | Araq | I guess I don't understand your question |
22:00:26 | ekarlso- | Araq: I meant the releases part of it sorry |
22:00:57 | Araq | dom96: help ekarlso- please |
22:01:25 | ekarlso- | Araq: he who wrote the tool ? |
22:02:25 | dom96 | hrm? what's the problem? |
22:02:41 | ekarlso- | dom96: trying to make tghe package app json usable for something like nimble |
22:02:45 | ekarlso- | https://bpaste.net/show/e061a319454f < that format ok for smth like nimble ? |
22:02:51 | ekarlso- | as in if the data is "ok" |
22:03:28 | dom96 | sure i guess |
22:03:58 | dom96 | releases won't be read by nimble though |
22:04:09 | ekarlso- | possible to make it do that ? |
22:04:48 | dom96 | sure |
22:05:17 | Araq | isn't that re-implementing git tags though? |
22:06:10 | ekarlso- | Araq: well, pypi works also by being able to publish tarballs.. |
22:06:18 | dom96 | i'm assumming ekarlso-'s will track them |
22:06:27 | dom96 | *ekarlso's website |
22:06:30 | * | tgkokk quit (Quit: Textual IRC Client: www.textualapp.com) |
22:06:43 | ekarlso- | can't you have a proc without a return ? |
22:06:55 | * | tgkokk joined #nim |
22:07:04 | * | tgkokk quit (Client Quit) |
22:07:32 | EXetoC | ekarlso-: yes, and you need at least one statement |
22:07:44 | EXetoC | use 'discard' as a placeholder |
22:07:58 | * | tgkokk joined #nim |
22:10:08 | dom96 | ekarlso-: don't worry about the format, we can always adjust it easily |
22:10:59 | ekarlso- | ;p |
22:11:42 | wtw | hi, I'm just reading about the quirks of Java's checked exceptions. I'm not yet familiar with nim's exception system, but how is Java's "mess" avoided here? |
22:12:12 | wtw | I understand checked exceptions don't _have_ to be caught? |
22:13:08 | wtw | otoh, there is no Option<T> type or default tuple return values or is there? |
22:14:29 | * | Dispatch joined #nim |
22:18:08 | ekarlso- | hmmm |
22:18:11 | ekarlso- | pkg["tags"].elems |
22:18:21 | ekarlso- | is that how u access the elements in a js array ? |
22:18:42 | Araq | wtw: it's avoided by having a better default and smarter inference |
22:19:09 | Araq | the default being "oh shut up, I don't care" |
22:19:38 | Araq | and then when you opt-in for the additional checking it's there for you |
22:20:47 | wtw | ah, thx |
22:20:50 | Araq | Java's mistake is that when I write no "throws" that it means "throws nothing". |
22:21:01 | Araq | In Nim it means "I don't care". |
22:21:07 | ldlework | nice |
22:22:01 | * | chrisheller quit () |
22:25:30 | nimnoob123 | Araq: how many people are actively working on Nim? main contributors |
22:25:42 | ldlework | ~4 |
22:25:57 | ldlework | is my count |
22:26:00 | nimnoob123 | dang, just 4 |
22:26:06 | nimnoob123 | that's cool |
22:26:55 | ekarlso- | hat does it mean when it says named expression expected ? |
22:27:18 | flaviu | nimnoob123: https://github.com/Araq/Nim/graphs/contributors |
22:27:32 | ldlework | flaviu: nice |
22:27:36 | nimnoob123 | flaviu: thanks |
22:27:44 | ekarlso- | var release = Release( < on a line like that |
22:28:24 | EXetoC | are you doing this Release(x=y) rather than this Release(x:y)? |
22:28:43 | ekarlso- | ah, I had a sneaked in =? |
22:28:57 | EXetoC | yep, common mistake |
22:29:31 | ekarlso- | ok, time to go to work on the angular app... |
22:30:32 | * | tane quit (Quit: Verlassend) |
22:31:27 | * | tgkokk quit (Ping timeout: 244 seconds) |
22:32:26 | * | gokr1 quit (Quit: Leaving.) |
22:33:14 | Araq | wtw: Option[T] is pretty simple to write too and we also have tuples and in fact |
22:33:43 | Araq | we improve upon "return value based error handling" with the requirement of having to use 'discard' |
22:34:33 | Y0Gi_ | Araq: I don't think 'discard' solves the same problems as Option does. |
22:35:07 | Araq | Y0Gi_: no, but it is related. |
22:35:15 | Y0Gi_ | I'd second a request for an Option type as libraries could pick it up as a standard way of doing such things |
22:35:36 | BlaXpirit | guys, what's the status on documentation comments? |
22:35:46 | BlaXpirit | do they work already and where should I put them? |
22:36:01 | BlaXpirit | (manual only says "they're allowed only in certain places") |
22:36:03 | Araq | BlaXpirit: they work and it's documented somewhere where to put them |
22:36:34 | BlaXpirit | not in manual, it looks like :| |
22:36:39 | skyfex | Araq: https://github.com/Araq/Nim/issues/936 -- If you pass int16 to `$` it selects proc `$`(x: int) rather than proc `$`(x: int64) even though int64 is convertible to both.. do you remember where in the compiler this special selection is implemented? |
22:36:56 | Araq | skyfex: sigmatch.nim |
22:37:20 | Araq | and this is the way it should work |
22:37:32 | Araq | that's not a bug what you describe here |
22:38:51 | * | jefus_ joined #nim |
22:40:35 | ldlework | https://github.com/rust-lang/rust/blob/master/src/test/run-pass/html-literals.rs |
22:41:41 | skyfex | Araq: well shouldn't uint8 be implicitly convertible to int16 and up? If so I need to implement a similar logic there |
22:42:49 | * | jefus quit (Ping timeout: 244 seconds) |
22:43:56 | Araq | skyfex: yeah, try that |
22:45:05 | skyfex | Think I found it out.. :) |
22:45:48 | Araq | I still wonder how I will be able to turn that thing into a spec |
22:46:25 | nimnoob123 | is it normal that if you name a file after a keyword that it won't compile? for example I was testing the varargs example from the tutorial and named the file in my examples folder "varargs.nim" and it spit out a ambitious identifier error use a qualifier |
22:46:53 | ldlework | nimnoob123: :/ |
22:47:30 | Araq | nimnoob123: the module name is useful for module.foo access |
22:47:37 | BlaXpirit | documentation comments for enums don't work? |
22:48:08 | Araq | BlaXpirit: just look at os.nim of how to do it |
22:48:16 | wtw | The problem I see with Java checked exceptions is that they are a workaround for the lack of two return values (be they implemented via Option[T] or via something else) |
22:48:20 | * | gokr1 joined #nim |
22:48:32 | nimnoob123 | I see. was just curious |
22:48:51 | wtw | and if something on a very low level throws something and I want to catch this something e.g. three levels higher every layer inbetween has to write "catch (something)" |
22:48:52 | BlaXpirit | Araq, I want multiline doc comment for enum |
22:49:02 | wtw | i.e. clutter :) |
22:49:38 | wtw | using an Option[T], Result[T] or something else alleviates this |
22:50:17 | Araq | how do you get a stacktrace with your precious Option[T]? ;-) |
22:50:37 | wtw | that's right :) I don't want to argue too much in favor of Option |
22:50:44 | Araq | how come Haskell - the king of monads - has exceptions? |
22:51:21 | wtw | there is also another problem: you get another kind of clutter, namely a cascade of Option[] checks |
22:51:31 | wtw | which has to be dealt with monad stuff :/ |
22:51:46 | Araq | yeah, but the performance implications remain |
22:51:53 | wtw | sure I concur |
22:52:30 | wtw | I don't want to come across as a proponent of Option[T] (probably already too late :D) but just wanted to know your stance on it |
22:53:11 | Araq | I usually prefer the hasKey/getKey pair where getKey returns a reasonable default |
22:53:54 | Araq | and I usually don't have to call hasKey at all |
22:54:13 | wtw | I find this also the most straightforward and useful approach |
22:54:23 | ldlework | in python: v = d.get('name'); if v is not None: do_something() |
22:54:49 | wtw | ah btw: do you plan to include higher-kinded types/generics of generics/monads? or is this already included? |
22:56:07 | ldlework | generics of generics |
22:56:10 | * | ldlework 's head spins. |
22:57:28 | dom96 | ldlework: we need to go deeper :P |
22:57:36 | wtw | ldlework: it's not that dizziness-inducing actually: https://stackoverflow.com/questions/2565097/higher-kinded-types-with-c |
22:57:38 | Araq | ha, I don't know! I remember zahary worked on it. |
22:58:12 | * | Dispatch quit (Quit: Page closed) |
22:58:13 | wtw | not that I need/want it, just for information :D |
22:58:26 | Araq | plan is definitely to have them one day. unlikely for version 1 though. but maybe I should be more optimistic. |
22:58:51 | wtw | ok :) rust hast the same plan, iirc |
22:59:16 | wtw | I find it quite difficult to maintain a balance between genericity and simplicity |
22:59:25 | * | Mat4 left #nim (#nim) |
22:59:51 | wtw | scala is a bad example for simplicity imho ;) |
23:00:16 | ldlework | wtw: I find that genericity leads to the most simple code, in a sense |
23:00:35 | Araq | wtw: currently the stdlib repeats the proc headers for SingleLinkedList[T] and DoublyLinkedList[T] but the implementation delegates to a common template |
23:00:48 | Araq | this is not too nice, but not too bad either |
23:01:30 | wtw | ldlework: i guess this is true for one layer at a time, but additional genericity increases the 'intellectual' load, i.e. I don't exactly know what/how my functions are doing something anymore |
23:01:52 | wtw | Araq: ah, I see, interesting |
23:02:56 | ldlework | sure but that's true for normal functions too |
23:04:27 | wtw | I've followed the development of scala a little and in the beginning I found the abstractions quite useful. however, if your language is powerful like Scala, you tend to have people in the community who are able to generalize over everything |
23:04:49 | wtw | which is reasonable from their point of view, but too complicated for me ;) |
23:05:02 | wtw | see e.g. tony morris's blog (https://tonymorris.github.io/blog/) |
23:05:37 | * | renesac joined #nim |
23:05:52 | wtw | however, I also prefer to write foo.map( * 2) instead of writing a for loop myself |
23:05:59 | ldlework | wtw, without referring to an external authority do you agree with my reasonning that the same is true for normal functions? |
23:06:12 | ldlework | wtw, you have to know what a function does in order to know what it does |
23:06:17 | ldlework | the same goes with generics and macros |
23:06:19 | wtw | I guess so |
23:06:33 | ldlework | anyone can write confusing and dense generics, macros, or functions |
23:07:40 | wtw | sure, however certain languages seem to foster complexity somehow, haskell and scala being examples |
23:08:22 | ldlework | wtw, I was waiting for you to make the point that macros and generics can do things that normal functions can't do |
23:08:32 | ldlework | so when you are looking at a function, you can guess at least to the range of things it might do |
23:08:43 | ldlework | when you're looking at a macro invocation it could literally be doing anything |
23:09:05 | ldlework | But then I was going to say that merely knowing the range of things your non-macro language can do doesn't really give you insight as to what a function is doing |
23:09:11 | ldlework | since the things the core language can do is still a lot |
23:09:44 | ldlework | so you still have to look at the definition |
23:11:20 | wtw | are you referring to nim specifically now? |
23:13:42 | BlaXpirit | this looks totally awesome! http://blaxpirit.com/t/csfml_graphics_gen.html#=,CircleShape,cfloat |
23:13:45 | ldlework | No I'm speaking generally about the alleged obsfucation that meta-programming is purported to inherently have |
23:14:02 | ldlework | BlaXpirit: nice |
23:14:07 | def- | BlaXpirit: wow, with documentation! |
23:14:08 | BlaXpirit | and I didn't write a single word of these docs :p |
23:14:19 | BlaXpirit | all parsed from c headers |
23:14:21 | ldlework | BlaXpirit: woah it stole them from the c lib |
23:14:23 | ldlework | nice! |
23:14:24 | BlaXpirit | but omg is the code kludgy |
23:14:44 | BlaXpirit | it's kludges upon kludges |
23:15:09 | BlaXpirit | but users won't have to deal with the kludgy code, they'll just see the nice pregenerated things :p |
23:16:13 | ldlework | BlaXpirit: what has kludges? |
23:16:23 | BlaXpirit | the Python code that I used to generate all this |
23:16:43 | dom96 | BlaXpirit: awesome! Now rewrite the generator in Nim ;) |
23:16:53 | BlaXpirit | no. |
23:16:56 | BlaXpirit | it's not needed |
23:16:59 | def- | and in a way so it can be used for all wrappers! |
23:17:14 | BlaXpirit | nah, it's all hardcorely hardcoded |
23:17:20 | BlaXpirit | i rely on nice format that sfml gives |
23:17:20 | Araq | c2nim could do it. |
23:17:27 | BlaXpirit | it would horribly break on anything else |
23:17:38 | def- | would be nice to have though, most wrappers don't have documentation unfortunately |
23:17:50 | Araq | it already adds C comments into the AST |
23:18:03 | BlaXpirit | uh cool |
23:18:03 | Araq | but it needs to be able to handly doxygen |
23:18:14 | Araq | and of course general polish |
23:18:16 | dts|pokeball | so can someone show me an example of how to call this c function in nim: unsigned int alarm(unsigned int seconds); its in unistd.h |
23:18:20 | BlaXpirit | but i'd most likely run into some problem and not be able to modify c2nim to my needs |
23:19:25 | def- | dts|pokeball: proc alarm(seconds: cuint): cuint {.header: "<unistd.h>".} |
23:19:25 | flaviu | dts|pokeball: run that through c2nim, see what comes out |
23:19:40 | Araq | I'm working on a general pre and post processing step for c2nim |
23:20:13 | Araq | well ... I'm playing with some ideas in my head |
23:20:15 | def- | Araq: sounds useful, i always did pre- and post-processing by hand with c2nim |
23:20:27 | Araq | def-: everybody does. :-) |
23:21:18 | def- | hm, can't install c2nim with nimble |
23:21:25 | def- | "nim not found in local packages.json" |
23:21:47 | Araq | nimble does not know about 'nim'? |
23:21:52 | def- | apparently not |
23:21:56 | Araq | I changed it today |
23:22:26 | Araq | added simply stuff like c2nim config.c2nim fileA.c fileB.h fileC.c |
23:22:38 | Araq | *simple stuff |
23:22:52 | def- | hm, same error when i try to use nimble to update itself |
23:23:09 | def- | after a manual update it works |
23:23:13 | dts|pokeball | thanks def, flaviu |
23:23:34 | wtw | ldlework: sorry, quite busy currently, please excuse the delay - I was thinking of additional layers of abstraction usually induced by metaprogramming. these tend to increase my 'cognitive load' or at least I had the impression when programming Haskell or Scala. I don't think there is an inherent difference in legibility of meta-languages or the programming language itself. however, by generalizing over larger structures (which meta-programming facilitates) it's po |
23:23:41 | wtw | arg |
23:23:42 | wtw | i should really split my messages, sr |
23:24:15 | def- | dts|pokeball: alarm already exists in the posix module btw, but I think its type is wrong |
23:24:17 | wtw | of course everyone is free to obfuscate using just functions ;) |
23:24:27 | dts|pokeball | def-, good to know |
23:24:36 | wtw | but I feel obfuscation gets easier as soon as you have access to monads an the likes |
23:25:28 | BlaXpirit | I think nim doc should handle `include`... |
23:25:38 | Araq | BlaXpirit: doc2 does |
23:26:03 | BlaXpirit | it doesn't seem to work on my system :| |
23:26:13 | def- | i'll try to fix a few includes in posix.nim |
23:26:22 | def- | a few procs* |
23:26:46 | EXetoC | Araq: it does look for some txt files in a relative directory |
23:27:11 | ldlework | wtw, sure my general point was that functions create additional layers of abstraction in the exact same way |
23:27:33 | EXetoC | wait |
23:27:56 | ldlework | wtw: and further, in the same way that macros creating abstractions can make somethings really high-level and nice to use, or make things complicated and hard to understand - the same is true for functions |
23:28:05 | dts|pokeball | how would i do signal handling in nim? |
23:28:30 | ldlework | So I think the long-term implication that metaprogramming has this inherent problem is overblown by people suffering from having to work with other people's badly-written utilization of meta programming facilities |
23:28:53 | Araq | ldlework: no, not in the exact same way. ;-) functions create abstractions that have a runtime representation |
23:29:11 | EXetoC | Araq: right, my package does not put those files there, cus unix hierarchies and all that |
23:29:30 | Araq | EXetoC: what is 'it'? |
23:29:43 | EXetoC | doc2 |
23:29:55 | EXetoC | maybe I should put everything in /opt |
23:30:30 | renesac | hi, I've never been in this channel before |
23:30:33 | renesac | :) |
23:30:52 | BlaXpirit | EXetoC, that's scary |
23:31:09 | BlaXpirit | ask for a fix |
23:31:20 | BlaXpirit | (and thanks for your work) |
23:31:27 | BlaXpirit | i wonder what the official maintainer is doing |
23:31:31 | def- | dts|pokeball: I've only done this, for more advanced ones you have to go down the posix hole i think: https://github.com/def-/nim-unsorted/blob/master/signals.nim |
23:31:37 | EXetoC | yeah |
23:32:02 | ldlework | Araq: what's the consequence of that observation? |
23:32:05 | def- | welcome renesac |
23:32:37 | dts|pokeball | handler, so your code tells the time whenever someone hits ctrl + c? |
23:32:40 | renesac | ok, it seems I will need nimfix |
23:32:50 | ldlework | hi renesac |
23:32:52 | * | chrisheller joined #nim |
23:32:56 | renesac | but first, download the new compiler |
23:33:02 | EXetoC | Araq, BlaXpirit: I found a related bug report |
23:33:11 | dts|pokeball | the new compiler fixes all the bugs ive found :( |
23:33:26 | renesac | will nimfix work on 0.9.4 code? |
23:33:29 | Araq | ldlework: with a macro system you strive for function like behaviour when it comes to local variables at least. |
23:33:51 | EXetoC | dts|pokeball: oh :\ |
23:33:53 | Araq | renesac: it should work even better than with 0.9.6 code |
23:33:58 | ldlework | Araq: you mean so that macros cannot inject local variables into the callsite? |
23:34:19 | dts|pokeball | EXetoC, yeah :/ i thought i was smart, and it turns out im just behind |
23:34:51 | Araq | ldlework: no I mean that every macro instantiation gets a fresh set of locals. "Hygiene" is the keyword. |
23:34:57 | ldlework | ah |
23:35:08 | Araq | or 'gensym' |
23:35:52 | renesac | Araq, your greetings bot is not working anymore? |
23:35:59 | EXetoC | :p |
23:36:27 | def- | Araq: I'm wondering why in the posix module all kinds of int types are wrong |
23:36:44 | renesac | the forum seems very active now |
23:37:10 | Araq | renesac: it collapsed under 100 users |
23:37:25 | renesac | I don't remember the record number of users on the old channel, but I think it was about 60 |
23:37:25 | renesac | heh |
23:37:37 | ldlework | Araq: huh I wondered how you so consistently greeted new people |
23:37:57 | flaviu | renesac: 80 actually |
23:38:00 | ldlework | I thought you were just a very caring and friendly BDFL |
23:38:02 | flaviu | https://gist.github.com/dom96/da2d4dead6fb00b71312/revisions |
23:38:04 | ldlework | :) |
23:38:05 | Araq | def-: I wrap unsigned types as signed |
23:38:42 | Araq | because I know it doesn't matter and unsigned is viral |
23:39:16 | def- | oh, so that's intentional. what about using "int" in Nim when it's a "long int" in C, is that guaranteed to work? |
23:39:23 | renesac | heh, the last record I was around was 71 |
23:39:55 | Araq | def-: no. |
23:40:41 | wan | renesac: let's party like it's 99 |
23:40:53 | def- | Araq: can't fix this in all 3000 lines by hand |
23:41:31 | Araq | def-: then it's fine. it only breaks for Win64 |
23:41:40 | renesac | and I'm back because of unsigneds by the way |
23:41:40 | Araq | which is not a posix target anyway |
23:41:42 | renesac | https://github.com/Araq/Nim/issues/936#issuecomment-68565981 |
23:41:46 | renesac | ^^' |
23:42:00 | def- | Araq: ok, not going to change anything then. thanks for the infos |
23:43:24 | dom96 | argh |
23:44:13 | Araq | skyfex: uint64 literals are not hard to handle at all, just look at the nodes' type field to see how to interpret the bit pattern |
23:45:47 | renesac | nimrod is still lacking a bigint library? |
23:46:06 | def- | renesac: https://github.com/def-/nim-bigints |
23:46:49 | jpoirier | Araq: can you elaborate on your "unsigned is viral" comment? |
23:47:21 | * | superfunc[mobile quit (Quit: Connection closed for inactivity) |
23:48:22 | renesac | def-, nice |
23:49:07 | def- | and I just discovered converters, should make bigints nicer with them |
23:50:16 | Araq | jpoirier: no, I need to sleep. But consider this: C#'s length returns int, not uint for a reason. |
23:51:15 | skyfex | jpoirier: There's been some discussions on the forum |
23:52:28 | * | foo123 joined #nim |
23:52:44 | * | xAndy joined #nim |
23:53:33 | * | foo123 quit (Client Quit) |
23:53:55 | * | Demon_Fox joined #nim |
23:54:11 | jpoirier | Araq: I've never used C# but as an embedded developer doing CRCs, viterbi/convolutional/turbo en/de-coders, and general bit banging I've always used unsigned types |
23:54:50 | jpoirier | i'll check out the forum |
23:56:07 | Araq | jpoirier: that's a fair point, but I prefer my 'for i in 0..L-3' to work when L == 0. |
23:56:42 | EXetoC | it's a very convenient default |
23:58:05 | xAndy | hi, i was looking at some nim tutorials and wrote some own code but i'm getting undeclared identifier: 'parseInt'. i use 0.10.2 (2014-12-31) [Linux: amd64] |
23:58:59 | BlaXpirit | .eval import strutils; echo parseInt("5") |
23:59:13 | BlaXpirit | Mimbus, oh, Mimbus... |
23:59:29 | flaviu | BlaXpirit: too spammy, you'll have to wait for dts |
23:59:31 | BlaXpirit | in any case, xAndy. import strutils |
23:59:34 | xAndy | oh strutils. thanks |
23:59:40 | BlaXpirit | flaviu, ? |
23:59:45 | BlaXpirit | "dts"? |
23:59:48 | skyfex | jpoirier: I also find it natural to use unsigned types in those cases.. but thinking about it.. if the value you're working with has no arithmetic interpretation (like in CRC or bitbanging), is it really more natural to use unsigned rather than signed? |
23:59:59 | flaviu | BlaXpirit: dts|pokeball |