<< 14-09-2018 >>

00:23:40*brainproxy quit (Quit: WeeChat 2.2)
00:32:25*brainproxy joined #nim
00:46:09*Jesin quit (Ping timeout: 252 seconds)
00:58:15*Jesin joined #nim
00:58:19*cstaeth joined #nim
01:00:08*zama quit (*.net *.split)
01:00:08*gsingh93 quit (*.net *.split)
01:00:08*jonafato quit (*.net *.split)
01:00:08*jsn- quit (*.net *.split)
01:00:08*acidx quit (*.net *.split)
01:00:11*jsn-_ joined #nim
01:00:42*acidx joined #nim
01:00:47*jonafato joined #nim
01:00:58*zama joined #nim
01:02:06*zama quit (Changing host)
01:02:06*zama joined #nim
01:03:36*gsingh93 joined #nim
01:08:09*cstaeth quit (Quit: WeeChat 2.1)
01:08:36*cstaeth joined #nim
01:24:26AlexMaxshashlick: howdy, got a minute?
01:39:27*dddddd quit (Remote host closed the connection)
01:57:08shashlickhey
01:59:22shashlickjust saw your issue - do you have the latest nimgen?
02:00:15AlexMaxmaybe?
02:00:21AlexMaxI dunno, I just ran it
02:00:31AlexMaxLet me try
02:00:57AlexMaxHow do I find out the version of nimgen?
02:01:49AlexMaxshashlick: According to .nimble, I have nimgen-0.4.0
02:02:33shashlickhmm, that should work
02:02:42shashlickcan you post your generated nuklear.nim
02:02:55shashlickalso what version of nim
02:03:06AlexMax18.0
02:03:33AlexMaxI did find something...odd in my delving
02:03:35AlexMaxhttps://github.com/genotrance/nimnuklear/issues/1
02:05:07FromGitter<kaushalmodi> And the musl experiment comes to an awesome conclusion!!
02:05:09FromGitter<kaushalmodi> https://github.com/kaushalmodi/hello_musl/commit/8c3289382bc520409a4af832c6b631e66533081b
02:05:24AlexMaxshashlick: here you go
02:05:26AlexMaxhttps://paste.ee/p/IBG9F
02:05:49FromGitter<kaushalmodi> Check out the static binary that prints "Hello, World!" in all glory! :D https://github.com/kaushalmodi/hello_musl/releases
02:05:59FromGitter<kaushalmodi> (only for Linux 64-bit OSes)
02:08:23shashlickBrb
02:12:08AlexMaxI'm reinstalling fresh
02:14:44AlexMaxYeah, I started from scratch, choosenim, and I'm getting the same error
02:16:52shashlickweird - plugin_filter was supposed to be moved down
02:21:16shashlickfixing, a sec
02:24:34shashlickAlexMax: pushed a fix, can you check please?
02:25:27AlexMaxOperation successful on Linux, let me try on windows...
02:26:09shashlickbasically, Nim doesn't support forward declarations of types so you have to move all the procs to the bottom and bring all type declarations into one type block
02:26:19shashlickdoing that automatically is a pain
02:26:46shashlickanother total pain with Nim is that enums have to be in order which is very hard if converted from C which can be in any order
02:26:56AlexMaxdamn
02:27:06shashlickhave to move the declarations up and down, don't see why this limitation is there
02:27:15shashlickthat's why those consts
02:27:26AlexMaxI'm getting three warnings fwiw
02:27:49shashlickand last, A or B doesn't work for those enums either despite being sizeof(int32) so have to sit and fix that also
02:27:52AlexMaxwait what? I'm only getting those warning on Windows
02:28:00shashlickwhat do you see
02:28:12AlexMaxhttps://paste.ee/p/sL3Xu
02:28:30AlexMaxalso these nuklear files are taking FOREVER to compile for some reason
02:28:48AlexMax...not forever, it's getting stuck...
02:29:18AlexMaxOnly on windows, Linux is working great
02:29:58shashlickwhat version of windows and gcc
02:30:14AlexMaxWindows 10, whatever version of gcc finish.exe installs
02:30:50shashlickokay - i'm using a recent mingw
02:31:09shashlickv7.3.0
02:31:30shashlickyou will see a cc1 process hanging, if you kill that you will see the error message
02:32:49AlexMaxI see four cc1 processes
02:32:53AlexMaxI'll kill them one by one
02:33:28AlexMaxand when i killed the first one it just says "failed with exit code 1"
02:34:03AlexMaxyeah I see four gcc's again
02:34:06*leorize quit (Quit: WeeChat 2.2)
02:34:45AlexMaxhttps://paste.ee/p/ayro1
02:35:13AlexMaxStrange
02:35:37AlexMaxversion is gcc.exe (x86_64-win32-seh-rev1, Built by MinGW-W64 project) 6.3.0
02:36:26AlexMaxand just to smoke-test things, I switched to my project and it built just fine
02:39:39AlexMaxsigh, sorry that this seems to be a wild good chase lol
02:42:20shashlickno worries
02:42:44AlexMaxOkay, running the command by hand reveals a compile error
02:43:06AlexMaxa whole mess of macros
02:43:54AlexMaxhttps://paste.ee/p/2GRDV
02:45:35AlexMaxMaybe on Windows you need to add a definition
02:45:51shashlickya I haven't had to, checking
02:46:13AlexMaxI'm using 64-bit nim, fwiw
02:46:15AlexMaxon windows at least
02:46:39shashlickdo you have a test file? or just doing an import
02:47:37AlexMaxWell, at this point I'm just trying to compile that .c file with the given version of GCC
02:47:51AlexMaxright now, Nim doesn't even enter the equation
02:49:16FromGitter<kayabaNerve> If I have a string that stores data, what's the fastest way to get a subset? ⏎ [start .. end] ⏎ .toOpenArray() ⏎ .substring ⏎ Something involving accessing the char pointer directly? [https://gitter.im/nim-lang/Nim?at=5b9b21acf7e1580625ca834e]
02:50:50*endragor joined #nim
02:51:27FromGitter<kayabaNerve> I do need to get the result as a string.
02:55:13FromGitter<kayabaNerve> It looks like an OpenArray[char] is the exact same as a string. A pointer and a length field...
02:55:13FromGitter<kayabaNerve> *in content. Not in the language.
02:55:14shashlickAlexMax: sorry man, I have no clue
02:55:33FromGitter<gogolxdong> can I transform StringTableRef to openArray?
02:58:08AlexMaxshashlick: I do
02:58:11AlexMaxJust figured it out
02:58:15shashlickwhat was it
02:58:30AlexMaxSo the clue was the very end
02:59:30AlexMaxhttps://github.com/vurtun/nuklear/blob/master/src/nuklear_internal.h#L88
02:59:35AlexMaxThis line was what broke
03:00:07AlexMaxThe problem is that nuklear has no idea what size nk_ptr is
03:00:13AlexMaxbecause....it doesn't exist!!!
03:00:56shashlickso how's it compiling for me?
03:01:45AlexMaxWell, ultimately, all that noise is handled here
03:01:47AlexMaxhttps://github.com/vurtun/nuklear/blob/master/src/nuklear.h#L110
03:02:09*deepend quit (*.net *.split)
03:02:09*so quit (*.net *.split)
03:02:34AlexMaxI suspect that detection of proper NK_POINTER_TYPE is broken
03:03:45AlexMaxIn any case, defining NK_INCLUDE_FIXED_TYPES seems to fix things
03:04:50AlexMaxThat define requires stdint.h, and thus it might not work if you use an ancient version of Visual C++ to compile nim stuff
03:05:10*deepend joined #nim
03:06:03AlexMaxbut since nimgen doesn't even support MSVC in the first place, maybe it's acceptable...for now.
03:06:14shashlickso {.passC: "-DNK_INCLUDE_FIXED_TYPES".}
03:06:25AlexMaxYeah
03:08:56AlexMaxActually, hrm, this might be a problem too
03:09:10AlexMaxhttps://github.com/vurtun/nuklear#building
03:09:31AlexMaxBasically, you have to #define NK_IMPLEMENTATION before including nuklear.h
03:09:53shashlickthat's only if you use the single file mode
03:10:03shashlickyou wanted to compile each c file individually remember
03:10:06shashlickso that stuff gets cached
03:11:41AlexMaxOh, you're right, I should've read more carefully....but what caught my eye is that it says you also have to define the same optional flags too
03:12:24AlexMaxSo I wonder if that means you have to -DNK_INCLUDE_FIXED_TYPES every time you include nuklear.h, even if it's header-only
03:13:20AlexMaxWait, how is what I'm saying make any sense...nim doesn't need nuklear.h, it has nuklear.nim
03:13:29AlexMaxright?
03:13:38shashlickhere's all the stuff zachcarter defined in his implementation - https://github.com/zacharycarter/nuklear-nim/blob/master/src/bind.c
03:14:03AlexMaxMmmhmm
03:14:10AlexMaxDamn, this is thorny :P
03:14:40shashlickwell, you import the nim file which uses importc which points to the header
03:15:03shashlickis the `-DNK_INCLUDE_FIXED_TYPES` not working for you?
03:16:11AlexMaxIt did. I was just trying to think of the ramifications.
03:16:45shashlickokay, well am going to include all of zachcarter's defines as `passC`
03:16:50AlexMaxProbably a wise idea
03:21:29shashlickjust pushed, please try
03:24:31shashlickmeh, it breaks on linux, hold off
03:24:48AlexMaxshashlick: Works for me!
03:25:01AlexMax:P
03:30:11*rockcavera joined #nim
03:32:22shashlickokay, pushed a fix
03:33:17AlexMaxoperation successful, one warning
03:33:28AlexMaxC:\Users\alexm\.nimble\pkgs\nimnuklear-0.1.0\nimnuklear\nuklear.nim(1257, 3) Hint: 'WINDOW_DYNAMIC' is declared but not used [XDeclaredButNotUsed]
03:34:15AlexMaxshashlick: I'll see if I can port one of the tests over to your library
03:34:24AlexMaxI'll probably do it this weekend, if I have power
03:34:31AlexMaxThanks so much for your time
03:34:39shashlickbrilliant
03:51:20FromGitter<gogolxdong> How to transform a variable to NimNode?
03:54:45shashlick`ident`?
03:58:04FromGitter<gogolxdong> access the variable in form of NimNode instead of creating new NimNode.
04:09:13*endragor quit (Quit: Leaving...)
04:14:42*def- quit (Quit: -)
04:30:58*miran joined #nim
04:34:33shashlick@kaushalmodi: https://github.com/nim-lang/nimble/pull/541
04:42:40*def- joined #nim
04:47:39*nsf joined #nim
05:05:01*ftsf joined #nim
05:36:29*kapil___ joined #nim
05:50:06*rockcavera quit (Ping timeout: 252 seconds)
05:51:03*leorize joined #nim
06:05:28*miran quit (Ping timeout: 244 seconds)
06:45:57*Vladar joined #nim
06:49:40*couven92 quit (Read error: Connection reset by peer)
06:50:07*couven92 joined #nim
07:16:27*leorize quit (Ping timeout: 250 seconds)
07:18:51*TheLemonMan joined #nim
07:26:22TangerHey folks, is it possible for me to use nim generics to create a generic proc for each value of an enum?
07:27:06FromGitter<kayabaNerve> You can just take in the Enum as a type.
07:27:23FromGitter<kayabaNerve> proc myProc(Val: MyEnum) =
07:27:23TangerHaha, of course it's that easy XD
07:27:37FromGitter<kayabaNerve> Partner it with a switch :p
07:27:39FromGitter<kayabaNerve> Or
07:27:43FromGitter<kayabaNerve> Case statement
07:28:03*PMunch joined #nim
07:30:15TangerkayabaNerve: I can't remember the phrase for it, but can I do something like proc myProc(Val: MyEnum.Val1 | MyEnum.Val2), so I can have one proc for enum values X, Y, Z and another definition for A, B, C?
07:30:24TangerIf that makes sense. Looking for the term now
07:30:56FromGitter<kayabaNerve> Union type but with values? No.
07:31:43FromGitter<kayabaNerve> You can't define a proc to take in 1/2. You define it to take in an int. Same here. Use a case statement or two different enums.
07:32:05FromGitter<alehander42> i actually wrote a lib for that
07:32:06FromGitter<alehander42> https://github.com/alehander42/poly
07:32:22FromGitter<alehander42> but it's still limited as you have to write all the overloads in one section haha
07:33:08FromGitter<kayabaNerve> Interesting
07:35:26TangerkayabaNerve: That makes sense. Thanks for the help! I was thinking of proc onlyIntOrString[T: int|string] from the nim manual, but I was thinking of enums incorrectly
07:38:15Tangeralehander42: That's an awesome concept!
07:43:42*ftsf quit (Ping timeout: 264 seconds)
07:44:57*ftsf joined #nim
08:00:01TheLemonMangot the js backend to emit every module as a standalone commonJs module o/
08:02:05FromGitter<alehander42> would that remain optional?
08:02:34*gmpreussner quit (Ping timeout: 252 seconds)
08:03:21TheLemonManof course, I have no plans about merging this :D
08:03:27*gmpreussner joined #nim
08:04:21*Ven`` joined #nim
08:07:37FromGitter<kayabaNerve> Nimble package? 0_0
08:09:06*leorize joined #nim
08:09:41FromGitter<alehander42> backend experiments are fun, once I forked and started modifying the js backend to support python as well
08:09:58FromGitter<alehander42> but it's really not a good idea :D
08:18:23*cspar quit (Ping timeout: 245 seconds)
08:32:17*kurahaupo26 joined #nim
08:32:59*kurahaupo26 quit (Remote host closed the connection)
08:34:13FromGitter<narimiran> python devs continue to make silly/crazy/stupid ideas: https://bugs.python.org/issue34605
08:36:45FromGitter<narimiran> take a look at PRs (links to github are above OP) and the reaction of the public
08:37:18*riposte14 joined #nim
08:38:05*riposte14 quit (Remote host closed the connection)
08:40:50FromGitter<bung87> does `slave` existed in cpython sources?
08:41:14FromGitter<mratsim> @Tanger, you’re mixing type and values, no need for generics if you only deal with values
08:47:16FromGitter<narimiran> @bung87 see the changes in PRs—there were some slaves. (sorry if i offended somebody, meant to say "childs" [sic])
08:48:49FromGitter<alehander42> what I wonder is, why people remove master/slave instead of `kill`
08:49:44FromGitter<narimiran> and to people who lost their parents/children, that new terminology might be offensive too!
08:49:56Araqbecause killing unborn babies is still ok, that's why
08:50:07TheLemonMan♪ killing in the name of ... consistency? ♪
08:50:40FromGitter<narimiran> fortunately, we in nim merge PRs to `devel` and not to `master`!!
08:50:57FromGitter<bung87> I see `pliant children`
08:52:01FromGitter<alehander42> well, i don't think `master` alone is a problem, otherwise they should bancrupt mastercard
08:52:37FromGitter<bung87> yeah otherwise github will remove every master branch :)
08:52:59FromGitter<alehander42> which will actually resolve a lot of problems
08:53:14FromGitter<narimiran> :D :D
08:53:20FromGitter<bung87> haha no news is good news
08:54:37*cspar joined #nim
08:56:00FromGitter<alehander42> btw there was a plan to move master to stable and devel to master
08:56:03FromGitter<alehander42> what happened
08:58:21*Juggie23 joined #nim
08:58:31Araqstill need to do that
08:58:58TheLemonMansoon™
08:59:47Araqhttps://github.com/nim-lang/Nim/issues/8961 is killing me :-)
09:00:10Araqwas that logic ever sound?
09:05:22TheLemonManhmm, shouldn't the length be sp.cint - 1 in order to make space for the trailing null?
09:05:57Araqfgets only writes n-1 bytes for the zero
09:06:26TheLemonManI stand corrected, thank you manpages
09:06:48*Juggie23 quit (Ping timeout: 272 seconds)
09:14:29*hoijui joined #nim
09:15:02*leorize quit (Quit: WeeChat 2.2)
09:26:53*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
09:30:41*floppydh joined #nim
09:30:52Araq"If
09:30:52Araq ``false`` is returned `line` contains no new data."
09:31:06Araqgood, the docs are clear about this.
09:31:14Araqbad, the implementation doesn't do this. :-)
09:31:26*gfssddd joined #nim
09:33:34*cspar quit (Ping timeout: 240 seconds)
09:35:06*gfssddd quit (Remote host closed the connection)
09:36:50*leorize joined #nim
09:51:59FromGitter<alehander42> hm i should close some of my old issues
09:52:09FromGitter<alehander42> i wonder how many of the nim issues are no longer relev
09:52:34*vqrs quit (Ping timeout: 240 seconds)
09:55:31Araqmany still are
09:55:39Araqfrom time to time I go through every issue
09:55:50Araqwell "every" in quotes. :P
09:57:46*runfalk22 joined #nim
10:00:28*vqrs joined #nim
10:02:31*runfalk22 quit (Remote host closed the connection)
10:05:59*krux02 joined #nim
10:10:25FromGitter<xmonader> mock library for nim? or patchFile the recommended solution?
10:12:09AraqpatchFile it.
10:13:02Araqthere is nothing worse than introducing indirections everywhere just to be able to "mock" your code. Which wasn't a thing back then when data and code was separate. and then OOP came along...
10:13:10krux02Araq: can you check out, if yuutayamada is still going to maintain nim-mode?
10:13:30krux02to me it feels he left the development on nim-mode
10:13:39Araqwhat can I do that you can't?
10:14:04krux02I wrote an e-mail
10:14:09krux02no response
10:14:27krux02basically what I want is merge rights on nim-mode
10:14:42Araqfork it?
10:14:54krux02already did it
10:15:26krux02but it feels like issues are left uncommented and pull requests are ignored.
10:15:48Araqwell maybe he is on holidays
10:16:36FromGitter<alehander42> yeah this happened with some repos i was interested in, a lot of ppl on holidays
10:17:49FromGitter<alehander42> btw @krux02 did you happen to read https://github.com/nim-lang/Nim/issues/8649#issuecomment-420618621
10:20:32FromGitter<xmonader> question: does it make sense to raise Error from internal APIs while you can match against the return value if it can be error or not in the user API? ⏎ ⏎ e.g: ⏎ ⏎ `````` [https://gitter.im/nim-lang/Nim?at=5b9b8b70f4bd1056ac5fd863]
10:21:52krux02alehander42 yes I did read it
10:22:49TheLemonManxmonader, use an Option[string] if you don't need to attach any information about the failing case
10:23:00TheLemonMan(and the failure is recoverable of course)
10:23:34krux02I think I can finally identify the missing feature of pattern matching.
10:24:00Araqoh... what is it?
10:24:37krux02basically you can't put scala's pattern matching on nim, because scala has full runtime type information on every object and for pattern matching it relies on this feature
10:25:45Araqhuh?
10:26:00krux02the pattern machting relies on custom unpackers: proc customunpacker(arg: object): Opiton[tuple[A,B,C,D]]
10:26:25krux02every object can be casted to Object on the jvm without loss of type information
10:26:37krux02and the type can re reconstructed via refleciton
10:26:54krux02therefore an unpacker that just takes object is enough
10:27:00Araqsounds like a terrible design to me
10:27:18Araqyou can have all the unpackers that you want, you can attach them to typeDesc[Foo]
10:27:33krux02arq that is not the point
10:27:40krux02the problem is in recursive patterns
10:27:49FromGitter<xmonader> @TheLemonMan, you mean Either type, Option doesn't fit. clearly the errors are needed but raising the content of them as Errors or not i'm not sure if it's the responsibility of the internal APIs? ⏎ I've ⏎ RedisValue = RedisInt|RedisString|RedisError|RedisList ⏎ ⏎ get(k) will query the server and server will respond either with String or Error and this info is totally preserved, the question does get from
10:27:49FromGitter... user perspective supposed to raise an exception if it receives RedisError or that should be delegated to the user, [https://gitter.im/nim-lang/Nim?at=5b9b8d257dca306503fcbcf2]
10:28:17krux02outer(a,b,inner(c,d), inner(e, f))
10:28:34Araqxmonader: it should raise an exception IMO.
10:28:47krux02outer unpacks an object into four children
10:29:11*stefanos82 joined #nim
10:29:11krux02then I need to type information of these children to select the inner matcher
10:29:16TheLemonManyep, raising a ValueError there is good
10:29:59krux02it is reverse type inference
10:30:44FromGitter<xmonader> I see thanks @Araq @TheLemonMan
10:31:12krux02in normal nim code the expression outer(a,b,inner(c,d), inner(e,f)) is resolved inner most first, so the resolution of outer depends on the types of inner. In pattern matching the symbol resolution is reversed, inner depends on the type of outer
10:32:21Araqthat's not true for 'untyped'
10:32:24FromGitter<Bennyelg> “Decorator” design pattern using macro?
10:32:35FromGitter<Bennyelg> Reasonable?
10:32:44krux02Araq: untyped doesn't relove anything
10:33:01Araqlol 'relove'
10:33:13krux02resolve
10:33:16Araqmaybe it loved once.
10:33:45krux02and typed only has type inferene from inner to outer types.
10:35:17Araqyeah, that's how type systems usually work
10:35:43krux02I need to try to actually implement another pattern matching library that can work with custom matcher function on flat data structures to be a bit more on the spot with my explanation
10:36:20krux02Araq, I know, but not in pattern matching.
10:36:30FromGitter<alehander42> @krux02 how does unpacking exactly work in scala? does it invoke an unpack method for each unpacking on runtime?
10:36:33krux02pattern matching is kind of an reverse assignment
10:37:07FromGitter<alehander42> unapply*
10:37:18krux02alehander42: there are tutorials on it, but yes, there is an unpack fucntion called that returns an obption
10:37:35krux02the option tells if the match failed or succeeded
10:37:37Araqwell I know ML managed to implement pattern matching without a JVM-like reflection mechanism
10:37:54FromGitter<alehander42> yeah, what I mean is does this happend for all objects, or only for objects with custom unpacking
10:38:18FromGitter<alehander42> e.g. do all objects share some default unpacking mechanism (e.g. based on fields)
10:38:20krux02Araq: I don't say it's impossible, but I do say that the type inference works a bit different on those patterns.
10:39:18krux02for example in: let (a,b,c) = foo()
10:40:21krux02the type of (a,b,c) is not inferred by the type of a and then b and then c composed to a tuple, it is inferred by the type of foo(), and then the types of a b c are the children of (a,b,c)
10:42:13FromGitter<alehander42> @krux02 if you want to support custom unpackers, that seems to be a problem. my idea for a lib has a different approach: a default unpacking mechanism for several kinds of types (seq, tuple, object, variant, set, constants) and explicit custom unpackers, e.g. ⏎ ⏎ `match Email.unpack!(name, host)` ⏎ ⏎ one + is that this way you can have multiple different unpack methods for a type
10:42:13FromGitter... [https://gitter.im/nim-lang/Nim?at=5b9b9085fcba1254fab49104]
10:42:21Araqsure but type inference is a compile-time thing, it doesn't require runtime reflection mechanisms
10:42:45FromGitter<alehander42> e.g. `email.differentUnpack(tokens)`
10:43:21krux02Araq, if the reverse type inference works, yes
10:45:00krux02with ast pattern matching I did not need this reverse type inference, because everything is of type NimNode
10:45:22krux02and patty does not need the reverse type inference, because it doesn't do nested patterns
10:48:23krux02currently I don't think that recursive type inference can be implemented efficiently with macros. I think the best would be to write a custom semantic checking phase for matching patterns.
10:48:35krux02maybe there is a hacky way to do it in macros.
10:48:44FromGitter<alehander42> i did support nested patterns similar to `of CSeq(HInt(2), HInt(4))` in my ast-pattern-matching fork
10:49:40krux02alehander42, what is thi HInt doing there?
10:49:57krux02why not match with @[2,4]?
10:51:00krux02or at least with seq(2,4)
10:52:43FromGitter<alehander42> no, CSeq is just a kind in another variant, nothing to do with seq
10:52:53FromGitter<alehander42> the point is, it's similar to A(B(..), C(..))
10:54:00FromGitter<alehander42> i am still not entirely sure about the unpacking problem: you can generate a call to the unpack function with the outer args and it will be resolved to the overload for its type on runtime
10:54:16FromGitter<alehander42> and then later do the same for the inner args
10:55:02FromGitter<alehander42> it will be resolved on compile time later* , we are not talking about methods
10:56:11FromGitter<alehander42> i mean why can't this work ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9b93ca7dca306503fce255]
10:57:17krux02outer is the name of the unpacker
10:57:23krux02same as inner
10:57:26FromGitter<alehander42> ok, so directly
10:57:32FromGitter<alehander42> `outer(value)` and `inner(i2)`
10:58:32*dddddd joined #nim
10:58:34krux02outer can also return Option[seq[T]]
10:58:41Araqkrux02, more importantly, how can we change 'nkIdentDefs'?
10:58:58Araqit needs to have the '## doc comment' as its last child IMO.
10:59:10Araqsome other node kinds are affected as well.
10:59:34krux02and when it does, the generated code needs to be different
10:59:52krux02Araq: can you get me up to date on it? Is it about that every node has a field for comment?
11:00:02Araqyeah, it sucks and need to die
11:00:28Araqwe could introduce nkIdentDefDoc and have an --oldAst switch for a transition period... :-/
11:00:52FromGitter<alehander42> @krux02 why does it need to be different?
11:00:59FromGitter<alehander42> if it does, one shoudln't write `inner(c,d)`
11:01:07FromGitter<alehander42> but `inner(@[c, d])` or something
11:01:21krux02Araq: can you post a quick example of nkIdentDef that I can use to dump the ast?
11:01:41krux02I never relied on docs in ident defs
11:01:58FromGitter<alehander42> and even if it had to read thoughts, it could generate `when compiler(...tuple assignment) else seq stuff`
11:02:01FromGitter<alehander42> compiles*
11:03:09krux02@alehander42: because when you return the seq[] you don't unpack it with (a,b,c,d) assignment, you need to use the index
11:03:55FromGitter<alehander42> but if the unpacker returns a seq, the user *shouldn't* use outer(a, b, c, d)
11:04:18krux02alehander42: you manually reverse the ast, I see. this could work for a prototype, but I don't think it can have nice error messages.
11:04:29FromGitter<alehander42> he should use outer(@[a, b, c, d]) and then the lib would generate seq unpacking too
11:04:54krux02maybe it can
11:05:30FromGitter<alehander42> @krux02 well here our approaches differ a lot :D i don't want any custom error messages, as they add overhead
11:05:52*ftsf quit (Ping timeout: 272 seconds)
11:06:30krux02well I think without custom error messages the pattern matching will be very useless, becaus on pattern mismatching the programmer will be confused and removes the pattern matching to fix it.
11:06:47FromGitter<alehander42> ok, more like
11:07:05krux02error messages are extremely important, and you question should be on how to implement them fast, not if you should have them.
11:07:06*vqrs quit (Ping timeout: 252 seconds)
11:07:10FromGitter<alehander42> if one wants, he can add a arg to `match` signifiying he wants an error message
11:07:16FromGitter<alehander42> but not by default
11:07:27FromGitter<alehander42> they are
11:07:42FromGitter<alehander42> but I don't think they would be worse in my approach
11:08:21FromGitter<alehander42> on the opposite: I plan on generating very readable ast so one can even map the pattern matching to the resulting raw nim code
11:08:37FromGitter<alehander42> yes i didnt phrase myself well
11:09:02FromGitter<alehander42> but not enabling them by default at least in `-d:release` is important
11:09:11krux02alehander42: I would like to see you how well you can program in nim, when instead of error messages nim has only (compilation failure) messages and in order to find where they are you have to add explicit {.withCompilerMessages.} tags everywhere to find where the error actually is.
11:09:37FromGitter<alehander42> because otherwise it's like having each `if` building a error message
11:09:45krux02and no error messages don't add a lot of overhead, because they are only generated on error
11:10:13FromGitter<alehander42> @krux02 not hitting a branch of match is not an error: it's like hitting `else` in if
11:10:20*vqrs joined #nim
11:10:48FromGitter<alehander42> so actually the best option is to just let the user decide
11:11:23krux02that is the worst solution
11:11:26FromGitter<alehander42> if one wants, one can invoke something `echo matchError()` in his `match` (whenever he wants)
11:11:50FromGitter<alehander42> @krux02 well it doesn't make any sense to always generate an error in `else`
11:12:10FromGitter<alehander42> i change an `if` in my program to `match` because it simplifies my if condition
11:12:15FromGitter<alehander42> i don't want an error in else
11:12:19krux02the user initially dosn't know what is best and leaves the default until hes has a really good reason to change that.
11:12:30krux02so the default must be the best for the user experience.
11:12:34FromGitter<alehander42> `match` is a control flow structure.
11:12:53krux02and not hitting any brach in a match expression is an error.
11:13:03FromGitter<alehander42> your thesis is equivalent to `else should always generate an error message because it's better for user expirience`
11:13:21krux02no
11:13:23FromGitter<alehander42> @krux02 not hitting any branch in match is exactly the same as not hitting any branch in if or in `case`
11:13:28FromGitter<alehander42> it's called else
11:13:37krux02if else is a low level branch
11:13:45FromGitter<alehander42> now, if the user *haven't* added an else branch
11:13:51krux02there is no error that can occur at all
11:13:53FromGitter<alehander42> then yeah it makes sense to raise an error
11:14:14krux02because it is just a single bit that decides everything and no uncorverd cases.
11:14:16FromGitter<alehander42> maybe you are talking about this case?
11:14:22krux02patterns are much more complex
11:14:33FromGitter<alehander42> they are a control flow structure
11:14:39FromGitter<alehander42> it doesn't matter how complex they are
11:14:49FromGitter<alehander42> I can always want to do my own thing in `else`
11:16:22FromGitter<alehander42> e.g. in ⏎ ⏎ ```match a: ⏎ of A(B(name: c), `e`): ⏎ f(e) ⏎ else: ⏎ f(default)``` [https://gitter.im/nim-lang/Nim?at=5b9b98860cfe7f30f1924ada]
11:16:57FromGitter<alehander42> i don't want the pattern matching lib to generate anything else than the branches
11:17:39FromGitter<alehander42> if I don't get why the branch fails and I am debugging, I can always do ⏎ ⏎ ```matchDebug a: ⏎ of A(B(name: c), `e`): ⏎ f(e) ⏎ else: ⏎ f(default)``` [https://gitter.im/nim-lang/Nim?at=5b9b98d31ee2ca650215cf7d]
11:17:41FromGitter<alehander42> or
11:17:55FromGitter<alehander42> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9b98e33b7e6c2edd16c7a0]
11:19:27krux02Araq: I just looked at the IdentDefs. As far as I know the comment in an ident def cannot be accessed from the macros module
11:19:37krux02at least by a quick look I didn't see it.
11:20:26krux02I think the best solution is to but the comment node after the identDefs in the VarSection
11:20:59krux02then macros that iterate VarSection need to be fixed to skip comment nodes here
11:21:53Araqyeah but people demand to access it
11:22:17krux02people demand to access the comment statement?
11:24:57krux02I think the comment in a var section should be exposed like this: http://ix.io/1mGP
11:26:57FromGitter<alehander42> oh, the macros one can write with full ast comment support
11:29:02krux02alehander42: currently the ast comment is stored in the comment field of the ast node
11:29:12krux02therefore every ast node has a comment field
11:29:21krux02which is nil for almost all cases
11:29:28krux0264 bits wasted
11:29:39pigmejhey folks again
11:29:45krux02and the line numbers have to suffer
11:29:48krux02pigmej, hi
11:29:56pigmejshort question, how is the support for UDP in asyncdispatch currently going?
11:30:14krux02pigmej, do you really need UDP?
11:30:18pigmejsure
11:30:19FromGitter<alehander42> @krux02 didn't know that, good idea to refactor it
11:30:36pigmejdon't want to have to write custom logic to reconnect
11:32:01*heinrich5991 quit (Quit: quit.)
11:32:08pigmejalso I need plenty of messages
11:32:36krux02for what I know UDP causes more trouble than it solves.
11:32:42pigmej"depends"
11:32:52*zachcarter quit (Ping timeout: 246 seconds)
11:32:54krux02it removes reliability for all messages.
11:33:02pigmejyup
11:33:25*heinrich5991 joined #nim
11:33:27pigmejbut in the same time it removes need to connect, reconnect, keep alive for tcp connection,
11:34:51krux02I like udp, but I would prefer a higher level protocol, that allows to set partial orderings and reliability flags. But as long as I don't get it, I just do TCP even though I don't really like it.
11:37:08*noonien joined #nim
11:37:32*rockcavera joined #nim
11:38:57*demtomohiro joined #nim
11:41:09*Dropa13 joined #nim
11:41:56*Dropa13 quit (Remote host closed the connection)
11:42:03*nsf quit (Quit: WeeChat 2.2)
11:43:14ng0I am working on the integration of nim into Guix and similar systems. I made good progress last night and today. So what warning/error do I have to disable, if this is possible, to ignore this: /gnu/store/8pdn6jrfh0s4dqgrwn35c9gs09s7s55z-nim-0.18.0/lib/compiler/options.nim(1, 2) Error: module names need to be unique per Nimble package; module clashes with
11:43:17ng0/gnu/store/8pdn6jrfh0s4dqgrwn35c9gs09s7s55z-nim-0.18.0/lib/pure/options.nim
11:43:53ng0I had to move around parts of the output. this line is while compiling nimble standalone.
11:44:07*demtomohiro quit (Ping timeout: 240 seconds)
11:47:26pigmejkrux02: btw I saw all your prs, I wonder if yuuta will review them...
11:48:25*qenthus1ast joined #nim
11:51:03*tiorock joined #nim
11:51:03*tiorock quit (Changing host)
11:51:03*tiorock joined #nim
11:51:03*rockcavera quit (Killed (livingstone.freenode.net (Nickname regained by services)))
11:51:04*tiorock is now known as rockcavera
11:51:38Araqkrux02, btw, nimsuggest with a directory name will no go up in the tree looking for a project file
11:51:50FromGitter<alehander42> @krux02 i am going to prototype my matching idea in a new lib this weekend, to see if it would work for real code
11:52:40ng0okay, different question: I had to move the output folders around. search paths etc were adjusted accordingly, and this is when the compiler started working (with other suggestions I will upstream). even when 'compiler' would be in a different folder than 'lib/compiler', this complain should still appear. what build is this: https://d.n0.is/pub/tmp/nim_0.18.0.txt
11:52:54ng0(excluding the broken leading tree output)
11:53:41FromGitter<codenoid> hi
11:57:20*tiorock joined #nim
11:58:12*qenthus1ast left #nim (#nim)
11:58:30*enthus1ast joined #nim
11:58:35FromGitter<xmonader> @codenoid Hi!
12:00:56*rockcavera quit (Ping timeout: 244 seconds)
12:02:35ng0I read a bit more in the source. Easy enough.
12:04:15FromGitter<codenoid> oh hi @xmonader
12:05:26FromGitter<xmonader> @codenoid giving nim a shot?
12:06:57federico3ng0: I just saw your toot. Welcome to Nim
12:08:37FromGitter<codenoid> @xmonader i just like to say hi
12:08:43FromGitter<codenoid> :D
12:10:27ng0federico3: hi
12:23:16*ftsf joined #nim
13:03:57shashlickI have 7 nim crash issues that are potentially fixed - can someone verify and close them?
13:05:04*vqrs quit (Ping timeout: 240 seconds)
13:06:40shashlickhttps://pastebin.com/VkJU63PK
13:10:22*vqrs joined #nim
13:11:51FromGitter<narimiran> shashlick: the first one is ok, the second one crashes (both on my and your end ;))
13:14:26FromGitter<narimiran> the third one is also ok, the fourth one is not. (nim devel from 2018-09-12)
13:20:18*zacharycarter joined #nim
13:20:19*zacharycarter quit (Client Quit)
13:20:38*zacharycarter joined #nim
13:20:57FromGitter<mratsim> @narimiran here you go: https://github.com/SimonDanisch/julia-challenge/pull/3 not benchmark though
13:20:59zacharycartergood morning / afternoon all - I'm having an issue with importcpp and backticks
13:21:26zacharycarterif I surround the variable I send into the imported procedure with backticks - the pattern assigned to the importcpp pragma doesn't work
13:21:34zacharycarterthe `#` get printed in the output
13:21:39zacharycarteranyone know a way around this?
13:21:57FromGitter<mratsim> can you show the proc definition
13:21:58TheLemonMando I hear "benchmark"? (this is getting old really quick, isn't it? :)
13:22:18zacharycartermratsim - sure let me throw together an exampler
13:22:20zacharycarterexample*
13:30:30shashlick@narimiran: second one is an error message, not a crash
13:31:49shashlickwhat do you see for the fourth one?
13:36:09TheLemonManshashlick, wrt #8960 the test is better under 'openarray' since the problem was in the string->openarray conversion
13:36:51shashlickokay will move
13:39:05shashlickI can create test cases very quickly and push using tissue so feel free to use the tool or to ask
13:40:15*stefanos82 quit (Quit: Quitting for now...)
13:41:23shashlickTheLemonMan: updated #8960
13:42:06TheLemonManyeah, let's wait for the green even tho it's just a file move
13:42:48shashlickya no worries
13:43:21shashlickcan you look into the other issues as well - https://pastebin.com/VkJU63PK - then I can make test cases for those and get them closed out
13:43:21shashlickPssst! I didn’t unfurl https://pastebin.com/VkJU63PK because it was already shared in this channel quite recently (within the last hour) and I didn’t want to clutter things up.
13:43:50shashlick@narimiran: please post your findings as well
13:44:13FromGitter<narimiran> shashlick: the fourth one is "Error: cannot instantiate: 'T'" — as you said, an error, not a crash
13:44:34FromGitter<narimiran> @mratsim will take a look, thanks for the ping!
13:44:56*tiorock quit (Remote host closed the connection)
13:49:36*planetis[m] joined #nim
13:50:37FromGitter<narimiran> shashlick: 5th error, 6th and 7th work ok
13:52:49FromGitter<narimiran> @mratsim are you a wizard?
13:53:42*beatmox quit (Ping timeout: 272 seconds)
13:54:14zacharycarterhere's a example of my problem - https://gist.github.com/zacharycarter/9952450e543c018245fb9994b38dfb0f
13:54:18planetis[m]Hi, how can i squeeze an int to a binary value {0, 1} in nim? I tried `int(bool(sumNum))` but it doesnt work
13:54:20*cornfeedhobo quit (Ping timeout: 252 seconds)
13:54:37*ehmry quit (Ping timeout: 246 seconds)
13:54:58*zama quit (Ping timeout: 272 seconds)
13:55:36*acidx quit (Ping timeout: 272 seconds)
13:55:36*sagax quit (Ping timeout: 272 seconds)
13:55:36*awal quit (Ping timeout: 272 seconds)
13:55:44*awal joined #nim
13:55:46PMunchsumNum == 0
13:55:57PMunchThat returns a true or false
13:56:09*awal is now known as Guest8490
13:56:12zacharycarternot sure why surrounding the bound procedure name with backticks is breaking the pattern in importcpp
13:56:14*beatmox joined #nim
13:56:26*nsf joined #nim
13:56:35*acidx joined #nim
13:56:41Araqbackticks in patterns? what should these do?
13:56:42*zama joined #nim
13:56:47Araqonly .emit has backtick support
13:56:51Araqbbl
13:57:07zacharycarterhrm
13:57:26zacharycarterwell - it works fine if I don't wrap the name of the proc when calling it in backticks
13:57:34zacharycarterbut since this is going through a macro - the identifier is getting resolved
13:57:43zacharycarterto the mangled JS variable name
13:57:43planetis[m]then i need a number back
13:57:50FromGitter<mratsim> @narimiran I’m not a wizard, I’m an Archmage :P
13:58:00zacharycarterbut basically the idea here is - eval(function`literal`) should get called
13:58:01zacharycarterin JS
13:58:01planetis[m]also tried `not not a`
13:58:02PMunchplanetis[m], int(sumNum == 0)
13:58:06zacharycarterwhich would produce a tagged template literal
13:58:30zacharycarterI had this working before I added back ticks around the caller
13:58:35planetis[m]thx will try it
13:58:36zacharycarternow it's borked
13:59:47zacharycarterin fact - the problem doesn't seem to be with the pragma contents whatsoever
14:00:20zacharycarterit seems to be that `foo`("bar") will break any importcpp pragma that is attached to foo with a pattern :/
14:00:24*PMunch quit (Quit: Leaving)
14:00:49*ehmry joined #nim
14:03:41zacharycarteror maybe not - console.log(`tag`(`bar`, `foobar`)) seems to work
14:03:59FromGitter<narimiran> @mratsim whatever you call yourself, your code is magic to me!
14:05:04FromGitter<mratsim> Any sufficiently advanced technology is indistinguishable from magic ;)
14:07:25FromGitter<narimiran> exactly my point! :)
14:07:38FromGitter<alehander42> has anybody tried to actually add nim support in travis :? https://docs.travis-ci.com/user/languages/community-supported-languages/
14:13:16*zacharycarter quit (Quit: Page closed)
14:16:02*cornfeedhobo joined #nim
14:16:34*enthus1ast quit (Ping timeout: 240 seconds)
14:18:53*hoijui quit (Ping timeout: 244 seconds)
14:21:58*redlegion joined #nim
14:21:59*redlegion quit (Changing host)
14:21:59*redlegion joined #nim
14:27:36shashlickyou need 3 people apparently
14:31:32*davex__ joined #nim
14:35:56*davex__ quit (Remote host closed the connection)
14:52:06FromGitter<arnetheduck> @Araq, the rodfiles stuff, is it dead? should it be removed?
14:52:46*miran joined #nim
14:53:53FromGitter<arnetheduck> @Araq, also, what's the plan for parallelism? it seems that either of spawn/parallel framework and channels could be deprecated (or spawn/parallel reworked in terms of channels)
14:56:07*cspar joined #nim
14:57:31Araqarntheduck: iirc the dead stuff was removed already and the stuff that's still there will be used for the "incremental compilation cache"
14:57:37*rockcavera joined #nim
14:59:27Araqspawn/parallel needs to get a much simpler implementation, channels are different from it though
15:00:18FromGitter<arnetheduck> @Araq oh ok - saw some tests that are still there
15:00:33FromGitter<bung87> hope more smart guys can speed nim development.
15:00:54Araqthe tests can be re-used, they cover the harder parts of the language, regardless of the chosen implementation
15:01:12AraqI mean harder wrt incremental compilation.
15:07:57Araqhttps://techcrunch.com/2018/09/12/security-flaw-in-nearly-all-modern-pcs-and-macs-leaks-encrypted-data/
15:08:34shashlickTheLemonMan: https://github.com/nim-lang/Nim/pull/8960 is ready
15:08:48FromGitter<arnetheduck> well, channels can be used to implement spawn/paralllel, no? that should also need less magic
15:09:27*rockcavera quit (Ping timeout: 252 seconds)
15:09:46TheLemonManshashlick, merged!
15:10:30shashlickTheLemonMan: if you can confirm that some of https://pastebin.com/VkJU63PK are fixed, I can push tests for those as well and get them closed out
15:11:40Araqarntheduck: channels make the data passing more explicit but don't give you a thread pool
15:11:45shashlickAraq ^^ if you have the time
15:13:53Araqshashlick, even if they are fixed they should be added to the test suite
15:22:58shashlicki've been adding to test suite as soon as I get confirmation that they are really fixed
15:23:34shashlickbut just need 👍 from one of you guys
15:23:45shashlickcrash => error message feels like a fix to me 🙂
15:26:27Araqoh you don't have to wait for us, create a PR and the review process will handle it
15:27:00shashlickOk cool
15:28:49*pheonix99121 joined #nim
15:31:23Araqwell now I'm having a look anyway
15:31:40*pheonix99121 quit (Remote host closed the connection)
15:32:34*cspar quit (Ping timeout: 240 seconds)
15:34:24*floppydh quit (Quit: WeeChat 2.2)
16:04:48*hoijui joined #nim
16:08:40*ftsf quit (Ping timeout: 246 seconds)
16:09:53*zacharycarter joined #nim
16:10:36zacharycarteraccording to - https://nim-lang.org/docs/macros.html#quote,typed,string - you can pass a string to quote which lets you specify a custom operator to escape with
16:10:45zacharycarteris this usable with the `do` notation?
16:10:51zacharycarterI think that's what I need to do to fix my issue
16:11:27TheLemonMangood luck with that, the implementation is ... well, see for yourself :P
16:12:11zacharycarterugh
16:12:36*Jesin quit (Quit: Leaving)
16:18:07*hoijui quit (Ping timeout: 252 seconds)
16:21:22zacharycarterTheLemonMan: https://gist.github.com/zacharycarter/adead6469d75c88989a836548dca42be
16:22:08*nsf quit (Quit: WeeChat 2.2)
16:23:11zacharycarteror maybe not
16:25:44*wildlander joined #nim
16:29:11zacharycarterthis backtick thing is killing me
16:32:21*sagax joined #nim
16:33:02TheLemonManwhat's the problem?
16:34:35zacharycarterJS uses backticks to construct string literals
16:34:59zacharycarterI'm using quote do: and then emitting a bunch of JS with backticks in it to escape nim symbols
16:35:17zacharycarterbut if I need to escape a Nim symbol and use it in a string literal
16:35:27zacharycarterI'm screwed atm
16:35:53zacharycartererr template literals sorry
16:36:01FromGitter<mratsim> @TheLemonBoy, criterion is not in Nimble btw
16:36:56TheLemonManmratsim, yeah, I wanted some feedback on the api/design before uploading it but got none :\
16:38:58TheLemonManzacharycarter, are you sure the custom quote chars isn't working for you?
16:39:59*Jesin joined #nim
16:43:03zacharycarterTheLemonMan: what is the custom quote char?
16:43:14zacharycarteroh in the quote macro?
16:43:18zacharycarterI'm not sure how to pass it, along with a block
16:43:29TheLemonManthe problem in that gist is that quote cannot replace stuff inside the string literals
16:43:56zacharycarteryeah
16:44:04TheLemonManevaluatedJS is a nimnode?
16:46:55zacharycarterit's a string
16:48:03zacharycarterTheLemonMan - I added another simpler example, but it's still not working :/ - I need to run out to meet my pops for lunch but I will be back in about an hour or so
16:49:52TheLemonManzacharycarter, like this? https://gist.github.com/0a64ca37c3e04374406faf920e7b5daa
16:51:36*leorize quit (Quit: WeeChat 2.2)
16:52:27*zacharycarter quit (Ping timeout: 252 seconds)
16:59:10*sentriz11 joined #nim
17:02:03*sentriz11 quit (Remote host closed the connection)
17:02:48*Reception12316 joined #nim
17:03:36*Reception12316 quit (Remote host closed the connection)
17:07:51*leorize joined #nim
17:10:37*demtomohiro joined #nim
17:13:00*demtomohiro quit (Client Quit)
17:13:35*demtomohiro joined #nim
17:56:14*rockcavera joined #nim
18:10:38*zachcarter joined #nim
18:11:28zachcarterTheLemonMan: let me try that - that looks right
18:29:36FromGitter<rayman22201> Jon Blow rants about Rust, interesting stuff: https://www.youtube.com/watch?v=4t1K66dMhWk
18:29:49FromGitter<rayman22201> Araq should make videos ranting about things more often /s :-P
18:33:55TheLemonMan"old man yells at cloud"
18:39:13*Trustable joined #nim
18:39:18*Strogg16 joined #nim
18:42:04*Strogg16 quit (Remote host closed the connection)
18:44:34FromGitter<rayman22201> Don Quixote
18:57:20zachcarterTheLemonMan: i guess I was confused about the backticks in quasi-quotes
18:57:34zachcarterwhat I really need to be able to do - is change how Nim symbols are escaped in the AST :/
18:57:43zachcarteror have a way to put a backtick literal in
19:03:44FromGitter<alehander42> Actually that's a good point about moving the problem further down the road by blow
19:05:31*krux02 quit (Remote host closed the connection)
19:05:40*modrobert2 joined #nim
19:10:26*modrobert2 quit (Remote host closed the connection)
19:20:52zachcarteranyone aware of any way to put a backtick into a string that's being emitted inside a quote block - without it being treated as a nim value? In other words - a literal backtick
19:22:14TheLemonMan`` ?
19:23:49zachcarterthanks
19:30:46shashlickhas anyone worked on some caching improvements to speed up the nim build on appveyor and travis?
19:35:10*demtomohiro quit (Quit: Leaving)
19:38:39*demtomohiro joined #nim
19:39:06*zachcarter quit (Ping timeout: 252 seconds)
19:42:31*francisl joined #nim
19:51:00*PMunch joined #nim
19:56:14francislhey, is it possible to use the `find` proc with a matching proc instead of single item? not sure I understand the doc correctly (still new to it). e.g. let store: seq[array[2, string]] = @[]; find(seq, proc(item: string): bool = item[0] == valueX)
19:58:24ng0when you don't use nimble to install https://github.com/nim-lang/x11 , do you just nim c all files in src and copy to the place you want it at? still very early and I'm tired.
20:00:22*rockcavera quit (Ping timeout: 246 seconds)
20:01:06*cspar joined #nim
20:06:08shashlickng0: it's a library so you import it in your app and put it in a relative dir
20:06:19shashlickyou nim c your app
20:07:45ng0okay. so since I'm working on this in terms of system integration from 0, i just read the docs and generic ways to handle this.
20:11:33ng0thanks. i'll catch some sleep, should work better afterwards.
20:14:57FromGitter<Vindaar> @francisl: I'm not quite sure if I understand you correctly. You want to have a `find` proc that takes a proc defining the criterion if an element is found?
20:20:37*tspjf joined #nim
20:21:24Araqalehander42: can you elaborate? I skimmed the video and didn't find any insights tbh
20:22:25AraqMr Blow talks about how he cannot afford to lose 5-10% productivity and yet he uses C++ instead of C# or something else
20:23:22*cnu-22 joined #nim
20:26:10*cnu-22 quit (Remote host closed the connection)
20:26:59FromGitter<rayman22201> Well, He is using his Jai language now
20:27:34francisl@Vindaar: from what I undertand, `find` needs a match item, but in my case, I don’t know what it is except for the first element of the item array. So I would like to have a matching proc to match agains the first element
20:29:00*miran quit (Ping timeout: 252 seconds)
20:30:37Araqrayman22201: meh ... fair enough I guess
20:31:37FromGitter<rayman22201> lol
20:32:47FromGitter<rayman22201> @francisl, your item isn't of type string, it would be of type array[2, string], I think?
20:33:47FromGitter<rayman22201> `find(seq, proc(item:array[2,string]): bool = item[0] == valueX)`
20:33:47francisl@rayman22201: correct, but I want to match against array[0]
20:34:22FromGitter<Vindaar> Do you need explicitly 1 (or the first) element matching `array[0]`?
20:35:27*tspjf left #nim (#nim)
20:35:33FromGitter<Vindaar> if not you could use `sequtils.filter` or `filterIt` and do `let fit = yourInput.filterIt(it[0] == YourMatchingObject)`, which will give you a `seq` of items in your input seq, matching the first value of your array
20:36:48*noonien quit (Quit: Connection closed for inactivity)
20:37:20francislI had it working with filter, but I was looking for something a bit cleaner, as I would do in js
20:39:09*francisl quit (Quit: francisl)
20:39:45FromGitter<rayman22201> How would you do it in JS? I'm still not sure what the issue is?
20:40:09TheLemonManwith a node.js module? how else? :P
20:40:15FromGitter<rayman22201> lmao
20:41:33FromGitter<alehander42> @Araq I just read a summary in https://www.reddit.com/r/rust/comments/9fqget/jonathan_blow_entity_systems_and_the_rust_borrow/ but the <in a parituclar situation borrow checker makes me reimplement the stuff with a different pattern which actually still leads to incorrectness, but a different kind and more hidden> thing sounded reasonable
20:41:54Xebtw, does nim have a working webassembly backend, even if i can't use a lot of system yet?
20:42:02Xei've been doing some rust and i'm done with rust
20:42:12Xei want normal programming back
20:42:23Xei'm willing to work with you guys to help the webassembly backend support what i'm targeting
20:42:32Xei'm doing server-side webassembly without JS
20:42:53PMunchhttps://www.spiria.com/en/blog/web-applications/webassembly-nim
20:42:59FromGitter<rayman22201> The funny thing is that I found nim because I was looking for something like Jai that I could actually use, also after playing with Rust and hating it.
20:43:32Xei just want normal mutability back
20:43:34Xetbh
20:44:10TheLemonManXe, see also https://github.com/nim-lang/Nim/pull/8738
20:44:17FromGitter<alehander42> @Xe I think some people used nim -> c++ [ermscripten] -> webasm
20:44:26Xeyeah i don't wanna do emscripten
20:44:32FromGitter<alehander42> and also one guy is working on a wasm backend
20:44:34Xei wanna just have raw webassembly as much as possible
20:44:41FromGitter<alehander42> https://github.com/stisa/nwasm
20:45:41XeTheLemonMan: emscripten is useless to me given there is no javascript involved in my webassembly execution
20:46:22Xei'm doing server-side webassmbly with no Javascript whatsoever
20:47:07TheLemonManI see, I'm not very practical when it comes to those newfangled web thingies
20:47:17FromGitter<alehander42> what is the benefit of webassembly on a server o.O
20:47:44Xeyou're not reliant on the hardware anymore and can take your existing deployed units and run them as long as the runtime works
20:47:57Xehttps://github.com/Xe/olin for my git repo
20:48:04FromGitter<alehander42> so, the virtual machine argument ?
20:48:21Xealso, i wanna do stuff like create a syscall-adjusted runtime metric
20:48:44Xeunix processes limit what you can do
20:51:55AlexMaxshashlick: Hi. Not sure how much longer I'm going to have power, but I think I've found another problem.
20:52:29shashlickwhat's up
20:53:37*rockcavera joined #nim
20:53:42AlexMaxI think the header wasn't preprocessed with the same defines
20:53:55shashlickgood point
20:54:01AlexMaxBecause I'm missing some definitions
20:54:37AlexMaxI'm looking into how to fix it - I think I found a promising configuration parameter that might help out
20:54:58shashlickits an easy fix, let me push
20:55:01AlexMaxppflag
20:55:09shashlickyep
20:55:22AlexMaxoh man, I hope this doesn't mean more potential problems with the newly-imported stuff
20:55:30shashlickfingers crossed 😄
21:02:10*nsf joined #nim
21:05:58shashlickwell, if I include NK_INCLUDE_STANDARD_VARARGS, c2nim fails
21:06:03shashlickon windows
21:06:09shashlickbut without it, it doesn't work for you
21:13:02AlexMaxshashlick: I don't think that define was part of the defines that I needed to get it running
21:13:18AlexMaxI think that define came from zach's library
21:13:33AraqNim can compile to C, you can compile C to wasm. alternatively use Nim's LLVM code generator to compile to wasm
21:13:53AlexMaxAnd looking at the functions it defines, it looks like it just defines a bunch of printf-family functions
21:14:16AlexMaxWhich, since we're using Nim and have access to _its_ formatting libs, I think can be safely elided
21:14:49Araqalehander42: that's basically "pointers vs indexes" and I'm completely and utterly sold on indexes :-)
21:14:52*francisl joined #nim
21:15:22AlexMaxsince somebody can just call the non-printf-family versions with an already-formatted string
21:15:46AlexMaxHere's a list of all the defines
21:15:59AlexMaxhttps://github.com/vurtun/nuklear/blob/master/src/HEADER#L96
21:16:05*Vladar quit (Remote host closed the connection)
21:20:08shashlickAlexMax: you needed it to stop hanging on Windows
21:20:33shashlickanyway, i don't need it
21:20:34AlexMaxOh - does it hang on windows without that define?
21:20:41shashlicklet's see, i have a workaround
21:20:51shashlickadding all the defines now results in more changes
21:21:12AlexMaxThe only define I needed to add to get it to stop hanging was NK_INCLUDE_FIXED_TYPES
21:21:38AlexMaxI was able to compile it on my end with just that define
21:21:52AlexMaxAnd then we decided to grab a few other defines from zach's library for good measure
21:21:55XeAraq: nim's LLVM codegen?
21:22:21shashlickok, let's see
21:22:30AlexMaxAnd I think we grabbed one too many :P
21:23:51AraqXe, 'nlvm' is its name
21:23:59XeAraq: doc link?
21:24:04Araqa fork of Nim that replaces the C backend with an LLVM one
21:25:21francisl@rayman22201: sorry was afk, like https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex you simply pass a function. So whatever is the type of the array you can have a custom checker. btw, I can’t get the find proc work with a function, I guess I’ll stop trying for the moment
21:25:29shashlickAlexMax: please pull
21:25:32shashlickshould work better now
21:26:08XeAraq: i'll have to give it a try and report back
21:27:10*PMunch quit (Ping timeout: 246 seconds)
21:27:45shashlickgot 300 more lines of resulting code I think
21:28:23shashlickwell, good thing is, thanks to the nuklear wrapper, I now have a way to deal with forward declarations pretty quickly
21:28:58shashlickstill a pain to deal with enums not in order though
21:29:24FromGitter<Vindaar> @francisl: some ways to do it (`find3` is basically the `findIndex` you linked, if I'm not mistaken) http://ix.io/1mIU/nim
21:29:35AlexMaxOkay, nuklear test app seems to work on linux
21:30:09shashlickcan you push some examples to the repo eventually?
21:30:20AlexMaxshashlick: Will do
21:30:28shashlickhow about a screenshot
21:30:31AlexMaxI've got it checked out and was working on porting one of the demos
21:30:59AlexMaxbut lack of font_atlas was kind of an immediate "uh oh"
21:31:03AlexMaxone sec
21:32:59AlexMaxOkay, windows test seems to compile
21:33:10AlexMax(I mean the empty "test" you already have)
21:33:35AlexMaxshashlick: I think I'm good for now, will let you know if I run into something else
21:33:50AlexMaxThanks again
21:34:15shashlickneat
21:34:44shashlickhope zachcarter checks out this repo at some point
21:40:02*PMunch joined #nim
21:41:28*nsf quit (Quit: WeeChat 2.2)
21:41:39AlexMaxwoaaaaaaaaaaaaaaaaa what the hecking heck
21:42:13AlexMaxOnce i got rid of the forward declarations of all the proceedures, the c2nim'ed source just....compiled
21:42:37AlexMaxThat's actually a bit frightening
21:42:44shashlickbrilliant
21:42:58shashlickbut that's a ton of moving around
21:43:07AlexMax...for one of the modules
21:43:20AlexMaxthe sample is split into at least two source files, maybe more
21:43:39shashlickoh you mean an example? not nuklear.h?
21:44:50AlexMaxhttps://github.com/vurtun/nuklear/blob/master/demo/sdl_opengl3/nuklear_sdl_gl3.h
21:44:52AlexMaxthis file
21:45:07AlexMaxI coaxed c2nim into giving me a nim source file
21:45:26AlexMaxoh, son of a gun
21:45:30AlexMaxthere's a define wrapping the whole thing
21:45:34FromGitter<Bennyelg> where is the `import sugar` can be found?
21:45:58AlexMaxno wonder it wasn't giving me any compile errors
21:46:13shashlickplus it doesn't include nuklear.h stuff
21:46:15AlexMaxhard to get compile errors for code that doesn't compiie :P
21:46:31FromGitter<Vindaar> `sugar` is the new name for the `future` module. I imported it in the script up there, because I wanted to use the `->` and `=>` macros, but then decided not to
21:46:37FromGitter<Vindaar> @Bennyelg
21:46:55FromGitter<Bennyelg> go it
21:47:19*francisl quit (Quit: francisl)
21:50:32FromGitter<kaushalmodi> Guys, I am starting nightly build of Nim docs here: https://kaushalmodi.github.io/nim-nightly-docs/theindex.html
21:51:29AlexMax@kaushalmodi Oh wow, thanks
21:51:32AlexMaxThat owns
21:52:39FromGitter<Vindaar> @kaushalmodi oh, nice! that's a great idea :)
21:55:27*zachcarter joined #nim
21:57:51zachcarterI have a macro that interprets a DSL, and the an example of the DSL is here - https://gist.github.com/zacharycarter/9e24d92013a7e0b84d9c859d7d0f45f8
21:58:18zachcarterif you look at the last line - I'm turning this into a string literal, and then emitting it inside of a quote do block
21:59:04FromGitter<Bennyelg> @zacharycarter this render to javascript?
21:59:21zachcarterthe problem I'm having is - I need the last part of the argument - `rt` to actually be encapsulated in another set of backticks, and it still needs to place the value of rt there (rt being a cstring)
21:59:27zachcarterBennyelg - yes
21:59:33FromGitter<Bennyelg> cool
21:59:43zachcarterit's going into a macro that is taking two untyped parameters
22:00:03FromGitter<Bennyelg> looks like react style
22:00:07zachcarterbut adding another backtick in front of `rt causes the code to not compile
22:00:15zachcarterdoes anyone have any idea how I can make this work?
22:00:32FromGitter<Bennyelg> I wish I could help you.
22:01:06FromGitter<Bennyelg> How do you run this code and where do you see the output?
22:01:12FromGitter<Bennyelg> you compile it using c compiler i guess
22:01:18zachcarterI haven't posted the code anywhere yet
22:01:20zachcarterno it's JS backend
22:01:41FromGitter<Bennyelg> I c,
22:02:23TheLemonManwith no code we can't do much, can you show us the wrong generated ast at least?
22:03:11zachcarterI'll post example code - one second
22:03:28zachcarterit's just a large project
22:03:37zachcarterI'll try to reproduce the issue
22:05:34*kapil___ quit (Quit: Connection closed for inactivity)
22:08:49*PMunch quit (Ping timeout: 246 seconds)
22:13:28*TheLemonMan quit (Quit: "It's now safe to turn off your computer.")
22:19:23zachcarterhttps://gist.github.com/
22:19:35zachcarterI think that explains it fairly well
22:20:51FromGitter<kayabaNerve> zachcarter You linked gist; not a gist lol
22:21:02zachcartersorry
22:21:09zachcarterlmao
22:22:19zachcarterthank you for pointing that out
22:22:20zachcarterhttps://gist.github.com/zacharycarter/641077d2603be1b9be860d7a721b3a13
22:24:07AlexMaxman, offsetof would be amazing
22:26:45AlexMaxbuilt-in, of course
22:28:37*peril joined #nim
22:30:10*Trustable quit (Remote host closed the connection)
22:42:11zachcarterugh - I can't use JS regex's because I can't import it at compile time :/
22:42:32Araq:-)
22:43:20zachcarterthese backticks are a pain - stupid JS! I need them for work though
22:45:03zachcartermaybe I can use strscans?
22:46:18*xet7 quit (Quit: Leaving)
22:47:27Araq'scanf' is superb IMO
22:47:36FromGitter<arnetheduck> how long does `thavlak` typically take? it's 11 minutes and counting on a run I'm seeing right now...
22:48:03Araqthavlak is an overly long test but 11 minutes seems excessive
22:48:41*zimboboyd joined #nim
22:51:22FromGitter<rayman22201> Just got back to my keyboard from lunch. @kaushalmodi Thank you for the nightly docs! That's awesome! @francisl I understand your issue now! You want a version of find that takes a predicate function, not just an item. Are you trying to avoid the extra allocation of the results sequence that filterIt does? If that is the case, the iterator version of filter doesn't do any extra allocation, and might do what you
22:51:22FromGitter... want. https://github.com/nim-lang/Nim/blob/master/lib/pure/collections/sequtils.nim#L280
22:51:49Araqwe have nightly docs?
22:52:06FromGitter<rayman22201> https://kaushalmodi.github.io/nim-nightly-docs/theindex.html
22:52:22FromGitter<rayman22201> Thanks to @kaushalmodi we do now :-)
22:53:35*zimboboyd quit (Remote host closed the connection)
22:53:53FromGitter<rayman22201> assuming he keeps them up to date :-P
22:54:12Araqwell nightly builds is on my radar too
22:54:36FromGitter<rayman22201> A full nightly build would also be very useful
22:55:07FromGitter<drewp> let cb: mgos_gpio_int_handler_f = proc(pin: cint, arg: pointer) = ... ⏎ ⏎ main.nim(17, 37) Error: type mismatch: got <proc (pin: cint, arg: pointer){.noSideEffect, gcsafe, locks: 0.}> but expected 'mgos_gpio_int_handler_f = proc (pin: cint, arg: pointer){.cdecl.}' ⏎ ⏎ ```let cb: mgos_gpio_int_handler_f = proc(pin: cint, arg: pointer) = ``` ... [https://gitter.im/nim-lang/Nim?at=5b9c3c4bf08bc22dfb5ace58]
22:55:58*dan12324 joined #nim
22:55:58FromGitter<arnetheduck> ok, weird then.. 760 seconds for `-d:release --gc:markandsweep`.. wonder what's up with that
22:56:26Araqtakes 8 seconds on my machine
22:56:48Araqso maybe 10 on yours but shouldn't take 760 :-)
22:57:43FromGitter<kayabaNerve> What if my machine is an original Xbox I installed damn small Linux on though
22:58:45*dan12324 quit (Remote host closed the connection)
23:00:16FromGitter<rayman22201> @drewp I'm not sure about the other pragmas, but I think you have to declare your function with cdecl because that changes the calling convention of the function. Nim is not going to automagically change the calling convention.
23:01:18FromGitter<drewp> indeed- that does get me further. I see that the other calling convention needs a 2nd arg (somehow), and my c lib actually does support a void* user param, so maybe there's a way to use that. NBD for now, though.
23:05:02FromGitter<kaushalmodi> @rayman22201 It's set up as a simple cron in Travis. If the build fails, the docs won't update.
23:05:31FromGitter<kaushalmodi> @Araq You can may be pull this repo into the Nim organization so that it gets a better domain.
23:05:56FromGitter<kaushalmodi> There's nothing special about the repo. It's just the .travis.yml.
23:07:10FromGitter<rayman22201> @drewp I suppose you could remove the cdecl pragram from the handler argument, but then you better be sure to handle what ever Nim gives you. I remember Araq saying on windows it uses fastcall. It looks like you are doing an embedded thing (awesome btw), so that may not apply to you. On unixes it probably just uses the standard gcc C++ calling convention, I would guess. Araq is the person to ask about Nims normal
23:07:10FromGitter... calling convention in detail.
23:07:26Araqkaushalmodi, create a PR please patching the .travis.yml?
23:08:00FromGitter<rayman22201> probably easier to cdecl all the things :-P
23:09:45Araqwell yeah, the standard is 'fastcall' but it only really applies on Windows, x86, 32 bits
23:09:59FromGitter<kaushalmodi> Araq: Yes, just noticed that the Nim core repo does not have a gh-pages branch.. so patching the current travis.yml would work
23:10:00Araqx86_64 sorted that out for us
23:10:29Araqgood night
23:11:34FromGitter<rayman22201> good night!
23:11:51*peril quit (Remote host closed the connection)
23:14:04*zachcarter quit (Ping timeout: 240 seconds)
23:16:59FromGitter<rayman22201> @zacharycarter This is kind of a 'hacky' idea, but you could find all the AccQuoted nodes in the AST and manually parse it to the correct string? does that make sense?
23:43:16FromGitter<Bennyelg> Hey I need help
23:43:51FromGitter<Bennyelg> I tried to "modify" the behavior of the key value by just printing something before every key assignment
23:43:55FromGitter<Bennyelg> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b9c47bbb4990c30eeb85460]
23:44:13FromGitter<Bennyelg> what am i doing wrong I am get stack overflow
23:45:12FromGitter<Bennyelg> Oh im calling my self endless time I got it :/
23:46:22*skelett quit (Ping timeout: 252 seconds)
23:54:40AlexMaxhrm, c2nim seems to get horribly confused by this invocation here
23:54:42AlexMaxhttps://github.com/vurtun/nuklear/blob/master/demo/glfw_opengl3/nuklear_glfw_gl3.h#L258
23:55:05AlexMaxTries to turn it into a pointer
23:56:03AlexMaxand doesn't mutate the nested arrays into object invocations
23:56:17FromGitter<Bennyelg> How Do I refer to my variable length if I am on macro ?