00:25:21 | * | shodan45 joined #nim |
00:33:40 | * | irrequietus quit () |
00:33:44 | * | joelmo quit (Quit: Connection closed for inactivity) |
00:39:35 | * | juanfra quit (Quit: juanfra) |
00:43:28 | * | juanfra joined #nim |
00:46:46 | * | Trustable_2 quit (Quit: Leaving) |
01:00:31 | * | jakesyl quit (Ping timeout: 260 seconds) |
01:05:38 | * | jaco60 quit (Ping timeout: 260 seconds) |
01:12:56 | * | jakesyl joined #nim |
01:45:55 | * | lokulin quit (Changing host) |
01:45:55 | * | lokulin joined #nim |
02:04:10 | * | yglukhov joined #nim |
02:08:29 | * | yglukhov quit (Ping timeout: 246 seconds) |
02:12:22 | * | vendethiel quit (Ping timeout: 260 seconds) |
02:16:56 | * | pregressive joined #nim |
02:34:30 | * | vendethiel joined #nim |
02:35:16 | * | nicktick joined #nim |
02:38:01 | cryzed | Is it just me or does nre not behave properly with anonymous capturing groups |
02:38:10 | cryzed | they show up in the RegexMatch.captures but really shouldn't |
02:38:51 | cryzed | ah nevermind, they don't |
02:46:42 | * | pregressive quit (Remote host closed the connection) |
02:48:54 | * | theduke quit (Ping timeout: 245 seconds) |
02:55:44 | * | vendethiel quit (Ping timeout: 246 seconds) |
03:03:05 | * | theduke joined #nim |
03:06:59 | * | nicktick quit (Ping timeout: 260 seconds) |
03:09:22 | * | Demon_Fox joined #nim |
03:15:00 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
03:17:08 | * | bjz joined #nim |
03:33:53 | * | makoLine quit (Ping timeout: 246 seconds) |
04:23:59 | * | ephja quit (Ping timeout: 260 seconds) |
04:51:35 | * | makoLine joined #nim |
04:58:03 | * | makoLine quit (Ping timeout: 260 seconds) |
05:01:25 | cryzed | :) |
05:14:30 | * | makoLine joined #nim |
05:33:20 | * | darkf joined #nim |
05:40:09 | * | yglukhov joined #nim |
05:44:26 | * | yglukhov quit (Ping timeout: 246 seconds) |
05:47:33 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
05:48:52 | * | bjz joined #nim |
05:53:58 | * | zepolen joined #nim |
06:04:48 | * | gunn quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
06:36:09 | * | desophos quit (Read error: Connection reset by peer) |
06:41:29 | * | gunn joined #nim |
06:53:46 | * | pregressive joined #nim |
07:39:05 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
07:42:04 | * | bjz joined #nim |
07:58:23 | * | shodan45 quit (Quit: Konversation terminated!) |
08:00:59 | * | pregressive quit (Remote host closed the connection) |
09:02:07 | * | gmpreussner|work quit (Read error: Connection reset by peer) |
09:06:54 | * | Demon_Fox quit (Quit: Leaving) |
09:21:38 | * | yglukhov joined #nim |
09:26:18 | * | zepolen quit (Remote host closed the connection) |
09:35:31 | * | Arrrr joined #nim |
09:41:13 | * | yglukhov quit (Remote host closed the connection) |
09:49:05 | * | makoLine quit (Ping timeout: 246 seconds) |
09:57:08 | * | Matthias247 joined #nim |
09:58:04 | * | girvo_ joined #nim |
09:59:25 | * | BlaXpirit quit (Quit: Bye) |
10:00:12 | * | BlaXpirit joined #nim |
10:16:24 | * | girvo_ quit (Quit: leaving) |
10:26:55 | * | zepolen joined #nim |
10:31:47 | * | zepolen quit (Ping timeout: 246 seconds) |
10:41:50 | * | yglukhov joined #nim |
10:46:08 | * | yglukhov quit (Ping timeout: 246 seconds) |
10:48:44 | * | joelmo joined #nim |
10:51:05 | * | vendethiel joined #nim |
10:58:23 | * | bjz quit (Ping timeout: 246 seconds) |
11:00:32 | * | bjz joined #nim |
11:05:12 | * | bjz quit (Max SendQ exceeded) |
11:05:58 | * | bjz joined #nim |
11:20:15 | * | BitPuffin|osx quit (Ping timeout: 260 seconds) |
11:23:06 | * | jaco60 joined #nim |
11:28:07 | * | zepolen joined #nim |
11:32:51 | * | zepolen quit (Ping timeout: 260 seconds) |
12:08:19 | * | vendethiel quit (Ping timeout: 260 seconds) |
12:12:07 | * | yglukhov joined #nim |
12:16:20 | * | boopsiesisaway is now known as boopsies |
12:17:29 | * | Matthias247 quit (Read error: Connection reset by peer) |
12:29:13 | * | zepolen joined #nim |
12:33:59 | * | zepolen quit (Ping timeout: 260 seconds) |
12:51:43 | * | ephja joined #nim |
12:59:44 | * | jakesyl quit (Ping timeout: 245 seconds) |
13:08:05 | * | Jesin quit (Quit: Leaving) |
13:13:16 | * | jakesyl joined #nim |
13:29:56 | * | irrequietus joined #nim |
13:30:12 | * | zepolen joined #nim |
13:36:02 | * | jaco60 quit (Ping timeout: 260 seconds) |
13:41:28 | * | heinrich5991_ joined #nim |
13:42:32 | * | FreeDog joined #nim |
13:42:54 | * | bigfondue_ joined #nim |
13:43:02 | * | someplace quit (Ping timeout: 240 seconds) |
13:43:02 | * | huonw quit (Ping timeout: 240 seconds) |
13:43:02 | * | M-Quora quit (Ping timeout: 240 seconds) |
13:43:03 | * | heinrich5991 quit (Ping timeout: 240 seconds) |
13:43:04 | * | r-ku quit (Ping timeout: 240 seconds) |
13:43:04 | * | flyx quit (Ping timeout: 240 seconds) |
13:43:04 | * | avsej quit (Ping timeout: 240 seconds) |
13:43:05 | * | LibreWulf quit (Ping timeout: 240 seconds) |
13:43:05 | * | bigfondue quit (Ping timeout: 240 seconds) |
13:43:27 | * | heinrich5991_ is now known as heinrich5991 |
13:45:03 | * | M-Quora joined #nim |
13:45:16 | * | vendethiel joined #nim |
13:45:20 | * | huonw joined #nim |
13:46:00 | * | zepolen quit (Remote host closed the connection) |
13:46:16 | * | r-ku joined #nim |
13:48:56 | * | jaco60 joined #nim |
13:49:22 | * | someplace joined #nim |
13:58:26 | * | avsej joined #nim |
13:58:27 | * | avsej quit (Changing host) |
13:58:27 | * | avsej joined #nim |
13:58:38 | * | nicktick joined #nim |
14:05:36 | * | lazypenguin quit (Ping timeout: 264 seconds) |
14:09:02 | * | lazypenguin joined #nim |
14:11:58 | * | DecoPerson quit (Ping timeout: 260 seconds) |
14:12:06 | * | yglukhov quit (Remote host closed the connection) |
14:12:11 | * | huonw quit (Ping timeout: 264 seconds) |
14:13:12 | * | yglukhov joined #nim |
14:13:44 | * | joelmo quit (Quit: Connection closed for inactivity) |
14:14:24 | * | DecoPerson joined #nim |
14:15:42 | * | jaco60 quit (Ping timeout: 260 seconds) |
14:17:32 | * | yglukhov quit (Ping timeout: 246 seconds) |
14:18:38 | * | huonw joined #nim |
14:22:09 | * | Jesin joined #nim |
14:23:24 | * | vendethiel quit (Read error: Connection reset by peer) |
14:24:38 | * | vendethiel joined #nim |
14:26:36 | * | clone1018 quit (Ping timeout: 264 seconds) |
14:27:04 | * | clone1018 joined #nim |
14:30:15 | nicktick | how to convert string into number? |
14:32:16 | * | jaco60 joined #nim |
14:34:41 | cryzed | nicktick, http://nim-lang.org/docs/strutils.html#parseInt,string |
14:36:08 | * | flyx joined #nim |
14:36:38 | cryzed | https://gist.github.com/cryzed/1728d8a1396e710f7f21 Is it possible to do this somehow, without getting "redefinition of children"ß |
14:37:09 | cryzed | I don't get why it's redefined, the nkRootNode and nkParagraphNode cases should never exist at the same time, and I don't want to make children the default for all of them |
14:47:03 | * | boopsies is now known as boopsiesisaway |
14:57:05 | Arrrr | you have no choice other than use different names, like rnChildren, pnChildren |
14:58:00 | Arrrr | It is the way is implemented, who knows if maybe in they future it is changed |
14:58:53 | Arrrr | I suppose it is to avoid conflicts. What if the first children is defined as a different kind of seq |
14:59:29 | cryzed | Arrrr, in the documentation it says one is simply not allowed to change identifier if I leads to a branch change |
14:59:36 | cryzed | so that shouldnt be an issue |
14:59:45 | Arrrr | The point of case objects is that they are fast and needs little runtime checking. Otherwise you can use inheritance |
15:00:00 | cryzed | I suppose that's a good idea |
15:00:23 | cryzed | one more Question. I can do "echo node.kind" to get a string representation of my enum value |
15:00:31 | cryzed | I am trying to do this manually with $(node.kind) |
15:00:37 | cryzed | but it returns Node instead of the string |
15:00:53 | cryzed | do you have an idea on how to get this string representation manually? |
15:01:07 | * | kulelu88 joined #nim |
15:01:08 | * | kulelu88 quit (Changing host) |
15:01:08 | * | kulelu88 joined #nim |
15:01:33 | Arrrr | what do you mean exactly, what does it return and what do you expect to retur |
15:02:03 | cryzed | Arrrr, echo nkTextNode prints "nkTextNode" |
15:02:19 | cryzed | I want to store this string representation in a string variable |
15:02:33 | cryzed | let a: string = $(myNode) does not work |
15:03:01 | cryzed | Arrrr, https://gist.github.com/cryzed/63d95a09a32f5a18988a currently doing this |
15:04:21 | Arrrr | Still i dont dont see what the problem is, maybe a little snippet with your problem would help |
15:04:41 | Arrrr | Error? returns a different string? |
15:04:48 | cryzed | one second |
15:06:00 | cryzed | error: http://i.imgur.com/6CE7eZX.png for https://gist.github.com/cryzed/63d95a09a32f5a18988a |
15:06:32 | cryzed | ah |
15:06:35 | cryzed | I was missing a parenthesis |
15:06:41 | cryzed | echo(($(root.kind)).indent(currentIndentation, " ")) |
15:06:41 | cryzed | works |
15:06:50 | Arrrr | heh |
15:07:07 | cryzed | :) |
15:21:58 | cryzed | http://i.imgur.com/ns5HhQE.png |
15:22:01 | cryzed | looks good :) |
15:23:27 | * | yglukhov joined #nim |
15:23:35 | * | theduke quit (Ping timeout: 264 seconds) |
15:24:41 | Arrrr | What is it for |
15:25:47 | Arrrr | ? |
15:27:10 | * | boopsiesisaway is now known as boopsies |
15:27:53 | * | yglukhov quit (Ping timeout: 246 seconds) |
15:30:24 | * | CARAM__ quit (Read error: Connection reset by peer) |
15:30:52 | * | CARAM__ joined #nim |
15:34:32 | * | zepolen joined #nim |
15:35:41 | * | theduke joined #nim |
15:39:50 | cryzed | Arrrr, sorry |
15:39:56 | cryzed | It's my attempt at a markdown parser |
15:40:07 | cryzed | I want to first tokenzie the document, then lex it into an AST |
15:40:17 | cryzed | And then create writer procs that work on the AST to output customized formats |
15:40:20 | cryzed | such as HTML primarily |
15:40:39 | cryzed | Just to get more familiar with Nim, ASTs etc. which I've never really used before |
15:44:58 | Arrrr | Good idea |
15:47:42 | cryzed | :), well let's see if my approach is too naive |
16:02:22 | * | yglukhov joined #nim |
16:15:32 | * | gmpreussner|work joined #nim |
16:42:10 | * | pregressive joined #nim |
16:45:13 | * | pregressive quit (Remote host closed the connection) |
16:49:14 | * | vendethiel quit (Ping timeout: 260 seconds) |
16:50:27 | * | sepisoad joined #nim |
16:51:12 | * | pregressive joined #nim |
16:59:51 | cryzed | https://gist.github.com/cryzed/48f8049eb1b317f83e28 part of my lexer looks like this |
17:00:11 | cryzed | do I really always need to manually "cast" interpret my Node subclass as the specific subclass to access subclass-specific attributes? |
17:04:52 | * | pregressive quit (Remote host closed the connection) |
17:13:51 | * | vendethiel joined #nim |
17:15:35 | Arrrr | From Node to SubNode? Yes, but you should use methods |
17:15:56 | Arrrr | method add(n: Node) {.base.} = discard |
17:16:11 | Arrrr | method add(n: ParagraphNode) = n.children add whatever |
17:16:30 | cryzed | ah |
17:16:31 | Arrrr | in this case method add(n: Node, child: Node) |
17:16:44 | cryzed | that would be much easier, yes. Like pattern matching in haskell -- or well, whatever it was called |
17:17:53 | federico3 | the socket module is deprecated. Should httpserver be ported to Net? |
17:17:59 | dom96 | I would personally use a variant object. |
17:18:09 | dom96 | federico3: httpserver should be deprecated if it isn't already |
17:18:17 | federico3 | why? :( |
17:18:34 | dom96 | because it sucks :P |
17:18:47 | * | jakesyl quit (Remote host closed the connection) |
17:19:14 | * | ephja quit (Quit: WeeChat 1.3) |
17:19:50 | cryzed | dom96, that's what I had, but not all object variants really have need for a children attribute |
17:19:53 | cryzed | should I just not care about that? |
17:20:54 | dom96 | what do you mean? |
17:21:20 | dom96 | You can just create a 'children' field under the variant kinds you want. |
17:23:39 | federico3 | well, while it's still around - https://github.com/nim-lang/Nim/pull/3624 |
17:24:53 | cryzed | dom96, if I do it tells me that I can't redefine the children field |
17:25:06 | cryzed | <cryzed> https://gist.github.com/cryzed/1728d8a1396e710f7f21 Is it possible to do this somehow, without getting "redefinition of children"ß |
17:25:06 | cryzed | <cryzed> I don't get why it's redefined, the nkRootNode and nkParagraphNode cases should never exist at the same time, and I don't want to make children the default for all of them |
17:26:20 | dom96 | ahh, yeah. That should really be fixed in the language to allow it. In this case the only solution is to name the second 'children', 'children2' or something. |
17:26:33 | Arrrr | You can use different names, i told you to use as an example rnChildren and pnChildren |
17:27:20 | cryzed | yes, but that would completely destroy the "API" of the object |
17:27:36 | dom96 | federico3: Developing sockets or httpserver further is pointless. |
17:27:55 | dom96 | cryzed: You can define a custom `children` accessor and setter |
17:28:06 | federico3 | it's a first step to implement SO_REUSEPORT in the other modules as well |
17:28:18 | federico3 | also httpserver is not officially deprecated yet |
17:28:22 | cryzed | dom96, so for each variant type have a custom children proc that gets/sets the value? |
17:28:33 | dom96 | proc children(n: Node): seq[Node] = if n.kind == nkRootNode: n.rnChildren else: ... |
17:28:47 | dom96 | better yet, use a case statement there too |
17:28:56 | cryzed | yep, ok |
17:29:27 | dom96 | federico3: 'sockets' is though. Please implement it in 'net'/'asyncnet' |
17:29:52 | Arrrr | i think inheritance is better suited for the task. There is a clearer distinction between api and implementation |
17:30:08 | federico3 | but httpserver still uses sockets so I started from it. I'm looking at porting it to net and asynchttpserver as well |
17:30:15 | Arrrr | But case objects are good too |
17:32:03 | dom96 | I disagree. Variant objects are perfectly suited for a Node type. |
17:35:57 | * | Trustable joined #nim |
17:36:01 | cryzed | dom96, what exception would be the most appropriate to raise if the children accessor is called on a type that doesn't have the attribute? |
17:37:36 | dom96 | InvalidValue |
17:38:15 | cryzed | thanks |
17:38:41 | * | makoLine joined #nim |
17:42:11 | * | lokulin quit (Ping timeout: 264 seconds) |
17:43:50 | * | gsingh93 quit (Ping timeout: 260 seconds) |
17:47:31 | * | makoLine quit (Read error: Connection reset by peer) |
17:48:20 | cryzed | dom96, how are procs prioritized? When I use node.children instead of children(node) it attempts to use the field accessor declared in the type I think |
17:50:02 | dom96 | I'm not sure what the priority is, I would think that the compiler would give an ambiguity error in that case. |
17:50:13 | dom96 | You should rename the field in any case |
17:50:35 | * | BitPuffin|osx joined #nim |
17:50:58 | * | gsingh93 joined #nim |
17:52:45 | * | lokulin joined #nim |
17:53:25 | cryzed | dom96, <dom96> You should rename the field in any case |
17:53:27 | cryzed | oops |
17:53:33 | cryzed | dom96, https://gist.github.com/cryzed/4c0862147810bc76cb13 I ended up doing this |
17:53:50 | * | sepisoad quit (Ping timeout: 246 seconds) |
17:53:58 | cryzed | called it internalChildren since _ isnt valid for identifiers (strange decision) |
17:55:02 | dom96 | good. :) |
17:55:09 | * | nicktick quit (Quit: Leaving.) |
17:55:57 | cryzed | dom96, why isn't compiler in the stdlib? It bit me several times in the ass and I had to pass --path manually |
17:56:24 | dom96 | it's a nimble package |
17:56:49 | cryzed | but it's also distributed with nim? |
17:57:24 | dom96 | is it distributed in the Windows installer? |
17:57:31 | cryzed | it is |
17:57:59 | dom96 | I suppose we could make it a part of the stdlib |
17:58:10 | dom96 | Create an issue please :) |
17:58:15 | cryzed | I will |
18:04:23 | * | makoLine joined #nim |
18:04:39 | * | desophos joined #nim |
18:05:37 | cryzed | dom96, https://github.com/nim-lang/Nim/issues/3625 |
18:05:38 | cryzed | good? |
18:06:26 | dom96 | yeah, thanks |
18:06:35 | cryzed | No problem |
18:13:20 | * | darkf quit (Quit: Leaving) |
18:22:52 | cryzed | Do I also create an issue for theduke case kind: NodeKind "redefine" problem? |
18:22:56 | cryzed | *the |
18:30:44 | cryzed | When I don't want to run my accessor for children twice, i.e. store the result somewhere -- how do I go about just storing the reference. I noticed when doing var myChildren = node.children that it stores a copy of the children apparently (since when modifying that instance it doesn't modify the tree) |
18:32:28 | Araq | return 'var T' or make the accessor a template |
18:33:56 | cryzed | my children accessor returns var seq[Node] |
18:34:13 | cryzed | oh wit |
18:34:15 | cryzed | wait |
18:35:18 | cryzed | nope it does, one second: https://gist.github.com/cryzed/4c0862147810bc76cb13 See: https://gist.github.com/cryzed/4c0862147810bc76cb13 and https://gist.github.com/cryzed/4c0862147810bc76cb13 |
18:35:31 | cryzed | when I do this the tree doesn't get modified. When I do currentNode.children.delete(currentNode.children.high) it works |
18:35:39 | * | exebook quit (Ping timeout: 260 seconds) |
18:38:26 | cryzed | ah damn |
18:38:29 | cryzed | It didnt link the lines |
18:38:40 | cryzed | See: https://gist.github.com/cryzed/4c0862147810bc76cb13#file-nim-nim-L106 |
18:38:46 | cryzed | and https://gist.github.com/cryzed/4c0862147810bc76cb13#file-nim-nim-L145 |
18:40:20 | Araq | well var x = foo() creates a copy anyway as 'var T' is not a first class citizen in the language |
18:40:38 | Araq | even if foo returns a 'var T'. |
18:41:01 | Araq | usually it means you should have started with a 'ref T' or return a 'ptr T' |
18:42:45 | cryzed | So, make my internalChildren ref types? |
18:44:56 | Arrrr | In my opinion, you dont actually want to give access to the internal children |
18:45:15 | Arrrr | maybe provide an interator if you really need it |
18:46:07 | cryzed | I need to delete a child out of the tree after adding it |
18:46:17 | cryzed | how would I do that without access to it? |
18:46:52 | Arrrr | wut, you delete it after you add it? |
18:47:51 | Arrrr | anyway, i dont see what's the problem there |
18:48:34 | cryzed | Arrrr, that I can't store a reference to the children in the tree, without calling the children accessor twice -- computational "overhead". I know it hardly matters with something as fast as Nim, but its not nitce |
18:48:36 | cryzed | *nice |
18:49:04 | Arrrr | if you do something like 'var s = node.seq' you will create a copy of that seq, so any operation should be done on node.seq. For example, 'delete node.seq, 0' |
18:49:43 | cryzed | Yes. So to get the last index of my children I would have to do |
18:49:58 | cryzed | let lastIndex = node.children.high (called children once) |
18:50:04 | cryzed | node.children.delete high |
18:50:08 | cryzed | called children twice |
18:50:09 | cryzed | instead of |
18:50:13 | cryzed | var children = node.children |
18:50:17 | cryzed | children.delete(children.high) |
18:50:42 | onionhammer | ls |
18:50:42 | Arrrr | you want to delete the last children? use pop(node.children) |
18:50:56 | Arrrr | http://nim-lang.org/docs/system.html#pop,seq[T] |
18:51:04 | Arrrr | *last child |
18:51:21 | cryzed | neat |
18:51:28 | cryzed | I suspect I will still run into problems with this in the future |
18:51:30 | cryzed | but thank you Arrrr |
18:52:43 | cryzed | Arrrr, https://gist.github.com/cryzed/4c0862147810bc76cb13#file-nim-nim-L143 and yeah, this is why I need to remove it after inserting it |
18:52:46 | cryzed | in a special case |
18:53:13 | cryzed | Basically in markdown one empty line is a linebreak <br/>, but 2 empty lines is a new paragraph without a lineBreak beforehand |
18:53:20 | cryzed | I probably am not constructing this tree in a very smart way |
18:53:57 | Arrrr | It is an interesting project, i see |
18:54:35 | cryzed | Probably too interesting for me ;D |
18:55:34 | Arrrr | You have done a lot. I see you finally used 'internalChildren' and 'internalChildren2' as names, eventually you will get confused. |
18:56:41 | Arrrr | Also, if you are going to use only the ref version of node, you can directly declare it as 'Node = ref object' |
18:56:42 | cryzed | Arrrr, that's why I'm planning to create a custom constructor for each nodetype that takes that complexity from my hands |
18:56:59 | cryzed | *off my hands |
18:57:08 | cryzed | noted |
18:59:02 | Araq | one thing to keep in mind: you have pattern matching on strings (that's called a regex), you don't have pattern matching on trees, so it might be wiser to deal with the complexity in the lexer rather than transforming the AST later on |
18:59:49 | cryzed | You mean tokenizer? |
18:59:55 | cryzed | Or maybe I am confusing the terms |
19:00:40 | cryzed | But I see your point, I'll have to consider doing that. But with Markdown it's only possible in a limited fashion I think |
19:01:54 | Araq | tokenizer == lexer |
19:02:28 | Araq | I don't think markdown is harder than RST |
19:02:50 | Araq | and how to parse RST well ... you can cheat and look at how Nim does it. |
19:05:11 | cryzed | cheating :O |
19:05:17 | cryzed | ;) |
19:22:55 | onionhammer | has someone written a nim parser/generator yet? |
19:22:59 | onionhammer | niml and nimy? :) |
19:24:09 | * | yglukhov quit (Remote host closed the connection) |
19:24:43 | * | yglukhov joined #nim |
19:29:02 | * | yglukhov quit (Ping timeout: 246 seconds) |
19:29:33 | * | juanfra quit (Quit: juanfra) |
19:29:45 | * | juanfra joined #nim |
19:35:56 | Araq | onionhammer: my lexim is a lexer generator |
19:36:03 | Araq | but nimy is definitely missing |
19:39:41 | * | pilne joined #nim |
19:40:21 | * | aziz joined #nim |
19:49:41 | * | sepisoad joined #nim |
19:50:43 | * | Matthias247 joined #nim |
19:52:22 | * | sepisoad quit (Remote host closed the connection) |
19:59:48 | * | sepisoad joined #nim |
20:00:17 | * | sepisoad quit (Remote host closed the connection) |
20:01:05 | * | zepolen quit (Read error: Connection reset by peer) |
20:02:16 | * | Demon_Fox joined #nim |
20:02:51 | * | zepolen joined #nim |
20:05:07 | * | sepisoad joined #nim |
20:07:02 | cryzed | Ok this bothers me though. Is there some writeup in the manual on how exactly nim works with variable passing? I understand that when defining methods with parameters prefixed by var or result prefixed by var it returns/gets references, that means no copying of datastructures when being called. When I declare a type as a ref object, I automatically get back a reference to the object instance when instantiating it. So when I have a method that |
20:07:02 | cryzed | returns a reference to a data structure, which I explicitly tell with a var-return type, then there _must_ be a matching way to store that reference return type in a variable. It can't just be transient -- usable not storeable, that doesn't make sense |
20:14:29 | * | pilne quit (Quit: Quit!) |
20:14:46 | * | pilne joined #nim |
20:14:52 | * | sepisoad2 joined #nim |
20:15:29 | Arrrr | I dont understand your problem, but i admit it takes some time until you get it. Mostly because string/seqs doesnt work the way people are used in other languages |
20:16:33 | * | sepisoad quit (Remote host closed the connection) |
20:23:38 | * | kulelu88 quit (Ping timeout: 246 seconds) |
20:26:50 | * | elrood joined #nim |
20:28:55 | cryzed | Arrrr, imagine you have a proc that collects various attributes from 10000 objects and creates a sequence that is 100mb in RAM |
20:29:00 | cryzed | Just for an extreme example |
20:29:06 | cryzed | Now you want to store it once, and have a reference to it |
20:29:13 | cryzed | instead of copying 100mb RAM |
20:29:15 | cryzed | how do I do that |
20:29:28 | cryzed | I return a reference to it, but as soon as I store it it gets copied |
20:29:42 | cryzed | I don't want to recompute it by accessing the proc again because that takes time |
20:30:22 | Arrrr | accessing a seq element with '[]' is also using a proc |
20:30:34 | cryzed | yes, I know |
20:30:40 | cryzed | that doesn't really help me |
20:30:46 | cryzed | how do i solve the described problem |
20:30:58 | Arrrr | Dont copy the seq, use node.seq |
20:31:17 | cryzed | that would require my code to collect the objects agian which takes 5 seconds |
20:32:04 | Arrrr | Why do you have to collect the objects again |
20:32:51 | cryzed | it's a theoretical scenario. The same reason I don't want to call my children proc on my Node more than necessary: Once should be enough. I want to get access to the children and be able to modify them, so when I return a reference to a sequence I want to be able to modify the sequence |
20:33:08 | cryzed | not a copy of it |
20:34:12 | Arrrr | You can use ref seq |
20:34:42 | cryzed | where do I put that? Into my object definition? |
20:35:19 | Arrrr | instead of children: seq[Node], use children: ref seq[Node] |
20:35:43 | cryzed | trying that, thank you |
20:37:55 | cryzed | Arrrr, now in my children proc I get a type mismatch, : http://i.imgur.com/vF4Sn8I.png -- Do I have to dereference the reference somehow before returning it? The code: http://i.imgur.com/Kted3v7.png |
20:38:44 | cryzed | It complains when returning it hm |
20:39:46 | * | BitPuffin|osx quit (Ping timeout: 260 seconds) |
20:40:06 | * | kulelu88 joined #nim |
20:40:35 | cryzed | Ok When I try to instantiate a new Node object now: |
20:40:35 | cryzed | let root = Node(kind: nkRootNode, internalChildren: (ref @[])) |
20:40:38 | cryzed | I am trying to do something like this |
20:40:57 | cryzed | but I get a type mismatch: got (typedesc[ref], Array constructor[...-1], empty]) |
20:42:10 | cryzed | Arrrr, any idea how I instantiate such a type with ref types properly then? |
20:42:42 | federico3 | dom96: I'm trying to add SO_REUSEPORT in nativesockets.nim right next to SO_REUSEADDR and I'm getting a "cannot export" error without further messages |
20:43:08 | dom96 | that's odd |
20:43:13 | dom96 | search for the 'export' keyword |
20:43:19 | * | zepolen quit (Remote host closed the connection) |
20:43:38 | federico3 | I assume the symbol comes from posix (where I added it earlier) |
20:43:50 | dom96 | cryzed: I believe a 'seq' is already a 'ref' type. |
20:44:17 | federico3 | could it be that the compiler is using posix.nim from the wrong path? |
20:44:33 | cryzed | dom96, https://gist.github.com/cryzed/4f40030a1388da7c063d |
20:44:48 | cryzed | line 116 is the instantiation |
20:44:49 | * | zepolen joined #nim |
20:45:04 | cryzed | if I don't cast it explicitly it complains about "got seq[empty]" |
20:45:12 | dom96 | cryzed: s/ref seq[T]/set[T]/ |
20:45:18 | cryzed | set? |
20:45:23 | dom96 | typo |
20:45:24 | dom96 | seq |
20:45:27 | cryzed | ok |
20:45:56 | cryzed | >let root = Node(kind: nkRootNode, internalChildren: ref seq[Node](@[])) -> Error: type expected |
20:46:10 | dom96 | federico3: can you gist your diff and the error output? |
20:46:42 | federico3 | apparently if the symbol is not found in any imported module it triggers a "cannot export" |
20:46:50 | Araq | " It can't just be transient -- usable not storeable, that doesn't make sense" |
20:46:52 | cryzed | let root = Node(kind: nkRootNode, internalChildren: ref seq[Node]) -> Error: type mismatch: got (typedesc[ref seq[Node]]) but expected ref seq[Node] |
20:47:01 | Araq | yet that is exactly how the language is defined. |
20:47:12 | cryzed | Araq, but what about the scenario I described earlier |
20:47:15 | Araq | and it does make lots of sense when you think about memory safety. |
20:47:25 | cryzed | is it just not a use-case in Nim? |
20:47:33 | Araq | that scenario just pretends 'ptr' doesn't exist in the language, but it does exist. |
20:47:43 | * | BitPuffin|osx joined #nim |
20:47:48 | Arrrr | cryzed: http://ideone.com/dmwbVf |
20:48:11 | Araq | you want a first class pointer? so use a first class pointer. (and live with the unsafety resulting from that model :P ) |
20:48:40 | cryzed | It's not like I'm being unreasonable |
20:48:49 | federico3 | dom96: http://paste.debian.net/341746/ line 44, together with the previous changes in #3624 |
20:49:06 | dom96 | Araq: I think cryzed wants to reduce copies as much as possible, maybe you could help him do that? |
20:49:36 | cryzed | copying parts of the whole AST just to check for an attribute here and there is insane |
20:50:38 | * | pilne quit (Quit: Quit!) |
20:50:44 | dom96 | cryzed: Your Node is a 'ref', I think that means it won't be copied on assignment. |
20:51:11 | cryzed | dom96, so far I have problem even instantiating my Node class with the ref changes |
20:51:14 | dom96 | federico3: Did you export it in posix.nim? |
20:51:30 | cryzed | I can't initialize Node with the internalChildren attribute |
20:51:38 | * | pilne joined #nim |
20:51:43 | dom96 | You're passing in a type when you should be passing a value |
20:51:46 | cryzed | I need it to get a "ref seq[Node]" but I don't know how |
20:51:53 | Arrrr | cryzed: http://ideone.com/dmwbVf |
20:51:54 | cryzed | So I need to create one with new? |
20:51:59 | federico3 | dom96: https://github.com/nim-lang/Nim/pull/3624/files#diff-880812f441788508a84adff2c2ead03dR1569 |
20:52:00 | dom96 | You need to change the type to 'seq[Node]' |
20:52:03 | cryzed | Arrrr, I saw that -- trying to figure out how to fit it into my code |
20:52:05 | cryzed | thank you |
20:52:07 | dom96 | and then use: let root = Node(kind: nkRootNode, internalChildren: @[]) |
20:52:14 | cryzed | dom96, then I have the same problem |
20:52:15 | Araq | dom96: I did help him :P |
20:52:23 | dom96 | cryzed: what problem? |
20:52:27 | cryzed | dom96, one second |
20:52:38 | Araq | cryzed: yeah it is pretty unreasonable giving that 'var T' tries to preserve memory safety |
20:52:41 | dom96 | Araq: You're telling him to use a ptr? |
20:52:45 | Araq | yes. |
20:53:04 | cryzed | I feel like you guys dont want me to do that |
20:53:07 | dom96 | That's ridiculous. |
20:53:08 | Araq | you can also just use an index |
20:53:23 | federico3 | dom96: here's the diff of both changes together http://paste.debian.net/341748/ |
20:53:32 | dom96 | You shouldn't need to use unsafe features of the language to implement a markdown parser. |
20:53:42 | Araq | that is a different topic, dom96 |
20:53:44 | dom96 | The unsafe features should only be necessary for C FFI. |
20:54:05 | Araq | his use case was "la la la huge object la la la RAm la la la, think of the children!" |
20:54:24 | Araq | ;-) |
20:54:59 | Araq | dom96: the unsafe features also greatly enhance the expressivity of the language. |
20:54:59 | dom96 | federico3: try putting the SO_REUSEPORT in the 'export' on line 28 |
20:55:12 | Araq | which is what we're arguing about. kind of. |
20:55:39 | cryzed | now I broke it completely |
20:55:56 | Araq | the original problem is of course solved as for instance rstast.nim does it. but cryzed knows that cause I told him. |
20:56:17 | federico3 | already tried |
20:56:36 | cryzed | Araq, of course I know that you implemented a rest parser -- I didn't and I'd like to gain experience doing it |
20:56:57 | Araq | well it shows everything. how you can implement an AST. |
20:57:10 | Araq | how you can parse a complex beast of a language such as RST |
20:57:11 | dom96 | The JSON parser may be easier to follow |
20:57:15 | cryzed | Your code will be 180° different from mine, possibly sharing 1-2 classes |
20:57:16 | Araq | how to transform it to HTML |
20:57:31 | cryzed | So I don't think I can find a solution for my strange problem in your code |
20:57:42 | cryzed | because you know the internals of the language and will do completely different things |
20:57:51 | Araq | all of which don't use unsafe code and are pretty performant. |
20:57:56 | federico3 | can I list what is being exported by posix? Yet, the code in sockets.nim works |
20:57:57 | dom96 | cryzed: Can you create a small example of what the problem actually is? I didn't read all of the logs. |
20:57:58 | cryzed | as evidenced by our difference in opinion |
20:58:15 | cryzed | dom96, I will -- give me a second, as soon as I have it restored to the scenario I had in the beginning |
20:58:43 | dom96 | federico3: please gist the full compiler output |
20:59:22 | * | irrequietus quit (Ping timeout: 260 seconds) |
20:59:42 | federico3 | http://paste.debian.net/341751/ |
20:59:46 | Arrrr | Araq will you support this? http://stackoverflow.com/questions/34119841/define-switch-for-key-value |
21:00:11 | cryzed | dom96, https://gist.github.com/cryzed/4c0862147810bc76cb13#file-nim-nim-L148 |
21:00:43 | dom96 | federico3: That is such a poor error, bug report! :P |
21:01:01 | cryzed | at this point I know that I can just call .pop -- but I'm sure I'll run into misunderstandings with the workings again soon |
21:01:07 | federico3 | yep, at least "cannot export" should tell why |
21:01:09 | cryzed | so I might as well worry about it now |
21:02:14 | Arrrr | From what i understand, he doesnt want to use delete(currentNode.children) |
21:02:53 | Arrrr | Well, delete(currentNode.children, high(currentNode.children)) |
21:03:02 | cryzed | Arrrr, I do. I want to do children.delete(children.high) NOT currentNode.children (call proc once).delete(currentNode.children (call proc twice).high) |
21:03:07 | cryzed | yes |
21:03:37 | Arrrr | but you have no other choice because seq semantics work as int, bool, etc |
21:03:44 | cryzed | Problem is when I do what I want I lose the reference to the seq returned by children proc |
21:04:07 | cryzed | hrm :/ |
21:04:23 | Arrrr | if you declare a return proc as 'var bool', as soon as you put the return value in a var, it makes a copy |
21:04:27 | Arrrr | the same happens with seqs |
21:04:42 | cryzed | if I don't return it as var, It immediately returns a copy? |
21:05:07 | cryzed | *declare |
21:05:49 | Arrrr | This kind of situations are better with a running code example |
21:06:40 | dom96 | In such a situation I would simply do it all on a single line. |
21:06:49 | cryzed | nim c --run nim.nim test.md with contents: https://gist.github.com/cryzed/e244f1337be06d04ea2a |
21:06:55 | dom96 | currentNode.children.delete(...) |
21:07:01 | cryzed | dom96, so call proc twice |
21:07:19 | cryzed | I suppose I can, but it will create a copy of some subtree of the AST |
21:07:26 | cryzed | when that is huge it might be an expensive operation to do it twice |
21:07:34 | Arrrr | http://ideone.com/kZT4XE |
21:07:37 | dom96 | oh, because 'children' is not a field |
21:07:40 | dom96 | It's a proc accessor |
21:08:02 | cryzed | yep |
21:08:04 | * | lokulin quit (Ping timeout: 245 seconds) |
21:08:09 | cryzed | Because I can't use the field accessors, because of that strange bug |
21:08:25 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
21:08:30 | cryzed | well I can, but I would have to use a different one for each variant |
21:08:41 | dom96 | Araq: So what do you suggest cryzed do? |
21:08:55 | dom96 | You still think cryzed should use a ptr? |
21:09:53 | * | Jesin quit (Quit: Leaving) |
21:10:49 | dom96 | cryzed: What you could do is make 'children' a template. |
21:11:02 | cryzed | dom96, wouldn't that suffer from the same problem? |
21:11:15 | cryzed | I mean from what I understand a template replaces the AST, or modifies it |
21:11:36 | dom96 | with a template there will be no proc call |
21:11:36 | cryzed | oh wait |
21:11:44 | cryzed | it would just decide to access between children or children2 |
21:11:52 | cryzed | not actually return it |
21:12:14 | dom96 | yes |
21:12:17 | cryzed | yes, Araq had suggested that -- but I thought it wouldn't work either at that point |
21:12:25 | cryzed | So I'll read up on templates I suppose |
21:12:37 | dom96 | You should be able to just s/proc/template/ |
21:12:39 | dom96 | maybe |
21:12:46 | cryzed | dom96, is my problem really that unreasonable though? I mean imagine if calling the accessor was really an expensive operation -- 500ms runtime or something |
21:12:51 | dom96 | This feels hackish to me though |
21:12:58 | cryzed | it wouldn't be feasible to do it twice just for fun |
21:13:24 | Arrrr | Define a proc called removeLast(n: Node) |
21:13:31 | Arrrr | and do that inside |
21:13:41 | dom96 | cryzed: I think your problem is reasonable actually |
21:13:46 | dom96 | I have code in which I do: |
21:14:12 | cryzed | Arrrr, yep let me figure out the template thing first |
21:14:17 | dom96 | template cs() = myNode.internalChildren2; cs.delete(...) |
21:14:20 | dom96 | Basically |
21:14:26 | dom96 | Just suited to my code |
21:14:35 | dom96 | It's kind of a hacky "alias" |
21:14:48 | cryzed | it's all rooted in the object variation not working correctly |
21:14:56 | cryzed | *variants |
21:15:06 | dom96 | indeed. |
21:15:08 | cryzed | that's why you need a custom accessor |
21:15:20 | dom96 | I complained about that for a while, I may just need to fix it myself :P |
21:15:54 | dom96 | cryzed: If you have time then please create an issue for each of these things. |
21:16:07 | cryzed | I will |
21:16:17 | dom96 | The object variant and the copying issues. |
21:16:20 | cryzed | dom96, just replacing it with template didn't work unfortunately, it's probably something obvious |
21:16:27 | dom96 | what's the error? |
21:16:34 | cryzed | markdown.nim(132, 15) template/generic instantiation from here |
21:16:34 | cryzed | markdown.nim(110, 18) Error: type mismatch: got (seq[Node]) but expected 'Node' |
21:16:37 | cryzed | line 132 being |
21:16:45 | cryzed | root.children.add currentNode |
21:17:26 | cryzed | I attempted to remove the var keyword from the return type, since that's moot now |
21:17:29 | cryzed | but there's no change |
21:17:36 | cryzed | I might have to read up more on templates |
21:19:05 | cryzed | https://gist.github.com/cryzed/24a33da7de19fcc5e49f here's the current code again, with a sample md file: https://gist.githubusercontent.com/cryzed/e244f1337be06d04ea2a/raw/4fe49ec9f3eff4b1e537fe1ad73345ee3a477dd1/test.md |
21:19:16 | cryzed | runnable with nim c --run newCode.nim test.md |
21:19:28 | dom96 | hrm |
21:19:42 | dom96 | yeah, it's because the 'return ...' ends up inside the body of your proc |
21:19:54 | dom96 | Your procs return type is 'Node' |
21:19:59 | dom96 | so maybe templates can't work :\ |
21:20:19 | cryzed | So maybe do what Arrrr suggested |
21:20:30 | cryzed | and write a template for that without a return type |
21:20:37 | cryzed | i.e. removeLast(n: Node) |
21:20:46 | cryzed | but it's not "cool" :D |
21:20:48 | cryzed | oh well |
21:20:58 | Arrrr | you cannot delete from seq, you need var seq. And, as i told you, the moment you do var s = node.seq you are doing a copy |
21:20:58 | cryzed | I'll create an issue for the object variants |
21:21:29 | cryzed | Arrrr, that's why I would use a template that simply accesses the correct field name depending on object variant |
21:21:54 | Arrrr | it doesnt matter if you use template, proc, or directly node.internalChildren. It makes a copy |
21:22:34 | Arrrr | think of seq as if it were an int |
21:22:57 | cryzed | but I am deleting from the sequence and have been when doing node.children.delete(...) -- even when I had the type definitions as they are currently, shouldn't that have _not_ worked then? |
21:23:33 | Araq | you can create issues all you want, but I will close most of them because there is no issue here. |
21:23:57 | Arrrr | without the var mod? |
21:24:02 | cryzed | yes |
21:24:10 | cryzed | Araq, so not being able to define two fields with the same for object variants is a feature? |
21:24:15 | cryzed | *name |
21:24:18 | cryzed | as in |
21:24:20 | Araq | of course it is. |
21:24:36 | cryzed | case kind: SomeKind: of FIRSTCASE: children: string, of SECONDCASE: children: string |
21:24:48 | * | bjz joined #nim |
21:24:49 | cryzed | because one branch is never executed while the other is |
21:24:55 | Araq | there is not a single language out there that supports what you're asking for. |
21:25:08 | cryzed | Araq, I am not using other languages, I'm using Nim |
21:25:11 | cryzed | and that features is nearly included |
21:25:28 | * | lokulin joined #nim |
21:25:34 | Araq | yeah, but maybe there is some deep underlying issue of why no language does that? |
21:25:44 | Araq | maybe, just maybe, it's not all Nim's fault? |
21:25:54 | cryzed | maybe -- I didn't develop it. Is there for that specific issue? |
21:26:19 | cryzed | there's no need to get defensive either -- I'm not attacking you or Nim, I just honestly believed it to be a bug |
21:26:21 | * | irrequietus joined #nim |
21:26:22 | cryzed | and I'm not the only one |
21:26:30 | Arrrr | You mean you did this? http://ideone.com/77g9Ub |
21:27:05 | Araq | well what does 'obj.children' mean when you've got two of them? |
21:27:16 | Arrrr | I suppose it is not supported because, in compile time, it doesnt know if node is of one kind or another |
21:27:33 | Araq | should we disambiguate via type resolution rules? |
21:27:44 | Araq | should we inject some code to make it polymorphic? |
21:27:52 | Araq | I mean runtime polymorphism. |
21:28:22 | Araq | compile-time disambiguation buys you nothing, since you might as well use two different field names then. |
21:28:47 | Araq | runtime disambiguation doesn't fit Nim's design at all. |
21:28:49 | cryzed | Arrrr, no I mean: https://gist.github.com/cryzed/bfae54903e73fa06f3c4 |
21:28:57 | Araq | pick your poision. ;-) |
21:29:38 | Arrrr | You said you did a delete from a seq returned by a proc |
21:29:44 | Arrrr | THat's what i understand |
21:29:59 | Araq | cryzed: for your example move the 'children: string' field out of the 'case'. ta-da. problem solved. |
21:30:16 | cryzed | Araq, now all variants have the children attribute |
21:30:19 | cryzed | even types that don't need it |
21:30:33 | cryzed | for examples nodes that cant contain children |
21:30:46 | Araq | so? |
21:30:58 | cryzed | and the field accessor would be chosen depending on the kind, that's why the case-statement is there right? |
21:31:11 | Araq | types are *always* a static *approximation* of what is actually valid at runtime. |
21:31:32 | dom96 | so why use the case statement inside the object definition at all? |
21:31:40 | cryzed | ^ |
21:31:53 | cryzed | I could just define all variables then and just use those I need |
21:31:55 | Araq | dom96: to get a better approximation and to save some memory. |
21:32:21 | cryzed | so now it's a half-way thing? Is there really an underlying language development issue that prevents this from working as expected? |
21:32:33 | cryzed | I have no clue -- that's why Im asking |
21:32:35 | cryzed | not to be a little shit |
21:35:01 | * | bjz quit (Read error: Connection reset by peer) |
21:35:02 | dom96 | As for no other language doing it, isn't this Rust doing it? http://is.gd/N4WeJC |
21:35:31 | Araq | not what I'm talking about. |
21:36:01 | dom96 | to be fair, I guess in Rust you need to repeat your fields |
21:36:15 | Araq | try to access 'x' without a guard check in Rust. |
21:38:56 | Araq | and just fyi, "so why use XXX at all then?" is always a shitty pseudo argument. |
21:39:23 | Araq | "so why use a toilet when my hands can get dirty anyway?" |
21:39:24 | dom96 | Hrm, you're right. Rust requires pattern matching. |
21:39:50 | cryzed | Araq, that's not the same at all. There was honest confusion about what the case-staement does in the variant definitions then |
21:40:05 | Araq | "so why use a car when I can go faster by plane?" |
21:40:16 | dom96 | Why not make it better then? |
21:40:35 | dom96 | I would expect node.children to expand into an if statement |
21:40:47 | dom96 | and give me the correct children field in the background |
21:40:53 | cryzed | depending on the kind |
21:40:54 | dom96 | Nim is meant to be expressive damn it |
21:44:13 | Arrrr | What went wrong |
21:44:29 | Arrrr | maybe we were too young and naive |
21:46:31 | Araq | dom96: the people who want that feature in general want the compiler to compute offsets so that the different 'children' fields are mapped to the same offset |
21:46:50 | Araq | and to not make it generate a hidden 'if' statement |
21:47:24 | dom96 | Araq: What if I said that I don't care for that? |
21:48:00 | dom96 | I assume that what you just described that other people want is significantly more difficult to implement than a simple hidden if statement |
21:48:43 | Araq | no, actually my suggestion is way easier to implement |
21:48:52 | Araq | but that's besides the point. |
21:49:34 | * | zepolen quit (Remote host closed the connection) |
21:49:41 | Araq | the point is that I thought cryzed is asking for 'children: string' in one branch and 'children: seq[T]' in another |
21:49:55 | cryzed | No not at all |
21:50:03 | cryzed | I just want some nodes to have children and some not |
21:50:05 | cryzed | of the same type |
21:50:10 | Araq | when they are of the same type, things are quite different |
21:50:24 | Araq | but then the implementation moves the field out of the 'case' |
21:50:47 | cryzed | So every object variant automatically has the children field? |
21:50:58 | Araq | no, I mean, ugh. |
21:51:05 | cryzed | Sorry, I'm being dumb probably |
21:51:23 | Araq | if Nim supported what you ask for, it would move the 'children' out of the 'case'. |
21:51:29 | dom96 | That's still not flexible enough in my opinion. |
21:51:46 | Araq | which you can do today, albeit losing some static checking and code documentation |
21:52:05 | Araq | dom96: that's why I'm not answering you anymore. |
21:52:23 | dom96 | Take the JsonNode type as an example https://github.com/nim-lang/Nim/blob/devel/lib/pure/json.nim#L557 |
21:52:53 | dom96 | A JInt and a JFloat could both have 'num' accessors. |
21:53:21 | Araq | dom96: for this my original answer applies. |
21:53:26 | Araq | ;-) |
21:54:12 | Araq | and now I'd rather work on Nim bugs rather than arguing about how the language could be even more convenient and complex. |
21:54:20 | cryzed | Well I'm off to exercise |
21:54:24 | cryzed | o/ |
22:27:08 | * | Jesin joined #nim |
22:39:11 | kulelu88 | how do I get a @nim-lang email address? <3 |
22:43:59 | * | theduke quit (Ping timeout: 264 seconds) |
22:48:17 | Arrrr | can i send drawings? |
22:56:09 | * | theduke joined #nim |
23:01:16 | Araq | kulelu88: these are hard to come by |
23:01:37 | Araq | theduke: what is the most annoying Nim bug for you? |
23:02:04 | kulelu88 | :D |
23:02:06 | Araq | kulelu88: I think you can buy one from dom96 :-) |
23:02:38 | kulelu88 | dom96 ... so young and already getting into the Silicon Valley startup scene of selling email addresses :D |
23:03:06 | dom96 | $5 million and you can get any @nim-lang.org email you want :P |
23:03:44 | * | elrood quit (Quit: Leaving) |
23:04:05 | kulelu88 | you didn't specify what type of dollar :) 5 million zim dollars won't be hard to come by |
23:04:50 | Araq | ah spoken like a true programmer ;-) |
23:17:40 | * | pilne quit (Remote host closed the connection) |
23:20:04 | * | pilne joined #nim |
23:20:58 | * | boopsies is now known as boopsiesisaway |
23:29:35 | * | Matthias247 quit (Read error: Connection reset by peer) |
23:32:19 | dom96 | kulelu88: sure, I like obscure currencies. :D |
23:32:48 | * | aziz quit (Remote host closed the connection) |
23:33:20 | kulelu88 | I bet you and Araq got your own personal blockchain currency :D |
23:34:58 | cryzed | Used solely to keep track of work to be done |
23:35:16 | cryzed | whoever has accredited more coins needs to do less work, the other party being paid after the bugtracker count shrinks |
23:37:32 | * | vendethiel quit (Ping timeout: 246 seconds) |
23:43:24 | * | irrequietus quit () |
23:45:25 | Arrrr | Good night |
23:45:27 | * | Arrrr quit (Quit: WeeChat 1.2) |
23:52:14 | * | girvo_ joined #nim |
23:52:21 | * | girvo_ quit (Client Quit) |
23:52:26 | girvo | Hi all :D |
23:52:34 | * | kulelu88 left #nim ("Leaving") |
23:52:55 | cryzed | hello |
23:52:57 | girvo | I finally sat down and had a proper play with Nim's macro system, and god-damn am I impressed |
23:53:30 | girvo | I'm a lisper at heart, who uses procedural languages at work because I have to; so having a procedural language with hygenic metaprogramming is a massive boon :D |
23:54:39 | girvo | Converting a 40 line C++ template specialisation set into a 4 line Nim macro totally made my weekend, heh |
23:55:06 | cryzed | that's very cool to hear :) |
23:55:06 | girvo | Does anyone have any documentation on how memory management should be dealt with when dealing with an external C library btw? |
23:55:35 | cryzed | You probably want to ping dom96 or Araq |
23:55:44 | girvo | yeah I might email them |
23:56:07 | cryzed | Why, just idle a bit |
23:56:14 | girvo | My little project is finally getting big enough that I should probably work out how to deal with all the memory i'm leaking |
23:56:20 | dom96 | No need, I am here |
23:56:23 | girvo | I'll be doing that too |
23:56:27 | girvo | Oh hey! hah |
23:56:49 | dom96 | hello girvo |
23:56:57 | dom96 | Cool to hear that you love Nim's macros |
23:57:03 | girvo | dom96: hey dom :) |
23:57:12 | dom96 | They are certainly one of Nim's awesomest features :D |
23:57:19 | girvo | That they are! |
23:57:36 | girvo | And how they play with the type system? just glorious, it worked exactly how I thought it would! |
23:57:58 | girvo | anyway, wheres the best place to look for pointers (hehehe) on how to deal with memory management when using an external C library? |
23:58:00 | dom96 | as far as memory management when dealing with external C libraries: just do it as you would in C. |
23:58:02 | girvo | Specifically the SDL2 one |
23:58:07 | girvo | Okay awesome, I thought that was the case |
23:58:25 | cryzed | girvo, can I be nosy and ask what you are doing with SDL2? |
23:58:29 | dom96 | Best thing to do is to create a module on top of the C wrapper |
23:58:29 | girvo | Do I have to worry about the GC accidentally freeing something it shouldn't when in a nim context? |
23:58:32 | girvo | I assume I wouldn't |
23:58:34 | dom96 | which exposes a safe Nim interface |
23:58:46 | girvo | dom96: awesome, yep thats the direction I'm heading in |
23:58:59 | dom96 | The Nim GC only frees things it allocates |
23:59:20 | girvo | dom96: cool, what about ints that are allocated but passed in as casted cints? |
23:59:22 | dom96 | You need to be careful if you are passing a Nim object into a C function |
23:59:31 | girvo | (for example) |
23:59:38 | dom96 | allocated how? |
23:59:51 | dom96 | in most cases ints won't be allocated on the heap |
23:59:53 | girvo | allocated is the wrong word, I'm not using alloc or anything lol :P |
23:59:57 | girvo | just regular `var` or `let` |