00:08:50 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
00:11:58 | * | gokr quit (Ping timeout: 240 seconds) |
00:22:45 | FromGitter | <TiberiumPY> Compiling nim on android now :) via termux |
00:23:38 | ftsf | \o/ |
00:24:21 | FromGitter | <TiberiumPY> Seems bad that there's no nim package in termux, I need to contribute to https://github.com/termux/termux-packages/ |
00:25:09 | * | ftsf has never heard of termux before |
00:25:59 | FromGitter | <TiberiumPY> It' like an terminal emulator, but with its own repository |
00:26:19 | FromGitter | <TiberiumPY> it doesnt require root |
00:26:21 | * | BitPuffin|osx quit (Ping timeout: 260 seconds) |
00:29:38 | jivank_ | TiberiumPY you could probably compile nim in termux with gcc |
00:30:16 | FromGitter | <TiberiumPY> Yeah |
00:30:30 | ftsf | i've just used ConnectBot in the past, quite nice. |
00:30:45 | ftsf | but never really done local development on my android device |
00:30:48 | FromGitter | <TiberiumPY> But how can I pass custom options to build.sh? |
00:31:08 | FromGitter | <TiberiumPY> I need to add -landroid-glob |
00:36:03 | FromGitter | <TiberiumPY> Nevermind |
00:36:13 | FromGitter | <TiberiumPY> SUCESS |
00:36:39 | FromGitter | <TiberiumPY> Now I need to build nim using nim |
00:38:06 | FromGitter | <TiberiumPY> Oh no, koch complains |
00:38:25 | FromGitter | <TiberiumPY> CC: compiler_koch Error: unhandled exception: No such file or directory Additional info: Could not find command: '/bin/sh'. OS error: No such file or directory [OSError] |
00:40:12 | * | rauss joined #nim |
00:41:53 | * | chemist69 quit (Ping timeout: 256 seconds) |
00:45:28 | * | chemist69 joined #nim |
00:48:02 | * | ftsf quit (Ping timeout: 246 seconds) |
00:51:41 | * | ftsf joined #nim |
00:51:48 | * | yglukhov joined #nim |
00:56:11 | * | yglukhov quit (Ping timeout: 264 seconds) |
01:10:07 | FromGitter | <TiberiumPY> Wow, Nim also supports snake_case |
01:10:40 | FromGitter | <TiberiumPY> I find it useful: you can have snake case locally, but commit with camelCase |
01:19:38 | ftsf | i take it you got your nim running on android? |
01:20:57 | FromGitter | <TiberiumPY> Yeah, but I will contribute to Termux packages anyway |
01:23:05 | FromGitter | <TiberiumPY> Hmm seems it can't run |
01:24:48 | FromGitter | <TiberiumPY> The issue is that bash in Termux located in /data/data/com.termux/files/usr/bin/bash (because /bin/bash is root-writable only, and it's not easy to get root on some android phones) |
01:39:13 | * | NimBot joined #nim |
01:52:56 | ftsf | scripts looking for #!/bin/bash ? |
02:10:10 | * | def-pri-pub joined #nim |
02:33:56 | * | brson quit (Quit: leaving) |
02:34:13 | * | shashlick quit (Ping timeout: 260 seconds) |
02:35:17 | * | shashlick joined #nim |
02:39:49 | * | chemist69 quit (Ping timeout: 260 seconds) |
02:53:48 | * | chemist69 joined #nim |
02:56:51 | * | arnetheduck joined #nim |
03:01:06 | * | kunev quit (Ping timeout: 240 seconds) |
03:02:05 | * | kunev joined #nim |
03:13:32 | * | adeohluwa joined #nim |
03:33:08 | * | adeohluwa quit (Quit: leaving) |
03:33:24 | * | adeohluwa joined #nim |
03:41:08 | * | def-pri-pub quit (Quit: leaving) |
05:01:54 | * | rauss quit (Quit: WeeChat 1.7) |
05:09:07 | * | ftsf quit (Quit: :q!) |
05:40:49 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
05:49:01 | * | adeohluwa quit (Ping timeout: 256 seconds) |
05:51:54 | * | APT69 joined #nim |
05:54:36 | * | jackkv quit (Ping timeout: 240 seconds) |
06:07:36 | * | joebo quit (Ping timeout: 240 seconds) |
06:08:06 | * | literal quit (Ping timeout: 240 seconds) |
06:12:48 | * | literal_ joined #nim |
06:12:48 | * | BitPuffin|osx joined #nim |
06:12:58 | * | jackv joined #nim |
06:13:39 | * | joebo joined #nim |
06:20:57 | * | adeohluwa joined #nim |
06:28:18 | * | adeohluw1 joined #nim |
06:31:35 | * | adeohluwa quit (Ping timeout: 264 seconds) |
06:33:03 | * | nsf joined #nim |
06:40:28 | * | xet7 quit (Quit: Leaving) |
06:47:59 | * | adeohluw1 quit (Read error: Connection reset by peer) |
06:50:11 | * | Vladar joined #nim |
07:03:28 | * | NimBot joined #nim |
07:18:27 | * | vlad1777d joined #nim |
07:43:02 | * | bjz joined #nim |
07:50:00 | * | yglukhov joined #nim |
07:57:22 | * | tankfeeder joined #nim |
08:12:36 | * | APT69 quit (Ping timeout: 258 seconds) |
08:15:24 | * | kulelu88 joined #nim |
08:30:16 | * | couven92 joined #nim |
08:32:26 | * | Andris_zbx joined #nim |
09:02:37 | * | couven92 quit (Quit: Client disconnecting) |
09:03:10 | * | couven92 joined #nim |
09:10:08 | * | zachcarter joined #nim |
09:16:27 | * | vlad1777d_ joined #nim |
09:17:33 | * | vlad1777d quit (Ping timeout: 256 seconds) |
09:56:16 | * | kulelu88 quit (Quit: Leaving) |
10:02:21 | * | kulelu88 joined #nim |
10:07:05 | * | bjz_ joined #nim |
10:08:29 | * | bjz quit (Ping timeout: 240 seconds) |
10:25:53 | * | zachcarter quit (Quit: zachcarter) |
10:29:10 | * | kulelu88 quit (Quit: Leaving) |
10:31:54 | * | bjz joined #nim |
10:32:47 | * | bjz_ quit (Ping timeout: 264 seconds) |
10:33:25 | * | vlad1777d_ quit (Remote host closed the connection) |
10:34:45 | * | benido joined #nim |
10:38:17 | * | benido quit (Client Quit) |
10:42:34 | * | literal_ is now known as literal |
10:56:25 | * | sleepy998 joined #nim |
10:57:23 | * | vivus joined #nim |
11:02:09 | sleepy998 | what does 'illegal capture' mean? |
11:02:23 | * | Snircle joined #nim |
11:02:27 | sleepy998 | did the compiler go poaching? |
11:04:34 | * | krux02 joined #nim |
11:05:41 | sleepy998 | i have a proc with object param (mc), used as a member function. mc.foo() the fn sets some members: mc.x = 3, etc. so, does the mc param need to be declared 'var'? |
11:07:28 | sleepy998 | the compiler doesn't mind its absence.. is var just a static type checking thing, or can its absence lead to run time errors? |
11:08:21 | sleepy998 | i assumed i didn't need it, and it's an {.async.} proc.. i added 'var' while chasing a bug and the compiler told me 'illegal capture' |
11:09:27 | Araq | it means it cannot translate 'var T' in an .async context |
11:09:51 | sleepy998 | do i need the 'var'? |
11:09:56 | Araq | no. |
11:10:06 | sleepy998 | ok |
11:10:21 | Araq | not unless the compiler complains about mutablity issues |
11:10:42 | FromGitter | <vegansk> @Araq, I fixed https://github.com/nim-lang/Nim/pull/5580 on windows |
11:23:00 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
11:23:31 | sleepy998 | why can i define procs with the same name and different params, but not the same name and different return type? |
11:25:28 | Araq | because 'let foo = overloadedProcHere()' would be ambiguous |
11:25:54 | Araq | and if your API design makes me write 'let foo: T = overloadedProcHere()', it's a stupid API design. |
11:26:02 | sleepy998 | yeah but it would be so awesome if the compiler let me make it not ambiguous |
11:26:10 | sleepy998 | why? |
11:27:09 | sleepy998 | if the result already has a type defined, there's no need to specify.. if its not overloaded, theres no need to specify.. |
11:27:37 | Araq | but you want to overload it in this fashion. |
11:27:54 | sleepy998 | only sometimes |
11:28:01 | * | couven92 quit (Quit: Leaving) |
11:28:35 | sleepy998 | let foo = initT() vs let foo:T = init() not much different |
11:28:49 | sleepy998 | and gives more versatility |
11:29:49 | Araq | how do you define versatility when 'let foo = init()' is not even possible |
11:30:17 | sleepy998 | only impossible if init is overloaded |
11:31:08 | Araq | "let's do A, it will only cause harm when it's actually used" is not an argument for me. |
11:31:22 | sleepy998 | i suppose that could be a pain, adding an import to existing code, causing a new overload, breaks existing code.. hmm. |
11:31:34 | stisa | isn't overloading on return a planned feature? See https://github.com/nim-lang/Nim/issues/1070 |
11:32:26 | Araq | it's definitely not gonna make it into v1 and I think it's a bad idea in general. |
11:32:47 | Araq | note that I never said anything in this thread. |
11:33:51 | Araq | we don't need more ways to write constructors. the initT vs newT is simple, already everywhere and flexible. |
11:34:20 | Araq | and it avoids the "factory" problem that's always overlooked by the alternative proposals. |
11:37:53 | * | zachcarter joined #nim |
11:42:47 | * | Tiberium joined #nim |
11:44:16 | * | bjz joined #nim |
11:49:30 | zachcarter | whoa setting up cygwin and mingw-w64 is a PITA |
11:49:39 | zachcarter | I forgot why I hate developing on windows so much |
11:50:43 | * | Salewski joined #nim |
11:53:07 | Salewski | Araq, nimsuggest highlight command seems to give no info for keywords or comments at all, and "<" is reported as a template. |
11:53:20 | Salewski | That may make text coloring not very easy. |
11:53:47 | zachcarter | Does anyone in here use Windows for Nim dev? |
11:54:33 | Salewski | zachcarter: I think Araq does! |
11:54:53 | * | Tiberium quit (Remote host closed the connection) |
11:55:06 | zachcarter | no shit... |
11:55:07 | cheatfate | zachcarter, check appveyor.yml in Nim's github repo |
11:55:08 | * | Tiberium joined #nim |
11:55:13 | zachcarter | okay |
11:55:20 | stisa | zachcarter I do, but I just download mingw w64, click install, add to path and it works. Maybe I'm doing simpler things than you |
11:55:29 | cheatfate | you will obtain link, you will obtain what you must to do with PATH and you will get it |
11:55:40 | zachcarter | gotcha thanks all |
11:55:56 | zachcarter | I’m trying to test out my game framework on all OS’s |
11:56:08 | * | byte512 joined #nim |
12:01:48 | zachcarter | cheatfate: thank you for that link it’s perfect, question since you’re a contributor |
12:02:21 | zachcarter | I need to set up a CI solution for my project that has nim installed along with nimble and nake |
12:02:30 | zachcarter | would you recommend staying away from Travis? |
12:02:37 | zachcarter | I’ve heard horror stories |
12:02:43 | cheatfate | why? Travis is one of the best |
12:03:09 | zachcarter | okay if it’s good enough for you guys it’s good enough for me then |
12:03:26 | zachcarter | I’ve just heard solutions like gitlab’s seem to be superior |
12:03:33 | zachcarter | and people often struggle hard with Tavis |
12:03:35 | zachcarter | Travis* |
12:03:52 | cheatfate | You can ask Araq about gitlab :) |
12:03:53 | zachcarter | but I don’t have a lot of first hand experience with either, minimal with both |
12:03:56 | zachcarter | ahahaha okay |
12:04:10 | zachcarter | we’re already on github anyway so we’ll go with Travis :P |
12:04:10 | cheatfate | Travis for Linux/MacOS and appveyor for Windows |
12:04:17 | zachcarter | okay thanks |
12:04:35 | zachcarter | I may be borrowing that appveyor script |
12:04:37 | cheatfate | and still looking for CI for BSDs |
12:04:48 | zachcarter | thank god I don’t have to support bsds |
12:04:48 | * | couven92 joined #nim |
12:04:51 | cheatfate | zachcarter, there other work based on appveyor.yml |
12:05:16 | cheatfate | https://github.com/nim-lang/Nim/wiki/BuildServices |
12:05:31 | zachcarter | ahh thank you |
12:05:42 | cheatfate | but this version uses `release` version of Nim |
12:05:49 | cheatfate | not `devel` |
12:05:56 | zachcarter | okay |
12:06:07 | zachcarter | yeah I’ll definitely need devel |
12:06:28 | zachcarter | regardless thanks for pointing me to that I should be able to cobble together something |
12:07:28 | * | BitPuffin|osx quit (Ping timeout: 240 seconds) |
12:07:43 | Araq | saleswski I don't remember how highlight works, sorry |
12:07:57 | Araq | I think VS Code uses 'outline' instead |
12:08:20 | Araq | oh and of course keywords and comments are not nimsuggest's business at all |
12:08:21 | Salewski | Araq, do you not use it for your nimedit? |
12:08:44 | Araq | we could support it now after my recent changes |
12:08:58 | Araq | but in the past nimsuggest didn't touch the Nim lexer |
12:09:09 | Salewski | Outline command seems to give only an overview. |
12:09:18 | Araq | so anything the lexer knows is lost in nimsuggest |
12:10:19 | Araq | I personally find highlighting that goes beyond the lexing step more confusing than helpful and editors can the lexing much faster than nimsuggest |
12:10:22 | Salewski | I was thinking indeed about highlighting keywords locally, by using a hash table lookup. But it is not fully accurate. |
12:11:42 | Araq | highlighting that reflects what the language does at the lexical level is helpful. highlighting that renders types different from vars (for example) means your highlighter conflated different language spec levels. |
12:11:59 | Salewski | Indeed, the gtksourceview highlight is fine already. I just tested nimsuggests highlight just for fun. |
12:14:10 | Salewski | Do you know how fast a highlight query is for nimsuggest? It transfers very many data, so it may take a more than a millisecond? |
12:15:47 | Araq | yup. |
12:16:04 | Araq | don't run it on every single keystroke to highlight tokens |
12:17:07 | Salewski | Yes, I have to think about it. One single keystroke can change much in some cases... |
12:17:19 | Salewski | I will do some testing, bye. |
12:18:24 | * | Salewski left #nim (#nim) |
12:19:41 | * | elrood joined #nim |
12:20:03 | * | krux02 quit (Remote host closed the connection) |
12:20:46 | * | krux02 joined #nim |
12:28:37 | vivus | in: https://nim-lang.org/docs/db_mysql.html should I use raw SQL statements to search for text in specific columns ? |
12:32:18 | Araq | not sure what that means. use ? in your query and substitute the search term(s) |
12:33:11 | vivus | Araq: to clarify, should I use db.exec(sql()) to search or are there built-ins in the library ? |
12:35:28 | FromGitter | <brechtm> Is there something in Nim similar to Python's context managers (with statement)? |
12:36:31 | Araq | brechtm: use a template with body: untyped as the last parameter |
12:37:30 | Araq | vivus: exec doesn't even return anything. use for x in theDb.fastRows(sql"select * from myTestTbl"): |
12:37:30 | Araq | echo x |
12:37:45 | Araq | which is part of the "Larger Example" on that very page you linked |
12:38:08 | FromGitter | <brechtm> Araq: that doesn't make much sense to me at this point :-) But it'll do as a starting point, thanks! |
12:39:00 | Araq | vivus: but point taken, we should have a "Retrieving data" section |
12:39:27 | vivus | Araq: that is good enough for me. will use that as a basis to understand more |
12:47:49 | * | zachcarter quit (Quit: zachcarter) |
12:48:05 | * | sleepy998 quit (Quit: http://www.kiwiirc.com/ - A hand crafted IRC client) |
12:48:17 | krux02 | I want to veryfy that visual studio code does not work properly with nim-include files, but I can't get the nim-plugin installying |
12:48:31 | krux02 | I press install, but it just doesn't finish |
12:48:49 | krux02 | is there a way, that I can see progress/log of the install of a visual studio code plugin? |
12:49:05 | couven92 | krux02, Help -> Toggle Developer Console -> Console |
12:49:46 | couven92 | or maybe it's Developer Tools, i'm not sure... but do a string.startsWith compare of all menu items and search for strings starting with Developer :P |
12:50:29 | couven92 | Ah! It's "Toggle Developer Tools" |
12:52:25 | krux02 | well I found it, and I have a German VSCode |
12:52:46 | krux02 | but the console doesn't print anything from the install process |
12:53:14 | krux02 | the button that was install is on 'installing' but it just doesn't finish |
12:57:22 | couven92 | really? :O That's weird... I had some problems a while back (before I came up with vccexe)... But I could then clearly see my the erroneous configuration of system that led to the error |
12:57:39 | couven92 | I'm uninstalling Nim from VS Code now... let's see... |
12:58:16 | FromGitter | <brechtm> What editor offers the most IDE-like experience (code navigation, debugger) for Nim at this moment? |
12:58:28 | * | djellemah quit (Remote host closed the connection) |
12:59:02 | couven92 | @brechtm I'd say VS Code |
12:59:04 | FromGitter | <brechtm> I'm trying VSCode now, which looks promising. Haven't tried debugging yet. |
12:59:19 | FromGitter | <TiberiumPY> *really* I dream about good NIM plugin for IntelliJ IDEA. Yeah, IntelliJ IDEA is big, full-blown IDE with JVM |
12:59:38 | FromGitter | <TiberiumPY> But, for example in Python world PyCharm is the most used Python IDE |
12:59:49 | couven92 | I have plans for NimVS for Visual Studio! But that may take some weeks... :P |
13:00:03 | FromGitter | <brechtm> Attempting to debug, I get these kinds of error messages: "undefinedBFD: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_macosx.a(arclite.o): unknown load command 0x2d" |
13:00:05 | Tiberium | couven92, sadly there's no Visual Studio for linux :( |
13:00:17 | Tiberium | only vscode |
13:00:19 | FromGitter | <brechtm> But I probably just need to build debug binaries |
13:00:30 | couven92 | Tiberium, it's getting there though... Considering that we have VS for Mac |
13:00:43 | Tiberium | couven92, yeah, I believe there will be VS for linux too |
13:01:10 | Tiberium | because if you want to choose a full-blown IDE for any popular language - it will be an IDE from JetBrains most of the time |
13:01:17 | Tiberium | (I mean on Linux) |
13:02:19 | couven92 | I can see that... Well, I have the luxury that I have always developed on Windows and that I mainly program in C#... And I have to say: VS and C# on Windows is AWESOME! |
13:02:49 | Tiberium | couven92, btw, there's new C# IDE from JetBrains |
13:03:21 | krux02 | well nim plugin for visual studio code is still installing |
13:03:21 | couven92 | Yeah... I have seen it... Not thoroughly looked at it yet, though |
13:03:25 | krux02 | doesn't seem to finish |
13:03:57 | krux02 | I can tell you, when you develop enough, then a good idea becomes less important for you |
13:04:27 | krux02 | on linux the best 'IDE's are still emacs and vim if you have configured them correctly |
13:04:28 | couven92 | krux02, do you have nimsuggest in you path? what Nim version are you using?... I'm not really sure whether that is relevant, but let's find the easy reasons first... :P |
13:04:37 | FromGitter | <brechtm> Do I only need `--debuginfo` to build a debug binary? |
13:04:49 | krux02 | i have nimsuggest in my path an nim in development branch build yesterday |
13:04:55 | couven92 | hmm... |
13:05:19 | couven92 | does it state the nim compiler headline in the devloper tools console? |
13:06:04 | couven92 | Mine says sth like: Nim Compiler Version 0.16.1 (2017-03-01) [Windows: amd64] |
13:06:04 | couven92 | and so on... |
13:06:25 | krux02 | well the plugin doesn't install, so no |
13:06:34 | Tiberium | couven92, wait, my VSCOde Nim plugin is working, but I don't have nimsuggest. If I install it, how can I add it to VSCode? |
13:06:49 | krux02 | http://ix.io/pco |
13:06:56 | couven92 | Tiberium, I think the Nim Plugin actually builds it's own nimsuggest |
13:06:59 | krux02 | but that is command line |
13:09:38 | krux02 | couven92, I hope not |
13:09:49 | couven92 | Hmm... you're right... The install of the plugin is remarkably silent... |
13:09:57 | krux02 | I have nimsuggest, and I don't want the plugin to use something else that my system nimsuggest |
13:10:09 | couven92 | and my computer it just magically works... :/ |
13:10:17 | * | djellemah joined #nim |
13:10:59 | couven92 | krux02, maybe log an issue on https://github.com/pragmagic/vscode-nim |
13:11:11 | krux02 | that is what I just wanted to do |
13:11:32 | couven92 | Hmm... because I have no better idea |
13:15:47 | * | user0___ joined #nim |
13:16:09 | Tiberium | how can I add 'nake' to path if I installed it from nimble? |
13:16:39 | couven92 | On Linux: export PATH=$HOME/.nimble/bin:$PATH |
13:16:52 | Tiberium | couven92, thanks |
13:17:29 | FromGitter | <brechtm> anyone debugging with gdb on macOS? |
13:17:51 | couven92 | Tiberium, not that this will add ALL nimble package binaries into your PATH! :P (But yeah, you'd want that anyways) |
13:17:57 | FromGitter | <brechtm> Apple is making stuff diffuclt again... |
13:18:00 | couven92 | s/not/note |
13:18:01 | Tiberium | couven92, I know it :) |
13:18:09 | Tiberium | I also installed latest Nim compiler and added it to path |
13:18:15 | Tiberium | (it fixed one nimx issue for me) |
13:18:22 | chemist69 | Hi, does anyone know of a nim library to extract plain text from html? |
13:19:06 | krux02 | ok, the issue is now submitted |
13:19:07 | krux02 | https://github.com/pragmagic/vscode-nim/issues/47 |
13:19:23 | krux02 | chemist69, regular expressions? |
13:19:50 | chemist69 | now I have two problems... ;-) |
13:19:56 | couven92 | :D |
13:20:04 | Tiberium | wait, nim supports path / path syntax? |
13:20:09 | chemist69 | I had hoped for a slightly more higher level solution |
13:20:18 | Tiberium | dir / filename |
13:21:20 | krux02 | chemist69, maybe you can translate html with pandoc to txt |
13:21:27 | krux02 | never tried it, but maybe that is what you want |
13:21:45 | chemist69 | krux02: good idea, thanks. |
13:22:04 | FromGitter | <Jeff-Ciesielski> Tiberium: Yes. the `os` module provides a `/` proc which aliases joinPath |
13:22:23 | FromGitter | <TiberiumPY> @Jeff-Ciesielski wery nice |
13:23:02 | Tiberium | hmm, I'm trying to install nimsuggest |
13:23:04 | Tiberium | it fails |
13:23:18 | krux02 | Tiberium, it should be bundled with nim |
13:23:23 | FromGitter | <Varriount> Isn't nimsuggest bundled with nim now? |
13:23:32 | Tiberium | ah I see |
13:23:36 | couven92 | yup |
13:23:38 | chemist69 | I thought nimsuggest is part of Nim nowadays, it is installed automatically. |
13:23:46 | couven92 | @Varriount, yes it is |
13:24:02 | FromGitter | <Varriount> It's not installed with Nimble, it's just in ./tools |
13:24:19 | couven92 | chemist69, no, it itsn't, you'll still have to run `koch tools` to build nimsuggest |
13:24:41 | FromGitter | <Varriount> Is `koch tools` documented? |
13:24:51 | chemist69 | ok, right, yeah I have a script that does that every time I update Nim. |
13:25:28 | Tiberium | how can I install compiled nim system-wide? |
13:25:51 | couven92 | @Varriount, well depends... If you run `koch --help` it says: `tools builds Nim related tools` |
13:26:33 | couven92 | Tiberium, on Linux: `./koch geninstall && sudo ./install.sh` |
13:26:52 | Tiberium | couven92, thanks again :) |
13:27:30 | krux02 | can I disable linenoise in nimsuggest? |
13:27:47 | couven92 | (Proceed with caution though! Maybe split it it up into two commands, I am a Windows guy giving suggestion on how to do stuff on Linux!!! :P ) |
13:28:16 | couven92 | krux02, what's linenoise? |
13:28:50 | krux02 | well that is a very poor library that lets you input a line on the command line |
13:29:11 | krux02 | normally gnu readline is used, but for licensing issued, it was replaced by linenoise. |
13:29:33 | krux02 | but linenoise doesn't even have basic file completion |
13:29:56 | krux02 | would prefer to have no line editor and start nimsuggest with rlwrap |
13:30:11 | krux02 | rlwrap is a shell script that wraps any program to use gnu readline |
13:30:29 | krux02 | as long as it doesn't do anything on it's own to provide line editing |
13:32:46 | couven92 | Hmmm... Ask Araq? |
13:32:50 | couven92 | :P |
13:33:11 | Tiberium | very newbie question, but how to pass html from httpclient.getContent to parseHtml in htmlparse? |
13:33:55 | FromGitter | <brechtm> great, got debugging to work in VSCode! |
13:34:28 | couven92 | @brechtm Cool! On Linux using the GDB integration? |
13:34:48 | FromGitter | <brechtm> @couven92 macOS using GDB |
13:35:25 | onionhammer | nim has a gitter now!? :-O |
13:35:37 | FromGitter | <brechtm> Needed to codesign the gdb executable though (https://sourceware.org/gdb/wiki/BuildingOnDarwin) |
13:35:41 | krux02 | well I can enable linenoise for "nim secret" |
13:36:05 | krux02 | that means "rlwrap nim secret" is awesome |
13:36:16 | FromGitter | <brechtm> can't see any variables though... |
13:36:18 | couven92 | Nice! :) I think step-by-step debugging using the VS Debugger in Windows is possible, but probably a long way down the road... I'll have to set aside time to write my MSc. as well I am afraid... :/ |
13:36:30 | demi- | brechtm, i would highly recommend not using GDB |
13:36:38 | demi- | use LLDB instead |
13:36:57 | * | zachcarter joined #nim |
13:37:10 | krux02 | brechtm: you can have some gdb support, when you put some python scripts |
13:37:13 | couven92 | demi-, that uses LLVM? |
13:37:16 | cheatfate | demi-, could i ask you for help |
13:37:27 | cheatfate | ? |
13:37:33 | FromGitter | <brechtm> @demi- why, and how would I go about it (a webpage reference would be fine) |
13:37:56 | krux02 | I don't think you want to fuzz with that stuff, but I one did something to get gdb know a bit more about nim, but very far away from being ready |
13:37:57 | demi- | couven92: yeah, GDB is not officially supported on OS X anymore, been that way for ages. LLDB comes with the xcode command line tools, which you presumably have for building nim and homebrew stuff |
13:38:27 | krux02 | https://github.com/krux02/opengl-sandbox/blob/master/includes/nim-gdb.py |
13:38:27 | couven92 | Hmm... interesting... |
13:38:30 | demi- | cheatfate: sure, what's up? (don't have much time atm but can answer what i can) |
13:38:45 | krux02 | https://github.com/krux02/opengl-sandbox/blob/master/includes/debug.nim |
13:38:56 | krux02 | the last file to embed the python script into the executable |
13:39:05 | krux02 | does only work on systems with elf files |
13:39:09 | cheatfate | demi-, i need your debugging skills on macos, to resolve coroutine's fail on tests/coroutines/twait.nim |
13:39:17 | krux02 | I think that just excludes windows |
13:39:47 | demi- | heh, cheatfate if it is alright with you i might need to postpone that to a bit later, about to go look at some apartments so will be AFK for a bit. |
13:40:00 | cheatfate | ok |
13:40:13 | demi- | but i'd be happy to help with what i can |
13:40:56 | krux02 | apple is very fast at dropping support for things that basically everybody relies on |
13:41:04 | FromGitter | <brechtm> @demi- Nice, using lldb-mi in VSCode does list variables |
13:41:17 | krux02 | flash, openGL, gdb, ... |
13:41:35 | FromGitter | <brechtm> thanks for the tip |
13:42:14 | demi- | krux02: apple hasn't officially supported GDB for like 10 years? |
13:42:18 | FromGitter | <brechtm> inspection of object attributes doesn't seem to be possible... |
13:42:26 | demi- | this isn't new |
13:42:30 | cheatfate | demi-, thanks |
13:42:42 | * | yglukhov quit (Remote host closed the connection) |
13:42:46 | Tiberium | how can I make httpclient to output page body as utf8? |
13:42:46 | krux02 | demi-, well the latest openGL version that apple supports is 7 years |
13:42:53 | krux02 | whatever that means |
13:43:18 | Tiberium | cyrillic text looks like this: � ������� ����������� |
13:43:38 | krux02 | Tiberium, what http client? |
13:43:39 | * | byyte512 quit (Quit: WeeChat 1.7) |
13:43:42 | demi- | brechtm, other thing i would suggest is ensuring you have debugging info enabled with the nim compiler |
13:43:47 | Tiberium | krux02, nim's httpclient |
13:43:50 | Tiberium | source code - http://pastebin.ca/3784890 |
13:43:56 | Araq | httpclient doesn't output text |
13:44:04 | FromGitter | <brechtm> @demi- `--debuginfo`? |
13:44:12 | Tiberium | Araq, not exactly httpclient |
13:44:14 | * | yglukhov joined #nim |
13:44:19 | Tiberium | Araq, http://pastebin.ca/3784890 how can I output utf8 text there? |
13:44:26 | demi- | you should be able to get everything as you would get it in C, variables object introspection, breakpoints in the nim code, etc |
13:44:33 | demi- | brechtm, yeah i believe that is it |
13:45:50 | FromGitter | <brechtm> @demi- no difference with or without `--debuginfo`... so I must be doing something wrong |
13:47:13 | flyx | Tiberium: well the URL you query returns its data with header „Content-Type:text/html; charset=windows-1251“ |
13:47:14 | FromGitter | <brechtm> But I'm building using a nakefile. I'll first try with a test file. |
13:47:20 | Tiberium | flyx, ah |
13:47:22 | demi- | sorry i would need to have a better idea of what you are doing and what you expect, i'm not familiar with vs-code's lldb integration so i don't know what i can say about that; i have personally used it from the command line w/o issue |
13:47:28 | Tiberium | flyx, so how can I decode it? |
13:47:32 | Tiberium | and encode to utf8 |
13:48:02 | flyx | Tiberium: you can use the package encodings |
13:48:17 | Tiberium | flyx, I found it on the forum already, thanks :) |
13:49:27 | Tiberium | flyx, works, many thanks! |
13:51:14 | couven92 | krux02, btw, are form Aachen? I couldn't help but notice the RWTH IP when you joined earlier... |
13:51:42 | krux02 | yes I am in Aachen RWTH |
13:51:53 | krux02 | why? |
13:52:14 | couven92 | nice... I grew up there and did my Abitur in Aachen before I moved to Norway |
13:52:16 | couven92 | :) |
13:52:42 | krux02 | Well I live here since I made my Abitur :) |
13:53:04 | flyx | although arguably, this is a bug in htmlparser. parseHtml transforms entities to UTF-8-encoded characters, so it better transformed the rest of the content into UTF-8 |
13:53:07 | krux02 | but I never know that people would remember ip addresses and where thay are from |
13:53:31 | couven92 | well for you it says: 178-169.eduroam.rwth-aachen.de |
13:54:04 | couven92 | pretty obvious! :) And if you're a student things like eduroam automatically stand out :P |
13:54:11 | krux02 | ok, that is obvious |
13:54:49 | krux02 | I like eduroam |
13:54:50 | flyx | eduroam is also for scientists, not just for students ;) |
13:55:01 | krux02 | I hated it in the beginning, because it was a pain the the ass to set up |
13:55:07 | krux02 | especially on linux |
13:55:11 | krux02 | it just always failed |
13:55:25 | krux02 | but now it does work and it also works for example in Holland |
13:55:54 | flyx | my university managed to fix the process for Linux, Windows and Mac. now we can just go on a website, download stuff and it works |
13:55:57 | couven92 | yup... eduroam is nice! Especially here in Norway, where eduroam router are also setup at all kinds of public places... Every Airport in Norway has eduroam! |
13:56:17 | FromGitter | <brechtm> @demi- I'm seeing variables names T1_, T2_ etc. |
13:56:26 | FromGitter | <brechtm> (running lldb from the command line now) |
13:56:38 | Tiberium | just curious, is there telegram channel for Nim programming? |
13:56:55 | couven92 | Telgram has channels? :O |
13:57:34 | flyx | why is it that people are so interested in having additional channels on other chat services |
13:57:50 | couven92 | Yeah... IRC FTW!!! :D |
13:59:17 | couven92 | PMunch and I (we're TAs here at UiT) try to push out students to use IRC... It's our official help and support channel in the subjects where we teach! :P Some students comply... :D |
14:00:00 | flyx | my students just drop by at my office |
14:00:16 | flyx | or write Mails |
14:01:06 | couven92 | well, ours do to... But there are times (usually around 2 a.m.) where we aren't in our office) |
14:03:11 | Tiberium | flyx, because IRC isn't so popular right now :( |
14:04:56 | * | rauss joined #nim |
14:06:38 | * | themagician joined #nim |
14:09:10 | * | vlad1777d joined #nim |
14:10:58 | flyx | Tiberium: we had that discussion and there's the Gitter room which is bridged here |
14:11:08 | Tiberium | flyx, I know |
14:11:11 | krux02 | yea irc is weird here and there |
14:11:38 | krux02 | there is no thumb sized button to join the channel |
14:11:51 | krux02 | you have to type /join #<channel-name> |
14:13:11 | krux02 | and then you can't just use pictures in the chat |
14:13:39 | FromGitter | <brechtm> @demi- passing `--debuginfo` doesn't make a difference for me. In the global scope, all variables are named "T1_", "T2_", ... In the local scope, they have the name I assigned, but (ref) object's attributes cannot be inspected. |
14:13:51 | krux02 | but emoji's do work, if the other side has the right font (which they don't) |
14:14:09 | flyx | krux02: it's accessible. people with command-line clients see the picture's URL, people with fancy clients see the picture |
14:14:33 | krux02 | what clients do support pictures? |
14:14:39 | flyx | Textual |
14:14:48 | krux02 | I have hexchat |
14:14:55 | flyx | the other fancy OSX client as well, though I don't remember the name |
14:14:59 | flyx | Linkinus, was it |
14:15:51 | krux02 | I can't find those in the AUR |
14:15:58 | flyx | well they are OSX only |
14:16:10 | krux02 | well that does not help very much |
14:16:25 | krux02 | I mean I sit in between two unused imacs |
14:16:31 | FromGitter | <brechtm> @demi- plain objects can be inspected though |
14:16:38 | flyx | I guess people wanting fancy IRC clients are expected to use Macs. |
14:16:56 | flyx | perhaps there are alternatives, but I don't know about them |
14:18:14 | flyx | anyway, we're going quite off-topic |
14:18:20 | * | lounge-user82 joined #nim |
14:18:51 | lounge-user82 | krux02 here, trying out another client can you send me nude pics please? |
14:19:48 | krux02 | lounge-user82, random image: https://raw.githubusercontent.com/wiki/ocornut/imgui/web/code_sample_01.png |
14:20:04 | lounge-user82 | oh year it works, thank you |
14:20:16 | * | lounge-user82 quit (Client Quit) |
14:20:25 | krux02 | yea sorry for spamming here |
14:21:25 | * | BitPuffin|osx joined #nim |
14:21:39 | krux02 | Is there documentation about nimsuggest? |
14:22:20 | Tiberium | I know this is too much for a compiled language, but will be there some fancy formatting like f'{a+b}' in Python? so maybe these expressions will be unpacked at compile-time |
14:24:17 | stisa | There's https://nim-lang.org/docs/nimsuggest.html |
14:29:27 | stisa | Tiberium : like https://nim-lang.org/docs/strutils.html#%,string,openArray[string] ? your example would be " $1 " % [$(a+b)] I think |
14:30:25 | Tiberium | stisa, oh, thanks, but something like "#{a+b}" looks cleaner :) anyway, as I said, it's too much for a compiled language |
14:32:20 | flyx | Tiberium: you can write a macro to do something like that |
14:32:28 | Tiberium | flyx, wow |
14:35:37 | stisa | well, $(a+b) would stringify the result of a+b, the problem is if you want "result: $(a+b)" you have to do "result:" & $(a+b) or something like that |
14:43:31 | def- | Tiberium: https://lyro.bitbucket.io/strfmt/ |
14:46:06 | * | nhywyll joined #nim |
14:47:08 | * | nhywyll quit (Client Quit) |
14:48:46 | federico3 | "interp" is really nice |
14:50:52 | couven92 | krux02, Araq tasked med with re-writing the nimsuggest documentation the day before yesterday... |
14:51:56 | couven92 | I'll get to it as fast as I can, meanwhile you can mind-merge https://nim-lang.org/docs/nimc.html#nim-idetools-integration and https://nim-lang.org/docs/nimsuggest.html to get a better understanding of what nimsuggest can do |
14:53:34 | couven92 | otherwise go to nim-lang IRC logs and see Araq and me discussing nimsuggest on https://irclogs.nim-lang.org/21-03-2017.html#08:32:51 |
14:53:54 | krux02 | well from the command line I can actually get the correct output from nimsuggest for my file |
14:54:05 | krux02 | it is just that the information I got was simply wrong |
14:54:12 | Araq | Tiberium: f"{a+b}" is a macro away |
14:54:32 | krux02 | I could not just pass the path of the project I needed to pass the exact root file of the project otherwise it did not work |
14:55:07 | * | brson joined #nim |
14:55:25 | Tiberium | Araq, but I'm a newbie, I think this will be too hard for me:) |
14:55:34 | flyx | Tiberium: proof of concept: https://gist.github.com/flyx/21623fabc89e84f0dbc3dd7e225bc227 |
14:55:38 | krux02 | and when I press Ctrl+D in interactive mode, nimsuggest becomes weird |
14:55:46 | Tiberium | flyx, wow |
14:56:17 | Tiberium | flyx, wait, will this evaluate at runtime or at compile-time? |
14:57:00 | Tiberium | it actually works like python's |
14:57:08 | FromGitter | <andreaferretti> tiberium, as others have mentioned, the macro was already written: https://lyro.bitbucket.io/strfmt/#how-interp-works |
14:57:16 | flyx | Tiberium: the last line gets rewritten at compile time to `echo "$1 + $2 = $3" % [$a, $b, $(a + b)]` which will be evaluated at runtime |
14:57:59 | krux02 | I also hava a macro like that: https://github.com/krux02/opengl-sandbox/blob/master/includes/macroutils.nim#L78 |
14:58:17 | vivus | the more time you spend here, the more you realize that nim is likely to move towards Pythons direction in terms of code simplicity |
14:58:20 | * | Nobabs27 joined #nim |
14:59:07 | krux02 | well I do not only care about code simplicity, but I do also care about performance |
14:59:24 | krux02 | and I do not like very much that the printing creates a lot of temporary strings |
15:00:16 | def- | flyx: no, interp is transformed to fmt and fmt is also evaluated at compile time: https://lyro.bitbucket.io/strfmt/#how-fmt-works |
15:00:18 | couven92 | krux02, so you don't like format strings in C's printf either? |
15:00:47 | flyx | def-: I am talking about my code |
15:01:15 | def- | flyx: ah, ok |
15:02:37 | * | couven92 quit (Quit: Client disconnecting) |
15:02:53 | * | couven92 joined #nim |
15:03:23 | * | tankfeeder quit (Quit: Leaving) |
15:03:33 | flyx | this was more for showing how it's done. it obviously is not production-quality |
15:08:07 | * | nsf quit (Quit: WeeChat 1.7) |
15:08:26 | Araq | parseutils.interpolatedFragments |
15:08:36 | Araq | pity that nobody is aware of it ;-) |
15:12:30 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
15:13:45 | krux02 | couven92, I think format strings in C are fine, because they work without temporary strings |
15:14:13 | couven92 | hmmm... |
15:14:14 | krux02 | all arguments of printf are passed as the argument itself, they are not first converted to a temporary string |
15:14:17 | couven92 | I see... |
15:15:26 | Araq | krux02: thats an argument for system.echof :-) |
15:15:44 | krux02 | a lot of temporary strings consume time for allocation, and because they still are allocated on a garbage collected heap, they also consume time for the garbage collector |
15:16:05 | krux02 | I have never used system.echof |
15:18:11 | krux02 | I think the best string interpolation would accept a first argument for output channel |
15:18:23 | Araq | no, it's argument for having something like echof |
15:18:36 | krux02 | the equivalent of sprintf and fprintf |
15:18:39 | Araq | there is no echof in system right now. |
15:18:51 | krux02 | Ah ok |
15:19:06 | Araq | oh sprintf is just addf |
15:19:29 | krux02 | Araq: if it is the addf that I remember, then almost |
15:19:39 | Araq | once concepts land in Nim, it can take a general 'sink' concept |
15:19:45 | krux02 | addf creates temporary strings for all arguments |
15:19:55 | Araq | does it? |
15:20:01 | Araq | it shouldn't |
15:20:27 | Araq | I think we should optimize the array construction |
15:20:35 | krux02 | https://nim-lang.org/docs/strutils.html#addf,string,string,varargs%5Bstring,%5D |
15:21:11 | krux02 | from the documentation varargs[string, `$`], creates a temporary string for each argument |
15:21:35 | Araq | no it does $arg |
15:21:50 | Araq | and $ for strings is a nop |
15:22:20 | Araq | so ok, if you pass integers and floats, it's a bit bad and should be done as a macro then |
15:22:23 | krux02 | for string it is nop, but for integers it is not a nop |
15:22:49 | krux02 | and basically anything else than a string |
15:23:48 | krux02 | it would be fancy if all `$` overrides could magically be used to create a string at the end of another string |
15:24:29 | krux02 | but I doubt it, because the result variable is required to be initialized with at leat "" |
15:25:06 | Araq | yeah, that is in fact still in the planning phase |
15:25:35 | Araq | the problem is that proc x(...; result: var string) can be easily transformed into proc x(...): string |
15:25:44 | Araq | but not the other way round |
15:26:27 | Araq | turning void procs into expressions would be a superb rewrite rule |
15:26:43 | Araq | but it has to be done in the language to be feasible |
15:27:49 | krux02 | and it does not handle format parameters |
15:28:41 | krux02 | I think about a general proc format(out: sink; format: stringview; value T) |
15:30:11 | krux02 | then something like this could be possile stdout.echof("my matrix: \n%2.2$mymatrix \n TADA!!!") |
15:30:53 | krux02 | sink is either `var string` or a stream like stdin/stdout |
15:31:17 | krux02 | strigview is like openarray[char] |
15:31:33 | krux02 | but with the difference that it can point into a string |
15:32:02 | Araq | as if I couldn't imagine |
15:32:03 | krux02 | and in this case it would just be the "2.2" part for ``mymatrix`` |
15:32:35 | krux02 | yea you know, I already made a suggestion for the general pointer size pair |
15:32:44 | krux02 | this would be a nice use case |
15:34:31 | krux02 | And I don't need a concept would be necessary for this feature |
15:36:09 | * | Tiberium quit (Ping timeout: 240 seconds) |
15:37:55 | krux02 | type sink = File | string |
15:38:10 | * | Tiberium joined #nim |
15:43:15 | Tiberium | ok, so I will start learning nim with rewriting my social network bot in Nim (originally it was written in Python) |
15:44:06 | Sentreen | Could it be that the profiler module is broken? Just want to be sure I'm not doing something stupid before I submit an issue. |
15:44:17 | Sentreen | $ nim build -d:release --profiler:on --stackTrace:on dre |
15:44:19 | Sentreen | lib/system/profiler.nim(92, 23) Error: undeclared identifier: 'framePtr' |
15:47:48 | Araq | do you import profiler? |
15:47:53 | Araq | cause you must not. |
15:48:13 | Sentreen | Nope, only nimprof |
15:50:40 | Sentreen | It seems to work for a minmal example though, so there might be something wrong in my nims file |
15:52:05 | yglukhov | there's a bug in profiler. |
15:52:29 | yglukhov | its code should be wrapped into stacktrace:off, afair |
15:53:07 | Tiberium | how can I convert things like \u0414\u0430\u043D\u0438\u0438\u043B to normal string? |
15:53:35 | Tiberium | ah |
15:53:39 | Tiberium | it's because of json |
15:53:39 | Sentreen | yglukhov: Any idea if I can work around this somehow? |
15:55:57 | yglukhov | i managed to fix it a couple of months ago, but never made a pr because it was done on my teammates machine. those changes are lost now. but they were rather trivial. but i dont remember exactly =)) |
16:02:08 | * | yglukhov quit (Remote host closed the connection) |
16:03:51 | Tiberium | That's the preferred paste service for this IRC channel? |
16:04:59 | Tiberium | *What's ? |
16:06:04 | krux02 | def-, I just realized I talked a lot about stuff you aready linked too :/ |
16:06:28 | krux02 | that is pretty exactly what I want in the standard library for nim |
16:06:37 | * | couven92 quit (Quit: Leaving) |
16:06:39 | def- | Tiberium: gist.github.com or pastebin I guess |
16:06:48 | * | couven92 joined #nim |
16:06:54 | Tiberium | Why this code throws an exception? http://pastebin.com/YbK1HPZ9 |
16:07:15 | Tiberium | Error: unhandled exception: node.kind == JObject [AssertionError] |
16:08:01 | Tiberium | I get an exception only if I'm trying to iterate over resp at lines 13 and 14 |
16:08:21 | def- | Well node is probably not a JObject |
16:08:31 | def- | but some other JSON stuff |
16:08:36 | Tiberium | ah |
16:08:38 | cheatfate | krux02, do you know that printf() has limitation on size of generated output? and this limitation can vary for any stdlib/os? |
16:09:01 | * | vlad1777d quit (Ping timeout: 260 seconds) |
16:09:03 | cheatfate | last time i checked windows version is limited to something like 1024-2048 bytes |
16:09:29 | krux02 | no I did not know that |
16:09:39 | krux02 | why is that? |
16:10:03 | cheatfate | because most of printf() implementation has something like char buffer[2048]; inside of function |
16:10:41 | krux02 | and the buffer can not be too big because recently someone told me the stack on windows is only about one MB in size |
16:11:02 | * | arnetheduck quit (Ping timeout: 268 seconds) |
16:11:25 | cheatfate | somebody was wrong... stack of size depends on compiler/linker and information about stack size stored in PE header |
16:11:28 | krux02 | at least i did not have a problem with that yet |
16:12:34 | krux02 | cheatfate, that guy who told it actually knows a lot, but that doesn't protect from being wrong |
16:12:43 | * | nhywyll joined #nim |
16:13:00 | krux02 | but he didn't say it like it was always the case, he was talking about the default |
16:13:21 | krux02 | maybe it is just me who is reflecting it incorrectly |
16:14:03 | cheatfate | right now i have opened 3 PE executables and all 3 has different stack sizes |
16:14:29 | cheatfate | so if you need more you can get more stack easily |
16:16:29 | krux02 | well I never managed stack size |
16:16:38 | krux02 | I neven even looked up any stack size |
16:16:44 | krux02 | it was always just enough |
16:16:56 | krux02 | but I am on Linux, maybe that is a difference |
16:17:35 | FromGitter | <brechtm> Does Nim have an equivalent of Python's super()? |
16:20:53 | krux02 | brechtm, I think you have to use cast ant proccall |
16:21:29 | Tiberium | How to convert JSON object to Nim object? I want to create a library to work with website API |
16:21:40 | krux02 | https://nim-lang.org/docs/system.html#procCall,expr |
16:21:54 | rauss | Tiberium: https://nim-lang.org/docs/json.html |
16:22:27 | Tiberium | rauss, so I need to convert ALL fields manually? |
16:22:38 | krux02 | Tiberium, json alone does not give you types |
16:22:39 | rauss | No idea, I just linked you to it |
16:23:03 | Tiberium | krux02, for example, I want to convert my json to object (so all json's fields will be strings) |
16:23:16 | FromGitter | <brechtm> @krux02 thanks, but that doesn't allow automatically determining the superclass's method? |
16:23:22 | rauss | It's a starting point for what you need, but you might need a light wrapper around it |
16:24:26 | krux02 | there is the fields and fieldPairs iterator |
16:24:41 | * | vlad1777d joined #nim |
16:24:49 | krux02 | so you can use that to set all fields of your types from json |
16:25:21 | krux02 | brechtm, yes you still need to cast manually |
16:25:45 | krux02 | brechtm, I guess you could write a macro that does super for you :P |
16:29:39 | krux02 | macros.getTypeImpl and then in that tree you get you probably have a symbol to the parent object |
16:31:09 | Tiberium | is there any examples of a libraries which do stuff with some JSON web api's? |
16:38:37 | FromGitter | <brechtm> @krux02 should be easy enough, since there is no multiple inheritance... but would I need to search the AST? |
16:39:18 | flyx | Tiberium: you can convert JSON to Nim objects directly with nimyaml.org, look at the JSON example |
16:39:30 | krux02 | just print the treeRepr of the type and then you will see if you can use something |
16:41:20 | Tiberium | flyx, oh, very nice! and what about json like {"response":actual json data} ? |
16:41:32 | Tiberium | sure I can remove it using slices |
16:43:48 | flyx | Tiberium: you mean like, `actual json data` being some deep JSON construct? |
16:44:00 | Tiberium | flyx, yeah |
16:44:11 | Tiberium | simplest example: {"response":[{"id":210700286,"first_name":"Lindsey","last_name":"Stirling"}]} |
16:44:12 | flyx | Tiberium: define a matching type hierarchy in Nim |
16:44:57 | flyx | for example, type Person = object ; id: int ; first_name: string ; last_name: string |
16:45:14 | Tiberium | flyx, yeah I've done that |
16:45:22 | flyx | type MyRoot = object ; response : seq[Person] |
16:45:37 | flyx | and then it just works |
16:46:50 | * | nsf joined #nim |
16:47:00 | FromGitter | <brechtm> @krux02 how do I get a NimNode from a type? |
16:47:43 | demi- | cheatfate: i'm back now |
16:48:17 | flyx | brechtm: getType(int) |
16:48:39 | krux02 | brechtm you have to implement super as a macro |
16:48:51 | FromGitter | <brechtm> thanks! |
16:48:53 | flyx | brechtm: there's also getTypeInst and getTypeImpl depending on what you need |
16:48:53 | krux02 | then you have already a nimNode in your argument |
16:49:10 | krux02 | you should just use getTypeImpl in your case |
16:49:43 | krux02 | getTypeInst is the generic expression of the type and getTypeImpl is the actual implemenation |
16:49:51 | krux02 | and getType should be deprecated |
16:49:55 | krux02 | in my opinion |
16:50:00 | krux02 | no need to keep it |
16:50:49 | FromGitter | <brechtm> doesn't work on refs, I suppose... |
16:50:53 | krux02 | and then you should get an ast that has somewhere a symbol |
16:51:03 | krux02 | brechtm: it does |
16:51:11 | krux02 | you need to have a typed macro |
16:51:21 | FromGitter | <brechtm> Error: request to generate code for .compileTime proc: treeRepr |
16:51:46 | krux02 | yes I told you, you have to implement it in a macro |
16:51:54 | krux02 | you can't operate on nimNode at runtime |
16:52:05 | krux02 | NimNodes don't exist anymore at runtime |
16:52:07 | FromGitter | <brechtm> aha |
16:52:45 | FromGitter | <brechtm> down the rabbit hole... |
16:52:59 | Tiberium | flyx, oh, thanks! |
16:53:03 | krux02 | macro super(arg: typed): untyped = ... |
16:53:15 | * | couven92 quit (Quit: Client disconnecting) |
16:53:31 | Tiberium | thanks god |
16:53:37 | Tiberium | there's JSON schema for this API |
16:53:43 | Tiberium | so I can autogenerate all API types |
16:56:17 | * | Andris_zbx quit (Remote host closed the connection) |
16:57:35 | flyx | Tiberium: you can also tell YAML to ignore parts of the JSON by calling ignoreInputKey(MyRoot, "response") |
16:57:44 | flyx | Tiberium: if you don't need those values |
16:57:56 | Tiberium | flyx, wow, thanks again! I'm not afraid now |
17:00:49 | * | Demos joined #nim |
17:02:10 | FromGitter | <brechtm> @krux02 I'm not sure what I'm doing here: macro super(typ: typedesc): untyped = echo treeRepr(getTypeImpl(typ)) |
17:03:07 | FromGitter | <brechtm> The output produced by "super(Ship)" seems very simple: ⏎ ⏎ ```BracketExpr ⏎ Sym "typeDesc" ⏎ Sym "Ship"``` [https://gitter.im/nim-lang/Nim?at=58d3ffca01bcf42439a5c094] |
17:04:12 | * | brson quit (Quit: leaving) |
17:04:16 | FromGitter | <brechtm> I should read up on macro's... |
17:09:26 | * | Trustable joined #nim |
17:16:13 | * | Demos quit (Ping timeout: 240 seconds) |
17:18:49 | * | couven92 joined #nim |
17:22:13 | * | shashlick quit (Ping timeout: 240 seconds) |
17:24:25 | * | shashlick joined #nim |
17:25:57 | krux02 | brechtm: http://ix.io/pcG |
17:28:37 | FromGitter | <brechtm> @krux02 thanks... doesn't give the same result with C = ref object ... |
17:28:52 | krux02 | that's true |
17:29:21 | krux02 | it might be that you have to write a bit of massage code, to handle ref type cases |
17:30:10 | FromGitter | <brechtm> @krux02 how could I change this to accept an object type name instead of an instance? |
17:30:52 | krux02 | well try it,just try out a lot of stuff |
17:31:03 | krux02 | and echo treeRepr |
17:31:26 | krux02 | what is treeRepr when you pass a typedesc? |
17:32:41 | FromGitter | <brechtm> What I pasted above: BracketExpr / Sym Sym |
17:33:03 | FromGitter | <brechtm> I was thinking getImpl() might be useful here |
17:33:12 | FromGitter | <brechtm> But I'm not getting at the Sym yet |
17:34:17 | krux02 | echo typ.getTypeImpl[1].getTypeImpl.treeRepr |
17:35:50 | FromGitter | <brechtm> ah, got it |
17:36:30 | FromGitter | <brechtm> macro super(typ: typedesc): untyped = ⏎ ⏎ ``` var node = getTypeImpl(typ) ⏎ echo treeRepr(getImpl(node[1].symbol))``` [https://gitter.im/nim-lang/Nim?at=58d4079d01bcf42439a5c115] |
17:37:10 | FromGitter | <Varriount> Don't we already have a super() for methods? |
17:37:25 | FromGitter | <brechtm> ugh, your brackets didn't make it through the IRC-Gitter bridge |
17:39:00 | dom96 | wow, that's weird. It turns it into a link to: https://github.com/sanctuary-js/sanctuary-def#NullaryType |
17:39:03 | dom96 | BlaXpirit: ^ |
17:39:43 | FromGitter | <brechtm> Running late... thanks for AST 101 krux02 ;-) |
17:41:03 | FromGitter | <brechtm> @Varriount no matches for "super" in the manual. Would love to hear about it though. |
17:42:37 | FromGitter | <Varriount> @brechtm Bah. Darn lack of documentation. |
17:43:40 | FromGitter | <Varriount> @Araq What's the Nim equivalent of 'super' for multi-methods? |
17:43:55 | * | Nobabs27 quit (Read error: Connection reset by peer) |
17:44:11 | * | Nobabs27 joined #nim |
17:44:36 | dom96 | typeinfo.base I guess |
17:45:10 | dom96 | I would suggest avoiding methods if at all possible |
17:55:16 | FromGitter | <brechtm> dom96 even if doing OOP? This isn't the first time I hear that recommendation. Why is the feature present? |
17:57:40 | FromGitter | <brechtm> @dom96 How would I use typeinfo.base in practise? Got an example? |
17:59:01 | FromGitter | <brechtm> Oh, nm, the base proc from the typeinfo module of course :-) |
18:00:46 | FromGitter | <Varriount> @brechtm Often, you can use templates/generics instead of the traditional OO mechanisms of inheritance and run-timte overloading. |
18:00:50 | FromGitter | <Varriount> *run-time |
18:01:26 | FromGitter | <Varriount> Also, the current typeinfo module has the defect that it gets the compile-time type of a value, not it's run-time type. |
18:03:12 | FromGitter | <Varriount> For example, if `ref Y` inherits from `ref X`, and you pass a `ref Y` value to a procedure expecting `ref X`, and that procedure uses typetraits to get the type of the parameter, the type will be `ref X` |
18:03:52 | FromGitter | <brechtm> I see. I'll have to explore templates/generics... |
18:04:15 | FromGitter | <Varriount> (Fixing/adding that to the typetraits module would probably be welcome) |
18:07:02 | jivank_ | dom96: on jester's todo list, will sendFile be more efficient than readFile in terms of GC? |
18:12:51 | krux02 | emacs nim-mode stoped working for me today, yay |
18:13:18 | krux02 | I just created an issue about that, but can anybody help me to track that problem down? |
18:13:40 | krux02 | https://github.com/nim-lang/nim-mode/issues/154 |
18:15:23 | dom96 | Varriount: brechtm: A more appropriate alternative would be object variants, not templates/generics. |
18:15:37 | FromGitter | <oprypin> gonna test this again |
18:15:38 | dom96 | jivank_: I don't think so. |
18:15:40 | FromGitter | <oprypin> *<krux02>* echo typ.getTypeImpl[1].getTypeImpl.treeRepr |
18:15:54 | FromGitter | <oprypin> look, it's freakin gitter, not my bot |
18:16:07 | FromGitter | <oprypin> literally turns \[1\] into a random link |
18:16:12 | FromGitter | <oprypin> [1] [2] [3] |
18:16:12 | dom96 | haha |
18:16:29 | dom96 | Wait. |
18:16:42 | dom96 | This seems oddly specific. |
18:16:47 | demi- | does gitter use markdown formatting? |
18:16:51 | FromGitter | <oprypin> yes |
18:16:52 | demi- | because that would do it |
18:17:11 | BlaXpirit | by the way i'm "oprypin" on github |
18:17:14 | zachcarter | is https://github.com/nim-lang/oldwinapi the windows API wrapper I should be using? |
18:17:19 | dom96 | https://gist.github.com/dom96/f26a7c5ffacf10945449ab6d39060a71 |
18:17:25 | dom96 | GitHub doesn't turn it into a link |
18:17:47 | zachcarter | or is there a "newwinapi" |
18:17:51 | BlaXpirit | gitter has a totally different implementation |
18:17:58 | * | Tiberium quit (Remote host closed the connection) |
18:18:04 | dom96 | Of course. |
18:18:12 | * | Tiberium joined #nim |
18:18:43 | * | Jesin quit (Quit: Leaving) |
18:19:16 | dom96 | Looks like all it needs is a dot before or after the [1] |
18:19:28 | krux02 | demi-, I just checked it in my gitter to irc bridge, and there the [1] just works fine |
18:19:45 | krux02 | so it is the representation of the text on gitter, no in the bridge |
18:20:42 | krux02 | if the [1] would have been eaten on the bridge, then I would not be able to see it when I bridge gitter back to irc |
18:20:43 | FromGitter | <oprypin> testing[1] |
18:21:30 | FromGitter | <oprypin> look, basically gitter has a kind of a vulnerability where if you type something\[1\] you get a random link from some previous message. i just typed that example.org link in another gitter channel |
18:21:33 | dom96 | jivank_: Well, maybe, I think Jester just does readFile which is pretty bad when serving large files. |
18:22:03 | jivank_ | dom96: i just tested downloading a 45MB file via public folder, ram went to 200MB. then i called a route that has GC_fullCollect, the ram went to 3MB |
18:22:22 | dom96 | BlaXpirit: I got the "https://github.com/sanctuary-js/sanctuary-def#NullaryType" link again in another channel when doing .1. |
18:22:26 | stisa | zachcarter : there's https://github.com/khchen/winim and I think winlean |
18:22:37 | zachcarter | ah thank you stisa |
18:23:20 | dom96 | *.[1]. |
18:24:54 | jivank_ | is there a way to set a ceiling for the GC? |
18:25:05 | * | Demos joined #nim |
18:25:08 | dom96 | BlaXpirit: Guess I beat you to it? :) |
18:25:14 | BlaXpirit | ye |
18:26:08 | * | Jesin joined #nim |
18:31:39 | demi- | does anyone want to make a nim wrapper for the github api so i don't have to? |
18:33:29 | Tiberium | demi-, make it please, it will be an example for me |
18:33:40 | demi- | :| |
18:33:40 | Tiberium | I want to create a wrapper for social network API |
18:34:00 | demi- | if you want an example, i wrote one for influxdb already |
18:34:21 | Tiberium | demi-, link please? |
18:34:35 | demi- | https://github.com/samdmarshall/influx.nim |
18:38:06 | * | krux02 quit (Quit: Leaving) |
18:41:03 | * | nhywyll quit (Quit: nhywyll) |
18:42:03 | flyx | so I heard demi- will make a nim wrapper for the github api |
18:42:11 | demi- | hahaha |
18:42:29 | demi- | it is so far down the list of things i have to do, but i want one |
18:42:48 | flyx | I am working on moving it further up your list right now. |
18:43:01 | dom96 | lol |
18:45:17 | demi- | neat, so when do you want to sync up on taking over a bunch of my existing projects? :) |
18:47:11 | flyx | we can do it right now. you just read the priority list of your projects to me and then I convince you that each one is worthless of your precious time. then in the end, only the github api wrapper remains. |
18:47:23 | demi- | hahaha |
18:49:20 | rauss | :D |
18:50:42 | flyx | I call this macro social engineering. instead of executing my plan, I explain it to you and that makes you do what would be the conclusion of my plan's execution, even though I didn't actually execute it. |
18:56:09 | * | nsf quit (Quit: WeeChat 1.7) |
18:56:32 | * | Trustable quit (Remote host closed the connection) |
18:56:46 | * | RPG joined #nim |
18:57:09 | * | RPG is now known as Guest10466 |
18:58:02 | * | Guest10466 is now known as scriptum |
18:58:34 | * | scriptum quit (Client Quit) |
18:58:53 | * | scriptum joined #nim |
19:06:30 | * | handlex joined #nim |
19:07:06 | * | couven92 quit (Ping timeout: 240 seconds) |
19:07:06 | chemist69 | Hi, I use VS Code for my Nim coding. For the first time I am looking into threads. I noticed that components from e.g. the channels module (which is implicitly imported) is not recognized by the linter. Does someone have a solution for this? |
19:09:44 | dom96 | chemist69: Maybe putting --threads:on into a yourproject.nim.cfg file |
19:10:24 | chemist69 | ah yes, should have thought of that. Thanks, dom96. |
19:12:22 | Tiberium | chemist69, vscode uses nimsuggest under the hood |
19:12:30 | Tiberium | (for nim) |
19:13:58 | chemist69 | yes, I know that. Linting works great for "normal" code. dom96 had the solution for the problem. |
19:15:26 | chemist69 | on that occasion I also have to say that nimsuggest has greatly improved over the past weeks. Great job! |
19:15:38 | * | Jesin quit (Quit: Leaving) |
19:24:18 | Araq | chemist69: oh thanks :-) |
19:25:55 | * | Salewski joined #nim |
19:26:57 | * | Jesin joined #nim |
19:28:14 | * | Tiberium quit (Remote host closed the connection) |
19:28:23 | Salewski | Araq, when my testfile imports opengl and compiles fine, which name should I give to nimsuggest from command line for checking opengl module? See |
19:28:24 | * | brson joined #nim |
19:28:30 | Salewski | last post in https://forum.nim-lang.org/t/2829/1#17979 |
19:29:07 | Salewski | chk opengl.nim:0:0 does not work |
19:29:51 | Salewski | I think I also tried full path to opengl.nim, but was not working. |
19:30:58 | Salewski | This was related to issue https://github.com/nim-lang/nimsuggest/issues/55 -- I do not really use opengl currently, just testing nimsuggest. |
19:32:46 | Salewski | When testing from within my editor I got that wrong recursive import message |
19:34:02 | Araq | salewski: looking into it. |
19:34:18 | Araq | in theory you handle it the opengl module for checking the opengl module |
19:34:33 | Salewski | Thanks. |
19:35:15 | * | couven92 joined #nim |
19:35:30 | * | zachcarter quit (Quit: zachcarter) |
19:36:00 | * | zachcarter joined #nim |
19:38:03 | * | yglukhov joined #nim |
19:38:19 | * | handlex quit (Quit: handlex) |
19:45:58 | jivank_ | i dont know much about the subject, but would using https://nim-lang.org/docs/asyncnet.html#send,AsyncSocket,pointer,int (send method that takes pointer) be better than the send proc that takes string? memory wise? |
19:46:53 | jivank_ | dom96 |
19:47:41 | dom96 | Not significantly.But your problem is that the memory never gets deallocated, correct? |
19:48:16 | jivank_ | well for example if i wanted to use arduino yun that has 64mb of ram, it wouldn't be able to serve a 45mb file |
19:50:25 | demi- | Araq: fwiw, i tried out the llvm thread sanitizer library and that worked out of the box with nim, afaik. |
19:50:46 | jivank_ | dom96: ideally, if jester could serve files without going over ~10MB of RAM that would be ideal. |
19:51:29 | dom96 | jivank_: I'll see what I can do for you :) |
19:51:55 | jivank_ | dom96 :D |
19:52:18 | * | brson quit (Quit: leaving) |
19:52:47 | jivank_ | i am working on a web filemanager, where you can easily share a folder from any device |
19:53:48 | jivank_ | like python -m SimpleHTTPServer/http.server but little more fancier |
19:57:29 | demi- | having a lower memory footprint would be nice, my instance of jester is now at ~500MB after 4 days of serving content. |
19:58:54 | * | brson joined #nim |
19:59:27 | * | Matthias247 joined #nim |
19:59:50 | def- | demi-: that sounds like a bug |
20:00:01 | def- | if you don't keep growing some seq or something |
20:00:19 | * | user0___ quit (Quit: user0___) |
20:00:31 | demi- | i get a fair amount of traffic, right now it is only serving static content, so it shouldn't be doing anything like that |
20:01:09 | * | user0___ joined #nim |
20:08:57 | * | Trustable joined #nim |
20:09:24 | jivank_ | what frontend js framework do you guys recommend? |
20:09:36 | * | brson quit (Ping timeout: 240 seconds) |
20:09:51 | jivank_ | maybe that is somewhat inline with nim's values, if that exists |
20:14:37 | * | Salewski left #nim (#nim) |
20:15:19 | * | Matthias247 quit (Read error: Connection reset by peer) |
20:16:45 | * | Matthias247 joined #nim |
20:17:13 | * | zachcarter quit (Quit: zachcarter) |
20:18:00 | * | zachcarter joined #nim |
20:20:03 | * | bjz joined #nim |
20:26:13 | * | zachcarter quit (Ping timeout: 240 seconds) |
20:33:10 | dom96 | Well, it still uses a rather large amount of RAM |
20:33:18 | dom96 | But it is still much better |
20:34:29 | BlaXpirit | dom96, basically they know about that problem from earlier on gitter but haven't done anything about it in over a year[1] |
20:36:06 | jivank_ | dom96, using buffer pointer instead of string? |
20:36:16 | dom96 | no, using asyncfile |
20:36:22 | dom96 | hrm, actually |
20:36:33 | dom96 | I know why it still uses so much RAM |
20:38:17 | jivank_ | :D why is that? |
20:38:41 | dom96 | because the future stream buffer is being filled up faster than it is read from |
20:38:57 | def- | dom96: is that something new? |
20:39:07 | dom96 | future streams? yeah |
20:40:47 | dom96 | But unfortunately I don't have time to implement a storage limit mechanism for them |
20:41:20 | dom96 | jivank_: If you want to try what I just implemented you will need jester (devel branch which I just created) and Nim (devel branch as well). |
20:41:57 | jivank_ | alright ill give it a shot |
20:42:39 | dom96 | But there is definitely a GC issue in here too |
20:44:13 | dom96 | In case you or anybody else is interested in how I implemented it: https://github.com/dom96/jester/commit/6c6b49be2790816c4bde0042970974febacd6485 |
20:48:32 | jivank_ | nice i'm taking a look at it |
20:49:04 | * | brson joined #nim |
20:53:42 | * | user0___ quit (Read error: Connection reset by peer) |
20:53:53 | * | user0___ joined #nim |
20:56:52 | * | nsf joined #nim |
21:12:36 | * | libman joined #nim |
21:15:22 | * | Trustable quit (Remote host closed the connection) |
21:21:52 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
21:26:28 | * | Tiberium joined #nim |
21:33:32 | * | zachcarter joined #nim |
21:33:57 | zachcarter | yay frag works with windows now! |
21:34:16 | zachcarter | so the game framework now can target osx, linux, windows and android |
21:34:38 | zachcarter | do I add iOS or go back to actually working on the game framework now :P |
21:34:56 | Tiberium | zachcarter, latter :) |
21:35:19 | zachcarter | :) I think so too, I need to add texture atlases |
21:38:55 | * | user0____ joined #nim |
21:38:55 | * | user0___ quit (Read error: Connection reset by peer) |
21:39:15 | Tiberium | wow, without any hassle - 12kb hello world, just used --opt:size -d:release, then strip -s test, and then upx test (without specifying level of compression) |
21:51:53 | * | rauss quit (Quit: WeeChat 1.7) |
21:58:29 | FromGitter | <brechtm> @dom96, @Varriount I'm of course biased since I'm new to the concepts of generics and object variants, but I have the impression that full OO using multi-methods is more powerful/versatile than those techniques. Why not use full OO if it's available. One reason could be performance, I assume. But I can't imagine dynamic dispatch ever being the bottleneck... |
21:59:00 | * | nsf quit (Quit: WeeChat 1.7) |
22:02:17 | demi- | not sure how you can have dynamic dispatch and type safety tho |
22:06:16 | * | Vladar quit (Quit: Leaving) |
22:09:05 | * | vlad1777d quit (Remote host closed the connection) |
22:23:26 | FromGitter | <brechtm> Are object variants also available in other languages? |
22:24:15 | * | brson quit (Quit: leaving) |
22:34:26 | FromGitter | <brechtm> @demi- because types can't be checked at compile-time? |
22:35:16 | demi- | if you want dynamic dispatch that badly, you can use dynamic languages, or there is swift that does both |
22:40:22 | * | yglukhov quit (Remote host closed the connection) |
22:40:53 | * | Tiberium quit (Remote host closed the connection) |
22:41:06 | dom96 | While it's available it is not used as much. OO has its place but it often is overused because it's so prevalent. |
22:41:49 | FromGitter | <brechtm> @demi- it's just what I'm used to |
22:42:05 | dom96 | Functional programming languages don't offer OO features and yet are pretty powerful and versatile. |
22:42:24 | ldlework | I've come to learn OO is just a method of convient cache storage |
22:42:37 | ldlework | take away the object and the automaticp passing of state |
22:42:44 | ldlework | well, doesn't mean you magically don't -need- to do that anymore |
22:42:48 | ldlework | you just have to do it manually now |
22:43:05 | FromGitter | <brechtm> I'll take this opportunity to learn about generics and object variants |
22:43:15 | FromGitter | <brechtm> I have used C++ templates before, but ... you know |
22:43:55 | dom96 | Keep this in mind as well: https://en.wikipedia.org/wiki/Composition_over_inheritance |
22:44:43 | FromGitter | <brechtm> @ldlework "you just have to do it manually" - I can just go back to C and do everything manually, no? |
22:45:20 | ldlework | I don't understand the question. Its phrased as if something I said is refuted by the idea that C doesn't have object services. |
22:45:43 | ldlework | Yes, you can use C and do manually the things that the C language does not do for you. |
22:46:00 | * | couven92 quit (Read error: Connection reset by peer) |
22:47:56 | FromGitter | <brechtm> @dom96 but it still makes sense using inheritance, no? It just depends on which problem you want to solve. |
22:48:36 | dom96 | Sure. There are problems for which inheritance is a natural solution. |
22:49:22 | FromGitter | <brechtm> It is also often said that you should not use multiple inheritance. Yes, it can be very complex. But if used well it is very powerful. |
22:49:39 | dom96 | Nim doesn't support multiple inheritance |
22:49:51 | FromGitter | <brechtm> I'm painfully aware :-) |
22:50:01 | demi- | neither does objective-c, and i can happily say i am very glad about this |
22:50:31 | FromGitter | <brechtm> @demo- you don't *have* to use it, if it had, you know :-) |
22:52:15 | demi- | i actually have a negative desire to even have it tbh |
22:53:37 | FromGitter | <brechtm> @demi- So you have bad experiences with it? In which language? |
22:54:16 | demi- | i have never experienced a time where i was solving a problem in code and said "you know what could have made this easier? multiple inheritance" |
22:54:32 | demi- | with that line of thought more often than not you are making things too complex |
22:55:41 | FromGitter | <brechtm> of course, the fact that you never use it may be a reason that you don't think of it... |
22:57:20 | FromGitter | <brechtm> I use it quite often in Python. Only now and then I do run into some confusion when using super(). |
22:57:25 | * | user0____ quit (Quit: user0____) |
23:04:41 | dom96 | What do you use it for? |
23:05:09 | Araq | pathlib. |
23:05:59 | Araq | I used to think a path is maybe a distinct string or a list of path components or just a string. Now I know it's a specialization of PosixPathLike and PathLike |
23:06:10 | Araq | :P |
23:07:49 | Demos | multiple inheratance gets fairly complex to implement |
23:08:54 | ldlework | The only time I have used multiple inheritence on purpose is when a library provided a mixin |
23:09:02 | ldlework | And it worked as designed, etc |
23:09:28 | ldlework | I can conceive of its problems, but then again, Python despite its rounded corners is a language made for consenting adults as they say |
23:09:51 | ldlework | for better or worse! |
23:10:43 | Demos | it's different for python though |
23:11:03 | Demos | like everything is a hashtable so multiple inheratance is more straightforward |
23:11:16 | FromGitter | <brechtm> @dom96 One example: https://github.com/brechtm/rinohtype/blob/master/src/rinoh/paragraph.py#L339 - I use classes to collect style attributes. The style of Paragraph combines the style attributes of a Flowable and Text (and adds some extra attributes). |
23:12:20 | ldlework | Demos: interesting |
23:12:54 | FromGitter | <brechtm> The Style classes also make heavy use of metaclasses. |
23:12:59 | federico3 | Demos: yet, the dynamic nature of Python tends to punish developers that abuse inheritane |
23:13:52 | Araq | once I knew why dynamically typed languages even have inheritance. |
23:13:58 | Araq | but I forgot it again. |
23:15:01 | Araq | any object can have any fields it needs already. |
23:19:46 | * | OnO_ quit (Quit: ZNC - 1.6.0 - http://znc.in) |
23:24:47 | * | zachcarter quit (Quit: zachcarter) |
23:24:48 | FromGitter | <Varriount> Here's an interesting thought - inheritance could be simulated through use of a hook (called on inheritence) and a macro. |
23:29:17 | Araq | that's what Lua does. |
23:29:26 | Araq | or similar to what Lua does. |
23:30:24 | FromGitter | <Varriount> Araq: Did you ever consider using the same mechanism for Nim? |
23:30:41 | FromGitter | <Varriount> For one thing, it might allow insertion of things like vtables. |
23:31:30 | Demos | I don't see why you could'nt use macros to add vtbls to nim |
23:31:53 | Araq | multi methods will turn into ordinary methods as soon as we can do it. |
23:32:01 | Demos | :( |
23:32:04 | FromGitter | <Varriount> Araq: how so? |
23:32:05 | Demos | why |
23:32:19 | Demos | I think multi-methods work nicely with UFCS |
23:32:22 | Araq | I have yet to see a use case for MM in practice |
23:32:33 | Demos | although tbh I don't use methods much at all in nim |
23:32:48 | Araq | UFCS is not affected by this change. |
23:32:53 | Araq | hardly anything is affected. |
23:33:09 | Araq | it's just that only the first param will be used for the dynamic dispatching |
23:33:26 | FromGitter | <brechtm> Why does this fail? https://glot.io/snippets/eo9rvc338f |
23:33:48 | FromGitter | <Varriount> Araq: Then will typetraits gain the ability to get the runtime type on an object? |
23:33:54 | Demos | I think MM is conceptually simpler, but then again I don't seem to reach for methods much in nim anyway |
23:35:14 | FromGitter | <Varriount> I'm in favor of keeping multimethods. Macros can't really replace them (at least, not without some sort of hook system) |
23:37:47 | FromGitter | <Varriount> Nim doesn't yet have a way of deferring custom generation of procedure/type implementations |
23:38:35 | Demos | do you need that? |
23:38:54 | FromGitter | <brechtm> oops, that sample code is not complete |
23:39:06 | Araq | MM doesn't work well with generics |
23:40:23 | Demos | imo methods are only interseting with some kind of type erasure |
23:40:36 | FromGitter | <brechtm> https://glot.io/snippets/eo9s2glvoe |
23:53:22 | FromGitter | <Varriount> Araq: MM tends to be used quite a bit in places like GUI frameworks, and places where the user of the library supplies functionality to extend things. |
23:53:51 | Araq | how so? no common programming language offers it. |
23:55:26 | FromGitter | <Varriount> Qt |
23:55:36 | Demos | does Qt have multimethods? |
23:55:42 | FromGitter | <Varriount> C++ has methods |
23:55:52 | Demos | c++ does not have multimethods |
23:56:09 | FromGitter | <Varriount> I'm not talking multimethods, so much as methods that dispatch on the true type of a reference/pointer |
23:56:44 | Demos | yeah I don't think anyone wants to get rid of those |
23:57:43 | FromGitter | <Varriount> Demos: Yes, but the only convenient/compact way to have runtime dispatch in Nim is through multimethods. |
23:57:57 | * | rauss joined #nim |
23:58:16 | FromGitter | <Varriount> Yes you can use procedure members or vtables, but the former takes up space in each object, and the latter is difficult to construct, even with macrosl. |
23:59:15 | Demos | procedure members and vtables are pretty much the same thing |
23:59:23 | Demos | sans closure |