00:05:54 | * | audiofile joined #nim |
00:32:49 | * | endragor joined #nim |
00:37:05 | * | endragor quit (Ping timeout: 240 seconds) |
00:55:28 | * | maier joined #nim |
01:00:11 | * | maier quit (Ping timeout: 240 seconds) |
01:04:05 | * | apahl_ joined #nim |
01:06:45 | * | apahl quit (Ping timeout: 240 seconds) |
01:35:09 | FromDiscord | <Varriount> shashlick: As much as I would prefer a pure-nim version, I can see tree-sitter being useful for creating utilities such as linters and formatters |
01:45:56 | * | endragor joined #nim |
01:53:03 | * | Tlongir joined #nim |
02:03:15 | shashlick | Why pure Nim? |
02:03:45 | disruptek | because otherwise there's nothing to bikeshed. |
02:04:28 | disruptek | there's too many users of treesitter. too much support. too much momentum and future development. |
02:04:33 | * | JStoker quit (Read error: Connection reset by peer) |
02:04:56 | disruptek | better to have one person write a replacement, from scratch, and maintain it. |
02:25:39 | leorize | disruptek: I don't know that much about cpp symbol mangling |
02:26:09 | shashlick | I'll never get porting c/c++ to Nim |
02:26:39 | shashlick | It's one thing to think that way with an incompatible language |
02:27:06 | shashlick | I think we need to start contributing more precompiled libraries to the world |
02:27:38 | shashlick | So ruby or Julia folks can benefit from our innovation for example |
02:29:38 | * | JStoker joined #nim |
02:38:46 | * | audiofile quit (Quit: Default Quit Message) |
02:46:10 | * | endragor quit (Remote host closed the connection) |
02:46:19 | * | endragor joined #nim |
02:56:33 | * | maier joined #nim |
03:01:10 | * | maier quit (Ping timeout: 256 seconds) |
03:29:36 | FromDiscord | <Varriount> @shashlick I think the biggest reason is just annoyance at having to deal with building C/C++ |
03:31:24 | FromDiscord | <Varriount> That being said, my experience with Linux is that build problems are largely self inflicted (because of distro choice, manually moving files around, etc). |
03:32:36 | FromDiscord | <Varriount> On Windows it's a headache, because of headaches with CMake, Autotools, or Visual Studio Projects. |
03:32:51 | FromDiscord | <Varriount> (edit) "a headache," => "harder," |
03:33:22 | shashlick | i can totally relate |
03:33:34 | shashlick | initially i added cmake and co support to nimterop |
03:33:58 | shashlick | now with JBB and Conan support, it's a lot easier to get precompiled binaries cross platform without wrestling with distros and windows |
03:34:07 | FromDiscord | <Varriount> JBB? |
03:34:21 | shashlick | http://BinaryBuilder.org run by Julia folks |
03:34:37 | shashlick | nimterop can download precompiled binaries from there |
03:34:55 | FromDiscord | <Varriount> Oh, wow. |
03:35:10 | shashlick | see nimarchive and nimgit2 for examples |
03:35:25 | FromDiscord | <Varriount> Where was this when I was struggling to build 64-bit GTK on Windows? |
03:36:34 | FromDiscord | <Varriount> (GTK is all the fun of a project only developed on Linux, combined with the teeth-grinding annoyance of circular dependencies) |
03:37:22 | shashlick | ๐ |
03:37:45 | shashlick | https://github.com/JuliaBinaryWrappers/GTK3_jll.jl/releases |
03:38:31 | leorize | @Varriount if you're on windows then just use msys2-mingw-w64? |
03:39:00 | leorize | if you use their package management system it can even solve deps and bundle all of them up nicely for you |
03:40:21 | FromDiscord | <Varriount> leorize: Sure, I'll just have to travel back in time 8 years |
03:40:52 | shashlick | problem with msys is too many deps |
03:41:06 | shashlick | i would have added nimterop support to download those but ya |
03:41:18 | FromDiscord | <Varriount> Also, https://devblogs.microsoft.com/oldnewthing/20140411-00/?p=1273 |
03:45:31 | shashlick | so @Varriount did you see cExclude()? |
03:48:20 | leorize | @Varriount ? |
03:48:44 | FromDiscord | <Varriount> @shashlick I believe I saw it mentioned in a reecent image. |
03:48:48 | FromDiscord | <Varriount> recent issue |
03:49:00 | leorize | shashlick: jbb's binaries also have deps :P |
03:49:10 | FromDiscord | <Varriount> in the Nimterop repo. I was perusing the issue tracker a couple of hours ago. |
03:56:22 | shashlick | @Varriount i was asking in reference to the python dsl work you did - anyway, looking forward to your feedback |
03:56:43 | shashlick | @leorize - yes but it also depends on msys libraries - forget the names now |
04:05:31 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
04:06:01 | * | supakeen quit (Quit: WeeChat 2.8) |
04:06:46 | * | supakeen joined #nim |
04:38:04 | * | narimiran joined #nim |
04:56:57 | * | maier joined #nim |
05:02:18 | * | maier quit (Ping timeout: 260 seconds) |
05:07:30 | * | maier joined #nim |
05:11:08 | * | vicfred quit (Quit: Leaving) |
05:34:39 | * | rockcavera quit (Remote host closed the connection) |
05:43:02 | * | solitudesf joined #nim |
05:53:47 | FromGitter | <codenoid> hello nim folks, stay alive |
05:53:54 | supakeen | Hi. |
06:02:43 | * | Tlongir quit (Remote host closed the connection) |
06:05:33 | * | Romanson joined #nim |
06:16:49 | * | letto quit (Quit: Konversation terminated!) |
06:18:18 | * | lritter joined #nim |
06:22:35 | * | letto joined #nim |
06:27:58 | * | NimBot joined #nim |
06:32:16 | * | Vladar joined #nim |
06:39:41 | * | PMunch joined #nim |
06:46:38 | FromDiscord | <creatable> `GetWindowThreadProcessId()` does not return the correct process ID and I'm not exactly sure why |
06:48:00 | FromDiscord | <creatable> sent a code paste, see https://play.nim-lang.org/#ix=2ttV |
06:55:25 | PMunch | Sure it's not this you want to do? https://play.nim-lang.org/#ix=2ttY |
06:55:30 | PMunch | Based on your C++ example |
06:58:22 | FromDiscord | <creatable> that is exactly what i want to do :^) |
06:58:30 | FromDiscord | <creatable> nim feels weird to me, i guess i'm too used to python |
06:58:49 | FromDiscord | <creatable> quirks like this is exactly why i'm writing this in the first place, to get used to things |
07:01:14 | FromDiscord | <Varriount> @creatable Well, it's not so much how Nim works, as how C functions work |
07:01:22 | FromDiscord | <mattrb> Hey! I'm pretty new to Nim. How can I make the compiler happy here? https://play.nim-lang.org/ |
07:01:41 | FromDiscord | <creatable> yeah, i lack experience in things outside of python and js to be honest |
07:01:55 | FromDiscord | <Varriount> @mattrb That's a blank link |
07:01:59 | FromDiscord | <creatable> it'd probably be better to learn c / cpp first, but this is the easy route lol |
07:02:16 | FromDiscord | <mattrb> Lol https://play.nim-lang.org/#ix=2tu1 |
07:02:18 | FromDiscord | <mattrb> Whoops |
07:02:34 | FromDiscord | <mattrb> I'm also new to sharing links apparently |
07:02:53 | FromDiscord | <Varriount> What error are you getting? |
07:04:31 | FromDiscord | <creatable> that worked :D |
07:04:47 | FromDiscord | <mattrb> Sorry, I phrased my question poorly. The error message says to replace `addr` with `unsafeAddr`, but I'm more just wondering what the semantic difference is |
07:05:21 | PMunch | Ah |
07:06:04 | FromDiscord | <mattrb> I see the different description in the docs here https://nim-lang.org/docs/system.htmlโตWhat makes these fundamentally different to deserve a different method? |
07:06:04 | FromDiscord | <Varriount> @mattrb In Nim, parameters aren't guaranteed to have an address |
07:06:38 | FromDiscord | <Varriount> Or rather, a writeable |
07:06:48 | FromDiscord | <Varriount> writeable address |
07:06:55 | PMunch | What you're getting in is an array. This means that it will be a copy of the data in the array (or a pointer if Nim optimises it). When you use addr Nim complains because it can't really guarantee that you get the address you probably think you want and so tells you to use unsafeAddr to make sure that you know what you're doing. |
07:07:47 | FromDiscord | <Varriount> @PMunch it's because the array is a parameter. `addr` requires a var type |
07:08:35 | FromDiscord | <mattrb> I mean the address for the parameter is just somewhere on the stack, right? |
07:08:39 | PMunch | If you change your code to take a "buffer: var FrameBuffer" argument then `addr` will work fine and it will point to the address of the buffer that was passed in. As it is now `buffer.unsafeAddr` can either point to the passed in buffer, or to a copy of it in your local scope, a bit depending on how Nim chooses to optimise. |
07:08:51 | PMunch | Varriount, yes that was I was trying to explain :P |
07:09:17 | FromDiscord | <Varriount> @mattrb It could also be in static (read-only) global memory. |
07:10:22 | FromDiscord | <mattrb> Ahh, gotcha I think. So the issue is just that it's not writable, and adding `var` in the parameter type would allow that to work if I wanted it to be writable. Since I don't want it to be writable and I know where I'm allocating the buffer, then `unsafeAddr` is probably just what I want |
07:10:36 | PMunch | As it is now you could even pass it a "const" buffer which would create a copy, edit the data, and then promply delete it again :P |
07:10:50 | FromDiscord | <Varriount> @mattrb Yes. |
07:10:50 | PMunch | Correct |
07:10:53 | FromDiscord | <mattrb> I normally use high level languages, and when I use c/asm I just completely abuse pointers until it works with no care to what I'm doing :p |
07:10:56 | FromDiscord | <mattrb> Thank you both ๐ |
07:11:36 | PMunch | Haha, sounds familiar. Nim feels like a high level language, but when you get down into the nitty gritty things like this you realise that you're closer to C than you might think |
07:12:37 | FromDiscord | <Varriount> @mattrb If the C code you are calling tries to write to static memory (in the case of a constant) the program will crash. |
07:13:06 | PMunch | However Nim has a proper type system which can help you tell the difference between straight up abuse and clever tricks :) |
07:13:06 | FromDiscord | <mattrb> Good to know! |
07:13:27 | FromDiscord | <mattrb> Just case everything as a void , duh |
07:13:43 | PMunch | Yeah.. That's not something you would do in native Nim code :P |
07:14:11 | FromDiscord | <Varriount> @mattrb If the C code tries to write to memory that a `let` variable has allocated, or a parameter, your program might crash, or unexpected behavior might occur |
07:14:17 | FromDiscord | <mattrb> I know x64 _pretty_ well, but have almost no knowledge of C. My C typically just reflects my x64 lmao |
07:14:36 | FromDiscord | <mattrb> @Varriount Also good to know! Thanks for the tips |
07:15:26 | FromDiscord | <Varriount> The "unexpected behavior" part is because the compiler makes certain assumptions about `let` variables. |
07:16:40 | FromDiscord | <Varriount> Normally it's able to ensure these assumptions are correct when compiling the program, but unsafeAddr is... unsafe |
07:16:43 | PMunch | I wrote some code for the Arduboy, a small Arduino powered GameBoy thingy. The C++ code it ran would load sprites into a void pointer and then draw things by passing a void pointer and dimensions. In my Nim wrapper I wrote a loading macro that on compile-time read the image files and encoded them as an array, giving them a generic type with height/width information. Now I could just call sprite.draw and it would already know the dimensions of the sprite |
07:16:43 | PMunch | (because the compiler remembered it) and it would ensure that e.g. a mask that had to be the same size would actually be the same size. This was all done without adding a single byte of runtime instructions as it was purely a type thing :) |
07:17:53 | * | opi joined #nim |
07:18:19 | FromDiscord | <mattrb> I've been working on this for awhile, but Crystal currently has _no_ reliable compilation with emscripten. I've been curious about Nim for awhile, and figured effectively rewriting this in Nim would allow me to learn a new language, as well as target a browser which would be nice ๐ https://github.com/mattrberry/CryBoy https://media.discordapp.net/attachments/371759389889003532/741193486052884560/unknown.png |
07:18:40 | FromDiscord | <mattrb> (edit) "I've been working on this for awhile, but Crystal currently has _no_ reliable compilation with emscripten. I've been curious about Nim for awhile, and figured effectively rewriting this in Nim would allow me to learn a new language, as well as target a browser which would be nice ๐ https://github.com/mattrberry/CryBoy ... https://media.discordapp.net/attachments/371759389889003532/741193486052884560/unknown.png" added "So fa |
07:19:25 | FromDiscord | <mattrb> That's funny that you mentioned Arduboy. I didn't see your message before I sent my own haha |
07:23:58 | PMunch | Haha, Nim is a good fit for this kind of stuff so I'm not surprised more people are trying it out for it :) |
07:25:12 | FromDiscord | <Ricky Spanish> been at nim for about 1 week now, loving that it more or less just takes what im used to in c/c++ and lets me re-do it in a simple safer way tbh, regret trying so many other things at the moment |
07:27:26 | PMunch | It's great :) I came from a background with mostly C and Python with some sprinkling of other things like Java and Clojure. Nim lets me do all the stuff I could do in C, but with an elegance that beats anything else I've tried |
07:28:29 | Zevv | But, did you do your CPS today?! |
07:28:44 | Zevv | because you know what they say: never skip CPS day! |
07:29:48 | FromDiscord | <mattrb> @PMunch Well I'm excited to try it out, and I'm sure I'll be back here to ask plenty more questions ๐ |
07:31:06 | PMunch | Zevv, haha :P I'm still using closure iterators for my coroutine needs :) |
07:31:17 | Zevv | you are sooo lmae |
07:32:03 | Zevv | we give you all the power in the world, we put a fision reactor in your basement, and here you are putting coal in your little stove |
07:32:11 | Zevv | duuude |
07:32:44 | FromDiscord | <Ricky Spanish> where is android support at? i seen hello world example but no activity generated example? is it do-able without java...or nimpossible at the moment? sorry had to say it |
07:33:09 | Zevv | well, if you want to do UI's in Android, you need to be doing Java. If you want access to 95% of the API's in android, you need Java |
07:33:36 | PMunch | Well, the fision reactor you put in the basement is so complicated to use! I've been heating my house with my coal stove for weeks now not freezing to death while you're over there pouring over the manual to get your fision reactor started properly! |
07:33:43 | Zevv | so that makes it kind of hard for other ecosystems to jump in. It's possible to make basic apps using OpenGL for example, but you're pretty restricted |
07:34:21 | Zevv | PMunch: fine with me, we'll put up a considerate smile and wave through the back window when we come speeding by you in some time! |
07:34:45 | Zevv | joking aside, it seems that things are slowly getting in a fairly usable state |
07:35:26 | Zevv | I can now built basic stuff like iterators, coroutines, exception handling, gotos and async |
07:35:30 | Zevv | which actually works |
07:35:32 | FromDiscord | <Yardanico> @Ricky Spanish it's possible but not easy |
07:35:32 | PMunch | Cool, I'm really curious to see what comes of it! When I went on vacation you seemed to know where you where going with it, but struggled with some technical issues |
07:35:51 | FromDiscord | <Yardanico> See https://github.com/yglukhov/jnim |
07:35:54 | PMunch | Oh wow, you've gotten quite far then :) |
07:36:02 | FromDiscord | <Ricky Spanish> maybe could wrap something like this? https://github.com/AshampooSystems/boden/ |
07:36:13 | Zevv | yeah there's still some. Problem is that I kind of lost contact with the code when disruptek got going, and I can't make sense of it anymore. So now I'm basically just kicking him to do this and that and such. But that works out quite well :) |
07:36:40 | PMunch | Haha, yeah reading other peoples code is always a challenge! |
07:36:58 | FromDiscord | <Yardanico> And https://github.com/yglukhov/android |
07:37:04 | Zevv | well, it is already quite complicated. I got stuk and tried a few more times but couldn't get there, while in the mean time disruptek _was_ able to |
07:37:18 | Zevv | so he's clearly smarter and more persistent then I am |
07:37:26 | PMunch | Oooh, that boden thing actually looks really interesting @Ricky Spanish |
07:37:32 | Zevv | anwya, if you're interested: this is a total standalone example: https://github.com/disruptek/cps/blob/master/stash/echo_server_client.nim |
07:37:59 | PMunch | He might've just gotten lucky ;) |
07:38:04 | Zevv | has 3 parts: basic event queue implementation, then some socket glue to hide the POSIX stuff, and then the 'main' program which is a tcp echo server with 100 clients doing 20k echo/replies |
07:38:08 | Zevv | and a little timer |
07:38:31 | Zevv | The interesting stuff starts at line 141, that is the "user part" |
07:39:25 | FromDiscord | <Varriount> @Ricky Spanish Try Nimterop |
07:39:27 | Zevv | and here is a little iterator implementation, the "user part" starts from line 37, above that is implementation of the iterator itself: https://github.com/disruptek/cps/blob/master/stash/iterator.nim |
07:40:14 | FromDiscord | <Ricky Spanish> @Varriount yeh will give it a test later today, the main issue might be the pre-requisites but i guess android devleopers are gonna expect some pre-reqs before being able to use it from nim |
07:41:02 | FromDiscord | <Varriount> @mattrb @creatable My first programming language was Python. I love it dearly, but was really glad when type annotations were introduced to the language. |
07:41:41 | FromDiscord | <Varriount> I find Nim to have a lot of the flexibility of Python (at least at compile time). |
07:43:48 | Zevv | and PMunch: you can have async I/O on your little arduinos |
07:44:01 | PMunch | That would actually be really cool! |
07:44:06 | Zevv | how cool is that right |
07:46:23 | FromDiscord | <mattrb> @Varriount `mypy --strict` or bust |
07:48:53 | FromDiscord | <Varriount> @mattrb I actually exchanged some messages with Jukka (the guy who started mypy) back when it was just starting out. |
07:49:25 | FromDiscord | <Varriount> Did you know the original intent for it was to be an optimizing compiler? Like Nuitka, Cython, etc. |
07:50:51 | supakeen | Haha, it's funny, I used to talk to the person who took that original intent and turned that into mypyc. |
07:51:00 | supakeen | Which is exactly that :) |
07:51:29 | FromDiscord | <Varriount> supakeen: Hm, I thought that was still a prototype? Or maybe I'm thinking of something else. |
07:51:46 | PMunch | Zevv, that is very cool |
07:51:59 | FromDiscord | <Varriount> So it went `compiler -> type checker -> compiler` |
07:52:23 | FromDiscord | <Varriount> Which I guess isn't all the unexpected, considering a compiler would have to do type checking anyway. |
07:52:30 | supakeen | Varriant: very much is, yes, I believe it supports a subset of Python for C compilation which is hinted by the types. |
07:52:32 | supakeen | Yea. |
07:52:59 | supakeen | Seems like mypyc got merged into mypy: https://github.com/python/mypy/tree/master/mypyc |
07:53:19 | FromDiscord | <Varriount> supakeen: I tend to recommend Nuitka for "compiling" Python, as its worked well for me as a packaging tool. |
07:53:56 | supakeen | Currently I mostly write C when I need to go fast (with CFFI) but I've been doing the Nimpy thing as well :) |
07:54:08 | FromDiscord | <Varriount> (although the compile time is quite terrible) |
07:54:43 | FromDiscord | <Varriount> supakeen: I don't need performance, so much as a decent way to distribute code onto systems. |
07:54:57 | PMunch | @Ricky Spanish, boden looks cool, but it still doesn't 100% solve your problem. If you want to use e.g. the locations API or other Android specific APIs then you are likely to have to write some Java glue code. |
07:55:12 | supakeen | Varriount: Ah, for that I have used pyinstaller in the past which worked well for my usecase. |
07:55:45 | PMunch | I just switched to Nim, much easier |
07:56:00 | PMunch | Distributing Python is such a pain in the ass.. |
07:56:05 | FromDiscord | <Varriount> supakeen: Nuitka is good if you're working in a commercial environment. |
07:56:45 | supakeen | I will check it out. |
07:56:59 | FromDiscord | <Varriount> You get obfuscation for free, since it translates Python to the equivalent C code that uses the CPython extension API. |
07:57:06 | supakeen | PMunch: There's the rest of the team to deal with and the stability of software/libraries for now our rule is that we use Nim when we can rewrite it very quickly in another language. |
07:57:25 | supakeen | But we do run quite a bit in production now :) |
07:57:31 | FromDiscord | <Varriount> supakeen: Other tools typically just embed the bytecode or source code within an executable |
07:58:07 | FromDiscord | <Ricky Spanish> @PMunch im more or less ok without many of the api's, i guess its really down to what things i cant do such as permissions etc since most apps will need storage and itnernet access, im gonna give it a try worst case its a waste of some time |
07:58:24 | * | oddp joined #nim |
07:58:25 | supakeen | Since I'm a reverse engineer half of the time I don't particularly care about the obfuscation factor an ELF binary supposedly provides. |
07:59:15 | PMunch | supakeen, oh cool. I was lucky enough to be left to my own devices on the last project. So I just rewrote the entire thing in Nim, contributed a PR to the project we were integrating with to support loading dynamic libraries instead of just Python, and just told everyone that I had made the project much faster :P |
07:59:17 | supakeen | In fact there's probably less people out there that know how to go from pyinstaller -> bytecode -> python than from ELF binary. |
07:59:31 | FromDiscord | <Varriount> supakeen: Heh. Well, it's another layer to put off curious eyes. Nuitka wouldn't stop a dedicated effort. But then again, what would? |
07:59:53 | supakeen | PMunch: We run a looot of VMs so it's neat whenever we can save the overhead of the Python vm for especially smaller services that run on them. |
07:59:54 | FromDiscord | <Ricky Spanish> python distribution was kinda ok until 2.7 and then came the big boy breaking changes, execute error 66 - print now uses curlys |
07:59:57 | supakeen | And Nim has been a *great* fit for that. |
08:00:16 | FromDiscord | <Varriount> supakeen: Could be worse, you could be dealing with the overhead of the JVM |
08:00:18 | PMunch | @Ricky Spanish, I think permissions are just requested through the manifest XML (at least it was last time I used Android..) |
08:00:25 | supakeen | Haha yes, Varriount. |
08:00:34 | PMunch | s/used Android/wrote Android apps |
08:01:04 | FromDiscord | <Ricky Spanish> @PMunch yeh but iv seen now in dart for example, and some java examples you can request the permissions in code too specific to the task not just before install....not sure if its a requirement or what but seen some samples |
08:01:06 | FromDiscord | <Varriount> supakeen: I wouldn't mind doing reverse engineering, though looking at assembly for prolonged periods does tend to make my eyes water. |
08:01:50 | supakeen | Yea really it's not special, it's another job and probably even less creative than programming. |
08:02:07 | supakeen | It's a lot of notetaking, mental map building, and experience. |
08:02:20 | FromDiscord | <Varriount> supakeen: For example, I once tried following how the C compiler ran a Nim closure. I had to give up on that one. It would probably be easier with the appropriate tools. |
08:02:34 | FromDiscord | <Varriount> compiled a Nim closure |
08:02:39 | PMunch | @Ricky Spanish, ah yes, you can request extra permissions after the app has been installed. I think that's only meant for someone enabling a feature after installing, e.g. Snapchat with their map feature will ask you to enable location permissions if you try to use it. |
08:02:43 | supakeen | Hah, I haven't taken a look at Nim-stuff yet from that angle. |
08:02:45 | supakeen | I should. |
08:04:04 | FromDiscord | <Varriount> supakeen: The C code is fairly straightforward, but I think there's some interaction with the C compiler's optimizer that confuses things. |
08:04:23 | FromDiscord | <Varriount> (and complicates the emitted assembly) |
08:05:23 | supakeen | Oh yea, there's plenty of weird stuff that optimizing compilers do like multiplication with constants to do certain things which looks *nothing* like what you'd expect until you realize 'oh so thats how it does modulus on arm'. |
08:26:34 | FromDiscord | <--HA--> is there an advantage in code size of the binary or for the compile time or anything if I do specific imports like `from os import joinPath` instead of just importing the whole module? |
08:32:14 | FromDiscord | <Yardanico> No |
08:32:26 | FromDiscord | <Yardanico> Nim always has dead code elimination enabled for all modules |
08:32:37 | FromDiscord | <Yardanico> Regardless if it's debug or release |
08:34:32 | FromDiscord | <--HA--> Awesome |
08:36:13 | FromDiscord | <Yardanico> about compile-time - I don't think it would change either |
08:38:37 | FromDiscord | <--HA--> This is probably a bit of a broad question with no one simple answer but I often wonder when it makes sense to assign something to a variable. If for example I use a result of a proc twice relativly close to each other. Will the compiler figure that out for me or should I assign the result to a variable so the work is not done twice? |
08:39:09 | FromDiscord | <Yardanico> compiler will probably not figure it out since that proc can have side effects and stuff |
08:42:23 | * | superbia1 is now known as superbia |
08:43:15 | FromDiscord | <--HA--> sent a code paste, see https://play.nim-lang.org/#ix=2tug |
08:43:15 | superbia | is nim code easier to decompile than let's say some code written in c/c++ |
08:43:25 | Yardanico | no |
08:43:40 | Yardanico | it's still fully native |
08:43:48 | superbia | assuming you know, that it was a nim in the beginning |
08:43:56 | Yardanico | well with refc there's RTTI |
08:44:01 | Yardanico | but with arc/orc there's no RTTI |
08:44:14 | Yardanico | only some metadata for methods (when using with object inheritance) |
08:44:21 | Yardanico | but you'll only get names of the objects this way, nothing more really |
08:44:42 | Yardanico | It's probably not very hard to detect nim binaries specifically |
08:44:46 | FromDiscord | <Elegant Beef> for all intents and purposes it's C/C++ compiled |
08:44:51 | superbia | but it would generate a cleaner decompiled source, right? |
08:44:56 | Yardanico | why? |
08:45:13 | Yardanico | it's still compiled to a real binary |
08:45:17 | Yardanico | no VMs, no JITs, nothing |
08:45:52 | superbia | so you never tried decompiling real binary into c? |
08:45:56 | Yardanico | i tried |
08:46:03 | Yardanico | and nim binary output isn't "cleaner" |
08:46:15 | Yardanico | in fact it might be harder to understand than "idiomatic" C compiled to binary |
08:46:26 | Yardanico | not sure why do you ask such questions if you have a lot of experience in reverse-engineering :) |
08:46:30 | Yardanico | why would a nim binary be easier to decompile |
08:46:48 | Yardanico | if you compile in -d:danger there are no checks, no stacktraces, nothing |
08:47:36 | Yardanico | there still will be exception messages, yes, but again - you won't figure out a lot with them |
08:47:54 | superbia | you are right |
08:50:53 | * | waleee-cl joined #nim |
08:51:25 | * | Vladar quit (Remote host closed the connection) |
08:52:09 | FromDiscord | <--HA--> What is the recommended regex module to use? I saw re and nre. I want to do a simple replace of multiple spaces with only one. I dont specifically need regex if there is a better way. In ruby I would have done something like `"a b".gsub(/ +/, ' ')` |
08:52:35 | Yardanico | mystr.split().join(" ") |
08:52:38 | Yardanico | import strutilsd |
08:52:40 | Yardanico | strutils* |
08:52:55 | Yardanico | !eval import strutils; echo "a b c d".split().join(" ") |
08:52:57 | NimBot | a b c d |
08:53:05 | Yardanico | wait one sec |
08:53:16 | * | Romanson quit (Quit: Connection closed for inactivity) |
08:53:38 | Yardanico | ah well you can also use mapIt here |
08:53:56 | Yardanico | !eval import strutils, sequtils; echo "a b c d".split().mapIt(it.strip()).join(" ") |
08:53:59 | NimBot | a b c d |
08:54:03 | Yardanico | lol |
08:54:22 | Yardanico | weird |
08:54:30 | Yardanico | ohh I see |
08:54:58 | schurig | what exactly is a typedesc? E.g., when will proc `of`[T, S](x: typedesc[T]; y: typedesc[S]) called over proc `of`[T, S](x: T; y: S) ?? |
08:55:07 | Yardanico | !eval import strutils, sequtils; echo "a b c d da s".split().filterIt(it != "").join(" ") |
08:55:10 | NimBot | a b c d da s |
08:55:31 | Yardanico | schurig: https://nim-lang.org/docs/manual.html#special-types-typedesc-t |
08:56:09 | FromDiscord | <--HA--> Thanks Yardanico |
08:56:16 | Yardanico | schurig: in your case it's two different signatures |
08:56:30 | Yardanico | the first one accepts "types" themselves, the second one accepts the values of the types |
08:56:56 | Yardanico | in nim typedesc is a type to represent types at compile-time |
08:57:50 | schurig | ah, thanks. I think I'll add a link from doc/html/system.html#typedesc to this, because the description in system.html of "Meta type to denote a type description" doesn't explain anything (to me) |
08:58:12 | FromDiscord | <Recruit_main707> @creatable they already helped you right? |
08:58:21 | Yardanico | schurig: well I think that would be a bit of an overkill |
08:58:32 | Yardanico | because you could as well add other links to all of the system :P |
08:58:35 | Yardanico | but that'd be too much |
09:01:05 | * | ee7[m] quit (Quit: Idle for 30+ days) |
09:01:25 | FromDiscord | <creatable> @Recruit_main707 yep! if I have any other issues I'll mention you though |
09:05:58 | * | synthmeat quit (Quit: WeeChat 2.9) |
09:07:41 | * | synthmeat joined #nim |
09:22:08 | FromDiscord | <Recruit_main707> Ok, if you are coming from python you might have some problems understanding pointers and references at first, but if you read the docs a bit you wont have any issue |
09:33:49 | FromDiscord | <--HA--> Turns out I need regex after all. What is the difference between `re` and `nre` modules? |
09:34:01 | Yardanico | can you try https://github.com/nitely/nim-regex first? |
09:34:06 | Yardanico | it's a pure-nim regex :) |
09:34:14 | Yardanico | if you don't need the most performance it's the better choice |
09:34:22 | Yardanico | re and nre modules use PCRE |
09:34:57 | FromDiscord | <--HA--> I don't need special performance. I'll try it out |
09:36:47 | FromGitter | <jivank> Are there any task queues like python's huey for nim? https://huey.readthedocs.io/en/latest/ |
09:36:59 | FromGitter | <jivank> I did find this: https://github.com/jackhftang/taskqueue.nim but its not clear if it runs in another thread |
09:38:05 | alehander92 | ะดะฝะฝ |
09:38:08 | alehander92 | ops, sorry |
09:38:11 | Yardanico | alehander92: ะดะฝะฝ :P |
09:38:14 | alehander92 | hahahaha |
09:38:16 | Yardanico | lyy |
09:38:19 | alehander92 | i tried to write okk |
09:38:26 | Yardanico | oh you don't have a russian layout right |
09:38:28 | alehander92 | but in our layout it is mapped to that |
09:38:30 | alehander92 | oh no |
09:38:50 | Yardanico | in russian layout ะด is under l, ะฝ is under y |
09:38:53 | alehander92 | it's called ะะะก it seems it was designed for our language to be more productive |
09:39:00 | alehander92 | a lot of people use latin |
09:39:03 | alehander92 | like phonetic* |
09:39:19 | alehander92 | it's cyrillic but mapped e.g. ะณ g ะฟ p |
09:39:24 | alehander92 | to similar sounds |
09:41:30 | Yardanico | 4rak on a holiday - almost no activity in nim github :PP |
09:43:51 | superbia | i thought mr stale bot is pretty active |
09:44:07 | Yardanico | yeah that person seems to be pretty active |
09:44:10 | Yardanico | looking through old nim issues |
09:50:04 | alehander92 | good thing we got pmunch back |
09:54:02 | * | apahl_ quit (Ping timeout: 244 seconds) |
09:55:23 | * | apahl joined #nim |
09:56:52 | * | moerm joined #nim |
09:57:08 | moerm | Hello everyone |
09:58:37 | Zevv | hello moerm |
09:59:39 | FromDiscord | <Yardanico> Hello IRC |
10:01:12 | alehander92 | hello Yardanico |
10:02:12 | alehander92 | ok, so moerm |
10:06:23 | moerm | alehander92 Was that a hello or the entry to a question or remark? |
10:07:00 | * | azed joined #nim |
10:13:19 | * | Trustable joined #nim |
10:13:26 | alehander92 | what do you think about `A@Kind` for variants |
10:13:28 | alehander92 | type syntax |
10:15:05 | alehander92 | basically flow typing for variant discriminators |
10:15:09 | alehander92 | i planned onw riting a rfc |
10:15:38 | alehander92 | but you are pretty into this kind of thing, so it would be cool to hear your feedback |
10:16:01 | Zevv | uuuuglyyyy |
10:16:04 | alehander92 | (the point is to generalize the planned isNil checking mechanism for that` |
10:16:18 | Zevv | oh I was not asked, right? :) |
10:16:19 | alehander92 | i mean the syntax doesn't matter to me it can be `A{kind}` i forgot |
10:16:29 | alehander92 | there was a discussion whichi have to find |
10:16:56 | alehander92 | but i have a rails interview soonish .. i have to read a bit about sql again |
10:17:05 | alehander92 | i keep forgetting what exactly a join is man |
10:17:44 | moerm | alehandler to be honest, a) I'm not a fan of new features but rather of getting rock solid what we have first |
10:18:32 | moerm | b) my input means little, the person to ask is @Araq, and c) please ask more precisely |
10:20:19 | moerm | (my narrow small mind needs precise questions *g) |
10:20:30 | FromDiscord | <kodkuce> this http3, hmm does it separate GET,POST requests from socket ones so GET POST stay reliable ? |
10:20:34 | Yardanico | well alehander92 had an RFC no? |
10:21:10 | moerm | If he provides a link to it I will look into it of course |
10:21:53 | alehander92 | i don't have a rfc yet, i am a bit lazy |
10:22:13 | alehander92 | ok, when i right it down i'll send it, to have an example |
10:22:33 | Yardanico | well it's kinda hard to understand what you mean without context :) |
10:22:39 | Yardanico | so yeah, with an RFC it'll bere better |
10:23:02 | moerm | I'll also gladly tell you my view if the question is narrow enough and preferably verification/analysis related |
10:23:16 | FromDiscord | <Varriount> Alehander92: When thinking of JOINs, think of a Venn diagram |
10:24:17 | FromDiscord | <Varriount> Yardanico: If you know of any new or updated standard-library bugfix PRs, I'll be happy to review and/or merge them |
10:24:30 | Yardanico | nah don't worry :P |
10:25:04 | FromDiscord | <Varriount> Unfortunately 4raq is the only one that approves compiler PRs |
10:25:23 | moerm | "Unfortunately"?? |
10:25:36 | Yardanico | moerm: well he's on holiday rn :) |
10:26:16 | alehander92 | yeah we could've added some {} |
10:26:18 | alehander92 | until now man |
10:26:20 | moerm | Yardanico, So Nim can't change in its core for some weeks? |
10:26:29 | Yardanico | moerm: it can, 4raq comes online sometimes :) |
10:26:35 | moerm | Tragedy!!! |
10:26:47 | moerm | OK, so not really a tragedy ;) |
10:26:51 | FromDiscord | <Varriount> Just work on standard library improvements |
10:27:12 | FromDiscord | <Varriount> Goodness knows we need more of them |
10:27:34 | FromDiscord | <Varriount> Well, improvements in documentation, to be precise |
10:27:59 | moerm | ... the classical problem ... |
10:31:26 | alehander92 | yardanico thanks, the visual joins did help a lot |
10:31:37 | Yardanico | ? |
10:31:38 | alehander92 | now i need to read a bit on cool stuff db-s do |
10:31:49 | alehander92 | oh sorry, thanks to Varriount * |
10:32:14 | * | pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
10:32:52 | * | pbb joined #nim |
10:33:25 | moerm | Does anyone know *where* Araq spends his holiday and when he'll be back? |
10:33:40 | Yardanico | he's still online in IRC btw :) |
10:33:51 | Yardanico | around 2 weeks |
10:35:08 | moerm | Thanks (Oh, it's nothing particular just general interest) |
10:36:27 | FromDiscord | <Varriount> moerm: He's taking a vacation on Earth |
10:42:02 | moerm | Varriount What a cunning guy to choose the one place where nobody expects him to be! |
10:42:25 | alehander92 | :) |
10:44:52 | * | clyybber joined #nim |
10:44:59 | Yardanico | wow clyybber on irc |
10:46:50 | clyybber | discod forced update forced me |
10:47:07 | Yardanico | welcome to boomers' zone |
10:47:19 | clyybber | moerm: I guess somewhere in germany, because of corona |
10:47:25 | clyybber | Yardanico: lol |
10:48:21 | moerm | clyybber, Thank you, but it was just general interest. I hope he can relax and have some fun (other than Nim) |
10:48:59 | * | clyybber quit (Client Quit) |
10:49:15 | * | clyybber joined #nim |
10:53:53 | * | clyybber quit (Client Quit) |
10:54:26 | moerm | That poor guy (clyybber) seems to have connectivity problems |
10:54:34 | Yardanico | hehe |
10:54:47 | FromDiscord | <Recruit_main707> Should have stayed in discord :p |
10:54:48 | superbia | (Client Quit) != connectivity problem |
10:54:53 | Yardanico | @Recruit no |
10:54:56 | Yardanico | discord is pretty bad |
10:55:00 | superbia | discord is shit |
10:55:03 | Yardanico | imagine no color support |
10:55:16 | FromDiscord | <Recruit_main707> (Images) |
10:55:21 | Yardanico | absolute ,08blasphemy |
10:55:31 | Yardanico | there are IRC clients with image previews and other stuff |
10:55:37 | Yardanico | it doesn't have to be server-side |
10:55:56 | FromDiscord | <Recruit_main707> Tbh if the new ts client has images, im all in for it |
10:56:12 | Yardanico | Mumble exists for voice chat |
10:56:20 | FromDiscord | <Recruit_main707> But discord currently rules the monopoly |
10:56:42 | Yardanico | because GaMeRs !1111 |
10:56:44 | moerm | Clueless me simply took the first simple client ('hexchat') and it seems to work fine |
10:57:36 | moerm | (I'm wondering a bit though why "we" chose discord ...) |
10:59:37 | Yardanico | "we" didn't |
10:59:40 | Yardanico | it's just getting popularized |
10:59:44 | Yardanico | and people use it out of convenience |
10:59:52 | Yardanico | I created the nim discord server in 2017 but I didn't use it |
11:00:01 | Yardanico | and really not a lot of people used it until ~2019 |
11:00:10 | moerm | Hmmm |
11:00:31 | moerm | I don't care much anyway, as long as the thing works |
11:00:35 | Yardanico | https://forum.nim-lang.org/t/3272 |
11:00:49 | * | maier quit (Ping timeout: 264 seconds) |
11:00:55 | Yardanico | my old account |
11:01:00 | Yardanico | (you can't change nickname on nimforum) |
11:01:38 | FromDiscord | <lqdev> 404 not found |
11:01:43 | Yardanico | ? |
11:01:51 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/741249740347408435/unknown.png |
11:01:56 | moerm | Yardanico, So you called yourself 'Tiberium' back then? I'm a C&C fan too, one of the *very few* games I play at all |
11:02:11 | Yardanico | moerm: yes, my old nickname(s) were Tiberium/Tiberiumk |
11:02:16 | Yardanico | I've used them in quite a lot of places |
11:02:57 | Yardanico | I had to create a new reddit accouint as well :) |
11:04:07 | moerm | I am 'moerm' * spilling the beans |
11:04:17 | FromDiscord | <kodkuce> @treeform would it be bad to just use |Sec-WebSocket-Protocol| for my auth header, example for protocol i can put [ default, myauthheader ] and then just hack you ws.nim to just alwies return protocol 0 , cuz from what i see RFC6455 i just need to return 1 of protocols, so i allwies return just protocolo[0] in my case default |
11:05:17 | moerm | (desaster in creation ...) |
11:07:32 | FromDiscord | <kodkuce> that reply to me ? |
11:07:49 | * | maier joined #nim |
11:07:52 | FromDiscord | <kodkuce> (edit) @treeform would it be bad to just use |Sec-WebSocket-Protocol| for my auth header, example for protocol i can put [ default, myauthheader ] and then just hack you ws.nim to just alwies return protocol[0] , cuz from what i see RFC6455 i just need to return 1 of protocols, so i allwies return just protocolo[0] in my case default |
11:08:20 | FromDiscord | <kodkuce> i gona try |
11:08:26 | moerm | kodkuce Yes, it is |
11:08:46 | moerm | But more a remark than a reply |
11:09:20 | FromDiscord | <kodkuce> why you think that will now work or be not secure? |
11:10:22 | * | oriba joined #nim |
11:10:44 | moerm | Oh, it might somehow work, at least in one well defined context. As for the "why": Lots of experience |
11:11:55 | FromDiscord | <kodkuce> i am just missusing a header field for my doings cuz i am not allowed to send custom headers |
11:12:15 | * | maier quit (Read error: Connection reset by peer) |
11:12:50 | * | maier joined #nim |
11:12:53 | moerm | Do as every you feel like. My remark was just that, a remark |
11:17:43 | * | maier_ joined #nim |
11:17:47 | * | Guest53507 quit (Ping timeout: 240 seconds) |
11:18:00 | FromDiscord | <kodkuce> i will, i just tough you have some magic insight of how i am shooting myself in foot ๐ |
11:18:02 | * | maier quit (Ping timeout: 265 seconds) |
11:23:21 | * | opi quit (Ping timeout: 265 seconds) |
11:26:11 | moerm | '_This section is non-normative._' sounds like really good stuff ... |
11:31:59 | PMunch | moerm, I'm also using HexChat, it's a pretty good one |
11:32:18 | PMunch | Certainly some features I'd like to see, but all in all it's pretty good |
11:34:15 | moerm | PMunch I don't know much about chat clients. Hexchat allows me to talk to you and that's all I need and expect. |
11:34:29 | moerm | (I'm chatting almost only here) |
11:34:58 | * | arecacea1 quit (Remote host closed the connection) |
11:35:44 | PMunch | That's what I like about IRC, just join the correct channel and start typing |
11:35:47 | PMunch | No frills |
11:36:42 | moerm | Yep. There's already more than enough fat bloated shi^H^H^H software out there ... |
11:36:47 | PMunch | And since you can choose your own client you can get one that doesn't have tons of whitespace and massive font size |
11:37:25 | * | arecacea1 joined #nim |
11:37:25 | PMunch | Like right now I can see messages as far back as 12:17 in this channel |
11:39:33 | moerm | Yes, having a little history is nice |
11:50:14 | moerm | Have a nice day everyone |
11:50:29 | * | moerm quit (Quit: Leaving) |
11:59:46 | * | opi joined #nim |
12:02:11 | FromDiscord | <Recruit_main707> thx, u too |
12:04:44 | FromDiscord | <Recruit_main707> You know what would be cool? Having a c2nim website to create the wrappers online |
12:04:55 | Yardanico | why? |
12:05:04 | Yardanico | you still need a computer |
12:05:07 | Yardanico | with an IDE |
12:05:10 | Yardanico | for manual changes and stuff |
12:05:47 | FromDiscord | <Recruit_main707> Depends on the size of what you want to wrap/transpile |
12:05:56 | Yardanico | still don't see a purpose in it :) |
12:06:01 | FromDiscord | <Recruit_main707> I woulsnt use it for large projects obv |
12:06:01 | * | supakeen quit (Quit: WeeChat 2.8) |
12:06:42 | * | supakeen joined #nim |
12:07:01 | FromDiscord | <Recruit_main707> If you want to do it for a small function or just a few, it would be easier to do it in a web than on your pc directly |
12:07:18 | FromDiscord | <Recruit_main707> (imo) |
12:07:26 | Yardanico | why? |
12:07:33 | Yardanico | you can install c2nim via nimble |
12:07:44 | Yardanico | i really don't understand the convenience in this case |
12:07:49 | Yardanico | you'll still need to copy it in your project |
12:07:53 | Yardanico | so you'll use an editor |
12:08:13 | FromDiscord | <Recruit_main707> To simplify things a bit |
12:08:24 | Yardanico | okay, but I don't get it at all :) |
12:08:36 | Yardanico | I don't see a simplification where you will have to use a whole browser to do such simple thin gs |
12:10:04 | * | dulsi_ joined #nim |
12:10:12 | FromDiscord | <lqdev> objectively, typing a command into a terminal is much quicker than having to open a website, select a file, and then download a file to the correct location. |
12:11:48 | * | oriba left #nim ("https://quassel-irc.org - Chat comfortably. Anywhere.") |
12:12:25 | * | dulsi quit (Ping timeout: 240 seconds) |
12:14:57 | Zevv | ssst don't tell that stuff to others. That's the only reason I still can stay ahead of the new kids these days. |
12:19:14 | FromDiscord | <lqdev> meanwhile your terminal can't display ๐ต because you're staying "ahead" with an ASCII-only font :) |
12:19:42 | FromDiscord | <lqdev> Yardanico please tell me your bridge supports emojis |
12:19:46 | Yardanico | ehm |
12:19:49 | Yardanico | why would it not |
12:19:54 | Yardanico | I don't handle UTF-8 in any specific way |
12:20:04 | Yardanico | it just works |
12:20:08 | FromDiscord | <lqdev> idk, discord uses special syntax for that |
12:20:15 | Yardanico | no |
12:20:17 | Yardanico | only for discord emotes |
12:20:25 | Yardanico | and for that I convert the ID to textual representation |
12:20:29 | Yardanico | I can't do any better |
12:20:32 | FromDiscord | <lqdev> but maybe they turn that into unicode client-side or server-side |
12:20:34 | FromDiscord | <lqdev> ok |
12:20:37 | FromDiscord | <lqdev> good |
12:20:49 | FromDiscord | <lqdev> i can annoy zevv with squares |
12:20:52 | Yardanico | ๐ |
12:20:59 | FromDiscord | <lqdev> ๐ |
12:21:03 | Yardanico | ๐ |
12:21:09 | Yardanico | ๐ |
12:21:53 | FromDiscord | <lqdev> ๐ฟ ๐ด ๐ด ๐ฒ ๐ช ๐ท |
12:22:11 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/741269957165187243/unknown.png |
12:22:16 | Yardanico | but it depends on the font of course |
12:22:26 | FromDiscord | <lqdev> no dude don't show him |
12:22:45 | FromDiscord | <kodkuce> sent a code paste, see https://play.nim-lang.org/#ix=2tuX |
12:23:47 | FromDiscord | <kodkuce> req.headers["sec-websocket-protocol",1] meybe will try that now |
12:24:31 | FromDiscord | <kodkuce> yep that works |
12:25:01 | FromDiscord | <kodkuce> tough i was expecting req.headers["sec-websocket-protocol"] to give me a seq of all values |
12:25:33 | * | dulsi_ is now known as dulsi |
12:29:45 | dulsi | Anyone play with windows cross compiling and using wine? I built smalltrek using it but it can't load SDL2.dll even if it is in the same directory. |
12:30:07 | Yardanico | checked that the architecture matches? |
12:30:14 | Yardanico | both the dll and .exe should be of same architecture |
12:30:24 | Yardanico | also there might be more dependencies than just SDL2.dll |
12:31:03 | Yardanico | try to compile to x64 |
12:31:07 | Yardanico | and unzip all from https://www.libsdl.org/release/SDL2-2.0.12-win32-x64.zip |
12:31:48 | * | rockcavera joined #nim |
12:32:06 | opi | I once cross-compiled SDL for Windows and ran it with wine, worked for me, I know it isn't helpful, but I don't even reacall what I was playing with |
12:32:10 | dulsi | Argh. You are probably right. It is the wrong architecture. |
12:32:15 | Yardanico | opi: you don't need to cross-compile :) |
12:32:18 | Yardanico | they provide binaries |
12:32:28 | opi | Yardanico: I mean Nim binary |
12:32:37 | opi | I grabbed the DLLs from them ;) |
12:32:42 | opi | and put them in . |
12:32:44 | Yardanico | well your message was a bit misleading :P |
12:32:49 | Yardanico | "cross-compiled SDL" |
12:33:08 | opi | SDL using program โ what I intended to say :P |
12:33:21 | opi | it's 32ยฐC, I'm a bit groggy |
12:35:33 | * | Trustable quit (Remote host closed the connection) |
12:38:26 | dulsi | Works fine after I grabbed the dlls for the right architecture. Thanks. |
12:42:37 | FromDiscord | <kodkuce> hmm wtf am i getting error mistmatch when proces accepts that argument |
12:43:20 | FromDiscord | <kodkuce> oh i think i know |
12:43:59 | FromDiscord | <kodkuce> or not i tough it was not exported but it is |
12:50:15 | FromDiscord | <XxDiCaprioxX> How do I get mouse input? |
12:50:37 | Yardanico | use OS-specific APIs :) |
12:50:55 | Zevv | use OS-specific APIs :( |
12:50:57 | FromDiscord | <XxDiCaprioxX> How do I do this? Is there something to import? |
12:50:59 | FromDiscord | <kodkuce> am i retarded or what? https://pastebin.com/PN6J721B |
12:51:09 | Zevv | XxDiCaprioxX: what platform are you targeting? |
12:51:16 | Yardanico | @kodkuce the error is clear |
12:51:18 | FromDiscord | <XxDiCaprioxX> Windows |
12:51:29 | Yardanico | you can either call newWebSocket with 1 argument being Request |
12:51:33 | Zevv | Do you have soemthing that opens a window yet? |
12:51:40 | Yardanico | or with TWO arguments one of them being the url, and the other being the protocol |
12:51:44 | Yardanico | and they're strings |
12:51:50 | FromDiscord | <XxDiCaprioxX> No but do I need it? |
12:51:57 | FromDiscord | <XxDiCaprioxX> Like I know I will need a window |
12:52:10 | Zevv | well, I guess you want to know the mouse cursor location in your window |
12:52:21 | FromDiscord | <XxDiCaprioxX> Yes |
12:52:42 | FromDiscord | <XxDiCaprioxX> Okay but the only important question is: can you give me a name? |
12:52:46 | Zevv | ok, so that's where you start. You need a way to open a window with some kind of API, and these API's typicaly support the iput handling |
12:52:52 | Zevv | I'd pick SDL |
12:52:57 | Zevv | but depends on what you want to do i your window |
12:52:59 | FromDiscord | <XxDiCaprioxX> Okay, thank you |
12:53:08 | Zevv | you want to do native windows stuff, low level bitmap graphics, opengl. It all depends |
12:53:14 | FromDiscord | <XxDiCaprioxX> A game only using mouse input? |
12:53:16 | FromDiscord | <kodkuce> @Yardanico hmm proc newWebSocket(req: Request, protocol: string = ""): Future[WebSocket] {.async.} = isent first arg req and seocnd string? |
12:53:16 | Zevv | it's not in any way a "Nim thing" |
12:53:29 | Zevv | XxDiCaprioxX: sure, but I guess you also want to draw things? |
12:53:35 | Yardanico | @kodkuce where did you see that? |
12:53:37 | FromDiscord | <XxDiCaprioxX> Yes |
12:53:49 | FromDiscord | <XxDiCaprioxX> I need a window but like is SDL suitable? |
12:53:49 | Zevv | so, how will you be drawing that? framebuffers, openGL? |
12:53:53 | Yardanico | @kodkuce I don't see such an overload here https://i.imgur.com/hxCiJ3i.png |
12:53:54 | FromDiscord | <kodkuce> https://github.com/treeform/ws/blob/master/src/ws.nim#L85 |
12:54:08 | Yardanico | are you sure you're using the correct version of ws? |
12:54:09 | Yardanico | which has that? |
12:54:10 | FromDiscord | <XxDiCaprioxX> Framebuffers |
12:54:20 | Zevv | SDL is all about that: it provides you the window, the input handling for mouse and keyboard, and primitives for drawing bitmap stuff, or creating an EGL context for you to do OpenGL in |
12:54:22 | Yardanico | that proc was changed 19 days ago |
12:54:27 | Yardanico | it doesn't have a release yet properly |
12:54:29 | Yardanico | probably*& |
12:54:36 | Yardanico | yes it doesn't |
12:54:43 | Yardanico | so you have to install the head |
12:54:47 | Yardanico | https://github.com/treeform/ws/commit/d0b31d13bf32f75b7e0964ad0d4e93b2736dcf26 |
12:54:49 | FromDiscord | <XxDiCaprioxX> Okay, that is it, I'll learn all the neccessary stuff by myself. Thank you |
12:54:54 | Zevv | SDL is the way to go. then. and if you take care not to do any windows-specific things your code is likeley to be portable to MacOs and Linux as well |
12:55:07 | FromDiscord | <XxDiCaprioxX> Nice |
12:55:16 | opi | yeah, SDL is pretty good commong ground if you want bitmaps and windows |
12:55:18 | FromDiscord | <kodkuce> treeforms/ws |
12:55:27 | Yardanico | yes |
12:55:32 | Yardanico | you need latest version (last commit from github) |
12:56:32 | FromDiscord | <kodkuce> ok |
12:56:41 | FromDiscord | <kodkuce> sorry i missed you post up |
12:57:22 | * | apahl quit (Ping timeout: 244 seconds) |
12:58:38 | * | apahl joined #nim |
13:00:13 | FromDiscord | <kodkuce> how to install head, i try using github link with last commit but did not work, only other way i know is to copy paste in same dir xD |
13:01:38 | opi | kodkuce @#branch in nimble |
13:01:57 | opi | ah, you mean stright from Git |
13:02:01 | opi | sorry |
13:02:18 | Yardanico | @kodkuce do as opi told you |
13:02:29 | FromDiscord | <kodkuce> ty |
13:02:36 | FromDiscord | <XxDiCaprioxX> Well looks like I have to bother y'all again |
13:02:42 | opi | Yardanico: it works the same for Git URI? Nice. Never had to grab something like that |
13:02:52 | Yardanico | opi: he uses a nimble package |
13:02:56 | FromDiscord | <XxDiCaprioxX> When installing mingw to which path do i have to add it? to the top or bottom one? |
13:03:08 | opi | ah |
13:03:24 | opi | damn, I should go sit in a chair, I'm clearly confused today |
13:04:13 | FromDiscord | <kodkuce> opi solution wokred i did nimble install ws@#head |
13:06:23 | * | clyybber joined #nim |
13:07:08 | * | clyybber quit (Client Quit) |
13:07:18 | * | clyybber joined #nim |
13:12:01 | schurig | someone forgot to update the channel topic, latest version is 1.2.6, not 1.2.0 |
13:12:10 | Yardanico | it's updated very rarely :P |
13:16:40 | FromDiscord | <XxDiCaprioxX> How do I render an image using sdl2? |
13:18:24 | * | audiofile joined #nim |
13:19:01 | Yardanico | do you want to make a game? |
13:20:26 | clyybber | lol @ the 65535 issue |
13:20:38 | Yardanico | XD |
13:20:39 | clyybber | "issue" |
13:20:54 | FromDiscord | <XxDiCaprioxX> yes I do |
13:21:26 | Yardanico | I would suggest using https://github.com/Vladar4/sdl2_nim as a (a bit more nimatic) sdl2 wrapper |
13:21:34 | Yardanico | there's also https://github.com/Vladar4/nimgame2 https://github.com/ftsf/nico |
13:22:27 | FromDiscord | <XxDiCaprioxX> Thank you for the links, but for the beginning I don't want to use engines |
13:22:35 | Yardanico | sdl2_nim is not an engine |
13:22:47 | Yardanico | https://github.com/Vladar4/sdl2_nim/blob/master/examples/ex201_textures.nim |
13:22:59 | audiofile | sdl2 is kinda cool |
13:23:15 | FromDiscord | <XxDiCaprioxX> I know, I was referring to nimgame2 and nico |
13:23:33 | Zevv | clyybber |
13:23:37 | clyybber | Zevv |
13:23:39 | Yardanico | Zevv |
13:23:40 | Zevv | oi! |
13:23:42 | clyybber | Yardanico: |
13:23:43 | clyybber | oi! |
13:23:46 | Zevv | Did you have any hunch about https://github.com/nim-lang/Nim/issues/15118 yet? |
13:23:47 | Yardanico | clyybber |
13:23:47 | Yardanico | oi! |
13:23:48 | disbot | โฅ Cgen error: genSym fails to make unique identifier for ref object types ; snippet at 12https://play.nim-lang.org/#ix=2sHS |
13:23:57 | FromDiscord | <XxDiCaprioxX> I already have the other Nim wrapper but I'll go for this one if it is better? |
13:24:09 | FromDiscord | <XxDiCaprioxX> But how do I install iz |
13:24:09 | Yardanico | It seems to have a better Nim interface than one in nim-lang, yes |
13:24:32 | clyybber | Zevv: I think that gensym in vm is wrong |
13:24:32 | FromDiscord | <exelotl> nico is also not much of an engine - it doesn't give you scenes, entities, physics etc. Just a nice API for retro graphics, input and sound |
13:24:47 | clyybber | Zevv: But thats not the only issue I think |
13:24:52 | FromDiscord | <XxDiCaprioxX> But for the beginner stuff I won't need it either way xD |
13:25:04 | clyybber | Zevv: gensym generates unique symbols but somehow they get mixed up later |
13:25:07 | Yardanico | @XxDiCaprioxX nimble install sdl2nim |
13:25:15 | FromDiscord | <XxDiCaprioxX> is that all i have to do? |
13:25:17 | FromDiscord | <XxDiCaprioxX> nice |
13:25:19 | FromDiscord | <XxDiCaprioxX> thank you |
13:25:23 | clyybber | Zevv: Although gensym could generate "more unique" ones, that don't exercise the underlying bug |
13:25:25 | Yardanico | well, and then read sdl2_nim docs |
13:25:32 | Zevv | clyybber: ok, right. I wondered if this was something I could find myself, but I'm not at all acquainted with that part of the compiler |
13:25:40 | clyybber | Zevv: I think you can |
13:25:45 | Yardanico | it might conflict with normal sdl2 |
13:25:45 | FromDiscord | <XxDiCaprioxX> okay, so basically just how you install other stuff like nico |
13:25:54 | clyybber | Zevv: The gensym part is opcGenSym |
13:25:58 | FromDiscord | <XxDiCaprioxX> oh okay |
13:26:01 | Zevv | I can always just push a half baked PR and let the PR discussion solve it for me, that usually works |
13:26:02 | FromDiscord | <XxDiCaprioxX> I'll have to look |
13:26:03 | clyybber | The other part; I have no idea :D |
13:26:04 | FromDiscord | <exelotl> sdl2_nim is way better than the other sdl2 wrapper, because its well documented and follows the C API closely |
13:26:07 | Yardanico | yeah |
13:26:12 | clyybber | Zevv: Yeah haha |
13:26:16 | Zevv | ok, thanks! |
13:26:37 | * | azed quit (Quit: WeeChat 2.9) |
13:26:58 | PMunch | Hmm: https://community.arduboy.com/t/game-jam-5-pretty-simple/9067 |
13:27:02 | FromDiscord | <XxDiCaprioxX> Package 'sdl2_nim' has an incorrect structure. It should contain a single directory hierarchy for source files, named 'sdl2_nim', but file 'atomics.nim' is in a directory named 'sdl2\private' instead. This will be an error in the future. |
13:27:09 | Yardanico | don't worry |
13:27:13 | Yardanico | quite a lot of packages have that warning |
13:27:18 | FromDiscord | <XxDiCaprioxX> ok |
13:27:35 | FromDiscord | <XxDiCaprioxX> now I just need the dependencies and I'm good to go? |
13:27:49 | Yardanico | well, if you're on linux, chances are - SDL2 is already installed |
13:28:46 | FromDiscord | <XxDiCaprioxX> Nevermind I already have sdl2 because I intalled the other wrapper too lol |
13:31:16 | clyybber | type A = proc() {.nimcall.} |
13:31:18 | clyybber | var b = "hey" |
13:31:20 | clyybber | var a: A = proc() = |
13:31:23 | clyybber | echo "hey" |
13:31:24 | clyybber | echo b |
13:31:33 | PMunch | clyybber... |
13:31:35 | clyybber | This shouldn't really compile, should it |
13:31:41 | clyybber | PMunch: Hey, it was only 5 lines :p |
13:31:52 | Yardanico | b is a global |
13:31:54 | PMunch | That's 4 lines too many.. |
13:32:05 | Yardanico | clyybber: but b is a global |
13:32:07 | clyybber | Yardanico: damnit, yeah |
13:32:09 | Yardanico | so it doesn't have t obe a closure |
13:32:31 | Yardanico | obe |
13:32:32 | FromDiscord | <Recruit_main707> have t obe xD |
13:35:58 | FromDiscord | <XxDiCaprioxX> So, now that I have the wrapper, how do I create the Window? |
13:36:15 | Yardanico | check the examples? :) |
13:36:26 | Yardanico | https://github.com/Vladar4/sdl2_nim/blob/master/examples/ex101_init.nim |
13:36:29 | Yardanico | all in https://github.com/Vladar4/sdl2_nim/tree/master/examples |
13:36:36 | FromDiscord | <XxDiCaprioxX> okay thanks |
13:41:03 | FromDiscord | <XxDiCaprioxX> Do I just compile and run? |
13:41:27 | Yardanico | well, you can dance if you want |
13:42:03 | FromDiscord | <XxDiCaprioxX> great idea |
13:42:50 | FromDiscord | <XxDiCaprioxX> I mean because with Nico I had to do some specific command instead of F6 in VS Code |
13:42:54 | FromDiscord | <XxDiCaprioxX> That's why I asked |
13:43:10 | Yardanico | you could do F6 with nico too, you just had to do some simple changes in the cfg |
13:43:15 | Yardanico | you can run it with F6, yes |
13:47:38 | clyybber | is trialism here? |
13:47:46 | Yardanico | I don't think so |
13:47:53 | Yardanico | it was their first issue in nim repo |
13:48:27 | clyybber | yeah, seems fishy |
13:48:32 | clyybber | also kinda toxic |
13:49:11 | Yardanico | oh I think they did open some nim issues |
13:49:16 | Yardanico | but then deleted (?) the account |
13:49:18 | Yardanico | e.g. see |
13:49:19 | Yardanico | https://github.com/nim-lang/nimble/issues/651 |
13:49:21 | disbot | โฅ getProxy() doesn't handle proxies properly ; snippet at 12https://play.nim-lang.org/#ix=2tvb |
13:49:25 | Yardanico | and see how 4raq replied https://github.com/nim-lang/nimble/issues/651#issuecomment-491232594 |
13:49:26 | disbot | โฅ getProxy() doesn't handle proxies properly ; snippet at 12https://play.nim-lang.org/#ix=2tvb |
13:49:45 | Yardanico | but idk if it's feasible to really change the max line count |
13:49:56 | Yardanico | is it a performance/memory impact? |
13:50:07 | Yardanico | I guess it's 2 more bytes for each TLineInfo |
13:50:53 | Oddmonger | ??! var truc:seq[string]=@[โฆ] # undeclared identifier '=@' |
13:51:11 | Yardanico | use proper spacing :) |
13:51:43 | Oddmonger | not the first time i have space problem (is Nim an extension of my flat ?) |
13:52:34 | Oddmonger | is it a problem like ">>" (shift) vs "> >" (template) in C ? |
13:53:56 | Oddmonger | in other words , does ยซ =@ ยป introduces ambiguity ? |
13:53:57 | Zevv | disruptek: where is your mangling branch |
13:54:14 | clyybber | https://github.com/disruptek/Nim/tree/mangling |
13:54:42 | Zevv | thanks |
13:55:30 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
13:55:52 | PMunch | Oddmonger, https://nim-lang.org/docs/manual.html#lexical-analysis-operators |
13:56:14 | PMunch | Your problem is that =@ is a legal operator, and [] is read on its own |
13:56:39 | PMunch | So it's parsed as [string] =@ [...] and not [string] = @[...] |
13:56:49 | Oddmonger | ahhh |
13:56:51 | Yardanico | exactly |
13:57:01 | Oddmonger | =@ an operator, didn't know |
13:57:07 | Oddmonger | so there's ambiguitรฉ |
13:57:37 | Oddmonger | ambiguity |
13:57:40 | PMunch | Well any combination of the characters listed in the link I sent is valid as an operator name |
13:57:49 | Yardanico | there's no ambiguity :) |
13:57:53 | PMunch | Mais oui, c'est ambiguitรฉ |
13:57:59 | narimiran | hardcore F1 fans know: "you always-a have to leave-a the space-a!" |
13:58:03 | Yardanico | yes |
13:58:05 | PMunch | Well ambiguous to a reader |
13:58:12 | Yardanico | I don't like it when I see nim code with weird spacing |
13:58:30 | Yardanico | proc hello ( name : string ) : string |
13:58:49 | PMunch | proc hello ( name:string ) :string |
14:02:15 | clyybber | what makes most sense to you guys conceptually; having {.nimcall.} force the calling convention ccNimCall and no explicit be ccImplicit |
14:02:31 | clyybber | Or to have a symflag that says: calling convention was explicitly provided |
14:05:06 | Oddmonger | what does =@ do ? didn't find in the link above |
14:05:12 | Yardanico | nothing |
14:05:14 | Yardanico | but you can define it |
14:05:26 | Yardanico | from that link you can define operator with any combination of characters |
14:05:31 | Yardanico | and =@ is a valid combination for a custom operator |
14:05:32 | * | tane joined #nim |
14:05:35 | Zevv | pff I give up already. Too hot for compiler debugging |
14:05:51 | Oddmonger | ah i see |
14:06:46 | * | PMunch quit (Quit: Leaving) |
14:07:17 | schurig | is there a way to hide the "CC: stdlib_io.nim" messages of the compiler? |
14:07:22 | Yardanico | yes |
14:07:35 | clyybber | hint:Processing:off I think |
14:07:41 | Yardanico | --hint[CC]:off |
14:07:44 | Yardanico | clyybber: that's the dots |
14:07:44 | clyybber | ah, right |
14:07:46 | Yardanico | for the nim modules |
14:08:02 | narimiran | or just `--hint:off` to hide everything ;) |
14:08:16 | Yardanico | then -w:off --hints:off --verbosity:0 |
14:08:19 | schurig | thanks |
14:08:21 | Yardanico | to make that stupid compiler be silent /s |
14:09:06 | schurig | as I don't yet know if/which hint can be helpful, I turn them off selectively, currently Link, Exec, CC, Success, Processing and Conf |
14:09:39 | schurig | *SuccessX |
14:10:21 | Yardanico | "pico-optimization" :( |
14:10:29 | Yardanico | that's why we can't have nice things and people make electron apps |
14:19:25 | FromDiscord | <Ricky Spanish> how can i test if a nimterop library actually runs? i get ``` Nothing to build. Did you specify a module to build using the `bin` key in your .nimble file?``` when the nimble file is quite basic since the example of nimterop was more .nim file heavy |
14:19:36 | Yardanico | wdym "actually runs"? |
14:20:14 | FromDiscord | <Ricky Spanish> i mean actually downloads the dependencies listed inside the getheader i guess |
14:20:15 | Yardanico | try to use some procedures the thing you're wrapping |
14:23:24 | shashlick | @Ricky Spanish you need to tell nimterop what to do - see the -d:xxx flags |
14:23:48 | FromDiscord | <Ricky Spanish> ah ok thanks for the tip @shashlick |
14:24:42 | shashlick | What are you wrapping |
14:25:46 | * | audiofile quit (Quit: Default Quit Message) |
14:27:07 | FromDiscord | <Ricky Spanish> i have a dll that just adds 2 numbers from c, im including the header from c and trying to find a way to download the dll. but iv not even made it that far yet im just trying the demo |
14:27:20 | FromDiscord | <Ricky Spanish> sent a code paste, see https://play.nim-lang.org/#ix=2tvg |
14:27:25 | FromDiscord | <Ricky Spanish> but it fails at the getheader |
14:27:40 | FromDiscord | <Ricky Spanish> No build files found in \nimcache\nimterop\wrap |
14:27:51 | * | clyybber quit (Quit: WeeChat 2.9) |
14:28:11 | FromDiscord | <Ricky Spanish> id expect it to fail for the obvious urls and things, but its looking for a build file |
14:34:01 | FromDiscord | <Zachary Carter> https://github.com/nim-lang/Nim/blob/devel/lib/std/monotimes.nim#L50 looks wrong to me according to https://developer.apple.com/documentation/kernel/1462446-mach_absolute_time |
14:34:56 | Yardanico | change it? :P |
14:35:18 | FromDiscord | <Zachary Carter> I will - I just hope it doesn't break a lot |
14:35:56 | shashlick | @Ricky Spanish - what's your command line |
14:36:07 | FromDiscord | <Zachary Carter> how can I run tests locally Yardanico? |
14:36:19 | FromDiscord | <Zachary Carter> to ensure that the change doesn't break stuff |
14:36:27 | Yardanico | just run the module itself lol |
14:36:37 | Yardanico | it seems to have "some" tests in the module itself |
14:36:38 | FromDiscord | <Zachary Carter> okay |
14:37:08 | FromDiscord | <Ricky Spanish> for ```nimble build -d:danger``` i get ``` Nothing to build. Did you specify a module to build using the `bin` key in your .nimble file?``` when i nim c the wrapper i get the no build file found |
14:37:19 | Yardanico | well, you need a .nimble file then |
14:37:22 | Yardanico | with your main entry point |
14:37:26 | Yardanico | which imports the nimterop definition |
14:37:26 | Yardanico | etc |
14:37:54 | shashlick | for starters, try nim c -d:headerGit -r file.nim |
14:38:07 | shashlick | that tells nimterop to go down the git path |
14:39:21 | FromDiscord | <Ricky Spanish> sent a code paste, see https://play.nim-lang.org/#ix=2tvl |
14:40:20 | shashlick | you need `bin =` in your nimble file |
14:40:22 | shashlick | for build |
14:42:23 | * | noonien quit (Quit: Connection closed for inactivity) |
14:42:25 | FromDiscord | <Ricky Spanish> ah ok, so if i dont do it then it will basically only build once included by another nim project? |
14:42:41 | shashlick | nimble won't know what to build |
14:42:47 | disruptek | Zevv: that didn't take long. |
14:43:04 | FromDiscord | <Ricky Spanish> oh so i always need the bin path? |
14:43:29 | FromDiscord | <treeform> @kodkuce an you open an issue on github with your paste? |
14:43:43 | shashlick | https://github.com/nim-lang/nimble/#binary-packages |
14:44:00 | FromDiscord | <Ricky Spanish> thanks @shashlick |
14:54:46 | * | abm joined #nim |
14:57:32 | FromDiscord | <kodkuce> @treeform nah, do i have to ๐ , i duno if that is an issue even tough i think it is |
14:57:55 | FromDiscord | <kodkuce> https://pastebin.com/hmN04x2R |
14:58:23 | FromDiscord | <kodkuce> my simple question was if i return befor even establish ws connection shoudent client error out |
15:01:19 | Zevv | disruptek: what did |
15:01:30 | Zevv | or, what didn't |
15:01:52 | * | apahl quit (Ping timeout: 260 seconds) |
15:02:24 | * | natrys joined #nim |
15:02:37 | FromDiscord | <treeform> it should |
15:02:55 | * | apahl joined #nim |
15:05:54 | disruptek | well, damnit, it did not. |
15:05:57 | FromDiscord | <Technisha (LGBTQIAP+)> Is `return false if user.id not in allowedIDs else return true` valid Nim code? |
15:06:07 | Yardanico | no |
15:06:18 | FromDiscord | <Technisha (LGBTQIAP+)> Oh okay |
15:06:21 | Yardanico | also you can simplify it greatly |
15:06:23 | FromDiscord | <treeform> @kodkuce "Currently only the synchronous functions support a timeout. " from https://nim-lang.org/docs/httpclient.html#newAsyncHttpClient%2Cint%2CProxy |
15:06:33 | FromDiscord | <Technisha (LGBTQIAP+)> Oh? |
15:06:36 | FromDiscord | <treeform> I guess I can try making my own timeout based on timers? |
15:06:48 | Yardanico | return user.id in allowedIDs |
15:06:51 | Yardanico | that'll do the same logically |
15:07:05 | Yardanico | not sure why do you have to make it in such a complex way |
15:07:17 | FromDiscord | <Technisha (LGBTQIAP+)> Oh |
15:07:21 | FromDiscord | <Technisha (LGBTQIAP+)> Thanks :P |
15:07:31 | disruptek | treeform: you could use cps. |
15:08:28 | disruptek | getting cps into ws would be huge. |
15:08:46 | disruptek | we'd get a lot more feedback. really big. |
15:08:51 | disruptek | bigly, i mean. |
15:08:54 | disruptek | tremendous. |
15:08:57 | Yardanico | disruptek: no |
15:08:59 | Yardanico | bigly it is |
15:09:08 | Yardanico | biggy |
15:09:10 | Yardanico | cpssy |
15:09:14 | Oddmonger | bugly |
15:09:15 | Yardanico | flatty |
15:09:16 | Yardanico | binny |
15:09:20 | disruptek | buggly |
15:09:29 | Oddmonger | too slow disruptek |
15:09:39 | disruptek | i'm riffing on you, chucklehead. |
15:09:50 | FromDiscord | <treeform> slappyโตflippyโตproffy |
15:09:59 | disruptek | i know, i think you have an illness. |
15:10:03 | Yardanico | LOL |
15:10:07 | disruptek | i've been meaning to speak to you about that. |
15:10:21 | FromDiscord | <kodkuce> what |
15:10:22 | disruptek | it's like you've got your own little colored ecosystem. |
15:10:25 | FromDiscord | <treeform> ~ branding ~ |
15:10:26 | disbot | no footnotes for ``. ๐ |
15:10:30 | disruptek | i should have thought of that for my ecosystem. |
15:10:36 | FromDiscord | <kodkuce> sorry am kind half afk am baking eggs |
15:10:43 | FromDiscord | <treeform> eggy? |
15:10:47 | Yardanico | piggy |
15:10:51 | FromDiscord | <kodkuce> (edit) "baking" => "paning/frying no oil " |
15:10:52 | disruptek | leggy |
15:10:54 | FromDiscord | <treeform> piggy is a good one |
15:10:58 | Yardanico | trimmy |
15:11:12 | FromDiscord | <treeform> piggy for PI and trigonometry stuff. |
15:11:31 | disruptek | because who doesn't need another library for that? |
15:11:48 | disruptek | smart people are creepy. |
15:12:14 | FromDiscord | <kodkuce> i dident get really your respons for httpasync, basicly you try establish ws connection, my serfer just returns 404 or whatwer but client still think its connected |
15:12:17 | FromDiscord | <treeform> good think I is no smart people |
15:12:28 | * | Trustable joined #nim |
15:12:39 | FromDiscord | <treeform> @kodkuce returning 404 works, I don't think that is what your code is doing. |
15:12:40 | disruptek | good think. |
15:13:02 | FromDiscord | <treeform> @kodkuce I think you think its returning a 400. But I don't think so? |
15:13:24 | Zevv | disruptek: https://inside.java/2020/08/07/loomperformance/ |
15:13:48 | FromDiscord | <treeform> @kodkuce does this case pass for you? https://github.com/treeform/ws/blob/master/tests/test_404.nim How is your case different from that case? |
15:15:28 | FromDiscord | <kodkuce> sec |
15:15:30 | disruptek | wow, this is a good read. |
15:15:34 | disruptek | or maybe i'm just stoned. |
15:17:52 | FromDiscord | <treeform> @kodkuce when I run your client I get "Exception message: Failed to Upgrade (Possibly Connected to non-WebSocket url)" |
15:17:59 | FromDiscord | <treeform> I think I just need to cut a new version to fix it. |
15:18:36 | FromDiscord | <treeform> Websockets can't to HTTP codes as returns, its invalid. |
15:18:57 | FromDiscord | <treeform> If you want to do a web failure I recommend doing it as a message. |
15:19:05 | disruptek | by fix he means, break your code. |
15:19:31 | FromDiscord | <treeform> Send back via websocket some thing like `{"error":"not authenticated"}` then close connection. |
15:19:50 | disruptek | who here has read my source code? |
15:19:57 | FromDiscord | <treeform> Not `req.respond(Http400, $(%{"error":"blablasome"}), rheader)` that does not work. |
15:20:16 | FromDiscord | <kodkuce> "Websockets can't to HTTP codes as returns, its invalid." <<< i did not know this ๐ |
15:20:23 | FromDiscord | <kodkuce> that is why i asked |
15:20:30 | Yardanico | google exists :P |
15:20:33 | Zevv | disruptek: can you think with me for a minute |
15:20:40 | FromDiscord | <treeform> @disruptek your source code? |
15:20:40 | disruptek | yeah. |
15:20:49 | disruptek | oops, i did it again. |
15:20:52 | Zevv | open the stash/echo thingy |
15:20:54 | FromDiscord | <kodkuce> but still shoduent this ws faill cuz server did not reposnd |
15:20:56 | disruptek | yes yes. |
15:21:19 | FromDiscord | <treeform> @kodkuce it fails for me in #head... I can cut a new release |
15:21:26 | disruptek | i wanna ask you guys to critique my code later. |
15:21:51 | Zevv | for example, line 186/187 |
15:21:57 | disruptek | i just realized i have rarely gotten feedback on nim code. |
15:22:05 | Zevv | I want 'sockSend()' to do the 'cps evq.io() for me and hide it |
15:22:11 | disruptek | yyes yes zevv. and it do. |
15:22:15 | disruptek | it do be like that. |
15:22:18 | Zevv | disruptek: we all decided not to talk about your nim code |
15:22:24 | disruptek | lol |
15:23:14 | disruptek | if i had realized anyone was reading it, i would have typed in more comments. |
15:23:35 | disruptek | anyway, talk to me about cps. |
15:24:27 | FromDiscord | <kodkuce> Exception message: Failed to Upgrade (Possibly Connected to non-WebSocket url) |
15:24:44 | disruptek | you wanna do it inside the compiler? are you ready? |
15:24:46 | FromDiscord | <kodkuce> ye it fails for me too now i am on #head before it just got stuck |
15:24:56 | FromDiscord | <kodkuce> whawer then its fixed |
15:25:09 | disruptek | personally, i am not. |
15:25:22 | Zevv | disruptek: well, as I said above. But I can't do it now |
15:25:37 | Zevv | I need a .cps. proc to be able to call a .cps. proc |
15:25:47 | disruptek | it will be cps.sockSend(fd, msg) -- what else? |
15:26:03 | disruptek | you are passing the continuation. |
15:26:13 | disruptek | we know the variable, the type, the name of the continuation. |
15:26:27 | disruptek | where it goes from there... who knows. |
15:26:32 | Zevv | we miss soemthing |
15:26:38 | disruptek | (well, we do, because we put where you go on the stack already) |
15:26:50 | Zevv | yes |
15:26:56 | disruptek | this is what the inversion of control flow is. |
15:27:10 | Zevv | right. So I now make a 'sockSend2()' which is .cps. |
15:27:20 | disruptek | you don't tell us where you're going. we tell you where you've been. |
15:27:28 | disruptek | yes yes. |
15:27:30 | Zevv | so so |
15:27:57 | Zevv | so I make a .cps. proc called sockSend2() |
15:28:00 | disruptek | yes |
15:28:01 | Zevv | I can do 'return sockSend2()' |
15:28:05 | Zevv | but then there is no more after that |
15:28:11 | Zevv | because return, well, returns |
15:28:16 | Zevv | we need a return that does not return |
15:28:26 | disruptek | no, we are rewriting the return. |
15:28:30 | Zevv | right |
15:28:32 | Zevv | a non-rewritten return |
15:28:33 | disruptek | just as we are rewriting the result. |
15:28:34 | FromDiscord | <treeform> @kodkuce new release published, please update your nimble https://github.com/treeform/ws/releases/tag/0.4.2 |
15:30:33 | disruptek | why would we need that? |
15:30:39 | disruptek | i think i missed something. |
15:30:52 | Zevv | I want CPS procs to be able to call CPS procs |
15:30:59 | Zevv | not only CPS *magic* procs |
15:31:04 | disruptek | indeed, that sounds cool. |
15:31:10 | disruptek | so what's the problem? |
15:31:24 | FromDiscord | <kodkuce> ty ๐ |
15:31:27 | Zevv | we lack the mechanism |
15:31:35 | disruptek | nonsense. |
15:31:41 | Zevv | _at this time_ |
15:31:45 | Zevv | we need "await" |
15:31:55 | disruptek | what do you think those .cpsMagic procs are? |
15:32:05 | disruptek | it's just nim, man. |
15:32:05 | Zevv | procs that do *not* get rewritten |
15:32:22 | disruptek | there's a kind of nim that isn't rewritten, right? |
15:32:29 | disruptek | and it's the same kind that is rewritten, right? |
15:32:35 | disruptek | so how can you tell the difference? |
15:32:39 | disruptek | /is/ there a difference? |
15:33:15 | disruptek | we decided that cps authors, people that write iterators.. they are willing to learn the dark art. |
15:33:38 | disruptek | the rest of the users... fuck 'em. they don't get the power but they don't get any sharp pointy bits that could take an eye out. |
15:33:53 | Zevv | disruptek: how should I do this: http://ix.io/2tvB/nim |
15:34:10 | disruptek | you just did it, right? |
15:34:16 | Zevv | no. it doesn't work |
15:34:30 | FromDiscord | <Technisha (LGBTQIAP+)> If i had a string like `" a b c"`, how would i get rid of all of the spaces before `a`? |
15:34:34 | Zevv | What do I do with the return value of sockSend() |
15:34:41 | Zevv | If I discard it, we lose it |
15:34:43 | disruptek | we don't do anything special for synchronoze calls. |
15:34:47 | disruptek | what is that, even? |
15:34:48 | Zevv | if I return it, we return after "This" and "That" is never reached |
15:35:24 | disruptek | dude, remember how this works? |
15:35:30 | Zevv | I guess not |
15:35:33 | disruptek | if it's a cps call, you put `cps` in front of it. |
15:35:39 | Zevv | Yeah yeah sure I do that |
15:35:44 | FromDiscord | <Yardanico> @Technisha (LGBTQIAP+) strutils.strip |
15:35:54 | FromDiscord | <Technisha (LGBTQIAP+)> But then that removes all spacea |
15:35:55 | disruptek | okay. 'cause it won't compile otherwise. |
15:35:58 | FromDiscord | <Technisha (LGBTQIAP+)> (edit) "spacea" => "spaces" |
15:36:05 | Zevv | no, it doesn't compile *with* |
15:36:15 | FromDiscord | <Technisha (LGBTQIAP+)> I only want to remove the spaces before `a` |
15:36:19 | disruptek | wut |
15:36:21 | Zevv | because i'm not calling a magic. Wrong proc signature |
15:36:26 | FromDiscord | <Technisha (LGBTQIAP+)> So i only have `"a b c"` |
15:36:39 | disruptek | magic isn't a thing. |
15:36:41 | disruptek | is it? |
15:36:50 | disruptek | i thought we already took it out. |
15:36:55 | Zevv | No, ok, true |
15:37:00 | Zevv | but still. Try to do what I try to do |
15:37:03 | Zevv | call a CPS from a CPS |
15:37:04 | Zevv | do it |
15:37:09 | disruptek | maybe i don't remember. |
15:37:14 | disruptek | can you put this in a test? |
15:37:18 | Zevv | sure |
15:37:25 | * | clemens3 quit (Ping timeout: 240 seconds) |
15:38:16 | * | dulsi quit (Remote host closed the connection) |
15:38:30 | FromDiscord | <Technisha (LGBTQIAP+)> :P |
15:40:04 | disruptek | Zevv: all it does is convenience for the user. |
15:40:21 | disruptek | there's no practical side-effect as far as cps is concerned. |
15:40:28 | FromDiscord | <Rika> @Technisha (LGBTQIAP+) read the definition/description of `strutils.strip` again |
15:40:35 | FromDiscord | <Technisha (LGBTQIAP+)> Okay |
15:41:09 | disruptek | instead of designing a second api for cps developers, we just make out primary api better. |
15:41:26 | disruptek | it's only nim. |
15:41:28 | Zevv | disruptek: https://github.com/disruptek/cps/blob/master/stash/cpscps.nim |
15:41:37 | Zevv | tell me what to type on line 22 to make this work |
15:41:47 | Zevv | I want the output "one a, two a, two b, one b", right? |
15:41:49 | FromDiscord | <Technisha (LGBTQIAP+)> Oh okay, thanks! |
15:41:50 | disruptek | okay, lemme see. |
15:41:56 | Zevv | with "sleep" in the middle, btw |
15:42:27 | disruptek | and i'm a "cps developer", right? |
15:43:12 | FromDiscord | <Technisha (LGBTQIAP+)> How would i get rid of few characters from the start of a string? |
15:43:23 | FromDiscord | <treeform> disruptek is a "child protective services developer"? |
15:43:29 | Zevv | disruptek: the docs say "yes, you are" |
15:43:32 | Zevv | you are *The* cps devleoper |
15:43:37 | Zevv | because no one dares read your code |
15:43:41 | disruptek | many is the protective service i've developed. |
15:43:59 | Zevv | I do *use* your code tho. today even, the mangling. I love it |
15:44:04 | * | pbb quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
15:44:08 | disruptek | nice. |
15:44:31 | Zevv | I did get some clashes with stdlib.h, tho |
15:44:35 | disruptek | we should tweak it soonish because it will be something that might be harder to change later. |
15:44:45 | Zevv | disruptek: sure thing |
15:44:48 | Zevv | that's why i'm bringing it up |
15:44:55 | disruptek | so we should get it gutten tight. |
15:44:59 | Zevv | I just spend a few minutes writing little things I want to write with this stuff |
15:45:06 | Zevv | every now and then |
15:45:18 | Zevv | but you see my problem now? |
15:45:41 | disruptek | well, i'm not looking at the code, but are you saying that no one can use the stuff we have? |
15:46:11 | Zevv | for the basics, but we can't do it all |
15:46:33 | disruptek | you want a dsl to compose iterators. |
15:46:46 | Zevv | well, did you look at cpscps.nim |
15:47:00 | disruptek | lemme understand it first. |
15:47:49 | disruptek | what does it do? |
15:48:24 | disruptek | well, sleep doesn't sleep, right? |
15:48:33 | Zevv | ok, I can make it do |
15:48:37 | Zevv | doesn't matter |
15:48:49 | Zevv | With the current stuff we can do a few things. |
15:49:00 | Zevv | - call a cps proc from normal code. This results in a cont that you have to do something with |
15:49:11 | * | pbb joined #nim |
15:49:18 | Zevv | - Call a 'magic'/'middleware' proc from a CPS. That does stuff that you don't want to see |
15:49:54 | Zevv | But I can't call CPS from CPS. My 'sockRecv()' needs to be a .cps. proc. But I want to call it from a .cps. proc, not from normal nim |
15:50:00 | disruptek | oh i'm such an idiot. |
15:50:07 | Zevv | your words |
15:51:29 | Zevv | so, makes sense now? |
15:51:45 | disruptek | nope. |
15:51:48 | disruptek | holdon. |
15:51:56 | disruptek | the code is working afaict. |
15:52:16 | Zevv | no. "one b" never happens |
15:52:23 | disruptek | oh. |
15:52:36 | Zevv | because the return gets rewritten to a returning return that returns |
15:52:38 | disruptek | i didn't see that it should. |
15:52:51 | disruptek | oh, you want to call two() as cps? |
15:52:58 | Zevv | Right'o |
15:53:00 | disruptek | just `cps two()` |
15:53:07 | disruptek | that's how we call cps procs, remember? |
15:53:08 | Zevv | try it |
15:53:36 | disruptek | huh. |
15:54:32 | disruptek | it's like a compiler phase issue. |
15:54:37 | Zevv | no. |
15:54:46 | Zevv | `proc two()` is the bootstrap |
15:54:52 | Zevv | it doesn't take a C, because it is ment to be called from *nim* |
15:54:54 | Zevv | not from cps |
15:54:56 | disruptek | this is solved once we're typeed, right? |
15:54:59 | disruptek | we can agree on that? |
15:55:01 | Zevv | no |
15:55:08 | Zevv | read that ^^^ |
15:55:08 | disruptek | and why is my keyboard producing so many double letters? |
15:55:13 | disruptek | am i slurring my words? |
15:55:29 | Zevv | only the es and the rs |
15:55:33 | disruptek | what's a bootstrap? |
15:55:43 | Zevv | the initial proc to call cps from nim |
15:55:45 | Zevv | look at the rewrite |
15:55:51 | Zevv | `proc two(): C` |
15:56:03 | Zevv | there is no `C` argument. Because you call it from nim, not from cps |
15:56:19 | Zevv | I call it a bootstrap, I don't know if you have a name for it |
15:56:47 | disruptek | we'll call it whatever you want. |
15:56:47 | Zevv | it's that one particular proc that has the same name as the original |
15:56:56 | disruptek | we're talking about the proc that the user calls "from nim". |
15:56:59 | disruptek | right? |
15:57:30 | Zevv | I'll call it steve then |
15:57:33 | Zevv | right |
15:57:34 | disruptek | that proc just creates our continuation and calls it, right? |
15:57:37 | disruptek | that's what it should do. |
15:57:40 | Zevv | right |
15:57:43 | FromDiscord | <kodkuce> this watchexec can i run it for just 1 file if i put -f filename.nim it dosent call it ๐ฆ |
15:57:47 | disruptek | i don't think we do all that yet. |
15:57:55 | Zevv | but if you call it from cps, it wants to get a C passed |
15:58:23 | disruptek | oh, you redid this. |
15:58:32 | disruptek | i totally did not see this. |
15:58:40 | Zevv | what |
15:59:18 | Zevv | anyway, we need generate 2 variants of the `two()` proc |
15:59:32 | Zevv | nim will call the right one by signature. One from nim to cps, and one from cps to cps. |
15:59:35 | disruptek | what's bad about doing stuff in macros? |
15:59:42 | Zevv | your types are a ly |
15:59:44 | Zevv | lie |
15:59:50 | Zevv | I just want to see that it is a NimNode |
16:00:12 | disruptek | okay, whatever. |
16:00:15 | Zevv | whatever |
16:00:29 | Zevv | So, agree? We need to generate `proc foo(): C` and `proc foo(c: C): C` |
16:00:39 | Zevv | one is for calling from nim, the other is for calling from cps |
16:00:50 | disruptek | fine. |
16:01:02 | Zevv | yeah, but you sound like I'm your nagging wife now |
16:01:03 | disruptek | but why? |
16:01:25 | Zevv | because it doesn't work now? |
16:02:58 | disruptek | you use nim to alloc the continuation. it's a chunk of memory. we just need to get ourselves into its .fn and we're golden. |
16:03:02 | * | clemens3 joined #nim |
16:03:33 | Zevv | right. So. What I think should be done: |
16:03:51 | Zevv | the first proc you now rewrite, the `proc two(): C` is the special kid in the class. IT doesn't take a C as argument. Right? |
16:03:59 | Zevv | so it does a special dance to *make* the C |
16:04:04 | Zevv | say yes or no |
16:04:29 | Zevv | it's the one doing the initial allocation of the env |
16:04:42 | disruptek | yes. |
16:04:52 | Zevv | but when I call from CPS, I already *have* a anv. |
16:04:53 | Zevv | env |
16:04:57 | disruptek | yes. |
16:05:02 | Zevv | So I think we should make two() take an env |
16:05:08 | disruptek | the first one is the bootstrap. |
16:05:11 | Zevv | right |
16:05:21 | Zevv | so we make two() just normal like all the others |
16:05:24 | Zevv | it gets an env |
16:05:40 | Zevv | and we make a little bootstrap with the same name, but now C argument. That simply does the alloc and calls he real two() |
16:05:45 | Zevv | so then we have both of them |
16:05:50 | disruptek | but i'm saying we have `run`, right? that's the api. so maybe we overload `new` as well. |
16:06:11 | disruptek | var c = new C() |
16:06:28 | Zevv | hmm not sure, overloading `new`? |
16:06:42 | Zevv | anyway, long story short: you *do* see my current problem |
16:06:44 | Zevv | question markl |
16:07:18 | disruptek | i'm thinking. |
16:07:22 | Zevv | good |
16:08:50 | disruptek | yes. |
16:08:54 | Zevv | I say: we rewrite two() like any other cps proc into `proc two(c: C): C` and provide a "bootstrap" that is just `proc two(): C = result = env2_14450074(fn: two)` |
16:09:10 | disruptek | why would it differ? |
16:09:18 | disruptek | we don't "do" entry. |
16:09:44 | disruptek | i live my life one .cps. at a time. |
16:11:56 | Zevv | ok, we need a `proc two(): C`, agree? |
16:12:21 | Zevv | but I also need `proc two(c: C): C`. |
16:12:23 | disruptek | yes, but what makes you think it's not a bug that it doesn't exist? |
16:12:33 | disruptek | why wouldn't it exist? it exists for one(). |
16:12:33 | Zevv | oh I dont know, is it? |
16:12:40 | disruptek | the two procs are defined the same. |
16:12:51 | disruptek | they should be equivalent in terms of the .cps. macro. |
16:13:05 | Zevv | I don't see a `proc one(c: C): C` |
16:13:17 | disruptek | it's added by .cps. |
16:13:24 | Zevv | don't see it in the cpsDEbug |
16:13:56 | disruptek | argh, lemme try it. |
16:14:44 | disruptek | are you on head? |
16:15:56 | Zevv | sure |
16:16:01 | Zevv | oh diner bbl |
16:18:01 | disruptek | it's not added, clearly. |
16:18:04 | disruptek | hmm. |
16:18:47 | * | dadada joined #nim |
16:19:10 | * | dadada is now known as Guest77498 |
16:22:08 | * | opi quit (Read error: Connection reset by peer) |
16:22:22 | disruptek | we should not write code as developers, we should write code as refactor artists. |
16:23:58 | disruptek | don't guess. the next guy will know. give him a way to refactor you. |
16:25:13 | * | matti is now known as kwilczynski |
16:25:24 | * | kwilczynski is now known as matti |
16:26:15 | * | matti is now known as kwilczynski |
16:26:41 | * | jken_ joined #nim |
16:30:08 | * | kwilczynski quit () |
16:30:55 | disruptek | Zevv: i dunno if it used to work or what, but let's just put it back in. |
16:31:01 | * | kwilczynski joined #nim |
16:31:08 | disruptek | we can do it simply and then the next guy can change it. |
16:31:25 | disruptek | if our input is nil, we'll alloc it. |
16:37:26 | shashlick | anyone knows how to use {.emit.} to run a c function and get a return value |
16:38:36 | disruptek | get a return value? |
16:38:58 | disruptek | from c you can access nim, right? |
16:39:05 | * | narimiran quit (Ping timeout: 240 seconds) |
16:44:24 | shashlick | how |
16:45:15 | disruptek | .exportc |
16:46:43 | shashlick | i'm basically trying to call https://github.com/cmuratori/meow_hash/blob/master/meow_hash_x64_aesni.h#L149 |
16:47:05 | disruptek | aha, you like meowhash, right?! |
16:47:51 | disruptek | so what does it take? |
16:47:56 | disruptek | pointers to something? |
16:48:10 | disruptek | do you have that thing in nim? exportc it. |
16:48:12 | shashlick | just hashes, that works fine but since it doesn't return anything, nim gets bothered |
16:48:23 | Zevv | disruptek: It's not a C thing. It's a C preprocesor hing |
16:48:29 | disruptek | bothered how? |
16:48:38 | disruptek | i know, it's a macro. |
16:48:59 | shashlick | https://play.nim-lang.org/#ix=2tvL |
16:49:22 | disruptek | oh shit, now i see. |
16:49:31 | Zevv | shashlick: if you want to go that way, wrap it in a C func and call that |
16:49:34 | disruptek | just use a proc to call what the macro does. |
16:50:01 | shashlick | if we can figure this out, nimterop can get macro => template support |
16:50:15 | disruptek | well, use zevv's idea, then. |
16:51:00 | disruptek | but you could have a macro right these templates, too. |
16:51:08 | disruptek | write, also. yikes. |
16:51:25 | shashlick | ya macro is fine but how do you get the return value from a c macro |
16:51:33 | Zevv | you don't. |
16:51:35 | Zevv | It's an expression |
16:51:36 | disruptek | it's an expr |
16:52:02 | shashlick | right and i don't know types to assign it to a var |
16:52:16 | disruptek | it wouldn't matter anyway, would it? |
16:53:16 | disruptek | you could just render the values in a macro. that would be cool. |
16:54:42 | shashlick | no idea how to proceed - any code tips will be appreciated |
16:54:56 | Zevv | I'm not sure how you would handle this. It doesn't exists when it's in the preprocessor |
16:55:13 | Zevv | you can't know types and all. |
16:55:26 | disruptek | i know, that's what's so aweome about it. |
16:55:39 | Zevv | awkward or awesome? |
16:55:43 | disruptek | you export the symbols you want to use. now you know how to get them from nim. |
16:55:50 | Zevv | there *is* no symbol |
16:55:53 | shashlick | i'd rather not use the value cause it could be very complicated |
16:56:02 | disruptek | then you simply render them into strings. |
16:56:09 | Zevv | it doesn't exist. It's just a bunch of characters |
16:56:15 | disruptek | the string goes into the source. |
16:56:20 | Zevv | what source |
16:56:20 | disruptek | the source goes into the compiler. |
16:56:23 | Zevv | what source |
16:56:27 | shashlick | somehow emit doesn't return anything |
16:56:27 | disruptek | c source |
16:56:31 | Zevv | what c source |
16:56:37 | shashlick | that can be replaced into the if xxx |
16:56:43 | disruptek | that which you emitted. |
16:56:45 | Zevv | yeah but there is no c source here |
16:56:53 | Zevv | oh the nim c source |
16:56:54 | Zevv | hmm |
16:56:55 | Zevv | lemme think |
16:57:02 | * | superbia1 joined #nim |
16:57:10 | disruptek | it's not crazy. |
16:57:13 | * | superbia quit (Ping timeout: 264 seconds) |
16:57:39 | Zevv | btw, to get back to the cps thing: will you bring back these nasty constructs with the `whens`, or just generate 2 procs with different signatures? |
16:58:17 | disruptek | we generate one new proc. from the first proc, we call the new proc. |
16:58:24 | Zevv | righto! |
16:58:46 | disruptek | but in the new proc we check if the input is nil. |
16:58:50 | Zevv | shashlick: you should ask the guy who made nimterop, I guess he knows a lot about this stuff |
16:59:09 | disruptek | if it is, we alloc whatever our via is. |
16:59:29 | Zevv | why not allocate in the first proc? |
16:59:33 | Zevv | you know you need to alloc there? |
16:59:45 | Zevv | it needs to return the C that it didn't get passed |
16:59:59 | disruptek | hmm, good point. |
17:00:30 | Zevv | most of my points are good |
17:00:30 | shashlick | ah you guys gave up already ๐ |
17:00:33 | Zevv | the rest of them are great |
17:00:40 | disruptek | i think it's worth it. |
17:00:44 | Zevv | shashlick: no not yet, but I need to keep track of disruptek otherwise he will type stupid stuff |
17:01:10 | shashlick | cps can continue run in the background anyway right |
17:01:27 | disruptek | we know a case where we will use this semantic. there may be others. it's not a big stretch. we could use it to scale envs up, for example. |
17:01:43 | disruptek | i guess we're calling them envs. |
17:04:30 | disruptek | i think we can assume that a nil check on the first arg input to the proc is practically, if not provably free. |
17:05:29 | disruptek | we'll do it your way and fix it when it breaks. |
17:07:41 | Zevv | or we'll break it when it's fixed |
17:10:36 | Zevv | shashlick: my bet is, if c2nim can't handle it, you're kind of out of luck |
17:14:12 | disruptek | my next project is gonna be some kind of reflection api. |
17:14:41 | Zevv | narcism |
17:14:47 | Zevv | call it |
17:16:08 | disruptek | sure. |
17:18:04 | disruptek | i want a little bucket i can access by id, like @cache.foo |
17:18:28 | disruptek | just compile-time caching by proc or something. |
17:19:23 | disruptek | Zevv: you should design some dsl for cps patterns, too. |
17:19:29 | Zevv | a bucket for monsieur |
17:19:52 | disruptek | un petit bucket. |
17:20:02 | Zevv | https://www.youtube.com/watch?v=Zx0ME65y72E |
17:20:16 | disruptek | just one thin mint. |
17:20:53 | Zevv | cps patterns |
17:20:56 | Zevv | enlighten me |
17:23:07 | disruptek | i dunno, like a syntax for iterators, a syntax for exceptions, etc. |
17:23:34 | Zevv | these are all middleware problems, right |
17:23:34 | disruptek | we should provide some basic generics, right? |
17:23:42 | Zevv | not sure, don't think so yet |
17:24:12 | Zevv | it's all dressing up |
17:38:51 | * | vicfred joined #nim |
17:53:47 | * | natrys quit (Quit: natrys) |
18:06:54 | * | waleee-cl joined #nim |
18:18:21 | * | superbia1 is now known as superbia |
18:19:22 | * | abm quit (Quit: Leaving) |
18:29:05 | * | lritter quit (Quit: Leaving) |
18:37:18 | disruptek | Zevv: why do we disallow a return type? |
18:38:16 | alehander92 | disruptek https://github.com/mrakgr/The-Spiral-Language/commit/51fe8b7f286590a83db5aa47d1da7fb11a96af56 |
18:38:19 | disruptek | it's part of #20 {.cps: C.} but i don't understand why. |
18:38:21 | alehander92 | those are the commit messages |
18:38:28 | alehander92 | i wanted to show once .. someone |
18:38:37 | alehander92 | not sure who tho, maybe you guys |
18:38:55 | Zevv | disruptek: elaborate |
18:38:59 | alehander92 | it reminds me a bit of your chat, if it gets inserted into commits |
18:40:10 | disruptek | nah, this guy is a way bigger asshole. i bow to him. |
18:40:35 | disruptek | we say, "No return type allowed for now" |
18:41:07 | alehander92 | hahaha i don't agree with his sentiment. but the thinking process and effort is pretty interesting to me |
18:41:38 | alehander92 | i'd like to add a bit of similar discipline. but with more optimism |
18:41:52 | disruptek | he's narcissist. i've a bit fed of with them, lately. |
18:41:59 | disruptek | fed up, rather. |
18:43:25 | disruptek | oh, we deny return type so that we can make results work. |
18:43:28 | disruptek | i forgot. |
18:43:38 | disruptek | i will write something about that. |
18:46:47 | disruptek | maybe a void return type means mutation (what else?) and otherwise it means value semantics. |
18:47:22 | alehander92 | yeah, i like the discipline of writing / working on projects like that |
18:47:27 | shashlick | Meowhash gives me different values in streaming mode |
18:47:29 | alehander92 | not the attitude |
18:47:43 | disruptek | shashlick: is that by design? |
18:48:09 | shashlick | No idea, now I need to redo in C to verify if my code is wrong |
18:48:19 | shashlick | But it worked fine with Sha256 |
18:48:41 | shashlick | Docs are minimal and code unreadable |
18:48:54 | shashlick | Their website is out of sync with the repo |
18:49:00 | Zevv | sounds like my life |
18:49:04 | shashlick | Not easy peasy |
18:49:06 | disruptek | i was going to port from scratch but i realized it could be challenging to get it to replace our existing hashing in stdlib, so i lost motivation. |
18:49:33 | disruptek | the speed is pretty attractive, though. |
18:49:54 | disruptek | iirc it's 16b/cyc |
18:50:32 | shashlick | It's all sse4 stuff |
18:51:19 | shashlick | Single header so no reason to port |
18:51:59 | disruptek | yeah, but it's not even that long. i'd rather have it in native. |
18:52:32 | disruptek | anyway, are there no tests? |
18:52:37 | * | ee7[m] joined #nim |
18:55:23 | shashlick | All seem to read file fully into memory |
18:55:26 | Zevv | disruptek: request permission to ask stupid question |
18:55:36 | disruptek | yes yes. |
18:55:39 | shashlick | Not the streaming api |
18:56:00 | disruptek | so the streaming api produces novel results but you have no test for it? |
18:56:15 | disruptek | i guess you do need to write a c version. |
18:56:41 | shashlick | Ya |
18:56:50 | shashlick | Way to go |
18:57:57 | * | NimBot joined #nim |
18:59:03 | disruptek | Zevv: do i have to guess? |
19:01:54 | Zevv | oh |
19:01:55 | Zevv | I forgot |
19:01:58 | disruptek | Zevv: ah, i took a shortcut and it bit me. that's what happened. |
19:02:14 | Zevv | what's "saften" |
19:02:21 | Zevv | german juice making? |
19:02:30 | disruptek | the mutant idea was supposed to be one where you supply the value type, premade, prealloc'd. |
19:02:59 | disruptek | there are a few words that have a silent t and this is one |
19:03:04 | disruptek | it's a made-up word. |
19:03:14 | disruptek | ensafen was taken. |
19:03:31 | disruptek | ensaferate is available, though. |
19:03:44 | disruptek | ensaferatoration is available, too. |
19:03:49 | Zevv | I'll just read it as german juice making |
19:03:56 | disruptek | fair enough. |
19:03:59 | Zevv | frog in a blender |
19:04:11 | disruptek | i do have some good news. |
19:04:19 | disruptek | bentley and i came to an agreement. |
19:04:31 | disruptek | when he dies, i won't stuff him and turn him into a throw cushion. |
19:04:41 | disruptek | and if i predecease him, he won't eat my face. |
19:04:45 | disruptek | well, not right away. |
19:04:54 | Zevv | why would you care? |
19:04:59 | Zevv | or he |
19:05:07 | Zevv | stupid agreement |
19:05:10 | disruptek | the guy is sick. |
19:05:19 | disruptek | i say him licking his own asshole last night. |
19:05:28 | disruptek | i caught him in the act. |
19:05:31 | supakeen | You don't? |
19:05:36 | disruptek | red tongued and with a guilty look on his face. |
19:05:50 | disruptek | call me a prude, but i do that shit in private. |
19:06:27 | supakeen | Live a little, disruptek. |
19:06:33 | disruptek | yeah, well. |
19:06:36 | disruptek | that's the problem. |
19:06:44 | disruptek | he's seen how i treat the cushions. |
19:07:26 | * | muffindrake joined #nim |
19:09:46 | * | vicfred quit (Read error: Connection reset by peer) |
19:09:47 | Zevv | hm when going typed a few different rules apply |
19:09:52 | Zevv | you can't modify your incoming NimNodes |
19:09:58 | * | vicfred joined #nim |
19:10:06 | Zevv | need to build a new tree |
19:10:11 | disruptek | that's fine. |
19:10:20 | disruptek | the only issue is copying gensyms. |
19:11:15 | disruptek | i'll patch this for the current impl and we'll rewrite it in the typed version. |
19:11:25 | Zevv | sure |
19:11:33 | disruptek | i mean, it's pretty important that it works. ๐ |
19:12:32 | Zevv | works is overrated |
19:22:36 | disruptek | foo(): Cont returns a Cont which is fully allocated and ready to run. you c() and it procedes with the trampoline, starting with foo(Cont): Cont. i think that's pretty tight, right? |
19:29:09 | * | dulsi joined #nim |
19:30:25 | disruptek | or should it just run the first leg of the continuation, too? |
19:39:26 | * | endragor_ joined #nim |
19:40:53 | FromGitter | <jivank> What would be the best way to call C code? Essentially I just want to call the main of this https://github.com/Rudde/mktorrent |
19:41:44 | FromGitter | <jivank> and I assume nim would embed everything it needs (still will compile to a single binary) |
19:42:24 | * | endragor quit (Ping timeout: 256 seconds) |
19:47:04 | Zevv | hmmm that's a good point. |
19:47:15 | Zevv | I think *not* do the initial tramp |
19:47:28 | Zevv | because if you do that and you don't want that, there's no way not do it |
19:47:33 | disruptek | right. |
19:47:36 | Zevv | but if you don't do it and you want it anyway, you *can* do it |
19:48:03 | Zevv | so the middleware can chose to do that if it makes sense |
19:48:45 | disruptek | i mean, they can always be run. the middleware can choose what to do, if anything. |
19:48:53 | Zevv | exactly |
19:48:58 | disruptek | you have a fresh object. |
19:49:03 | disruptek | it's not like you cannot test for this. |
19:49:21 | Zevv | push that shizzle |
19:49:29 | disruptek | we could give you some kind of initialization. |
19:49:39 | Zevv | like how |
19:49:47 | disruptek | i added this for trace but i would want it be nicer if it were general. |
19:50:22 | disruptek | like we call you with (nil.Cont, c: Cont) and you overload that to do initialization. |
19:50:53 | Zevv | hmmm. it sounds plausible, but I do not have a practical use case for that yet, I think |
19:51:18 | disruptek | well it doesn't work yet. i am doing something dumb. |
19:52:56 | disruptek | oh because i assume too much. |
19:56:34 | * | jken_ quit (Ping timeout: 256 seconds) |
19:59:58 | Zevv | and now your AST is ill formed |
20:00:05 | Zevv | that's quite a nasty thing to say |
20:00:24 | disruptek | just pushed. somehow i'm wiping the return type and not restoring it. |
20:00:28 | Zevv | Yo mama's so fat her AST is ill formed |
20:01:32 | disruptek | we have to always insert it, right? |
20:01:41 | disruptek | else how can you merge two continuations? |
20:02:18 | Zevv | hm let me see. "merging two continuations" |
20:02:51 | disruptek | point is, you have to be able to pass more than one. |
20:03:04 | Zevv | how so? |
20:03:10 | Zevv | there is always only one? |
20:03:19 | Zevv | you can't go two places |
20:03:22 | disruptek | that's rather sad. |
20:03:30 | Zevv | it's the way of the world |
20:03:37 | disruptek | well, the way of the world sucks. |
20:03:48 | Zevv | so I've heard |
20:04:55 | disruptek | the crows are feasting tonight. |
20:07:27 | Zevv | I just found back on old CD I forgot about for 20 years. nostalgia galore. |
20:07:41 | Zevv | suddenly I'm there programming turbo C and playing quake |
20:07:48 | disruptek | beck? |
20:07:51 | Zevv | Orbital |
20:08:19 | Zevv | I bet they never made it to the usa |
20:08:22 | disruptek | orbital. |
20:08:46 | disruptek | i don't know them. |
20:08:55 | Zevv | "In Sides" is the album |
20:09:30 | disruptek | it's freaking bentley out. |
20:09:40 | Zevv | it should. |
20:09:46 | Zevv | start at #3 |
20:09:48 | zedeus | poor dog |
20:10:13 | Zevv | so, echo server is not happy now |
20:10:17 | Zevv | but you probably noticed |
20:10:32 | disruptek | i try not to run tests. |
20:10:39 | disruptek | i'm all about my testes, now. |
20:10:42 | Zevv | good |
20:12:19 | disruptek | gah, time for line numbers on this debugging output. |
20:12:34 | Zevv | like, the original source line numbers? |
20:12:36 | disruptek | probably should just write a proper logging interface. |
20:12:38 | disruptek | yeah. |
20:13:04 | Zevv | did I accidentally check in the treerepr |
20:13:06 | Zevv | or was it you |
20:13:11 | disruptek | me. |
20:13:13 | Zevv | ok |
20:17:08 | * | vicfred quit (Quit: Leaving) |
20:17:32 | * | MightyJoe quit (Ping timeout: 256 seconds) |
20:17:45 | * | cyraxjoe joined #nim |
20:19:18 | disruptek | it's pretty fun to listening to everyone's music on this channel. |
20:23:08 | Zevv | I miss your streams |
20:23:12 | Zevv | I hated the babbling, tho |
20:23:28 | disruptek | yeah. it was hard to work sometimes. |
20:25:29 | disruptek | i think we have to go typed now. |
20:28:45 | Zevv | like, *now*? |
20:28:51 | Zevv | I was just about to get some breakfast |
20:28:57 | disruptek | breakfast? |
20:29:03 | disruptek | for second dinner? |
20:29:08 | Zevv | first breakfast |
20:29:18 | disruptek | where are you? |
20:29:21 | Zevv | cereals make for an appropriate meal any time of the day |
20:29:24 | * | narimiran joined #nim |
20:29:37 | Zevv | and go great with Talisker |
20:29:59 | disruptek | eggs, too. i'm pretty much always down to slurp up half a dozen hen's periods. |
20:30:36 | * | kenran joined #nim |
20:32:22 | Zevv | good thing they debunked the cholstrol story, right |
20:32:38 | disruptek | bunch of bs. |
20:33:47 | disruptek | focus on the cereal. we can't have you on talisker until we've weathered the milk-coma storm. |
20:34:09 | Zevv | too late |
20:39:03 | Zevv | jerk |
20:39:08 | Yardanico | baka* |
20:39:28 | disruptek | heh |
20:40:32 | Zevv | one reason I took the cps code out of the macro: I was planning to make macros in middleware |
20:40:37 | Zevv | like .coroutine. |
20:40:44 | disruptek | makes sense. |
20:40:48 | Zevv | what would do cpsXfrm(MyCoroType, fn) |
20:41:09 | disruptek | i just want that as normal syntax. |
20:41:19 | Zevv | and my reasoning is: don't do in a macro what you can do in a proc |
20:41:23 | Zevv | yeah I want that too |
20:41:58 | disruptek | isn't that what -> is about? |
20:42:43 | Zevv | we'll see, we'll see. |
20:43:15 | Zevv | I decided to take the pragmatical route |
20:43:35 | Zevv | philosiphy is fine and all, but that doesn't bring usable code on the table |
20:43:35 | disruptek | well, why don't we just recurse directly in cpsXfrm then? |
20:44:18 | Zevv | I wasn't sure if it makes sense to transform nested procs |
20:44:24 | Zevv | so now it only picks up top level |
20:44:45 | Zevv | my goal is to put my whole source file under .cps. one day |
20:44:50 | Zevv | and only have the procs transformed that need to |
20:44:55 | disruptek | well, do it, then. |
20:45:05 | Zevv | yeah I know I know |
20:45:14 | disruptek | we'll make it work. it's no big deal. |
20:45:26 | disruptek | it's not like we don't have 0.0.13. |
20:45:57 | Zevv | but make sure to finish this before nim 2.0 |
20:46:02 | Zevv | because we need to rewrite half of the stdlib |
20:46:24 | disruptek | it's not a problem. |
20:46:56 | disruptek | when it goes into the compiler, it will cost almost nothing. |
20:47:43 | Zevv | sure |
20:50:01 | disruptek | i have to try to figure out how to get internet in this $godforsaken wilderness. |
20:50:39 | disruptek | got an opportunity to move to a camp on the side of a lake. |
20:50:51 | disruptek | but, i may have to shit in a hole for a few months. |
20:54:44 | Zevv | Id shit in a hole |
20:54:47 | shashlick | ugh - addr data instead of data was the bug |
20:54:48 | Zevv | as long as i had good internet |
20:54:53 | shashlick | waste of half a day |
20:55:07 | disruptek | ouch, shashlick |
20:55:19 | shashlick | okay so at least my code works |
20:55:19 | Zevv | wlel, you learned something new |
21:01:23 | FromDiscord | <Ricky Spanish> sent a code paste, see https://play.nim-lang.org/#ix=2twN |
21:01:40 | Yardanico | don't trust the "ide" |
21:01:46 | Yardanico | give us what the nim compiler says to you :) |
21:03:19 | FromDiscord | <Ricky Spanish> ok so firstly no warning at all when i dont use the build api example and i can use my library with nimble develop, with the examples code i get the line ``` Nothing to build. Did you specify a module to build using the `bin` key in your .nimble file?``` which is strange because im not trying to make a binary im trying to make a regular library that includes just a header and a dll downloaded from url |
21:04:21 | FromDiscord | <Ricky Spanish> sent a code paste, see https://play.nim-lang.org/#ix=2twQ |
21:08:40 | * | kenran quit (Remote host closed the connection) |
21:08:49 | * | vicfred joined #nim |
21:11:35 | * | solitudesf quit (Ping timeout: 256 seconds) |
21:11:56 | * | oddp quit (Ping timeout: 256 seconds) |
21:12:46 | disruptek | shashlick: when can i improve meowhash? |
21:12:49 | disruptek | er, import |
21:12:55 | disruptek | i don't want to improve it. ๐ |
21:13:23 | * | oddp joined #nim |
21:16:48 | shashlick | will post it shortly |
21:16:51 | shashlick | now that it works |
21:23:11 | shashlick | heh doesn't work again - might be an issue with file binary mode |
21:23:23 | shashlick | using open() on a file |
21:27:12 | * | arecacea1 quit (Remote host closed the connection) |
21:28:00 | * | arecacea1 joined #nim |
21:38:38 | * | narimiran quit (Ping timeout: 260 seconds) |
21:40:57 | shashlick | looks like nim already opens files in binary mode |
21:45:37 | shashlick | disruptek: https://gist.github.com/genotrance/bf4b389bc61b618cf53c727a0e55c44b meow hash wrapper |
21:51:59 | * | dulsi_ joined #nim |
21:54:49 | * | dulsi quit (Ping timeout: 264 seconds) |
21:55:02 | disruptek | sweet. i will try to put this into some stuff. |
21:55:58 | shashlick | we can repo it if needed |
21:56:11 | disruptek | turns out i have a repo from before. i will put you on it. |
21:57:23 | * | dulsi_ is now known as dulsi |
21:57:30 | disruptek | hah, it's empty |
21:57:58 | disruptek | it took 6 mos to make one commit. |
21:58:30 | shashlick | neat |
21:59:03 | disruptek | how is the speed? |
21:59:06 | * | vicfred quit (Quit: Leaving) |
21:59:23 | shashlick | https://github.com/genotrance/autodup is my current focus - cleaning up my dad's photo collection |
21:59:32 | shashlick | am about to try that now |
21:59:40 | disruptek | i have a parent like that. |
22:00:14 | shashlick | it worked well, used sha256 with async and threads but asynctools doesn't work anymore |
22:00:20 | shashlick | so moving to weave and sprucing it up a bit |
22:00:25 | disruptek | why doesn't it work? |
22:01:08 | disruptek | maybe you should try cps. this is kinda what it's for. |
22:01:47 | shashlick | i'd like that - basically hashing can be done async |
22:01:59 | shashlick | but cps needs to allow io without blocking |
22:02:09 | disruptek | of course. |
22:02:35 | shashlick | can you look at autodup - quite short |
22:02:55 | disruptek | yeah. |
22:04:31 | disruptek | this is really interesting. |
22:04:55 | disruptek | i mean, it will be a great test of cps to outperform weave's channel passing. |
22:05:05 | disruptek | doesn't it have a copy-free version? |
22:05:37 | shashlick | weave just uses nim's channels |
22:05:46 | disruptek | always? |
22:05:52 | disruptek | weird. |
22:10:26 | leorize[m] | didn't mratsim wrote a special Channel type for weave? |
22:10:40 | disruptek | i think he wrong a few. |
22:10:43 | disruptek | wrote, too. |
22:11:20 | disruptek | i have to look at it more closely. it hasn't been a thing i've had a use for. |
22:19:26 | * | arecacea1 quit (Remote host closed the connection) |
22:20:20 | * | arecacea1 joined #nim |
22:26:59 | * | Trustable quit (Remote host closed the connection) |
22:33:22 | * | Jjp137 quit (Quit: Leaving) |
22:42:55 | * | Jjp137 joined #nim |
22:55:52 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
23:10:18 | * | tane quit (Quit: Leaving) |
23:28:06 | * | endragor_ quit (Remote host closed the connection) |
23:33:01 | * | aenesidemus quit (Read error: Connection reset by peer) |
23:33:08 | * | endragor joined #nim |
23:56:23 | * | opal quit (Ping timeout: 240 seconds) |
23:57:33 | * | vicfred joined #nim |
23:58:17 | FromDiscord | <Varriount> @disruptek What's the performance of CPS currently like? |
23:58:17 | * | opal joined #nim |
23:58:18 | * | Jesin quit (Quit: Leaving) |
23:58:48 | disruptek | i dunno what to compare it to. |
23:59:20 | disruptek | zevv's echo server does about 150k tps in a single thread. |