00:26:57 | * | chrisheller joined #nim |
00:35:15 | * | zodiak_ quit (Ping timeout: 264 seconds) |
00:41:35 | * | chrisheller quit (Remote host closed the connection) |
00:42:10 | * | chrisheller joined #nim |
00:43:01 | * | desophos joined #nim |
00:46:28 | * | chrisheller quit (Ping timeout: 252 seconds) |
00:54:14 | * | desophos quit (Read error: Connection reset by peer) |
00:57:35 | * | desophos joined #nim |
01:10:21 | * | abruanese joined #nim |
01:16:36 | * | desophos quit (Ping timeout: 250 seconds) |
01:17:11 | * | kulelu88 quit (Quit: Leaving) |
01:21:39 | * | arnetheduck joined #nim |
01:21:48 | * | chemist69_ quit (Ping timeout: 250 seconds) |
01:33:59 | * | chemist69_ joined #nim |
01:34:04 | * | kssreeram joined #nim |
01:35:57 | * | brechtm quit (Read error: Connection reset by peer) |
01:36:51 | * | brechtm joined #nim |
01:38:24 | * | josh joined #nim |
01:39:05 | * | josh is now known as Guest33000 |
01:39:12 | * | Guest33000 quit (Client Quit) |
02:09:36 | * | Demon_Fox joined #nim |
02:16:57 | * | kssreeram quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
03:02:56 | * | jeffc quit () |
03:13:28 | * | desophos joined #nim |
03:28:56 | * | zodiak joined #nim |
03:43:39 | * | zodiak quit (Ping timeout: 260 seconds) |
03:43:56 | * | kssreeram joined #nim |
03:45:56 | * | kssreeram quit (Client Quit) |
03:47:42 | * | zodiak joined #nim |
04:15:03 | * | xet7__ joined #nim |
04:16:01 | * | xet7 quit (Read error: Connection reset by peer) |
04:39:22 | * | yglukhov joined #nim |
04:44:30 | * | yglukhov quit (Ping timeout: 276 seconds) |
04:45:39 | * | nsf quit (Quit: WeeChat 1.5) |
05:09:53 | * | kssreeram joined #nim |
05:58:59 | * | brechtm quit (Read error: Connection reset by peer) |
05:59:06 | * | brechtm_ joined #nim |
06:19:48 | * | xet7__ quit (Quit: Leaving) |
06:20:32 | * | xet7 joined #nim |
06:41:07 | * | brechtm_ quit (Read error: Connection reset by peer) |
06:41:13 | * | brechtm joined #nim |
06:49:48 | * | yglukhov joined #nim |
06:54:30 | * | yglukhov quit (Ping timeout: 276 seconds) |
07:13:46 | * | der-landgraf quit (Quit: WeeChat 1.5) |
07:23:12 | * | Varriount quit (Read error: Connection reset by peer) |
07:25:39 | * | yglukhov joined #nim |
07:30:15 | * | yglukhov quit (Ping timeout: 276 seconds) |
07:37:35 | * | yglukhov joined #nim |
07:38:45 | * | pafmaf joined #nim |
07:47:06 | * | fastrom joined #nim |
08:00:57 | * | yglukhov quit (Remote host closed the connection) |
08:01:34 | * | kssreeram quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
08:04:50 | * | Matthias247 joined #nim |
08:12:49 | * | yglukhov joined #nim |
08:17:42 | * | yglukhov quit (Ping timeout: 276 seconds) |
08:48:40 | * | yglukhov joined #nim |
08:53:27 | * | yglukhov quit (Ping timeout: 276 seconds) |
08:54:41 | * | elrood joined #nim |
08:57:52 | * | zaquest quit (Remote host closed the connection) |
09:01:55 | * | zaquest joined #nim |
09:14:04 | * | Demon_Fox quit (Quit: Leaving) |
09:21:19 | * | yglukhov joined #nim |
09:30:45 | * | kssreeram joined #nim |
09:41:58 | * | GangstaCat joined #nim |
09:46:22 | * | der-landgraf joined #nim |
10:08:39 | dom96 | Anybody worked with protobuf in Nim before? |
10:09:30 | federico3 | dom96: looked at some binary protocol libs, ended up using jangko/msgpack4nim instead |
10:12:17 | dom96 | federico3: pity. A protobuf wrapper would be really nice. |
10:12:51 | dom96 | Right now I'm doing something very hackish: calling the `protoc` binary to encode/decode packets and then parsing its output. |
10:16:19 | federico3 | dom96: sounds like you just volunteered for a protobuf wrapper |
10:20:06 | dom96 | hah maybe |
10:20:16 | * | xet7_ quit (Quit: AndroIRC - Android IRC Client ( http://www.androirc.com )) |
10:20:46 | dom96 | The interesting thing about protobuf is that you can transform proto files into .c, .py etc. source files which contain type definitions which match the protocol. |
10:21:17 | dom96 | I wonder how easy that would be to do. |
10:21:43 | dom96 | Currently my program is crashing on `writeFile` after some time and I have no clue why |
10:22:28 | dom96 | But other than that my status page is working well so far https://pokemongostatus.org/ |
10:24:20 | ofelas | i wrote a .thrift parser in nim once to generate C, .proto to nim would be along the same lines, anything protobuf these days seems to be related to pokemon go |
10:24:35 | ofelas | 8) |
10:35:51 | * | kssreeram quit (Ping timeout: 264 seconds) |
10:38:24 | dom96 | ofelas: cool, is it on github anywhere? |
10:40:39 | ofelas | dom96: nope, unfortunately not, i may have it laying around somewhere, was just trying/learning Nim at the time |
10:49:05 | dom96 | aww too bad |
10:49:24 | federico3 | dom96: the code autogeneration works well, especially for java, but protobuf has the downside of unpacking entire messages and create object structures even for fields that you are never going to access |
11:04:17 | kier | Dom96: check out cap'n proto - imo it's much nicer than protobuf and allows more idiomatic data structures |
11:04:42 | dom96 | kier: I don't have a choice unfortunately |
11:06:45 | kier | Ah too bad - cap'n proto is designed so that you only need to parse what you use (rather than parsing everything and copying it into another data structure) |
11:07:45 | kier | It's been a while since I used protobuf, so not sure I can be much with that |
11:22:41 | * | yglukhov quit (Remote host closed the connection) |
11:33:13 | * | yglukhov joined #nim |
11:44:29 | * | arnetheduck quit (Ping timeout: 258 seconds) |
11:44:52 | * | arnetheduck joined #nim |
11:50:44 | * | brechtm quit (Read error: No route to host) |
11:50:56 | * | brechtm joined #nim |
12:29:20 | federico3 | the unittest lib needs some more features |
12:33:59 | * | yglukhov quit (Remote host closed the connection) |
12:39:16 | * | kssreeram joined #nim |
12:45:53 | * | yglukhov joined #nim |
12:50:23 | * | yglukhov quit (Ping timeout: 244 seconds) |
13:04:37 | dom96 | ah, of course, I'm leaking FDs |
13:07:51 | dom96 | RAII sure would be nice in Nim. |
13:10:24 | * | yglukhov joined #nim |
13:14:40 | * | yglukhov quit (Ping timeout: 244 seconds) |
13:15:24 | * | kssreeram quit (Ping timeout: 276 seconds) |
13:24:25 | elrood | depending on how literal your definition of raii is, that won't necessarily help with leaking, though |
13:50:50 | * | pafmaf quit (Ping timeout: 244 seconds) |
14:15:14 | * | arnetheduck quit (Remote host closed the connection) |
14:17:46 | * | Ven joined #nim |
14:18:49 | * | yglukhov joined #nim |
14:49:01 | * | rolha joined #nim |
14:50:26 | rolha | hi everyone. is it possible to have a proc reference in a Table? i.e. let table: Table[string, proc(x: string):string] ? |
14:50:59 | rolha | then initialised as proc a(x:string):string = x ; { "x" : a } |
15:00:28 | * | rolha quit (Quit: Textual IRC Client: www.textualapp.com) |
15:09:53 | * | Jesin quit (Quit: Leaving) |
15:12:03 | * | Jesin joined #nim |
15:30:05 | * | Matthias247 quit (Read error: Connection reset by peer) |
15:33:05 | kier | rolha: that looks like it should work. Have you tried it? |
16:08:17 | * | rolha joined #nim |
16:22:02 | * | nsf joined #nim |
16:38:51 | * | Trustable joined #nim |
16:50:19 | * | kulelu88 joined #nim |
17:00:53 | * | reyDaJavaNub joined #nim |
17:24:32 | * | yglukhov quit (Remote host closed the connection) |
17:24:54 | * | reyDaJavaNub quit (Ping timeout: 250 seconds) |
17:34:16 | kier | is there a straightforward way to dump the AST of a source code file after templates have been expanded during the compilation process? |
17:36:24 | * | yglukhov joined #nim |
17:36:52 | * | brechtm_ joined #nim |
17:38:15 | * | brechtm quit (Ping timeout: 264 seconds) |
17:40:45 | * | yglukhov quit (Ping timeout: 244 seconds) |
17:53:53 | * | yglukhov joined #nim |
17:58:48 | * | yglukhov quit (Ping timeout: 276 seconds) |
18:16:00 | * | kulelu88 quit (Quit: Leaving) |
18:22:23 | * | shadwick joined #nim |
18:23:18 | shadwick | Hi all. I was trying to use some OO combined with generics but I hit a problem. |
18:24:07 | shadwick | I have some type, "Entity", which has several subtypes. I then also have a "Repository[T: Entity]" to be able to load/store these generically. |
18:25:22 | Araq | kier: no. |
18:25:30 | Araq | it's often requested though. |
18:25:52 | Araq | shadwick: and then? |
18:25:56 | shadwick | However, I wanted to use dynamic-dispatching with the repository to allow different implementations at runtime, meaning something like "SqliteRepository[T: Entity] = ref object of Repository[T]", but that I get "invalid type SqliteRepository[SqliteRepository.T]" from a var declaration for it |
18:26:31 | shadwick | And if I drop the ": Entity" from the Sqlite generic def. it appears to hang the compiler, but I am still looking into thaty |
18:29:53 | avsej | dom96, what do you think about this fix? https://github.com/nim-lang/nimforum/pull/89/files |
18:30:11 | avsej | it works for me, but I'm not sure about implementation |
18:30:24 | avsej | maybe just replace <document> with <div> at all? |
18:37:16 | Araq | shadwick: "invalid type" usually means you try to use a generic type where the compiler cannot resolve it to a concrete type |
18:37:40 | Araq | and when you manage to hang the compiler, please create proper bug reports |
18:38:08 | shadwick | Araq: certainly, I'm trying to find the minimal case where that happened, and if I can get any more verbosity from Nim |
18:39:09 | shadwick | So I might be wrong here, but I assume that if I have "SomeType[T: Blah]", then the "Blah" constraint also includes all types that are "= object of Blah"? |
18:41:55 | Araq | yes |
18:47:51 | * | yglukhov joined #nim |
18:51:24 | * | krux02 joined #nim |
18:52:03 | * | yglukhov quit (Ping timeout: 244 seconds) |
18:52:13 | krux02 | can it be that the defer statement is broken? ``Error: internal error: expr(nkDefer); unknown node kind`` |
18:52:31 | * | Sembei quit (Read error: No route to host) |
18:58:06 | Araq | krux02: more likely is that your macro found a way to produce an AST that's not transformed properly |
19:00:13 | krux02 | Araq: actually I get that error when I try to compile the example from the tutorial here: http://nim-lang.org/docs/manual.html#exception-handling-defer-statement |
19:00:42 | krux02 | so no macro magic here |
19:00:49 | Araq | Top level defer statements are not supported since it's unclear what such a statement should refer to |
19:01:01 | Araq | ^ insufficient error checking for this? |
19:01:14 | krux02 | Ah, ok thank you |
19:05:00 | shadwick | I've produced a several line example of what I was attempting to do with the generics and subtypes here: http://ideone.com/8jlxYB |
19:06:28 | shadwick | I've come to find Nim a week ago so I'm sure I'm doing simple wrong |
19:12:23 | * | yglukhov joined #nim |
19:16:51 | * | yglukhov quit (Ping timeout: 244 seconds) |
19:22:43 | krux02 | shadwick: so what are you trying to express with your code? |
19:25:00 | krux02 | my knowledge so far of generics is, that you should not use constraints on generic types, because concepts are not yet ready |
19:27:05 | * | kssreeram joined #nim |
19:27:35 | shadwick | krux02: Coming from Ada2012 or Java, I would consider an interface of "Repository" to read or write entity objects of T. I then want to provide several implementations of Repository. This is due to it changing via runtime configuration, etc. |
19:28:12 | shadwick | The thing here is that I have a repository for domain type X and one for domain type Y, both of why are just "Repository[X]" and "Repository[Y]", where X and Y are both of type T |
19:28:19 | krux02 | I don't know ada, but I do know java |
19:28:29 | krux02 | generics do not work like they work in java |
19:28:49 | * | Matthias247 joined #nim |
19:29:16 | krux02 | I think the nim compiler doesn't care weather X and Y are both of type T |
19:29:33 | krux02 | you can just leave out the `` : Entity `` part |
19:29:40 | shadwick | krux02: But then what is the point of specifying constraints like "Something[T: Entity]"? |
19:30:29 | shadwick | krux02: The reason for that constraint/bound was to guarantee the T objects have a specific field that is common to all entities |
19:30:37 | shadwick | for this DB layer |
19:30:48 | krux02 | In my experience they have a very good purpose, but in my experience and what I've read in the forums, they are not a stable enough language feature to use them in real code |
19:30:57 | krux02 | so for now, just leave them out |
19:31:35 | krux02 | you should know that unlike java, in generics the nim compiler generatas code for every type you put in the generic type |
19:32:04 | krux02 | java does not do that, java relies on the virtual dispatch of interfaces |
19:32:48 | krux02 | yes, concepts are meant to give you that certainty, but sadly concept are not stable yet. |
19:33:53 | * | kulelu88 joined #nim |
19:34:33 | shadwick | krux02: So that's the same as Ada generics. Because I'm defining an "interface" that actually requires a generic parameters, this might be the issue |
19:35:14 | * | kulelu88 quit (Max SendQ exceeded) |
19:35:19 | shadwick | In Java, I could always pass a "Repository<? extends Entity>" around, but there is no such "type" in Ada if done this way since the Repository belongs inside a generic unit |
19:35:40 | * | kulelu88 joined #nim |
19:35:58 | * | cnu- joined #nim |
19:36:02 | * | kulelu88 quit (Max SendQ exceeded) |
19:36:23 | * | kulelu88 joined #nim |
19:37:46 | krux02 | http://ideone.com/gu1405 |
19:37:52 | * | yglukhov joined #nim |
19:39:03 | shadwick | krux02: However, with that, you cannot define some proc elsewhere that is "proc whatever[R: Repository](repo: R): \ r.someMethod()" since SqliteRepository is not a Repository |
19:39:22 | krux02 | shadwick: I removed all inheritance (in nim you don't need inheritance to use generics) |
19:39:47 | shadwick | unless the missing piece is that the generic checking here is like templates in C+ |
19:39:58 | krux02 | it is |
19:40:17 | shadwick | as-in, a method taking T and using "T.field" will not fail-typechecking unless a particular instantiation provides a T without ".field" |
19:40:28 | krux02 | generic checking is like templates in c++, except that it does not support template specialization |
19:40:40 | shadwick | i.e. checking only the concrete expansions as opposed to the abstract |
19:42:32 | krux02 | yes that's exactly the case, and concepts are there, to give you better error messages in case of generic parameters are not suitable |
19:42:48 | * | yglukhov quit (Ping timeout: 276 seconds) |
19:43:01 | shadwick | krux02: Ok, thanks for the help. I will revisit how I'm designing this now with that info |
19:51:59 | * | yglukhov joined #nim |
20:01:06 | * | desophos quit (Ping timeout: 250 seconds) |
20:05:41 | * | gokr joined #nim |
20:06:07 | * | brechtm_ quit (Remote host closed the connection) |
20:06:58 | * | shadwick quit (Ping timeout: 250 seconds) |
20:11:59 | * | gokr quit (Ping timeout: 244 seconds) |
20:12:44 | * | brechtm joined #nim |
20:27:26 | * | gokr joined #nim |
20:28:37 | * | brechtm quit (Remote host closed the connection) |
20:35:39 | * | xet7_ joined #nim |
20:40:24 | * | brechtm joined #nim |
20:42:31 | * | gokr quit (Read error: No route to host) |
20:45:47 | * | brechtm quit (Remote host closed the connection) |
20:46:03 | * | brechtm joined #nim |
20:50:31 | * | Trustable quit (Remote host closed the connection) |
20:58:34 | * | krux02 quit (Quit: Verlassend) |
21:06:15 | * | brechtm quit (Remote host closed the connection) |
21:07:54 | * | roose joined #nim |
21:08:23 | * | brechtm joined #nim |
21:19:10 | * | krux02 joined #nim |
21:20:05 | krux02 | I can't find the nim equivalent of std::numeric_limits, where is the maximum of an int32 etc defined? |
21:23:54 | krux02 | and is there something I can use for a bitarray (I don't work on enums, something like c++ std::vector<bool> would be nice in this context) |
21:28:08 | Araq | intsets module comes close, I guess |
21:28:17 | Araq | high(int32) |
21:29:29 | * | brechtm_ joined #nim |
21:31:54 | roose | hi all |
21:32:51 | * | brechtm quit (Ping timeout: 264 seconds) |
21:33:04 | roose | Araq you wrote "Python doesn't use OrderedDicts here, so no." about ordered json, but python have "object_hook" in json.load |
21:33:39 | * | brechtm_ quit (Ping timeout: 250 seconds) |
21:34:28 | Araq | roose: ok :-) |
21:34:47 | roose | oh, *object_pairs_hook |
21:36:18 | roose | and I can get ordered data with json.loads(file_name, object_pairs_hook=collections.OrderedDict) |
21:37:02 | roose | how about make something like this in nim? ) |
21:37:08 | * | fastrom quit (Quit: Leaving.) |
21:40:54 | krux02 | Araq: thanks for high(int32) that works, but intset is not what I am looking for. I was looking for something that is guaranteed to not allocate, because I want to use it for an object pool of a particle system. |
21:43:30 | Araq | I fail to see the connection between "doesn't allocate" and "used for pooling" |
21:46:32 | * | kingofoz quit (Ping timeout: 260 seconds) |
21:46:54 | krux02 | Araq: don't worry it's not that important for the moment. But `sparse` was the keyword is what i am explicitly not looking for. I was looking for something that is defined to be just one continious chunk of memory |
21:47:06 | * | kingofoz joined #nim |
21:47:26 | Araq | hey, but it's interesting |
21:47:38 | Araq | so what is the connection? |
22:00:01 | krux02 | in memory pooling, or object pooling there is the requirement to create some sort of index to give out free objects. This index is usually a bit array every bit corresponds weather one object or one chunk of memory is currently in use. But when the memory pool itself might allocate when one object get's reserved, it kind of defeats the purpose of the whole pooling. And sparse datastructures do allocate on certain changes. |
22:27:34 | Araq | vector<bool> does reallocate ... |
22:34:42 | roose | ok, if ordered JSON is impossible =), how to compare two Ordered Table? |
22:39:44 | * | fvs joined #nim |
22:41:03 | * | elrood quit (Quit: Leaving) |
22:42:47 | fvs | hi, it is possbile to populate an array using a proc before compilation? I want my code to use a fixed array instead of a seq and I'm too lazy filling it myself. |
22:44:06 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
22:51:45 | Araq | fvs: sure, use a compile-time proc or a macro |
22:51:56 | Araq | roose: we'll get ordered json |
22:58:19 | roose | Araq: sorry for my english and i newbie to nim, i wanted copy json.nim and change Table to OrderedTable |
23:00:45 | * | Matthias247 quit (Read error: Connection reset by peer) |
23:02:32 | roose | tables.nim have comparsion procedure for Table but none for OrderedTable |
23:04:43 | * | kssreeram quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
23:11:17 | * | der-landgraf quit (Quit: WeeChat 1.5) |
23:12:11 | Araq | roose: PRs welcome |
23:18:41 | roose | Araq: ok, I'll try |
23:30:27 | * | der-landgraf joined #nim |
23:30:27 | * | der-landgraf quit (Changing host) |
23:30:27 | * | der-landgraf joined #nim |
23:30:42 | * | fvs left #nim ("ERC (IRC client for Emacs 24.5.1)") |
23:41:06 | * | kulelu88 quit (Quit: Leaving) |
23:52:21 | * | der-landgraf quit (Quit: WeeChat 1.5) |
23:53:58 | * | der-landgraf joined #nim |
23:53:59 | * | der-landgraf quit (Changing host) |
23:53:59 | * | der-landgraf joined #nim |
23:56:05 | * | rolha quit (Read error: Connection reset by peer) |
23:57:28 | * | rolha joined #nim |