<< 14-08-2018 >>

00:00:22zacharycarter[m]only gripe I have with BGFX is the shader comilation but it's inevitable
00:00:37FromGitter<zetashift> oh I thought it was a clean C++ codebase
00:01:00FromGitter<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:13zacharycarter[m]nope! the author of BGFX actually writes his C++ code in a style he calls `Orthodox C++`
00:03:25zacharycarter[m]`https://gist.github.com/bkaradzic/2e39896bc7d8c34e042b`
00:03:44*amar quit (Remote host closed the connection)
00:04:26FromGitter<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:12zacharycarter[m]😅
00:05:30zacharycarter[m]metaprogramming in C++ != metaprogramming in Nim though
00:05:39zacharycarter[m]so you have to take that into consideration as well
00:05:59FromGitter<zetashift> yeah so I heard
00:06:45zacharycarter[m]but yeah - I agree with that sentiment - use metaprogramming for what it's for
00:06:47FromGitter<zetashift> man I give up on this undeclared identifier error
00:06:56zacharycarter[m]gist?
00:07:03FromGitter<zetashift> https://github.com/pragmagic/godot-nim/issues/36
00:08:07zacharycarter[m]Ooph - you're using dynamic dispatch
00:08:30zacharycarter[m]I has no idea then :P - I never do OOP with Nim if I can avoid it
00:09:13zacharycarter[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:43zacharycarter[m]sounds likes something is off though with the `gdobj` macro
00:12:46FromGitter<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:20AlexMaxugh man, the last time I used OpenGL I did precisely no transformations
00:21:33AlexMaxdidn't need them, all I was doing was 2D
00:36:03AlexMax`converter toSizePtr(x: int): GLsizeiptr = return GLsizeiptr(x)
00:36:21AlexMaxI'm-a Wario. I'm a-gonna ween!
00:38:14zacharycarter[m]don't user converters
00:38:51zacharycarter[m]look at what the GLtypes equate to - and then just use those ctypes in Nim
00:39:01zacharycarter[m]or once you have GLType = NimType
00:39:05zacharycarter[m]use `.NimType`
00:39:28zacharycarter[m]you're almost always passsing primitives anyway
00:40:09zacharycarter[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:31zacharycarter[m]it was mostly a port of http://www.raylib.com/
00:41:17zacharycarter[m]although I differentiated from raylibs implementation of a few features
00:42:26zacharycarter[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:42zacharycarter[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:48AlexMaxoof, 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:03AlexMaxGL_FALSE is not a GLboolean
00:54:29AlexMaxit's implemented as literal int 0
00:54:42AlexMaxso you gotta cast it...every time...
00:55:51zacharycarter[m]write a proc then - don't use a converter
00:56:02zacharycarter[m]from my understanding - converters are going the way of the dodo bird eventually
00:56:19*Lord_Nightmare2 joined #nim
00:56:40zacharycarter[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:04zacharycarter[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:32AlexMaxzacharycarter[m]: My point was that I think glad might need a fixup
00:59:46AlexMaxand not define GL_FALSE incorrectly
00:59:57AlexMaxwhat use are types if they're not correct :P
01:01:06*ldlework joined #nim
01:02:08*francisl quit (Quit: francisl)
01:02:35zacharycarter[m]don't use GLAD
01:02:48zacharycarter[m]I don't think anyone doing opengl programming these days is using it
01:03:10zacharycarter[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:34zacharycarter[m]I'm sure whatever Nim bindings for GLAD that exist - aren't up to doate
01:05:35zacharycarter[m]to date*
01:05:36zacharycarter[m]the SDL2 bindings also do a lot of things behind the scenes in regards to loading the GLContext
01:05:38AlexMaxzacharycarter[m]: krux02 actually mentioend that he did
01:05:50AlexMaxwhich is why I considered it again
01:06:23zacharycarter[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:56AlexMaxfrom 1:1 what?
01:08:52AlexMaxI've used SDL2 + OpenGL in the past using C++, which is why I'm trying them now :P
01:09:22zacharycarter[m]I mean from GLAD calls to SDL2 calls
01:09:38zacharycarter[m]sdl2 + opengl + nim should work fine
01:09:53zacharycarter[m]Im not 100% understanding why GLAD is in the picture
01:09:57zacharycarter[m]SDl2 should remove any need for GLAD
01:10:42AlexMaxyou mean `opengl`?
01:10:43AlexMax:P
01:11:18zacharycarter[m]no - if you want to use SDL2 + OpenGL you still need OpenGL
01:11:43AlexMaxthat's weird - nimble isntall opengl brought along x11 package
01:11:47AlexMaxbut I'm on windows
01:12:53zacharycarter[m]¯_(ツ)_/¯
01:13:57zacharycarter[m]https://github.com/nim-lang/opengl/blob/master/opengl.nimble
01:14:57AlexMaxyeah i saw that
01:14:59AlexMaxi didn't get it either
01:15:15*thomasross_ joined #nim
01:16:10zacharycarter[m]is `windows` stll a valid define?
01:16:41zacharycarter[m]maybe do some debugging and add an echo into the nimble file and see if it prints to stdout
01:17:01zacharycarter[m]I can only think that windows translated to something else in a later version of nim
01:17:12zacharycarter[m]but I have no idea - I'm on osx primarily
01:17:33zacharycarter[m]maybe win32 / win64? I dunno
01:17:35*thomasross quit (Ping timeout: 240 seconds)
01:17:50AlexMaxokay yeah, opengl gets rid of all the stupidity
01:18:05zacharycarter[m]:)
01:20:10AlexMaxno casts needed
01:20:16AlexMaxi want my money back
01:22:57zacharycarter[m]bill araq :P
01:23:24zacharycarter[m]but expect a harsh return on your investment :D
01:33:23AlexMaxno, i want my money back for glad
01:39:03AlexMaxand the joke is that it's free, so there's no money to be given back
01:39:09AlexMaxthats_the_joke.avi
01:44:13bozaloshtshanyone have nim-mode and nimsuggest integration working in emacs?
01:47:05bozaloshtshWhenever I leave my point somewhere, emacs freezes because epc to nimsuggest fails to start
01:48:21bozaloshtshI compiled nimsuggest without -d:release and got the following stack trace: https://ptpb.pw/-eCy
01:49:08bozaloshtshFixing this issue doesn't solve the problem... nimsuggest then just hangs and blasts my cpu for whatever reason
01:49:24bozaloshtshcan anyone confirm that they have this working on master? I'm currently using devel
01:52:04FromGitter<kaushalmodi> bozaloshtsh: I am on devel too. I disable nimsuggest.
01:56:28bozaloshtshbleh
01:57:35FromGitter<gogolxdong> any help on ⏎ ⏎ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b72370f988005174ed69c53]
01:58:12FromGitter<gogolxdong> SIGSEGV: Illegal storage access. (Attempt to read from nil?) in line of crc32
02:03:30AlexMaxhrm, in this opengl tutorial, glShaderSource is capable of taking a plain-old string, not necessarily a cstringarray
02:04:24AlexMaxglShaderSource(vertexShader, 1, &vertexShaderSource, NULL);
02:07:44FromGitter<gogolxdong> changed to `proc crc32*(buffers: ref EnetBuffer; ...`and `var buffers = new EnetBuffer` compiles but got crc32 is 0.
02:15:56bozaloshtshon another note, I'm surprised at the interest in nim from the bioinformatics field
02:18:05AlexMaxi 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:36AlexMaxnim seemed really good at interfacing with C libraries
02:18:55bozaloshtshnim seems to fill a niche between python and C that many have needed for some time
02:19:05bozaloshtshgame devs and bioinformaticians alike
02:19:34bozaloshtshI picked it up because I thought its metaprogramming was cool
02:20:24AlexMaxaw, 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:19bozaloshtshIs there an Either counterpart to Option in the stdlib? planned?
02:29:03*ziddey10 joined #nim
02:30:35AlexMaxI 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:01bozaloshtshany 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:09bozaloshtshbah
02:50:51bozaloshtshbad paste, https://ptpb.pw/Fh9c is the real one
02:54:11bozaloshtshfigured 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:22euantorzacharycarter[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:50AraqAlexMax: finalizers are not being removed
05:03:25Araqand destructors are now available without --newruntime (but still receive serious bugfixes...)
05:04:36Araq"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:48endragorIs 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:21Araqit used to enable `=destroy` and `=sink` etc, but these are now available without switch
06:28:25Araqthe "new runtime" is now just another GC mode with a different performance profile (--gc:destructors)
06:30:27FromGitter<gogolxdong> what's benefit of destroy and sink?
06:32:31Araqit produces a more deterministic runtime profile and improves interop with C++, Python, etc further
06:32:58Araqit may also be faster but that usually depends on many factors
06:44:26endragorAraq: 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:30Araqhttps://github.com/nim-lang/Nim/wiki/Destructors
06:46:58Araqis the spec I'm sticking to/updating
06:49:18Araqthe constructor topic seems to be covered by https://github.com/nim-lang/Nim/issues/7917
06:55:32*miran joined #nim
06:58:07FromGitter<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:50Araqwell but you typed '=' instead of ':', I bet ;-)
07:01:57Araqvar x = 4
07:01:58Araqvs
07:02:01Araqvar x: int
07:02:22stefanos82Araq, 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:23Araqvalues are not types, types are not values (as a first approximation)
07:02:55Araqbecause it's only a "partial move"
07:03:11Araqit moves into the destination but does not clear the source
07:03:36Araqa move would take two 'var T' parameters and that's harder to work with
07:03:56Araqand means we would need to be able to bind rvalues to 'var T' and other nonsense
07:04:14Araqsee C++ for a reference ;-)
07:05:34stefanos82I use C++ already, no need to investigate it any further lol
07:06:33FromGitter<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:53Araqsomething like that, yes
07:09:08Araqendragor: btw have you tried 'packedjson' ?
07:10:57endragorAraq: 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:25stefanos82Araq, question: when does GC usually kicks in to start cleanup?
07:19:43Araqstefanos82: when it feels like
07:20:00Araqafter 4MB was allocated
07:20:07stefanos82ah I see
07:20:30*Vladar joined #nim
07:21:02stefanos82so, 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:54FromGitter<alehander42> oh , initialization in type definitions sounds pretty nice
07:30:00FromGitter<alehander42> default values*
07:31:47Araqstefanos82: hybrid and if you avoid 'ref' and closures there are no tracing mechanisms used
07:32:06stefanos82Araq: more than awesome!
07:32:09stefanos82that would be mind blowing
07:34:02Araqoh and of course, as a nice side effect you don't have to 'close' files, sockets
07:34:37stefanos82who will close it, the destructor?
07:35:39Araqyeah
07:36:39stefanos82in other words, like C++'s RAII
07:38:00PMunchHmm, 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:40Araqyeah, I understand. no, it's not possible
07:40:23Araqyou can write a blog post 'return statement considered evil, it's tied to function calls, not to blocks'
07:40:42Araqbut that's just how things are :-)
07:41:33PMunchHaha, why would it be considered evil?
07:42:05Araqdunno, last time I checked 'bool' is now evil.
07:42:07PMunchFound a workaround that creates a value which works similar to result: http://ix.io/1k8N/
07:43:01PMunchHaha, it's not that bools are evil. It's just the implicit context of a check that is unsafe
07:43:52Araqit really isn't.
07:44:05PMunchOf course it is
07:44:20AraqI agree that pattern matching is safer, but it's also more limited
07:44:51PMunchOh yeah, I'm not saying that we should strip away bools and if checks entirely
07:45:02Araqif x > 0: # ok we know x is Positive here
07:45:26Araqif Positive(x) as y: # now a type property of 'y', great
07:45:48PMunchI'm just trying to add the option for people to use the safer option
07:46:13Araqif Positive(x) and isPrime(x) as y # uh, hmm, my type system cannot express isPrime
07:46:31Araq# let's have dependent typing...
07:46:33*leorize joined #nim
07:47:09PMunchHmm, I think I see what you mean
07:47:22AraqI don't mind dependent typing, but I do mind reinventing it without being aware of it
07:48:15Araqthe type systems in wide usage today are always a crude approximation of the runtime behaviour
07:48:47Araqand for good reasons, but if you want to push the state of the art here, look into proof engines
07:49:56PMunchWell 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:02FromGitter<alehander42> btw does somebody have good initial resources for that, I was literally trying to get into proof engines last weekend :D
07:51:19Araqhmm I would start with "abstract interpretation" and control flow graphs
07:51:27*odc_ quit ()
07:51:46*odc_ joined #nim
07:52:25Araqand then look into "shape analysis" as a generalization of alias analysis
07:52:58PMunchBesides, 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:35Araqyeah but I want a very lean options.nim module so that I can use Option[T] without feeling fat
07:54:01Araqwell I don't use Option[T] but eventually it will be used more in the stdlib, can't fight the inevitable forever
07:54:41Araqand 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:17FromGitter<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:35Araqyeah it's pretty much symbolic execution
07:55:40*odc joined #nim
07:56:54FromGitter<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:16FromGitter<alehander42> @PMunch do you have a blog article about options? I am trying to find out the origin of discussion
07:58:53Araqlambda cube?
07:59:04FromGitter<alehander42> ah I found it
08:00:10FromGitter<alehander42> https://en.wikipedia.org/wiki/Lambda_cube
08:00:22Araqyeah found it, way over my head
08:00:57FromGitter<alehander42> basically something like a higher level "periodic" table
08:01:39PMunchalehander42, 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:54PMunchAnd 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:13Araqyeah, follow my advice instead, I bet it's simpler :P
08:03:16PMunchAnd 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:35FromGitter<alehander42> I think krux02's pattern matching lib or patty can be adapted for most nim values
08:04:37PMunchBut 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:49FromGitter<alehander42> I already had a patch for krux02's lib which worked for most values
08:04:57FromGitter<alehander42> but it was very rough and unfinished
08:05:13PMunchI can neuter it though, and only keep that part of the functionality and call it something else than "match"
08:05:26FromGitter<alehander42> and I got lazy and didn't finish it
08:05:33Araqwhy not 'optionsex.nim' as a new module?
08:11:05FromGitter<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:58FromGitter<alehander42> options would be extremely useful especially with less and less nil in Nim
08:12:42PMunchYeah I could move it to optionutils or something
08:13:09PMunchalehander42, less and less nil?
08:13:31PMunchalehander42, yeah as I point out in my article this whole boolean blindness thing is a bit silly
08:13:40FromGitter<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:45PMunchIt's more about checks
08:14:24*pwntus quit (Remote host closed the connection)
08:15:10FromGitter<alehander42> well yeah this would be great in a flow typing/dependent types way
08:15:59FromGitter<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:07PMunchIf 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:12FromGitter<alehander42> so, can you express that isPrime results can be tested for isPositive ?
08:17:13PMunchWell yeah, that kind of tracking would be awesome. But a lot harder to implement and get right
08:17:45PMunchWhat do you mean?
08:17:55Araq``some(100) and some(200)`` would return ``some(200)``
08:17:59FromGitter<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:13FromGitter<alehander42> I mean what's the point of isPrime and isPositive being distinct
08:18:25Araqthat's not Option thing, that's a whole new concept of "has-ity"
08:18:26FromGitter<alehander42> if you dont have rules that validate only some operations with them
08:18:45FromGitter<alehander42> because currently they both see like the same type: Option[int]
08:18:54Araqit just doesn't belong to the stdlib, sorry
08:20:30PMunchHmm, should I flip the meaning of `and` and `or`? They make sense in bash where
08:20:44PMunch<someprogram> && <some other program>
08:21:04FromGitter<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:12PMunchonly 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:17FromGitter<alehander42> but this would quickly be too much for the type system
08:21:40PMunchalehander42, well that can already be handled by using distinct types
08:22:42FromGitter<alehander42> this part can, but for more complicated checks you would need weirder stuff
08:41:46FromGitter<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:12Araqgist it
08:53:19FromGitter<tim-st> basically this:
08:53:29FromGitter<tim-st> ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5b7298895b07ae730ab74128]
08:53:55FromGitter<tim-st> p2 doesnt work
08:54:05FromGitter<mratsim> try s\[0\]
08:54:13FromGitter<mratsim> idem for p1
08:54:34FromGitter<mratsim> take the address of the first elements, not of the string, because those are not the same
08:54:50FromGitter<tim-st> yes, you're right, thanks
08:54:54FromGitter<mratsim> string is a pointer to length + memory
08:55:02FromGitter<mratsim> you want a pointer to the memory directly
08:55:11FromGitter<tim-st> ok, so it's expected to not work?
08:55:39FromGitter<mratsim> I’m pretty sure it’s not what you want
08:55:43FromGitter<tim-st> I made this working using `t: var T` as param and `mitems(t)`
08:56:28FromGitter<tim-st> Well, I have not tested the code yet, but the compiler doesnt complain
09:01:21FromGitter<tim-st> `var p2 = unsafeAddr(strings[i])` works; I thought it's the same like iterating in a for loop
09:10:50FromGitter<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:25dom96hello kobi7
09:39:53kobi7hey dom, can you see my messages? seems there were some problems with the irc server
09:40:36kobi7ah, good, I see it now in the irc log
09:50:06*Guest74244 joined #nim
09:51:06kobi7hi dom96
09:51:37*Guest74244 quit (Remote host closed the connection)
09:51:37kobi7I am porting some C# code, and I was wondering how to handle static classes and their (static) methods
09:51:58dom96There is no problem with the IRC server. We mute every user that isn't registered because of spammers
09:52:31kobi7ok
09:53:45kobi7static methods are called with their class: ClassA.someMethod()
09:55:03kobi7also, they may contain some static variables, that are available to all their static methods
09:55:50kobi7if I understand correctly, the equivalence is just a filename with the class name, and put variables there, without actually creating a type
09:56:16kobi7is that the best idea, in your opinion?
09:59:21dom96sure, I think that would work
09:59:32dom96But I wonder what you're needing this for?
10:07:15FromGitter<tim-st> kobi7: if you really want to keep the style, the following works:
10:07:33FromGitter<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:54FromGitter<tim-st> or even better with underscore: `proc procForA*(_: typedesc[ClassA]): string =`
10:11:32*Taylor_ joined #nim
10:12:52kobi7tim-st, thanks! that's really great. One question though: that kind of type can be instantiated as an object
10:13:03kobi7right?
10:13:31kobi7you 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:17kobi7dom96: there's just a lot of dotnet code out there. I wanted to port and keep the syntax close to original
10:14:31kobi7thought it'd be useful.
10:15:07FromGitter<tim-st> Maybe you can overwrite the internal proc for each type that is called in instantiation with `doAssert false`
10:15:09kobi7tim-st, that's a good approach, I don't want to create new files for every static.
10:15:24kobi7hmm
10:15:33FromGitter<tim-st> Otherwise you can look for "Concept" that maybe can do this check
10:15:39kobi7overwrite the `new` basically?
10:16:08FromGitter<tim-st> I think `new` is only for ref object, others have to answer this one^^
10:16:26kobi7actually it doesn't matter really, the c# code is built right, so my usage will not mess things up
10:17:08kobi7... others have to answer this ???
10:17:22FromGitter<tim-st> Others have more knowledge about internals^^
10:17:26kobi7(Error: brain couldn't parse)
10:17:50FromGitter<tim-st> No, even better:
10:18:34FromGitter<tim-st> instead of `type classA = object ` use `type classA = distinct int` or something that cannot be initialized
10:19:07kobi7you're a genius
10:19:46kobi7Many thanks
10:20:01FromGitter<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:59kobi7dom96: I hope I have enough time to finish it, to show you the idea in practice :-)
10:23:42kobi7the 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:07kobi7so, not sure I'll finish this... need to see
10:25:01kobi7ok, see you for now, thanks a bunch! and have a great day
10:25:09*kobi7 quit (Quit: Leaving)
10:25:44FromGitter<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:14krux02I am generally not a fan of porting the stdlib of some other language to Nim
11:16:36krux02then there will be the python stdlib, the c# stdlib, thc c++ stdlib
11:16:49krux02all of them basically doing 95% of the same thing just with different names
11:16:52krux02and different imports
11:17:32krux02Nim is not c# and it does not want to be C#
11:17:47krux02but if it makes people happy to port the c
11:18:09krux02C# stdlib, then people can do it. It should just not become part of the Nim stdlib.
11:18:33FromGitter<alehander42> I can see the appeal, it makes porting easy indeed
11:18:46FromGitter<alehander42> but yeah, it should be a nimble lib
11:21:22FromGitter<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:01FromGitter<alehander42> but usually this works well only on small scale
11:22:12FromGitter<alehander42> especially with a language with different patterns as c#
11:22:47*tcsc0 joined #nim
11:22:57Araqpy2nim could focus on a subset of Python, like numpy
11:22:59*janus0 joined #nim
11:23:08Araqbut I'm not sure if it buys you much
11:23:23Araqnumpy code might be pretty static though
11:23:30FromGitter<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:10FromGitter<alehander42> otherwise I think py2nim can become kinda useful for some projects/scripts which mostly consume existing libs and process/tweak data
11:25:27FromGitter<alehander42> but not for libs
11:26:37FromGitter<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:08FromGitter<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:16FromGitter<Varriount> nimcrypto might work.
11:51:19*neptune joined #nim
11:54:32*neptune quit (Remote host closed the connection)
11:57:38FromGitter<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:46zacharycarter[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:25FromGitter<tim-st> is deleting from seq at index i in O(1)? is it linked list?
12:37:54FromGitter<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:48FromGitter<tim-st> is it correct? (from docs):
12:40:59FromGitter<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:23FromGitter<tim-st> shouldnt it be `@[1, 2, 4,5]`?
12:41:48*voiceftp quit (Ping timeout: 268 seconds)
12:42:52FromGitter<tim-st> ok, there's also `delete` proc this seems the one I want
12:43:17euantorzacharycarter[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:37PMunchUhm, what does this error mean? Error: unhandled exception: false ccgtypes.nim(180) mapType [AssertionError]
13:01:41FromGitter<mratsim> @tim-st, del is O(1), delete is O(n)
13:02:19FromGitter<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:13FromGitter<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:02FromGitter<trashhalo> Is there a way to make two implementations of the same module? One for normal backend one for js backend?
13:16:36FromGitter<tim-st> `when defined(js)`?
13:18:16FromGitter<trashhalo> like block out function bodys have the js version and the normal version proc yada yada: = when defined(js) ??
13:18:55FromGitter<tim-st> `when defined(js): var x = 1 else: var x = 2`
13:19:17FromGitter<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:44FromGitter<tim-st> you can look in `system.nim` or `math` it's used there quite often
13:19:49FromGitter<trashhalo> perfect!
13:19:53FromGitter<trashhalo> thank you. will dig in
13:19:57FromGitter<data-man> @tim-st: I pushed updates for nimsnappyc. Please, check. :)
13:20:34FromGitter<trashhalo> oh yea look at that. https://github.com/nim-lang/Nim/blob/devel/lib/pure/math.nim#L139
13:21:45FromGitter<tim-st> @data-man thanks, I will try it; I think you can use `if unlikely(len == 0)`
13:22:14FromGitter<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:57FromGitter<mratsim> if it’s big you can use `when defined(js): import mymodule_impljs else: import mymodule_impl
13:25:00zacharycarter[m]Anyone want to port http://www.seanriddle.com/furbysource.pdf to Nim?
13:25:22*gangstacat quit (Ping timeout: 256 seconds)
13:25:25FromGitter<trashhalo> oh smart ill keep that in mind
13:27:06FromGitter<tim-st> @data-man works good, thanks :)
13:28:05*miran_ joined #nim
13:28:20*miran quit (Ping timeout: 256 seconds)
13:30:55FromGitter<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:02FromGitter<mratsim> @data-man it’s often placebo :P
13:40:43FromGitter<mratsim> also it’s really only useful before an exceptions/very rare path
13:41:00FromGitter<mratsim> the difference is the order of the if/else branch generated.
13:41:41FromGitter<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:47FromGitter<mratsim> at least on x86
13:45:10FromGitter<data-man> @mratsim: yes, "placebo" is the suitable word :) ⏎ But likely/unlikely very often used in optimized (or "optimized") C's libs.
13:45:57FromGitter<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:22FromGitter<mratsim> also branch prediction has been tremendously improved with has well.
13:46:34FromGitter<mratsim> Haswell*
13:47:32FromGitter<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:45FromGitter<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:02FromGitter<mratsim> you can’t benchmark it, because if you call it repeatedly the branch predictor will override the likely/unlikely boost
14:26:24FromGitter<mratsim> though if you use them wrong, the first few iterations will have more misprediction
14:28:36FromGitter<data-man> What about the app's times?
14:29:03FromGitter<data-man> I can compare two different apps.
14:29:33FromGitter<mratsim> likely/unlikely only makes sense for exceptional code paths
14:29:46FromGitter<mratsim> you don’t bench exceptional code paths normally
14:29:59AraqHaswell is unrealistically good at branch prediction...
14:30:03FromGitter<mratsim> just make sure they don’t hurt normal flow
14:30:56FromGitter<mratsim> ^ what I said. likely/unlikely are placebo’s today on x86
14:31:25Araqas a rule of thumb, only memory accesses matter
14:32:17Araqthe rest is fiction, optimize multiplications to shifts all day long, the CPU doesn't care
14:34:16AraqPMunch: it means you have found yet-another compiler bug :-/
14:34:54FromGitter<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:33Araqit's a rule of thumb.
14:36:19Araqand 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:11AraqI 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:25Araq(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:16FromGitter<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:02FromGitter<mratsim> except that in that case, prefetcher works better in the forward direction if you want to do fooArray\[i\]
14:44:31Araqyeah and you *need* exlusive lower bounds for that because otherwise your code will be littered with +1, -1, .... hmm wait
14:44:47Araqnobody ever argued for that. interesting.
14:45:32FromGitter<juancarlospaco> Yo
14:47:00Araqhi
14:51:18PMunchYeah I figured..
14:51:39Araqgah this cstring nil business is terrible
14:51:58Araqso I made mycstring == "string" not compile anymore
14:52:03Araqbut it breaks so much code
14:52:32Araqinstead I forbid mycstring == nil
14:52:46Araqthat then needs to be written as isNil(mycstring)
14:52:57Araqwhich seems to be more bearable
14:53:31Araqmaybe we disallow it just for a transition period?
14:54:37Araqalternatively I could introduce a special '==' in order to catch the string == nil comparison
14:54:55*m712 quit (Quit: bye-nyan!)
14:55:27leorizethen mark it with {.error.}
14:55:32leorizesounds good actually
14:55:46*m712 joined #nim
14:55:47Araq^ yep
14:56:41*noonien quit (Quit: Connection closed for inactivity)
14:57:29TheLemonMantim-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:52FromGitter<tim-st> TheLemonMan: Thank you very much!
15:37:47FromGitter<tim-st> @data-man haha, ok, I try to use them and hope it will make a positive difference :D
15:38:21ehmrycould 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:40ehmrybe* made
15:43:53krux02Araq: what is the problem with ``mycstring == "string"`` to compile?
15:44:49leorizeit makes "string" == nil a valid comparison
15:48:23*birdspider quit (Remote host closed the connection)
15:48:33krux02ah, ok I get it
15:51:33krux02well isn't there a pattern matcher in the compiler that can emit a warning when you compare a string with nil?
15:52:22krux02warining: this string is converted to cstring first before you compare it to Nil, this is probably not what you want.
15:53:32krux02I 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:41dom96shashlick: 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:57dom96c2nim/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:20FromGitter<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:03FromGitter<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:12TheLemonManhmm, are destroyers safe to use?
17:38:24*cspar joined #nim
17:40:12FromGitter<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:37Araqkrux02: I don't want this to be a warning, warnings are ignored
17:54:00Araqin fact, you know when we got rid of the deprecated symbols in the tests?
17:54:08Araqwhen they were finally removed.
17:54:24Araqand the tests started to fail.
17:54:41Araqwarnings are to be avoided if possible.
17:55:50krux02Araq, 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:44Araqbe 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:10Araqtim-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:38FromGitter<tim-st> what do you want to change?
18:44:57FromGitter<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:43Araqmoar directories
19:14:30*Guest79333 joined #nim
19:14:53FromGitter<kayabaNerve> Araq moar directories = moar paths. moar paths = moar files. moar files = moar code. moar code = moar Nim. more Nim = moar awesomeness.
19:15:23Araqthat sounds convincing
19:16:50FromGitter<kayabaNerve> Each file should have it's own directory.
19:17:00*Guest79333 quit (Remote host closed the connection)
19:17:20FromGitter<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:23FromGitter<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:54FromGitter<kayabaNerve> Till 23 seconds: https://youtu.be/chjVoVcVi3A?t=12s
19:20:48*francisl joined #nim
19:34:39*cryptocat1094 joined #nim
19:40:12FromGitter<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:52FromGitter<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:45krux02moar code = moar bugs. moar bugs = less awesomeness
19:48:02FromGitter<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:09PMunchHmm, I'm working with a C-wrapped library that takes the classic pointer to an array in order to return an array
20:45:24PMunchSo a ptr ptr TheType
20:45:40PMunchHow can I wrap this in an ergonomic fashion
20:47:02*jxy joined #nim
20:51:42*krux02_ joined #nim
20:54:04FromGitter<mratsim> it’s a pain
20:54:19FromGitter<mratsim> Nim opencl needs that by the way.
20:54:31*krux02 quit (Ping timeout: 268 seconds)
20:54:41FromGitter<mratsim> The most annoying part is managing array/seq lifetimes
20:55:13FromGitter<mratsim> easiest is probably to build a medium or high-level API with a custom seq/array type
20:55:19PMunchWell this isn't too performance critical, so just copying all the data over and then freeing the original array is fine
20:55:44PMunchI just need something I can pass in to read the type out
20:57:13PMunchI tried this: CArray{.unchecked.}[T] = array[0..0, T]
20:57:49PMunchAnd then: myArray: CArray[TheType]; theProc(myArray.addr); but that doesn't work for some reason
20:57:53FromGitter<mratsim> but the library is allocating an array inside the call?
20:58:00PMunchYe
20:58:03PMunchs
20:58:24FromGitter<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:42PMunchIt's the xlib call XQueryTree
20:58:49FromGitter<mratsim> because of lifetime issues, it’s much easier for the caller to manage array/malloc’ed array lifetime
20:59:18PMunchSo 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:52PMunchOh 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:24FromGitter<mratsim> Any sufficiently advanced library is indistinguishable from magic
21:07:40PMunchIndeed
21:07:55*PrimHelios joined #nim
21:08:42*cspar quit (Ping timeout: 268 seconds)
21:10:01PMunchOh 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:00zacharycarter[m]Howdy folks
21:26:28*get10 quit (Killed (Sigyn (Spam is off topic on freenode.)))
21:27:16krux02_zacharycarter[m], Howdy
21:27:40*francisl quit (Quit: francisl)
21:28:49zacharycarter[m]krux02_: have you ever played any MUDs?
21:29:10krux02_mean ugly dirty sports?
21:29:35zacharycarter[m]no haha Multi User Dungeons
21:29:52zacharycarter[m]basically text based MMORPGs - the precursor to MMORPGs
21:30:09*nsf quit (Quit: WeeChat 2.2)
21:30:53krux02_well I played once nethack via teln
21:31:05zacharycarter[m]yes that's basically a MUD
21:31:09zacharycarter[m]you play them via telnet
21:32:45zacharycarter[m]I was thinking - it'd be neat to try to write one in Nim
21:32:49*krux02__ joined #nim
21:33:02krux02__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:21krux02__I was disconnected but my irc cliend noticed it very late
21:34:09zacharycarter[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:12zacharycarter[m]I mean I'm sure you could - but I wonder if it would play well gameplay wise
21:34:38zacharycarter[m]well multi user dungeons have to be multiplayer
21:34:41zacharycarter[m]so there are other players in the same world as you
21:35:05*krux02_ quit (Ping timeout: 244 seconds)
21:35:39krux02__well for sure, I think technically that could be very doable
21:36:07krux02__but you should really think about how it would work with in multiplayer
21:36:31krux02__when you go multiplayer, I think turn based is not very scalable
21:36:44zacharycarter[m]oh I don't mean keep RL style gameplay
21:36:54krux02__what gameplay do you want then?
21:37:17zacharycarter[m]I guess it would play like a MMORPG
21:37:26zacharycarter[m]which is kind of what MUDs play like
21:38:16krux02__I am thinking of "crypt of the necrodancer" like turn where everybody has to take turns in regular time steps
21:38:28krux02__that can be synchronized
21:39:01zacharycarter[m]yeah - I don't think roguelikes and multiplayer work well together
21:39:02krux02__it is ideal for synchronization
21:39:06zacharycarter[m]the whole energy / turn concept doesn't translate at all
21:39:22krux02__you know "crypt of the necrodancer"
21:39:31zacharycarter[m]hrm - but what about when you scale to several hundred players?
21:39:39zacharycarter[m]I've heard of the game - but I've never played it - I read that it was really good
21:39:51krux02__I also din't play it
21:40:07krux02__but it has 1 turen per second I think
21:40:24zacharycarter[m]interesting
21:40:34krux02__so every second every player has to decide what to do in that second
21:40:52zacharycarter[m]right
21:40:53krux02__whoever misses out on making a decision misses the opportunity to do anything
21:41:17krux02__so there is no waiting for players
21:41:34krux02__nod no complicated logic on handling ping
21:41:44zacharycarter[m]right
21:41:50krux02__ping of 500? kick!
21:41:58zacharycarter[m]yeah that is an interesting way to do it
21:42:34zacharycarter[m]okay - I think frag 2.0 has to wait - this new project is too enticing 😂
21:43:00krux02__it is not only interesting, but also easy to implement
21:43:06zacharycarter[m]although I know barely anything about network programming
21:43:06krux02__well fairly easy
21:43:16zacharycarter[m]so this should be fun
21:43:32krux02__network programming is easy, the big problem is latency handling in game
21:43:37krux02__and this way you just avoid it
21:44:01zacharycarter[m]yeah - I definitely like the sync mechanism
21:44:16krux02__game are not in sync, it is all fake, someone has the feel the latency somehow
21:44:35krux02__s/game/games/
21:44:50krux02__any building this fake is super complicated
21:45:35zacharycarter[m]yeah - I've read that valve networking article where they talk about lag compensation
21:45:46zacharycarter[m]it's definitely complex as fuq
21:46:27krux02__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:57zacharycarter[m]lol
21:47:13zacharycarter[m]when I did a lot of UDK / UE3|4 programming replication was always fun
21:47:35zacharycarter[m]and explaining it to another developer who wasn't familiar with client networking code was even more fun
21:47:36krux02__replication?
21:48:01zacharycarter[m]that's UE's name for calls that take place both on the client and server
21:48:12zacharycarter[m]https://wiki.unrealengine.com/Replication
21:48:34*miran_ quit (Ping timeout: 256 seconds)
21:48:46krux02__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:50zacharycarter[m]it's just basically code that syncs object state b/w client and server
21:48:58zacharycarter[m]haha that game is so much fun
21:49:02krux02__The game wasn't fun for me anymore, because I knew where to aim
21:49:04zacharycarter[m]that's what got me into procedural mapgen / roguelikes
21:49:49zacharycarter[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:57krux02__the only problem I have, I don't have a server that I can use.
21:50:18zacharycarter[m]to play on?
21:50:33zacharycarter[m]aren't there lots of dedicated servers?
21:50:47zacharycarter[m]thank goodness for fowl - https://github.com/fowlmouth/nimrod-enet
21:51:15krux02__well I always wanted to have my own server, I don't really like to use "the cloud"
21:51:43zacharycarter[m]next time carfax gives away free pcs I'll send you one
21:51:57krux02__zacharycarter[m], I don't think you shoud use UDP for this project
21:51:58zacharycarter[m]if I'm still there
21:52:11zacharycarter[m]TCP?
21:52:15krux02__yes
21:52:25krux02__and set the timeout to 500 ms
21:52:32krux02__I think you can customize it
21:52:44krux02__I think normally it is at 30 000 ms
21:52:48krux02__30s
21:53:03krux02__½ min
21:53:19zacharycarter[m]gotcha
21:53:50krux02__and maybe a warning system when the lag goes beying 250ms
21:54:26krux02__I think a half second interval is good
21:54:38zacharycarter[m]yeah
21:55:02krux02__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:36krux02__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:50krux02__you have to give the game a sync time
21:56:36zacharycarter[m]`proc recv(socket: Socket; data: pointer; size: int; timeout: int): int {..}`
21:56:37zacharycarter[m]looks like that should work
21:56:55zacharycarter[m]right
21:56:57krux02__other games normally hide this sync time from the player, for good reasons
21:57:14krux02__yes
21:57:17krux02__looks good
21:57:35krux02__I am just confused about the api, I think it should be an open array
21:57:38FromGitter<mratsim> Github search on ..< is a complete fail: https://forum.nim-lang.org/t/4130
21:57:45krux02__where is that proc?
21:58:05zacharycarter[m]https://nim-lang.org/docs/net.html
21:58:07FromGitter<mratsim> asyncdispatch?
21:59:00zacharycarter[m]`proc withTimeout[T](fut: Future[T]; timeout: int): Future[bool]` is in asyncdispatch
21:59:01FromGitter<mratsim> oh, asyncnet also has the same then
21:59:24zacharycarter[m]nope :(
21:59:51zacharycarter[m]but I think that's okay because asyncdispatch has it
22:02:02FromGitter<mratsim> @krux02 I’m pretty sure it’s not an openarray because it’s just a dumb wrapper to Posix recv
22:02:52FromGitter<mratsim> https://github.com/nim-lang/Nim/blob/devel/lib/posix/posix.nim#L851-L852
22:06:04krux02__mratsim: but it is not that procedure
22:06:08krux02__it is the proc in net
22:06:56krux02__and there is an overload with that uses .... string ... :-/
22:07:03krux02__it should be openarray
22:10:54AlexMaxWhat is nim doing when it's [Processing]?
22:11:36AlexMaxkrux02__: 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:00krux02__it is compiling
22:12:11AlexMaxthat said, I have no clue how I'm supposed to load third-party GL extensions
22:12:17AlexMaxwith the default opengl implementation
22:12:24krux02__AlexMax, can you give an example of a cast that you needed?
22:12:38AlexMaxzacharycarter[m] remembers
22:12:53AlexMax:P
22:12:57AlexMaxjk, let me look through my logs
22:13:21krux02__AlexMax, in glad you can specify what extensions you want. and with the default opengl implementation I think you just use them
22:13:34krux02__the problem is that then the loader will also require them
22:13:49krux02__there is no way that you can load thoes extensions optionally
22:14:00krux02__so glay seems the only option left
22:14:07krux02__and I use it in production
22:14:09AlexMaxkrux02__: I tried looking for KHR_debug and couldn't find it
22:14:20AlexMax(in nim opengl)
22:14:20zacharycarter[m]I'm on osx so take any OpenGL advice I give you - with a grain of salt 😅
22:15:17AlexMaxkrux02__: GL_FALSE is not a GLboolean
22:15:34AlexMaxso I found myself having to GL_FALSE.GLboolean it
22:15:47krux02__what type is GL_FALSE then?
22:15:57AlexMaxkrux02__: Literal int 0
22:17:17krux02__AlexMax, you can just use false and true
22:19:32AlexMaxI think I also had to cast an int to GLsizeiptr
22:22:15zacharycarter[m]https://thoughtstreams.io/glyph/your-game-doesnt-need-udp-yet/ - pretty good
22:30:18krux02__AlexMax, that is not something that should happen,
22:33:59krux02__AlexMax, that cant to GLsizeiptr is indeed a bug
22:34:18krux02__I create a PR now to fix it in glad
22:34:55krux02__you should change the type definition in your generated gl.nim to int as well.
22:34:59AlexMaxkrux02__: You've verified it on your end?
22:35:07AlexMaxAnd to be clear, the problem was that I had to do the cast in the first place
22:35:12krux02__yes
22:35:20AlexMaxnot that a cast was happening without me knowing about it
22:35:27krux02__the problem is that the type definition in gl.nim is wrong
22:35:35krux02__meaning also the fuction prototype is wrong
22:35:44AlexMaxallright - well right now I'm using nim opengl
22:35:48AlexMaxbut i might be switching back soon
22:35:49krux02__meaning that the fucntion can be called incorrectly
22:35:52AlexMaxso thanks for the heads up
22:35:58krux02__causing very very strange behavior
22:36:37*PrettyKittie14 joined #nim
22:36:44krux02__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:51krux02__it has many of the same bugs
22:37:32AlexMaxwell, right now I'm trying to just render a triangle
22:42:28krux02__https://github.com/Dav1dde/glad/compare/master...krux02:patch-2
22:43:14krux02__sorry
22:43:16krux02__https://github.com/Dav1dde/glad/pull/168
22:43:54AlexMaxnice
22:52:07AlexMaxwow, windows is apparently giving me a compatibility context even when I request a core context
22:56:44krux02__windows is always nice to you
22:57:17krux02__AlexMax, what version do you request?
22:57:23AlexMax3.2, core
22:57:38krux02__3.2 is the first version to have a core context?
22:57:42krux02__why not 3.3?
22:58:05krux02__is there any hardware left on this planet that supports 3.2 but not 3.3?
23:00:28*enchi joined #nim
23:01:22AlexMaxughhhhhh where is my triangle
23:01:30AlexMaxI'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:57krux02__AlexMax, because OpenGL is horrible
23:02:07krux02__you have to enable the attributes
23:03:30AlexMaxI'm doing that already I thought
23:04:31AlexMaxkrux02__: https://paste.ee/p/aJR8y
23:04:34AlexMaxIt'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:17AlexMaxkrux02__: ugh, I forgot to rebind the vao before rendering, but it still won't do anything
23:25:26AlexMax...wait a minute, I'm passing the length of the array
23:25:31AlexMaxthat's not right
23:25:38AlexMaxI need to pass the complete size of it
23:26:39AlexMaxthat was it!
23:29:02*yglukhov[i] quit (Remote host closed the connection)