<< 03-01-2015 >>

00:00:10flaviuI don't understand how his name works
00:00:31*Demos_ quit (Ping timeout: 244 seconds)
00:00:43skyfexjpoirier: 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:55jpoirierskyfex: 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:11skyfexjpoirier: 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:11skyfexdon't have to see unsigned numbers
00:03:22skyfexI'm actually noticing it myself right now
00:03:39skyfexI'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:47jpoirierskyfex: agreed, but it just comes down to understanding the difference between arithmetic vs logical operations.
00:07:16jpoirierskyfex: 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:11skyfexWhy not apply bitwise operations on signed numbers?
00:08:46*vbtt joined #nim
00:09:21*rpag quit (Quit: Leaving)
00:09:48skyfexIf 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:21flaviuskyfex: 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:07skyfexflaviu: 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:10renesacor when adding it to a signed integer
00:16:24jpoirierskyfex: example, int a = -8; a >> 2 = -2; unsigned int b = 8; b >> 2 = 4
00:16:40renesac-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:56renesacoh, the tutorials are now in Learn, not on Docs, I missed it
00:21:09jpoirierE.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:35renesacmaybe it would be good to add something at the docs page pointing to the learn page
00:22:30renesacbut maybe I'm the only one blind here
00:23:15skyfexjpoirier: 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:21skyfexScratch that, you're right for shift
00:24:35skyfexIn C
00:24:59skyfexIn my opinion that's a design error in C
00:25:31renesacskyfex, but it is still very error prone to use +% in nimrod
00:25:52renesacthat was one of the reasons araq finally introduced unsigned numbers in nimrod
00:27:00flaviurenesac: It's nim now :)
00:27:13skyfexrenesac: hm, yeah, nim does overflow checking, that complicates things
00:27:25TriplefoxI agree about using unsigned for bit patterns. It's really irritating when the language wants to act like everything is a number
00:27:54def-skyfex: you can disable them for part of your code iirc
00:28:03*chrisheller quit (Ping timeout: 252 seconds)
00:28:13skyfexTriplefox: Then there should be a bitvector type, rather than unsigned.. which is still a number ;)
00:28:16jpoirier 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:50jpoiriers/unsigned time/unsigned type
00:29:03skyfexjpoirier: I make hardware for a living :P
00:29:05renesacflaviu, err, I will take sometime to internalize that
00:29:08renesac:P
00:29:14renesacdamn americans, I liked the name nimrod
00:29:22ekarlso-hmmm
00:29:29ekarlso-how can I check if a field of a obj is set ?
00:29:40ekarlso-if obj.field != nil isn't working too good
00:30:21jpoirierskyfex: oh, well, then you know more about it than me. for sure
00:30:32flaviurenesac: You're just jealous of our freedom ;). ekarlso-: You can't, that doesn't make sense
00:30:49skyfexjpoirier: not necessarily.. you might have experience with other architectures than me
00:30:50flaviuekarlso-: It'd require nim have a bit for each field and set it on first assignment
00:31:07ekarlso-flaviu: so if a object is created with one of the fields not set how then ?!
00:31:16skyfexjpoirier: but say AVR8, the ADD instruction is the same for signed and unsigned numbers
00:31:47skyfexThe 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:56skyfex*arithmetic shift right
00:31:58def-Oh, SO activity: https://stackoverflow.com/questions/27750045/statement-list-composition
00:32:04flaviuekarlso-: 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:34ekarlso-flaviu: no tfollowing that bit but
00:32:58skyfexjpoirier: 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:05flaviuekarlso-: type mytype = object; myfield: T; myfieldset: bool
00:33:21TriplefoxI'm coming more from the perspective of languages like js or lua where they just cut you off without giving options
00:33:22jpoirierskyfex: 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:30ekarlso-flaviu: that just seems weird
00:33:46TriplefoxI am open to "better than uint" as an idea
00:33:55skyfexjpoirier: Yes, you're right, considering >> becomes arithmetic shift on signed
00:34:07flaviuekarlso-: What programming background are you from? It might help me tailor my answers better.
00:34:33ekarlso-pythom ;)
00:35:04jpoirierskyfex: but I always used signed types when writing logic in conditionals, etc
00:35:13*superfunc quit (Ping timeout: 246 seconds)
00:37:34flaviuekarlso-: 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:34flaviuIn 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:40flaviuekarlso-: Does that make sense so far?
00:38:06*superfunc[mobile joined #nim
00:39:34jpoirierskyfex: 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:46skyfexjpoirier: 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:21ekarlso-flaviu: ye
00:41:25ekarlso-flaviu: http://imgur.com/sKMu2yf
00:41:32ekarlso-ehm, generally ^ that link
00:41:39*viralata quit (Quit: leaving)
00:41:44ekarlso-it actually works with a nim backend
00:41:53skyfexjpoirier: they're not, unsigned types are there more or less, but there's some bugs
00:43:48flaviuekarlso-: 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:03skyfexjpoirier: But I'm trying to fix them at the moment :)
00:44:07ekarlso-flaviu: ahhh ok
00:44:18ekarlso-dom96: tmrw i'll add tags stuff and so on
00:44:21ekarlso-getting there slowly
00:44:29jpoirierskyfex: 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:09jpoirierskyfex: 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:18skyfexjpoirier: The whole situation is not well resolved yet is my impression
00:54:55skyfexSome wrappers were created before uint and pals were added I suppose
00:55:22skyfexThe current c2nim translates unsigned int to uint etc.
00:58:41jpoirierskyfex: it' can be confusing stuff to think about and second guessing the correctness of the language would be a problematic
01:04:29nimnoob123trying 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:38renesacbabel = nimble?
01:11:46*Ven joined #nim
01:14:36skyfexrenesac: yeah
01:18:36nimnoob123yea, renamed in latest update
01:20:16def-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:28ldleworkman
01:26:41ldleworkdowncasting 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:59ldleworkthis is perplexing
01:33:07ldleworkI have a function which takes a Foo
01:33:26ldleworkin one place in my program, I create a Bar which is a subtype of Foo, and pass it to this function
01:33:39ldleworkthe resulting machinery correctly calls the methods of Bar
01:33:56ldleworkin 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:11ldleworkthe same resulting machinery calls the methods defined on Foo
01:34:22ldleworkI'm a bit perplexed
01:34:58ldleworkI presume that somewhere my Baz is getting downcast
01:35:08ldleworkbut I just don't see how
01:35:12ldleworkthe types are defined the same
01:35:15ldleworkthey are initialized the same
01:35:18ldleworkand passed to the same function
01:35:31ldleworkI wish I knew how to debug nim programs
01:37:37nimnoob123hmm 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:52def-nimnoob123: so nimble ships with the wrong libraries?
01:39:14ldleworkIs there anyway to just magically print the type of a name?
01:39:17nimnoob123def-: possibly, i have a 64bit machine maybe they ship w/ 32bit?
01:39:38def-ldlework: type of a name or name of a type?
01:39:49def-nimnoob123: should ship with both then I guess?
01:40:14ldleworkdef-: the type of an arbitrary variable
01:40:21ldleworkwell
01:40:30ldleworkthe name of the type of an arbitrary variabe, for printing purposes
01:40:38ldleworkvariabe.
01:40:41nimnoob123def-: 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:42def-ldlework: import typetraits; echo name(type(myVariable))
01:40:46ldleworkdef-: thanks
01:41:40def-nimnoob123: i'd suggest a bugreport to nimble then
01:41:55nimnoob123def-: alright
01:42:17*ehaliewicz quit (Ping timeout: 240 seconds)
01:43:03ldleworkdef-: 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:41def-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:44def-this seems to call the right methods
01:45:59def-because all types are refs, otherwise it's wrong
01:46:21ldleworkdef-: yeah, for one subclass it calls the right methods
01:46:32ldleworkfor the other subclass, when I pass it to the *same* function, it get's downcast
01:46:35ldleworkand the base methods are called
01:46:57def-is the other subclassa ref object too?
01:47:03*onionhammer joined #nim
01:47:24ldleworkthey are both "object of Foo"
01:47:32def-should be "ref object of Foo"
01:47:41ldleworkdef-: I don't create ref types
01:47:45ldleworkI use ref's explicitly
01:47:49ldleworklets not have that argument
01:47:52ldleworkboth types here are the same
01:47:58ldleworkthat's all that matters
01:48:13def-no idea then
01:55:04ldleworkhahaha
01:55:10ldleworkhelps if you import the module with the methods
01:55:13ldleworkfuck
01:56:28*johnsoft joined #nim
02:01:23jpoirierthis 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:03nimnoob123jpoirier: that's cool
02:11:32jpoiriernimnoob123: 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:24MyMindexist do..while in nim?
02:27:02*Y0Gi_ left #nim (#nim)
02:28:28jpoirierdon't think so http://nim-lang.org/manual.html
02:28:53*willwillson quit (Ping timeout: 240 seconds)
02:29:00def-MyMind: no, but you can write it yourself: https://github.com/def-/nim-unsorted/blob/master/dowhile.nim
02:29:48MyMindjpoirier: i was looking on the manual
02:30:44MyMindty def-
02:32:32jpoirierMyMind: 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:14MyMindit's ok jpoirier
02:33:25*yglukhov__ joined #nim
02:35:49flaviuI personally like `while true: ...; if not cond: break` better
02:36:07flaviuand you can do that without extra templates
02:37:02*kapil__ joined #nim
02:37:44*yglukhov__ quit (Ping timeout: 245 seconds)
02:40:06MyMindfor practising I'm porting a C program
02:43:38no_namehow to you cast null pointers in nim?
02:44:03renesacflaviu, yeah, that template from def- isn't very nice to use
02:44:19renesacthe good thing about do .. while is that the condition is at the end of the loop
02:44:47flaviuno_name: What are you trying to do?
02:44:58renesacMyMind, you are better off doing that using a while: true + if as flaviu said
02:45:02renesacIMHO
02:45:16MyMindyup im doing that
02:45:16no_nameI'm populating a stream in the zlib library. It has fields which are function pointers that I want to set to null
02:45:31flaviuno_name: `NULL` in C is `nil` in Nim.
02:46:18no_namethanks
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:48MyMindan equivalent of fabs in nim?
02:59:47def-MyMind: what's fabs?
02:59:54MyMindfloat abs
02:59:59def-import math; abs()
03:00:12MyMindis not in math I think
03:00:20def-oh, right
03:00:33def-it's in system, no import necessary
03:01:06def-For finding Nim stuff there's http://nim-lang.org/theindex.html
03:01:28jpoirierhttp://nim-lang.org/system.html#abs,float
03:03:20*superfunc|home joined #nim
03:06:50superfunc|homedom96: for 1.0, is there plans to include nimble with the install?
03:08:46*ehaliewicz joined #nim
03:09:18dyudef-: what's your os?
03:09:41dyudef-: I just updated nim to devel and your macro example still failed (I'm on ubuntu)
03:11:15def-dyu: linux x86-64
03:11:23def-strange
03:11:25dyuhmm
03:11:29dyusame here
03:11:38dyucompile options you passed?
03:11:47def-none
03:11:51def-nim c mm
03:12:25def-Can anyone else check if this compiles for them? https://github.com/Araq/Nim/issues/1843
03:15:09*chrisheller joined #nim
03:17:21jpoirierdef-: eOS x86_64, nim v 0.10.3, works
03:17:50dyuubuntu 13.04 x64, fails
03:18:26def-jpoirier: thanks. Is eOS elementary OS?
03:18:38jpoirierdef-: yes
03:19:15dyudef-: gcc version?
03:19:32dyumine is gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-2ubuntu4)
03:19:43jpoirierdef-: 4.9.2
03:19:49*darkf joined #nim
03:20:10*dyu spins up a VM
03:20:31def-the error indicates that it doesn't even get to gcc, dyu
03:20:43def-but i have gcc 4.8.4
03:21:02dyuwell the compiler is built with gcc
03:21:08dyu4.7.3
03:21:37def-oh yeah, but i somehow don't want to believe it's a gcc bug
03:25:33jpoirieri'll check with gcc 4.8 as well, hold a sec...
03:28:37jpoiriereOS gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2, it works fine
03:29:06def-dyu: maybe you have an older nim version in your path?
03:29:49dyudef-: Nim Compiler Version 0.10.3 (2015-01-03) [Linux: amd64]
03:30:07*ehaliewicz quit (Remote host closed the connection)
03:30:11dyufrom nim -v
03:30:27def-no idea then =/
03:31:43jpoirierjust curious, what's the error msg?
03:32:21dyujpoirier: in the link def posted
03:32:30jpoirierdoh, never mind; it's on the webpage
03:32:50jpoirierlol
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:29jpoirieri think it's 300 or so
03:35:20def-faster to download the zip of devel HEAD for quick tests
03:36:37dyuyea, too bad i'm already 80% in :/
03:36:52renesacthe nim repository is only about 30mb now
03:37:22renesacit used to be 300+mb
03:37:57renesacbecause a lot of cruft on the history
03:38:41renesac32.16 MiB my clone
03:38:46dyurenesac: my fork probably is linked to the old one, which is the one I'm checking out on
03:38:56dyuthe old one with all the history
03:39:07renesacit was months ago, that cleaning...
03:39:08def-so you're running your own fork of Nim, dyu!
03:39:23dyudef-: the fork 'devel' with no changes
03:39:32dyujust keeping up with upstream
03:39:57renesacthere was some instructions for those with forks to update to the new smaller repo
03:40:01renesacat the time
03:40:07*dyu was absent
03:40:12dyuat that time
03:41:12renesacdyu, http://forum.nimrod-lang.org/t/417
03:41:32renesacand: https://github.com/Araq/Nim/issues/958
03:42:04dyuyea I missed that
03:48:20MyMindhow do I translate ip = (int)((t + 22.5)/45) & 0x7 to nim
03:48:28MyMindand bitwise operator
03:50:08def-ip = int((t + 22.5)/45) and 0x7
03:50:31*Demos_ quit (Ping timeout: 255 seconds)
03:53:20MyMindty def-
03:54:41MyMindwhat is the best approach for void functions
03:54:58MyMindreturn an int and pragma discard?
03:55:08MyMindor just void type
03:55:31def-why would a void function return an int?
03:55:44def-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:43def-dyu: you can also try in the nim dir: ./koch temp c file.nim to get a backtrace
04:00:44MyMindyou can put void ?
04:01:05def-MyMind: prox foo(x: int) = echo "Hello ", x
04:01:09def-proc*
04:02:57dyudef-: ok I tried it and here's the trace: sempass2.nim(823) trackProc
04:03:11dyuthat's the last one before SIGSEGV
04:03:59jpoirierwow, 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:39dyudef-: on ubuntu 14.04 x64 with gcc 4.8.2, i get the same error
04:05:52dyuon 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:55dyui'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:48dyudef-: no joy, still doesn't work on gcc 4.9
04:32:57renesacwhat are you testing?
04:32:58dyu4.9.2
04:33:53dyurenesac: https://github.com/Araq/Nim/issues/1843#issuecomment-68580385
04:34:06dyurenesac: are you on ubuntu?
04:36:27jsudlowhi all is there a diffrence between a string and a cstring in nim?
04:39:22dyujsudlow: yea the former is garbage collected
04:40:01jsudlowdye: do you know how to create a cstring in nim? this render text solid function from the sdl_ttf lib requiers it
04:40:03dyuis backed by a different datastructure that wraps a char array
04:40:10jsudlow*dyu:
04:40:21dyuconst foo: cstring = ""
04:40:40dyuproc foo(f: cstring) = ... then call foo("sdfsdf")
04:40:43dyuits automatic
04:41:21jsudlowdyu: so if I wanted to supply a cstring as a parameter to a function I could just do const foo: cstring =""
04:41:24jsudlowand pass foo as the param?
04:42:06dyusorry 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:44dyujsudlow: in short, just pass a literal, it gets handled correctly
04:42:52*ldlework nods
04:43:16renesacdyu: yes, I'm on ubuntu
04:43:26dyurenesac: did it compile?
04:43:27renesacand yes, it compiles here
04:43:30dyufark
04:43:50renesacI just bootstraped nim
04:44:00renesacI'm probably with the latest devel
04:44:01dyurenesac: what version?
04:44:04renesacwait
04:44:05dyuos
04:44:14dyugcc
04:45:12renesacUbuntuVersion
04:45:12renesac14.04
04:45:12renesactrusty
04:45:55renesacgcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
04:46:53dyurenesac: can you post the exact commands where you bootstrapped, and compiled the example?
04:47:02dyuI'll try to follow it word-for-word
04:47:43*NimBot joined #nim
04:47:51renesacI made a new clone for Nim (didn't try to update the old Nimrod one)
04:48:03renesacbootstraped as described in the readme
04:48:49renesacand compiled with:
04:48:52renesacnim c -r test.nim
04:48:58renesacsimple
04:49:19renesacsee if you copied correctly the example in the first place
04:51:02flaviujsudlow: another difference is that a cstring is null terminated while a string has a length field.
04:51:22renesaca string is also null terminated on nimrod, isn't?
04:51:33ldleworkyes
04:51:40renesacexactly for C interop
04:51:40flaviuYes, so that conversion to a cstring is O(1)
04:52:07flaviuldlework: of course there exists an index, nim-lang.org/theindex.html
04:52:17ldlework`the`index.html
04:52:19ldleworkof course
04:52:24ldleworkwe should probably link to it
04:52:52flaviuldlework: http://nim-lang.org/documentation.html#search-options
04:53:23flaviuanyway, 'night
04:53:26dyurenesac: rename test.nim to quote.nim
04:54:59renesacdyu,
04:55:00renesaclol
04:55:02*dyu just wasted more than an hour
04:55:07renesacI get the error
04:55:18dyufor a silly bug
04:55:31renesacwhat is the reason?
04:55:59dyuits a bug in nim, not sure what "quote" has to do with it
04:56:04dyubut it triggers it
04:56:22renesacright, it is in the code too
04:56:38renesacbizarre
04:57:02dyurenesac: you helped me track it down :-)
04:57:04dyuthanks
04:57:49dyuI figured, all the steps were the same, ... let's try changing the filename ... then BOOM!
04:58:58ldleworkI really wish we had a module system that divorced the modules/namespaces from the filesystem
04:59:28renesacyou are welcome
05:02:02*nimnoob123 quit (Quit: Page closed)
05:11:20ldleworkthe 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:30superfunc|homejust curious, for uniformity, when we go to 1.0, should json be called parsejson to match up with parsecsv, parsexml, parsecfg?
05:12:51SplinterOfChaosIs 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:50renesacnimrod compiles to C, so you can aways make C as fast as nimrod, with sufficient effort
05:19:54renesacbut 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:48renesacnimrod is a typed language that tries to be expressive, but the design decisions are very focused on efficiency too
05:23:11renesac /s/nimrod/nim
05:23:58renesacnim is alergic to any type of runtime overhead, it prefers compile-time mechanisms
05:24:23renesacthat is what I can say from the top of my head SplinterOfChaos
05:24:39renesacgood night
05:24:54*renesac is now known as renesac|away
05:27:08SplinterOfChaosthanks
05:31:38jsudlowhi all: does anyone know the difference between these 2 mismastches? Error: type mismatch: got (PSurface) but expected 'PSurface'
05:32:18dyujsudlow: thats basically the same, any snip?
05:32:41jsudlowdye: just trying to set a surfaceText to a field on a type
05:32:53jsudlowmethod enter*(self: ref MenuScene) =
05:32:53jsudlow var myFont = openFont("src/fonts/Pacifo.ttf",14)
05:32:53jsudlow var myColor = sdl.TColor(r:250, g:250, b:250)
05:32:53jsudlow var surfaceText = renderTextSolid(myFont,"My test Font",myColor)
05:32:53jsudlow self.menuText = surfaceText
05:33:10jsudlowself.menuText = surfaceText complains of that type mismatch
05:33:45jsudlowand my type is MenuScene* = object of Scene
05:33:45jsudlow menuText*: graphics.PSurface
05:33:51ldleworkjsudlow: use gist
05:35:32ldleworkjsudlow: oh
05:35:48ldleworkI think graphics has its own PSurface
05:35:50dyuit might be the graphics.PSurface expression, you've have to import "foo" as graphics I think
05:36:24ldleworkyeah so we just need to make a graphics.PSurface from the sdl.PSurface
05:37:18jsudlowldlework: yea that worked
05:37:20ldleworkjsudlow: use this instead of sdl_ttf http://nim-lang.org/graphics.html#newFont,string,int
05:37:30ldleworkIE, load your font with this
05:37:34ldleworkget a graphics.PSurface back
05:37:37ldleworkall is good
05:37:42ldleworksee
05:37:56jsudlowall is well :_
05:37:57jsudlow:)
05:37:59ldleworknice
05:38:49jsudlow* 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:39adam_scan 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:43adam_sbut I can't seem to get the compiler to accept XDeclaredButNotUsed
07:08:27dv-that's a hint
07:08:44ldleworkheh
07:09:04adam_ssame problem using --hint
07:10:33adam_scould you give an example of a valid compilation command which disables XDeclaredButNotUsed?
07:10:41adam_ssay for a file named file.nim
07:13:38dv-nim --hint[XDeclaredButNotUsed]:off
07:13:44dv-apparently
07:15:32*gour joined #nim
07:15:39adam_syep, zsh seems to be breaking it for me
07:15:42adam_sthanks
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:58tanegood morning
07:45:45dts|pokeballgood 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:35dts|pokeballhrmmm... i think im going to have to use threads :/
08:15:30ldleworkfor what
08:15:52dts|pokeballNimbus
08:16:08ldleworkright; for what?
08:16:20dts|pokeballoh
08:16:31dts|pokeballso, watch this and wait 10 ssecs
08:16:47dts|pokeballoh wait mimbus is offline
08:16:49dts|pokeballanyways]
08:17:19*yglukhov__ quit (Ping timeout: 245 seconds)
08:17:21dts|pokeballif i want to prevent things like real infinite loops, i need to do timeouts
08:17:41dts|pokeballi talked to eelis, who wrote geordi (the c++ eval bot) and he suggested alarm
08:18:51dts|pokeballso 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:16dts|pokeballunless you can think of a better solution ldlework ?
08:21:34ldleworkdts|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:34ldleworkwhich is essentially a system where the bot actually spins up a new container with the input
08:22:44ldleworkthe container just compiles and outputs a file, which the bot then reads and spits out
08:23:00dts|pokeballhmmm... maybe
08:23:18ldleworklike
08:23:19ldleworkwouldn't
08:23:27ldleworknim c -r somefile > output.txt
08:23:28ldleworkwork
08:23:38ldleworkyou don't need any extra machinery in the container
08:23:39*noriok joined #nim
08:23:41ldleworkjust the compiler
08:24:30dts|pokeballwell see, the issue with that is writing errors
08:24:38dts|pokeballmy current system grabs the errors
08:25:06ldleworkdts|pokeball: I'm pretty sure unix has a way of filtering the stdout and stderr to different files
08:25:25ldleworkhttp://stackoverflow.com/questions/7901517/how-to-redirect-stderr-and-stdout-to-different-files-in-the-same-line-of-bash
08:26:14dts|pokeballhrrrmmmm
08:27:15dts|pokeballhey ldlework :) wanna do me a favor?
08:27:50ldleworkdocker run -d -v /nimbus/input/AFE39DD.txt:/input.txt -v /nimbus/outputAFE39DD.txt:/output.txt nimbus
08:28:49*yglukhov__ joined #nim
08:28:51ldleworksomethin like that
08:30:12dts|pokeballbut 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:45ldleworklol
08:31:52ldleworksubstitute whatever you want
08:32:28*NimBot joined #nim
08:35:00dts|pokeballso 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:08dts|pokeballwhat are the colon things?
08:36:17ldleworkdts|pokeball: you run nimble outside the container
08:36:20ldleworkon the host
08:36:30ldleworknimble talks to docker
08:36:36*noriok quit ()
08:36:39ldleworkto start containerized nim compilers
08:37:13*dts|pokeball is still confused :/
08:37:35ldleworkdts|pokeball: you have a program
08:37:37ldleworknimbus
08:37:40ldleworkwritten in nim
08:37:43ldleworkit can do 2 things
08:37:46ldleworkconnect to irc
08:37:52ldleworkand shell out to the docker cli tool
08:37:56ldleworkwhen someone types .eval
08:38:00ldleworkyou take their text
08:38:05ldleworkwrite it to a file in a known location
08:38:11ldleworkthen you shell out to docker
08:38:36ldleworktelling docker to start a new container, that runs "nim c -r /input.txt > /error.txt > /output.txt" or whatever
08:38:46ldleworkyou mount the files inside the container, to files on the host
08:38:50ldleworkthat's what the -v flags are
08:39:04ldleworkso that when the output of the nim compiler get's piped to the files inside the container
08:39:10ldleworkthey are really writing to files on your host
08:39:19dts|pokeballok wait
08:39:21ldleworkfiles that nimbus can read and spit back to the irc user
08:39:54dts|pokeballso /AFE39DD.txt is the one inside docker and input.txt would be the one mounted on the host?
08:40:00ldleworkno
08:40:13ldleworkAFE39DD is a random token you assign to this specific compilation request
08:40:23dts|pokeballpj
08:40:25ldleworkyou remember "ldlework's token is AFE39DD"
08:40:26dts|pokeball**oh
08:40:31*SplinterOfChaos joined #nim
08:40:34ldleworkinside the container
08:40:37ldleworkthe file names are generic
08:40:45dts|pokeballoh, so i got it backwards
08:40:53ldleworkso that the "nim c -r /input.txt ..." command can always be the same
08:41:54ldleworkdts|pokeball: with this, you can easily control the memory and cpu that each compilation can utilize
08:42:03ldleworkyou can let people write to disk in their examples
08:42:12ldleworkand clean up anything they do by deleting their container
08:42:19ldleworkyou can make it so they don't have a network
08:42:34dts|pokeballhmmm good point. how late are you going to be up so i can get you to review my work?
08:42:40ldleworkand nimbus can have an async timer that schedules a pre-emptive deletion of the container if it takes too long
08:43:06ldleworkdts|pokeball: a while but I wont have much attention
08:43:11dts|pokeballok
08:43:11ldleworkI'll have some
08:43:26dts|pokeballwell ill get started then anyways
08:44:08ldleworkdts|pokeball: I would start by building a Nim docker image
08:44:15dts|pokeballhow do i do that?
08:44:24*MrOrdinaire joined #nim
08:44:25dts|pokeballactually, let me back up
08:44:25ldleworkwriting a Dockerfile
08:44:38dts|pokeballno wait never mind i understand
08:44:45ldleworkso the ocmpiler can run in the container
08:44:49dts|pokeballso i guess i have to learn to write a dockerfile
08:44:50ldleworkFROM ubuntu:latest
08:44:56ldleworkRUN
08:45:03ldleworkthen everything to compile nim's compiler, etc
08:45:06ldleworkjust like on your local host
08:45:33dts|pokeballoh, so i need an ubuntu image with nim on it. duh
08:45:40ldleworkhttp://docs.docker.com/userguide/dockerimages/#creating-our-own-images
08:45:59ldleworkhttp://docs.docker.com/reference/builder/
08:46:04dts|pokeballim going to focus on creating the async timer last
08:46:10ldleworkdts|pokeball: good idea
08:46:41dts|pokeballok, one last question...
08:47:00ldleworkchose wisely
08:47:04ldleworkhehe just kidding
08:47:25*gokr_ joined #nim
08:47:42dts|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:33ldleworkeh you dont need a data container
08:48:35ldleworkjust map files directly to your host
08:48:45ldleworkunless you plan on moving nimbus around to different hosts a lot
08:48:53ldleworkeven then it doesn't matter, its more for like
08:48:59ldleworkah I don't have time to explain
08:49:16dts|pokeballwhat does map files directly to your host mean?
08:49:26*adam_s quit (Quit: Leaving)
08:49:34dts|pokeballoh wait
08:49:53ldleworkdts|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:05ldleworkso that when the container starts up and tries to compile /input.txt
08:50:12dts|pokeballi guess you just mean generate a token, and just make it known throughout that current run of the loop
08:50:14ldleworkit has the contents of /nimbus/inputs/ldlework.txt
08:50:17*gokr quit (Ping timeout: 240 seconds)
08:50:17ldleworkyes
08:50:27ldleworkdts|pokeball: is your application async?
08:50:37ldleworkcan you do multiple async i/o operations?
08:50:41dts|pokeballsorry. im a bit tired. thanks for all of the input :) and no. its TCP sockets
08:50:46ldleworkouch
08:50:51dts|pokeballbut im willing to change it
08:51:03ldleworkdts|pokeball: well I don't know *anything* about Nim's async support
08:51:09ldleworkI'm used to Python's twisted
08:51:19dts|pokeballhrrmmm
08:51:25ldleworkso someone else would have to help you rework the actual nim app to be async
08:51:26dts|pokeballill ask dom96 about it in the morninng
08:51:30ldleworksure
08:51:46ldleworkdts|pokeball: what lib are you using for irc
08:51:58dts|pokeballim not. im just using sockets.
08:52:07ldleworkokay you wernt kiddin
08:52:10ldlework:)
08:52:27dts|pokeballsince its not that hard to parse irc, i didnt feel like using a full irc lib
08:52:42dts|pokeballespecially since im parsing an incredibly small subset
08:52:44ldleworkyeah but I wonder if the irc lib is already built ontop of asyncore
08:52:52ldleworkdts|pokeball: okay first step
08:52:54dts|pokeballdom96 told me it uses sockets
08:52:58ldleworklearn asyncore and async/wait
08:53:12dts|pokeballyeah, ill do that after docker though
08:53:19ldleworkwell I don't think you can really
08:53:25dts|pokeballwhy?
08:53:36ldleworkhmm I guess you can poll
08:53:45ldleworkbut when you're doing docker stuff
08:53:49ldleworkand waiting for compilation
08:53:59ldleworkwont IRC disconnect because you're not responding to pings?
08:54:01ldleworkand so on
08:54:12dts|pokeballhuh... good point
08:54:12ldleworkhow does that work
08:54:16dts|pokeballalthough
08:54:33dts|pokeballno never mind. yeah it might be better to do that first
08:54:41ldleworkdts|pokeball: it'll be a great skill
08:54:42ldleworkand in the end
08:54:57ldleworkthe bot wil be able to be in multiple channels responding to multiple compilation requests simultaneously, etc
08:55:03dts|pokeballooooo sexy
08:55:19dts|pokeballdo you have any sources for learning async io? it doesnt have to be in nim
08:55:24dts|pokeballpython/c++ works
08:55:45ldleworkdts|pokeball: its a hard subject, but if you already know python you might be able to learn Twisted's basics
08:55:49ldleworkI mean
08:55:54ldleworkIt was hard for me. But I'm a twit.
08:56:01dts|pokeballdamn :/ i am too
08:56:04ldleworkhaha
08:56:06dts|pokeballbut ill give it a shot
08:57:06ldleworkhttp://krondo.com/wp-content/uploads/2009/08/twisted-intro.html
08:57:10dts|pokeballty
08:57:21ldleworkhttp://krondo.com/?page_id=1327
08:57:53ldleworkhttp://jcalderone.livejournal.com/tag/sixty%20seconds
08:58:02ldleworkhttp://twistedmatrix.com/documents/current/core/howto/index.html
09:16:40*dyu quit (Quit: Leaving)
09:19:46MrOrdinairehi, 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:24dv-what's wrong with p.a, p.b, p.c?
09:25:14MrOrdinaire`p.` is repeated? so there's no way to do that?
09:25:18ldleworkMrOrdinaire: take a slice
09:25:48MrOrdinaireldlework: can you show me an example?
09:26:58MrOrdinaireproc energy(bodies: NBody): float64 =
09:26:59MrOrdinaire var dx, dy, dz, distance: float64
09:26:59MrOrdinaire result = 0
09:27:01MrOrdinaire for i in low(bodies)..high(bodies):
09:27:02MrOrdinaire let (ix, iy, iz, ivx, ivy, ivz, imass) = bodies[i]
09:27:04MrOrdinaire result += 0.5 * imass * (ivx * ivx + ivy * ivy + ivz * ivz)
09:27:06MrOrdinaire for j in i+1..high(bodies):
09:27:08MrOrdinaire let (jx, jy, jz, jvx, jvy, jvz, jmass) = bodies[j]
09:27:10MrOrdinaire dx = ix - jx
09:27:12MrOrdinaire dy = iy - jy
09:27:14MrOrdinaire dz = iz - jz
09:27:16MrOrdinaire distance = sqrt(dx*dx + dy*dy + dz*dz)
09:27:18MrOrdinaire result -= (imass * jmass) / distance
09:27:20MrOrdinairesorry for the mess
09:27:25MrOrdinairehttps://gist.github.com/anonymous/3565c9711ab2a099db76
09:27:29dts|pokeballuse a fucking paste mate
09:27:47MrOrdinairedv-: this is the piece of code i'm writing
09:28:27ldleworkMrOrdinaire: it is polite to use a service like Gist, to link to snippets of code
09:28:32ldleworkrather than flooding the channel
09:28:41MrOrdinairesorry for that
09:28:47ldleworkno worries
09:28:57MrOrdinaireI pasted the link afterwards
09:29:14ldleworkanyway I am currently perplexed by the behavior of assigning a slice
09:29:15ldleworkohhhh
09:30:02MrOrdinaireI guess `result = 0` is redundant
09:31:17MrOrdinairefor that piece of code, keep typing `bodies[j].` is a bit tiring
09:31:27dom96dts|pokeball: be more polite
09:31:30MrOrdinaireso unpacking helps
09:32:22dts|pokeballalright. it just annoys me when people paste to public channels
09:32:57MrOrdinairedts|pokeball: sorry for the mess
09:33:17dom96dts|pokeball: Doesn't mean you can't be polite.
09:33:31dts|pokeballMrOrdinaire, its ok :} sorry for the language. im grouchy cause im learning confusing io
09:33:35ldleworkdom96: he gets it
09:33:35dom96dts|pokeball: FYI the irc lib is async.
09:33:47dts|pokeballTIL
09:33:50ldleworkdom96: how do you unpack a slice into a tuple of variables?!
09:34:16BlaXpiritEXetoC, so I literally created a folder doc with an empty file of that name in it, and it worked
09:34:19MrOrdinaireso in that piece of code, jvx, jvy, jvz is never used. is there any way to get rid of them?
09:34:29BlaXpiritjust so you know, official package is broken in the exact same way
09:34:30dom96ldlework: i'm not sure what you mean
09:34:53ldleworkdom96: let (a, b, c) = [1,2,3,4,5][0..2]
09:35:11dom96ldlework: You can't destructure arrays/seqs that way.
09:35:18ldleworkthat's really unfortunate
09:35:30ldleworkbut ok
09:35:33ldleworkMrOrdinaire: there's your answer
09:36:07dom96there were talks of allowing: let (_, _, jz, jvx, ...) = bodies[j]
09:36:11ldleworkdom96: so you can't just convert a slice into a tuple with perhaps copy semantics?
09:36:16dom96but it's not implemented yet as far as I know
09:36:17MrOrdinairedom96: that would be nice
09:36:30dom96MrOrdinaire: It will help if you create a feature request for that on Github :)
09:36:33MrOrdinaireI tried that but it didn't work
09:36:40MrOrdinaireI see
09:37:03dom96ldlework: You could write a function that does it
09:37:17ldleworkdom96: it seems like it should be a core converter, honestly...
09:37:22dom96but that's a bit hackish
09:38:30ldleworkdom96: is it because tuples are named in Nim?
09:38:37ldleworktuple fields anyway
09:38:48dom96yeah
09:39:57ldleworkdom96: 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:34ldleworklike "tuple unpacking disregards tuple field names too, so why can't seq's?" kind of thing
09:40:45dom96I think seq/array unpacking should be possible
09:41:00ldleworkokay no inherent technical reason
09:42:43ldleworkdom96: have you found good uses for object variants?
09:42:48ldleworkthey seem interesting
09:43:04dom96yeah, lot's of uses.
09:43:13ldleworkneat
09:43:17ldleworkI'll think more about them then
09:43:23dom96They are better than using inheritance
09:43:43ldleworkhmm I'm thinking there might be cases where you need inheritance
09:44:00ldleworklike when methods are involved
09:44:30ldleworklets say there is some library for which there is a type
09:44:40ldleworkwell already you can see where this is going
09:45:00MrOrdinaireopened https://github.com/Araq/Nim/issues/1844
09:45:57dv-MrOrdinaire: i wrote that too! https://github.com/dvolk/nbody.nim
09:46:10MrOrdinairedv-: cool!
09:46:57dv-one version with vec tuples and one without
09:47:28dom96ldlework: I've been using Nim for like 5 years now and I still have not used methods once!
09:47:42MrOrdinairedv-: cool!
09:47:47ldleworkdom96: I believe you but I still can't even really understand that
09:48:03dom96I still don't get their purpose
09:48:19ldleworkdom96: maybe you could help me understand how to implement some of the patterns I'm used to without inheritance
09:48:19MrOrdinairedv-: I plan to reimplement problems in the benchmarks game (benchmarksgame.alioth.debian.org). I guess you are, too, right?
09:48:27ldleworkdom96: I use them for code reuse
09:48:31dom96ldlework: what patterns would those be?
09:48:48*VinceAddons joined #nim
09:48:57dv-MrOrdinaire: that's great. do they accept new languages?
09:49:13MrOrdinairedv-: I guess we can try
09:49:23ldleworkdom96: 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:23MrOrdinairedv-: This is my first time doing this
09:49:40ldleworkdom96: by changing the current scene, you can change the behavior of your program, like main menu, gameplay, high score, etc
09:49:55dom96MrOrdinaire: That's awesome!
09:50:19ldleworkdom96: sometimes its nice to have some base methods on the base Scene class, so that subclasses are free to override them
09:50:40ldleworkdom96: 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:48ldleworkso Scene has base implementations that just do discard
09:50:50MrOrdinairedom96: thanks
09:51:13ldleworkso 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:16dom96ldlework: This is how I implemented my game: https://github.com/dom96/ld25/blob/master/main.nim
09:51:20ldleworkdom96: I hope that's a sufficient explanation
09:51:26dom96instead of that I seem to use overloading
09:51:32ldleworkdom96: does it have anything to do with what I just described?
09:51:45dom96I have a State type which is the state of the game world
09:51:51ldleworkThat's not what I mean
09:52:01ldleworkI'm talking about State Machines, like Finite State Machine
09:52:38dom96But you're still implementing the same thing I am
09:52:43ldleworkAnyway if you read from the top of when I started describing it should make sense
09:52:45Triplefoxi tend to implement scene transition type stuff with polling first, and only switch to a more complicated pattern as needed
09:52:58ldleworkHow is a type called "state" the same thing? Does your type act as a delegate?
09:53:10Triplefoxif is_title: # draw title screen
09:53:15Triplefoxor somesuch
09:53:22ldleworkdom96: you're just using this type as the container for your game's data - that's not the same thing
09:53:38dom96I'm not saying it's the same thing.
09:53:45dom96I'm saying that we are both implementing games
09:53:55dom96Which are the same types of software
09:54:21dom96I also have a draw function in my code
09:54:25dom96But I don't use methods for it
09:54:33ldleworkdom96: your game only has one State, or Scene
09:54:43ldleworkyou don't transition from say, a Main Menu, to the Gameplay scene
09:54:51dom96true
09:54:52ldleworkSo, while we're both making games, that's not saying much?
09:55:07ldleworkSo like, if you read from the top of my description you could understand what I'm describing
09:55:07dom96At that point I would probably use object variants
09:55:17ldleworkit isn't about variance in fields though
09:55:24ldleworkI wish you would just read my words when offering to help lol
09:55:33dom96case scene: Scene
09:55:36dom96of MainMenu: ...
09:55:40dom96of Gameplay: ...
09:55:40dom96?
09:55:46ldleworkdom96: lets say I'm writing a game engine
09:55:50dom96I did read them!
09:55:51ldleworkso that you can write your game ontop of it
09:56:08ldleworkI have a system, that will run a scene passed to the scene manager
09:56:19ldleworkmy scene manager can't know all the possible scene type variants that you will introduce
09:56:25dom96And I know what you mean. I think for games inheritance may be advantageous.
09:56:25ldleworkthis is why dynamic dispatch is useful
09:56:33ldleworkah okay
09:56:50dom96But I would like you to try and implement it without it ;)
09:56:51ldleworkI think libraries in general, where the library is some sort of framework
09:57:04dom96And see how it compares.
09:57:08dom96Because I am curious.
09:57:14ldleworkdom96: but like, I have no solution
09:57:21ldleworkI've thought about it in other lanugages without inheritance
09:57:36ldleworkmaybe typeclasses, but what this loses
09:57:37dom96ldlework: Could you create a simple piece of code which demonstrates why you need inheritance?
09:57:44ldleworkI'll explain why
09:57:52ldleworklets say you replaced inheritance with typeclasses
09:58:00dom96Because then I could have a go at translating it to not use inheritance
09:58:04ldleworkso that the framework expects any kind of thing that adheres to the typeclass
09:58:10Triplefoxi implement a new function when i need a new scene AND i'm going to reuse it
09:58:26ldlework'implement a new function' doesn't really tell us anything?
09:58:43Triplefoxthe assumption i make is that that the default case is - new game, new rendering technique
09:59:01ldleworkuh what?
09:59:39ldleworkdom96: 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:41ldleworkthat would work
09:59:45Triplefoxin that situation, there is nothing to be reused and "scene managing" doesn't work anymore as an abstraction
09:59:48ldleworkbut what you lose
09:59:56ldleworkis the ability to not have to implement all parts of the interface
10:00:03Araqguys, it is well known that runtime polymorphism doesn't accomplish the same as compiletime polymorphism.
10:00:03ldleworkwith inheritance you get 'default implementations'
10:00:16ldleworkdom96: does that make sense?
10:00:22dom96ldlework: Could you please create a simple piece of code which demonstrates this?
10:00:40ldleworkdom96: why is it so hard to just use language to communicate? :P
10:00:54ldleworkwith a typeclass, your user type must implement the whole interface
10:01:07dom96ldlework: Because I am a programmer. Code is unambiguous and I prefer to communicate in unambigous languages :P
10:01:08ldleworkwith inheritance, you can implement a subset of the interface merely by overriding
10:01:14ldleworkthis is a convenience
10:01:23ldleworkdom96: jsut read the last three lines I wrote
10:01:26ldleworkliterally all you need to know
10:02:08ldleworkalso hi Araq
10:02:33ldleworkdom96: I'll try to write a minimal thing
10:05:15dom96ldlework: thanks
10:05:20dom96Araq: Thoughts on this? http://forum.nimrod-lang.org/t/701
10:05:48dom96My plan is to create a distinct type, define [] for it and a converter to preserve the old behaviour.
10:08:45tanehello, i have a problem understanding when exactly a converter is called: https://gist.github.com/anonymous/95a49045032cd1700c69
10:09:08tanein (B) it doesn't work, even though the type of the seq should be known, so i don't get it :)
10:09:49Araqdom96: I'd concat the field values like this instead key: "value A" "value B" "value C"
10:10:19Araqif I read the http spec correctly this is unambiguous
10:10:38Araqbut I know nobody will agree with me here.
10:10:41dom96that's not convenient
10:10:46*tgkokk joined #nim
10:10:47dom96and it would break code
10:10:56Araqit is. it fixes the stupid HTTP spec
10:11:14Araqwhich uses key-value pairs for something that is clearly not a list of key-value pairs
10:11:15dom96I'd have to parse out the quotes
10:12:07dom96With my idea you won't have to worry about this until you do get multiple same-name headers
10:12:43novisthey Araq. got time to elaborate on grammar maybe? why it isnt bnf and cant be?
10:14:24Araqtane: report it.
10:14:42taneso (B) should work?
10:14:57*Ven joined #nim
10:15:25MrOrdinairedoes anyone know what `nim c -d:release <filename>` does? how does it differ from `nim c --opt=speed <filename>`?
10:15:38Araqtane: yes and what's worse: if the compiler doesn't invoke toSeries it should fail at compiletime
10:15:53tanealright, where do those reports belong, github issue page?
10:16:11AraqMrOrdinaire: the default config file defines what -d:release means, you can read it there
10:17:20Araqnovist: 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:07MrOrdinaireAraq: thanks
10:18:31Araqalso I like the "ordered choice" operator from PEGs, and that's not available for BNF
10:19:01novistso 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:27novistoh i guess its "PEG" heh
10:19:42Araqno, it's not PEG either, unfortunately
10:20:41novistso.. are you saying its some kind of customized thing with no readily available tools for it?
10:20:52AraqI'm afraid your best option is to translate Nim's parser to Java.
10:20:59Araqyes. that's what I'm saying.
10:21:35novistbummer..
10:21:47MrOrdinaireAraq: for this piece of code, https://gist.github.com/anonymous/6695430e833c5ddae081, is the range checker too restrictive?
10:22:23MrOrdinairebodies is an array[0..4, Body]
10:22:57novistor maybe compiler itself could be somehow leveraged to do these tasks and provide relevant data for plugin consumption?
10:23:21Araqnovist: that's what idetools does. yes
10:23:53novistcan it dump like AST? my biggest concern atm is how to achieve syntax highlighting.
10:24:46Araqnovist: syntax hihlighting only needs a lexer
10:25:16novistthat means grammar though, no?
10:25:22Araqbut we can give you the AST as json
10:25:59dv-MrOrdinaire: i think for i=4 you're looking at the slice j=5..4
10:26:31AraqMrOrdinaire: report it, I think it's a bug
10:27:36MrOrdinaireAraq: will do
10:27:53MrOrdinairedv-: That's what I thought, too
10:28:26*nimnoob123 joined #nim
10:28:42*Demon_Fox quit (Quit: Leaving)
10:28:47ldleworkWhy invalid indentation? https://gist.github.com/dustinlacewell/47eb156080942e0459aa
10:28:49Araqnovist: a lexer doesn't need the full grammar, only the part of it concerned with lexing
10:28:49ldleworklast line
10:29:07dv-MrOrdinaire: so you should be using something like ... while j <= 4: ...
10:29:21nimnoob123Hey 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:30novistsorry 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:34ldleworkoh nm
10:29:38MrOrdinairedv-: turn off the rangeChecks and it'll work flawlessly ;)
10:31:12dv-you get the right result?
10:31:45Araqldlework: works for me
10:31:54ldleworkAraq: looking at wrong file
10:32:06nimnoob123feels like i've missed something so simple in the docs
10:32:12ldleworkWhat's the exception raised for interruption in ^C
10:32:44novistim 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:27Araqnovist: that is exactly how every other editor does it
10:33:54novistsounds like a plan then. thanks for help ^_^
10:33:57ldleworkAraq: can you catch SIGINT?
10:34:00*Matthias247 joined #nim
10:34:21Araqldlework: yeah system/excpt.nim shows how to do that
10:34:35ldleworkthanks
10:35:07Araqnimnoob123: you need to delcare startWalking before move. (yeah yeah I know, I know, it's technology from the 60ies)
10:36:01ldleworkAraq: define "signalHandler"?d
10:36:26nimnoob123Araq: 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:47Araqno, but I don't plan to work on this before 1.0 is out.
10:36:56ldleworkmaybe "c_singal"
10:37:35nimnoob123Araq: alright, thanks for the help
10:37:45Araqnimnoob123: IMO that the order reflects your call graph is a nice feature
10:37:52Araqbut not many agree with me
10:38:26MrOrdinairedv-: I do
10:38:52*jefus__ joined #nim
10:39:45*Ven left #nim ("Textual IRC Client: www.textualapp.com")
10:40:39nimnoob123yeah I think it would get a bit difficult to organize if objects become too large
10:41:08ldleworkAraq: I can't import c_signal from system/ansi_c
10:41:13nimnoob123became*
10:42:18*jefus_ quit (Ping timeout: 250 seconds)
10:42:22Araqldlework: system/ansi_c is not for your consumption, but perhaps you can 'include' it
10:42:38ldleworkAraq: is there a higher level mechanism for trapping signals?
10:43:10AraqI pretend they don't exist.
10:43:28Araqit's such a hack.
10:44:23Araqlike symlinks and 'fork'
10:44:30*ldlework sighs
10:44:35ldleworklol
10:45:24Araqdoes your signal handler even run on the same thread? who knows
10:47:20Araqldlework: there is system.setControlCHook()
10:49:56Araqdom96: just use some dedicated data structure instead of StringTableRef and don't bother with the converter
10:51:40dom96Araq: why?
10:51:51dom96I don't want to break code
10:52:02Araqbecause everybody says "screw backwards compatibility"
10:52:21*goobles_ joined #nim
10:53:41dom96well I don't, and I probably use httpclient the most ;)
10:53:58dom96And I don't wanna have to write [0] every time.
10:54:12goobles_whoa
10:54:16Araqoh yeah, that's a good point
10:54:23*MrOrdinaire quit ()
10:54:54Araqbut you don't have to do that with a dedicated data structure
10:55:00Araqspeaking of which
10:55:15*yglukhov__ quit (Quit: Be back later ...)
10:55:25Araqis the order of these "key value" pairs perhaps relevant in other ways?
10:55:26dom96I do.
10:55:41dom96headers["Set-Cookie"] will return a seq[string]
10:55:47goobles_he said i do
10:56:12dom96I want it to return a string
10:56:27dom96unless you write headers["Set-cookie"][1]
10:56:49Araqmaybe if do KeyA: valueA; keyB 'keyB' is also allowed to have different semantics depending on 'KeyA's existance?
10:57:22dom96huh?
10:57:34ldleworkdom96: https://gist.github.com/dustinlacewell/df3e99a630ff173563aa
10:57:38ldleworkdom96: read lib.nim first
10:57:56Araqhi goobles_ welcome
10:58:03Araqback
10:58:14ldleworkdom96: 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:01ldleworkdom96: 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:50goobles_nim is very vertical
10:59:52*minciue joined #nim
11:01:20ldleworkI think if I could provide default implementations on typeclasses.... that might obviate the need for inheritance here
11:02:00goobles_yeah for typeclasses!
11:02:05ldleworksort 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:47ldleworkthat's kind of wierd though
11:04:10ldleworkyou 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:15ldleworkbut.. that could also be pretty neat
11:04:37ekarlso-yay, package registry for nim up and running ! :)
11:04:59ldleworkdom96: ping me if you take a look
11:05:26ekarlso-can now get / register packages at least
11:06:55*BitPuffin quit (Ping timeout: 256 seconds)
11:10:20taneAraq, i noticed another converter was hooked into the game, leading to the following behaviour, that might be intended:
11:10:25taneGiven 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:57taneif this is still report-worthy, i'll report it
11:15:37dom96ldlework: 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:44repaxI'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:26ldleworkdom96: I wonder how you'd do it but ok
11:20:34ldleworkdom96: thanks for looking it over
11:20:41def-is there a reason that `$` is not implemented for arrays btw?
11:21:07*Jesin quit (Ping timeout: 245 seconds)
11:21:38def-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:08repaxdef-: you're right. I'll do that when I've finished up
11:28:33*yglukhov__ joined #nim
11:31:44reactormonklib/system.nim(478, 12) Error: invalid pragma: deprecated: <- current master
11:31:48reactormonk... whut'
11:32:32*Var|Mobile joined #nim
11:34:08*Jesin joined #nim
11:34:13reactormonkI'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:08ekarlso-so, mysql doesn't work on osx either ?
11:38:11ekarlso-booo
11:38:35*Jesin quit (Max SendQ exceeded)
11:40:29*Jesin joined #nim
11:41:23reactormonkthe line isn't any new, so why does it pop up now
11:41:42reactormonkah, I'm using "nimrod" binary
11:43:20ekarlso-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:45reactormonkekarlso-, which libmysqlclient do you have?
11:51:50reactormonkekarlso-, https://github.com/Araq/Nim/pull/1835
11:51:53repaxekarlso-, is the library located in /usr/lib or does it have a symlink there
11:51:56repax?
11:52:04*gokr_ quit (Ping timeout: 250 seconds)
11:52:17reactormonkekarlso-, ... could you test that change and report if it works for you?
11:54:08*filippo joined #nim
11:54:26repaxnevermind, I was thinking of dylibs
11:55:02filippohi 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:17filcucsolved 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:59ekarlso-Araq: can u get that patch in for libmysqlclient ? :p
12:23:13ekarlso-also
12:23:21ekarlso-libmysqlclient.18.dylib
12:23:24ekarlso-vs .so
12:23:26ekarlso-on osx
12:23:43def-ekarlso-: but with libmysqlclient.18.dylib it works?
12:25:10*gour_ is now known as gour
12:26:16ekarlso-def-: how u mean ? :)
12:26:50def-ekarlso-: did you try manually adding libmysqlclient.18.dylib in your copy of the standard library?
12:28:10ekarlso-trying now def- :)
12:28:24ekarlso-def-: is it possible to do like when defined(OSX) or smth?
12:28:33def-yes, "elif defined(macosx):"
12:28:56ekarlso-so, that fixed it
12:29:05def-great, i'll add it to my pull request
12:29:29ekarlso-def-: should probably be sept pull req no ?
12:29:36ekarlso-since it needs to be specific for osx..
12:29:47def-don't think it will be a problem
12:30:37ekarlso-i'll send one too def-
12:30:39ekarlso-for osx
12:30:43def-ekarlso-: also works with libmysqlclient.dylib?
12:30:44def-ok
12:31:57def-there are a few other wrappers without macosx support yet
12:32:32*irrequietus joined #nim
12:37:30ekarlso-hmmm
12:37:40ekarlso-maybe we need to split it up
12:38:40*EXetoC quit (Quit: WeeChat 1.0.1)
12:51:11Araqdef-: the only place where the bug can be hiding is this line:
12:51:18reactormonkekarlso-, nah, just add the metnioned elif
12:51:23Araqif c.count[0] < (len shl 3): c.count[1] = c.count[1] +% 1'i32
12:51:34Araqline 179
12:51:38def-Araq: yes, added a ze64 around c.count[0]
12:51:47Araqreplace the < with <% and it should work
12:51:50def-ah right
12:52:29Araqthis code predates the additions of unsigned integers to Nim btw
12:52:35def-i notice
12:52:37*foxcub_ joined #nim
12:53:05def-should be changed to unsigneds?
12:53:18Araqsure
12:53:51def-nope, still doesn't work
12:54:01Araqthat's weird
12:54:05foxcub_Hi
12:54:12def-<% had the same effect as ze64, only works up to 512 MB now
12:54:31foxcub_I just filed an issue: https://github.com/Araq/Nim/issues/1846
12:54:42foxcub_Did something change in the language or is the problem known, by chance?
12:54:56Araqwe should try to get it to work before switching to unsigned
12:56:28def-hm, i thought the bug might disappear by switching to unsigned
12:57:28Araqok, try that then
12:57:41Araqbut it should work with these +% ops everywhere too
12:57:57Araqotherwise there is some codegen bug lurking in them
12:58:18*gokr_ joined #nim
12:58:41Araqfoxcub_: I can imagine why it fails now. add {.nimcall.} to the TBinOp and see if it changes things
12:59:26foxcub_Yup, that did it.
12:59:35foxcub_Is that by design or a bug?
12:59:41Araqa bug
13:00:17Araqit's a nice regression, the same fix enabled other code to work
13:00:26foxcub_Ah, Ok.
13:00:33foxcub_Well, solves my immediate problem. So thanks.
13:00:42foxcub_Hopefully, the compiler stabilizes soon.
13:01:29*gokr quit (Ping timeout: 245 seconds)
13:02:35Araqyeah eventually most bugs have about 5 root causes that people stumble upon over and over
13:04:30reactormonkAraq, why would nimcall work here?
13:04:52reactormonk(it does)
13:05:14foxcub_Completely unrelated question: has anybody thought about transactional memory to Nim?
13:05:38Araqreactormonk: 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:49foxcub_*about adding TM to Nim
13:06:17Araqfoxcub_: I blogged about it once
13:06:18reactormonkAraq, kk
13:06:29foxcub_Link?
13:07:28Araqfoxcub_: don't read it, I'm not sure I agree with myself anymore, it's old.
13:07:35foxcub_;-)
13:07:42*z1y joined #nim
13:07:49foxcub_What’s the new thinking?
13:08:01Araqhowever, I argued that TM doesn't solve the hard problems
13:08:46foxcub_What are the hard problems in your view that it doesn’t solve?
13:09:39Araqthat you access some location without protection aka data race, or more broadly "race condition"
13:10:26foxcub_Isn’t that orthogonal to TM?
13:10:54def-Araq: ok, working immediately with uint32 and muuuuuch more performant
13:11:41Araqdef-: now that is strange given that clang's immediate representation is close to these +% ops
13:11:59def-i'm using gcc
13:12:07def-oh wait
13:12:10def-misunderstood you
13:12:43Araqfoxcub_: exactly. TM doesn't even address these problems. it solves some other problems.
13:12:49*jefus__ is now known as jefus
13:13:07def-maybe i just accidentally didn't compile with -d:release before
13:13:21reactormonkdef-, that's an insane different ^^
13:13:35foxcub_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:03foxcub_And it seems its ease of use is tightly coupled with language design, where Nim shines.
13:14:27Araqfoxcub_: so what problem DOES it solve?
13:14:31foxcub_Do you think TM could be implemented using what’s already there (macros and some external C TM libraries)?
13:14:40foxcub_The level of abstraction.
13:15:12Araqthat is not an answer
13:15:16foxcub_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:39foxcub_TM lets one reason about it at the level of code blocks (of the higher language).
13:16:18foxcub_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:03foxcub_TM greatly helps with such expression.
13:17:52AraqTM only allows for slightly more expressive code in comparison to locks+lock levels which is what we (will) provide
13:18:07Araqboth address the deadlocking problems
13:18:11foxcub_I don’t know about slightly.
13:18:33foxcub_TM lets one not modify existing data structures.
13:18:45foxcub_It keeps track of the affected addresses for you. That’s not so easy to express with locks.
13:18:57Araqit is
13:19:23foxcub_How?
13:19:47Araqyou can use the "single global lock"
13:19:53foxcub_lol
13:19:57foxcub_Fair enough
13:20:02Matthias247imho the only problem that transactional memory solves is not having to care about locking order
13:20:34Matthias247but instead you have the limitation that it doesn't work with anything that has sideeffects (IO)
13:20:57foxcub_Wait, maybe I’m missing something.
13:21:01foxcub_Let’s make it concrete.
13:21:11foxcub_Imagine I have a data structure. A k-ary tree or something like that.
13:21:22foxcub_I’d like to be able to insert nodes wherever I please into it.
13:21:53foxcub_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:09foxcub_With TM you don’t modify the data structure.
13:22:28foxcub_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:00foxcub_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:18def-md5 should work now: https://github.com/Araq/Nim/pull/1847
13:23:24Matthias247the implementations of transactional memory will do nothing else than modifying the structure with atomic operations
13:23:29Araqfoxcub_: 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:58foxcub_I’m afraid I know little about GC.
13:24:27foxcub_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:44foxcub_All I can say is that as a programmer, TM is very attractive.
13:25:09minciuehi everyone
13:25:44minciueis there any particular reason why nim c -o:”test” src/test.nim outputs to src/test ?
13:25:52minciueas opposed to just test in the current directory?
13:26:09foxcub_Matthias247: they will also keep track of conflicts, with little effort required from the programmer. That’s quite huge.
13:26:45foxcub_The k-ary tree example is a very simple data structure, there are much more complicated scenarios.
13:27:21Araqfoxcub_: the single lock works well once Intel got hardware transactional memory to work reliably
13:27:47foxcub_You are talking about automatic lock elision?
13:27:48Matthias247foxcub_: 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:21Araqand locks are much easier to reason about as you don't have to think about transaction rollbacks
13:28:24foxcub_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:17foxcub_Why do you have to think about transaction rollbacks?
13:29:44Matthias247afaik what clojure is doing with STM is more or less a transformation to atomic CAS and repeat that until success operations
13:30:19gokr_sidenote: Gemstone has so called "reduced conflict" classes, that are structures with defined concurrent semantics.
13:30:27Matthias247which works only for immutable types and side-effect free operations
13:31:08gokr_Like say an rccounter that has inc/dec ops that are conflict free
13:31:57foxcub_Alright, I did not mean to derail whatever conversation was happening.
13:32:16foxcub_I was mostly curious if anybody has thought about tying some C STM library into Nim.
13:32:27foxcub_It sounds like people have thought about it, but there is little interest.
13:32:53Araqfoxcub_: I looked at these libraries years ago. they were not usable to me
13:33:02foxcub_Araq: got you
13:33:34Araqfoxcub_: for more complex scenarios you can get livelocks with TM
13:33:50Araqthese are much worse than deadlocks
13:34:03Araqin my humble opinion
13:35:00foxcub_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:28foxcub_(I think the heart of our disagreement is whether TM can do the latter.)
13:35:47Araqfoxcub_: look at the new .locks and .guard pragmas. These address existing problems at least. :P
13:36:00foxcub_Araq: Thanks. I shall.
13:37:01foxcub_Oh, yet another unrelated question.
13:37:17foxcub_Is there any work (planned or ongoing) about importing C++ templates as Nim generics?
13:37:26filcucmm 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:35reactormonkfoxcub_, C++ templates are a bit too complex I'd say
13:37:54reactormonkand without having looked at them, I'd say the semantic differences are gonna give you a headache
13:38:13foxcub_reactormonk: well, how about some restriction of them?
13:38:30foxcub_I mean, things like std::vector<T> could be easiy mapped into a vector[T], manually.
13:38:51foxcub_No, “manually” is not what I mean there.
13:38:51reactormonkyup, pretty much gotta do it manually.
13:39:08foxcub_Well, that’s the problem. I’m not sure how I could do it manually.
13:39:17reactormonkno C api?
13:39:41foxcub_For a type that’s not fixed? No.
13:40:00foxcub_There couldn’t be one. C doesn’t have the concept.
13:40:27foxcub_Sure, once you fix T, you could create a C api, but that’s not what I’m after.
13:40:34reactormonkfoxcub_, well, for starters, you'd need to use the g++ instead of gcc
13:40:57reactormonkwhich reminds me, there is an importcpp
13:40:58Araqfoxcub_: I'm working on these things as part of my day job now.
13:41:08foxcub_Araq: oh, great!
13:41:18foxcub_What’s your day job now?
13:41:41foxcub_Also, are you planning these for 1.0, or is this a longer time-horizon?
13:41:49reactormonkfoxcub_, well, yeah. {.importcpp "...".} on a proc and you should have at least the functions. Not sure how to mess with the generics.
13:42:14Araqfilcuc: quite sure this is possible
13:42:19foxcub_reactormonk: I’ve noticed importcpp, but that seems to deal with just OOP call semantics. Nothing to do with generics.
13:43:07reactormonkfoxcub_, s/semantics/syntax/ and, yes you're correct. No generics.
13:43:57filcucAraq: 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:09reactormonkfilcuc, yup, include is file-level.
13:44:48filcuc:( mh so reactormonk mean that i cannot be nested?
13:44:56filcucthat it cannot be nested?
13:44:58reactormonkfilcuc, what do you want to do?
13:45:11Araq ## .. code-block:: nim
13:45:12Araq ## :file: someinclude.nim
13:45:18filcucinclude a source file in a rst doc
13:45:24Araqor something like that
13:45:27filcucfor showing and example
13:45:28reactormonkfilcuc, ah, rst. oops.
13:46:16filcuci thought that someone already had this need given that rst is used by most of nim doc
13:46:20Araqfilcuc: pegs.nim uses RST's include
13:46:39filcucAraq: thank i give it a look
13:49:53foxcub_Ok, one more question, and I stop pestering you.
13:50:13foxcub_Is there a standard (or any way) to create Python modules using Nim?
13:50:18reactormonkfoxcub_, you can keep asking questions, we choose not to answer if we deem you pestering ;-)
13:50:29foxcub_reactormonk: I like this attitude. :-)
13:50:54reactormonkfoxcub_, you could mess with the C api of python, but not directly, no. There might be a project on github
13:51:14foxcub_reactormonk: Is there a link to this potential project?
13:51:30renesacaraq was going to write a blog post about that...
13:51:36renesacsometime
13:51:37reactormonkfoxcub_, apparently not.
13:51:50foxcub_Actually, how does one create a shared lib using Nim?
13:53:07def-foxcub_: i made a small example here: http://rosettacode.org/wiki/Call_a_function_in_a_shared_library#Nimrod
13:53:16reactormonkdef-, wrong way round?
13:53:20def-oh, right^
13:53:34def-i think I have it the other way around somewhere
13:54:02reactormonkfoxcub_, there's exportc and you compile the C code with nim...
13:54:04foxcub_—app:lib is the secret?
13:54:07foxcub_with exportc
13:54:08def-foxcub_: yes
13:54:27def-reactormonk: right way around is right below!
13:54:29reactormonkdef-, btw, gotta edit that one too
13:54:50def-nimrod -> nim or why?
13:54:57def-did i forget something with the GC?
13:55:08foxcub_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:26foxcub_And probably with a little macro magic one could even make it feel elegant.
13:55:32reactormonkfoxcub_, pretty much.
13:55:53def-I need to write a script to rename nimrod -> nim everywhere on Rosetta Code
13:56:12reactormonkI'd say mediawiki might be hairy
13:56:25Araqargh ... so many PRs
13:59:31reactormonkdef-, the libmysqlclient is probably safe.
13:59:58def-reactormonk: I'm wondering about the proper style to choose a library version
14:00:17def-i guess it should be (|.18|.17|.16|.15) instead
14:00:19*renesac quit (Ping timeout: 256 seconds)
14:00:36reactormonkdef-, how so
14:00:37def-but it's not consistent among all the wrappers
14:01:02def-reactormonk: if you have libmysqlclient.so, that is chosen first, otherwise the highest lib first, then the lower ones
14:01:26novistis idetools broken or something?
14:01:30reactormonknovist, probably
14:01:46novistcant get it to tell me anything heh
14:01:46*Dispatch joined #nim
14:02:15def-novist: Araq is pulling it out into a separate program currently I think
14:03:05novisti see
14:03:18Araqnovist: 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:23novisti got tiny something working with only lexer now. https://paste2box.com/6/#/YZnWGQ/n4uwlUeXTGiANFnbUwy_hb5upny8JrkePxoBsuUEw3Y/gbk9HmQZ.jpg
14:05:00novistofc full parser would be much better as it would instantly provide syntax error feedback and stuff
14:05:29*repax joined #nim
14:05:51reactormonkah, intellij
14:05:54novistthat grammar in docs/grammar.txt isnt exactly full/latest i guess?
14:06:21flaviuI don't understand why Araq said that BNF can't capture Nim's grammer
14:06:26Araqit cuts some corners and it more complex than it needs to be at the same time
14:06:52reactormonkAraq, btw, how about s-expressions or json for idetools?
14:07:12flaviuAraq: Nim is context free, right? If so, BNF can represent it.
14:07:43Araqhow do you represent the indentation stack in BNF?
14:07:56AraqPython does it by hiding it in the lexer
14:08:06Araqthe cost is that you cannot have multiline lambdas
14:08:45repaxby explosion of states
14:08:51flaviuCan't you just treat an indent and dedent as a token?
14:09:19Araqrepax: fair enough, that might work
14:11:30Araqnovist: parser doesn't help really. then you need a type checker.
14:11:35repaxflaviu, that's an interesting idea
14:11:37reactormonkAraq, ah, TIL why you can't have multiline lambdas
14:12:03Araqand then you essentially re-implement the full Nim compiler ...
14:12:07novisti suppose idetools could provide typechecking no?
14:12:22Araqso asking the compiler is the only sane way to do it
14:12:45repaxindeed!
14:12:48Araqflaviu: that's what Python does.
14:13:18novistnim's lexer/parser is hand-crafted?
14:13:33Araqyeah "crafted"
14:13:40Araq(as if it's hard)
14:13:53novistits easy once you know how :p
14:16:45Araq"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:48Araqis 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:44def-Araq: both ways sound wrong
14:20:51def-but I'm not sure what's best
14:22:39def-maybe getconf LONG_BIT
14:22:54def-but that's only 64/32 bit
14:23:24*azynheira joined #nim
14:25:39foxcub_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:54flaviufoxcub_: --passC:
14:26:08flaviuhttp://nim-lang.org/nimc.html
14:27:04foxcub_flaviu: Thanks!
14:27:08Araqhow is "uname -m" bad for arch detection anyway. 'uname' was made for this.
14:28:00def-but it's the architecture of the kernel, right?
14:28:08def-you could be running a 32bit chroot inside
14:28:58Araqso uname runs as a 32bit app then and should report that
14:29:13*z1y quit (Ping timeout: 256 seconds)
14:31:01Araqwhy would anybody be interested in the kernel's "real arch" when it effectively runs some form of virtual machine
14:31:32def-never tried, but some people report that it reports x86_64 in a x86 chroot
14:31:41def-(and some people report the opposite)
14:32:10def-https://lists.debian.org/debian-glibc/2006/04/msg00033.html
14:32:46*azynheira quit (Quit: Leaving)
14:33:14willwillsonanyone know how `macros.typ` should work? Here is my problem: https://gist.github.com/anonymous/63ced7bce08dbe1298ba
14:34:45Araqwillwillson: this is a bug that also affects other things, so consider it reported
14:34:53willwillsonAraq: ok, thanks
14:35:00*BitPuffin joined #nim
14:36:31def-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:15repaxI 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:44repaxNevermind, it would probably bee ugly to match more than you implement.
14:45:51repaxbe*
14:48:02Araqrepax: you can try a TR template
14:49:06*darkf quit (Quit: Leaving)
14:50:29repaxWhat does TR stand for?
14:50:39def-term rewriting
14:50:50repaxah
14:51:47repaxThanks. But, I changed my mind after asking the question. Don't want to match more signatures than needed
15:01:44ekarlso-any of you good at scss ?
15:01:51ekarlso-and or design stuff
15:03:26*goobles joined #nim
15:04:23*willwillson quit (Ping timeout: 240 seconds)
15:05:17wanekarlso-: 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:55ekarlso-wan: ye
15:10:56wangist it/pastebin it?
15:11:40*Jesin joined #nim
15:12:06*filcuc joined #nim
15:13:09flaviupomf.se it?
15:14:10*rpag joined #nim
15:18:36ekarlso-wan: lemme post the code in a sec
15:18:44ekarlso-u can bring it up yourself :)
15:20:26*filcuc quit (Quit: Konversation terminated!)
15:35:38novistguys, is it terrible idea to write lexer like this? https://paste2box.com/6/#/YJnWGQ/egmTxNAhS7TIhbRWuvV0QL1l7cp56uSSydmk3m-BfXk/dz2yx5kO.txt
15:36:37goobleswhy u lexing the nims
15:36:42*foxcub_ quit (Quit: foxcub_)
15:36:56novistplugin for intellij
15:37:23gokr1Araq: There?
15:39:29repaxIf 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:50gooblesis nim gc threadsafe?
15:40:58*irrequietus quit ()
15:41:06repaxA REPL would interface such a server directly.
15:41:10novisteach thread has its own gc goobles
15:41:27goobleso
15:41:46repaxso, in that sense yes, goobles
15:41:47gooblesif i'm in C++ with many threads and I call into nim is that going to break shit?
15:42:09novistwhy would it break shit if you write it correctly
15:43:13repaxgoobles, don't share mutable data between threads undisciplined
15:44:02gooblesthis will anger my c++
15:44:04novistrepax so does that lexer bit i showed look retarded?
15:44:32repaxnovist, I don't see anything wrong with it
15:44:46novisti thought maybe such logic belongs in parser?
15:45:45repaxAha, a lexer you say. Yes, perhaps a bit early to juggle such items
15:45:54flaviurepax: see roslyn for your design, IIRC
15:46:26novistthats 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:42repaxflaviu, nice.
15:47:06*Lordovos joined #nim
15:47:40repaxnovist, 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:03dyugoobles: call setupForeignThreadGc() after each c++ thread is created
15:48:05*wan quit (Ping timeout: 244 seconds)
15:48:33flaviuFrom what I recall, I think that jetbrains implements most the refactorings for you
15:48:52novisti 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:57repaxnovist, I've not worked with intellij plugins so I'm not the best person to ask
15:50:17repaxthough it seems like a bit of redunant implementation
15:50:29novistAraq 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:31repaxto do it twice
15:50:37novistyeah i agree
15:50:39*LordAndrew quit (Client Quit)
15:51:13*Lordovos joined #nim
15:51:35*Lordovos quit (Client Quit)
15:51:54repaxflaviu, 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:13ekarlso-https://github.com/ekarlso/nim-packages < there's the initial work
15:54:32ekarlso-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:21ekarlso-Guest73082: ^
15:58:11flaviuekarlso-: https://github.com/ekarlso/nim-packages/blob/master/src/assets/images/node-sass.png ?
15:58:30ekarlso-flaviu: yeah, leftovers from the bootstrap :)
15:58:34*foxcub_ joined #nim
15:58:35repaxRoslyn is a beautifyl piece of work
16:00:17flaviuangularjs seems like a pretty big dependency
16:00:30ekarlso-why so ?
16:00:55flaviuAh, you're doing a one-page-app
16:01:19ekarlso-it's the same as rust's crates.io kidna
16:01:58*Guest73082 is now known as wan_
16:03:38flaviuekarlso-: I can't figure out how to run it. Can you add a short readme?
16:03:48ekarlso-flaviu: ya
16:04:42repaxUnfortunately 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:48ekarlso-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:50flaviuekarlso-: json, I guess?
16:16:44flaviuI wrote a yaml parser, but that's not on nimble yet, or really ready to use.
16:16:58iivvoooh, hi
16:17:00dom96ekarlso-: parsecfg module?
16:17:27iivvoonimble install aporia -> github.com[0: 192.30.252.128]: errno=Connection timed out
16:17:58iivvooas far as I know I can just access github (http(s) / git) outside of nim(ble) just fine
16:19:03flaviuparsecfg is meh
16:20:33foxcub_What is the best macro documentation? Or the best way to learn about them?
16:20:45foxcub_*macro -> macros
16:21:04flaviufoxcub_: I may be a bit biased, but nim-by-example.github.io/oop_macro/
16:21:17dom96flaviu: json is worse
16:23:10foxcub_Where are things like nnkInfix, nnkIdent, and such documented?
16:23:15flaviudom96: Yes, JSON is the worse configuration format. But the API for parseutils is weird.
16:23:32*Lordovos joined #nim
16:23:50flaviufoxcub_: The typical workflow for macros is to dumpTree the desired output code, and see how to get to that point
16:23:55flaviuthere is documentation at http://nim-lang.org/macros.html
16:23:57dom96flaviu: *parsecfg
16:24:02dom96flaviu: It's not that bad.
16:24:09dom96it just requires a bit of boilerplate
16:24:29foxcub_flaviu: Thanks.
16:24:37wan_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:49iivvoowon't the macro stuff end up in people creating their own (syntactically/semantically?) incompatible class, list comprehension, whatever implementation?
16:26:04flaviudom96: Oh, yes it is. The api is terrible. It looks like getopt, and getopt is universally hated.
16:26:46no_namequestion: 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:49iivvoono_name, http://nim-lang.org/lib.html#data-compression-and-archiving ?
16:27:52*gmpreussner__ quit (Ping timeout: 244 seconds)
16:28:03dom96flaviu: Improve it! :)
16:29:20flaviudom96: 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:47dom96no. People should implement that API on top of parsecfg.
16:30:03BlaXpiritHow 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:03no_nameiivvoo: 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:37flaviuI think that toml's format is much better designed than parsecfg
16:31:34iivvoono_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:30no_nameiivvoo: I'm just using httpclient.getContents()
16:33:54dom96no_name: https://gist.github.com/dom96/2f193bae2f7b9f24e130
16:33:57dom96That may help you.
16:34:09iivvoono_name, you could try passing an empty accept-encoding header
16:34:09dom96It's what I use to decompress images that i've previously compressed using zlib.
16:35:14iivvooanyway my nimble github issue seems to have magically resolved itself, but aporia fails to install (syntax error if I understand correctly)
16:35:31dom96iivvoo: nimble install aporia@#head
16:35:39*gokr quit (Ping timeout: 245 seconds)
16:36:39iivvooah, nice. Thanks dom96
16:36:46dom96np
16:37:40*iivvoo was just curious about a working gui application
16:37:48iivvoonot really sure what to do with nim yet
16:37:49repaxcfg files could just as well be nim files
16:38:05gooblesdoes nim build fast
16:38:21repaxgoobles, I think so
16:38:21flaviugoobles: yep
16:38:56ekarlso-wan_: ?
16:39:10ekarlso-dom96: kewl
16:39:22ekarlso-flaviu: toml support ?
16:40:03no_namedom96: 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:05flaviuekarlso-: I don't understand what you're asking.
16:40:26flaviuhttps://github.com/toml-lang/toml is toml, but nim does not have a parser for it.
16:40:28gooblescould u use nim as a script language?
16:40:28no_nameI've been trying to reimplement it to support gzip, but it doesn't appear to be working either
16:40:33dom96no_name: that sucks.
16:41:01flaviugoobles: Sure, https://gist.github.com/flaviut/27c2dc9cd2d8f5ced4e4
16:41:05LordovosTOML looks like INI.
16:41:06ekarlso-would be kewl if there was a parser for it
16:41:59flaviuekarlso-: If you want to get to shaving yaks, you can try wrapping https://github.com/ajwans/libtoml
16:42:12no_nameis there any documentation on how to use futures?
16:42:48no_nameI'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:58BlaXpiritguys, how to convert C array to seq?
16:44:29flaviuBlaXpirit: By copying. seqs have a header to store the length information.
16:44:29BlaXpiritI almost worked out a simple but lame way to do it, but I'm missing pointer arithmetics anyway
16:44:41BlaXpiritC array is just a pointer btw
16:44:44BlaXpiritflaviu, I don't understand
16:44:48*foxcub_ quit (Quit: foxcub_)
16:47:04flaviutype carray[T] = {.unchecked.} = array[0..0, T]; myarr = cast[carray[mytype]](mypointer); for i in 0..(carrylen - 1): result.add(myarr[i])
16:47:08flaviuBlaXpirit: ^
16:47:26flaviuNot actual syntax, I took some liberties for brevity.
16:47:27BlaXpiritflaviu, OK, thank you.
16:51:54no_nameI can't find docs for Future[T] anywhere....
16:54:51repaxno_name: asyncdispatch.html
16:56:47*foxcub_ joined #nim
17:02:54*foxcub_ quit (Quit: foxcub_)
17:14:02*bluemanshoe joined #nim
17:14:14MyMindis not possible to perform operations between floats and ints w/o explicit conversion?
17:14:50bluemanshoeIs there a builtin for consuming an iterator and returning a sequence?
17:15:07def-bluemanshoe: toSeq in sequtils?
17:16:10def-MyMind: I'd consider that a good thing
17:16:50MyMindmaybe it is
17:16:58MyMindbut even C can do it
17:17:54MyMindwhat is the alternative to printf?
17:18:06flaviuMyMind: Nope. Converters, maybe, but don't do that.
17:18:46flaviuMyMind: strfmt from Nimble, https://lyro.bitbucket.org/strfmt/
17:19:06MyMindflaviu: I'm trying to port this code to nim http://www.voidware.com/phase.c
17:19:14MyMindand it does constantly
17:19:26MyMindfloat to int implicit conversions
17:20:04flaviuMyMind: https://gist.github.com/8323723338e2b5ebe53c
17:20:38flaviuwait, you're right
17:21:10MyMindlol you did already O_O?
17:21:26flaviuc2nim does most of the work
17:22:04MyMinddidn't know that exist that
17:22:31bluemanshoe\quit
17:22:33*bluemanshoe quit (Quit: leaving)
17:22:34MyMindwell I'm learning a lot
17:23:52MyMindthat works flaviu ?
17:23:57flaviuIt does?
17:24:24MyMindI doubt
17:24:30MyMindis using printf
17:24:39MyMindand fflush
17:30:54*Trustable joined #nim
17:33:31ekarlso-flaviu: added readme
17:38:37dom96ekarlso-: Why are you using a nodejs server to proxy to the Nim server?
17:39:57flaviuMyMind: It sort of works now: https://gist.github.com/72429331289e50d7e16a
17:40:07flaviuIt's really shitty code because the input C was pretty shitty.
17:40:51flaviudom96: jester-0.1.0/private/patterns.nim(96, 10) Error: invalid indentation
17:41:36dom96flaviu: reinstall jester
17:43:27flaviuok, seems to work
17:45:15*bluemanshoe joined #nim
17:45:24dom96ekarlso-: Any chance you can get rid of those nodejs dependencies?
17:45:37wan_dom96: maybe the proxying is because of CORS issues?
17:47:27dom96wan_: I don't see how that is relevant
17:47:37BlaXpiritis there a way to get rid of {.raises: [], tags: [].} in doc2?
17:47:41*brson quit (Quit: leaving)
17:48:02BlaXpiritwell, of course, there is... by literally removing it from generated html
17:48:05bluemanshoeIs there a reason countup doesn't have the wrapping proc defined?
17:48:05BlaXpiritbut a reasonable way?
17:49:35*Demos_ joined #nim
17:49:37bluemanshoeI'm hopping to do something like {1} + {countup(3,10,2)}
17:50:29flaviuekarlso-: Any idea what [Proxy] { [Error: connect ECONNREFUSED] code: 'ECONNREFUSED', errno: 'ECONNREFUSED', syscall: 'connect' } is about?
17:57:29flaviuah, I need to run the nim server at the same time
17:57:37*Var|Mobile joined #nim
18:01:44dom96bluemanshoe: I don't think you can do that because countup is an iterator.
18:02:11dom96bluemanshoe: Why not just change its params?
18:02:24*wan_ quit (Quit: WeeChat 1.0.1)
18:03:10ekarlso-dom96: uh, u need nodejs stuff to compile the app
18:03:29dom96ekarlso-: why?
18:03:43ekarlso-eh, dom96 because it's the way it works ? :P
18:03:52ekarlso-gulp, bower etc are based off of it
18:04:11dom96what do you need these dependencies for?
18:04:25ekarlso-dom96: ... the js app concists of multiple html and js files
18:04:28ekarlso-as well as scss
18:04:41ekarlso-nodejs is the runtime for the tools to compile all that
18:05:11ekarlso-dom96: what else would you do ?
18:05:19dom96alright. Doesn't explain why you need a proxy?
18:05:35ekarlso-dom96: it's just for convenience because of CORS atm..
18:05:41ekarlso-havent bothered to work around it
18:07:15dom96I would personally just write it in CSS.
18:07:24dom96The JS doesn't need to be compiled.
18:07:30bluemanshoedom96: Not sure what you mean by that
18:07:44bluemanshoedom96: changing its params that is
18:07:48ekarlso-dom96: ... these tools exists for a reason :p
18:07:53dom96bluemanshoe: What are you hoping to accomplish via {1} + {countup(3,10,2)}?
18:08:27*irrequietus joined #nim
18:08:54bluemanshoedom96: 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:00dom96ekarlso-: I'd rather not have to install node just to get it to compile.
18:09:29bluemanshoedom96: 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:31dom96bluemanshoe: oh, you want countup to build you a set.
18:09:39*johnsoft quit (Ping timeout: 244 seconds)
18:09:40dom96countup doesn't build a set
18:10:23bluemanshoedom96: 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:44flaviuekarlso-: Can you use sqlite instead of mysql?
18:10:48dom96bluemanshoe: Yes. In the case of {1..10} you're not calling that iterator.
18:10:54flaviuIt simplifies deployment and usage signficantly.
18:10:58dom96The `..` is a part of Nim's syntax.
18:11:12*Demos_ quit (Ping timeout: 244 seconds)
18:11:39bluemanshoedom96: well, if I understand this right, looking at: https://github.com/Araq/Nim/blob/master/lib/system.nim#L221
18:11:50dom96bluemanshoe: You could write a proc called countupSet which returns a set.
18:11:54bluemanshoedom96: `..` has a procedure defined, instead of just the iterator
18:12:09dom96That returns a slice, not a set.
18:12:19dom96That's for array/seq slices.
18:13:22ekarlso-flaviu: u mean for dev or for actual deployment ?
18:13:40bluemanshoedom96: 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:45flaviuekarlso-: Both.
18:13:55ekarlso-flaviu: I wouldn't use sqlite for deployment...
18:14:15flaviuekarlso-: It works for the forum, and everything is run on a single vps anyway
18:14:26dom96bluemanshoe: Yes. But a seq is not a set either.
18:15:11dom96ekarlso-: indeed sqlite is pretty fast
18:17:33bluemanshoedom96: right. I guess I don't understand what is allowed to appear inside the { } set constructor
18:18:24dom96bluemanshoe: AFAIK just char and int literals, and `..`.
18:18:32ekarlso-I dont get it what is so bad with mysql -,,-
18:19:18flaviuekarlso-: Mysql is complicated and takes lots of RAM.
18:19:28*Var|Mobile quit (Ping timeout: 244 seconds)
18:19:32ekarlso-u got little on the VPS ? ^^
18:19:52flaviuYep, and all the stuff shares the ram
18:19:59ekarlso-ah ok
18:19:59flaviuekarlso-: sqlite scales fine: http://i.imgur.com/IoSGrFp.png
18:20:14ekarlso-flaviu: well fine enough by me...
18:20:23ekarlso-guess i'll change the api then :'(
18:20:42flaviuekarlso-: I'll update the schema
18:21:06ekarlso-flaviu: how u backup sqlite then
18:21:34flaviuI guess it's enough just to download the database file
18:21:37flaviuit'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:21flaviuekarlso-: https://gist.github.com/flaviut/c947e966085d01889ff5
18:25:34*ekarlso- wishes there was a sqlite ish thing for nim
18:25:40ekarlso-ehm, sqlalchemy
18:25:54flaviubut sql is fun!
18:26:08ekarlso-not rly :p
18:26:30flaviuFor sqlite, you can use sqlitestudio for experimenting.
18:26:34flaviuIt's a pleasure.
18:28:19flaviuIt 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:10ekarlso-flaviu: is it possible to do migrations thought with sqlite ?
18:46:56flaviuekarlso-: sorry, I don't understand what you said.
18:47:10ekarlso-flaviu: db migrations ..
18:47:43flaviuoh, like between schemas? Looks like, sqlite supports https://www.sqlite.org/lang_altertable.html
18:49:18ekarlso-flaviu: kk
18:49:21ekarlso-what next ? :p
18:49:51*brson joined #nim
18:49:55*Lordovos quit (Quit: Leaving)
18:50:21flaviuCutting down on dependencies would be good. I don't think that most the angularjs modules are necessary.
18:50:31ekarlso-flaviu: which ones ?
18:50:44flaviudunno, let me look
18:51:32ekarlso-flaviu: I really dont get it why it's so bad
18:52:05flaviuBecause most existing nim programs are minimalist
18:52:27flaviulots of emphasis on efficiency.
18:52:45ekarlso-well, u could probably not use states...
18:52:54ekarlso-aka ui-router but I feel the app is better with it
18:56:45flaviuekarlso-: btw, malformed json causes a segfault in the app
19:02:54flaviuekarlso-: 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:01dom96why do you even need angular for?
19:06:07dom96*what
19:06:34flaviudom96: It's a single-page app, all the rendering is done in the browser
19:07:53dom96I'm not sure what that means
19:08:15*gokr joined #nim
19:08:37flaviudom96: The page it serves up has no content on it. The content is placed on the page by client-side javascript.
19:09:28flaviuThe browser gets https://gist.github.com/flaviut/9d77821ec2c128548981 and does all the work of filling in the page
19:10:25dom96Ahh
19:10:40*AMorpork is now known as AFKMorpork
19:12:14ekarlso-flaviu: eh, ok what stuff did u remove ?
19:13:32flaviuekarlso-: here's the patch: https://gist.github.com/anonymous/233e51d35ce17012b709
19:13:52flaviurun `git apply`, paste that in, press <enter>, <ctl>-d
19:14:19ekarlso-flaviu: pull req ? :D
19:17:11flaviuekarlso-: 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:37BlaXpiritMimbus pls
19:28:53BlaXpiritit's actualy like better than nim i
19:30:11dom96You should grab Aporia ;)
19:30:18BlaXpiritnope
19:30:30dom96Ctrl+N, type in code, F5
19:30:33BlaXpiriti have the best text editor in the world
19:30:38BlaXpiritbut hmm that could be useful :p
19:33:55BlaXpiritcheck this craziness out though
19:33:58BlaXpirit.eval proc `test=`*(a, b: int): bool = true; let success = (5.test = 6)
19:34:55jsudlowError: type mismatch: got (ref ClickSystem, typedesc[PMouseButtonEvent])
19:34:55jsudlowbut expected one of:
19:34:55jsudlowclicksystem.mouse_down(self: ref ClickSystem, event: PMouseButtonEvent)
19:35:22jsudlowdose anyone know what the diffrence between typedesc[PMouseButtonEvent] and PMouseButtonEvent are
19:36:01BlaXpiritdom96, welp, AUR aporia-git doesn't work
19:36:04BlaXpiriti guess that's that
19:36:08def-jsudlow: typedesc is the type itself, you have to make an instance of it
19:36:29jsudlowdef: cool I'm trying to spoof a mouse click
19:36:43jsudlowdef: so maybe I have to make in instance of that event
19:37:00BlaXpiritobviously
19:37:15jsudlowdef: thx :_
19:37:18jsudlow:)
19:37:26def-np
19:38:11dom96BlaXpirit: obviously AUR sucks, use Nimble instead :P
19:39:36ekarlso-flaviu: other comments?
19:40:02flaviuAs dom96 said, it'd be great if we could get rid of the nodejs dependency at runtime.
19:40:15flaviuDoesn't nodejs just serve up static files
19:40:44ekarlso-flaviu:
19:40:44ekarlso-u already can...
19:40:44ekarlso-just need to fix cors...
19:41:19flaviuMy bad, I didn't see message.
19:41:55ekarlso-flaviu: also gulp serve uses "live reload" so whenever you change some file it reloads the page
19:42:00ekarlso-which is pretty helpful
19:42:38flaviuyep, I've noticed, but given the memory-constrained environment of the VPS, it's best not to run more processes than required.
19:43:03ekarlso-flaviu: it was never the intention either :)
19:43:19ekarlso-the api svc is supposed to support CORS when deployed..
19:43:41ekarlso-but given that there's no examples of it atm it's not easy for me :p
19:44:23flaviuI'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:44ekarlso-flaviu: oh, sorry you're right
19:45:04ekarlso-I *think* at least..
19:47:19*Demos_ joined #nim
19:47:32dom96Yeah, that's why I got confused.
19:47:42dom96CORS is never a problem when it comes to Nim.
19:51:12*Mat4 joined #nim
19:51:28Mat4hi 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:57Sembeiflaviu: 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:53ekarlso-dom96: how u set the static root of jester ?
20:10:27dom96var settings = newSettings(staticDir = "..")
20:10:59dom96Make sure to give it an absolute path.
20:11:54flaviuekarlso-: see my fork: https://github.com/flaviut/nim-packages/commit/c87c0965757f7e3bc0a3935d90dd6e49734e9cab
20:12:34jsudlowsI'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:35jsudlow var spoof_event_ptr = ptr spoof_tmouse_event
20:13:06ekarlso-flaviu: pull req and i'll merge
20:17:26flaviuIt looks like it's returning 502 when it should be returning 520
20:17:53flaviuerr, 500
20:18:25ekarlso-:P
20:18:33ekarlso-flaviu: that's jester's fault
20:19:17ekarlso-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:38dom96Yes, i'll implement that in the future.
20:19:51ekarlso-:P
20:19:57ekarlso-dom96: what other libs u got for nim ?
20:20:04flaviuekarlso-: It should also try to create the tables on each connection to the DB.
20:20:22ekarlso-flaviu: uh, that sounds a bit weird to me .:/
20:20:25*rpag quit (Quit: Leaving)
20:20:54flaviuProbably, I have no real web dev experience.
20:21:05dom96ekarlso-: not that many actually
20:21:11dom96ekarlso-: Most of my stuff is in the stdlib ;)
20:21:13ekarlso-:p
20:21:21flaviuBut `CREATE IF NOT EXIST` would be helpful if I forget to initialize my database.
20:21:40*minciue quit (Quit: minciue)
20:21:51ekarlso-flaviu: sounds like u should have a vagrant thing or smth instead ? :P
20:22:33flaviuI've never heard of those things, but I get by with `sqlite3 ./packages.sqlite < ../schema.sql`.
20:22:53ekarlso-flaviu: yeah, should probably add it to readme :)
20:32:00ekarlso-flaviu: how big is the vps ?
20:32:20flaviudunno, ask dom96
20:32:50dom96512mb RAM currently. We will likely upgrade it.
20:34:25*gokr notes del for seq... sneaky
20:34:40ekarlso-gokr: tjena!
20:34:45gokrTjaba! :)
20:35:34*gokr picking away at my port of PetitParser...
20:36:37ekarlso-flaviu: gotten to test it yet ?
20:36:55flaviuekarlso-: hmm?
20:37:03flaviuI've gotten it to run with just jester
20:37:14flaviuyou have to copy some stuff from the other directories
20:38:21ekarlso-fair enough
20:39:19flaviuI'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:35ekarlso-flaviu: it puts it under dist
20:40:07ekarlso-dist/index.html
20:40:08flaviuekarlso-: 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:26jpoirieris 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:12Mat4I think that would result in some kind of trouble
20:51:47flaviujpoirier: Everyone is using the github web UI, but TIL about request-pull, thanks!
20:51:58ekarlso-actually flaviu
20:52:02ekarlso-if you set the static dir
20:52:02jpoirierMat4: a pull request is a pull request
20:52:09ekarlso-to "dist" under the repo folder
20:52:19ekarlso-and run gulp before running the packages.nim
20:52:26ekarlso-u should be able to localhost:5000/index.html
20:52:27ekarlso-:)
20:52:50jpoirierhere'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:48ekarlso-flaviu: I was thinking of adding a "release" create form as well
21:00:47jpoirierIt'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:26flaviujpoirier: I won't disagree with you, I'd like to do everything from the terminal too, but that's unlikely to change.
21:03:38jpoirierflaviu: you can do that now. I think people forget that github is just an web interface around the git tools
21:06:04flaviujpoirier: 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:32jpoirierflaviu: 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:15ekarlso-any changes u want flaviu ?
21:13:58flaviuJust to be clear, I'm not a representative of the project.
21:14:07flaviuekarlso-: What's the scope of the project?
21:14:28*ldlework bows to our great leader flaviu
21:14:37ekarlso-flaviu: ;P
21:14:51ekarlso-flaviu: I was thinking like crates.io for nim
21:15:33Var|MobileMeep
21:15:49ekarlso-what was the thing again for parsing config files ?
21:15:59ldleworkparsecfg
21:16:04*ldlework hands ekarlso- a bookmark to the docs
21:16:06flaviuekarlso-: TOML is the one I like.
21:16:22*renesac quit (Remote host closed the connection)
21:16:46*renesac joined #nim
21:16:46ekarlso-flaviu: but I guess that isn't supported yet ?
21:17:06flaviuNo one has implemented a parser for nim.
21:17:31ekarlso-never written a parser :/
21:18:49flaviuWell, I suppose I could try. How hard can it be? ;)
21:18:58ekarlso-hah :p
21:19:30dom96flaviu: https://github.com/search?utf8=%E2%9C%93&q=nim+toml
21:19:39dom96You sure? :P
21:20:30flaviuWell, one of those doesn't actually have an implmentation
21:20:30reactormonkbtw, why is the tutorial split into parts? Why not merge it?
21:20:41dom96the other does
21:21:29ekarlso-doesnt have a implementation how ?
21:21:35*flaviu quit (Read error: Connection reset by peer)
21:21:46ekarlso-dom96: would be radical if u had delete stuff etc
21:22:07dom96ekarlso-: hrm? You mean the REST stuff?
21:22:11ekarlso-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:33flaviuekarlso-: The source file is literally doesn't have anything in it.
21:25:55reactormonkwhy do I get a "cannot open" when I'm opening a file in write mode?
21:26:00reactormonk... it doesn't exist.
21:26:14flaviujudofyr'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:12reactormonkEven 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:13reactormonkopen("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:11onionhammerom96
21:37:13onionhammerdom96
21:37:25onionhammeryou 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:44dom96onionhammer: yeah, i'll fix it later
21:41:08*renesac quit (Remote host closed the connection)
21:41:34*renesac joined #nim
21:42:47reactormonkok, wtf. According to errnos I get a ETXTBSY 26 Text file busy
21:43:57reactormonkHow 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:24dom96reactormonk: You're trying to open a file which doesn't exist?
21:45:44reactormonkrtfm, huh
21:46:11reactormonkdom96, yeah, the mode was wrong. But with fmWrite, I get the same error
21:47:12reactormonkdom96, 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:06reactormonkfound it -.-
21:49:45*renesac quit (Ping timeout: 244 seconds)
21:51:18reactormonkHow can I do path expansion?
21:52:29*renesac__ joined #nim
21:52:30*renesac_ quit (Ping timeout: 265 seconds)
21:53:03bluemanshoeHow do I make a sequence that I can index with an int64 ?
21:55:13reactormonkbluemanshoe, 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:57reactormonkwhich kinda gives you equivalent range, but can't compile on 32bit systems anymore.
21:56:24reactormonkwhich I honestly doubt should pose too much of a problem
21:56:46reactormonkAnyone ever wrapped realpath() ?
21:56:55*renesac joined #nim
21:57:15reactormonkok, it's in stdlib
21:57:20*renesac__ quit (Ping timeout: 265 seconds)
21:58:10bluemanshoereactormonk: 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:57reactormonkbluemanshoe, it can't because it's also expected to run on a 32bit system.
21:59:08renesac_nimborg is dead?
21:59:29renesac_somebody asked about python interfacing yesterday I think
21:59:46reactormonkrenesac_, lemme look it up
22:00:29reactormonkhe's offline
22:00:44reactormonkfoxcub, in case he shows up again
22:00:53reactormonkbluemanshoe, 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:29ekarlso-flaviu: what u think we should add to it ?
22:01:37reactormonkbut I have no idea if it would actually complain at compile time...
22:01:56reactormonkbluemanshoe, I suggest going to the forum with that one
22:02:17flaviuekarlso-: Make it look better, make the licence list a dropdown.
22:02:36reactormonkare cstrings returned from an importc'd function garbage collected?
22:02:38flaviuImplement docgen for the packages that are uploaded.
22:03:13ekarlso-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:11flaviuI was thinking of doing it on upload, but do it however you want to do it.
22:04:47ekarlso-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:28flaviuDoesn't really matter, the main idea is that each package get's its docs autogenerated.
22:06:37flaviu*gets
22:07:09reactormonkno pw reset for the forum yet?
22:09:31ekarlso-flaviu: how u mean by upload ? :)
22:09:34ekarlso-u mean register ?
22:09:46*renesac quit (Remote host closed the connection)
22:10:10*renesac joined #nim
22:13:58flaviuekarlso-: https://gist.github.com/692650d9ab76ecc490fd
22:14:15flaviuekarlso-: Just to make sure we're thinking of the same thing
22:14:49*renesac quit (Ping timeout: 255 seconds)
22:18:09ekarlso-flaviu: approvals are a bit silly I think..
22:18:57flaviuOk, removed then
22:20:22*gokr joined #nim
22:24:51ekarlso-what u mean about sandboxing flaviu ?
22:24:52*Varriount|Laptop joined #nim
22:25:01def-Made a script in Nim to convert all pages on Rosetta Code from Nimrod to Nim. Seems to work
22:25:12flaviuekarlso-: What if there's a bug in docgen? We don't want our server to be pwned
22:25:27ekarlso-flaviu: docker ? ^^
22:25:50flaviuhttp://www.ucw.cz/moe/isolate.1.html
22:25:58flaviuIt's probably easiest to use
22:26:04flaviubut it uses the same technology as docker
22:26:13ekarlso-or just use docker..
22:26:15ekarlso-:p
22:26:31flaviuSure, whatever you want. It's your project.
22:26:41ekarlso-hah :P
22:27:01Varriount|LaptopAraq: I think you made a type in your last post on the page http://forum.nim-lang.org/t/362/1
22:27:05Varriount|Laptop*typo
22:28:15def-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:27BlaXpirit_[:27:04] the irony
22:40:37ekarlso-flaviu: what licenses to allow then +
22:40:49flaviuekarlso-: Make a table for licences
22:41:04flaviuand then admins can add whatever they want
22:48:33reactormonkdo we have anything for mail parsing?
22:49:44reactormonkWhich library for simple beginning-of-line matching?
22:49:54*Epic|gmpreussner is now known as gmpreussner
22:50:06reactormonkAka ^Foo: (.*)$ and gimme back the match
22:51:19*tane quit (Quit: Verlassend)
22:51:57flaviu`re`?
22:52:24*saltylicorice joined #nim
22:54:49reactormonkshould 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:11Varriount|Laptop.eval var s = "hello";var a: ref string = s;echo(repr(s), " ", repr(a))
22:57:39BlaXpirit_Mimbus pls
22:57:58*Varriount|Laptop pokes flaviu
22:58:06flaviuhi
22:58:32flaviuGo in #nim-offtopic, it was apparently too spammy
23:00:36flaviuWell, A___ isn't here, I suppose I could sneak him in ;)
23:02:53*Mimbus joined #nim
23:03:17flaviuNow, don't ping or use Mimbus when A___ is here.
23:03:46dom96Are you trying to not highlight Araq?
23:04:03dom96You do realise he's away right?
23:04:14flaviuyep, which is why I'm trying not to ping him
23:04:45*EXetoC joined #nim
23:04:54dom96If 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:41BlaXpirit_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:41reactormonkAraq, any way to lock nim into 64bit to have ints be 64bit for seqs?
23:11:49goobleswhat if i want 32 bits
23:11:53goobleswhy u hating
23:14:05dom96BlaXpirit_: Try adding a 'return' and see if that helps
23:14:15reactormonkgoobles, because 32bit is legacy and legacy sucks
23:14:16dom96in any case, report it
23:14:17BlaXpirit_dom96, it probably will, but still a problem
23:14:23dom96^^
23:14:25dom96I agree
23:14:38goobles32 bit takes less memory
23:14:49gooblesi can store more ints that way
23:15:02BlaXpirit_what is stopping you guys from using the corresponding data types?
23:15:13reactormonkBlaXpirit_, seq
23:15:17BlaXpirit_how exactly
23:15:21*Jesin joined #nim
23:15:26EXetoCgoobles: int8, int16 or int32?
23:15:26reactormonktried using int64 as index in seq?
23:15:30BlaXpirit_oh ok
23:15:44gooblesoooh i like that
23:16:02flaviureactormonk: Just use a macro to verify that int is 8 bits, and use a converter to make int64 equal int.
23:16:12BlaXpirit_reactormonk, but you can't possibly have enough memory
23:16:17reactormonkflaviu, probably
23:16:19Mat4reactormonk: so the index is truncated to int32 ?
23:16:33BlaXpirit_for int64 to be a valid index
23:16:55BlaXpirit_just convert it gee
23:17:05*saltylicorice joined #nim
23:17:19BlaXpirit_dom96, should i report in araq/nim
23:17:24BlaXpirit_about doc2
23:17:57EXetoCis this the same issue? the issue we talked about was reported a few months ago
23:18:06EXetoCoh
23:18:09EXetoCok
23:18:15EXetoCcontext..
23:22:33*saltylicorice quit (Ping timeout: 244 seconds)
23:28:48reactormonkdo we already have an option type?
23:30:01flaviureactormonk: Nope.
23:30:04gooblesi'm sure some nimrod made one
23:30:23reactormonkflaviu, too bad
23:30:43gooblesu can make one
23:30:46gooblesand submit it
23:30:49gooblesand be famous
23:30:55*Demos_ joined #nim
23:31:00reactormonk... sometimes I wish I kept op in this channel
23:31:22flaviuI did write an Option once: https://gist.github.com/420210d6ea558d83f3cd
23:32:01reactormonkflaviu, I think you forgot the most important part: flatmap and map
23:32:30flaviuI'm really meh on lambdas in Nim, feel free to do that though. Should be easy.
23:32:53flaviureactormonk: Also feel free to post it on Nimble, my code is licensed under MIT.
23:35:06*saltylicorice joined #nim
23:37:54goobleswhy do you use lower case bool and then upper case Bool?
23:38:23BlaXpirit_goobles, probably old code
23:38:27flaviugoobles: That's old code, since when that was valid. I should update it.
23:38:34BlaXpirit_when things were completely case insensitive
23:39:12Sembeiwhat are the best options to debug nim? anything visual?
23:40:03def-Sembei: gdb works
23:40:04flaviugokr has had good experiences with KDevelop and GDB: http://irclogs.nim-lang.org/02-01-2015.html
23:40:34Sembeidef-: but anything visual
23:40:36Sembei?
23:40:43Sembeito set breakpoints
23:40:45gokrKDevelop is visual
23:40:52def-Sembei: anything that works with C maybe? I'm not sure
23:41:04gokrI also tried Nemiver and it worked, but KDevelop was smoothest.
23:41:14SembeiNemiver?
23:41:25gokrI think that's the name...
23:41:36Sembeiwell I'm on os x
23:41:42Sembeiso kdevelop is not an option
23:41:46Sembeiafaik
23:41:57gokrah, well, any gdb frontend should work
23:42:05gokrI haven't played on OSX.
23:42:43gokrYou need to compile with --debuginfo and --lineDir:on
23:42:45*Mat4 left #nim (#nim)
23:42:52gokrThen just debug it.
23:43:03flaviuSembei: I find the hardest part of text-mode gdb is getting started
23:43:09gokrStepping in/out/over etc - with proper nim source and breakpoints etc works fine.
23:43:12flaviuonce you memorize a few commands, it's pretty easy.
23:43:14Sembeiyup
23:43:24Sembeiwell is not that is complicated
23:43:30gokrBut exploring data doesn't really work of course.
23:43:39Sembeiis that you need two separated windows
23:43:54gokrAraq has some ideas there
23:44:08Sembeiand follow code by hand is kinda meh
23:44:33flaviuSembei: GDB prints the currently executing line.
23:44:45Sembeii know
23:44:52Sembeibut you need terminal
23:44:58Sembeiand scroll all code
23:45:01gokrWhy so obsessed with gdb? The frontends are nice.
23:45:02Sembeion your editor
23:45:10Sembei+gokr
23:45:16Sembei*+1
23:45:52Sembeiwatch a variable with a single click or things like that
23:46:54Sembeiactually os x deprecated gdb
23:46:56Sembeiit uses lldb
23:47:59gokrHaven't tried, but... if it supports the lineDir stuff, and I guess it should - then perhaps it works just fine.
23:48:38Sembeiis almost the same as gdb but is based on llvm
23:53:08Sembeijust 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:38gooblesa visual studio pluggin derp derp
23:57:42*z1y joined #nim
23:57:44gooblesya right nobody will make dat
23:57:54flaviugoobles: Someone has already made one.
23:58:17xAndyis 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:48flaviuDoes 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:33flaviuThat, or kept the docs and code up to data :)
23:59:49BlaXpirit_i'm pretty sure i saw that too
23:59:53*z1y quit (Remote host closed the connection)