<< 03-12-2015 >>

00:02:46*Varriount-Laptop quit (Ping timeout: 250 seconds)
00:08:39cryzedhttp://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:51cryzedIt seems kind of strange that you would have to explicitly import strtabs when xmltree is using it anyways
00:09:01cryzedor maybe I'm too used to Python
00:09:45*desophos quit (Remote host closed the connection)
00:10:15cryzedah 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:29def-cryzed: xmltree could re-export it
00:17:56cryzeddef-, re-exporting it would cause me, as the "end-user" i.e. importer of xmltree, not to have to import it?
00:18:21cryzeddef-, oh by adding a *?
00:20:40*elrood quit (Quit: Leaving)
00:21:23ephjais it part of the public interface?
00:21:50cryzedephja, it should be in my opinion, because using XmlAttributes is not possible otherwise
00:21:51*jakesyl joined #nim
00:22:22cryzedsince XmlAttribute is simply strtab's StringTableRef
00:22:58cryzedbut 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:38cryzedhow do I copy a sequence in nim?
00:37:42*zepolen quit (Ping timeout: 260 seconds)
00:38:33cryzedah I suppose I could just slice it
00:39:31ephjaa=b
00:40:45cryzedephja, this doesn't just copy the reference?
00:41:22*pilne quit (Quit: Quit!)
00:43:22*pilne joined #nim
00:43:26ephjano
00:43:40*kulelu88 left #nim ("Leaving")
00:44:45cryzedI 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:36cryzedephja, Error: unhandled exception: len(a) == L seq modified while iterating over it [AssertionError]
00:52:38cryzedapparently yes?
00:53:26cryzedephja, 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:02cryzedephja, beep
01:16:04ephjaI can't reproduce that
01:16:07*Jesin joined #nim
01:19:03cryzedWell I'm using the latest devel version
01:26:14ephjacryzed: ok it's because oldParts isn't a var
01:26:40cryzedoh, right
01:26:46cryzedno wait
01:26:56cryzedIt still isn't obvious to me why var would cause a copy
01:27:01cryzedwhile let would cause a reference
01:27:19cryzedjust fundamentally different behaviour?
01:29:52*girvo quit (Quit: leaving)
01:30:26*gokr quit (Ping timeout: 260 seconds)
01:30:27ephjaI have no idea
01:30:45cryzedalright, ephja thanks for the feedback
01:36:09ephjait 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:18thedukeIs the runtime cost of the dynamic dispatch really higher than the extra method call?
02:05:30thedukeah 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:17girvohey all :)
03:49:44*Jesin quit (Quit: Leaving)
03:51:06girvohas anyone integrated an external scripting lang into nim?
03:51:53*dngad joined #nim
03:53:25girvoChaiScript 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:31sqwishyThere'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:55def-sqwishy: no need to make an issue, you can make a PR directly
04:53:17*silven quit (Ping timeout: 246 seconds)
04:53:28def-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:10veganskAraq, hi! Please review https://github.com/nim-lang/Nim/pull/3587 again when you get a minute
10:35:50Araqvegansk: 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:41cryzedThere'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:02cryzedmaybe, I'm not sure what the best default behavior is
14:47:25Araqwe disussed this iirc.
14:47:44Araqand IMHO a combine which doesn't combine is weird
14:48:54*nastavnic quit (Ping timeout: 245 seconds)
14:57:53cryzedAraq, sorry, let me correct myself. Even when using the / proc it has that behavior
15:06:53cryzedAraq, sorry, let me correct myself. Even when using the / proc it has that behavior
15:06:54cryzedoops
15:06:55cryzedsorry.
15:13:27federico3where is the implementation of fieldPairs? https://github.com/nim-lang/Nim/search?utf8=%E2%9C%93&q=FieldPairs
15:20:41cryzedfederico3, can't find it either
15:22:14*elrood quit (Quit: Leaving)
15:28:23federico3is it implemented in C only? Is it due to the "magic" pragma?
15:30:32*Jehan_ joined #nim
15:31:00ephjatry mfieldpairs
15:31:02Jehan_federico3, cryzed: fieldPairs is implemented in the compiler (that's what {.magic.} is about).
15:33:53Jehan_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:09cryzedCan someone tell me what the uppercase letters in front of TIterator or PXmlNode stand for?
16:26:17federico3any way to access a tuple field named after an enum value?
16:26:56cryzedfederico3, you can probably index it
16:27:05cryzedor unpack it
16:27:28cryzedand I'm sure the .field syntax is just a proc that shadows another actual method, taking a string
16:28:38federico3field?
16:28:42ephjacryzed: Type and Pointer
16:28:46ephjathese conventions are outdated
16:28:59ephjabecause the first letter is now case sensitive
16:29:18cryzedephja, so they will be removed. federico3 you are doing Person.name where .name is the field you want to access
16:29:26cryzedYou could also do myPerson[0] to access it for example
16:30:15federico3myPerson[n] needs to be evalued at compile time
16:31:00cryzedah.
16:31:06cryzedand you can't do that with tuple indexes?
16:31:10cryzedI'm new to Nim, sorry
16:32:03cryzedfederico3, 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:11cryzedbut there really should be something like that already
16:32:20cryzedI just can't find it, i.e. the method that .field-syntax uses
16:32:34federico3and there is no mytuple.get("fieldname")
16:33:07cryzedfederico3, you could easily write one
16:33:54cryzedor maybe just rename your enum
16:35:50cryzedfederico3, sorry for not being more helpful
16:42:28federico3np, thank you anyways :)
16:43:41ephjacryzed: there still are such identifiers that haven't been deprecated?
16:43:54cryzedephja, I had just read about TIterator recently
16:43:56cryzedand PXmlNode
16:43:58cryzedfor example
16:44:19cryzedoh wait, maybe I am using them and getting deprecation warnings
16:46:02*Jehan_ quit (Ping timeout: 260 seconds)
16:48:21cryzedYeah I think I was
16:48:25cryzedI 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:04cryzedSomeObj 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:08cryzedI'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:29ephja"one ref-type"
18:20:53*nicktick joined #nim
18:22:11ephja"ref object" saves you from having to type "ref Foo"
18:23:06*Jehan_ quit (Ping timeout: 260 seconds)
18:24:33ephjacryzed: 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:15ephjasee the second bullet point
18:25:51*nicktick joined #nim
18:27:56*elrood joined #nim
18:28:48*Jehan_ joined #nim
18:30:01AraqJehan_: 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:30Araqwith -d:useSysAssert -d:useGcAssert some tests fail with --gc:v2
18:31:02Araqand 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:23ephjacryzed: https://gist.github.com/ephja/8648f160d9b0a821d84c
18:36:47*kniteli joined #nim
18:41:18Jehan_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:44Jehan_Is that the precise GC you had been talking about or some other project?
18:42:07Araqno, that's just the old GC which a cycle collector that doesn't suck
18:42:31Araqit'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:49Jehan_Gotcha.
18:43:35Jehan_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:43Araqthank you.
18:44:23Jehan_Incidentally, have you seen my PR w.r.t. shifts and set operations?
18:44:34AraqI 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:47Jehan_Araq: Heh. :)
18:45:12AraqI merged that PR already?
18:45:18Araqor is it a new one?
18:45:26Jehan_Oops, did you? In that case, I must have missed it.
18:45:56Jehan_Hmm, I'm talking about https://github.com/nim-lang/Nim/pull/3530
18:45:56ephjawhy must Araq's nick be yellow -.-
18:46:00Jehan_Seems unmerged?
18:46:02ephjathe default X colors are terrible
18:46:27Jehan_I mean, I totally wouldn't be surprised if you had comments/concerns.
18:46:29*jaco60 joined #nim
18:47:01Jehan_But it actually creates issues with sets that use the highest bit.
18:47:15Jehan_Discovered by running with -fsanitize=shift, incidentally.
18:47:57Araqyou mean your PR creates new issues?
18:48:05Jehan_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:08AraqI reviewed it and thought I had merged it already
18:48:38Jehan_Araq: No, I mean that the *current* code technically generates undefined C.
18:48:43AraqJehan_: yeah I also have 'not nil becomes the default' in the works to silence this crowd
18:48:53AraqJehan_: yeah, ok, gotcha
18:49:02Jehan_Because it does stuff like 1 << (SETSIZE-1)
18:49:23*pregressive quit (Remote host closed the connection)
18:49:23Jehan_Araq: I have a lot more mixed feelings about that, because I actually like it the way it currently is. :)
18:49:43Araqyeah but I've seen how it improves the code in the compiler
18:49:50Jehan_Also not entirely sure how backwards compatible that is going to be.
18:49:58Araqand I'm quite convinced it's the way to go
18:50:06Jehan_Okay, I trust you. :)
18:50:09Araqnote that I introduced new syntax for this
18:50:26Araqproc p(s: nil Node) = ...
18:50:57ephjaneat
18:52:15Jehan_Araq: Hmm, I'm still concerned about backwards compatibility.
18:52:50Jehan_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:28Araqyeah, it will break everything. but we'll only produce warnings for a couple of versions
18:53:45Araqand the warning handling will be per nimble package too
18:54:07Jehan_I think you may need at least an option to downgrade that to warnings for a longer period, too.
18:55:30Araqthe fact that we tend to alias ref types mitigates the problem though
18:55:45Araqtype Rope = nil ref RopeObj
18:56:13gmpreussner|workhey guys
18:56:25Araqand we'll never enforce 'nil' checking for nilable pointers
18:56:40*solidsnack joined #nim
18:56:41Araqso obj.field is valid even if 'obj' can be 'nil'.
18:57:16*pregressive joined #nim
18:57:19Araqwe 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:05Jehan_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:10Araqturns 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:35Araq'ref?' would introduce a postfix operator which we try to avoid
19:12:40Araqhi gmpreussner|work
19:13:49cryzedephja, thank you!
19:14:02cryzedThat's really helpful, I'll take a look at it after I'm back from exercise
19:14:05cryzed:)!
19:14:10*Jehan_ joined #nim
19:15:25*solidsnack joined #nim
19:15:45ephjad(: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:18strcmp1d
20:21:41*jakesyl joined #nim
20:22:43ephja0x64
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:16cryzedephja, 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:18ephjacryzed: yes
21:40:36*bjz joined #nim
21:41:26cryzedephja, 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:04cryzedIn your gist you say that new is implicitly invoked for the constructors whose types are references
21:42:18cryzedbut isn't it also implicitly invoked when doing foo = object, foo()?
21:42:49ephjacryzed: no, because then it's allocated on the stack
21:43:02*jakesyl quit (Ping timeout: 246 seconds)
21:43:14cryzedSo doing foo = object, foo() will automatically die/be garbage collected as soon as the function exits?
21:44:03cryzedAnd 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:36cryzedephja, 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:45ephjacryzed: it goes out of scope, and subsequent function calls might override that part of the stack
21:52:07cryzedephja, so it's unsafe. I just tried it, it also tells me even before compiling that .field is not assignable
21:52:18cryzedOnly within the same function
21:53:05cryzedI 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:08ephjacryzed: no, what should be avoided is having a pointer to the object in question after the function has returned
21:53:40cryzedyes, that makes sense
21:53:51ephjacryzed: that's different. are you omitting 'var' when you perhaps shouldn't?
21:54:02cryzedephja, I'll check
21:54:07cryzedah.
21:54:26cryzedOne is a reference, and a reference I can always dereference and modify the object
21:54:33cryzedbut when passing an object without var in the parameter list
21:54:35cryzedI can't modify it
21:54:38cryzedis that right?
21:55:30cryzedah 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:30cryzedSo 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:59ephjano, a reference doesn't allow modifications to be made when 'var' is omitted
22:00:22cryzedephja, https://gist.github.com/cryzed/f39e306e54717b515364 am I missing something? This works
22:02:17*makoLine quit (Ping timeout: 246 seconds)
22:02:18ephjayes, sorry, it's only the reference itself that cannot be modified
22:02:29cryzedah ok :)
22:02:41cryzedso I couldn't test = somethingElse
22:02:43cryzedwithin that function
22:03:02ephjaright
22:03:46cryzedah, alright -- thank you. Regarding my understand of usecases, is that correct or completely off the mark?
22:03:53cryzedunderstanding
22:04:08cryzed"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:19Araqcryzed: the 'ref object' vs 'object' depends on your code style and the semantics you need.
22:14:20ephjano, 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:46Araqin general, I advise newbies to use 'ref object' since that's much closer to what Python etc. do
22:14:58cryzedAraq, ephja -- alright, thank you
22:15:37*jakesyl joined #nim
22:15:47*BlaXpirit quit (Quit: Bye)
22:15:48ephjathough I often use ref even though I have certain types that are instantiated only in the main function
22:16:09cryzedI'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:32cryzedephja, alright, I'll go with ref for now until I'm more aware of the advantages of the different semantics
22:16:45AraqAST screams 'ref' ;-)
22:16:57cryzedThen that's what I'll be using if I get that far :)
22:17:18ephjajust because the overhead often isn't significant (dynamic allocation is a lot slower)
22:17:59Araqthough 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:09ephjaAraq: you could always just roll your own stack allocator :p
22:18:40*BlaXpirit joined #nim
22:19:05Araqephja: Nim's allocator uses a bump pointer. not that it helps too much, but still
22:19:06ephjathough the stack size is usually orders of magnitude smaller
22:19:36ephjait's unique to nim?
22:22:05ephjacryzed: https://github.com/fowlmouth/glossolalia
22:22:29ephjathough it might not be that easy to use for newbies, and the documentation is sparse, but it's a neat parser generator
22:22:49cryzedwhat about pegs?
22:23:04cryzedI had just seen that in the docs
22:23:13*makoLine joined #nim
22:23:26ephjaI think it still lacks trees, which greatly limits its usefulness
22:23:54cryzedah
22:24:35cryzedYeah 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:50Araqplease try lexim for the lexer
22:26:10Araqbut I have to admit I never found the time to test it thoroughly
22:26:18Araqbut it's awesome, use it
22:26:44Araqit's as fast as a hand written lexer
22:28:29cryzedI 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:00ephjaAraq: is that the one reason to prefer it over a well-designed parser generator?
22:30:43ephjaanyway, I like the simplicity of it
22:31:48ephjacryzed: nope, sounds perfectly reasonable
22:32:03cryzedAraq, 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:05ephjasome people just can't master a language in 4 hours I guess ;)
22:32:24Araqlexim only builds the lexer for you
22:32:33Araqthe parser and AST are still yours to build
22:32:52*Jesin quit (Quit: Leaving)
22:39:11cryzedI believe you, my point still stands :)
22:39:26cryzedwith the small addition of wanting to write my own lexer -- FOR NOW
22:39:30cryzedI know I sound infantile
22:41:44ephjano, it's a reasonable way to learn
22:44:04cryzedephja, 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:34Araqcryzed: if you want "inspiration" look at docgen/rstast.nim docgen/*.nim
22:47:01cryzedthank you Araq, I will
22:48:50*vendethiel- quit (Ping timeout: 246 seconds)
22:49:17cryzeddocutils, right?
22:50:14cryzedah 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:42cryzedOk 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:54cryzedthe signature looks like it is matching though?
23:23:57cryzedthe lower one that is
23:26:55*kulelu88 quit (Ping timeout: 260 seconds)
23:33:05cryzedah 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:08cryzedthis really should work with nimble
23:42:41*kulelu88 joined #nim
23:46:59*Jesin joined #nim
23:49:19yglukhovAraq, are closure iterators transformed to procs?
23:49:44yglukhovclosure iterators dont work in js :(
23:50:56Araqyeah, but it's "easy" to support for JS
23:51:19Araqyou need to implement how to translate the nkState and nkGoto AST nodes
23:52:11*kniteli quit (Ping timeout: 246 seconds)
23:58:05Araqjust look at what the C codegen does with it and do the same for JS
23:58:25Araqand "the same" means here "oh ffs, JS doesn't support goto"
23:58:59Araqbut 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:53Araqgood night