<< 23-01-2017 >>

00:01:08*nsf quit (Quit: WeeChat 1.7)
00:01:51*yglukhov joined #nim
00:02:39PMunchHmm, another question about my macro. The idea is that each node will return an object. And the previous level will add all objects as children.
00:03:17PMunchSo frame (title="Hello"):\n text: "Hi there"\n button: "ButtonText"
00:03:30PMunchWould create a frame with a title, then add a text and a button element to it
00:03:49PMunchtext and button are not containers so they only take strings
00:05:49enthus1astnimx?
00:06:12*yglukhov quit (Ping timeout: 252 seconds)
00:06:28PMunchNah, trying to create some nice little macros for wxWidgets
00:06:43AraqPMunch: sounds easy to do, but I need to sleep now. good night
00:06:52PMunchOkay, night
00:06:58PMunchI'll see what I can find :P
00:07:15cheatfateAraq, nimongo is not a wrapper, because it not using any external libraries, asyncpg is wrapper but i'm thinking to move away from libpq to get more performance
00:08:09Araqok, I should have said "we have mongo and postgres support"
00:08:21Araqnot necessarily C wrappers
00:11:26enthus1astunhappy with the wrapper cheatfate?
00:24:12*couven92 quit (Quit: Client disconnecting)
01:05:16*chemist69 quit (Ping timeout: 258 seconds)
01:05:39*chemist69 joined #nim
01:10:05*PMunch quit (Quit: leaving)
01:28:11*MyMind quit (Ping timeout: 240 seconds)
01:49:14*MyMind joined #nim
01:56:41*Snircle_ joined #nim
01:58:54*Snircle quit (Ping timeout: 255 seconds)
02:03:14*Trioxin joined #nim
02:03:51*yglukhov joined #nim
02:08:22*yglukhov quit (Ping timeout: 240 seconds)
02:21:06*abruanese quit (Ping timeout: 276 seconds)
02:21:25*vlad1777d quit (Quit: Leaving)
02:26:02*chemist69 quit (Ping timeout: 255 seconds)
02:28:18*abruanese joined #nim
02:39:43*chemist69 joined #nim
03:01:22*zetashift quit (Ping timeout: 240 seconds)
03:07:53FromGitter<endragor> @dom96 Do you think it's OK that asyncdispatch/asyncnet/net raise OSError and not IOError? Logically, IOError should actually be a subtype of OSError. OSError would mean "some syscall returned an error", while IOError - "IO-related syscall returned an error". The current distinguishment between IOError/OSError is unclear
03:17:47*pie_ quit (Ping timeout: 264 seconds)
03:28:00*brson quit (Ping timeout: 255 seconds)
03:42:51*abruanese quit (Ping timeout: 255 seconds)
04:00:58*abruanese joined #nim
04:05:21*abruanese quit (Ping timeout: 255 seconds)
04:05:27*yglukhov joined #nim
04:09:50*yglukhov quit (Ping timeout: 245 seconds)
04:25:56*def-pri-pub quit (Quit: leaving)
05:20:17Xehow do you have nim output a C variable?
05:21:38FromGitter<Varriount> Xe: For what purpose?
05:21:51*djellemah quit (Ping timeout: 240 seconds)
05:22:31XeI have a terrible idea involving writing weechat plugins in nim, and weechat expects certian C symbols (that are cstrings) in the .so file
05:22:41FromGitter<Varriount> @endragor Looks like sound logic to me.
05:23:07FromGitter<Varriount> Xe: There's the emit pragma
05:23:44FromGitter<Varriount> Or yippy could generate a separate C file at compilation time and link/include it.
05:23:48FromGitter<Varriount> *You
05:24:00Xewhat side do pragmas go on in variable declerations?
05:26:09FromGitter<Varriount> This isn't a variable pragma, it's a statement one
05:26:53FromGitter<Varriount> It just hangs out in the middle of your code, like a clown in a mime party. :3
05:27:57Xetemplate WEECHAT_PLUGIN_NAME*(name: untyped): void =
05:27:59Xe var weechat_plugin_name*: ptr char = name
05:28:02FromGitter<Varriount> Xe: http://nim-lang.org/docs/manual.html#implementation-specific-pragmas-emit-pragma
05:28:08Xewhere do i put {.emit.} here?
05:28:38FromGitter<Varriount> Xe: Can you give me an appropriate link to the weechat docs?
05:30:25*kulelu88 quit (Quit: Leaving)
05:32:03Xehttps://weechat.org/files/doc/devel/weechat_plugin_api.en.html
05:32:36FromGitter<Varriount> ?
05:34:05FromGitter<Varriount> Have you wrapped the include file? It says there's a macro that you need to call
05:34:24FromGitter<Varriount> I mean, C2Nim should handle things correctly
05:35:13Xei c2nim'd it, but it took a lot of editing
05:35:20Xethe macro definitions i gave up on for now
05:36:03FromGitter<Varriount> Can you gist the macros then?
05:36:54FromGitter<Varriount> Also, I could try my hand at the file
05:37:55Xehttps://github.com/weechat/weechat/blob/c017af8e0a0d4d0da6c28d0b82e77af51d8428fa/src/plugins/weechat-plugin.h
05:39:48FromGitter<Varriount> Goodness gracious that's horrid.
05:40:43Xeyeah
05:40:51Xei'm considering giving up on this idea for now
05:41:06FromGitter<Varriount> Wait, let me try.
05:41:28FromGitter<Varriount> It's not quite as bad as the Windows header files.
05:41:59FromGitter<Varriount> I just wish I had a working Nim install on this laptop
05:44:13*brson joined #nim
05:44:37FromGitter<Varriount> Ok, first off, you're probably going to have to include this header file, along with whatever wrapper is generated.
05:49:39FromGitter<Varriount> Xe: Do you have a possibly working file?
05:49:49Xeno, i've given up on it for now
05:50:14Xeweechat is the kind of C program where its plugins pass around C pointers as strings
05:51:30FromGitter<Varriount> Nim can do that.
05:52:13Xeyes, but i'm saying that weechat just has such objectively bad code that it's not worth my time to deal with it, it might be better for me to putt energy into replacing it.
05:53:54FromGitter<Varriount> Xe: https://glot.io/snippets/emfwvbldwe
05:54:05FromGitter<Varriount> If you're interested, that *should* work, I think.
05:54:37FromGitter<Varriount> A proper API would use a function to get the name, not a variable.
05:55:14FromGitter<Varriount> `char* plugin_name(){ ... }`
05:55:35Xeweechat has very few "proper" design choices
05:55:39FromGitter<Varriount> Or actually.
05:57:34FromGitter<Varriount> `int plugin_name(char* buffer, int buffer_length){ ... }` if I have my C correct.
05:58:03FromGitter<Varriount> You might be able to turn that character pointer into a proper array type, I don't know
06:02:36*Snircle_ quit (Quit: Textual IRC Client: www.textualapp.com)
06:07:15*yglukhov joined #nim
06:07:31FromGitter<Varriount> Xe: If you want a semi-easy way, just create a bare-bones C plugin for WeeChat that calls into the Nim code.
06:08:34Xethat would involve writing C though, i don't want to write C
06:11:55*yglukhov quit (Ping timeout: 258 seconds)
06:19:59FromGitter<Varriount> Xe: If you want, as soon as I have Nim setup on this laptop, I can try a quick wrap
06:28:59*nsf joined #nim
06:35:04*bjz joined #nim
06:38:45*djellemah joined #nim
06:42:48*bjz quit (Max SendQ exceeded)
06:44:04*bjz joined #nim
06:54:41*bjz quit (Ping timeout: 255 seconds)
06:59:37*Kingsquee joined #nim
07:08:11*bjz joined #nim
07:12:30*ftsf_ quit (Remote host closed the connection)
07:29:51*unlaudable joined #nim
07:30:08*yglukhov joined #nim
07:34:11*yglukhov quit (Ping timeout: 240 seconds)
07:45:49*filcuc joined #nim
07:57:54*couven92 joined #nim
08:14:46FromGitter<jacobdufault> Is there a way to check if two objects have the same type without knowing said type beforehand? I wrote a quick proof of concept, ie: ⏎ ⏎ ```var a: Derived = Derived() ⏎ echo repr(a.getRuntimeType())``` ⏎ ⏎ it will fail because the `m_type` field is on the `sup` member of `derived_asdfasdfa`. So making this work in general seems a bit tricky. Also tied very closely to compiler implementation details.
08:14:46FromGitter... [https://gitter.im/nim-lang/Nim?at=5885bb7511e7a7f61dd164eb]
08:17:11*Andris_zbx joined #nim
08:17:31*rokups joined #nim
08:23:12Araqa is b and b is a
08:23:48Araqa of b and b of a
08:24:32flyxa = "fair", b = "foul"
08:24:46FromGitter<jacobdufault> Those give compiler errors, they expect an explicit type
08:25:03Araqoh come on
08:25:06Araqa is type(b)
08:25:40*lenstr quit (Ping timeout: 245 seconds)
08:27:05FromGitter<jacobdufault> type(...) computes declaration type, right? so it ignores the actual runtime type ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5885be57d43728124e91575d]
08:29:52FromGitter<jacobdufault> sorry, above example should actually be ⏎ ⏎ ``` echo "a == b? " & $(a is type(b) and b is type(a))``` ⏎ ⏎ which still has the same problem, because type(a) is fetching declaration type, not runtime type [https://gitter.im/nim-lang/Nim?at=5885beffd43728124e915b9d]
08:31:46Araqso use 'of' instead of 'is'
08:32:58*rusua joined #nim
08:33:54FromGitter<jacobdufault> same problem ⏎ ⏎ `echo "a == b? " & $(a of type(b) and b of type(a)) # ==> true`
08:34:16FromGitter<jacobdufault> Compiler even gives a warning saying 'of type (b)' is always true :P
08:36:26*Vladar joined #nim
08:37:07Araqhow is a warning "the same problem"?
08:39:46FromGitter<Varriount> @jacobdufault You'll want the typetraits module
08:39:50FromGitter<jacobdufault> the warning is not a problem, it's just calling out that type(b) is fetching the declaration type of b, not the runtime type of b
08:40:15FromGitter<Varriount> Sorry, I mean typeinfo: http://nim-lang.org/docs/typeinfo.html
08:41:22flyxtypeinfo has a `setObjectRuntimeType`, but apparently no getter
08:41:27FromGitter<jacobdufault> @Varriount I haven't been able to find anything to do this in typeinfo
08:41:46FromGitter<jacobdufault> @flyx: yep
08:42:40flyxjacobdufault: well you could of course define methods on the types, given that the set of types it needs to work on is known
08:43:28*stisa joined #nim
08:43:35flyxmethod isSameType(a: MyType, b: RootObj) = b is MyType
08:43:55flyxbut you'd need an implementation for each tye
08:43:58flyx*type
08:44:00FromGitter<jacobdufault> @flyx: yea, I wanted to avoid that though since the information is available in the `m_type` struct param
08:44:29FromGitter<jacobdufault> implementation complexity is also different. one is just a compare, the other is a bunch of branches
08:45:01FromGitter<jacobdufault> runtime complexity*
08:47:41Araqb of type(a) and a of type(b)
08:48:24FromGitter<jacobdufault> araq: This doesn't work because type(a) and type(b) both resolve to Parent
08:48:24FromGitter<Varriount> Araq: Isn't that compile time though?
08:49:24Araq'is' is compiletime, 'of' is runtime
08:49:39Araqbut jacobdufault is right ... hmmm
08:49:39FromGitter<Varriount> @mpcjanssen If you look in the typeinfo code, you'll see the rawType template
08:50:23FromGitter<Varriount> If that was made public...
08:50:32Araqjust cast your way around then. if cast[ptr pointer](addr obj)[] == cast[ptr pointer](add objB)[]
08:51:41FromGitter<Varriount> @jacobdufault Why do you need this, by the way?
08:53:01FromGitter<moigagoo> I've been writing some simple examples to showcase Nim's async story to my colleagues but found myself stuck with the very basic code, which I'm sure used to work. Please take a look and tell me where I am wrong: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ So here's a plain async downloader. It doesn't compile, the error is `'cb' is not GC-safe as it accesses 'nameIterVar' which is a global using GC'ed memory ...
08:53:01FromGitter... [https://gitter.im/nim-lang/Nim?at=5885c46b11e7a7f61dd190bc]
08:53:45*arnetheduck joined #nim
08:54:06FromGitter<jacobdufault> @Varriount ⏎ ⏎ ```proc setup(defaults: seq[Init], overrides: seq[Init])``` ⏎ ⏎ The function goes through every value in `defaults` and runs some logic on it. It uses a value in `overrides` instead of the one in `defaults` if there is an override present. An override is defined as any object having the same type as the default value. [https://gitter.im/nim-lang/Nim?at=5885c4ace836bf70107cdad2]
08:54:28FromGitter<jacobdufault> @araq: I'm not following how casting helps in this situation.
08:54:36*brson quit (Ping timeout: 240 seconds)
08:55:02FromGitter<jacobdufault> @araq: Casting the values to pointers doesn't tell me the runtime type
08:55:10FromGitter<moigagoo> Here a twist I just discovered. When compiled without `--threads:on`, it's not an error but a warning, and the code compiles. With `--threads:on`, compilation fails.
08:56:20FromGitter<Varriount> @jacobdufault This looks like something a method (not a procedure) would handle...
08:56:49FromGitter<Varriount> @jacobdufault Will a hacky solution work?
08:56:53FromGitter<Araq> @moigagoo sounds like expected behaviour
08:57:20FromGitter<Araq> not sure if httpclient is threadsafe
08:57:52FromGitter<jacobdufault> @Varriount Yea, I can hack it by emulating runtime type information (putting an `id` field in `Init`), but it would be nice to use actual RTTI generated by the compiler
08:58:25FromGitter<moigagoo> @Araq So, I can't use httpclient and multiple threads in the same program? For example, download files asynchronously and then, say, calculating hashes in multiple threads?
09:00:20FromGitter<endragor> @moigagoo the problem is that it uses `defaultSslContext` variable which is global. just pass the context manually to `newAsyncHttpClient` as a workaround (and file an issue on GitHub if it's not there)
09:04:06*bjz_ joined #nim
09:04:38*irrequietus joined #nim
09:06:41*bjz quit (Ping timeout: 256 seconds)
09:08:32FromGitter<andreaferretti> @Araq I saw your new plans in todo.txt
09:08:40FromGitter<andreaferretti> It is nice to see that pattern matching is coming
09:08:54FromGitter<Varriount> @jacobdufault https://glot.io/snippets/emfwvbldwe
09:09:02FromGitter<andreaferretti> I don't konw if you had seen https://github.com/andreaferretti/patty
09:09:05FromGitter<moigagoo> @endragor Thanks! It's filed already https://github.com/nim-lang/Nim/issues/4998. ⏎ ⏎ Could you please guide me how to pass the context manually? Unfortunately, I couldn't find much info in the docs (http://nim-lang.org/docs/net.html#SslContext).
09:09:22FromGitter<Varriount> @jacobdufault I am not responsible if that snippet causes any major disasters and/or extinctions
09:09:23FromGitter<andreaferretti> I tried to emulate pattern matching - as well as algeraic data types - using macros
09:09:53FromGitter<andreaferretti> It could be better, but I never managed to work on nested patterns and so on
09:10:38FromGitter<Varriount> @jacobdufault Also, even if it works on the C/C++ backend, I can't say it will work on the JS backend
09:10:42FromGitter<andreaferretti> I don't know if it could make sense to port something like this into the stdlib
09:10:43FromGitter<endragor> @moigagoo newAsyncHttpClient(sslContext = nil)
09:10:51FromGitter<andreaferretti> so that the base language does not need to change
09:11:02FromGitter<andreaferretti> (of course, and improved version)
09:11:07FromGitter<jacobdufault> @Varriount Did you send the right link?
09:11:33FromGitter<Varriount> @jacobdufault The proper solution would be to expose the rawType attribute in the Any object. (file an issue)
09:11:40FromGitter<Araq> @andreaferretti I'm aware of your package, never used it though. some primitive way of PM needs to be builtin for safety reasons though
09:11:42FromGitter<andreaferretti> on the other hand baking pattern matching into the language would make it more type-safe
09:12:02FromGitter<andreaferretti> yes, I agree
09:12:20FromGitter<Varriount> @jacobdufault Blah, sorry: https://glot.io/snippets/emg2c6mp9r
09:12:22FromGitter<jacobdufault> @Varriount I'm not sure that would work either. Constructing an any calls getTypeInfo which runs at compile time
09:12:40FromGitter<andreaferretti> also, I think it would allow to use the same name for fields in different type branches
09:12:42FromGitter<moigagoo> @endragor Was not expecting that :-D Thanks!
09:13:10FromGitter<andreaferretti> because the compiler would be able to figure it out based on the pattern
09:13:41FromGitter<andreaferretti> I would be happy when patty becomes deprecated :-)
09:13:48FromGitter<Varriount> @jacobdufault Huh? Are you sure?
09:14:45FromGitter<andreaferretti> @Araq also, please, make the pattern matching an expression
09:14:47FromGitter<Varriount> getTypeInfo retrieves the pointer to the type information structure attached to the object/reference
09:15:01FromGitter<andreaferretti> right now in patty it only works well as a statement
09:15:28FromGitter<andreaferretti> which is inconvenient when one wants to assign the result of PM to a variable
09:15:36FromGitter<jacobdufault> @Varriount Try it with this snippet ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5885c9b7074f7be7630674f4]
09:15:42FromGitter<jacobdufault> It prints "true" for me
09:16:22FromGitter<Varriount> @jacobdufault Where's the rest of the code?
09:16:56FromGitter<jacobdufault> ```type ⏎ Parent = ref object {.inheritable.} ⏎ Derived = ref object of Parent ⏎ ⏎ ...``` ⏎ ⏎ I'll create a full paste, give me a sec [https://gitter.im/nim-lang/Nim?at=5885ca07074f7be763067697]
09:17:01FromGitter<Araq> @andreaferretti hmm? it's just that 'case' will get pattern matching features, 'case' is available as an expression
09:17:43FromGitter<andreaferretti> ok, then I think the problem only arises because patty uses a macro
09:18:10FromGitter<andreaferretti> I need to wrap the whole thing in a blcok
09:18:12FromGitter<andreaferretti> block
09:18:20FromGitter<andreaferretti> even though it expands to a case statement
09:19:15FromGitter<Varriount> @jacobdufault https://glot.io/snippets/emg2izax2z
09:20:11FromGitter<jacobdufault> @Varriount That's using type inference ⏎ https://glot.io/snippets/emg2k0rugw
09:20:32FromGitter<jacobdufault> The type inference gives y a decl type of 'Child' which makes it work
09:20:41FromGitter<Varriount> Ah, I see.
09:21:07FromGitter<vegansk> @Araq, @andreaferretti, hi! It will be superb if pattern matching will be added to the language or at least to the stdlib :-)
09:21:15FromGitter<Varriount> @jacobdufault Thats... unexpected.
09:21:37*yglukhov joined #nim
09:22:21FromGitter<jacobdufault> @Varriount If you look at the definition of `toAny` it is using `getTypeInfo`, which is compile-time only :/
09:23:30FromGitter<vegansk> What do you think about something like scala extractors for PM? (http://docs.scala-lang.org/tutorials/tour/extractor-objects)
09:25:41*yglukhov quit (Ping timeout: 240 seconds)
09:25:58FromGitter<Varriount> @jacobdufault See PM
09:26:46FromGitter<andreaferretti> @vegansk the problem is that they add some overhead at runtime
09:27:14*chemist69 quit (Ping timeout: 255 seconds)
09:27:18FromGitter<andreaferretti> the approach of patty (and I assume what the builtin version will do)
09:27:32FromGitter<andreaferretti> just translates it into what you would write manually
09:27:35FromGitter<andreaferretti> at compile time
09:28:26FromGitter<Araq> btw ref object {.inheritable.} is already wrong and everything on top of this will make it worse
09:28:47FromGitter<Araq> use 'ref object of RootRef' and let the language do its job
09:32:04*chemist69 joined #nim
09:35:21cheatfateenthus1ast, libpq is pretty old and uses poll/select to satisfy asynchronous behavior, also for libpq i have invented workaround for windows (which is hacky), so its better to replace libpq with pure nim code
09:36:00FromGitter<Araq> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5885ce7fcbcb281770a51073]
09:36:40FromGitter<Varriount> @jacobdufault ^
09:36:43*yglukhov joined #nim
09:39:33FromGitter<jacobdufault> araq: That's still broken. You're using type inference so that the compile time x and y have different types
09:39:48FromGitter<jacobdufault> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5885cf63d43728124e91c19c]
09:40:15FromGitter<jacobdufault> @Araq ^
09:41:13FromGitter<Varriount> Don't forget to make them references
09:44:40FromGitter<jacobdufault> Nice catch, I got this to work with: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5885d087c0de6f017fdceadd]
09:49:59FromGitter<jacobdufault> Thanks @Varriount, @Araq, is this something you'd be willing to accept in a PR?
09:50:21Araqwhy is it needed?
09:50:36Araqif you want precise types, don't use inheritance
09:52:56FromGitter<jacobdufault> I treat object type as identity in some code
09:58:18Araqwhat does that even mean.
10:00:44FromGitter<jacobdufault> I have an example earlier up. The runtime type is used to identify an element and match it against other elements in a seq
10:01:28FromGitter<jacobdufault> I also think for a PR it be better to expose the type itself instead of just a compare function, more flexible that way
10:09:08Araqproc setup is not a use case, it's a big mystery
10:09:13*byte512 joined #nim
10:09:41Araqwhy are object types treated as values? what if I have 2 fields of the same type and want to override only one?
10:10:32Araqwhy not use a macro to create a much faster and flexible 'setup' operation?
10:10:54*bjz joined #nim
10:11:11*bjz_ quit (Ping timeout: 255 seconds)
10:14:34FromGitter<jacobdufault> The values given to the setup proc are only available at runtime, ie, parsed from a file the end user can modify, so a macro doesn't work
10:19:13FromGitter<Varriount> @jacobdufault You mean like a marshalling/serialization setup?
10:19:13*stisa quit (Read error: Connection reset by peer)
10:19:56FromGitter<Varriount> @Araq By the way, why is get
10:21:07FromGitter<jacobdufault> @Varriount Maybe, haven't implemented it yet. but that is before the data gets to the setup proc.
10:21:31FromGitter<Varriount> Why does getTypeInfo not see past variable types (such as references)?
10:24:07FromGitter<Varriount> If I assign a child type to a variable marked as holding parent type, getTypeInfo gets the parent type information
10:25:25*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
10:26:06Araqproc toAny*[T](x: var T): Any {.inline.} =
10:26:06Araq newAny(addr(x), cast[PNimType](getTypeInfo(x)))
10:26:17Araqthat's why. it doesn't special case 'object of'
10:29:23*PMunch joined #nim
10:30:08*jinshil joined #nim
10:31:05*Arrrr joined #nim
10:33:17*bjz joined #nim
10:33:26*stisa joined #nim
10:35:21FromGitter<Varriount> Seems like a flaw to me, but oh well, probably a good reason for it.
10:35:40yglukhovAraq: what is newAny? is it real?
10:36:07*rusua quit (Quit: Connection closed for inactivity)
10:36:16Araqvarriount could be a bug, could be for good reasons. I don't remember
10:36:17FromGitter<Varriount> It's a private procedure in typeinfo
10:36:40Araqyglukhov: it's real, private and old
10:36:58yglukhovit sounds a lot like my variants
10:44:05*libman joined #nim
10:46:56FromGitter<Varriount> @Araq Well, I know the current design is the reason why the marshal module can't serialize structures that have types different than that of their variables
10:47:15*pie_ joined #nim
11:03:42*stisa quit (Read error: Connection reset by peer)
11:13:54Araqyeah so fix it :-)
11:16:09libmanmsgpack4nim has been my favorite Nim marshal method so far.
11:16:26Arrrrlink?
11:16:53libmanhttps://github.com/jangko/msgpack4nim
11:16:59Arrrrthank you
11:22:04*stisa joined #nim
11:25:46*jinshil quit (Quit: client terminated!)
11:32:15*yglukhov quit (Remote host closed the connection)
11:32:51*yglukhov joined #nim
11:33:06*vlad1777d joined #nim
11:37:13*yglukhov quit (Ping timeout: 248 seconds)
11:42:47*yglukhov joined #nim
11:45:32*yglukhov quit (Remote host closed the connection)
11:46:06*yglukhov joined #nim
11:50:38*libman quit (Ping timeout: 255 seconds)
11:50:45*yglukhov quit (Ping timeout: 258 seconds)
12:02:23*yglukhov joined #nim
12:02:32*Snircle joined #nim
12:13:29*bbl joined #nim
12:13:29*stisa quit (Read error: Connection reset by peer)
12:16:21*stisa joined #nim
12:18:09*fredrik92 joined #nim
12:20:12*couven92 quit (Disconnected by services)
12:20:18*fredrik92 is now known as couven92
12:20:37*fredrik92 joined #nim
12:28:32FromGitter<timeyyy> There is a libc msgpack being developed for neovim that is designed to be reusable https://github.com/tarruda/libmpack/blob/master/README.md
12:39:01*stisa quit (Read error: Connection reset by peer)
12:43:56*stisa joined #nim
12:45:48*Arrrr quit (Quit: WeeChat 1.5)
12:47:16*couven92 quit (Quit: Disconnecting)
12:50:56*Trioxin quit (Ping timeout: 255 seconds)
12:57:58*yglukhov quit (Remote host closed the connection)
12:58:32*yglukhov joined #nim
13:08:40*stisa quit (Read error: Connection reset by peer)
13:11:33*yglukhov quit (Remote host closed the connection)
13:12:09*yglukhov joined #nim
13:13:40*fredrik92 is now known as couven92
13:15:36*yglukhov quit (Remote host closed the connection)
13:15:49*yglukhov joined #nim
13:16:01*stisa joined #nim
13:16:58*rupil joined #nim
13:20:43*fulcrum joined #nim
13:21:44*unlaudable quit (Ping timeout: 260 seconds)
13:22:08*yglukhov quit (Remote host closed the connection)
13:22:27*yglukhov joined #nim
13:40:35*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
13:42:05*rokups quit (Quit: Connection closed for inactivity)
14:08:33*zetashift joined #nim
14:25:00*yglukhov quit (Remote host closed the connection)
14:25:35*yglukhov joined #nim
14:27:51*Kingsquee quit (Quit: https://i.imgur.com/qicT3GK.gif)
14:29:51*yglukhov quit (Ping timeout: 245 seconds)
14:40:09*yglukhov joined #nim
14:40:11*fredrik92 joined #nim
14:40:11*fredrik92 quit (Client Quit)
14:40:12*couven92 quit (Quit: Client disconnecting)
14:42:08*askatasuna quit (Quit: ZNC 1.6.3 - http://znc.in)
14:48:58*stisa quit (Read error: Connection reset by peer)
14:55:32*stisa joined #nim
14:56:19*askatasuna joined #nim
14:58:41*zetashift quit (Ping timeout: 240 seconds)
14:59:42*devted joined #nim
15:02:47*devted quit (Read error: Connection reset by peer)
15:04:35*stisa quit (Read error: Connection reset by peer)
15:09:53*adeohluwa joined #nim
15:14:18*sz0 joined #nim
15:21:22*WildMage999 joined #nim
15:27:48*stisa joined #nim
15:29:47*stisa quit (Read error: Connection reset by peer)
15:31:04*zetashift joined #nim
15:37:41*adeohluwa_ joined #nim
15:37:41*adeohluwa quit (Ping timeout: 240 seconds)
15:40:32*stisa joined #nim
15:43:47*adeohluwa_ quit (Read error: Connection reset by peer)
15:48:00*couven92 joined #nim
15:50:45*adeohluwa joined #nim
15:52:02*stisa quit (Read error: Connection reset by peer)
15:56:15FromGitter<Varriount> Lib
15:57:57FromGitter<Varriount> Is there a de facto standard protocol for typed, reference-holding data?
15:59:37*krux02 joined #nim
15:59:59*adeohluwa_ joined #nim
16:01:21*adeohluwa quit (Ping timeout: 240 seconds)
16:05:45*nsf quit (Quit: WeeChat 1.7)
16:10:34*stisa joined #nim
16:15:03*pregressive joined #nim
16:19:57*adeohluwa_ quit (Remote host closed the connection)
16:22:08flyxVarriount: something like XML or YAML?
16:22:09*Jesin quit (Quit: Leaving)
16:22:25*fulcrum quit (Ping timeout: 255 seconds)
16:23:10FromGitter<Varriount> Those are ok, but not very space efficient
16:25:52flyxif you are looking for a binary format, I don't think there's a de facto standard
16:26:32flyxwhen efficiency is a concern, protocols tailored to the use-case tend to be better
16:27:48*devted joined #nim
16:31:58FromGitter<andreaferretti> well, there are protobuf, thrift, avro...
16:35:17*Trustable joined #nim
16:36:07*handlex joined #nim
16:36:48federico3...msgpack
16:39:06FromGitter<andreaferretti> well, msgpack is schemaless
16:39:24FromGitter<andreaferretti> varriount asked for typed data
16:39:58federico3just typed or self-describing?
16:41:05*yglukhov quit (Remote host closed the connection)
16:41:12*hendi joined #nim
16:41:19federico3partially related: https://xomachine.github.io/NESM/
16:41:38*yglukhov joined #nim
16:41:41*arnetheduck quit (Ping timeout: 258 seconds)
16:41:49*yglukhov quit (Remote host closed the connection)
16:42:03*yglukhov joined #nim
16:44:01*hendi quit (Client Quit)
16:44:57*handlex quit (Ping timeout: 276 seconds)
16:51:24*yglukhov quit (Remote host closed the connection)
16:51:31*hendi joined #nim
16:51:56*yglukhov joined #nim
16:59:36*yglukhov quit (Ping timeout: 240 seconds)
17:02:41*filcuc quit (Ping timeout: 240 seconds)
17:07:04*Salewski joined #nim
17:07:29*NimBot joined #nim
17:08:35enthus1astBSON
17:09:04SalewskiAraq, is this statement (from the book ) true: "Sequences are stored on the heap and as such are garbage collected."
17:09:49SalewskiPersonally I have the feeling that sequences are objects, and only the real data is stored on the heap.
17:11:25Salewskivar s: seq[int]; echo s.len # gives 0
17:13:27*stisa quit (Read error: Connection reset by peer)
17:14:35*hendi quit (Quit: hendi)
17:15:54SalewskiSo a seq is basically a value type, not a ref type. But the buffer for the elements is a ref type, and nil be default.
17:16:57cheatfateSalewski, you can always check C code to be sure :)
17:18:19*stisa joined #nim
17:18:41*stisa left #nim (#nim)
17:21:16SalewskiYes, I think it's too late for fixes in the book. Maybe add some errata.
17:21:34*benwbooth quit (Quit: Textual IRC Client: www.textualapp.com)
17:21:54flyxSalewski: seqs are definitely on the heap
17:22:19flyxSalewski: you can be lucky that s.len in your code returns 0
17:22:44*Andris_zbx quit (Remote host closed the connection)
17:22:59flyxprobably it's implemented as if isNil(s): return 0
17:23:23flyxjust do `echo isNil(s)`, it will print true
17:24:25SalewskiInteresting idea.
17:27:34SalewskiYes indeed, echo s.isNil gives true.
17:28:28dom96A seq is definitely stored on the heap
17:28:53flyxthe seq type just has value semantics, i.e. seqs are copied on assignment
17:29:26SalewskiDom: Yes, your book is correct!
17:32:48SalewskiI was confused by: var s: seq[int]; echo s.len # gives 0
17:33:05SalewskiSometimes Nim is too smart for me. Bye...
17:36:49*Salewski left #nim (#nim)
17:37:06FromGitter<PabClsn_twitter> Hi guys :)
17:37:14dom96yeah, it's magical
17:37:27dom96I didn't like this when it was implemented
17:37:31dom96Still not sure I like it
17:39:58dom96hi PabClsn_twitter
17:40:08FromGitter<PabClsn_twitter> just a little question I'm pretty new to nim I'm trying to make the Sastantua with nim and I'm facing a little problem. I need a array and the size of the array has to be movable so I used a sequence var tabEtoiles: seq[int] but when I acces it in my for loop I have a "trying to access nil ? " error please help me https://gist.github.com/anonymous/864bda147f794d60096ff65fd2b7e98c
17:41:19*askatasuna quit (Quit: ZNC 1.6.3 - http://znc.in)
17:41:41*Jesin joined #nim
17:45:09Vladardom96: do you mean /libtcod_nim/libtcod_nim/private ?
17:45:11*kunev quit (Ping timeout: 240 seconds)
17:45:24dom96yes
17:45:36dom96/libtcod_nim/private
17:45:41dom96where the root is the git repo root
17:46:02*kunev joined #nim
17:47:06Vladarseems strange, but ok
17:48:05cheatfatePabClsn_twitter, you need to initialize your `tabEtoiles`, like `tabEtoiles = newSeq[int]()`...
17:48:21*devted quit (Ping timeout: 240 seconds)
17:49:37FromGitter<PabClsn_twitter> ah ok i’ll try thx
17:50:51FromGitter<PabClsn_twitter> when you need to acces it you have to use the « @«  right ?
17:51:14*Jesin quit (Quit: Leaving)
17:51:23FromGitter<PabClsn_twitter> beacuse when i remove it build but when i let the « @«  it don’t build ..
17:53:49FromGitter<andreaferretti> no, @ is a function that takes an array and return a sequence
17:54:24FromGitter<andreaferretti> the problem you have is that you initialize an empty sequence
17:54:32FromGitter<andreaferretti> and then try to fill the i-th slot
17:54:47FromGitter<andreaferretti> you can either make the sequence large enough
17:54:57FromGitter<andreaferretti> with `newSeqint (maxLignes)`
17:55:16FromGitter<andreaferretti> or use `tabEtoiles.add(increment)`
17:55:26FromGitter<andreaferretti> which will resize the sequence when needed
17:55:36FromGitter<PabClsn_twitter> ah ok :)
17:55:45FromGitter<PabClsn_twitter> ok i try thanks
18:07:17*brson joined #nim
18:11:59*yglukhov joined #nim
18:15:36*devted joined #nim
18:16:11*yglukhov quit (Ping timeout: 240 seconds)
18:23:12*Matthias247 joined #nim
18:26:15*hendi joined #nim
18:30:41*zetashift quit (Ping timeout: 240 seconds)
18:32:24*kulelu88 joined #nim
18:37:33*hendi quit (Quit: hendi)
18:39:24*yglukhov joined #nim
18:46:38*yglukhov quit (Remote host closed the connection)
18:47:11*yglukhov joined #nim
18:47:26FromGitter<PabClsn_twitter> hey guys do you know if there is a way to acces the last index of an array ??
18:47:41Vladararr[^1]
18:47:48*yglukhov quit (Remote host closed the connection)
18:47:52FromGitter<PabClsn_twitter> Thanks :)
18:47:56Vladarnp
18:48:01*yglukhov joined #nim
18:49:54FromGitter<PabClsn_twitter> last question do you know if there is a way to print x times a space for example ?
18:50:33FromGitter<PabClsn_twitter> because i need ton print x spaces before printing a « * » x times then a « \ » one time
18:51:19Araqstrutils.repeat
18:52:06FromGitter<PabClsn_twitter> ok thanks a lot guys !
18:53:13*Trustable quit (Remote host closed the connection)
18:53:25yglukhovAraq: i tried to find the commit that caused https://github.com/nim-lang/Nim/issues/5271, but is more than 2 months old, so that i can't even bootstrap nim that old.
19:00:39Araqjust fix the bug
19:00:55*rupil quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
19:01:40AraqI don't believe in git bisect and working backwards. the bug is in the current codegen.
19:02:14Araqso fix it.
19:04:32FromGitter<zacharycarter> is there an equivalent call to *func* in nim? I found instantiatonInfo for filename / line number but no way to retrieve function names yet
19:05:06FromGitter<zacharycarter> macro I should say
19:07:26yglukhovAraq: ok, mind merging my pr in?
19:09:47*sz0 quit (Quit: Connection closed for inactivity)
19:10:03yglukhovthanks!
19:16:28*hendi joined #nim
19:19:21*Trioxin joined #nim
19:38:36*Jesin joined #nim
19:43:40*couven92 quit (Quit: Client disconnecting)
19:45:41*Trioxin quit (Ping timeout: 240 seconds)
19:50:13*byte512 quit (Ping timeout: 260 seconds)
19:50:22cheatfateis it possible to create type with macro?
19:50:55flyxcheatfate: sure
19:51:30flyxhttps://nim-by-example.github.io/oop_macro/ does it, for example
19:53:44FromGitter<Varriount> @PabClsn_twitter arrayOrSeq[len(arrayOrSeq)]
19:53:55cheatfateflyx, thank you
20:01:46*bjz joined #nim
20:02:09*lenstr joined #nim
20:08:00*bbl quit (Quit: WeeChat 1.0)
20:11:13kulelu88does nim have HTTP2 support? If no, will it be easy to port this lib to nim: https://www.nghttp2.org ?
20:12:50federico3kulelu88: I wonder if it's worth supporting HTTP/2 vs SPDY vs QUIC
20:13:11kulelu88well I'm not asking for anyone to port it or anything, just wondering what support is offered
20:13:54federico3afaik HTTP2 is not natively supported. Porting a C client is probably relatively simple
20:17:05*hendi quit (Quit: hendi)
20:18:18*couven92 joined #nim
20:18:33*bbl joined #nim
20:22:26*bbl quit (Client Quit)
20:25:43FromGitter<Varriount> Though having native library support would be nice too
20:27:50*couven92 quit (Quit: Client disconnecting)
20:28:55*dddddd joined #nim
20:30:47*brson quit (Quit: leaving)
20:43:44FromGitter<PabClsn_twitter> guys what wrong here i dont understand … ```proc repeatT (n: T; i: Natural): seq[T] ⏎ ⏎ for i in 0..maxLignes-1: ⏎ repeat(" ", (tabEtoiles[^1 - 1] - tabEtoiles[i]) div 2)``` [https://gitter.im/nim-lang/Nim?at=58866affe836bf701080f52d]
20:43:54FromGitter<PabClsn_twitter> Error: value of type 'string' has to be discarded
20:44:54FromGitter<PabClsn_twitter> https://gist.github.com/pablocolson/3651ee44ec7969c73c9de5b0d3527def
20:45:33Vladarproc repeat returns string and it goes nowhere
20:46:21FromGitter<PabClsn_twitter> so i should do an echo if i want to display the space to repeat ?
20:46:33Vladarif you want just print the result, change it to echo repeat(...
20:47:03FromGitter<PabClsn_twitter> i try to do it but i have this now Error: implementation of 'satstentua.repeat(n: T, i: Natural)' expected
20:47:49Vladarwell you, didn't implement your proc repeat[T](n: T; i: Natural): seq[T]
20:48:05FromGitter<PabClsn_twitter> ok now i’m lost ahah
20:48:31Vladarhttp://nim-lang.org/docs/tut1.html#procedures
20:48:49Vladarbasically, you should write a procedure's body
20:49:46FromGitter<PabClsn_twitter> ok so in proc repeat I write echo ....
20:50:03FromGitter<PabClsn_twitter> and implement it in the for loop?
20:51:05VladarIs the code you pasted is supposed to be the procedure itself?
20:52:48FromGitter<PabClsn_twitter> honestly Some one gave me a link sooner and I just read the website of the repeat proc and how to use it I'm sur I'm doing something wrong
20:53:40VladarIt should be easier for me if you tell me what you trying to achieve
20:54:27FromGitter<PabClsn_twitter> i want to print X times an Space character depending of a variable
20:54:57FromGitter<PabClsn_twitter> the X is the variable
20:55:41FromGitter<PabClsn_twitter> now i have this following the tutorial
20:55:42FromGitter<PabClsn_twitter> https://gist.github.com/pablocolson/97724bc4d9853050b7d431da9a0d000e
20:56:40FromGitter<PabClsn_twitter> sorry for ask so many question but i’m quit noob :/
20:58:04Vladari don't know what your tabEtoiles contains, but [^1 - 1] seems wrong to me
20:58:29FromGitter<PabClsn_twitter> wait
20:59:06FromGitter<PabClsn_twitter> http://a.fsdn.com/con/app/proj/sastantua/screenshots/Screen%20Shot%202013-07-29%20at%201.36.31%20AM.png
20:59:17FromGitter<PabClsn_twitter> i’m tring to do this
20:59:46FromGitter<PabClsn_twitter> I have to print X spaces and the are determined by the height of the pyramid
21:00:02FromGitter<PabClsn_twitter> so i made a co to count every stars and store them into a tab
21:00:30FromGitter<PabClsn_twitter> so i re use the last Index of my tab to print the space
21:01:11FromGitter<PabClsn_twitter> and all the code is here https://gist.github.com/pablocolson/1b85b8ade5586db7f0b6d2d8df5af02e
21:01:42*brson joined #nim
21:03:58*couven92 joined #nim
21:05:36Vladarhow about https://gist.github.com/pablocolson/1b85b8ade5586db7f0b6d2d8df5af02e#gistcomment-1978702 ?
21:06:54FromGitter<PabClsn_twitter> i try because the number of stars to print are stored in the tab
21:06:58FromGitter<PabClsn_twitter> tabEtoiles
21:07:28*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
21:07:41Vladarit easily computed from the line number, as you see
21:08:00Vladarrepeat("*", n * 2 + 1)
21:09:04FromGitter<PabClsn_twitter> your a fucking genius
21:09:19FromGitter<PabClsn_twitter> you made it in 4 line
21:09:27FromGitter<PabClsn_twitter> i’m so fucked
21:12:31Vladaronce I did something similar in forth, for fun https://gist.github.com/Vladar4/838cc28a358f3ba0002f0496d92dd2cb
21:12:56FromGitter<PabClsn_twitter> Ahah ;)$
21:13:39FromGitter<PabClsn_twitter> i just need to adapt you code because there is the different floor and the space need to be precisise
21:14:11FromGitter<PabClsn_twitter> but to access the last index of your array you use anArray[^1] right ?
21:14:11Vladarwell, you've got the general idea
21:14:45Vladaryes, the arr[^n] is basically equal to arr[arr.len-n]
21:15:18FromGitter<PabClsn_twitter> ah ok the length of the array minus the current index
21:15:21FromGitter<PabClsn_twitter> ok nice
21:16:33*couven92 quit (Ping timeout: 260 seconds)
21:16:38*yglukhov quit (Remote host closed the connection)
21:17:19FromGitter<PabClsn_twitter> he really dont want to take my epeat(" ", (tabEtoiles[^1] - tabEtoiles[n])/2)
21:18:06FromGitter<PabClsn_twitter> oh i know it was dic instead of /
21:19:22FromGitter<PabClsn_twitter> with what software do you use Nim sublime text nano Vim emacs ?
21:19:28*zetashift joined #nim
21:21:17*bjz joined #nim
21:22:17Vladarvim
21:23:15*yglukhov joined #nim
21:24:13FromGitter<PabClsn_twitter> GUI ?
21:24:55Vladaryou mean gvim? yes, mostly
21:25:37FromGitter<PabClsn_twitter> here it is
21:25:42FromGitter<PabClsn_twitter> https://gist.github.com/pablocolson/27bf5812c79bed94d2218cbb3f5b0a69
21:26:02FromGitter<PabClsn_twitter> beacause i’m using sublime on mac but i have to compile in a term
21:26:08FromGitter<PabClsn_twitter> thansk a lot
21:26:12Vladarcongrats
21:26:32FromGitter<PabClsn_twitter> this language is cool as fuck
21:26:34FromGitter<PabClsn_twitter> thanks a lot men :)
21:26:45Vladarit is cool, indeed
21:27:00*nsf joined #nim
21:27:03*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
21:29:35FromGitter<PabClsn_twitter> i was trying swift but for now Oriented Object is complicated to fully understand Nim seems good for leanring
21:46:26*bjz joined #nim
21:50:44*bjz quit (Client Quit)
21:55:46*vasher_ joined #nim
21:59:02devtedPabClsn_twitter, checkout the NimLime plugin for Sublime Text; you can shift-command-b to pick
21:59:26devted'run' or 'compile', and command-b will compile/run based off your last action.
22:00:15devtedIt works fine in OS X. Just update /etc/paths so it points to nim's bin folder, and then create an applescript launcher to properly start Sublime Text.
22:00:43devtedby default Sublime Text doesn't pickup paths that you put in /etc/paths...but you can properly start Sublime Text run running this:
22:00:44devtedopen -a "/Applications/Sublime Text.app"
22:10:55*zion_ joined #nim
22:12:43FromGitter<PabClsn_twitter> I try installing NimLim
22:12:55FromGitter<PabClsn_twitter> but i’m getting Errno 13 Permissions denied
22:13:08FromGitter<PabClsn_twitter> i update my PATH but still not working
22:14:53FromGitter<PabClsn_twitter> ah your open -a "/Applications/Sublime Text.app » is working
22:15:39FromGitter<PabClsn_twitter> Thanks a lot men ;)
22:15:56FromGitter<PabClsn_twitter> do you know if i can by default lauch the app with this a option ?
22:18:44federico3a way to swap endianness for an uint64?
22:19:27FromGitter<PabClsn_twitter> i didn’t understand but i find a tuto on how to lauch app with otpion by default :)
22:20:34*nsf quit (Quit: WeeChat 1.7)
22:21:18zion_@fedrico3 have you looked at http://nim-lang.org/docs/endians.html ?
22:21:46federico3yep zion_
22:22:22federico3http://forum.nim-lang.org/t/2626/2 it's more tricky than that
22:34:26*Vladar quit (Quit: Leaving)
22:44:39zion_@fredrico3 does the following code do the trick: https://paste.scratchbook.ch/view/989be763
22:51:59*krux02 quit (Quit: Leaving)
22:58:16*vlad1777d quit (Quit: Leaving)
22:58:33zion_I just tested it and it looks like it works properly.
23:01:47*PMunch_ joined #nim
23:04:18*couven92 joined #nim
23:06:16federico3swapping 1 leads to 2 ** 56
23:10:51federico3yep. Ideally I was hoping for a simpler way
23:11:24zion_What do you mean simpler?
23:14:05federico3there's an __builtin_bswap64 for int64 in intrin.h (and besides, I wonder if it maps to a single cpu instruction)
23:15:23federico3or doing two 32-bits byte swap? http://x86.renejeschke.de/html/file_module_x86_id_21.html
23:15:50zion_Perhaps this is what you want then: https://github.com/nim-lang/Nim/blob/master/lib/pure/endians.nim#L41
23:20:12federico3yep.. oddly it's not exported directly, only using pointers and casts
23:20:37federico3thanks zion_
23:24:47*WildMage999 quit (Remote host closed the connection)
23:26:28*yglukhov quit ()
23:29:03*Trioxin joined #nim
23:31:42*ftsf_ joined #nim
23:33:49*zetashift left #nim ("Leaving")
23:39:31*yglukhov joined #nim
23:39:33*pregressive quit (Remote host closed the connection)
23:40:07*pregressive joined #nim
23:40:48*yglukhov quit (Remote host closed the connection)
23:41:19*pregressive quit (Read error: Connection reset by peer)
23:41:42*pregressive joined #nim
23:42:27*pregressive quit (Remote host closed the connection)
23:43:00*pregressive joined #nim
23:47:36*pregressive quit (Ping timeout: 240 seconds)
23:50:34*couven92 quit (Quit: Client disconnecting)
23:53:23*devted quit (Quit: Sleeping.)
23:57:17*manjaroi3 joined #nim