00:00:22 | zacharycarter[m] | only gripe I have with BGFX is the shader comilation but it's inevitable |
00:00:37 | FromGitter | <zetashift> oh I thought it was a clean C++ codebase |
00:01:00 | FromGitter | <zetashift> Also i didn't know about your bindings I thought you used these: https://github.com/Halsys/nim-bgfx |
00:03:08 | * | amar joined #nim |
00:03:13 | zacharycarter[m] | nope! the author of BGFX actually writes his C++ code in a style he calls `Orthodox C++` |
00:03:25 | zacharycarter[m] | `https://gist.github.com/bkaradzic/2e39896bc7d8c34e042b` |
00:03:44 | * | amar quit (Remote host closed the connection) |
00:04:26 | FromGitter | <zetashift> "Don't use metaprogramming excessively for academic masturbation. Use it in moderation, only where necessary, and where it reduces code complexity." lmao |
00:05:12 | zacharycarter[m] | 😅 |
00:05:30 | zacharycarter[m] | metaprogramming in C++ != metaprogramming in Nim though |
00:05:39 | zacharycarter[m] | so you have to take that into consideration as well |
00:05:59 | FromGitter | <zetashift> yeah so I heard |
00:06:45 | zacharycarter[m] | but yeah - I agree with that sentiment - use metaprogramming for what it's for |
00:06:47 | FromGitter | <zetashift> man I give up on this undeclared identifier error |
00:06:56 | zacharycarter[m] | gist? |
00:07:03 | FromGitter | <zetashift> https://github.com/pragmagic/godot-nim/issues/36 |
00:08:07 | zacharycarter[m] | Ooph - you're using dynamic dispatch |
00:08:30 | zacharycarter[m] | I has no idea then :P - I never do OOP with Nim if I can avoid it |
00:09:13 | zacharycarter[m] | I'm going to work on these bgfx bindings - if I have more time tonight I'll check out godot and see if I can solve it |
00:09:43 | zacharycarter[m] | sounds likes something is off though with the `gdobj` macro |
00:12:46 | FromGitter | <zetashift> yea I'll leave the issue as is hopefully endragor can respond quickly. Meantime I'll get back to learning lin alg |
00:21:20 | AlexMax | ugh man, the last time I used OpenGL I did precisely no transformations |
00:21:33 | AlexMax | didn't need them, all I was doing was 2D |
00:36:03 | AlexMax | `converter toSizePtr(x: int): GLsizeiptr = return GLsizeiptr(x) |
00:36:21 | AlexMax | I'm-a Wario. I'm a-gonna ween! |
00:38:14 | zacharycarter[m] | don't user converters |
00:38:51 | zacharycarter[m] | look at what the GLtypes equate to - and then just use those ctypes in Nim |
00:39:01 | zacharycarter[m] | or once you have GLType = NimType |
00:39:05 | zacharycarter[m] | use `.NimType` |
00:39:28 | zacharycarter[m] | you're almost always passsing primitives anyway |
00:40:09 | zacharycarter[m] | I suggest looking at the code of zengine - it's not the best written library in the world - especially after I added all the WASM stuff and then abandoned the lib afterwards- but it should still give you an idea of how to structure a simple OpenGL app |
00:40:31 | zacharycarter[m] | it was mostly a port of http://www.raylib.com/ |
00:41:17 | zacharycarter[m] | although I differentiated from raylibs implementation of a few features |
00:42:26 | zacharycarter[m] | you can take all the abstractions away and just focus on the OpenGL fuction calls, and still have a decent roadmap for doing whatever you want with Nim + OpenGL |
00:49:13 | * | wildlander quit (Quit: Konversation terminated!) |
00:50:42 | zacharycarter[m] | and if you need > OpenGL 2.1 - best to go w/ something like BGFX or use MoltenVK or something equivalent I guess |
00:53:01 | * | erratic_ joined #nim |
00:53:48 | AlexMax | oof, I tried using glad, since somebody else claimed to be using it just fine and I thought it would be nice to have a customized exposure of just the GL 3.3 core context |
00:54:03 | AlexMax | GL_FALSE is not a GLboolean |
00:54:29 | AlexMax | it's implemented as literal int 0 |
00:54:42 | AlexMax | so you gotta cast it...every time... |
00:55:51 | zacharycarter[m] | write a proc then - don't use a converter |
00:56:02 | zacharycarter[m] | from my understanding - converters are going the way of the dodo bird eventually |
00:56:19 | * | Lord_Nightmare2 joined #nim |
00:56:40 | zacharycarter[m] | or at least they're going to take some other form in the future - if they still exist in Nim's stdlib |
00:57:04 | zacharycarter[m] | I'd just stay away from them - nothing a procedure can't do anyways |
00:57:09 | * | ftsf quit (*.net *.split) |
00:57:09 | * | erratic quit (*.net *.split) |
00:57:09 | * | drazan quit (*.net *.split) |
00:57:10 | * | Lord_Nightmare quit (*.net *.split) |
00:57:10 | * | ldlework quit (*.net *.split) |
00:57:10 | * | FromDiscord_ quit (*.net *.split) |
00:57:10 | * | def- quit (*.net *.split) |
00:57:10 | * | livcd quit (*.net *.split) |
00:57:26 | * | Lord_Nightmare2 is now known as Lord_Nightmare |
00:58:37 | * | ven473 quit (Remote host closed the connection) |
00:59:03 | * | ven473 joined #nim |
00:59:32 | AlexMax | zacharycarter[m]: My point was that I think glad might need a fixup |
00:59:46 | AlexMax | and not define GL_FALSE incorrectly |
00:59:57 | AlexMax | what use are types if they're not correct :P |
01:01:06 | * | ldlework joined #nim |
01:02:08 | * | francisl quit (Quit: francisl) |
01:02:35 | zacharycarter[m] | don't use GLAD |
01:02:48 | zacharycarter[m] | I don't think anyone doing opengl programming these days is using it |
01:03:10 | zacharycarter[m] | AlexMax: ^ |
01:04:29 | * | ftsf joined #nim |
01:04:29 | * | drazan joined #nim |
01:04:29 | * | FromDiscord_ joined #nim |
01:04:29 | * | def- joined #nim |
01:04:29 | * | livcd joined #nim |
01:04:29 | * | ftsf quit (Remote host closed the connection) |
01:04:42 | * | FromDiscord_ quit (Read error: Connection reset by peer) |
01:04:54 | * | ftsf joined #nim |
01:05:34 | zacharycarter[m] | I'm sure whatever Nim bindings for GLAD that exist - aren't up to doate |
01:05:35 | zacharycarter[m] | to date* |
01:05:36 | zacharycarter[m] | the SDL2 bindings also do a lot of things behind the scenes in regards to loading the GLContext |
01:05:38 | AlexMax | zacharycarter[m]: krux02 actually mentioend that he did |
01:05:50 | AlexMax | which is why I considered it again |
01:06:23 | zacharycarter[m] | so if you're assuming you can go from 1:1 - you'd be mistaken, the SDL bindings issue a lot of calls to establish the GL context behind the scenes |
01:07:56 | AlexMax | from 1:1 what? |
01:08:52 | AlexMax | I've used SDL2 + OpenGL in the past using C++, which is why I'm trying them now :P |
01:09:22 | zacharycarter[m] | I mean from GLAD calls to SDL2 calls |
01:09:38 | zacharycarter[m] | sdl2 + opengl + nim should work fine |
01:09:53 | zacharycarter[m] | Im not 100% understanding why GLAD is in the picture |
01:09:57 | zacharycarter[m] | SDl2 should remove any need for GLAD |
01:10:42 | AlexMax | you mean `opengl`? |
01:10:43 | AlexMax | :P |
01:11:18 | zacharycarter[m] | no - if you want to use SDL2 + OpenGL you still need OpenGL |
01:11:43 | AlexMax | that's weird - nimble isntall opengl brought along x11 package |
01:11:47 | AlexMax | but I'm on windows |
01:12:53 | zacharycarter[m] | ¯_(ツ)_/¯ |
01:13:57 | zacharycarter[m] | https://github.com/nim-lang/opengl/blob/master/opengl.nimble |
01:14:57 | AlexMax | yeah i saw that |
01:14:59 | AlexMax | i didn't get it either |
01:15:15 | * | thomasross_ joined #nim |
01:16:10 | zacharycarter[m] | is `windows` stll a valid define? |
01:16:41 | zacharycarter[m] | maybe do some debugging and add an echo into the nimble file and see if it prints to stdout |
01:17:01 | zacharycarter[m] | I can only think that windows translated to something else in a later version of nim |
01:17:12 | zacharycarter[m] | but I have no idea - I'm on osx primarily |
01:17:33 | zacharycarter[m] | maybe win32 / win64? I dunno |
01:17:35 | * | thomasross quit (Ping timeout: 240 seconds) |
01:17:50 | AlexMax | okay yeah, opengl gets rid of all the stupidity |
01:18:05 | zacharycarter[m] | :) |
01:20:10 | AlexMax | no casts needed |
01:20:16 | AlexMax | i want my money back |
01:22:57 | zacharycarter[m] | bill araq :P |
01:23:24 | zacharycarter[m] | but expect a harsh return on your investment :D |
01:33:23 | AlexMax | no, i want my money back for glad |
01:39:03 | AlexMax | and the joke is that it's free, so there's no money to be given back |
01:39:09 | AlexMax | thats_the_joke.avi |
01:44:13 | bozaloshtsh | anyone have nim-mode and nimsuggest integration working in emacs? |
01:47:05 | bozaloshtsh | Whenever I leave my point somewhere, emacs freezes because epc to nimsuggest fails to start |
01:48:21 | bozaloshtsh | I compiled nimsuggest without -d:release and got the following stack trace: https://ptpb.pw/-eCy |
01:49:08 | bozaloshtsh | Fixing this issue doesn't solve the problem... nimsuggest then just hangs and blasts my cpu for whatever reason |
01:49:24 | bozaloshtsh | can anyone confirm that they have this working on master? I'm currently using devel |
01:52:04 | FromGitter | <kaushalmodi> bozaloshtsh: I am on devel too. I disable nimsuggest. |
01:56:28 | bozaloshtsh | bleh |
01:57:35 | FromGitter | <gogolxdong> any help on ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b72370f988005174ed69c53] |
01:58:12 | FromGitter | <gogolxdong> SIGSEGV: Illegal storage access. (Attempt to read from nil?) in line of crc32 |
02:03:30 | AlexMax | hrm, in this opengl tutorial, glShaderSource is capable of taking a plain-old string, not necessarily a cstringarray |
02:04:24 | AlexMax | glShaderSource(vertexShader, 1, &vertexShaderSource, NULL); |
02:07:44 | FromGitter | <gogolxdong> changed to `proc crc32*(buffers: ref EnetBuffer; ...`and `var buffers = new EnetBuffer` compiles but got crc32 is 0. |
02:15:56 | bozaloshtsh | on another note, I'm surprised at the interest in nim from the bioinformatics field |
02:18:05 | AlexMax | i wanted to try nim because I was going to use C++ and I figured I'd try nim before inflicting C++ on myself again |
02:18:36 | AlexMax | nim seemed really good at interfacing with C libraries |
02:18:55 | bozaloshtsh | nim seems to fill a niche between python and C that many have needed for some time |
02:19:05 | bozaloshtsh | game devs and bioinformaticians alike |
02:19:34 | bozaloshtsh | I picked it up because I thought its metaprogramming was cool |
02:20:24 | AlexMax | aw, no destructors unless I use the new runtime? |
02:23:25 | * | supercool3 joined #nim |
02:24:52 | * | supercool3 quit (Remote host closed the connection) |
02:26:19 | bozaloshtsh | Is there an Either counterpart to Option in the stdlib? planned? |
02:29:03 | * | ziddey10 joined #nim |
02:30:35 | AlexMax | I get to use finalizers, but they're being removed... |
02:32:08 | * | ziddey10 quit (Remote host closed the connection) |
02:41:14 | * | miklcct26 joined #nim |
02:41:53 | * | miklcct26 quit (Remote host closed the connection) |
02:48:45 | * | craigger quit (Quit: bye) |
02:49:03 | * | craigger joined #nim |
02:50:01 | bozaloshtsh | any ideas on why the following isn't enough to prove that the variable `loc` isn't nil at the return site? https://ptpb.pw/G59O |
02:50:09 | bozaloshtsh | bah |
02:50:51 | bozaloshtsh | bad paste, https://ptpb.pw/Fh9c is the real one |
02:54:11 | bozaloshtsh | figured it out: it only assumes not nil if it's in the else: of the if isNil |
03:00:38 | * | BitPuffin quit (Ping timeout: 244 seconds) |
03:05:05 | * | yglukhov[i] quit (Ping timeout: 248 seconds) |
03:10:24 | * | r3m3 joined #nim |
03:15:01 | * | r3m3 quit (Remote host closed the connection) |
03:27:22 | euantor | zacharycarter[m]: I’m not pragmagic btw (just saw the earlier tag, but was sleeping). I’ve no idea who that is (or what Godot is)... |
03:29:24 | * | endragor joined #nim |
03:50:25 | * | dddddd quit (Remote host closed the connection) |
03:56:34 | * | stefanos82 joined #nim |
04:30:17 | * | yglukhov[i] joined #nim |
05:02:50 | Araq | AlexMax: finalizers are not being removed |
05:03:25 | Araq | and destructors are now available without --newruntime (but still receive serious bugfixes...) |
05:04:36 | Araq | "Client socket needs to be initialised with `new`, not `newSocket`" what? |
05:06:23 | * | nsf joined #nim |
05:10:19 | * | yglukhov[i] quit (Ping timeout: 244 seconds) |
05:23:48 | endragor | Is there a doc on --newruntime by the way? |
05:25:42 | * | yglukhov[i] joined #nim |
06:07:19 | * | arecaceae quit (Remote host closed the connection) |
06:07:37 | * | arecaceae joined #nim |
06:14:57 | * | shodan45 quit (Ping timeout: 248 seconds) |
06:18:40 | * | shodan45 joined #nim |
06:21:13 | * | Trustable joined #nim |
06:27:21 | Araq | it used to enable `=destroy` and `=sink` etc, but these are now available without switch |
06:28:25 | Araq | the "new runtime" is now just another GC mode with a different performance profile (--gc:destructors) |
06:30:27 | FromGitter | <gogolxdong> what's benefit of destroy and sink? |
06:32:31 | Araq | it produces a more deterministic runtime profile and improves interop with C++, Python, etc further |
06:32:58 | Araq | it may also be faster but that usually depends on many factors |
06:44:26 | endragor | Araq: yeah I meant is there a doc on =sink, =destroy etc? I only know of your blog post, but not sure how up to date it is. Would there be a way to disable "default constructor" too? Having to deal with it (i.e. not being able to define a type invariant) is annoying. |
06:46:30 | Araq | https://github.com/nim-lang/Nim/wiki/Destructors |
06:46:58 | Araq | is the spec I'm sticking to/updating |
06:49:18 | Araq | the constructor topic seems to be covered by https://github.com/nim-lang/Nim/issues/7917 |
06:55:32 | * | miran joined #nim |
06:58:07 | FromGitter | <craigglennie> Is there a list of symbols, with explanations, somewhere? I've just fixed an error "'typedesc' metadata is not valid here; typed '=' instead of ':'?" but I have absolutely no idea what switching to : did (or what typedesc metadata is)... |
07:01:11 | * | Trustable quit (Remote host closed the connection) |
07:01:50 | Araq | well but you typed '=' instead of ':', I bet ;-) |
07:01:57 | Araq | var x = 4 |
07:01:58 | Araq | vs |
07:02:01 | Araq | var x: int |
07:02:22 | stefanos82 | Araq, now I got curious: how did you come up with the name "sink"? If it's a move mechanism, why not use `=move` instead...or is it a reserved keyword already? |
07:02:23 | Araq | values are not types, types are not values (as a first approximation) |
07:02:55 | Araq | because it's only a "partial move" |
07:03:11 | Araq | it moves into the destination but does not clear the source |
07:03:36 | Araq | a move would take two 'var T' parameters and that's harder to work with |
07:03:56 | Araq | and means we would need to be able to bind rvalues to 'var T' and other nonsense |
07:04:14 | Araq | see C++ for a reference ;-) |
07:05:34 | stefanos82 | I use C++ already, no need to investigate it any further lol |
07:06:33 | FromGitter | <craigglennie> @Araq: Fair enough, I guess I didn't understand the code I was copying. It was "var ctx : GCM[aes128]" (from the nimcrypto library) which I guess is setting the type of "ctx" out of an... array?... called GCM, indexed by... whatever aes128 actually is...? |
07:06:53 | Araq | something like that, yes |
07:09:08 | Araq | endragor: btw have you tried 'packedjson' ? |
07:10:57 | endragor | Araq: oh, didn't know about it. Just this morning I thought that kind of parser would be nice to have, what a coincidence :) |
07:11:36 | * | c0ded joined #nim |
07:13:58 | * | c0ded quit (Remote host closed the connection) |
07:15:25 | stefanos82 | Araq, question: when does GC usually kicks in to start cleanup? |
07:19:43 | Araq | stefanos82: when it feels like |
07:20:00 | Araq | after 4MB was allocated |
07:20:07 | stefanos82 | ah I see |
07:20:30 | * | Vladar joined #nim |
07:21:02 | stefanos82 | so, what are the future plans for GC? to make it completely optional or a much more hybrid approach than already is? |
07:24:02 | * | PMunch joined #nim |
07:26:44 | * | NimBot joined #nim |
07:29:54 | FromGitter | <alehander42> oh , initialization in type definitions sounds pretty nice |
07:30:00 | FromGitter | <alehander42> default values* |
07:31:47 | Araq | stefanos82: hybrid and if you avoid 'ref' and closures there are no tracing mechanisms used |
07:32:06 | stefanos82 | Araq: more than awesome! |
07:32:09 | stefanos82 | that would be mind blowing |
07:34:02 | Araq | oh and of course, as a nice side effect you don't have to 'close' files, sockets |
07:34:37 | stefanos82 | who will close it, the destructor? |
07:35:39 | Araq | yeah |
07:36:39 | stefanos82 | in other words, like C++'s RAII |
07:38:00 | PMunch | Hmm, is it possible to break a block with a value returned? I mean you can do this "let x = block: let y = 100; <some code>; y" and it will return the y value and assign it to x. But it's not possible to use a return statement in a block. And adding a break will stop y from being the last value and as such it needs to be discarded.. |
07:39:40 | Araq | yeah, I understand. no, it's not possible |
07:40:23 | Araq | you can write a blog post 'return statement considered evil, it's tied to function calls, not to blocks' |
07:40:42 | Araq | but that's just how things are :-) |
07:41:33 | PMunch | Haha, why would it be considered evil? |
07:42:05 | Araq | dunno, last time I checked 'bool' is now evil. |
07:42:07 | PMunch | Found a workaround that creates a value which works similar to result: http://ix.io/1k8N/ |
07:43:01 | PMunch | Haha, it's not that bools are evil. It's just the implicit context of a check that is unsafe |
07:43:52 | Araq | it really isn't. |
07:44:05 | PMunch | Of course it is |
07:44:20 | Araq | I agree that pattern matching is safer, but it's also more limited |
07:44:51 | PMunch | Oh yeah, I'm not saying that we should strip away bools and if checks entirely |
07:45:02 | Araq | if x > 0: # ok we know x is Positive here |
07:45:26 | Araq | if Positive(x) as y: # now a type property of 'y', great |
07:45:48 | PMunch | I'm just trying to add the option for people to use the safer option |
07:46:13 | Araq | if Positive(x) and isPrime(x) as y # uh, hmm, my type system cannot express isPrime |
07:46:31 | Araq | # let's have dependent typing... |
07:46:33 | * | leorize joined #nim |
07:47:09 | PMunch | Hmm, I think I see what you mean |
07:47:22 | Araq | I don't mind dependent typing, but I do mind reinventing it without being aware of it |
07:48:15 | Araq | the type systems in wide usage today are always a crude approximation of the runtime behaviour |
07:48:47 | Araq | and for good reasons, but if you want to push the state of the art here, look into proof engines |
07:49:56 | PMunch | Well yeah. And options really don't solve that in the same way as dependent typing does. But it does make it ever so slightly safer by giving you a new identifier to use in your block, instead of the old one that is just implicitly checked. |
07:50:02 | FromGitter | <alehander42> btw does somebody have good initial resources for that, I was literally trying to get into proof engines last weekend :D |
07:51:19 | Araq | hmm I would start with "abstract interpretation" and control flow graphs |
07:51:27 | * | odc_ quit () |
07:51:46 | * | odc_ joined #nim |
07:52:25 | Araq | and then look into "shape analysis" as a generalization of alias analysis |
07:52:58 | PMunch | Besides, we already have an options module, which dom96 has said before (when asked why it wasn't more used), is clunky and unwieldy to use. I'm trying to make them more ergonomic to use so that the module is actually useful. |
07:53:35 | Araq | yeah but I want a very lean options.nim module so that I can use Option[T] without feeling fat |
07:54:01 | Araq | well I don't use Option[T] but eventually it will be used more in the stdlib, can't fight the inevitable forever |
07:54:41 | Araq | and pattern matching should not be available only for Option T, that needs a more general solution |
07:55:17 | * | odc_ quit (Client Quit) |
07:55:17 | FromGitter | <alehander42> so abstract interpretation is basically assigning a domain of possible of values to everything and working with that, in a way something like symbolic execution where you have constraints? |
07:55:35 | Araq | yeah it's pretty much symbolic execution |
07:55:40 | * | odc joined #nim |
07:56:54 | FromGitter | <alehander42> interesting, very different than the path I wanted to take, I wanted to start with the lambda cube & type theories after predicate logic |
07:57:16 | FromGitter | <alehander42> @PMunch do you have a blog article about options? I am trying to find out the origin of discussion |
07:58:53 | Araq | lambda cube? |
07:59:04 | FromGitter | <alehander42> ah I found it |
08:00:10 | FromGitter | <alehander42> https://en.wikipedia.org/wiki/Lambda_cube |
08:00:22 | Araq | yeah found it, way over my head |
08:00:57 | FromGitter | <alehander42> basically something like a higher level "periodic" table |
08:01:39 | PMunch | alehander42, yeah the post on my site (https://peterme.net/optional-value-handling-in-nim.html) and this PR: https://github.com/nim-lang/Nim/pull/8358 |
08:02:54 | PMunch | And Araq, options is still the same type as before. There's really not any inherit bloat if you don't use any of the new features.. |
08:03:13 | Araq | yeah, follow my advice instead, I bet it's simpler :P |
08:03:16 | PMunch | And I agree that pattern matching should be handled in a more generic way |
08:04:21 | * | gmpreussner_ quit (Ping timeout: 240 seconds) |
08:04:30 | * | gmpreussner joined #nim |
08:04:35 | FromGitter | <alehander42> I think krux02's pattern matching lib or patty can be adapted for most nim values |
08:04:37 | PMunch | But I'm not sure what to do with my "match" macro then. The idea of two branches where one has an unpacked symbol is why I started implementing this in the first place, so it would be strange to completely remove it. |
08:04:49 | FromGitter | <alehander42> I already had a patch for krux02's lib which worked for most values |
08:04:57 | FromGitter | <alehander42> but it was very rough and unfinished |
08:05:13 | PMunch | I can neuter it though, and only keep that part of the functionality and call it something else than "match" |
08:05:26 | FromGitter | <alehander42> and I got lazy and didn't finish it |
08:05:33 | Araq | why not 'optionsex.nim' as a new module? |
08:11:05 | FromGitter | <alehander42> I don't think there's anything wrong with booleans, the examples just show that options are better than boolean check + get |
08:11:58 | FromGitter | <alehander42> options would be extremely useful especially with less and less nil in Nim |
08:12:42 | PMunch | Yeah I could move it to optionutils or something |
08:13:09 | PMunch | alehander42, less and less nil? |
08:13:31 | PMunch | alehander42, yeah as I point out in my article this whole boolean blindness thing is a bit silly |
08:13:40 | FromGitter | <alehander42> but I don't quite see the problem with booleans in general: if isPositive is different than isPrime, you have to somehow prohibit combining them etc |
08:13:45 | PMunch | It's more about checks |
08:14:24 | * | pwntus quit (Remote host closed the connection) |
08:15:10 | FromGitter | <alehander42> well yeah this would be great in a flow typing/dependent types way |
08:15:59 | FromGitter | <alehander42> but I still prefer sometimes the "smart" if , e.g. ⏎ ⏎ ```if x > 5 and x.isEven: ⏎ # x here has a more strict type ⏎ # here it's still an int``` [https://gitter.im/nim-lang/Nim?at=5b728fbf5b07ae730ab716bf] |
08:16:07 | PMunch | If isPositive and isPrime there would return options you could do something like "match x.isPrime.?isPositive(): some positivePrime: echo "We have a positive prime: ", positivePrime; none: echo "The number is not a positive prime" |
08:17:12 | FromGitter | <alehander42> so, can you express that isPrime results can be tested for isPositive ? |
08:17:13 | PMunch | Well yeah, that kind of tracking would be awesome. But a lot harder to implement and get right |
08:17:45 | PMunch | What do you mean? |
08:17:55 | Araq | ``some(100) and some(200)`` would return ``some(200)`` |
08:17:59 | FromGitter | <alehander42> I think the `x` has a more strict type part isn't hard, it already happens (I think) in `of`, the dependent typing part is hard :D |
08:18:13 | FromGitter | <alehander42> I mean what's the point of isPrime and isPositive being distinct |
08:18:25 | Araq | that's not Option thing, that's a whole new concept of "has-ity" |
08:18:26 | FromGitter | <alehander42> if you dont have rules that validate only some operations with them |
08:18:45 | FromGitter | <alehander42> because currently they both see like the same type: Option[int] |
08:18:54 | Araq | it just doesn't belong to the stdlib, sorry |
08:20:30 | PMunch | Hmm, should I flip the meaning of `and` and `or`? They make sense in bash where |
08:20:44 | PMunch | <someprogram> && <some other program> |
08:21:04 | FromGitter | <alehander42> what I imagined was eg that .getNegative would return NegativeInt and .getNegative.?getPrime wouldn't work as getPrime doesn't work with NegativeInt |
08:21:12 | PMunch | only executes some other program if someprogram doesn't return an error code. But when we expect a value they look a bit strange.. |
08:21:17 | FromGitter | <alehander42> but this would quickly be too much for the type system |
08:21:40 | PMunch | alehander42, well that can already be handled by using distinct types |
08:22:42 | FromGitter | <alehander42> this part can, but for more complicated checks you would need weirder stuff |
08:41:46 | FromGitter | <tim-st> Is it expected that I can take an `unsafeAddr` from a proc param but not from an element in a for loop of a seq unless I call `mitems` ? |
08:47:12 | Araq | gist it |
08:53:19 | FromGitter | <tim-st> basically this: |
08:53:29 | FromGitter | <tim-st> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b7298895b07ae730ab74128] |
08:53:55 | FromGitter | <tim-st> p2 doesnt work |
08:54:05 | FromGitter | <mratsim> try s\[0\] |
08:54:13 | FromGitter | <mratsim> idem for p1 |
08:54:34 | FromGitter | <mratsim> take the address of the first elements, not of the string, because those are not the same |
08:54:50 | FromGitter | <tim-st> yes, you're right, thanks |
08:54:54 | FromGitter | <mratsim> string is a pointer to length + memory |
08:55:02 | FromGitter | <mratsim> you want a pointer to the memory directly |
08:55:11 | FromGitter | <tim-st> ok, so it's expected to not work? |
08:55:39 | FromGitter | <mratsim> I’m pretty sure it’s not what you want |
08:55:43 | FromGitter | <tim-st> I made this working using `t: var T` as param and `mitems(t)` |
08:56:28 | FromGitter | <tim-st> Well, I have not tested the code yet, but the compiler doesnt complain |
09:01:21 | FromGitter | <tim-st> `var p2 = unsafeAddr(strings[i])` works; I thought it's the same like iterating in a for loop |
09:10:50 | FromGitter | <tim-st> yes, indeed that's not expected; when iterating using indices instead of direct for loop I can use unsafeAddr; so in my opinion it's a bug; but I don't have the deep knowledge at this addr-level |
09:13:09 | * | xet7 joined #nim |
09:13:40 | * | ZetaDot left #nim (#nim) |
09:22:35 | * | krux02 joined #nim |
09:25:51 | * | stefanos82 quit (Quit: Quitting for now...) |
09:27:47 | * | kobi7_ joined #nim |
09:30:59 | * | kobi7 joined #nim |
09:32:02 | * | kobi7 quit (Quit: Leaving) |
09:33:55 | * | kobi7 joined #nim |
09:38:25 | dom96 | hello kobi7 |
09:39:53 | kobi7 | hey dom, can you see my messages? seems there were some problems with the irc server |
09:40:36 | kobi7 | ah, good, I see it now in the irc log |
09:50:06 | * | Guest74244 joined #nim |
09:51:06 | kobi7 | hi dom96 |
09:51:37 | * | Guest74244 quit (Remote host closed the connection) |
09:51:37 | kobi7 | I am porting some C# code, and I was wondering how to handle static classes and their (static) methods |
09:51:58 | dom96 | There is no problem with the IRC server. We mute every user that isn't registered because of spammers |
09:52:31 | kobi7 | ok |
09:53:45 | kobi7 | static methods are called with their class: ClassA.someMethod() |
09:55:03 | kobi7 | also, they may contain some static variables, that are available to all their static methods |
09:55:50 | kobi7 | if I understand correctly, the equivalence is just a filename with the class name, and put variables there, without actually creating a type |
09:56:16 | kobi7 | is that the best idea, in your opinion? |
09:59:21 | dom96 | sure, I think that would work |
09:59:32 | dom96 | But I wonder what you're needing this for? |
10:07:15 | FromGitter | <tim-st> kobi7: if you really want to keep the style, the following works: |
10:07:33 | FromGitter | <tim-st> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b72a9e48206fd2a46a6cce4] |
10:07:38 | * | cspar quit (Ping timeout: 272 seconds) |
10:10:54 | FromGitter | <tim-st> or even better with underscore: `proc procForA*(_: typedesc[ClassA]): string =` |
10:11:32 | * | Taylor_ joined #nim |
10:12:52 | kobi7 | tim-st, thanks! that's really great. One question though: that kind of type can be instantiated as an object |
10:13:03 | kobi7 | right? |
10:13:31 | kobi7 | you know how they have singletons for example, that are not supposed to have this option |
10:13:51 | * | PrimHelios quit (Ping timeout: 240 seconds) |
10:14:17 | kobi7 | dom96: there's just a lot of dotnet code out there. I wanted to port and keep the syntax close to original |
10:14:31 | kobi7 | thought it'd be useful. |
10:15:07 | FromGitter | <tim-st> Maybe you can overwrite the internal proc for each type that is called in instantiation with `doAssert false` |
10:15:09 | kobi7 | tim-st, that's a good approach, I don't want to create new files for every static. |
10:15:24 | kobi7 | hmm |
10:15:33 | FromGitter | <tim-st> Otherwise you can look for "Concept" that maybe can do this check |
10:15:39 | kobi7 | overwrite the `new` basically? |
10:16:08 | FromGitter | <tim-st> I think `new` is only for ref object, others have to answer this one^^ |
10:16:26 | kobi7 | actually it doesn't matter really, the c# code is built right, so my usage will not mess things up |
10:17:08 | kobi7 | ... others have to answer this ??? |
10:17:22 | FromGitter | <tim-st> Others have more knowledge about internals^^ |
10:17:26 | kobi7 | (Error: brain couldn't parse) |
10:17:50 | FromGitter | <tim-st> No, even better: |
10:18:34 | FromGitter | <tim-st> instead of `type classA = object ` use `type classA = distinct int` or something that cannot be initialized |
10:19:07 | kobi7 | you're a genius |
10:19:46 | kobi7 | Many thanks |
10:20:01 | FromGitter | <tim-st> haha, no, but at least this things would be good in the docs for people who want to port code; I was surprised too that it worked that good^^ |
10:20:59 | kobi7 | dom96: I hope I have enough time to finish it, to show you the idea in practice :-) |
10:23:42 | kobi7 | the idea is basically to port the standard library so libs that use it will be easier to port. However the stdlib of dotnet is really huge |
10:24:07 | kobi7 | so, not sure I'll finish this... need to see |
10:25:01 | kobi7 | ok, see you for now, thanks a bunch! and have a great day |
10:25:09 | * | kobi7 quit (Quit: Leaving) |
10:25:44 | FromGitter | <mratsim> If C# stdlib relies a lot on inheritance I’m not sure portingits stdlib is the best. Otherwise it’s OK. |
10:31:33 | * | kobi7_ quit (Quit: Page closed) |
11:14:39 | * | pwntus joined #nim |
11:14:52 | * | pwntus quit (Changing host) |
11:14:52 | * | pwntus joined #nim |
11:16:14 | krux02 | I am generally not a fan of porting the stdlib of some other language to Nim |
11:16:36 | krux02 | then there will be the python stdlib, the c# stdlib, thc c++ stdlib |
11:16:49 | krux02 | all of them basically doing 95% of the same thing just with different names |
11:16:52 | krux02 | and different imports |
11:17:32 | krux02 | Nim is not c# and it does not want to be C# |
11:17:47 | krux02 | but if it makes people happy to port the c |
11:18:09 | krux02 | C# stdlib, then people can do it. It should just not become part of the Nim stdlib. |
11:18:33 | FromGitter | <alehander42> I can see the appeal, it makes porting easy indeed |
11:18:46 | FromGitter | <alehander42> but yeah, it should be a nimble lib |
11:21:22 | FromGitter | <alehander42> i've always tried to automate stdlib porting itself, e.g. in py2nim: https://github.com/metacraft-labs/py2nim/blob/master/idioms/string_methods.nim |
11:22:01 | FromGitter | <alehander42> but usually this works well only on small scale |
11:22:12 | FromGitter | <alehander42> especially with a language with different patterns as c# |
11:22:47 | * | tcsc0 joined #nim |
11:22:57 | Araq | py2nim could focus on a subset of Python, like numpy |
11:22:59 | * | janus0 joined #nim |
11:23:08 | Araq | but I'm not sure if it buys you much |
11:23:23 | Araq | numpy code might be pretty static though |
11:23:30 | FromGitter | <alehander42> I was talking more about the approach of autotranslating python stdlib calls to nim idioms |
11:23:43 | * | janus0 quit (Remote host closed the connection) |
11:25:10 | FromGitter | <alehander42> otherwise I think py2nim can become kinda useful for some projects/scripts which mostly consume existing libs and process/tweak data |
11:25:27 | FromGitter | <alehander42> but not for libs |
11:26:37 | FromGitter | <alehander42> as libs usually use more unique language features, metaprogramming etc and they need to be designed specifically for each lang (except wrappers, wrappers are good fit) |
11:29:46 | * | tcsc0 quit (Ping timeout: 256 seconds) |
11:31:08 | FromGitter | <gogolxdong> Is there any sha256 decode library? |
11:41:34 | * | shah18 joined #nim |
11:42:15 | * | shah18 quit (Killed (Sigyn (Spam is off topic on freenode.))) |
11:46:16 | FromGitter | <Varriount> nimcrypto might work. |
11:51:19 | * | neptune joined #nim |
11:54:32 | * | neptune quit (Remote host closed the connection) |
11:57:38 | FromGitter | <mratsim> @araq nimpy can wrap Numpy code since last week https://github.com/yglukhov/nimpy/issues/24. |
11:59:46 | * | francisl joined #nim |
12:05:46 | * | dddddd joined #nim |
12:19:21 | * | noonien joined #nim |
12:30:05 | * | voiceftp quit (Ping timeout: 240 seconds) |
12:30:57 | * | francisl quit (Quit: francisl) |
12:32:44 | * | voiceftp joined #nim |
12:33:46 | zacharycarter[m] | euantor: ah my bad |
12:36:26 | * | voiceftp quit (Read error: Connection reset by peer) |
12:36:27 | * | ryanhowe joined #nim |
12:36:29 | * | ryanhowe quit (Client Quit) |
12:36:49 | * | voiceftp joined #nim |
12:37:25 | FromGitter | <tim-st> is deleting from seq at index i in O(1)? is it linked list? |
12:37:54 | FromGitter | <tim-st> oh, I understand how it works... |
12:38:36 | * | joepie9124 joined #nim |
12:38:56 | * | voice_ftp joined #nim |
12:40:15 | * | voice_ftp quit (Remote host closed the connection) |
12:40:34 | * | voice_ftp joined #nim |
12:40:48 | FromGitter | <tim-st> is it correct? (from docs): |
12:40:59 | FromGitter | <tim-st> ```var i = @[1, 2, 3, 4, 5] ⏎ i.del(2) #=> @[1, 2, 5, 4]``` [https://gitter.im/nim-lang/Nim?at=5b72cddb5ec2bc174ff930f8] |
12:41:23 | FromGitter | <tim-st> shouldnt it be `@[1, 2, 4,5]`? |
12:41:48 | * | voiceftp quit (Ping timeout: 268 seconds) |
12:42:52 | FromGitter | <tim-st> ok, there's also `delete` proc this seems the one I want |
12:43:17 | euantor | zacharycarter[m]: No problem :) |
12:44:08 | * | joepie9124 quit (Ping timeout: 256 seconds) |
12:45:07 | * | voice_ftp_ joined #nim |
12:45:30 | * | voice_ftp quit (Ping timeout: 268 seconds) |
12:45:33 | * | rory6 joined #nim |
12:47:53 | * | birdspider joined #nim |
12:49:10 | * | rory6 quit (Remote host closed the connection) |
12:49:56 | * | Adbray11 joined #nim |
12:51:08 | * | voiceftp joined #nim |
12:51:11 | * | voice_ftp_ quit (Ping timeout: 244 seconds) |
12:51:34 | * | francisl joined #nim |
12:52:34 | * | Adbray11 quit (Remote host closed the connection) |
12:55:48 | * | voice_ftp joined #nim |
12:56:38 | * | voiceftp quit (Ping timeout: 260 seconds) |
13:00:37 | PMunch | Uhm, what does this error mean? Error: unhandled exception: false ccgtypes.nim(180) mapType [AssertionError] |
13:01:41 | FromGitter | <mratsim> @tim-st, del is O(1), delete is O(n) |
13:02:19 | FromGitter | <mratsim> for delete you have to copy the tail of the seq |
13:05:44 | * | wildlander joined #nim |
13:06:25 | * | voice_ftp_ joined #nim |
13:08:21 | * | voice_ftp quit (Ping timeout: 240 seconds) |
13:10:21 | * | voiceftp joined #nim |
13:11:24 | * | voice_ftp_ quit (Ping timeout: 268 seconds) |
13:12:33 | * | Taylor_ quit (Ping timeout: 248 seconds) |
13:13:42 | * | endragor quit (Remote host closed the connection) |
13:15:13 | FromGitter | <tim-st> yes, I knew this algo, but not the other one, which is quite cool, but imo should make clearer that is changes the order of elements in the seq |
13:16:02 | FromGitter | <trashhalo> Is there a way to make two implementations of the same module? One for normal backend one for js backend? |
13:16:36 | FromGitter | <tim-st> `when defined(js)`? |
13:18:16 | FromGitter | <trashhalo> like block out function bodys have the js version and the normal version proc yada yada: = when defined(js) ?? |
13:18:55 | FromGitter | <tim-st> `when defined(js): var x = 1 else: var x = 2` |
13:19:17 | FromGitter | <trashhalo> id like to start contributing js versions of popular nim libraries. to increase the coverage of js compatibility out there. trying to figure out the "right" wat to do that |
13:19:44 | FromGitter | <tim-st> you can look in `system.nim` or `math` it's used there quite often |
13:19:49 | FromGitter | <trashhalo> perfect! |
13:19:53 | FromGitter | <trashhalo> thank you. will dig in |
13:19:57 | FromGitter | <data-man> @tim-st: I pushed updates for nimsnappyc. Please, check. :) |
13:20:34 | FromGitter | <trashhalo> oh yea look at that. https://github.com/nim-lang/Nim/blob/devel/lib/pure/math.nim#L139 |
13:21:45 | FromGitter | <tim-st> @data-man thanks, I will try it; I think you can use `if unlikely(len == 0)` |
13:22:14 | FromGitter | <trashhalo> in go you can define a file with a build tag that says if you are targeting js include this file. example. https://github.com/golang/go/blob/master/src/runtime/os_js.go |
13:24:38 | * | TheLemonMan joined #nim |
13:24:57 | FromGitter | <mratsim> if it’s big you can use `when defined(js): import mymodule_impljs else: import mymodule_impl |
13:25:00 | zacharycarter[m] | Anyone want to port http://www.seanriddle.com/furbysource.pdf to Nim? |
13:25:22 | * | gangstacat quit (Ping timeout: 256 seconds) |
13:25:25 | FromGitter | <trashhalo> oh smart ill keep that in mind |
13:27:06 | FromGitter | <tim-st> @data-man works good, thanks :) |
13:28:05 | * | miran_ joined #nim |
13:28:20 | * | miran quit (Ping timeout: 256 seconds) |
13:30:55 | FromGitter | <data-man> @tim-st: No problem. And I never noticed a difference in results with the use of likely/unlikely and without using them. ⏎ Will be interested to know other opinions. :) |
13:31:51 | * | endragor joined #nim |
13:36:38 | * | endragor quit (Ping timeout: 272 seconds) |
13:37:08 | * | gangstacat joined #nim |
13:40:02 | FromGitter | <mratsim> @data-man it’s often placebo :P |
13:40:43 | FromGitter | <mratsim> also it’s really only useful before an exceptions/very rare path |
13:41:00 | FromGitter | <mratsim> the difference is the order of the if/else branch generated. |
13:41:41 | FromGitter | <mratsim> iirc by default branch predictors assume that the branch will not be taken. But that’s only the very very first time when the CPU never saw the branch before. |
13:41:47 | FromGitter | <mratsim> at least on x86 |
13:45:10 | FromGitter | <data-man> @mratsim: yes, "placebo" is the suitable word :) ⏎ But likely/unlikely very often used in optimized (or "optimized") C's libs. |
13:45:57 | FromGitter | <mratsim> I use it but only in these kinds of situation: https://github.com/mratsim/Arraymancer/blob/master/src/tensor/private/p_checks.nim#L29-L34 |
13:46:22 | FromGitter | <mratsim> also branch prediction has been tremendously improved with has well. |
13:46:34 | FromGitter | <mratsim> Haswell* |
13:47:32 | FromGitter | <mratsim> likely/unlikely might help on ARM though but for current CPU I’m pretty sure it makes no difference compared to networking, disk access, RAM accesses |
13:50:53 | * | rasengan18 joined #nim |
13:53:26 | * | rasengan18 quit (Remote host closed the connection) |
13:53:45 | FromGitter | <data-man> Are there concrete results of increasing performance? :) |
13:55:30 | * | Ben645 joined #nim |
13:59:54 | * | Ben645 quit (Remote host closed the connection) |
14:02:33 | * | iamtakingiteasy joined #nim |
14:03:13 | * | iamtakingiteasy quit (Remote host closed the connection) |
14:16:28 | * | UxerUospr joined #nim |
14:26:02 | FromGitter | <mratsim> you can’t benchmark it, because if you call it repeatedly the branch predictor will override the likely/unlikely boost |
14:26:24 | FromGitter | <mratsim> though if you use them wrong, the first few iterations will have more misprediction |
14:28:36 | FromGitter | <data-man> What about the app's times? |
14:29:03 | FromGitter | <data-man> I can compare two different apps. |
14:29:33 | FromGitter | <mratsim> likely/unlikely only makes sense for exceptional code paths |
14:29:46 | FromGitter | <mratsim> you don’t bench exceptional code paths normally |
14:29:59 | Araq | Haswell is unrealistically good at branch prediction... |
14:30:03 | FromGitter | <mratsim> just make sure they don’t hurt normal flow |
14:30:56 | FromGitter | <mratsim> ^ what I said. likely/unlikely are placebo’s today on x86 |
14:31:25 | Araq | as a rule of thumb, only memory accesses matter |
14:32:17 | Araq | the rest is fiction, optimize multiplications to shifts all day long, the CPU doesn't care |
14:34:16 | Araq | PMunch: it means you have found yet-another compiler bug :-/ |
14:34:54 | FromGitter | <mratsim> division should be optimized where possible. Multiplication vs bitwise ops: bitwise ops have less latency on non-x86 arch, most importantly compiler are better are at using SIMD instructions for parallel bitwise ops (unless it’s floating point mul …) but yeah, memory is the bottleneck for everything. |
14:35:33 | Araq | it's a rule of thumb. |
14:36:19 | Araq | and it stood the test of time. Divisions might still be slow but you could throw more gates at it like they did for muls |
14:40:11 | Araq | I personally use 'x < 0' instead of 'x == -1' because I know it produces smaller asm code, but you don't have to know that, it is unmeasurable |
14:41:25 | Araq | (it's also a transformation that the compiler is unlikely to be able to do) |
14:41:41 | * | drazan quit (Remote host closed the connection) |
14:42:54 | * | drazan joined #nim |
14:43:16 | FromGitter | <mratsim> reminds me of those in favor of counting down where possible because comparing to zero is cheaper than comparing to arbitrary N |
14:44:02 | FromGitter | <mratsim> except that in that case, prefetcher works better in the forward direction if you want to do fooArray\[i\] |
14:44:31 | Araq | yeah and you *need* exlusive lower bounds for that because otherwise your code will be littered with +1, -1, .... hmm wait |
14:44:47 | Araq | nobody ever argued for that. interesting. |
14:45:32 | FromGitter | <juancarlospaco> Yo |
14:47:00 | Araq | hi |
14:51:18 | PMunch | Yeah I figured.. |
14:51:39 | Araq | gah this cstring nil business is terrible |
14:51:58 | Araq | so I made mycstring == "string" not compile anymore |
14:52:03 | Araq | but it breaks so much code |
14:52:32 | Araq | instead I forbid mycstring == nil |
14:52:46 | Araq | that then needs to be written as isNil(mycstring) |
14:52:57 | Araq | which seems to be more bearable |
14:53:31 | Araq | maybe we disallow it just for a transition period? |
14:54:37 | Araq | alternatively I could introduce a special '==' in order to catch the string == nil comparison |
14:54:55 | * | m712 quit (Quit: bye-nyan!) |
14:55:27 | leorize | then mark it with {.error.} |
14:55:32 | leorize | sounds good actually |
14:55:46 | * | m712 joined #nim |
14:55:47 | Araq | ^ yep |
14:56:41 | * | noonien quit (Quit: Connection closed for inactivity) |
14:57:29 | TheLemonMan | tim-st, there's #8632 for you |
15:07:54 | * | qwertfisch is now known as qvertfisk |
15:26:12 | * | PMunch quit (Quit: Leaving) |
15:32:20 | * | cryptocat1094 joined #nim |
15:36:52 | FromGitter | <tim-st> TheLemonMan: Thank you very much! |
15:37:47 | FromGitter | <tim-st> @data-man haha, ok, I try to use them and hope it will make a positive difference :D |
15:38:21 | ehmry | could the FutureStream stream by made faster by recycling string buffers at the reader back to the writing, using a second deque? is that a reasonable to try and benchmark? |
15:38:40 | ehmry | be* made |
15:43:53 | krux02 | Araq: what is the problem with ``mycstring == "string"`` to compile? |
15:44:49 | leorize | it makes "string" == nil a valid comparison |
15:48:23 | * | birdspider quit (Remote host closed the connection) |
15:48:33 | krux02 | ah, ok I get it |
15:51:33 | krux02 | well isn't there a pattern matcher in the compiler that can emit a warning when you compare a string with nil? |
15:52:22 | krux02 | warining: this string is converted to cstring first before you compare it to Nil, this is probably not what you want. |
15:53:32 | krux02 | I know matlab has a lot of warnings like that built into the language to make it easier for beginners to write programs. |
15:54:57 | * | yglukhov[i] quit (Remote host closed the connection) |
15:57:35 | * | qvertfisk is now known as qwertfisch |
16:03:59 | * | cspar joined #nim |
16:10:41 | dom96 | shashlick: Isn't that just uint32? |
16:13:48 | * | nsf quit (Quit: WeeChat 2.2) |
16:14:06 | * | cryptocat1094 quit (Quit: WeeChat 2.2) |
16:17:51 | * | Trustable joined #nim |
16:31:57 | dom96 | c2nim/nimgen should support this renaming |
16:39:33 | * | gsdg joined #nim |
16:42:40 | * | gsdg quit (Remote host closed the connection) |
16:54:15 | * | Jesin quit (Remote host closed the connection) |
17:00:40 | * | PMunch joined #nim |
17:12:30 | * | Jesin joined #nim |
17:15:44 | * | yglukhov[i] joined #nim |
17:20:05 | * | yglukhov[i] quit (Ping timeout: 240 seconds) |
17:25:16 | * | cspar quit (Ping timeout: 272 seconds) |
17:29:20 | FromGitter | <tim-st> btw the new `nimcache` folder still compiles the stdlib in each folder, is it intended and is there a downside of having stdlib cached in a seperate folder? |
17:35:03 | FromGitter | <tim-st> Also I wonder if the current folder naming is sufficient, I would do at least `filename_without.nim_+[r|dbg]+md5(fullpath)` |
17:36:12 | TheLemonMan | hmm, are destroyers safe to use? |
17:38:24 | * | cspar joined #nim |
17:40:12 | FromGitter | <tim-st> ok, it seems the *.o files of stdlib have different size, maybe depending on what is used, so then the current way is good |
17:43:49 | * | yglukhov[i] joined #nim |
17:51:12 | * | shashlick quit (Remote host closed the connection) |
17:51:34 | * | shashlick joined #nim |
17:53:37 | Araq | krux02: I don't want this to be a warning, warnings are ignored |
17:54:00 | Araq | in fact, you know when we got rid of the deprecated symbols in the tests? |
17:54:08 | Araq | when they were finally removed. |
17:54:24 | Araq | and the tests started to fail. |
17:54:41 | Araq | warnings are to be avoided if possible. |
17:55:50 | krux02 | Araq, I don't ignore warnings, I just ignore this inconsistent whitespace warning around operators. That is annoying. |
17:55:54 | * | pringlecake joined #nim |
17:58:44 | Araq | be that as it may be, the effort of producing an error or a warning for this is identical |
18:00:39 | * | pringlecake quit (Remote host closed the connection) |
18:17:34 | * | TheLemonMan quit (Quit: "It's now safe to turn off your computer.") |
18:18:10 | Araq | tim-st: It's about to change once again. |
18:29:26 | * | thor77 quit (Quit: ZNC 1.7.1 - https://znc.in) |
18:29:54 | * | thor77 joined #nim |
18:37:26 | * | DarkArctic joined #nim |
18:44:38 | FromGitter | <tim-st> what do you want to change? |
18:44:57 | FromGitter | <tim-st> are there things that didn't work now? |
18:55:42 | * | francisl quit (Quit: francisl) |
18:56:02 | * | nsf joined #nim |
19:07:43 | Araq | moar directories |
19:14:30 | * | Guest79333 joined #nim |
19:14:53 | FromGitter | <kayabaNerve> Araq moar directories = moar paths. moar paths = moar files. moar files = moar code. moar code = moar Nim. more Nim = moar awesomeness. |
19:15:23 | Araq | that sounds convincing |
19:16:50 | FromGitter | <kayabaNerve> Each file should have it's own directory. |
19:17:00 | * | Guest79333 quit (Remote host closed the connection) |
19:17:20 | FromGitter | <tim-st> ok, and caching the full stdlib module would be possible, I think, then compilation isnt needed, but filesize would be bigger like in golang I think, but imo that would be good for debug mode |
19:17:23 | FromGitter | <kayabaNerve> It's the only way to truly organize your code. We all know organized code is clean code. Don't we want Nim to be clean? |
19:18:54 | FromGitter | <kayabaNerve> Till 23 seconds: https://youtu.be/chjVoVcVi3A?t=12s |
19:20:48 | * | francisl joined #nim |
19:34:39 | * | cryptocat1094 joined #nim |
19:40:12 | FromGitter | <kayabaNerve> Can I apply a filter to every file in a project without placing it in every file? ⏎ https://nim-lang.org/docs/filters.html |
19:40:52 | FromGitter | <kayabaNerve> It's about that old `import ~/` thing from a month ago. I want it again because now my paths are: ⏎ import ../../lib/BN ⏎ import ../../lib/Base ⏎ import ../../DB/Merit/Block [https://gitter.im/nim-lang/Nim?at=5b7330445ec2bc174ffba66d] |
19:46:45 | krux02 | moar code = moar bugs. moar bugs = less awesomeness |
19:48:02 | FromGitter | <kayabaNerve> krux02 Nahhhhhh |
19:49:03 | * | kunwon14 joined #nim |
19:49:47 | * | kunwon14 quit (Remote host closed the connection) |
19:51:57 | * | riidom_ quit (Ping timeout: 240 seconds) |
19:53:45 | * | ven473 quit (Remote host closed the connection) |
19:54:06 | * | ven473 joined #nim |
19:54:49 | * | francisl quit (Quit: francisl) |
20:00:47 | * | ozy23 joined #nim |
20:03:38 | * | ozy23 quit (Excess Flood) |
20:12:11 | * | UxerUospr quit (Quit: Lost terminal) |
20:13:31 | * | Trustable quit (Remote host closed the connection) |
20:19:23 | * | francisl joined #nim |
20:38:07 | * | Caraway10 joined #nim |
20:41:31 | * | jxy quit (Quit: leaving) |
20:42:52 | * | Caraway10 quit (Remote host closed the connection) |
20:45:09 | PMunch | Hmm, I'm working with a C-wrapped library that takes the classic pointer to an array in order to return an array |
20:45:24 | PMunch | So a ptr ptr TheType |
20:45:40 | PMunch | How can I wrap this in an ergonomic fashion |
20:47:02 | * | jxy joined #nim |
20:51:42 | * | krux02_ joined #nim |
20:54:04 | FromGitter | <mratsim> it’s a pain |
20:54:19 | FromGitter | <mratsim> Nim opencl needs that by the way. |
20:54:31 | * | krux02 quit (Ping timeout: 268 seconds) |
20:54:41 | FromGitter | <mratsim> The most annoying part is managing array/seq lifetimes |
20:55:13 | FromGitter | <mratsim> easiest is probably to build a medium or high-level API with a custom seq/array type |
20:55:19 | PMunch | Well this isn't too performance critical, so just copying all the data over and then freeing the original array is fine |
20:55:44 | PMunch | I just need something I can pass in to read the type out |
20:57:13 | PMunch | I tried this: CArray{.unchecked.}[T] = array[0..0, T] |
20:57:49 | PMunch | And then: myArray: CArray[TheType]; theProc(myArray.addr); but that doesn't work for some reason |
20:57:53 | FromGitter | <mratsim> but the library is allocating an array inside the call? |
20:58:00 | PMunch | Ye |
20:58:03 | PMunch | s |
20:58:24 | FromGitter | <mratsim> that would be strange, usually C libs either provide you destructor procs or expect you to pass a result value they can modify |
20:58:42 | PMunch | It's the xlib call XQueryTree |
20:58:49 | FromGitter | <mratsim> because of lifetime issues, it’s much easier for the caller to manage array/malloc’ed array lifetime |
20:59:18 | PMunch | So I pass in a pointer to a pointer to a window, ie. a list of windows, and it populates it. Then I'm supposed to call XFree on the resulting pointer |
21:00:31 | * | cryptocat1094 quit (Quit: later) |
21:01:35 | * | yglukhov[i] quit (Remote host closed the connection) |
21:01:52 | PMunch | Oh wait, all of a sudden it started working.. |
21:02:10 | * | yglukhov[i] joined #nim |
21:06:21 | * | yglukhov[i] quit (Ping timeout: 240 seconds) |
21:07:24 | FromGitter | <mratsim> Any sufficiently advanced library is indistinguishable from magic |
21:07:40 | PMunch | Indeed |
21:07:55 | * | PrimHelios joined #nim |
21:08:42 | * | cspar quit (Ping timeout: 268 seconds) |
21:10:01 | PMunch | Oh well, time for bed |
21:10:06 | * | PMunch quit (Quit: leaving) |
21:11:35 | * | Vladar quit (Remote host closed the connection) |
21:12:34 | * | yglukhov[i] joined #nim |
21:13:31 | * | xet7 quit (Quit: Leaving) |
21:15:34 | * | cspar joined #nim |
21:25:21 | * | get10 joined #nim |
21:26:00 | zacharycarter[m] | Howdy folks |
21:26:28 | * | get10 quit (Killed (Sigyn (Spam is off topic on freenode.))) |
21:27:16 | krux02_ | zacharycarter[m], Howdy |
21:27:40 | * | francisl quit (Quit: francisl) |
21:28:49 | zacharycarter[m] | krux02_: have you ever played any MUDs? |
21:29:10 | krux02_ | mean ugly dirty sports? |
21:29:35 | zacharycarter[m] | no haha Multi User Dungeons |
21:29:52 | zacharycarter[m] | basically text based MMORPGs - the precursor to MMORPGs |
21:30:09 | * | nsf quit (Quit: WeeChat 2.2) |
21:30:53 | krux02_ | well I played once nethack via teln |
21:31:05 | zacharycarter[m] | yes that's basically a MUD |
21:31:09 | zacharycarter[m] | you play them via telnet |
21:32:45 | zacharycarter[m] | I was thinking - it'd be neat to try to write one in Nim |
21:32:49 | * | krux02__ joined #nim |
21:33:02 | krux02__ | zacharycarter[m], and yesterday I played brogue in the browser, but I am not sure if it was a multi user dungeon. But it had a highscore |
21:33:21 | krux02__ | I was disconnected but my irc cliend noticed it very late |
21:34:09 | zacharycarter[m] | not only that but - I wonder if you could combine the graphical rendering style of RL's (ASCII bitmap fonts) with a MUD |
21:34:12 | zacharycarter[m] | I mean I'm sure you could - but I wonder if it would play well gameplay wise |
21:34:38 | zacharycarter[m] | well multi user dungeons have to be multiplayer |
21:34:41 | zacharycarter[m] | so there are other players in the same world as you |
21:35:05 | * | krux02_ quit (Ping timeout: 244 seconds) |
21:35:39 | krux02__ | well for sure, I think technically that could be very doable |
21:36:07 | krux02__ | but you should really think about how it would work with in multiplayer |
21:36:31 | krux02__ | when you go multiplayer, I think turn based is not very scalable |
21:36:44 | zacharycarter[m] | oh I don't mean keep RL style gameplay |
21:36:54 | krux02__ | what gameplay do you want then? |
21:37:17 | zacharycarter[m] | I guess it would play like a MMORPG |
21:37:26 | zacharycarter[m] | which is kind of what MUDs play like |
21:38:16 | krux02__ | I am thinking of "crypt of the necrodancer" like turn where everybody has to take turns in regular time steps |
21:38:28 | krux02__ | that can be synchronized |
21:39:01 | zacharycarter[m] | yeah - I don't think roguelikes and multiplayer work well together |
21:39:02 | krux02__ | it is ideal for synchronization |
21:39:06 | zacharycarter[m] | the whole energy / turn concept doesn't translate at all |
21:39:22 | krux02__ | you know "crypt of the necrodancer" |
21:39:31 | zacharycarter[m] | hrm - but what about when you scale to several hundred players? |
21:39:39 | zacharycarter[m] | I've heard of the game - but I've never played it - I read that it was really good |
21:39:51 | krux02__ | I also din't play it |
21:40:07 | krux02__ | but it has 1 turen per second I think |
21:40:24 | zacharycarter[m] | interesting |
21:40:34 | krux02__ | so every second every player has to decide what to do in that second |
21:40:52 | zacharycarter[m] | right |
21:40:53 | krux02__ | whoever misses out on making a decision misses the opportunity to do anything |
21:41:17 | krux02__ | so there is no waiting for players |
21:41:34 | krux02__ | nod no complicated logic on handling ping |
21:41:44 | zacharycarter[m] | right |
21:41:50 | krux02__ | ping of 500? kick! |
21:41:58 | zacharycarter[m] | yeah that is an interesting way to do it |
21:42:34 | zacharycarter[m] | okay - I think frag 2.0 has to wait - this new project is too enticing 😂 |
21:43:00 | krux02__ | it is not only interesting, but also easy to implement |
21:43:06 | zacharycarter[m] | although I know barely anything about network programming |
21:43:06 | krux02__ | well fairly easy |
21:43:16 | zacharycarter[m] | so this should be fun |
21:43:32 | krux02__ | network programming is easy, the big problem is latency handling in game |
21:43:37 | krux02__ | and this way you just avoid it |
21:44:01 | zacharycarter[m] | yeah - I definitely like the sync mechanism |
21:44:16 | krux02__ | game are not in sync, it is all fake, someone has the feel the latency somehow |
21:44:35 | krux02__ | s/game/games/ |
21:44:50 | krux02__ | any building this fake is super complicated |
21:45:35 | zacharycarter[m] | yeah - I've read that valve networking article where they talk about lag compensation |
21:45:46 | zacharycarter[m] | it's definitely complex as fuq |
21:46:27 | krux02__ | with logic like, when I shoot someone on my screen I see him somewhere, but he is not really there, then the server gets that information and says, yea he was not there, but for you he was there, so the hit counts telling the player who got hit: "sorry you are dead". And the dead player who was already in cover and could not have been hit: "alf+f4" |
21:46:57 | zacharycarter[m] | lol |
21:47:13 | zacharycarter[m] | when I did a lot of UDK / UE3|4 programming replication was always fun |
21:47:35 | zacharycarter[m] | and explaining it to another developer who wasn't familiar with client networking code was even more fun |
21:47:36 | krux02__ | replication? |
21:48:01 | zacharycarter[m] | that's UE's name for calls that take place both on the client and server |
21:48:12 | zacharycarter[m] | https://wiki.unrealengine.com/Replication |
21:48:34 | * | miran_ quit (Ping timeout: 256 seconds) |
21:48:46 | krux02__ | I rememebr playing King Arthungs Gold when it did not have latency compensation yet. I was killing people 10:1. Then the game got network compensation and my ass was beaten. |
21:48:50 | zacharycarter[m] | it's just basically code that syncs object state b/w client and server |
21:48:58 | zacharycarter[m] | haha that game is so much fun |
21:49:02 | krux02__ | The game wasn't fun for me anymore, because I knew where to aim |
21:49:04 | zacharycarter[m] | that's what got me into procedural mapgen / roguelikes |
21:49:49 | zacharycarter[m] | I only played it probably 20x so I didn't get good or anything - but I had a blast the times I did play |
21:49:57 | krux02__ | the only problem I have, I don't have a server that I can use. |
21:50:18 | zacharycarter[m] | to play on? |
21:50:33 | zacharycarter[m] | aren't there lots of dedicated servers? |
21:50:47 | zacharycarter[m] | thank goodness for fowl - https://github.com/fowlmouth/nimrod-enet |
21:51:15 | krux02__ | well I always wanted to have my own server, I don't really like to use "the cloud" |
21:51:43 | zacharycarter[m] | next time carfax gives away free pcs I'll send you one |
21:51:57 | krux02__ | zacharycarter[m], I don't think you shoud use UDP for this project |
21:51:58 | zacharycarter[m] | if I'm still there |
21:52:11 | zacharycarter[m] | TCP? |
21:52:15 | krux02__ | yes |
21:52:25 | krux02__ | and set the timeout to 500 ms |
21:52:32 | krux02__ | I think you can customize it |
21:52:44 | krux02__ | I think normally it is at 30 000 ms |
21:52:48 | krux02__ | 30s |
21:53:03 | krux02__ | ½ min |
21:53:19 | zacharycarter[m] | gotcha |
21:53:50 | krux02__ | and maybe a warning system when the lag goes beying 250ms |
21:54:26 | krux02__ | I think a half second interval is good |
21:54:38 | zacharycarter[m] | yeah |
21:55:02 | krux02__ | so you have half a second to decide what you want to do. then half a second to sync all player decisions, and then the step is executed everywhere |
21:55:36 | krux02__ | you can't do it exactly like in crypt of the necro dancer where the move is executed at the same time you hat the key |
21:55:50 | krux02__ | you have to give the game a sync time |
21:56:36 | zacharycarter[m] | `proc recv(socket: Socket; data: pointer; size: int; timeout: int): int {..}` |
21:56:37 | zacharycarter[m] | looks like that should work |
21:56:55 | zacharycarter[m] | right |
21:56:57 | krux02__ | other games normally hide this sync time from the player, for good reasons |
21:57:14 | krux02__ | yes |
21:57:17 | krux02__ | looks good |
21:57:35 | krux02__ | I am just confused about the api, I think it should be an open array |
21:57:38 | FromGitter | <mratsim> Github search on ..< is a complete fail: https://forum.nim-lang.org/t/4130 |
21:57:45 | krux02__ | where is that proc? |
21:58:05 | zacharycarter[m] | https://nim-lang.org/docs/net.html |
21:58:07 | FromGitter | <mratsim> asyncdispatch? |
21:59:00 | zacharycarter[m] | `proc withTimeout[T](fut: Future[T]; timeout: int): Future[bool]` is in asyncdispatch |
21:59:01 | FromGitter | <mratsim> oh, asyncnet also has the same then |
21:59:24 | zacharycarter[m] | nope :( |
21:59:51 | zacharycarter[m] | but I think that's okay because asyncdispatch has it |
22:02:02 | FromGitter | <mratsim> @krux02 I’m pretty sure it’s not an openarray because it’s just a dumb wrapper to Posix recv |
22:02:52 | FromGitter | <mratsim> https://github.com/nim-lang/Nim/blob/devel/lib/posix/posix.nim#L851-L852 |
22:06:04 | krux02__ | mratsim: but it is not that procedure |
22:06:08 | krux02__ | it is the proc in net |
22:06:56 | krux02__ | and there is an overload with that uses .... string ... :-/ |
22:07:03 | krux02__ | it should be openarray |
22:10:54 | AlexMax | What is nim doing when it's [Processing]? |
22:11:36 | AlexMax | krux02__: btw, I tried using glad last night and found a couple of weird issues with having to cast parameter types that the built-in opengl module doesn't have |
22:12:00 | krux02__ | it is compiling |
22:12:11 | AlexMax | that said, I have no clue how I'm supposed to load third-party GL extensions |
22:12:17 | AlexMax | with the default opengl implementation |
22:12:24 | krux02__ | AlexMax, can you give an example of a cast that you needed? |
22:12:38 | AlexMax | zacharycarter[m] remembers |
22:12:53 | AlexMax | :P |
22:12:57 | AlexMax | jk, let me look through my logs |
22:13:21 | krux02__ | AlexMax, in glad you can specify what extensions you want. and with the default opengl implementation I think you just use them |
22:13:34 | krux02__ | the problem is that then the loader will also require them |
22:13:49 | krux02__ | there is no way that you can load thoes extensions optionally |
22:14:00 | krux02__ | so glay seems the only option left |
22:14:07 | krux02__ | and I use it in production |
22:14:09 | AlexMax | krux02__: I tried looking for KHR_debug and couldn't find it |
22:14:20 | AlexMax | (in nim opengl) |
22:14:20 | zacharycarter[m] | I'm on osx so take any OpenGL advice I give you - with a grain of salt 😅 |
22:15:17 | AlexMax | krux02__: GL_FALSE is not a GLboolean |
22:15:34 | AlexMax | so I found myself having to GL_FALSE.GLboolean it |
22:15:47 | krux02__ | what type is GL_FALSE then? |
22:15:57 | AlexMax | krux02__: Literal int 0 |
22:17:17 | krux02__ | AlexMax, you can just use false and true |
22:19:32 | AlexMax | I think I also had to cast an int to GLsizeiptr |
22:22:15 | zacharycarter[m] | https://thoughtstreams.io/glyph/your-game-doesnt-need-udp-yet/ - pretty good |
22:30:18 | krux02__ | AlexMax, that is not something that should happen, |
22:33:59 | krux02__ | AlexMax, that cant to GLsizeiptr is indeed a bug |
22:34:18 | krux02__ | I create a PR now to fix it in glad |
22:34:55 | krux02__ | you should change the type definition in your generated gl.nim to int as well. |
22:34:59 | AlexMax | krux02__: You've verified it on your end? |
22:35:07 | AlexMax | And to be clear, the problem was that I had to do the cast in the first place |
22:35:12 | krux02__ | yes |
22:35:20 | AlexMax | not that a cast was happening without me knowing about it |
22:35:27 | krux02__ | the problem is that the type definition in gl.nim is wrong |
22:35:35 | krux02__ | meaning also the fuction prototype is wrong |
22:35:44 | AlexMax | allright - well right now I'm using nim opengl |
22:35:48 | AlexMax | but i might be switching back soon |
22:35:49 | krux02__ | meaning that the fucntion can be called incorrectly |
22:35:52 | AlexMax | so thanks for the heads up |
22:35:58 | krux02__ | causing very very strange behavior |
22:36:37 | * | PrettyKittie14 joined #nim |
22:36:44 | krux02__ | I would stick to glad, the official opengl implementation doesn't seem to be better structually at all. |
22:36:51 | * | PrettyKittie14 quit (K-Lined) |
22:36:51 | krux02__ | it has many of the same bugs |
22:37:32 | AlexMax | well, right now I'm trying to just render a triangle |
22:42:28 | krux02__ | https://github.com/Dav1dde/glad/compare/master...krux02:patch-2 |
22:43:14 | krux02__ | sorry |
22:43:16 | krux02__ | https://github.com/Dav1dde/glad/pull/168 |
22:43:54 | AlexMax | nice |
22:52:07 | AlexMax | wow, windows is apparently giving me a compatibility context even when I request a core context |
22:56:44 | krux02__ | windows is always nice to you |
22:57:17 | krux02__ | AlexMax, what version do you request? |
22:57:23 | AlexMax | 3.2, core |
22:57:38 | krux02__ | 3.2 is the first version to have a core context? |
22:57:42 | krux02__ | why not 3.3? |
22:58:05 | krux02__ | is there any hardware left on this planet that supports 3.2 but not 3.3? |
23:00:28 | * | enchi joined #nim |
23:01:22 | AlexMax | ughhhhhh where is my triangle |
23:01:30 | AlexMax | I've done this twice before, why is it always hard :P |
23:01:46 | * | enchi quit (Killed (Sigyn (Spam is off topic on freenode.))) |
23:01:57 | krux02__ | AlexMax, because OpenGL is horrible |
23:02:07 | krux02__ | you have to enable the attributes |
23:03:30 | AlexMax | I'm doing that already I thought |
23:04:31 | AlexMax | krux02__: https://paste.ee/p/aJR8y |
23:04:34 | AlexMax | It's probably something stupid |
23:09:24 | * | yglukhov[i] quit (Remote host closed the connection) |
23:09:57 | * | yglukhov[i] joined #nim |
23:10:51 | * | yglukhov[i] quit (Remote host closed the connection) |
23:11:04 | * | yglukhov[i] joined #nim |
23:13:17 | AlexMax | krux02__: ugh, I forgot to rebind the vao before rendering, but it still won't do anything |
23:25:26 | AlexMax | ...wait a minute, I'm passing the length of the array |
23:25:31 | AlexMax | that's not right |
23:25:38 | AlexMax | I need to pass the complete size of it |
23:26:39 | AlexMax | that was it! |
23:29:02 | * | yglukhov[i] quit (Remote host closed the connection) |