00:02:46 | * | Varriount-Laptop quit (Ping timeout: 250 seconds) |
00:08:39 | cryzed | http://nim-lang.org/docs/htmlparser.html When looking at this example, wouldn't it make sense to automatically make strtabs available/usable somehow when importing xmltree? |
00:08:51 | cryzed | It seems kind of strange that you would have to explicitly import strtabs when xmltree is using it anyways |
00:09:01 | cryzed | or maybe I'm too used to Python |
00:09:45 | * | desophos quit (Remote host closed the connection) |
00:10:15 | cryzed | ah I see, it provides an overloaded version of [] for StringTableRef, and XmlAttributes is a synonym for it -- still I would think that one would automatically import that overloaded proc when importing xmltree -- is there a way to do this automatically? |
00:17:29 | def- | cryzed: xmltree could re-export it |
00:17:56 | cryzed | def-, re-exporting it would cause me, as the "end-user" i.e. importer of xmltree, not to have to import it? |
00:18:21 | cryzed | def-, oh by adding a *? |
00:20:40 | * | elrood quit (Quit: Leaving) |
00:21:23 | ephja | is it part of the public interface? |
00:21:50 | cryzed | ephja, it should be in my opinion, because using XmlAttributes is not possible otherwise |
00:21:51 | * | jakesyl joined #nim |
00:22:22 | cryzed | since XmlAttribute is simply strtab's StringTableRef |
00:22:58 | cryzed | but I'm completely new to nim, maybe that's a nim-idiom I'm simply not familiar with |
00:24:51 | * | desophos joined #nim |
00:33:53 | * | zepolen_ joined #nim |
00:36:38 | cryzed | how do I copy a sequence in nim? |
00:37:42 | * | zepolen quit (Ping timeout: 260 seconds) |
00:38:33 | cryzed | ah I suppose I could just slice it |
00:39:31 | ephja | a=b |
00:40:45 | cryzed | ephja, this doesn't just copy the reference? |
00:41:22 | * | pilne quit (Quit: Quit!) |
00:43:22 | * | pilne joined #nim |
00:43:26 | ephja | no |
00:43:40 | * | kulelu88 left #nim ("Leaving") |
00:44:45 | cryzed | I see |
00:45:17 | * | boydgreenfield quit (Quit: boydgreenfield) |
00:47:45 | * | pilne quit (Remote host closed the connection) |
00:48:35 | * | pilne joined #nim |
00:52:22 | * | yglukhov joined #nim |
00:52:36 | cryzed | ephja, Error: unhandled exception: len(a) == L seq modified while iterating over it [AssertionError] |
00:52:38 | cryzed | apparently yes? |
00:53:26 | cryzed | ephja, https://gist.github.com/cryzed/a70fee9105e0d2aaf9bf this is just a test, I know this doesn't quite work. But I would have expected for oldParts to be a copy, but apparently I am modifying the same instance I am iterating over |
00:54:50 | * | vikaton joined #nim |
00:56:41 | * | yglukhov quit (Ping timeout: 246 seconds) |
01:08:14 | * | barosl quit (Quit: Leaving) |
01:14:02 | cryzed | ephja, beep |
01:16:04 | ephja | I can't reproduce that |
01:16:07 | * | Jesin joined #nim |
01:19:03 | cryzed | Well I'm using the latest devel version |
01:26:14 | ephja | cryzed: ok it's because oldParts isn't a var |
01:26:40 | cryzed | oh, right |
01:26:46 | cryzed | no wait |
01:26:56 | cryzed | It still isn't obvious to me why var would cause a copy |
01:27:01 | cryzed | while let would cause a reference |
01:27:19 | cryzed | just fundamentally different behaviour? |
01:29:52 | * | girvo quit (Quit: leaving) |
01:30:26 | * | gokr quit (Ping timeout: 260 seconds) |
01:30:27 | ephja | I have no idea |
01:30:45 | cryzed | alright, ephja thanks for the feedback |
01:36:09 | ephja | it might just be an optimization |
01:50:42 | * | pregressive joined #nim |
01:53:35 | * | theduke quit (Ping timeout: 264 seconds) |
02:05:15 | * | theduke joined #nim |
02:05:18 | theduke | Is the runtime cost of the dynamic dispatch really higher than the extra method call? |
02:05:30 | theduke | ah extra proc call |
02:07:22 | * | solidsnack quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
02:13:26 | * | solidsnack joined #nim |
02:17:43 | * | solidsnack quit (Client Quit) |
02:38:57 | * | desophos_ joined #nim |
02:43:26 | * | desophos_ quit (Ping timeout: 246 seconds) |
02:49:23 | * | theduke quit (Ping timeout: 264 seconds) |
02:51:38 | * | silven quit (Ping timeout: 260 seconds) |
02:52:01 | * | silven joined #nim |
02:55:54 | * | yglukhov joined #nim |
02:58:10 | * | ephja quit (Ping timeout: 260 seconds) |
03:01:24 | * | yglukhov quit (Ping timeout: 245 seconds) |
03:02:08 | * | theduke joined #nim |
03:10:29 | * | pilne quit (Quit: Quit!) |
03:19:10 | * | jakesyl quit (Ping timeout: 260 seconds) |
03:47:44 | * | girvo joined #nim |
03:48:17 | girvo | hey all :) |
03:49:44 | * | Jesin quit (Quit: Leaving) |
03:51:06 | girvo | has anyone integrated an external scripting lang into nim? |
03:51:53 | * | dngad joined #nim |
03:53:25 | girvo | ChaiScript looks like a decent candiate to try and wrap, but I've only written wrappers for C libraries, not C++ ones before |
04:23:02 | * | vendethiel joined #nim |
04:37:35 | * | sqwishy joined #nim |
04:40:31 | sqwishy | There's a typo in the documentation. If I make an issue about it can I submit a pull request for a fix to the devel branch? |
04:46:17 | * | vendethiel quit (Ping timeout: 246 seconds) |
04:52:55 | def- | sqwishy: no need to make an issue, you can make a PR directly |
04:53:17 | * | silven quit (Ping timeout: 246 seconds) |
04:53:28 | def- | sqwishy: using the regular PR process, or with the github web interface, but make sure to make it against devel, not master |
04:54:06 | * | silven joined #nim |
04:57:59 | * | vikaton quit (Quit: Connection closed for inactivity) |
04:58:23 | * | yglukhov joined #nim |
05:02:38 | * | yglukhov quit (Ping timeout: 250 seconds) |
05:25:22 | * | Varriount-Laptop joined #nim |
05:47:29 | * | darkf joined #nim |
05:52:12 | * | s4 joined #nim |
05:53:13 | * | theduke quit (Quit: Leaving) |
05:58:00 | * | kniteli quit (Quit: Leaving) |
06:01:46 | * | pregressive quit (Remote host closed the connection) |
06:05:25 | * | Demon_Fox joined #nim |
06:14:43 | * | dngad_ joined #nim |
06:17:14 | * | dngad quit (Ping timeout: 245 seconds) |
06:53:06 | * | dngad joined #nim |
06:55:43 | * | dngad_ quit (Ping timeout: 260 seconds) |
06:56:37 | * | Demon_Fox quit (Quit: Leaving) |
07:13:54 | * | Varriount-Laptop quit (Ping timeout: 260 seconds) |
07:15:57 | * | bjz joined #nim |
07:26:18 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
07:48:39 | * | desophos_ joined #nim |
07:49:37 | * | yglukhov joined #nim |
07:53:21 | * | bjz joined #nim |
07:53:34 | * | desophos_ quit (Ping timeout: 260 seconds) |
07:57:48 | * | gokr joined #nim |
08:04:52 | * | dngad_ joined #nim |
08:07:14 | * | dngad quit (Ping timeout: 245 seconds) |
08:22:18 | * | nastavnic joined #nim |
08:26:01 | * | desophos quit (Read error: Connection reset by peer) |
08:30:30 | * | dngad__ joined #nim |
08:34:39 | * | dngad_ quit (Ping timeout: 260 seconds) |
08:47:43 | * | dngad__ quit (Ping timeout: 260 seconds) |
08:48:28 | * | Arrrr joined #nim |
10:12:38 | * | bjz quit (Ping timeout: 260 seconds) |
10:15:48 | * | desophos joined #nim |
10:20:16 | * | desophos quit (Ping timeout: 250 seconds) |
10:24:46 | * | nastavnic quit (Ping timeout: 260 seconds) |
10:24:46 | * | makoLine quit (Ping timeout: 260 seconds) |
10:27:05 | * | bjz joined #nim |
10:27:32 | * | nastavnic joined #nim |
10:30:50 | * | nicktick quit (Ping timeout: 260 seconds) |
10:30:57 | * | nicktick1 joined #nim |
10:33:49 | * | zepolen joined #nim |
10:34:10 | vegansk | Araq, hi! Please review https://github.com/nim-lang/Nim/pull/3587 again when you get a minute |
10:35:50 | Araq | vegansk: well I need to do it on my own to understand it |
10:36:26 | * | zepolen_ quit (Ping timeout: 260 seconds) |
11:01:38 | * | Sornaensis quit (Ping timeout: 260 seconds) |
11:02:49 | * | Sornaensis joined #nim |
11:11:49 | * | nastavnic quit (Ping timeout: 245 seconds) |
11:17:20 | * | Trustable joined #nim |
11:17:55 | * | PyHedgehog-work joined #nim |
11:24:40 | * | ir2ivps10_ joined #nim |
11:25:38 | * | ir2ivps10 quit (Remote host closed the connection) |
11:31:07 | * | nastavnic joined #nim |
11:42:42 | * | PyHedgehog-work left #nim (#nim) |
11:49:15 | * | elrood joined #nim |
12:40:31 | * | matkuki joined #nim |
13:03:12 | * | filcuc joined #nim |
13:05:59 | * | BitPuffin joined #nim |
13:28:48 | * | ephja joined #nim |
13:41:27 | * | matkuki quit (Quit: ChatZilla 0.9.92 [Firefox 42.0/20151029151421]) |
13:44:41 | * | s4 quit () |
14:04:44 | * | ir2ivps10_ quit (Ping timeout: 250 seconds) |
14:27:18 | * | ir2ivps10 joined #nim |
14:38:32 | * | nastavnic quit (Ping timeout: 250 seconds) |
14:38:57 | * | nastavnic joined #nim |
14:40:41 | cryzed | There's a bug in the stdlib uri module afaict. When combining http://example.com/test/hello.html with //domain.com/file it should simply return //domain.com/file instead of a concatenated version of the two |
14:41:02 | cryzed | maybe, I'm not sure what the best default behavior is |
14:47:25 | Araq | we disussed this iirc. |
14:47:44 | Araq | and IMHO a combine which doesn't combine is weird |
14:48:54 | * | nastavnic quit (Ping timeout: 245 seconds) |
14:57:53 | cryzed | Araq, sorry, let me correct myself. Even when using the / proc it has that behavior |
15:06:53 | cryzed | Araq, sorry, let me correct myself. Even when using the / proc it has that behavior |
15:06:54 | cryzed | oops |
15:06:55 | cryzed | sorry. |
15:13:27 | federico3 | where is the implementation of fieldPairs? https://github.com/nim-lang/Nim/search?utf8=%E2%9C%93&q=FieldPairs |
15:20:41 | cryzed | federico3, can't find it either |
15:22:14 | * | elrood quit (Quit: Leaving) |
15:28:23 | federico3 | is it implemented in C only? Is it due to the "magic" pragma? |
15:30:32 | * | Jehan_ joined #nim |
15:31:00 | ephja | try mfieldpairs |
15:31:02 | Jehan_ | federico3, cryzed: fieldPairs is implemented in the compiler (that's what {.magic.} is about). |
15:33:53 | Jehan_ | It's because the loop needs to be unrolled (each field can have a different type, so the iterator result has a different type for each iteration). |
15:49:06 | * | ephja quit (Ping timeout: 260 seconds) |
15:55:48 | * | pregressive joined #nim |
15:55:50 | * | pregressive quit (Read error: Connection reset by peer) |
15:56:23 | * | pregressive joined #nim |
16:01:25 | * | Jesin joined #nim |
16:04:03 | * | vqrs quit (Ping timeout: 260 seconds) |
16:04:39 | * | vqrs joined #nim |
16:10:03 | * | ephja joined #nim |
16:13:00 | * | yglukhov quit (Ping timeout: 250 seconds) |
16:13:26 | * | kerze joined #nim |
16:23:09 | cryzed | Can someone tell me what the uppercase letters in front of TIterator or PXmlNode stand for? |
16:26:17 | federico3 | any way to access a tuple field named after an enum value? |
16:26:56 | cryzed | federico3, you can probably index it |
16:27:05 | cryzed | or unpack it |
16:27:28 | cryzed | and I'm sure the .field syntax is just a proc that shadows another actual method, taking a string |
16:28:38 | federico3 | field? |
16:28:42 | ephja | cryzed: Type and Pointer |
16:28:46 | ephja | these conventions are outdated |
16:28:59 | ephja | because the first letter is now case sensitive |
16:29:18 | cryzed | ephja, so they will be removed. federico3 you are doing Person.name where .name is the field you want to access |
16:29:26 | cryzed | You could also do myPerson[0] to access it for example |
16:30:15 | federico3 | myPerson[n] needs to be evalued at compile time |
16:31:00 | cryzed | ah. |
16:31:06 | cryzed | and you can't do that with tuple indexes? |
16:31:10 | cryzed | I'm new to Nim, sorry |
16:32:03 | cryzed | federico3, if not at all avoidable you could write a getField method that uses key, val in fieldPairs(myPerson) to search for the matching key and then return val |
16:32:11 | cryzed | but there really should be something like that already |
16:32:20 | cryzed | I just can't find it, i.e. the method that .field-syntax uses |
16:32:34 | federico3 | and there is no mytuple.get("fieldname") |
16:33:07 | cryzed | federico3, you could easily write one |
16:33:54 | cryzed | or maybe just rename your enum |
16:35:50 | cryzed | federico3, sorry for not being more helpful |
16:42:28 | federico3 | np, thank you anyways :) |
16:43:41 | ephja | cryzed: there still are such identifiers that haven't been deprecated? |
16:43:54 | cryzed | ephja, I had just read about TIterator recently |
16:43:56 | cryzed | and PXmlNode |
16:43:58 | cryzed | for example |
16:44:19 | cryzed | oh wait, maybe I am using them and getting deprecation warnings |
16:46:02 | * | Jehan_ quit (Ping timeout: 260 seconds) |
16:48:21 | cryzed | Yeah I think I was |
16:48:25 | cryzed | I can just as well use XmlNode, thanks ephja |
17:04:19 | * | Jehan_ joined #nim |
17:16:11 | * | yglukhov joined #nim |
17:20:32 | * | yglukhov quit (Ping timeout: 246 seconds) |
17:25:34 | * | makoLine joined #nim |
17:35:12 | * | Jehan_ quit (Read error: Connection reset by peer) |
17:38:10 | * | boopsiesisaway is now known as boopsies |
17:38:30 | * | filcuc quit (Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/) |
17:38:42 | * | brson joined #nim |
17:42:05 | * | Arrrr quit (Quit: WeeChat 1.2) |
17:43:16 | * | yglukhov joined #nim |
17:52:40 | * | Jehan_ joined #nim |
18:02:57 | * | zepolen quit (Remote host closed the connection) |
18:04:54 | * | SirCmpwn quit (Ping timeout: 260 seconds) |
18:05:09 | * | nicktick joined #nim |
18:05:23 | * | nicktick1 quit (Ping timeout: 260 seconds) |
18:09:34 | * | cryzed quit (Ping timeout: 260 seconds) |
18:13:20 | * | cryzed joined #nim |
18:14:18 | * | nastavnic joined #nim |
18:15:04 | cryzed | SomeObj and ref SomeObj -- is the ref keyword just important for the garbage collector in the end? Types that are only defined with ref can not be instantiated as/with untraced pointers, while types that only have one ref-type can only be instantiated as traced references? |
18:15:08 | cryzed | I'm not quite clear on that yet |
18:18:12 | * | Trustable quit (Remote host closed the connection) |
18:18:27 | * | nicktick quit (Ping timeout: 260 seconds) |
18:20:29 | ephja | "one ref-type" |
18:20:53 | * | nicktick joined #nim |
18:22:11 | ephja | "ref object" saves you from having to type "ref Foo" |
18:23:06 | * | Jehan_ quit (Ping timeout: 260 seconds) |
18:24:33 | ephja | cryzed: https://github.com/nim-lang/Nim/wiki/Style-Guide-for-Nim-Code#naming-conventions |
18:25:09 | * | nicktick quit (Ping timeout: 245 seconds) |
18:25:15 | ephja | see the second bullet point |
18:25:51 | * | nicktick joined #nim |
18:27:56 | * | elrood joined #nim |
18:28:48 | * | Jehan_ joined #nim |
18:30:01 | Araq | Jehan_: if you are looking for a challenge, take a look at gc2.nim |
18:30:17 | * | desophos joined #nim |
18:30:18 | * | SirCmpwn joined #nim |
18:30:30 | Araq | with -d:useSysAssert -d:useGcAssert some tests fail with --gc:v2 |
18:31:02 | Araq | and for reasons that escape me, the incremental marking step can free obviously reachable objects |
18:34:45 | * | darkf quit (Quit: Leaving) |
18:35:15 | * | ozra joined #nim |
18:35:23 | ephja | cryzed: https://gist.github.com/ephja/8648f160d9b0a821d84c |
18:36:47 | * | kniteli joined #nim |
18:41:18 | Jehan_ | Araq: I've been looking at the commit messages, but I'm not sure I have the time to dig into the actual code. |
18:41:44 | Jehan_ | Is that the precise GC you had been talking about or some other project? |
18:42:07 | Araq | no, that's just the old GC which a cycle collector that doesn't suck |
18:42:31 | Araq | it's an incremental mark&sweep that respects deadlines |
18:42:42 | * | kulelu88 joined #nim |
18:42:42 | * | kulelu88 quit (Changing host) |
18:42:42 | * | kulelu88 joined #nim |
18:42:49 | Jehan_ | Gotcha. |
18:43:35 | Jehan_ | I'm still not sure about how much time I have in the next couple of weeks, but I'll try to give it a look. |
18:43:43 | Araq | thank you. |
18:44:23 | Jehan_ | Incidentally, have you seen my PR w.r.t. shifts and set operations? |
18:44:34 | Araq | I don't have much time either, so I'm not actively debugging it. Instead I am waiting for the solution to turn up when I sleep |
18:44:47 | Jehan_ | Araq: Heh. :) |
18:45:12 | Araq | I merged that PR already? |
18:45:18 | Araq | or is it a new one? |
18:45:26 | Jehan_ | Oops, did you? In that case, I must have missed it. |
18:45:56 | Jehan_ | Hmm, I'm talking about https://github.com/nim-lang/Nim/pull/3530 |
18:45:56 | ephja | why must Araq's nick be yellow -.- |
18:46:00 | Jehan_ | Seems unmerged? |
18:46:02 | ephja | the default X colors are terrible |
18:46:27 | Jehan_ | I mean, I totally wouldn't be surprised if you had comments/concerns. |
18:46:29 | * | jaco60 joined #nim |
18:47:01 | Jehan_ | But it actually creates issues with sets that use the highest bit. |
18:47:15 | Jehan_ | Discovered by running with -fsanitize=shift, incidentally. |
18:47:57 | Araq | you mean your PR creates new issues? |
18:48:05 | Jehan_ | This is part of a plan to add a -d:safe option to silence the "C output is undefined" peanut gallery, for what it's worth. |
18:48:07 | * | vendethiel joined #nim |
18:48:08 | Araq | I reviewed it and thought I had merged it already |
18:48:38 | Jehan_ | Araq: No, I mean that the *current* code technically generates undefined C. |
18:48:43 | Araq | Jehan_: yeah I also have 'not nil becomes the default' in the works to silence this crowd |
18:48:53 | Araq | Jehan_: yeah, ok, gotcha |
18:49:02 | Jehan_ | Because it does stuff like 1 << (SETSIZE-1) |
18:49:23 | * | pregressive quit (Remote host closed the connection) |
18:49:23 | Jehan_ | Araq: I have a lot more mixed feelings about that, because I actually like it the way it currently is. :) |
18:49:43 | Araq | yeah but I've seen how it improves the code in the compiler |
18:49:50 | Jehan_ | Also not entirely sure how backwards compatible that is going to be. |
18:49:58 | Araq | and I'm quite convinced it's the way to go |
18:50:06 | Jehan_ | Okay, I trust you. :) |
18:50:09 | Araq | note that I introduced new syntax for this |
18:50:26 | Araq | proc p(s: nil Node) = ... |
18:50:57 | ephja | neat |
18:52:15 | Jehan_ | Araq: Hmm, I'm still concerned about backwards compatibility. |
18:52:50 | Jehan_ | Because if refs/ptrs can't be nil or uninitialized, that's going to break a shipload of code. |
18:53:26 | * | gmpreussner|work joined #nim |
18:53:28 | Araq | yeah, it will break everything. but we'll only produce warnings for a couple of versions |
18:53:45 | Araq | and the warning handling will be per nimble package too |
18:54:07 | Jehan_ | I think you may need at least an option to downgrade that to warnings for a longer period, too. |
18:55:30 | Araq | the fact that we tend to alias ref types mitigates the problem though |
18:55:45 | Araq | type Rope = nil ref RopeObj |
18:56:13 | gmpreussner|work | hey guys |
18:56:25 | Araq | and we'll never enforce 'nil' checking for nilable pointers |
18:56:40 | * | solidsnack joined #nim |
18:56:41 | Araq | so obj.field is valid even if 'obj' can be 'nil'. |
18:57:16 | * | pregressive joined #nim |
18:57:19 | Araq | we will provide an optional warning for that though. so people who want more checking can get more checking. |
19:04:24 | * | desophos_ joined #nim |
19:08:05 | Jehan_ | Any reason for using `nil ref` rather than `ref?` like some other languages have done? Grepability (yeah, I know, that's not a word)? |
19:10:40 | * | Jehan_ quit (Read error: Connection reset by peer) |
19:10:44 | * | vendethiel quit (Ping timeout: 272 seconds) |
19:11:53 | * | solidsnack quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
19:12:10 | Araq | turns out 'nil ref' is already allowed by the grammar and we just don't support it in semantic checking |
19:12:15 | * | desophos_ quit () |
19:12:35 | Araq | 'ref?' would introduce a postfix operator which we try to avoid |
19:12:40 | Araq | hi gmpreussner|work |
19:13:49 | cryzed | ephja, thank you! |
19:14:02 | cryzed | That's really helpful, I'll take a look at it after I'm back from exercise |
19:14:05 | cryzed | :)! |
19:14:10 | * | Jehan_ joined #nim |
19:15:25 | * | solidsnack joined #nim |
19:15:45 | ephja | d(:P)|< |
19:15:58 | * | Matthias247 joined #nim |
19:16:15 | * | k1io joined #nim |
19:18:20 | * | solidsnack quit (Client Quit) |
19:21:40 | * | Jehan_ quit (Read error: Connection reset by peer) |
19:24:57 | * | Jehan_ joined #nim |
19:25:39 | * | kerze quit (Ping timeout: 260 seconds) |
19:28:59 | * | kulelu88 quit (Ping timeout: 246 seconds) |
19:29:50 | * | vendethiel joined #nim |
19:33:19 | * | Jehan_ quit (Read error: Connection reset by peer) |
19:35:12 | * | Jehan_ joined #nim |
19:45:34 | * | Jehan_ quit (Ping timeout: 245 seconds) |
19:45:36 | * | kulelu88 joined #nim |
19:45:36 | * | kulelu88 quit (Changing host) |
19:45:36 | * | kulelu88 joined #nim |
19:50:54 | * | Jehan_ joined #nim |
19:51:23 | * | nastavnic quit (Ping timeout: 246 seconds) |
19:55:59 | * | no_name quit (Ping timeout: 245 seconds) |
19:55:59 | * | devzerp quit (Ping timeout: 245 seconds) |
20:04:38 | * | no_name joined #nim |
20:05:26 | * | devzerp joined #nim |
20:19:11 | * | nicktick quit (Quit: Leaving.) |
20:20:18 | strcmp1 | d |
20:21:41 | * | jakesyl joined #nim |
20:22:43 | ephja | 0x64 |
20:23:54 | * | solidsnack joined #nim |
20:27:32 | * | Jehan_ quit (Quit: Leaving) |
20:29:34 | * | solidsnack quit (Ping timeout: 260 seconds) |
20:31:55 | * | kulelu88 quit (Ping timeout: 260 seconds) |
20:32:50 | * | jaco60 quit (Ping timeout: 260 seconds) |
20:34:14 | * | jakesyl quit (Ping timeout: 260 seconds) |
20:39:39 | * | jaco60 joined #nim |
20:42:06 | * | BitPuffin quit (Ping timeout: 250 seconds) |
20:43:55 | * | kulelu88 joined #nim |
20:50:32 | * | solidsnack joined #nim |
20:54:47 | * | jakesyl joined #nim |
21:05:03 | * | ozra quit (Ping timeout: 252 seconds) |
21:07:45 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
21:11:59 | * | solidsnack quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
21:13:10 | * | solidsnack joined #nim |
21:17:59 | * | vendethiel- joined #nim |
21:18:38 | * | desophos_ joined #nim |
21:19:14 | * | vendethiel quit (Ping timeout: 246 seconds) |
21:21:41 | * | kulelu88 quit (Ping timeout: 246 seconds) |
21:22:46 | * | desophos quit (Ping timeout: 260 seconds) |
21:25:21 | * | bjz joined #nim |
21:32:28 | * | benaiah left #nim ("WeeChat 0.4.2") |
21:33:02 | * | makoLine quit (Ping timeout: 260 seconds) |
21:33:16 | cryzed | ephja, are you still around? |
21:34:03 | * | kulelu88 joined #nim |
21:34:03 | * | kulelu88 quit (Changing host) |
21:34:03 | * | kulelu88 joined #nim |
21:35:04 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
21:36:57 | * | solidsnack quit (Quit: My Mac has gone to sleep. ZZZzzz…) |
21:40:18 | ephja | cryzed: yes |
21:40:36 | * | bjz joined #nim |
21:41:26 | cryzed | ephja, so I did take a look at your gist. So when I have a type x = obj -- it's the obj I'm talking to directly when I have an instance of it, I don't dereference it with the [] proc. When I do y = ref obj, and create a new instance of it, doing y() will automatically return a reference to the object which I will have to dereference |
21:41:49 | * | kulelu88 quit (Ping timeout: 245 seconds) |
21:42:03 | * | solidsnack joined #nim |
21:42:04 | cryzed | In your gist you say that new is implicitly invoked for the constructors whose types are references |
21:42:18 | cryzed | but isn't it also implicitly invoked when doing foo = object, foo()? |
21:42:49 | ephja | cryzed: no, because then it's allocated on the stack |
21:43:02 | * | jakesyl quit (Ping timeout: 246 seconds) |
21:43:14 | cryzed | So doing foo = object, foo() will automatically die/be garbage collected as soon as the function exits? |
21:44:03 | cryzed | And when creating a reference instead I could pass it around my program until I manually destroy it? |
21:45:07 | * | Demon_Fox joined #nim |
21:45:10 | * | bjz quit (Ping timeout: 260 seconds) |
21:45:21 | * | solidsnack quit (Client Quit) |
21:46:36 | cryzed | ephja, so attempting to pass around an object directly between functions should fail? Sorry if I'm being obtuse |
21:47:42 | * | makoLine joined #nim |
21:47:49 | * | desophos_ is now known as desophos |
21:51:45 | ephja | cryzed: it goes out of scope, and subsequent function calls might override that part of the stack |
21:52:07 | cryzed | ephja, so it's unsafe. I just tried it, it also tells me even before compiling that .field is not assignable |
21:52:18 | cryzed | Only within the same function |
21:53:05 | cryzed | I have been using high-level languages for so long -- so the only usecase where instantiating an object directly would make sense if you only use it within the function itself and don't want to dereference it? |
21:53:08 | ephja | cryzed: no, what should be avoided is having a pointer to the object in question after the function has returned |
21:53:40 | cryzed | yes, that makes sense |
21:53:51 | ephja | cryzed: that's different. are you omitting 'var' when you perhaps shouldn't? |
21:54:02 | cryzed | ephja, I'll check |
21:54:07 | cryzed | ah. |
21:54:26 | cryzed | One is a reference, and a reference I can always dereference and modify the object |
21:54:33 | cryzed | but when passing an object without var in the parameter list |
21:54:35 | cryzed | I can't modify it |
21:54:38 | cryzed | is that right? |
21:55:30 | cryzed | ah yes, seems to be the case, https://gist.github.com/cryzed/f39e306e54717b515364 this works |
21:56:13 | * | kulelu88 joined #nim |
21:56:13 | * | kulelu88 quit (Changing host) |
21:56:13 | * | kulelu88 joined #nim |
21:56:30 | cryzed | So instantiate the object directly when I'm not planning on passing it around after the function has ended, and use a reference to it when I am planning on doing so |
21:58:59 | ephja | no, a reference doesn't allow modifications to be made when 'var' is omitted |
22:00:22 | cryzed | ephja, https://gist.github.com/cryzed/f39e306e54717b515364 am I missing something? This works |
22:02:17 | * | makoLine quit (Ping timeout: 246 seconds) |
22:02:18 | ephja | yes, sorry, it's only the reference itself that cannot be modified |
22:02:29 | cryzed | ah ok :) |
22:02:41 | cryzed | so I couldn't test = somethingElse |
22:02:43 | cryzed | within that function |
22:03:02 | ephja | right |
22:03:46 | cryzed | ah, alright -- thank you. Regarding my understand of usecases, is that correct or completely off the mark? |
22:03:53 | cryzed | understanding |
22:04:08 | cryzed | "so the only usecase where instantiating an object directly would make sense if you only use it within the function itself and don't want to dereference it?" |
22:14:19 | Araq | cryzed: the 'ref object' vs 'object' depends on your code style and the semantics you need. |
22:14:20 | ephja | no, but rather if you want it to potentially outlive that scope, and when you want polymorphism, and for recursive types (such as trees) in most cases |
22:14:46 | Araq | in general, I advise newbies to use 'ref object' since that's much closer to what Python etc. do |
22:14:58 | cryzed | Araq, ephja -- alright, thank you |
22:15:37 | * | jakesyl joined #nim |
22:15:47 | * | BlaXpirit quit (Quit: Bye) |
22:15:48 | ephja | though I often use ref even though I have certain types that are instantiated only in the main function |
22:16:09 | cryzed | I'm attempting to write a rough Markdown parser, and first tokenize the content and then use the tokens to build an AST. Then hopefully add methods that work on this AST and can output it in different formats, such as HTML |
22:16:32 | cryzed | ephja, alright, I'll go with ref for now until I'm more aware of the advantages of the different semantics |
22:16:45 | Araq | AST screams 'ref' ;-) |
22:16:57 | cryzed | Then that's what I'll be using if I get that far :) |
22:17:18 | ephja | just because the overhead often isn't significant (dynamic allocation is a lot slower) |
22:17:59 | Araq | though there is a cool trick that's quite unique to Nim where you use seq[DirectObject] to build the trees and save one level of indirection |
22:18:09 | ephja | Araq: you could always just roll your own stack allocator :p |
22:18:40 | * | BlaXpirit joined #nim |
22:19:05 | Araq | ephja: Nim's allocator uses a bump pointer. not that it helps too much, but still |
22:19:06 | ephja | though the stack size is usually orders of magnitude smaller |
22:19:36 | ephja | it's unique to nim? |
22:22:05 | ephja | cryzed: https://github.com/fowlmouth/glossolalia |
22:22:29 | ephja | though it might not be that easy to use for newbies, and the documentation is sparse, but it's a neat parser generator |
22:22:49 | cryzed | what about pegs? |
22:23:04 | cryzed | I had just seen that in the docs |
22:23:13 | * | makoLine joined #nim |
22:23:26 | ephja | I think it still lacks trees, which greatly limits its usefulness |
22:23:54 | cryzed | ah |
22:24:35 | cryzed | Yeah I have no clue what a parser combinator is as of yet, I might just try my own "simple" solution first and see where I go from there -- i.e. tokenizing with re/nre and then building the AST manually |
22:25:50 | Araq | please try lexim for the lexer |
22:26:10 | Araq | but I have to admit I never found the time to test it thoroughly |
22:26:18 | Araq | but it's awesome, use it |
22:26:44 | Araq | it's as fast as a hand written lexer |
22:28:29 | cryzed | I do believe you, and I might use it (if I get that far), but for now it's not about speed or the best possible solution for me, but rather getting acquainted with Nim and building/parsing an AST on my own (since I have never done so either before). I hope this doesn't sound too stupid :P |
22:30:00 | ephja | Araq: is that the one reason to prefer it over a well-designed parser generator? |
22:30:43 | ephja | anyway, I like the simplicity of it |
22:31:48 | ephja | cryzed: nope, sounds perfectly reasonable |
22:32:03 | cryzed | Araq, the thing is -- I know for a fact that this will be great code and a great implementation, but it takes away all the hard parts from me -- i.e. thinking about how to best write my lexer by hand, and assemble the AST etc. When I actually manage to implement Markdown or a subset of it, and then notice I want /need something better, I'll definitely use that solution -- thank you |
22:32:05 | ephja | some people just can't master a language in 4 hours I guess ;) |
22:32:24 | Araq | lexim only builds the lexer for you |
22:32:33 | Araq | the parser and AST are still yours to build |
22:32:52 | * | Jesin quit (Quit: Leaving) |
22:39:11 | cryzed | I believe you, my point still stands :) |
22:39:26 | cryzed | with the small addition of wanting to write my own lexer -- FOR NOW |
22:39:30 | cryzed | I know I sound infantile |
22:41:44 | ephja | no, it's a reasonable way to learn |
22:44:04 | cryzed | ephja, I'm glad you think so. It's also not just about learning Nim as a different language -- even knowing Python as well as I do, writing this AST-toolset would be hard for me (since that's something I have never done before). So it's about learning both, and I hope I understand both things pretty well in the end |
22:46:34 | Araq | cryzed: if you want "inspiration" look at docgen/rstast.nim docgen/*.nim |
22:47:01 | cryzed | thank you Araq, I will |
22:48:50 | * | vendethiel- quit (Ping timeout: 246 seconds) |
22:49:17 | cryzed | docutils, right? |
22:50:14 | cryzed | ah yep |
22:53:14 | * | gokr left #nim (#nim) |
22:55:28 | * | BitPuffin|osx joined #nim |
23:05:43 | * | boopsies is now known as boopsiesisaway |
23:13:27 | * | pregressive quit () |
23:23:42 | cryzed | Ok so again: I clone nimsuggest, move it to Nim-devel\compiler\nimsuggest, then cd into it and do nimble build and end up with this: https://gist.github.com/cryzed/196b794a4c54b1ea3c8e |
23:23:54 | cryzed | the signature looks like it is matching though? |
23:23:57 | cryzed | the lower one that is |
23:26:55 | * | kulelu88 quit (Ping timeout: 260 seconds) |
23:33:05 | cryzed | ah I got it to work by using the steps described above, and then running "nim c -d:release --noNimblePath --path:"C:\Nim-devel" nimsuggest.nim" |
23:33:08 | cryzed | this really should work with nimble |
23:42:41 | * | kulelu88 joined #nim |
23:46:59 | * | Jesin joined #nim |
23:49:19 | yglukhov | Araq, are closure iterators transformed to procs? |
23:49:44 | yglukhov | closure iterators dont work in js :( |
23:50:56 | Araq | yeah, but it's "easy" to support for JS |
23:51:19 | Araq | you need to implement how to translate the nkState and nkGoto AST nodes |
23:52:11 | * | kniteli quit (Ping timeout: 246 seconds) |
23:58:05 | Araq | just look at what the C codegen does with it and do the same for JS |
23:58:25 | Araq | and "the same" means here "oh ffs, JS doesn't support goto" |
23:58:59 | Araq | but I told you how to transform 'goto' when there is no 'goto' in the target language, right? |
23:59:37 | * | jaco60 quit (Quit: Leaving) |
23:59:53 | Araq | good night |