<< 23-07-2018 >>

00:23:40FromGitter<Varriount> Huh, I wonder why #rust is on mozilla, rather than freenode.
00:33:54*krux02 quit (Quit: Leaving)
00:38:49FromGitter<asampal> I've built Nim from source and everything seemed to go OK. When I try to invoke `nimble`, I see `could not load: (libcrypto-1_1-x64|libeay64).dll`. Do I need to download these separately?
00:46:39FromGitter<Varriount> @asampal They should be available as part of the pre-built Nim compiler available on the website.
00:47:06FromGitter<Varriount> You can download that and copy the dlls to Nimble's binary directory.
00:51:58FromGitter<asampal> so nimble is built from a separate repo?
00:53:06FromGitter<asampal> I noticed that after building Nim (as per instructions on GitHub page), there was a nimble.exe (I'm on Windows) in Nim/bin.
00:54:05FromGitter<asampal> Didn't pay attention to see where it was copied from, but if it wasn't built when building Nim itself, why wouldn't the dlls be copied to Nim/bin as well?
00:54:38Calinouhttps://nim-lang.org/download/dlls.zip
00:54:45Calinouyou can fetch Windows DLLs used by Nim here ^
00:54:48Calinou(64-bit + 32-bit)
00:55:38FromGitter<asampal> tha;nks
01:10:16FromGitter<asampal> should the VSCode extension see nimble packages?
01:11:42FromGitter<asampal> I installed Karak following the GitHub readme and created a Nim file with the Hello World example there, but it doesn't look like VSCode is seeing Karax.
01:13:13FromGitter<asampal> I'm guessing there should be some kind of project file that specifies dependencies, no?
01:14:59*dddddd quit (Remote host closed the connection)
01:17:31FromGitter<asampal> so I ran `nimble init` to generate a package config file
01:18:27*mwbrown quit (Ping timeout: 240 seconds)
01:19:38FromGitter<asampal> added a `requires` for karax and the source file seems fine now
01:20:08*mwbrown joined #nim
01:26:29FromGitter<asampal> After building `karun` should the executable normally be added to the path?
01:30:53FromGitter<asampal> I guess I'm assuming karax is a popular framework and that people here know what I'm talking about - is it a thing in the Nim community?
01:36:50FromGitter<Varriount> @asampal If I had to guess, karun is a utility bundled with the karax module
01:37:19FromGitter<rayman22201> Karax is the premier web framework for Nim, I just don't do a lot of web stuff with Nim... so I can't help much :-/
01:38:00FromGitter<rayman22201> Karun is the build tool for karax. It should be safe to add to your PATH. idk if it's required though.
01:38:53FromGitter<asampal> np about not being familiar with Karax in particular, but maybe you could tell me how include works wrt finding source
01:39:46FromGitter<asampal> @Varriount , yes that's what it is, and I built the executable - just don't know if the practice is to have it on the path
01:40:14FromGitter<rayman22201> https://nim-lang.org/docs/manual.html#modules
01:40:25FromGitter<rayman22201> What do you want to know about importing?
01:41:31FromGitter<rayman22201> basically, the filename is the module name
01:41:52FromGitter<asampal> it's not an import that I'm using, but `include` - and the question is where does Nim look for source?
01:42:20FromGitter<asampal> I understand that packages are downloaded as source, no?
01:42:59FromGitter<asampal> so that if I installed karax and the source is now under .nimble, Nim should be able to reach the source for any package
01:45:57FromGitter<asampal> hmm, I think I see what happened - I ran `nimble develop karax` and then moved the source directory
01:46:30FromGitter<asampal> so that the link file for karak, under .nimble was no longer valid
01:47:06FromGitter<rayman22201> include just copy/pastes the source, similar to C #include.
01:48:16FromGitter<asampal> yes, that's what I understood from the docs
01:48:49FromGitter<rayman22201> 👍
01:49:55FromGitter<rayman22201> As far as path searching goes, It will go use the .nimble, so if that is correct that will throw things off
01:51:52FromGitter<rayman22201> Nim will generally use any config files nim.cfg, follwed by .nimble, and default to the root of the project directory. I believe.
01:52:41FromGitter<asampal> I fixed the link pointer and now running the karax Hello World runs (mostly), but I get `Error: This module only works on the JavaScript platform` when I try to run the file from VSCode
01:53:11FromGitter<asampal> I guess the run command in the extension is assuming C
01:54:50FromGitter<Quelklef> Anyone know how I can make https://gist.github.com/Quelklef/0ce5c96ba2fd926750e95733b9d54cf5 work?
01:55:00FromGitter<Quelklef> It works if I make `T` a formal parameter, but I specifically don't want that
01:57:36FromGitter<Quelklef> For some reason it's not recognizing that `2` matches `static[int]`. Is this a bug?
01:58:53FromGitter<Quelklef> I take that back, it seems to be complaining that `typeImpl[2]` isn't a type..
02:08:19FromGitter<rayman22201> @asampal I don't know how to do it in VS code, but you need to use `nim js` instead of `nim c`
02:10:01FromGitter<asampal> yes, I changed the settings in VSCode to build with js and it built, but, according to the karax readme, the proper way to run the example is with `karun`
02:13:22FromGitter<asampal> Trying to run the file with `nim js` resulted in an error stating that `document` wasn't found. Of course the resulting js file needs to be run in a JavaScript runtime with DOM access, otherwise the generated references couldn't be resolved.
02:13:45FromGitter<rayman22201> I'm assuming `karun` would run `nim js` for you
02:13:53FromGitter<asampal> I guess `karun` does that - maybe by running with node - need to read up on what it actually does.
02:14:41*NimBot joined #nim
02:14:47FromGitter<rayman22201> you still have to run it in a browser yourself
02:15:52FromGitter<rayman22201> the `document` not found is most likely not the browser DOM document, but a Nim shim that needs to referenced or imported.
02:16:33FromGitter<rayman22201> I'm out of my depth here, sorry I can't be more specific.
02:17:50FromGitter<rayman22201> @Quelklef Your macro is interesting. It looks like Nim assigns at least some type definitions before it runs macros. It looks like your macro isn't even running.
02:18:43FromGitter<asampal> I think it is the browser document since it's in the generated JavaScript and it's specifically this: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b553b034b880b3e6a40d4fb]
02:20:27FromGitter<rayman22201> are you trying to run that javascript outside the browser?
02:21:40FromGitter<rayman22201> can you post the exact error you got?
02:22:35FromGitter<Quelklef> @rayman22201 Yeah, I tried `echo(result.repr)`-ing, but that never got run. I'm not totally sure what's going on
02:23:17FromGitter<asampal> well, I ran `nim js -r "c:\dev\projects\_nim\newnim\src\main.nim"` which tries to run the result, but I guess not in the proper environment
02:23:34FromGitter<asampal> anyhow, I'm trying with karun, as their readme instructs
02:24:09FromGitter<rayman22201> don't do -r
02:24:13FromGitter<rayman22201> @asampal
02:24:35FromGitter<asampal> it worked with `karun` - a page opened in the browser
02:25:24FromGitter<asampal> oh, so just to build, not run automatically
02:25:26FromGitter<rayman22201> `nim -r` will cause Nim to try and run the code in terminal. not what you want
02:25:34FromGitter<asampal> yeah, got it
02:26:03FromGitter<rayman22201> @Quelklef I'm confused by this too. I'm investigating
02:26:23FromGitter<Quelklef> Cool, LMK if you find anything. I'm gonna see if there are any open issues or any discussion about it
02:27:20FromGitter<rayman22201> I have to go make dinner soon, so I don't think I will be able to dig into it until a bit later, but I'll let you know if I find anything
02:32:04FromGitter<rayman22201> @Quelklef this works: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b553e23f02a0977a3f2b053]
02:32:29FromGitter<rayman22201> ignore the comment. I forgot to remove it from your earlier example
02:32:54FromGitter<rayman22201> macros don't like generic type params that are not formal arguments? idk
02:33:12FromGitter<rayman22201> You specifically don't want it to be a formal argument right?
02:33:20FromGitter<rayman22201> Is there a reason you want that behavior?
02:33:34FromGitter<rayman22201> of course there is. What is the reason?
02:40:53FromGitter<gogolxdong> python generated SOAP request works , difference is not using the serialized string directly but substitude `<?xml version="1.0" encoding="UTF-8"?>\n` with concating xmlHeader manually.
02:46:47zacharycarter[m]I have karax working with wasm kind of
02:46:55zacharycarter[m]just lots of work to do still - but I have dom diffing / rendering working
02:47:02FromGitter<gogolxdong> Then problems come up , there are more than four thousands data types , we have to serialize these by hand at issuing requests, but still efficient compared to using newElement and set attributions with newStringTable , I think.
02:47:54FromGitter<gogolxdong> Did you compile nim to wasm ?
02:48:47zacharycarter[m]no I'm using emscripten
02:49:37zacharycarter[m]but yes the entire Nim program eventually compiles down to wasm
02:50:03zacharycarter[m]I guess the best way to describe what I'm building is - https://github.com/DenisKolodin/yew
02:51:03FromGitter<gogolxdong> How to you manage layouts and transitions?
02:51:30*ieatnerd1 joined #nim
02:51:33FromGitter<gogolxdong> I'm trying to build a frontend framework based on karax.
02:52:29FromGitter<Quelklef> @rayman22201 The reason is that I have a `Coloring[T: static[int]]` type that I want to be implemented as a `TwoColoring` for `T == 2` and a `NColoring[T]` for all other `T`, for efficiency reasons
02:53:16FromGitter<Quelklef> Essentially, I have a `Coloring[T]` but can make a bunch of optimizations if `T` is 2, so I want to be able to transparently implement those operations while still having a generic `Coloring[T]` type
02:53:36FromGitter<Quelklef> eghhhhh both of those explanations were a little circular; hopefully they made sense
02:54:36*rockcavera joined #nim
02:54:44*erratic quit (Ping timeout: 256 seconds)
02:55:20FromGitter<rayman22201> That shouldn't be affected by whether you have the macro take the int as a formal param or not?
02:56:42FromGitter<Quelklef> That's what I'm thinking. But apparently it is...
02:57:23FromGitter<Quelklef> Do you think I should open an issue?
02:59:53FromGitter<Quelklef> I can't find an open issue about it
03:08:57FromGitter<asampal> I see Karax uses a virtual DOM like most other similar-purpose frameworks. Does anyone here know if, when it was started there was any thought about working with the actual DOM, as Imba (http://imba.io) does. Imba uses a caching method with the DOM elements it constructs which makes access really fast - much faster than React, Vue, etc.
03:09:56FromGitter<asampal> One of the benchmarks - https://somebee.github.io/dom-reconciler-bench/index.html
03:10:31FromGitter<Quelklef> @Araq @dom96 is https://gist.github.com/Quelklef/0ce5c96ba2fd926750e95733b9d54cf5 a bug?
03:11:57*ieatnerd1 quit (Ping timeout: 240 seconds)
03:14:09zacharycarter[m]gogolxdong: I don't plan on doing so
03:14:21FromGitter<Varriount> @Quelklef
03:14:33zacharycarter[m]asampal: I think there is an experiment in karax that does that
03:14:42zacharycarter[m]I need to check this out - this might be a better approach for me to take as well
03:14:45FromGitter<Quelklef> yeah varriount?
03:14:56FromGitter<Varriount> Don't you need to call the macro?
03:15:05FromGitter<Quelklef> No, doesn't work either way
03:15:09FromGitter<Quelklef> Same error
03:15:21FromGitter<Quelklef> And I've seen and used templates defined with no params and called without `()`s IIRC
03:15:54zacharycarter[m]asampal: https://github.com/pragmagic/karax/blob/master/experiments/trello/knete.nim
03:16:11zacharycarter[m]i guess I'm porting this now to my wasm thing :P
03:17:41FromGitter<asampal> nice - but I think the caching is an important aspect in how Imba achieves its great performance - not sure if this experiment does something similar
03:18:58zacharycarter[m]yeah - I'll have to look into that
03:20:23*endragor joined #nim
03:21:06FromGitter<gogolxdong> Are you going to try DOM caching rather than regular Virtual DOM solution like what karax using now with vdom?
03:22:20FromGitter<gogolxdong> knete manupulates DOM directly.
03:22:27FromGitter<asampal> @zacharycarter - maybe you want to take a look at the JavaScript Imba generates, to see what it's doing
03:22:33zacharycarter[m]I don't know what I'm going to do
03:22:43zacharycarter[m]I guess there's also - https://mithril.js.org/
03:23:08FromGitter<asampal> take a look here - http://imba.io/guides/advanced/performance
03:23:24zacharycarter[m]and of course - https://markojs.com/
03:24:18zacharycarter[m]interesting
03:24:44FromGitter<asampal> yeah, I thought so
03:26:21FromGitter<gogolxdong> much much faster than virtual DOM, Imba video says so, lol
03:27:18FromGitter<gogolxdong> Sadly, virtual doms are still quite slow. Imba has chosen a very different approach that turns out to be a lot faster.
03:27:41zacharycarter[m]I still wonder how it compares to markojs
03:28:54FromGitter<asampal> me too - do you know if Marko uses a virtual DOM?
03:29:10zacharycarter[m]I don't
03:29:10FromGitter<gogolxdong> I got the point, it's another different approach to manipulate DOM.
03:29:10zacharycarter[m]https://svelte.technology/
03:29:14zacharycarter[m]also has caught my eye
03:30:14zacharycarter[m]I don't believe marko does - apparently there is an implementatin of marko that uses a vdom
03:30:18zacharycarter[m]but by default I guess not
03:30:35zacharycarter[m]https://github.com/marko-js/marko/tree/master/src/runtime/vdom
03:30:40zacharycarter[m]err wait - it looks like it does afterall
03:33:31zacharycarter[m]https://markojs.com/docs/why-is-marko-fast/
03:42:12FromGitter<rayman22201> @Quelklef I would think `var a : typeImpl[2]` should work, but why is `var a: typeImpl(2)` not sufficient?
03:57:44FromGitter<Quelklef> No, it is
03:57:51FromGitter<Quelklef> It works as a formal parameter
03:57:58FromGitter<Quelklef> Oh, you mean why can't I use that
03:58:14FromGitter<Quelklef> Essentially because it keeps `Coloring[T]` a type both semantically and syntactically
03:58:43FromGitter<Quelklef> Although I suppose I could always `type ColoringImpl[T] = ... ; template Coloring(T) = Coloring[T]` if I change it later, so I should just to `typeImpl(2)`
04:00:49FromGitter<Quelklef> Oh shit
04:01:05FromGitter<Quelklef> `proc fT (c: TypeImpl[C])` doesn't work
04:02:09FromGitter<Quelklef> Oh boy a SIGSEGV
04:03:05FromGitter<rayman22201> Well that's a bug lol
04:03:38FromGitter<Quelklef> Yeah on my way to the git issues
04:06:24FromGitter<rayman22201> Good work!
04:06:52FromGitter<Quelklef> 😄
04:08:49*drazan quit (Remote host closed the connection)
04:10:47*drazan joined #nim
04:34:33*mwbrown quit (Ping timeout: 264 seconds)
04:39:19*xylef joined #nim
04:54:05*nsf joined #nim
04:58:48*mwbrown joined #nim
05:22:59*leorize quit (Ping timeout: 265 seconds)
05:35:58*stefanos82 joined #nim
05:50:36*leorize joined #nim
05:55:45*leorize quit (Ping timeout: 248 seconds)
05:56:15*leorize joined #nim
06:05:16*Vladar joined #nim
06:20:05*yglukhov[i] joined #nim
06:25:00*yglukhov[i] quit (Ping timeout: 268 seconds)
06:26:45zacharycarter[m]https://github.com/zacharycarter/zapp
06:29:28FromGitter<Quelklef> aw man
06:29:45FromGitter<Quelklef> if wasm gets big then the days of javascript inspecting & tinkering will be over :(
06:35:05stefanos82in case you haven't figure it out yet, they are unifying all programming languages under a common umbrella called wasm
06:35:08zacharycarter[m]wasm is pretty sweet if you ask me
06:35:21stefanos82their objective is to get rid of the desktop applications and take everything on the cloud
06:35:45FromGitter<Quelklef> Google probably needs new pants
06:36:21FromGitter<kayabaNerve> stefanos82 What time zone are you?
06:36:34stefanos82the twilight of course
06:36:48stefanos82you are wondering whether I slept or not lol
06:36:49stefanos82I didn't
06:38:08stefanos82we are under a red flag alert for 2 days. we have reached 42 Celsius (107.6 F) and everything is boiling
06:38:18stefanos82we cannot sleep even with a/c on
06:38:37FromGitter<Quelklef> woah where are you?
06:38:43zacharycarter[m]where do you live?
06:38:43stefanos82Cyprus
06:38:44zacharycarter[m]if you don't mind me asking?
06:38:55zacharycarter[m]ooph
06:39:09FromGitter<Quelklef> christ don't die over there
06:39:31stefanos82every time Africa farts, the sand and heatwaves greets us with gratitude lol
06:39:52stefanos82now I know how that poor Snowman feels when it melts
06:40:30FromGitter<Quelklef> lol
06:40:38stefanos82there is a positive side though
06:40:44stefanos82laundry gets dried within 15 minutes!
06:40:44FromGitter<kayabaNerve> @Quelklef How's your C FFI knowledge?
06:41:11stefanos82kayabaNerve: don't tell me you are still struggling with the wrapped code
06:41:11FromGitter<Quelklef> @kayabaNerve Never used it and don't know C
06:41:20FromGitter<kayabaNerve> I haven't worked on it since :P
06:41:29FromGitter<kayabaNerve> @Quelklef I meant your Nim wrapping C :P
06:41:40FromGitter<Quelklef> Eh?
06:41:54FromGitter<Quelklef> Yeah I know, but I don't mess with the C FFI 'cause I don't know C
06:41:56FromGitter<kayabaNerve> But yeah. It's still broken as hell because I haven't touched it since I do have jobs
06:42:10FromGitter<kayabaNerve> Argon2.o: In function `Argon2_LXoXxA4bUETX9cn8hX3n8qA': Argon2.nim:20: multiple definition of `Argon2_LXoXxA4bUETX9cn8hX3n8qA'
06:42:12FromGitter<kayabaNerve> Enlightening
06:42:37FromGitter<kayabaNerve> In the object file for the file, there's a definition of a function found in the file.
06:42:41FromGitter<kayabaNerve> Who would've though
06:42:58FromGitter<Quelklef> w0t
06:43:14FromGitter<kayabaNerve> BTW. I'm still doing my jobs. I just wanted to see of Quellie knew anything.
06:43:58FromGitter<Quelklef> who now
06:44:33FromGitter<kayabaNerve> The Nim file is linking itself twice I guess? And then the C compiles but then can't find the function it was linked against despite there being relevant .o s.
06:44:38FromGitter<gogolxdong> How to run your zapp test?
06:44:46FromGitter<kayabaNerve> stefanos82 GDI. I found the issue.
06:44:57FromGitter<Quelklef> oh by the way @kayabaNerve I just recently had my birthday so we're not the same age anymore
06:45:01FromGitter<Quelklef> sorry mate
06:45:02FromGitter<kayabaNerve> Did you know case insensitivity applies to Nim and C files?
06:45:30FromGitter<kayabaNerve> So argon2.c and Argon2.nim, even when using the paths in compile, cause Argon2.nim to get compiled and linked twice?
06:45:40FromGitter<kayabaNerve> You betrayed me.
06:46:30FromGitter<kayabaNerve> And I can't change the name of the C so I guess I'm not forced to change the name of my Nim... Argon2 to Argon? I mean technically, it's not even Argon2. It's Argon2d which is a variant of the Argon2 algo.
06:46:46FromGitter<Quelklef> :o
06:54:19stefanos82kayabaNerve: can you open a ticket with this case?
06:54:24stefanos82it needs to get investigated
06:54:24*dddddd joined #nim
06:55:20FromGitter<kayabaNerve> Does it?
06:56:17stefanos82yes
06:56:39FromGitter<gogolxdong> @zacharycarter /mnt/d/zapp/src/zapp/zdom.nim(530, 16) Error: undeclared identifier: 'globalEmbindObject'
06:56:41stefanos82tag it as "Question"
06:59:21FromGitter<gogolxdong> not sure but looks like it's from jsbind https://nimpkgdir.firelet.net/ci/badges/jsbind/nimdevel/doc_build_output.html
06:59:42zacharycarter[m]yes you need to do a nimble install first
06:59:50zacharycarter[m]then do
07:00:10zacharycarter[m]nim c -d:emscripten src/zapp.nim from the root of the directdory
07:00:15zacharycarter[m]I've only tested on osx so far
07:02:58FromGitter<gogolxdong> Do you use emsdk?
07:03:33FromGitter<kayabaNerve> stefanos82: Can I also complain about path consistency while at it?
07:03:37zacharycarter[m]yes
07:03:43FromGitter<kayabaNerve> {.passC: "-Isrc/lib/Argon/include".} ⏎ {.compile: "Argon/src/argon2.c".} ⏎ {.header: "../../src/lib/Argon/include/argon2.h", importc: "argon2d_hash_raw".}
07:04:03FromGitter<kayabaNerve> One is from the project, one is relative, and one is relative to the nimcache directory
07:04:51stefanos82kayabaNerve: feel free to express any concern of yours, but do it in a polite, yet diplomatic and elegant way.
07:08:19*ieatnerd1 joined #nim
07:08:59FromGitter<kayabaNerve> https://github.com/nim-lang/Nim/issues/8407
07:12:46*ieatnerd1 quit (Ping timeout: 260 seconds)
07:16:49FromGitter<gogolxdong> @zacharycarter --shell-file /Users/zachcarter/projects/zapp/static/index.html should be static/index.html
07:18:42FromGitter<kayabaNerve> https://github.com/nim-lang/Nim/issues/8408
07:19:59FromGitter<gogolxdong> @zacharycarter got plain {{{ SCRIPT }}} HTML
07:21:05*leorize quit (Ping timeout: 240 seconds)
07:21:40*leorize joined #nim
07:23:00FromGitter<gogolxdong> This uses wasm ,doesn't involve DOM manipulation right?, if it does , it uses Virtual DOM or something like lmba?
07:23:37stefanos82Araq: am I missing something here? https://github.com/apache/mynewt-nimble
07:26:47*leorize quit (Ping timeout: 244 seconds)
07:28:16*yglukhov[i] joined #nim
07:30:19zacharycarter[m]yes it uses vdom and dom diffing
07:30:31*leorize joined #nim
07:30:31zacharycarter[m]just basically put karax in wasm
07:32:33FromGitter<gogolxdong> what's benefit?
07:34:32FromGitter<gogolxdong> Do you want to compile nim down to wasm and using cached DOM at the same time? Does this technology Imba uses have a name?
07:35:55*floppydh joined #nim
08:06:22zacharycarter[m]the benefit would be - you don't have to write javascript
08:06:40zacharycarter[m]and you could potentially run more performant sensitive code
08:07:00zacharycarter[m]I don't know that there's much of a point - Rust has a project that does something similar minus emscripten, so I figured I might as well make one to play around
08:08:58*NamPNQ joined #nim
08:10:26FromGitter<kayabaNerve> @Quelklef I found a new use for Result Error
08:22:21FromGitter<gogolxdong> How do you manage layout and transition?
08:27:44FromGitter<kayabaNerve> :( I have a Memory leak.
08:29:00zacharycarter[m]I'm not going to manage them
08:29:03zacharycarter[m]that's kind of beyond the scope of this
08:29:13zacharycarter[m]going to bed - night
08:36:07FromGitter<gogolxdong> good night.
09:09:35FromGitter<mratsim> The original post is moderated, and I feel I’m missing some key things for a potentially important topic :/ :https://forum.nim-lang.org/t/4068
09:25:52*erratic joined #nim
09:30:00dom96Yeah, I need to fix that bug
09:32:51*yglukhov[i] quit (Remote host closed the connection)
10:01:27*yglukhov[i] joined #nim
10:03:50FromGitter<kayabaNerve> Morning dom
10:05:25*yglukhov[i] quit (Remote host closed the connection)
10:08:10*yglukhov_ joined #nim
10:10:41*leorize quit (Ping timeout: 248 seconds)
10:19:58FromGitter<mratsim> Oh - https://github.com/zacharycarter/zapp “Web app framework for Nim targeting WASM via emscripten"
10:24:59dom96Good morning kayabaNerve
10:32:26*TheLemonMan joined #nim
10:34:19TheLemonMandom96, yo, are you up for testing some code on osx?
10:35:56dom96Depends how easy the testing is
10:36:33TheLemonManit ranges from really easy to very easy :)
10:37:34FromGitter<zetashift> oh cool we have https://github.com/Skrylar/raylib-nim bindings :O
10:41:21FromGitter<tim-st> why does calling `system.instantiationInfo().filename` yields `???` but `system.currentSourcePath` works which calls it too?
10:43:19FromGitter<tim-st> ok, I understood, how it works, this only works when called inside a template
10:47:29FromGitter<tim-st> can I invoke a template "anonymously"?
10:47:31dom96TheLemonMan: alright, go on then
10:49:00TheLemonMandom96, grab https://github.com/LemonBoy/criterion.nim and try out the example in the readme. If anything goes wrong feel free to open a ticket or just wait for me to pop up again, I'll check out the irc logs, g2g now.
10:49:22*TheLemonMan quit (Quit: "It's now safe to turn off your computer.")
10:50:12dom96/Users/dom/.nimble/pkgs/criterion-0.1.0/criterion/timer.nim(33, 62) Error: undeclared field: 'denum'
10:52:15*Ven`` joined #nim
10:52:19*Ven`` quit (Read error: No route to host)
10:54:11dom96Pro Tip: nim check --os:macosx file.nim # works on all platforms
10:56:44*BitPuffin joined #nim
11:03:07*Ven`` joined #nim
11:06:22FromDiscord<coliny> Howdy all - has anybody managed to get nim integrated with vim such that the documentation/definition of the thing under the cursor is displayed? I have tried just about every nim plugin but they all pale into the blinding glory that is VSCode's integration :-). Any suggestions? I would even consider an emacs plugin 😃
11:13:31dom96coliny: this might be worthy of a forum thread :)
11:21:06FromGitter<mratsim> Is there an example of M:N threading in Nim? i.e. spawn M threads and let a macro/library dispatch that on the actual N hardware threads available (possibly even one like asyncdispatch).
11:22:02*FromDiscord <coliny> runs off to start a forum thread :-)
11:23:04FromGitter<tim-st> can I echo a the result of a const to compiler log output?
11:25:08FromGitter<tim-st> I got it working using `{.error: constStr.}`
11:26:30*ieatnerd1 joined #nim
11:30:39*ieatnerd1 quit (Ping timeout: 244 seconds)
11:30:54FromGitter<gogolxdong> I made this compiles
11:31:20FromGitter<gogolxdong> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b55bc884b880b3e6a4222e4]
11:31:55FromGitter<gogolxdong> but browser crashes.
11:34:51*leorize joined #nim
11:37:28*leorize1 joined #nim
11:39:04*xylef quit (Quit: WeeChat 2.2)
11:39:30*leorize quit (Ping timeout: 268 seconds)
11:41:05*leorize2 joined #nim
11:42:35*leorize1 quit (Ping timeout: 240 seconds)
11:42:47*xylef joined #nim
11:45:07FromGitter<kaushalmodi> coliny: See if this helps (Emacs): https://scripter.co/accessing-devdocs-from-emacs/
11:46:04FromGitter<mratsim> @gogolxdong the repo is only 4 hours old so I guess that’s expected :P
11:46:19FromGitter<codem4ster> (offtopic) which is faster in Nim: `func` or `proc`?
11:46:44FromGitter<mratsim> no difference
11:46:52FromGitter<mratsim> func = proc {.noSideEffect.}
11:47:22FromGitter<mratsim> noSideEffect just asks the compiler to make sure that the proc doesn’t use a global variable
11:47:46FromGitter<mratsim> global variable can mean a global variable, but also reading a file or printing to stdout
11:48:22FromGitter<mratsim> i.e. the pronc only depends on its inputs (and compile-time constants)
11:48:25FromGitter<mratsim> proc*
11:49:28FromGitter<codem4ster> ```code paste, see link``` ⏎ ⏎ so this must not work? [https://gitter.im/nim-lang/Nim?at=5b55c0c7ee530e4aac903f5a]
11:49:53FromGitter<codem4ster> test is global I think
11:50:18*TheLemonMan joined #nim
11:50:54TheLemonMandom96, thanks for the tip, I've corrected the typo
11:51:56FromGitter<mratsim> yes test is global. const test = … would work
11:52:16FromGitter<mratsim> echo doesn’t work either
11:52:26FromGitter<codem4ster> but that is working already :P
11:52:46FromGitter<mratsim> are you using devel or stable?
11:52:52FromGitter<codem4ster> stable
11:52:55FromGitter<mratsim> try in devel
11:53:12zacharycarter[m]gogolxdong: lib is still not complete - not everything that works in karax works in zapp yet
11:53:26FromGitter<codem4ster> oh ok, thanks.
11:53:43zacharycarter[m]I'm going to post up more examples later today
11:54:05FromGitter<Varriount> Anyone know if the 'options' module is imported implicitly?
11:54:26FromGitter<Varriount> I seem to be able to access an "Option" type without importing options.
11:54:31zacharycarter[m]off to work 😢
11:55:23FromGitter<mratsim> @Varriount I get undeclared identifier
11:57:01FromGitter<Varriount> Ok, this is weird...
11:57:50FromGitter<Varriount> If I import a module such as nim-regex (https://nitely.github.io/nim-regex/) which uses options, I can use the Option type directly in any module that imports nim-regex.
11:58:28FromGitter<Varriount> Is that supposed to happen?
11:59:19*zlib_is_awesome joined #nim
12:01:55zlib_is_awesomeis there a well-documented way to cross-compile program written in nim for arm?
12:03:03FromGitter<Varriount> zlib_is_awesome: Documented? No.
12:04:50FromGitter<Varriount> zlib_is_awesome: It's probably the same process that cross-compiling a C/C++ program is. I would pass in the C/C++ compiler flags using the `--passC` and `--passL` arguments to the Nim compiler, then set the architecture via `--cpu`
12:06:05zlib_is_awesomeVarriount: Well, for C code it's problematic too - cross-compiling is a big problem of manual dependency porting/getting
12:07:28FromGitter<Varriount> zlib_is_awesome: I know it's possible. People have performed (regular) compilation for Nim on the ARM architecture.
12:08:22CalinouI tried `nimble publish` but got "Error: unhandled exception: Connection was closed before full request has been made [ProtocolError]"
12:09:08FromGitter<Varriount> Calinou: I believe that happens when the proper github credentials aren't in place. Try looking at the Nimble issue tracker.
12:09:10Calinouthe commit has been done in my fork, I'll just submit the PR manually
12:09:15CalinouI did set up the token :)
12:09:20*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
12:09:31dom96It's a Nim bug
12:09:39dom96Should be fixed in devel
12:09:58Calinouyeah, I see a few people ran into it too
12:10:02*Ven`` joined #nim
12:10:04zlib_is_awesomeSure it's possible to compile nim for arm, it's officially supported architecture. I'm just dreaming about magic nim compile --target "myWeirdAndroidPhoneWithTermux" like it works with go or even better. Sadly there's no such magic anywhere yet
12:10:15Calinouthere https://github.com/nim-lang/packages/pull/805 :)
12:10:40Calinouzlib_is_awesome: there's this in Rust land, https://github.com/japaric/cross
12:10:54Calinoubut I presume Rust makes it easier to cross-compile things due to how it works
12:11:25FromGitter<Varriount> zlib_is_awesome: For what it's worth, I've yet to find a language where I can easily cross-compile for another architecture/platform.
12:11:40FromGitter<Varriount> (Excluding interpreted languages)
12:12:06Calinouthe above Rust crate made it easy for me to build a musl-linked library, but I haven't tested ARM target
12:12:11Calinoubinary*
12:14:07dom96zlib_is_awesome: Sounds like a great project for you to work on :)
12:17:16zlib_is_awesomedom96 unfortunately it's not possible until OS developers will have standardized layer of graphics/sound apis
12:17:25FromGitter<codem4ster> what is this `Warning: Cannot prove that 'r' is initialized. This will become a compile time error in the future. [ProveInit]` ⏎ I got it from this: ⏎ ⏎ ```var client = new Socket``` [https://gitter.im/nim-lang/Nim?at=5b55c7554b880b3e6a424a25]
12:17:57dom96zlib_is_awesome: huh, what does graphics/sound API have to do with cross-compilation?
12:18:30*nc-x joined #nim
12:18:54zlib_is_awesomedom96, cross-compilation itself will be more viable and useful when it'll be possible to do easy cross-compilation for games, not just for pure dependency-free code
12:18:56nc-x@codem4ster It is a bug already reported on github
12:19:36nc-xhttps://github.com/nim-lang/Nim/issues/7848
12:19:36FromGitter<codem4ster> Is there any work around to get rid of this?
12:20:01nc-xIt still works so you don't need a workaround AFAIK
12:20:44nc-xOh nope. https://github.com/nim-lang/Nim/issues/8054 I think it crashes.
12:20:44zlib_is_awesomeso it is possible to make solution for compiling nim to arm using docker, but for now it will only give you same capabilities as using nim-to-js and using node from android side
12:20:48nc-x* does not compile
12:20:57nc-xError: unhandled exception: int(client.fd) <= 0 Client socket needs to be initialised with `new`, not `newSocket`. [AssertionError]
12:21:43nc-xIIRC when I hit this issue, I had just removed the assert and it was working.
12:22:00FromGitter<codem4ster> I could compile this. It runs, but I didn't test is it works as expected yet.
12:23:27nc-xWhen a client will connect, it will crash with the AssertionError
12:25:02dom96https://github.com/nim-lang/Nim/issues/7848
12:25:10dom96It's a known issue
12:26:01FromGitter<codem4ster> ah, a real showstopper :(
12:26:16dom96oh, I think I just realised what the problem is
12:26:17FromGitter<codem4ster> as it is labelled
12:26:30dom96Put the `var client = new Socket` into the while loop
12:28:01dom96That sucks for performance though
12:29:45nc-xdom96: Same warning even after putting it inside while loop
12:30:09*Ven`` quit (Ping timeout: 260 seconds)
12:30:13dom96warning?
12:30:34Calinouzlib_is_awesome: if you use portable APIs, your code is more portable, simple as that :)
12:30:38dom96I'm not fixing the warning, I'm fixing the assertion error.
12:30:39Calinoui.e. OpenGL ES instead of desktop OpenGL
12:31:41Calinouunfortunately, the state of OpenGL ES 3.0 support on mobile is pretty bleak
12:31:53Calinouit's supposed to be present on 2/3 of Android devices, but it works like crap on most Adreno GPUs…
12:32:44nc-xdom96: Yeah, the assertion is fixed.
12:34:48*nc-x quit (Quit: Page closed)
12:36:09*Ven`` joined #nim
12:39:22*dddddd quit (Ping timeout: 244 seconds)
12:48:36TheLemonManare you sure the assertion is correct? new Socket is always going to null the `fd` field
12:49:11TheLemonMan`client.fd.int != 0` should be checked for instead
12:52:10TheLemonManwell, s/!=/==/
12:52:17*Ven`` quit (Ping timeout: 248 seconds)
12:54:00dom96new Socket will set 'fd' to 0
12:54:05dom96That's the default value for an int
12:54:46TheLemonManand that's what you want, no? newSocket will set .fd to something != 0
12:55:18dom96Yes, that's why I'm asseting that fd <= 0
12:55:20dom96*asserting
12:58:28TheLemonManoh, right, I need my morning coffee
13:01:41zlib_is_awesomeCalinou: unfortunately i know no portable api that doesnt require weird long and boring paperwork to be done with licensing. For example MIT requires to have a copyright notice of each mit-licensed dependency to be copied somewhere to your project
13:02:10zlib_is_awesomezlib require less, but very few projects use that
13:03:04Calinouyou're talking about libraries here, not APIs :)
13:04:29Calinoudom96: thanks for merging my PR :)
13:04:29zlib_is_awesomei thought different libraries provide different access even to same APIs
13:04:50*Ven`` joined #nim
13:04:50CalinouI used the term API to refer to technologies like OpenGL here
13:05:11Calinouyou don't have control over how it is implemented, but you can still use it (using libraries)
13:06:30FromGitter<mratsim> @zlib_is_awesome just follow what was done for Nintendo Switch cross compilation https://github.com/nim-lang/Nim/pull/8069
13:07:16FromGitter<mratsim> you can try nimx on android and ios with the —os switch as well: https://github.com/yglukhov/nimx#supported-target-platforms
13:08:41zlib_is_awesomeCalinou: lets say OpenGL. Isn't shader language the only code that is portable between different libraries implementing opengl
13:10:19*endragor quit (Remote host closed the connection)
13:11:26*regtools joined #nim
13:12:50FromGitter<mratsim> libraries implementing OpenGL? Do you mean driver?
13:14:49FromGitter<mratsim> OpenGL is an abstraction over HW, and should be implemented at the driver level. If OpenGL code does not run on different implementations, that does not mean that OpenGL is not portable, it means that one or more of the library support different version of OpenGL
13:18:21*zlib_is_awesome quit (Quit: Leaving)
13:23:10*Ven`` quit (Ping timeout: 256 seconds)
13:25:20*endragor joined #nim
13:30:14*endragor quit (Ping timeout: 260 seconds)
13:33:11*TheLemonMan quit (Quit: "It's now safe to turn off your computer.")
13:34:40*Ven`` joined #nim
13:44:45*xylef quit (Ping timeout: 264 seconds)
13:59:29*Ven`` quit (Ping timeout: 268 seconds)
14:03:26*xylef joined #nim
14:04:32*xylef quit (Client Quit)
14:05:45*xylef joined #nim
14:36:31FromGitter<Quelklef> @kayabaNerve What's your new ResultError usecase
14:40:31FromGitter<kayabaNerve> @Quelklef Just plan external libs
14:40:51FromGitter<kayabaNerve> Remove the web API part. External anything.
14:41:27FromGitter<Quelklef> IMO it can even be more general than that
14:41:29FromGitter<kayabaNerve> I validate hex input and have hard coded arguments. The function stores the results in a pointer and uses error codes. If it breaks, something seriously messed up, but I did screen the inputs and check the arguments.
14:41:36FromGitter<kayabaNerve> Yeah but previously we said web APIs
14:41:43FromGitter<Quelklef> Ah
14:41:44FromGitter<kayabaNerve> So... now it is more general
14:41:46FromGitter<kayabaNerve> :P
14:41:54FromGitter<Quelklef> The previous idea I had gotten was "Your request was valid but could not be completed"
14:41:59FromGitter<kayabaNerve> Feel free to make it even more general. I'll make some comments on the RFC
14:42:05FromGitter<kayabaNerve> That's this
14:42:12FromGitter<Quelklef> which IIRC actually is what an error *was* in the beginning until people started fucking with it
14:42:23FromGitter<Quelklef> With ValueError for instance
14:42:37FromGitter<kayabaNerve> C libs have an idea where you pass a pointer, it stores data in the pointer, but returns an int
14:42:47FromGitter<Quelklef> ooh fancy
14:42:51FromGitter<Quelklef> And by fancy I mean
14:43:03FromGitter<Quelklef> Sounds like an idiom to solve the problem of an inexpressive language
14:43:04FromGitter<kayabaNerve> 0 is OK. 5 is invalid arg X. 3 is an invalid arg Y. 1 is a f*** you.
14:43:06FromGitter<kayabaNerve> Yep
14:43:21FromGitter<kayabaNerve> So. You validate the request, but get an error code.
14:43:25FromGitter<kayabaNerve> Bam. ResultError
14:43:34FromGitter<Quelklef> What's the RFC called?
14:43:38FromGitter<kayabaNerve> Remove the external service/web API reason just for external library.
14:43:41FromGitter<Quelklef> or is it in the error rfc
14:43:42FromGitter<Quelklef> ok
14:43:44FromGitter<kayabaNerve> That one
14:43:56FromGitter<kayabaNerve> I did make an RFC though https://github.com/nim-lang/Nim/issues/8408
14:44:24FromGitter<Quelklef> WHy can i not find "Remove the external service/web API reason just for external library."
14:44:56FromGitter<kayabaNerve> ... that was a comment
14:44:59FromGitter<kayabaNerve> Not the RFC
14:45:01FromGitter<kayabaNerve> https://github.com/nim-lang/Nim/issues/8363
14:45:02FromGitter<Quelklef> fantastic
14:45:28FromGitter<kayabaNerve> There's the error RFC. The one above mine was just standardizing paths in the compile/header pragmas
14:50:14FromGitter<kayabaNerve> Actually going to wait to see how this plays out lol
14:50:40FromGitter<kayabaNerve> Because I think it's too up in the air to suggest an Exception be added yet...
14:51:00FromGitter<Quelklef> ehhh
14:51:17FromGitter<kayabaNerve> If you feel otherwise, you do it :P
14:51:23FromGitter<Quelklef> My one worry is that the rfc seems to be heading away from exception hierarchies
14:51:30FromGitter<kayabaNerve> It is kinda similar to the suggested UnknownError though
14:51:32FromGitter<Quelklef> and ResultError very much is designed *for* one
14:51:50FromGitter<kayabaNerve> It seems to me like we're still heading for hierarchies but with overrides
14:52:30FromGitter<Quelklef> With the new enum setup?
14:52:34FromGitter<kayabaNerve> Yeah
14:52:48FromGitter<kayabaNerve> TBH I think raising anything is just breaking the type system we've setup
14:52:55FromGitter<Quelklef> "no need to fit errors into hierarchys"
14:53:02FromGitter<Quelklef> Wym?
14:53:13FromGitter<kayabaNerve> We've made a big point that things have types
14:53:32FromGitter<kayabaNerve> We're statically typed; not like JS
14:53:37FromGitter<Quelklef> Things will still have types tho
14:53:37FromGitter<Quelklef> ?
14:53:48FromGitter<kayabaNerve> By allowing raising anything, the return value becomes untyped
14:53:55FromGitter<Quelklef> no
14:54:01FromGitter<kayabaNerve> How not lol
14:54:15FromGitter<Quelklef> It becomes `Option[T, Error]` conceptually
14:54:23FromGitter<kayabaNerve> If I can raise a bool, string, int, custom object, Exception, or ref object of IOError
14:54:39FromGitter<Quelklef> Is that part of the RFC?
14:54:42FromGitter<Quelklef> Being able to raise anything?
14:54:48FromGitter<Quelklef> I've only seen the enums
14:54:51FromGitter<kayabaNerve> Only if we allow raising anything as a language but not as a function
14:55:02FromGitter<Quelklef> come again mate
14:55:06FromGitter<kayabaNerve> It's in there a few times with no expansion
14:55:32FromGitter<Quelklef> I mean as long as you never use it as a *value* it doesn't matter
14:55:37FromGitter<kayabaNerve> "Why don't you instead make it possible to raise stack-allocated objects (as well as heap-allocated objects)?"
14:55:46FromGitter<Quelklef> hm
14:55:49FromGitter<kayabaNerve> "Exceptions are currently ref types, and there is no mechanism to raise stack or fixed size objects"
14:56:05FromGitter<Quelklef> That may just mean raising an `object of Exception`
14:56:18FromGitter<kayabaNerve> "but let's go a step further and just implement what I proposed above: the ability to raise all stack-allocated objects. Even objects that aren't variants."
14:56:25FromGitter<Quelklef> yoooo
14:56:59FromGitter<kayabaNerve> That's from dom. This is meaning int, string, object, or Exception, right?
14:57:12FromGitter<kayabaNerve> I don't think I'm misreading it tbh
14:57:38FromGitter<kayabaNerve> Or maybe not int/string but any `object` as in `ref object of RootObj` or so on
14:57:46dom96Can't wait for the latest TechEmpower run to finish: https://tfb-status.techempower.com/
14:57:55FromGitter<kayabaNerve> dom96 perfect timing
14:58:06dom96Jester/HttpBeast numbers are already there and they are looking really good
14:58:06FromGitter<Quelklef> I don't think ints & co. are objects in Nim
14:58:08FromGitter<Quelklef> I could be wrong
14:58:11FromGitter<kayabaNerve> When you referred to all stack based options in the Errors rfc going around
14:58:17FromGitter<kayabaNerve> *objects
14:58:52FromGitter<kayabaNerve> Did you mean: ⏎ int, string, object, Exception, ref object of IOError ⏎ object as in ref object of RootObj ⏎ ref object of Exception [https://gitter.im/nim-lang/Nim?at=5b55ed2cc579673e6b8c2663]
14:58:57FromGitter<kayabaNerve> The second, right?
15:00:07dom96Is that 3 choices?
15:00:07FromGitter<kayabaNerve> Wouldn't that create an untyped system for Exceptions? @Quelklef referred to Option[T, Error] but you must define T when you do it. It sounds like for this, I could: ⏎ proc a() = ⏎ ⏎ ```if myBool: ⏎ raise obj1 ⏎ raise obj2``` [https://gitter.im/nim-lang/Nim?at=5b55ed77f10ffa0b48a7d428]
15:00:11dom96I meant `object`
15:00:39dom96As in a non-ref `object` type
15:00:46FromGitter<kayabaNerve> Got it
15:00:51FromGitter<Quelklef> With arbitrary fields?
15:01:00dom96sure
15:01:01FromGitter<kayabaNerve> So then I could raise two completely separate objects? Would I have to define all possible ones in the header or have a common inheritor?
15:01:09FromGitter<kayabaNerve> Besides object itself
15:01:17dom96There would be no inheritance in this proposal
15:01:18FromGitter<Quelklef> Hm, that could be abused, but then lots of things can in any plang
15:01:27FromGitter<kayabaNerve> Because it sounds like you're suggesting untyping Exceptions
15:01:29dom96In any case, this isn't happening for 1.0 anyway
15:01:48dom96how so?
15:01:55FromGitter<kayabaNerve> There's a reason I declare an Animal object and a Plant object... If I use one, it's completely different from the other.
15:02:15dom96There would probably be a constraint that only objects with a 'msg' field can be raised
15:02:19dom96but that's a simple concept
15:02:36FromGitter<kayabaNerve> But why not just keep the types/a common inheritor lol
15:02:47dom96That's what I want
15:02:50FromGitter<kayabaNerve> For example. A Error type with the msg field predeclared
15:02:56dom96The RFC proposes getting rid of inheritance
15:03:03dom96and the current system of exception and replacing it with enums
15:03:29FromGitter<kayabaNerve> Yeah
15:03:31FromGitter<Quelklef> @kayabaNerve This kind of abuse can already be done with the current system anyway
15:03:55FromGitter<kayabaNerve> @Quelklef Yes but the Exception common ancestor/inheritor/whatever guarantees some consistency.
15:04:09FromGitter<Quelklef> Don't agree
15:04:17FromGitter<Quelklef> Doesn't Exception just have the msg field
15:05:52FromGitter<kayabaNerve> He's suggesting requiring all objects raised have the message field
15:06:03FromGitter<kayabaNerve> This sounds like the current system lol
15:06:10FromGitter<kayabaNerve> But we removed types for field sharing
15:06:14FromGitter<Quelklef> Well my point being the only consistency you have is that the raised object has `msg`
15:06:22FromGitter<kayabaNerve> That's what the suggestion is
15:06:30FromGitter<kayabaNerve> Except we get rid of the Exception type when we do it
15:06:33FromGitter<Quelklef> Especially if Nim supports multiple inheritance (dunno if it does), that's a fairly weak guarnatee
15:06:37FromGitter<kayabaNerve> Even though we still require the field
15:06:47FromGitter<Quelklef> No I'm replying to "Yes but the Exception common ancestor/inheritor/whatever guarantees some consistency."
15:07:03FromGitter<kayabaNerve> It guarantees as much as the suggestion
15:07:22FromGitter<kayabaNerve> Except now we use object over Exception, and check the names of fields to verify it's at least usable as an Exception
15:08:49*arecacea1 quit (Remote host closed the connection)
15:09:00FromGitter<kayabaNerve> I could be misunderstanding this and I do believe dom96 is the better Nim dev. This just sounds like the current system with no inheritance for... some reason? But then requiring the new object at least have a msg field which is why objects must inherit from the Exception object in the first place (and that is properly typed)
15:09:14*arecacea1 joined #nim
15:09:47FromGitter<kayabaNerve> So it sounds like removing types to remove inheritance just to reintroduce the reason we had the Exception type but this time do it in a more complex way, akin to JS or something
15:09:49dom96The whole point of this whole thing is to avoid heap allocation
15:09:53dom96For performance reasons
15:10:43FromGitter<kayabaNerve> How much performance would an object with a msg field and custom fields over an object with custom fields inherited from an object with a msg field save? I actually do not know.
15:10:50FromGitter<kayabaNerve> Kinda asking here
15:12:18FromGitter<Quelklef> I mean, given that that's the RFC, it must be significant
15:14:02FromGitter<kayabaNerve> "As far as I'm concerned this diminishes exceptions in Nim greatly by removing their ability to be extended. Like I've said in the forum: I use exceptions very heavily and love them dearly. Please do not diminish them." ⏎ ⏎ "The rationale for this change seems to be embedded systems, but how many of Nim's users are actually targeting embedded systems? How many of those users are limited by Nim's exceptions? I
15:14:02FromGitter... have never heard anyone complain about Nim's exceptions so to me this seems like an almost theoretical problem with a solution that is very disruptive." ⏎ ⏎ Also dom96. [https://gitter.im/nim-lang/Nim?at=5b55f0ba9ddf5f4aad0284ad]
15:14:21FromGitter<kayabaNerve> That's a single quote...
15:14:36FromGitter<kayabaNerve> Of course, this was made very early on
15:14:38dom96Yeah, I'm deeply skeptical about the benefits that this overhaul brings
15:14:51FromGitter<kayabaNerve> I don't know enough
15:15:02FromGitter<kayabaNerve> I do know I do some embedded systems work but can't even run the GV
15:15:05FromGitter<kayabaNerve> *GC
15:15:13*Trustable joined #nim
15:15:15FromGitter<kayabaNerve> So I'm so embedded I don't really care
15:15:23FromGitter<kayabaNerve> I've just accepted my fate
15:16:43FromGitter<kayabaNerve> "You're not a real embedded sys dev if you haven't tried to make your env better, and given up after a week of work after realizing it's impossible and crying for an hour." -- Some C asshole
15:17:53FromGitter<andreaferretti> @kayabaNerve in my proposal you could raise anything, but only catch things of a single type in a `try` block
15:17:55FromGitter<andreaferretti> that is
15:18:00FromGitter<andreaferretti> `try` becomes tyepd
15:18:13FromGitter<andreaferretti> in a way, it would be more typed than before
15:18:30*ftsf quit (Ping timeout: 244 seconds)
15:18:41FromGitter<andreaferretti> you could not catch just anything, only things that have been declared in a single variant type
15:18:48*dashed quit (Ping timeout: 256 seconds)
15:19:21*surma quit (Ping timeout: 256 seconds)
15:19:22*r4vi quit (Ping timeout: 256 seconds)
15:19:24FromGitter<kayabaNerve> Isn't except typed though?
15:19:55*crem quit (Ping timeout: 256 seconds)
15:20:48FromGitter<Varriount> For me, the biggest advantage to this would be faster exceptions.
15:21:19FromGitter<Varriount> setjmp/longjmp can be very slow (especially for glibc)
15:21:29*surma joined #nim
15:21:29*r4vi joined #nim
15:21:47*crem joined #nim
15:21:56*dashed joined #nim
15:26:23FromGitter<Varriount> Though, I wonder why exceptions can't use `goto`
15:29:55*icebattle joined #nim
15:35:42*yglukhov_ quit (Remote host closed the connection)
15:36:26*yglukhov[i] joined #nim
15:37:06FromGitter<kayabaNerve> I like performance; I use exceptions; personally, I'm fine with just compiling to C++ if I need it as long as the language doesn't get quirky/worse behavior.
15:37:49FromGitter<kayabaNerve> I understand this isn't me versus everyone and how we should target performance. I just believe in either our current system or modular enums.
15:38:10FromGitter<kayabaNerve> *or something I can use the same as our current system without sacrificing language integrity
15:40:52*yglukhov[i] quit (Ping timeout: 256 seconds)
15:41:50*yglukhov[i] joined #nim
15:43:57FromGitter<andreaferretti> @kayabaNerve yeah, what I mean is that the whole `try .. except` construct becomes typed over the exception type that you are guarding
15:44:46FromGitter<Varriount> @andreaferretti The compiler could create a variant exception type behind the scenes.
15:44:47FromGitter<andreaferretti> you would not be allowed (under my proposal) to do ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b55f7ef32fa1b74085ea9d0]
15:44:59FromGitter<andreaferretti> @Varriount sure, it could
15:45:13FromGitter<andreaferretti> it would be more convenient
15:45:22FromGitter<andreaferretti> but you would end up with a lot of generated types
15:45:52FromGitter<andreaferretti> I also kind of like the limitation on variant types
15:46:05FromGitter<andreaferretti> it would force library authors to declare their own exceptions upfront
15:46:20FromGitter<andreaferretti> and catch foreign exception to rethrow as their own type
15:46:43FromGitter<andreaferretti> maybe a little complicated, but it would bring some order
15:48:01FromGitter<andreaferretti> anyway, it's just a proposal, I have no string preference here
15:48:15FromGitter<andreaferretti> as long as one is not tied a fixed enum as in the first proposal
15:52:56FromGitter<Varriount> Yeah, but then you might get 50 different variants of errors thrown from the standard library.
15:55:10FromGitter<Varriount> If various libraries are made that create variants of standard library exceptions, and then an application writer wants to create generic procedures that handle those exceptions, things could get messy.
16:23:03*krux02 joined #nim
16:25:11FromDiscord<emekoi> is it possible to create a `seq` that uses shared memory?
16:27:14*NamPNQ quit (Remote host closed the connection)
16:27:17*dorelix quit (Ping timeout: 276 seconds)
16:46:24FromGitter<krux02> emokoi: I don't think so.
16:46:34FromGitter<krux02> maybe
16:46:37FromGitter<krux02> soon
16:46:44FromGitter<Varriount> emokoi: What's your use-case?
16:48:18FromGitter<krux02> emokoi: I think Araq currently works on a seq that as an allocator bound to it, so that when you expand it, the seq knows that it has to allocate further memory from shared memory.
16:48:18*dorelix joined #nim
16:48:59FromGitter<Varriount> There is a shared list module, however it is rather bare-bones, and has difference performance characteristics than a sequence.
16:51:26FromGitter<krux02> @Varriount what list?
16:51:34FromGitter<krux02> I am worried that it might be a linked list.
16:51:43FromGitter<Varriount> http://github.com/nim-lang/Nim/blob/master/lib/pure/collections/sharedlist.nim
16:52:02FromGitter<Varriount> Yes, it's a linked list, for concurrency reasons.
16:52:14FromGitter<krux02> ouch, I just by looking at it, I can only scream, don't use it.
16:52:46FromGitter<Varriount> Why?
16:54:02FromGitter<krux02> it feels a lot like some early experiments with Nim that just did not catch up.
16:54:20FromGitter<krux02> not conventional names like iterAndMutate
16:55:09FromGitter<krux02> head, tail name usage that is just semantically wrong.
16:55:22FromGitter<krux02> head is normally the first element of the list and teal the list without the first element
16:55:27FromGitter<krux02> but here tail is just tha last element.
16:55:45FromGitter<krux02> for anybody who ever did functional programming, that is just wrong
16:57:33*leorize2 is now known as leorize
16:58:19*craigger_ quit (Quit: bye)
16:58:37*craigger joined #nim
17:00:26*leorize1 joined #nim
17:01:59*leorize quit (Ping timeout: 260 seconds)
17:04:46*leorize joined #nim
17:04:58*leorize1 quit (Ping timeout: 260 seconds)
17:06:49FromGitter<kaushalmodi> > but here tail is just tha last element. ⏎ ⏎ Oh yeah, that is wrong. Even from the perspective of lisp users
17:11:38*yglukhov[i] quit (Read error: Connection reset by peer)
17:12:13*yglukhov[i] joined #nim
17:12:35FromGitter<mratsim> Posix tail is the last line ;)
17:12:54*yglukhov[i] quit (Remote host closed the connection)
17:13:59FromGitter<mratsim> @emokoi, you can always pass a pointer to the first elem of the seq. A seq is in the heap which can be accessed by all proc through pointers
17:22:27*arecacea1 quit (Remote host closed the connection)
17:22:51*arecacea1 joined #nim
17:26:11*yglukhov[i] joined #nim
17:32:59*thomasross quit (Remote host closed the connection)
17:33:27*thomasross joined #nim
17:46:26Yardanicook, I've mentored all solutions for Nim on exercism which were requiring mentor feedback :)
18:12:15dom96awesome
18:12:25dom96Was there many?
18:14:12Araqkrux02: the GC uses sharedlist iirc
18:14:32AraqI agree the API design is well ... suboptimal but I wrote it quickly for the GC.
18:15:05dom96Yardanico: Passed last year's response rate on the survey. Now at 636.
18:15:21dom96I should really close it now but since I advertised it late on nim-lang.org I'll leave it open for a while longer
18:16:32krux02Araq: I still won't recommend it for the standard library.
18:17:29*Araq shrugs.
18:24:54Araqcan't be that hard to clean up the API names
18:40:36*icebattle quit (Quit: leaving)
18:41:26*icebattle joined #nim
18:41:59*Ven`` joined #nim
18:48:51FromGitter<Varriount> Yardanico: How many were there?
18:50:57FromGitter<rayman22201> @dom96 I'm super excited to see the survey results. I will be patient though :-)
18:57:55*arecacea1 quit (Remote host closed the connection)
18:58:20*arecacea1 joined #nim
18:58:57*yglukhov_ joined #nim
18:58:58*yglukhov[i] quit (Read error: Connection reset by peer)
19:00:12*Ven`` quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
19:00:58FromGitter<tim-st> @kayabaNerve how did you generate the error here?
19:01:02FromGitter<tim-st> https://github.com/nim-lang/Nim/issues/8407
19:01:35FromGitter<tim-st> did you use `{.compile: "a.c".}`?
19:05:46*UxerUospr joined #nim
19:15:57*donotturnoff joined #nim
19:21:28stefanos82Araq: I have tried an example based on kayabaNerve's issue and produced the following problem: https://pastebin.com/uCReWMLn
19:22:53stefanos82basically I took the following example https://nim-lang.org/docs/backends.html#nim-code-calling-the-backend-c-invocation-example and instead of calling it logic.c, I renamed it to calculator.c and placed it under the same directory as calculator.nim
19:23:18stefanos82and changed the {.compile.} line accordingly
19:24:59Araqyeah, so fix it. not sure how though.
19:26:12stefanos82the question is: does nim compiler converts calculator.nim to c in the background using the same name as nim's file?
19:28:33FromGitter<kayabaNerve> @tim-st Yeah. They weren't in the same directory though.
19:28:37FromGitter<kayabaNerve> And they had different casing
19:28:44*dddddd joined #nim
19:29:12FromGitter<kayabaNerve> That was the part that really pissed me off lol. ~/lib/src/argon2.c and ~/Argon2.nim
19:30:20FromGitter<kayabaNerve> Where does the Nim compiler throw an error if two Nim files have the same name? I'd just throw that same error, tbh. Of course, I'm not a Nim dev for a reason, not my expertise...
19:32:05Araqstefanos82: yes, it does. unless it's in a nimble package then the name becomes package_module.c
19:32:38Araqbut you know what? I don't care, hash the full path and make it module_$HASH.c
19:32:44FromGitter<tim-st> @kayabaNerve ok, that's exactly what I predicted a few days ago, is one case [of several] that will fail on the "all sources in one nimcache folder" concept
19:35:14FromGitter<tim-st> rebuilding the folder structure implicit or explicit is the only way to solve this
19:35:36FromGitter<tim-st> (inside the cache folder)
19:36:15stefanos82Araq: when you say hash the full path? can you provide an example please?
19:36:25Araqthat's not true, no matter how often you repeat it.
19:36:35Araq@tim-st
19:37:08FromGitter<tim-st> ^^ well the first issue comes quicklier than what was assumed
19:37:20Araqno, it's an old issue.
19:42:25*nsf quit (Quit: WeeChat 2.1)
19:43:24FromGitter<kayabaNerve> stefanos82: output = file.name & SHA256(file.path)
19:43:48FromGitter<kayabaNerve> That'd break binary verification if we use the full path though, right?
19:43:48stefanos82and where to place this output kayabaNerve?
19:44:18FromGitter<kayabaNerve> I'm just saying what it means to hash a path and rename the module :P Not where to put it. Output was meant to be the .o file. I have no clue.
19:45:00FromGitter<kayabaNerve> If we hash /home/user/Kayaba/project/file.nim to create file_HASH.o, wouldn't that be included in the binary meaning the only way to verify my build is to have my exact same full path Araq?
19:45:13*Trustable quit (Remote host closed the connection)
19:45:15FromGitter<kayabaNerve> It should be the path relative to the calling of the Nim compiler.
19:45:34FromGitter<kayabaNerve> *right?
19:46:01stefanos82I wonder why difficult it is to produce .c files for each .nim post-fixed with -nim.c or even better, foo.nim.c
19:46:05FromGitter<tim-st> btw what I wanted to ask: it it ok to use `{.compile: "folder/file.c".}` regarding the seperator `/` ?
19:46:10FromGitter<bluenote10> Hello everyone! Maybe I'm too tired, but didn't `1 == 1.0`produce a warning in the past?
19:46:11FromGitter<tim-st> on windows it works
19:47:58FromGitter<krux02> @bluenote10 it is not a warning, because it is lossless conversion.
19:50:04FromGitter<bluenote10> @krux02 I see and it only works with pure literals, I'm reliefed ;)
19:50:19krux02yes
19:54:31FromGitter<mratsim> @stefanos82 @kayabaNerve @araq, I’m curious about your .c .nim file conflict: I’ve been using this repo without any issues for months: https://github.com/define-private-public/stb_image-Nim/tree/master/stb_image
19:57:11stefanos82mrtasim: Araq answered above about this; your example works because you are using it via nimble which produces package_module.c
19:58:16FromGitter<mratsim> ah!
19:58:42FromGitter<mratsim> so adding a .nimble file to the project solves everything
19:58:55FromGitter<mratsim> \o/
20:01:37stefanos82if I knew where to check for the file checking before the C generating code...all I would ask it would be something like "if c file has the same name as nim file, then add a -nim.c as Nim file's suffix"
20:02:09*yglukhov_ quit (Ping timeout: 244 seconds)
20:06:54krux02dom96: are you online?
20:08:52FromGitter<Yardanico> @dom96 maybe you can mention in nim_lang's twitter that Nim track is live at exercism.io?
20:09:34*yglukhov[i] joined #nim
20:11:01krux02Araq: I would like to have your opinion on this PR that I made https://github.com/nim-lang/Nim/pull/8369/files
20:11:16dom96krux02: Yes. Don't ask to ask.
20:11:17*Jesin quit (Quit: Leaving)
20:11:27*donotturnoff quit (Ping timeout: 240 seconds)
20:11:46dom96yardanico: waiting for them to fix the icon :P
20:11:55krux02dom96: that PR I just linked. I made the changes you asked for.
20:11:58FromGitter<Yardanico> they don't know what icon is broken :)
20:12:01FromGitter<Yardanico> *that
20:12:03*Ven`` joined #nim
20:13:19dom96Yardanico: what?
20:14:08FromGitter<Yardanico> I think they don't know that Nim icon is broken
20:15:24krux02dom96: Also I would also really like to remove all the functional programming stuff away from the options module. I think it does not belong in there. With fucntional programming I mean map and flatMap and flatten
20:15:47*xylef quit (Quit: WeeChat 2.2)
20:16:40*Jesin joined #nim
20:16:56Araqkrux02: can't we make 'get' a template instead? then you can do f.get(otherwise) for 'f or otherwise'
20:17:07krux02I would like to have minimal definition of the types with a minimal set of functions that allow to access them generically, and then one modle for fuctional programming that allows to use functional programming paradigms
20:17:59dom96Also, yeah, what Araq said
20:18:26dom96`or` for two Option[T]'s is still nice though
20:18:56dom96I commented on the PR too
20:19:05dom96Please, everyone, write short and sweet examples
20:19:18dom96Nobody is going to read a novel when they just want to get shit done (TM).
20:20:07stefanos82lol dom96 you are an OCD I presume? I know this perfectionist's characteristic...I wonder who that might be...hmmm
20:20:41Araqdoes that imply you finally agree with me on '@param foo the foo' being bad?
20:20:50krux02dom96: don't try too be too harsh about the documentation. Yea it is probably not the best, but I wanted at least an example and I did that.
20:22:03krux02Araq: get should be a template as well. I think there is nothing from holding it back.
20:22:46dom96stefanos82: I like to think of it rather that I have an eye for detail ;)
20:23:13krux02Araq: I would really like to get all the functional programming shinanegance and put it all in a fucntional programming modlue where it belongs.
20:23:25dom96I'm not going to lose nights of sleep if docs aren't perfect
20:23:33Araqdoes it though?
20:23:36dom96but it's time we strive to push for them to be better
20:23:36stefanos82dom96: don't worry mate, I know *exactly* what you mean. I'm OCD since, let's see...as long as I remember? LOL!
20:23:37krux02I don't want everything cluttered with functional programming stuff, when I am not going to use it.
20:23:52Araqdo we also have an "oo.nim" module where all the OO stuff ends up?
20:24:04krux02I get it, people want to do functional programming. but pleas don't clutter the standard library with all that stuff.
20:24:25Araqwho are you and what did you to krux02?
20:24:30krux02you can put in in a nice "funcpro" or something package and everybody is happy.
20:24:47Araqwe already fp nimble packages.
20:25:38Araqas much as I sympathesize with your position
20:25:40krux02I am still the same person. I still like functional programming as a paradigm. But I see that the standard library can be much more minimal without all the functional programming functions cluttered everywhere.
20:26:01AraqI'm not sure it's really the way to go.
20:26:17krux02It is also much easier to make functional programming in nim consistent when all the functions are gathered in a single package.
20:26:53Araqdoes Haskell have a single module then, what does that even mean
20:27:10krux02well haskell has no alternative to functional programming
20:27:15dom96I see Araq is getting picky about whitespace after commas too :D
20:27:24krux02so haskell hat operators for flatmap
20:27:36krux02and fold
20:27:38FromDiscord<awr> @Araq can you rephrase what you mean by this? https://github.com/nim-lang/Nim/issues/8405#issuecomment-407184321
20:27:39krux02(I think)
20:28:04dom96krux02: I'm afraid I can't agree either
20:28:12FromDiscord<awr> i don't understand what you mean by "assuming the current version is fine for compiletime evaluation"
20:28:15dom96Nim needs its own functional programming flavour
20:28:28AraqFP is a paradigm, I don't see how we can restrict a paradigm to "one module only"
20:28:53Araqon the other hand, 'flatMap' shouldn't be in options.nim
20:29:41Araqawr you link against nimrtl.dll, right?
20:29:45krux02Araq: haskell works much more with concepts, so the Option type is like any sequence with 0 or 1 element.
20:30:05FromDiscord<awr> yes
20:31:11Araqso you don't know which version of strutils.replace you will get.
20:31:20krux02so when Option just has an index operator and and a len field, a functional programming module could provide a generic map flatMap and all the other stuff, without taking care if it is an opiton an array a seq or something like that.
20:31:27Araqhow can you then run it at compile-time?
20:31:36AraqI'm probably overthinking this though.
20:33:52krux02it is very important to think about the true core features that every container needs to provide in order to have functional programming on them enabled.
20:34:06krux02so maybe [] and len isn't the right choice.
20:34:30krux02maybe `items` and `add` is the better option.
20:34:51FromDiscord<awr> what if there was a const-safe variation of the `{.rtl.}` pragma without `{.dynlib.}` on it at compile time? presumably under a `when nimvm` block
20:35:09krux02`add` surely isn't "pure fucntional" but it is surely a nice generic way to implement `map`
20:35:53Araq'items' and 'add' is MUCH better for packedjson
20:36:30krux02yea but not that good for `array` but that one can be overloaded.
20:37:23FromGitter<kayabaNerve> We had a Nimble file; it messed everything up @mratsim
20:38:04FromGitter<kayabaNerve> Other things; not this. Not broke things, just messed things up.
20:38:29*Ven` joined #nim
20:38:35FromGitter<kayabaNerve> Had to completely redo the project structure, lot of bloat, wouldn't allow dependency installing without module installing, wasn't suitable for tests...
20:40:24dom96huh
20:40:28dom96Elaborate
20:40:38*Ven`` quit (Ping timeout: 256 seconds)
20:44:15FromGitter<kayabaNerve> 1) I wanted a .nimble for the dependency installation. AFAICT, you can only install a module's dependencies by installing the module. This is not a module to be instaled. ⏎ 2) It was added by someone else for the testing architecture which was ditched because it wasn't suitable for the tests I did. ⏎ 3) The Entire src directory had to be wrapped in another directory to get rid of critical warnings/future errors.
20:44:15FromGitter... It was a major PITA. ⏎ We had no benefit on the avenue I wanted to use it for, and no benefit or the avenue it was added for. It completely changed the project structure and added bloat. [https://gitter.im/nim-lang/Nim?at=5b563e1f32fa1b74085f936e]
20:44:44FromGitter<kayabaNerve> And we could've used develop but it'd still get a symlink...
20:48:20dom96What project was this for?
20:49:44krux02Araq: I made a little example how a generic functional programming module could look like: http://ix.io/1icY
20:49:59krux02it is completely untested
20:50:14krux02and it requires a concept Container that I just skipped writing
20:50:19krux02but that is the idea
20:50:35*Ven` quit (Ping timeout: 240 seconds)
20:51:11krux02if the Concept is implemented correctly, these functions would work on every type.
20:53:16FromDiscord<awr> haha i think it works
20:53:22Araqyes ok, but that's fold and map
20:53:38Araqand 'sum' should arguably in math.nim instead (I think it already is)
20:54:49Araqfold and map are important, but hardly the only thing FP offers. what about a 'curry' macro?
20:54:58Araqwould that be in fp.nim too?
20:55:05FromDiscord<awr> ugh lol i accidentally tried to open a DLL in my photo editing app instead of my DLL inspection tool
20:58:47krux02Araq: I think a curry marco is perfectly fine in an fp.nim
20:59:24krux02I am just not sure how yo would want a curry macro. I have seen a curry macro that makes functions "curry-able".
20:59:52krux02but I think far more asable would be a curry macro that curries an arbitrary function.
21:00:05FromDiscord<awr> damnit the new pragma doesn't work. it just removes the export entirely when i do that
21:00:41krux02haskell does currying by requiring the fucntion definition to be written in a way that is curryable
21:01:04krux02int -> int -> int
21:01:25krux02it is a function that takes an int and returns a function that takes and int and returns an int
21:01:34krux02int -> (int -> int)
21:01:52krux02but that is also the common way I've seen to write a function with two arguments
21:02:26Araqmy Haskell knowledge is good enough to know that one
21:02:57Araqthe 'curry' macro is some slides of mine
21:03:14AraqI forgot how it works, I don't use currying.
21:03:31Araqcurrying is for the people who lack 'mapIt'
21:04:20Araqas I said, once you have 'it', you have general expressions, not tied to first class functions and so you don't need currying
21:05:38*donotturnoff joined #nim
21:06:11*UxerUospr quit (Quit: Lost terminal)
21:10:35krux02I don't really like functions as parameters when it is avoidable, because they are a very slow function call.
21:10:53krux02the compiler can't inline
21:11:18krux02and the logic in such functional programming expressions is always very small where inlining would really benefit.
21:20:24*Vladar quit (Quit: Leaving)
21:21:05*donotturnoff quit (Ping timeout: 240 seconds)
21:23:57*yglukhov[i] quit (Read error: Connection reset by peer)
21:24:14FromGitter<mratsim> Yeah remove flatMap from Options and introduce a Monad Concept :trollface:
21:24:31*yglukhov[i] joined #nim
21:25:41FromGitter<mratsim> regarding function as parameter, I think having first class inline iterator chaining would go a long way.
21:26:28FromGitter<mratsim> most of the time you pass a function as parameter either for comparison, or to process elements in a container for which iterators are probably better
21:27:51FromGitter<Quelklef> Is there any sugar for `var x: X; x[] = y`? Since constructors for `ref object` types are still object constructors (I think)?
21:29:06FromGitter<Quelklef> Yeah, `var x: X = ... ; let y: X = X(x[])` doesn't work.
21:29:08FromGitter<mratsim> let x = X(field0: y)
21:29:30FromGitter<mratsim> well somewhat like that because what you’re doing is not really safe
21:29:35FromGitter<Quelklef> Really?
21:30:08stefanos82dom96: can we extend the survey until the end of the month? I didn't know there was a survey running on the main website
21:30:57FromGitter<Quelklef> My specific use-case is that `w` and `z` are NimNodes. I want `w` to be a copy of `z`, but with a few fields changed
21:31:01FromGitter<mratsim> var x: X is nil pointer @Quelklef , you should then use new.
21:31:03krux02I just put in more funcpro stuff http://ix.io/1id7 yay
21:31:17FromGitter<mratsim> and only then you can dereference
21:31:31FromGitter<Quelklef> Ah, thank you
21:31:36stefanos82krux02: do you know whether is possible or not to overload backticks?
21:31:46FromGitter<Quelklef> Is there an existing idiom for this use-case, do you know?
21:31:50FromGitter<Quelklef> But thank you, I'll just make a proc
21:32:18krux02stefanos82, honestly I don't know if you can overload them. I think you can't
21:32:25stefanos82darn it :/
21:32:34krux02how do you want to use them?
21:32:39FromGitter<mratsim> there is copyChildrenTo, copyNimNode and at least one other copy functions @Quelklef, I was also lost into how to do it properly
21:32:53krux02I gave them a meaning in ast-pattern-matching, but I did that with a macro.
21:32:59FromGitter<Quelklef> alright, I'll look in macros. ty!
21:33:07stefanos82krux02: I really don't like using triple quotes so I can use double quotes in a certain line nor I like escaping double quotes
21:33:14FromGitter<mratsim> ah, copyNimTree
21:33:30stefanos82compare echo """hello "world"!""" with echo `hello "world"!`
21:33:30FromGitter<mratsim> I think copyNimNode == copyNimTree nowadays
21:33:41krux02well you can't overload backticks with macros, it is just that you cant the ast in a macro including the backticks and there you can put any meaning into backticks you want.
21:33:49krux02but that is not overloading at all.
21:33:58FromGitter<Quelklef> Perhaps one is shallow?
21:34:15FromGitter<mratsim> the simple `=` is shallow
21:34:22krux02why do you want to overload backticks?
21:34:27krux02can't you just use a fucntion name?
21:34:31FromGitter<Quelklef> Wait, really? `=` on ref types is a shallow clone?
21:34:35FromGitter<mratsim> everything else should be deep, but it’s easy to test
21:34:35stefanos82krux02: I demonstrated my reasoning above.
21:35:18FromGitter<mratsim> ref type have reference semantics, ref semantics = you only copy the pointer, i.e. it points to the same memory so data is shared / copy is shallow
21:35:20FromGitter<Quelklef> I'm not in a state to test at ;-)
21:35:30FromGitter<Quelklef> Right no but
21:35:46FromGitter<Quelklef> Copying the pointer is not a "shallow clone" in my book
21:35:55FromGitter<Quelklef> a shallow clone is that the object is clones, but its fields are not
21:36:02krux02what you want can't even be done with overloading
21:36:05FromGitter<Quelklef> Is this just a terminology difference between us? Or am I actually misunderstanding
21:36:18FromGitter<mratsim> a field is just a memory location.
21:36:31krux02stefanos82, have yo trued doing this foobar"my string"?
21:36:41FromGitter<mratsim> when you `=`a ref type it points to the same memory location
21:36:44krux02it won't help you with tha quotes, but it is a raw string otherwise
21:36:52FromGitter<Quelklef> Okay, I think I'm understanding then
21:36:53FromGitter<Quelklef> just to be sure
21:36:58stefanos82krux02: you mean much like C++ uses raw strings since C++11?
21:37:13FromGitter<Quelklef> `var x: NimNode = ...; var y = x; y[0] = z; x[0] == y[0] # true`, yes?
21:37:20krux02stefanos82, I don't know what you mean by that
21:37:29FromGitter<mratsim> @Quelklef yes
21:37:33FromGitter<Quelklef> Alright, I got it then
21:37:35krux02how does c++11 treat raw strings (whatever you mean by that) differently?
21:37:38stefanos82the foobar"my string" you mentioned krux02
21:38:05FromGitter<mratsim> Try with a ref array and a ref tuple, and use “repr”, it’s easy to check.
21:38:12FromGitter<mratsim> ref object not ref tuple
21:38:22FromGitter<Quelklef> aaaaaa cannot right now
21:38:31FromGitter<Quelklef> Well, I could, but making new files for testing breaks flow
21:38:48stefanos82krux02: C++11 and afterwards allow you syntax like R"foo(something in "here")foo";
21:39:04krux02http://ix.io/1id8
21:39:19krux02no not like c++11
21:39:32krux02c++11 is much better than Nim is this regard.
21:40:24krux02c++ allows you to choose you own begin and end tokes, so that you won't have conflics in the string literal.
21:40:53krux02But nim just has the simple raw string that can't have " in them, and the """ string literal that can't have """ in them.
21:41:48stefanos82that's why I asked whether I could overload backticks or not :/ I don't like the use of """ for such cases
21:42:17krux02you can still escape the backticks in non raw strings if you prefer that.
21:42:35stefanos82you mean the standard C way, like "\"hello\""?
21:42:40krux02yes
21:42:49stefanos82that I know and I would like to avoid it -_-
21:43:17stefanos82look at this beauty: echo `she said "hello" to me!`
21:43:22krux02the escaping string literals are the only literals that can really represent any string thanks to escaping.
21:43:45krux02stefanos82, I get what you mean.
21:43:52krux02but that is not how Nim works
21:44:10stefanos82maybe one day...who knows?
21:44:33krux02also if if you could overload the backticks `` your example would still not work, because to make it work the parser would need to know about this.
21:44:49krux02and no mapper what you overload, you can't change the behaviour of the parser.
21:45:08stefanos82I understand
21:46:17krux02stefanos82, look what the parser generates http://ix.io/1idb
21:46:30krux02it is interesting it completely eats up the quotes.
21:46:40krux02I don't think that is right.
21:46:45stefanos82I see
21:47:10krux02also the spaces are gone
21:47:29krux02you won't be able to see if there was one space, more spaces or not a single space at all
21:51:02stefanos82maybe a macro could emulate the behavior I want with the use of a different operator of my choice?
21:51:07stefanos82something like @{}?
21:57:01*Ven`` joined #nim
22:00:52*Ven`` quit (Client Quit)
22:05:27stefanos82krux02: do you know which file is responsible for generating C files upon compilation? I tried to read cgen.nim, but couldn't figure it out.
22:07:11stefanos82I mean the name for each generated C code
22:10:12krux02I am sorry, i can't tell you that
22:10:20krux02I only know what you already found out.
22:10:52FromDiscord<emekoi> @Varriount i'm trying to wrap a c pointer as a seq that shares memory with the c side. i got nim to make an openarray that shares memory with c, but i get errors when i store an openarray in an object.
22:10:56*yglukhov[i] quit (Remote host closed the connection)
22:11:55krux02you can't store an openarray in an object
22:12:00krux02for reasons
22:12:14krux02nor can you wrap a pointer is a seq.
22:12:22krux02at least not yet.
22:23:47*krux02 quit (Quit: Leaving)
22:26:06FromDiscord<emekoi> i didn't get an error from putting the openarray in an object, but i got errors from declaring procs that took them as arguments.
22:33:27FromGitter<Quelklef> Question which is perhaps dumb: Generally, is a function call faster than a field access, or the other way 'round?
22:34:08FromGitter<Quelklef> I have a situation where I have to decide between giving 20 functions overhead by either A) making them dispatch to another function or B) making them do 1 extra field access
23:00:21FromGitter<Varriount> emekoi: An openarray is purely for parameter types - it's not a type you can actually pass around.
23:00:38FromGitter<Varriount> Or rather, not a type you can actually store in other types, or in variables.
23:00:45FromGitter<Varriount> emekoi: What C library is this?
23:34:20*ftsf joined #nim
23:47:57*icebattle quit (Ping timeout: 240 seconds)
23:51:18FromGitter<Quelklef> Anyone know if this is a bug?: https://gist.github.com/Quelklef/7edf87ac89e4b90a23b37ce2fd1d8cff