<< 23-01-2018 >>

00:10:33*MJCaley joined #nim
00:12:26*RushPL quit (Remote host closed the connection)
00:15:42*RushPL joined #nim
00:17:12*Calinou_ is now known as Calinou
00:30:13*endragor joined #nim
00:34:35*endragor quit (Ping timeout: 240 seconds)
00:37:35*user0 quit (Ping timeout: 240 seconds)
00:37:57*jxy quit (Ping timeout: 240 seconds)
00:43:00*jxy joined #nim
01:20:50*Kingsquee joined #nim
01:21:46*couven92 quit (Quit: Client Disconnecting)
01:34:33*xkapastel quit (Quit: Connection closed for inactivity)
02:12:03*MJCaley quit (Quit: MJCaley)
02:22:58*chemist69 quit (Ping timeout: 256 seconds)
02:36:42*chemist69 joined #nim
02:40:27*jxy quit (Ping timeout: 240 seconds)
02:44:27*marenz_ quit (Ping timeout: 240 seconds)
02:51:20*jxy joined #nim
02:58:09*Kingsquee quit (Quit: https://i.imgur.com/qicT3GK.gif)
02:59:42*jxy quit (Ping timeout: 246 seconds)
03:04:13*jxy joined #nim
03:05:41*endragor joined #nim
03:08:34*craigger quit (Ping timeout: 268 seconds)
03:08:57*craigger joined #nim
03:15:57*vlad1777d quit (Ping timeout: 240 seconds)
04:18:50*dddddd quit (Remote host closed the connection)
04:19:33*ludocode quit (Read error: Connection reset by peer)
04:38:50*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
04:54:39*user0 joined #nim
05:04:31*c0ntribut0r quit (Ping timeout: 248 seconds)
05:08:10*c0ntribut0r joined #nim
05:23:51*c0ntribut0r quit (Ping timeout: 256 seconds)
05:24:09user0How does one elegantly block the `=` operator for user defined types?
05:25:30*c0ntribut0r joined #nim
05:39:27*c0ntribut0r quit (Ping timeout: 240 seconds)
05:39:57*c0ntribut0r joined #nim
05:42:42*tinAndi joined #nim
05:43:35*user0 quit (Ping timeout: 240 seconds)
05:48:15*tinAndi quit (Ping timeout: 248 seconds)
05:52:32FromGitter<Varriount> What do you mean?
05:55:15*endragor quit (Remote host closed the connection)
06:23:46Araqproc `=`(dest: var MyType; src: MyType) {.error.} but it's in development
06:24:54*nsf joined #nim
06:28:42*endragor joined #nim
06:33:18*JStoker quit (Quit: JStoker is gone :()
06:47:47*xet7 quit (Quit: Leaving)
06:51:18FromGitter<survivorm> @shashlick, xterm-256color
06:52:29FromGitter<survivorm> @shachlick xfce4-terminal
06:54:27shashlickthanks!
06:55:10*xet7 joined #nim
06:55:53*devdri joined #nim
07:00:36*xet7 quit (Remote host closed the connection)
07:00:41FromGitter<survivorm> @PMunch a bit late answer, but i'm here
07:01:21FromGitter<survivorm> Currently going to write an article with all I've dug on parsing yet
07:01:25*xet7 joined #nim
07:01:42Araqpah, an article
07:01:58Araqgive us compile-time PEG grammar support please
07:02:12FromGitter<survivorm> A lot, actually. And never seen it in one place, except for big books on compiler writing
07:02:43FromGitter<survivorm> @Araq - So, green flag on it? And the AST?
07:03:11Araqhuh?
07:03:38Araqwhat do you mean?
07:04:26FromGitter<survivorm> Then I hear "parsing" - i think of 'text' -> 'some AST' translation, not just tokenization or 'matches', i can perfectly use regexp for it, thank you
07:04:39*JStoker joined #nim
07:05:28FromGitter<survivorm> Or did You ask about 'green flag'?
07:08:45*xet7 quit (Ping timeout: 264 seconds)
07:11:07*devdri quit ()
07:16:27*solitudesf joined #nim
07:20:14FromGitter<survivorm> @Araq
07:22:24*xet7 joined #nim
07:25:26*endragor quit (Remote host closed the connection)
07:25:54*endragor joined #nim
08:02:26*endragor quit (Remote host closed the connection)
08:02:57*endragor joined #nim
08:12:22*PMunch joined #nim
08:14:41*endragor quit (Remote host closed the connection)
08:15:09*endragor joined #nim
08:19:16*yglukhov joined #nim
08:26:28*Vladar joined #nim
08:34:48PMunchOh hi survivorm, you still around?
08:35:23*floppydh joined #nim
08:36:32PMunchAnd Araq, why doesn't PEG work on compile-time? Is there some technical issue with it?
08:38:26*dddddd joined #nim
08:38:38FromGitter<survivorm> Yeah
08:38:45FromGitter<survivorm> 'm here
08:38:59PMunchJust wanted to show you this: https://gist.github.com/kmizu/2b10c2bf0ab3eafecc1a825b892482f3
08:39:28PMunchSomeone made a small parser combinator library in Nim
08:42:06FromGitter<survivorm> Hmm. From a first glance - i do not understand how is this used
08:42:19FromGitter<survivorm> And is this finished at all
08:42:34PMunchWell, I'm still trying to work through the logic of it :P
08:43:17PMunchFrom the proc A() and downwards you can see how he uses it
08:43:42PMunchPretty messy syntax but it shouldn't be too hard to use some macro-magic to clean that up
08:44:39FromGitter<survivorm> Ah, i see, i just viewed not full version of it, as it has no scroll on gitter
08:44:54PMunchAh right
08:46:56FromGitter<survivorm> But for now,, i'm focused at the article, then back to my "work-work". So I'll return to the parsing in evening, maybe. And my idea for now was to take pegs lib with AST (from D, for eg), then compile it to c, then c2nim it and then learn tweaking it's algorithm to the nim-style
08:47:18FromGitter<survivorm> The same for BNF-thing
08:47:36PMunchLooking forward to reading the article
08:48:18FromGitter<survivorm> The version one will be in russian. And translation will be hard, i'm not so good in english
08:48:45FromGitter<survivorm> The point is - russian docs on parsing are sparce at best
08:49:16PMunchAh damn, I don't speak Russian..
08:49:33PMunchIf you want help with translating though I can try to be of assistance
08:49:49PMunchPlus, your English is pretty good
08:49:52FromGitter<survivorm> Yeah, of cource
08:51:27FromGitter<survivorm> Think of it - I've not seen ANY article that speaks about all the parsing opportunities You have - brute force, regexp, bnf via flex-bison or likes, or native libs, pegs
08:51:56FromGitter<survivorm> So i decided to write one
08:53:14PMunchThat sounds like an interesting read
08:56:20*endragor quit (Remote host closed the connection)
08:56:47*endragor joined #nim
08:58:20*devdri joined #nim
09:01:05*PMunch quit (Ping timeout: 240 seconds)
09:03:46*gmpreussner quit (Ping timeout: 268 seconds)
09:05:04*PMunch joined #nim
09:05:33*gmpreussner joined #nim
09:07:05*vlad1777d joined #nim
09:09:57*gmpreussner quit (Ping timeout: 240 seconds)
09:21:45FromGitter<Bennyelg> Guys, do we have any macro that mimik scala match statement ?
09:24:59FromGitter<andreaferretti> There is patty, but it is still very basic
09:25:01FromGitter<andreaferretti> https://github.com/andreaferretti/patty
09:25:09FromGitter<survivorm> @PMunch found pyBison package in python. I'll look into it and MAYBE try to port it to nim (python's my current "native" prog language :) )
09:25:20FromGitter<andreaferretti> in particular, patterns cannot be nested
09:25:28FromGitter<andreaferretti> but PRs are welcome :-)
09:25:42FromGitter<Bennyelg> Great! @andreaferretti
09:32:44*endragor quit (Remote host closed the connection)
09:33:12*endragor joined #nim
09:38:38AraqPMunch: it's just VM bugs that keep it from working
09:38:52Araqbut the real point is is that you cannot attach actions to matchings
09:40:21*endragor quit (Remote host closed the connection)
09:41:07*endragor joined #nim
09:51:28*natrys joined #nim
10:02:53FromGitter<survivorm> @Araq Which restriction it is&
10:03:12Araqit crashes iirc
10:03:47*Arrrr joined #nim
10:04:18FromGitter<survivorm> @Araq what's iirc?
10:04:58FromGitter<survivorm> And the question was about the actions, not compilation
10:04:58Araq"if I recall correctly"
10:05:08FromGitter<survivorm> Ah, that
10:06:22*endragor quit (Remote host closed the connection)
10:06:33cremit's WIMDRE in German
10:06:46cremNot sure if D can be ommited..
10:06:49*endragor joined #nim
10:08:22Araqit can.
10:08:55Araqwhat about the actions? Pegs was written by a stupid guy who hardly knew how to design Nim APIs/DSLs
10:10:01Araqand yes, you want to support PATTERN: ACTION(s), not necessarily AST construction, AST construction is expensive
10:24:02FromGitter<survivorm> @Araq than maybe make this as a flag?
10:24:37*user0 joined #nim
10:24:45*PMunch quit (Read error: Connection reset by peer)
10:26:12*PMunch joined #nim
10:26:12*yglukhov quit (Read error: Connection reset by peer)
10:26:14*yglukhov_ joined #nim
10:28:18PMunchAraq, wasn't the PEGs module written by you? :P
10:32:09*yglukhov joined #nim
10:32:09*yglukhov_ quit (Read error: Connection reset by peer)
10:33:10*yglukhov_ joined #nim
10:33:10*yglukhov quit (Read error: Connection reset by peer)
10:33:11Araqyup, I wrote it
10:36:19*couven92 joined #nim
10:39:49*endragor quit (Remote host closed the connection)
10:40:17*endragor joined #nim
10:40:54FromGitter<andreaferretti> I like the approach of parboiled https://github.com/sirthias/parboiled/wiki where matchings consume or produce stuff on a stack
10:41:16FromGitter<andreaferretti> This way you can produce an AST that is much smaller then the full parse tree
10:41:36FromGitter<andreaferretti> This version constructs combinators at compile time https://github.com/sirthias/parboiled2/
10:44:53FromGitter<krux02> Araq: do you plan to fix the inconsistency between `-3 mod 2` and `-3.0 mod 2.0` before 1.0?
10:45:32FromGitter<andreaferretti> why is -3.0 mod 2.0 even a thing?
10:45:43FromGitter<krux02> what do you mean?
10:46:13FromGitter<krux02> do you mean mod with a float type, or mod with a negative argument?
10:46:27FromGitter<andreaferretti> mod with a float type
10:46:57FromGitter<krux02> well I think it's very useful
10:48:15FromGitter<andreaferretti> I have never used it, or even guessed it existed, but apparently we do very different things :-)
10:48:30*endragor quit (Remote host closed the connection)
10:48:57*endragor joined #nim
10:49:50FromGitter<krux02> yes we do
10:49:58FromGitter<krux02> in computer graphics it is very useful
10:51:15FromGitter<krux02> but sadly the version in c++ (fmod) is completely useless, because of the behaviour in negative numbers
10:51:53Araqkrux02: dunno, seems wrong to depart from what fmod does
10:52:08FromGitter<krux02> I like to disagree there
10:52:20Araqmaybe introduce 'mod' vs 'rem' like Ada does
10:53:18*walkre joined #nim
10:54:11FromGitter<krux02> I could live with that
10:54:36FromGitter<krux02> there are two worlds who implement mod
10:54:50FromGitter<krux02> in the positive range they are the same in the negative, they are not
10:55:34AraqI never use 'mod' for negative numbers though
10:56:03Araqand you cannot tell me C++ isn't used for computer graphics either, really, seems risky to change
10:57:33FromGitter<krux02> trust me, it's save to change that
10:57:36*endragor quit (Remote host closed the connection)
10:57:52*miran quit (Quit: Page closed)
10:58:04*walkre quit (Ping timeout: 260 seconds)
10:58:24FromGitter<krux02> a quote from here: https://www.rapitasystems.com/blog/ada-c-rem-and-mod "Somewhat confusingly, in C99 standard the % operator is usually referred to as mod, although it actually implements the behavior of rem"
10:59:23*endragor joined #nim
11:00:16FromGitter<krux02> c++ is used for computer graphics a lot, but the standard mod is avoid because it is useless. People use the mod from for example glm: https://glm.g-truc.net/0.9.4/api/a00129.html#ga3bdf136bc96f670965cd2f48d14356b4
11:00:50*endragor quit (Remote host closed the connection)
11:01:14FromGitter<krux02> https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/mod.xhtml
11:01:38FromGitter<krux02> but it would be dangerous to change the behavior of mod in nim for floating point values.
11:02:29FromGitter<GULPF> IMO `mod` should work like C/C++, but there should be a separate operator for floor mod
11:03:13*endragor joined #nim
11:03:37*kier quit (Quit: No Ping reply in 180 seconds.)
11:04:05FromGitter<krux02> @GULPF have you ever used and needed the mod behavior of mod like it is in c++?
11:04:11*endragor quit (Remote host closed the connection)
11:05:06FromGitter<krux02> I mean did you ever expect and needed a negative result for `mod(x, 5.0)`?
11:06:42FromGitter<GULPF> Not really, but I think people might be more familiar with the behavior of mod in C. Besides, I think it's important that `div` uses the same method as `mod`, and changing `div` to floor division would break a lot
11:07:33FromGitter<krux02> ok that might be true
11:08:09FromGitter<krux02> and no, people are surprised with the behavior of mod in C all the time.
11:08:45FromGitter<krux02> % in C is used, then the program crashes and they realize, shit I can't use % I need something else
11:08:59*kier joined #nim
11:09:08FromGitter<krux02> I've seen it
11:09:15FromGitter<krux02> and I had the experience
11:09:28FromGitter<krux02> here I really think it's good not to copy C.
11:10:26*endragor joined #nim
11:10:55FromGitter<krux02> what if Nim changes and says div and rem
11:11:02FromGitter<krux02> belong together?
11:11:27*devdri quit (Ping timeout: 248 seconds)
11:11:51FromGitter<GULPF> you mean that `rem` is trunc mod and `mod`is floor mod?
11:17:27*devdri joined #nim
11:19:43*Yardanico joined #nim
11:21:02Araqkrux02: check what Rust does here please :-)
11:22:12PMunchhttps://stackoverflow.com/questions/31210357/is-there-a-modulus-not-remainder-function-operation
11:22:18PMunchRust does rem as well it seems
11:24:01PMunchSince Nim uses the keyword mod and not just % I feel like it definitely should be an actual modulus operation
11:24:20FromGitter<krux02> @gulpf that is how it is in ada
11:24:24PMunchBut also add rem for those who need that
11:24:47PMunchCalling remainder for mod is just confusing
11:25:31FromGitter<GULPF> I think Common Lisp also uses the same as Ada
11:27:52Araqhttps://mail.mozilla.org/pipermail/rust-dev/2013-April/003683.html
11:27:58Araqand onwards it goes
11:28:32FromGitter<krux02> https://stackoverflow.com/questions/4003232/how-to-code-a-modulo-operator-in-c-c-obj-c-that-handles-negative-numbers
11:28:52FromGitter<krux02> it seems like that `%` in C is implementation defined. lol
11:30:19FromGitter<krux02> honestly I think to have both modulo and remainder like in Ada is the best thing to have.
11:30:31FromGitter<krux02> I have no Ada experience, but that really seems like a good idea
11:30:38FromGitter<GULPF> I agree
11:31:44*tinAndi joined #nim
11:32:34Araqyeah, but 'rem' won't become a keyword, sorry
11:33:59Araq-7 /- 3 = -1
11:34:05Araq-7 /+ 3 = 1
11:34:23Araq"rem" and "mod" as operators anybody can remember
11:34:45Araq(I probably got it wrong though)
11:34:48PMunchThat's just confusing..
11:34:59Araqas I can't remember 'mod' nor 'rem'
11:34:59PMunch-7/-3 = ??
11:35:48PMunchModulo only returns positive numbers
11:36:48Araq /+ then. :P
11:37:09Araqor maybe %+
11:37:35*tinAndi quit (Ping timeout: 248 seconds)
11:37:45Araqor /+/ vs /-/
11:38:09Araqmore bikeshedding to come
11:38:11PMunchWhy not just mod and rem?
11:38:19FromGitter<GULPF> rem is used as a var name all the time
11:38:26FromGitter<GULPF> would break a lot
11:38:26Araqbecause these names are bad.
11:38:55PMunchBut why do you think they are bad :P
11:39:10Arrrrwhy not wrap
11:39:14AraqI would like to remove the 'mod' and 'div' keywords from the language, not add more of them
11:39:24PMunchGULPF, well type is also often used (I'd say even more than rem) and that's a keyword
11:39:35Araqtype is beyond repair :P
11:39:40PMunchHaha :P
11:39:46Araqbut we can still get mod/rem right
11:39:50PMunchdiv as well though?
11:39:59PMunchWhat're you going to call it then?
11:40:04Araq //
11:40:11PMunchEh, I guess that's okay
11:40:13Araqlike Python.
11:40:25PMunchBut /+ and /- is just confusing since you would need to space it out
11:40:42Araqyeah but that's just Nim's lexical rules at play here
11:40:45federico3urgh
11:40:51Araqand you should use spaces around them anyway
11:41:06federico3+1 PMunch
11:41:23PMunchYeah but I can imagine a lot of people writing 2/-3 in a program and getting unexpected results..
11:41:27FromGitter<alehander42> wow I can imagine a karax with `div` instead of tdiv :D
11:41:36Araqor maybe %+ vs %-
11:42:05ArrrrIt will work as fine as <4
11:42:07PMunch-% +% at least
11:42:20Araqthese already exist, PMunch
11:42:25PMunchThey do?
11:42:27Araqto do modulo arithmetic ...
11:42:52Araqso we have %- vs -% vs %+ vs +%
11:43:07Araqand the type checker is useless since it's all on integers
11:43:14Araqwe need a better plan.
11:43:27PMunchYeah, that'd just be a huge mess :P
11:44:02PMunchAh so <op>% is unsigned arithmetic
11:44:07PMunchInteresting
11:44:24Araqmaybe embrace Unicode operators?
11:44:43PMunchOh god no :P How would you even type those?
11:44:52PMunchApart from Γ˜Γ†Γ… of course
11:44:53FromGitter<GULPF> % for rem and %_ for mod? the _ kind of looks like a floor :P
11:44:58FromGitter<GULPF> *the _
11:45:33PMunch^_^ For rem and <_< for mod? :P
11:45:37AraqI don't understand the "floor" analogy. for me one can return negative numbers and the other doesn't
11:46:05Araqwhat's there to "floor" in a modulo operation?
11:46:19FromGitter<GULPF> @Araq floor/trunc is the terminology used in https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/divmodnote-letter.pdf
11:46:57*devdri quit (Ping timeout: 240 seconds)
11:47:00FromGitter<krux02> yes unicode operators, I want ¬∨∧ for booleans as alternatives to `not` `or` `and` :P
11:47:09*derlafff quit (Remote host closed the connection)
11:47:21FromGitter<GULPF> the reasoning is that mod can be implemented using floor division, and rem can be implemented using truncating division
11:47:35*derlafff joined #nim
11:47:46Araqyou really don't as usually operators evaluate all their arguments, krux02
11:48:09Araq'and' is much closer to an 'if' than it is to an &
11:49:26Araqbut I made this point before and you shrugged it off ;-)
11:49:34FromGitter<krux02> I just found out, that x86 assembley has only truncating division and the division instruction calculates both, the remainder and the division result in the same instruction. And the integer division is one of the slowest instructions on the cpu even slower than float64 division
11:51:03*devdri joined #nim
11:51:29FromGitter<krux02> Yea we had that argument before. I know I wont't get my unicode ¬∨∧ operators, but I can still wish for them
11:52:17*craigger quit (Quit: bye)
11:52:28*craigger joined #nim
11:52:44*vlad1777d quit (Ping timeout: 276 seconds)
11:53:03FromGitter<krux02> and no I don't think `and` is close to an `if` it is close to an `∧` with lazy evaluation of the arguments
12:04:51FromGitter<andreaferretti> I'd rather have an operation that returns modulo and division result as a tuple at the same time without doing the same thing twice
12:05:38FromGitter<andreaferretti> but that's another story, I am actually happy with the name mod, looks much better than % and it is what mathematicians write
12:06:06FromGitter<andreaferretti> div is also nice to distinguish integer division from float division visually
12:08:10*tinAndi joined #nim
12:18:29Araq/ //+ //-
12:18:33Araq // //+ //-
12:18:40Araqdiv, rem, mod
12:18:55FromGitter<krux02> not sure
12:19:07FromGitter<krux02> div could also be implemented in two ways :P
12:19:54FromGitter<krux02> @andreaferretti that would be analog to x86 assembler. I think that is a good thing.
12:22:46FromGitter<data-man> UnQLite 1.1.8 released, If someone uses it.
12:26:21*Snircle joined #nim
12:27:00FromGitter<krux02> http://ix.io/Eyb/c
12:27:41FromGitter<krux02> http://ix.io/Eyc
12:31:01FromGitter<krux02> http://ix.io/Eyd/c
12:31:11FromGitter<krux02> http://ix.io/Eye
12:31:23FromGitter<krux02> as you can see there is this uglyness around 0
12:32:34FromGitter<krux02> (div, mod), (remdiv, rem)
12:35:03FromGitter<krux02> ``proc truncDiv(a,b: int): tuple[quotient, remainder: int]`` ``proc floorDiv(a,b: int): tuple[quotiont, remainder: int]``
12:46:46*tinAndi quit (Ping timeout: 265 seconds)
12:49:39FromGitter<mratsim> normally it’s divmod and quotrem
12:50:00FromGitter<mratsim> And like andrea I would love a divmod proc that does the work only once ...
12:51:12*miran joined #nim
12:52:14FromGitter<ZarsBranchkin> @krux02 Is `company-mode` still unusable for you in `nim-mode`? Recently, after some updating, the completion takes way too long and hangs emacs for few seconds
12:53:42*niv quit (Quit: The Lounge - https://thelounge.github.io)
12:53:55FromGitter<GULPF> I think a good C compiler will optimize div + mod anyway
12:54:41miranre: "// //+ //-" == "div, rem, mod" --> please no
12:54:48FromGitter<ZarsBranchkin> Kind of wish to learn how `company-mode` backends work. This is what I find annoying about emacs, each mode has bit different approach at implementing things like auto completion backends or auto indentation, so it's all an inconsistent mess
12:55:01*niv joined #nim
12:56:00FromGitter<krux02> @ZarsBranchkin emacs is an inconsistent growing mess
12:56:18FromGitter<krux02> I use it too, and I also have no idea how to fix it
12:56:47FromGitter<ZarsBranchkin> Yeah, haha, the more you poke around in it, the more you realize how complex of a mess it is
12:57:10FromGitter<krux02> my gift of the day for you: (defun nim-repl () ⏎ "Switch to a nim REPL." ⏎ (interactive) ⏎ (switch-to-buffer (make-comint "nim-repl" "nim" nil "secret"))) [https://gitter.im/nim-lang/Nim?at=5a6731266117191e61a05e2a]
12:57:42FromGitter<ZarsBranchkin> o damn, I think this is exactly what I wanted the other day
12:59:46FromGitter<krux02> if you are on a command line you get the repl with "rlwrap nim secret"
13:00:42FromGitter<krux02> rlwrap applies gnu readline to nim. gnu readline is GPL so I think the license is incompatible with nim. But rlwrap allows to use it anyway.
13:01:32FromGitter<ZarsBranchkin> Nice, love how REPL is a secret switch of the nim compiler
13:02:02FromGitter<ZarsBranchkin> Now just need send to repl command, to evaluate buffer, function or region
13:02:37FromGitter<krux02> well don't expect too much of the repl. You won't be able to call into any C functions.
13:02:52FromGitter<krux02> it is all the nimvm and brings all limitations you have in macros as well.
13:03:03FromGitter<krux02> but if you know that it is really cool
13:03:34FromGitter<ZarsBranchkin> So it's a Nimscript interpreter?
13:03:54FromGitter<krux02> I think so
13:04:23FromGitter<ZarsBranchkin> Heard of it, didn't really check it out much, but it kind of seems like it
13:04:33FromGitter<krux02> could be, but I never wrote nimscript only macros. So I can't really do that comparison.
13:22:02FromGitter<Bennyelg> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a6736fad9f895c3604e40b3]
13:41:19*Arrrr quit (Ping timeout: 248 seconds)
13:42:24*devdri quit ()
13:50:18*devdri joined #nim
13:50:58FromGitter<krux02> @Bennyelg try `[]` after the second argument
13:51:42*nsf quit (Quit: WeeChat 2.0.1)
13:53:23*devdri quit (Client Quit)
13:58:23FromGitter<allochi_twitter> Hi, I have a newbie question :), can I ask here? or should I just post in the forum?
13:58:43FromGitter<krux02> ask
13:59:02FromGitter<allochi_twitter> Thanks, I have a code snippet
13:59:15FromGitter<allochi_twitter> import json ⏎ ⏎ let content = readFile("fuse/dataset.json") ⏎ var dataset = parseJson(content) ⏎ ... [https://gitter.im/nim-lang/Nim?at=5a673fb3ce68c3bc74f2e8f7]
13:59:23FromGitter<allochi_twitter> opps
14:00:01FromGitter<allochi_twitter> How can I reference `Test` instance inside the `check` proc?
14:00:19FromGitter<allochi_twitter> Without passing it again like `condition.check(condition, node)`
14:00:39FromGitter<Bennyelg> @krux02 Didnt got you
14:00:54FromGitter<allochi_twitter> maybe the code need to be formatted
14:01:19FromGitter<krux02> @Bennyelg uups type, sorry
14:01:28FromGitter<krux02> yea format the code
14:01:48FromGitter<krux02> and use tripple backticks around the code
14:02:02FromGitter<allochi_twitter> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a67405ace68c3bc74f2ecae]
14:02:26FromGitter<allochi_twitter> it took me a little while to figure out how to post this :D
14:02:57FromGitter<allochi_twitter> so you see I have a `Test` type, and each test has it’s own `check` `proc`
14:03:00*gokr joined #nim
14:03:08FromGitter<krux02> yes I got that
14:03:34FromGitter<allochi_twitter> Currently the only way to pass a reference to the test instance is by actually passing it
14:03:36FromGitter<krux02> the check block has the test bound to the symbol t
14:03:42FromGitter<allochi_twitter> there is no `this`
14:03:48FromGitter<krux02> correct
14:04:13FromGitter<allochi_twitter> and I can’t just call `condition.check(node)`
14:04:14FromGitter<krux02> you can call the first argument this if you want
14:04:23FromGitter<krux02> correct
14:04:54FromGitter<allochi_twitter> well, my question is there is no way to call `condition.check(node)` instead of `condition.check(condition, node)`
14:05:09FromGitter<krux02> is it really that important?
14:05:22FromGitter<krux02> condition.check(condition, node) seems fine to me
14:05:38FromGitter<krux02> I like that it does not have a hidden this pointer
14:05:48FromGitter<allochi_twitter> well, not really, but I’m trying to learn Nim by porting some of code, and I came across this.
14:05:58FromGitter<krux02> ok
14:06:12FromGitter<allochi_twitter> just wanted to make sure I’m not missing something
14:06:12FromGitter<krux02> well in c++ a method has a hidden this argument
14:06:31FromGitter<krux02> but under the hood it still passes the this parameter, you just don't see it
14:06:38FromGitter<allochi_twitter> yes, I though that maybe Nim also
14:06:48FromGitter<krux02> no it doesn't
14:07:13FromGitter<allochi_twitter> Thanks for your help :)
14:08:29*Jesin quit (Quit: Leaving)
14:08:56FromGitter<krux02> @allochi_twitter https://nim-lang.org/docs/manual.html#overloading-resolution-automatic-self-insertions
14:09:10FromGitter<krux02> there is something, but I don't use it
14:09:48FromGitter<allochi_twitter> Thanks, I guess I need to spend some more time reading the Manual
14:10:10FromGitter<krux02> but you would still be required to pass explicitly the this parameter, you would just be able to save some typing in the function implementation.
14:11:02FromGitter<allochi_twitter> Well, the pragma will activate this for the whole module, interesting, I wonder if this has some perfromance cost
14:12:07FromGitter<allochi_twitter> Nah, I think I can live without it for now :), thanls a lot @krux02
14:15:05*PMunch quit (Ping timeout: 240 seconds)
14:15:44*PMunch joined #nim
14:55:37*c0ntribut0r quit (Ping timeout: 256 seconds)
14:56:18*c0ntribut0r joined #nim
14:59:42FromGitter<nitely> @allochi_twitter write a wrapper? `proc check(t: var Test, j: JsonNode) = t.check(t, j)` then `check(condition, node)`
15:02:58FromGitter<nitely> not great in general, though
15:06:41*PMunch quit (Remote host closed the connection)
15:06:44*PMunch_ joined #nim
15:08:45*PMunch_ is now known as PMunch
15:15:36*devdri joined #nim
15:16:27*gokr quit (Ping timeout: 240 seconds)
15:19:57*c0ntribut0r quit (Ping timeout: 246 seconds)
15:20:20FromGitter<allochi_twitter> Haha, amazing @nitely, I just won’t go that deep, but it’s a nice twist. Thanks!
15:21:06*c0ntribut0r joined #nim
15:23:49*PMunch_ joined #nim
15:24:47*PMunch quit (Ping timeout: 248 seconds)
15:25:22*PMunch_ is now known as PMunch
15:31:30*MJCaley joined #nim
15:37:35*c0ntribut0r quit (Ping timeout: 240 seconds)
15:37:53*c0ntribut0r joined #nim
15:45:15*MJCaley quit (Quit: MJCaley)
15:47:35*PMunch_ joined #nim
15:48:00*devdri quit ()
15:48:07*PMunch quit (Disconnected by services)
15:48:12*PMunch_ is now known as PMunch
15:49:28*arnetheduck quit (Ping timeout: 265 seconds)
15:50:53shashlickis it possible to convert a string into a variable name at runtime?
15:53:58*jxy quit (Quit: leaving)
15:55:49*gmpreussner joined #nim
15:57:55*jxy joined #nim
15:58:39PMunchshashlick, no
15:58:55PMunchVariable names aren't compiled into your binary so they wouldn't mean much on runtime
15:59:14PMunchBut what are you trying to do? There's probably another way to do it :)
15:59:57shashlickwell, I have an array of file names which I'm using to load a bunch of content from text files using staticRead
16:00:14*MJCaley joined #nim
16:00:42shashlickthat works fine but then I'm trying to pick the right const containing the filename but no way to do it without hard coding each file name
16:01:18PMunchWell in that case a table is probably the right choice
16:01:38PMunchhttps://nim-lang.org/docs/tables.html
16:01:45shashlickcan you have a table built at compile time with a macro?
16:02:45PMunchYou can do pretty much anything with a macro :P
16:03:06shashlickgood good, let me fidget
16:04:48*nsf joined #nim
16:06:36PMunchSo let me get this right. On compile-time you read in a bunch of files with staticRead. And on runtime you want the user to be able to select the correct file? In that case something like this would work: http://ix.io/EyA/
16:06:56PMunchstaticString is here just a way to emulate staticRead
16:07:27*gmpreussner quit (Ping timeout: 240 seconds)
16:07:50*gmpreussner joined #nim
16:08:06PMunchIf you look at the source code the call to staticString is completely gone and the string is inserted where it would normally be
16:12:32*gokr joined #nim
16:14:30shashlickinteresting
16:14:58shashlicki tried using staticRead in a template, but looks like I have to do that in a macro? or use this .compiletime. pragma
16:15:32*miran_ joined #nim
16:15:34PMunch.compileTime. is only for procs that get run on compileTime
16:15:42PMunchAll templates get run on compileTime
16:16:07PMunchDo you have a snippet that shows what you are doing?
16:16:44*MJCaley quit (Quit: MJCaley)
16:17:15shashlickhttps://gist.github.com/anonymous/d5eb0a2fa9715c179d3b80377358dd9d
16:19:11PMunchHmm, I'm guessing it's a problem with the walkDir
16:20:09shashlickError: 'staticRead' can only be used in compile-time context <= that's the error I get
16:20:44PMunchYeah
16:20:57PMunchwalkDir isn't run on compileTime
16:21:04PMunchSo it's not a compile time context
16:21:07*sz0 joined #nim
16:21:59PMunchHmm
16:22:07PMunchIt appears it doesn't work in a template at all
16:22:10PMunchThat's strange
16:22:40shashlickI just upgraded to a macro and I get a different error
16:22:57shashlickError: VM is only allowed to 'cast' between integers of same size
16:23:09PMunchUhm, with the same snippet?
16:23:31shashlickhttps://gist.github.com/anonymous/1662326c7d52f5ca0f3d9aade792d73c
16:25:40FromGitter<Bennyelg> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a6762040ad3e04b1b5b614a]
16:25:47FromGitter<Bennyelg> how to get this working ? :)
16:26:37PMunchshashlick, there are some different bugs there
16:26:54PMunchBut walkFiles doesn't work on compile time I think
16:29:10PMunchvarargs[$, string] ?
16:29:27PMunchOr the other way, don't quite remember
16:29:34PMunchBennyelg, ^
16:29:47FromGitter<Bennyelg> I''l try thanks!
16:31:19shashlickPMunch: so I removed walkfiles and hard-coded the files, now it doesn't like the fact that KEYMAPSTRING_TABLE is undeclared
16:31:23shashlicki guess I should resort to hard coding to proceed for now
16:31:53FromGitter<krux02> @Bennyelg: don't use auto
16:32:06FromGitter<Bennyelg> its not working anyway
16:32:14FromGitter<andreaferretti> @shashlick use a `static:` block
16:32:17FromGitter<Bennyelg> I am just throwing away things to see how to get this working
16:32:29FromGitter<andreaferretti> otherwise the var is just a runtime variable
16:33:01shashlickandreaferreti: do you have an example?
16:33:20FromGitter<krux02> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a6763d0e014122650809cf4]
16:33:20FromGitter<andreaferretti> No, but I would try something like this
16:33:27shashlickok found the documentation
16:34:08*MJCaley joined #nim
16:34:08FromGitter<andreaferretti> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a6764006117191e61a1afab]
16:34:45FromGitter<andreaferretti> I am not sure whether you can see the example over IRC
16:35:04FromGitter<andreaferretti> anyway, declare and populate your var in a static block
16:35:17FromGitter<andreaferretti> then assign it to a const at compile time
16:35:25FromGitter<krux02> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5a67644dce68c3bc74f3e7d3]
16:35:27FromGitter<andreaferretti> the const will be usable at runtime
16:35:50FromGitter<andreaferretti> Β @krux02 solution is even simler
16:36:23PMunchshashlick, this works fine here: http://ix.io/EyH/
16:37:55shashlickandreaferreti: I tried what you said, it complains with Error: cannot evaluate at compile time for const data = myTable
16:38:08FromGitter<Bennyelg> done πŸ’ƒ
16:40:14shashlickPMunch: your version also isn't compiling - Error: VM is only allowed to 'cast' between integers of same size
16:40:55shashlickPMunch: actually it worked - without walkfiles
16:41:22shashlickwill experiment with static and compiletime
16:41:24shashlickthanks for your help!
16:41:30*gokr quit (Ping timeout: 246 seconds)
16:41:44*clyybber joined #nim
16:45:03FromGitter<krux02> when you write code for the VM, only use int and float
16:45:13FromGitter<krux02> don't use sized integer types like float32 or uint32
16:49:33*c0ntribut0r quit (Ping timeout: 265 seconds)
16:52:00*endragor quit (Remote host closed the connection)
16:53:27*clyybber quit (Ping timeout: 240 seconds)
16:57:13*c0ntribut0r joined #nim
16:58:23shashlickprobably walkfiles is doing that internally, cause my code doesn't
17:01:45*yglukhov_ quit (Remote host closed the connection)
17:07:54*clyybber joined #nim
17:09:51FromGitter<data-man> @shashlick: Try walkDir (or walkDirRec) from oswalkdir.nim
17:10:03FromGitter<Yardanico> @ZarsBranchkin https://gitter.im/nim-lang/twitch - #nim-offtopic
17:11:40*endragor joined #nim
17:11:48*PMunch quit (Quit: Leaving)
17:12:56shashlickit uses the same underlying walkCommon() function which does some integer work, might be some implicit casting going on there
17:15:23*Trustable joined #nim
17:16:08FromGitter<ZarsBranchkin> Ooh, hah, was confused by the different name
17:16:29*endragor quit (Ping timeout: 255 seconds)
17:20:17*floppydh quit (Quit: WeeChat 2.0.1)
17:27:51*programisto quit (Quit: WeeChat 1.4)
17:28:38*endragor joined #nim
17:30:06*clyybber quit (Quit: good night)
17:30:14*clyybber joined #nim
17:30:14*clyybber quit (Client Quit)
17:30:30*clyybber joined #nim
17:30:30*clyybber quit (Client Quit)
17:30:46*clyybber joined #nim
17:30:46*clyybber quit (Client Quit)
17:30:54*clyybber joined #nim
17:30:54*clyybber quit (Client Quit)
17:31:10*clyybber joined #nim
17:31:10*clyybber quit (Client Quit)
17:31:26*clyybber joined #nim
17:31:26*clyybber quit (Client Quit)
17:31:52*clyybber joined #nim
17:31:52*clyybber quit (Client Quit)
17:32:00*clyybber joined #nim
17:32:00*clyybber quit (Client Quit)
17:32:15*clyybber joined #nim
17:32:15*clyybber quit (Client Quit)
17:32:31*clyybber joined #nim
17:32:31*clyybber quit (Client Quit)
17:32:42*clyybber joined #nim
17:32:42*clyybber quit (Client Quit)
17:32:50*clyybber joined #nim
17:32:50*clyybber quit (Client Quit)
17:33:06*clyybber joined #nim
17:33:06*clyybber quit (Client Quit)
17:33:09*c0ntribut0r quit (Ping timeout: 256 seconds)
17:33:22*clyybber joined #nim
17:33:22*clyybber quit (Client Quit)
17:33:26*endragor quit (Remote host closed the connection)
17:33:45*clyybber joined #nim
17:33:45*clyybber quit (Client Quit)
17:34:09*clyybber joined #nim
17:34:09*clyybber quit (Client Quit)
17:34:25*clyybber joined #nim
17:34:26*clyybber quit (Client Quit)
17:34:34*clyybber joined #nim
17:34:34*clyybber quit (Client Quit)
17:34:50*clyybber joined #nim
17:34:50*clyybber quit (Client Quit)
17:35:06*clyybber joined #nim
17:35:06*clyybber quit (Client Quit)
17:35:14*clyybber joined #nim
17:35:14*clyybber quit (Client Quit)
17:35:30*clyybber joined #nim
17:35:30*clyybber quit (Client Quit)
17:35:46*clyybber joined #nim
17:35:46*clyybber quit (Client Quit)
17:36:10*clyybber joined #nim
17:36:10*clyybber quit (Client Quit)
17:36:11*c0ntribut0r joined #nim
17:36:26*clyybber joined #nim
17:36:26*clyybber quit (Client Quit)
17:36:45*clyybber joined #nim
17:36:45*clyybber quit (Client Quit)
17:36:56*clyybber joined #nim
17:36:56*clyybber quit (Client Quit)
17:37:12*clyybber joined #nim
17:37:12*clyybber quit (Client Quit)
17:37:20*clyybber joined #nim
17:37:20*clyybber quit (Client Quit)
17:37:36*clyybber joined #nim
17:37:36*clyybber quit (Client Quit)
17:37:52*clyybber joined #nim
17:37:52*clyybber quit (Client Quit)
17:38:15*clyybber joined #nim
17:38:15*clyybber quit (Client Quit)
17:38:30*clyybber joined #nim
17:38:30*clyybber quit (Client Quit)
17:38:56*clyybber joined #nim
17:38:56*clyybber quit (Client Quit)
17:39:11*clyybber joined #nim
17:39:11*clyybber quit (Client Quit)
17:39:26*clyybber joined #nim
17:39:26*clyybber quit (Client Quit)
17:39:41*clyybber joined #nim
17:39:41*clyybber quit (Client Quit)
17:39:56*clyybber joined #nim
17:39:56*clyybber quit (Client Quit)
17:40:11*clyybber joined #nim
17:40:11*clyybber quit (Client Quit)
17:40:27*clyybber joined #nim
17:40:27*clyybber quit (Client Quit)
17:40:43*clyybber joined #nim
17:40:43*clyybber quit (Client Quit)
17:40:52*clyybber joined #nim
17:40:52*clyybber quit (Client Quit)
17:41:08*clyybber joined #nim
17:41:08*clyybber quit (Client Quit)
17:41:32*clyybber joined #nim
17:41:32*clyybber quit (Client Quit)
17:46:56*natrys quit (Quit: natrys)
17:47:49*couven92 quit (Quit: Client disconnecting)
17:49:44*gokr joined #nim
17:53:12GitDisc<awr> Can I use assembly in nimscript (the reason: so i can use cpuid to see the available ISA extensions to pass to a c compiler to build a project) or is that a flat-out "lol no use nake instead"
17:54:06*clyybber joined #nim
17:54:07*MJCaley quit (Read error: Connection reset by peer)
17:54:40*MJCaley joined #nim
17:54:51GitDisc<awr> parsing `cat /proc/cpuinfo` and looking up ISA extensions from there isn't portable to windows
17:58:59*clyybber quit (Client Quit)
18:01:56*MJCaley quit (Quit: MJCaley)
18:06:50Araqlol no use nake instead
18:07:25GitDisc<awr> got it
18:07:29GitDisc<awr> thx
18:11:56*stisa joined #nim
18:16:14GitDisc<treeform> what is a good way to format floats in nim? I was looking at https://bitbucket.org/lyro/strfmt, but it has bugs like `(0.5).format("0.2f")` outputs `0.00`
18:24:50*sz0 quit (Quit: Connection closed for inactivity)
18:26:05miran_@treeform - have you tried to use `import strformat`?
18:26:30miran_you might need devel version of nim for it
18:28:18FromGitter<ZarsBranchkin> and what about https://nim-lang.org/docs/strutils.html#formatFloat,float,FloatFormatMode,range[],Char ?
18:29:18shashlickwalkFiles() is not working in the VM since it calls getFilename() internally which does a cast - $cast[WideCString](addr(f.cFilename[0]))
18:32:42shashlickthis is on Windows
18:32:47shashlickhowever, this works - https://gist.github.com/56d362417db90c6b3d0a2ff0fdcbec2d
18:32:53shashlickso there's something weird going on here
18:33:36FromGitter<krux02> shashlick: 502 Bad Gateway
18:34:04shashlickweird - that's on github?
18:34:24FromGitter<krux02> well when I click it I see it
18:34:31FromGitter<krux02> it's just the embeddeng that doesn't wrok
18:37:40GitDisc<awr> nimscript gives you listFiles (which isn't an iterator)
18:43:28GitDisc<treeform> @miran_ `Error: cannot open 'strformat'`
18:44:19*yglukhov joined #nim
18:44:56GitDisc<awr> https://nim-lang.org/docs/strutils.html#formatFloat,float,FloatFormatMode,range[],Char ?
18:47:00GitDisc<treeform> hmm `(0.312).formatFloat(precision=1)` out puts `0.312` but it should output `0.3`
18:47:36GitDisc<treeform> oh `(0.312).formatFloat(ffDecimal, precision=1)` works
18:47:54shashlick@awr: thanks will check it out
18:50:06shashlick@awr: unable to use listFiles() in this way - listFiles() not found, and cannot import nimscript
18:50:32*Trustable quit (Remote host closed the connection)
18:54:52GitDisc<treeform> got my charts drawing in nim:
18:54:53GitDisc<treeform>
18:54:54GitDisc<treeform> https://cdn.discordapp.com/attachments/371759389889003532/405435238735675414/unknown.png
18:55:36*yglukhov quit (Read error: Connection reset by peer)
18:56:12*yglukhov joined #nim
19:01:11GitDisc<awr> @shashlick
19:01:36GitDisc<awr> as a silly hack you could do gorge("ls -1p").splitLines.filterIt(not it.endsWith("/"))
19:02:21shashlickgood point, will have to make it portable but that's a good ide
19:02:56GitDisc<awr> you may have to figure out how to prevent it from caching
19:07:14*yglukhov quit (Remote host closed the connection)
19:15:24*stisa quit (Remote host closed the connection)
19:22:12*yglukhov joined #nim
19:33:02*yglukhov quit (Remote host closed the connection)
19:51:54*Vindaar joined #nim
19:53:31*yglukhov joined #nim
20:09:26*scriptum joined #nim
20:15:56*yglukhov quit (Remote host closed the connection)
20:16:31*yglukhov joined #nim
20:19:26*Ven`` joined #nim
20:36:13*miran_ quit (Quit: Konversation terminated!)
20:36:15*Yardanico quit (Ping timeout: 248 seconds)
20:37:46*ofelas quit (Quit: shutdown -h now)
20:39:37*ofelas joined #nim
20:45:25*gangstacat quit (Quit: Ĝis!)
21:01:46*Jesin joined #nim
21:04:03*gangstacat joined #nim
21:09:20*Vladar quit (Quit: Leaving)
21:14:49*clyybber joined #nim
21:16:30FromGitter<wiltonlazary> Dear, im talking to people of https://github.com/vadimcn/vscode-lldb, its apears that is not too hard to add Nim language suport to this great debug tool.
21:23:39*devdri joined #nim
21:28:02*yglukhov quit (Remote host closed the connection)
21:29:09*beatmox quit (Remote host closed the connection)
21:29:40*beatmox joined #nim
21:36:05*stisa joined #nim
21:38:56*solitudesf quit (Quit: solitudesf)
21:44:01*solitudesf joined #nim
21:53:12*benoliver999 left #nim ("WeeChat 2.0.1")
21:53:26*xkapastel joined #nim
21:54:03*Ven`` quit (Ping timeout: 246 seconds)
21:56:03*Ven`` joined #nim
21:56:47*clyybber quit (Ping timeout: 248 seconds)
21:59:32FromGitter<honewatson> With nimble is there a way to install a package so it will save the dependency to your project? Something like... ⏎ ⏎ ```nimble install templates --save-dep``` [https://gitter.im/nim-lang/Nim?at=5a67b044ce68c3bc74f5b254]
22:00:41*clyybber joined #nim
22:02:40*Jesin quit (Quit: Leaving)
22:03:20*nsf quit (Quit: WeeChat 2.0.1)
22:08:05*Ven`` quit (Ping timeout: 240 seconds)
22:08:30FromGitter<Quelklef> Or some way to make Nim virtual enviros?
22:09:39*yglukhov joined #nim
22:11:09*Ven`` joined #nim
22:12:24*rauss quit (Quit: WeeChat 2.0.1)
22:14:11*rauss joined #nim
22:15:12*tinAndi joined #nim
22:15:24*clyybber quit (Ping timeout: 246 seconds)
22:25:54FromGitter<matrixbot> `pqflx3` 'nimble develop' clones a package to a local dir
22:28:41FromGitter<Quelklef> I don't think that's quite what he's looking for
22:31:09FromGitter<honewatson> Yes I want to manually avoid typing in the dependency
22:51:11*solitudesf quit (Ping timeout: 248 seconds)
22:53:45*Ven`` quit (Ping timeout: 264 seconds)
22:56:23*devdri quit ()
22:59:03*Ven`` joined #nim
22:59:05*xet7 quit (Ping timeout: 240 seconds)
22:59:09*tinAndi quit (Ping timeout: 265 seconds)
23:00:25*tinAndi joined #nim
23:08:37*Ven`` quit (Ping timeout: 256 seconds)
23:11:55*Ven`` joined #nim
23:12:53GitDisc<treeform> Can some one help me with macros? I want to convert this code to work with JS: https://gist.github.com/treeform/929915fae3ce5923df69e940d2b657c7 I think right now it produces a bunch of `stdout.write`s but I need it to produce `echo foo & foo & foo` type of thing instead i think?
23:14:15*xet7 joined #nim
23:15:57*vlad1777d joined #nim
23:17:58FromGitter<tim-st> Why doesnt `echo uint64.high` work?
23:22:09FromGitter<Quelklef> `high(uint64)` isn't a thing. Hardcode it.
23:22:44FromGitter<tim-st> I was just interested for planning a structure, but I use int64.high*2 now
23:23:19*Ven`` quit (Read error: Connection reset by peer)
23:23:24*Ven` joined #nim
23:25:58FromGitter<tim-st> Btw is it a good idea to give every node in a tree an int to allow quick relation check instead of iterating through tree?
23:29:03GitDisc<treeform> nvm solve my own problem! thanks
23:29:08GitDisc<treeform> nvm solved my own problem! thanks
23:39:33*arnetheduck joined #nim
23:54:24*yglukhov quit (Remote host closed the connection)