<< 17-09-2018 >>

00:03:36*rockcavera joined #nim
00:30:53*stefanos82 quit (Quit: Quitting for now...)
00:31:50FromGitter<dm1try> > Error: illegal capture 'result' ⏎ ⏎ I think you cannot mix nim closure proc(they have implicit for environment) with the callback of used lib. I might use proc suitable for native callback and provide the created object as argument to this callback
00:34:20FromGitter<dm1try> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9ef68cd655361f760d657c]
00:35:08FromGitter<dm1try> feel free to ignore, it just my assumption =)
00:35:44FromGitter<dm1try> I never did such things
00:41:02FromGitter<dm1try> if Knob is defined as `ref` this^ should work seamlessly if I not missing something
00:47:33*abm quit (Ping timeout: 245 seconds)
00:52:24*x023 joined #nim
00:56:03*x023 quit (Remote host closed the connection)
00:56:19*dddddd quit (Remote host closed the connection)
01:07:18*SenasOzys quit (Remote host closed the connection)
01:09:24*SenasOzys joined #nim
01:09:46krux02is someone here online using emacs in nim?
01:11:18*SenasOzys quit (Remote host closed the connection)
01:11:26zestyryep
01:13:15*SenasOzys joined #nim
01:15:48*SenasOzys quit (Remote host closed the connection)
01:16:38*SenasOzys joined #nim
01:18:22krux02zestyr, do you have problems with the performance of nim-mode?
01:19:09zestyrnot particularly, but I can't get the flycheck part working, it just constantly gives a large amount of errors starting at the imports
01:19:43krux02zestyr, I got that part working. But it is a mess to get it right.
01:19:50krux02and then it is horribly slow
01:20:00krux02blocking your input
01:21:20zestyryeah I've seen your PRs, shame the maintainer seems to be gone
01:21:37krux02I think so, too.
01:21:56krux02I wrote an e-mail asking if I could take over maintaining the project.
01:22:38krux02But I think I hurt the feelings of yuutayamada
01:23:08FromGitter<kaushalmodi> krux02: Why did he say so in a reply? Or didn't reply at all?
01:23:30FromGitter<kaushalmodi> I have couple of my PRs hanging for nim-emacs-module too for a while
01:23:42FromGitter<kaushalmodi> Looks like he's missing in action on GitHub for a while now
01:23:49FromGitter<kaushalmodi> may be some other priorities?
01:24:10krux02I opened several issues "permoremacs issues made feature X unusable and therefore I have to disable it to keep the mode usable"
01:24:24krux02and I did so with almost all features including syntax highlighting.
01:24:34krux02at least syntax highlighting is fixed in my PR.
01:24:49krux02but that doesn't help other people if it doesn't get merged.
01:25:25krux02kaushalmodi: basically yuutayamada stopped replying to my issues at all.
01:25:38krux02I think I was just too annoying.
01:26:18FromGitter<kaushalmodi> I think he has just stopped using Nim (and/or emacs) and so is not interested?
01:26:24zestyrHe hasn't really been active on github since late October though
01:26:26krux02and on top of that, I had no idea of emacs. So I had sorts of problems that have nothing to do with nim mode but are general emacs usability quirks.
01:27:13krux02well he is not getting payed, but I wrote an e-mail, too aking if I can take over maintaining nim-mode. But also no reply.
01:27:57FromGitter<kaushalmodi> well, let's hope he's doing fine physically
01:28:38krux02well yes, let's hope he just can't stand me anymore and that is the reason he doesn't answer to me at all.
01:28:52krux02:P
01:29:42krux02but since I fixed syntax highlighting performance issues, I am now in the vibe to improve nimsuggest performance problems as well.
01:29:58krux02I also want it to work by default.
01:30:04krux02no weired error messages
01:30:11zestyrnimsuggest could definitely use some love
01:30:37krux02you mean nimsuggest or nimsuggest emacs integration?
01:30:58krux02currently I have no idea how nimsuggest is integrated in emacs.
01:31:13krux02but at least by now elisp isn't a totally strange language to me anymore.
01:31:23krux02it is maintainable.
01:31:44FromGitter<kaushalmodi> elisp is awesome! Looks like you are starting to see that "light" :)
01:31:46krux02developing elisp in emacs is quite fun
01:32:23krux02well, not sure about "awesome" but it certainly has some greats aspects of it.
01:32:54krux02I really like for example that it is an always running lisp maching where I can add and reload functions arbitrarily.
01:33:29krux02a very hacky language that allows to change functions from a library.
01:33:47krux02you shouldn't do it, but it works and that is great.
01:33:50FromGitter<kaushalmodi> that's what's awesome; you can hijack anything in emacs using elisp
01:34:07FromGitter<kaushalmodi> make 'a' type 'b' and 'b' type 'c' if you want :P
01:34:45FromGitter<kaushalmodi> wait till you learn about the nadvice system (if you haven't already)
01:34:55krux02there are still things in emacs that I simply can't stand and I won't change my opinion.
01:35:02krux02but that has nothing to do with elisp
01:35:05FromGitter<kaushalmodi> you can advise whole functions, just the return value or just the arguments, whatever
01:36:02krux02I have no idea what you mean
01:38:22krux02the thing that I can't stand it emacs is that by default it his it's own idea of how to abuse your frames for displaying stuff.
01:39:11FromGitter<kaushalmodi> krux02: You have mentioned that before
01:39:24FromGitter<kaushalmodi> You configure that behavior as you like using the display-buffer-alist
01:39:33krux02for example helm shows a list of buffers and does so picking a random window/frame and showing a buffer with tha list of buffers.
01:39:50FromGitter<kaushalmodi> If that's too low level, look into the shackle package (that I also mentioned earlier)
01:40:12FromGitter<kaushalmodi> shackle is like sugar syntax for display-buffer-alist
01:40:20FromGitter<kaushalmodi> it's not random
01:40:54krux02to me it's random
01:41:06zestyrtry ivy instead of helm
01:41:15krux02maybe I will do.
01:41:38krux02I never used anything else than helm
01:41:48zestyrit uses the minibuffer to display stuff
01:41:53FromGitter<kaushalmodi> +1 for ivy
01:41:57krux02does ivy have fuzzy finding as well?
01:42:00zestyryes
01:42:04krux02ok
01:42:09krux02is ivy built into emacs?
01:42:14zestyrno
01:42:26FromGitter<kaushalmodi> About advice system, if interested, you can find examples in my config: https://github.com/kaushalmodi/.emacs.d/search?o=desc&q=advice-add&s=indexed
01:42:32krux02but it does have tab completion doesn't it?
01:42:40krux02that is what was most disturbing in helm.
01:43:06FromGitter<kaushalmodi> krux02: that's why helm never stuck for me, and also the way it used windows instead of minibuffer
01:44:35krux02well sometimes there is a lot of stuff to complete.
01:45:06FromGitter<kaushalmodi> minibuffer is just fine.. you never scroll and manually sort through hundreds of entries
01:45:22krux02for example helm git grep is quite nice
01:45:37krux02does that exist in ivy as well?
01:45:41FromGitter<kaushalmodi> yes
01:46:06FromGitter<kaushalmodi> replace helm-* stuff with counsel-*
01:46:20FromGitter<kaushalmodi> replace helm-\* stuff with counsel-\*
01:46:35krux02counsel?
01:46:52FromGitter<kaushalmodi> ivy is the engine, the low level component
01:47:02FromGitter<kaushalmodi> counsel is the user-facing library that uses ivy
01:47:17FromGitter<kaushalmodi> both are by the same ivy developer Abo Abo
01:49:39krux02ok, sounds cool
01:51:06krux02kaushalmodi: I have a strange error in emacs/nim-mode btw
01:51:21krux02for some reason nim-mode was not loaded
01:51:34krux02the mode was not set automatically
01:51:54FromGitter<kaushalmodi> you need to set the auto load alist correctly
01:51:59FromGitter<kaushalmodi> (and I think it is, already)
01:52:19krux02then I put some linebreaks here: https://github.com/nim-lang/nim-mode/pull/201/commits/63d4315429c54f5edd92d2a6b328c9b4e7f50642
01:52:32krux02after the autoload and then everything worked
01:53:09FromGitter<kaushalmodi> this is what causes .nim files to autoload nim-mode
01:53:10FromGitter<kaushalmodi> https://github.com/nim-lang/nim-mode/blob/35f4b2cb2d4c142f6f7f0e3ffb06c87b81bb8c26/nim-mode.el#L237
01:53:18krux02just the changes in the file nim-mode.el are relevant
01:53:51krux02yea but I needed to add the newline there, otherwise the mode wasn't loaded correctly.
01:54:00FromGitter<kaushalmodi> hmm.. yeah.. the ###autoload cookies should be on their own lines
01:54:18FromGitter<kaushalmodi> the reason I never caught that issue is that I set the autoloads for nim myself in use package
01:54:20FromGitter<kaushalmodi> .. let me check
01:54:22krux02and now all of a sudden tests are failing on the server, because the language is not set
01:54:32krux02but that didn't happen on that change
01:54:43krux02it happened many commits later
01:55:00FromGitter<kaushalmodi> yep, I let those auto-loads myself :D
01:55:01FromGitter<kaushalmodi> https://github.com/kaushalmodi/.emacs.d/blob/master/setup-files/setup-nim.el#L8
01:55:06FromGitter<kaushalmodi> so I never caught that bug
01:56:45FromGitter<kaushalmodi> actually I take it back
01:56:51FromGitter<kaushalmodi> your refactoring is wrong
01:57:00krux02ah never mind I found the error
01:57:09FromGitter<kaushalmodi> the autoload cookies are by themselves on a line only on top of fn definitions
01:57:14krux02I renamed a defvar and now it is causing problems
01:57:17FromGitter<kaushalmodi> in your case, that line has to be executed
01:57:21krux02even though locally I did not have that problem
01:57:36FromGitter<kaushalmodi> so revert that autoload on its own line first of all
01:58:05krux02ok thanks a lot
01:58:08krux02I have to sleep now
01:58:16krux02it is already 4:00 in the morning
01:58:39krux02but thank you I now know where i have to look
01:58:59*krux02 quit (Remote host closed the connection)
02:00:02FromGitter<kaushalmodi> actually I take back what I asked to take back, hehe
02:00:13FromGitter<kaushalmodi> looking at the source: http://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/progmodes/elisp-mode.el#n948
02:00:48FromGitter<kaushalmodi> looks like it's OK to have autoload on its own line even when executing a lisp form
02:21:34*ebx1000 quit (Read error: Connection reset by peer)
02:39:35*epon11 joined #nim
02:41:51*gangstacat joined #nim
02:42:31*epon11 quit (Remote host closed the connection)
02:47:02FromGitter<gogolxdong> @zacharycarter How is your hyperHTML porting?
03:28:51*harrynoob joined #nim
03:35:07*harrynoob quit (Ping timeout: 240 seconds)
04:22:15*rkeene17 joined #nim
04:27:30*rkeene17 quit (Ping timeout: 252 seconds)
04:35:08zestyrIs there a way to handle optional return types? I'm dealing with an API that either returns a "Message" object, or "true" depending on the input, and need to make a function that returns either value
04:35:32zestyrI could use a tuple but that kinda seems like a hack
04:35:43FromGitter<bung87> options module
04:35:58zestyrthat only allows for one type though
04:37:02*nsf joined #nim
04:37:08FromGitter<bung87> then use a custom object
04:39:48*SenasOzys quit (Remote host closed the connection)
04:40:34*SenasOzys joined #nim
04:40:37FromGitter<jrfondren> an API that either returns a Message object, or true ⏎ so: either some(Message), or none(Message)
04:41:02FromGitter<jrfondren> is there a third kind of return that you need to handle?
04:42:04narimiran[m]return a tuple (bool, Message)?
04:42:47FromGitter<bung87> I think it’s a API design problem.
04:42:49zestyrI think it'll have to be (bool, Option[Message]), as I can't use nil for the message field.
04:43:11zestyrIt's a bad design I agree.
04:43:13zestyrhttps://core.telegram.org/bots/api#editmessagetext
04:43:18*SenasOzys quit (Remote host closed the connection)
04:43:20zestyr"On success, if the edited message was sent by the bot, the edited Message is returned, otherwise True is returned."
04:43:21FromGitter<jrfondren> the API *sounds* fine. You get something or you get nothing. It's just confusing because the nothing is 'true'
04:43:22FromGitter<bung87> tuple seems good enough
04:43:41FromGitter<jrfondren> the tuple lets you encode absurd states, like (bool, some(Message))
04:43:48FromGitter<jrfondren> er, (false, some(Message))
04:43:49*SenasOzys joined #nim
04:46:07zestyrthat works, thanks
04:46:48*SenasOzys quit (Remote host closed the connection)
04:47:18*SenasOzys joined #nim
04:53:15*miran joined #nim
05:06:57*kapil___ joined #nim
05:28:33*leorize quit (Ping timeout: 252 seconds)
05:35:50FromGitter<Bennyelg> VS-Code yield undefined identifier but source code compile well. looks like the errors shown only when Thread module is used or Threadpool
05:50:23*leorize joined #nim
05:56:58FromGitter<bung87> it doesnot know you compile with thread:on
05:59:45FromGitter<bung87> I have not read nim cfg manual, if I get enough info I can fix that for vscode-nim
06:14:54*miran quit (Ping timeout: 264 seconds)
06:41:30Tangerbung87: Hey mate, I'm not too familiar with VSCode, but if you can get it to read a .nims or .nim.cfg (which it should by default if one is present in the path of the file you're compiling, you can try putting in `switch("threads", "on")` on
06:45:18FromGitter<bung87> ah so I can read the config file and send args to nimsuggest ⏎ (not sure whether nimsuggest support currently) I’ll try it
06:45:27FromGitter<bung87> thanks !
06:49:10FromGitter<Bennyelg> I'lll try too thanks
06:54:49*skelett joined #nim
07:00:02*hcsiftrewq is now known as qwertfisch
07:00:38FromGitter<Bennyelg> Works Like magic
07:03:08*xet7 quit (Quit: Leaving)
07:04:49FromGitter<Bennyelg> it has disappeared for a moment but then came back :/
07:14:38FromGitter<alehander42> so, what is the best way to get a "shared" view of a subseq?
07:14:54FromGitter<alehander42> e.g. a[1 .. ^1] without making a copy (just data pointing to original data[1])
07:23:54FromGitter<alehander42> I mean i remember the view/slice discussions I and found a lot of them right now, but I can't seem to find what happened in the end
07:24:24FromGitter<alehander42> e.g. https://github.com/nim-lang/Nim/pull/5957
07:24:55FromGitter<alehander42> (with shared, I meant, non-copying, sorry)
07:33:01*kapil___ quit (Quit: Connection closed for inactivity)
07:46:19*PMunch joined #nim
08:03:27*leorize quit (Ping timeout: 240 seconds)
08:03:29*floppydh joined #nim
08:03:49*gmpreussner_ joined #nim
08:05:20*gmpreussner quit (Ping timeout: 272 seconds)
08:05:48*leorize joined #nim
08:07:21*TheLemonMan joined #nim
08:12:27*ftsf joined #nim
08:16:22*xet7 joined #nim
08:19:37*abm joined #nim
08:24:26*ftsf quit (Quit: Leaving)
08:28:31*NimBot joined #nim
08:39:32*Vladar joined #nim
08:58:06*Ipsilon12 joined #nim
09:00:02*Ipsilon12 quit (Killed (Sigyn (Spam is off topic on freenode.)))
09:05:34c15ade4where has nim been hiding all my life
09:05:36c15ade4its so much fun
09:06:56*ftsf joined #nim
09:08:28FromGitter<codenoid> as nim user, are you more prefer todo with camel-case or snak-case
09:08:58FromGitter<Vindaar> camelCase
09:09:51*leorize quit (Ping timeout: 250 seconds)
09:13:30PMunchThat being said Nim is style insensitive, so someCase is the same identifier as some_case
09:13:56PMunchSo if you write your code in snake case it's still possible to use it in camel case
09:14:20PMunchOnly character that is case-sensitive is the first one
09:14:40PMunchSo SomeCase is not the same identifier as someCase or some_case
09:14:48PMunchBut it is the same as Some_case
09:15:03PMunchThis is to allow you to have classes with upper case letters
09:15:04FromGitter<alehander42> yeah you can write a lib in snake_case and it wouldn't matter for your users
09:18:39PMunchHmm, would it be possible to make a Nim proc that takes a procedure ignore optional parameters?
09:18:54PMunchI tried to map the procedure strip over a sequence of strings
09:19:35PMunchBut it doesn't work since strip is not a proc (x: T): S
09:19:50PMunchHowever if you ignore the optional parameters it is
09:21:00FromGitter<narimiran> but shouldn't optional parameters be.... well.... optional?
09:22:13PMunchYes, but I'm opting not to use any here
09:22:22PMunchWhat I have to do: for key in toggleExpand.split('+').map(proc (x: string): string = x.strip):
09:22:34PMunchWhat I'd want to do: for key in toggleExpand.split('+').map(strip):
09:22:55PMunchI have to wrap strip in a procedure that hides the optional parameters
09:23:35FromGitter<alehander42> ahh
09:24:14FromGitter<narimiran> strange, `strip` without optional parameters works for a single string, but i doesn't work when it is used inside of a map/mapIt
09:24:42PMunchYeah, that's my point
09:24:56FromGitter<narimiran> is this a bug?
09:25:11PMunchI don't know, might be intentional, but I'm not sure why
09:25:40FromGitter<alehander42> i guess map just expects a proc with one T argument
09:25:48FromGitter<alehander42> and the signatures don't match on a type level
09:25:49PMunchI mean strip doesn't strictly have the proc (x: T): S signature, event though it can have it
09:26:19FromGitter<alehander42> proc types are very delicate to match
09:26:36FromGitter<alehander42> i feel like every little difference resulted in mismatch for me before
09:29:38FromGitter<narimiran> PMunch will you open an issue (or will i)?
09:30:30PMunchI'm currently looking at the issue tracker to see if there is one
09:42:26PMunchhttps://github.com/nim-lang/Nim/issues/8987
09:47:14*Vladar quit (Remote host closed the connection)
09:47:38*Vladar joined #nim
09:48:34*hjko joined #nim
09:55:53*hjko quit (Quit: Page closed)
10:03:00PMunchhttp://ix.io/1mRz/Nim
10:03:12PMunchAny idea what's wrong?
10:09:35FromGitter<narimiran> not the same types in the seq?
10:10:03FromGitter<bung87> how to have iterator param that as default value, I always get type didnot match,like this ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9f7d7abe4f300626a74844]
10:10:28PMunchnarimiran, but as you can see they are the same type..
10:10:37FromGitter<bung87> `proc initMinHasher*T (num_seeds:int, tokenizer:iterator (x:string) : (string,int)):MinHasher[T]=`
10:10:53FromGitter<bung87> ```code paste, see link```
10:12:21PMunchHmm @narimiran, apparently this works: "actions.add (modmask: modmask, keysym: keysym, call: proc (ev: TXKeyEvent) {.closure.} = toggleExpandHandler(ev))"
10:12:26PMunchSo it's just the pragmas..
10:12:37FromGitter<narimiran> PMunch: first `call` is "proc (ev: TXKeyEvent){.closure.}", the second one is "proc (ev: TXKeyEvent){.gcsafe, locks: 0.}"
10:12:42FromGitter<alehander42> btw do you guys use `~` for something?
10:12:58FromGitter<alehander42> i want to use it in a dsl but i wonder if people hate it
10:13:36FromGitter<narimiran> @alehander42 numerical libs use it in combination with `=` for "almost the same" in `=~` or `~=`. i haven't seen it used on its own
10:13:41PMunchalehander42, it's a pain to type on my keyboard..
10:14:00PMunchnarimiran, yeah but why does that matter..
10:14:11PMunchI never specified that it had to be a closure in the first place..
10:14:22FromGitter<narimiran> PMunch: i have no idea. no experience with pragmas here
10:15:07PMunchvar actions = newSeq[tuple[modmask: int, keysym: TKeySym, call: proc (ev: TXKeyEvent)]]()
10:15:34PMunchThat's how the sequence is defined, but for some reason it says that call has to be a closure
10:16:05PMunchEven if I add a {.gcsafe, locks: 0.} pragma tag to it it converts it to {.closure, gcsafe, locks: 0.}
10:16:15FromGitter<alehander42> @narimiran yeah i use it like `~name` so it doesn't clash
10:16:34FromGitter<alehander42> @PMunch ugh that sucks, how do people write destructors with your keyboard ?
10:16:47*zachcarter quit (Ping timeout: 240 seconds)
10:16:47FromGitter<alehander42> is it typical to your country layout?
10:16:59FromGitter<narimiran> i guess `AltGr+ something`?
10:17:17FromGitter<alehander42> yeah but I mean that `~` is relatively popular in some prog languages
10:17:21FromGitter<bung87> @alehander42 if you dont do something like this ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9f7f31a56b215c974deb9c]
10:17:45FromGitter<narimiran> btw, my colleague uses croatian keyboard and he has trouble with a backtick
10:18:02FromGitter<alehander42> haha ~ and backtick are on the same key for me
10:18:03FromGitter<narimiran> (...and with square brackets, and lots of other 'normal' stuff)
10:18:28FromGitter<alehander42> well that's very sad, I'd use `%` or `^` but it adds much more noise
10:18:29PMunch@alehander42, yes it's like this by default on our keyboard. You have to do AltGr + <key with tilde on> and then hit a space
10:18:46FromGitter<alehander42> hm for me it's just shift + backtick
10:19:02FromGitter<alehander42> backtick is literally first class on my kb dunno why
10:19:03PMunchbacktick is already shift+\ for me :P
10:19:16PMunchWhich kinda makes sense
10:19:16FromGitter<narimiran> oh and \ is also altgr combination on croatian layout
10:19:19FromGitter<alehander42> §
10:19:31FromGitter<alehander42> i have this weird symbol too as shift + bulgarian key
10:19:48PMunchThe idea with tilde is to be able to create things like ñ and ­õ
10:19:57PMunchNot that they are used in Norwegian though..
10:20:21FromGitter<narimiran> and he writes a lots of latex, where \ is used quite a lot, but he refuses to use international standard layout
10:21:23PMunchHmm, apparently adding {.nimcall.} to the proc in the tuple works..
10:21:26FromGitter<alehander42> well , if he finds it ok, no problem
10:22:48FromGitter<narimiran> PMunch: that's good to know. i'll probably stumble on that one day, and ask you if you remember how did you fix it (instead of writing it down right now ;))
10:23:16FromGitter<alehander42> ugh `^` looks weird
10:24:04FromGitter<narimiran> @alehander42 what is there left? `*`? `@`?
10:25:43FromGitter<alehander42> `*` wouldn't work for my case
10:25:47FromGitter<alehander42> `@` too
10:26:14FromGitter<alehander42> i match stuff, so i already use them: `*` for multiple matches etc
10:32:53PMunch&%¤#£¡§¦±«þ¥ªç®€ıß×µ unused characters that only require a single modifier to type on my layout :P
10:46:13*Arrrr joined #nim
10:46:57*stefanos82 joined #nim
10:50:08ArrrrCan't nim infer the type of an enum inside a set/array? For example: {A, B, C}, if a is of type Letter and B can be of type Letter/Button, if should be able to disambiguate
10:51:37*dddddd joined #nim
10:52:23PMunchArrrr, what do you mean? This works fine http://ix.io/1mRG/Nim
10:52:40FromGitter<alehander42> @PMunch yeah but `&` and `%` already are a bit ambigious :(
10:53:12PMunchYeah I was just trying to highlight how silly my layouts symbol choices are..
10:53:41PMunchBest is shift+4 which gives ¤
10:53:45FromGitter<alehander42> yeah :D
10:53:51PMunchI've never seen that used in my life!
10:53:52FromGitter<alehander42> honestly i am sticking with `~` for now
10:54:10*vivus joined #nim
10:54:29FromGitter<alehander42> maybe they use it for the city square-s
10:54:38FromGitter<alehander42> maybe you live on that symbol
10:55:11ArrrrI don't see muhc in that snippet. In devel, my example would complain
10:58:14PMunchalehander42, nope. It's a "currency" symbol. Back before Unicode they had an issue that if I type $100 in an e-mail and you opened it on a computer with a british character encoding it would show £100. To circumvent this confusion they came up with a generic "currency" symbol, the ¤ which was intended to take the character code-point of £, $, and other currency symbols. This would mean that it was up to the reading to decide which currency was most like
10:58:14PMunchly intended.
11:07:42*Cthalupa quit (Ping timeout: 252 seconds)
11:09:57*Cthalupa joined #nim
11:20:30*ahiknsr23 joined #nim
11:21:17*ahiknsr23 quit (Remote host closed the connection)
11:25:01FromGitter<bung87> how to give a API let user provide a iterator?
11:27:06FromGitter<alehander42> you can always use a concept
11:27:06FromGitter<bung87> or should I let user provide a iterator factory proc?
11:28:04*krux02 joined #nim
11:32:26FromGitter<bung87> ```type ⏎ MinHasher*[T] = object ⏎ ⏎ tokenizer:SomeConecpt ???``` [https://gitter.im/nim-lang/Nim?at=5b9f90ca1ee2ca65022bb3a3]
11:32:53FromGitter<alehander42> I guess you can do
11:33:32FromGitter<alehander42> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9f910cfcba1254facaeb6d]
11:34:30FromGitter<alehander42> but actually i have no idea if the c generation can put "an iterator" in a field
11:35:49FromGitter<bung87> well, make more complicated
11:36:30FromGitter<bung87> in python or js it’s just a function..
11:37:15TheLemonManwhat is `tokenizer` supposed to do?
11:37:39FromGitter<bung87> `iterator (x:string) : (string,int)`
11:38:31TheLemonManmake it a closure iterator if you really want it to be an iterator
11:39:35FromGitter<bung87> when it’s closure it just iterate once
11:39:43TheLemonManno?
11:46:38krux02yay a PR on nim-mode got merged
11:53:21FromGitter<bung87> https://github.com/Nim-NLP/minhash/blob/master/src/minhash.nim#L63 if I use direcly `slide ` this will work
11:59:15*enthus1ast joined #nim
11:59:53enthus1astwhich module would you use for syntax highlighting nim code for a website?
12:00:00enthus1astrstgen?
12:01:34*SenasOzys quit (Ping timeout: 240 seconds)
12:01:47FromGitter<bung87> generally it’s about js lib
12:07:21TheLemonManbung87, uh that's weird, it should work the same
12:07:30*zachcarter joined #nim
12:07:38TheLemonManway it does if you declare it as inline
12:08:06zachcarterit's not possible to resolve a value generated at runtime inside of a macro - is it? krux02 showed me something the other day - but I don't think that was a runtime value
12:08:23zachcartersince macros are resolved at compile time
12:08:48krux02macros are compile time only
12:08:51FromGitter<bung87> when it’s in global namespace it has no diffriences between inline or closure,
12:08:59krux02they don't exist at runtime anymore
12:09:12zachcarterokay
12:09:13krux02so they can't access any runtime value
12:09:21zachcartergotcha that makes sense - thank you
12:09:27FromGitter<bung87> in mine case , I declare all closure, but didnot work
12:09:30zachcarterI guess what I've been trying to do is impossible then
12:09:42zachcarterI'll need to figure out another way
12:09:45krux02zachcarter, what do you try to yo then?
12:10:00krux02I macros are for compile time code generation.
12:10:22zachcarterwell - I am using emerald, but with some modifications to generate templates at compile time for HTML using a DSL
12:10:23krux02so I don.t understand how you got to the idea to access a runtime value from there
12:10:43krux02that is a bit meta
12:10:47zachcarterhaha
12:11:15krux02emaralds are mostly a sonic the Hedgehog thing to me.
12:11:16zachcarteryeah - I haven't really used macros extensively so it was my naievety / not realizing what emerald was producing wasn't going to be available at compile time
12:11:20zachcarter:P
12:11:21zachcarterhttp://flyx.github.io/emerald/
12:12:03krux02with html you have two categries of templates
12:12:42krux02you have the nim templates that are evaluated at nim compilation time, and you have the html templates that are evaluated at html generation time (runtime)
12:13:14krux02so talking about "templates" in a nim chat when you mean html-templates can be very confusing.
12:13:19krux02maybe that is what confused you, too.
12:13:20zachcarterah sorry
12:14:06FromGitter<Bennyelg> @zacharycarter wonderful
12:15:08zachcarterBennyelg: what's that?
12:15:21FromGitter<Bennyelg> http://flyx.github.io/emerald/
12:15:37zachcarterah - that's flyx's library not mine
12:15:42zachcarterbut it is a very nice library
12:15:49FromGitter<Bennyelg> yes indeed
12:17:43*SenasOzys joined #nim
12:18:01*SilentX joined #nim
12:19:36*SilentX quit (Remote host closed the connection)
12:31:14FromGitter<alehander42> i really underestimated nim's `if` until now
12:31:27FromGitter<alehander42> i didn't know i can define a local variable in it and use it in the branch
12:31:39FromGitter<alehander42> I mean, that's horrible for normal code, but it's helpful for macros
12:31:50FromGitter<alehander42> (define it in the condition)
12:32:37FromGitter<bung87> I ‘ve seen some example in `case`{| expr |}
12:32:49FromGitter<alehander42> also `if (when stuff: .. )` is a beautiful pattern
12:33:01FromGitter<alehander42> .. almost beautiful :D
12:34:08FromGitter<bung87> if when, why combines two?
12:34:52FromGitter<alehander42> because my macro needs it :(
12:35:49FromGitter<alehander42> but sometimes it's useful in macros: when you don't know much about your untyped args and you just generate two cases and let the compiler choose in the near future between them
12:36:00FromGitter<alehander42> so eg
12:36:16FromGitter<alehander42> `if (when a: b else: c)`
12:36:22FromGitter<alehander42> where b and c are different NimNode
12:38:01FromGitter<bung87> eh, what happen `if` a NimNode
12:38:57FromGitter<alehander42> basically the macro generates different code depending on the when
12:39:27FromGitter<alehander42> it doesn't really makes sense without context, if i finish my macro, i'll show an example
12:40:13FromGitter<bung87> I’m curious
12:52:19*leorize joined #nim
12:53:12FromGitter<tim-st> @bung87 https://github.com/tim-st/nim-zim/blob/79a3c7bd789b61aef61354158dbe44b840a5816b/zim.nim#L210
12:55:24FromGitter<bung87> ah left value depends on CT
12:56:02FromGitter<tim-st> yes
12:56:26FromGitter<bung87> thanks!
12:56:40*dddddd quit (Ping timeout: 272 seconds)
13:05:14*ritchie_ joined #nim
13:16:51*opi_ quit (Quit: ZNC - http://znc.in)
13:17:30*opi_ joined #nim
13:34:04*enthus1ast quit (Ping timeout: 240 seconds)
13:38:00*kapil___ joined #nim
13:56:34TheLemonManhmm, choosenim runs the whole testsuite each time it is run... that's bad for CI
14:01:39krux02alehander42: I think for that case I use typed templates
14:02:09krux02I generate expressions with template calls. And the templates are resolved during type checking phase.
14:02:33TheLemonManwelp, according to the benchmark results the machines used by travis are quite faster than this laptop heh
14:05:05*SenasOzys quit (Remote host closed the connection)
14:06:36FromGitter<kaushalmodi> I recently got this tip from @arnetheduck that you can cache the Nim installs on Travis.
14:06:45FromGitter<kaushalmodi> Ref: https://gitter.im/nim-lang/Nim?at=5b9ad06c8909f71f75ccf768
14:07:03FromGitter<kaushalmodi> I use that tip here: https://github.com/kaushalmodi/hello_musl/blob/master/.travis.yml
14:09:05*SenasOzys joined #nim
14:09:08TheLemonManoh I see..
14:10:03*SenasOzys quit (Remote host closed the connection)
14:10:20*SenasOzys joined #nim
14:12:13TheLemonMankaushalmodi, thank you for the nightly docs, just wanted to tell ya :)
14:13:23FromGitter<kaushalmodi> You are welcome! Though.. there's hardly anything in there that I can take credit for.. I just set up a travis job, that's it.
14:14:12FromGitter<kaushalmodi> It's send a PR for that to nim repo soon. @Araq will only need to get Github API token and set it to a `$GITHUB_API_TOKEN` env var in travis
14:14:23FromGitter<kaushalmodi> (not publicly revealed, of course)
14:23:17FromGitter<alehander42> @krux02 i think i've done that too, but in some cases the when solution is simpler
14:25:54*PMunch quit (Quit: Leaving)
14:31:53*trfl joined #nim
14:33:56FromGitter<alehander42> it would be cool if nimble init could work in `.`
14:34:36*brainproxy quit (Quit: WeeChat 2.2)
14:35:27*ftsf quit (Ping timeout: 240 seconds)
14:36:46*trfl quit (Remote host closed the connection)
14:46:31FromGitter<kaushalmodi> @Araq I meant `$GITHUB_OAUTH_TOKEN` env var in my prev message
14:50:54zachcarterif I have a macro that calls a proc that returns a NimNode, how can I take that NimNode and have the macro return it as AST (or another NimNode)? Is this possible?
14:51:54FromGitter<alehander42> so you want to return it as a result of your macro?
14:52:04zachcarteryes
14:52:19zachcarterbut not as concrete Nim syntax - as abstract syntax - so it can be passed to another macro
14:52:20FromGitter<alehander42> but it seems you want something different
14:52:23zachcarterif that makes any sense
14:52:25zachcarterpossibly
14:52:33zachcarterI'm still very new to a lot of this
14:52:47FromGitter<alehander42> so this macro :
14:52:51FromGitter<alehander42> is it ever called by the user
14:52:57FromGitter<alehander42> or only by your other macro
14:53:23zachcarterI'm thinking it will be called by my other macro
14:53:25zachcarterand not by the user
14:53:35FromGitter<alehander42> well, then you can just make it a compile time proc
14:53:50FromGitter<alehander42> which also returns a NimNode
14:53:52zachcarterokay - let me try that - thank you
14:54:03*miran joined #nim
15:09:04*Vladar quit (Remote host closed the connection)
15:16:31*noonien joined #nim
15:27:47*Vladar joined #nim
15:28:04FromGitter<bung87> TheLemonMan that still not work even I try to pass a iterator factor, some test pass, some failure,it gets more weird.
15:29:48FromGitter<bung87> if pass a iterator none get pass, before all these (when not provide tokenizer API), all works.
15:37:28TheLemonManbung87, is the code available anywhere?
15:38:01FromGitter<bung87> yeh https://github.com/Nim-NLP/minhash
15:42:17pigmejkrux02: awesome work with the prs to nim-mode :)
15:42:37FromGitter<bung87> I updated something ,now if just use `slide` directly all test will be passed
15:42:48*Trustable joined #nim
15:44:06*Vladar quit (Remote host closed the connection)
15:45:26TheLemonManwhat test should I try to run?
15:45:47FromGitter<bung87> test1.nim enough
15:47:34TheLemonManit fails with and without the closure annotation
15:49:07*Vladar joined #nim
15:49:29FromGitter<bung87> I remember I tried both
15:52:37FromGitter<bung87> this time I tried switch two blocks ,each block works but two will fails..
15:53:15TheLemonManoh well, the test works if I change the second block assertion from `low_j < high_j` to `low_j <= high_j`
15:54:26*S3l3ct3d joined #nim
15:56:35*S3l3ct3d quit (Killed (Sigyn (Spam is off topic on freenode.)))
15:56:54FromGitter<bung87> that doest make sense
15:58:07TheLemonManI have no idea what I'm looking at, sorry
15:59:50FromGitter<bung87> is there some code apparently wrong?
16:01:08TheLemonManno idea, the ngrams iteration looks fine here
16:02:08FromGitter<bung87> ok, thank you ! guess we need a break.
16:03:13*floppydh quit (Quit: WeeChat 2.2)
16:07:08*kapil___ quit (Quit: Connection closed for inactivity)
16:11:40FromDiscord<treeform> Hey guys can you help me out with this error: https://github.com/nim-lang/Nim/issues/8994 Can you run the simple script couple of times and see if you get crashes?
16:13:45TheLemonManyeah, it's truncated
16:14:05FromDiscord<treeform> if you run it ever and over again? do you get it right?
16:14:11FromDiscord<treeform> For me parts in the middle are missing
16:14:26FromDiscord<treeform> but its random probably based on net speed or some thing...
16:14:58TheLemonManyeah, random chunks
16:15:05FromDiscord<treeform> what OS do you have? Can you append that info to the bug ticket?
16:15:23FromDiscord<treeform> the nim -v stuff
16:15:23TheLemonManlinux
16:15:33FromDiscord<treeform> neat, I am on windows
16:15:37FromDiscord<treeform> so we got most OSes covered
16:18:24AlexMaxIs there a limit to the amount of "type" lookahead in Nim?
16:19:50AlexMaxI have a function pointer type very early in this file (line 197) that takes a ptr "text_edit" as a parameter, and nim complains about not being able to find the "text_edit" type
16:21:28AlexMaxtext_edit is implemented on line 1380, within the same type block
16:23:45FromGitter<mratsim> there is no limit, are you sure you didn’t switch to another type section?
16:24:05AlexMaxReasonably sure. Let me dump the entire nim file
16:29:19AlexMaxhrm, I started from scratch and now I can't replicate the error...
16:31:22AlexMaxokay yeah I'm no longer getting the error *shrug*
16:38:52krux02pigmej, thank you
17:02:42FromGitter<Vindaar> is there some documentation about testament? I'm a little confused what the `file` should be used for
17:03:28*gangstacat quit (Read error: Connection reset by peer)
17:03:33*gangstacat_ joined #nim
17:08:49FromGitter<bung87> TheLemonMan news,the release mode whether pass a iterator or iterator factor all works !
17:09:43TheLemonManhmm, are you using a devel compiler?
17:10:13FromGitter<bung87> yeah ,I prefer use devel branch
17:11:35FromGitter<bung87> ah it is simple as in python and js, but don’t know what happen in debug mode.
17:12:59TheLemonManthat's extremely weird, can you upload the latest version of the code plus some brief and detailed instructions of how to make the tests fail/pass ?
17:14:12FromGitter<unreadable> hey, anyone familiar with nginx that could help me?
17:15:34FromGitter<bung87> yeah, let me trace the changes.
17:19:33*gangstacat_ quit (Ping timeout: 250 seconds)
17:30:40FromGitter<bung87> https://github.com/Nim-NLP/minhash/issues/1
17:32:54*MrTrick29 joined #nim
17:34:16FromGitter<bung87> `clang: error: no such file or directory: '/Users/bung/.cache/nim/test2_r/murmur3.c.o’` seems devel branch also have a cache problem .
17:35:41*MrTrick29 quit (Remote host closed the connection)
17:42:01TheLemonManbung87, is `hasher.jaccard("This is a doc", "This is a doc")` supposed to return 1?
17:42:35FromGitter<bung87> yes , since same content
17:43:08FromGitter<bung87> do I describe the problem clearly? (worried about my english level)
17:43:09TheLemonManwell fuck, it outputs 0.5 here
17:44:08FromGitter<bung87> hmm when replace `tokenizer` to `slide` in hash function I can have brief of the results.
17:44:54TheLemonManyeah, it works if you do that replacement
17:46:15FromGitter<bung87> so, this looks very weird, especially swich the test1.nim blocks case.
17:47:34*SenasOzys quit (Ping timeout: 240 seconds)
17:51:54FromGitter<tim-st> what happens when I use `Stream.readData` and the position+length > fileSize ?
17:52:29FromGitter<tim-st> the docs say "low level proc that reads data into an untyped `buffer` of `bufLen` size."
17:53:08FromGitter<tim-st> oh, I see the number is returnt
17:55:12*preaction3 joined #nim
17:57:10*Superdawg5 joined #nim
17:57:50*Superdawg5 quit (Remote host closed the connection)
17:58:52TheLemonManbung87, here's your problem: once your closure iterator is consumed you won't get anything out of it for any of the following uses
17:59:54*preaction3 quit (Remote host closed the connection)
18:01:25*stefanos82 quit (Quit: Quitting for now...)
18:02:16FromGitter<bung87> so the debug mode is right results?
18:05:11TheLemonManyeah, if I rewind the iterator using some dirty low-level magic the tests pass
18:06:01TheLemonManhaha, wanna know why the tests pass with -d:release?
18:06:10TheLemonManbecause `assert` are compiled out :D
18:06:30FromGitter<bung87> that’s funny..
18:08:07FromGitter<bung87> then do I still need provide iterator as API?
18:10:06FromGitter<bung87> or make it behave as python’s generator.
18:11:49FromGitter<kaushalmodi> doAssert don't get compiled out, right?
18:12:37TheLemonManif you don't mind some dirty trick there's https://gist.github.com/77f15d708b59877d26f6c3e2edc30793, call this after you're done with the iterator and it'll be usable again
18:12:44TheLemonMankaushalmodi, yep
18:20:32*MyMind quit (Ping timeout: 244 seconds)
18:21:26FromGitter<bung87> ah… can’t figure out where to place it...
18:22:06TheLemonManbung87, after `result[s] = curHash`
18:24:09FromGitter<bung87> the args proc int what to pass?
18:25:00TheLemonMantokenizer and n = 0
18:25:20TheLemonManall it does is reset the state machine the closure compiler gets compiled down to
18:25:29*Arrrr left #nim (#nim)
18:26:34FromGitter<bung87> wow , I like this, makes like a python generator.
18:28:02*Vladar quit (Remote host closed the connection)
18:28:03*MyMind joined #nim
18:28:21*SenasOzys joined #nim
18:30:08FromGitter<bung87> seems `slide` with closure also acts like this.
18:36:20*xet7 quit (Quit: Leaving)
18:41:07*tefter joined #nim
18:43:45*vivus quit (Remote host closed the connection)
18:44:13federico3who wants to nimify https://github.com/s-macke/Interplanetary-Postal-Service ? :)
19:00:09*stefanos82 joined #nim
19:04:49*mephinet15 joined #nim
19:05:29*mephinet15 quit (Remote host closed the connection)
19:07:44FromGitter<bung87> I can sleep now,tanks to lemonman
19:14:12TheLemonManit's a dirty workaround, you should really think of a better API :P
19:15:42*ldlework[MIA] is now known as ldlework
19:17:40FromGitter<bung87> yeah Seems prefer use macro provide a inline iterator as param
19:19:20TheLemonManor maybe not, maybe we should just slap this snippet in the stdlib
19:23:07FromGitter<bung87> then that user can intend pass a closure iterator,works as expected
19:25:05FromGitter<bung87> I want provide both version.allow pass inline or closure iterator also other iterable type
19:25:52TheLemonManwell you can't pass around inline iterators
19:26:28*gangstacat joined #nim
19:27:31FromGitter<bung87> the manual says can pass to macro,template?
19:27:44*dddddd joined #nim
19:28:16TheLemonManoh sure, but not procedures
19:32:42FromGitter<bung87> think about if I can just convert inline to closure
19:34:32FromGitter<kayabaNerve> Petition to make every single Nim proc/iterator/template/macro... inline unless the new {.outline.} pragma is used.
19:34:49FromGitter<kayabaNerve> 🤔
19:35:25*enen27 joined #nim
19:40:21FromGitter<bung87> I’d prefer get the generator keyword,that will simple solve my problem:)
19:41:16*aerth joined #nim
19:41:27*enen27 quit (Ping timeout: 240 seconds)
19:41:37aerthwhats goin on here
19:45:52TheLemonMannothing much
19:48:41FromGitter<arnetheduck> @kayabaNerve here's an example of that line of thought: https://github.com/status-im/nim-chronicles/issues/29 :)
20:01:39*mcc joined #nim
20:08:50*Trustable quit (Remote host closed the connection)
20:10:42*zachcarter quit (Ping timeout: 252 seconds)
20:10:44*Vladar joined #nim
20:10:45*miran quit (Ping timeout: 252 seconds)
20:12:33aerth213kb hello world, not too shabby!
20:13:00FromGitter<kaushalmodi> It can be 16kb ;-)
20:13:40FromGitter<kaushalmodi> on GNU/Linux type OSes
20:13:41aerthah i just stripped it and its 175k, im guessing theres a compiler option for smaller
20:13:53FromGitter<kaushalmodi> yes, `--opt:size`
20:14:11FromGitter<kaushalmodi> See the config.nims in https://github.com/kaushalmodi/hello_musl
20:14:13TheLemonManor 142 bytes http://timelessname.com/elfbin/
20:14:59FromGitter<kaushalmodi> TheLemonMan: Is that Nim generated?
20:15:20TheLemonManofc not :)
20:15:28aerthgot down to 111k after --opt:size && strip, not sure about no 16kb!
20:15:35FromGitter<kaushalmodi> see upx
20:15:57*abm quit (Quit: Leaving)
20:16:01FromGitter<kaushalmodi> https://github.com/kaushalmodi/hello_musl/blob/master/.travis.yml#L49-L57
20:16:09FromGitter<kayabaNerve> @arnetheduck Use a template that then calls a proc. :thinking:
20:17:15FromGitter<kaushalmodi> aerth: In summary, use `-d:release --opt:size` and then `strip -s` + `upx --best`
20:19:27aerthkaushalmodi: woah upx looks neat , thank you
20:25:26dom96aerth: https://hookrace.net/blog/nim-binary-size/
20:27:24*aerth faints
20:31:54aerthwhat can't you write with nim? and is there anything that seems to be kind which most nim programs are?
20:32:09aerthgood for reverse proxys?
20:37:17*nsf quit (Quit: WeeChat 2.2)
20:45:11stefanos82with -d:release --opt:size I got it from 106K to 44K; not bad
20:45:53aerthyup 44k here too
20:47:28stefanos82dom96: since we use -d:release and --opt:size, shouldn't "strip -s" be used somehow to reduce the size even further?
20:48:30aerthyeah strip -s 30960 bytes
20:48:49aerthafter upx , 15580 bytes
20:48:53stefanos82with strip -s, I reduce my already reduced binary from 44k to 32k
20:49:27stefanos82aerth: sometimes binaries that got compressed with upx can be considered as false positives
20:49:31stefanos82especially under windows
20:50:04aerthstefanos82: ah because virii like to use upx i bet!
20:50:30stefanos82I have no idea what they use
20:54:51*gangstacat quit (Read error: Connection reset by peer)
20:59:07*Jesin quit (Quit: Leaving)
21:03:22*Jesin joined #nim
21:07:49FromGitter<kaushalmodi> How do I get the value of compile-time defines.. example `nim c -d:foo=abc test.nim`
21:08:14FromGitter<kaushalmodi> How do I check for the defined foo's value in test.nim?
21:08:42FromGitter<kaushalmodi> `defined(foo)` tells only if I set the `-d:foo` switch or not
21:10:36FromGitter<kaushalmodi> got it: https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-compile-time-define-pragmas
21:16:31*TheLemonMan quit (Quit: "It's now safe to turn off your computer.")
21:16:45*craigger quit (Quit: bye)
21:17:00*craigger joined #nim
21:36:27*Vladar quit (Remote host closed the connection)
21:57:10*gangstacat joined #nim
22:15:38AlexMaxHrm, it looks to me like 'or' has to be implemented for enums
22:16:35AlexMaxIs there a more...acceptable pattern for when enums are espected to be combined like bitfields?
22:21:44FromGitter<kaushalmodi> You can or the `ordinal` of the enums
22:25:58AlexMaxwhat if I just implement `or` for the specific enum type?
22:29:22FromGitter<kaushalmodi> You can do that. I think the reason or'ing of enums isn't implemented is, what if the or'ed ordinal value doesn't have a corresponding enum? So it's better if the user does the ordinal back to enum convertion themselves and catch such errors.
22:29:30AlexMaxThat makes a ton of sense actually
22:29:56AlexMaxI wonder if enum's representing a bitfield might convince somebody to have a shorthand special case of enum to signify a bitfield
22:29:59AlexMaxI think C# has this
22:30:24AlexMaxhttps://stackoverflow.com/questions/8447/what-does-the-flags-enum-attribute-mean-in-c
22:33:55AlexMaxperhaps not necessary though, imho - the `or` proc definition already exists
22:37:22FromGitter<kaushalmodi> This might be not relevant to your application. But based on that example, I can think of using enum sets. Adding enums to a set would be kind of the or'ing in that example. You'd then need to interpret those sets of multiple enum values.
22:44:24*zachcarter joined #nim
23:11:11AlexMaxyay, i finally got something to render
23:11:18AlexMax....and by something I mean nothing, nothing renders :P
23:11:31AlexMaxbut at least there are no crashes
23:13:34*ftsf joined #nim
23:29:02AlexMaxzachcarter: I have made good on my promise, but I'm still working on it :P
23:29:41FromGitter<zetashift> the nuklear bindings?
23:30:30AlexMaxYessir
23:31:10AlexMaxhttps://github.com/AlexMax/nimnuklear
23:31:31AlexMaxCurrently the demo compiles and runs and doesn't crash
23:31:37AlexMaxstill trying to get something to render though :P