<< 15-04-2020 >>

00:01:19FromGitter<awr1> Hmm
00:01:32FromGitter<awr1> you can't place a lower bound on length of varargs[T]
00:01:33FromGitter<awr1> right?
00:01:38shashlickwhat i mean is build the header files into object files and then link them to the final binary
00:02:09zacharycarteryeah that's what I was thinking you meant - okay let me try that
00:02:38shashlicknested struct/union/enum support is coming in ast2
00:02:47zacharycartersweeet
00:02:54shashlicktook a couple hours, amazing, this new arch
00:02:57FromGitter<awr1> trying to think if these signatures should be just `varargs[T]` or `x, y: T; z: varargs[T]`
00:03:40FromGitter<awr1> I suppose i could just add a `when args.len < 2`
00:14:15*JohnAD quit (Ping timeout: 260 seconds)
00:17:33*Trustable quit (Remote host closed the connection)
00:21:28FromGitter<awr1> https://github.com/nim-lang/Nim/pull/13985
00:28:43*fputs quit (Quit: WeeChat 2.8)
00:28:50FromDiscord<clyybber> nice!
00:29:01FromDiscord<clyybber> I think this approach is the best
00:29:39*aEverr quit (Ping timeout: 260 seconds)
00:30:21*aEverr joined #nim
00:36:54*icebattle quit (Ping timeout: 256 seconds)
00:48:57zacharycartershashlick: so I can produce an object file for the cpp source or the objc source - but then I have different problems with each
00:49:17FromGitter<timotheecour> can anyone please merge https://github.com/nim-lang/Nim/pull/13984 to unbreak nim CI?
00:49:34zacharycarterwith the cpp source, when I try to compile my nim sources with the C compiler and link to it, I get an error about algorithm.h, which is a cpp header
00:50:11zacharycarterif I compile the objc sources, and compile my nim sources with the cpp backend I get errors because of name mangling and definitions not being found for importc
00:50:33zacharycarteris there a way to get nimterop to use the importc pragma and be explicit about what definition is being imported?
00:51:22zacharycarterI guess the first way doesn't make much sense - I can't really link a cpp object file when using a c compiler
00:55:10zacharycarteror I guess I can
00:57:51*icebattle joined #nim
01:08:44*icebattle quit (Ping timeout: 265 seconds)
01:10:05zacharycarteryay got it to work
01:10:13zacharycarterjust had to link libc++ and use the c++ linker
01:10:16PrestigeIs nimlsp supposed to be showing diagnostic info? I don't seem to be getting any error/warning info
01:10:20*chemist69 quit (Ping timeout: 246 seconds)
01:12:34*chemist69 joined #nim
01:12:51*pbb quit (Ping timeout: 272 seconds)
01:14:48*ryan__ joined #nim
01:16:53*Prestige quit (Quit: Prestige)
01:17:14*Prestige joined #nim
01:17:33*ryan_ quit (Ping timeout: 256 seconds)
01:22:13*icebattle joined #nim
01:26:32*icebattle quit (Ping timeout: 256 seconds)
01:26:37*lritter quit (Ping timeout: 265 seconds)
01:27:06*lritter joined #nim
01:27:14*icebattle joined #nim
01:29:39*ryan__ is now known as number_one
01:30:25*MightyJoe joined #nim
01:32:11*cyraxjoe quit (Ping timeout: 260 seconds)
01:38:08*cyraxjoe joined #nim
01:39:34*MightyJoe quit (Ping timeout: 240 seconds)
01:44:25*MightyJoe joined #nim
01:44:59*cyraxjoe quit (Ping timeout: 265 seconds)
01:47:30*Hexeratops joined #nim
01:50:04shashlickYes was about to say that
01:50:08shashlickAwesome
01:51:52zacharycarterthanks for the protip
02:05:39*JohnAD joined #nim
02:07:42*endragor joined #nim
02:14:28*bunbunbunbunny joined #nim
02:23:09*muffindrake quit (Ping timeout: 246 seconds)
02:25:26*muffindrake joined #nim
02:30:03*icebattle quit (Read error: Connection reset by peer)
02:38:40*icebattle joined #nim
02:44:57PrestigeAnyone familiar with xlib? I'm attempting to use XGrabPointer, and if I click on the root window I will get an error "BadWindow (invalid Window parameter)". Just attempting to pass in the event's window/root/subwindow, they all give that error
02:47:41Prestigeah I needed to check if it was of type x.None
02:58:06*audiofile quit (Ping timeout: 258 seconds)
03:00:43*opal quit (Ping timeout: 240 seconds)
03:01:12*Hexeratops quit (Read error: Connection reset by peer)
03:03:54*opal joined #nim
03:08:54*dddddd quit (Ping timeout: 240 seconds)
03:20:43FromDiscord<Varriount> Hm, what would I call an iterator that returns a stream of file path component indices?
03:21:33leorizecomponentSlices
03:22:09FromDiscord<Varriount> leorize: Thanks.
03:22:44FromDiscord<Varriount> It's frustrating trying to design the API for this path library, because what's convenient isn't what's efficient, and there's not an easy way to bridge the two.
03:47:38FromDiscord<Varriount> Araq: With distinct types, is there any way of avoiding the gymnastics required for conversions across generic containers, something like `var foo = LinkedList[ParentType](variableOfLinkedListChildType)`?
04:05:10*nsf joined #nim
04:06:02*supakeen quit (Quit: WeeChat 1.9.1)
04:06:43*supakeen joined #nim
04:19:34*zacharycarter quit (Ping timeout: 240 seconds)
04:48:01*Intensity joined #nim
05:25:16FromGitter<awr1> @Varriount can you clarify what you're asking
05:27:13*thomasross quit (Ping timeout: 264 seconds)
05:29:08FromGitter<awr1> are you asking for ways to decrease verbosity of that
05:30:18*rockcavera quit (Remote host closed the connection)
05:31:34*icebattle quit (Ping timeout: 256 seconds)
05:35:25FromGitter<awr1> if you know the mapping from child to its parent type, you could make a template that takes a type and returns a type
05:43:16*narimiran_ joined #nim
05:52:19*arielfe joined #nim
05:54:22arielfei really want to learn nim, but also thinking about lisp. i have read interesting things about the way using lisps might help promote a deeper understanding of programming. do you i can have the same experience by learning and using nim?
05:55:26ZevvNope, nothing compares to lisp.
05:55:59arielfei see. thats what i thought. well - ill just have to do it as quickly as possible and then come back to nim :)
05:56:33ZevvBut there is no reason to do both, and they're kind of different beast. Lisp brings you nirvana, but Nim is a powerful practical workhorse.
05:57:00ZevvFor lisp, work your way through "Structure and Interpretation of Computer Programs" and you will see the light
05:57:05Zevvhttps://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-001-structure-and-interpretation-of-computer-programs-spring-2005/video-lectures/1a-overview-and-introduction-to-lisp/
05:57:08arielfethats exactly what i was thinking :)
05:58:29arielfeyes the famous SICP book :) - which brings up another question - should i start from it? or some more introductory material for lisp and then move on to it?
06:01:11*waleee-cl joined #nim
06:02:31*gmpreussner quit (Ping timeout: 256 seconds)
06:04:03*gmpreussner joined #nim
06:06:05*PMunch joined #nim
06:06:57*icebattle joined #nim
06:09:00arielfeok got all the answers i needed from searching and the start of the lecture you linked. Thanks a lot :) Zevv
06:11:07*arielfe quit (Remote host closed the connection)
06:12:08*icebattle quit (Ping timeout: 256 seconds)
07:00:00*gmpreussner quit (Quit: kthxbye)
07:04:59*gmpreussner joined #nim
07:06:04PrestigePMunch: does nimlsp report diagnostics? It looks like it should, looking at the README. My lsp client isn't reporting any, didn't know if it's because of nimlsp or a misconfiguration on my end
07:06:27PMunchDefine diagnostics
07:07:47PrestigeSyntax warnings/errors, like incorrect params, unmatched quotes and parens, etc
07:08:13PMunchOh yeah, those should show up
07:08:47*neceve joined #nim
07:09:22PrestigeThanks, I'll dig into my coc-nvim setup then to see what's going wrong
07:11:24PMunchIt only appears on file save though
07:31:43*jjido joined #nim
07:41:18*MarderIII joined #nim
07:41:36*bunbunbunbunny quit (Quit: Lost terminal)
07:56:54*Vladar joined #nim
08:08:03*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
08:12:34number_oneHey, maybe a weird question, anybody have any ideas for removing terminal styling from lines in files?
08:13:17PMunchnumber_one, this might help: https://github.com/PMunch/ansiparse
08:13:55PMunchSimply parse it with that, then go through and only pick out the kind == String entries
08:16:54PrestigePMunch: I seem to be getting autocompletion from nimlsp but nothing about diagnostics? Like if I declare let foo: string = 123, nothing shows. Is that expected?
08:17:08PrestigeI thought maybe the lsp wasn't working at all, but I am getting completion
08:19:32PMunchHmm, even when saving the file?
08:19:53PrestigeYeah :/
08:20:27PrestigeIdk if you have touched coc-nvim at all (it's what I'm using) but their docs for setting up for nimlsp seems really straightforward. Idk what I could be missing
08:20:46PMunchWell, either nimlsp doesn't get the save message, or it fails to check your code for some reason, or your nimlsp plugin doesn't support diagnostics, or your editor doesn't show them properly.
08:21:01PMunchNever even heard of it :P
08:21:28PMunchYou could try to compile nimlsp with debug logging and see if that shines some light on the situation
08:21:29PrestigeI have it working for a number of other languages, so maybe it isn't getting the save message
08:21:46PrestigeHm okay I'll try that out next
08:22:31Prestigeonly message I currently get from nimlsp is Hint: used config file '/home/redacted/.choosenim/toolchains/nim-1.2.0/config/nim.cfg' [Conf]
08:24:01PMunchYeah, that comes from the compiler
08:26:05*dddddd joined #nim
08:27:41PrestigeLooks like it is working https://0x0.st/iQ9A.txt
08:34:20number_onePMunch, thanks, this looks super helpful!
08:37:01FromDiscord<sealegs> This may be a dumb question, but is there a wsy to get unix time in milliseconds?
08:37:13FromDiscord<sealegs> way*
08:40:18PMunchsealegs epochTime()*1000?
08:42:41PMunchPrestige, yeah so it's definitely sending didSave notifications
08:46:14Prestigeah PMunch so a few lines down it says "versionSupport": false for publishDiagnostics
08:46:21PrestigeI think that has something to do with it
08:46:35PrestigeI'm not well versed with lsp though
08:47:22*pbb joined #nim
08:49:08*liblq-dev joined #nim
08:49:52*dwdv joined #nim
08:50:34Prestigefound some details here https://microsoft.github.io/language-server-protocol/specification.html
08:57:12Prestigehm so that seems to have nothing to do with it. Looking at the output from nimlsp, I get autocompletion options but nothing back regarding diagnostics
08:59:08PMunchNothing from any of these echos? https://github.com/PMunch/nimlsp/blob/master/src/nimlsp.nim#L439
08:59:54PrestigeShould all be here: https://0x0.st/iQ9A.txt
08:59:59*pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
09:00:49*pbb joined #nim
09:03:27*ftsf quit (Ping timeout: 260 seconds)
09:08:33PrestigeSeems odd that nothing is output regarding diagnostics. Gotta go for now but I'll be back at it tomorrow, thanks for looking into it PMunch
09:15:54*sknebel quit (Remote host closed the connection)
09:16:33*sknebel joined #nim
09:18:45*ryan_ joined #nim
09:21:03FromDiscord<sealegs> PMunch, I mean like milliseconds since 1-1-1970
09:21:29*number_one quit (Ping timeout: 256 seconds)
09:21:49*MarderIII quit (Ping timeout: 250 seconds)
09:23:04PMunchYes
09:23:07FromDiscord<sealegs> Oh wait nvm thx, I thought epochTime() was just like toUnix() lol.
09:23:16FromDiscord<sealegs> My bad
09:23:29PMunchIt's kinda in the name `epoch` in this context refers to 1-1-1970
09:23:50PMunchOr rather, that is the specific epoch it refers to
09:24:15PMunchThere are systems that use different epochs
09:24:29FromDiscord<sealegs> Interesting.
09:25:56FromGitter<kayabaNerve> Does Nim have shortcircuiting outside of and/or?
09:26:32PMunchI encountered it a lot when working with satellite data, they are afraid of rollover if the satellite stays up for longer than expected. But they still want to save on bandwidth since the downlink is limited. So they come up with all sorts of weird time systems in order to avoid using 64-bit timestamps
09:27:18FromGitter<kayabaNerve> I assume it follows C and it's only applied to and/or, and only because it compiles down to &&/||. Just checking as I'm writing a macro that needs to detect short circuiting.
09:37:18FromDiscord<Gary M> float queue_priorities[max_family_queues];memset(queue_priorities, 0, sizeof queue_priorities);
09:37:24FromDiscord<Gary M> whoops
09:37:29FromDiscord<Gary M> float queue_priorities[max_family_queues];
09:37:29FromDiscord<Gary M> memset(queue_priorities, 0, sizeof queue_priorities);
09:37:47FromDiscord<Gary M> that's a pretty shitty piece of C code that I need to write similarly in Nim
09:38:10AraqkayabaNerve: only 'and' and 'or' do that, other constructs rely on 'if' expressions
09:38:30FromDiscord<Rika> let queue_priorities = newSeq[float](max_family_queues)
09:38:34FromDiscord<Gary M> so I did var queuePriorities = newSeq[float](maxFamilyQueues), but the whole memset thing is throwing a wrench into the equation
09:38:54FromDiscord<Rika> you dont need to memset it i dont think
09:38:56AraqNim does the memset for you, you don't have to write anything for it
09:39:05FromDiscord<Gary M> oh
09:39:12FromDiscord<Gary M> well cool then 🙂
09:39:54AraqzeroMem(addr(s[0]), sizeof(s[0]) * N) # would be the equivalent, but it's not required and harmful low level stuff
09:40:49FromDiscord<Rika> and is redundant too
09:42:52FromDiscord<Gary M> another question
09:43:05FromDiscord<Gary M> how do I do additional conditions in a for loop in nim
09:43:12FromDiscord<Rika> additional conditions?
09:43:46FromDiscord<Gary M> like for(int i = 1; i < 4 && i < someMaxVariable; ++i)
09:43:59FromDiscord<Rika> you just use a break inside the for
09:44:05*narimiran_ is now known as narimiran
09:44:10narimiranyou use while loop
09:44:12FromDiscord<Rika> for i in something: if i < someotherthing: break
09:44:28FromDiscord<Rika> or that too
09:44:49FromDiscord<Gary M> ok, thanks
09:53:19FromGitter<kayabaNerve> Araq: Thanks for the confirmation. Working on Result unwrapping and the lack of short circuiting will break a lot of my code. Need to make sure I don't rely on it some place I don't think I do.
09:54:32*abm joined #nim
09:55:51*Trustable joined #nim
10:10:45*waleee-cl quit (Quit: Connection closed for inactivity)
10:11:07*krux02 joined #nim
10:25:56FromDiscord<Rika> how do you debug npeg stuff?
10:26:07FromDiscord<Rika> ah, theres a define
10:31:13PMunchYea.. Most macros have that, but it's a bit random what it's called :P
10:31:27PMunchEven my own macros aren't consistent in what I call it..
10:32:04PMunchWith expandMacro it might get better, but it currently doesn't expand if the macro has an error in it, which is mostly what I use my `echo result.repr` for..
10:34:02*jjido joined #nim
10:57:26ZevvRika: what do you need?
10:58:56FromDiscord<Rika> never mind 😛
11:06:39FromGitter<timotheecour> can anyone merge https://github.com/nim-lang/Nim/pull/13984 to un-break nim CI ?
11:07:27FromDiscord<clyybber> Done : )
11:08:16ZevvRika: ok, just ping me if you need a hand
11:09:11FromGitter<timotheecour> thanks @Clyybber !
11:09:58FromDiscord<Rika> your docs are really good though
11:10:04*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
11:10:34ZevvAh I thought it was the lack of users resulting in no support requests, but it's just the quality of the docs :)
11:10:43ZevvI hope
11:11:52FromDiscord<Rika> what do you mean lmao
11:13:59*jjido joined #nim
11:14:52*lritter quit (Quit: Leaving)
11:15:07*MarderIII joined #nim
11:27:40*sacredfrog quit (Quit: ZNC 1.7.5 - https://znc.in)
11:27:43*FromDiscord quit (Remote host closed the connection)
11:27:45*gmpreussner quit (Quit: kthxbye)
11:27:58*sacredfrog joined #nim
11:28:03*gmpreussner joined #nim
11:28:16*FromDiscord joined #nim
11:29:21*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
11:30:53*jjido joined #nim
11:44:05*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
11:48:17*solitudesf joined #nim
11:50:40*xace quit (Ping timeout: 256 seconds)
11:50:58*xace joined #nim
12:01:16FromDiscord<Recruit_main707> do we have an align prgma?
12:02:37*hax-scramper quit (Ping timeout: 264 seconds)
12:06:02*supakeen quit (Quit: WeeChat 1.9.1)
12:06:42*supakeen joined #nim
12:09:27*hax-scramper joined #nim
12:10:21*sunwukong joined #nim
12:10:28Araqyes we do
12:10:48FromDiscord<Recruit_main707> yes, ive found it, thanks Araq
12:11:04*dadada quit (Ping timeout: 256 seconds)
12:12:50*dadada joined #nim
12:13:14*dadada is now known as Guest45140
12:16:08*a_b_m joined #nim
12:19:41*abm quit (Ping timeout: 258 seconds)
12:20:32liblq-devZevv: are you familiar with the Lua C API?
12:21:06liblq-dev'cause I'm getting a "too many local variables" error for seemingly no reason
12:24:17Araqkrux02, Scala does not have 'emit: <Java code here>' at all
12:24:43Araqstop your nonsense
12:24:47krux02Araq: scala does not need an emit Java code here, because you can just used Java classes directly.
12:24:51krux02No need to emit anything.
12:24:52Araqand the trollish behaviour
12:25:08Araqlikewise C++ has no #emit feature
12:25:12krux02Scala classen and Java classes with seamless.
12:25:28krux02This isn't possible for C and C++ because of the lack of modules.
12:25:40*a_b_m quit (Quit: Leaving)
12:25:41Araqso what, it doesn't have an emit
12:25:45krux02Maybe we might be able to do something smarter with c++ modules.
12:26:05Araqthe RFC and PR are about "fixing" emit, but there is nothing to fix with it, it works
12:26:17Araqit's a sharp tool, no need to make it less sharp
12:26:26krux02Araq: you are just in denial that there is a problem with emit.
12:26:34krux02And that hurts the fixing process.
12:26:44krux02That isn't helpful.
12:27:04Araqok so enlighten me
12:27:09Araqwhere is the problem with emit?
12:27:10krux02I don't need to.
12:27:26krux02It is already written down by @timotheecour
12:28:12federico3https://starchart.cc/nim-lang/nim.svg <-- heyy
12:28:13Araqit says "what if I mistype TYPESECTION?" well so what, the C code then fails to compile, otherwise the section annotation wasn't reqired to begin with
12:28:54krux02maybe it fails
12:29:02krux02maybe it doesn't fail and just does the wrong thing.
12:29:18krux02I don't want to prove it to you.
12:29:34FromDiscord<Recruit_main707> federico3 wikipedia stats?
12:29:40krux02It is your job to detect that here is a potential problem that should be addressed.
12:30:02federico3Recruit_main707: github stars (FWIW)
12:30:09FromDiscord<Recruit_main707> nice
12:30:39FromDiscord<Recruit_main707> lets reach the thousand forks, 2 left!
12:30:54Araqkrux02, it's also my job not to feed trolls
12:31:08krux02Who is the troll?
12:31:24Araqyou.
12:33:32krux02Then why do you post such things like "Why do we need an even more powerful emit statement though? Why not let Nim be a real language that compiles via C or LLVM to binary code." in a conversation that tries to address detected problems with `emit`?
12:33:47krux02That doesn't help the conversation at all.
12:34:11krux02You are not offering a solution at all. You are just trollin the conversation with snark.
12:34:26Araqfeatures must be justified well
12:34:31krux02If you do so, don't get offended if I reply to you.
12:34:58krux02ok
12:35:05AraqI like replies that don't imply "Araq is a fool, Nim is doomed"
12:35:30*Guest45140 is now known as dadada
12:35:39krux02Then stop posting foolish stuff.
12:36:01krux02Or comments that let me assume that you are in denial of problems
12:36:04leorize[m]eventually we should move torwards not having `emit` at all
12:36:27AraqI'm trying ;-) can you try the same please.
12:36:54Araqand "you are in denial" is 100% troll speak, just fyi
12:36:54krux02ok, then admit at least that `emit` isn't perfectly designed.
12:37:10krux02yes emit is a hack. But a damn useful hack that solves real problems.
12:37:14Araqemit is a hack, of course it's not perfectly designed
12:37:20dadadastop guys, just stop, this bickering is incredibly sad to see
12:37:22Araqit hardly was designed at all
12:37:28krux02yes
12:37:29FromDiscord<Recruit_main707> emit is useful, i asked Araq about this and he told me we could pass the emit code by a c/cpp compiler right?
12:38:08krux02Me and timothee were just discussing on ideas on how `emit` could be converted from "a hack" into a nice language feature that would also work well with editors.
12:38:24leorize[m]emit was a hack for the lack of proper interop fwiw
12:38:42leorize[m]I think we should find ways to deprecate it, not making it easier to use
12:38:56FromDiscord<Recruit_main707> imho emit is useful because its hacky
12:39:00leorize[m]the reason why emit is ugly is because you're not supposed to use it
12:39:14FromDiscord<Recruit_main707> it allows you to do some dirty things to avoid complex things
12:39:29krux02please don't teach me about emit.
12:39:36FromDiscord<Recruit_main707> (at least thats how i use it)
12:39:39krux02I know what it is good for and when it should be avoided.
12:40:16FromDiscord<Recruit_main707> i still dont get whats all of this for, redesigning emit?
12:40:43krux02When there is a proper way to do it, always do the proper thing. The problem is, C++ is a very dirty language with preprocessor magic and weird syntax for compiler secific features that can best be accessed with `emit`.
12:41:31krux02Recruit_main707: The problem is, we were just discussing emit and how to improve it.
12:41:38krux02Because there are things that don't work well with it.
12:42:22leorizeI generally think that the syntax is fine, if that's what you wanna change
12:42:40krux02here is the context: https://github.com/nim-lang/RFCs/issues/210
12:43:54Araqexactly, that's the *context* but there is no *motivation* and no *justification*
12:44:35krux02whatever
12:44:54Araqit simply says "I don't like triple quoted strings and I want indentation based strings" and then conflating it with .emit and its quirks
12:45:49*abm joined #nim
12:45:56krux02It is a discussion.
12:46:23krux02not a finished proposal
12:46:40Araqit could start with a problem statement though.
12:46:43leorizeso apparantly the main bug that I can see here is that `backticks` captures in emit have unclear semantics
12:47:26krux02There are multiple problems with emit.
12:47:27*Tyresc joined #nim
12:47:31krux02The backticks are one of them
12:47:52*rockcavera joined #nim
12:47:52krux02The magic comment like /*TYPESECTION*/ is also one of them.
12:47:57FromDiscord<clyybber> I don't like the part of the proposal to put emit and asm out of the triple quoted string literals
12:48:08krux02commants arn't supposed to have semantic.
12:49:10krux02The last one is. I have a C code within Nim code. My editor can highlight C code nicely: Is there a reliable way to tell my editor to highlight a subset of my file as C instead of Nim?
12:49:26FromDiscord<clyybber> Thats an editor problem
12:49:50leorizeyes, highlight a region that starts with `{.emit:\s+"""` and ends with `"""\.\?}`
12:49:54krux02clyybber: that is means the language doesn't need to care about how hard it is for the editor to support it?
12:49:58FromDiscord<clyybber> Yeah
12:50:01krux02no
12:50:04krux02I disagree.
12:50:06FromDiscord<clyybber> And also its not hard
12:50:29leorizewell I just gave you how to highlight inline C code :P
12:50:53krux02leorize, that would work
12:50:53Araqhow exactly are "indentation based string literals" easier for the editor support?
12:51:31Araqand are we even talking about "indentation based string literals (via asm?)" or are we talking about emit
12:52:06*Trustable quit (Remote host closed the connection)
12:52:18Araqthis is all messed up, which is why I seek to close both the RFC and the PR fwiw
12:52:18*chemist69 quit (Quit: WeeChat 2.7)
12:52:26*hpyc9 quit (Quit: FREENODE IS FUCKING GAY)
12:52:37*hpyc9 joined #nim
12:52:40Araqbut hey, I'm "in denial", so I re-opened it, have fun
12:52:47krux02Araq: The problem with end tokens is, they might be ambiguous. A ) always closes the last opene (, An xml end tag for example is named, when you encounter </mytag> it closes the opened <mytag>
12:53:12krux02that helps the editor a lot during the time when the text isn't fully written yet.
12:53:16*chemist69 joined #nim
12:53:21leorizeI'd tell you that indentation-based literals make things harder to support, at least with vim
12:53:37krux02incomplete stant end tokens often meke the editor rehighlight the entire file
12:53:40FromDiscord<clyybber> Yeah, and it also opens a whole can of worms
12:53:49FromDiscord<clyybber> Better to leave emit taking a string literal
12:53:55Araqthere is an existing RFC for indentation based string literals too
12:54:14*zacharycarter joined #nim
12:54:19krux02leorize, yes thank you, this is the type of comments I am hoping for.
12:54:52krux02If you say it is really hard to support in popular editors it is an argument to not use indentation based string literals.
12:55:40FromDiscord<clyybber> So whats left is the enum for where we emit stuff
12:56:27krux02In org-mode (emacs specific) there are code sections in other programming languages. Org mode fully supports syntax highlighting for these embedded code sections. But it does so by using very unambiguous start and end tokens.
12:56:48krux02clyybber: No
12:57:02FromDiscord<Recruit_main707> as a side note: if youd need C++ highlight for the code inside your emit, dont you think it would be more fitting to just have it in a separate cpp file, and wrap it in nim?
12:57:23krux02clyybber: Just because an idea seems to be bad. It isn't rejected yet. And if it is rejected it doesn't mean the search for an alternative is over.
12:57:56leorizeI think it helps to present the problem and what you're trying to improve in a RFC
12:57:57krux02Recruit_main707: depends
12:58:05krux02not necessarily.
12:58:20leorizecurrently all I see is "I don't like this, can we change?"
12:58:24krux02That is like saying you never want embedded javascript in an html document.
12:58:37FromDiscord<clyybber> And I really don't see whats wrong with having C code in a string literal
12:58:50FromDiscord<clyybber> Whats the advantage of having it without """
12:58:50FromDiscord<Recruit_main707> but being that small, you should not need highlight then
12:59:25FromDiscord<clyybber> Its really ugly IMO since it blurs the lines between nim code and C code. Just imagine what happens to preprocessor statements
12:59:37FromDiscord<clyybber> Its a can of worms that need not be opened
12:59:42FromDiscord<clyybber> Simply use string literals
13:00:00FromDiscord<clyybber> And if you want to indent them write a helper and do """...""".unindent
13:00:57dadadahow about developing indention based markdown support for Nim, that get's converted to a string in compilation, and enable an extension for this markdown that supports embedding of code including a hint for the lang, that way this feature could be reused for anything and not only emit, and editors would simply have to understand how Nim designates a markdown section (by indentation) and to support markdown
13:00:57krux02leorize, there has been a lot of aggrevation of timothee's RFC's issues and pull requests. Please don't take them too serious. This what was proposed here in this PR by him was something that I mentioned in a conversation might be a good idea, and he converted it into an RFC because that is all we have right now. But to be honest it is nothing more than a proto RFC. The verbosity of timothee's style of writing RFC's
13:00:57krux02make it seem more than it actually it.
13:01:18krux02s/it\.\>/is./
13:01:26Araqwell I'm still waiting for an analysis of 'emit's problems
13:01:39*beatmox quit (Remote host closed the connection)
13:01:53krux02tsizeof.nim
13:01:58Araqso far I heard arguments against triple quoted strings which we have an RFC for already.
13:02:05*xcm quit (Remote host closed the connection)
13:02:15krux02the c_sizeof doesn't work top level because of the way `emit` works.
13:02:29krux02The solution is "HERE" generation flag.
13:02:39FromDiscord<clyybber> So can we cut the RFC down?
13:03:00FromDiscord<Recruit_main707> dadada: from my complete ignorance, that seems utterly complicated and not useful
13:03:02krux02clyybber: That is something that you have to figuer out with timothee.
13:03:23krux02You can take the RFC over by making your own less verbose RFC that includes all the necessary information.
13:03:50krux02But it really wears you down if you do it all the time.
13:04:04FromDiscord<clyybber> @timotheecour Can you extract the emit("here") into a seperate RFC?
13:04:16*xcm joined #nim
13:04:36leorizeyou know that highlighting `emit` is not hard when even github can do it :p
13:04:50leorizeand they can't properly highlight `8'u8` literals
13:04:51dadadaRecruit_main707: since markdown has become kind of a standard, first class lang support for it seems quite support
13:04:52*beatmox joined #nim
13:05:07dadadas/quite support/quite useful
13:06:27leorizesorry, but it's still no justification for overcomplicating things
13:06:35FromDiscord<clyybber> dadada: Sounds like you want macro DSL
13:06:43leorizeand iirc docgen supports an RST/markdown mix
13:06:44FromDiscord<clyybber> This is about emit tho
13:06:48FromDiscord<clyybber> A builting pragma
13:08:17Araqbtw .emit doesn't take a string literal. it takes a string literal or an array of string pieces to avoid the quoting hell
13:08:54krux02Araq: yes and the array is ugly.
13:08:56FromDiscord<Recruit_main707> a very good decision imo
13:09:18krux02It makes the potential support for syntax highlighting in emit code sections completely impossible.
13:09:19Araqkrux02, ugly syntax for ugly semantics is a fair deal IMHO.
13:09:54leorizekrux02: the array just make it not possible when you're using it
13:10:15leorizeif you use the triple-quote syntax it's easy to highlight it
13:10:25FromDiscord<Recruit_main707> and allows some nim syntax highlight
13:11:15leorizecase in point: github can even highlight `emit`, while they struggle with `'i32` suffixes
13:12:47*Vladar quit (Quit: Leaving)
13:12:57leorizeI think the biggest issue with `emit` is how it lures the user into thinking that "the generated C code is ordered exactly like the Nim code"
13:13:59leorizetsizeof demonstrates this problem: you have an emit block before a `type` block (in the middle of the file), thinking that they will be added in the same order
13:14:11FromDiscord<mratsim> the array is ugly ... very ugly: https://github.com/mratsim/constantine/blob/master/constantine/primitives/extended_precision_64bit_uint128.nim#L32-L99
13:14:59*MarderIII quit (Ping timeout: 260 seconds)
13:15:04FromDiscord<mratsim> interpolation would be much nicer (note this code is working by luck): https://github.com/numforge/laser/blob/master/benchmarks/transpose/transpose_bench.nim#L144-L167
13:15:48FromDiscord<mratsim> I could do a macro though that transform interpolation in correct emit code
13:16:06FromDiscord<Recruit_main707> thats a good idea
13:19:07Araqmratsim: and why is that a problem? why is the real problem not identified as "Nim should support C's int128 type"?
13:19:30*MarderIII joined #nim
13:20:38Araqand why is tsizeof relevant for anything? it's a test testing nasty stuff, it's not representative for anything.
13:20:39FromDiscord<mratsim> the array being ugly makes it harder to write correct code
13:20:58FromDiscord<mratsim> it's easy to miss a parenthesis in the forest of quote and commas for example
13:22:07krux02leorize, for editors it is good if there is an unambiguous regular expression to detect the beginning and the end. tripple quotes alone are ambiguous. Including the full pragma though could work.
13:22:21FromGitter<Clyybber> triple quotes are not ambiguous..
13:22:33leorizekrux02: they are not ambiguous...
13:22:43leorizeI wrote editor plugins, I know
13:23:04Araqand indentation based literals have no regex to begin with.
13:23:06krux02tripple quots can be any tripple quotes, how should the editor know that this string should be C code?
13:23:09krux02It needs context.
13:23:24FromGitter<Clyybber> So look at the emit
13:23:29leorizekrux02: I gave you the regex needed earlier
13:23:35krux02I know I kno
13:23:43krux02I also reference that
13:23:54Araqtemplate ccode(x: untyped): untyped = x
13:24:06Araq.emit: ccode"""works"""
13:24:24krux02Araq: yes that works
13:24:31leorizeif markdown's inline code can be highlighted by editors, I see no problem in highlighting emit
13:24:41krux02I don't think tripple quotes within C code is a thing.
13:24:46leorizeyou need a more convincing case
13:24:54krux02And we don't support emitting python code.
13:24:57FromDiscord<mratsim> VScode properly highlight the emit code, unless "lo" appears
13:25:10FromDiscord<mratsim> not sure why
13:25:11krux02lo?
13:25:14FromDiscord<mratsim> yes lo
13:25:34FromDiscord<mratsim> you can check with this file: https://github.com/mratsim/constantine/blob/master/constantine/primitives/extended_precision_64bit_uint128.nim#L32-L99 cs this one https://github.com/numforge/laser/blob/master/benchmarks/transpose/transpose_bench.nim#L144-L167
13:25:38FromDiscord<mratsim> vs*
13:25:38AraqVSCode's syntax highlighting is just broken in all sort of ways
13:25:41krux02mratsim: do you have a screenshot? I don't have vscode installed right now.
13:25:45leorizefile a bug I guess, though I don't maintain that plugin :P
13:26:29Araqleorize, I gave up on it
13:26:38krux02I maintain emacs syntax highlighting. That doesn't mean I have a solution for everything though.
13:26:40Araqit doesn't even understand Nim's keywords properly
13:27:21krux02The process to fix nim syntax highlighting in emacs was to remove most of it.
13:27:34FromDiscord<mratsim>
13:27:34FromDiscord<mratsim> https://cdn.discordapp.com/attachments/371759389889003532/699974199934189568/2020-04-15_15-27.png
13:27:44Araq^ I can imagine the same is true for VSCode's highlighter
13:28:18FromDiscord<mratsim> or it's the emit array that is broken
13:28:25leorizeyea the vscode highlighter is broken
13:28:49Araqmratsim: how did you manage to use the same color for 'proc' and 'for'?
13:29:18leorizeI know how to highlight that in vim, and I'll add that in just to prove the point :P
13:29:24FromDiscord<mratsim> afaik it's the C code highlighter
13:29:44FromDiscord<mratsim> or not
13:29:48FromDiscord<mratsim> just the color scheme
13:30:12FromGitter<alehander92> krux02 that indented other code idea seems interesting
13:30:17FromGitter<alehander92> but kinda radical
13:31:19krux02alehander92: The thing about that is, if the editor can support indeted blocks of foreign code. It is impossible to mess it up.
13:31:48krux02The editor won't accidentally make half of the file C code.
13:31:53leorizeusually editors try not to care about indentation rules when highlighting
13:32:01krux02leorize, that is the problem
13:32:22Araq5 minutes ago you argued for regex based highlighting though
13:32:59krux02I am just explaining my reasoning behind the indentation besed idea.
13:33:07krux02currently they are both ideas.
13:33:16krux02I did not fully reject any of them.
13:33:37FromGitter<alehander92> ok but how many editors can do it
13:33:52FromGitter<alehander92> i'd guess markdown support is the closest thing
13:34:01*nc-x joined #nim
13:34:02FromGitter<alehander92> if most ide-s support markdown with random code in sections
13:34:08krux02mratsim: thanks a lot for the screenshot. I had no idea on its support for C syntax highlighting in Nim code.
13:34:12FromGitter<alehander92> this might be achievable
13:34:30FromGitter<alehander92> but i find something else bad
13:34:39krux02alehander92: you mean gihub markdown?
13:34:40FromGitter<alehander92> if you have long C/JavaScript snippets
13:34:47FromGitter<alehander92> yes, sorry
13:34:54krux02```nim <--- not standard markdown
13:35:06FromGitter<alehander92> so if you have those, you can open nim files and just look at a lot of random otherlanguage highlighted code
13:35:10FromGitter<alehander92> and this is somehow confusing
13:35:20companion_cubeAraq: fwiw, vscode will move to tree-sitter, I think? which is more powerful than regexes
13:35:23FromGitter<alehander92> like, e.g. rst/github markdown: one expects
13:35:29FromGitter<alehander92> that
13:35:41FromGitter<alehander92> i can think mostly of html/php as other examples of this style
13:35:57krux02mratsim: this `lo` in code that breaks everything doen't make sense at all for me.
13:36:08krux02alehander92: yes
13:36:14krux02also html/javascript
13:36:27krux02or JSP
13:36:33FromDiscord<mratsim> @krux02, I think it aws the "{.emit:[" syntax
13:37:02FromDiscord<mratsim> lo just happened to be at the beginning when I noticed highlight breakage
13:37:13FromDiscord<mratsim> I think it's*
13:38:30nc-xwell, vscode just stabilized semantic highlighting a few days ago. And I think nimsuggest already provides that output (leorize's nvim.nim uses it for semantic highlighting IIRC)
13:38:41krux02since you actually use the `emit` statement your opinion on this idea we just discussed might be important: https://github.com/nim-lang/RFCs/issues/210
13:38:45nc-xso somebody just needs to add support in the vscode nim plugin
13:38:54krux02but don't participate in anying emotianl stuff.
13:38:57FromDiscord<mratsim> @Araq, regarding int128 support in Nim, it's a good idea but I think providing MSVC API is probably easier to support on most platform: https://github.com/mratsim/constantine/blob/master/constantine/primitives/extended_precision_x86_64_msvc.nim#L24-L31
13:39:09krux02Only in ideas, becauese it is just an idea, nothing more.
13:40:19*jjido joined #nim
13:42:16*nc-x quit (Remote host closed the connection)
13:42:23zacharycarterI have a app built with --gc:arc that is loading a shared library and calling a function in it via the dynlib module
13:42:31Araqand here is the other, older RFC https://github.com/nim-lang/RFCs/issues/161
13:42:40krux02mratsim: Are you talking about `int128` as a builtin type that is just supported, or are you talking about the internal `int128`?
13:42:44zacharycarterIt's being passed a ref object and I'm assigning a value to a field defined in the object
13:43:25zacharycarterI'm then creating another object and passing that to some C code, and I'm copying that field's value into another field in this new object
13:44:01zacharycartermy program hangs when the c code tries to dereference the cstring for value assignment
13:44:12zacharycarterbecause of an EXC_BAD_ACCESS
13:44:23krux02zacharycarter, my recommendation: debug it.
13:44:39krux02but build without line information, just with debug information.
13:44:49FromGitter<alehander92> guys
13:44:50zacharycarterokay
13:44:53krux02Then you debug the generated C code, that allows you to spot incorrect code generation..
13:44:53FromGitter<alehander92> sorry for offtopic
13:45:03FromGitter<alehander92> especially krux02 as you are good with debug/codegen
13:45:13FromGitter<alehander92> how should i generate lineinfo-s for generated nodes
13:45:28FromGitter<alehander92> with copyLineInfo or with other more idiomatic way?
13:45:41krux02alehander92: currently you can't set the line information for generated nodes.
13:46:09krux02you can set the line information of other already existing nodes though.
13:46:12FromDiscord<mratsim> @krux02 we were talking about the runtime int128, not the one in the compiler
13:46:17*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
13:46:22krux02yes copyLineInfo is the only option right now
13:46:31krux02mratsim: ok
13:47:50krux02but as soon as runtime `int128` is supported as a builtin type the internal integer must be lifted to int256, or at least `int129` (if that is even a thing) to reintroduce all the problems the compiler had before the internal `int128` was introduced.
13:48:02FromGitter<alehander92> krux02 sorry, that's what i mean
13:48:45FromGitter<alehander92> e.g. if i generate a procedure, and i copyLineInfo to the symbol node of its name / the node of the iterator itself, this should work for linedir
13:49:10FromDiscord<mratsim> it doesn't need to be a builtin type and there is no need to allow compile-time computation on it
13:49:34FromDiscord<mratsim> for starter, just allowing additoon/substraction/negate/multiplication/division/shifts is good
13:50:05FromDiscord<mratsim> and to be cross-OS, you probably need an umul128 and udiv128
13:51:31FromDiscord<mratsim> and otherwise if we want to allow compile-time compilation of those, it probably makes more sense to have a generic fixed precision library in the compiler like LLVM APInt
13:54:57Araqthat's all true, I hesitate to do that because of the Nim VM
13:55:41*waleee-cl joined #nim
13:55:48Araqa VM that uses bigints for a language that otherwise uses machine integers is a recipe for inconsistencies. though extensive testing helps.
13:55:58*jjido joined #nim
13:57:28FromDiscord<mratsim> If you want the same representation as what an "wide-integer" would be in an underlying platform, it's just a "when cpuEndian == bigEndian" switch away
13:58:19Araqit's also diverse bitmask operations away
13:58:30FromDiscord<mratsim> besides Stint which only operates on power of 2, in constantine I also have my own VM compatible bigint library and it can operate on weird sizes like BigInt[17] or BigInt[381]
13:59:49*chemist69 quit (Ping timeout: 272 seconds)
14:00:53*chemist69 joined #nim
14:05:20*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
14:22:11FromGitter<sealmove> how to make this work? https://play.nim-lang.org/#ix=2i9x
14:24:37*Cadey is now known as Xe
14:25:39shashlickAraq: for types which are importc
14:25:41shashlick```Error: cannot evaluate 'sizeof' because its type is not defined completely```
14:26:34shashlickbut the entire object is defined
14:26:58*jjido joined #nim
14:27:03shashlickhttps://play.nim-lang.org/#ix=2i9A
14:35:17*icebattle joined #nim
14:36:27*Cadey joined #nim
14:49:41FromDiscord<mratsim> int64/float64 should work
14:49:48FromDiscord<mratsim> your types are target dependent
14:50:41shashlickI tried 64 and get the same error
14:51:05shashlickbasically, i'm trying to add a feature to nimterop to check that the types it generates matches the sizes of the actual C type
14:51:06FromDiscord<mratsim> this worked for me: https://github.com/nim-lang/Nim/issues/7675#issuecomment-383405960
14:51:18shashlickbut not able to get the size, and even emit is not working as expected
14:51:21FromDiscord<mratsim> see the int128 code with dummy uint64 fields
14:51:49FromDiscord<mratsim> the fields were added for sizeof
14:53:14shashlickhmm, cannot do that when generating types from C headers
14:59:44shashlickmy other option is to use emit and do the check during runtime - it is purely for test purposes but am wondering how to check sizeof(Ctype) == sizeof(Nimtype) if they have the same name
15:03:32*nsf quit (Quit: WeeChat 2.8)
15:05:26*icebattle quit (Ping timeout: 256 seconds)
15:10:45*zacharyc1rter joined #nim
15:12:52FromGitter<alehander92> Araq
15:13:00FromGitter<alehander92> i am not good at the vm thing
15:13:04FromGitter<alehander92> how are hints printed
15:13:35FromGitter<alehander92> e.g. i do echo stuff; symbol.copyLineInfo(code); echo stuff
15:13:54FromGitter<alehander92> and i print stuff from vmgen when copyLineInfo is invoked
15:14:03FromGitter<alehander92> and this print seems to happen way before the stuff thing
15:14:44FromGitter<alehander92> i guess the vm executes all the opcodes and .. somehow flushes the echo after finished?
15:15:20FromGitter<alehander92> ah i need to add `static:` , still wonder why are those printed at all otherwise
15:15:26*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
15:20:36FromGitter<faulander> since today i get an indentation error on line 14 when compiling. same code, copied/pasted works in nim playground. i even tried putting comments in line 1-20 and i still get the same error. any clues?
15:21:59FromGitter<alehander92> can you link the code
15:23:28*icebattle joined #nim
15:25:35*jjido joined #nim
15:25:37FromGitter<faulander> it works in playground
15:26:03FromGitter<faulander> https://play.nim-lang.org/#ix=2ial
15:27:15FromGitter<faulander> compiler tells me its on line 14, i even deleted the first two lines, so the line which was before 14 is now 12. i still get the exact same error
15:29:03*Vladar joined #nim
15:29:51FromGitter<faulander> i think its in the proc hash*s last line
15:30:42*zacharycarter quit (Quit: Lost terminal)
15:30:42*zacharyc1rter quit (Quit: Lost terminal)
15:31:29*NimBot joined #nim
15:31:41FromGitter<alehander92> are you .. sure
15:31:46FromGitter<alehander92> you are not compiling the wrong file
15:31:50FromGitter<alehander92> this happens from time to time
15:31:55*sunwukong quit (Quit: Leaving)
15:31:58FromGitter<alehander92> to me
15:32:05FromGitter<alehander92> and it's always very confusing
15:32:29FromGitter<alehander92> it really sounds like this kind of thing
15:33:00FromGitter<faulander> aaaaaaaaaaaaaaaaaaaaaah
15:33:08FromGitter<faulander> i am soooooo sorry, i am such a total newb
15:33:19FromGitter<faulander> this did cost me an hour now! grrrrrrrr
15:33:26FromGitter<faulander> thanks alex, thanks so much! :*
15:33:38FromDiscord<Rika> lmao
15:34:03FromGitter<alehander92> @faulander no problem it happens a lot to me as well
15:34:15FromGitter<faulander> at least i can make you laugh :)
15:34:16FromGitter<alehander92> especially when you maintain several versions of the same code/project
15:34:24*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
15:35:03FromGitter<alehander92> one possible hint i can think of is somehow the compiler hinting a warning "no changes to source since last compilation with the same flags"
15:35:15FromGitter<alehander92> which would be great in detecting stuff like that
15:35:51FromGitter<alehander92> but it's very niche and probably too expensive for big projects , maybe a more general solution can be integrated in build systems which already track files
15:38:43FromGitter<alehander92> faulander laughing can be quite helpful :P
15:38:58*jjido joined #nim
15:39:04FromDiscord<Rika> i dont think its too expensive, given that nim already doesnt recompile if no change has happened
15:39:19FromDiscord<Rika> its probably just a matter of adding some print statement
15:39:32*jjido quit (Client Quit)
15:39:42shashlickping leorize
15:41:16FromGitter<alehander92> not if you run `nim c`
15:41:26FromGitter<alehander92> it detects that only for the c files
15:41:34FromGitter<alehander92> which are organized in nimcache
15:41:44FromGitter<alehander92> at least thats what i guess?
15:42:10*jjido joined #nim
15:50:03*nsf joined #nim
15:56:30*icebattl1 joined #nim
15:57:51*thomasross joined #nim
15:58:38*icebattle quit (Ping timeout: 256 seconds)
15:59:29*Trustable joined #nim
16:07:41*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
16:09:22FromGitter<faulander> i have now made a task file in visual studio code, which automatically compiles the open file.
16:10:37FromGitter<faulander> if someone wants it --> https://play.nim-lang.org/#ix=2iaD
16:10:58FromGitter<faulander> must be in folder .vscode in tasks.json
16:12:49FromDiscord<Rika> big brain uses playground for nonnim code/data
16:13:10FromDiscord<Recruit_main707> bold statement
16:13:20FromGitter<faulander> very nice Rika
16:14:17FromGitter<faulander> big brain Rika doesn't recognize that big brain faulander is making newbie mistake ...
16:14:23FromGitter<faulander> +s
16:14:29FromGitter<faulander> (a lot of them)
16:15:20FromDiscord<Rika> i aint yo personal code proofer
16:15:50FromGitter<faulander> did i ask something directly from you may i ask?
16:16:04FromDiscord<Rika> nah
16:16:05FromDiscord<Rika> why
16:16:36FromGitter<faulander> because you state that "i am not your personal code proofer" and i never asked you to be.
16:16:50FromDiscord<Rika> `big brain Rika doesn't recognize that big brain faulander is making newbie mistake`
16:17:01shashlickchill guys
16:17:04FromDiscord<Rika> this implies that i should have recognized it
16:17:11FromDiscord<Rika> i thought you jokin
16:17:12FromGitter<faulander> well, that was a reply to your nice comment
16:17:13FromDiscord<Rika> i aint serious
16:17:49FromDiscord<Rika> lmao okay
16:18:19*chemist69 quit (Quit: WeeChat 2.7)
16:18:34*chemist69 joined #nim
16:19:11*fputs joined #nim
16:25:14*Vladar quit (Quit: Leaving)
16:28:34*JohnAD quit (Ping timeout: 240 seconds)
16:32:00*jjido joined #nim
16:36:02*nsf quit (Quit: WeeChat 2.8)
16:44:24*waleee-cl quit (Quit: Connection closed for inactivity)
16:44:40*Vladar joined #nim
16:45:52*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
16:52:51Yardanico@faulander if you have nim extension installed in vscode you can just hit F6 to compile and run currently opened nim file
16:52:59Yardanicono need to create tasks manually
16:57:39*Vladar quit (Read error: Connection reset by peer)
16:58:04*Vladar joined #nim
16:59:21shashlickis it possible to hide certain procs from doc output
16:59:38shashlickthey still need to exist, cannot just use when not defined(nimdoc)
17:00:53shashlickalternatively, is it possible to have the export marker as a variable that can be on and off without having to duplicate the entire proc line
17:04:02*jjido joined #nim
17:04:02*endragor quit (Remote host closed the connection)
17:06:32FromDiscord<Skaruts> man... this is a bit of a trap in templates: https://play.nim-lang.org/#ix=2ibq
17:07:22FromDiscord<Varriount> Skarut's: True... but the only good way for the compiler to show that would be to show the "expanded" template.
17:08:06FromDiscord<Varriount> That's also why it's good policy not to re-use identifiers anywhere in a template, if you can help it.
17:09:27Yardanicoyeah, because then you can get all sorts of interesting bugs because your code will be run twice instead of being run once :P
17:10:29FromDiscord<Skaruts> I fell for this a few times :S
17:10:53*zacharycarter joined #nim
17:11:17zacharycarterquestion - I'm allocating a string inside of a shared library I'm loading with the dynlib module's `loadLib` proc
17:11:51zacharycarterI pass in a var object to this proc and assign a string to one of its fields
17:12:12zacharycarterback in the host program I then assign this field's value to another field in another object, and then I unload the library
17:12:27zacharycarterIt seems like the string gets collected though when I unload the library - which makes sense
17:12:45zacharycartercan I allocate a new string and copy the value from the old string?
17:13:50zacharycarteror should I use GC_ref or something
17:14:20Yardanicowell I know there's deepCopy in default GC but I'm not sure if it's what you need really
17:14:28YardanicoI'm not experienced with memory management really
17:14:33zacharycarterI'm using --gc:arc
17:14:37Yardanicooh
17:14:59zacharycarterin both the host program and the shared lib
17:16:55zacharycarterGC_ref seems to work
17:18:11*fputs quit (Quit: WeeChat 2.8)
17:19:29*fputs joined #nim
17:23:37*hax-scramper quit (Ping timeout: 265 seconds)
17:27:59zacharycarteroh cool - I don't even need to rely on GC_ref I can just do `let foo = $foobar`
17:38:04FromDiscord<Skaruts> another trap, but this one's on me: https://play.nim-lang.org/#ix=2ibI 😄
17:38:31Yardanicoplayground shows a different error though
17:38:32FromDiscord<Skaruts> gotta remember not to put that discard there because I always forget it's there when I add the block of code...
17:38:35Yardanico/usercode/in.nim(15, 8) Error: expression 'echo ["template fooing!"]' has no type (or is ambiguous)
17:38:55FromDiscord<Skaruts> yup that's the error I get
17:39:08FromDiscord<Skaruts> remove the discard and it's all fine
17:39:29FromDiscord<Skaruts> oh I forgot to take the previous error comments
17:39:37FromDiscord<Skaruts> disregard those
17:40:24FromDiscord<Rika> The discard immediately ends the block so technically the echo fooing is an invalid indentation error, isn't it?
17:41:07FromDiscord<Rika> But I think what nim interprets it as is that the discard statement is discarding the echo
17:41:21Yardanicolet's check with a macro
17:41:22FromDiscord<Rika> Since echo is void, it spits the no type error
17:41:44FromDiscord<Skaruts> oh, yea that's probably what it's doing, @Rika
17:42:04Yardanico@Rika's right
17:42:12Yardanicohttps://play.nim-lang.org/#ix=2ibN
17:42:24Yardanicogives
17:42:32Yardanico(Arglist (StmtList (DiscardStmt (Command (Ident "echo") (StrLit "template fooing!"))))) (changed to lispRepr so it's 1 line)
17:42:41Yardanicoso it discards an echo call
17:44:50FromDiscord<Skaruts> heh, knowing that would've saved me 10 minutes figuring it out
17:44:56*moerm joined #nim
17:45:09moermHello everyone
17:45:14Yardanicoi'm still really confused about that though @Skaruts
17:45:35FromDiscord<Skaruts> about what?
17:46:06Yardanicoabout the error
17:46:08Yardanicoand why it happens
17:46:22*rockcavera quit (Remote host closed the connection)
17:47:21*filcuc joined #nim
17:47:37FromDiscord<Skaruts> seems to me you're both right, it's pretty much interpreting as a statement `discard echo "template fooing!"`
17:47:41FromDiscord<Skaruts> https://play.nim-lang.org/#ix=2ibU
17:48:03Yardanicobasically yeah https://play.nim-lang.org/#ix=2ibV
17:55:34*rockcavera joined #nim
18:04:37FromDiscord<Rika> It really should give an indentation error instead though
18:05:19Yardanicoyes
18:05:25Yardanicowell discard is quite special
18:10:48*moerm quit (Quit: Leaving)
18:12:24leorizeshashlick: you pinged me?
18:13:42*hax-scramper joined #nim
18:15:59shashlickya had a question around the enum implementation in nimterop
18:16:21shashlickdistinct int ends up in wrong size in nested structs so had to change it to distinct cint
18:16:39shashlickwill be ideal if you could join the nimterop gitter room
18:17:36shashlickwas thinking of https://play.nim-lang.org/#ix=2iaK as the new implementation but then A or B won't work as proc params since they get converted into int
18:17:51*endragor joined #nim
18:23:08*endragor quit (Ping timeout: 256 seconds)
18:24:45leorizewait you implemented them as distinct int? shouldn't they be distinct cint?
18:26:57shashlickyes have changed it now
18:27:15shashlickhttps://github.com/nimterop/nimterop/blob/nested/nimterop/types.nim
18:27:25shashlickhave nested struct support now in nimterop
18:28:15*filcuc quit (Ping timeout: 250 seconds)
18:31:19PrestigeLooks like nimpretty isn't respecting --maxLineLen, anyone else seeing that?
18:32:58*audiofile joined #nim
18:36:36*jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
18:55:01shashlickdoes it make any sense to wrap static inline functions?
18:57:59leorizeusually you translate the function into nim :P
18:58:03leorizebtw what's the gitter room?
18:58:28Yardaniconim-lang/nim
18:59:07leorizeI mean for nimterop :P
18:59:16shashlickhttps://gitter.im/nimterop/Lobby
18:59:24shashlickfolks can ask their questions around nimterp
19:00:06FromDiscord<Recruit_main707> aka: i fill the chat with questions :P
19:03:05shashlickonce compiled, those inline functions don't really exist right? they aren't callable?
19:04:32FromDiscord<Recruit_main707> depends on the compiler i think, i guess if you call them they wont be inlined
19:06:45leorizeshashlick: usually they are fully inlined
19:10:44*xcm quit (Remote host closed the connection)
19:13:29*xcm joined #nim
19:15:53*waleee-cl joined #nim
19:35:00*icebattl1 quit (Quit: leaving)
19:35:25*icebattle joined #nim
19:40:52*xcm quit (Remote host closed the connection)
19:43:03*xcm joined #nim
19:55:20FromDiscord<Skaruts> is there a way to prevent the docs from going in dark mode all the time?
20:03:48PrestigeDoes anyone know what "nimcheck" is?
20:04:45Yardanico"nim check" checks if your program is correct Nim code :)
20:05:03Yardanicoand if it's not, it'll show what errors you have
20:05:20Prestigeah thank you
20:05:29Yardanicobasically it has the same behaviour as the compiler but without the code generation step
20:06:04Yardanicoyou can also supply it with the same arguments as the Nim compiler like "nim check --threads:on"
20:06:04Prestigestill debugging why nimlsp diagnostics aren't working with my lsp client, but ALE was. It was getting error info from nim check, rather than nimlsp
20:08:09Yardanico"nim check" is mostly used for IDEs/editors to highlight errors in your code right in the editor, but of course it can be used stand-alone too
20:09:14Yardanicothe most complete nim extension is IMO the VSCode one, it has stuff like error highlighting, F6 to compile & run current file, nimsuggest integration, nimpretty integration
20:14:03*narimiran quit (Ping timeout: 260 seconds)
20:15:05*jjido joined #nim
20:19:59PrestigePMunch: are you sure diagnostics are being reported from nimlsp itself via the protocol?
20:20:25*hpyc9 quit (Killed (Sigyn (Stay safe off irc)))
20:25:42*Vladar quit (Quit: Leaving)
20:28:07FromDiscord<kodkuce> lol i using vscode whole time only like a month used neovim and i dident know F6 is compile and run
20:32:46*tane joined #nim
20:33:49*MarderIII quit (Quit: Leaving)
20:41:43PrestigeI compiled nimlsp from source and copied nimsuggest into src/nimlsppkg/ then edited a file, here's the output PMunch https://0x0.st/iQJe.txt
20:42:09PrestigeThe very last line is "Trying to read frame" I wonder if something failed?
20:46:47*hpyc9 joined #nim
20:50:39Yardanicowow git bisect is impressive
20:50:51YardanicoI never used it but just found the first broken commit for https://github.com/nim-lang/Nim/issues/13935 in a few minutes
20:52:28Yardanicoand it's easy to use too, just "git bisect start", "git bisect bad # current is bad", "git bisect good <commit-hash-of-good-revision", and then ./koch temp c stuff and "git bisect good" or "git bisect bad"
20:56:46*Ven`` joined #nim
20:57:54*solitudesf quit (Ping timeout: 256 seconds)
21:00:57shashlickAraq, leorize: do you have any ideas on how I can validate that the type wrappers I create with nimterop are correct in size?
21:02:55leorizewe have -d:checkAbi for this iirc
21:04:11leorizeYardanico: beware that git bisect can lead you to the wrong place to look for bugs
21:04:25Yardanicowell in this case it seems to do the right thing
21:04:38Yardanicothe commit before that commit works fine, and the first "bad" commit is directly related to threads and --gc:arc :)
21:05:34leorizebe sure to double check if it's the bug or it just expose a hidden one :P
21:06:24Yardanicobtw how do I bind a proc with arguments in a template?
21:06:30Yardanicoif it's imported from another module
21:06:33Yardanicoor I can't?
21:07:23leorizeYardanico: wdym?
21:07:57Yardanicosystem.nim has sysAssert template which uses rawWrite from system/ansi_c
21:08:06Yardanicoah nvm I can just make it a proc temporarily
21:08:19leorizeadd `bind rawWrite`
21:11:34PMunchPrestige, sorry left my client connected while I was gone
21:11:54PrestigeNp
21:12:07PMunchAnd yeah I'm sure
21:12:40PrestigeAny thoughts on the last message I sent?
21:13:04PMunchIf I disable my other Nim plug-in (zah/nim.vim) and open a file and run ":setf nim :e!" it starts showing diagnostics when I save the file
21:13:42PMunchHmm, strange
21:14:21PMunchIt's getting late here now though, I'll have a look at it tomorrow
21:14:42PMunchMight be a good time to have a look at the nimlsp code as well. It has an annoying bug that I really want to iron out
21:15:21PrestigeI appreciate it, if I can help somehow let me know PMunch
21:15:44leorizeyou can look at the code :)
21:15:53leorizeit's not too complicated afaict :)
21:16:48PrestigeI'm not familiar with lsp but I'll take a look
21:17:00*tane quit (Quit: Leaving)
21:17:25PMunchYeah if you stick to this file it should be pretty to understand: https://github.com/PMunch/nimlsp/blob/master/src/nimlsp.nim
21:18:49PMunchHmm, it seems like it might not detect it as a valid DocumentNotification..
21:18:57leorizeif you can, can you fix the bug with forward declaration in nimsuggest?
21:20:50PMunchForward declaration?
21:22:23leorizeyea, http://ix.io/2idu
21:27:57PMunchAh, figured out the bug Prestige
21:28:01PrestigeI think you might be right - textDocumentNotification might just be failing on the source for some reason
21:28:03Prestigeoh?
21:28:23PMunchYour LSP client is sending messages that don't match the schema
21:28:53PrestigeIf you can provvide some specifics I'll file a bug report with the client
21:28:59Prestiges/provvide/provide
21:29:00*filcuc joined #nim
21:30:40PMunchSo the textDocument/didSave is supposed to have a DidSaveTextDocumentParams as the params. And DidSaveTextDocumentParams is supposed to have a textDocument field of the kind TextDocumentIdentifier. This only has one field according to the spec, namely uri which is supposed to be a DocumentUri. But your client sends: `{"uri":"file:///home/avahe/programming/nim/testing/test.nim","version":1}` ie. it has an extra version field.
21:31:39Prestigeah and that extra field is causing a breakage? I thought it'd just get ignored. But that's awesome, thanks for figuring that out
21:31:46PMunchThis makes the check performed here: https://github.com/PMunch/nimlsp/blob/master/src/nimlsp.nim#L440 (through the textDocumentNotification template that calls whenValid which calls isValid from jsonschema: https://github.com/PMunch/jsonschema/blob/master/src/jsonschema.nim#L356
21:31:48PMunch)
21:32:16PMunchAs you can see `isValid` has an option `allowExtra` that defaults to false.
21:32:40Prestigeah interesting
21:32:54PMunchSo if you change this line: https://github.com/PMunch/nimlsp/blob/master/src/nimlsp.nim#L53 to have allowExtra=true it should work
21:33:33Prestigeand line 58 I suppose wouldn't hurt either
21:34:26PMunchYeah, for a proper fix, but it should work for this specific case by only changing line 53
21:36:18Prestigeah it's working! Thanks :)
21:36:24PMunchNo problem :)
21:36:25PrestigeThis is great
21:36:36PMunchI could've sworn that I had fixed that in nimlsp..
21:36:51Prestigedifferent branch maybe?
21:36:52PMunchI think I even implemented allowExtra in jsonschema for the express purpose of using it in nimlsp..
21:38:46PrestigeAt least it was a simple fix. I'm very glad this works now
21:40:45PMunchThis is so weird..
21:41:13PMunchI really thought there was an issue with a similar thing, that got resolved by me adding allowExtra and toggling it in nimlsp..
21:41:17PMunchHave I been dreaming?
21:41:42PMunchAccording to git blame I added allowExtra about a year and a half ago..
21:42:10PrestigeIn nimlsp?
21:42:51PrestigeCould've just forgotten to add it after putting allowExtra in the json schema
21:43:30PMunchNo in jsonschema, added it Nov 2018
21:43:35PMunchMight be
21:43:54PMunchBut I remember there was some editor that sent some weird fields, and that I fixed the error by doing that..
21:44:10*tiorock joined #nim
21:44:11*rockcavera quit (Killed (tepper.freenode.net (Nickname regained by services)))
21:44:11*tiorock is now known as rockcavera
21:44:11*rockcavera quit (Changing host)
21:44:11*rockcavera joined #nim
21:44:54PrestigeMaybe it was an editor using jsonschema that didn't use nimlsp directly
21:45:11PMunchI don't think anything besides nimlsp uses jsonschema :P
21:45:19PMunchApart from one of my other projects I think
21:46:38PMunchOh well, off to bed
21:46:40PrestigeAfter I get my current project to a decent state I'll probably start contributing to nimlsp or similar repos
21:46:43PrestigeGn
21:47:07PMunchWhat is your current project?
21:47:22PMunchThe WM right?
21:47:37PrestigeYep
21:47:38PMunchI remember in your previous log the code in there was a lot of xlib stuff :P
21:47:51PrestigeHaha yeah, we'll see how it goes
21:48:01PrestigeTrying to replace my current wm with this
21:48:34PMunchIf you send my a public key I could give you read access to the repo for my Nim WM
21:48:53PMunchGot some interesting macros there for handling xevents
21:49:05PMunchBut, as I said, bedtime
21:49:06*PMunch quit (Quit: leaving)
21:53:32*jjido quit (Ping timeout: 246 seconds)
21:58:30*exelotl joined #nim
21:59:26exelotlI think I pinned down the nimterop bug I encountered yesterday?
21:59:33exelotlhttps://github.com/exelotl/nimterop-override-test
22:00:42exelotlA struct has a field which has leading underscores. It seems to be impossible to omit the field.
22:01:58exelotlI tried (1) using the -O flag to omit it, (2) using a plugin to set the name to ""
22:10:02*filcuc quit (Quit: Konversation terminated!)
22:12:28*liblq-dev quit (Quit: WeeChat 2.7.1)
22:22:10shashlickDid you try -E
22:22:54shashlick-O only works for the type
22:23:09shashlickCan't really omit a field of a struct
22:24:10shashlickAnd it has two _ so you need -E__
22:25:25exelotlit still gets through with -E=__
22:29:48shashlickGets thru?
22:30:42exelotlas in, it still gives this error:
22:30:46exelotlIdentifier 'SockaddrStorage:__ss_padding' (nskField) contains leading/trailing underscores '_' [AssertionError]
22:32:16shashlickTry without the =
22:32:28shashlickThough it should work with cligen
22:33:44exelotloh, wow that actually works o_O
22:35:36shashlickHmm I think only : is allowed
22:35:44shashlickOr the full name
22:36:06exelotlseems that both -E=__ and -E__ work in my minimal example
22:37:01exelotlstill run into issues with the plugin though
22:37:28exelotlif you pass -E__ it doesn't strip the __ from the name that gets sent to the plugin
22:38:34exelotlI guess the plugin runs at an early stage or something?
22:40:19*abm quit (Read error: Connection reset by peer)
22:41:26*bunbunbunbunny joined #nim
22:41:40*bunbunbunbunny quit (Client Quit)
22:41:51shashlickEither or
22:42:04shashlickCannot use plugin and -E
22:42:11*bunbunbunbunny joined #nim
22:42:24shashlickAnd for plugin, use strip, you cannot have a field with no name
22:45:41*endragor joined #nim
22:50:23*endragor quit (Ping timeout: 260 seconds)
22:50:29shashlickPlease use -f:ast2 for new wrappers
23:08:48*neceve quit (Ping timeout: 256 seconds)
23:12:15*Trustable quit (Remote host closed the connection)
23:16:20*dwdv quit (Ping timeout: 256 seconds)
23:19:42PrestigeIs there any documentation on testament? Do we just write files the same way we would with unittest?
23:20:03Yardanicono
23:20:20Yardanicotestament is mainly used for testing nim itself, you can check tests in "tests" directory to see how they look :)
23:20:44PrestigeThanks :)
23:21:03Yardanicowhy you want to use testament though? unittest is pretty good and it's basically the most popular lib used for testing nim libs/apps
23:21:35Prestigejust saw this suggesting to use testament: https://nim-lang.org/docs/unittest.html
23:21:52Yardanicowell unittest will still be better for most apps/libs, or no separate test lib at all
23:22:00Yardanicotestament might be better for bigger projects IMO
23:22:12PrestigeThank you
23:27:15*bunbunbunbunny quit (Ping timeout: 250 seconds)
23:30:43*lritter joined #nim
23:32:11*exelotl quit (Quit: Leaving)
23:32:49*krux02_ joined #nim
23:34:44*xet7 quit (Quit: Leaving)
23:35:42*krux02 quit (Ping timeout: 256 seconds)
23:38:07*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
23:43:29*bunbunbunbunny joined #nim
23:54:12*NimBot joined #nim