<< 31-12-2017 >>

00:08:53*endragor joined #nim
00:11:23*MJCaley joined #nim
00:13:27*endragor quit (Ping timeout: 240 seconds)
00:29:32*endragor joined #nim
00:33:57*endragor quit (Ping timeout: 240 seconds)
01:01:33*yglukhov joined #nim
01:05:57*yglukhov quit (Ping timeout: 240 seconds)
01:20:46*chamar quit (Quit: Leaving)
01:42:06*vlad1777d joined #nim
02:39:53*chemist69 quit (Ping timeout: 252 seconds)
02:44:11*S1t1Schu joined #nim
02:48:17*S1tiSchu quit (Ping timeout: 268 seconds)
02:48:20*endragor joined #nim
02:52:12*dandevelo quit (Ping timeout: 272 seconds)
02:52:49*endragor quit (Ping timeout: 248 seconds)
02:53:17*chemist69 joined #nim
03:12:09*user0 quit (Quit: user0)
03:12:17*user0 joined #nim
03:37:54*BitPuffin|osx joined #nim
04:05:11*MJCaley quit (Quit: MJCaley)
04:14:27FromGitter<gogolxdong> Is there any description of importc or importcpp, I don't quite get it.
04:15:22FromGitter<Quelklef> https://nim-lang.org/docs/backends.html ?
04:16:12FromGitter<gogolxdong> not detailed enough
04:16:27*vlad1777d quit (Ping timeout: 240 seconds)
04:17:35FromGitter<gogolxdong> Quoted from Araq ⏎ 'importcpp' doesn't mean "import from C++" (sorry!) ⏎ it means "import from the target environment as a method or pattern" ⏎ importcpp: "name" ⏎ is a shortcut for ... [https://gitter.im/nim-lang/Nim?at=5a4864df68d092bb6209224c]
04:19:22FromGitter<gogolxdong> Specifically if I want to use gapi object of Google Compute Engine javascript SDK in karax , how do I do?
04:21:02*tefter joined #nim
04:21:26FromGitter<gogolxdong> I found I had never understood where `importc` or `importcpp` import from.
04:41:14*dddddd quit (Remote host closed the connection)
05:10:15*endragor joined #nim
05:24:17*dandevelo joined #nim
05:37:33*dandevelo quit (Ping timeout: 264 seconds)
05:56:12*endragor quit (Remote host closed the connection)
05:59:13*endragor joined #nim
06:13:22FromGitter<Varriount> @gogolxdong Well, how would you use the object in JavaScript?
06:14:53*xkapastel quit (Quit: Connection closed for inactivity)
06:48:30*sz0 joined #nim
06:51:38*yglukhov joined #nim
07:07:01*yglukhov quit (Remote host closed the connection)
07:34:04*dandevelo joined #nim
07:38:27*dandevelo quit (Ping timeout: 240 seconds)
07:44:09*miran joined #nim
07:47:36*Vladar joined #nim
08:23:10*marenz__ joined #nim
08:32:50FromGitter<gogolxdong> I just don't know how in karax.
08:53:12*claudiuinberlin joined #nim
09:02:37*gmpreussner quit (Ping timeout: 256 seconds)
09:05:44*gmpreussner joined #nim
09:15:05*Yardanico[Phone] quit (Ping timeout: 256 seconds)
09:16:07*Yardanico[Phone] joined #nim
09:34:16FromGitter<alehander42> @gogolxdong the whole point of import pragmas is to tell Nim about an existing function/variable
09:35:45FromGitter<alehander42> e.g. you have `__dirname` and you want to somehow access it in Nim
09:36:24FromGitter<alehander42> you can write ⏎ ⏎ ```dirname* {. importcpp: "__dirname" .}: cstring``` ⏎ ⏎ and now the language knows how to compile this name (to `__dirname`) and what its type is (you dont need to cast) [https://gitter.im/nim-lang/Nim?at=5a48af9884fb74b9401ffef8]
09:37:42FromGitter<alehander42> I have no idea why is it called `importcpp` tho, @Araq ? I also thought it's for `import c++` in the beginning, but it's more like `importc_pattern` or something
09:52:17*gokr joined #nim
10:00:32*endragor quit (Remote host closed the connection)
10:01:35*rauss quit (Read error: Connection reset by peer)
10:02:46*rauss joined #nim
10:04:54*MJCaley joined #nim
10:08:42FromGitter<gogolxdong> @alehander42 Do I use `var gapi {. importcpp:"gapi".}` in Google Compute Engine javascript SDK case?
10:15:05*MJCaley quit (Quit: MJCaley)
10:23:02FromGitter<gogolxdong> ```code paste, see link``` ⏎ ⏎ Do I user `proc authorization() :JsObject {. importcpp .}` [https://gitter.im/nim-lang/Nim?at=5a48ba850163b0281097c2ec]
10:32:40*nsf joined #nim
10:47:47*Ven`` joined #nim
10:47:49*Ven`` quit (Client Quit)
10:58:14dom96gogolxdong: look into how other JS wrappers are made
10:59:02dom96Example: https://github.com/stisa/jswebsockets/blob/master/src/jswebsockets.nim
11:01:03*endragor joined #nim
11:06:03*Ven`` joined #nim
11:08:13*yglukhov joined #nim
11:09:22*endragor quit (Ping timeout: 272 seconds)
11:12:57*yglukhov quit (Ping timeout: 264 seconds)
11:27:40*endragor joined #nim
11:27:47*dddddd joined #nim
11:47:02*yglukhov joined #nim
11:50:23*scriptum quit (Quit: Leaving)
11:51:27*yglukhov quit (Ping timeout: 240 seconds)
11:54:25*endragor quit (Remote host closed the connection)
12:01:50*Trustable joined #nim
12:09:52*vlad1777d joined #nim
12:17:39*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
12:18:22*natrys joined #nim
12:29:53*nsf quit (Quit: WeeChat 2.0.1)
12:30:41*endragor joined #nim
12:51:01*themagician joined #nim
12:55:08dom96Nim's C++ wrapping capabilities sure are awesome
13:02:56dom96https://stackoverflow.com/a/48042694/492186 :D
13:07:31*dandevelo joined #nim
13:12:26*lastjedi joined #nim
13:12:27*dandevelo quit (Ping timeout: 240 seconds)
13:19:34*lastjedi quit (Remote host closed the connection)
13:19:54*profkitkat joined #nim
13:25:46*Ven`` joined #nim
13:33:40*Yardanico joined #nim
13:43:53Yardanicodom96, merge this? https://github.com/nim-lang/Nim/pull/7005
13:55:23*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
13:57:45*Amrykid2 quit (Quit: Goodbye!)
14:00:37Araqalehander42: historical accident
14:05:54*endragor quit (Remote host closed the connection)
14:19:42*deathstar joined #nim
14:22:31*profkitkat quit (Ping timeout: 260 seconds)
14:23:27*Ven`` joined #nim
14:35:33Yardanicoohh it's so satisfying to see nim compiler bootstrapping itself on 16-core machine
14:37:27*gokr quit (Ping timeout: 268 seconds)
14:41:07*endragor joined #nim
14:44:17*xet7 quit (Quit: Leaving)
14:53:18dom96So what's everyone's new year plan?
14:54:54*endragor quit (Remote host closed the connection)
14:55:30*Trustable quit (Remote host closed the connection)
14:58:26*yglukhov joined #nim
15:00:26*MJCaley joined #nim
15:02:06FromGitter<data-man> To Learn Nim :-)
15:02:27*yglukhov quit (Ping timeout: 240 seconds)
15:07:29FromGitter<Varriount> To learn German.
15:10:02*dandevelo joined #nim
15:11:32*MJCaley quit (Quit: MJCaley)
15:15:13*dandevelo quit (Ping timeout: 248 seconds)
15:23:43*yglukhov joined #nim
15:33:56*themagician_n joined #nim
15:35:00*S1tiSchu joined #nim
15:35:27*themagician quit (Ping timeout: 248 seconds)
15:36:00*earenndil quit (Ping timeout: 248 seconds)
15:36:31*gmpreussner quit (Ping timeout: 248 seconds)
15:37:04*bozaloshtsh quit (Ping timeout: 248 seconds)
15:37:04*Xe quit (Ping timeout: 248 seconds)
15:37:35*natrys quit (Ping timeout: 248 seconds)
15:37:36*claudiuinberlin quit (Ping timeout: 248 seconds)
15:37:36*Vladar quit (Ping timeout: 248 seconds)
15:37:36*S1t1Schu quit (Ping timeout: 248 seconds)
15:37:36*onionhammer1 quit (Ping timeout: 248 seconds)
15:37:36*MonsterAbyss quit (Ping timeout: 248 seconds)
15:38:01*onionhammer1 joined #nim
15:39:27*ldlework quit (Ping timeout: 240 seconds)
15:39:36*endragor joined #nim
15:39:50*endragor quit (Remote host closed the connection)
15:41:16*surma quit (Ping timeout: 260 seconds)
15:42:30*ldlework joined #nim
15:42:59*gmpreussner joined #nim
15:43:13*bozaloshtsh joined #nim
15:43:13*bozaloshtsh quit (Changing host)
15:43:13*bozaloshtsh joined #nim
15:43:14*MonsterAbyss joined #nim
15:43:50*Xe joined #nim
15:46:15*yglukhov quit (Remote host closed the connection)
15:49:44*natrys joined #nim
15:50:58*MJCaley joined #nim
15:53:22*Vladar joined #nim
15:57:36FromGitter<RedBeard0531> Dom96 out of curiosity, what are you building with your libclang/nim mashup?
16:04:40*vlad1777d quit (Remote host closed the connection)
16:07:26*MJCaley quit (Quit: MJCaley)
16:09:19*endragor joined #nim
16:10:07dom96RedBeard0531: An obfuscator for Uni.
16:12:35FromGitter<RedBeard0531> Ahh, I was hoping it would be something to do with indexing or searching C++ codebases, since I've been meaning to build that for a while for work
16:13:18*endragor quit (Remote host closed the connection)
16:14:15FromGitter<RedBeard0531> Any chance anyone has a nim heterogeneous hash table? Specifically I'd like to store keys as strings, but support lookup by cstring without having to allocate a new string.
16:15:09FromGitter<Quelklef> write a second `[]` proc?
16:16:05FromGitter<Quelklef> `\`[]\`string, V (table: Table[string, V], key: string) = <loop thru keys and check if eq to \`key\` then return> `
16:16:54FromGitter<RedBeard0531> The point of a hash table is O(1) lookup. Making it O(N) won't be faster than allocating a string.
16:17:05FromGitter<Quelklef> oh, shoot, that's right
16:17:06FromGitter<Quelklef> hold on
16:25:36FromGitter<RedBeard0531> The table has 5-10,000 entries and I think I'm shooting for ~1 million lookups with a time budget of about 100ms. If I'm reading the profiles right, I think I can hit that except for the time spent allocating and GCing all the temporary strings that get created.
16:33:33*earenndil joined #nim
16:34:10FromGitter<Quelklef> im in the Table implementation seeing if i can write a proc for this
16:34:30FromGitter<Quelklef> but there'd need to a a cstring hasher which guarantees the same key as the corresponding string for each input
16:34:49FromGitter<Quelklef> which maybe is by default how it works. I doubt it, but
16:35:48FromGitter<RedBeard0531> actually, it is https://github.com/nim-lang/Nim/blob/master/lib/pure/hashes.nim#L131-L150
16:40:17*dandevelo joined #nim
16:41:51FromGitter<alehander42> I just realized I can directly do `[]`(a: varargs[..])
16:45:14*dandevelo quit (Ping timeout: 276 seconds)
16:48:09*sz0 quit (Quit: Connection closed for inactivity)
16:51:26FromGitter<Quelklef> rather than what
16:51:36FromGitter<Quelklef> also, is there some way to access unexposed parts of a module?
16:54:09FromGitter<RedBeard0531> Quelklef I think I can just make the table keyed by cstring, assuming that strings tagged shallow keep the same cstring pointers when copied and not modified
16:55:26FromGitter<RedBeard0531> The value is an object that includes the key, so that should keep the cstring alive even if it feels a bit unsafe
16:55:42FromGitter<Quelklef> aaaaaaaaaa I'm in the middle of making your solution ;-;
16:55:58FromGitter<Quelklef> Whatever; you can do that and I'll holler when I've finished this alternative
16:58:00*MJCaley joined #nim
17:00:21*onionhammer1 quit (Ping timeout: 264 seconds)
17:00:48*onionhammer1 joined #nim
17:01:13FromGitter<RedBeard0531> Publish it on nimble! It is a super useful widget. We use something similar all the time at work to massive benefit.
17:01:55FromGitter<Quelklef> If I can get it working, lol
17:02:12FromGitter<Quelklef> Never published anything before, though; exciting!
17:03:11dom96you should be able to just grab a cstring out of a string by doing addr(str[0])
17:08:44FromGitter<RedBeard0531> Is that address guaranteed to be stable after copying a string if I call shallow on it?
17:10:44FromGitter<Quelklef> I'm not sure if doing it my way is possible. I don't think the tables module exposes enough for it to work : /
17:13:38FromGitter<RedBeard0531> I'm pretty sure it doesn't, which is why I came to ask if anyone had an impl that does support this
17:14:26FromGitter<Quelklef> shame
17:14:54FromGitter<Quelklef> one of the first things I loved about Nim was how you could define all the functionality you needed, wherever you needed
17:15:05FromGitter<Quelklef> procs didn't have to be defined with their respective data typed, like in many OOP langs
17:16:43FromGitter<Quelklef> I can understand allowing access to unexposed stuff would break modules as a black box and allow for really iffy code which won't work when things are updated
17:17:02FromGitter<Quelklef> but it *would* be cool, and useful if contained
17:27:02FromGitter<RedBeard0531> Quelklef: I'm not sure if this is officially sanctioned, but you can include tableimpl to get a head start like the stdlib: https://github.com/nim-lang/Nim/blob/master/lib/pure/collections/tables.nim#L119. Alternatively you could do something like including tables.nim in a helper module to get access to the internals. That feels kinda dirty though...
17:27:02*Yardanico[Phone] quit (Ping timeout: 268 seconds)
17:28:08*deathstar quit (Ping timeout: 252 seconds)
17:34:55FromGitter<Quelklef> Oh, is that what include does?
17:35:03FromGitter<Quelklef> I guess my whole lil rant there is dumb then
17:35:14FromGitter<Quelklef> I think that'd be the best way to do it actually
17:35:18FromGitter<Quelklef> I'll try again later
17:38:16Yardanicoinclude just includes another nim file :)
17:40:21*surma joined #nim
17:41:27*endragor joined #nim
17:48:08*profkitkat joined #nim
17:56:46*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
18:02:03*yglukhov joined #nim
18:06:57*yglukhov quit (Ping timeout: 264 seconds)
18:09:08*vlad1777d joined #nim
18:17:57*craigger quit (Ping timeout: 256 seconds)
18:20:11*craigger joined #nim
18:26:45*Ven`` joined #nim
18:27:17*yglukhov joined #nim
18:28:57*dandevelo joined #nim
18:32:27*miran quit (Quit: Konversation terminated!)
18:34:15*dandevelo quit (Ping timeout: 268 seconds)
18:37:29*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
18:40:26*MJCaley quit (Quit: MJCaley)
18:58:27*profkitkat quit (Ping timeout: 240 seconds)
18:58:33*Ven`` joined #nim
19:04:07*MJCaley joined #nim
19:09:23*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
19:12:33*endragor quit (Remote host closed the connection)
19:14:14*endragor joined #nim
19:17:25*vlad1777d quit (Ping timeout: 268 seconds)
19:17:32*endragor quit (Remote host closed the connection)
19:28:15FromGitter<RedBeard0531> Well I changed the table to use cstring keys. It feels a bit dirty, but it shaved 30% off total program runtime so its probably worth it.
19:56:05*user0 quit (Quit: user0)
19:58:45*user0 joined #nim
20:06:57*BitPuffin|osx quit (Ping timeout: 264 seconds)
20:11:54*azur_kind joined #nim
20:19:10*yglukhov quit (Remote host closed the connection)
20:21:11*craigger quit (Ping timeout: 240 seconds)
20:23:32*vlad1777d joined #nim
20:31:57*vlad1777d quit (Ping timeout: 240 seconds)
20:37:29Yardanicohappy new year everyone (23 minutes left!). where does nim search for dll's?
20:37:41YardanicoI have librouter.dll in the same directory as my .exe
20:37:45Yardanicoand it can't load it
20:37:57Yardanicocould not load: librouter.dll
20:42:34*Yardanico[Phone] joined #nim
20:57:18*yglukhov joined #nim
20:57:48FromGitter<Quelklef> : o I still have 8 hours till midnight
20:58:16FromGitter<Quelklef> I thought it worked in same directory
20:58:19FromGitter<Quelklef> try recompiling
20:58:42FromGitter<Quelklef> lib/nimrtl.dll is in the same dir as lib/nimrtl.nim
20:58:44FromGitter<Quelklef> so dik
21:05:31Yardanico[Phone]Happy New year everyone!
21:11:33*MJCaley quit (Quit: MJCaley)
21:16:38*MJCaley joined #nim
21:20:45*xet7 joined #nim
21:39:08Yardanicohmm, really strange
21:39:15Yardanicostill doesn't work :)
21:42:46dom96Still a little over 2 hours here
21:42:56dom96new year's on IRC sure is fun heh
21:51:38YardanicoAHH
21:51:39YardanicoI forgot!
21:51:49Yardanicousually dlls depend on other dlls
21:52:55*arecacea1 quit (Remote host closed the connection)
21:53:14*arecacea1 joined #nim
21:53:27Yardanicohmm, that didn't help
21:54:35dom96use dependency walker
21:54:44dom96make sure the DLL is the correct arch
21:55:53Yardanicodom96, AAHHH!
21:56:02Yardaniconim compiles for x64 by default for x64 bit gcc
21:58:54dom96it'd be nice to get some more detailed errors for this
21:59:05dom96surely we can write a little procedure that detects the arch of a dll
21:59:28*yglukhov quit (Remote host closed the connection)
22:00:33Yardanicodom96, well on windows you can use GetLastError() to get the error code
22:03:25*yglukhov joined #nim
22:03:56*yglukhov quit (Remote host closed the connection)
22:08:09*yglukhov joined #nim
22:11:00YardanicoI'm just writing a wrapper to library written in pascal :D
22:15:19dom96there is a pas2nim as well in case that helps :)
22:15:23*demi- joined #nim
22:15:57*yglukhov quit (Remote host closed the connection)
22:18:15Yardanicodom96, well it was very easy to translate pascal header file to nim file :)
22:18:18Yardanico*wrapper file
22:23:52*azur_kind quit (Ping timeout: 272 seconds)
22:24:08*MJCaley quit (Quit: MJCaley)
22:36:08*Vladar quit (Quit: Leaving)
22:36:46*user0 quit (Remote host closed the connection)
22:37:09*user0 joined #nim
22:40:10Yardanicohmm, can I write a proc which accepts any pointer type?
22:40:18Yardanicoand how do I, for example, pass cstring to it?
22:42:40dom96`pointer`
22:43:26*nsf joined #nim
22:47:33Yardanicodom96, thanks!
22:49:32*nsf quit (Quit: WeeChat 2.0.1)
22:55:54YardanicoIs there a way to convert array[15, char] to string ? :)
22:56:51*Jesin quit (Quit: Leaving)
22:59:10Yardanicoah
22:59:14Yardanicoit's $cstring(unsafeAddr arr)
23:00:27FromGitter<RedBeard0531> Yardanico that only works if arr is null-terminated
23:01:01YardanicoRedBeard0531: it is null-terminated in my case, so that's OK
23:01:09Yardanico(well it's windows wide string actually)
23:01:11Yardanicobut it works
23:02:33Yardanicowell it doesn't really work :D
23:03:34Yardanicoarray contains this
23:03:34Yardanico['\xFF', '\xFF', '\xFF', 'R', 'o', 'u', 't', 'e', 'r', 'S', 'c', 'a', 'n', '\x00', '\x00']
23:03:51Yardanico(after calling procedure from a dll)
23:08:37FromGitter<RedBeard0531> This is probably not the best time to ask, but lets see. What is the nimmiest way to associate a proc with a type? Specifically, I want to create something like IndexedSet[T, KeyFunc] that stores a T but supports lookup as-if by KeyFunc(T). For example `proc keyFunc(o: MyRefObj): cstring = o.stringField.cstring`. Then all the lookup functions on IndexedSet[T] would take a cstring and return MyRefObj. I don't want
23:08:37FromGitter... to just use a mixin proc (like hash for Table) because you may want to index a single type by multiple fields.
23:12:48dom96Hrm, I'm not 100% sure what you're looking for.
23:15:41FromGitter<RedBeard0531> How should IndexedSet let consumers specify the KeyFunc?
23:17:03*xet7 quit (Quit: Leaving)
23:17:41dom96You could use whatever `keyFunc` is available for T
23:17:55dom96or store a keyFunc inside the IndexedSet object
23:17:57FromGitter<RedBeard0531> @Yardanico What do you want the string to be? '\xFF' isn't a valid utf8 char and that string doesn't look like utf16/ucs2
23:20:22*onionhammer1 is now known as onionhammer
23:22:07FromGitter<RedBeard0531> @dom96 both of those have downsides. 1 can only support a single keyFunc per T (I think) and 2 requires a runtime call through a function pointer (I think). Given the choice, I think 1 is better, but I was hoping there would be a solution without either downsided
23:22:41dom96how many keyFuncs do you want to support per T?
23:25:33FromGitter<RedBeard0531> Up to consumer. Consider something like `type Person = ref object[email, phoneNumber: string]`. You may want separate IndexedSet[Person] objects for both email and phone number that hold the same people.
23:28:04FromGitter<jaccarmac> But you want the types of those separate sets to be the same?
23:28:39FromGitter<RedBeard0531> But maybe I'm just overcomplicating it. For now I only need a single keyFunc. I'm trying to replace fs here since for every entry the key is value.name, and I often want to do lookups by cstrings: https://github.com/RedBeard0531/nimja/blob/master/nimja.nim#L26-L40 (this is what I was asking about earlier)
23:29:45FromGitter<RedBeard0531> @jaccarmac They don't need to be. I assumed it would be more efficient if they are separate types, but I'd be happy to be proven wrong.
23:30:42FromGitter<RedBeard0531> They should both have the same element type though: Person. They may but are not required to have the same virtual key type.
23:32:00FromGitter<jaccarmac> Seems to me the constructor could just take the key function then.
23:32:41FromGitter<jaccarmac> If you want to make the set generic over the function there will need to be some wizardry since functions can't fill type parameters.
23:34:27Araqhappy new year!
23:35:54FromGitter<RedBeard0531> Are you in a half hour timezone? ☺
23:36:15Araqno, I'm late
23:36:54Araqmy neighbor set my garden on fire, had to watch
23:37:57Araqdo we have a wrapper for unsqlite?
23:47:14*user0 quit (Quit: user0)
23:49:20dom96lol what