<< 20-09-2018 >>

00:00:49FromGitter<kayabaNerve> WebView? As in Android?
00:00:59FromGitter<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:11enthus1astwhen it comes to tables/grids there are not much choices
00:01:38FromGitter<kayabaNerve> As in Android?
00:01:48FromGitter<kayabaNerve> I'm focusing on Win Dev
00:02:11FromGitter<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:17FromGitter<kayabaNerve> Am I missing anything right now?
00:02:21enthus1astbut qt is cool
00:02:34enthus1astplayed with it lately
00:02:37FromGitter<kayabaNerve> The only non-licensed UI lib out there I actually like is Kivy but it's for Python which I hate.
00:03:13FromGitter<kayabaNerve> But it's large (I won't say bloat just yet) and corporate as hell
00:03:32enthus1astthere is also: libui, fltk, qt, tcl tk, libagar
00:03:40enthus1astnigui
00:04:09FromGitter<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:24FromGitter<kayabaNerve> @adam-r-kowalski Electron is Chromium.
00:04:37enthus1asthttps://github.com/oskca/webview
00:04:40FromGitter<kayabaNerve> I also can't use the JS backend.
00:05:00enthus1astgtk3 :)
00:05:13FromGitter<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:33FromGitter<kayabaNerve> "I also can't use the JS backend"
00:05:45FromGitter<adam-r-kowalski> whats your use case?
00:05:54FromGitter<kayabaNerve> I would be willing to accept the bloat if I knew CSS and could use JS
00:06:14FromGitter<kayabaNerve> High performance networking with multiple C libraries that wouldn't play nice with emscripten
00:06:15FromGitter<adam-r-kowalski> WebViews allow you embed web technology inside of a “native” app
00:07:06FromGitter<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:22FromGitter<adam-r-kowalski> then just open up a socket or use the cffi to talk to your libraries
00:07:56FromGitter<kayabaNerve> ... No. Asynchronous will not help. I definitely need threads.
00:08:10FromGitter<kayabaNerve> I already have async code for my IO. I needed threaded processing.
00:08:59FromGitter<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:06FromGitter<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:35FromGitter<kayabaNerve> ... what
00:09:44FromGitter<kayabaNerve> Dude. You completely do not know what I'm doing.
00:09:56FromGitter<kayabaNerve> I'm already using Nim's asyncdispatch for the network IO.
00:10:21FromGitter<kayabaNerve> I know I need threads and my task is designed to be threaded.
00:10:53FromGitter<kayabaNerve> I'm writing a cryptocurrency node where the TXs are stored on a DAG (can edit one part without affecting another).
00:12:44FromGitter<kayabaNerve> I actually may be able to use WebView. Thanks entus1ast.
00:16:49enthus1astwebview and karax could be cool but would require some testing how things could fit together
00:17:34FromGitter<zetashift> wow didn't know about webview
00:17:38FromGitter<zetashift> that looks neat
00:21:39FromGitter<kayabaNerve> I'm not liking how it talks about starting a web server and how WebView is just a browser
00:22:16enthus1astyou do not need a server
00:22:17FromGitter<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:27enthus1astyou can inject html js css directly in the browser
00:22:29FromGitter<kayabaNerve> ... It talks about spawning a server on 127.0.0.1:0
00:22:34enthus1astyeah
00:22:49FromGitter<kayabaNerve> I'm not saying there's not ways to not spawn any server
00:23:00FromGitter<kayabaNerve> I'm saying I wish that was never something to talk about
00:26:00enthus1asthttps://gist.github.com/enthus1ast/e25a52d768fcefb40b02070398607002
00:26:25enthus1astthe html is feedet in as data url
00:30:25FromGitter<kayabaNerve> Or as file://
00:30:28FromGitter<kayabaNerve> Or as localhost/
00:30:55FromGitter<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:47enthus1astyou can bind a context and call nim functions from js
00:31:59FromGitter<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:30FromGitter<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:47FromGitter<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:26zachcarteranyone know if it's possible to use nimble develop w/ local dependencies?
02:35:16Tangerzachcarter, 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:24TangerIf that's what you mean
02:37:49zachcarterhrm - 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:09zachcarterso you don't have to constantly `nimble install` the projeect your project is depending on
02:38:41zachcarterit'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:53zachcarterdom96 ^ 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:04FromGitter<mvlootman> Ijn
03:28:10FromGitter<iffy> @enthus1ast That makes this error: `lib/pure/strformat.nim(315, 39) Error: undeclared identifier: 'sql_arr'`
03:29:51FromGitter<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:34FromGitter<kayabaNerve> Talking about Nimble: Just me or should Nimble work as a dependency manager for Nim programs?
03:36:27FromGitter<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:28FromGitter<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:09FromGitter<kayabaNerve> Main issue is the directory structure.
03:38:40leorizeI'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:30FromGitter<iffy> @rayman22201 that macro worked great! Where can I read more about that much better macro-making syntax?
04:03:36FromGitter<kayabaNerve> leorize: Only if you install your thing as a package or symlink it as a package
04:04:02FromGitter<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:11leorizeit also work if you `nimble build` actually
04:04:53FromGitter<kayabaNerve> You still need to follow the folder structure
04:06:59leorizeIs there any reason why you don't follow the structure?
04:13:47FromGitter<kayabaNerve> @Quelklef tried forking my app to use it for Nimble tests. It was very very radical
04:17:53FromGitter<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:07FromGitter<kayabaNerve> And the fact that future Nimble versions will raise it as an error.
04:19:50FromGitter<kayabaNerve> My src Dir has: Database/ Network/ UI/ main.nim
04:20:11FromGitter<kayabaNerve> Nimble wants me to nest everything one step further where those are in src/PackageName
04:22:53leorizenot really
04:22:58leorizeyou don't need src/
04:23:11leorizebut you certainly need packageName/
04:25:45FromGitter<kayabaNerve> ... the issue is that src doesn't have a single file
04:25:49FromGitter<kayabaNerve> *folder
04:26:09FromGitter<kayabaNerve> ~/src is main, a nimscript file, and 5 folders
04:26:47FromGitter<kayabaNerve> Nimble believes the folder structure should be src/PROJECT_NAME/Database (and the other 4 folders)
04:27:37FromGitter<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:59leorizekayabaNerve: well obviously :P
04:31:13FromGitter<kayabaNerve> leorize: That's double nesting!
04:31:14FromGitter<kayabaNerve> Why
04:31:17leorizeyou can move them there then add an .nims including that path
04:31:19FromGitter<kayabaNerve> Single nesting should be good enough
04:31:30leorizeyes you can skip the `src/` path
04:33:17leorizethe reason is simple, you installed 'packageA', you don't want it to provides 'nameThatDuplicateSomeOtherPackages'
04:33:20FromGitter<kayabaNerve> So have nimble build a dummy file just to install the packages?
04:33:28FromGitter<kayabaNerve> That's not the issue
04:33:43leorizethat could be a walkaround
04:33:59FromGitter<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:18leorizeyou can rename src -> "your project name"
04:34:56FromGitter<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:03FromGitter<kayabaNerve> But it shouldn't be
04:35:33FromGitter<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:41FromGitter<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:47leorizeyou can put your main file to `src/`
04:37:55FromGitter<kayabaNerve> The main file is in src/
04:38:01FromGitter<kayabaNerve> But then I have 5 other folders of code in there
04:38:13FromGitter<kayabaNerve> Nimble wants: ⏎ src/main ⏎ src/PROJECT/dir1 ⏎ src/PROJECT/dir2 ⏎ src/PROJECT/dir3 [https://gitter.im/nim-lang/Nim?at=5ba324358909f71f75fdca36]
04:38:55FromGitter<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:22leorizethe 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:33leorizeyour best bet at install dependencies in that case should be to either:
04:42:46leorizeuse a shell script than invoke `nimble install`
04:42:53leorizeor a dummy package
04:43:08leorizeI think the shell script one makes more sense
04:44:42FromGitter<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:13FromGitter<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:40FromGitter<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:10FromGitter<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:17c15ade4Araq: 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:31c15ade4converters also seem like a feature that would make it work to convert error types.
08:32:33c15ade4*Not* suggesting that is the right way to go about things, just wondered your throughts.
08:35:58PMunchSomething like this: https://github.com/nim-lang/Nim/pull/8358/commits/606544db01663ed9870e2ede26589f15c9d7dd13
08:37:31c15ade4PMunch: yeah - it basically requires redoing the stdlib
08:38:13PMunchWell to use it everywhere yes
08:39:23c15ade4I think it would solve a problem I saw with async
08:39:24PMunchAlthough this includes wrappers: https://github.com/nim-lang/Nim/pull/8358/files#diff-fdaf5ed8685e0ec96346e47f49ec2041R338
08:39:28c15ade4that exceptions didn't work
08:39:48c15ade4if we non fatal errors were not exceptions
08:39:51FromGitter<mratsim> exceptions work in async in devel
08:39:57c15ade4Oh
08:40:11c15ade4that changes my opinion a little bit
08:40:17c15ade4from the docs I thought it was some fundamental flaw
08:41:08FromGitter<mratsim> async are implemented completely through macro, it’s just an issue of catching the error messages and locations properly
08:41:45FromGitter<mratsim> I think this fixed it: https://github.com/nim-lang/Nim/pull/7770
08:42:08FromGitter<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:45c15ade4Does that mean if future.failed: is not needed?
08:45:58c15ade4that was something that seemed a bit strange to me
08:46:20c15ade4with errors as values this idiom is not needed
08:47:31FromGitter<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:48c15ade4yeah, I don't have all the facts - Just trying to make sense of when to throw an exception in my own code
08:50:52Araqit is not an "idiom", it is what you sometimes need to do yourself when you couldn't use 'await'
08:51:24c15ade4sorry - :(
08:52:18FromGitter<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:25c15ade4Yes, my code was using libsodium to decrypt something
08:53:35FromGitter<mratsim> and this one: https://gist.github.com/zah/d2d729b39d95a1dfedf8183ca35043b3
08:53:36c15ade4two cases were tampered data, or key mismatches
08:53:53c15ade4I didn't know if it should be an exception or return value to be honest
08:54:20c15ade4thanks for the link
08:55:37c15ade4Exceptions do make straight line code very readable so I don't know.
08:56:05Araqif in doubt, use exceptions
08:56:18c15ade4:)
08:56:20Araqotherwise your code will just be littered with "on error, pass error along"
08:56:38FromGitter<mratsim> Using exceptions for control-flow is bad though
08:56:43c15ade4ok, thank you
08:57:02FromGitter<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:47Araqthe 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:30Araqbut my opinion on this changes on a daily fashion :P
08:58:38FromGitter<mratsim> I don’t really have an issue with exceptions, I also prefer not cluttering my return values with error code
08:59:28FromGitter<mratsim> except when it makes sense to make those first class (i.e. on user inputs)
08:59:32c15ade4The exception tracking/effect system seems like a very nice help too
09:00:04c15ade4where in python I just have no clue what is going on
09:01:59TheLemonManbashing Python is not that fair since it is dynamic by nature (and choice)
09:05:08c15ade4Its not really bashing, I like it, its just my experience
09:06:18Araqbashing things based on bad initial choices is a valid thing to do :P
09:07:06FromGitter<mratsim> "Choosing x86 was bad” <— here you go
09:07:38TheLemonManMIPS master race
09:07:59c15ade4Btw, have there been any dropped backends for nim in the past?
09:08:19FromGitter<mratsim> PHP backend was dropped ;)
09:08:19TheLemonManthe php one :D
09:08:33c15ade4lol
09:08:37c15ade4bash backend please
09:08:42FromGitter<mratsim> @TheLemonMan: Stargate was PC Master Race before it even started: https://twitter.com/VideoCardz/status/1041773139414458370
09:09:12TheLemonManits soul is still with us, the js backend contains a lot of unused pieces from it
09:09:23c15ade4I guess backends increase work and also cause some fragmentation in libs
09:09:51c15ade4:) I was trying to imagine if a Go backend would have any real world value
09:09:56c15ade4or just be a waste
09:10:18FromGitter<mratsim> Go can wrap C so it’s better to just output C code
09:10:28c15ade4yeah that is true
09:10:50FromGitter<mratsim> C is common compiled language, JS is common browser language
09:11:02FromGitter<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:12FromGitter<alehander42> the only new backend I think nim needs now is `wasm`
09:11:27FromGitter<mratsim> or a LLVM frontend
09:12:04TheLemonManor a Fortran one
09:12:20FromGitter<mratsim> or Forth :P
09:12:25FromGitter<alehander42> well nlvm needs contributors i guess
09:13:00FromGitter<kayabaNerve> @mratsim There is a LLVM Compiler. :thinking:
09:13:19FromGitter<kayabaNerve> I would love a wasm backend...
09:13:24FromGitter<mratsim> actually I think Cuda/OpenCL/Vulkan backends would be nice as well
09:13:50c15ade4find someone who will pay for them :P
09:14:04FromGitter<mratsim> I’m paying with my time
09:14:10c15ade4:)
09:14:30FromGitter<mratsim> didn’t start on Vulkan because I’m developping on a MacBook but I will on my new computer
09:15:15FromGitter<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:54FromGitter<mratsim> nice!
09:19:20FromGitter<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:42FromGitter<alehander42> wasn't @krux02 also doing something like that (generating shader code from nim)
09:20:52FromGitter<alehander42> looks nice @jwollen
09:21:05FromGitter<mratsim> but OpenGL: https://github.com/krux02/opengl-sandbox
09:21:31FromGitter<alehander42> yeah
09:21:35FromGitter<mratsim> and it’s higher level
09:21:57FromGitter<jwollen> one level at a time! :P
09:22:07FromGitter<mratsim> we can maybe use krux02 macros on top of @jwollen SPIR-V
09:22:30AraqZerg is OP once somebody/an AI can exploit the fact that all the other races can't tech-switch as effectively
09:23:06Araqthat's my prediction anyway :P
09:24:41FromGitter<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:19copygirlCan I not write code like `foo = bar\n || baz` due to indentation checking..?
09:26:13FromGitter<mratsim> you should split line after the operator
09:26:49copygirlI know I should but that looks ugly to me. Having the operator at the front of the line is much more readable.
09:27:23copygirl"Ah, whatever is above combined with this operator with what follows."
09:27:30FromGitter<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:44copygirlEspecially when chaining multiple operators it makes the flow much more readable.
09:27:47FromGitter<mratsim> otherwise just use parenthesis
09:28:48*navin_ joined #nim
09:29:09copygirlHow?
09:29:37FromGitter<mratsim> foo = (\n … \n )
09:29:55copygirlMhh I guess that doesn't work with templates or so.
09:30:26FromGitter<mratsim> probably this one: https://github.com/nim-lang/Nim/issues/8258
09:30:27*navin quit (Ping timeout: 240 seconds)
09:31:46TheLemonManis there a nicer way to serialize an object to a json string without having to build many intermediate JsonNodes?
09:32:00FromGitter<mratsim> %*?
09:32:11FromGitter<mratsim> or check Araq’s packedJSON
09:32:33FromGitter<mratsim> https://github.com/Araq/packedjson
09:33:23*navin_ quit (Ping timeout: 244 seconds)
09:33:54TheLemonMannice
09:34:22FromGitter<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:39TheLemonManoh, it's not os nice because it has its own benchmark harness :P
09:35:26FromGitter<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:38Araqbecause 'shallow' will be replaced with move semantics?
09:39:11FromGitter<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:14FromGitter<bung87> I write a DSL lib trying to do ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba36b395df5194734e7f73d]
09:41:30FromGitter<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:30Araqmratsim: a move ensures linearity but I have mutiple owners
10:07:17Araqand 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:26FromDiscord<Shield> is there a built in function to get the next valid value for an enum when they have disjoint values?
10:20:19Araqsystem.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:23FromDiscord<Shield> it seems that it works like inc, it doesn't jump to the next valid enum
10:33:13TheLemonManyeah, at runtime there's no knowdlege about your enum holes
10:34:01*PMunch quit (Ping timeout: 260 seconds)
10:34:28FromDiscord<Shield> ah
10:35:06Araqenums with holes are a stupid feature and need to die, for C interop a 'distinct cint' would have been better
10:37:46TheLemonMan1.0 is not out yet, you're still in time :)
10:40:58FromDiscord<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:36TheLemonManthe real question is why do you load the enums from a file?
10:44:06AraqShield: You can also serialize them as strings
10:46:22*dvn quit (Ping timeout: 250 seconds)
10:46:31FromDiscord<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:50FromGitter<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:59FromGitter<alehander42> good noon
11:16:55FromGitter<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:21FromGitter<alehander42> but that point is good, I thought last week about a nim linq lib based on his forloop macro comments
11:17:48FromGitter<alehander42> and that it can be actually implemented as a "fronted" for zero-functional
11:18:06FromGitter<alehander42> or to somehow reuse its internals
11:19:21*navin quit (Remote host closed the connection)
11:19:30FromGitter<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:05FromGitter<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:32FromGitter<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:16shashlick@kaushalmodi: does emacs hang for you in nim mode
12:17:49shashlickI'm trying spacemacs with nim layer and it hangs as soon as I type
12:18:02shashlickFeels like some nimsuggest issues
12:18:46FromGitter<kaushalmodi> I'd disable nimsuggest first.
12:19:09FromGitter<kaushalmodi> Secondly krux02 has added PR for improving nim-mode performance
12:19:19shashlickHow do you disable it
12:19:31shashlickSo no auto complete works for you?
12:19:49FromGitter<kaushalmodi> Set the nimsuggest var to nil
12:19:56FromGitter<kaushalmodi> Not at my computer right now.
12:20:12FromGitter<kaushalmodi> Or.. remove nimsuggest from PATH for now.
12:20:50shashlickOk that's unfortunate
12:21:00shashlickAny opinion on spacemacs
12:21:27shashlickFeels very slow to start and a ram hog, might as well use vscode then
12:21:33FromGitter<kaushalmodi> Though, I haven't needed to do that.
12:22:21shashlickSo 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:13abmxi editor usable when
13:09:41*ritchie_ joined #nim
13:09:53FromGitter<kaushalmodi> shashlick: I don't use any auto complete, actually
13:10:04FromGitter<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:19FromGitter<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:24FromGitter<codenoid> sublime
14:03:31FromGitter<bung87> vscode good enough
14:10:01PMunchInteresting, 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:35FromGitter<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:19pigmejjust `M-x customize-variable` and customize `nimsuggest-options` no need to manually edit files
15:05:53Araq"Note that the provider name GitHub is case sensitive (e.g. not Github)." sure, document your bugs
15:06:36Araqmaybe 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:51stefanos82lol
15:18:37*SenasOzys quit (Quit: Leaving)
15:20:20*SenasOzys joined #nim
15:20:24FromGitter<alehander42> GiThuB E!!Rprise
15:20:40TheLemonManare you having a stroke?
15:22:56FromGitter<alehander42> you're being very case sensitive lemon man
15:23:21stefanos82more like a hiccup TheLemonMan lol
15:23:32TheLemonManyou surely mean 7h313m0nm4n
15:23:53stefanos82remember the google incident?
15:24:02*iffy joined #nim
15:24:05stefanos82with the unicode G letter in a domain name?
15:24:51stefanos82https://thenextweb.com/google/2016/11/21/google-isnt-google/
15:24:54TheLemonManthat's punycode domain
15:25:35FromGitter<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:26PMunchI think parsetoml should support 0.5.0 of the TOML spec now :)
15:31:29*PMunch quit (Quit: Leaving)
15:34:39TheLemonMannice.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:00FromGitter<kaushalmodi> PMunch: That's awesome!
16:30:34FromGitter<kaushalmodi> Thanks! I think on the TOML repo, you can request listing parsetoml as 0.5.0 compliant parser
16:31:03FromGitter<kaushalmodi> The readme needs to be updated.. still says "Currently it supports v0.4.0 of the TOML specification."
16:31:57FromGitter<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:37FromGitter<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:27FromGitter<iffy> Can I test if a tuple has a key?
17:00:23FromGitter<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:39Araqwhen compiles(tup.maKey)
17:06:08FromGitter<kaushalmodi> Araq: awesome! thanks
17:06:11FromGitter<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:09FromGitter<iffy> Thanks!
17:10:43FromGitter<kaushalmodi> works for `compiles(person[0])` and so on.. too
17:10:57FromGitter<kaushalmodi> wondering.. how to get number of fields in a tuple
17:11:18TheLemonManyou can also use a concept (I think)
17:11:34FromGitter<kaushalmodi> I've yet to get into concepts
17:14:03*stefanos82 quit (Quit: Quitting for now...)
17:17:16TheLemonManI've sent more than 100 PRs, nice
17:20:28FromGitter<kaushalmodi> TheLemonMan +1
17:20:53FromGitter<kaushalmodi> Araq: still tinkering with that `compiles` snippet ..
17:20:56FromGitter<kaushalmodi> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba3d6f8e5c2cc56adbb39e6]
17:21:15FromGitter<kaushalmodi> that outputs: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba3d70be6046343f38f5d95]
17:21:49FromGitter<kaushalmodi> so "by name" reference outcome is the same whether I use the tuple type or tuple var
17:22:10FromGitter<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:06FromGitter<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:39FromGitter<Vindaar> @kaushalmodi number of fields in tuple -> `typetraits.arity`, so for your example `type(person).arity`
17:32:13FromGitter<kaushalmodi> @Vindaar Cool! thanks
17:32:31FromGitter<kaushalmodi> any comment about why Person[0] doesn't work? should it work?
17:35:00FromGitter<Vindaar> If I'm not mistaken there was something specific about tuples and indexing by integer
17:39:35Araqthe index must be a constant
17:41:55*navin_ quit (Remote host closed the connection)
17:42:17*navin joined #nim
17:42:38FromGitter<kaushalmodi> It is a constant in that example above
17:45:40FromGitter<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:28FromGitter<kaushalmodi> but TupleType.FieldName works..
17:46:47FromGitter<kaushalmodi> we are just check if a field exists.. doing type.field is meaningless otherwise
17:46:49FromGitter<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:53FromGitter<kaushalmodi> hmm, makes sense
17:48:35FromGitter<kaushalmodi> so it just happens that the square brackets are generics syntax, else it would have worked
17:49:10FromGitter<kaushalmodi> are purely numerical generics possible?
17:49:49FromGitter<kaushalmodi> I mean, can a type be just a number?
17:50:07TheLemonManstatic[T] to the rescue
17:51:39FromGitter<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:50FromGitter<kaushalmodi> but `echo compiles(Person.age)` returns true
17:51:53FromGitter<kaushalmodi> as expected
17:52:09FromGitter<kaushalmodi> TheLemonMan: I didn't understand how static[T] can be used here
17:52:33TheLemonManyou asked "I mean, can a type be just a number"
17:53:11FromGitter<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:25FromGitter<Vindaar> of `age` in `Person` I meant
17:53:58FromGitter<Vindaar> So if you import `typetraits` it should now echo `int`
17:54:11FromGitter<kaushalmodi> TheLemonMan: ah, OK. I meant something like `Option[123]` would never be valid, right?
17:54:33FromGitter<kaushalmodi> @Vindaar ah, OK to you too :)
17:55:37FromGitter<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:27FromGitter<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:52FromGitter<kaushalmodi> pretty neat
17:59:57FromGitter<kaushalmodi> thanks!
18:00:05FromGitter<Vindaar> :)
18:04:38FromGitter<kaushalmodi> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba3e1368909f71f75027ce7]
18:04:42FromGitter<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:55FromDiscord<Shield> how do I make nim generate readable assembly code?
18:35:39Araq--lineDir:on and pass some flags to gcc/clang that keep the produced asm
18:35:51AraqI can never remember what that switch is called, -S ?
18:39:48FromGitter<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:37TheLemonMandom96, ping
18:44:37FromDiscord<Shield> where is the asm kept? I didn't find it in nimcache
18:49:11*darithorn quit (Quit: WeeChat 2.2)
18:50:09FromGitter<mratsim> in the .o objects in nimcache
18:50:43*navin quit (Remote host closed the connection)
18:51:02FromGitter<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:21Araqno, you can use --passC:"-S"
18:53:41FromDiscord<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:02FromGitter<codenoid> hi
19:08:11FromGitter<codenoid> i want ask something about algorithm
19:10:05FromGitter<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:33FromGitter<codenoid> i'm bad at math xD
19:12:50FromGitter<codenoid> i was think about ⏎ `total_post/total_post_per_page # -> to even, ex 8/5 1.6 > 2 (2 page)`
19:13:01TheLemonManpages = (posts / posts_per_page) + 1
19:15:47FromGitter<dm1try> #ex : total_post = 10 == 2 page
19:16:09FromGitter<codenoid> yes like that @dm1try
19:20:46FromGitter<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:09FromGitter<Vindaar> maybe convert back to `int` if that's what you need
19:21:14FromGitter<dm1try> winner^
19:25:05*chattyMan joined #nim
19:25:10*chattyMan quit (Remote host closed the connection)
19:27:25FromGitter<codenoid> yeah ⏎ `math.ceil` is what i need (in python) ⏎ ✨ thankyou
19:28:09FromGitter<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:51FromGitter<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:08FromGitter<vivekimsit> Error: 'prettybytes' can have side effects
19:57:29FromGitter<vivekimsit> I am not doing any I/O
19:57:39FromGitter<vivekimsit> what I am missing here?
19:59:08FromGitter<vivekimsit> also, I need my function to take integer or float, is there any union operator?
20:00:58TheLemonManthere's the SomeNumber typeclasss
20:01:20FromGitter<kaushalmodi> @vivekimsit as an aside, it's probably not a good idea to have `var` in the arg list
20:01:34FromGitter<kaushalmodi> you won't be able to do `prettybytes(1.2)`
20:01:43FromGitter<kaushalmodi> because 1.2 is a constant
20:02:00FromGitter<Vindaar> and I'm pretty sure the `var` argument is what makes it have a side effect
20:02:22FromGitter<kaushalmodi> hmm, yeah :)
20:02:46FromGitter<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:17FromGitter<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:17FromGitter<kaushalmodi> it's the `units`
20:05:26FromGitter<kaushalmodi> that var is sitting outside the proc
20:06:33FromGitter<Vindaar> oh, good point. I sort of thought it was a `const` array
20:07:19FromGitter<Vindaar> (which would still be a side effect maybe?)
20:07:37FromGitter<kaushalmodi> so this works ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba3fe090cfe7f30f1c3b8f4]
20:08:19FromGitter<kaushalmodi> yes, it works even if that const is moved outside
20:08:25FromGitter<kaushalmodi> earlier it was a var
20:11:33FromGitter<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:54TheLemonManNim also have term-rewriting macros ;)
20:12:59FromGitter<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:46FromGitter<kaushalmodi> thanks for that clarification
20:13:55FromGitter<Vindaar> Well, the signature tells me about modifying it, so I can't complain I guess :D
20:14:04FromGitter<kaushalmodi> so the only culprit for sideeffects was the var array being outside the proc
20:14:16FromGitter<Vindaar> yes
20:14:56FromGitter<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:18FromGitter<kaushalmodi> in any case, here's the updated code: ⏎ ⏎ @vivekimsit ⏎ ⏎ 1) allow const args ... [https://gitter.im/nim-lang/Nim?at=5ba3ffd61ee2ca650246d01d]
20:15:43FromGitter<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:09TheLemonManmore 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:17FromGitter<vivekimsit> @kaushalmodi thanks, but I would keep units outside proc because this separates data from function
20:18:50FromGitter<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:15FromGitter<vivekimsit> also, I didn't get it. ⏎ ⏎ why I cannot do? ⏎ ⏎ ` ... [https://gitter.im/nim-lang/Nim?at=5ba400c3f7e1580625fe58cf]
20:19:27FromGitter<vivekimsit> sorry for the formatting
20:19:51FromGitter<vivekimsit> it seems leaking implementation detail to the outside world
20:20:01FromGitter<kaushalmodi> with your existing code, making that var a const won't work
20:20:12*Sembei joined #nim
20:20:15FromGitter<kaushalmodi> because your proc signature requires the arg to be mutable (var)
20:20:26FromGitter<vivekimsit> and what if I have predefined variable which I want t convert?
20:20:35FromGitter<kaushalmodi> what's leaking implementation detail?
20:20:59FromGitter<vivekimsit> the function always expects literal to be an argument
20:21:14FromGitter<kaushalmodi> ok, it depends on your requirement
20:21:21FromGitter<kaushalmodi> I thought that proc outputs just the string
20:21:28FromGitter<vivekimsit> yes
20:21:28FromGitter<kaushalmodi> if you need to modify the input arg too, keep it var
20:22:06FromGitter<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:25FromGitter<kaushalmodi> what does 'convert' mean here?
20:22:26FromGitter<vivekimsit> how will I pass that variable to my function?
20:22:57FromGitter<vivekimsit> `prettybytes(b) => 1.123 B`
20:23:17FromGitter<kaushalmodi> so that works with my updated snippet too.. I am confused
20:23:32FromGitter<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:14FromGitter<kaushalmodi> or i'd just have it return a tuple
20:24:26FromGitter<kaushalmodi> (converted n, prettystr)
20:24:55FromGitter<kaushalmodi> then you can do `(newNum, prettyStr) = prettybytes(oldNum)`
20:25:01FromGitter<vivekimsit> you are passing constants as arguments right now
20:25:11FromGitter<vivekimsit> which I understand is because of var
20:25:13FromGitter<kaushalmodi> I can pass anything to that refactored code
20:25:16FromGitter<kaushalmodi> const or var
20:25:24FromGitter<vivekimsit> ok let me check then :)
20:25:54FromGitter<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:03FromGitter<kaushalmodi> (https://files.gitter.im/nim-lang/Nim/OGjs/image.png)
20:26:43FromGitter<vivekimsit> ya it worked, sorry :p
20:27:41FromGitter<mratsim> outside const are allowed in a noSIdeEffect proc
20:28:06FromGitter<kaushalmodi> yep, I verified that too
20:28:11FromGitter<mratsim> just don’t access runtime globals
20:28:42FromGitter<mratsim> echoing or reading/writing a file is considering accessing a global
20:28:54TheLemonManDSL hell heh, we're living in the DSL heaven
20:29:04*kapil___ quit (Quit: Connection closed for inactivity)
20:30:00FromGitter<kaushalmodi> @mratsim just to add the mention of using `debugEcho` in nosideeffect procs aka `func` (devel)
20:30:24*seni joined #nim
20:31:25FromGitter<vivekimsit> cool, now getting error while using `:g` in template
20:32:03FromGitter<vivekimsit> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba403c27dca3065032e40e7]
20:32:29FromGitter<rayman22201> @TheLemonMan lol! It's all in the eye of the beholder
20:39:38*Junaos8 joined #nim
20:39:54FromGitter<vivekimsit> I see that its a known issue
20:39:55FromGitter<vivekimsit> https://github.com/nim-lang/Nim/issues/7632
20:41:20Araqwhat 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:28FromGitter<vivekimsit> @kaushalmodi how you are able to compile it?
20:41:44FromGitter<kaushalmodi> compile what?
20:41:53FromGitter<kaushalmodi> the exact snippet I pasted?
20:42:11Araqthe arguments against macros are all applicable to plain function calls
20:42:12*Junaos8 quit (Remote host closed the connection)
20:43:13FromGitter<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:19FromGitter<vivekimsit> I am not able to compile with `:g` in fmt
20:44:23Araqto be fair though, designing good DSLs is really hard and a macro system is a never ending source of compiler bugs
20:45:40FromGitter<kaushalmodi> hmm, I don't remember if the :g support was added in devel
20:45:46FromGitter<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:22Araqbut it's unclear how many of the compiler bugs stem from the fact that the compiler writer started as an amateur
20:46:44FromGitter<rayman22201> @Araq Good thing you are a skilled programmer that squashes compiler bugs like a mythological demigod :-P
20:46:55Araqand designing good APIs is also really hard.
20:47:10FromGitter<kaushalmodi> @vivekimsit it was added in Dec 2017
20:47:18FromGitter<kaushalmodi> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba407555df5194734ec1993]
20:47:30TheLemonManeverything is hard but good-enough is often easier
20:47:52FromGitter<kaushalmodi> so that's in the first commit of stfformat
20:48:14FromGitter<arnetheduck> @Araq ever crossed your mind to write the compile anew, from scratch?
20:48:16FromGitter<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:39FromGitter<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:39FromGitter<vivekimsit> @kaushalmodi what I am missing then?
20:48:54FromGitter<iffy> What's the best way to store binary data (including nulls) a sequence of chars?
20:49:04FromGitter<vivekimsit> I installed it last week
20:49:08FromGitter<kaushalmodi> can you paste the actual full error?
20:49:12Araqarnetheduck: yep.
20:49:33Araqall the time I want to start it from scratch
20:49:54FromGitter<vivekimsit> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5ba407f2b9531f2dfa982807]
20:50:04Araqbut the saner route is to refactor the hell out of it until it gets into shape
20:51:06FromGitter<rayman22201> @iffy I would use stream.readData and related methods: https://nim-lang.org/docs/streams.html#readData
20:51:09FromGitter<kaushalmodi> @vivekimsit and if you remove ":g", it works?
20:51:25TheLemonManiffy, why are you using readLine on a binary stream?
20:51:29FromGitter<vivekimsit> yes
20:51:48AraqreadLine was changed on devel, are you on devel?
20:53:29FromGitter<iffy> @TheLemonMan it's a log of HTTP requests/responses... so it's semi-line-delimited
20:53:57FromGitter<iffy> I'm on devel, yes
20:54:01FromGitter<iffy> Araq: ^
20:54:02FromGitter<Vindaar> @vivekimsit try to import `strformat` in `unit.nim`
20:54:15TheLemonManonce the stream needle ends up in the non-textual part of the request you're boned
20:54:34FromGitter<kaushalmodi> @vivekimsit ok, I can reproduce that error on devel too
20:54:46FromGitter<kaushalmodi> the prettybytes proc works by itself, with :g
20:54:52FromGitter<kaushalmodi> but not inside the unittests
20:54:55FromGitter<kaushalmodi> no idea why
20:55:09FromGitter<vivekimsit> yes, it works now strange
20:55:17FromGitter<kaushalmodi> ?
20:55:24FromGitter<vivekimsit> the error was too cryptic
20:55:30FromGitter<vivekimsit> I mean it works now lol
20:55:57FromGitter<kaushalmodi> you had to import strformat in the unit.nim too?
20:56:10FromGitter<kaushalmodi> I don't understand why that would be needed
20:56:23FromGitter<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:51FromGitter<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:18Araqer ... why do you use readLine on binary data?
20:57:35Araqif \0 is valid data, how come that \L isn't?
20:57:54FromGitter<vivekimsit> yes, I needed to import it in tests as well
20:58:04FromGitter<kaushalmodi> @vivekimsit please file an issue. I am curious to understand why that is needed.
20:58:25FromGitter<kaushalmodi> .. and why especially after adding ":g"
20:58:28FromGitter<Vindaar> thinking of this: https://irclogs.nim-lang.org/15-09-2018.html#10:54:35
20:58:38FromGitter<Vindaar> linking to this https://github.com/nim-lang/Nim/issues/4773
20:58:39FromGitter<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:29FromGitter<kaushalmodi> "pain while dealing with typings" - strong typing is reason 1 why people use Nim (I believe)
20:59:31FromGitter<vivekimsit> @kaushalmodi I think there is one already
20:59:31FromGitter<vivekimsit> https://github.com/nim-lang/Nim/issues/7632
20:59:43FromGitter<vivekimsit> yes, and I need to learn
20:59:59FromGitter<vivekimsit> I am just saying
21:00:21FromGitter<kaushalmodi> I think that that issue is different
21:00:38FromGitter<vivekimsit> ok
21:01:00FromGitter<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:24FromGitter<vivekimsit> also, I may sound stupid but any way to ignore pushing binary files in git?
21:01:39FromGitter<vivekimsit> I can do gitignore
21:01:47FromGitter<kaushalmodi> yes, that
21:02:15FromGitter<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:24Araqsorry this makes no sense to me. If the imagine contains a byte of the value 10 then you stop at that position?
21:03:29Araq*image
21:04:16*noonien quit (Quit: Connection closed for inactivity)
21:04:47Araqhttps://travis-ci.org/nim-lang/nightlies it's green, now where are the binaries?
21:05:24Araqah never mind
21:05:52*druonysus quit (Client Quit)
21:06:37FromGitter<vivekimsit> Thank you guys, its my first time learning system programming and you all have been very supportive so far
21:07:08FromGitter<iffy> Araq: I think it's the \0 byte where it's stopping, not \10
21:07:11FromGitter<vivekimsit> is there anything similar to npm to publish modules?
21:07:25FromGitter<Vindaar> @vivekimsit always glad to help friendly people :)
21:07:49Araqiffy: Yeah and if readLine doesn't stop at \0 it would stop at \10 instead
21:08:23FromGitter<kaushalmodi> @vivekimsit You are welcome
21:08:25FromGitter<kaushalmodi> nimble!
21:09:23FromGitter<kaushalmodi> read through https://github.com/nim-lang/nimble#creating-packages
21:09:44FromGitter<kaushalmodi> the next section after that is on publishing those packages
21:09:54FromGitter<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:46FromGitter<vivekimsit> @kaushalmodi thanks
21:13:16Araqiffy: how do you know the image file cannot contain a \n ?
21:16:12FromGitter<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:16Araqthat's terrible :-)
21:18:20TheLemonManI'd parse it using some perl instead, the whole program will fit in a single 80x24 terminal
21:18:35FromGitter<iffy> it is terrible :)
21:19:00FromGitter<iffy> if I could trust the content-length header, I'd use that
21:19:56dom96Why can't you trust that header?
21:20:21FromGitter<iffy> These are logs from a pentest... so some could intentionally be wrong :)
21:20:52FromGitter<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:12dom96What parsing logic are you after?
21:22:22FromGitter<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:30FromGitter<iffy> (the format of the log file)
21:24:01dom96if the format is ambiguous then there isn't much you can do
21:24:09FromGitter<iffy> right
21:24:41FromGitter<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:30FromGitter<mratsim> @TheLemonMan, how many samples does criterion takes by default?
21:33:55*webpigeon11 joined #nim
21:34:10TheLemonManmratsim, at least 100
21:34:32FromGitter<mratsim> mmm, that’s problematic with 1000x1000 tensors
21:34:40*webpigeon11 quit (Killed (Sigyn (Spam is off topic on freenode.)))
21:35:10TheLemonManyeah, 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:49zachcarterso 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:57zachcarterhttps://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:05FromGitter<gogolxdong> zach, do you know how to solve the issue above mentioned?