00:01:09 | * | elrood quit (Quit: Leaving) |
00:01:12 | FromGitter | <Varriount> Well, vtables are references to a dedicated object, which may or may not be a global |
00:02:41 | FromGitter | <Varriount> Anyway, if multimethods are taken away, there's no adequate substitute. |
00:02:42 | FromGitter | <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:59 | FromGitter | <Varriount> @brechtm Seems like a bug. |
00:07:36 | FromGitter | <brechtm> returning a string instead will always return nil |
00:08:13 | Demos | I think the idea would be to switch to single dispatch methods |
00:09:23 | FromGitter | <Varriount> @brechtm By the way, what are you using multimethods for? |
00:09:55 | FromGitter | <brechtm> @Varriount to see how I could translate that to using generics instead :-) |
00:10:50 | FromGitter | <Varriount> I don't follow. |
00:12:55 | FromGitter | <brechtm> @Varriount you didn't ask that in relation to the code snippet? |
00:14:31 | FromGitter | <brechtm> bug logged: https://github.com/nim-lang/Nim/issues/5599 |
00:18:20 | FromGitter | <Varriount> Hm, this is interesting. Generics don't seem to take into account procedure overloads defined after the generic. |
00:19:20 | FromGitter | <Varriount> @brechtm https://glot.io/new/nim |
00:19:32 | FromGitter | <Varriount> https://glot.io/snippets/eo9t5heq1k |
00:20:07 | FromGitter | <Varriount> I find it odd that the symbol has to be forced open with mixin, but w/e |
00:20:23 | FromGitter | <brechtm> @Varriount yup, that's what I came up with also |
00:20:33 | FromGitter | <brechtm> @Varriount but what's the mixin line for? |
00:21:04 | FromGitter | <Varriount> https://nim-lang.org/docs/manual.html#generics-symbol-lookup-in-generics |
00:21:14 | FromGitter | <brechtm> It seems I didn't need that line |
00:21:28 | FromGitter | <brechtm> But this was in my application, not in this sample code |
00:21:50 | FromGitter | <Varriount> It works without mixin if you rearrange the procedure implementation orders |
00:23:48 | FromGitter | <brechtm> Ah, the difference was that I didn't define inner(obj: Base) |
00:24:48 | FromGitter | <Varriount> Generics tend to work intuitively, except when they don't |
00:25:17 | * | Matthias247 quit (Read error: Connection reset by peer) |
00:25:18 | FromGitter | <brechtm> :-) |
00:26:45 | FromGitter | <Varriount> Actually, I wonder if @Araq would be willing to explain why symbols need to be closed at all. |
00:27:45 | Araq | proc complexAlgorith[T](x) = partOne(x); partTwo(x); partThree(x) |
00:28:02 | Araq | in what world do you want partOne() etc to be open? |
00:28:41 | FromGitter | <Varriount> One in which you want the user to supply an overload? |
00:28:53 | Araq | it's not part of the contract of 'T' to have a partOne proc, it's an implementation detail |
00:29:07 | Araq | hence you want it "private" aka "closed". |
00:29:29 | FromGitter | <Varriount> @Araq Yes, but in the posted snippet, the generic wasn't considering the implementations defined after it |
00:29:53 | Araq | so? |
00:30:59 | FromGitter | <Varriount> So, I'd consider the generic symbol lookup to consider the entire module, since a module usually contains an entire implementation. |
00:32:04 | Araq | why? Nim doesn't consider the entire module at all. it requires forward decls. |
00:32:48 | Araq | you can argue that forward decl suck but you cannot argue that it's inconsistent behaviour. |
00:33:16 | FromGitter | <Varriount> No, just unintuitive for people coming from other languages. |
00:34:20 | Araq | *shrug* what isn't. |
00:34:36 | Araq | everything is always confusing for programmers. |
00:35:47 | FromGitter | <Varriount> I wonder what Swift does |
00:36:18 | Araq | it considers the class context, what else. |
00:36:53 | Araq | but Nim has no class context :P |
00:37:04 | FromGitter | <Varriount> It does have module context though. |
00:42:06 | * | themagician quit () |
00:45:13 | FromGitter | <Varriount> Araq: So if you remove multi-methods, what's going to replace them? |
00:46:11 | Araq | I've already explained it. |
00:46:55 | FromGitter | <Varriount> Oh, single-dispatch |
00:47:44 | FromGitter | <Varriount> @Araq: Isn't that what is currently done? I though multimethods dispatched on the type of the object. |
01:00:49 | FromGitter | <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:36 | sleepy998 | is 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:00 | sleepy998 | i 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:11 | sleepy998 | if sleepAsync(0) relinquished, that would suffice. i'm not sure why it doesn't. |
02:29:01 | sleepy998 | oh nevermind, poll(0) works :o |
02:30:57 | FromGitter | <Varriount> sleepy998: You might want to wait until dom96 is awake, he's the expert on async stuff |
02:38:28 | FromGitter | <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:47 | sleepy998 | Varriount: yes; the problem was how to yield an infinitesimally small amount of time |
02:39:48 | FromGitter | <barcharcraz> Idea: c++ffi via clang pch files |
02:40:48 | FromGitter | <Varriount> @barcharcraz Is that format documented anywhere? |
02:41:31 | * | user0___ joined #nim |
02:45:58 | FromGitter | <barcharcraz> I think so |
02:46:37 | FromGitter | <barcharcraz> https://clang.llvm.org/docs/PCHInternals.html |
02:46:54 | FromGitter | <barcharcraz> I think the clangserialization library can even real em |
02:47:01 | FromGitter | <barcharcraz> *read |
02:49:58 | FromGitter | <barcharcraz> Ine thing idk about is how to instantiate a cop Templar with a nim type, that seems complicated |
02:50:15 | FromGitter | <barcharcraz> Jesus iPhone autocomplete is bad |
02:50:46 | FromGitter | <barcharcraz> Also see dlang's calypso project |
02:51:03 | * | user0___ quit (Quit: user0___) |
02:52:38 | * | chemist69 joined #nim |
02:58:56 | def-pri-pub | Has 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:48 | def-pri-pub | Nevermind, 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:05 | FromGitter | <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:39 | demi- | is it possible to build a nimble package as an executable binary as well as dynamic library? |
03:59:35 | FromGitter | <vegansk> @demi-, use ``when isMainModule: callMainFunctionHere()`` |
03:59:50 | demi- | yeah i'm doing that and get problems :\ |
04:00:11 | FromGitter | <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:43 | demi- | i think i have worked around it for now |
04:12:06 | demi- | now to work out how to get the existing set of environment variables |
04:13:25 | FromGitter | <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:19 | Tiberium | ehm, noob question - if I have an "url" variable in global section, can I modify it from while loop section? |
06:25:25 | FromGitter | <vegansk> @Tiberium, yes unless you iterating over it |
06:25:53 | FromGitter | <TiberiumPY> @vegansk no, I'm not iterating over it |
06:26:04 | FromGitter | <TiberiumPY> so how to do it? |
06:27:02 | FromGitter | <vegansk> ```var url = "x" ⏎ for x in 1..5: ⏎ url &= url & $x``` [https://gitter.im/nim-lang/Nim?at=58d4bc34a84f611959da1012] |
06:27:17 | FromGitter | <TiberiumPY> ah, I'm stupid |
06:27:23 | FromGitter | <TiberiumPY> I was doing it with "var" like |
06:27:47 | FromGitter | <TiberiumPY> ```var url = "" ⏎ while true: ⏎ var url = "something else"``` [https://gitter.im/nim-lang/Nim?at=58d4bc618fa16339540f0b17] |
06:27:48 | FromGitter | <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:01 | SusWombat | Morning |
06:59:19 | SusWombat | Anyone 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:25 | zachcarter | nope :/ |
07:15:29 | zachcarter | are you talking about with the compiler? |
07:15:33 | zachcarter | the switch? |
07:15:38 | zachcarter | SusWombat^ |
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:20 | SusWombat | zachcarter, yeah |
08:09:29 | zachcarter | sec |
08:09:39 | SusWombat | zachcarter, i think we even discussed this together like 1-2 weeks ago :D |
08:09:50 | zachcarter | ah possibly |
08:09:55 | zachcarter | I remember a similar discusison |
08:10:01 | zachcarter | still no luch huh? |
08:10:08 | SusWombat | no :/ |
08:10:27 | zachcarter | hrmmm |
08:10:35 | zachcarter | you’re using gdb right? |
08:10:38 | SusWombat | i compile with lineDir on but i still get some "random" code when i press l in gdb/lldb |
08:10:39 | zachcarter | have you tried lldb? |
08:10:44 | zachcarter | ah okay |
08:10:48 | zachcarter | have you tried linedir |
08:10:51 | zachcarter | not camel case? |
08:11:23 | zachcarter | nim c --linedir:on --debuginfo c hello |
08:12:58 | SusWombat | yeah same |
08:13:10 | SusWombat | zachcarter, the double c is a tyo right? |
08:13:16 | SusWombat | typo* |
08:13:16 | cheatfate | nim c --debugger:native --linedir:on hello |
08:13:40 | zachcarter | I copied and pasted that from a blog |
08:13:42 | zachcarter | but yeah probably |
08:13:52 | SusWombat | cheatfate, same :/ |
08:14:26 | cheatfate | what is `l` command doing? |
08:14:51 | SusWombat | should list my code no? |
08:15:05 | SusWombat | cheatfate, |
08:15:46 | SusWombat | http://i.imgur.com/PCZG0Yw.png |
08:16:09 | SusWombat | the file only contains " echo "Hello World" " |
08:17:56 | cheatfate | SusWombat, you need to execute `b NimMainModule` |
08:17:58 | cheatfate | r |
08:18:02 | cheatfate | then `r` |
08:18:08 | cheatfate | then one `n` |
08:18:14 | cheatfate | and you are at your code |
08:19:27 | * | couven92 joined #nim |
08:20:45 | SusWombat | cheatfate, http://i.imgur.com/UUiNZdT.png |
08:20:50 | SusWombat | thats what happens for me |
08:21:09 | cheatfate | yeah i know |
08:21:12 | cheatfate | make one step |
08:21:19 | cheatfate | with `n` |
08:21:22 | * | Andris_zbx joined #nim |
08:21:43 | cheatfate | this is workaround :) |
08:22:01 | cheatfate | of course you can make `b helloworld.nim:<linenumber>` |
08:22:23 | cheatfate | so you can avoid walking through stub code (which is very very unclear) |
08:22:56 | SusWombat | cheatfate, ok after next step its works O: Do you happen to know why that happens? |
08:23:41 | SusWombat | it* |
08:23:52 | cheatfate | SusWombat, nope, and i have asked Araq, he dont know too :) |
08:24:15 | SusWombat | cheatfate, do other debuggers work without that workaround? |
08:24:46 | cheatfate | SusWombat, nope this workaround for gdb/lldb and windows debuggers too |
08:25:15 | * | couven92 quit (Quit: Client disconnecting) |
08:25:32 | SusWombat | cheatfate, 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:17 | cheatfate | SusWombat, i dont think it workd better for zachcarter |
08:26:36 | cheatfate | but i think he make `b somecode.nim:<someline>` before executing |
08:26:44 | cheatfate | so he never seen stub code |
08:26:51 | SusWombat | zachcarter, could you comment on that? |
08:27:06 | zachcarter | hrm? I don’t have to do much to get debug line info in lldb |
08:27:23 | zachcarter | I pretty much do this - |
08:27:53 | zachcarter | nim —linedir:on —debuginfo c hello.nim |
08:28:20 | zachcarter | on osx with devel version of nim |
08:28:44 | SusWombat | zachcarter, and if you open the binary with lldb and press l whats the output? |
08:29:09 | zachcarter | sec |
08:30:00 | zachcarter | https://gist.github.com/zacharycarter/d36edf74f5c30690da2b0bc02cdd4a6f |
08:30:42 | SusWombat | ah well you have the same problem :/ |
08:30:55 | SusWombat | btw thanks cheatfate zachcarter |
08:31:16 | zachcarter | sure |
08:31:28 | zachcarter | sorry I’m totally distracted haha, trying to get shaders to copmile for dx11 on my windows vm |
08:31:39 | SusWombat | no problem |
08:38:09 | * | vivus joined #nim |
08:39:26 | vivus | in this lib: https://nim-lang.org/docs/db_mysql.html . am I limited to searching for strings by what mysql offers? |
08:45:23 | zachcarter | vivus - I don’t understand your question |
08:45:40 | zachcarter | I don’t think that module adds any functionality to mysql |
08:45:44 | zachcarter | if that’s what you’re asking |
08:46:47 | vivus | zachcarter: 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:01 | zachcarter | I’m guessing the latter |
08:47:11 | zachcarter | but maybe not |
08:47:16 | zachcarter | it does say higher level wrapper |
08:47:28 | zachcarter | I’m not a user so a user would be better to comment, but thank you for clarifying your question |
08:48:36 | vivus | zachcarter: 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:37 | zachcarter | vivus: 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:48 | zachcarter | maybe try the .rows iterator |
08:49:50 | zachcarter | see what you get |
08:50:01 | vivus | yeah I'm going to try fetching each row to see what happens |
08:50:11 | vivus | gotta crawl before I can walk in nim :) |
09:00:45 | * | Tiberium joined #nim |
09:05:38 | zachcarter | true |
09:07:11 | SusWombat | what 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:59 | cheatfate | SusWombat, var a = ObjectType(field1: value1, field2: value2, ...) |
09:13:12 | Tiberium | I'm wondering - is there any website like codecombat or codingame with Nim support? |
09:14:21 | cheatfate | SusWombat, var a = ObjectType() initializes memory of object to `0x00` bytes |
09:14:44 | SusWombat | cheatfate, ok thanks |
09:15:16 | SusWombat | Tiberium, if you find one pls be so kind and tell me about it :) |
09:15:53 | Tiberium | SusWombat, ok, will spend some time googling :) |
09:18:20 | Tiberium | ehh, codingame contains many languages, but no "Nim" in list, but there's even a Swift, C, C++, and so on |
09:23:10 | vivus | Tiberium: for an online nim compiler? I believe there is 1 |
09:23:25 | Tiberium | vivus, no, I know there's a Nim compiler |
09:23:35 | Tiberium | vivus, I want to find a coding game like "codingame" |
09:23:42 | Tiberium | with Nim support |
09:25:33 | FromGitter | <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:22 | FromGitter | <dom96> Someone from codingame emailed me about adding Nim support |
09:41:28 | FromGitter | <dom96> so it might happen |
09:41:44 | zachcarter | anyone with a windows machine want to help me out and test my game framework on their machine? |
09:41:58 | zachcarter | I’m getting some weird results in my DX11 shaders and I’m wondering if it’s because I’m using a VM |
09:42:02 | zachcarter | to test with |
09:42:15 | * | xet7 quit (Quit: Leaving) |
09:45:44 | zachcarter | I’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:26 | FromGitter | <TiberiumPY> @dom96 how long time ago they emailed y |
10:15:45 | * | Guest14586 quit (Ping timeout: 268 seconds) |
10:16:13 | FromGitter | <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:13 | FromGitter | <brechtm> The following crashes on Nim devel on macOS: https://glot.io/snippets/eoaac145ag |
10:45:43 | FromGitter | <brechtm> But not if line 9 is uncommented |
10:45:57 | FromGitter | <brechtm> Can someone try this on Linux or Windows? |
10:46:15 | Araq | I don't think we claim you can echo typeinfo |
10:47:14 | FromGitter | <brechtm> Error: execution of an external program failed: 'clang -c -w -g -O3 -I/usr/local/Cellar/nim/HEAD-0d8a503/nim/lib... |
10:48:29 | FromGitter | <brechtm> @Araq The C compilation step errors, I mean. Is that normal? |
10:49:09 | zachcarter | Varriount: if you’d still be willing please lmk, sorry went to eat breakfast |
10:49:50 | FromGitter | <TiberiumPY> It doesn't crash for me |
10:49:56 | FromGitter | <TiberiumPY> (linux gcc) |
10:49:59 | FromGitter | <TiberiumPY> will try with clang now |
10:50:17 | FromGitter | <TiberiumPY> it's fine |
10:50:24 | FromGitter | <Varriount> zachcarter: I can test in the morning, I'm going back to sleep now. |
10:50:31 | zachcarter | Alright thanks :D |
10:50:35 | zachcarter | have a good night! |
10:50:41 | FromGitter | <brechtm> @TiberiumPY strange |
10:51:26 | Araq | brechtm: (value: ...rawTypePtr: ...) # produces this output for me |
10:51:39 | Araq | which is ok, the fields are hidden |
10:52:17 | FromGitter | <brechtm> @Araq I get this: http://pastebin.com/tPS2qJpe |
10:52:42 | FromGitter | <TiberiumPY> my clang version is 3.9.1 |
10:53:38 | * | krux02 joined #nim |
10:54:15 | FromGitter | <brechtm> Hrm, it does seem to work now that I updated my Nim to current devel |
10:54:35 | FromGitter | <TiberiumPY> that's it :) |
10:54:36 | FromGitter | <brechtm> Nope, it's something to do with VSCode... nm |
10:54:43 | FromGitter | <TiberiumPY> ? |
10:54:46 | FromGitter | <TiberiumPY> I use VSCode too |
10:55:33 | FromGitter | <brechtm> I have no idea what's going on |
10:59:01 | zachcarter | what’s the error brechtm? |
10:59:50 | FromGitter | <brechtm> Ah, it's because in VSCode I'm passing more options to nim |
11:00:42 | FromGitter | <brechtm> @TiberiumPY try passing -d:release |
11:01:38 | FromGitter | <brechtm> Yup, that makes it fail on glot.io as well |
11:02:24 | * | Snircle joined #nim |
11:02:30 | FromGitter | <TiberiumPY> can you provide exact command? |
11:02:50 | FromGitter | <TiberiumPY> so I need to uncomment commented line |
11:02:54 | FromGitter | <TiberiumPY> and run with clang and release |
11:02:58 | FromGitter | <brechtm> nim c -d:release file.nim |
11:02:58 | FromGitter | <TiberiumPY> it works for me... |
11:03:04 | FromGitter | <brechtm> no, don't uncomment |
11:03:07 | zachcarter | https://glot.io/snippets/eoaac145ag |
11:03:10 | zachcarter | works with -d:release |
11:03:11 | FromGitter | <brechtm> uncommenting "fixes" it |
11:03:18 | FromGitter | <TiberiumPY> ah |
11:03:19 | FromGitter | <TiberiumPY> it is |
11:03:23 | FromGitter | <TiberiumPY> fails with comment |
11:03:25 | zachcarter | whoops |
11:03:30 | zachcarter | hrm how do I update your snippet |
11:03:35 | FromGitter | <TiberiumPY> both on gcc and clang |
11:03:55 | zachcarter | https://glot.io/snippets/eoaawusoex |
11:03:56 | zachcarter | there |
11:04:00 | zachcarter | that works with -d:release |
11:04:01 | FromGitter | <brechtm> @zachcarter You need to fork it first, then change it, then save it again... annoying, huh? |
11:04:13 | zachcarter | you guys can’t echo that |
11:04:19 | zachcarter | use repr |
11:04:30 | FromGitter | <TiberiumPY> but it's compile-time rror |
11:04:32 | FromGitter | <TiberiumPY> in C |
11:04:44 | FromGitter | <TiberiumPY> which is always bad |
11:04:48 | zachcarter | Araq: I don't think we claim you can echo typeinfo |
11:05:16 | zachcarter | I think that’s what he’s referring to |
11:05:20 | zachcarter | could be wrong |
11:05:51 | FromGitter | <brechtm> @zachcarter But it doesn't make sense that it works when uncommenting line 9 |
11:06:11 | zachcarter | kind is a string? |
11:06:15 | FromGitter | <brechtm> And as @TiberiumPY says, I don't suppose this should generale C-compile error |
11:06:23 | zachcarter | probably not |
11:06:38 | Araq | it shouldn't. but it also doesn't for me. |
11:06:55 | zachcarter | I don’t know why the release define causes that |
11:06:57 | FromGitter | <brechtm> Araq: neither with -d:release? |
11:07:34 | Araq | ah, it does |
11:07:58 | FromGitter | <brechtm> @Araq let me know if you want me to create an issue for this |
11:08:14 | Araq | yeah sure go ahead. |
11:08:29 | Araq | not 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:02 | FromGitter | <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:13 | Tiberium | zachcarter, 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:28 | zachcarter | sure I already have it precompiled |
11:29:34 | zachcarter | let me zip it up fo ryou thank you Tiberium |
11:30:20 | FromGitter | <TiberiumPY> OK :) |
11:32:28 | zachcarter | going to figure out how to get this off my vm then I’ll have to you :) |
11:32:47 | FromGitter | <TiberiumPY> you can use services like transfer.sh |
11:32:54 | FromGitter | <TiberiumPY> to upload and share files |
11:32:59 | FromGitter | <TiberiumPY> it doesn't require any registration |
11:33:05 | FromGitter | <TiberiumPY> https://transfer.sh |
11:35:00 | zachcarter | thanks |
11:38:28 | zachcarter | https://transfer.sh/xtAsS/zach%27s%20dx11%20app.zip |
11:39:25 | FromGitter | <TiberiumPY> wait, I need to download SDL2, I can do this manually :) |
11:39:37 | zachcarter | ah crap forgot about that |
11:39:43 | zachcarter | okay thanks :) |
11:40:38 | FromGitter | <TiberiumPY> ah |
11:40:43 | FromGitter | <TiberiumPY> you forgot to send me assets :) |
11:40:47 | zachcarter | whoops |
11:40:51 | FromGitter | <TiberiumPY> C:\Users\Tiberius\Desktop\../assets\textures/test01.png does not exist. |
11:40:59 | zachcarter | let me do that real quick |
11:41:20 | FromGitter | <TiberiumPY> no, I do not hurry |
11:42:14 | * | Ven joined #nim |
11:42:37 | * | Ven is now known as Guest63163 |
11:42:41 | zachcarter | https://transfer.sh/jyeGi/assets.zip |
11:42:46 | zachcarter | :P |
11:43:00 | zachcarter | quick is relative anyway |
11:44:05 | FromGitter | <TiberiumPY> so I started it |
11:44:27 | FromGitter | <TiberiumPY> http://image.prntscr.com/image/fed3a3a6bcc64df49690fcd8a6654790.png |
11:44:36 | FromGitter | <TiberiumPY> it is that I get |
11:44:38 | zachcarter | okay thanks that’s what I”m seeing too on my screen |
11:44:42 | zachcarter | do you have DX11> |
11:44:43 | zachcarter | ? |
11:44:45 | FromGitter | <TiberiumPY> yeah |
11:44:52 | FromGitter | <TiberiumPY> GTX 750 |
11:45:03 | zachcarter | gotcha, okay thank you for trying that I appreciate it very much! |
11:45:28 | FromGitter | <TiberiumPY> I always ready to help with game development projects :) |
11:45:37 | zachcarter | well I’m welcoming contributors to mine :D |
11:45:46 | zachcarter | https://github.com/fragworks/frag |
11:45:54 | FromGitter | <TiberiumPY> no, I'm actually a newbie in Nim |
11:46:13 | zachcarter | ah well you don’t have to be a pro to help |
11:46:20 | zachcarter | so much work to be done |
11:46:42 | FromGitter | <TiberiumPY> but I'm really a newbie, I've came from Python |
11:46:50 | zachcarter | :D well glad to have you |
11:47:07 | zachcarter | Nim is very cool |
11:47:17 | FromGitter | <brechtm> Hrm, getting nowhere trying to get the base type for an object type using typeinfo.base |
11:47:26 | FromGitter | <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:11 | zachcarter | http://imgur.com/a/JG9y7 |
12:17:13 | zachcarter | got it working |
12:18:18 | FromGitter | <TiberiumPY> wow, nice |
12:19:51 | zachcarter | thanks |
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:40 | krux02 | brechtm, are you still trying to implement super with a macro? |
12:39:56 | FromGitter | <brechtm> @krux02 I gave up |
12:40:18 | FromGitter | <brechtm> @krux02 well, I was now trying to use typeinfo.base, so no macro |
12:50:41 | * | zachcarter quit (Quit: zachcarter) |
12:52:05 | krux02 | http://ix.io/pdP |
12:52:11 | krux02 | forget about typeinfo |
12:52:30 | krux02 | brechtm: I implemented super for you |
12:52:54 | krux02 | you still need to do proccall, but the super does the casting for you |
12:53:01 | FromGitter | <timeyyy> is cmake what neovim uses for building all the things in .deps, ? |
12:53:09 | krux02 | and it is written in a way that it assumes a ref type, and casts to a ref type |
12:53:45 | krux02 | timeyyy well cmake is the default build system for c++ projects |
12:53:54 | krux02 | well not the default, but it is getting there |
12:54:11 | FromGitter | <timeyyy> but vim is c :) |
12:54:12 | krux02 | I don't know about .deps, |
12:54:19 | krux02 | it also works for c |
12:54:42 | krux02 | It is a horrible language that makes builds complicated |
12:54:44 | krux02 | I hate it |
12:55:09 | krux02 | but it get's the job done for most big projects and it allows cross platform builds |
12:55:33 | FromGitter | <timeyyy> i want to automatically download system dependencies for my python project |
12:56:00 | krux02 | I have no idea about python, but cmake normally does not download dependencies |
12:56:13 | krux02 | I think you can write a cmake script that does it, but normally it does not do that |
12:56:32 | krux02 | and what do you mean with downloading system dependencies? |
12:56:45 | krux02 | aren't system dependencies those things you can't download |
12:56:59 | FromGitter | <timeyyy> well when i do `make` with neovim |
12:56:59 | krux02 | otherwise they would not be called "system" dependencies |
12:57:11 | krux02 | I only know vim |
12:57:32 | krux02 | and in vim make would call make by default, but you could replace it with any other command |
12:57:39 | FromGitter | <timeyyy> yeah i mean, when i ship my final product to the user it will depend on xclip for example |
12:57:45 | krux02 | cmake generates (normally) makefiles |
12:57:56 | FromGitter | <timeyyy> or lets say luajit |
12:58:07 | krux02 | so when you have a cmake project and you execute cmake already, make should be enough |
12:58:26 | krux02 | those makefiles are written in a way that they call cmake when needed |
12:58:41 | krux02 | doesn't always work though and you still have to call cmake from time to time |
12:59:17 | krux02 | well you have some options |
12:59:38 | krux02 | when you have a git repository, you can put your dependencies in a git subtree |
12:59:59 | krux02 | then you ship with your dependencies, but then they are also not system dependencies anymore |
13:00:11 | krux02 | cmake normally helps you detect system dependencies |
13:00:18 | FromGitter | <timeyyy> ok hold on |
13:00:35 | FromGitter | <timeyyy> so i want to bundle the deps in a reproducible way |
13:00:48 | krux02 | yes then I recommend you do git subtree |
13:01:01 | FromGitter | <timeyyy> 1) download, 2. compile if required |
13:01:38 | krux02 | with git subtree, your build does not download the dependencies, the dependencies are bundled in the download of the project |
13:02:15 | FromGitter | <timeyyy> as source? |
13:02:18 | krux02 | yes |
13:02:41 | krux02 | and then cmake can be configured to trigger the build of all dependencies |
13:03:03 | krux02 | you can also bundle binaries, but that is much less reproducable |
13:03:45 | vivus | I 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:12 | FromGitter | <timeyyy> ok thanks for the help |
13:04:21 | krux02 | dbstore is nil |
13:04:32 | krux02 | timeyy, no problem |
13:05:08 | vivus | krux02: what do I do instead? |
13:05:19 | krux02 | timeyyy, but those dependencies you mentioned seem to be very stable dependencies |
13:05:35 | krux02 | timeyyy, so you could rely on them |
13:05:51 | krux02 | cmake will trigger an error when they are not found, and users can install them |
13:06:20 | FromGitter | <timeyyy> well i am making an appimage |
13:06:27 | krux02 | I would rather suggest bundling dependencies that are less stable and might introduce incompatible api changes |
13:06:32 | FromGitter | <timeyyy> so the idea is a bundle everything and it will just work |
13:06:44 | krux02 | yes then git subtree is your friend |
13:07:15 | krux02 | vivus, well I never work with sql, but you have a segfault |
13:07:26 | krux02 | and what I said was just a guess |
13:07:32 | FromGitter | <timeyyy> now that you mention it i think neovim has all it's deps in a git repo |
13:07:35 | krux02 | one of your variables you use is not initialized |
13:07:58 | krux02 | and most of the time this happens is, when you try to append to an nil seq or a nil string |
13:08:19 | krux02 | so before you call add on a seq, you should call newSeq(0) on it |
13:08:36 | krux02 | or initialize it with = @[] |
13:08:59 | vivus | krux02: 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:22 | vivus | krux02: should I use a sequence or some other advanced-type ? |
13:09:37 | krux02 | seq is a very fine type |
13:09:42 | krux02 | you can't overuse it |
13:10:14 | vivus | which type should I then use for a dynamic array-like type ? |
13:10:16 | krux02 | array is too static for this context (fixed length) |
13:10:29 | krux02 | vivus, you should use seq |
13:10:33 | krux02 | that is your type |
13:10:47 | krux02 | but you have to initialize it |
13:10:52 | vivus | alright I see the docs shows initialization, so I need to do that |
13:11:32 | krux02 | I think it's sad that this needs to be initialized, but that is how it is |
13:12:20 | vivus | krux02: why is the initialization necessary? so that it can be placed on the heap for GC? |
13:12:36 | vivus | and do I initialize it in a proc or at the global level? |
13:15:13 | krux02 | vivus, it's best when you initialize where you also declare it |
13:15:26 | demi- | 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:16 | krux02 | reactormonk, do you still maintain nim-mode? |
13:17:26 | reactormonk | krux02, nope. |
13:17:34 | krux02 | hmm |
13:17:37 | FromGitter | <timeyyy> hey krux02, i thought i was in the neovim channel lol! |
13:17:48 | FromGitter | <timeyyy> now it makes sense ^^ |
13:18:02 | krux02 | np, was a bit off topic though |
13:18:42 | krux02 | reactormonk, 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:57 | krux02 | because I have the feeling nim-mode is orphaned |
13:19:44 | krux02 | since 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:57 | reactormonk | krux02, not sure I can still vet PRs on that, if Araq agrees, I can just give you collab. |
13:22:02 | krux02 | timeyyy, 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:23 | reactormonk | and yuutayamada for that matter. |
13:23:00 | krux02 | reactormonk, 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:10 | krux02 | what are the right tools to do it, how to test changes etc |
13:23:29 | krux02 | and where to put code that I want to be executed |
13:23:41 | vivus | thanks krux02 that worked |
13:24:46 | * | SusWombat joined #nim |
13:25:41 | krux02 | @brechtm: did you test http://ix.io/pdP ? |
13:28:20 | reactormonk | krux02, check the makefile |
13:40:52 | demi- | 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:35 | flyx | demi-: well, you'd need to dump the process' output to stdout and feed stdin to the process' input |
13:43:26 | demi- | and that isn't what "poParentStreams" is for? |
13:43:39 | SusWombat | Can someone tell me what im doing wrong here? https://hastebin.com/kolubazoki.nim |
13:43:53 | SusWombat | i get: SIGSEGV: Illegal storage access. (Attempt to read from nil?) |
13:44:26 | flyx | demi-: hmm, it should |
13:45:10 | demi- | yeah i am not seeing that |
13:45:15 | Araq | demi-: poParentStreams is only implemented for Windows :-) |
13:45:23 | demi- | |
13:45:38 | vivus | which lib should I use for reading/writing strings to files ? |
13:45:50 | demi- | Araq then it seems that the majority of osproc is only implemented on windows |
13:46:38 | flyx | vivus: depends on your use-case. there are simple procs in system, and there is the streams module |
13:46:47 | Araq | you can use os.execShellCmd that does poParentStreams |
13:47:05 | vivus | SusWombat: I had a similar problem above. you need to initilize something in your code |
13:47:10 | Araq | also majority of osproc my ass, I only touch this code when I'm drunk for a reason |
13:47:14 | SusWombat | Is there somewhere a list on stuff thats only implemented for windows? |
13:47:29 | Araq | it's a never ending pita in posix land |
13:47:35 | demi- | haha |
13:47:40 | demi- | ain't that the truth |
13:47:57 | vivus | so when calling osproc and it bricks your OS, blame Araq for writing code while drunk |
13:47:59 | * | user0___ quit (Quit: user0___) |
13:48:22 | flyx | SusWombat: it is really a bad idea to give a field the same name as its type. use Books for the type. |
13:48:33 | flyx | SusWombat: also Shelf |
13:48:49 | SusWombat | flyx, thats just stupid example code but thanks :) |
13:48:53 | Araq | SusWombat: only osproc poParentStreams comes to mind. |
13:49:04 | SusWombat | Araq, ok thank you |
13:49:12 | demi- | Araq: that would work but i have no way to modify the env of the command being invoked then :\ |
13:49:15 | flyx | SusWombat: then do var bookShelf = Shelf(books: Books()) |
13:49:37 | SusWombat | flyx, o.O ok thanks why isnt nim doing that? |
13:49:37 | Araq | demi-: I think if you say "please, please" cheatfate might give it a shot |
13:49:47 | flyx | SusWombat: why should it? |
13:50:13 | demi- | heh, ok i will give that a shot |
13:50:14 | SusWombat | flyx, cause i declared it as a member or not? |
13:50:29 | flyx | SusWombat: yes, and default value for ref types is nil |
13:50:30 | krux02 | reactormonk, 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:02 | krux02 | just add the folder of my fork to load-path and add require in my init.el? |
13:51:03 | flyx | SusWombat: you need to tell Nim explicitly to allocate an object of Books, it won't do that on its own |
13:51:14 | SusWombat | ok thanks |
13:51:40 | reactormonk | krux02, in emacs or via cask? |
13:51:47 | reactormonk | via emacs, just eval-buffer |
13:51:50 | reactormonk | via cask, make test |
13:51:55 | flyx | SusWombat: 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:20 | krux02 | reactormonk, so the test is only non-interactive? |
13:53:27 | reactormonk | krux02, yeah. |
13:54:46 | krux02 | and with eval-buffer you mean the buffers of the test cases? |
13:55:06 | SusWombat | flyx, yeah |
13:55:21 | krux02 | reactormonk, I was thinking more of interactive testing |
13:56:12 | reactormonk | krux02, define interactive testing |
13:56:16 | krux02 | meaning to open a file in nim-mode, and do thinks I would normally do when I edit that file |
13:56:43 | reactormonk | ah nope, cask is explicitly about isolation. |
13:57:03 | krux02 | well then how do I reaload a package from emacs? |
13:57:08 | krux02 | just restart emacs? |
13:57:25 | krux02 | I mean isolation tests are good |
13:57:38 | krux02 | but more important is how it works in the editor |
13:58:35 | reactormonk | for 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:48 | SusWombat | reactormonk, do you use nim in emacs? |
14:04:54 | SusWombat | the nimmode i mean |
14:04:57 | reactormonk | SusWombat, I don't use nim at all anymore :-( |
14:05:02 | SusWombat | ah ok |
14:05:21 | reactormonk | mainly Scala, with Haskell on the side. |
14:15:11 | krux02 | reactormonk, well I went in the other direction I used to write a lot of scala and now it's nim |
14:15:21 | krux02 | main reason JVM |
14:16:04 | krux02 | haskell only in university courses |
14:16:14 | vivus | I'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:05 | krux02 | vivus, 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:30 | krux02 | vivus, this file streaming stuff is a very ancient technology when memory was short and files used to not fit in memory |
14:18:23 | vivus | krux02: 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:39 | demi- | for str in str_seq: file.write(str) |
14:18:53 | krux02 | demi-, well not entirely |
14:19:12 | krux02 | vivus, you need a separator, otherwise you wont't be able to parse the content back |
14:19:27 | reactormonk | krux02, actually got a haskell application here in the company, but it's only a smaller project :-) |
14:19:28 | krux02 | the simplets separator is just a newline |
14:19:50 | vivus | krux02: should I use csv operations then ? |
14:20:00 | krux02 | reactormonk, what is haskell actually be used for except for writing compilers? |
14:20:14 | reactormonk | krux02, servant makes for nice microservices |
14:20:15 | krux02 | vivus, that would be an option |
14:21:45 | * | byte512 quit (Quit: Bye.) |
14:21:59 | krux02 | reactormonk, 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:53 | reactormonk | krux02, they're not too different. However, you can do funny things with eff monads. |
14:23:03 | reactormonk | ... also, applicative do basically gives you some erlang power. |
14:23:06 | krux02 | what is eff monads |
14:23:58 | reactormonk | Scala implementation: https://atnos-org.github.io/eff/ |
14:24:06 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
14:24:13 | reactormonk | Monad Transformers are inflexible. That's why eff exists. |
14:25:05 | Tiberium | how can I define tables which looks like this: {"peer_id": 123, "message": "some text"} ? |
14:25:22 | * | byte512 joined #nim |
14:25:44 | krux02 | Tiberium, that is not a table |
14:25:46 | vivus | is this the only place to view CSV docs: https://github.com/achesak/nim-csv/blob/master/documentation.html ? |
14:25:57 | Tiberium | krux02, {"peer_id": 123, "message": "some text"}.toTable() |
14:26:09 | Tiberium | I don't know how to use objects like this without toTable |
14:26:20 | Tiberium | I need something like python's dict |
14:26:24 | krux02 | Tiberium, well it is badly typed or better as a struct/object/tuble |
14:26:28 | krux02 | tuple |
14:26:43 | krux02 | well there is a package called tables |
14:26:48 | krux02 | but they are typed |
14:26:53 | Tiberium | yeah I see |
14:26:58 | krux02 | so you should have a consistent type on the right side |
14:27:30 | krux02 | I think you can use the any type, but that is very dirty |
14:27:31 | Tiberium | ok, thankfully there's web API, so it accepts JSON, so I can safely convert all parameters to string |
14:27:50 | krux02 | there is also a json package |
14:28:03 | Tiberium | I know |
14:28:11 | Tiberium | But it requires to unpack everything too |
14:28:13 | krux02 | so maybe want to work with json objects instead of tables |
14:28:17 | Tiberium | like object.str |
14:28:28 | vivus | hows this lib: https://github.com/unicredit/csvtools . much cleaner usage |
14:28:45 | vivus | awesome to see a big bank using nim |
14:29:03 | krux02 | well I would always be careful with 19 commits packages. |
14:29:38 | vivus | https://github.com/achesak/nim-csv 25 commits |
14:29:44 | krux02 | either 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:53 | krux02 | it's more likely the first one |
14:30:05 | krux02 | yea you git the idea |
14:30:13 | krux02 | test it get the idea of it |
14:30:27 | krux02 | but eventually it means you have to write your own version of it |
14:30:49 | * | rauss joined #nim |
14:30:53 | krux02 | I don't want to scare you off. I just want you to be careful |
14:31:34 | krux02 | Tiberium, web API are written with javascript in mind, not with a typed programming language |
14:31:41 | Tiberium | krux02, I know sadly |
14:31:53 | krux02 | but when you have a specification of the web api |
14:31:55 | krux02 | is some form |
14:32:09 | Tiberium | I have them |
14:32:12 | krux02 | you should be able to transform that specification into nim code that you can just call as functions |
14:32:40 | krux02 | In is very powerful, it could generate all the glue code for you |
14:32:45 | Tiberium | they have JSON Schema describing their API |
14:32:52 | Tiberium | so like all the types |
14:33:02 | krux02 | that's pretty great |
14:33:14 | krux02 | that means you could transform this schema into a wrapper API |
14:33:58 | krux02 | I don't know that API, but web api are better when they are async |
14:34:08 | krux02 | so maybe you have several void procs |
14:34:21 | Tiberium | their json schema is located on GitHub: https://github.com/VKCOM/vk-api-schema |
14:39:16 | krux02 | Tiberium, 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:27 | Tiberium | krux02, you mean send them as one? |
14:39:33 | krux02 | yes |
14:39:47 | Tiberium | there's that possibility too, you can send up to 25 requests using special web api method |
14:40:10 | Tiberium | and api itself is limited for 3 requests per second, so the best you can get is 75 req/s |
14:40:15 | Tiberium | but it's not really needed |
14:40:42 | krux02 | oh yea what speeds |
14:41:00 | Tiberium | it's largest social network in Russia and in CIS |
14:41:01 | krux02 | but anyway, you should some request struct |
14:41:11 | krux02 | and then an apicall that accepts an openarray of that |
14:41:17 | Tiberium | krux02, I will try to parse this json schema |
14:41:22 | krux02 | and then the API itself can be sycronous |
14:42:20 | krux02 | VK isn't that this russian Facebook with the German name? |
14:42:32 | Tiberium | it's russian facebook, but with russian name :) |
14:42:56 | krux02 | well Kontakte is a German word :P |
14:43:02 | Tiberium | nooo |
14:43:10 | Tiberium | "VKontakte" means "In contact" |
14:43:20 | Tiberium | if you translate from russian to english |
14:43:38 | Tiberium | it's just english letters instead of russian one's |
14:43:43 | Tiberium | originally it's "ВКонтакте" |
14:44:34 | vivus | that would be an awesome domain to own |
14:44:36 | * | Andris_zbx quit (Ping timeout: 240 seconds) |
14:44:36 | FromGitter | <brechtm> @krux02 Thanks. Good to know it's possible! |
14:45:07 | FromGitter | <brechtm> @krux02 But I'm sure you don't mind I'll try to use generics instead ;-) |
14:45:18 | Tiberium | Where do I start learning, how to generate Nim code? Or maybe I shouldn't do it now, because I'm a newbie? |
14:45:30 | Tiberium | I've done some auto-binding generation in Python using pycparser and cffi |
14:45:39 | * | andris_ joined #nim |
14:45:42 | krux02 | brechtm: I don't use inheritance at all, it's all generics in my code |
14:46:09 | krux02 | Tiberium, I started with code generation, too |
14:46:18 | krux02 | the nice thing is, that you can do it all in a macro |
14:47:05 | krux02 | macro parseApi(): untyped = let api = staticRead("schema.json") ... |
14:47:13 | krux02 | don't forget to import macros |
14:47:19 | krux02 | and then you have quote do |
14:47:30 | krux02 | let x = quote do: ... |
14:48:38 | vivus | Araq: is there a better place for documentation for this: https://github.com/achesak/nim-csv/blob/master/documentation.html ? |
14:48:41 | krux02 | this 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:34 | Tiberium | krux02, yeah, I've read some articles about Nim's compile-time possibilities |
14:49:57 | krux02 | those compile time possibilites are the reason I am here |
14:50:10 | vivus | Araq: ignore that question, I just realized there is more than 1 CSV lib |
14:50:11 | krux02 | without them I would never have touched this language |
14:52:39 | krux02 | reactormonk, 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:03 | Tiberium | krux02, 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:13 | Tiberium | or wait |
14:58:29 | vivus | krux02: in a sequence of strings, is there a way to preserve the \n characters when writing to a file ? |
14:58:53 | Tiberium | nah, I'm not so familiar with Nim to do such complicated things right now :) |
15:01:32 | * | BitPuffin|osx joined #nim |
15:08:39 | Tiberium | but maaaybe |
15:13:17 | krux02 | vivus, I think when you use \n in string literals, nim replaces them by the system dependent version of that |
15:13:22 | krux02 | I am not so sure about that |
15:13:30 | * | Ven joined #nim |
15:13:53 | * | Ven is now known as Guest28837 |
15:13:56 | vivus | I'm hoping to preserve them, if possible |
15:14:17 | Tiberium | so I somehow need to parse json at compile-time, hmm |
15:14:31 | krux02 | well best is, if you don't use newline at all |
15:14:36 | krux02 | json can be one line |
15:14:44 | krux02 | (eg) |
15:14:49 | vivus | krux02: the data itself is stored with newlines |
15:14:56 | krux02 | or you have newline as your separator of strings |
15:15:04 | krux02 | that also does work |
15:15:21 | krux02 | but newline in the strings from arbitrary sources I am not so sure about that |
15:15:35 | stisa | Tiberium: I think it should work in a `static:` block |
15:15:48 | Tiberium | stisa, ah, let me try |
15:16:23 | krux02 | Tiberium, stisa well in a static block you can generate NimNodes, but you can't do anything with them there |
15:16:31 | Tiberium | so something like static: let api = parseJson(staticRead("objects.json")) |
15:16:32 | Tiberium | ? |
15:17:05 | krux02 | Tiberium, that should work |
15:17:23 | krux02 | but you still have to call a macro somewhere that generates the actual procedures |
15:18:16 | Tiberium | krux02, compiler says "lib/pure/lexbase.nim(155, 13) Error: VM is not allowed to 'cast' " |
15:18:43 | krux02 | well then you are out of luck :( |
15:18:53 | Tiberium | krux02, "lib/pure/lexbase.nim(155, 13) Error: VM is not allowed to 'cast'<newline> L.buf = cast[cstring](alloc(bufLen * chrSize))" |
15:19:41 | krux02 | that sucks |
15:19:57 | * | tankfeeder left #nim ("Leaving") |
15:20:40 | krux02 | what you still can do is write a file that parses the json at runtime and prints an actual source file |
15:21:14 | Tiberium | hmm, there's https://github.com/cjxgm/jsonob |
15:21:23 | krux02 | and then you can do staticExec("nim c -r generateApi.nim", cache="true") |
15:21:36 | krux02 | that is much more classical code generation |
15:22:00 | krux02 | then you don't have nimnodes, but a textfile you generate |
15:22:28 | Tiberium | yeah, I know |
15:24:19 | krux02 | (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:21 | krux02 | then you would not need a json parser anymore |
15:25:42 | Araq | some procs of marshal.nim are available at compiletime |
15:25:49 | krux02 | you could include the transformed json in your nim file and have a representation that is parsed already from the nim compiler |
15:25:51 | Araq | and marshal uses JSON, so there. |
15:26:37 | Araq | that said, I would use staticExec |
15:27:17 | Araq | its caching feature is just unbeatable for quick compiletimes. otherwise you do this complex compile time transformation over and over again |
15:28:41 | Araq | the VM is for macros, macros are for AST to AST transformations, not for Json to AST transformations |
15:30:09 | Araq | and 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:02 | Tiberium | Araq, can I find some docs on those? |
15:33:38 | Araq | no but the compiler's AST is the same as in macros.nim |
15:33:48 | Araq | except that nnkX becomes nkX |
15:35:01 | Araq | for reasons that excape me there is no macro to transform Nim code into compiler/ast construction |
15:46:04 | Tiberium | I 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:24 | Araq | well you can also just interpret the json at runtime |
15:57:35 | Tiberium | Araq, 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:46 | Tiberium | ah |
15:58:53 | Tiberium | I thought I need to use them in if' |
15:58:55 | Tiberium | but it doesn't work |
15:59:03 | Tiberium | only as additional variable |
15:59:09 | * | Guest28837 quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
16:00:10 | Tiberium | but no |
16:00:58 | Tiberium | so how can I use something like in c: " if (x & 512) {stuff} else {another stuff}" |
16:01:44 | Tiberium | ah, nevermind |
16:03:05 | def- | != 0? |
16:03:15 | def- | there is no implicit int to bool conversion in nim |
16:04:17 | * | vlad1777d quit (Ping timeout: 258 seconds) |
16:15:21 | krux02 | Tiberium, 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:39 | krux02 | at set is basically a bitmasked unsigned integer |
16:15:52 | Tiberium | krux02, can you tell me more? |
16:15:52 | * | brson joined #nim |
16:15:54 | krux02 | it's not a hash set |
16:16:17 | krux02 | well very often integers are used to enable flags |
16:16:21 | Tiberium | yeah |
16:16:23 | Tiberium | in my case too |
16:16:27 | krux02 | for a nice c api |
16:16:47 | krux02 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) |
16:17:19 | krux02 | so when you put all your flags into an enum |
16:17:32 | krux02 | you can use set[MyEnum] instead |
16:17:33 | * | vlad1777d joined #nim |
16:17:44 | * | libman joined #nim |
16:17:58 | Tiberium | krux02, so I will need to check for every enum vs my integer value? |
16:18:45 | krux02 | Tiberium, 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:41 | krux02 | and your example " if (x & 512) {... " would become "if enumValue in x: ..." |
16:20:58 | Tiberium | krux02, 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:52 | Tiberium | krux02, ah |
16:21:55 | Tiberium | krux02, thanks :) |
16:22:06 | krux02 | well then you should remove the assignments in your enum |
16:22:47 | krux02 | and then you can check what echo(int({unread,replied})) prints |
16:23:03 | krux02 | (should be 5) |
16:23:55 | Sentreen | Is it possible to return an anonymous proc from within the body of a template? I'm trying to do something like this: |
16:23:57 | Sentreen | template lazy* (s: untyped): untyped = |
16:23:59 | Sentreen | proc [T](): T = s |
16:24:43 | Sentreen | So the template should just wrap the expression s in a function, so I can delay execution. |
16:25:36 | krux02 | sorry in that case you would need a cast[int](...) |
16:25:43 | krux02 | but I just tested it, it works |
16:25:55 | krux02 | http://ix.io/pe8 |
16:26:26 | krux02 | Sentreen, yes that is possible |
16:27:11 | krux02 | Tiberium, this C patters has become a language feature in Nim and is called set ;) |
16:27:22 | Tiberium | krux02, it says Type mismatch: got (int, Flags) |
16:27:25 | krux02 | s/patters/pattern/ |
16:27:50 | krux02 | Tiberium, well without code C can't help |
16:28:01 | Sentreen | krux02: That code gives me an identifier expected error though, on the proc that I am returning. I should have specified that |
16:28:44 | krux02 | Sentreen, well can you create a paste on something that I can execute? |
16:29:29 | krux02 | I mean I can't help, not C |
16:30:12 | Tiberium | krux02, like this https://glot.io/snippets/eoajwn1c1x |
16:32:46 | Sentreen | krux02: http://pastebin.com/Y8FXH2fE |
16:34:11 | krux02 | if unread in cast[set[Flags]](3): |
16:34:20 | Tiberium | oh ok |
16:34:37 | krux02 | Tiberium, but try to do it without cast |
16:34:57 | krux02 | I mean actual code |
16:35:08 | krux02 | for doodling around and testing limits this is fine |
16:36:13 | vivus | is 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:51 | Tiberium | krux02, but it doesn't work without cast, hm |
16:37:16 | vivus | or better yet, if somebody could explain to me what I should/can insert into these proc-examples |
16:38:33 | vivus | find("somestring", "some", matches, 0 ) ?? |
16:38:53 | Araq | Sentreen: just give the proc a name and have that name the return expression of the template |
16:39:19 | Araq | the proc should be annotated as {.gensym.} |
16:40:40 | vivus | or do I need to instantiate an openArray before naming it in find() ? |
16:42:05 | vivus | here is my basic code: https://www.zerobin.net/?706d126f3817d415#wAcDGxijsnhl8n5eBuO5Oc+zeEkItjSZJfGDQwQEjrk= ? |
16:44:10 | * | Trustable joined #nim |
16:48:37 | Sentreen | @Araq, like this? |
16:48:39 | Sentreen | template lazy* (s: untyped): typed = |
16:48:41 | Sentreen | proc wrapper [T](): T {.gensym.} = s |
16:50:32 | Sentreen | Actually 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:53 | krux02 | well I found out the lazy templates doesn't work, because nim does not parse a proc() ... as a lambda expression |
16:51:06 | krux02 | http://ix.io/peb |
16:51:10 | krux02 | this one does work |
16:51:45 | krux02 | I could also create the lambda expression manually |
16:54:25 | vivus | wow, its like I'm fighting with the documentation at times |
16:54:56 | Sentreen | krux02: that seems to work, thanks a lot! |
16:55:07 | Sentreen | I 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:56 | krux02 | Sentreen, well you need to call echo ast.treeRepr a lot |
16:58:21 | * | Tiberium quit (Remote host closed the connection) |
16:58:22 | krux02 | and sometimes very similar looking ast things look very different |
16:58:34 | krux02 | I have to admit, macro development is not just write it down |
16:58:41 | krux02 | it is a lot of try end error |
16:58:50 | krux02 | but it is better that in almost any other language |
16:59:09 | krux02 | because not nice it much better than not at all |
17:01:10 | Sentreen | Okay, 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:29 | Sentreen | I 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:35 | vivus | krux02: how do I access the openarray here: proc match(s: string; pattern: Regex; matches: var openArray[string]; start = 0): bool {..} ? |
17:05:10 | krux02 | Sentreen, the alternative is to create the syntax tree with NimNodes manually |
17:05:26 | krux02 | with nnkLambda.newTree(...) |
17:06:17 | krux02 | vivus, with matches[i] ?! |
17:06:19 | dom96 | What we need is a library/module that builds on top of the macros module. |
17:06:39 | krux02 | dom96, for what? |
17:06:49 | Sentreen | Oh right, because otherwise the parser gets confused with the proc, I get it now |
17:06:51 | Sentreen | thanks again! |
17:06:52 | dom96 | To make building ASTs easier |
17:07:34 | vivus | krux02: so in my match statement I write: var check = match(string1, regex1, matches) ? |
17:07:37 | krux02 | dom96, I think it would be nice to have a getAst that allows to pass in a context |
17:08:14 | krux02 | for example it is not possible to create expr colon expr without the context of a contructor call |
17:08:30 | krux02 | sorry I mean quote |
17:11:47 | krux02 | so that I can say myObjConstr.add quote nnkObjConstr do: `myIdent` : `mySymbol` |
17:12:46 | krux02 | dom96, I don't think that another abstraction/different-view on how to generate syntax trees is going to help anybody |
17:21:56 | demi- | dom96: if you have a minute, i ran into what seems to be a nasty bug with nimble last night |
17:23:49 | dom96 | demi-: sure, i'm here |
17:26:10 | dom96 | krux02: 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:50 | dom96 | It 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:24 | dom96 | Writing node[0][4][i][2] isn't very clear |
17:28:23 | demi- | 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:38 | dom96 | So it's srcDir = "src" vs. srcDir = "src/" |
17:31:48 | dom96 | i.e. the `/` makes it fail? |
17:31:57 | * | Tiberium joined #nim |
17:32:08 | demi- | yeah |
17:32:24 | demi- | if you do a clear install of a package it fails in the same manner |
17:32:57 | demi- | the paths that get resolved in that stack-trace are identical except for the trailing slash on the directory name as well |
17:33:44 | dom96 | Report it please. It sucks but it's not too serious. Do you agree? |
17:34:04 | dom96 | (Feel free to link to the IRC logs in your issue) |
17:34:18 | krux02 | dom96, well for me it turned out that I neve use those names, because they are not visible from treeRepr |
17:34:33 | demi- | ok, i spent an inordinent amount of time trying to figure out what i was doing wrong last night |
17:34:54 | krux02 | dom96, anything that cannot be inferred from treeRepr I tend to just not use at all |
17:35:02 | krux02 | for example all thos constructor procs |
17:35:14 | dom96 | demi-: If Nimble fails with anything other than a NimbleError then that's a bug. |
17:35:47 | demi- | ok i'll open a new issue |
17:35:55 | dom96 | krux02: Not sure what you mean. What "names" are you referring to? |
17:36:03 | krux02 | I 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:59 | Araq | that might be a valuable advise. rather than adding more arbitrary AST constructors we could improve treeRepr's output to be more helpful |
17:38:48 | dom96 | oh |
17:38:57 | * | dom96 just got what you meant |
17:39:49 | dom96 | If `quote` gets significantly better we won't need constructor procs. |
17:40:44 | krux02 | yes |
17:41:10 | Araq | what's wrong with 'quote'? |
17:41:31 | dom96 | Maybe nothing today. I haven't used it in too long. |
17:41:33 | krux02 | Araq, it always returns a stmtList |
17:41:47 | dom96 | I can't remember the limitations I faced. |
17:42:05 | krux02 | whenever I want to use it for something else I have to index into the result |
17:42:07 | Araq | you know you can write your own 'quote', right? |
17:42:15 | krux02 | let tmp = quote do: ... |
17:42:25 | krux02 | tmp[1][2][3] ... |
17:42:31 | Araq | krux02: gotcha. |
17:42:59 | dom96 | Araq: Let's not encourage hundreds of 'quote' implementations. |
17:43:02 | Araq | but again, write your own quote and once it's pleasant, contribute it back to macros.nim |
17:43:15 | Araq | dom96: not my point. |
17:43:29 | Araq | my point is: it doesn't require compiler support. |
17:43:46 | dom96 | Okay, so ask people to improve it. |
17:43:48 | Araq | the current quote is only a builtin to make it faster to process |
17:44:23 | Araq | ofc we never benchmarked it. zahary thought I would be concerned about compile times and so he added it as builtin |
17:44:52 | krux02 | I wrote it earlier, but I thought of something like this: quote nnkObjConstr do: a : `someValue` |
17:45:22 | krux02 | and I think that one does compiler assistence |
17:45:36 | krux02 | because the argument would not be parsable without giving context |
17:46:38 | Araq | macros.quote doesn't parse anything either |
17:46:39 | dom96 | Why does it need the 'do' keyword btw? |
17:47:01 | Araq | dom96: because of a grammar deficiency. already on our roadmap, remember? |
17:47:43 | dom96 | I must be missing something, it doesn't take two stmtLists, does it? |
17:49:36 | * | ludocode quit (Ping timeout: 240 seconds) |
17:52:10 | krux02 | well currently I am very busy with fixing the emacs nim-mode |
17:53:12 | dom96 | I would say that while there is room for improvement it's already good enough. |
17:54:59 | * | zachcarter joined #nim |
17:55:41 | dom96 | So fixing it is low priority. |
17:59:34 | * | zachcarter quit (Client Quit) |
18:08:20 | * | elrood quit (Quit: Leaving) |
18:08:46 | krux02 | reactormonk, what is nim-compile-command-checker-functions for? |
18:08:57 | krux02 | it's undocumented and unused |
18:09:05 | krux02 | and makes my life hard |
18:15:00 | jivank_ | created a simple file server with jester https://github.com/jivank/nim-simplefilemanager/blob/master/simplefilemanager.nim |
18:15:08 | vivus | Araq: 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:13 | jivank_ | maybe it will become a manager in the future |
18:19:07 | Sentreen | I'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:47 | jivank_ | dom96 is there some sort of lazy readFile? |
18:20:58 | jivank_ | not sure if that would help though |
18:22:02 | dom96 | jivank_: that is what async file essentially is |
18:23:46 | reactormonk | krux02, I have no idea. :-( |
18:23:55 | reactormonk | delete them and see what happens ^^ |
18:24:06 | reactormonk | (make sure to restart emacs / unset the function) |
18:24:27 | vivus | where is the 're' library for nim hosted? I find nothing on github |
18:25:01 | * | nsf joined #nim |
18:25:26 | dom96 | vivus: in the stdlib |
18:27:36 | * | brson quit (Ping timeout: 240 seconds) |
18:28:42 | Sentreen | Okay, 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:15 | vivus | dom96: 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:27 | dom96 | var matches: array[MaxSubpatterns, string] |
18:37:34 | dom96 | IIRC |
18:38:03 | vivus | dom96: so I need to explicitly create an openArray ? |
18:38:11 | dom96 | We have the whole regex spec in the documentation for 're' but no actual examples of the module... |
18:38:27 | dom96 | vivus: yeah. |
18:38:36 | krux02 | reactormonk, that is what I am doing |
18:38:45 | vivus | once I can figure it out, I will gladly add examples to all the libs I am using |
18:39:01 | dom96 | vivus: that would be brilliant :) |
18:39:02 | krux02 | it seems to be complicating things unnecessarily |
18:39:39 | * | dmi0 joined #nim |
18:40:18 | krux02 | how does the project structure of nim projects really work |
18:40:39 | krux02 | I mean when I have a project, how do I detect it, and how do I compile it? |
18:40:43 | dom96 | vivus: If you do please make the examples short. Similar in style to the ones in: https://nim-lang.org/docs/httpclient.html |
18:41:14 | vivus | dom96: within a proc, what is the difference of saying proc foo(s : string, box: var openArray[string]) ? why does box get "var" ? |
18:41:28 | dom96 | There 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:37 | krux02 | nim-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:01 | Tiberium | waaait, 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:03 | Tiberium | just WOW |
18:42:28 | dom96 | vivus: The proc 'foo' is able to modify the `box` parameter |
18:42:53 | dom96 | Tiberium: Nice. But why are you paying so much attention to the size? |
18:43:00 | vivus | dom96: 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:13 | dom96 | vivus: I agree. |
18:43:15 | Tiberium | dom96, because you can't simply distribute a program in python for example |
18:43:19 | Tiberium | it will be huge |
18:44:08 | vivus | Tiberium: isn't python universal on most OSes? you could distribute just the script |
18:44:17 | dom96 | vivus: Long examples are also not good because users are almost always looking for how to do a specific task. |
18:44:20 | Tiberium | vivus, except for Windows :) |
18:44:23 | dom96 | Scanning through a long piece of code is not easy |
18:44:30 | Tiberium | vivus, and there's also need to install packages |
18:44:36 | Tiberium | and users can have different python versions etc |
18:45:26 | vivus | dom96: 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:20 | dom96 | vivus: Some of them could be, yes. |
18:46:59 | dom96 | Tiberium: Ahh. :) |
18:47:15 | vivus | I 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:41 | Tiberium | dom96, I've started with social network bot in Nim because I've done it in Python already |
18:47:50 | dom96 | I never think about the size of dependencies, more about their tendency to fail in incredibly annoying ways. |
18:48:15 | Tiberium | https://github.com/TiberiumPY/LOLBot (sorry for russian language and off-topic) |
18:52:13 | dom96 | Tiberium: Cool. Are you rewriting this in Nim? :) |
18:52:22 | Tiberium | dom96, I want to :) |
18:52:31 | Tiberium | so I will learn some Nim in process |
18:52:52 | Tiberium | Basically I already have working kernel of the bot |
18:52:58 | Tiberium | But I'm not happy with the code |
18:53:46 | vivus | dom96: 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:54 | dom96 | Tiberium: You'll be using async right? Let me know if you need any help |
18:54:39 | Tiberium | dom96, firstly I'll try to make simple working synchronous implementation. |
18:54:56 | Tiberium | vivus, personally I don't like error handling in Go |
18:55:05 | Tiberium | it seems very... |
18:55:12 | dom96 | vivus: I know I want that. But do a lot of Python coders really also would like to move to Nim? |
18:55:54 | dom96 | Tiberium: Sounds like a good idea. You should be able to use the multisync macro to add an asynchronous implementation easily. |
18:56:20 | Tiberium | dom96, I'll use only httpclient with json I think, so yes |
18:56:43 | vivus | dom96: 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:40 | Tiberium | by the way, is 2 spaces or 4 spaces preferred in Nim? |
18:58:50 | vivus | 2? |
18:58:52 | Vladar | 2 |
18:59:10 | Tiberium | ah, ok |
19:01:07 | dom96 | Regarding Go error handling. I'm the same, I like exceptions. |
19:01:18 | * | hendi joined #nim |
19:01:50 | euantor | I don't mind Go's error handling, though it is repetitive |
19:02:30 | euantor | I 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:44 | dom96 | I prefer Nim's opt-in checked exceptions. |
19:02:52 | federico3 | any lib to generate a gifs? |
19:02:53 | euantor | Though I also like the approach of using checked exceptions like java and Nim |
19:04:35 | * | athaudia quit (Ping timeout: 255 seconds) |
19:04:53 | euantor | Unchecked exceptions are the thing I dislike most about C# |
19:05:43 | * | athie joined #nim |
19:06:22 | dom96 | federico3: 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:33 | Araq | euantor: huh? it's easy to call function() in go and ignore the return value(s). right? |
19:08:46 | Araq | I never heard of it having Nim's explicit "discard" |
19:08:49 | euantor | Yes, but if you want a return value, you have to ignore the error |
19:08:55 | federico3 | dom96: a couple of useful and some toy projects |
19:09:06 | euantor | So if a function returns (x, error), you have to discard `error` (using `_`) |
19:09:22 | euantor | Which is the only good thing about their error model |
19:09:35 | federico3 | generating a little gif animation |
19:10:49 | Araq | so it's easier to ignore errors than exceptions, got it :P |
19:11:24 | Tiberium | is it fine to have two http clients in two modules of one app, or I can reuse them? |
19:11:49 | euantor | It'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:25 | euantor | EG: 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:30 | dom96 | Tiberium: 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:26 | Araq | euantor: never seen this happening. |
19:16:46 | euantor | Lucky you ;) |
19:16:59 | Araq | it's mostly a semiconscious process of getting shit done more quickly :P |
19:17:21 | euantor | I've seen it all too many times in poorly programmed C# libraries |
19:17:45 | Araq | and Java's model is just "ok, I'm logging this exception here" |
19:17:54 | euantor | Usually by people who came from writing old VB6 code, then went to vb.net, then to C# |
19:17:58 | Araq | so everything in Java depends on a logging framework |
19:18:09 | euantor | Which our company has had a couple of |
19:18:30 | Araq | I think logging is a disease. |
19:19:09 | euantor | I think it has its place |
19:19:29 | euantor | But again, I think it depends on what kind of software you work on most of the time |
19:19:54 | euantor | Write what works best for your scenario, and hope that it works |
19:20:25 | Araq | it'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:09 | Araq | if 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:26 | euantor | What if you're logging that your DB's broken? |
19:21:36 | euantor | Good luck putting that in the DB :) |
19:21:46 | Araq | then you fix your DB. |
19:21:47 | euantor | Again, do what works best for your scenario |
19:22:02 | Araq | what if the logging IO operation fails? how do you log that? |
19:22:04 | euantor | And if it's on a remote machine you have no physical access to in morocco? |
19:22:09 | Araq | same problem, logging doesn't solve it. |
19:22:20 | Araq | you use a DB that's local. |
19:22:26 | euantor | No, but at that point your pretty much screwed |
19:22:44 | euantor | The DB is local t the machine that's deployed, it's an embedded system that cannot touch the internet |
19:23:05 | euantor | Anyway, I would say we're going off topic a bit and I don't want to argue |
19:23:32 | vivus | so 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:36 | Araq | vivus: var matches: array[10, string]; let check = match(s, r, matches) |
19:27:48 | vivus | Araq: so you have to define an array of a fixed size ? |
19:28:05 | Araq | you can also use a seq, but why bother |
19:28:24 | Araq | you should know your pattern and the number of captures in it |
19:28:36 | vivus | Araq: when I run the regex to match, I'm not sure how many I will get (consider the data hostile) |
19:28:46 | Araq | that's not how it works. |
19:30:14 | Araq | r(\w+)=(\w+).* matches a=b;c=d but matches only captures a and b |
19:30:34 | Araq | you get the c=d part the next itereation |
19:30:59 | Araq | with the starts int parameter or whatever it's called. |
19:31:05 | vivus | Araq: so as a rule of thumb, should the array size be the size of the database rows? |
19:31:31 | Araq | as a rule of thumb you shouldn't use regexes. |
19:35:52 | * | ludocode_ joined #nim |
19:46:34 | krux02 | args, I made tea for myself, but someone before me abused the container for coffee, now the tea smells horribly like coffee |
19:46:38 | Tiberium | this is that I've written for my bot: https://gist.github.com/TiberiumN/96b252808798af7656d05f2412c0c489 |
19:46:49 | Tiberium | I'm still not happy with that JSON stuff :( |
19:47:17 | Tiberium | (and, be aware, I started learning nim only ~3 days ago) |
19:47:38 | krux02 | Tiberium, well yea but you have experience programming |
19:48:12 | Tiberium | krux02, but not in compiled languages :) |
19:48:19 | krux02 | for me learning nim was mostly learning syntax, and a few new concepts here and there |
19:48:48 | Tiberium | Actually Nim feels like dynamic language sometimes - you don't need to put types everywhere |
19:48:52 | Tiberium | and compiler is very smart |
19:48:52 | krux02 | Tiberium, well compilation is only a mental thing |
19:49:09 | krux02 | the boundary between compiled languages and interpreted ones in blurry |
19:49:15 | krux02 | in the middle in julia |
19:50:05 | Tiberium | I have a question - how I need to format long definitions of object instances (like MessageUpdate in mainLoop() in main.nim) |
19:50:18 | Tiberium | The way I've formatted it, or there's another styling preferred for Nim? |
19:50:18 | krux02 | and python also has the preference to poop pyc files everywhere but still likes to call itself interpreted :P |
19:51:18 | dom96 | MessageUpdate( |
19:51:20 | dom96 | foo: 42 |
19:51:21 | dom96 | ) |
19:51:40 | Tiberium | dom96, ah, ok |
19:51:40 | dom96 | Also, you should put all your types under one type section |
19:51:43 | vivus | well my code compiles and runs, but my regex is not loved :P |
19:51:50 | Tiberium | dom96, thanks |
19:52:24 | dom96 | Tiberium: Why aren't you happy with the JSON? |
19:52:28 | krux02 | Tiberium, the types in one type section has the advangage that within one type section the types can reference each other |
19:52:39 | Tiberium | dom96, I thought it's a bad code |
19:52:46 | krux02 | with different types sections you can only reference previous types |
19:52:59 | Tiberium | but yeah, I know that processing JSON in compiled languages is hard |
19:53:17 | dom96 | Does this work? event.extract(_, msgId, flags, peerId, ts, subject, text, attaches) |
19:53:27 | krux02 | this is horrible this tea just smells like coffee, think I have to throw it out, I can't enjoy it :( |
19:53:47 | dom96 | Didn't realise `_` could be used like that. Did I accidentally implement this or did somebody else explicitly implement support for this feature? |
19:53:54 | Tiberium | dom96, it works for me via unpack package? |
19:54:13 | Tiberium | I've also used this underscore in Python |
19:54:17 | demi- | i've used that in nim a bunch |
19:54:29 | demi- | as a "discard this element because i don't want it" |
19:54:37 | Tiberium | in python it may be _, _, useful_data, _ = some_tuple |
19:54:49 | dom96 | unpack package? |
19:54:51 | Tiberium | yeah |
19:54:54 | dom96 | got a URL? |
19:54:56 | Tiberium | but wait |
19:55:26 | dom96 | Yeah, I am aware that it works for tuple unpacking |
19:55:49 | dom96 | But this is as a proc param |
19:55:52 | * | Trustable quit (Remote host closed the connection) |
19:56:00 | demi- | O_o |
19:56:06 | dom96 | or maybe, extract is a template? |
19:56:18 | Tiberium | dom96, oh wait |
19:56:21 | vivus | Araq: did I get the formatting wrong: var reg2 = re"<a href=\\.*? style=\\.*?\\>.*?<\/a>" ? |
19:56:25 | Tiberium | It's a macro that I've copied |
19:56:33 | Tiberium | Second answer here - http://stackoverflow.com/questions/31948131/unpack-multiple-variables-from-sequence |
19:57:06 | dom96 | vivus: Tony the Pony is coming. |
19:57:27 | dom96 | Why are you parsing HTML using regex? |
19:57:35 | dom96 | Use htmlparser |
19:57:40 | Tiberium | And in what order I should define variables? constants first, then let's, and after that typical vars? |
19:58:05 | vivus | dom96: because this is what I am looking for in the DB :) specific patterns of text |
19:58:32 | Tiberium | by the way: it would be a nice small addition to have automatic url encoding in httpclient |
19:58:55 | Tiberium | and possibility to pass query parameters :) |
19:58:58 | dom96 | vivus: hrm, alright. Does that snippet not compile? |
19:59:24 | * | rauss quit (Ping timeout: 260 seconds) |
19:59:28 | vivus | dom96: it compiles and executes. I can show you the full code if you are interested? |
19:59:35 | dom96 | Tiberium: That would be a nice addition to the uri module (if it's not already in there). PRs encouraged :) |
19:59:49 | dom96 | vivus: I guess it doesn't give you the result you expect? |
20:00:05 | dom96 | What pattern should that be? The `\\` look suspicious to me |
20:00:22 | vivus | dom96: it shows me the else part of my if/else (which is fuark :) ) |
20:00:48 | dom96 | Tiberium: The order only matters in the global scope in my opinion. |
20:01:08 | * | rauss joined #nim |
20:01:14 | vivus | dom96: <a href=\"http://somesite.net/\" style=\"text-decoration:none;color:#676c6c\">Link</a> |
20:01:18 | dom96 | Tiberium: And for that case the order you mentioned sounds alright |
20:02:02 | dom96 | vivus: I'm a bit lost now :) |
20:02:16 | vivus | dom96: do you use sublime text? |
20:02:26 | dom96 | nope |
20:02:34 | dom96 | VS Code mostly nowadays |
20:02:41 | vivus | do you use any text editor that does regex checking? |
20:02:55 | dom96 | Never seen that in a text editor |
20:03:26 | vivus | I am 99% certain my pattern matches. verified it as well |
20:06:08 | * | zachcarter joined #nim |
20:06:09 | dom96 | vivus: are you using the find or the match proc? |
20:06:15 | vivus | match |
20:06:24 | Tiberium | And what's preferred max line length in Nim? |
20:07:43 | demi- | i think that is personal preference |
20:08:03 | demi- | but there is very few things that yield long lines in nim |
20:08:07 | dom96 | vivus: try 'find' |
20:08:41 | dom96 | Max len is 80 for the stdlib/compiler |
20:10:18 | vivus | lots of code mods dom96 :P now the mind is tired :P |
20:11:06 | dom96 | Araq: Any chance you could give https://github.com/nim-lang/Nim/issues/5589 a look? |
20:20:08 | Araq | I replied. |
20:21:06 | Araq | I 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:21 | krux02 | ./koch tools -> Error: cannot open 'tools/nimsuggest/nimsuggest.nim' |
20:21:30 | Araq | krux02: nim c koch |
20:22:03 | krux02 | ok thanks it works now |
20:24:33 | dom96 | Araq: What do you mean? The bug report includes source code. |
20:27:30 | * | hcorion joined #nim |
20:29:21 | vivus | Araq 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:48 | Araq | dom96: sorry, I really missed that then :-) |
20:30:20 | dom96 | vivus: Did you try 'find'? |
20:30:31 | vivus | dom96: yep, same problem |
20:30:46 | dom96 | did you try getting rid of the '\\'? |
20:31:40 | krux02 | well 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:04 | krux02 | and this process buffer shows this: Process epc:server:5 finished |
20:32:12 | krux02 | the server just dies |
20:33:34 | vivus | dom96: yep, that too. my mind is doing a SEGFAULT now :P |
20:36:24 | vivus | dom96: the non-matching doesn't make sense to me because nim supports PCRE |
20:37:36 | * | rauss quit (Quit: WeeChat 1.7) |
20:38:24 | dom96 | vivus: this seems to work: <a\ href=.*\ style=.*>.*<\/a> |
20:38:30 | dom96 | The spaces need to be escaped, weird. |
20:38:34 | dom96 | Maybe there is a re option for that |
20:38:45 | vivus | heh |
20:38:52 | dom96 | (The best way to figure out what's going on is to reduce the regex pattern until it does work) |
20:40:23 | vivus | dom96: can you copy/paste your code in zerobin please? |
20:41:14 | dom96 | I hope gist is fine: https://gist.github.com/dom96/091bc3e8526844e7f6bdcc4bb1aa3083 |
20:42:30 | krux02 | well the best way to test regular expressions, is with eithe vim the / (search) or in emacs with re-builder |
20:42:58 | krux02 | not default vim I guess |
20:43:08 | krux02 | maybe neovim highlights all matches |
20:43:30 | vivus | krux02: sublime supports it also |
20:44:16 | krux02 | all you need is to have highlighting of all matches and a fill with all cases you want to cover |
20:44:40 | krux02 | then you can realtime edit the regular expression and see how the highlight changes |
20:44:49 | dom96 | That doesn't help in this case |
20:45:00 | dom96 | Unless vim/whatever follows the same rules that 're' does |
20:49:44 | krux02 | what does epc stand for? |
20:50:26 | vivus | no idea what is going on with re now. |
20:51:54 | vivus | trimmed it down to: var reg2 = re"<a.*>.*<\/a>" |
20:54:05 | krux02 | I really feel a bit stinding in the rain, when I want to fix problem with nim mode |
20:54:47 | dom96 | PMunch: I submitted your article (I think it's yours at least) to HN, hope you don't mind :) |
20:58:45 | Tiberium | Is it fine to have one types.nim file? |
20:58:54 | Tiberium | so all types are stored there |
21:00:17 | Tiberium | it doesn't work for me for some reason... |
21:00:45 | krux02 | Tiberium, it should be |
21:00:46 | dom96 | Sure it's fine. But do whatever works. |
21:00:52 | vivus | how are you importing? |
21:00:58 | Tiberium | vivus, at the top of the file |
21:01:01 | Tiberium | import types |
21:01:06 | Tiberium | should I include instead? |
21:01:40 | Tiberium | I have 3 files, main.nim, types.nim, api.nim main.nim imports types.nim and api.nim, api.nim imports types.nim |
21:02:11 | dom96 | So a basic version of my little snake game is working: http://picheta.me/snake/ |
21:02:16 | dom96 | Let me know your thoughts :) |
21:03:09 | Tiberium | dom96, very nice game |
21:03:17 | Tiberium | I played up to 10 score |
21:03:21 | Tiberium | ah |
21:03:23 | Tiberium | it's endless |
21:03:48 | dom96 | Yeah, maybe i'll add other levels in the future |
21:04:30 | dom96 | Glad you think it's nice :D |
21:04:37 | Tiberium | so for some reason compiler can detect that I've imported type, but can't detect it's field |
21:04:38 | Tiberium | hm |
21:04:41 | krux02 | it.s a bit easy |
21:04:52 | dom96 | Tiberium: Did you export the field? |
21:05:03 | Tiberium | dom96, I didn't export, I just exported objects? |
21:05:12 | dom96 | Tiberium: You need export each field as well |
21:05:27 | dom96 | krux02: Snake typically is in the early game |
21:05:41 | dom96 | krux02: But i'm open to ideas on how to make it more challenging earlier |
21:05:50 | vivus | nice game |
21:05:52 | Tiberium | dom96, so place a star for every field? |
21:05:54 | krux02 | yes it's cool |
21:05:58 | krux02 | it easy and fun |
21:06:05 | dom96 | Tiberium: yeah |
21:06:12 | dom96 | Tiberium: field*: string |
21:06:16 | Tiberium | I understand |
21:06:25 | vivus | the most clear example for snake would be for making the snake go faster after each bob it eats |
21:06:34 | Tiberium | dom96, do I need to do the same for enums? |
21:06:40 | Tiberium | thanks god no |
21:06:42 | dom96 | vivus: Yep, that's what happens. |
21:06:55 | vivus | doesn't feel like it got faster |
21:07:06 | dom96 | vivus: Maybe I made it a bit too subtle |
21:07:15 | dom96 | But it definitely gets faster |
21:07:24 | krux02 | snake always reminded me of the game I played when I was very young: http://s.uvlist.net/l/y2012/01/92323.jpg |
21:07:38 | dom96 | It moves every (200ms - score) |
21:08:11 | krux02 | it's basically snake with nondeadly walls keys doors traps and different things to collect |
21:08:25 | dom96 | krux02: cool, never seen it before. |
21:08:39 | krux02 | well it is also hard to google for it |
21:08:51 | krux02 | it's called VEGI and exists only in German |
21:09:04 | krux02 | but in that game language doesn't really matter |
21:12:08 | hcorion | @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:18 | krux02 | it's basically a lost game |
21:12:22 | hcorion | Score of 50 btw |
21:12:36 | dom96 | Yeah, will fix that :) |
21:13:33 | krux02 | reactormonk, when you are still online, you can merge my pull request in nim-mode |
21:13:50 | krux02 | or check if you are ok with the changes |
21:14:02 | dom96 | I can't remember my high score but I definitely got to at least 80. |
21:14:34 | dom96 | Source 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:50 | Xe | Why does the {.procvar.} pragma exist? |
21:15:55 | Xe | procvar pragma |
21:15:56 | Xe | The procvar pragma is used to mark a proc that it can be passed to a procedural variable. |
21:18:15 | dom96 | Xe: https://irclogs.nim-lang.org/15-09-2016.html#18:02:52 |
21:18:50 | dom96 | And related issue https://github.com/nim-lang/Nim/issues/2172 |
21:19:09 | dom96 | There 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:33 | Tiberium | how can I catch SIGINT and SIGTERM? |
21:22:40 | Tiberium | to end my app gracefully |
21:22:52 | dom96 | A nice project might be using markov chains on the IRC logs to answer Nim questions |
21:23:21 | dom96 | Tiberium: https://nim-lang.org/docs/system.html#setControlCHook, |
21:23:43 | krux02 | dom96, that is how I feel when I enter the #emacs channel |
21:24:02 | krux02 | they do it |
21:24:16 | dom96 | they use markov chains? |
21:24:44 | krux02 | I don't know if they use markov chains, but just do /join #emacs and ask a what is question |
21:26:18 | Tiberium | haha |
21:27:13 | dom96 | I tried :P |
21:27:48 | * | kier quit (Remote host closed the connection) |
21:28:03 | hcorion | Very cool |
21:28:29 | dom96 | hcorion: https://github.com/nim-lang/nimbot |
21:28:32 | dom96 | Help welcome :) |
21:29:02 | * | kier joined #nim |
21:29:07 | vivus | dom96: if you can create a tar.gz dump of the logs until end-2016, someone might be able to work on that |
21:30:02 | vivus | the problem with answering a question on IRC is "where does the answer end?" |
21:30:13 | Tiberium | wait, does nim ssl module depends on system openssl library? |
21:30:18 | Tiberium | or it's embedded into binary? |
21:30:33 | dom96 | vivus: They're available online in JSON-ish format: https://irclogs.nim-lang.org/04-02-2017.logs |
21:30:50 | dom96 | Tiberium: System openSSL unfortunately |
21:31:01 | Tiberium | dom96, ah, dynamic loading |
21:31:26 | krux02 | NimBot, how are you? |
21:31:32 | krux02 | hmm |
21:31:32 | Tiberium | NimBot, hi |
21:31:49 | krux02 | NimBot doesn't seem to respond very well |
21:31:52 | vivus | NimBot: sudo rm -rf / |
21:32:07 | dom96 | !ping |
21:32:07 | NimBot | pong |
21:32:10 | dom96 | !lag |
21:32:10 | NimBot | 1ms between me and the server. |
21:32:31 | vivus | !nimble |
21:32:43 | krux02 | !beer |
21:32:46 | dom96 | That's about all the commands it knows really |
21:32:57 | dom96 | Adding a dictionary would be easy (hint hint) |
21:33:11 | vivus | !ping |
21:33:11 | NimBot | pong |
21:33:31 | krux02 | well I know that the emacs bot get's updates from the channel |
21:33:33 | hcorion | Sure is good at ping pong |
21:33:43 | krux02 | when the bot doesn't know something they can tell him |
21:34:13 | dom96 | Yeah. It's a simple "dictionary" feature |
21:34:31 | dom96 | You could implement a !set command for NimBot |
21:34:37 | dom96 | !set nimble Nimble is awesome |
21:34:41 | dom96 | !nimble |
21:34:44 | dom96 | >Nimble is awesome |
21:34:55 | hcorion | But only allow certain people to set it |
21:35:26 | dom96 | of course |
21:35:44 | vivus | am I allowed to write the IRC bot in python for the nim channel? |
21:35:52 | Xe | no |
21:35:59 | Xe | that goes against the point of it |
21:36:05 | dom96 | Why would you? |
21:36:21 | hcorion | There is already a nim bot written in Nim |
21:36:23 | vivus | shipping to market |
21:36:32 | vivus | MVP :P |
21:36:35 | dom96 | Extending NimBot should be trivial |
21:36:55 | krux02 | the bot should detect what is questions |
21:36:57 | hcorion | Yeah, nice clean code |
21:37:08 | hcorion | What is love? |
21:37:18 | vivus | there is an easy way to achieve what dom96 said without using intense mathematics/deep-learning |
21:37:22 | krux02 | how do I compile nimsuggest in debug mode (with stack traces)? |
21:37:48 | dom96 | nim c nimsuggest isn't possible? |
21:37:49 | vivus | the bot just needs to detect when a question is asked |
21:38:09 | krux02 | I build nimsuggest with koch |
21:38:40 | dom96 | And it needs to reply to hcorion's question with "Baby don't hurt me" |
21:38:58 | dom96 | That feature is a must :) |
21:39:33 | dom96 | But honestly, writing an IRC bot in Nim should be a breeze |
21:39:34 | hcorion | With emojis! Baby don't hurt me |
21:39:40 | Tiberium | Is 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:46 | dom96 | hcorion: OOOH YES :D |
21:40:05 | vivus | until your bot needs to actually detect when this "?" is used |
21:40:18 | dom96 | Tiberium: You mean you want to load pre-compiled plugins at runtime? |
21:40:29 | krux02 | well my font doesn't have those emojis |
21:40:32 | Tiberium | dom96, no, no, I will compile them all at the same time |
21:40:40 | vivus | nor mine krux02 |
21:40:45 | Xe | Tiberium: why not compile them into the app then? |
21:40:50 | hcorion | You should get better fonts |
21:40:56 | Tiberium | Xe, I'm asking how to do this better |
21:40:57 | krux02 | but I can do this: ✔✘†€‣♠♥♦⊂∫∀∈∃∀∈∃Σ√ΛℂΩ×ιαοωχεακψλχοηπβσj{`}/{([]^…_›[₁₂₃♀♂♀⟨⚥⟨₀⟩∅∝∞∥∡→∨∧⊥∡∥∨∧⊥∡∧⊥∡¹²³›³›¢›‹¢‚‘ |
21:41:16 | Xe | Tiberium: why do you think that loading .so files is better than loading the final binary? |
21:41:30 | Tiberium | Xe, nooo |
21:41:31 | vivus | Xe: how is your regex? |
21:41:43 | krux02 | aren't so files just binaries? |
21:41:45 | Xe | vivus: (not!good) |
21:41:45 | Tiberium | Xe, I mean, I will compile all plugins with the main app, so they'll be in one binary |
21:41:53 | vivus | was worth a try :P |
21:41:54 | Xe | oh i see waht you mean |
21:42:16 | dom96 | Tiberium: Well... I'm not sure there is any examples of that. |
21:42:36 | dom96 | If you show how you would implement it in Python I might be able to help |
21:42:59 | jivank_ | by default --gc:markAndSweep is used? |
21:43:15 | Xe | Tiberium: 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:58 | dom96 | jivank_: nope |
21:44:10 | Xe | Tiberium: you want something like this though right? https://gist.github.com/Xe/382817a00026f5eb68554c482c946e83 |
21:44:29 | Tiberium | Xe, yeah |
21:44:49 | Tiberium | Xe, so my plugins will subscribe to commands or some other events |
21:45:34 | Xe | Tiberium: you need some kind of "default" global bot command demux or something |
21:45:43 | Xe | kinda like how Go's net/http.DefaultServeMux works |
21:49:07 | dom96 | jivank_: I asked Araq earlier to look into your issue and I think he will once he gets a chance. |
21:49:39 | dom96 | oh would you look at that. My HN submission is on the front page :D |
21:50:26 | hcorion | Which one? |
21:51:03 | dom96 | Check the front page and you'll see |
21:51:09 | hcorion | http://serv.peterme.net/devlog/cross-platform-guis-and-nim-macros.html |
21:59:04 | vivus | I'm calling it now, someone in an HN comment will say "wow, what a cool language, never heard of nim before" |
21:59:12 | hcorion | Issue for automated responses for nimbot: https://github.com/nim-lang/nimbot/issues/13' |
22:00:56 | dom96 | hcorion: Nice! Thanks :) |
22:01:24 | dom96 | vivus: hah yes. |
22:02:19 | jivank_ | 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:34 | dom96 | Somebody submitted John Novak's blog post as well and it's also on the front page. |
22:03:02 | dom96 | jivank_: Yeah. I'm pretty sure both are affected by the same bug. |
22:03:14 | dom96 | Unused memory simply isn't freed. |
22:03:25 | krux02 | hcorion, I just read the article, that is very interesing and I do like it |
22:03:59 | krux02 | except that this site requires javascript so that I can read the blog |
22:04:19 | krux02 | should not be a requirement |
22:04:35 | dom96 | John Novak's blog post is nice too http://blog.johnnovak.net/2016/05/29/cross-platform-gui-trainwreck-2016-edition/ |
22:04:38 | dom96 | (Another Nim user) |
22:04:45 | dom96 | Also, his blog looks awesome. |
22:04:56 | Tiberium | is there a list on what packages from stdlib are support on JS target (not emscripten)? |
22:05:21 | Tiberium | *are supported |
22:05:30 | dom96 | Tiberium: Not as far as I know. |
22:05:36 | Tiberium | dom96, for example httpclient |
22:05:59 | dom96 | I can probably name the modules which /do/ support JS |
22:06:08 | dom96 | There isn't many |
22:06:22 | dom96 | hrm, well no, maybe I can't |
22:06:34 | dom96 | I was surprised a while back that deques worked fine |
22:06:42 | dom96 | But httpclient doesn't support it |
22:06:45 | dom96 | definitely |
22:07:13 | hcorion | Does it work with emscripten? |
22:07:24 | * | vlad1777d quit (Remote host closed the connection) |
22:07:27 | Tiberium | I think httpclient isn't that hard to port to JS |
22:07:38 | dom96 | hcorion: no idea |
22:07:59 | dom96 | Tiberium: I don't think it can be fully supported (in the web browser) |
22:08:06 | Tiberium | dom96, just simple get |
22:09:12 | dom96 | That might be easy to get working. |
22:09:29 | * | brson quit (Ping timeout: 260 seconds) |
22:09:33 | dom96 | I'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:04 | Tiberium | is memory that massif reports - real memory usage of my app? |
22:43:37 | * | vivus quit (Quit: Leaving) |
22:44:15 | Tiberium | it says my app (bot) used ONLY 20kb's of heap |
22:44:21 | Tiberium | (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:03 | krux02 | dom96, maybe you can help me |
23:25:17 | krux02 | what is the best pattern to detect a project root? |
23:25:39 | krux02 | my projects are all customized with whatever works |
23:25:51 | krux02 | but I don't know how to properly detect a project root |
23:26:10 | krux02 | I need a project root specification |
23:26:42 | dom96 | what do you mean by "project root" |
23:26:44 | dom96 | ? |
23:27:27 | demi- | this is about nimsuggest isn't it? |
23:27:28 | krux02 | well I mean the important argument to pass to the nimsuggest process |
23:27:33 | krux02 | demi-, yes |
23:27:41 | krux02 | I try to fix nimsuggest for emacs |
23:28:08 | krux02 | the current state of nim-mode is more like no maintenance anymore |
23:28:30 | demi- | it doesn't seem that difficult at all |
23:28:38 | krux02 | well then you can answer me |
23:28:53 | krux02 | at seems there are some weird patterns |
23:28:58 | krux02 | project/project.nim |
23:29:01 | demi- | there is a directory that has a nim.cfg or .nimble file that is the top-most directory |
23:29:10 | krux02 | project.nim + project.nim.cfg |
23:29:16 | krux02 | project.nimble |
23:29:43 | krux02 | well there can also be the project.nim.cfg |
23:29:57 | * | adeohluwa quit (Remote host closed the connection) |
23:30:06 | demi- | yeah there are 3 patterns, what is so complicated about this? |
23:30:20 | krux02 | demi-, the question is, it that all? |
23:30:27 | krux02 | what about nakefile |
23:30:36 | krux02 | and project.nims |
23:30:37 | demi- | nakefile isn't a language supported thing |
23:30:44 | demi- | that is a third party project |
23:32:36 | krux02 | demi-, what is with the nimscipt variant of nimble? |
23:32:47 | demi- | hm? |
23:33:04 | demi- | you mean nimble tasks? |
23:33:30 | Tiberium | can I output the name of the filename where exception happened? In except block |
23:34:10 | demi- | Tiberium: yeah, look at https://nim-lang.org/docs/system.html#instantiationInfo, |
23:37:14 | * | Tiberium quit (Remote host closed the connection) |
23:41:51 | FromGitter | <TiberiumPY> Thanks |
23:44:35 | krux02 | didn't nimble once introduce the "new" format for package descriptions that was a .nims file? |
23:46:21 | krux02 | well I got an answer, yes nimble has a nimscipt fromat but the file is still called .nimble |
23:50:23 | dom96 | indeed |
23:51:43 | dom96 | This project file business seems like it should just be handled by Nimsuggest |
23:51:49 | zachcarter | wewt frag has texture atlas / spritesheet support now |
23:52:05 | dom96 | Assuming that the finding of this file always follows the same algorithm (and it seems it does) |
23:53:57 | krux02 | args, it feels there are 20 different implementations of find project root in nim-mode |
23:54:05 | krux02 | the code really is bad quality |
23:54:33 | krux02 | dom96, well not really |
23:54:56 | krux02 | dom96, when I need to find the root of a project manually otherwise nimsuggest doesn't work |
23:55:32 | krux02 | dom96, 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:07 | dom96 | but why couldn't nimsuggest find the project root on its own? |
23:57:42 | * | rauss joined #nim |
23:58:36 | * | yglukhov joined #nim |