00:01:08*Cthalupa quit (Ping timeout: 256 seconds)
00:05:50FromDiscord<Gyllou> what is the prevailing programming paradigm for nim? oop? functional?
00:06:00FromDiscord<Gyllou> it seems like oop - lite
00:06:55Zoom[m]I use one paradigm with any language
00:07:12*Cthalupa joined #nim
00:07:39FromDiscord<Gyllou> and that is?
00:07:56Zoom[m]I call it Dysfunctional Programming
00:08:05FromDiscord<Gyllou> lol idk what i expected
00:08:13FromDiscord<Rika> Isn't nim considered procedural
00:08:30FromDiscord<Gyllou> idc that much but im trying to make this thing appealing to use
00:09:54FromDiscord<Gyllou> @Rika yea i figured as much, seems mostly oop with room to do functional if desired
00:10:39FromDiscord<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:58FromDiscord<Daniel> Nim can probably fit any type
00:12:11FromDiscord<Gyllou> kk ill probably do something like create a few graph classes and the separate out the algorithms into their own lib
00:12:24Zoom[m]If you're diligent in your chase you end up with exactly as many copies, as necessary.
00:12:28FromDiscord<Gyllou> (edit) "the" => "then"
00:13:03FromDiscord<Gyllou> yea but if you do want zero copy you need to do inplace ops.
00:14:47FromDiscord<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:05FromDiscord<Gyllou> and thats for a directed unweighted graph
00:18:15FromDiscord<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:03FromDiscord<Gyllou> so far i have it implemented with arraymancer, bitvectors and then I'm working on nim standard types implementation
00:24:08PMunchOoops, left my IRC open again.. hmmm, if you're reading the logs, yes that is indeed Vim
00:31:33disruptekgyllou: is there anything published?
00:36:04*PMunch quit (Quit: leaving)
00:40:46FromDiscord<exelotl> is there a better way to get the number of values in an enum, besides `ord(MyEnum.high)+1`
00:48:43Zoom[m]Store the number of elements as the first element 😛
00:49:06Zoom[m]Whoops, disregard that
00:53:15FromDiscord<ElegantBeef> @exelotl that only works if there arent any holes
00:53:32disruptekfucking holes.
00:53:47disruptekmy idea of a lit friday night.
00:54:02disruptekexelotl: there's a macro that was pr'd recently.
00:54:23disruptekor just write your own. it should be like 4 lines with comments and guards.
00:55:42FromDiscord<ElegantBeef> and if you're really silly, 1 line
00:56:22FromDiscord<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:38FromDiscord<exelotl> lol nice
01:18:19FromDiscord<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:08FromDiscord<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:39FromDiscord<Revenant> I always know the type of the object from its key
01:52:46miprithat 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:57FromDiscord<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:12FromDiscord<Revenant> yeah they're completely arbitrary, so using object variants would just createa mess
01:54:20FromDiscord<exelotl> ah, hmm
01:54:37FromDiscord<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:56FromDiscord<Revenant> `ref object` would be enough for me, but looks like i can't store them in a table
01:55:20FromDiscord<Revenant> it has to be `ref RootObj` (or `ref SomeConcreteType`)
01:55:41FromDiscord<exelotl> ref object has no runtime type info so it would be impossible to convert it to a concrete type safely
01:56:27FromDiscord<exelotl> that's what RootObj unlocks for you I guess
01:56:49FromDiscord<Revenant> makes sense
01:56:50FromDiscord<Revenant> thanks guys
02:00:23FromDiscord<Gyllou> @disruptek do you mean research published or have i pushed it to github?
02:00:26*Prestige quit (Quit: Prestige)
02:01:01FromDiscord<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:47FromDiscord<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:14FromDiscord<shadow.> `for x in 0..3:` raising `Error: unhandled exception: index out of bounds, the container is empty [IndexDefect]`
02:35:23FromDiscord<shadow.> i feel like i'm missing something very big...
02:35:35FromDiscord<shadow.> OH
02:35:37FromDiscord<shadow.> nvm ik what it is
02:36:03FromDiscord<shadow.> lol
02:36:16FromDiscord<Avatarfighter> @ElegantBeef i just read an article that talks about nimscripter
02:36:25FromDiscord<Avatarfighter> idk if you've seen it yet
02:36:30FromDiscord<ElegantBeef> Was it rebel's nimplant?
02:36:35FromDiscord<Avatarfighter> Yes
02:36:49FromDiscord<Avatarfighter> your library is famous now
02:36:54FromDiscord<Avatarfighter> in my heart at least
02:37:00FromDiscord<ElegantBeef> Suffice to say they've been talking to me about it 😄
02:37:05FromDiscord<Avatarfighter> ehhe
02:37:09FromDiscord<Avatarfighter> (edit) "ehhe" => "hehe"
02:37:29FromDiscord<ElegantBeef> They're the reason it now can run strings as nimscript
02:37:46FromDiscord<Avatarfighter> ohhh
02:37:47FromDiscord<Avatarfighter> That's so cool
02:37:48FromDiscord<Avatarfighter> 😄
02:41:02*a_chou joined #nim
02:49:33FromDiscord<Gyllou> Anybody know why I'm getting a type error here?↵↵https://play.nim-lang.org/#ix=2ETG
02:53:57FromDiscord<exelotl> you wanna do `name = "test"` instead of `name: "test"` etc.
02:54:49FromDiscord<exelotl> it's a bit of a language quirk - only the object construction syntax uses colons for field names
02:55:04FromDiscord<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:06FromDiscord<exelotl> regular procedure calls use `=` for named parameters
02:55:17FromDiscord<Gyllou> dear god im so retarded sometimes
02:55:18FromDiscord<nikki> bonus points if makes nested concepts too for deeper members
02:55:25FromDiscord<Gyllou> thanks exelotl
02:55:33FromDiscord<exelotl> no worries x)
02:55:37FromDiscord<nikki> basically inferred static structural typing
02:56:01FromDiscord<nikki> like it just sees what members you use in the body, and puts all of that in a concept
02:56:29FromDiscord<exelotl> sounds galaxy brain
02:56:39FromDiscord<nikki> yeah i've run out of brain for now
02:57:27FromDiscord<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:49FromDiscord<nikki> https://github.com/nikki93/ng-public/blob/2418a386df02dac8f1dda40c2b4608fbd69fab59/src/game/feet.nim#L10
02:58:46FromDiscord<nikki> maybe this is a bad example tbh, but in another case it was simple properties like sprite depth etc.
02:59:27FromDiscord<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:19FromDiscord<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:59FromDiscord<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:49disrupteknikki: 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:02FromDiscord<nikki> sweet
05:43:20*fredrikhr quit (Ping timeout: 256 seconds)
05:46:28FromDiscord<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:12FromDiscord<Rika> Did you selectively import
07:58:44disrupteki had no choice.
07:59:38j-jamesso i'm trying to parse a html file, locally download all images, and replace the img srcs with local paths
07:59:53j-jamesand as such looking at the htmlparser and xmltree libraries
08:00:21j-jameswhich eventually led me to the XmlNode type
08:00:56j-jamesbut i can't find documentation on the XmlNode type itself
08:01:04j-jamesis there somewhere specific i should be looking?
08:04:42disruptekthere's nothing to know.
08:05:13disruptekit's an opaque type; no exported fields.
08:06:03j-jamesso when the htmlparser example has something like `XmlNode.attrs.hasKey` are those actually methods from somewhere else?
08:06:11FromGitter<AZ-X> This is a good project https://github.com/nim-lang/pas2nim. How about go2nim?
08:06:24disruptekthat's the attrs proc from xmltree, yes.
08:06:49j-jamesi see, thank you
08:07:27disruptekgo2nim won't be useful until csp is ready.
08:08:01disruptekalso, csp looks like it won't be ready until at least 1.8 due to incomplete concepts.
08:08:27disruptekhopefully, cps for 1.6. hopefully.
08:10:48FromGitter<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:29disruptekyou really think so?
08:14:07FromDiscord<ElegantBeef> what does "wide open" even mean
08:15:16FromGitter<AZ-X> > *<disruptek>* you really think so? ⏎ ⏎ Yes, depends on resources involved
08:18:54FromGitter<AZ-X> > *<FromDiscord>* <ElegantBeef> what does "wide open" even mean ⏎ ⏎ When you are really reading codes, you can feel it 'wide open'.
08:19:21FromDiscord<ElegantBeef> Yes... i totally dont follow
08:19:43FromGitter<AZ-X> > *<FromDiscord>* <ElegantBeef> Yes... i totally dont follow ⏎ ⏎ At least, you can try it.
08:27:42FromGitter<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:57FromDiscord<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:25FromDiscord<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:48FromDiscord<ElegantBeef> I was going to note that it doesnt have a return value
09:18:04FromDiscord<ElegantBeef> I did `result.repr` and nothing printed, and was confused
09:18:20FromDiscord<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:15FromDiscord<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:15FromDiscord<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:41FromDiscord<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:47FromDiscord<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:00FromDiscord<InventorMatt> here is the new code with those fixes and the new error https://play.nim-lang.org/#ix=2EVd
09:28:40FromDiscord<Vindaar> this compiles:
09:28:41FromDiscord<Vindaar> https://play.nim-lang.org/#ix=2EVf
09:29:56FromDiscord<Vindaar> oh
09:30:03FromDiscord<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:45FromDiscord<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:36FromDiscord<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:21FromDiscord<Vindaar> here you go now: https://play.nim-lang.org/#ix=2EVi
09:49:34FromDiscord<Vindaar> I think I noted all the changes I made, but might have forgotten some
09:50:33FromDiscord<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:33FromDiscord<Vindaar> oh and changing the gensym logic a bit
09:51:58FromDiscord<InventorMatt> awesome that seems to be working now. thank you so much
09:52:28FromDiscord<Vindaar> You're very welcome! Thanks for the morning macro fun 🙃
09:54:41FromDiscord<InventorMatt> now I can do the the fun part of actually generating the fuzzy controller logic for the proc
09:59:51FromDiscord<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:08FromDiscord<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:48ForumUpdaterBotNew 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:25j-jamesWhat's best practice for downloading a file from a url?
10:58:54j-jameswhoops, nvm
11:14:19*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
11:39:29FromGitter<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:38j-jamesHJarausch: It looks like your proc isn't returning an int
11:47:14*audiofile joined #nim
11:47:29audiofilehello looking for crossplatform gui framework fr nim -- windows and linux
11:48:08audiofilefound nigui anyoneo confirm if work?
11:48:13j-jamesHJarausch: You might want to either remove the `: int` before the = or just type `result` on line 8
11:48:46audiofileor i dont mind web app either
11:48:49audiofileanything fine :)
11:49:05j-jamesaudiofile: Two native options are NiGui and nim-lang/ui
11:49:18audiofilethanks james
11:50:18j-jamesTry `nimble search gui` for more options, I know there's a fair number of web-based packages
11:51:40audiofileoh wow there are many entries!
11:51:48audiofilelooks like many ppl taking attempt at making gui libs for nim
11:52:09audiofilewhat do I do to search for the web oens you mentioned
11:54:33*hmmm quit (Ping timeout: 260 seconds)
11:55:10j-jamesthey usually mention "web" or have it as a tag
11:55:16*narimiran quit (Ping timeout: 240 seconds)
11:56:05audiofilegotcha thanks. also anything akin to beautifulsoup from python for web scraping?
11:56:19audiofileor does nim have something in stdlib to parse html
11:57:44audiofilenvm 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:32audiofiledoes 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:49FromDiscord<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:05audiofileok! probably too trivial
12:33:22audiofilebtw what's the idea behind having to 'discard' values unused from a function return value
12:33:32audiofileother programming languages just silently do it
12:33:56FromDiscord<haxscramper> You don't want to drop return codes for example
12:34:31FromDiscord<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:40FromDiscord<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:05audiofileah, that makes much more sense now, thanks for explaniign!
12:36:24FromDiscord<haxscramper> And need to be indicated explicitly. Although you can use `{.discardable.}` on proc so you can omit `discard`.
12:36:48audiofileis that a 'macro'?
12:37:09FromDiscord<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:42:07audiofilejust noticed there's a 'future' module. will stuff from that be merged into stdlib eventually
12:42:13audiofileI mean the standard namespace
12:42:36audiofilelike how in python2 you do from future import __print__ (I think) but not in python3
12:44:53FromDiscord<haxscramper> Actually I think it was deprecated and superseded by `std/sugar`. And list comprehension macro was replaced by `std/sugar.collect`
12:45:35audiofilemajor changes
12:50:59Zoom[m]audiofile: what codec are you?
12:51:32FromGitter<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:46audiofileon sad days im an ogg and on days when im a bit frisky, im a flac Zoom[m] B)
12:52:15FromGitter<HJarausch_gitlab> j-james: I just cannot "return" to no indentation
12:52:32Zoom[m]audiofile: not too bad, at least you're not windows media
12:53:31FromGitter<haxscramper> @HJarausch_gitlab https://play.nim-lang.org/#ix=2EWu
12:54:04FromGitter<haxscramper> Is it close to what you wanted?
12:59:01FromGitter<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:23FromDiscord<Rika> HJarausch you can't dedent?
13:01:29FromDiscord<haxscramper> To decrease indentation just enter empty line. Everything else is the same as regular editor
13:02:08FromGitter<haxscramper> E.g you would need to type ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5fb90fd02cb422778f2bf183]
13:02:29FromGitter<haxscramper> Notice empty lines after each `result`
13:06:02*ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
13:06:33FromGitter<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:05ForumUpdaterBotNew thread by AlectronikHQ: Error: type mismatch: got <type int8> but expected 'int literal(8)', see https://forum.nim-lang.org/t/7134
13:28:18FromDiscord<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:36FromDiscord<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:03FromGitter<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:13audiofilewhat is taintedstring
15:31:51audiofilecan I not check if a variable is empty by doing `if not <var>`
15:32:34miprinot inverts a boolean. zero-length sequences, if that's what you mean by empty, aren't false.
15:33:48mipriTaintedString is https://en.wikipedia.org/wiki/Taint_checking . if you don't turn it on, it's the same thing as string
15:34:19mipriyou can support it by explicitly .string'ing a TaintedString type when it should be safe to use
15:34:31audiofilefirst time encountering it! btw can I also not concatenate multiple strings like a & b & c?
15:34:43audiofile.string sounds handy
15:34:46miprithere'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:00mipri!eval echo "a" & "b" & "c"
15:35:17audiofileoh er...a b c are strings I should clarify
15:35:43audiofile!eval let a="abc";let b="bcd"; let c="cde"; echo a & b & c
15:35:57*audiofile scratches head
15:36:29audiofileif name == '': "One for you, one for me." else: "One for " & name & " , one for me."
15:36:38audiofilesomething wrong here?
15:36:48audiofilealso if there's a better way of checking for empty string lmk!
15:37:06PMunchThere is something wrong there
15:37:15PMunch'' is a character literal, and they can't be empty
15:37:15audiofilename in that if-else thingy?
15:37:18PMunchTry using "" instead
15:37:19FromDiscord<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:28PMunchOr check if len == 0
15:37:46FromDiscord<haxscramper> Or someone mentioned it on forum etc.
15:37:51PMunchSo if name.len == 0:
15:37:51audiofilehax, I did a `if not name`
15:38:43audiofilethat automatic last expression returning mechanism....does that work outside of proc's?
15:38:54audiofilelike if I want to return something at the end of a program is it okay to leave the expression dangling
15:39:10PMunchAh, not at the end of a program
15:39:24audiofileeven with variable named 'result'?
15:40:47PMunchYeah, the program as such doesn't have a return variable
15:40:59PMunchI mean you have an exit code
15:41:18audiofileoh hmm that's not whaht I'm looking for i think
15:41:35miprithat URL just loads to "page not found" for me
15:42:06audiofileum loads for me
15:42:19audiofilepete's devlog rite?
15:42:42mipriyeah, it's fine. my terminal managed to cut off the .html
15:43:53audiofileI can use stdin.readLine without importing stdin first?
15:44:17mipriit comes with the 'system' module
15:44:25audiofile...which is autoimported?
15:44:59audiofilecould someoene tell me what is the indentation error here? http://vpaste.net/03uJa?bg=dark&nu
15:45:13audiofilecompiler says it's in L#3
15:45:38mipriyou want a = instead of a : on line 1
15:45:56miprigeneral syntax errors tend to get reported as 'indendation errors'
15:46:13audiofileoh wow
15:46:32audiofilethat's like going to the doc for a fever and he treats someone else and you get cured
15:48:15miprihttps://play.nim-lang.org/#ix=2EXO works as a pastebin with Nim syntax highlighting and compilation
15:48:42audiofileyeah sorry about that
15:48:53audiofilehave to write some vimscript to push to that instead
15:49:33audiofileis there any way I can manually import 'stdin'?
15:49:38audiofilelike explicitly
15:50:38miprirealistically, no.
15:50:53mipribut you can suppress importing system by importing from it explicitly
15:51:01mipriand you can import nothing by default with 'from system import nil'
15:51:50mipriif 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:17audiofileoh sweet, looks lilke the import system is pretty exhaustive!
15:53:40mipriit has a few extra features like that yeah
15:56:52audiofileI 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:26miprino idea. what's the error?
15:58:10audiofileError: undeclared identifier: 'twoFer'
15:58:30mipriok, are you sure two_fer.nim is exporting that?
15:58:56miprithat's another difference from Python
15:59:07mipriput a * after the proc name to mark it as exported
16:00:56FromGitter<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:34mipriif you don't want them you can have a 'var T: (int, int, int)' instead
16:02:26FromGitter<HJarausch_gitlab> Thanks, that's nice
16:11:50*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
16:21:04audiofileany way to have everything exported
16:26:27*natrys joined #nim
16:26:48*jjido joined #nim
16:28:02FromGitter<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:50mipriaudiofile: no.
16:29:28FromGitter<HJarausch_gitlab> `continue` won't work before, i.e. outside, a loop
16:29:57mipriin a pinch, if you don't want to bother with modules, you can 'include' stuff instead of importing it
16:29:58audiofileyou mean the consumption of cycles in an iterator without actually iterating right
16:30:16audiofileoh! include != import???
16:30:25audiofiledamn, nim has a lot of stuff
16:30:37mipriinclude is like C's #include.
16:30:54FromGitter<HJarausch_gitlab> @audiofile yes, consume a cycle (i.e. continue won't work(
16:30:56mipribut bothering with modules gives you a lot, at the cost of typing * when you want something to be exported
16:31:18miprifor example cycle breaks down but import can deal with cycles to an extent
16:31:24audiofileexport sounds like the python's package export stuff at top level in the __init__.py file
16:31:46audiofileHJarausch sorry im nto too familiar with nim but I understand what youre tryna do
16:32:31mipriNim'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:52disruptek!repo cps
16:32:52disbot12https://github.com/disruptek/cps -- 9cps: 11Continuation-Passing Style for Nim 🔗 15 40⭐ 2🍴
16:33:11audiofilechild protection services
16:33:15FromGitter<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:22FromDiscord<haxscramper> https://nim-lang.org/docs/manual.html#iterators-and-the-for-statement-first-class-iterators
16:34:27FromDiscord<haxscramper> Closure iterators have `next` and `finished`
16:34:52disruptekfinished is pretty lousy, though.
16:35:13mipriand as a rule you should avoid the need for .next() rather than switch from inline to closure iterators.
16:35:15disruptekfine for toys, not suitable for production.
16:35:22*vicfred joined #nim
16:35:25FromDiscord<haxscramper> But for this particular use case you would porbably want to just use `continue` and `lines`
16:35:25audiofilethis 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:49disruptekrefs aren't limited to objects.
16:35:58audiofileoh um
16:36:19audiofileI see stuff in the docs like CounterTable and CoutnerTableRef
16:36:24audiofilestuff like dat ^
16:36:58mipriNim'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:30mipriso '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:59audiofilei 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:07FromGitter<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:19miprithe 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:21disruptekuse cps.
16:39:21audiofileBy strings and seqs having value semantics you mean when I do a = b, a copy is created?
16:39:54audiofiletaht's itneresting, since python has reference for 'lists'!
16:40:02audiofilealways a gotcha in pyton there
16:40:38*Vladar quit (Quit: Leaving)
16:40:56audiofilebtw why is the 're' module an impure one...can't we have one written purely in nim?
16:41:07PMunchYes, we can, and we do
16:41:33mipri*shrug*, if you really want .next you can get it as others have said. I would look first at .toSeq
16:41:41audiofileoh sweet! so will this be replacing the current re module sometime in the future?
16:42:01miprino, it's not compatible and it's not necessarily better. it's trivial to use when you want it.
16:42:24disruptekthe same can be said for the non-native one.
16:42:40audiofilehttps://imgur.com/a/cS638Xi :)
16:42:46disruptekthe difference is that it requires extra dlls on windows.
16:42:57disruptekthe complexity is not worthwhile, imo.
16:43:11audiofileso this regex matching at compile-time. is that only available with nim-regex?
16:43:21mipriyeah, 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:33ForumUpdaterBotNew thread by Mildred: Tables.add() deprecation in favor of []= is wrong, see https://forum.nim-lang.org/t/7135
16:43:50disrupteki just don't use regex.
16:43:55audiofiledude what
16:44:03audiofilewhy wouldnt you want more problems???
16:44:32mipribut PCRE generally handily beats nim-regex except on artificial benchmarks.
16:44:36disrupteki can't pay my phone bill. this is really not something i'm going to fix.
16:44:51FromGitter<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:12mipriyeah 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:22disruptekfavor explicit control flow over continue.
16:46:27disruptekit's smelly.
16:49:02audiofileso...help me undersstand this. by c library bindings do you mean i cna use any c library in nim?
16:49:59miprithat's a weird emphasis. Makes me want to say "no, you can't use libraries that don't exist yet."
16:50:54mipriobviously 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:22audiofilethis some schrodinger shit
16:51:38mipriyou're the one asking the weird question. Why do you think there would be some class of usable vs. unusable C libraries?
16:51:54audiofileum where did I say that
16:52:20mipriyes, you can use any C library in Nim.
16:52:40audiofileit'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:44miprifor the FFI I'd start at https://nim-lang.org/docs/manual.html#foreign-function-interface
16:55:49mipriNim 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:51FromDiscord<exelotl> I don't know of any C library that can't be wrapped by Nim
16:57:32FromDiscord<exelotl> but you could probably construct a C library that has weird semantics by abusing preprocessor macros
16:57:50FromDiscord<exelotl> and then using that library in Nim would possibly be awkward and unpredictable
16:58:32miprioh you could easily make something incompatible. Just stomp use symbols that Nim would need, like NimMain
16:58:35FromGitter<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:44PMunchOr 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:52mipriif 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:01mipriif you *don't* turn on tainting on
17:01:08mipri!eval echo "hello"[1..^1]
17:01:37mipri!eval echo typeof(^1)
17:01:57miprithat "1..^" might be your problem
17:02:09*audiofile quit (Quit: Default Quit Message)
17:03:34FromGitter<HJarausch_gitlab> So, I have to write
17:04:37FromGitter<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:22mipri!eval echo ("hello"[1..^1], "hello"[1..<len("hello")])
17:05:24NimBot("ello", "ello")
17:06:12FromGitter<HJarausch_gitlab> Yes, it works just fine with a string constant or variable but not with the result of readLine
17:06:25mipriwhy would you think that?
17:06:39mipriyou have
17:06:46miprigah, terminal messed up there.
17:06:51mipriyou have [1..^], not [1..^1]
17:09:12FromGitter<HJarausch_gitlab> Oh, I see! Thanks.
17:11:21disruptekwe 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:51Prestigedisruptek: 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:38disruptekhow 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:46ForumUpdaterBotNew 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:05FromDiscord<exelotl> https://media.discordapp.net/attachments/371759389889003532/779783459031220234/hacking-in-progress.gif
19:06:23*opal quit (Ping timeout: 240 seconds)
19:07:11FromDiscord<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:29mipri99% 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:23FromDiscord<Gyllou> method getNeighbors(this: Graph): void{.base.} = discard is this an idiomatic way to declare a method of an abstract base class?
22:36:21FromDiscord<Gyllou> is there a classy-er way to do this
22:38:11FromDiscord<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:20FromDiscord<nikki> i would rename "this" "graph" instesd
22:38:32FromDiscord<nikki> it's nice to just see what ur talking about in the method body
22:38:39FromDiscord<nikki> graph.foo
22:38:48FromDiscord<Gyllou> okay gotcha
22:39:18FromDiscord<Gyllou> should i bother making a base class?
22:39:31FromDiscord<Gyllou> ive got 4 different graph implmentations right now
22:39:37FromDiscord<ElegantBeef> If you're inheriting and wanting to overide methods, yes
22:39:45FromDiscord<Gyllou> (edit) "implmentations" => "implentations"
22:40:00FromDiscord<nikki> could also consider making a concept, and then you have static dispatch if some algo is generic over graph type
22:40:16FromDiscord<nikki> like, do you actually need / want dynamic dispatch?
22:40:17FromDiscord<Gyllou> okay i wasn't sure how strictly nim standards adhere to oop
22:40:46FromDiscord<Gyllou> im not familiar with concepts
22:41:09FromDiscord<Gyllou> ill hafta google them, what are they similar to?
22:41:29FromDiscord<Gyllou> i am not a huge proponent of oops but i want this lib to be useful for other people
22:41:43FromDiscord<Gyllou> (edit) "oops" => "oop" | "people" => "people, and they might expect dynamic dispatch"
22:41:53FromDiscord<nikki> why not just have the 4 graph data structures
22:41:57FromDiscord<nikki> and people can use whichever one they want
22:42:03FromDiscord<nikki> why do u need / want a base class or w/e
22:42:04FromDiscord<Gyllou> hey im fine with that
22:42:09FromDiscord<nikki> seems fine then
22:42:17FromDiscord<Gyllou> the only reason would be then interacting with the graph algos
22:42:25FromDiscord<nikki> if you have algos in the lib too that are generic over graphs then that may make sense
22:42:28FromDiscord<nikki> to have a graph concept
22:42:46FromDiscord<Gyllou> yea that was my thinking, those are the hard part anyways
22:43:05FromDiscord<Gyllou> is a concept like an interface?
22:43:32FromDiscord<Gyllou> oh they are like cpp concepts
22:43:34FromDiscord<nikki> https://nim-lang.github.io/Nim/manual_experimental.html#concepts
22:43:44FromDiscord<nikki> the thing they are most like is nim concepts
22:44:10FromDiscord<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:09FromDiscord<Gyllou> i will look through that then and maybe ill use concepts for the graphs
22:45:31FromDiscord<Gyllou> i dont want to have multiple implementations of graph algos
22:45:32FromDiscord<nikki> i would say to think about it in terms of the algos
22:45:36FromDiscord<nikki> instead of of the graph data structures
22:45:45FromDiscord<nikki> like, for a particular algo that is generic, what is it looking for
22:45:54FromDiscord<nikki> and keep the data structures themselves as concrete as possible and just the concrete ones
22:46:04FromDiscord<nikki> interfaces seem good when close to their usage, vs their implementors
22:46:17FromDiscord<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:25FromDiscord<Gyllou> yea there are
22:46:35FromDiscord<nikki> what do they look like
22:46:37FromDiscord<Gyllou> im implementing gpu based graph algos
22:46:49FromDiscord<nikki> like do they take a graph and a function and run it over elems etc. or such
22:47:24FromDiscord<Gyllou> ive only made naive one so far to get a feel for what data structure api i need
22:47:34FromDiscord<Gyllou> but most like yea, about like that
22:47:48FromDiscord<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:53FromDiscord<nikki> then maybe you'll see some patterns emerge
22:48:13FromDiscord<nikki> mostly it seems like you need static dispatch tho right
22:48:15FromDiscord<Gyllou> kk, yea i have basic stuff, like get/remove/getneighbors etc
22:48:31FromDiscord<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:33FromDiscord<Gyllou> possibly it just depends on how slick i am with the api
22:48:37FromDiscord<nikki> or a graph is loaded from a dll or sth... lol
22:49:10FromDiscord<Gyllou> thats probably actually how im going, the data structures are done in nim though, save for using arraymancer
22:49:24FromDiscord<Gyllou> which, i think has a lot of cpp interop of something
22:49:48FromDiscord<Gyllou> the datastructures were important for me because of the size of our graphs are ridiculous
22:49:53FromDiscord<Gyllou> (edit) "datastructures" => "data structures"
22:50:40FromDiscord<Gyllou> ill take a look at concepts and play around with some more algos and see what i need
22:50:51FromDiscord<Gyllou> its going to be a bit of fiddling here then there sort of deal
22:51:20FromDiscord<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:26FromDiscord<Gyllou> this is a dependency for alot of other things in our project right now though
22:51:45FromDiscord<Gyllou> thats kinda what i figured, this is an hpc lib
22:52:07FromDiscord<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:19FromDiscord<nikki> ya just focus on having a good time
22:52:23FromDiscord<nikki> if you have a good time
22:52:25FromDiscord<nikki> it'll all work out
22:52:31FromDiscord<Gyllou> lol good rule of thumb
22:52:46FromDiscord<Gyllou> thanks!
22:59:57FromDiscord<nikki> https://media.discordapp.net/attachments/371759389889003532/779843569199743036/simplescreenrecorder-2020-11-21_14.59.23.mp4
23:00:18FromDiscord<nikki> got vim to hide the C long names :0 but also auto-expand them when cursor on 'em
23:05:42FromDiscord<ache of head> 🤯
23:13:17FromDiscord<nikki> `map <F7> :syn match dunderEnd /\<\@<!\w\+\>/ conceal <bar> set conceallevel=2<CR>`
23:13:20FromDiscord<nikki> makes F7 toggle this mode
23:18:00planetis[m]nice how does it deal with escaped operator names?
23:20:38FromDiscord<nikki> 🤔 🤔 it just ends up looknig like `eqeq` or w/e and not the `eqeq_LKaskjlk24j`
23:21:13FromDiscord<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:34planetis[m]thats fine, still better than the orig uglyness
23:26:55planetis[m]wish I had this in kate editor
23:27:15FromDiscord<nikki> i 'm fine with / like the `eqeq` and `fooeq` kinda stuff
23:39:19*vicfred quit (Quit: Leaving)