00:01:08 | * | Cthalupa quit (Ping timeout: 256 seconds) |
00:05:50 | FromDiscord | <Gyllou> what is the prevailing programming paradigm for nim? oop? functional? |
00:06:00 | FromDiscord | <Gyllou> it seems like oop - lite |
00:06:55 | Zoom[m] | I use one paradigm with any language |
00:07:12 | * | Cthalupa joined #nim |
00:07:39 | FromDiscord | <Gyllou> and that is? |
00:07:56 | Zoom[m] | I call it Dysfunctional Programming |
00:08:05 | FromDiscord | <Gyllou> lol idk what i expected |
00:08:13 | FromDiscord | <Rika> Isn't nim considered procedural |
00:08:30 | FromDiscord | <Gyllou> idc that much but im trying to make this thing appealing to use |
00:09:54 | FromDiscord | <Gyllou> @Rika yea i figured as much, seems mostly oop with room to do functional if desired |
00:10:39 | FromDiscord | <Gyllou> idk i like to keep my data types as simple as possible, but chasing immutability end up with alot of copying and that is never good |
00:11:58 | FromDiscord | <Daniel> Nim can probably fit any type |
00:12:11 | FromDiscord | <Gyllou> kk ill probably do something like create a few graph classes and the separate out the algorithms into their own lib |
00:12:24 | Zoom[m] | If you're diligent in your chase you end up with exactly as many copies, as necessary. |
00:12:28 | FromDiscord | <Gyllou> (edit) "the" => "then" |
00:13:03 | FromDiscord | <Gyllou> yea but if you do want zero copy you need to do inplace ops. |
00:14:47 | FromDiscord | <Gyllou> i mean for graphs its a big deal, if you want fast access you can do a matrix, but then you are talking about a storage of O(V V). if you the number of nodes, V is say 1 million, which is not that big, you are looking at 1 million 1 million bits minimum |
00:15:05 | FromDiscord | <Gyllou> and thats for a directed unweighted graph |
00:18:15 | FromDiscord | <Gyllou> for anyone interested though, this lib will have a few flavors of graphs, compressed sparse rows(fastest), adjacency list(smallest), and possibly a hybrid type |
00:19:03 | FromDiscord | <Gyllou> so far i have it implemented with arraymancer, bitvectors and then I'm working on nim standard types implementation |
00:24:08 | PMunch | Ooops, left my IRC open again.. hmmm, if you're reading the logs, yes that is indeed Vim |
00:31:33 | disruptek | gyllou: is there anything published? |
00:36:04 | * | PMunch quit (Quit: leaving) |
00:40:46 | FromDiscord | <exelotl> is there a better way to get the number of values in an enum, besides `ord(MyEnum.high)+1` |
00:48:43 | Zoom[m] | Store the number of elements as the first element 😛 |
00:49:06 | Zoom[m] | Whoops, disregard that |
00:53:15 | FromDiscord | <ElegantBeef> @exelotl that only works if there arent any holes |
00:53:32 | disruptek | fucking holes. |
00:53:47 | disruptek | my idea of a lit friday night. |
00:54:02 | disruptek | exelotl: there's a macro that was pr'd recently. |
00:54:23 | disruptek | or just write your own. it should be like 4 lines with comments and guards. |
00:55:42 | FromDiscord | <ElegantBeef> and if you're really silly, 1 line |
00:56:22 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2ET4 super secure, like all of the guns totally properly stowed in the USA |
01:00:15 | * | vicfred quit (Quit: Leaving) |
01:16:38 | FromDiscord | <exelotl> lol nice |
01:18:19 | FromDiscord | <exelotl> It's fine though I'll just use ord, my enums don't have holes :p |
01:38:52 | * | abm quit (Quit: Leaving) |
01:45:08 | FromDiscord | <Revenant> hello, is `Table[int, ref RootObj]` the best way to store arbitrary objects in a hashmap by some key? `Table[int, ref object]` doesn't compile... I actually don't want inheritance |
01:45:39 | FromDiscord | <Revenant> I always know the type of the object from its key |
01:52:46 | mipri | that if they're completely arbitrary, I guess that works. I'd look to see if I couldn't use a discriminated union instead, or just an object over optional values rather than a table, or at least more constrained common parent |
01:53:57 | FromDiscord | <exelotl> yeah, you'd probably want to use a variant type: https://nim-lang.org/docs/tut2.html#object-oriented-programming-object-variants |
01:54:12 | FromDiscord | <Revenant> yeah they're completely arbitrary, so using object variants would just createa mess |
01:54:20 | FromDiscord | <exelotl> ah, hmm |
01:54:37 | FromDiscord | <Revenant> i'm okay with storing refs, i just find it strange that i have to "enable" inheritance in my objects for this to work |
01:54:56 | FromDiscord | <Revenant> `ref object` would be enough for me, but looks like i can't store them in a table |
01:55:20 | FromDiscord | <Revenant> it has to be `ref RootObj` (or `ref SomeConcreteType`) |
01:55:41 | FromDiscord | <exelotl> ref object has no runtime type info so it would be impossible to convert it to a concrete type safely |
01:56:27 | FromDiscord | <exelotl> that's what RootObj unlocks for you I guess |
01:56:49 | FromDiscord | <Revenant> makes sense |
01:56:50 | FromDiscord | <Revenant> thanks guys |
02:00:23 | FromDiscord | <Gyllou> @disruptek do you mean research published or have i pushed it to github? |
02:00:26 | * | Prestige quit (Quit: Prestige) |
02:01:01 | FromDiscord | <Gyllou> I don't have enough of it fleshed out yet for it to be any use to anyone else yet, ill make the repo public when i do |
02:02:22 | * | hnOsmium0001 quit (Quit: Connection closed for inactivity) |
02:05:04 | * | Prestige joined #nim |
02:07:47 | FromDiscord | <Rika> Famous last words |
02:08:52 | * | hnOsmium0001 joined #nim |
02:11:36 | * | CcxWrk quit (Read error: Connection reset by peer) |
02:14:44 | * | j-james[m] left #nim ("User left") |
02:15:43 | * | CcxWrk joined #nim |
02:19:18 | * | CcxWrk quit (Client Quit) |
02:19:58 | * | CcxWrk joined #nim |
02:24:09 | * | j-james joined #nim |
02:28:31 | * | vicfred joined #nim |
02:29:36 | * | vicfred quit (Max SendQ exceeded) |
02:30:06 | * | vicfred joined #nim |
02:30:12 | * | apahl quit (Ping timeout: 260 seconds) |
02:32:10 | * | apahl joined #nim |
02:35:14 | FromDiscord | <shadow.> `for x in 0..3:` raising `Error: unhandled exception: index out of bounds, the container is empty [IndexDefect]` |
02:35:23 | FromDiscord | <shadow.> i feel like i'm missing something very big... |
02:35:35 | FromDiscord | <shadow.> OH |
02:35:37 | FromDiscord | <shadow.> nvm ik what it is |
02:36:03 | FromDiscord | <shadow.> lol |
02:36:16 | FromDiscord | <Avatarfighter> @ElegantBeef i just read an article that talks about nimscripter |
02:36:25 | FromDiscord | <Avatarfighter> idk if you've seen it yet |
02:36:30 | FromDiscord | <ElegantBeef> Was it rebel's nimplant? |
02:36:35 | FromDiscord | <Avatarfighter> Yes |
02:36:49 | FromDiscord | <Avatarfighter> your library is famous now |
02:36:54 | FromDiscord | <Avatarfighter> in my heart at least |
02:37:00 | FromDiscord | <ElegantBeef> Suffice to say they've been talking to me about it 😄 |
02:37:05 | FromDiscord | <Avatarfighter> ehhe |
02:37:09 | FromDiscord | <Avatarfighter> (edit) "ehhe" => "hehe" |
02:37:29 | FromDiscord | <ElegantBeef> They're the reason it now can run strings as nimscript |
02:37:46 | FromDiscord | <Avatarfighter> ohhh |
02:37:47 | FromDiscord | <Avatarfighter> That's so cool |
02:37:48 | FromDiscord | <Avatarfighter> 😄 |
02:41:02 | * | a_chou joined #nim |
02:49:33 | FromDiscord | <Gyllou> Anybody know why I'm getting a type error here?↵↵https://play.nim-lang.org/#ix=2ETG |
02:53:57 | FromDiscord | <exelotl> you wanna do `name = "test"` instead of `name: "test"` etc. |
02:54:49 | FromDiscord | <exelotl> it's a bit of a language quirk - only the object construction syntax uses colons for field names |
02:55:04 | FromDiscord | <nikki> how hard would it be to make a macro where when you define a proc, it inspects the body and makes the accepted type generic over a concept that has all of those members |
02:55:06 | FromDiscord | <exelotl> regular procedure calls use `=` for named parameters |
02:55:17 | FromDiscord | <Gyllou> dear god im so retarded sometimes |
02:55:18 | FromDiscord | <nikki> bonus points if makes nested concepts too for deeper members |
02:55:25 | FromDiscord | <Gyllou> thanks exelotl |
02:55:33 | FromDiscord | <exelotl> no worries x) |
02:55:37 | FromDiscord | <nikki> basically inferred static structural typing |
02:56:01 | FromDiscord | <nikki> like it just sees what members you use in the body, and puts all of that in a concept |
02:56:29 | FromDiscord | <exelotl> sounds galaxy brain |
02:56:39 | FromDiscord | <nikki> yeah i've run out of brain for now |
02:57:27 | FromDiscord | <nikki> the main thing is, component types in the game are just loading from json -- which is cool for runtime loading, but it'd be nice if it doubled for initialization at other places in the code at compile time too |
02:57:49 | FromDiscord | <nikki> https://github.com/nikki93/ng-public/blob/2418a386df02dac8f1dda40c2b4608fbd69fab59/src/game/feet.nim#L10 |
02:58:46 | FromDiscord | <nikki> maybe this is a bad example tbh, but in another case it was simple properties like sprite depth etc. |
02:59:27 | FromDiscord | <nikki> and if code is initializing a component, i end up just setting the properties but it'd be nice to reuse the json loading logic as initialization logic |
03:00:19 | FromDiscord | <nikki> maybe the simplest improvement for now is to just hash the identifiers at the callsite at compile time, but still use runtime layout |
03:00:59 | FromDiscord | <nikki> idk why `foo["bar"]` on `JsonNode` doesn't just compile time hash, maybe cuz the hash fn used depends on runtime size of the table? idk |
03:04:38 | * | xet7_ joined #nim |
03:06:01 | * | xet7 quit (Ping timeout: 256 seconds) |
04:06:01 | * | supakeen quit (Quit: WeeChat 2.9) |
04:06:36 | * | supakeen joined #nim |
04:24:06 | * | a_chou quit (Quit: a_chou) |
04:35:49 | disruptek | nikki: it can be done, it just hasn't been done yet. |
04:49:00 | * | rockcavera quit (Remote host closed the connection) |
05:23:16 | * | mfx joined #nim |
05:23:32 | * | j-james quit (Quit: Leaving.) |
05:26:15 | * | mfx quit (Remote host closed the connection) |
05:39:16 | * | mbomba joined #nim |
05:43:02 | FromDiscord | <nikki> sweet |
05:43:20 | * | fredrikhr quit (Ping timeout: 256 seconds) |
05:46:28 | FromDiscord | <emekoi> i'm trying to use jsonutil.fromJson but for some reason it seems to be ignore the hooks for converting Option[T]'s |
05:47:55 | * | fredrikhr joined #nim |
05:53:14 | * | j-james joined #nim |
06:12:30 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
07:00:32 | * | narimiran joined #nim |
07:18:36 | * | Prestige quit (Quit: Prestige) |
07:20:50 | * | Prestige joined #nim |
07:31:45 | * | vicfred quit (Ping timeout: 240 seconds) |
07:58:12 | FromDiscord | <Rika> Did you selectively import |
07:58:44 | disruptek | i had no choice. |
07:59:38 | j-james | so i'm trying to parse a html file, locally download all images, and replace the img srcs with local paths |
07:59:53 | j-james | and as such looking at the htmlparser and xmltree libraries |
08:00:21 | j-james | which eventually led me to the XmlNode type |
08:00:56 | j-james | but i can't find documentation on the XmlNode type itself |
08:01:04 | j-james | is there somewhere specific i should be looking? |
08:04:42 | disruptek | there's nothing to know. |
08:05:00 | disruptek | https://nim-lang.org/docs/xmltree.html#XmlNode |
08:05:13 | disruptek | it's an opaque type; no exported fields. |
08:06:03 | j-james | so when the htmlparser example has something like `XmlNode.attrs.hasKey` are those actually methods from somewhere else? |
08:06:11 | FromGitter | <AZ-X> This is a good project https://github.com/nim-lang/pas2nim. How about go2nim? |
08:06:24 | disruptek | that's the attrs proc from xmltree, yes. |
08:06:49 | j-james | i see, thank you |
08:07:27 | disruptek | go2nim won't be useful until csp is ready. |
08:08:01 | disruptek | also, csp looks like it won't be ready until at least 1.8 due to incomplete concepts. |
08:08:27 | disruptek | hopefully, cps for 1.6. hopefully. |
08:10:48 | FromGitter | <AZ-X> Did anybody compare these two project: https://github.com/nim-lang/csources and https://github.com/golang/gofrontend ? I believe if Nim is wide open, it could go far more than go-lang. |
08:13:29 | disruptek | you really think so? |
08:14:07 | FromDiscord | <ElegantBeef> what does "wide open" even mean |
08:15:16 | FromGitter | <AZ-X> > *<disruptek>* you really think so? ⏎ ⏎ Yes, depends on resources involved |
08:18:54 | FromGitter | <AZ-X> > *<FromDiscord>* <ElegantBeef> what does "wide open" even mean ⏎ ⏎ When you are really reading codes, you can feel it 'wide open'. |
08:19:21 | FromDiscord | <ElegantBeef> Yes... i totally dont follow |
08:19:43 | FromGitter | <AZ-X> > *<FromDiscord>* <ElegantBeef> Yes... i totally dont follow ⏎ ⏎ At least, you can try it. |
08:27:42 | FromGitter | <AZ-X> The total time I deal with Nim is an hour reading Nim's website plus 10 minutes reading README of https://github.com/arnetheduck/nlvm. The amazing ten minutes... 'When I started on this little project, I knew neither llvm nor Nim.' It just sound like what I said. Watch this README carefully. |
08:41:50 | * | Vladar joined #nim |
08:45:50 | * | habamax joined #nim |
08:52:00 | * | tane joined #nim |
08:53:01 | * | lum quit (Quit: Lum: Bye!) |
08:55:02 | * | lum joined #nim |
09:02:57 | FromDiscord | <InventorMatt> I am trying to create a fairly complicated macro for generating a proc but i am getting an error for a missing identifier. In theory the macro should compile because it can pass through dumpAstGen just fine. Here is the code https://play.nim-lang.org/#ix=2EV1 . It's not finished yet and any help for soving the error would be appreciated. |
09:04:40 | * | j-james quit (Quit: Leaving.) |
09:04:57 | * | j-james joined #nim |
09:17:12 | * | jjido joined #nim |
09:17:25 | FromDiscord | <Vindaar> @InventorMatt I'm not quite following the whole macro, but a couple of things: 1. I understand correctly that your `main` variable is supposed to be the return value of the macro? 2. are the arguments of the lambda with the slices supposed to be allowed ranges? e.g. `1.0 .. 15.0` should represent a range? 3. your body is not assigned as the body of the `main`. You can use `main.body = procbody`. You add one too many empty nodes before add |
09:17:48 | FromDiscord | <ElegantBeef> I was going to note that it doesnt have a return value |
09:18:04 | FromDiscord | <ElegantBeef> I did `result.repr` and nothing printed, and was confused |
09:18:20 | FromDiscord | <Vindaar> assigning the body correctly still doesn't make it work though, because the ranges are assigned as is as types for the lambda arguments |
09:18:57 | * | mbomba quit (Quit: WeeChat 3.0) |
09:21:15 | FromDiscord | <InventorMatt> for 1. yes main is supposed to go into result but i don't have that set into it for testing purposes. for 2. yes, the slices are supposed to allowed ranges for the parameters. as for 3. early on it was complaining about not having enough empty nodes but I can easily remove those |
09:24:15 | FromDiscord | <Vindaar> oh, one more thing: given that your return value is supposed to be a lambda, it has to be assigned to something. Otherwise you need to turn it into a normal proc |
09:24:41 | FromDiscord | <InventorMatt> changing the empty from 4 to 3 solves that original problem but now it is saying "Error: internal error: environment misses: funcy`gensym22" I've also fixed the assigning part as well |
09:24:47 | FromDiscord | <Vindaar> and I was wrong about the range type, apparently writing `proc foo(x: 0.0 .. 10.0)` is valid, I wasn't aware of that |
09:26:00 | FromDiscord | <InventorMatt> here is the new code with those fixes and the new error https://play.nim-lang.org/#ix=2EVd |
09:28:40 | FromDiscord | <Vindaar> this compiles: |
09:28:41 | FromDiscord | <Vindaar> https://play.nim-lang.org/#ix=2EVf |
09:29:56 | FromDiscord | <Vindaar> oh |
09:30:03 | FromDiscord | <Vindaar> I screwed up a bit, haha |
09:31:15 | * | lum quit (Quit: Lum: Bye!) |
09:31:54 | * | lum joined #nim |
09:36:37 | * | lum quit (Client Quit) |
09:37:24 | * | lum joined #nim |
09:42:45 | FromDiscord | <InventorMatt> for some odd reason with yours it is giving it an empty parameters node even though the parameter node is full before it added |
09:44:36 | FromDiscord | <Vindaar> sorry, my code has a few problems there. give me a few more minutes |
09:48:52 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
09:49:21 | FromDiscord | <Vindaar> here you go now: https://play.nim-lang.org/#ix=2EVi |
09:49:34 | FromDiscord | <Vindaar> I think I noted all the changes I made, but might have forgotten some |
09:50:33 | FromDiscord | <Vindaar> notable ones: ↵1. correct number of empty nodes for lambda in beginning (3 instead of 4)↵2. quote the `lower` and `upper` nodes ↵3. and the aforementioned assignment to a variable |
09:51:33 | FromDiscord | <Vindaar> oh and changing the gensym logic a bit |
09:51:58 | FromDiscord | <InventorMatt> awesome that seems to be working now. thank you so much |
09:52:28 | FromDiscord | <Vindaar> You're very welcome! Thanks for the morning macro fun 🙃 |
09:54:41 | FromDiscord | <InventorMatt> now I can do the the fun part of actually generating the fuzzy controller logic for the proc |
09:59:51 | FromDiscord | <Vindaar> Sounds cool. Feel free to ping me when you're done with it and have an example showing what it's really supposed to do! |
10:01:08 | FromDiscord | <InventorMatt> will do. |
10:02:22 | * | hnOsmium0001 quit (Quit: Connection closed for inactivity) |
10:02:27 | * | bouzu_ joined #nim |
10:25:37 | * | narimiran quit (Ping timeout: 260 seconds) |
10:26:48 | ForumUpdaterBot | New thread by Satoru: How to differentiate different IOErrors?, see https://forum.nim-lang.org/t/7133 |
10:28:21 | * | narimiran joined #nim |
10:29:00 | * | NimBot joined #nim |
10:51:29 | * | jjido joined #nim |
10:51:44 | * | hmmm joined #nim |
10:55:25 | j-james | What's best practice for downloading a file from a url? |
10:58:54 | j-james | whoops, nvm |
11:14:19 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
11:39:29 | FromGitter | <HJarausch_gitlab> inim : how to outdent? E.g., having entered a multiline proc definition (e.g. https://play.nim-lang.org/#ix=2EW1 ) I cannot return to indent 0 which implies I cannot enter a proc at all. What am I missing |
11:46:38 | j-james | HJarausch: It looks like your proc isn't returning an int |
11:47:14 | * | audiofile joined #nim |
11:47:29 | audiofile | hello looking for crossplatform gui framework fr nim -- windows and linux |
11:47:34 | audiofile | hm? |
11:48:08 | audiofile | found nigui anyoneo confirm if work? |
11:48:13 | j-james | HJarausch: You might want to either remove the `: int` before the = or just type `result` on line 8 |
11:48:46 | audiofile | or i dont mind web app either |
11:48:49 | audiofile | anything fine :) |
11:49:05 | j-james | audiofile: Two native options are NiGui and nim-lang/ui |
11:49:18 | audiofile | thanks james |
11:50:18 | j-james | Try `nimble search gui` for more options, I know there's a fair number of web-based packages |
11:51:40 | audiofile | oh wow there are many entries! |
11:51:48 | audiofile | looks like many ppl taking attempt at making gui libs for nim |
11:52:09 | audiofile | what do I do to search for the web oens you mentioned |
11:54:33 | * | hmmm quit (Ping timeout: 260 seconds) |
11:55:10 | j-james | they usually mention "web" or have it as a tag |
11:55:16 | * | narimiran quit (Ping timeout: 240 seconds) |
11:56:05 | audiofile | gotcha thanks. also anything akin to beautifulsoup from python for web scraping? |
11:56:19 | audiofile | or does nim have something in stdlib to parse html |
11:57:44 | audiofile | nvm I think 'htmlparser' will do the job xD |
12:06:01 | * | supakeen quit (Quit: WeeChat 2.9) |
12:06:36 | * | supakeen joined #nim |
12:07:45 | * | bouzu_ quit (Quit: Leaving) |
12:10:06 | * | PMunch joined #nim |
12:17:10 | * | hmmm joined #nim |
12:17:10 | * | hmmm quit (Client Quit) |
12:21:32 | audiofile | does allowing compiler to infer type of a variable make it slower? |
12:28:17 | * | apahl quit (Ping timeout: 272 seconds) |
12:28:45 | * | apahl joined #nim |
12:28:54 | * | jjido joined #nim |
12:29:49 | FromDiscord | <haxscramper> Even if it does, I would advise to not think about this too much |
12:29:57 | * | j-james quit (Quit: Leaving.) |
12:30:28 | * | clyybber joined #nim |
12:33:05 | audiofile | ok! probably too trivial |
12:33:22 | audiofile | btw what's the idea behind having to 'discard' values unused from a function return value |
12:33:32 | audiofile | other programming languages just silently do it |
12:33:38 | audiofile | s/idea/reasoning |
12:33:56 | FromDiscord | <haxscramper> You don't want to drop return codes for example |
12:34:31 | FromDiscord | <haxscramper> For C-like error handling. Or if you want to have `Result[E, V]` this is also useful |
12:35:10 | * | hmmm joined #nim |
12:35:40 | FromDiscord | <haxscramper> It is just for reducing bugs mostly - if you don't need a value then show it explicitly (because my assumption is that you need values most of the time, so discarding them is a none-standard situation) |
12:36:05 | audiofile | ah, that makes much more sense now, thanks for explaniign! |
12:36:24 | FromDiscord | <haxscramper> And need to be indicated explicitly. Although you can use `{.discardable.}` on proc so you can omit `discard`. |
12:36:48 | audiofile | is that a 'macro'? |
12:37:09 | FromDiscord | <haxscramper> No, it is a pragma - https://nim-lang.org/docs/manual.html#statements-and-expressions-discard-statement |
12:38:22 | * | gmaggior joined #nim |
12:41:47 | audiofile | thanks! |
12:42:07 | audiofile | just noticed there's a 'future' module. will stuff from that be merged into stdlib eventually |
12:42:13 | audiofile | I mean the standard namespace |
12:42:36 | audiofile | like how in python2 you do from future import __print__ (I think) but not in python3 |
12:44:53 | FromDiscord | <haxscramper> Actually I think it was deprecated and superseded by `std/sugar`. And list comprehension macro was replaced by `std/sugar.collect` |
12:45:33 | audiofile | oh! |
12:45:35 | audiofile | major changes |
12:50:59 | Zoom[m] | audiofile: what codec are you? |
12:51:32 | FromGitter | <HJarausch_gitlab> j-james: That doesn't help. E.g. proc T(x:int) : int = ⏎ if x == 0 : ⏎ ⏎ ``` result= x-1``` [https://gitter.im/nim-lang/Nim?at=5fb90d546697c7481f1ac1d7] |
12:51:46 | audiofile | on sad days im an ogg and on days when im a bit frisky, im a flac Zoom[m] B) |
12:52:15 | FromGitter | <HJarausch_gitlab> j-james: I just cannot "return" to no indentation |
12:52:32 | Zoom[m] | audiofile: not too bad, at least you're not windows media |
12:52:45 | audiofile | :P |
12:53:31 | FromGitter | <haxscramper> @HJarausch_gitlab https://play.nim-lang.org/#ix=2EWu |
12:54:04 | FromGitter | <haxscramper> Is it close to what you wanted? |
12:59:01 | FromGitter | <HJarausch_gitlab> @haxscramper It is not a question about Nim. Probably I'm missing something really simple. Using INIM, I just can't enter anything at column 0 or 1 like line 7 in your example. |
13:01:23 | FromDiscord | <Rika> HJarausch you can't dedent? |
13:01:29 | FromDiscord | <haxscramper> To decrease indentation just enter empty line. Everything else is the same as regular editor |
13:02:08 | FromGitter | <haxscramper> E.g you would need to type ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5fb90fd02cb422778f2bf183] |
13:02:29 | FromGitter | <haxscramper> Notice empty lines after each `result` |
13:06:02 | * | ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
13:06:33 | FromGitter | <HJarausch_gitlab> @haxscramper Yes, thanks. I've missed that additional empty line. |
13:08:37 | * | rockcavera joined #nim |
13:09:52 | * | abm joined #nim |
13:12:28 | * | hmmm quit () |
13:19:41 | * | lum quit (Quit: Lum: Bye!) |
13:22:39 | * | lum joined #nim |
13:27:05 | ForumUpdaterBot | New thread by AlectronikHQ: Error: type mismatch: got <type int8> but expected 'int literal(8)', see https://forum.nim-lang.org/t/7134 |
13:28:18 | FromDiscord | <potatnado> anyone free that dont mind me pming them to ask about their experience with programming? |
13:42:41 | * | rockcavera quit (Remote host closed the connection) |
13:45:36 | FromDiscord | <lqdev> don't ask to ask |
14:04:26 | * | ehmry joined #nim |
14:09:35 | * | lbart quit (Ping timeout: 256 seconds) |
14:11:18 | * | lbart joined #nim |
14:11:18 | * | lbart quit (Changing host) |
14:11:18 | * | lbart joined #nim |
14:19:29 | * | ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
14:29:37 | * | waleee-cl joined #nim |
14:50:45 | * | abm quit (Quit: Leaving) |
14:57:20 | * | ehmry joined #nim |
15:31:03 | FromGitter | <deech> I get this isn't an issue from a calling convention perspective but is there a utility that changes snake case identifiers to camel case? |
15:31:13 | audiofile | what is taintedstring |
15:31:51 | audiofile | can I not check if a variable is empty by doing `if not <var>` |
15:32:34 | mipri | not inverts a boolean. zero-length sequences, if that's what you mean by empty, aren't false. |
15:33:48 | mipri | TaintedString is https://en.wikipedia.org/wiki/Taint_checking . if you don't turn it on, it's the same thing as string |
15:34:15 | audiofile | interesting |
15:34:19 | mipri | you can support it by explicitly .string'ing a TaintedString type when it should be safe to use |
15:34:31 | audiofile | first time encountering it! btw can I also not concatenate multiple strings like a & b & c? |
15:34:43 | audiofile | .string sounds handy |
15:34:46 | mipri | there's no runtime cost to that, with or without tainting turned on, but doing it allows your code to work with taint checking |
15:35:00 | mipri | !eval echo "a" & "b" & "c" |
15:35:06 | NimBot | abc |
15:35:17 | audiofile | oh er...a b c are strings I should clarify |
15:35:43 | audiofile | !eval let a="abc";let b="bcd"; let c="cde"; echo a & b & c |
15:35:45 | NimBot | abcbcdcde |
15:35:50 | audiofile | hm |
15:35:57 | * | audiofile scratches head |
15:36:29 | audiofile | if name == '': "One for you, one for me." else: "One for " & name & " , one for me." |
15:36:38 | audiofile | something wrong here? |
15:36:44 | mipri | no |
15:36:48 | audiofile | also if there's a better way of checking for empty string lmk! |
15:37:02 | PMunch | Uhm |
15:37:06 | PMunch | There is something wrong there |
15:37:15 | PMunch | '' is a character literal, and they can't be empty |
15:37:15 | audiofile | name in that if-else thingy? |
15:37:18 | PMunch | Try using "" instead |
15:37:19 | FromDiscord | <haxscramper> audiofile: in what context you encountered the tainted string? Like it was return value for some proc or you found it in manual? |
15:37:20 | audiofile | oh |
15:37:28 | PMunch | Or check if len == 0 |
15:37:46 | FromDiscord | <haxscramper> Or someone mentioned it on forum etc. |
15:37:51 | PMunch | So if name.len == 0: |
15:37:51 | audiofile | hax, I did a `if not name` |
15:38:02 | audiofile | thanks |
15:38:43 | audiofile | that automatic last expression returning mechanism....does that work outside of proc's? |
15:38:52 | PMunch | Yes |
15:38:54 | audiofile | like if I want to return something at the end of a program is it okay to leave the expression dangling |
15:38:58 | audiofile | oh! |
15:39:03 | PMunch | https://peterme.net/tips-and-tricks-with-implicit-return-in-nim.html |
15:39:10 | PMunch | Ah, not at the end of a program |
15:39:24 | audiofile | even with variable named 'result'? |
15:40:47 | PMunch | Yeah, the program as such doesn't have a return variable |
15:40:59 | PMunch | I mean you have an exit code |
15:41:18 | audiofile | oh hmm that's not whaht I'm looking for i think |
15:41:35 | mipri | that URL just loads to "page not found" for me |
15:42:06 | audiofile | um loads for me |
15:42:19 | audiofile | pete's devlog rite? |
15:42:42 | mipri | yeah, it's fine. my terminal managed to cut off the .html |
15:43:53 | audiofile | I can use stdin.readLine without importing stdin first? |
15:44:17 | mipri | it comes with the 'system' module |
15:44:25 | audiofile | ...which is autoimported? |
15:44:29 | mipri | yes. |
15:44:32 | audiofile | hm |
15:44:59 | audiofile | could someoene tell me what is the indentation error here? http://vpaste.net/03uJa?bg=dark&nu |
15:45:13 | audiofile | compiler says it's in L#3 |
15:45:38 | mipri | you want a = instead of a : on line 1 |
15:45:56 | mipri | general syntax errors tend to get reported as 'indendation errors' |
15:46:13 | audiofile | oh wow |
15:46:32 | audiofile | that's like going to the doc for a fever and he treats someone else and you get cured |
15:48:15 | mipri | https://play.nim-lang.org/#ix=2EXO works as a pastebin with Nim syntax highlighting and compilation |
15:48:42 | audiofile | yeah sorry about that |
15:48:53 | audiofile | have to write some vimscript to push to that instead |
15:49:33 | audiofile | is there any way I can manually import 'stdin'? |
15:49:38 | audiofile | like explicitly |
15:50:38 | mipri | realistically, no. |
15:50:53 | mipri | but you can suppress importing system by importing from it explicitly |
15:51:01 | mipri | and you can import nothing by default with 'from system import nil' |
15:51:50 | mipri | if you're asking this because you want to avoid a conflict with system.stdin, you can exclude just that as well, 'import system except stdin' |
15:52:17 | audiofile | oh sweet, looks lilke the import system is pretty exhaustive! |
15:53:40 | mipri | it has a few extra features like that yeah |
15:56:52 | audiofile | I have a twoFer proc in my two_fer.nim and two_fer_test.nim imports two_fer and calls twoFer() but it gets 'undeclared identifier'...what gives |
15:57:26 | mipri | no idea. what's the error? |
15:58:10 | audiofile | Error: undeclared identifier: 'twoFer' |
15:58:30 | mipri | ok, are you sure two_fer.nim is exporting that? |
15:58:38 | audiofile | ohhhh |
15:58:56 | mipri | that's another difference from Python |
15:59:07 | mipri | put a * after the proc name to mark it as exported |
16:00:56 | FromGitter | <HJarausch_gitlab> I have to say var T = tuple[a:int,b:int,b:int]. Why can't I omit the the labels 'a','b','c'? I can access the fields as T[0], etc anyway |
16:01:34 | mipri | if you don't want them you can have a 'var T: (int, int, int)' instead |
16:02:26 | FromGitter | <HJarausch_gitlab> Thanks, that's nice |
16:11:50 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
16:21:04 | audiofile | any way to have everything exported |
16:26:27 | * | natrys joined #nim |
16:26:48 | * | jjido joined #nim |
16:28:02 | FromGitter | <HJarausch_gitlab> How to advance an iterator (similar to 'next' in Python). Sometime I want to skip a line before entering a `for l in File.lines` and sometime I want to skip a line within such a loop. Is there something like 'next' in Python |
16:28:35 | mipri | 'continue' |
16:28:50 | mipri | audiofile: no. |
16:29:01 | audiofile | :'( |
16:29:28 | FromGitter | <HJarausch_gitlab> `continue` won't work before, i.e. outside, a loop |
16:29:40 | audiofile | ah |
16:29:57 | mipri | in a pinch, if you don't want to bother with modules, you can 'include' stuff instead of importing it |
16:29:58 | audiofile | you mean the consumption of cycles in an iterator without actually iterating right |
16:30:16 | audiofile | oh! include != import??? |
16:30:25 | audiofile | damn, nim has a lot of stuff |
16:30:37 | mipri | include is like C's #include. |
16:30:54 | FromGitter | <HJarausch_gitlab> @audiofile yes, consume a cycle (i.e. continue won't work( |
16:30:56 | mipri | but bothering with modules gives you a lot, at the cost of typing * when you want something to be exported |
16:31:18 | mipri | for example cycle breaks down but import can deal with cycles to an extent |
16:31:24 | audiofile | export sounds like the python's package export stuff at top level in the __init__.py file |
16:31:46 | audiofile | HJarausch sorry im nto too familiar with nim but I understand what youre tryna do |
16:32:31 | mipri | Nim's iterators are macros rather than objects with methods, so no they don't have what you're looking for. you might toSeq them and work with that. |
16:32:52 | disruptek | !repo cps |
16:32:52 | disbot | https://github.com/disruptek/cps -- 9cps: 11Continuation-Passing Style for Nim 🔗 15 40⭐ 2🍴 |
16:33:11 | audiofile | child protection services |
16:33:15 | FromGitter | <HJarausch_gitlab> Here is a Python example ⏎ Inp= open("data") ⏎ next(Inp) ⏎ for L in Inp : ⏎ if L.startswith('#") : ... [https://gitter.im/nim-lang/Nim?at=5fb9414b2cb422778f2c6c0d] |
16:33:22 | FromDiscord | <haxscramper> https://nim-lang.org/docs/manual.html#iterators-and-the-for-statement-first-class-iterators |
16:34:27 | FromDiscord | <haxscramper> Closure iterators have `next` and `finished` |
16:34:52 | disruptek | finished is pretty lousy, though. |
16:35:13 | mipri | and as a rule you should avoid the need for .next() rather than switch from inline to closure iterators. |
16:35:15 | disruptek | fine for toys, not suitable for production. |
16:35:22 | * | vicfred joined #nim |
16:35:25 | FromDiscord | <haxscramper> But for this particular use case you would porbably want to just use `continue` and `lines` |
16:35:25 | audiofile | this Ref version of objects is pretty confusing to me...why have a separate version of the objects instead of a keyword like how C does call by ref with & |
16:35:49 | disruptek | refs aren't limited to objects. |
16:35:58 | audiofile | oh um |
16:36:19 | audiofile | I see stuff in the docs like CounterTable and CoutnerTableRef |
16:36:24 | audiofile | stuff like dat ^ |
16:36:58 | mipri | Nim's more like C++ than C. Value semantics, reference semantics, move semantics, copy elision, etc. Strings and seqs have value semantics for example in Nim. In C you're always moving register contents around. |
16:38:30 | mipri | so 'ref object' gives you reference semantics instead of the default of value semantics. in C there are a small number of value types that fit into registers, and you can't create a new value type. |
16:38:59 | audiofile | i thought i knew a fair bit of cpp but looks like that's not the case...'move semantics and copy elision' have me lost! |
16:39:07 | FromGitter | <HJarausch_gitlab> @mipri Avoid 'next' forces me to flags which carry information from one loop pass to the next. I don't like this assembler type style. |
16:39:19 | mipri | the downside of this is that it encourages lots of little copies, blitting some bytes around on an assignment or a parameter call instead of passing a register. the upside is that this is generally a lot faster than the alternative on modern CPUs. |
16:39:21 | disruptek | use cps. |
16:39:21 | audiofile | By strings and seqs having value semantics you mean when I do a = b, a copy is created? |
16:39:29 | mipri | yes. |
16:39:54 | audiofile | taht's itneresting, since python has reference for 'lists'! |
16:40:02 | audiofile | always a gotcha in pyton there |
16:40:38 | * | Vladar quit (Quit: Leaving) |
16:40:56 | audiofile | btw why is the 're' module an impure one...can't we have one written purely in nim? |
16:41:07 | PMunch | Yes, we can, and we do |
16:41:17 | PMunch | https://github.com/nitely/nim-regex |
16:41:33 | mipri | *shrug*, if you really want .next you can get it as others have said. I would look first at .toSeq |
16:41:41 | audiofile | oh sweet! so will this be replacing the current re module sometime in the future? |
16:41:57 | disruptek | probably. |
16:42:01 | mipri | no, it's not compatible and it's not necessarily better. it's trivial to use when you want it. |
16:42:24 | disruptek | the same can be said for the non-native one. |
16:42:40 | audiofile | https://imgur.com/a/cS638Xi :) |
16:42:46 | disruptek | the difference is that it requires extra dlls on windows. |
16:42:57 | disruptek | the complexity is not worthwhile, imo. |
16:43:11 | audiofile | so this regex matching at compile-time. is that only available with nim-regex? |
16:43:21 | disruptek | yes. |
16:43:21 | mipri | yeah, I've switched from 're' to 'regex' in some cases for no other reason to avoid deployment of pcre. And not even on Windows, but just on Unix systems where Nim's re complained. |
16:43:33 | ForumUpdaterBot | New thread by Mildred: Tables.add() deprecation in favor of []= is wrong, see https://forum.nim-lang.org/t/7135 |
16:43:50 | disruptek | i just don't use regex. |
16:43:55 | audiofile | dude what |
16:44:03 | audiofile | why wouldnt you want more problems??? |
16:44:32 | mipri | but PCRE generally handily beats nim-regex except on artificial benchmarks. |
16:44:36 | disruptek | i can't pay my phone bill. this is really not something i'm going to fix. |
16:44:51 | FromGitter | <HJarausch_gitlab> @mipri `toSeq` doesn't work for files, and reading the whole file into memory just for that reason isn't a good solution |
16:45:12 | mipri | yeah obviously it's not going to work in all cases ever. I said I would look first at it. |
16:45:56 | * | habamax quit (Ping timeout: 240 seconds) |
16:46:22 | disruptek | favor explicit control flow over continue. |
16:46:27 | disruptek | it's smelly. |
16:49:02 | audiofile | so...help me undersstand this. by c library bindings do you mean i cna use any c library in nim? |
16:49:59 | mipri | that's a weird emphasis. Makes me want to say "no, you can't use libraries that don't exist yet." |
16:50:14 | audiofile | huh? |
16:50:36 | audiofile | wdym |
16:50:54 | mipri | obviously there are practical limits on the C libraries that you can use. They have to exist. You need to have some information about them. If the library only works on a Cray and you don't have a Cray you're going to have a bad time. |
16:51:10 | audiofile | ??????? |
16:51:22 | audiofile | this some schrodinger shit |
16:51:38 | mipri | you're the one asking the weird question. Why do you think there would be some class of usable vs. unusable C libraries? |
16:51:54 | audiofile | um where did I say that |
16:52:20 | mipri | yes, you can use any C library in Nim. |
16:52:40 | audiofile | it's late night and I can't grok what youre driving at...i will try to read what you said tomorrow |
16:53:48 | * | habamax joined #nim |
16:54:44 | mipri | for the FFI I'd start at https://nim-lang.org/docs/manual.html#foreign-function-interface |
16:55:49 | mipri | Nim has some slightly unusual abilities like being able to #include a C header and then import #define'd values by name, without having to put "const DubiouslyPortableThing = 2" in your source code, but people generally do that anyway. |
16:55:51 | FromDiscord | <exelotl> I don't know of any C library that can't be wrapped by Nim |
16:57:32 | FromDiscord | <exelotl> but you could probably construct a C library that has weird semantics by abusing preprocessor macros |
16:57:50 | FromDiscord | <exelotl> and then using that library in Nim would possibly be awkward and unpredictable |
16:58:32 | mipri | oh you could easily make something incompatible. Just stomp use symbols that Nim would need, like NimMain |
16:58:35 | FromGitter | <HJarausch_gitlab> What on earth is a `tainted string`. Nim doesn't accept ⏎ ⏎ #Inp= open(....) ⏎ ⏎ let ln = Inp.readLine[1..^] # for skipping the first char of a line ... [https://gitter.im/nim-lang/Nim?at=5fb9473b0451324f1529267e] |
16:58:44 | PMunch | Or one that just checks for some Nim defines with the pre-processor to intentionally make it behave weird when imported into a Nim project :P |
16:59:52 | mipri | if you turn tainting on, a TaintedString is exactly the same thing as a string. it's not distinct, it's literally another name for string. Since you don't know what tainting is you haven't turned tainting on and you don't have anything but a string there. It just shows up differently. |
17:00:01 | mipri | if you *don't* turn on tainting on |
17:01:08 | mipri | !eval echo "hello"[1..^1] |
17:01:11 | NimBot | ello |
17:01:37 | mipri | !eval echo typeof(^1) |
17:01:39 | NimBot | BackwardsIndex |
17:01:57 | mipri | that "1..^" might be your problem |
17:02:09 | * | audiofile quit (Quit: Default Quit Message) |
17:03:34 | FromGitter | <HJarausch_gitlab> So, I have to write |
17:04:37 | FromGitter | <HJarausch_gitlab> So, I have to write ⏎ let LN = Inp.readLine ⏎ echo LN[1..<(len(LN))] ⏎ Isn't there some prettier? [https://gitter.im/nim-lang/Nim?at=5fb948a529cc4d7348221ba0] |
17:05:22 | mipri | !eval echo ("hello"[1..^1], "hello"[1..<len("hello")]) |
17:05:24 | NimBot | ("ello", "ello") |
17:06:12 | FromGitter | <HJarausch_gitlab> Yes, it works just fine with a string constant or variable but not with the result of readLine |
17:06:25 | mipri | why would you think that? |
17:06:39 | mipri | you have |
17:06:46 | mipri | gah, terminal messed up there. |
17:06:51 | mipri | you have [1..^], not [1..^1] |
17:09:12 | FromGitter | <HJarausch_gitlab> Oh, I see! Thanks. |
17:11:21 | disruptek | we can talk about balls now, if you want. |
17:14:28 | * | narimiran joined #nim |
17:16:30 | * | gmaggior quit (Quit: Leaving) |
17:16:47 | * | PMunch quit (Quit: leaving) |
17:16:51 | Prestige | disruptek: how many? |
17:18:55 | * | natrys quit (Ping timeout: 246 seconds) |
17:22:04 | * | Vladar joined #nim |
17:26:44 | * | a_chou joined #nim |
17:28:56 | * | xet7_ is now known as xet7 |
17:37:38 | disruptek | how many do you need? |
17:42:32 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
17:48:51 | * | Northstrider[m] quit (Disconnected by services) |
17:48:58 | * | Northstrider[m] joined #nim |
17:50:07 | * | Northstrider[m] quit (Disconnected by services) |
18:00:34 | * | Jesin quit (Quit: Leaving) |
18:08:55 | * | Jesin joined #nim |
18:17:46 | ForumUpdaterBot | New thread by Snej: Article on writing hacking tools in Nim, see https://forum.nim-lang.org/t/7136 |
18:29:35 | * | jjido joined #nim |
18:42:49 | * | hnOsmium0001 joined #nim |
18:45:26 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
19:01:05 | FromDiscord | <exelotl> https://media.discordapp.net/attachments/371759389889003532/779783459031220234/hacking-in-progress.gif |
19:06:23 | * | opal quit (Ping timeout: 240 seconds) |
19:07:11 | FromDiscord | <Quibono> Can someone l337 explain to me what an implant is in this context? |
19:07:35 | * | opal joined #nim |
19:19:16 | * | jjido joined #nim |
19:23:27 | * | j-james joined #nim |
19:39:04 | * | bung joined #nim |
19:41:09 | * | j-james quit (Quit: Leaving.) |
19:46:16 | * | j-james joined #nim |
19:54:28 | * | a_chou quit (Quit: a_chou) |
20:00:21 | * | habamax quit (Ping timeout: 256 seconds) |
20:09:08 | * | L[m] joined #nim |
20:13:03 | * | Jesin quit (Quit: Leaving) |
20:26:06 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
20:30:24 | * | Jesin joined #nim |
20:32:26 | * | jjido joined #nim |
20:40:29 | mipri | 99% synonymous with "software" |
20:58:47 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
21:02:53 | * | narimiran quit (Ping timeout: 260 seconds) |
21:13:24 | * | jjido joined #nim |
21:24:56 | * | aaronm quit (Ping timeout: 240 seconds) |
21:34:12 | * | aaronm joined #nim |
21:38:39 | * | lritter joined #nim |
21:50:16 | * | Vladar quit (Quit: Leaving) |
22:07:19 | * | jjido quit (Quit: Textual IRC Client: www.textualapp.com) |
22:24:53 | * | aaronm quit (Ping timeout: 272 seconds) |
22:35:23 | FromDiscord | <Gyllou> method getNeighbors(this: Graph): void{.base.} = discard is this an idiomatic way to declare a method of an abstract base class? |
22:36:21 | FromDiscord | <Gyllou> is there a classy-er way to do this |
22:38:11 | FromDiscord | <ElegantBeef> using `: void` isnt very idiomatic, but that's the way, you may want an `{.error: "Implement this method".}` instead of discard, or just an echo to inform you that method isnt impl for derived classes |
22:38:20 | FromDiscord | <nikki> i would rename "this" "graph" instesd |
22:38:32 | FromDiscord | <nikki> it's nice to just see what ur talking about in the method body |
22:38:39 | FromDiscord | <nikki> graph.foo |
22:38:48 | FromDiscord | <Gyllou> okay gotcha |
22:39:18 | FromDiscord | <Gyllou> should i bother making a base class? |
22:39:31 | FromDiscord | <Gyllou> ive got 4 different graph implmentations right now |
22:39:37 | FromDiscord | <ElegantBeef> If you're inheriting and wanting to overide methods, yes |
22:39:45 | FromDiscord | <Gyllou> (edit) "implmentations" => "implentations" |
22:40:00 | FromDiscord | <nikki> could also consider making a concept, and then you have static dispatch if some algo is generic over graph type |
22:40:16 | FromDiscord | <nikki> like, do you actually need / want dynamic dispatch? |
22:40:17 | FromDiscord | <Gyllou> okay i wasn't sure how strictly nim standards adhere to oop |
22:40:46 | FromDiscord | <Gyllou> im not familiar with concepts |
22:41:09 | FromDiscord | <Gyllou> ill hafta google them, what are they similar to? |
22:41:29 | FromDiscord | <Gyllou> i am not a huge proponent of oops but i want this lib to be useful for other people |
22:41:43 | FromDiscord | <Gyllou> (edit) "oops" => "oop" | "people" => "people, and they might expect dynamic dispatch" |
22:41:53 | FromDiscord | <nikki> why not just have the 4 graph data structures |
22:41:57 | FromDiscord | <nikki> and people can use whichever one they want |
22:42:03 | FromDiscord | <nikki> why do u need / want a base class or w/e |
22:42:04 | FromDiscord | <Gyllou> hey im fine with that |
22:42:09 | FromDiscord | <nikki> seems fine then |
22:42:17 | FromDiscord | <Gyllou> the only reason would be then interacting with the graph algos |
22:42:25 | FromDiscord | <nikki> if you have algos in the lib too that are generic over graphs then that may make sense |
22:42:28 | FromDiscord | <nikki> to have a graph concept |
22:42:46 | FromDiscord | <Gyllou> yea that was my thinking, those are the hard part anyways |
22:43:05 | FromDiscord | <Gyllou> is a concept like an interface? |
22:43:32 | FromDiscord | <Gyllou> oh they are like cpp concepts |
22:43:34 | FromDiscord | <nikki> https://nim-lang.github.io/Nim/manual_experimental.html#concepts |
22:43:44 | FromDiscord | <nikki> the thing they are most like is nim concepts |
22:44:10 | FromDiscord | <nikki> concepts are new enough in c++ and nim that it makes sense to just pick up nim's particular semantics for them i think |
22:45:09 | FromDiscord | <Gyllou> i will look through that then and maybe ill use concepts for the graphs |
22:45:31 | FromDiscord | <Gyllou> i dont want to have multiple implementations of graph algos |
22:45:32 | FromDiscord | <nikki> i would say to think about it in terms of the algos |
22:45:36 | FromDiscord | <nikki> instead of of the graph data structures |
22:45:45 | FromDiscord | <nikki> like, for a particular algo that is generic, what is it looking for |
22:45:54 | FromDiscord | <nikki> and keep the data structures themselves as concrete as possible and just the concrete ones |
22:46:04 | FromDiscord | <nikki> interfaces seem good when close to their usage, vs their implementors |
22:46:17 | FromDiscord | <nikki> which is why i was asking if there was algos in the lib (if not, then it seems like you don't need an interface-like thing) |
22:46:25 | FromDiscord | <Gyllou> yea there are |
22:46:35 | FromDiscord | <nikki> what do they look like |
22:46:37 | FromDiscord | <Gyllou> im implementing gpu based graph algos |
22:46:49 | FromDiscord | <nikki> like do they take a graph and a function and run it over elems etc. or such |
22:47:24 | FromDiscord | <Gyllou> ive only made naive one so far to get a feel for what data structure api i need |
22:47:34 | FromDiscord | <Gyllou> but most like yea, about like that |
22:47:48 | FromDiscord | <nikki> yeah it makes sense to continue that experiment and make a few more, and see what interface each one is looking for on its own |
22:47:53 | FromDiscord | <nikki> then maybe you'll see some patterns emerge |
22:48:13 | FromDiscord | <nikki> mostly it seems like you need static dispatch tho right |
22:48:15 | FromDiscord | <Gyllou> kk, yea i have basic stuff, like get/remove/getneighbors etc |
22:48:31 | FromDiscord | <nikki> like it's not like some algo takes a list of graphs, and each graph backed by a different data structure <-- that's when you need virtual dispatch haha |
22:48:33 | FromDiscord | <Gyllou> possibly it just depends on how slick i am with the api |
22:48:37 | FromDiscord | <nikki> or a graph is loaded from a dll or sth... lol |
22:49:10 | FromDiscord | <Gyllou> thats probably actually how im going, the data structures are done in nim though, save for using arraymancer |
22:49:24 | FromDiscord | <Gyllou> which, i think has a lot of cpp interop of something |
22:49:48 | FromDiscord | <Gyllou> the datastructures were important for me because of the size of our graphs are ridiculous |
22:49:53 | FromDiscord | <Gyllou> (edit) "datastructures" => "data structures" |
22:50:40 | FromDiscord | <Gyllou> ill take a look at concepts and play around with some more algos and see what i need |
22:50:51 | FromDiscord | <Gyllou> its going to be a bit of fiddling here then there sort of deal |
22:51:20 | FromDiscord | <nikki> cool. i'm guessing you make a ton of calls to eg. .getNeighbors in every step of some algo for example. it's nice if those are statically dispatched instead of dynamically |
22:51:26 | FromDiscord | <Gyllou> this is a dependency for alot of other things in our project right now though |
22:51:45 | FromDiscord | <Gyllou> thats kinda what i figured, this is an hpc lib |
22:52:07 | FromDiscord | <Gyllou> needs to be slick, but that doesnt happen over night. I dont want to shoot myself in the foot though early on |
22:52:19 | FromDiscord | <nikki> ya just focus on having a good time |
22:52:23 | FromDiscord | <nikki> if you have a good time |
22:52:25 | FromDiscord | <nikki> it'll all work out |
22:52:31 | FromDiscord | <Gyllou> lol good rule of thumb |
22:52:46 | FromDiscord | <Gyllou> thanks! |
22:59:57 | FromDiscord | <nikki> https://media.discordapp.net/attachments/371759389889003532/779843569199743036/simplescreenrecorder-2020-11-21_14.59.23.mp4 |
23:00:18 | FromDiscord | <nikki> got vim to hide the C long names :0 but also auto-expand them when cursor on 'em |
23:05:42 | FromDiscord | <ache of head> 🤯 |
23:13:17 | FromDiscord | <nikki> `map <F7> :syn match dunderEnd /\<\@<!\w\+\>/ conceal <bar> set conceallevel=2<CR>` |
23:13:20 | FromDiscord | <nikki> makes F7 toggle this mode |
23:18:00 | planetis[m] | nice how does it deal with escaped operator names? |
23:20:38 | FromDiscord | <nikki> 🤔 🤔 it just ends up looknig like `eqeq` or w/e and not the `eqeq_LKaskjlk24j` |
23:21:13 | FromDiscord | <nikki> but also when you cursor onto the line it expands, and the actual buffer contents are untouched so eg. lsp goto-def still works (godsend when exploring the c code imo) |
23:26:34 | planetis[m] | thats fine, still better than the orig uglyness |
23:26:55 | planetis[m] | wish I had this in kate editor |
23:27:15 | FromDiscord | <nikki> i 'm fine with / like the `eqeq` and `fooeq` kinda stuff |
23:39:19 | * | vicfred quit (Quit: Leaving) |