00:00:49 | FromGitter | <kayabaNerve> WebView? As in Android? |
00:00:59 | FromGitter | <adam-r-kowalski> @enthus1ast how do I get nim to match the most specific concept? ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ This fails because it says it’s ambiguous [https://gitter.im/nim-lang/Nim?at=5ba2e33bb9531f2dfa90ebf3] |
00:01:11 | enthus1ast | when it comes to tables/grids there are not much choices |
00:01:38 | FromGitter | <kayabaNerve> As in Android? |
00:01:48 | FromGitter | <kayabaNerve> I'm focusing on Win Dev |
00:02:11 | FromGitter | <kayabaNerve> Chromium has too much bloat. Qt is too corporate. WxWidgets looks like it hasn't been updated since XP. GTK is... better. Nimx is broken. |
00:02:17 | FromGitter | <kayabaNerve> Am I missing anything right now? |
00:02:21 | enthus1ast | but qt is cool |
00:02:34 | enthus1ast | played with it lately |
00:02:37 | FromGitter | <kayabaNerve> The only non-licensed UI lib out there I actually like is Kivy but it's for Python which I hate. |
00:03:13 | FromGitter | <kayabaNerve> But it's large (I won't say bloat just yet) and corporate as hell |
00:03:32 | enthus1ast | there is also: libui, fltk, qt, tcl tk, libagar |
00:03:40 | enthus1ast | nigui |
00:04:09 | FromGitter | <adam-r-kowalski> Well you can electron and use the nim -> js backend and write a html based site. That way you have one app that works in mac/linux/windows/ios/etc... |
00:04:24 | FromGitter | <kayabaNerve> @adam-r-kowalski Electron is Chromium. |
00:04:37 | enthus1ast | https://github.com/oskca/webview |
00:04:40 | FromGitter | <kayabaNerve> I also can't use the JS backend. |
00:05:00 | enthus1ast | gtk3 :) |
00:05:13 | FromGitter | <adam-r-kowalski> I feel like shooting down an entire platform because it’s bloated is unfair until you actually try it out |
00:05:33 | FromGitter | <kayabaNerve> "I also can't use the JS backend" |
00:05:45 | FromGitter | <adam-r-kowalski> whats your use case? |
00:05:54 | FromGitter | <kayabaNerve> I would be willing to accept the bloat if I knew CSS and could use JS |
00:06:14 | FromGitter | <kayabaNerve> High performance networking with multiple C libraries that wouldn't play nice with emscripten |
00:06:15 | FromGitter | <adam-r-kowalski> WebViews allow you embed web technology inside of a “native” app |
00:07:06 | FromGitter | <adam-r-kowalski> Chances are your electron app will spank something like wx/qt/etc because JavaScript is asyncronous and with libraries like React you can write very performant ui |
00:07:22 | FromGitter | <adam-r-kowalski> then just open up a socket or use the cffi to talk to your libraries |
00:07:56 | FromGitter | <kayabaNerve> ... No. Asynchronous will not help. I definitely need threads. |
00:08:10 | FromGitter | <kayabaNerve> I already have async code for my IO. I needed threaded processing. |
00:08:59 | FromGitter | <kayabaNerve> My comments weren't trying to be that there's nothing out there. My comments were I hate the major options. enthus1ast pointed out a couple I haven't heard of. |
00:09:06 | FromGitter | <adam-r-kowalski> just because something is written in c doesn’t make it fast. if it’s written in a single threaded, syncronous way it will still be less responsive. Threads can help but then you can only perform N tasks where N is the number of threads. Something using a threadpool, with async tasks per thread can be good, but I feel like thats a lot of complexity wihtout trying out the simple solution first |
00:09:35 | FromGitter | <kayabaNerve> ... what |
00:09:44 | FromGitter | <kayabaNerve> Dude. You completely do not know what I'm doing. |
00:09:56 | FromGitter | <kayabaNerve> I'm already using Nim's asyncdispatch for the network IO. |
00:10:21 | FromGitter | <kayabaNerve> I know I need threads and my task is designed to be threaded. |
00:10:53 | FromGitter | <kayabaNerve> I'm writing a cryptocurrency node where the TXs are stored on a DAG (can edit one part without affecting another). |
00:12:44 | FromGitter | <kayabaNerve> I actually may be able to use WebView. Thanks entus1ast. |
00:16:49 | enthus1ast | webview and karax could be cool but would require some testing how things could fit together |
00:17:34 | FromGitter | <zetashift> wow didn't know about webview |
00:17:38 | FromGitter | <zetashift> that looks neat |
00:21:39 | FromGitter | <kayabaNerve> I'm not liking how it talks about starting a web server and how WebView is just a browser |
00:22:16 | enthus1ast | you do not need a server |
00:22:17 | FromGitter | <kayabaNerve> I mean, I did expect for it to be a HTML/CSS rendering engine with some dynamic (JS) capabilities. Just popping in a URL and walking away though? |
00:22:27 | enthus1ast | you can inject html js css directly in the browser |
00:22:29 | FromGitter | <kayabaNerve> ... It talks about spawning a server on 127.0.0.1:0 |
00:22:34 | enthus1ast | yeah |
00:22:49 | FromGitter | <kayabaNerve> I'm not saying there's not ways to not spawn any server |
00:23:00 | FromGitter | <kayabaNerve> I'm saying I wish that was never something to talk about |
00:26:00 | enthus1ast | https://gist.github.com/enthus1ast/e25a52d768fcefb40b02070398607002 |
00:26:25 | enthus1ast | the html is feedet in as data url |
00:30:25 | FromGitter | <kayabaNerve> Or as file:// |
00:30:28 | FromGitter | <kayabaNerve> Or as localhost/ |
00:30:55 | FromGitter | <kayabaNerve> That said, yes, it can be handed off like that. Can you communicate with the browser instance if you do it like that? |
00:31:47 | enthus1ast | you can bind a context and call nim functions from js |
00:31:59 | FromGitter | <kayabaNerve> Got it. Good to know |
00:38:00 | * | zachcarter joined #nim |
00:42:30 | * | zachcarter quit (Ping timeout: 252 seconds) |
00:44:38 | * | druonysus quit (Ping timeout: 245 seconds) |
00:55:30 | FromGitter | <rayman22201> @iffy, when you are back online, If you know all the sql statements you want to execute at compile time, you can do a macro like this: https://gist.github.com/rayman22201/aad9a164fcac70003637e4485bc67bd9 |
01:00:40 | * | Sargun quit (*.net *.split) |
01:00:53 | * | Sargun joined #nim |
01:04:47 | FromGitter | <kayabaNerve> @adam-r-kowalski I meant to say. You mentioned Electron for "mac/linux/windows". Electron doesn't work on mobile. React, another CEF thingy, does. |
01:09:28 | * | PrimHelios quit (Quit: Leaving) |
01:22:11 | * | abm quit (Ping timeout: 260 seconds) |
01:22:13 | * | gmpreussner joined #nim |
01:26:55 | * | shibumi28 joined #nim |
01:27:49 | * | shibumi28 quit (Remote host closed the connection) |
01:28:12 | * | Jesin quit (Quit: Leaving) |
01:33:23 | * | ebx1000 quit (Ping timeout: 245 seconds) |
01:35:39 | * | skrylar quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
01:47:04 | * | navin joined #nim |
01:51:18 | * | navin quit (Ping timeout: 245 seconds) |
02:17:00 | * | dddddd quit (Remote host closed the connection) |
02:21:52 | * | engblom3 joined #nim |
02:22:39 | * | zachcarter joined #nim |
02:23:21 | * | zachcarter quit (Client Quit) |
02:23:32 | * | engblom3 quit (Remote host closed the connection) |
02:23:38 | * | zachcarter joined #nim |
02:26:56 | * | chowmeined joined #nim |
02:29:01 | * | chowmeined quit (Remote host closed the connection) |
02:29:26 | zachcarter | anyone know if it's possible to use nimble develop w/ local dependencies? |
02:35:16 | Tanger | zachcarter, I think that if you install your app and local dependencies with nimble install, it'll save those versions to your .nimble/pkgs folder. When you build, nimble should pick up those versions |
02:35:24 | Tanger | If that's what you mean |
02:37:49 | zachcarter | hrm - well there's a `develop` target in the nimble cli tool which is supposed to clone a dependency, and symlink it to the projecdt |
02:38:09 | zachcarter | so you don't have to constantly `nimble install` the projeect your project is depending on |
02:38:41 | zachcarter | it'd be nice if nimble A) allowed you to reference local directories as dependencies and B) allowed you to run `nimble develop` against a file path |
02:38:53 | zachcarter | dom96 ^ do you think that'd be worth a PR? |
02:46:13 | * | zachcarter quit (Ping timeout: 246 seconds) |
02:46:43 | * | noonien quit (Quit: Connection closed for inactivity) |
02:48:25 | * | zachcarter joined #nim |
02:55:47 | * | SenasOzys quit (Ping timeout: 240 seconds) |
03:11:04 | FromGitter | <mvlootman> Ijn |
03:28:10 | FromGitter | <iffy> @enthus1ast That makes this error: `lib/pure/strformat.nim(315, 39) Error: undeclared identifier: 'sql_arr'` |
03:29:51 | FromGitter | <iffy> @rayman22201 oh wow, thanks (I do know the SQL at compile time). I tried a macro but was using a syntax way uglier than that. Let me try it |
03:35:34 | FromGitter | <kayabaNerve> Talking about Nimble: Just me or should Nimble work as a dependency manager for Nim programs? |
03:36:27 | FromGitter | <kayabaNerve> I'm not saying NPM is amazing. I'm saying I hate having to have to tell users to install 7 Nimble packages, some by GitHub URL, instead of running "nimble dependencies" |
03:37:28 | FromGitter | <kayabaNerve> I would just recommend Nimble develop except my app goes against the required package structure in so many ways and should never be anywhere in the Nimble folders, even as just a symlink. |
03:38:09 | FromGitter | <kayabaNerve> Main issue is the directory structure. |
03:38:40 | leorize | I'm not quite sure what you're talking about... Doesn't nimble already manage the dependencies you declare in your .nimble file? |
03:45:06 | * | zachcarter quit (Ping timeout: 260 seconds) |
03:55:30 | FromGitter | <iffy> @rayman22201 that macro worked great! Where can I read more about that much better macro-making syntax? |
04:03:36 | FromGitter | <kayabaNerve> leorize: Only if you install your thing as a package or symlink it as a package |
04:04:02 | FromGitter | <kayabaNerve> It doesn't work if your app doesn't follow the required folder structure or if you don't want your app installed as a package |
04:04:11 | leorize | it also work if you `nimble build` actually |
04:04:53 | FromGitter | <kayabaNerve> You still need to follow the folder structure |
04:06:59 | leorize | Is there any reason why you don't follow the structure? |
04:13:47 | FromGitter | <kayabaNerve> @Quelklef tried forking my app to use it for Nimble tests. It was very very radical |
04:17:53 | FromGitter | <kayabaNerve> Apparently the structure only throws warning against the current Nimble. Then the comment becomes it shouldn't be installed as a Nimble package, but build ignores that... |
04:19:07 | FromGitter | <kayabaNerve> And the fact that future Nimble versions will raise it as an error. |
04:19:50 | FromGitter | <kayabaNerve> My src Dir has: Database/ Network/ UI/ main.nim |
04:20:11 | FromGitter | <kayabaNerve> Nimble wants me to nest everything one step further where those are in src/PackageName |
04:22:53 | leorize | not really |
04:22:58 | leorize | you don't need src/ |
04:23:11 | leorize | but you certainly need packageName/ |
04:25:45 | FromGitter | <kayabaNerve> ... the issue is that src doesn't have a single file |
04:25:49 | FromGitter | <kayabaNerve> *folder |
04:26:09 | FromGitter | <kayabaNerve> ~/src is main, a nimscript file, and 5 folders |
04:26:47 | FromGitter | <kayabaNerve> Nimble believes the folder structure should be src/PROJECT_NAME/Database (and the other 4 folders) |
04:27:37 | FromGitter | <rayman22201> @iffy glad I could help. 👍 idk if it's "good" macro syntax lol. Just a mix of stuff I've learned from reading the docs and talking to people on the irc channel lol. |
04:30:59 | leorize | kayabaNerve: well obviously :P |
04:31:13 | FromGitter | <kayabaNerve> leorize: That's double nesting! |
04:31:14 | FromGitter | <kayabaNerve> Why |
04:31:17 | leorize | you can move them there then add an .nims including that path |
04:31:19 | FromGitter | <kayabaNerve> Single nesting should be good enough |
04:31:30 | leorize | yes you can skip the `src/` path |
04:33:17 | leorize | the reason is simple, you installed 'packageA', you don't want it to provides 'nameThatDuplicateSomeOtherPackages' |
04:33:20 | FromGitter | <kayabaNerve> So have nimble build a dummy file just to install the packages? |
04:33:28 | FromGitter | <kayabaNerve> That's not the issue |
04:33:43 | leorize | that could be a walkaround |
04:33:59 | FromGitter | <kayabaNerve> The Nimble package is named the same. The issue is all my code is src/, and Nimble wants me to double nest it. |
04:34:18 | leorize | you can rename src -> "your project name" |
04:34:56 | FromGitter | <kayabaNerve> Because it believes the mainfile should be in the root, and the src directory should be named PROJECT, even though the Nimble file is PROJECT and if installed, it would be to a folder named PROJECT |
04:35:03 | FromGitter | <kayabaNerve> But it shouldn't be |
04:35:33 | FromGitter | <kayabaNerve> And your "packageA" excuse is unreasonable because it relies on the argument that Nimble doesn't pick pkgs/packageA but pkgs/packageA/packageA |
04:36:41 | FromGitter | <kayabaNerve> The end point is: ⏎ Nimble requires the source file to be in the root of the source directory. ⏎ Nimble requires the only other code in the root of the source directory to be nested under PROJECT/ ⏎ It's already nested under src/ and I don't want to double nest it. [https://gitter.im/nim-lang/Nim?at=5ba323d98909f71f75fdc855] |
04:37:47 | leorize | you can put your main file to `src/` |
04:37:55 | FromGitter | <kayabaNerve> The main file is in src/ |
04:38:01 | FromGitter | <kayabaNerve> But then I have 5 other folders of code in there |
04:38:13 | FromGitter | <kayabaNerve> Nimble wants: ⏎ src/main ⏎ src/PROJECT/dir1 ⏎ src/PROJECT/dir2 ⏎ src/PROJECT/dir3 [https://gitter.im/nim-lang/Nim?at=5ba324358909f71f75fdca36] |
04:38:55 | FromGitter | <kayabaNerve> And I don't want that pointless nesting. I'm not saying it doesn't make sense for packages. I'm saying it doesn't make sense for this. |
04:40:22 | leorize | the problem is that nimble is designed to handle packages, and only packages... It can't do anything when it's not a package |
04:42:33 | leorize | your best bet at install dependencies in that case should be to either: |
04:42:46 | leorize | use a shell script than invoke `nimble install` |
04:42:53 | leorize | or a dummy package |
04:43:08 | leorize | I think the shell script one makes more sense |
04:44:42 | FromGitter | <kayabaNerve> That's why I'm saying it should expand into a dependency manager. |
05:19:30 | * | Perkol joined #nim |
05:22:27 | * | darithorn quit (Quit: WeeChat 2.2) |
05:28:10 | * | xet7 joined #nim |
05:33:00 | * | nsf joined #nim |
05:36:15 | * | navin joined #nim |
05:37:30 | * | navin quit (Remote host closed the connection) |
05:37:44 | * | navin joined #nim |
06:20:28 | * | Insmell7 joined #nim |
06:20:36 | * | Insmell7 quit (Remote host closed the connection) |
06:29:13 | FromGitter | <gogolxdong> @zachcarter How to input string in editString of nuklear-nim ? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba33e397dca306503294ed5] |
06:32:40 | FromGitter | <gogolxdong> typed in the text field but nothing appeared. |
06:36:31 | * | TheLemonMan joined #nim |
06:48:02 | * | Prestige20 joined #nim |
06:48:05 | * | Prestige20 quit (Remote host closed the connection) |
07:05:10 | FromGitter | <gogolxdong> its C comparable is ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba346a61ee2ca650242138b] |
07:21:20 | * | navin quit (Remote host closed the connection) |
07:22:08 | * | Amigant5 joined #nim |
07:26:00 | * | navin joined #nim |
07:28:05 | * | navin quit (Remote host closed the connection) |
07:28:20 | * | Amigant5 quit (Ping timeout: 250 seconds) |
07:29:35 | * | navin joined #nim |
07:33:15 | * | xvilka17 joined #nim |
07:34:07 | * | xvilka17 quit (Killed (Unit193 (Spam is not permitted on freenode.))) |
07:37:02 | * | navin quit (Remote host closed the connection) |
07:37:08 | * | cyraxjoe quit (Ping timeout: 245 seconds) |
07:46:56 | * | PMunch joined #nim |
07:47:24 | * | navin joined #nim |
07:48:45 | * | SenasOzys joined #nim |
08:02:34 | * | gmpreussner quit (Ping timeout: 240 seconds) |
08:03:47 | * | gmpreussner joined #nim |
08:04:00 | * | Perkol quit (Quit: Leaving) |
08:17:37 | * | sam-lap19 joined #nim |
08:18:27 | * | sam-lap19 quit (Remote host closed the connection) |
08:29:41 | * | abm joined #nim |
08:31:17 | c15ade4 | Araq: what are your opinions on rust style ? operator - I may be naive but it seems to address some of https://github.com/nim-lang/Nim/issues/8363 |
08:31:31 | c15ade4 | converters also seem like a feature that would make it work to convert error types. |
08:32:33 | c15ade4 | *Not* suggesting that is the right way to go about things, just wondered your throughts. |
08:35:58 | PMunch | Something like this: https://github.com/nim-lang/Nim/pull/8358/commits/606544db01663ed9870e2ede26589f15c9d7dd13 |
08:37:31 | c15ade4 | PMunch: yeah - it basically requires redoing the stdlib |
08:38:13 | PMunch | Well to use it everywhere yes |
08:39:23 | c15ade4 | I think it would solve a problem I saw with async |
08:39:24 | PMunch | Although this includes wrappers: https://github.com/nim-lang/Nim/pull/8358/files#diff-fdaf5ed8685e0ec96346e47f49ec2041R338 |
08:39:28 | c15ade4 | that exceptions didn't work |
08:39:48 | c15ade4 | if we non fatal errors were not exceptions |
08:39:51 | FromGitter | <mratsim> exceptions work in async in devel |
08:39:57 | c15ade4 | Oh |
08:40:11 | c15ade4 | that changes my opinion a little bit |
08:40:17 | c15ade4 | from the docs I thought it was some fundamental flaw |
08:41:08 | FromGitter | <mratsim> async are implemented completely through macro, it’s just an issue of catching the error messages and locations properly |
08:41:45 | FromGitter | <mratsim> I think this fixed it: https://github.com/nim-lang/Nim/pull/7770 |
08:42:08 | FromGitter | <mratsim> you couldn’t use yield in try, but as async is built on top of closure iterators it depended on yield |
08:44:49 | * | Ke25 joined #nim |
08:45:45 | c15ade4 | Does that mean if future.failed: is not needed? |
08:45:58 | c15ade4 | that was something that seemed a bit strange to me |
08:46:20 | c15ade4 | with errors as values this idiom is not needed |
08:47:31 | FromGitter | <mratsim> I’ve wrote like 20 lines of async code in Nim so I can’t tell you much more :P |
08:49:01 | * | Ke25 quit (Remote host closed the connection) |
08:50:48 | c15ade4 | yeah, I don't have all the facts - Just trying to make sense of when to throw an exception in my own code |
08:50:52 | Araq | it is not an "idiom", it is what you sometimes need to do yourself when you couldn't use 'await' |
08:51:24 | c15ade4 | sorry - :( |
08:52:18 | FromGitter | <mratsim> exceptions vs errors is a hard question and I’m not sure it’s even solved in our project at Status, see here: https://github.com/status-im/nimbus/wiki/Exceptions-and-errors |
08:53:25 | c15ade4 | Yes, my code was using libsodium to decrypt something |
08:53:35 | FromGitter | <mratsim> and this one: https://gist.github.com/zah/d2d729b39d95a1dfedf8183ca35043b3 |
08:53:36 | c15ade4 | two cases were tampered data, or key mismatches |
08:53:53 | c15ade4 | I didn't know if it should be an exception or return value to be honest |
08:54:20 | c15ade4 | thanks for the link |
08:55:37 | c15ade4 | Exceptions do make straight line code very readable so I don't know. |
08:56:05 | Araq | if in doubt, use exceptions |
08:56:18 | c15ade4 | :) |
08:56:20 | Araq | otherwise your code will just be littered with "on error, pass error along" |
08:56:38 | FromGitter | <mratsim> Using exceptions for control-flow is bad though |
08:56:43 | c15ade4 | ok, thank you |
08:57:02 | FromGitter | <mratsim> and in crypto, we can expect that 99% of the time are bots inputting malicious values |
08:57:28 | * | dddddd joined #nim |
08:57:47 | Araq | the arguments against exceptions are overblown, you need to adapt your mental model that a function call can throw and writing 'check' in front of every call soon is filtered out by your brain |
08:58:30 | Araq | but my opinion on this changes on a daily fashion :P |
08:58:38 | FromGitter | <mratsim> I don’t really have an issue with exceptions, I also prefer not cluttering my return values with error code |
08:59:28 | FromGitter | <mratsim> except when it makes sense to make those first class (i.e. on user inputs) |
08:59:32 | c15ade4 | The exception tracking/effect system seems like a very nice help too |
09:00:04 | c15ade4 | where in python I just have no clue what is going on |
09:01:59 | TheLemonMan | bashing Python is not that fair since it is dynamic by nature (and choice) |
09:05:08 | c15ade4 | Its not really bashing, I like it, its just my experience |
09:06:18 | Araq | bashing things based on bad initial choices is a valid thing to do :P |
09:07:06 | FromGitter | <mratsim> "Choosing x86 was bad” <— here you go |
09:07:38 | TheLemonMan | MIPS master race |
09:07:59 | c15ade4 | Btw, have there been any dropped backends for nim in the past? |
09:08:19 | FromGitter | <mratsim> PHP backend was dropped ;) |
09:08:19 | TheLemonMan | the php one :D |
09:08:33 | c15ade4 | lol |
09:08:37 | c15ade4 | bash backend please |
09:08:42 | FromGitter | <mratsim> @TheLemonMan: Stargate was PC Master Race before it even started: https://twitter.com/VideoCardz/status/1041773139414458370 |
09:09:12 | TheLemonMan | its soul is still with us, the js backend contains a lot of unused pieces from it |
09:09:23 | c15ade4 | I guess backends increase work and also cause some fragmentation in libs |
09:09:51 | c15ade4 | :) I was trying to imagine if a Go backend would have any real world value |
09:09:56 | c15ade4 | or just be a waste |
09:10:18 | FromGitter | <mratsim> Go can wrap C so it’s better to just output C code |
09:10:28 | c15ade4 | yeah that is true |
09:10:50 | FromGitter | <mratsim> C is common compiled language, JS is common browser language |
09:11:02 | FromGitter | <xmonader> cligen experts ⏎ any idea how to achieve this? ⏎ ⏎ ```app containers list ⏎ app containers new -n aname -i image``` ⏎ ... [https://gitter.im/nim-lang/Nim?at=5ba36426e6046343f38c4db5] |
09:11:12 | FromGitter | <alehander42> the only new backend I think nim needs now is `wasm` |
09:11:27 | FromGitter | <mratsim> or a LLVM frontend |
09:12:04 | TheLemonMan | or a Fortran one |
09:12:20 | FromGitter | <mratsim> or Forth :P |
09:12:25 | FromGitter | <alehander42> well nlvm needs contributors i guess |
09:13:00 | FromGitter | <kayabaNerve> @mratsim There is a LLVM Compiler. :thinking: |
09:13:19 | FromGitter | <kayabaNerve> I would love a wasm backend... |
09:13:24 | FromGitter | <mratsim> actually I think Cuda/OpenCL/Vulkan backends would be nice as well |
09:13:50 | c15ade4 | find someone who will pay for them :P |
09:14:04 | FromGitter | <mratsim> I’m paying with my time |
09:14:10 | c15ade4 | :) |
09:14:30 | FromGitter | <mratsim> didn’t start on Vulkan because I’m developping on a MacBook but I will on my new computer |
09:15:15 | FromGitter | <jwollen> shameless plug: https://github.com/fragcolor-xyz/nim2spirv. gonna finish it some time this generation of graphics cards i promise! |
09:16:10 | * | Vladar joined #nim |
09:17:54 | FromGitter | <mratsim> nice! |
09:19:20 | FromGitter | <mratsim> now we just need a Nim bot that can rival Tencent new Starcraft 2 AI: https://arxiv.org/abs/1809.07193 and we have everything to create game logic, graphics, sound and AI in pure Nim :D |
09:20:42 | FromGitter | <alehander42> wasn't @krux02 also doing something like that (generating shader code from nim) |
09:20:52 | FromGitter | <alehander42> looks nice @jwollen |
09:21:05 | FromGitter | <mratsim> but OpenGL: https://github.com/krux02/opengl-sandbox |
09:21:31 | FromGitter | <alehander42> yeah |
09:21:35 | FromGitter | <mratsim> and it’s higher level |
09:21:57 | FromGitter | <jwollen> one level at a time! :P |
09:22:07 | FromGitter | <mratsim> we can maybe use krux02 macros on top of @jwollen SPIR-V |
09:22:30 | Araq | Zerg is OP once somebody/an AI can exploit the fact that all the other races can't tech-switch as effectively |
09:23:06 | Araq | that's my prediction anyway :P |
09:24:41 | FromGitter | <mratsim> you don’t need to develop an AI, most SC2 grandmaster are zergs http://www.rankedftw.com/stats/races/1v1/#v=2&r=-2&l=-2 |
09:25:19 | copygirl | Can I not write code like `foo = bar\n || baz` due to indentation checking..? |
09:26:13 | FromGitter | <mratsim> you should split line after the operator |
09:26:49 | copygirl | I know I should but that looks ugly to me. Having the operator at the front of the line is much more readable. |
09:27:23 | copygirl | "Ah, whatever is above combined with this operator with what follows." |
09:27:30 | FromGitter | <mratsim> I’m pretty sure there was a RFC about that in the past 3 weeks (by timothee :?) but so much is happening I don’t remember |
09:27:44 | copygirl | Especially when chaining multiple operators it makes the flow much more readable. |
09:27:47 | FromGitter | <mratsim> otherwise just use parenthesis |
09:28:48 | * | navin_ joined #nim |
09:29:09 | copygirl | How? |
09:29:37 | FromGitter | <mratsim> foo = (\n … \n ) |
09:29:55 | copygirl | Mhh I guess that doesn't work with templates or so. |
09:30:26 | FromGitter | <mratsim> probably this one: https://github.com/nim-lang/Nim/issues/8258 |
09:30:27 | * | navin quit (Ping timeout: 240 seconds) |
09:31:46 | TheLemonMan | is there a nicer way to serialize an object to a json string without having to build many intermediate JsonNodes? |
09:32:00 | FromGitter | <mratsim> %*? |
09:32:11 | FromGitter | <mratsim> or check Araq’s packedJSON |
09:32:33 | FromGitter | <mratsim> https://github.com/Araq/packedjson |
09:33:23 | * | navin_ quit (Ping timeout: 244 seconds) |
09:33:54 | TheLemonMan | nice |
09:34:22 | FromGitter | <mratsim> The JsonNode are stack object so it’s much less costly than in the stdlib to create them, though they contain a seq |
09:34:39 | TheLemonMan | oh, it's not os nice because it has its own benchmark harness :P |
09:35:26 | FromGitter | <mratsim> btw @Araq, why use a ref seq instead of a shallow object? https://github.com/Araq/packedjson/blob/master/packedjson.nim#L109 |
09:37:38 | Araq | because 'shallow' will be replaced with move semantics? |
09:39:11 | FromGitter | <bung87> `Error: (k)..(k) not disjoint from (k)..(k)` what does it mean? the spawn proc needs take arg k ? |
09:40:18 | * | navin joined #nim |
09:41:14 | FromGitter | <bung87> I write a DSL lib trying to do ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba36b395df5194734e7f73d] |
09:41:30 | FromGitter | <mratsim> @Araq, not convinced, changing from shallow to move doesn’t require to change type, while changing from ref seq to move will require to change type and edit all those dereference you are doing in the code. |
09:56:00 | * | StathisA1 joined #nim |
09:58:31 | * | StathisA1 quit (Remote host closed the connection) |
10:01:22 | * | navin quit (Remote host closed the connection) |
10:06:30 | Araq | mratsim: a move ensures linearity but I have mutiple owners |
10:07:17 | Araq | and the derefs are just a "replace in file" operation when it comes to it. it's foolish to write code for what-ifs that never happen or take 3 minutes to resolve |
10:11:22 | * | navin joined #nim |
10:16:12 | * | ebx1000 joined #nim |
10:17:26 | FromDiscord | <Shield> is there a built in function to get the next valid value for an enum when they have disjoint values? |
10:20:19 | Araq | system.succ |
10:21:00 | * | navin quit (Remote host closed the connection) |
10:21:53 | * | stefanos82 joined #nim |
10:22:51 | * | navin joined #nim |
10:28:23 | FromDiscord | <Shield> it seems that it works like inc, it doesn't jump to the next valid enum |
10:33:13 | TheLemonMan | yeah, at runtime there's no knowdlege about your enum holes |
10:34:01 | * | PMunch quit (Ping timeout: 260 seconds) |
10:34:28 | FromDiscord | <Shield> ah |
10:35:06 | Araq | enums with holes are a stupid feature and need to die, for C interop a 'distinct cint' would have been better |
10:37:46 | TheLemonMan | 1.0 is not out yet, you're still in time :) |
10:40:58 | FromDiscord | <Shield> how else can you ensure backward compatibility if you load enum values from a file? appending new values at the end of the list doesn't sound that clean |
10:41:36 | TheLemonMan | the real question is why do you load the enums from a file? |
10:44:06 | Araq | Shield: You can also serialize them as strings |
10:46:22 | * | dvn quit (Ping timeout: 250 seconds) |
10:46:31 | FromDiscord | <Shield> I've forgot about that handy feature, thanks |
10:50:31 | * | PMunch joined #nim |
10:50:32 | * | PMunch quit (Remote host closed the connection) |
10:50:41 | * | PMunch joined #nim |
10:52:48 | * | dvn joined #nim |
11:02:50 | FromGitter | <codenoid> good noon all |
11:04:39 | * | PMunch quit (Ping timeout: 252 seconds) |
11:10:00 | * | kapil___ joined #nim |
11:14:52 | * | PMunch joined #nim |
11:14:59 | FromGitter | <alehander42> good noon |
11:16:55 | FromGitter | <alehander42> hahah @Araq basically thought of zero-functional in 2015 https://forum.nim-lang.org/t/1333#8368 ⏎ i hoped at least that was an original idea |
11:17:21 | FromGitter | <alehander42> but that point is good, I thought last week about a nim linq lib based on his forloop macro comments |
11:17:48 | FromGitter | <alehander42> and that it can be actually implemented as a "fronted" for zero-functional |
11:18:06 | FromGitter | <alehander42> or to somehow reuse its internals |
11:19:21 | * | navin quit (Remote host closed the connection) |
11:19:30 | FromGitter | <alehander42> basically it will just convert stuff like ⏎ ⏎ ```values.q --> filter(rewritten test) --> map(rewritten other)``` [https://gitter.im/nim-lang/Nim?at=5ba382418909f71f750006a1] |
11:20:50 | * | Vladar quit (Remote host closed the connection) |
11:21:05 | FromGitter | <alehander42> of course that would be the only "runtime values" provider |
11:22:06 | * | navin joined #nim |
11:23:58 | * | Vladar joined #nim |
11:44:01 | * | ritchie_ quit (Ping timeout: 260 seconds) |
11:57:37 | * | noonien joined #nim |
12:06:32 | FromGitter | <kaushalmodi> @xmonader About the 2nd level dispatch, the cligen dev is very responsive. Open an issue on his repo. |
12:08:50 | * | navin quit (Remote host closed the connection) |
12:17:16 | shashlick | @kaushalmodi: does emacs hang for you in nim mode |
12:17:49 | shashlick | I'm trying spacemacs with nim layer and it hangs as soon as I type |
12:18:02 | shashlick | Feels like some nimsuggest issues |
12:18:46 | FromGitter | <kaushalmodi> I'd disable nimsuggest first. |
12:19:09 | FromGitter | <kaushalmodi> Secondly krux02 has added PR for improving nim-mode performance |
12:19:19 | shashlick | How do you disable it |
12:19:31 | shashlick | So no auto complete works for you? |
12:19:49 | FromGitter | <kaushalmodi> Set the nimsuggest var to nil |
12:19:56 | FromGitter | <kaushalmodi> Not at my computer right now. |
12:20:12 | FromGitter | <kaushalmodi> Or.. remove nimsuggest from PATH for now. |
12:20:50 | shashlick | Ok that's unfortunate |
12:21:00 | shashlick | Any opinion on spacemacs |
12:21:27 | shashlick | Feels very slow to start and a ram hog, might as well use vscode then |
12:21:33 | FromGitter | <kaushalmodi> Though, I haven't needed to do that. |
12:22:21 | shashlick | So auto complete does work for you? |
12:29:18 | * | ThomasWhite joined #nim |
12:30:18 | * | ThomasWhite quit (Remote host closed the connection) |
12:40:36 | * | Vladar quit (Remote host closed the connection) |
12:40:58 | * | Vladar joined #nim |
12:42:09 | * | navin joined #nim |
12:42:13 | abm | xi editor usable when |
13:09:41 | * | ritchie_ joined #nim |
13:09:53 | FromGitter | <kaushalmodi> shashlick: I don't use any auto complete, actually |
13:10:04 | FromGitter | <kaushalmodi> The inbuilt hippie-expand works just fine |
13:34:14 | * | navin quit (Remote host closed the connection) |
13:35:31 | * | seni_ joined #nim |
13:37:07 | * | seni quit (Ping timeout: 240 seconds) |
13:38:40 | * | navin joined #nim |
13:47:19 | FromGitter | <Bennyelg> How's the integration of nim & sublime ? which is more stable with nim? vs-code or sublime |
13:54:16 | * | navin quit (Remote host closed the connection) |
13:54:33 | * | navin joined #nim |
13:58:24 | FromGitter | <codenoid> sublime |
14:03:31 | FromGitter | <bung87> vscode good enough |
14:10:01 | PMunch | Interesting, the TOML specification got an ABNF definition. So now I can run abnfgen to generate random TOML documents that I can test the TOML parser against |
14:23:14 | * | navin quit (Remote host closed the connection) |
14:29:20 | * | navin joined #nim |
14:31:35 | FromGitter | <BontaVlad> Spacemacs is fine for working with nim, check https://github.com/nim-lang/nim-mode/issues/159 for debugging nim-mode in emacs |
14:47:18 | * | miran joined #nim |
14:48:06 | * | ebx1000 quit (Quit: Leaving) |
15:02:19 | pigmej | just `M-x customize-variable` and customize `nimsuggest-options` no need to manually edit files |
15:05:53 | Araq | "Note that the provider name GitHub is case sensitive (e.g. not Github)." sure, document your bugs |
15:06:36 | Araq | maybe some day a Github will arrive that's different from GitHub |
15:08:57 | * | navin quit (Remote host closed the connection) |
15:09:33 | * | seni_ quit (Quit: Leaving) |
15:16:51 | stefanos82 | lol |
15:18:37 | * | SenasOzys quit (Quit: Leaving) |
15:20:20 | * | SenasOzys joined #nim |
15:20:24 | FromGitter | <alehander42> GiThuB E!!Rprise |
15:20:40 | TheLemonMan | are you having a stroke? |
15:22:56 | FromGitter | <alehander42> you're being very case sensitive lemon man |
15:23:21 | stefanos82 | more like a hiccup TheLemonMan lol |
15:23:32 | TheLemonMan | you surely mean 7h313m0nm4n |
15:23:53 | stefanos82 | remember the google incident? |
15:24:02 | * | iffy joined #nim |
15:24:05 | stefanos82 | with the unicode G letter in a domain name? |
15:24:51 | stefanos82 | https://thenextweb.com/google/2016/11/21/google-isnt-google/ |
15:24:54 | TheLemonMan | that's punycode domain |
15:25:35 | FromGitter | <alehander42> they do this + "free eth" for each tweet of elon musk |
15:28:08 | * | iffy left #nim (#nim) |
15:28:57 | * | ericst joined #nim |
15:29:52 | * | ericst quit (K-Lined) |
15:31:26 | PMunch | I think parsetoml should support 0.5.0 of the TOML spec now :) |
15:31:29 | * | PMunch quit (Quit: Leaving) |
15:34:39 | TheLemonMan | nice.bat |
15:37:06 | * | Xe quit (Ping timeout: 264 seconds) |
15:38:12 | * | navin joined #nim |
15:39:08 | * | ryanhowe joined #nim |
15:40:20 | * | ryanhowe quit (Client Quit) |
15:42:48 | * | navin quit (Ping timeout: 244 seconds) |
15:51:19 | * | Xe joined #nim |
15:53:51 | * | navin joined #nim |
15:58:24 | * | navin quit (Ping timeout: 272 seconds) |
16:02:03 | * | acksys15 joined #nim |
16:03:36 | * | acksys15 quit (Remote host closed the connection) |
16:05:07 | * | Sembei quit (Ping timeout: 240 seconds) |
16:05:31 | * | byte512_ joined #nim |
16:05:32 | * | MyMind joined #nim |
16:05:39 | * | byte512_ quit (Remote host closed the connection) |
16:10:44 | * | darithorn joined #nim |
16:11:18 | * | darithorn quit (Read error: Connection reset by peer) |
16:12:04 | * | darithorn joined #nim |
16:16:45 | * | fbt23 joined #nim |
16:19:48 | * | Trustable joined #nim |
16:20:51 | * | fbt23 quit (Remote host closed the connection) |
16:21:04 | * | darithorn quit (Read error: Connection reset by peer) |
16:21:50 | * | darithorn joined #nim |
16:25:37 | * | Vladar quit (Remote host closed the connection) |
16:30:00 | FromGitter | <kaushalmodi> PMunch: That's awesome! |
16:30:34 | FromGitter | <kaushalmodi> Thanks! I think on the TOML repo, you can request listing parsetoml as 0.5.0 compliant parser |
16:31:03 | FromGitter | <kaushalmodi> The readme needs to be updated.. still says "Currently it supports v0.4.0 of the TOML specification." |
16:31:57 | FromGitter | <kaushalmodi> https://github.com/toml-lang/toml/wiki#v050-compliant |
16:39:22 | * | navin joined #nim |
16:44:14 | * | PrimHelios joined #nim |
16:44:53 | * | DerUltraLord joined #nim |
16:49:37 | FromGitter | <brentp> anyone have an example of setting the version in a .nimble file from a version defined in the source of the project so I don't need to update the value in 2 places? |
16:50:01 | * | wildlander joined #nim |
16:51:27 | FromGitter | <iffy> Can I test if a tuple has a key? |
17:00:23 | FromGitter | <kaushalmodi> @iffy Interesting, I never had to find that out. But now I am curious too. |
17:04:18 | * | eip`13 joined #nim |
17:04:39 | Araq | when compiles(tup.maKey) |
17:06:08 | FromGitter | <kaushalmodi> Araq: awesome! thanks |
17:06:11 | FromGitter | <kaushalmodi> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba3d383b4990c30eee3e3a8] |
17:07:17 | * | navin_ joined #nim |
17:08:34 | * | navin quit (Ping timeout: 244 seconds) |
17:09:04 | * | eip`13 quit (Remote host closed the connection) |
17:09:09 | FromGitter | <iffy> Thanks! |
17:10:43 | FromGitter | <kaushalmodi> works for `compiles(person[0])` and so on.. too |
17:10:57 | FromGitter | <kaushalmodi> wondering.. how to get number of fields in a tuple |
17:11:18 | TheLemonMan | you can also use a concept (I think) |
17:11:34 | FromGitter | <kaushalmodi> I've yet to get into concepts |
17:14:03 | * | stefanos82 quit (Quit: Quitting for now...) |
17:17:16 | TheLemonMan | I've sent more than 100 PRs, nice |
17:20:28 | FromGitter | <kaushalmodi> TheLemonMan +1 |
17:20:53 | FromGitter | <kaushalmodi> Araq: still tinkering with that `compiles` snippet .. |
17:20:56 | FromGitter | <kaushalmodi> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba3d6f8e5c2cc56adbb39e6] |
17:21:15 | FromGitter | <kaushalmodi> that outputs: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba3d70be6046343f38f5d95] |
17:21:49 | FromGitter | <kaushalmodi> so "by name" reference outcome is the same whether I use the tuple type or tuple var |
17:22:10 | FromGitter | <kaushalmodi> but the field index reference works correctly only with tuple var |
17:22:53 | * | Pisuke joined #nim |
17:23:03 | * | MyMind quit (Ping timeout: 252 seconds) |
17:27:27 | * | gmodena3 joined #nim |
17:29:23 | * | gmodena3 quit (Remote host closed the connection) |
17:30:06 | FromGitter | <rayman22201> Hey look, another new language that has a bunch of "innovative" features that Nim has had forever : Kit Programming Language https://news.ycombinator.com/item?id=18023598 |
17:31:39 | FromGitter | <Vindaar> @kaushalmodi number of fields in tuple -> `typetraits.arity`, so for your example `type(person).arity` |
17:32:13 | FromGitter | <kaushalmodi> @Vindaar Cool! thanks |
17:32:31 | FromGitter | <kaushalmodi> any comment about why Person[0] doesn't work? should it work? |
17:35:00 | FromGitter | <Vindaar> If I'm not mistaken there was something specific about tuples and indexing by integer |
17:39:35 | Araq | the index must be a constant |
17:41:55 | * | navin_ quit (Remote host closed the connection) |
17:42:17 | * | navin joined #nim |
17:42:38 | FromGitter | <kaushalmodi> It is a constant in that example above |
17:45:40 | FromGitter | <Vindaar> Oh, I only just realized that you're trying to access the field of the type and not of the specific instance in the latter part. No idea if that should work. |
17:46:21 | * | DerUltraLord quit (Ping timeout: 256 seconds) |
17:46:28 | FromGitter | <kaushalmodi> but TupleType.FieldName works.. |
17:46:47 | FromGitter | <kaushalmodi> we are just check if a field exists.. doing type.field is meaningless otherwise |
17:46:49 | FromGitter | <Vindaar> Well, the compilation error for that is `Error: no generic parameters allowed for Person`, which sort of makes sense I guess, since it's the same syntax you'd use for generics |
17:47:53 | FromGitter | <kaushalmodi> hmm, makes sense |
17:48:35 | FromGitter | <kaushalmodi> so it just happens that the square brackets are generics syntax, else it would have worked |
17:49:10 | FromGitter | <kaushalmodi> are purely numerical generics possible? |
17:49:49 | FromGitter | <kaushalmodi> I mean, can a type be just a number? |
17:50:07 | TheLemonMan | static[T] to the rescue |
17:51:39 | FromGitter | <kaushalmodi> @Vindaar On the flip side, just `Person.age` (from that above example) error too *nim_src_YckhwY.nim(8, 12) Error: type mismatch: got <type int>* |
17:51:50 | FromGitter | <kaushalmodi> but `echo compiles(Person.age)` returns true |
17:51:53 | FromGitter | <kaushalmodi> as expected |
17:52:09 | FromGitter | <kaushalmodi> TheLemonMan: I didn't understand how static[T] can be used here |
17:52:33 | TheLemonMan | you asked "I mean, can a type be just a number" |
17:53:11 | FromGitter | <Vindaar> `Person.age` simply returns the type of `Person`. So the error in your case is that you're doing something with it that doesn't work for a type (I guess you just removed the compiles around it?) |
17:53:25 | FromGitter | <Vindaar> of `age` in `Person` I meant |
17:53:58 | FromGitter | <Vindaar> So if you import `typetraits` it should now echo `int` |
17:54:11 | FromGitter | <kaushalmodi> TheLemonMan: ah, OK. I meant something like `Option[123]` would never be valid, right? |
17:54:33 | FromGitter | <kaushalmodi> @Vindaar ah, OK to you too :) |
17:55:37 | FromGitter | <kaushalmodi> so the problem is the the generic parsing kicks on, on seeing `Person[0]` instead of returing the type of `Person[0]` |
17:56:26 | * | der_Alte17 joined #nim |
17:57:59 | * | der_Alte17 quit (Remote host closed the connection) |
17:58:27 | FromGitter | <Vindaar> what TheLemonMan was referring to is ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ so yes, soemthing like that is allowed [https://gitter.im/nim-lang/Nim?at=5ba3dfc25df5194734eb11ec] |
17:59:52 | FromGitter | <kaushalmodi> pretty neat |
17:59:57 | FromGitter | <kaushalmodi> thanks! |
18:00:05 | FromGitter | <Vindaar> :) |
18:04:38 | FromGitter | <kaushalmodi> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba3e1368909f71f75027ce7] |
18:04:42 | FromGitter | <kaushalmodi> :) |
18:09:59 | * | couven92 quit (Read error: Connection reset by peer) |
18:25:54 | * | loonycyborg17 joined #nim |
18:28:22 | * | loonycyborg17 quit (Killed (Sigyn (Spam is off topic on freenode.))) |
18:34:55 | FromDiscord | <Shield> how do I make nim generate readable assembly code? |
18:35:39 | Araq | --lineDir:on and pass some flags to gcc/clang that keep the produced asm |
18:35:51 | Araq | I can never remember what that switch is called, -S ? |
18:39:48 | FromGitter | <Clyybber> @rayman22201 It certainly does look interesting. It also doesn't claim to have "innovative" features, though I think the term rewriting is an interesting approach to what is essentially a macro. |
18:41:37 | TheLemonMan | dom96, ping |
18:44:37 | FromDiscord | <Shield> where is the asm kept? I didn't find it in nimcache |
18:49:11 | * | darithorn quit (Quit: WeeChat 2.2) |
18:50:09 | FromGitter | <mratsim> in the .o objects in nimcache |
18:50:43 | * | navin quit (Remote host closed the connection) |
18:51:02 | FromGitter | <mratsim> but you should take the .c files in nimcache copy paste the gcc command that was used to produce them and add -S |
18:51:21 | Araq | no, you can use --passC:"-S" |
18:53:41 | FromDiscord | <Shield> it worked, thanks! |
19:00:36 | * | junland joined #nim |
19:02:18 | * | pzich7 joined #nim |
19:06:19 | * | pzich7 quit (Remote host closed the connection) |
19:08:02 | FromGitter | <codenoid> hi |
19:08:11 | FromGitter | <codenoid> i want ask something about algorithm |
19:10:05 | FromGitter | <codenoid> total_post = 8 ⏎ total_post_per_page = 5 ⏎ ⏎ #ex : total_post = 8 == 2 page ⏎ ... [https://gitter.im/nim-lang/Nim?at=5ba3f08d33da0f649e2b8cd7] |
19:10:33 | FromGitter | <codenoid> i'm bad at math xD |
19:12:50 | FromGitter | <codenoid> i was think about ⏎ `total_post/total_post_per_page # -> to even, ex 8/5 1.6 > 2 (2 page)` |
19:13:01 | TheLemonMan | pages = (posts / posts_per_page) + 1 |
19:15:47 | FromGitter | <dm1try> #ex : total_post = 10 == 2 page |
19:16:09 | FromGitter | <codenoid> yes like that @dm1try |
19:20:46 | FromGitter | <Vindaar> @codenoid, @dm1try refers to the fact that TheLemonMan's formula breaks for 10 posts. I'd go with `let pages = ceil(posts / posts_per_page)` |
19:21:09 | FromGitter | <Vindaar> maybe convert back to `int` if that's what you need |
19:21:14 | FromGitter | <dm1try> winner^ |
19:25:05 | * | chattyMan joined #nim |
19:25:10 | * | chattyMan quit (Remote host closed the connection) |
19:27:25 | FromGitter | <codenoid> yeah ⏎ `math.ceil` is what i need (in python) ⏎ ✨ thankyou |
19:28:09 | FromGitter | <kaushalmodi> what? You are asking solutions for problems writing python code in nim forum? :P |
19:47:47 | * | wildlander quit (Read error: Connection reset by peer) |
19:48:35 | * | wildlander joined #nim |
19:56:51 | FromGitter | <vivekimsit> I am trying to include the side effect pragma `{.noSideEffect.}` to functional but I am getting error: ⏎ ⏎ https://github.com/vivekimsit/pretty-bytes/blob/master/src/prettybytes.nim#L10 ⏎ ⏎ Error: [https://gitter.im/nim-lang/Nim?at=5ba3fb83d655361f762c22ea] |
19:57:08 | FromGitter | <vivekimsit> Error: 'prettybytes' can have side effects |
19:57:29 | FromGitter | <vivekimsit> I am not doing any I/O |
19:57:39 | FromGitter | <vivekimsit> what I am missing here? |
19:59:08 | FromGitter | <vivekimsit> also, I need my function to take integer or float, is there any union operator? |
20:00:58 | TheLemonMan | there's the SomeNumber typeclasss |
20:01:20 | FromGitter | <kaushalmodi> @vivekimsit as an aside, it's probably not a good idea to have `var` in the arg list |
20:01:34 | FromGitter | <kaushalmodi> you won't be able to do `prettybytes(1.2)` |
20:01:43 | FromGitter | <kaushalmodi> because 1.2 is a constant |
20:02:00 | FromGitter | <Vindaar> and I'm pretty sure the `var` argument is what makes it have a side effect |
20:02:22 | FromGitter | <kaushalmodi> hmm, yeah :) |
20:02:46 | FromGitter | <kaushalmodi> so if you remove that var and do something like ⏎ ⏎ ```proc prettybytes*(number: float): string = ⏎ var number: float = number ⏎ ..``` [https://gitter.im/nim-lang/Nim?at=5ba3fce6be4f300626c31f45] |
20:04:17 | FromGitter | <Vindaar> in addition (if you're using Nim's devel version), you can just write `func` to get a `proc` with `{.noSideEffect.}` attached |
20:05:17 | FromGitter | <kaushalmodi> it's the `units` |
20:05:26 | FromGitter | <kaushalmodi> that var is sitting outside the proc |
20:06:33 | FromGitter | <Vindaar> oh, good point. I sort of thought it was a `const` array |
20:07:19 | FromGitter | <Vindaar> (which would still be a side effect maybe?) |
20:07:37 | FromGitter | <kaushalmodi> so this works ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba3fe090cfe7f30f1c3b8f4] |
20:08:19 | FromGitter | <kaushalmodi> yes, it works even if that const is moved outside |
20:08:25 | FromGitter | <kaushalmodi> earlier it was a var |
20:11:33 | FromGitter | <rayman22201> @Clyybber I was being facetious. I was just using it as an opportunity to be a Nim fanboy :-P It actually does look like an interesting project. The term rewriting seems like something in between Nim templates and full macros. |
20:12:54 | TheLemonMan | Nim also have term-rewriting macros ;) |
20:12:59 | FromGitter | <Vindaar> ok, if I understand the explanation for `noSideEffect ` correctly https://nim-lang.github.io/Nim/manual.html#pragmas-nosideeffect-pragma it's indeed allowed to have `var` parameters |
20:13:39 | * | Sembei joined #nim |
20:13:46 | FromGitter | <kaushalmodi> thanks for that clarification |
20:13:55 | FromGitter | <Vindaar> Well, the signature tells me about modifying it, so I can't complain I guess :D |
20:14:04 | FromGitter | <kaushalmodi> so the only culprit for sideeffects was the var array being outside the proc |
20:14:16 | FromGitter | <Vindaar> yes |
20:14:56 | FromGitter | <rayman22201> @TheLemonMan exactly. Nim has term-rewriting macros and full macros. I.E. strictly more powerful. It seems really limiting to just have term-rewriting macros, imo. |
20:15:12 | * | Pisuke quit (Ping timeout: 252 seconds) |
20:15:18 | FromGitter | <kaushalmodi> in any case, here's the updated code: ⏎ ⏎ @vivekimsit ⏎ ⏎ 1) allow const args ... [https://gitter.im/nim-lang/Nim?at=5ba3ffd61ee2ca650246d01d] |
20:15:43 | FromGitter | <kaushalmodi> outputs: ⏎ ⏎ ```1.123 B ⏎ 1 B ⏎ 1.024 KB ⏎ 1 KB``` [https://gitter.im/nim-lang/Nim?at=5ba3ffefbe4f300626c33402] |
20:15:54 | * | MyMind joined #nim |
20:16:11 | * | miran quit (Ping timeout: 260 seconds) |
20:16:50 | * | MyMind quit (Client Quit) |
20:17:09 | TheLemonMan | more powerful means more bugs and more code, that's the takeaway IMO |
20:17:48 | * | MyMind joined #nim |
20:18:13 | * | MyMind quit (Client Quit) |
20:18:17 | FromGitter | <vivekimsit> @kaushalmodi thanks, but I would keep units outside proc because this separates data from function |
20:18:50 | FromGitter | <kaushalmodi> yep, makes sense. (used to typing too much elisp.. what is data what is code..) |
20:19:02 | * | Sembei quit (Ping timeout: 252 seconds) |
20:19:15 | FromGitter | <vivekimsit> also, I didn't get it. ⏎ ⏎ why I cannot do? ⏎ ⏎ ` ... [https://gitter.im/nim-lang/Nim?at=5ba400c3f7e1580625fe58cf] |
20:19:27 | FromGitter | <vivekimsit> sorry for the formatting |
20:19:51 | FromGitter | <vivekimsit> it seems leaking implementation detail to the outside world |
20:20:01 | FromGitter | <kaushalmodi> with your existing code, making that var a const won't work |
20:20:12 | * | Sembei joined #nim |
20:20:15 | FromGitter | <kaushalmodi> because your proc signature requires the arg to be mutable (var) |
20:20:26 | FromGitter | <vivekimsit> and what if I have predefined variable which I want t convert? |
20:20:35 | FromGitter | <kaushalmodi> what's leaking implementation detail? |
20:20:59 | FromGitter | <vivekimsit> the function always expects literal to be an argument |
20:21:14 | FromGitter | <kaushalmodi> ok, it depends on your requirement |
20:21:21 | FromGitter | <kaushalmodi> I thought that proc outputs just the string |
20:21:28 | FromGitter | <vivekimsit> yes |
20:21:28 | FromGitter | <kaushalmodi> if you need to modify the input arg too, keep it var |
20:22:06 | FromGitter | <vivekimsit> but for example in my client code I have some variable `b=100` and I want t convert it into pretty bytes |
20:22:25 | FromGitter | <kaushalmodi> what does 'convert' mean here? |
20:22:26 | FromGitter | <vivekimsit> how will I pass that variable to my function? |
20:22:57 | FromGitter | <vivekimsit> `prettybytes(b) => 1.123 B` |
20:23:17 | FromGitter | <kaushalmodi> so that works with my updated snippet too.. I am confused |
20:23:32 | FromGitter | <Vindaar> personally I'd rather refactor `prettyBytes` into 2 procs then. 1 to perform the conversion (taking a `var`) and the other to create the pretty string |
20:24:14 | FromGitter | <kaushalmodi> or i'd just have it return a tuple |
20:24:26 | FromGitter | <kaushalmodi> (converted n, prettystr) |
20:24:55 | FromGitter | <kaushalmodi> then you can do `(newNum, prettyStr) = prettybytes(oldNum)` |
20:25:01 | FromGitter | <vivekimsit> you are passing constants as arguments right now |
20:25:11 | FromGitter | <vivekimsit> which I understand is because of var |
20:25:13 | FromGitter | <kaushalmodi> I can pass anything to that refactored code |
20:25:16 | FromGitter | <kaushalmodi> const or var |
20:25:24 | FromGitter | <vivekimsit> ok let me check then :) |
20:25:54 | FromGitter | <rayman22201> @TheLemonMan True, he has legit reasons for the design decisions he made. He responded to a comment on HN where he described not wanting to fall into the "DSL hell" that macros can bring. He talked about seeing it in the Rust community, but Nim has also fought with this dilemma. It's always a cost benefit analysis of power / convenience vs. bugs / complexity. |
20:26:03 | FromGitter | <kaushalmodi> (https://files.gitter.im/nim-lang/Nim/OGjs/image.png) |
20:26:43 | FromGitter | <vivekimsit> ya it worked, sorry :p |
20:27:41 | FromGitter | <mratsim> outside const are allowed in a noSIdeEffect proc |
20:28:06 | FromGitter | <kaushalmodi> yep, I verified that too |
20:28:11 | FromGitter | <mratsim> just don’t access runtime globals |
20:28:42 | FromGitter | <mratsim> echoing or reading/writing a file is considering accessing a global |
20:28:54 | TheLemonMan | DSL hell heh, we're living in the DSL heaven |
20:29:04 | * | kapil___ quit (Quit: Connection closed for inactivity) |
20:30:00 | FromGitter | <kaushalmodi> @mratsim just to add the mention of using `debugEcho` in nosideeffect procs aka `func` (devel) |
20:30:24 | * | seni joined #nim |
20:31:25 | FromGitter | <vivekimsit> cool, now getting error while using `:g` in template |
20:32:03 | FromGitter | <vivekimsit> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba403c27dca3065032e40e7] |
20:32:29 | FromGitter | <rayman22201> @TheLemonMan lol! It's all in the eye of the beholder |
20:39:38 | * | Junaos8 joined #nim |
20:39:54 | FromGitter | <vivekimsit> I see that its a known issue |
20:39:55 | FromGitter | <vivekimsit> https://github.com/nim-lang/Nim/issues/7632 |
20:41:20 | Araq | what is this DSL hell? never seen it, I've only seen bad code. And far worse code in DSL-free Java/C code. |
20:41:28 | FromGitter | <vivekimsit> @kaushalmodi how you are able to compile it? |
20:41:44 | FromGitter | <kaushalmodi> compile what? |
20:41:53 | FromGitter | <kaushalmodi> the exact snippet I pasted? |
20:42:11 | Araq | the arguments against macros are all applicable to plain function calls |
20:42:12 | * | Junaos8 quit (Remote host closed the connection) |
20:43:13 | FromGitter | <rayman22201> lol. I agree with you. I'm definitely a Nim fanboy! I would pick having macros and being careful over not having macros any day. |
20:43:19 | FromGitter | <vivekimsit> I am not able to compile with `:g` in fmt |
20:44:23 | Araq | to be fair though, designing good DSLs is really hard and a macro system is a never ending source of compiler bugs |
20:45:40 | FromGitter | <kaushalmodi> hmm, I don't remember if the :g support was added in devel |
20:45:46 | FromGitter | <kaushalmodi> I build Nim from its devel branch |
20:45:51 | * | ||cw10 joined #nim |
20:46:00 | * | ||cw10 quit (Remote host closed the connection) |
20:46:22 | Araq | but it's unclear how many of the compiler bugs stem from the fact that the compiler writer started as an amateur |
20:46:44 | FromGitter | <rayman22201> @Araq Good thing you are a skilled programmer that squashes compiler bugs like a mythological demigod :-P |
20:46:55 | Araq | and designing good APIs is also really hard. |
20:47:10 | FromGitter | <kaushalmodi> @vivekimsit it was added in Dec 2017 |
20:47:18 | FromGitter | <kaushalmodi> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba407555df5194734ec1993] |
20:47:30 | TheLemonMan | everything is hard but good-enough is often easier |
20:47:52 | FromGitter | <kaushalmodi> so that's in the first commit of stfformat |
20:48:14 | FromGitter | <arnetheduck> @Araq ever crossed your mind to write the compile anew, from scratch? |
20:48:16 | FromGitter | <rayman22201> programming is hard. It's the same duality. Designing a good API and a good DSL are really "two sides of the same coin" so to speak. |
20:48:39 | FromGitter | <iffy> I'm reading through a large file (using `while stream.readLine(line):`) and the loop exits before finishing the file. It's at the same place every time. There's a lot of binary data in the file. There's no error thrown. I think it's because a null byte was encountered. Which leads me to... |
20:48:39 | FromGitter | <vivekimsit> @kaushalmodi what I am missing then? |
20:48:54 | FromGitter | <iffy> What's the best way to store binary data (including nulls) a sequence of chars? |
20:49:04 | FromGitter | <vivekimsit> I installed it last week |
20:49:08 | FromGitter | <kaushalmodi> can you paste the actual full error? |
20:49:12 | Araq | arnetheduck: yep. |
20:49:33 | Araq | all the time I want to start it from scratch |
20:49:54 | FromGitter | <vivekimsit> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba407f2b9531f2dfa982807] |
20:50:04 | Araq | but the saner route is to refactor the hell out of it until it gets into shape |
20:51:06 | FromGitter | <rayman22201> @iffy I would use stream.readData and related methods: https://nim-lang.org/docs/streams.html#readData |
20:51:09 | FromGitter | <kaushalmodi> @vivekimsit and if you remove ":g", it works? |
20:51:25 | TheLemonMan | iffy, why are you using readLine on a binary stream? |
20:51:29 | FromGitter | <vivekimsit> yes |
20:51:48 | Araq | readLine was changed on devel, are you on devel? |
20:53:29 | FromGitter | <iffy> @TheLemonMan it's a log of HTTP requests/responses... so it's semi-line-delimited |
20:53:57 | FromGitter | <iffy> I'm on devel, yes |
20:54:01 | FromGitter | <iffy> Araq: ^ |
20:54:02 | FromGitter | <Vindaar> @vivekimsit try to import `strformat` in `unit.nim` |
20:54:15 | TheLemonMan | once the stream needle ends up in the non-textual part of the request you're boned |
20:54:34 | FromGitter | <kaushalmodi> @vivekimsit ok, I can reproduce that error on devel too |
20:54:46 | FromGitter | <kaushalmodi> the prettybytes proc works by itself, with :g |
20:54:52 | FromGitter | <kaushalmodi> but not inside the unittests |
20:54:55 | FromGitter | <kaushalmodi> no idea why |
20:55:09 | FromGitter | <vivekimsit> yes, it works now strange |
20:55:17 | FromGitter | <kaushalmodi> ? |
20:55:24 | FromGitter | <vivekimsit> the error was too cryptic |
20:55:30 | FromGitter | <vivekimsit> I mean it works now lol |
20:55:57 | FromGitter | <kaushalmodi> you had to import strformat in the unit.nim too? |
20:56:10 | FromGitter | <kaushalmodi> I don't understand why that would be needed |
20:56:23 | FromGitter | <iffy> I'm guessing this is the code that's stopping me: https://github.com/nim-lang/Nim/blob/855956bf617f68ac0be3717329e9e1181e5dc0c6/lib/pure/streams.nim#L303 |
20:56:51 | FromGitter | <Vindaar> I don't understand it either, but I've had similar things. And someone else had a similar problem recently too. @dm1try found a related issue on github |
20:56:59 | * | xet7 quit (Quit: Leaving) |
20:57:18 | Araq | er ... why do you use readLine on binary data? |
20:57:35 | Araq | if \0 is valid data, how come that \L isn't? |
20:57:54 | FromGitter | <vivekimsit> yes, I needed to import it in tests as well |
20:58:04 | FromGitter | <kaushalmodi> @vivekimsit please file an issue. I am curious to understand why that is needed. |
20:58:25 | FromGitter | <kaushalmodi> .. and why especially after adding ":g" |
20:58:28 | FromGitter | <Vindaar> thinking of this: https://irclogs.nim-lang.org/15-09-2018.html#10:54:35 |
20:58:38 | FromGitter | <Vindaar> linking to this https://github.com/nim-lang/Nim/issues/4773 |
20:58:39 | FromGitter | <vivekimsit> I am pretty new to nim and coming from JS it seems a bit of pain while dealing with typings but I hope I will get easier :) |
20:59:29 | FromGitter | <kaushalmodi> "pain while dealing with typings" - strong typing is reason 1 why people use Nim (I believe) |
20:59:31 | FromGitter | <vivekimsit> @kaushalmodi I think there is one already |
20:59:31 | FromGitter | <vivekimsit> https://github.com/nim-lang/Nim/issues/7632 |
20:59:43 | FromGitter | <vivekimsit> yes, and I need to learn |
20:59:59 | FromGitter | <vivekimsit> I am just saying |
21:00:21 | FromGitter | <kaushalmodi> I think that that issue is different |
21:00:38 | FromGitter | <vivekimsit> ok |
21:01:00 | FromGitter | <kaushalmodi> and the surprising part is that it started erroring only after adding the ":g" formatting str |
21:01:10 | * | Trustable quit (Remote host closed the connection) |
21:01:20 | * | druonysus joined #nim |
21:01:20 | * | druonysus quit (Changing host) |
21:01:20 | * | druonysus joined #nim |
21:01:24 | FromGitter | <vivekimsit> also, I may sound stupid but any way to ignore pushing binary files in git? |
21:01:39 | FromGitter | <vivekimsit> I can do gitignore |
21:01:47 | FromGitter | <kaushalmodi> yes, that |
21:02:15 | FromGitter | <iffy> Araq: I'm reading a log of HTTP requests/responses. So it's a somewhat line-delimited exercise, but not when images are in the responses. I can write my own readline proc -- it was just a surprise that it stopped rather than emitting an error |
21:03:24 | Araq | sorry this makes no sense to me. If the imagine contains a byte of the value 10 then you stop at that position? |
21:03:29 | Araq | *image |
21:04:16 | * | noonien quit (Quit: Connection closed for inactivity) |
21:04:47 | Araq | https://travis-ci.org/nim-lang/nightlies it's green, now where are the binaries? |
21:05:24 | Araq | ah never mind |
21:05:52 | * | druonysus quit (Client Quit) |
21:06:37 | FromGitter | <vivekimsit> Thank you guys, its my first time learning system programming and you all have been very supportive so far |
21:07:08 | FromGitter | <iffy> Araq: I think it's the \0 byte where it's stopping, not \10 |
21:07:11 | FromGitter | <vivekimsit> is there anything similar to npm to publish modules? |
21:07:25 | FromGitter | <Vindaar> @vivekimsit always glad to help friendly people :) |
21:07:49 | Araq | iffy: Yeah and if readLine doesn't stop at \0 it would stop at \10 instead |
21:08:23 | FromGitter | <kaushalmodi> @vivekimsit You are welcome |
21:08:25 | FromGitter | <kaushalmodi> nimble! |
21:09:23 | FromGitter | <kaushalmodi> read through https://github.com/nim-lang/nimble#creating-packages |
21:09:44 | FromGitter | <kaushalmodi> the next section after that is on publishing those packages |
21:09:54 | FromGitter | <iffy> Araq: I don't think it's a bug in readLine -- more a bug in my expectation of how it would behave. This does what I want: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba40ca1b9531f2dfa984503] |
21:11:46 | FromGitter | <vivekimsit> @kaushalmodi thanks |
21:13:16 | Araq | iffy: how do you know the image file cannot contain a \n ? |
21:16:12 | FromGitter | <iffy> Araq: oh, it can contain a \n, but in my parsing code, I know when I'm in an image body and keep reading lines (and inserting the \n back in) until I reach the sentinel line that tells me it's the end of the body. |
21:17:41 | * | nsf quit (Quit: WeeChat 2.2) |
21:18:16 | Araq | that's terrible :-) |
21:18:20 | TheLemonMan | I'd parse it using some perl instead, the whole program will fit in a single 80x24 terminal |
21:18:35 | FromGitter | <iffy> it is terrible :) |
21:19:00 | FromGitter | <iffy> if I could trust the content-length header, I'd use that |
21:19:56 | dom96 | Why can't you trust that header? |
21:20:21 | FromGitter | <iffy> These are logs from a pentest... so some could intentionally be wrong :) |
21:20:52 | FromGitter | <iffy> although, chances are good that I shouldn't trust the sentinel either... but I haven't run into that being a problem yet |
21:21:12 | dom96 | What parsing logic are you after? |
21:22:22 | FromGitter | <iffy> I have a file with a bunch of HTTP requests and responses and I just want to know things about each request/response (URL, parameters in url, json body, xml body, etc...). I don't get to decide the format, unfortunately |
21:22:30 | FromGitter | <iffy> (the format of the log file) |
21:24:01 | dom96 | if the format is ambiguous then there isn't much you can do |
21:24:09 | FromGitter | <iffy> right |
21:24:41 | FromGitter | <iffy> I came here just because I didn't know why readLine was quitting part way through. But now I know that it doesn't like nulls so I'm good now. |
21:27:09 | * | outlawpoet joined #nim |
21:28:04 | * | outlawpoet quit (Remote host closed the connection) |
21:30:15 | * | voiceftp quit (Remote host closed the connection) |
21:31:36 | * | voiceftp joined #nim |
21:33:30 | FromGitter | <mratsim> @TheLemonMan, how many samples does criterion takes by default? |
21:33:55 | * | webpigeon11 joined #nim |
21:34:10 | TheLemonMan | mratsim, at least 100 |
21:34:32 | FromGitter | <mratsim> mmm, that’s problematic with 1000x1000 tensors |
21:34:40 | * | webpigeon11 quit (Killed (Sigyn (Spam is off topic on freenode.))) |
21:35:10 | TheLemonMan | yeah, you gotta play with the time budgets too |
21:36:18 | * | druonysus joined #nim |
21:36:19 | * | druonysus quit (Changing host) |
21:36:19 | * | druonysus joined #nim |
21:37:14 | * | PrimHelios quit (Quit: Leaving) |
21:40:09 | * | darithorn joined #nim |
21:40:55 | * | TheLemonMan quit (Quit: "It's now safe to turn off your computer.") |
21:56:26 | * | darithorn quit (Quit: WeeChat 2.2) |
22:00:15 | * | voiceftp quit (Remote host closed the connection) |
22:00:35 | * | voiceftp joined #nim |
22:01:14 | * | mmint1 joined #nim |
22:01:18 | * | mmint1 quit (Remote host closed the connection) |
22:11:17 | * | voice_ftp joined #nim |
22:11:47 | * | voiceftp quit (Ping timeout: 252 seconds) |
22:14:24 | * | zachcarter joined #nim |
22:23:49 | zachcarter | so I have this working now - https://gist.github.com/zacharycarter/2cb9bbe98d6be01b018413403a5160b6 - with my libraries and mobx + web components |
22:31:57 | * | xekz joined #nim |
22:33:26 | * | wildlander quit (Quit: Konversation terminated!) |
22:35:29 | * | xekz quit (Remote host closed the connection) |
22:36:18 | * | voice_ftp quit (Ping timeout: 245 seconds) |
22:39:55 | * | voiceftp joined #nim |
22:47:07 | * | icebattle quit (Read error: Connection reset by peer) |
22:47:23 | * | icebattle joined #nim |
22:56:04 | * | a2cypher joined #nim |
22:57:04 | * | a2cypher quit (Remote host closed the connection) |
23:00:35 | * | Notkea quit (Remote host closed the connection) |
23:18:53 | * | seni quit (Quit: Leaving) |
23:30:57 | zachcarter | https://forum.nim-lang.org/t/3755#26047 |
23:44:15 | * | sfz- joined #nim |
23:49:01 | * | sfz- quit (Remote host closed the connection) |
23:59:05 | FromGitter | <gogolxdong> zach, do you know how to solve the issue above mentioned? |