<< 05-04-2015 >>

00:05:25*Trustable quit (Remote host closed the connection)
00:06:36*Demon_Fox quit (Quit: Leaving)
00:12:39*coopernurse quit ()
00:14:23AraqJehan_: yes except that .immediate is expanded eagerly in a generic too.
00:14:42Araqand an all 'expr' template is not
00:15:06Jehan_Okay. I think I'm not going to bother the guy with this level of detail, though.
00:15:10Araqthe interactions of generics with templates is particularly nasty
00:15:50Araqthough arguably the complexity comes from our butchered generics which do not perform a proper type-check
00:16:37Araqsomething which we should fix for Nim 2.0 once 'concept' is stable
00:16:50flaviuHave people in here looked at the rust stdlib? Seems to be very well designed.
00:17:40flaviuLooks like they have this "trait" thing, which is basically a nim concept.
00:18:54Araqeverything in Rust is well designed but at the end of the day I don't want to work in a language that thinks everybody is developing software for a space shuttle.
00:19:02Jehan_Rust traits are essentially a simplified version of ML signatures.
00:19:53fowlmeh
00:20:06flaviuWell, the main point is that traits are used extensively to provide polymorphism.
00:20:36reactormonkwould it be possible to replace generics with concepts?
00:20:41fowlthis seems extremely weird http://rustbyexample.com/trait.html `let spike: Dog = Animal::new("spike")`
00:21:12fowlanimal is the trait here, but it instantiates a Dog?
00:22:28flaviuSeems like some sort of reverse type inference, it is weird.
00:23:38reactormonkmaybe it's upcasting?
00:23:43fowlreactormonk, whenever you use a generic parameter as a parameter, like if you check obj.len from map[T](obj: T), then it has requirements you could put into a concept
00:24:02reactormonkfowl, so basically like haskell does it
00:24:05flaviuBut my main point here is the stdlib is well designed because of
00:24:05flaviu1) Extensive use of traits (concepts) to provide polymorphism
00:24:06flaviu2) Library functionally designed by determine what operations can be logically used on a type rather then adding operations as needed.
00:24:07Jehan_We're talking essentially about structural subtyping here.
00:24:22Jehan_Structural typing can be used for both static and dynamic dispatch.
00:24:26fowlreactormonk, but if you dont need to call it or pass it around, if you just needed to store a pointer to it or cast it and return it, it should be `any`
00:24:48reactormonkfowl, sounds nice
00:24:49Jehan_Static dispatch is how C++ and Nim work, sort of (except that currently neither of them requires you to specify the interface, but it's inferred).
00:25:58Jehan_Haskell and ML allow you to do it explicitly with type classes/signatures.
00:26:27Jehan_You can also use the same feature for dynamic dispatch.
00:27:08Jehan_However, it's much trickier to describe signatures that involve more than one type parameter and use them for dynamic dispatch.
00:27:20reactormonkthe question is - can you still get C-like speed with that approach?
00:27:47Jehan_reactormonk: Any approach that uses dynamic dispatch will do something that C cannot do directly.
00:27:58Jehan_Since C does not have dynamic dispatch on types.
00:28:20Jehan_Or static, for that matter (except for the generic stuff in C11).
00:28:48reactormonkJehan_, you don't need static dispatch in C, because you can determine which proc to invoke in the nim compiler
00:28:48fowlJehan_, i plan to have a macro pull the statement list from a concept type and build a generic 'interface' type with that
00:29:26Jehan_reactormonk: If you were to write code in C directly. C as a compiler backend is a more complicated story.
00:29:59*wb quit (Ping timeout: 264 seconds)
00:30:26Jehan_The thing is that any language that implements dynamic dispatch has to settle for one convention. If you implement it in C in the same way, the speed in C should be exactly the same.
00:31:10Jehan_Of course, since C is not really bound by that convention, they can situationally use a different (possibly faster) solution at the expense of interoperability with code that uses other conventions.
00:31:24reactormonkJehan_, function pointers?
00:32:36Jehan_Function pointers you can do in other languages, too, if they're sufficient for what you need.
00:32:48Jehan_I'm talking about situations where function pointers don't suffice.
00:32:57reactormonklambdas?
00:33:22Jehan_Lambda closures cannot be expressed through function pointers alone, since function pointers lack an environment.
00:33:37Araqflaviu: C++'s STL is also well designed in this respect and so is D's range concept.
00:34:06Jehan_Which is why callbacks in C usually are a pair (function pointer, void *) to give you a poor man's closure.
00:34:27Jehan_I'll also note that C is not fast. C *can* be fast given a sufficiently omniscient programmer.
00:34:47Jehan_It is pretty easy to make C fast for tight inner loops, especially over contiguous blocks of memory.
00:34:47reactormonkI suppose it depends on your definition of fast ;-)
00:34:56flaviuAraq: That's great! Nim's stdlib should take inspiration from them!
00:35:10AraqBut I'm still not a huge fan of these things because at the end of the day, my foo::String is not compatible to std::string.
00:35:10reactormonkflaviu, the question is how much can you remash the stdlib
00:35:23Jehan_If you're dealing with complex data structures, the lack of abstractions that C provides generally means that you'll be writing inefficient code.
00:36:02Araqflaviu: the problem remains that generics are *viral*
00:36:26reactormonkAraq, as in they infect everythin?
00:36:27flaviuAraq: But it is! std::string is just a concept for a indexable char container.
00:36:41flaviuErr, dunno what it is in rust, but it could be so.
00:39:27Jehan_Something different: I'm sympathetic towards getting a different name for .gensym, but I can't really come up with a good alternative.
00:40:07Araqflaviu: an AST node with a string[T] either is Node[T] or a Node and nails the T in String[T].
00:40:42AraqFor you Node[T] is the hallmark of good generic design. For me it's a tradeoff.
00:41:03flaviuAraq: I can't parse that first sentence, can you rewrite it?
00:42:00Araqtype Node = ref object
00:42:04Araq ... stuff ...
00:42:29Araq stringLiteral: string[char]
00:42:49Araqvs
00:42:55Araqtype Node[T] = ref object
00:42:58Araq ... stuff ...
00:43:06Araq stringLiteral: string[T]
00:43:38flaviuNo, I'd want
00:43:38flaviutype Node[T <: string] = ref object
00:43:38flaviu stringLiteral: T
00:43:47Araqdoesn't matter
00:44:45flaviuBut what is the tradeoff here?
00:45:08fowlAraq, i want to do this type x[T] = someMacro(T) and have it invoked at instantiation is that possible
00:45:58AraqNode works in a production compiler consisting of thousands of lines of code. Node[T] does not. Do you really want *every single function* to be generic?
00:46:46flaviuBut the generic would only be instantiated once or twice.
00:46:47*gsingh93 quit (Ping timeout: 250 seconds)
00:49:37Araqfowl: no but we can support it
00:50:13AraqJehan_: I cannot think of something better than 'gensym' either.
00:50:28Araq"noinject"? that's backwards
00:50:40fowlhow about: type LiteralNode[T] = ref object of Node; value: T; type StringLiteral[T] = ref object of LiteralNode[string[T]]
00:50:47Jehan_Araq: Heh. {.internal.} was the best I could come up with.
00:51:00Jehan_I don't like private etc. for the same reasons as you (I think).
00:51:01Araqand it's the default anyway for locals so you don't have to write it often
00:51:17fowlast with inheritance would be a lot to change though
00:51:42Araqfowl: inheritance is a different topic
00:52:32Araqflaviu: the interop problems with C++'s string types are real and not something I made up to have an argument with you.
00:52:43*gsingh93 joined #nim
00:54:00flaviuSeems as if there's been some miscommunication. I don't see where you've referenced C++'s string types.
01:01:10Araqok, I need to sleep, we continue this discussion but at the end of the day, every single proc in the stdlib will be generic and depend on some concept anyway.
01:01:16Araq*we can continue
01:01:57Araqthat's what happened with Scala, C++, D, Rust and Haskell and is inevitable
01:02:16Araqso I won't fight it
01:03:48reactormonkAraq, what do you dislike about generic/concepts?
01:05:16Jehan_Heh. :)
01:06:54flaviureactormonk: I don't want to put words in his mouth, but the problem he sees here looks like code bloat.
01:07:08flaviuGenerated code bloat
01:07:43renesacand compile time bloat
01:07:57renesacerr, increase in compilation times
01:09:14Jehan_flaviu: I think it's not just code bloat, but also the fact that code generation for generics is (necessarily) different from code generation for fixed types.
01:11:16Jehan_renesac: And yeah, type checking is also necessarily more expensive.
01:11:53renesacI still like generics and concepts though
01:12:36renesacis nim type checking paralelizable?
01:12:44Jehan_renesac: Yeah, and they're part of the core language. I think Araq is more concerned with having generic bloat (in the source, not the generated code).
01:13:28Jehan_renesac: It doesn't really matter if it is. Parallelizing non-trivial algorithms is something that needs to be approached with care.
01:13:37*TEttinger joined #nim
01:13:59Jehan_You want type checking to be correct much more than you want it to be fast.
01:14:21renesacright, just thinking on the long term
01:14:38Jehan_Incremental compilation will do more about compile speed issues than parallel type-checking.
01:15:13renesacyeah, especially regarding imports from stdlib
01:15:16Jehan_For what it's worth, I did experiment with --symbolfiles when that option still worked and incremental compilation was really, really good back then.
01:15:23*bpr joined #nim
01:15:27renesacthey can surelly be made much faster with some smart caching
01:16:03Jehan_As in: compile time < 1s for 1 million LOC as long as the change was local.
01:16:16renesac:)
01:17:09flaviuImpressive.
01:17:37Jehan_Well, this was with hot caches and everything.
01:17:39flaviuI wonder how it worked.
01:18:22Jehan_Well, I've tried to understand how rod files work, but realized soon that that required more time than I had.
01:18:47Jehan_Mind you, that was generated source code. It may have been that I hit a sweet spot.
01:19:05Jehan_Still, it seems to indicate that Nim can at least in principle recompile without revalidating everything.
01:20:51bprSay, I just noticed that the 'normalize' procedure in lib/pure/strutils.nim lowers the first character, which is correct for Nimrod but not Nim (I think). Is that correct?
01:20:57Jehan_It's not all that surprising, though. Scala is really slow when doing a cold compile, but incremental compilation can be blazingly fast.
01:21:40Jehan_bpr: Hmm. I'm not sure about that. It may be a backwards compatibility thing.
01:23:35bprJehan: I was looking at fixing some Nim bugs and noticed that one, but since it's my first attempt I thought I'd ask...
01:24:28Jehan_Hmm.
01:24:59Jehan_I'm wondering if instead you want a new procedure `normalizeNimIdent` or something.
01:25:07Jehan_Because the semantics are very Nim-specific.
01:25:24Jehan_Whereas the old `normalize` could potentially make sense for stuff other than Nim identifiers.
01:25:25renesacif it is for backwards compatibility, and intended only on nim identifiers, that proc should be changed or deprecated
01:26:31renesacbugs caused by it surelly would have appeared if the compiler were actually using that, though...
01:26:32bprAre there spots in the code that need to use the old one? If you just change normalize, koch.nim doesn't quite work, but that's easy to fix I think.
01:27:24Jehan_renesac: It's used for command line options, I think.
01:28:00renesachumm
01:28:07renesacso it normalizes also things-like-that?
01:28:08Jehan_Possibly also for generated code.
01:28:21Jehan_"nim C_C" is the same as "nim cc".
01:28:23renesacthen it makes sense to put everything lower case
01:29:08bprJehan: I was investigating the bug when there are two variables named p and P and the C compilation fails.
01:29:32bprbecause both get mapped to 'p'
01:29:43Jehan_bpr: Huh.
01:29:52Jehan_They should still get different suffixes.
01:30:45bprhttps://github.com/Araq/Nim/issues/2212
01:30:58Jehan_Oh, local variables. Right.
01:31:57bprSorry, kids bugging me to get off computer, be back in half an hour...
01:32:03*bpr quit (Quit: Page closed)
01:39:12fowlhmm
01:39:45fowlc2nim chokes on `1e5`
01:43:02Jehan_Ah, it's in ccgutils.nim::mangle
01:43:25Jehan_normalize doesn't enter into it.
01:44:19Jehan_Not entirely sure what the correct solution is, though.
01:45:42Jehan_Just removing .toLower should fix the issue, but I wonder if that may then generate identifiers that conflict with something else.
01:46:42*pregressive joined #nim
01:46:53Jehan_Hmm. You'd definitely get a conflict if you have an identifer "N0" and another identifier "0" (not sure how you get that, presumably something internal).
01:48:24fowlyou can throw __ on the end
01:48:39fowllul
01:48:49flaviuBut Nim complains if your identifiers contain __
01:49:03fowlyea so your nim ident couldnt conflict with a c ident
01:49:18Jehan_flaviu: For the generated C code.
01:49:51Jehan_fowl: Well, local variables should be relatively unmangled.
01:50:04Jehan_You could also prefix it with C or something.
01:51:49*brson quit (Quit: leaving)
01:52:08*bpr joined #nim
01:52:11Jehan_But in short: it's easy to fix, Araq will just have to have to say how he wants these identifiers mangled.
01:55:56bprJehan: Great! But normalize should still leave the first char unchanged, right? It's supposed to normalize according to Nim's lexical rules, and those now say that the first char case matters.
01:57:35*pregressive quit ()
02:02:26*BitPuffin quit (Ping timeout: 250 seconds)
02:03:01*untitaker quit (Ping timeout: 248 seconds)
02:09:27*untitaker joined #nim
02:28:44Jehan_bpr: Yeah, mangle is not dependent on normalize at all.
02:29:09Jehan_It's a totally separate implementation.
02:29:34*gsingh93 quit (Ping timeout: 272 seconds)
02:40:17*meeeee3 joined #nim
02:42:01meeeee3setInt(mlist, "COUNT", 10) in nim?
02:42:35*gsingh93 joined #nim
02:45:08*darkf joined #nim
02:47:18reactormonkmeeeee3, whut?
02:51:15*johnsoft quit (Ping timeout: 244 seconds)
02:51:54*johnsoft joined #nim
02:53:42meeeee3setint is a c func?
02:56:25flaviumeeeee3: You could probably look at a C wrapper and copy it
02:56:32flaviuor perhaps run the header through c2nim
02:56:41flaviuhttp://goran.krampe.se/2014/10/16/nim-wrapping-c/
03:04:27*Jehan_ quit (Quit: Leaving)
03:12:02*a5i joined #nim
03:17:01*meeeee3 left #nim (#nim)
03:19:06*gsingh93 quit (Quit: WeeChat 1.1.1)
03:19:42*meeeee3 joined #nim
03:19:51meeeee3accidently closed chat, did someone answer?
03:20:01*gsingh93 joined #nim
03:23:38EXetoCfor logs, see the topic. bye
03:34:13*gsingh93 quit (Ping timeout: 248 seconds)
03:34:40*bpr quit (Ping timeout: 246 seconds)
03:44:16*meeeee3 left #nim (#nim)
03:47:20*gsingh93 joined #nim
04:09:52dhasenanI have a ref Foo that I want to pass to a C function that takes a void*. How do I do this?
04:12:48dhasenanSpecifically, I'm using an event system that allows me to pass a data pointer to be supplied to a callback, so I need to feed it something that fits in a void* that I can restore to a ref Foo later.
04:13:55*endragor joined #nim
04:14:16renesacdhasenan: this probably involves addr()
04:14:31fowldhasenan, cast to pointer
04:14:32renesacbut I suggest you to do that question in stackoverflow so more people can see that
04:14:47renesacafterwards
04:15:06renesacis there a tutorial on interfacing with C? besides c2nim?
04:15:12fowlif you need to and you can unref it later, gcref it first
04:15:18*brson joined #nim
04:15:43renesacfowl: if it is a ref Foo from nim it should already be referenced by the GC
04:16:03*endragor quit (Remote host closed the connection)
04:16:06renesacand he shouldn't unref it otherwise the GC could erase it
04:16:16fowlrenesac, if you pass a ref to c and dont keep reference to in nim you do need to ref and unref it manually
04:16:50flaviuBut only if the C code keeps a reference to it.
04:17:04fowlsure whatever
04:17:22flaviuIf you pass it to C but get ownership of the pointer back at the end of the C call, that requires no special precaution.
04:17:25fowlyou ought to avoid this though
04:17:55renesac^ this, what flaviu said is what I was thinking
04:18:18dhasenanI'm not seeing a gcref function in the nim source code or docs.
04:18:35*endragor joined #nim
04:18:35fowlGCref/GCunref
04:18:57dhasenanGC_ref
04:18:58fowlthats right flaviu
04:19:02dhasenanGot it.
04:19:33renesacoh, those functions should be renamed to the new naming convention
04:20:08renesacwhy they are in system by the way?
04:24:05*endragor quit (Remote host closed the connection)
04:26:54*endragor joined #nim
04:28:40*endragor quit (Remote host closed the connection)
04:28:54*endragor joined #nim
04:31:45*saml_ quit (Quit: Leaving)
04:32:40*endragor quit (Remote host closed the connection)
04:33:26*brson quit (Quit: leaving)
04:33:27dhasenanTurns out I was getting confused by an unrelated segfault and casting to pointer worked pretty trivially.
04:34:35*endragor joined #nim
04:39:46*endragor quit (Remote host closed the connection)
04:40:40*dashed joined #nim
04:42:59*Demon_Fox joined #nim
05:43:14*a5i quit (Quit: Connection closed for inactivity)
06:04:05*gsingh93 quit (Ping timeout: 248 seconds)
06:25:18*Varriount_ joined #nim
06:28:09*Varriount quit (Ping timeout: 245 seconds)
07:01:20*vendethiel quit (Ping timeout: 246 seconds)
07:02:08*vendethiel joined #nim
07:23:31*Sembei quit (Ping timeout: 256 seconds)
07:55:19*Ven joined #nim
07:56:25*Ven quit (Client Quit)
07:58:47*BlaXpirit joined #nim
08:01:46*gmpreussner|work quit (Read error: Connection reset by peer)
08:02:11*Ven joined #nim
08:09:21*MyMind joined #nim
08:21:39*repax joined #nim
08:30:30*wb joined #nim
08:47:04*Demon_Fox quit (Quit: Leaving)
08:56:44*Sembei joined #nim
08:58:59reactormonkAraq, is it possible at all to move unsigned literals to the unsigned module or would that be too nasty?
09:01:28*milosn quit (Ping timeout: 255 seconds)
09:18:28*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
09:38:47*dv- quit (Ping timeout: 276 seconds)
09:39:27*dv- joined #nim
09:41:46*irrequietus joined #nim
09:42:45*Matthias247 joined #nim
09:44:01*Ven joined #nim
10:01:08*dv- quit (Changing host)
10:01:08*dv- joined #nim
10:14:18*dashed quit (Quit: Connection closed for inactivity)
10:18:27*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
10:29:44*milosn joined #nim
10:41:35*Ven joined #nim
10:44:29*HakanD joined #nim
11:07:30*jefus__ joined #nim
11:10:45*jefus_ quit (Ping timeout: 248 seconds)
11:28:59*TEttinger quit (Ping timeout: 250 seconds)
11:30:50*BitPuffin joined #nim
11:45:21*Trustable joined #nim
11:49:51*irrequietus quit ()
11:52:28*Senketsu joined #nim
11:57:12*JinShil joined #nim
12:00:49*wtw quit (Read error: Connection reset by peer)
12:01:46*wtw joined #nim
12:04:10*Kingsquee quit (Quit: Konversation terminated!)
12:04:57*endragor joined #nim
12:09:31*endragor quit (Remote host closed the connection)
12:10:33*endragor joined #nim
12:11:38*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
12:15:26*BlaXpirit-UA joined #nim
12:17:40*BlaXpirit quit (Ping timeout: 252 seconds)
12:18:47*JinShil quit (Quit: Konversation terminated!)
12:19:37*Ven joined #nim
12:21:42*endragor quit (Remote host closed the connection)
12:22:59*endragor joined #nim
12:41:02*endragor quit (Remote host closed the connection)
12:41:35*endragor joined #nim
12:42:01*irrequietus joined #nim
12:47:48*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
12:51:45*BitPuffin quit (Ping timeout: 250 seconds)
12:56:24*Ven joined #nim
12:59:50*milosn quit (Ping timeout: 252 seconds)
13:11:18*endragor quit (Remote host closed the connection)
13:13:56*fluoride joined #nim
13:15:03*endragor joined #nim
13:17:12*fluoride quit (Client Quit)
13:19:25*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
13:24:10*Ven joined #nim
13:25:15*Ven quit (Client Quit)
13:25:17*milosn joined #nim
13:27:09*Ven joined #nim
13:28:20endragorvar mySeq : seq[int64] = @[1i64, 2i64, 3i64, 4i64, 5i64, 6i64, 7i64, 8i64, 9i64]
13:28:27endragoris there a way to make that look prettier?
13:29:45endragor(not having to append "i64" to each number). Something like "toSeq(countup(1,9))", but countup() returns "int", and I'm not sure how you convert output of an iterator.
13:32:34EXetoC.eval var x=@[0i64, 0, 0, 0]
13:32:36MimbusEXetoC: eval.nim(3, 8) Error: ':' or '=' expected, but found '['
13:33:13EXetoC.eval var x = @[0i64, 0, 0, 0]
13:33:17MimbusEXetoC: <no output>
13:39:13dom96yeah, you just need to have it on the first element.
13:41:44*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
13:42:00EXetoCendragor: oh. just pass in 64 bit integers
13:42:30EXetoCiterator countup*[S, T](a: S, b: T, step = 1): T
13:43:13endragorahh, thanks!
13:46:33*endragor quit (Remote host closed the connection)
13:47:45*endragor joined #nim
13:53:18*Ven joined #nim
13:59:19repaxIs anyone using the unittest module? I can't get it to work.
13:59:30dhasenanrepax: it's working for me.
13:59:48repaxFirst of all the compiler fails to generate C-code for the terminal module (to give colours)
14:00:13dhasenanAre you on master or devel?
14:00:13repaxI'm on osx but it has posix support so that shouldn't be a problem
14:00:17repaxdevel
14:00:48dhasenanOkay, it's working on devel for me as of ca5c3295.
14:00:54dhasenanWith the C++ backend.
14:01:06repaxInteresting I'm also using the c++ backend
14:01:14dhasenanI'll update and re-test.
14:02:21repaxdhasenan, have you published code (open source) that uses it successfully? Or are you aware of any such code? I could try to compile it
14:03:24dom96Do you need to use the C++ backend? It's likely the problem
14:03:27dhasenanrepax: I have code, but it's on my private gitlab instacne.
14:03:41repaxdom96, I see. I'll try without
14:03:51dhasenanUpdated and it still seems to work (even after nuking nimcache). I'll gist my unittest.
14:04:30dhasenanhttps://gist.github.com/anonymous/db05fa6995a9645e276c
14:04:54dhasenanThe only interesting import is macros.
14:05:12repaxdom96, You're correct. It's the C++ thing that makes it fail
14:05:18repaxhm
14:05:26dom96report it on github
14:05:50repaxI'll do
14:06:13repaxdhasenan, but you generate C++, you say.
14:07:10dhasenanHrm, I'm compiling with a few compiler options. Without them, it fails.
14:07:23*endragor quit (Remote host closed the connection)
14:07:33dhasenanTurn on dead code elimination.
14:07:37dhasenan--deadCodeElim:on
14:07:42dhasenanThat makes it work for me.
14:07:46dhasenanI'll file a bug report.
14:08:39repaxI get other problems then
14:09:33*endragor joined #nim
14:09:36repaxundefined symbols (_stackoverflow_19801) from stdlib_unsigned.o, stdlib_termios.o, stdlib_posix.o
14:09:47dhasenanIntriguing.
14:10:49repax--assertions:on --checks:on --hints:on --warnings:on --debuginfo --opt:none --deadCodeElim:on --parallelBuild:1
14:11:08federico3(I'd love to have python-like string formatters)
14:12:13dom96federico3: `%` not good enough?
14:13:16EXetoCit's limited of course
14:13:19EXetoChttps://bitbucket.org/lyro/strfmt
14:13:31federico3something quick and handy like: print "pi %15.2f " % 3.1415
14:13:42*endragor quit (Remote host closed the connection)
14:14:01*endragor joined #nim
14:15:25federico3EXetoC: exactly :)
14:15:55EXetoCbut it's fine in many cases
14:16:51federico3alignment, trimming floats, that's what is needed most frequently
14:17:25repaxdhasenan, my mistake. I had to clean build caches
14:17:37EXetoCok well try that lib then
14:17:40repaxThanks, it works now even with C++ backend
14:17:47repaxusing deadcode elim
14:17:57dhasenan\o/
14:19:12*HakanD quit (Quit: Be back later ...)
14:23:37*HakanD joined #nim
14:26:07*qwr quit (Ping timeout: 265 seconds)
14:33:40*gmpreussner|work joined #nim
14:34:54gmpreussner|workdo we have a package for talking to serial ports?
14:44:25*darkf quit (Quit: Leaving)
14:46:50federico3EXetoC: aha: http://forum.nim-lang.org/t/1020/2
14:49:06dom96gmpreussner|work: don't think so
14:53:43dom96TIL there is a crown emoji.
14:53:44gmpreussner|workdom96: hmm... ok, i'll see if i can write some bindings then
14:54:47federico3EXetoC: on second thought, giving that I almost always prefer log.<priority>() over print() in Python, maybe the formatting could be done inside a logging module.
15:15:38*repax quit (Quit: repax)
15:31:44*BitPuffin joined #nim
15:33:45endragoris there a reason for not having `excl` for OrderedSet?
15:36:10*Trustable quit (Remote host closed the connection)
15:38:45renesacendragor: I would guess the reason for that is because that is an O(n) operation in the way they are implemented
15:38:46*endragor quit (Remote host closed the connection)
15:41:08renesacby the way, this ordered hash table implementation is interesting: https://nikic.github.io/2014/12/22/PHPs-new-hashtable-implementation.html
15:41:49renesacit is basically a open addressing hash table that holds a index to an ordered vector with the keys and data.
15:42:28*HakanD quit (Quit: Be back later ...)
15:42:54*endragor joined #nim
15:43:21renesacendragor: look at the log
15:45:51endragorah, so it's backed with a seq instead of linked list..
15:46:14renesacendragor: my link is for the php implementation
15:46:18endragorbacking it with linked list would make O(1) excl possible
15:46:32endragorI didn't look at PHP implementation
15:46:39renesacyeah, but slower overall
15:46:46renesacright
15:46:56endragorwhy slower?
15:47:01renesacoh
15:47:13*HakanD joined #nim
15:47:27renesacI may be wrong
15:47:32renesacI must look the code
15:47:54renesacbut it would probably consume more memory at least, for the pointers
15:48:54renesac(well, an seq can also waste memory because it has a power of 2 size, but on average is probably less)
15:50:18*BlaXpirit-UA quit (Quit: Quit Konversation)
15:50:38endragorI mean not the hashtable itself, but the seq that is there to maintain order
15:52:21*BlaXpirit joined #nim
15:52:21endragorhmm, no, implementation is different from what I thought
15:54:00renesacindeed
15:54:33renesacit might be a simple overlook then
15:55:22*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
16:05:03*repax joined #nim
16:06:00*endragor quit (Remote host closed the connection)
16:07:28*endragor joined #nim
16:15:16*BitPuffin quit (Ping timeout: 255 seconds)
16:24:29*wan quit (Quit: WeeChat 1.1.1)
16:58:41*irrequietus quit ()
17:02:56*Ven joined #nim
17:09:45*irrequietus joined #nim
17:11:16*endragor quit (Remote host closed the connection)
17:13:18*endragor_ joined #nim
17:43:05*endragor_ quit (Remote host closed the connection)
17:46:13*johnsoft quit (Ping timeout: 265 seconds)
17:47:36*johnsoft joined #nim
17:58:19*Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
17:58:20*HakanD quit (Read error: Connection reset by peer)
18:07:32*johnsoft quit (Ping timeout: 272 seconds)
18:12:03*pipeep quit (Ping timeout: 245 seconds)
18:12:03*johnsoft joined #nim
18:14:28*pipeep joined #nim
18:26:06*MyMind quit (Ping timeout: 250 seconds)
18:27:47*johnsoft quit (Ping timeout: 265 seconds)
18:32:04*johnsoft joined #nim
18:47:20*johnsoft quit (Ping timeout: 250 seconds)
18:49:04*Sembei quit (Ping timeout: 250 seconds)
18:52:03*johnsoft joined #nim
19:07:37*johnsoft quit (Ping timeout: 264 seconds)
19:10:29repaxHow does one build the nim documentation? I've tried ./koch web but nimweb fails:
19:10:54repax"cannot open: web/nim.ini"
19:11:02repaxI have no nim.ini
19:11:14*Sembei joined #nim
19:11:30*vendethiel quit (Ping timeout: 272 seconds)
19:12:02*johnsoft joined #nim
19:12:15*vendethiel joined #nim
19:13:49*Menche joined #nim
19:27:19*johnsoft quit (Ping timeout: 245 seconds)
19:32:12*johnsoft joined #nim
19:36:37*Menche quit (Quit: Leaving)
19:38:21dom96repax: looks like somebody recently renamed nim.ini to installer.ini
19:38:35dom96seems they forgot to change it in nimweb
19:39:23repaxdom96, thanks
19:42:52*milosn quit (Ping timeout: 256 seconds)
19:47:24*johnsoft quit (Ping timeout: 264 seconds)
19:47:29*milosn joined #nim
19:47:57BlaXpiritD:
19:50:26*Menche joined #nim
19:52:13*johnsoft joined #nim
19:55:17*elbow_jason joined #nim
20:03:31*yeye123 joined #nim
20:05:30yeye123can you code interactively in nim, like in elm for example?
20:07:02repaxyeye123: there's an experimental repl for nim. I don't know much about it
20:07:03repaxhttps://github.com/wheineman/nrpl
20:07:37*johnsoft quit (Ping timeout: 264 seconds)
20:08:20yeye123thanks
20:12:04*johnsoft joined #nim
20:12:27reactormonkyeye123, it's more like a rcepl, it compiles the code ;-)
20:14:52BlaXpirithm this stuff looks cool, exceeded my expectations
20:25:02yeye123and can you do hot swapping of code?
20:26:54*johnsoft quit (Ping timeout: 245 seconds)
20:30:17flaviuyeye123: No, but I've heard some talk in that direction.
20:31:48repaxyeye123: it depends.. The source is compiled to machine code with no symbol information at runtime. But you can replace a dynamic library at runtime, I would think
20:32:09*johnsoft joined #nim
20:33:02repaxThe program is not executed in a virtual machine like, say, java or erlang
20:34:10flaviuIt can be - see CTFE, but it typically isn't.
20:35:09*gsingh93 joined #nim
20:42:38*repax quit (Quit: repax)
20:44:19*endragor joined #nim
20:47:28*johnsoft quit (Ping timeout: 256 seconds)
20:48:26*endragor quit (Ping timeout: 252 seconds)
20:52:05*johnsoft joined #nim
21:07:46*johnsoft quit (Ping timeout: 265 seconds)
21:09:09*Kingsquee joined #nim
21:10:21*fishbrain joined #nim
21:12:04*johnsoft joined #nim
21:14:32*yeye123 quit (Ping timeout: 265 seconds)
21:24:22*fishbrain quit (Quit: Verlassend)
21:27:19*johnsoft quit (Ping timeout: 245 seconds)
21:32:14*johnsoft joined #nim
21:32:40*BitPuffin joined #nim
21:33:10*BitPuffin quit (Remote host closed the connection)
21:33:22*BitPuffin joined #nim
21:41:39*Trustable joined #nim
21:47:07*johnsoft quit (Ping timeout: 256 seconds)
21:51:24*HakanD joined #nim
21:52:11*johnsoft joined #nim
21:55:46*HakanD quit (Client Quit)
22:01:25*zama quit (Ping timeout: 248 seconds)
22:05:09*Matthias247 quit (Read error: Connection reset by peer)
22:06:56*johnsoft quit (Ping timeout: 272 seconds)
22:10:26*Trustable quit (Remote host closed the connection)
22:10:51*saml_ joined #nim
22:12:04*johnsoft joined #nim
22:18:10*zama joined #nim
22:20:10*angus quit (Quit: Leaving)
22:27:17*johnsoft quit (Ping timeout: 252 seconds)
22:28:16Araqarnetheduck: I merged your PR. what happened?
22:28:38Araqgithub failed to do it?
22:31:21*MagusOTB joined #nim
22:32:09*johnsoft joined #nim
22:34:06*MagusOTB quit (Client Quit)
22:46:56pigmejhmm, I feel quite lost for a while
22:47:19*johnsoft quit (Ping timeout: 245 seconds)
22:47:47pigmejhow can I correctly define a proc that returns "different" objects that have common parent ( inheritance )
22:49:06Araqproc foo(): Parent ?
22:49:47pigmejAraq: then nim complains type missmatch: got(Parent) but expected 'child'
22:51:36Araqlet c = Child(foo())
22:51:52Araqin other words use a type conversion
22:51:56pigmejah, ok
22:52:04Araqwill be checked at runtime in debug mode then.
22:52:17*johnsoft joined #nim
22:52:28pigmejoks, that what came to my mind too, though I was hoping that nim has some helper for that ;)
22:52:58pigmej(and yes, I have already read about cast vs conversion) ;-)
22:53:20Araqdowncasting is not typesafe so we cannot do it automatically
22:53:30Araqyou *could* write a converter for this
22:53:38Araqbut you really shouldn't.
22:53:46pigmejok.
22:53:58flaviupigmej: You shouldn't do Child(foo())
22:54:20flaviuWhat happens if you make foo() return OtherChild?
22:54:34pigmejflaviu: it will not ;-)
22:55:04pigmej(probably...)
22:55:21pigmejflaviu: but if I shouldn't do that, then how Can I do something similar ?
22:55:49flaviuWell, you can make foo() return Child
22:55:55flaviuie, proc foo(): Child
22:56:04pigmejso function per child type?
22:56:16pigmej(proc)
22:56:50flaviuI'm not sure what you mean.
22:57:52pigmejme also ... I'm still trying to wrap my head around static typing in fact ..
22:58:59pigmejbut hmm, let's have something like this
22:59:22pigmejif I have dynamic object comming let's say from some serializer (json, msgpack whatever)
22:59:46pigmejthen I want to parse it and return traced reference for my 'child container'
22:59:57pigmejthen, how could I do so?
23:00:23pigmejI mean, I probably know how to do so, but I would like hear the recommended way :)
23:00:46flaviuWell, http://nim-lang.org/json.html is an example
23:01:08flaviuIt uses object variants, but it's possible to do the same thing with inheritance.
23:01:11pigmejyeah,
23:01:23pigmejbut then all fields needs to be different in names
23:01:48pigmejI started from it, then it became hmm, kind of unreadable
23:02:47reactormonkwe have a natural number type?
23:07:23Araqreactormonk: sure, since version 0.001
23:07:41*jefus_ joined #nim
23:07:44*johnsoft quit (Ping timeout: 272 seconds)
23:09:35reactormonkAraq, ok, never seen it
23:10:04reactormonkah, found it
23:11:06*jefus__ quit (Ping timeout: 244 seconds)
23:11:48def-So Naturals should be used much more?
23:12:08*johnsoft joined #nim
23:13:31Araqdef-: yeah pretty much, but you have to be a bit careful:
23:13:49Araqvar x = foo.len
23:14:02Araqwhile x >= 0: dec x
23:14:25Araq# ouch, don't infer 'x' to be Natural here
23:14:42*brson joined #nim
23:14:47Araqso for better or worse 'len' should still return 'int'
23:15:09def-sounds like return types should be ints, parameters Naturals
23:15:17Araqexactly
23:16:52Araqproper "flow typing" would have been better instead of range[T] except that flow typing works much worse for Nim's generics and fixed size arrays
23:19:01def-reactormonk: you want to try making more params Naturals or should I?
23:19:22reactormonkdef-, go mess, I'll take a look at the GC pull request again
23:20:13reactormonkfuck, too many branches
23:21:14reactormonkAraq, so it should run multiple threads?
23:21:20reactormonk... the gc testing stuff
23:22:00Araqreactormonk: sure why not
23:22:11reactormonkAraq, I have no idea how to do it in C
23:22:27reactormonkshould be possible in nim, gotta look at the doc
23:22:44Araqreactormonk: just test that DLLs work with multi threading and don't leak
23:22:54Araqdon't write C code
23:23:11reactormonkAraq, so you would spawn the threads inside the DLL?
23:23:44Araqin the DLL and in the test program too
23:24:05reactormonkso in both?
23:24:46def-So, should we index seqs with Naturals? insert, delete for example
23:25:01reactormonkdef-, I approve
23:25:10reactormonkyou can even add Natural to [] if you want to
23:25:23reactormonkor rather Index, because it has to include ^1 too ;-)
23:27:27*johnsoft quit (Ping timeout: 265 seconds)
23:27:38Araqdef-: yes
23:28:15Araqbtw happy easter!
23:28:28cazovhappy easter!
23:28:45reactormonkhow do I get hold of the threads used in parallel/spawn to call getOccupiedMem?
23:29:14Araq"get hold"?
23:29:30Araqyou call it in the thread
23:29:42Araqthere is no other way, currently.
23:30:05Araqyou cannot access the thread local storage from a different thread
23:32:13*johnsoft joined #nim
23:33:59*brson quit (Quit: leaving)
23:34:21*TEttinger joined #nim
23:34:33reactormonkthe current design of said test runs the allocating proc a few times, then sleeps for a second, then calls occupiedMem.
23:34:47reactormonkShould I move said call into the worker thread?
23:36:04Araqyes
23:38:17reactormonkI would assume the gc test also tests for multiple calls to the dll - I can't really emulate that one
23:39:08reactormonkhttps://github.com/Araq/Nim/pull/1891/files#diff-2bdfb91f2f92400ba50898d03533d448R51
23:39:35reactormonkgetting that stuff over to threads is rather hairy.
23:43:52reactormonkAraq, so a) use threads in the dll - need to move iteration into dll to generate enough data. status() isn't enough data, so I'll have to delete that b) use threads via threadpool in the main.nim only, not c, to call the DLL with threads. Rather easy, can still do all tests, but no threading from C.
23:44:05reactormonkI'd prefer b), because less work and probably more data
23:44:38Araqhack it, leave it out, do something to stay productive. almost any test is better than no test.
23:45:46reactormonkkk
23:47:38*johnsoft quit (Ping timeout: 272 seconds)
23:48:02*BlaXpirit quit (Quit: Quit Konversation)
23:52:01*johnsoft joined #nim
23:52:40*elbow_jason quit (Remote host closed the connection)
23:55:00reactormonksegfault :-/
23:56:52*Varriount_ is now known as Varriount
23:58:47reactormonkmight just be because the shared lib has shared state, but I don't really care if that's mangled up
23:59:43*wb quit (Ping timeout: 256 seconds)