00:00:10 | flaviu | I don't understand how his name works |
00:00:31 | * | Demos_ quit (Ping timeout: 244 seconds) |
00:00:43 | skyfex | jpoirier: Araq's argument is that unsigned numbers can introduce subtle bugs in certain code, and there's very few cases where unsigned numbers are actually *necessary*, so it's best to avoid them |
00:00:55 | jpoirier | skyfex: I think for most situations a signed type is appropriate, the developer should know when it's appropriate to use unsigned types and when not to |
00:03:11 | skyfex | jpoirier: I agree, but in C, "unsigned" types tend to spread.. they might be used in the device driver because some register has that type, or because data packed in a file or network is unsigned.. and since they're so transparently easy to work with, library writers don't bother casting them to signed ints.. I think what Araq hopes to achieve with Nim is that high-level users |
00:03:11 | skyfex | don't have to see unsigned numbers |
00:03:22 | skyfex | I'm actually noticing it myself right now |
00:03:39 | skyfex | I'm working with libusb, which has tons of unsigned ints in its structs |
00:04:21 | * | Matthias247 quit (Read error: Connection reset by peer) |
00:04:47 | jpoirier | skyfex: agreed, but it just comes down to understanding the difference between arithmetic vs logical operations. |
00:07:16 | jpoirier | skyfex: one should not be applying bitwise (logical) operations on signed numbers. And on most (embedded anyway) processors unsigned types are more efficient; no ops (overflow flags, etc) to worry about. |
00:08:11 | skyfex | Why not apply bitwise operations on signed numbers? |
00:08:46 | * | vbtt joined #nim |
00:09:21 | * | rpag quit (Quit: Leaving) |
00:09:48 | skyfex | If you're doing bitwise operations, the number is just a collection of bits to the ALU, the value is neither signed nor unsigned, no? |
00:10:29 | * | vbtt quit (Client Quit) |
00:12:21 | flaviu | skyfex: Conceptually, I think signed numbers as numbers, and unsigned integers as a series of bits. Doing arithmetic on signed ints could also lead to accidents like using signed shifts. |
00:15:07 | skyfex | flaviu: Well both are just a series of bits, even most arithmetic instructions don't care if it's signed or unsigned since we use 2's complement form.. It's mostly only when doing sign extension or arithmetic shift that it comes into play |
00:16:10 | renesac | or when adding it to a signed integer |
00:16:24 | jpoirier | skyfex: example, int a = -8; a >> 2 = -2; unsigned int b = 8; b >> 2 = 4 |
00:16:40 | renesac | -128 is very different from 255 |
00:17:44 | * | Puffin is now known as BitPuffin |
00:19:53 | * | BlaXpirit quit (Quit: Quit Konversation) |
00:20:12 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
00:20:56 | renesac | oh, the tutorials are now in Learn, not on Docs, I missed it |
00:21:09 | jpoirier | E.g., when processing packets of data you may not want to arithmetically interpret the data and to ensure it doesn't happen at the hardware level C has unsigned types. |
00:21:35 | renesac | maybe it would be good to add something at the docs page pointing to the learn page |
00:22:30 | renesac | but maybe I'm the only one blind here |
00:23:15 | skyfex | jpoirier: It's not the type of the int that determines whether they are treated arithmeticly or not, it's the operations you perform on it |
00:23:45 | * | Demos_ joined #nim |
00:24:21 | skyfex | Scratch that, you're right for shift |
00:24:35 | skyfex | In C |
00:24:59 | skyfex | In my opinion that's a design error in C |
00:25:31 | renesac | skyfex, but it is still very error prone to use +% in nimrod |
00:25:52 | renesac | that was one of the reasons araq finally introduced unsigned numbers in nimrod |
00:27:00 | flaviu | renesac: It's nim now :) |
00:27:13 | skyfex | renesac: hm, yeah, nim does overflow checking, that complicates things |
00:27:25 | Triplefox | I agree about using unsigned for bit patterns. It's really irritating when the language wants to act like everything is a number |
00:27:54 | def- | skyfex: you can disable them for part of your code iirc |
00:28:03 | * | chrisheller quit (Ping timeout: 252 seconds) |
00:28:13 | skyfex | Triplefox: Then there should be a bitvector type, rather than unsigned.. which is still a number ;) |
00:28:16 | jpoirier | skyfex: I think maybe your missing the hardware point of view. For signed types the upper most bit contains the sign for for an unsigned time it's just another bit, and the hardware needs to know that to determine what flags to set and how to handle ops in the hardware |
00:28:50 | jpoirier | s/unsigned time/unsigned type |
00:29:03 | skyfex | jpoirier: I make hardware for a living :P |
00:29:05 | renesac | flaviu, err, I will take sometime to internalize that |
00:29:08 | renesac | :P |
00:29:14 | renesac | damn americans, I liked the name nimrod |
00:29:22 | ekarlso- | hmmm |
00:29:29 | ekarlso- | how can I check if a field of a obj is set ? |
00:29:40 | ekarlso- | if obj.field != nil isn't working too good |
00:30:21 | jpoirier | skyfex: oh, well, then you know more about it than me. for sure |
00:30:32 | flaviu | renesac: You're just jealous of our freedom ;). ekarlso-: You can't, that doesn't make sense |
00:30:49 | skyfex | jpoirier: not necessarily.. you might have experience with other architectures than me |
00:30:50 | flaviu | ekarlso-: It'd require nim have a bit for each field and set it on first assignment |
00:31:07 | ekarlso- | flaviu: so if a object is created with one of the fields not set how then ?! |
00:31:16 | skyfex | jpoirier: but say AVR8, the ADD instruction is the same for signed and unsigned numbers |
00:31:47 | skyfex | The hardware doesn't care about the sign bit except for very few instructions, like signed shift right, which copies the sign bit when shifting down |
00:31:56 | skyfex | *arithmetic shift right |
00:31:58 | def- | Oh, SO activity: https://stackoverflow.com/questions/27750045/statement-list-composition |
00:32:04 | flaviu | ekarlso-: I'm not sure what you mean. A possible solution might be to make the "field" a proc and take advantage of UFCS. You can set and check your bit there. |
00:32:34 | ekarlso- | flaviu: no tfollowing that bit but |
00:32:58 | skyfex | jpoirier: My confusion with your example in C was that I forgot that >> uses the arithmetic shift right instruction when the numbers are signed.. in Verilog >> is always logical shift, whether the numbers are signed or not, while >>> is arithmetic shift |
00:33:05 | flaviu | ekarlso-: type mytype = object; myfield: T; myfieldset: bool |
00:33:21 | Triplefox | I'm coming more from the perspective of languages like js or lua where they just cut you off without giving options |
00:33:22 | jpoirier | skyfex: I've done a lot of forward error correction (and other) en/de-coding on DSPs and other embedded processors and they're all a bit different. But for C, it's always safe to process said data using unsigned types. |
00:33:30 | ekarlso- | flaviu: that just seems weird |
00:33:46 | Triplefox | I am open to "better than uint" as an idea |
00:33:55 | skyfex | jpoirier: Yes, you're right, considering >> becomes arithmetic shift on signed |
00:34:07 | flaviu | ekarlso-: What programming background are you from? It might help me tailor my answers better. |
00:34:33 | ekarlso- | pythom ;) |
00:35:04 | jpoirier | skyfex: but I always used signed types when writing logic in conditionals, etc |
00:35:13 | * | superfunc quit (Ping timeout: 246 seconds) |
00:37:34 | flaviu | ekarlso-: Ok. The way python works is they have a big hashmap for each object. If a field isn't set, it's not in the hashmap, that's how you check. |
00:37:34 | flaviu | In Nim, everything is a bunch of bits. No hashmaps. Fields have their size determined at compile time. A field is always set, but sometimes to the default initialization of all 0's. |
00:37:40 | flaviu | ekarlso-: Does that make sense so far? |
00:38:06 | * | superfunc[mobile joined #nim |
00:39:34 | jpoirier | skyfex: it's my understanding that Nim is closer to a systems language at this point and as such I'd be a bit mortified if unsigned types were just aliases to signed types. |
00:40:46 | skyfex | jpoirier: In light of that, maybe nim should have the bitwise operations on unsigned exposed by default, while leaving the arithmetic functions undefined unless you import 'unsigned'.. I agree that given C's behavior it's correct to use unsigned for bitwise operations |
00:40:55 | * | Var|Mobile joined #nim |
00:41:21 | ekarlso- | flaviu: ye |
00:41:25 | ekarlso- | flaviu: http://imgur.com/sKMu2yf |
00:41:32 | ekarlso- | ehm, generally ^ that link |
00:41:39 | * | viralata quit (Quit: leaving) |
00:41:44 | ekarlso- | it actually works with a nim backend |
00:41:53 | skyfex | jpoirier: they're not, unsigned types are there more or less, but there's some bugs |
00:43:48 | flaviu | ekarlso-: So if it's all 0s, you don't know if the compiler set them that way or whether you did. Therefore, you need some sort of marker that you set if you've set the field. That's also referred to as a bit sometimes, because a boolean can be represented as a bit. |
00:44:03 | skyfex | jpoirier: But I'm trying to fix them at the moment :) |
00:44:07 | ekarlso- | flaviu: ahhh ok |
00:44:18 | ekarlso- | dom96: tmrw i'll add tags stuff and so on |
00:44:21 | ekarlso- | getting there slowly |
00:44:29 | jpoirier | skyfex: yeah, i've dug in to the code and hadn't seen anything that suggested unsigned types were all signed but I've not looked through all the code...then Araq made a comment alluding to maybe that was the case |
00:44:36 | * | yglukhov__ quit (Quit: Be back later ...) |
00:45:10 | * | Varriount|Mobile quit (Ping timeout: 264 seconds) |
00:48:09 | jpoirier | skyfex: fortunately I've not had to deal with many signed vs unsigned bugs but there have been a few, and quite painful to find. It's a similar situation with type bit widths. |
00:51:18 | skyfex | jpoirier: The whole situation is not well resolved yet is my impression |
00:54:55 | skyfex | Some wrappers were created before uint and pals were added I suppose |
00:55:22 | skyfex | The current c2nim translates unsigned int to uint etc. |
00:58:41 | jpoirier | skyfex: it' can be confusing stuff to think about and second guessing the correctness of the language would be a problematic |
01:04:29 | nimnoob123 | trying to install gtk2 with nimble, but it's saying it can't load the ssleay32.dll which is weird because i'm looking right at the file - windows 7 prebuilt archives |
01:11:38 | renesac | babel = nimble? |
01:11:46 | * | Ven joined #nim |
01:14:36 | skyfex | renesac: yeah |
01:18:36 | nimnoob123 | yea, renamed in latest update |
01:20:16 | def- | Got it solved but I really think the compiler should do this automatically: https://stackoverflow.com/questions/27750045/statement-list-composition/27750779 |
01:24:49 | * | Var|Mobile quit (Ping timeout: 245 seconds) |
01:26:07 | * | VinceAddons quit (Read error: Connection reset by peer) |
01:26:28 | ldlework | man |
01:26:41 | ldlework | downcasting is a serious growing pain coming from dynamic typing |
01:26:49 | * | nimnoob123_ joined #nim |
01:27:01 | * | nimnoob123 quit (Ping timeout: 246 seconds) |
01:27:34 | * | nimnoob123_ is now known as nimnoob123 |
01:32:59 | ldlework | this is perplexing |
01:33:07 | ldlework | I have a function which takes a Foo |
01:33:26 | ldlework | in one place in my program, I create a Bar which is a subtype of Foo, and pass it to this function |
01:33:39 | ldlework | the resulting machinery correctly calls the methods of Bar |
01:33:56 | ldlework | in a different place in my program, I create a Baz which is also a subtype of Foo, and pass it to this same function |
01:34:02 | * | onionhammer quit (Ping timeout: 244 seconds) |
01:34:11 | ldlework | the same resulting machinery calls the methods defined on Foo |
01:34:22 | ldlework | I'm a bit perplexed |
01:34:58 | ldlework | I presume that somewhere my Baz is getting downcast |
01:35:08 | ldlework | but I just don't see how |
01:35:12 | ldlework | the types are defined the same |
01:35:15 | ldlework | they are initialized the same |
01:35:18 | ldlework | and passed to the same function |
01:35:31 | ldlework | I wish I knew how to debug nim programs |
01:37:37 | nimnoob123 | hmm fixed my open ssl issue w/ nimble, replaced the dll's w/ the 64bit ones here https://code.google.com/p/openssl-for-windows/ and everything works |
01:38:52 | def- | nimnoob123: so nimble ships with the wrong libraries? |
01:39:14 | ldlework | Is there anyway to just magically print the type of a name? |
01:39:17 | nimnoob123 | def-: possibly, i have a 64bit machine maybe they ship w/ 32bit? |
01:39:38 | def- | ldlework: type of a name or name of a type? |
01:39:49 | def- | nimnoob123: should ship with both then I guess? |
01:40:14 | ldlework | def-: the type of an arbitrary variable |
01:40:21 | ldlework | well |
01:40:30 | ldlework | the name of the type of an arbitrary variabe, for printing purposes |
01:40:38 | ldlework | variabe. |
01:40:41 | nimnoob123 | def-: yeah would be nice, i'm actually surprised I got that far - it's working though and i actually got to build aporia properly |
01:40:42 | def- | ldlework: import typetraits; echo name(type(myVariable)) |
01:40:46 | ldlework | def-: thanks |
01:41:40 | def- | nimnoob123: i'd suggest a bugreport to nimble then |
01:41:55 | nimnoob123 | def-: alright |
01:42:17 | * | ehaliewicz quit (Ping timeout: 240 seconds) |
01:43:03 | ldlework | def-: hmm, if I pass a ref SubFoo, to a proc taking a ref Foo, we expect it to call the right methods on SubFoo, even if by the time it does so, typetraits considers the value to be a ref Foo (because dynamic dispatch?) |
01:44:41 | def- | ldlework: no idea, i'm not big with object orientation. all i have is this: https://github.com/def-/nim-unsorted/blob/master/polymorphiccopy.nim |
01:44:56 | * | ldlework pouts |
01:45:44 | def- | this seems to call the right methods |
01:45:59 | def- | because all types are refs, otherwise it's wrong |
01:46:21 | ldlework | def-: yeah, for one subclass it calls the right methods |
01:46:32 | ldlework | for the other subclass, when I pass it to the *same* function, it get's downcast |
01:46:35 | ldlework | and the base methods are called |
01:46:57 | def- | is the other subclassa ref object too? |
01:47:03 | * | onionhammer joined #nim |
01:47:24 | ldlework | they are both "object of Foo" |
01:47:32 | def- | should be "ref object of Foo" |
01:47:41 | ldlework | def-: I don't create ref types |
01:47:45 | ldlework | I use ref's explicitly |
01:47:49 | ldlework | lets not have that argument |
01:47:52 | ldlework | both types here are the same |
01:47:58 | ldlework | that's all that matters |
01:48:13 | def- | no idea then |
01:55:04 | ldlework | hahaha |
01:55:10 | ldlework | helps if you import the module with the methods |
01:55:13 | ldlework | fuck |
01:56:28 | * | johnsoft joined #nim |
02:01:23 | jpoirier | this is such a handy website http://www.tutorialspoint.com/codingground.htm I hope they upgrade their Nim compiler to 0.10.2 soon though |
02:04:39 | * | MrOrdinaire joined #nim |
02:08:53 | * | MrOrdinaire quit (Client Quit) |
02:09:03 | nimnoob123 | jpoirier: that's cool |
02:11:32 | jpoirier | nimnoob123: unfortunately they don't seem to keep some of the language compilers up to date. :( For some it's no big deal, but for younger languages (rist, go, nim, d, dart, ...) it's a bit irritating. |
02:14:33 | * | dyu joined #nim |
02:15:37 | * | fiatjaf quit (Remote host closed the connection) |
02:16:22 | * | saml_ quit (Ping timeout: 264 seconds) |
02:19:41 | * | derek joined #nim |
02:21:24 | MyMind | exist do..while in nim? |
02:27:02 | * | Y0Gi_ left #nim (#nim) |
02:28:28 | jpoirier | don't think so http://nim-lang.org/manual.html |
02:28:53 | * | willwillson quit (Ping timeout: 240 seconds) |
02:29:00 | def- | MyMind: no, but you can write it yourself: https://github.com/def-/nim-unsorted/blob/master/dowhile.nim |
02:29:48 | MyMind | jpoirier: i was looking on the manual |
02:30:44 | MyMind | ty def- |
02:32:32 | jpoirier | MyMind: i'm a nim noob myself and i'm really fatigued due to the new year festivities so i figured I'd send the link to the manual in case i missed something - no rtfm implied |
02:33:14 | MyMind | it's ok jpoirier |
02:33:25 | * | yglukhov__ joined #nim |
02:35:49 | flaviu | I personally like `while true: ...; if not cond: break` better |
02:36:07 | flaviu | and you can do that without extra templates |
02:37:02 | * | kapil__ joined #nim |
02:37:44 | * | yglukhov__ quit (Ping timeout: 245 seconds) |
02:40:06 | MyMind | for practising I'm porting a C program |
02:43:38 | no_name | how to you cast null pointers in nim? |
02:44:03 | renesac | flaviu, yeah, that template from def- isn't very nice to use |
02:44:19 | renesac | the good thing about do .. while is that the condition is at the end of the loop |
02:44:47 | flaviu | no_name: What are you trying to do? |
02:44:58 | renesac | MyMind, you are better off doing that using a while: true + if as flaviu said |
02:45:02 | renesac | IMHO |
02:45:16 | MyMind | yup im doing that |
02:45:16 | no_name | I'm populating a stream in the zlib library. It has fields which are function pointers that I want to set to null |
02:45:31 | flaviu | no_name: `NULL` in C is `nil` in Nim. |
02:46:18 | no_name | thanks |
02:47:21 | * | superfunc[mobile quit (Quit: Connection closed for inactivity) |
02:53:06 | * | Hakaslak joined #nim |
02:53:52 | * | brson quit (Quit: leaving) |
02:58:48 | MyMind | an equivalent of fabs in nim? |
02:59:47 | def- | MyMind: what's fabs? |
02:59:54 | MyMind | float abs |
02:59:59 | def- | import math; abs() |
03:00:12 | MyMind | is not in math I think |
03:00:20 | def- | oh, right |
03:00:33 | def- | it's in system, no import necessary |
03:01:06 | def- | For finding Nim stuff there's http://nim-lang.org/theindex.html |
03:01:28 | jpoirier | http://nim-lang.org/system.html#abs,float |
03:03:20 | * | superfunc|home joined #nim |
03:06:50 | superfunc|home | dom96: for 1.0, is there plans to include nimble with the install? |
03:08:46 | * | ehaliewicz joined #nim |
03:09:18 | dyu | def-: what's your os? |
03:09:41 | dyu | def-: I just updated nim to devel and your macro example still failed (I'm on ubuntu) |
03:11:15 | def- | dyu: linux x86-64 |
03:11:23 | def- | strange |
03:11:25 | dyu | hmm |
03:11:29 | dyu | same here |
03:11:38 | dyu | compile options you passed? |
03:11:47 | def- | none |
03:11:51 | def- | nim c mm |
03:12:25 | def- | Can anyone else check if this compiles for them? https://github.com/Araq/Nim/issues/1843 |
03:15:09 | * | chrisheller joined #nim |
03:17:21 | jpoirier | def-: eOS x86_64, nim v 0.10.3, works |
03:17:50 | dyu | ubuntu 13.04 x64, fails |
03:18:26 | def- | jpoirier: thanks. Is eOS elementary OS? |
03:18:38 | jpoirier | def-: yes |
03:19:15 | dyu | def-: gcc version? |
03:19:32 | dyu | mine is gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-2ubuntu4) |
03:19:43 | jpoirier | def-: 4.9.2 |
03:19:49 | * | darkf joined #nim |
03:20:10 | * | dyu spins up a VM |
03:20:31 | def- | the error indicates that it doesn't even get to gcc, dyu |
03:20:43 | def- | but i have gcc 4.8.4 |
03:21:02 | dyu | well the compiler is built with gcc |
03:21:08 | dyu | 4.7.3 |
03:21:37 | def- | oh yeah, but i somehow don't want to believe it's a gcc bug |
03:25:33 | jpoirier | i'll check with gcc 4.8 as well, hold a sec... |
03:28:37 | jpoirier | eOS gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2, it works fine |
03:29:06 | def- | dyu: maybe you have an older nim version in your path? |
03:29:49 | dyu | def-: Nim Compiler Version 0.10.3 (2015-01-03) [Linux: amd64] |
03:30:07 | * | ehaliewicz quit (Remote host closed the connection) |
03:30:11 | dyu | from nim -v |
03:30:27 | def- | no idea then =/ |
03:31:43 | jpoirier | just curious, what's the error msg? |
03:32:21 | dyu | jpoirier: in the link def posted |
03:32:30 | jpoirier | doh, never mind; it's on the webpage |
03:32:50 | jpoirier | lol |
03:32:54 | * | dyu the nim repo is laaarge, taking a while to clone on the vm |
03:34:09 | * | dyu 200mb downloaded and still going |
03:34:29 | jpoirier | i think it's 300 or so |
03:35:20 | def- | faster to download the zip of devel HEAD for quick tests |
03:36:37 | dyu | yea, too bad i'm already 80% in :/ |
03:36:52 | renesac | the nim repository is only about 30mb now |
03:37:22 | renesac | it used to be 300+mb |
03:37:57 | renesac | because a lot of cruft on the history |
03:38:41 | renesac | 32.16 MiB my clone |
03:38:46 | dyu | renesac: my fork probably is linked to the old one, which is the one I'm checking out on |
03:38:56 | dyu | the old one with all the history |
03:39:07 | renesac | it was months ago, that cleaning... |
03:39:08 | def- | so you're running your own fork of Nim, dyu! |
03:39:23 | dyu | def-: the fork 'devel' with no changes |
03:39:32 | dyu | just keeping up with upstream |
03:39:57 | renesac | there was some instructions for those with forks to update to the new smaller repo |
03:40:01 | renesac | at the time |
03:40:07 | * | dyu was absent |
03:40:12 | dyu | at that time |
03:41:12 | renesac | dyu, http://forum.nimrod-lang.org/t/417 |
03:41:32 | renesac | and: https://github.com/Araq/Nim/issues/958 |
03:42:04 | dyu | yea I missed that |
03:48:20 | MyMind | how do I translate ip = (int)((t + 22.5)/45) & 0x7 to nim |
03:48:28 | MyMind | and bitwise operator |
03:50:08 | def- | ip = int((t + 22.5)/45) and 0x7 |
03:50:31 | * | Demos_ quit (Ping timeout: 255 seconds) |
03:53:20 | MyMind | ty def- |
03:54:41 | MyMind | what is the best approach for void functions |
03:54:58 | MyMind | return an int and pragma discard? |
03:55:08 | MyMind | or just void type |
03:55:31 | def- | why would a void function return an int? |
03:55:44 | def- | just leave out the return type, then it's none |
03:55:59 | * | dashed joined #nim |
03:59:32 | * | Hakaslak quit (Quit: TODO: Generate 'Computer Sleep Quit Message') |
04:00:06 | * | Hakaslak joined #nim |
04:00:43 | def- | dyu: you can also try in the nim dir: ./koch temp c file.nim to get a backtrace |
04:00:44 | MyMind | you can put void ? |
04:01:05 | def- | MyMind: prox foo(x: int) = echo "Hello ", x |
04:01:09 | def- | proc* |
04:02:57 | dyu | def-: ok I tried it and here's the trace: sempass2.nim(823) trackProc |
04:03:11 | dyu | that's the last one before SIGSEGV |
04:03:59 | jpoirier | wow, compiling Nim with -d:useGnuReadline makes nim interactive mode so much better |
04:04:24 | * | Hakaslak quit (Ping timeout: 245 seconds) |
04:04:39 | * | adam_s joined #nim |
04:05:39 | dyu | def-: on ubuntu 14.04 x64 with gcc 4.8.2, i get the same error |
04:05:52 | dyu | on a vm |
04:13:05 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
04:13:29 | * | johnsoft quit (Quit: Leaving) |
04:17:46 | * | johnsoft joined #nim |
04:18:55 | dyu | i'm installing gcc 4.9 to check |
04:20:08 | * | Varriount|Laptop joined #nim |
04:22:18 | * | yglukhov__ joined #nim |
04:24:28 | * | Varriount|Laptop quit (Ping timeout: 246 seconds) |
04:26:37 | * | yglukhov__ quit (Ping timeout: 240 seconds) |
04:32:48 | dyu | def-: no joy, still doesn't work on gcc 4.9 |
04:32:57 | renesac | what are you testing? |
04:32:58 | dyu | 4.9.2 |
04:33:53 | dyu | renesac: https://github.com/Araq/Nim/issues/1843#issuecomment-68580385 |
04:34:06 | dyu | renesac: are you on ubuntu? |
04:36:27 | jsudlow | hi all is there a diffrence between a string and a cstring in nim? |
04:39:22 | dyu | jsudlow: yea the former is garbage collected |
04:40:01 | jsudlow | dye: do you know how to create a cstring in nim? this render text solid function from the sdl_ttf lib requiers it |
04:40:03 | dyu | is backed by a different datastructure that wraps a char array |
04:40:10 | jsudlow | *dyu: |
04:40:21 | dyu | const foo: cstring = "" |
04:40:40 | dyu | proc foo(f: cstring) = ... then call foo("sdfsdf") |
04:40:43 | dyu | its automatic |
04:41:21 | jsudlow | dyu: so if I wanted to supply a cstring as a parameter to a function I could just do const foo: cstring ="" |
04:41:24 | jsudlow | and pass foo as the param? |
04:42:06 | dyu | sorry I used the foo var twice, you can pass a literal "sdf", or a var c:cstring, const c2:cstring or let c:cstring |
04:42:44 | dyu | jsudlow: in short, just pass a literal, it gets handled correctly |
04:42:52 | * | ldlework nods |
04:43:16 | renesac | dyu: yes, I'm on ubuntu |
04:43:26 | dyu | renesac: did it compile? |
04:43:27 | renesac | and yes, it compiles here |
04:43:30 | dyu | fark |
04:43:50 | renesac | I just bootstraped nim |
04:44:00 | renesac | I'm probably with the latest devel |
04:44:01 | dyu | renesac: what version? |
04:44:04 | renesac | wait |
04:44:05 | dyu | os |
04:44:14 | dyu | gcc |
04:45:12 | renesac | UbuntuVersion |
04:45:12 | renesac | 14.04 |
04:45:12 | renesac | trusty |
04:45:55 | renesac | gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) |
04:46:53 | dyu | renesac: can you post the exact commands where you bootstrapped, and compiled the example? |
04:47:02 | dyu | I'll try to follow it word-for-word |
04:47:43 | * | NimBot joined #nim |
04:47:51 | renesac | I made a new clone for Nim (didn't try to update the old Nimrod one) |
04:48:03 | renesac | bootstraped as described in the readme |
04:48:49 | renesac | and compiled with: |
04:48:52 | renesac | nim c -r test.nim |
04:48:58 | renesac | simple |
04:49:19 | renesac | see if you copied correctly the example in the first place |
04:51:02 | flaviu | jsudlow: another difference is that a cstring is null terminated while a string has a length field. |
04:51:22 | renesac | a string is also null terminated on nimrod, isn't? |
04:51:33 | ldlework | yes |
04:51:40 | renesac | exactly for C interop |
04:51:40 | flaviu | Yes, so that conversion to a cstring is O(1) |
04:52:07 | flaviu | ldlework: of course there exists an index, nim-lang.org/theindex.html |
04:52:17 | ldlework | `the`index.html |
04:52:19 | ldlework | of course |
04:52:24 | ldlework | we should probably link to it |
04:52:52 | flaviu | ldlework: http://nim-lang.org/documentation.html#search-options |
04:53:23 | flaviu | anyway, 'night |
04:53:26 | dyu | renesac: rename test.nim to quote.nim |
04:54:59 | renesac | dyu, |
04:55:00 | renesac | lol |
04:55:02 | * | dyu just wasted more than an hour |
04:55:07 | renesac | I get the error |
04:55:18 | dyu | for a silly bug |
04:55:31 | renesac | what is the reason? |
04:55:59 | dyu | its a bug in nim, not sure what "quote" has to do with it |
04:56:04 | dyu | but it triggers it |
04:56:22 | renesac | right, it is in the code too |
04:56:38 | renesac | bizarre |
04:57:02 | dyu | renesac: you helped me track it down :-) |
04:57:04 | dyu | thanks |
04:57:49 | dyu | I figured, all the steps were the same, ... let's try changing the filename ... then BOOM! |
04:58:58 | ldlework | I really wish we had a module system that divorced the modules/namespaces from the filesystem |
04:59:28 | renesac | you are welcome |
05:02:02 | * | nimnoob123 quit (Quit: Page closed) |
05:11:20 | ldlework | the errors that say ambiguous identifier use a qualifier should list the things you're ambiguous with just like when you pass wrong params |
05:11:30 | superfunc|home | just curious, for uniformity, when we go to 1.0, should json be called parsejson to match up with parsecsv, parsexml, parsecfg? |
05:12:51 | SplinterOfChaos | Is there any reading on how nim can be so efficient? I read a blog post claiming it being faster than C in some instance. I'm skeptical, but also curious. |
05:17:47 | * | viralata joined #nim |
05:18:50 | renesac | nimrod compiles to C, so you can aways make C as fast as nimrod, with sufficient effort |
05:19:54 | renesac | but where on C it could mean using terrible macros to do efficient generic programming, in nimrod you have that easily |
05:22:45 | * | chrisheller quit (Remote host closed the connection) |
05:22:48 | renesac | nimrod is a typed language that tries to be expressive, but the design decisions are very focused on efficiency too |
05:23:11 | renesac | /s/nimrod/nim |
05:23:58 | renesac | nim is alergic to any type of runtime overhead, it prefers compile-time mechanisms |
05:24:23 | renesac | that is what I can say from the top of my head SplinterOfChaos |
05:24:39 | renesac | good night |
05:24:54 | * | renesac is now known as renesac|away |
05:27:08 | SplinterOfChaos | thanks |
05:31:38 | jsudlow | hi all: does anyone know the difference between these 2 mismastches? Error: type mismatch: got (PSurface) but expected 'PSurface' |
05:32:18 | dyu | jsudlow: thats basically the same, any snip? |
05:32:41 | jsudlow | dye: just trying to set a surfaceText to a field on a type |
05:32:53 | jsudlow | method enter*(self: ref MenuScene) = |
05:32:53 | jsudlow | var myFont = openFont("src/fonts/Pacifo.ttf",14) |
05:32:53 | jsudlow | var myColor = sdl.TColor(r:250, g:250, b:250) |
05:32:53 | jsudlow | var surfaceText = renderTextSolid(myFont,"My test Font",myColor) |
05:32:53 | jsudlow | self.menuText = surfaceText |
05:33:10 | jsudlow | self.menuText = surfaceText complains of that type mismatch |
05:33:45 | jsudlow | and my type is MenuScene* = object of Scene |
05:33:45 | jsudlow | menuText*: graphics.PSurface |
05:33:51 | ldlework | jsudlow: use gist |
05:35:32 | ldlework | jsudlow: oh |
05:35:48 | ldlework | I think graphics has its own PSurface |
05:35:50 | dyu | it might be the graphics.PSurface expression, you've have to import "foo" as graphics I think |
05:36:24 | ldlework | yeah so we just need to make a graphics.PSurface from the sdl.PSurface |
05:37:18 | jsudlow | ldlework: yea that worked |
05:37:20 | ldlework | jsudlow: use this instead of sdl_ttf http://nim-lang.org/graphics.html#newFont,string,int |
05:37:30 | ldlework | IE, load your font with this |
05:37:34 | ldlework | get a graphics.PSurface back |
05:37:37 | ldlework | all is good |
05:37:42 | ldlework | see |
05:37:56 | jsudlow | all is well :_ |
05:37:57 | jsudlow | :) |
05:37:59 | ldlework | nice |
05:38:49 | jsudlow | * feeds ldlework a cinnamon bun for his efforts |
05:44:33 | * | SplinterOfChaos quit (Read error: Connection reset by peer) |
05:45:02 | * | ARCADIVS joined #nim |
05:53:22 | * | viralata left #nim (#nim) |
06:04:23 | * | mxstirner joined #nim |
06:07:58 | * | adam_s quit (Ping timeout: 264 seconds) |
06:08:42 | * | renesac|away quit (Ping timeout: 244 seconds) |
06:11:13 | * | yglukhov__ joined #nim |
06:15:42 | * | yglukhov__ quit (Ping timeout: 245 seconds) |
06:20:55 | * | adam_s joined #nim |
06:21:54 | * | z1y joined #nim |
06:23:04 | * | chrisheller joined #nim |
06:23:32 | * | chrisheller quit (Remote host closed the connection) |
06:23:38 | * | chrisheller joined #nim |
06:25:16 | * | chrisheller quit (Client Quit) |
06:40:39 | adam_s | can anyone tell me how to disable a specific warning? I see "--warning[X]:on|off" in the docs, |
06:40:40 | * | stapler joined #nim |
06:40:43 | adam_s | but I can't seem to get the compiler to accept XDeclaredButNotUsed |
07:08:27 | dv- | that's a hint |
07:08:44 | ldlework | heh |
07:09:04 | adam_s | same problem using --hint |
07:10:33 | adam_s | could you give an example of a valid compilation command which disables XDeclaredButNotUsed? |
07:10:41 | adam_s | say for a file named file.nim |
07:13:38 | dv- | nim --hint[XDeclaredButNotUsed]:off |
07:13:44 | dv- | apparently |
07:15:32 | * | gour joined #nim |
07:15:39 | adam_s | yep, zsh seems to be breaking it for me |
07:15:42 | adam_s | thanks |
07:24:22 | * | mxstirner quit (Ping timeout: 246 seconds) |
07:35:46 | * | dashed quit (Quit: Connection closed for inactivity) |
07:44:52 | * | tane joined #nim |
07:44:58 | tane | good morning |
07:45:45 | dts|pokeball | good morning |
07:48:05 | * | NimBot joined #nim |
07:51:32 | * | kapil__ quit (Quit: Connection closed for inactivity) |
07:53:26 | * | BlaXpirit joined #nim |
08:00:04 | * | yglukhov__ joined #nim |
08:04:27 | * | yglukhov__ quit (Ping timeout: 256 seconds) |
08:06:10 | * | BitPuffin quit (Ping timeout: 264 seconds) |
08:13:06 | * | yglukhov__ joined #nim |
08:14:35 | dts|pokeball | hrmmm... i think im going to have to use threads :/ |
08:15:30 | ldlework | for what |
08:15:52 | dts|pokeball | Nimbus |
08:16:08 | ldlework | right; for what? |
08:16:20 | dts|pokeball | oh |
08:16:31 | dts|pokeball | so, watch this and wait 10 ssecs |
08:16:47 | dts|pokeball | oh wait mimbus is offline |
08:16:49 | dts|pokeball | anyways] |
08:17:19 | * | yglukhov__ quit (Ping timeout: 245 seconds) |
08:17:21 | dts|pokeball | if i want to prevent things like real infinite loops, i need to do timeouts |
08:17:41 | dts|pokeball | i talked to eelis, who wrote geordi (the c++ eval bot) and he suggested alarm |
08:18:51 | dts|pokeball | so my solution is to spawn a thread to compile the eval, and if it doesnt return before SIGALARM is raised, kill the second thread and have the bot print something like [timed out] |
08:21:16 | dts|pokeball | unless you can think of a better solution ldlework ? |
08:21:34 | ldlework | dts|pokeball: the solution I dreamed up was docker based and you wouldn't like it |
08:22:22 | * | z1y quit (Ping timeout: 245 seconds) |
08:22:34 | ldlework | which is essentially a system where the bot actually spins up a new container with the input |
08:22:44 | ldlework | the container just compiles and outputs a file, which the bot then reads and spits out |
08:23:00 | dts|pokeball | hmmm... maybe |
08:23:18 | ldlework | like |
08:23:19 | ldlework | wouldn't |
08:23:27 | ldlework | nim c -r somefile > output.txt |
08:23:28 | ldlework | work |
08:23:38 | ldlework | you don't need any extra machinery in the container |
08:23:39 | * | noriok joined #nim |
08:23:41 | ldlework | just the compiler |
08:24:30 | dts|pokeball | well see, the issue with that is writing errors |
08:24:38 | dts|pokeball | my current system grabs the errors |
08:25:06 | ldlework | dts|pokeball: I'm pretty sure unix has a way of filtering the stdout and stderr to different files |
08:25:25 | ldlework | http://stackoverflow.com/questions/7901517/how-to-redirect-stderr-and-stdout-to-different-files-in-the-same-line-of-bash |
08:26:14 | dts|pokeball | hrrrmmmm |
08:27:15 | dts|pokeball | hey ldlework :) wanna do me a favor? |
08:27:50 | ldlework | docker run -d -v /nimbus/input/AFE39DD.txt:/input.txt -v /nimbus/outputAFE39DD.txt:/output.txt nimbus |
08:28:49 | * | yglukhov__ joined #nim |
08:28:51 | ldlework | somethin like that |
08:30:12 | dts|pokeball | but i dont have any of those folders or files |
08:30:16 | * | yglukhov__ quit (Read error: Connection reset by peer) |
08:30:44 | * | yglukhov__ joined #nim |
08:31:13 | * | derek quit (Ping timeout: 246 seconds) |
08:31:45 | ldlework | lol |
08:31:52 | ldlework | substitute whatever you want |
08:32:28 | * | NimBot joined #nim |
08:35:00 | dts|pokeball | so if im writing the eval stuff to $NIMBUS_ROOT/eval/eval.nim, then i should do something like this? docker run -d -v $NIMBUS_ROOT/nimbus/eval/eval.nim -v $NIMBUS_ROOT/output.txt nimbus? |
08:35:08 | dts|pokeball | what are the colon things? |
08:36:17 | ldlework | dts|pokeball: you run nimble outside the container |
08:36:20 | ldlework | on the host |
08:36:30 | ldlework | nimble talks to docker |
08:36:36 | * | noriok quit () |
08:36:39 | ldlework | to start containerized nim compilers |
08:37:13 | * | dts|pokeball is still confused :/ |
08:37:35 | ldlework | dts|pokeball: you have a program |
08:37:37 | ldlework | nimbus |
08:37:40 | ldlework | written in nim |
08:37:43 | ldlework | it can do 2 things |
08:37:46 | ldlework | connect to irc |
08:37:52 | ldlework | and shell out to the docker cli tool |
08:37:56 | ldlework | when someone types .eval |
08:38:00 | ldlework | you take their text |
08:38:05 | ldlework | write it to a file in a known location |
08:38:11 | ldlework | then you shell out to docker |
08:38:36 | ldlework | telling docker to start a new container, that runs "nim c -r /input.txt > /error.txt > /output.txt" or whatever |
08:38:46 | ldlework | you mount the files inside the container, to files on the host |
08:38:50 | ldlework | that's what the -v flags are |
08:39:04 | ldlework | so that when the output of the nim compiler get's piped to the files inside the container |
08:39:10 | ldlework | they are really writing to files on your host |
08:39:19 | dts|pokeball | ok wait |
08:39:21 | ldlework | files that nimbus can read and spit back to the irc user |
08:39:54 | dts|pokeball | so /AFE39DD.txt is the one inside docker and input.txt would be the one mounted on the host? |
08:40:00 | ldlework | no |
08:40:13 | ldlework | AFE39DD is a random token you assign to this specific compilation request |
08:40:23 | dts|pokeball | pj |
08:40:25 | ldlework | you remember "ldlework's token is AFE39DD" |
08:40:26 | dts|pokeball | **oh |
08:40:31 | * | SplinterOfChaos joined #nim |
08:40:34 | ldlework | inside the container |
08:40:37 | ldlework | the file names are generic |
08:40:45 | dts|pokeball | oh, so i got it backwards |
08:40:53 | ldlework | so that the "nim c -r /input.txt ..." command can always be the same |
08:41:54 | ldlework | dts|pokeball: with this, you can easily control the memory and cpu that each compilation can utilize |
08:42:03 | ldlework | you can let people write to disk in their examples |
08:42:12 | ldlework | and clean up anything they do by deleting their container |
08:42:19 | ldlework | you can make it so they don't have a network |
08:42:34 | dts|pokeball | hmmm good point. how late are you going to be up so i can get you to review my work? |
08:42:40 | ldlework | and nimbus can have an async timer that schedules a pre-emptive deletion of the container if it takes too long |
08:43:06 | ldlework | dts|pokeball: a while but I wont have much attention |
08:43:11 | dts|pokeball | ok |
08:43:11 | ldlework | I'll have some |
08:43:26 | dts|pokeball | well ill get started then anyways |
08:44:08 | ldlework | dts|pokeball: I would start by building a Nim docker image |
08:44:15 | dts|pokeball | how do i do that? |
08:44:24 | * | MrOrdinaire joined #nim |
08:44:25 | dts|pokeball | actually, let me back up |
08:44:25 | ldlework | writing a Dockerfile |
08:44:38 | dts|pokeball | no wait never mind i understand |
08:44:45 | ldlework | so the ocmpiler can run in the container |
08:44:49 | dts|pokeball | so i guess i have to learn to write a dockerfile |
08:44:50 | ldlework | FROM ubuntu:latest |
08:44:56 | ldlework | RUN |
08:45:03 | ldlework | then everything to compile nim's compiler, etc |
08:45:06 | ldlework | just like on your local host |
08:45:33 | dts|pokeball | oh, so i need an ubuntu image with nim on it. duh |
08:45:40 | ldlework | http://docs.docker.com/userguide/dockerimages/#creating-our-own-images |
08:45:59 | ldlework | http://docs.docker.com/reference/builder/ |
08:46:04 | dts|pokeball | im going to focus on creating the async timer last |
08:46:10 | ldlework | dts|pokeball: good idea |
08:46:41 | dts|pokeball | ok, one last question... |
08:47:00 | ldlework | chose wisely |
08:47:04 | ldlework | hehe just kidding |
08:47:25 | * | gokr_ joined #nim |
08:47:42 | dts|pokeball | (for now anyways ;) knowing my stupidity im sure ill have much more) what data container should i use to map users to files? |
08:48:33 | ldlework | eh you dont need a data container |
08:48:35 | ldlework | just map files directly to your host |
08:48:45 | ldlework | unless you plan on moving nimbus around to different hosts a lot |
08:48:53 | ldlework | even then it doesn't matter, its more for like |
08:48:59 | ldlework | ah I don't have time to explain |
08:49:16 | dts|pokeball | what does map files directly to your host mean? |
08:49:26 | * | adam_s quit (Quit: Leaving) |
08:49:34 | dts|pokeball | oh wait |
08:49:53 | ldlework | dts|pokeball: you're going to mount the file inside the container /input.txt to some file on your host /nimbus/inputs/ldlework.txt |
08:50:05 | ldlework | so that when the container starts up and tries to compile /input.txt |
08:50:12 | dts|pokeball | i guess you just mean generate a token, and just make it known throughout that current run of the loop |
08:50:14 | ldlework | it has the contents of /nimbus/inputs/ldlework.txt |
08:50:17 | * | gokr quit (Ping timeout: 240 seconds) |
08:50:17 | ldlework | yes |
08:50:27 | ldlework | dts|pokeball: is your application async? |
08:50:37 | ldlework | can you do multiple async i/o operations? |
08:50:41 | dts|pokeball | sorry. im a bit tired. thanks for all of the input :) and no. its TCP sockets |
08:50:46 | ldlework | ouch |
08:50:51 | dts|pokeball | but im willing to change it |
08:51:03 | ldlework | dts|pokeball: well I don't know *anything* about Nim's async support |
08:51:09 | ldlework | I'm used to Python's twisted |
08:51:19 | dts|pokeball | hrrmmm |
08:51:25 | ldlework | so someone else would have to help you rework the actual nim app to be async |
08:51:26 | dts|pokeball | ill ask dom96 about it in the morninng |
08:51:30 | ldlework | sure |
08:51:46 | ldlework | dts|pokeball: what lib are you using for irc |
08:51:58 | dts|pokeball | im not. im just using sockets. |
08:52:07 | ldlework | okay you wernt kiddin |
08:52:10 | ldlework | :) |
08:52:27 | dts|pokeball | since its not that hard to parse irc, i didnt feel like using a full irc lib |
08:52:42 | dts|pokeball | especially since im parsing an incredibly small subset |
08:52:44 | ldlework | yeah but I wonder if the irc lib is already built ontop of asyncore |
08:52:52 | ldlework | dts|pokeball: okay first step |
08:52:54 | dts|pokeball | dom96 told me it uses sockets |
08:52:58 | ldlework | learn asyncore and async/wait |
08:53:12 | dts|pokeball | yeah, ill do that after docker though |
08:53:19 | ldlework | well I don't think you can really |
08:53:25 | dts|pokeball | why? |
08:53:36 | ldlework | hmm I guess you can poll |
08:53:45 | ldlework | but when you're doing docker stuff |
08:53:49 | ldlework | and waiting for compilation |
08:53:59 | ldlework | wont IRC disconnect because you're not responding to pings? |
08:54:01 | ldlework | and so on |
08:54:12 | dts|pokeball | huh... good point |
08:54:12 | ldlework | how does that work |
08:54:16 | dts|pokeball | although |
08:54:33 | dts|pokeball | no never mind. yeah it might be better to do that first |
08:54:41 | ldlework | dts|pokeball: it'll be a great skill |
08:54:42 | ldlework | and in the end |
08:54:57 | ldlework | the bot wil be able to be in multiple channels responding to multiple compilation requests simultaneously, etc |
08:55:03 | dts|pokeball | ooooo sexy |
08:55:19 | dts|pokeball | do you have any sources for learning async io? it doesnt have to be in nim |
08:55:24 | dts|pokeball | python/c++ works |
08:55:45 | ldlework | dts|pokeball: its a hard subject, but if you already know python you might be able to learn Twisted's basics |
08:55:49 | ldlework | I mean |
08:55:54 | ldlework | It was hard for me. But I'm a twit. |
08:56:01 | dts|pokeball | damn :/ i am too |
08:56:04 | ldlework | haha |
08:56:06 | dts|pokeball | but ill give it a shot |
08:57:06 | ldlework | http://krondo.com/wp-content/uploads/2009/08/twisted-intro.html |
08:57:10 | dts|pokeball | ty |
08:57:21 | ldlework | http://krondo.com/?page_id=1327 |
08:57:53 | ldlework | http://jcalderone.livejournal.com/tag/sixty%20seconds |
08:58:02 | ldlework | http://twistedmatrix.com/documents/current/core/howto/index.html |
09:16:40 | * | dyu quit (Quit: Leaving) |
09:19:46 | MrOrdinaire | hi, for `var p = (x: 0, y: 0, z: 0, a: 0, b: 0, c: 0, d: 0)`, is there any way to only get a, b, c out via destructuring? |
09:23:24 | dv- | what's wrong with p.a, p.b, p.c? |
09:25:14 | MrOrdinaire | `p.` is repeated? so there's no way to do that? |
09:25:18 | ldlework | MrOrdinaire: take a slice |
09:25:48 | MrOrdinaire | ldlework: can you show me an example? |
09:26:58 | MrOrdinaire | proc energy(bodies: NBody): float64 = |
09:26:59 | MrOrdinaire | var dx, dy, dz, distance: float64 |
09:26:59 | MrOrdinaire | result = 0 |
09:27:01 | MrOrdinaire | for i in low(bodies)..high(bodies): |
09:27:02 | MrOrdinaire | let (ix, iy, iz, ivx, ivy, ivz, imass) = bodies[i] |
09:27:04 | MrOrdinaire | result += 0.5 * imass * (ivx * ivx + ivy * ivy + ivz * ivz) |
09:27:06 | MrOrdinaire | for j in i+1..high(bodies): |
09:27:08 | MrOrdinaire | let (jx, jy, jz, jvx, jvy, jvz, jmass) = bodies[j] |
09:27:10 | MrOrdinaire | dx = ix - jx |
09:27:12 | MrOrdinaire | dy = iy - jy |
09:27:14 | MrOrdinaire | dz = iz - jz |
09:27:16 | MrOrdinaire | distance = sqrt(dx*dx + dy*dy + dz*dz) |
09:27:18 | MrOrdinaire | result -= (imass * jmass) / distance |
09:27:20 | MrOrdinaire | sorry for the mess |
09:27:25 | MrOrdinaire | https://gist.github.com/anonymous/3565c9711ab2a099db76 |
09:27:29 | dts|pokeball | use a fucking paste mate |
09:27:47 | MrOrdinaire | dv-: this is the piece of code i'm writing |
09:28:27 | ldlework | MrOrdinaire: it is polite to use a service like Gist, to link to snippets of code |
09:28:32 | ldlework | rather than flooding the channel |
09:28:41 | MrOrdinaire | sorry for that |
09:28:47 | ldlework | no worries |
09:28:57 | MrOrdinaire | I pasted the link afterwards |
09:29:14 | ldlework | anyway I am currently perplexed by the behavior of assigning a slice |
09:29:15 | ldlework | ohhhh |
09:30:02 | MrOrdinaire | I guess `result = 0` is redundant |
09:31:17 | MrOrdinaire | for that piece of code, keep typing `bodies[j].` is a bit tiring |
09:31:27 | dom96 | dts|pokeball: be more polite |
09:31:30 | MrOrdinaire | so unpacking helps |
09:32:22 | dts|pokeball | alright. it just annoys me when people paste to public channels |
09:32:57 | MrOrdinaire | dts|pokeball: sorry for the mess |
09:33:17 | dom96 | dts|pokeball: Doesn't mean you can't be polite. |
09:33:31 | dts|pokeball | MrOrdinaire, its ok :} sorry for the language. im grouchy cause im learning confusing io |
09:33:35 | ldlework | dom96: he gets it |
09:33:35 | dom96 | dts|pokeball: FYI the irc lib is async. |
09:33:47 | dts|pokeball | TIL |
09:33:50 | ldlework | dom96: how do you unpack a slice into a tuple of variables?! |
09:34:16 | BlaXpirit | EXetoC, so I literally created a folder doc with an empty file of that name in it, and it worked |
09:34:19 | MrOrdinaire | so in that piece of code, jvx, jvy, jvz is never used. is there any way to get rid of them? |
09:34:29 | BlaXpirit | just so you know, official package is broken in the exact same way |
09:34:30 | dom96 | ldlework: i'm not sure what you mean |
09:34:53 | ldlework | dom96: let (a, b, c) = [1,2,3,4,5][0..2] |
09:35:11 | dom96 | ldlework: You can't destructure arrays/seqs that way. |
09:35:18 | ldlework | that's really unfortunate |
09:35:30 | ldlework | but ok |
09:35:33 | ldlework | MrOrdinaire: there's your answer |
09:36:07 | dom96 | there were talks of allowing: let (_, _, jz, jvx, ...) = bodies[j] |
09:36:11 | ldlework | dom96: so you can't just convert a slice into a tuple with perhaps copy semantics? |
09:36:16 | dom96 | but it's not implemented yet as far as I know |
09:36:17 | MrOrdinaire | dom96: that would be nice |
09:36:30 | dom96 | MrOrdinaire: It will help if you create a feature request for that on Github :) |
09:36:33 | MrOrdinaire | I tried that but it didn't work |
09:36:40 | MrOrdinaire | I see |
09:37:03 | dom96 | ldlework: You could write a function that does it |
09:37:17 | ldlework | dom96: it seems like it should be a core converter, honestly... |
09:37:22 | dom96 | but that's a bit hackish |
09:38:30 | ldlework | dom96: is it because tuples are named in Nim? |
09:38:37 | ldlework | tuple fields anyway |
09:38:48 | dom96 | yeah |
09:39:57 | ldlework | dom96: seems like if you amended the compiler to support a right-hand side seq, you'd just unpack in order of the lexcial presentation of the variable names you're unpacking to? |
09:40:34 | ldlework | like "tuple unpacking disregards tuple field names too, so why can't seq's?" kind of thing |
09:40:45 | dom96 | I think seq/array unpacking should be possible |
09:41:00 | ldlework | okay no inherent technical reason |
09:42:43 | ldlework | dom96: have you found good uses for object variants? |
09:42:48 | ldlework | they seem interesting |
09:43:04 | dom96 | yeah, lot's of uses. |
09:43:13 | ldlework | neat |
09:43:17 | ldlework | I'll think more about them then |
09:43:23 | dom96 | They are better than using inheritance |
09:43:43 | ldlework | hmm I'm thinking there might be cases where you need inheritance |
09:44:00 | ldlework | like when methods are involved |
09:44:30 | ldlework | lets say there is some library for which there is a type |
09:44:40 | ldlework | well already you can see where this is going |
09:45:00 | MrOrdinaire | opened https://github.com/Araq/Nim/issues/1844 |
09:45:57 | dv- | MrOrdinaire: i wrote that too! https://github.com/dvolk/nbody.nim |
09:46:10 | MrOrdinaire | dv-: cool! |
09:46:57 | dv- | one version with vec tuples and one without |
09:47:28 | dom96 | ldlework: I've been using Nim for like 5 years now and I still have not used methods once! |
09:47:42 | MrOrdinaire | dv-: cool! |
09:47:47 | ldlework | dom96: I believe you but I still can't even really understand that |
09:48:03 | dom96 | I still don't get their purpose |
09:48:19 | ldlework | dom96: maybe you could help me understand how to implement some of the patterns I'm used to without inheritance |
09:48:19 | MrOrdinaire | dv-: I plan to reimplement problems in the benchmarks game (benchmarksgame.alioth.debian.org). I guess you are, too, right? |
09:48:27 | ldlework | dom96: I use them for code reuse |
09:48:31 | dom96 | ldlework: what patterns would those be? |
09:48:48 | * | VinceAddons joined #nim |
09:48:57 | dv- | MrOrdinaire: that's great. do they accept new languages? |
09:49:13 | MrOrdinaire | dv-: I guess we can try |
09:49:23 | ldlework | dom96: One pattern I use is to control my games with a "Scene Manager" which is essentially a state machine. Each state implements an update and draw method. So the main app loop just delegates the update and draw to the manager's current state |
09:49:23 | MrOrdinaire | dv-: This is my first time doing this |
09:49:40 | ldlework | dom96: by changing the current scene, you can change the behavior of your program, like main menu, gameplay, high score, etc |
09:49:55 | dom96 | MrOrdinaire: That's awesome! |
09:50:19 | ldlework | dom96: sometimes its nice to have some base methods on the base Scene class, so that subclasses are free to override them |
09:50:40 | ldlework | dom96: like, say the interface for a Scene is enter, update, draw, exit, but maybe you don't always need to implement enter and exit for your scene |
09:50:48 | ldlework | so Scene has base implementations that just do discard |
09:50:50 | MrOrdinaire | dom96: thanks |
09:51:13 | ldlework | so now any Scene you pass to the system, the system code can call manager.current_scene.enter(), even though that subclass didn't implement enter() |
09:51:16 | dom96 | ldlework: This is how I implemented my game: https://github.com/dom96/ld25/blob/master/main.nim |
09:51:20 | ldlework | dom96: I hope that's a sufficient explanation |
09:51:26 | dom96 | instead of that I seem to use overloading |
09:51:32 | ldlework | dom96: does it have anything to do with what I just described? |
09:51:45 | dom96 | I have a State type which is the state of the game world |
09:51:51 | ldlework | That's not what I mean |
09:52:01 | ldlework | I'm talking about State Machines, like Finite State Machine |
09:52:38 | dom96 | But you're still implementing the same thing I am |
09:52:43 | ldlework | Anyway if you read from the top of when I started describing it should make sense |
09:52:45 | Triplefox | i tend to implement scene transition type stuff with polling first, and only switch to a more complicated pattern as needed |
09:52:58 | ldlework | How is a type called "state" the same thing? Does your type act as a delegate? |
09:53:10 | Triplefox | if is_title: # draw title screen |
09:53:15 | Triplefox | or somesuch |
09:53:22 | ldlework | dom96: you're just using this type as the container for your game's data - that's not the same thing |
09:53:38 | dom96 | I'm not saying it's the same thing. |
09:53:45 | dom96 | I'm saying that we are both implementing games |
09:53:55 | dom96 | Which are the same types of software |
09:54:21 | dom96 | I also have a draw function in my code |
09:54:25 | dom96 | But I don't use methods for it |
09:54:33 | ldlework | dom96: your game only has one State, or Scene |
09:54:43 | ldlework | you don't transition from say, a Main Menu, to the Gameplay scene |
09:54:51 | dom96 | true |
09:54:52 | ldlework | So, while we're both making games, that's not saying much? |
09:55:07 | ldlework | So like, if you read from the top of my description you could understand what I'm describing |
09:55:07 | dom96 | At that point I would probably use object variants |
09:55:17 | ldlework | it isn't about variance in fields though |
09:55:24 | ldlework | I wish you would just read my words when offering to help lol |
09:55:33 | dom96 | case scene: Scene |
09:55:36 | dom96 | of MainMenu: ... |
09:55:40 | dom96 | of Gameplay: ... |
09:55:40 | dom96 | ? |
09:55:46 | ldlework | dom96: lets say I'm writing a game engine |
09:55:50 | dom96 | I did read them! |
09:55:51 | ldlework | so that you can write your game ontop of it |
09:56:08 | ldlework | I have a system, that will run a scene passed to the scene manager |
09:56:19 | ldlework | my scene manager can't know all the possible scene type variants that you will introduce |
09:56:25 | dom96 | And I know what you mean. I think for games inheritance may be advantageous. |
09:56:25 | ldlework | this is why dynamic dispatch is useful |
09:56:33 | ldlework | ah okay |
09:56:50 | dom96 | But I would like you to try and implement it without it ;) |
09:56:51 | ldlework | I think libraries in general, where the library is some sort of framework |
09:57:04 | dom96 | And see how it compares. |
09:57:08 | dom96 | Because I am curious. |
09:57:14 | ldlework | dom96: but like, I have no solution |
09:57:21 | ldlework | I've thought about it in other lanugages without inheritance |
09:57:36 | ldlework | maybe typeclasses, but what this loses |
09:57:37 | dom96 | ldlework: Could you create a simple piece of code which demonstrates why you need inheritance? |
09:57:44 | ldlework | I'll explain why |
09:57:52 | ldlework | lets say you replaced inheritance with typeclasses |
09:58:00 | dom96 | Because then I could have a go at translating it to not use inheritance |
09:58:04 | ldlework | so that the framework expects any kind of thing that adheres to the typeclass |
09:58:10 | Triplefox | i implement a new function when i need a new scene AND i'm going to reuse it |
09:58:26 | ldlework | 'implement a new function' doesn't really tell us anything? |
09:58:43 | Triplefox | the assumption i make is that that the default case is - new game, new rendering technique |
09:59:01 | ldlework | uh what? |
09:59:39 | ldlework | dom96: anyway, lets say instead of inheriteace my game engine uses typeclasses, so that games utilizing the game engine can craft scene's that adhere to the typeclass |
09:59:41 | ldlework | that would work |
09:59:45 | Triplefox | in that situation, there is nothing to be reused and "scene managing" doesn't work anymore as an abstraction |
09:59:48 | ldlework | but what you lose |
09:59:56 | ldlework | is the ability to not have to implement all parts of the interface |
10:00:03 | Araq | guys, it is well known that runtime polymorphism doesn't accomplish the same as compiletime polymorphism. |
10:00:03 | ldlework | with inheritance you get 'default implementations' |
10:00:16 | ldlework | dom96: does that make sense? |
10:00:22 | dom96 | ldlework: Could you please create a simple piece of code which demonstrates this? |
10:00:40 | ldlework | dom96: why is it so hard to just use language to communicate? :P |
10:00:54 | ldlework | with a typeclass, your user type must implement the whole interface |
10:01:07 | dom96 | ldlework: Because I am a programmer. Code is unambiguous and I prefer to communicate in unambigous languages :P |
10:01:08 | ldlework | with inheritance, you can implement a subset of the interface merely by overriding |
10:01:14 | ldlework | this is a convenience |
10:01:23 | ldlework | dom96: jsut read the last three lines I wrote |
10:01:26 | ldlework | literally all you need to know |
10:02:08 | ldlework | also hi Araq |
10:02:33 | ldlework | dom96: I'll try to write a minimal thing |
10:05:15 | dom96 | ldlework: thanks |
10:05:20 | dom96 | Araq: Thoughts on this? http://forum.nimrod-lang.org/t/701 |
10:05:48 | dom96 | My plan is to create a distinct type, define [] for it and a converter to preserve the old behaviour. |
10:08:45 | tane | hello, i have a problem understanding when exactly a converter is called: https://gist.github.com/anonymous/95a49045032cd1700c69 |
10:09:08 | tane | in (B) it doesn't work, even though the type of the seq should be known, so i don't get it :) |
10:09:49 | Araq | dom96: I'd concat the field values like this instead key: "value A" "value B" "value C" |
10:10:19 | Araq | if I read the http spec correctly this is unambiguous |
10:10:38 | Araq | but I know nobody will agree with me here. |
10:10:41 | dom96 | that's not convenient |
10:10:46 | * | tgkokk joined #nim |
10:10:47 | dom96 | and it would break code |
10:10:56 | Araq | it is. it fixes the stupid HTTP spec |
10:11:14 | Araq | which uses key-value pairs for something that is clearly not a list of key-value pairs |
10:11:15 | dom96 | I'd have to parse out the quotes |
10:12:07 | dom96 | With my idea you won't have to worry about this until you do get multiple same-name headers |
10:12:43 | novist | hey Araq. got time to elaborate on grammar maybe? why it isnt bnf and cant be? |
10:14:24 | Araq | tane: report it. |
10:14:42 | tane | so (B) should work? |
10:14:57 | * | Ven joined #nim |
10:15:25 | MrOrdinaire | does anyone know what `nim c -d:release <filename>` does? how does it differ from `nim c --opt=speed <filename>`? |
10:15:38 | Araq | tane: yes and what's worse: if the compiler doesn't invoke toSeries it should fail at compiletime |
10:15:53 | tane | alright, where do those reports belong, github issue page? |
10:16:11 | Araq | MrOrdinaire: the default config file defines what -d:release means, you can read it there |
10:17:20 | Araq | novist: the way we do indentation based parsing doesn't work with BNF and we didn't want to copy how Python does it because we like multi-line lambdas |
10:18:07 | MrOrdinaire | Araq: thanks |
10:18:31 | Araq | also I like the "ordered choice" operator from PEGs, and that's not available for BNF |
10:19:01 | novist | so what kind of grammar is this? i wonder if there are any tools which could generate lexer/parser that i could plug easily into intellij |
10:19:27 | novist | oh i guess its "PEG" heh |
10:19:42 | Araq | no, it's not PEG either, unfortunately |
10:20:41 | novist | so.. are you saying its some kind of customized thing with no readily available tools for it? |
10:20:52 | Araq | I'm afraid your best option is to translate Nim's parser to Java. |
10:20:59 | Araq | yes. that's what I'm saying. |
10:21:35 | novist | bummer.. |
10:21:47 | MrOrdinaire | Araq: for this piece of code, https://gist.github.com/anonymous/6695430e833c5ddae081, is the range checker too restrictive? |
10:22:23 | MrOrdinaire | bodies is an array[0..4, Body] |
10:22:57 | novist | or maybe compiler itself could be somehow leveraged to do these tasks and provide relevant data for plugin consumption? |
10:23:21 | Araq | novist: that's what idetools does. yes |
10:23:53 | novist | can it dump like AST? my biggest concern atm is how to achieve syntax highlighting. |
10:24:46 | Araq | novist: syntax hihlighting only needs a lexer |
10:25:16 | novist | that means grammar though, no? |
10:25:22 | Araq | but we can give you the AST as json |
10:25:59 | dv- | MrOrdinaire: i think for i=4 you're looking at the slice j=5..4 |
10:26:31 | Araq | MrOrdinaire: report it, I think it's a bug |
10:27:36 | MrOrdinaire | Araq: will do |
10:27:53 | MrOrdinaire | dv-: That's what I thought, too |
10:28:26 | * | nimnoob123 joined #nim |
10:28:42 | * | Demon_Fox quit (Quit: Leaving) |
10:28:47 | ldlework | Why invalid indentation? https://gist.github.com/dustinlacewell/47eb156080942e0459aa |
10:28:49 | Araq | novist: a lexer doesn't need the full grammar, only the part of it concerned with lexing |
10:28:49 | ldlework | last line |
10:29:07 | dv- | MrOrdinaire: so you should be using something like ... while j <= 4: ... |
10:29:21 | nimnoob123 | Hey it's 4am and I'm still learning the basics and wondering if someone could help me understand something regarding methods http://www.reddit.com/r/learnprogramming/comments/2r70fb/nimnimrod_how_exactly_do_you_call_an_object/ |
10:29:30 | novist | sorry im rather clueless about this. reading some stuff now.. so lexer produces list of tokens and parser puts those tokens into AST right? |
10:29:34 | ldlework | oh nm |
10:29:38 | MrOrdinaire | dv-: turn off the rangeChecks and it'll work flawlessly ;) |
10:31:12 | dv- | you get the right result? |
10:31:45 | Araq | ldlework: works for me |
10:31:54 | ldlework | Araq: looking at wrong file |
10:32:06 | nimnoob123 | feels like i've missed something so simple in the docs |
10:32:12 | ldlework | What's the exception raised for interruption in ^C |
10:32:44 | novist | im thinking maybe for syntax highlighting it would suffice to put together minor "fake" grammar that could just differentiate between keywords, strings and some other stuff. idetools should provide rest of feedback like syntax errors and what not. that right? |
10:33:27 | Araq | novist: that is exactly how every other editor does it |
10:33:54 | novist | sounds like a plan then. thanks for help ^_^ |
10:33:57 | ldlework | Araq: can you catch SIGINT? |
10:34:00 | * | Matthias247 joined #nim |
10:34:21 | Araq | ldlework: yeah system/excpt.nim shows how to do that |
10:34:35 | ldlework | thanks |
10:35:07 | Araq | nimnoob123: you need to delcare startWalking before move. (yeah yeah I know, I know, it's technology from the 60ies) |
10:36:01 | ldlework | Araq: define "signalHandler"?d |
10:36:26 | nimnoob123 | Araq: ah hmm, so hmm will it always be like that? because im assuming i'd have to carefully order each method based on how i'd call them? |
10:36:47 | Araq | no, but I don't plan to work on this before 1.0 is out. |
10:36:56 | ldlework | maybe "c_singal" |
10:37:35 | nimnoob123 | Araq: alright, thanks for the help |
10:37:45 | Araq | nimnoob123: IMO that the order reflects your call graph is a nice feature |
10:37:52 | Araq | but not many agree with me |
10:38:26 | MrOrdinaire | dv-: I do |
10:38:52 | * | jefus__ joined #nim |
10:39:45 | * | Ven left #nim ("Textual IRC Client: www.textualapp.com") |
10:40:39 | nimnoob123 | yeah I think it would get a bit difficult to organize if objects become too large |
10:41:08 | ldlework | Araq: I can't import c_signal from system/ansi_c |
10:41:13 | nimnoob123 | became* |
10:42:18 | * | jefus_ quit (Ping timeout: 250 seconds) |
10:42:22 | Araq | ldlework: system/ansi_c is not for your consumption, but perhaps you can 'include' it |
10:42:38 | ldlework | Araq: is there a higher level mechanism for trapping signals? |
10:43:10 | Araq | I pretend they don't exist. |
10:43:28 | Araq | it's such a hack. |
10:44:23 | Araq | like symlinks and 'fork' |
10:44:30 | * | ldlework sighs |
10:44:35 | ldlework | lol |
10:45:24 | Araq | does your signal handler even run on the same thread? who knows |
10:47:20 | Araq | ldlework: there is system.setControlCHook() |
10:49:56 | Araq | dom96: just use some dedicated data structure instead of StringTableRef and don't bother with the converter |
10:51:40 | dom96 | Araq: why? |
10:51:51 | dom96 | I don't want to break code |
10:52:02 | Araq | because everybody says "screw backwards compatibility" |
10:52:21 | * | goobles_ joined #nim |
10:53:41 | dom96 | well I don't, and I probably use httpclient the most ;) |
10:53:58 | dom96 | And I don't wanna have to write [0] every time. |
10:54:12 | goobles_ | whoa |
10:54:16 | Araq | oh yeah, that's a good point |
10:54:23 | * | MrOrdinaire quit () |
10:54:54 | Araq | but you don't have to do that with a dedicated data structure |
10:55:00 | Araq | speaking of which |
10:55:15 | * | yglukhov__ quit (Quit: Be back later ...) |
10:55:25 | Araq | is the order of these "key value" pairs perhaps relevant in other ways? |
10:55:26 | dom96 | I do. |
10:55:41 | dom96 | headers["Set-Cookie"] will return a seq[string] |
10:55:47 | goobles_ | he said i do |
10:56:12 | dom96 | I want it to return a string |
10:56:27 | dom96 | unless you write headers["Set-cookie"][1] |
10:56:49 | Araq | maybe if do KeyA: valueA; keyB 'keyB' is also allowed to have different semantics depending on 'KeyA's existance? |
10:57:22 | dom96 | huh? |
10:57:34 | ldlework | dom96: https://gist.github.com/dustinlacewell/df3e99a630ff173563aa |
10:57:38 | ldlework | dom96: read lib.nim first |
10:57:56 | Araq | hi goobles_ welcome |
10:58:03 | Araq | back |
10:58:14 | ldlework | dom96: if you can reimplement this same library without inheritance, with all the same benefits and to the end user I'll be very interested |
10:59:01 | ldlework | dom96: its important to note the erogronomics the end user enjoys right now to quickly get their 'game' (parser in this case) going and integrated into the larger system |
10:59:50 | goobles_ | nim is very vertical |
10:59:52 | * | minciue joined #nim |
11:01:20 | ldlework | I think if I could provide default implementations on typeclasses.... that might obviate the need for inheritance here |
11:02:00 | goobles_ | yeah for typeclasses! |
11:02:05 | ldlework | sort of like default impelmentations on Rust traits that they have decided is too complicated to implement |
11:02:10 | * | BitPuffin joined #nim |
11:03:07 | * | repax joined #nim |
11:03:47 | ldlework | that's kind of wierd though |
11:04:10 | ldlework | you make a type, and accidentally implement some typeclass with a default implementation of some proc and suddenly your type has an implementation you didn't expect |
11:04:15 | ldlework | but.. that could also be pretty neat |
11:04:37 | ekarlso- | yay, package registry for nim up and running ! :) |
11:04:59 | ldlework | dom96: ping me if you take a look |
11:05:26 | ekarlso- | can now get / register packages at least |
11:06:55 | * | BitPuffin quit (Ping timeout: 256 seconds) |
11:10:20 | tane | Araq, i noticed another converter was hooked into the game, leading to the following behaviour, that might be intended: |
11:10:25 | tane | Given two types A and B, having procs f(A,A) and f(B,B) and converters for A->B and B->A. Call f(a,b) is converted to f(a->b, b) without warning that f(a, b->a) could've been possible as well. |
11:10:57 | tane | if this is still report-worthy, i'll report it |
11:15:37 | dom96 | ldlework: I think rewriting this to use object variants is possible, that said it would probably end up resulting in more code and there wouldn't be any real benefits. |
11:18:44 | repax | I've spent some time renaming sdl2 types and procs to the new naming convention. I'm sure somebody else has already done this though. |
11:20:26 | ldlework | dom96: I wonder how you'd do it but ok |
11:20:34 | ldlework | dom96: thanks for looking it over |
11:20:41 | def- | is there a reason that `$` is not implemented for arrays btw? |
11:21:07 | * | Jesin quit (Ping timeout: 245 seconds) |
11:21:38 | def- | repax: best make a pull request then, so no one else will have to do it again |
11:21:40 | * | superfunc|home quit (Ping timeout: 246 seconds) |
11:23:08 | repax | def-: you're right. I'll do that when I've finished up |
11:28:33 | * | yglukhov__ joined #nim |
11:31:44 | reactormonk | lib/system.nim(478, 12) Error: invalid pragma: deprecated: <- current master |
11:31:48 | reactormonk | ... whut' |
11:32:32 | * | Var|Mobile joined #nim |
11:34:08 | * | Jesin joined #nim |
11:34:13 | reactormonk | I'm not exactly sure if this can be reproduced. I'm pulling on [email protected]:Araq/Nimrod.git branch master - did I miss a branch change again? |
11:35:49 | * | Jesin quit (Max SendQ exceeded) |
11:36:52 | * | Jesin joined #nim |
11:38:08 | ekarlso- | so, mysql doesn't work on osx either ? |
11:38:11 | ekarlso- | booo |
11:38:35 | * | Jesin quit (Max SendQ exceeded) |
11:40:29 | * | Jesin joined #nim |
11:41:23 | reactormonk | the line isn't any new, so why does it pop up now |
11:41:42 | reactormonk | ah, I'm using "nimrod" binary |
11:43:20 | ekarlso- | could not load: libmysqlclient.so.15 |
11:49:19 | * | goobles_ quit (Ping timeout: 246 seconds) |
11:49:19 | * | goobles quit (Ping timeout: 246 seconds) |
11:50:45 | reactormonk | ekarlso-, which libmysqlclient do you have? |
11:51:50 | reactormonk | ekarlso-, https://github.com/Araq/Nim/pull/1835 |
11:51:53 | repax | ekarlso-, is the library located in /usr/lib or does it have a symlink there |
11:51:56 | repax | ? |
11:52:04 | * | gokr_ quit (Ping timeout: 250 seconds) |
11:52:17 | reactormonk | ekarlso-, ... could you test that change and report if it works for you? |
11:54:08 | * | filippo joined #nim |
11:54:26 | repax | nevermind, I was thinking of dylibs |
11:55:02 | filippo | hi all, i'm writing some doc and using the nim rst2html command. Is there a way to include an external file inside a codeblock? |
11:55:09 | * | filippo is now known as filcuc |
11:58:44 | * | gokr_ joined #nim |
11:59:54 | * | gokr joined #nim |
12:02:17 | filcuc | solved by using the ::include directive |
12:02:44 | * | ARCADIVS quit (Quit: ARCADIVS) |
12:03:09 | * | gokr_ quit (Ping timeout: 245 seconds) |
12:09:41 | * | gour_ joined #nim |
12:10:49 | * | kapil__ joined #nim |
12:12:23 | * | gour quit (Ping timeout: 240 seconds) |
12:18:38 | * | tgkokk quit (Ping timeout: 244 seconds) |
12:22:19 | * | repax quit (Quit: repax) |
12:22:59 | ekarlso- | Araq: can u get that patch in for libmysqlclient ? :p |
12:23:13 | ekarlso- | also |
12:23:21 | ekarlso- | libmysqlclient.18.dylib |
12:23:24 | ekarlso- | vs .so |
12:23:26 | ekarlso- | on osx |
12:23:43 | def- | ekarlso-: but with libmysqlclient.18.dylib it works? |
12:25:10 | * | gour_ is now known as gour |
12:26:16 | ekarlso- | def-: how u mean ? :) |
12:26:50 | def- | ekarlso-: did you try manually adding libmysqlclient.18.dylib in your copy of the standard library? |
12:28:10 | ekarlso- | trying now def- :) |
12:28:24 | ekarlso- | def-: is it possible to do like when defined(OSX) or smth? |
12:28:33 | def- | yes, "elif defined(macosx):" |
12:28:56 | ekarlso- | so, that fixed it |
12:29:05 | def- | great, i'll add it to my pull request |
12:29:29 | ekarlso- | def-: should probably be sept pull req no ? |
12:29:36 | ekarlso- | since it needs to be specific for osx.. |
12:29:47 | def- | don't think it will be a problem |
12:30:37 | ekarlso- | i'll send one too def- |
12:30:39 | ekarlso- | for osx |
12:30:43 | def- | ekarlso-: also works with libmysqlclient.dylib? |
12:30:44 | def- | ok |
12:31:57 | def- | there are a few other wrappers without macosx support yet |
12:32:32 | * | irrequietus joined #nim |
12:37:30 | ekarlso- | hmmm |
12:37:40 | ekarlso- | maybe we need to split it up |
12:38:40 | * | EXetoC quit (Quit: WeeChat 1.0.1) |
12:51:11 | Araq | def-: the only place where the bug can be hiding is this line: |
12:51:18 | reactormonk | ekarlso-, nah, just add the metnioned elif |
12:51:23 | Araq | if c.count[0] < (len shl 3): c.count[1] = c.count[1] +% 1'i32 |
12:51:34 | Araq | line 179 |
12:51:38 | def- | Araq: yes, added a ze64 around c.count[0] |
12:51:47 | Araq | replace the < with <% and it should work |
12:51:50 | def- | ah right |
12:52:29 | Araq | this code predates the additions of unsigned integers to Nim btw |
12:52:35 | def- | i notice |
12:52:37 | * | foxcub_ joined #nim |
12:53:05 | def- | should be changed to unsigneds? |
12:53:18 | Araq | sure |
12:53:51 | def- | nope, still doesn't work |
12:54:01 | Araq | that's weird |
12:54:05 | foxcub_ | Hi |
12:54:12 | def- | <% had the same effect as ze64, only works up to 512 MB now |
12:54:31 | foxcub_ | I just filed an issue: https://github.com/Araq/Nim/issues/1846 |
12:54:42 | foxcub_ | Did something change in the language or is the problem known, by chance? |
12:54:56 | Araq | we should try to get it to work before switching to unsigned |
12:56:28 | def- | hm, i thought the bug might disappear by switching to unsigned |
12:57:28 | Araq | ok, try that then |
12:57:41 | Araq | but it should work with these +% ops everywhere too |
12:57:57 | Araq | otherwise there is some codegen bug lurking in them |
12:58:18 | * | gokr_ joined #nim |
12:58:41 | Araq | foxcub_: I can imagine why it fails now. add {.nimcall.} to the TBinOp and see if it changes things |
12:59:26 | foxcub_ | Yup, that did it. |
12:59:35 | foxcub_ | Is that by design or a bug? |
12:59:41 | Araq | a bug |
13:00:17 | Araq | it's a nice regression, the same fix enabled other code to work |
13:00:26 | foxcub_ | Ah, Ok. |
13:00:33 | foxcub_ | Well, solves my immediate problem. So thanks. |
13:00:42 | foxcub_ | Hopefully, the compiler stabilizes soon. |
13:01:29 | * | gokr quit (Ping timeout: 245 seconds) |
13:02:35 | Araq | yeah eventually most bugs have about 5 root causes that people stumble upon over and over |
13:04:30 | reactormonk | Araq, why would nimcall work here? |
13:04:52 | reactormonk | (it does) |
13:05:14 | foxcub_ | Completely unrelated question: has anybody thought about transactional memory to Nim? |
13:05:38 | Araq | reactormonk: the default is .closure and that's now done for generic instantiations too but there is some LL bug so that the conversion from .nimcall to .closure produces wrong C code |
13:05:49 | foxcub_ | *about adding TM to Nim |
13:06:17 | Araq | foxcub_: I blogged about it once |
13:06:18 | reactormonk | Araq, kk |
13:06:29 | foxcub_ | Link? |
13:07:28 | Araq | foxcub_: don't read it, I'm not sure I agree with myself anymore, it's old. |
13:07:35 | foxcub_ | ;-) |
13:07:42 | * | z1y joined #nim |
13:07:49 | foxcub_ | What’s the new thinking? |
13:08:01 | Araq | however, I argued that TM doesn't solve the hard problems |
13:08:46 | foxcub_ | What are the hard problems in your view that it doesn’t solve? |
13:09:39 | Araq | that you access some location without protection aka data race, or more broadly "race condition" |
13:10:26 | foxcub_ | Isn’t that orthogonal to TM? |
13:10:54 | def- | Araq: ok, working immediately with uint32 and muuuuuch more performant |
13:11:41 | Araq | def-: now that is strange given that clang's immediate representation is close to these +% ops |
13:11:59 | def- | i'm using gcc |
13:12:07 | def- | oh wait |
13:12:10 | def- | misunderstood you |
13:12:43 | Araq | foxcub_: exactly. TM doesn't even address these problems. it solves some other problems. |
13:12:49 | * | jefus__ is now known as jefus |
13:13:07 | def- | maybe i just accidentally didn't compile with -d:release before |
13:13:21 | reactormonk | def-, that's an insane different ^^ |
13:13:35 | foxcub_ | It solves the crucial problem of the level at which to reason about concurrency. (I.e., what constitutes an atomic operation.) That’s huge from the point of view of algorithm design. |
13:14:03 | foxcub_ | And it seems its ease of use is tightly coupled with language design, where Nim shines. |
13:14:27 | Araq | foxcub_: so what problem DOES it solve? |
13:14:31 | foxcub_ | Do you think TM could be implemented using what’s already there (macros and some external C TM libraries)? |
13:14:40 | foxcub_ | The level of abstraction. |
13:15:12 | Araq | that is not an answer |
13:15:16 | foxcub_ | I think one difficult part about parallel programming is that we (humans) don’t like to reason about concurrency at the level of assembly code. |
13:15:39 | foxcub_ | TM lets one reason about it at the level of code blocks (of the higher language). |
13:16:18 | foxcub_ | I suspect there are a ton of places where one could find opportunistic parallelism, if one could only easily express what can and cannot be done in parallel. |
13:17:03 | foxcub_ | TM greatly helps with such expression. |
13:17:52 | Araq | TM only allows for slightly more expressive code in comparison to locks+lock levels which is what we (will) provide |
13:18:07 | Araq | both address the deadlocking problems |
13:18:11 | foxcub_ | I don’t know about slightly. |
13:18:33 | foxcub_ | TM lets one not modify existing data structures. |
13:18:45 | foxcub_ | It keeps track of the affected addresses for you. That’s not so easy to express with locks. |
13:18:57 | Araq | it is |
13:19:23 | foxcub_ | How? |
13:19:47 | Araq | you can use the "single global lock" |
13:19:53 | foxcub_ | lol |
13:19:57 | foxcub_ | Fair enough |
13:20:02 | Matthias247 | imho the only problem that transactional memory solves is not having to care about locking order |
13:20:34 | Matthias247 | but instead you have the limitation that it doesn't work with anything that has sideeffects (IO) |
13:20:57 | foxcub_ | Wait, maybe I’m missing something. |
13:21:01 | foxcub_ | Let’s make it concrete. |
13:21:11 | foxcub_ | Imagine I have a data structure. A k-ary tree or something like that. |
13:21:22 | foxcub_ | I’d like to be able to insert nodes wherever I please into it. |
13:21:53 | foxcub_ | If you want to allow this with locks, either you need one global lock, getting no parallelization; or you have to add locks to individual nodes. |
13:22:09 | * | kniteli quit (Read error: Connection reset by peer) |
13:22:09 | foxcub_ | With TM you don’t modify the data structure. |
13:22:28 | foxcub_ | It just keeps track of the affected addresses, and as long as they don’t conflict, it lets you do things in parallel. |
13:23:00 | foxcub_ | You could of course simulate that with locks be keeping track of the affected addresses yourself, but that’s really going back to TM, just in some specific form. |
13:23:18 | def- | md5 should work now: https://github.com/Araq/Nim/pull/1847 |
13:23:24 | Matthias247 | the implementations of transactional memory will do nothing else than modifying the structure with atomic operations |
13:23:29 | Araq | foxcub_: TM also doesn't address GC efficiency at all. TM simply doesn't help with any of the problems that we have in practice as it doesn't even address them. |
13:23:58 | foxcub_ | I’m afraid I know little about GC. |
13:24:27 | foxcub_ | I do disagree with your second sentence, if it’s meant in general, and not regarding GC specifically. |
13:24:38 | * | dyu joined #nim |
13:24:44 | foxcub_ | All I can say is that as a programmer, TM is very attractive. |
13:25:09 | minciue | hi everyone |
13:25:44 | minciue | is there any particular reason why nim c -o:”test” src/test.nim outputs to src/test ? |
13:25:52 | minciue | as opposed to just test in the current directory? |
13:26:09 | foxcub_ | Matthias247: they will also keep track of conflicts, with little effort required from the programmer. That’s quite huge. |
13:26:45 | foxcub_ | The k-ary tree example is a very simple data structure, there are much more complicated scenarios. |
13:27:21 | Araq | foxcub_: the single lock works well once Intel got hardware transactional memory to work reliably |
13:27:47 | foxcub_ | You are talking about automatic lock elision? |
13:27:48 | Matthias247 | foxcub_: I did lots of concurrent programming the last years. And from all things in the "7 concurrency models in 7 weeks" book I think STM is the one that I would miss at least |
13:28:21 | Araq | and locks are much easier to reason about as you don't have to think about transaction rollbacks |
13:28:24 | foxcub_ | Well, it’s difficult for me to miss TM, since I’ve never had real access to it. |
13:29:16 | * | Trustable joined #nim |
13:29:17 | foxcub_ | Why do you have to think about transaction rollbacks? |
13:29:44 | Matthias247 | afaik what clojure is doing with STM is more or less a transformation to atomic CAS and repeat that until success operations |
13:30:19 | gokr_ | sidenote: Gemstone has so called "reduced conflict" classes, that are structures with defined concurrent semantics. |
13:30:27 | Matthias247 | which works only for immutable types and side-effect free operations |
13:31:08 | gokr_ | Like say an rccounter that has inc/dec ops that are conflict free |
13:31:57 | foxcub_ | Alright, I did not mean to derail whatever conversation was happening. |
13:32:16 | foxcub_ | I was mostly curious if anybody has thought about tying some C STM library into Nim. |
13:32:27 | foxcub_ | It sounds like people have thought about it, but there is little interest. |
13:32:53 | Araq | foxcub_: I looked at these libraries years ago. they were not usable to me |
13:33:02 | foxcub_ | Araq: got you |
13:33:34 | Araq | foxcub_: for more complex scenarios you can get livelocks with TM |
13:33:50 | Araq | these are much worse than deadlocks |
13:34:03 | Araq | in my humble opinion |
13:35:00 | foxcub_ | I agree with that. I don’t think any programming language technique can obviate the need for algorithm design. But it can make the life of a programmer easier. |
13:35:28 | foxcub_ | (I think the heart of our disagreement is whether TM can do the latter.) |
13:35:47 | Araq | foxcub_: look at the new .locks and .guard pragmas. These address existing problems at least. :P |
13:36:00 | foxcub_ | Araq: Thanks. I shall. |
13:37:01 | foxcub_ | Oh, yet another unrelated question. |
13:37:17 | foxcub_ | Is there any work (planned or ongoing) about importing C++ templates as Nim generics? |
13:37:26 | filcuc | mm i'm still having issue. Is there someone who knows if is possible to included a file in a code-block in an rst file? |
13:37:35 | reactormonk | foxcub_, C++ templates are a bit too complex I'd say |
13:37:54 | reactormonk | and without having looked at them, I'd say the semantic differences are gonna give you a headache |
13:38:13 | foxcub_ | reactormonk: well, how about some restriction of them? |
13:38:30 | foxcub_ | I mean, things like std::vector<T> could be easiy mapped into a vector[T], manually. |
13:38:51 | foxcub_ | No, “manually” is not what I mean there. |
13:38:51 | reactormonk | yup, pretty much gotta do it manually. |
13:39:08 | foxcub_ | Well, that’s the problem. I’m not sure how I could do it manually. |
13:39:17 | reactormonk | no C api? |
13:39:41 | foxcub_ | For a type that’s not fixed? No. |
13:40:00 | foxcub_ | There couldn’t be one. C doesn’t have the concept. |
13:40:27 | foxcub_ | Sure, once you fix T, you could create a C api, but that’s not what I’m after. |
13:40:34 | reactormonk | foxcub_, well, for starters, you'd need to use the g++ instead of gcc |
13:40:57 | reactormonk | which reminds me, there is an importcpp |
13:40:58 | Araq | foxcub_: I'm working on these things as part of my day job now. |
13:41:08 | foxcub_ | Araq: oh, great! |
13:41:18 | foxcub_ | What’s your day job now? |
13:41:41 | foxcub_ | Also, are you planning these for 1.0, or is this a longer time-horizon? |
13:41:49 | reactormonk | foxcub_, well, yeah. {.importcpp "...".} on a proc and you should have at least the functions. Not sure how to mess with the generics. |
13:42:14 | Araq | filcuc: quite sure this is possible |
13:42:19 | foxcub_ | reactormonk: I’ve noticed importcpp, but that seems to deal with just OOP call semantics. Nothing to do with generics. |
13:43:07 | reactormonk | foxcub_, s/semantics/syntax/ and, yes you're correct. No generics. |
13:43:57 | filcuc | Araq: i can include a file with include but not inside a codeblock |
13:44:01 | * | renesac|away joined #nim |
13:44:02 | * | renesac|away is now known as renesac |
13:44:09 | reactormonk | filcuc, yup, include is file-level. |
13:44:48 | filcuc | :( mh so reactormonk mean that i cannot be nested? |
13:44:56 | filcuc | that it cannot be nested? |
13:44:58 | reactormonk | filcuc, what do you want to do? |
13:45:11 | Araq | ## .. code-block:: nim |
13:45:12 | Araq | ## :file: someinclude.nim |
13:45:18 | filcuc | include a source file in a rst doc |
13:45:24 | Araq | or something like that |
13:45:27 | filcuc | for showing and example |
13:45:28 | reactormonk | filcuc, ah, rst. oops. |
13:46:16 | filcuc | i thought that someone already had this need given that rst is used by most of nim doc |
13:46:20 | Araq | filcuc: pegs.nim uses RST's include |
13:46:39 | filcuc | Araq: thank i give it a look |
13:49:53 | foxcub_ | Ok, one more question, and I stop pestering you. |
13:50:13 | foxcub_ | Is there a standard (or any way) to create Python modules using Nim? |
13:50:18 | reactormonk | foxcub_, you can keep asking questions, we choose not to answer if we deem you pestering ;-) |
13:50:29 | foxcub_ | reactormonk: I like this attitude. :-) |
13:50:54 | reactormonk | foxcub_, you could mess with the C api of python, but not directly, no. There might be a project on github |
13:51:14 | foxcub_ | reactormonk: Is there a link to this potential project? |
13:51:30 | renesac | araq was going to write a blog post about that... |
13:51:36 | renesac | sometime |
13:51:37 | reactormonk | foxcub_, apparently not. |
13:51:50 | foxcub_ | Actually, how does one create a shared lib using Nim? |
13:53:07 | def- | foxcub_: i made a small example here: http://rosettacode.org/wiki/Call_a_function_in_a_shared_library#Nimrod |
13:53:16 | reactormonk | def-, wrong way round? |
13:53:20 | def- | oh, right^ |
13:53:34 | def- | i think I have it the other way around somewhere |
13:54:02 | reactormonk | foxcub_, there's exportc and you compile the C code with nim... |
13:54:04 | foxcub_ | —app:lib is the secret? |
13:54:07 | foxcub_ | with exportc |
13:54:08 | def- | foxcub_: yes |
13:54:27 | def- | reactormonk: right way around is right below! |
13:54:29 | reactormonk | def-, btw, gotta edit that one too |
13:54:50 | def- | nimrod -> nim or why? |
13:54:57 | def- | did i forget something with the GC? |
13:55:08 | foxcub_ | Ok, great. This gives me the idea. Basically, one could expose Python C api using the first way, and then create modules using the second way. |
13:55:26 | foxcub_ | And probably with a little macro magic one could even make it feel elegant. |
13:55:32 | reactormonk | foxcub_, pretty much. |
13:55:53 | def- | I need to write a script to rename nimrod -> nim everywhere on Rosetta Code |
13:56:12 | reactormonk | I'd say mediawiki might be hairy |
13:56:25 | Araq | argh ... so many PRs |
13:59:31 | reactormonk | def-, the libmysqlclient is probably safe. |
13:59:58 | def- | reactormonk: I'm wondering about the proper style to choose a library version |
14:00:17 | def- | i guess it should be (|.18|.17|.16|.15) instead |
14:00:19 | * | renesac quit (Ping timeout: 256 seconds) |
14:00:36 | reactormonk | def-, how so |
14:00:37 | def- | but it's not consistent among all the wrappers |
14:01:02 | def- | reactormonk: if you have libmysqlclient.so, that is chosen first, otherwise the highest lib first, then the lower ones |
14:01:26 | novist | is idetools broken or something? |
14:01:30 | reactormonk | novist, probably |
14:01:46 | novist | cant get it to tell me anything heh |
14:01:46 | * | Dispatch joined #nim |
14:02:15 | def- | novist: Araq is pulling it out into a separate program currently I think |
14:03:05 | novist | i see |
14:03:18 | Araq | novist: I thought about it, and I think you can use PEGs to parse Nim completely, but it depends on how you can embed actions in the PEG parser generator |
14:04:23 | novist | i got tiny something working with only lexer now. https://paste2box.com/6/#/YZnWGQ/n4uwlUeXTGiANFnbUwy_hb5upny8JrkePxoBsuUEw3Y/gbk9HmQZ.jpg |
14:05:00 | novist | ofc full parser would be much better as it would instantly provide syntax error feedback and stuff |
14:05:29 | * | repax joined #nim |
14:05:51 | reactormonk | ah, intellij |
14:05:54 | novist | that grammar in docs/grammar.txt isnt exactly full/latest i guess? |
14:06:21 | flaviu | I don't understand why Araq said that BNF can't capture Nim's grammer |
14:06:26 | Araq | it cuts some corners and it more complex than it needs to be at the same time |
14:06:52 | reactormonk | Araq, btw, how about s-expressions or json for idetools? |
14:07:12 | flaviu | Araq: Nim is context free, right? If so, BNF can represent it. |
14:07:43 | Araq | how do you represent the indentation stack in BNF? |
14:07:56 | Araq | Python does it by hiding it in the lexer |
14:08:06 | Araq | the cost is that you cannot have multiline lambdas |
14:08:45 | repax | by explosion of states |
14:08:51 | flaviu | Can't you just treat an indent and dedent as a token? |
14:09:19 | Araq | repax: fair enough, that might work |
14:11:30 | Araq | novist: parser doesn't help really. then you need a type checker. |
14:11:35 | repax | flaviu, that's an interesting idea |
14:11:37 | reactormonk | Araq, ah, TIL why you can't have multiline lambdas |
14:12:03 | Araq | and then you essentially re-implement the full Nim compiler ... |
14:12:07 | novist | i suppose idetools could provide typechecking no? |
14:12:22 | Araq | so asking the compiler is the only sane way to do it |
14:12:45 | repax | indeed! |
14:12:48 | Araq | flaviu: that's what Python does. |
14:13:18 | novist | nim's lexer/parser is hand-crafted? |
14:13:33 | Araq | yeah "crafted" |
14:13:40 | Araq | (as if it's hard) |
14:13:53 | novist | its easy once you know how :p |
14:16:45 | Araq | "csources/build.sh: using "uname -m" for ARCH detection is a _BAD thing when a 64bit kernel runs a 32bit userspace. It is better to detect ARCH of the gcc compiler" |
14:19:48 | Araq | is that really better? what if gcc is not installed but clang? |
14:20:24 | * | willwillson joined #nim |
14:20:26 | * | Trustable quit (Quit: Leaving) |
14:20:44 | def- | Araq: both ways sound wrong |
14:20:51 | def- | but I'm not sure what's best |
14:22:39 | def- | maybe getconf LONG_BIT |
14:22:54 | def- | but that's only 64/32 bit |
14:23:24 | * | azynheira joined #nim |
14:25:39 | foxcub_ | How do I tell nim, where to look for the headers specified in the header pragma? I.e., how do I pass -I down to the C compiler? |
14:25:54 | flaviu | foxcub_: --passC: |
14:26:08 | flaviu | http://nim-lang.org/nimc.html |
14:27:04 | foxcub_ | flaviu: Thanks! |
14:27:08 | Araq | how is "uname -m" bad for arch detection anyway. 'uname' was made for this. |
14:28:00 | def- | but it's the architecture of the kernel, right? |
14:28:08 | def- | you could be running a 32bit chroot inside |
14:28:58 | Araq | so uname runs as a 32bit app then and should report that |
14:29:13 | * | z1y quit (Ping timeout: 256 seconds) |
14:31:01 | Araq | why would anybody be interested in the kernel's "real arch" when it effectively runs some form of virtual machine |
14:31:32 | def- | never tried, but some people report that it reports x86_64 in a x86 chroot |
14:31:41 | def- | (and some people report the opposite) |
14:32:10 | def- | https://lists.debian.org/debian-glibc/2006/04/msg00033.html |
14:32:46 | * | azynheira quit (Quit: Leaving) |
14:33:14 | willwillson | anyone know how `macros.typ` should work? Here is my problem: https://gist.github.com/anonymous/63ced7bce08dbe1298ba |
14:34:45 | Araq | willwillson: this is a bug that also affects other things, so consider it reported |
14:34:53 | willwillson | Araq: ok, thanks |
14:35:00 | * | BitPuffin joined #nim |
14:36:31 | def- | Araq: I think using "uname -m" is fine. if it's a problem you can use "setarch linux32". most other build systems seem to behave in the same way |
14:41:15 | repax | I have the following: `template foo*(int) = discard` in order to ignore calls to `foo(int)`. Is it possible to have it match all overloaded variants of `foo` as well? E.g. `template foo*(discard) = discard` |
14:45:44 | repax | Nevermind, it would probably bee ugly to match more than you implement. |
14:45:51 | repax | be* |
14:48:02 | Araq | repax: you can try a TR template |
14:49:06 | * | darkf quit (Quit: Leaving) |
14:50:29 | repax | What does TR stand for? |
14:50:39 | def- | term rewriting |
14:50:50 | repax | ah |
14:51:47 | repax | Thanks. But, I changed my mind after asking the question. Don't want to match more signatures than needed |
15:01:44 | ekarlso- | any of you good at scss ? |
15:01:51 | ekarlso- | and or design stuff |
15:03:26 | * | goobles joined #nim |
15:04:23 | * | willwillson quit (Ping timeout: 240 seconds) |
15:05:17 | wan | ekarlso-: maybe. Do you have an html layout? |
15:08:06 | * | filcuc quit (Quit: Konversation terminated!) |
15:09:39 | * | Jesin quit (Ping timeout: 244 seconds) |
15:09:55 | ekarlso- | wan: ye |
15:10:56 | wan | gist it/pastebin it? |
15:11:40 | * | Jesin joined #nim |
15:12:06 | * | filcuc joined #nim |
15:13:09 | flaviu | pomf.se it? |
15:14:10 | * | rpag joined #nim |
15:18:36 | ekarlso- | wan: lemme post the code in a sec |
15:18:44 | ekarlso- | u can bring it up yourself :) |
15:20:26 | * | filcuc quit (Quit: Konversation terminated!) |
15:35:38 | novist | guys, is it terrible idea to write lexer like this? https://paste2box.com/6/#/YJnWGQ/egmTxNAhS7TIhbRWuvV0QL1l7cp56uSSydmk3m-BfXk/dz2yx5kO.txt |
15:36:37 | goobles | why u lexing the nims |
15:36:42 | * | foxcub_ quit (Quit: foxcub_) |
15:36:56 | novist | plugin for intellij |
15:37:23 | gokr1 | Araq: There? |
15:39:29 | repax | If I understand idetools correctly, it is based on tracking files. An alternative design, which I don't want to foist upon anyone, would be to statefully maintain a global AST to which queries and modifications could be aimed. Project-wide refactorings could be done by the server by AST manipulation, instead of through text search&replace. |
15:40:50 | goobles | is nim gc threadsafe? |
15:40:58 | * | irrequietus quit () |
15:41:06 | repax | A REPL would interface such a server directly. |
15:41:10 | novist | each thread has its own gc goobles |
15:41:27 | goobles | o |
15:41:46 | repax | so, in that sense yes, goobles |
15:41:47 | goobles | if i'm in C++ with many threads and I call into nim is that going to break shit? |
15:42:09 | novist | why would it break shit if you write it correctly |
15:43:13 | repax | goobles, don't share mutable data between threads undisciplined |
15:44:02 | goobles | this will anger my c++ |
15:44:04 | novist | repax so does that lexer bit i showed look retarded? |
15:44:32 | repax | novist, I don't see anything wrong with it |
15:44:46 | novist | i thought maybe such logic belongs in parser? |
15:45:45 | repax | Aha, a lexer you say. Yes, perhaps a bit early to juggle such items |
15:45:54 | flaviu | repax: see roslyn for your design, IIRC |
15:46:26 | novist | thats what i suspected.. i wanted highlighting to pick up typenames in proc definitions. so its either dirty hack or also a parser. bummer.. |
15:46:42 | repax | flaviu, nice. |
15:47:06 | * | Lordovos joined #nim |
15:47:40 | repax | novist, sorry for harping on this but, you would have to, basically, reimplement a big portion of the nim compiler in order to do a good job |
15:48:03 | dyu | goobles: call setupForeignThreadGc() after each c++ thread is created |
15:48:05 | * | wan quit (Ping timeout: 244 seconds) |
15:48:33 | flaviu | From what I recall, I think that jetbrains implements most the refactorings for you |
15:48:52 | novist | i wonder maybe smarter thing to do would be is somehow hooking up compiler into plugin reimplementing lexer/parser interfaces. so compiler could do hard work and plugin would just translate between compiler output and what IDE expects |
15:48:53 | * | LordAndrew joined #nim |
15:49:05 | * | Lordovos quit (Client Quit) |
15:49:07 | * | LordAndrew quit (Client Quit) |
15:49:28 | * | LordAndrew joined #nim |
15:49:57 | repax | novist, I've not worked with intellij plugins so I'm not the best person to ask |
15:50:17 | repax | though it seems like a bit of redunant implementation |
15:50:29 | novist | Araq think it would be possible to somehow make compiler provide stuff these interfaces expect? https://paste2box.com/6/#/YpnWGQ/ZKTR0EavL_q2trQRbWWR3bw8S1cu8GqElLaKFHCfAU4/Ydojkqyq.java |
15:50:31 | repax | to do it twice |
15:50:37 | novist | yeah i agree |
15:50:39 | * | LordAndrew quit (Client Quit) |
15:51:13 | * | Lordovos joined #nim |
15:51:35 | * | Lordovos quit (Client Quit) |
15:51:54 | repax | flaviu, I have not dived deep into the implementation of the compiler but ideally the idetools and the one-off compiler would both use the same internal api for adding nodes to the ast |
15:54:13 | ekarlso- | https://github.com/ekarlso/nim-packages < there's the initial work |
15:54:32 | ekarlso- | https://github.com/ekarlso/nim-packages/blob/master/src/packages.nim < is the nim part |
15:54:59 | * | wan joined #nim |
15:55:22 | * | wan is now known as Guest73082 |
15:56:21 | ekarlso- | Guest73082: ^ |
15:58:11 | flaviu | ekarlso-: https://github.com/ekarlso/nim-packages/blob/master/src/assets/images/node-sass.png ? |
15:58:30 | ekarlso- | flaviu: yeah, leftovers from the bootstrap :) |
15:58:34 | * | foxcub_ joined #nim |
15:58:35 | repax | Roslyn is a beautifyl piece of work |
16:00:17 | flaviu | angularjs seems like a pretty big dependency |
16:00:30 | ekarlso- | why so ? |
16:00:55 | flaviu | Ah, you're doing a one-page-app |
16:01:19 | ekarlso- | it's the same as rust's crates.io kidna |
16:01:58 | * | Guest73082 is now known as wan_ |
16:03:38 | flaviu | ekarlso-: I can't figure out how to run it. Can you add a short readme? |
16:03:48 | ekarlso- | flaviu: ya |
16:04:42 | repax | Unfortunately roslyn works on a textual representation. A nice thing with nim is that even ##-comments are ast nodes. Simple #-comments should too in such a design. |
16:06:55 | * | Var|Mobile quit (Ping timeout: 265 seconds) |
16:10:42 | * | iivvoo joined #nim |
16:13:48 | ekarlso- | flaviu: is there a way to read config files in nim ? |
16:14:19 | * | soggybread joined #nim |
16:14:21 | * | Dispatch quit (Quit: Page closed) |
16:15:50 | flaviu | ekarlso-: json, I guess? |
16:16:44 | flaviu | I wrote a yaml parser, but that's not on nimble yet, or really ready to use. |
16:16:58 | iivvoo | oh, hi |
16:17:00 | dom96 | ekarlso-: parsecfg module? |
16:17:27 | iivvoo | nimble install aporia -> github.com[0: 192.30.252.128]: errno=Connection timed out |
16:17:58 | iivvoo | as far as I know I can just access github (http(s) / git) outside of nim(ble) just fine |
16:19:03 | flaviu | parsecfg is meh |
16:20:33 | foxcub_ | What is the best macro documentation? Or the best way to learn about them? |
16:20:45 | foxcub_ | *macro -> macros |
16:21:04 | flaviu | foxcub_: I may be a bit biased, but nim-by-example.github.io/oop_macro/ |
16:21:17 | dom96 | flaviu: json is worse |
16:23:10 | foxcub_ | Where are things like nnkInfix, nnkIdent, and such documented? |
16:23:15 | flaviu | dom96: Yes, JSON is the worse configuration format. But the API for parseutils is weird. |
16:23:32 | * | Lordovos joined #nim |
16:23:50 | flaviu | foxcub_: The typical workflow for macros is to dumpTree the desired output code, and see how to get to that point |
16:23:55 | flaviu | there is documentation at http://nim-lang.org/macros.html |
16:23:57 | dom96 | flaviu: *parsecfg |
16:24:02 | dom96 | flaviu: It's not that bad. |
16:24:09 | dom96 | it just requires a bit of boilerplate |
16:24:29 | foxcub_ | flaviu: Thanks. |
16:24:37 | wan_ | ekarlso-: you have a devDependency on jade, but you don't use it? (if given the choice, I'd prefer to read jade files) |
16:24:49 | iivvoo | won't the macro stuff end up in people creating their own (syntactically/semantically?) incompatible class, list comprehension, whatever implementation? |
16:26:04 | flaviu | dom96: Oh, yes it is. The api is terrible. It looks like getopt, and getopt is universally hated. |
16:26:46 | no_name | question: I'm trying to write a simple program to scrape a web page as a get-to-know nim project.. httpclient doesn't appear to support gzip encoded pages from web servers (nginx is just pushing gzipped content at a request) and in fact, there's no easy way to gunzip something even with zlib that I've found. what can I do to help? |
16:27:02 | * | gokr joined #nim |
16:27:49 | iivvoo | no_name, http://nim-lang.org/lib.html#data-compression-and-archiving ? |
16:27:52 | * | gmpreussner__ quit (Ping timeout: 244 seconds) |
16:28:03 | dom96 | flaviu: Improve it! :) |
16:29:20 | flaviu | dom96: I'm busy these days, but if anyone else is up for it, one option would be to implement https://github.com/toml-lang/toml with a ["foo"]["bar"] style API |
16:29:47 | dom96 | no. People should implement that API on top of parsecfg. |
16:30:03 | BlaXpirit | How can I turn ptr+size to a seq? Looking to wrap this function. https://github.com/LaurentGomila/CSFML/blob/fdf58188caf49684fbeb5e951c61e92a0a6c3e82/src/SFML/Window/VideoMode.cpp#L47 |
16:30:03 | no_name | iivvoo: yeah, I have been wrestling with zlib - it's just a raw exposure to the raw zlib functions. I've been trying to write a proc using zlib to decompress a gzip string and I've been unsuccessful after a day of it |
16:30:17 | * | gokr_ quit (Ping timeout: 240 seconds) |
16:30:22 | * | brson joined #nim |
16:30:37 | flaviu | I think that toml's format is much better designed than parsecfg |
16:31:34 | iivvoo | no_name, do you supply an Accept-Encoding header in your request? |
16:31:45 | * | Epic|gmpreussner joined #nim |
16:31:48 | * | willwillson joined #nim |
16:32:12 | * | dyu quit (Quit: Leaving) |
16:32:13 | * | gokr_ joined #nim |
16:32:30 | no_name | iivvoo: I'm just using httpclient.getContents() |
16:33:54 | dom96 | no_name: https://gist.github.com/dom96/2f193bae2f7b9f24e130 |
16:33:57 | dom96 | That may help you. |
16:34:09 | iivvoo | no_name, you could try passing an empty accept-encoding header |
16:34:09 | dom96 | It's what I use to decompress images that i've previously compressed using zlib. |
16:35:14 | iivvoo | anyway my nimble github issue seems to have magically resolved itself, but aporia fails to install (syntax error if I understand correctly) |
16:35:31 | dom96 | iivvoo: nimble install aporia@#head |
16:35:39 | * | gokr quit (Ping timeout: 245 seconds) |
16:36:39 | iivvoo | ah, nice. Thanks dom96 |
16:36:46 | dom96 | np |
16:37:40 | * | iivvoo was just curious about a working gui application |
16:37:48 | iivvoo | not really sure what to do with nim yet |
16:37:49 | repax | cfg files could just as well be nim files |
16:38:05 | goobles | does nim build fast |
16:38:21 | repax | goobles, I think so |
16:38:21 | flaviu | goobles: yep |
16:38:56 | ekarlso- | wan_: ? |
16:39:10 | ekarlso- | dom96: kewl |
16:39:22 | ekarlso- | flaviu: toml support ? |
16:40:03 | no_name | dom96: apparently gzip files are different and have headers that need to be parsed and you have to use a larger WBITS size, so you can't just use uncompress |
16:40:05 | flaviu | ekarlso-: I don't understand what you're asking. |
16:40:26 | flaviu | https://github.com/toml-lang/toml is toml, but nim does not have a parser for it. |
16:40:28 | goobles | could u use nim as a script language? |
16:40:28 | no_name | I've been trying to reimplement it to support gzip, but it doesn't appear to be working either |
16:40:33 | dom96 | no_name: that sucks. |
16:41:01 | flaviu | goobles: Sure, https://gist.github.com/flaviut/27c2dc9cd2d8f5ced4e4 |
16:41:05 | Lordovos | TOML looks like INI. |
16:41:06 | ekarlso- | would be kewl if there was a parser for it |
16:41:59 | flaviu | ekarlso-: If you want to get to shaving yaks, you can try wrapping https://github.com/ajwans/libtoml |
16:42:12 | no_name | is there any documentation on how to use futures? |
16:42:48 | no_name | I'm trying to use the asynchttpclient and it returns a Future[Response], not sure what to do with that any haven't seen it covered in the docs |
16:43:58 | BlaXpirit | guys, how to convert C array to seq? |
16:44:29 | flaviu | BlaXpirit: By copying. seqs have a header to store the length information. |
16:44:29 | BlaXpirit | I almost worked out a simple but lame way to do it, but I'm missing pointer arithmetics anyway |
16:44:41 | BlaXpirit | C array is just a pointer btw |
16:44:44 | BlaXpirit | flaviu, I don't understand |
16:44:48 | * | foxcub_ quit (Quit: foxcub_) |
16:47:04 | flaviu | type carray[T] = {.unchecked.} = array[0..0, T]; myarr = cast[carray[mytype]](mypointer); for i in 0..(carrylen - 1): result.add(myarr[i]) |
16:47:08 | flaviu | BlaXpirit: ^ |
16:47:26 | flaviu | Not actual syntax, I took some liberties for brevity. |
16:47:27 | BlaXpirit | flaviu, OK, thank you. |
16:51:54 | no_name | I can't find docs for Future[T] anywhere.... |
16:54:51 | repax | no_name: asyncdispatch.html |
16:56:47 | * | foxcub_ joined #nim |
17:02:54 | * | foxcub_ quit (Quit: foxcub_) |
17:14:02 | * | bluemanshoe joined #nim |
17:14:14 | MyMind | is not possible to perform operations between floats and ints w/o explicit conversion? |
17:14:50 | bluemanshoe | Is there a builtin for consuming an iterator and returning a sequence? |
17:15:07 | def- | bluemanshoe: toSeq in sequtils? |
17:16:10 | def- | MyMind: I'd consider that a good thing |
17:16:50 | MyMind | maybe it is |
17:16:58 | MyMind | but even C can do it |
17:17:54 | MyMind | what is the alternative to printf? |
17:18:06 | flaviu | MyMind: Nope. Converters, maybe, but don't do that. |
17:18:46 | flaviu | MyMind: strfmt from Nimble, https://lyro.bitbucket.org/strfmt/ |
17:19:06 | MyMind | flaviu: I'm trying to port this code to nim http://www.voidware.com/phase.c |
17:19:14 | MyMind | and it does constantly |
17:19:26 | MyMind | float to int implicit conversions |
17:20:04 | flaviu | MyMind: https://gist.github.com/8323723338e2b5ebe53c |
17:20:38 | flaviu | wait, you're right |
17:21:10 | MyMind | lol you did already O_O? |
17:21:26 | flaviu | c2nim does most of the work |
17:22:04 | MyMind | didn't know that exist that |
17:22:31 | bluemanshoe | \quit |
17:22:33 | * | bluemanshoe quit (Quit: leaving) |
17:22:34 | MyMind | well I'm learning a lot |
17:23:52 | MyMind | that works flaviu ? |
17:23:57 | flaviu | It does? |
17:24:24 | MyMind | I doubt |
17:24:30 | MyMind | is using printf |
17:24:39 | MyMind | and fflush |
17:30:54 | * | Trustable joined #nim |
17:33:31 | ekarlso- | flaviu: added readme |
17:38:37 | dom96 | ekarlso-: Why are you using a nodejs server to proxy to the Nim server? |
17:39:57 | flaviu | MyMind: It sort of works now: https://gist.github.com/72429331289e50d7e16a |
17:40:07 | flaviu | It's really shitty code because the input C was pretty shitty. |
17:40:51 | flaviu | dom96: jester-0.1.0/private/patterns.nim(96, 10) Error: invalid indentation |
17:41:36 | dom96 | flaviu: reinstall jester |
17:43:27 | flaviu | ok, seems to work |
17:45:15 | * | bluemanshoe joined #nim |
17:45:24 | dom96 | ekarlso-: Any chance you can get rid of those nodejs dependencies? |
17:45:37 | wan_ | dom96: maybe the proxying is because of CORS issues? |
17:47:27 | dom96 | wan_: I don't see how that is relevant |
17:47:37 | BlaXpirit | is there a way to get rid of {.raises: [], tags: [].} in doc2? |
17:47:41 | * | brson quit (Quit: leaving) |
17:48:02 | BlaXpirit | well, of course, there is... by literally removing it from generated html |
17:48:05 | bluemanshoe | Is there a reason countup doesn't have the wrapping proc defined? |
17:48:05 | BlaXpirit | but a reasonable way? |
17:49:35 | * | Demos_ joined #nim |
17:49:37 | bluemanshoe | I'm hopping to do something like {1} + {countup(3,10,2)} |
17:50:29 | flaviu | ekarlso-: Any idea what [Proxy] { [Error: connect ECONNREFUSED] code: 'ECONNREFUSED', errno: 'ECONNREFUSED', syscall: 'connect' } is about? |
17:57:29 | flaviu | ah, I need to run the nim server at the same time |
17:57:37 | * | Var|Mobile joined #nim |
18:01:44 | dom96 | bluemanshoe: I don't think you can do that because countup is an iterator. |
18:02:11 | dom96 | bluemanshoe: Why not just change its params? |
18:02:24 | * | wan_ quit (Quit: WeeChat 1.0.1) |
18:03:10 | ekarlso- | dom96: uh, u need nodejs stuff to compile the app |
18:03:29 | dom96 | ekarlso-: why? |
18:03:43 | ekarlso- | eh, dom96 because it's the way it works ? :P |
18:03:52 | ekarlso- | gulp, bower etc are based off of it |
18:04:11 | dom96 | what do you need these dependencies for? |
18:04:25 | ekarlso- | dom96: ... the js app concists of multiple html and js files |
18:04:28 | ekarlso- | as well as scss |
18:04:41 | ekarlso- | nodejs is the runtime for the tools to compile all that |
18:05:11 | ekarlso- | dom96: what else would you do ? |
18:05:19 | dom96 | alright. Doesn't explain why you need a proxy? |
18:05:35 | ekarlso- | dom96: it's just for convenience because of CORS atm.. |
18:05:41 | ekarlso- | havent bothered to work around it |
18:07:15 | dom96 | I would personally just write it in CSS. |
18:07:24 | dom96 | The JS doesn't need to be compiled. |
18:07:30 | bluemanshoe | dom96: Not sure what you mean by that |
18:07:44 | bluemanshoe | dom96: changing its params that is |
18:07:48 | ekarlso- | dom96: ... these tools exists for a reason :p |
18:07:53 | dom96 | bluemanshoe: What are you hoping to accomplish via {1} + {countup(3,10,2)}? |
18:08:27 | * | irrequietus joined #nim |
18:08:54 | bluemanshoe | dom96: I'm just getting started with nim, was working through project euler puzzles, and I wanted to build a sieve that was powered by a set of all of the multiples generated thus far |
18:09:00 | dom96 | ekarlso-: I'd rather not have to install node just to get it to compile. |
18:09:29 | bluemanshoe | dom96: ended up with something like for i in countup(n*n, limit, n): myset.incl(i) but was just wondering if there was a more idiomatic way to write it |
18:09:31 | dom96 | bluemanshoe: oh, you want countup to build you a set. |
18:09:39 | * | johnsoft quit (Ping timeout: 244 seconds) |
18:09:40 | dom96 | countup doesn't build a set |
18:10:23 | bluemanshoe | dom96: but {1..10} works, because the `..` iterator has a corresponding proc defined in the standard lib, but I noticed that countup does not, was just wondering if there was a reason for that |
18:10:44 | flaviu | ekarlso-: Can you use sqlite instead of mysql? |
18:10:48 | dom96 | bluemanshoe: Yes. In the case of {1..10} you're not calling that iterator. |
18:10:54 | flaviu | It simplifies deployment and usage signficantly. |
18:10:58 | dom96 | The `..` is a part of Nim's syntax. |
18:11:12 | * | Demos_ quit (Ping timeout: 244 seconds) |
18:11:39 | bluemanshoe | dom96: well, if I understand this right, looking at: https://github.com/Araq/Nim/blob/master/lib/system.nim#L221 |
18:11:50 | dom96 | bluemanshoe: You could write a proc called countupSet which returns a set. |
18:11:54 | bluemanshoe | dom96: `..` has a procedure defined, instead of just the iterator |
18:12:09 | dom96 | That returns a slice, not a set. |
18:12:19 | dom96 | That's for array/seq slices. |
18:13:22 | ekarlso- | flaviu: u mean for dev or for actual deployment ? |
18:13:40 | bluemanshoe | dom96: right, but since iterators and procedures are in different name spaces, I could define: proc countup(a, b, step: int): seq[int] = return toSeq(countup(a,b,step)) and have it work |
18:13:45 | flaviu | ekarlso-: Both. |
18:13:55 | ekarlso- | flaviu: I wouldn't use sqlite for deployment... |
18:14:15 | flaviu | ekarlso-: It works for the forum, and everything is run on a single vps anyway |
18:14:26 | dom96 | bluemanshoe: Yes. But a seq is not a set either. |
18:15:11 | dom96 | ekarlso-: indeed sqlite is pretty fast |
18:17:33 | bluemanshoe | dom96: right. I guess I don't understand what is allowed to appear inside the { } set constructor |
18:18:24 | dom96 | bluemanshoe: AFAIK just char and int literals, and `..`. |
18:18:32 | ekarlso- | I dont get it what is so bad with mysql -,,- |
18:19:18 | flaviu | ekarlso-: Mysql is complicated and takes lots of RAM. |
18:19:28 | * | Var|Mobile quit (Ping timeout: 244 seconds) |
18:19:32 | ekarlso- | u got little on the VPS ? ^^ |
18:19:52 | flaviu | Yep, and all the stuff shares the ram |
18:19:59 | ekarlso- | ah ok |
18:19:59 | flaviu | ekarlso-: sqlite scales fine: http://i.imgur.com/IoSGrFp.png |
18:20:14 | ekarlso- | flaviu: well fine enough by me... |
18:20:23 | ekarlso- | guess i'll change the api then :'( |
18:20:42 | flaviu | ekarlso-: I'll update the schema |
18:21:06 | ekarlso- | flaviu: how u backup sqlite then |
18:21:34 | flaviu | I guess it's enough just to download the database file |
18:21:37 | flaviu | it's a single file |
18:21:40 | * | Var|Mobile joined #nim |
18:24:08 | * | Var|Mobile quit (Read error: Connection reset by peer) |
18:24:21 | flaviu | ekarlso-: https://gist.github.com/flaviut/c947e966085d01889ff5 |
18:25:34 | * | ekarlso- wishes there was a sqlite ish thing for nim |
18:25:40 | ekarlso- | ehm, sqlalchemy |
18:25:54 | flaviu | but sql is fun! |
18:26:08 | ekarlso- | not rly :p |
18:26:30 | flaviu | For sqlite, you can use sqlitestudio for experimenting. |
18:26:34 | flaviu | It's a pleasure. |
18:28:19 | flaviu | It looks like s/db_mysql/db_sqlite/g and that schema change is all that's needed for migration |
18:36:50 | * | zahary2 quit (Ping timeout: 244 seconds) |
18:39:24 | * | bluemanshoe quit (Ping timeout: 245 seconds) |
18:40:58 | * | Varriount|Mobile joined #nim |
18:46:10 | ekarlso- | flaviu: is it possible to do migrations thought with sqlite ? |
18:46:56 | flaviu | ekarlso-: sorry, I don't understand what you said. |
18:47:10 | ekarlso- | flaviu: db migrations .. |
18:47:43 | flaviu | oh, like between schemas? Looks like, sqlite supports https://www.sqlite.org/lang_altertable.html |
18:49:18 | ekarlso- | flaviu: kk |
18:49:21 | ekarlso- | what next ? :p |
18:49:51 | * | brson joined #nim |
18:49:55 | * | Lordovos quit (Quit: Leaving) |
18:50:21 | flaviu | Cutting down on dependencies would be good. I don't think that most the angularjs modules are necessary. |
18:50:31 | ekarlso- | flaviu: which ones ? |
18:50:44 | flaviu | dunno, let me look |
18:51:32 | ekarlso- | flaviu: I really dont get it why it's so bad |
18:52:05 | flaviu | Because most existing nim programs are minimalist |
18:52:27 | flaviu | lots of emphasis on efficiency. |
18:52:45 | ekarlso- | well, u could probably not use states... |
18:52:54 | ekarlso- | aka ui-router but I feel the app is better with it |
18:56:45 | flaviu | ekarlso-: btw, malformed json causes a segfault in the app |
19:02:54 | flaviu | ekarlso-: I got rid of all the angular modules besides ui.router and ui.bootstrap, and things seem to work fine |
19:04:59 | * | gokr1 quit (Quit: Leaving.) |
19:06:01 | dom96 | why do you even need angular for? |
19:06:07 | dom96 | *what |
19:06:34 | flaviu | dom96: It's a single-page app, all the rendering is done in the browser |
19:07:53 | dom96 | I'm not sure what that means |
19:08:15 | * | gokr joined #nim |
19:08:37 | flaviu | dom96: The page it serves up has no content on it. The content is placed on the page by client-side javascript. |
19:09:28 | flaviu | The browser gets https://gist.github.com/flaviut/9d77821ec2c128548981 and does all the work of filling in the page |
19:10:25 | dom96 | Ahh |
19:10:40 | * | AMorpork is now known as AFKMorpork |
19:12:14 | ekarlso- | flaviu: eh, ok what stuff did u remove ? |
19:13:32 | flaviu | ekarlso-: here's the patch: https://gist.github.com/anonymous/233e51d35ce17012b709 |
19:13:52 | flaviu | run `git apply`, paste that in, press <enter>, <ctl>-d |
19:14:19 | ekarlso- | flaviu: pull req ? :D |
19:17:11 | flaviu | ekarlso-: sure: https://github.com/ekarlso/nim-packages/pull/1 |
19:19:37 | * | johnsoft joined #nim |
19:22:06 | * | jefus quit (Read error: Connection reset by peer) |
19:24:08 | * | nimnoob123 quit (Quit: Page closed) |
19:28:37 | BlaXpirit | Mimbus pls |
19:28:53 | BlaXpirit | it's actualy like better than nim i |
19:30:11 | dom96 | You should grab Aporia ;) |
19:30:18 | BlaXpirit | nope |
19:30:30 | dom96 | Ctrl+N, type in code, F5 |
19:30:33 | BlaXpirit | i have the best text editor in the world |
19:30:38 | BlaXpirit | but hmm that could be useful :p |
19:33:55 | BlaXpirit | check this craziness out though |
19:33:58 | BlaXpirit | .eval proc `test=`*(a, b: int): bool = true; let success = (5.test = 6) |
19:34:55 | jsudlow | Error: type mismatch: got (ref ClickSystem, typedesc[PMouseButtonEvent]) |
19:34:55 | jsudlow | but expected one of: |
19:34:55 | jsudlow | clicksystem.mouse_down(self: ref ClickSystem, event: PMouseButtonEvent) |
19:35:22 | jsudlow | dose anyone know what the diffrence between typedesc[PMouseButtonEvent] and PMouseButtonEvent are |
19:36:01 | BlaXpirit | dom96, welp, AUR aporia-git doesn't work |
19:36:04 | BlaXpirit | i guess that's that |
19:36:08 | def- | jsudlow: typedesc is the type itself, you have to make an instance of it |
19:36:29 | jsudlow | def: cool I'm trying to spoof a mouse click |
19:36:43 | jsudlow | def: so maybe I have to make in instance of that event |
19:37:00 | BlaXpirit | obviously |
19:37:15 | jsudlow | def: thx :_ |
19:37:18 | jsudlow | :) |
19:37:26 | def- | np |
19:38:11 | dom96 | BlaXpirit: obviously AUR sucks, use Nimble instead :P |
19:39:36 | ekarlso- | flaviu: other comments? |
19:40:02 | flaviu | As dom96 said, it'd be great if we could get rid of the nodejs dependency at runtime. |
19:40:15 | flaviu | Doesn't nodejs just serve up static files |
19:40:44 | ekarlso- | flaviu: |
19:40:44 | ekarlso- | u already can... |
19:40:44 | ekarlso- | just need to fix cors... |
19:41:19 | flaviu | My bad, I didn't see message. |
19:41:55 | ekarlso- | flaviu: also gulp serve uses "live reload" so whenever you change some file it reloads the page |
19:42:00 | ekarlso- | which is pretty helpful |
19:42:38 | flaviu | yep, I've noticed, but given the memory-constrained environment of the VPS, it's best not to run more processes than required. |
19:43:03 | ekarlso- | flaviu: it was never the intention either :) |
19:43:19 | ekarlso- | the api svc is supposed to support CORS when deployed.. |
19:43:41 | ekarlso- | but given that there's no examples of it atm it's not easy for me :p |
19:44:23 | flaviu | I'm not sure what all this cors stuff is about. Can't the same Nim server serve up the static files and the API endpoints? |
19:44:44 | ekarlso- | flaviu: oh, sorry you're right |
19:45:04 | ekarlso- | I *think* at least.. |
19:47:19 | * | Demos_ joined #nim |
19:47:32 | dom96 | Yeah, that's why I got confused. |
19:47:42 | dom96 | CORS is never a problem when it comes to Nim. |
19:51:12 | * | Mat4 joined #nim |
19:51:28 | Mat4 | hi all |
19:53:24 | * | tani joined #nim |
19:55:04 | * | MyMind quit (Quit: WeeChat 1.1-rc1) |
19:55:57 | * | Sembei joined #nim |
19:56:39 | * | tane is now known as Guest75912 |
19:56:39 | * | Guest75912 quit (Killed (hitchcock.freenode.net (Nickname regained by services))) |
19:56:39 | * | tani is now known as tane |
19:57:57 | Sembei | flaviu: https://gist.github.com/Sembei/020fee00f88483bc7662 |
20:01:53 | * | BlaXpirit_ joined #nim |
20:01:58 | * | BlaXpirit_ quit (Client Quit) |
20:02:19 | * | BlaXpirit_ joined #nim |
20:02:26 | * | repax quit (Quit: repax) |
20:04:21 | * | BlaXpirit quit (Ping timeout: 244 seconds) |
20:09:53 | ekarlso- | dom96: how u set the static root of jester ? |
20:10:27 | dom96 | var settings = newSettings(staticDir = "..") |
20:10:59 | dom96 | Make sure to give it an absolute path. |
20:11:54 | flaviu | ekarlso-: see my fork: https://github.com/flaviut/nim-packages/commit/c87c0965757f7e3bc0a3935d90dd6e49734e9cab |
20:12:34 | jsudlow | sI'm trying to make a pointer to a tmouseevent that I just instantiated, does anyone know where to put the type that the compiler expects on spff_event_ptr? |
20:12:35 | jsudlow | var spoof_event_ptr = ptr spoof_tmouse_event |
20:13:06 | ekarlso- | flaviu: pull req and i'll merge |
20:17:26 | flaviu | It looks like it's returning 502 when it should be returning 520 |
20:17:53 | flaviu | err, 500 |
20:18:25 | ekarlso- | :P |
20:18:33 | ekarlso- | flaviu: that's jester's fault |
20:19:17 | ekarlso- | dom96: would it be possible for you to make jester have a error proc or smth that would allow for custom error handling ? |
20:19:38 | dom96 | Yes, i'll implement that in the future. |
20:19:51 | ekarlso- | :P |
20:19:57 | ekarlso- | dom96: what other libs u got for nim ? |
20:20:04 | flaviu | ekarlso-: It should also try to create the tables on each connection to the DB. |
20:20:22 | ekarlso- | flaviu: uh, that sounds a bit weird to me .:/ |
20:20:25 | * | rpag quit (Quit: Leaving) |
20:20:54 | flaviu | Probably, I have no real web dev experience. |
20:21:05 | dom96 | ekarlso-: not that many actually |
20:21:11 | dom96 | ekarlso-: Most of my stuff is in the stdlib ;) |
20:21:13 | ekarlso- | :p |
20:21:21 | flaviu | But `CREATE IF NOT EXIST` would be helpful if I forget to initialize my database. |
20:21:40 | * | minciue quit (Quit: minciue) |
20:21:51 | ekarlso- | flaviu: sounds like u should have a vagrant thing or smth instead ? :P |
20:22:33 | flaviu | I've never heard of those things, but I get by with `sqlite3 ./packages.sqlite < ../schema.sql`. |
20:22:53 | ekarlso- | flaviu: yeah, should probably add it to readme :) |
20:32:00 | ekarlso- | flaviu: how big is the vps ? |
20:32:20 | flaviu | dunno, ask dom96 |
20:32:50 | dom96 | 512mb RAM currently. We will likely upgrade it. |
20:34:25 | * | gokr notes del for seq... sneaky |
20:34:40 | ekarlso- | gokr: tjena! |
20:34:45 | gokr | Tjaba! :) |
20:35:34 | * | gokr picking away at my port of PetitParser... |
20:36:37 | ekarlso- | flaviu: gotten to test it yet ? |
20:36:55 | flaviu | ekarlso-: hmm? |
20:37:03 | flaviu | I've gotten it to run with just jester |
20:37:14 | flaviu | you have to copy some stuff from the other directories |
20:38:21 | ekarlso- | fair enough |
20:39:19 | flaviu | I'm not familiar with the tooling you chose, but I assume you can get it to minify everything and put it in a specific directory? |
20:39:35 | ekarlso- | flaviu: it puts it under dist |
20:40:07 | ekarlso- | dist/index.html |
20:40:08 | flaviu | ekarlso-: Not everything. The compiled javascript and css is in .tmp/ |
20:40:14 | * | Var|Mobile joined #nim |
20:43:59 | * | yglukhov__ quit (Quit: Be back later ...) |
20:44:35 | * | Varriount|Mobile quit (Ping timeout: 264 seconds) |
20:48:26 | jpoirier | is anyone using "git request-pull" directly as opposed to forking araq/nim and using the github pull request web feature? |
20:48:44 | * | gokr quit (Quit: Leaving.) |
20:50:02 | * | yglukhov__ joined #nim |
20:51:12 | Mat4 | I think that would result in some kind of trouble |
20:51:47 | flaviu | jpoirier: Everyone is using the github web UI, but TIL about request-pull, thanks! |
20:51:58 | ekarlso- | actually flaviu |
20:52:02 | ekarlso- | if you set the static dir |
20:52:02 | jpoirier | Mat4: a pull request is a pull request |
20:52:09 | ekarlso- | to "dist" under the repo folder |
20:52:19 | ekarlso- | and run gulp before running the packages.nim |
20:52:26 | ekarlso- | u should be able to localhost:5000/index.html |
20:52:27 | ekarlso- | :) |
20:52:50 | jpoirier | here's Linus' rant, it's a good read https://github.com/torvalds/linux/pull/17#issuecomment-5654674 |
20:52:52 | * | renesac joined #nim |
20:54:47 | * | yglukhov__ quit (Ping timeout: 264 seconds) |
20:54:59 | * | gour quit (Remote host closed the connection) |
20:58:48 | ekarlso- | flaviu: I was thinking of adding a "release" create form as well |
21:00:47 | jpoirier | It's a lot simpler to a) clone master/devel, branch fix/feature, request-pull, merge upstream/master|devel, delete branch than to b) fork master/devel, clone the fork, branch, push remote branch, go to github and mess with the web interface. |
21:02:26 | flaviu | jpoirier: I won't disagree with you, I'd like to do everything from the terminal too, but that's unlikely to change. |
21:03:38 | jpoirier | flaviu: you can do that now. I think people forget that github is just an web interface around the git tools |
21:06:04 | flaviu | jpoirier: I'm not sure what you mean. Isn't request-pull used to create emails for pull requests? |
21:06:56 | * | yglukhov__ joined #nim |
21:10:32 | jpoirier | flaviu: hmm, it seems I have an alias that's calling a script that does all the magic... |
21:11:56 | * | renesac quit (Remote host closed the connection) |
21:12:21 | * | renesac joined #nim |
21:13:15 | ekarlso- | any changes u want flaviu ? |
21:13:58 | flaviu | Just to be clear, I'm not a representative of the project. |
21:14:07 | flaviu | ekarlso-: What's the scope of the project? |
21:14:28 | * | ldlework bows to our great leader flaviu |
21:14:37 | ekarlso- | flaviu: ;P |
21:14:51 | ekarlso- | flaviu: I was thinking like crates.io for nim |
21:15:33 | Var|Mobile | Meep |
21:15:49 | ekarlso- | what was the thing again for parsing config files ? |
21:15:59 | ldlework | parsecfg |
21:16:04 | * | ldlework hands ekarlso- a bookmark to the docs |
21:16:06 | flaviu | ekarlso-: TOML is the one I like. |
21:16:22 | * | renesac quit (Remote host closed the connection) |
21:16:46 | * | renesac joined #nim |
21:16:46 | ekarlso- | flaviu: but I guess that isn't supported yet ? |
21:17:06 | flaviu | No one has implemented a parser for nim. |
21:17:31 | ekarlso- | never written a parser :/ |
21:18:49 | flaviu | Well, I suppose I could try. How hard can it be? ;) |
21:18:58 | ekarlso- | hah :p |
21:19:30 | dom96 | flaviu: https://github.com/search?utf8=%E2%9C%93&q=nim+toml |
21:19:39 | dom96 | You sure? :P |
21:20:30 | flaviu | Well, one of those doesn't actually have an implmentation |
21:20:30 | reactormonk | btw, why is the tutorial split into parts? Why not merge it? |
21:20:41 | dom96 | the other does |
21:21:29 | ekarlso- | doesnt have a implementation how ? |
21:21:35 | * | flaviu quit (Read error: Connection reset by peer) |
21:21:46 | ekarlso- | dom96: would be radical if u had delete stuff etc |
21:22:07 | dom96 | ekarlso-: hrm? You mean the REST stuff? |
21:22:11 | ekarlso- | ya! :d |
21:22:13 | * | renesac_ joined #nim |
21:22:20 | * | renesac quit (Ping timeout: 250 seconds) |
21:23:56 | * | flaviu joined #nim |
21:24:33 | flaviu | ekarlso-: The source file is literally doesn't have anything in it. |
21:25:55 | reactormonk | why do I get a "cannot open" when I'm opening a file in write mode? |
21:26:00 | reactormonk | ... it doesn't exist. |
21:26:14 | flaviu | judofyr's implementation has the same bad API as parsecfg |
21:26:39 | * | renesac__ joined #nim |
21:26:40 | * | renesac_ quit (Ping timeout: 255 seconds) |
21:27:03 | * | adam_s joined #nim |
21:28:12 | reactormonk | Even with fmReadWriteExisting |
21:29:08 | * | zahary1 joined #nim |
21:31:06 | * | renesac joined #nim |
21:31:10 | * | renesac__ quit (Ping timeout: 255 seconds) |
21:33:36 | * | Demon_Fox joined #nim |
21:34:13 | reactormonk | open("test", fmReadWriteExisting).write(readAll(stdin)) # What am I doing wrong here? The file "test" doesn't exist. The code gives me Error: unhandled exception: cannot open: test [IOError] |
21:37:11 | onionhammer | om96 |
21:37:13 | onionhammer | dom96 |
21:37:25 | onionhammer | you know the <title> tag of the nim forum is still "nimrod forum" |
21:37:26 | * | bluemanshoe joined #nim |
21:37:59 | * | jefus joined #nim |
21:40:44 | dom96 | onionhammer: yeah, i'll fix it later |
21:41:08 | * | renesac quit (Remote host closed the connection) |
21:41:34 | * | renesac joined #nim |
21:42:47 | reactormonk | ok, wtf. According to errnos I get a ETXTBSY 26 Text file busy |
21:43:57 | reactormonk | How should I put in debug statements into the compiler that are only enabled when you run it in debug mode? |
21:45:23 | * | adam_s quit (Ping timeout: 240 seconds) |
21:45:24 | dom96 | reactormonk: You're trying to open a file which doesn't exist? |
21:45:44 | reactormonk | rtfm, huh |
21:46:11 | reactormonk | dom96, yeah, the mode was wrong. But with fmWrite, I get the same error |
21:47:12 | reactormonk | dom96, I would like the errno to be output via stderr in case you have debug mode enabled, might help other people debug |
21:48:04 | * | renesac_ joined #nim |
21:49:06 | reactormonk | found it -.- |
21:49:45 | * | renesac quit (Ping timeout: 244 seconds) |
21:51:18 | reactormonk | How can I do path expansion? |
21:52:29 | * | renesac__ joined #nim |
21:52:30 | * | renesac_ quit (Ping timeout: 265 seconds) |
21:53:03 | bluemanshoe | How do I make a sequence that I can index with an int64 ? |
21:55:13 | reactormonk | bluemanshoe, I don't think that's possible. seq is baked too much into the compiler. You can check for sizeof(int) == sizeof(int64) |
21:55:57 | reactormonk | which kinda gives you equivalent range, but can't compile on 32bit systems anymore. |
21:56:24 | reactormonk | which I honestly doubt should pose too much of a problem |
21:56:46 | reactormonk | Anyone ever wrapped realpath() ? |
21:56:55 | * | renesac joined #nim |
21:57:15 | reactormonk | ok, it's in stdlib |
21:57:20 | * | renesac__ quit (Ping timeout: 265 seconds) |
21:58:10 | bluemanshoe | reactormonk: hmm. I get true, but for some reason when I created a large const, it had type int64, and when I tried to use that as an address to a seq, it gave and error. I would have expected int64 to safely cast to int |
21:58:53 | * | renesac is now known as renesac_ |
21:58:57 | reactormonk | bluemanshoe, it can't because it's also expected to run on a 32bit system. |
21:59:08 | renesac_ | nimborg is dead? |
21:59:29 | renesac_ | somebody asked about python interfacing yesterday I think |
21:59:46 | reactormonk | renesac_, lemme look it up |
22:00:29 | reactormonk | he's offline |
22:00:44 | reactormonk | foxcub, in case he shows up again |
22:00:53 | reactormonk | bluemanshoe, you could use a converter with said assert |
22:00:56 | * | renesac_ quit (Remote host closed the connection) |
22:01:23 | * | renesac joined #nim |
22:01:29 | ekarlso- | flaviu: what u think we should add to it ? |
22:01:37 | reactormonk | but I have no idea if it would actually complain at compile time... |
22:01:56 | reactormonk | bluemanshoe, I suggest going to the forum with that one |
22:02:17 | flaviu | ekarlso-: Make it look better, make the licence list a dropdown. |
22:02:36 | reactormonk | are cstrings returned from an importc'd function garbage collected? |
22:02:38 | flaviu | Implement docgen for the packages that are uploaded. |
22:03:13 | ekarlso- | flaviu: I was wondering if one should add docgen that queries the pkg index and generates docs for anything that doesnt have it |
22:04:11 | flaviu | I was thinking of doing it on upload, but do it however you want to do it. |
22:04:47 | ekarlso- | flaviu: I think it would be cooler if it was a diff app from the registry app itself |
22:05:23 | * | renesac quit (Remote host closed the connection) |
22:05:46 | * | renesac joined #nim |
22:06:28 | flaviu | Doesn't really matter, the main idea is that each package get's its docs autogenerated. |
22:06:37 | flaviu | *gets |
22:07:09 | reactormonk | no pw reset for the forum yet? |
22:09:31 | ekarlso- | flaviu: how u mean by upload ? :) |
22:09:34 | ekarlso- | u mean register ? |
22:09:46 | * | renesac quit (Remote host closed the connection) |
22:10:10 | * | renesac joined #nim |
22:13:58 | flaviu | ekarlso-: https://gist.github.com/692650d9ab76ecc490fd |
22:14:15 | flaviu | ekarlso-: Just to make sure we're thinking of the same thing |
22:14:49 | * | renesac quit (Ping timeout: 255 seconds) |
22:18:09 | ekarlso- | flaviu: approvals are a bit silly I think.. |
22:18:57 | flaviu | Ok, removed then |
22:20:22 | * | gokr joined #nim |
22:24:51 | ekarlso- | what u mean about sandboxing flaviu ? |
22:24:52 | * | Varriount|Laptop joined #nim |
22:25:01 | def- | Made a script in Nim to convert all pages on Rosetta Code from Nimrod to Nim. Seems to work |
22:25:12 | flaviu | ekarlso-: What if there's a bug in docgen? We don't want our server to be pwned |
22:25:27 | ekarlso- | flaviu: docker ? ^^ |
22:25:50 | flaviu | http://www.ucw.cz/moe/isolate.1.html |
22:25:58 | flaviu | It's probably easiest to use |
22:26:04 | flaviu | but it uses the same technology as docker |
22:26:13 | ekarlso- | or just use docker.. |
22:26:15 | ekarlso- | :p |
22:26:31 | flaviu | Sure, whatever you want. It's your project. |
22:26:41 | ekarlso- | hah :P |
22:27:01 | Varriount|Laptop | Araq: I think you made a type in your last post on the page http://forum.nim-lang.org/t/362/1 |
22:27:05 | Varriount|Laptop | *typo |
22:28:15 | def- | You can watch the site slowly filling: http://rosettacode.org/wiki/Category:Nim |
22:31:13 | * | Varriount|Laptop quit (Ping timeout: 246 seconds) |
22:31:36 | * | Demos_ quit (Ping timeout: 244 seconds) |
22:39:27 | BlaXpirit_ | [:27:04] the irony |
22:40:37 | ekarlso- | flaviu: what licenses to allow then + |
22:40:49 | flaviu | ekarlso-: Make a table for licences |
22:41:04 | flaviu | and then admins can add whatever they want |
22:48:33 | reactormonk | do we have anything for mail parsing? |
22:49:44 | reactormonk | Which library for simple beginning-of-line matching? |
22:49:54 | * | Epic|gmpreussner is now known as gmpreussner |
22:50:06 | reactormonk | Aka ^Foo: (.*)$ and gimme back the match |
22:51:19 | * | tane quit (Quit: Verlassend) |
22:51:57 | flaviu | `re`? |
22:52:24 | * | saltylicorice joined #nim |
22:54:49 | reactormonk | should do |
22:56:03 | * | Jesin quit (Quit: Leaving) |
22:56:40 | * | Varriount joined #nim |
22:57:02 | * | Varriount is now known as Varriount|Laptop |
22:57:11 | Varriount|Laptop | .eval var s = "hello";var a: ref string = s;echo(repr(s), " ", repr(a)) |
22:57:39 | BlaXpirit_ | Mimbus pls |
22:57:58 | * | Varriount|Laptop pokes flaviu |
22:58:06 | flaviu | hi |
22:58:32 | flaviu | Go in #nim-offtopic, it was apparently too spammy |
23:00:36 | flaviu | Well, A___ isn't here, I suppose I could sneak him in ;) |
23:02:53 | * | Mimbus joined #nim |
23:03:17 | flaviu | Now, don't ping or use Mimbus when A___ is here. |
23:03:46 | dom96 | Are you trying to not highlight Araq? |
23:04:03 | dom96 | You do realise he's away right? |
23:04:14 | flaviu | yep, which is why I'm trying not to ping him |
23:04:45 | * | EXetoC joined #nim |
23:04:54 | dom96 | If his client isn't connected to his BNC then it doesn't matter. |
23:05:18 | * | Jesin joined #nim |
23:06:46 | * | saltylicorice quit (Ping timeout: 250 seconds) |
23:07:41 | BlaXpirit_ | There seems to be a problem with doc2. Some of my functions are missing their documentation. It seems to be one-line functions. https://github.com/BlaXpirit/nim-csfml/blob/master/src/csfml_system.nim#L108 http://blaxpirit.github.io/nim-csfml/csfml_system.html#==,Vector2i,Vector2i |
23:08:29 | * | Jesin quit (Client Quit) |
23:10:41 | reactormonk | Araq, any way to lock nim into 64bit to have ints be 64bit for seqs? |
23:11:49 | goobles | what if i want 32 bits |
23:11:53 | goobles | why u hating |
23:14:05 | dom96 | BlaXpirit_: Try adding a 'return' and see if that helps |
23:14:15 | reactormonk | goobles, because 32bit is legacy and legacy sucks |
23:14:16 | dom96 | in any case, report it |
23:14:17 | BlaXpirit_ | dom96, it probably will, but still a problem |
23:14:23 | dom96 | ^^ |
23:14:25 | dom96 | I agree |
23:14:38 | goobles | 32 bit takes less memory |
23:14:49 | goobles | i can store more ints that way |
23:15:02 | BlaXpirit_ | what is stopping you guys from using the corresponding data types? |
23:15:13 | reactormonk | BlaXpirit_, seq |
23:15:17 | BlaXpirit_ | how exactly |
23:15:21 | * | Jesin joined #nim |
23:15:26 | EXetoC | goobles: int8, int16 or int32? |
23:15:26 | reactormonk | tried using int64 as index in seq? |
23:15:30 | BlaXpirit_ | oh ok |
23:15:44 | goobles | oooh i like that |
23:16:02 | flaviu | reactormonk: Just use a macro to verify that int is 8 bits, and use a converter to make int64 equal int. |
23:16:12 | BlaXpirit_ | reactormonk, but you can't possibly have enough memory |
23:16:17 | reactormonk | flaviu, probably |
23:16:19 | Mat4 | reactormonk: so the index is truncated to int32 ? |
23:16:33 | BlaXpirit_ | for int64 to be a valid index |
23:16:55 | BlaXpirit_ | just convert it gee |
23:17:05 | * | saltylicorice joined #nim |
23:17:19 | BlaXpirit_ | dom96, should i report in araq/nim |
23:17:24 | BlaXpirit_ | about doc2 |
23:17:57 | EXetoC | is this the same issue? the issue we talked about was reported a few months ago |
23:18:06 | EXetoC | oh |
23:18:09 | EXetoC | ok |
23:18:15 | EXetoC | context.. |
23:22:33 | * | saltylicorice quit (Ping timeout: 244 seconds) |
23:28:48 | reactormonk | do we already have an option type? |
23:30:01 | flaviu | reactormonk: Nope. |
23:30:04 | goobles | i'm sure some nimrod made one |
23:30:23 | reactormonk | flaviu, too bad |
23:30:43 | goobles | u can make one |
23:30:46 | goobles | and submit it |
23:30:49 | goobles | and be famous |
23:30:55 | * | Demos_ joined #nim |
23:31:00 | reactormonk | ... sometimes I wish I kept op in this channel |
23:31:22 | flaviu | I did write an Option once: https://gist.github.com/420210d6ea558d83f3cd |
23:32:01 | reactormonk | flaviu, I think you forgot the most important part: flatmap and map |
23:32:30 | flaviu | I'm really meh on lambdas in Nim, feel free to do that though. Should be easy. |
23:32:53 | flaviu | reactormonk: Also feel free to post it on Nimble, my code is licensed under MIT. |
23:35:06 | * | saltylicorice joined #nim |
23:37:54 | goobles | why do you use lower case bool and then upper case Bool? |
23:38:23 | BlaXpirit_ | goobles, probably old code |
23:38:27 | flaviu | goobles: That's old code, since when that was valid. I should update it. |
23:38:34 | BlaXpirit_ | when things were completely case insensitive |
23:39:12 | Sembei | what are the best options to debug nim? anything visual? |
23:40:03 | def- | Sembei: gdb works |
23:40:04 | flaviu | gokr has had good experiences with KDevelop and GDB: http://irclogs.nim-lang.org/02-01-2015.html |
23:40:34 | Sembei | def-: but anything visual |
23:40:36 | Sembei | ? |
23:40:43 | Sembei | to set breakpoints |
23:40:45 | gokr | KDevelop is visual |
23:40:52 | def- | Sembei: anything that works with C maybe? I'm not sure |
23:41:04 | gokr | I also tried Nemiver and it worked, but KDevelop was smoothest. |
23:41:14 | Sembei | Nemiver? |
23:41:25 | gokr | I think that's the name... |
23:41:36 | Sembei | well I'm on os x |
23:41:42 | Sembei | so kdevelop is not an option |
23:41:46 | Sembei | afaik |
23:41:57 | gokr | ah, well, any gdb frontend should work |
23:42:05 | gokr | I haven't played on OSX. |
23:42:43 | gokr | You need to compile with --debuginfo and --lineDir:on |
23:42:45 | * | Mat4 left #nim (#nim) |
23:42:52 | gokr | Then just debug it. |
23:43:03 | flaviu | Sembei: I find the hardest part of text-mode gdb is getting started |
23:43:09 | gokr | Stepping in/out/over etc - with proper nim source and breakpoints etc works fine. |
23:43:12 | flaviu | once you memorize a few commands, it's pretty easy. |
23:43:14 | Sembei | yup |
23:43:24 | Sembei | well is not that is complicated |
23:43:30 | gokr | But exploring data doesn't really work of course. |
23:43:39 | Sembei | is that you need two separated windows |
23:43:54 | gokr | Araq has some ideas there |
23:44:08 | Sembei | and follow code by hand is kinda meh |
23:44:33 | flaviu | Sembei: GDB prints the currently executing line. |
23:44:45 | Sembei | i know |
23:44:52 | Sembei | but you need terminal |
23:44:58 | Sembei | and scroll all code |
23:45:01 | gokr | Why so obsessed with gdb? The frontends are nice. |
23:45:02 | Sembei | on your editor |
23:45:10 | Sembei | +gokr |
23:45:16 | Sembei | *+1 |
23:45:52 | Sembei | watch a variable with a single click or things like that |
23:46:54 | Sembei | actually os x deprecated gdb |
23:46:56 | Sembei | it uses lldb |
23:47:59 | gokr | Haven't tried, but... if it supports the lineDir stuff, and I guess it should - then perhaps it works just fine. |
23:48:38 | Sembei | is almost the same as gdb but is based on llvm |
23:53:08 | Sembei | just an IDE with debug, code lint and autocomplete can skyrocket Nim |
23:56:14 | * | saltylicorice quit (Ping timeout: 265 seconds) |
23:57:08 | * | saltylicorice joined #nim |
23:57:38 | goobles | a visual studio pluggin derp derp |
23:57:42 | * | z1y joined #nim |
23:57:44 | goobles | ya right nobody will make dat |
23:57:54 | flaviu | goobles: Someone has already made one. |
23:58:17 | xAndy | is there a way to nest iterators or call them recursively? basically i want the yield statement in another block/function/iterator than the called iterator |
23:58:48 | flaviu | Does anyone know who Alex Prengel is? I'd appreciate it if he took down http://web.mit.edu/nimrod-lang/README.athena so it doesn't show it in my google results. |
23:59:33 | flaviu | That, or kept the docs and code up to data :) |
23:59:49 | BlaXpirit_ | i'm pretty sure i saw that too |
23:59:53 | * | z1y quit (Remote host closed the connection) |