<< 24-03-2017 >>

00:01:09*elrood quit (Quit: Leaving)
00:01:12FromGitter<Varriount> Well, vtables are references to a dedicated object, which may or may not be a global
00:02:41FromGitter<Varriount> Anyway, if multimethods are taken away, there's no adequate substitute.
00:02:42FromGitter<brechtm> Why doesn't this this output "inner A" and "inner B"? https://glot.io/snippets/eo9snwfmo1
00:04:28*user0____ joined #nim
00:06:59FromGitter<Varriount> @brechtm Seems like a bug.
00:07:36FromGitter<brechtm> returning a string instead will always return nil
00:08:13DemosI think the idea would be to switch to single dispatch methods
00:09:23FromGitter<Varriount> @brechtm By the way, what are you using multimethods for?
00:09:55FromGitter<brechtm> @Varriount to see how I could translate that to using generics instead :-)
00:10:50FromGitter<Varriount> I don't follow.
00:12:55FromGitter<brechtm> @Varriount you didn't ask that in relation to the code snippet?
00:14:31FromGitter<brechtm> bug logged: https://github.com/nim-lang/Nim/issues/5599
00:18:20FromGitter<Varriount> Hm, this is interesting. Generics don't seem to take into account procedure overloads defined after the generic.
00:19:20FromGitter<Varriount> @brechtm https://glot.io/new/nim
00:19:32FromGitter<Varriount> https://glot.io/snippets/eo9t5heq1k
00:20:07FromGitter<Varriount> I find it odd that the symbol has to be forced open with mixin, but w/e
00:20:23FromGitter<brechtm> @Varriount yup, that's what I came up with also
00:20:33FromGitter<brechtm> @Varriount but what's the mixin line for?
00:21:04FromGitter<Varriount> https://nim-lang.org/docs/manual.html#generics-symbol-lookup-in-generics
00:21:14FromGitter<brechtm> It seems I didn't need that line
00:21:28FromGitter<brechtm> But this was in my application, not in this sample code
00:21:50FromGitter<Varriount> It works without mixin if you rearrange the procedure implementation orders
00:23:48FromGitter<brechtm> Ah, the difference was that I didn't define inner(obj: Base)
00:24:48FromGitter<Varriount> Generics tend to work intuitively, except when they don't
00:25:17*Matthias247 quit (Read error: Connection reset by peer)
00:25:18FromGitter<brechtm> :-)
00:26:45FromGitter<Varriount> Actually, I wonder if @Araq would be willing to explain why symbols need to be closed at all.
00:27:45Araqproc complexAlgorith[T](x) = partOne(x); partTwo(x); partThree(x)
00:28:02Araqin what world do you want partOne() etc to be open?
00:28:41FromGitter<Varriount> One in which you want the user to supply an overload?
00:28:53Araqit's not part of the contract of 'T' to have a partOne proc, it's an implementation detail
00:29:07Araqhence you want it "private" aka "closed".
00:29:29FromGitter<Varriount> @Araq Yes, but in the posted snippet, the generic wasn't considering the implementations defined after it
00:29:53Araqso?
00:30:59FromGitter<Varriount> So, I'd consider the generic symbol lookup to consider the entire module, since a module usually contains an entire implementation.
00:32:04Araqwhy? Nim doesn't consider the entire module at all. it requires forward decls.
00:32:48Araqyou can argue that forward decl suck but you cannot argue that it's inconsistent behaviour.
00:33:16FromGitter<Varriount> No, just unintuitive for people coming from other languages.
00:34:20Araq*shrug* what isn't.
00:34:36Araqeverything is always confusing for programmers.
00:35:47FromGitter<Varriount> I wonder what Swift does
00:36:18Araqit considers the class context, what else.
00:36:53Araqbut Nim has no class context :P
00:37:04FromGitter<Varriount> It does have module context though.
00:42:06*themagician quit ()
00:45:13FromGitter<Varriount> Araq: So if you remove multi-methods, what's going to replace them?
00:46:11AraqI've already explained it.
00:46:55FromGitter<Varriount> Oh, single-dispatch
00:47:44FromGitter<Varriount> @Araq: Isn't that what is currently done? I though multimethods dispatched on the type of the object.
01:00:49FromGitter<Varriount> @brechtm How are you finding Nim so far?
01:10:11*def-pri-pub joined #nim
01:10:11*def-pri-pub quit (Changing host)
01:10:11*def-pri-pub joined #nim
01:15:32*Demos quit (Quit: Konversation terminated!)
01:59:59*sleepy998 joined #nim
02:03:42*user0___ joined #nim
02:03:42*user0____ quit (Read error: Connection reset by peer)
02:04:36sleepy998is there any proc that can process other completed async 'threads' if there are any, else do nothing? currently i'm using sleepAsync(1), but i want zero added latency.. and sleepAsync(0) seems to not let other 'threads' run
02:06:22*rauss quit (Quit: WeeChat 1.7)
02:06:51*user0___ quit (Client Quit)
02:09:18*xet7 joined #nim
02:11:00sleepy998i also tried using hasPendingOperations() to conditionally sleepAsync(1) but that apparently returns true even if nothing else has completed (unless i overlooked something)
02:14:11sleepy998if sleepAsync(0) relinquished, that would suffice. i'm not sure why it doesn't.
02:29:01sleepy998oh nevermind, poll(0) works :o
02:30:57FromGitter<Varriount> sleepy998: You might want to wait until dom96 is awake, he's the expert on async stuff
02:38:28FromGitter<Varriount> sleepy998: Shouldn't the framework just complete other asynchronous tasks once you yield?
02:39:01*chemist69 quit (Ping timeout: 260 seconds)
02:39:47sleepy998Varriount: yes; the problem was how to yield an infinitesimally small amount of time
02:39:48FromGitter<barcharcraz> Idea: c++ffi via clang pch files
02:40:48FromGitter<Varriount> @barcharcraz Is that format documented anywhere?
02:41:31*user0___ joined #nim
02:45:58FromGitter<barcharcraz> I think so
02:46:37FromGitter<barcharcraz> https://clang.llvm.org/docs/PCHInternals.html
02:46:54FromGitter<barcharcraz> I think the clangserialization library can even real em
02:47:01FromGitter<barcharcraz> *read
02:49:58FromGitter<barcharcraz> Ine thing idk about is how to instantiate a cop Templar with a nim type, that seems complicated
02:50:15FromGitter<barcharcraz> Jesus iPhone autocomplete is bad
02:50:46FromGitter<barcharcraz> Also see dlang's calypso project
02:51:03*user0___ quit (Quit: user0___)
02:52:38*chemist69 joined #nim
02:58:56def-pri-pubHas anyone yet made any JS bindings for audio playback or keyboard events yet?
03:01:02*libman quit (Quit: Connection closed for inactivity)
03:02:48def-pri-pubNevermind, might be able to do everything with the `dom` package, but it's not going to be "elegant."
03:09:10*bjz joined #nim
03:27:05FromGitter<barcharcraz> I mean tbh creating a video or audio element is how you do it
03:51:45*Snircle quit (Quit: Textual IRC Client: www.textualapp.com)
03:58:39demi-is it possible to build a nimble package as an executable binary as well as dynamic library?
03:59:35FromGitter<vegansk> @demi-, use ``when isMainModule: callMainFunctionHere()``
03:59:50demi-yeah i'm doing that and get problems :\
04:00:11FromGitter<vegansk> Then show the code and the problem
04:00:58*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
04:11:04*Serenitor joined #nim
04:11:43demi-i think i have worked around it for now
04:12:06demi-now to work out how to get the existing set of environment variables
04:13:25FromGitter<vegansk> https://github.com/nim-lang/Nim/blob/master/lib/pure/os.nim#L814
04:14:14*def-pri-pub quit (Quit: leaving)
04:48:03*Nobabs27 quit (Quit: Leaving)
05:00:10*vivus quit (Quit: Leaving)
05:19:46*bjz joined #nim
05:39:48*Tiberium joined #nim
05:41:49*Calinou quit (Read error: Connection reset by peer)
05:52:25*Serenitor quit (Quit: Leaving)
05:53:34*yglukhov joined #nim
05:55:57*BitPuffin|osx quit (Ping timeout: 260 seconds)
05:56:08*yglukhov quit (Remote host closed the connection)
05:56:23*yglukhov joined #nim
06:00:13*vlad1777d joined #nim
06:00:31*enthus1a1t joined #nim
06:02:47*enthus1ast quit (Ping timeout: 264 seconds)
06:23:19Tiberiumehm, noob question - if I have an "url" variable in global section, can I modify it from while loop section?
06:25:25FromGitter<vegansk> @Tiberium, yes unless you iterating over it
06:25:53FromGitter<TiberiumPY> @vegansk no, I'm not iterating over it
06:26:04FromGitter<TiberiumPY> so how to do it?
06:27:02FromGitter<vegansk> ```var url = "x" ⏎ for x in 1..5: ⏎ url &= url & $x``` [https://gitter.im/nim-lang/Nim?at=58d4bc34a84f611959da1012]
06:27:17FromGitter<TiberiumPY> ah, I'm stupid
06:27:23FromGitter<TiberiumPY> I was doing it with "var" like
06:27:47FromGitter<TiberiumPY> ```var url = "" ⏎ while true: ⏎ var url = "something else"``` [https://gitter.im/nim-lang/Nim?at=58d4bc618fa16339540f0b17]
06:27:48FromGitter<TiberiumPY> thanks
06:35:05*girvo quit (Quit: Lost terminal)
06:40:35*nsf joined #nim
06:51:12*zachcarter joined #nim
06:53:20*SusWombat_ quit (Remote host closed the connection)
06:55:02*SusWombat joined #nim
06:59:01SusWombatMorning
06:59:19SusWombatAnyone a idea why lineDir doesnt work for me on linux?
07:05:16*sleepy998 quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client)
07:12:39*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
07:14:21*Tiberium quit (Remote host closed the connection)
07:14:25zachcarternope :/
07:15:29zachcarterare you talking about with the compiler?
07:15:33zachcarterthe switch?
07:15:38zachcarterSusWombat^
07:28:36*bjz joined #nim
07:35:53*Vladar joined #nim
07:42:10*tankfeeder joined #nim
08:07:59*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
08:09:14*bjz joined #nim
08:09:20SusWombatzachcarter, yeah
08:09:29zachcartersec
08:09:39SusWombatzachcarter, i think we even discussed this together like 1-2 weeks ago :D
08:09:50zachcarterah possibly
08:09:55zachcarterI remember a similar discusison
08:10:01zachcarterstill no luch huh?
08:10:08SusWombatno :/
08:10:27zachcarterhrmmm
08:10:35zachcarteryou’re using gdb right?
08:10:38SusWombati compile with lineDir on but i still get some "random" code when i press l in gdb/lldb
08:10:39zachcarterhave you tried lldb?
08:10:44zachcarterah okay
08:10:48zachcarterhave you tried linedir
08:10:51zachcarternot camel case?
08:11:23zachcarternim c --linedir:on --debuginfo c hello
08:12:58SusWombatyeah same
08:13:10SusWombatzachcarter, the double c is a tyo right?
08:13:16SusWombattypo*
08:13:16cheatfatenim c --debugger:native --linedir:on hello
08:13:40zachcarterI copied and pasted that from a blog
08:13:42zachcarterbut yeah probably
08:13:52SusWombatcheatfate, same :/
08:14:26cheatfatewhat is `l` command doing?
08:14:51SusWombatshould list my code no?
08:15:05SusWombatcheatfate,
08:15:46SusWombathttp://i.imgur.com/PCZG0Yw.png
08:16:09SusWombatthe file only contains " echo "Hello World" "
08:17:56cheatfateSusWombat, you need to execute `b NimMainModule`
08:17:58cheatfater
08:18:02cheatfatethen `r`
08:18:08cheatfatethen one `n`
08:18:14cheatfateand you are at your code
08:19:27*couven92 joined #nim
08:20:45SusWombatcheatfate, http://i.imgur.com/UUiNZdT.png
08:20:50SusWombatthats what happens for me
08:21:09cheatfateyeah i know
08:21:12cheatfatemake one step
08:21:19cheatfatewith `n`
08:21:22*Andris_zbx joined #nim
08:21:43cheatfatethis is workaround :)
08:22:01cheatfateof course you can make `b helloworld.nim:<linenumber>`
08:22:23cheatfateso you can avoid walking through stub code (which is very very unclear)
08:22:56SusWombatcheatfate, ok after next step its works O: Do you happen to know why that happens?
08:23:41SusWombatit*
08:23:52cheatfateSusWombat, nope, and i have asked Araq, he dont know too :)
08:24:15SusWombatcheatfate, do other debuggers work without that workaround?
08:24:46cheatfateSusWombat, nope this workaround for gdb/lldb and windows debuggers too
08:25:15*couven92 quit (Quit: Client disconnecting)
08:25:32SusWombatcheatfate, as it seems it works for zachcarter out of the box i guess because he uses mac?
08:25:44*couven92 joined #nim
08:26:17cheatfateSusWombat, i dont think it workd better for zachcarter
08:26:36cheatfatebut i think he make `b somecode.nim:<someline>` before executing
08:26:44cheatfateso he never seen stub code
08:26:51SusWombatzachcarter, could you comment on that?
08:27:06zachcarterhrm? I don’t have to do much to get debug line info in lldb
08:27:23zachcarterI pretty much do this -
08:27:53zachcarternim —linedir:on —debuginfo c hello.nim
08:28:20zachcarteron osx with devel version of nim
08:28:44SusWombatzachcarter, and if you open the binary with lldb and press l whats the output?
08:29:09zachcartersec
08:30:00zachcarterhttps://gist.github.com/zacharycarter/d36edf74f5c30690da2b0bc02cdd4a6f
08:30:42SusWombatah well you have the same problem :/
08:30:55SusWombatbtw thanks cheatfate zachcarter
08:31:16zachcartersure
08:31:28zachcartersorry I’m totally distracted haha, trying to get shaders to copmile for dx11 on my windows vm
08:31:39SusWombatno problem
08:38:09*vivus joined #nim
08:39:26vivusin this lib: https://nim-lang.org/docs/db_mysql.html . am I limited to searching for strings by what mysql offers?
08:45:23zachcartervivus - I don’t understand your question
08:45:40zachcarterI don’t think that module adds any functionality to mysql
08:45:44zachcarterif that’s what you’re asking
08:46:47vivuszachcarter: say I want to search for pattern-matched strings in a mysql table. does the db_mysql library add any functionalities for doing this or is the library just a wrapper for what mysql provides?
08:47:01zachcarterI’m guessing the latter
08:47:11zachcarterbut maybe not
08:47:16zachcarterit does say higher level wrapper
08:47:28zachcarterI’m not a user so a user would be better to comment, but thank you for clarifying your question
08:48:36vivuszachcarter: will it be possible to fetch each row from the table, treat it as a string/list/nims-equivalent-of-a-python-dictionary, do the things I want to do and then re-add each row back to its original place (after being modified) ?
08:49:37zachcartervivus: I have no idea, I’ve never done any DB work with Nim. Looking at the module, it looks like doing something similiar to that should be possible
08:49:48zachcartermaybe try the .rows iterator
08:49:50zachcartersee what you get
08:50:01vivusyeah I'm going to try fetching each row to see what happens
08:50:11vivusgotta crawl before I can walk in nim :)
09:00:45*Tiberium joined #nim
09:05:38zachcartertrue
09:07:11SusWombatwhat are the default values for object members? and can i set them when declaring a type?
09:09:02*Ven joined #nim
09:09:25*Ven is now known as Guest14586
09:12:59cheatfateSusWombat, var a = ObjectType(field1: value1, field2: value2, ...)
09:13:12TiberiumI'm wondering - is there any website like codecombat or codingame with Nim support?
09:14:21cheatfateSusWombat, var a = ObjectType() initializes memory of object to `0x00` bytes
09:14:44SusWombatcheatfate, ok thanks
09:15:16SusWombatTiberium, if you find one pls be so kind and tell me about it :)
09:15:53TiberiumSusWombat, ok, will spend some time googling :)
09:18:20Tiberiumehh, codingame contains many languages, but no "Nim" in list, but there's even a Swift, C, C++, and so on
09:23:10vivusTiberium: for an online nim compiler? I believe there is 1
09:23:25Tiberiumvivus, no, I know there's a Nim compiler
09:23:35Tiberiumvivus, I want to find a coding game like "codingame"
09:23:42Tiberiumwith Nim support
09:25:33FromGitter<brechtm> @Varriount How I am finding Nim so far? Ease of coding seems to be very close to Python. But I'm still struggling to let go of OOP and get used to types (and refs).
09:35:30*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
09:37:09*bjz joined #nim
09:41:22FromGitter<dom96> Someone from codingame emailed me about adding Nim support
09:41:28FromGitter<dom96> so it might happen
09:41:44zachcarteranyone with a windows machine want to help me out and test my game framework on their machine?
09:41:58zachcarterI’m getting some weird results in my DX11 shaders and I’m wondering if it’s because I’m using a VM
09:42:02zachcarterto test with
09:42:15*xet7 quit (Quit: Leaving)
09:45:44zachcarterI’m going to chalk it up to it being DX11 and me running a vm :P
09:46:03*nhywyll joined #nim
09:48:54*nhywyll quit (Client Quit)
10:01:26FromGitter<TiberiumPY> @dom96 how long time ago they emailed y
10:15:45*Guest14586 quit (Ping timeout: 268 seconds)
10:16:13FromGitter<Varriount> zachcarter: I might be able to.
10:29:24*couven92 quit (Quit: Leaving)
10:29:41*couven92 joined #nim
10:32:18*arnetheduck joined #nim
10:45:13FromGitter<brechtm> The following crashes on Nim devel on macOS: https://glot.io/snippets/eoaac145ag
10:45:43FromGitter<brechtm> But not if line 9 is uncommented
10:45:57FromGitter<brechtm> Can someone try this on Linux or Windows?
10:46:15AraqI don't think we claim you can echo typeinfo
10:47:14FromGitter<brechtm> Error: execution of an external program failed: 'clang -c -w -g -O3 -I/usr/local/Cellar/nim/HEAD-0d8a503/nim/lib...
10:48:29FromGitter<brechtm> @Araq The C compilation step errors, I mean. Is that normal?
10:49:09zachcarterVarriount: if you’d still be willing please lmk, sorry went to eat breakfast
10:49:50FromGitter<TiberiumPY> It doesn't crash for me
10:49:56FromGitter<TiberiumPY> (linux gcc)
10:49:59FromGitter<TiberiumPY> will try with clang now
10:50:17FromGitter<TiberiumPY> it's fine
10:50:24FromGitter<Varriount> zachcarter: I can test in the morning, I'm going back to sleep now.
10:50:31zachcarterAlright thanks :D
10:50:35zachcarterhave a good night!
10:50:41FromGitter<brechtm> @TiberiumPY strange
10:51:26Araqbrechtm: (value: ...rawTypePtr: ...) # produces this output for me
10:51:39Araqwhich is ok, the fields are hidden
10:52:17FromGitter<brechtm> @Araq I get this: http://pastebin.com/tPS2qJpe
10:52:42FromGitter<TiberiumPY> my clang version is 3.9.1
10:53:38*krux02 joined #nim
10:54:15FromGitter<brechtm> Hrm, it does seem to work now that I updated my Nim to current devel
10:54:35FromGitter<TiberiumPY> that's it :)
10:54:36FromGitter<brechtm> Nope, it's something to do with VSCode... nm
10:54:43FromGitter<TiberiumPY> ?
10:54:46FromGitter<TiberiumPY> I use VSCode too
10:55:33FromGitter<brechtm> I have no idea what's going on
10:59:01zachcarterwhat’s the error brechtm?
10:59:50FromGitter<brechtm> Ah, it's because in VSCode I'm passing more options to nim
11:00:42FromGitter<brechtm> @TiberiumPY try passing -d:release
11:01:38FromGitter<brechtm> Yup, that makes it fail on glot.io as well
11:02:24*Snircle joined #nim
11:02:30FromGitter<TiberiumPY> can you provide exact command?
11:02:50FromGitter<TiberiumPY> so I need to uncomment commented line
11:02:54FromGitter<TiberiumPY> and run with clang and release
11:02:58FromGitter<brechtm> nim c -d:release file.nim
11:02:58FromGitter<TiberiumPY> it works for me...
11:03:04FromGitter<brechtm> no, don't uncomment
11:03:07zachcarterhttps://glot.io/snippets/eoaac145ag
11:03:10zachcarterworks with -d:release
11:03:11FromGitter<brechtm> uncommenting "fixes" it
11:03:18FromGitter<TiberiumPY> ah
11:03:19FromGitter<TiberiumPY> it is
11:03:23FromGitter<TiberiumPY> fails with comment
11:03:25zachcarterwhoops
11:03:30zachcarterhrm how do I update your snippet
11:03:35FromGitter<TiberiumPY> both on gcc and clang
11:03:55zachcarterhttps://glot.io/snippets/eoaawusoex
11:03:56zachcarterthere
11:04:00zachcarterthat works with -d:release
11:04:01FromGitter<brechtm> @zachcarter You need to fork it first, then change it, then save it again... annoying, huh?
11:04:13zachcarteryou guys can’t echo that
11:04:19zachcarteruse repr
11:04:30FromGitter<TiberiumPY> but it's compile-time rror
11:04:32FromGitter<TiberiumPY> in C
11:04:44FromGitter<TiberiumPY> which is always bad
11:04:48zachcarterAraq: I don't think we claim you can echo typeinfo
11:05:16zachcarterI think that’s what he’s referring to
11:05:20zachcartercould be wrong
11:05:51FromGitter<brechtm> @zachcarter But it doesn't make sense that it works when uncommenting line 9
11:06:11zachcarterkind is a string?
11:06:15FromGitter<brechtm> And as @TiberiumPY says, I don't suppose this should generale C-compile error
11:06:23zachcarterprobably not
11:06:38Araqit shouldn't. but it also doesn't for me.
11:06:55zachcarterI don’t know why the release define causes that
11:06:57FromGitter<brechtm> Araq: neither with -d:release?
11:07:34Araqah, it does
11:07:58FromGitter<brechtm> @Araq let me know if you want me to create an issue for this
11:08:14Araqyeah sure go ahead.
11:08:29Araqnot seeing how it's invalid C code
11:12:59*user0___ joined #nim
11:15:08*bjz quit (Ping timeout: 246 seconds)
11:16:04*bjz_ joined #nim
11:22:29*user0___ quit (Quit: user0___)
11:22:44*user0___ joined #nim
11:26:48*bjz joined #nim
11:27:02FromGitter<brechtm> How can I go from an Any (akObject) to the typedesc?
11:27:08*user0___ quit (Client Quit)
11:28:13*bjz_ quit (Ping timeout: 260 seconds)
11:29:13Tiberiumzachcarter, I'll reboot to Windows now (I have windows 10), and I'll test your app. Will you precompile it?
11:29:18*Tiberium quit (Remote host closed the connection)
11:29:28zachcartersure I already have it precompiled
11:29:34zachcarterlet me zip it up fo ryou thank you Tiberium
11:30:20FromGitter<TiberiumPY> OK :)
11:32:28zachcartergoing to figure out how to get this off my vm then I’ll have to you :)
11:32:47FromGitter<TiberiumPY> you can use services like transfer.sh
11:32:54FromGitter<TiberiumPY> to upload and share files
11:32:59FromGitter<TiberiumPY> it doesn't require any registration
11:33:05FromGitter<TiberiumPY> https://transfer.sh
11:35:00zachcarterthanks
11:38:28zachcarterhttps://transfer.sh/xtAsS/zach%27s%20dx11%20app.zip
11:39:25FromGitter<TiberiumPY> wait, I need to download SDL2, I can do this manually :)
11:39:37zachcarterah crap forgot about that
11:39:43zachcarterokay thanks :)
11:40:38FromGitter<TiberiumPY> ah
11:40:43FromGitter<TiberiumPY> you forgot to send me assets :)
11:40:47zachcarterwhoops
11:40:51FromGitter<TiberiumPY> C:\Users\Tiberius\Desktop\../assets\textures/test01.png does not exist.
11:40:59zachcarterlet me do that real quick
11:41:20FromGitter<TiberiumPY> no, I do not hurry
11:42:14*Ven joined #nim
11:42:37*Ven is now known as Guest63163
11:42:41zachcarterhttps://transfer.sh/jyeGi/assets.zip
11:42:46zachcarter:P
11:43:00zachcarterquick is relative anyway
11:44:05FromGitter<TiberiumPY> so I started it
11:44:27FromGitter<TiberiumPY> http://image.prntscr.com/image/fed3a3a6bcc64df49690fcd8a6654790.png
11:44:36FromGitter<TiberiumPY> it is that I get
11:44:38zachcarterokay thanks that’s what I”m seeing too on my screen
11:44:42zachcarterdo you have DX11>
11:44:43zachcarter?
11:44:45FromGitter<TiberiumPY> yeah
11:44:52FromGitter<TiberiumPY> GTX 750
11:45:03zachcartergotcha, okay thank you for trying that I appreciate it very much!
11:45:28FromGitter<TiberiumPY> I always ready to help with game development projects :)
11:45:37zachcarterwell I’m welcoming contributors to mine :D
11:45:46zachcarterhttps://github.com/fragworks/frag
11:45:54FromGitter<TiberiumPY> no, I'm actually a newbie in Nim
11:46:13zachcarterah well you don’t have to be a pro to help
11:46:20zachcarterso much work to be done
11:46:42FromGitter<TiberiumPY> but I'm really a newbie, I've came from Python
11:46:50zachcarter:D well glad to have you
11:47:07zachcarterNim is very cool
11:47:17FromGitter<brechtm> Hrm, getting nowhere trying to get the base type for an object type using typeinfo.base
11:47:26FromGitter<brechtm> Might as well get on with the real work...
11:50:28*couven92 quit (Quit: Client disconnecting)
11:58:41*elrood joined #nim
12:17:11zachcarterhttp://imgur.com/a/JG9y7
12:17:13zachcartergot it working
12:18:18FromGitter<TiberiumPY> wow, nice
12:19:51zachcarterthanks
12:24:23*kunev quit (Quit: е те!)
12:28:24*_yeeve quit (Quit: Leaving)
12:28:40*_yeeve joined #nim
12:28:40*_yeeve quit (Client Quit)
12:29:02*yeeve joined #nim
12:31:15*kunev joined #nim
12:33:08*Tiberium joined #nim
12:39:40krux02brechtm, are you still trying to implement super with a macro?
12:39:56FromGitter<brechtm> @krux02 I gave up
12:40:18FromGitter<brechtm> @krux02 well, I was now trying to use typeinfo.base, so no macro
12:50:41*zachcarter quit (Quit: zachcarter)
12:52:05krux02http://ix.io/pdP
12:52:11krux02forget about typeinfo
12:52:30krux02brechtm: I implemented super for you
12:52:54krux02you still need to do proccall, but the super does the casting for you
12:53:01FromGitter<timeyyy> is cmake what neovim uses for building all the things in .deps, ?
12:53:09krux02and it is written in a way that it assumes a ref type, and casts to a ref type
12:53:45krux02timeyyy well cmake is the default build system for c++ projects
12:53:54krux02well not the default, but it is getting there
12:54:11FromGitter<timeyyy> but vim is c :)
12:54:12krux02I don't know about .deps,
12:54:19krux02it also works for c
12:54:42krux02It is a horrible language that makes builds complicated
12:54:44krux02I hate it
12:55:09krux02but it get's the job done for most big projects and it allows cross platform builds
12:55:33FromGitter<timeyyy> i want to automatically download system dependencies for my python project
12:56:00krux02I have no idea about python, but cmake normally does not download dependencies
12:56:13krux02I think you can write a cmake script that does it, but normally it does not do that
12:56:32krux02and what do you mean with downloading system dependencies?
12:56:45krux02aren't system dependencies those things you can't download
12:56:59FromGitter<timeyyy> well when i do `make` with neovim
12:56:59krux02otherwise they would not be called "system" dependencies
12:57:11krux02I only know vim
12:57:32krux02and in vim make would call make by default, but you could replace it with any other command
12:57:39FromGitter<timeyyy> yeah i mean, when i ship my final product to the user it will depend on xclip for example
12:57:45krux02cmake generates (normally) makefiles
12:57:56FromGitter<timeyyy> or lets say luajit
12:58:07krux02so when you have a cmake project and you execute cmake already, make should be enough
12:58:26krux02those makefiles are written in a way that they call cmake when needed
12:58:41krux02doesn't always work though and you still have to call cmake from time to time
12:59:17krux02well you have some options
12:59:38krux02when you have a git repository, you can put your dependencies in a git subtree
12:59:59krux02then you ship with your dependencies, but then they are also not system dependencies anymore
13:00:11krux02cmake normally helps you detect system dependencies
13:00:18FromGitter<timeyyy> ok hold on
13:00:35FromGitter<timeyyy> so i want to bundle the deps in a reproducible way
13:00:48krux02yes then I recommend you do git subtree
13:01:01FromGitter<timeyyy> 1) download, 2. compile if required
13:01:38krux02with git subtree, your build does not download the dependencies, the dependencies are bundled in the download of the project
13:02:15FromGitter<timeyyy> as source?
13:02:18krux02yes
13:02:41krux02and then cmake can be configured to trigger the build of all dependencies
13:03:03krux02you can also bundle binaries, but that is much less reproducable
13:03:45vivusI defined a seq like this: dbstore: seq[string] ... and then ran this code: for x in fetchdb.fastRows(sql("select content from posts")): dbstore.add(x) , but it gives me this error: SIGSEGV: Illegal storage access. (Attempt to read from nil?) ... what am I doing wrong ?
13:04:12FromGitter<timeyyy> ok thanks for the help
13:04:21krux02dbstore is nil
13:04:32krux02timeyy, no problem
13:05:08vivuskrux02: what do I do instead?
13:05:19krux02timeyyy, but those dependencies you mentioned seem to be very stable dependencies
13:05:35krux02timeyyy, so you could rely on them
13:05:51krux02cmake will trigger an error when they are not found, and users can install them
13:06:20FromGitter<timeyyy> well i am making an appimage
13:06:27krux02I would rather suggest bundling dependencies that are less stable and might introduce incompatible api changes
13:06:32FromGitter<timeyyy> so the idea is a bundle everything and it will just work
13:06:44krux02yes then git subtree is your friend
13:07:15krux02vivus, well I never work with sql, but you have a segfault
13:07:26krux02and what I said was just a guess
13:07:32FromGitter<timeyyy> now that you mention it i think neovim has all it's deps in a git repo
13:07:35krux02one of your variables you use is not initialized
13:07:58krux02and most of the time this happens is, when you try to append to an nil seq or a nil string
13:08:19krux02so before you call add on a seq, you should call newSeq(0) on it
13:08:36krux02or initialize it with = @[]
13:08:59vivuskrux02: basically, I want to store the strings from the DB into a sequence/array/dictionary to do some 'work' on them within the program
13:09:22vivuskrux02: should I use a sequence or some other advanced-type ?
13:09:37krux02seq is a very fine type
13:09:42krux02you can't overuse it
13:10:14vivuswhich type should I then use for a dynamic array-like type ?
13:10:16krux02array is too static for this context (fixed length)
13:10:29krux02vivus, you should use seq
13:10:33krux02that is your type
13:10:47krux02but you have to initialize it
13:10:52vivusalright I see the docs shows initialization, so I need to do that
13:11:32krux02I think it's sad that this needs to be initialized, but that is how it is
13:12:20vivuskrux02: why is the initialization necessary? so that it can be placed on the heap for GC?
13:12:36vivusand do I initialize it in a proc or at the global level?
13:15:13krux02vivus, it's best when you initialize where you also declare it
13:15:26demi-dom96: when you are around i think i found a significant bug in nimble and not sure how to proceed with fixing it.
13:17:16krux02reactormonk, do you still maintain nim-mode?
13:17:26reactormonkkrux02, nope.
13:17:34krux02hmm
13:17:37FromGitter<timeyyy> hey krux02, i thought i was in the neovim channel lol!
13:17:48FromGitter<timeyyy> now it makes sense ^^
13:18:02krux02np, was a bit off topic though
13:18:42krux02reactormonk, that was a quick reply, but can you give me some advice, on how I could take over the maintenance of the package?
13:18:57krux02because I have the feeling nim-mode is orphaned
13:19:44krux02since I rely on it it would be very nice if I would at least be able to fix problems with it
13:19:57*SusWombat quit (Remote host closed the connection)
13:21:35*SusWombat joined #nim
13:21:36*SusWombat quit (Remote host closed the connection)
13:21:57reactormonkkrux02, not sure I can still vet PRs on that, if Araq agrees, I can just give you collab.
13:22:02krux02timeyyy, when you look at the YouCompleteMe plugin, then you can see how you could deal with system dependencies, that plugin bundles boost
13:22:18*user0___ joined #nim
13:22:23reactormonkand yuutayamada for that matter.
13:23:00krux02reactormonk, it's not about getting access rights, for now I am ok with creating pull requests, as long as they are actually merged, but I need some information on how to actually develop an emacs package
13:23:10krux02what are the right tools to do it, how to test changes etc
13:23:29krux02and where to put code that I want to be executed
13:23:41vivusthanks krux02 that worked
13:24:46*SusWombat joined #nim
13:25:41krux02@brechtm: did you test http://ix.io/pdP ?
13:28:20reactormonkkrux02, check the makefile
13:40:52demi-hmmm, i'm trying to run a process using osproc's startProcess; that is all working fine but the process i'm starting is interactive, how do i make it "take over" while it is running?
13:41:05*zachcarter joined #nim
13:42:35flyxdemi-: well, you'd need to dump the process' output to stdout and feed stdin to the process' input
13:43:26demi-and that isn't what "poParentStreams" is for?
13:43:39SusWombatCan someone tell me what im doing wrong here? https://hastebin.com/kolubazoki.nim
13:43:53SusWombati get: SIGSEGV: Illegal storage access. (Attempt to read from nil?)
13:44:26flyxdemi-: hmm, it should
13:45:10demi-yeah i am not seeing that
13:45:15Araqdemi-: poParentStreams is only implemented for Windows :-)
13:45:23demi-
13:45:38vivuswhich lib should I use for reading/writing strings to files ?
13:45:50demi-Araq then it seems that the majority of osproc is only implemented on windows
13:46:38flyxvivus: depends on your use-case. there are simple procs in system, and there is the streams module
13:46:47Araqyou can use os.execShellCmd that does poParentStreams
13:47:05vivusSusWombat: I had a similar problem above. you need to initilize something in your code
13:47:10Araqalso majority of osproc my ass, I only touch this code when I'm drunk for a reason
13:47:14SusWombatIs there somewhere a list on stuff thats only implemented for windows?
13:47:29Araqit's a never ending pita in posix land
13:47:35demi-haha
13:47:40demi-ain't that the truth
13:47:57vivusso when calling osproc and it bricks your OS, blame Araq for writing code while drunk
13:47:59*user0___ quit (Quit: user0___)
13:48:22flyxSusWombat: it is really a bad idea to give a field the same name as its type. use Books for the type.
13:48:33flyxSusWombat: also Shelf
13:48:49SusWombatflyx, thats just stupid example code but thanks :)
13:48:53AraqSusWombat: only osproc poParentStreams comes to mind.
13:49:04SusWombatAraq, ok thank you
13:49:12demi-Araq: that would work but i have no way to modify the env of the command being invoked then :\
13:49:15flyxSusWombat: then do var bookShelf = Shelf(books: Books())
13:49:37SusWombatflyx, o.O ok thanks why isnt nim doing that?
13:49:37Araqdemi-: I think if you say "please, please" cheatfate might give it a shot
13:49:47flyxSusWombat: why should it?
13:50:13demi-heh, ok i will give that a shot
13:50:14SusWombatflyx, cause i declared it as a member or not?
13:50:29flyxSusWombat: yes, and default value for ref types is nil
13:50:30krux02reactormonk, I now have cask and I can run the cask commands. And I now did some local changes, how do I test them?
13:51:02krux02just add the folder of my fork to load-path and add require in my init.el?
13:51:03flyxSusWombat: you need to tell Nim explicitly to allocate an object of Books, it won't do that on its own
13:51:14SusWombatok thanks
13:51:40reactormonkkrux02, in emacs or via cask?
13:51:47reactormonkvia emacs, just eval-buffer
13:51:50reactormonkvia cask, make test
13:51:55flyxSusWombat: imagine you have a tree structure `type Tree = ref object ; left, right: Tree`. do you see why it's a bad idea now?
13:52:35*user0___ joined #nim
13:53:20krux02reactormonk, so the test is only non-interactive?
13:53:27reactormonkkrux02, yeah.
13:54:46krux02and with eval-buffer you mean the buffers of the test cases?
13:55:06SusWombatflyx, yeah
13:55:21krux02reactormonk, I was thinking more of interactive testing
13:56:12reactormonkkrux02, define interactive testing
13:56:16krux02meaning to open a file in nim-mode, and do thinks I would normally do when I edit that file
13:56:43reactormonkah nope, cask is explicitly about isolation.
13:57:03krux02well then how do I reaload a package from emacs?
13:57:08krux02just restart emacs?
13:57:25krux02I mean isolation tests are good
13:57:38krux02but more important is how it works in the editor
13:58:35reactormonkfor reloading it in your editor, eval-buffer
14:00:23*Guest63163 quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
14:00:40*Ven joined #nim
14:01:03*Ven is now known as Guest67847
14:01:17*Guest67847 quit (Client Quit)
14:02:58*zaquest quit (Read error: Connection reset by peer)
14:03:11*zaquest joined #nim
14:04:48SusWombatreactormonk, do you use nim in emacs?
14:04:54SusWombatthe nimmode i mean
14:04:57reactormonkSusWombat, I don't use nim at all anymore :-(
14:05:02SusWombatah ok
14:05:21reactormonkmainly Scala, with Haskell on the side.
14:15:11krux02reactormonk, well I went in the other direction I used to write a lot of scala and now it's nim
14:15:21krux02main reason JVM
14:16:04krux02haskell only in university courses
14:16:14vivusI've opened a file like this: var fs = newFileStream(filename, fmWrite) . which option do I use to write each entry of my sequence to the file ?
14:17:05krux02vivus, the simplest thing you can do, is to write everything you do into a string, and then at the end you just write that string to a file in one operation
14:17:30krux02vivus, this file streaming stuff is a very ancient technology when memory was short and files used to not fit in memory
14:18:23vivuskrux02: that is what I want to do. So I have this operation: for x in fetchdb.fastRows(sql("select content from posts")): ... and now I want to add each entry to a file. what would I do here?
14:18:39demi-for str in str_seq: file.write(str)
14:18:53krux02demi-, well not entirely
14:19:12krux02vivus, you need a separator, otherwise you wont't be able to parse the content back
14:19:27reactormonkkrux02, actually got a haskell application here in the company, but it's only a smaller project :-)
14:19:28krux02the simplets separator is just a newline
14:19:50vivuskrux02: should I use csv operations then ?
14:20:00krux02reactormonk, what is haskell actually be used for except for writing compilers?
14:20:14reactormonkkrux02, servant makes for nice microservices
14:20:15krux02vivus, that would be an option
14:21:45*byte512 quit (Quit: Bye.)
14:21:59krux02reactormonk, I always liked this pure fuctional style of haskell, but neither the world nor the computer is pure functional. And I prefer procedures over IO monads
14:22:53reactormonkkrux02, they're not too different. However, you can do funny things with eff monads.
14:23:03reactormonk... also, applicative do basically gives you some erlang power.
14:23:06krux02what is eff monads
14:23:58reactormonkScala implementation: https://atnos-org.github.io/eff/
14:24:06*bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
14:24:13reactormonkMonad Transformers are inflexible. That's why eff exists.
14:25:05Tiberiumhow can I define tables which looks like this: {"peer_id": 123, "message": "some text"} ?
14:25:22*byte512 joined #nim
14:25:44krux02Tiberium, that is not a table
14:25:46vivusis this the only place to view CSV docs: https://github.com/achesak/nim-csv/blob/master/documentation.html ?
14:25:57Tiberiumkrux02, {"peer_id": 123, "message": "some text"}.toTable()
14:26:09TiberiumI don't know how to use objects like this without toTable
14:26:20TiberiumI need something like python's dict
14:26:24krux02Tiberium, well it is badly typed or better as a struct/object/tuble
14:26:28krux02tuple
14:26:43krux02well there is a package called tables
14:26:48krux02but they are typed
14:26:53Tiberiumyeah I see
14:26:58krux02so you should have a consistent type on the right side
14:27:30krux02I think you can use the any type, but that is very dirty
14:27:31Tiberiumok, thankfully there's web API, so it accepts JSON, so I can safely convert all parameters to string
14:27:50krux02there is also a json package
14:28:03TiberiumI know
14:28:11TiberiumBut it requires to unpack everything too
14:28:13krux02so maybe want to work with json objects instead of tables
14:28:17Tiberiumlike object.str
14:28:28vivushows this lib: https://github.com/unicredit/csvtools . much cleaner usage
14:28:45vivusawesome to see a big bank using nim
14:29:03krux02well I would always be careful with 19 commits packages.
14:29:38vivushttps://github.com/achesak/nim-csv 25 commits
14:29:44krux02either it's is very much proof of concept, or it is written by the most mazing programmer who can program in a way that covers all corner cases naturally
14:29:53krux02it's more likely the first one
14:30:05krux02yea you git the idea
14:30:13krux02test it get the idea of it
14:30:27krux02but eventually it means you have to write your own version of it
14:30:49*rauss joined #nim
14:30:53krux02I don't want to scare you off. I just want you to be careful
14:31:34krux02Tiberium, web API are written with javascript in mind, not with a typed programming language
14:31:41Tiberiumkrux02, I know sadly
14:31:53krux02but when you have a specification of the web api
14:31:55krux02is some form
14:32:09TiberiumI have them
14:32:12krux02you should be able to transform that specification into nim code that you can just call as functions
14:32:40krux02In is very powerful, it could generate all the glue code for you
14:32:45Tiberiumthey have JSON Schema describing their API
14:32:52Tiberiumso like all the types
14:33:02krux02that's pretty great
14:33:14krux02that means you could transform this schema into a wrapper API
14:33:58krux02I don't know that API, but web api are better when they are async
14:34:08krux02so maybe you have several void procs
14:34:21Tiberiumtheir json schema is located on GitHub: https://github.com/VKCOM/vk-api-schema
14:39:16krux02Tiberium, I have very little knowledge about web apis, but I know that it is best for performance, when the api allows to bundle requests
14:39:27Tiberiumkrux02, you mean send them as one?
14:39:33krux02yes
14:39:47Tiberiumthere's that possibility too, you can send up to 25 requests using special web api method
14:40:10Tiberiumand api itself is limited for 3 requests per second, so the best you can get is 75 req/s
14:40:15Tiberiumbut it's not really needed
14:40:42krux02oh yea what speeds
14:41:00Tiberiumit's largest social network in Russia and in CIS
14:41:01krux02but anyway, you should some request struct
14:41:11krux02and then an apicall that accepts an openarray of that
14:41:17Tiberiumkrux02, I will try to parse this json schema
14:41:22krux02and then the API itself can be sycronous
14:42:20krux02VK isn't that this russian Facebook with the German name?
14:42:32Tiberiumit's russian facebook, but with russian name :)
14:42:56krux02well Kontakte is a German word :P
14:43:02Tiberiumnooo
14:43:10Tiberium"VKontakte" means "In contact"
14:43:20Tiberiumif you translate from russian to english
14:43:38Tiberiumit's just english letters instead of russian one's
14:43:43Tiberiumoriginally it's "ВКонтакте"
14:44:34vivusthat would be an awesome domain to own
14:44:36*Andris_zbx quit (Ping timeout: 240 seconds)
14:44:36FromGitter<brechtm> @krux02 Thanks. Good to know it's possible!
14:45:07FromGitter<brechtm> @krux02 But I'm sure you don't mind I'll try to use generics instead ;-)
14:45:18TiberiumWhere do I start learning, how to generate Nim code? Or maybe I shouldn't do it now, because I'm a newbie?
14:45:30TiberiumI've done some auto-binding generation in Python using pycparser and cffi
14:45:39*andris_ joined #nim
14:45:42krux02brechtm: I don't use inheritance at all, it's all generics in my code
14:46:09krux02Tiberium, I started with code generation, too
14:46:18krux02the nice thing is, that you can do it all in a macro
14:47:05krux02macro parseApi(): untyped = let api = staticRead("schema.json") ...
14:47:13krux02don't forget to import macros
14:47:19krux02and then you have quote do
14:47:30krux02let x = quote do: ...
14:48:38vivusAraq: is there a better place for documentation for this: https://github.com/achesak/nim-csv/blob/master/documentation.html ?
14:48:41krux02this means you don't need an extra build step thet generates your generates sources, it's all integrated in the default nim build
14:49:34Tiberiumkrux02, yeah, I've read some articles about Nim's compile-time possibilities
14:49:57krux02those compile time possibilites are the reason I am here
14:50:10vivusAraq: ignore that question, I just realized there is more than 1 CSV lib
14:50:11krux02without them I would never have touched this language
14:52:39krux02reactormonk, I have a bug with the newest nimsuggest version here: https://github.com/nim-lang/nim-mode/issues/154
14:56:42*yglukhov quit (Remote host closed the connection)
14:58:03Tiberiumkrux02, and how can I generate something based on this json schema using macro like you'd suggested? I can't use json module at compile time
14:58:13Tiberiumor wait
14:58:29vivuskrux02: in a sequence of strings, is there a way to preserve the \n characters when writing to a file ?
14:58:53Tiberiumnah, I'm not so familiar with Nim to do such complicated things right now :)
15:01:32*BitPuffin|osx joined #nim
15:08:39Tiberiumbut maaaybe
15:13:17krux02vivus, I think when you use \n in string literals, nim replaces them by the system dependent version of that
15:13:22krux02I am not so sure about that
15:13:30*Ven joined #nim
15:13:53*Ven is now known as Guest28837
15:13:56vivusI'm hoping to preserve them, if possible
15:14:17Tiberiumso I somehow need to parse json at compile-time, hmm
15:14:31krux02well best is, if you don't use newline at all
15:14:36krux02json can be one line
15:14:44krux02(eg)
15:14:49vivuskrux02: the data itself is stored with newlines
15:14:56krux02or you have newline as your separator of strings
15:15:04krux02that also does work
15:15:21krux02but newline in the strings from arbitrary sources I am not so sure about that
15:15:35stisaTiberium: I think it should work in a `static:` block
15:15:48Tiberiumstisa, ah, let me try
15:16:23krux02Tiberium, stisa well in a static block you can generate NimNodes, but you can't do anything with them there
15:16:31Tiberiumso something like static: let api = parseJson(staticRead("objects.json"))
15:16:32Tiberium?
15:17:05krux02Tiberium, that should work
15:17:23krux02but you still have to call a macro somewhere that generates the actual procedures
15:18:16Tiberiumkrux02, compiler says "lib/pure/lexbase.nim(155, 13) Error: VM is not allowed to 'cast' "
15:18:43krux02well then you are out of luck :(
15:18:53Tiberiumkrux02, "lib/pure/lexbase.nim(155, 13) Error: VM is not allowed to 'cast'<newline> L.buf = cast[cstring](alloc(bufLen * chrSize))"
15:19:41krux02that sucks
15:19:57*tankfeeder left #nim ("Leaving")
15:20:40krux02what you still can do is write a file that parses the json at runtime and prints an actual source file
15:21:14Tiberiumhmm, there's https://github.com/cjxgm/jsonob
15:21:23krux02and then you can do staticExec("nim c -r generateApi.nim", cache="true")
15:21:36krux02that is much more classical code generation
15:22:00krux02then you don't have nimnodes, but a textfile you generate
15:22:28Tiberiumyeah, I know
15:24:19krux02(waring very experimental) maybe you can find an easy transformation rule that allows te transform the json with regular expression replace into something the nim compiler does understand
15:25:21krux02then you would not need a json parser anymore
15:25:42Araqsome procs of marshal.nim are available at compiletime
15:25:49krux02you could include the transformed json in your nim file and have a representation that is parsed already from the nim compiler
15:25:51Araqand marshal uses JSON, so there.
15:26:37Araqthat said, I would use staticExec
15:27:17Araqits caching feature is just unbeatable for quick compiletimes. otherwise you do this complex compile time transformation over and over again
15:28:41Araqthe VM is for macros, macros are for AST to AST transformations, not for Json to AST transformations
15:30:09Araqand your Json to AST tool doesn't have to use string concats to generate Nim code, import compiler/ast, compiler/renderer and let the compiler API do its job
15:32:02TiberiumAraq, can I find some docs on those?
15:33:38Araqno but the compiler's AST is the same as in macros.nim
15:33:48Araqexcept that nnkX becomes nkX
15:35:01Araqfor reasons that excape me there is no macro to transform Nim code into compiler/ast construction
15:46:04TiberiumI have to wrap my head around macros and all the AST stuff until I can do something like auto-generation...
15:48:54*yglukhov joined #nim
15:53:02*yglukhov quit (Ping timeout: 246 seconds)
15:56:24Araqwell you can also just interpret the json at runtime
15:57:35TiberiumAraq, thanks for all answers! there's a a newbie question again: how can I do "512 & somenumber" like in c? bitwise and
15:58:14*nsf quit (Quit: WeeChat 1.7)
15:58:46Tiberiumah
15:58:53TiberiumI thought I need to use them in if'
15:58:55Tiberiumbut it doesn't work
15:59:03Tiberiumonly as additional variable
15:59:09*Guest28837 quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
16:00:10Tiberiumbut no
16:00:58Tiberiumso how can I use something like in c: " if (x & 512) {stuff} else {another stuff}"
16:01:44Tiberiumah, nevermind
16:03:05def-!= 0?
16:03:15def-there is no implicit int to bool conversion in nim
16:04:17*vlad1777d quit (Ping timeout: 258 seconds)
16:15:21krux02Tiberium, when you want to check for bits in integers, maybe the set is the more ideomatic nim way to do the same thing
16:15:39krux02at set is basically a bitmasked unsigned integer
16:15:52Tiberiumkrux02, can you tell me more?
16:15:52*brson joined #nim
16:15:54krux02it's not a hash set
16:16:17krux02well very often integers are used to enable flags
16:16:21Tiberiumyeah
16:16:23Tiberiumin my case too
16:16:27krux02for a nice c api
16:16:47krux02glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
16:17:19krux02so when you put all your flags into an enum
16:17:32krux02you can use set[MyEnum] instead
16:17:33*vlad1777d joined #nim
16:17:44*libman joined #nim
16:17:58Tiberiumkrux02, so I will need to check for every enum vs my integer value?
16:18:45krux02Tiberium, well the idea is that you then convert everything to the set, where you mean the set, and you don't work with integers anymore
16:20:41krux02and your example " if (x & 512) {... " would become "if enumValue in x: ..."
16:20:58Tiberiumkrux02, for example I have a enum like type Flags = enum unread=1, outbox=2, replied=4, important=8, chat=16, friends=32, spam=64, deleted=128, fixed=256, media=512 . And I've got a int 1+4, so it will set unread and replied flags
16:21:52Tiberiumkrux02, ah
16:21:55Tiberiumkrux02, thanks :)
16:22:06krux02well then you should remove the assignments in your enum
16:22:47krux02and then you can check what echo(int({unread,replied})) prints
16:23:03krux02(should be 5)
16:23:55SentreenIs it possible to return an anonymous proc from within the body of a template? I'm trying to do something like this:
16:23:57Sentreentemplate lazy* (s: untyped): untyped =
16:23:59Sentreen proc [T](): T = s
16:24:43SentreenSo the template should just wrap the expression s in a function, so I can delay execution.
16:25:36krux02sorry in that case you would need a cast[int](...)
16:25:43krux02but I just tested it, it works
16:25:55krux02http://ix.io/pe8
16:26:26krux02Sentreen, yes that is possible
16:27:11krux02Tiberium, this C patters has become a language feature in Nim and is called set ;)
16:27:22Tiberiumkrux02, it says Type mismatch: got (int, Flags)
16:27:25krux02s/patters/pattern/
16:27:50krux02Tiberium, well without code C can't help
16:28:01Sentreenkrux02: That code gives me an identifier expected error though, on the proc that I am returning. I should have specified that
16:28:44krux02Sentreen, well can you create a paste on something that I can execute?
16:29:29krux02I mean I can't help, not C
16:30:12Tiberiumkrux02, like this https://glot.io/snippets/eoajwn1c1x
16:32:46Sentreenkrux02: http://pastebin.com/Y8FXH2fE
16:34:11krux02if unread in cast[set[Flags]](3):
16:34:20Tiberiumoh ok
16:34:37krux02Tiberium, but try to do it without cast
16:34:57krux02I mean actual code
16:35:08krux02for doodling around and testing limits this is fine
16:36:13vivusis there an example of using this proc from the 're' lib: proc find(s: string; pattern: Regex; matches: var openArray[string]; start = 0) ?
16:36:51Tiberiumkrux02, but it doesn't work without cast, hm
16:37:16vivusor better yet, if somebody could explain to me what I should/can insert into these proc-examples
16:38:33vivusfind("somestring", "some", matches, 0 ) ??
16:38:53AraqSentreen: just give the proc a name and have that name the return expression of the template
16:39:19Araqthe proc should be annotated as {.gensym.}
16:40:40vivusor do I need to instantiate an openArray before naming it in find() ?
16:42:05vivushere is my basic code: https://www.zerobin.net/?706d126f3817d415#wAcDGxijsnhl8n5eBuO5Oc+zeEkItjSZJfGDQwQEjrk= ?
16:44:10*Trustable joined #nim
16:48:37Sentreen@Araq, like this?
16:48:39Sentreentemplate lazy* (s: untyped): typed =
16:48:41Sentreen proc wrapper [T](): T {.gensym.} = s
16:50:32SentreenActually returning wrapper in that context doesn't seem to work. Using it like this results in a "has no type (or is ambiguous)" when I actually make a lazy value
16:50:53krux02well I found out the lazy templates doesn't work, because nim does not parse a proc() ... as a lambda expression
16:51:06krux02http://ix.io/peb
16:51:10krux02this one does work
16:51:45krux02I could also create the lambda expression manually
16:54:25vivuswow, its like I'm fighting with the documentation at times
16:54:56Sentreenkrux02: that seems to work, thanks a lot!
16:55:07SentreenI should dive into the macro documentation to get a better idea as to why now :)
16:55:21*andris_ quit (Remote host closed the connection)
16:57:56krux02Sentreen, well you need to call echo ast.treeRepr a lot
16:58:21*Tiberium quit (Remote host closed the connection)
16:58:22krux02and sometimes very similar looking ast things look very different
16:58:34krux02I have to admit, macro development is not just write it down
16:58:41krux02it is a lot of try end error
16:58:50krux02but it is better that in almost any other language
16:59:09krux02because not nice it much better than not at all
17:01:10SentreenOkay, that makes it more clear :). The only thing I don't get is why you need to create the `let foo =` part and extract it later?
17:02:20*Nobabs27 joined #nim
17:02:29SentreenI agree that the macro system (from what little I've seen) seems to be pretty powerful. Though I kind of get the obsession lispers have with s-expressions after making a (relatively simple) macro
17:04:35vivuskrux02: how do I access the openarray here: proc match(s: string; pattern: Regex; matches: var openArray[string]; start = 0): bool {..} ?
17:05:10krux02Sentreen, the alternative is to create the syntax tree with NimNodes manually
17:05:26krux02with nnkLambda.newTree(...)
17:06:17krux02vivus, with matches[i] ?!
17:06:19dom96What we need is a library/module that builds on top of the macros module.
17:06:39krux02dom96, for what?
17:06:49SentreenOh right, because otherwise the parser gets confused with the proc, I get it now
17:06:51Sentreenthanks again!
17:06:52dom96To make building ASTs easier
17:07:34vivuskrux02: so in my match statement I write: var check = match(string1, regex1, matches) ?
17:07:37krux02dom96, I think it would be nice to have a getAst that allows to pass in a context
17:08:14krux02for example it is not possible to create expr colon expr without the context of a contructor call
17:08:30krux02sorry I mean quote
17:11:47krux02so that I can say myObjConstr.add quote nnkObjConstr do: `myIdent` : `mySymbol`
17:12:46krux02dom96, I don't think that another abstraction/different-view on how to generate syntax trees is going to help anybody
17:21:56demi-dom96: if you have a minute, i ran into what seems to be a nasty bug with nimble last night
17:23:49dom96demi-: sure, i'm here
17:26:10dom96krux02: Maybe you're right. From the top of my head `quote` definitely needs to be improved (maybe it has been already but the last time I used it it had issues).
17:26:50dom96It would also be nice to have some sort of aliases for different node kind's children so that AST code isn't just a bunch of indexes.
17:27:24dom96Writing node[0][4][i][2] isn't very clear
17:28:23demi-so i'm working with this package: https://github.com/samdmarshall/rune and this is what i'm seeing: https://gist.github.com/samdmarshall/778c2fdf7458769d8ac85608ca632481 (notice the diff between line 11 and 47)
17:29:09*zachcarter quit (Ping timeout: 240 seconds)
17:31:38dom96So it's srcDir = "src" vs. srcDir = "src/"
17:31:48dom96i.e. the `/` makes it fail?
17:31:57*Tiberium joined #nim
17:32:08demi-yeah
17:32:24demi-if you do a clear install of a package it fails in the same manner
17:32:57demi-the paths that get resolved in that stack-trace are identical except for the trailing slash on the directory name as well
17:33:44dom96Report it please. It sucks but it's not too serious. Do you agree?
17:34:04dom96(Feel free to link to the IRC logs in your issue)
17:34:18krux02dom96, well for me it turned out that I neve use those names, because they are not visible from treeRepr
17:34:33demi-ok, i spent an inordinent amount of time trying to figure out what i was doing wrong last night
17:34:54krux02dom96, anything that cannot be inferred from treeRepr I tend to just not use at all
17:35:02krux02for example all thos constructor procs
17:35:14dom96demi-: If Nimble fails with anything other than a NimbleError then that's a bug.
17:35:47demi-ok i'll open a new issue
17:35:55dom96krux02: Not sure what you mean. What "names" are you referring to?
17:36:03krux02I used to write those that were missing for my use case, and then eventually I tended to always use nnkStmtList.newTree(...) because I could do it consistently whit any node kind
17:36:59Araqthat might be a valuable advise. rather than adding more arbitrary AST constructors we could improve treeRepr's output to be more helpful
17:38:48dom96oh
17:38:57*dom96 just got what you meant
17:39:49dom96If `quote` gets significantly better we won't need constructor procs.
17:40:44krux02yes
17:41:10Araqwhat's wrong with 'quote'?
17:41:31dom96Maybe nothing today. I haven't used it in too long.
17:41:33krux02Araq, it always returns a stmtList
17:41:47dom96I can't remember the limitations I faced.
17:42:05krux02whenever I want to use it for something else I have to index into the result
17:42:07Araqyou know you can write your own 'quote', right?
17:42:15krux02let tmp = quote do: ...
17:42:25krux02tmp[1][2][3] ...
17:42:31Araqkrux02: gotcha.
17:42:59dom96Araq: Let's not encourage hundreds of 'quote' implementations.
17:43:02Araqbut again, write your own quote and once it's pleasant, contribute it back to macros.nim
17:43:15Araqdom96: not my point.
17:43:29Araqmy point is: it doesn't require compiler support.
17:43:46dom96Okay, so ask people to improve it.
17:43:48Araqthe current quote is only a builtin to make it faster to process
17:44:23Araqofc we never benchmarked it. zahary thought I would be concerned about compile times and so he added it as builtin
17:44:52krux02I wrote it earlier, but I thought of something like this: quote nnkObjConstr do: a : `someValue`
17:45:22krux02and I think that one does compiler assistence
17:45:36krux02because the argument would not be parsable without giving context
17:46:38Araqmacros.quote doesn't parse anything either
17:46:39dom96Why does it need the 'do' keyword btw?
17:47:01Araqdom96: because of a grammar deficiency. already on our roadmap, remember?
17:47:43dom96I must be missing something, it doesn't take two stmtLists, does it?
17:49:36*ludocode quit (Ping timeout: 240 seconds)
17:52:10krux02well currently I am very busy with fixing the emacs nim-mode
17:53:12dom96I would say that while there is room for improvement it's already good enough.
17:54:59*zachcarter joined #nim
17:55:41dom96So fixing it is low priority.
17:59:34*zachcarter quit (Client Quit)
18:08:20*elrood quit (Quit: Leaving)
18:08:46krux02reactormonk, what is nim-compile-command-checker-functions for?
18:08:57krux02it's undocumented and unused
18:09:05krux02and makes my life hard
18:15:00jivank_created a simple file server with jester https://github.com/jivank/nim-simplefilemanager/blob/master/simplefilemanager.nim
18:15:08vivusAraq: in a proc like this: proc match(s: string; pattern: Regex; matches: var openArray[string]; start = 0): bool {..} ... can you explain to me what this part means: matches: var openArray[string] ... or rather, what should I be adding into the proc for that option ?
18:15:13jivank_maybe it will become a manager in the future
18:19:07SentreenI'm trying to figure out why I get a `lib/system/profiler.nim(92, 23) Error: undeclared identifier: 'framePtr'` whenever I try to compile with profiler:on so that I can submit a proper issue report. However, I can't seem to reproduce this issue with a minimal example. Does anybody have any idea what I should look out for if I want to reproduce this (in terms of imports etc)
18:20:47jivank_dom96 is there some sort of lazy readFile?
18:20:58jivank_not sure if that would help though
18:22:02dom96jivank_: that is what async file essentially is
18:23:46reactormonkkrux02, I have no idea. :-(
18:23:55reactormonkdelete them and see what happens ^^
18:24:06reactormonk(make sure to restart emacs / unset the function)
18:24:27vivuswhere is the 're' library for nim hosted? I find nothing on github
18:25:01*nsf joined #nim
18:25:26dom96vivus: in the stdlib
18:27:36*brson quit (Ping timeout: 240 seconds)
18:28:42SentreenOkay, so for some reason --profiler:on does not work when there is a .nims file in the same directory as the .nim file you are compiling. There is already an open issue though
18:36:15vivusdom96: maybe you might be able to answer here: in a proc like this: proc match(s: string; pattern: Regex; matches: var openArray[string]; start = 0): bool {..} ... can you explain to me what this part means: matches: var openArray[string] ... or rather, what should I be adding into the proc for that option ?
18:37:27dom96var matches: array[MaxSubpatterns, string]
18:37:34dom96IIRC
18:38:03vivusdom96: so I need to explicitly create an openArray ?
18:38:11dom96We have the whole regex spec in the documentation for 're' but no actual examples of the module...
18:38:27dom96vivus: yeah.
18:38:36krux02reactormonk, that is what I am doing
18:38:45vivusonce I can figure it out, I will gladly add examples to all the libs I am using
18:39:01dom96vivus: that would be brilliant :)
18:39:02krux02it seems to be complicating things unnecessarily
18:39:39*dmi0 joined #nim
18:40:18krux02how does the project structure of nim projects really work
18:40:39krux02I mean when I have a project, how do I detect it, and how do I compile it?
18:40:43dom96vivus: If you do please make the examples short. Similar in style to the ones in: https://nim-lang.org/docs/httpclient.html
18:41:14vivusdom96: within a proc, what is the difference of saying proc foo(s : string, box: var openArray[string]) ? why does box get "var" ?
18:41:28dom96There is far too many "Large example"-style examples. For example here: https://nim-lang.org/docs/db_mysql.html#examples (there are also some nice short examples here too though).
18:41:37krux02nim-mode has currently logic to detect the project/project.nim but then still uses the current buffer-file-name as argument for nim build
18:42:01Tiberiumwaaait, simple social network bot which connects to long polling endpoint and pulls events, and sends message back to user (if user've sent a message) - 80kb stripped and upx'd
18:42:02*Matthias247 joined #nim
18:42:03Tiberiumjust WOW
18:42:28dom96vivus: The proc 'foo' is able to modify the `box` parameter
18:42:53dom96Tiberium: Nice. But why are you paying so much attention to the size?
18:43:00vivusdom96: in principle, I prefer examples over the specs provided below said-examples. to 'see' actual code helps a lot more than reading specs, IMHO
18:43:13dom96vivus: I agree.
18:43:15Tiberiumdom96, because you can't simply distribute a program in python for example
18:43:19Tiberiumit will be huge
18:44:08vivusTiberium: isn't python universal on most OSes? you could distribute just the script
18:44:17dom96vivus: Long examples are also not good because users are almost always looking for how to do a specific task.
18:44:20Tiberiumvivus, except for Windows :)
18:44:23dom96Scanning through a long piece of code is not easy
18:44:30Tiberiumvivus, and there's also need to install packages
18:44:36Tiberiumand users can have different python versions etc
18:45:26vivusdom96: what I think might work for the docs, (which is why I asked for where `re` is stored), is that the /tests/ for nim-code could be used as short examples. unfortunately, tre.nim had minimal tests for the procs
18:46:20dom96vivus: Some of them could be, yes.
18:46:59dom96Tiberium: Ahh. :)
18:47:15vivusI learnt that nifty trick when I was using a small lib written by 1 dude. not much example code, but quite a few tests showing his procs/functions at work
18:47:41Tiberiumdom96, I've started with social network bot in Nim because I've done it in Python already
18:47:50dom96I never think about the size of dependencies, more about their tendency to fail in incredibly annoying ways.
18:48:15Tiberiumhttps://github.com/TiberiumPY/LOLBot (sorry for russian language and off-topic)
18:52:13dom96Tiberium: Cool. Are you rewriting this in Nim? :)
18:52:22Tiberiumdom96, I want to :)
18:52:31Tiberiumso I will learn some Nim in process
18:52:52TiberiumBasically I already have working kernel of the bot
18:52:58TiberiumBut I'm not happy with the code
18:53:46vivusdom96: I think I mentioned it earlier, but a lot of Python coders see (or would like to see) Nim as the language they can move to, instead of Go
18:53:54dom96Tiberium: You'll be using async right? Let me know if you need any help
18:54:39Tiberiumdom96, firstly I'll try to make simple working synchronous implementation.
18:54:56Tiberiumvivus, personally I don't like error handling in Go
18:55:05Tiberiumit seems very...
18:55:12dom96vivus: I know I want that. But do a lot of Python coders really also would like to move to Nim?
18:55:54dom96Tiberium: Sounds like a good idea. You should be able to use the multisync macro to add an asynchronous implementation easily.
18:56:20Tiberiumdom96, I'll use only httpclient with json I think, so yes
18:56:43vivusdom96: its not something that should be optimized for, but if the syntax/features make it appealing for pythonistas to use nim, that wouldn't hurt the progression (instead of python programmers optimizing around cython, pypy, etc.)
18:58:40Tiberiumby the way, is 2 spaces or 4 spaces preferred in Nim?
18:58:50vivus2?
18:58:52Vladar2
18:59:10Tiberiumah, ok
19:01:07dom96Regarding Go error handling. I'm the same, I like exceptions.
19:01:18*hendi joined #nim
19:01:50euantorI don't mind Go's error handling, though it is repetitive
19:02:30euantorI like that you have to explicitly ignore an error, rather than simply missing it by not catching an exception that might get thrown
19:02:44dom96I prefer Nim's opt-in checked exceptions.
19:02:52federico3any lib to generate a gifs?
19:02:53euantorThough I also like the approach of using checked exceptions like java and Nim
19:04:35*athaudia quit (Ping timeout: 255 seconds)
19:04:53euantorUnchecked exceptions are the thing I dislike most about C#
19:05:43*athie joined #nim
19:06:22dom96federico3: not that I know of, what are you working on?
19:06:29*dmi0 quit (Ping timeout: 260 seconds)
19:06:53*brson joined #nim
19:08:33Araqeuantor: huh? it's easy to call function() in go and ignore the return value(s). right?
19:08:46AraqI never heard of it having Nim's explicit "discard"
19:08:49euantorYes, but if you want a return value, you have to ignore the error
19:08:55federico3dom96: a couple of useful and some toy projects
19:09:06euantorSo if a function returns (x, error), you have to discard `error` (using `_`)
19:09:22euantorWhich is the only good thing about their error model
19:09:35federico3generating a little gif animation
19:10:49Araqso it's easier to ignore errors than exceptions, got it :P
19:11:24Tiberiumis it fine to have two http clients in two modules of one app, or I can reuse them?
19:11:49euantorIt's easy to ignore unchecked exceptions at the low level where they should be handled and to let them propagate to a too high level to handle them properly
19:12:25euantorEG: ignore an exception in a library used by some other library and don't catch it until the main app, by which point you can't take proper corrective action in some cases
19:12:30dom96Tiberium: It's fine, but you can reuse them.
19:13:29*michael_campbell quit (Quit: ZNC 1.6.1 - http://znc.in)
19:16:19*tankfeeder joined #nim
19:16:25*tankfeeder left #nim (#nim)
19:16:26Araqeuantor: never seen this happening.
19:16:46euantorLucky you ;)
19:16:59Araqit's mostly a semiconscious process of getting shit done more quickly :P
19:17:21euantorI've seen it all too many times in poorly programmed C# libraries
19:17:45Araqand Java's model is just "ok, I'm logging this exception here"
19:17:54euantorUsually by people who came from writing old VB6 code, then went to vb.net, then to C#
19:17:58Araqso everything in Java depends on a logging framework
19:18:09euantorWhich our company has had a couple of
19:18:30AraqI think logging is a disease.
19:19:09euantorI think it has its place
19:19:29euantorBut again, I think it depends on what kind of software you work on most of the time
19:19:54euantorWrite what works best for your scenario, and hope that it works
19:20:25Araqit's over used and doesn't come with any kind of policy. so, ok your log has 4000 errors. when will somebody look at it? what does it mean? is it 4000x the same error? is it a bug or a real error?
19:21:09Araqif it's important data, why is it in a textfile? shouldn't it be structured data that was put into a database instead?
19:21:26euantorWhat if you're logging that your DB's broken?
19:21:36euantorGood luck putting that in the DB :)
19:21:46Araqthen you fix your DB.
19:21:47euantorAgain, do what works best for your scenario
19:22:02Araqwhat if the logging IO operation fails? how do you log that?
19:22:04euantorAnd if it's on a remote machine you have no physical access to in morocco?
19:22:09Araqsame problem, logging doesn't solve it.
19:22:20Araqyou use a DB that's local.
19:22:26euantorNo, but at that point your pretty much screwed
19:22:44euantorThe DB is local t the machine that's deployed, it's an embedded system that cannot touch the internet
19:23:05euantorAnyway, I would say we're going off topic a bit and I don't want to argue
19:23:32vivusso I tried this: var check = match(string2, regex2, matches: var openArray[string]) and got this error: regex.nim(9, 38) Error: invalid expression: 'matches: var openArray[string]'
19:24:25*sz0 quit (Quit: Connection closed for inactivity)
19:26:36Araqvivus: var matches: array[10, string]; let check = match(s, r, matches)
19:27:48vivusAraq: so you have to define an array of a fixed size ?
19:28:05Araqyou can also use a seq, but why bother
19:28:24Araqyou should know your pattern and the number of captures in it
19:28:36vivusAraq: when I run the regex to match, I'm not sure how many I will get (consider the data hostile)
19:28:46Araqthat's not how it works.
19:30:14Araq r(\w+)=(\w+).* matches a=b;c=d but matches only captures a and b
19:30:34Araqyou get the c=d part the next itereation
19:30:59Araqwith the starts int parameter or whatever it's called.
19:31:05vivusAraq: so as a rule of thumb, should the array size be the size of the database rows?
19:31:31Araqas a rule of thumb you shouldn't use regexes.
19:35:52*ludocode_ joined #nim
19:46:34krux02args, I made tea for myself, but someone before me abused the container for coffee, now the tea smells horribly like coffee
19:46:38Tiberiumthis is that I've written for my bot: https://gist.github.com/TiberiumN/96b252808798af7656d05f2412c0c489
19:46:49TiberiumI'm still not happy with that JSON stuff :(
19:47:17Tiberium(and, be aware, I started learning nim only ~3 days ago)
19:47:38krux02Tiberium, well yea but you have experience programming
19:48:12Tiberiumkrux02, but not in compiled languages :)
19:48:19krux02for me learning nim was mostly learning syntax, and a few new concepts here and there
19:48:48TiberiumActually Nim feels like dynamic language sometimes - you don't need to put types everywhere
19:48:52Tiberiumand compiler is very smart
19:48:52krux02Tiberium, well compilation is only a mental thing
19:49:09krux02the boundary between compiled languages and interpreted ones in blurry
19:49:15krux02in the middle in julia
19:50:05TiberiumI have a question - how I need to format long definitions of object instances (like MessageUpdate in mainLoop() in main.nim)
19:50:18TiberiumThe way I've formatted it, or there's another styling preferred for Nim?
19:50:18krux02and python also has the preference to poop pyc files everywhere but still likes to call itself interpreted :P
19:51:18dom96MessageUpdate(
19:51:20dom96 foo: 42
19:51:21dom96)
19:51:40Tiberiumdom96, ah, ok
19:51:40dom96Also, you should put all your types under one type section
19:51:43vivuswell my code compiles and runs, but my regex is not loved :P
19:51:50Tiberiumdom96, thanks
19:52:24dom96Tiberium: Why aren't you happy with the JSON?
19:52:28krux02Tiberium, the types in one type section has the advangage that within one type section the types can reference each other
19:52:39Tiberiumdom96, I thought it's a bad code
19:52:46krux02with different types sections you can only reference previous types
19:52:59Tiberiumbut yeah, I know that processing JSON in compiled languages is hard
19:53:17dom96Does this work? event.extract(_, msgId, flags, peerId, ts, subject, text, attaches)
19:53:27krux02this is horrible this tea just smells like coffee, think I have to throw it out, I can't enjoy it :(
19:53:47dom96Didn't realise `_` could be used like that. Did I accidentally implement this or did somebody else explicitly implement support for this feature?
19:53:54Tiberiumdom96, it works for me via unpack package?
19:54:13TiberiumI've also used this underscore in Python
19:54:17demi-i've used that in nim a bunch
19:54:29demi-as a "discard this element because i don't want it"
19:54:37Tiberiumin python it may be _, _, useful_data, _ = some_tuple
19:54:49dom96unpack package?
19:54:51Tiberiumyeah
19:54:54dom96got a URL?
19:54:56Tiberiumbut wait
19:55:26dom96Yeah, I am aware that it works for tuple unpacking
19:55:49dom96But this is as a proc param
19:55:52*Trustable quit (Remote host closed the connection)
19:56:00demi-O_o
19:56:06dom96or maybe, extract is a template?
19:56:18Tiberiumdom96, oh wait
19:56:21vivusAraq: did I get the formatting wrong: var reg2 = re"<a href=\\.*? style=\\.*?\\>.*?<\/a>" ?
19:56:25TiberiumIt's a macro that I've copied
19:56:33TiberiumSecond answer here - http://stackoverflow.com/questions/31948131/unpack-multiple-variables-from-sequence
19:57:06dom96vivus: Tony the Pony is coming.
19:57:27dom96Why are you parsing HTML using regex?
19:57:35dom96Use htmlparser
19:57:40TiberiumAnd in what order I should define variables? constants first, then let's, and after that typical vars?
19:58:05vivusdom96: because this is what I am looking for in the DB :) specific patterns of text
19:58:32Tiberiumby the way: it would be a nice small addition to have automatic url encoding in httpclient
19:58:55Tiberiumand possibility to pass query parameters :)
19:58:58dom96vivus: hrm, alright. Does that snippet not compile?
19:59:24*rauss quit (Ping timeout: 260 seconds)
19:59:28vivusdom96: it compiles and executes. I can show you the full code if you are interested?
19:59:35dom96Tiberium: That would be a nice addition to the uri module (if it's not already in there). PRs encouraged :)
19:59:49dom96vivus: I guess it doesn't give you the result you expect?
20:00:05dom96What pattern should that be? The `\\` look suspicious to me
20:00:22vivusdom96: it shows me the else part of my if/else (which is fuark :) )
20:00:48dom96Tiberium: The order only matters in the global scope in my opinion.
20:01:08*rauss joined #nim
20:01:14vivusdom96: <a href=\"http://somesite.net/\" style=\"text-decoration:none;color:#676c6c\">Link</a>
20:01:18dom96Tiberium: And for that case the order you mentioned sounds alright
20:02:02dom96vivus: I'm a bit lost now :)
20:02:16vivusdom96: do you use sublime text?
20:02:26dom96nope
20:02:34dom96VS Code mostly nowadays
20:02:41vivusdo you use any text editor that does regex checking?
20:02:55dom96Never seen that in a text editor
20:03:26vivusI am 99% certain my pattern matches. verified it as well
20:06:08*zachcarter joined #nim
20:06:09dom96vivus: are you using the find or the match proc?
20:06:15vivusmatch
20:06:24TiberiumAnd what's preferred max line length in Nim?
20:07:43demi-i think that is personal preference
20:08:03demi-but there is very few things that yield long lines in nim
20:08:07dom96vivus: try 'find'
20:08:41dom96Max len is 80 for the stdlib/compiler
20:10:18vivuslots of code mods dom96 :P now the mind is tired :P
20:11:06dom96Araq: Any chance you could give https://github.com/nim-lang/Nim/issues/5589 a look?
20:20:08AraqI replied.
20:21:06AraqI don't look into bug reports that make me write my own programs with my own test data which may result eventually in the same reported wrong behaviour.
20:21:21krux02./koch tools -> Error: cannot open 'tools/nimsuggest/nimsuggest.nim'
20:21:30Araqkrux02: nim c koch
20:22:03krux02ok thanks it works now
20:24:33dom96Araq: What do you mean? The bug report includes source code.
20:27:30*hcorion joined #nim
20:29:21vivusAraq dom96 here is the type of situation I am dealing with: https://www.zerobin.net/?593b3c78b10da57a#UOjWAxOudKUEZzyENzqXWdc/GpuJirr2sW+lRRov+e8= . fully working example
20:29:48Araqdom96: sorry, I really missed that then :-)
20:30:20dom96vivus: Did you try 'find'?
20:30:31vivusdom96: yep, same problem
20:30:46dom96did you try getting rid of the '\\'?
20:31:40krux02well nim-mode shows this: Error while checking syntax automatically: (error "Server may raise an error. Use \"M-x epc:pop-to-last-server-process-buffer RET\" to see full traceback:
20:32:04krux02and this process buffer shows this: Process epc:server:5 finished
20:32:12krux02the server just dies
20:33:34vivusdom96: yep, that too. my mind is doing a SEGFAULT now :P
20:36:24vivusdom96: the non-matching doesn't make sense to me because nim supports PCRE
20:37:36*rauss quit (Quit: WeeChat 1.7)
20:38:24dom96vivus: this seems to work: <a\ href=.*\ style=.*>.*<\/a>
20:38:30dom96The spaces need to be escaped, weird.
20:38:34dom96Maybe there is a re option for that
20:38:45vivusheh
20:38:52dom96(The best way to figure out what's going on is to reduce the regex pattern until it does work)
20:40:23vivusdom96: can you copy/paste your code in zerobin please?
20:41:14dom96I hope gist is fine: https://gist.github.com/dom96/091bc3e8526844e7f6bdcc4bb1aa3083
20:42:30krux02well the best way to test regular expressions, is with eithe vim the / (search) or in emacs with re-builder
20:42:58krux02not default vim I guess
20:43:08krux02maybe neovim highlights all matches
20:43:30vivuskrux02: sublime supports it also
20:44:16krux02all you need is to have highlighting of all matches and a fill with all cases you want to cover
20:44:40krux02then you can realtime edit the regular expression and see how the highlight changes
20:44:49dom96That doesn't help in this case
20:45:00dom96Unless vim/whatever follows the same rules that 're' does
20:49:44krux02what does epc stand for?
20:50:26vivusno idea what is going on with re now.
20:51:54vivustrimmed it down to: var reg2 = re"<a.*>.*<\/a>"
20:54:05krux02I really feel a bit stinding in the rain, when I want to fix problem with nim mode
20:54:47dom96PMunch: I submitted your article (I think it's yours at least) to HN, hope you don't mind :)
20:58:45TiberiumIs it fine to have one types.nim file?
20:58:54Tiberiumso all types are stored there
21:00:17Tiberiumit doesn't work for me for some reason...
21:00:45krux02Tiberium, it should be
21:00:46dom96Sure it's fine. But do whatever works.
21:00:52vivushow are you importing?
21:00:58Tiberiumvivus, at the top of the file
21:01:01Tiberiumimport types
21:01:06Tiberiumshould I include instead?
21:01:40TiberiumI have 3 files, main.nim, types.nim, api.nim main.nim imports types.nim and api.nim, api.nim imports types.nim
21:02:11dom96So a basic version of my little snake game is working: http://picheta.me/snake/
21:02:16dom96Let me know your thoughts :)
21:03:09Tiberiumdom96, very nice game
21:03:17TiberiumI played up to 10 score
21:03:21Tiberiumah
21:03:23Tiberiumit's endless
21:03:48dom96Yeah, maybe i'll add other levels in the future
21:04:30dom96Glad you think it's nice :D
21:04:37Tiberiumso for some reason compiler can detect that I've imported type, but can't detect it's field
21:04:38Tiberiumhm
21:04:41krux02it.s a bit easy
21:04:52dom96Tiberium: Did you export the field?
21:05:03Tiberiumdom96, I didn't export, I just exported objects?
21:05:12dom96Tiberium: You need export each field as well
21:05:27dom96krux02: Snake typically is in the early game
21:05:41dom96krux02: But i'm open to ideas on how to make it more challenging earlier
21:05:50vivusnice game
21:05:52Tiberiumdom96, so place a star for every field?
21:05:54krux02yes it's cool
21:05:58krux02it easy and fun
21:06:05dom96Tiberium: yeah
21:06:12dom96Tiberium: field*: string
21:06:16TiberiumI understand
21:06:25vivusthe most clear example for snake would be for making the snake go faster after each bob it eats
21:06:34Tiberiumdom96, do I need to do the same for enums?
21:06:40Tiberiumthanks god no
21:06:42dom96vivus: Yep, that's what happens.
21:06:55vivusdoesn't feel like it got faster
21:07:06dom96vivus: Maybe I made it a bit too subtle
21:07:15dom96But it definitely gets faster
21:07:24krux02snake always reminded me of the game I played when I was very young: http://s.uvlist.net/l/y2012/01/92323.jpg
21:07:38dom96It moves every (200ms - score)
21:08:11krux02it's basically snake with nondeadly walls keys doors traps and different things to collect
21:08:25dom96krux02: cool, never seen it before.
21:08:39krux02well it is also hard to google for it
21:08:51krux02it's called VEGI and exists only in German
21:09:04krux02but in that game language doesn't really matter
21:12:08hcorion@dom96, small bug, but I'm sure your aware, sometimes the fruit will spawn on the snake, so you can't see it
21:12:18krux02it's basically a lost game
21:12:22hcorionScore of 50 btw
21:12:36dom96Yeah, will fix that :)
21:13:33krux02reactormonk, when you are still online, you can merge my pull request in nim-mode
21:13:50krux02or check if you are ok with the changes
21:14:02dom96I can't remember my high score but I definitely got to at least 80.
21:14:34dom96Source code here in case you want to see how it's implemented: https://github.com/dom96/snake
21:15:48*_apg joined #nim
21:15:50XeWhy does the {.procvar.} pragma exist?
21:15:55Xeprocvar pragma
21:15:56XeThe procvar pragma is used to mark a proc that it can be passed to a procedural variable.
21:18:15dom96Xe: https://irclogs.nim-lang.org/15-09-2016.html#18:02:52
21:18:50dom96And related issue https://github.com/nim-lang/Nim/issues/2172
21:19:09dom96There was a more recent discussion about this as well but I can't find it
21:20:04*hendi quit (Quit: Connection closed for inactivity)
21:22:33Tiberiumhow can I catch SIGINT and SIGTERM?
21:22:40Tiberiumto end my app gracefully
21:22:52dom96A nice project might be using markov chains on the IRC logs to answer Nim questions
21:23:21dom96Tiberium: https://nim-lang.org/docs/system.html#setControlCHook,
21:23:43krux02dom96, that is how I feel when I enter the #emacs channel
21:24:02krux02they do it
21:24:16dom96they use markov chains?
21:24:44krux02I don't know if they use markov chains, but just do /join #emacs and ask a what is question
21:26:18Tiberiumhaha
21:27:13dom96I tried :P
21:27:48*kier quit (Remote host closed the connection)
21:28:03hcorionVery cool
21:28:29dom96hcorion: https://github.com/nim-lang/nimbot
21:28:32dom96Help welcome :)
21:29:02*kier joined #nim
21:29:07vivusdom96: if you can create a tar.gz dump of the logs until end-2016, someone might be able to work on that
21:30:02vivusthe problem with answering a question on IRC is "where does the answer end?"
21:30:13Tiberiumwait, does nim ssl module depends on system openssl library?
21:30:18Tiberiumor it's embedded into binary?
21:30:33dom96vivus: They're available online in JSON-ish format: https://irclogs.nim-lang.org/04-02-2017.logs
21:30:50dom96Tiberium: System openSSL unfortunately
21:31:01Tiberiumdom96, ah, dynamic loading
21:31:26krux02NimBot, how are you?
21:31:32krux02hmm
21:31:32TiberiumNimBot, hi
21:31:49krux02NimBot doesn't seem to respond very well
21:31:52vivusNimBot: sudo rm -rf /
21:32:07dom96!ping
21:32:07NimBotpong
21:32:10dom96!lag
21:32:10NimBot1ms between me and the server.
21:32:31vivus!nimble
21:32:43krux02!beer
21:32:46dom96That's about all the commands it knows really
21:32:57dom96Adding a dictionary would be easy (hint hint)
21:33:11vivus!ping
21:33:11NimBotpong
21:33:31krux02well I know that the emacs bot get's updates from the channel
21:33:33hcorionSure is good at ping pong
21:33:43krux02when the bot doesn't know something they can tell him
21:34:13dom96Yeah. It's a simple "dictionary" feature
21:34:31dom96You could implement a !set command for NimBot
21:34:37dom96!set nimble Nimble is awesome
21:34:41dom96!nimble
21:34:44dom96>Nimble is awesome
21:34:55hcorionBut only allow certain people to set it
21:35:26dom96of course
21:35:44vivusam I allowed to write the IRC bot in python for the nim channel?
21:35:52Xeno
21:35:59Xethat goes against the point of it
21:36:05dom96Why would you?
21:36:21hcorionThere is already a nim bot written in Nim
21:36:23vivusshipping to market
21:36:32vivusMVP :P
21:36:35dom96Extending NimBot should be trivial
21:36:55krux02the bot should detect what is questions
21:36:57hcorionYeah, nice clean code
21:37:08hcorionWhat is love?
21:37:18vivusthere is an easy way to achieve what dom96 said without using intense mathematics/deep-learning
21:37:22krux02how do I compile nimsuggest in debug mode (with stack traces)?
21:37:48dom96nim c nimsuggest isn't possible?
21:37:49vivusthe bot just needs to detect when a question is asked
21:38:09krux02I build nimsuggest with koch
21:38:40dom96And it needs to reply to hcorion's question with "Baby don't hurt me"
21:38:58dom96That feature is a must :)
21:39:33dom96But honestly, writing an IRC bot in Nim should be a breeze
21:39:34hcorionWith emojis!  Baby don't hurt me 
21:39:40TiberiumIs there any example on plugin system for nim? I'd like to set-up something like handlers for an event, and then activate this event from main loop, so plugins will process it?
21:39:46dom96hcorion: OOOH YES :D
21:40:05vivusuntil your bot needs to actually detect when this "?" is used
21:40:18dom96Tiberium: You mean you want to load pre-compiled plugins at runtime?
21:40:29krux02well my font doesn't have those emojis
21:40:32Tiberiumdom96, no, no, I will compile them all at the same time
21:40:40vivusnor mine krux02
21:40:45XeTiberium: why not compile them into the app then?
21:40:50hcorionYou should get better fonts
21:40:56TiberiumXe, I'm asking how to do this better
21:40:57krux02but I can do this: ✔✘†€‣♠♥♦⊂∫∀∈∃∀∈∃Σ√ΛℂΩ×ιαοωχεακψλχοηπβσj{`}/{([]^…_›[₁₂₃♀♂♀⟨⚥⟨₀⟩∅∝∞∥∡→∨∧⊥∡∥∨∧⊥∡∧⊥∡¹²³›³›¢›‹¢‚‘
21:41:16XeTiberium: why do you think that loading .so files is better than loading the final binary?
21:41:30TiberiumXe, nooo
21:41:31vivusXe: how is your regex?
21:41:43krux02aren't so files just binaries?
21:41:45Xevivus: (not!good)
21:41:45TiberiumXe, I mean, I will compile all plugins with the main app, so they'll be in one binary
21:41:53vivuswas worth a try :P
21:41:54Xeoh i see waht you mean
21:42:16dom96Tiberium: Well... I'm not sure there is any examples of that.
21:42:36dom96If you show how you would implement it in Python I might be able to help
21:42:59jivank_by default --gc:markAndSweep is used?
21:43:15XeTiberium: https://github.com/Heartmender/sobot/blob/master/modules/hello.nim https://github.com/Heartmender/sobot/blob/master/src/command.nim friend of mine got this far, but ended up ditching this idea
21:43:58dom96jivank_: nope
21:44:10XeTiberium: you want something like this though right? https://gist.github.com/Xe/382817a00026f5eb68554c482c946e83
21:44:29TiberiumXe, yeah
21:44:49TiberiumXe, so my plugins will subscribe to commands or some other events
21:45:34XeTiberium: you need some kind of "default" global bot command demux or something
21:45:43Xekinda like how Go's net/http.DefaultServeMux works
21:49:07dom96jivank_: I asked Araq earlier to look into your issue and I think he will once he gets a chance.
21:49:39dom96oh would you look at that. My HN submission is on the front page :D
21:50:26hcorionWhich one?
21:51:03dom96Check the front page and you'll see
21:51:09hcorionhttp://serv.peterme.net/devlog/cross-platform-guis-and-nim-macros.html
21:59:04vivusI'm calling it now, someone in an HN comment will say "wow, what a cool language, never heard of nim before"
21:59:12hcorionIssue for automated responses for nimbot: https://github.com/nim-lang/nimbot/issues/13'
22:00:56dom96hcorion: Nice! Thanks :)
22:01:24dom96vivus: hah yes.
22:02:19jivank_dom96 thanks! , i tested your devel branch but the results seemed similar to the ones i just posted to the issue, is that the asyncfile gc bug you talked about yesterday?
22:02:34dom96Somebody submitted John Novak's blog post as well and it's also on the front page.
22:03:02dom96jivank_: Yeah. I'm pretty sure both are affected by the same bug.
22:03:14dom96Unused memory simply isn't freed.
22:03:25krux02hcorion, I just read the article, that is very interesing and I do like it
22:03:59krux02except that this site requires javascript so that I can read the blog
22:04:19krux02should not be a requirement
22:04:35dom96John Novak's blog post is nice too http://blog.johnnovak.net/2016/05/29/cross-platform-gui-trainwreck-2016-edition/
22:04:38dom96(Another Nim user)
22:04:45dom96Also, his blog looks awesome.
22:04:56Tiberiumis there a list on what packages from stdlib are support on JS target (not emscripten)?
22:05:21Tiberium*are supported
22:05:30dom96Tiberium: Not as far as I know.
22:05:36Tiberiumdom96, for example httpclient
22:05:59dom96I can probably name the modules which /do/ support JS
22:06:08dom96There isn't many
22:06:22dom96hrm, well no, maybe I can't
22:06:34dom96I was surprised a while back that deques worked fine
22:06:42dom96But httpclient doesn't support it
22:06:45dom96definitely
22:07:13hcorionDoes it work with emscripten?
22:07:24*vlad1777d quit (Remote host closed the connection)
22:07:27TiberiumI think httpclient isn't that hard to port to JS
22:07:38dom96hcorion: no idea
22:07:59dom96Tiberium: I don't think it can be fully supported (in the web browser)
22:08:06Tiberiumdom96, just simple get
22:09:12dom96That might be easy to get working.
22:09:29*brson quit (Ping timeout: 260 seconds)
22:09:33dom96I'll accept a PR implementing it
22:11:40*nsf quit (Quit: WeeChat 1.7)
22:13:22*brson joined #nim
22:32:33*bjz joined #nim
22:34:57*hcorion quit (Quit: Konversation terminated!)
22:37:13*Vladar quit (Quit: Leaving)
22:38:55*gokr joined #nim
22:39:30*Jesin quit (Quit: Leaving)
22:41:04Tiberiumis memory that massif reports - real memory usage of my app?
22:43:37*vivus quit (Quit: Leaving)
22:44:15Tiberiumit says my app (bot) used ONLY 20kb's of heap
22:44:21Tiberium(it's maximum value)
22:44:52*Jesin joined #nim
22:57:59*shashlick quit (Ping timeout: 256 seconds)
22:59:51*shashlick joined #nim
23:01:03*libman quit (Quit: Connection closed for inactivity)
23:09:12*adeohluwa joined #nim
23:16:43*vendethiel joined #nim
23:18:12*_apg left #nim ("rcirc on GNU Emacs 24.5.1")
23:25:03krux02dom96, maybe you can help me
23:25:17krux02what is the best pattern to detect a project root?
23:25:39krux02my projects are all customized with whatever works
23:25:51krux02but I don't know how to properly detect a project root
23:26:10krux02I need a project root specification
23:26:42dom96what do you mean by "project root"
23:26:44dom96?
23:27:27demi-this is about nimsuggest isn't it?
23:27:28krux02well I mean the important argument to pass to the nimsuggest process
23:27:33krux02demi-, yes
23:27:41krux02I try to fix nimsuggest for emacs
23:28:08krux02the current state of nim-mode is more like no maintenance anymore
23:28:30demi-it doesn't seem that difficult at all
23:28:38krux02well then you can answer me
23:28:53krux02at seems there are some weird patterns
23:28:58krux02project/project.nim
23:29:01demi-there is a directory that has a nim.cfg or .nimble file that is the top-most directory
23:29:10krux02project.nim + project.nim.cfg
23:29:16krux02project.nimble
23:29:43krux02well there can also be the project.nim.cfg
23:29:57*adeohluwa quit (Remote host closed the connection)
23:30:06demi-yeah there are 3 patterns, what is so complicated about this?
23:30:20krux02demi-, the question is, it that all?
23:30:27krux02what about nakefile
23:30:36krux02and project.nims
23:30:37demi-nakefile isn't a language supported thing
23:30:44demi-that is a third party project
23:32:36krux02demi-, what is with the nimscipt variant of nimble?
23:32:47demi-hm?
23:33:04demi-you mean nimble tasks?
23:33:30Tiberiumcan I output the name of the filename where exception happened? In except block
23:34:10demi-Tiberium: yeah, look at https://nim-lang.org/docs/system.html#instantiationInfo,
23:37:14*Tiberium quit (Remote host closed the connection)
23:41:51FromGitter<TiberiumPY> Thanks
23:44:35krux02didn't nimble once introduce the "new" format for package descriptions that was a .nims file?
23:46:21krux02well I got an answer, yes nimble has a nimscipt fromat but the file is still called .nimble
23:50:23dom96indeed
23:51:43dom96This project file business seems like it should just be handled by Nimsuggest
23:51:49zachcarterwewt frag has texture atlas / spritesheet support now
23:52:05dom96Assuming that the finding of this file always follows the same algorithm (and it seems it does)
23:53:57krux02args, it feels there are 20 different implementations of find project root in nim-mode
23:54:05krux02the code really is bad quality
23:54:33krux02dom96, well not really
23:54:56krux02dom96, when I need to find the root of a project manually otherwise nimsuggest doesn't work
23:55:32krux02dom96, nimsuggest want the project root as an argument otherwise it just doesn't do anything
23:55:35*rauss joined #nim
23:55:51*rauss quit (Client Quit)
23:56:07dom96but why couldn't nimsuggest find the project root on its own?
23:57:42*rauss joined #nim
23:58:36*yglukhov joined #nim